summaryrefslogtreecommitdiff
path: root/plugins/QuickMessages/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-03-04 07:23:42 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-03-04 07:23:42 +0000
commit66cb770a982a2502456d10d73838df2b7239fd89 (patch)
treefc419dde94a9be3ebe8f2266ff46feb90d2bcbec /plugins/QuickMessages/src
parentbc256df33a57e585367edffe33d3e58d53f82ce8 (diff)
new subclassing functions applied to all plugins
git-svn-id: http://svn.miranda-ng.org/main/trunk@3880 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/QuickMessages/src')
-rw-r--r--plugins/QuickMessages/src/options.cpp1354
1 files changed, 672 insertions, 682 deletions
diff --git a/plugins/QuickMessages/src/options.cpp b/plugins/QuickMessages/src/options.cpp
index b5add8e26f..7b53dfc933 100644
--- a/plugins/QuickMessages/src/options.cpp
+++ b/plugins/QuickMessages/src/options.cpp
@@ -26,14 +26,14 @@ HTREEITEM hDragItem = NULL;
HWND hButtonsList = NULL;
HWND hMenuTree = NULL;
HWND hwndEdit = NULL;
-WNDPROC oldEditProc = 0, oldBNameProc = 0, oldMNameProc = 0;
HWND g_opHdlg = NULL, g_varhelpDlg = NULL;
INT_PTR CALLBACK HelpDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam)
- {
+{
switch(msg){
- case WM_INITDIALOG:{
+ case WM_INITDIALOG:
+ {
LOGFONT logFont;
HFONT hFont;
RECT rc;
@@ -52,154 +52,156 @@ INT_PTR CALLBACK HelpDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam)
SendMessage(GetDlgItem(hdlg, IDC_VARCNAME), WM_SETFONT, (WPARAM)hFont, 0);
SendMessage(GetDlgItem(hdlg, IDC_VARCFNAME), WM_SETFONT, (WPARAM)hFont, 0);
SendMessage(GetDlgItem(hdlg, IDC_VARCLNAME), WM_SETFONT, (WPARAM)hFont, 0);
-
+
GetWindowRect(g_opHdlg,&rc);
SetWindowPos(hdlg,0,rc.left,rc.top,0,0,SWP_SHOWWINDOW|SWP_NOSIZE);
- }break;
+ }
+ break;
- case WM_LBUTTONDOWN:{
- PostMessage( hdlg,WM_NCLBUTTONDOWN, HTCAPTION,lparam);
- }break;
+ case WM_LBUTTONDOWN:
+ PostMessage( hdlg,WM_NCLBUTTONDOWN, HTCAPTION,lparam);
+ break;
- case WM_CLOSE:
- case WM_DESTROY:
- DestroyWindow(g_varhelpDlg);
- g_varhelpDlg=NULL;
- break;
- default:
- return FALSE;
- }
- return TRUE;
+ case WM_CLOSE:
+ case WM_DESTROY:
+ DestroyWindow(g_varhelpDlg);
+ g_varhelpDlg=NULL;
+ break;
+
+ default:
+ return FALSE;
}
+ return TRUE;
+}
static LRESULT CALLBACK LabelEditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
- {
+{
switch (msg) {
- case WM_GETDLGCODE:
- return DLGC_WANTALLKEYS;
- }
- return CallWindowProc(oldEditProc, hwnd, msg, wParam, lParam);
- }
+ case WM_GETDLGCODE:
+ return DLGC_WANTALLKEYS;
+ }
+ return mir_callNextSubclass(hwnd, LabelEditSubclassProc, msg, wParam, lParam);
+}
static LRESULT CALLBACK EditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
- {
- HWND hParent=GetParent(hwnd);
+{
+ HWND hParent = GetParent(hwnd);
switch (msg) {
- case WM_GETDLGCODE:
- return DLGC_WANTALLKEYS|DLGC_HASSETSEL;
- case WM_SETFOCUS:
- PostMessage(hwnd,EM_SETSEL,0,-1);
- break;
- case WM_KEYDOWN:
- {
+ case WM_GETDLGCODE:
+ return DLGC_WANTALLKEYS|DLGC_HASSETSEL;
+
+ case WM_SETFOCUS:
+ PostMessage(hwnd,EM_SETSEL,0,-1);
+ break;
+
+ case WM_KEYDOWN:
+ {
if(wParam==VK_RETURN)
if(hwnd==GetDlgItem(hParent,IDC_BUTTONNAME))
SendMessage(hParent,WM_COMMAND,IDC_BLISTADD,0);
else
SendMessage(hParent,WM_COMMAND,IDC_MTREEADD,0);
- }break;
- }
- if(hwnd==GetDlgItem(hParent,IDC_BUTTONNAME))
- return CallWindowProc(oldBNameProc, hwnd, msg, wParam, lParam);
- else
- return CallWindowProc(oldMNameProc, hwnd, msg, wParam, lParam);
- }
+ }break;
+ }
+
+ return mir_callNextSubclass(hwnd, EditSubclassProc, msg, wParam, lParam);
+}
void SetMenuEntryProperties(HWND hdlg)
- {
+{
TVITEM tvi;
HTREEITEM hItem=NULL;
ButtonData* bd=NULL;
int pos=0;
if(TreeView_GetCount(hButtonsList)&&(tvi.hItem=TreeView_GetSelection(hButtonsList)))
- {
+ {
tvi.mask=TVIF_HANDLE|TVIF_PARAM;
TreeView_GetItem(hButtonsList,&tvi);
if (tvi.lParam)
- {
+ {
ListData* ld = ( ListData* )tvi.lParam;
TCHAR szValue[256];
GetWindowText(GetDlgItem(hdlg,IDC_RCLICKVALUE), szValue, sizeof(szValue));
if(_tcslen(szValue))
- {
+ {
if(ld->ptszOPQValue&&(ld->ptszOPQValue!=ld->ptszQValue))
mir_free(ld->ptszOPQValue);
ld->ptszOPQValue=mir_tstrdup(szValue);
- }
- ld->bIsOpServName=IsDlgButtonChecked(hdlg,IDC_ISSERVNAME2);
}
+ ld->bIsOpServName=IsDlgButtonChecked(hdlg,IDC_ISSERVNAME2);
}
+ }
tvi.hItem=NULL;
if(TreeView_GetCount(hMenuTree)&&(tvi.hItem=TreeView_GetSelection(hMenuTree)))
- {
+ {
tvi.mask=TVIF_HANDLE|TVIF_PARAM;
TreeView_GetItem(hMenuTree,&tvi);
if (tvi.lParam)
- {
+ {
ButtonData* bd = ( ButtonData* )tvi.lParam;
TCHAR szValue[256];
GetWindowText(GetDlgItem(hdlg,IDC_MENUVALUE), szValue, sizeof(szValue));
if(_tcslen(szValue))
- {
+ {
if(_tcslen(bd->pszOpValue)&&(bd->pszOpValue!=bd->pszValue))
mir_free(bd->pszOpValue);
bd->pszOpValue=mir_tstrdup(szValue);
- }
+ }
bd->bOpInQMenu=IsDlgButtonChecked(hdlg,IDC_INQMENU);
bd->bIsOpServName=IsDlgButtonChecked(hdlg,IDC_ISSERVNAME);
- }
-
+ }
+
tvi.mask = TVIF_HANDLE | TVIF_PARAM;
tvi.hItem = TreeView_GetRoot(hMenuTree);
- }
- while (tvi.hItem) {
- TreeView_GetItem(hMenuTree, &tvi);
- bd= (ButtonData*)tvi.lParam;
+ }
+ while (tvi.hItem) {
+ TreeView_GetItem(hMenuTree, &tvi);
+ bd= (ButtonData*)tvi.lParam;
- bd->dwOPPos=pos++;
+ bd->dwOPPos=pos++;
- if(hItem=TreeView_GetChild(hMenuTree, tvi.hItem)) {
+ if(hItem=TreeView_GetChild(hMenuTree, tvi.hItem)) {
- bd->fEntryOpType&=~QMF_EX_CHILD;
+ bd->fEntryOpType&=~QMF_EX_CHILD;
+ if(bd->pszOpValue){
+ mir_free(bd->pszOpValue);
+ bd->pszOpValue=NULL;
+ }
+ tvi.hItem=hItem;
+ continue;
+ }
+ else
+ {
+ if(bd->fEntryOpType&QMF_EX_SEPARATOR){
if(bd->pszOpValue){
mir_free(bd->pszOpValue);
bd->pszOpValue=NULL;
- }
- tvi.hItem=hItem;
- continue;
- }
- else
- {
- if(bd->fEntryOpType&QMF_EX_SEPARATOR){
- if(bd->pszOpValue){
- mir_free(bd->pszOpValue);
- bd->pszOpValue=NULL;
- }}
- else
- {
- if (!bd->pszOpValue)
- bd->pszOpValue=mir_tstrdup(LPGENT("Enter Value"));
- }
- if(TreeView_GetParent(hMenuTree, tvi.hItem))
- bd->fEntryOpType|=QMF_EX_CHILD;
- else bd->fEntryOpType&=~QMF_EX_CHILD;
-
- if (!(hItem=TreeView_GetNextSibling(hMenuTree, tvi.hItem)))
- tvi.hItem=TreeView_GetNextSibling(hMenuTree, TreeView_GetParent(hMenuTree,tvi.hItem));
- else
- tvi.hItem=hItem;
-
- }
+ }}
+ else
+ {
+ if (!bd->pszOpValue)
+ bd->pszOpValue=mir_tstrdup(LPGENT("Enter Value"));
}
+ if(TreeView_GetParent(hMenuTree, tvi.hItem))
+ bd->fEntryOpType|=QMF_EX_CHILD;
+ else bd->fEntryOpType&=~QMF_EX_CHILD;
+
+ if (!(hItem=TreeView_GetNextSibling(hMenuTree, tvi.hItem)))
+ tvi.hItem=TreeView_GetNextSibling(hMenuTree, TreeView_GetParent(hMenuTree,tvi.hItem));
+ else
+ tvi.hItem=hItem;
+
+ }
}
+}
void SaveMenuTree(HWND hdlg)
- {
+{
int iBl=0,i=0,k=0;
int iBtd=g_iButtonsCount;
BOOL bDeleted=FALSE;
@@ -214,7 +216,7 @@ void SaveMenuTree(HWND hdlg)
tvi.cchTextMax = 256;
tvi.mask=TVIF_HANDLE|TVIF_TEXT ;
tvi.hItem=TreeView_GetRoot(hButtonsList);
-
+
TreeView_GetItem(hButtonsList,&tvi);
li_ZeroQuickList(QuickList);
@@ -222,7 +224,7 @@ void SaveMenuTree(HWND hdlg)
BalanceButtons(iBtd,g_iButtonsCount);
while(ButtonsList[iBl])
- {
+ {
SortedList * sl=NULL;
ListData* ld=ButtonsList[iBl];
@@ -231,133 +233,133 @@ void SaveMenuTree(HWND hdlg)
sl=ld->sl;
if(ld->dwOPFlags&QMF_DELETNEEDED)
- {
+ {
bDeleted=(ld->dwOPFlags&QMF_NEW)?FALSE:TRUE;
if(bDeleted) CleanSettings(ld->dwPos,-1);
DestroyButton(iBl);
continue;
- }
+ }
if(ld->ptszQValue!=ld->ptszOPQValue)
- {
- if(ld->ptszQValue)
- mir_free(ld->ptszQValue);
+ {
+ if(ld->ptszQValue)
+ mir_free(ld->ptszQValue);
ld->ptszQValue=(ld->ptszOPQValue)?ld->ptszOPQValue:NULL;
- }
+ }
if(ld->ptszButtonName)
- mir_free(ld->ptszButtonName);
- if(iBl>0)
- if(hti=TreeView_GetNextSibling(hButtonsList,hti?hti:tvi.hItem))
- {
+ mir_free(ld->ptszButtonName);
+ if(iBl>0)
+ if(hti=TreeView_GetNextSibling(hButtonsList,hti?hti:tvi.hItem))
+ {
tvi.hItem=hti;
TreeView_GetItem(hButtonsList,&tvi);
- }
+ }
+
+ ld->ptszButtonName=mir_tstrdup(tvi.pszText);
- ld->ptszButtonName=mir_tstrdup(tvi.pszText);
-
- if(ld->ptszQValue)
+ if(ld->ptszQValue)
{
- mir_snprintf(szMEntry,255,"ButtonValue_%u",iBl);
- DBWriteContactSettingTString(NULL, PLGNAME,szMEntry,ld->ptszQValue);
+ mir_snprintf(szMEntry,255,"ButtonValue_%u",iBl);
+ DBWriteContactSettingTString(NULL, PLGNAME,szMEntry,ld->ptszQValue);
}
- if (ServiceExists(MS_BB_MODIFYBUTTON)&&((ld->dwOPFlags&QMF_NEW)||(ld->dwOPFlags&QMF_RENAMED)||bDeleted))
+ if (ServiceExists(MS_BB_MODIFYBUTTON)&&((ld->dwOPFlags&QMF_NEW)||(ld->dwOPFlags&QMF_RENAMED)||bDeleted))
{
- BBButton bb={0};
- bb.cbSize=sizeof(BBButton);
- bb.pszModuleName=PLGNAME;
- bb.dwButtonID=iBl;
- bb.ptszTooltip=ld->ptszButtonName;
- CallService(MS_BB_MODIFYBUTTON,0,(LPARAM)&bb);
+ BBButton bb={0};
+ bb.cbSize=sizeof(BBButton);
+ bb.pszModuleName=PLGNAME;
+ bb.dwButtonID=iBl;
+ bb.ptszTooltip=ld->ptszButtonName;
+ CallService(MS_BB_MODIFYBUTTON,0,(LPARAM)&bb);
}
-
-
- mir_snprintf(szMEntry,255,"ButtonName_%u",iBl);
- DBWriteContactSettingTString(NULL, PLGNAME,szMEntry,ld->ptszButtonName);
- ld->dwOPFlags=0;
- ld->dwPos=iBl;
- ld->bIsServName=ld->bIsOpServName;
- mir_snprintf(szMEntry,255,"RCEntryIsServiceName_%u",iBl);
- DBWriteContactSettingByte(NULL, PLGNAME,szMEntry,ld->bIsServName);
-
- bDeleted=FALSE;
- qsort(sl->items,sl->realCount,sizeof(ButtonData *),sstSortButtons);
+ mir_snprintf(szMEntry,255,"ButtonName_%u",iBl);
+ DBWriteContactSettingTString(NULL, PLGNAME,szMEntry,ld->ptszButtonName);
- for ( i=0; i < sl->realCount; i++ ) {
- ButtonData * bd= (ButtonData *)sl->items[i];
+ ld->dwOPFlags=0;
+ ld->dwPos=iBl;
+ ld->bIsServName=ld->bIsOpServName;
+ mir_snprintf(szMEntry,255,"RCEntryIsServiceName_%u",iBl);
+ DBWriteContactSettingByte(NULL, PLGNAME,szMEntry,ld->bIsServName);
- if(bd->dwOPFlags&QMF_DELETNEEDED){
- RemoveMenuEntryNode(sl, i--);
- continue;
+ bDeleted=FALSE;
+
+ qsort(sl->items,sl->realCount,sizeof(ButtonData *),sstSortButtons);
+
+ for ( i=0; i < sl->realCount; i++ ) {
+ ButtonData * bd= (ButtonData *)sl->items[i];
+
+ if(bd->dwOPFlags&QMF_DELETNEEDED){
+ RemoveMenuEntryNode(sl, i--);
+ continue;
}
- bd->bIsServName=bd->bIsOpServName;
- bd->bInQMenu=bd->bOpInQMenu;
- bd->dwPos=bd->dwOPPos;
- bd->fEntryType=bd->fEntryOpType;
- bd->dwOPFlags=0;
+ bd->bIsServName=bd->bIsOpServName;
+ bd->bInQMenu=bd->bOpInQMenu;
+ bd->dwPos=bd->dwOPPos;
+ bd->fEntryType=bd->fEntryOpType;
+ bd->dwOPFlags=0;
- if(bd->pszName!=bd->pszOpName)
+ if(bd->pszName!=bd->pszOpName)
{
- if(bd->pszName)
- mir_free(bd->pszName);
- bd->pszName=bd->pszOpName?bd->pszOpName:NULL;
+ if(bd->pszName)
+ mir_free(bd->pszName);
+ bd->pszName=bd->pszOpName?bd->pszOpName:NULL;
}
- if(bd->pszValue!=bd->pszOpValue)
+ if(bd->pszValue!=bd->pszOpValue)
{
- if(bd->pszValue)
- mir_free(bd->pszValue);
- bd->pszValue=bd->pszOpValue?bd->pszOpValue:NULL;
+ if(bd->pszValue)
+ mir_free(bd->pszValue);
+ bd->pszValue=bd->pszOpValue?bd->pszOpValue:NULL;
}
- if(bd->bInQMenu)
+ if(bd->bInQMenu)
{
- QuickData* qd = (QuickData *)mir_alloc(sizeof(QuickData));
- qd->dwPos=k++;
- qd->fEntryType=bd->fEntryType;
- qd->bIsService=bd->bIsServName;
- qd->ptszValue=bd->pszValue;
- qd->ptszValueName=bd->pszName;
- List_InsertPtr(QuickList,qd);
+ QuickData* qd = (QuickData *)mir_alloc(sizeof(QuickData));
+ qd->dwPos=k++;
+ qd->fEntryType=bd->fEntryType;
+ qd->bIsService=bd->bIsServName;
+ qd->ptszValue=bd->pszValue;
+ qd->ptszValueName=bd->pszName;
+ List_InsertPtr(QuickList,qd);
}
- SaveModuleSettings(iBl,bd);
+ SaveModuleSettings(iBl,bd);
}
- CleanSettings(iBl,sl->realCount);
+ CleanSettings(iBl,sl->realCount);
- iBl++;
- }
-
- DBWriteContactSettingByte(NULL, PLGNAME,"ButtonsCount", (BYTE)g_iButtonsCount);
+ iBl++;
}
+ DBWriteContactSettingByte(NULL, PLGNAME,"ButtonsCount", (BYTE)g_iButtonsCount);
+}
+
void RestoreModuleData(HWND hdlg)
- {
+{
int iBl=0,i=0;
char szMEntry[256]={'\0'};
while(ButtonsList[iBl])
- {
+ {
SortedList * sl=NULL;
ListData* ld=ButtonsList[iBl];
if (!(sl=ld->sl)) break;
if(ld->dwOPFlags&QMF_NEW)
- {
+ {
DestroyButton(iBl);
continue;
- }
+ }
if(ld->ptszQValue!=ld->ptszOPQValue)
- {
+ {
if(ld->ptszOPQValue)
mir_free(ld->ptszOPQValue);
ld->ptszOPQValue=(ld->ptszQValue)?ld->ptszQValue:NULL;
- }
+ }
ld->bIsOpServName=ld->bIsServName;
ld->dwOPFlags=0;
@@ -370,7 +372,7 @@ void RestoreModuleData(HWND hdlg)
if(bd->dwOPFlags&QMF_NEW){
RemoveMenuEntryNode(sl, i--);
continue;
- }
+ }
bd->bIsOpServName=bd->bIsServName;
bd->bOpInQMenu=bd->bInQMenu;
bd->dwOPPos=bd->dwPos;
@@ -378,25 +380,25 @@ void RestoreModuleData(HWND hdlg)
bd->dwOPFlags=0;
if(bd->pszName!=bd->pszOpName)
- {
+ {
if(bd->pszOpName)
mir_free(bd->pszOpName);
bd->pszOpName=bd->pszName?bd->pszName:NULL;
- }
+ }
if(bd->pszValue!=bd->pszOpValue)
- {
+ {
if(bd->pszOpValue)
mir_free(bd->pszOpValue);
bd->pszOpValue=bd->pszValue?bd->pszValue:NULL;
- }
}
- iBl++;
}
+ iBl++;
}
+}
static int BuildMenuTree(HWND hToolBarTree,SortedList * sl)
- {
+{
TVINSERTSTRUCT tvis;
int i;
HTREEITEM hParent=NULL;
@@ -424,18 +426,18 @@ static int BuildMenuTree(HWND hToolBarTree,SortedList * sl)
hParent=TreeView_InsertItem( hToolBarTree, &tvis );
if(tvis.hParent) TreeView_Expand( hMenuTree, tvis.hParent, TVE_EXPAND );
if (!bd->pszOpValue&&bd->fEntryOpType==0)
- {
+ {
tvis.hParent = hParent;
- }
-// else if (!(bd->fEntryOpType&QMF_EX_CHILD))
-// tvis.hParent = NULL;
}
+ // else if (!(bd->fEntryOpType&QMF_EX_CHILD))
+ // tvis.hParent = NULL;
+ }
return 1;
- }
+}
static int BuildButtonsList(HWND hToolBarTree)
- {
+{
TVINSERTSTRUCT tvis;
int i=0;
tvis.hParent = NULL;
@@ -443,23 +445,23 @@ static int BuildButtonsList(HWND hToolBarTree)
tvis.item.mask =TVIF_PARAM | TVIF_TEXT;
TreeView_DeleteAllItems( hToolBarTree );
-
+
//for(i=0;i<g_iButtonsCount;i++)
while(ButtonsList[i])
- {
+ {
tvis.item.lParam =(LPARAM) ButtonsList[i];
tvis.item.pszText = ButtonsList[i]->ptszButtonName;
TreeView_InsertItem( hToolBarTree, &tvis );
i++;
- }
- return 1;
}
+ return 1;
+}
///////////////////////////////////
//From UserInfoEx by DeathAxe
//
void MoveItem( HTREEITEM hItem, HTREEITEM hInsertAfter, BOOLEAN bAsChild )
- {
+{
TVINSERTSTRUCT tvis;
//TCHAR strbuf[128];
HTREEITEM hParent, hChild, hNewItem;
@@ -470,22 +472,22 @@ void MoveItem( HTREEITEM hItem, HTREEITEM hInsertAfter, BOOLEAN bAsChild )
return;
switch( ( ULONG_PTR )hInsertAfter ) {
- case TVI_ROOT:
- case TVI_FIRST:
- case TVI_LAST:
- hParent = NULL;
- bAsChild = FALSE;
- break;
- default:
- hParent = TreeView_GetParent( hMenuTree, hInsertAfter );
- break;
- }
+ case TVI_ROOT:
+ case TVI_FIRST:
+ case TVI_LAST:
+ hParent = NULL;
+ bAsChild = FALSE;
+ break;
+ default:
+ hParent = TreeView_GetParent( hMenuTree, hInsertAfter );
+ break;
+ }
// do not move a parent next to its own children!
if ( hItem == hParent )
return;
// prepare the insert structure
- {
+ {
TCHAR strbuf[128];
tvis.item.mask=TVIF_HANDLE|TVIF_PARAM|TVIF_TEXT;
@@ -493,191 +495,191 @@ void MoveItem( HTREEITEM hItem, HTREEITEM hInsertAfter, BOOLEAN bAsChild )
tvis.item.cchTextMax=sizeof(strbuf);
tvis.item.hItem=hItem;
TreeView_GetItem(hMenuTree,&tvis.item);
- }
+ }
- // item should be inserted as the first child of an existing root item
- if ( bAsChild ) {
- tvis.hParent = hInsertAfter;
- tvis.hInsertAfter = ( bAsChild == 2 ) ? TVI_LAST : TVI_FIRST ;
- }
- // item should be inserted after an existing item
- else {
- tvis.hParent = hParent;
- tvis.hInsertAfter = hInsertAfter;
- }
- // insert the item
- if ( !( hNewItem = TreeView_InsertItem( hMenuTree, &tvis )) )
- return;
-
- // move children
- hInsertAfter = hNewItem;
- while( hChild = TreeView_GetChild( hMenuTree, hItem )) {
- MoveItem( hChild, hInsertAfter, 2 );
- }
- // delete old tree
- TreeView_DeleteItem( hMenuTree, hItem );
+ // item should be inserted as the first child of an existing root item
+ if ( bAsChild ) {
+ tvis.hParent = hInsertAfter;
+ tvis.hInsertAfter = ( bAsChild == 2 ) ? TVI_LAST : TVI_FIRST ;
+ }
+ // item should be inserted after an existing item
+ else {
+ tvis.hParent = hParent;
+ tvis.hInsertAfter = hInsertAfter;
+ }
+ // insert the item
+ if ( !( hNewItem = TreeView_InsertItem( hMenuTree, &tvis )) )
+ return;
- TreeView_SelectItem( hMenuTree, hNewItem );
- //TreeView_Expand( hMenuTree, hNewItem, TVE_EXPAND );
+ // move children
+ hInsertAfter = hNewItem;
+ while( hChild = TreeView_GetChild( hMenuTree, hItem )) {
+ MoveItem( hChild, hInsertAfter, 2 );
}
+ // delete old tree
+ TreeView_DeleteItem( hMenuTree, hItem );
+
+ TreeView_SelectItem( hMenuTree, hNewItem );
+ //TreeView_Expand( hMenuTree, hNewItem, TVE_EXPAND );
+}
///////
INT_PTR CALLBACK OptionsProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam)
- {
+{
switch(msg){
- case WM_INITDIALOG:{
- DWORD style;
- g_opHdlg=hdlg;
- bOptionsInit=TRUE;
- TranslateDialogDefault(hdlg);
- if(g_iButtonsCount!=DBGetContactSettingByte(NULL, PLGNAME,"ButtonsCount", 0))
- {
- LOGFONT logFont;
- HFONT hFont;
- bNeedRestart=TRUE;
- EnableWindow(GetDlgItem(hdlg,IDC_BUTTONSLIST),FALSE);
- EnableWindow(GetDlgItem(hdlg,IDC_BLISTADD),FALSE);
- EnableWindow(GetDlgItem(hdlg,IDC_BLISTREMOVE),FALSE);
- EnableWindow(GetDlgItem(hdlg,IDC_MENUTREE),FALSE);
- EnableWindow(GetDlgItem(hdlg,IDC_MTREEADD),FALSE);
- EnableWindow(GetDlgItem(hdlg,IDC_MTREEREMOVE),FALSE);
- EnableWindow(GetDlgItem(hdlg,IDC_MENUVALUE),FALSE);
- EnableWindow(GetDlgItem(hdlg,IDC_RCLICKVALUE),FALSE);
- EnableWindow(GetDlgItem(hdlg,IDC_BUTTONNAME),FALSE);
- EnableWindow(GetDlgItem(hdlg,IDC_INQMENU),FALSE);
- EnableWindow(GetDlgItem(hdlg,IDC_ISSERVNAME),FALSE);
- EnableWindow(GetDlgItem(hdlg,IDC_MENUNAME),FALSE);
- ShowWindow(GetDlgItem(hdlg,IDC_WARNING),SW_SHOW);
-
- hFont = (HFONT)SendMessage(GetDlgItem(hdlg, IDC_WARNING), WM_GETFONT, 0, 0);
- GetObject(hFont, sizeof logFont, &logFont);
- logFont.lfWeight = FW_BOLD;
- hFont = CreateFontIndirect(&logFont);
- SendMessage(GetDlgItem(hdlg, IDC_WARNING), WM_SETFONT, (WPARAM)hFont, 0);
- break;
- }
-
- g_iOPButtonsCount=g_iButtonsCount;
+ case WM_INITDIALOG:{
+ DWORD style;
+ g_opHdlg=hdlg;
+ bOptionsInit=TRUE;
+ TranslateDialogDefault(hdlg);
+ if(g_iButtonsCount!=DBGetContactSettingByte(NULL, PLGNAME,"ButtonsCount", 0))
+ {
+ LOGFONT logFont;
+ HFONT hFont;
+ bNeedRestart=TRUE;
+ EnableWindow(GetDlgItem(hdlg,IDC_BUTTONSLIST),FALSE);
+ EnableWindow(GetDlgItem(hdlg,IDC_BLISTADD),FALSE);
+ EnableWindow(GetDlgItem(hdlg,IDC_BLISTREMOVE),FALSE);
+ EnableWindow(GetDlgItem(hdlg,IDC_MENUTREE),FALSE);
+ EnableWindow(GetDlgItem(hdlg,IDC_MTREEADD),FALSE);
+ EnableWindow(GetDlgItem(hdlg,IDC_MTREEREMOVE),FALSE);
+ EnableWindow(GetDlgItem(hdlg,IDC_MENUVALUE),FALSE);
+ EnableWindow(GetDlgItem(hdlg,IDC_RCLICKVALUE),FALSE);
+ EnableWindow(GetDlgItem(hdlg,IDC_BUTTONNAME),FALSE);
+ EnableWindow(GetDlgItem(hdlg,IDC_INQMENU),FALSE);
+ EnableWindow(GetDlgItem(hdlg,IDC_ISSERVNAME),FALSE);
+ EnableWindow(GetDlgItem(hdlg,IDC_MENUNAME),FALSE);
+ ShowWindow(GetDlgItem(hdlg,IDC_WARNING),SW_SHOW);
- hButtonsList=GetDlgItem(hdlg,IDC_BUTTONSLIST);
- hMenuTree=GetDlgItem(hdlg,IDC_MENUTREE);
+ hFont = (HFONT)SendMessage(GetDlgItem(hdlg, IDC_WARNING), WM_GETFONT, 0, 0);
+ GetObject(hFont, sizeof logFont, &logFont);
+ logFont.lfWeight = FW_BOLD;
+ hFont = CreateFontIndirect(&logFont);
+ SendMessage(GetDlgItem(hdlg, IDC_WARNING), WM_SETFONT, (WPARAM)hFont, 0);
+ break;
+ }
- style = GetWindowLongPtr(hButtonsList,GWL_STYLE);
- style |=TVS_NOHSCROLL;
- SetWindowLongPtr(hButtonsList,GWL_STYLE, style);
+ g_iOPButtonsCount=g_iButtonsCount;
- style = GetWindowLongPtr(hMenuTree,GWL_STYLE);
- style |=TVS_NOHSCROLL;
- SetWindowLongPtr(hMenuTree,GWL_STYLE, style);
- BuildButtonsList(hButtonsList);
-
- if (!TreeView_GetCount(hButtonsList)) EnableWindow(GetDlgItem(hdlg,IDC_RCLICKVALUE),FALSE);
+ hButtonsList=GetDlgItem(hdlg,IDC_BUTTONSLIST);
+ hMenuTree=GetDlgItem(hdlg,IDC_MENUTREE);
- oldBNameProc = (WNDPROC) SetWindowLongPtr(GetDlgItem(hdlg,IDC_BUTTONNAME), GWLP_WNDPROC, (LONG) EditSubclassProc);
- oldMNameProc = (WNDPROC) SetWindowLongPtr(GetDlgItem(hdlg,IDC_MENUNAME) , GWLP_WNDPROC, (LONG) EditSubclassProc);
+ style = GetWindowLongPtr(hButtonsList,GWL_STYLE);
+ style |=TVS_NOHSCROLL;
+ SetWindowLongPtr(hButtonsList,GWL_STYLE, style);
-
- EnableWindow(GetDlgItem(hdlg,IDC_MENUVALUE),FALSE);
- EnableWindow(GetDlgItem(hdlg,IDC_INQMENU),FALSE);
- EnableWindow(GetDlgItem(hdlg,IDC_ISSERVNAME),FALSE);
- CheckDlgButton(hdlg,IDC_RAUTOSEND,(g_bRClickAuto=DBGetContactSettingByte(NULL,PLGNAME,"RClickAuto",0)));
- CheckDlgButton(hdlg,IDC_LAUTOSEND,(g_bLClickAuto=DBGetContactSettingByte(NULL,PLGNAME,"LClickAuto",0)));
- CheckDlgButton(hdlg,IDC_ENABLEQUICKMENU,(g_bQuickMenu=DBGetContactSettingByte(NULL, PLGNAME,"QuickMenu", 1)));
-
- bOptionsInit=FALSE;
- }break;
+ style = GetWindowLongPtr(hMenuTree,GWL_STYLE);
+ style |=TVS_NOHSCROLL;
+ SetWindowLongPtr(hMenuTree,GWL_STYLE, style);
+ BuildButtonsList(hButtonsList);
- case WM_LBUTTONUP:
- if(drag) {
- TVHITTESTINFO hti;
- HTREEITEM htiAfter=NULL;
- ButtonData* bd=NULL;
- TVITEM tvi;
- RECT rc;
- BYTE height;
- BOOLEAN bAsChild = FALSE;
+ if (!TreeView_GetCount(hButtonsList))
+ EnableWindow(GetDlgItem(hdlg,IDC_RCLICKVALUE),FALSE);
- TreeView_SetInsertMark(hMenuTree, NULL, 0 );
- ReleaseCapture();
- SetCursor( LoadCursor( NULL, IDC_ARROW ));
+ mir_subclassWindow( GetDlgItem(hdlg,IDC_BUTTONNAME), EditSubclassProc);
+ mir_subclassWindow( GetDlgItem(hdlg,IDC_MENUNAME), EditSubclassProc);
- hti.pt.x = ( SHORT )LOWORD( lparam );
- hti.pt.y = ( SHORT )HIWORD( lparam );
- ClientToScreen(hdlg,&hti.pt);
- ScreenToClient(hMenuTree,&hti.pt);
- TreeView_HitTest( hMenuTree, &hti );
+ EnableWindow(GetDlgItem(hdlg,IDC_MENUVALUE),FALSE);
+ EnableWindow(GetDlgItem(hdlg,IDC_INQMENU),FALSE);
+ EnableWindow(GetDlgItem(hdlg,IDC_ISSERVNAME),FALSE);
+ CheckDlgButton(hdlg,IDC_RAUTOSEND,(g_bRClickAuto=DBGetContactSettingByte(NULL,PLGNAME,"RClickAuto",0)));
+ CheckDlgButton(hdlg,IDC_LAUTOSEND,(g_bLClickAuto=DBGetContactSettingByte(NULL,PLGNAME,"LClickAuto",0)));
+ CheckDlgButton(hdlg,IDC_ENABLEQUICKMENU,(g_bQuickMenu=DBGetContactSettingByte(NULL, PLGNAME,"QuickMenu", 1)));
- if(TreeView_GetParent(hMenuTree,hti.hItem)&&TreeView_GetChild(hMenuTree,hDragItem))
- break;
+ bOptionsInit=FALSE;
+ }break;
- if(TreeView_GetChild(hMenuTree,hti.hItem)&&TreeView_GetChild(hMenuTree,hDragItem))
- break;
+ case WM_LBUTTONUP:
+ if(drag) {
+ TVHITTESTINFO hti;
+ HTREEITEM htiAfter=NULL;
+ ButtonData* bd=NULL;
+ TVITEM tvi;
+ RECT rc;
+ BYTE height;
+ BOOLEAN bAsChild = FALSE;
+
+ TreeView_SetInsertMark(hMenuTree, NULL, 0 );
+ ReleaseCapture();
+ SetCursor( LoadCursor( NULL, IDC_ARROW ));
+
+ hti.pt.x = ( SHORT )LOWORD( lparam );
+ hti.pt.y = ( SHORT )HIWORD( lparam );
+ ClientToScreen(hdlg,&hti.pt);
+ ScreenToClient(hMenuTree,&hti.pt);
+ TreeView_HitTest( hMenuTree, &hti );
+ if(TreeView_GetParent(hMenuTree,hti.hItem)&&TreeView_GetChild(hMenuTree,hDragItem))
+ break;
+
+ if(TreeView_GetChild(hMenuTree,hti.hItem)&&TreeView_GetChild(hMenuTree,hDragItem))
+ break;
- if ( hti.flags & TVHT_ABOVE ) {
- htiAfter = TVI_FIRST;
+
+ if ( hti.flags & TVHT_ABOVE ) {
+ htiAfter = TVI_FIRST;
+ }
+ else
+ if ( hti.flags & ( TVHT_NOWHERE|TVHT_BELOW )) {
+ htiAfter = TVI_LAST;
+ }
+ else
+ if ( hti.flags & ( TVHT_ONITEM|TVHT_ONITEMRIGHT )) {
+ // check where over the item, the pointer is
+ if ( !TreeView_GetItemRect( hMenuTree, hti.hItem, &rc, FALSE )) {
+ drag=0;
+ break;
}
- else
- if ( hti.flags & ( TVHT_NOWHERE|TVHT_BELOW )) {
- htiAfter = TVI_LAST;
+ height = ( BYTE )( rc.bottom - rc.top );
+
+ if ( hti.pt.y - ( height / 3 ) < rc.top ) {
+ HTREEITEM hItem = hti.hItem;
+
+ if ( !( hti.hItem = TreeView_GetPrevSibling( hMenuTree, hItem )) ) {
+ if ( !( hti.hItem = TreeView_GetParent(hMenuTree, hItem )))
+ htiAfter = TVI_FIRST;
+ else
+ bAsChild = TRUE;
}
- else
- if ( hti.flags & ( TVHT_ONITEM|TVHT_ONITEMRIGHT )) {
- // check where over the item, the pointer is
- if ( !TreeView_GetItemRect( hMenuTree, hti.hItem, &rc, FALSE )) {
- drag=0;
- break;
- }
- height = ( BYTE )( rc.bottom - rc.top );
-
- if ( hti.pt.y - ( height / 3 ) < rc.top ) {
- HTREEITEM hItem = hti.hItem;
-
- if ( !( hti.hItem = TreeView_GetPrevSibling( hMenuTree, hItem )) ) {
- if ( !( hti.hItem = TreeView_GetParent(hMenuTree, hItem )))
- htiAfter = TVI_FIRST;
- else
- bAsChild = TRUE;
- }
- }
- else
- if ( hti.pt.y + ( height / 3 ) <= rc.bottom ) {
- bAsChild = TRUE;
- }
- }
-
-
- if(TreeView_GetChild(hMenuTree,hDragItem)&&bAsChild)
- break;
+ }
+ else
+ if ( hti.pt.y + ( height / 3 ) <= rc.bottom ) {
+ bAsChild = TRUE;
+ }
+ }
- if(hti.hItem){
- tvi.hItem=hti.hItem;
- tvi.mask=TVIF_PARAM |TVIF_HANDLE;
- TreeView_GetItem(hMenuTree,&tvi);
- if ((bd=(ButtonData*)tvi.lParam)&&(bd->fEntryOpType&QMF_EX_SEPARATOR))
- bAsChild = FALSE;
- }
+ if(TreeView_GetChild(hMenuTree,hDragItem)&&bAsChild)
+ break;
- if(TreeView_GetParent(hMenuTree,hti.hItem))
- bAsChild = FALSE;
+ if(hti.hItem){
+ tvi.hItem=hti.hItem;
+ tvi.mask=TVIF_PARAM |TVIF_HANDLE;
+ TreeView_GetItem(hMenuTree,&tvi);
+ if ((bd=(ButtonData*)tvi.lParam)&&(bd->fEntryOpType&QMF_EX_SEPARATOR))
+ bAsChild = FALSE;
+ }
- MoveItem( hDragItem, htiAfter?htiAfter:hti.hItem, bAsChild );
- SendMessage(GetParent(hdlg),PSM_CHANGED,0,0);
- drag=0;
+ if(TreeView_GetParent(hMenuTree,hti.hItem))
+ bAsChild = FALSE;
- }
- break;
+
+ MoveItem( hDragItem, htiAfter?htiAfter:hti.hItem, bAsChild );
+ SendMessage(GetParent(hdlg),PSM_CHANGED,0,0);
+ drag=0;
+
+ }
+ break;
///////////////////////////////////
//From UserInfoEx by DeathAxe
//
- case WM_MOUSEMOVE:
- {
+ case WM_MOUSEMOVE:
+ {
if (!drag) break;
- {
+ {
TVHITTESTINFO hti;
hti.pt.x=(short)LOWORD(lparam);
@@ -695,460 +697,448 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam)
if ( hti.pt.y - ( height / 3 ) < rc.top ) {
SetCursor( LoadCursor( NULL, IDC_ARROW ));
TreeView_SetInsertMark( hMenuTree, hti.hItem, 0 );
- }
+ }
else
if ( hti.pt.y + ( height / 3 ) > rc.bottom ) {
SetCursor( LoadCursor( NULL, IDC_ARROW ));
TreeView_SetInsertMark( hMenuTree, hti.hItem, 1 );
- }
+ }
else {
TreeView_SetInsertMark( hMenuTree, NULL, 0 );
SetCursor( LoadCursor( GetModuleHandle(NULL), MAKEINTRESOURCE( 183 )) );
- }
- }
+ }
}
+ }
else {
if ( hti.flags & TVHT_ABOVE ) SendMessage( hMenuTree, WM_VSCROLL, MAKEWPARAM( SB_LINEUP, 0 ), 0 );
if ( hti.flags & TVHT_BELOW ) SendMessage( hMenuTree, WM_VSCROLL, MAKEWPARAM( SB_LINEDOWN, 0 ), 0 );
TreeView_SetInsertMark( hMenuTree, NULL, 0 );
- }
}
- }break;
- /////////////
- case WM_DESTROY:
- if (g_varhelpDlg)
- DestroyWindow(g_varhelpDlg);
- g_varhelpDlg=NULL;
- break;
+ }
+ }break;
+ /////////////
+ case WM_DESTROY:
+ if (g_varhelpDlg)
+ DestroyWindow(g_varhelpDlg);
+ g_varhelpDlg=NULL;
+ break;
- case WM_NOTIFY:{
- switch(((LPNMHDR)lparam)->idFrom) {
- case 0:{
+ case WM_NOTIFY:
+ switch(((LPNMHDR)lparam)->idFrom) {
+ case 0:
if (((LPNMHDR)lparam)->code == PSN_APPLY ) {
if (!bNeedRestart){
- SetMenuEntryProperties(hdlg);
- SaveMenuTree(hdlg);
+ SetMenuEntryProperties(hdlg);
+ SaveMenuTree(hdlg);
}
DBWriteContactSettingByte(NULL,PLGNAME,"RClickAuto",(BYTE)(g_bRClickAuto=IsDlgButtonChecked(hdlg,IDC_RAUTOSEND)));
DBWriteContactSettingByte(NULL,PLGNAME,"LClickAuto",(BYTE)(g_bLClickAuto=IsDlgButtonChecked(hdlg,IDC_LAUTOSEND)));
DBWriteContactSettingByte(NULL,PLGNAME,"QuickMenu",(BYTE)(g_bQuickMenu=IsDlgButtonChecked(hdlg,IDC_ENABLEQUICKMENU)));
return 1;
- }
+ }
else if (((LPNMHDR)lparam)->code == PSN_RESET ) {
- if (!bNeedRestart)
- RestoreModuleData(hdlg);
+ if (!bNeedRestart)
+ RestoreModuleData(hdlg);
return 1;
- }
}
break;
case IDC_MENUTREE:
switch (((LPNMHDR)lparam)->code){
-
- case TVN_KEYDOWN:{
- TV_KEYDOWN* pTVKeyDown = (TV_KEYDOWN*) ((LPNMHDR)lparam);
- if ( pTVKeyDown->wVKey == VK_F2 )
- TreeView_EditLabel(hMenuTree,TreeView_GetSelection(hMenuTree));
- else if ( pTVKeyDown->wVKey == VK_DELETE )
+ case TVN_KEYDOWN:{
+ TV_KEYDOWN* pTVKeyDown = (TV_KEYDOWN*) ((LPNMHDR)lparam);
+ if ( pTVKeyDown->wVKey == VK_F2 )
+ TreeView_EditLabel(hMenuTree,TreeView_GetSelection(hMenuTree));
+ else if ( pTVKeyDown->wVKey == VK_DELETE )
SendMessage(hdlg,WM_COMMAND,IDC_MTREEREMOVE,0);
- }break;
+ }break;
- case TVN_BEGINLABELEDITA:
- case TVN_BEGINLABELEDITW:
- hwndEdit=TreeView_GetEditControl(hMenuTree);
- oldEditProc = (WNDPROC) SetWindowLongPtr(hwndEdit, GWLP_WNDPROC, (LONG) LabelEditSubclassProc);
- break;
+ case TVN_BEGINLABELEDITA:
+ case TVN_BEGINLABELEDITW:
+ hwndEdit=TreeView_GetEditControl(hMenuTree);
+ mir_subclassWindow(hwndEdit, LabelEditSubclassProc);
+ break;
- case TVN_ENDLABELEDITA:
- case TVN_ENDLABELEDITW:
- {
- TVITEM tvi;
- ButtonData* bd=NULL;
- TCHAR strbuf[256];
- TCHAR szLabel[256];
-
- SetWindowLongPtr(hwndEdit, GWLP_WNDPROC, (LONG) oldEditProc);
-
- tvi.pszText = strbuf;
- tvi.cchTextMax = sizeof(strbuf);
- tvi.mask=TVIF_TEXT |TVIF_HANDLE|TVIF_PARAM;
- tvi.hItem=TreeView_GetSelection(hMenuTree);
- TreeView_GetItem(hMenuTree,&tvi);
-
- GetWindowText(hwndEdit, szLabel, sizeof(szLabel));
- hwndEdit=NULL;
- if (!_tcslen(szLabel)) break;
- if (bd = (ButtonData*)tvi.lParam){
- if (!_tcscmp(szLabel,_T("---"))) {
- if(TreeView_GetChild(hMenuTree,tvi.hItem))
- break;
- else{
- bd->fEntryOpType=QMF_EX_SEPARATOR;
- EnableWindow(GetDlgItem(hdlg,IDC_MENUVALUE),FALSE);
- EnableWindow(GetDlgItem(hdlg,IDC_ISSERVNAME),FALSE);
- SetWindowText(GetDlgItem(hdlg,IDC_MENUVALUE),_T(""));
+ case TVN_ENDLABELEDITA:
+ case TVN_ENDLABELEDITW:
+ {
+ TVITEM tvi;
+ ButtonData* bd=NULL;
+ TCHAR strbuf[256];
+ TCHAR szLabel[256];
+
+ tvi.pszText = strbuf;
+ tvi.cchTextMax = sizeof(strbuf);
+ tvi.mask=TVIF_TEXT |TVIF_HANDLE|TVIF_PARAM;
+ tvi.hItem=TreeView_GetSelection(hMenuTree);
+ TreeView_GetItem(hMenuTree,&tvi);
+
+ GetWindowText(hwndEdit, szLabel, sizeof(szLabel));
+ hwndEdit=NULL;
+ if (!_tcslen(szLabel)) break;
+ if (bd = (ButtonData*)tvi.lParam){
+ if (!_tcscmp(szLabel,_T("---"))) {
+ if(TreeView_GetChild(hMenuTree,tvi.hItem))
+ break;
+ else{
+ bd->fEntryOpType=QMF_EX_SEPARATOR;
+ EnableWindow(GetDlgItem(hdlg,IDC_MENUVALUE),FALSE);
+ EnableWindow(GetDlgItem(hdlg,IDC_ISSERVNAME),FALSE);
+ SetWindowText(GetDlgItem(hdlg,IDC_MENUVALUE),_T(""));
+ }
+ }
+ else {
+ bd->fEntryOpType&=~QMF_EX_SEPARATOR;
+ EnableWindow(GetDlgItem(hdlg,IDC_MENUVALUE),TRUE);
+ EnableWindow(GetDlgItem(hdlg,IDC_ISSERVNAME),TRUE);
+ SetWindowText(GetDlgItem(hdlg,IDC_MENUVALUE),bd->pszOpValue/*?bd->pszOpValue:bd->pszValue*/);
}
- }
- else {
- bd->fEntryOpType&=~QMF_EX_SEPARATOR;
- EnableWindow(GetDlgItem(hdlg,IDC_MENUVALUE),TRUE);
- EnableWindow(GetDlgItem(hdlg,IDC_ISSERVNAME),TRUE);
- SetWindowText(GetDlgItem(hdlg,IDC_MENUVALUE),bd->pszOpValue/*?bd->pszOpValue:bd->pszValue*/);
- }
- bd->pszOpName=mir_tstrdup(szLabel);
-
- tvi.pszText=szLabel;
- TreeView_SetItem(hMenuTree, &tvi);
- SendMessage(GetParent(hdlg),PSM_CHANGED,0,0);
- }
- }break;
+ bd->pszOpName=mir_tstrdup(szLabel);
- case NM_KILLFOCUS:
- TreeView_EndEditLabelNow(hButtonsList, 1);
- break;
+ tvi.pszText=szLabel;
+ TreeView_SetItem(hMenuTree, &tvi);
+ SendMessage(GetParent(hdlg),PSM_CHANGED,0,0);
+ }
+ }break;
- case TVN_BEGINDRAGA:
- case TVN_BEGINDRAGW:
- SetCapture(hdlg);
- drag=1;
- hDragItem=((LPNMTREEVIEW)lparam)->itemNew.hItem;
- TreeView_SelectItem(hMenuTree,hDragItem);
- break;
+ case NM_KILLFOCUS:
+ TreeView_EndEditLabelNow(hButtonsList, 1);
+ break;
- case TVN_SELCHANGINGA:
- case TVN_SELCHANGINGW:
- {
- TVITEM tvi;
- HTREEITEM hti;
- ButtonData* bd;
+ case TVN_BEGINDRAGA:
+ case TVN_BEGINDRAGW:
+ SetCapture(hdlg);
+ drag=1;
+ hDragItem=((LPNMTREEVIEW)lparam)->itemNew.hItem;
+ TreeView_SelectItem(hMenuTree,hDragItem);
+ break;
+
+ case TVN_SELCHANGINGA:
+ case TVN_SELCHANGINGW:
+ {
+ TVITEM tvi;
+ HTREEITEM hti;
+ ButtonData* bd;
- hti=TreeView_GetSelection(hMenuTree);
+ hti=TreeView_GetSelection(hMenuTree);
- if (hti==NULL)
- break;
+ if (hti==NULL)
+ break;
- tvi.hItem=hti;
- tvi.mask=TVIF_HANDLE|TVIF_PARAM;
- TreeView_GetItem(hMenuTree,&tvi);
+ tvi.hItem=hti;
+ tvi.mask=TVIF_HANDLE|TVIF_PARAM;
+ TreeView_GetItem(hMenuTree,&tvi);
- if (tvi.lParam == 0)
- break;
+ if (tvi.lParam == 0)
+ break;
- bd = ( ButtonData* )tvi.lParam;
- if (bd) {
- TCHAR szValue[256];
- GetWindowText(GetDlgItem(hdlg,IDC_MENUVALUE), szValue, sizeof(szValue));
- if(_tcslen(szValue))
- {
- if(bd->pszOpValue&&(bd->pszOpValue!=bd->pszValue))
- mir_free(bd->pszOpValue);
- bd->pszOpValue=mir_tstrdup(szValue);
+ bd = ( ButtonData* )tvi.lParam;
+ if (bd) {
+ TCHAR szValue[256];
+ GetWindowText(GetDlgItem(hdlg,IDC_MENUVALUE), szValue, sizeof(szValue));
+ if(_tcslen(szValue))
+ {
+ if(bd->pszOpValue&&(bd->pszOpValue!=bd->pszValue))
+ mir_free(bd->pszOpValue);
+ bd->pszOpValue=mir_tstrdup(szValue);
+ }
+ bd->bOpInQMenu=IsDlgButtonChecked(hdlg,IDC_INQMENU);
+ bd->bIsOpServName=IsDlgButtonChecked(hdlg,IDC_ISSERVNAME);
}
- bd->bOpInQMenu=IsDlgButtonChecked(hdlg,IDC_INQMENU);
- bd->bIsOpServName=IsDlgButtonChecked(hdlg,IDC_ISSERVNAME);
- }
- }break;
- case TVN_SELCHANGEDA:
- case TVN_SELCHANGEDW:
- {
- TVITEM tvi;
- HTREEITEM hti;
- ButtonData* bd=NULL;
+ }break;
+ case TVN_SELCHANGEDA:
+ case TVN_SELCHANGEDW:
+ {
+ TVITEM tvi;
+ HTREEITEM hti;
+ ButtonData* bd=NULL;
- hti=TreeView_GetSelection(hMenuTree);
+ hti=TreeView_GetSelection(hMenuTree);
- if (hti==NULL)
- break;
+ if (hti==NULL)
+ break;
- tvi.mask=TVIF_HANDLE|TVIF_PARAM;
+ tvi.mask=TVIF_HANDLE|TVIF_PARAM;
- tvi.hItem=hti;
- TreeView_GetItem(hMenuTree,&tvi);
+ tvi.hItem=hti;
+ TreeView_GetItem(hMenuTree,&tvi);
- bd = ( ButtonData* )tvi.lParam;
- if (bd) {
- if (!TreeView_GetChild(hMenuTree, tvi.hItem)&&!(bd->fEntryOpType&QMF_EX_SEPARATOR))
- {
- EnableWindow(GetDlgItem(hdlg,IDC_MENUVALUE),TRUE);
- EnableWindow(GetDlgItem(hdlg,IDC_ISSERVNAME),TRUE);
- EnableWindow(GetDlgItem(hdlg,IDC_INQMENU),TRUE);
- SetWindowText(GetDlgItem(hdlg,IDC_MENUVALUE),bd->pszOpValue/*?bd->pszOpValue:bd->pszValue*/);
- }
- else
- {
- EnableWindow(GetDlgItem(hdlg,IDC_MENUVALUE),FALSE);
- EnableWindow(GetDlgItem(hdlg,IDC_ISSERVNAME),FALSE);
- if (!(bd->fEntryOpType&QMF_EX_SEPARATOR))
- EnableWindow(GetDlgItem(hdlg,IDC_INQMENU),FALSE);
- SetWindowText(GetDlgItem(hdlg,IDC_MENUVALUE),_T(""));
+ bd = ( ButtonData* )tvi.lParam;
+ if (bd) {
+ if (!TreeView_GetChild(hMenuTree, tvi.hItem)&&!(bd->fEntryOpType&QMF_EX_SEPARATOR))
+ {
+ EnableWindow(GetDlgItem(hdlg,IDC_MENUVALUE),TRUE);
+ EnableWindow(GetDlgItem(hdlg,IDC_ISSERVNAME),TRUE);
+ EnableWindow(GetDlgItem(hdlg,IDC_INQMENU),TRUE);
+ SetWindowText(GetDlgItem(hdlg,IDC_MENUVALUE),bd->pszOpValue/*?bd->pszOpValue:bd->pszValue*/);
+ }
+ else
+ {
+ EnableWindow(GetDlgItem(hdlg,IDC_MENUVALUE),FALSE);
+ EnableWindow(GetDlgItem(hdlg,IDC_ISSERVNAME),FALSE);
+ if (!(bd->fEntryOpType&QMF_EX_SEPARATOR))
+ EnableWindow(GetDlgItem(hdlg,IDC_INQMENU),FALSE);
+ SetWindowText(GetDlgItem(hdlg,IDC_MENUVALUE),_T(""));
+ }
+ CheckDlgButton(hdlg,IDC_INQMENU,bd->bOpInQMenu);
+ CheckDlgButton(hdlg,IDC_ISSERVNAME,bd->bIsOpServName);
}
- CheckDlgButton(hdlg,IDC_INQMENU,bd->bOpInQMenu);
- CheckDlgButton(hdlg,IDC_ISSERVNAME,bd->bIsOpServName);
}
- }
- }break;
+ }break;
case IDC_BUTTONSLIST:
switch (((LPNMHDR)lparam)->code) {
+ case TVN_KEYDOWN:{
+ TV_KEYDOWN* pTVKeyDown = (TV_KEYDOWN*) ((LPNMHDR)lparam);
+ if ( pTVKeyDown->wVKey == VK_F2 )
+ TreeView_EditLabel(hButtonsList,TreeView_GetSelection(hButtonsList));
+ else if ( pTVKeyDown->wVKey == VK_DELETE )
+ SendMessage(hdlg,WM_COMMAND,IDC_BLISTREMOVE,0);
+ }break;
+
+ case TVN_BEGINLABELEDITA:
+ case TVN_BEGINLABELEDITW:
+ hwndEdit = TreeView_GetEditControl(hButtonsList);
+ mir_subclassWindow(hwndEdit, LabelEditSubclassProc);
+ break;
- case TVN_KEYDOWN:{
- TV_KEYDOWN* pTVKeyDown = (TV_KEYDOWN*) ((LPNMHDR)lparam);
- if ( pTVKeyDown->wVKey == VK_F2 )
- TreeView_EditLabel(hButtonsList,TreeView_GetSelection(hButtonsList));
- else if ( pTVKeyDown->wVKey == VK_DELETE )
- SendMessage(hdlg,WM_COMMAND,IDC_BLISTREMOVE,0);
- }break;
-
- case TVN_BEGINLABELEDITA:
- case TVN_BEGINLABELEDITW:
- hwndEdit=TreeView_GetEditControl(hButtonsList);
- oldEditProc = (WNDPROC) SetWindowLongPtr(hwndEdit, GWLP_WNDPROC, (LONG) LabelEditSubclassProc);
- break;
-
- case TVN_ENDLABELEDITA:
- case TVN_ENDLABELEDITW:{
- TVITEM tvi;
- TCHAR strbuf[128];
- TCHAR szLabel[128];
-
- SetWindowLongPtr(hwndEdit, GWLP_WNDPROC, (LONG) oldEditProc);
+ case TVN_ENDLABELEDITA:
+ case TVN_ENDLABELEDITW:
+ {
+ TVITEM tvi;
+ TCHAR strbuf[128];
+ TCHAR szLabel[128];
- tvi.pszText = strbuf;
- tvi.cchTextMax = sizeof(strbuf);
- tvi.mask=TVIF_TEXT |TVIF_HANDLE|TVIF_PARAM;
- tvi.hItem=TreeView_GetSelection(hButtonsList);
- TreeView_GetItem(hButtonsList,&tvi);
+ tvi.pszText = strbuf;
+ tvi.cchTextMax = sizeof(strbuf);
+ tvi.mask=TVIF_TEXT |TVIF_HANDLE|TVIF_PARAM;
+ tvi.hItem=TreeView_GetSelection(hButtonsList);
+ TreeView_GetItem(hButtonsList,&tvi);
- GetWindowText(hwndEdit, szLabel, sizeof(szLabel));
- hwndEdit=NULL;
- if (!_tcslen(szLabel)) break;
+ GetWindowText(hwndEdit, szLabel, sizeof(szLabel));
+ hwndEdit=NULL;
+ if (!_tcslen(szLabel)) break;
- tvi.pszText=szLabel;
- ((ListData*)tvi.lParam)->dwOPFlags|=QMF_RENAMED;
+ tvi.pszText=szLabel;
+ ((ListData*)tvi.lParam)->dwOPFlags|=QMF_RENAMED;
- TreeView_SetItem(hButtonsList, &tvi);
- SendMessage(GetParent(hdlg),PSM_CHANGED,0,0);
- }break;
+ TreeView_SetItem(hButtonsList, &tvi);
+ SendMessage(GetParent(hdlg),PSM_CHANGED,0,0);
+ }break;
- case TVN_SELCHANGINGA:
- case TVN_SELCHANGINGW:
- SetMenuEntryProperties(hdlg);
- break;
+ case TVN_SELCHANGINGA:
+ case TVN_SELCHANGINGW:
+ SetMenuEntryProperties(hdlg);
+ break;
- case TVN_SELCHANGEDA:
- case TVN_SELCHANGEDW:{
- TVITEM tvi;
- HTREEITEM hti;
+ case TVN_SELCHANGEDA:
+ case TVN_SELCHANGEDW:
+ {
+ TVITEM tvi;
+ HTREEITEM hti;
- hti=TreeView_GetSelection(hButtonsList);
+ hti=TreeView_GetSelection(hButtonsList);
- if(hti==NULL||!TreeView_GetCount(hButtonsList)) {
- EnableWindow(GetDlgItem(hdlg,IDC_MENUVALUE),FALSE);
- EnableWindow(GetDlgItem(hdlg,IDC_ISSERVNAME),FALSE);
- EnableWindow(GetDlgItem(hdlg,IDC_INQMENU),FALSE);
- EnableWindow(GetDlgItem(hdlg,IDC_ISSERVNAME2),FALSE);
- SetWindowText(GetDlgItem(hdlg,IDC_MENUVALUE),_T(""));
- break;
- }
-
- tvi.mask=TVIF_HANDLE|TVIF_PARAM;
- tvi.hItem=hti;
- TreeView_GetItem(hButtonsList,&tvi);
+ if(hti==NULL||!TreeView_GetCount(hButtonsList)) {
+ EnableWindow(GetDlgItem(hdlg,IDC_MENUVALUE),FALSE);
+ EnableWindow(GetDlgItem(hdlg,IDC_ISSERVNAME),FALSE);
+ EnableWindow(GetDlgItem(hdlg,IDC_INQMENU),FALSE);
+ EnableWindow(GetDlgItem(hdlg,IDC_ISSERVNAME2),FALSE);
+ SetWindowText(GetDlgItem(hdlg,IDC_MENUVALUE),_T(""));
+ break;
+ }
- if(tvi.lParam==0) break;
+ tvi.mask=TVIF_HANDLE|TVIF_PARAM;
+ tvi.hItem=hti;
+ TreeView_GetItem(hButtonsList,&tvi);
- BuildMenuTree(hMenuTree,(SortedList *)((ListData*)tvi.lParam)->sl);
+ if(tvi.lParam==0) break;
- SetWindowText(GetDlgItem(hdlg,IDC_MENUVALUE),_T(""));
- EnableWindow(GetDlgItem(hdlg,IDC_RCLICKVALUE),TRUE);
- EnableWindow(GetDlgItem(hdlg,IDC_ISSERVNAME2),TRUE);
- CheckDlgButton(hdlg,IDC_ISSERVNAME2,((ListData*)tvi.lParam)->bIsOpServName);
+ BuildMenuTree(hMenuTree,(SortedList *)((ListData*)tvi.lParam)->sl);
- if (((ListData*)tvi.lParam)->ptszOPQValue)
- SetWindowText(GetDlgItem(hdlg,IDC_RCLICKVALUE),((ListData*)tvi.lParam)->ptszOPQValue);
- else
- SetWindowText(GetDlgItem(hdlg,IDC_RCLICKVALUE),_T(""));
+ SetWindowText(GetDlgItem(hdlg,IDC_MENUVALUE),_T(""));
+ EnableWindow(GetDlgItem(hdlg,IDC_RCLICKVALUE),TRUE);
+ EnableWindow(GetDlgItem(hdlg,IDC_ISSERVNAME2),TRUE);
+ CheckDlgButton(hdlg,IDC_ISSERVNAME2,((ListData*)tvi.lParam)->bIsOpServName);
- }break;
+ if (((ListData*)tvi.lParam)->ptszOPQValue)
+ SetWindowText(GetDlgItem(hdlg,IDC_RCLICKVALUE),((ListData*)tvi.lParam)->ptszOPQValue);
+ else
+ SetWindowText(GetDlgItem(hdlg,IDC_RCLICKVALUE),_T(""));
}break;
- }
}break;
+ }
+ break;
- case WM_COMMAND:{
+ case WM_COMMAND:
switch(LOWORD(wparam)) {
- case IDC_VARHELP:{
+ case IDC_VARHELP:
if (!g_varhelpDlg)
g_varhelpDlg=CreateDialog(hinstance,MAKEINTRESOURCE(IDD_HELPDIALOG), 0, HelpDlgProc);
else
//ShowWindow(g_varhelpDlg,SW_SHOWDEFAULT);
SetWindowPos(g_varhelpDlg,0,0,0,0,0,SWP_SHOWWINDOW|SWP_NOMOVE|SWP_NOSIZE);
- }break;
- case IDC_BLISTADD:{
- TVINSERTSTRUCT tvis;
- ListData* ld=NULL;
- TCHAR namebuff[MAX_PATH]={'\0'};
- int count=TreeView_GetCount(hButtonsList);
- if (count>10) break;
- if(g_iOPButtonsCount==99){
- MessageBox(NULL, TranslateT("Congratulation!\r\nYou have clicked this button 100 times!\r\nThere was access violation at this point...\r\nAnd now function for freeing resources must be called...\r\nBut no! there's only break :D"), TranslateT("You win!"),MB_OK);
- break;
+ break;
+ case IDC_BLISTADD:
+ {
+ TVINSERTSTRUCT tvis;
+ ListData* ld=NULL;
+ TCHAR namebuff[MAX_PATH]={'\0'};
+ int count=TreeView_GetCount(hButtonsList);
+ if (count>10) break;
+ if(g_iOPButtonsCount==99){
+ MessageBox(NULL, TranslateT("Congratulation!\r\nYou have clicked this button 100 times!\r\nThere was access violation at this point...\r\nAnd now function for freeing resources must be called...\r\nBut no! there's only break :D"), TranslateT("You win!"),MB_OK);
+ break;
}
- ld = (ListData *)mir_alloc(sizeof(ListData));
- ButtonsList[g_iOPButtonsCount++]=ld;
+ ld = (ListData *)mir_alloc(sizeof(ListData));
+ ButtonsList[g_iOPButtonsCount++]=ld;
- ld->sl=List_Create(0,1);
- ld->dwOPFlags=QMF_NEW;
- ld->bIsOpServName=0;
- ld->ptszButtonName=NULL;
- ld->ptszOPQValue=NULL;
- ld->ptszQValue=NULL;
- tvis.hParent = NULL;
- tvis.hInsertAfter = TVI_LAST;
-
- GetWindowText(GetDlgItem(hdlg,IDC_BUTTONNAME),namebuff,MAX_PATH);
+ ld->sl=List_Create(0,1);
+ ld->dwOPFlags=QMF_NEW;
+ ld->bIsOpServName=0;
+ ld->ptszButtonName=NULL;
+ ld->ptszOPQValue=NULL;
+ ld->ptszQValue=NULL;
+ tvis.hParent = NULL;
+ tvis.hInsertAfter = TVI_LAST;
- tvis.item.mask=TVIF_PARAM|TVIF_TEXT;
- tvis.item.pszText=(_tcslen(namebuff))?namebuff:TranslateT("New Button");
- tvis.item.lParam=(LPARAM)ld;
- TreeView_SelectItem(hButtonsList,TreeView_InsertItem(hButtonsList,&tvis));
+ GetWindowText(GetDlgItem(hdlg,IDC_BUTTONNAME),namebuff,MAX_PATH);
+ tvis.item.mask=TVIF_PARAM|TVIF_TEXT;
+ tvis.item.pszText=(_tcslen(namebuff))?namebuff:TranslateT("New Button");
+ tvis.item.lParam=(LPARAM)ld;
+ TreeView_SelectItem(hButtonsList,TreeView_InsertItem(hButtonsList,&tvis));
}break;
- case IDC_BLISTREMOVE:{
- TVITEM tvi;
- ListData* ld;
+ case IDC_BLISTREMOVE:
+ {
+ TVITEM tvi;
+ ListData* ld;
- if (!(tvi.hItem=TreeView_GetSelection(hButtonsList)))
- break;
+ if (!(tvi.hItem=TreeView_GetSelection(hButtonsList)))
+ break;
- tvi.mask=TVIF_HANDLE|TVIF_PARAM;
- TreeView_GetItem(hButtonsList,&tvi);
+ tvi.mask=TVIF_HANDLE|TVIF_PARAM;
+ TreeView_GetItem(hButtonsList,&tvi);
- ld= (ListData*)tvi.lParam;
+ ld= (ListData*)tvi.lParam;
- ld->dwOPFlags|=QMF_DELETNEEDED;
+ ld->dwOPFlags|=QMF_DELETNEEDED;
- TreeView_DeleteItem(hButtonsList,tvi.hItem);
- if (!TreeView_GetCount(hButtonsList))
- {
- TreeView_DeleteAllItems(hMenuTree);
- EnableWindow(GetDlgItem(hdlg,IDC_MENUVALUE),FALSE);
- EnableWindow(GetDlgItem(hdlg,IDC_RCLICKVALUE),FALSE);
- EnableWindow(GetDlgItem(hdlg,IDC_ISSERVNAME),FALSE);
- EnableWindow(GetDlgItem(hdlg,IDC_INQMENU),FALSE);
- EnableWindow(GetDlgItem(hdlg,IDC_ISSERVNAME2),FALSE);
- SetWindowText(GetDlgItem(hdlg,IDC_MENUVALUE),_T(""));
- SetWindowText(GetDlgItem(hdlg,IDC_RCLICKVALUE),_T(""));
+ TreeView_DeleteItem(hButtonsList,tvi.hItem);
+ if (!TreeView_GetCount(hButtonsList)) {
+ TreeView_DeleteAllItems(hMenuTree);
+ EnableWindow(GetDlgItem(hdlg,IDC_MENUVALUE),FALSE);
+ EnableWindow(GetDlgItem(hdlg,IDC_RCLICKVALUE),FALSE);
+ EnableWindow(GetDlgItem(hdlg,IDC_ISSERVNAME),FALSE);
+ EnableWindow(GetDlgItem(hdlg,IDC_INQMENU),FALSE);
+ EnableWindow(GetDlgItem(hdlg,IDC_ISSERVNAME2),FALSE);
+ SetWindowText(GetDlgItem(hdlg,IDC_MENUVALUE),_T(""));
+ SetWindowText(GetDlgItem(hdlg,IDC_RCLICKVALUE),_T(""));
}
}break;
- case IDC_MTREEADD:{
- TVINSERTSTRUCT tvis;
- TVITEM tvi;
- ButtonData *bd=NULL;
- SortedList *sl=NULL;
- TCHAR namebuff[MAX_PATH]={'\0'};
-
- if (!TreeView_GetCount(hButtonsList)) break;
- if (!(tvi.hItem=TreeView_GetSelection(hButtonsList))) break;
-
- bd = (ButtonData *)mir_alloc(sizeof(ButtonData));
- memset(bd,0,sizeof(ButtonData));
+ case IDC_MTREEADD:
+ {
+ TVINSERTSTRUCT tvis;
+ TVITEM tvi;
+ ButtonData *bd=NULL;
+ SortedList *sl=NULL;
+ TCHAR namebuff[MAX_PATH]={'\0'};
- GetWindowText(GetDlgItem(hdlg,IDC_MENUNAME),namebuff,MAX_PATH);
+ if (!TreeView_GetCount(hButtonsList)) break;
+ if (!(tvi.hItem=TreeView_GetSelection(hButtonsList))) break;
- bd->dwOPPos=TreeView_GetCount(hMenuTree)-1;
- bd->pszOpName=_tcslen(namebuff)?mir_tstrdup(namebuff):mir_tstrdup(TranslateT("New Menu Entry"));
- bd->pszOpValue=mir_tstrdup(bd->pszOpName);
- bd->fEntryOpType=!_tcscmp(namebuff,_T("---"))?QMF_EX_SEPARATOR:0;
- bd->dwOPFlags=QMF_NEW;
- bd->pszName=NULL;
- bd->pszValue=NULL;
+ bd = (ButtonData *)mir_alloc(sizeof(ButtonData));
+ memset(bd,0,sizeof(ButtonData));
+ GetWindowText(GetDlgItem(hdlg,IDC_MENUNAME),namebuff,MAX_PATH);
- tvi.mask=TVIF_HANDLE|TVIF_PARAM;
-
- TreeView_GetItem(hButtonsList,&tvi);
+ bd->dwOPPos=TreeView_GetCount(hMenuTree)-1;
+ bd->pszOpName=_tcslen(namebuff)?mir_tstrdup(namebuff):mir_tstrdup(TranslateT("New Menu Entry"));
+ bd->pszOpValue=mir_tstrdup(bd->pszOpName);
+ bd->fEntryOpType=!_tcscmp(namebuff,_T("---"))?QMF_EX_SEPARATOR:0;
+ bd->dwOPFlags=QMF_NEW;
+ bd->pszName=NULL;
+ bd->pszValue=NULL;
- sl=((ListData*)tvi.lParam)->sl;
- List_InsertPtr(sl,bd);
+ tvi.mask=TVIF_HANDLE|TVIF_PARAM;
- tvis.hParent = NULL;
- tvis.hInsertAfter = TVI_LAST;
- tvis.item.mask=TVIF_PARAM|TVIF_TEXT;
- tvis.item.pszText=bd->pszOpName;
- tvis.item.lParam=(LPARAM)bd;
- TreeView_SelectItem(hMenuTree,TreeView_InsertItem(hMenuTree,&tvis));
- }break;
+ TreeView_GetItem(hButtonsList,&tvi);
- case IDC_MTREEREMOVE:{
- TVITEM tvi;
- TVINSERTSTRUCT tvis;
- HTREEITEM hti=NULL;
- ButtonData *bd=NULL;
- tvi.mask=TVIF_HANDLE|TVIF_PARAM;
- if (!(tvi.hItem=TreeView_GetSelection(hMenuTree)))
- break;
- TreeView_GetItem(hMenuTree,&tvi);
- hti=tvi.hItem;
+ sl=((ListData*)tvi.lParam)->sl;
- bd= (ButtonData*)tvi.lParam;
- bd->dwOPFlags|=QMF_DELETNEEDED;
+ List_InsertPtr(sl,bd);
- if(tvi.hItem=TreeView_GetChild(hMenuTree,tvi.hItem)) {
- TCHAR strbuf[128];
- while(tvi.hItem){
- tvis.hInsertAfter=hti;
- tvi.pszText = strbuf;
- tvi.cchTextMax = sizeof(strbuf);
- tvi.mask=TVIF_HANDLE|TVIF_PARAM|TVIF_TEXT;
+ tvis.hParent = NULL;
+ tvis.hInsertAfter = TVI_LAST;
+ tvis.item.mask=TVIF_PARAM|TVIF_TEXT;
+ tvis.item.pszText=bd->pszOpName;
+ tvis.item.lParam=(LPARAM)bd;
+ TreeView_SelectItem(hMenuTree,TreeView_InsertItem(hMenuTree,&tvis));
+ }break;
- TreeView_GetItem(hMenuTree,&tvi);
- tvis.hParent=NULL;
- tvis.item=tvi;
- TreeView_InsertItem(hMenuTree,&tvis);
- tvi.hItem=TreeView_GetNextSibling(hMenuTree,tvi.hItem);
+ case IDC_MTREEREMOVE:
+ {
+ TVITEM tvi;
+ TVINSERTSTRUCT tvis;
+ HTREEITEM hti=NULL;
+ ButtonData *bd=NULL;
+ tvi.mask=TVIF_HANDLE|TVIF_PARAM;
+ if (!(tvi.hItem=TreeView_GetSelection(hMenuTree)))
+ break;
+ TreeView_GetItem(hMenuTree,&tvi);
+ hti=tvi.hItem;
+
+ bd= (ButtonData*)tvi.lParam;
+ bd->dwOPFlags|=QMF_DELETNEEDED;
+
+ if(tvi.hItem=TreeView_GetChild(hMenuTree,tvi.hItem)) {
+ TCHAR strbuf[128];
+ while(tvi.hItem){
+ tvis.hInsertAfter=hti;
+ tvi.pszText = strbuf;
+ tvi.cchTextMax = sizeof(strbuf);
+ tvi.mask=TVIF_HANDLE|TVIF_PARAM|TVIF_TEXT;
+
+ TreeView_GetItem(hMenuTree,&tvi);
+ tvis.hParent=NULL;
+ tvis.item=tvi;
+ TreeView_InsertItem(hMenuTree,&tvis);
+ tvi.hItem=TreeView_GetNextSibling(hMenuTree,tvi.hItem);
}
}
- TreeView_DeleteItem(hMenuTree,hti);
- if (!TreeView_GetCount(hMenuTree)) {
- EnableWindow(GetDlgItem(hdlg,IDC_MENUVALUE),FALSE);
- EnableWindow(GetDlgItem(hdlg,IDC_ISSERVNAME),FALSE);
- EnableWindow(GetDlgItem(hdlg,IDC_INQMENU),FALSE);
- SetWindowText(GetDlgItem(hdlg,IDC_MENUVALUE),_T(""));
- }
-
- }break;
-
+ TreeView_DeleteItem(hMenuTree,hti);
+ if (!TreeView_GetCount(hMenuTree)) {
+ EnableWindow(GetDlgItem(hdlg,IDC_MENUVALUE),FALSE);
+ EnableWindow(GetDlgItem(hdlg,IDC_ISSERVNAME),FALSE);
+ EnableWindow(GetDlgItem(hdlg,IDC_INQMENU),FALSE);
+ SetWindowText(GetDlgItem(hdlg,IDC_MENUVALUE),_T(""));
}
}break;
-
- case WM_NCDESTROY:
- if(oldBNameProc) SetWindowLongPtr(GetDlgItem(hdlg,IDC_BUTTONNAME), GWLP_WNDPROC, (LONG) oldBNameProc);
- if(oldMNameProc) SetWindowLongPtr(GetDlgItem(hdlg,IDC_MENUNAME) , GWLP_WNDPROC, (LONG) oldMNameProc);
- break;
-
- case WM_CLOSE:
- EndDialog(hdlg,0);
- return 0;
}
- if (HIWORD(wparam)==BN_CLICKED && GetFocus()==(HWND)lparam)
- SendMessage(GetParent(hdlg),PSM_CHANGED,0,0);
- else if ((HIWORD(wparam) == EN_CHANGE)&&(GetFocus()==(HWND)lparam))
- if (!bOptionsInit) SendMessage(GetParent(hdlg),PSM_CHANGED,0,0);
+ break;
- return 0;
+ case WM_CLOSE:
+ EndDialog(hdlg,0);
+ return 0;
}
+ if (HIWORD(wparam)==BN_CLICKED && GetFocus()==(HWND)lparam)
+ SendMessage(GetParent(hdlg),PSM_CHANGED,0,0);
+ else if ((HIWORD(wparam) == EN_CHANGE)&&(GetFocus()==(HWND)lparam))
+ if (!bOptionsInit) SendMessage(GetParent(hdlg),PSM_CHANGED,0,0);
+
+ return 0;
+}
int OptionsInit(WPARAM wparam,LPARAM lparam)
{
- OPTIONSDIALOGPAGE odp={0};
- odp.cbSize = sizeof(odp);
+ OPTIONSDIALOGPAGE odp = { sizeof(odp) };
odp.position = 940000000;
odp.hInstance = hinstance;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS);