Running FLTK in static initializers (cont'd):

1) Changed the way fluid attaches images to widgets and menu items so
it is compatible with running fluid-generated code containing such images
in a static initializer. Images are now attached calling a function:
  widget->image( image_function_name() );
and this function is defined before in fluid-generated code as:
   static Fl_Image *image_function_name() {
     static Fl_Image *image = new image_type(......);
     return image;
   }

2) Changed src/Fl_File_Chooser.fl so the source code generate by fluid
from it is compatible with running in a static initializer.

3) Changed src/Fl_File_Chooser.cxx and FL/Fl_File_Chooser.H
to the result of running fluid on src/Fl_File_Chooser.fl 

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10972 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Manolo Gouy
2015-12-18 18:56:58 +00:00
parent 5c7ef30341
commit 43bfe74b25
7 changed files with 58 additions and 42 deletions
+6 -2
View File
@@ -254,14 +254,18 @@ void write_cdata(const char *s, int length) {
putc('}', code_file);
}
void write_c(const char* format,...) {
void vwrite_c(const char* format, va_list args) {
if (varused_test) {
varused = 1;
return;
}
vfprintf(code_file, format, args);
}
void write_c(const char* format,...) {
va_list args;
va_start(args, format);
vfprintf(code_file, format, args);
vwrite_c(format, args);
va_end(args);
}