mirror of
https://github.com/fltk/fltk.git
synced 2026-06-04 23:42:15 +08:00
Fix problems with new FLUID output, add common to closing braces to show
what widget is being closed, and bump the version number to 1.1.8 in the repo... git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@5271 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
+1
-1
@@ -47,7 +47,7 @@
|
|||||||
|
|
||||||
#define FL_MAJOR_VERSION 1
|
#define FL_MAJOR_VERSION 1
|
||||||
#define FL_MINOR_VERSION 1
|
#define FL_MINOR_VERSION 1
|
||||||
#define FL_PATCH_VERSION 7
|
#define FL_PATCH_VERSION 8
|
||||||
#define FL_VERSION ((double)FL_MAJOR_VERSION + \
|
#define FL_VERSION ((double)FL_MAJOR_VERSION + \
|
||||||
(double)FL_MINOR_VERSION * 0.01 + \
|
(double)FL_MINOR_VERSION * 0.01 + \
|
||||||
(double)FL_PATCH_VERSION * 0.0001)
|
(double)FL_PATCH_VERSION * 0.0001)
|
||||||
|
|||||||
+1
-1
@@ -36,7 +36,7 @@ AC_INIT(src/Fl.cxx)
|
|||||||
dnl FLTK library versions...
|
dnl FLTK library versions...
|
||||||
FL_MAJOR_VERSION=1
|
FL_MAJOR_VERSION=1
|
||||||
FL_MINOR_VERSION=1
|
FL_MINOR_VERSION=1
|
||||||
FL_PATCH_VERSION=7
|
FL_PATCH_VERSION=8
|
||||||
FL_API_VERSION=${FL_MAJOR_VERSION}.${FL_MINOR_VERSION}
|
FL_API_VERSION=${FL_MAJOR_VERSION}.${FL_MINOR_VERSION}
|
||||||
|
|
||||||
AC_SUBST(FL_MAJOR_VERSION)
|
AC_SUBST(FL_MAJOR_VERSION)
|
||||||
|
|||||||
@@ -340,15 +340,15 @@ void Fl_Function_Type::write_code1() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Fl_Function_Type::write_code2() {
|
void Fl_Function_Type::write_code2() {
|
||||||
|
Fl_Type *child;
|
||||||
|
const char *var = "w";
|
||||||
|
for (child = next; child && child->level > level; child = child->next)
|
||||||
|
if (child->is_window() && child->name()) var = child->name();
|
||||||
|
|
||||||
if (ismain()) {
|
if (ismain()) {
|
||||||
if (havewidgets) write_c(" w->show(argc, argv);\n");
|
if (havewidgets) write_c(" %s->show(argc, argv);\n", var);
|
||||||
write_c(" return Fl::run();\n");
|
write_c(" return Fl::run();\n");
|
||||||
} else if (havewidgets && !constructor && !return_type) {
|
} else if (havewidgets && !constructor && !return_type) {
|
||||||
Fl_Type *child;
|
|
||||||
const char *var = "w";
|
|
||||||
for (child = next; child && child->level > level; child = child->next)
|
|
||||||
if (child->is_window() && child->name()) var = child->name();
|
|
||||||
|
|
||||||
write_c(" return %s;\n", var);
|
write_c(" return %s;\n", var);
|
||||||
}
|
}
|
||||||
write_c("}\n");
|
write_c("}\n");
|
||||||
|
|||||||
+23
-24
@@ -1941,6 +1941,8 @@ const char *Fl_Type::callback_name() {
|
|||||||
return unique_id(this, "cb", name(), label());
|
return unique_id(this, "cb", name(), label());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern int varused_test, varused;
|
||||||
|
|
||||||
void Fl_Widget_Type::write_code1() {
|
void Fl_Widget_Type::write_code1() {
|
||||||
const char* t = subclassname(this);
|
const char* t = subclassname(this);
|
||||||
const char *c = array_name(this);
|
const char *c = array_name(this);
|
||||||
@@ -1958,23 +1960,34 @@ void Fl_Widget_Type::write_code1() {
|
|||||||
write_h(" static void %s(%s*, %s);\n", cn, t, ut);
|
write_h(" static void %s(%s*, %s);\n", cn, t, ut);
|
||||||
}
|
}
|
||||||
// figure out if local variable will be used (prevent compiler warnings):
|
// figure out if local variable will be used (prevent compiler warnings):
|
||||||
int oused = !name();
|
|
||||||
int wused = !name() && is_window();
|
int wused = !name() && is_window();
|
||||||
const char *ptr;
|
const char *ptr;
|
||||||
|
|
||||||
if (!oused) {
|
varused = wused;
|
||||||
|
|
||||||
|
if (!name() && !varused) {
|
||||||
|
varused |= is_parent();
|
||||||
|
|
||||||
|
if (!varused) {
|
||||||
|
varused_test = 1;
|
||||||
|
write_widget_code();
|
||||||
|
varused_test = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!varused) {
|
||||||
for (int n=0; n < NUM_EXTRA_CODE; n++)
|
for (int n=0; n < NUM_EXTRA_CODE; n++)
|
||||||
if (extra_code(n) && !isdeclare(extra_code(n)) &&
|
if (extra_code(n) && !isdeclare(extra_code(n)) &&
|
||||||
(ptr = strstr(extra_code(n), "o->")) != NULL &&
|
(ptr = strstr(extra_code(n), "o->")) != NULL &&
|
||||||
(ptr == extra_code(n) ||
|
(ptr == extra_code(n) ||
|
||||||
(!isalnum(ptr[-1] & 255) && ptr[-1] != '_'))) {
|
(!isalnum(ptr[-1] & 255) && ptr[-1] != '_'))) {
|
||||||
oused = 1;
|
varused = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
write_c(indent());
|
write_c("%s{ ", indent());
|
||||||
if (oused) write_c("{ %s* o = ", t);
|
if (varused) write_c("%s* o = ", t);
|
||||||
if (name()) write_c("%s = ", name());
|
if (name()) write_c("%s = ", name());
|
||||||
if (is_window()) {
|
if (is_window()) {
|
||||||
// Handle special case where user is faking a Fl_Group type as a window,
|
// Handle special case where user is faking a Fl_Group type as a window,
|
||||||
@@ -2007,10 +2020,10 @@ void Fl_Widget_Type::write_code1() {
|
|||||||
}
|
}
|
||||||
write_c(");\n");
|
write_c(");\n");
|
||||||
|
|
||||||
if (oused)
|
indentation += 2;
|
||||||
indentation += 2;
|
|
||||||
|
|
||||||
if (wused) write_c("%sw = o;\n", indent());
|
if (wused) write_c("%sw = o;\n", indent());
|
||||||
|
|
||||||
write_widget_code();
|
write_widget_code();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2195,23 +2208,9 @@ void Fl_Widget_Type::write_extra_code() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Fl_Widget_Type::write_block_close() {
|
void Fl_Widget_Type::write_block_close() {
|
||||||
int oused = !name();
|
indentation -= 2;
|
||||||
const char *ptr;
|
write_c("%s} // %s* %s\n", indent(), subclassname(this),
|
||||||
|
name() ? name() : "o");
|
||||||
if (!oused) {
|
|
||||||
for (int n=0; n < NUM_EXTRA_CODE; n++)
|
|
||||||
if (extra_code(n) && !isdeclare(extra_code(n)) &&
|
|
||||||
(ptr = strstr(extra_code(n), "o->")) != NULL &&
|
|
||||||
(ptr == extra_code(n) ||
|
|
||||||
(!isalnum(ptr[-1] & 255) && ptr[-1] != '_'))) {
|
|
||||||
oused = 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (oused) {
|
|
||||||
indentation -= 2;
|
|
||||||
write_c("%s}\n", indent());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Fl_Widget_Type::write_code2() {
|
void Fl_Widget_Type::write_code2() {
|
||||||
|
|||||||
@@ -1299,7 +1299,7 @@ void Fl_Window_Type::write_code2() {
|
|||||||
}
|
}
|
||||||
write_c("%s%s->end();\n", indent(), var);
|
write_c("%s%s->end();\n", indent(), var);
|
||||||
if (((Fl_Window*)o)->resizable() == o)
|
if (((Fl_Window*)o)->resizable() == o)
|
||||||
write_c("%s%s->resizable(o);\n", indent(), var);
|
write_c("%s%s->resizable(%s);\n", indent(), var, var);
|
||||||
write_block_close();
|
write_block_close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -153,8 +153,18 @@ int write_declare(const char *format, ...) {
|
|||||||
|
|
||||||
////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// silly thing to prevent declaring unused variables:
|
||||||
|
// When this symbol is on, all attempts to write code don't write
|
||||||
|
// anything, but set a variable if it looks like the variable "o" is used:
|
||||||
|
int varused_test;
|
||||||
|
int varused;
|
||||||
|
|
||||||
// write an array of C characters (adds a null):
|
// write an array of C characters (adds a null):
|
||||||
void write_cstring(const char *w, int length) {
|
void write_cstring(const char *w, int length) {
|
||||||
|
if (varused_test) {
|
||||||
|
varused = 1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
const char *e = w+length;
|
const char *e = w+length;
|
||||||
int linelength = 1;
|
int linelength = 1;
|
||||||
putc('\"', code_file);
|
putc('\"', code_file);
|
||||||
@@ -221,6 +231,10 @@ void write_cstring(const char *w) {write_cstring(w,strlen(w));}
|
|||||||
|
|
||||||
// write an array of C binary data (does not add a null):
|
// write an array of C binary data (does not add a null):
|
||||||
void write_cdata(const char *s, int length) {
|
void write_cdata(const char *s, int length) {
|
||||||
|
if (varused_test) {
|
||||||
|
varused = 1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
const unsigned char *w = (const unsigned char *)s;
|
const unsigned char *w = (const unsigned char *)s;
|
||||||
const unsigned char *e = w+length;
|
const unsigned char *e = w+length;
|
||||||
int linelength = 1;
|
int linelength = 1;
|
||||||
@@ -238,6 +252,10 @@ void write_cdata(const char *s, int length) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void write_c(const char* format,...) {
|
void write_c(const char* format,...) {
|
||||||
|
if (varused_test) {
|
||||||
|
varused = 1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
va_list args;
|
va_list args;
|
||||||
va_start(args, format);
|
va_start(args, format);
|
||||||
vfprintf(code_file, format, args);
|
vfprintf(code_file, format, args);
|
||||||
@@ -245,6 +263,7 @@ void write_c(const char* format,...) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void write_h(const char* format,...) {
|
void write_h(const char* format,...) {
|
||||||
|
if (varused_test) return;
|
||||||
va_list args;
|
va_list args;
|
||||||
va_start(args, format);
|
va_start(args, format);
|
||||||
vfprintf(header_file, format, args);
|
vfprintf(header_file, format, args);
|
||||||
|
|||||||
+24
-14
@@ -171,10 +171,20 @@ depend: $(CPPFILES)
|
|||||||
include makedepend
|
include makedepend
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
-$(RM) $(ALL) $(GLALL) core
|
$(RM) $(ALL) $(GLALL) core
|
||||||
-$(RM) *.o core.* *~ *.bck *.bak
|
$(RM) *.o core.* *~ *.bck *.bak
|
||||||
-$(RM) checkers.app/Contents/MacOS/checkers
|
$(RM) CubeViewUI.cxx
|
||||||
-$(RM) sudoku.app/Contents/MacOS/sudoku
|
$(RM) fast_slow.cxx
|
||||||
|
$(RM) inactive.cxx
|
||||||
|
$(RM) keyboard_ui.cxx
|
||||||
|
$(RM) mandelbrot_ui.cxx
|
||||||
|
$(RM) preferences.cxx
|
||||||
|
$(RM) radio.cxx
|
||||||
|
$(RM) resize.cxx
|
||||||
|
$(RM) tabs.cxx
|
||||||
|
$(RM) valuators.cxx
|
||||||
|
$(RM) checkers.app/Contents/MacOS/checkers
|
||||||
|
$(RM) sudoku.app/Contents/MacOS/sudoku
|
||||||
|
|
||||||
install: all
|
install: all
|
||||||
echo "Installing example programs to $(DESTDIR)$(docdir)/examples..."
|
echo "Installing example programs to $(DESTDIR)$(docdir)/examples..."
|
||||||
@@ -288,7 +298,7 @@ editor$(EXEEXT): editor.o
|
|||||||
$(POSTBUILD) $@ ../FL/mac.r
|
$(POSTBUILD) $@ ../FL/mac.r
|
||||||
|
|
||||||
fast_slow$(EXEEXT): fast_slow.o
|
fast_slow$(EXEEXT): fast_slow.o
|
||||||
fast_slow.cxx: fast_slow.fl
|
fast_slow.cxx: fast_slow.fl ../fluid/fluid$(EXEEXT)
|
||||||
|
|
||||||
file_chooser$(EXEEXT): file_chooser.o ../lib/$(IMGLIBNAME)
|
file_chooser$(EXEEXT): file_chooser.o ../lib/$(IMGLIBNAME)
|
||||||
echo Linking $@...
|
echo Linking $@...
|
||||||
@@ -314,7 +324,7 @@ iconize$(EXEEXT): iconize.o
|
|||||||
image$(EXEEXT): image.o
|
image$(EXEEXT): image.o
|
||||||
|
|
||||||
inactive$(EXEEXT): inactive.o
|
inactive$(EXEEXT): inactive.o
|
||||||
inactive.cxx: inactive.fl
|
inactive.cxx: inactive.fl ../fluid/fluid$(EXEEXT)
|
||||||
|
|
||||||
input$(EXEEXT): input.o
|
input$(EXEEXT): input.o
|
||||||
|
|
||||||
@@ -325,7 +335,7 @@ keyboard$(EXEEXT): keyboard_ui.o keyboard.o
|
|||||||
$(CXX) $(ARCHFLAGS) $(LDFLAGS) -o $@ keyboard.o keyboard_ui.o $(LINKFLTK) $(LDLIBS)
|
$(CXX) $(ARCHFLAGS) $(LDFLAGS) -o $@ keyboard.o keyboard_ui.o $(LINKFLTK) $(LDLIBS)
|
||||||
$(POSTBUILD) $@ ../FL/mac.r
|
$(POSTBUILD) $@ ../FL/mac.r
|
||||||
keyboard_ui.o: keyboard_ui.h
|
keyboard_ui.o: keyboard_ui.h
|
||||||
keyboard_ui.cxx: keyboard_ui.fl
|
keyboard_ui.cxx: keyboard_ui.fl ../fluid/fluid$(EXEEXT)
|
||||||
|
|
||||||
label$(EXEEXT): label.o
|
label$(EXEEXT): label.o
|
||||||
echo Linking $@...
|
echo Linking $@...
|
||||||
@@ -341,7 +351,7 @@ mandelbrot$(EXEEXT): mandelbrot_ui.o mandelbrot.o
|
|||||||
$(CXX) $(ARCHFLAGS) $(LDFLAGS) -o $@ mandelbrot.o mandelbrot_ui.o $(LINKFLTK) $(LDLIBS)
|
$(CXX) $(ARCHFLAGS) $(LDFLAGS) -o $@ mandelbrot.o mandelbrot_ui.o $(LINKFLTK) $(LDLIBS)
|
||||||
$(POSTBUILD) $@ ../FL/mac.r
|
$(POSTBUILD) $@ ../FL/mac.r
|
||||||
mandelbrot_ui.o: mandelbrot_ui.h
|
mandelbrot_ui.o: mandelbrot_ui.h
|
||||||
mandelbrot_ui.cxx: mandelbrot_ui.fl
|
mandelbrot_ui.cxx: mandelbrot_ui.fl ../fluid/fluid$(EXEEXT)
|
||||||
|
|
||||||
menubar$(EXEEXT): menubar.o
|
menubar$(EXEEXT): menubar.o
|
||||||
|
|
||||||
@@ -368,13 +378,13 @@ pixmap_browser$(EXEEXT): pixmap_browser.o ../lib/$(IMGLIBNAME)
|
|||||||
$(POSTBUILD) $@ ../FL/mac.r
|
$(POSTBUILD) $@ ../FL/mac.r
|
||||||
|
|
||||||
preferences$(EXEEXT): preferences.o
|
preferences$(EXEEXT): preferences.o
|
||||||
preferences.cxx: preferences.fl
|
preferences.cxx: preferences.fl ../fluid/fluid$(EXEEXT)
|
||||||
|
|
||||||
radio$(EXEEXT): radio.o
|
radio$(EXEEXT): radio.o
|
||||||
radio.cxx: radio.fl
|
radio.cxx: radio.fl ../fluid/fluid$(EXEEXT)
|
||||||
|
|
||||||
resize$(EXEEXT): resize.o
|
resize$(EXEEXT): resize.o
|
||||||
resize.cxx: resize.fl
|
resize.cxx: resize.fl ../fluid/fluid$(EXEEXT)
|
||||||
|
|
||||||
resizebox$(EXEEXT): resizebox.o
|
resizebox$(EXEEXT): resizebox.o
|
||||||
|
|
||||||
@@ -396,7 +406,7 @@ sudoku.exe: sudoku.o sudoku.rc
|
|||||||
symbols$(EXEEXT): symbols.o
|
symbols$(EXEEXT): symbols.o
|
||||||
|
|
||||||
tabs$(EXEEXT): tabs.o
|
tabs$(EXEEXT): tabs.o
|
||||||
tabs.cxx: tabs.fl
|
tabs.cxx: tabs.fl ../fluid/fluid$(EXEEXT)
|
||||||
|
|
||||||
threads$(EXEEXT): threads.o
|
threads$(EXEEXT): threads.o
|
||||||
# This ensures that we have this dependency even if threads are not
|
# This ensures that we have this dependency even if threads are not
|
||||||
@@ -408,7 +418,7 @@ tile$(EXEEXT): tile.o
|
|||||||
tiled_image$(EXEEXT): tiled_image.o
|
tiled_image$(EXEEXT): tiled_image.o
|
||||||
|
|
||||||
valuators$(EXEEXT): valuators.o
|
valuators$(EXEEXT): valuators.o
|
||||||
valuators.cxx: valuators.fl
|
valuators.cxx: valuators.fl ../fluid/fluid$(EXEEXT)
|
||||||
|
|
||||||
# All OpenGL demos depend on the FLTK and FLTK_GL libraries...
|
# All OpenGL demos depend on the FLTK and FLTK_GL libraries...
|
||||||
$(GLALL): ../lib/$(LIBNAME) ../lib/$(GLLIBNAME)
|
$(GLALL): ../lib/$(LIBNAME) ../lib/$(GLLIBNAME)
|
||||||
@@ -423,7 +433,7 @@ CubeView$(EXEEXT): CubeMain.o CubeView.o CubeViewUI.o
|
|||||||
CubeMain.o: CubeViewUI.h CubeView.h
|
CubeMain.o: CubeViewUI.h CubeView.h
|
||||||
CubeView.o: CubeView.h
|
CubeView.o: CubeView.h
|
||||||
CubeViewUI.o: CubeViewUI.h
|
CubeViewUI.o: CubeViewUI.h
|
||||||
CubeViewUI.cxx: CubeViewUI.fl
|
CubeViewUI.cxx: CubeViewUI.fl ../fluid/fluid$(EXEEXT)
|
||||||
|
|
||||||
cube$(EXEEXT): cube.o
|
cube$(EXEEXT): cube.o
|
||||||
echo Linking $@...
|
echo Linking $@...
|
||||||
|
|||||||
Reference in New Issue
Block a user