From b4485ac19d490a1cd36d1aa9dd3eeed8076d0e89 Mon Sep 17 00:00:00 2001 From: Tobias Weimer Date: Sun, 19 Aug 2012 10:54:51 +0000 Subject: fixes for unicode fonts (fixed #18) Weather sounds are moved to its own group git-svn-id: http://svn.miranda-ng.org/main/trunk@1498 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Weather/weather.cpp | 8 +++--- protocols/Weather/weather_mwin.cpp | 44 ++++++++++++++++---------------- protocols/Weather/weather_opt.cpp | 16 ++++++------ protocols/Weather/weather_popup.cpp | 2 +- protocols/Weather/weather_svcs.cpp | 46 +++++++++++++++++----------------- protocols/Weather/weather_userinfo.cpp | 4 +-- 6 files changed, 60 insertions(+), 60 deletions(-) diff --git a/protocols/Weather/weather.cpp b/protocols/Weather/weather.cpp index feb928c8e0..75d93b621d 100644 --- a/protocols/Weather/weather.cpp +++ b/protocols/Weather/weather.cpp @@ -141,7 +141,7 @@ int WeatherInit(WPARAM wParam,LPARAM lParam) AddMenuItems(); // timer for the first update - timerId = SetTimer(NULL, 0, 5000, (TIMERPROC)timerProc2); // first update is 5 sec after load + timerId = SetTimer(NULL, 0, 5000, timerProc2); // first update is 5 sec after load // weather user detail hHooks[0] = HookEvent(ME_USERINFO_INITIALISE, UserInfoInit); @@ -210,7 +210,6 @@ extern "C" int __declspec(dllexport) Unload(void) extern "C" int __declspec(dllexport) Load(void) { - PROTOCOLDESCRIPTOR pd = {0}; DWORD lastver; @@ -258,6 +257,7 @@ extern "C" int __declspec(dllexport) Load(void) hUpdateMutex = CreateMutex(NULL, FALSE, NULL); // register weather protocol + PROTOCOLDESCRIPTOR pd = {0}; pd.cbSize = PROTOCOLDESCRIPTOR_V3_SIZE; pd.szName = WEATHERPROTONAME; pd.type = PROTOTYPE_PROTOCOL; @@ -270,8 +270,8 @@ extern "C" int __declspec(dllexport) Load(void) DBWriteContactSettingString(NULL, "KnownModules", "Weather Protocol", "Weather,WeatherCondition,Current"); // add sound event - SkinAddNewSoundEx("weatherupdated", NULL, LPGEN("Weather Condition Changed")); - SkinAddNewSoundEx("weatheralert", NULL, LPGEN("Weather Alert Issued")); + SkinAddNewSoundExT("weatherupdated", _T(WEATHERPROTONAME), LPGENT("Weather Condition Changed")); + SkinAddNewSoundExT("weatheralert", _T(WEATHERPROTONAME), LPGENT("Weather Alert Issued")); // window needed for popup commands TCHAR SvcFunc[100]; diff --git a/protocols/Weather/weather_mwin.cpp b/protocols/Weather/weather_mwin.cpp index 4e4fd125bd..1c1d3d3974 100644 --- a/protocols/Weather/weather_mwin.cpp +++ b/protocols/Weather/weather_mwin.cpp @@ -188,13 +188,13 @@ static LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara clr = DBGetContactSettingDword(NULL, WEATHERPROTONAME, "ColorMwinFrame", GetSysColor(COLOR_3DFACE)); { - FontID fntid = {0}; - strcpy(fntid.group, WEATHERPROTONAME); - strcpy(fntid.name, "Frame Font"); - fntc = CallService(MS_FONT_GET, (WPARAM)&fntid, (LPARAM)&lfnt); + FontIDT fntid = {0}; + _tcscpy(fntid.group, _T(WEATHERPROTONAME)); + _tcscpy(fntid.name, LPGENT("Frame Font")); + fntc = CallService(MS_FONT_GETT, (WPARAM)&fntid, (LPARAM)&lfnt); - strcpy(fntid.name, "Frame Title Font"); - fntc1 = CallService(MS_FONT_GET, (WPARAM)&fntid, (LPARAM)&lfnt1); + _tcscpy(fntid.name, LPGENT("Frame Title Font")); + fntc1 = CallService(MS_FONT_GETT, (WPARAM)&fntid, (LPARAM)&lfnt1); } DBGetContactSettingTString(data->hContact, WEATHERCONDITION, "WeatherInfo", &dbv); @@ -348,7 +348,7 @@ int RedrawFrame(WPARAM wParam, LPARAM lParam) void InitMwin(void) { HANDLE hContact; - HMODULE hUser = GetModuleHandleA("user32.dll"); + HMODULE hUser = GetModuleHandle(_T("user32.dll")); if (!ServiceExists(MS_CLIST_FRAMES_ADDFRAME)) return; @@ -373,21 +373,21 @@ void InitMwin(void) } { - ColourID colourid = {0}; - colourid.cbSize = sizeof(ColourID); + ColourIDT colourid = {0}; + colourid.cbSize = sizeof(ColourIDT); strcpy(colourid.dbSettingsGroup, WEATHERPROTONAME); strcpy(colourid.setting, "ColorMwinFrame"); - strcpy(colourid.name, "Frame Background"); - strcpy(colourid.group, WEATHERPROTONAME); + _tcscpy(colourid.name, LPGENT("Frame Background")); + _tcscpy(colourid.group, _T(WEATHERPROTONAME)); colourid.defcolour = GetSysColor(COLOR_3DFACE); - ColourRegister(&colourid); + ColourRegisterT(&colourid); - FontID fontid = {0}; - fontid.cbSize = sizeof(FontID); + FontIDT fontid = {0}; + fontid.cbSize = sizeof(FontIDT); fontid.flags = FIDF_ALLOWREREGISTER | FIDF_DEFAULTVALID; strcpy(fontid.dbSettingsGroup, WEATHERPROTONAME); - strcpy(fontid.group, WEATHERPROTONAME); - strcpy(fontid.name, "Frame Font"); + _tcscpy(fontid.group, _T(WEATHERPROTONAME)); + _tcscpy(fontid.name, LPGENT("Frame Font")); strcpy(fontid.prefix, "fnt0"); HDC hdc = GetDC(NULL); @@ -395,15 +395,15 @@ void InitMwin(void) ReleaseDC(0, hdc); fontid.deffontsettings.charset = DEFAULT_CHARSET; - strcpy(fontid.deffontsettings.szFace, "Verdana"); - strcpy(fontid.backgroundGroup, WEATHERPROTONAME); - strcpy(fontid.backgroundName, "Frame Background"); - FontRegister(&fontid); + _tcscpy(fontid.deffontsettings.szFace, _T("Verdana")); + _tcscpy(fontid.backgroundGroup, _T(WEATHERPROTONAME)); + _tcscpy(fontid.backgroundName, LPGENT("Frame Background")); + FontRegisterT(&fontid); fontid.deffontsettings.style = DBFONTF_BOLD; - strcpy(fontid.name, "Frame Title Font"); + _tcscpy(fontid.name, LPGENT("Frame Title Font")); strcpy(fontid.prefix, "fnt1"); - FontRegister(&fontid); + FontRegisterT(&fontid); } hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0); diff --git a/protocols/Weather/weather_opt.cpp b/protocols/Weather/weather_opt.cpp index 6571df6f3f..b6eda4fb94 100644 --- a/protocols/Weather/weather_opt.cpp +++ b/protocols/Weather/weather_opt.cpp @@ -287,25 +287,25 @@ int OptInit(WPARAM wParam,LPARAM lParam) { odp.position = 95600; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS); odp.pfnDlgProc = OptionsProc; - odp.pszGroup = LPGEN("Network"); - odp.pszTitle = WEATHERPROTOTEXT; - odp.pszTab = LPGEN("General"); - odp.flags = ODPF_BOLDGROUPS; + odp.ptszGroup = LPGENT("Network"); + odp.ptszTitle = _T(WEATHERPROTOTEXT); + odp.ptszTab = LPGENT("General"); + odp.flags = ODPF_BOLDGROUPS|ODPF_TCHAR; Options_AddPage(wParam, &odp); // text options odp.pszTemplate = MAKEINTRESOURCEA(IDD_TEXTOPT); odp.pfnDlgProc = DlgProcText; - odp.pszTab = LPGEN("Display"); + odp.ptszTab = LPGENT("Display"); Options_AddPage(wParam, &odp); // if popup service exists, load the weather popup options - if ((ServiceExists(MS_POPUP_ADDPOPUP))) { + if ((ServiceExists(MS_POPUP_ADDPOPUPT))) { odp.position = 100000000; odp.pszTemplate = MAKEINTRESOURCEA(IDD_POPUP); - odp.pszGroup = LPGEN("PopUps"); + odp.ptszGroup = LPGENT("PopUps"); odp.groupPosition = 910000000; - odp.pszTab = NULL; + odp.ptszTab = NULL; odp.pfnDlgProc = DlgPopUpOpts; Options_AddPage(wParam, &odp); } diff --git a/protocols/Weather/weather_popup.cpp b/protocols/Weather/weather_popup.cpp index de9be80b6e..6b6b1d4ebd 100644 --- a/protocols/Weather/weather_popup.cpp +++ b/protocols/Weather/weather_popup.cpp @@ -47,7 +47,7 @@ int WeatherPopup(WPARAM wParam, LPARAM lParam) ppd.PluginData = ppd.lchIcon = LoadSkinnedProtoIcon(WEATHERPROTONAME, winfo.status); GetDisplay(&winfo, opt.pTitle, ppd.lptzContactName); GetDisplay(&winfo, opt.pText, ppd.lptzText); - ppd.PluginWindowProc = (WNDPROC)PopupDlgProc; + ppd.PluginWindowProc = PopupDlgProc; // } // else { // for preview // ppd.lchIcon = LoadSkinnedProtoIcon(WEATHERPROTONAME, ONLINE); diff --git a/protocols/Weather/weather_svcs.cpp b/protocols/Weather/weather_svcs.cpp index 0ded709fcc..1125ba8fb1 100644 --- a/protocols/Weather/weather_svcs.cpp +++ b/protocols/Weather/weather_svcs.cpp @@ -250,18 +250,18 @@ void UpdateMenu(BOOL State) if (State) { // to enable auto-update - mi.pszName = "Auto Update Enabled"; + mi.ptszName = LPGENT("Auto Update Enabled"); mi.icolibItem = GetIconHandle("main"); } else { // to disable auto-update - mi.pszName = "Auto Update Disabled"; + mi.ptszName = LPGENT("Auto Update Disabled"); mi.icolibItem = GetIconHandle("disabled"); } // update option setting opt.CAutoUpdate = State; DBWriteContactSettingByte(NULL, WEATHERPROTONAME, "AutoUpdate", (BYTE)opt.AutoUpdate); - mi.flags = CMIM_ICON | CMIM_NAME | CMIF_ICONFROMICOLIB; + mi.flags = CMIM_ICON | CMIM_NAME | CMIF_ICONFROMICOLIB | CMIF_TCHAR; // update menu item CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)hEnableDisableMenu,(LPARAM)&mi); @@ -282,18 +282,18 @@ void UpdatePopupMenu(BOOL State) if (State) { // to enable popup - mi.pszName = "Disable &weather notification"; + mi.ptszName = LPGENT("Disable &weather notification"); mi.icolibItem = GetIconHandle("popup"); } else { // to disable popup - mi.pszName = "Enable &weather notification"; + mi.ptszName = LPGENT("Enable &weather notification"); mi.icolibItem = GetIconHandle("nopopup"); } // update option setting opt.UsePopup = State; DBWriteContactSettingByte(NULL, WEATHERPROTONAME, "UsePopUp", (BYTE)opt.UsePopup); - mi.flags = CMIM_ICON | CMIM_NAME | CMIF_ICONFROMICOLIB; + mi.flags = CMIM_ICON | CMIM_NAME | CMIF_ICONFROMICOLIB | CMIF_TCHAR; // update menu item CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)hEnableDisablePopupMenu,(LPARAM)&mi); @@ -321,64 +321,64 @@ void AddMenuItems(void) mi.cbSize = sizeof(mi); mi.pszContactOwner = WEATHERPROTONAME; - mi.flags = CMIF_ICONFROMICOLIB; + mi.flags = CMIF_ICONFROMICOLIB|CMIF_TCHAR; // contact menu hService[15] = CreateServiceFunction(MS_WEATHER_UPDATE, UpdateSingleStation); mi.position = -0x7FFFFFFA; mi.icolibItem = GetIconHandle("update"); - mi.pszName = "Update Weather"; + mi.ptszName = LPGENT("Update Weather"); mi.pszService = MS_WEATHER_UPDATE; Menu_AddContactMenuItem(&mi); hService[16] = CreateServiceFunction(MS_WEATHER_REFRESH, UpdateSingleRemove); mi.position = -0x7FFFFFF9; mi.icolibItem = GetIconHandle("update2"); - mi.pszName = "Remove Old Data then Update"; + mi.ptszName = LPGENT("Remove Old Data then Update"); mi.pszService = MS_WEATHER_REFRESH; Menu_AddContactMenuItem(&mi); hService[17] = CreateServiceFunction(MS_WEATHER_BRIEF, BriefInfoSvc); mi.position = -0x7FFFFFF8; mi.icolibItem = GetIconHandle("brief"); - mi.pszName = "Brief Information"; + mi.ptszName = LPGENT("Brief Information"); mi.pszService = MS_WEATHER_BRIEF; Menu_AddContactMenuItem(&mi); hService[18] = CreateServiceFunction(MS_WEATHER_COMPLETE, LoadForecast); mi.position = -0x7FFFFFF7; mi.icolibItem = GetIconHandle("read"); - mi.pszName = "Read Complete Forecast"; + mi.ptszName = LPGENT("Read Complete Forecast"); mi.pszService = MS_WEATHER_COMPLETE; Menu_AddContactMenuItem(&mi); hService[19] = CreateServiceFunction(MS_WEATHER_MAP, WeatherMap); mi.position = -0x7FFFFFF6; mi.icolibItem = GetIconHandle("map"); - mi.pszName = "Weather Map"; + mi.ptszName = LPGENT("Weather Map"); mi.pszService = MS_WEATHER_MAP; Menu_AddContactMenuItem(&mi); hService[20] = CreateServiceFunction(MS_WEATHER_LOG, ViewLog); mi.position = -0x7FFFFFF5; mi.icolibItem = GetIconHandle("log"); - mi.pszName = "View Log"; + mi.ptszName = LPGENT("View Log"); mi.pszService = MS_WEATHER_LOG; Menu_AddContactMenuItem(&mi); hService[21] = CreateServiceFunction(MS_WEATHER_EDIT, EditSettings); mi.position = -0x7FFFFFF4; mi.icolibItem = GetIconHandle("edit"); - mi.pszName = "Edit Settings"; + mi.ptszName = LPGENT("Edit Settings"); mi.pszService = MS_WEATHER_EDIT; Menu_AddContactMenuItem(&mi); // adding main menu items - mi.pszPopupName = "Weather"; + mi.ptszPopupName = LPGENT("Weather"); mi.popupPosition = 500099000; hService[22] = CreateServiceFunction(MS_WEATHER_ENABLED, EnableDisableCmd); - mi.pszName = "Enable/Disable Weather Update"; + mi.ptszName = LPGENT("Enable/Disable Weather Update"); mi.icolibItem = GetIconHandle("main"); mi.position = 10100001; mi.pszService = MS_WEATHER_ENABLED; @@ -388,24 +388,24 @@ void AddMenuItems(void) hService[23] = CreateServiceFunction(MS_WEATHER_UPDATEALL, UpdateAllInfo); mi.position = 20100001; mi.icolibItem = GetIconHandle("update"); - mi.pszName = "Update All Weather"; + mi.ptszName = LPGENT("Update All Weather"); mi.pszService = MS_WEATHER_UPDATEALL; Menu_AddMainMenuItem(&mi); hService[24] = CreateServiceFunction(MS_WEATHER_REFRESHALL, UpdateAllRemove); mi.position = 20100002; mi.icolibItem = GetIconHandle("update2"); - mi.pszName = "Remove Old Data then Update All"; + mi.ptszName = LPGENT("Remove Old Data then Update All"); mi.pszService = MS_WEATHER_REFRESHALL; Menu_AddMainMenuItem(&mi); // only run if popup service exists - if (ServiceExists(MS_POPUP_ADDPOPUP)) { + if (ServiceExists(MS_POPUP_ADDPOPUPT)) { hService[25] = CreateServiceFunction(WEATHERPROTONAME "/PopupMenu", MenuitemNotifyCmd); - mi.pszName = "Weather Notification"; + mi.ptszName = LPGENT("Weather Notification"); mi.icolibItem = GetIconHandle("popup"); mi.position = 0; - mi.pszPopupName = "PopUps"; + mi.ptszPopupName = LPGENT("PopUps"); mi.pszService = WEATHERPROTONAME "/PopupMenu"; hEnableDisablePopupMenu = Menu_AddMainMenuItem(&mi); UpdatePopupMenu(opt.UsePopup); @@ -415,8 +415,8 @@ void AddMenuItems(void) hService[26] = CreateServiceFunction("Weather/mwin_menu", Mwin_MenuClicked); mi.position = -0x7FFFFFF0; mi.hIcon = NULL; - mi.flags = 0; - mi.pszName = "Display in a frame"; + mi.flags = CMIF_TCHAR; + mi.ptszName = LPGENT("Display in a frame"); mi.pszService = "Weather/mwin_menu"; hMwinMenu = Menu_AddContactMenuItem(&mi); } diff --git a/protocols/Weather/weather_userinfo.cpp b/protocols/Weather/weather_userinfo.cpp index 055fdb9fed..c00be9e018 100644 --- a/protocols/Weather/weather_userinfo.cpp +++ b/protocols/Weather/weather_userinfo.cpp @@ -38,7 +38,7 @@ int UserInfoInit(WPARAM wParam, LPARAM lParam) odp.cbSize = sizeof(odp); odp.hInstance = hInst; odp.position = 100000000; - odp.pszTitle = LPGEN(WEATHERPROTONAME); + odp.ptszTitle = _T(WEATHERPROTONAME); if (lParam == 0) { @@ -54,7 +54,7 @@ int UserInfoInit(WPARAM wParam, LPARAM lParam) // register the contact info page odp.pszTemplate = MAKEINTRESOURCEA(IDD_USERINFO); odp.pfnDlgProc = DlgProcUIPage; - odp.flags = ODPF_BOLDGROUPS; + odp.flags = ODPF_BOLDGROUPS|ODPF_TCHAR; UserInfo_AddPage(wParam, &odp); } } -- cgit v1.2.3