diff --git a/uppdev/RichEditTest/main.cpp b/uppdev/RichEditTest/main.cpp index ba4883c82..f887c972f 100644 --- a/uppdev/RichEditTest/main.cpp +++ b/uppdev/RichEditTest/main.cpp @@ -1,5 +1,19 @@ #include +#define Time XTime +#define Font XFont +#define Display XDisplay +#define Picture XPicture + +#include +#include +#include + +#undef Picture +#undef Time +#undef Font +#undef Display + using namespace Upp; String FileName() @@ -25,7 +39,13 @@ GUI_APP_MAIN DUMP(GetStdFontCy()); DUMP(GUI_PopUpEffect()); +// String htxt; +// if(!EditText(htxt, "xxx", "xxxx")) +// return; + // PromptOK("[H20L1 &&&"); + + DUMPM(Environment()); RichEditWithToolBar e; // e.SetPage(Size(6074, 3968)); diff --git a/uppsrc/CtrlCore/GtkApp.cpp b/uppsrc/CtrlCore/GtkApp.cpp index 4db7414e8..68bef4a52 100644 --- a/uppsrc/CtrlCore/GtkApp.cpp +++ b/uppsrc/CtrlCore/GtkApp.cpp @@ -2,10 +2,22 @@ #ifdef GUI_GTK +#define CATCH_ERRORS 0 + NAMESPACE_UPP #define LLOG(x) // DLOG(x) +#if CATCH_ERRORS +void CatchError(const gchar *log_domain, + GLogLevelFlags log_level, + const gchar *message, + gpointer user_data) +{ + __BREAK__; +} +#endif + void _DBG_Ungrab(void) { // This is a special nasty hack to make possible to ungrab mouse by debugger (see ide/Debuggers/PrettyPrinters.py) gdk_pointer_ungrab(GDK_CURRENT_TIME); @@ -40,6 +52,9 @@ void InitGtkApp(int argc, char **argv, const char **envptr) g_timeout_add(20, (GSourceFunc) Ctrl::TimeHandler, NULL); InstallPanicMessageBox(Ctrl::PanicMsgBox); gdk_window_add_filter(NULL, Ctrl::RootKeyFilter, NULL); +#if CATCH_ERRORS + g_log_set_default_handler (CatchError, 0); +#endif } void ExitGtkApp() diff --git a/uppsrc/CtrlCore/GtkCreate.cpp b/uppsrc/CtrlCore/GtkCreate.cpp index 1d073ed32..eb355744e 100644 --- a/uppsrc/CtrlCore/GtkCreate.cpp +++ b/uppsrc/CtrlCore/GtkCreate.cpp @@ -100,8 +100,8 @@ void Ctrl::WndDestroy() if(HasFocusDeep()) activeCtrl = owner; } - gtk_widget_destroy(top->window); g_object_unref(top->im_context); + gtk_widget_destroy(top->window); isopen = false; popup = false; delete top; diff --git a/uppsrc/CtrlCore/init b/uppsrc/CtrlCore/init index 27c33a181..aa63470cf 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__ Fe2ff541f9bb9f4ad3f5bcc23a34e1b73 +#define BLITZ_INDEX__ F656a4ea94e4f808b1ec63034b0e6c5ac #include "CtrlCore.icpp" #undef BLITZ_INDEX__ #endif diff --git a/uppsrc/CtrlLib/ChGtk.cpp b/uppsrc/CtrlLib/ChGtk.cpp index d0a304ca8..8734360d1 100644 --- a/uppsrc/CtrlLib/ChGtk.cpp +++ b/uppsrc/CtrlLib/ChGtk.cpp @@ -261,8 +261,103 @@ void ChHostSkin() for(int i = 0; i < 6; i++) CtrlsImg::Set(CtrlsImg::I_DA + i, CtrlsImg::Get(CtrlsImg::I_kDA + i)); - if(Qt) { - LLOG("Qt path"); + if((Environment().Get("GTK_MODULES", "").Find("overlay-scrollbar") < 0 || + Environment().Get("LIBOVERLAY_SCROLLBAR", "1") == "0") && + findarg(engine, "Glider", "Human", "DarkRoom", "Crux") >= 0) { + GtkChScrollBar(s.up.look, s.up2.look, s.vlower, s.vthumb, s.vupper, s.down2.look, s.down.look, + CtrlsImg::I_UA, CtrlsImg::I_DA, false); + + if(IsEmptyImage(GetGTK(ChGtkLast(), 2, 2, "vscrollbar", GTK_BOX|GTK_TOP|GTK_RANGEA, 16, 16))) { + static GtkWidget *btn = gtk_button_new(); + ChGtkNew(btn, "button", GTK_BOX); + + GtkChButton(Button::StyleScroll().Write().look); + GtkChButton(Button::StyleEdge().Write().look); + GtkChButton(Button::StyleLeftEdge().Write().look); + + { + DropList::Style& s = DropList::StyleFrame().Write(); + GtkChButtonWith(s.look, CtrlsImg::DA()); + GtkChButtonWith(s.trivial, CtrlsImg::DA()); + } + { + SpinButtons::Style& s = SpinButtons::StyleDefault().Write(); + GtkChButtonWith(s.inc.look, CtrlImg::spinup2()); + GtkChButtonWith(s.dec.look, CtrlImg::spindown2()); + } + } + else { + ChGtkNew("vscrollbar", GTK_BOX|GTK_VCENTER|GTK_RANGEB); + GtkCh(Button::StyleScroll().Write().look, "02142222"); + + int q = !classiq; + + GtkChImgWith(Button::StyleEdge().Write().look, Null, 1 * q); + GtkChImgWith(Button::StyleLeftEdge().Write().look, Null, 2 * q); + + { + DropList::Style& s = DropList::StyleFrame().Write(); + GtkChImgWith(s.look, CtrlsImg::DA(), 1 * q, po); + GtkChImgWith(s.trivial, CtrlsImg::DA(), 1 * q, po); + GtkChImgWith(s.left, CtrlsImg::DA(), 2 * q, po); + GtkChImgWith(s.right, CtrlsImg::DA(), 1 * q, po); + s.pressoffset = po; + } + { + SpinButtons::Style& s = SpinButtons::StyleDefault().Write(); + GtkChImgWith(s.inc.look, q ? CtrlImg::spinup2() : CtrlImg::spinup3(), (1|GTK_BOTTOMLINE) * q, po); + GtkChImgWith(s.dec.look, q ? CtrlImg::spindown2() : CtrlImg::spindown3(), 1 * q, po); + } + } + + static GtkWidget *hscrollbar = gtk_hscrollbar_new(GTK_ADJUSTMENT(adj)); + ChGtkNew(hscrollbar, "slider", GTK_SLIDER); + GtkChScrollBar(s.left.look, s.left2.look, s.hlower, s.hthumb, s.hupper, s.right2.look, s.right.look, + CtrlsImg::I_LA, CtrlsImg::I_RA, true); + + int d = Diff(fc, SColorPaper()); + Image m = GtkGetLastImage(); + for(int x = 0; x < 4; x++) + for(int y = 0; y < 4; y++) { + RGBA c = m[x][y]; + if(c.a == 255) { + int dd = Diff(c, SColorPaper()); + if(dd > d) { + fc = c; + d = dd; + } + } + } + FieldFrameColor_Write(fc); + + gtk_object_sink(adj); + + adj = gtk_adjustment_new(0, 0, 1000, 1, 1, 500); + + w = gtk_vscrollbar_new(NULL); + Setup(w); + s.overthumb = m != GetGTK(w, 0, 0, "slider", GTK_SLIDER|GTK_VAL1, 16, 32) && !Qt; + gtk_widget_destroy(w); + gtk_object_sink(adj); + + w = gtk_hscale_new_with_range(0.0, 100.0, 1.0); + Setup(w); + int cx = GtkInt(w, "slider-length"); + int cy = 15; + if(engine == "Glider") + cy += cx-3; + if(engine == "Human" || engine == "DarkRoom" || engine == "Crux") + cy = 13; + CtrlImg::Set("hthumb",GetGTK(w, 0, 0, "hscale", GTK_SLIDER, cx, cy)); + CtrlImg::Set("hthumb1",GetGTK(w, 2, 0, "hscale", GTK_SLIDER, cx, cy)); + gtk_widget_destroy(w); + w = gtk_hscale_new_with_range(0.0, 100.0, 1.0); + Setup(w); + CtrlImg::Set("vthumb",GetGTK(w, 0, 0, "vscale", GTK_SLIDER|GTK_VAL1, cy, cx)); + CtrlImg::Set("vthumb1",GetGTK(w, 2, 0, "vscale", GTK_SLIDER|GTK_VAL1, cy, cx)); + gtk_widget_destroy(w); + } + else { int r = Null; for(int i = 0; i < 4; i++) { ImageDraw iw(64, 64); @@ -334,100 +429,6 @@ void ChHostSkin() GtkChSlider(s.hthumb); s.overthumb = false; } - else { - GtkChScrollBar(s.up.look, s.up2.look, s.vlower, s.vthumb, s.vupper, s.down2.look, s.down.look, - CtrlsImg::I_UA, CtrlsImg::I_DA, false); - - if(IsEmptyImage(GetGTK(ChGtkLast(), 2, 2, "vscrollbar", GTK_BOX|GTK_TOP|GTK_RANGEA, 16, 16))) { - static GtkWidget *btn = gtk_button_new(); - ChGtkNew(btn, "button", GTK_BOX); - - GtkChButton(Button::StyleScroll().Write().look); - GtkChButton(Button::StyleEdge().Write().look); - GtkChButton(Button::StyleLeftEdge().Write().look); - - { - DropList::Style& s = DropList::StyleFrame().Write(); - GtkChButtonWith(s.look, CtrlsImg::DA()); - GtkChButtonWith(s.trivial, CtrlsImg::DA()); - } - { - SpinButtons::Style& s = SpinButtons::StyleDefault().Write(); - GtkChButtonWith(s.inc.look, CtrlImg::spinup2()); - GtkChButtonWith(s.dec.look, CtrlImg::spindown2()); - } - } - else { - ChGtkNew("vscrollbar", GTK_BOX|GTK_VCENTER|GTK_RANGEB); - GtkCh(Button::StyleScroll().Write().look, "02142222"); - - int q = !classiq; - - GtkChImgWith(Button::StyleEdge().Write().look, Null, 1 * q); - GtkChImgWith(Button::StyleLeftEdge().Write().look, Null, 2 * q); - - { - DropList::Style& s = DropList::StyleFrame().Write(); - GtkChImgWith(s.look, CtrlsImg::DA(), 1 * q, po); - GtkChImgWith(s.trivial, CtrlsImg::DA(), 1 * q, po); - GtkChImgWith(s.left, CtrlsImg::DA(), 2 * q, po); - GtkChImgWith(s.right, CtrlsImg::DA(), 1 * q, po); - s.pressoffset = po; - } - { - SpinButtons::Style& s = SpinButtons::StyleDefault().Write(); - GtkChImgWith(s.inc.look, q ? CtrlImg::spinup2() : CtrlImg::spinup3(), (1|GTK_BOTTOMLINE) * q, po); - GtkChImgWith(s.dec.look, q ? CtrlImg::spindown2() : CtrlImg::spindown3(), 1 * q, po); - } - } - - static GtkWidget *hscrollbar = gtk_hscrollbar_new(GTK_ADJUSTMENT(adj)); - ChGtkNew(hscrollbar, "slider", GTK_SLIDER); - GtkChScrollBar(s.left.look, s.left2.look, s.hlower, s.hthumb, s.hupper, s.right2.look, s.right.look, - CtrlsImg::I_LA, CtrlsImg::I_RA, true); - - int d = Diff(fc, SColorPaper()); - Image m = GtkGetLastImage(); - for(int x = 0; x < 4; x++) - for(int y = 0; y < 4; y++) { - RGBA c = m[x][y]; - if(c.a == 255) { - int dd = Diff(c, SColorPaper()); - if(dd > d) { - fc = c; - d = dd; - } - } - } - FieldFrameColor_Write(fc); - - gtk_object_sink(adj); - - adj = gtk_adjustment_new(0, 0, 1000, 1, 1, 500); - w = gtk_vscrollbar_new(NULL); - Setup(w); - s.overthumb = m != GetGTK(w, 0, 0, "slider", GTK_SLIDER|GTK_VAL1, 16, 32) && !Qt; - gtk_widget_destroy(w); - gtk_object_sink(adj); - - w = gtk_hscale_new_with_range(0.0, 100.0, 1.0); - Setup(w); - int cx = GtkInt(w, "slider-length"); - int cy = 15; - if(engine == "Glider") - cy += cx-3; - if(engine == "Human" || engine == "DarkRoom" || engine == "Crux") - cy = 13; - CtrlImg::Set("hthumb",GetGTK(w, 0, 0, "hscale", GTK_SLIDER, cx, cy)); - CtrlImg::Set("hthumb1",GetGTK(w, 2, 0, "hscale", GTK_SLIDER, cx, cy)); - gtk_widget_destroy(w); - w = gtk_hscale_new_with_range(0.0, 100.0, 1.0); - Setup(w); - CtrlImg::Set("vthumb",GetGTK(w, 0, 0, "vscale", GTK_SLIDER|GTK_VAL1, cy, cx)); - CtrlImg::Set("vthumb1",GetGTK(w, 2, 0, "vscale", GTK_SLIDER|GTK_VAL1, cy, cx)); - gtk_widget_destroy(w); - } - } if(!Qt) diff --git a/uppsrc/CtrlLib/Ctrl.lay b/uppsrc/CtrlLib/Ctrl.lay index 1fa81f368..705c20223 100644 --- a/uppsrc/CtrlLib/Ctrl.lay +++ b/uppsrc/CtrlLib/Ctrl.lay @@ -1,29 +1,29 @@ -LAYOUT(EditStringLayout, 392, 62) +LAYOUT(EditStringLayout, 396, 68) ITEM(Label, lbl, SetLabel(t_("Test")).LeftPosZ(4, 128).TopPosZ(8, 19)) - ITEM(EditString, text, HSizePosZ(136, 4).TopPosZ(8, 19)) - ITEM(Button, ok, SetLabel(t_("OK")).HCenterPosZ(64, 92).BottomPosZ(6, 20)) - ITEM(Button, cancel, SetLabel(t_("Cancel")).RightPosZ(4, 64).BottomPosZ(6, 20)) + ITEM(EditString, text, HSizePosZ(136, 8).TopPosZ(8, 19)) + ITEM(Button, ok, SetLabel(t_("OK")).HCenterPosZ(64, 90).BottomPosZ(8, 24)) + ITEM(Button, cancel, SetLabel(t_("Cancel")).RightPosZ(8, 64).BottomPosZ(8, 24)) END_LAYOUT LAYOUT(EditIntLayout, 236, 62) ITEM(Label, lbl, SetLabel(t_("Test")).LeftPosZ(4, 68).TopPosZ(4, 19)) ITEM(EditInt, number, HSizePosZ(68, 4).TopPosZ(4, 19)) - ITEM(Button, ok, SetLabel(t_("OK")).HCenterPosZ(80, -10).BottomPosZ(4, 22)) - ITEM(Button, cancel, SetLabel(t_("Cancel")).RightPosZ(4, 80).BottomPosZ(4, 22)) + ITEM(Button, ok, SetLabel(t_("OK")).HCenterPosZ(64, 14).BottomPosZ(6, 24)) + ITEM(Button, cancel, SetLabel(t_("Cancel")).RightPosZ(4, 64).BottomPosZ(6, 24)) END_LAYOUT LAYOUT(EditDoubleLayout, 236, 62) ITEM(Label, lbl, SetLabel(t_("Test")).LeftPosZ(4, 68).TopPosZ(4, 19)) ITEM(EditDouble, number, HSizePosZ(68, 4).TopPosZ(4, 19)) - ITEM(Button, ok, SetLabel(t_("OK")).HCenterPosZ(80, -10).BottomPosZ(4, 22)) - ITEM(Button, cancel, SetLabel(t_("Cancel")).RightPosZ(4, 80).BottomPosZ(4, 22)) + ITEM(Button, ok, SetLabel(t_("OK")).HCenterPosZ(64, 14).BottomPosZ(6, 24)) + ITEM(Button, cancel, SetLabel(t_("Cancel")).RightPosZ(4, 64).BottomPosZ(6, 24)) END_LAYOUT LAYOUT(EditDateLayout, 236, 62) ITEM(Label, lbl, SetLabel(t_("Test")).LeftPosZ(4, 120).TopPosZ(4, 19)) ITEM(DropDate, date, HSizePosZ(128, 8).TopPosZ(4, 19)) - ITEM(Button, ok, SetLabel(t_("OK")).HCenterPosZ(80, -14).BottomPosZ(8, 22)) - ITEM(Button, cancel, SetLabel(t_("Cancel")).RightPosZ(8, 80).BottomPosZ(8, 22)) + ITEM(Button, ok, SetLabel(t_("OK")).HCenterPosZ(64, 10).BottomPosZ(6, 24)) + ITEM(Button, cancel, SetLabel(t_("Cancel")).RightPosZ(8, 64).BottomPosZ(6, 24)) END_LAYOUT LAYOUT(ProgressLayout, 320, 72)