From 6ff11dd8d0c811d1ddb5c9f753ace8f73bbfede1 Mon Sep 17 00:00:00 2001 From: Matthias Melcher Date: Mon, 14 Jan 2019 01:43:17 +0100 Subject: [PATCH] Added Fl_Simple_Terminal to Fluid. --- fluid/Fl_Type.cxx | 9 ++++++--- fluid/alignment_panel.cxx | 9 --------- fluid/alignment_panel.fl | 10 +++------- fluid/alignment_panel.h | 2 +- fluid/factory.cxx | 20 +++++++++++++++++++- fluid/function_panel.cxx | 6 ++++++ fluid/function_panel.fl | 18 ++++++++++++------ fluid/pixmaps/flSimpleTerminal.xpm | 29 +++++++++++++++++++++++++++++ 8 files changed, 76 insertions(+), 27 deletions(-) create mode 100644 fluid/pixmaps/flSimpleTerminal.xpm diff --git a/fluid/Fl_Type.cxx b/fluid/Fl_Type.cxx index 48881836c..7c7e96235 100644 --- a/fluid/Fl_Type.cxx +++ b/fluid/Fl_Type.cxx @@ -98,6 +98,7 @@ static Fl_Pixmap protected_pixmap(protected_xpm); #include "pixmaps/flWidgetClass.xpm" #include "pixmaps/flTree.xpm" #include "pixmaps/flTable.xpm" +#include "pixmaps/flSimpleTerminal.xpm" static Fl_Pixmap window_pixmap(flWindow_xpm); static Fl_Pixmap button_pixmap(flButton_xpm); @@ -149,7 +150,8 @@ static Fl_Pixmap spinner_pixmap(flSpinner_xpm); static Fl_Pixmap widgetclass_pixmap(flWidgetClass_xpm); static Fl_Pixmap data_pixmap(flData_xpm); static Fl_Pixmap tree_pixmap(flTree_xpm); -static Fl_Pixmap table_pixmap(flTable_xpm); +static Fl_Pixmap table_pixmap(flTable_xpm); +static Fl_Pixmap simple_terminal_pixmap(flSimpleTerminal_xpm); Fl_Pixmap *pixmap[] = { 0, &window_pixmap, &button_pixmap, &checkbutton_pixmap, &roundbutton_pixmap, /* 0..4 */ &box_pixmap, &group_pixmap, &function_pixmap, &code_pixmap, &codeblock_pixmap, &declaration_pixmap, /* 5..10 */ @@ -157,10 +159,11 @@ Fl_Pixmap *pixmap[] = { 0, &window_pixmap, &button_pixmap, &checkbutton_pixmap, &menuitem_pixmap, &menubar_pixmap, &submenu_pixmap, &scroll_pixmap, &tile_pixmap, &wizard_pixmap, /* 16..21 */ &pack_pixmap, &returnbutton_pixmap, &lightbutton_pixmap, &repeatbutton_pixmap, &menubutton_pixmap, /* 22..26 */ &output_pixmap, &textdisplay_pixmap, &textedit_pixmap, &fileinput_pixmap, &browser_pixmap, /* 27..32 */ - &checkbrowser_pixmap, &filebrowser_pixmap, &clock_pixmap, &help_pixmap, &progress_pixmap, /* 33..36 */ + &checkbrowser_pixmap, &filebrowser_pixmap, &clock_pixmap, &help_pixmap, &progress_pixmap, /* 33..36 */ &slider_pixmap, &scrollbar_pixmap, &valueslider_pixmap, &adjuster_pixmap, &counter_pixmap, /* 37..41 */ &dial_pixmap, &roller_pixmap, &valueinput_pixmap, &valueoutput_pixmap, &comment_pixmap, /* 42..46 */ - &spinner_pixmap, &widgetclass_pixmap, &data_pixmap, &tree_pixmap, &table_pixmap }; /* 47..51 */ + &spinner_pixmap, &widgetclass_pixmap, &data_pixmap, &tree_pixmap, &table_pixmap, /* 47..51 */ + &simple_terminal_pixmap }; /* 52 */ extern int show_comments; diff --git a/fluid/alignment_panel.cxx b/fluid/alignment_panel.cxx index 3ab1a7fd4..6444ce462 100644 --- a/fluid/alignment_panel.cxx +++ b/fluid/alignment_panel.cxx @@ -410,15 +410,6 @@ Fl_Double_Window* make_shell_window() { } // Fl_Double_Window* shell_window { shell_run_window = new Fl_Double_Window(555, 430, "Shell Command Output"); { shell_run_terminal = new Fl_Simple_Terminal(10, 10, 535, 375); - shell_run_terminal->box(FL_DOWN_BOX); - shell_run_terminal->color(FL_FOREGROUND_COLOR); - shell_run_terminal->selection_color(FL_BACKGROUND_COLOR); - shell_run_terminal->labeltype(FL_NORMAL_LABEL); - shell_run_terminal->labelfont(0); - shell_run_terminal->labelsize(14); - shell_run_terminal->labelcolor(FL_FOREGROUND_COLOR); - shell_run_terminal->align(Fl_Align(FL_ALIGN_CENTER)); - shell_run_terminal->when(FL_WHEN_RELEASE); Fl_Group::current()->resizable(shell_run_terminal); } // Fl_Simple_Terminal* shell_run_terminal { shell_run_button = new Fl_Return_Button(468, 395, 77, 25, "Close"); diff --git a/fluid/alignment_panel.fl b/fluid/alignment_panel.fl index 7a3892777..e2445970a 100644 --- a/fluid/alignment_panel.fl +++ b/fluid/alignment_panel.fl @@ -28,9 +28,6 @@ decl {\#include } {public local decl {\#include } {public local } -decl {\#include } {public local -} - decl {\#include } {public local } @@ -350,12 +347,11 @@ Function {make_shell_window()} {open } } Fl_Window shell_run_window { - label {Shell Command Output} open selected + label {Shell Command Output} open xywh {454 363 555 430} type Double resizable visible } { - Fl_Box shell_run_terminal { - xywh {10 10 535 375} box DOWN_BOX color 0 resizable - class Fl_Simple_Terminal + Fl_Simple_Terminal shell_run_terminal { + xywh {10 10 535 375} resizable } Fl_Return_Button shell_run_button { label Close diff --git a/fluid/alignment_panel.h b/fluid/alignment_panel.h index d38bb86ca..1e02a5c37 100644 --- a/fluid/alignment_panel.h +++ b/fluid/alignment_panel.h @@ -23,7 +23,6 @@ #include #include #include -#include #include extern void load_history(); extern void redraw_browser(); @@ -87,6 +86,7 @@ extern Fl_Check_Button *shell_savefl_button; #include extern void do_shell_command(Fl_Return_Button*, void*); extern Fl_Double_Window *shell_run_window; +#include extern Fl_Simple_Terminal *shell_run_terminal; extern Fl_Return_Button *shell_run_button; Fl_Double_Window* make_shell_window(); diff --git a/fluid/factory.cxx b/fluid/factory.cxx index 92395ac20..4008536df 100644 --- a/fluid/factory.cxx +++ b/fluid/factory.cxx @@ -577,7 +577,7 @@ public: int ww = (int)fl_width('m'); w = ((w + ww - 1) / ww) * ww + Fl::box_dw(o->box()); h = ((h + fl_height() - 1) / fl_height()) * fl_height() + - Fl::box_dh(o->box()); + Fl::box_dh(o->box()); if (h < 30) h = 30; if (w < 50) w = 50; } @@ -607,6 +607,23 @@ int Fl_Text_Editor_Type::textstuff(int w, Fl_Font& f, int& s, Fl_Color& c) { //////////////////////////////////////////////////////////////// +#include +class Fl_Simple_Terminal_Type : public Fl_Text_Editor_Type { +public: + virtual const char *type_name() {return "Fl_Simple_Terminal";} + virtual const char *alt_type_name() {return "fltk::SimpleTerminal";} + int is_text_display() const {return 1;} + Fl_Widget *widget(int x,int y,int w,int h) { + Fl_Simple_Terminal *myo = new Fl_Simple_Terminal(x,y,w,h); + return myo; + } + Fl_Widget_Type *_make() {return new Fl_Simple_Terminal_Type();} + int pixmapID() { return 52; } +}; +static Fl_Simple_Terminal_Type Fl_Simple_Terminal_type; + +//////////////////////////////////////////////////////////////// + #include class Fl_Clock_Type : public Fl_Widget_Type { public: @@ -1023,6 +1040,7 @@ Fl_Menu_Item New_Menu[] = { {0,0,cb,(void*)&Fl_Output_type}, {0,0,cb,(void*)&Fl_Text_Display_type}, {0,0,cb,(void*)&Fl_Text_Editor_type}, + {0,0,cb,(void*)&Fl_Simple_Terminal_type}, {0}, {"Menus",0,0,0,FL_SUBMENU}, {0,0,cb,(void*)&Fl_Menu_Bar_type}, diff --git a/fluid/function_panel.cxx b/fluid/function_panel.cxx index 8aabc129a..273e42f0b 100644 --- a/fluid/function_panel.cxx +++ b/fluid/function_panel.cxx @@ -974,6 +974,12 @@ Fl_Window* make_widgetbin() { o->callback((Fl_Callback*)type_make_cb, (void*)("Fl_File_Input")); o->image(pixmap[30]); } // Fl_Button* o + { Fl_Button* o = new Fl_Button(366, 55, 24, 24); + o->tooltip("File Input"); + o->box(FL_THIN_UP_BOX); + o->callback((Fl_Callback*)type_make_cb, (void*)("Fl_Simple_Terminal")); + o->image(pixmap[52]); + } // Fl_Button* o o->end(); } // Fl_Group* o { Fl_Group* o = new Fl_Group(398, 3, 54, 79); diff --git a/fluid/function_panel.fl b/fluid/function_panel.fl index fed57dcd1..945295ad0 100644 --- a/fluid/function_panel.fl +++ b/fluid/function_panel.fl @@ -257,8 +257,7 @@ Function {make_declblock_panel()} {} { } } -Function {make_decl_panel()} {selected -} { +Function {make_decl_panel()} {} { Fl_Window decl_panel { label {Declaration Properties} open xywh {480 333 343 237} type Double align 80 hide resizable size_range {343 237 0 0} @@ -536,16 +535,17 @@ Function {type_make_cb(Fl_Widget*,void*d)} {return_type void }} {} } -Function {make_widgetbin()} {} { +Function {make_widgetbin()} {open +} { Fl_Window widgetbin_panel { label {Widget Bin} callback {if (Fl::event()==FL_SHORTCUT && Fl::event_key()==FL_Escape) exit_cb((Fl_Widget*)o, v); else toggle_widgetbin_cb((Fl_Widget*)o, v);} open - xywh {410 171 574 85} type Single align 80 hide non_modal + xywh {410 171 574 85} type Single align 80 non_modal visible } { - Fl_Group {} {open + Fl_Group {} { xywh {3 3 79 79} } { Fl_Button {} { @@ -759,7 +759,7 @@ else code0 {o->image(pixmap[44]);} } } - Fl_Group {} { + Fl_Group {} {open xywh {339 3 54 79} } { Fl_Button {} { @@ -792,6 +792,12 @@ else tooltip {File Input} xywh {341 55 24 24} box THIN_UP_BOX code0 {o->image(pixmap[30]);} } + Fl_Button {} { + user_data {"Fl_Simple_Terminal"} + callback type_make_cb selected + tooltip {File Input} xywh {366 55 24 24} box THIN_UP_BOX + code0 {o->image(pixmap[52]);} + } } Fl_Group {} { xywh {398 3 54 79} diff --git a/fluid/pixmaps/flSimpleTerminal.xpm b/fluid/pixmaps/flSimpleTerminal.xpm new file mode 100644 index 000000000..e7c91bc27 --- /dev/null +++ b/fluid/pixmaps/flSimpleTerminal.xpm @@ -0,0 +1,29 @@ +/* XPM */ +static const char *flSimpleTerminal_xpm[] = { +/* width height ncolors chars_per_pixel */ +"16 16 6 1", +/* colors */ +"f c #606060", +". c #000000", +"c c none", +"d c #ffffff", +"e c #8080ff", +"a c #d0d0d0", +/* pixels */ +"cccccccccccccccc", +"ffffffffffffffff", +"fdddddddddddddda", +"fdddddddddddddda", +"fd.dddddddddddda", +"fdd.ddddddddddda", +"fddd.dddddddddda", +"fdd.ddddddddddda", +"fd.ddd....ddddda", +"fdddddddddddddda", +"fdddddddddddddda", +"fdddddddddddddda", +"fdddddddddddddda", +"fdddddddddddddda", +"aaaaaaaaaaaaaaaa", +"cccccccccccccccc" +};