diff options
Diffstat (limited to 'plugins/TopToolBar')
-rw-r--r-- | plugins/TopToolBar/res/main.rc | 14 | ||||
-rw-r--r-- | plugins/TopToolBar/src/InternalButtons.cpp | 91 | ||||
-rw-r--r-- | plugins/TopToolBar/src/main.cpp | 2 | ||||
-rw-r--r-- | plugins/TopToolBar/src/resource.h | 34 | ||||
-rw-r--r-- | plugins/TopToolBar/src/toolbar.cpp | 143 | ||||
-rw-r--r-- | plugins/TopToolBar/src/toolbarwnd.cpp | 14 | ||||
-rw-r--r-- | plugins/TopToolBar/src/topbutton.cpp | 41 |
7 files changed, 181 insertions, 158 deletions
diff --git a/plugins/TopToolBar/res/main.rc b/plugins/TopToolBar/res/main.rc index 6a2260d1d6..2caa9b4f81 100644 --- a/plugins/TopToolBar/res/main.rc +++ b/plugins/TopToolBar/res/main.rc @@ -121,17 +121,19 @@ END // Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
-IDI_SHOWONLINEUP ICON "Show only Online Users_UP.ico"
+IDI_SHOWOFFLINE ICON "Show only Online Users_UP.ico"
IDI_RUN ICON "run.ico"
-IDI_SHOWONLINEDN ICON "Show only Online Users_DN.ico"
-IDI_GROUPSUP ICON "Groups On_Off_UP.ico"
-IDI_GROUPSDN ICON "Groups On_Off_DN.ico"
-IDI_SOUNDDN ICON "Sounds Enable_Disable_DN.ico"
-IDI_SOUNDUP ICON "Sounds Enable_Disable_UP.ico"
+IDI_HIDEOFFLINE ICON "Show only Online Users_DN.ico"
+IDI_GROUPSOFF ICON "Groups On_Off_UP.ico"
+IDI_GROUPSON ICON "Groups On_Off_DN.ico"
+IDI_SOUNDSOFF ICON "Sounds Enable_Disable_DN.ico"
+IDI_SOUNDSON ICON "Sounds Enable_Disable_UP.ico"
IDI_OPTIONSUP ICON "Show Options Page_UP.ico"
IDI_MINIMIZEUP ICON "Minimize Button_UP.ico"
IDI_FINDADDUP ICON "Find_Add Contacts_UP.ico"
IDI_MIRANDAUP ICON "Show Main Menu_UP.ico"
+IDI_METAON ICON "..\\..\\..\\src\\res\\meta_menu.ico"
+IDI_METAOFF ICON "..\\..\\..\\src\\res\\meta_menuof.ico"
#endif // Neutral resources
/////////////////////////////////////////////////////////////////////////////
diff --git a/plugins/TopToolBar/src/InternalButtons.cpp b/plugins/TopToolBar/src/InternalButtons.cpp index fa28ad79e0..0869b5b7a8 100644 --- a/plugins/TopToolBar/src/InternalButtons.cpp +++ b/plugins/TopToolBar/src/InternalButtons.cpp @@ -4,6 +4,12 @@ #define TTBI_GROUPSHOWHIDE "TTBInternal/GroupShowHide"
#define TTBI_SOUNDSONOFF "TTBInternal/SoundsOnOFF"
#define TTBI_MAINMENUBUTT "TTBInternal/MainMenuBUTT"
+#define TTBI_STATUSMENUBUTT "TTBInternal/StatusMenuButt"
+
+#define INDEX_OFFLINE 5
+#define INDEX_META 6
+#define INDEX_GROUPS 7
+#define INDEX_SOUNDS 8
static HWND hwndContactTree;
@@ -11,17 +17,21 @@ struct { char *name, *pszService;
int iconidUp, iconidDn;
char *tooltipUp, *tooltipDn;
+ bool bCustomIcon, bDefVisible;
HANDLE hButton;
}
static stdButtons[] = {
- { LPGEN("Show only online users"), MS_CLIST_SETHIDEOFFLINE, IDI_SHOWONLINEUP, IDI_SHOWONLINEDN, LPGEN("Hide offline users"), LPGEN("Show all users") },
- { LPGEN("Groups on/off"), TTBI_GROUPSHOWHIDE, IDI_GROUPSUP, IDI_GROUPSDN, LPGEN("Hide groups"), LPGEN("Show groups") },
- { LPGEN("Sounds enable/disable"), TTBI_SOUNDSONOFF, IDI_SOUNDUP, IDI_SOUNDDN, LPGEN("Disable sounds"), LPGEN("Enable sounds") },
-
- { LPGEN("Show options page"), "Options/OptionsCommand", IDI_OPTIONSUP, 0, LPGEN("Show options") },
- { LPGEN("Minimize button"), MS_CLIST_SHOWHIDE, IDI_MINIMIZEUP, 0, NULL },
- { LPGEN("Find/Add contacts"), MS_FINDADD_FINDADD, IDI_FINDADDUP, 0, NULL },
- { LPGEN("Show main menu"), TTBI_MAINMENUBUTT, IDI_MIRANDAUP, 0, LPGEN("Show main menu") }
+ { LPGEN("Show main menu"), TTBI_MAINMENUBUTT, SKINICON_OTHER_MAINMENU, 0, LPGEN("Show main menu"), NULL, 0, 1 },
+ { LPGEN("Show options page"), "Options/OptionsCommand", SKINICON_OTHER_OPTIONS, 0, LPGEN("Show options page"), NULL, 0, 1 },
+ { LPGEN("Show accounts manager"), "Protos/ShowAccountManager", SKINICON_OTHER_ACCMGR, 0, LPGEN("Show accounts manager"), NULL, 0, 0 },
+ { LPGEN("Find/add contacts"), MS_FINDADD_FINDADD, SKINICON_OTHER_FINDUSER, 0, LPGEN("Find/add contacts"), NULL, 0, 1 },
+ { LPGEN("Show status menu"), TTBI_STATUSMENUBUTT, SKINICON_OTHER_STATUS, 0, LPGEN("Show status menu"), NULL, 0, 0 },
+ { LPGEN("Show/hide offline contacts"), MS_CLIST_SETHIDEOFFLINE, IDI_HIDEOFFLINE, IDI_SHOWOFFLINE, LPGEN("Hide offline contacts"), LPGEN("Show offline contacts"), 1, 1 },
+ { LPGEN("Enable/disable MetaContacts"), "MetaContacts/OnOff", IDI_METAOFF, IDI_METAON, LPGEN("Disable MetaContacts"), LPGEN("Enable MetaContacts"), 1, 1 },
+ { LPGEN("Enable/disable groups"), TTBI_GROUPSHOWHIDE, IDI_GROUPSOFF, IDI_GROUPSON, LPGEN("Enable groups"), LPGEN("Disable groups"), 1, 1 },
+ { LPGEN("Enable/disable sounds"), TTBI_SOUNDSONOFF, IDI_SOUNDSOFF, IDI_SOUNDSON, LPGEN("Disable sounds"), LPGEN("Enable sounds"), 1, 1 },
+ { LPGEN("Minimize contact list"), MS_CLIST_SHOWHIDE, SKINICON_OTHER_SHOWHIDE, 0, LPGEN("Minimize contact list"), NULL, 0, 1 },
+ { LPGEN("Exit"), "CloseAction", SKINICON_OTHER_EXIT, 0, LPGEN("Exit"), NULL, 0, 0 }
};
///////////////////////////////////////////////////////////////////////////////
@@ -34,15 +44,17 @@ int OnSettingChanging(WPARAM hContact, LPARAM lParam) if (!strcmp(dbcws->szModule, "CList")) {
if (!strcmp(dbcws->szSetting, "HideOffline"))
- CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)stdButtons[0].hButton, (dbcws->value.bVal) ? TTBST_PUSHED : TTBST_RELEASED);
-
+ CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)stdButtons[INDEX_OFFLINE].hButton, dbcws->value.bVal ? TTBST_RELEASED : TTBST_PUSHED);
else if (!strcmp(dbcws->szSetting, "UseGroups"))
- CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)stdButtons[1].hButton, (dbcws->value.bVal) ? TTBST_PUSHED : TTBST_RELEASED);
+ CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)stdButtons[INDEX_GROUPS].hButton, dbcws->value.bVal ? TTBST_PUSHED : TTBST_RELEASED);
}
-
else if (!strcmp(dbcws->szModule, "Skin")) {
if (!strcmp(dbcws->szSetting, "UseSound"))
- CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)stdButtons[2].hButton, (dbcws->value.bVal) ? TTBST_RELEASED : TTBST_PUSHED);
+ CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)stdButtons[INDEX_SOUNDS].hButton, dbcws->value.bVal ? TTBST_PUSHED : TTBST_RELEASED);
+ }
+ else if (!strcmp(dbcws->szModule, "MetaContacts")) {
+ if (!strcmp(dbcws->szSetting, "Enabled"))
+ CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)stdButtons[INDEX_META].hButton, dbcws->value.bVal ? TTBST_PUSHED : TTBST_RELEASED);
}
return 0;
@@ -58,6 +70,16 @@ INT_PTR TTBInternalMainMenuButt(WPARAM wParam, LPARAM lParam) return 0;
}
+INT_PTR TTBInternalStatusMenuButt(WPARAM wParam, LPARAM lParam)
+{
+ HMENU hMenu = (HMENU)CallService(MS_CLIST_MENUGETSTATUS, 0, 0);
+
+ POINT pt;
+ GetCursorPos(&pt);
+ TrackPopupMenu(hMenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, 0, (HWND)CallService(MS_CLUI_GETHWND, 0, 0), NULL);
+ return 0;
+}
+
INT_PTR TTBInternalGroupShowHide(WPARAM wParam, LPARAM lParam)
{
int newVal = !(GetWindowLongPtr(hwndContactTree, GWL_STYLE) & CLS_USEGROUPS);
@@ -82,23 +104,37 @@ void InitInternalButtons() CreateServiceFunction(TTBI_GROUPSHOWHIDE, TTBInternalGroupShowHide);
CreateServiceFunction(TTBI_SOUNDSONOFF, TTBInternalSoundsOnOff);
CreateServiceFunction(TTBI_MAINMENUBUTT, TTBInternalMainMenuButt);
+ CreateServiceFunction(TTBI_STATUSMENUBUTT, TTBInternalStatusMenuButt);
for (int i = 0; i < SIZEOF(stdButtons); i++) {
- TTBButton ttb = { 0 };
+ TTBButton ttb = {0};
ttb.cbSize = sizeof(ttb);
ttb.name = stdButtons[i].name;
ttb.pszService = stdButtons[i].pszService;
- ttb.dwFlags = TTBBF_VISIBLE | TTBBF_INTERNAL;
+ ttb.dwFlags = TTBBF_INTERNAL;
+ if (stdButtons[i].bDefVisible == TRUE)
+ ttb.dwFlags |= TTBBF_VISIBLE;
if ((ttb.pszTooltipDn = stdButtons[i].tooltipDn) != NULL)
ttb.dwFlags |= TTBBF_SHOWTOOLTIP;
ttb.pszTooltipUp = stdButtons[i].tooltipUp;
- ttb.hIconUp = (HICON)LoadImage(hInst, MAKEINTRESOURCE(stdButtons[i].iconidUp), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
- if (stdButtons[i].iconidDn) {
- ttb.dwFlags |= TTBBF_ASPUSHBUTTON;
- ttb.hIconDn = (HICON)LoadImage(hInst, MAKEINTRESOURCE(stdButtons[i].iconidDn), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
+ if (stdButtons[i].bCustomIcon) {
+ ttb.hIconUp = (HICON)LoadImage(hInst, MAKEINTRESOURCE(stdButtons[i].iconidUp), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
+ if (stdButtons[i].iconidDn) {
+ ttb.dwFlags |= TTBBF_ASPUSHBUTTON;
+ ttb.hIconDn = (HICON)LoadImage(hInst, MAKEINTRESOURCE(stdButtons[i].iconidDn), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
+ }
+ else
+ ttb.hIconDn = NULL;
+ }
+ else {
+ ttb.hIconHandleUp = LoadSkinnedIconHandle(stdButtons[i].iconidUp);
+ if (stdButtons[i].iconidDn) {
+ ttb.dwFlags |= TTBBF_ASPUSHBUTTON;
+ ttb.hIconHandleDn = LoadSkinnedIconHandle(stdButtons[i].iconidDn);
+ }
+ else
+ ttb.hIconHandleDn = ttb.hIconDn = NULL;
}
- else
- ttb.hIconDn = NULL;
if (i == 0)
ttb.wParamUp = 1;
@@ -106,14 +142,17 @@ void InitInternalButtons() stdButtons[i].hButton = (HANDLE)TTBAddButton((WPARAM)&ttb, 0);
}
- CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)stdButtons[0].hButton,
- db_get_b(NULL, "CList", "HideOffline", 0) ? TTBST_PUSHED : TTBST_RELEASED);
+ CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)stdButtons[INDEX_OFFLINE].hButton,
+ db_get_b(NULL, "CList", "HideOffline", 0) ? TTBST_RELEASED : TTBST_PUSHED);
- CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)stdButtons[1].hButton,
+ CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)stdButtons[INDEX_GROUPS].hButton,
db_get_b(NULL, "CList", "UseGroups", 1) ? TTBST_PUSHED : TTBST_RELEASED);
- CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)stdButtons[2].hButton,
- db_get_b(NULL, "Skin", "UseSound", 1) ? TTBST_RELEASED : TTBST_PUSHED);
+ CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)stdButtons[INDEX_SOUNDS].hButton,
+ db_get_b(NULL, "Skin", "UseSound", 1) ? TTBST_PUSHED : TTBST_RELEASED);
+
+ CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)stdButtons[INDEX_META].hButton,
+ db_get_b(NULL, "MetaContacts", "Enabled", 1) ? TTBST_PUSHED : TTBST_RELEASED);
HookEvent(ME_DB_CONTACT_SETTINGCHANGED, OnSettingChanging);
}
diff --git a/plugins/TopToolBar/src/main.cpp b/plugins/TopToolBar/src/main.cpp index 87d431ad2e..a651684e1f 100644 --- a/plugins/TopToolBar/src/main.cpp +++ b/plugins/TopToolBar/src/main.cpp @@ -19,7 +19,7 @@ PLUGININFOEX pluginInfo = {0xf593c752, 0x51d8, 0x4d46, {0xba, 0x27, 0x37, 0x57, 0x79, 0x53, 0xf5, 0x5c}}
};
-extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion)
+extern "C" __declspec(dllexport) PLUGININFOEX *MirandaPluginInfoEx(DWORD mirandaVersion)
{
return &pluginInfo;
}
diff --git a/plugins/TopToolBar/src/resource.h b/plugins/TopToolBar/src/resource.h index 81cfa42467..3c3db09e52 100644 --- a/plugins/TopToolBar/src/resource.h +++ b/plugins/TopToolBar/src/resource.h @@ -3,22 +3,20 @@ // Used by ..\res\main.rc
//
#define IDB_SEP 118
-#define IDI_SHOWONLINEUP 125
-#define IDI_SHOWONLINEDN 126
-#define IDI_GROUPSUP 127
-#define IDI_GROUPSDN 128
-#define IDI_SOUNDDN 129
-#define IDI_SOUNDUP 130
+#define IDI_SHOWOFFLINE 125
+#define IDI_HIDEOFFLINE 126
+#define IDI_GROUPSOFF 127
+#define IDI_GROUPSON 128
+#define IDI_SOUNDSOFF 129
+#define IDI_SOUNDSON 130
#define IDI_OPTIONSUP 131
#define IDI_MINIMIZEUP 133
#define IDI_FINDADDUP 135
#define IDI_MIRANDAUP 137
+#define IDI_METAON 139
#define IDI_RUN 140
-#define IDD_OPT_TTBBKG 230
-#define IDD_OPT_INTERNALORDER 262
+#define IDI_METAOFF 141
#define IDD_OPT_BUTORDER 262
-#define IDD_FRAMEPLUG2 265
-#define IDC_BUTTON1 1002
#define IDC_ADDSEP 1003
#define IDC_REMOVEBUTTON 1004
#define IDC_ADDLBUTTON 1005
@@ -26,11 +24,9 @@ #define IDC_ENAME 1007
#define IDC_LBUTTONNAME 1008
#define IDC_EPATH 1009
-#define IDC_AUTOSIZE 1010
#define IDC_LBUTTONPATH 1011
#define IDC_LBUTTONSET 1012
#define IDC_BUTTHEIGHT 1015
-#define IDC_EDIT2 1016
#define IDC_BUTTWIDTH 1016
#define IDC_BUTTGAP 1017
#define IDC_USEFLAT 1018
@@ -40,25 +36,13 @@ #define IDC_SPIN_WIDTH 1025
#define IDC_SPIN_GAP 1026
#define IDC_BROWSE 1184
-#define IDC_BKGCOLOUR 1269
-#define IDC_FILENAME 1271
-#define IDC_SCROLL 1277
-#define IDC_PROPORTIONAL 1278
-#define IDC_SELCOLOUR 1281
-#define IDC_STRETCHH 1298
-#define IDC_STRETCHV 1299
-#define IDC_TILEH 1300
-#define IDC_TILEV 1301
-#define IDC_BITMAP 1363
-#define IDC_P2ONLINEBUTT 1562
-#define IDC_P2GROUPBUTT 1564
#define IDC_BUTTONORDERTREE 1591
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 139
+#define _APS_NEXT_RESOURCE_VALUE 142
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1025
#define _APS_NEXT_SYMED_VALUE 101
diff --git a/plugins/TopToolBar/src/toolbar.cpp b/plugins/TopToolBar/src/toolbar.cpp index 92a1f00fea..1918633f1c 100644 --- a/plugins/TopToolBar/src/toolbar.cpp +++ b/plugins/TopToolBar/src/toolbar.cpp @@ -1,7 +1,7 @@ #include "common.h"
-#define OLD_TBBUTTON_SIZE (offsetof(TTBButton, pszTooltipUp))
+#define OLD_TBBUTTON_SIZE (offsetof(TTBButton, pszTooltipUp))
pfnCustomProc g_CustomProc = NULL;
LPARAM g_CustomProcParam = 0;
@@ -18,29 +18,31 @@ static WNDPROC buttonWndProc; CRITICAL_SECTION csButtonsHook;
-int sortfunc(const TopButtonInt* a, const TopButtonInt* b)
+int sortfunc(const TopButtonInt *a, const TopButtonInt *b)
{
return a->arrangedpos - b->arrangedpos;
}
LIST<TopButtonInt> Buttons(8, sortfunc);
-TopButtonInt* idtopos(int id, int* pPos)
+TopButtonInt *idtopos(int id, int *pPos)
{
- for ( int i = 0; i < Buttons.getCount(); i++)
+ for (int i = 0; i < Buttons.getCount(); i++)
if (Buttons[i]->id == id) {
- if (pPos) *pPos = i;
+ if (pPos)
+ *pPos = i;
return Buttons[i];
}
- if (pPos) *pPos = -1;
+ if (pPos)
+ *pPos = -1;
return NULL;
}
//----- Service buttons -----
void InsertSBut(int i)
{
- TTBButton ttb = { 0 };
+ TTBButton ttb = {0};
ttb.cbSize = sizeof(ttb);
ttb.hIconDn = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_RUN), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
ttb.hIconUp = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_RUN), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
@@ -54,7 +56,7 @@ void LoadAllSButs() //must be locked
int cnt = db_get_b(0, TTB_OPTDIR, "ServiceCnt", 0);
if (cnt > 0) {
- for (int i = 1; i<=cnt; i++)
+ for (int i = 1; i <= cnt; i++)
InsertSBut(i);
}
}
@@ -66,7 +68,7 @@ INT_PTR LaunchService(WPARAM wParam, LPARAM lParam) STARTUPINFO si = {0};
si.cb = sizeof(si);
- if ( CreateProcess(NULL, Buttons[lParam]->ptszProgram, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi)) {
+ if (CreateProcess(NULL, Buttons[lParam]->ptszProgram, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi)) {
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
}
@@ -76,7 +78,7 @@ INT_PTR LaunchService(WPARAM wParam, LPARAM lParam) void InsertLBut(int i)
{
- TTBButton ttb = { 0 };
+ TTBButton ttb = {0};
ttb.cbSize = sizeof(ttb);
ttb.hIconDn = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_RUN), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
ttb.dwFlags = TTBBF_VISIBLE | TTBBF_ISLBUTTON | TTBBF_INTERNAL;
@@ -95,10 +97,9 @@ void LoadAllLButs() }
//----- Separators -----
-
void InsertSeparator(int i)
{
- TTBButton ttb = { 0 };
+ TTBButton ttb = {0};
ttb.cbSize = sizeof(ttb);
ttb.dwFlags = TTBBF_VISIBLE | TTBBF_ISSEPARATOR | TTBBF_INTERNAL;
ttb.wParamDown = i;
@@ -133,13 +134,13 @@ static bool nameexists(const char *name) return false;
for (int i = 0; i < Buttons.getCount(); i++)
- if ( !lstrcmpA(Buttons[i]->pszName, name))
+ if (!lstrcmpA(Buttons[i]->pszName, name))
return true;
return false;
}
-static void Icon2button(TTBButton* but, HANDLE& hIcoLib, HICON& hIcon, bool bIsUp)
+static void Icon2button(TTBButton *but, HANDLE &hIcoLib, HICON &hIcon, bool bIsUp)
{
HANDLE hSrc = bIsUp ? but->hIconHandleUp : but->hIconHandleDn;
if (hSrc == NULL) {
@@ -150,22 +151,23 @@ static void Icon2button(TTBButton* but, HANDLE& hIcoLib, HICON& hIcon, bool bIsU hIcoLib = (HANDLE)CallService(MS_SKIN2_ISMANAGEDICON, WPARAM(hSrc), 0);
if (!hIcoLib) {
char buf[256];
- mir_snprintf(buf, SIZEOF(buf), "toptoolbar_%s%s", but->name, (bIsUp) ? (but->hIconDn ? "%s_up" : "%s") : "%s_dn");
+ mir_snprintf(buf, SIZEOF(buf), "toptoolbar_%s%s", but->name, bIsUp ? (but->hIconDn ? "%s_up" : "%s") : "%s_dn");
SKINICONDESC sid = { sizeof(sid) };
sid.pszSection = "Toolbar";
sid.pszName = buf;
sid.pszDefaultFile = NULL;
- sid.pszDescription = but->name;
- sid.hDefaultIcon = (bIsUp) ? but->hIconUp : but->hIconDn;
+ mir_snprintf(buf, SIZEOF(buf), "%s %s", but->name, bIsUp ? (but->hIconDn ? "" : "") : "(pressed)");
+ sid.pszDescription = buf;
+ sid.hDefaultIcon = bIsUp ? but->hIconUp : but->hIconDn;
hIcoLib = Skin_AddIcon(&sid);
}
hIcon = Skin_GetIconByHandle(hIcoLib);
}
-TopButtonInt* CreateButton(TTBButton* but)
+TopButtonInt *CreateButton(TTBButton *but)
{
- TopButtonInt* b = new TopButtonInt;
+ TopButtonInt *b = new TopButtonInt;
b->id = nextButtonId++;
b->dwFlags = but->dwFlags;
@@ -175,7 +177,7 @@ TopButtonInt* CreateButton(TTBButton* but) b->wParamDown = but->wParamDown;
b->lParamDown = but->lParamDown;
- if ( !(b->dwFlags & TTBBF_ISSEPARATOR)) {
+ if (!(b->dwFlags & TTBBF_ISSEPARATOR)) {
b->bPushed = (but->dwFlags & TTBBF_PUSHED) ? TRUE : FALSE;
if (but->dwFlags & TTBBF_ISLBUTTON) {
@@ -212,9 +214,9 @@ int ArrangeButtons() int nLineCount = 0;
int i, ypos = 1, xpos = g_ctrl->nButtonSpace, nextX = 0, y = 0;
- int newheight = g_ctrl->nButtonHeight+1, nButtonCount=0;
+ int newheight = g_ctrl->nButtonHeight + 1, nButtonCount = 0;
- for (i=0; i < Buttons.getCount(); i++)
+ for (i = 0; i < Buttons.getCount(); i++)
if (Buttons[i]->hwnd)
nButtonCount++;
@@ -224,33 +226,32 @@ int ArrangeButtons() HDWP hdwp = BeginDeferWindowPos(nButtonCount);
bool bWasButttonBefore;
- int nUsedWidth, iFirstButtonId = 0, iLastButtonId = 0;
+ int nUsedWidth, iFirstButtonId = 0, iLastButtonId = 0;
- do
- {
+ do {
nLineCount++;
bWasButttonBefore = false;
nUsedWidth = 0;
- for (i=iFirstButtonId; i < Buttons.getCount(); i++) {
+ for (i = iFirstButtonId; i < Buttons.getCount(); i++) {
TopButtonInt *b = Buttons[i];
if (b->hwnd == NULL)
continue;
int width = 0;
- if ( b->isVisible())
- width = (b->isSep()) ? SEPWIDTH+2 : g_ctrl->nButtonWidth + ((bWasButttonBefore) ? g_ctrl->nButtonSpace : 0);
+ if (b->isVisible())
+ width = b->isSep() ? SEPWIDTH + 2 : g_ctrl->nButtonWidth + (bWasButttonBefore ? g_ctrl->nButtonSpace : 0);
if (nUsedWidth + width > nBarSize)
break;
nUsedWidth += width;
- iLastButtonId = i+1;
+ iLastButtonId = i + 1;
bWasButttonBefore = !b->isSep();
}
int nFreeSpace = nBarSize - nUsedWidth;
- for (i=iFirstButtonId; i < iLastButtonId; i++) {
+ for (i = iFirstButtonId; i < iLastButtonId; i++) {
TopButtonInt *b = Buttons[i];
if (b->hwnd == NULL)
continue;
@@ -259,14 +260,15 @@ int ArrangeButtons() if (bOldVisible != b->isVisible())
g_ctrl->bOrderChanged = TRUE;
- if ( b->isVisible()) {
+ if (b->isVisible()) {
hdwp = DeferWindowPos(hdwp, b->hwnd, NULL, nextX, y, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_SHOWWINDOW);
- if ( b->isSep())
- nextX += SEPWIDTH+2;
+ if (b->isSep())
+ nextX += SEPWIDTH + 2;
else
nextX += g_ctrl->nButtonWidth + g_ctrl->nButtonSpace;
}
- else hdwp = DeferWindowPos(hdwp, Buttons[i]->hwnd, NULL, nextX, y, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_HIDEWINDOW);
+ else
+ hdwp = DeferWindowPos(hdwp, Buttons[i]->hwnd, NULL, nextX, y, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_HIDEWINDOW);
}
if (iFirstButtonId == iLastButtonId)
@@ -277,16 +279,15 @@ int ArrangeButtons() nextX = 0;
if (g_ctrl->bSingleLine)
break;
- }
- while (iFirstButtonId < Buttons.getCount() && y >= 0 && (g_ctrl->bAutoSize || (y + g_ctrl->nButtonHeight <= rcClient.bottom - rcClient.top)));
+ } while (iFirstButtonId < Buttons.getCount() && y >= 0 && (g_ctrl->bAutoSize || (y + g_ctrl->nButtonHeight <= rcClient.bottom - rcClient.top)));
- for (i=iLastButtonId; i < Buttons.getCount(); i++)
+ for (i = iLastButtonId; i < Buttons.getCount(); i++)
hdwp = DeferWindowPos(hdwp, Buttons[i]->hwnd, NULL, nextX, y, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_HIDEWINDOW);
if (hdwp)
EndDeferWindowPos(hdwp);
- return (g_ctrl->nButtonHeight + g_ctrl->nButtonSpace)*nLineCount - g_ctrl->nButtonSpace;
+ return (g_ctrl->nButtonHeight + g_ctrl->nButtonSpace) * nLineCount - g_ctrl->nButtonSpace;
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -299,14 +300,14 @@ INT_PTR TTBAddButton(WPARAM wParam, LPARAM lParam) if (wParam == 0)
return -1;
- TTBButton *but = (TTBButton*)wParam;
+ TTBButton *but = (TTBButton *)wParam;
if (but->cbSize != sizeof(TTBButton) && but->cbSize != OLD_TBBUTTON_SIZE)
return -1;
- if ( !(but->dwFlags && TTBBF_ISLBUTTON) && nameexists(but->name))
+ if (!(but->dwFlags && TTBBF_ISLBUTTON) && nameexists(but->name))
return -1;
- TopButtonInt* b = CreateButton(but);
+ TopButtonInt *b = CreateButton(but);
b->hLangpack = (int)lParam;
b->LoadSettings();
b->CreateWnd();
@@ -314,10 +315,8 @@ INT_PTR TTBAddButton(WPARAM wParam, LPARAM lParam) delete b;
return -1;
}
- {
- mir_cslock lck(csButtonsHook);
- Buttons.insert(b);
- }
+ mir_cslock lck(csButtonsHook);
+ Buttons.insert(b);
g_ctrl->bOrderChanged = TRUE;
ArrangeButtons();
@@ -332,7 +331,7 @@ INT_PTR TTBRemoveButton(WPARAM wParam, LPARAM lParam) mir_cslock lck(csButtonsHook);
int idx;
- TopButtonInt* b = idtopos(wParam, &idx);
+ TopButtonInt *b = idtopos(wParam, &idx);
if (b == NULL)
return -1;
@@ -352,12 +351,12 @@ INT_PTR TTBSetState(WPARAM wParam, LPARAM lParam) {
mir_cslock lck(csButtonsHook);
- TopButtonInt* b = idtopos(wParam);
+ TopButtonInt *b = idtopos(wParam);
if (b == NULL)
return -1;
- b->bPushed = (lParam & TTBST_PUSHED)?TRUE:FALSE;
- b->bPushed = (lParam & TTBST_RELEASED)?FALSE:TRUE;
+ b->bPushed = (lParam & TTBST_PUSHED) ? TRUE : FALSE;
+ b->bPushed = (lParam & TTBST_RELEASED) ? FALSE : TRUE;
b->SetBitmap();
return 0;
}
@@ -368,7 +367,7 @@ INT_PTR TTBSetState(WPARAM wParam, LPARAM lParam) INT_PTR TTBGetState(WPARAM wParam, LPARAM lParam)
{
mir_cslock lck(csButtonsHook);
- TopButtonInt* b = idtopos(wParam);
+ TopButtonInt *b = idtopos(wParam);
if (b == NULL)
return -1;
@@ -381,11 +380,11 @@ INT_PTR TTBGetOptions(WPARAM wParam, LPARAM lParam) INT_PTR retval;
mir_cslock lck(csButtonsHook);
- TopButtonInt* b = idtopos(wParam);
+ TopButtonInt *b = idtopos(wParam);
if (b == NULL)
return -1;
- switch(LOWORD(wParam)) {
+ switch (LOWORD(wParam)) {
case TTBO_FLAGS:
retval = b->dwFlags & (~TTBBF_PUSHED);
if (b->bPushed)
@@ -419,7 +418,7 @@ INT_PTR TTBGetOptions(WPARAM wParam, LPARAM lParam) else
replaceStr(lpTTB->pszService, b->pszService);
- retval = ( INT_PTR )lpTTB;
+ retval = (INT_PTR)lpTTB;
}
break;
@@ -433,14 +432,14 @@ INT_PTR TTBGetOptions(WPARAM wParam, LPARAM lParam) INT_PTR TTBSetOptions(WPARAM wParam, LPARAM lParam)
{
- int retval;
+ int retval = 0;
mir_cslock lck(csButtonsHook);
- TopButtonInt* b = idtopos(HIWORD(wParam));
+ TopButtonInt *b = idtopos(HIWORD(wParam));
if (b == NULL)
return -1;
- switch(LOWORD(wParam)) {
+ switch (LOWORD(wParam)) {
case TTBO_FLAGS:
if (b->dwFlags == lParam)
break;
@@ -451,7 +450,7 @@ INT_PTR TTBSetOptions(WPARAM wParam, LPARAM lParam) b->SetBitmap();
if (retval & TTBBF_VISIBLE) {
ArrangeButtons();
- b->SaveSettings(0,0);
+ b->SaveSettings(0, 0);
}
retval = 1;
@@ -461,8 +460,8 @@ INT_PTR TTBSetOptions(WPARAM wParam, LPARAM lParam) if (lParam == 0)
break;
- replaceStrT(b->ptszTooltip, TranslateTS( _A2T((LPCSTR)lParam)));
- SendMessage(b->hwnd,BUTTONADDTOOLTIP,(WPARAM)b->ptszTooltip,BATF_UNICODE);
+ replaceStrT(b->ptszTooltip, TranslateTS(_A2T((LPCSTR)lParam)));
+ SendMessage(b->hwnd, BUTTONADDTOOLTIP, (WPARAM)b->ptszTooltip, BATF_UNICODE);
retval = 1;
break;
@@ -488,7 +487,7 @@ INT_PTR TTBSetOptions(WPARAM wParam, LPARAM lParam) if (retval & TTBBF_VISIBLE) {
ArrangeButtons();
- b->SaveSettings(0,0);
+ b->SaveSettings(0, 0);
}
if (b->dwFlags & TTBBF_ISLBUTTON)
@@ -520,8 +519,8 @@ int OnIconChange(WPARAM wParam, LPARAM lParam) {
mir_cslock lck(csButtonsHook);
for (int i = 0; i < Buttons.getCount(); i++) {
- TopButtonInt* b = Buttons[i];
- if ( !b->hIconHandleUp && !b->hIconHandleDn)
+ TopButtonInt *b = Buttons[i];
+ if (!b->hIconHandleUp && !b->hIconHandleDn)
continue;
if (b->hIconHandleUp) {
@@ -578,7 +577,7 @@ int OnPluginUnload(WPARAM, LPARAM lParam) bool bNeedUpdate = false;
mir_cslock lck(csButtonsHook);
- for (int i=Buttons.getCount()-1; i >= 0; i--)
+ for (int i = Buttons.getCount() - 1; i >= 0; i--)
if (Buttons[i]->hLangpack == hLangpack) {
TTBRemoveButton(Buttons[i]->id, 0);
bNeedUpdate = true;
@@ -606,7 +605,7 @@ static int OnModulesLoad(WPARAM wParam, LPARAM lParam) if (hEvent != 0)
CallService(MS_SYSTEM_WAITONHANDLE, (WPARAM)hEvent, (LPARAM)"TTB_ONSTARTUPFIRE");
- if ( HookEvent(ME_BACKGROUNDCONFIG_CHANGED, OnBGChange)) {
+ if (HookEvent(ME_BACKGROUNDCONFIG_CHANGED, OnBGChange)) {
char buf[256];
mir_snprintf(buf, SIZEOF(buf), "%s/%s", LPGEN("TopToolBar background"), TTB_OPTDIR);
CallService(MS_BACKGROUNDCONFIG_REGISTER, (WPARAM)buf, 0);
@@ -632,12 +631,12 @@ static int OnShutdown(WPARAM wParam, LPARAM lParam) /////////////////////////////////////////////////////////////////////////////////////////
-static LRESULT CALLBACK TTBButtonWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+static LRESULT CALLBACK TTBButtonWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
LRESULT lResult = buttonWndProc(hwnd, msg, wParam, lParam);
if (msg == WM_NCCREATE) {
- TopButtonInt* p = (TopButtonInt*)((CREATESTRUCT*)lParam)->lpCreateParams;
+ TopButtonInt *p = (TopButtonInt *)((CREATESTRUCT *)lParam)->lpCreateParams;
if (g_CustomProc)
g_CustomProc((HANDLE)p->id, hwnd, g_CustomProcParam);
}
@@ -647,14 +646,14 @@ static LRESULT CALLBACK TTBButtonWndProc(HWND hwnd, UINT msg, WPARAM wParam, LP int LoadToolbarModule()
{
- if ( !ServiceExists(MS_CLIST_FRAMES_ADDFRAME)) {
- if ( !db_get_b(NULL, TTB_OPTDIR, "WarningDone", 0))
+ if (!ServiceExists(MS_CLIST_FRAMES_ADDFRAME)) {
+ if (!db_get_b(NULL, TTB_OPTDIR, "WarningDone", 0))
MessageBox(0, TranslateT("Frames service has not been found, so plugin will be disabled.\nTo run it you need to install and / or enable contact list plugin that supports it:\n- Modern contact list\n- MultiWindow (MW)\n- Nicer+\nYou can get them at http://miranda-ng.org/"), TranslateT("TopToolBar"), 0);
db_set_b(NULL, TTB_OPTDIR, "WarningDone", 1);
return 1;
}
- g_ctrl = (TTBCtrl*)mir_calloc( sizeof(TTBCtrl));
+ g_ctrl = (TTBCtrl *)mir_calloc(sizeof(TTBCtrl));
g_ctrl->nButtonHeight = db_get_dw(0, TTB_OPTDIR, "BUTTHEIGHT", DEFBUTTHEIGHT);
g_ctrl->nButtonWidth = db_get_dw(0, TTB_OPTDIR, "BUTTWIDTH", DEFBUTTWIDTH);
g_ctrl->nButtonSpace = db_get_dw(0, TTB_OPTDIR, "BUTTGAP", DEFBUTTGAP);
@@ -692,13 +691,13 @@ int LoadToolbarModule() CreateServiceFunction("TopToolBar/SetCustomProc", TTBSetCustomProc);
CreateServiceFunction("TTB_ONSTARTUPFIRE", OnEventFire);
- buttonWndProc = (WNDPROC)CallService("Button/GetWindowProc",0,0);
+ buttonWndProc = (WNDPROC)CallService("Button/GetWindowProc", 0, 0);
WNDCLASSEX wc = {0};
wc.cbSize = sizeof(wc);
wc.lpszClassName = TTB_BUTTON_CLASS;
wc.lpfnWndProc = TTBButtonWndProc;
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
- wc.cbWndExtra = sizeof(void*);
+ wc.cbWndExtra = sizeof(void *);
wc.hbrBackground = 0;
wc.style = CS_GLOBALCLASS;
RegisterClassEx(&wc);
@@ -714,7 +713,7 @@ int UnloadToolbarModule() DeleteObject(hBmpSeparator);
DeleteCriticalSection(&csButtonsHook);
- for (int i=0; i < Buttons.getCount(); i++)
+ for (int i = 0; i < Buttons.getCount(); i++)
delete Buttons[i];
mir_free(g_ctrl);
diff --git a/plugins/TopToolBar/src/toolbarwnd.cpp b/plugins/TopToolBar/src/toolbarwnd.cpp index 5e4ee49469..cf32d796f9 100644 --- a/plugins/TopToolBar/src/toolbarwnd.cpp +++ b/plugins/TopToolBar/src/toolbarwnd.cpp @@ -248,16 +248,16 @@ INT_PTR OnEventFire(WPARAM wParam, LPARAM lParam) if (parent == NULL) // no clist, no buttons
return -1;
- WNDCLASS wndclass = { 0 };
- wndclass.lpfnWndProc = TopToolBarProc;
- wndclass.cbWndExtra = sizeof(void*);
- wndclass.hInstance = hInst;
- wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
- wndclass.hbrBackground = (HBRUSH)(COLOR_BTNFACE+1);
+ WNDCLASS wndclass = {0};
+ wndclass.lpfnWndProc = TopToolBarProc;
+ wndclass.cbWndExtra = sizeof(void *);
+ wndclass.hInstance = hInst;
+ wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
+ wndclass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
wndclass.lpszClassName = pluginname;
RegisterClass(&wndclass);
- g_ctrl->pButtonList = (SortedList*)&Buttons;
+ g_ctrl->pButtonList = (SortedList *)&Buttons;
g_ctrl->hWnd = CreateWindow(pluginname, _T("Toolbar"),
WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
0, 0, 0, g_ctrl->nLastHeight, parent, NULL, hInst, NULL);
diff --git a/plugins/TopToolBar/src/topbutton.cpp b/plugins/TopToolBar/src/topbutton.cpp index 45a13b0dab..f0cb4ba82a 100644 --- a/plugins/TopToolBar/src/topbutton.cpp +++ b/plugins/TopToolBar/src/topbutton.cpp @@ -25,25 +25,24 @@ TopButtonInt::~TopButtonInt() DWORD TopButtonInt::CheckFlags(DWORD Flags)
{
int res = 0;
- if ( BitChanged(TTBBF_DISABLED)) {
+ if (BitChanged(TTBBF_DISABLED)) {
dwFlags ^= TTBBF_DISABLED;
- EnableWindow(hwnd,(dwFlags & TTBBF_DISABLED)?FALSE:TRUE);
+ EnableWindow(hwnd, (dwFlags & TTBBF_DISABLED) ? FALSE : TRUE);
}
- if ( BitChanged(TTBBF_ASPUSHBUTTON)) {
+ if (BitChanged(TTBBF_ASPUSHBUTTON)) {
dwFlags ^= TTBBF_ASPUSHBUTTON;
- SendMessage(hwnd, BUTTONSETASPUSHBTN, (dwFlags & TTBBF_ASPUSHBUTTON)?1:0, 0);
+ SendMessage(hwnd, BUTTONSETASPUSHBTN, (dwFlags & TTBBF_ASPUSHBUTTON) ? 1 : 0, 0);
}
- if ( BitChanged(TTBBF_SHOWTOOLTIP)) {
+ if (BitChanged(TTBBF_SHOWTOOLTIP)) {
dwFlags ^= TTBBF_SHOWTOOLTIP;
- SendMessage(hwnd,BUTTONADDTOOLTIP,
- (WPARAM)((dwFlags & TTBBF_SHOWTOOLTIP) ? ptszTooltip : _T("")), BATF_TCHAR);
+ SendMessage(hwnd, BUTTONADDTOOLTIP, (WPARAM)((dwFlags & TTBBF_SHOWTOOLTIP) ? ptszTooltip : _T("")), BATF_TCHAR);
}
// next settings changing visual side, requires additional actions
- if ( BitChanged(TTBBF_VISIBLE)) {
+ if (BitChanged(TTBBF_VISIBLE)) {
dwFlags ^= TTBBF_VISIBLE;
res |= TTBBF_VISIBLE;
}
- if ( BitChanged(TTBBF_PUSHED)) {
+ if (BitChanged(TTBBF_PUSHED)) {
dwFlags ^= TTBBF_PUSHED;
res |= TTBBF_PUSHED;
bPushed = (dwFlags & TTBBF_PUSHED) ? TRUE : FALSE;
@@ -53,8 +52,8 @@ DWORD TopButtonInt::CheckFlags(DWORD Flags) void TopButtonInt::CreateWnd()
{
- if ( !(dwFlags & TTBBF_ISSEPARATOR)) {
- hwnd = CreateWindow(TTB_BUTTON_CLASS, _T(""), BS_PUSHBUTTON|WS_CHILD|WS_TABSTOP|SS_NOTIFY, 0, 0, g_ctrl->nButtonWidth, g_ctrl->nButtonHeight, g_ctrl->hWnd, NULL, hInst, this);
+ if (!(dwFlags & TTBBF_ISSEPARATOR)) {
+ hwnd = CreateWindow(TTB_BUTTON_CLASS, _T(""), BS_PUSHBUTTON | WS_CHILD | WS_TABSTOP | SS_NOTIFY, 0, 0, g_ctrl->nButtonWidth, g_ctrl->nButtonHeight, g_ctrl->hWnd, NULL, hInst, this);
if (dwFlags & TTBBF_ASPUSHBUTTON)
SendMessage(hwnd, BUTTONSETASPUSHBTN, 1, 0);
@@ -62,11 +61,11 @@ void TopButtonInt::CreateWnd() if (db_get_b(0, TTB_OPTDIR, "UseFlatButton", 1))
SendMessage(hwnd, BUTTONSETASFLATBTN, TRUE, 0);
- EnableWindow(hwnd,(dwFlags & TTBBF_DISABLED)?FALSE:TRUE);
+ EnableWindow(hwnd, (dwFlags & TTBBF_DISABLED) ? FALSE : TRUE);
}
// maybe SEPWIDTH, not g_ctrl->nButtonWidth?
- else
- hwnd = CreateWindow( _T("STATIC"), _T(""), WS_CHILD|SS_NOTIFY, 0, 0, g_ctrl->nButtonWidth, g_ctrl->nButtonHeight, g_ctrl->hWnd, NULL, hInst, 0);
+ else
+ hwnd = CreateWindow(_T("STATIC"), _T(""), WS_CHILD | SS_NOTIFY, 0, 0, g_ctrl->nButtonWidth, g_ctrl->nButtonHeight, g_ctrl->hWnd, NULL, hInst, 0);
SetWindowLongPtr(hwnd, GWLP_USERDATA, id);
SetBitmap();
@@ -86,7 +85,7 @@ void TopButtonInt::LoadSettings() AS(buf2, "Sep", buf1);
arrangedpos = db_get_b(0, TTB_OPTDIR, AS(buf, buf2, "_Position"), Buttons.getCount());
- if ( db_get_b(0, TTB_OPTDIR, AS(buf, buf2, "_Visible"), oldv) > 0 )
+ if (db_get_b(0, TTB_OPTDIR, AS(buf, buf2, "_Visible"), oldv) > 0)
dwFlags |= TTBBF_VISIBLE;
}
else if ((dwFlags & TTBBF_ISLBUTTON ) && (dwFlags & TTBBF_INTERNAL)) {
@@ -102,12 +101,12 @@ void TopButtonInt::LoadSettings() ptszProgram = db_get_tsa(0, TTB_OPTDIR, AS(buf, buf2, "_lpath"));
arrangedpos = db_get_b(0, TTB_OPTDIR, AS(buf, buf2, "_Position"), Buttons.getCount());
- if ( db_get_b(0, TTB_OPTDIR, AS(buf, buf2, "_Visible"), oldv) > 0 )
+ if (db_get_b(0, TTB_OPTDIR, AS(buf, buf2, "_Visible"), oldv) > 0)
dwFlags |= TTBBF_VISIBLE;
}
else {
arrangedpos = db_get_b(0, TTB_OPTDIR, AS(buf, pszName, "_Position"), Buttons.getCount());
- if ( db_get_b(0, TTB_OPTDIR, AS(buf, pszName, "_Visible"), oldv) > 0 )
+ if (db_get_b(0, TTB_OPTDIR, AS(buf, pszName, "_Visible"), oldv) > 0)
dwFlags |= TTBBF_VISIBLE;
}
@@ -154,18 +153,18 @@ void TopButtonInt::SetBitmap() if (dwFlags & TTBBF_ISSEPARATOR) {
SetWindowLongPtr(hwnd, GWL_STYLE, curstyle | SS_BITMAP);
SendMessage(hwnd, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM)hBmpSeparator);
- SendMessage(hwnd, BM_SETIMAGE, IMAGE_BITMAP, (LPARAM)hBmpSeparator);
+ SendMessage(hwnd, BM_SETIMAGE, IMAGE_BITMAP, (LPARAM)hBmpSeparator);
}
else {
if (GetWindowLongPtr(hwnd, GWL_STYLE) & SS_ICON)
SetWindowLongPtr(hwnd, GWL_STYLE, curstyle | SS_ICON);
- TCHAR* pTooltip;
+ TCHAR *pTooltip;
if (bPushed) {
- SendMessage(hwnd, BM_SETIMAGE, IMAGE_ICON, (LPARAM)((hIconDn) ? hIconDn : hIconUp));
+ SendMessage(hwnd, BM_SETIMAGE, IMAGE_ICON, (LPARAM)(hIconDn ? hIconDn : hIconUp));
SendMessage(hwnd, BM_SETCHECK, BST_CHECKED, 0);
- pTooltip = (ptszTooltipDn) ? ptszTooltipDn : ptszTooltipUp;
+ pTooltip = ptszTooltipDn ? ptszTooltipDn : ptszTooltipUp;
}
else {
SendMessage(hwnd, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIconUp);
|