diff options
author | George Hazan <george.hazan@gmail.com> | 2012-07-07 07:42:40 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-07-07 07:42:40 +0000 |
commit | 6ba9eb829a0b95bf9e6c6bdc9ed37d1d3947b87b (patch) | |
tree | 6d578ae1a68dcc7ab48d38ef9c33605d392d8186 /plugins/Clist_modern/modern_statusbar_options.cpp | |
parent | 3447a9bff3aa6ba3a2d9bab91653cab257c29bcf (diff) |
correct mir_free usage
git-svn-id: http://svn.miranda-ng.org/main/trunk@808 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Clist_modern/modern_statusbar_options.cpp')
-rw-r--r-- | plugins/Clist_modern/modern_statusbar_options.cpp | 381 |
1 files changed, 159 insertions, 222 deletions
diff --git a/plugins/Clist_modern/modern_statusbar_options.cpp b/plugins/Clist_modern/modern_statusbar_options.cpp index a70fa2387c..4f6c1072ce 100644 --- a/plugins/Clist_modern/modern_statusbar_options.cpp +++ b/plugins/Clist_modern/modern_statusbar_options.cpp @@ -39,7 +39,8 @@ typedef struct _StatusBarProtocolOptions BYTE ShowXStatus;
int PaddingLeft;
int PaddingRight;
-} StatusBarProtocolOptions;
+}
+ StatusBarProtocolOptions;
static StatusBarProtocolOptions _GlobalOptions = {0};
@@ -51,29 +52,22 @@ static void UpdateXStatusIconOptions(HWND hwndDlg, BOOL perProto, StatusBarProto EnableWindow(GetDlgItem(hwndDlg,IDC_SHOWBOTH),en && IsDlgButtonChecked(hwndDlg,IDC_SHOWXSTATUS) && !IsDlgButtonChecked(hwndDlg,IDC_SHOWNORMAL));
if (IsDlgButtonChecked(hwndDlg,IDC_SHOWNORMAL)) CheckDlgButton(hwndDlg,IDC_SHOWBOTH,FALSE);
- EnableWindow(GetDlgItem(hwndDlg,IDC_SHOWNORMAL),en && IsDlgButtonChecked(hwndDlg,IDC_SHOWXSTATUS)&& !IsDlgButtonChecked(hwndDlg,IDC_SHOWBOTH));
+ EnableWindow(GetDlgItem(hwndDlg,IDC_SHOWNORMAL),en && IsDlgButtonChecked(hwndDlg,IDC_SHOWXSTATUS) && !IsDlgButtonChecked(hwndDlg,IDC_SHOWBOTH));
- EnableWindow(GetDlgItem(hwndDlg,IDC_TRANSPARENTOVERLAY),en && IsDlgButtonChecked(hwndDlg,IDC_SHOWXSTATUS) && IsDlgButtonChecked(hwndDlg,IDC_SHOWNORMAL)&& !IsDlgButtonChecked(hwndDlg,IDC_SHOWBOTH));
+ EnableWindow(GetDlgItem(hwndDlg,IDC_TRANSPARENTOVERLAY),en && IsDlgButtonChecked(hwndDlg,IDC_SHOWXSTATUS) && IsDlgButtonChecked(hwndDlg,IDC_SHOWNORMAL) && !IsDlgButtonChecked(hwndDlg,IDC_SHOWBOTH));
- {
- BYTE val = 0;
- if (IsDlgButtonChecked(hwndDlg,IDC_SHOWXSTATUS))
- {
- if (IsDlgButtonChecked(hwndDlg,IDC_SHOWBOTH)) val = 3;
- else if (IsDlgButtonChecked(hwndDlg,IDC_SHOWNORMAL)) val = 2;
- else val = 1;
- val += IsDlgButtonChecked(hwndDlg,IDC_TRANSPARENTOVERLAY)?4:0;
- }
- val += IsDlgButtonChecked(hwndDlg,IDC_SHOWXSTATUSNAME)?8:0;
- if (perProto)
- {
- dat[curSelProto].ShowXStatus = val;
- }
- else
- {
- _GlobalOptions.ShowXStatus = val;
- }
+ BYTE val = 0;
+ if (IsDlgButtonChecked(hwndDlg,IDC_SHOWXSTATUS)) {
+ if (IsDlgButtonChecked(hwndDlg,IDC_SHOWBOTH)) val = 3;
+ else if (IsDlgButtonChecked(hwndDlg,IDC_SHOWNORMAL)) val = 2;
+ else val = 1;
+ val += IsDlgButtonChecked(hwndDlg,IDC_TRANSPARENTOVERLAY)?4:0;
}
+ val += IsDlgButtonChecked(hwndDlg,IDC_SHOWXSTATUSNAME)?8:0;
+ if (perProto)
+ dat[curSelProto].ShowXStatus = val;
+ else
+ _GlobalOptions.ShowXStatus = val;
}
static void UpdateStatusBarOptionsDisplay(HWND hwndDlg)
@@ -87,23 +81,15 @@ static void UpdateStatusBarOptionsDisplay(HWND hwndDlg) perProto = FALSE;
if (perProto)
- {
sbpo = dat[curSelProto];
- }
else
- {
sbpo = _GlobalOptions;
- }
- if (perProto)
- {
+ if (perProto) {
EnableWindow(GetDlgItem(hwndDlg, IDC_SBAR_USE_ACCOUNT_SETTINGS), TRUE);
CheckDlgButton(hwndDlg, IDC_SBAR_USE_ACCOUNT_SETTINGS, sbpo.AccountIsCustomized ? BST_CHECKED : BST_UNCHECKED);
}
- else
- {
- EnableWindow(GetDlgItem(hwndDlg, IDC_SBAR_USE_ACCOUNT_SETTINGS), FALSE);
- }
+ else EnableWindow(GetDlgItem(hwndDlg, IDC_SBAR_USE_ACCOUNT_SETTINGS), FALSE);
CheckDlgButton(hwndDlg, IDC_SBAR_HIDE_ACCOUNT_COMPLETELY, sbpo.HideAccount ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_USECONNECTINGICON, sbpo.UseConnectingIcon ? BST_CHECKED : BST_UNCHECKED);
@@ -139,8 +125,7 @@ static void UpdateStatusBarOptionsDisplay(HWND hwndDlg) EnableWindow(GetDlgItem(hwndDlg, IDC_SHOWXSTATUSNAME), enableOptions);
EnableWindow(GetDlgItem(hwndDlg, IDC_SHOWXSTATUS), enableOptions && enableIcons);
- if (!enableOptions)
- {
+ if (!enableOptions) {
EnableWindow(GetDlgItem(hwndDlg, IDC_SHOWNORMAL), enableOptions && enableIcons);
EnableWindow(GetDlgItem(hwndDlg, IDC_SHOWBOTH), enableOptions && enableIcons );
EnableWindow(GetDlgItem(hwndDlg, IDC_TRANSPARENTOVERLAY), enableOptions && enableIcons);
@@ -162,7 +147,7 @@ static void UpdateStatusBarOptionsDisplay(HWND hwndDlg) UpdateXStatusIconOptions(hwndDlg, perProto, dat, curSelProto);
}
- INT_PTR CALLBACK DlgProcSBarOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+INT_PTR CALLBACK DlgProcSBarOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
StatusBarProtocolOptions *dat = (StatusBarProtocolOptions*)GetWindowLongPtr(GetDlgItem(hwndDlg,IDC_STATUSBAR_PROTO_LIST),GWLP_USERDATA);
LOGFONTA lf;
@@ -172,173 +157,163 @@ static void UpdateStatusBarOptionsDisplay(HWND hwndDlg) if (curSelProto < 0)
perProto = FALSE;
- switch (msg)
- {
- case WM_DESTROY:
- mir_free(dat);
- break;
+ switch (msg) {
case WM_INITDIALOG:
- {
- perProto = (BOOL)db_get_b(NULL,"CLUI","SBarPerProto",SETTING_SBARPERPROTO_DEFAULT);
-
- TranslateDialogDefault(hwndDlg);
+ perProto = (BOOL)db_get_b(NULL,"CLUI","SBarPerProto",SETTING_SBARPERPROTO_DEFAULT);
- CheckDlgButton(hwndDlg, IDC_SHOWSBAR, db_get_b(NULL,"CLUI","ShowSBar",SETTING_SHOWSBAR_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_STATUSBAR_PER_PROTO, perProto ? BST_CHECKED : BST_UNCHECKED);
+ TranslateDialogDefault(hwndDlg);
+ CheckDlgButton(hwndDlg, IDC_SHOWSBAR, db_get_b(NULL,"CLUI","ShowSBar",SETTING_SHOWSBAR_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_STATUSBAR_PER_PROTO, perProto ? BST_CHECKED : BST_UNCHECKED);
+ {
+ // populate per-proto list box.
+ char *szName;
+ char buf[256];
+ int count;
- { // populate per-proto list box.
- char *szName;
- char buf[256];
- int i,count;
-
- SendMessage(hwndComboBox, CB_RESETCONTENT, 0, 0);
+ SendMessage(hwndComboBox, CB_RESETCONTENT, 0, 0);
- PROTOACCOUNT **accs;
- ProtoEnumAccounts( &count, &accs );
+ PROTOACCOUNT **accs;
+ ProtoEnumAccounts( &count, &accs );
- dat = (StatusBarProtocolOptions*)mir_alloc(sizeof(StatusBarProtocolOptions)*count);
- SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_STATUSBAR_PROTO_LIST),GWLP_USERDATA,(LONG_PTR)dat);
+ dat = (StatusBarProtocolOptions*)mir_alloc(sizeof(StatusBarProtocolOptions)*count);
+ SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_STATUSBAR_PROTO_LIST),GWLP_USERDATA,(LONG_PTR)dat);
- SendMessage(hwndComboBox, CB_ADDSTRING, 0, (LPARAM)TranslateT( " << Global>>" ));
- SendMessage(hwndComboBox, CB_SETITEMDATA, 0, (LPARAM)0);
+ SendMessage(hwndComboBox, CB_ADDSTRING, 0, (LPARAM)TranslateT( " << Global>>" ));
+ SendMessage(hwndComboBox, CB_SETITEMDATA, 0, (LPARAM)0);
- for ( i=0; i < count; i++ )
- {
- szName = accs[i]->szModuleName;
- dat[i].szName = szName;
+ for (int i=0; i < count; i++ ) {
+ szName = accs[i]->szModuleName;
+ dat[i].szName = szName;
- DWORD dwNewId = SendMessage(hwndComboBox, CB_ADDSTRING, 0, (LPARAM)accs[i]->tszAccountName);
- SendMessage(hwndComboBox, CB_SETITEMDATA, dwNewId, (LPARAM)(i+1));
+ DWORD dwNewId = SendMessage(hwndComboBox, CB_ADDSTRING, 0, (LPARAM)accs[i]->tszAccountName);
+ SendMessage(hwndComboBox, CB_SETITEMDATA, dwNewId, (LPARAM)(i+1));
- mir_snprintf(buf, SIZEOF(buf), "SBarAccountIsCustom_%s", szName);
- dat[i].AccountIsCustomized = db_get_b(NULL,"CLUI", buf, SETTING_SBARACCOUNTISCUSTOM_DEFAULT);
+ mir_snprintf(buf, SIZEOF(buf), "SBarAccountIsCustom_%s", szName);
+ dat[i].AccountIsCustomized = db_get_b(NULL,"CLUI", buf, SETTING_SBARACCOUNTISCUSTOM_DEFAULT);
- mir_snprintf(buf, SIZEOF(buf), "HideAccount_%s", szName);
- dat[i].HideAccount = db_get_b(NULL,"CLUI", buf, SETTING_SBARHIDEACCOUNT_DEFAULT);
+ mir_snprintf(buf, SIZEOF(buf), "HideAccount_%s", szName);
+ dat[i].HideAccount = db_get_b(NULL,"CLUI", buf, SETTING_SBARHIDEACCOUNT_DEFAULT);
- mir_snprintf(buf, SIZEOF(buf), "SBarShow_%s", szName);
- dat[i].SBarShow = db_get_b(NULL,"CLUI", buf, SETTING_SBARSHOW_DEFAULT);
+ mir_snprintf(buf, SIZEOF(buf), "SBarShow_%s", szName);
+ dat[i].SBarShow = db_get_b(NULL,"CLUI", buf, SETTING_SBARSHOW_DEFAULT);
- mir_snprintf(buf, SIZEOF(buf), "SBarRightClk_%s", szName);
- dat[i].SBarRightClk = db_get_b(NULL,"CLUI", buf, SETTING_SBARRIGHTCLK_DEFAULT);
+ mir_snprintf(buf, SIZEOF(buf), "SBarRightClk_%s", szName);
+ dat[i].SBarRightClk = db_get_b(NULL,"CLUI", buf, SETTING_SBARRIGHTCLK_DEFAULT);
- mir_snprintf(buf, SIZEOF(buf), "ShowUnreadEmails_%s", szName);
- dat[i].ShowUnreadEmails = db_get_b(NULL,"CLUI", buf, SETTING_SHOWUNREADEMAILS_DEFAULT);
+ mir_snprintf(buf, SIZEOF(buf), "ShowUnreadEmails_%s", szName);
+ dat[i].ShowUnreadEmails = db_get_b(NULL,"CLUI", buf, SETTING_SHOWUNREADEMAILS_DEFAULT);
- mir_snprintf(buf, SIZEOF(buf), "ShowXStatus_%s", szName);
- dat[i].ShowXStatus = db_get_b(NULL,"CLUI", buf, SETTING_SHOWXSTATUS_DEFAULT);
+ mir_snprintf(buf, SIZEOF(buf), "ShowXStatus_%s", szName);
+ dat[i].ShowXStatus = db_get_b(NULL,"CLUI", buf, SETTING_SHOWXSTATUS_DEFAULT);
- mir_snprintf(buf, SIZEOF(buf), "UseConnectingIcon_%s", szName);
- dat[i].UseConnectingIcon = db_get_b(NULL,"CLUI", buf, SETTING_USECONNECTINGICON_DEFAULT);
+ mir_snprintf(buf, SIZEOF(buf), "UseConnectingIcon_%s", szName);
+ dat[i].UseConnectingIcon = db_get_b(NULL,"CLUI", buf, SETTING_USECONNECTINGICON_DEFAULT);
- mir_snprintf(buf, SIZEOF(buf), "PaddingLeft_%s", szName);
- dat[i].PaddingLeft = db_get_dw(NULL,"CLUI", buf, SETTING_PADDINGLEFT_DEFAULT);
+ mir_snprintf(buf, SIZEOF(buf), "PaddingLeft_%s", szName);
+ dat[i].PaddingLeft = db_get_dw(NULL,"CLUI", buf, SETTING_PADDINGLEFT_DEFAULT);
- mir_snprintf(buf, SIZEOF(buf), "PaddingRight_%s", szName);
- dat[i].PaddingRight = db_get_dw(NULL,"CLUI", buf, SETTING_PADDINGRIGHT_DEFAULT);
- }
-
- if (count)
- {
- SendMessage(hwndComboBox, CB_SETCURSEL, 0, 0);
- }
+ mir_snprintf(buf, SIZEOF(buf), "PaddingRight_%s", szName);
+ dat[i].PaddingRight = db_get_dw(NULL,"CLUI", buf, SETTING_PADDINGRIGHT_DEFAULT);
}
- _GlobalOptions.AccountIsCustomized = TRUE;
- _GlobalOptions.SBarRightClk = db_get_b(NULL,"CLUI", "SBarRightClk", SETTING_SBARRIGHTCLK_DEFAULT);
- _GlobalOptions.ShowUnreadEmails = db_get_b(NULL,"CLUI", "ShowUnreadEmails", SETTING_SHOWUNREADEMAILS_DEFAULT);
- _GlobalOptions.ShowXStatus = db_get_b(NULL,"CLUI", "ShowXStatus", SETTING_SHOWXSTATUS_DEFAULT);
- _GlobalOptions.UseConnectingIcon = db_get_b(NULL,"CLUI", "UseConnectingIcon", SETTING_USECONNECTINGICON_DEFAULT);
- _GlobalOptions.SBarShow = db_get_b(NULL,"CLUI","SBarShow",SETTING_SBARSHOW_DEFAULT);
+ if (count)
+ SendMessage(hwndComboBox, CB_SETCURSEL, 0, 0);
+ }
- CheckDlgButton(hwndDlg, IDC_EQUALSECTIONS, db_get_b(NULL,"CLUI","EqualSections",SETTING_EQUALSECTIONS_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ _GlobalOptions.AccountIsCustomized = TRUE;
+ _GlobalOptions.SBarRightClk = db_get_b(NULL,"CLUI", "SBarRightClk", SETTING_SBARRIGHTCLK_DEFAULT);
+ _GlobalOptions.ShowUnreadEmails = db_get_b(NULL,"CLUI", "ShowUnreadEmails", SETTING_SHOWUNREADEMAILS_DEFAULT);
+ _GlobalOptions.ShowXStatus = db_get_b(NULL,"CLUI", "ShowXStatus", SETTING_SHOWXSTATUS_DEFAULT);
+ _GlobalOptions.UseConnectingIcon = db_get_b(NULL,"CLUI", "UseConnectingIcon", SETTING_USECONNECTINGICON_DEFAULT);
+ _GlobalOptions.SBarShow = db_get_b(NULL,"CLUI","SBarShow",SETTING_SBARSHOW_DEFAULT);
- SendDlgItemMessage(hwndDlg,IDC_MULTI_SPIN,UDM_SETRANGE,0,MAKELONG(50,0));
- SendDlgItemMessage(hwndDlg,IDC_MULTI_SPIN,UDM_SETPOS,0,MAKELONG(db_get_b(NULL,"CLUI","StatusBarProtosPerLine",SETTING_PROTOSPERLINE_DEFAULT),0));
+ CheckDlgButton(hwndDlg, IDC_EQUALSECTIONS, db_get_b(NULL,"CLUI","EqualSections",SETTING_EQUALSECTIONS_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
- SendDlgItemMessage(hwndDlg,IDC_OFFSETSPIN,UDM_SETRANGE,0,MAKELONG(50,0));
- SendDlgItemMessage(hwndDlg,IDC_OFFSETSPIN,UDM_SETPOS,0,MAKELONG(db_get_dw(NULL,"CLUI","LeftOffset",SETTING_LEFTOFFSET_DEFAULT),0));
+ SendDlgItemMessage(hwndDlg,IDC_MULTI_SPIN,UDM_SETRANGE,0,MAKELONG(50,0));
+ SendDlgItemMessage(hwndDlg,IDC_MULTI_SPIN,UDM_SETPOS,0,MAKELONG(db_get_b(NULL,"CLUI","StatusBarProtosPerLine",SETTING_PROTOSPERLINE_DEFAULT),0));
- SendDlgItemMessage(hwndDlg,IDC_OFFSETSPIN2,UDM_SETRANGE,0,MAKELONG(50,0));
- SendDlgItemMessage(hwndDlg,IDC_OFFSETSPIN2,UDM_SETPOS,0,MAKELONG(db_get_dw(NULL,"CLUI","RightOffset",SETTING_RIGHTOFFSET_DEFAULT),0));
+ SendDlgItemMessage(hwndDlg,IDC_OFFSETSPIN,UDM_SETRANGE,0,MAKELONG(50,0));
+ SendDlgItemMessage(hwndDlg,IDC_OFFSETSPIN,UDM_SETPOS,0,MAKELONG(db_get_dw(NULL,"CLUI","LeftOffset",SETTING_LEFTOFFSET_DEFAULT),0));
- SendDlgItemMessage(hwndDlg,IDC_SBAR_BORDER_TOP_SPIN,UDM_SETRANGE,0,MAKELONG(50,0));
- SendDlgItemMessage(hwndDlg,IDC_SBAR_BORDER_TOP_SPIN,UDM_SETPOS,0,MAKELONG(db_get_dw(NULL,"CLUI","TopOffset",SETTING_TOPOFFSET_DEFAULT),0));
+ SendDlgItemMessage(hwndDlg,IDC_OFFSETSPIN2,UDM_SETRANGE,0,MAKELONG(50,0));
+ SendDlgItemMessage(hwndDlg,IDC_OFFSETSPIN2,UDM_SETPOS,0,MAKELONG(db_get_dw(NULL,"CLUI","RightOffset",SETTING_RIGHTOFFSET_DEFAULT),0));
- SendDlgItemMessage(hwndDlg,IDC_SBAR_BORDER_BOTTOM_SPIN,UDM_SETRANGE,0,MAKELONG(50,0));
- SendDlgItemMessage(hwndDlg,IDC_SBAR_BORDER_BOTTOM_SPIN,UDM_SETPOS,0,MAKELONG(db_get_dw(NULL,"CLUI","BottomOffset",SETTING_BOTTOMOFFSET_DEFAULT),0));
+ SendDlgItemMessage(hwndDlg,IDC_SBAR_BORDER_TOP_SPIN,UDM_SETRANGE,0,MAKELONG(50,0));
+ SendDlgItemMessage(hwndDlg,IDC_SBAR_BORDER_TOP_SPIN,UDM_SETPOS,0,MAKELONG(db_get_dw(NULL,"CLUI","TopOffset",SETTING_TOPOFFSET_DEFAULT),0));
- SendDlgItemMessage(hwndDlg,IDC_OFFSETSPIN3,UDM_SETRANGE,0,MAKELONG(50,0));
- SendDlgItemMessage(hwndDlg,IDC_OFFSETSPIN3,UDM_SETPOS,0,MAKELONG(db_get_dw(NULL,"CLUI","SpaceBetween",SETTING_SPACEBETWEEN_DEFAULT),2));
+ SendDlgItemMessage(hwndDlg,IDC_SBAR_BORDER_BOTTOM_SPIN,UDM_SETRANGE,0,MAKELONG(50,0));
+ SendDlgItemMessage(hwndDlg,IDC_SBAR_BORDER_BOTTOM_SPIN,UDM_SETPOS,0,MAKELONG(db_get_dw(NULL,"CLUI","BottomOffset",SETTING_BOTTOMOFFSET_DEFAULT),0));
- {
- int i, item;
- TCHAR *align[] = {_T("Left"), _T("Center"), _T("Right")};
- for (i=0; i < SIZEOF(align); i++) {
- item = SendDlgItemMessage(hwndDlg,IDC_SBAR_HORIZ_ALIGN,CB_ADDSTRING,0,(LPARAM)TranslateTS(align[i]));
- }
+ SendDlgItemMessage(hwndDlg,IDC_OFFSETSPIN3,UDM_SETRANGE,0,MAKELONG(50,0));
+ SendDlgItemMessage(hwndDlg,IDC_OFFSETSPIN3,UDM_SETPOS,0,MAKELONG(db_get_dw(NULL,"CLUI","SpaceBetween",SETTING_SPACEBETWEEN_DEFAULT),2));
- SendDlgItemMessage(hwndDlg, IDC_SBAR_HORIZ_ALIGN, CB_SETCURSEL, db_get_b(NULL, "CLUI", "Align", SETTING_ALIGN_DEFAULT), 0);
+ {
+ int i, item;
+ TCHAR *align[] = {_T("Left"), _T("Center"), _T("Right")};
+ for (i=0; i < SIZEOF(align); i++) {
+ item = SendDlgItemMessage(hwndDlg,IDC_SBAR_HORIZ_ALIGN,CB_ADDSTRING,0,(LPARAM)TranslateTS(align[i]));
}
- {
- int i, item;
- TCHAR *align[] = {_T("Top"), _T("Center"), _T("Bottom")};
- for (i=0; i < SIZEOF(align); i++) {
- item = SendDlgItemMessage(hwndDlg,IDC_SBAR_VERT_ALIGN,CB_ADDSTRING,0,(LPARAM)TranslateTS(align[i]));
- }
+ SendDlgItemMessage(hwndDlg, IDC_SBAR_HORIZ_ALIGN, CB_SETCURSEL, db_get_b(NULL, "CLUI", "Align", SETTING_ALIGN_DEFAULT), 0);
+ }
- SendDlgItemMessage(hwndDlg, IDC_SBAR_VERT_ALIGN, CB_SETCURSEL, db_get_b(NULL, "CLUI", "VAlign", SETTING_VALIGN_DEFAULT), 0);
+ {
+ int i, item;
+ TCHAR *align[] = {_T("Top"), _T("Center"), _T("Bottom")};
+ for (i=0; i < SIZEOF(align); i++) {
+ item = SendDlgItemMessage(hwndDlg,IDC_SBAR_VERT_ALIGN,CB_ADDSTRING,0,(LPARAM)TranslateTS(align[i]));
}
- {
- int en = IsDlgButtonChecked(hwndDlg,IDC_SHOWSBAR);
- int en_icons = IsDlgButtonChecked(hwndDlg,IDC_SHOWICON );
-
- EnableWindow(GetDlgItem(hwndDlg,IDC_SHOWICON),en);
- EnableWindow(GetDlgItem(hwndDlg,IDC_SHOWPROTO),en);
- EnableWindow(GetDlgItem(hwndDlg,IDC_SHOWSTATUS),en);
- EnableWindow(GetDlgItem(hwndDlg,IDC_RIGHTSTATUS),en);
- EnableWindow(GetDlgItem(hwndDlg,IDC_RIGHTMIRANDA),en);
- EnableWindow(GetDlgItem(hwndDlg,IDC_EQUALSECTIONS),en);
- EnableWindow(GetDlgItem(hwndDlg,IDC_USECONNECTINGICON),en && en_icons);
- EnableWindow(GetDlgItem(hwndDlg,IDC_USEOWNERDRAW),en);
- EnableWindow(GetDlgItem(hwndDlg,IDC_OFFSETSPIN),en);
- EnableWindow(GetDlgItem(hwndDlg,IDC_OFFSETICON),en);
- EnableWindow(GetDlgItem(hwndDlg,IDC_OFFSETSPIN2),en);
- EnableWindow(GetDlgItem(hwndDlg,IDC_OFFSETICON2),en);
- EnableWindow(GetDlgItem(hwndDlg,IDC_OFFSETSPIN3),en);
- EnableWindow(GetDlgItem(hwndDlg,IDC_OFFSETICON3),en);
- EnableWindow(GetDlgItem(hwndDlg,IDC_BUTTON_BROWSE),en);
- EnableWindow(GetDlgItem(hwndDlg,IDC_SHOW_ONLY_IF_DIFFERENT),en);
- EnableWindow(GetDlgItem(hwndDlg,IDC_COLOUR),en);
- EnableWindow(GetDlgItem(hwndDlg,IDC_SHOWXSTATUSNAME),en);
- EnableWindow(GetDlgItem(hwndDlg,IDC_SHOWXSTATUS),en && en_icons);
- EnableWindow(GetDlgItem(hwndDlg,IDC_SHOWBOTH),en && en_icons && IsDlgButtonChecked(hwndDlg,IDC_SHOWXSTATUS) && !IsDlgButtonChecked(hwndDlg,IDC_SHOWNORMAL));
- EnableWindow(GetDlgItem(hwndDlg,IDC_SHOWNORMAL),en && en_icons && IsDlgButtonChecked(hwndDlg,IDC_SHOWXSTATUS)&& !IsDlgButtonChecked(hwndDlg,IDC_SHOWBOTH));
- EnableWindow(GetDlgItem(hwndDlg,IDC_TRANSPARENTOVERLAY),en && en_icons && IsDlgButtonChecked(hwndDlg,IDC_SHOWXSTATUS) && IsDlgButtonChecked(hwndDlg,IDC_SHOWNORMAL)&& !IsDlgButtonChecked(hwndDlg,IDC_SHOWBOTH));
- EnableWindow(GetDlgItem(hwndDlg,IDC_SHOWUNREADEMAIL),en);
-
- EnableWindow(GetDlgItem(hwndDlg,IDC_OFFSETICON_LEFT),en);
- EnableWindow(GetDlgItem(hwndDlg,IDC_OFFSETSPIN_LEFT),en);
- EnableWindow(GetDlgItem(hwndDlg,IDC_OFFSETICON_RIGHT),en);
- EnableWindow(GetDlgItem(hwndDlg,IDC_OFFSETSPIN_RIGHT),en);
-
- EnableWindow(GetDlgItem(hwndDlg,IDC_MULTI),en);
- EnableWindow(GetDlgItem(hwndDlg,IDC_MULTI_2),en);
- EnableWindow(GetDlgItem(hwndDlg,IDC_MULTI_COUNT),en);
- EnableWindow(GetDlgItem(hwndDlg,IDC_MULTI_SPIN),en);
-
- EnableWindow(GetDlgItem(hwndDlg,IDC_STATUSBAR_PER_PROTO),en);
- EnableWindow(GetDlgItem(hwndDlg, IDC_STATUSBAR_PROTO_LIST), en && IsDlgButtonChecked(hwndDlg, IDC_STATUSBAR_PER_PROTO));
- EnableWindow(GetDlgItem(hwndDlg, IDC_SBAR_USE_ACCOUNT_SETTINGS), FALSE);
- }
+ SendDlgItemMessage(hwndDlg, IDC_SBAR_VERT_ALIGN, CB_SETCURSEL, db_get_b(NULL, "CLUI", "VAlign", SETTING_VALIGN_DEFAULT), 0);
+ }
- UpdateStatusBarOptionsDisplay(hwndDlg);
+ {
+ int en = IsDlgButtonChecked(hwndDlg,IDC_SHOWSBAR);
+ int en_icons = IsDlgButtonChecked(hwndDlg,IDC_SHOWICON );
- return TRUE;
+ EnableWindow(GetDlgItem(hwndDlg,IDC_SHOWICON),en);
+ EnableWindow(GetDlgItem(hwndDlg,IDC_SHOWPROTO),en);
+ EnableWindow(GetDlgItem(hwndDlg,IDC_SHOWSTATUS),en);
+ EnableWindow(GetDlgItem(hwndDlg,IDC_RIGHTSTATUS),en);
+ EnableWindow(GetDlgItem(hwndDlg,IDC_RIGHTMIRANDA),en);
+ EnableWindow(GetDlgItem(hwndDlg,IDC_EQUALSECTIONS),en);
+ EnableWindow(GetDlgItem(hwndDlg,IDC_USECONNECTINGICON),en && en_icons);
+ EnableWindow(GetDlgItem(hwndDlg,IDC_USEOWNERDRAW),en);
+ EnableWindow(GetDlgItem(hwndDlg,IDC_OFFSETSPIN),en);
+ EnableWindow(GetDlgItem(hwndDlg,IDC_OFFSETICON),en);
+ EnableWindow(GetDlgItem(hwndDlg,IDC_OFFSETSPIN2),en);
+ EnableWindow(GetDlgItem(hwndDlg,IDC_OFFSETICON2),en);
+ EnableWindow(GetDlgItem(hwndDlg,IDC_OFFSETSPIN3),en);
+ EnableWindow(GetDlgItem(hwndDlg,IDC_OFFSETICON3),en);
+ EnableWindow(GetDlgItem(hwndDlg,IDC_BUTTON_BROWSE),en);
+ EnableWindow(GetDlgItem(hwndDlg,IDC_SHOW_ONLY_IF_DIFFERENT),en);
+ EnableWindow(GetDlgItem(hwndDlg,IDC_COLOUR),en);
+ EnableWindow(GetDlgItem(hwndDlg,IDC_SHOWXSTATUSNAME),en);
+ EnableWindow(GetDlgItem(hwndDlg,IDC_SHOWXSTATUS),en && en_icons);
+ EnableWindow(GetDlgItem(hwndDlg,IDC_SHOWBOTH),en && en_icons && IsDlgButtonChecked(hwndDlg,IDC_SHOWXSTATUS) && !IsDlgButtonChecked(hwndDlg,IDC_SHOWNORMAL));
+ EnableWindow(GetDlgItem(hwndDlg,IDC_SHOWNORMAL),en && en_icons && IsDlgButtonChecked(hwndDlg,IDC_SHOWXSTATUS) && !IsDlgButtonChecked(hwndDlg,IDC_SHOWBOTH));
+ EnableWindow(GetDlgItem(hwndDlg,IDC_TRANSPARENTOVERLAY),en && en_icons && IsDlgButtonChecked(hwndDlg,IDC_SHOWXSTATUS) && IsDlgButtonChecked(hwndDlg,IDC_SHOWNORMAL) && !IsDlgButtonChecked(hwndDlg,IDC_SHOWBOTH));
+ EnableWindow(GetDlgItem(hwndDlg,IDC_SHOWUNREADEMAIL),en);
+
+ EnableWindow(GetDlgItem(hwndDlg,IDC_OFFSETICON_LEFT),en);
+ EnableWindow(GetDlgItem(hwndDlg,IDC_OFFSETSPIN_LEFT),en);
+ EnableWindow(GetDlgItem(hwndDlg,IDC_OFFSETICON_RIGHT),en);
+ EnableWindow(GetDlgItem(hwndDlg,IDC_OFFSETSPIN_RIGHT),en);
+
+ EnableWindow(GetDlgItem(hwndDlg,IDC_MULTI),en);
+ EnableWindow(GetDlgItem(hwndDlg,IDC_MULTI_2),en);
+ EnableWindow(GetDlgItem(hwndDlg,IDC_MULTI_COUNT),en);
+ EnableWindow(GetDlgItem(hwndDlg,IDC_MULTI_SPIN),en);
+
+ EnableWindow(GetDlgItem(hwndDlg,IDC_STATUSBAR_PER_PROTO),en);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_STATUSBAR_PROTO_LIST), en && IsDlgButtonChecked(hwndDlg, IDC_STATUSBAR_PER_PROTO));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_SBAR_USE_ACCOUNT_SETTINGS), FALSE);
}
+
+ UpdateStatusBarOptionsDisplay(hwndDlg);
+ return TRUE;
+
case WM_COMMAND:
if (LOWORD(wParam) == IDC_BUTTON1)
{
@@ -355,7 +330,7 @@ static void UpdateStatusBarOptionsDisplay(HWND hwndDlg) return 0;
}
}
- else if (LOWORD(wParam) == IDC_COLOUR ||(LOWORD(wParam) == IDC_SBAR_HORIZ_ALIGN && HIWORD(wParam) == CBN_SELCHANGE)) SendMessage(GetParent(hwndDlg), PSM_CHANGED, (WPARAM)hwndDlg, 0);
+ else if (LOWORD(wParam) == IDC_COLOUR || (LOWORD(wParam) == IDC_SBAR_HORIZ_ALIGN && HIWORD(wParam) == CBN_SELCHANGE)) SendMessage(GetParent(hwndDlg), PSM_CHANGED, (WPARAM)hwndDlg, 0);
else if (LOWORD(wParam) == IDC_SHOWSBAR) {
int en = IsDlgButtonChecked(hwndDlg,IDC_SHOWSBAR);
int en_icons = IsDlgButtonChecked(hwndDlg,IDC_SHOWICON );
@@ -384,15 +359,6 @@ static void UpdateStatusBarOptionsDisplay(HWND hwndDlg) EnableWindow(GetDlgItem(hwndDlg,IDC_SHOWXSTATUS),en && en_icons);
EnableWindow(GetDlgItem(hwndDlg,IDC_SHOWUNREADEMAIL),en);
-// EnableWindow(GetDlgItem(hwndDlg,IDC_SHOWBOTH),en && IsDlgButtonChecked(hwndDlg,IDC_SHOWXSTATUS) && !IsDlgButtonChecked(hwndDlg,IDC_SHOWNORMAL));
-// EnableWindow(GetDlgItem(hwndDlg,IDC_SHOWNORMAL),en && IsDlgButtonChecked(hwndDlg,IDC_SHOWXSTATUS)&& !IsDlgButtonChecked(hwndDlg,IDC_SHOWBOTH));
-// EnableWindow(GetDlgItem(hwndDlg,IDC_TRANSPARENTOVERLAY),en && IsDlgButtonChecked(hwndDlg,IDC_SHOWXSTATUS) && IsDlgButtonChecked(hwndDlg,IDC_SHOWNORMAL)&& !IsDlgButtonChecked(hwndDlg,IDC_SHOWBOTH));
-
-// EnableWindow(GetDlgItem(hwndDlg,IDC_OFFSETICON_LEFT),en);
-// EnableWindow(GetDlgItem(hwndDlg,IDC_OFFSETSPIN_LEFT),en);
-// EnableWindow(GetDlgItem(hwndDlg,IDC_OFFSETICON_RIGHT),en);
-// EnableWindow(GetDlgItem(hwndDlg,IDC_OFFSETSPIN_RIGHT),en);
-
EnableWindow(GetDlgItem(hwndDlg,IDC_MULTI),en);
EnableWindow(GetDlgItem(hwndDlg,IDC_MULTI_2),en);
EnableWindow(GetDlgItem(hwndDlg,IDC_MULTI_COUNT),en);
@@ -418,10 +384,10 @@ static void UpdateStatusBarOptionsDisplay(HWND hwndDlg) SendMessage(GetParent(hwndDlg), PSM_CHANGED, (WPARAM)hwndDlg, 0);
}
else if (
- LOWORD(wParam) == IDC_SHOWXSTATUS ||
- LOWORD(wParam) == IDC_SHOWBOTH ||
- LOWORD(wParam) == IDC_SHOWNORMAL ||
- LOWORD(wParam) == IDC_TRANSPARENTOVERLAY ||
+ LOWORD(wParam) == IDC_SHOWXSTATUS ||
+ LOWORD(wParam) == IDC_SHOWBOTH ||
+ LOWORD(wParam) == IDC_SHOWNORMAL ||
+ LOWORD(wParam) == IDC_TRANSPARENTOVERLAY ||
LOWORD(wParam) == IDC_SHOWXSTATUSNAME
)
{
@@ -429,102 +395,71 @@ static void UpdateStatusBarOptionsDisplay(HWND hwndDlg) }
else if (LOWORD(wParam) == IDC_SBAR_USE_ACCOUNT_SETTINGS)
{
- if (perProto)
- {
+ if (perProto) {
dat[curSelProto].AccountIsCustomized = IsDlgButtonChecked(hwndDlg, IDC_SBAR_USE_ACCOUNT_SETTINGS);
-
UpdateStatusBarOptionsDisplay(hwndDlg);
}
}
else if (LOWORD(wParam) == IDC_SBAR_HIDE_ACCOUNT_COMPLETELY)
{
if (perProto)
- {
dat[curSelProto].HideAccount = IsDlgButtonChecked(hwndDlg, IDC_SBAR_HIDE_ACCOUNT_COMPLETELY);
- }
}
else if (LOWORD(wParam) == IDC_USECONNECTINGICON)
{
if (perProto)
- {
dat[curSelProto].UseConnectingIcon = IsDlgButtonChecked(hwndDlg, IDC_USECONNECTINGICON);
- }
else
- {
_GlobalOptions.UseConnectingIcon = IsDlgButtonChecked(hwndDlg, IDC_USECONNECTINGICON);
- }
}
else if (LOWORD(wParam) == IDC_SHOWUNREADEMAIL)
{
if (perProto)
- {
dat[curSelProto].ShowUnreadEmails = IsDlgButtonChecked(hwndDlg, IDC_SHOWUNREADEMAIL);
- }
else
- {
_GlobalOptions.ShowUnreadEmails = IsDlgButtonChecked(hwndDlg, IDC_SHOWUNREADEMAIL);
- }
}
- else if (
- LOWORD(wParam) == IDC_SHOWICON ||
- LOWORD(wParam) == IDC_SHOWPROTO ||
- LOWORD(wParam) == IDC_SHOWSTATUS
- )
+ else if (LOWORD(wParam) == IDC_SHOWICON || LOWORD(wParam) == IDC_SHOWPROTO || LOWORD(wParam) == IDC_SHOWSTATUS)
{
BYTE val = (IsDlgButtonChecked(hwndDlg, IDC_SHOWICON)?1:0)|(IsDlgButtonChecked(hwndDlg, IDC_SHOWPROTO)?2:0)|(IsDlgButtonChecked(hwndDlg, IDC_SHOWSTATUS)?4:0);
if (perProto)
- {
dat[curSelProto].SBarShow = val;
- }
else
- {
_GlobalOptions.SBarShow = val;
- }
+
UpdateStatusBarOptionsDisplay(hwndDlg);
}
else if (LOWORD(wParam) == IDC_RIGHTSTATUS || LOWORD(wParam) == IDC_RIGHTMIRANDA)
{
if (perProto)
- {
dat[curSelProto].SBarRightClk = IsDlgButtonChecked(hwndDlg,IDC_RIGHTMIRANDA);
- }
else
- {
_GlobalOptions.SBarRightClk = IsDlgButtonChecked(hwndDlg,IDC_RIGHTMIRANDA);
- }
}
else if (LOWORD(wParam) == IDC_OFFSETICON_LEFT)
{
if (perProto)
- {
dat[curSelProto].PaddingLeft = (DWORD)SendDlgItemMessage(hwndDlg,IDC_OFFSETSPIN_LEFT,UDM_GETPOS,0,0);
- }
else
- {
_GlobalOptions.PaddingLeft = (DWORD)SendDlgItemMessage(hwndDlg,IDC_OFFSETSPIN_LEFT,UDM_GETPOS,0,0);
- }
}
else if (LOWORD(wParam) == IDC_OFFSETICON_RIGHT)
{
if (perProto)
- {
dat[curSelProto].PaddingRight = (DWORD)SendDlgItemMessage(hwndDlg,IDC_OFFSETSPIN_RIGHT,UDM_GETPOS,0,0);
- }
else
- {
_GlobalOptions.PaddingRight = (DWORD)SendDlgItemMessage(hwndDlg,IDC_OFFSETSPIN_RIGHT,UDM_GETPOS,0,0);
- }
}
else if (
(
- LOWORD(wParam) == IDC_MULTI_COUNT ||
- LOWORD(wParam) == IDC_OFFSETICON ||
- LOWORD(wParam) == IDC_OFFSETICON2 ||
- LOWORD(wParam) == IDC_OFFSETICON3 ||
- LOWORD(wParam) == IDC_SBAR_BORDER_BOTTOM ||
+ LOWORD(wParam) == IDC_MULTI_COUNT ||
+ LOWORD(wParam) == IDC_OFFSETICON ||
+ LOWORD(wParam) == IDC_OFFSETICON2 ||
+ LOWORD(wParam) == IDC_OFFSETICON3 ||
+ LOWORD(wParam) == IDC_SBAR_BORDER_BOTTOM ||
LOWORD(wParam) == IDC_SBAR_BORDER_TOP
) && (
- HIWORD(wParam) != EN_CHANGE ||
+ HIWORD(wParam) != EN_CHANGE ||
(HWND)lParam != GetFocus()
))
return 0; // dont make apply enabled during buddy set crap
@@ -536,15 +471,13 @@ static void UpdateStatusBarOptionsDisplay(HWND hwndDlg) SendMessage(GetParent(hwndDlg), PSM_CHANGED, (WPARAM)hwndDlg, 0);
break;
case WM_NOTIFY:
- switch (((LPNMHDR)lParam)->code)
- {
+ switch (((LPNMHDR)lParam)->code) {
case PSN_APPLY:
{
int count = db_get_dw(0,"Protocols","ProtoCount",-1);
db_set_b(NULL, "CLUI", "SBarPerProto", IsDlgButtonChecked(hwndDlg, IDC_STATUSBAR_PER_PROTO));
- for (int i=0; i < count; i++)
- {
+ for (int i=0; i < count; i++) {
HWND hwndComboBox = GetDlgItem( hwndDlg, IDC_STATUSBAR_PROTO_LIST );
StatusBarProtocolOptions sbpo = dat[i];
char *defProto = sbpo.szName;
@@ -599,6 +532,10 @@ static void UpdateStatusBarOptionsDisplay(HWND hwndDlg) }
}
break;
+
+ case WM_DESTROY:
+ mir_free(dat);
+ break;
}
return FALSE;
}
|