From 75c68d4db1c1bd42ab7145c8973d2a0bde89eac4 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 23 Nov 2012 15:19:16 +0000 Subject: - the same window is reused for the same protocol; - unused file removed; - global variable removed git-svn-id: http://svn.miranda-ng.org/main/trunk@2446 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/CSList/src/cslist.cpp | 151 ++++++++++++++++++++++-------------------- plugins/CSList/src/cslist.h | 30 ++++----- plugins/CSList/src/legacy.h | 87 ------------------------ 3 files changed, 93 insertions(+), 175 deletions(-) delete mode 100644 plugins/CSList/src/legacy.h diff --git a/plugins/CSList/src/cslist.cpp b/plugins/CSList/src/cslist.cpp index 8bcd75e94c..828c204b0a 100644 --- a/plugins/CSList/src/cslist.cpp +++ b/plugins/CSList/src/cslist.cpp @@ -26,15 +26,12 @@ #include "cslist.h" #include "strpos.h" -#include "legacy.h" CLIST_INTERFACE *pcli; int hLangpack; - HINSTANCE g_hInst; -CSWindow *g_hMainWindow; -extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { PLUGIN_GUUID, MIID_LAST }; +static LIST arWindows(3, LIST::FTSortFunc(HandleKeySort)); PLUGININFOEX pluginInfoEx = { @@ -47,7 +44,8 @@ PLUGININFOEX pluginInfoEx = __COPYRIGHT, __AUTHORWEB, UNICODE_AWARE, - PLUGIN_GUUID + // {C8CC7414-6507-4AF6-925A-83C1D2F7BE8C} + { 0xc8cc7414, 0x6507, 0x4af6, { 0x92, 0x5a, 0x83, 0xc1, 0xd2, 0xf7, 0xbe, 0x8c } } }; // ====[ MAIN ]=============================================================== @@ -76,7 +74,7 @@ static int OnDbChanged(WPARAM wparam, LPARAM lparam) if (hContact == NULL) { INT_PTR szUniqueID = CallProtoService(cws->szModule, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0); if (szUniqueID != CALLSERVICE_NOTFOUND && !lstrcmpA(cws->szSetting, (char*)szUniqueID)) - RebuildMenuItems(); + pcli->pfnReloadProtoMenus(); } return 0; } @@ -148,6 +146,7 @@ extern "C" __declspec(dllexport) int Load() extern "C" __declspec(dllexport) int Unload() { + arWindows.destroy(); return FALSE; } @@ -166,11 +165,6 @@ void RegisterHotkeys(char buf[200], TCHAR* accName, int Number) Hotkey_Register(&hotkey); } -void RebuildMenuItems() -{ - pcli->pfnReloadProtoMenus(); -} - void SetStatus(WORD code, StatusItem* item, char *szAccName) { if ( code == IDCLOSE ) @@ -208,16 +202,23 @@ void SetStatus(WORD code, StatusItem* item, char *szAccName) INT_PTR showList(WPARAM wparam, LPARAM lparam, LPARAM param) { - g_hMainWindow = new CSWindow((char*)param); - mir_forkthread(&g_hMainWindow->showWindow, g_hMainWindow); + char* szProto = (char*)param; + for (int i=0; i < arWindows.getCount(); i++) { + CSWindow *p = arWindows[i]; + if ( !strcmp(szProto, p->m_protoName)) { + ShowWindow(p->m_handle, SW_SHOW); + SetForegroundWindow(p->m_handle); + return 1; + } + } + + mir_forkthread(&CSWindow::showWindow, new CSWindow(szProto)); return 0; } -void closeList( HWND hwnd ) +void closeList(HWND hwnd) { - mir_forkthread( &g_hMainWindow->closeWindow, hwnd ); - delete g_hMainWindow; - g_hMainWindow = NULL; + mir_forkthread(&CSWindow::closeWindow, hwnd); } void forAllProtocols( pForAllProtosFunc pFunc, void *arg ) @@ -243,11 +244,11 @@ void addProtoStatusMenuItem( char *protoName, void *arg ) return; mir_snprintf(buf, SIZEOF(buf), "CSList/ShowList/%s", protoName); - if (!ServiceExists(buf)) + if ( !ServiceExists(buf)) CreateServiceFunctionParam(buf, showList, (LPARAM)protoName); CLISTMENUITEM mi = { sizeof(mi) }; - mi.flags = CMIF_TCHAR; + mi.flags = CMIF_TCHAR | CMIF_ICONFROMICOLIB; mi.icolibItem = forms[0].hIcoLibItem; mi.ptszName = _T(MODULENAME); mi.position = 2000040000; @@ -269,13 +270,23 @@ void countProtos( char *protoName, void *arg ) *protosEnabled = ( *protosEnabled )++; } +/////////////////////////////////////////////////////////////////////////////// + +struct importParams +{ + CSWindow* csw; + int* result; +}; + void importCustomStatusUIStatusesFromAllProtos(char *protoName, void *arg) { - int *result = (int*)arg; + importParams* params = (importParams*)arg; + CSWindow* csw = params->csw; + DBVARIANT dbv; char bufTitle[32], bufMessage[32]; - for (int i = 0; i < g_hMainWindow->m_statusCount; i++) { + for (int i = 0; i < csw->m_statusCount; i++) { StatusItem* si = new StatusItem(); si->m_iIcon = i-1; @@ -294,17 +305,17 @@ void importCustomStatusUIStatusesFromAllProtos(char *protoName, void *arg) else si->m_tszMessage[0] = 0; if (si->m_tszTitle[0] || si->m_tszMessage[0]) { - g_hMainWindow->m_itemslist->m_list->add(si); - g_hMainWindow->m_bSomethingChanged = TRUE; + csw->m_itemslist->m_list->add(si); + csw->m_bSomethingChanged = TRUE; } else delete si; - if ( *result == IDYES ) { + if ( *params->result == IDYES ) { db_unset(NULL, protoName, bufTitle); db_unset(NULL, protoName, bufMessage); } } - g_hMainWindow->m_listview->reinitItems(g_hMainWindow->m_itemslist->m_list->getListHead()); + csw->m_listview->reinitItems(csw->m_itemslist->m_list->getListHead()); } /////////////////////////////////////////////////////////////////////////////// @@ -325,7 +336,7 @@ CSWindow::CSWindow(char *protoName) CSWindow::~CSWindow() { delete m_itemslist; - SAFE_FREE( ( void** )&m_filterString ); + SAFE_FREE(( void** )&m_filterString ); } void CSWindow::showWindow( void *arg ) @@ -398,9 +409,7 @@ void CSWindow::initButtons() void CSWindow::loadWindowPosition() { if ( getByte( "RememberWindowPosition", DEFAULT_REMEMBER_WINDOW_POSITION )) - { Utils_RestoreWindowPosition(m_handle,NULL,__INTERNAL_NAME,"Position"); - } } void CSWindow::toggleEmptyListMessage() @@ -445,7 +454,7 @@ void CSWindow::toggleFilter() TCHAR filterText[255]; GetDlgItemText(m_handle, IDC_FILTER_FIELD, filterText, SIZEOF(filterText)); if ( lstrlen( filterText ) > 0 ) - SetDlgItemText( m_handle, IDC_FILTER_FIELD, TEXT( "" )); + SetDlgItemText( m_handle, IDC_FILTER_FIELD, TEXT( "")); } } @@ -548,7 +557,6 @@ void CSAMWindow::fillDialog() SetDlgItemText(m_handle, IDC_MESSAGE, m_item->m_tszMessage); } - void CSAMWindow::checkFieldLimit( WORD action, WORD item ) { BOOL type = ( item == IDC_MESSAGE ) ? TRUE : FALSE; @@ -581,7 +589,6 @@ void CSAMWindow::checkFieldLimit( WORD action, WORD item ) } } - void CSAMWindow::checkItemValidity() { COMBOBOXEXITEM cbi = { 0 }; @@ -638,7 +645,7 @@ CSListView::CSListView(HWND hwnd, CSWindow* parent) lvc.mask = LVCF_TEXT | LVCF_FMT | LVCF_WIDTH | LVCF_SUBITEM; lvc.fmt = LVCFMT_LEFT; lvc.cx = 0x00; - lvc.pszText = TEXT( "" ); + lvc.pszText = TEXT( ""); lvc.cx = 0x16; SendMessage( m_handle, LVM_INSERTCOLUMN, 0, ( LPARAM )&lvc ); lvc.pszText = TranslateT("Title"); @@ -682,7 +689,6 @@ void CSListView::addItem( StatusItem* item, int itemNumber ) SendMessage( m_handle, LVM_SETITEM, 0, ( LPARAM )&lvi ); } - void CSListView::initItems( ListItem< StatusItem >* items ) { ListItem< StatusItem >* help = items; @@ -849,33 +855,32 @@ INT_PTR CALLBACK CSWindowProc( HWND hwnd, UINT message, WPARAM wparam, LPARAM lp { CSWindow* csw = ( CSWindow* )GetWindowLongPtr( hwnd, GWLP_USERDATA ); - switch ( message ) - { - + switch ( message ) { case WM_INITDIALOG: - csw = ( CSWindow* )lparam; - SetWindowLongPtr( hwnd, GWLP_USERDATA, lparam ); + TranslateDialogDefault(hwnd); + + csw = (CSWindow*)lparam; + arWindows.insert(csw); + SetWindowLongPtr(hwnd, GWLP_USERDATA, lparam); + csw->m_handle = hwnd; csw->initIcons(); csw->initButtons(); - csw->m_listview = new CSListView( GetDlgItem( hwnd, IDC_CSLIST ), csw ); + csw->m_listview = new CSListView( GetDlgItem( hwnd, IDC_CSLIST ), csw); csw->m_listview->initItems(csw->m_itemslist->m_list->getListHead()); csw->toggleButtons(); csw->toggleEmptyListMessage(); csw->loadWindowPosition(); SetWindowText(hwnd, TranslateT(MODULENAME)); - TranslateDialogDefault(hwnd); return TRUE; case WM_COMMAND: - switch ( LOWORD( wparam )) - { + switch ( LOWORD( wparam )) { case IDC_MODIFY: case IDC_ADD: csw->m_addModifyDlg = new CSAMWindow( LOWORD( wparam ), csw ); csw->m_addModifyDlg->exec(); - if ( csw->m_addModifyDlg->m_bChanged ) - { + if ( csw->m_addModifyDlg->m_bChanged ) { if ( LOWORD( wparam ) == IDC_MODIFY ) csw->m_itemslist->m_list->remove( csw->m_listview->getPositionInList()); @@ -893,6 +898,7 @@ INT_PTR CALLBACK CSWindowProc( HWND hwnd, UINT message, WPARAM wparam, LPARAM lp if ( getByte( "ConfirmDeletion", DEFAULT_PLUGIN_CONFIRM_ITEMS_DELETION )) if ( MessageBox( hwnd, TranslateT("Do you really want to delete selected item?"), TranslateT(MODULENAME), MB_YESNO | MB_DEFBUTTON2 | MB_ICONQUESTION ) == IDNO ) break; + csw->m_itemslist->m_list->remove( csw->m_listview->getPositionInList()); csw->m_bSomethingChanged = TRUE; csw->m_listview->reinitItems( csw->m_itemslist->m_list->getListHead()); @@ -915,7 +921,6 @@ INT_PTR CALLBACK CSWindowProc( HWND hwnd, UINT message, WPARAM wparam, LPARAM lp break; case IDC_UNDO: - { csw->m_itemslist->m_list->destroy(); csw->m_itemslist->loadItems(csw->m_protoName); csw->m_bSomethingChanged = FALSE; @@ -923,21 +928,22 @@ INT_PTR CALLBACK CSWindowProc( HWND hwnd, UINT message, WPARAM wparam, LPARAM lp csw->toggleButtons(); csw->toggleEmptyListMessage(); break; - } case IDC_IMPORT: { int result = getByte( "DeleteAfterImport", DEFAULT_PLUGIN_DELETE_AFTER_IMPORT ); - if ( result == TRUE ) + if (result == TRUE) result = IDYES; else { - result = MessageBox( hwnd, TranslateT("Do you want old database entries to be deleted after Import?"), - TranslateT(MODULENAME), MB_YESNOCANCEL | MB_DEFBUTTON2 | MB_ICONQUESTION ); + result = MessageBox( hwnd, + TranslateT("Do you want old database entries to be deleted after Import?"), + TranslateT(MODULENAME), MB_YESNOCANCEL | MB_DEFBUTTON2 | MB_ICONQUESTION ); if ( result == IDCANCEL ) break; } - forAllProtocols( importCustomStatusUIStatusesFromAllProtos, ( void *)&result ); + importParams params = { csw, &result }; + forAllProtocols(importCustomStatusUIStatusesFromAllProtos, ¶ms); csw->m_bSomethingChanged = TRUE; csw->toggleButtons(); csw->toggleEmptyListMessage(); @@ -955,9 +961,9 @@ INT_PTR CALLBACK CSWindowProc( HWND hwnd, UINT message, WPARAM wparam, LPARAM lp break; case IDCLOSE: // close and save, no custom status - case IDCANCEL: // close and save, no custom status - case IDC_CANCEL: // close and save, cancel custom status - case IDOK: // close and save, set selected custom status + case IDCANCEL: // close and save, no custom status + case IDC_CANCEL: // close and save, cancel custom status + case IDOK: // close and save, set selected custom status if ( LOWORD( wparam ) == IDOK && csw->toggleButtons()) SetStatus(IDOK, csw->m_itemslist->m_list->get(csw->m_listview->getPositionInList()), csw->m_protoName); if ( LOWORD( wparam ) == IDC_CANCEL ) @@ -990,33 +996,35 @@ INT_PTR CALLBACK CSWindowProc( HWND hwnd, UINT message, WPARAM wparam, LPARAM lp return FALSE; case WM_CTLCOLORSTATIC: - SetTextColor( ( HDC )wparam, RGB( 174, 174, 174 )); - if ( ( ( HWND )lparam == GetDlgItem( hwnd, IDC_NO_ITEMS )) || - ( ( HWND )lparam == GetDlgItem( hwnd, IDC_ADD_SAMPLE )) ) + SetTextColor(( HDC )wparam, RGB( 174, 174, 174 )); + if (((HWND)lparam == GetDlgItem(hwnd, IDC_NO_ITEMS)) || ((HWND)lparam == GetDlgItem(hwnd, IDC_ADD_SAMPLE))) return ( BOOL )GetStockObject( WHITE_BRUSH ); return FALSE; + + case WM_DESTROY: + SetWindowLongPtr(hwnd, GWLP_USERDATA, 0); + arWindows.remove(csw); + delete csw; + break; } return FALSE; } - INT_PTR CALLBACK CSAMWindowProc( HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam ) { CSAMWindow* csamw = ( CSAMWindow* )GetWindowLongPtr( hwnd, GWLP_USERDATA ); switch ( message ) { case WM_INITDIALOG: - { - csamw = ( CSAMWindow* )lparam; - SetWindowLongPtr( hwnd, GWLP_USERDATA, lparam ); - csamw->m_handle = hwnd; - EnableWindow( csamw->m_parent->m_handle, FALSE ); - csamw->m_hCombo = GetDlgItem( hwnd, IDC_COMBO ); - csamw->m_hMessage = GetDlgItem( hwnd, IDC_MESSAGE ); - csamw->setCombo(); - csamw->fillDialog(); - TranslateDialogDefault(hwnd); - } + csamw = ( CSAMWindow* )lparam; + SetWindowLongPtr( hwnd, GWLP_USERDATA, lparam ); + csamw->m_handle = hwnd; + EnableWindow( csamw->m_parent->m_handle, FALSE ); + csamw->m_hCombo = GetDlgItem( hwnd, IDC_COMBO ); + csamw->m_hMessage = GetDlgItem( hwnd, IDC_MESSAGE ); + csamw->setCombo(); + csamw->fillDialog(); + TranslateDialogDefault(hwnd); break; case WM_COMMAND: @@ -1024,8 +1032,10 @@ INT_PTR CALLBACK CSAMWindowProc( HWND hwnd, UINT message, WPARAM wparam, LPARAM case IDC_MESSAGE: csamw->checkFieldLimit( HIWORD( wparam ), LOWORD( wparam )); break; + case IDOK: csamw->checkItemValidity(); + case IDCANCEL: EnableWindow(csamw->m_parent->m_handle, TRUE); EndDialog(hwnd, LOWORD(wparam)); @@ -1041,6 +1051,7 @@ INT_PTR CALLBACK CSOptionsProc( HWND hwnd, UINT message, WPARAM wparam, LPARAM l { switch ( message ) { case WM_INITDIALOG: + TranslateDialogDefault(hwnd); CheckDlgButton( hwnd, IDC_CONFIRM_DELETION, getByte( "ConfirmDeletion", DEFAULT_PLUGIN_CONFIRM_ITEMS_DELETION ) ? BST_CHECKED : BST_UNCHECKED ); @@ -1055,8 +1066,6 @@ INT_PTR CALLBACK CSOptionsProc( HWND hwnd, UINT message, WPARAM wparam, LPARAM l EnableWindow(GetDlgItem( hwnd, IDC_ALLOW_EXTRA_ICONS ), TRUE); CheckDlgButton(hwnd, IDC_ALLOW_EXTRA_ICONS, getByte( "AllowExtraIcons", DEFAULT_ALLOW_EXTRA_ICONS)); - - TranslateDialogDefault(hwnd); return TRUE; case WM_NOTIFY: @@ -1067,7 +1076,7 @@ INT_PTR CALLBACK CSOptionsProc( HWND hwnd, UINT message, WPARAM wparam, LPARAM l setByte( "AllowExtraIcons", IsDlgButtonChecked( hwnd, IDC_ALLOW_EXTRA_ICONS ) ? 1 : 0 ); setByte( "RememberWindowPosition", IsDlgButtonChecked( hwnd, IDC_REMEMBER_POSITION ) ? 1 : 0 ); - RebuildMenuItems(); + pcli->pfnReloadProtoMenus(); break; } return TRUE; diff --git a/plugins/CSList/src/cslist.h b/plugins/CSList/src/cslist.h index d6b83b30f4..c593f541bc 100644 --- a/plugins/CSList/src/cslist.h +++ b/plugins/CSList/src/cslist.h @@ -51,7 +51,7 @@ #define MIRANDA_VER 0x0A00 #pragma warning( disable: 4996 ) -#pragma comment( lib, "comctl32.lib" ) +#pragma comment( lib, "comctl32.lib") #include #include @@ -61,6 +61,7 @@ #include #include #include +#include #include #include #include @@ -81,9 +82,6 @@ #define MODULENAME "Custom Status List" -// {C8CC7414-6507-4AF6-925A-83C1D2F7BE8C} -#define PLUGIN_GUUID { 0xc8cc7414, 0x6507, 0x4af6, { 0x92, 0x5a, 0x83, 0xc1, 0xd2, 0xf7, 0xbe, 0x8c } } - // ====[ LIMITS ]============================================================= #define EXTRASTATUS_TITLE_LIMIT 64 // limit of chars for extra status title @@ -165,17 +163,17 @@ static struct CSForm { // icons + buttons } forms[] = { - { -1, LPGENT( "Main Menu" ), LPGENT( "Main Icon" ), "icon", IDI_CSLIST, NULL }, - { IDC_ADD, LPGENT( "Add new item" ), LPGENT( "Add" ), "add", IDI_ADD, NULL }, - { IDC_MODIFY, LPGENT( "Modify selected item" ), LPGENT( "Modify" ), "modify", IDI_MODIFY, NULL }, - { IDC_REMOVE, LPGENT( "Delete selected item" ), LPGENT( "Remove" ), "remove", IDI_REMOVE, NULL }, - { IDC_FAVOURITE, LPGENT( "Set/unset current item as favorite" ), LPGENT( "Favourite" ), "favourite", IDI_FAVOURITE, NULL }, - { IDC_UNDO, LPGENT( "Undo changes" ), LPGENT( "Undo changes" ), "undo", IDI_UNDO, NULL }, - { IDC_IMPORT, LPGENT( "Import statuses from database" ), LPGENT( "Import" ), "import", IDI_IMPORT, NULL }, - { IDC_FILTER, LPGENT( "Filter list" ), LPGENT( "Filter" ), "filter", IDI_FILTER, NULL }, - { IDCLOSE, LPGENT( "Close without changing custom status" ), LPGENT( "No change" ), "nochng", IDI_CLOSE, NULL }, - { IDC_CANCEL, LPGENT( "Clear custom status (reset to None) and close" ), LPGENT( "Clear" ), "clear", IDI_UNSET, NULL }, - { IDOK, LPGENT( "Set custom status to selected one and close" ), LPGENT( "Set" ), "apply", IDI_APPLY, NULL }, + { -1, LPGENT("Main Menu"), LPGENT("Main Icon"), "icon", IDI_CSLIST }, + { IDC_ADD, LPGENT("Add new item"), LPGENT("Add"), "add", IDI_ADD }, + { IDC_MODIFY, LPGENT("Modify selected item"), LPGENT("Modify"), "modify", IDI_MODIFY }, + { IDC_REMOVE, LPGENT("Delete selected item"), LPGENT("Remove"), "remove", IDI_REMOVE }, + { IDC_FAVOURITE, LPGENT("Set/unset current item as favorite"), LPGENT("Favourite"), "favourite", IDI_FAVOURITE }, + { IDC_UNDO, LPGENT("Undo changes"), LPGENT("Undo changes"), "undo", IDI_UNDO }, + { IDC_IMPORT, LPGENT("Import statuses from database"), LPGENT("Import"), "import", IDI_IMPORT }, + { IDC_FILTER, LPGENT("Filter list"), LPGENT("Filter"), "filter", IDI_FILTER }, + { IDCLOSE, LPGENT("Close without changing custom status"), LPGENT("No change"), "nochng", IDI_CLOSE }, + { IDC_CANCEL, LPGENT("Clear custom status (reset to None) and close"), LPGENT("Clear"), "clear", IDI_UNSET }, + { IDOK, LPGENT("Set custom status to selected one and close"), LPGENT("Set"), "apply", IDI_APPLY } }; // ====[ MY BITCHY LIST IMPLEMENTATION x)) ]================================== @@ -426,12 +424,10 @@ void closeList( HWND ); void forAllProtocols(pForAllProtosFunc pFunc, void *arg); void addProtoStatusMenuItem( char *protoName, void *arg); void countProtos( char *protoName, void *arg); -void importCustomStatusUIStatusesFromAllProtos( char *protoName, void *arg ); // other functions void IitIcoLib(); void RegisterHotkeys(char buf[200], TCHAR* accName, int Number); -void RebuildMenuItems(); void SetStatus(WORD code, StatusItem* item, char *protoName); // ====[ INIT STUFF ]========================================================= diff --git a/plugins/CSList/src/legacy.h b/plugins/CSList/src/legacy.h deleted file mode 100644 index 949f4bd588..0000000000 --- a/plugins/CSList/src/legacy.h +++ /dev/null @@ -1,87 +0,0 @@ -/* - - FILE INFO: Legacy functions of older Custom Status List versions - -*/ - -int cslist_import_v2_status_items(); -int cslist_parse_row( TCHAR *row, int ord ); - -int cslist_import_v2_status_items() -{ - // get DB string, parse to statuses, add by helpItem - DBVARIANT dbv = { DBVT_TCHAR }; - int parseResult; - int dbLoadResult; - const TCHAR* rowDelim = _T( "" ); // new line - TCHAR *row = NULL; - - dbLoadResult = getTString( "listhistory", &dbv ); - if ( dbv.ptszVal ) - { - int i = getByte( "ItemsCount", DEFAULT_ITEMS_COUNT ); - row = _tcstok( dbv.ptszVal, rowDelim ); - while( row != NULL ) { - i++; - // process current row.. - parseResult = cslist_parse_row( row, i ); - // ..and go to the other, while some remains - row = _tcstok( NULL, rowDelim ); - } - setByte( "ItemsCount", i ); - } - //free( rowDelim ); - //free( row ); - return 0; -} - -int cslist_parse_row( TCHAR *row, int ord ) // parse + helpItem -{ - int pIconInt; - TCHAR pIcon[4], pTitle[EXTRASTATUS_TITLE_LIMIT+2], pMsg[EXTRASTATUS_MESSAGE_LIMIT+2], pFav[4]; - TCHAR scanfFormat[64]; - - lstrcpy( pTitle, _T( "" )); - lstrcpy( pMsg, _T( "" )); - - // database row format: "%2[^]%64[^]%2048[^]%2[^]" - - mir_sntprintf( - scanfFormat, - sizeof( scanfFormat ), - _T( "%%%d[^]%%%d[^]%%%d[^]%%%d[^]" ), // %% makes %, %d makes number :) - 2, - EXTRASTATUS_TITLE_LIMIT, - EXTRASTATUS_MESSAGE_LIMIT, - 2 - ); - - _tcscanf( row, scanfFormat, pIcon, pTitle, pMsg, pFav ); - - if ( lstrlen( pTitle ) + lstrlen( pMsg ) > 0 ) - { - char dbSetting[32]; - pIconInt = _ttoi( pIcon ); - mir_snprintf( dbSetting, sizeof( dbSetting ), "Item%dIcon", ord ); - setByte( dbSetting, pIconInt ); - mir_snprintf( dbSetting, sizeof( dbSetting ), "Item%dTitle", ord ); - setTString( dbSetting, pTitle ); - mir_snprintf( dbSetting, sizeof( dbSetting ), "Item%dMessage", ord ); - setTString( dbSetting, pMsg ); - mir_snprintf( dbSetting, sizeof( dbSetting ), "Item%dFavourite", ord ); - setByte( dbSetting, 0 ); - } - else { - return FALSE; - } - return TRUE; -} - - -void MessageBoxInt( int value1, int value2 ) -{ - TCHAR buf1[64], buf2[64]; - mir_sntprintf( buf1, SIZEOF( buf1 ), TEXT( "%d" ), value1 ); - mir_sntprintf( buf2, SIZEOF( buf2 ), TEXT( "%d" ), value2 ); - MessageBox( NULL, buf2, buf1, MB_OK ); -} -- cgit v1.2.3