diff options
author | Alexey Kulakov <panda75@bk.ru> | 2012-06-23 09:59:45 +0000 |
---|---|---|
committer | Alexey Kulakov <panda75@bk.ru> | 2012-06-23 09:59:45 +0000 |
commit | d32a469270d6032ce394418099ebeb17771afc3f (patch) | |
tree | cc8149b559d195849b5a4bdec07762ceefc68778 /plugins/TopToolBar | |
parent | d8478067cac03ff0c8378a9915525bedc27231db (diff) |
removed unneded icons
fixed internal pushed buttons
git-svn-id: http://svn.miranda-ng.org/main/trunk@538 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/TopToolBar')
18 files changed, 87 insertions, 106 deletions
diff --git a/plugins/TopToolBar/InternalButtons.cpp b/plugins/TopToolBar/InternalButtons.cpp index 5e2413f5d0..8f0fbedfcd 100644 --- a/plugins/TopToolBar/InternalButtons.cpp +++ b/plugins/TopToolBar/InternalButtons.cpp @@ -8,17 +8,13 @@ int LoadInternalButtons( HWND );
int UnLoadInternalButtons();
-extern HINSTANCE hInst;
-HANDLE hSettingChangedHook;
+extern HINSTANCE hInst;
-static int ShowOnline, ShowGroups, SoundsEnabled;
static HANDLE hOnlineBut, hGroupBut, hSoundsBut, hOptionsBut, hMainMenuBut;
static HANDLE hMinimizeBut;
static HANDLE hFindUsers;
-static HANDLE OnSettingChg;
-
static HWND hwndContactTree;
int OnSettingChanging(WPARAM wParam, LPARAM lParam)
@@ -52,7 +48,7 @@ int OnSettingChanging(WPARAM wParam, LPARAM lParam) if (!strcmp(dbcws->szModule, "Skin")) {
if (!strcmp(dbcws->szSetting, "UseSound")) {
int val = dbcws->value.bVal;
- CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)hSoundsBut, (LPARAM)(val)?TTBST_PUSHED:TTBST_RELEASED);
+ CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)hSoundsBut, (LPARAM)(val)?TTBST_RELEASED:TTBST_PUSHED);
return 0;
}
}
@@ -90,29 +86,26 @@ INT_PTR TTBInternalSoundsOnOff(WPARAM wParam, LPARAM lParam) int UnLoadInternalButtons()
{
- if (hSettingChangedHook)
- UnhookEvent(hSettingChangedHook);
return 0;
}
int LoadInternalButtons(HWND hwnd)
{
hwndContactTree = hwnd;
- hSettingChangedHook = 0;
arServices.insert( CreateServiceFunction(TTBI_GROUPSHOWHIDE, TTBInternalGroupShowHide));
arServices.insert( CreateServiceFunction(TTBI_SOUNDSONOFF, TTBInternalSoundsOnOff));
arServices.insert( CreateServiceFunction(TTBI_MAINMENUBUTT, TTBInternalMainMenuButt));
- ShowOnline = DBGetContactSettingByte(NULL, "CList", "HideOffline", 0);
- ShowGroups = DBGetContactSettingByte(NULL, "CList", "UseGroups", 2);
- SoundsEnabled = DBGetContactSettingByte(NULL, "Skin", "UseSound", 1);
+ int ShowOnline = DBGetContactSettingByte(NULL, "CList", "HideOffline", 0);
+ int ShowGroups = DBGetContactSettingByte(NULL, "CList", "UseGroups", 2);
+ int SoundsEnabled = DBGetContactSettingByte(NULL, "Skin", "UseSound", 1);
TTBButton ttb = { 0 };
ttb.cbSize = sizeof(ttb);
ttb.hIconUp = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_SHOWONLINEUP), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
ttb.hIconDn = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_SHOWONLINEDN), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
- ttb.dwFlags = (ShowOnline?TTBBF_PUSHED:0)|TTBBF_VISIBLE|TTBBF_SHOWTOOLTIP|TTBBF_ASPUSHBUTTON;
+ ttb.dwFlags = (ShowOnline?TTBBF_PUSHED:0)|TTBBF_VISIBLE|TTBBF_SHOWTOOLTIP|TTBBF_ASPUSHBUTTON|TTBBF_INTERNAL;
ttb.pszService = MS_CLIST_SETHIDEOFFLINE;
ttb.wParamUp = ttb.wParamDown = -1;
ttb.name = "Show only Online Users";
@@ -122,42 +115,42 @@ int LoadInternalButtons(HWND hwnd) ttb.hIconUp = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_GROUPSUP), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
ttb.hIconDn = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_GROUPSDN), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
- ttb.dwFlags = (ShowGroups?TTBBF_PUSHED:0)|TTBBF_VISIBLE|TTBBF_SHOWTOOLTIP|TTBBF_ASPUSHBUTTON;
+ ttb.dwFlags = (ShowGroups?TTBBF_PUSHED:0)|TTBBF_VISIBLE|TTBBF_SHOWTOOLTIP|TTBBF_ASPUSHBUTTON|TTBBF_INTERNAL;
ttb.pszService = TTBI_GROUPSHOWHIDE;
ttb.name = "Groups On/Off";
hGroupBut = (HANDLE)TTBAddButton((WPARAM)&ttb, 0);
ttb.hIconUp = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_SOUNDUP), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
ttb.hIconDn = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_SOUNDDN), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
- ttb.dwFlags = (SoundsEnabled?TTBBF_PUSHED:0)|TTBBF_VISIBLE|TTBBF_SHOWTOOLTIP|TTBBF_ASPUSHBUTTON;
+ ttb.dwFlags = (SoundsEnabled?0:TTBBF_PUSHED)|TTBBF_VISIBLE|TTBBF_SHOWTOOLTIP|TTBBF_ASPUSHBUTTON|TTBBF_INTERNAL;
ttb.pszService = TTBI_SOUNDSONOFF;
ttb.name = "Sounds Enable/Disable";
hSoundsBut = (HANDLE)TTBAddButton((WPARAM)&ttb, 0);
ttb.hIconUp = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_OPTIONSUP), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
- ttb.hIconDn = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_OPTIONSDN), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
- ttb.dwFlags = TTBBF_VISIBLE|TTBBF_SHOWTOOLTIP;
+ ttb.hIconDn = 0;
+ ttb.dwFlags = TTBBF_VISIBLE|TTBBF_SHOWTOOLTIP|TTBBF_INTERNAL;
ttb.pszService = "Options/OptionsCommand";
ttb.name = "Show Options Page";
hOptionsBut = (HANDLE)TTBAddButton((WPARAM)&ttb, 0);
ttb.hIconUp = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_MINIMIZEUP), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
- ttb.hIconDn = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_MINIMIZEDN), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
- ttb.dwFlags = TTBBF_VISIBLE;
+ ttb.hIconDn = 0;
+ ttb.dwFlags = TTBBF_VISIBLE|TTBBF_INTERNAL;
ttb.pszService = MS_CLIST_SHOWHIDE;
ttb.name = "Minimize Button";
hMinimizeBut = (HANDLE)TTBAddButton((WPARAM)&ttb, 0);
ttb.hIconUp = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_FINDADDUP), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
- ttb.hIconDn = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_FINDADDDN), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
- ttb.dwFlags = TTBBF_VISIBLE;
+ ttb.hIconDn = 0;
+ ttb.dwFlags = TTBBF_VISIBLE|TTBBF_INTERNAL;
ttb.pszService = MS_FINDADD_FINDADD;
ttb.name = "Find/Add Contacts";
hFindUsers = (HANDLE)TTBAddButton((WPARAM)&ttb, 0);
ttb.hIconUp = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_MIRANDAUP), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
- ttb.hIconDn = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_MIRANDADN), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
- ttb.dwFlags = TTBBF_VISIBLE|TTBBF_SHOWTOOLTIP;
+ ttb.hIconDn = 0;
+ ttb.dwFlags = TTBBF_VISIBLE|TTBBF_SHOWTOOLTIP|TTBBF_INTERNAL;
ttb.pszService = TTBI_MAINMENUBUTT;
ttb.name = "Show Main Menu";
hMainMenuBut = (HANDLE)TTBAddButton((WPARAM)&ttb, 0);
@@ -174,5 +167,10 @@ int LoadInternalButtons(HWND hwnd) CallService(MS_TTB_SETBUTTONOPTIONS, MAKEWPARAM(TTBO_TIPNAME, hOptionsBut),
(LPARAM)"Show Options");
- return 0;
+ CallService(MS_TTB_SETBUTTONOPTIONS, MAKEWPARAM(TTBO_TIPNAME, hMainMenuBut),
+ (LPARAM)"Show Main Menu");
+
+ arHooks.insert(HookEvent(ME_DB_CONTACT_SETTINGCHANGED,OnSettingChanging));
+
+ return 0;
}
diff --git a/plugins/TopToolBar/TopToolBar.vcxproj b/plugins/TopToolBar/TopToolBar.vcxproj index 18acc171d6..2198ce9788 100644 --- a/plugins/TopToolBar/TopToolBar.vcxproj +++ b/plugins/TopToolBar/TopToolBar.vcxproj @@ -239,20 +239,14 @@ </ItemGroup>
<ItemGroup>
<None Include="bmp\sep.bmp" />
- <None Include="icos\Find_Add Contacts_DN.ico" />
<None Include="icos\Find_Add Contacts_UP.ico" />
<None Include="icos\Groups On_Off_DN.ico" />
<None Include="icos\Groups On_Off_UP.ico" />
- <None Include="icos\Minimize Button_DN.ico" />
<None Include="icos\Minimize Button_UP.ico" />
- <None Include="icos\notick.ico" />
- <None Include="icos\notick1.ico" />
<None Include="icos\Run.ico" />
- <None Include="icos\Show Main Menu_DN.ico" />
<None Include="icos\Show Main Menu_UP.ico" />
<None Include="icos\Show only Online Users_DN.ico" />
<None Include="icos\Show only Online Users_UP.ico" />
- <None Include="icos\Show Options Page_DN.ico" />
<None Include="icos\Show Options Page_UP.ico" />
<None Include="icos\Sounds Enable_Disable_DN.ico" />
<None Include="icos\Sounds Enable_Disable_UP.ico" />
diff --git a/plugins/TopToolBar/TopToolBar.vcxproj.filters b/plugins/TopToolBar/TopToolBar.vcxproj.filters index b9a24e0f04..e6f6451e3c 100644 --- a/plugins/TopToolBar/TopToolBar.vcxproj.filters +++ b/plugins/TopToolBar/TopToolBar.vcxproj.filters @@ -26,9 +26,6 @@ </ClInclude>
</ItemGroup>
<ItemGroup>
- <None Include="icos\Find_Add Contacts_DN.ico">
- <Filter>Resource Files</Filter>
- </None>
<None Include="icos\Find_Add Contacts_UP.ico">
<Filter>Resource Files</Filter>
</None>
@@ -38,24 +35,12 @@ <None Include="icos\Groups On_Off_UP.ico">
<Filter>Resource Files</Filter>
</None>
- <None Include="icos\Minimize Button_DN.ico">
- <Filter>Resource Files</Filter>
- </None>
<None Include="icos\Minimize Button_UP.ico">
<Filter>Resource Files</Filter>
</None>
- <None Include="icos\notick.ico">
- <Filter>Resource Files</Filter>
- </None>
- <None Include="icos\notick1.ico">
- <Filter>Resource Files</Filter>
- </None>
<None Include="icos\Run.ico">
<Filter>Resource Files</Filter>
</None>
- <None Include="icos\Show Main Menu_DN.ico">
- <Filter>Resource Files</Filter>
- </None>
<None Include="icos\Show Main Menu_UP.ico">
<Filter>Resource Files</Filter>
</None>
@@ -65,9 +50,6 @@ <None Include="icos\Show only Online Users_UP.ico">
<Filter>Resource Files</Filter>
</None>
- <None Include="icos\Show Options Page_DN.ico">
- <Filter>Resource Files</Filter>
- </None>
<None Include="icos\Show Options Page_UP.ico">
<Filter>Resource Files</Filter>
</None>
diff --git a/plugins/TopToolBar/common.h b/plugins/TopToolBar/common.h index 70b365044d..61fdbdcd0d 100644 --- a/plugins/TopToolBar/common.h +++ b/plugins/TopToolBar/common.h @@ -40,6 +40,8 @@ #define TTBDEFAULT_USEBITMAP 0
#define TTBDEFAULT_SELBKCOLOUR GetSysColor(COLOR_HIGHLIGHT)
+#define TTBBF_INTERNAL 0x1000000
+
///////////////////////////////////////////////////////////////////////////////
// TopButtonInt class
diff --git a/plugins/TopToolBar/icos/Find_Add Contacts_DN.ico b/plugins/TopToolBar/icos/Find_Add Contacts_DN.ico Binary files differdeleted file mode 100644 index 06027e5bbe..0000000000 --- a/plugins/TopToolBar/icos/Find_Add Contacts_DN.ico +++ /dev/null diff --git a/plugins/TopToolBar/icos/Minimize Button_DN.ico b/plugins/TopToolBar/icos/Minimize Button_DN.ico Binary files differdeleted file mode 100644 index 1fc45867e8..0000000000 --- a/plugins/TopToolBar/icos/Minimize Button_DN.ico +++ /dev/null diff --git a/plugins/TopToolBar/icos/Show Main Menu_DN.ico b/plugins/TopToolBar/icos/Show Main Menu_DN.ico Binary files differdeleted file mode 100644 index 075649f4ac..0000000000 --- a/plugins/TopToolBar/icos/Show Main Menu_DN.ico +++ /dev/null diff --git a/plugins/TopToolBar/icos/Show Options Page_DN.ico b/plugins/TopToolBar/icos/Show Options Page_DN.ico Binary files differdeleted file mode 100644 index 62558dbd69..0000000000 --- a/plugins/TopToolBar/icos/Show Options Page_DN.ico +++ /dev/null diff --git a/plugins/TopToolBar/icos/icon1.ico b/plugins/TopToolBar/icos/icon1.ico Binary files differdeleted file mode 100644 index bf61a00df5..0000000000 --- a/plugins/TopToolBar/icos/icon1.ico +++ /dev/null diff --git a/plugins/TopToolBar/icos/mirandad.ico b/plugins/TopToolBar/icos/mirandad.ico Binary files differdeleted file mode 100644 index 423daa96e1..0000000000 --- a/plugins/TopToolBar/icos/mirandad.ico +++ /dev/null diff --git a/plugins/TopToolBar/icos/mirandau.ico b/plugins/TopToolBar/icos/mirandau.ico Binary files differdeleted file mode 100644 index 423daa96e1..0000000000 --- a/plugins/TopToolBar/icos/mirandau.ico +++ /dev/null diff --git a/plugins/TopToolBar/icos/notick.ico b/plugins/TopToolBar/icos/notick.ico Binary files differdeleted file mode 100644 index 4ff17dfa7b..0000000000 --- a/plugins/TopToolBar/icos/notick.ico +++ /dev/null diff --git a/plugins/TopToolBar/icos/notick1.ico b/plugins/TopToolBar/icos/notick1.ico Binary files differdeleted file mode 100644 index d24d6adbbf..0000000000 --- a/plugins/TopToolBar/icos/notick1.ico +++ /dev/null diff --git a/plugins/TopToolBar/main.rc b/plugins/TopToolBar/main.rc index 4120d62c72..a0978b165e 100644 --- a/plugins/TopToolBar/main.rc +++ b/plugins/TopToolBar/main.rc @@ -43,11 +43,11 @@ BEGIN PUSHBUTTON "Set",IDC_LBUTTONSET,205,158,50,14
EDITTEXT IDC_BUTTHEIGHT,10,182,24,12,ES_AUTOHSCROLL | WS_TABSTOP
- LTEXT "Button Height:",IDC_STATIC,36,184,124,8
+ LTEXT "Button Height",IDC_STATIC,36,184,124,8
EDITTEXT IDC_BUTTWIDTH,10,198,24,12,ES_AUTOHSCROLL | WS_TABSTOP
- LTEXT "Button Width: ",IDC_STATIC,36,200,124,8
+ LTEXT "Button Width ",IDC_STATIC,36,200,124,8
EDITTEXT IDC_BUTTGAP,10,214,24,12,ES_AUTOHSCROLL | WS_TABSTOP
- LTEXT "Button Gap: ",IDC_STATIC,36,216,124,8
+ LTEXT "Button Gap ",IDC_STATIC,36,216,124,8
CONTROL "Use Flat Mode",IDC_USEFLAT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,186,208,62,10
END
@@ -167,13 +167,9 @@ IDI_GROUPSDN ICON "icos\\Groups On_Off_DN.ico" IDI_SOUNDDN ICON "icos\\Sounds Enable_Disable_DN.ico"
IDI_SOUNDUP ICON "icos\\Sounds Enable_Disable_UP.ico"
IDI_OPTIONSUP ICON "icos\\Show Options Page_UP.ico"
-IDI_OPTIONSDN ICON "icos\\Show Options Page_DN.ico"
IDI_MINIMIZEUP ICON "icos\\Minimize Button_UP.ico"
-IDI_MINIMIZEDN ICON "icos\\Minimize Button_DN.ico"
IDI_FINDADDUP ICON "icos\\Find_Add Contacts_UP.ico"
-IDI_FINDADDDN ICON "icos\\Find_Add Contacts_DN.ico"
IDI_MIRANDAUP ICON "icos\\Show Main Menu_UP.ico"
-IDI_MIRANDADN ICON "icos\\Show Main Menu_DN.ico"
#endif // Russian (Russia) resources
/////////////////////////////////////////////////////////////////////////////
diff --git a/plugins/TopToolBar/resource.h b/plugins/TopToolBar/resource.h index c4ff766b8f..7a4380acfe 100644 --- a/plugins/TopToolBar/resource.h +++ b/plugins/TopToolBar/resource.h @@ -10,14 +10,9 @@ #define IDI_SOUNDDN 129
#define IDI_SOUNDUP 130
#define IDI_OPTIONSUP 131
-#define IDI_OPTIONSDN 132
#define IDI_MINIMIZEUP 133
-#define IDI_MINIMIZEDN 134
#define IDI_FINDADDUP 135
-#define IDI_FINDADDDN 136
#define IDI_MIRANDAUP 137
-#define IDI_ICON1 138
-#define IDI_MIRANDADN 139
#define IDI_RUN 140
#define IDD_OPT_TTBBKG 230
#define IDD_OPT_INTERNALORDER 262
diff --git a/plugins/TopToolBar/toolbar.cpp b/plugins/TopToolBar/toolbar.cpp index 4e06728839..81bacd8916 100644 --- a/plugins/TopToolBar/toolbar.cpp +++ b/plugins/TopToolBar/toolbar.cpp @@ -63,7 +63,7 @@ void InsertSBut(int i) ttb.cbSize = sizeof(ttb);
ttb.hIconDn = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_RUN), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
ttb.hIconUp = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_RUN), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
- ttb.dwFlags = TTBBF_VISIBLE|TTBBF_ISSBUTTON;
+ ttb.dwFlags = TTBBF_VISIBLE|TTBBF_ISSBUTTON|TTBBF_INTERNAL;
ttb.wParamDown = i;
ttb.lParamDown = TTBAddButton(( WPARAM )&ttb, 0);;
CallService(MS_TTB_SETBUTTONOPTIONS, MAKEWPARAM(TTBO_ALLDATA, ttb.lParamDown), (LPARAM)&ttb);
@@ -100,8 +100,8 @@ void InsertLBut(int i) TTBButton ttb = { 0 };
ttb.cbSize = sizeof(ttb);
ttb.hIconDn = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_RUN), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
- ttb.hIconUp = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_RUN), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
- ttb.dwFlags = TTBBF_VISIBLE | TTBBF_ISLBUTTON;
+// ttb.hIconUp = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_RUN), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
+ ttb.dwFlags = TTBBF_VISIBLE | TTBBF_ISLBUTTON | TTBBF_INTERNAL;
ttb.name = LPGEN("Default");
ttb.program = _T("Execute Path");
ttb.wParamDown = i;
@@ -123,7 +123,7 @@ void InsertSeparator(int i) {
TTBButton ttb = { 0 };
ttb.cbSize = sizeof(ttb);
- ttb.dwFlags = TTBBF_VISIBLE | TTBBF_ISSEPARATOR;
+ ttb.dwFlags = TTBBF_VISIBLE | TTBBF_ISSEPARATOR | TTBBF_INTERNAL;
ttb.wParamDown = i;
ttb.lParamDown = TTBAddButton((WPARAM)&ttb, 0);
CallService(MS_TTB_SETBUTTONOPTIONS, MAKEWPARAM(TTBO_ALLDATA, ttb.lParamDown), (LPARAM)&ttb);
@@ -282,10 +282,17 @@ INT_PTR TTBAddButton(WPARAM wParam, LPARAM lParam) b->dwFlags = but->dwFlags;
- if (b->dwFlags & TTBBF_ICONBYHANDLE)
- b->hIconDn = Skin_GetIconByHandle(but->hIconHandleDn), b->hIconUp = Skin_GetIconByHandle(but->hIconHandleUp);
- else
- b->hIconDn = but->hIconDn, b->hIconUp = but->hIconUp;
+ if (b->dwFlags & TTBBF_ICONBYHANDLE) {
+ if (but->hIconHandleDn)
+ b->hIconDn = Skin_GetIconByHandle(but->hIconHandleDn);
+ else
+ b->hIconDn = 0;
+ b->hIconUp = Skin_GetIconByHandle(but->hIconHandleUp);
+ }
+ else {
+ b->hIconDn = but->hIconDn;
+ b->hIconUp = but->hIconUp;
+ }
b->wParamUp = but->wParamUp;
b->lParamUp = but->lParamUp;
@@ -298,8 +305,10 @@ INT_PTR TTBAddButton(WPARAM wParam, LPARAM lParam) char buf[256];
sprintf(buf, "%s_up", b->name);
b->hIconUp = LoadIconFromLibrary(buf, b->hIconUp, b->hIconHandleUp);
- sprintf(buf, "%s_dn", b->name);
- b->hIconDn = LoadIconFromLibrary(buf, b->hIconDn, b->hIconHandleDn);
+ if (b->hIconDn) {
+ sprintf(buf, "%s_dn", b->name);
+ b->hIconDn = LoadIconFromLibrary(buf, b->hIconDn, b->hIconHandleDn);
+ }
}
b->LoadSettings();
@@ -710,7 +719,6 @@ LRESULT CALLBACK TopToolBarProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara return 0;
}
- b->SetBitmap();
// flag inversion inside condition coz we uses Up -> Down for non-push buttons
// condition and inversion can be moved to main condition end
if (b->bPushed) { //Dn -> Up
@@ -730,6 +738,7 @@ LRESULT CALLBACK TopToolBarProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara CallService(b->pszService, b->wParamDown, b->lParamDown);
}
+ b->SetBitmap();
ulockbut();
}
}
diff --git a/plugins/TopToolBar/topbutton.cpp b/plugins/TopToolBar/topbutton.cpp index e5705f5ecd..3091d429b4 100644 --- a/plugins/TopToolBar/topbutton.cpp +++ b/plugins/TopToolBar/topbutton.cpp @@ -156,7 +156,10 @@ void TopButtonInt::SetBitmap() else {
if (GetWindowLongPtr(hwnd, GWL_STYLE) & SS_ICON)
SetWindowLongPtr(hwnd, GWL_STYLE, curstyle | SS_ICON);
- SendMessage(hwnd, BM_SETIMAGE, IMAGE_ICON, (LPARAM)((bPushed)?(hIconDn):(hIconUp)));
+
+ HICON bicon = (hIconDn)?hIconDn:hIconUp;
+
+ SendMessage(hwnd, BM_SETIMAGE, IMAGE_ICON, (LPARAM)((bPushed)?(bicon):(hIconUp)));
SendMessage(hwnd, BM_SETCHECK, bPushed?BST_CHECKED:BST_UNCHECKED ,0);
}
}
diff --git a/plugins/TopToolBar/ttbopt.cpp b/plugins/TopToolBar/ttbopt.cpp index 882e628c08..31fc422ea4 100644 --- a/plugins/TopToolBar/ttbopt.cpp +++ b/plugins/TopToolBar/ttbopt.cpp @@ -34,7 +34,8 @@ int BuildTree(HWND hwndDlg) TopButtonInt *b = Buttons[i];
if (b->dwFlags & TTBBF_ISSEPARATOR) {
- tvis.item.mask = TVIF_PARAM | TVIF_TEXT | TVIF_STATE;
+ tvis.item.mask = TVIF_PARAM | TVIF_TEXT | TVIF_STATE | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
+ tvis.item.iImage = tvis.item.iSelectedImage = -1;
tvis.item.pszText = L"------------------";
}
else {
@@ -113,16 +114,17 @@ int SaveTree(HWND hwndDlg) static INT_PTR CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
TopButtonInt* btn;
- struct OrderData *dat = (struct OrderData*)GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_BUTTONORDERTREE), GWLP_USERDATA);
+ HWND tree = GetDlgItem(hwndDlg, IDC_BUTTONORDERTREE);
+ struct OrderData *dat = (struct OrderData*)GetWindowLongPtr(tree, GWLP_USERDATA);
switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
dat = (struct OrderData*)malloc(sizeof(struct OrderData));
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_BUTTONORDERTREE), GWLP_USERDATA, (LONG)dat);
+ SetWindowLongPtr(tree, GWLP_USERDATA, (LONG)dat);
dat->dragging = 0;
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_BUTTONORDERTREE), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_BUTTONORDERTREE), GWL_STYLE)|TVS_NOHSCROLL);
+ SetWindowLongPtr(tree, GWL_STYLE, GetWindowLongPtr(tree, GWL_STYLE)|TVS_NOHSCROLL);
SetDlgItemInt(hwndDlg, IDC_BUTTHEIGHT, BUTTHEIGHT, FALSE);
SetDlgItemInt(hwndDlg, IDC_BUTTWIDTH, BUTTWIDTH, FALSE);
@@ -156,12 +158,12 @@ static INT_PTR CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR if (ctrlid == IDC_LBUTTONSET) {
TVITEM tvi;
- tvi.hItem = TreeView_GetSelection(GetDlgItem(hwndDlg, IDC_BUTTONORDERTREE));
+ tvi.hItem = TreeView_GetSelection(tree);
if (tvi.hItem == NULL)
break;
tvi.mask = TVIF_PARAM;
- TreeView_GetItem(GetDlgItem(hwndDlg, IDC_BUTTONORDERTREE), &tvi);
+ TreeView_GetItem(tree, &tvi);
btn = (TopButtonInt*)tvi.lParam;
TCHAR buf [256];
@@ -177,7 +179,7 @@ static INT_PTR CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR tvi.mask = TVIF_TEXT;
tvi.pszText = mir_a2t( btn->name );
- TreeView_SetItem(GetDlgItem(hwndDlg, IDC_BUTTONORDERTREE), &tvi);
+ TreeView_SetItem(tree, &tvi);
}
break;
}
@@ -198,12 +200,12 @@ static INT_PTR CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR if (ctrlid == IDC_REMOVEBUTTON) {
TVITEM tvi = {0};
- tvi.hItem = TreeView_GetSelection(GetDlgItem(hwndDlg, IDC_BUTTONORDERTREE));
+ tvi.hItem = TreeView_GetSelection(tree);
if (tvi.hItem == NULL)
break;
tvi.mask = TVIF_PARAM;
- TreeView_GetItem(GetDlgItem(hwndDlg, IDC_BUTTONORDERTREE), &tvi);
+ TreeView_GetItem(tree, &tvi);
btn = (TopButtonInt*)tvi.lParam;
// if button enabled for separator and launch only, no need condition
@@ -211,12 +213,14 @@ static INT_PTR CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR if (btn->dwFlags & (TTBBF_ISSEPARATOR | TTBBF_ISLBUTTON)) {
int idx = Buttons.indexOf(btn);
if (idx != -1) {
+ TreeView_DeleteItem(tree,tvi.hItem);
+
Buttons.remove(idx);
delete btn;
ArrangeButtons();
ulockbut();
- OptionsPageRebuild();
+// OptionsPageRebuild();
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
}
}
@@ -251,7 +255,7 @@ static INT_PTR CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR SetCapture(hwndDlg);
dat->dragging = 1;
dat->hDragItem = ((LPNMTREEVIEW)lParam)->itemNew.hItem;
- TreeView_SelectItem(GetDlgItem(hwndDlg, IDC_BUTTONORDERTREE), dat->hDragItem);
+ TreeView_SelectItem(tree, dat->hDragItem);
break;
case NM_CLICK:
@@ -263,7 +267,7 @@ static INT_PTR CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR if (TreeView_HitTest(((LPNMHDR)lParam)->hwndFrom, &hti))
if (hti.flags & TVHT_ONITEMSTATEICON) {
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- TreeView_SelectItem(GetDlgItem(hwndDlg, IDC_BUTTONORDERTREE), hti.hItem);
+ TreeView_SelectItem(tree, hti.hItem);
}
}
break;
@@ -271,7 +275,7 @@ static INT_PTR CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR case TVN_SELCHANGEDA:
case TVN_SELCHANGEDW:
{
- HTREEITEM hti = TreeView_GetSelection(GetDlgItem(hwndDlg, IDC_BUTTONORDERTREE));
+ HTREEITEM hti = TreeView_GetSelection(tree);
if (hti == NULL)
break;
@@ -295,10 +299,8 @@ static INT_PTR CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR }
else
{
- if (btn->dwFlags & TTBBF_ISSEPARATOR)
- EnableWindow(GetDlgItem(hwndDlg, IDC_REMOVEBUTTON), TRUE);
- else
- EnableWindow(GetDlgItem(hwndDlg, IDC_REMOVEBUTTON), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg,IDC_REMOVEBUTTON),
+ (btn->dwFlags & TTBBF_ISSEPARATOR)?TRUE:FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_ENAME), FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_EPATH), FALSE);
@@ -319,17 +321,17 @@ static INT_PTR CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR hti.pt.x = (short)LOWORD(lParam);
hti.pt.y = (short)HIWORD(lParam);
ClientToScreen(hwndDlg, &hti.pt);
- ScreenToClient(GetDlgItem(hwndDlg, IDC_BUTTONORDERTREE), &hti.pt);
- TreeView_HitTest(GetDlgItem(hwndDlg, IDC_BUTTONORDERTREE), &hti);
+ ScreenToClient(tree, &hti.pt);
+ TreeView_HitTest(tree, &hti);
if (hti.flags & (TVHT_ONITEM | TVHT_ONITEMRIGHT)) {
- hti.pt.y -= TreeView_GetItemHeight(GetDlgItem(hwndDlg, IDC_BUTTONORDERTREE))/2;
- TreeView_HitTest(GetDlgItem(hwndDlg, IDC_BUTTONORDERTREE), &hti);
- TreeView_SetInsertMark(GetDlgItem(hwndDlg, IDC_BUTTONORDERTREE), hti.hItem, 1);
+ hti.pt.y -= TreeView_GetItemHeight(tree)/2;
+ TreeView_HitTest(tree, &hti);
+ TreeView_SetInsertMark(tree, hti.hItem, 1);
}
else {
- if (hti.flags & TVHT_ABOVE) SendDlgItemMessage(hwndDlg, IDC_BUTTONORDERTREE, WM_VSCROLL, MAKEWPARAM(SB_LINEUP, 0), 0);
- if (hti.flags & TVHT_BELOW) SendDlgItemMessage(hwndDlg, IDC_BUTTONORDERTREE, WM_VSCROLL, MAKEWPARAM(SB_LINEDOWN, 0), 0);
- TreeView_SetInsertMark(GetDlgItem(hwndDlg, IDC_BUTTONORDERTREE), NULL, 0);
+ if (hti.flags & TVHT_ABOVE) SendMessage(tree, WM_VSCROLL, MAKEWPARAM(SB_LINEUP, 0), 0);
+ if (hti.flags & TVHT_BELOW) SendMessage(tree, WM_VSCROLL, MAKEWPARAM(SB_LINEDOWN, 0), 0);
+ TreeView_SetInsertMark(tree, NULL, 0);
}
}
break;
@@ -344,8 +346,7 @@ static INT_PTR CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR case WM_LBUTTONUP:
if (dat->dragging) {
- HWND hTree = GetDlgItem(hwndDlg, IDC_BUTTONORDERTREE);
- TreeView_SetInsertMark(hTree, NULL, 0);
+ TreeView_SetInsertMark(tree, NULL, 0);
dat->dragging = 0;
ReleaseCapture();
@@ -353,16 +354,16 @@ static INT_PTR CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR hti.pt.x = (short)LOWORD(lParam);
hti.pt.y = (short)HIWORD(lParam);
ClientToScreen(hwndDlg, &hti.pt);
- ScreenToClient(GetDlgItem(hwndDlg, IDC_BUTTONORDERTREE), &hti.pt);
- hti.pt.y -= TreeView_GetItemHeight(GetDlgItem(hwndDlg, IDC_BUTTONORDERTREE))/2;
- TreeView_HitTest(hTree, &hti);
+ ScreenToClient(tree, &hti.pt);
+ hti.pt.y -= TreeView_GetItemHeight(tree)/2;
+ TreeView_HitTest(tree, &hti);
if (dat->hDragItem == hti.hItem)
break;
TVITEM tvi;
tvi.mask = TVIF_HANDLE|TVIF_PARAM;
tvi.hItem = hti.hItem;
- TreeView_GetItem(hTree, &tvi);
+ TreeView_GetItem(tree, &tvi);
if (hti.flags&(TVHT_ONITEM|TVHT_ONITEMRIGHT)) {
TVINSERTSTRUCT tvis;
TCHAR name[128];
@@ -371,12 +372,13 @@ static INT_PTR CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR tvis.item.pszText = name;
tvis.item.cchTextMax = SIZEOF(name);
tvis.item.hItem = dat->hDragItem;
- TreeView_GetItem(hTree, &tvis.item);
+ TreeView_GetItem(tree, &tvis.item);
- TreeView_DeleteItem(hTree, dat->hDragItem);
+ TreeView_DeleteItem(tree, dat->hDragItem);
tvis.hParent = NULL;
tvis.hInsertAfter = hti.hItem;
- TreeView_SelectItem(hTree, TreeView_InsertItem(hTree, &tvis));
+ TreeView_SelectItem(tree, TreeView_InsertItem(tree, &tvis));
+
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
}
}
|