From 2f6fdfc629f79881b4095f98abe2bcc7fe9bf273 Mon Sep 17 00:00:00 2001 From: cxl Date: Fri, 21 Aug 2015 09:39:06 +0000 Subject: [PATCH] CtrlCore/CtrlLib: Fixed some issues with UHD mode and Gtk skin git-svn-id: svn://ultimatepp.org/upp/trunk@8825 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/CtrlCore/Ctrl.cpp | 3 +++ uppsrc/CtrlLib/ChGtk.cpp | 16 ++++++++++------ uppsrc/CtrlLib/ChGtk.h | 2 +- uppsrc/PdfDraw/init | 2 +- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/uppsrc/CtrlCore/Ctrl.cpp b/uppsrc/CtrlCore/Ctrl.cpp index f01de4f78..9845e13e5 100644 --- a/uppsrc/CtrlCore/Ctrl.cpp +++ b/uppsrc/CtrlCore/Ctrl.cpp @@ -955,6 +955,9 @@ void Ctrl::ReSkin() if(lock) return; lock++; + bool uhd = GetStdFontCy() > 22; + GUI_HiDPI_Write(GetStdFontCy() > 22); + SetUHDMode(uhd); if(s_chdefault) (*s_chdefault)(); if(skin) diff --git a/uppsrc/CtrlLib/ChGtk.cpp b/uppsrc/CtrlLib/ChGtk.cpp index d98b8030a..14f06fa76 100644 --- a/uppsrc/CtrlLib/ChGtk.cpp +++ b/uppsrc/CtrlLib/ChGtk.cpp @@ -53,6 +53,10 @@ extern String CurrentSoundTheme; void ChHostSkin() { + int fcx = 17 * (1 + IsUHDMode()); + FrameButtonWidth_Write(fcx); + ScrollBarArrowSize_Write(fcx); + MemoryIgnoreLeaksBlock __; static struct { void (*set)(Color); int ii; } col[] = { { SColorPaper_Write, 6*5 + 0 }, @@ -81,7 +85,7 @@ void ChHostSkin() ColoredOverride(CtrlsImg::Iml(), ClassicCtrlsImg::Iml()); ChLookFn(GtkLookFn); - + bool KDE = Environment().Get("KDE_FULL_SESSION", String()) == "true"; String engine = GtkStyleString("gtk-theme-name"); @@ -159,7 +163,7 @@ void ChHostSkin() ChGtkIs().Clear(); GtkWidget *w = Setup(gtk_radio_button_new(NULL)); - int is = GtkInt(w, "indicator-size") + 2; + int is = DPI(GtkInt(w, "indicator-size")) + 2; GTK_TOGGLE_BUTTON(w)->active = false; GTK_TOGGLE_BUTTON(w)->inconsistent = false; GtkIml(CtrlsImg::I_S0, w, 2, "radiobutton", GTK_OPTION|GTK_MARGIN1, is, is); @@ -203,9 +207,9 @@ void ChHostSkin() po.x = GtkInt("child-displacement-x"); po.y = GtkInt("child-displacement-y"); - s.ok = GtkImage("gtk-ok", 4, 16); - s.cancel = GtkImage("gtk-cancel", 4, 16); - s.exit = GtkImage("gtk-quit", 4, 16); + s.ok = GtkImage("gtk-ok", DPI(16), DPI(16)); + s.cancel = GtkImage("gtk-cancel", DPI(16), DPI(16)); + s.exit = GtkImage("gtk-quit", DPI(16), DPI(16)); ChGtkColor(s.textcolor, 0 * 5); s.pressoffset = po; @@ -260,7 +264,7 @@ void ChHostSkin() ChGtkNew(vscrollbar, "slider", GTK_SLIDER|GTK_VAL1); s.thumbmin = GTK_RANGE(vscrollbar)->min_slider_size; - s.barsize = max(14, GtkInt("slider_width")); // 'max' - ugly fix for ThinIce theme + s.barsize = max(DPI(14), GtkInt("slider_width")); // 'max' - ugly fix for ThinIce theme s.arrowsize = max(s.barsize, GtkInt("stepper_size")); // 'max' - ugly fix for ThinIce theme /* The only theme with 3 buttons is Amaranth and it does not look good... diff --git a/uppsrc/CtrlLib/ChGtk.h b/uppsrc/CtrlLib/ChGtk.h index adc1f78ae..92a56b5cd 100644 --- a/uppsrc/CtrlLib/ChGtk.h +++ b/uppsrc/CtrlLib/ChGtk.h @@ -147,7 +147,7 @@ String GtkStyleString(const char *name); void GtkChScrollBar(Value *lbutton, Value *lbutton2, Value *lower, Value *thumb, Value *upper, - Value *ubutton2, Value *ubutton, + Value *ubutton2, Value *ubutton, int i_larrow, int i_uarrow, bool horz); }; diff --git a/uppsrc/PdfDraw/init b/uppsrc/PdfDraw/init index 28995abea..10066a884 100644 --- a/uppsrc/PdfDraw/init +++ b/uppsrc/PdfDraw/init @@ -1,7 +1,7 @@ #ifndef _PdfDraw_icpp_init_stub #define _PdfDraw_icpp_init_stub #include "Draw/init" -#define BLITZ_INDEX__ F51dd2ec67e7a06d44adca1e7fbbaebdc +#define BLITZ_INDEX__ F45b8b8ce27234b3a4db83c8cbd05bbce #include "PdfReport.icpp" #undef BLITZ_INDEX__ #endif