summaryrefslogtreecommitdiff
path: root/src/modules/fonts
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-06-18 20:53:59 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-06-18 20:53:59 +0000
commit3f23417a1099f73dc28ec1b7d6ec2a1a7fc2b7a2 (patch)
tree3e0bcd88c55dad310da0dc980e252bf9fbfa6dc5 /src/modules/fonts
parent537b94169bf2483798a651ee3b96f7904eebe7b4 (diff)
- PLUGININFO structure removed at all;
- Options_AddPage & UserInfo_AddPage replaced MS_OPT_ADDPAGE & MS_USERINFO_ADDPAGE services respectively - total internal redesign of options' translation - code reformatting git-svn-id: http://svn.miranda-ng.org/main/trunk@477 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/modules/fonts')
-rw-r--r--src/modules/fonts/FontOptions.cpp355
-rw-r--r--src/modules/fonts/FontService.cpp10
-rw-r--r--src/modules/fonts/FontService.h2
-rw-r--r--src/modules/fonts/services.cpp142
4 files changed, 253 insertions, 256 deletions
diff --git a/src/modules/fonts/FontOptions.cpp b/src/modules/fonts/FontOptions.cpp
index 2e8ac7823e..8f343c5041 100644
--- a/src/modules/fonts/FontOptions.cpp
+++ b/src/modules/fonts/FontOptions.cpp
@@ -27,47 +27,47 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// *_w2 is working copy of list
// *_w3 is stores initial configuration
-static int sttCompareFont( const TFontID* p1, const TFontID* p2 )
+static int sttCompareFont(const TFontID* p1, const TFontID* p2)
{
- int result = _tcscmp( p1->group, p2->group );
- if ( result != 0 )
+ int result = _tcscmp(p1->group, p2->group);
+ if (result != 0)
return result;
result = p1->order - p2->order;
- if ( result != 0 )
+ if (result != 0)
return result;
- return _tcscmp( TranslateTS(p1->name), TranslateTS(p2->name) );
+ return _tcscmp(TranslateTS(p1->name), TranslateTS(p2->name));
}
-OBJLIST<TFontID> font_id_list( 20, sttCompareFont ), font_id_list_w2( 20, sttCompareFont ), font_id_list_w3( 20, sttCompareFont );
+OBJLIST<TFontID> font_id_list(20, sttCompareFont), font_id_list_w2(20, sttCompareFont), font_id_list_w3(20, sttCompareFont);
-static int sttCompareColour( const TColourID* p1, const TColourID* p2 )
+static int sttCompareColour(const TColourID* p1, const TColourID* p2)
{
- int result = _tcscmp( p1->group, p2->group );
- if ( result != 0 )
+ int result = _tcscmp(p1->group, p2->group);
+ if (result != 0)
return result;
result = p1->order - p2->order;
- if ( result != 0 )
+ if (result != 0)
return result;
- return _tcscmp( TranslateTS(p1->name), TranslateTS(p2->name) );
+ return _tcscmp(TranslateTS(p1->name), TranslateTS(p2->name));
}
-OBJLIST<TColourID> colour_id_list( 10, sttCompareColour ), colour_id_list_w2( 10, sttCompareColour ), colour_id_list_w3( 10, sttCompareColour );
+OBJLIST<TColourID> colour_id_list(10, sttCompareColour), colour_id_list_w2(10, sttCompareColour), colour_id_list_w3(10, sttCompareColour);
-static int sttCompareEffect( const TEffectID* p1, const TEffectID* p2 )
+static int sttCompareEffect(const TEffectID* p1, const TEffectID* p2)
{
- int result = _tcscmp( p1->group, p2->group );
- if ( result != 0 )
+ int result = _tcscmp(p1->group, p2->group);
+ if (result != 0)
return result;
result = p1->order - p2->order;
- if ( result != 0 )
+ if (result != 0)
return result;
- return _tcscmp( TranslateTS(p1->name), TranslateTS(p2->name) );
+ return _tcscmp(TranslateTS(p1->name), TranslateTS(p2->name));
}
-OBJLIST<TEffectID> effect_id_list( 10, sttCompareEffect ), effect_id_list_w2( 10, sttCompareEffect ), effect_id_list_w3( 10, sttCompareEffect );
+OBJLIST<TEffectID> effect_id_list(10, sttCompareEffect), effect_id_list_w2(10, sttCompareEffect), effect_id_list_w3(10, sttCompareEffect);
typedef struct DrawTextWithEffectParam_tag
{
@@ -87,26 +87,26 @@ typedef struct DrawTextWithEffectParam_tag
#define MS_DRAW_TEXT_WITH_EFFECT MS_DRAW_TEXT_WITH_EFFECTW
// Helper
-int __inline DrawTextWithEffect( HDC hdc, LPCTSTR lpchText, int cchText, RECT * lprc, UINT dwDTFormat, FONTEFFECT * pEffect )
+int __inline DrawTextWithEffect(HDC hdc, LPCTSTR lpchText, int cchText, RECT * lprc, UINT dwDTFormat, FONTEFFECT * pEffect)
{
DrawTextWithEffectParam params;
- static BYTE bIfServiceExists = ServiceExists( MS_DRAW_TEXT_WITH_EFFECT ) ? 1 : 0;
+ static BYTE bIfServiceExists = ServiceExists(MS_DRAW_TEXT_WITH_EFFECT) ? 1 : 0;
- if ( pEffect == NULL || pEffect->effectIndex == 0 )
- return DrawText ( hdc, lpchText, cchText, lprc, dwDTFormat ); // If no effect specified draw by GDI it just more careful with ClearType
+ if (pEffect == NULL || pEffect->effectIndex == 0)
+ return DrawText (hdc, lpchText, cchText, lprc, dwDTFormat); // If no effect specified draw by GDI it just more careful with ClearType
- if ( bIfServiceExists == 0)
- return DrawText ( hdc, lpchText, cchText, lprc, dwDTFormat );
+ if (bIfServiceExists == 0)
+ return DrawText (hdc, lpchText, cchText, lprc, dwDTFormat);
// else
- params.cbSize = sizeof( DrawTextWithEffectParam );
+ 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)&params, 0 );
+ return CallService(MS_DRAW_TEXT_WITH_EFFECT, (WPARAM)&params, 0);
}
@@ -146,32 +146,32 @@ BOOL ExportSettings(HWND hwndDlg, TCHAR *filename, OBJLIST<TFontID>& flist, OBJL
strcpy(buff, "SETTINGS:\r\n");
WriteLine(fhand, buff);
- for ( i = 0; i < flist.getCount(); i++ ) {
+ for (i = 0; i < flist.getCount(); i++) {
TFontID& F = flist[i];
mir_snprintf(buff, SIZEOF(buff), "\r\n[%s]", F.dbSettingsGroup);
- if ( strcmp( buff, header ) != 0) {
+ if (strcmp(buff, header) != 0) {
strcpy(header, buff);
WriteLine(fhand, buff);
}
- if ( F.flags & FIDF_APPENDNAME )
- mir_snprintf( buff, SIZEOF(buff), "%sName=s", F.prefix );
+ if (F.flags & FIDF_APPENDNAME)
+ 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;
- strcat( buff, abuff );
+ strcat(buff, abuff);
WriteLine(fhand, buff);
mir_snprintf(buff, SIZEOF(buff), "%sSize=b", F.prefix);
- if ( F.flags & FIDF_SAVEACTUALHEIGHT ) {
+ if (F.flags & FIDF_SAVEACTUALHEIGHT) {
HDC hdc;
SIZE size;
HFONT hFont, hOldFont;
LOGFONT lf;
- CreateFromFontSettings( &F.value, &lf );
+ CreateFromFontSettings(&F.value, &lf);
hFont = CreateFontIndirect(&lf);
hdc = GetDC(hwndDlg);
@@ -207,32 +207,32 @@ BOOL ExportSettings(HWND hwndDlg, TCHAR *filename, OBJLIST<TFontID>& flist, OBJL
}
header[0] = 0;
- for ( i=0; i < clist.getCount(); i++ ) {
+ for (i=0; i < clist.getCount(); i++) {
TColourID& C = clist[i];
- mir_snprintf(buff, SIZEOF(buff), "\r\n[%s]", C.dbSettingsGroup );
+ mir_snprintf(buff, SIZEOF(buff), "\r\n[%s]", C.dbSettingsGroup);
if (strcmp(buff, header) != 0) {
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);
}
header[0] = 0;
- for ( i=0; i < elist.getCount(); i++ ) {
+ for (i=0; i < elist.getCount(); i++) {
TEffectID& E = elist[i];
- mir_snprintf(buff, SIZEOF(buff), "\r\n[%s]", E.dbSettingsGroup );
+ mir_snprintf(buff, SIZEOF(buff), "\r\n[%s]", E.dbSettingsGroup);
if (strcmp(buff, header) != 0) {
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);
}
@@ -281,18 +281,18 @@ static BOOL sttFsuiBindColourIdToFonts(HWND hwndList, const TCHAR *name, const T
{
int i;
BOOL res = FALSE;
- for (i = SendMessage(hwndList, LB_GETCOUNT, 0, 0); i--; )
+ 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) {
TFontID& F = font_id_list_w2[itemData->font_id];
- if ( name && !_tcscmp( F.name, name )) {
+ if (name && !_tcscmp(F.name, name)) {
itemData->colour_id = colourId;
res = TRUE;
}
- if ( backgroundGroup && backgroundName && !_tcscmp( F.backgroundGroup, backgroundGroup) && !_tcscmp( F.backgroundName, backgroundName)) {
+ if (backgroundGroup && backgroundName && !_tcscmp(F.backgroundGroup, backgroundGroup) && !_tcscmp(F.backgroundName, backgroundName)) {
itemData->colour_id = colourId;
res = TRUE;
} } }
@@ -304,13 +304,13 @@ static BOOL sttFsuiBindEffectIdToFonts(HWND hwndList, const TCHAR *name, int eff
{
int i;
BOOL res = FALSE;
- for (i = SendMessage(hwndList, LB_GETCOUNT, 0, 0); i--; )
+ 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) {
TFontID& F = font_id_list_w2[itemData->font_id];
- if ( name && !_tcscmp( F.name, name )) {
+ if (name && !_tcscmp(F.name, name)) {
itemData->effect_id = effectId;
res = TRUE;
}
@@ -330,7 +330,7 @@ static HTREEITEM sttFindNamedTreeItemAt(HWND hwndTree, HTREEITEM hItem, const TC
else
tvi.hItem = TreeView_GetRoot(hwndTree);
- if (!name)
+ if ( !name)
return tvi.hItem;
tvi.mask = TVIF_TEXT;
@@ -341,7 +341,7 @@ static HTREEITEM sttFindNamedTreeItemAt(HWND hwndTree, HTREEITEM hItem, const TC
{
TreeView_GetItem(hwndTree, &tvi);
- if (!lstrcmp(tvi.pszText, name))
+ if ( !lstrcmp(tvi.pszText, name))
return tvi.hItem;
tvi.hItem = TreeView_GetNextSibling(hwndTree, tvi.hItem);
@@ -369,11 +369,11 @@ static void sttFsuiCreateSettingsTreeNode(HWND hwndTree, const TCHAR *groupName)
*sectionName = 0;
}
- pItemName = TranslateTS( pItemName );
+ pItemName = TranslateTS(pItemName);
hItem = sttFindNamedTreeItemAt(hwndTree, hSection, pItemName);
- if (!sectionName || !hItem) {
- if (!hItem) {
+ if ( !sectionName || !hItem) {
+ if ( !hItem) {
TVINSERTSTRUCT tvis = {0};
TreeItem *treeItem = (TreeItem *)mir_alloc(sizeof(TreeItem));
treeItem->groupName = sectionName ? NULL : mir_tstrdup(groupName);
@@ -390,7 +390,7 @@ static void sttFsuiCreateSettingsTreeNode(HWND hwndTree, const TCHAR *groupName)
ZeroMemory(&tvis.item, sizeof(tvis.item));
tvis.item.hItem = hItem;
tvis.item.mask = TVIF_HANDLE|TVIF_STATE;
- tvis.item.state = tvis.item.stateMask = DBGetContactSettingByte(NULL, "FontServiceUI", treeItem->paramName, TVIS_EXPANDED );
+ tvis.item.state = tvis.item.stateMask = DBGetContactSettingByte(NULL, "FontServiceUI", treeItem->paramName, TVIS_EXPANDED);
TreeView_SetItem(hwndTree, &tvis.item);
} }
@@ -405,36 +405,36 @@ static void sttFsuiCreateSettingsTreeNode(HWND hwndTree, const TCHAR *groupName)
}
}
-static void sttSaveCollapseState( HWND hwndTree )
+static void sttSaveCollapseState(HWND hwndTree)
{
HTREEITEM hti;
TVITEM tvi;
- hti = TreeView_GetRoot( hwndTree );
- while ( hti != NULL ) {
+ hti = TreeView_GetRoot(hwndTree);
+ while (hti != NULL) {
HTREEITEM ht;
TreeItem *treeItem;
tvi.mask = TVIF_STATE | TVIF_HANDLE | TVIF_CHILDREN | TVIF_PARAM;
tvi.hItem = hti;
tvi.stateMask = (DWORD)-1;
- TreeView_GetItem( hwndTree, &tvi );
+ TreeView_GetItem(hwndTree, &tvi);
- if ( tvi.cChildren > 0 ) {
+ if (tvi.cChildren > 0) {
treeItem = (TreeItem *)tvi.lParam;
- if ( tvi.state & TVIS_EXPANDED )
- DBWriteContactSettingByte(NULL, "FontServiceUI", treeItem->paramName, TVIS_EXPANDED );
+ if (tvi.state & TVIS_EXPANDED)
+ DBWriteContactSettingByte(NULL, "FontServiceUI", treeItem->paramName, TVIS_EXPANDED);
else
- DBWriteContactSettingByte(NULL, "FontServiceUI", treeItem->paramName, 0 );
+ DBWriteContactSettingByte(NULL, "FontServiceUI", treeItem->paramName, 0);
}
- ht = TreeView_GetChild( hwndTree, hti );
- if ( ht == NULL ) {
- ht = TreeView_GetNextSibling( hwndTree, hti );
- while ( ht == NULL ) {
- hti = TreeView_GetParent( hwndTree, hti );
- if ( hti == NULL ) break;
- ht = TreeView_GetNextSibling( hwndTree, hti );
+ ht = TreeView_GetChild(hwndTree, hti);
+ if (ht == NULL) {
+ ht = TreeView_GetNextSibling(hwndTree, hti);
+ while (ht == NULL) {
+ hti = TreeView_GetParent(hwndTree, hti);
+ if (hti == NULL) break;
+ ht = TreeView_GetNextSibling(hwndTree, hti);
} }
hti = ht;
@@ -445,18 +445,18 @@ static void sttFreeListItems(HWND hList)
int idx = 0;
LRESULT res;
FSUIListItemData *itemData;
- int count = SendMessage( hList, LB_GETCOUNT, 0, 0 );
- if ( count > 0 ) {
- while ( idx < count) {
- res = SendMessage( hList, LB_GETITEMDATA, idx++, 0 );
+ int count = SendMessage(hList, LB_GETCOUNT, 0, 0);
+ if (count > 0) {
+ while (idx < count) {
+ res = SendMessage(hList, LB_GETITEMDATA, idx++, 0);
itemData = (FSUIListItemData *)res;
- if ( itemData && res != LB_ERR )
- mir_free( itemData );
+ if (itemData && res != LB_ERR)
+ mir_free(itemData);
}
}
}
-static BOOL ShowEffectButton( HWND hwndDlg, BOOL bShow )
+static BOOL ShowEffectButton(HWND hwndDlg, BOOL bShow)
{
ShowWindow(GetDlgItem(hwndDlg, IDC_BKGCOLOUR), bShow ? SW_HIDE : SW_SHOW);
ShowWindow(GetDlgItem(hwndDlg, IDC_BKGCOLOUR_STATIC), bShow ? SW_HIDE : SW_SHOW);
@@ -466,14 +466,14 @@ static BOOL ShowEffectButton( HWND hwndDlg, BOOL bShow )
return TRUE;
}
-static INT_PTR CALLBACK ChooseEffectDlgProc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam )
+static INT_PTR CALLBACK ChooseEffectDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
static TEffectSettings * pEffect = NULL;
switch (uMsg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
- pEffect = ( TEffectSettings*) lParam;
+ pEffect = (TEffectSettings*) lParam;
{
int i;
TCHAR * ModernEffectNames[]=
@@ -488,17 +488,17 @@ static INT_PTR CALLBACK ChooseEffectDlgProc( HWND hwndDlg, UINT uMsg, WPARAM wPa
_T("Contour heavy"),
};
- for ( i=0; i < SIZEOF(ModernEffectNames); i++ )
+ for (i=0; i < SIZEOF(ModernEffectNames); i++)
{
int itemid = SendDlgItemMessage(hwndDlg, IDC_EFFECT_COMBO, CB_ADDSTRING, 0, (LPARAM)TranslateTS(ModernEffectNames[i]));
- SendDlgItemMessage(hwndDlg, IDC_EFFECT_COMBO, CB_SETITEMDATA, itemid, i );
- SendDlgItemMessage(hwndDlg, IDC_EFFECT_COMBO, CB_SETCURSEL, 0, 0 );
+ SendDlgItemMessage(hwndDlg, IDC_EFFECT_COMBO, CB_SETITEMDATA, itemid, i);
+ SendDlgItemMessage(hwndDlg, IDC_EFFECT_COMBO, CB_SETCURSEL, 0, 0);
}
- int cnt=SendDlgItemMessage(hwndDlg, IDC_EFFECT_COMBO, CB_GETCOUNT, 0, 0 );
- 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 );
+ int cnt=SendDlgItemMessage(hwndDlg, IDC_EFFECT_COMBO, CB_GETCOUNT, 0, 0);
+ 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;
} } }
@@ -515,16 +515,16 @@ static INT_PTR CALLBACK ChooseEffectDlgProc( HWND hwndDlg, UINT uMsg, WPARAM wPa
switch (LOWORD(wParam)) {
case IDOK:
{
- int i = SendDlgItemMessage(hwndDlg, IDC_EFFECT_COMBO, CB_GETCURSEL, 0, 0 );
+ 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);;
}
- EndDialog( hwndDlg, IDOK );
+ EndDialog(hwndDlg, IDOK);
return TRUE;
case IDCANCEL:
- EndDialog( hwndDlg, IDCANCEL );
+ EndDialog(hwndDlg, IDCANCEL);
return TRUE;
}
break;
@@ -535,9 +535,9 @@ static INT_PTR CALLBACK ChooseEffectDlgProc( HWND hwndDlg, UINT uMsg, WPARAM wPa
return FALSE;
}
-static BOOL ChooseEffectDialog( HWND hwndParent, TEffectSettings * es)
+static BOOL ChooseEffectDialog(HWND hwndParent, TEffectSettings * es)
{
- return ( DialogBoxParam( hMirandaInst, MAKEINTRESOURCE(IDD_CHOOSE_FONT_EFFECT), hwndParent, ChooseEffectDlgProc, (LPARAM) es ) == IDOK );
+ return (DialogBoxParam(hMirandaInst, MAKEINTRESOURCE(IDD_CHOOSE_FONT_EFFECT), hwndParent, ChooseEffectDlgProc, (LPARAM) es) == IDOK);
}
static void sttSaveFontData(HWND hwndDlg, TFontID &F)
@@ -545,34 +545,34 @@ static void sttSaveFontData(HWND hwndDlg, TFontID &F)
LOGFONT lf;
char str[128];
- if ( F.flags & FIDF_APPENDNAME )
+ if (F.flags & FIDF_APPENDNAME)
mir_snprintf(str, SIZEOF(str), "%sName", F.prefix);
else
mir_snprintf(str, SIZEOF(str), "%s", F.prefix);
- if ( DBWriteContactSettingTString( NULL, F.dbSettingsGroup, str, F.value.szFace )) {
+ if (DBWriteContactSettingTString(NULL, F.dbSettingsGroup, str, F.value.szFace)) {
char buff[1024];
WideCharToMultiByte(code_page, 0, F.value.szFace, -1, buff, 1024, 0, 0);
DBWriteContactSettingString(NULL, F.dbSettingsGroup, str, buff);
}
mir_snprintf(str, SIZEOF(str), "%sSize", F.prefix);
- if ( F.flags & FIDF_SAVEACTUALHEIGHT ) {
+ if (F.flags & FIDF_SAVEACTUALHEIGHT) {
HDC hdc;
SIZE size;
HFONT hFont, hOldFont;
- CreateFromFontSettings( &F.value, &lf );
- hFont = CreateFontIndirect( &lf );
+ CreateFromFontSettings(&F.value, &lf);
+ hFont = CreateFontIndirect(&lf);
hdc = GetDC(hwndDlg);
- hOldFont = (HFONT)SelectObject( hdc, hFont );
- GetTextExtentPoint32( hdc, _T("_W"), 2, &size);
+ hOldFont = (HFONT)SelectObject(hdc, hFont);
+ GetTextExtentPoint32(hdc, _T("_W"), 2, &size);
ReleaseDC(hwndDlg, hdc);
SelectObject(hdc, hOldFont);
DeleteObject(hFont);
DBWriteContactSettingByte(NULL, F.dbSettingsGroup, str, (char)size.cy);
}
- else if ( F.flags & FIDF_SAVEPOINTSIZE ) {
+ else if (F.flags & FIDF_SAVEPOINTSIZE) {
HDC hdc = GetDC(hwndDlg);
DBWriteContactSettingByte(NULL, F.dbSettingsGroup, str, (BYTE)-MulDiv(F.value.size, 72, GetDeviceCaps(hdc, LOGPIXELSY)));
ReleaseDC(hwndDlg, hdc);
@@ -585,7 +585,7 @@ static void sttSaveFontData(HWND hwndDlg, TFontID &F)
DBWriteContactSettingByte(NULL, F.dbSettingsGroup, str, F.value.charset);
mir_snprintf(str, SIZEOF(str), "%sCol", F.prefix);
DBWriteContactSettingDword(NULL, F.dbSettingsGroup, str, F.value.colour);
- if ( F.flags & FIDF_NOAS ) {
+ if (F.flags & FIDF_NOAS) {
mir_snprintf(str, SIZEOF(str), "%sAs", F.prefix);
DBWriteContactSettingWord(NULL, F.dbSettingsGroup, str, (WORD)0x00FF);
}
@@ -613,26 +613,26 @@ 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++) {
TFontID& F = font_id_list_w2[i];
// sync settings with database
- UpdateFontSettings( &F, &F.value );
+ UpdateFontSettings(&F, &F.value);
sttFsuiCreateSettingsTreeNode(GetDlgItem(hwndDlg, IDC_FONTGROUP), F.group);
}
- for ( i = 0; i < colour_id_list_w2.getCount(); i++ ) {
+ for (i = 0; i < colour_id_list_w2.getCount(); i++) {
TColourID& C = colour_id_list_w2[i];
// sync settings with database
- UpdateColourSettings( &C, &C.value );
+ UpdateColourSettings(&C, &C.value);
sttFsuiCreateSettingsTreeNode(GetDlgItem(hwndDlg, IDC_FONTGROUP), C.group);
}
- for ( i = 0; i < effect_id_list_w2.getCount(); i++ ) {
+ for (i = 0; i < effect_id_list_w2.getCount(); i++) {
TEffectID& E = effect_id_list_w2[i];
// sync settings with database
- UpdateEffectSettings( &E, &E.value );
+ UpdateEffectSettings(&E, &E.value);
sttFsuiCreateSettingsTreeNode(GetDlgItem(hwndDlg, IDC_FONTGROUP), E.group);
}
}
@@ -665,37 +665,37 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam,
SendDlgItemMessage(hwndDlg, IDC_FONTLIST, WM_SETREDRAW, FALSE, 0);
- for ( fontId = 0; fontId < font_id_list_w2.getCount(); fontId++ ) {
+ for (fontId = 0; fontId < font_id_list_w2.getCount(); fontId++) {
TFontID& F = font_id_list_w2[fontId];
- if ( _tcsncmp( F.group, group_buff, 64 ) == 0 ) {
- FSUIListItemData *itemData = ( FSUIListItemData* )mir_alloc(sizeof(FSUIListItemData));
+ if (_tcsncmp(F.group, group_buff, 64) == 0) {
+ FSUIListItemData *itemData = (FSUIListItemData*)mir_alloc(sizeof(FSUIListItemData));
itemData->colour_id = -1;
itemData->effect_id = -1;
itemData->font_id = fontId;
- if ( first_font_index == -1 )
+ if (first_font_index == -1)
first_font_index = fontId;
itemId = SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_ADDSTRING, (WPARAM)-1, (LPARAM)itemData);
need_restart |= (F.flags & FIDF_NEEDRESTART);
} }
-// ShowWindow( GetDlgItem(hwndDlg, IDC_STAT_RESTART), (need_restart ? SW_SHOW : SW_HIDE));
+// ShowWindow(GetDlgItem(hwndDlg, IDC_STAT_RESTART), (need_restart ? SW_SHOW : SW_HIDE));
- if ( hBkgColourBrush ) {
- DeleteObject( hBkgColourBrush );
+ if (hBkgColourBrush) {
+ DeleteObject(hBkgColourBrush);
hBkgColourBrush = 0;
}
- for ( colourId = 0; colourId < colour_id_list_w2.getCount(); colourId++ ) {
+ for (colourId = 0; colourId < colour_id_list_w2.getCount(); colourId++) {
TColourID& C = colour_id_list_w2[colourId];
- if ( _tcsncmp( C.group, group_buff, 64 ) == 0 ) {
+ if (_tcsncmp(C.group, group_buff, 64) == 0) {
FSUIListItemData *itemData = NULL;
- if ( first_colour_index == -1 )
+ if (first_colour_index == -1)
first_colour_index = colourId;
- if (!sttFsuiBindColourIdToFonts(GetDlgItem(hwndDlg, IDC_FONTLIST), C.name, C.group, C.name, colourId)) {
- itemData = ( FSUIListItemData* )mir_alloc(sizeof(FSUIListItemData));
+ if ( !sttFsuiBindColourIdToFonts(GetDlgItem(hwndDlg, IDC_FONTLIST), C.name, C.group, C.name, colourId)) {
+ itemData = (FSUIListItemData*)mir_alloc(sizeof(FSUIListItemData));
itemData->colour_id = colourId;
itemData->font_id = -1;
itemData->effect_id = -1;
@@ -703,22 +703,22 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam,
itemId = SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_ADDSTRING, (WPARAM)-1, (LPARAM)itemData);
}
- if ( _tcscmp( C.name, _T("Background") ) == 0 )
- hBkgColourBrush = CreateSolidBrush( C.value );
+ if (_tcscmp(C.name, _T("Background")) == 0)
+ hBkgColourBrush = CreateSolidBrush(C.value);
} }
- if ( !hBkgColourBrush )
+ if ( !hBkgColourBrush)
hBkgColourBrush = CreateSolidBrush(GetSysColor(COLOR_WINDOW));
- for ( effectId = 0; effectId < effect_id_list_w2.getCount(); effectId++ ) {
+ for (effectId = 0; effectId < effect_id_list_w2.getCount(); effectId++) {
TEffectID& E = effect_id_list_w2[effectId];
- if ( _tcsncmp( E.group, group_buff, 64 ) == 0 ) {
+ if (_tcsncmp(E.group, group_buff, 64) == 0) {
FSUIListItemData *itemData = NULL;
- if ( first_effect_index == -1 )
+ if (first_effect_index == -1)
first_effect_index = effectId;
- if (!sttFsuiBindEffectIdToFonts(GetDlgItem(hwndDlg, IDC_FONTLIST), E.name, effectId)) {
- itemData = ( FSUIListItemData* )mir_alloc(sizeof(FSUIListItemData));
+ if ( !sttFsuiBindEffectIdToFonts(GetDlgItem(hwndDlg, IDC_FONTLIST), E.name, effectId)) {
+ itemData = (FSUIListItemData*)mir_alloc(sizeof(FSUIListItemData));
itemData->effect_id = effectId;
itemData->font_id = -1;
itemData->colour_id = -1;
@@ -755,24 +755,24 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam,
if ((mis->CtlID != IDC_FONTLIST) || (mis->itemID == -1))
break;
- if (!itemData) return FALSE;
+ if ( !itemData) return FALSE;
if (itemData->font_id >= 0) {
int iItem = itemData->font_id;
bIsFont = TRUE;
- CreateFromFontSettings( &font_id_list_w2[iItem].value, &lf );
+ CreateFromFontSettings(&font_id_list_w2[iItem].value, &lf);
hFont = CreateFontIndirect(&lf);
itemName = TranslateTS(font_id_list_w2[iItem].name);
}
if (itemData->colour_id >= 0) {
int iItem = itemData->colour_id;
- if ( !itemName )
- itemName = TranslateTS( colour_id_list_w2[iItem].name );
+ if ( !itemName)
+ itemName = TranslateTS(colour_id_list_w2[iItem].name);
}
hdc = GetDC(GetDlgItem(hwndDlg, mis->CtlID));
- if ( hFont )
+ if (hFont)
hoFont = (HFONT) SelectObject(hdc, hFont);
else
hoFont = (HFONT) SelectObject(hdc, (HFONT)SendDlgItemMessage(hwndDlg, mis->CtlID, WM_GETFONT, 0, 0));
@@ -803,18 +803,18 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam,
if (dis->CtlID != IDC_FONTLIST)
break;
- if (!itemData) return FALSE;
+ if ( !itemData) return FALSE;
- if ( itemData->font_id >= 0 ) {
+ if (itemData->font_id >= 0) {
int iItem = itemData->font_id;
bIsFont = TRUE;
- CreateFromFontSettings(&font_id_list_w2[iItem].value, &lf );
+ CreateFromFontSettings(&font_id_list_w2[iItem].value, &lf);
hFont = CreateFontIndirect(&lf);
itemName = TranslateTS(font_id_list_w2[iItem].name);
clText = font_id_list_w2[iItem].value.colour;
}
- if ( itemData->colour_id >= 0 ) {
+ if (itemData->colour_id >= 0) {
int iItem = itemData->colour_id;
if (bIsFont)
clBack = colour_id_list_w2[iItem].value;
@@ -824,7 +824,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam,
} }
- if ( itemData->effect_id >= 0 ) {
+ if (itemData->effect_id >= 0) {
int iItem = itemData->effect_id;
Effect.effectIndex = effect_id_list_w2[iItem].value.effectIndex;
@@ -832,7 +832,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam,
Effect.secondaryColour = effect_id_list_w2[iItem].value.secondaryColour;
pEffect = &Effect;
- if (!bIsFont)
+ if ( !bIsFont)
itemName = TranslateTS(effect_id_list_w2[iItem].name);
}
@@ -857,7 +857,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam,
else FillRect(dis->hDC, &dis->rcItem, bIsFont ? hBkgColourBrush : GetSysColorBrush(COLOR_WINDOW));
}
- if ( bIsFont ) {
+ if (bIsFont) {
HBRUSH hbrBack;
RECT rc;
@@ -887,7 +887,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam,
SetTextColor(dis->hDC, clText);
- DrawTextWithEffect(dis->hDC, _T("abc"), 3, &rc, DT_CENTER|DT_NOPREFIX|DT_SINGLELINE|DT_VCENTER|DT_WORD_ELLIPSIS, pEffect );
+ DrawTextWithEffect(dis->hDC, _T("abc"), 3, &rc, DT_CENTER|DT_NOPREFIX|DT_SINGLELINE|DT_VCENTER|DT_WORD_ELLIPSIS, pEffect);
if (dis->itemState & ODS_SELECTED) {
SetTextColor(dis->hDC, GetSysColor(COLOR_HIGHLIGHTTEXT));
@@ -895,7 +895,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam,
}
rc = dis->rcItem;
rc.left += FSUI_FONTLEFT;
- DrawTextWithEffect(dis->hDC, itemName, (int)_tcslen(itemName), &rc, DT_LEFT|DT_NOPREFIX|DT_SINGLELINE|DT_VCENTER|DT_WORD_ELLIPSIS, pEffect );
+ DrawTextWithEffect(dis->hDC, itemName, (int)_tcslen(itemName), &rc, DT_LEFT|DT_NOPREFIX|DT_SINGLELINE|DT_VCENTER|DT_WORD_ELLIPSIS, pEffect);
} else
{
RECT rc;
@@ -920,7 +920,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam,
rc = dis->rcItem;
rc.left += FSUI_FONTLEFT;
- DrawTextWithEffect(dis->hDC, itemName, (int)_tcslen(itemName), &rc, DT_LEFT|DT_NOPREFIX|DT_SINGLELINE|DT_VCENTER|DT_WORD_ELLIPSIS, pEffect );
+ DrawTextWithEffect(dis->hDC, itemName, (int)_tcslen(itemName), &rc, DT_LEFT|DT_NOPREFIX|DT_SINGLELINE|DT_VCENTER|DT_WORD_ELLIPSIS, pEffect);
}
if (hoFont) SelectObject(dis->hDC, hoFont);
if (hFont) DeleteObject(hFont);
@@ -955,7 +955,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam,
bEnableEffect = 0;
if (bEnableFont && (itemData->font_id < 0))
bEnableFont = 0;
- if (!bEnableFont || bEnableClText && (itemData->font_id < 0))
+ if ( !bEnableFont || bEnableClText && (itemData->font_id < 0))
bEnableClText = 0;
if (bEnableReset && (itemData->font_id >= 0) && !(font_id_list_w2[itemData->font_id].flags&FIDF_DEFAULTVALID))
bEnableReset = 0;
@@ -976,7 +976,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam,
}
EnableWindow(GetDlgItem(hwndDlg, IDC_BKGCOLOUR), bEnableClBack);
- ShowEffectButton( hwndDlg, bEnableEffect && !bEnableClBack );
+ ShowEffectButton(hwndDlg, bEnableEffect && !bEnableClBack);
EnableWindow(GetDlgItem(hwndDlg, IDC_FONTCOLOUR), bEnableClText);
EnableWindow(GetDlgItem(hwndDlg, IDC_CHOOSEFONT), bEnableFont);
@@ -1012,14 +1012,14 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam,
TFontID& F = font_id_list_w2[itemData->font_id];
- CreateFromFontSettings(&F.value, &lf );
+ CreateFromFontSettings(&F.value, &lf);
cf.lStructSize = sizeof(cf);
cf.hwndOwner = hwndDlg;
cf.lpLogFont = &lf;
cf.lCustData = 0;
- if ( F.flags & FIDF_ALLOWEFFECTS )
+ if (F.flags & FIDF_ALLOWEFFECTS)
{
cf.Flags = CF_FORCEFONTEXIST | CF_INITTOLOGFONTSTRUCT | CF_SCREENFONTS | CF_EFFECTS | CF_ENABLETEMPLATE | CF_ENABLEHOOK;
// use custom font dialog to disable colour selection
@@ -1027,7 +1027,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam,
cf.lpTemplateName = MAKEINTRESOURCE(IDD_CUSTOM_FONT);
cf.lpfnHook = CFHookProc;
}
- else if ( F.flags & FIDF_DISABLESTYLES ) { // no style selection, mutually exclusive with FIDF_ALLOWEFFECTS
+ else if (F.flags & FIDF_DISABLESTYLES) { // no style selection, mutually exclusive with FIDF_ALLOWEFFECTS
cf.Flags = CF_FORCEFONTEXIST | CF_INITTOLOGFONTSTRUCT | CF_SCREENFONTS | CF_ENABLETEMPLATE | CF_ENABLEHOOK | CF_TTONLY | CF_NOOEMFONTS;
cf.lCustData = F.flags;
cf.hInstance = hMirandaInst;
@@ -1078,7 +1078,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam,
itemData = (FSUIListItemData *)SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETITEMDATA, selItems[0], 0);
TEffectID& E = effect_id_list_w2[itemData->effect_id];
es = E.value;
- if ( ChooseEffectDialog(hwndDlg, &es) ) {
+ if (ChooseEffectDialog(hwndDlg, &es)) {
for (i = 0; i < selCount; ++i) {
FSUIListItemData *itemData = (FSUIListItemData *)SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETITEMDATA, selItems[i], 0);
if (itemData->effect_id < 0)
@@ -1124,10 +1124,10 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam,
if (itemData->colour_id < 0) continue;
colour_id_list_w2[itemData->colour_id].value = SendDlgItemMessage(hwndDlg, IDC_BKGCOLOUR, CPM_GETCOLOUR, 0, 0);
- if ( _tcscmp( colour_id_list_w2[itemData->colour_id].name, _T("Background") ) == 0 )
+ if (_tcscmp(colour_id_list_w2[itemData->colour_id].name, _T("Background")) == 0)
{
- if ( hBkgColourBrush ) DeleteObject( hBkgColourBrush );
- hBkgColourBrush = CreateSolidBrush( colour_id_list_w2[itemData->colour_id].value );
+ if (hBkgColourBrush) DeleteObject(hBkgColourBrush);
+ hBkgColourBrush = CreateSolidBrush(colour_id_list_w2[itemData->colour_id].value);
}
}
mir_free(selItems);
@@ -1188,8 +1188,8 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam,
ofn.lpstrDefExt = _T("ini");
- if ( GetSaveFileName( &ofn ) == TRUE )
- if ( !ExportSettings( hwndDlg, ofn.lpstrFile, font_id_list, colour_id_list, effect_id_list ))
+ if (GetSaveFileName(&ofn) == TRUE)
+ if ( !ExportSettings(hwndDlg, ofn.lpstrFile, font_id_list, colour_id_list, effect_id_list))
MessageBox(hwndDlg, TranslateT("Error writing file"), TranslateT("Error"), MB_ICONWARNING | MB_OK);
return TRUE;
}
@@ -1207,32 +1207,32 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam,
break;
case WM_NOTIFY:
- if (((LPNMHDR) lParam)->idFrom == 0 && ((LPNMHDR) lParam)->code == PSN_APPLY ) {
+ if (((LPNMHDR) lParam)->idFrom == 0 && ((LPNMHDR) lParam)->code == PSN_APPLY) {
char str[32];
font_id_list_w3 = font_id_list;
colour_id_list_w3 = colour_id_list;
effect_id_list_w3 = effect_id_list;
- EnableWindow( GetDlgItem(hwndDlg, IDC_BTN_UNDO), TRUE );
+ EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_UNDO), TRUE);
font_id_list = font_id_list_w2;
colour_id_list = colour_id_list_w2;
effect_id_list = effect_id_list_w2;
- for ( i=0; i < font_id_list_w2.getCount(); i++ ) {
+ for (i=0; i < font_id_list_w2.getCount(); i++) {
TFontID& F = font_id_list_w2[i];
sttSaveFontData(hwndDlg, F);
}
- for ( i=0; i < colour_id_list_w2.getCount(); i++ ) {
+ for (i=0; i < colour_id_list_w2.getCount(); i++) {
TColourID& C = colour_id_list_w2[i];
mir_snprintf(str, SIZEOF(str), "%s", C.setting);
DBWriteContactSettingDword(NULL, C.dbSettingsGroup, str, C.value);
}
- for ( i=0; i < effect_id_list_w2.getCount(); i++ ) {
+ for (i=0; i < effect_id_list_w2.getCount(); i++) {
TEffectID& E = effect_id_list_w2[i];
mir_snprintf(str, SIZEOF(str), "%sEffect", E.setting);
@@ -1290,18 +1290,15 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam,
int OptInit(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = {0};
-
- odp.cbSize = sizeof(odp);
- odp.cbSize = OPTIONPAGE_OLD_SIZE2;
- odp.position = -790000000;
- odp.hInstance = hMirandaInst;;
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_FONTS);
- odp.pszTitle = LPGEN("Fonts & Colors");
- odp.pszGroup = LPGEN("Customize");
- odp.flags = ODPF_BOLDGROUPS;
- odp.nIDBottomSimpleControl = 0;
- odp.pfnDlgProc = DlgProcLogOptions;
- CallService( MS_OPT_ADDPAGE, wParam, ( LPARAM )&odp );
+ odp.cbSize = sizeof(odp);
+ odp.position = -790000000;
+ odp.hInstance = hMirandaInst;;
+ odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_FONTS);
+ odp.pszTitle = LPGEN("Fonts & Colors");
+ odp.pszGroup = LPGEN("Customize");
+ odp.flags = ODPF_BOLDGROUPS;
+ odp.pfnDlgProc = DlgProcLogOptions;
+ Options_AddPage(wParam, &odp);
return 0;
}
@@ -1309,10 +1306,10 @@ int OptInit(WPARAM wParam, LPARAM)
static TFontID *sttFindFont(OBJLIST<TFontID> &fonts, char *module, char *prefix)
{
- for ( int i = 0; i < fonts.getCount(); i++ )
+ for (int i = 0; i < fonts.getCount(); i++)
{
TFontID& F = fonts[i];
- if ( !lstrcmpA(F.dbSettingsGroup, module) && !lstrcmpA(F.prefix, prefix) )
+ if ( !lstrcmpA(F.dbSettingsGroup, module) && !lstrcmpA(F.prefix, prefix))
return &F;
}
@@ -1358,7 +1355,7 @@ static INT_PTR CALLBACK DlgProcModernOptions(HWND hwndDlg, UINT msg, WPARAM wPar
break;
}
- if (!pf) break;
+ if ( !pf) break;
HFONT hFont = NULL, hoFont = NULL;
COLORREF clText = GetSysColor(COLOR_WINDOWTEXT);
@@ -1400,7 +1397,7 @@ static INT_PTR CALLBACK DlgProcModernOptions(HWND hwndDlg, UINT msg, WPARAM wPar
cf.hwndOwner = hwndDlg;
cf.lpLogFont = &lf;
cf.Flags = CF_FORCEFONTEXIST | CF_INITTOLOGFONTSTRUCT | CF_SCREENFONTS;
- if ( pf->flags & FIDF_ALLOWEFFECTS )
+ if (pf->flags & FIDF_ALLOWEFFECTS)
{
cf.Flags |= CF_EFFECTS | CF_ENABLETEMPLATE | CF_ENABLEHOOK;
// use custom font dialog to disable colour selection
@@ -1427,18 +1424,18 @@ static INT_PTR CALLBACK DlgProcModernOptions(HWND hwndDlg, UINT msg, WPARAM wPar
break;
case WM_NOTIFY:
- if (((LPNMHDR) lParam)->idFrom == 0 && ((LPNMHDR) lParam)->code == PSN_APPLY ) {
- for ( i=0; i < font_id_list.getCount(); i++ )
+ if (((LPNMHDR) lParam)->idFrom == 0 && ((LPNMHDR) lParam)->code == PSN_APPLY) {
+ for (i=0; i < font_id_list.getCount(); i++)
{
TFontID &F = font_id_list[i];
if (F.deffontsettings.charset == SYMBOL_CHARSET) continue;
COLORREF cl = F.value.colour;
- if ((F.flags&FIDF_CLASSMASK) == FIDF_CLASSHEADER ||
+ if ((F.flags&FIDF_CLASSMASK) == FIDF_CLASSHEADER ||
(F.flags&FIDF_CLASSMASK) == 0 &&
- (_tcsstr(F.name, _T("Incoming nick")) ||
- _tcsstr(F.name, _T("Outgoing nick")) ||
- _tcsstr(F.name, _T("Incoming timestamp")) ||
+ (_tcsstr(F.name, _T("Incoming nick")) ||
+ _tcsstr(F.name, _T("Outgoing nick")) ||
+ _tcsstr(F.name, _T("Incoming timestamp")) ||
_tcsstr(F.name, _T("Outgoing timestamp")))
)
{
diff --git a/src/modules/fonts/FontService.cpp b/src/modules/fonts/FontService.cpp
index 050661aefb..832d8ae610 100644
--- a/src/modules/fonts/FontService.cpp
+++ b/src/modules/fonts/FontService.cpp
@@ -29,7 +29,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
int code_page = CP_ACP;
HANDLE hFontReloadEvent, hColourReloadEvent;
-int OptInit( WPARAM, LPARAM );
+int OptInit(WPARAM, LPARAM);
int FontsModernOptInit(WPARAM wParam, LPARAM lParam);
INT_PTR RegisterFont(WPARAM wParam, LPARAM lParam);
@@ -67,7 +67,7 @@ static int OnPreShutdown(WPARAM, LPARAM)
return 0;
}
-int LoadFontserviceModule( void )
+int LoadFontserviceModule(void)
{
code_page = LangPackGetDefaultCodePage();
@@ -103,19 +103,19 @@ int LoadFontserviceModule( void )
fontid.flags = FIDF_APPENDNAME | FIDF_NOAS | FIDF_SAVEPOINTSIZE | FIDF_ALLOWEFFECTS | FIDF_CLASSHEADER;
strncpy(fontid.prefix, "Header", SIZEOF(fontid.prefix));
fontid.order = 0;
- FontRegisterT( &fontid );
+ FontRegisterT(&fontid);
_tcsncpy(fontid.name, _T("Generic text"), SIZEOF(fontid.name));
fontid.flags = FIDF_APPENDNAME | FIDF_NOAS | FIDF_SAVEPOINTSIZE | FIDF_ALLOWEFFECTS | FIDF_CLASSGENERAL;
strncpy(fontid.prefix, "Generic", SIZEOF(fontid.prefix));
fontid.order = 0;
- FontRegisterT( &fontid );
+ FontRegisterT(&fontid);
_tcsncpy(fontid.name, _T("Small text"), SIZEOF(fontid.name));
fontid.flags = FIDF_APPENDNAME | FIDF_NOAS | FIDF_SAVEPOINTSIZE | FIDF_ALLOWEFFECTS | FIDF_CLASSSMALL;
strncpy(fontid.prefix, "Small", SIZEOF(fontid.prefix));
fontid.order = 0;
- FontRegisterT( &fontid );
+ FontRegisterT(&fontid);
// do last for silly dyna plugin
HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded);
diff --git a/src/modules/fonts/FontService.h b/src/modules/fonts/FontService.h
index 5d9a3f10a2..92e62ba9df 100644
--- a/src/modules/fonts/FontService.h
+++ b/src/modules/fonts/FontService.h
@@ -109,4 +109,4 @@ extern OBJLIST<TEffectID> effect_id_list;
extern int code_page;
extern HANDLE hFontReloadEvent, hColourReloadEvent;
-int CreateFromFontSettings(TFontSettings *fs, LOGFONT *lf );
+int CreateFromFontSettings(TFontSettings *fs, LOGFONT *lf);
diff --git a/src/modules/fonts/services.cpp b/src/modules/fonts/services.cpp
index b19fd59144..3e69a5fe9f 100644
--- a/src/modules/fonts/services.cpp
+++ b/src/modules/fonts/services.cpp
@@ -27,17 +27,17 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
COLORREF GetColorFromDefault(COLORREF cl);
-void ConvertFontSettings( FontSettings* fs, TFontSettings* fsw)
+void ConvertFontSettings(FontSettings* fs, TFontSettings* fsw)
{
fsw->colour = fs->colour;
fsw->size = fs->size;
fsw->style = fs->style;
fsw->charset = fs->charset;
- MultiByteToWideChar( code_page, 0, fs->szFace, -1, fsw->szFace, LF_FACESIZE);
+ MultiByteToWideChar(code_page, 0, fs->szFace, -1, fsw->szFace, LF_FACESIZE);
}
-void ConvertFontID( FontID *fid, TFontID* fidw )
+void ConvertFontID(FontID *fid, TFontID* fidw)
{
memset(fidw, 0, sizeof(TFontID));
fidw->cbSize = sizeof(TFontID);
@@ -47,11 +47,11 @@ void ConvertFontID( FontID *fid, TFontID* fidw )
fidw->order = fid->order;
ConvertFontSettings(&fid->deffontsettings, &fidw->deffontsettings);
- MultiByteToWideChar( code_page, 0, fid->group, -1, fidw->group, 64);
- MultiByteToWideChar( code_page, 0, fid->name, -1, fidw->name, 64);
+ MultiByteToWideChar(code_page, 0, fid->group, -1, fidw->group, 64);
+ MultiByteToWideChar(code_page, 0, fid->name, -1, fidw->name, 64);
if (fid->cbSize >= FontID_SIZEOF_V2A) {
- MultiByteToWideChar( code_page, 0, fid->backgroundGroup, -1, fidw->backgroundGroup, 64);
- MultiByteToWideChar( code_page, 0, fid->backgroundName, -1, fidw->backgroundName, 64);
+ MultiByteToWideChar(code_page, 0, fid->backgroundGroup, -1, fidw->backgroundGroup, 64);
+ MultiByteToWideChar(code_page, 0, fid->backgroundName, -1, fidw->backgroundName, 64);
}
}
@@ -65,8 +65,8 @@ void ConvertColourID(ColourID *cid, TColourID* cidw)
cidw->defcolour = cid->defcolour;
cidw->order = cid->order;
- MultiByteToWideChar( code_page, 0, cid->group, -1, cidw->group, 64);
- MultiByteToWideChar( code_page, 0, cid->name, -1, cidw->name, 64);
+ MultiByteToWideChar(code_page, 0, cid->group, -1, cidw->group, 64);
+ MultiByteToWideChar(code_page, 0, cid->name, -1, cidw->name, 64);
}
void ConvertEffectID(EffectID *eid, TEffectID* eidw)
@@ -81,8 +81,8 @@ void ConvertEffectID(EffectID *eid, TEffectID* eidw)
eidw->defeffect.secondaryColour = eid->defeffect.secondaryColour;
eidw->order = eid->order;
- MultiByteToWideChar( code_page, 0, eid->group, -1, eidw->group, 64);
- MultiByteToWideChar( code_page, 0, eid->name, -1, eidw->name, 64);
+ MultiByteToWideChar(code_page, 0, eid->group, -1, eidw->group, 64);
+ MultiByteToWideChar(code_page, 0, eid->name, -1, eidw->name, 64);
}
@@ -102,13 +102,13 @@ void ConvertLOGFONT(LOGFONTW *lfw, LOGFONTA *lfa)
lfa->lfQuality = lfw->lfQuality;
lfa->lfPitchAndFamily = lfw->lfPitchAndFamily;
- WideCharToMultiByte( code_page, 0, lfw->lfFaceName, -1, lfa->lfFaceName, LF_FACESIZE, 0, 0);
+ WideCharToMultiByte(code_page, 0, lfw->lfFaceName, -1, lfa->lfFaceName, LF_FACESIZE, 0, 0);
}
static void GetDefaultFontSetting(LOGFONT* lf, COLORREF* colour)
{
SystemParametersInfo(SPI_GETICONTITLELOGFONT, sizeof(LOGFONT), lf, FALSE);
- if ( colour )
+ if (colour)
*colour = GetSysColor(COLOR_WINDOWTEXT);
lf->lfHeight = 10;
@@ -130,7 +130,7 @@ int GetFontSettingFromDB(char *settings_group, char *prefix, LOGFONT* lf, COLORR
if (flags & FIDF_APPENDNAME) mir_snprintf(idstr, SIZEOF(idstr), "%sName", prefix);
else mir_snprintf(idstr, SIZEOF(idstr), "%s", prefix);
- if ( !DBGetContactSettingTString(NULL, settings_group, idstr, &dbv )) {
+ if ( !DBGetContactSettingTString(NULL, settings_group, idstr, &dbv)) {
_tcscpy(lf->lfFaceName, dbv.ptszVal);
DBFreeVariant(&dbv);
}
@@ -193,7 +193,7 @@ int GetFontSettingFromDB(char *settings_group, char *prefix, LOGFONT* lf, COLORR
return retval;
}
-int CreateFromFontSettings(TFontSettings* fs, LOGFONT* lf )
+int CreateFromFontSettings(TFontSettings* fs, LOGFONT* lf)
{
GetDefaultFontSetting(lf, 0);
@@ -218,8 +218,8 @@ void UpdateFontSettings(TFontID* font_id, TFontSettings* fontsettings)
{
LOGFONT lf;
COLORREF colour;
- if ( GetFontSettingFromDB(font_id->dbSettingsGroup, font_id->prefix, &lf, &colour, font_id->flags) && (font_id->flags & FIDF_DEFAULTVALID)) {
- CreateFromFontSettings(&font_id->deffontsettings, &lf );
+ if (GetFontSettingFromDB(font_id->dbSettingsGroup, font_id->prefix, &lf, &colour, font_id->flags) && (font_id->flags & FIDF_DEFAULTVALID)) {
+ CreateFromFontSettings(&font_id->deffontsettings, &lf);
colour = GetColorFromDefault(font_id->deffontsettings.colour);
}
@@ -269,11 +269,11 @@ COLORREF GetColorFromDefault(COLORREF cl)
/////////////////////////////////////////////////////////////////////////////////////////
// RegisterFont service
-static int sttRegisterFontWorker( TFontID* font_id )
+static int sttRegisterFontWorker(TFontID* font_id)
{
- for ( int i = 0; i < font_id_list.getCount(); i++ ) {
+ for (int i = 0; i < font_id_list.getCount(); i++) {
TFontID& F = font_id_list[i];
- if ( !lstrcmp( F.group, font_id->group ) && !lstrcmp( F.name, font_id->name ) && !( F.flags & FIDF_ALLOWREREGISTER ))
+ if ( !lstrcmp(F.group, font_id->group) && !lstrcmp(F.name, font_id->name) && !(F.flags & FIDF_ALLOWREREGISTER))
return 1;
}
@@ -282,61 +282,61 @@ static int sttRegisterFontWorker( TFontID* font_id )
DBWriteContactSettingDword(0, font_id->dbSettingsGroup, idstr, font_id->flags);
{
TFontID* newItem = new TFontID;
- memset( newItem, 0, sizeof( TFontID ));
- memcpy( newItem, font_id, font_id->cbSize);
+ memset(newItem, 0, sizeof(TFontID));
+ memcpy(newItem, font_id, font_id->cbSize);
- if (!lstrcmp(newItem->deffontsettings.szFace, _T("MS Shell Dlg")))
+ if ( !lstrcmp(newItem->deffontsettings.szFace, _T("MS Shell Dlg")))
{
LOGFONT lf;
SystemParametersInfo(SPI_GETICONTITLELOGFONT, sizeof(LOGFONT), &lf, FALSE);
lstrcpyn(newItem->deffontsettings.szFace, lf.lfFaceName, SIZEOF(newItem->deffontsettings.szFace));
- if (!newItem->deffontsettings.size)
+ if ( !newItem->deffontsettings.size)
newItem->deffontsettings.size = lf.lfHeight;
}
- UpdateFontSettings( font_id, &newItem->value );
- font_id_list.insert( newItem );
+ UpdateFontSettings(font_id, &newItem->value);
+ font_id_list.insert(newItem);
}
return 0;
}
-INT_PTR RegisterFontW(WPARAM wParam, LPARAM )
+INT_PTR RegisterFontW(WPARAM wParam, LPARAM)
{
- return sttRegisterFontWorker(( TFontID* )wParam );
+ return sttRegisterFontWorker((TFontID*)wParam);
}
INT_PTR RegisterFont(WPARAM wParam, LPARAM)
{
TFontID temp;
- ConvertFontID(( FontID* )wParam, &temp );
- return sttRegisterFontWorker( &temp );
+ ConvertFontID((FontID*)wParam, &temp);
+ return sttRegisterFontWorker(&temp);
}
/////////////////////////////////////////////////////////////////////////////////////////
// GetFont service
-static int sttGetFontWorker( TFontID* font_id, LOGFONT* lf )
+static int sttGetFontWorker(TFontID* 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++) {
TFontID& 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 )) {
- CreateFromFontSettings( &F.deffontsettings, lf );
+ 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)) {
+ CreateFromFontSettings(&F.deffontsettings, lf);
colour = GetColorFromDefault(F.deffontsettings.colour);
}
return (int)colour;
} }
- GetDefaultFontSetting( lf, &colour );
+ GetDefaultFontSetting(lf, &colour);
return (int)colour;
}
INT_PTR GetFontW(WPARAM wParam, LPARAM lParam)
{
- return sttGetFontWorker(( TFontID* )wParam, ( LOGFONT* )lParam );
+ return sttGetFontWorker((TFontID*)wParam, (LOGFONT*)lParam);
}
INT_PTR GetFont(WPARAM wParam, LPARAM lParam)
@@ -344,8 +344,8 @@ INT_PTR GetFont(WPARAM wParam, LPARAM lParam)
TFontID temp;
LOGFONT lftemp;
ConvertFontID((FontID *)wParam, &temp);
- { int ret = sttGetFontWorker( &temp, &lftemp );
- ConvertLOGFONT( &lftemp, ( LOGFONTA* )lParam );
+ { int ret = sttGetFontWorker(&temp, &lftemp);
+ ConvertLOGFONT(&lftemp, (LOGFONTA*)lParam);
return ret;
}
}
@@ -353,48 +353,48 @@ INT_PTR GetFont(WPARAM wParam, LPARAM lParam)
/////////////////////////////////////////////////////////////////////////////////////////
// RegisterColour service
-void UpdateColourSettings( TColourID* colour_id, COLORREF *colour)
+void UpdateColourSettings(TColourID* colour_id, COLORREF *colour)
{
- *colour = ( COLORREF )DBGetContactSettingDword(NULL, colour_id->dbSettingsGroup, colour_id->setting, GetColorFromDefault(colour_id->defcolour) );
+ *colour = (COLORREF)DBGetContactSettingDword(NULL, colour_id->dbSettingsGroup, colour_id->setting, GetColorFromDefault(colour_id->defcolour));
}
-static int sttRegisterColourWorker( TColourID* colour_id )
+static int sttRegisterColourWorker(TColourID* colour_id)
{
- for ( int i = 0; i < colour_id_list.getCount(); i++ ) {
+ for (int i = 0; i < colour_id_list.getCount(); i++) {
TColourID& C = colour_id_list[i];
- if ( !_tcscmp( C.group, colour_id->group ) && !_tcscmp( C.name, colour_id->name ))
+ if ( !_tcscmp(C.group, colour_id->group) && !_tcscmp(C.name, colour_id->name))
return 1;
}
TColourID* newItem = new TColourID;
- memcpy( newItem, colour_id, sizeof( TColourID ));
- UpdateColourSettings( colour_id, &newItem->value );
- colour_id_list.insert( newItem );
+ memcpy(newItem, colour_id, sizeof(TColourID));
+ UpdateColourSettings(colour_id, &newItem->value);
+ colour_id_list.insert(newItem);
return 0;
}
INT_PTR RegisterColourW(WPARAM wParam, LPARAM)
{
- return sttRegisterColourWorker(( TColourID* )wParam );
+ return sttRegisterColourWorker((TColourID*)wParam);
}
INT_PTR RegisterColour(WPARAM wParam, LPARAM)
{
TColourID temp;
- ConvertColourID(( ColourID* )wParam, &temp );
- return sttRegisterColourWorker( &temp );
+ ConvertColourID((ColourID*)wParam, &temp);
+ return sttRegisterColourWorker(&temp);
}
/////////////////////////////////////////////////////////////////////////////////////////
// GetColour service
-static int sttGetColourWorker( TColourID* colour_id )
+static int sttGetColourWorker(TColourID* colour_id)
{
int i;
- for ( i = 0; i < colour_id_list.getCount(); i++ ) {
+ for (i = 0; i < colour_id_list.getCount(); i++) {
TColourID& C = colour_id_list[i];
- if ( !_tcscmp( C.group, colour_id->group ) && !_tcscmp( C.name, colour_id->name ))
+ if ( !_tcscmp(C.group, colour_id->group) && !_tcscmp(C.name, colour_id->name))
return (int)DBGetContactSettingDword(NULL, C.dbSettingsGroup, C.setting, GetColorFromDefault(C.defcolour));
}
@@ -403,14 +403,14 @@ static int sttGetColourWorker( TColourID* colour_id )
INT_PTR GetColourW(WPARAM wParam, LPARAM)
{
- return sttGetColourWorker(( TColourID* )wParam );
+ return sttGetColourWorker((TColourID*)wParam);
}
INT_PTR GetColour(WPARAM wParam, LPARAM)
{
TColourID temp;
- ConvertColourID(( ColourID* )wParam, &temp );
- return sttGetColourWorker( &temp );
+ ConvertColourID((ColourID*)wParam, &temp);
+ return sttGetColourWorker(&temp);
}
@@ -435,44 +435,44 @@ void UpdateEffectSettings(TEffectID* effect_id, TEffectSettings* effectsettings)
/////////////////////////////////////////////////////////////////////////////////////////
// RegisterFont service
-static int sttRegisterEffectWorker( TEffectID* effect_id )
+static int sttRegisterEffectWorker(TEffectID* effect_id)
{
- for ( int i = 0; i < effect_id_list.getCount(); i++ ) {
+ for (int i = 0; i < effect_id_list.getCount(); i++) {
TEffectID& E = effect_id_list[i];
- if ( !_tcscmp( E.group, effect_id->group ) && !_tcscmp( E.name, effect_id->name ))
+ if ( !_tcscmp(E.group, effect_id->group) && !_tcscmp(E.name, effect_id->name))
return 1;
}
TEffectID* newItem = new TEffectID;
- memcpy( newItem, effect_id, sizeof( TEffectID ));
- UpdateEffectSettings( effect_id, &newItem->value );
- effect_id_list.insert( newItem );
+ memcpy(newItem, effect_id, sizeof(TEffectID));
+ UpdateEffectSettings(effect_id, &newItem->value);
+ effect_id_list.insert(newItem);
return 0;
}
INT_PTR RegisterEffectW(WPARAM wParam, LPARAM lParam)
{
- return sttRegisterEffectWorker(( TEffectID* )wParam );
+ return sttRegisterEffectWorker((TEffectID*)wParam);
}
INT_PTR RegisterEffect(WPARAM wParam, LPARAM lParam)
{
TEffectID temp;
- ConvertEffectID(( EffectID* )wParam, &temp );
- return sttRegisterEffectWorker( &temp );
+ ConvertEffectID((EffectID*)wParam, &temp);
+ return sttRegisterEffectWorker(&temp);
}
/////////////////////////////////////////////////////////////////////////////////////////
// GetEffect service
-static int sttGetEffectWorker( TEffectID* effect_id, FONTEFFECT* effect )
+static int sttGetEffectWorker(TEffectID* effect_id, FONTEFFECT* effect)
{
- for ( int i = 0; i < effect_id_list.getCount(); i++ ) {
+ for (int i = 0; i < effect_id_list.getCount(); i++) {
TEffectID& E = effect_id_list[i];
- if ( !_tcsncmp( E.name, effect_id->name, SIZEOF(E.name)) && !_tcsncmp( E.group, effect_id->group, SIZEOF(E.group)))
+ if ( !_tcsncmp(E.name, effect_id->name, SIZEOF(E.name)) && !_tcsncmp(E.group, effect_id->group, SIZEOF(E.group)))
{
TEffectSettings temp;
- UpdateEffectSettings( effect_id, &temp );
+ UpdateEffectSettings(effect_id, &temp);
effect->effectIndex = temp.effectIndex;
effect->baseColour = temp.baseColour;
@@ -486,12 +486,12 @@ static int sttGetEffectWorker( TEffectID* effect_id, FONTEFFECT* effect )
INT_PTR GetEffectW(WPARAM wParam, LPARAM lParam)
{
- return sttGetEffectWorker(( TEffectID* )wParam, ( FONTEFFECT* )lParam );
+ return sttGetEffectWorker((TEffectID*)wParam, (FONTEFFECT*)lParam);
}
INT_PTR GetEffect(WPARAM wParam, LPARAM lParam)
{
TEffectID temp;
ConvertEffectID((EffectID *)wParam, &temp);
- return sttGetEffectWorker( &temp, ( FONTEFFECT* )lParam );
+ return sttGetEffectWorker(&temp, (FONTEFFECT*)lParam);
}