diff options
author | George Hazan <george.hazan@gmail.com> | 2012-07-08 18:45:11 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-07-08 18:45:11 +0000 |
commit | 929cf4f6f089cc4db4eea16898402120fc812e30 (patch) | |
tree | 67218e5b14923f8021b4406249756bdf1cab232a /plugins/Clist_modern/modern_toolbar.cpp | |
parent | 71defe6c2ba6284e775f2317311e29a77c02b81d (diff) |
default buttons from Clist Nicer+ & Modern
git-svn-id: http://svn.miranda-ng.org/main/trunk@859 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Clist_modern/modern_toolbar.cpp')
-rw-r--r-- | plugins/Clist_modern/modern_toolbar.cpp | 114 |
1 files changed, 53 insertions, 61 deletions
diff --git a/plugins/Clist_modern/modern_toolbar.cpp b/plugins/Clist_modern/modern_toolbar.cpp index 05ddd64100..75a1e2e915 100644 --- a/plugins/Clist_modern/modern_toolbar.cpp +++ b/plugins/Clist_modern/modern_toolbar.cpp @@ -29,6 +29,59 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include <m_toptoolbar.h>
#include "hdr/modern_sync.h"
+struct
+{
+ char *pszButtonID, *pszButtonName, *pszServiceName;
+ char *pszTooltipUp, *pszTooltipDn;
+ int icoDefIdx, defResource, defResource2;
+ BOOL bVisByDefault;
+}
+static BTNS[] =
+{
+ { "MainMenu", "Main Menu", "CList/ShowMainMenu", "Main menu", NULL, 100 , IDI_RESETVIEW, IDI_RESETVIEW, TRUE },
+ { "StatusMenu", "Status Menu", "CList/ShowStatusMenu", "Status menu", NULL, 105 , IDI_RESETVIEW, IDI_RESETVIEW, TRUE },
+ { "AccoMgr", "Accounts", MS_PROTO_SHOWACCMGR, "Accounts...", NULL, 282 , IDI_ACCMGR, IDI_ACCMGR, TRUE },
+ { "ShowHideOffline","Show/Hide offline contacts", MS_CLIST_TOGGLEHIDEOFFLINE, "Hide offline contacts", "Show offline contacts", 110, IDI_RESETVIEW, IDI_RESETVIEW, TRUE },
+ { "DatabaseEditor","DBEditor++", "DBEditorpp/MenuCommand", "Database Editor", NULL, 130 , IDI_RESETVIEW, IDI_RESETVIEW, TRUE },
+ { "FindUser","Find User", "FindAdd/FindAddCommand", "Find User", NULL, 140 , IDI_RESETVIEW, IDI_RESETVIEW, TRUE },
+ { "Options","Options", "Options/OptionsCommand", "Options", NULL, 150 , IDI_RESETVIEW, IDI_RESETVIEW, TRUE },
+ { "UseGroups","Use/Disable groups", MS_CLIST_TOGGLEGROUPS, "Use groups", "Disable Groups", 160, IDI_RESETVIEW, IDI_RESETVIEW, FALSE },
+ { "EnableSounds","Enable/Disable sounds", MS_CLIST_TOGGLESOUNDS, "Enable sounds", "Disable Sounds", 170, IDI_RESETVIEW, IDI_RESETVIEW, FALSE },
+ { "Minimize","Minimize", "CList/ShowHide", "Minimize", NULL, 180 , IDI_RESETVIEW, IDI_RESETVIEW, FALSE }
+};
+
+int Modern_InitButtons(WPARAM, LPARAM)
+{
+ TTBButton tbb = { 0 };
+ tbb.cbSize = sizeof(tbb);
+
+ for (int i=0; i < SIZEOF(BTNS); i++ ) {
+ tbb.dwFlags = TTBBF_ICONBYHANDLE;
+ if (BTNS[i].pszButtonID) {
+ tbb.name = BTNS[i].pszButtonID;
+ tbb.pszService = BTNS[i].pszServiceName;
+ tbb.pszTooltipUp = BTNS[i].pszTooltipUp;
+ tbb.pszTooltipDn = BTNS[i].pszTooltipDn;
+
+ char buf[255];
+ mir_snprintf(buf,SIZEOF(buf),"%s%s%s", TTB_OPTDIR, BTNS[i].pszButtonID, "_dn");
+ tbb.hIconHandleUp = RegisterIcolibIconHandle( buf, "ToolBar", BTNS[i].pszButtonName , _T("icons\\toolbar_icons.dll"),-BTNS[i].icoDefIdx, g_hInst, BTNS[i].defResource );
+
+ if (BTNS[i].pszTooltipDn) {
+ mir_snprintf(buf,SIZEOF(buf),"%s%s%s", TTB_OPTDIR, BTNS[i].pszButtonID, "_up");
+ tbb.hIconHandleUp = RegisterIcolibIconHandle( buf, "ToolBar", BTNS[i].pszTooltipDn , _T("icons\\toolbar_icons.dll"),-(BTNS[i].icoDefIdx+1), g_hInst, BTNS[i].defResource2 );
+ }
+ }
+ else tbb.dwFlags |= TTBBF_ISSEPARATOR;
+
+ tbb.dwFlags |= (BTNS[i].bVisByDefault ? TTBBF_VISIBLE :0 );
+ TopToolbar_AddButton(&tbb);
+ }
+ return 1;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
#define TTB_OPTDIR "TopToolBar"
#if defined(WIN64)
@@ -44,66 +97,6 @@ static void CopySettings(const char* to, const char* from) db_set_b(NULL, TTB_OPTDIR, to, db_get_b(NULL,"ModernToolBar",from, 0));
}
-static void sttRegisterToolBarButton(char * pszButtonID, char * pszButtonName, char * pszServiceName,
- char * pszTooltipUp, char * pszTooltipDn, int icoDefIdx, int defResource, int defResource2, BOOL bVisByDefault)
-{
- TTBButton tbb = { 0 };
- static int defPos = 0;
- defPos += 100;
- tbb.cbSize = sizeof(tbb);
- tbb.dwFlags = TTBBF_ICONBYHANDLE;
- if (pszButtonID) {
- tbb.name = pszButtonID;
- tbb.pszService = pszServiceName;
-
- char buf[255];
- mir_snprintf(buf,SIZEOF(buf),"%s%s%s", "TTB_", pszButtonID, "_dn");
- tbb.hIconHandleUp = RegisterIcolibIconHandle( buf, "ToolBar", pszButtonName , _T("icons\\toolbar_icons.dll"),-icoDefIdx, g_hInst, defResource );
-
- if (pszTooltipDn) {
- mir_snprintf(buf,SIZEOF(buf),"%s%s%s", "TTB_", pszButtonID, "_up");
- tbb.hIconHandleUp = RegisterIcolibIconHandle( buf, "ToolBar", pszTooltipDn , _T("icons\\toolbar_icons.dll"),-(icoDefIdx+1), g_hInst, defResource2 );
- }
- }
- else tbb.dwFlags |= TTBBF_ISSEPARATOR;
-
- tbb.dwFlags |= (bVisByDefault ? TTBBF_VISIBLE :0 );
- CallService(MS_TTB_ADDBUTTON,0, (LPARAM)&tbb);
-}
-
-static void ToolBar_DefaultButtonRegistration()
-{
- sttRegisterToolBarButton( "MainMenu", "Main Menu", "CList/ShowMainMenu",
- "Main menu", NULL, 100 , IDI_RESETVIEW, IDI_RESETVIEW, TRUE );
-
- sttRegisterToolBarButton( "StatusMenu", "Status Menu", "CList/ShowStatusMenu",
- "Status menu", NULL, 105 , IDI_RESETVIEW, IDI_RESETVIEW, TRUE );
-
- sttRegisterToolBarButton( "AccoMgr", "Accounts", MS_PROTO_SHOWACCMGR,
- "Accounts...", NULL, 282 , IDI_ACCMGR, IDI_ACCMGR, TRUE );
-
- sttRegisterToolBarButton( "ShowHideOffline","Show/Hide offline contacts", MS_CLIST_TOGGLEHIDEOFFLINE,
- "Hide offline contacts", "Show offline contacts", 110, IDI_RESETVIEW, IDI_RESETVIEW, TRUE );
-
- sttRegisterToolBarButton( "DatabaseEditor","DBEditor++", "DBEditorpp/MenuCommand",
- "Database Editor", NULL, 130 , IDI_RESETVIEW, IDI_RESETVIEW, TRUE );
-
- sttRegisterToolBarButton( "FindUser","Find User", "FindAdd/FindAddCommand",
- "Find User", NULL, 140 , IDI_RESETVIEW, IDI_RESETVIEW, TRUE );
-
- sttRegisterToolBarButton( "Options","Options", "Options/OptionsCommand",
- "Options", NULL, 150 , IDI_RESETVIEW, IDI_RESETVIEW, TRUE );
-
- sttRegisterToolBarButton( "UseGroups","Use/Disable groups", MS_CLIST_TOGGLEGROUPS,
- "Use groups", "Disable Groups", 160, IDI_RESETVIEW, IDI_RESETVIEW, FALSE );
-
- sttRegisterToolBarButton( "EnableSounds","Enable/Disable sounds", MS_CLIST_TOGGLESOUNDS,
- "Enable sounds", "Disable Sounds", 170, IDI_RESETVIEW, IDI_RESETVIEW, FALSE );
-
- sttRegisterToolBarButton( "Minimize","Minimize", "CList/ShowHide",
- "Minimize", NULL, 180 , IDI_RESETVIEW, IDI_RESETVIEW, FALSE );
-}
-
HRESULT ToolbarLoadModule()
{
if ( db_get_b(NULL, "CLUI", "ShowButtonBar", -1) != -1) {
@@ -121,6 +114,5 @@ HRESULT ToolbarLoadModule() CallService(MS_UTILS_OPENURL, 0, (LPARAM)szUrl);
}
- ToolBar_DefaultButtonRegistration();
return S_OK;
}
|