diff options
author | George Hazan <george.hazan@gmail.com> | 2012-06-10 14:46:58 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-06-10 14:46:58 +0000 |
commit | 101ca36412b3e7b8851b6b48a4f6cbc17d9f9eff (patch) | |
tree | a846c60f7c2a7df17b694deba92e7f6df3bbb882 /plugins/TopToolBar | |
parent | a3fdadd09f12f6b246b11a5156bf6f0358e9a5f8 (diff) |
bitmap operations were removed from TopToolBar and replaced with IcoLib
git-svn-id: http://svn.miranda-ng.org/main/trunk@379 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/TopToolBar')
36 files changed, 212 insertions, 669 deletions
diff --git a/plugins/TopToolBar/InternalButtons.cpp b/plugins/TopToolBar/InternalButtons.cpp index 5b7fc1db2a..06d4488c94 100644 --- a/plugins/TopToolBar/InternalButtons.cpp +++ b/plugins/TopToolBar/InternalButtons.cpp @@ -223,7 +223,7 @@ int LoadInternalButtons(HWND hwnd) ShowGroups = DBGetContactSettingByte(NULL, "CList", "UseGroups", 2);
SoundsEnabled = DBGetContactSettingByte(NULL, "Skin", "UseSound", 1);
- TTBButtonV2 ttb = { 0 };
+ 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);
diff --git a/plugins/TopToolBar/TopToolBar.vcxproj b/plugins/TopToolBar/TopToolBar.vcxproj index f71c76676b..0822bd90e2 100644 --- a/plugins/TopToolBar/TopToolBar.vcxproj +++ b/plugins/TopToolBar/TopToolBar.vcxproj @@ -238,36 +238,17 @@ <ClInclude Include="resource.h" />
</ItemGroup>
<ItemGroup>
- <None Include="bmp\bitmap1.bmp" />
- <None Include="bmp\bmp00002.bmp" />
- <None Include="bmp\borderup.bmp" />
- <None Include="bmp\borederdn.bmp" />
- <None Include="bmp\cpaneldn.bmp" />
- <None Include="bmp\cpanelup.bmp" />
+ <None Include="bmp\sep.bmp" />
<None Include="find.ico" />
<None Include="icos\Find_Add Contacts_DN.ico" />
<None Include="icos\Find_Add Contacts_UP.ico" />
- <None Include="bmp\finduser.bmp" />
- <None Include="bmp\finduserdn.bmp" />
- <None Include="bmp\groupdn.bmp" />
<None Include="icos\Groups On_Off_DN.ico" />
<None Include="icos\Groups On_Off_UP.ico" />
- <None Include="bmp\groupup.bmp" />
- <None Include="bmp\launch.bmp" />
- <None Include="bmp\launchdn.bmp" />
- <None Include="bmp\launchup.bmp" />
- <None Include="bmp\menudn.bmp" />
- <None Include="bmp\menuup.bmp" />
<None Include="icos\Minimize Button_DN.ico" />
<None Include="icos\Minimize Button_UP.ico" />
- <None Include="bmp\minimize.bmp" />
- <None Include="bmp\minimizedn.bmp" />
<None Include="icos\notick.ico" />
<None Include="icos\notick1.ico" />
- <None Include="bmp\options.bmp" />
<None Include="icos\Run.ico" />
- <None Include="bmp\searchtest.bmp" />
- <None Include="bmp\sep.bmp" />
<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" />
@@ -276,9 +257,6 @@ <None Include="icos\Show Options Page_UP.ico" />
<None Include="icos\Sounds Enable_Disable_DN.ico" />
<None Include="icos\Sounds Enable_Disable_UP.ico" />
- <None Include="bmp\soundsdn.bmp" />
- <None Include="bmp\soundsup.bmp" />
- <None Include="bmp\test.bmp" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="main.rc">
diff --git a/plugins/TopToolBar/TopToolBar.vcxproj.filters b/plugins/TopToolBar/TopToolBar.vcxproj.filters index 12fb8c451d..43d0d470cc 100644 --- a/plugins/TopToolBar/TopToolBar.vcxproj.filters +++ b/plugins/TopToolBar/TopToolBar.vcxproj.filters @@ -26,24 +26,6 @@ </ClInclude>
</ItemGroup>
<ItemGroup>
- <None Include="bmp\bitmap1.bmp">
- <Filter>Resource Files</Filter>
- </None>
- <None Include="bmp\bmp00002.bmp">
- <Filter>Resource Files</Filter>
- </None>
- <None Include="bmp\borderup.bmp">
- <Filter>Resource Files</Filter>
- </None>
- <None Include="bmp\borederdn.bmp">
- <Filter>Resource Files</Filter>
- </None>
- <None Include="bmp\cpaneldn.bmp">
- <Filter>Resource Files</Filter>
- </None>
- <None Include="bmp\cpanelup.bmp">
- <Filter>Resource Files</Filter>
- </None>
<None Include="find.ico">
<Filter>Resource Files</Filter>
</None>
@@ -53,69 +35,27 @@ <None Include="icos\Find_Add Contacts_UP.ico">
<Filter>Resource Files</Filter>
</None>
- <None Include="bmp\finduser.bmp">
- <Filter>Resource Files</Filter>
- </None>
- <None Include="bmp\finduserdn.bmp">
- <Filter>Resource Files</Filter>
- </None>
- <None Include="bmp\groupdn.bmp">
- <Filter>Resource Files</Filter>
- </None>
<None Include="icos\Groups On_Off_DN.ico">
<Filter>Resource Files</Filter>
</None>
<None Include="icos\Groups On_Off_UP.ico">
<Filter>Resource Files</Filter>
</None>
- <None Include="bmp\groupup.bmp">
- <Filter>Resource Files</Filter>
- </None>
- <None Include="bmp\launch.bmp">
- <Filter>Resource Files</Filter>
- </None>
- <None Include="bmp\launchdn.bmp">
- <Filter>Resource Files</Filter>
- </None>
- <None Include="bmp\launchup.bmp">
- <Filter>Resource Files</Filter>
- </None>
- <None Include="bmp\menudn.bmp">
- <Filter>Resource Files</Filter>
- </None>
- <None Include="bmp\menuup.bmp">
- <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="bmp\minimize.bmp">
- <Filter>Resource Files</Filter>
- </None>
- <None Include="bmp\minimizedn.bmp">
- <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="bmp\options.bmp">
- <Filter>Resource Files</Filter>
- </None>
<None Include="icos\Run.ico">
<Filter>Resource Files</Filter>
</None>
- <None Include="bmp\searchtest.bmp">
- <Filter>Resource Files</Filter>
- </None>
- <None Include="bmp\sep.bmp">
- <Filter>Resource Files</Filter>
- </None>
<None Include="icos\Show Main Menu_DN.ico">
<Filter>Resource Files</Filter>
</None>
@@ -140,13 +80,7 @@ <None Include="icos\Sounds Enable_Disable_UP.ico">
<Filter>Resource Files</Filter>
</None>
- <None Include="bmp\soundsdn.bmp">
- <Filter>Resource Files</Filter>
- </None>
- <None Include="bmp\soundsup.bmp">
- <Filter>Resource Files</Filter>
- </None>
- <None Include="bmp\test.bmp">
+ <None Include="bmp\sep.bmp">
<Filter>Resource Files</Filter>
</None>
</ItemGroup>
diff --git a/plugins/TopToolBar/bmp/bitmap1.bmp b/plugins/TopToolBar/bmp/bitmap1.bmp Binary files differdeleted file mode 100644 index 573b7d6186..0000000000 --- a/plugins/TopToolBar/bmp/bitmap1.bmp +++ /dev/null diff --git a/plugins/TopToolBar/bmp/bmp00001.bmp b/plugins/TopToolBar/bmp/bmp00001.bmp Binary files differdeleted file mode 100644 index 7c97999188..0000000000 --- a/plugins/TopToolBar/bmp/bmp00001.bmp +++ /dev/null diff --git a/plugins/TopToolBar/bmp/bmp00002.bmp b/plugins/TopToolBar/bmp/bmp00002.bmp Binary files differdeleted file mode 100644 index 6e8e840620..0000000000 --- a/plugins/TopToolBar/bmp/bmp00002.bmp +++ /dev/null diff --git a/plugins/TopToolBar/bmp/borderup.bmp b/plugins/TopToolBar/bmp/borderup.bmp Binary files differdeleted file mode 100644 index 2d7fd71299..0000000000 --- a/plugins/TopToolBar/bmp/borderup.bmp +++ /dev/null diff --git a/plugins/TopToolBar/bmp/borederdn.bmp b/plugins/TopToolBar/bmp/borederdn.bmp Binary files differdeleted file mode 100644 index 53809acff3..0000000000 --- a/plugins/TopToolBar/bmp/borederdn.bmp +++ /dev/null diff --git a/plugins/TopToolBar/bmp/cpaneldn.bmp b/plugins/TopToolBar/bmp/cpaneldn.bmp Binary files differdeleted file mode 100644 index 2f4e2a95b5..0000000000 --- a/plugins/TopToolBar/bmp/cpaneldn.bmp +++ /dev/null diff --git a/plugins/TopToolBar/bmp/cpanelup.bmp b/plugins/TopToolBar/bmp/cpanelup.bmp Binary files differdeleted file mode 100644 index fc3531facd..0000000000 --- a/plugins/TopToolBar/bmp/cpanelup.bmp +++ /dev/null diff --git a/plugins/TopToolBar/bmp/findusedn.bmp b/plugins/TopToolBar/bmp/findusedn.bmp Binary files differdeleted file mode 100644 index f21e56fb95..0000000000 --- a/plugins/TopToolBar/bmp/findusedn.bmp +++ /dev/null diff --git a/plugins/TopToolBar/bmp/finduser.bmp b/plugins/TopToolBar/bmp/finduser.bmp Binary files differdeleted file mode 100644 index e6a884651b..0000000000 --- a/plugins/TopToolBar/bmp/finduser.bmp +++ /dev/null diff --git a/plugins/TopToolBar/bmp/finduserdn.bmp b/plugins/TopToolBar/bmp/finduserdn.bmp Binary files differdeleted file mode 100644 index 668a92c4b5..0000000000 --- a/plugins/TopToolBar/bmp/finduserdn.bmp +++ /dev/null diff --git a/plugins/TopToolBar/bmp/groupdn.bmp b/plugins/TopToolBar/bmp/groupdn.bmp Binary files differdeleted file mode 100644 index 9a106b15ee..0000000000 --- a/plugins/TopToolBar/bmp/groupdn.bmp +++ /dev/null diff --git a/plugins/TopToolBar/bmp/groupup.bmp b/plugins/TopToolBar/bmp/groupup.bmp Binary files differdeleted file mode 100644 index 7bc71b6764..0000000000 --- a/plugins/TopToolBar/bmp/groupup.bmp +++ /dev/null diff --git a/plugins/TopToolBar/bmp/launch.bmp b/plugins/TopToolBar/bmp/launch.bmp Binary files differdeleted file mode 100644 index 326c0d31c6..0000000000 --- a/plugins/TopToolBar/bmp/launch.bmp +++ /dev/null diff --git a/plugins/TopToolBar/bmp/launchdn.bmp b/plugins/TopToolBar/bmp/launchdn.bmp Binary files differdeleted file mode 100644 index 0e72934853..0000000000 --- a/plugins/TopToolBar/bmp/launchdn.bmp +++ /dev/null diff --git a/plugins/TopToolBar/bmp/launchup.bmp b/plugins/TopToolBar/bmp/launchup.bmp Binary files differdeleted file mode 100644 index 22584a7e3b..0000000000 --- a/plugins/TopToolBar/bmp/launchup.bmp +++ /dev/null diff --git a/plugins/TopToolBar/bmp/menudn.bmp b/plugins/TopToolBar/bmp/menudn.bmp Binary files differdeleted file mode 100644 index ad93aff878..0000000000 --- a/plugins/TopToolBar/bmp/menudn.bmp +++ /dev/null diff --git a/plugins/TopToolBar/bmp/menuup.bmp b/plugins/TopToolBar/bmp/menuup.bmp Binary files differdeleted file mode 100644 index a3a902ae6e..0000000000 --- a/plugins/TopToolBar/bmp/menuup.bmp +++ /dev/null diff --git a/plugins/TopToolBar/bmp/minimize.bmp b/plugins/TopToolBar/bmp/minimize.bmp Binary files differdeleted file mode 100644 index 4749fa9369..0000000000 --- a/plugins/TopToolBar/bmp/minimize.bmp +++ /dev/null diff --git a/plugins/TopToolBar/bmp/minimizedn.bmp b/plugins/TopToolBar/bmp/minimizedn.bmp Binary files differdeleted file mode 100644 index f8470a3d6a..0000000000 --- a/plugins/TopToolBar/bmp/minimizedn.bmp +++ /dev/null diff --git a/plugins/TopToolBar/bmp/options.bmp b/plugins/TopToolBar/bmp/options.bmp Binary files differdeleted file mode 100644 index 945be884f4..0000000000 --- a/plugins/TopToolBar/bmp/options.bmp +++ /dev/null diff --git a/plugins/TopToolBar/bmp/searchtest.bmp b/plugins/TopToolBar/bmp/searchtest.bmp Binary files differdeleted file mode 100644 index 2b2fda1042..0000000000 --- a/plugins/TopToolBar/bmp/searchtest.bmp +++ /dev/null diff --git a/plugins/TopToolBar/bmp/separator.bmp b/plugins/TopToolBar/bmp/separator.bmp Binary files differdeleted file mode 100644 index fa4a4449f0..0000000000 --- a/plugins/TopToolBar/bmp/separator.bmp +++ /dev/null diff --git a/plugins/TopToolBar/bmp/soundsdn.bmp b/plugins/TopToolBar/bmp/soundsdn.bmp Binary files differdeleted file mode 100644 index 224e299691..0000000000 --- a/plugins/TopToolBar/bmp/soundsdn.bmp +++ /dev/null diff --git a/plugins/TopToolBar/bmp/soundsup.bmp b/plugins/TopToolBar/bmp/soundsup.bmp Binary files differdeleted file mode 100644 index c11e7521fe..0000000000 --- a/plugins/TopToolBar/bmp/soundsup.bmp +++ /dev/null diff --git a/plugins/TopToolBar/bmp/test.bmp b/plugins/TopToolBar/bmp/test.bmp Binary files differdeleted file mode 100644 index b3b4252fef..0000000000 --- a/plugins/TopToolBar/bmp/test.bmp +++ /dev/null diff --git a/plugins/TopToolBar/common.h b/plugins/TopToolBar/common.h index 6e51009e93..7a51636e2a 100644 --- a/plugins/TopToolBar/common.h +++ b/plugins/TopToolBar/common.h @@ -58,10 +58,9 @@ struct TopButtonInt BOOL bPushed;
int dwFlags;
int x, y;
- HBITMAP hbBitmapUp, hbBitmapDown;
- HBITMAP hbDefBitmapUp, hbDefBitmapDown;
HBITMAP hbWBordBitmapUp, hbWBordBitmapDown;
HICON hIconUp, hIconDn;
+ HANDLE hIconHandleUp, hIconHandleDn;
char *pszServiceUp, *pszServiceDown;
char *name;
@@ -72,8 +71,6 @@ struct TopButtonInt LPARAM lParamDown;
WPARAM wParamDown;
WORD arrangedpos;
- TCHAR *UserDefinedbmUp;
- TCHAR *UserDefinedbmDown;
};
struct SortData
@@ -88,14 +85,7 @@ struct SortData //#define BUTTHEIGHT 16
#define SEPWIDTH 3
-struct ButtonOptData
-{
- char *name;
- int pos;
- bool show;
-};
-
-extern bool OptionsOpened, UseIcoLib, StopArrange;
+extern bool OptionsOpened, StopArrange;
extern HWND OptionshWnd;
extern HANDLE hHookTTBModuleLoaded;
extern HINSTANCE hInst;
@@ -155,7 +145,6 @@ int UnInitLBut(); void lockbut();
void ulockbut();
-int applyuserbitmaps( int );
INT_PTR TTBAddButton(WPARAM, LPARAM);
INT_PTR TTBRemoveButton(WPARAM, LPARAM);
diff --git a/plugins/TopToolBar/launchbt.cpp b/plugins/TopToolBar/launchbt.cpp index 3b5678386f..fd0e15d600 100644 --- a/plugins/TopToolBar/launchbt.cpp +++ b/plugins/TopToolBar/launchbt.cpp @@ -82,8 +82,8 @@ INT_PTR InsertLBut(int id) TTBButton ttb = { 0 };
ttb.cbSize = sizeof(ttb);
- ttb.hbBitmapDown = DefLDn;
- ttb.hbBitmapUp = DefLUp;
+ //ttb.hbBitmapDown = DefLDn; !!!!!!!!!!!!!!
+ //ttb.hbBitmapUp = DefLUp; !!!!!!!!!!!!!!
ttb.dwFlags = TTBBF_VISIBLE|TTBBF_ISLBUTTON;
ttb.pszServiceDown = TTB_LAUNCHSERVICE;
ttb.lParamDown = id;
@@ -120,7 +120,7 @@ int LoadAllLButs() memset(LBUTS, 0, sizeof(LBUTS));
for (int i = 0; i < MAXLBUTS; i++) {
memset(buf1, 0, SIZEOF(buf1));
- itoa(i, buf1, 10);
+ _itoa(i, buf1, 10);
AS(fixname, "LBUT", buf1);
id = DBGetContactSettingWord(0, TTB_OPTDIR, AS(buf, fixname, ""), -1);
if (id != -1) {
@@ -145,7 +145,7 @@ int SaveAllLButs() memset(buf, 0, SIZEOF(buf));
for (int i = 0;i<MAXLBUTS;i++) {
- itoa(i, buf1, 10);
+ _itoa(i, buf1, 10);
if (LBUTS[i].hframe != 0) {
AS(fixname, "LBUT", buf1);
DBWriteContactSettingWord(0, TTB_OPTDIR, AS(buf, fixname, ""), i);
diff --git a/plugins/TopToolBar/main.cpp b/plugins/TopToolBar/main.cpp index 04cede70ae..54b7542c24 100644 --- a/plugins/TopToolBar/main.cpp +++ b/plugins/TopToolBar/main.cpp @@ -83,4 +83,4 @@ extern "C" int __declspec(dllexport) Unload(void) DestroyHookableEvent(hHookTTBModuleLoaded);
return 0;
-}
\ No newline at end of file +}
diff --git a/plugins/TopToolBar/main.rc b/plugins/TopToolBar/main.rc index 72857524c4..332f6cac40 100644 --- a/plugins/TopToolBar/main.rc +++ b/plugins/TopToolBar/main.rc @@ -16,10 +16,8 @@ // Neutral resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU)
-#ifdef _WIN32
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
#pragma code_page(1251)
-#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
@@ -30,36 +28,27 @@ IDD_OPT_BUTORDER DIALOGEX 0, 0, 300, 231 STYLE DS_SETFONT | WS_CHILD
FONT 8, "MS Sans Serif", 0, 0, 0x1
BEGIN
- GROUPBOX "Buttons Order && Visibility", IDC_STATIC, 10, 0, 150, 180
- CONTROL "Tree1", IDC_BUTTONORDERTREE, "SysTreeView32", TVS_NOTOOLTIPS | WS_BORDER | WS_TABSTOP, 20, 25, 132, 100
- LTEXT "Buttons order:", IDC_STATIC, 20, 15, 132, 8
- CONTROL 268, IDC_BMPUP, "Static", SS_BITMAP | SS_NOTIFY, 60, 130, 13, 10
- CONTROL 268, IDC_BMPDN, "Static", SS_BITMAP | SS_NOTIFY, 115, 130, 13, 10, WS_EX_TRANSPARENT
- LTEXT "Up:", IDC_STATIC1, 35, 130, 12, 8
- LTEXT "Down:", IDC_STATIC2, 85, 130, 22, 8
- PUSHBUTTON "Default", IDC_DEFAULT, 55, 146, 50, 14
- LTEXT "Click on images to select new bitmaps.", IDC_STATIC3, 15, 165, 140, 8
- PUSHBUTTON "Add Separator", IDC_ADDSEP, 175, 15, 55, 14
- PUSHBUTTON "Del Separator", IDC_REMOVESEP, 235, 15, 55, 14
- PUSHBUTTON "Add Launch", IDC_ADDLBUTTON, 180, 60, 100, 14
- PUSHBUTTON "Del Launch", IDC_DELLBUTTON, 180, 81, 100, 14
- EDITTEXT IDC_ENAME, 195, 100, 85, 14, ES_AUTOHSCROLL
- LTEXT "Name: ", IDC_LBUTTONNAME, 170, 100, 24, 8
- EDITTEXT IDC_EPATH, 195, 121, 85, 14, ES_AUTOHSCROLL
- LTEXT "Path:", IDC_LBUTTONPATH, 170, 121, 18, 8
- PUSHBUTTON "Set", IDC_LBUTTONSET, 205, 140, 50, 14
- EDITTEXT IDC_IMGDIR, 65, 190, 205, 14, ES_AUTOHSCROLL | ES_READONLY
- GROUPBOX "Separator Button", IDC_STATIC, 165, 0, 130, 40
- GROUPBOX "Launch Button", IDC_STATIC, 165, 45, 130, 115
- PUSHBUTTON "...", IDC_OPENIMGDIR, 275, 190, 14, 14
- CONTROL "Image Directory:", IDC_STATIC, "Static", SS_LEFTNOWORDWRAP | WS_GROUP, 5, 190, 55, 10
- LTEXT "Button Height:", IDC_STATIC, 11, 210, 46, 8
- EDITTEXT IDC_BUTTHEIGHT, 65, 207, 24, 14, ES_AUTOHSCROLL
- LTEXT "Button Width: ", IDC_STATIC, 99, 210, 46, 8
- EDITTEXT IDC_BUTTWIDTH, 147, 208, 24, 14, ES_AUTOHSCROLL
- CONTROL "Use Miranda Button Class", IDC_USEMIRANDABUTTON, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 185, 210, 97, 10
- CONTROL "Use Flat Mode", IDC_USEFLAT, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 201, 220, 62, 10
- CONTROL "Use IcoLib (need restart!)", IDC_USEICOLIB, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 170, 165, 95, 10
+ GROUPBOX "Buttons Order && Visibility",IDC_STATIC,10,0,150,180
+ CONTROL "Tree1",IDC_BUTTONORDERTREE,"SysTreeView32",TVS_NOTOOLTIPS | WS_BORDER | WS_HSCROLL | WS_TABSTOP,18,25,134,148
+ LTEXT "Buttons order:",IDC_STATIC,18,15,132,8
+ PUSHBUTTON "Add Separator",IDC_ADDSEP,175,15,55,14
+ PUSHBUTTON "Del Separator",IDC_REMOVESEP,235,15,55,14
+ PUSHBUTTON "Add Launch",IDC_ADDLBUTTON,180,60,100,14
+ PUSHBUTTON "Del Launch",IDC_DELLBUTTON,180,81,100,14
+ EDITTEXT IDC_ENAME,195,111,85,14,ES_AUTOHSCROLL
+ LTEXT "Name: ",IDC_LBUTTONNAME,170,114,24,8
+ EDITTEXT IDC_EPATH,195,134,85,14,ES_AUTOHSCROLL
+ LTEXT "Path:",IDC_LBUTTONPATH,170,136,18,8
+ PUSHBUTTON "Set",IDC_LBUTTONSET,205,158,50,14
+ GROUPBOX "Separator Button",IDC_STATIC,165,0,130,40
+ GROUPBOX "Launch Button",IDC_STATIC,165,45,130,136
+ LTEXT "Button Height:",IDC_STATIC,11,190,46,8
+ EDITTEXT IDC_BUTTHEIGHT,65,187,24,14,ES_AUTOHSCROLL
+ LTEXT "Button Width: ",IDC_STATIC,11,211,46,8
+ EDITTEXT IDC_BUTTWIDTH,65,209,24,14,ES_AUTOHSCROLL
+ CONTROL "Use Miranda Button Class",IDC_USEMIRANDABUTTON,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,170,196,97,10
+ CONTROL "Use Flat Mode",IDC_USEFLAT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,186,208,62,10
+ CONTROL "Use IcoLib (need restart!)",IDC_USEICOLIB,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,170,184,95,10
END
@@ -92,25 +81,23 @@ END /////////////////////////////////////////////////////////////////////////////
-// Russian resources
+// Russian (Russia) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_RUS)
-#ifdef _WIN32
LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT
#pragma code_page(1251)
-#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
-IDD_FRAMEPLUG2 DIALOG 0, 0, 211, 11
+IDD_FRAMEPLUG2 DIALOG 0, 0, 211, 11
STYLE DS_SETFONT | WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN
FONT 8, "MS Sans Serif"
BEGIN
- CONTROL 262, IDC_P2ONLINEBUTT, "Static", SS_BITMAP | SS_NOTIFY | NOT WS_VISIBLE, 55, 0, 13, 10
- CONTROL 269, IDC_P2GROUPBUTT, "Static", SS_BITMAP | SS_NOTIFY | NOT WS_VISIBLE, 70, 0, 13, 10
+ CONTROL 262,IDC_P2ONLINEBUTT,"Static",SS_BITMAP | SS_NOTIFY | NOT WS_VISIBLE,55,0,13,10
+ CONTROL 269,IDC_P2GROUPBUTT,"Static",SS_BITMAP | SS_NOTIFY | NOT WS_VISIBLE,70,0,13,10
END
@@ -136,8 +123,6 @@ END // Bitmap
//
-IDB_TESTBITMAP BITMAP "bmp\\test.bmp"
-IDB_OPTIONS BITMAP "bmp\\options.bmp"
IDB_SEP BITMAP "bmp\\sep.bmp"
#ifdef APSTUDIO_INVOKED
@@ -146,18 +131,18 @@ IDB_SEP BITMAP "bmp\\sep.bmp" // TEXTINCLUDE
//
-1 TEXTINCLUDE
+1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
-2 TEXTINCLUDE
+2 TEXTINCLUDE
BEGIN
"#include ""winres.h""\r\n"
"\0"
END
-3 TEXTINCLUDE
+3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
@@ -194,8 +179,8 @@ IDI_MIRANDADN ICON "icos\\Show Main Menu_DN.ico" //
VS_VERSION_INFO VERSIONINFO
- FILEVERSION 0, 7, 3, 1
- PRODUCTVERSION 0, 7, 3, 1
+ FILEVERSION 0,7,3,1
+ PRODUCTVERSION 0,7,3,1
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
@@ -225,18 +210,16 @@ BEGIN END
END
-#endif // Russian resources
+#endif // Russian (Russia) resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
-// English (U.K.) resources
+// English (United Kingdom) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG)
-#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
#pragma code_page(1252)
-#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
@@ -247,7 +230,7 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK // remains consistent on all systems.
IDI_NOTICK ICON "icos\\notick.ico"
IDI_TICK ICON "icos\\notick1.ico"
-#endif // English (U.K.) resources
+#endif // English (United Kingdom) resources
/////////////////////////////////////////////////////////////////////////////
@@ -255,10 +238,8 @@ IDI_TICK ICON "icos\\notick1.ico" // English (Canada) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENC)
-#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_CAN
#pragma code_page(1252)
-#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
@@ -270,20 +251,20 @@ STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_VISIBLE EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
- GROUPBOX "TopToolBar Background", IDC_STATIC, 4, 4, 227, 124
- LTEXT "Background colour:", IDC_STATIC, 12, 20, 72, 8, NOT WS_GROUP
- CONTROL "", IDC_BKGCOLOUR, "ColourPicker", WS_TABSTOP, 84, 19, 32, 10
- LTEXT "Selection colour:", IDC_STATIC, 12, 36, 72, 8, NOT WS_VISIBLE
- CONTROL "", IDC_SELCOLOUR, "ColourPicker", NOT WS_VISIBLE | WS_TABSTOP, 84, 35, 32, 10
- CONTROL "Use background bitmap", IDC_BITMAP, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 12, 53, 161, 10
- EDITTEXT IDC_FILENAME, 22, 67, 184, 12, ES_AUTOHSCROLL
- PUSHBUTTON "...", IDC_BROWSE, 208, 67, 15, 11
- CONTROL "Stretch to width", IDC_STRETCHH, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 22, 84, 100, 10
- CONTROL "Stretch to height", IDC_STRETCHV, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 122, 84, 101, 10
- CONTROL "Tile horizontally", IDC_TILEH, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 22, 97, 100, 10
- CONTROL "Tile vertically", IDC_TILEV, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 122, 97, 101, 10
- CONTROL "Scroll with text", IDC_SCROLL, "Button", BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP, 22, 110, 100, 10
- CONTROL "Stretch proportionally", IDC_PROPORTIONAL, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 122, 110, 101, 10
+ GROUPBOX "TopToolBar Background",IDC_STATIC,4,4,227,124
+ LTEXT "Background colour:",IDC_STATIC,12,20,72,8,NOT WS_GROUP
+ CONTROL "",IDC_BKGCOLOUR,"ColourPicker",WS_TABSTOP,84,19,32,10
+ LTEXT "Selection colour:",IDC_STATIC,12,36,72,8,NOT WS_VISIBLE
+ CONTROL "",IDC_SELCOLOUR,"ColourPicker",NOT WS_VISIBLE | WS_TABSTOP,84,35,32,10
+ CONTROL "Use background bitmap",IDC_BITMAP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,53,161,10
+ EDITTEXT IDC_FILENAME,22,67,184,12,ES_AUTOHSCROLL
+ PUSHBUTTON "...",IDC_BROWSE,208,67,15,11
+ CONTROL "Stretch to width",IDC_STRETCHH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,22,84,100,10
+ CONTROL "Stretch to height",IDC_STRETCHV,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,122,84,101,10
+ CONTROL "Tile horizontally",IDC_TILEH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,22,97,100,10
+ CONTROL "Tile vertically",IDC_TILEV,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,122,97,101,10
+ CONTROL "Scroll with text",IDC_SCROLL,"Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP,22,110,100,10
+ CONTROL "Stretch proportionally",IDC_PROPORTIONAL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,122,110,101,10
END
@@ -328,3 +309,4 @@ END /////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
+
diff --git a/plugins/TopToolBar/resource.h b/plugins/TopToolBar/resource.h index d83b333797..13e4d07678 100644 --- a/plugins/TopToolBar/resource.h +++ b/plugins/TopToolBar/resource.h @@ -44,10 +44,7 @@ #define IDD_FRAMEPLUG2 265
#define IDB_GROUPUP 268
#define IDB_GROUPDN 269
-#define IDC_BMPUP 1000
-#define IDC_BMPDN 1001
#define IDC_BUTTON1 1002
-#define IDC_DEFAULT 1002
#define IDC_ADDSEP 1003
#define IDC_REMOVESEP 1004
#define IDC_ADDLBUTTON 1005
@@ -57,17 +54,12 @@ #define IDC_EPATH 1009
#define IDC_LBUTTONPATH 1011
#define IDC_LBUTTONSET 1012
-#define IDC_IMGDIR 1013
-#define IDC_OPENIMGDIR 1014
#define IDC_BUTTHEIGHT 1015
#define IDC_EDIT2 1016
#define IDC_BUTTWIDTH 1016
#define IDC_USEMIRANDABUTTON 1017
#define IDC_USEFLAT 1018
#define IDC_USEICOLIB 1019
-#define IDC_STATIC1 1020
-#define IDC_STATIC2 1021
-#define IDC_STATIC3 1022
#define IDC_BROWSE 1184
#define IDC_BKGCOLOUR 1269
#define IDC_FILENAME 1271
diff --git a/plugins/TopToolBar/separators.cpp b/plugins/TopToolBar/separators.cpp index cc765b573e..f6ef43e8ab 100644 --- a/plugins/TopToolBar/separators.cpp +++ b/plugins/TopToolBar/separators.cpp @@ -10,15 +10,11 @@ static int SeparatorCnt = 0; int InsertSeparator(int id)
{
- HBITMAP Separator = LoadBitmap(hInst, MAKEINTRESOURCE(IDB_SEP));
-
char buf[255];
wsprintfA(buf, "%s %d", Translate("Separator"), id);
TTBButton ttb = { 0 };
ttb.cbSize = sizeof(ttb);
- ttb.hbBitmapDown = Separator;
- ttb.hbBitmapUp = Separator;
ttb.dwFlags = TTBBF_VISIBLE | TTBBF_ISSEPARATOR;
ttb.pszServiceDown = "";
ttb.pszServiceUp = "";
diff --git a/plugins/TopToolBar/toolbar.cpp b/plugins/TopToolBar/toolbar.cpp index 9ed23687e3..7c0dae64d5 100644 --- a/plugins/TopToolBar/toolbar.cpp +++ b/plugins/TopToolBar/toolbar.cpp @@ -17,7 +17,7 @@ int lastypos = 1; // == == == == == == == options
COLORREF bkColour;
-HBITMAP hBmpBackground;
+HBITMAP hBmpBackground, hBmpSeparator;
int backgroundBmpUse;
static CRITICAL_SECTION csButtonsHook;
@@ -28,31 +28,10 @@ SortData arrangedbuts[MAX_BUTTONS]; int SetButtBitmap(int pos);
-int applyuserbitmaps(int pos)
-{
- int t = IMAGE_BITMAP;
- Buttons[pos].hbBitmapDown = Buttons[pos].hbDefBitmapDown;
- Buttons[pos].hbBitmapUp = Buttons[pos].hbDefBitmapUp;
- if (Buttons[pos].UserDefinedbmDown != NULL) {
- if ( _tcsstr(Buttons[pos].UserDefinedbmDown, _T(".ico")))
- t = IMAGE_ICON;
- Buttons[pos].hbBitmapDown = ( HBITMAP )LoadImage(0, Buttons[pos].UserDefinedbmDown, t, 0, 0, LR_LOADFROMFILE);
- }
-
- if (Buttons[pos].UserDefinedbmUp != NULL) {
- if ( _tcsstr(Buttons[pos].UserDefinedbmUp, _T(".ico")))
- t = IMAGE_ICON;
- Buttons[pos].hbBitmapUp = ( HBITMAP )LoadImage(0, Buttons[pos].UserDefinedbmUp, t, 0, 0, LR_LOADFROMFILE);
- }
-
- return 0;
-}
-
int SetAllBitmaps()
{
lockbut();
for (int i = 0; i < nButtonsCount; i++) {
- applyuserbitmaps(i);
SetButtBitmap(i);
}
ulockbut();
@@ -90,13 +69,6 @@ int DBSaveButtonSettings(int butpos) DBWriteContactSettingString(0, TTB_OPTDIR, AS(buf, Buttons[butpos].name, "_BmpDown"), "");
DBWriteContactSettingString(0, TTB_OPTDIR, AS(buf, Buttons[butpos].name, "_BmpUp"), "");
-
- if (Buttons[butpos].UserDefinedbmDown != NULL)
- DBWriteContactSettingTString(0, TTB_OPTDIR, AS(buf, Buttons[butpos].name, "_BmpDown"), Buttons[butpos].UserDefinedbmDown);
-
- if (Buttons[butpos].UserDefinedbmUp != NULL)
- DBWriteContactSettingTString(0, TTB_OPTDIR, AS(buf, Buttons[butpos].name, "_BmpUp"), Buttons[butpos].UserDefinedbmUp);
-
return 0;
}
@@ -121,18 +93,6 @@ int DBLoadButtonSettings(int butpos) Buttons[butpos].dwFlags = Buttons[butpos].dwFlags & (~TTBBF_VISIBLE);
if ( DBGetContactSettingDword(0, TTB_OPTDIR, AS(buf, Buttons[butpos].name, "_Visible"), oldv) > 0 )
Buttons[butpos].dwFlags |= TTBBF_VISIBLE;
-
- Buttons[butpos].UserDefinedbmDown = DBGetStringT(0, TTB_OPTDIR, AS(buf, Buttons[butpos].name, "_BmpDown"));
- if ( Buttons[butpos].UserDefinedbmDown != NULL && Buttons[butpos].UserDefinedbmDown[0] == 0) {
- mir_free(Buttons[butpos].UserDefinedbmDown);
- Buttons[butpos].UserDefinedbmDown = NULL;
- }
-
- Buttons[butpos].UserDefinedbmUp = DBGetStringT(0, TTB_OPTDIR, AS(buf, Buttons[butpos].name, "_BmpUp"));
- if ( Buttons[butpos].UserDefinedbmUp != NULL && Buttons[butpos].UserDefinedbmUp[0] == 0) {
- mir_free(Buttons[butpos].UserDefinedbmUp);
- Buttons[butpos].UserDefinedbmUp = NULL;
- }
return 0;
}
@@ -192,23 +152,23 @@ INT_PTR TTBRemoveButton(WPARAM wParam, LPARAM lParam) return 0;
}
-static HBITMAP DrawBorderForBitmap(HBITMAP hb, BOOL up)
+static HBITMAP DrawBorderForBitmap(HICON hIcon, BOOL up)
{
- HBITMAP Border, workbmp;
- HDC workdc, destdc, srcdc;
+ ICONINFO ii;
+ GetIconInfo(hIcon, &ii);
- Border = LoadBitmap(hInst, MAKEINTRESOURCE(up?IDB_BORDERUP:IDB_BORDERDN));
- workdc = GetDC(hwndContactList);
- destdc = CreateCompatibleDC(workdc);
- srcdc = CreateCompatibleDC(workdc);
+ HBITMAP Border = LoadBitmap(hInst, MAKEINTRESOURCE(up?IDB_BORDERUP:IDB_BORDERDN));
+ HDC workdc = GetDC(hwndContactList);
+ HDC destdc = CreateCompatibleDC(workdc);
+ HDC srcdc = CreateCompatibleDC(workdc);
- workbmp = CreateBitmap(BUTTWIDTH, BUTTHEIGHT, 1, GetDeviceCaps(workdc, BITSPIXEL), NULL);
+ HBITMAP workbmp = CreateBitmap(BUTTWIDTH, BUTTHEIGHT, 1, GetDeviceCaps(workdc, BITSPIXEL), NULL);
SelectObject(destdc, workbmp);
SelectObject(srcdc, Border);
BitBlt(destdc, 0, 0, BUTTWIDTH, BUTTHEIGHT, srcdc, 0, 0, SRCCOPY);
- SelectObject(srcdc, hb);
+ SelectObject(srcdc, ii.hbmColor);
BitBlt(destdc, 1, 1, BUTTWIDTH-4, BUTTHEIGHT-4, srcdc, 0, 0, SRCCOPY);
DeleteDC(destdc);
@@ -237,7 +197,7 @@ bool nameexists(const char *name) return FALSE;
}
-HICON LoadIconFromLibrary(char *SectName, char *Name, char *Description, HICON hIcon, bool RegisterIt, bool *RegistredOk)
+HICON LoadIconFromLibrary(char *Name, char *Description, HICON hIcon, HANDLE* phIcolib, bool *RegistredOk)
{
if (RegistredOk)
*RegistredOk = FALSE;
@@ -245,22 +205,20 @@ HICON LoadIconFromLibrary(char *SectName, char *Name, char *Description, HICON h if (Name != NULL && *Name != 0) {
char iconame[256];
_snprintf(iconame, SIZEOF(iconame), "toptoolbar_%s", Name);
- if ( ServiceExists(MS_SKIN2_ADDICON)) {
- if (RegisterIt) {
- SKINICONDESC sid = {0};
- sid.cbSize = sizeof(sid);
- sid.pszSection = Translate(SectName);
- sid.pszName = iconame;
- sid.pszDefaultFile = NULL;
- sid.pszDescription = Description;
- sid.hDefaultIcon = hIcon;
- CallService(MS_SKIN2_ADDICON, 0, (LPARAM)&sid);
-
- if (RegistredOk)
- *RegistredOk = TRUE;
- }
- return ((HICON)CallService(MS_SKIN2_GETICON, 0, (LPARAM)iconame));
+ if (phIcolib) {
+ SKINICONDESC sid = {0};
+ sid.cbSize = sizeof(sid);
+ sid.pszSection = "Toolbar";
+ sid.pszName = iconame;
+ sid.pszDefaultFile = NULL;
+ sid.pszDescription = Description;
+ sid.hDefaultIcon = hIcon;
+ *phIcolib = Skin_AddIcon(&sid);
+
+ if (RegistredOk)
+ *RegistredOk = TRUE;
}
+ return Skin_GetIcon(iconame);
}
return hIcon;
@@ -296,82 +254,78 @@ INT_PTR TTBAddButton(WPARAM wParam, LPARAM lParam) return -1;
int i = nButtonsCount;
- TTBButtonV2 but = { 0 };
- if (((TTBButton*)wParam)->cbSize == sizeof(TTBButton))
- memcpy(&but, (void*)wParam, sizeof(TTBButton));
-
- if (((TTBButton*)wParam)->cbSize == sizeof(TTBButtonV2))
- memcpy(&but, (void*)wParam, sizeof(TTBButtonV2));
-
- if ( but.name == NULL || nameexists(but.name)) {
+ TTBButton *but = (TTBButton*)wParam;
+ if (but->cbSize != sizeof(TTBButton) || but->name == NULL || nameexists(but->name)) {
ulockbut();
return -1;
}
- Buttons[i].id = nextButtonId++;
- Buttons[i].hbBitmapDown = but.hbBitmapDown;
- Buttons[i].hbBitmapUp = but.hbBitmapUp;
- Buttons[i].hbDefBitmapDown = but.hbBitmapDown;
- Buttons[i].hbDefBitmapUp = but.hbBitmapUp;
+ TopButtonInt& b = Buttons[i];
+ b.id = nextButtonId++;
- if (but.pszServiceDown != NULL) Buttons[i].pszServiceDown = strdup(but.pszServiceDown);
- if (but.pszServiceUp != NULL) Buttons[i].pszServiceUp = strdup(but.pszServiceUp);
- Buttons[i].name = strdup(but.name);
- Buttons[i].dwFlags = but.dwFlags;
-
- if (Buttons[i].dwFlags & TTBBF_DRAWBORDER) {
- Buttons[i].hbWBordBitmapDown = DrawBorderForBitmap(Buttons[i].hbBitmapDown, FALSE);
- Buttons[i].hbWBordBitmapUp = DrawBorderForBitmap(Buttons[i].hbBitmapUp, TRUE);
+ if (but->pszServiceDown != NULL) b.pszServiceDown = _strdup(but->pszServiceDown);
+ if (but->pszServiceUp != NULL) b.pszServiceUp = _strdup(but->pszServiceUp);
+ b.name = _strdup(but->name);
+ b.dwFlags = but->dwFlags;
+
+ if (b.dwFlags & TTBBF_ICONBYHANDLE) {
+ b.hIconHandleDn = but->hIconHandleDn;
+ b.hIconHandleUp = but->hIconHandleUp;
+ b.hIconDn = Skin_GetIconByHandle(b.hIconHandleDn);
+ b.hIconUp = Skin_GetIconByHandle(b.hIconHandleUp);
+ }
+ else {
+ b.hIconDn = but->hIconDn;
+ b.hIconUp = but->hIconUp;
}
- Buttons[i].wParamUp = but.wParamUp;
- Buttons[i].lParamUp = but.lParamUp;
- Buttons[i].wParamDown = but.wParamDown;
- Buttons[i].lParamDown = but.lParamDown;
-
- Buttons[i].dwFlags = but.dwFlags;
+ if (b.dwFlags & TTBBF_DRAWBORDER) {
+ b.hbWBordBitmapDown = DrawBorderForBitmap(b.hIconDn, FALSE);
+ b.hbWBordBitmapUp = DrawBorderForBitmap(b.hIconUp, TRUE);
+ }
- Buttons[i].bPushed = (but.dwFlags&TTBBF_PUSHED)?TRUE:FALSE;
+ b.wParamUp = but->wParamUp;
+ b.lParamUp = but->lParamUp;
+ b.wParamDown = but->wParamDown;
+ b.lParamDown = but->lParamDown;
+
+ b.bPushed = (but->dwFlags & TTBBF_PUSHED) ? TRUE : FALSE;
CreateOneWindow(i);
-
- Buttons[i].hIconUp = but.hIconUp ;
- Buttons[i].hIconDn = but.hIconDn ;
- if (UseIcoLib && (!(Buttons[i].dwFlags & TTBBF_ISSEPARATOR))) {
+ if ( !(b.dwFlags & TTBBF_ISSEPARATOR)) {
char buf[256];
- sprintf(buf, "%s_up", Buttons[i].name);
- Buttons[i].hIconUp = LoadIconFromLibrary("TopToolBar", buf, buf, but.hIconDn, TRUE, NULL);
- sprintf(buf, "%s_dn", Buttons[i].name);
- Buttons[i].hIconDn = LoadIconFromLibrary("TopToolBar", buf, buf, but.hIconUp, TRUE, NULL);
+ sprintf(buf, "%s_up", b.name);
+ b.hIconUp = LoadIconFromLibrary(buf, buf, b.hIconDn, &b.hIconHandleDn, NULL);
+ sprintf(buf, "%s_dn", b.name);
+ b.hIconDn = LoadIconFromLibrary(buf, buf, b.hIconUp, &b.hIconHandleUp, NULL);
}
- Buttons[i].hwndTip = CreateWindowEx(0, TOOLTIPS_CLASS, NULL,
+ b.hwndTip = CreateWindowEx(0, TOOLTIPS_CLASS, NULL,
WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
hwndTopToolBar, NULL, hInst,
NULL);
- SetWindowPos(Buttons[i].hwndTip, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
+ SetWindowPos(b.hwndTip, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
TOOLINFO ti = { 0 };
ti.cbSize = sizeof(ti);
ti.lpszText = _T("");
ti.hinst = hInst;
ti.uFlags = TTF_IDISHWND|TTF_SUBCLASS ;
- ti.uId = (UINT_PTR)Buttons[i].hwnd;
- SendMessage(Buttons[i].hwndTip, TTM_ADDTOOL, 0, (LPARAM)&ti);
+ ti.uId = (UINT_PTR)b.hwnd;
+ SendMessage(b.hwndTip, TTM_ADDTOOL, 0, (LPARAM)&ti);
- SendMessage(Buttons[i].hwndTip, TTM_ACTIVATE, (WPARAM)(Buttons[i].dwFlags&TTBBF_SHOWTOOLTIP)?TRUE:FALSE, 0);
+ SendMessage(b.hwndTip, TTM_ACTIVATE, (WPARAM)(b.dwFlags&TTBBF_SHOWTOOLTIP)?TRUE:FALSE, 0);
- SetWindowLongPtr(Buttons[i].hwnd, GWLP_USERDATA, Buttons[i].id);
+ SetWindowLongPtr(b.hwnd, GWLP_USERDATA, b.id);
nButtonsCount++;
- int retval = Buttons[i].id;
+ int retval = b.id;
DBLoadButtonSettings(i);
- applyuserbitmaps(i);
SetButtBitmap(i);
ulockbut();
@@ -538,39 +492,21 @@ int ArrangeButtons() int SetButtBitmap(int pos)
{
- int t = IMAGE_BITMAP;
- TCHAR *curname = (Buttons[pos].bPushed)?(Buttons[pos].UserDefinedbmDown):(Buttons[pos].UserDefinedbmUp);
-
int curstyle = GetWindowLongPtr(Buttons[pos].hwnd, GWL_STYLE);
curstyle &= (~SS_BITMAP);
curstyle &= (~SS_ICON);
- if (!UseIcoLib || (Buttons[pos].dwFlags&TTBBF_ISSEPARATOR)) {
- if (curname != NULL) {
- if ( _tcsstr(curname, _T(".ico")))
- t = IMAGE_ICON;
-
- curstyle |= (t == IMAGE_ICON || UseIcoLib) ? SS_ICON : SS_BITMAP;
- SetWindowLongPtr(Buttons[pos].hwnd, GWL_STYLE, curstyle);
- }
- else SetWindowLongPtr(Buttons[pos].hwnd, GWL_STYLE, curstyle|(Buttons[pos].hbBitmapDown == NULL?SS_ICON:SS_BITMAP));
- }
- else if (GetWindowLongPtr(Buttons[pos].hwnd, GWL_STYLE)&SS_ICON)
- SetWindowLongPtr(Buttons[pos].hwnd, GWL_STYLE, curstyle|SS_ICON);
+ if (Buttons[pos].dwFlags & TTBBF_ISSEPARATOR)
+ SetWindowLongPtr(Buttons[pos].hwnd, GWL_STYLE, curstyle | SS_BITMAP);
+ else if (GetWindowLongPtr(Buttons[pos].hwnd, GWL_STYLE) & SS_ICON)
+ SetWindowLongPtr(Buttons[pos].hwnd, GWL_STYLE, curstyle | SS_ICON);
- if ( !UseIcoLib || (Buttons[pos].dwFlags & TTBBF_ISSEPARATOR)) {
+ if (Buttons[pos].dwFlags & TTBBF_ISSEPARATOR) {
if (!(Buttons[pos].dwFlags & TTBBF_DRAWBORDER)) {
- if (Buttons[pos].hbBitmapDown == NULL) {
- t = IMAGE_ICON;
- SendMessage(Buttons[pos].hwnd, STM_SETIMAGE, t, (LPARAM)((Buttons[pos].bPushed)?(Buttons[pos].hIconDn):(Buttons[pos].hIconUp)));
- SendMessage(Buttons[pos].hwnd, BM_SETIMAGE, t, (LPARAM)((Buttons[pos].bPushed)?(Buttons[pos].hIconDn):(Buttons[pos].hIconUp)));
- }
- else {
- SendMessage(Buttons[pos].hwnd, STM_SETIMAGE, t, (LPARAM)((Buttons[pos].bPushed)?(Buttons[pos].hbBitmapDown):(Buttons[pos].hbBitmapUp)));
- SendMessage(Buttons[pos].hwnd, BM_SETIMAGE, t, (LPARAM)((Buttons[pos].bPushed)?(Buttons[pos].hbBitmapDown):(Buttons[pos].hbBitmapUp)));
- }
+ SendMessage(Buttons[pos].hwnd, STM_SETIMAGE, IMAGE_ICON, (LPARAM)((Buttons[pos].bPushed)?(Buttons[pos].hIconDn):(Buttons[pos].hIconUp)));
+ SendMessage(Buttons[pos].hwnd, BM_SETIMAGE, IMAGE_ICON, (LPARAM)((Buttons[pos].bPushed)?(Buttons[pos].hIconDn):(Buttons[pos].hIconUp)));
}
- else SendMessage(Buttons[pos].hwnd, STM_SETIMAGE, t, (LPARAM)((Buttons[pos].bPushed)?(Buttons[pos].hbWBordBitmapDown):(Buttons[pos].hbWBordBitmapUp)));
+ else SendMessage(Buttons[pos].hwnd, STM_SETIMAGE, IMAGE_ICON, (LPARAM)((Buttons[pos].bPushed)?(Buttons[pos].hbWBordBitmapDown):(Buttons[pos].hbWBordBitmapUp)));
}
else SendMessage(Buttons[pos].hwnd, BM_SETIMAGE, IMAGE_ICON, (LPARAM)((Buttons[pos].bPushed)?(Buttons[pos].hIconDn):(Buttons[pos].hIconUp)));
@@ -648,8 +584,6 @@ INT_PTR TTBGetOptions(WPARAM wParam, LPARAM lParam) if (Buttons[pos].bPushed)
lpTTB->dwFlags |= TTBBF_PUSHED;
- lpTTB->hbBitmapDown = Buttons[pos].hbBitmapDown;
- lpTTB->hbBitmapUp = Buttons[pos].hbBitmapUp;
lpTTB->lParamUp = Buttons[pos].lParamUp;
lpTTB->wParamUp = Buttons[pos].wParamUp;
lpTTB->lParamDown = Buttons[pos].lParamDown;
@@ -688,8 +622,8 @@ INT_PTR TTBSetOptions(WPARAM wParam, LPARAM lParam) Buttons[pos].dwFlags = lParam;
Buttons[pos].bPushed = (Buttons[pos].dwFlags & TTBBF_PUSHED) ? TRUE : FALSE;
if (Buttons[pos].dwFlags & TTBBF_DRAWBORDER) {
- Buttons[pos].hbWBordBitmapDown = DrawBorderForBitmap(Buttons[pos].hbBitmapDown, FALSE);
- Buttons[pos].hbWBordBitmapUp = DrawBorderForBitmap(Buttons[pos].hbBitmapUp, TRUE);
+ Buttons[pos].hbWBordBitmapDown = DrawBorderForBitmap(Buttons[pos].hIconDn, FALSE);
+ Buttons[pos].hbWBordBitmapUp = DrawBorderForBitmap(Buttons[pos].hIconUp, TRUE);
}
SetButtBitmap(pos);
@@ -726,8 +660,6 @@ INT_PTR TTBSetOptions(WPARAM wParam, LPARAM lParam) break;
Buttons[pos].dwFlags = lpTTB->dwFlags;
- Buttons[pos].hbBitmapDown = lpTTB->hbBitmapDown;
- Buttons[pos].hbBitmapUp = lpTTB->hbBitmapUp;
Buttons[pos].lParamUp = lpTTB->lParamUp;
Buttons[pos].wParamUp = lpTTB->wParamUp;
Buttons[pos].lParamDown = lpTTB->lParamDown;
@@ -742,8 +674,8 @@ INT_PTR TTBSetOptions(WPARAM wParam, LPARAM lParam) Buttons[pos].pszServiceUp = _strdup(lpTTB->pszServiceUp);
if (Buttons[pos].dwFlags & TTBBF_DRAWBORDER) {
- Buttons[pos].hbWBordBitmapDown = DrawBorderForBitmap(Buttons[pos].hbBitmapDown, FALSE);
- Buttons[pos].hbWBordBitmapUp = DrawBorderForBitmap(Buttons[pos].hbBitmapUp, TRUE);
+ Buttons[pos].hbWBordBitmapDown = DrawBorderForBitmap(Buttons[pos].hIconDn, FALSE);
+ Buttons[pos].hbWBordBitmapUp = DrawBorderForBitmap(Buttons[pos].hIconUp, TRUE);
}
Buttons[pos].bPushed = (Buttons[pos].dwFlags&TTBBF_PUSHED)?TRUE:FALSE;
@@ -987,9 +919,9 @@ int OnIconChange(WPARAM wParam, LPARAM lParam) for (int i = 0; i < nButtonsCount; i++) {
char buf[256];
sprintf(buf, "%s_up", Buttons[i].name);
- Buttons[i].hIconUp = LoadIconFromLibrary("TopToolBar", buf, buf, Buttons[i].hIconUp, FALSE, NULL);
+ Buttons[i].hIconUp = LoadIconFromLibrary(buf, buf, Buttons[i].hIconUp, FALSE, NULL);
sprintf(buf, "%s_dn", Buttons[i].name);
- Buttons[i].hIconDn = LoadIconFromLibrary("TopToolBar", buf, buf, Buttons[i].hIconDn, FALSE, NULL);
+ Buttons[i].hIconDn = LoadIconFromLibrary(buf, buf, Buttons[i].hIconDn, FALSE, NULL);
}
ulockbut();
RecreateWindows();
@@ -1016,9 +948,6 @@ int OnModulesLoad(WPARAM wParam, LPARAM lParam) hwndContactList = (HWND)CallService(MS_CLUI_GETHWND, 0, 0);
OptionsOpened = false;
- UseIcoLib = DBGetContactSettingByte(0, TTB_OPTDIR, "UseIcoLib", UseIcoLibDefaultValue);
- if (UseIcoLib)
- arHooks.insert( HookEvent(ME_SKIN2_ICONSCHANGED, OnIconChange));
hFrameTopWindow = addTopToolBarWindow(hwndContactList);
LoadInternalButtons(( HWND )CallService(MS_CLUI_GETHWNDTREE, 0, 0));
@@ -1050,8 +979,10 @@ int LoadToolbarModule() {
InitializeCriticalSection(&csButtonsHook);
StopArrange = TRUE;
+ hBmpSeparator = LoadBitmap(hInst, MAKEINTRESOURCE(IDB_SEP));
arHooks.insert( HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoad));
+ arHooks.insert( HookEvent(ME_SKIN2_ICONSCHANGED, OnIconChange));
arHooks.insert( HookEvent(ME_OPT_INITIALISE, TTBOptInit));
arServices.insert( CreateServiceFunction(MS_TTB_ADDBUTTON, TTBAddButton));
@@ -1078,6 +1009,7 @@ int UnloadToolbarModule() {
SaveAllSeparators();
+ DeleteObject(hBmpSeparator);
DeleteCriticalSection(&csButtonsHook);
return 0;
}
diff --git a/plugins/TopToolBar/ttbopt.cpp b/plugins/TopToolBar/ttbopt.cpp index e962321008..dadfe7e305 100644 --- a/plugins/TopToolBar/ttbopt.cpp +++ b/plugins/TopToolBar/ttbopt.cpp @@ -4,7 +4,6 @@ static INT_PTR CALLBACK DlgProcTTBBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
extern int ttbOptionsChanged();
-extern HINSTANCE hInst;
extern TopButtonInt Buttons[MAX_BUTTONS];
extern int nButtonsCount;
@@ -14,124 +13,21 @@ extern SortData arrangedbuts[MAX_BUTTONS]; bool OptionsOpened = false;
HWND OptionshWnd = 0;
+struct ButtonOptData
+{
+ char *name;
+ int pos;
+ bool show;
+};
+
struct OrderData
{
int dragging;
HTREEITEM hDragItem;
};
-TCHAR *SetEndSlash(TCHAR *str)
-{
- if (str == NULL || *str == 0)
- return NULL;
-
- TCHAR *outs = str;
- if (str[_tcslen(str)-1] != '\\') {
- outs = (TCHAR*)calloc( sizeof(TCHAR), _tcslen(str)+3);
- _tcscat(outs, str);
- outs[_tcslen(str)] = '\\';
- }
- return outs;
-}
-
-bool FileExists(TCHAR *fname)
-{
- WIN32_FIND_DATA wfd = { 0 };
- HANDLE h = FindFirstFile(fname, &wfd);
- if (h == INVALID_HANDLE_VALUE)
- return FALSE;
-
- FindClose(h);
- return TRUE;
-}
-
-TCHAR *ReplaceBadChar(TCHAR *str, TCHAR bad, TCHAR toreplace)
-{
- for (int i = 0; str[i] != 0; i++)
- if (str[i] == bad)
- str[i] = toreplace;
-
- return str;
-}
-
-TCHAR *ReplaceAll(TCHAR *str)
-{
- ReplaceBadChar(str, '\\', '_');
- ReplaceBadChar(str, '/', '_');
- ReplaceBadChar(str, '"', '_');
- ReplaceBadChar(str, '?', '_');
- ReplaceBadChar(str, '|', '_');
- ReplaceBadChar(str, '>', '_');
- ReplaceBadChar(str, '<', '_');
- ReplaceBadChar(str, ':', '_');
- ReplaceBadChar(str, '*', '_');
- return str;
-}
-
-void AssignBitmapsFromDir(TCHAR *dir)
-{
- if (dir == NULL || *dir == 0 )
- return;
-
- dir = SetEndSlash(dir);
- lockbut();
- for (int i = 0; i < nButtonsCount; i++) {
- TCHAR curnameUP[512], curnameDN[512], ChangedName[512];
- _tcscpy(ChangedName, _A2T(Buttons[i].name));
- ReplaceAll(ChangedName);
-
- wsprintf(curnameUP, _T("%s%s_UP.bmp"), dir, ChangedName);
- wsprintf(curnameDN, _T("%s%s_DN.bmp"), dir, ChangedName);
-
- if ( FileExists(curnameUP)) {
- if (Buttons[i].UserDefinedbmUp != NULL)
- mir_free(Buttons[i].UserDefinedbmUp);
- Buttons[i].UserDefinedbmUp = mir_tstrdup(curnameUP);
- }
-
- if ( FileExists(curnameDN)) {
- if (Buttons[i].UserDefinedbmDown != NULL)
- mir_free(Buttons[i].UserDefinedbmDown);
- Buttons[i].UserDefinedbmDown = mir_tstrdup(curnameDN);
- }
-
- wsprintf(curnameUP, _T("%s%s_UP.ico"), dir, ChangedName);
- wsprintf(curnameDN, _T("%s%s_DN.ico"), dir, ChangedName);
-
- if ( FileExists(curnameUP)) {
- if (Buttons[i].UserDefinedbmUp != NULL)
- mir_free(Buttons[i].UserDefinedbmUp);
- Buttons[i].UserDefinedbmUp = mir_tstrdup(curnameUP);
- }
-
- if ( FileExists(curnameDN)) {
- if (Buttons[i].UserDefinedbmDown != NULL)
- mir_free(Buttons[i].UserDefinedbmDown);
- Buttons[i].UserDefinedbmDown = mir_tstrdup(curnameDN);
- }
- }
-
- ulockbut();
- SetAllBitmaps();
- SaveAllButtonsOptions();
-}
-
-void ApplyNewDir(HWND hwnd)
-{
- TCHAR buf[512], *buf2;
- GetDlgItemText(hwnd, IDC_IMGDIR, buf, SIZEOF(buf));
- buf2 = DBGetStringT(0, TTB_OPTDIR, "ImgDir");
- if ( buf2 == NULL || lstrcmp(buf, buf2)) {
- DBWriteContactSettingTString(0, TTB_OPTDIR, "ImgDir", buf);
- AssignBitmapsFromDir(buf);
- }
-}
-
int BuildTree(HWND hwndDlg)
{
- PostMessage(GetDlgItem(hwndDlg, IDC_BMPUP), STM_SETIMAGE, IMAGE_BITMAP, 0);
- PostMessage(GetDlgItem(hwndDlg, IDC_BMPDN), STM_SETIMAGE, IMAGE_BITMAP, 0);
-
OrderData *dat = (struct OrderData*)GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_BUTTONORDERTREE), GWLP_USERDATA);
TVINSERTSTRUCT tvis;
@@ -146,7 +42,7 @@ int BuildTree(HWND hwndDlg) for (int i = 0; i < nButtonsCount; i++) {
ButtonOptData *PD = (ButtonOptData*)malloc(sizeof(ButtonOptData));
PD->name = Buttons[arrangedbuts[i].oldpos].name;
- PD->show = Buttons[arrangedbuts[i].oldpos].dwFlags&TTBBF_VISIBLE?TRUE:FALSE;
+ PD->show = Buttons[arrangedbuts[i].oldpos].dwFlags & TTBBF_VISIBLE?TRUE:FALSE;
PD->pos = arrangedbuts[i].oldpos;
tvis.item.lParam = (LPARAM)PD;
tvis.item.pszText = TranslateTS( mir_a2t( PD->name));
@@ -200,43 +96,8 @@ int SaveTree(HWND hwndDlg) return (TRUE);
}
-void SetImagesForCurrent (HWND hwndDlg, int curselect)
-{
- int t = IMAGE_BITMAP;
-
- PostMessage(GetDlgItem(hwndDlg, IDC_BMPUP), STM_SETIMAGE, t, 0);
- PostMessage(GetDlgItem(hwndDlg, IDC_BMPDN), STM_SETIMAGE, t, 0);
-
- TCHAR *curname = Buttons[curselect].UserDefinedbmUp;
- if (curname != NULL) {
- if ( _tcsstr(curname, _T(".ico")))
- t = IMAGE_ICON;
- int st = WS_CHILDWINDOW | SS_NOTIFY | WS_VISIBLE;
- st |= (t == IMAGE_ICON) ? SS_ICON : SS_BITMAP;
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_BMPUP), GWL_STYLE, st);
- }
- else {
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_BMPUP), GWL_STYLE, WS_CHILDWINDOW|WS_VISIBLE|SS_NOTIFY|(Buttons[curselect].hbBitmapDown == NULL?SS_ICON:SS_BITMAP));
- t = IMAGE_ICON;
- }
-
- PostMessage(GetDlgItem(hwndDlg, IDC_BMPUP), STM_SETIMAGE, t, (Buttons[curselect].hbBitmapUp == NULL) ? (LPARAM)Buttons[curselect].hIconUp : (LPARAM)Buttons[curselect].hbBitmapUp);
-
- curname = Buttons[curselect].UserDefinedbmDown;
- if (curname != NULL) {
- if ( _tcsstr(curname, _T(".ico")))
- t = IMAGE_ICON;
- int st = WS_CHILDWINDOW | SS_NOTIFY | WS_VISIBLE;
- st |= (t == IMAGE_ICON) ? SS_ICON : SS_BITMAP;
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_BMPDN), GWL_STYLE, st);
- }
- else {
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_BMPDN), GWL_STYLE, WS_CHILDWINDOW|WS_VISIBLE|SS_NOTIFY|(Buttons[curselect].hbBitmapDown == NULL?SS_ICON:SS_BITMAP));
- t = IMAGE_ICON;
- }
-
- PostMessage(GetDlgItem(hwndDlg, IDC_BMPDN), STM_SETIMAGE, t, (Buttons[curselect].hbBitmapDown == NULL) ? (LPARAM)Buttons[curselect].hIconDn : (LPARAM)Buttons[curselect].hbBitmapDown);
-}
+/////////////////////////////////////////////////////////////////////////////////////////
+// Options window: main
static INT_PTR CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
@@ -244,54 +105,42 @@ static INT_PTR CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR switch (msg) {
case WM_INITDIALOG:
- {
- TranslateDialogDefault(hwndDlg);
- dat = (struct OrderData*)malloc(sizeof(struct OrderData));
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_BUTTONORDERTREE), GWLP_USERDATA, (LONG)dat);
- dat->dragging = 0;
+ TranslateDialogDefault(hwndDlg);
+ dat = (struct OrderData*)malloc(sizeof(struct OrderData));
+ SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_BUTTONORDERTREE), GWLP_USERDATA, (LONG)dat);
+ dat->dragging = 0;
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_BUTTONORDERTREE), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_BUTTONORDERTREE), GWL_STYLE)|TVS_NOHSCROLL);
- {
- HIMAGELIST himlCheckBoxes;
- himlCheckBoxes = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR4|ILC_MASK, 2, 2);
- ImageList_AddIcon(himlCheckBoxes, LoadIcon(hInst, MAKEINTRESOURCE(IDI_NOTICK)));
- ImageList_AddIcon(himlCheckBoxes, LoadIcon(hInst, MAKEINTRESOURCE(IDI_TICK)));
- TreeView_SetImageList(GetDlgItem(hwndDlg, IDC_BUTTONORDERTREE), himlCheckBoxes, TVSIL_NORMAL);
- }
+ SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_BUTTONORDERTREE), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_BUTTONORDERTREE), GWL_STYLE)|TVS_NOHSCROLL);
+ {
+ HIMAGELIST himlCheckBoxes;
+ himlCheckBoxes = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR4|ILC_MASK, 2, 2);
+ ImageList_AddIcon(himlCheckBoxes, LoadIcon(hInst, MAKEINTRESOURCE(IDI_NOTICK)));
+ ImageList_AddIcon(himlCheckBoxes, LoadIcon(hInst, MAKEINTRESOURCE(IDI_TICK)));
+ TreeView_SetImageList(GetDlgItem(hwndDlg, IDC_BUTTONORDERTREE), himlCheckBoxes, TVSIL_NORMAL);
+ }
- PostMessage(GetDlgItem(hwndDlg, IDC_BMPUP), STM_SETIMAGE, IMAGE_BITMAP, 0);
- PostMessage(GetDlgItem(hwndDlg, IDC_BMPDN), STM_SETIMAGE, IMAGE_BITMAP, 0);
- SetDlgItemInt(hwndDlg, IDC_BUTTHEIGHT, DBGetContactSettingByte(0, TTB_OPTDIR, "BUTTHEIGHT", 16), FALSE);
- SetDlgItemInt(hwndDlg, IDC_BUTTWIDTH, DBGetContactSettingByte(0, TTB_OPTDIR, "BUTTWIDTH", 20), FALSE);
- CheckDlgButton(hwndDlg, IDC_USEMIRANDABUTTON, DBGetContactSettingByte(0, TTB_OPTDIR, "UseMirandaButtonClass", UseMirandaButtonClassDefaultValue));
- CheckDlgButton(hwndDlg, IDC_USEFLAT, DBGetContactSettingByte(0, TTB_OPTDIR, "UseFlatButton", 1));
+ SetDlgItemInt(hwndDlg, IDC_BUTTHEIGHT, DBGetContactSettingByte(0, TTB_OPTDIR, "BUTTHEIGHT", 16), FALSE);
+ SetDlgItemInt(hwndDlg, IDC_BUTTWIDTH, DBGetContactSettingByte(0, TTB_OPTDIR, "BUTTWIDTH", 20), FALSE);
+ CheckDlgButton(hwndDlg, IDC_USEMIRANDABUTTON, DBGetContactSettingByte(0, TTB_OPTDIR, "UseMirandaButtonClass", UseMirandaButtonClassDefaultValue));
+ CheckDlgButton(hwndDlg, IDC_USEFLAT, DBGetContactSettingByte(0, TTB_OPTDIR, "UseFlatButton", 1));
- if ( !ServiceExists(MS_SKIN2_ADDICON))
- EnableWindow(GetDlgItem(hwndDlg, IDC_USEICOLIB), FALSE);
+ if ( !ServiceExists(MS_SKIN2_ADDICON))
+ EnableWindow(GetDlgItem(hwndDlg, IDC_USEICOLIB), FALSE);
- CheckDlgButton(hwndDlg, IDC_USEICOLIB, ServiceExists(MS_SKIN2_ADDICON)&&DBGetContactSettingByte(0, TTB_OPTDIR, "UseIcoLib", UseIcoLibDefaultValue));
+ CheckDlgButton(hwndDlg, IDC_USEICOLIB, TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_USEICOLIB), FALSE);
- BuildTree(hwndDlg);
- OptionsOpened = true;
- EnableWindow(GetDlgItem(hwndDlg, IDC_ENAME), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_EPATH), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_DELLBUTTON), FALSE);
+ BuildTree(hwndDlg);
+ OptionsOpened = true;
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ENAME), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_EPATH), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_DELLBUTTON), FALSE);
- SetDlgItemText(hwndDlg, IDC_IMGDIR, DBGetStringT(0, TTB_OPTDIR, "ImgDir"));
- SendMessage(hwndDlg, WM_COMMAND, 0, 0);
- OptionshWnd = hwndDlg;
- }
+ SendMessage(hwndDlg, WM_COMMAND, 0, 0);
+ OptionshWnd = hwndDlg;
return TRUE;
case WM_COMMAND:
- ShowWindow(GetDlgItem(hwndDlg, IDC_BMPUP), IsDlgButtonChecked(hwndDlg, IDC_USEICOLIB)?SW_HIDE:SW_SHOW);
- ShowWindow(GetDlgItem(hwndDlg, IDC_BMPDN), IsDlgButtonChecked(hwndDlg, IDC_USEICOLIB)?SW_HIDE:SW_SHOW);
- ShowWindow(GetDlgItem(hwndDlg, IDC_DEFAULT), IsDlgButtonChecked(hwndDlg, IDC_USEICOLIB)?SW_HIDE:SW_SHOW);
-
- ShowWindow(GetDlgItem(hwndDlg, IDC_STATIC1), IsDlgButtonChecked(hwndDlg, IDC_USEICOLIB)?SW_HIDE:SW_SHOW);
- ShowWindow(GetDlgItem(hwndDlg, IDC_STATIC2), IsDlgButtonChecked(hwndDlg, IDC_USEICOLIB)?SW_HIDE:SW_SHOW);
- ShowWindow(GetDlgItem(hwndDlg, IDC_STATIC3), IsDlgButtonChecked(hwndDlg, IDC_USEICOLIB)?SW_HIDE:SW_SHOW);
-
EnableWindow(GetDlgItem(hwndDlg, IDC_USEFLAT), IsDlgButtonChecked(hwndDlg, IDC_USEMIRANDABUTTON));
if (HIWORD(wParam) == EN_CHANGE ) {
@@ -303,28 +152,12 @@ static INT_PTR CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR int ctrlid = LOWORD(wParam);
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- if (ctrlid == IDC_OPENIMGDIR) {
- TCHAR buf[512];
- BROWSEINFO bi = { 0 };
- bi.hwndOwner = hwndDlg;
- bi.pszDisplayName = buf;
- bi.lpszTitle = TranslateT("Select Directory");
- bi.ulFlags = BIF_RETURNONLYFSDIRS;
- PCIDLIST_ABSOLUTE res = SHBrowseForFolder(&bi);
- if (res != NULL) {
- if (SHGetPathFromIDList(res, buf) == TRUE) {
- SetDlgItemText(hwndDlg, IDC_IMGDIR, buf);
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- }
- }
- break;
- }
-
if (ctrlid == IDC_LBUTTONSET) {
int curselect;
TVITEM tvi;
tvi.hItem = TreeView_GetSelection(GetDlgItem(hwndDlg, IDC_BUTTONORDERTREE));
- if (tvi.hItem == NULL){break;}
+ if (tvi.hItem == NULL)
+ break;
tvi.mask = TVIF_PARAM;
TreeView_GetItem(GetDlgItem(hwndDlg, IDC_BUTTONORDERTREE), &tvi);
@@ -409,93 +242,6 @@ static INT_PTR CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR }
break;
}
-
- if (ctrlid == IDC_DEFAULT) {
- TVITEM tvi;
- tvi.hItem = TreeView_GetSelection(GetDlgItem(hwndDlg, IDC_BUTTONORDERTREE));
- if (tvi.hItem == NULL)
- break;
-
- tvi.mask = TVIF_PARAM;
- TreeView_GetItem(GetDlgItem(hwndDlg, IDC_BUTTONORDERTREE), &tvi);
-
- int curselect = ((ButtonOptData *)tvi.lParam)->pos;
- lockbut();
-
- if (Buttons[curselect].UserDefinedbmUp != NULL) mir_free(Buttons[curselect].UserDefinedbmUp);
- if (Buttons[curselect].UserDefinedbmDown != NULL) mir_free(Buttons[curselect].UserDefinedbmDown);
- Buttons[curselect].UserDefinedbmUp = NULL;
- Buttons[curselect].UserDefinedbmDown = NULL;
- applyuserbitmaps(curselect);
- SetImagesForCurrent(hwndDlg, curselect);
-
- ulockbut();
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- }
- }
-
- if ((HIWORD(wParam) == STN_CLICKED || HIWORD(wParam) == STN_DBLCLK)) {
- int ctrlid = LOWORD(wParam);
- if (ctrlid == IDC_BMPUP || ctrlid == IDC_BMPDN) {
- TVITEM tvi;
- tvi.hItem = TreeView_GetSelection(GetDlgItem(hwndDlg, IDC_BUTTONORDERTREE));
- if (tvi.hItem == NULL)
- break;
-
- tvi.mask = TVIF_PARAM;
- TreeView_GetItem(GetDlgItem(hwndDlg, IDC_BUTTONORDERTREE), &tvi);
- if (tvi.lParam == 0)
- break;
-
- int curselect = ((ButtonOptData *)tvi.lParam)->pos;
-
- TCHAR filename[MAX_PATH], filter[512];
- filename[0] = 0;
- _tcscpy(filter, TranslateT("Bitmap/Icon files"));
- _tcscat(filter, _T(" (*.bmp;*.ico)"));
-
- TCHAR *pfilter = filter+_tcslen(filter)+1;
- _tcscpy(pfilter, _T("*.bmp;*.ico"));
- pfilter += _tcslen(pfilter)+1;
-
- _tcscpy(pfilter, TranslateT("All Files"));
- _tcscat(pfilter, _T("(*)"));
- pfilter = pfilter + _tcslen(pfilter)+1;
-
- _tcscpy(pfilter, _T("*"));
- pfilter = pfilter + _tcslen(pfilter)+1;
- *pfilter = '\0';
-
- OPENFILENAME ofn = {0};
- ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
- ofn.hwndOwner = hwndDlg;
- ofn.hInstance = NULL;
- ofn.lpstrFilter = filter;
- ofn.lpstrFile = filename;
- ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
- ofn.nMaxFile = sizeof(filename);
- ofn.nMaxFileTitle = MAX_PATH;
- ofn.lpstrDefExt = _T("bmp");
- ofn.lpstrTitle = (ctrlid == IDC_BMPUP) ? TranslateT("Select Up Bitmap") : TranslateT("Select Down Bitmap");
- if (GetOpenFileName(&ofn)) {
- lockbut();
- if (ctrlid == IDC_BMPUP){
- if (Buttons[curselect].UserDefinedbmUp != NULL)
- mir_free(Buttons[curselect].UserDefinedbmUp);
- Buttons[curselect].UserDefinedbmUp = mir_tstrdup(ofn.lpstrFile);
- }
- if (ctrlid == IDC_BMPDN){
- if (Buttons[curselect].UserDefinedbmDown != NULL)
- mir_free(Buttons[curselect].UserDefinedbmDown);
- Buttons[curselect].UserDefinedbmDown = mir_tstrdup(ofn.lpstrFile);
- }
- applyuserbitmaps(curselect);
- SetImagesForCurrent(hwndDlg, curselect);
-
- ulockbut();
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- }
- }
}
break;
@@ -513,7 +259,6 @@ static INT_PTR CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR SaveTree(hwndDlg);
- ApplyNewDir(hwndDlg);
RecreateWindows();
ArrangeButtons();
}
@@ -561,20 +306,10 @@ static INT_PTR CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR tvi.hItem = hti;
TreeView_GetItem(GetDlgItem(hwndDlg, IDC_BUTTONORDERTREE), &tvi);
-
lockbut();
- EnableWindow(GetDlgItem(hwndDlg, IDC_BMPUP), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_BMPDN), FALSE);
-
- SetImagesForCurrent(hwndDlg, ((ButtonOptData *)tvi.lParam)->pos);
-
EnableWindow(GetDlgItem(hwndDlg, IDC_REMOVESEP), FALSE);
- if (Buttons[((ButtonOptData *)tvi.lParam)->pos].dwFlags&TTBBF_ISSEPARATOR)
+ if (Buttons[((ButtonOptData *)tvi.lParam)->pos].dwFlags & TTBBF_ISSEPARATOR)
EnableWindow(GetDlgItem(hwndDlg, IDC_REMOVESEP), TRUE);
- else {
- EnableWindow(GetDlgItem(hwndDlg, IDC_BMPUP), TRUE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_BMPDN), TRUE);
- }
EnableWindow(GetDlgItem(hwndDlg, IDC_ENAME), FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_EPATH), FALSE);
@@ -675,34 +410,8 @@ static INT_PTR CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR return FALSE;
}
-int TTBOptInit(WPARAM wParam, LPARAM lParam)
-{
- OPTIONSDIALOGPAGE odp = { 0 };
- odp.cbSize = sizeof(odp);
- odp.position = 0;
- odp.hInstance = hInst;
- odp.pszGroup = LPGEN("TopToolBar");
-
- if ( !ServiceExists(MS_BACKGROUNDCONFIG_REGISTER)) {
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_TTBBKG);
- odp.pszTitle = LPGEN("TTBBackground");
- odp.pfnDlgProc = DlgProcTTBBkgOpts;
- odp.flags = ODPF_BOLDGROUPS;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&odp);
- }
-
- ZeroMemory(&odp, sizeof(odp));
- odp.cbSize = sizeof(odp);
- odp.position = -1000000000;
- odp.hInstance = hInst;
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_BUTORDER);
- odp.pszGroup = LPGEN("TopToolBar");
- odp.pszTitle = LPGEN("Buttons");
- odp.pfnDlgProc = ButOrderOpts;
- odp.flags = ODPF_BOLDGROUPS|ODPF_EXPERTONLY;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&odp);
- return 0;
-}
+/////////////////////////////////////////////////////////////////////////////////////////
+// Options window: background
static INT_PTR CALLBACK DlgProcTTBBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
@@ -819,3 +528,34 @@ static INT_PTR CALLBACK DlgProcTTBBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, }
return FALSE;
}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+int TTBOptInit(WPARAM wParam, LPARAM lParam)
+{
+ OPTIONSDIALOGPAGE odp = { 0 };
+ odp.cbSize = sizeof(odp);
+ odp.position = 0;
+ odp.hInstance = hInst;
+ odp.pszGroup = LPGEN("TopToolBar");
+
+ if ( !ServiceExists(MS_BACKGROUNDCONFIG_REGISTER)) {
+ odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_TTBBKG);
+ odp.pszTitle = LPGEN("TTBBackground");
+ odp.pfnDlgProc = DlgProcTTBBkgOpts;
+ odp.flags = ODPF_BOLDGROUPS;
+ CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&odp);
+ }
+
+ ZeroMemory(&odp, sizeof(odp));
+ odp.cbSize = sizeof(odp);
+ odp.position = -1000000000;
+ odp.hInstance = hInst;
+ odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_BUTORDER);
+ odp.pszGroup = LPGEN("TopToolBar");
+ odp.pszTitle = LPGEN("Buttons");
+ odp.pfnDlgProc = ButOrderOpts;
+ odp.flags = ODPF_BOLDGROUPS|ODPF_EXPERTONLY;
+ CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&odp);
+ return 0;
+}
|