From e13abbf0f5a4bcef939e4e32e06a7e8e74e72465 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 23 Apr 2013 08:32:10 +0000 Subject: - clist_modern switched to the core wildcmp[i] functions - fixed chinese in skin options git-svn-id: http://svn.miranda-ng.org/main/trunk@4512 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- .../Clist_modern/src/hdr/modern_commonprototypes.h | 4 +- plugins/Clist_modern/src/hdr/modern_skinselector.h | 1 - plugins/Clist_modern/src/modern_cachefuncs.cpp | 2 +- plugins/Clist_modern/src/modern_clcitems.cpp | 3 +- plugins/Clist_modern/src/modern_clistmod.cpp | 13 +-- plugins/Clist_modern/src/modern_clistsettings.cpp | 2 +- plugins/Clist_modern/src/modern_skineditor.cpp | 129 ++++++++++----------- plugins/Clist_modern/src/modern_skinengine.cpp | 8 +- plugins/Clist_modern/src/modern_skinselector.cpp | 101 ++++++---------- 9 files changed, 110 insertions(+), 153 deletions(-) (limited to 'plugins/Clist_modern/src') diff --git a/plugins/Clist_modern/src/hdr/modern_commonprototypes.h b/plugins/Clist_modern/src/hdr/modern_commonprototypes.h index 3fe99a1f86..9b2970ec06 100644 --- a/plugins/Clist_modern/src/hdr/modern_commonprototypes.h +++ b/plugins/Clist_modern/src/hdr/modern_commonprototypes.h @@ -203,15 +203,13 @@ int Docking_ProcessWindowMessage(WPARAM wParam,LPARAM lParam); void DrawBackGround(HWND hwnd,HDC mhdc, HBITMAP hBmpBackground, COLORREF bkColour, DWORD backgroundBmpUse ); HRESULT BackgroundsLoadModule(); int BackgroundsUnloadModule(); -BOOL wildcmp(const char *name, const char *mask, BYTE option); //mod_skin_selector.c -BOOL wildcmpi(const char *name, const char *mask); //mod_skin_selector.c -BOOL wildcmpi(const WCHAR *name, const WCHAR *mask); //mod_skin_selector.c INT_PTR CALLBACK DlgSkinEditorOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); //SkinEditor.c INT_PTR CALLBACK DlgTmplEditorOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); //RowTemplate.c BOOL FindMenuHanleByGlobalID(HMENU hMenu, int globalID, struct _MenuItemHandles * dat); //GenMenu.c BOOL MatchMask(char *name, char *mask); //mod_skin_selector.c char* GetContactCachedProtocol(HANDLE hContact); //clistsettings.c char* GetParamN(char *string, char *buf, int buflen, BYTE paramN, char Delim, BOOL SkipSpaces); //mod_skin_selector.c +WCHAR* GetParamN(WCHAR *string, WCHAR *buf, int buflen, BYTE paramN, WCHAR Delim, BOOL SkipSpaces); DWORD CompareContacts2_getLMTime(HANDLE u); //contact.c DWORD mod_CalcHash(const char * a); //mod_skin_selector.c HICON cliGetIconFromStatusMode(HANDLE hContact, const char *szProto,int status); //clistmod.c diff --git a/plugins/Clist_modern/src/hdr/modern_skinselector.h b/plugins/Clist_modern/src/hdr/modern_skinselector.h index 4e75fdecc5..7c6226c5e5 100644 --- a/plugins/Clist_modern/src/hdr/modern_skinselector.h +++ b/plugins/Clist_modern/src/hdr/modern_skinselector.h @@ -78,7 +78,6 @@ BOOL CompareStrWithModernMask(char * szValue,MODERNMASK *mmTemplate); MODERNMASK * FindMaskByStr(char * szValue,LISTMODERNMASK * mmTemplateList); DWORD mod_CalcHash(const char * a); char * ModernMaskToString(MODERNMASK *mm, char * buf, UINT bufsize); -BOOL __inline wildcmp(const char * name, const char * mask, BYTE option); int RegisterObjectByParce(char * ObjectName, char * Params); SKINOBJECTDESCRIPTOR * skin_FindObjectByRequest(char * szValue,LISTMODERNMASK * mmTemplateList); SKINOBJECTDESCRIPTOR * skin_FindObjectByMask (MODERNMASK *mm,LISTMODERNMASK * mmTemplateList); diff --git a/plugins/Clist_modern/src/modern_cachefuncs.cpp b/plugins/Clist_modern/src/modern_cachefuncs.cpp index 14c460ed7a..adbbc114c5 100644 --- a/plugins/Clist_modern/src/modern_cachefuncs.cpp +++ b/plugins/Clist_modern/src/modern_cachefuncs.cpp @@ -754,7 +754,7 @@ void Cache_ProceedAvatarInList(ClcData *dat, ClcContact *contact) else height_clip = width_clip * ace->bmHeight / ace->bmWidth; - if (wildcmpi(contact->avatar_data->szFilename,_T("*.gif"))) { + if (wildcmpit(contact->avatar_data->szFilename,_T("*.gif"))) { if (old_pos == AVATAR_POS_ANIMATED) AniAva_RemoveAvatar(contact->hContact); diff --git a/plugins/Clist_modern/src/modern_clcitems.cpp b/plugins/Clist_modern/src/modern_clcitems.cpp index 3aa6b7e313..68e8724401 100644 --- a/plugins/Clist_modern/src/modern_clcitems.cpp +++ b/plugins/Clist_modern/src/modern_clcitems.cpp @@ -235,7 +235,7 @@ void * AddTempGroup(HWND hwnd,ClcData *dat,const TCHAR *szName,DWORD flags,int g TCHAR * szGroupName; DWORD groupFlags; - if ( wildcmp( _T2A(szName), "-@-HIDDEN-GROUP-@-",0)) + if ( wildcmp( _T2A(szName), "-@-HIDDEN-GROUP-@-")) return NULL; for (i = 1;;i++) { @@ -339,7 +339,6 @@ int RestoreSelection( ClcData *dat, HANDLE hSelected ) void cliRebuildEntireList(HWND hwnd,ClcData *dat) { DWORD style = GetWindowLongPtr(hwnd,GWL_STYLE); - HANDLE hContact; ClcContact *cont; ClcGroup *group; static int rebuildCounter = 0; diff --git a/plugins/Clist_modern/src/modern_clistmod.cpp b/plugins/Clist_modern/src/modern_clistmod.cpp index fdc095d935..52989a59bc 100644 --- a/plugins/Clist_modern/src/modern_clistmod.cpp +++ b/plugins/Clist_modern/src/modern_clistmod.cpp @@ -36,11 +36,6 @@ pfnMyGetMonitorInfo MyGetMonitorInfo = NULL; int OnLoadLangpack(WPARAM, LPARAM); -static HANDLE hookSystemShutdown_CListMod = NULL; -HANDLE hookOptInitialise_CList = NULL, - hookOptInitialise_Skin = NULL, - hookContactAdded_CListSettings = NULL; - int CListMod_HideWindow(HWND hwndContactList, int mode); void GroupMenus_Init(void); @@ -227,15 +222,15 @@ INT_PTR SvcApplySkin(WPARAM wParam, LPARAM lParam); HRESULT CluiLoadModule() { InitDisplayNameCache(); - hookSystemShutdown_CListMod = HookEvent(ME_SYSTEM_SHUTDOWN,CListMod_ContactListShutdownProc); - hookOptInitialise_CList = HookEvent(ME_OPT_INITIALISE,CListOptInit); - hookOptInitialise_Skin = HookEvent(ME_OPT_INITIALISE,SkinOptInit); + HookEvent(ME_SYSTEM_SHUTDOWN,CListMod_ContactListShutdownProc); + HookEvent(ME_OPT_INITIALISE,CListOptInit); + HookEvent(ME_OPT_INITIALISE,SkinOptInit); CreateServiceFunction("ModernSkinSel/Active", SvcActiveSkin); CreateServiceFunction("ModernSkinSel/Preview", SvcPreviewSkin); CreateServiceFunction("ModernSkinSel/Apply", SvcApplySkin); - hookContactAdded_CListSettings = HookEvent(ME_DB_CONTACT_ADDED,ContactAdded); + HookEvent(ME_DB_CONTACT_ADDED,ContactAdded); CreateServiceFunction(MS_CLIST_TRAYICONPROCESSMESSAGE,cli_TrayIconProcessMessage); CreateServiceFunction(MS_CLIST_PAUSEAUTOHIDE,TrayIconPauseAutoHide); CreateServiceFunction(MS_CLIST_CONTACTCHANGEGROUP,ContactChangeGroup); diff --git a/plugins/Clist_modern/src/modern_clistsettings.cpp b/plugins/Clist_modern/src/modern_clistsettings.cpp index 7d2c965705..b47ca00245 100644 --- a/plugins/Clist_modern/src/modern_clistsettings.cpp +++ b/plugins/Clist_modern/src/modern_clistsettings.cpp @@ -448,7 +448,7 @@ int ContactSettingChanged(WPARAM wParam,LPARAM lParam) if ( !strcmp(cws->szSetting,"IsSubcontact")) PostMessage(pcli->hwndContactTree,CLM_AUTOREBUILD, 0, 0); - if ( !mir_strcmp(cws->szSetting, "Status") || wildcmp((char*)cws->szSetting, (char*) "Status?",2)) { + if ( !mir_strcmp(cws->szSetting, "Status") || wildcmp(cws->szSetting, "Status?")) { if (g_szMetaModuleName && !mir_strcmp(cws->szModule,g_szMetaModuleName) && mir_strcmp(cws->szSetting, "Status")) { int res = 0; if (pcli->hwndContactTree && g_flag_bOnModulesLoadedCalled) diff --git a/plugins/Clist_modern/src/modern_skineditor.cpp b/plugins/Clist_modern/src/modern_skineditor.cpp index 02652af515..81cb437111 100644 --- a/plugins/Clist_modern/src/modern_skineditor.cpp +++ b/plugins/Clist_modern/src/modern_skineditor.cpp @@ -30,10 +30,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. typedef struct _OPT_OBJECT_DATA { - char * szName; - char * szPath; - char * szValue; - char * szTempValue; + char *szName; + TCHAR *szPath; + TCHAR *szValue; + TCHAR *szTempValue; } OPT_OBJECT_DATA; static char *gl_Mask = NULL; @@ -43,7 +43,8 @@ int EnableGroup(HWND hwndDlg, HWND first, BOOL bEnable); int ShowGroup(HWND hwndDlg, HWND first, BOOL bEnable); BOOL glOtherSkinWasLoaded = FALSE; BYTE glSkinWasModified = 0; //1- but not applied, 2-stored to DB -HTREEITEM FindChild(HWND hTree, HTREEITEM Parent, char * Caption) + +HTREEITEM FindChild(HWND hTree, HTREEITEM Parent, TCHAR *Caption) { HTREEITEM res = NULL, tmp = NULL; if (Parent) @@ -52,14 +53,14 @@ HTREEITEM FindChild(HWND hTree, HTREEITEM Parent, char * Caption) tmp = TreeView_GetRoot(hTree); while (tmp) { - TVITEMA tvi; - char buf[255]; + TVITEM tvi; + TCHAR buf[255]; tvi.hItem = tmp; tvi.mask = TVIF_TEXT|TVIF_HANDLE; - tvi.pszText = (LPSTR)&buf; + tvi.pszText = (LPTSTR)&buf; tvi.cchTextMax = 254; TreeView_GetItem(hTree,&tvi); - if (mir_bool_strcmpi(Caption,tvi.pszText)) + if (lstrcmpi(Caption,tvi.pszText)) return tmp; tmp = TreeView_GetNextSibling(hTree,tmp); } @@ -70,15 +71,13 @@ int TreeAddObject(HWND hwndDlg, int ID, OPT_OBJECT_DATA * data) { HTREEITEM rootItem = NULL; HTREEITEM cItem = NULL; - char * path; - char * ptr; - char * ptrE; - char buf[255]; + TCHAR *ptr, *ptrE; BOOL ext = FALSE; - path = data->szPath?mir_strdup(data->szPath):(data->szName[1] == '$')?mir_strdup((data->szName)+2):NULL; + TCHAR *path = data->szPath ? mir_tstrdup(data->szPath):(data->szName[1] == '$') ? mir_a2t(data->szName+2):NULL; if ( !path) { - mir_snprintf(buf,SIZEOF(buf),"$(other)/%s",(data->szName)+1); - path = mir_strdup(buf); + TCHAR buf[255]; + mir_sntprintf(buf, SIZEOF(buf), _T("$(other)/%S"), data->szName+1); + path = mir_tstrdup(buf); } ptr = path; @@ -92,10 +91,10 @@ int TreeAddObject(HWND hwndDlg, int ID, OPT_OBJECT_DATA * data) ptrE++; // find item if not - create; { - cItem = FindChild(GetDlgItem(hwndDlg,ID),rootItem,ptr); + cItem = FindChild(GetDlgItem(hwndDlg,ID), rootItem, ptr); if ( !cItem) // not found - create node { - TVINSERTSTRUCTA tvis; + TVINSERTSTRUCT tvis; tvis.hParent = rootItem; tvis.hInsertAfter = TVI_SORT; tvis.item.mask = TVIF_PARAM|TVIF_TEXT|TVIF_PARAM; @@ -113,7 +112,7 @@ int TreeAddObject(HWND hwndDlg, int ID, OPT_OBJECT_DATA * data) //Insert item node { - TVINSERTSTRUCTA tvis; + TVINSERTSTRUCT tvis; tvis.hParent = rootItem; tvis.hInsertAfter = TVI_SORT; tvis.item.mask = TVIF_PARAM|TVIF_TEXT|TVIF_PARAM; @@ -127,16 +126,13 @@ int TreeAddObject(HWND hwndDlg, int ID, OPT_OBJECT_DATA * data) int enumDB_SkinObjectsForEditorProc(const char *szSetting,LPARAM lParam) { - if (wildcmp((char *)szSetting,gl_Mask,0) || wildcmp((char *)szSetting,"$*",0)) + if (wildcmp(szSetting,gl_Mask) || wildcmp(szSetting,"$*")) { - char * value; - char *desc; - char *descKey; - descKey = mir_strdup(szSetting); + char *descKey = mir_strdup(szSetting); descKey[0] = '%'; - value = db_get_sa(NULL,SKIN,szSetting); - desc = db_get_sa(NULL,SKIN,descKey); - if (wildcmp(value,"?lyph*",0)) + TCHAR *value = db_get_tsa(NULL,SKIN,szSetting); + TCHAR *desc = db_get_tsa(NULL,SKIN,descKey); + if ( wildcmpt(value, _T("?lyph*"))) { OPT_OBJECT_DATA * a = (OPT_OBJECT_DATA*)mir_alloc(sizeof(OPT_OBJECT_DATA)); a->szPath = desc; @@ -230,9 +226,9 @@ void SetAppropriateGroups(HWND hwndDlg, int Type) } } -void SetControls(HWND hwndDlg, char * str) +void SetControls(HWND hwndDlg, TCHAR *str) { - char buf[250]; + TCHAR buf[250]; int Type=0; if ( !str) { @@ -240,9 +236,9 @@ void SetControls(HWND hwndDlg, char * str) return; } GetParamN(str,buf,SIZEOF(buf),1,',',TRUE); - if (mir_bool_strcmpi(buf,"Solid")) Type=1; - else if (mir_bool_strcmpi(buf,"Image")) Type=2; - else if (mir_bool_strcmpi(buf,"Fragment")) Type=3; + if (!lstrcmpi(buf,_T("Solid"))) Type=1; + else if (!lstrcmpi(buf, _T("Image"))) Type=2; + else if (!lstrcmpi(buf, _T("Fragment"))) Type=3; SendDlgItemMessage(hwndDlg,IDC_TYPE,CB_SETCURSEL,(WPARAM)Type,0); SetAppropriateGroups(hwndDlg,Type); switch (Type) @@ -252,10 +248,10 @@ void SetControls(HWND hwndDlg, char * str) int r,g,b,a; r = g = b = 200; a = 255; - r = atoi(GetParamN(str,buf,SIZEOF(buf),2,',',TRUE)); - g = atoi(GetParamN(str,buf,SIZEOF(buf),3,',',TRUE)); - b = atoi(GetParamN(str,buf,SIZEOF(buf),4,',',TRUE)); - a = atoi(GetParamN(str,buf,SIZEOF(buf),5,',',TRUE)); + r = _ttoi(GetParamN(str,buf,SIZEOF(buf),2,',',TRUE)); + g = _ttoi(GetParamN(str,buf,SIZEOF(buf),3,',',TRUE)); + b = _ttoi(GetParamN(str,buf,SIZEOF(buf),4,',',TRUE)); + a = _ttoi(GetParamN(str,buf,SIZEOF(buf),5,',',TRUE)); SendDlgItemMessage(hwndDlg,IDC_COLOR,CPM_SETCOLOUR, 0, (LPARAM)RGB(r,g,b)); SendDlgItemMessage(hwndDlg,IDC_COLOR,CPM_SETDEFAULTCOLOUR, 0, (LPARAM)RGB(r,g,b)); SendDlgItemMessage(hwndDlg,IDC_SPIN_ALPHA,UDM_SETPOS, 0, MAKELONG(a,0)); @@ -269,11 +265,11 @@ void SetControls(HWND hwndDlg, char * str) l = t = r = b = 0; a = 255; - l = atoi(GetParamN(str,buf,SIZEOF(buf),4,',',TRUE)); - t = atoi(GetParamN(str,buf,SIZEOF(buf),5,',',TRUE)); - r = atoi(GetParamN(str,buf,SIZEOF(buf),6,',',TRUE)); - b = atoi(GetParamN(str,buf,SIZEOF(buf),7,',',TRUE)); - a = atoi(GetParamN(str,buf,SIZEOF(buf),8,',',TRUE)); + l = _ttoi(GetParamN(str,buf,SIZEOF(buf),4,',',TRUE)); + t = _ttoi(GetParamN(str,buf,SIZEOF(buf),5,',',TRUE)); + r = _ttoi(GetParamN(str,buf,SIZEOF(buf),6,',',TRUE)); + b = _ttoi(GetParamN(str,buf,SIZEOF(buf),7,',',TRUE)); + a = _ttoi(GetParamN(str,buf,SIZEOF(buf),8,',',TRUE)); SendDlgItemMessage(hwndDlg,IDC_SPIN_ALPHA,UDM_SETPOS, 0, MAKELONG(a,0)); SendDlgItemMessage(hwndDlg,IDC_SPIN_LEFT,UDM_SETPOS, 0, MAKELONG(l,0)); @@ -285,9 +281,9 @@ void SetControls(HWND hwndDlg, char * str) SendDlgItemMessageA(hwndDlg,IDC_FILE,WM_SETTEXT, 0, (LPARAM)buf); GetParamN(str,buf,SIZEOF(buf),3,',',TRUE); - if (mir_bool_strcmpi(buf,"TileBoth")) fitmode = FM_TILE_BOTH; - else if (mir_bool_strcmpi(buf,"TileVert")) fitmode = FM_TILE_VERT; - else if (mir_bool_strcmpi(buf,"TileHorz")) fitmode = FM_TILE_HORZ; + if (!lstrcmpi(buf,_T("TileBoth"))) fitmode = FM_TILE_BOTH; + else if (!lstrcmpi(buf,_T("TileVert"))) fitmode = FM_TILE_VERT; + else if (!lstrcmpi(buf,_T("TileHorz"))) fitmode = FM_TILE_HORZ; else fitmode = 0; SendDlgItemMessage(hwndDlg,IDC_FIT,CB_SETCURSEL,(WPARAM)fitmode,0); } @@ -303,16 +299,16 @@ void SetControls(HWND hwndDlg, char * str) x = y = w = h = 0; a = 255; - x = atoi(GetParamN(str,buf,SIZEOF(buf),3,',',TRUE)); - y = atoi(GetParamN(str,buf,SIZEOF(buf),4,',',TRUE)); - w = atoi(GetParamN(str,buf,SIZEOF(buf),5,',',TRUE)); - h = atoi(GetParamN(str,buf,SIZEOF(buf),6,',',TRUE)); - - l = atoi(GetParamN(str,buf,SIZEOF(buf),8,',',TRUE)); - t = atoi(GetParamN(str,buf,SIZEOF(buf),9,',',TRUE)); - r = atoi(GetParamN(str,buf,SIZEOF(buf),10, ',',TRUE)); - b = atoi(GetParamN(str,buf,SIZEOF(buf),11,',',TRUE)); - a = atoi(GetParamN(str,buf,SIZEOF(buf),12,',',TRUE)); + x = _ttoi(GetParamN(str,buf,SIZEOF(buf),3,',',TRUE)); + y = _ttoi(GetParamN(str,buf,SIZEOF(buf),4,',',TRUE)); + w = _ttoi(GetParamN(str,buf,SIZEOF(buf),5,',',TRUE)); + h = _ttoi(GetParamN(str,buf,SIZEOF(buf),6,',',TRUE)); + + l = _ttoi(GetParamN(str,buf,SIZEOF(buf),8,',',TRUE)); + t = _ttoi(GetParamN(str,buf,SIZEOF(buf),9,',',TRUE)); + r = _ttoi(GetParamN(str,buf,SIZEOF(buf),10, ',',TRUE)); + b = _ttoi(GetParamN(str,buf,SIZEOF(buf),11,',',TRUE)); + a = _ttoi(GetParamN(str,buf,SIZEOF(buf),12,',',TRUE)); SendDlgItemMessage(hwndDlg,IDC_SPIN_ALPHA,UDM_SETPOS, 0, MAKELONG(a,0)); SendDlgItemMessage(hwndDlg,IDC_SPIN_LEFT,UDM_SETPOS, 0, MAKELONG(l,0)); @@ -329,9 +325,9 @@ void SetControls(HWND hwndDlg, char * str) SendDlgItemMessageA(hwndDlg,IDC_FILE,WM_SETTEXT, 0, (LPARAM)buf); GetParamN(str,buf,SIZEOF(buf),7,',',TRUE); - if (mir_bool_strcmpi(buf,"TileBoth")) fitmode = FM_TILE_BOTH; - else if (mir_bool_strcmpi(buf,"TileVert")) fitmode = FM_TILE_VERT; - else if (mir_bool_strcmpi(buf,"TileHorz")) fitmode = FM_TILE_HORZ; + if (!lstrcmpi(buf,_T("TileBoth"))) fitmode = FM_TILE_BOTH; + else if (!lstrcmpi(buf,_T("TileVert"))) fitmode = FM_TILE_VERT; + else if (!lstrcmpi(buf,_T("TileHorz"))) fitmode = FM_TILE_HORZ; else fitmode = 0; SendDlgItemMessage(hwndDlg,IDC_FIT,CB_SETCURSEL,(WPARAM)fitmode,0); } @@ -365,7 +361,7 @@ int GetShortFileName(TCHAR *FullFile) return 2; //mirand folder relative } -char * MadeString(HWND hwndDlg) +TCHAR* MadeString(HWND hwndDlg) { char buf[MAX_PATH*2] = {0}; int i = SendDlgItemMessage(hwndDlg,IDC_TYPE,CB_GETCURSEL, 0, 0); @@ -434,12 +430,13 @@ char * MadeString(HWND hwndDlg) } break; } - if (buf[0] != '\0') return mir_strdup(buf); + if (buf[0] != '\0') return mir_a2t(buf); return 0; } + void UpdateInfo(HWND hwndDlg) { - char *b = MadeString(hwndDlg); + TCHAR *b = MadeString(hwndDlg); if ( !b) { SendDlgItemMessageA(hwndDlg,IDC_EDIT1,WM_SETTEXT, 0, (LPARAM)""); @@ -451,15 +448,15 @@ void UpdateInfo(HWND hwndDlg) HTREEITEM hti = TreeView_GetSelection(GetDlgItem(hwndDlg,IDC_OBJECT_TREE)); if (hti) { - TVITEMA tvi = {0}; + TVITEM tvi = {0}; tvi.hItem = hti; - tvi.mask = TVIF_HANDLE|TVIF_PARAM; + tvi.mask = TVIF_HANDLE | TVIF_PARAM; TreeView_GetItem(GetDlgItem(hwndDlg,IDC_OBJECT_TREE),&tvi); sd = (OPT_OBJECT_DATA*)(tvi.lParam); if (sd) { mir_free(sd->szValue); - sd->szValue = mir_strdup(b); + sd->szValue = mir_tstrdup(b); } } } @@ -485,7 +482,7 @@ void StoreTreeNode(HWND hTree, HTREEITEM node, char * section) { OPT_OBJECT_DATA * dat = (OPT_OBJECT_DATA*)(tvi.lParam); if (dat->szName && dat->szValue) - db_set_s(NULL,section,dat->szName,dat->szValue); + db_set_ts(NULL,section,dat->szName,dat->szValue); } tmp2 = TreeView_GetChild(hTree,tmp); if (tmp2) StoreTreeNode(hTree,tmp2,section); @@ -503,7 +500,7 @@ void StoreTreeToDB(HWND hTree, char * section) glSkinWasModified = 2; } static BOOL fileChanged = FALSE; -static char * object_clipboard = NULL; +static TCHAR *object_clipboard = NULL; int GetFileSizes(HWND hwndDlg) { TCHAR buf[MAX_PATH]; @@ -615,7 +612,7 @@ INT_PTR CALLBACK DlgSkinEditorOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM sd = (OPT_OBJECT_DATA*)(tvi.lParam); } if (sd && sd->szValue) - object_clipboard = mir_strdup(sd->szValue); + object_clipboard = mir_tstrdup(sd->szValue); EnableWindow(GetDlgItem(hwndDlg,IDC_PASTE),object_clipboard != NULL); return 0; diff --git a/plugins/Clist_modern/src/modern_skinengine.cpp b/plugins/Clist_modern/src/modern_skinengine.cpp index d8b90a6ca8..b4d2768a98 100644 --- a/plugins/Clist_modern/src/modern_skinengine.cpp +++ b/plugins/Clist_modern/src/modern_skinengine.cpp @@ -184,9 +184,9 @@ HRESULT IniParser::WriteStrToDb( const char * szSection, const char * szName, co if ( This->_SecCheck) { //TODO check security here - if ( wildcmp( szSection,"Skin_Description_Section",1 )) return S_OK; + if ( wildcmp( szSection,"Skin_Description_Section")) return S_OK; } - if (( This->_Flags == IniParser::FLAG_ONLY_OBJECTS ) && !wildcmp( szSection, DEFAULTSKINSECTION,1 )) + if (( This->_Flags == IniParser::FLAG_ONLY_OBJECTS ) && !wildcmp( szSection, DEFAULTSKINSECTION)) return S_OK; // skip not objects @@ -1819,7 +1819,7 @@ static HBITMAP ske_LoadGlyphImage_TGA(const TCHAR *szFilename) BOOL err = FALSE; tga_header_t header; if ( !szFilename) return NULL; - if ( !wildcmpi(szFilename, _T("*\\*%.tga"))) { + if ( !wildcmpit(szFilename, _T("*\\*%.tga"))) { //Loading TGA image from file FILE *fp = _tfopen (szFilename, _T("rb")); if ( !fp) { @@ -2001,7 +2001,7 @@ static HBITMAP ske_LoadGlyphImageByDecoders(const TCHAR *tszFileName) static HBITMAP ske_skinLoadGlyphImage(const TCHAR *tszFileName) { - if ( !g_CluiData.fGDIPlusFail && !wildcmpi(tszFileName, _T("*.tga"))) + if ( !g_CluiData.fGDIPlusFail && !wildcmpit(tszFileName, _T("*.tga"))) return GDIPlus_LoadGlyphImage(tszFileName); return ske_LoadGlyphImageByDecoders(tszFileName); diff --git a/plugins/Clist_modern/src/modern_skinselector.cpp b/plugins/Clist_modern/src/modern_skinselector.cpp index 22b067c5c5..654a42b01e 100644 --- a/plugins/Clist_modern/src/modern_skinselector.cpp +++ b/plugins/Clist_modern/src/modern_skinselector.cpp @@ -62,71 +62,6 @@ int SkinSelector_DeleteMask(MODERNMASK *mm) return 1; } -#define _qtoupper(_c) (((_c) >= 'a' && (_c) <= 'z')?((_c)-('a'+'A')):(_c)) - -BOOL wildcmpi(const WCHAR *name, const WCHAR *mask) -{ - const WCHAR* last = NULL; - for (;; mask++, name++) - { - if (*mask != '?' && _qtoupper(*mask) != _qtoupper(*name)) break; - if (*name == '\0') return ((BOOL)!*mask); - } - if (*mask != '*') return FALSE; - for (;; mask++, name++) - { - while(*mask == '*') - { - last = mask++; - if (*mask == '\0') return ((BOOL)!*mask); /* true */ - } - if (*name == '\0') return ((BOOL)!*mask); /* *mask == EOS */ - if (*mask != '?' && _qtoupper(*mask) != _qtoupper(*name)) name -= (size_t)(mask - last) - 1, mask = last; - } -} - -BOOL wildcmpi(const char *name, const char *mask) -{ - const char *last = NULL; - for (;; mask++, name++) - { - if (*mask != '?' && _qtoupper(*mask) != _qtoupper(*name)) break; - if (*name == '\0') return ((BOOL)!*mask); - } - if (*mask != '*') return FALSE; - for (;; mask++, name++) - { - while(*mask == '*') - { - last = mask++; - if (*mask == '\0') return ((BOOL)!*mask); /* true */ - } - if (*name == '\0') return ((BOOL)!*mask); /* *mask == EOS */ - if (*mask != '?' && _qtoupper(*mask) != _qtoupper(*name)) name -= (size_t)(mask - last) - 1, mask = last; - } -} - -BOOL __inline wildcmp(const char * name, const char * mask, BYTE option) -{ - const char * last = '\0'; - for (;; mask++, name++) - { - if (*mask != '?' && *mask != *name) break; - if (*name == '\0') return ((BOOL)!*mask); - } - if (*mask != '*') return FALSE; - for (;; mask++, name++) - { - while(*mask == '*') - { - last = mask++; - if (*mask == '\0') return ((BOOL)!*mask); /* true */ - } - if (*name == '\0') return ((BOOL)!*mask); /* *mask == EOS */ - if (*mask != '?' && *mask != *name) name -= (size_t)(mask - last) - 1, mask = last; - } -} - BOOL MatchMask(char * name, char * mask) { if ( !mask || !name) return mask == name; @@ -488,7 +423,7 @@ BOOL CompareModernMask(MODERNMASK *mmValue,MODERNMASK *mmTemplate) { if (mmValue->pl_Params[pVal].dwId == ph) { - if (wildcmp(mmValue->pl_Params[pVal].szValue,p.szValue,0)){finded = 1; break;} + if (wildcmp(mmValue->pl_Params[pVal].szValue,p.szValue)){finded = 1; break;} else {finded = 0; break;} } pVal++; @@ -577,6 +512,40 @@ TCHAR * GetParamNT(char * string, TCHAR * buf, int buflen, BYTE paramN, char Del return buf; } +WCHAR* GetParamN(WCHAR *string, WCHAR *buf, int buflen, BYTE paramN, WCHAR Delim, BOOL SkipSpaces) +{ + int i=0; + DWORD start = 0; + DWORD end = 0; + DWORD CurentCount = 0; + DWORD len; + while (i < lstrlen(string)) + { + if (string[i] == Delim) + { + if (CurentCount == paramN) break; + start = i+1; + CurentCount++; + } + i++; + } + if (CurentCount == paramN) + { + if (SkipSpaces) + { //remove spaces + while (string[start] == ' ' && (int)start < lstrlen(string)) + start++; + while (i>1 && string[i-1] == ' ' && i>(int)start) + i--; + } + len = ((int)(i-start) < buflen)?i-start:buflen; + _tcsncpy(buf, string+start, len); + buf[len] = '\0'; + } + else buf[0] = '\0'; + return buf; +} + char * GetParamN(char * string, char * buf, int buflen, BYTE paramN, char Delim, BOOL SkipSpaces) { int i=0; -- cgit v1.2.3