summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-02-20 17:12:40 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-02-20 17:12:40 +0000
commit509f52fe07c0b035dfeea810b99edf92a9781380 (patch)
tree3a31ce4a6260801a9dfd47c2c50e2875171eab3c
parent646d843cd5b1b3498e488f99d812ad344f746f81 (diff)
nicer+ status items list made dynamic
git-svn-id: http://svn.miranda-ng.org/main/trunk@3654 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--plugins/Clist_nicer/skineditor/src/main.cpp466
-rw-r--r--plugins/Clist_nicer/src/CLCButton.cpp2
-rw-r--r--plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp30
-rw-r--r--plugins/Clist_nicer/src/Include/commonheaders.h3
-rw-r--r--plugins/Clist_nicer/src/Include/m_cln_skinedit.h2
-rw-r--r--plugins/Clist_nicer/src/alphablend.cpp3
-rw-r--r--plugins/Clist_nicer/src/clc.cpp9
-rw-r--r--plugins/Clist_nicer/src/clcpaint.cpp35
-rw-r--r--plugins/Clist_nicer/src/clistevents.cpp6
-rw-r--r--plugins/Clist_nicer/src/clui.cpp9
-rw-r--r--plugins/Clist_nicer/src/extBackg.cpp379
-rw-r--r--plugins/Clist_nicer/src/statusbar.cpp5
-rw-r--r--plugins/Clist_nicer/src/statusfloater.cpp4
13 files changed, 436 insertions, 517 deletions
diff --git a/plugins/Clist_nicer/skineditor/src/main.cpp b/plugins/Clist_nicer/skineditor/src/main.cpp
index 9037525b23..465071f7f5 100644
--- a/plugins/Clist_nicer/skineditor/src/main.cpp
+++ b/plugins/Clist_nicer/skineditor/src/main.cpp
@@ -42,7 +42,7 @@ PLUGININFOEX pluginInfo = {
HINSTANCE g_hInst = 0;
int hLangpack;
-StatusItems_t *StatusItems;
+StatusItems_t **StatusItems;
ChangedSItems_t ChangedSItems = {0};
static int LastModifiedItem = -1;
@@ -243,7 +243,7 @@ static void FillOptionDialogByStatusItem(HWND hwndDlg, StatusItems_t *item)
_itoa(ret, itoabuf, 10);
SetDlgItemTextA(hwndDlg, IDC_MRGN_BOTTOM, itoabuf);
}
- if(item->BORDERSTYLE == -1)
+ if (item->BORDERSTYLE == -1)
SendDlgItemMessage(hwndDlg, IDC_BORDERTYPE, CB_SETCURSEL, 0, 0);
else {
index = 0;
@@ -274,12 +274,11 @@ static void FillOptionDialogByCurrentSel(HWND hwndDlg)
{
int index = SendDlgItemMessage(hwndDlg, IDC_ITEMS, LB_GETCURSEL, 0, 0);
int itemData = SendDlgItemMessage(hwndDlg, IDC_ITEMS, LB_GETITEMDATA, index, 0);
- if(itemData != ID_EXTBKSEPARATOR) {
+ if (itemData != ID_EXTBKSEPARATOR) {
LastModifiedItem = itemData - ID_EXTBK_FIRST;
- if (CheckItem(itemData - ID_EXTBK_FIRST, hwndDlg)) {
- FillOptionDialogByStatusItem(hwndDlg, &StatusItems[itemData - ID_EXTBK_FIRST]);
- }
+ if (CheckItem(itemData - ID_EXTBK_FIRST, hwndDlg))
+ FillOptionDialogByStatusItem(hwndDlg, StatusItems[itemData - ID_EXTBK_FIRST]);
}
}
@@ -287,7 +286,7 @@ static void FillOptionDialogByCurrentSel(HWND hwndDlg)
// enabled all status controls if the selected item is a separator
static BOOL CheckItem(int item, HWND hwndDlg)
{
- if (StatusItems[item].statusID == ID_EXTBKSEPARATOR) {
+ if (StatusItems[item]->statusID == ID_EXTBKSEPARATOR) {
ChangeControlItems(hwndDlg, 0, 0);
return FALSE;
} else {
@@ -368,7 +367,7 @@ static void SetChangedStatusItemFlag(WPARAM wParam, HWND hwndDlg)
static BOOL isValidItem(void)
{
- if (StatusItems[LastModifiedItem].statusID == ID_EXTBKSEPARATOR)
+ if (StatusItems[LastModifiedItem]->statusID == ID_EXTBKSEPARATOR)
return FALSE;
return TRUE;
@@ -379,101 +378,102 @@ static void UpdateStatusStructSettingsFromOptDlg(HWND hwndDlg, int index)
{
char buf[15];
ULONG bdrtype;
+ StatusItems_t *p = StatusItems[index];
if (ChangedSItems.bIGNORED)
- StatusItems[index]. IGNORED = IsDlgButtonChecked(hwndDlg, IDC_IGNORE);
+ p->IGNORED = IsDlgButtonChecked(hwndDlg, IDC_IGNORE);
if (ChangedSItems.bGRADIENT) {
- StatusItems[index]. GRADIENT = GRADIENT_NONE;
+ p->GRADIENT = GRADIENT_NONE;
if (IsDlgButtonChecked(hwndDlg, IDC_GRADIENT))
- StatusItems[index].GRADIENT |= GRADIENT_ACTIVE;
+ p->GRADIENT |= GRADIENT_ACTIVE;
if (IsDlgButtonChecked(hwndDlg, IDC_GRADIENT_LR))
- StatusItems[index].GRADIENT |= GRADIENT_LR;
+ p->GRADIENT |= GRADIENT_LR;
if (IsDlgButtonChecked(hwndDlg, IDC_GRADIENT_RL))
- StatusItems[index].GRADIENT |= GRADIENT_RL;
+ p->GRADIENT |= GRADIENT_RL;
if (IsDlgButtonChecked(hwndDlg, IDC_GRADIENT_TB))
- StatusItems[index].GRADIENT |= GRADIENT_TB;
+ p->GRADIENT |= GRADIENT_TB;
if (IsDlgButtonChecked(hwndDlg, IDC_GRADIENT_BT))
- StatusItems[index].GRADIENT |= GRADIENT_BT;
+ p->GRADIENT |= GRADIENT_BT;
}
if (ChangedSItems.bCORNER) {
- StatusItems[index]. CORNER = CORNER_NONE;
+ p->CORNER = CORNER_NONE;
if (IsDlgButtonChecked(hwndDlg, IDC_CORNER))
- StatusItems[index].CORNER |= CORNER_ACTIVE ;
+ p->CORNER |= CORNER_ACTIVE ;
if (IsDlgButtonChecked(hwndDlg, IDC_CORNER_TL))
- StatusItems[index].CORNER |= CORNER_TL ;
+ p->CORNER |= CORNER_TL ;
if (IsDlgButtonChecked(hwndDlg, IDC_CORNER_TR))
- StatusItems[index].CORNER |= CORNER_TR;
+ p->CORNER |= CORNER_TR;
if (IsDlgButtonChecked(hwndDlg, IDC_CORNER_BR))
- StatusItems[index].CORNER |= CORNER_BR;
+ p->CORNER |= CORNER_BR;
if (IsDlgButtonChecked(hwndDlg, IDC_CORNER_BL))
- StatusItems[index].CORNER |= CORNER_BL;
+ p->CORNER |= CORNER_BL;
}
if (ChangedSItems.bCOLOR)
- StatusItems[index]. COLOR = SendDlgItemMessage(hwndDlg, IDC_BASECOLOUR, CPM_GETCOLOUR, 0, 0);
+ p->COLOR = SendDlgItemMessage(hwndDlg, IDC_BASECOLOUR, CPM_GETCOLOUR, 0, 0);
if (ChangedSItems.bCOLOR2)
- StatusItems[index]. COLOR2 = SendDlgItemMessage(hwndDlg, IDC_BASECOLOUR2, CPM_GETCOLOUR, 0, 0);
+ p->COLOR2 = SendDlgItemMessage(hwndDlg, IDC_BASECOLOUR2, CPM_GETCOLOUR, 0, 0);
if (ChangedSItems.bCOLOR2_TRANSPARENT)
- StatusItems[index]. COLOR2_TRANSPARENT = IsDlgButtonChecked(hwndDlg, IDC_COLOR2_TRANSPARENT);
+ p->COLOR2_TRANSPARENT = IsDlgButtonChecked(hwndDlg, IDC_COLOR2_TRANSPARENT);
if (ChangedSItems.bTEXTCOLOR)
- StatusItems[index]. TEXTCOLOR = SendDlgItemMessage(hwndDlg, IDC_TEXTCOLOUR, CPM_GETCOLOUR, 0, 0);
+ p->TEXTCOLOR = SendDlgItemMessage(hwndDlg, IDC_TEXTCOLOUR, CPM_GETCOLOUR, 0, 0);
if (ChangedSItems.bALPHA) {
GetWindowTextA(GetDlgItem(hwndDlg, IDC_ALPHA), buf, 10); // can be removed now
if (lstrlenA(buf) > 0)
- StatusItems[index]. ALPHA = (BYTE) SendDlgItemMessage(hwndDlg, IDC_ALPHASPIN, UDM_GETPOS, 0, 0);
+ p->ALPHA = (BYTE) SendDlgItemMessage(hwndDlg, IDC_ALPHASPIN, UDM_GETPOS, 0, 0);
}
if (ChangedSItems.bMARGIN_LEFT) {
GetWindowTextA(GetDlgItem(hwndDlg, IDC_MRGN_LEFT), buf, 10);
if (lstrlenA(buf) > 0)
- StatusItems[index]. MARGIN_LEFT = (BYTE) SendDlgItemMessage(hwndDlg, IDC_MRGN_LEFT_SPIN, UDM_GETPOS, 0, 0);
+ p->MARGIN_LEFT = (BYTE) SendDlgItemMessage(hwndDlg, IDC_MRGN_LEFT_SPIN, UDM_GETPOS, 0, 0);
}
if (ChangedSItems.bMARGIN_TOP) {
GetWindowTextA(GetDlgItem(hwndDlg, IDC_MRGN_TOP), buf, 10);
if (lstrlenA(buf) > 0)
- StatusItems[index]. MARGIN_TOP = (BYTE) SendDlgItemMessage(hwndDlg, IDC_MRGN_TOP_SPIN, UDM_GETPOS, 0, 0);
+ p->MARGIN_TOP = (BYTE) SendDlgItemMessage(hwndDlg, IDC_MRGN_TOP_SPIN, UDM_GETPOS, 0, 0);
}
if (ChangedSItems.bMARGIN_RIGHT) {
GetWindowTextA(GetDlgItem(hwndDlg, IDC_MRGN_RIGHT), buf, 10);
if (lstrlenA(buf) > 0)
- StatusItems[index]. MARGIN_RIGHT = (BYTE) SendDlgItemMessage(hwndDlg, IDC_MRGN_RIGHT_SPIN, UDM_GETPOS, 0, 0);
+ p->MARGIN_RIGHT = (BYTE) SendDlgItemMessage(hwndDlg, IDC_MRGN_RIGHT_SPIN, UDM_GETPOS, 0, 0);
}
if (ChangedSItems.bMARGIN_BOTTOM) {
GetWindowTextA(GetDlgItem(hwndDlg, IDC_MRGN_BOTTOM), buf, 10);
if (lstrlenA(buf) > 0)
- StatusItems[index]. MARGIN_BOTTOM = (BYTE) SendDlgItemMessage(hwndDlg, IDC_MRGN_BOTTOM_SPIN, UDM_GETPOS, 0, 0);
+ p->MARGIN_BOTTOM = (BYTE) SendDlgItemMessage(hwndDlg, IDC_MRGN_BOTTOM_SPIN, UDM_GETPOS, 0, 0);
}
if (ChangedSItems.bBORDERSTYLE) {
bdrtype = SendDlgItemMessage(hwndDlg, IDC_BORDERTYPE, CB_GETCURSEL, 0, 0);
- if(bdrtype == CB_ERR)
- StatusItems[index].BORDERSTYLE = 0;
+ if (bdrtype == CB_ERR)
+ p->BORDERSTYLE = 0;
else {
switch(bdrtype) {
case 0:
- StatusItems[index].BORDERSTYLE = 0;
+ p->BORDERSTYLE = 0;
break;
case 1:
- StatusItems[index].BORDERSTYLE = BDR_RAISEDOUTER;
+ p->BORDERSTYLE = BDR_RAISEDOUTER;
break;
case 2:
- StatusItems[index].BORDERSTYLE = BDR_SUNKENINNER;
+ p->BORDERSTYLE = BDR_SUNKENINNER;
break;
case 3:
- StatusItems[index].BORDERSTYLE = EDGE_BUMP;
+ p->BORDERSTYLE = EDGE_BUMP;
break;
case 4:
- StatusItems[index].BORDERSTYLE = EDGE_ETCHED;
+ p->BORDERSTYLE = EDGE_ETCHED;
break;
default:
- StatusItems[index].BORDERSTYLE = 0;
+ p->BORDERSTYLE = 0;
break;
}
}
@@ -561,8 +561,7 @@ static void OnListItemsChange(HWND hwndDlg)
// set new selection
last_selcount = SendMessage(GetDlgItem(hwndDlg, IDC_ITEMS), LB_GETSELCOUNT, 0, 0);
if (last_selcount > 0) {
- int n, real_index, itemData, first_item;
- StatusItems_t DialogSettingForMultiSel;
+ int n, itemData, first_item;
// get selected indizes
SendMessage(GetDlgItem(hwndDlg, IDC_ITEMS), LB_GETSELITEMS, 64, (LPARAM) last_indizes);
@@ -570,41 +569,43 @@ static void OnListItemsChange(HWND hwndDlg)
// initialize with first items value
first_item = SendDlgItemMessage(hwndDlg, IDC_ITEMS, LB_GETITEMDATA, last_indizes[0], 0) - ID_EXTBK_FIRST;
- DialogSettingForMultiSel = StatusItems[first_item];
+ StatusItems_t *pFirst = StatusItems[first_item];
+ StatusItems_t DialogSettingForMultiSel = *StatusItems[first_item];
for (n = 0; n < last_selcount; n++) {
itemData = SendDlgItemMessage(hwndDlg, IDC_ITEMS, LB_GETITEMDATA, last_indizes[n], 0);
- if (itemData != ID_EXTBKSEPARATOR) {
- real_index = itemData - ID_EXTBK_FIRST;
- if (StatusItems[real_index].ALPHA != StatusItems[first_item].ALPHA)
+ if (itemData == ID_EXTBKSEPARATOR)
+ continue;
+
+ StatusItems_t *p = StatusItems[itemData - ID_EXTBK_FIRST];
+ if (p->ALPHA != pFirst->ALPHA)
DialogSettingForMultiSel.ALPHA = -1;
- if (StatusItems[real_index].COLOR != StatusItems[first_item].COLOR)
+ if (p->COLOR != pFirst->COLOR)
DialogSettingForMultiSel.COLOR = CLCDEFAULT_COLOR;
- if (StatusItems[real_index].COLOR2 != StatusItems[first_item].COLOR2)
+ if (p->COLOR2 != pFirst->COLOR2)
DialogSettingForMultiSel.COLOR2 = CLCDEFAULT_COLOR2;
- if (StatusItems[real_index].COLOR2_TRANSPARENT != StatusItems[first_item].COLOR2_TRANSPARENT)
+ if (p->COLOR2_TRANSPARENT != pFirst->COLOR2_TRANSPARENT)
DialogSettingForMultiSel.COLOR2_TRANSPARENT = CLCDEFAULT_COLOR2_TRANSPARENT;
- if (StatusItems[real_index].TEXTCOLOR != StatusItems[first_item].TEXTCOLOR)
+ if (p->TEXTCOLOR != pFirst->TEXTCOLOR)
DialogSettingForMultiSel.TEXTCOLOR = CLCDEFAULT_TEXTCOLOR;
- if (StatusItems[real_index].CORNER != StatusItems[first_item].CORNER)
+ if (p->CORNER != pFirst->CORNER)
DialogSettingForMultiSel.CORNER = CLCDEFAULT_CORNER;
- if (StatusItems[real_index].GRADIENT != StatusItems[first_item].GRADIENT)
+ if (p->GRADIENT != pFirst->GRADIENT)
DialogSettingForMultiSel.GRADIENT = CLCDEFAULT_GRADIENT;
- if (StatusItems[real_index].IGNORED != StatusItems[first_item].IGNORED)
+ if (p->IGNORED != pFirst->IGNORED)
DialogSettingForMultiSel.IGNORED = CLCDEFAULT_IGNORE;
- if (StatusItems[real_index].MARGIN_BOTTOM != StatusItems[first_item].MARGIN_BOTTOM)
+ if (p->MARGIN_BOTTOM != pFirst->MARGIN_BOTTOM)
DialogSettingForMultiSel.MARGIN_BOTTOM = -1;
- if (StatusItems[real_index].MARGIN_LEFT != StatusItems[first_item].MARGIN_LEFT)
+ if (p->MARGIN_LEFT != pFirst->MARGIN_LEFT)
DialogSettingForMultiSel.MARGIN_LEFT = -1;
- if (StatusItems[real_index].MARGIN_RIGHT != StatusItems[first_item].MARGIN_RIGHT)
+ if (p->MARGIN_RIGHT != pFirst->MARGIN_RIGHT)
DialogSettingForMultiSel.MARGIN_RIGHT = -1;
- if (StatusItems[real_index].MARGIN_TOP != StatusItems[first_item].MARGIN_TOP)
+ if (p->MARGIN_TOP != pFirst->MARGIN_TOP)
DialogSettingForMultiSel.MARGIN_TOP = -1;
- if (StatusItems[real_index].BORDERSTYLE != StatusItems[first_item].BORDERSTYLE)
+ if (p->BORDERSTYLE != pFirst->BORDERSTYLE)
DialogSettingForMultiSel.BORDERSTYLE = -1;
- }
}
- if (last_selcount == 1 && StatusItems[first_item].statusID == ID_EXTBKSEPARATOR) {
+ if (last_selcount == 1 && pFirst->statusID == ID_EXTBKSEPARATOR) {
ChangeControlItems(hwndDlg, 0, 0);
last_selcount = 0;
} else
@@ -624,12 +625,12 @@ static void FillItemList(HWND hwndDlg)
for (n = 0; n <= ID_EXTBK_LAST - ID_EXTBK_FIRST; n++) {
iOff = 0;
- if(strstr(StatusItems[n].szName, "{-}")) {
+ if (strstr(StatusItems[n]->szName, "{-}")) {
item = SendDlgItemMessageA(hwndDlg, IDC_ITEMS, LB_ADDSTRING, 0, (LPARAM)"------------------------");
SendDlgItemMessageA(hwndDlg, IDC_ITEMS, LB_SETITEMDATA, item, ID_EXTBKSEPARATOR);
iOff = 3;
}
- item = SendDlgItemMessageA(hwndDlg, IDC_ITEMS, LB_ADDSTRING, 0, (LPARAM)&StatusItems[n].szName[iOff]);
+ item = SendDlgItemMessageA(hwndDlg, IDC_ITEMS, LB_ADDSTRING, 0, (LPARAM)StatusItems[n]->szName[iOff]);
SendDlgItemMessage(hwndDlg, IDC_ITEMS, LB_SETITEMDATA, item, ID_EXTBK_FIRST + n);
}
}
@@ -637,89 +638,84 @@ static void FillItemList(HWND hwndDlg)
static INT_PTR CALLBACK SkinEdit_ExtBkDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
SKINDESCRIPTION *psd = (SKINDESCRIPTION *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
-
- if(psd) {
+ if (psd) {
ID_EXTBK_FIRST = psd->firstItem;
ID_EXTBK_LAST = psd->lastItem;
StatusItems = psd->StatusItems;
}
+
switch (msg) {
- case WM_INITDIALOG:
- psd = (SKINDESCRIPTION *)malloc(sizeof(SKINDESCRIPTION));
- ZeroMemory(psd, sizeof(SKINDESCRIPTION));
- CopyMemory(psd, (void *)lParam, sizeof(SKINDESCRIPTION));
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)psd);
-
- if(psd) {
- ID_EXTBK_FIRST = psd->firstItem;
- ID_EXTBK_LAST = psd->lastItem;
- StatusItems = psd->StatusItems;
- }
+ case WM_INITDIALOG:
+ psd = (SKINDESCRIPTION *)malloc(sizeof(SKINDESCRIPTION));
+ ZeroMemory(psd, sizeof(SKINDESCRIPTION));
+ CopyMemory(psd, (void *)lParam, sizeof(SKINDESCRIPTION));
+ SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)psd);
+
+ if (psd) {
+ ID_EXTBK_FIRST = psd->firstItem;
+ ID_EXTBK_LAST = psd->lastItem;
+ StatusItems = psd->StatusItems;
+ }
- TranslateDialogDefault(hwndDlg);
- FillItemList(hwndDlg);
- SendMessage(hwndDlg, WM_USER + 101, 0, 0);
+ TranslateDialogDefault(hwndDlg);
+ FillItemList(hwndDlg);
+ SendMessage(hwndDlg, WM_USER + 101, 0, 0);
- psd->hMenuItems = CreatePopupMenu();
- AppendMenu(psd->hMenuItems, MF_STRING | MF_DISABLED, (UINT_PTR)0, LPGENT("Copy from"));
- AppendMenuA(psd->hMenuItems, MF_SEPARATOR, (UINT_PTR)0, NULL);
+ psd->hMenuItems = CreatePopupMenu();
+ AppendMenu(psd->hMenuItems, MF_STRING | MF_DISABLED, (UINT_PTR)0, LPGENT("Copy from"));
+ AppendMenuA(psd->hMenuItems, MF_SEPARATOR, (UINT_PTR)0, NULL);
- {
- int i;
-
- for(i = ID_EXTBK_FIRST; i <= ID_EXTBK_LAST; i++) {
- int iOff = StatusItems[i - ID_EXTBK_FIRST].szName[0] == '{' ? 3 : 0;
- if(iOff)
- AppendMenuA(psd->hMenuItems, MF_SEPARATOR, (UINT_PTR)0, NULL);
- AppendMenuA(psd->hMenuItems, MF_STRING, (UINT_PTR)i, &StatusItems[i - ID_EXTBK_FIRST].szName[iOff]);
- }
- }
- return TRUE;
- case WM_USER + 101:
- {
- DBVARIANT dbv = {0};
-
- SendDlgItemMessage(hwndDlg, IDC_MRGN_LEFT_SPIN, UDM_SETRANGE, 0, MAKELONG(100, 0));
- SendDlgItemMessage(hwndDlg, IDC_MRGN_TOP_SPIN, UDM_SETRANGE, 0, MAKELONG(100, 0));
- SendDlgItemMessage(hwndDlg, IDC_MRGN_RIGHT_SPIN, UDM_SETRANGE, 0, MAKELONG(100, 0));
- SendDlgItemMessage(hwndDlg, IDC_MRGN_BOTTOM_SPIN, UDM_SETRANGE, 0, MAKELONG(100, 0));
- SendDlgItemMessage(hwndDlg, IDC_ALPHASPIN, UDM_SETRANGE, 0, MAKELONG(100, 0));
-
- SendDlgItemMessage(hwndDlg, IDC_BORDERTYPE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("<None>"));
- SendDlgItemMessage(hwndDlg, IDC_BORDERTYPE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Raised"));
- SendDlgItemMessage(hwndDlg, IDC_BORDERTYPE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Sunken"));
- SendDlgItemMessage(hwndDlg, IDC_BORDERTYPE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Bumped"));
- SendDlgItemMessage(hwndDlg, IDC_BORDERTYPE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Etched"));
-
- SendDlgItemMessage(hwndDlg, IDC_3DDARKCOLOR, CPM_SETCOLOUR, 0, DBGetContactSettingDword(NULL, "CLCExt", "3ddark", RGB(224,224,224)));
- SendDlgItemMessage(hwndDlg, IDC_3DLIGHTCOLOR, CPM_SETCOLOUR, 0, DBGetContactSettingDword(NULL, "CLCExt", "3dbright", RGB(224,224,224)));
- return 0;
+ {
+ for (int i = ID_EXTBK_FIRST; i <= ID_EXTBK_LAST; i++) {
+ int iOff = StatusItems[i - ID_EXTBK_FIRST]->szName[0] == '{' ? 3 : 0;
+ if (iOff)
+ AppendMenuA(psd->hMenuItems, MF_SEPARATOR, (UINT_PTR)0, NULL);
+ AppendMenuA(psd->hMenuItems, MF_STRING, (UINT_PTR)i, &StatusItems[i - ID_EXTBK_FIRST]->szName[iOff]);
}
+ }
+ return TRUE;
- case WM_DRAWITEM:
- {
- DRAWITEMSTRUCT *dis = (DRAWITEMSTRUCT *) lParam;
- int iItem = dis->itemData;
- StatusItems_t *item = 0;
+ case WM_USER + 101:
+ SendDlgItemMessage(hwndDlg, IDC_MRGN_LEFT_SPIN, UDM_SETRANGE, 0, MAKELONG(100, 0));
+ SendDlgItemMessage(hwndDlg, IDC_MRGN_TOP_SPIN, UDM_SETRANGE, 0, MAKELONG(100, 0));
+ SendDlgItemMessage(hwndDlg, IDC_MRGN_RIGHT_SPIN, UDM_SETRANGE, 0, MAKELONG(100, 0));
+ SendDlgItemMessage(hwndDlg, IDC_MRGN_BOTTOM_SPIN, UDM_SETRANGE, 0, MAKELONG(100, 0));
+ SendDlgItemMessage(hwndDlg, IDC_ALPHASPIN, UDM_SETRANGE, 0, MAKELONG(100, 0));
+
+ SendDlgItemMessage(hwndDlg, IDC_BORDERTYPE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("<None>"));
+ SendDlgItemMessage(hwndDlg, IDC_BORDERTYPE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Raised"));
+ SendDlgItemMessage(hwndDlg, IDC_BORDERTYPE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Sunken"));
+ SendDlgItemMessage(hwndDlg, IDC_BORDERTYPE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Bumped"));
+ SendDlgItemMessage(hwndDlg, IDC_BORDERTYPE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Etched"));
+
+ SendDlgItemMessage(hwndDlg, IDC_3DDARKCOLOR, CPM_SETCOLOUR, 0, DBGetContactSettingDword(NULL, "CLCExt", "3ddark", RGB(224,224,224)));
+ SendDlgItemMessage(hwndDlg, IDC_3DLIGHTCOLOR, CPM_SETCOLOUR, 0, DBGetContactSettingDword(NULL, "CLCExt", "3dbright", RGB(224,224,224)));
+ return 0;
- SetBkMode(dis->hDC, TRANSPARENT);
- FillRect(dis->hDC, &dis->rcItem, GetSysColorBrush(COLOR_WINDOW));
+ case WM_DRAWITEM:
+ {
+ DRAWITEMSTRUCT *dis = (DRAWITEMSTRUCT *) lParam;
+ int iItem = dis->itemData;
+ StatusItems_t *item = 0;
+
+ SetBkMode(dis->hDC, TRANSPARENT);
+ FillRect(dis->hDC, &dis->rcItem, GetSysColorBrush(COLOR_WINDOW));
- if(iItem >= ID_EXTBK_FIRST && iItem <= ID_EXTBK_LAST)
- item = &StatusItems[iItem - ID_EXTBK_FIRST];
+ if (iItem >= ID_EXTBK_FIRST && iItem <= ID_EXTBK_LAST)
+ item = StatusItems[iItem - ID_EXTBK_FIRST];
- if (dis->itemState & ODS_SELECTED && iItem != ID_EXTBKSEPARATOR) {
+ if (dis->itemState & ODS_SELECTED && iItem != ID_EXTBKSEPARATOR) {
FillRect(dis->hDC, &dis->rcItem, GetSysColorBrush(COLOR_HIGHLIGHT));
SetTextColor(dis->hDC, GetSysColor(COLOR_HIGHLIGHTTEXT));
- }
- else {
+ }
+ else {
FillRect(dis->hDC, &dis->rcItem, GetSysColorBrush(COLOR_WINDOW));
- if(item && item->IGNORED)
- SetTextColor(dis->hDC, RGB(255, 0, 0));
+ if (item && item->IGNORED)
+ SetTextColor(dis->hDC, RGB(255, 0, 0));
else
- SetTextColor(dis->hDC, GetSysColor(COLOR_WINDOWTEXT));
- }
- if(iItem == ID_EXTBKSEPARATOR) {
+ SetTextColor(dis->hDC, GetSysColor(COLOR_WINDOWTEXT));
+ }
+ if (iItem == ID_EXTBKSEPARATOR) {
HPEN hPen, hPenOld;
POINT pt;
@@ -730,124 +726,130 @@ static INT_PTR CALLBACK SkinEdit_ExtBkDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa
LineTo(dis->hDC, dis->rcItem.right, (dis->rcItem.top + dis->rcItem.bottom) / 2);
SelectObject(dis->hDC, hPenOld);
DeleteObject((HGDIOBJ)hPen);
- }
- else if(dis->itemID >= 0 && item) {
+ }
+ else if (dis->itemID >= 0 && item) {
char *szName = item->szName[0] == '{' ? &item->szName[3] : item->szName;
TextOutA(dis->hDC, dis->rcItem.left, dis->rcItem.top, szName, lstrlenA(szName));
- }
- return TRUE;
}
+ return TRUE;
+ }
- case WM_CONTEXTMENU:
- {
- POINT pt;
- RECT rc;
- HWND hwndList = GetDlgItem(hwndDlg, IDC_ITEMS);
+ case WM_CONTEXTMENU:
+ {
+ HWND hwndList = GetDlgItem(hwndDlg, IDC_ITEMS);
- GetCursorPos(&pt);
- GetWindowRect(hwndList, &rc);
- if(PtInRect(&rc, pt)) {
+ POINT pt;
+ GetCursorPos(&pt);
+
+ RECT rc;
+ GetWindowRect(hwndList, &rc);
+
+ if (PtInRect(&rc, pt)) {
int iSelection = (int)TrackPopupMenu(psd->hMenuItems, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL);
- if(iSelection >= ID_EXTBK_FIRST && iSelection <= ID_EXTBK_LAST) {
- iSelection -= ID_EXTBK_FIRST;
-
- for(int i = ID_EXTBK_FIRST; i <= ID_EXTBK_LAST; i++) {
- if(SendMessage(hwndList, LB_GETSEL, i - ID_EXTBK_FIRST, 0) > 0) {
- int iIndex = SendMessage(hwndList, LB_GETITEMDATA, i - ID_EXTBK_FIRST, 0);
- iIndex -= ID_EXTBK_FIRST;
-
- if(iIndex >= 0) {
- StatusItems[iIndex].ALPHA = StatusItems[iSelection].ALPHA;
- StatusItems[iIndex].BORDERSTYLE = StatusItems[iSelection].BORDERSTYLE;
- StatusItems[iIndex].COLOR = StatusItems[iSelection].COLOR;
- StatusItems[iIndex].COLOR2 = StatusItems[iSelection].COLOR2;
- StatusItems[iIndex].COLOR2_TRANSPARENT = StatusItems[iSelection].COLOR2_TRANSPARENT;
- StatusItems[iIndex].CORNER = StatusItems[iSelection].CORNER;
- StatusItems[iIndex].GRADIENT = StatusItems[iSelection].GRADIENT;
- StatusItems[iIndex].IGNORED = StatusItems[iSelection].IGNORED;
- StatusItems[iIndex].imageItem = StatusItems[iSelection].imageItem;
- StatusItems[iIndex].MARGIN_BOTTOM = StatusItems[iSelection].MARGIN_BOTTOM;
- StatusItems[iIndex].MARGIN_LEFT = StatusItems[iSelection].MARGIN_LEFT;
- StatusItems[iIndex].MARGIN_RIGHT = StatusItems[iSelection].MARGIN_RIGHT;
- StatusItems[iIndex].MARGIN_TOP = StatusItems[iSelection].MARGIN_TOP;
- StatusItems[iIndex].TEXTCOLOR = StatusItems[iSelection].TEXTCOLOR;
- }
- }
- }
- OnListItemsChange(hwndDlg);
- }
+ if (iSelection >= ID_EXTBK_FIRST && iSelection <= ID_EXTBK_LAST) {
+ iSelection -= ID_EXTBK_FIRST;
+ StatusItems_t *pSel = StatusItems[iSelection];
+
+ for(int i = ID_EXTBK_FIRST; i <= ID_EXTBK_LAST; i++) {
+ if ( SendMessage(hwndList, LB_GETSEL, i - ID_EXTBK_FIRST, 0) <= 0)
+ continue;
+
+ int iIndex = SendMessage(hwndList, LB_GETITEMDATA, i - ID_EXTBK_FIRST, 0);
+ iIndex -= ID_EXTBK_FIRST;
+ if (iIndex < 0)
+ continue;
+
+ StatusItems_t *p = StatusItems[iIndex];
+ p->ALPHA = pSel->ALPHA;
+ p->BORDERSTYLE = pSel->BORDERSTYLE;
+ p->COLOR = pSel->COLOR;
+ p->COLOR2 = pSel->COLOR2;
+ p->COLOR2_TRANSPARENT = pSel->COLOR2_TRANSPARENT;
+ p->CORNER = pSel->CORNER;
+ p->GRADIENT = pSel->GRADIENT;
+ p->IGNORED = pSel->IGNORED;
+ p->imageItem = pSel->imageItem;
+ p->MARGIN_BOTTOM = pSel->MARGIN_BOTTOM;
+ p->MARGIN_LEFT = pSel->MARGIN_LEFT;
+ p->MARGIN_RIGHT = pSel->MARGIN_RIGHT;
+ p->MARGIN_TOP = pSel->MARGIN_TOP;
+ p->TEXTCOLOR = pSel->TEXTCOLOR;
+ }
+ OnListItemsChange(hwndDlg);
}
- break;
}
- case WM_COMMAND:
- // this will check if the user changed some actual statusitems values
- // if yes the flag bChanged will be set to TRUE
- SetChangedStatusItemFlag(wParam, hwndDlg);
- switch(LOWORD(wParam)) {
- case IDC_ITEMS:
- if (HIWORD(wParam) != LBN_SELCHANGE)
- return FALSE;
- {
- int iItem = SendDlgItemMessage(hwndDlg, IDC_ITEMS, LB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_ITEMS, LB_GETCURSEL, 0, 0), 0);
- if(iItem == ID_EXTBKSEPARATOR)
- return FALSE;
- }
- OnListItemsChange(hwndDlg);
- if(psd->pfnClcOptionsChanged)
- psd->pfnClcOptionsChanged();
- break;
- case IDC_GRADIENT:
- ReActiveCombo(hwndDlg);
- break;
- case IDC_CORNER:
- ReActiveCombo(hwndDlg);
- break;
- case IDC_IGNORE:
- ReActiveCombo(hwndDlg);
- break;
- case IDC_COLOR2_TRANSPARENT:
- ReActiveCombo(hwndDlg);
- break;
- case IDC_BORDERTYPE:
- break;
+ }
+ break;
+
+ case WM_COMMAND:
+ // this will check if the user changed some actual statusitems values
+ // if yes the flag bChanged will be set to TRUE
+ SetChangedStatusItemFlag(wParam, hwndDlg);
+ switch(LOWORD(wParam)) {
+ case IDC_ITEMS:
+ if (HIWORD(wParam) != LBN_SELCHANGE)
+ return FALSE;
+ {
+ int iItem = SendDlgItemMessage(hwndDlg, IDC_ITEMS, LB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_ITEMS, LB_GETCURSEL, 0, 0), 0);
+ if (iItem == ID_EXTBKSEPARATOR)
+ return FALSE;
}
- if ((LOWORD(wParam) == IDC_ALPHA || LOWORD(wParam) == IDC_MRGN_LEFT || LOWORD(wParam) == IDC_MRGN_BOTTOM || LOWORD(wParam) == IDC_MRGN_TOP || LOWORD(wParam) == IDC_MRGN_RIGHT) && (HIWORD(wParam) != EN_CHANGE || (HWND) lParam != GetFocus()))
- return 0;
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ OnListItemsChange(hwndDlg);
+ if (psd->pfnClcOptionsChanged)
+ psd->pfnClcOptionsChanged();
+ break;
+ case IDC_GRADIENT:
+ ReActiveCombo(hwndDlg);
break;
-
- case WM_NOTIFY:
- switch (((LPNMHDR) lParam)->idFrom) {
- case 0:
- switch (((LPNMHDR) lParam)->code) {
- case PSN_APPLY:
+ case IDC_CORNER:
+ ReActiveCombo(hwndDlg);
+ break;
+ case IDC_IGNORE:
+ ReActiveCombo(hwndDlg);
+ break;
+ case IDC_COLOR2_TRANSPARENT:
+ ReActiveCombo(hwndDlg);
+ break;
+ case IDC_BORDERTYPE:
+ break;
+ }
+ if ((LOWORD(wParam) == IDC_ALPHA || LOWORD(wParam) == IDC_MRGN_LEFT || LOWORD(wParam) == IDC_MRGN_BOTTOM || LOWORD(wParam) == IDC_MRGN_TOP || LOWORD(wParam) == IDC_MRGN_RIGHT) && (HIWORD(wParam) != EN_CHANGE || (HWND) lParam != GetFocus()))
+ return 0;
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+
+ case WM_NOTIFY:
+ switch (((LPNMHDR) lParam)->idFrom) {
+ case 0:
+ switch (((LPNMHDR) lParam)->code) {
+ case PSN_APPLY:
// save user made changes
- SaveLatestChanges(hwndDlg);
+ SaveLatestChanges(hwndDlg);
// save struct to DB
- if(psd->pfnSaveCompleteStruct)
- psd->pfnSaveCompleteStruct();
- db_set_dw(NULL, "CLCExt", "3dbright", SendDlgItemMessage(hwndDlg, IDC_3DLIGHTCOLOR, CPM_GETCOLOUR, 0, 0));
- db_set_dw(NULL, "CLCExt", "3ddark", SendDlgItemMessage(hwndDlg, IDC_3DDARKCOLOR, CPM_GETCOLOUR, 0, 0));
-
- if(psd->pfnClcOptionsChanged)
- psd->pfnClcOptionsChanged();
- if(psd->hwndCLUI) {
- SendMessage(psd->hwndCLUI, WM_SIZE, 0, 0);
- PostMessage(psd->hwndCLUI, WM_USER+100, 0, 0); // CLUIINTM_REDRAW
- }
- break;
+ if (psd->pfnSaveCompleteStruct)
+ psd->pfnSaveCompleteStruct();
+ db_set_dw(NULL, "CLCExt", "3dbright", SendDlgItemMessage(hwndDlg, IDC_3DLIGHTCOLOR, CPM_GETCOLOUR, 0, 0));
+ db_set_dw(NULL, "CLCExt", "3ddark", SendDlgItemMessage(hwndDlg, IDC_3DDARKCOLOR, CPM_GETCOLOUR, 0, 0));
+
+ if (psd->pfnClcOptionsChanged)
+ psd->pfnClcOptionsChanged();
+ if (psd->hwndCLUI) {
+ SendMessage(psd->hwndCLUI, WM_SIZE, 0, 0);
+ PostMessage(psd->hwndCLUI, WM_USER+100, 0, 0); // CLUIINTM_REDRAW
}
+ break;
}
- break;
- case WM_DESTROY:
- DestroyMenu(psd->hMenuItems);
- break;
- case WM_NCDESTROY:
- free(psd);
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)0);
- break;
+ }
+ break;
+ case WM_DESTROY:
+ DestroyMenu(psd->hMenuItems);
+ break;
+ case WM_NCDESTROY:
+ free(psd);
+ SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)0);
+ break;
}
return FALSE;
}
@@ -863,7 +865,7 @@ static BOOL CALLBACK SkinEdit_ImageItemEditProc(HWND hwndDlg, UINT msg, WPARAM w
static INT_PTR SkinEdit_FillByCurrentSel(WPARAM wParam, LPARAM lParam)
{
- if(wParam)
+ if (wParam)
FillOptionDialogByCurrentSel((HWND)wParam);
return 0;
}
@@ -881,7 +883,7 @@ static INT_PTR SkinEdit_Invoke(WPARAM wParam, LPARAM lParam)
RECT rcClient;
int iTabs;
- if(psd->cbSize != sizeof(SKINDESCRIPTION))
+ if (psd->cbSize != sizeof(SKINDESCRIPTION))
return 0;
iTabs = TabCtrl_GetItemCount(psd->hWndTab);
@@ -939,9 +941,9 @@ extern "C" int __declspec(dllexport) Load(void)
static int ShutdownProc(WPARAM wParam, LPARAM lParam)
{
- if(hSvc_invoke)
+ if (hSvc_invoke)
DestroyServiceFunction(hSvc_invoke);
- if(hSvc_fillby)
+ if (hSvc_fillby)
DestroyServiceFunction(hSvc_fillby);
return 0;
}
diff --git a/plugins/Clist_nicer/src/CLCButton.cpp b/plugins/Clist_nicer/src/CLCButton.cpp
index 93f1275bb7..9d4afe9b5b 100644
--- a/plugins/Clist_nicer/src/CLCButton.cpp
+++ b/plugins/Clist_nicer/src/CLCButton.cpp
@@ -220,7 +220,7 @@ static void PaintWorker(MButtonExtension *ctl, HDC hdcPaint)
item_id = ctl->stateId == PBS_HOT ? ID_EXTBKTBBUTTONMOUSEOVER : (ctl->stateId == PBS_PRESSED ? ID_EXTBKTBBUTTONSPRESSED : ID_EXTBKTBBUTTONSNPRESSED);
else
item_id = ctl->stateId == PBS_HOT ? ID_EXTBKBUTTONSMOUSEOVER : (ctl->stateId == PBS_PRESSED ? ID_EXTBKBUTTONSPRESSED : ID_EXTBKBUTTONSNPRESSED);
- item = &StatusItems[item_id - ID_STATUS_OFFLINE];
+ item = arStatusItems[item_id - ID_STATUS_OFFLINE];
SetTextColor(hdcMem, item->TEXTCOLOR);
if (item->IGNORED) {
diff --git a/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp b/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp
index 8ad09efc9c..e8c41ab051 100644
--- a/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp
+++ b/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp
@@ -28,7 +28,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
HFONT __fastcall ChangeToFont(HDC hdc, struct ClcData *dat, int id, int *fontHeight);
extern HWND g_hwndViewModeFrame, g_hwndEventArea;
-extern StatusItems_t *StatusItems;
extern int mf_updatethread_running;
extern DWORD WINAPI MF_UpdateThread(LPVOID p);
@@ -1137,7 +1136,7 @@ INT_PTR CLUIFramesSetFrameOptions(WPARAM wParam, LPARAM lParam)
}
if (Frames[pos].Skinned) {
int uID = (Frames[pos].TitleBar.ShowTitleBar ? ID_EXTBKOWNEDFRAMEBORDERTB - ID_STATUS_OFFLINE : ID_EXTBKOWNEDFRAMEBORDER - ID_STATUS_OFFLINE);
- lParam += (StatusItems[uID].MARGIN_BOTTOM + StatusItems[uID].MARGIN_TOP);
+ lParam += (arStatusItems[uID]->MARGIN_BOTTOM + arStatusItems[uID]->MARGIN_TOP);
}
if (Frames[pos].collapsed) {
int oldHeight = Frames[pos].height;
@@ -1694,10 +1693,7 @@ int FrameNCPaint(HWND hwnd, WNDPROC oldWndProc, WPARAM wParam, LPARAM lParam, BO
if (pcli && pcli->hwndContactList && GetParent(hwnd) == pcli->hwndContactList) {
if (GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_SKINNEDFRAME) {
- StatusItems_t *item = StatusItems ? (hasTitleBar ? &StatusItems[ID_EXTBKOWNEDFRAMEBORDERTB - ID_STATUS_OFFLINE] : &StatusItems[ID_EXTBKOWNEDFRAMEBORDER - ID_STATUS_OFFLINE]) : 0;
- HDC realDC;
- HBITMAP hbmDraw, hbmOld;
-
+ StatusItems_t *item = (arStatusItems.getCount() != 0) ? (hasTitleBar ? arStatusItems[ID_EXTBKOWNEDFRAMEBORDERTB - ID_STATUS_OFFLINE] : arStatusItems[ID_EXTBKOWNEDFRAMEBORDER - ID_STATUS_OFFLINE]) : 0;
if (item == 0)
return 0;
@@ -1706,7 +1702,8 @@ int FrameNCPaint(HWND hwnd, WNDPROC oldWndProc, WPARAM wParam, LPARAM lParam, BO
rc.right = rcWindow.right - rcWindow.left;
rc.bottom = rcWindow.bottom - rcWindow.top;
- hdc = realDC = GetWindowDC(hwnd);
+ HBITMAP hbmDraw, hbmOld;
+ HDC realDC = hdc = GetWindowDC(hwnd);
if (hwnd == pcli->hwndContactTree) {
realDC = CreateCompatibleDC(hdc);
hbmDraw = CreateCompatibleBitmap(hdc, rc.right, rc.bottom);
@@ -1717,8 +1714,8 @@ int FrameNCPaint(HWND hwnd, WNDPROC oldWndProc, WPARAM wParam, LPARAM lParam, BO
BitBlt(realDC, 0, 0, rc.right - rc.left, rc.bottom - rc.top, cfg::dat.hdcBg, rcWindow.left - cfg::dat.ptW.x, rcWindow.top - cfg::dat.ptW.y, SRCCOPY);
- DrawAlpha(realDC, &rc, item->COLOR, item->ALPHA, item->COLOR2, item->COLOR2_TRANSPARENT, item->GRADIENT,
- item->CORNER, item->BORDERSTYLE, item->imageItem);
+ DrawAlpha(realDC, &rc, item->COLOR, item->ALPHA, item->COLOR2, item->COLOR2_TRANSPARENT, item->GRADIENT, item->CORNER, item->BORDERSTYLE, item->imageItem);
+
if (hwnd == pcli->hwndContactTree) {
ExcludeClipRect(hdc, item->MARGIN_LEFT, item->MARGIN_TOP, rc.right - item->MARGIN_RIGHT, rc.bottom - item->MARGIN_BOTTOM);
BitBlt(hdc, 0, 0, rc.right, rc.bottom, realDC, 0, 0, SRCCOPY);
@@ -1728,17 +1725,16 @@ int FrameNCPaint(HWND hwnd, WNDPROC oldWndProc, WPARAM wParam, LPARAM lParam, BO
}
ReleaseDC(hwnd, hdc);
return 0;
- } else if (GetWindowLongPtr(hwnd, GWL_STYLE) & WS_BORDER) {
- HPEN hPenOld;
- HBRUSH brold;
-
+ }
+
+ if ( GetWindowLongPtr(hwnd, GWL_STYLE) & WS_BORDER) {
hdc = GetWindowDC(hwnd);
- hPenOld = reinterpret_cast<HPEN>(SelectObject(hdc, g_hPenCLUIFrames));
+ HPEN hPenOld = reinterpret_cast<HPEN>(SelectObject(hdc, g_hPenCLUIFrames));
GetWindowRect(hwnd, &rcWindow);
rc.left = rc.top = 0;
rc.right = rcWindow.right - rcWindow.left;
rc.bottom = rcWindow.bottom - rcWindow.top;
- brold = reinterpret_cast<HBRUSH>(SelectObject(hdc, GetStockObject(HOLLOW_BRUSH)));
+ HBRUSH brold = reinterpret_cast<HBRUSH>(SelectObject(hdc, GetStockObject(HOLLOW_BRUSH)));
Rectangle(hdc, 0, 0, rcWindow.right - rcWindow.left, rcWindow.bottom - rcWindow.top);
SelectObject(hdc, hPenOld);
SelectObject(hdc, brold);
@@ -1751,7 +1747,7 @@ int FrameNCPaint(HWND hwnd, WNDPROC oldWndProc, WPARAM wParam, LPARAM lParam, BO
int FrameNCCalcSize(HWND hwnd, WNDPROC oldWndProc, WPARAM wParam, LPARAM lParam, BOOL hasTitleBar)
{
- StatusItems_t *item = StatusItems ? (hasTitleBar ? &StatusItems[ID_EXTBKOWNEDFRAMEBORDERTB - ID_STATUS_OFFLINE] : &StatusItems[ID_EXTBKOWNEDFRAMEBORDER - ID_STATUS_OFFLINE]) : 0;
+ StatusItems_t *item = (arStatusItems.getCount() != 0) ? (hasTitleBar ? arStatusItems[ID_EXTBKOWNEDFRAMEBORDERTB - ID_STATUS_OFFLINE] : arStatusItems[ID_EXTBKOWNEDFRAMEBORDER - ID_STATUS_OFFLINE]) : 0;
LRESULT orig = oldWndProc ? CallWindowProc(oldWndProc, hwnd, WM_NCCALCSIZE, wParam, lParam) : 0;
NCCALCSIZE_PARAMS *nccp = (NCCALCSIZE_PARAMS *)lParam;
DWORD dwStyle = GetWindowLongPtr(hwnd, GWL_STYLE);
@@ -2497,7 +2493,7 @@ static int DrawTitleBar(HDC dc, RECT rect, int Frameid)
HBITMAP hBmpOsb, hoBmp;
HBRUSH hBack, hoBrush;
int pos;
- StatusItems_t *item = &StatusItems[ID_EXTBKFRAMETITLE - ID_STATUS_OFFLINE];
+ StatusItems_t *item = arStatusItems[ID_EXTBKFRAMETITLE - ID_STATUS_OFFLINE];
/*
* no need to redraw anything while shutting down
diff --git a/plugins/Clist_nicer/src/Include/commonheaders.h b/plugins/Clist_nicer/src/Include/commonheaders.h
index aa3d51c812..d92f07724b 100644
--- a/plugins/Clist_nicer/src/Include/commonheaders.h
+++ b/plugins/Clist_nicer/src/Include/commonheaders.h
@@ -52,6 +52,7 @@
#include <win2k.h>
#include <m_clistint.h>
#include <m_database.h>
+#include <m_system_cpp.h>
#include <m_langpack.h>
#include <m_avatars.h>
#include <m_button.h>
@@ -175,7 +176,7 @@
// shared vars
extern HINSTANCE g_hInst;
extern LONG g_cxsmIcon, g_cysmIcon;
-extern StatusItems_t *StatusItems;
+extern LIST<StatusItems_t> arStatusItems;
extern ImageItem *g_glyphItem;
/* most free()'s are invalid when the code is executed from a dll, so this changes
diff --git a/plugins/Clist_nicer/src/Include/m_cln_skinedit.h b/plugins/Clist_nicer/src/Include/m_cln_skinedit.h
index a1e69bb6e1..a643363d70 100644
--- a/plugins/Clist_nicer/src/Include/m_cln_skinedit.h
+++ b/plugins/Clist_nicer/src/Include/m_cln_skinedit.h
@@ -98,7 +98,7 @@ typedef struct {
typedef struct _tagSkinDescription {
DWORD cbSize;
- StatusItems_t *StatusItems;
+ StatusItems_t **StatusItems;
int lastItem;
int firstItem;
char szModule[100];
diff --git a/plugins/Clist_nicer/src/alphablend.cpp b/plugins/Clist_nicer/src/alphablend.cpp
index eb46d4c437..ddd40dbc3c 100644
--- a/plugins/Clist_nicer/src/alphablend.cpp
+++ b/plugins/Clist_nicer/src/alphablend.cpp
@@ -27,7 +27,6 @@ extern int g_hottrack, g_hottrack_done;
extern BOOL g_inCLCpaint;
extern BYTE saved_alpha;
extern DWORD savedCORNER;
-extern StatusItems_t *StatusItems;
extern ImageItem *g_glyphItem;
BYTE __forceinline percent_to_byte(UINT32 percent)
@@ -112,7 +111,7 @@ void DrawAlpha(HDC hdcwnd, PRECT rc, DWORD basecolor, int alpha, DWORD basecolor
LONG realHeightHalf = realHeight >> 1;
if (g_hottrack && g_inCLCpaint) {
- StatusItems_t *ht = &StatusItems[ID_EXTBKHOTTRACK - ID_STATUS_OFFLINE];
+ StatusItems_t *ht = arStatusItems[ID_EXTBKHOTTRACK - ID_STATUS_OFFLINE];
if (ht->IGNORED == 0) {
basecolor = ht->COLOR;
basecolor2 = ht->COLOR2;
diff --git a/plugins/Clist_nicer/src/clc.cpp b/plugins/Clist_nicer/src/clc.cpp
index 6d80e49cfd..99e1ff7668 100644
--- a/plugins/Clist_nicer/src/clc.cpp
+++ b/plugins/Clist_nicer/src/clc.cpp
@@ -43,7 +43,6 @@ extern wndFrame *wndFrameCLC;
extern ButtonItem *g_ButtonItems;
extern int during_sizing;
-extern StatusItems_t *StatusItems;
HIMAGELIST hCListImages;
@@ -219,21 +218,21 @@ int ClcShutdown(WPARAM wParam, LPARAM lParam)
free(cfg::eCache[i].statusMsg);
if (cfg::eCache[i].status_item) {
StatusItems_t *item = cfg::eCache[i].status_item;
- int j;
free(cfg::eCache[i].status_item);
cfg::eCache[i].status_item = 0;
- for (j = i; j < cfg::nextCacheEntry; j++) { // avoid duplicate free()'ing status item pointers (there are references from sub to master contacts, so compare the pointers...
+ for (int j = i; j < cfg::nextCacheEntry; j++) // avoid duplicate free()'ing status item pointers (there are references from sub to master contacts, so compare the pointers...
if (cfg::eCache[j].status_item == item)
cfg::eCache[j].status_item = 0;
- }
}
}
free(cfg::eCache);
cfg::eCache = NULL;
}
IMG_DeleteItems();
- free(StatusItems);
+ for (int i=0; i < arStatusItems.getCount(); i++)
+ mir_free(arStatusItems[i]);
+ arStatusItems.destroy();
DeleteCriticalSection(&cfg::cachecs);
return 0;
}
diff --git a/plugins/Clist_nicer/src/clcpaint.cpp b/plugins/Clist_nicer/src/clcpaint.cpp
index dddabc259a..0fd6cc0921 100644
--- a/plugins/Clist_nicer/src/clcpaint.cpp
+++ b/plugins/Clist_nicer/src/clcpaint.cpp
@@ -45,7 +45,6 @@ extern HICON overlayicons[];
extern TCHAR *statusNames[];
extern LONG g_cxsmIcon, g_cysmIcon;
-extern StatusItems_t *StatusItems;
int g_hottrack, g_center, g_ignoreselforgroups, g_selectiveIcon, g_hottrack_done;
HWND g_focusWnd;
@@ -266,7 +265,7 @@ static int __fastcall DrawAvatar(HDC hdcMem, RECT *rc, ClcContact *contact, int
HRGN rgn = 0;
int avatar_size = cfg::dat.avatarSize;
DWORD av_saved_left;
- StatusItems_t *item = contact->wStatus == ID_STATUS_OFFLINE ? &StatusItems[ID_EXTBKAVATARFRAMEOFFLINE - ID_STATUS_OFFLINE] : &StatusItems[ID_EXTBKAVATARFRAME - ID_STATUS_OFFLINE];
+ StatusItems_t *item = contact->wStatus == ID_STATUS_OFFLINE ? arStatusItems[ID_EXTBKAVATARFRAMEOFFLINE - ID_STATUS_OFFLINE] : arStatusItems[ID_EXTBKAVATARFRAME - ID_STATUS_OFFLINE];
int skinMarginX, skinMarginY;
BOOL fOverlay = (cfg::dat.dwFlags & CLUI_FRAME_OVERLAYICONS);
@@ -565,10 +564,10 @@ set_bg_l:
if (cstatus >= ID_STATUS_OFFLINE && cstatus <= ID_STATUS_OUTTOLUNCH) {
BYTE perstatus_ignored;
- if ((flags & CONTACTF_IDLE) && !StatusItems[ID_EXTBKIDLE - ID_STATUS_OFFLINE].IGNORED)
- sitem = &StatusItems[ID_EXTBKIDLE - ID_STATUS_OFFLINE];
+ if ((flags & CONTACTF_IDLE) && !arStatusItems[ID_EXTBKIDLE - ID_STATUS_OFFLINE]->IGNORED)
+ sitem = arStatusItems[ID_EXTBKIDLE - ID_STATUS_OFFLINE];
else
- sitem = &StatusItems[cstatus - ID_STATUS_OFFLINE];
+ sitem = arStatusItems[cstatus - ID_STATUS_OFFLINE];
if ( !dat->bisEmbedded) {
pp_item = cEntry->status_item ? cEntry->status_item : cEntry->proto_status_item;
@@ -585,15 +584,15 @@ set_bg_l:
else if ( !sitem->IGNORED)
SetTextColor(hdcMem, sitem->TEXTCOLOR);
- sevencontact_pos = &StatusItems[ID_EXTBKEVEN_CNTCTPOS - ID_STATUS_OFFLINE];
- soddcontact_pos = &StatusItems[ID_EXTBKODD_CNTCTPOS - ID_STATUS_OFFLINE];
- sfirstitem = &StatusItems[ID_EXTBKFIRSTITEM - ID_STATUS_OFFLINE];
- ssingleitem = &StatusItems[ID_EXTBKSINGLEITEM - ID_STATUS_OFFLINE];
- slastitem = &StatusItems[ID_EXTBKLASTITEM - ID_STATUS_OFFLINE];
+ sevencontact_pos = arStatusItems[ID_EXTBKEVEN_CNTCTPOS - ID_STATUS_OFFLINE];
+ soddcontact_pos = arStatusItems[ID_EXTBKODD_CNTCTPOS - ID_STATUS_OFFLINE];
+ sfirstitem = arStatusItems[ID_EXTBKFIRSTITEM - ID_STATUS_OFFLINE];
+ ssingleitem = arStatusItems[ID_EXTBKSINGLEITEM - ID_STATUS_OFFLINE];
+ slastitem = arStatusItems[ID_EXTBKLASTITEM - ID_STATUS_OFFLINE];
- sfirstitem_NG = &StatusItems[ID_EXTBKFIRSTITEM_NG - ID_STATUS_OFFLINE];
- ssingleitem_NG = &StatusItems[ID_EXTBKSINGLEITEM_NG - ID_STATUS_OFFLINE];
- slastitem_NG = &StatusItems[ID_EXTBKLASTITEM_NG - ID_STATUS_OFFLINE];
+ sfirstitem_NG = arStatusItems[ID_EXTBKFIRSTITEM_NG - ID_STATUS_OFFLINE];
+ ssingleitem_NG = arStatusItems[ID_EXTBKSINGLEITEM_NG - ID_STATUS_OFFLINE];
+ slastitem_NG = arStatusItems[ID_EXTBKLASTITEM_NG - ID_STATUS_OFFLINE];
rc.left = sitem->MARGIN_LEFT + bg_indent_l;
rc.top = y + sitem->MARGIN_TOP;
@@ -775,9 +774,9 @@ set_bg_l:
}
if (type == CLCIT_GROUP) {
- StatusItems_t *sempty = &StatusItems[ID_EXTBKEMPTYGROUPS - ID_STATUS_OFFLINE];
- StatusItems_t *sexpanded = &StatusItems[ID_EXTBKEXPANDEDGROUP - ID_STATUS_OFFLINE];
- StatusItems_t *scollapsed = &StatusItems[ID_EXTBKCOLLAPSEDDGROUP - ID_STATUS_OFFLINE];
+ StatusItems_t *sempty = arStatusItems[ID_EXTBKEMPTYGROUPS - ID_STATUS_OFFLINE];
+ StatusItems_t *sexpanded = arStatusItems[ID_EXTBKEXPANDEDGROUP - ID_STATUS_OFFLINE];
+ StatusItems_t *scollapsed = arStatusItems[ID_EXTBKCOLLAPSEDDGROUP - ID_STATUS_OFFLINE];
ChangeToFont(hdcMem, dat, FONTID_GROUPS, &fontHeight);
if (contact->group->cl.count == 0) {
@@ -814,7 +813,7 @@ set_bg_l:
}
}
if (selected) {
- StatusItems_t *sselected = &StatusItems[ID_EXTBKSELECTION - ID_STATUS_OFFLINE];
+ StatusItems_t *sselected = arStatusItems[ID_EXTBKSELECTION - ID_STATUS_OFFLINE];
if ( !g_ignoreselforgroups || type != CLCIT_GROUP) {
if ( !sselected->IGNORED) {
@@ -840,7 +839,7 @@ set_bg_l:
}
}
else if (g_hottrack) {
- StatusItems_t *ht = &StatusItems[ID_EXTBKHOTTRACK - ID_STATUS_OFFLINE];
+ StatusItems_t *ht = arStatusItems[ID_EXTBKHOTTRACK - ID_STATUS_OFFLINE];
SetHotTrackColour(hdcMem, dat);
if (ht->IGNORED == 0)
diff --git a/plugins/Clist_nicer/src/clistevents.cpp b/plugins/Clist_nicer/src/clistevents.cpp
index 12449d3adb..63cb6bb9d3 100644
--- a/plugins/Clist_nicer/src/clistevents.cpp
+++ b/plugins/Clist_nicer/src/clistevents.cpp
@@ -32,8 +32,6 @@ extern wndFrame *wndFrameEventArea;
extern HPEN g_hPenCLUIFrames;
-extern StatusItems_t *StatusItems;
-
HWND g_hwndEventArea = 0;
struct CListEvent {
@@ -215,7 +213,7 @@ LRESULT CALLBACK EventAreaWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa
if (cfg::dat.bWallpaperMode)
SkinDrawBg(hwnd, hdcMem);
- item = &StatusItems[ID_EXTBKEVTAREA - ID_STATUS_OFFLINE];
+ item = arStatusItems[ID_EXTBKEVTAREA - ID_STATUS_OFFLINE];
if (item->IGNORED) {
FillRect(hdcMem, &rc, GetSysColorBrush(COLOR_3DFACE));
}
@@ -299,7 +297,7 @@ struct CListEvent* AddEvent(CLISTEVENT *cle)
mii.dwItemData = (ULONG_PTR) nmi;
mii.wID = cfg::dat.wNextMenuID;
SetMenuItemInfo(cfg::dat.hMenuNotify, cfg::dat.wNextMenuID, FALSE, &mii);
- p-> menuId = cfg::dat.wNextMenuID;
+ p->menuId = cfg::dat.wNextMenuID;
cfg::dat.wNextMenuID++;
if (cfg::dat.wNextMenuID > 0x7fff)
cfg::dat.wNextMenuID = 1;
diff --git a/plugins/Clist_nicer/src/clui.cpp b/plugins/Clist_nicer/src/clui.cpp
index 5da598e932..e371b70a0a 100644
--- a/plugins/Clist_nicer/src/clui.cpp
+++ b/plugins/Clist_nicer/src/clui.cpp
@@ -61,7 +61,6 @@ extern HWND g_hwndViewModeFrame, g_hwndEventArea;
extern ImageItem *g_CLUIImageItem;
extern HBRUSH g_CLUISkinnedBkColor;
-extern StatusItems_t *StatusItems;
extern HWND g_hwndSFL;
extern ButtonItem *g_ButtonItems;
extern COLORREF g_CLUISkinnedBkColorRGB;
@@ -626,7 +625,7 @@ static void sttProcessResize(HWND hwnd, NMCLISTCONTROL *nmc)
if (winstyle & CLS_SKINNEDFRAME) {
BOOL hasTitleBar = wndFrameCLC ? wndFrameCLC->TitleBar.ShowTitleBar : 0;
- StatusItems_t *item = &StatusItems[(hasTitleBar ? ID_EXTBKOWNEDFRAMEBORDERTB : ID_EXTBKOWNEDFRAMEBORDER) - ID_STATUS_OFFLINE];
+ StatusItems_t *item = arStatusItems[(hasTitleBar ? ID_EXTBKOWNEDFRAMEBORDERTB : ID_EXTBKOWNEDFRAMEBORDER) - ID_STATUS_OFFLINE];
skinHeight = item->IGNORED ? 0 : item->MARGIN_BOTTOM + item->MARGIN_TOP;
}
@@ -704,7 +703,7 @@ int CustomDrawScrollBars(NMCSBCUSTOMDRAW *nmcsbcd)
}
uItemID -= ID_STATUS_OFFLINE;
- item = &StatusItems[uItemID];
+ item = arStatusItems[uItemID];
if ( !item->IGNORED) {
int alpha = nmcsbcd->uState == CDIS_DISABLED ? item->ALPHA - 50 : item->ALPHA;
DrawAlpha(hdcScroll, &nmcsbcd->rect, item->COLOR, alpha, item->COLOR2, item->COLOR2_TRANSPARENT,
@@ -715,9 +714,9 @@ int CustomDrawScrollBars(NMCSBCUSTOMDRAW *nmcsbcd)
(nmcsbcd->uState == CDIS_SELECTED ? DFCS_PUSHED : 0)));
if (nmcsbcd->uItem == HTSCROLL_UP)
- arrowItem = &StatusItems[ID_EXTBKSCROLLARROWUP - ID_STATUS_OFFLINE];
+ arrowItem = arStatusItems[ID_EXTBKSCROLLARROWUP - ID_STATUS_OFFLINE];
if (nmcsbcd->uItem == HTSCROLL_DOWN)
- arrowItem = &StatusItems[ID_EXTBKSCROLLARROWDOWN - ID_STATUS_OFFLINE];
+ arrowItem = arStatusItems[ID_EXTBKSCROLLARROWDOWN - ID_STATUS_OFFLINE];
if (arrowItem && !arrowItem->IGNORED)
DrawAlpha(hdcScroll, &nmcsbcd->rect, arrowItem->COLOR, arrowItem->ALPHA, arrowItem->COLOR2, arrowItem->COLOR2_TRANSPARENT,
arrowItem->GRADIENT, arrowItem->CORNER, arrowItem->BORDERSTYLE, arrowItem->imageItem);
diff --git a/plugins/Clist_nicer/src/extBackg.cpp b/plugins/Clist_nicer/src/extBackg.cpp
index 651995a52c..771e36bba0 100644
--- a/plugins/Clist_nicer/src/extBackg.cpp
+++ b/plugins/Clist_nicer/src/extBackg.cpp
@@ -28,7 +28,7 @@ extern int g_hottrack;
extern HWND g_hwndViewModeFrame;
-StatusItems_t *StatusItems = NULL;
+LIST<StatusItems_t> arStatusItems(10);
ImageItem *g_ImageItems = NULL, *g_glyphItem = NULL;
ButtonItem *g_ButtonItems = NULL;
ImageItem *g_CLUIImageItem = NULL;
@@ -243,8 +243,11 @@ static StatusItems_t _StatusItems[] = {
BOOL __forceinline GetItemByStatus(int status, StatusItems_t *retitem)
{
- status = (status >= ID_STATUS_OFFLINE && status <= ID_EXTBK_LAST) ? status : ID_STATUS_OFFLINE; // better check the index...
- *retitem = StatusItems[status - ID_STATUS_OFFLINE];
+ int idx = status - ID_STATUS_OFFLINE; // better check the index...
+ if ( idx < 0 || idx >= arStatusItems.getCount())
+ idx = 0;
+
+ *retitem = *arStatusItems[idx];
if (g_hottrack && status != ID_EXTBKHOTTRACK) // allow hottracking for ignored items, unless hottrack item itself should be ignored
retitem->IGNORED = FALSE;
return TRUE;
@@ -252,14 +255,13 @@ BOOL __forceinline GetItemByStatus(int status, StatusItems_t *retitem)
StatusItems_t *GetProtocolStatusItem(const char *szProto)
{
- int i;
-
if (szProto == NULL)
return NULL;
- for (i = ID_EXTBK_LAST_D - ID_STATUS_OFFLINE + 1; i <= ID_EXTBK_LAST - ID_STATUS_OFFLINE; i++) {
- if ( !strcmp(StatusItems[i].szName[0] == '{' ? &StatusItems[i].szName[3] : StatusItems[i].szName, szProto))
- return &StatusItems[i];
+ for (int i = SIZEOF(_StatusItems); i < arStatusItems.getCount(); i++) {
+ StatusItems_t *p = arStatusItems[i];
+ if ( !strcmp(p->szName[0] == '{' ? p->szName+3 : p->szName, szProto))
+ return p;
}
return NULL;
}
@@ -267,93 +269,61 @@ StatusItems_t *GetProtocolStatusItem(const char *szProto)
// fills the struct with the settings in the database
void LoadExtBkSettingsFromDB()
{
- DWORD ret;
- int n;
- char buffer[255];
- int protoCount = 0, i;
- PROTOACCOUNT **accs = 0;
- DBVARIANT dbv = {0};
+ int i, n;
+ for (i=0; i < SIZEOF(_StatusItems); i++) {
+ StatusItems_t *p = (StatusItems_t*)mir_alloc( sizeof(StatusItems_t));
+ *p = _StatusItems[i];
+ arStatusItems.insert(p);
+ }
+ int protoCount;
+ PROTOACCOUNT **accs;
ProtoEnumAccounts( &protoCount, &accs );
- StatusItems = (StatusItems_t *)malloc(sizeof(StatusItems_t) * ((ID_EXTBK_LAST - ID_STATUS_OFFLINE) + protoCount + 2));
- CopyMemory(StatusItems, _StatusItems, sizeof(_StatusItems));
-
for (i = 0; i < protoCount; i++) {
+ StatusItems_t *p = (StatusItems_t*)mir_alloc( sizeof(StatusItems_t));
+ *p = _StatusItems[0];
ID_EXTBK_LAST++;
- CopyMemory(&StatusItems[ID_EXTBK_LAST - ID_STATUS_OFFLINE], &StatusItems[0], sizeof(StatusItems_t));
- mir_snprintf(StatusItems[ID_EXTBK_LAST - ID_STATUS_OFFLINE].szDBname, 30, "EXBK_%s", accs[i]->szModuleName );
+
+ mir_snprintf(p->szDBname, 30, "EXBK_%s", accs[i]->szModuleName );
if (i == 0) {
- lstrcpynA(StatusItems[ID_EXTBK_LAST - ID_STATUS_OFFLINE].szName, "{-}", 30);
- strncat(StatusItems[ID_EXTBK_LAST - ID_STATUS_OFFLINE].szName, accs[i]->szModuleName, 30);
+ lstrcpynA(p->szName, "{-}", 30);
+ strncat(p->szName, accs[i]->szModuleName, 30);
}
- else
- lstrcpynA(StatusItems[ID_EXTBK_LAST - ID_STATUS_OFFLINE].szName, accs[i]->szModuleName, 30);
- StatusItems[ID_EXTBK_LAST - ID_STATUS_OFFLINE].statusID = ID_EXTBK_LAST;
+ else lstrcpynA(p->szName, accs[i]->szModuleName, 30);
+ p->statusID = ID_EXTBK_LAST;
+ arStatusItems.insert(p);
}
- for (n = 0; n <= ID_EXTBK_LAST - ID_STATUS_OFFLINE; n++) {
- if (StatusItems[n].statusID != ID_EXTBKSEPARATOR) {
- StatusItems[n].imageItem = 0;
- lstrcpyA(buffer, StatusItems[n].szDBname); lstrcatA(buffer, "_IGNORE");
- ret = cfg::getByte("CLCExt", buffer, StatusItems[n].IGNORED);
- StatusItems[n]. IGNORED = (BYTE) ret;
-
- lstrcpyA(buffer, StatusItems[n].szDBname); lstrcatA(buffer, "_GRADIENT");
- ret = cfg::getDword("CLCExt", buffer, StatusItems[n].GRADIENT);
- StatusItems[n]. GRADIENT = (BYTE) ret;
-
- lstrcpyA(buffer, StatusItems[n].szDBname); lstrcatA(buffer, "_CORNER");
- ret = cfg::getDword("CLCExt", buffer, StatusItems[n].CORNER);
- StatusItems[n]. CORNER = (BYTE) ret;
-
- lstrcpyA(buffer, StatusItems[n].szDBname); lstrcatA(buffer, "_COLOR");
- ret = cfg::getDword("CLCExt", buffer, StatusItems[n].COLOR);
- StatusItems[n]. COLOR = ret;
-
- lstrcpyA(buffer, StatusItems[n].szDBname); lstrcatA(buffer, "_COLOR2");
- ret = cfg::getDword(NULL, "CLCExt", buffer, StatusItems[n].COLOR2);
- StatusItems[n]. COLOR2 = ret;
-
- lstrcpyA(buffer, StatusItems[n].szDBname); lstrcatA(buffer, "_COLOR2_TRANSPARENT");
- ret = cfg::getByte("CLCExt", buffer, StatusItems[n].COLOR2_TRANSPARENT);
- StatusItems[n]. COLOR2_TRANSPARENT = (BYTE) ret;
-
- lstrcpyA(buffer, StatusItems[n].szDBname); lstrcatA(buffer, "_TEXTCOLOR");
- ret = cfg::getDword("CLCExt", buffer, StatusItems[n].TEXTCOLOR);
- StatusItems[n]. TEXTCOLOR = ret;
-
- lstrcpyA(buffer, StatusItems[n].szDBname); lstrcatA(buffer, "_ALPHA");
- ret = cfg::getByte("CLCExt", buffer, StatusItems[n].ALPHA);
- StatusItems[n]. ALPHA = ret;
-
- lstrcpyA(buffer, StatusItems[n].szDBname); lstrcatA(buffer, "_MRGN_LEFT");
- ret = cfg::getByte("CLCExt", buffer, StatusItems[n].MARGIN_LEFT);
- StatusItems[n]. MARGIN_LEFT = ret;
-
- lstrcpyA(buffer, StatusItems[n].szDBname); lstrcatA(buffer, "_MRGN_TOP");
- ret = cfg::getByte("CLCExt", buffer, StatusItems[n].MARGIN_TOP);
- StatusItems[n]. MARGIN_TOP = ret;
-
- lstrcpyA(buffer, StatusItems[n].szDBname); lstrcatA(buffer, "_MRGN_RIGHT");
- ret = cfg::getByte("CLCExt", buffer, StatusItems[n].MARGIN_RIGHT);
- StatusItems[n]. MARGIN_RIGHT = ret;
-
- lstrcpyA(buffer, StatusItems[n].szDBname); lstrcatA(buffer, "_MRGN_BOTTOM");
- ret = cfg::getByte("CLCExt", buffer, StatusItems[n].MARGIN_BOTTOM);
- StatusItems[n]. MARGIN_BOTTOM = ret;
-
- lstrcpyA(buffer, StatusItems[n].szDBname); lstrcatA(buffer, "_BDRSTYLE");
- ret = cfg::getDword("CLCExt", buffer, StatusItems[n].BORDERSTYLE);
- StatusItems[n]. BORDERSTYLE = ret;
- }
+
+ for (n = 0; n < arStatusItems.getCount(); n++) {
+ StatusItems_t *p = arStatusItems[n];
+ if (p->statusID == ID_EXTBKSEPARATOR)
+ continue;
+
+ p->imageItem = 0;
+ char buffer[255], *pszEnd = buffer + mir_snprintf(buffer, SIZEOF(buffer), "%s_", p->szDBname);
+ strcpy(pszEnd, "IGNORE"); p->IGNORED = (BYTE)cfg::getByte("CLCExt", buffer, p->IGNORED);
+ strcpy(pszEnd, "GRADIENT"); p->GRADIENT = (BYTE)cfg::getDword("CLCExt", buffer, p->GRADIENT);
+ strcpy(pszEnd, "CORNER"); p->CORNER = (BYTE)cfg::getDword("CLCExt", buffer, p->CORNER);
+ strcpy(pszEnd, "COLOR"); p->COLOR = cfg::getDword("CLCExt", buffer, p->COLOR);
+ strcpy(pszEnd, "COLOR2"); p->COLOR2 = cfg::getDword(NULL, "CLCExt", buffer, p->COLOR2);
+ strcpy(pszEnd, "COLOR2_TRANSPARENT"); p->COLOR2_TRANSPARENT = (BYTE)cfg::getByte("CLCExt", buffer, p->COLOR2_TRANSPARENT);
+ strcpy(pszEnd, "TEXTCOLOR"); p->TEXTCOLOR = cfg::getDword("CLCExt", buffer, p->TEXTCOLOR);
+ strcpy(pszEnd, "ALPHA"); p->ALPHA = cfg::getByte("CLCExt", buffer, p->ALPHA);
+ strcpy(pszEnd, "MRGN_LEFT"); p->MARGIN_LEFT = cfg::getByte("CLCExt", buffer, p->MARGIN_LEFT);
+ strcpy(pszEnd, "MRGN_TOP"); p->MARGIN_TOP = cfg::getByte("CLCExt", buffer, p->MARGIN_TOP);
+ strcpy(pszEnd, "MRGN_RIGHT"); p->MARGIN_RIGHT = cfg::getByte("CLCExt", buffer, p->MARGIN_RIGHT);
+ strcpy(pszEnd, "MRGN_BOTTOM"); p->MARGIN_BOTTOM = cfg::getByte("CLCExt", buffer, p->MARGIN_BOTTOM);
+ strcpy(pszEnd, "BDRSTYLE"); p->BORDERSTYLE = cfg::getDword("CLCExt", buffer, p->BORDERSTYLE);
}
+
if (cfg::dat.bFirstRun) {
- StatusItems_t *item = &StatusItems[ID_EXTBKBUTTONBAR - ID_STATUS_OFFLINE];
+ StatusItems_t *item = arStatusItems[ID_EXTBKBUTTONBAR - ID_STATUS_OFFLINE];
item->COLOR = GetSysColor(COLOR_3DFACE);
item->COLOR2 = GetSysColor(COLOR_3DFACE);
- item = &StatusItems[ID_EXTBKEVTAREA - ID_STATUS_OFFLINE];
+ item = arStatusItems[ID_EXTBKEVTAREA - ID_STATUS_OFFLINE];
item->COLOR = item->COLOR2 = GetSysColor(COLOR_WINDOW);
item->BORDERSTYLE = EDGE_ETCHED;
SaveCompleteStructToDB();
@@ -363,50 +333,27 @@ void LoadExtBkSettingsFromDB()
// writes whole struct to the database
static void SaveCompleteStructToDB(void)
{
- int n;
char buffer[255];
- for (n = 0; n <= ID_EXTBK_LAST - ID_STATUS_OFFLINE; n++) {
- if (StatusItems[n].statusID != ID_EXTBKSEPARATOR) {
- lstrcpyA(buffer, StatusItems[n].szDBname); lstrcatA(buffer, "_IGNORE");
- cfg::writeByte("CLCExt", buffer, StatusItems[n].IGNORED);
-
- lstrcpyA(buffer, StatusItems[n].szDBname); lstrcatA(buffer, "_GRADIENT");
- cfg::writeDword("CLCExt", buffer, StatusItems[n].GRADIENT);
-
- lstrcpyA(buffer, StatusItems[n].szDBname); lstrcatA(buffer, "_CORNER");
- cfg::writeDword("CLCExt", buffer, StatusItems[n].CORNER);
-
- lstrcpyA(buffer, StatusItems[n].szDBname); lstrcatA(buffer, "_COLOR");
- cfg::writeDword("CLCExt", buffer, StatusItems[n].COLOR);
-
- lstrcpyA(buffer, StatusItems[n].szDBname); lstrcatA(buffer, "_COLOR2");
- cfg::writeDword("CLCExt", buffer, StatusItems[n].COLOR2);
-
- lstrcpyA(buffer, StatusItems[n].szDBname); lstrcatA(buffer, "_COLOR2_TRANSPARENT");
- cfg::writeByte("CLCExt", buffer, StatusItems[n].COLOR2_TRANSPARENT);
-
- lstrcpyA(buffer, StatusItems[n].szDBname); lstrcatA(buffer, "_TEXTCOLOR");
- cfg::writeDword("CLCExt", buffer, StatusItems[n].TEXTCOLOR);
-
- lstrcpyA(buffer, StatusItems[n].szDBname); lstrcatA(buffer, "_ALPHA");
- cfg::writeByte("CLCExt", buffer, (BYTE)StatusItems[n].ALPHA);
-
- lstrcpyA(buffer, StatusItems[n].szDBname); lstrcatA(buffer, "_MRGN_LEFT");
- cfg::writeByte("CLCExt", buffer, (BYTE)StatusItems[n].MARGIN_LEFT);
-
- lstrcpyA(buffer, StatusItems[n].szDBname); lstrcatA(buffer, "_MRGN_TOP");
- cfg::writeByte("CLCExt", buffer, (BYTE)StatusItems[n].MARGIN_TOP);
-
- lstrcpyA(buffer, StatusItems[n].szDBname); lstrcatA(buffer, "_MRGN_RIGHT");
- cfg::writeByte("CLCExt", buffer, (BYTE)StatusItems[n].MARGIN_RIGHT);
-
- lstrcpyA(buffer, StatusItems[n].szDBname); lstrcatA(buffer, "_MRGN_BOTTOM");
- cfg::writeByte("CLCExt", buffer, (BYTE)StatusItems[n].MARGIN_BOTTOM);
+ for (int n = 0; n < arStatusItems.getCount(); n++) {
+ StatusItems_t *p = arStatusItems[n];
+ char *pszEnd = buffer + mir_snprintf(buffer, SIZEOF(buffer), "%s_", p->szDBname);
+ if (p->statusID == ID_EXTBKSEPARATOR)
+ continue;
- lstrcpyA(buffer, StatusItems[n].szDBname); lstrcatA(buffer, "_BDRSTYLE");
- cfg::writeDword("CLCExt", buffer, StatusItems[n].BORDERSTYLE);
- }
+ strcpy(pszEnd, "IGNORE"); cfg::writeByte("CLCExt", buffer, p->IGNORED);
+ strcpy(pszEnd, "GRADIENT"); cfg::writeDword("CLCExt", buffer, p->GRADIENT);
+ strcpy(pszEnd, "CORNER"); cfg::writeDword("CLCExt", buffer, p->CORNER);
+ strcpy(pszEnd, "COLOR"); cfg::writeDword("CLCExt", buffer, p->COLOR);
+ strcpy(pszEnd, "COLOR2"); cfg::writeDword("CLCExt", buffer, p->COLOR2);
+ strcpy(pszEnd, "COLOR2_TRANSPARENT"); cfg::writeByte("CLCExt", buffer, p->COLOR2_TRANSPARENT);
+ strcpy(pszEnd, "TEXTCOLOR"); cfg::writeDword("CLCExt", buffer, p->TEXTCOLOR);
+ strcpy(pszEnd, "ALPHA"); cfg::writeByte("CLCExt", buffer, (BYTE)p->ALPHA);
+ strcpy(pszEnd, "MRGN_LEFT"); cfg::writeByte("CLCExt", buffer, (BYTE)p->MARGIN_LEFT);
+ strcpy(pszEnd, "MRGN_TOP"); cfg::writeByte("CLCExt", buffer, (BYTE)p->MARGIN_TOP);
+ strcpy(pszEnd, "MRGN_RIGHT"); cfg::writeByte("CLCExt", buffer, (BYTE)p->MARGIN_RIGHT);
+ strcpy(pszEnd, "MRGN_BOTTOM"); cfg::writeByte("CLCExt", buffer, (BYTE)p->MARGIN_BOTTOM);
+ strcpy(pszEnd, "BDRSTYLE"); cfg::writeDword("CLCExt", buffer, p->BORDERSTYLE);
}
}
@@ -429,7 +376,7 @@ void Reload3dBevelColors()
cfg::dat.hPen3DDark = CreatePen(PS_SOLID, 1, cfg::getDword("CLCExt", "3ddark", GetSysColor(COLOR_3DSHADOW)));
}
-// Save Non-StatusItems Settings
+// Save Non-arStatusItems Settings
void SaveNonStatusItemsSettings(HWND hwndDlg)
{
BOOL translated;
@@ -491,7 +438,7 @@ struct {char *szModule; char *szSetting; unsigned int size; int defaultval;} _ta
void extbk_export(char *file)
{
- int n, i;
+ int i, n;
char buffer[255];
char szSection[255];
char szKey[255];
@@ -501,36 +448,27 @@ void extbk_export(char *file)
data = 3;
WritePrivateProfileStructA("Global", "Version", &data, 4, file);
- for (n = 0; n <= ID_EXTBK_LAST - ID_STATUS_OFFLINE; n++) {
- if (StatusItems[n].statusID != ID_EXTBKSEPARATOR) {
- lstrcpyA(buffer, StatusItems[n].szDBname); lstrcatA(buffer, "_ALPHA");
- WritePrivateProfileStructA("ExtBKSettings", buffer, &(StatusItems[n].ALPHA), sizeof(StatusItems[n].ALPHA), file);
- lstrcpyA(buffer, StatusItems[n].szDBname); lstrcatA(buffer, "_COLOR");
- WritePrivateProfileStructA("ExtBKSettings", buffer, &(StatusItems[n].COLOR), sizeof(StatusItems[n].COLOR), file);
- lstrcpyA(buffer, StatusItems[n].szDBname); lstrcatA(buffer, "_COLOR2");
- WritePrivateProfileStructA("ExtBKSettings", buffer, &(StatusItems[n].COLOR2), sizeof(StatusItems[n].COLOR2), file);
- lstrcpyA(buffer, StatusItems[n].szDBname); lstrcatA(buffer, "_COLOR2_TRANSPARENT");
- WritePrivateProfileStructA("ExtBKSettings", buffer, &(StatusItems[n].COLOR2_TRANSPARENT), sizeof(StatusItems[n].COLOR2_TRANSPARENT), file);
- lstrcpyA(buffer, StatusItems[n].szDBname); lstrcatA(buffer, "_TEXTCOLOR");
- WritePrivateProfileStructA("ExtBKSettings", buffer, &(StatusItems[n].TEXTCOLOR), sizeof(StatusItems[n].TEXTCOLOR), file);
- lstrcpyA(buffer, StatusItems[n].szDBname); lstrcatA(buffer, "_CORNER");
- WritePrivateProfileStructA("ExtBKSettings", buffer, &(StatusItems[n].CORNER), sizeof(StatusItems[n].CORNER), file);
- lstrcpyA(buffer, StatusItems[n].szDBname); lstrcatA(buffer, "_GRADIENT");
- WritePrivateProfileStructA("ExtBKSettings", buffer, &(StatusItems[n].GRADIENT), sizeof(StatusItems[n].GRADIENT), file);
- lstrcpyA(buffer, StatusItems[n].szDBname); lstrcatA(buffer, "_IGNORED");
- WritePrivateProfileStructA("ExtBKSettings", buffer, &(StatusItems[n].IGNORED), sizeof(StatusItems[n].IGNORED), file);
- lstrcpyA(buffer, StatusItems[n].szDBname); lstrcatA(buffer, "_MARGIN_BOTTOM");
- WritePrivateProfileStructA("ExtBKSettings", buffer, &(StatusItems[n].MARGIN_BOTTOM), sizeof(StatusItems[n].MARGIN_BOTTOM), file);
- lstrcpyA(buffer, StatusItems[n].szDBname); lstrcatA(buffer, "_MARGIN_LEFT");
- WritePrivateProfileStructA("ExtBKSettings", buffer, &(StatusItems[n].MARGIN_LEFT), sizeof(StatusItems[n].MARGIN_LEFT), file);
- lstrcpyA(buffer, StatusItems[n].szDBname); lstrcatA(buffer, "_MARGIN_RIGHT");
- WritePrivateProfileStructA("ExtBKSettings", buffer, &(StatusItems[n].MARGIN_RIGHT), sizeof(StatusItems[n].MARGIN_RIGHT), file);
- lstrcpyA(buffer, StatusItems[n].szDBname); lstrcatA(buffer, "_MARGIN_TOP");
- WritePrivateProfileStructA("ExtBKSettings", buffer, &(StatusItems[n].MARGIN_TOP), sizeof(StatusItems[n].MARGIN_TOP), file);
- lstrcpyA(buffer, StatusItems[n].szDBname); lstrcatA(buffer, "_BORDERSTYLE");
- WritePrivateProfileStructA("ExtBKSettings", buffer, &(StatusItems[n].BORDERSTYLE), sizeof(StatusItems[n].BORDERSTYLE), file);
- }
+ for (n = 0; n < arStatusItems.getCount(); n++) {
+ StatusItems_t *p = arStatusItems[n];
+ if (p->statusID == ID_EXTBKSEPARATOR)
+ continue;
+
+ char *pszEnd = buffer + mir_snprintf(buffer, SIZEOF(buffer), "%s_", p->szDBname);
+ strcpy(pszEnd, "ALPHA"); WritePrivateProfileStructA("ExtBKSettings", buffer, &(p->ALPHA), sizeof(p->ALPHA), file);
+ strcpy(pszEnd, "COLOR"); WritePrivateProfileStructA("ExtBKSettings", buffer, &(p->COLOR), sizeof(p->COLOR), file);
+ strcpy(pszEnd, "COLOR2"); WritePrivateProfileStructA("ExtBKSettings", buffer, &(p->COLOR2), sizeof(p->COLOR2), file);
+ strcpy(pszEnd, "COLOR2_TRANSPARENT"); WritePrivateProfileStructA("ExtBKSettings", buffer, &(p->COLOR2_TRANSPARENT), sizeof(p->COLOR2_TRANSPARENT), file);
+ strcpy(pszEnd, "TEXTCOLOR"); WritePrivateProfileStructA("ExtBKSettings", buffer, &(p->TEXTCOLOR), sizeof(p->TEXTCOLOR), file);
+ strcpy(pszEnd, "CORNER"); WritePrivateProfileStructA("ExtBKSettings", buffer, &(p->CORNER), sizeof(p->CORNER), file);
+ strcpy(pszEnd, "GRADIENT"); WritePrivateProfileStructA("ExtBKSettings", buffer, &(p->GRADIENT), sizeof(p->GRADIENT), file);
+ strcpy(pszEnd, "IGNORED"); WritePrivateProfileStructA("ExtBKSettings", buffer, &(p->IGNORED), sizeof(p->IGNORED), file);
+ strcpy(pszEnd, "MARGIN_BOTTOM"); WritePrivateProfileStructA("ExtBKSettings", buffer, &(p->MARGIN_BOTTOM), sizeof(p->MARGIN_BOTTOM), file);
+ strcpy(pszEnd, "MARGIN_LEFT"); WritePrivateProfileStructA("ExtBKSettings", buffer, &(p->MARGIN_LEFT), sizeof(p->MARGIN_LEFT), file);
+ strcpy(pszEnd, "MARGIN_RIGHT"); WritePrivateProfileStructA("ExtBKSettings", buffer, &(p->MARGIN_RIGHT), sizeof(p->MARGIN_RIGHT), file);
+ strcpy(pszEnd, "MARGIN_TOP"); WritePrivateProfileStructA("ExtBKSettings", buffer, &(p->MARGIN_TOP), sizeof(p->MARGIN_TOP), file);
+ strcpy(pszEnd, "BORDERSTYLE"); WritePrivateProfileStructA("ExtBKSettings", buffer, &(p->BORDERSTYLE), sizeof(p->BORDERSTYLE), file);
}
+
for (n = 0; n <= FONTID_LAST; n++) {
mir_snprintf(szSection, 255, "Font%d", n);
@@ -563,6 +501,7 @@ void extbk_export(char *file)
data = (DWORD)cfg::getWord("CLC", szKey, 8);
WritePrivateProfileStructA(szSection, "SameAs", &data, 2, file);
}
+
i = 0;
while(_tagSettings[i].szModule != NULL) {
data = 0;
@@ -580,6 +519,7 @@ void extbk_export(char *file)
WritePrivateProfileStructA("Global", _tagSettings[i].szSetting, &data, _tagSettings[i].size, file);
i++;
}
+
if ( !cfg::getString(NULL, "CLC", "BkBitmap", &dbv)) {
WritePrivateProfileStringA("Global", "BkBitmap", dbv.pszVal, file);
DBFreeVariant(&dbv);
@@ -603,7 +543,6 @@ static StatusItems_t default_item = {
CLCDEFAULT_MRGN_BOTTOM, CLCDEFAULT_IGNORE
};
-
static void PreMultiply(HBITMAP hBitmap, int mode)
{
BYTE *p = NULL;
@@ -752,15 +691,15 @@ static void ReadItem(StatusItems_t *this_item, char *szItem, char *file)
if (strcmp(buffer, "None")) {
- int i;
-
- for (i = 0; i <= ID_EXTBK_LAST - ID_STATUS_OFFLINE; i++) {
- if ( !_stricmp(StatusItems[i].szName[0] == '{' ? &StatusItems[i].szName[3] : StatusItems[i].szName, buffer)) {
- defaults = &StatusItems[i];
+ for (int i = 0; i < arStatusItems.getCount(); i++) {
+ StatusItems_t *p = arStatusItems[i];
+ if ( !_stricmp(p->szName[0] == '{' ? p->szName+3 : p->szName, buffer)) {
+ defaults = p;
break;
}
}
}
+
this_item->ALPHA = (int)GetPrivateProfileIntA(szItem, "Alpha", defaults->ALPHA, file);
this_item->ALPHA = min(this_item->ALPHA, 100);
@@ -945,8 +884,9 @@ done_with_glyph:
}
continue;
}
- for (i = 0; i <= ID_EXTBK_LAST - ID_STATUS_OFFLINE; i++) {
- if ( !_stricmp(StatusItems[i].szName[0] == '{' ? &StatusItems[i].szName[3] : StatusItems[i].szName, buffer)) {
+ for (i = 0; i < arStatusItems.getCount(); i++) {
+ StatusItems_t *p = arStatusItems[i];
+ if ( !_stricmp(p->szName[0] == '{' ? p->szName+3 : p->szName, buffer)) {
if ( !alloced) {
if ( !(tmpItem.dwFlags & IMAGE_GLYPH))
IMG_CreateItem(&tmpItem, szFinalName, hdc);
@@ -954,7 +894,7 @@ done_with_glyph:
newItem = reinterpret_cast<ImageItem *>(malloc(sizeof(ImageItem)));
ZeroMemory(newItem, sizeof(ImageItem));
*newItem = tmpItem;
- StatusItems[i].imageItem = newItem;
+ p->imageItem = newItem;
if (g_ImageItems == NULL)
g_ImageItems = newItem;
else {
@@ -968,7 +908,7 @@ done_with_glyph:
}
}
else if (newItem != NULL)
- StatusItems[i].imageItem = newItem;
+ p->imageItem = newItem;
}
}
}
@@ -1011,8 +951,8 @@ void IMG_DeleteItems()
}
g_glyphItem = NULL;
- for (i = 0; i <= ID_EXTBK_LAST - ID_STATUS_OFFLINE; i++)
- StatusItems[i].imageItem = NULL;
+ for (i = 0; i < arStatusItems.getCount(); i++)
+ arStatusItems[i]->imageItem = NULL;
}
static UINT nextButtonID = IDC_TBFIRSTUID;
@@ -1034,7 +974,7 @@ static void BTN_ReadItem(char *itemName, char *file)
GetPrivateProfileStringA(itemName, "Pressed", "None", szBuffer, 1000, file);
if ( !_stricmp(szBuffer, "default"))
- tmpItem.imgPressed = StatusItems[ID_EXTBKTBBUTTONSPRESSED - ID_STATUS_OFFLINE].imageItem;
+ tmpItem.imgPressed = arStatusItems[ID_EXTBKTBBUTTONSPRESSED - ID_STATUS_OFFLINE]->imageItem;
else {
while(imgItem) {
if ( !_stricmp(imgItem->szName, szBuffer)) {
@@ -1048,7 +988,7 @@ static void BTN_ReadItem(char *itemName, char *file)
imgItem = g_ImageItems;
GetPrivateProfileStringA(itemName, "Normal", "None", szBuffer, 1000, file);
if ( !_stricmp(szBuffer, "default"))
- tmpItem.imgNormal = StatusItems[ID_EXTBKTBBUTTONSNPRESSED - ID_STATUS_OFFLINE].imageItem;
+ tmpItem.imgNormal = arStatusItems[ID_EXTBKTBBUTTONSNPRESSED - ID_STATUS_OFFLINE]->imageItem;
else {
while(imgItem) {
if ( !_stricmp(imgItem->szName, szBuffer)) {
@@ -1062,7 +1002,7 @@ static void BTN_ReadItem(char *itemName, char *file)
imgItem = g_ImageItems;
GetPrivateProfileStringA(itemName, "Hover", "None", szBuffer, 1000, file);
if ( !_stricmp(szBuffer, "default"))
- tmpItem.imgHover = StatusItems[ID_EXTBKTBBUTTONMOUSEOVER - ID_STATUS_OFFLINE].imageItem;
+ tmpItem.imgHover = arStatusItems[ID_EXTBKTBBUTTONMOUSEOVER - ID_STATUS_OFFLINE]->imageItem;
else {
while(imgItem) {
if ( !_stricmp(imgItem->szName, szBuffer)) {
@@ -1392,35 +1332,25 @@ void extbk_import(char *file, HWND hwndDlg)
char szKey[255], szSection[255];
DWORD data, version = 0;
- for (n = 0; n <= ID_EXTBK_LAST - ID_STATUS_OFFLINE; n++) {
- if (StatusItems[n].statusID != ID_EXTBKSEPARATOR) {
- lstrcpyA(buffer, StatusItems[n].szDBname); lstrcatA(buffer, "_ALPHA");
- GetPrivateProfileStructA("ExtBKSettings", buffer, &(StatusItems[n].ALPHA), sizeof(StatusItems[n].ALPHA), file);
- lstrcpyA(buffer, StatusItems[n].szDBname); lstrcatA(buffer, "_COLOR");
- GetPrivateProfileStructA("ExtBKSettings", buffer, &(StatusItems[n].COLOR), sizeof(StatusItems[n].COLOR), file);
- lstrcpyA(buffer, StatusItems[n].szDBname); lstrcatA(buffer, "_COLOR2");
- GetPrivateProfileStructA("ExtBKSettings", buffer, &(StatusItems[n].COLOR2), sizeof(StatusItems[n].COLOR2), file);
- lstrcpyA(buffer, StatusItems[n].szDBname); lstrcatA(buffer, "_COLOR2_TRANSPARENT");
- GetPrivateProfileStructA("ExtBKSettings", buffer, &(StatusItems[n].COLOR2_TRANSPARENT), sizeof(StatusItems[n].COLOR2_TRANSPARENT), file);
- lstrcpyA(buffer, StatusItems[n].szDBname); lstrcatA(buffer, "_TEXTCOLOR");
- GetPrivateProfileStructA("ExtBKSettings", buffer, &(StatusItems[n].TEXTCOLOR), sizeof(StatusItems[n].TEXTCOLOR), file);
- lstrcpyA(buffer, StatusItems[n].szDBname); lstrcatA(buffer, "_CORNER");
- GetPrivateProfileStructA("ExtBKSettings", buffer, &(StatusItems[n].CORNER), sizeof(StatusItems[n].CORNER), file);
- lstrcpyA(buffer, StatusItems[n].szDBname); lstrcatA(buffer, "_GRADIENT");
- GetPrivateProfileStructA("ExtBKSettings", buffer, &(StatusItems[n].GRADIENT), sizeof(StatusItems[n].GRADIENT), file);
- lstrcpyA(buffer, StatusItems[n].szDBname); lstrcatA(buffer, "_IGNORED");
- GetPrivateProfileStructA("ExtBKSettings", buffer, &(StatusItems[n].IGNORED), sizeof(StatusItems[n].IGNORED), file);
- lstrcpyA(buffer, StatusItems[n].szDBname); lstrcatA(buffer, "_MARGIN_BOTTOM");
- GetPrivateProfileStructA("ExtBKSettings", buffer, &(StatusItems[n].MARGIN_BOTTOM), sizeof(StatusItems[n].MARGIN_BOTTOM), file);
- lstrcpyA(buffer, StatusItems[n].szDBname); lstrcatA(buffer, "_MARGIN_LEFT");
- GetPrivateProfileStructA("ExtBKSettings", buffer, &(StatusItems[n].MARGIN_LEFT), sizeof(StatusItems[n].MARGIN_LEFT), file);
- lstrcpyA(buffer, StatusItems[n].szDBname); lstrcatA(buffer, "_MARGIN_RIGHT");
- GetPrivateProfileStructA("ExtBKSettings", buffer, &(StatusItems[n].MARGIN_RIGHT), sizeof(StatusItems[n].MARGIN_RIGHT), file);
- lstrcpyA(buffer, StatusItems[n].szDBname); lstrcatA(buffer, "_MARGIN_TOP");
- GetPrivateProfileStructA("ExtBKSettings", buffer, &(StatusItems[n].MARGIN_TOP), sizeof(StatusItems[n].MARGIN_TOP), file);
- lstrcpyA(buffer, StatusItems[n].szDBname); lstrcatA(buffer, "_BORDERSTYLE");
- GetPrivateProfileStructA("ExtBKSettings", buffer, &(StatusItems[n].BORDERSTYLE), sizeof(StatusItems[n].BORDERSTYLE), file);
- }
+ for (n = 0; n < arStatusItems.getCount(); n++) {
+ StatusItems_t *p = arStatusItems[n];
+ if (p->statusID == ID_EXTBKSEPARATOR)
+ continue;
+
+ char *pszEnd = buffer + mir_snprintf(buffer, SIZEOF(buffer), "%s_", p->szDBname);
+ strcpy(pszEnd, "ALPHA"); GetPrivateProfileStructA("ExtBKSettings", buffer, &(p->ALPHA), sizeof(p->ALPHA), file);
+ strcpy(pszEnd, "COLOR"); GetPrivateProfileStructA("ExtBKSettings", buffer, &(p->COLOR), sizeof(p->COLOR), file);
+ strcpy(pszEnd, "COLOR2"); GetPrivateProfileStructA("ExtBKSettings", buffer, &(p->COLOR2), sizeof(p->COLOR2), file);
+ strcpy(pszEnd, "COLOR2_TRANSPARENT"); GetPrivateProfileStructA("ExtBKSettings", buffer, &(p->COLOR2_TRANSPARENT), sizeof(p->COLOR2_TRANSPARENT), file);
+ strcpy(pszEnd, "TEXTCOLOR"); GetPrivateProfileStructA("ExtBKSettings", buffer, &(p->TEXTCOLOR), sizeof(p->TEXTCOLOR), file);
+ strcpy(pszEnd, "CORNER"); GetPrivateProfileStructA("ExtBKSettings", buffer, &(p->CORNER), sizeof(p->CORNER), file);
+ strcpy(pszEnd, "GRADIENT"); GetPrivateProfileStructA("ExtBKSettings", buffer, &(p->GRADIENT), sizeof(p->GRADIENT), file);
+ strcpy(pszEnd, "IGNORED"); GetPrivateProfileStructA("ExtBKSettings", buffer, &(p->IGNORED), sizeof(p->IGNORED), file);
+ strcpy(pszEnd, "MARGIN_BOTTOM"); GetPrivateProfileStructA("ExtBKSettings", buffer, &(p->MARGIN_BOTTOM), sizeof(p->MARGIN_BOTTOM), file);
+ strcpy(pszEnd, "MARGIN_LEFT"); GetPrivateProfileStructA("ExtBKSettings", buffer, &(p->MARGIN_LEFT), sizeof(p->MARGIN_LEFT), file);
+ strcpy(pszEnd, "MARGIN_RIGHT"); GetPrivateProfileStructA("ExtBKSettings", buffer, &(p->MARGIN_RIGHT), sizeof(p->MARGIN_RIGHT), file);
+ strcpy(pszEnd, "MARGIN_TOP"); GetPrivateProfileStructA("ExtBKSettings", buffer, &(p->MARGIN_TOP), sizeof(p->MARGIN_TOP), file);
+ strcpy(pszEnd, "BORDERSTYLE"); GetPrivateProfileStructA("ExtBKSettings", buffer, &(p->BORDERSTYLE), sizeof(p->BORDERSTYLE), file);
}
data = 0;
@@ -1663,18 +1593,17 @@ INT_PTR CALLBACK OptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara
static int iInit = TRUE;
static HWND hwndSkinEdit = 0;
- switch(msg)
- {
+ switch(msg) {
case WM_INITDIALOG:
+ TranslateDialogDefault(hwnd);
{
- TCITEM tci;
- RECT rcClient;
int oPage = cfg::getByte("CLUI", "opage", 0);
- SKINDESCRIPTION sd;
- TranslateDialogDefault(hwnd);
+ RECT rcClient;
GetClientRect(hwnd, &rcClient);
iInit = TRUE;
+
+ TCITEM tci;
tci.mask = TCIF_PARAM|TCIF_TEXT;
tci.lParam = (LPARAM)CreateDialog(g_hInst,MAKEINTRESOURCE(IDD_OPT_SKIN), hwnd, DlgProcSkinOpts);
tci.pszText = TranslateT("Load and apply");
@@ -1684,14 +1613,14 @@ INT_PTR CALLBACK OptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara
if (IS_THEMED)
API::pfnEnableThemeDialogTexture((HWND)tci.lParam, ETDT_ENABLETAB);
- if (ServiceExists(MS_CLNSE_INVOKE)) {
- ZeroMemory(&sd, sizeof(sd));
+ if ( ServiceExists(MS_CLNSE_INVOKE)) {
+ SKINDESCRIPTION sd = { 0 };
sd.cbSize = sizeof(sd);
- sd.StatusItems = StatusItems;
+ sd.StatusItems = arStatusItems.getArray();
sd.hWndParent = hwnd;
sd.hWndTab = GetDlgItem(hwnd, IDC_OPTIONSTAB);
sd.pfnSaveCompleteStruct = SaveCompleteStructToDB;
- sd.lastItem = ID_EXTBK_LAST;
+ sd.lastItem = ID_STATUS_OFFLINE + arStatusItems.getCount() + 1;
sd.firstItem = ID_STATUS_OFFLINE;
sd.pfnClcOptionsChanged = pcli->pfnClcOptionsChanged;
sd.hwndCLUI = pcli->hwndContactList;
@@ -1816,24 +1745,24 @@ int CoolSB_SetupScrollBar()
* and no item is set to ignored
*/
- cfg::dat.bSkinnedScrollbar = !StatusItems[ID_EXTBKSCROLLBACK - ID_STATUS_OFFLINE].IGNORED &&
- !StatusItems[ID_EXTBKSCROLLBACKLOWER - ID_STATUS_OFFLINE].IGNORED &&
- !StatusItems[ID_EXTBKSCROLLTHUMB - ID_STATUS_OFFLINE].IGNORED &&
- !StatusItems[ID_EXTBKSCROLLTHUMBHOVER - ID_STATUS_OFFLINE].IGNORED &&
- !StatusItems[ID_EXTBKSCROLLTHUMBPRESSED - ID_STATUS_OFFLINE].IGNORED &&
- !StatusItems[ID_EXTBKSCROLLBUTTON - ID_STATUS_OFFLINE].IGNORED &&
- !StatusItems[ID_EXTBKSCROLLBUTTONHOVER - ID_STATUS_OFFLINE].IGNORED &&
- !StatusItems[ID_EXTBKSCROLLBUTTONPRESSED - ID_STATUS_OFFLINE].IGNORED;
-
-
- if ( !StatusItems[ID_EXTBKSCROLLBACK - ID_STATUS_OFFLINE].imageItem ||
- !StatusItems[ID_EXTBKSCROLLBACKLOWER - ID_STATUS_OFFLINE].imageItem ||
- !StatusItems[ID_EXTBKSCROLLTHUMB - ID_STATUS_OFFLINE].imageItem ||
- !StatusItems[ID_EXTBKSCROLLTHUMBHOVER - ID_STATUS_OFFLINE].imageItem ||
- !StatusItems[ID_EXTBKSCROLLTHUMBPRESSED - ID_STATUS_OFFLINE].imageItem ||
- !StatusItems[ID_EXTBKSCROLLBUTTON - ID_STATUS_OFFLINE].imageItem ||
- !StatusItems[ID_EXTBKSCROLLBUTTONHOVER - ID_STATUS_OFFLINE].imageItem ||
- !StatusItems[ID_EXTBKSCROLLBUTTONPRESSED - ID_STATUS_OFFLINE].imageItem)
+ cfg::dat.bSkinnedScrollbar = !arStatusItems[ID_EXTBKSCROLLBACK - ID_STATUS_OFFLINE]->IGNORED &&
+ !arStatusItems[ID_EXTBKSCROLLBACKLOWER - ID_STATUS_OFFLINE]->IGNORED &&
+ !arStatusItems[ID_EXTBKSCROLLTHUMB - ID_STATUS_OFFLINE]->IGNORED &&
+ !arStatusItems[ID_EXTBKSCROLLTHUMBHOVER - ID_STATUS_OFFLINE]->IGNORED &&
+ !arStatusItems[ID_EXTBKSCROLLTHUMBPRESSED - ID_STATUS_OFFLINE]->IGNORED &&
+ !arStatusItems[ID_EXTBKSCROLLBUTTON - ID_STATUS_OFFLINE]->IGNORED &&
+ !arStatusItems[ID_EXTBKSCROLLBUTTONHOVER - ID_STATUS_OFFLINE]->IGNORED &&
+ !arStatusItems[ID_EXTBKSCROLLBUTTONPRESSED - ID_STATUS_OFFLINE]->IGNORED;
+
+
+ if ( !arStatusItems[ID_EXTBKSCROLLBACK - ID_STATUS_OFFLINE]->imageItem ||
+ !arStatusItems[ID_EXTBKSCROLLBACKLOWER - ID_STATUS_OFFLINE]->imageItem ||
+ !arStatusItems[ID_EXTBKSCROLLTHUMB - ID_STATUS_OFFLINE]->imageItem ||
+ !arStatusItems[ID_EXTBKSCROLLTHUMBHOVER - ID_STATUS_OFFLINE]->imageItem ||
+ !arStatusItems[ID_EXTBKSCROLLTHUMBPRESSED - ID_STATUS_OFFLINE]->imageItem ||
+ !arStatusItems[ID_EXTBKSCROLLBUTTON - ID_STATUS_OFFLINE]->imageItem ||
+ !arStatusItems[ID_EXTBKSCROLLBUTTONHOVER - ID_STATUS_OFFLINE]->imageItem ||
+ !arStatusItems[ID_EXTBKSCROLLBUTTONPRESSED - ID_STATUS_OFFLINE]->imageItem)
cfg::dat.bSkinnedScrollbar = FALSE;
diff --git a/plugins/Clist_nicer/src/statusbar.cpp b/plugins/Clist_nicer/src/statusbar.cpp
index 936f1f0b92..82c5a5e2e6 100644
--- a/plugins/Clist_nicer/src/statusbar.cpp
+++ b/plugins/Clist_nicer/src/statusbar.cpp
@@ -29,7 +29,6 @@ static POINT ptMouse = {0};
static RECT rcMouse = {0};
static int timer_set = 0, tooltip_active = 0;
extern HANDLE hStatusBarShowToolTipEvent, hStatusBarHideToolTipEvent;
-extern StatusItems_t *StatusItems;
extern HBRUSH g_CLUISkinnedBkColor;
extern HANDLE (WINAPI *MyOpenThemeData)(HWND, LPCWSTR);
@@ -85,7 +84,7 @@ LRESULT CALLBACK NewStatusBarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
break;
case WM_PAINT:
- if (cfg::shutDown || !StatusItems)
+ if (cfg::shutDown || arStatusItems.getCount() == 0)
return 0;
if (cfg::dat.bSkinnedStatusBar) {
@@ -114,7 +113,7 @@ LRESULT CALLBACK NewStatusBarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
SetBkMode(hdcMem, TRANSPARENT);
hOldFont = reinterpret_cast<HFONT>(SelectObject(hdcMem, GetStockObject(DEFAULT_GUI_FONT)));
BitBlt(hdcMem, 0, 0, rcClient.right, rcClient.bottom, cfg::dat.hdcBg, pt.x, pt.y, SRCCOPY);
- item = &StatusItems[ID_EXTBKSTATUSBAR - ID_STATUS_OFFLINE];
+ item = arStatusItems[ID_EXTBKSTATUSBAR - ID_STATUS_OFFLINE];
if ( !item->IGNORED) {
RECT rc = rcClient;
rc.left += item->MARGIN_LEFT;
diff --git a/plugins/Clist_nicer/src/statusfloater.cpp b/plugins/Clist_nicer/src/statusfloater.cpp
index f605bc1329..751e9f29d6 100644
--- a/plugins/Clist_nicer/src/statusfloater.cpp
+++ b/plugins/Clist_nicer/src/statusfloater.cpp
@@ -58,8 +58,6 @@ BOOL tooltip = FALSE;
UINT_PTR hTooltipTimer = 0;
POINT start_pos;
-
-extern StatusItems_t *StatusItems;
extern int g_padding_y;
extern HIMAGELIST hCListImages;
@@ -765,7 +763,7 @@ void SFL_Update(HICON hIcon, int iIcon, HIMAGELIST hIml, const TCHAR *szText, BO
SIZE szDest, szT;
BLENDFUNCTION bf = {0};
HFONT hOldFont;
- StatusItems_t *item = &StatusItems[ID_EXTBKSTATUSFLOATER - ID_STATUS_OFFLINE];
+ StatusItems_t *item = arStatusItems[ID_EXTBKSTATUSFLOATER - ID_STATUS_OFFLINE];
RECT rcStatusArea;
LONG cy;