void Toolbar_UpdatePosition() { Settings_toolbarAlpha = Settings_toolbarAlphaEnabled ? Settings_toolbarAlphaValue : 255; // Another Toolbar has set the info: if (NULL == Toolbar_hwnd && TBInfo.hwnd) return; intptr_t place = get_string_index(Settings_toolbarPlacement, placement_strings); if (-1 == place) place = PLACEMENT_BOTTOM_CENTER; // --- toolbar metrics ---------------------- int labelH, buttonH; if (Settings_newMetrics || (mStyle.ToolbarLabel.validated & VALID_MARGIN)) { HFONT hf = CreateStyleFont(&mStyle.Toolbar); int lfh = get_fontheight(hf); DeleteObject(hf); if (mStyle.ToolbarLabel.validated & VALID_MARGIN) labelH = lfh + 2 * mStyle.ToolbarLabel.marginWidth; else labelH = (int)imax(10, lfh) + 2*2; } else { labelH = (int)imax(8, mStyle.Toolbar.FontHeight) + 2; } labelH |= 1; if (mStyle.ToolbarButton.validated & VALID_MARGIN) { buttonH = 9 + 2 * mStyle.ToolbarButton.marginWidth; } else { buttonH = labelH - 2; } tbMargin = mStyle.Toolbar.marginWidth; tbButtonWH = buttonH; tbLabelH = labelH; int tbheight = (int)imax(labelH, buttonH) + 2 * (mStyle.Toolbar.borderWidth + mStyle.Toolbar.marginWidth); int tbwidth = (int)imax (300, ScreenWidth * Settings_toolbarWidthPercent / 100); // ------------------------------------------ //int ScreenWidth = GetSystemMetrics(SM_CXSCREEN); //int ScreenHeight = GetSystemMetrics(SM_CYSCREEN); TBInfo.placement = (int)place; TBInfo.widthPercent = Settings_toolbarWidthPercent; TBInfo.height = tbheight; TBInfo.width = tbwidth; TBInfo.ypos = (place<3) ? 0 : ScreenHeight - TBInfo.height; TBInfo.xpos = (place%3) * (ScreenWidth - TBInfo.width) / 2; TBInfo.onTop = Settings_toolbarOnTop; TBInfo.autoHide = Settings_toolbarAutoHide; TBInfo.pluginToggle = Settings_toolbarPluginToggle; TBInfo.autohidden = TBInfo.autoHide; TBInfo.alphaValue = Settings_toolbarAlphaValue; TBInfo.transparency = Settings_toolbarAlphaEnabled; TBInfo.disabled = false == Settings_toolbarEnabled; TBInfo.hidden = false == Settings_toolbarEnabled; if (Toolbar_hwnd) { int d = TBInfo.height - 1; Toolbar_HideY = TBInfo.ypos + (place < 3 ? -d : d); SetDesktopMargin( Toolbar_hwnd, place < 3 ? BB_DM_TOP : BB_DM_BOTTOM, TBInfo.autoHide || Toolbar_hidden ? 0 : TBInfo.height + (TBInfo.onTop ? 0 : 4) ); tbClockW = 0; Toolbar_setlabel(); Toolbar_setclock(); if (Toolbar_hFont) DeleteObject(Toolbar_hFont), Toolbar_hFont = NULL; Toolbar_set_pos(); } }
void StringItem::Paint(HDC hDC) { RECT r; HFONT hFont; int x, y, w, h, padd; if (Settings_menu.showBroams) { if (hText) DestroyWindow(hText), hText = NULL; m_Justify = MENUITEM_STANDARD_JUSTIFY; MenuItem::Paint(hDC); return; } m_Justify = MENUITEM_CUSTOMTEXT; MenuItem::Paint(hDC); GetTextRect(&r); if (EqualRect(&m_textrect, &r)) return; m_textrect = r; if (NULL == hText) { hText = CreateWindow( TEXT("EDIT"), m_pszTitle, WS_CHILD | WS_VISIBLE | ES_AUTOHSCROLL | ES_MULTILINE, 0, 0, 0, 0, m_pMenu->m_hwnd, (HMENU)1234, hMainInstance, NULL ); SetWindowLongPtr(hText, GWLP_USERDATA, (LONG_PTR)this); wpEditProc = (WNDPROC)SetWindowLongPtr(hText, GWLP_WNDPROC, (LONG_PTR)EditProc); #if 0 int n = GetWindowTextLength(hText); SendMessage(hText, EM_SETSEL, 0, n); SendMessage(hText, EM_SCROLLCARET, 0, 0); #endif m_pMenu->m_hwndChild = hText; if (GetFocus() == m_pMenu->m_hwnd) SetFocus(hText); } hFont = MenuInfo.hFrameFont; SendMessage(hText, WM_SETFONT, (WPARAM)hFont, 0); x = r.left-1; y = r.top+2; h = r.bottom - r.top - 4; w = r.right - r.left + 2; SetWindowPos(hText, NULL, x, y, w, h, SWP_NOZORDER); padd = imax(0, (h - get_fontheight(hFont)) / 2); r.left = padd+2; r.right = w - (padd+2); r.top = padd; r.bottom = h - padd; SendMessage(hText, EM_SETRECT, 0, (LPARAM)&r); }
void Toolbar_UpdatePosition(void) { int ScreenWidth; int ScreenHeight; int labelH, buttonH, tbheight, tbwidth, labelBorder; int place, fontH; HFONT hf; struct toolbar_setting *tbs = &Settings_toolbar; // Another Toolbar has set the info: if (NULL == Toolbar_hwnd && TBInfo.hwnd) return; ScreenWidth = GetSystemMetrics(SM_CXSCREEN); ScreenHeight = GetSystemMetrics(SM_CYSCREEN); place = get_string_index(tbs->placement, placement_strings); if (-1 == place) place = PLACEMENT_BOTTOM_CENTER; // --- toolbar metrics ---------------------- hf = CreateStyleFont(&mStyle.Toolbar); fontH = get_fontheight(hf); DeleteObject(hf); // xxx old behaviour xxx if (false == mStyle.is_070 && 0 == (mStyle.ToolbarLabel.validated & V_MAR)) fontH = mStyle.Toolbar.FontHeight-2; //xxxxxxxxxxxxxxxxxxxxxx labelBorder = imax(mStyle.ToolbarLabel.borderWidth, imax(mStyle.ToolbarWindowLabel.borderWidth, mStyle.ToolbarClock.borderWidth)); labelH = (fontH|1) + 2*(mStyle.ToolbarLabel.marginWidth/*+labelBorder*/); buttonH = labelH + 2*(mStyle.ToolbarButton.marginWidth-mStyle.ToolbarLabel.marginWidth); tbMargin = mStyle.Toolbar.marginWidth; tbButtonWH = buttonH; tbLabelH = labelH; tbLabelIndent = imax(2+labelBorder, (labelH-fontH)/2); tbheight = imax(labelH, buttonH) + 2*(mStyle.Toolbar.borderWidth + mStyle.Toolbar.marginWidth); tbwidth = imax (300, ScreenWidth * tbs->widthPercent / 100); // ------------------------------------------ TBInfo.placement = place; TBInfo.widthPercent = tbs->widthPercent; TBInfo.height = tbheight; TBInfo.width = tbwidth; TBInfo.ypos = (place<3) ? 0 : ScreenHeight - TBInfo.height; TBInfo.xpos = (place%3) * (ScreenWidth - TBInfo.width) / 2; TBInfo.onTop = tbs->onTop; TBInfo.autoHide = tbs->autoHide; TBInfo.pluginToggle = tbs->pluginToggle; TBInfo.autohidden = TBInfo.autoHide; TBInfo.alphaValue = (BYTE)tbs->alphaValue; TBInfo.transparency = tbs->alphaEnabled; TBInfo.disabled = false == tbs->enabled; TBInfo.hidden = false == tbs->enabled; if (Toolbar_hwnd) { int d = TBInfo.height - 1; Toolbar_HideY = TBInfo.ypos + (place < 3 ? -d : d); SetDesktopMargin( Toolbar_hwnd, place < 3 ? BB_DM_TOP : BB_DM_BOTTOM, TBInfo.autoHide || Toolbar_hidden ? 0 : TBInfo.height); tbClockW = 0; Toolbar_setlabel(); Toolbar_setclock(); if (Toolbar_hFont) DeleteObject(Toolbar_hFont), Toolbar_hFont = NULL; Toolbar_set_pos(); } }