|
|
|
@ -57,7 +57,7 @@
@@ -57,7 +57,7 @@
|
|
|
|
|
# include <direct.h> |
|
|
|
|
# include <windows.h> |
|
|
|
|
# include <io.h> |
|
|
|
|
# include <FCNTL.H> |
|
|
|
|
# include <fcntl.h> |
|
|
|
|
# include <commdlg.h> |
|
|
|
|
# include <FL/x.H> |
|
|
|
|
# ifndef __WATCOMC__ |
|
|
|
@ -142,7 +142,7 @@ void leave_source_dir() {
@@ -142,7 +142,7 @@ void leave_source_dir() {
|
|
|
|
|
pwd, strerror(errno));} |
|
|
|
|
in_source_dir = 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
char position_window(Fl_Window *w, const char *prefsName, int Visible, int X, int Y, int W=0, int H=0 ) { |
|
|
|
|
Fl_Preferences pos(fluid_prefs, prefsName); |
|
|
|
|
if (prevpos_button->value()) { |
|
|
|
@ -839,7 +839,7 @@ void about_cb(Fl_Widget *, void *) {
@@ -839,7 +839,7 @@ void about_cb(Fl_Widget *, void *) {
|
|
|
|
|
void show_help(const char *name) { |
|
|
|
|
const char *docdir; |
|
|
|
|
char helpname[1024]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!help_dialog) help_dialog = new Fl_Help_Dialog(); |
|
|
|
|
|
|
|
|
|
if ((docdir = getenv("FLTK_DOCDIR")) == NULL) { |
|
|
|
@ -855,7 +855,7 @@ void show_help(const char *name) {
@@ -855,7 +855,7 @@ void show_help(const char *name) {
|
|
|
|
|
docdir = FLTK_DOCDIR; |
|
|
|
|
#endif // __EMX__
|
|
|
|
|
} |
|
|
|
|
snprintf(helpname, sizeof(helpname), "%s/%s", docdir, name);
|
|
|
|
|
snprintf(helpname, sizeof(helpname), "%s/%s", docdir, name); |
|
|
|
|
|
|
|
|
|
help_dialog->load(helpname); |
|
|
|
|
help_dialog->show(); |
|
|
|
@ -991,7 +991,7 @@ void print_menu_cb(Fl_Widget *, void *) {
@@ -991,7 +991,7 @@ void print_menu_cb(Fl_Widget *, void *) {
|
|
|
|
|
char date[1024]; |
|
|
|
|
|
|
|
|
|
strftime(date, sizeof(date), "%c", curdate); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Print each of the windows...
|
|
|
|
|
for (winpage = 0; winpage < num_windows; winpage ++) { |
|
|
|
|
// Draw header...
|
|
|
|
@ -1279,7 +1279,7 @@ void print_cb(Fl_Return_Button *, void *) {
@@ -1279,7 +1279,7 @@ void print_cb(Fl_Return_Button *, void *) {
|
|
|
|
|
char date[1024]; |
|
|
|
|
|
|
|
|
|
strftime(date, sizeof(date), "%c", curdate); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Write the prolog...
|
|
|
|
|
fprintf(outfile, |
|
|
|
|
"%%!PS-Adobe-3.0\n" |
|
|
|
@ -1395,7 +1395,7 @@ void print_cb(Fl_Return_Button *, void *) {
@@ -1395,7 +1395,7 @@ void print_cb(Fl_Return_Button *, void *) {
|
|
|
|
|
// Draw a simulated window border...
|
|
|
|
|
fprintf(outfile, |
|
|
|
|
"0.75 setgray\n" // Gray background
|
|
|
|
|
"newpath %.2f %.2f %.2f 180 90 arcn\n" // Top left
|
|
|
|
|
"newpath %.2f %.2f %.2f 180 90 arcn\n" // Top left
|
|
|
|
|
"%.2f %.2f %.2f 90 0 arcn\n" // Top right
|
|
|
|
|
"%.2f %.2f %.2f 0 -90 arcn\n" // Bottom right
|
|
|
|
|
"%.2f %.2f %.2f -90 -180 arcn\n" // Bottom left
|
|
|
|
@ -1857,7 +1857,7 @@ public:
@@ -1857,7 +1857,7 @@ public:
|
|
|
|
|
// construction / destruction
|
|
|
|
|
Fl_Process() {_fpt= NULL;} |
|
|
|
|
~Fl_Process() {if (_fpt) close();} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FILE * popen (const char *cmd, const char *mode="r"); |
|
|
|
|
//not necessary here: FILE * fopen (const char *file, const char *mode="r");
|
|
|
|
|
int close(); |
|
|
|
@ -1893,17 +1893,17 @@ bool Fl_Process::createPipe(HANDLE * h, BOOL bInheritHnd) {
@@ -1893,17 +1893,17 @@ bool Fl_Process::createPipe(HANDLE * h, BOOL bInheritHnd) {
|
|
|
|
|
SECURITY_ATTRIBUTES sa; |
|
|
|
|
sa.nLength = sizeof(sa); |
|
|
|
|
sa.lpSecurityDescriptor = NULL; |
|
|
|
|
sa.bInheritHandle = bInheritHnd;
|
|
|
|
|
sa.bInheritHandle = bInheritHnd; |
|
|
|
|
return CreatePipe (&h[0],&h[1],&sa,0) ? true : false; |
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|
#endif |
|
|
|
|
// portable open process:
|
|
|
|
|
FILE * Fl_Process::popen(const char *cmd, const char *mode) { |
|
|
|
|
#if defined(WIN32) && !defined(__CYGWIN__) |
|
|
|
|
#if defined(WIN32) && !defined(__CYGWIN__) |
|
|
|
|
// PRECONDITIONS
|
|
|
|
|
if (!mode || !*mode || (*mode!='r' && *mode!='w') ) return NULL; |
|
|
|
|
if (_fpt) close(); // close first before reuse
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ptmode = *mode; |
|
|
|
|
pin[0] = pin[1] = pout[0] = pout[1] = perr[0] = perr[1] = INVALID_HANDLE_VALUE; |
|
|
|
|
// stderr to stdout wanted ?
|
|
|
|
@ -1924,19 +1924,19 @@ FILE * Fl_Process::popen(const char *cmd, const char *mode) {
@@ -1924,19 +1924,19 @@ FILE * Fl_Process::popen(const char *cmd, const char *mode) {
|
|
|
|
|
if ( CreateProcess(NULL, (LPTSTR) cmd,NULL,NULL,TRUE, |
|
|
|
|
DETACHED_PROCESS,NULL,NULL, &si, &pi)) { |
|
|
|
|
// don't need theses handles inherited by child process:
|
|
|
|
|
clean_close(pin[0]); clean_close(pout[1]); clean_close(perr[1]);
|
|
|
|
|
clean_close(pin[0]); clean_close(pout[1]); clean_close(perr[1]); |
|
|
|
|
HANDLE & h = *mode == 'r' ? pout[0] : pin[1]; |
|
|
|
|
_fpt = _fdopen(_open_osfhandle((long) h,_O_BINARY),mode); |
|
|
|
|
h= INVALID_HANDLE_VALUE; // reset the handle pointer that is shared
|
|
|
|
|
h= INVALID_HANDLE_VALUE; // reset the handle pointer that is shared
|
|
|
|
|
// with _fpt so we don't free it twice
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!_fpt) freeHandles(); |
|
|
|
|
return _fpt; |
|
|
|
|
#else |
|
|
|
|
#else |
|
|
|
|
_fpt=::popen(cmd,mode); |
|
|
|
|
return _fpt; |
|
|
|
|
#endif |
|
|
|
|
#endif |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
int Fl_Process::close() { |
|
|
|
@ -1950,11 +1950,11 @@ int Fl_Process::close() {
@@ -1950,11 +1950,11 @@ int Fl_Process::close() {
|
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
return -1; |
|
|
|
|
#else |
|
|
|
|
#else |
|
|
|
|
int ret = ::pclose(_fpt); |
|
|
|
|
_fpt=NULL; |
|
|
|
|
return ret; |
|
|
|
|
#endif |
|
|
|
|
#endif |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#if defined(WIN32) && !defined(__CYGWIN__) |
|
|
|
@ -2079,7 +2079,7 @@ void set_filename(const char *c) {
@@ -2079,7 +2079,7 @@ void set_filename(const char *c) {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// The Source View system offers an immediate preview of the code
|
|
|
|
|
// The Source View system offers an immediate preview of the code
|
|
|
|
|
// files that will be generated by FLUID. It also marks the code
|
|
|
|
|
// generated for the last selected item in the header and the source
|
|
|
|
|
// file.
|
|
|
|
@ -2093,9 +2093,9 @@ void set_filename(const char *c) {
@@ -2093,9 +2093,9 @@ void set_filename(const char *c) {
|
|
|
|
|
//
|
|
|
|
|
void update_sourceview_position() |
|
|
|
|
{ |
|
|
|
|
if (!sourceview_panel || !sourceview_panel->visible())
|
|
|
|
|
if (!sourceview_panel || !sourceview_panel->visible()) |
|
|
|
|
return; |
|
|
|
|
if (sv_autoposition->value()==0)
|
|
|
|
|
if (sv_autoposition->value()==0) |
|
|
|
|
return; |
|
|
|
|
if (sourceview_panel && sourceview_panel->visible() && Fl_Type::current) { |
|
|
|
|
int pos0, pos1; |
|
|
|
@ -2124,7 +2124,7 @@ void update_sourceview_position()
@@ -2124,7 +2124,7 @@ void update_sourceview_position()
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void update_sourceview_position_cb(Fl_Tabs*, void*)
|
|
|
|
|
void update_sourceview_position_cb(Fl_Tabs*, void*) |
|
|
|
|
{ |
|
|
|
|
update_sourceview_position(); |
|
|
|
|
} |
|
|
|
@ -2136,9 +2136,9 @@ static char *sv_header_filename = 0;
@@ -2136,9 +2136,9 @@ static char *sv_header_filename = 0;
|
|
|
|
|
// Generate a header and source file in a temporary directory and
|
|
|
|
|
// load those into the Code Viewer widgets.
|
|
|
|
|
//
|
|
|
|
|
void update_sourceview_cb(Fl_Button*, void*)
|
|
|
|
|
void update_sourceview_cb(Fl_Button*, void*) |
|
|
|
|
{ |
|
|
|
|
if (!sourceview_panel || !sourceview_panel->visible())
|
|
|
|
|
if (!sourceview_panel || !sourceview_panel->visible()) |
|
|
|
|
return; |
|
|
|
|
// generate space for the source and header file filenames
|
|
|
|
|
if (!sv_source_filename) { |
|
|
|
@ -2162,7 +2162,7 @@ void update_sourceview_cb(Fl_Button*, void*)
@@ -2162,7 +2162,7 @@ void update_sourceview_cb(Fl_Button*, void*)
|
|
|
|
|
// generate the code and load the files
|
|
|
|
|
write_sourceview = 1; |
|
|
|
|
// generate files
|
|
|
|
|
if (write_code(sv_source_filename, sv_header_filename))
|
|
|
|
|
if (write_code(sv_source_filename, sv_header_filename)) |
|
|
|
|
{ |
|
|
|
|
// load file into source editor
|
|
|
|
|
int pos = sv_source->top_line(); |
|
|
|
@ -2181,7 +2181,7 @@ void update_sourceview_cb(Fl_Button*, void*)
@@ -2181,7 +2181,7 @@ void update_sourceview_cb(Fl_Button*, void*)
|
|
|
|
|
header_file_name = header_file_name_bak; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void update_sourceview_timer(void*)
|
|
|
|
|
void update_sourceview_timer(void*) |
|
|
|
|
{ |
|
|
|
|
update_sourceview_cb(0,0); |
|
|
|
|
} |
|
|
|
@ -2196,7 +2196,7 @@ void set_modflag(int mf) {
@@ -2196,7 +2196,7 @@ void set_modflag(int mf) {
|
|
|
|
|
if (main_window) { |
|
|
|
|
if (!filename) basename = "Untitled.fl"; |
|
|
|
|
else if ((basename = strrchr(filename, '/')) != NULL) basename ++; |
|
|
|
|
#if defined(WIN32) || defined(__EMX__) |
|
|
|
|
#if defined(WIN32) || defined(__EMX__) |
|
|
|
|
else if ((basename = strrchr(filename, '\\')) != NULL) basename ++; |
|
|
|
|
#endif // WIN32 || __EMX__
|
|
|
|
|
else basename = filename; |
|
|
|
|