summaryrefslogtreecommitdiff
path: root/src/core/stdchat
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-01-15 08:32:28 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-01-15 08:32:28 +0000
commitf507f067b0559d3e9e3d9764fd9ae94284432577 (patch)
tree7ee10a0426916018428686cdad666f3a24b92020 /src/core/stdchat
parentb4b7fadea31c8a909cefe50051691aa3e883d45d (diff)
fix for reading splitter settings
git-svn-id: http://svn.miranda-ng.org/main/trunk@7662 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/core/stdchat')
-rw-r--r--src/core/stdchat/src/main.cpp34
-rw-r--r--src/core/stdchat/src/window.cpp78
2 files changed, 58 insertions, 54 deletions
diff --git a/src/core/stdchat/src/main.cpp b/src/core/stdchat/src/main.cpp
index d70685a5a2..ae73933d2e 100644
--- a/src/core/stdchat/src/main.cpp
+++ b/src/core/stdchat/src/main.cpp
@@ -73,23 +73,6 @@ int OnShutdown(WPARAM, LPARAM)
return 0;
}
-void TabsInit(void)
-{
- ZeroMemory(&g_TabSession, sizeof(SESSION_INFO));
- g_TabSession.iType = GCW_TABROOM;
- g_TabSession.iSplitterX = g_Settings.iSplitterX;
- g_TabSession.iSplitterY = g_Settings.iSplitterY;
- g_TabSession.iLogFilterFlags = (int)db_get_dw(NULL, "Chat", "FilterFlags", 0x03E0);
- g_TabSession.bFilterEnabled = db_get_b(NULL, "Chat", "FilterEnabled", 0);
- g_TabSession.bNicklistEnabled = db_get_b(NULL, "Chat", "ShowNicklist", 1);
- g_TabSession.iFG = 4;
- g_TabSession.bFGSet = TRUE;
- g_TabSession.iBG = 2;
- g_TabSession.bBGSet = TRUE;
-
- HookEvent(ME_SYSTEM_SHUTDOWN, OnShutdown);
-}
-
static void OnAddLog(SESSION_INFO *si, int isOk)
{
if (isOk && si->hWnd) {
@@ -254,6 +237,18 @@ static void OnLoadSettings()
if (hListSelectedBkgBrush != NULL)
DeleteObject(hListSelectedBkgBrush);
hListSelectedBkgBrush = CreateSolidBrush(db_get_dw(NULL, "Chat", "ColorNicklistSelectedBG", GetSysColor(COLOR_HIGHLIGHT)));
+
+ ZeroMemory(&g_TabSession, sizeof(SESSION_INFO));
+ g_TabSession.iType = GCW_TABROOM;
+ g_TabSession.iSplitterX = g_Settings.iSplitterX;
+ g_TabSession.iSplitterY = g_Settings.iSplitterY;
+ g_TabSession.iLogFilterFlags = (int)db_get_dw(NULL, "Chat", "FilterFlags", 0x03E0);
+ g_TabSession.bFilterEnabled = db_get_b(NULL, "Chat", "FilterEnabled", 0);
+ g_TabSession.bNicklistEnabled = db_get_b(NULL, "Chat", "ShowNicklist", 1);
+ g_TabSession.iFG = 4;
+ g_TabSession.bFGSet = TRUE;
+ g_TabSession.iBG = 2;
+ g_TabSession.bBGSet = TRUE;
}
extern "C" __declspec(dllexport) int Load(void)
@@ -291,7 +286,8 @@ extern "C" __declspec(dllexport) int Load(void)
AddIcons();
LoadIcons();
OptionsInit();
- TabsInit();
+
+ HookEvent(ME_SYSTEM_SHUTDOWN, OnShutdown);
return 0;
}
@@ -436,4 +432,4 @@ STDMETHODIMP CREOleCallback::QueryInsertObject(LPCLSID lpclsid, LPSTORAGE lpstg,
STDMETHODIMP CREOleCallback::ShowContainerUI(BOOL fShow)
{
return S_OK;
-} \ No newline at end of file
+}
diff --git a/src/core/stdchat/src/window.cpp b/src/core/stdchat/src/window.cpp
index 0ad24af67e..632c3ed8d3 100644
--- a/src/core/stdchat/src/window.cpp
+++ b/src/core/stdchat/src/window.cpp
@@ -124,7 +124,7 @@ static int RoomWndResize(HWND hwndDlg,LPARAM lParam,UTILRESIZECONTROL *urc)
BOOL bFormat = (BOOL)db_get_b(NULL, "Chat", "ShowFormatButtons", 1);
BOOL bToolbar = bFormat || bControl;
BOOL bSend = (BOOL)db_get_b(NULL, "Chat", "ShowSend", 0);
- BOOL bNick = si->iType!=GCW_SERVER && si->bNicklistEnabled;
+ BOOL bNick = si->iType != GCW_SERVER && si->bNicklistEnabled;
BOOL bTabs = g_Settings.TabsEnable;
BOOL bTabBottom = g_Settings.TabsAtBottom;
@@ -134,19 +134,19 @@ static int RoomWndResize(HWND hwndDlg,LPARAM lParam,UTILRESIZECONTROL *urc)
TabCtrl_AdjustRect(GetDlgItem(hwndDlg, IDC_TAB), FALSE, &rcTabs);
TabHeight -= (rcTabs.bottom - rcTabs.top);
ShowWindow(GetDlgItem(hwndDlg, IDC_SMILEY), (SmileyAddInstalled && bFormat) ? SW_SHOW : SW_HIDE);
- ShowWindow(GetDlgItem(hwndDlg, IDC_BOLD), bFormat?SW_SHOW:SW_HIDE);
- ShowWindow(GetDlgItem(hwndDlg, IDC_UNDERLINE), bFormat?SW_SHOW:SW_HIDE);
- ShowWindow(GetDlgItem(hwndDlg, IDC_ITALICS), bFormat?SW_SHOW:SW_HIDE);
- ShowWindow(GetDlgItem(hwndDlg, IDC_COLOR), bFormat?SW_SHOW:SW_HIDE);
- ShowWindow(GetDlgItem(hwndDlg, IDC_BKGCOLOR), bFormat?SW_SHOW:SW_HIDE);
- ShowWindow(GetDlgItem(hwndDlg, IDC_HISTORY), bControl?SW_SHOW:SW_HIDE);
- ShowWindow(GetDlgItem(hwndDlg, IDC_SHOWNICKLIST), bControl?SW_SHOW:SW_HIDE);
- ShowWindow(GetDlgItem(hwndDlg, IDC_FILTER), bControl?SW_SHOW:SW_HIDE);
- ShowWindow(GetDlgItem(hwndDlg, IDC_CHANMGR), bControl?SW_SHOW:SW_HIDE);
- ShowWindow(GetDlgItem(hwndDlg, IDOK), bSend?SW_SHOW:SW_HIDE);
- ShowWindow(GetDlgItem(hwndDlg, IDC_SPLITTERX), bNick?SW_SHOW:SW_HIDE);
- ShowWindow(GetDlgItem(hwndDlg, IDC_CLOSE), g_Settings.TabsEnable?SW_SHOW:SW_HIDE);
- ShowWindow(GetDlgItem(hwndDlg, IDC_TAB), g_Settings.TabsEnable?SW_SHOW:SW_HIDE);
+ ShowWindow(GetDlgItem(hwndDlg, IDC_BOLD), bFormat ? SW_SHOW : SW_HIDE);
+ ShowWindow(GetDlgItem(hwndDlg, IDC_UNDERLINE), bFormat ? SW_SHOW : SW_HIDE);
+ ShowWindow(GetDlgItem(hwndDlg, IDC_ITALICS), bFormat ? SW_SHOW : SW_HIDE);
+ ShowWindow(GetDlgItem(hwndDlg, IDC_COLOR), bFormat ? SW_SHOW : SW_HIDE);
+ ShowWindow(GetDlgItem(hwndDlg, IDC_BKGCOLOR), bFormat ? SW_SHOW : SW_HIDE);
+ ShowWindow(GetDlgItem(hwndDlg, IDC_HISTORY), bControl ? SW_SHOW : SW_HIDE);
+ ShowWindow(GetDlgItem(hwndDlg, IDC_SHOWNICKLIST), bControl ? SW_SHOW : SW_HIDE);
+ ShowWindow(GetDlgItem(hwndDlg, IDC_FILTER), bControl ? SW_SHOW : SW_HIDE);
+ ShowWindow(GetDlgItem(hwndDlg, IDC_CHANMGR), bControl ? SW_SHOW : SW_HIDE);
+ ShowWindow(GetDlgItem(hwndDlg, IDOK), bSend ? SW_SHOW : SW_HIDE);
+ ShowWindow(GetDlgItem(hwndDlg, IDC_SPLITTERX), bNick ? SW_SHOW : SW_HIDE);
+ ShowWindow(GetDlgItem(hwndDlg, IDC_CLOSE), g_Settings.TabsEnable ? SW_SHOW : SW_HIDE);
+ ShowWindow(GetDlgItem(hwndDlg, IDC_TAB), g_Settings.TabsEnable ? SW_SHOW : SW_HIDE);
if (si->iType != GCW_SERVER)
ShowWindow(GetDlgItem(hwndDlg, IDC_LIST), si->bNicklistEnabled?SW_SHOW:SW_HIDE);
else
@@ -167,50 +167,58 @@ static int RoomWndResize(HWND hwndDlg,LPARAM lParam,UTILRESIZECONTROL *urc)
switch(urc->wId) {
case IDOK:
GetWindowRect(si->hwndStatus, &rc);
- urc->rcItem.left = bSend?315:urc->dlgNewSize.cx ;
- urc->rcItem.top = urc->dlgNewSize.cy - si->iSplitterY+23;
- urc->rcItem.bottom = urc->dlgNewSize.cy - (rc.bottom-rc.top)-1;
- return RD_ANCHORX_RIGHT|RD_ANCHORY_CUSTOM;
+ urc->rcItem.left = bSend ? 315 : urc->dlgNewSize.cx;
+ urc->rcItem.top = urc->dlgNewSize.cy - si->iSplitterY + 23;
+ urc->rcItem.bottom = urc->dlgNewSize.cy - (rc.bottom - rc.top) - 1;
+ return RD_ANCHORX_RIGHT | RD_ANCHORY_CUSTOM;
case IDC_TAB:
urc->rcItem.top = 1;
urc->rcItem.left = 0;
urc->rcItem.right = urc->dlgNewSize.cx- 24;
- urc->rcItem.bottom = bToolbar?(urc->dlgNewSize.cy - si->iSplitterY):(urc->dlgNewSize.cy - si->iSplitterY+20);
- return RD_ANCHORX_CUSTOM|RD_ANCHORY_CUSTOM;
+ urc->rcItem.bottom = urc->dlgNewSize.cy - si->iSplitterY;
+ if (bToolbar)
+ urc->rcItem.bottom += 20;
+ return RD_ANCHORX_CUSTOM | RD_ANCHORY_CUSTOM;
case IDC_LOG:
urc->rcItem.top = bTabs?(bTabBottom?0:rcTabs.top-1):0;
urc->rcItem.left = 0;
urc->rcItem.right = bNick?urc->dlgNewSize.cx - si->iSplitterX:urc->dlgNewSize.cx;
- urc->rcItem.bottom = bToolbar?(bTabs&&bTabBottom?urc->dlgNewSize.cy - si->iSplitterY-TabHeight + 6:urc->dlgNewSize.cy - si->iSplitterY):(bTabs&&bTabBottom?urc->dlgNewSize.cy - si->iSplitterY-TabHeight+26:urc->dlgNewSize.cy - si->iSplitterY+20);
- return RD_ANCHORX_CUSTOM|RD_ANCHORY_CUSTOM;
+ urc->rcItem.bottom = (bTabs && bTabBottom) ? urc->dlgNewSize.cy - si->iSplitterY - TabHeight + 6 : urc->dlgNewSize.cy - si->iSplitterY;
+ if (bToolbar)
+ urc->rcItem.bottom += 20;
+ return RD_ANCHORX_CUSTOM | RD_ANCHORY_CUSTOM;
case IDC_LIST:
urc->rcItem.top = bTabs?(bTabBottom?0:rcTabs.top-1):0;
urc->rcItem.right = urc->dlgNewSize.cx ;
urc->rcItem.left = urc->dlgNewSize.cx - si->iSplitterX + 2;
- urc->rcItem.bottom = bToolbar?(bTabs&&bTabBottom?urc->dlgNewSize.cy - si->iSplitterY-TabHeight + 6:urc->dlgNewSize.cy - si->iSplitterY):(bTabs&&bTabBottom?urc->dlgNewSize.cy - si->iSplitterY-TabHeight+26:urc->dlgNewSize.cy - si->iSplitterY+20);
- return RD_ANCHORX_CUSTOM|RD_ANCHORY_CUSTOM;
+ urc->rcItem.bottom = (bTabs && bTabBottom) ? urc->dlgNewSize.cy - si->iSplitterY - TabHeight + 6 : urc->dlgNewSize.cy - si->iSplitterY;
+ if (bToolbar)
+ urc->rcItem.bottom += 20;
+ return RD_ANCHORX_CUSTOM | RD_ANCHORY_CUSTOM;
case IDC_SPLITTERX:
- urc->rcItem.right = urc->dlgNewSize.cx - si->iSplitterX+2;
+ urc->rcItem.right = urc->dlgNewSize.cx - si->iSplitterX + 2;
urc->rcItem.left = urc->dlgNewSize.cx - si->iSplitterX;
- urc->rcItem.bottom = bToolbar?(bTabs&&bTabBottom?urc->dlgNewSize.cy - si->iSplitterY-TabHeight + 6:urc->dlgNewSize.cy - si->iSplitterY):(bTabs&&bTabBottom?urc->dlgNewSize.cy - si->iSplitterY-TabHeight+26:urc->dlgNewSize.cy - si->iSplitterY+20);
- urc->rcItem.top = bTabs ?rcTabs.top:1;
- return RD_ANCHORX_CUSTOM|RD_ANCHORY_CUSTOM;
+ urc->rcItem.bottom = (bTabs && bTabBottom) ? urc->dlgNewSize.cy - si->iSplitterY - TabHeight + 6 : urc->dlgNewSize.cy - si->iSplitterY;
+ if (bToolbar)
+ urc->rcItem.bottom += 20;
+ urc->rcItem.top = bTabs ? rcTabs.top : 1;
+ return RD_ANCHORX_CUSTOM | RD_ANCHORY_CUSTOM;
case IDC_SPLITTERY:
- urc->rcItem.top = bToolbar?urc->dlgNewSize.cy - si->iSplitterY:urc->dlgNewSize.cy - si->iSplitterY+20;
- urc->rcItem.bottom = bToolbar?(urc->dlgNewSize.cy - si->iSplitterY+2):(urc->dlgNewSize.cy - si->iSplitterY+22);
- return RD_ANCHORX_WIDTH|RD_ANCHORY_CUSTOM;
+ urc->rcItem.top = bToolbar ? urc->dlgNewSize.cy - si->iSplitterY : urc->dlgNewSize.cy - si->iSplitterY + 20;
+ urc->rcItem.bottom = bToolbar ? (urc->dlgNewSize.cy - si->iSplitterY + 2) : (urc->dlgNewSize.cy - si->iSplitterY + 22);
+ return RD_ANCHORX_WIDTH | RD_ANCHORY_CUSTOM;
case IDC_MESSAGE:
GetWindowRect(si->hwndStatus, &rc);
- urc->rcItem.right = bSend?urc->dlgNewSize.cx - 64:urc->dlgNewSize.cx ;
- urc->rcItem.top = urc->dlgNewSize.cy - si->iSplitterY+22;
- urc->rcItem.bottom = urc->dlgNewSize.cy - (rc.bottom-rc.top)-1 ;
- return RD_ANCHORX_LEFT|RD_ANCHORY_CUSTOM;
+ urc->rcItem.right = bSend ? urc->dlgNewSize.cx - 64 : urc->dlgNewSize.cx;
+ urc->rcItem.top = urc->dlgNewSize.cy - si->iSplitterY + 22;
+ urc->rcItem.bottom = urc->dlgNewSize.cy - (rc.bottom - rc.top) - 1;
+ return RD_ANCHORX_LEFT | RD_ANCHORY_CUSTOM;
case IDC_SMILEY:
case IDC_ITALICS: