From 803b51d1a61b8c13badf6ac1f361b4d577f03cda Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 1 Nov 2012 16:59:23 +0000 Subject: Clist Modern own extra icons support removed git-svn-id: http://svn.miranda-ng.org/main/trunk@2138 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Clist_modern/src/modern_clistopts.cpp | 296 +------------------------- 1 file changed, 1 insertion(+), 295 deletions(-) (limited to 'plugins/Clist_modern/src/modern_clistopts.cpp') diff --git a/plugins/Clist_modern/src/modern_clistopts.cpp b/plugins/Clist_modern/src/modern_clistopts.cpp index de26c3b2be..fe5ac2dc86 100644 --- a/plugins/Clist_modern/src/modern_clistopts.cpp +++ b/plugins/Clist_modern/src/modern_clistopts.cpp @@ -450,9 +450,7 @@ static INT_PTR CALLBACK DlgProcItemIconOpts(HWND hwndDlg, UINT msg, WPARAM wPara if ( !IsDlgButtonChecked(hwndDlg,IDC_HIDE_ICON_ON_AVATAR)) EnableWindow(GetDlgItem(hwndDlg,IDC_DRAW_ON_AVATAR_SPACE),FALSE); - if (ServiceExists("ExtraIcon/Register")) - ShowWindow(GetDlgItem(hwndDlg, IDC_ALWAYS_VISIBLEICON), SW_HIDE); - + ShowWindow(GetDlgItem(hwndDlg, IDC_ALWAYS_VISIBLEICON), SW_HIDE); break; case WM_COMMAND: @@ -944,293 +942,6 @@ static INT_PTR CALLBACK DlgProcItemThirdLineOpts(HWND hwndDlg, UINT msg, WPARAM return 0; } -/* Extra icons settings */ -typedef struct _OrderTreeData -{ - BYTE ID; - TCHAR * Name; - BYTE Position; - char * KeyName; - BOOL Visible; - BOOL fReserved; -} *pOrderTreeData, TOrderTreeData; - -static TOrderTreeData OrderTreeData[] = -{ - {EXTRA_ICON_VISMODE, _T("Visibility/Chat activity"), EXTRA_ICON_VISMODE, "EXTRA_ICON_VISMODE", SETTING_EXTRA_ICON_VISMODE_DEFAULT,0}, - {EXTRA_ICON_EMAIL, _T("E-mail"), EXTRA_ICON_EMAIL, "EXTRA_ICON_EMAIL", SETTING_EXTRA_ICON_EMAIL_DEFAULT, 0}, - {EXTRA_ICON_PROTO, _T("Protocol"), EXTRA_ICON_PROTO, "EXTRA_ICON_PROTO", SETTING_EXTRA_ICON_PROTO_DEFAULT, 0}, - {EXTRA_ICON_SMS, _T("Phone/SMS"), EXTRA_ICON_SMS, "EXTRA_ICON_SMS", SETTING_EXTRA_ICON_SMS_DEFAULT, 0}, - {EXTRA_ICON_WEB, _T("Web page"), EXTRA_ICON_WEB, "EXTRA_ICON_WEB", SETTING_EXTRA_ICON_WEB_DEFAULT, 0}, - {EXTRA_ICON_CLIENT, _T("Client (fingerprint.dll is required)"), EXTRA_ICON_CLIENT,"EXTRA_ICON_CLIENT", SETTING_EXTRA_ICON_CLIENT_DEFAULT, 0}, - {EXTRA_ICON_ADV1, _T("Advanced #1"), EXTRA_ICON_ADV1, "EXTRA_ICON_ADV1", SETTING_EXTRA_ICON_ADV1_DEFAULT, 0}, - {EXTRA_ICON_ADV2, _T("Advanced #2"), EXTRA_ICON_ADV2, "EXTRA_ICON_ADV2", SETTING_EXTRA_ICON_ADV2_DEFAULT, 0}, - {EXTRA_ICON_ADV3, _T("Advanced #3"), EXTRA_ICON_ADV3, "EXTRA_ICON_ADV3", SETTING_EXTRA_ICON_ADV3_DEFAULT, 0}, - {EXTRA_ICON_ADV4, _T("Advanced #4"), EXTRA_ICON_ADV4, "EXTRA_ICON_ADV4", SETTING_EXTRA_ICON_ADV4_DEFAULT, 0} -}; - -#define PrVer 4 - -static char **settingname; -static int nArrayLen; - -static int OrderEnumProc (const char *szSetting,LPARAM lParam) -{ - if (szSetting == NULL) return 0; - if ( !wildcmp((char*) szSetting,(char *) lParam,0)) return 0; - nArrayLen++; - settingname = (char **)realloc(settingname,nArrayLen*sizeof(char *)); - settingname[nArrayLen-1] = _strdup(szSetting); - return 0; -}; - -static int DeleteAllSettingInOrder() -{ - DBCONTACTENUMSETTINGS dbces; - nArrayLen = 0; - - dbces.pfnEnumProc = OrderEnumProc; - dbces.szModule = CLUIFrameModule; - dbces.ofsSettings = 0; - dbces.lParam = (LPARAM)"ORDER_EXTRA_*"; - - CallService(MS_DB_CONTACT_ENUMSETTINGS,0,(LPARAM)&dbces); - - //delete all settings - if (nArrayLen == 0) - return 0; - - for (int i=0; i < nArrayLen; i++) { - db_unset(0, CLUIFrameModule, settingname[i]); - free(settingname[i]); - } - free(settingname); - settingname = NULL; - - return 0; -} - -static int CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort) -{ - pOrderTreeData A = (pOrderTreeData)lParam1; - pOrderTreeData B = (pOrderTreeData)lParam2; - return (int)(A->Position)-(int)(B->Position); -} - -static int FillOrderTree(HWND hwndDlg, HWND Tree) -{ - TVINSERTSTRUCT tvis = {0}; - TreeView_DeleteAllItems(Tree); - tvis.hParent = NULL; - tvis.hInsertAfter = TVI_LAST; - tvis.item.mask = TVIF_PARAM|TVIF_TEXT|TVIF_IMAGE|TVIF_SELECTEDIMAGE; - if (db_get_b(NULL,CLUIFrameModule,"ExtraCountStored",0) != SIZEOF(OrderTreeData)) { - DeleteAllSettingInOrder(); - db_set_b(NULL,CLUIFrameModule,"ExtraCountStored",SIZEOF(OrderTreeData)); - } - - for (int i=0; i < SIZEOF(OrderTreeData); i++) { - char buf[256]; - sprintf(buf,"ORDER_%s",OrderTreeData[i].KeyName); - OrderTreeData[i].Position = (BYTE)db_get_b(NULL,CLUIFrameModule,buf,i); - OrderTreeData[i].Visible = (BOOL)db_get_b(NULL,CLUIFrameModule,OrderTreeData[i].KeyName,1); - tvis.hInsertAfter = TVI_LAST; - tvis.item.lParam = (LPARAM)(&(OrderTreeData[i])); - tvis.item.pszText = TranslateTS(OrderTreeData[i].Name); - tvis.item.iImage = tvis.item.iSelectedImage = OrderTreeData[i].Visible; - TreeView_InsertItem(Tree,&tvis); - } - - TVSORTCB sort = {0}; - sort.hParent = NULL; - sort.lParam = 0; - sort.lpfnCompare = CompareFunc; - TreeView_SortChildrenCB(Tree,&sort,0); - return 0; -} - -static int SaveOrderTree(HWND hwndDlg, HWND Tree) -{ - HTREEITEM ht; - BYTE pos = 0; - TVITEMA tvi = {0}; - tvi.mask = TVIF_HANDLE|TVIF_IMAGE|TVIF_SELECTEDIMAGE|TVIF_PARAM; - ht = TreeView_GetRoot(Tree); - do { - TOrderTreeData * it = NULL; - tvi.hItem = ht; - TreeView_GetItemA(Tree,&tvi); - it = (TOrderTreeData*)(tvi.lParam); - { - char buf[250]; - sprintf(buf,"ORDER_%s",it->KeyName); - db_set_b(NULL,CLUIFrameModule,buf,pos); - db_set_b(NULL,CLUIFrameModule,it->KeyName, it->Visible); - } - ht = TreeView_GetNextSibling(Tree,ht); - pos++; - } - while (ht); - - return 0; -} - -int LoadPositionsFromDB(BYTE * OrderPos) -{ - if (db_get_b(NULL,CLUIFrameModule,"ExtraCountStored",0) != SIZEOF(OrderTreeData)) { - DeleteAllSettingInOrder(); - db_set_b(NULL,CLUIFrameModule,"ExtraCountStored",SIZEOF(OrderTreeData)); - } - - for (int i=0; i < SIZEOF(OrderTreeData); i++) { - char buf[256]; - sprintf(buf,"ORDER_%s",OrderTreeData[i].KeyName); - OrderPos[OrderTreeData[i].ID-1] = (BYTE)db_get_b(NULL,CLUIFrameModule,buf,i); - } - return 0; -} - -static int dragging = 0; -static HANDLE hDragItem = NULL; - -INT_PTR CALLBACK DlgProcExtraIconsOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) -{ - switch (msg) { - case WM_INITDIALOG: - TranslateDialogDefault(hwndDlg); - SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_EXTRAORDER),GWL_STYLE,GetWindowLongPtr(GetDlgItem(hwndDlg,IDC_EXTRAORDER),GWL_STYLE)|TVS_NOHSCROLL); - { - HIMAGELIST himlCheckBoxes; - himlCheckBoxes = ImageList_Create(GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),ILC_COLOR32|ILC_MASK,2,2); - ImageList_AddIcon(himlCheckBoxes,LoadSmallIconShared(GetModuleHandle(NULL),MAKEINTRESOURCE(IDI_NOTICK))); - ImageList_AddIcon(himlCheckBoxes,LoadSmallIconShared(GetModuleHandle(NULL),MAKEINTRESOURCE(IDI_TICK))); - TreeView_SetImageList(GetDlgItem(hwndDlg,IDC_EXTRAORDER),himlCheckBoxes,TVSIL_NORMAL); - } - FillOrderTree(hwndDlg,GetDlgItem(hwndDlg,IDC_EXTRAORDER)); - return TRUE; - - case WM_COMMAND: - SendMessage((GetParent(hwndDlg)), PSM_CHANGED, (WPARAM)hwndDlg, 0); - break; - - case WM_NOTIFY: - switch(((LPNMHDR)lParam)->idFrom) { - case 0: - switch (((LPNMHDR)lParam)->code) { - case PSN_APPLY: - SaveOrderTree(hwndDlg,GetDlgItem(hwndDlg,IDC_EXTRAORDER)); - ReAssignExtraIcons(); - CLUI_ReloadCLUIOptions(); - ClcOptionsChanged(); - return TRUE; - } - break; - - case IDC_EXTRAORDER: - switch (((LPNMHDR)lParam)->code) { - case NM_CLICK: - { - TVHITTESTINFO hti; - hti.pt.x = (short)LOWORD(GetMessagePos()); - hti.pt.y = (short)HIWORD(GetMessagePos()); - ScreenToClient(((LPNMHDR)lParam)->hwndFrom,&hti.pt); - if (TreeView_HitTest(((LPNMHDR)lParam)->hwndFrom,&hti)) - if (hti.flags & TVHT_ONITEMICON) - { - TVITEMA tvi; - tvi.mask = TVIF_HANDLE|TVIF_IMAGE|TVIF_SELECTEDIMAGE; - tvi.hItem = hti.hItem; - TreeView_GetItemA(((LPNMHDR)lParam)->hwndFrom,&tvi); - tvi.iImage = tvi.iSelectedImage = !tvi.iImage; - ((TOrderTreeData *)tvi.lParam)->Visible = tvi.iImage; - TreeView_SetItem(((LPNMHDR)lParam)->hwndFrom,&tvi); - SendMessage((GetParent(hwndDlg)), PSM_CHANGED, (WPARAM)hwndDlg, 0); - } - } - break; - - case TVN_BEGINDRAGA: - case TVN_BEGINDRAGW: - SetCapture(hwndDlg); - dragging = 1; - hDragItem = ((LPNMTREEVIEWA)lParam)->itemNew.hItem; - TreeView_SelectItem(GetDlgItem(hwndDlg,IDC_EXTRAORDER),hDragItem); - break; - } - } - break; - - case WM_MOUSEMOVE: - if ( dragging) { - TVHITTESTINFO hti; - hti.pt.x = (short)LOWORD(lParam); - hti.pt.y = (short)HIWORD(lParam); - ClientToScreen(hwndDlg,&hti.pt); - ScreenToClient(GetDlgItem(hwndDlg,IDC_EXTRAORDER),&hti.pt); - TreeView_HitTest(GetDlgItem(hwndDlg,IDC_EXTRAORDER),&hti); - if (hti.flags & (TVHT_ONITEM|TVHT_ONITEMRIGHT)) { - HTREEITEM it = hti.hItem; - hti.pt.y -= TreeView_GetItemHeight(GetDlgItem(hwndDlg,IDC_EXTRAORDER))/2; - TreeView_HitTest(GetDlgItem(hwndDlg,IDC_EXTRAORDER),&hti); - //TreeView_SetInsertMark(GetDlgItem(hwndDlg,IDC_EXTRAORDER),hti.hItem,1); - if ( !(hti.flags&TVHT_ABOVE)) - TreeView_SetInsertMark(GetDlgItem(hwndDlg,IDC_EXTRAORDER),hti.hItem,1); - else - TreeView_SetInsertMark(GetDlgItem(hwndDlg,IDC_EXTRAORDER),it,0); - } - else { - if (hti.flags&TVHT_ABOVE) SendDlgItemMessage(hwndDlg,IDC_EXTRAORDER,WM_VSCROLL,MAKEWPARAM(SB_LINEUP,0),0); - if (hti.flags&TVHT_BELOW) SendDlgItemMessage(hwndDlg,IDC_EXTRAORDER,WM_VSCROLL,MAKEWPARAM(SB_LINEDOWN,0),0); - TreeView_SetInsertMark(GetDlgItem(hwndDlg,IDC_EXTRAORDER),NULL,0); - } - } - break; - - case WM_LBUTTONUP: - if ( dragging) { - TreeView_SetInsertMark(GetDlgItem(hwndDlg,IDC_EXTRAORDER),NULL,0); - dragging = 0; - ReleaseCapture(); - - TVHITTESTINFO hti; - TVITEM tvi; - hti.pt.x = (short)LOWORD(lParam); - hti.pt.y = (short)HIWORD(lParam); - ClientToScreen(hwndDlg,&hti.pt); - ScreenToClient(GetDlgItem(hwndDlg,IDC_EXTRAORDER),&hti.pt); - hti.pt.y -= TreeView_GetItemHeight(GetDlgItem(hwndDlg,IDC_EXTRAORDER))/2; - TreeView_HitTest(GetDlgItem(hwndDlg,IDC_EXTRAORDER),&hti); - if (hDragItem == hti.hItem) break; - if (hti.flags&TVHT_ABOVE) hti.hItem = TVI_FIRST; - tvi.mask = TVIF_HANDLE|TVIF_PARAM; - tvi.hItem = (HTREEITEM)hDragItem; - TreeView_GetItem(GetDlgItem(hwndDlg,IDC_EXTRAORDER),&tvi); - if (hti.flags&(TVHT_ONITEM|TVHT_ONITEMRIGHT) || (hti.hItem == TVI_FIRST)) { - TVINSERTSTRUCT tvis; - TCHAR name[128]; - 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.hItem = (HTREEITEM)hDragItem; - tvis.item.iImage = tvis.item.iSelectedImage = ((TOrderTreeData *)tvi.lParam)->Visible; - TreeView_GetItem(GetDlgItem(hwndDlg,IDC_EXTRAORDER),&tvis.item); - TreeView_DeleteItem(GetDlgItem(hwndDlg,IDC_EXTRAORDER),hDragItem); - tvis.hParent = NULL; - tvis.hInsertAfter = hti.hItem; - TreeView_SelectItem(GetDlgItem(hwndDlg,IDC_EXTRAORDER),TreeView_InsertItem(GetDlgItem(hwndDlg,IDC_EXTRAORDER),&tvis)); - SendMessage((GetParent(hwndDlg)), PSM_CHANGED, (WPARAM)hwndDlg, 0); - } - } - break; - - case WM_DESTROY: - ImageList_Destroy(TreeView_SetImageList(GetDlgItem(hwndDlg,IDC_EXTRAORDER),NULL,TVSIL_NORMAL)); - break; - } - return FALSE; -} - ///////////////////////////////////////////////////////////////////////////////////////// struct @@ -1251,7 +962,6 @@ static row_opt_items[] = { LPGEN("Text"), IDD_OPT_ITEM_TEXT, DlgProcItemTextOpts }, { LPGEN("Second Line"), IDD_OPT_ITEM_SECOND_LINE, DlgProcItemSecondLineOpts }, { LPGEN("Third Line"), IDD_OPT_ITEM_THIRD_LINE, DlgProcItemThirdLineOpts }, - { LPGEN("Extra Icons"), IDD_OPT_ITEM_EXTRAICONS, DlgProcExtraIconsOpts} }; int CListOptInit(WPARAM wParam,LPARAM lParam) @@ -1265,11 +975,7 @@ int CListOptInit(WPARAM wParam,LPARAM lParam) odp.pszTitle = LPGEN("Row items"); odp.flags = ODPF_BOLDGROUPS; - BOOL hasExtraIconsService = ServiceExists("ExtraIcon/Register"); for (int i=0; i < SIZEOF(row_opt_items); i++) { - if (hasExtraIconsService && row_opt_items[i].id == IDD_OPT_ITEM_EXTRAICONS) - continue; - odp.pszTemplate = MAKEINTRESOURCEA(row_opt_items[i].id); odp.pszTab = row_opt_items[i].name; odp.pfnDlgProc = row_opt_items[i].wnd_proc; -- cgit v1.2.3