From e3cefc7b6ca803e3f87dbadae54a110332778490 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 5 Jul 2012 22:41:06 +0000 Subject: - first of the /Core standard plugins; - code cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@778 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/modules/fonts/FontOptions.cpp | 74 +++++++++++++++++++-------------------- src/modules/fonts/services.cpp | 22 ++++++------ 2 files changed, 48 insertions(+), 48 deletions(-) (limited to 'src/modules/fonts') diff --git a/src/modules/fonts/FontOptions.cpp b/src/modules/fonts/FontOptions.cpp index bb3961369e..0ed3aa6911 100644 --- a/src/modules/fonts/FontOptions.cpp +++ b/src/modules/fonts/FontOptions.cpp @@ -102,13 +102,13 @@ int __inline DrawTextWithEffect(HDC hdc, LPCTSTR lpchText, int cchText, RECT * l return DrawText (hdc, lpchText, cchText, lprc, dwDTFormat); // else - params.cbSize = sizeof(DrawTextWithEffectParam); - params.hdc = hdc; - params.lpchText = lpchText; - params.cchText = cchText; - params.lprc = lprc; - params.dwDTFormat = dwDTFormat; - params.pEffect = pEffect; + params.cbSize = sizeof(DrawTextWithEffectParam); + params.hdc = hdc; + params.lpchText = lpchText; + params.cchText = cchText; + params.lprc = lprc; + params.dwDTFormat = dwDTFormat; + params.pEffect = pEffect; return CallService(MS_DRAW_TEXT_WITH_EFFECT, (WPARAM)¶ms, 0); } @@ -149,7 +149,7 @@ BOOL ExportSettings(HWND hwndDlg, TCHAR *filename, OBJLIST& flist, strcpy(buff, "SETTINGS:\r\n"); WriteLine(fhand, buff); - for (i = 0; i < flist.getCount(); i++) { + for (i=0; i < flist.getCount(); i++) { FontInternal& F = flist[i]; mir_snprintf(buff, SIZEOF(buff), "\r\n[%s]", F.dbSettingsGroup); @@ -159,16 +159,16 @@ BOOL ExportSettings(HWND hwndDlg, TCHAR *filename, OBJLIST& flist, } if (F.flags & FIDF_APPENDNAME) - mir_snprintf(buff, SIZEOF(buff), "%sName=s", F.prefix); + mir_snprintf(buff, SIZEOF(buff), "%sName = s", F.prefix); else - mir_snprintf(buff, SIZEOF(buff), "%s=s", F.prefix); + mir_snprintf(buff, SIZEOF(buff), "%s = s", F.prefix); WideCharToMultiByte(code_page, 0, F.value.szFace, -1, abuff, 1024, 0, 0); - abuff[1023]=0; + abuff[1023] = 0; strcat(buff, abuff); WriteLine(fhand, buff); - mir_snprintf(buff, SIZEOF(buff), "%sSize=b", F.prefix); + mir_snprintf(buff, SIZEOF(buff), "%sSize = b", F.prefix); if (F.flags & FIDF_SAVEACTUALHEIGHT) { HDC hdc; SIZE size; @@ -195,17 +195,17 @@ BOOL ExportSettings(HWND hwndDlg, TCHAR *filename, OBJLIST& flist, WriteLine(fhand, buff); - mir_snprintf(buff, SIZEOF(buff), "%sSty=b%d", F.prefix, (BYTE)F.value.style); + mir_snprintf(buff, SIZEOF(buff), "%sSty = b%d", F.prefix, (BYTE)F.value.style); WriteLine(fhand, buff); - mir_snprintf(buff, SIZEOF(buff), "%sSet=b%d", F.prefix, (BYTE)F.value.charset); + mir_snprintf(buff, SIZEOF(buff), "%sSet = b%d", F.prefix, (BYTE)F.value.charset); WriteLine(fhand, buff); - mir_snprintf(buff, SIZEOF(buff), "%sCol=d%d", F.prefix, (DWORD)F.value.colour); + mir_snprintf(buff, SIZEOF(buff), "%sCol = d%d", F.prefix, (DWORD)F.value.colour); WriteLine(fhand, buff); if (F.flags & FIDF_NOAS) { - mir_snprintf(buff, SIZEOF(buff), "%sAs=w%d", F.prefix, (WORD)0x00FF); + mir_snprintf(buff, SIZEOF(buff), "%sAs = w%d", F.prefix, (WORD)0x00FF); WriteLine(fhand, buff); } - mir_snprintf(buff, SIZEOF(buff), "%sFlags=w%d", F.prefix, (WORD)F.flags); + mir_snprintf(buff, SIZEOF(buff), "%sFlags = w%d", F.prefix, (WORD)F.flags); WriteLine(fhand, buff); } @@ -218,7 +218,7 @@ BOOL ExportSettings(HWND hwndDlg, TCHAR *filename, OBJLIST& flist, strcpy(header, buff); WriteLine(fhand, buff); } - mir_snprintf(buff, SIZEOF(buff), "%s=d%d", C.setting, (DWORD)C.value); + mir_snprintf(buff, SIZEOF(buff), "%s = d%d", C.setting, (DWORD)C.value); WriteLine(fhand, buff); } @@ -231,11 +231,11 @@ BOOL ExportSettings(HWND hwndDlg, TCHAR *filename, OBJLIST& flist, strcpy(header, buff); WriteLine(fhand, buff); } - mir_snprintf(buff, SIZEOF(buff), "%sEffect=b%d", E.setting, E.value.effectIndex); + mir_snprintf(buff, SIZEOF(buff), "%sEffect = b%d", E.setting, E.value.effectIndex); WriteLine(fhand, buff); - mir_snprintf(buff, SIZEOF(buff), "%sEffectCol1=d%d", E.setting, E.value.baseColour); + mir_snprintf(buff, SIZEOF(buff), "%sEffectCol1 = d%d", E.setting, E.value.baseColour); WriteLine(fhand, buff); - mir_snprintf(buff, SIZEOF(buff), "%sEffectCol2=d%d", E.setting, E.value.secondaryColour); + mir_snprintf(buff, SIZEOF(buff), "%sEffectCol2 = d%d", E.setting, E.value.secondaryColour); WriteLine(fhand, buff); } @@ -287,7 +287,7 @@ static BOOL sttFsuiBindColourIdToFonts(HWND hwndList, const TCHAR *name, const T for (i = SendMessage(hwndList, LB_GETCOUNT, 0, 0); i--;) { FSUIListItemData *itemData = (FSUIListItemData *)SendMessage(hwndList, LB_GETITEMDATA, i, 0); - if (itemData && itemData->font_id >= 0) { + if (itemData && itemData->font_id >= 0) { FontInternal& F = font_id_list_w2[itemData->font_id]; if (name && !_tcscmp(F.name, name)) { @@ -310,7 +310,7 @@ static BOOL sttFsuiBindEffectIdToFonts(HWND hwndList, const TCHAR *name, int eff for (i = SendMessage(hwndList, LB_GETCOUNT, 0, 0); i--;) { FSUIListItemData *itemData = (FSUIListItemData *)SendMessage(hwndList, LB_GETITEMDATA, i, 0); - if (itemData && itemData->font_id >= 0) { + if (itemData && itemData->font_id >= 0) { FontInternal& F = font_id_list_w2[itemData->font_id]; if (name && !_tcscmp(F.name, name)) { @@ -487,7 +487,7 @@ static INT_PTR CALLBACK ChooseEffectDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wPar } int cnt = SendDlgItemMessage(hwndDlg, IDC_EFFECT_COMBO, CB_GETCOUNT, 0, 0); - for (i = 0; i < cnt; i++) { + for (i=0; i < cnt; i++) { if (SendDlgItemMessage(hwndDlg, IDC_EFFECT_COMBO, CB_GETITEMDATA, i, 0) == pEffect->effectIndex) { SendDlgItemMessage(hwndDlg, IDC_EFFECT_COMBO, CB_SETCURSEL, i, 0); break; @@ -507,9 +507,9 @@ static INT_PTR CALLBACK ChooseEffectDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wPar case IDOK: { int i = SendDlgItemMessage(hwndDlg, IDC_EFFECT_COMBO, CB_GETCURSEL, 0, 0); - pEffect->effectIndex=(BYTE)SendDlgItemMessage(hwndDlg, IDC_EFFECT_COMBO, CB_GETITEMDATA, i, 0); - pEffect->baseColour=SendDlgItemMessage(hwndDlg, IDC_EFFECT_COLOUR1, CPM_GETCOLOUR, 0, 0)|((~(BYTE)SendDlgItemMessage(hwndDlg, IDC_EFFECT_COLOUR_SPIN1, UDM_GETPOS, 0, 0))<<24); - pEffect->secondaryColour=SendDlgItemMessage(hwndDlg, IDC_EFFECT_COLOUR2, CPM_GETCOLOUR, 0, 0)|((~(BYTE)SendDlgItemMessage(hwndDlg, IDC_EFFECT_COLOUR_SPIN2, UDM_GETPOS, 0, 0))<<24);; + pEffect->effectIndex = (BYTE)SendDlgItemMessage(hwndDlg, IDC_EFFECT_COMBO, CB_GETITEMDATA, i, 0); + pEffect->baseColour = SendDlgItemMessage(hwndDlg, IDC_EFFECT_COLOUR1, CPM_GETCOLOUR, 0, 0)|((~(BYTE)SendDlgItemMessage(hwndDlg, IDC_EFFECT_COLOUR_SPIN1, UDM_GETPOS, 0, 0))<<24); + pEffect->secondaryColour = SendDlgItemMessage(hwndDlg, IDC_EFFECT_COLOUR2, CPM_GETCOLOUR, 0, 0)|((~(BYTE)SendDlgItemMessage(hwndDlg, IDC_EFFECT_COLOUR_SPIN2, UDM_GETPOS, 0, 0))<<24);; } EndDialog(hwndDlg, IDOK); return TRUE; @@ -599,14 +599,14 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, effect_id_list_w2 = effect_id_list; effect_id_list_w3 = effect_id_list; - for (i = 0; i < font_id_list_w2.getCount(); i++) { + for (i=0; i < font_id_list_w2.getCount(); i++) { FontInternal& F = font_id_list_w2[i]; // sync settings with database UpdateFontSettings(&F, &F.value); sttFsuiCreateSettingsTreeNode(GetDlgItem(hwndDlg, IDC_FONTGROUP), F.group, F.hLangpack); } - for (i = 0; i < colour_id_list_w2.getCount(); i++) { + for (i=0; i < colour_id_list_w2.getCount(); i++) { ColourInternal& C = colour_id_list_w2[i]; // sync settings with database @@ -614,7 +614,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, sttFsuiCreateSettingsTreeNode(GetDlgItem(hwndDlg, IDC_FONTGROUP), C.group, C.hLangpack); } - for (i = 0; i < effect_id_list_w2.getCount(); i++) { + for (i=0; i < effect_id_list_w2.getCount(); i++) { EffectInternal& E = effect_id_list_w2[i]; // sync settings with database @@ -927,7 +927,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, if (selCount = SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETSELCOUNT, (WPARAM)0, (LPARAM)0)) { int *selItems = (int *)mir_alloc(font_id_list_w2.getCount() * sizeof(int)); SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETSELITEMS, (WPARAM)selCount, (LPARAM)selItems); - for (i = 0; i < selCount; ++i) { + for (i=0; i < selCount; ++i) { FSUIListItemData *itemData = (FSUIListItemData *)SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETITEMDATA, selItems[i], 0); if (IsBadReadPtr(itemData, sizeof(FSUIListItemData))) continue; // prevent possible problems with corrupted itemData @@ -1017,7 +1017,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, else cf.Flags = CF_FORCEFONTEXIST | CF_INITTOLOGFONTSTRUCT | CF_SCREENFONTS; if (ChooseFont(&cf)) { - for (i = 0; i < selCount; ++i) { + for (i=0; i < selCount; ++i) { FSUIListItemData *itemData = (FSUIListItemData *)SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETITEMDATA, selItems[i], 0); if (itemData->font_id < 0) continue; @@ -1075,7 +1075,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, if (selCount = SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETSELCOUNT, 0, 0)) { int *selItems = (int *)mir_alloc(selCount * sizeof(int)); SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETSELITEMS, (WPARAM)selCount, (LPARAM) selItems); - for (int i = 0; i < selCount; i++) { + for (int i=0; i < selCount; i++) { FSUIListItemData *itemData = (FSUIListItemData *)SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETITEMDATA, selItems[i], 0); if (itemData->font_id < 0) continue; font_id_list_w2[itemData->font_id].value.colour = SendDlgItemMessage(hwndDlg, IDC_FONTCOLOUR, CPM_GETCOLOUR, 0, 0); @@ -1090,7 +1090,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, if (selCount = SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETSELCOUNT, 0, 0)) { int *selItems = (int *)mir_alloc(selCount * sizeof(int)); SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETSELITEMS, (WPARAM)selCount, (LPARAM) selItems); - for (i = 0; i < selCount; i++) { + for (i=0; i < selCount; i++) { FSUIListItemData *itemData = (FSUIListItemData *)SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETITEMDATA, selItems[i], 0); if (itemData->colour_id < 0) continue; colour_id_list_w2[itemData->colour_id].value = SendDlgItemMessage(hwndDlg, IDC_BKGCOLOUR, CPM_GETCOLOUR, 0, 0); @@ -1110,7 +1110,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, if (font_id_list_w2.getCount() && (selCount = SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETSELCOUNT, (WPARAM)0, (LPARAM)0))) { int *selItems = (int *)mir_alloc(font_id_list_w2.getCount() * sizeof(int)); SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETSELITEMS, (WPARAM)selCount, (LPARAM)selItems); - for (i = 0; i < selCount; ++i) { + for (i=0; i < selCount; ++i) { FSUIListItemData *itemData = (FSUIListItemData *)SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETITEMDATA, selItems[i], 0); if (IsBadReadPtr(itemData, sizeof(FSUIListItemData))) continue; // prevent possible problems with corrupted itemData @@ -1274,7 +1274,7 @@ int OptInit(WPARAM wParam, LPARAM) static FontInternal *sttFindFont(OBJLIST &fonts, char *module, char *prefix) { - for (int i = 0; i < fonts.getCount(); i++) + for (int i=0; i < fonts.getCount(); i++) { FontInternal& F = fonts[i]; if ( !lstrcmpA(F.dbSettingsGroup, module) && !lstrcmpA(F.prefix, prefix)) @@ -1418,7 +1418,7 @@ INT_PTR CALLBACK DlgPluginOpt(HWND, UINT, WPARAM, LPARAM); int FontsModernOptInit(WPARAM wParam, LPARAM lParam) { - static int iBoldControls[] = + static int iBoldControls[] = { IDC_TXT_TITLE1, IDC_TXT_TITLE2, IDC_TXT_TITLE3, MODERNOPT_CTRL_LAST diff --git a/src/modules/fonts/services.cpp b/src/modules/fonts/services.cpp index f4804c839a..5a7c9696ab 100644 --- a/src/modules/fonts/services.cpp +++ b/src/modules/fonts/services.cpp @@ -237,7 +237,7 @@ void UpdateFontSettings(FontIDW* font_id, FontSettingsT* fontsettings) colour = GetColorFromDefault(font_id->deffontsettings.colour); } - fontsettings->style = + fontsettings->style = (lf.lfWeight == FW_NORMAL ? 0 : DBFONTF_BOLD) | (lf.lfItalic ? DBFONTF_ITALIC : 0) | (lf.lfUnderline ? DBFONTF_UNDERLINE : 0) | (lf.lfStrikeOut ? DBFONTF_STRIKEOUT : 0); fontsettings->size = (char)lf.lfHeight; @@ -288,7 +288,7 @@ static int sttRegisterFontWorker(FontIDW* font_id, int hLangpack) if (font_id->cbSize != sizeof(FontIDW) && font_id->cbSize != FontIDW_OLDSIZE) return -1; - for (int i = 0; i < font_id_list.getCount(); i++) { + for (int i=0; i < font_id_list.getCount(); i++) { FontInternal& F = font_id_list[i]; if ( !lstrcmp(F.group, font_id->group) && !lstrcmp(F.name, font_id->name) && !(F.flags & FIDF_ALLOWREREGISTER)) return 1; @@ -335,7 +335,7 @@ static INT_PTR sttGetFontWorker(FontIDW* font_id, LOGFONT* lf) { COLORREF colour; - for (int i = 0; i < font_id_list.getCount(); i++) { + for (int i=0; i < font_id_list.getCount(); i++) { FontInternal& F = font_id_list[i]; if ( !_tcsncmp(F.name, font_id->name, SIZEOF(F.name)) && !_tcsncmp(F.group, font_id->group, SIZEOF(F.group))) { if (GetFontSettingFromDB(F.dbSettingsGroup, F.prefix, lf, &colour, F.flags) && (F.flags & FIDF_DEFAULTVALID)) { @@ -372,7 +372,7 @@ INT_PTR GetFont(WPARAM wParam, LPARAM lParam) void KillModuleFonts(int hLangpack) { - for (int i=font_id_list.getCount()-1; i >= 0; i--) + for (int i = font_id_list.getCount()-1; i >= 0; i--) if ( font_id_list[i].hLangpack == hLangpack) font_id_list.remove(i); } @@ -390,7 +390,7 @@ static INT_PTR sttRegisterColourWorker(ColourIDW* colour_id, int hLangpack) if (colour_id->cbSize != sizeof(ColourIDW)) return -1; - for (int i = 0; i < colour_id_list.getCount(); i++) { + for (int i=0; i < colour_id_list.getCount(); i++) { ColourInternal& C = colour_id_list[i]; if ( !_tcscmp(C.group, colour_id->group) && !_tcscmp(C.name, colour_id->name)) return 1; @@ -422,7 +422,7 @@ INT_PTR RegisterColour(WPARAM wParam, LPARAM lParam) static INT_PTR sttGetColourWorker(ColourIDW* colour_id) { - for (int i = 0; i < colour_id_list.getCount(); i++) { + for (int i=0; i < colour_id_list.getCount(); i++) { ColourInternal& C = colour_id_list[i]; if ( !_tcscmp(C.group, colour_id->group) && !_tcscmp(C.name, colour_id->name)) return DBGetContactSettingDword(NULL, C.dbSettingsGroup, C.setting, GetColorFromDefault(C.defcolour)); @@ -447,7 +447,7 @@ INT_PTR GetColour(WPARAM wParam, LPARAM) void KillModuleColours(int hLangpack) { - for (int i=colour_id_list.getCount()-1; i >= 0; i--) + for (int i = colour_id_list.getCount()-1; i >= 0; i--) if (colour_id_list[i].hLangpack == hLangpack) colour_id_list.remove(i); } @@ -476,7 +476,7 @@ static INT_PTR sttRegisterEffectWorker(EffectIDW* effect_id, int hLangpack) if (effect_id->cbSize != sizeof(EffectIDW)) return -1; - for (int i = 0; i < effect_id_list.getCount(); i++) { + for (int i=0; i < effect_id_list.getCount(); i++) { EffectInternal& E = effect_id_list[i]; if ( !_tcscmp(E.group, effect_id->group) && !_tcscmp(E.name, effect_id->name)) return 1; @@ -508,14 +508,14 @@ INT_PTR RegisterEffect(WPARAM wParam, LPARAM lParam) static INT_PTR sttGetEffectWorker(EffectIDW* effect_id, FONTEFFECT* effect) { - for (int i = 0; i < effect_id_list.getCount(); i++) { + for (int i=0; i < effect_id_list.getCount(); i++) { EffectInternal& E = effect_id_list[i]; if ( !_tcsncmp(E.name, effect_id->name, SIZEOF(E.name)) && !_tcsncmp(E.group, effect_id->group, SIZEOF(E.group))) { FONTEFFECT temp; UpdateEffectSettings(effect_id, &temp); effect->effectIndex = temp.effectIndex; - effect->baseColour = temp.baseColour; + effect->baseColour = temp.baseColour; effect->secondaryColour = temp.secondaryColour; return TRUE; } } @@ -539,7 +539,7 @@ INT_PTR GetEffect(WPARAM wParam, LPARAM lParam) void KillModuleEffects(int hLangpack) { - for (int i=effect_id_list.getCount()-1; i >= 0; i--) + for (int i = effect_id_list.getCount()-1; i >= 0; i--) if (effect_id_list[i].hLangpack == hLangpack) effect_id_list.remove(i); } -- cgit v1.2.3