diff options
Diffstat (limited to 'src/modules/clist/genmenuopt.cpp')
-rw-r--r-- | src/modules/clist/genmenuopt.cpp | 284 |
1 files changed, 142 insertions, 142 deletions
diff --git a/src/modules/clist/genmenuopt.cpp b/src/modules/clist/genmenuopt.cpp index ed58a53145..e16fd49d18 100644 --- a/src/modules/clist/genmenuopt.cpp +++ b/src/modules/clist/genmenuopt.cpp @@ -28,7 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. extern bool bIconsDisabled;
extern int DefaultImageListColorDepth;
long handleCustomDraw(HWND hWndTreeView, LPNMTVCUSTOMDRAW pNMTVCD);
-void RebuildProtoMenus( int );
+void RebuildProtoMenus(int);
struct OrderData
{
@@ -57,7 +57,7 @@ static BOOL GetCurrentMenuObjectID(HWND hwndDlg, int* result) TVITEM tvi;
HWND hTree = GetDlgItem(hwndDlg, IDC_MENUOBJECTS);
HTREEITEM hti = TreeView_GetSelection(hTree);
- if ( hti == NULL )
+ if (hti == NULL)
return FALSE;
tvi.mask = TVIF_HANDLE | TVIF_PARAM;
@@ -77,51 +77,51 @@ static int SaveTree(HWND hwndDlg) int MenuObjectId, runtimepos;
TIntMenuObject* pimo;
MenuItemOptData* iod;
- HWND hTree = GetDlgItem( hwndDlg, IDC_MENUITEMS );
+ HWND hTree = GetDlgItem(hwndDlg, IDC_MENUITEMS);
- if ( !GetCurrentMenuObjectID( hwndDlg, &MenuObjectId ))
+ if ( !GetCurrentMenuObjectID(hwndDlg, &MenuObjectId))
return 0;
- tvi.hItem = TreeView_GetRoot( hTree );
+ tvi.hItem = TreeView_GetRoot(hTree);
tvi.cchTextMax = 99;
tvi.mask = TVIF_TEXT | TVIF_PARAM | TVIF_HANDLE;
tvi.pszText = idstr;
count = 0;
- menupos = GetMenuObjbyId( MenuObjectId );
- if ( menupos == -1 )
+ menupos = GetMenuObjbyId(MenuObjectId);
+ if (menupos == -1)
return -1;
pimo = g_menus[menupos];
- mir_snprintf( MenuNameItems, sizeof(MenuNameItems), "%s_Items", pimo->Name);
+ mir_snprintf(MenuNameItems, sizeof(MenuNameItems), "%s_Items", pimo->Name);
runtimepos = 100;
- while ( tvi.hItem != NULL ) {
- TreeView_GetItem( hTree, &tvi );
- iod = ( MenuItemOptData* )tvi.lParam;
- if ( iod->pimi ) {
- GetMenuItemName( iod->pimi, menuItemName, sizeof( menuItemName ));
+ while (tvi.hItem != NULL) {
+ TreeView_GetItem(hTree, &tvi);
+ iod = (MenuItemOptData*)tvi.lParam;
+ if (iod->pimi) {
+ GetMenuItemName(iod->pimi, menuItemName, sizeof(menuItemName));
- mir_snprintf( DBString, SIZEOF(DBString), "%s_visible", menuItemName );
- DBWriteContactSettingByte( NULL, MenuNameItems, DBString, iod->show );
+ mir_snprintf(DBString, SIZEOF(DBString), "%s_visible", menuItemName);
+ DBWriteContactSettingByte(NULL, MenuNameItems, DBString, iod->show);
- mir_snprintf( DBString, SIZEOF(DBString), "%s_pos", menuItemName );
- DBWriteContactSettingDword( NULL, MenuNameItems, DBString, runtimepos );
+ mir_snprintf(DBString, SIZEOF(DBString), "%s_pos", menuItemName);
+ DBWriteContactSettingDword(NULL, MenuNameItems, DBString, runtimepos);
- mir_snprintf( DBString, SIZEOF(DBString), "%s_name", menuItemName );
- if ( lstrcmp( iod->name, iod->defname ) != 0 )
- DBWriteContactSettingTString( NULL, MenuNameItems, DBString, iod->name );
+ mir_snprintf(DBString, SIZEOF(DBString), "%s_name", menuItemName);
+ if (lstrcmp(iod->name, iod->defname) != 0)
+ DBWriteContactSettingTString(NULL, MenuNameItems, DBString, iod->name);
else
- DBDeleteContactSetting( NULL, MenuNameItems, DBString );
+ DBDeleteContactSetting(NULL, MenuNameItems, DBString);
runtimepos += 100;
}
- if ( iod->name && !_tcscmp( iod->name, STR_SEPARATOR) && iod->show )
+ if (iod->name && !_tcscmp(iod->name, STR_SEPARATOR) && iod->show)
runtimepos += SEPARATORPOSITIONINTERVAL;
- tvi.hItem = TreeView_GetNextSibling( hTree, tvi.hItem );
+ tvi.hItem = TreeView_GetNextSibling(hTree, tvi.hItem);
count++;
}
return 1;
@@ -136,19 +136,19 @@ static int BuildMenuObjectsTree(HWND hwndDlg) tvis.hParent = NULL;
tvis.hInsertAfter = TVI_LAST;
tvis.item.mask = TVIF_PARAM | TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
- TreeView_DeleteAllItems( hTree );
- if ( g_menus.getCount() == 0 )
+ TreeView_DeleteAllItems(hTree);
+ if (g_menus.getCount() == 0)
return FALSE;
- for ( i=0; i < g_menus.getCount(); i++ ) {
- if ( g_menus[i]->id == (int)hStatusMenuObject || !g_menus[i]->m_bUseUserDefinedItems )
+ for (i=0; i < g_menus.getCount(); i++) {
+ if (g_menus[i]->id == (int)hStatusMenuObject || !g_menus[i]->m_bUseUserDefinedItems)
continue;
- tvis.item.lParam = ( LPARAM )g_menus[i]->id;
- tvis.item.pszText = LangPackPcharToTchar( g_menus[i]->Name );
+ tvis.item.lParam = (LPARAM)g_menus[i]->id;
+ tvis.item.pszText = LangPackPcharToTchar(g_menus[i]->Name);
tvis.item.iImage = tvis.item.iSelectedImage = TRUE;
- TreeView_InsertItem( hTree, &tvis );
- mir_free( tvis.item.pszText );
+ TreeView_InsertItem(hTree, &tvis);
+ mir_free(tvis.item.pszText);
}
return 1;
}
@@ -173,21 +173,21 @@ static int InsertSeparator(HWND hwndDlg) TVINSERTSTRUCT tvis = {0};
TVITEM tvi = {0};
HTREEITEM hti = {0};
- HWND hMenuTree = GetDlgItem( hwndDlg, IDC_MENUITEMS );
+ HWND hMenuTree = GetDlgItem(hwndDlg, IDC_MENUITEMS);
- hti = TreeView_GetSelection( hMenuTree );
- if ( hti == NULL )
+ hti = TreeView_GetSelection(hMenuTree);
+ if (hti == NULL)
return 1;
tvi.mask = TVIF_HANDLE | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM | TVIF_TEXT;
tvi.hItem = hti;
- if ( TreeView_GetItem( hMenuTree, &tvi) == FALSE )
+ if (TreeView_GetItem(hMenuTree, &tvi) == FALSE)
return 1;
- PD = ( MenuItemOptData* )mir_alloc( sizeof( MenuItemOptData ));
- ZeroMemory( PD, sizeof( MenuItemOptData ));
+ PD = (MenuItemOptData*)mir_alloc(sizeof(MenuItemOptData));
+ ZeroMemory(PD, sizeof(MenuItemOptData));
PD->id = -1;
- PD->name = mir_tstrdup( STR_SEPARATOR );
+ PD->name = mir_tstrdup(STR_SEPARATOR);
PD->show = TRUE;
PD->pos = ((MenuItemOptData *)tvi.lParam)->pos-1;
@@ -197,23 +197,23 @@ static int InsertSeparator(HWND hwndDlg) tvis.hParent = NULL;
tvis.hInsertAfter = hti;
tvis.item.mask = TVIF_PARAM | TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
- TreeView_InsertItem( hMenuTree, &tvis );
+ TreeView_InsertItem(hMenuTree, &tvis);
return 1;
}
-static void FreeTreeData( HWND hwndDlg )
+static void FreeTreeData(HWND hwndDlg)
{
HTREEITEM hItem = TreeView_GetRoot(GetDlgItem(hwndDlg, IDC_MENUITEMS));
- while ( hItem != NULL ) {
+ while (hItem != NULL) {
TVITEM tvi;
tvi.mask = TVIF_HANDLE | TVIF_PARAM;
tvi.hItem = hItem;
- TreeView_GetItem( GetDlgItem( hwndDlg, IDC_MENUITEMS ), &tvi );
+ TreeView_GetItem(GetDlgItem(hwndDlg, IDC_MENUITEMS), &tvi);
{ MenuItemOptData* O = (MenuItemOptData *)tvi.lParam;
- if ( O->name ) mir_free( O->name );
- if ( O->defname ) mir_free( O->defname );
- if ( O->uniqname ) mir_free( O->uniqname );
- mir_free( O );
+ if (O->name) mir_free(O->name);
+ if (O->defname) mir_free(O->defname);
+ if (O->uniqname) mir_free(O->uniqname);
+ mir_free(O);
}
tvi.lParam = 0;
@@ -227,69 +227,69 @@ static int BuildTree(HWND hwndDlg, int MenuObjectId, BOOL bReread) char menuItemName[256], MenuNameItems[256];
char buf[256];
- FreeTreeData( hwndDlg );
+ FreeTreeData(hwndDlg);
TreeView_DeleteAllItems(GetDlgItem(hwndDlg, IDC_MENUITEMS));
- int menupos = GetMenuObjbyId( MenuObjectId );
- if ( menupos == -1 )
+ int menupos = GetMenuObjbyId(MenuObjectId);
+ if (menupos == -1)
return FALSE;
TIntMenuObject* pimo = g_menus[menupos];
- if ( pimo->m_items.first == NULL )
+ if (pimo->m_items.first == NULL)
return FALSE;
- mir_snprintf( MenuNameItems, sizeof(MenuNameItems), "%s_Items", pimo->Name );
+ mir_snprintf(MenuNameItems, sizeof(MenuNameItems), "%s_Items", pimo->Name);
int count = 0;
{
- for ( PMO_IntMenuItem p = pimo->m_items.first; p != NULL; p = p->next )
- if ( p->mi.root == ( HGENMENU )-1 || p->mi.root == NULL )
+ for (PMO_IntMenuItem p = pimo->m_items.first; p != NULL; p = p->next)
+ if (p->mi.root == (HGENMENU)-1 || p->mi.root == NULL)
count++;
}
- lpMenuItemOptData *PDar = ( lpMenuItemOptData* )mir_alloc( sizeof( lpMenuItemOptData )*count );
+ lpMenuItemOptData *PDar = (lpMenuItemOptData*)mir_alloc(sizeof(lpMenuItemOptData)*count);
count = 0;
{
- for ( PMO_IntMenuItem p = pimo->m_items.first; p != NULL; p = p->next ) {
- if ( p->mi.root != ( HGENMENU )-1 && p->mi.root != NULL )
+ for (PMO_IntMenuItem p = pimo->m_items.first; p != NULL; p = p->next) {
+ if (p->mi.root != (HGENMENU)-1 && p->mi.root != NULL)
continue;
- MenuItemOptData *PD = ( MenuItemOptData* )mir_calloc( sizeof( MenuItemOptData ));
- GetMenuItemName( p, menuItemName, sizeof( menuItemName ));
+ MenuItemOptData *PD = (MenuItemOptData*)mir_calloc(sizeof(MenuItemOptData));
+ GetMenuItemName(p, menuItemName, sizeof(menuItemName));
{
DBVARIANT dbv;
mir_snprintf(buf, SIZEOF(buf), "%s_name", menuItemName);
- if ( !DBGetContactSettingTString( NULL, MenuNameItems, buf, &dbv )) {
- PD->name = mir_tstrdup( dbv.ptszVal );
- DBFreeVariant( &dbv );
+ if ( !DBGetContactSettingTString(NULL, MenuNameItems, buf, &dbv)) {
+ PD->name = mir_tstrdup(dbv.ptszVal);
+ DBFreeVariant(&dbv);
}
- else PD->name = mir_tstrdup( GetMenuItemText(p));
+ else PD->name = mir_tstrdup(GetMenuItemText(p));
}
PD->pimi = p;
- PD->defname = mir_tstrdup( GetMenuItemText(p));
+ PD->defname = mir_tstrdup(GetMenuItemText(p));
- mir_snprintf( buf, SIZEOF(buf), "%s_visible", menuItemName );
- PD->show = DBGetContactSettingByte( NULL, MenuNameItems, buf, 1 );
+ mir_snprintf(buf, SIZEOF(buf), "%s_visible", menuItemName);
+ PD->show = DBGetContactSettingByte(NULL, MenuNameItems, buf, 1);
- if ( bReread ) {
- mir_snprintf( buf, SIZEOF(buf), "%s_pos", menuItemName );
- PD->pos = DBGetContactSettingDword( NULL, MenuNameItems, buf, 1 );
+ if (bReread) {
+ mir_snprintf(buf, SIZEOF(buf), "%s_pos", menuItemName);
+ PD->pos = DBGetContactSettingDword(NULL, MenuNameItems, buf, 1);
}
- else PD->pos = ( PD->pimi ) ? PD->pimi->originalPosition : 0;
+ else PD->pos = (PD->pimi) ? PD->pimi->originalPosition : 0;
PD->id = p->iCommand;
- if ( p->UniqName )
- PD->uniqname = mir_strdup( p->UniqName );
+ if (p->UniqName)
+ PD->uniqname = mir_strdup(p->UniqName);
PDar[ count ] = PD;
count++;
} }
- qsort( PDar, count, sizeof( lpMenuItemOptData ), sortfunc );
+ qsort(PDar, count, sizeof(lpMenuItemOptData), sortfunc);
SendDlgItemMessage(hwndDlg, IDC_MENUITEMS, WM_SETREDRAW, FALSE, 0);
int lastpos = 0;
@@ -299,26 +299,26 @@ static int BuildTree(HWND hwndDlg, int MenuObjectId, BOOL bReread) tvis.hParent = NULL;
tvis.hInsertAfter = TVI_LAST;
tvis.item.mask = TVIF_PARAM | TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
- for ( int i=0; i < count; i++ ) {
- if ( PDar[i]->pos - lastpos >= SEPARATORPOSITIONINTERVAL ) {
- MenuItemOptData *PD = ( MenuItemOptData* )mir_calloc( sizeof( MenuItemOptData ));
+ for (int i=0; i < count; i++) {
+ if (PDar[i]->pos - lastpos >= SEPARATORPOSITIONINTERVAL) {
+ MenuItemOptData *PD = (MenuItemOptData*)mir_calloc(sizeof(MenuItemOptData));
PD->id = -1;
- PD->name = mir_tstrdup( STR_SEPARATOR );
+ PD->name = mir_tstrdup(STR_SEPARATOR);
PD->pos = PDar[i]->pos - 1;
PD->show = TRUE;
- tvis.item.lParam = ( LPARAM )PD;
+ tvis.item.lParam = (LPARAM)PD;
tvis.item.pszText = PD->name;
tvis.item.iImage = tvis.item.iSelectedImage = PD->show;
SendDlgItemMessage(hwndDlg, IDC_MENUITEMS, TVM_INSERTITEM, 0, (LPARAM)&tvis);
}
- tvis.item.lParam = ( LPARAM )PDar[i];
+ tvis.item.lParam = (LPARAM)PDar[i];
tvis.item.pszText = PDar[i]->name;
tvis.item.iImage = tvis.item.iSelectedImage = PDar[i]->show;
HTREEITEM hti = (HTREEITEM)SendDlgItemMessage(hwndDlg, IDC_MENUITEMS, TVM_INSERTITEM, 0, (LPARAM)&tvis);
- if ( first ) {
+ if (first) {
TreeView_SelectItem(GetDlgItem(hwndDlg, IDC_MENUITEMS), hti);
first=FALSE;
}
@@ -326,26 +326,26 @@ static int BuildTree(HWND hwndDlg, int MenuObjectId, BOOL bReread) lastpos = PDar[i]->pos;
}
- SendDlgItemMessage( hwndDlg, IDC_MENUITEMS, WM_SETREDRAW, TRUE, 0 );
- mir_free( PDar );
- ShowWindow( GetDlgItem( hwndDlg, IDC_NOTSUPPORTWARNING ), ( pimo->m_bUseUserDefinedItems ) ? SW_HIDE : SW_SHOW );
- EnableWindow( GetDlgItem( hwndDlg, IDC_MENUITEMS ), pimo->m_bUseUserDefinedItems );
- EnableWindow( GetDlgItem( hwndDlg, IDC_INSERTSEPARATOR ), pimo->m_bUseUserDefinedItems );
+ SendDlgItemMessage(hwndDlg, IDC_MENUITEMS, WM_SETREDRAW, TRUE, 0);
+ mir_free(PDar);
+ ShowWindow(GetDlgItem(hwndDlg, IDC_NOTSUPPORTWARNING), (pimo->m_bUseUserDefinedItems) ? SW_HIDE : SW_SHOW);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_MENUITEMS), pimo->m_bUseUserDefinedItems);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_INSERTSEPARATOR), pimo->m_bUseUserDefinedItems);
return 1;
}
-static void RebuildCurrent( HWND hwndDlg )
+static void RebuildCurrent(HWND hwndDlg)
{
int MenuObjectID;
- if ( GetCurrentMenuObjectID( hwndDlg, &MenuObjectID ))
- BuildTree( hwndDlg, MenuObjectID, TRUE );
+ if (GetCurrentMenuObjectID(hwndDlg, &MenuObjectID))
+ BuildTree(hwndDlg, MenuObjectID, TRUE);
}
-static void ResetMenuItems( HWND hwndDlg )
+static void ResetMenuItems(HWND hwndDlg)
{
int MenuObjectID;
- if ( GetCurrentMenuObjectID( hwndDlg, &MenuObjectID ))
- BuildTree( hwndDlg, MenuObjectID, FALSE );
+ if (GetCurrentMenuObjectID(hwndDlg, &MenuObjectID))
+ BuildTree(hwndDlg, MenuObjectID, FALSE);
}
static HTREEITEM MoveItemAbove(HWND hTreeWnd, HTREEITEM hItem, HTREEITEM hInsertAfter)
@@ -353,23 +353,23 @@ static HTREEITEM MoveItemAbove(HWND hTreeWnd, HTREEITEM hItem, HTREEITEM hInsert TVITEM tvi = { 0 };
tvi.mask = TVIF_HANDLE | TVIF_PARAM;
tvi.hItem = hItem;
- if ( !SendMessage(hTreeWnd, TVM_GETITEM, 0, ( LPARAM )&tvi ))
+ if ( !SendMessage(hTreeWnd, TVM_GETITEM, 0, (LPARAM)&tvi))
return NULL;
- if ( hItem && hInsertAfter ) {
+ if (hItem && hInsertAfter) {
TVINSERTSTRUCT tvis;
TCHAR name[128];
- if ( hItem == hInsertAfter )
+ if (hItem == hInsertAfter)
return hItem;
tvis.item.mask = TVIF_HANDLE | TVIF_PARAM | TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
tvis.item.stateMask = 0xFFFFFFFF;
tvis.item.pszText = name;
- tvis.item.cchTextMax = sizeof( name );
+ tvis.item.cchTextMax = sizeof(name);
tvis.item.hItem = hItem;
- tvis.item.iImage = tvis.item.iSelectedImage = (( MenuItemOptData* )tvi.lParam)->show;
- if (!SendMessage(hTreeWnd, TVM_GETITEM, 0, (LPARAM)&tvis.item))
+ tvis.item.iImage = tvis.item.iSelectedImage = ((MenuItemOptData*)tvi.lParam)->show;
+ if ( !SendMessage(hTreeWnd, TVM_GETITEM, 0, (LPARAM)&tvis.item))
return NULL;
- if (!TreeView_DeleteItem(hTreeWnd, hItem))
+ if ( !TreeView_DeleteItem(hTreeWnd, hItem))
return NULL;
tvis.hParent=NULL;
tvis.hInsertAfter=hInsertAfter;
@@ -396,9 +396,9 @@ LRESULT CALLBACK LBTNDOWNProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam HWND tvw=hwnd;
tvi.mask=TVIF_HANDLE|TVIF_PARAM;
tvi.hItem=hti.hItem;
- TreeView_GetItem( tvw, &tvi );
+ TreeView_GetItem(tvw, &tvi);
- if (!((MenuItemOptData *)tvi.lParam)->isSelected) { /* is not Selected*/
+ if ( !((MenuItemOptData *)tvi.lParam)->isSelected) { /* is not Selected*/
// reset all selection except current
HTREEITEM hit;
hit=TreeView_GetRoot(tvw);
@@ -432,7 +432,7 @@ static INT_PTR CALLBACK GenMenuOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA dat=(struct OrderData*)mir_alloc(sizeof(struct OrderData));
SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_MENUITEMS), GWLP_USERDATA, (LONG_PTR)dat);
dat->dragging = 0;
- dat->iInitMenuValue = DBGetContactSettingByte( NULL, "CList", "MoveProtoMenus", TRUE );
+ dat->iInitMenuValue = DBGetContactSettingByte(NULL, "CList", "MoveProtoMenus", TRUE);
MyOldWindowProc = (WNDPROC)GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_MENUITEMS), GWLP_WNDPROC);
SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_MENUITEMS), GWLP_WNDPROC, (LONG_PTR)&LBTNDOWNProc);
{
@@ -446,28 +446,28 @@ static INT_PTR CALLBACK GenMenuOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA TreeView_SetImageList(GetDlgItem(hwndDlg, IDC_MENUOBJECTS), himlCheckBoxes, TVSIL_NORMAL);
TreeView_SetImageList(GetDlgItem(hwndDlg, IDC_MENUITEMS), himlCheckBoxes, TVSIL_NORMAL);
}
- CheckDlgButton(hwndDlg, dat->iInitMenuValue ? IDC_RADIO2 : IDC_RADIO1, TRUE );
- CheckDlgButton(hwndDlg, IDC_DISABLEMENUICONS, bIconsDisabled );
+ CheckDlgButton(hwndDlg, dat->iInitMenuValue ? IDC_RADIO2 : IDC_RADIO1, TRUE);
+ CheckDlgButton(hwndDlg, IDC_DISABLEMENUICONS, bIconsDisabled);
BuildMenuObjectsTree(hwndDlg);
return TRUE;
case WM_COMMAND:
- if ( HIWORD(wParam) == BN_CLICKED || HIWORD( wParam ) == BN_DBLCLK ) {
- switch ( LOWORD( wParam )) {
+ if (HIWORD(wParam) == BN_CLICKED || HIWORD(wParam) == BN_DBLCLK) {
+ switch (LOWORD(wParam)) {
case IDC_INSERTSEPARATOR:
InsertSeparator(hwndDlg);
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
case IDC_RESETMENU:
- ResetMenuItems( hwndDlg );
- SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0 );
+ ResetMenuItems(hwndDlg);
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
case IDC_DISABLEMENUICONS:
case IDC_RADIO1:
case IDC_RADIO2:
- SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0 );
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
case IDC_GENMENU_DEFAULT:
@@ -483,18 +483,18 @@ static INT_PTR CALLBACK GenMenuOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA tvi.mask=TVIF_HANDLE|TVIF_IMAGE|TVIF_SELECTEDIMAGE|TVIF_PARAM;
tvi.hItem=hti;
TreeView_GetItem(GetDlgItem(hwndDlg, IDC_MENUITEMS), &tvi);
- iod = ( MenuItemOptData * )tvi.lParam;
+ iod = (MenuItemOptData *)tvi.lParam;
- if ( iod->name && _tcsstr( iod->name, STR_SEPARATOR ))
+ if (iod->name && _tcsstr(iod->name, STR_SEPARATOR))
break;
if (iod->name)
mir_free(iod->name);
- iod->name = mir_tstrdup( iod->defname );
+ iod->name = mir_tstrdup(iod->defname);
SaveTree(hwndDlg);
RebuildCurrent(hwndDlg);
- SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0 );
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
}
break;
@@ -504,20 +504,20 @@ static INT_PTR CALLBACK GenMenuOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA TCHAR buf[256];
MenuItemOptData *iod;
- HTREEITEM hti = TreeView_GetSelection( GetDlgItem( hwndDlg, IDC_MENUITEMS ));
- if ( hti == NULL )
+ HTREEITEM hti = TreeView_GetSelection(GetDlgItem(hwndDlg, IDC_MENUITEMS));
+ if (hti == NULL)
break;
tvi.mask = TVIF_HANDLE|TVIF_IMAGE|TVIF_SELECTEDIMAGE|TVIF_PARAM;
tvi.hItem = hti;
SendDlgItemMessage(hwndDlg, IDC_MENUITEMS, TVM_GETITEM, 0, (LPARAM)&tvi);
- iod = ( MenuItemOptData * )tvi.lParam;
+ iod = (MenuItemOptData *)tvi.lParam;
- if ( iod->name && _tcsstr(iod->name, STR_SEPARATOR ))
+ if (iod->name && _tcsstr(iod->name, STR_SEPARATOR))
break;
- ZeroMemory(buf, sizeof( buf ));
- GetDlgItemText( hwndDlg, IDC_GENMENU_CUSTOMNAME, buf, SIZEOF( buf ));
+ ZeroMemory(buf, sizeof(buf));
+ GetDlgItemText(hwndDlg, IDC_GENMENU_CUSTOMNAME, buf, SIZEOF(buf));
if (iod->name)
mir_free(iod->name);
@@ -525,7 +525,7 @@ static INT_PTR CALLBACK GenMenuOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA SaveTree(hwndDlg);
RebuildCurrent(hwndDlg);
- SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0 );
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
}
break;
} }
@@ -533,15 +533,15 @@ static INT_PTR CALLBACK GenMenuOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA case WM_NOTIFY:
hdr = (LPNMHDR)lParam;
- switch( hdr->idFrom ) {
+ switch(hdr->idFrom) {
case 0:
- if (hdr->code == PSN_APPLY ) {
+ if (hdr->code == PSN_APPLY) {
bIconsDisabled = IsDlgButtonChecked(hwndDlg, IDC_DISABLEMENUICONS) != 0;
DBWriteContactSettingByte(NULL, "CList", "DisableMenuIcons", bIconsDisabled);
SaveTree(hwndDlg);
int iNewMenuValue = IsDlgButtonChecked(hwndDlg, IDC_RADIO1) ? 0 : 1;
- if ( iNewMenuValue != dat->iInitMenuValue ) {
- RebuildProtoMenus( iNewMenuValue );
+ if (iNewMenuValue != dat->iInitMenuValue) {
+ RebuildProtoMenus(iNewMenuValue);
dat->iInitMenuValue = iNewMenuValue;
}
RebuildCurrent(hwndDlg);
@@ -549,8 +549,8 @@ static INT_PTR CALLBACK GenMenuOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA break;
case IDC_MENUOBJECTS:
- if (hdr->code == TVN_SELCHANGEDA )
- RebuildCurrent( hwndDlg );
+ if (hdr->code == TVN_SELCHANGEDA)
+ RebuildCurrent(hwndDlg);
break;
case IDC_MENUITEMS:
@@ -661,12 +661,12 @@ static INT_PTR CALLBACK GenMenuOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA tvi.hItem=hti;
TreeView_GetItem(GetDlgItem(hwndDlg, IDC_MENUITEMS), &tvi);
- if ( tvi.lParam == 0 )
+ if (tvi.lParam == 0)
break;
- iod = ( MenuItemOptData * )tvi.lParam;
+ iod = (MenuItemOptData *)tvi.lParam;
- if ( iod->name && _tcsstr(iod->name, STR_SEPARATOR))
+ if (iod->name && _tcsstr(iod->name, STR_SEPARATOR))
break;
SetDlgItemText(hwndDlg, IDC_GENMENU_CUSTOMNAME, iod->name);
@@ -684,7 +684,7 @@ static INT_PTR CALLBACK GenMenuOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA break;
case WM_MOUSEMOVE:
- if (!dat||!dat->dragging) break;
+ if ( !dat || !dat->dragging) break;
{
TVHITTESTINFO hti;
@@ -697,7 +697,7 @@ static INT_PTR CALLBACK GenMenuOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA HTREEITEM it = hti.hItem;
hti.pt.y -= TreeView_GetItemHeight(GetDlgItem(hwndDlg, IDC_MENUITEMS))/2;
TreeView_HitTest(GetDlgItem(hwndDlg, IDC_MENUITEMS), &hti);
- if (!(hti.flags&TVHT_ABOVE))
+ if ( !(hti.flags&TVHT_ABOVE))
TreeView_SetInsertMark(GetDlgItem(hwndDlg, IDC_MENUITEMS), hti.hItem, 1);
else
TreeView_SetInsertMark(GetDlgItem(hwndDlg, IDC_MENUITEMS), it, 0);
@@ -710,7 +710,7 @@ static INT_PTR CALLBACK GenMenuOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA break;
case WM_LBUTTONUP:
- if (!dat->dragging)
+ if ( !dat->dragging)
break;
TreeView_SetInsertMark(GetDlgItem(hwndDlg, IDC_MENUITEMS), NULL, 0);
@@ -727,7 +727,7 @@ static INT_PTR CALLBACK GenMenuOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA if (hti.flags&TVHT_ABOVE) hti.hItem=TVI_FIRST;
if (dat->hDragItem == hti.hItem) break;
dat->hDragItem=NULL;
- if (hti.flags&(TVHT_ONITEM|TVHT_ONITEMRIGHT)||(hti.hItem == TVI_FIRST)) {
+ if (hti.flags&(TVHT_ONITEM|TVHT_ONITEMRIGHT) || (hti.hItem == TVI_FIRST)) {
HWND tvw;
HTREEITEM * pSIT;
HTREEITEM FirstItem=NULL;
@@ -760,7 +760,7 @@ static INT_PTR CALLBACK GenMenuOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA for (i=0; i<uSic; i++) {
if (insertAfter) insertAfter=MoveItemAbove(tvw, pSIT[i], insertAfter);
else break;
- if (!i) FirstItem=insertAfter;
+ if ( !i) FirstItem=insertAfter;
} }
// free pointers...
mir_free(pSIT);
@@ -773,11 +773,11 @@ static INT_PTR CALLBACK GenMenuOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA break;
case WM_DESTROY:
- if ( dat )
- mir_free( dat );
+ if (dat)
+ mir_free(dat);
ImageList_Destroy(TreeView_SetImageList(GetDlgItem(hwndDlg, IDC_MENUOBJECTS), NULL, TVSIL_NORMAL));
- FreeTreeData( hwndDlg );
+ FreeTreeData(hwndDlg);
break;
}
@@ -786,10 +786,10 @@ static INT_PTR CALLBACK GenMenuOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA long handleCustomDraw(HWND hWndTreeView, LPNMTVCUSTOMDRAW pNMTVCD)
{
- if ( pNMTVCD == NULL )
+ if (pNMTVCD == NULL)
return -1;
- switch ( pNMTVCD->nmcd.dwDrawStage ) {
+ switch (pNMTVCD->nmcd.dwDrawStage) {
case CDDS_PREPAINT:
return CDRF_NOTIFYITEMDRAW;
@@ -818,7 +818,7 @@ long handleCustomDraw(HWND hWndTreeView, LPNMTVCUSTOMDRAW pNMTVCD) and any subitems and return CDRF_NEWFONT. If the list-view control
is in report mode, you can simply return CDRF_NOTIFYSUBITEMREDRAW
to customize the item's subitems individually */
- if ( tvi.iImage == -1 ) {
+ if (tvi.iImage == -1) {
HBRUSH br;
SIZE sz;
RECT rc;
@@ -853,18 +853,18 @@ int GenMenuOptInit(WPARAM wParam, LPARAM) odp.pszGroup = LPGEN("Customize");
odp.position = -1000000000;
- odp.pszTemplate = MAKEINTRESOURCEA( IDD_OPT_GENMENU );
+ odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_GENMENU);
odp.pszTitle = LPGEN("Menus");
odp.pfnDlgProc = GenMenuOpts;
odp.flags = ODPF_BOLDGROUPS;
- CallService( MS_OPT_ADDPAGE, wParam, ( LPARAM )&odp );
+ Options_AddPage(wParam, &odp);
odp.position = -10000000;
odp.groupPosition = 1000000;
- odp.pszTemplate = MAKEINTRESOURCEA( IDD_OPT_PROTOCOLORDER );
+ odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_PROTOCOLORDER);
odp.pszTitle = LPGEN("Accounts");
odp.pfnDlgProc = ProtocolOrderOpts;
odp.flags = ODPF_BOLDGROUPS|ODPF_EXPERTONLY;
- CallService( MS_OPT_ADDPAGE, wParam, ( LPARAM )&odp );
+ Options_AddPage(wParam, &odp);
return 0;
}
|