diff options
author | (no author) <(no author)@4f64403b-2f21-0410-a795-97e2b3489a10> | 2010-04-05 05:44:52 +0000 |
---|---|---|
committer | (no author) <(no author)@4f64403b-2f21-0410-a795-97e2b3489a10> | 2010-04-05 05:44:52 +0000 |
commit | 9a8ea65ccec0256ecda95581edd69c8d91020867 (patch) | |
tree | a6614ace0f554686f44e11af80390a98977ce0bc | |
parent | 70ee49c6aa80f3dd35078321fc4807fcd55353fc (diff) |
Added x64 port
Converted to Unicode
Reduced size
git-svn-id: https://server.scottellis.com.au/svn/mim_plugs@494 4f64403b-2f21-0410-a795-97e2b3489a10
-rw-r--r-- | worldtime/WorldTime.cpp | 32 | ||||
-rw-r--r-- | worldtime/WorldTime.h | 17 | ||||
-rw-r--r-- | worldtime/WorldTime.rc | 86 | ||||
-rw-r--r-- | worldtime/WorldTime_9.sln | 6 | ||||
-rw-r--r-- | worldtime/WorldTime_9.vcproj | 322 | ||||
-rw-r--r-- | worldtime/common.h | 44 | ||||
-rw-r--r-- | worldtime/options.cpp | 110 | ||||
-rw-r--r-- | worldtime/plugwin.cpp | 181 | ||||
-rw-r--r-- | worldtime/plugwin.h | 40 | ||||
-rw-r--r-- | worldtime/resource.h | 13 | ||||
-rw-r--r-- | worldtime/timezone.cpp | 28 | ||||
-rw-r--r-- | worldtime/timezone.h | 19 |
12 files changed, 558 insertions, 340 deletions
diff --git a/worldtime/WorldTime.cpp b/worldtime/WorldTime.cpp index 5978cba..5451e94 100644 --- a/worldtime/WorldTime.cpp +++ b/worldtime/WorldTime.cpp @@ -18,21 +18,8 @@ PLUGININFOEX pluginInfo={ { 0x6e8c83d3, 0x418e, 0x4cec, { 0xb3, 0x4e, 0xed, 0x61, 0x3f, 0x51, 0xae, 0x58 } } // {6E8C83D3-418E-4cec-B34E-ED613F51AE58}
};
-int winver = 0;
-
-#define VER_9X 1
-#define VER_NT40 2
-#define VER_2KXP 3
-
-void detect_win_version() {
- OSVERSIONINFO version;
-
- version.dwOSVersionInfoSize = sizeof(version);
- GetVersionEx(&version);
-
- winver = (version.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) ? VER_9X
- : (version.dwMajorVersion == 4) ? VER_NT40 : VER_2KXP;
-}
+MM_INTERFACE mmi;
+LIST_INTERFACE li;
extern "C" BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvReserved)
@@ -67,7 +54,7 @@ static int OnModulesLoaded(WPARAM wParam, LPARAM lParam) { update.szComponentName = pluginInfo.shortName;
update.pbVersion = (BYTE *)CreateVersionString(pluginInfo.version, szVersion);
- update.cpbVersion = strlen((char *)update.pbVersion);
+ update.cpbVersion = (int)strlen((char *)update.pbVersion);
update.szUpdateURL = UPDATER_AUTOREGISTER;
@@ -79,7 +66,7 @@ static int OnModulesLoaded(WPARAM wParam, LPARAM lParam) { update.szBetaVersionURL = "http://www.scottellis.com.au/miranda_plugins/ver_worldtime.html";
update.pbBetaVersionPrefix = (BYTE *)"World Time version ";
- update.cpbBetaVersionPrefix = strlen((char *)update.pbBetaVersionPrefix);
+ update.cpbBetaVersionPrefix = (int)strlen((char *)update.pbBetaVersionPrefix);
CallService(MS_UPDATE_REGISTER, 0, (WPARAM)&update);
}
@@ -95,13 +82,8 @@ extern "C" WORLDTIME_API int Load(PLUGINLINK *link) {
pluginLink=link;
-/*
- detect_win_version();
- if(winver < 2) {
- MessageBox(0, "Sorry, this plugin does not work on Win9x (yet).\nPlugin disabled.", "World Time", MB_ICONERROR | MB_OK);
- return 0;
- }
-*/
+ mir_getMMI(&mmi);
+ mir_getLI(&li);
// ensure datetime picker is loaded
INITCOMMONCONTROLSEX ccx = {0};
@@ -118,7 +100,7 @@ extern "C" WORLDTIME_API int Load(PLUGINLINK *link) HookEvent( ME_OPT_INITIALISE, WorldTimeOptInit );
} else {
- MessageBox(0, "Unable to read timezone information.\nPlugin disabled.", "World Time", MB_ICONERROR | MB_OK);
+ MessageBox(0, _T("Unable to read timezone information.\nPlugin disabled."), _T("World Time"), MB_ICONERROR | MB_OK);
}
return 0;
diff --git a/worldtime/WorldTime.h b/worldtime/WorldTime.h index 595f20f..1ab795c 100644 --- a/worldtime/WorldTime.h +++ b/worldtime/WorldTime.h @@ -17,21 +17,10 @@ #include "plugwin.h"
#include "timezone.h"
-//#include "../../include/newpluginapi.h"
#include <m_clui.h>
-#include <m_system.h>
#include <m_options.h>
-#include <m_protocols.h>
-#include <m_protomod.h>
-#include <m_protosvc.h>
-
-#include <m_updater.h>
-
-//#include "../../include/m_clist.h"
-//#include "../../include/m_skin.h"
-//#include "../../include/m_cluiframes.h"
-//#include "../../include/m_netlib.h"
+#include "m_updater.h"
extern HINSTANCE hInst;
extern PLUGINLINK *pluginLink;
@@ -41,4 +30,8 @@ extern "C" WORLDTIME_API PLUGININFO* MirandaPluginInfo(DWORD mirandaVersion); extern "C" WORLDTIME_API int Load(PLUGINLINK *link);
extern "C" WORLDTIME_API int Unload(void);
+#ifndef MIID_WORLDTIME
+#define MIID_WORLDTIME {0x5e436914, 0x3258, 0x4dfa, { 0x8a, 0xd9, 0xf2, 0xcd, 0x26, 0x43, 0x6f, 0x1}}
+#endif
+
#endif
\ No newline at end of file diff --git a/worldtime/WorldTime.rc b/worldtime/WorldTime.rc index 7fce92b..9967fb8 100644 --- a/worldtime/WorldTime.rc +++ b/worldtime/WorldTime.rc @@ -1,4 +1,4 @@ -//Microsoft Developer Studio generated resource script.
+// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
@@ -27,18 +27,18 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US // TEXTINCLUDE
//
-1 TEXTINCLUDE MOVEABLE PURE
+1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
-2 TEXTINCLUDE MOVEABLE PURE
+2 TEXTINCLUDE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
-3 TEXTINCLUDE MOVEABLE PURE
+3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
@@ -67,83 +67,61 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_AUS IDD_DIALOG1 DIALOGEX 0, 0, 327, 255
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CENTER | WS_CHILD
EXSTYLE WS_EX_CONTROLPARENT
-FONT 8, "MS Shell Dlg"
+FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
GROUPBOX "Configuration",IDC_STATIC,7,7,313,241
GROUPBOX "Interface",IDC_STATIC,28,16,272,75
- CONTROL "Show/hide with contact list (*if set, show/hide menu item has no effect)",
- IDC_CHK_MINMAX,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,34,
- 27,260,10
+ CONTROL "Show/hide with contact list (*if set, show/hide menu item has no effect)",IDC_CHK_MINMAX,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,34,27,260,10
GROUPBOX "Times",IDC_STATIC,28,155,272,87
- LISTBOX IDC_LIST_TIMES2,53,169,221,43,LBS_NOINTEGRALHEIGHT |
- WS_VSCROLL | WS_TABSTOP
+ LISTBOX IDC_LIST_TIMES2,53,169,221,43,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "Remove",IDC_BTN_REM,143,219,42,16,WS_DISABLED
- CONTROL "Format Date",IDC_CHK_FORMAT,"Button",BS_AUTOCHECKBOX |
- WS_TABSTOP,34,59,72,10
+ CONTROL "Format Date",IDC_CHK_FORMAT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,34,59,72,10
EDITTEXT IDC_ED_FORMAT,211,58,78,12,ES_AUTOHSCROLL
CTEXT "and Time",IDC_STATIC,166,60,41,8
EDITTEXT IDC_ED_DATE_FORMAT,111,58,51,12,ES_AUTOHSCROLL
- CONTROL "Show icons",IDC_CHK_ICONS,"Button",BS_AUTOCHECKBOX |
- WS_TABSTOP,34,75,116,10
+ CONTROL "Show icons",IDC_CHK_ICONS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,34,75,116,10
PUSHBUTTON "Edit",IDC_BTN_EDIT,94,219,42,16,WS_DISABLED
PUSHBUTTON "Add",IDC_BTN_ADD,45,219,42,16
PUSHBUTTON "Up",IDC_BTN_UP,192,219,42,16,WS_DISABLED
PUSHBUTTON "Down",IDC_BTN_DOWN,241,219,42,16,WS_DISABLED
- CONTROL "Hide main menu item (requires restart)",
- IDC_CHK_HIDEMENU,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,
- 34,43,170,10
+ CONTROL "Hide main menu item (requires restart)",IDC_CHK_HIDEMENU,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,34,43,170,10
PUSHBUTTON "Show Window",IDC_BTN_SHOW,211,40,78,13
GROUPBOX "List",IDC_STATIC,28,94,272,59
RTEXT "Font size:",IDC_STATICH,36,111,45,8
- EDITTEXT IDC_ED_FSIZE,86,109,32,14,ES_AUTOHSCROLL | ES_NUMBER,
- WS_EX_RIGHT
- CONTROL "Spin1",IDC_SPIN1,"msctls_updown32",UDS_SETBUDDYINT |
- UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,118,108,
- 12,15
- CONTROL "Custom1",IDC_TEXTCOL,"ColourPicker",WS_TABSTOP,164,117,
- 40,9
+ EDITTEXT IDC_ED_FSIZE,86,109,32,14,ES_AUTOHSCROLL | ES_NUMBER,WS_EX_RIGHT
+ CONTROL "Spin1",IDC_SPIN1,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,118,108,12,15
+ CONTROL "Custom1",IDC_TEXTCOL,"ColourPicker",WS_TABSTOP,164,117,40,9
CTEXT "Text",IDC_STATICH2,161,105,44,9
- CONTROL "Custom1",IDC_BGCOL,"ColourPicker",WS_TABSTOP,217,117,40,
- 9
+ CONTROL "Custom1",IDC_BGCOL,"ColourPicker",WS_TABSTOP,217,117,40,9
CTEXT "Background",IDC_STATIC,212,105,53,9
- LTEXT "Use the Customize/Fonts options to change text size and colour",
- IDC_STATFS,39,107,174,31,NOT WS_VISIBLE
+ LTEXT "Use the Customize/Fonts options to change text size and colour",IDC_STATFS,39,107,174,31,NOT WS_VISIBLE
RTEXT "Indent:",IDC_STATIC,37,136,42,8
EDITTEXT IDC_EDIT1,86,133,33,15,ES_AUTOHSCROLL
- CONTROL "Spin2",IDC_SP_INDENT,"msctls_updown32",UDS_SETBUDDYINT |
- UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,118,133,
- 12,15
+ CONTROL "Spin2",IDC_SP_INDENT,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,118,133,12,15
RTEXT "Row height:",IDC_STATIC,144,136,60,8
EDITTEXT IDC_EDIT2,214,133,33,15,ES_AUTOHSCROLL
- CONTROL "Spin3",IDC_SP_ROWHEIGHT,"msctls_updown32",
- UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY |
- UDS_ARROWKEYS,247,133,12,15
+ CONTROL "Spin3",IDC_SP_ROWHEIGHT,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,247,133,12,15
END
-IDD_DIALOG2 DIALOG DISCARDABLE 0, 0, 296, 223
-STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
+IDD_DIALOG2 DIALOG 0, 0, 296, 223
+STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Time Details"
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "OK",IDOK,95,202,50,14,WS_DISABLED
PUSHBUTTON "Cancel",IDCANCEL,150,202,50,14
- LISTBOX IDC_LIST_TIMES,43,39,208,46,LBS_NOINTEGRALHEIGHT |
- WS_VSCROLL | WS_TABSTOP
+ LISTBOX IDC_LIST_TIMES,43,39,208,46,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
EDITTEXT IDC_ED_DISP,43,92,208,14,ES_AUTOHSCROLL | ES_READONLY
LTEXT "Label:",IDC_STATIC,68,123,20,8
EDITTEXT IDC_ED_LABEL,94,121,133,14,ES_AUTOHSCROLL | WS_DISABLED
- CONTROL "Alphabetical",IDC_RAD_ALPHA,"Button",BS_AUTORADIOBUTTON,
- 88,25,55,10
- CONTROL "Geographical",IDC_RAD_GEO,"Button",BS_AUTORADIOBUTTON,
- 151,25,58,10
+ CONTROL "Alphabetical",IDC_RAD_ALPHA,"Button",BS_AUTORADIOBUTTON,88,25,55,10
+ CONTROL "Geographical",IDC_RAD_GEO,"Button",BS_AUTORADIOBUTTON,151,25,58,10
LTEXT "Sort Order:",IDC_STATIC,44,25,35,8
- CONTROL "DateTimePicker1",IDC_TIME_SUNRISE,"SysDateTimePick32",
- DTS_RIGHTALIGN | DTS_UPDOWN | WS_TABSTOP | 0x8,119,153,
- 90,15
+ CONTROL "DateTimePicker1",IDC_TIME_SUNRISE,"SysDateTimePick32",DTS_RIGHTALIGN | DTS_UPDOWN | WS_TABSTOP | 0x8,119,153,90,15
RTEXT "Sunrise:",IDC_STATIC,49,155,54,8
- CONTROL "DateTimePicker1",IDC_TIME_SUNSET,"SysDateTimePick32",
- DTS_RIGHTALIGN | DTS_UPDOWN | WS_TABSTOP | 0x8,119,173,
- 90,15
+ CONTROL "DateTimePicker1",IDC_TIME_SUNSET,"SysDateTimePick32",DTS_RIGHTALIGN | DTS_UPDOWN | WS_TABSTOP | 0x8,119,173,90,15
RTEXT "Sunset:",IDC_STATIC,49,176,54,8
END
@@ -154,7 +132,7 @@ END //
#ifdef APSTUDIO_INVOKED
-GUIDELINES DESIGNINFO MOVEABLE PURE
+GUIDELINES DESIGNINFO
BEGIN
IDD_DIALOG1, DIALOG
BEGIN
@@ -180,7 +158,7 @@ END // Menu
//
-IDR_CONTEXT MENU DISCARDABLE
+IDR_CONTEXT MENU
BEGIN
MENUITEM "", 65535
POPUP "test menu"
@@ -197,10 +175,10 @@ END // Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
-IDI_ICON_SUN ICON DISCARDABLE "day.ico"
-IDI_ICON_SUNSET ICON DISCARDABLE "sunset.ico"
-IDI_ICON_MOON ICON DISCARDABLE "night.ico"
-IDI_ICON_SUNRISE ICON DISCARDABLE "sunrise.ico"
+IDI_ICON_SUN ICON "day.ico"
+IDI_ICON_SUNSET ICON "sunset.ico"
+IDI_ICON_MOON ICON "night.ico"
+IDI_ICON_SUNRISE ICON "sunrise.ico"
#endif // English (Australia) resources
/////////////////////////////////////////////////////////////////////////////
diff --git a/worldtime/WorldTime_9.sln b/worldtime/WorldTime_9.sln index 4de1626..b6b3941 100644 --- a/worldtime/WorldTime_9.sln +++ b/worldtime/WorldTime_9.sln @@ -6,13 +6,19 @@ EndProject Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
+ Debug|x64 = Debug|x64
Release|Win32 = Release|Win32
+ Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{5F370DEE-3F8E-4BA1-BC2C-2B040691BD18}.Debug|Win32.ActiveCfg = Debug|Win32
{5F370DEE-3F8E-4BA1-BC2C-2B040691BD18}.Debug|Win32.Build.0 = Debug|Win32
+ {5F370DEE-3F8E-4BA1-BC2C-2B040691BD18}.Debug|x64.ActiveCfg = Debug|x64
+ {5F370DEE-3F8E-4BA1-BC2C-2B040691BD18}.Debug|x64.Build.0 = Debug|x64
{5F370DEE-3F8E-4BA1-BC2C-2B040691BD18}.Release|Win32.ActiveCfg = Release|Win32
{5F370DEE-3F8E-4BA1-BC2C-2B040691BD18}.Release|Win32.Build.0 = Release|Win32
+ {5F370DEE-3F8E-4BA1-BC2C-2B040691BD18}.Release|x64.ActiveCfg = Release|x64
+ {5F370DEE-3F8E-4BA1-BC2C-2B040691BD18}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/worldtime/WorldTime_9.vcproj b/worldtime/WorldTime_9.vcproj index 276b992..12cf731 100644 --- a/worldtime/WorldTime_9.vcproj +++ b/worldtime/WorldTime_9.vcproj @@ -12,6 +12,9 @@ <Platform
Name="Win32"
/>
+ <Platform
+ Name="x64"
+ />
</Platforms>
<ToolFiles>
</ToolFiles>
@@ -49,21 +52,24 @@ />
<Tool
Name="VCCLCompilerTool"
- Optimization="2"
+ Optimization="1"
InlineFunctionExpansion="1"
+ EnableIntrinsicFunctions="true"
+ FavorSizeOrSpeed="2"
+ WholeProgramOptimization="true"
AdditionalIncludeDirectories="../../include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;WORLDTIME_EXPORTS"
StringPooling="true"
- RuntimeLibrary="0"
+ ExceptionHandling="0"
+ RuntimeLibrary="2"
+ BufferSecurityCheck="false"
EnableFunctionLevelLinking="true"
+ FloatingPointModel="2"
+ RuntimeTypeInfo="false"
UsePrecompiledHeader="2"
PrecompiledHeaderThrough="common.h"
- AssemblerListingLocation=".\Release/"
- ObjectFile=".\Release/"
- ProgramDataBaseFileName=".\Release/"
WarningLevel="3"
SuppressStartupBanner="true"
- DisableSpecificWarnings="4996"
/>
<Tool
Name="VCManagedResourceCompilerTool"
@@ -78,14 +84,13 @@ />
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="comctl32.lib odbc32.lib odbccp32.lib"
+ AdditionalDependencies="comctl32.lib"
LinkIncremental="1"
SuppressStartupBanner="true"
- ProgramDatabaseFile=".\Release/WorldTime.pdb"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
BaseAddress="0x22070000"
RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
- ImportLibrary="$(IntDir)/$(TargetName).lib"
TargetMachine="1"
/>
<Tool
@@ -208,6 +213,201 @@ Name="VCPostBuildEventTool"
/>
</Configuration>
+ <Configuration
+ Name="Release|x64"
+ OutputDirectory="$(ConfigurationName)64"
+ IntermediateDirectory="$(ConfigurationName)64"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="NDEBUG"
+ MkTypLibCompatible="true"
+ SuppressStartupBanner="true"
+ TargetEnvironment="3"
+ TypeLibraryName=".\Release/WorldTime.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="1"
+ InlineFunctionExpansion="1"
+ EnableIntrinsicFunctions="true"
+ FavorSizeOrSpeed="2"
+ WholeProgramOptimization="true"
+ AdditionalIncludeDirectories="../../../include"
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;WORLDTIME_EXPORTS;_USRDLL;_CRT_SECURE_NO_WARNINGS"
+ StringPooling="true"
+ ExceptionHandling="0"
+ RuntimeLibrary="2"
+ BufferSecurityCheck="false"
+ EnableFunctionLevelLinking="true"
+ FloatingPointModel="2"
+ RuntimeTypeInfo="false"
+ UsePrecompiledHeader="2"
+ PrecompiledHeaderThrough="common.h"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="3081"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="comctl32.lib"
+ LinkIncremental="1"
+ SuppressStartupBanner="true"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ BaseAddress="0x22070000"
+ RandomizedBaseAddress="1"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ SuppressStartupBanner="true"
+ OutputFile=".\Release/WorldTime.bsc"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|x64"
+ OutputDirectory="$(ConfigurationName)64"
+ IntermediateDirectory="$(ConfigurationName)64"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+ UseOfMFC="2"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="_DEBUG"
+ MkTypLibCompatible="true"
+ SuppressStartupBanner="true"
+ TargetEnvironment="3"
+ TypeLibraryName=".\Debug/WorldTime.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../include"
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;WORLDTIME_EXPORTS;_CRT_SECURE_NO_WARNINGS"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="2"
+ PrecompiledHeaderThrough="common.h"
+ AssemblerListingLocation=".\Debug/"
+ ObjectFile=".\Debug/"
+ ProgramDataBaseFileName=".\Debug/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="3"
+ DisableSpecificWarnings="4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="3081"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="user32.lib gdi32.lib shell32.lib advapi32.lib comctl32.lib"
+ LinkIncremental="2"
+ SuppressStartupBanner="true"
+ GenerateDebugInformation="true"
+ ProgramDatabaseFile=".\Debug/WorldTime.pdb"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ ImportLibrary="$(IntDir)/$(TargetName).lib"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ SuppressStartupBanner="true"
+ OutputFile=".\Debug/WorldTime.bsc"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
</Configurations>
<References>
</References>
@@ -235,6 +435,22 @@ PreprocessorDefinitions=""
/>
</FileConfiguration>
+ <FileConfiguration
+ Name="Release|x64"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|x64"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
</File>
<File
RelativePath="plugwin.cpp"
@@ -255,6 +471,22 @@ PreprocessorDefinitions=""
/>
</FileConfiguration>
+ <FileConfiguration
+ Name="Release|x64"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|x64"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
</File>
<File
RelativePath="time_convert.cpp"
@@ -275,6 +507,22 @@ PreprocessorDefinitions=""
/>
</FileConfiguration>
+ <FileConfiguration
+ Name="Release|x64"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|x64"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
</File>
<File
RelativePath="timezone.cpp"
@@ -295,6 +543,22 @@ PreprocessorDefinitions=""
/>
</FileConfiguration>
+ <FileConfiguration
+ Name="Release|x64"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|x64"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
</File>
<File
RelativePath="WorldTime.cpp"
@@ -317,6 +581,24 @@ UsePrecompiledHeader="1"
/>
</FileConfiguration>
+ <FileConfiguration
+ Name="Release|x64"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|x64"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
</File>
</Filter>
<Filter
@@ -332,6 +614,10 @@ >
</File>
<File
+ RelativePath=".\resource.h"
+ >
+ </File>
+ <File
RelativePath="time_convert.h"
>
</File>
@@ -415,6 +701,22 @@ PreprocessorDefinitions=""
/>
</FileConfiguration>
+ <FileConfiguration
+ Name="Release|x64"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|x64"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
</File>
</Filter>
<File
diff --git a/worldtime/common.h b/worldtime/common.h index cb5a041..f43e636 100644 --- a/worldtime/common.h +++ b/worldtime/common.h @@ -1,32 +1,36 @@ -// stdafx.h : include file for standard system include files,
-// or project specific include files that are used frequently, but
-// are changed infrequently
-//
-
-#if !defined(AFX_STDAFX_H__C0DB2B52_6239_4F4B_85C1_830836CC6209__INCLUDED_)
-#define AFX_STDAFX_H__C0DB2B52_6239_4F4B_85C1_830836CC6209__INCLUDED_
-
-#if _MSC_VER > 1000
-#pragma once
-#endif // _MSC_VER > 1000
+#ifndef _COMMON_H
+#define _COMMON_H
// Insert your headers here
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#define _WIN32_WINNT 0x0500
+#define MIRANDA_VER 0x0700
+
+#include <m_stdhdr.h>
#include <windows.h>
-#include <winuser.h>
#include <prsht.h>
-#include <shellapi.h>
#include <commctrl.h>
+#include <win2k.h>
+#include <newpluginapi.h>
+#include <m_langpack.h>
+#include <m_skin.h>
+#include <m_database.h>
+#include <m_options.h>
+#include <m_popup.h>
+#include <m_protosvc.h>
+#include <m_protomod.h>
+#include <m_system.h>
+#include <m_system_cpp.h>
+#include <m_utils.h>
+#include <m_cluiframes.h>
+#include <m_clist.h>
+#include <m_genmenu.h>
+#include <m_clc.h>
+#include <m_fontservice.h>
+#include <m_icolib.h>
+#include "m_skin_eng.h"
-#ifndef MIID_WORLDTIME
-#define MIID_WORLDTIME {0x5e436914, 0x3258, 0x4dfa, { 0x8a, 0xd9, 0xf2, 0xcd, 0x26, 0x43, 0x6f, 0x1}}
#endif
-
-//{{AFX_INSERT_LOCATION}}
-// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
-
-#endif // !defined(AFX_STDAFX_H__C0DB2B52_6239_4F4B_85C1_830836CC6209__INCLUDED_)
diff --git a/worldtime/options.cpp b/worldtime/options.cpp index 1d991a0..2b646e8 100644 --- a/worldtime/options.cpp +++ b/worldtime/options.cpp @@ -3,26 +3,33 @@ //#include "commctrl.h"
void save_listbox_items() {
- DBWriteContactSettingDword(0, "WorldTime", "NumEntries", listbox_items.size());
+ DBWriteContactSettingDword(0, "WorldTime", "NumEntries", listbox_items.getCount());
int index = 0;
- for(ITEMLIST::iterator i = listbox_items.begin(); i != listbox_items.end(); i++, index++) {
- std::ostringstream p1, p2, p3, p4, p5;
-
- p1 << "Label" << index;
- p2 << "Index" << index;
- p3 << "Sunrise" << index;
- p4 << "Sunset" << index;
- p5 << "TZName" << index;
-
- DBWriteContactSettingString(0, "WorldTime", p1.str().c_str(), i->pszText);
- DBWriteContactSettingDword(0, "WorldTime", p2.str().c_str(), i->timezone_list_index);
- DBWriteContactSettingDword(0, "WorldTime", p3.str().c_str(), i->sunrise.wHour * 60 + i->sunrise.wMinute);
- DBWriteContactSettingDword(0, "WorldTime", p4.str().c_str(), i->sunset.wHour * 60 + i->sunset.wMinute);
- DBWriteContactSettingString(0, "WorldTime", p5.str().c_str(), timezone_list[i->timezone_list_index].tcName);
+ for(int i = 0; i < listbox_items.getCount(); i++, index++) {
+ char p1[20], p2[20], p3[20], p4[20], p5[20];
+
+ mir_snprintf(p1, SIZEOF(p1), "Label%d", i);
+ mir_snprintf(p2, SIZEOF(p2), "Index%d", i);
+ mir_snprintf(p3, SIZEOF(p3), "Sunrise%d", i);
+ mir_snprintf(p4, SIZEOF(p4), "Sunset%d", i);
+ mir_snprintf(p5, SIZEOF(p5), "TZName%d", i);
+
+ DBWriteContactSettingTString(0, "WorldTime", p1, listbox_items[i].pszText);
+ DBWriteContactSettingDword(0, "WorldTime", p2, listbox_items[i].timezone_list_index);
+ DBWriteContactSettingDword(0, "WorldTime", p3, listbox_items[i].sunrise.wHour * 60 + listbox_items[i].sunrise.wMinute);
+ DBWriteContactSettingDword(0, "WorldTime", p4, listbox_items[i].sunset.wHour * 60 + listbox_items[i].sunset.wMinute);
+ DBWriteContactSettingTString(0, "WorldTime", p5, timezone_list[listbox_items[i].timezone_list_index].tcName);
}
DBWriteContactSettingWord(0, "WorldTime", "DataVersion", 1);
}
+void copy_listbox_items(ITEMLIST &dest, ITEMLIST &src)
+{
+ dest.destroy();
+ for (int i=0; i < src.getCount(); ++i)
+ dest.insert(new LISTITEM(src[i]));
+}
+
void set_minmax(bool mm) {
hook_window_behaviour_to_clist = mm;
if(hook_window_behaviour_to_clist) {
@@ -41,12 +48,12 @@ void set_set_format(bool sf) { set_format = sf;
}
-void set_time_format(const char *sf) {
- strncpy(format_string, sf, 512);
+void set_time_format(const TCHAR *sf) {
+ _tcsncpy(format_string, sf, 512);
}
-void set_date_format(const char *sf) {
- strncpy(date_format_string, sf, 512);
+void set_date_format(const TCHAR *sf) {
+ _tcsncpy(date_format_string, sf, 512);
}
void set_show_icons(bool si) {
@@ -57,24 +64,23 @@ void set_hide_menu(bool hm) { hide_menu = hm;
}
-ITEMLIST temp_listbox_items;
+ITEMLIST temp_listbox_items(5);
-void fill_timezone_list_control(HWND hwndDlg) {
- int index = 0;
-
+void fill_timezone_list_control(HWND hwndDlg)
+{
HWND hw = GetDlgItem(hwndDlg, IDC_LIST_TIMES);
SendMessage(hw, LB_RESETCONTENT, 0, 0);
if(IsDlgButtonChecked(hwndDlg, IDC_RAD_ALPHA)) {
- for(TimeList::iterator i = timezone_list.begin(); i != timezone_list.end(); i++, index++) {
- SendMessage(hw, LB_INSERTSTRING, (WPARAM)-1, (LPARAM)i->tcName);
- SendMessage(hw, LB_SETITEMDATA, (WPARAM)index, (LPARAM)i->list_index);
+ for(int i = 0; i < timezone_list.getCount(); i++) {
+ SendMessage(hw, LB_INSERTSTRING, (WPARAM)-1, (LPARAM)timezone_list[i].tcName);
+ SendMessage(hw, LB_SETITEMDATA, (WPARAM)i, (LPARAM)timezone_list[i].list_index);
}
} else {
- for(TimeList::iterator i = geo_timezone_list.begin(); i != geo_timezone_list.end(); i++, index++) {
- SendMessage(hw, LB_INSERTSTRING, (WPARAM)-1, (LPARAM)i->tcName);
- SendMessage(hw, LB_SETITEMDATA, (WPARAM)index, (LPARAM)i->list_index);
+ for(int i = 0; i < geo_timezone_list.getCount(); i++) {
+ SendMessage(hw, LB_INSERTSTRING, (WPARAM)-1, (LPARAM)timezone_list[i].tcName);
+ SendMessage(hw, LB_SETITEMDATA, (WPARAM)i, (LPARAM)timezone_list[i].list_index);
}
}
}
@@ -82,10 +88,10 @@ void fill_timezone_list_control(HWND hwndDlg) { LISTITEM add_edit_item;
-static BOOL CALLBACK DlgProcOpts2(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
+static INT_PTR CALLBACK DlgProcOpts2(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
HWND hw;
int sel;
- char buf[MAX_NAME_LENGTH];
+ TCHAR buf[MAX_NAME_LENGTH];
switch ( msg ) {
case WM_INITDIALOG:
@@ -152,8 +158,8 @@ static BOOL CALLBACK DlgProcOpts2(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM case IDC_ED_LABEL:
GetDlgItemText(hwndDlg, IDC_ED_LABEL, buf, MAX_NAME_LENGTH);
hw = GetDlgItem(hwndDlg, IDOK);
- EnableWindow(hw, (strlen(buf) > 0));
- strncpy(add_edit_item.pszText, buf, MAX_NAME_LENGTH);
+ EnableWindow(hw, (_tcslen(buf) > 0));
+ _tcsncpy(add_edit_item.pszText, buf, MAX_NAME_LENGTH);
}
}
@@ -196,10 +202,10 @@ static BOOL CALLBACK DlgProcOpts2(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM return FALSE;
}
-static BOOL CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
+static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
HWND hw;
- int sel, index;
+ int sel;
DBVARIANT dbv;
switch ( msg ) {
@@ -218,12 +224,11 @@ static BOOL CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l SendMessage(GetDlgItem(hwndDlg, IDC_SP_ROWHEIGHT), UDM_SETRANGE, 0, (LPARAM)MAKELONG(500, 6));
SendMessage(GetDlgItem(hwndDlg, IDC_SP_ROWHEIGHT), UDM_SETPOS, 0, DBGetContactSettingWord(NULL, "WorldTime", "RowHeight", GetSystemMetrics(SM_CYSMICON)));
- temp_listbox_items = listbox_items;
+ copy_listbox_items(temp_listbox_items, listbox_items);
hw = GetDlgItem(hwndDlg, IDC_LIST_TIMES2);
- index = 0;
- for(ITEMLIST::iterator ili = temp_listbox_items.begin(); ili != temp_listbox_items.end(); ili++, index++) {
- sel = SendMessage(hw, LB_INSERTSTRING, (WPARAM)-1, (LPARAM)&ili->pszText);
+ for(int ili = 0; ili < temp_listbox_items.getCount(); ili++) {
+ sel = SendMessage(hw, LB_INSERTSTRING, (WPARAM)-1, (LPARAM)&temp_listbox_items[ili].pszText);
}
if(!ServiceExists(MS_CLIST_FRAMES_ADDFRAME)) {
@@ -243,12 +248,12 @@ static BOOL CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l bool show_icons = (DBGetContactSettingByte(NULL, "WorldTime", "ShowIcons", 1) == 1);
CheckDlgButton(hwndDlg, IDC_CHK_ICONS, show_icons ? 1 : 0);
DBVARIANT dbv;
- if(!DBGetContactSetting(NULL, "WorldTime", "TimeFormat", &dbv))
- strcpy(format_string, dbv.pszVal);
+ if(!DBGetContactSettingTString(NULL, "WorldTime", "TimeFormat", &dbv))
+ _tcscpy(format_string, dbv.ptszVal);
DBFreeVariant(&dbv);
SetDlgItemText(hwndDlg, IDC_ED_FORMAT, format_string);
- if(!DBGetContactSetting(NULL, "WorldTime", "DateFormat", &dbv))
- strcpy(date_format_string, dbv.pszVal);
+ if(!DBGetContactSettingTString(NULL, "WorldTime", "DateFormat", &dbv))
+ _tcscpy(date_format_string, dbv.ptszVal);
DBFreeVariant(&dbv);
SetDlgItemText(hwndDlg, IDC_ED_DATE_FORMAT, date_format_string);
@@ -332,7 +337,7 @@ static BOOL CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l add_edit_item.timezone_list_index = -1;
if(DialogBox(hInst, MAKEINTRESOURCE(IDD_DIALOG2), hwndDlg, DlgProcOpts2) == IDOK) {
- temp_listbox_items.push_back(add_edit_item);
+ temp_listbox_items.insert(new LISTITEM(add_edit_item));
hw = GetDlgItem(hwndDlg, IDC_LIST_TIMES2);
sel = SendMessage(hw, LB_INSERTSTRING, (WPARAM)-1, (LPARAM)add_edit_item.pszText);
@@ -343,7 +348,7 @@ static BOOL CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l hw = GetDlgItem(hwndDlg, IDC_BTN_EDIT);
EnableWindow(hw, TRUE);
- sel = temp_listbox_items.size() - 1;
+ sel = temp_listbox_items.getCount() - 1;
hw = GetDlgItem(hwndDlg, IDC_BTN_UP);
EnableWindow(hw, (sel > 0));
hw = GetDlgItem(hwndDlg, IDC_LIST_TIMES2);
@@ -361,12 +366,7 @@ static BOOL CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l if(sel != LB_ERR) {
SendMessage(hw, LB_DELETESTRING, (WPARAM)sel, 0);
- {
- ITEMLIST::iterator i = temp_listbox_items.begin();
- for(int j = 0; j < sel; j++)
- i++;
- temp_listbox_items.erase(i);
- }
+ temp_listbox_items.remove(sel);
hw = GetDlgItem(hwndDlg, IDC_BTN_REM);
EnableWindow(hw, FALSE);
@@ -475,16 +475,16 @@ static BOOL CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l DBWriteContactSettingByte(NULL, "WorldTime", "HideMenu", new_hide_menu ? 1 : 0);
set_hide_menu(new_hide_menu);
- char buf[512];
+ TCHAR buf[512];
GetDlgItemText(hwndDlg, IDC_ED_FORMAT, buf, 512);
- DBWriteContactSettingString(NULL, "WorldTime", "TimeFormat", buf);
+ DBWriteContactSettingTString(NULL, "WorldTime", "TimeFormat", buf);
set_time_format(buf);
GetDlgItemText(hwndDlg, IDC_ED_DATE_FORMAT, buf, 512);
- DBWriteContactSettingString(NULL, "WorldTime", "DateFormat", buf);
+ DBWriteContactSettingTString(NULL, "WorldTime", "DateFormat", buf);
set_date_format(buf);
- listbox_items = temp_listbox_items;
+ copy_listbox_items(listbox_items, temp_listbox_items);
save_listbox_items();
if(!ServiceExists(MS_FONT_REGISTER)) {
diff --git a/worldtime/plugwin.cpp b/worldtime/plugwin.cpp index 920b19c..690cefe 100644 --- a/worldtime/plugwin.cpp +++ b/worldtime/plugwin.cpp @@ -19,7 +19,7 @@ HICON upIcon, downIcon, riseIcon, setIcon; HMENU hMainMenu;
UINT menuItemId;
-ITEMLIST listbox_items;
+ITEMLIST listbox_items(5);
TCHAR format_string[512], date_format_string[512];
@@ -48,17 +48,15 @@ static int transparentFocus=1; #define WMU_INITIALIZE (WM_USER + 11)
#define WMU_SIZELIST (WM_USER + 12)
-static int CLUILoadTitleBarFont()
+static HFONT CLUILoadTitleBarFont()
{
- char facename[]="MS Shell Dlg";
HFONT hfont;
- LOGFONT logfont;
- memset(&logfont,0,sizeof(logfont));
- memcpy(logfont.lfFaceName,facename,sizeof(facename));
+ LOGFONT logfont = {0};
+ _tcscpy(logfont.lfFaceName, _T("MS Shell Dlg"));
logfont.lfWeight=FW_NORMAL;
logfont.lfHeight=-10;
hfont=CreateFontIndirect(&logfont);
- return((int)hfont);
+ return hfont;
}
HFONT GetCLCFont0()
@@ -74,22 +72,22 @@ HFONT GetCLCFont0() SystemParametersInfo(SPI_GETICONTITLELOGFONT,sizeof(LOGFONT),lf,FALSE);
- if(!DBGetContactSetting(NULL,"WorldTime","FontName",&dbv)) {
- lstrcpy(lf->lfFaceName,dbv.pszVal);
+ if(!DBGetContactSettingTString(NULL,"WorldTime","FontName",&dbv)) {
+ lstrcpy(lf->lfFaceName, dbv.ptszVal);
DBFreeVariant(&dbv);
} else {
- wsprintf(idstr,"Font%dName",i);
- if(!DBGetContactSetting(NULL,"CLC",idstr,&dbv)) {
- lstrcpy(lf->lfFaceName,dbv.pszVal);
+ mir_snprintf(idstr, SIZEOF(idstr), "Font%dName", i);
+ if(!DBGetContactSettingTString(NULL,"CLC",idstr,&dbv)) {
+ lstrcpy(lf->lfFaceName,dbv.ptszVal);
DBFreeVariant(&dbv);
}
}
- wsprintf(idstr, "Font%dCol", i);
+ mir_snprintf(idstr, SIZEOF(idstr), "Font%dCol", i);
ContactFontColour = (COLORREF)DBGetContactSettingDword(NULL, "CLC", idstr, GetSysColor(COLOR_WINDOWTEXT));
if(!DBGetContactSetting(NULL,"WorldTime","FontSize",&dbv)) {
lf->lfHeight=(char)dbv.bVal;
} else {
- wsprintf(idstr,"Font%dSize",i);
+ mir_snprintf(idstr, SIZEOF(idstr), "Font%dSize", i);
lf->lfHeight=(char)DBGetContactSettingByte(NULL,"CLC",idstr,lf->lfHeight);
if(lf->lfHeight > 0)
lf->lfHeight=-MulDiv(abs(lf->lfHeight), GetDeviceCaps(hdc, LOGPIXELSY), 72);
@@ -99,10 +97,10 @@ HFONT GetCLCFont0() #define DBFONTF_ITALIC 2
#define DBFONTF_UNDERLINE 4
- if(!DBGetContactSetting(NULL,"WorldTime","FontSty",&dbv)) {
+ if(!DBGetContactSettingString(NULL,"WorldTime","FontSty",&dbv)) {
style=(BYTE)DBGetContactSettingByte(NULL,"WorldTime","FontSty",(lf->lfWeight==FW_NORMAL?0:DBFONTF_BOLD)|(lf->lfItalic?DBFONTF_ITALIC:0)|(lf->lfUnderline?DBFONTF_UNDERLINE:0));
} else {
- wsprintf(idstr,"Font%dSty",i);
+ mir_snprintf(idstr, SIZEOF(idstr), "Font%dSty", i);
style=(BYTE)DBGetContactSettingByte(NULL,"CLC",idstr,(lf->lfWeight==FW_NORMAL?0:DBFONTF_BOLD)|(lf->lfItalic?DBFONTF_ITALIC:0)|(lf->lfUnderline?DBFONTF_UNDERLINE:0));
}
lf->lfWidth=lf->lfEscapement=lf->lfOrientation=0;
@@ -114,7 +112,7 @@ HFONT GetCLCFont0() if(!DBGetContactSetting(NULL,"WorldTime","FontSet",&dbv)) {
lf->lfCharSet = dbv.bVal;
} else {
- wsprintf(idstr,"Font%dSet",i);
+ mir_snprintf(idstr, SIZEOF(idstr), "Font%dSet", i);
lf->lfCharSet=DBGetContactSettingByte(NULL,"CLC",idstr,lf->lfCharSet);
}
lf->lfOutPrecision=OUT_DEFAULT_PRECIS;
@@ -130,10 +128,10 @@ HFONT GetCLCFont0() HFONT GetFont() {
if(ServiceExists(MS_FONT_REGISTER)) {
LOGFONT log_font;
- ContactFontColour = (COLORREF)CallService(MS_FONT_GET, (WPARAM)&font_id, (LPARAM)&log_font);
+ ContactFontColour = (COLORREF)CallService(MS_FONT_GETT, (WPARAM)&font_id, (LPARAM)&log_font);
return CreateFontIndirect(&log_font);
} else
- return (HFONT)GetCLCFont0();
+ return GetCLCFont0();
}
int ReloadFont(WPARAM wParam, LPARAM lParam) {
@@ -181,7 +179,7 @@ void CALLBACK plug1TimerProc( void CALLBACK plug1TimerProc2(
HWND hwnd, // handle to window
UINT uMsg, // WM_TIMER message
- UINT idEvent, // timer identifier
+ UINT_PTR idEvent, // timer identifier
DWORD dwTime // current system time
)
{
@@ -196,7 +194,7 @@ void CALLBACK plug1TimerProc2( void CALLBACK plug1TimerProc3(
HWND hwnd, // handle to window
UINT uMsg, // WM_TIMER message
- UINT idEvent, // timer identifier
+ UINT_PTR idEvent, // timer identifier
DWORD dwTime // current system time
)
{
@@ -283,7 +281,7 @@ LRESULT CALLBACK mypluginwindow1proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM if(dis->itemID != -1) {
oldFont = (HFONT)SelectObject(dis->hDC, ContactFont);
- GetTextExtentPoint32(dis->hDC,"X",1,&textSize);
+ GetTextExtentPoint32(dis->hDC,_T("X"),1,&textSize);
SendMessage(label, LB_SETITEMHEIGHT, 0, (LPARAM)DBGetContactSettingWord(NULL, "WorldTime", "RowHeight",GetSystemMetrics(SM_CYSMICON)));
// stop full list erase
//dis->rcItem.bottom = dis->rcItem.top + DBGetContactSettingWord(NULL, "WorldTime", "RowHeight",GetSystemMetrics(SM_CYSMICON));
@@ -393,13 +391,13 @@ LRESULT CALLBACK mypluginwindow1proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM MyGetSystemTime(&st);
EnterCriticalSection(&cs2);
- for(ITEMLIST::iterator i = listbox_items.begin(); i != listbox_items.end(); i++) {
+ for(int i = 0; i < listbox_items.getCount(); i++) {
TIME_ZONE_INFORMATION tzi;
- tzi.Bias = timezone_list[i->timezone_list_index].TZI.Bias;
- tzi.DaylightBias = timezone_list[i->timezone_list_index].TZI.DaylightBias;
- tzi.DaylightDate = timezone_list[i->timezone_list_index].TZI.DaylightDate;
- tzi.StandardBias = timezone_list[i->timezone_list_index].TZI.StandardBias;
- tzi.StandardDate = timezone_list[i->timezone_list_index].TZI.StandardDate;
+ tzi.Bias = timezone_list[listbox_items[i].timezone_list_index].TZI.Bias;
+ tzi.DaylightBias = timezone_list[listbox_items[i].timezone_list_index].TZI.DaylightBias;
+ tzi.DaylightDate = timezone_list[listbox_items[i].timezone_list_index].TZI.DaylightDate;
+ tzi.StandardBias = timezone_list[listbox_items[i].timezone_list_index].TZI.StandardBias;
+ tzi.StandardDate = timezone_list[listbox_items[i].timezone_list_index].TZI.StandardDate;
MySystemTimeToTzSpecificLocalTime(&tzi, &st, &other_st);
@@ -409,8 +407,8 @@ LRESULT CALLBACK mypluginwindow1proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM } else
GetTimeFormat(LOCALE_USER_DEFAULT, TIME_NOSECONDS, &other_st, 0, buf, 512);
- int risediff = minutes_diff(&other_st, &i->sunrise),
- setdiff = minutes_diff(&other_st, &i->sunset);
+ int risediff = minutes_diff(&other_st, &listbox_items[i].sunrise),
+ setdiff = minutes_diff(&other_st, &listbox_items[i].sunset);
if(risediff >= 0 && setdiff < 0) {
if(risediff < 30)
hIcon = riseIcon;
@@ -423,12 +421,12 @@ LRESULT CALLBACK mypluginwindow1proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM hIcon = downIcon;
}
- if(strcmp(buf, i->pszTimeText) || (set_format && strcmp(buf2, i->pszDateText)) || i->icon != hIcon) {
+ if(_tcscmp(buf, listbox_items[i].pszTimeText) || (set_format && _tcscmp(buf2, listbox_items[i].pszDateText)) || listbox_items[i].icon != hIcon) {
need_repaint = true;
- strcpy(i->pszTimeText, buf);
- if(set_format) strcpy(i->pszDateText, buf2);
- else i->pszDateText[0] = '\0';
- i->icon = (HICON)hIcon;
+ _tcscpy(listbox_items[i].pszTimeText, buf);
+ if(set_format) _tcscpy(listbox_items[i].pszDateText, buf2);
+ else listbox_items[i].pszDateText[0] = '\0';
+ listbox_items[i].icon = (HICON)hIcon;
}
}
LeaveCriticalSection(&cs2);
@@ -442,7 +440,7 @@ LRESULT CALLBACK mypluginwindow1proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM if(tbrush) DeleteObject(tbrush);
- return (BOOL)(tbrush = CreateSolidBrush((COLORREF)DBGetContactSettingDword(NULL,"WorldTime","BgColour", GetSysColor(COLOR_3DFACE))));
+ return (INT_PTR)(tbrush = CreateSolidBrush((COLORREF)DBGetContactSettingDword(NULL,"WorldTime","BgColour", GetSysColor(COLOR_3DFACE))));
}
break;
case WM_ERASEBKGND:
@@ -485,9 +483,9 @@ LRESULT CALLBACK mypluginwindow1proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM break;
case WM_CREATE:
- label=CreateWindow("LISTBOX", "", (WS_VISIBLE | WS_CHILD | LBS_STANDARD | LBS_OWNERDRAWFIXED | LBS_NOTIFY) & ~WS_BORDER, 0, 0, 0, 0, hwnd, NULL, hInst,0);
+ label=CreateWindow(_T("LISTBOX"), _T(""), (WS_VISIBLE | WS_CHILD | LBS_STANDARD | LBS_OWNERDRAWFIXED | LBS_NOTIFY) & ~WS_BORDER, 0, 0, 0, 0, hwnd, NULL, hInst,0);
- oldListWindowProc = (WNDPROC)SetWindowLong(label, GWL_WNDPROC, (LONG)SubclassedListWindowProc);
+ oldListWindowProc = (WNDPROC)SetWindowLongPtr(label, GWLP_WNDPROC, (LONG_PTR)SubclassedListWindowProc);
if (DBGetContactSettingByte(NULL,"CList","Transparent",0))
{
@@ -742,8 +740,8 @@ int FillList(WPARAM wParam, LPARAM lParam) { EnterCriticalSection(&cs2);
- for(ITEMLIST::iterator i = listbox_items.begin(); i != listbox_items.end(); i++) {
- SendMessage(label, LB_INSERTSTRING, (WPARAM)-1, (LPARAM)i->pszText);
+ for(int i = 0; i < listbox_items.getCount(); i++) {
+ SendMessage(label, LB_INSERTSTRING, (WPARAM)-1, (LPARAM)listbox_items[i].pszText);
}
LeaveCriticalSection(&cs2);
@@ -752,7 +750,7 @@ int FillList(WPARAM wParam, LPARAM lParam) { return 0;
}
-static int PlugShowWindow(WPARAM wParam, LPARAM lParam) {
+static INT_PTR PlugShowWindow(WPARAM wParam, LPARAM lParam) {
if(pluginwind && !hook_window_behaviour_to_clist) {
ShowWindow(pluginwind, IsWindowVisible(pluginwind) ? SW_HIDE : SW_SHOW);
DBWriteContactSettingByte(NULL, "WorldTime", "WindowVisible", IsWindowVisible(pluginwind) ? 1 : 0);
@@ -819,49 +817,49 @@ int ReloadIcons(WPARAM wParam, LPARAM lParam) { void load_listbox_items() {
int num = DBGetContactSettingDword(0, "WorldTime", "NumEntries", 0);
for(int i = 0; i < num; i++) {
- LISTITEM li = {0};
- std::ostringstream p1, p2, p3, p4, p5;
+ LISTITEM lsi = {0};
+ char p1[20], p2[20], p3[20], p4[20], p5[20];
- p1 << "Label" << i;
- p2 << "Index" << i;
- p3 << "Sunrise" << i;
- p4 << "Sunset" << i;
- p5 << "TZName" << i;
+ mir_snprintf(p1, SIZEOF(p1), "Label%d", i);
+ mir_snprintf(p2, SIZEOF(p2), "Index%d", i);
+ mir_snprintf(p3, SIZEOF(p3), "Sunrise%d", i);
+ mir_snprintf(p4, SIZEOF(p4), "Sunset%d", i);
+ mir_snprintf(p5, SIZEOF(p5), "TZName%d", i);
DBVARIANT dbv;
- DBGetContactSetting(0, "WorldTime", p1.str().c_str(), &dbv);
- strncpy(li.pszText, dbv.pszVal, MAX_NAME_LENGTH);
+ DBGetContactSettingTString(0, "WorldTime", p1, &dbv);
+ _tcsncpy(lsi.pszText, dbv.ptszVal, MAX_NAME_LENGTH);
DBFreeVariant(&dbv);
- if(!DBGetContactSetting(0, "WorldTime", p5.str().c_str(), &dbv)) {
- for(TimeList::iterator j = timezone_list.begin(); j != timezone_list.end(); j++) {
- if(!strcmp(j->tcName, dbv.pszVal)) {
- li.timezone_list_index = j->list_index;
+ if(!DBGetContactSettingTString(0, "WorldTime", p5, &dbv)) {
+ for(int j = 0; j < timezone_list.getCount(); j++) {
+ if(!_tcscmp(timezone_list[j].tcName, dbv.ptszVal)) {
+ lsi.timezone_list_index = timezone_list[j].list_index;
break;
}
}
DBFreeVariant(&dbv);
} else
- li.timezone_list_index = (int)DBGetContactSettingDword(0, "WorldTime", p2.str().c_str(), 0);
+ lsi.timezone_list_index = (int)DBGetContactSettingDword(0, "WorldTime", p2, 0);
- GetSystemTime(&li.sunrise);
- GetSystemTime(&li.sunset);
+ GetSystemTime(&lsi.sunrise);
+ GetSystemTime(&lsi.sunset);
- int sunrise_min = (int)DBGetContactSettingDword(0, "WorldTime", p3.str().c_str(), 360), // 60 * 6 (6 am) = 360
- sunset_min = (int)DBGetContactSettingDword(0, "WorldTime", p4.str().c_str(), 1080); // 60 * 18 (6 pm) = 1080
+ int sunrise_min = (int)DBGetContactSettingDword(0, "WorldTime", p3, 360), // 60 * 6 (6 am) = 360
+ sunset_min = (int)DBGetContactSettingDword(0, "WorldTime", p4, 1080); // 60 * 18 (6 pm) = 1080
- li.sunrise.wHour = sunrise_min / 60;
- li.sunrise.wMinute = sunrise_min % 60;
- li.sunrise.wSecond = 0;
- li.sunset.wHour = sunset_min / 60;
- li.sunset.wMinute = sunset_min % 60;
- li.sunset.wSecond = 0;
+ lsi.sunrise.wHour = sunrise_min / 60;
+ lsi.sunrise.wMinute = sunrise_min % 60;
+ lsi.sunrise.wSecond = 0;
+ lsi.sunset.wHour = sunset_min / 60;
+ lsi.sunset.wMinute = sunset_min % 60;
+ lsi.sunset.wSecond = 0;
- li.pszTimeText[0] = '\0';
- li.pszDateText[0] = '\0';
- li.icon = upIcon;
+ lsi.pszTimeText[0] = '\0';
+ lsi.pszDateText[0] = '\0';
+ lsi.icon = upIcon;
- listbox_items.push_back(li);
+ listbox_items.insert(new LISTITEM(lsi));
}
}
@@ -935,7 +933,7 @@ int addmypluginwindow1(HWND parent) HookEvent(ME_SKIN_SERVICESCREATED, SkinReload);
}
- hUserDll = LoadLibrary("user32.dll");
+ hUserDll = GetModuleHandleA("user32");
if (hUserDll) {
MySetLayeredWindowAttributes = (BOOL (WINAPI *)(HWND,COLORREF,BYTE,DWORD))GetProcAddress(hUserDll, "SetLayeredWindowAttributes");
MyAnimateWindow=(BOOL (WINAPI*)(HWND,DWORD,DWORD))GetProcAddress(hUserDll,"AnimateWindow");
@@ -950,12 +948,12 @@ int addmypluginwindow1(HWND parent) show_icons = (DBGetContactSettingByte(NULL, "WorldTime", "ShowIcons", 1) == 1);
hide_menu = (DBGetContactSettingByte(NULL, "WorldTime", "HideMenu", 0) == 1);
DBVARIANT dbv;
- if(!DBGetContactSetting(NULL, "WorldTime", "TimeFormat", &dbv)) {
- strncpy(format_string, dbv.pszVal, 512);
+ if(!DBGetContactSettingTString(NULL, "WorldTime", "TimeFormat", &dbv)) {
+ _tcsncpy(format_string, dbv.ptszVal, 512);
}
DBFreeVariant(&dbv);
- if(!DBGetContactSetting(NULL, "WorldTime", "DateFormat", &dbv)) {
- strncpy(date_format_string, dbv.pszVal, 512);
+ if(!DBGetContactSettingTString(NULL, "WorldTime", "DateFormat", &dbv)) {
+ _tcsncpy(date_format_string, dbv.ptszVal, 512);
}
DBFreeVariant(&dbv);
@@ -981,11 +979,11 @@ int addmypluginwindow1(HWND parent) wndclass.hCursor = LoadCursor (NULL, IDC_ARROW);
wndclass.hbrBackground = (HBRUSH)(COLOR_3DFACE+1);
wndclass.lpszMenuName = NULL;
- wndclass.lpszClassName = PLUG;
+ wndclass.lpszClassName = _T(PLUG);
RegisterClass(&wndclass);
if(ServiceExists(MS_CLIST_FRAMES_ADDFRAME)) {
- pluginwind=CreateWindow(PLUG,Translate("World Time"),
+ pluginwind=CreateWindow(_T(PLUG),TranslateT("World Time"),
WS_BORDER|WS_CHILD|WS_CLIPCHILDREN,
0,0,0,0,parent,NULL,hInst,NULL);
@@ -1018,7 +1016,7 @@ int addmypluginwindow1(HWND parent) visible = ((int)DBGetContactSettingByte(NULL, "WorldTime", "WindowVisible", 1) == 1);
}
- pluginwind=CreateWindowEx(WS_EX_TOOLWINDOW, PLUG,Translate("World Time"),
+ pluginwind=CreateWindowEx(WS_EX_TOOLWINDOW, _T(PLUG),TranslateT("World Time"),
WS_POPUPWINDOW | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | (visible ? WS_VISIBLE : 0) | WS_CLIPCHILDREN,
x,y,width,height,parent,NULL,hInst,NULL);
@@ -1041,8 +1039,8 @@ int addmypluginwindow1(HWND parent) font=SendMessage(parent,WM_GETFONT,0,0);
SendMessage(pluginwind,WM_SETFONT,font,0);
- TitleBarFont = (HFONT)CLUILoadTitleBarFont();
- ContactFont = (HFONT)GetFont();
+ TitleBarFont = CLUILoadTitleBarFont();
+ ContactFont = GetFont();
SendMessage(label,WM_SETFONT,(WPARAM)TitleBarFont,0);
@@ -1072,32 +1070,27 @@ LRESULT CALLBACK NullWindowProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM return DefWindowProc(hWnd, message, wParam, lParam);
}
-void CALLBACK sttMainThreadCallback( ULONG dwParam )
+void CALLBACK sttMainThreadCallback( ULONG_PTR dwParam )
{
- POPUPDATAEX* ppd = ( POPUPDATAEX* )dwParam;
-
- if ( ServiceExists(MS_POPUP_ADDPOPUPEX) )
- CallService( MS_POPUP_ADDPOPUPEX, ( WPARAM )ppd, 0 );
- else
- if ( ServiceExists(MS_POPUP_ADDPOPUP) )
- CallService( MS_POPUP_ADDPOPUP, ( WPARAM )ppd, 0 );
+ POPUPDATAT* ppd = ( POPUPDATAT* )dwParam;
+ CallService( MS_POPUP_ADDPOPUPT, ( WPARAM )ppd, 0 );
free( ppd );
}
-void __stdcall ShowPopup( const char* line1, const char* line2, int flags )
+void __stdcall ShowPopup( const TCHAR* line1, const TCHAR* line2, int flags )
{
- if ( !ServiceExists( MS_POPUP_ADDPOPUP )) {
- MessageBox( NULL, line2, Translate("World Time"), MB_OK | MB_ICONINFORMATION );
+ if ( !ServiceExists( MS_POPUP_ADDPOPUPT )) {
+ MessageBox( NULL, line2, TranslateT("World Time"), MB_OK | MB_ICONINFORMATION );
return;
}
- POPUPDATAEX* ppd = ( POPUPDATAEX* )calloc( sizeof( POPUPDATAEX ), 1 );
+ POPUPDATAT* ppd = ( POPUPDATAT* )calloc( sizeof( POPUPDATAT ), 1 );
ppd->lchContact = NULL;
ppd->lchIcon = 0;
- strcpy( ppd->lpzContactName, line1 );
- strcpy( ppd->lpzText, line2 );
+ _tcscpy( ppd->lptzContactName, line1 );
+ _tcscpy( ppd->lptzText, line2 );
ppd->colorBack = GetSysColor( COLOR_BTNFACE );
ppd->colorText = GetSysColor( COLOR_WINDOWTEXT );
@@ -1106,7 +1099,7 @@ void __stdcall ShowPopup( const char* line1, const char* line2, int flags ) ppd->PluginWindowProc = ( WNDPROC )NullWindowProc;
ppd->PluginData = NULL;
- QueueUserAPC( sttMainThreadCallback , mainThread, ( ULONG )ppd );
+ QueueUserAPC( sttMainThreadCallback , mainThread, ( ULONG_PTR )ppd );
}
void plugwin_cleanup() {
diff --git a/worldtime/plugwin.h b/worldtime/plugwin.h index 1229909..24196a9 100644 --- a/worldtime/plugwin.h +++ b/worldtime/plugwin.h @@ -5,35 +5,10 @@ #define TIMER_ID2 19192
#define TIMER_ID3 19193
-#include "timezone.h"
-
-#include <newpluginapi.h>
-#include <m_langpack.h>
-#include <m_skin.h>
-#include <m_database.h>
-#include <m_options.h>
-#include <m_popup.h>
-#include <m_protosvc.h>
-#include <m_protomod.h>
-#include <stdio.h>
-#include <m_utils.h>
-#include <m_cluiframes.h>
-//#include "../mwclist/m_clist.h"
-#include <m_clist.h>
-#include <m_genmenu.h>
-//#include "../mwclist/m_clc.h"
-#include <m_clc.h>
-#include <m_fontservice.h>
-//#include <m_skin_eng.h>
-#include "m_skin_eng.h"
-
-
-#include <m_icolib.h>
-
-#include <sstream>
-
+#include "common.h"
#include "resource.h"
+#include "timezone.h"
#include "time_convert.h"
#define PLUG "WorldTime"
@@ -50,17 +25,16 @@ typedef struct tagLISTITEM {
int cbSize;
- char pszText[MAX_NAME_LENGTH];
+ TCHAR pszText[MAX_NAME_LENGTH];
int timezone_list_index;
SYSTEMTIME sunset;
SYSTEMTIME sunrise;
- char pszTimeText[MAX_NAME_LENGTH];
- char pszDateText[MAX_NAME_LENGTH];
+ TCHAR pszTimeText[MAX_NAME_LENGTH];
+ TCHAR pszDateText[MAX_NAME_LENGTH];
HICON icon;
} LISTITEM;
-#include <vector>
-typedef std::vector<LISTITEM> ITEMLIST;
+typedef OBJLIST<LISTITEM> ITEMLIST;
extern HICON upIcon, downIcon;
@@ -68,7 +42,7 @@ extern ITEMLIST listbox_items; extern HANDLE mainThread;
-extern char format_string[];
+extern TCHAR format_string[];
int addmypluginwindow1(HWND parent);
void plugwin_cleanup();
diff --git a/worldtime/resource.h b/worldtime/resource.h index 1b77d1c..c129fa4 100644 --- a/worldtime/resource.h +++ b/worldtime/resource.h @@ -1,5 +1,5 @@ //{{NO_DEPENDENCIES}}
-// Microsoft Developer Studio generated include file.
+// Microsoft Visual C++ generated include file.
// Used by WorldTime.rc
//
#define IDD_DIALOG1 101
@@ -9,19 +9,9 @@ #define IDD_DIALOG2 112
#define IDI_ICON_SUNSET 117
#define IDI_ICON_SUNRISE 119
-#define IDC_PPM 1001
-#define IDC_PT 1002
-#define IDC_CHECK1 1005
-#define IDC_CHECKPOPUP 1005
#define IDC_CHK_FORMAT 1005
-#define IDC_BUTTONEDIT 1006
#define IDC_CHK_ICONS 1006
-#define IDC_BUTTONRELOAD 1007
-#define IDC_CHK_LOG 1008
-#define IDC_ED_FILENAME 1009
-#define IDC_CHECKPOPUP2 1010
#define IDC_CHK_MINMAX 1011
-#define IDC_CHK_BLOCK 1012
#define IDC_LIST_TIMES 1012
#define IDC_ED_DISP 1013
#define IDC_ED_LABEL 1014
@@ -51,7 +41,6 @@ #define IDC_TIME_SUNRISE 1041
#define IDC_TIME_SUNSET 1042
#define POPUP_TESTING 40001
-#define ID_Menu 40002
// Next default values for new objects
//
diff --git a/worldtime/timezone.cpp b/worldtime/timezone.cpp index 5b2c31b..5839229 100644 --- a/worldtime/timezone.cpp +++ b/worldtime/timezone.cpp @@ -1,18 +1,18 @@ #include "common.h"
#include "timezone.h"
-TimeList timezone_list, geo_timezone_list;
+TimeList timezone_list(10), geo_timezone_list(10, LS_TZREG::compare);
-bool LS_TZREG::operator<(const LS_TZREG &other) {
+int LS_TZREG::compare(const LS_TZREG *p1, const LS_TZREG *p2) {
//return Index < other.Index;
- return TZI.Bias < other.TZI.Bias;
+ return p1->TZI.Bias - p2->TZI.Bias;
}
bool build_timezone_list() {
HKEY HKlmtz;
HKEY KKtz;
DWORD dwIndex = 0;
- CHAR tcName[MAX_SIZE];
+ TCHAR tcName[MAX_SIZE];
DWORD dwcbName = MAX_SIZE;
DWORD dwcbValue;
DWORD dwcbSTD;
@@ -34,26 +34,27 @@ bool build_timezone_list() { return false;
}
- strncpy(Temp.tcName, tcName, MAX_SIZE);
+ _tcsncpy(Temp.tcName, tcName, MAX_SIZE);
dwcbValue = MAX_SIZE;
- RegQueryValueEx(KKtz,"Display",NULL,NULL,(BYTE*)Temp.tcDisp,&dwcbValue);
+ RegQueryValueEx(KKtz, _T("Display"), NULL, NULL, (LPBYTE)Temp.tcDisp, &dwcbValue);
dwcbDLT = MAX_SIZE;
- RegQueryValueEx(KKtz,"Dlt",NULL,NULL,(BYTE*)Temp.tcDLT,&dwcbDLT);
+ RegQueryValueEx(KKtz, _T("Dlt"), NULL, NULL, (LPBYTE)Temp.tcDLT, &dwcbDLT);
dwcbSTD = MAX_SIZE;
- RegQueryValueEx(KKtz,"Std",NULL,NULL,(BYTE*)Temp.tcSTD,&dwcbSTD);
+ RegQueryValueEx(KKtz, _T("Std"), NULL, NULL, (LPBYTE)Temp.tcSTD, &dwcbSTD);
dwcbValue = MAX_SIZE;
- RegQueryValueEx(KKtz,"MapID",NULL,NULL,(BYTE*)Temp.MapID,&dwcbValue);
+ RegQueryValueEx(KKtz, _T("MapID"), NULL, NULL, (LPBYTE)Temp.MapID, &dwcbValue);
if(!win9x) {
dwcbValue = sizeof(DWORD);
- RegQueryValueEx(KKtz,"Index",NULL,NULL,(BYTE*)&Temp.Index,&dwcbValue);
+ RegQueryValueEx(KKtz, _T("Index"), NULL, NULL, (LPBYTE)&Temp.Index, &dwcbValue);
}
dwcbValue = sizeof(Temp.TZI);
- RegQueryValueEx(KKtz,"TZI",NULL,NULL,(BYTE*)&Temp.TZI,&dwcbValue);
+ RegQueryValueEx(KKtz, _T("TZI"), NULL, NULL, (LPBYTE)&Temp.TZI, &dwcbValue);
RegCloseKey(KKtz);
Temp.list_index = dwIndex;
- timezone_list.push_back(Temp);
+ timezone_list.insert(new LS_TZREG(Temp));
+ geo_timezone_list.insert(new LS_TZREG(Temp));
dwcbName = MAX_SIZE;
dwIndex++;
@@ -61,9 +62,6 @@ bool build_timezone_list() { RegCloseKey(HKlmtz);
- geo_timezone_list = timezone_list;
- std::sort(geo_timezone_list.begin(), geo_timezone_list.end());
-
return true;
}
diff --git a/worldtime/timezone.h b/worldtime/timezone.h index 0770976..328abed 100644 --- a/worldtime/timezone.h +++ b/worldtime/timezone.h @@ -1,18 +1,17 @@ #ifndef _TIMEZONE_H
#define _TIMEZONE_H
-#define TZREG "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Time Zones"
-#define TZREG_9X "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Time Zones"
-//#define TZREG2 "SYSTEM\\CurrentControlSet\\Control\\TimeZoneInformation"
+#define TZREG _T("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Time Zones")
+#define TZREG_9X _T("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Time Zones")
+//#define TZREG2 _T("SYSTEM\\CurrentControlSet\\Control\\TimeZoneInformation")
#define MAX_SIZE 512
-#include <vector>
-#include <algorithm>
+#include "common.h"
struct REG_TZI {
- long Bias;
- long StandardBias;
- long DaylightBias;
+ LONG Bias;
+ LONG StandardBias;
+ LONG DaylightBias;
SYSTEMTIME StandardDate;
SYSTEMTIME DaylightDate;
};
@@ -31,10 +30,10 @@ struct LS_TZREG { unsigned int list_index;
- bool operator<(const LS_TZREG &other);
+ static int compare(const LS_TZREG *p1, const LS_TZREG *p2);
};
-typedef std::vector< LS_TZREG > TimeList;
+typedef OBJLIST< LS_TZREG > TimeList;
extern TimeList timezone_list, geo_timezone_list;
bool build_timezone_list();
|