Browse Source

STR #2093 - fix typo (name case) FCNTL.H should be fcntl.h, affecting some mingw builds


			
			
				pull/49/head
			
			
		
Ian MacArthur 17 years ago
parent
commit
17e38137d8
  1. 54
      fluid/fluid.cxx

54
fluid/fluid.cxx

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

Loading…
Cancel
Save