FLUID shell command patch from Erco.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@2963 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Michael R Sweet
2003-04-01 19:58:08 +00:00
parent 3fd86acaec
commit cd339710f0
5 changed files with 50 additions and 27 deletions
+3
View File
@@ -1,5 +1,8 @@
CHANGES IN FLTK 1.1.4 CHANGES IN FLTK 1.1.4
- FLUID now uses an Fl_Text_Display widget for command
output, which allows you to copy and paste text from
command output into other windows.
- Fl_Gl_Window could cause a bus error on MacOS X if the - Fl_Gl_Window could cause a bus error on MacOS X if the
parent window was not yet shown. parent window was not yet shown.
- FLUID could crash after displaying a syntax error - FLUID could crash after displaying a syntax error
+11 -8
View File
@@ -1,4 +1,4 @@
// generated by Fast Light User Interface Designer (fluid) version 1.0102 // generated by Fast Light User Interface Designer (fluid) version 1.0104
#include "alignment_panel.h" #include "alignment_panel.h"
@@ -110,6 +110,7 @@ Fl_Window* make_project_window() {
} }
return w; return w;
} }
Fl_Text_Buffer *shell_run_buffer;
Fl_Window *settings_window=(Fl_Window *)0; Fl_Window *settings_window=(Fl_Window *)0;
@@ -144,7 +145,7 @@ static void cb_prevpos_button(Fl_Check_Button*, void*) {
Fl_Window* make_settings_window() { Fl_Window* make_settings_window() {
Fl_Window* w; Fl_Window* w;
{ Fl_Window* o = settings_window = new Fl_Window(255, 213, "GUI Settings"); { Fl_Window* o = settings_window = new Fl_Window(255, 210, "GUI Settings");
w = o; w = o;
{ Fl_Button* o = new Fl_Button(185, 179, 60, 25, "Close"); { Fl_Button* o = new Fl_Button(185, 179, 60, 25, "Close");
o->tooltip("Close this dialog."); o->tooltip("Close this dialog.");
@@ -223,14 +224,14 @@ static void cb_Cancel(Fl_Button*, void*) {
Fl_Window *shell_run_window=(Fl_Window *)0; Fl_Window *shell_run_window=(Fl_Window *)0;
Fl_Browser *shell_run_list=(Fl_Browser *)0;
Fl_Return_Button *shell_run_button=(Fl_Return_Button *)0; Fl_Return_Button *shell_run_button=(Fl_Return_Button *)0;
static void cb_shell_run_button(Fl_Return_Button*, void*) { static void cb_shell_run_button(Fl_Return_Button*, void*) {
shell_run_window->hide(); shell_run_window->hide();
} }
Fl_Text_Display *shell_run_display=(Fl_Text_Display *)0;
Fl_Window* make_shell_window() { Fl_Window* make_shell_window() {
Fl_Window* w; Fl_Window* w;
{ Fl_Window* o = shell_window = new Fl_Window(450, 145, "Shell Command"); { Fl_Window* o = shell_window = new Fl_Window(450, 145, "Shell Command");
@@ -279,13 +280,15 @@ Fl_Window* make_shell_window() {
} }
{ Fl_Window* o = shell_run_window = new Fl_Window(555, 435, "Shell Command Output"); { Fl_Window* o = shell_run_window = new Fl_Window(555, 435, "Shell Command Output");
w = o; w = o;
{ Fl_Browser* o = shell_run_list = new Fl_Browser(10, 10, 535, 380); { Fl_Return_Button* o = shell_run_button = new Fl_Return_Button(465, 400, 80, 25, "Close");
o->callback((Fl_Callback*)cb_shell_run_button);
}
{ Fl_Text_Display* o = shell_run_display = new Fl_Text_Display(10, 10, 530, 380);
o->textfont(4); o->textfont(4);
o->textsize(12); o->textsize(12);
Fl_Group::current()->resizable(o); Fl_Group::current()->resizable(o);
} shell_run_buffer = new Fl_Text_Buffer();
{ Fl_Return_Button* o = shell_run_button = new Fl_Return_Button(465, 400, 80, 25, "Close"); shell_run_display->buffer(shell_run_buffer);
o->callback((Fl_Callback*)cb_shell_run_button);
} }
o->end(); o->end();
} }
+19 -8
View File
@@ -1,7 +1,13 @@
# data file for the Fltk User Interface Designer (fluid) # data file for the Fltk User Interface Designer (fluid)
version 1.0102 version 1.0103
header_name {.h} header_name {.h}
code_name {.cxx} code_name {.cxx}
decl {\#include <FL/Fl_Text_Buffer.H>} {public
}
decl {\#include <FL/Fl_Text_Display.H>} {public
}
Function {make_project_window()} {open Function {make_project_window()} {open
} { } {
Fl_Window project_window { Fl_Window project_window {
@@ -97,15 +103,18 @@ decl {extern void i18n_cb(Fl_Choice *,void *);} {public
decl {extern Fl_Preferences fluid_prefs;} {public decl {extern Fl_Preferences fluid_prefs;} {public
} }
decl {Fl_Text_Buffer *shell_run_buffer;} {selected public
}
Function {make_settings_window()} {open Function {make_settings_window()} {open
} { } {
Fl_Window settings_window { Fl_Window settings_window {
label {GUI Settings} open label {GUI Settings} open
xywh {340 243 255 213} visible xywh {340 243 255 210} visible
} { } {
Fl_Button {} { Fl_Button {} {
label Close label Close
callback {settings_window->hide();} selected callback {settings_window->hide();}
tooltip {Close this dialog.} xywh {185 179 60 25} tooltip {Close this dialog.} xywh {185 179 60 25}
} }
Fl_Tabs {} { Fl_Tabs {} {
@@ -213,16 +222,18 @@ Function {make_shell_window()} {open
} }
Fl_Window shell_run_window { Fl_Window shell_run_window {
label {Shell Command Output} open label {Shell Command Output} open
xywh {693 386 555 435} hide resizable xywh {693 386 555 435} resizable visible
} { } {
Fl_Browser shell_run_list {
xywh {10 10 535 380} textfont 4 textsize 12 resizable
}
Fl_Return_Button shell_run_button { Fl_Return_Button shell_run_button {
label Close label Close
callback {shell_run_window->hide();} callback {shell_run_window->hide();}
xywh {465 400 80 25} xywh {465 400 80 25}
} }
Fl_Text_Display shell_run_display {
xywh {10 10 530 380} textfont 4 textsize 12 resizable
code0 {shell_run_buffer = new Fl_Text_Buffer();}
code1 {shell_run_display->buffer(shell_run_buffer);}
}
} }
} }
@@ -230,7 +241,7 @@ Function {make_grid_window()} {open
} { } {
Fl_Window grid_window { Fl_Window grid_window {
label Grid open label Grid open
xywh {1128 236 155 175} visible xywh {1120 236 155 175} visible
} { } {
Fl_Tabs {} { Fl_Tabs {} {
xywh {10 10 135 120} align 5 xywh {10 10 135 120} align 5
+6 -3
View File
@@ -1,8 +1,10 @@
// generated by Fast Light User Interface Designer (fluid) version 1.0102 // generated by Fast Light User Interface Designer (fluid) version 1.0104
#ifndef alignment_panel_h #ifndef alignment_panel_h
#define alignment_panel_h #define alignment_panel_h
#include <FL/Fl.H> #include <FL/Fl.H>
#include <FL/Fl_Text_Buffer.H>
#include <FL/Fl_Text_Display.H>
#include <FL/Fl_Window.H> #include <FL/Fl_Window.H>
#include <FL/Fl_Preferences.H> #include <FL/Fl_Preferences.H>
#include <FL/Fl_Tooltip.H> #include <FL/Fl_Tooltip.H>
@@ -31,6 +33,7 @@ Fl_Window* make_project_window();
extern Fl_Menu_Item menu_i18n_type_chooser[]; extern Fl_Menu_Item menu_i18n_type_chooser[];
extern void i18n_cb(Fl_Choice *,void *); extern void i18n_cb(Fl_Choice *,void *);
extern Fl_Preferences fluid_prefs; extern Fl_Preferences fluid_prefs;
extern Fl_Text_Buffer *shell_run_buffer;
extern Fl_Window *settings_window; extern Fl_Window *settings_window;
#include <FL/Fl_Check_Button.H> #include <FL/Fl_Check_Button.H>
extern Fl_Check_Button *tooltips_button; extern Fl_Check_Button *tooltips_button;
@@ -46,9 +49,9 @@ extern Fl_Check_Button *shell_writemsgs_button;
#include <FL/Fl_Return_Button.H> #include <FL/Fl_Return_Button.H>
extern void do_shell_command(Fl_Return_Button*, void*); extern void do_shell_command(Fl_Return_Button*, void*);
extern Fl_Window *shell_run_window; extern Fl_Window *shell_run_window;
#include <FL/Fl_Browser.H>
extern Fl_Browser *shell_run_list;
extern Fl_Return_Button *shell_run_button; extern Fl_Return_Button *shell_run_button;
#include <FL/Fl_Text_Display.H>
extern Fl_Text_Display *shell_run_display;
Fl_Window* make_shell_window(); Fl_Window* make_shell_window();
extern Fl_Window *grid_window; extern Fl_Window *grid_window;
extern void grid_cb(Fl_Input*, long); extern void grid_cb(Fl_Input*, long);
+11 -8
View File
@@ -1,5 +1,5 @@
// //
// "$Id: fluid.cxx,v 1.15.2.13.2.36 2002/11/03 00:01:20 matthiaswm Exp $" // "$Id: fluid.cxx,v 1.15.2.13.2.37 2003/04/01 19:58:08 easysw Exp $"
// //
// FLUID main entry for the Fast Light Tool Kit (FLTK). // FLUID main entry for the Fast Light Tool Kit (FLTK).
// //
@@ -636,16 +636,18 @@ shell_pipe_cb(int, void*) {
if (fgets(line, sizeof(line), shell_pipe) != NULL) { if (fgets(line, sizeof(line), shell_pipe) != NULL) {
// Add the line to the output list... // Add the line to the output list...
shell_run_list->add(line); shell_run_buffer->append(line);
shell_run_list->make_visible(shell_run_list->size());
} else { } else {
// End of file; tell the parent... // End of file; tell the parent...
Fl::remove_fd(fileno(shell_pipe)); Fl::remove_fd(fileno(shell_pipe));
pclose(shell_pipe); pclose(shell_pipe);
shell_pipe = NULL; shell_pipe = NULL;
shell_run_list->add("... END SHELL COMMAND ..."); shell_run_buffer->append("... END SHELL COMMAND ...\n");
} }
shell_run_display->scroll(shell_run_display->count_lines(0,
shell_run_buffer->length(), 1), 0);
} }
void void
@@ -682,8 +684,9 @@ do_shell_command(Fl_Return_Button*, void*) {
} }
// Show the output window and clear things... // Show the output window and clear things...
shell_run_list->clear(); shell_run_buffer->text("");
shell_run_list->add(command); shell_run_buffer->append(command);
shell_run_buffer->append("\n");
shell_run_window->label("Shell Command Running..."); shell_run_window->label("Shell Command Running...");
if ((shell_pipe = popen(command, "r")) == NULL) { if ((shell_pipe = popen(command, "r")) == NULL) {
@@ -692,7 +695,7 @@ do_shell_command(Fl_Return_Button*, void*) {
} }
shell_run_button->deactivate(); shell_run_button->deactivate();
shell_run_window->hotspot(shell_run_list); shell_run_window->hotspot(shell_run_display);
shell_run_window->show(); shell_run_window->show();
Fl::add_fd(fileno(shell_pipe), shell_pipe_cb); Fl::add_fd(fileno(shell_pipe), shell_pipe_cb);
@@ -853,5 +856,5 @@ int main(int argc,char **argv) {
} }
// //
// End of "$Id: fluid.cxx,v 1.15.2.13.2.36 2002/11/03 00:01:20 matthiaswm Exp $". // End of "$Id: fluid.cxx,v 1.15.2.13.2.37 2003/04/01 19:58:08 easysw Exp $".
// //