diff options
Diffstat (limited to 'plugins/Utils')
-rw-r--r-- | plugins/Utils/mir_dblists.cpp | 66 | ||||
-rw-r--r-- | plugins/Utils/mir_dblists.h | 18 | ||||
-rw-r--r-- | plugins/Utils/mir_options.cpp | 260 | ||||
-rw-r--r-- | plugins/Utils/mir_options.h | 6 | ||||
-rw-r--r-- | plugins/Utils/mir_smileys.cpp | 52 | ||||
-rw-r--r-- | plugins/Utils/mir_smileys.h | 6 |
6 files changed, 204 insertions, 204 deletions
diff --git a/plugins/Utils/mir_dblists.cpp b/plugins/Utils/mir_dblists.cpp index 83917d0c7c..eb2a46dd81 100644 --- a/plugins/Utils/mir_dblists.cpp +++ b/plugins/Utils/mir_dblists.cpp @@ -26,55 +26,55 @@ Boston, MA 02111-1307, USA. #include <m_system.h>
-void List_DestroyFreeContents( SortedList* p_list )
+void List_DestroyFreeContents(SortedList* p_list)
{
- if ( p_list == NULL )
+ if (p_list == NULL)
return;
- if ( p_list->items != NULL )
+ if (p_list->items != NULL)
{
int i;
- for ( i = 0 ; i < p_list->realCount ; i++ )
+ for (i = 0; i < p_list->realCount; i++)
{
- if ( p_list->items[i] != NULL )
+ if (p_list->items[i] != NULL)
{
- mir_free( p_list->items[i] );
+ mir_free(p_list->items[i]);
}
}
}
- List_Destroy( p_list );
+ List_Destroy(p_list);
}
-int List_Append( SortedList* p_list, void* p_value )
+int List_Append(SortedList* p_list, void* p_value)
{
- return List_Insert( p_list, p_value, p_list->realCount );
+ return List_Insert(p_list, p_value, p_list->realCount);
}
-int List_InsertOrdered( SortedList* p_list, void* p_value )
+int List_InsertOrdered(SortedList* p_list, void* p_value)
{
int index;
- List_GetIndex( p_list, p_value, &index );
- List_Insert( p_list, p_value, index );
+ List_GetIndex(p_list, p_value, &index);
+ List_Insert(p_list, p_value, index);
return index;
}
-int List_RemoveByValue( SortedList* p_list, void* p_value )
+int List_RemoveByValue(SortedList* p_list, void* p_value)
{
int ret = 0;
- if ( p_list->items != NULL )
+ if (p_list->items != NULL)
{
int i;
- for ( i = p_list->realCount - 1 ; i >= 0 ; i-- )
+ for (i = p_list->realCount - 1; i >= 0; i--)
{
- if ( p_list->items[ i ] == p_value )
- ret += List_Remove( p_list, i );
+ if (p_list->items[i] == p_value)
+ ret += List_Remove(p_list, i);
}
}
@@ -82,19 +82,19 @@ int List_RemoveByValue( SortedList* p_list, void* p_value ) }
-int List_RemoveByValueFreeContents( SortedList* p_list, void* p_value )
+int List_RemoveByValueFreeContents(SortedList* p_list, void* p_value)
{
int ret = 0;
- if ( p_list->items != NULL )
+ if (p_list->items != NULL)
{
int i;
- for ( i = p_list->realCount - 1 ; i >= 0 ; i-- )
+ for (i = p_list->realCount - 1; i >= 0; i--)
{
- if ( p_list->items[ i ] == p_value )
+ if (p_list->items[i] == p_value)
{
- mir_free( p_list->items[ i ] );
- ret += List_Remove( p_list, i );
+ mir_free(p_list->items[i]);
+ ret += List_Remove(p_list, i);
}
}
}
@@ -103,36 +103,36 @@ int List_RemoveByValueFreeContents( SortedList* p_list, void* p_value ) }
-void List_Push( SortedList* p_list, void* p_value )
+void List_Push(SortedList* p_list, void* p_value)
{
- List_Insert( p_list, p_value, p_list->realCount );
+ List_Insert(p_list, p_value, p_list->realCount);
}
-void* List_Pop( SortedList* p_list )
+void* List_Pop(SortedList* p_list)
{
void *ret;
- if ( p_list->realCount <= 0 )
+ if (p_list->realCount <= 0)
return NULL;
- ret = p_list->items[ p_list->realCount - 1 ];
- List_Remove( p_list, p_list->realCount - 1 );
+ ret = p_list->items[p_list->realCount - 1];
+ List_Remove(p_list, p_list->realCount - 1);
return ret;
}
-void* List_Peek( SortedList* p_list )
+void* List_Peek(SortedList* p_list)
{
- if ( p_list->realCount <= 0 )
+ if (p_list->realCount <= 0)
return NULL;
- return p_list->items[ p_list->realCount - 1 ];
+ return p_list->items[p_list->realCount - 1];
}
-BOOL List_HasItens( SortedList* p_list )
+BOOL List_HasItens(SortedList* p_list)
{
return p_list->realCount > 0;
}
\ No newline at end of file diff --git a/plugins/Utils/mir_dblists.h b/plugins/Utils/mir_dblists.h index f9a5092327..23b93b6a39 100644 --- a/plugins/Utils/mir_dblists.h +++ b/plugins/Utils/mir_dblists.h @@ -27,19 +27,19 @@ Boston, MA 02111-1307, USA. // Need to be called on ME_SYSTEM_MODULESLOADED
-BOOL List_HasItens( SortedList* p_list );
+BOOL List_HasItens(SortedList* p_list);
-void List_DestroyFreeContents( SortedList* );
-int List_RemoveByValue( SortedList*, void* );
-int List_RemoveByValueFreeContents( SortedList*, void* );
+void List_DestroyFreeContents(SortedList*);
+int List_RemoveByValue(SortedList*, void*);
+int List_RemoveByValueFreeContents(SortedList*, void*);
-int List_Append( SortedList*, void* );
-int List_InsertOrdered( SortedList*, void* );
+int List_Append(SortedList*, void*);
+int List_InsertOrdered(SortedList*, void*);
// Theese work on the end of the list
-void List_Push( SortedList* p_list, void* p_value );
-void* List_Pop( SortedList* p_list );
-void* List_Peek( SortedList* p_list );
+void List_Push(SortedList* p_list, void* p_value);
+void* List_Pop(SortedList* p_list);
+void* List_Peek(SortedList* p_list);
diff --git a/plugins/Utils/mir_options.cpp b/plugins/Utils/mir_options.cpp index 5f0d6748cc..12b2d5466d 100644 --- a/plugins/Utils/mir_options.cpp +++ b/plugins/Utils/mir_options.cpp @@ -14,7 +14,7 @@ Library General Public License for more details. You should have received a copy of the GNU Library General Public
License along with this file; see the file license.txt. If
not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.
+Boston, MA 02111-1307, USA.
*/
#include <windows.h>
@@ -190,51 +190,51 @@ INT_PTR CALLBACK SaveOptsDlgProc(OptPageControl *controls, int controlsSize, cha break;
case CONTROL_PROTOCOL_LIST:
- {
- // Fill list view
- HWND hwndProtocols = GetDlgItem(hwndDlg, ctrl->nID);
- LVCOLUMN lvc;
- LVITEM lvi;
-
- ListView_SetExtendedListViewStyle(hwndProtocols, LVS_EX_CHECKBOXES);
+ {
+ // Fill list view
+ HWND hwndProtocols = GetDlgItem(hwndDlg, ctrl->nID);
+ LVCOLUMN lvc;
+ LVITEM lvi;
- memset(&lvc, 0, sizeof(lvc));
- lvc.mask = LVCF_FMT;
- lvc.fmt = LVCFMT_IMAGE | LVCFMT_LEFT;
- ListView_InsertColumn(hwndProtocols, 0, &lvc);
+ ListView_SetExtendedListViewStyle(hwndProtocols, LVS_EX_CHECKBOXES);
- memset(&lvi, 0, sizeof(lvi));
- lvi.mask = LVIF_TEXT | LVIF_PARAM;
- lvi.iSubItem = 0;
- lvi.iItem = 1000;
+ memset(&lvc, 0, sizeof(lvc));
+ lvc.mask = LVCF_FMT;
+ lvc.fmt = LVCFMT_IMAGE | LVCFMT_LEFT;
+ ListView_InsertColumn(hwndProtocols, 0, &lvc);
- int count;
- PROTOACCOUNT **protos;
- ProtoEnumAccounts(&count, &protos);
+ memset(&lvi, 0, sizeof(lvi));
+ lvi.mask = LVIF_TEXT | LVIF_PARAM;
+ lvi.iSubItem = 0;
+ lvi.iItem = 1000;
- for (int i = 0; i < count; i++) {
- PROTOACCOUNT *p = protos[i];
- if (p->szModuleName == NULL || p->szModuleName[0] == '\0')
- continue;
+ int count;
+ PROTOACCOUNT **protos;
+ ProtoEnumAccounts(&count, &protos);
- if (ctrl->allowProtocol != NULL && !ctrl->allowProtocol(p->szModuleName))
- continue;
+ for (int i = 0; i < count; i++) {
+ PROTOACCOUNT *p = protos[i];
+ if (p->szModuleName == NULL || p->szModuleName[0] == '\0')
+ continue;
- char *setting = (char *)mir_alloc(128 * sizeof(char));
- mir_snprintf(setting, 128, ctrl->setting, p->szModuleName);
+ if (ctrl->allowProtocol != NULL && !ctrl->allowProtocol(p->szModuleName))
+ continue;
- BOOL show = (BOOL)db_get_b(NULL, module, setting, ctrl->dwDefValue);
+ char *setting = (char *)mir_alloc(128 * sizeof(char));
+ mir_snprintf(setting, 128, ctrl->setting, p->szModuleName);
- lvi.lParam = (LPARAM)setting;
- lvi.pszText = p->tszAccountName;
- lvi.iItem = ListView_InsertItem(hwndProtocols, &lvi);
- ListView_SetItemState(hwndProtocols, lvi.iItem, INDEXTOSTATEIMAGEMASK(show ? 2 : 1), LVIS_STATEIMAGEMASK);
- }
+ BOOL show = (BOOL)db_get_b(NULL, module, setting, ctrl->dwDefValue);
- ListView_SetColumnWidth(hwndProtocols, 0, LVSCW_AUTOSIZE);
- ListView_Arrange(hwndProtocols, LVA_ALIGNLEFT | LVA_ALIGNTOP);
+ lvi.lParam = (LPARAM)setting;
+ lvi.pszText = p->tszAccountName;
+ lvi.iItem = ListView_InsertItem(hwndProtocols, &lvi);
+ ListView_SetItemState(hwndProtocols, lvi.iItem, INDEXTOSTATEIMAGEMASK(show ? 2 : 1), LVIS_STATEIMAGEMASK);
}
- break;
+
+ ListView_SetColumnWidth(hwndProtocols, 0, LVSCW_AUTOSIZE);
+ ListView_Arrange(hwndProtocols, LVA_ALIGNLEFT | LVA_ALIGNTOP);
+ }
+ break;
case CONTROL_TEXT:
SetDlgItemText(hwndDlg, ctrl->nID, MyDBGetContactSettingTString(NULL, module, ctrl->setting, tmp, 1024, ctrl->tszDefValue == NULL ? NULL : TranslateTS(ctrl->tszDefValue)));
@@ -308,122 +308,122 @@ INT_PTR CALLBACK SaveOptsDlgProc(OptPageControl *controls, int controlsSize, cha break;
case WM_NOTIFY:
- {
- LPNMHDR lpnmhdr = (LPNMHDR)lParam;
- if (lpnmhdr->idFrom == 0 && lpnmhdr->code == PSN_APPLY) {
- for (int i = 0; i < controlsSize; i++) {
- OptPageControl *ctrl = &controls[i];
+ {
+ LPNMHDR lpnmhdr = (LPNMHDR)lParam;
+ if (lpnmhdr->idFrom == 0 && lpnmhdr->code == PSN_APPLY) {
+ for (int i = 0; i < controlsSize; i++) {
+ OptPageControl *ctrl = &controls[i];
- if (GetDlgItem(hwndDlg, ctrl->nID) == NULL)
- continue;
+ if (GetDlgItem(hwndDlg, ctrl->nID) == NULL)
+ continue;
- switch (ctrl->type) {
- case CONTROL_CHECKBOX:
- db_set_b(NULL, module, ctrl->setting, (BYTE)IsDlgButtonChecked(hwndDlg, ctrl->nID));
- break;
+ switch (ctrl->type) {
+ case CONTROL_CHECKBOX:
+ db_set_b(NULL, module, ctrl->setting, (BYTE)IsDlgButtonChecked(hwndDlg, ctrl->nID));
+ break;
- case CONTROL_SPIN:
- db_set_w(NULL, module, ctrl->setting, (WORD)SendDlgItemMessage(hwndDlg, ctrl->nIDSpin, UDM_GETPOS, 0, 0));
- break;
+ case CONTROL_SPIN:
+ db_set_w(NULL, module, ctrl->setting, (WORD)SendDlgItemMessage(hwndDlg, ctrl->nIDSpin, UDM_GETPOS, 0, 0));
+ break;
- case CONTROL_COLOR:
- db_set_dw(NULL, module, ctrl->setting, (DWORD)SendDlgItemMessage(hwndDlg, ctrl->nID, CPM_GETCOLOUR, 0, 0));
- break;
+ case CONTROL_COLOR:
+ db_set_dw(NULL, module, ctrl->setting, (DWORD)SendDlgItemMessage(hwndDlg, ctrl->nID, CPM_GETCOLOUR, 0, 0));
+ break;
- case CONTROL_RADIO:
- if (IsDlgButtonChecked(hwndDlg, ctrl->nID))
- db_set_w(NULL, module, ctrl->setting, (BYTE)ctrl->value);
- break;
+ case CONTROL_RADIO:
+ if (IsDlgButtonChecked(hwndDlg, ctrl->nID))
+ db_set_w(NULL, module, ctrl->setting, (BYTE)ctrl->value);
+ break;
- case CONTROL_COMBO:
- db_set_w(NULL, module, ctrl->setting, (WORD)SendDlgItemMessage(hwndDlg, ctrl->nID, CB_GETCURSEL, 0, 0));
- break;
+ case CONTROL_COMBO:
+ db_set_w(NULL, module, ctrl->setting, (WORD)SendDlgItemMessage(hwndDlg, ctrl->nID, CB_GETCURSEL, 0, 0));
+ break;
- case CONTROL_PROTOCOL_LIST:
- {
- LVITEM lvi = { 0 };
- HWND hwndProtocols = GetDlgItem(hwndDlg, ctrl->nID);
- int i;
+ case CONTROL_PROTOCOL_LIST:
+ {
+ LVITEM lvi = { 0 };
+ HWND hwndProtocols = GetDlgItem(hwndDlg, ctrl->nID);
+ int i;
- lvi.mask = (UINT)LVIF_PARAM;
+ lvi.mask = (UINT)LVIF_PARAM;
- for (i = 0; i < ListView_GetItemCount(hwndProtocols); i++) {
- lvi.iItem = i;
- ListView_GetItem(hwndProtocols, &lvi);
+ for (i = 0; i < ListView_GetItemCount(hwndProtocols); i++) {
+ lvi.iItem = i;
+ ListView_GetItem(hwndProtocols, &lvi);
- char *setting = (char *)lvi.lParam;
- db_set_b(NULL, module, setting, (BYTE)ListView_GetCheckState(hwndProtocols, i));
- }
+ char *setting = (char *)lvi.lParam;
+ db_set_b(NULL, module, setting, (BYTE)ListView_GetCheckState(hwndProtocols, i));
}
- break;
+ }
+ break;
- case CONTROL_TEXT:
- {
- TCHAR tmp[1024];
- GetDlgItemText(hwndDlg, ctrl->nID, tmp, SIZEOF(tmp));
- db_set_ts(NULL, module, ctrl->setting, tmp);
- }
- break;
-
- case CONTROL_INT:
- {
- BOOL trans;
- int val = GetDlgItemInt(hwndDlg, ctrl->nID, &trans, ctrl->min <= 0);
- if (!trans)
- val = ctrl->dwDefValue;
- if (ctrl->max != 0)
- val = min(val, ctrl->max);
- if (ctrl->min != 0)
- val = max(val, ctrl->min);
- db_set_dw(NULL, module, ctrl->setting, val);
- }
- break;
- case CONTROL_FILE:
- {
- TCHAR tmp[1024];
- GetDlgItemText(hwndDlg, ctrl->nID, tmp, SIZEOF(tmp));
- TCHAR rel[1024];
- PathToRelative(rel, 1024, tmp);
- db_set_ts(NULL, module, ctrl->setting, rel);
- }
- break;
- case CONTROL_COMBO_TEXT:
- {
- TCHAR tmp[1024];
- GetDlgItemText(hwndDlg, ctrl->nID, tmp, SIZEOF(tmp));
- db_set_ts(NULL, module, ctrl->setting, tmp);
- }
- break;
- case CONTROL_COMBO_ITEMDATA:
- {
- int sel = SendDlgItemMessage(hwndDlg, ctrl->nID, CB_GETCURSEL, 0, 0);
- db_set_ts(NULL, module, ctrl->setting, (TCHAR *)SendDlgItemMessage(hwndDlg, ctrl->nID, CB_GETITEMDATA, (WPARAM)sel, 0));
- }
- break;
- }
+ case CONTROL_TEXT:
+ {
+ TCHAR tmp[1024];
+ GetDlgItemText(hwndDlg, ctrl->nID, tmp, SIZEOF(tmp));
+ db_set_ts(NULL, module, ctrl->setting, tmp);
+ }
+ break;
- LoadOpt(ctrl, module);
+ case CONTROL_INT:
+ {
+ BOOL trans;
+ int val = GetDlgItemInt(hwndDlg, ctrl->nID, &trans, ctrl->min <= 0);
+ if (!trans)
+ val = ctrl->dwDefValue;
+ if (ctrl->max != 0)
+ val = min(val, ctrl->max);
+ if (ctrl->min != 0)
+ val = max(val, ctrl->min);
+ db_set_dw(NULL, module, ctrl->setting, val);
+ }
+ break;
+ case CONTROL_FILE:
+ {
+ TCHAR tmp[1024];
+ GetDlgItemText(hwndDlg, ctrl->nID, tmp, SIZEOF(tmp));
+ TCHAR rel[1024];
+ PathToRelative(rel, 1024, tmp);
+ db_set_ts(NULL, module, ctrl->setting, rel);
+ }
+ break;
+ case CONTROL_COMBO_TEXT:
+ {
+ TCHAR tmp[1024];
+ GetDlgItemText(hwndDlg, ctrl->nID, tmp, SIZEOF(tmp));
+ db_set_ts(NULL, module, ctrl->setting, tmp);
+ }
+ break;
+ case CONTROL_COMBO_ITEMDATA:
+ {
+ int sel = SendDlgItemMessage(hwndDlg, ctrl->nID, CB_GETCURSEL, 0, 0);
+ db_set_ts(NULL, module, ctrl->setting, (TCHAR *)SendDlgItemMessage(hwndDlg, ctrl->nID, CB_GETITEMDATA, (WPARAM)sel, 0));
+ }
+ break;
}
- return TRUE;
+ LoadOpt(ctrl, module);
}
- else if (lpnmhdr->idFrom != 0 && lpnmhdr->code == LVN_ITEMCHANGED) {
- // Changed for protocols
- for (int i = 0; i < controlsSize; i++) {
- OptPageControl *ctrl = &controls[i];
- if (ctrl->type == CONTROL_PROTOCOL_LIST && ctrl->nID == lpnmhdr->idFrom) {
- NMLISTVIEW *nmlv = (NMLISTVIEW *)lParam;
+ return TRUE;
+ }
+ else if (lpnmhdr->idFrom != 0 && lpnmhdr->code == LVN_ITEMCHANGED) {
+ // Changed for protocols
+ for (int i = 0; i < controlsSize; i++) {
+ OptPageControl *ctrl = &controls[i];
- if (IsWindowVisible(GetDlgItem(hwndDlg, ctrl->nID)) && ((nmlv->uNewState ^ nmlv->uOldState) & LVIS_STATEIMAGEMASK))
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ if (ctrl->type == CONTROL_PROTOCOL_LIST && ctrl->nID == lpnmhdr->idFrom) {
+ NMLISTVIEW *nmlv = (NMLISTVIEW *)lParam;
- break;
- }
+ if (IsWindowVisible(GetDlgItem(hwndDlg, ctrl->nID)) && ((nmlv->uNewState ^ nmlv->uOldState) & LVIS_STATEIMAGEMASK))
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+
+ break;
}
}
}
- break;
+ }
+ break;
case WM_DESTROY:
for (int i = 0; i < controlsSize; i++) {
diff --git a/plugins/Utils/mir_options.h b/plugins/Utils/mir_options.h index 5a41c3c0dc..842d154e3a 100644 --- a/plugins/Utils/mir_options.h +++ b/plugins/Utils/mir_options.h @@ -1,4 +1,4 @@ -/*
+/*
Copyright (C) 2005-2009 Ricardo Pescuma Domenecci
This is free software; you can redistribute it and/or
@@ -14,7 +14,7 @@ Library General Public License for more details. You should have received a copy of the GNU Library General Public
License along with this file; see the file license.txt. If
not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.
+Boston, MA 02111-1307, USA.
*/
@@ -37,7 +37,7 @@ Boston, MA 02111-1307, USA. #define CONTROL_INT 10 // Stored as DWORD
-typedef BOOL (* FPAllowProtocol) (const char *proto);
+typedef BOOL(*FPAllowProtocol) (const char *proto);
typedef struct {
void *var;
diff --git a/plugins/Utils/mir_smileys.cpp b/plugins/Utils/mir_smileys.cpp index fc321c0a56..ab5f666668 100644 --- a/plugins/Utils/mir_smileys.cpp +++ b/plugins/Utils/mir_smileys.cpp @@ -52,11 +52,11 @@ typedef struct };
};
}
- TextPiece;
+TextPiece;
SortedList * ReplaceSmileys(const TCHAR *text, int text_size, const char *protocol, int *max_smiley_height);
void DrawTextSmiley(HDC hdcMem, RECT free_rc, const TCHAR *szText, int len, SortedList *plText, UINT uTextFormat, int max_smiley_height);
-void DestroySmileyList( SortedList* p_list );
+void DestroySmileyList(SortedList* p_list);
SIZE GetTextSize(HDC hdcMem, const TCHAR *szText, SortedList *plText, UINT uTextFormat, int max_smiley_height);
// Functions
@@ -80,7 +80,7 @@ int InitContactListSmileys() SmileysParseInfo Smileys_PreParse(const TCHAR* lpString, int nCount, const char *protocol)
{
- SmileysParseInfo info = (SmileysParseInfo) mir_calloc(sizeof(_SmileysParseInfo));
+ SmileysParseInfo info = (SmileysParseInfo)mir_calloc(sizeof(_SmileysParseInfo));
info->pieces = ReplaceSmileys(lpString, nCount, protocol, &info->max_height);
@@ -112,7 +112,7 @@ int skin_DrawText(HDC hDC, LPCTSTR lpString, int nCount, LPRECT lpRect, UINT uFo }
int skin_DrawIconEx(HDC hdc, int xLeft, int yTop, HICON hIcon, int cxWidth, int cyWidth,
- UINT istepIfAniCur, HBRUSH hbrFlickerFreeDraw, UINT diFlags)
+ UINT istepIfAniCur, HBRUSH hbrFlickerFreeDraw, UINT diFlags)
{
if (ServiceExists(MS_SKINENG_DRAWICONEXFIX))
return mod_DrawIconEx_helper(hdc, xLeft, yTop, hIcon, cxWidth, cyWidth, istepIfAniCur, hbrFlickerFreeDraw, diFlags);
@@ -158,7 +158,7 @@ int Smileys_DrawText(HDC hDC, LPCTSTR lpString, int nCount, LPRECT lpRect, UINT else
{
// Clipping rgn
- HRGN oldRgn = CreateRectRgn(0,0,1,1);
+ HRGN oldRgn = CreateRectRgn(0, 0, 1, 1);
if (GetClipRgn(hDC, oldRgn) != 1)
{
DeleteObject(oldRgn);
@@ -217,7 +217,7 @@ SIZE GetTextSize(HDC hdcMem, const TCHAR *szText, SortedList *plText, UINT uText text_size.cx = 0;
}
else {
- RECT text_rc = {0, 0, 0x7FFFFFFF, 0x7FFFFFFF};
+ RECT text_rc = { 0, 0, 0x7FFFFFFF, 0x7FFFFFFF };
// Always need cy...
DrawText(hdcMem, szText, -1, &text_rc, DT_CALCRECT | uTextFormat);
@@ -226,17 +226,17 @@ SIZE GetTextSize(HDC hdcMem, const TCHAR *szText, SortedList *plText, UINT uText if (plText == NULL)
text_size.cx = text_rc.right - text_rc.left;
else {
- if ( !(uTextFormat & DT_RESIZE_SMILEYS))
+ if (!(uTextFormat & DT_RESIZE_SMILEYS))
text_size.cy = max(text_size.cy, max_smiley_height);
text_size.cx = 0;
// See each item of list
for (int i = 0; i < plText->realCount; i++) {
- TextPiece *piece = (TextPiece *) plText->items[i];
+ TextPiece *piece = (TextPiece *)plText->items[i];
if (piece->type == TEXT_PIECE_TYPE_TEXT) {
- RECT text_rc = {0, 0, 0x7FFFFFFF, 0x7FFFFFFF};
+ RECT text_rc = { 0, 0, 0x7FFFFFFF, 0x7FFFFFFF };
DrawText(hdcMem, &szText[piece->start_pos], piece->len, &text_rc, DT_CALCRECT | uTextFormat);
text_size.cx = text_size.cx + text_rc.right - text_rc.left;
@@ -245,7 +245,7 @@ SIZE GetTextSize(HDC hdcMem, const TCHAR *szText, SortedList *plText, UINT uText double factor;
if ((uTextFormat & DT_RESIZE_SMILEYS) && piece->smiley_height > text_size.cy)
- factor = text_size.cy / (double) piece->smiley_height;
+ factor = text_size.cy / (double)piece->smiley_height;
else
factor = 1;
@@ -293,7 +293,7 @@ void DrawTextSmiley(HDC hdcMem, RECT free_rc, const TCHAR *szText, int len, Sort // Draw text and smileys
for (; i < plText->realCount && i >= 0 && pos_x < free_rc.right - free_rc.left && len > 0; i += (uTextFormat & DT_RTLREADING ? -1 : 1))
{
- TextPiece *piece = (TextPiece *) plText->items[i];
+ TextPiece *piece = (TextPiece *)plText->items[i];
RECT text_rc = free_rc;
if (uTextFormat & DT_RTLREADING)
@@ -330,7 +330,7 @@ void DrawTextSmiley(HDC hdcMem, RECT free_rc, const TCHAR *szText, int len, Sort if ((uTextFormat & DT_RESIZE_SMILEYS) && piece->smiley_height > row_height)
{
- factor = row_height / (double) piece->smiley_height;
+ factor = row_height / (double)piece->smiley_height;
}
else
{
@@ -338,7 +338,7 @@ void DrawTextSmiley(HDC hdcMem, RECT free_rc, const TCHAR *szText, int len, Sort }
if (uTextFormat & DT_RTLREADING)
- text_rc.left = max(text_rc.right - (LONG) (piece->smiley_width * factor), text_rc.left);
+ text_rc.left = max(text_rc.right - (LONG)(piece->smiley_width * factor), text_rc.left);
if ((LONG)(piece->smiley_width * factor) <= text_rc.right - text_rc.left)
{
@@ -361,19 +361,19 @@ void DrawTextSmiley(HDC hdcMem, RECT free_rc, const TCHAR *szText, int len, Sort }
-void DestroySmileyList( SortedList* p_list )
+void DestroySmileyList(SortedList* p_list)
{
- if ( p_list == NULL )
+ if (p_list == NULL)
return;
- if ( p_list->items != NULL )
+ if (p_list->items != NULL)
{
int i;
- for ( i = 0 ; i < p_list->realCount ; i++ )
+ for (i = 0; i < p_list->realCount; i++)
{
- TextPiece *piece = (TextPiece *) p_list->items[i];
+ TextPiece *piece = (TextPiece *)p_list->items[i];
- if ( piece != NULL )
+ if (piece != NULL)
{
if (piece->type == TEXT_PIECE_TYPE_SMILEY)
DestroyIcon(piece->smiley);
@@ -383,7 +383,7 @@ void DestroySmileyList( SortedList* p_list ) }
}
- List_Destroy( p_list );
+ List_Destroy(p_list);
}
@@ -401,7 +401,7 @@ SortedList * ReplaceSmileys(const TCHAR *text, int text_size, const char *protoc sp.Protocolname = protocol;
sp.str = (TCHAR*)text;
sp.flag = SAFL_TCHAR;
- SMADD_BATCHPARSERES *spres = (SMADD_BATCHPARSERES *) CallService(MS_SMILEYADD_BATCHPARSE, 0, (LPARAM)&sp);
+ SMADD_BATCHPARSERES *spres = (SMADD_BATCHPARSERES *)CallService(MS_SMILEYADD_BATCHPARSE, 0, (LPARAM)&sp);
if (spres == NULL)
// Did not find a simley
return NULL;
@@ -410,7 +410,7 @@ SortedList * ReplaceSmileys(const TCHAR *text, int text_size, const char *protoc SortedList *plText = List_Create(0, 10);
const TCHAR *next_text_pos = text;
- const TCHAR *last_text_pos = _tcsninc(text, text_size);
+ const TCHAR *last_text_pos = _tcsninc(text, text_size);
for (unsigned int i = 0; i < sp.numSmileys; i++) {
TCHAR* start = _tcsninc(text, spres[i].startChar);
@@ -419,7 +419,7 @@ SortedList * ReplaceSmileys(const TCHAR *text, int text_size, const char *protoc if (spres[i].hIcon != NULL) { // For defective smileypacks
// Add text
if (start > next_text_pos) {
- TextPiece *piece = (TextPiece *) mir_calloc(sizeof(TextPiece));
+ TextPiece *piece = (TextPiece *)mir_calloc(sizeof(TextPiece));
piece->type = TEXT_PIECE_TYPE_TEXT;
piece->start_pos = next_text_pos - text;
@@ -432,7 +432,7 @@ SortedList * ReplaceSmileys(const TCHAR *text, int text_size, const char *protoc {
BITMAP bm;
ICONINFO icon;
- TextPiece *piece = (TextPiece *) mir_calloc(sizeof(TextPiece));
+ TextPiece *piece = (TextPiece *)mir_calloc(sizeof(TextPiece));
piece->type = TEXT_PIECE_TYPE_SMILEY;
piece->len = end - start;
@@ -442,7 +442,7 @@ SortedList * ReplaceSmileys(const TCHAR *text, int text_size, const char *protoc piece->smiley_height = 16;
if (GetIconInfo(piece->smiley, &icon))
{
- if (GetObject(icon.hbmColor,sizeof(BITMAP),&bm))
+ if (GetObject(icon.hbmColor, sizeof(BITMAP), &bm))
{
piece->smiley_width = bm.bmWidth;
piece->smiley_height = bm.bmHeight;
@@ -464,7 +464,7 @@ SortedList * ReplaceSmileys(const TCHAR *text, int text_size, const char *protoc // Add rest of text
if (last_text_pos > next_text_pos)
{
- TextPiece *piece = (TextPiece *) mir_calloc(sizeof(TextPiece));
+ TextPiece *piece = (TextPiece *)mir_calloc(sizeof(TextPiece));
piece->type = TEXT_PIECE_TYPE_TEXT;
piece->start_pos = next_text_pos - text;
diff --git a/plugins/Utils/mir_smileys.h b/plugins/Utils/mir_smileys.h index 8b3b2a504b..fe130bbc6a 100644 --- a/plugins/Utils/mir_smileys.h +++ b/plugins/Utils/mir_smileys.h @@ -1,4 +1,4 @@ -/*
+/*
Copyright (C) 2005 Ricardo Pescuma Domenecci
This is free software; you can redistribute it and/or
@@ -14,7 +14,7 @@ Library General Public License for more details. You should have received a copy of the GNU Library General Public
License along with this file; see the file license.txt. If
not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.
+Boston, MA 02111-1307, USA.
*/
@@ -41,7 +41,7 @@ typedef struct _SmileysParseInfo {
SortedList *pieces;
int max_height;
-} * SmileysParseInfo;
+} *SmileysParseInfo;
SmileysParseInfo Smileys_PreParse(LPCSTR lpString, int nCount, const char *protocol);
void Smileys_FreeParse(SmileysParseInfo parseInfo);
|