diff options
author | Alexey Kulakov <panda75@bk.ru> | 2012-06-24 10:31:17 +0000 |
---|---|---|
committer | Alexey Kulakov <panda75@bk.ru> | 2012-06-24 10:31:17 +0000 |
commit | 74dedd8bbf8ec9b3ca1e0f07fc603875697aa9b3 (patch) | |
tree | 6a734f5d5300e789265d82349a5b24830af2bd2a /plugins | |
parent | 66b49434b600a3b326697393a86c93129f545e92 (diff) |
resource buttons aligned
added path browse button for launch buttons
service addition/deletion reaction in option view addded
git-svn-id: http://svn.miranda-ng.org/main/trunk@598 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/TopToolBar/common.h | 5 | ||||
-rw-r--r-- | plugins/TopToolBar/main.rc | 19 | ||||
-rw-r--r-- | plugins/TopToolBar/toolbar.cpp | 8 | ||||
-rw-r--r-- | plugins/TopToolBar/topbutton.cpp | 4 | ||||
-rw-r--r-- | plugins/TopToolBar/ttbopt.cpp | 77 |
5 files changed, 91 insertions, 22 deletions
diff --git a/plugins/TopToolBar/common.h b/plugins/TopToolBar/common.h index 04e3474c47..4e4c31f393 100644 --- a/plugins/TopToolBar/common.h +++ b/plugins/TopToolBar/common.h @@ -109,7 +109,10 @@ extern LIST<void> arHooks, arServices; extern HBITMAP hBmpBackground, hBmpSeparator;
extern int BUTTWIDTH, BUTTHEIGHT, BUTTGAP;
-int OptionsPageRebuild();
+void AddToOptions(TopButtonInt* b);
+void RemoveFromOptions(int id);
+
+//int OptionsPageRebuild();
void lockbut();
void ulockbut();
diff --git a/plugins/TopToolBar/main.rc b/plugins/TopToolBar/main.rc index a0978b165e..0f8578951c 100644 --- a/plugins/TopToolBar/main.rc +++ b/plugins/TopToolBar/main.rc @@ -32,15 +32,16 @@ BEGIN CONTROL "Tree1",IDC_BUTTONORDERTREE,"SysTreeView32",TVS_NOTOOLTIPS | TVS_CHECKBOXES | 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 "Add Launch",IDC_ADDLBUTTON,235,15,55,14
- PUSHBUTTON "Del Sep/Launch Button",IDC_REMOVEBUTTON,180,60,100,14
+ PUSHBUTTON "Add Separator",IDC_ADDSEP,165,5,130,14
+ PUSHBUTTON "Add Launch",IDC_ADDLBUTTON,165,25,130,14
+ PUSHBUTTON "Del Sep/Launch Button",IDC_REMOVEBUTTON,165,115,130,14
- EDITTEXT IDC_ENAME,195,111,85,14,ES_AUTOHSCROLL | WS_TABSTOP
- LTEXT "Name: ",IDC_LBUTTONNAME,170,114,24,8
- EDITTEXT IDC_EPATH,195,134,85,14,ES_AUTOHSCROLL | WS_TABSTOP
- LTEXT "Path:",IDC_LBUTTONPATH,170,136,18,8
- PUSHBUTTON "Set",IDC_LBUTTONSET,205,158,50,14
+ EDITTEXT IDC_ENAME,200,45,95,14,ES_AUTOHSCROLL | WS_TABSTOP
+ LTEXT "Name: ",IDC_LBUTTONNAME,165,45,30,14, SS_CENTERIMAGE
+ EDITTEXT IDC_EPATH,165,72,112,14,ES_AUTOHSCROLL | WS_TABSTOP
+ PUSHBUTTON "...",IDC_BROWSE,280,73,15,11
+ LTEXT "Path:",IDC_LBUTTONPATH,165,62,30,8
+ PUSHBUTTON "Set",IDC_LBUTTONSET,205,90,50,14
EDITTEXT IDC_BUTTHEIGHT,10,182,24,12,ES_AUTOHSCROLL | WS_TABSTOP
LTEXT "Button Height",IDC_STATIC,36,184,124,8
@@ -49,7 +50,7 @@ BEGIN 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
+ CONTROL "Use Flat Mode",IDC_USEFLAT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,165,216,130,10
END
diff --git a/plugins/TopToolBar/toolbar.cpp b/plugins/TopToolBar/toolbar.cpp index f7e2b19c68..17e5028df0 100644 --- a/plugins/TopToolBar/toolbar.cpp +++ b/plugins/TopToolBar/toolbar.cpp @@ -183,12 +183,14 @@ INT_PTR TTBRemoveButton(WPARAM wParam, LPARAM lParam) return -1;
}
+ RemoveFromOptions(b->id);
+
Buttons.remove(b);
delete b;
ArrangeButtons();
ulockbut();
- OptionsPageRebuild();
+// OptionsPageRebuild();
return 0;
}
@@ -318,7 +320,9 @@ INT_PTR TTBAddButton(WPARAM wParam, LPARAM lParam) ulockbut();
ArrangeButtons();
- OptionsPageRebuild();
+// OptionsPageRebuild();
+
+ AddToOptions(b);
return b->id;
}
diff --git a/plugins/TopToolBar/topbutton.cpp b/plugins/TopToolBar/topbutton.cpp index d6d5b1cce9..c0bb99ae55 100644 --- a/plugins/TopToolBar/topbutton.cpp +++ b/plugins/TopToolBar/topbutton.cpp @@ -111,7 +111,7 @@ void TopButtonInt::SaveSettings(int &SepCnt, int &LaunchCnt) {
char buf[255];
- if (dwFlags & TTBBF_ISSEPARATOR) {
+ if (dwFlags & (TTBBF_ISSEPARATOR | TTBBF_INTERNAL)) {
char buf1[10];
_itoa(++SepCnt, buf1, 10);
char buf2[20];
@@ -120,7 +120,7 @@ void TopButtonInt::SaveSettings(int &SepCnt, int &LaunchCnt) DBWriteContactSettingByte(0, TTB_OPTDIR, AS(buf, buf2, "_Position"), arrangedpos);
DBWriteContactSettingByte(0, TTB_OPTDIR, AS(buf, buf2, "_Visible"), dwFlags & TTBBF_VISIBLE);
}
- else if (dwFlags & TTBBF_ISLBUTTON) {
+ else if (dwFlags & (TTBBF_ISLBUTTON | TTBBF_INTERNAL)) {
char buf1[10];
_itoa(++LaunchCnt, buf1, 10);
char buf2[20];
diff --git a/plugins/TopToolBar/ttbopt.cpp b/plugins/TopToolBar/ttbopt.cpp index 67d6b99238..edad6b8c8a 100644 --- a/plugins/TopToolBar/ttbopt.cpp +++ b/plugins/TopToolBar/ttbopt.cpp @@ -65,6 +65,41 @@ int BuildTree(HWND hwndDlg) return TRUE;
}
+void AddToOptions(TopButtonInt* b)
+{
+ if (OptionshWnd) {
+ HWND hTree = GetDlgItem(OptionshWnd, IDC_BUTTONORDERTREE);
+ OrderData *dat = (struct OrderData*)GetWindowLongPtr(hTree, GWLP_USERDATA);
+ AddLine(hTree, b, TVI_LAST, dat->himlButtonIcons);
+ }
+}
+
+void RemoveFromOptions(int id)
+{
+ if (OptionshWnd) {
+ HWND hTree = GetDlgItem(OptionshWnd, IDC_BUTTONORDERTREE);
+ TVITEM tvi = { 0 };
+ tvi.hItem = TreeView_GetRoot(hTree);
+ tvi.mask = TVIF_PARAM | TVIF_HANDLE;
+
+ TopButtonInt* btn;
+ while(tvi.hItem != NULL) {
+ TreeView_GetItem(hTree, &tvi);
+ btn = (TopButtonInt*)tvi.lParam;
+ if (btn->id == id) {
+ // delete if was changed
+ if (btn->dwFlags & TTBBF_OPTIONAL)
+ delete btn;
+ TreeView_DeleteItem(hTree,tvi.hItem);
+ break;
+ }
+
+ tvi.hItem = TreeView_GetNextSibling(hTree, tvi.hItem);
+ }
+ }
+}
+
+/*
//call this when options opened and buttons added/removed
int OptionsPageRebuild()
{
@@ -73,19 +108,19 @@ int OptionsPageRebuild() return 0;
}
-
+*/
void SaveTree(HWND hwndDlg)
{
HWND hTree = GetDlgItem(hwndDlg, IDC_BUTTONORDERTREE);
TVITEM tvi = { 0 };
tvi.hItem = TreeView_GetRoot(hTree);
+ tvi.stateMask = TVIS_STATEIMAGEMASK;
+ tvi.mask = TVIF_PARAM | TVIF_HANDLE | TVIF_STATE;
LIST<TopButtonInt> tmpList(8);
while(tvi.hItem != NULL) {
- tvi.stateMask = TVIS_STATEIMAGEMASK;
- tvi.mask = TVIF_PARAM | TVIF_HANDLE | TVIF_STATE;
TreeView_GetItem(hTree, &tvi);
TopButtonInt* btn = (TopButtonInt*)tvi.lParam;
@@ -177,10 +212,33 @@ static INT_PTR CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR if ((HIWORD(wParam) == BN_CLICKED || HIWORD(wParam) == BN_DBLCLK)) {
int ctrlid = LOWORD(wParam);
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
//----- Launch buttons -----
+ if (ctrlid == IDC_BROWSE) {
+ TCHAR str[MAX_PATH];
+ OPENFILENAME ofn = {0};
+
+ GetDlgItemText(hwndDlg, IDC_EPATH, str, sizeof(str));
+ ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
+ ofn.hwndOwner = hwndDlg;
+ ofn.hInstance = NULL;
+ ofn.lpstrFilter = NULL;
+ ofn.lpstrFile = str;
+ ofn.Flags = OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST | OFN_EXPLORER;
+ ofn.nMaxFile = sizeof(str);
+ ofn.nMaxFileTitle = MAX_PATH;
+ ofn.lpstrDefExt = _T("exe");
+ if (!GetOpenFileName(&ofn))
+ break;
+
+ SetDlgItemText(hwndDlg, IDC_EPATH, str);
+
+ break;
+ }
+
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+
if (ctrlid == IDC_LBUTTONSET) {
TVITEM tvi ={0};
tvi.hItem = TreeView_GetSelection(hTree);
@@ -202,7 +260,9 @@ static INT_PTR CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR ttb.dwFlags = TTBBF_VISIBLE | TTBBF_ISLBUTTON | TTBBF_INTERNAL | TTBBF_OPTIONAL;
ttb.name = NULL;
ttb.program = NULL;
+ int id = btn->id;
btn = CreateButton(&ttb);
+ btn->id = id;
tvi.lParam = (LPARAM)btn;
TreeView_SetItem(hTree, &tvi);
@@ -344,10 +404,11 @@ static INT_PTR CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR lockbut();
if (btn->dwFlags & TTBBF_ISLBUTTON) {
- EnableWindow(GetDlgItem(hwndDlg, IDC_ENAME), TRUE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_EPATH), TRUE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_REMOVEBUTTON), TRUE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_LBUTTONSET), TRUE);
+ bool enable = (btn->dwFlags & TTBBF_INTERNAL) !=0;
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ENAME), enable);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_EPATH), enable);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_REMOVEBUTTON), enable);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_LBUTTONSET), enable);
if (btn->name != NULL)
SetDlgItemTextA(hwndDlg, IDC_ENAME, btn->name);
else
|