FLUID: Replaces Fl_Simple_Terminal with Fl_Terminal

This commit is contained in:
Matthias Melcher 2023-11-15 13:02:48 +01:00
parent dd1c2fc843
commit dd8ac4d557
10 changed files with 39 additions and 67 deletions

View File

@ -59,7 +59,6 @@
| +-- Fl_Output_Type
+-+ Fl_Text_Display_Type
| +-- Fl_Text_Editor+Type
| +-- Fl_Simple_Terminal_Type
+-- Fl_Box_Type
+-- Fl_Clock_Type
+-- Fl_Progress_Type
@ -71,6 +70,7 @@
| +-- Fl_Table_Type
| +-- Fl_Tabs_Type
| +-- Fl_Scroll_Type
| +-- Fl_Terminal_Type
| +-- Fl_Tile_Type
| +-- Fl_Wizard_Type
| +-+ Fl_Window_Type

View File

@ -54,7 +54,7 @@ enum ID {
ID_Dial, ID_Roller, ID_Value_Input, ID_Value_Output,
// text
ID_Input, ID_Output, ID_Text_Editor,
ID_Text_Display, ID_File_Input, ID_Simple_Terminal,
ID_Text_Display, ID_File_Input, ID_Terminal,
// menus
ID_Menu_Bar, ID_Menu_Button, ID_Choice,
ID_Input_Choice, ID_Submenu, ID_Menu_Item,

View File

@ -84,9 +84,9 @@ Fl_Widget_Type::ideal_size(int &w, int &h) {
Fl_Type *Fl_Widget_Type::make(Strategy strategy) {
// Find the current widget, or widget to copy:
Fl_Type *qq = Fl_Type::current;
while (qq && !qq->is_true_widget()) qq = qq->parent;
while (qq && (!qq->is_true_widget() || !qq->is_parent())) qq = qq->parent;
if (!qq) {
fl_message("Please select a widget");
fl_message("Please select a group widget or window");
return 0;
}
Fl_Widget_Type* q = (Fl_Widget_Type*)qq;

View File

@ -3029,10 +3029,10 @@ le FLTK_GETTEXT_FOUND");
Fl_Double_Window *shell_run_window=(Fl_Double_Window *)0;
Fl_Simple_Terminal *shell_run_terminal=(Fl_Simple_Terminal *)0;
Fl_Terminal *shell_run_terminal=(Fl_Terminal *)0;
static void cb_Clear(Fl_Button*, void*) {
shell_run_terminal->clear();
shell_run_terminal->append("\e[2J\e[H");
}
Fl_Return_Button *shell_run_button=(Fl_Return_Button *)0;
@ -3049,10 +3049,11 @@ static void cb_shell_run_button(Fl_Return_Button*, void*) {
Fl_Double_Window* make_shell_window() {
{ shell_run_window = new Fl_Double_Window(555, 430, "Shell Command Output");
shell_run_window->align(Fl_Align(FL_ALIGN_CLIP|FL_ALIGN_INSIDE));
{ shell_run_terminal = new Fl_Simple_Terminal(10, 10, 535, 375);
Fl_Group::current()->resizable(shell_run_terminal);
{ shell_run_terminal = new Fl_Terminal(10, 10, 535, 375);
shell_run_terminal->ansi(1);
} // Fl_Simple_Terminal* shell_run_terminal
shell_run_terminal->end();
Fl_Group::current()->resizable(shell_run_terminal);
} // Fl_Terminal* shell_run_terminal
{ Fl_Group* o = new Fl_Group(10, 395, 535, 25);
{ Fl_Button* o = new Fl_Button(10, 395, 94, 25, "Clear");
o->callback((Fl_Callback*)cb_Clear);

View File

@ -1565,36 +1565,6 @@ settings_window->hide();}
}
}
}
Fl_Window {} {open
xywh {646 417 480 320} type Double visible
} {
Fl_Grid {} {open
xywh {25 25 240 160}
dimensions {3 3}
} {
Fl_Button {} {
label Button
xywh {25 25 80 66}
parent_properties {
location {0 0}
}
}
Fl_Light_Button {} {
label Button
xywh {105 25 80 66}
parent_properties {
location {0 1}
}
}
Fl_Button {} {
label Button selected
xywh {185 25 80 66}
parent_properties {
location {0 2}
}
}
}
}
code {w_settings_tabs->do_callback(w_settings_tabs, LOAD);} {}
}
@ -1604,16 +1574,16 @@ Function {make_shell_window()} {open
label {Shell Command Output} open
xywh {769 585 555 430} type Double align 80 resizable visible
} {
Fl_Simple_Terminal shell_run_terminal {
Fl_Terminal shell_run_terminal {
xywh {10 10 535 375} resizable
code0 {shell_run_terminal->ansi(1);}
}
} {}
Fl_Group {} {open
xywh {10 395 535 25}
} {
Fl_Button {} {
label Clear
callback {shell_run_terminal->clear();}
callback {shell_run_terminal->append("\\e[2J\\e[H");} selected
xywh {10 395 94 25}
}
Fl_Box {} {

View File

@ -130,8 +130,8 @@ extern Fl_Menu_Item menu_Condition[];
extern Fl_Menu_Item menu_w_settings_shell_text_macros[];
extern Fl_Menu_Item menu_i18n_type_chooser[];
extern Fl_Double_Window *shell_run_window;
#include <FL/Fl_Simple_Terminal.H>
extern Fl_Simple_Terminal *shell_run_terminal;
#include <FL/Fl_Terminal.H>
extern Fl_Terminal *shell_run_terminal;
extern Fl_Return_Button *shell_run_button;
Fl_Double_Window* make_shell_window();
#endif

View File

@ -49,7 +49,7 @@
#include <FL/Fl_Progress.H>
#include <FL/Fl_Roller.H>
#include <FL/Fl_Scrollbar.H>
#include <FL/Fl_Simple_Terminal.H>
#include <FL/Fl_Terminal.H>
#include <FL/Fl_Spinner.H>
#include <FL/Fl_Text_Display.H>
#include <FL/Fl_Text_Editor.H>
@ -848,32 +848,33 @@ static Fl_Text_Editor_Type Fl_Text_Editor_type;
/**
\brief Manage a simple terminal widget.
*/
class Fl_Simple_Terminal_Type : public Fl_Text_Display_Type
class Fl_Terminal_Type : public Fl_Group_Type
{
typedef Fl_Text_Display_Type super;
typedef Fl_Group_Type super;
public:
const char *type_name() FL_OVERRIDE { return "Fl_Simple_Terminal"; }
const char *alt_type_name() FL_OVERRIDE { return "fltk::SimpleTerminal"; }
const char *type_name() FL_OVERRIDE { return "Fl_Terminal"; }
const char *alt_type_name() FL_OVERRIDE { return "Fl_Simple_Terminal"; }
Fl_Widget *widget(int x, int y, int w, int h) FL_OVERRIDE {
Fl_Widget *myo = 0L;
if (batch_mode) {
// The Fl_Simple_Terminal constructor attaches a buffer which in turn
// The Fl_Terminal constructor attaches a buffer which in turn
// opens a connection to the display. In batch mode, we create the
// superclass Fl_Text_Display to avoid that.
myo = new Fl_Text_Display(x,y,w,h);
} else {
Fl_Simple_Terminal *term = new Fl_Simple_Terminal(x, y, w, h);
term->text("> ls -als");
Fl_Terminal *term = new Fl_Terminal(x, y, w, h);
term->append("> ls -als");
myo = term;
}
return myo;
}
Fl_Widget_Type *_make() FL_OVERRIDE {return new Fl_Simple_Terminal_Type();}
ID id() const FL_OVERRIDE { return ID_Simple_Terminal; }
bool is_a(ID inID) const FL_OVERRIDE { return (inID==ID_Simple_Terminal) ? true : super::is_a(inID); }
Fl_Widget_Type *_make() FL_OVERRIDE {return new Fl_Terminal_Type();}
int is_parent() const FL_OVERRIDE { return 0; }
ID id() const FL_OVERRIDE { return ID_Terminal; }
bool is_a(ID inID) const FL_OVERRIDE { return (inID==ID_Terminal) ? true : super::is_a(inID); }
};
static Fl_Simple_Terminal_Type Fl_Simple_Terminal_type;
static Fl_Terminal_Type Fl_Terminal_type;
// ---- Other ---------------------------------------------------------- MARK: -
@ -1102,7 +1103,7 @@ static Fl_Type *known_types[] = {
(Fl_Type*)&Fl_Text_Editor_type,
(Fl_Type*)&Fl_Text_Display_type,
(Fl_Type*)&Fl_File_Input_type,
(Fl_Type*)&Fl_Simple_Terminal_type,
(Fl_Type*)&Fl_Terminal_type,
// menus
(Fl_Type*)&Fl_Menu_Bar_type,
(Fl_Type*)&Fl_Menu_Button_type,
@ -1352,7 +1353,7 @@ Fl_Menu_Item New_Menu[] = {
{0,0,cb,(void*)&Fl_Text_Editor_type},
{0,0,cb,(void*)&Fl_Text_Display_type},
{0,0,cb,(void*)&Fl_File_Input_type},
{0,0,cb,(void*)&Fl_Simple_Terminal_type},
{0,0,cb,(void*)&Fl_Terminal_type},
{0},
{"Menus",0,0,0,FL_SUBMENU},
{0,0,cb,(void*)&Fl_Menu_Bar_type},

View File

@ -1222,7 +1222,7 @@ Fl_Window* make_widgetbin() {
o->image(pixmap[ID_File_Input]);
} // Widget_Bin_Button* o
{ Widget_Bin_Button* o = new Widget_Bin_Button(366, 71, 24, 24);
o->tooltip("Simple Terminal");
o->tooltip("Terminal");
o->box(FL_THIN_UP_BOX);
o->color(FL_BACKGROUND_COLOR);
o->selection_color(FL_BACKGROUND_COLOR);
@ -1230,10 +1230,10 @@ Fl_Window* make_widgetbin() {
o->labelfont(0);
o->labelsize(14);
o->labelcolor(FL_FOREGROUND_COLOR);
o->callback((Fl_Callback*)type_make_cb, (void*)("Fl_Simple_Terminal"));
o->callback((Fl_Callback*)type_make_cb, (void*)("Fl_Terminal"));
o->align(Fl_Align(FL_ALIGN_CENTER));
o->when(FL_WHEN_RELEASE);
o->image(pixmap[ID_Simple_Terminal]);
o->image(pixmap[ID_Terminal]);
} // Widget_Bin_Button* o
o->end();
} // Fl_Group* o

View File

@ -670,7 +670,7 @@ else
}
Fl_Button {} {
user_data {"Fl_Grid"}
callback type_make_cb selected
callback type_make_cb
tooltip Grid xywh {139 71 24 24} box THIN_UP_BOX
code0 {o->image(pixmap[ID_Grid]);}
class Widget_Bin_Button
@ -838,10 +838,10 @@ else
class Widget_Bin_Button
}
Fl_Button {} {
user_data {"Fl_Simple_Terminal"}
callback type_make_cb
tooltip {Simple Terminal} xywh {366 71 24 24} box THIN_UP_BOX
code0 {o->image(pixmap[ID_Simple_Terminal]);}
user_data {"Fl_Terminal"}
callback type_make_cb selected
tooltip Terminal xywh {366 71 24 24} box THIN_UP_BOX
code0 {o->image(pixmap[ID_Terminal]);}
class Widget_Bin_Button
}
}

View File

@ -213,7 +213,7 @@ void loadPixmaps()
pixmap[ID_Tree] = tmp = new Fl_Pixmap(flTree_xpm); tmp->scale(16, 16);
pixmap[ID_Table] = tmp = new Fl_Pixmap(flTable_xpm); tmp->scale(16, 16);
pixmap[ID_Simple_Terminal] = tmp = new Fl_Pixmap(flSimpleTerminal_xpm); tmp->scale(16, 16);
pixmap[ID_Terminal] = tmp = new Fl_Pixmap(flSimpleTerminal_xpm); tmp->scale(16, 16);
pixmap[ID_Input_Choice] = tmp = new Fl_Pixmap(flInputChoice_xpm); tmp->scale(16, 16);
pixmap[ID_Checkbox_Menu_Item] = tmp = new Fl_Pixmap(flCheckMenuitem_xpm); tmp->scale(16, 16);
pixmap[ID_Radio_Menu_Item] = tmp = new Fl_Pixmap(flRadioMenuitem_xpm); tmp->scale(16, 16);