mirror of
https://github.com/fltk/fltk.git
synced 2026-05-18 08:13:45 +08:00
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:
@@ -1,5 +1,8 @@
|
||||
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
|
||||
parent window was not yet shown.
|
||||
- FLUID could crash after displaying a syntax error
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -110,6 +110,7 @@ Fl_Window* make_project_window() {
|
||||
}
|
||||
return w;
|
||||
}
|
||||
Fl_Text_Buffer *shell_run_buffer;
|
||||
|
||||
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* 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;
|
||||
{ Fl_Button* o = new Fl_Button(185, 179, 60, 25, "Close");
|
||||
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_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_Text_Display *shell_run_display=(Fl_Text_Display *)0;
|
||||
|
||||
Fl_Window* make_shell_window() {
|
||||
Fl_Window* w;
|
||||
{ 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");
|
||||
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->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);
|
||||
shell_run_buffer = new Fl_Text_Buffer();
|
||||
shell_run_display->buffer(shell_run_buffer);
|
||||
}
|
||||
o->end();
|
||||
}
|
||||
|
||||
@@ -1,7 +1,13 @@
|
||||
# data file for the Fltk User Interface Designer (fluid)
|
||||
version 1.0102
|
||||
version 1.0103
|
||||
header_name {.h}
|
||||
code_name {.cxx}
|
||||
decl {\#include <FL/Fl_Text_Buffer.H>} {public
|
||||
}
|
||||
|
||||
decl {\#include <FL/Fl_Text_Display.H>} {public
|
||||
}
|
||||
|
||||
Function {make_project_window()} {open
|
||||
} {
|
||||
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 {Fl_Text_Buffer *shell_run_buffer;} {selected public
|
||||
}
|
||||
|
||||
Function {make_settings_window()} {open
|
||||
} {
|
||||
Fl_Window settings_window {
|
||||
label {GUI Settings} open
|
||||
xywh {340 243 255 213} visible
|
||||
xywh {340 243 255 210} visible
|
||||
} {
|
||||
Fl_Button {} {
|
||||
label Close
|
||||
callback {settings_window->hide();} selected
|
||||
callback {settings_window->hide();}
|
||||
tooltip {Close this dialog.} xywh {185 179 60 25}
|
||||
}
|
||||
Fl_Tabs {} {
|
||||
@@ -213,16 +222,18 @@ Function {make_shell_window()} {open
|
||||
}
|
||||
Fl_Window shell_run_window {
|
||||
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 {
|
||||
label Close
|
||||
callback {shell_run_window->hide();}
|
||||
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 {
|
||||
label Grid open
|
||||
xywh {1128 236 155 175} visible
|
||||
xywh {1120 236 155 175} visible
|
||||
} {
|
||||
Fl_Tabs {} {
|
||||
xywh {10 10 135 120} align 5
|
||||
|
||||
@@ -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
|
||||
#define alignment_panel_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_Preferences.H>
|
||||
#include <FL/Fl_Tooltip.H>
|
||||
@@ -31,6 +33,7 @@ Fl_Window* make_project_window();
|
||||
extern Fl_Menu_Item menu_i18n_type_chooser[];
|
||||
extern void i18n_cb(Fl_Choice *,void *);
|
||||
extern Fl_Preferences fluid_prefs;
|
||||
extern Fl_Text_Buffer *shell_run_buffer;
|
||||
extern Fl_Window *settings_window;
|
||||
#include <FL/Fl_Check_Button.H>
|
||||
extern Fl_Check_Button *tooltips_button;
|
||||
@@ -46,9 +49,9 @@ 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;
|
||||
#include <FL/Fl_Text_Display.H>
|
||||
extern Fl_Text_Display *shell_run_display;
|
||||
Fl_Window* make_shell_window();
|
||||
extern Fl_Window *grid_window;
|
||||
extern void grid_cb(Fl_Input*, long);
|
||||
|
||||
+11
-8
@@ -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).
|
||||
//
|
||||
@@ -636,16 +636,18 @@ shell_pipe_cb(int, void*) {
|
||||
|
||||
if (fgets(line, sizeof(line), shell_pipe) != NULL) {
|
||||
// Add the line to the output list...
|
||||
shell_run_list->add(line);
|
||||
shell_run_list->make_visible(shell_run_list->size());
|
||||
shell_run_buffer->append(line);
|
||||
} else {
|
||||
// End of file; tell the parent...
|
||||
Fl::remove_fd(fileno(shell_pipe));
|
||||
|
||||
pclose(shell_pipe);
|
||||
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
|
||||
@@ -682,8 +684,9 @@ do_shell_command(Fl_Return_Button*, void*) {
|
||||
}
|
||||
|
||||
// Show the output window and clear things...
|
||||
shell_run_list->clear();
|
||||
shell_run_list->add(command);
|
||||
shell_run_buffer->text("");
|
||||
shell_run_buffer->append(command);
|
||||
shell_run_buffer->append("\n");
|
||||
shell_run_window->label("Shell Command Running...");
|
||||
|
||||
if ((shell_pipe = popen(command, "r")) == NULL) {
|
||||
@@ -692,7 +695,7 @@ do_shell_command(Fl_Return_Button*, void*) {
|
||||
}
|
||||
|
||||
shell_run_button->deactivate();
|
||||
shell_run_window->hotspot(shell_run_list);
|
||||
shell_run_window->hotspot(shell_run_display);
|
||||
shell_run_window->show();
|
||||
|
||||
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 $".
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user