mirror of
https://github.com/edeproject/ede.git
synced 2023-08-10 21:13:03 +03:00
Support for launching with terminal
Added missing title in fl file
This commit is contained in:
parent
c9534bcbae
commit
e0e54f2ece
@ -15,6 +15,7 @@
|
|||||||
#include <FL/Fl.H>
|
#include <FL/Fl.H>
|
||||||
#include <FL/Fl_Box.H>
|
#include <FL/Fl_Box.H>
|
||||||
#include <FL/Fl_Button.H>
|
#include <FL/Fl_Button.H>
|
||||||
|
#include <FL/Fl_Check_Button.H>
|
||||||
#include <FL/Fl_Input.H>
|
#include <FL/Fl_Input.H>
|
||||||
#include <FL/Fl_Pixmap.H>
|
#include <FL/Fl_Pixmap.H>
|
||||||
#include <edelib/Run.h>
|
#include <edelib/Run.h>
|
||||||
@ -33,6 +34,8 @@ EDELIB_NS_USING(run_program_fmt)
|
|||||||
|
|
||||||
static Fl_Pixmap image_run(run_xpm);
|
static Fl_Pixmap image_run(run_xpm);
|
||||||
static Fl_Input* dialog_input;
|
static Fl_Input* dialog_input;
|
||||||
|
static Fl_Check_Button* in_term;
|
||||||
|
|
||||||
static int ret;
|
static int ret;
|
||||||
|
|
||||||
void help(void) {
|
void help(void) {
|
||||||
@ -183,12 +186,22 @@ static void ok_cb(Fl_Widget*, void* w) {
|
|||||||
/* do not block dialog when program is starting */
|
/* do not block dialog when program is starting */
|
||||||
Fl::check();
|
Fl::check();
|
||||||
|
|
||||||
/* TODO: is 'cmd' safe to use here? */
|
/* TODO: is 'cmd' safe after hide? */
|
||||||
|
if(in_term->value()) {
|
||||||
|
char buff[128];
|
||||||
|
char* term = getenv("TERM");
|
||||||
|
if(!term)
|
||||||
|
term = "xterm";
|
||||||
|
|
||||||
|
snprintf(buff, sizeof(buff), "%s -e %s", term, cmd);
|
||||||
|
start_child_process_with_core(buff);
|
||||||
|
} else {
|
||||||
start_child_process_with_core(cmd);
|
start_child_process_with_core(cmd);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void start_dialog(int argc, char** argv) {
|
static void start_dialog(int argc, char** argv) {
|
||||||
LaunchWindow* win = new LaunchWindow(370, 160, _("Run Command"));
|
LaunchWindow* win = new LaunchWindow(370, 195, _("Run Command"));
|
||||||
win->begin();
|
win->begin();
|
||||||
Fl_Box* icon = new Fl_Box(10, 10, 55, 55);
|
Fl_Box* icon = new Fl_Box(10, 10, 55, 55);
|
||||||
icon->image(image_run);
|
icon->image(image_run);
|
||||||
@ -198,9 +211,12 @@ static void start_dialog(int argc, char** argv) {
|
|||||||
|
|
||||||
dialog_input = new Fl_Input(70, 90, 290, 25, _("Open:"));
|
dialog_input = new Fl_Input(70, 90, 290, 25, _("Open:"));
|
||||||
|
|
||||||
Fl_Button* ok = new Fl_Button(175, 125, 90, 25, _("&OK"));
|
in_term = new Fl_Check_Button(70, 125, 290, 25, _("Run in terminal"));
|
||||||
|
in_term->down_box(FL_DOWN_BOX);
|
||||||
|
|
||||||
|
Fl_Button* ok = new Fl_Button(175, 160, 90, 25, _("&OK"));
|
||||||
ok->callback(ok_cb, win);
|
ok->callback(ok_cb, win);
|
||||||
Fl_Button* cancel = new Fl_Button(270, 125, 90, 25, _("&Cancel"));
|
Fl_Button* cancel = new Fl_Button(270, 160, 90, 25, _("&Cancel"));
|
||||||
cancel->callback(cancel_cb, win);
|
cancel->callback(cancel_cb, win);
|
||||||
win->end();
|
win->end();
|
||||||
win->show(argc, argv);
|
win->show(argc, argv);
|
||||||
|
@ -4,8 +4,9 @@ header_name {.h}
|
|||||||
code_name {.cxx}
|
code_name {.cxx}
|
||||||
Function {} {open
|
Function {} {open
|
||||||
} {
|
} {
|
||||||
Fl_Window {} {open
|
Fl_Window {} {
|
||||||
xywh {433 276 370 160} type Double visible
|
label {Run Command} open
|
||||||
|
xywh {433 276 370 195} type Double visible
|
||||||
} {
|
} {
|
||||||
Fl_Box {} {
|
Fl_Box {} {
|
||||||
image {../icons/run.xpm} xywh {10 10 55 55} labelsize 14
|
image {../icons/run.xpm} xywh {10 10 55 55} labelsize 14
|
||||||
@ -18,13 +19,17 @@ Function {} {open
|
|||||||
label {Open:}
|
label {Open:}
|
||||||
xywh {70 90 290 25}
|
xywh {70 90 290 25}
|
||||||
}
|
}
|
||||||
Fl_Button {} {
|
Fl_Check_Button {} {
|
||||||
label {&OK}
|
label {Run in terminal} selected
|
||||||
xywh {175 125 90 25}
|
xywh {70 125 290 25} down_box DOWN_BOX
|
||||||
}
|
}
|
||||||
Fl_Button {} {
|
Fl_Button {} {
|
||||||
label {&Cancel} selected
|
label {&OK}
|
||||||
xywh {270 125 90 25}
|
xywh {175 160 90 25}
|
||||||
|
}
|
||||||
|
Fl_Button {} {
|
||||||
|
label {&Cancel}
|
||||||
|
xywh {270 160 90 25}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user