From 50feaa0ffc1b2e120eb6b22b2970f5bc2f7dc7a4 Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Sun, 14 Oct 2012 13:35:25 +0000 Subject: TabSRMM: folders restructurization git-svn-id: http://svn.miranda-ng.org/main/trunk@1923 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/TabSRMM/tabmodplus/icons/imgclose.ico | Bin 2550 -> 0 bytes plugins/TabSRMM/tabmodplus/icons/imgopen.ico | Bin 2550 -> 0 bytes plugins/TabSRMM/tabmodplus/modplus.cpp | 276 ------------------------- plugins/TabSRMM/tabmodplus/msgoptions_plus.cpp | 189 ----------------- 4 files changed, 465 deletions(-) delete mode 100644 plugins/TabSRMM/tabmodplus/icons/imgclose.ico delete mode 100644 plugins/TabSRMM/tabmodplus/icons/imgopen.ico delete mode 100644 plugins/TabSRMM/tabmodplus/modplus.cpp delete mode 100644 plugins/TabSRMM/tabmodplus/msgoptions_plus.cpp (limited to 'plugins/TabSRMM/tabmodplus') diff --git a/plugins/TabSRMM/tabmodplus/icons/imgclose.ico b/plugins/TabSRMM/tabmodplus/icons/imgclose.ico deleted file mode 100644 index 615b00a98e..0000000000 Binary files a/plugins/TabSRMM/tabmodplus/icons/imgclose.ico and /dev/null differ diff --git a/plugins/TabSRMM/tabmodplus/icons/imgopen.ico b/plugins/TabSRMM/tabmodplus/icons/imgopen.ico deleted file mode 100644 index c1a5c7514e..0000000000 Binary files a/plugins/TabSRMM/tabmodplus/icons/imgopen.ico and /dev/null differ diff --git a/plugins/TabSRMM/tabmodplus/modplus.cpp b/plugins/TabSRMM/tabmodplus/modplus.cpp deleted file mode 100644 index fc6b69b292..0000000000 --- a/plugins/TabSRMM/tabmodplus/modplus.cpp +++ /dev/null @@ -1,276 +0,0 @@ -/* - * astyle --force-indent=tab=4 --brackets=linux --indent-switches - * --pad=oper --one-line=keep-blocks --unpad=paren - * - * Miranda NG: the free IM client for Microsoft* Windows* - * - * Copyright 2000-2009 Miranda ICQ/IM project, - * all portions of this codebase are copyrighted to the people - * listed in contributors.txt. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * you should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * part of tabSRMM messaging plugin for Miranda. - * - * (C) 2005-2009 by silvercircle _at_ gmail _dot_ com and contributors - * - * $Id: modplus.cpp 11848 2010-05-27 14:57:22Z silvercircle $ - * - * implements features of the tabSRMM "MADMOD" patch, developed by - * Mad Cluster in May 2008 - * - * the "mad mod" patch added the following features: - * - * ) typing sounds - * ) support for animated avatars through ACC (avs) - * ) a fully customizable tool bar providing services useable by external plugins - * to add and change buttons - * ) toolbar on the bottom - * ) image tag button - * ) client icon in status bar - * ) close tab/window on send and the "hide container feature" - * ) bug fixes - * - */ - -#include "../src/commonheaders.h" - -static HANDLE hEventCBButtonPressed,hEventCBInit, hEventDbOptionsInit, hEventDbPluginsLoaded; - -int g_bStartup=0; - -BOOL g_bIMGtagButton; - -static char* getMirVer(HANDLE hContact) -{ - char *szProto = NULL; - char *msg = NULL; - DBVARIANT dbv = {0}; - - szProto = (char*) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0); - if ( !szProto ) - return (NULL); - - if ( !DBGetContactSettingString(hContact, szProto, "MirVer", &dbv)) { - msg=mir_strdup(dbv.pszVal); - DBFreeVariant(&dbv); - } - return (msg); -} - -static TCHAR* getMenuEntry(int i) { - TCHAR *msg = NULL; - char MEntry[256] = {'\0'}; - DBVARIANT dbv = {0}; - - mir_snprintf(MEntry, 255, "MenuEntry_%u", i); - if ( !M->GetTString(NULL, "tabmodplus",MEntry, &dbv)) { - msg = mir_tstrdup(dbv.ptszVal); - DBFreeVariant(&dbv); - } - return (msg); -} - -int ChangeClientIconInStatusBar(const TWindowData *dat) -{ - if (!ServiceExists(MS_FP_GETCLIENTICON)) - return(S_FALSE); - - char *msg = getMirVer(dat->hContact); - - if ( !msg ) - return (S_FALSE); - - StatusIconData sid = {0}; - - sid.cbSize = sizeof(sid); - sid.szModule = (char *)"tabmodplus"; - sid.hIcon = sid.hIconDisabled = dat->hClientIcon; - sid.dwId = 1; - sid.szTooltip = msg; - sid.flags = MBF_OWNERSTATE; - CallService(MS_MSG_MODIFYICON,(WPARAM)dat->hContact, (LPARAM)&sid); - mir_free(msg); - return (S_OK); -} - - -int ModPlus_PreShutdown(WPARAM wparam, LPARAM lparam) -{ - if ( hEventCBButtonPressed ) - UnhookEvent(hEventCBButtonPressed); - if ( hEventCBInit ) - UnhookEvent(hEventCBInit); - UnhookEvent(hEventDbPluginsLoaded); - UnhookEvent(hEventDbOptionsInit); - - return (0); -} - -static int RegisterCustomButton(WPARAM wParam,LPARAM lParam) -{ - if ( ServiceExists(MS_BB_ADDBUTTON)) { - BBButton bbd = {0}; - bbd.cbSize = sizeof(BBButton); - bbd.bbbFlags = BBBF_ISIMBUTTON|BBBF_ISLSIDEBUTTON|BBBF_ISPUSHBUTTON; - bbd.dwButtonID = 1; - bbd.dwDefPos =200; - bbd.hIcon = PluginConfig.g_buttonBarIconHandles[3]; - bbd.pszModuleName = (char *)"Tabmodplus"; - bbd.ptszTooltip = TranslateT("Insert [img] tag / surround selected text with [img][/img]"); - - return (CallService(MS_BB_ADDBUTTON, 0, (LPARAM)&bbd)); - } - return (1); -} - -static int CustomButtonPressed(WPARAM wParam,LPARAM lParam) -{ - CustomButtonClickData *cbcd=(CustomButtonClickData *)lParam; - - CHARRANGE cr; - TCHAR* pszMenu[256]={0};//=NULL; - int i=0; - TCHAR* pszText = (TCHAR *)_T(""); - TCHAR* pszFormatedText=NULL; - UINT textlenght=0; - BBButton bbd={0}; - - int state=0; - - if ( strcmp(cbcd->pszModule,"Tabmodplus")||cbcd->dwButtonId!=1 ) return (0); - - bbd.cbSize=sizeof(BBButton); - bbd.dwButtonID=1; - bbd.pszModuleName = (char *)"Tabmodplus"; - CallService(MS_BB_GETBUTTONSTATE, wParam, (LPARAM)&bbd); - - cr.cpMin = cr.cpMax = 0; - SendDlgItemMessage(cbcd->hwndFrom,IDC_MESSAGE, EM_EXGETSEL, 0, (LPARAM)&cr); - textlenght=cr.cpMax-cr.cpMin; - if ( textlenght ) { - pszText = (TCHAR *)mir_alloc((textlenght+1)*sizeof(TCHAR)); - ZeroMemory(pszText,(textlenght+1)*sizeof(TCHAR)); - SendDlgItemMessage(cbcd->hwndFrom, IDC_MESSAGE,EM_GETSELTEXT, 0, (LPARAM)pszText); - } - - if ( cbcd->flags & BBCF_RIGHTBUTTON ) - state=1; - else if ( textlenght ) - state = 2; - else if ( bbd.bbbFlags & BBSF_PUSHED ) - state = 3; - else - state = 4; - - switch ( state ) { - case 1: - { - int res=0; - int menunum; - int menulimit; - HMENU hMenu=NULL; - - menulimit = M->GetByte("tabmodplus","MenuCount", 0); - if ( menulimit ) { - hMenu = CreatePopupMenu(); - //pszMenu=malloc(menulimit*sizeof(TCHAR*)); - } else break; - for ( menunum=0;menunumpt.x, cbcd->pt.y, 0, cbcd->hwndFrom, NULL); - if ( res==0 ) break; - - pszFormatedText = (TCHAR *)mir_alloc((textlenght+lstrlen(pszMenu[res-1])+2)*sizeof(TCHAR)); - ZeroMemory(pszFormatedText,(textlenght+lstrlen(pszMenu[res-1])+2)*sizeof(TCHAR)); - - mir_sntprintf(pszFormatedText,(textlenght+lstrlen(pszMenu[res-1])+2)*sizeof(TCHAR),pszMenu[res-1],pszText); - - }break; - case 2: - { - pszFormatedText = (TCHAR *)mir_alloc((textlenght+12)*sizeof(TCHAR)); - ZeroMemory(pszFormatedText,(textlenght+12)*sizeof(TCHAR)); - - SendDlgItemMessage(cbcd->hwndFrom, IDC_MESSAGE,EM_GETSELTEXT, 0, (LPARAM)pszText); - mir_sntprintf(pszFormatedText,(textlenght+12)*sizeof(TCHAR),_T("[img]%s[/img]"),pszText); - - bbd.ptszTooltip=0; - bbd.hIcon=0; - bbd.bbbFlags=BBSF_RELEASED; - CallService(MS_BB_SETBUTTONSTATE, wParam, (LPARAM)&bbd); - }break; - - case 3: - { - pszFormatedText = (TCHAR *)mir_alloc(6*sizeof(TCHAR)); - ZeroMemory(pszFormatedText,6*sizeof(TCHAR)); - - _sntprintf(pszFormatedText,6*sizeof(TCHAR),_T("%s"),_T("[img]")); - - bbd.ptszTooltip = TranslateT("Insert [img] tag / surround selected text with [img][/img]"); - CallService(MS_BB_SETBUTTONSTATE, wParam, (LPARAM)&bbd); - - }break; - case 4: - { - - pszFormatedText = (TCHAR *)mir_alloc(7*sizeof(TCHAR)); - ZeroMemory(pszFormatedText,7*sizeof(TCHAR)); - _sntprintf(pszFormatedText,7*sizeof(TCHAR),_T("%s"),_T("[/img]")); - - bbd.ptszTooltip = TranslateT("Insert [img] tag / surround selected text with [img][/img]"); - CallService(MS_BB_SETBUTTONSTATE, wParam, (LPARAM)&bbd); - - }break; - } - - while ( pszMenu[i] ) { - mir_free(pszMenu[i]); - i++; - } - - if ( pszFormatedText ) SendDlgItemMessage(cbcd->hwndFrom, IDC_MESSAGE, EM_REPLACESEL, TRUE, (LPARAM)pszFormatedText); - - if ( textlenght ) mir_free(pszText); - if ( pszFormatedText ) mir_free(pszFormatedText); - return (1); - -} - -#define MBF_OWNERSTATE 0x04 - -int ModPlus_Init(WPARAM wparam,LPARAM lparam) -{ - g_bStartup = 1; - - hEventCBButtonPressed=HookEvent(ME_MSG_BUTTONPRESSED,CustomButtonPressed); - hEventCBInit=HookEvent(ME_MSG_TOOLBARLOADED,RegisterCustomButton); - - if (PluginConfig.g_bClientInStatusBar&&ServiceExists(MS_MSG_ADDICON)) { - StatusIconData sid = {0}; - sid.cbSize = sizeof(sid); - sid.szModule = (char *)"tabmodplus"; - sid.flags = MBF_OWNERSTATE|MBF_HIDDEN; - sid.dwId = 1; - sid.szTooltip = 0; - sid.hIcon = sid.hIconDisabled = 0; - CallService(MS_MSG_ADDICON, 0, (LPARAM)&sid); - } - g_bStartup = 0; - return (0); -} diff --git a/plugins/TabSRMM/tabmodplus/msgoptions_plus.cpp b/plugins/TabSRMM/tabmodplus/msgoptions_plus.cpp deleted file mode 100644 index 9e5994389b..0000000000 --- a/plugins/TabSRMM/tabmodplus/msgoptions_plus.cpp +++ /dev/null @@ -1,189 +0,0 @@ -/* - * astyle --force-indent=tab=4 --brackets=linux --indent-switches - * --pad=oper --one-line=keep-blocks --unpad=paren - * - * Miranda NG: the free IM client for Microsoft* Windows* - * - * Copyright 2000-2009 Miranda ICQ/IM project, - * all portions of this codebase are copyrighted to the people - * listed in contributors.txt. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * you should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * part of tabSRMM messaging plugin for Miranda. - * - * (C) 2005-2009 by silvercircle _at_ gmail _dot_ com and contributors - * - * $Id: msgoptions_plus.cpp 13034 2010-10-24 20:39:04Z silvercircle $ - * - * implements the "advanced tweak" option page - * - * originally developed by Mad Cluster for the tabSRMM "MADMOD" patch in - * May 2008. - * - */ - -#include "../src/commonheaders.h" - -extern HINSTANCE hinstance; -extern BOOL g_bIMGtagButton; -extern HIMAGELIST g_himlOptions, CreateStateImageList(); - -static void FillDialog(HWND hwndDlg) -{ - TVINSERTSTRUCT tvi = {0}; - int i; - - TOptionListGroup *lvGroups = CTranslator::getGroupTree(CTranslator::TREE_MODPLUS); - for (i=0; lvGroups[i].szName != NULL; i++) { - tvi.hParent = 0; - tvi.hInsertAfter = TVI_LAST; - tvi.item.mask = TVIF_TEXT | TVIF_STATE; - tvi.item.pszText = TranslateTS(lvGroups[i].szName); - tvi.item.stateMask = TVIS_STATEIMAGEMASK | TVIS_EXPANDED | TVIS_BOLD; - tvi.item.state = INDEXTOSTATEIMAGEMASK(0) | TVIS_EXPANDED | TVIS_BOLD; - lvGroups[i].handle = (LRESULT)TreeView_InsertItem(GetDlgItem(hwndDlg, IDC_PLUS_CHECKTREE), &tvi); - } - - TOptionListItem *lvItems = CTranslator::getTree(CTranslator::TREE_MODPLUS); - for (i=0; lvItems[i].szName != 0; i++) { - tvi.hParent = (HTREEITEM)lvGroups[lvItems[i].uGroup].handle; - tvi.hInsertAfter = TVI_LAST; - tvi.item.pszText = TranslateTS(lvItems[i].szName); - tvi.item.mask = TVIF_TEXT | TVIF_STATE | TVIF_PARAM; - tvi.item.lParam = i; - tvi.item.stateMask = TVIS_STATEIMAGEMASK; - if (lvItems[i].uType == LOI_TYPE_SETTING) - tvi.item.state = INDEXTOSTATEIMAGEMASK(M->GetByte((char *)lvItems[i].lParam, lvItems[i].id) ? 3 : 2); // NOTE: was 2 : 1 without state image mask - lvItems[i].handle = (LRESULT)TreeView_InsertItem(GetDlgItem(hwndDlg, IDC_PLUS_CHECKTREE), &tvi); - } - - PluginConfig.g_bClientInStatusBar = M->GetByte("adv_ClientIconInStatusBar", 0); - - SendDlgItemMessage(hwndDlg, IDC_TIMEOUTSPIN, UDM_SETRANGE, 0, MAKELONG(300, SRMSGSET_MSGTIMEOUT_MIN / 1000)); - SendDlgItemMessage(hwndDlg, IDC_TIMEOUTSPIN, UDM_SETPOS, 0, PluginConfig.m_MsgTimeout / 1000); - - SendDlgItemMessage(hwndDlg, IDC_HISTORYSIZESPIN, UDM_SETRANGE, 0, MAKELONG(255, 15)); - SendDlgItemMessage(hwndDlg, IDC_HISTORYSIZESPIN, UDM_SETPOS, 0, (int)M->GetByte("historysize", 0)); -} - -INT_PTR CALLBACK PlusOptionsProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lParam) -{ - switch(msg) { - case WM_INITDIALOG: - TranslateDialogDefault(hwndDlg); - SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_PLUS_CHECKTREE), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_PLUS_CHECKTREE), GWL_STYLE) | (TVS_NOHSCROLL | TVS_CHECKBOXES)); - - g_himlOptions = (HIMAGELIST)SendDlgItemMessage(hwndDlg, IDC_PLUS_CHECKTREE, TVM_SETIMAGELIST, TVSIL_STATE, (LPARAM)CreateStateImageList()); - ImageList_Destroy(g_himlOptions); - - FillDialog(hwndDlg); - return TRUE; - - case WM_NOTIFY: - switch (((LPNMHDR) lParam)->idFrom) { - case IDC_PLUS_CHECKTREE: - if (((LPNMHDR)lParam)->code == NM_CLICK || (((LPNMHDR)lParam)->code == TVN_KEYDOWN && ((LPNMTVKEYDOWN)lParam)->wVKey == VK_SPACE)) { - TVHITTESTINFO hti; - TVITEM item = {0}; - - item.mask = TVIF_HANDLE | TVIF_STATE; - item.stateMask = TVIS_STATEIMAGEMASK | TVIS_BOLD; - 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) || ((LPNMHDR)lParam)->code == TVN_KEYDOWN) { - if (((LPNMHDR)lParam)->code == TVN_KEYDOWN) { - hti.flags |= TVHT_ONITEMSTATEICON; - item.hItem = TreeView_GetSelection(((LPNMHDR)lParam)->hwndFrom); - } else - item.hItem = (HTREEITEM)hti.hItem; - SendDlgItemMessageA(hwndDlg, IDC_PLUS_CHECKTREE, TVM_GETITEMA, 0, (LPARAM)&item); - if (item.state & TVIS_BOLD && hti.flags & TVHT_ONITEMSTATEICON) { - item.state = INDEXTOSTATEIMAGEMASK(0) | TVIS_BOLD; - SendDlgItemMessageA(hwndDlg, IDC_PLUS_CHECKTREE, TVM_SETITEMA, 0, (LPARAM)&item); - } - else if (hti.flags & TVHT_ONITEMSTATEICON) { - if (((item.state & TVIS_STATEIMAGEMASK) >> 12) == 3) { - item.state = INDEXTOSTATEIMAGEMASK(1); - SendDlgItemMessageA(hwndDlg, IDC_PLUS_CHECKTREE, TVM_SETITEMA, 0, (LPARAM)&item); - } - SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); - } - } - } - break; - - default: - switch (((LPNMHDR) lParam)->code) { - case PSN_APPLY: { - TVITEM item = {0}; - DWORD msgTimeout; - /* - * scan the tree view and obtain the options... - */ - TOptionListItem* lvItems = CTranslator::getTree(CTranslator::TREE_MODPLUS); - - for (int i=0; lvItems[i].szName != NULL; i++) { - item.mask = TVIF_HANDLE | TVIF_STATE; - item.hItem = (HTREEITEM)lvItems[i].handle; - item.stateMask = TVIS_STATEIMAGEMASK; - - SendDlgItemMessageA(hwndDlg, IDC_PLUS_CHECKTREE, TVM_GETITEMA, 0, (LPARAM)&item); - if (lvItems[i].uType == LOI_TYPE_SETTING) - M->WriteByte(SRMSGMOD_T, (char *)lvItems[i].lParam, (BYTE)((item.state >> 12) == 3/*2*/ ? 1 : 0)); // NOTE: state image masks changed - } - - msgTimeout = 1000 * GetDlgItemInt(hwndDlg, IDC_SECONDS, NULL, FALSE); - PluginConfig.m_MsgTimeout = msgTimeout >= SRMSGSET_MSGTIMEOUT_MIN ? msgTimeout : SRMSGSET_MSGTIMEOUT_MIN; - M->WriteDword(SRMSGMOD, SRMSGSET_MSGTIMEOUT, PluginConfig.m_MsgTimeout); - - M->WriteByte(SRMSGMOD_T, "historysize", (BYTE)SendDlgItemMessage(hwndDlg, IDC_HISTORYSIZESPIN, UDM_GETPOS, 0, 0)); - PluginConfig.reloadAdv(); - return TRUE; - } - } - break; - } - break; - - case WM_COMMAND: - if (LOWORD(wParam) == IDC_PLUS_HELP) { - CallService(MS_UTILS_OPENURL, 0, (LPARAM)"http://wiki.miranda.or.at/TabSRMM/AdvancedTweaks"); - break; - } - else if (LOWORD(wParam) == IDC_PLUS_REVERT) { // revert to defaults... - TOptionListItem *lvItems = CTranslator::getTree(CTranslator::TREE_MODPLUS); - - for (int i=0; lvItems[i].szName; i++) - if (lvItems[i].uType == LOI_TYPE_SETTING) - M->WriteByte(SRMSGMOD_T, (char *)lvItems[i].lParam, (BYTE)lvItems[i].id); - - TreeView_DeleteAllItems(GetDlgItem(hwndDlg, IDC_PLUS_CHECKTREE)); - FillDialog(hwndDlg); - break; - } - if (HIWORD(wParam) != EN_CHANGE || (HWND) lParam != GetFocus()) - return TRUE; - - SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); - break; - - case WM_CLOSE: - EndDialog(hwndDlg,0); - return 0; - } - return 0; -} -- cgit v1.2.3