diff --git a/uppsrc/CtrlCore/DrawTextX11.cpp b/uppsrc/CtrlCore/DrawTextX11.cpp index ddd3d0f6b..46e3dbad0 100644 --- a/uppsrc/CtrlCore/DrawTextX11.cpp +++ b/uppsrc/CtrlCore/DrawTextX11.cpp @@ -19,7 +19,7 @@ XftFont *CreateXftFont(Font font, int angle) double sina, cosa; Std(font); int hg = abs(font.GetHeight()); - if(hg == 0) hg = 10; + if(hg == 0) hg = max(GetStdFontCy(), 10); String face = font.GetFaceName(); FcPattern *p = FcPatternCreate(); FcPatternAddString(p, FC_FAMILY, (FcChar8*)~face); diff --git a/uppsrc/CtrlCore/init b/uppsrc/CtrlCore/init index 50cfc50f5..81d292e73 100644 --- a/uppsrc/CtrlCore/init +++ b/uppsrc/CtrlCore/init @@ -3,7 +3,7 @@ #include "Draw/init" #include "plugin\bmp/init" #include "RichText/init" -#define BLITZ_INDEX__ F0A6208DAEC7575B6117705E83EBFD054 +#define BLITZ_INDEX__ FC7D3155EBFD63D91990D6369B831171A #include "CtrlCore.icpp" #undef BLITZ_INDEX__ #endif diff --git a/uppsrc/CtrlLib/Button.cpp b/uppsrc/CtrlLib/Button.cpp index 471b46849..bbe66b368 100644 --- a/uppsrc/CtrlLib/Button.cpp +++ b/uppsrc/CtrlLib/Button.cpp @@ -170,7 +170,7 @@ int Pusher::GetVisualState() const Pusher::Pusher() { keypush = push = clickfocus = false; accesskey = 0; - font = Null; + font = StdFont(); NoInitFocus(); } diff --git a/uppsrc/CtrlLib/ChGtk.cpp b/uppsrc/CtrlLib/ChGtk.cpp index 932e37a5e..ea16342e2 100644 --- a/uppsrc/CtrlLib/ChGtk.cpp +++ b/uppsrc/CtrlLib/ChGtk.cpp @@ -589,6 +589,28 @@ extern String gtk_rgba; extern void ClearFtFaceCache(); +void SetDefTrough(ScrollBar::Style& s) +{ + for(int i = 0; i < 4; i++) { + Image m = CtrlsImg::Get(CtrlsImg::I_SBVU + i); + ImageBuffer ib(m); + Size sz = ib.GetSize(); + ib[0][sz.cx - 1] = ib[0][0] = SColorShadow(); + ib.SetHotSpot(Point(0, 0)); + ib.Set2ndSpot(Point(sz.cx - 1, 0)); + m = ib; + s.vlower[i] = s.vupper[i] = m; + m = CtrlsImg::Get(CtrlsImg::I_SBHU + i); + ib = m; + sz = ib.GetSize(); + ib[sz.cy - 1][0] = ib[0][0] = SColorShadow(); + ib.SetHotSpot(Point(0, 0)); + ib.Set2ndSpot(Point(0, sz.cy - 1)); + m = ib; + s.hupper[i] = s.hlower[i] = m; + } +} + void ChHostSkin() { MemoryIgnoreLeaksBlock __; @@ -779,6 +801,7 @@ void ChHostSkin() { ScrollBar::Style& s = ScrollBar::StyleDefault().Write(); + SetDefTrough(s); s.through = true; GtkObject *adj = gtk_adjustment_new(250, 0, 1000, 1, 1, 500); static GtkWidget *vscrollbar = gtk_vscrollbar_new(GTK_ADJUSTMENT(adj)); @@ -791,9 +814,10 @@ void ChHostSkin() s.isright2 = s.isdown2 = GtkInt("has-secondary-forward-stepper"); s.isleft2 = s.isup2 = GtkInt("has-secondary-backward-stepper"); + for(int i = 0; i < 6; i++) + CtrlsImg::Set(CtrlsImg::I_DA + i, CtrlsImg::Get(CtrlsImg::I_kDA + i)); + if(engine == "Qt") { - for(int i = 0; i < 6; i++) - CtrlsImg::Set(CtrlsImg::I_DA + i, CtrlsImg::Get(CtrlsImg::I_kDA + i)); int r = Null; for(int i = 0; i < 4; i++) { ImageDraw iw(64, 64); @@ -859,24 +883,7 @@ void ChHostSkin() GtkChSlider(s.vthumb); s.barsize += 2; s.arrowsize++; - for(int i = 0; i < 4; i++) { - Image m = CtrlsImg::Get(CtrlsImg::I_SBVU + i); - ImageBuffer ib(m); - Size sz = ib.GetSize(); - ib[0][sz.cx - 1] = ib[0][0] = SColorShadow(); - ib.SetHotSpot(Point(0, 0)); - ib.Set2ndSpot(Point(sz.cx - 1, 0)); - m = ib; - s.vlower[i] = s.vupper[i] = m; - m = CtrlsImg::Get(CtrlsImg::I_SBHU + i); - ib = m; - sz = ib.GetSize(); - ib[sz.cy - 1][0] = ib[0][0] = SColorShadow(); - ib.SetHotSpot(Point(0, 0)); - ib.Set2ndSpot(Point(0, sz.cy - 1)); - m = ib; - s.hupper[i] = s.hlower[i] = m; - } + SetDefTrough(s); static GtkWidget *hscrollbar = gtk_hscrollbar_new(GTK_ADJUSTMENT(adj)); ChGtkNew(hscrollbar, "slider", GTK_SLIDER|GTK_MARGIN1|GTK_XMARGIN); GtkChSlider(s.hthumb); @@ -884,9 +891,11 @@ void ChHostSkin() } else { GtkChSlider(s.vthumb); - ChGtkNew("trough", GTK_BGBOX); - GtkChTrough(s.vupper); - GtkChTrough(s.vlower); + if(engine != "Nodoka") { + ChGtkNew("trough", GTK_BGBOX); + GtkChTrough(s.vupper); + GtkChTrough(s.vlower); + } bool atp = IsEmptyImage(GetGTK(ChGtkLast(), 2, 2, "vscrollbar", GTK_BOX|GTK_TOP|GTK_RANGEA, 16, 16)); Size asz(s.barsize / 2, s.arrowsize / 2); if(engine == "Qt") @@ -918,8 +927,10 @@ void ChHostSkin() } } else { - GtkIml(CtrlsImg::I_UA, ChGtkLast(), 0, 0, "vscrollbar", GTK_ARROW|GTK_TOP|GTK_RANGEA, asz.cx, asz.cy); - GtkIml(CtrlsImg::I_DA, ChGtkLast(), 0, 0, "vscrollbar", GTK_ARROW|GTK_VAL1|GTK_BOTTOM|GTK_RANGED, asz.cx, asz.cy); + if(engine != "Nodoka") { + GtkIml(CtrlsImg::I_UA, ChGtkLast(), 0, 0, "vscrollbar", GTK_ARROW|GTK_TOP|GTK_RANGEA, asz.cx, asz.cy); + GtkIml(CtrlsImg::I_DA, ChGtkLast(), 0, 0, "vscrollbar", GTK_ARROW|GTK_VAL1|GTK_BOTTOM|GTK_RANGED, asz.cx, asz.cy); + } ChGtkNew("vscrollbar", GTK_BGBOX|GTK_TOP|GTK_RANGEA); GtkChArrow(s.up.look, CtrlsImg::UA(), po); @@ -970,9 +981,11 @@ void ChHostSkin() static GtkWidget *hscrollbar = gtk_hscrollbar_new(GTK_ADJUSTMENT(adj)); ChGtkNew(hscrollbar, "slider", GTK_SLIDER); GtkChSlider(s.hthumb); - ChGtkNew("trough", GTK_BGBOX); - GtkChTrough(s.hupper); - GtkChTrough(s.hlower); + if(engine != "Nodoka") { + ChGtkNew("trough", GTK_BGBOX); + GtkChTrough(s.hupper); + GtkChTrough(s.hlower); + } if(atp) { ChGtkNew("hscrollbar", GTK_ARROW|GTK_VAL2); GtkCh(s.left.look, "02141111"); @@ -982,8 +995,10 @@ void ChHostSkin() GtkCh(s.right2.look, "02141111"); } else { - GtkIml(CtrlsImg::I_LA, ChGtkLast(), 0, 0, "hscrollbar", GTK_ARROW|GTK_VAL2|GTK_LEFT|GTK_RANGEA, asz.cy, asz.cx); - GtkIml(CtrlsImg::I_RA, ChGtkLast(), 0, 0, "hscrollbar", GTK_ARROW|GTK_VAL3|GTK_RIGHT|GTK_RANGED, asz.cy, asz.cx); + if(engine != "Nodoka") { + GtkIml(CtrlsImg::I_LA, ChGtkLast(), 0, 0, "hscrollbar", GTK_ARROW|GTK_VAL2|GTK_LEFT|GTK_RANGEA, asz.cy, asz.cx); + GtkIml(CtrlsImg::I_RA, ChGtkLast(), 0, 0, "hscrollbar", GTK_ARROW|GTK_VAL3|GTK_RIGHT|GTK_RANGED, asz.cy, asz.cx); + } ChGtkNew("hscrollbar", GTK_BGBOX|GTK_LEFT|GTK_RANGEA); GtkChArrow(s.left.look, CtrlsImg::LA(), po); ChGtkNew("hscrollbar", GTK_BGBOX|GTK_VCENTER|GTK_RANGEC); diff --git a/uppsrc/CtrlLib/EditField.cpp b/uppsrc/CtrlLib/EditField.cpp index 5627d5e13..b6b802899 100644 --- a/uppsrc/CtrlLib/EditField.cpp +++ b/uppsrc/CtrlLib/EditField.cpp @@ -961,6 +961,7 @@ void EditField::Reset() alignright = false; SetStyle(StyleDefault()); SetFrame(edge); + font = StdFont(); } EditField& EditField::SetFont(Font _font) diff --git a/uppsrc/CtrlLib/LabelBase.cpp b/uppsrc/CtrlLib/LabelBase.cpp index 3b17d1203..d2f9df2a9 100644 --- a/uppsrc/CtrlLib/LabelBase.cpp +++ b/uppsrc/CtrlLib/LabelBase.cpp @@ -122,6 +122,7 @@ DrawLabel::DrawLabel() align = valign = ALIGN_CENTER; accesskey = 0; accesspos = -1; + font = StdFont(); } Size DrawLabel::GetSize(int txtcx) const diff --git a/uppsrc/CtrlLib/MultiButton.cpp b/uppsrc/CtrlLib/MultiButton.cpp index deea0ed84..8ea571670 100644 --- a/uppsrc/CtrlLib/MultiButton.cpp +++ b/uppsrc/CtrlLib/MultiButton.cpp @@ -262,6 +262,16 @@ int MultiButton::ChState(int i) : CTRL_NORMAL; } +Rect MultiButton::GetMargin() +{ + Rect m = style->margin; + int fcy = GetStdFontCy(); + int cy = GetSize().cy; + if(m.top + m.bottom + fcy > cy) + m.top = m.bottom = max((cy - fcy) / 2, 0); + return m; +} + void MultiButton::Lay(Rect& r) { int border, lx, rx; @@ -280,7 +290,7 @@ void MultiButton::Lay(Rect& r) } else if(frm) { - Rect m = style->margin; + Rect m = GetMargin(); r = Rect(r.left + max(lx, m.left), r.top + m.top, min(rx, r.right - m.right), r.bottom - m.bottom); } else { @@ -387,7 +397,7 @@ void MultiButton::Paint(Draw& w) } else if(frm) { - Rect m = style->margin; + Rect m = GetMargin(); r = Rect(max(lx, m.left), m.top, min(rx, sz.cx - m.right), sz.cy - m.bottom); Color paper; if(mst == CTRL_HOT && !IsTrivial()) diff --git a/uppsrc/CtrlLib/MultiButton.h b/uppsrc/CtrlLib/MultiButton.h index 90812aba8..29536ae89 100644 --- a/uppsrc/CtrlLib/MultiButton.h +++ b/uppsrc/CtrlLib/MultiButton.h @@ -105,6 +105,7 @@ private: bool GetPos(SubButton& b, int& lx, int& rx, int& x, int& cx, int px = -1); void GetPos(int ii, int& x, int& cx); int ChState(int i); + Rect GetMargin(); void Lay(Rect& r); bool ComplexFrame(); bool Metrics(int& border, int& lx, int &rx, const Rect& r); diff --git a/uppsrc/CtrlLib/Switch.cpp b/uppsrc/CtrlLib/Switch.cpp index 4797f7085..852496cc3 100644 --- a/uppsrc/CtrlLib/Switch.cpp +++ b/uppsrc/CtrlLib/Switch.cpp @@ -310,6 +310,7 @@ Switch::Switch() { mincy = 0; Transparent(); NoInitFocus(); + font = StdFont(); } Switch::~Switch() {} diff --git a/uppsrc/CtrlLib/TrayIconX11.cpp b/uppsrc/CtrlLib/TrayIconX11.cpp index 04b89e500..f68383c96 100644 --- a/uppsrc/CtrlLib/TrayIconX11.cpp +++ b/uppsrc/CtrlLib/TrayIconX11.cpp @@ -96,7 +96,7 @@ void TrayIcon::Message(int type, const char *title, const char *text, int timeou } UntrapX11Errors(x11trap); #else - if (!notify_init (title)) + if (!notify_init(title)) return; NotifyNotification* notification; GError* error = NULL; diff --git a/uppsrc/CtrlLib/init b/uppsrc/CtrlLib/init index 89fc6abb9..6539e88fe 100644 --- a/uppsrc/CtrlLib/init +++ b/uppsrc/CtrlLib/init @@ -2,7 +2,7 @@ #define _CtrlLib_icpp_init_stub #include "CtrlCore/init" #include "PdfDraw/init" -#define BLITZ_INDEX__ F8CEBFB3B591328AB1E0EC796741AA480 +#define BLITZ_INDEX__ F024C0B38D924382DCD64BDB53539FC50 #include "CtrlLib.icpp" #undef BLITZ_INDEX__ #endif