From 8cee0ecbc1c81a2a2a30113ab9d5eca7b60060da Mon Sep 17 00:00:00 2001 From: Dmitry Kuzkin Date: Mon, 20 Aug 2012 11:10:24 +0000 Subject: revert changes r14006 - simplify tab options now close icons on tabs can be disabled :) git-svn-id: http://svn.miranda-ng.org/main/trunk@1505 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Scriver/res/resource.rc | 32 ++++++++++++++++++-------------- plugins/Scriver/src/globals.cpp | 3 +++ plugins/Scriver/src/globals.h | 1 + plugins/Scriver/src/msgoptions.cpp | 12 ++++++++++-- plugins/Scriver/src/msgs.h | 4 ++++ plugins/Scriver/src/msgwindow.cpp | 21 ++++----------------- plugins/Scriver/src/resource.h | 2 ++ 7 files changed, 42 insertions(+), 33 deletions(-) diff --git a/plugins/Scriver/res/resource.rc b/plugins/Scriver/res/resource.rc index 8de9d45979..611556aedb 100644 --- a/plugins/Scriver/res/resource.rc +++ b/plugins/Scriver/res/resource.rc @@ -67,22 +67,26 @@ BEGIN GROUPBOX "Tabs",IDC_STATIC,0,0,304,118 CONTROL "Enable tabs",IDC_USETABS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,12,260,10 + CONTROL "Always show tab bar",IDC_ALWAYSSHOWTABS, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,20,23,252,10 CONTROL "Tabs at bottom",IDC_TABSATBOTTOM,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,20,23,252,10 + BS_AUTOCHECKBOX | WS_TABSTOP,20,34,252,10 CONTROL "Limit names on tabs to",IDC_LIMITNAMES, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,20,34,126,10 - EDITTEXT IDC_LIMITNAMESLEN,212,33,20,12,ES_RIGHT | ES_NUMBER - LTEXT "characters",IDC_CHARS,236,34,65,8,WS_DISABLED + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,20,45,126,10 + EDITTEXT IDC_LIMITNAMESLEN,212,44,20,12,ES_RIGHT | ES_NUMBER + LTEXT "characters",IDC_CHARS,236,45,65,8,WS_DISABLED + CONTROL "Show close button on each tab ",IDC_TABCLOSEBUTTON, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,20,56,192,10 CONTROL "Switch to active tab",IDC_SWITCHTOACTIVE, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,20,45,252,10 + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,20,67,252,10 CONTROL "Limit number of tabs per window to",IDC_LIMITTABS, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,20,56,180,10 - EDITTEXT IDC_LIMITTABSNUM,212,55,20,12,ES_RIGHT | ES_NUMBER + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,20,78,180,10 + EDITTEXT IDC_LIMITTABSNUM,212,77,20,12,ES_RIGHT | ES_NUMBER CONTROL "Use separate windows for group chats",IDC_SEPARATECHATSCONTAINERS, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,20,67,192,10 + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,20,89,192,10 CONTROL "Limit number of group chats tabs per window to",IDC_LIMITCHATSTABS, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,32,78,180,10 - EDITTEXT IDC_LIMITCHATSTABSNUM,212,77,20,12,ES_RIGHT | ES_NUMBER + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,32,100,180,10 + EDITTEXT IDC_LIMITCHATSTABSNUM,212,99,20,12,ES_RIGHT | ES_NUMBER END IDD_OPT_LAYOUT DIALOGEX 2, 0, 304, 230 @@ -673,8 +677,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 2,10,0,1 - PRODUCTVERSION 2,10,0,1 + FILEVERSION 2,10,0,2 + PRODUCTVERSION 2,10,0,2 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -692,12 +696,12 @@ BEGIN VALUE "Comments", "http://miranda-ng.org/" VALUE "CompanyName", "Miranda NG Development Team" VALUE "FileDescription", "Scriver - send and receive instant messages" - VALUE "FileVersion", "2.10.0.1" + VALUE "FileVersion", "2.10.0.2" VALUE "InternalName", "scriver" VALUE "LegalCopyright", "Copyright (c) 2000-2012 Miranda NG Project" VALUE "OriginalFilename", "scriver.dll" VALUE "ProductName", "Scriver" - VALUE "ProductVersion", "2.10.0.1" + VALUE "ProductVersion", "2.10.0.2" END END BLOCK "VarFileInfo" diff --git a/plugins/Scriver/src/globals.cpp b/plugins/Scriver/src/globals.cpp index 9a81ebcdbb..6e9a23b22b 100644 --- a/plugins/Scriver/src/globals.cpp +++ b/plugins/Scriver/src/globals.cpp @@ -390,9 +390,12 @@ void ReloadGlobals() { g_dat->flags2 |= SMF2_SWITCHTOACTIVE; if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_LIMITNAMES, SRMSGDEFSET_LIMITNAMES)) g_dat->flags2 |= SMF2_LIMITNAMES; + if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_HIDEONETAB, SRMSGDEFSET_HIDEONETAB)) g_dat->flags2 |= SMF2_HIDEONETAB; if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SEPARATECHATSCONTAINERS, SRMSGDEFSET_SEPARATECHATSCONTAINERS)) g_dat->flags2 |= SMF2_SEPARATECHATSCONTAINERS; + if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_TABCLOSEBUTTON, SRMSGDEFSET_TABCLOSEBUTTON)) + g_dat->flags2 |= SMF2_TABCLOSEBUTTON; if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_LIMITTABS, SRMSGDEFSET_LIMITTABS)) g_dat->flags2 |= SMF2_LIMITTABS; if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_LIMITCHATSTABS, SRMSGDEFSET_LIMITCHATSTABS)) diff --git a/plugins/Scriver/src/globals.h b/plugins/Scriver/src/globals.h index d3ec2af2d8..dd3e07d595 100644 --- a/plugins/Scriver/src/globals.h +++ b/plugins/Scriver/src/globals.h @@ -59,6 +59,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define SMF2_LIMITNAMES 0x00000008 #define SMF2_SWITCHTOACTIVE 0x00000010 #define SMF2_SEPARATECHATSCONTAINERS 0x00000020 +#define SMF2_TABCLOSEBUTTON 0x00000040 #define SMF2_LIMITTABS 0x00000080 #define SMF2_LIMITCHATSTABS 0x00000100 #define SMF2_HIDECONTAINERS 0x00000200 diff --git a/plugins/Scriver/src/msgoptions.cpp b/plugins/Scriver/src/msgoptions.cpp index fb660d59d7..ea103245bd 100644 --- a/plugins/Scriver/src/msgoptions.cpp +++ b/plugins/Scriver/src/msgoptions.cpp @@ -370,8 +370,10 @@ static INT_PTR CALLBACK DlgProcTabsOptions(HWND hwndDlg, UINT msg, WPARAM wParam int bChecked; TranslateDialogDefault(hwndDlg); CheckDlgButton(hwndDlg, IDC_USETABS, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_USETABS, SRMSGDEFSET_USETABS)); + CheckDlgButton(hwndDlg, IDC_ALWAYSSHOWTABS, !DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_HIDEONETAB, SRMSGDEFSET_HIDEONETAB)); CheckDlgButton(hwndDlg, IDC_TABSATBOTTOM, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_TABSATBOTTOM, SRMSGDEFSET_TABSATBOTTOM)); CheckDlgButton(hwndDlg, IDC_SWITCHTOACTIVE, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SWITCHTOACTIVE, SRMSGDEFSET_SWITCHTOACTIVE)); + CheckDlgButton(hwndDlg, IDC_TABCLOSEBUTTON, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_TABCLOSEBUTTON, SRMSGDEFSET_TABCLOSEBUTTON)); CheckDlgButton(hwndDlg, IDC_LIMITNAMES, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_LIMITNAMES, SRMSGDEFSET_LIMITNAMES)); limitLength = DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_LIMITNAMESLEN, SRMSGDEFSET_LIMITNAMESLEN); (int)SetDlgItemInt(hwndDlg, IDC_LIMITNAMESLEN, limitLength >= SRMSGSET_LIMITNAMESLEN_MIN ? limitLength : SRMSGDEFSET_LIMITNAMESLEN, FALSE); @@ -387,8 +389,10 @@ static INT_PTR CALLBACK DlgProcTabsOptions(HWND hwndDlg, UINT msg, WPARAM wParam CheckDlgButton(hwndDlg, IDC_SEPARATECHATSCONTAINERS, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SEPARATECHATSCONTAINERS, SRMSGDEFSET_SEPARATECHATSCONTAINERS)); bChecked = IsDlgButtonChecked(hwndDlg, IDC_USETABS); + EnableWindow(GetDlgItem(hwndDlg, IDC_ALWAYSSHOWTABS), bChecked ); EnableWindow(GetDlgItem(hwndDlg, IDC_TABSATBOTTOM), bChecked ); - EnableWindow(GetDlgItem(hwndDlg, IDC_SWITCHTOACTIVE), bChecked); + EnableWindow(GetDlgItem(hwndDlg, IDC_SWITCHTOACTIVE), bChecked ); + EnableWindow(GetDlgItem(hwndDlg, IDC_TABCLOSEBUTTON), bChecked ); EnableWindow(GetDlgItem(hwndDlg, IDC_LIMITNAMES), bChecked ); EnableWindow(GetDlgItem(hwndDlg, IDC_SEPARATECHATSCONTAINERS), bChecked ); EnableWindow(GetDlgItem(hwndDlg, IDC_LIMITTABS), bChecked ); @@ -411,7 +415,9 @@ static INT_PTR CALLBACK DlgProcTabsOptions(HWND hwndDlg, UINT msg, WPARAM wParam EnableWindow(GetDlgItem(hwndDlg, IDC_SWITCHTOACTIVE), bChecked); EnableWindow(GetDlgItem(hwndDlg, IDC_TABSATBOTTOM), bChecked); EnableWindow(GetDlgItem(hwndDlg, IDC_LIMITNAMES), bChecked); - EnableWindow(GetDlgItem(hwndDlg, IDC_SEPARATECHATSCONTAINERS), bChecked ); + EnableWindow(GetDlgItem(hwndDlg, IDC_ALWAYSSHOWTABS), bChecked); + EnableWindow(GetDlgItem(hwndDlg, IDC_TABCLOSEBUTTON), bChecked); + EnableWindow(GetDlgItem(hwndDlg, IDC_SEPARATECHATSCONTAINERS), bChecked); EnableWindow(GetDlgItem(hwndDlg, IDC_LIMITTABS), bChecked); } case IDC_LIMITTABS: @@ -466,7 +472,9 @@ static INT_PTR CALLBACK DlgProcTabsOptions(HWND hwndDlg, UINT msg, WPARAM wParam limitLength = GetDlgItemInt(hwndDlg, IDC_LIMITCHATSTABSNUM, NULL, TRUE) >= 1 ? GetDlgItemInt(hwndDlg, IDC_LIMITCHATSTABSNUM, NULL, TRUE) : 1; DBWriteContactSettingDword(NULL, SRMMMOD, SRMSGSET_LIMITCHATSTABSNUM, limitLength); + DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_HIDEONETAB, (BYTE) !IsDlgButtonChecked(hwndDlg, IDC_ALWAYSSHOWTABS)); DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SWITCHTOACTIVE, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SWITCHTOACTIVE)); + DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_TABCLOSEBUTTON, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_TABCLOSEBUTTON)); DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SEPARATECHATSCONTAINERS, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SEPARATECHATSCONTAINERS)); ApplyChanges(8); diff --git a/plugins/Scriver/src/msgs.h b/plugins/Scriver/src/msgs.h index e17c63897d..a28dcb963f 100644 --- a/plugins/Scriver/src/msgs.h +++ b/plugins/Scriver/src/msgs.h @@ -266,11 +266,15 @@ extern int fontOptionsListSize; #define SRMSGDEFSET_USETABS 1 #define SRMSGSET_TABSATBOTTOM "TabsPosition" #define SRMSGDEFSET_TABSATBOTTOM 0 +#define SRMSGSET_TABCLOSEBUTTON "TabCloseButton" +#define SRMSGDEFSET_TABCLOSEBUTTON 0 #define SRMSGSET_LIMITNAMES "LimitNamesOnTabs" #define SRMSGDEFSET_LIMITNAMES 1 #define SRMSGSET_LIMITNAMESLEN "LimitNamesLength" #define SRMSGDEFSET_LIMITNAMESLEN 20 #define SRMSGSET_LIMITNAMESLEN_MIN 0 +#define SRMSGSET_HIDEONETAB "HideOneTab" +#define SRMSGDEFSET_HIDEONETAB 1 #define SRMSGSET_SEPARATECHATSCONTAINERS "SeparateChatsContainers" #define SRMSGDEFSET_SEPARATECHATSCONTAINERS 0 #define SRMSGSET_LIMITTABS "LimitTabs" diff --git a/plugins/Scriver/src/msgwindow.cpp b/plugins/Scriver/src/msgwindow.cpp index a59e0482e8..4fa52a0005 100644 --- a/plugins/Scriver/src/msgwindow.cpp +++ b/plugins/Scriver/src/msgwindow.cpp @@ -346,16 +346,6 @@ static void ActivateChild(ParentWindowData *dat, HWND child) { } } -static void UpdateTabsPadding(ParentWindowData *dat) -{ - if (dat->childrenCount > 1) { -// ws |= 0x2000; //TCS_OWNERDRAWFIXED - TabCtrl_SetPadding(dat->hwndTabs, GetSystemMetrics(SM_CXEDGE) + 12, GetSystemMetrics(SM_CYEDGE) + 1); - } else { - TabCtrl_SetPadding(dat->hwndTabs, GetSystemMetrics(SM_CXEDGE) + 4, GetSystemMetrics(SM_CYEDGE) + 1); - } -} - static void AddChild(ParentWindowData *dat, HWND hwnd, HANDLE hContact) { TCITEM tci; @@ -372,7 +362,6 @@ static void AddChild(ParentWindowData *dat, HWND hwnd, HANDLE hContact) tci.pszText = _T(""); tabId = TabCtrl_InsertItem(dat->hwndTabs, dat->childrenCount-1, &tci); // ActivateChild(dat, mdat->hwnd); - UpdateTabsPadding(dat); SetWindowPos(mwtd->hwnd, HWND_TOP, dat->childRect.left, dat->childRect.top, dat->childRect.right-dat->childRect.left, dat->childRect.bottom - dat->childRect.top, SWP_HIDEWINDOW); SendMessage(dat->hwnd, WM_SIZE, 0, 0); @@ -398,7 +387,6 @@ static void RemoveChild(ParentWindowData *dat, HWND child) else dat->hwndActive = NULL; } - UpdateTabsPadding(dat); ReleaseIcon(tci.iImage); } } @@ -413,7 +401,6 @@ static void CloseOtherChilden(ParentWindowData *dat, HWND child) SendMessage(mwtd->hwnd, WM_CLOSE, 0, 0); } } - UpdateTabsPadding(dat); ActivateChild(dat, child); } @@ -471,7 +458,7 @@ static void SetContainerWindowStyle(ParentWindowData *dat) ws |= TCS_BOTTOM; } ws |= 0x2000; //TCS_OWNERDRAWFIXED - if (dat->childrenCount > 1) { + if (dat->flags2 & SMF2_TABCLOSEBUTTON) { // ws |= 0x2000; //TCS_OWNERDRAWFIXED TabCtrl_SetPadding(dat->hwndTabs, GetSystemMetrics(SM_CXEDGE) + 12, GetSystemMetrics(SM_CYEDGE) + 1); } else { @@ -1231,7 +1218,7 @@ static void DrawTab(ParentWindowData *dat, HWND hwnd, WPARAM wParam, LPARAM lPar ImageList_DrawEx(g_dat->hTabIconList, tci.iImage, lpDIS->hDC, rIcon.left, rIcon.top, 0, 0, CLR_NONE, CLR_NONE, ILD_NORMAL); rect.left = rIcon.left + (info.rcImage.right - info.rcImage.left); } - if (dat->childrenCount > 1) { + if (dat->flags2 & SMF2_TABCLOSEBUTTON) { ImageList_GetImageInfo(g_dat->hButtonIconList, 0, &info); rIcon.left = rect.right - GetSystemMetrics(SM_CXEDGE) - (bSelected ? 6 : 2) - (info.rcImage.right - info.rcImage.left); ImageList_DrawEx(g_dat->hButtonIconList, 0, lpDIS->hDC, rIcon.left, rIcon.top, 0, 0, CLR_NONE, CLR_NONE, ILD_NORMAL); @@ -1247,7 +1234,7 @@ static void DrawTab(ParentWindowData *dat, HWND hwnd, WPARAM wParam, LPARAM lPar ImageList_DrawEx(g_dat->hTabIconList, tci.iImage, lpDIS->hDC, rIcon.left, rIcon.top, 0, 0, CLR_NONE, CLR_NONE, ILD_NORMAL); rect.left = rIcon.left + (info.rcImage.right - info.rcImage.left); } - if (dat->childrenCount > 1) { + if (dat->flags2 & SMF2_TABCLOSEBUTTON) { ImageList_GetImageInfo(g_dat->hButtonIconList, 0, &info); rIcon.top = rect.bottom - (info.rcImage.bottom - info.rcImage.top) - 2; rIcon.left = rect.right - GetSystemMetrics(SM_CXEDGE) - (bSelected ? 6 : 2) - (info.rcImage.right - info.rcImage.left); @@ -1462,7 +1449,7 @@ BOOL CALLBACK TabCtrlProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) dat->destTab = -1; RedrawWindow(hwnd, NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW); } - } else if (dat->srcTab >= 0 && TabCtrl_GetItemCount(hwnd) > 1) { + } else if (dat->srcTab >= 0 && g_dat->flags2 & SMF2_TABCLOSEBUTTON) { IMAGEINFO info; POINT pt; RECT rect; diff --git a/plugins/Scriver/src/resource.h b/plugins/Scriver/src/resource.h index 07ea9a6546..6f48c2d97a 100644 --- a/plugins/Scriver/src/resource.h +++ b/plugins/Scriver/src/resource.h @@ -83,6 +83,7 @@ #define IDC_STAYMINIMIZED 1006 #define IDC_SWITCHTOACTIVE 1007 #define IDC_SEPARATECHATSCONTAINERS 1008 +#define IDC_TABCLOSEBUTTON 1009 #define IDC_LIMITTABS 1010 #define IDC_LIMITTABSNUM 1011 #define IDC_LIMITCHATSTABS 1012 @@ -150,6 +151,7 @@ #define IDC_ATRANSPARENCYPERC 1620 #define IDC_ITRANSPARENCYVALUE 1621 #define IDC_ITRANSPARENCYPERC 1622 +#define IDC_ALWAYSSHOWTABS 1623 #define IDC_SENDALL 1624 #define IDC_TRANSPARENCYTEXT1 1627 #define IDC_TRANSPARENCYTEXT2 1628 -- cgit v1.2.3