diff options
author | George Hazan <george.hazan@gmail.com> | 2015-06-28 15:20:06 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2015-06-28 15:20:06 +0000 |
commit | dcc561ccf83c7468bf512ab94db0c34bfdb49dfc (patch) | |
tree | b71f88f9be3198372f8e8cf11fa6c4093367a8dc /plugins/TopToolBar | |
parent | 7cd632b27e8bbae2005518606666547144c100dc (diff) |
code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@14428 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/TopToolBar')
-rw-r--r-- | plugins/TopToolBar/src/InternalButtons.cpp | 3 | ||||
-rw-r--r-- | plugins/TopToolBar/src/toolbar.cpp | 30 | ||||
-rw-r--r-- | plugins/TopToolBar/src/ttbopt.cpp | 3 |
3 files changed, 8 insertions, 28 deletions
diff --git a/plugins/TopToolBar/src/InternalButtons.cpp b/plugins/TopToolBar/src/InternalButtons.cpp index ac0869d4a2..8ed9c6022d 100644 --- a/plugins/TopToolBar/src/InternalButtons.cpp +++ b/plugins/TopToolBar/src/InternalButtons.cpp @@ -113,8 +113,7 @@ void InitInternalButtons() CreateServiceFunction(TTBI_SHOWHIDEOFFLINE, TTBInternalShowHideOffline);
for (int i = 0; i < _countof(stdButtons); i++) {
- TTBButton ttb = {0};
- ttb.cbSize = sizeof(ttb);
+ TTBButton ttb = { 0 };
ttb.name = stdButtons[i].name;
ttb.pszService = stdButtons[i].pszService;
ttb.dwFlags = TTBBF_INTERNAL;
diff --git a/plugins/TopToolBar/src/toolbar.cpp b/plugins/TopToolBar/src/toolbar.cpp index d9b21dad72..c0c86131bf 100644 --- a/plugins/TopToolBar/src/toolbar.cpp +++ b/plugins/TopToolBar/src/toolbar.cpp @@ -1,8 +1,6 @@ #include "common.h"
-#define OLD_TBBUTTON_SIZE (offsetof(TTBButton, pszTooltipUp))
-
pfnCustomProc g_CustomProc = NULL;
LPARAM g_CustomProcParam = 0;
TTBCtrl *g_ctrl = NULL;
@@ -42,8 +40,7 @@ TopButtonInt *idtopos(int id, int *pPos) //----- Service buttons -----
void InsertSBut(int i)
{
- TTBButton ttb = {0};
- ttb.cbSize = sizeof(ttb);
+ TTBButton ttb = { 0 };
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);
ttb.dwFlags = TTBBF_VISIBLE | TTBBF_ISSBUTTON | TTBBF_INTERNAL;
@@ -78,8 +75,7 @@ INT_PTR LaunchService(WPARAM, LPARAM lParam) void InsertLBut(int i)
{
- TTBButton ttb = {0};
- ttb.cbSize = sizeof(ttb);
+ TTBButton ttb = { 0 };
ttb.hIconDn = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_RUN), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
ttb.dwFlags = TTBBF_VISIBLE | TTBBF_ISLBUTTON | TTBBF_INTERNAL;
ttb.name = LPGEN("Default");
@@ -99,8 +95,7 @@ void LoadAllLButs() //----- Separators -----
void InsertSeparator(int i)
{
- TTBButton ttb = {0};
- ttb.cbSize = sizeof(ttb);
+ TTBButton ttb = { 0 };
ttb.dwFlags = TTBBF_VISIBLE | TTBBF_ISSEPARATOR | TTBBF_INTERNAL;
ttb.wParamDown = i;
TTBAddButton((WPARAM)&ttb, 0);
@@ -195,10 +190,8 @@ TopButtonInt *CreateButton(TTBButton *but) Icon2button(but, b->hIconHandleUp, b->hIconUp, true);
Icon2button(but, b->hIconHandleDn, b->hIconDn, false);
- if (but->cbSize > OLD_TBBUTTON_SIZE) {
- b->ptszTooltipUp = mir_a2t(but->pszTooltipUp);
- b->ptszTooltipDn = mir_a2t(but->pszTooltipDn);
- }
+ b->ptszTooltipUp = mir_a2t(but->pszTooltipUp);
+ b->ptszTooltipDn = mir_a2t(but->pszTooltipDn);
}
return b;
}
@@ -306,9 +299,6 @@ INT_PTR TTBAddButton(WPARAM wParam, LPARAM lParam) return -1;
TTBButton *but = (TTBButton *)wParam;
- if (but->cbSize != sizeof(TTBButton) && but->cbSize != OLD_TBBUTTON_SIZE)
- return -1;
-
if (!(but->dwFlags & TTBBF_ISLBUTTON) && nameexists(but->name))
return -1;
@@ -397,10 +387,7 @@ INT_PTR TTBGetOptions(WPARAM wParam, LPARAM lParam) case TTBO_ALLDATA:
if (lParam) {
- lpTTBButton lpTTB = (lpTTBButton)lParam;
- if (lpTTB->cbSize != sizeof(TTBButton))
- return -1;
-
+ TTBButton *lpTTB = (TTBButton*)lParam;
lpTTB->dwFlags = b->dwFlags & (~TTBBF_PUSHED);
if (b->bPushed)
lpTTB->dwFlags |= TTBBF_PUSHED;
@@ -461,10 +448,7 @@ INT_PTR TTBSetOptions(WPARAM wParam, LPARAM lParam) case TTBO_ALLDATA:
if (lParam) {
- lpTTBButton lpTTB = (lpTTBButton)lParam;
- if (lpTTB->cbSize != sizeof(TTBButton))
- return 0;
-
+ TTBButton *lpTTB = (TTBButton*)lParam;
DWORD retval = b->CheckFlags(lpTTB->dwFlags);
bool changed = false;
diff --git a/plugins/TopToolBar/src/ttbopt.cpp b/plugins/TopToolBar/src/ttbopt.cpp index ec2eab562b..6aa57f9d03 100644 --- a/plugins/TopToolBar/src/ttbopt.cpp +++ b/plugins/TopToolBar/src/ttbopt.cpp @@ -277,7 +277,6 @@ static INT_PTR CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR if (!(btn->dwFlags & TTBBF_OPTIONAL)) {
// create button
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 | TTBBF_OPTIONAL;
ttb.name = NULL;
@@ -306,7 +305,6 @@ static INT_PTR CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR if (ctrlid == IDC_ADDLBUTTON) {
// create button
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 | TTBBF_OPTIONAL;
ttb.name = LPGEN("Default");
@@ -329,7 +327,6 @@ static INT_PTR CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR if (ctrlid == IDC_ADDSEP) {
// create button
TTBButton ttb = { 0 };
- ttb.cbSize = sizeof(ttb);
ttb.dwFlags = TTBBF_VISIBLE | TTBBF_ISSEPARATOR | TTBBF_INTERNAL | TTBBF_OPTIONAL;
TopButtonInt* b = CreateButton(&ttb);
|