diff options
author | George Hazan <george.hazan@gmail.com> | 2012-12-02 18:19:49 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-12-02 18:19:49 +0000 |
commit | c4582dd65b444e5dae29ada7cc3f6c9a9c20edf3 (patch) | |
tree | 17a8627550b202d62df8e1df76d2585d3d0cdeaa /plugins/Sessions | |
parent | 5ea5feb7e052ca45af7bc9ed76e4a252bd71950d (diff) |
new easy standard way of registering icons: Icon_Register
git-svn-id: http://svn.miranda-ng.org/main/trunk@2601 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Sessions')
-rw-r--r-- | plugins/Sessions/Src/Main.cpp | 35 | ||||
-rw-r--r-- | plugins/Sessions/Src/Options.cpp | 5 | ||||
-rw-r--r-- | plugins/Sessions/Src/Sessions.h | 4 | ||||
-rw-r--r-- | plugins/Sessions/Src/Utils.cpp | 16 | ||||
-rw-r--r-- | plugins/Sessions/Src/Utils.h | 1 |
5 files changed, 22 insertions, 39 deletions
diff --git a/plugins/Sessions/Src/Main.cpp b/plugins/Sessions/Src/Main.cpp index 31d5bdddac..05674e29a7 100644 --- a/plugins/Sessions/Src/Main.cpp +++ b/plugins/Sessions/Src/Main.cpp @@ -25,8 +25,7 @@ WNDPROC mainProc; HANDLE
hServiceOpenManager, hServiceShowFavMenu, hServiceCloseCurrentSession, hServiceSaveUserSession,
- hServiceLoadLastSession, hmSaveCurrentSession, hmLoadLastSession, hmLoadSession, hmSessionsManager,
- hibSessions, hibSessionsLoad, hibSessionsSave, hibSessionsLoadLast, hibChecked, hibNotChecked;
+ hServiceLoadLastSession, hmSaveCurrentSession, hmLoadLastSession, hmLoadSession, hmSessionsManager;
HANDLE hmTBButton[2],hiTBbutton[2],iTBbutton[2];
@@ -73,6 +72,15 @@ PLUGININFOEX pluginInfo = { { 0x60558872, 0x2aab, 0x45aa, { 0x88, 0x8d, 0x9, 0x76, 0x91, 0xc9, 0xb6, 0x83 } }
};
+IconItem iconList[] =
+{
+ { LPGEN("Sessions"), "Sessions", IDD_SESSION_CHECKED },
+ { LPGEN("Favorite Session"), "SessionMarked", IDD_SESSION_CHECKED },
+ { LPGEN("Not favorite Session"), "SessionUnMarked", IDD_SESSION_UNCHECKED },
+ { LPGEN("Load Session"), "SessionsLoad", IDI_SESSIONS_LOAD },
+ { LPGEN("Save Session"), "SessionsSave", IDD_SESSIONS_SAVE },
+ { LPGEN("Load last Session"), "SessionsLoadLast", IDD_SESSIONS_LOADLAST }
+};
INT_PTR CALLBACK ExitDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam)
{
@@ -849,22 +857,22 @@ static int CreateButtons(WPARAM wparam,LPARAM lparam) button.pszService = MS_SESSIONS_OPENMANAGER;
button.pszTooltipUp = button.name = LPGEN("Open Sessions Manager");
- button.hIconHandleUp = hibSessionsLoad;
+ button.hIconHandleUp = iconList[3].hIcolib;
TopToolbar_AddButton(&button);
button.pszService = MS_SESSIONS_SAVEUSERSESSION;
button.pszTooltipUp = button.name = LPGEN("Save Session");
- button.hIconHandleUp = hibSessionsSave;
+ button.hIconHandleUp = iconList[4].hIcolib;
TopToolbar_AddButton(&button);
button.pszService = MS_SESSIONS_RESTORELASTSESSION;
button.pszTooltipUp = button.name = LPGEN("Restore Last Session");
- button.hIconHandleUp = hibSessionsLoadLast;
+ button.hIconHandleUp = iconList[5].hIcolib;
TopToolbar_AddButton(&button);
button.pszService = MS_SESSIONS_SHOWFAVORITESMENU;
button.pszTooltipUp = button.name = LPGEN("Show Favorite Sessions Menu");
- button.hIconHandleUp = hibChecked;
+ button.hIconHandleUp = iconList[1].hIcolib;
TopToolbar_AddButton(&button);
return 0;
}
@@ -951,12 +959,7 @@ static int PluginInit(WPARAM wparam,LPARAM lparam) Hotkey_Register(&hkd);
// 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);
+ Icon_Register(hinstance, __INTERNAL_NAME, iconList, SIZEOF(iconList));
// Main menu
CLISTMENUITEM cl = { sizeof(cl) };
@@ -965,13 +968,13 @@ static int PluginInit(WPARAM wparam,LPARAM lparam) cl.ptszName = _T("Save session...");
cl.ptszPopupName = _T("Sessions Manager");
- cl.icolibItem = hibSessions;
+ cl.icolibItem = iconList[0].hIcolib;
cl.pszService = MS_SESSIONS_SAVEUSERSESSION;
hmSaveCurrentSession = Menu_AddMainMenuItem(&cl);
cl.ptszName = _T("Load session...");
cl.pszService = MS_SESSIONS_OPENMANAGER;
- cl.icolibItem = hibSessionsLoad;
+ cl.icolibItem = iconList[3].hIcolib;
hmLoadLastSession = Menu_AddMainMenuItem(&cl);
cl.ptszName = _T("Close session");
@@ -981,14 +984,14 @@ static int PluginInit(WPARAM wparam,LPARAM lparam) cl.ptszName = _T("Load last session");
cl.pszService = MS_SESSIONS_RESTORELASTSESSION;
- cl.icolibItem = hibSessionsLoadLast;
+ cl.icolibItem = iconList[5].hIcolib;
cl.position = 10100000;
hmLoadSession = Menu_AddMainMenuItem(&cl);
ZeroMemory(&cl, sizeof(cl));
cl.cbSize = sizeof(cl);
cl.flags = CMIM_ICON;
- cl.icolibItem = hibSessionsSave;
+ cl.icolibItem = iconList[4].hIcolib;
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hmSaveCurrentSession, (LPARAM)&cl);
return 0;
diff --git a/plugins/Sessions/Src/Options.cpp b/plugins/Sessions/Src/Options.cpp index 7c6d545225..d5295453fb 100644 --- a/plugins/Sessions/Src/Options.cpp +++ b/plugins/Sessions/Src/Options.cpp @@ -17,7 +17,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-
#include "sessions.h"
HICON hIcon;
@@ -177,8 +176,8 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam) g_opHdlg=hdlg;
bOptionsInit=TRUE;
TranslateDialogDefault(hdlg);
- hMarked = Skin_GetIconByHandle(hibChecked);
- hNotMarked = Skin_GetIconByHandle(hibNotChecked);
+ hMarked = Skin_GetIconByHandle(iconList[1].hIcolib);
+ hNotMarked = Skin_GetIconByHandle(iconList[2].hIcolib);
hIcon=(bChecked=IsMarkedUserDefSession(opses_count))?hMarked:hNotMarked;
diff --git a/plugins/Sessions/Src/Sessions.h b/plugins/Sessions/Src/Sessions.h index 11883cae42..f775892dea 100644 --- a/plugins/Sessions/Src/Sessions.h +++ b/plugins/Sessions/Src/Sessions.h @@ -46,8 +46,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "Version.h"
#include "Resource.h"
-extern HANDLE hibChecked;
-extern HANDLE hibNotChecked;
+extern IconItem iconList[];
#define MIIM_STRING 0x00000040
@@ -75,7 +74,6 @@ extern BOOL g_bIncompletedSave; #define TIMERID_SHOW 11
#define TIMERID_REBUILDAFTER 14
-
#define SESSIONS_NAME "sessions"
diff --git a/plugins/Sessions/Src/Utils.cpp b/plugins/Sessions/Src/Utils.cpp index 97c1d7dc95..dada08333d 100644 --- a/plugins/Sessions/Src/Utils.cpp +++ b/plugins/Sessions/Src/Utils.cpp @@ -526,22 +526,6 @@ BYTE IsMarkedUserDefSession(int ses_count) return DBGetContactSettingByte(NULL, __INTERNAL_NAME, szSessionName, 0);
}
-HANDLE AddIcon(char *name, char *description, int idx)
-{
- TCHAR tszPath[MAX_PATH];
- GetModuleFileName(hinstance, tszPath, SIZEOF(tszPath));
-
- SKINICONDESC sid = { sizeof(sid) };
- sid.flags = SIDF_PATH_TCHAR;
- sid.pszSection = __INTERNAL_NAME;
- sid.cx = sid.cy = 16;
- sid.pszDescription = description;
- sid.pszName = name;
- sid.ptszDefaultFile = tszPath;
- sid.iDefaultIndex = -idx;
- return Skin_AddIcon( &sid);
-}
-
void SavePosition(HWND hwnd, char *wndName)
{
RECT rc;
diff --git a/plugins/Sessions/Src/Utils.h b/plugins/Sessions/Src/Utils.h index 3e044a4d17..2dc9cbb733 100644 --- a/plugins/Sessions/Src/Utils.h +++ b/plugins/Sessions/Src/Utils.h @@ -33,7 +33,6 @@ int CheckForDuplicate(DWORD contact_list[],DWORD lparam); BOOL ResaveSettings(char* szName,int iFirst,int iLimit,TCHAR* pszPrevSetting);
void OffsetWindow(HWND parent, HWND hwnd, int dx, int dy);
int LoadSessionToCombobox (HWND hdlg,BOOL mode,int iLimit,char* pszSetting,int iFirstNum);
-HANDLE AddIcon(char *name, char *description, int idx);
int MarkUserDefSession(int ses_count,BYTE bCheck);
BYTE IsMarkedUserDefSession(int ses_count);
void SavePosition(HWND hWnd, char *wndName);
|