From 5b0a53a6d3f1b8d70b34631d96d3815d0a334dd3 Mon Sep 17 00:00:00 2001 From: Vadim Dashevskiy Date: Mon, 16 Jul 2012 16:31:53 +0000 Subject: Clist_mw, Clist_nicer, CmdLine, Console: folder structure change git-svn-id: http://svn.miranda-ng.org/main/trunk@988 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Console/Console.cpp | 1430 -------------------------- plugins/Console/Console.vcxproj | 42 +- plugins/Console/Console.vcxproj.filters | 66 +- plugins/Console/Console_history.txt | 179 ---- plugins/Console/Console_readme.txt | 21 - plugins/Console/commonheaders.cpp | 24 - plugins/Console/commonheaders.h | 68 -- plugins/Console/console-translation.txt | 38 - plugins/Console/docs/Console_history.txt | 179 ++++ plugins/Console/docs/Console_readme.txt | 21 + plugins/Console/docs/console-translation.txt | 38 + plugins/Console/docs/gpl.txt | 340 ++++++ plugins/Console/gpl.txt | 340 ------ plugins/Console/init.cpp | 74 -- plugins/Console/res/resource.rc | 171 +++ plugins/Console/res/version.rc | 63 ++ plugins/Console/resource.h | 58 -- plugins/Console/resource.rc | 176 ---- plugins/Console/src/Console.cpp | 1430 ++++++++++++++++++++++++++ plugins/Console/src/commonheaders.cpp | 24 + plugins/Console/src/commonheaders.h | 68 ++ plugins/Console/src/init.cpp | 74 ++ plugins/Console/src/resource.h | 58 ++ plugins/Console/src/version.h | 41 + plugins/Console/version.h | 41 - plugins/Console/version.rc | 65 -- 26 files changed, 2527 insertions(+), 2602 deletions(-) delete mode 100644 plugins/Console/Console.cpp delete mode 100644 plugins/Console/Console_history.txt delete mode 100644 plugins/Console/Console_readme.txt delete mode 100644 plugins/Console/commonheaders.cpp delete mode 100644 plugins/Console/commonheaders.h delete mode 100644 plugins/Console/console-translation.txt create mode 100644 plugins/Console/docs/Console_history.txt create mode 100644 plugins/Console/docs/Console_readme.txt create mode 100644 plugins/Console/docs/console-translation.txt create mode 100644 plugins/Console/docs/gpl.txt delete mode 100644 plugins/Console/gpl.txt delete mode 100644 plugins/Console/init.cpp create mode 100644 plugins/Console/res/resource.rc create mode 100644 plugins/Console/res/version.rc delete mode 100644 plugins/Console/resource.h delete mode 100644 plugins/Console/resource.rc create mode 100644 plugins/Console/src/Console.cpp create mode 100644 plugins/Console/src/commonheaders.cpp create mode 100644 plugins/Console/src/commonheaders.h create mode 100644 plugins/Console/src/init.cpp create mode 100644 plugins/Console/src/resource.h create mode 100644 plugins/Console/src/version.h delete mode 100644 plugins/Console/version.h delete mode 100644 plugins/Console/version.rc (limited to 'plugins/Console') diff --git a/plugins/Console/Console.cpp b/plugins/Console/Console.cpp deleted file mode 100644 index b04be4dc39..0000000000 --- a/plugins/Console/Console.cpp +++ /dev/null @@ -1,1430 +0,0 @@ -/* - -Miranda IM: the free IM client for Microsoft* Windows* - -Copyright 2000-2008 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. -*/ - -#include "commonheaders.h" - -#define MS_CONSOLE_SHOW_HIDE "Console/Show/Hide" - -#define DEFAULT_WRAPLEN 90 -#define MIN_WRAPLEN 25 -#define MAX_WRAPLEN 255 - -#define MIN_LIMIT 1000 -#define MAX_LIMIT 1000000 - -#define IMG_EMPTY 0 -#define IMG_ARROW 1 -#define IMG_IN 2 -#define IMG_OUT 3 -#define IMG_INFO 4 - -#define LOGICONX_SIZE 10 -#define LOGICONY_SIZE 10 - -#define ICON_FIRST 3 - -#define ICON_NOSCROLL 1 -#define ICON_PAUSED 2 -#define ICON_SCROLL 3 -#define ICON_STARTED 4 - -#define HM_DUMP (WM_USER+10) -#define HM_ADD (WM_USER+11) -#define HM_REMOVE (WM_USER+12) -#define HM_SETFONT (WM_USER+13) -#define HM_SETCOLOR (WM_USER+14) -#define HM_PAUSEALL (WM_USER+15) -#define HM_RESTART (WM_USER+16) - - -typedef struct { - const char* pszHead; - const char* pszMsg; -} LOGMSG; - - -typedef struct { - char szModule[128]; - TCHAR szMsg[1]; -} DUMPMSG; - - -typedef struct { - HWND hwnd; - HWND hList; - char *Module; - int Scroll; - int Paused; - int newline; -} LOGWIN; - - - -static SortedList lModules = {0}; - -static LOGWIN *pActive = NULL; -static int tabCount = 0; -static RECT rcTabs = {0}; -static HWND hTabs = NULL; -static HWND hwndConsole = NULL; - -static HIMAGELIST gImg = NULL; -static HFONT hfLogFont = NULL; - -static int gIcons = 0; -static int gVisible = 0; -static int gSingleMode = 0; -static int gLimit = 0; -static int gSeparator = 0; - -static DWORD gWrapLen = DEFAULT_WRAPLEN; - -static DWORD OutMsgs = 0; -static DWORD InMsgs = 0; - -static HICON hIcons[15] = {0}; -static HANDLE hMenu = NULL; - -static void LoadSettings(); -static void ShowConsole(int show); -static INT_PTR ShowHideConsole(WPARAM wParam, LPARAM lParam); -static int Openfile(TCHAR *outputFile, int selection); - -//////////////////////////////////////////////////////////////////////////////// - -static HANDLE hTTBButt = 0; - -static INT_PTR HideConsoleButt(WPARAM wParam,LPARAM lParam) -{ - ShowConsole(0); - return 0; -} - -static INT_PTR ShowConsoleButt(WPARAM wParam,LPARAM lParam) -{ - ShowConsole(1); - return 0; -} - -static int OnTTBLoaded(WPARAM wParam,LPARAM lParam) -{ - if ( !IsWindow(hwndConsole)) - return 0; - - int state = IsWindowVisible(hwndConsole); - - CreateServiceFunction("Console/Hide", HideConsoleButt); - CreateServiceFunction("Console/Show", ShowConsoleButt); - - TTBButton ttbb = {0}; - ttbb.cbSize = sizeof(ttbb); - - TCHAR szModuleFileName[MAX_PATH]={0}; - GetModuleFileName(hInst, szModuleFileName, SIZEOF(szModuleFileName)); - - SKINICONDESC sid={0}; - sid.cbSize = sizeof(sid); - sid.pszSection = "Console"; - sid.ptszDefaultFile = szModuleFileName; - sid.flags = SIDF_PATH_TCHAR; - sid.pszDescription = "Show"; - sid.pszName = "Console_Up"; - sid.iDefaultIndex = -IDI_BTN_UP; - ttbb.hIconHandleUp = Skin_AddIcon(&sid); - - sid.pszDescription = "Hide"; - sid.pszName = "Console_Down"; - sid.iDefaultIndex = -IDI_BTN_DN; - ttbb.hIconHandleDn = Skin_AddIcon(&sid); - - ttbb.dwFlags = (state ? TTBBF_PUSHED : 0) | TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP; - ttbb.pszService = "Console/Hide"; - ttbb.name = LPGEN("Show/Hide Console"); - ttbb.pszTooltipDn = LPGEN("Hide Console"); - ttbb.pszTooltipUp = LPGEN("Show Console"); - hTTBButt = TopToolbar_AddButton(&ttbb); - if (hTTBButt) - CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)hTTBButt, (LPARAM)(state?TTBST_PUSHED:TTBST_RELEASED)); - - return 0; -} - -//////////////////////////////////////////////////////////////////////////////// - -void ScrollDown(LOGWIN * dat) { - if (dat->Scroll) - ListView_EnsureVisible(dat->hList, ListView_GetItemCount(dat->hList) - 1, FALSE); -} - -//////////////////////////////////////////////////////////////////////////////// - -static void ShowConsole(int show) -{ - HWND hwnd = NULL; - - if (!hwndConsole || !pActive) return; - - gVisible = show; - - if (show) { - hwnd = GetForegroundWindow(); - if ( InMsgs == OutMsgs ) - ScrollDown( pActive ); - } - ShowWindow(hwndConsole, (show)?SW_SHOW:SW_HIDE); - DBWriteContactSettingByte(NULL,"Console","Show",(BYTE)((show)?1:0)); - - if (hwnd) - SetForegroundWindow(hwnd); - - if (show) - RedrawWindow(pActive->hList, NULL, NULL, RDW_INVALIDATE | RDW_FRAME |RDW_UPDATENOW | RDW_ERASE); - - if (hMenu) - { - CLISTMENUITEM mi = {0}; - - mi.cbSize = sizeof(mi); - mi.ptszName=(show)?TranslateT("Hide Console"):TranslateT("Show Console"); - mi.flags = CMIM_NAME | CMIF_TCHAR; - CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenu, (LPARAM)&mi); - } - - if (hTTBButt) - CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)hTTBButt, (show)?TTBST_PUSHED:TTBST_RELEASED); -} - -//////////////////////////////////////////////////////////////////////////////// - -static INT_PTR ShowHideConsole(WPARAM wParam, LPARAM lParam) -{ - if (hwndConsole) - ShowConsole(!IsWindowVisible(hwndConsole)); - - return 0; -} - -//////////////////////////////////////////////////////////////////////////////// - -int LogResize(HWND hwnd,LPARAM lParam,UTILRESIZECONTROL *urc) -{ - switch(urc->wId) { - case IDC_LIST: - ListView_SetColumnWidth(GetDlgItem(hwnd, IDC_LIST), 0, urc->dlgNewSize.cx - 25); - return RD_ANCHORX_WIDTH|RD_ANCHORY_HEIGHT; - case IDC_STARTALL: - case IDC_PAUSEALL: - case IDC_CLOSE: - return RD_ANCHORX_RIGHT|RD_ANCHORY_TOP; - default: - return RD_ANCHORX_LEFT|RD_ANCHORY_TOP; - } -} - -//////////////////////////////////////////////////////////////////////////////// - -typedef struct -{ - UINT control; - UINT icon; - int type; - TCHAR *tooltip; -} controlinfo; - - -static controlinfo ctrls[] = -{ - // IDC_SCROLL & IDC_PAUSE must be first - {IDC_SCROLL, IDI_SCROLL, BUTTONSETASFLATBTN, _T("Scrolling (Ctrl+Q)")}, - {IDC_PAUSE, IDI_STARTED, BUTTONSETASFLATBTN, _T("Pause logging(Ctrl+P)")}, - {IDC_SAVE, IDI_SAVE, BUTTONSETASFLATBTN, _T("Save log to file (Ctrl+S)")}, - {IDC_COPY, IDI_COPY, BUTTONSETASFLATBTN, _T("Copy selected log (Ctrl+C)")}, - {IDC_DELETE, IDI_DELETE, BUTTONSETASFLATBTN, _T("Delete selected (Del)")}, - {IDC_OPTIONS, IDI_OPTIONS, BUTTONSETASFLATBTN, _T("Log options (Ctrl+O)")}, - {IDC_STARTALL, IDI_START, BUTTONSETASFLATBTN, _T("Start logging in all tabs")}, - {IDC_PAUSEALL, IDI_PAUSE, BUTTONSETASFLATBTN, _T("Pause logging in all tabs")}, - {IDC_CLOSE, IDI_CLOSE, BUTTONSETASFLATBTN, _T("Close tab (Ctrl+W)")}, -}; - -//////////////////////////////////////////////////////////////////////////////// - -static LRESULT CALLBACK SubclassProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam) -{ - int ctrl = GetKeyState(VK_CONTROL)&0x8000; - - switch (msg) { - - case WM_KEYDOWN: - if ( wParam == VK_DELETE && !ctrl) { - SendMessage(GetParent(hwnd), WM_COMMAND, IDC_DELETE, 0); - break; - } - - if (wParam == VK_LEFT && ctrl) - { - NMHDR nmhdr = {0}; - int tab = TabCtrl_GetCurSel(hTabs); - - if (tab == 0) - tab = TabCtrl_GetItemCount(hTabs)-1; - else - tab--; - - TabCtrl_SetCurSel(hTabs, tab); - nmhdr.code = TCN_SELCHANGE; - SendMessage(hwndConsole, WM_NOTIFY, IDC_TABS, (LPARAM)&nmhdr); - break; - } - - if (wParam == VK_RIGHT && ctrl) - { - NMHDR nmhdr = {0}; - int tab = TabCtrl_GetCurSel(hTabs); - int count = TabCtrl_GetItemCount(hTabs); - tab = (tab + 1) % count; - - TabCtrl_SetCurSel(hTabs, tab); - nmhdr.code = TCN_SELCHANGE; - SendMessage(hwndConsole, WM_NOTIFY, IDC_TABS, (LPARAM)&nmhdr); - break; - } - - break; - - case WM_CHAR: -/* - { - char t[32]; - sprintf(t,"%u\n",wParam); - OutputDebugStringA(t); - } -*/ - // CTRL - if ( !(GetKeyState(VK_CONTROL)&0x8000)) - break; - - switch(wParam) { - - case 1: // Ctrl+A - if ( ListView_GetSelectedCount(hwnd) != (UINT)ListView_GetItemCount(hwnd)) - ListView_SetItemState(hwnd, -1, LVIS_SELECTED, LVIS_SELECTED); - return 0; - - case 3: // Ctrl+D - SendMessage(GetParent(hwnd), WM_COMMAND, IDC_COPY, 0); - return 0; - - case 15: // Ctrl+O - SendMessage(GetParent(hwnd), WM_COMMAND, IDC_OPTIONS, 0); - return 0; - - case 16: // Ctrl+P - SendMessage(GetParent(hwnd), WM_COMMAND, IDC_PAUSE, 0); - return 0; - - case 17: // Ctrl+Q - SendMessage(GetParent(hwnd), WM_COMMAND, IDC_SCROLL, 0); - return 0; - - case 19: // Ctrl+S - SendMessage(GetParent(hwnd), WM_COMMAND, IDC_SAVE, 0); - return 0; - - case 23: // Ctrl+W - SendMessage(GetParent(hwnd), WM_COMMAND, IDC_CLOSE, 0); - return 0; - } - break; - } - return CallWindowProc((WNDPROC)GetWindowLongPtr(hwnd, GWLP_USERDATA),hwnd,msg,wParam,lParam); -} - -//////////////////////////////////////////////////////////////////////////////// - -static INT_PTR CALLBACK LogDlgProc(HWND hwndDlg,UINT message,WPARAM wParam,LPARAM lParam) -{ - - LOGWIN *dat = (LOGWIN*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); - - switch(message) { - case WM_INITDIALOG: - { - dat = (LOGWIN*)lParam; - - dat->hwnd = hwndDlg; - dat->Scroll = 1; - dat->Paused = 0; - dat->hList = GetDlgItem(hwndDlg, IDC_LIST); - - SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG)dat); - SetWindowLongPtr(dat->hList, GWLP_USERDATA, SetWindowLongPtr(dat->hList, GWLP_WNDPROC, (LONG)SubclassProc)); - - // init buttons - { - int i; - HWND hwnd; - for(i = 0; i < SIZEOF(ctrls); i++) { - hwnd = GetDlgItem(hwndDlg,ctrls[i].control); - SendMessage(hwnd, ctrls[i].type, 0, 0); - SendMessage(hwnd, BM_SETIMAGE,IMAGE_ICON,(LPARAM)hIcons[i+ICON_FIRST]); - SendMessage(hwnd, BUTTONADDTOOLTIP,(WPARAM)TranslateTS(ctrls[i].tooltip), BATF_TCHAR); - } - } - - CheckDlgButton(hwndDlg,IDC_SCROLL,dat->Scroll?BST_CHECKED:BST_UNCHECKED); - SendDlgItemMessage(hwndDlg,IDC_SCROLL,BM_SETIMAGE,IMAGE_ICON,(LPARAM)hIcons[(dat->Scroll?ICON_SCROLL:ICON_NOSCROLL)]); - - if (gSingleMode) - { - ShowWindow(GetDlgItem(hwndDlg, IDC_PAUSEALL), SW_HIDE); - ShowWindow(GetDlgItem(hwndDlg, IDC_STARTALL), SW_HIDE); - ShowWindow(GetDlgItem(hwndDlg, IDC_CLOSE), SW_HIDE); - } - - // init listview - { - LVITEM lvi = {0}; - LVCOLUMN sLC; - //ListView_SetUnicodeFormat(dat->hList, TRUE); - ListView_SetImageList(dat->hList, gImg, LVSIL_SMALL); - sLC.mask = LVCF_FMT | LVCF_WIDTH; - sLC.fmt = LVCFMT_LEFT; - sLC.cx = 630; - ListView_InsertColumn(dat->hList, 0, &sLC); - ListView_SetExtendedListViewStyle(dat->hList, LVS_EX_FULLROWSELECT); - - lvi.mask = LVIF_TEXT; - if (gIcons) - { - lvi.mask |= LVIF_IMAGE; - lvi.iImage = IMG_INFO; - } - - lvi.pszText = TranslateT("*** Console started ***"); - ListView_InsertItem(dat->hList, &lvi); - } - - SendMessage(hwndDlg, WM_SIZE, 0, 0); - break; - } - case HM_DUMP: - { - // lParam = DUMPMSG - if (!lParam) break; - if (dat && !dat->Paused) - { - LVITEM lvi = {0}; - int last = 0x7fffffff; - TCHAR szBreak; - DWORD len, tmplen; - DWORD wraplen = gWrapLen; - TCHAR *str = ((DUMPMSG*)lParam)->szMsg; - - lvi.iItem = 0x7fffffff; - - str = _tcstok(str, _T("\n")); - - if (gIcons && str != NULL) - { - lvi.mask = LVIF_TEXT | LVIF_IMAGE; - - if (_tcsstr(str, _T("Data received"))) - { - if (gSeparator) ListView_InsertItem(dat->hList, &lvi); - lvi.iImage = IMG_IN; - } - else - if (_tcsstr(str, _T("Data sent"))) - { - if (gSeparator) ListView_InsertItem(dat->hList, &lvi); - lvi.iImage = IMG_OUT; - } - else - { - if (gSeparator && dat->newline) - { - ListView_InsertItem(dat->hList, &lvi); - dat->newline = 0; - } - lvi.iImage = IMG_INFO; - } - } else - lvi.mask = LVIF_TEXT; - - while (str != NULL) - { - lvi.pszText = &str[0]; - tmplen = len = (DWORD)_tcslen(lvi.pszText); - - while(len > wraplen) - { - szBreak = lvi.pszText[wraplen]; - lvi.pszText[wraplen] = 0; - last = ListView_InsertItem(dat->hList, &lvi); - lvi.pszText[wraplen] = szBreak; - len -= wraplen; - lvi.pszText = &str[0] + tmplen - len; - - dat->newline = 1; - lvi.iImage = IMG_EMPTY; - } - - if (len && lvi.pszText[len-1] == '\r') - lvi.pszText[len-1] = 0; - - last = ListView_InsertItem(dat->hList, &lvi); - - str = _tcstok(NULL, _T("\n")); - - if (str) dat->newline = 1; - lvi.iImage = IMG_EMPTY; - } - - - if ( gVisible && dat == pActive && dat->Scroll == 1 ) - ListView_EnsureVisible(dat->hList, last, FALSE); - - if (last > gLimit) - { - int idx = last - gLimit + gLimit/4; // leave only 75% of LIMIT - - while (idx >= 0) - { - ListView_DeleteItem(dat->hList, idx); - idx--; - } - } - } - - mir_free((DUMPMSG*)lParam); - return TRUE; - } - case WM_SIZE: - { - UTILRESIZEDIALOG urd={0}; - urd.cbSize=sizeof(urd); - urd.hInstance=hInst; - urd.hwndDlg=hwndDlg; - urd.lpTemplate=MAKEINTRESOURCEA(IDD_LOG); - urd.pfnResizer=LogResize; - SetWindowPos(hwndDlg, HWND_TOP, rcTabs.left, rcTabs.top, rcTabs.right - rcTabs.left, rcTabs.bottom - rcTabs.top, SWP_SHOWWINDOW); - CallService(MS_UTILS_RESIZEDIALOG,0,(LPARAM)&urd); - break; - } - case WM_COMMAND: - { - switch(LOWORD(wParam)) - { - if (!dat) break; - - case IDC_PAUSE: - { - LVITEM lvi = {0}; - dat->Paused = !(dat->Paused); - lvi.mask = LVIF_TEXT | LVIF_IMAGE; - lvi.iImage = IMG_INFO; - lvi.iItem = 0x7FFFFFFF; - lvi.pszText = (dat->Paused) ? TranslateT("*** Console paused ***") : TranslateT("*** Console resumed ***"); - ListView_InsertItem(dat->hList, &lvi); - CheckDlgButton(hwndDlg,IDC_PAUSE,(dat->Paused)?BST_CHECKED:BST_UNCHECKED); - SendDlgItemMessage(hwndDlg,IDC_PAUSE,BM_SETIMAGE,IMAGE_ICON,(LPARAM)hIcons[((dat->Paused)?ICON_PAUSED:ICON_STARTED)]); - break; - } - case IDC_SCROLL: - { - dat->Scroll = !(dat->Scroll); - CheckDlgButton(hwndDlg,IDC_SCROLL,(dat->Scroll)?BST_CHECKED:BST_UNCHECKED); - SendDlgItemMessage(hwndDlg,IDC_SCROLL,BM_SETIMAGE,IMAGE_ICON,(LPARAM)hIcons[((dat->Scroll)?ICON_SCROLL:ICON_NOSCROLL)]); - break; - } - case IDC_COPY: - { - int idx = 0; - TCHAR szText[128]; - TCHAR *src, *dst, *buf; - int flags = LVNI_BELOW; - int count = ListView_GetSelectedCount(dat->hList); - - if (count) - flags |= LVNI_SELECTED; - else - count = ListView_GetItemCount(dat->hList); - - dst = buf = (TCHAR*)malloc((count*(sizeof(szText)+1)+1)*sizeof(TCHAR)); - if (!buf) break; - - while ((idx = ListView_GetNextItem(dat->hList, idx, flags)) > 0) - { - ListView_GetItemText(dat->hList, idx, 0, szText, sizeof(szText)-1); - src = szText; - while (*dst++ = *src++); - dst--; - *dst++ = '\r'; - *dst++ = '\n'; - *dst = 0; - } - - if (dst - buf > 0 && OpenClipboard(hwndDlg)) { - HGLOBAL hClipboardData; - TCHAR* pchData; - EmptyClipboard(); - if (hClipboardData = GlobalAlloc(GMEM_DDESHARE, (dst-buf+1)*sizeof(TCHAR))) { - pchData = (TCHAR*)GlobalLock(hClipboardData); - _tcscpy(pchData, buf); - GlobalUnlock(hClipboardData); - SetClipboardData(CF_UNICODETEXT,hClipboardData); - } - CloseClipboard(); - } - free(buf); - break; - } - case IDC_DELETE: - { - int idx = 0; - int count = ListView_GetSelectedCount(dat->hList); - - if ( !count ) break; - - if ( count == ListView_GetItemCount(dat->hList)) { - LVITEM lvi = {0}; - ListView_DeleteAllItems(dat->hList); - lvi.mask = LVIF_TEXT | LVIF_IMAGE; - lvi.iImage = IMG_INFO; - lvi.pszText = TranslateT("*** Console cleared ***"); - ListView_InsertItem(dat->hList, &lvi); - dat->newline = 0; - break; - } - - while ((idx = ListView_GetNextItem(dat->hList, idx, LVNI_BELOW|LVNI_SELECTED)) > 0) - { - ListView_DeleteItem(dat->hList, idx); - idx--; - } - break; - } - case IDC_SAVE: - { - FILE *fp; - TCHAR szFile[MAX_PATH]; - - if (!Openfile(szFile, ListView_GetSelectedCount(dat->hList))) break; - - fp = _tfopen(szFile, _T("wt")); - if (fp) { - int idx = 0; - TCHAR szText[128]; - int flags = LVNI_BELOW; - if (ListView_GetSelectedCount(dat->hList)) - flags |= LVNI_SELECTED; - - while ((idx = ListView_GetNextItem(dat->hList, idx, flags)) > 0) - { - ListView_GetItemText(dat->hList, idx, 0, szText, SIZEOF(szText)-1); - _ftprintf(fp, _T("%s\n"), szText); - } - fclose(fp); - } - break; - } - case IDC_OPTIONS: - CallServiceSync(MS_NETLIB_LOGWIN,0,0); - break; - case IDC_STARTALL: - SendMessage(hwndConsole, HM_PAUSEALL, 0, 0); - break; - case IDC_PAUSEALL: - SendMessage(hwndConsole, HM_PAUSEALL, 0, 1); - break; - case IDC_CLOSE: - if (tabCount > 1) - SendMessage(hwndDlg, WM_CLOSE, 0, 0); - break; - default: - break; - } - break; - } - case WM_CLOSE: - DestroyWindow(hwndDlg); - break; - case WM_DESTROY: - SetWindowLongPtr(dat->hList, GWLP_WNDPROC, GetWindowLongPtr(dat->hList, GWLP_USERDATA)); - SendMessage(hwndConsole, HM_REMOVE, 0, (LPARAM)dat); - break; - } - - return FALSE; -} - - -//////////////////////////////////////////////////////////////////////////////// - -int ConsoleResize(HWND hwnd,LPARAM lParam,UTILRESIZECONTROL *urc) -{ - switch(urc->wId) { - case IDC_TABS: - return RD_ANCHORX_WIDTH|RD_ANCHORY_HEIGHT; - default: - return RD_ANCHORX_LEFT|RD_ANCHORY_TOP; - } -} - - -static INT_PTR CALLBACK ConsoleDlgProc(HWND hwndDlg,UINT message,WPARAM wParam,LPARAM lParam) -{ - switch(message) { - case WM_INITDIALOG: - { - TCHAR title[MAX_PATH]; - TCHAR name[MAX_PATH] = {0}; - TCHAR path[MAX_PATH] = {0}; - - hTabs = GetDlgItem(hwndDlg, IDC_TABS); - - //TabCtrl_SetMinTabWidth(hTabs, 100); - - // restore position - { - SAVEWINDOWPOS swp; - swp.hwnd=hwndDlg; swp.hContact=NULL; swp.szModule="Console"; swp.szNamePrefix="Console"; - CallService(MS_UTILS_RESTOREWINDOWPOSITION, RWPF_HIDDEN, (LPARAM)&swp); - } - - CallService(MS_DB_GETPROFILENAMET,(WPARAM)MAX_PATH,(LPARAM)name); - - CallService(MS_DB_GETPROFILEPATHT,(WPARAM)MAX_PATH,(LPARAM)path); - - mir_sntprintf(title, MAX_PATH, _T("%s - %s\\%s"), TranslateT("Miranda Console"), path, name); - - SetWindowText(hwndDlg, title); - SendMessage(hwndDlg,WM_SETICON,ICON_BIG,(LPARAM)hIcons[0]); - - hwndConsole = hwndDlg; - SendMessage(hwndDlg, HM_ADD, 0, 0); - PostMessage(hwndDlg, WM_SIZE, 0, 0); - break; - } - case HM_DUMP: - { - // lParam = DUMPMSG - int idx; - LOGWIN *lw; - LOGWIN lw2; - DUMPMSG *dumpMsg = (DUMPMSG*)lParam; - - if (!pActive) { - mir_free(dumpMsg); - break; - } - - if (!gSingleMode) - { - lw2.Module = dumpMsg->szModule; - if (!List_GetIndex(&lModules, &lw2, &idx)) - SendMessage(hwndDlg, HM_ADD, (WPARAM)idx, (LPARAM)dumpMsg->szModule); - - lw = (LOGWIN*)lModules.items[idx]; - } - else - lw = pActive; - - if (lw->hwnd) - SendMessage(lw->hwnd, HM_DUMP, wParam, lParam); - else - PostMessage(hwndDlg, HM_DUMP, wParam, lParam); // loop msg until window will be ready - - return TRUE; - } - case HM_ADD: - { - // wParam = index, lParam = module name - LOGWIN *lw; - COLORREF col; - TCITEM tci = {0}; - int idx = (int)wParam; - char *str = (char*)lParam; - - if (!str) str = ""; // startup window - - lw = (LOGWIN*)mir_calloc( sizeof(LOGWIN)); - lw->Module = (char*)mir_strdup(str); - List_Insert(&lModules, lw, idx); - - if (!gSingleMode && lParam) - { - tci.mask = TCIF_PARAM | TCIF_TEXT; - tci.lParam = (LPARAM)lw; - - tci.pszText = mir_a2u(lw->Module); - idx = TabCtrl_InsertItem(hTabs, tabCount, &tci); - mir_free(tci.pszText); - - tabCount++; - } - - GetClientRect(hTabs, &rcTabs); - TabCtrl_AdjustRect(hTabs, FALSE, &rcTabs); - - CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_LOG), hwndDlg, LogDlgProc, (LPARAM)lw); - ShowWindow(lw->hwnd, (tabCount > 1)?SW_HIDE:SW_SHOWNOACTIVATE); - - if (pActive) - { - col = ListView_GetBkColor(pActive->hList); - ListView_SetBkColor(lw->hList, col); - ListView_SetTextBkColor(lw->hList, col); - - col = ListView_GetTextColor(pActive->hList); - ListView_SetTextColor(lw->hList, col); - - if (hfLogFont) - SendMessage(lw->hList, WM_SETFONT, (WPARAM)hfLogFont, (LPARAM)TRUE); - } - - // hide startup window - if (tabCount == 1) - { - ShowWindow(pActive->hwnd, SW_HIDE); - PostMessage(pActive->hwnd, WM_CLOSE, 0, 0); - pActive = lw; - } - - if (!pActive) - pActive = lw; - - return TRUE; - } - case HM_REMOVE: - { - // lParam = LOGWIN - LOGWIN *lw = (LOGWIN*)lParam; - - if (!lw) break; - - if (lw == pActive) - { - int tab = TabCtrl_GetCurSel(hTabs); - if (tab >= 0) - { - TCITEM tci={0}; - - TabCtrl_DeleteItem(hTabs, tab); - tabCount--; - if (tabCount) - { - tab--; - if (tab < 0 ) tab = 0; - TabCtrl_SetCurSel(hTabs, tab); - - tci.mask = TCIF_PARAM; - TabCtrl_GetItem(hTabs, tab, &tci); - pActive = (LOGWIN*)tci.lParam; - SendMessage(pActive->hwnd, WM_SIZE, 0, 0); - ScrollDown(pActive); - ShowWindow(pActive->hwnd, SW_SHOWNOACTIVATE); - SetFocus(pActive->hList); - } - else - pActive = NULL; - } - } - - List_RemovePtr(&lModules, lw); - mir_free(lw->Module); - mir_free(lw); - return TRUE; - } - case HM_SETFONT: - { - // wParam = font, lParam = font color - int i; - LOGWIN *lw; - for ( i = 0; i < lModules.realCount; i++ ) - { - lw = (LOGWIN*)lModules.items[i]; - ListView_SetTextColor(lw->hList, (COLORREF)lParam); - if (wParam) - SendMessage(lw->hList, WM_SETFONT, wParam, (LPARAM)TRUE); - } - return TRUE; - } - case HM_SETCOLOR: - { - // wParam = font, lParam = background color - int i; - LOGWIN *lw; - for ( i = 0; i < lModules.realCount; i++ ) - { - lw = (LOGWIN*)lModules.items[i]; - ListView_SetBkColor(lw->hList, (COLORREF)lParam); - ListView_SetTextBkColor(lw->hList, (COLORREF)lParam); - if (wParam) - SendMessage(lw->hList, WM_SETFONT, wParam, (LPARAM)TRUE); - } - return TRUE; - } - case HM_PAUSEALL: - { - // lParam = 1 to pause, 0 to start - int i; - LOGWIN *lw; - for ( i = 0; i < lModules.realCount; i++ ) - { - lw = (LOGWIN*)lModules.items[i]; - if (lw->Paused != (int)lParam) - SendMessage(lw->hwnd, WM_COMMAND, IDC_PAUSE, 0); - } - return TRUE; - } - case HM_RESTART: - { - if (pActive) - { - pActive = NULL; - PostMessage(hwndDlg, HM_RESTART, 0, 0); - return TRUE; - } - // close all tabs - if (!lParam) - { - LOGWIN *lw; - TabCtrl_DeleteAllItems(hTabs); - while ( lModules.realCount ) - { - lw = (LOGWIN*)lModules.items[0]; - SendMessage(lw->hwnd, WM_CLOSE, 0, 0); - } - tabCount = 0; - PostMessage(hwndDlg, HM_RESTART, 0, 1); - return TRUE; - } - - LoadSettings(); - SendMessage(hwndDlg, HM_ADD, 0, 0); - PostMessage(hwndDlg, WM_SIZE, 0, 0); - return TRUE; - } - case WM_SETFOCUS: - if (pActive) { - SetFocus(pActive->hList); - } - return TRUE; - case WM_NOTIFY: - switch(wParam) { - case IDC_TABS: - { - LPNMHDR lpnmhdr = (LPNMHDR)lParam; - if (lpnmhdr->code == TCN_SELCHANGE) - { - int newTab = TabCtrl_GetCurSel(hTabs); - if (newTab >= 0 ) - { - TCITEM tci={0}; - HWND hOld = pActive->hwnd; - - tci.mask = TCIF_PARAM; - - if (!TabCtrl_GetItem(hTabs, newTab, &tci)) break; - - pActive = (LOGWIN*)tci.lParam; - - SendMessage(pActive->hwnd, WM_SIZE, 0, 0); - ScrollDown(pActive); - ShowWindow(hOld, SW_HIDE); - ShowWindow(pActive->hwnd, SW_SHOWNOACTIVATE); - SetFocus(pActive->hList); - } else - SendMessage(pActive->hwnd, WM_SIZE, 0, 0); - } - break; - } - } - break; - case WM_SIZE: - { - UTILRESIZEDIALOG urd={0}; - urd.cbSize=sizeof(urd); - urd.hInstance=hInst; - urd.hwndDlg=hwndDlg; - urd.lpTemplate=MAKEINTRESOURCEA(IDD_CONSOLE); - urd.pfnResizer=ConsoleResize; - CallService(MS_UTILS_RESIZEDIALOG,0,(LPARAM)&urd); - - GetClientRect(hTabs, &rcTabs); - TabCtrl_AdjustRect(hTabs, FALSE, &rcTabs); - - if ( pActive ) - SendMessage(pActive->hwnd, WM_SIZE, 0, 0); - break; - } - case WM_GETMINMAXINFO: - { - MINMAXINFO *mmi=(MINMAXINFO*)lParam; - mmi->ptMinTrackSize.x=400; - mmi->ptMinTrackSize.y=200; - break; - } - case WM_CLOSE: - if ( lParam != 1 ) { - Utils_SaveWindowPosition(hwndDlg,NULL,"Console","Console"); - ShowConsole(0); - return TRUE; - } else - DestroyWindow(hwndDlg); - break; - case WM_DESTROY: - pActive = NULL; - if (hfLogFont) DeleteObject(hfLogFont); - PostQuitMessage(0); - break; - } - - return FALSE; -} - - -//////////////////////////////////////////////////////////////////////////////// - - -void __cdecl ConsoleThread(void* arg) -{ - MSG msg; - HWND hwnd; - - hwnd = CreateDialog(hInst,MAKEINTRESOURCE(IDD_CONSOLE),NULL,ConsoleDlgProc); - - if (!hwnd) return; - - while( GetMessage(&msg, NULL, 0, 0) > 0 ) - { - switch(msg.message) { - case HM_DUMP: - OutMsgs++; - break; - } - - if ( IsDialogMessage(hwnd, &msg)) - continue; - - TranslateMessage(&msg); - DispatchMessage(&msg); - } - - hwndConsole = NULL; -} - -/////////////////////////////////////////////////////////////////////////////// - -static int OnFastDump(WPARAM wParam,LPARAM lParam) -{ - if ( pActive ) - { - LOGMSG *logMsg = (LOGMSG*)lParam; - DWORD headlen = (DWORD)strlen(logMsg->pszHead); - DWORD msglen = (DWORD)strlen(logMsg->pszMsg); - DWORD len = (headlen + msglen + 1) * sizeof(TCHAR) + sizeof(DUMPMSG); - DUMPMSG *dumpMsg = (DUMPMSG*)mir_alloc( len ); - TCHAR *str = dumpMsg->szMsg; - - strncpy(dumpMsg->szModule, ((NETLIBUSER*)wParam)->szDescriptiveName, sizeof(dumpMsg->szModule))[ sizeof(dumpMsg->szModule)-1 ] = 0; - - { - wchar_t *ucs2; - - ucs2 = mir_a2u( logMsg->pszHead ); - wcscpy(str, ucs2); - mir_free(ucs2); - - // try to detect utf8 - ucs2 = mir_utf8decodeW( logMsg->pszMsg ); - if ( !ucs2 ) - ucs2 = mir_a2u( logMsg->pszMsg ); - - wcscat( str, ucs2 ); - mir_free( ucs2 ); - } - - InMsgs++; - PostMessage(hwndConsole, HM_DUMP, 0, (LPARAM)dumpMsg); - } - return 0; -} - -/////////////////////////////////////////////////////////////////////////////// - -static void LoadSettings() -{ - gIcons = DBGetContactSettingByte(NULL, "Console", "ShowIcons", 1); - gSeparator = DBGetContactSettingByte(NULL, "Console", "Separator", 1); - gSingleMode = DBGetContactSettingByte(NULL, "Console", "SingleMode", 0); - - gWrapLen = DBGetContactSettingByte(NULL, "Console", "Wrap", DEFAULT_WRAPLEN); - if ( gWrapLen < MIN_WRAPLEN ) gWrapLen = DEFAULT_WRAPLEN; - - gLimit = DBGetContactSettingDword(NULL, "Console", "Limit", MAX_LIMIT); - if (gLimit > MAX_LIMIT) gLimit = MAX_LIMIT; - if (gLimit < MIN_LIMIT) gLimit = MIN_LIMIT; -} - - -static void SaveSettings(HWND hwndDlg) -{ - int len = GetDlgItemInt(hwndDlg, IDC_WRAP, NULL, FALSE); - if (len < MIN_WRAPLEN ) - len = MIN_WRAPLEN; - else - if (len > MAX_WRAPLEN) - len = MAX_WRAPLEN; - - gWrapLen = len; - SetDlgItemInt(hwndDlg, IDC_WRAP, gWrapLen, FALSE); - DBWriteContactSettingByte(NULL, "Console", "Wrap", (BYTE)len); - - len = GetDlgItemInt(hwndDlg, IDC_LIMIT, NULL, FALSE); - if (len < MIN_LIMIT ) - len = MIN_LIMIT; - else - if (len > MAX_LIMIT) - len = MAX_LIMIT; - - gLimit = len; - SetDlgItemInt(hwndDlg, IDC_LIMIT, gLimit, FALSE); - DBWriteContactSettingDword(NULL, "Console", "Limit", len); - - DBWriteContactSettingByte(NULL, "Console", "SingleMode", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SINGLE)); - DBWriteContactSettingByte(NULL, "Console", "Separator", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SEPARATOR)); - DBWriteContactSettingByte(NULL, "Console", "ShowIcons", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWICONS)); - - DBWriteContactSettingByte(NULL, "Console", "ShowAtStart", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_START)); -} - - -static INT_PTR CALLBACK OptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) -{ - switch(msg) { - case WM_INITDIALOG: - TranslateDialogDefault(hwndDlg); - CheckDlgButton(hwndDlg, IDC_START, DBGetContactSettingByte(NULL, "Console", "ShowAtStart", 0)); - CheckDlgButton(hwndDlg, IDC_SINGLE, gSingleMode); - CheckDlgButton(hwndDlg, IDC_SHOWICONS, gIcons); - CheckDlgButton(hwndDlg, IDC_SEPARATOR, gSeparator); - SetDlgItemInt(hwndDlg, IDC_WRAP, gWrapLen, FALSE); - SetDlgItemInt(hwndDlg, IDC_LIMIT, gLimit, FALSE); - break; - case WM_COMMAND: - switch (LOWORD(wParam)) { - case IDC_RESTART: - { - if (!pActive) break; - SaveSettings(hwndDlg); - PostMessage(hwndConsole, HM_RESTART, 0, 0); - break; - } - case IDC_LIMIT: - case IDC_WRAP: - if (HIWORD(wParam) != EN_CHANGE || (HWND) lParam != GetFocus()) - return FALSE; - SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); - break; - case IDC_START: - case IDC_SEPARATOR: - case IDC_SHOWICONS: - case IDC_SINGLE: - SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); - break; - } - break; - case WM_NOTIFY: - switch(((LPNMHDR)lParam)->idFrom) - { - case 0: - switch (((LPNMHDR)lParam)->code) - { - case PSN_APPLY: - { - SaveSettings(hwndDlg); - break; - } - } - break; - } - break; - } - return FALSE; -} - - -static int OptInit(WPARAM wParam,LPARAM lParam) -{ - OPTIONSDIALOGPAGE odp={0}; - odp.cbSize = sizeof(odp); - odp.hInstance = hInst; - odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS); - odp.pszGroup = LPGEN("Network"); - odp.pszTitle = LPGEN("Console"); - odp.pfnDlgProc = OptDlgProc; - odp.flags = ODPF_BOLDGROUPS; - odp.expertOnlyControls = NULL; - Options_AddPage(wParam, &odp); - return 0; -} - -/////////////////////////////////////////////////////////////////////////////// - -static int OnColourChange(WPARAM wParam,LPARAM lParam) -{ - if (hwndConsole) - { - ColourID cid = {0}; - COLORREF col; - - cid.cbSize=sizeof(cid); - strcpy(cid.group,"Console"); - strcpy(cid.name,"Background"); - strcpy(cid.dbSettingsGroup,"Console"); - strcpy(cid.setting,"BgColor"); - - col = (COLORREF)CallService(MS_COLOUR_GET,(WPARAM)&cid,0); - if (col != -1) - SendMessage(hwndConsole, HM_SETCOLOR, (WPARAM)hfLogFont, (LPARAM)col); - } - return 0; -} - - -static int OnFontChange(WPARAM wParam,LPARAM lParam) -{ - if (hwndConsole) - { - COLORREF col; - HFONT hf = NULL; - LOGFONT LogFont={0}; - FontIDT fid={0}; - fid.cbSize=sizeof(fid); - - _tcscpy(fid.group,_T("Console")); - _tcscpy(fid.name,TranslateT("Text")); - - col = (COLORREF)CallService(MS_FONT_GETT,(WPARAM)&fid,(LPARAM)&LogFont); - - if (LogFont.lfHeight != 0) - { - hf=CreateFontIndirect(&LogFont); - - SendMessage(hwndConsole, HM_SETFONT, (WPARAM)hf, (LPARAM)col); - - if (hfLogFont) - DeleteObject(hfLogFont); - hfLogFont = hf; - } - } - return 0; -} - -static int OnSystemModulesLoaded(WPARAM wParam,LPARAM lParam) -{ - HookEvent( ME_NETLIB_FASTDUMP, OnFastDump ); - - CreateServiceFunction(MS_CONSOLE_SHOW_HIDE, ShowHideConsole); - - FontIDT fid = {0}; - fid.cbSize = sizeof(fid); - _tcscpy(fid.group,_T("Console")); - _tcscpy(fid.name,TranslateT("Text")); - strcpy(fid.dbSettingsGroup,"Console"); - strcpy(fid.prefix,"ConsoleFont"); - _tcscpy(fid.backgroundGroup,_T("Console")); - _tcscpy(fid.backgroundName,_T("Background")); - fid.flags = FIDF_DEFAULTVALID; - fid.deffontsettings.charset = DEFAULT_CHARSET; - fid.deffontsettings.colour = RGB(0, 0, 0); - fid.deffontsettings.size = 10; - fid.deffontsettings.style = 0; - _tcsncpy(fid.deffontsettings.szFace, _T("Courier"), LF_FACESIZE); - FontRegisterT(&fid); - - HookEvent(ME_FONT_RELOAD,OnFontChange); - - ColourIDT cid = {0}; - cid.cbSize=sizeof(cid); - _tcscpy(cid.group,_T("Console")); - _tcscpy(cid.name,_T("Background")); - strcpy(cid.dbSettingsGroup,"Console"); - strcpy(cid.setting,"BgColor"); - cid.defcolour = RGB(255,255,255); - ColourRegisterT(&cid); - - HookEvent(ME_COLOUR_RELOAD, OnColourChange); - - HOTKEYDESC hkd = {0}; - hkd.cbSize = sizeof(hkd); - hkd.pszName = "Console_Show_Hide"; - hkd.pszDescription = LPGEN("Show/Hide Console"); - hkd.pszSection = "Main"; - hkd.pszService = MS_CONSOLE_SHOW_HIDE; - hkd.DefHotKey = HOTKEYCODE(HOTKEYF_EXT, 'C'); - Hotkey_Register(&hkd); - - if (hwndConsole && IsWindow(hwndConsole)) - { - CLISTMENUITEM mi={0}; - HookEvent(ME_TTB_MODULELOADED, OnTTBLoaded); - mi.cbSize=sizeof(mi); - mi.flags=CMIF_TCHAR; - mi.hIcon=hIcons[0]; - mi.ptszPopupName=TranslateT("&Help"); - mi.popupPosition=2000090000; - mi.position=1000000000; - mi.ptszName=(IsWindowVisible(hwndConsole))?TranslateT("Hide Console"):TranslateT("Show Console"); - mi.pszService=MS_CONSOLE_SHOW_HIDE; - hMenu = Menu_AddMainMenuItem(&mi); - - OnFontChange(0,0); - OnColourChange(0,0); - - if (DBGetContactSettingByte(NULL,"Console","ShowAtStart",0) || DBGetContactSettingByte(NULL,"Console","Show",1)) - ShowConsole(1); - else - ShowConsole(0); - } - - return 0; -} - -static int PreshutdownConsole(WPARAM wParam,LPARAM lParam) -{ - if (hwndConsole) - PostMessage(hwndConsole, WM_CLOSE, 0, 1 ); - - return 0; -} - -/////////////////////////////////////////////////////////////////////////////// - -static int stringCompare( LOGWIN *lw1, LOGWIN *lw2 ) -{ - return strcmp( lw1->Module, lw2->Module ); -} - -/////////////////////////////////////////////////////////////////////////////// - -static UINT logicons[] = {IDI_EMPTY, IDI_ARROW, IDI_IN, IDI_OUT, IDI_INFO}; - - -void InitConsole() -{ - int i; - HICON hi; - - lModules.sortFunc = (FSortFunc)stringCompare; - lModules.increment = 5; - - hIcons[0] = LoadIcon(hInst, MAKEINTRESOURCE(IDI_CONSOLE)); - hIcons[1] = (HICON)LoadImage(hInst,MAKEINTRESOURCE(IDI_NOSCROLL),IMAGE_ICON,GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),0); - hIcons[2] = (HICON)LoadImage(hInst,MAKEINTRESOURCE(IDI_PAUSED),IMAGE_ICON,GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),0); - - for(i = 0; i < SIZEOF(ctrls); i++) { - hIcons[i+ICON_FIRST] = (HICON)LoadImage(hInst,MAKEINTRESOURCE(ctrls[i].icon),IMAGE_ICON,GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),0); - } - - gImg = ImageList_Create(LOGICONX_SIZE, LOGICONY_SIZE, ILC_COLOR24 | ILC_MASK, SIZEOF(logicons), 0); - - for(i = 0; i < SIZEOF(logicons); i++) - { - hi = (HICON)LoadImage(hInst,MAKEINTRESOURCE(logicons[i]),IMAGE_ICON,LOGICONX_SIZE,LOGICONY_SIZE,0); - if (hi) - { - ImageList_AddIcon(gImg, hi); - DestroyIcon(hi); - } - } - - LoadSettings(); - - mir_forkthread(ConsoleThread, 0); - - HookEvent(ME_SYSTEM_PRESHUTDOWN, PreshutdownConsole); - HookEvent(ME_SYSTEM_MODULESLOADED, OnSystemModulesLoaded); - HookEvent(ME_OPT_INITIALISE, OptInit); - HookEvent(ME_NETLIB_FASTDUMP, OnFastDump); -} - -void ShutdownConsole(void) -{ - int i; - - List_Destroy(&lModules); - - if (gImg) ImageList_Destroy(gImg); - - for(i = 0; i < SIZEOF(hIcons); i++) { - if (hIcons[i]) DestroyIcon(hIcons[i]); - } -} - -//////////////////////////////////////////////////////////////////////////////// - -TCHAR *addstring(TCHAR *str, TCHAR *add) { - _tcscpy(str,add); - return str + _tcslen(add) + 1; -} - - -static int Openfile(TCHAR *outputFile, int selection) -{ - OPENFILENAME ofn = {0}; - TCHAR filename[MAX_PATH+2] = _T(""); - TCHAR *title; - - TCHAR *filter, *tmp, *tmp1, *tmp2; - tmp1 = TranslateT("Text Files (*.txt)"); - tmp2 = TranslateT("All Files"); - filter = tmp = (TCHAR*)_alloca((_tcslen(tmp1)+_tcslen(tmp2)+11)*sizeof(TCHAR)); - tmp = addstring(tmp, tmp1); - tmp = addstring(tmp, _T("*.TXT")); - tmp = addstring(tmp, tmp2); - tmp = addstring(tmp, _T("*")); - *tmp = 0; - - if (selection) - title = TranslateT("Save selection to file"); - else - title = TranslateT("Save log to file"); - - ofn.lStructSize = sizeof(ofn); - ofn.lpstrFile = filename; - ofn.lpstrFilter = filter; - ofn.Flags = OFN_HIDEREADONLY | OFN_SHAREAWARE | OFN_PATHMUSTEXIST | OFN_OVERWRITEPROMPT; - ofn.lpstrTitle = title; - ofn.nMaxFile = MAX_PATH; - ofn.lpstrDefExt = _T("txt"); - - if (!GetSaveFileName(&ofn)) - return 0; - _tcscpy(outputFile, filename); - return 1; -} - -//////////////////////////////////////////////////////////////////////////////// diff --git a/plugins/Console/Console.vcxproj b/plugins/Console/Console.vcxproj index 821004cc92..578ba3c195 100644 --- a/plugins/Console/Console.vcxproj +++ b/plugins/Console/Console.vcxproj @@ -73,7 +73,7 @@ Disabled ..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_WINDOWS;_USRDLL;Console_EXPORTS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) + WIN32;_DEBUG;_WINDOWS;_USRDLL;Console_EXPORTS;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebugDLL Use @@ -97,7 +97,7 @@ Disabled ..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories) - WIN64;_DEBUG;_WINDOWS;_USRDLL;Console_EXPORTS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) + WIN64;_DEBUG;_WINDOWS;_USRDLL;Console_EXPORTS;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebugDLL Use @@ -121,7 +121,7 @@ Full AnySuitable ..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_WINDOWS;_USRDLL;Console_EXPORTS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) + WIN32;NDEBUG;_WINDOWS;_USRDLL;Console_EXPORTS;%(PreprocessorDefinitions) true true Use @@ -148,7 +148,7 @@ Full AnySuitable ..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories) - WIN64;NDEBUG;_WINDOWS;_USRDLL;Console_EXPORTS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) + WIN64;NDEBUG;_WINDOWS;_USRDLL;Console_EXPORTS;%(PreprocessorDefinitions) true true Use @@ -171,38 +171,20 @@ - + Create - - + + - - - + + + - - - - - - - - - - - - - - - - - - - - + + diff --git a/plugins/Console/Console.vcxproj.filters b/plugins/Console/Console.vcxproj.filters index 7cb1fc485a..ddbba4e23a 100644 --- a/plugins/Console/Console.vcxproj.filters +++ b/plugins/Console/Console.vcxproj.filters @@ -15,82 +15,32 @@ - + Source Files - + Source Files - + Source Files - + Header Files - + Header Files - + Header Files - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - - + Resource Files - + Resource Files diff --git a/plugins/Console/Console_history.txt b/plugins/Console/Console_history.txt deleted file mode 100644 index 337cf95b0c..0000000000 --- a/plugins/Console/Console_history.txt +++ /dev/null @@ -1,179 +0,0 @@ -PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND... -ONLY MORAL SUPPORT IN SPECIAL CASES CAN BE PROVIDED 8-) --------------------------------------------------------------------------------- - -v7.3 - -[-] bug fixes - - -v7.2 - -[+] console hot restart (to apply new options) -[+] always show at start option -[*] other small changes - - -v7.1 - -[+] switch tabs with CTRL+Left/Right -[+] log size limitation -[+] icons in log -[+] event separation with empty line -[-] create "(NULL)" tab only on demand -[*] dumping optimization -[*] small changes to compile in VC6 - - -v7.0 - -[+] tabbed mode support (tab for every NETLIB user) -[+] toolbar button for clist modern -[+] options page -[*] other small changes - - -v6.6 - -[+] logging pause button -[*] log scrolling hotkey was changed to Ctrl+Q -[*] more translatable strings -[-] fixed tooltips on buttons - - -v6.5 - -[+] global hotkey to show/hide console (Win+C by default) -[+] common shortcuts in console (Ctrl+C/S/D/A/O, Del) -[*] trying to hook netlib log on load -[*] hi-res console icon - - -v6.4 - -[-] some bugfixes (unicode version only) - - -v6.3 - -[!] NETLIB was removed. using netlib log hook. -[+] unicode support -[+] ansi / utf8 autodetection and conversion -[+] faster startup/shutdown/dumping -[+] variable line wrap length - - -v6.0 - 6.2 - -[!] internal builds - - -v5.4 - -[-] workaround for "\r" in console window -[*] small speed improvements in netlib log dump -[*] merge with SVN (netlib module) - - -v5.3 - -[*] PluginInfoEx was added, some code was replaced with core services (thanx Jazzy$) -[*] merge with SVN (netlib module) - - -v5.2 - -[*] merge with SVN (netlib module) -[*] fix for crash on exit (miranda 0.7 core issue) -[+] save and restore console window position - - -v5.1 - -[-] filter settings were not saved - - -v5.0 - -[+] buttons to copy/delete/save log, open options -[+] ability to select colors and font (fontservice needed) -[*] long lines (>90 chars) are wraped -[+] list-view auto width -[*] destoying all services before unload to prevent crashes - - -v4.0 - -[*] merged with lastest netlib - - -v3.3 - -[-] packet dumps still were not shown in some cases -[+] small optimizations - - -v3.2 - -[-] fixed huge memory leak -[-] packet dumps were not shown if logging to file was off - - -v3.1 - -[!] listview control console window. richedit is too slow - - -v3.0 - -[!] richedit control console window! - -v2.0 - -[?] - -v1.9 - -[+] abitity to remember last console state - -v1.8 - -[+] profile path is shown in console title - -v1.7 - -[?] - - -v1.6 - -[-] fixed AV on msg from NULL (thanx sh8an) -[*] attempt to fix windows shutdown issues with opened miranda - -v1.5 - -[+] ability to log only custom protocols (netlibusers) -[-] console window startup workaround to prevent crashes and other bugs - -v1.4 - -[+] console window writes log even in hidden state (if Log to Console is checked) -[+] ability to hide/show console from main menu and toptoolbar button -[+] open outgoing connections with delay is now optional -[*] console startup code was rewritten -[-] pressing Ctrl+C or Ctrl+Break in console window do not close Miranda any more -[-] now console window always appears on top - -v1.3 - -[+] console window from 0.3x netlib -[+] console buffer is 100 times larger -[+] console text convertion to OEM codepage -[-] close button now always disabled -[*] some changes to unloading - --------------------------------------------------------------------------------- -[!] important note -[+] added feature -[*] improved/changed feature -[-] bug fixed diff --git a/plugins/Console/Console_readme.txt b/plugins/Console/Console_readme.txt deleted file mode 100644 index 6d66f9b061..0000000000 --- a/plugins/Console/Console_readme.txt +++ /dev/null @@ -1,21 +0,0 @@ -Console window plugin for Netlib logging. - -It is designed for Miranda developers & advanced users! 8-) - - -v7 introduced tabs support. Single window mode is also avaliable. -It can be switched in options. Icons and other stuff is avaliable. - -v6 is based on the code of v5 but without NETLIB. it uses new netlib log hook instead. -Netlib filters are still in Log Options but they are not part of console any more :). - -Also: -+ faster startup/shutdown/dumping -+ unicode support -+ ansi / utf8 autodetection and conversion -+ variable line wrap length - -Console window can be opened/closed with: - - (Top)ToolBar button - - MainMenu->Help->Show/Hide Console - - Hotkey using service "Console/Show/Hide" \ No newline at end of file diff --git a/plugins/Console/commonheaders.cpp b/plugins/Console/commonheaders.cpp deleted file mode 100644 index cbfb79d624..0000000000 --- a/plugins/Console/commonheaders.cpp +++ /dev/null @@ -1,24 +0,0 @@ -/* - -Miranda IM: the free IM client for Microsoft* Windows* - -Copyright 2000-2008 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. -*/ - -#include "commonheaders.h" \ No newline at end of file diff --git a/plugins/Console/commonheaders.h b/plugins/Console/commonheaders.h deleted file mode 100644 index 63f5a61622..0000000000 --- a/plugins/Console/commonheaders.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - -Miranda IM: the free IM client for Microsoft* Windows* - -Copyright 2000-2008 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. -*/ - - -#define _WIN32_WINNT 0x0501 - -#pragma comment( lib, "comctl32.lib") - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define MIRANDA_VER 0x0A00 - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "resource.h" - -#include "version.h" - -extern HINSTANCE hInst; - -void InitConsole(); -void ShutdownConsole(); - -#define MS_NETLIB_LOGWIN "Netlib/Log/Win" diff --git a/plugins/Console/console-translation.txt b/plugins/Console/console-translation.txt deleted file mode 100644 index b590fbda35..0000000000 --- a/plugins/Console/console-translation.txt +++ /dev/null @@ -1,38 +0,0 @@ -; Common strings that belong to many files -;[] - -; ../../plugins/Console/Console.cpp -;[&Help] -;[*** Console cleared ***] -;[*** Console paused ***] -;[*** Console resumed ***] -;[*** Console started ***] -;[All Files] -;[Console] -;[Hide Console] -;[Miranda Console] -;[Network] -;[Save log to file] -;[Save selection to file] -;[Show Console] -;[Show/Hide Console] -;[Text] -;[Text Files (*.txt)] - -; ../../plugins/Console/resource.rc -;[&C] -;[&D] -;[&O] -;[&P] -;[&Q] -;[&S] -;[&W] -;[* Restart needed] -;[Always show at start] -;[Console ] -;[Lines wrap length [25-255]] -;[Log size limit [1 000 - 1 000 000 lines]] -;[New lines between events*] -;[Save settings and restart console] -;[Show icons in log*] -;[Single window mode*] diff --git a/plugins/Console/docs/Console_history.txt b/plugins/Console/docs/Console_history.txt new file mode 100644 index 0000000000..337cf95b0c --- /dev/null +++ b/plugins/Console/docs/Console_history.txt @@ -0,0 +1,179 @@ +PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND... +ONLY MORAL SUPPORT IN SPECIAL CASES CAN BE PROVIDED 8-) +-------------------------------------------------------------------------------- + +v7.3 + +[-] bug fixes + + +v7.2 + +[+] console hot restart (to apply new options) +[+] always show at start option +[*] other small changes + + +v7.1 + +[+] switch tabs with CTRL+Left/Right +[+] log size limitation +[+] icons in log +[+] event separation with empty line +[-] create "(NULL)" tab only on demand +[*] dumping optimization +[*] small changes to compile in VC6 + + +v7.0 + +[+] tabbed mode support (tab for every NETLIB user) +[+] toolbar button for clist modern +[+] options page +[*] other small changes + + +v6.6 + +[+] logging pause button +[*] log scrolling hotkey was changed to Ctrl+Q +[*] more translatable strings +[-] fixed tooltips on buttons + + +v6.5 + +[+] global hotkey to show/hide console (Win+C by default) +[+] common shortcuts in console (Ctrl+C/S/D/A/O, Del) +[*] trying to hook netlib log on load +[*] hi-res console icon + + +v6.4 + +[-] some bugfixes (unicode version only) + + +v6.3 + +[!] NETLIB was removed. using netlib log hook. +[+] unicode support +[+] ansi / utf8 autodetection and conversion +[+] faster startup/shutdown/dumping +[+] variable line wrap length + + +v6.0 - 6.2 + +[!] internal builds + + +v5.4 + +[-] workaround for "\r" in console window +[*] small speed improvements in netlib log dump +[*] merge with SVN (netlib module) + + +v5.3 + +[*] PluginInfoEx was added, some code was replaced with core services (thanx Jazzy$) +[*] merge with SVN (netlib module) + + +v5.2 + +[*] merge with SVN (netlib module) +[*] fix for crash on exit (miranda 0.7 core issue) +[+] save and restore console window position + + +v5.1 + +[-] filter settings were not saved + + +v5.0 + +[+] buttons to copy/delete/save log, open options +[+] ability to select colors and font (fontservice needed) +[*] long lines (>90 chars) are wraped +[+] list-view auto width +[*] destoying all services before unload to prevent crashes + + +v4.0 + +[*] merged with lastest netlib + + +v3.3 + +[-] packet dumps still were not shown in some cases +[+] small optimizations + + +v3.2 + +[-] fixed huge memory leak +[-] packet dumps were not shown if logging to file was off + + +v3.1 + +[!] listview control console window. richedit is too slow + + +v3.0 + +[!] richedit control console window! + +v2.0 + +[?] + +v1.9 + +[+] abitity to remember last console state + +v1.8 + +[+] profile path is shown in console title + +v1.7 + +[?] + + +v1.6 + +[-] fixed AV on msg from NULL (thanx sh8an) +[*] attempt to fix windows shutdown issues with opened miranda + +v1.5 + +[+] ability to log only custom protocols (netlibusers) +[-] console window startup workaround to prevent crashes and other bugs + +v1.4 + +[+] console window writes log even in hidden state (if Log to Console is checked) +[+] ability to hide/show console from main menu and toptoolbar button +[+] open outgoing connections with delay is now optional +[*] console startup code was rewritten +[-] pressing Ctrl+C or Ctrl+Break in console window do not close Miranda any more +[-] now console window always appears on top + +v1.3 + +[+] console window from 0.3x netlib +[+] console buffer is 100 times larger +[+] console text convertion to OEM codepage +[-] close button now always disabled +[*] some changes to unloading + +-------------------------------------------------------------------------------- +[!] important note +[+] added feature +[*] improved/changed feature +[-] bug fixed diff --git a/plugins/Console/docs/Console_readme.txt b/plugins/Console/docs/Console_readme.txt new file mode 100644 index 0000000000..6d66f9b061 --- /dev/null +++ b/plugins/Console/docs/Console_readme.txt @@ -0,0 +1,21 @@ +Console window plugin for Netlib logging. + +It is designed for Miranda developers & advanced users! 8-) + + +v7 introduced tabs support. Single window mode is also avaliable. +It can be switched in options. Icons and other stuff is avaliable. + +v6 is based on the code of v5 but without NETLIB. it uses new netlib log hook instead. +Netlib filters are still in Log Options but they are not part of console any more :). + +Also: ++ faster startup/shutdown/dumping ++ unicode support ++ ansi / utf8 autodetection and conversion ++ variable line wrap length + +Console window can be opened/closed with: + - (Top)ToolBar button + - MainMenu->Help->Show/Hide Console + - Hotkey using service "Console/Show/Hide" \ No newline at end of file diff --git a/plugins/Console/docs/console-translation.txt b/plugins/Console/docs/console-translation.txt new file mode 100644 index 0000000000..b590fbda35 --- /dev/null +++ b/plugins/Console/docs/console-translation.txt @@ -0,0 +1,38 @@ +; Common strings that belong to many files +;[] + +; ../../plugins/Console/Console.cpp +;[&Help] +;[*** Console cleared ***] +;[*** Console paused ***] +;[*** Console resumed ***] +;[*** Console started ***] +;[All Files] +;[Console] +;[Hide Console] +;[Miranda Console] +;[Network] +;[Save log to file] +;[Save selection to file] +;[Show Console] +;[Show/Hide Console] +;[Text] +;[Text Files (*.txt)] + +; ../../plugins/Console/resource.rc +;[&C] +;[&D] +;[&O] +;[&P] +;[&Q] +;[&S] +;[&W] +;[* Restart needed] +;[Always show at start] +;[Console ] +;[Lines wrap length [25-255]] +;[Log size limit [1 000 - 1 000 000 lines]] +;[New lines between events*] +;[Save settings and restart console] +;[Show icons in log*] +;[Single window mode*] diff --git a/plugins/Console/docs/gpl.txt b/plugins/Console/docs/gpl.txt new file mode 100644 index 0000000000..45645b4b53 --- /dev/null +++ b/plugins/Console/docs/gpl.txt @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + 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 + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/plugins/Console/gpl.txt b/plugins/Console/gpl.txt deleted file mode 100644 index 45645b4b53..0000000000 --- a/plugins/Console/gpl.txt +++ /dev/null @@ -1,340 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - 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 - - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. diff --git a/plugins/Console/init.cpp b/plugins/Console/init.cpp deleted file mode 100644 index 58943d2c6a..0000000000 --- a/plugins/Console/init.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* - -Miranda IM: the free IM client for Microsoft* Windows* - -Copyright 2000-2008 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. -*/ - -#include "commonheaders.h" - -DWORD mirandaVer; -int hLangpack; -HINSTANCE hInst; - -PLUGININFOEX pluginInfoEx={ - sizeof(PLUGININFOEX), - __PLUGIN_NAME, - __VERSION_DWORD, - __PLUGIN_LONGDESC, - __PLUGIN_AUTHOR, - __PLUGIN_EMAIL, - __PLUGIN_RIGHTS, - __PLUGIN_URL, - UNICODE_AWARE, - MIID_CONSOLE -}; - -BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvReserved) -{ - hInst = hinstDLL; - return TRUE; -} - -extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion) -{ - return &pluginInfoEx; -} - -// we implement service mode interface -static const MUUID interfaces[] = {MIID_LOGWINDOW, MIID_LAST}; -extern "C" __declspec(dllexport) const MUUID* MirandaPluginInterfaces(void) -{ - return interfaces; -} - -extern "C" __declspec(dllexport) int Load(void) -{ - mir_getLP(&pluginInfoEx); - - InitCommonControls(); - InitConsole(); - return 0; -} - -extern "C" __declspec(dllexport) int Unload(void) -{ - ShutdownConsole(); - return 0; -} \ No newline at end of file diff --git a/plugins/Console/res/resource.rc b/plugins/Console/res/resource.rc new file mode 100644 index 0000000000..c6c2718250 --- /dev/null +++ b/plugins/Console/res/resource.rc @@ -0,0 +1,171 @@ +// Microsoft Visual C++ generated resource script. +// +#include "..\src\resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_CONSOLE DIALOGEX 0, 0, 335, 257 +STYLE DS_SETFONT | DS_FIXEDSYS | DS_CENTER | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | + WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME +CAPTION "Console " +FONT 8, "MS Shell Dlg", 0, 0, 0x1 +BEGIN + CONTROL "",IDC_TABS,"SysTabControl32",TCS_FOCUSNEVER | + WS_CLIPSIBLINGS | WS_TABSTOP,0,0,335,257 +END + +IDD_LOG DIALOGEX 0, 0, 335, 257 +STYLE DS_SETFONT | DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN +FONT 10, "Courier", 0, 0, 0x1 +BEGIN + CONTROL "List1",IDC_LIST,"SysListView32",LVS_REPORT | + LVS_SHAREIMAGELISTS | LVS_NOCOLUMNHEADER | + LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,0,18,335,239 + CONTROL "",IDC_SAVE,"MButtonClass",WS_TABSTOP,0,1,14,16, + 0x18000000L + CONTROL "",IDC_PAUSE,"MButtonClass",WS_TABSTOP,16,1,14,16, + 0x18000000L + CONTROL "",IDC_SCROLL,"MButtonClass",WS_TABSTOP,32,1,14,16, + 0x18000000L + CONTROL "",IDC_COPY,"MButtonClass",WS_TABSTOP,48,1,14,16, + 0x18000000L + CONTROL "",IDC_DELETE,"MButtonClass",WS_TABSTOP,64,1,14,16, + 0x18000000L + CONTROL "",IDC_OPTIONS,"MButtonClass",WS_TABSTOP,80,1,14,16, + 0x18000000L + CONTROL "",IDC_STARTALL,"MButtonClass",WS_TABSTOP,278,1,14,16, + 0x18000000L + CONTROL "",IDC_PAUSEALL,"MButtonClass",WS_TABSTOP,294,1,14,16, + 0x18000000L + CONTROL "",IDC_CLOSE,"MButtonClass",WS_TABSTOP,320,1,14,16, + 0x18000000L +END + +IDD_OPTIONS DIALOGEX 0, 0, 314, 239 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_CHILD | WS_VISIBLE +EXSTYLE WS_EX_CONTROLPARENT +FONT 8, "MS Shell Dlg", 0, 0, 0x1 +BEGIN + CONTROL "Single window mode*",IDC_SINGLE,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,8,9,297,10 + CONTROL "Show icons in log*",IDC_SHOWICONS,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,8,24,297,10 + CONTROL "New lines between events*",IDC_SEPARATOR,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,8,39,297,10 + CONTROL "Always show at start",IDC_START,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,8,54,297,10 + EDITTEXT IDC_WRAP,8,69,23,11,ES_RIGHT | ES_NUMBER + EDITTEXT IDC_LIMIT,8,86,59,11,ES_RIGHT | ES_NUMBER + LTEXT "Lines wrap length [25-255]",IDC_STATIC,35,70,272,10 + LTEXT "Log size limit [1 000 - 1 000 000 lines]",IDC_STATIC,71, + 86,236,10 + LTEXT "* Restart needed",IDC_STATIC,8,106,296,10 + PUSHBUTTON "Save settings and restart console",IDC_RESTART,12,129, + 287,17 +END + + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include \r\n" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_COPY ICON "copy.ico" +IDI_CONSOLE ICON "console.ico" +IDI_NOSCROLL ICON "noscroll.ico" +IDI_SCROLL ICON "scroll.ico" +IDI_SAVE ICON "save.ico" +IDI_DELETE ICON "delete.ico" +IDI_OPTIONS ICON "options.ico" +IDI_PAUSED ICON "paused.ico" +IDI_STARTED ICON "started.ico" +IDI_BTN_UP ICON "btn_up.ico" +IDI_BTN_DN ICON "btn_dn.ico" +IDI_CLOSE ICON "close.ico" +IDI_PAUSE ICON "pause.ico" +IDI_START ICON "start.ico" +IDI_IN ICON "in.ico" +IDI_OUT ICON "out.ico" +IDI_ARROW ICON "arrow.ico" +IDI_INFO ICON "info.ico" +IDI_EMPTY ICON "empty.ico" +IDI_CONSOLE_UP ICON "console_up.ico" +IDI_CONSOLE_DOWN ICON "console_dn.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO +BEGIN + IDD_CONSOLE, DIALOG + BEGIN + BOTTOMMARGIN, 256 + END +END +#endif // APSTUDIO_INVOKED + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED diff --git a/plugins/Console/res/version.rc b/plugins/Console/res/version.rc new file mode 100644 index 0000000000..d095fdddac --- /dev/null +++ b/plugins/Console/res/version.rc @@ -0,0 +1,63 @@ +// Microsoft Visual C++ generated resource script. +// +#ifdef APSTUDIO_INVOKED +#error this file is not editable by Microsoft Visual C++ +#endif //APSTUDIO_INVOKED + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include +#include <..\src\version.h> +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION __FILEVERSION_STRING + PRODUCTVERSION __FILEVERSION_STRING + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "000004b0" + BEGIN + VALUE "FileDescription", __PLUGIN_DESC + VALUE "FileVersion", __VERSION_STRING + VALUE "InternalName", __PLUGIN_SHORTNAME + VALUE "LegalCopyright", __PLUGIN_RIGHTS + VALUE "OriginalFilename", __PLUGIN_FILE + VALUE "ProductName", __PLUGIN_SHORTNAME + VALUE "ProductVersion", __VERSION_STRING + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0, 1200 + END +END + +#endif diff --git a/plugins/Console/resource.h b/plugins/Console/resource.h deleted file mode 100644 index a8947819a4..0000000000 --- a/plugins/Console/resource.h +++ /dev/null @@ -1,58 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by resource.rc -// -#define IDI_CONSOLE_UP 100 -#define IDI_CONSOLE_DOWN 101 -#define IDD_MSG 111 -#define IDD_CONSOLE 112 -#define IDD_LOG 113 -#define IDD_OPTIONS 114 -#define IDI_COPY 402 -#define IDI_NOSCROLL 403 -#define IDI_SCROLL 404 -#define IDI_SAVE 405 -#define IDI_DELETE 406 -#define IDI_OPTIONS 407 -#define IDI_PAUSED 408 -#define IDI_STARTED 409 -#define IDI_BTN_UP 410 -#define IDI_BTN_DN 411 -#define IDI_CLOSE 412 -#define IDI_START 413 -#define IDI_PAUSE 414 -#define IDI_IN 415 -#define IDI_OUT 416 -#define IDI_ARROW 417 -#define IDI_INFO 418 -#define IDI_EMPTY 419 -#define IDC_TABS 1000 -#define IDC_LIST 1001 -#define IDC_SAVE 1002 -#define IDC_PAUSE 1003 -#define IDC_SCROLL 1004 -#define IDC_COPY 1005 -#define IDC_DELETE 1006 -#define IDC_OPTIONS 1007 -#define IDI_CONSOLE 1008 -#define IDC_CLOSE 1009 -#define IDC_PAUSEALL 1010 -#define IDC_STARTALL 1011 -#define IDC_SINGLE 1012 -#define IDC_WRAP 1013 -#define IDC_SHOWICONS 1014 -#define IDC_SEPARATOR 1015 -#define IDC_LIMIT 1016 -#define IDC_START 1017 -#define IDC_RESTART 1018 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 115 -#define _APS_NEXT_COMMAND_VALUE 40000 -#define _APS_NEXT_CONTROL_VALUE 1019 -#define _APS_NEXT_SYMED_VALUE 102 -#endif -#endif diff --git a/plugins/Console/resource.rc b/plugins/Console/resource.rc deleted file mode 100644 index 77507e3c77..0000000000 --- a/plugins/Console/resource.rc +++ /dev/null @@ -1,176 +0,0 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include -#include -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_CONSOLE DIALOGEX 0, 0, 335, 257 -STYLE DS_SETFONT | DS_FIXEDSYS | DS_CENTER | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | - WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME -CAPTION "Console " -FONT 8, "MS Shell Dlg", 0, 0, 0x1 -BEGIN - CONTROL "",IDC_TABS,"SysTabControl32",TCS_FOCUSNEVER | - WS_CLIPSIBLINGS | WS_TABSTOP,0,0,335,257 -END - -IDD_LOG DIALOGEX 0, 0, 335, 257 -STYLE DS_SETFONT | DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN -FONT 10, "Courier", 0, 0, 0x1 -BEGIN - CONTROL "List1",IDC_LIST,"SysListView32",LVS_REPORT | - LVS_SHAREIMAGELISTS | LVS_NOCOLUMNHEADER | - LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,0,18,335,239 - CONTROL "",IDC_SAVE,"MButtonClass",WS_TABSTOP,0,1,14,16, - 0x18000000L - CONTROL "",IDC_PAUSE,"MButtonClass",WS_TABSTOP,16,1,14,16, - 0x18000000L - CONTROL "",IDC_SCROLL,"MButtonClass",WS_TABSTOP,32,1,14,16, - 0x18000000L - CONTROL "",IDC_COPY,"MButtonClass",WS_TABSTOP,48,1,14,16, - 0x18000000L - CONTROL "",IDC_DELETE,"MButtonClass",WS_TABSTOP,64,1,14,16, - 0x18000000L - CONTROL "",IDC_OPTIONS,"MButtonClass",WS_TABSTOP,80,1,14,16, - 0x18000000L - CONTROL "",IDC_STARTALL,"MButtonClass",WS_TABSTOP,278,1,14,16, - 0x18000000L - CONTROL "",IDC_PAUSEALL,"MButtonClass",WS_TABSTOP,294,1,14,16, - 0x18000000L - CONTROL "",IDC_CLOSE,"MButtonClass",WS_TABSTOP,320,1,14,16, - 0x18000000L -END - -IDD_OPTIONS DIALOGEX 0, 0, 314, 239 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_CHILD | WS_VISIBLE -EXSTYLE WS_EX_CONTROLPARENT -FONT 8, "MS Shell Dlg", 0, 0, 0x1 -BEGIN - CONTROL "Single window mode*",IDC_SINGLE,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,8,9,297,10 - CONTROL "Show icons in log*",IDC_SHOWICONS,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,8,24,297,10 - CONTROL "New lines between events*",IDC_SEPARATOR,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,8,39,297,10 - CONTROL "Always show at start",IDC_START,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,8,54,297,10 - EDITTEXT IDC_WRAP,8,69,23,11,ES_RIGHT | ES_NUMBER - EDITTEXT IDC_LIMIT,8,86,59,11,ES_RIGHT | ES_NUMBER - LTEXT "Lines wrap length [25-255]",IDC_STATIC,35,70,272,10 - LTEXT "Log size limit [1 000 - 1 000 000 lines]",IDC_STATIC,71, - 86,236,10 - LTEXT "* Restart needed",IDC_STATIC,8,106,296,10 - PUSHBUTTON "Save settings and restart console",IDC_RESTART,12,129, - 287,17 -END - - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include \r\n" - "#include \r\n" - "#include \r\n" - "#include \r\n" - "#include \0" -END - -3 TEXTINCLUDE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -// Icon with lowest ID value placed first to ensure application icon -// remains consistent on all systems. -IDI_COPY ICON "Res\\copy.ico" -IDI_CONSOLE ICON "res\\console.ico" -IDI_NOSCROLL ICON "Res\\noscroll.ico" -IDI_SCROLL ICON "Res\\scroll.ico" -IDI_SAVE ICON "Res\\save.ico" -IDI_DELETE ICON "Res\\delete.ico" -IDI_OPTIONS ICON "Res\\options.ico" -IDI_PAUSED ICON "Res\\paused.ico" -IDI_STARTED ICON "Res\\started.ico" -IDI_BTN_UP ICON "Res\\btn_up.ico" -IDI_BTN_DN ICON "Res\\btn_dn.ico" -IDI_CLOSE ICON "Res\\close.ico" -IDI_PAUSE ICON "Res\\pause.ico" -IDI_START ICON "Res\\start.ico" -IDI_IN ICON "Res\\in.ico" -IDI_OUT ICON "Res\\out.ico" -IDI_ARROW ICON "Res\\arrow.ico" -IDI_INFO ICON "Res\\info.ico" -IDI_EMPTY ICON "Res\\empty.ico" -IDI_CONSOLE_UP ICON "Res\\console_up.ico" -IDI_CONSOLE_DOWN ICON "Res\\console_dn.ico" - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO -BEGIN - IDD_CONSOLE, DIALOG - BEGIN - BOTTOMMARGIN, 256 - END -END -#endif // APSTUDIO_INVOKED - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED diff --git a/plugins/Console/src/Console.cpp b/plugins/Console/src/Console.cpp new file mode 100644 index 0000000000..b04be4dc39 --- /dev/null +++ b/plugins/Console/src/Console.cpp @@ -0,0 +1,1430 @@ +/* + +Miranda IM: the free IM client for Microsoft* Windows* + +Copyright 2000-2008 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. +*/ + +#include "commonheaders.h" + +#define MS_CONSOLE_SHOW_HIDE "Console/Show/Hide" + +#define DEFAULT_WRAPLEN 90 +#define MIN_WRAPLEN 25 +#define MAX_WRAPLEN 255 + +#define MIN_LIMIT 1000 +#define MAX_LIMIT 1000000 + +#define IMG_EMPTY 0 +#define IMG_ARROW 1 +#define IMG_IN 2 +#define IMG_OUT 3 +#define IMG_INFO 4 + +#define LOGICONX_SIZE 10 +#define LOGICONY_SIZE 10 + +#define ICON_FIRST 3 + +#define ICON_NOSCROLL 1 +#define ICON_PAUSED 2 +#define ICON_SCROLL 3 +#define ICON_STARTED 4 + +#define HM_DUMP (WM_USER+10) +#define HM_ADD (WM_USER+11) +#define HM_REMOVE (WM_USER+12) +#define HM_SETFONT (WM_USER+13) +#define HM_SETCOLOR (WM_USER+14) +#define HM_PAUSEALL (WM_USER+15) +#define HM_RESTART (WM_USER+16) + + +typedef struct { + const char* pszHead; + const char* pszMsg; +} LOGMSG; + + +typedef struct { + char szModule[128]; + TCHAR szMsg[1]; +} DUMPMSG; + + +typedef struct { + HWND hwnd; + HWND hList; + char *Module; + int Scroll; + int Paused; + int newline; +} LOGWIN; + + + +static SortedList lModules = {0}; + +static LOGWIN *pActive = NULL; +static int tabCount = 0; +static RECT rcTabs = {0}; +static HWND hTabs = NULL; +static HWND hwndConsole = NULL; + +static HIMAGELIST gImg = NULL; +static HFONT hfLogFont = NULL; + +static int gIcons = 0; +static int gVisible = 0; +static int gSingleMode = 0; +static int gLimit = 0; +static int gSeparator = 0; + +static DWORD gWrapLen = DEFAULT_WRAPLEN; + +static DWORD OutMsgs = 0; +static DWORD InMsgs = 0; + +static HICON hIcons[15] = {0}; +static HANDLE hMenu = NULL; + +static void LoadSettings(); +static void ShowConsole(int show); +static INT_PTR ShowHideConsole(WPARAM wParam, LPARAM lParam); +static int Openfile(TCHAR *outputFile, int selection); + +//////////////////////////////////////////////////////////////////////////////// + +static HANDLE hTTBButt = 0; + +static INT_PTR HideConsoleButt(WPARAM wParam,LPARAM lParam) +{ + ShowConsole(0); + return 0; +} + +static INT_PTR ShowConsoleButt(WPARAM wParam,LPARAM lParam) +{ + ShowConsole(1); + return 0; +} + +static int OnTTBLoaded(WPARAM wParam,LPARAM lParam) +{ + if ( !IsWindow(hwndConsole)) + return 0; + + int state = IsWindowVisible(hwndConsole); + + CreateServiceFunction("Console/Hide", HideConsoleButt); + CreateServiceFunction("Console/Show", ShowConsoleButt); + + TTBButton ttbb = {0}; + ttbb.cbSize = sizeof(ttbb); + + TCHAR szModuleFileName[MAX_PATH]={0}; + GetModuleFileName(hInst, szModuleFileName, SIZEOF(szModuleFileName)); + + SKINICONDESC sid={0}; + sid.cbSize = sizeof(sid); + sid.pszSection = "Console"; + sid.ptszDefaultFile = szModuleFileName; + sid.flags = SIDF_PATH_TCHAR; + sid.pszDescription = "Show"; + sid.pszName = "Console_Up"; + sid.iDefaultIndex = -IDI_BTN_UP; + ttbb.hIconHandleUp = Skin_AddIcon(&sid); + + sid.pszDescription = "Hide"; + sid.pszName = "Console_Down"; + sid.iDefaultIndex = -IDI_BTN_DN; + ttbb.hIconHandleDn = Skin_AddIcon(&sid); + + ttbb.dwFlags = (state ? TTBBF_PUSHED : 0) | TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP; + ttbb.pszService = "Console/Hide"; + ttbb.name = LPGEN("Show/Hide Console"); + ttbb.pszTooltipDn = LPGEN("Hide Console"); + ttbb.pszTooltipUp = LPGEN("Show Console"); + hTTBButt = TopToolbar_AddButton(&ttbb); + if (hTTBButt) + CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)hTTBButt, (LPARAM)(state?TTBST_PUSHED:TTBST_RELEASED)); + + return 0; +} + +//////////////////////////////////////////////////////////////////////////////// + +void ScrollDown(LOGWIN * dat) { + if (dat->Scroll) + ListView_EnsureVisible(dat->hList, ListView_GetItemCount(dat->hList) - 1, FALSE); +} + +//////////////////////////////////////////////////////////////////////////////// + +static void ShowConsole(int show) +{ + HWND hwnd = NULL; + + if (!hwndConsole || !pActive) return; + + gVisible = show; + + if (show) { + hwnd = GetForegroundWindow(); + if ( InMsgs == OutMsgs ) + ScrollDown( pActive ); + } + ShowWindow(hwndConsole, (show)?SW_SHOW:SW_HIDE); + DBWriteContactSettingByte(NULL,"Console","Show",(BYTE)((show)?1:0)); + + if (hwnd) + SetForegroundWindow(hwnd); + + if (show) + RedrawWindow(pActive->hList, NULL, NULL, RDW_INVALIDATE | RDW_FRAME |RDW_UPDATENOW | RDW_ERASE); + + if (hMenu) + { + CLISTMENUITEM mi = {0}; + + mi.cbSize = sizeof(mi); + mi.ptszName=(show)?TranslateT("Hide Console"):TranslateT("Show Console"); + mi.flags = CMIM_NAME | CMIF_TCHAR; + CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenu, (LPARAM)&mi); + } + + if (hTTBButt) + CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)hTTBButt, (show)?TTBST_PUSHED:TTBST_RELEASED); +} + +//////////////////////////////////////////////////////////////////////////////// + +static INT_PTR ShowHideConsole(WPARAM wParam, LPARAM lParam) +{ + if (hwndConsole) + ShowConsole(!IsWindowVisible(hwndConsole)); + + return 0; +} + +//////////////////////////////////////////////////////////////////////////////// + +int LogResize(HWND hwnd,LPARAM lParam,UTILRESIZECONTROL *urc) +{ + switch(urc->wId) { + case IDC_LIST: + ListView_SetColumnWidth(GetDlgItem(hwnd, IDC_LIST), 0, urc->dlgNewSize.cx - 25); + return RD_ANCHORX_WIDTH|RD_ANCHORY_HEIGHT; + case IDC_STARTALL: + case IDC_PAUSEALL: + case IDC_CLOSE: + return RD_ANCHORX_RIGHT|RD_ANCHORY_TOP; + default: + return RD_ANCHORX_LEFT|RD_ANCHORY_TOP; + } +} + +//////////////////////////////////////////////////////////////////////////////// + +typedef struct +{ + UINT control; + UINT icon; + int type; + TCHAR *tooltip; +} controlinfo; + + +static controlinfo ctrls[] = +{ + // IDC_SCROLL & IDC_PAUSE must be first + {IDC_SCROLL, IDI_SCROLL, BUTTONSETASFLATBTN, _T("Scrolling (Ctrl+Q)")}, + {IDC_PAUSE, IDI_STARTED, BUTTONSETASFLATBTN, _T("Pause logging(Ctrl+P)")}, + {IDC_SAVE, IDI_SAVE, BUTTONSETASFLATBTN, _T("Save log to file (Ctrl+S)")}, + {IDC_COPY, IDI_COPY, BUTTONSETASFLATBTN, _T("Copy selected log (Ctrl+C)")}, + {IDC_DELETE, IDI_DELETE, BUTTONSETASFLATBTN, _T("Delete selected (Del)")}, + {IDC_OPTIONS, IDI_OPTIONS, BUTTONSETASFLATBTN, _T("Log options (Ctrl+O)")}, + {IDC_STARTALL, IDI_START, BUTTONSETASFLATBTN, _T("Start logging in all tabs")}, + {IDC_PAUSEALL, IDI_PAUSE, BUTTONSETASFLATBTN, _T("Pause logging in all tabs")}, + {IDC_CLOSE, IDI_CLOSE, BUTTONSETASFLATBTN, _T("Close tab (Ctrl+W)")}, +}; + +//////////////////////////////////////////////////////////////////////////////// + +static LRESULT CALLBACK SubclassProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam) +{ + int ctrl = GetKeyState(VK_CONTROL)&0x8000; + + switch (msg) { + + case WM_KEYDOWN: + if ( wParam == VK_DELETE && !ctrl) { + SendMessage(GetParent(hwnd), WM_COMMAND, IDC_DELETE, 0); + break; + } + + if (wParam == VK_LEFT && ctrl) + { + NMHDR nmhdr = {0}; + int tab = TabCtrl_GetCurSel(hTabs); + + if (tab == 0) + tab = TabCtrl_GetItemCount(hTabs)-1; + else + tab--; + + TabCtrl_SetCurSel(hTabs, tab); + nmhdr.code = TCN_SELCHANGE; + SendMessage(hwndConsole, WM_NOTIFY, IDC_TABS, (LPARAM)&nmhdr); + break; + } + + if (wParam == VK_RIGHT && ctrl) + { + NMHDR nmhdr = {0}; + int tab = TabCtrl_GetCurSel(hTabs); + int count = TabCtrl_GetItemCount(hTabs); + tab = (tab + 1) % count; + + TabCtrl_SetCurSel(hTabs, tab); + nmhdr.code = TCN_SELCHANGE; + SendMessage(hwndConsole, WM_NOTIFY, IDC_TABS, (LPARAM)&nmhdr); + break; + } + + break; + + case WM_CHAR: +/* + { + char t[32]; + sprintf(t,"%u\n",wParam); + OutputDebugStringA(t); + } +*/ + // CTRL + if ( !(GetKeyState(VK_CONTROL)&0x8000)) + break; + + switch(wParam) { + + case 1: // Ctrl+A + if ( ListView_GetSelectedCount(hwnd) != (UINT)ListView_GetItemCount(hwnd)) + ListView_SetItemState(hwnd, -1, LVIS_SELECTED, LVIS_SELECTED); + return 0; + + case 3: // Ctrl+D + SendMessage(GetParent(hwnd), WM_COMMAND, IDC_COPY, 0); + return 0; + + case 15: // Ctrl+O + SendMessage(GetParent(hwnd), WM_COMMAND, IDC_OPTIONS, 0); + return 0; + + case 16: // Ctrl+P + SendMessage(GetParent(hwnd), WM_COMMAND, IDC_PAUSE, 0); + return 0; + + case 17: // Ctrl+Q + SendMessage(GetParent(hwnd), WM_COMMAND, IDC_SCROLL, 0); + return 0; + + case 19: // Ctrl+S + SendMessage(GetParent(hwnd), WM_COMMAND, IDC_SAVE, 0); + return 0; + + case 23: // Ctrl+W + SendMessage(GetParent(hwnd), WM_COMMAND, IDC_CLOSE, 0); + return 0; + } + break; + } + return CallWindowProc((WNDPROC)GetWindowLongPtr(hwnd, GWLP_USERDATA),hwnd,msg,wParam,lParam); +} + +//////////////////////////////////////////////////////////////////////////////// + +static INT_PTR CALLBACK LogDlgProc(HWND hwndDlg,UINT message,WPARAM wParam,LPARAM lParam) +{ + + LOGWIN *dat = (LOGWIN*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); + + switch(message) { + case WM_INITDIALOG: + { + dat = (LOGWIN*)lParam; + + dat->hwnd = hwndDlg; + dat->Scroll = 1; + dat->Paused = 0; + dat->hList = GetDlgItem(hwndDlg, IDC_LIST); + + SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG)dat); + SetWindowLongPtr(dat->hList, GWLP_USERDATA, SetWindowLongPtr(dat->hList, GWLP_WNDPROC, (LONG)SubclassProc)); + + // init buttons + { + int i; + HWND hwnd; + for(i = 0; i < SIZEOF(ctrls); i++) { + hwnd = GetDlgItem(hwndDlg,ctrls[i].control); + SendMessage(hwnd, ctrls[i].type, 0, 0); + SendMessage(hwnd, BM_SETIMAGE,IMAGE_ICON,(LPARAM)hIcons[i+ICON_FIRST]); + SendMessage(hwnd, BUTTONADDTOOLTIP,(WPARAM)TranslateTS(ctrls[i].tooltip), BATF_TCHAR); + } + } + + CheckDlgButton(hwndDlg,IDC_SCROLL,dat->Scroll?BST_CHECKED:BST_UNCHECKED); + SendDlgItemMessage(hwndDlg,IDC_SCROLL,BM_SETIMAGE,IMAGE_ICON,(LPARAM)hIcons[(dat->Scroll?ICON_SCROLL:ICON_NOSCROLL)]); + + if (gSingleMode) + { + ShowWindow(GetDlgItem(hwndDlg, IDC_PAUSEALL), SW_HIDE); + ShowWindow(GetDlgItem(hwndDlg, IDC_STARTALL), SW_HIDE); + ShowWindow(GetDlgItem(hwndDlg, IDC_CLOSE), SW_HIDE); + } + + // init listview + { + LVITEM lvi = {0}; + LVCOLUMN sLC; + //ListView_SetUnicodeFormat(dat->hList, TRUE); + ListView_SetImageList(dat->hList, gImg, LVSIL_SMALL); + sLC.mask = LVCF_FMT | LVCF_WIDTH; + sLC.fmt = LVCFMT_LEFT; + sLC.cx = 630; + ListView_InsertColumn(dat->hList, 0, &sLC); + ListView_SetExtendedListViewStyle(dat->hList, LVS_EX_FULLROWSELECT); + + lvi.mask = LVIF_TEXT; + if (gIcons) + { + lvi.mask |= LVIF_IMAGE; + lvi.iImage = IMG_INFO; + } + + lvi.pszText = TranslateT("*** Console started ***"); + ListView_InsertItem(dat->hList, &lvi); + } + + SendMessage(hwndDlg, WM_SIZE, 0, 0); + break; + } + case HM_DUMP: + { + // lParam = DUMPMSG + if (!lParam) break; + if (dat && !dat->Paused) + { + LVITEM lvi = {0}; + int last = 0x7fffffff; + TCHAR szBreak; + DWORD len, tmplen; + DWORD wraplen = gWrapLen; + TCHAR *str = ((DUMPMSG*)lParam)->szMsg; + + lvi.iItem = 0x7fffffff; + + str = _tcstok(str, _T("\n")); + + if (gIcons && str != NULL) + { + lvi.mask = LVIF_TEXT | LVIF_IMAGE; + + if (_tcsstr(str, _T("Data received"))) + { + if (gSeparator) ListView_InsertItem(dat->hList, &lvi); + lvi.iImage = IMG_IN; + } + else + if (_tcsstr(str, _T("Data sent"))) + { + if (gSeparator) ListView_InsertItem(dat->hList, &lvi); + lvi.iImage = IMG_OUT; + } + else + { + if (gSeparator && dat->newline) + { + ListView_InsertItem(dat->hList, &lvi); + dat->newline = 0; + } + lvi.iImage = IMG_INFO; + } + } else + lvi.mask = LVIF_TEXT; + + while (str != NULL) + { + lvi.pszText = &str[0]; + tmplen = len = (DWORD)_tcslen(lvi.pszText); + + while(len > wraplen) + { + szBreak = lvi.pszText[wraplen]; + lvi.pszText[wraplen] = 0; + last = ListView_InsertItem(dat->hList, &lvi); + lvi.pszText[wraplen] = szBreak; + len -= wraplen; + lvi.pszText = &str[0] + tmplen - len; + + dat->newline = 1; + lvi.iImage = IMG_EMPTY; + } + + if (len && lvi.pszText[len-1] == '\r') + lvi.pszText[len-1] = 0; + + last = ListView_InsertItem(dat->hList, &lvi); + + str = _tcstok(NULL, _T("\n")); + + if (str) dat->newline = 1; + lvi.iImage = IMG_EMPTY; + } + + + if ( gVisible && dat == pActive && dat->Scroll == 1 ) + ListView_EnsureVisible(dat->hList, last, FALSE); + + if (last > gLimit) + { + int idx = last - gLimit + gLimit/4; // leave only 75% of LIMIT + + while (idx >= 0) + { + ListView_DeleteItem(dat->hList, idx); + idx--; + } + } + } + + mir_free((DUMPMSG*)lParam); + return TRUE; + } + case WM_SIZE: + { + UTILRESIZEDIALOG urd={0}; + urd.cbSize=sizeof(urd); + urd.hInstance=hInst; + urd.hwndDlg=hwndDlg; + urd.lpTemplate=MAKEINTRESOURCEA(IDD_LOG); + urd.pfnResizer=LogResize; + SetWindowPos(hwndDlg, HWND_TOP, rcTabs.left, rcTabs.top, rcTabs.right - rcTabs.left, rcTabs.bottom - rcTabs.top, SWP_SHOWWINDOW); + CallService(MS_UTILS_RESIZEDIALOG,0,(LPARAM)&urd); + break; + } + case WM_COMMAND: + { + switch(LOWORD(wParam)) + { + if (!dat) break; + + case IDC_PAUSE: + { + LVITEM lvi = {0}; + dat->Paused = !(dat->Paused); + lvi.mask = LVIF_TEXT | LVIF_IMAGE; + lvi.iImage = IMG_INFO; + lvi.iItem = 0x7FFFFFFF; + lvi.pszText = (dat->Paused) ? TranslateT("*** Console paused ***") : TranslateT("*** Console resumed ***"); + ListView_InsertItem(dat->hList, &lvi); + CheckDlgButton(hwndDlg,IDC_PAUSE,(dat->Paused)?BST_CHECKED:BST_UNCHECKED); + SendDlgItemMessage(hwndDlg,IDC_PAUSE,BM_SETIMAGE,IMAGE_ICON,(LPARAM)hIcons[((dat->Paused)?ICON_PAUSED:ICON_STARTED)]); + break; + } + case IDC_SCROLL: + { + dat->Scroll = !(dat->Scroll); + CheckDlgButton(hwndDlg,IDC_SCROLL,(dat->Scroll)?BST_CHECKED:BST_UNCHECKED); + SendDlgItemMessage(hwndDlg,IDC_SCROLL,BM_SETIMAGE,IMAGE_ICON,(LPARAM)hIcons[((dat->Scroll)?ICON_SCROLL:ICON_NOSCROLL)]); + break; + } + case IDC_COPY: + { + int idx = 0; + TCHAR szText[128]; + TCHAR *src, *dst, *buf; + int flags = LVNI_BELOW; + int count = ListView_GetSelectedCount(dat->hList); + + if (count) + flags |= LVNI_SELECTED; + else + count = ListView_GetItemCount(dat->hList); + + dst = buf = (TCHAR*)malloc((count*(sizeof(szText)+1)+1)*sizeof(TCHAR)); + if (!buf) break; + + while ((idx = ListView_GetNextItem(dat->hList, idx, flags)) > 0) + { + ListView_GetItemText(dat->hList, idx, 0, szText, sizeof(szText)-1); + src = szText; + while (*dst++ = *src++); + dst--; + *dst++ = '\r'; + *dst++ = '\n'; + *dst = 0; + } + + if (dst - buf > 0 && OpenClipboard(hwndDlg)) { + HGLOBAL hClipboardData; + TCHAR* pchData; + EmptyClipboard(); + if (hClipboardData = GlobalAlloc(GMEM_DDESHARE, (dst-buf+1)*sizeof(TCHAR))) { + pchData = (TCHAR*)GlobalLock(hClipboardData); + _tcscpy(pchData, buf); + GlobalUnlock(hClipboardData); + SetClipboardData(CF_UNICODETEXT,hClipboardData); + } + CloseClipboard(); + } + free(buf); + break; + } + case IDC_DELETE: + { + int idx = 0; + int count = ListView_GetSelectedCount(dat->hList); + + if ( !count ) break; + + if ( count == ListView_GetItemCount(dat->hList)) { + LVITEM lvi = {0}; + ListView_DeleteAllItems(dat->hList); + lvi.mask = LVIF_TEXT | LVIF_IMAGE; + lvi.iImage = IMG_INFO; + lvi.pszText = TranslateT("*** Console cleared ***"); + ListView_InsertItem(dat->hList, &lvi); + dat->newline = 0; + break; + } + + while ((idx = ListView_GetNextItem(dat->hList, idx, LVNI_BELOW|LVNI_SELECTED)) > 0) + { + ListView_DeleteItem(dat->hList, idx); + idx--; + } + break; + } + case IDC_SAVE: + { + FILE *fp; + TCHAR szFile[MAX_PATH]; + + if (!Openfile(szFile, ListView_GetSelectedCount(dat->hList))) break; + + fp = _tfopen(szFile, _T("wt")); + if (fp) { + int idx = 0; + TCHAR szText[128]; + int flags = LVNI_BELOW; + if (ListView_GetSelectedCount(dat->hList)) + flags |= LVNI_SELECTED; + + while ((idx = ListView_GetNextItem(dat->hList, idx, flags)) > 0) + { + ListView_GetItemText(dat->hList, idx, 0, szText, SIZEOF(szText)-1); + _ftprintf(fp, _T("%s\n"), szText); + } + fclose(fp); + } + break; + } + case IDC_OPTIONS: + CallServiceSync(MS_NETLIB_LOGWIN,0,0); + break; + case IDC_STARTALL: + SendMessage(hwndConsole, HM_PAUSEALL, 0, 0); + break; + case IDC_PAUSEALL: + SendMessage(hwndConsole, HM_PAUSEALL, 0, 1); + break; + case IDC_CLOSE: + if (tabCount > 1) + SendMessage(hwndDlg, WM_CLOSE, 0, 0); + break; + default: + break; + } + break; + } + case WM_CLOSE: + DestroyWindow(hwndDlg); + break; + case WM_DESTROY: + SetWindowLongPtr(dat->hList, GWLP_WNDPROC, GetWindowLongPtr(dat->hList, GWLP_USERDATA)); + SendMessage(hwndConsole, HM_REMOVE, 0, (LPARAM)dat); + break; + } + + return FALSE; +} + + +//////////////////////////////////////////////////////////////////////////////// + +int ConsoleResize(HWND hwnd,LPARAM lParam,UTILRESIZECONTROL *urc) +{ + switch(urc->wId) { + case IDC_TABS: + return RD_ANCHORX_WIDTH|RD_ANCHORY_HEIGHT; + default: + return RD_ANCHORX_LEFT|RD_ANCHORY_TOP; + } +} + + +static INT_PTR CALLBACK ConsoleDlgProc(HWND hwndDlg,UINT message,WPARAM wParam,LPARAM lParam) +{ + switch(message) { + case WM_INITDIALOG: + { + TCHAR title[MAX_PATH]; + TCHAR name[MAX_PATH] = {0}; + TCHAR path[MAX_PATH] = {0}; + + hTabs = GetDlgItem(hwndDlg, IDC_TABS); + + //TabCtrl_SetMinTabWidth(hTabs, 100); + + // restore position + { + SAVEWINDOWPOS swp; + swp.hwnd=hwndDlg; swp.hContact=NULL; swp.szModule="Console"; swp.szNamePrefix="Console"; + CallService(MS_UTILS_RESTOREWINDOWPOSITION, RWPF_HIDDEN, (LPARAM)&swp); + } + + CallService(MS_DB_GETPROFILENAMET,(WPARAM)MAX_PATH,(LPARAM)name); + + CallService(MS_DB_GETPROFILEPATHT,(WPARAM)MAX_PATH,(LPARAM)path); + + mir_sntprintf(title, MAX_PATH, _T("%s - %s\\%s"), TranslateT("Miranda Console"), path, name); + + SetWindowText(hwndDlg, title); + SendMessage(hwndDlg,WM_SETICON,ICON_BIG,(LPARAM)hIcons[0]); + + hwndConsole = hwndDlg; + SendMessage(hwndDlg, HM_ADD, 0, 0); + PostMessage(hwndDlg, WM_SIZE, 0, 0); + break; + } + case HM_DUMP: + { + // lParam = DUMPMSG + int idx; + LOGWIN *lw; + LOGWIN lw2; + DUMPMSG *dumpMsg = (DUMPMSG*)lParam; + + if (!pActive) { + mir_free(dumpMsg); + break; + } + + if (!gSingleMode) + { + lw2.Module = dumpMsg->szModule; + if (!List_GetIndex(&lModules, &lw2, &idx)) + SendMessage(hwndDlg, HM_ADD, (WPARAM)idx, (LPARAM)dumpMsg->szModule); + + lw = (LOGWIN*)lModules.items[idx]; + } + else + lw = pActive; + + if (lw->hwnd) + SendMessage(lw->hwnd, HM_DUMP, wParam, lParam); + else + PostMessage(hwndDlg, HM_DUMP, wParam, lParam); // loop msg until window will be ready + + return TRUE; + } + case HM_ADD: + { + // wParam = index, lParam = module name + LOGWIN *lw; + COLORREF col; + TCITEM tci = {0}; + int idx = (int)wParam; + char *str = (char*)lParam; + + if (!str) str = ""; // startup window + + lw = (LOGWIN*)mir_calloc( sizeof(LOGWIN)); + lw->Module = (char*)mir_strdup(str); + List_Insert(&lModules, lw, idx); + + if (!gSingleMode && lParam) + { + tci.mask = TCIF_PARAM | TCIF_TEXT; + tci.lParam = (LPARAM)lw; + + tci.pszText = mir_a2u(lw->Module); + idx = TabCtrl_InsertItem(hTabs, tabCount, &tci); + mir_free(tci.pszText); + + tabCount++; + } + + GetClientRect(hTabs, &rcTabs); + TabCtrl_AdjustRect(hTabs, FALSE, &rcTabs); + + CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_LOG), hwndDlg, LogDlgProc, (LPARAM)lw); + ShowWindow(lw->hwnd, (tabCount > 1)?SW_HIDE:SW_SHOWNOACTIVATE); + + if (pActive) + { + col = ListView_GetBkColor(pActive->hList); + ListView_SetBkColor(lw->hList, col); + ListView_SetTextBkColor(lw->hList, col); + + col = ListView_GetTextColor(pActive->hList); + ListView_SetTextColor(lw->hList, col); + + if (hfLogFont) + SendMessage(lw->hList, WM_SETFONT, (WPARAM)hfLogFont, (LPARAM)TRUE); + } + + // hide startup window + if (tabCount == 1) + { + ShowWindow(pActive->hwnd, SW_HIDE); + PostMessage(pActive->hwnd, WM_CLOSE, 0, 0); + pActive = lw; + } + + if (!pActive) + pActive = lw; + + return TRUE; + } + case HM_REMOVE: + { + // lParam = LOGWIN + LOGWIN *lw = (LOGWIN*)lParam; + + if (!lw) break; + + if (lw == pActive) + { + int tab = TabCtrl_GetCurSel(hTabs); + if (tab >= 0) + { + TCITEM tci={0}; + + TabCtrl_DeleteItem(hTabs, tab); + tabCount--; + if (tabCount) + { + tab--; + if (tab < 0 ) tab = 0; + TabCtrl_SetCurSel(hTabs, tab); + + tci.mask = TCIF_PARAM; + TabCtrl_GetItem(hTabs, tab, &tci); + pActive = (LOGWIN*)tci.lParam; + SendMessage(pActive->hwnd, WM_SIZE, 0, 0); + ScrollDown(pActive); + ShowWindow(pActive->hwnd, SW_SHOWNOACTIVATE); + SetFocus(pActive->hList); + } + else + pActive = NULL; + } + } + + List_RemovePtr(&lModules, lw); + mir_free(lw->Module); + mir_free(lw); + return TRUE; + } + case HM_SETFONT: + { + // wParam = font, lParam = font color + int i; + LOGWIN *lw; + for ( i = 0; i < lModules.realCount; i++ ) + { + lw = (LOGWIN*)lModules.items[i]; + ListView_SetTextColor(lw->hList, (COLORREF)lParam); + if (wParam) + SendMessage(lw->hList, WM_SETFONT, wParam, (LPARAM)TRUE); + } + return TRUE; + } + case HM_SETCOLOR: + { + // wParam = font, lParam = background color + int i; + LOGWIN *lw; + for ( i = 0; i < lModules.realCount; i++ ) + { + lw = (LOGWIN*)lModules.items[i]; + ListView_SetBkColor(lw->hList, (COLORREF)lParam); + ListView_SetTextBkColor(lw->hList, (COLORREF)lParam); + if (wParam) + SendMessage(lw->hList, WM_SETFONT, wParam, (LPARAM)TRUE); + } + return TRUE; + } + case HM_PAUSEALL: + { + // lParam = 1 to pause, 0 to start + int i; + LOGWIN *lw; + for ( i = 0; i < lModules.realCount; i++ ) + { + lw = (LOGWIN*)lModules.items[i]; + if (lw->Paused != (int)lParam) + SendMessage(lw->hwnd, WM_COMMAND, IDC_PAUSE, 0); + } + return TRUE; + } + case HM_RESTART: + { + if (pActive) + { + pActive = NULL; + PostMessage(hwndDlg, HM_RESTART, 0, 0); + return TRUE; + } + // close all tabs + if (!lParam) + { + LOGWIN *lw; + TabCtrl_DeleteAllItems(hTabs); + while ( lModules.realCount ) + { + lw = (LOGWIN*)lModules.items[0]; + SendMessage(lw->hwnd, WM_CLOSE, 0, 0); + } + tabCount = 0; + PostMessage(hwndDlg, HM_RESTART, 0, 1); + return TRUE; + } + + LoadSettings(); + SendMessage(hwndDlg, HM_ADD, 0, 0); + PostMessage(hwndDlg, WM_SIZE, 0, 0); + return TRUE; + } + case WM_SETFOCUS: + if (pActive) { + SetFocus(pActive->hList); + } + return TRUE; + case WM_NOTIFY: + switch(wParam) { + case IDC_TABS: + { + LPNMHDR lpnmhdr = (LPNMHDR)lParam; + if (lpnmhdr->code == TCN_SELCHANGE) + { + int newTab = TabCtrl_GetCurSel(hTabs); + if (newTab >= 0 ) + { + TCITEM tci={0}; + HWND hOld = pActive->hwnd; + + tci.mask = TCIF_PARAM; + + if (!TabCtrl_GetItem(hTabs, newTab, &tci)) break; + + pActive = (LOGWIN*)tci.lParam; + + SendMessage(pActive->hwnd, WM_SIZE, 0, 0); + ScrollDown(pActive); + ShowWindow(hOld, SW_HIDE); + ShowWindow(pActive->hwnd, SW_SHOWNOACTIVATE); + SetFocus(pActive->hList); + } else + SendMessage(pActive->hwnd, WM_SIZE, 0, 0); + } + break; + } + } + break; + case WM_SIZE: + { + UTILRESIZEDIALOG urd={0}; + urd.cbSize=sizeof(urd); + urd.hInstance=hInst; + urd.hwndDlg=hwndDlg; + urd.lpTemplate=MAKEINTRESOURCEA(IDD_CONSOLE); + urd.pfnResizer=ConsoleResize; + CallService(MS_UTILS_RESIZEDIALOG,0,(LPARAM)&urd); + + GetClientRect(hTabs, &rcTabs); + TabCtrl_AdjustRect(hTabs, FALSE, &rcTabs); + + if ( pActive ) + SendMessage(pActive->hwnd, WM_SIZE, 0, 0); + break; + } + case WM_GETMINMAXINFO: + { + MINMAXINFO *mmi=(MINMAXINFO*)lParam; + mmi->ptMinTrackSize.x=400; + mmi->ptMinTrackSize.y=200; + break; + } + case WM_CLOSE: + if ( lParam != 1 ) { + Utils_SaveWindowPosition(hwndDlg,NULL,"Console","Console"); + ShowConsole(0); + return TRUE; + } else + DestroyWindow(hwndDlg); + break; + case WM_DESTROY: + pActive = NULL; + if (hfLogFont) DeleteObject(hfLogFont); + PostQuitMessage(0); + break; + } + + return FALSE; +} + + +//////////////////////////////////////////////////////////////////////////////// + + +void __cdecl ConsoleThread(void* arg) +{ + MSG msg; + HWND hwnd; + + hwnd = CreateDialog(hInst,MAKEINTRESOURCE(IDD_CONSOLE),NULL,ConsoleDlgProc); + + if (!hwnd) return; + + while( GetMessage(&msg, NULL, 0, 0) > 0 ) + { + switch(msg.message) { + case HM_DUMP: + OutMsgs++; + break; + } + + if ( IsDialogMessage(hwnd, &msg)) + continue; + + TranslateMessage(&msg); + DispatchMessage(&msg); + } + + hwndConsole = NULL; +} + +/////////////////////////////////////////////////////////////////////////////// + +static int OnFastDump(WPARAM wParam,LPARAM lParam) +{ + if ( pActive ) + { + LOGMSG *logMsg = (LOGMSG*)lParam; + DWORD headlen = (DWORD)strlen(logMsg->pszHead); + DWORD msglen = (DWORD)strlen(logMsg->pszMsg); + DWORD len = (headlen + msglen + 1) * sizeof(TCHAR) + sizeof(DUMPMSG); + DUMPMSG *dumpMsg = (DUMPMSG*)mir_alloc( len ); + TCHAR *str = dumpMsg->szMsg; + + strncpy(dumpMsg->szModule, ((NETLIBUSER*)wParam)->szDescriptiveName, sizeof(dumpMsg->szModule))[ sizeof(dumpMsg->szModule)-1 ] = 0; + + { + wchar_t *ucs2; + + ucs2 = mir_a2u( logMsg->pszHead ); + wcscpy(str, ucs2); + mir_free(ucs2); + + // try to detect utf8 + ucs2 = mir_utf8decodeW( logMsg->pszMsg ); + if ( !ucs2 ) + ucs2 = mir_a2u( logMsg->pszMsg ); + + wcscat( str, ucs2 ); + mir_free( ucs2 ); + } + + InMsgs++; + PostMessage(hwndConsole, HM_DUMP, 0, (LPARAM)dumpMsg); + } + return 0; +} + +/////////////////////////////////////////////////////////////////////////////// + +static void LoadSettings() +{ + gIcons = DBGetContactSettingByte(NULL, "Console", "ShowIcons", 1); + gSeparator = DBGetContactSettingByte(NULL, "Console", "Separator", 1); + gSingleMode = DBGetContactSettingByte(NULL, "Console", "SingleMode", 0); + + gWrapLen = DBGetContactSettingByte(NULL, "Console", "Wrap", DEFAULT_WRAPLEN); + if ( gWrapLen < MIN_WRAPLEN ) gWrapLen = DEFAULT_WRAPLEN; + + gLimit = DBGetContactSettingDword(NULL, "Console", "Limit", MAX_LIMIT); + if (gLimit > MAX_LIMIT) gLimit = MAX_LIMIT; + if (gLimit < MIN_LIMIT) gLimit = MIN_LIMIT; +} + + +static void SaveSettings(HWND hwndDlg) +{ + int len = GetDlgItemInt(hwndDlg, IDC_WRAP, NULL, FALSE); + if (len < MIN_WRAPLEN ) + len = MIN_WRAPLEN; + else + if (len > MAX_WRAPLEN) + len = MAX_WRAPLEN; + + gWrapLen = len; + SetDlgItemInt(hwndDlg, IDC_WRAP, gWrapLen, FALSE); + DBWriteContactSettingByte(NULL, "Console", "Wrap", (BYTE)len); + + len = GetDlgItemInt(hwndDlg, IDC_LIMIT, NULL, FALSE); + if (len < MIN_LIMIT ) + len = MIN_LIMIT; + else + if (len > MAX_LIMIT) + len = MAX_LIMIT; + + gLimit = len; + SetDlgItemInt(hwndDlg, IDC_LIMIT, gLimit, FALSE); + DBWriteContactSettingDword(NULL, "Console", "Limit", len); + + DBWriteContactSettingByte(NULL, "Console", "SingleMode", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SINGLE)); + DBWriteContactSettingByte(NULL, "Console", "Separator", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SEPARATOR)); + DBWriteContactSettingByte(NULL, "Console", "ShowIcons", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWICONS)); + + DBWriteContactSettingByte(NULL, "Console", "ShowAtStart", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_START)); +} + + +static INT_PTR CALLBACK OptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch(msg) { + case WM_INITDIALOG: + TranslateDialogDefault(hwndDlg); + CheckDlgButton(hwndDlg, IDC_START, DBGetContactSettingByte(NULL, "Console", "ShowAtStart", 0)); + CheckDlgButton(hwndDlg, IDC_SINGLE, gSingleMode); + CheckDlgButton(hwndDlg, IDC_SHOWICONS, gIcons); + CheckDlgButton(hwndDlg, IDC_SEPARATOR, gSeparator); + SetDlgItemInt(hwndDlg, IDC_WRAP, gWrapLen, FALSE); + SetDlgItemInt(hwndDlg, IDC_LIMIT, gLimit, FALSE); + break; + case WM_COMMAND: + switch (LOWORD(wParam)) { + case IDC_RESTART: + { + if (!pActive) break; + SaveSettings(hwndDlg); + PostMessage(hwndConsole, HM_RESTART, 0, 0); + break; + } + case IDC_LIMIT: + case IDC_WRAP: + if (HIWORD(wParam) != EN_CHANGE || (HWND) lParam != GetFocus()) + return FALSE; + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); + break; + case IDC_START: + case IDC_SEPARATOR: + case IDC_SHOWICONS: + case IDC_SINGLE: + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); + break; + } + break; + case WM_NOTIFY: + switch(((LPNMHDR)lParam)->idFrom) + { + case 0: + switch (((LPNMHDR)lParam)->code) + { + case PSN_APPLY: + { + SaveSettings(hwndDlg); + break; + } + } + break; + } + break; + } + return FALSE; +} + + +static int OptInit(WPARAM wParam,LPARAM lParam) +{ + OPTIONSDIALOGPAGE odp={0}; + odp.cbSize = sizeof(odp); + odp.hInstance = hInst; + odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS); + odp.pszGroup = LPGEN("Network"); + odp.pszTitle = LPGEN("Console"); + odp.pfnDlgProc = OptDlgProc; + odp.flags = ODPF_BOLDGROUPS; + odp.expertOnlyControls = NULL; + Options_AddPage(wParam, &odp); + return 0; +} + +/////////////////////////////////////////////////////////////////////////////// + +static int OnColourChange(WPARAM wParam,LPARAM lParam) +{ + if (hwndConsole) + { + ColourID cid = {0}; + COLORREF col; + + cid.cbSize=sizeof(cid); + strcpy(cid.group,"Console"); + strcpy(cid.name,"Background"); + strcpy(cid.dbSettingsGroup,"Console"); + strcpy(cid.setting,"BgColor"); + + col = (COLORREF)CallService(MS_COLOUR_GET,(WPARAM)&cid,0); + if (col != -1) + SendMessage(hwndConsole, HM_SETCOLOR, (WPARAM)hfLogFont, (LPARAM)col); + } + return 0; +} + + +static int OnFontChange(WPARAM wParam,LPARAM lParam) +{ + if (hwndConsole) + { + COLORREF col; + HFONT hf = NULL; + LOGFONT LogFont={0}; + FontIDT fid={0}; + fid.cbSize=sizeof(fid); + + _tcscpy(fid.group,_T("Console")); + _tcscpy(fid.name,TranslateT("Text")); + + col = (COLORREF)CallService(MS_FONT_GETT,(WPARAM)&fid,(LPARAM)&LogFont); + + if (LogFont.lfHeight != 0) + { + hf=CreateFontIndirect(&LogFont); + + SendMessage(hwndConsole, HM_SETFONT, (WPARAM)hf, (LPARAM)col); + + if (hfLogFont) + DeleteObject(hfLogFont); + hfLogFont = hf; + } + } + return 0; +} + +static int OnSystemModulesLoaded(WPARAM wParam,LPARAM lParam) +{ + HookEvent( ME_NETLIB_FASTDUMP, OnFastDump ); + + CreateServiceFunction(MS_CONSOLE_SHOW_HIDE, ShowHideConsole); + + FontIDT fid = {0}; + fid.cbSize = sizeof(fid); + _tcscpy(fid.group,_T("Console")); + _tcscpy(fid.name,TranslateT("Text")); + strcpy(fid.dbSettingsGroup,"Console"); + strcpy(fid.prefix,"ConsoleFont"); + _tcscpy(fid.backgroundGroup,_T("Console")); + _tcscpy(fid.backgroundName,_T("Background")); + fid.flags = FIDF_DEFAULTVALID; + fid.deffontsettings.charset = DEFAULT_CHARSET; + fid.deffontsettings.colour = RGB(0, 0, 0); + fid.deffontsettings.size = 10; + fid.deffontsettings.style = 0; + _tcsncpy(fid.deffontsettings.szFace, _T("Courier"), LF_FACESIZE); + FontRegisterT(&fid); + + HookEvent(ME_FONT_RELOAD,OnFontChange); + + ColourIDT cid = {0}; + cid.cbSize=sizeof(cid); + _tcscpy(cid.group,_T("Console")); + _tcscpy(cid.name,_T("Background")); + strcpy(cid.dbSettingsGroup,"Console"); + strcpy(cid.setting,"BgColor"); + cid.defcolour = RGB(255,255,255); + ColourRegisterT(&cid); + + HookEvent(ME_COLOUR_RELOAD, OnColourChange); + + HOTKEYDESC hkd = {0}; + hkd.cbSize = sizeof(hkd); + hkd.pszName = "Console_Show_Hide"; + hkd.pszDescription = LPGEN("Show/Hide Console"); + hkd.pszSection = "Main"; + hkd.pszService = MS_CONSOLE_SHOW_HIDE; + hkd.DefHotKey = HOTKEYCODE(HOTKEYF_EXT, 'C'); + Hotkey_Register(&hkd); + + if (hwndConsole && IsWindow(hwndConsole)) + { + CLISTMENUITEM mi={0}; + HookEvent(ME_TTB_MODULELOADED, OnTTBLoaded); + mi.cbSize=sizeof(mi); + mi.flags=CMIF_TCHAR; + mi.hIcon=hIcons[0]; + mi.ptszPopupName=TranslateT("&Help"); + mi.popupPosition=2000090000; + mi.position=1000000000; + mi.ptszName=(IsWindowVisible(hwndConsole))?TranslateT("Hide Console"):TranslateT("Show Console"); + mi.pszService=MS_CONSOLE_SHOW_HIDE; + hMenu = Menu_AddMainMenuItem(&mi); + + OnFontChange(0,0); + OnColourChange(0,0); + + if (DBGetContactSettingByte(NULL,"Console","ShowAtStart",0) || DBGetContactSettingByte(NULL,"Console","Show",1)) + ShowConsole(1); + else + ShowConsole(0); + } + + return 0; +} + +static int PreshutdownConsole(WPARAM wParam,LPARAM lParam) +{ + if (hwndConsole) + PostMessage(hwndConsole, WM_CLOSE, 0, 1 ); + + return 0; +} + +/////////////////////////////////////////////////////////////////////////////// + +static int stringCompare( LOGWIN *lw1, LOGWIN *lw2 ) +{ + return strcmp( lw1->Module, lw2->Module ); +} + +/////////////////////////////////////////////////////////////////////////////// + +static UINT logicons[] = {IDI_EMPTY, IDI_ARROW, IDI_IN, IDI_OUT, IDI_INFO}; + + +void InitConsole() +{ + int i; + HICON hi; + + lModules.sortFunc = (FSortFunc)stringCompare; + lModules.increment = 5; + + hIcons[0] = LoadIcon(hInst, MAKEINTRESOURCE(IDI_CONSOLE)); + hIcons[1] = (HICON)LoadImage(hInst,MAKEINTRESOURCE(IDI_NOSCROLL),IMAGE_ICON,GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),0); + hIcons[2] = (HICON)LoadImage(hInst,MAKEINTRESOURCE(IDI_PAUSED),IMAGE_ICON,GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),0); + + for(i = 0; i < SIZEOF(ctrls); i++) { + hIcons[i+ICON_FIRST] = (HICON)LoadImage(hInst,MAKEINTRESOURCE(ctrls[i].icon),IMAGE_ICON,GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),0); + } + + gImg = ImageList_Create(LOGICONX_SIZE, LOGICONY_SIZE, ILC_COLOR24 | ILC_MASK, SIZEOF(logicons), 0); + + for(i = 0; i < SIZEOF(logicons); i++) + { + hi = (HICON)LoadImage(hInst,MAKEINTRESOURCE(logicons[i]),IMAGE_ICON,LOGICONX_SIZE,LOGICONY_SIZE,0); + if (hi) + { + ImageList_AddIcon(gImg, hi); + DestroyIcon(hi); + } + } + + LoadSettings(); + + mir_forkthread(ConsoleThread, 0); + + HookEvent(ME_SYSTEM_PRESHUTDOWN, PreshutdownConsole); + HookEvent(ME_SYSTEM_MODULESLOADED, OnSystemModulesLoaded); + HookEvent(ME_OPT_INITIALISE, OptInit); + HookEvent(ME_NETLIB_FASTDUMP, OnFastDump); +} + +void ShutdownConsole(void) +{ + int i; + + List_Destroy(&lModules); + + if (gImg) ImageList_Destroy(gImg); + + for(i = 0; i < SIZEOF(hIcons); i++) { + if (hIcons[i]) DestroyIcon(hIcons[i]); + } +} + +//////////////////////////////////////////////////////////////////////////////// + +TCHAR *addstring(TCHAR *str, TCHAR *add) { + _tcscpy(str,add); + return str + _tcslen(add) + 1; +} + + +static int Openfile(TCHAR *outputFile, int selection) +{ + OPENFILENAME ofn = {0}; + TCHAR filename[MAX_PATH+2] = _T(""); + TCHAR *title; + + TCHAR *filter, *tmp, *tmp1, *tmp2; + tmp1 = TranslateT("Text Files (*.txt)"); + tmp2 = TranslateT("All Files"); + filter = tmp = (TCHAR*)_alloca((_tcslen(tmp1)+_tcslen(tmp2)+11)*sizeof(TCHAR)); + tmp = addstring(tmp, tmp1); + tmp = addstring(tmp, _T("*.TXT")); + tmp = addstring(tmp, tmp2); + tmp = addstring(tmp, _T("*")); + *tmp = 0; + + if (selection) + title = TranslateT("Save selection to file"); + else + title = TranslateT("Save log to file"); + + ofn.lStructSize = sizeof(ofn); + ofn.lpstrFile = filename; + ofn.lpstrFilter = filter; + ofn.Flags = OFN_HIDEREADONLY | OFN_SHAREAWARE | OFN_PATHMUSTEXIST | OFN_OVERWRITEPROMPT; + ofn.lpstrTitle = title; + ofn.nMaxFile = MAX_PATH; + ofn.lpstrDefExt = _T("txt"); + + if (!GetSaveFileName(&ofn)) + return 0; + _tcscpy(outputFile, filename); + return 1; +} + +//////////////////////////////////////////////////////////////////////////////// diff --git a/plugins/Console/src/commonheaders.cpp b/plugins/Console/src/commonheaders.cpp new file mode 100644 index 0000000000..cbfb79d624 --- /dev/null +++ b/plugins/Console/src/commonheaders.cpp @@ -0,0 +1,24 @@ +/* + +Miranda IM: the free IM client for Microsoft* Windows* + +Copyright 2000-2008 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. +*/ + +#include "commonheaders.h" \ No newline at end of file diff --git a/plugins/Console/src/commonheaders.h b/plugins/Console/src/commonheaders.h new file mode 100644 index 0000000000..7689c7dce2 --- /dev/null +++ b/plugins/Console/src/commonheaders.h @@ -0,0 +1,68 @@ +/* + +Miranda IM: the free IM client for Microsoft* Windows* + +Copyright 2000-2008 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. +*/ + +#define _CRT_SECURE_NO_WARNINGS +#define _WIN32_WINNT 0x0501 + +#pragma comment( lib, "comctl32.lib") + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define MIRANDA_VER 0x0A00 + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "resource.h" + +#include "version.h" + +extern HINSTANCE hInst; + +void InitConsole(); +void ShutdownConsole(); + +#define MS_NETLIB_LOGWIN "Netlib/Log/Win" diff --git a/plugins/Console/src/init.cpp b/plugins/Console/src/init.cpp new file mode 100644 index 0000000000..58943d2c6a --- /dev/null +++ b/plugins/Console/src/init.cpp @@ -0,0 +1,74 @@ +/* + +Miranda IM: the free IM client for Microsoft* Windows* + +Copyright 2000-2008 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. +*/ + +#include "commonheaders.h" + +DWORD mirandaVer; +int hLangpack; +HINSTANCE hInst; + +PLUGININFOEX pluginInfoEx={ + sizeof(PLUGININFOEX), + __PLUGIN_NAME, + __VERSION_DWORD, + __PLUGIN_LONGDESC, + __PLUGIN_AUTHOR, + __PLUGIN_EMAIL, + __PLUGIN_RIGHTS, + __PLUGIN_URL, + UNICODE_AWARE, + MIID_CONSOLE +}; + +BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvReserved) +{ + hInst = hinstDLL; + return TRUE; +} + +extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion) +{ + return &pluginInfoEx; +} + +// we implement service mode interface +static const MUUID interfaces[] = {MIID_LOGWINDOW, MIID_LAST}; +extern "C" __declspec(dllexport) const MUUID* MirandaPluginInterfaces(void) +{ + return interfaces; +} + +extern "C" __declspec(dllexport) int Load(void) +{ + mir_getLP(&pluginInfoEx); + + InitCommonControls(); + InitConsole(); + return 0; +} + +extern "C" __declspec(dllexport) int Unload(void) +{ + ShutdownConsole(); + return 0; +} \ No newline at end of file diff --git a/plugins/Console/src/resource.h b/plugins/Console/src/resource.h new file mode 100644 index 0000000000..a8947819a4 --- /dev/null +++ b/plugins/Console/src/resource.h @@ -0,0 +1,58 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by resource.rc +// +#define IDI_CONSOLE_UP 100 +#define IDI_CONSOLE_DOWN 101 +#define IDD_MSG 111 +#define IDD_CONSOLE 112 +#define IDD_LOG 113 +#define IDD_OPTIONS 114 +#define IDI_COPY 402 +#define IDI_NOSCROLL 403 +#define IDI_SCROLL 404 +#define IDI_SAVE 405 +#define IDI_DELETE 406 +#define IDI_OPTIONS 407 +#define IDI_PAUSED 408 +#define IDI_STARTED 409 +#define IDI_BTN_UP 410 +#define IDI_BTN_DN 411 +#define IDI_CLOSE 412 +#define IDI_START 413 +#define IDI_PAUSE 414 +#define IDI_IN 415 +#define IDI_OUT 416 +#define IDI_ARROW 417 +#define IDI_INFO 418 +#define IDI_EMPTY 419 +#define IDC_TABS 1000 +#define IDC_LIST 1001 +#define IDC_SAVE 1002 +#define IDC_PAUSE 1003 +#define IDC_SCROLL 1004 +#define IDC_COPY 1005 +#define IDC_DELETE 1006 +#define IDC_OPTIONS 1007 +#define IDI_CONSOLE 1008 +#define IDC_CLOSE 1009 +#define IDC_PAUSEALL 1010 +#define IDC_STARTALL 1011 +#define IDC_SINGLE 1012 +#define IDC_WRAP 1013 +#define IDC_SHOWICONS 1014 +#define IDC_SEPARATOR 1015 +#define IDC_LIMIT 1016 +#define IDC_START 1017 +#define IDC_RESTART 1018 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 115 +#define _APS_NEXT_COMMAND_VALUE 40000 +#define _APS_NEXT_CONTROL_VALUE 1019 +#define _APS_NEXT_SYMED_VALUE 102 +#endif +#endif diff --git a/plugins/Console/src/version.h b/plugins/Console/src/version.h new file mode 100644 index 0000000000..c91b5628e0 --- /dev/null +++ b/plugins/Console/src/version.h @@ -0,0 +1,41 @@ +/* + +Miranda IM: the free IM client for Microsoft* Windows* + +Copyright 2000-2008 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. +*/ + + +#define __FILEVERSION_STRING 0,0,7,3 +#define __VERSION_STRING "0.0.7.3" +#define __VERSION_DWORD 0x00000703 + + +#define __PLUGIN_DESC "Console log window for Miranda" +#define __PLUGIN_LONGDESC __PLUGIN_DESC ". ["__DATE__" "__TIME__"]" +#define __PLUGIN_AUTHOR "Bio" +#define __PLUGIN_EMAIL "bio@ktaspb.ru" +#define __PLUGIN_RIGHTS "© 2005-2012 Bio" +#define __PLUGIN_FILE "Console.dll" +#define __PLUGIN_SHORTNAME "Console" + +#define MIID_CONSOLE { 0x23d4f302, 0xd513, 0x45b7, { 0x90, 0x27, 0x44, 0x5f, 0x29, 0x55, 0x73, 0x11 }} // {23D4F302-D513-45b7-9027-445F29557311} + +#define __PLUGIN_NAME __PLUGIN_SHORTNAME +#define __PLUGIN_URL "http://addons.miranda-im.org/details.php?action=viewfile&id=3791" diff --git a/plugins/Console/version.h b/plugins/Console/version.h deleted file mode 100644 index c91b5628e0..0000000000 --- a/plugins/Console/version.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - -Miranda IM: the free IM client for Microsoft* Windows* - -Copyright 2000-2008 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. -*/ - - -#define __FILEVERSION_STRING 0,0,7,3 -#define __VERSION_STRING "0.0.7.3" -#define __VERSION_DWORD 0x00000703 - - -#define __PLUGIN_DESC "Console log window for Miranda" -#define __PLUGIN_LONGDESC __PLUGIN_DESC ". ["__DATE__" "__TIME__"]" -#define __PLUGIN_AUTHOR "Bio" -#define __PLUGIN_EMAIL "bio@ktaspb.ru" -#define __PLUGIN_RIGHTS "© 2005-2012 Bio" -#define __PLUGIN_FILE "Console.dll" -#define __PLUGIN_SHORTNAME "Console" - -#define MIID_CONSOLE { 0x23d4f302, 0xd513, 0x45b7, { 0x90, 0x27, 0x44, 0x5f, 0x29, 0x55, 0x73, 0x11 }} // {23D4F302-D513-45b7-9027-445F29557311} - -#define __PLUGIN_NAME __PLUGIN_SHORTNAME -#define __PLUGIN_URL "http://addons.miranda-im.org/details.php?action=viewfile&id=3791" diff --git a/plugins/Console/version.rc b/plugins/Console/version.rc deleted file mode 100644 index 9981077b9f..0000000000 --- a/plugins/Console/version.rc +++ /dev/null @@ -1,65 +0,0 @@ -// Microsoft Visual C++ generated resource script. -// -#ifdef APSTUDIO_INVOKED -#error this file is not editable by Microsoft Visual C++ -#endif //APSTUDIO_INVOKED - -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include -#include -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION __FILEVERSION_STRING - PRODUCTVERSION __FILEVERSION_STRING - FILEFLAGSMASK 0x3fL -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x40004L - FILETYPE 0x1L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "000004b0" - BEGIN - VALUE "FileDescription", __PLUGIN_DESC - VALUE "FileVersion", __VERSION_STRING - VALUE "InternalName", __PLUGIN_SHORTNAME - VALUE "LegalCopyright", __PLUGIN_RIGHTS - VALUE "OriginalFilename", __PLUGIN_FILE - VALUE "ProductName", __PLUGIN_SHORTNAME - VALUE "ProductVersion", __VERSION_STRING - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x0, 1200 - END -END - -#endif -- cgit v1.2.3