diff options
author | Alexey Kulakov <panda75@bk.ru> | 2012-06-22 13:22:39 +0000 |
---|---|---|
committer | Alexey Kulakov <panda75@bk.ru> | 2012-06-22 13:22:39 +0000 |
commit | 3e7048d2037b42781182c895ef56d5f51b1b5f35 (patch) | |
tree | 5c1c32bf5469e4688a020b7c85d36328a853b37c /plugins/TopToolBar | |
parent | 724eb80f574a1a46ade6d58d21ce1296064f44a7 (diff) |
small fixes + cleanup
git-svn-id: http://svn.miranda-ng.org/main/trunk@528 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/TopToolBar')
-rw-r--r-- | plugins/TopToolBar/InternalButtons.cpp | 109 | ||||
-rw-r--r-- | plugins/TopToolBar/main.rc | 11 | ||||
-rw-r--r-- | plugins/TopToolBar/resource.h | 1 | ||||
-rw-r--r-- | plugins/TopToolBar/toolbar.cpp | 4 | ||||
-rw-r--r-- | plugins/TopToolBar/ttbopt.cpp | 10 |
5 files changed, 20 insertions, 115 deletions
diff --git a/plugins/TopToolBar/InternalButtons.cpp b/plugins/TopToolBar/InternalButtons.cpp index 359157e92e..5e2413f5d0 100644 --- a/plugins/TopToolBar/InternalButtons.cpp +++ b/plugins/TopToolBar/InternalButtons.cpp @@ -4,10 +4,7 @@ #define TTBI_GROUPSHOWHIDE "TTBInternal/GroupShowHide"
#define TTBI_SOUNDSONOFF "TTBInternal/SoundsOnOFF"
-#define TTBI_OPTIONSBUTT "TTBInternal/OptionsBUTT"
#define TTBI_MAINMENUBUTT "TTBInternal/MainMenuBUTT"
-#define TTBI_MINIMIZEBUTT "TTBInternal/MinimizeBUTT"
-#define TTBI_FINDADDBUTT "TTBInternal/FindAddBUTT"
int LoadInternalButtons( HWND );
int UnLoadInternalButtons();
@@ -63,18 +60,6 @@ int OnSettingChanging(WPARAM wParam, LPARAM lParam) return 0;
}
-INT_PTR TTBInternalFindAddButt(WPARAM wParam, LPARAM lParam)
-{
- CallService("FindAdd/FindAddCommand", 0, 0);
- return 0;
-}
-
-INT_PTR TTBInternalMinimizeButt(WPARAM wParam, LPARAM lParam)
-{
- CallService(MS_CLIST_SHOWHIDE, 0, 0);
- return 0;
-}
-
INT_PTR TTBInternalMainMenuButt(WPARAM wParam, LPARAM lParam)
{
HMENU hMenu = (HMENU)CallService(MS_CLIST_MENUGETMAIN, 0, 0);
@@ -86,12 +71,6 @@ INT_PTR TTBInternalMainMenuButt(WPARAM wParam, LPARAM lParam) return 0;
}
-INT_PTR TTBInternalOptionsButt(WPARAM wParam, LPARAM lParam)
-{
- CallService("Options/OptionsCommand", 0, 0);
- return 0;
-}
-
INT_PTR TTBInternalGroupShowHide(WPARAM wParam, LPARAM lParam)
{
int newVal = !(GetWindowLongPtr(hwndContactTree, GWL_STYLE)&CLS_USEGROUPS);
@@ -116,80 +95,6 @@ int UnLoadInternalButtons() return 0;
}
-bool framesexists = FALSE;
-int windhandle;
-
-LRESULT CALLBACK TestProczzz(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- switch(msg) {
- case WM_CREATE:
- SetTimer(hwnd, 0, 100, 0);
- return 0;
-
- case WM_TIMER:
- InvalidateRect(hwnd, NULL, TRUE);
- RedrawWindow(hwnd, NULL, NULL, 0);
- break;
-
- case WM_PAINT:
- {
- PAINTSTRUCT lp;
- HDC hdc = BeginPaint(hwnd, &lp);
- if (hdc) {
- TCHAR buf[255];
- wsprintf(buf, _T("%d"), GetTickCount());
- TextOut(hdc, 4, 4, buf, lstrlen(buf));
- EndPaint(hwnd, &lp);
- }
- return 0;
- }
- }
-
- return(DefWindowProc(hwnd, msg, wParam, lParam));
-}
-
-bool first = TRUE;
-TCHAR pluginname[] = _T("SimpleClassName");
-
-INT_PTR test(WPARAM wParam, LPARAM lParam)
-{
- if (first) {
- WNDCLASS wndclass = { 0 };
- wndclass.lpfnWndProc = TestProczzz;
- wndclass.hInstance = hInst;
- wndclass.hCursor = LoadCursor (NULL, IDC_ARROW);
- wndclass.hbrBackground = (HBRUSH)(COLOR_3DFACE+1);//NULL;//(HBRUSH)(COLOR_3DFACE+1);
- wndclass.lpszClassName = pluginname;
- RegisterClass(&wndclass);
- first = FALSE;
- }
-
- if (framesexists) {
- CallService(MS_CLIST_FRAMES_REMOVEFRAME, (WPARAM)windhandle, 0);
- windhandle = 0;
- framesexists = FALSE;
- }
- else {
- HWND pluginwind = CreateWindow(pluginname, pluginname,
- WS_CHILD|WS_VISIBLE|WS_CLIPCHILDREN,
- 0, 0, 0, 0, (HWND)CallService(MS_CLUI_GETHWND, 0, 0), NULL, hInst, NULL);
-
- CLISTFrame Frame = { 0 };
- Frame.name = (char *)malloc(255);
- memset(Frame.name, 0, 255);
- memcpy(Frame.name, pluginname, SIZEOF(pluginname));
- Frame.cbSize = sizeof(Frame);
- Frame.hWnd = pluginwind;
- Frame.align = alTop;
- Frame.Flags = F_VISIBLE;
- Frame.height = 18;
-
- windhandle = CallService(MS_CLIST_FRAMES_ADDFRAME, (WPARAM)&Frame, 0);
- framesexists = TRUE;
- }
- return 0;
-}
-
int LoadInternalButtons(HWND hwnd)
{
hwndContactTree = hwnd;
@@ -197,14 +102,8 @@ int LoadInternalButtons(HWND hwnd) arServices.insert( CreateServiceFunction(TTBI_GROUPSHOWHIDE, TTBInternalGroupShowHide));
arServices.insert( CreateServiceFunction(TTBI_SOUNDSONOFF, TTBInternalSoundsOnOff));
- arServices.insert( CreateServiceFunction(TTBI_OPTIONSBUTT, TTBInternalOptionsButt));
arServices.insert( CreateServiceFunction(TTBI_MAINMENUBUTT, TTBInternalMainMenuButt));
- arServices.insert( CreateServiceFunction(TTBI_MINIMIZEBUTT, TTBInternalMinimizeButt));
- arServices.insert( CreateServiceFunction(TTBI_FINDADDBUTT, TTBInternalFindAddButt));
-
- arServices.insert( CreateServiceFunction("TEST1", test));
-
ShowOnline = DBGetContactSettingByte(NULL, "CList", "HideOffline", 0);
ShowGroups = DBGetContactSettingByte(NULL, "CList", "UseGroups", 2);
SoundsEnabled = DBGetContactSettingByte(NULL, "Skin", "UseSound", 1);
@@ -219,6 +118,8 @@ int LoadInternalButtons(HWND hwnd) ttb.name = "Show only Online Users";
hOnlineBut = (HANDLE)TTBAddButton((WPARAM)&ttb, 0);
+ ttb.wParamUp = ttb.wParamDown = 0;
+
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;
@@ -236,21 +137,21 @@ int LoadInternalButtons(HWND hwnd) 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.pszService = TTBI_OPTIONSBUTT;
+ 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.pszService = TTBI_MINIMIZEBUTT;
+ 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.pszService = TTBI_FINDADDBUTT;
+ ttb.pszService = MS_FINDADD_FINDADD;
ttb.name = "Find/Add Contacts";
hFindUsers = (HANDLE)TTBAddButton((WPARAM)&ttb, 0);
diff --git a/plugins/TopToolBar/main.rc b/plugins/TopToolBar/main.rc index 944f35c4e7..4120d62c72 100644 --- a/plugins/TopToolBar/main.rc +++ b/plugins/TopToolBar/main.rc @@ -42,10 +42,13 @@ BEGIN LTEXT "Path:",IDC_LBUTTONPATH,170,136,18,8
PUSHBUTTON "Set",IDC_LBUTTONSET,205,158,50,14
- LTEXT "Button Height:",IDC_STATIC,11,190,46,8
- EDITTEXT IDC_BUTTHEIGHT,65,187,24,14,ES_AUTOHSCROLL | WS_TABSTOP
- LTEXT "Button Width: ",IDC_STATIC,11,211,46,8
- EDITTEXT IDC_BUTTWIDTH,65,209,24,14,ES_AUTOHSCROLL | WS_TABSTOP
+ EDITTEXT IDC_BUTTHEIGHT,10,182,24,12,ES_AUTOHSCROLL | WS_TABSTOP
+ 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
+ EDITTEXT IDC_BUTTGAP,10,214,24,12,ES_AUTOHSCROLL | WS_TABSTOP
+ 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
diff --git a/plugins/TopToolBar/resource.h b/plugins/TopToolBar/resource.h index 9cb7f600ee..c4ff766b8f 100644 --- a/plugins/TopToolBar/resource.h +++ b/plugins/TopToolBar/resource.h @@ -36,6 +36,7 @@ #define IDC_BUTTHEIGHT 1015
#define IDC_EDIT2 1016
#define IDC_BUTTWIDTH 1016
+#define IDC_BUTTGAP 1017
#define IDC_USEFLAT 1018
#define IDC_BROWSE 1184
#define IDC_BKGCOLOUR 1269
diff --git a/plugins/TopToolBar/toolbar.cpp b/plugins/TopToolBar/toolbar.cpp index a6869d579b..f69b2bf894 100644 --- a/plugins/TopToolBar/toolbar.cpp +++ b/plugins/TopToolBar/toolbar.cpp @@ -435,7 +435,7 @@ INT_PTR TTBGetOptions(WPARAM wParam, LPARAM lParam) switch(LOWORD(wParam)) {
case TTBO_FLAGS:
- retval = b->dwFlags & (!TTBBF_PUSHED);
+ retval = b->dwFlags & (~TTBBF_PUSHED);
if (b->bPushed)
retval |= TTBBF_PUSHED;
break;
@@ -450,7 +450,7 @@ INT_PTR TTBGetOptions(WPARAM wParam, LPARAM lParam) if (lpTTB->cbSize != sizeof(TTBButton))
break;
- lpTTB->dwFlags = b->dwFlags & (!TTBBF_PUSHED);
+ lpTTB->dwFlags = b->dwFlags & (~TTBBF_PUSHED);
if (b->bPushed)
lpTTB->dwFlags |= TTBBF_PUSHED;
diff --git a/plugins/TopToolBar/ttbopt.cpp b/plugins/TopToolBar/ttbopt.cpp index c36d78c68d..02e834ffd6 100644 --- a/plugins/TopToolBar/ttbopt.cpp +++ b/plugins/TopToolBar/ttbopt.cpp @@ -82,7 +82,7 @@ int SaveTree(HWND hwndDlg) int count = 0;
lockbut();
- Buttons.destroy();
+// Buttons.destroy();
while(tvi.hItem != NULL) {
tvi.stateMask = TVIS_STATEIMAGEMASK;
@@ -97,7 +97,7 @@ int SaveTree(HWND hwndDlg) btn->dwFlags &= ~TTBBF_VISIBLE;
btn->arrangedpos = count;
- Buttons.insert(btn);
+// Buttons.insert(btn);
tvi.hItem = TreeView_GetNextSibling(hTree, tvi.hItem);
count++;
}
@@ -126,7 +126,7 @@ static INT_PTR CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR SetDlgItemInt(hwndDlg, IDC_BUTTHEIGHT, BUTTHEIGHT, FALSE);
SetDlgItemInt(hwndDlg, IDC_BUTTWIDTH, BUTTWIDTH, FALSE);
-// SetDlgItemInt(hwndDlg, IDC_BUTTGAP, BUTTGAP, FALSE);
+ SetDlgItemInt(hwndDlg, IDC_BUTTGAP, BUTTGAP, FALSE);
CheckDlgButton(hwndDlg, IDC_USEFLAT, DBGetContactSettingByte(0, TTB_OPTDIR, "UseFlatButton", 1));
BuildTree(hwndDlg);
@@ -224,10 +224,10 @@ static INT_PTR CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR case PSN_APPLY:
BUTTHEIGHT = GetDlgItemInt(hwndDlg, IDC_BUTTHEIGHT, NULL, FALSE);
BUTTWIDTH = GetDlgItemInt(hwndDlg, IDC_BUTTWIDTH, NULL, FALSE);
-// BUTTGAP = GetDlgItemInt(hwndDlg, IDC_BUTTGAP, NULL, FALSE));
+ BUTTGAP = GetDlgItemInt(hwndDlg, IDC_BUTTGAP, NULL, FALSE);
DBWriteContactSettingByte(0, TTB_OPTDIR, "BUTTHEIGHT", BUTTHEIGHT);
DBWriteContactSettingByte(0, TTB_OPTDIR, "BUTTWIDTH", BUTTWIDTH);
-// DBWriteContactSettingByte(0, TTB_OPTDIR, "BUTTGAP", BUTTGAP);
+ DBWriteContactSettingByte(0, TTB_OPTDIR, "BUTTGAP", BUTTGAP);
DBWriteContactSettingByte(0, TTB_OPTDIR, "UseFlatButton", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_USEFLAT));
SaveTree(hwndDlg);
|