From cb4a46e7fbe62d788e66ed6121c717a2d22a4d7c Mon Sep 17 00:00:00 2001 From: watcherhd Date: Thu, 21 Apr 2011 14:14:52 +0000 Subject: svn.miranda.im is moving to a new home! git-svn-id: http://miranda-plugins.googlecode.com/svn/trunk@7 e753b5eb-9565-29b2-b5c5-2cc6f99dfbcb --- console/Console.c | 1538 +++++++++++++++++++++++++++++++ console/Console.dsp | 363 ++++++++ console/Console.dsw | 33 + console/Console.ncb | Bin 0 -> 58368 bytes console/Console.opt | Bin 0 -> 49664 bytes console/Console.plg | 49 + console/Console.sln | 28 + console/Console.suo | Bin 0 -> 8704 bytes console/Console.vcproj | 634 +++++++++++++ console/Console.vcproj.Note.Leonid.user | 121 +++ console/Console.vcxproj | 348 +++++++ console/Console.vcxproj.filters | 103 +++ console/Console.vcxproj.user | 3 + console/Console_history.txt | 174 ++++ console/Console_readme.txt | 21 + console/commonheaders.c | 24 + console/commonheaders.h | 69 ++ console/gpl.txt | 340 +++++++ console/init.c | 90 ++ console/m_toolbar.h | 88 ++ console/m_toptoolbar.h | 125 +++ console/res/arrow.ico | Bin 0 -> 422 bytes console/res/btn_dn.ico | Bin 0 -> 894 bytes console/res/btn_up.ico | Bin 0 -> 894 bytes console/res/close.ico | Bin 0 -> 894 bytes console/res/close2.ico | Bin 0 -> 894 bytes console/res/console.ico | Bin 0 -> 11502 bytes console/res/console_dn.bmp | Bin 0 -> 1014 bytes console/res/console_up.bmp | Bin 0 -> 1014 bytes console/res/copy.ico | Bin 0 -> 894 bytes console/res/delete.ico | Bin 0 -> 894 bytes console/res/empty.ico | Bin 0 -> 422 bytes console/res/in.ico | Bin 0 -> 422 bytes console/res/info.ico | Bin 0 -> 422 bytes console/res/noscroll.ico | Bin 0 -> 894 bytes console/res/options.ico | Bin 0 -> 894 bytes console/res/out.ico | Bin 0 -> 422 bytes console/res/pause.ico | Bin 0 -> 894 bytes console/res/paused.ico | Bin 0 -> 894 bytes console/res/save.ico | Bin 0 -> 894 bytes console/res/scroll.ico | Bin 0 -> 894 bytes console/res/start.ico | Bin 0 -> 894 bytes console/res/started.ico | Bin 0 -> 894 bytes console/resource.h | 58 ++ console/resource.rc | 223 +++++ console/version.h | 51 + 46 files changed, 4483 insertions(+) create mode 100644 console/Console.c create mode 100644 console/Console.dsp create mode 100644 console/Console.dsw create mode 100644 console/Console.ncb create mode 100644 console/Console.opt create mode 100644 console/Console.plg create mode 100644 console/Console.sln create mode 100644 console/Console.suo create mode 100644 console/Console.vcproj create mode 100644 console/Console.vcproj.Note.Leonid.user create mode 100644 console/Console.vcxproj create mode 100644 console/Console.vcxproj.filters create mode 100644 console/Console.vcxproj.user create mode 100644 console/Console_history.txt create mode 100644 console/Console_readme.txt create mode 100644 console/commonheaders.c create mode 100644 console/commonheaders.h create mode 100644 console/gpl.txt create mode 100644 console/init.c create mode 100644 console/m_toolbar.h create mode 100644 console/m_toptoolbar.h create mode 100644 console/res/arrow.ico create mode 100644 console/res/btn_dn.ico create mode 100644 console/res/btn_up.ico create mode 100644 console/res/close.ico create mode 100644 console/res/close2.ico create mode 100644 console/res/console.ico create mode 100644 console/res/console_dn.bmp create mode 100644 console/res/console_up.bmp create mode 100644 console/res/copy.ico create mode 100644 console/res/delete.ico create mode 100644 console/res/empty.ico create mode 100644 console/res/in.ico create mode 100644 console/res/info.ico create mode 100644 console/res/noscroll.ico create mode 100644 console/res/options.ico create mode 100644 console/res/out.ico create mode 100644 console/res/pause.ico create mode 100644 console/res/paused.ico create mode 100644 console/res/save.ico create mode 100644 console/res/scroll.ico create mode 100644 console/res/start.ico create mode 100644 console/res/started.ico create mode 100644 console/resource.h create mode 100644 console/resource.rc create mode 100644 console/version.h (limited to 'console') diff --git a/console/Console.c b/console/Console.c new file mode 100644 index 0000000..52f892e --- /dev/null +++ b/console/Console.c @@ -0,0 +1,1538 @@ +/* + +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" + +// console toptoolbarbutton(old) integration +#define TTB 1 + +#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; + HANDLE hList; + char *Module; + int Scroll; + int Paused; + int newline; +} LOGWIN; + + +struct MM_INTERFACE mmi; +struct UTF8_INTERFACE utfi; +struct LIST_INTERFACE li; + +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 hHooks[4] = {0}; + +static HANDLE hTButton = 0; +static HANDLE hMenu = NULL; + +static void LoadSettings(); +static void ShowConsole(int show); +static int ShowHideConsole(WPARAM wParam, LPARAM lParam); +static int Openfile(TCHAR *outputFile, int selection); + +//////////////////////////////////////////////////////////////////////////////// + +#ifdef TTB +static HBITMAP BmpUp = NULL; +static HBITMAP BmpDn = NULL; +static HANDLE hTTBButt = 0; + +static int HideConsoleButt(WPARAM wParam,LPARAM lParam) +{ + ShowConsole(0); + return 0; +} + +static int ShowConsoleButt(WPARAM wParam,LPARAM lParam) +{ + ShowConsole(1); + return 0; +} + +static int OnTTBLoaded(WPARAM wParam,LPARAM lParam) +{ + + if (IsWindow(hwndConsole)) + { + TTBButton ttbb = {0}; + int state = IsWindowVisible(hwndConsole); + + CreateServiceFunction("Console/Hide", HideConsoleButt); + CreateServiceFunction("Console/Show", ShowConsoleButt); + + BmpUp = LoadBitmap(hInst,MAKEINTRESOURCE(IDB_CONSOLE_UP)); + BmpDn = LoadBitmap(hInst,MAKEINTRESOURCE(IDB_CONSOLE_DOWN)); + + ttbb.cbSize = sizeof(ttbb); + ttbb.hbBitmapUp = BmpUp; + ttbb.hbBitmapDown = BmpDn; + ttbb.dwFlags=(state?TTBBF_PUSHED:0)|TTBBF_VISIBLE|TTBBF_SHOWTOOLTIP; + ttbb.pszServiceDown = "Console/Show"; + ttbb.pszServiceUp = "Console/Hide"; + ttbb.name = Translate("Show/Hide Console"); + hTTBButt = (HANDLE)CallService(MS_TTB_ADDBUTTON, (WPARAM)&ttbb, 0); + + if (hTTBButt) + { + CallService(MS_TTB_SETBUTTONOPTIONS,MAKEWPARAM(TTBO_TIPNAME,hTTBButt), + (LPARAM)(state?Translate("Hide Console"):Translate("Show Console"))); + + CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)hTTBButt, (LPARAM)(state?TTBST_PUSHED:TTBST_RELEASED)); + } + } + return 0; +} +#endif + +//////////////////////////////////////////////////////////////////////////////// + +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 (hTButton) + { + CallService(MS_TB_SETBUTTONSTATEBYID, (WPARAM)"console_btn", (show)?TBST_PUSHED:TBST_RELEASED); + } + +#ifdef TTB + if (hTTBButt) + { + CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)hTTBButt, (show)?TTBST_PUSHED:TTBST_RELEASED); + CallService(MS_TTB_SETBUTTONOPTIONS,MAKEWPARAM(TTBO_TIPNAME,hTTBButt), + (LPARAM)(show?Translate("Hide Console"):Translate("Show Console"))); + } +#endif +} + +//////////////////////////////////////////////////////////////////////////////// + +static int 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)GetWindowLong(hwnd, GWL_USERDATA),hwnd,msg,wParam,lParam); +} + +//////////////////////////////////////////////////////////////////////////////// + +static BOOL CALLBACK LogDlgProc(HWND hwndDlg,UINT message,WPARAM wParam,LPARAM lParam) +{ + + LOGWIN *dat = (LOGWIN*)GetWindowLong(hwndDlg, GWL_USERDATA); + + switch(message) { + case WM_INITDIALOG: + { + dat = (LOGWIN*)lParam; + + dat->hwnd = hwndDlg; + dat->Scroll = 1; + dat->Paused = 0; + dat->hList = GetDlgItem(hwndDlg, IDC_LIST); + + SetWindowLong(hwndDlg, GWL_USERDATA, (LONG)dat); + SetWindowLong(dat->hList, GWL_USERDATA, SetWindowLong(dat->hList,GWL_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, BUTTONADDTOOLTIP,(WPARAM)TranslateTS(ctrls[i].tooltip), BATF_TCHAR); + SendMessage(hwnd, BM_SETIMAGE,IMAGE_ICON,(LPARAM)hIcons[i+ICON_FIRST]); + } + } + + 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, FALSE); + 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 = _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--; + } + } + } + + 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 = 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); + #ifdef UNICODE + SetClipboardData(CF_UNICODETEXT,hClipboardData); + #else + SetClipboardData(CF_TEXT,hClipboardData); + #endif + } + 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: + SetWindowLong(dat->hList, GWL_WNDPROC, GetWindowLong(dat->hList,GWL_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 BOOL CALLBACK ConsoleDlgProc(HWND hwndDlg,UINT message,WPARAM wParam,LPARAM lParam) +{ + switch(message) { + case WM_INITDIALOG: + { + char Title[512]; + char ProfileName[513]; + char ProfilePath[513]; + ProfileName[512] = 0; + ProfilePath[512] = 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_NOACTIVATE,(LPARAM)&swp); + ShowWindow(hwndDlg,SW_HIDE); + } + + if (CallService(MS_DB_GETPROFILENAME,(WPARAM)512,(LPARAM)ProfileName)) + ProfileName[0] = 0; + + if (CallService(MS_DB_GETPROFILEPATH,(WPARAM)512,(LPARAM)ProfilePath)) + ProfilePath[0] = 0; + + mir_snprintf(Title, sizeof(Title), "%s - %s\\%s", Translate("Miranda Console"), ProfilePath, ProfileName); + + SetWindowTextA(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) break; + + if (!gSingleMode) + { + lw2.Module = dumpMsg->szModule; + if (!li.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); + li.List_Insert(&lModules, lw, idx); + + if (!gSingleMode && lParam) + { + tci.mask = TCIF_PARAM | TCIF_TEXT; + tci.lParam = (LPARAM)lw; +#ifdef _UNICODE + tci.pszText = mir_a2u(lw->Module); + idx = TabCtrl_InsertItem(hTabs, tabCount, &tci); + mir_free(tci.pszText); +#else + tci.pszText = lw->Module; + idx = TabCtrl_InsertItem(hTabs, tabCount, &tci); +#endif + 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; + } + } + + li.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 = strlen(logMsg->pszHead); + DWORD msglen = strlen(logMsg->pszMsg); + DWORD len = (headlen + msglen + 1) * sizeof(TCHAR) + sizeof(DUMPMSG); + DUMPMSG *dumpMsg = (DUMPMSG*)malloc( len ); + TCHAR *str = dumpMsg->szMsg; + + strncpy(dumpMsg->szModule, ((NETLIBUSER*)wParam)->szDescriptiveName, sizeof(dumpMsg->szModule))[ sizeof(dumpMsg->szModule)-1 ] = 0; + +#ifdef _UNICODE + { + 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 ); + } +#else + memcpy( str, logMsg->pszHead, headlen ); + memcpy( str + headlen, logMsg->pszMsg, msglen + 1 ); + + // try to detect utf8 + mir_utf8decode( str + headlen, NULL ); +#endif + 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 BOOL 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.position = 0; + odp.hInstance = hInst; + odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS); + odp.ptszGroup = TranslateT("Network"); + odp.ptszTitle = TranslateT("Console"); + odp.pfnDlgProc = OptDlgProc; + odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR; + odp.expertOnlyControls = NULL; + CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&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) +{ + int i = 1; + if ( !hHooks[0] ) + hHooks[0] = HookEvent( ME_NETLIB_FASTDUMP, OnFastDump ); + + CreateServiceFunction(MS_CONSOLE_SHOW_HIDE, ShowHideConsole); + + + if (ServiceExists(MS_FONT_REGISTERT)) + { + 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); + + CallService(MS_FONT_REGISTERT,(WPARAM)&fid,0); + + hHooks[i++] = HookEvent(ME_FONT_RELOAD,OnFontChange); + } + + if (ServiceExists(MS_COLOUR_REGISTERT)) + { + 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); + + CallService(MS_COLOUR_REGISTERT,(WPARAM)&cid,0); + + hHooks[i++] = HookEvent(ME_COLOUR_RELOAD, OnColourChange); + } + + if (ServiceExists(MS_HOTKEY_REGISTER)) + { + HOTKEYDESC hkd = {0}; + + hkd.cbSize=sizeof(hkd); + + hkd.pszName = "Console_Show_Hide"; + hkd.pszDescription = Translate("Show/Hide Console"); + hkd.pszSection = "Main"; + hkd.pszService = MS_CONSOLE_SHOW_HIDE; + hkd.DefHotKey = HOTKEYCODE(HOTKEYF_EXT, 'C'); + + CallService(MS_HOTKEY_REGISTER,(WPARAM)0,(LPARAM)&hkd); + } + + if (ServiceExists(MS_TB_ADDBUTTON)) + { + SKINICONDESC sid={0}; + TBButton tbb = {0}; + char szModuleFileName[MAX_PATH]={0}; + + GetModuleFileNameA(hInst,szModuleFileName,MAX_PATH); + + sid.cbSize = sizeof(sid); + sid.pszSection = Translate("Console"); + sid.pszDefaultFile = szModuleFileName; + + sid.pszDescription = Translate("Show"); + sid.pszName = "Console_Up"; + sid.iDefaultIndex = -IDI_BTN_UP; + CallService(MS_SKIN2_ADDICON,0,(LPARAM)&sid); + + sid.pszDescription = Translate("Hide"); + sid.pszName = "Console_Down"; + sid.iDefaultIndex = -IDI_BTN_DN; + CallService(MS_SKIN2_ADDICON,0,(LPARAM)&sid); + + tbb.cbSize = sizeof(TBButton); + tbb.pszButtonID = "console_btn"; + tbb.pszButtonName = Translate("Show/Hide Console"); + tbb.pszServiceName = MS_CONSOLE_SHOW_HIDE; + tbb.hPrimaryIconHandle = (HANDLE)CallService(MS_SKIN2_GETICONHANDLE,0, (LPARAM)"Console_Up"); + tbb.hSecondaryIconHandle = (HANDLE)CallService(MS_SKIN2_GETICONHANDLE,0, (LPARAM)"Console_Down"); + tbb.pszTooltipUp = Translate("Show Console"); + tbb.pszTooltipDn = Translate("Hide Console"); + tbb.tbbFlags = TBBF_VISIBLE|TBBF_SHOWTOOLTIP; + tbb.defPos = 20000; + hTButton = (HANDLE)CallService(MS_TB_ADDBUTTON,0, (LPARAM)&tbb); + } + + if (hwndConsole && IsWindow(hwndConsole)) + { + CLISTMENUITEM mi={0}; +#ifdef TTB + hHooks[i++] = HookEvent(ME_TTB_MODULELOADED, OnTTBLoaded); +#endif + 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 = (HANDLE)CallService(MS_CLIST_ADDMAINMENUITEM,0,(LPARAM)&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) +{ + int i; + + if (hwndConsole) { + PostMessage(hwndConsole, WM_CLOSE, 0, 1 ); + } + + for (i=0;iModule, lw2->Module ); +} + +/////////////////////////////////////////////////////////////////////////////// + +static UINT logicons[] = {IDI_EMPTY, IDI_ARROW, IDI_IN, IDI_OUT, IDI_INFO}; + + +void InitConsole() +{ + int i; + HICON hi; + + mir_getMMI(&mmi); + mir_getUTFI(&utfi); + mir_getLI(&li); + + lModules.sortFunc = 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); + + hHooks[0] = HookEvent( ME_NETLIB_FASTDUMP, OnFastDump ); +} + +void ShutdownConsole(void) +{ + int i; + + li.List_Destroy(&lModules); + + if (gImg) ImageList_Destroy(gImg); + + for(i = 0; i < SIZEOF(hIcons); i++) { + if (hIcons[i]) DestroyIcon(hIcons[i]); + } + +#ifdef TBB + if (BmpUp) DeleteObject(BmpUp); + if (BmpDn) DeleteObject(BmpDn); +#endif +} + +//////////////////////////////////////////////////////////////////////////////// + +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/console/Console.dsp b/console/Console.dsp new file mode 100644 index 0000000..292f47e --- /dev/null +++ b/console/Console.dsp @@ -0,0 +1,363 @@ +# Microsoft Developer Studio Project File - Name="Console" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=Console - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "Console.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "Console.mak" CFG="Console - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "Console - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "Console - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "Console - Win32 Debug Unicode" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "Console - Win32 Release Unicode" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "Perforce Project" +# PROP Scc_LocalPath "." +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "Console - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir ".\Debug" +# PROP BASE Intermediate_Dir ".\Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir ".\Debug" +# PROP Intermediate_Dir ".\Debug" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MDd /W3 /GX /Zi /Od /I "../../include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_USRDLL" /D "Console_EXPORTS" /D "_MBCS" /FR /Yu"Commonheaders.h" /GZ /c +# ADD CPP /nologo /MDd /W3 /GX /Zi /Od /I "../../include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_USRDLL" /D "Console_EXPORTS" /D "_MBCS" /FR /Yu"Commonheaders.h" /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /i "..\..\include" /d "_DEBUG" +# ADD RSC /l 0x409 /i "..\..\include" /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /incremental:no /map /debug /machine:IX86 /out:"..\..\Bin\Debug\plugins\Console.dll" /pdbtype:sept +# SUBTRACT BASE LINK32 /pdb:none +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /incremental:no /map /debug /machine:IX86 /out:"..\..\Bin\Debug\plugins\Console.dll" /pdbtype:sept +# SUBTRACT LINK32 /pdb:none + +!ELSEIF "$(CFG)" == "Console - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir ".\Release" +# PROP BASE Intermediate_Dir ".\Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir ".\Release" +# PROP Intermediate_Dir ".\Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MD /W3 /GX /Ox /Ob2 /Gy /I "../../include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "Console_EXPORTS" /D "_MBCS" /FR /Yu"Commonheaders.h" /GF /c +# ADD CPP /nologo /MD /W3 /Zi /Ox /Ot /Os /Ob2 /Gf /Gy /I "../../include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "Console_EXPORTS" /D "_MBCS" /FR /Yu"Commonheaders.h" /GF /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /i "..\..\include" /d "NDEBUG" +# ADD RSC /l 0x409 /i "..\..\include" /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /map /machine:IX86 /out:"..\..\bin\release\plugins\Console.dll" /pdbtype:sept /ALIGN:4096 +# SUBTRACT BASE LINK32 /pdb:none +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /map /machine:IX86 /out:"..\..\bin\release\plugins\Console.dll" /pdbtype:sept /ALIGN:4096 +# SUBTRACT LINK32 /pdb:none + +!ELSEIF "$(CFG)" == "Console - Win32 Debug Unicode" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "$(ConfigurationName)" +# PROP BASE Intermediate_Dir "$(ConfigurationName)" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug_Unicode" +# PROP Intermediate_Dir "Debug_Unicode" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MDd /W3 /GX /Zi /Od /I "../../include" /D "_UNICODE" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_USRDLL" /D "Console_EXPORTS" /FR /Fp".\Debug/Console.pch" /Yu"Commonheaders.h" /Fo".\Debug/" /Fd".\Debug/" /GZ /c +# ADD CPP /nologo /MDd /W3 /GX /Zi /Od /I "../../include" /D "_UNICODE" /D "UNICODE" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_USRDLL" /D "Console_EXPORTS" /FR /Fp".\Debug/Console.pch" /Yu"Commonheaders.h" /Fo".\Debug/" /Fd".\Debug/" /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /i "..\..\include" /d "_DEBUG" +# ADD RSC /l 0x409 /i "..\..\include" /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /incremental:no /pdb:".\Debug\Console.pdb" /map:".\Debug\Console.map" /debug /machine:IX86 /out:"..\..\Bin\Debug Unicode\plugins\Console.dll" /implib:".\Debug/Console.lib" /pdbtype:sept +# SUBTRACT BASE LINK32 /pdb:none +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /incremental:no /pdb:".\Debug\Console.pdb" /map:".\Debug\Console.map" /debug /machine:IX86 /out:"..\..\Bin\Debug Unicode\plugins\Console.dll" /implib:".\Debug/Console.lib" /pdbtype:sept +# SUBTRACT LINK32 /pdb:none + +!ELSEIF "$(CFG)" == "Console - Win32 Release Unicode" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "$(ConfigurationName)" +# PROP BASE Intermediate_Dir "$(ConfigurationName)" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release_Unicode" +# PROP Intermediate_Dir "Release_Unicode" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /GX /Ox /Ob2 /Gy /I "../../include" /D "_UNICODE" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "Console_EXPORTS" /FR /Fo".\Release/" /GF /c +# ADD CPP /nologo /MD /W3 /Zi /Ox /Og /Gf /Gy /I "../../include" /D "_UNICODE" /D "UNICODE" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "Console_EXPORTS" /Fr /Fo".\Release/" /Fd".\Release/" /c +# SUBTRACT CPP /YX /Yc /Yu +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /i "..\..\include" /d "NDEBUG" +# ADD RSC /l 0x409 /i "..\..\include" /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /pdb:".\Release\Console.pdb" /map /machine:IX86 /out:"..\..\bin\release unicode\plugins\Console.dll" /implib:".\Release/Console.lib" /pdbtype:sept /ALIGN:4096 +# SUBTRACT BASE LINK32 /pdb:none +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /map /debug /machine:IX86 /out:"Release_Unicode\Plugins\Console.dll" /implib:".\Release/Console.lib" +# SUBTRACT LINK32 /pdb:none + +!ENDIF + +# Begin Target + +# Name "Console - Win32 Debug" +# Name "Console - Win32 Release" +# Name "Console - Win32 Debug Unicode" +# Name "Console - Win32 Release Unicode" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=Commonheaders.c +DEP_CPP_COMMO=\ + ".\Commonheaders.h"\ + ".\m_toolbar.h"\ + ".\m_toptoolbar.h"\ + ".\version.h"\ + {$(INCLUDE)}"m_button.h"\ + {$(INCLUDE)}"m_clist.h"\ + {$(INCLUDE)}"m_clui.h"\ + {$(INCLUDE)}"m_database.h"\ + {$(INCLUDE)}"m_fontservice.h"\ + {$(INCLUDE)}"m_hotkeys.h"\ + {$(INCLUDE)}"m_icolib.h"\ + {$(INCLUDE)}"m_langpack.h"\ + {$(INCLUDE)}"m_netlib.h"\ + {$(INCLUDE)}"m_options.h"\ + {$(INCLUDE)}"m_plugins.h"\ + {$(INCLUDE)}"m_system.h"\ + {$(INCLUDE)}"m_utils.h"\ + {$(INCLUDE)}"newpluginapi.h"\ + {$(INCLUDE)}"statusmodes.h"\ + {$(INCLUDE)}"win2k.h"\ + + +!IF "$(CFG)" == "Console - Win32 Debug" + +# ADD CPP /nologo /GX /Od /FR /Yc"Commonheaders.h" /GZ + +!ELSEIF "$(CFG)" == "Console - Win32 Release" + +# ADD CPP /nologo /GX /O2 /FR /Yc"Commonheaders.h" + +!ELSEIF "$(CFG)" == "Console - Win32 Debug Unicode" + +# ADD CPP /nologo /GX /Od /FR /Yc"Commonheaders.h" /GZ + +!ELSEIF "$(CFG)" == "Console - Win32 Release Unicode" + +# ADD CPP /nologo /GX /O2 /FR + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=Console.c +DEP_CPP_CONSO=\ + ".\Commonheaders.h"\ + ".\m_toolbar.h"\ + ".\m_toptoolbar.h"\ + ".\version.h"\ + {$(INCLUDE)}"m_button.h"\ + {$(INCLUDE)}"m_clist.h"\ + {$(INCLUDE)}"m_clui.h"\ + {$(INCLUDE)}"m_database.h"\ + {$(INCLUDE)}"m_fontservice.h"\ + {$(INCLUDE)}"m_hotkeys.h"\ + {$(INCLUDE)}"m_icolib.h"\ + {$(INCLUDE)}"m_langpack.h"\ + {$(INCLUDE)}"m_netlib.h"\ + {$(INCLUDE)}"m_options.h"\ + {$(INCLUDE)}"m_plugins.h"\ + {$(INCLUDE)}"m_system.h"\ + {$(INCLUDE)}"m_utils.h"\ + {$(INCLUDE)}"newpluginapi.h"\ + {$(INCLUDE)}"statusmodes.h"\ + {$(INCLUDE)}"win2k.h"\ + + +!IF "$(CFG)" == "Console - Win32 Debug" + +# ADD CPP /nologo /GX /Od /FR /GZ + +!ELSEIF "$(CFG)" == "Console - Win32 Release" + +# ADD CPP /nologo /GX /O2 /FR + +!ELSEIF "$(CFG)" == "Console - Win32 Debug Unicode" + +# ADD CPP /nologo /GX /Od /FR /GZ + +!ELSEIF "$(CFG)" == "Console - Win32 Release Unicode" + +# ADD CPP /nologo /GX /O2 /FR + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\init.c +DEP_CPP_INIT_=\ + ".\Commonheaders.h"\ + ".\m_toolbar.h"\ + ".\m_toptoolbar.h"\ + ".\version.h"\ + {$(INCLUDE)}"m_button.h"\ + {$(INCLUDE)}"m_clist.h"\ + {$(INCLUDE)}"m_clui.h"\ + {$(INCLUDE)}"m_database.h"\ + {$(INCLUDE)}"m_fontservice.h"\ + {$(INCLUDE)}"m_hotkeys.h"\ + {$(INCLUDE)}"m_icolib.h"\ + {$(INCLUDE)}"m_langpack.h"\ + {$(INCLUDE)}"m_netlib.h"\ + {$(INCLUDE)}"m_options.h"\ + {$(INCLUDE)}"m_plugins.h"\ + {$(INCLUDE)}"m_system.h"\ + {$(INCLUDE)}"m_utils.h"\ + {$(INCLUDE)}"newpluginapi.h"\ + {$(INCLUDE)}"statusmodes.h"\ + {$(INCLUDE)}"win2k.h"\ + +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=Commonheaders.h +# End Source File +# Begin Source File + +SOURCE=.\resource.h +# End Source File +# Begin Source File + +SOURCE=.\version.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# Begin Source File + +SOURCE=.\res\btn_dn.ico +# End Source File +# Begin Source File + +SOURCE=.\res\btn_up.ico +# End Source File +# Begin Source File + +SOURCE=.\res\close.ico +# End Source File +# Begin Source File + +SOURCE=Res\console.ico +# End Source File +# Begin Source File + +SOURCE=Res\console_dn.bmp +# End Source File +# Begin Source File + +SOURCE=Res\console_up.bmp +# End Source File +# Begin Source File + +SOURCE=.\Res\copy.ico +# End Source File +# Begin Source File + +SOURCE=.\Res\delete.ico +# End Source File +# Begin Source File + +SOURCE=.\res\noscroll.ico +# End Source File +# Begin Source File + +SOURCE=.\Res\options.ico +# End Source File +# Begin Source File + +SOURCE=.\res\pause.ico +# End Source File +# Begin Source File + +SOURCE=.\res\paused.ico +# End Source File +# Begin Source File + +SOURCE=resource.rc +# End Source File +# Begin Source File + +SOURCE=.\Res\Save.ico +# End Source File +# Begin Source File + +SOURCE=.\res\scroll.ico +# End Source File +# Begin Source File + +SOURCE=.\res\start.ico +# End Source File +# Begin Source File + +SOURCE=.\res\started.ico +# End Source File +# End Group +# End Target +# End Project diff --git a/console/Console.dsw b/console/Console.dsw new file mode 100644 index 0000000..3250410 --- /dev/null +++ b/console/Console.dsw @@ -0,0 +1,33 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00 +# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! + +############################################################################### + +Project: "Console"=Console.dsp - Package Owner=<4> + +Package=<5> +{{{ + begin source code control + Perforce Project + . + end source code control +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### + diff --git a/console/Console.ncb b/console/Console.ncb new file mode 100644 index 0000000..3f192e6 Binary files /dev/null and b/console/Console.ncb differ diff --git a/console/Console.opt b/console/Console.opt new file mode 100644 index 0000000..8c2c900 Binary files /dev/null and b/console/Console.opt differ diff --git a/console/Console.plg b/console/Console.plg new file mode 100644 index 0000000..60b675e --- /dev/null +++ b/console/Console.plg @@ -0,0 +1,49 @@ + + +
+

Build Log

+

+--------------------Configuration: Console - Win32 Release Unicode-------------------- +

+

Command Lines

+Creating command line "rc.exe /l 0x409 /fo"Release_Unicode/resource.res" /i "..\..\include" /d "NDEBUG" "D:\Sources\svn.miranda.im\console\trunk\resource.rc"" +Creating temporary file "C:\Temp\RSPB728.tmp" with contents +[ +/nologo /MD /W3 /GX /Zi /O2 /I "../../include" /D "_UNICODE" /D "UNICODE" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "Console_EXPORTS" /FR"Release_Unicode/" /Fo".\Release/" /Fd".\Release/" /c +"D:\Sources\svn.miranda.im\console\trunk\Commonheaders.c" +"D:\Sources\svn.miranda.im\console\trunk\Console.c" +] +Creating command line "cl.exe @C:\Temp\RSPB728.tmp" +Creating temporary file "C:\Temp\RSPB729.tmp" with contents +[ +/nologo /MD /W3 /Zi /Ox /Og /Gf /Gy /I "../../include" /D "_UNICODE" /D "UNICODE" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "Console_EXPORTS" /Fr"Release_Unicode/" /Fo".\Release/" /Fd".\Release/" /c +"D:\Sources\svn.miranda.im\console\trunk\init.c" +] +Creating command line "cl.exe @C:\Temp\RSPB729.tmp" +Creating temporary file "C:\Temp\RSPB72A.tmp" with contents +[ +kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /incremental:no /pdb:"Release_Unicode/Console.pdb" /map:"Release_Unicode/Console.map" /debug /machine:IX86 /out:"Release_Unicode\Plugins\Console.dll" /implib:".\Release/Console.lib" +.\Release\Commonheaders.obj +.\Release\Console.obj +.\Release\init.obj +.\Release_Unicode\resource.res +] +Creating command line "link.exe @C:\Temp\RSPB72A.tmp" +

Output Window

+Compiling resources... +Compiling... +Commonheaders.c +Console.c +Generating Code... +Compiling... +init.c +Linking... + Creating library .\Release/Console.lib and object .\Release/Console.exp + + + +

Results

+Console.dll - 0 error(s), 0 warning(s) +
+ + diff --git a/console/Console.sln b/console/Console.sln new file mode 100644 index 0000000..04d0cb6 --- /dev/null +++ b/console/Console.sln @@ -0,0 +1,28 @@ +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual C++ Express 2010 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Console", "Console.vcxproj", "{A231E008-2D1A-4F24-95DD-59F56F85A499}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug Unicode|Win32 = Debug Unicode|Win32 + Debug|Win32 = Debug|Win32 + Release Unicode|Win32 = Release Unicode|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {A231E008-2D1A-4F24-95DD-59F56F85A499}.Debug Unicode|Win32.ActiveCfg = Debug Unicode|Win32 + {A231E008-2D1A-4F24-95DD-59F56F85A499}.Debug Unicode|Win32.Build.0 = Debug Unicode|Win32 + {A231E008-2D1A-4F24-95DD-59F56F85A499}.Debug|Win32.ActiveCfg = Debug|Win32 + {A231E008-2D1A-4F24-95DD-59F56F85A499}.Debug|Win32.Build.0 = Debug|Win32 + {A231E008-2D1A-4F24-95DD-59F56F85A499}.Release Unicode|Win32.ActiveCfg = Release Unicode|Win32 + {A231E008-2D1A-4F24-95DD-59F56F85A499}.Release Unicode|Win32.Build.0 = Release Unicode|Win32 + {A231E008-2D1A-4F24-95DD-59F56F85A499}.Release|Win32.ActiveCfg = Release|Win32 + {A231E008-2D1A-4F24-95DD-59F56F85A499}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(DPCodeReviewSolutionGUID) = preSolution + DPCodeReviewSolutionGUID = {00000000-0000-0000-0000-000000000000} + EndGlobalSection +EndGlobal diff --git a/console/Console.suo b/console/Console.suo new file mode 100644 index 0000000..45e2af4 Binary files /dev/null and b/console/Console.suo differ diff --git a/console/Console.vcproj b/console/Console.vcproj new file mode 100644 index 0000000..3814d7b --- /dev/null +++ b/console/Console.vcproj @@ -0,0 +1,634 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/console/Console.vcproj.Note.Leonid.user b/console/Console.vcproj.Note.Leonid.user new file mode 100644 index 0000000..c05c96a --- /dev/null +++ b/console/Console.vcproj.Note.Leonid.user @@ -0,0 +1,121 @@ + + + + + + + + + + + + + + + + + diff --git a/console/Console.vcxproj b/console/Console.vcxproj new file mode 100644 index 0000000..9589d4c --- /dev/null +++ b/console/Console.vcxproj @@ -0,0 +1,348 @@ + + + + + Debug Unicode + Win32 + + + Debug + Win32 + + + Release Unicode + Win32 + + + Release + Win32 + + + + {A231E008-2D1A-4F24-95DD-59F56F85A499} + Console + + + + + + + + DynamicLibrary + false + Unicode + + + DynamicLibrary + false + Unicode + + + DynamicLibrary + false + MultiByte + + + DynamicLibrary + false + MultiByte + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + .\Debug\ + .\Debug\ + false + .\Release\ + .\Release\ + false + $(Configuration)\ + $(Configuration)\ + false + $(SolutionDir)$(Configuration)/Plugins\ + $(SolutionDir)$(Configuration)/Obj/$(ProjectName)\ + false + D:\Sources\miranda9_trunk\miranda\include;$(IncludePath) + + + + _DEBUG;%(PreprocessorDefinitions) + true + true + Win32 + .\Debug/Console.tlb + + + + + Disabled + ../../include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;_USRDLL;Console_EXPORTS;%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebugDLL + Use + Commonheaders.h + .\Debug/Console.pch + .\Debug/ + .\Debug/ + .\Debug/ + true + Level3 + true + ProgramDatabase + Default + + + _DEBUG;%(PreprocessorDefinitions) + 0x0409 + ../../include;%(AdditionalIncludeDirectories) + + + ../../Bin/Debug/plugins/Console.dll + true + true + .\Debug/Console.pdb + true + .\Debug/Console.map + false + + + .\Debug/Console.lib + MachineX86 + + + + + NDEBUG;%(PreprocessorDefinitions) + true + true + Win32 + .\Release/Console.tlb + + + + + Full + AnySuitable + ../../include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;_USRDLL;Console_EXPORTS;%(PreprocessorDefinitions) + true + MultiThreadedDLL + true + Use + Commonheaders.h + .\Release/Console.pch + .\Release/ + .\Release/ + .\Release/ + true + Level3 + true + Default + + + NDEBUG;%(PreprocessorDefinitions) + 0x0409 + ../../include;%(AdditionalIncludeDirectories) + + + /ALIGN:4096 %(AdditionalOptions) + ../../bin/release/plugins/Console.dll + true + .\Release/Console.pdb + true + false + + + .\Release/Console.lib + MachineX86 + + + + + _DEBUG;%(PreprocessorDefinitions) + true + true + Win32 + .\Debug/Console.tlb + + + + + Disabled + ../../include;%(AdditionalIncludeDirectories) + _UNICODE;WIN32;_DEBUG;_WINDOWS;_USRDLL;Console_EXPORTS;%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebugDLL + Use + Commonheaders.h + .\Debug/Console.pch + .\Debug/ + .\Debug/ + .\Debug/ + true + Level3 + true + ProgramDatabase + Default + + + _DEBUG;%(PreprocessorDefinitions) + 0x0409 + ../../include;%(AdditionalIncludeDirectories) + + + ../../Bin/Debug Unicode/plugins/Console.dll + true + true + .\Debug/Console.pdb + true + .\Debug/Console.map + false + + + .\Debug/Console.lib + MachineX86 + + + + + NDEBUG;%(PreprocessorDefinitions) + true + true + Win32 + .\Release/Console.tlb + + + + + Full + AnySuitable + ../../include;%(AdditionalIncludeDirectories) + _UNICODE;WIN32;NDEBUG;_WINDOWS;_USRDLL;Console_EXPORTS;%(PreprocessorDefinitions) + true + MultiThreaded + true + Use + Commonheaders.h + .\Release/Console.pch + .\Release/ + .\Release/ + .\Release/ + true + Level3 + true + Default + + + NDEBUG;%(PreprocessorDefinitions) + 0x0409 + ../../include;%(AdditionalIncludeDirectories) + + + /ALIGN:4096 %(AdditionalOptions) + true + .\Release/Console.pdb + true + false + + + .\Release/Console.lib + MachineX86 + + + + + Disabled + %(AdditionalIncludeDirectories) + EnableFastChecks + Create + true + Disabled + %(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;Console_EXPORTS + EnableFastChecks + Create + true + MaxSpeed + %(AdditionalIncludeDirectories) + Create + true + MaxSpeed + %(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;Console_EXPORTS + Create + true + + + Disabled + %(AdditionalIncludeDirectories) + EnableFastChecks + true + Disabled + %(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;Console_EXPORTS + EnableFastChecks + true + MaxSpeed + %(AdditionalIncludeDirectories) + true + MaxSpeed + %(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;Console_EXPORTS + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/console/Console.vcxproj.filters b/console/Console.vcxproj.filters new file mode 100644 index 0000000..7a841a2 --- /dev/null +++ b/console/Console.vcxproj.filters @@ -0,0 +1,103 @@ + + + + + {94e1a2e5-64bb-4574-a01b-61fbe40e73e2} + cpp;c;cxx;rc;def;r;odl;idl;hpj;bat + + + {a5d1caa4-5b85-489a-bedc-9709b86d7dc0} + h;hpp;hxx;hm;inl + + + {1e71008e-a4e4-44c1-a0a9-d5fd17cd53f2} + ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe + + + + + 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 + + + Resource Files + + + + + Resource Files + + + \ No newline at end of file diff --git a/console/Console.vcxproj.user b/console/Console.vcxproj.user new file mode 100644 index 0000000..695b5c7 --- /dev/null +++ b/console/Console.vcxproj.user @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/console/Console_history.txt b/console/Console_history.txt new file mode 100644 index 0000000..0801dc0 --- /dev/null +++ b/console/Console_history.txt @@ -0,0 +1,174 @@ +PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND... +ONLY MORAL SUPPORT IN SPECIAL CASES CAN BE PROVIDED 8-) +-------------------------------------------------------------------------------- + +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/console/Console_readme.txt b/console/Console_readme.txt new file mode 100644 index 0000000..6d66f9b --- /dev/null +++ b/console/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/console/commonheaders.c b/console/commonheaders.c new file mode 100644 index 0000000..cbfb79d --- /dev/null +++ b/console/commonheaders.c @@ -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/console/commonheaders.h b/console/commonheaders.h new file mode 100644 index 0000000..05a5d96 --- /dev/null +++ b/console/commonheaders.h @@ -0,0 +1,69 @@ +/* + +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 0x0800 + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "m_toolbar.h" +#include "m_toptoolbar.h" +#include "resource.h" + +#include "version.h" + +HINSTANCE hInst; + +void InitConsole(); +void ShutdownConsole(); + +#define MS_NETLIB_LOGWIN "Netlib/Log/Win" diff --git a/console/gpl.txt b/console/gpl.txt new file mode 100644 index 0000000..45645b4 --- /dev/null +++ b/console/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/console/init.c b/console/init.c new file mode 100644 index 0000000..91c4a2d --- /dev/null +++ b/console/init.c @@ -0,0 +1,90 @@ +/* + +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" + +#pragma comment(exestr, "\n\n Bio was here 8-) \n") + + +PLUGINLINK *pluginLink; +DWORD mirandaVer; + + +PLUGININFOEX pluginInfoEx={ + sizeof(PLUGININFOEX), + __PLUGIN_NAME, + __VERSION_DWORD, + __PLUGIN_LONGDESC, + __PLUGIN_AUTHOR, + __PLUGIN_EMAIL, + __PLUGIN_RIGHTS, + __PLUGIN_URL, + UNICODE_AWARE, + 0, + MIID_CONSOLE +}; + + +BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvReserved) +{ + hInst = hinstDLL; + return TRUE; +} + +//////////////////////////////////////////////////////////////////////////////// + +__declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion) +{ + mirandaVer = mirandaVersion; + return &pluginInfoEx; +} + +// we implement service mode interface +static const MUUID interfaces[] = {MIID_LOGWINDOW, MIID_LAST}; +__declspec(dllexport) const MUUID* MirandaPluginInterfaces(void) +{ + return interfaces; +} + +//////////////////////////////////////////////////////////////////////////////// + +int __declspec(dllexport) Load(PLUGINLINK *link) +{ + pluginLink = link; + + if (mirandaVer < PLUGIN_MAKE_VERSION(0,8,0,3)) + return -1; + else + { + InitCommonControls(); + InitConsole(); + return 0; + } +} + + +int __declspec(dllexport) Unload(void) +{ + ShutdownConsole(); + return 0; +} diff --git a/console/m_toolbar.h b/console/m_toolbar.h new file mode 100644 index 0000000..fc417cf --- /dev/null +++ b/console/m_toolbar.h @@ -0,0 +1,88 @@ +#ifndef M_TOOLBAR_H +#define M_TOOLBAR_H + +#define TOOLBARBUTTON_ICONIDPREFIX "MTB_" +#define TOOLBARBUTTON_ICONIDPRIMARYSUFFIX "_Primary" +#define TOOLBARBUTTON_ICONIDSECONDARYSUFFIX "_Secondary" +#define TOOLBARBUTTON_ICONNAMEPRESSEDSUFFIX "Pressed" + +//button flags +#define TBBF_DISABLED (1<<0) +#define TBBF_VISIBLE (1<<1) +#define TBBF_PUSHED (1<<2) +#define TBBF_SHOWTOOLTIP (1<<3) +#define TBBF_ISSEPARATOR (1<<5) +#define TBBF_ISLBUTTON (1<<6) +#define TBBF_FLEXSIZESEPARATOR (TBBF_ISSEPARATOR|TBBF_PUSHED) +typedef struct _tagTBButton +{ + int cbSize; // size of structure + char * pszButtonID; // char id of button used to store button info in DB and know about icon + char * pszButtonName; // name of button (not translated) + char * pszServiceName; // service name to be executed + LPARAM lParam; // param of service to be called + char * pszTooltipUp, *pszTooltipDn; + DWORD defPos; // default order pos of button (less values are nearer to edge).. please use values greater that 100. the default buttons has pos: 10,20..90 + DWORD tbbFlags; // combine of TBBF_ flags above + void (*ParamDestructor)(void *); //will be called on parameters deletion + HANDLE hPrimaryIconHandle; + HANDLE hSecondaryIconHandle; +}TBButton; + +////////////////////////////////////////////////////////////////////////// +// Events +// Only after this event module subscribers should register their buttons +// wparam=lparam=0 +// don't forget to return 0 to continue processing +#define ME_TB_MODULELOADED "ToolBar/ModuleLoaded" + +////////////////////////////////////////////////////////////////////////// +// Services +// +////////////////////////////////////////////////////////////////////////// +// Adding a button +// WPARAM = 0 +// LPARAM = (TBButton *) &description +// LRESULT = (HANDLE) hButton +// in order to correctly process default icons via iconlib it should be +// registered icolib icon with id named: +// 'TBButton_'+pszButtonID+ 'Up' or +'Down' for Push (2-state) buttons +#define MS_TB_ADDBUTTON "ToolBar/AddButton" + +////////////////////////////////////////////////////////////////////////// +// Remove button +// WPARAM = (HANDLE) hButton; +// LPARAM = 0; +#define MS_TB_REMOVEBUTTON "ToolBar/RemoveButton" + +////////////////////////////////////////////////////////////////////////// +// SetState +// WPARAM = (HANDLE) hButton; +// LPARAM = one of below TBST_ states +// LRESULT= old state +#define TBST_PUSHED 1 +#define TBST_RELEASED 0 +#define MS_TB_SETBUTTONSTATE "ToolBar/SetButtonState" + +////////////////////////////////////////////////////////////////////////// +// SetStatebyId +// WPARAM = (char *) szButtonID; +// LPARAM = one of below TBST_ states +// LRESULT= old state +#define MS_TB_SETBUTTONSTATEBYID "ToolBar/SetButtonStateId" +////////////////////////////////////////////////////////////////////////// +// GetState +// WPARAM = (HANLDE) hButton; +// LPARAM = 0 +// LRESULT= current state +#define MS_TB_GETBUTTONSTATE "ToolBar/GetButtonState" + +////////////////////////////////////////////////////////////////////////// +// GetState +// WPARAM = (char *) szButtonID;; +// LPARAM = 0 +// LRESULT= current state +#define MS_TB_GETBUTTONSTATEBYID "ToolBar/GetButtonStateId" + + +#endif \ No newline at end of file diff --git a/console/m_toptoolbar.h b/console/m_toptoolbar.h new file mode 100644 index 0000000..5628f68 --- /dev/null +++ b/console/m_toptoolbar.h @@ -0,0 +1,125 @@ + +#ifndef M_TOPTOOLBAR_H +#define M_TOPTOOLBAR_H + +//button flags +#define TTBBF_DISABLED 1 +#define TTBBF_VISIBLE 2 +#define TTBBF_PUSHED 4 +#define TTBBF_SHOWTOOLTIP 8 +#define TTBBF_DRAWBORDER 16//draw border for bitmap,bitmap must be WxH 16x12 +#define TTBBF_ISSEPARATOR 32 + +//for internal launch buttons +#define TTBBF_ISLBUTTON 64 + +typedef struct { + int cbSize; + HBITMAP hbBitmapUp; + HBITMAP hbBitmapDown; + char *pszServiceUp; + char *pszServiceDown; + DWORD dwFlags; + LPARAM lParamUp; + WPARAM wParamUp; + LPARAM lParamDown; + WPARAM wParamDown; + char *name; + +} TTBButton, * lpTTBButton; + +typedef struct { + int cbSize; + HBITMAP hbBitmapUp; + HBITMAP hbBitmapDown; + char *pszServiceUp; + char *pszServiceDown; + DWORD dwFlags; + LPARAM lParamUp; + WPARAM wParamUp; + LPARAM lParamDown; + WPARAM wParamDown; + char *name; + HICON hIconUp,hIconDn; + char *tooltipUp; + char *tooltipDn; + +} TTBButtonV2, * lpTTBButtonV2; + +//=== EVENTS === +/* +toptoolbar/moduleloaded event +wParam = lParam = 0 +Called when the toolbar services are available + +!!!Warning you may work with TTB services only in this event or later. + +*/ +#define ME_TTB_MODULELOADED "TopToolBar/ModuleLoaded" + + + +//=== SERVICES === +/* +toptoolbar/addbutton service +wparam = (TTBButton*)lpTTBButton +lparam = 0 +returns: hTTBButton - handle of added button on success, -1 on failure. +*/ +#define MS_TTB_ADDBUTTON "TopToolBar/AddButton" + +/* +toptoolbar/removebutton service +wparam = (HANDLE)hTTButton +lparam = 0 +returns: 0 on success, -1 on failure. +*/ +#define MS_TTB_REMOVEBUTTON "TopToolBar/RemoveButton" + +/* +toptoolbar/setstate service +wparam = (HANDLE)hTTButton +lparam = (LPARAM) state +returns: 0 on success, -1 on failure. +*/ +#define TTBST_PUSHED 1 +#define TTBST_RELEASED 2 + +#define MS_TTB_SETBUTTONSTATE "TopToolBar/SetState" + +/* +toptoolbar/getstate service +wparam = (HANDLE)hTTButton +lparam = 0 +returns: state on success, -1 on failure. +*/ +#define MS_TTB_GETBUTTONSTATE "TopToolBar/GetState" + +/* +toptoolbar/getoptions service +(HIWORD)wparam = (HANDLE)hTTButton +(LOWORD)wparam = TTBO_FLAG +lparam = 0,or lparam=lpTTBButton if flag=TTBO_ALLDATA +returns: value on success, -1 on failure. +*/ +#define TTBO_FLAGS 0 //get/set all flags +#define TTBO_POS 1 //position +#define TTBO_WIDTH 2 //not impemented +#define TTBO_HEIGHT 3 //not impemented +#define TTBO_TIPNAME 4 //tool tip name +#define TTBO_ALLDATA 5 //change all data via lparam=lpTTBButton + + +#define MS_TTB_GETBUTTONOPTIONS "TopToolBar/GetOptions" + +/* +toptoolbar/setoptions service +(HIWORD)wparam = (HANDLE)hTTButton +(LOWORD)wparam = TTBO_FLAG +lparam = value +returns: 1 on success, -1 on failure. +*/ +#define MS_TTB_SETBUTTONOPTIONS "TopToolBar/SetOptions" + + +#endif \ No newline at end of file diff --git a/console/res/arrow.ico b/console/res/arrow.ico new file mode 100644 index 0000000..56d058b Binary files /dev/null and b/console/res/arrow.ico differ diff --git a/console/res/btn_dn.ico b/console/res/btn_dn.ico new file mode 100644 index 0000000..f86cdc6 Binary files /dev/null and b/console/res/btn_dn.ico differ diff --git a/console/res/btn_up.ico b/console/res/btn_up.ico new file mode 100644 index 0000000..d885ea0 Binary files /dev/null and b/console/res/btn_up.ico differ diff --git a/console/res/close.ico b/console/res/close.ico new file mode 100644 index 0000000..81237d0 Binary files /dev/null and b/console/res/close.ico differ diff --git a/console/res/close2.ico b/console/res/close2.ico new file mode 100644 index 0000000..7e9bd8a Binary files /dev/null and b/console/res/close2.ico differ diff --git a/console/res/console.ico b/console/res/console.ico new file mode 100644 index 0000000..7252e62 Binary files /dev/null and b/console/res/console.ico differ diff --git a/console/res/console_dn.bmp b/console/res/console_dn.bmp new file mode 100644 index 0000000..33bb07c Binary files /dev/null and b/console/res/console_dn.bmp differ diff --git a/console/res/console_up.bmp b/console/res/console_up.bmp new file mode 100644 index 0000000..2cdbb8d Binary files /dev/null and b/console/res/console_up.bmp differ diff --git a/console/res/copy.ico b/console/res/copy.ico new file mode 100644 index 0000000..c27f61f Binary files /dev/null and b/console/res/copy.ico differ diff --git a/console/res/delete.ico b/console/res/delete.ico new file mode 100644 index 0000000..7d931ad Binary files /dev/null and b/console/res/delete.ico differ diff --git a/console/res/empty.ico b/console/res/empty.ico new file mode 100644 index 0000000..567bbe8 Binary files /dev/null and b/console/res/empty.ico differ diff --git a/console/res/in.ico b/console/res/in.ico new file mode 100644 index 0000000..ceda4e6 Binary files /dev/null and b/console/res/in.ico differ diff --git a/console/res/info.ico b/console/res/info.ico new file mode 100644 index 0000000..bf6ada7 Binary files /dev/null and b/console/res/info.ico differ diff --git a/console/res/noscroll.ico b/console/res/noscroll.ico new file mode 100644 index 0000000..76c97c8 Binary files /dev/null and b/console/res/noscroll.ico differ diff --git a/console/res/options.ico b/console/res/options.ico new file mode 100644 index 0000000..2dbffa5 Binary files /dev/null and b/console/res/options.ico differ diff --git a/console/res/out.ico b/console/res/out.ico new file mode 100644 index 0000000..96425d3 Binary files /dev/null and b/console/res/out.ico differ diff --git a/console/res/pause.ico b/console/res/pause.ico new file mode 100644 index 0000000..6e177a1 Binary files /dev/null and b/console/res/pause.ico differ diff --git a/console/res/paused.ico b/console/res/paused.ico new file mode 100644 index 0000000..2d077bd Binary files /dev/null and b/console/res/paused.ico differ diff --git a/console/res/save.ico b/console/res/save.ico new file mode 100644 index 0000000..4bb07fb Binary files /dev/null and b/console/res/save.ico differ diff --git a/console/res/scroll.ico b/console/res/scroll.ico new file mode 100644 index 0000000..abf4595 Binary files /dev/null and b/console/res/scroll.ico differ diff --git a/console/res/start.ico b/console/res/start.ico new file mode 100644 index 0000000..9272803 Binary files /dev/null and b/console/res/start.ico differ diff --git a/console/res/started.ico b/console/res/started.ico new file mode 100644 index 0000000..3bc0da2 Binary files /dev/null and b/console/res/started.ico differ diff --git a/console/resource.h b/console/resource.h new file mode 100644 index 0000000..e0b9ed2 --- /dev/null +++ b/console/resource.h @@ -0,0 +1,58 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by resource.rc +// +#define IDB_CONSOLE_UP 100 +#define IDB_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/console/resource.rc b/console/resource.rc new file mode 100644 index 0000000..d6f054e --- /dev/null +++ b/console/resource.rc @@ -0,0 +1,223 @@ +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include +#include +#include +#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 "&S",IDC_SAVE,"MButtonClass",WS_TABSTOP,0,1,14,16, + 0x18000000L + CONTROL "&P",IDC_PAUSE,"MButtonClass",WS_TABSTOP,16,1,14,16, + 0x18000000L + CONTROL "&Q",IDC_SCROLL,"MButtonClass",WS_TABSTOP,32,1,14,16, + 0x18000000L + CONTROL "&C",IDC_COPY,"MButtonClass",WS_TABSTOP,48,1,14,16, + 0x18000000L + CONTROL "&D",IDC_DELETE,"MButtonClass",WS_TABSTOP,64,1,14,16, + 0x18000000L + CONTROL "&O",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 "&W",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 + + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 0,0,7,2 + PRODUCTVERSION 0,0,7,2 + 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", "Console log window for Miranda 0.8.0.3+" + VALUE "FileVersion", "0.0.7.2" + VALUE "InternalName", "Console" + VALUE "LegalCopyright", "© 2005-2009 Bio" + VALUE "OriginalFilename", "Console.dll" + VALUE "ProductName", "Console" + VALUE "ProductVersion", "0.0.7.2" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0, 1200 + END +END + + +///////////////////////////////////////////////////////////////////////////// +// +// 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" + +///////////////////////////////////////////////////////////////////////////// +// +// Bitmap +// + +IDB_CONSOLE_UP BITMAP "res\\console_up.bmp" +IDB_CONSOLE_DOWN BITMAP "res\\console_dn.bmp" + +///////////////////////////////////////////////////////////////////////////// +// +// 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/console/version.h b/console/version.h new file mode 100644 index 0000000..f7a19ef --- /dev/null +++ b/console/version.h @@ -0,0 +1,51 @@ +/* + +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,2 +#define __VERSION_STRING "0.0.7.2" +#define __VERSION_DWORD 0x00000702 + + +#define __PLUGIN_DESC "Console log window for Miranda 0.8.0.3+" +#define __PLUGIN_LONGDESC __PLUGIN_DESC ". Compiled by Bio. Enjoy! 8-) [ Built "__DATE__" "__TIME__" ]" +#define __PLUGIN_AUTHOR "Bio" +#define __PLUGIN_EMAIL "bio@msx.ru" +#define __PLUGIN_RIGHTS "© 2005-2009 Bio" +#define __PLUGIN_FILE "Console.dll" +#define __PLUGIN_SHORTNAME "Console" + + +#ifdef _UNICODE + // {23D4F302-D513-45b7-9027-445F29557311} + #define MIID_CONSOLE { 0x23d4f302, 0xd513, 0x45b7, { 0x90, 0x27, 0x44, 0x5f, 0x29, 0x55, 0x73, 0x11 }} + #define __PLUGIN_NAME __PLUGIN_SHORTNAME " (Unicode)" + #define __PLUGIN_URL "http://addons.miranda-im.org/details.php?action=viewfile&id=3791" +#endif + +#ifndef _UNICODE + // {798A94B8-74F4-46fc-978B-353D22BD485E} + #define MIID_CONSOLE { 0x798a94b8, 0x74f4, 0x46fc, { 0x97, 0x8b, 0x35, 0x3d, 0x22, 0xbd, 0x48, 0x5e }} + #define __PLUGIN_NAME __PLUGIN_SHORTNAME " (ANSI)" + #define __PLUGIN_URL "http://addons.miranda-im.org/details.php?action=viewfile&id=3789" +#endif -- cgit v1.2.3