summaryrefslogtreecommitdiff
path: root/fluid
diff options
context:
space:
mode:
authorMatthias Melcher <git@matthiasm.com>2019-01-14 00:09:31 +0100
committerMatthias Melcher <git@matthiasm.com>2019-01-14 00:09:31 +0100
commitb71601fe7c959eb4a68967b1ff2bcf52c67b4d77 (patch)
tree92ab7767b5a7cafc4b6558d086176d86d4bbf7b1 /fluid
parent3d6b234c274d1376a95d462f13dea69bd117953c (diff)
STR 3460: shell window remembers position
The Fluid window to display the execute shell command result is now reopened where it was previously closed.
Diffstat (limited to 'fluid')
-rw-r--r--fluid/alignment_panel.cxx29
-rw-r--r--fluid/alignment_panel.fl33
-rw-r--r--fluid/alignment_panel.h5
-rw-r--r--fluid/fluid.cxx24
4 files changed, 55 insertions, 36 deletions
diff --git a/fluid/alignment_panel.cxx b/fluid/alignment_panel.cxx
index 26412d717..3ab1a7fd4 100644
--- a/fluid/alignment_panel.cxx
+++ b/fluid/alignment_panel.cxx
@@ -22,7 +22,6 @@
#include <FL/Fl_Preferences.H>
#include <FL/fl_ask.H>
#include <string.h>
-Fl_Text_Buffer *shell_run_buffer;
Fl_Double_Window *project_window=(Fl_Double_Window *)0;
@@ -357,12 +356,17 @@ static void cb_Cancel(Fl_Button*, void*) {
Fl_Double_Window *shell_run_window=(Fl_Double_Window *)0;
-Fl_Text_Display *shell_run_display=(Fl_Text_Display *)0;
+Fl_Simple_Terminal *shell_run_terminal=(Fl_Simple_Terminal *)0;
Fl_Return_Button *shell_run_button=(Fl_Return_Button *)0;
static void cb_shell_run_button(Fl_Return_Button*, void*) {
- shell_run_window->hide();
+ Fl_Preferences pos(fluid_prefs, "shell_run_Window_pos");
+pos.set("x", shell_run_window->x());
+pos.set("y", shell_run_window->y());
+pos.set("w", shell_run_window->w());
+pos.set("h", shell_run_window->h());
+shell_run_window->hide();
}
Fl_Double_Window* make_shell_window() {
@@ -405,13 +409,18 @@ Fl_Double_Window* make_shell_window() {
shell_window->end();
} // Fl_Double_Window* shell_window
{ shell_run_window = new Fl_Double_Window(555, 430, "Shell Command Output");
- { shell_run_display = new Fl_Text_Display(10, 10, 535, 375);
- shell_run_display->box(FL_DOWN_BOX);
- shell_run_display->textfont(4);
- Fl_Group::current()->resizable(shell_run_display);
- shell_run_buffer = new Fl_Text_Buffer();
- shell_run_display->buffer(shell_run_buffer);
- } // Fl_Text_Display* shell_run_display
+ { 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");
shell_run_button->callback((Fl_Callback*)cb_shell_run_button);
} // Fl_Return_Button* shell_run_button
diff --git a/fluid/alignment_panel.fl b/fluid/alignment_panel.fl
index e21b8c351..7a3892777 100644
--- a/fluid/alignment_panel.fl
+++ b/fluid/alignment_panel.fl
@@ -28,6 +28,9 @@ decl {\#include <FL/Fl_Text_Buffer.H>} {public local
decl {\#include <FL/Fl_Text_Display.H>} {public local
}
+decl {\#include <FL/Fl_Simple_Terminal.H>} {public local
+}
+
decl {\#include <FL/filename.H>} {public local
}
@@ -37,7 +40,7 @@ decl {\#include <FL/Fl_Preferences.H>} {private global
decl {\#include <FL/fl_ask.H>} {private global
}
-decl {\#include <string.h>} {selected private global
+decl {\#include <string.h>} {private global
}
decl {extern void load_history();} {public local
@@ -64,9 +67,6 @@ decl {extern struct Fl_Menu_Item *dbmanager_item;} {public local
decl {extern Fl_Preferences fluid_prefs;} {public local
}
-decl {Fl_Text_Buffer *shell_run_buffer;} {public local
-}
-
Function {make_project_window()} {open
} {
Fl_Window project_window {
@@ -138,7 +138,7 @@ Function {make_project_window()} {open
}
Fl_Input i18n_include_input {
label {\#include:}
- callback i18n_text_cb selected
+ callback i18n_text_cb
tooltip {The include file for internationalization.} xywh {100 78 272 20} box THIN_DOWN_BOX labelfont 1 textfont 4
}
Fl_Input i18n_file_input {
@@ -281,7 +281,7 @@ redraw_browser();}
callback {strncpy(G_external_editor_command, editor_command_input->value(), sizeof(G_external_editor_command)-1);
G_external_editor_command[sizeof(G_external_editor_command)-1] = 0;
fluid_prefs.set("external_editor_command", G_external_editor_command);
-redraw_browser();} selected
+redraw_browser();}
tooltip {The editor command to open your external text editor.
Include any necessary flags to ensure your editor does not background itself.
Examples:
@@ -300,7 +300,8 @@ Examples:
}
}
-Function {make_shell_window()} {} {
+Function {make_shell_window()} {open
+} {
Fl_Window shell_window {
label {Shell Command} open
xywh {761 190 365 125} type Double hide
@@ -349,17 +350,21 @@ Function {make_shell_window()} {} {
}
}
Fl_Window shell_run_window {
- label {Shell Command Output}
- xywh {592 332 555 430} type Double hide resizable
+ label {Shell Command Output} open selected
+ xywh {454 363 555 430} type Double resizable visible
} {
- Fl_Text_Display shell_run_display {
- xywh {10 10 535 375} box DOWN_BOX textfont 4 resizable
- code0 {shell_run_buffer = new Fl_Text_Buffer();}
- code1 {shell_run_display->buffer(shell_run_buffer);}
+ Fl_Box shell_run_terminal {
+ xywh {10 10 535 375} box DOWN_BOX color 0 resizable
+ class Fl_Simple_Terminal
}
Fl_Return_Button shell_run_button {
label Close
- callback {shell_run_window->hide();}
+ callback {Fl_Preferences pos(fluid_prefs, "shell_run_Window_pos");
+pos.set("x", shell_run_window->x());
+pos.set("y", shell_run_window->y());
+pos.set("w", shell_run_window->w());
+pos.set("h", shell_run_window->h());
+shell_run_window->hide();}
xywh {468 395 77 25}
}
}
diff --git a/fluid/alignment_panel.h b/fluid/alignment_panel.h
index c00a8d7a4..d38bb86ca 100644
--- a/fluid/alignment_panel.h
+++ b/fluid/alignment_panel.h
@@ -23,6 +23,7 @@
#include <FL/Fl.H>
#include <FL/Fl_Text_Buffer.H>
#include <FL/Fl_Text_Display.H>
+#include <FL/Fl_Simple_Terminal.H>
#include <FL/filename.H>
extern void load_history();
extern void redraw_browser();
@@ -32,7 +33,6 @@ extern char G_external_editor_command[512];
extern int show_coredevmenus;
extern struct Fl_Menu_Item *dbmanager_item;
extern Fl_Preferences fluid_prefs;
-extern Fl_Text_Buffer *shell_run_buffer;
#include <FL/Fl_Double_Window.H>
#include <FL/Fl_Preferences.H>
#include <FL/Fl_Tooltip.H>
@@ -87,8 +87,7 @@ extern Fl_Check_Button *shell_savefl_button;
#include <FL/Fl_Return_Button.H>
extern void do_shell_command(Fl_Return_Button*, void*);
extern Fl_Double_Window *shell_run_window;
-#include <FL/Fl_Text_Display.H>
-extern Fl_Text_Display *shell_run_display;
+extern Fl_Simple_Terminal *shell_run_terminal;
extern Fl_Return_Button *shell_run_button;
Fl_Double_Window* make_shell_window();
extern Fl_Double_Window *grid_window;
diff --git a/fluid/fluid.cxx b/fluid/fluid.cxx
index 5b1cb0c35..cb2a849da 100644
--- a/fluid/fluid.cxx
+++ b/fluid/fluid.cxx
@@ -1483,16 +1483,13 @@ shell_pipe_cb(FL_SOCKET, void*) {
if (s_proc.get_line(line, sizeof(line)) != NULL) {
// Add the line to the output list...
- shell_run_buffer->append(line);
+ shell_run_terminal->append(line);
} else {
// End of file; tell the parent...
Fl::remove_fd(fileno(s_proc.desc()));
s_proc.close();
- shell_run_buffer->append("... END SHELL COMMAND ...\n");
+ shell_run_terminal->append("... END SHELL COMMAND ...\n");
}
-
- shell_run_display->scroll(shell_run_display->count_lines(0,
- shell_run_buffer->length(), 1), 0);
}
void
@@ -1502,9 +1499,9 @@ do_shell_command(Fl_Return_Button*, void*) {
if (!prepare_shell_command(command)) return;
// Show the output window and clear things...
- shell_run_buffer->text("");
- shell_run_buffer->append(command);
- shell_run_buffer->append("\n");
+ shell_run_terminal->text("");
+ shell_run_terminal->append(command);
+ shell_run_terminal->append("\n");
shell_run_window->label("Shell Command Running...");
if (s_proc.popen((char *)command) == NULL) {
@@ -1513,7 +1510,16 @@ do_shell_command(Fl_Return_Button*, void*) {
}
shell_run_button->deactivate();
- shell_run_window->hotspot(shell_run_display);
+
+ Fl_Preferences pos(fluid_prefs, "shell_run_Window_pos");
+ int x, y, w, h;
+ pos.get("x", x, -1);
+ pos.get("y", y, 0);
+ pos.get("w", w, 640);
+ pos.get("h", h, 480);
+ if (x!=-1) {
+ shell_run_window->resize(x, y, w, h);
+ }
shell_run_window->show();
Fl::add_fd(fileno(s_proc.desc()), shell_pipe_cb);