summaryrefslogtreecommitdiff
path: root/plugins/Sessions/Src/Main.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-12-01 13:25:11 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-12-01 13:25:11 +0000
commit854959cbc0a1bad2c086214be4d1a829b17a61f3 (patch)
treeee3de50f4b4e57f54ae20d139f97fa469ff90d34 /plugins/Sessions/Src/Main.cpp
parent73ddc73d92675399e4619758d4b0881418de0a6d (diff)
icolib: icon creation quirks
git-svn-id: http://svn.miranda-ng.org/main/trunk@2588 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Sessions/Src/Main.cpp')
-rw-r--r--plugins/Sessions/Src/Main.cpp85
1 files changed, 34 insertions, 51 deletions
diff --git a/plugins/Sessions/Src/Main.cpp b/plugins/Sessions/Src/Main.cpp
index ac82ba2010..31d5bdddac 100644
--- a/plugins/Sessions/Src/Main.cpp
+++ b/plugins/Sessions/Src/Main.cpp
@@ -23,12 +23,10 @@ HINSTANCE hinstance = NULL;
WNDPROC mainProc;
-HANDLE hServiceOpenManager,hServiceShowFavMenu,hServiceCloseCurrentSession,hServiceSaveUserSession,
-hServiceLoadLastSession,hmSaveCurrentSession, hmLoadLastSession,hmLoadSession,hmSessionsManager,
-hibSessionsLoad,hibSessionsSave,hibSessionsLoadLast,hibChecked,hibNotChecked;
-
-HICON hiChecked,hiNotChecked,hiSessions,hiSessionsLoad ,hiSessionsSave,hiSessionsLoadLast;
-
+HANDLE
+ hServiceOpenManager, hServiceShowFavMenu, hServiceCloseCurrentSession, hServiceSaveUserSession,
+ hServiceLoadLastSession, hmSaveCurrentSession, hmLoadLastSession, hmLoadSession, hmSessionsManager,
+ hibSessions, hibSessionsLoad, hibSessionsSave, hibSessionsLoadLast, hibChecked, hibNotChecked;
HANDLE hmTBButton[2],hiTBbutton[2],iTBbutton[2];
@@ -781,18 +779,9 @@ int SessionPreShutdown(WPARAM wparam,LPARAM lparam)
if (g_hDlg) DestroyWindow(g_hDlg);
if (g_hSDlg) DestroyWindow(g_hSDlg);
- DestroyIcon(hiSessions);
- DestroyIcon(hiSessionsLoad);
- DestroyIcon(hiSessionsSave);
- DestroyIcon(hiSessionsLoadLast);
- DestroyIcon(hiChecked);
- DestroyIcon(hiNotChecked);
-
- if(g_bIncompletedSave)
- {
+ if(g_bIncompletedSave) {
int i=0;
- while(session_list_recovered[i])
- {
+ while(session_list_recovered[i]) {
DBWriteContactSettingByte((HANDLE)session_list_recovered[i], __INTERNAL_NAME, "wasInLastSession", 0);
i++;
}
@@ -888,21 +877,20 @@ static int PluginInit(WPARAM wparam,LPARAM lparam)
HookEvent(ME_OPT_INITIALISE, OptionsInit);
HookEvent(ME_TTB_MODULELOADED, CreateButtons);
- hServiceShowFavMenu=CreateServiceFunction(MS_SESSIONS_SHOWFAVORITESMENU, BuildFavMenu);
- hServiceOpenManager=CreateServiceFunction(MS_SESSIONS_OPENMANAGER, OpenSessionsManagerWindow);
- hServiceLoadLastSession=CreateServiceFunction(MS_SESSIONS_RESTORELASTSESSION, LoadLastSession/*LoadSession*/);
- hServiceSaveUserSession=CreateServiceFunction(MS_SESSIONS_SAVEUSERSESSION, SaveUserSessionHandles);
- hServiceCloseCurrentSession=CreateServiceFunction(MS_SESSIONS_CLOSESESSION, CloseCurrentSession);
+ hServiceShowFavMenu = CreateServiceFunction(MS_SESSIONS_SHOWFAVORITESMENU, BuildFavMenu);
+ hServiceOpenManager = CreateServiceFunction(MS_SESSIONS_OPENMANAGER, OpenSessionsManagerWindow);
+ hServiceLoadLastSession = CreateServiceFunction(MS_SESSIONS_RESTORELASTSESSION, LoadLastSession/*LoadSession*/);
+ hServiceSaveUserSession = CreateServiceFunction(MS_SESSIONS_SAVEUSERSESSION, SaveUserSessionHandles);
+ hServiceCloseCurrentSession = CreateServiceFunction(MS_SESSIONS_CLOSESESSION, CloseCurrentSession);
- g_ses_count=DBGetContactSettingByte(0, __INTERNAL_NAME, "UserSessionsCount", 0);
+ g_ses_count = DBGetContactSettingByte(0, __INTERNAL_NAME, "UserSessionsCount", 0);
if (!g_ses_count)
- g_ses_count=DBGetContactSettingByte(0, "Sessions (Unicode)", "UserSessionsCount", 0);
- ses_limit=DBGetContactSettingByte(0, __INTERNAL_NAME, "TrackCount", 10);
- g_bExclHidden=DBGetContactSettingByte(NULL, __INTERNAL_NAME, "ExclHidden", 0);
- g_bWarnOnHidden=DBGetContactSettingByte(NULL, __INTERNAL_NAME, "WarnOnHidden", 0);
- g_bOtherWarnings=DBGetContactSettingByte(NULL, __INTERNAL_NAME, "OtherWarnings", 1);
- g_bCrashRecovery=DBGetContactSettingByte(NULL, __INTERNAL_NAME, "CrashRecovery", 0);
-
+ g_ses_count = DBGetContactSettingByte(0, "Sessions (Unicode)", "UserSessionsCount", 0);
+ ses_limit = DBGetContactSettingByte(0, __INTERNAL_NAME, "TrackCount", 10);
+ g_bExclHidden = DBGetContactSettingByte(NULL, __INTERNAL_NAME, "ExclHidden", 0);
+ g_bWarnOnHidden = DBGetContactSettingByte(NULL, __INTERNAL_NAME, "WarnOnHidden", 0);
+ g_bOtherWarnings = DBGetContactSettingByte(NULL, __INTERNAL_NAME, "OtherWarnings", 1);
+ g_bCrashRecovery = DBGetContactSettingByte(NULL, __INTERNAL_NAME, "CrashRecovery", 0);
if(g_bCrashRecovery)
g_bIncompletedSave=!DBGetContactSettingByte(NULL, __INTERNAL_NAME, "lastSaveCompleted", 0);
@@ -938,8 +926,8 @@ static int PluginInit(WPARAM wparam,LPARAM lparam)
g_hDlg=CreateDialog(hinstance,MAKEINTRESOURCE(IDD_WLCMDIALOG), 0, LoadSessionDlgProc);
}
- HOTKEYDESC hkd = {0};
- hkd.cbSize = sizeof(hkd);
+ // Hotkeys
+ HOTKEYDESC hkd = { sizeof(hkd) };
hkd.dwFlags = HKD_TCHAR;
hkd.ptszSection = _T("Sessions");
hkd.pszName = "OpenSessionsManager";
@@ -962,50 +950,45 @@ static int PluginInit(WPARAM wparam,LPARAM lparam)
hkd.pszService = MS_SESSIONS_CLOSESESSION;
Hotkey_Register(&hkd);
- hiChecked = LoadIcon(hinstance, MAKEINTRESOURCE(IDD_SESSION_CHECKED));
- hiNotChecked = LoadIcon(hinstance, MAKEINTRESOURCE(IDD_SESSION_UNCHECKED));
-
- hiSessions = LoadIcon(hinstance, MAKEINTRESOURCE(IDI_SESSIONS));
- hiSessionsLoad = LoadIcon(hinstance, MAKEINTRESOURCE(IDI_SESSIONS_LOAD));
- hiSessionsSave = LoadIcon(hinstance, MAKEINTRESOURCE(IDD_SESSIONS_SAVE));
- hiSessionsLoadLast = LoadIcon(hinstance, MAKEINTRESOURCE(IDD_SESSIONS_LOADLAST));
-
- hibChecked = AddIcon(hiChecked, "SessionMarked", LPGENT("Favorite Session"));
- hibNotChecked = AddIcon(hiNotChecked, "SessionUnMarked", LPGENT("Not favorite Session"));
- hibSessionsLoad = AddIcon(hiSessionsLoad, "SessionsLoad", LPGENT("Load Session"));
- hibSessionsSave = AddIcon(hiSessionsSave, "SessionsSave", LPGENT("Save Session"));
- hibSessionsLoadLast = AddIcon(hiSessionsLoadLast, "SessionsLoadLast", LPGENT("Load last Session"));
+ // Icons
+ hibSessions = AddIcon("Sessions", LPGEN("Sessions"), IDD_SESSION_CHECKED);
+ hibChecked = AddIcon("SessionMarked", LPGEN("Favorite Session"), IDD_SESSION_CHECKED);
+ hibNotChecked = AddIcon("SessionUnMarked", LPGEN("Not favorite Session"), IDD_SESSION_UNCHECKED);
+ hibSessionsLoad = AddIcon("SessionsLoad", LPGEN("Load Session"), IDI_SESSIONS_LOAD);
+ hibSessionsSave = AddIcon("SessionsSave", LPGEN("Save Session"), IDD_SESSIONS_SAVE);
+ hibSessionsLoadLast = AddIcon("SessionsLoadLast", LPGEN("Load last Session"), IDD_SESSIONS_LOADLAST);
+ // Main menu
CLISTMENUITEM cl = { sizeof(cl) };
cl.position = 1000000000;
- cl.flags = CMIM_ALL | CMIF_TCHAR;
+ cl.flags = CMIM_ALL | CMIF_TCHAR | CMIF_ICONFROMICOLIB;
cl.ptszName = _T("Save session...");
cl.ptszPopupName = _T("Sessions Manager");
- cl.hIcon = hiSessions;
+ cl.icolibItem = hibSessions;
cl.pszService = MS_SESSIONS_SAVEUSERSESSION;
hmSaveCurrentSession = Menu_AddMainMenuItem(&cl);
cl.ptszName = _T("Load session...");
cl.pszService = MS_SESSIONS_OPENMANAGER;
- cl.hIcon = hiSessionsLoad;
+ cl.icolibItem = hibSessionsLoad;
hmLoadLastSession = Menu_AddMainMenuItem(&cl);
cl.ptszName = _T("Close session");
cl.pszService = MS_SESSIONS_CLOSESESSION;
- cl.hIcon = 0;
+ cl.icolibItem = 0;
hmLoadSession = Menu_AddMainMenuItem(&cl);
cl.ptszName = _T("Load last session");
cl.pszService = MS_SESSIONS_RESTORELASTSESSION;
- cl.hIcon = hiSessionsLoadLast;
+ cl.icolibItem = hibSessionsLoadLast;
cl.position = 10100000;
hmLoadSession = Menu_AddMainMenuItem(&cl);
ZeroMemory(&cl, sizeof(cl));
cl.cbSize = sizeof(cl);
cl.flags = CMIM_ICON;
- cl.hIcon = hiSessionsSave;
+ cl.icolibItem = hibSessionsSave;
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hmSaveCurrentSession, (LPARAM)&cl);
return 0;