Skip to content

Commit

Permalink
Add shell command support to FLUID.
Browse files Browse the repository at this point in the history
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@2155 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
  • Loading branch information
michaelrsweet committed May 1, 2002
1 parent b338c74 commit 39a823b
Show file tree
Hide file tree
Showing 6 changed files with 341 additions and 55 deletions.
7 changes: 3 additions & 4 deletions CHANGES
@@ -1,8 +1,6 @@
CHANGES IN FLTK 1.1.0rc1

- Fixed VisualC projects for Fl_File_Input.
- Added binary support and procedural names to
Fl_Preferences, updated FLUID
- FLUID now supports running shell commands.
- New Fl_File_Input widget that shows directory
separators with filename in input field.
- The Fl_File_Chooser dialog now shows the absolute path
Expand All @@ -15,7 +13,8 @@ CHANGES IN FLTK 1.1.0rc1
in WIN32 version of scandir(). This takes care of a
file chooser performance problem with large
directories.
- Added Fl_Preferences class from Matthias Melcher.
- Added Fl_Preferences class from Matthias Melcher,
including binary data support.
- FLUID now recognizes the "using" keyword in
declarations.
- fl_file_chooser() didn't highlight the requested file
Expand Down
100 changes: 98 additions & 2 deletions fluid/alignment_panel.cxx
Expand Up @@ -114,8 +114,6 @@ Fl_Window* make_alignment_window() {
}
return w;
}
extern void i18n_cb(Fl_Choice *,void *);
extern Fl_Preferences fluid_prefs;

Fl_Window *settings_window=(Fl_Window *)0;

Expand Down Expand Up @@ -213,3 +211,101 @@ Fl_Window* make_settings_window() {
}
return w;
}

Fl_Window *shell_window=(Fl_Window *)0;

Fl_Input *shell_command_input=(Fl_Input *)0;

static void cb_shell_command_input(Fl_Input*, void*) {
fluid_prefs.set("shell_command", shell_command_input->value());
}

Fl_Check_Button *shell_savefl_button=(Fl_Check_Button *)0;

static void cb_shell_savefl_button(Fl_Check_Button*, void*) {
fluid_prefs.set("shell_savefl", shell_savefl_button->value());
}

Fl_Check_Button *shell_writecode_button=(Fl_Check_Button *)0;

static void cb_shell_writecode_button(Fl_Check_Button*, void*) {
fluid_prefs.set("shell_writecode", shell_writecode_button->value());
}

Fl_Check_Button *shell_writemsgs_button=(Fl_Check_Button *)0;

static void cb_shell_writemsgs_button(Fl_Check_Button*, void*) {
fluid_prefs.set("shell_writemsgs", shell_writemsgs_button->value());
}

static void cb_Cancel(Fl_Button*, void*) {
shell_window->hide();
}

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;

static void cb_shell_run_button(Fl_Return_Button*, void*) {
shell_run_window->hide();
}

Fl_Window* make_shell_window() {
Fl_Window* w;
{ Fl_Window* o = shell_window = new Fl_Window(445, 104, "Shell Command");
w = o;
{ Fl_Input* o = shell_command_input = new Fl_Input(85, 10, 350, 20, "Command:");
o->callback((Fl_Callback*)cb_shell_command_input);
char buf[1024];
fluid_prefs.get("shell_command", buf, "", sizeof(buf));
shell_command_input->value(buf);
}
{ Fl_Group* o = new Fl_Group(85, 40, 350, 20, "Options:");
o->align(FL_ALIGN_LEFT);
{ Fl_Check_Button* o = shell_savefl_button = new Fl_Check_Button(85, 40, 110, 20, "Save .FL File");
o->down_box(FL_DOWN_BOX);
o->callback((Fl_Callback*)cb_shell_savefl_button);
char b;
fluid_prefs.get("shell_savefl", b, 1);
shell_savefl_button->value(b);
}
{ Fl_Check_Button* o = shell_writecode_button = new Fl_Check_Button(200, 40, 95, 20, "Write Code");
o->down_box(FL_DOWN_BOX);
o->callback((Fl_Callback*)cb_shell_writecode_button);
char b;
fluid_prefs.get("shell_writecode", b, 1);
shell_writecode_button->value(b);
}
{ Fl_Check_Button* o = shell_writemsgs_button = new Fl_Check_Button(300, 40, 125, 20, "Write Messages");
o->down_box(FL_DOWN_BOX);
o->callback((Fl_Callback*)cb_shell_writemsgs_button);
char b;
fluid_prefs.get("shell_writemsgs", b, 0);
shell_writemsgs_button->value(b);
}
o->end();
}
{ Fl_Button* o = new Fl_Button(370, 70, 65, 25, "Cancel");
o->callback((Fl_Callback*)cb_Cancel);
}
{ Fl_Return_Button* o = new Fl_Return_Button(220, 70, 140, 25, "Run Command");
o->callback((Fl_Callback*)do_shell_command);
}
o->end();
}
{ Fl_Window* o = shell_run_window = new Fl_Window(553, 435, "Shell Command Output");
w = o;
{ Fl_Browser* o = shell_run_list = new Fl_Browser(10, 10, 535, 380);
o->textfont(4);
o->textsize(12);
Fl_Group::current()->resizable(o);
}
{ Fl_Return_Button* o = shell_run_button = new Fl_Return_Button(465, 400, 80, 25, "Close");
o->callback((Fl_Callback*)cb_shell_run_button);
}
o->end();
}
return w;
}
85 changes: 78 additions & 7 deletions fluid/alignment_panel.fl
Expand Up @@ -6,7 +6,9 @@ Function {make_alignment_window()} {open
} {
Fl_Window alignment_window {
label Preferences open
xywh {469 112 365 340} modal visible
xywh {469 112 365 340}
code0 {\#include <FL/Fl_Preferences.H>}
code1 {\#include <FL/Fl_Tooltip.H>} modal visible
} {
Fl_Button {} {
label Close
Expand Down Expand Up @@ -83,17 +85,17 @@ Function {make_alignment_window()} {open
}
}

decl {extern void i18n_cb(Fl_Choice *,void *);} {}
decl {extern void i18n_cb(Fl_Choice *,void *);} {public
}

decl {extern Fl_Preferences fluid_prefs;} {}
decl {extern Fl_Preferences fluid_prefs;} {public
}

Function {make_settings_window()} {open
} {
Fl_Window settings_window {
label Settings open
xywh {376 480 400 175}
code0 {\#include <FL/Fl_Preferences.H>}
code1 {\#include <FL/Fl_Tooltip.H>} visible
xywh {376 480 400 175} visible
} {
Fl_Button {} {
label Close
Expand Down Expand Up @@ -132,7 +134,7 @@ Function {make_settings_window()} {open
Fl_Check_Button tooltips_button {
label {Show Tooltips}
callback {Fl_Tooltip::enable(tooltips_button->value());
fluid_prefs.set("show_tooltips", tooltips_button->value());} selected
fluid_prefs.set("show_tooltips", tooltips_button->value());}
xywh {165 40 215 20} down_box DOWN_BOX
code0 {char b;}
code1 {fluid_prefs.get("show_tooltips", b, 1);}
Expand All @@ -157,3 +159,72 @@ fluid_prefs.set("show_tooltips", tooltips_button->value());} selected
}
}
}

Function {make_shell_window()} {open
} {
Fl_Window shell_window {
label {Shell Command} open
xywh {630 219 445 104} visible
} {
Fl_Input shell_command_input {
label {Command:}
callback {fluid_prefs.set("shell_command", shell_command_input->value());}
xywh {85 10 350 20}
code0 {char buf[1024];}
code1 {fluid_prefs.get("shell_command", buf, "", sizeof(buf));}
code2 {shell_command_input->value(buf);}
}
Fl_Group {} {
label {Options:} open
xywh {85 40 350 20} align 4
} {
Fl_Check_Button shell_savefl_button {
label {Save .FL File}
callback {fluid_prefs.set("shell_savefl", shell_savefl_button->value());}
xywh {85 40 110 20} down_box DOWN_BOX
code0 {char b;}
code1 {fluid_prefs.get("shell_savefl", b, 1);}
code2 {shell_savefl_button->value(b);}
}
Fl_Check_Button shell_writecode_button {
label {Write Code}
callback {fluid_prefs.set("shell_writecode", shell_writecode_button->value());}
xywh {200 40 95 20} down_box DOWN_BOX
code0 {char b;}
code1 {fluid_prefs.get("shell_writecode", b, 1);}
code2 {shell_writecode_button->value(b);}
}
Fl_Check_Button shell_writemsgs_button {
label {Write Messages}
callback {fluid_prefs.set("shell_writemsgs", shell_writemsgs_button->value());}
xywh {300 40 125 20} down_box DOWN_BOX
code0 {char b;}
code1 {fluid_prefs.get("shell_writemsgs", b, 0);}
code2 {shell_writemsgs_button->value(b);}
}
}
Fl_Button {} {
label Cancel
callback {shell_window->hide();}
xywh {370 70 65 25}
}
Fl_Return_Button {} {
label {Run Command}
callback do_shell_command
xywh {220 70 140 25}
}
}
Fl_Window shell_run_window {
label {Shell Command Output} open
xywh {693 386 553 435} resizable visible
} {
Fl_Browser shell_run_list {selected
xywh {10 10 535 380} textfont 4 textsize 12 resizable
}
Fl_Return_Button shell_run_button {
label Close
callback {shell_run_window->hide();}
xywh {465 400 80 25}
}
}
}
19 changes: 17 additions & 2 deletions fluid/alignment_panel.h
Expand Up @@ -4,6 +4,8 @@
#define alignment_panel_h
#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Preferences.H>
#include <FL/Fl_Tooltip.H>
extern Fl_Window *alignment_window;
#include <FL/Fl_Button.H>
#include <FL/Fl_Box.H>
Expand All @@ -25,8 +27,8 @@ extern Fl_Input *i18n_set_input;
extern Fl_Input *i18n_function_input;
Fl_Window* make_alignment_window();
extern Fl_Menu_Item menu_i18n_type_chooser[];
#include <FL/Fl_Preferences.H>
#include <FL/Fl_Tooltip.H>
extern void i18n_cb(Fl_Choice *,void *);
extern Fl_Preferences fluid_prefs;
extern Fl_Window *settings_window;
extern void grid_cb(Fl_Input*, long);
extern Fl_Input *horizontal_input;
Expand All @@ -37,4 +39,17 @@ extern Fl_Check_Button *tooltips_button;
extern Fl_Check_Button *completion_button;
extern Fl_Check_Button *openlast_button;
Fl_Window* make_settings_window();
extern Fl_Window *shell_window;
extern Fl_Input *shell_command_input;
#include <FL/Fl_Group.H>
extern Fl_Check_Button *shell_savefl_button;
extern Fl_Check_Button *shell_writecode_button;
extern Fl_Check_Button *shell_writemsgs_button;
#include <FL/Fl_Return_Button.H>
extern void do_shell_command(Fl_Return_Button*, void*);
extern Fl_Window *shell_run_window;
#include <FL/Fl_Browser.H>
extern Fl_Browser *shell_run_list;
extern Fl_Return_Button *shell_run_button;
Fl_Window* make_shell_window();
#endif

0 comments on commit 39a823b

Please sign in to comment.