Fluid fixes from Vincent PENNE.
git-svn-id: file:///fltk/svn/fltk/trunk@12 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
parent
45bb73a9bf
commit
255e7fb39b
@ -66,6 +66,8 @@ const char *c_check(const char *c, int type) {
|
|||||||
|
|
||||||
class Fl_Function_Type : public Fl_Type {
|
class Fl_Function_Type : public Fl_Type {
|
||||||
const char* return_type;
|
const char* return_type;
|
||||||
|
const char* actual_return_type;
|
||||||
|
const char* star;
|
||||||
char public_, constructor, havewidgets;
|
char public_, constructor, havewidgets;
|
||||||
public:
|
public:
|
||||||
Fl_Type *make();
|
Fl_Type *make();
|
||||||
@ -166,21 +168,21 @@ void Fl_Function_Type::write_code1() {
|
|||||||
Fl_Type *child;
|
Fl_Type *child;
|
||||||
const char* widget_type = 0;
|
const char* widget_type = 0;
|
||||||
for (child = next; child && child->level > level; child = child->next)
|
for (child = next; child && child->level > level; child = child->next)
|
||||||
if (child->is_widget()) {
|
if (child->is_widget() && child->level == level+1) {
|
||||||
havewidgets = 1;
|
havewidgets = 1;
|
||||||
widget_type = subclassname(child);
|
widget_type = subclassname(child);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
write_c("\n");
|
write_c("\n");
|
||||||
if (ismain())
|
if (ismain())
|
||||||
write_c("int main(int argc, char **argv) {\n");
|
write_c("int main(int argc, char **argv) {\n");
|
||||||
else {
|
else {
|
||||||
const char* t = return_type;
|
const char* t = return_type;
|
||||||
const char* star = "";
|
star = "";
|
||||||
if (!t) {
|
if (!t) {
|
||||||
if (havewidgets) {t = widget_type; star = "*";}
|
if (havewidgets) {t = widget_type; star = "*";}
|
||||||
else t = "void";
|
else t = "void";
|
||||||
}
|
}
|
||||||
|
actual_return_type=t;
|
||||||
const char* k = class_name();
|
const char* k = class_name();
|
||||||
if (k) {
|
if (k) {
|
||||||
write_public(public_);
|
write_public(public_);
|
||||||
@ -200,7 +202,7 @@ void Fl_Function_Type::write_code1() {
|
|||||||
write_c("%s%s %s {\n", t, star, name());
|
write_c("%s%s %s {\n", t, star, name());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (havewidgets) write_c(" %s* w;\n", widget_type);
|
if (havewidgets) write_c(" Fl_Window* w;\n");
|
||||||
indentation += 2;
|
indentation += 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -209,7 +211,7 @@ void Fl_Function_Type::write_code2() {
|
|||||||
if (havewidgets) write_c(" w->show(argc, argv);\n");
|
if (havewidgets) write_c(" w->show(argc, argv);\n");
|
||||||
write_c(" return Fl::run();\n");
|
write_c(" return Fl::run();\n");
|
||||||
} else if (havewidgets && !constructor)
|
} else if (havewidgets && !constructor)
|
||||||
write_c(" return w;\n");
|
write_c(" return (%s%s)w;\n", actual_return_type, star);
|
||||||
write_c("}\n");
|
write_c("}\n");
|
||||||
indentation = 0;
|
indentation = 0;
|
||||||
}
|
}
|
||||||
|
@ -512,6 +512,8 @@ void delete_all(int selected_only) {
|
|||||||
f = g;
|
f = g;
|
||||||
} else f = f->next;
|
} else f = f->next;
|
||||||
}
|
}
|
||||||
|
if(!selected_only) include_H_from_C=1;
|
||||||
|
|
||||||
selection_changed(0);
|
selection_changed(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,3 +140,5 @@ const char *c_check(const char *c, int type = 0);
|
|||||||
|
|
||||||
// replace a string pointer with new value, strips leading/trailing blanks:
|
// replace a string pointer with new value, strips leading/trailing blanks:
|
||||||
int storestring(const char *n, const char * & p, int nostrip=0);
|
int storestring(const char *n, const char * & p, int nostrip=0);
|
||||||
|
|
||||||
|
extern bool include_H_from_C;
|
||||||
|
@ -1267,7 +1267,7 @@ void Fl_Widget_Type::write_code1() {
|
|||||||
if (varused) 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()) {
|
||||||
write_c("w = new %s(%d, %d", t, o->w(), o->h());
|
write_c("new %s(%d, %d", t, o->w(), o->h());
|
||||||
// prevent type() code from being emitted:
|
// prevent type() code from being emitted:
|
||||||
((Fl_Widget_Type*)factory)->o->type(o->type());
|
((Fl_Widget_Type*)factory)->o->type(o->type());
|
||||||
} else {
|
} else {
|
||||||
@ -1279,6 +1279,7 @@ void Fl_Widget_Type::write_code1() {
|
|||||||
}
|
}
|
||||||
write_c(");\n");
|
write_c(");\n");
|
||||||
indentation += 2;
|
indentation += 2;
|
||||||
|
if (is_window()) write_c("%sw = o;\n", indent());
|
||||||
if (varused) write_widget_code();
|
if (varused) write_widget_code();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,6 +21,8 @@ int gridx = 5;
|
|||||||
int gridy = 5;
|
int gridy = 5;
|
||||||
int snap = 3;
|
int snap = 3;
|
||||||
|
|
||||||
|
bool include_H_from_C;
|
||||||
|
|
||||||
void alignment_cb(Fl_Input *i, long v) {
|
void alignment_cb(Fl_Input *i, long v) {
|
||||||
int n = atoi(i->value());
|
int n = atoi(i->value());
|
||||||
if (n < 0) n = 0;
|
if (n < 0) n = 0;
|
||||||
@ -35,7 +37,8 @@ extern const char* header_file_name;
|
|||||||
extern const char* code_file_name;
|
extern const char* code_file_name;
|
||||||
|
|
||||||
void show_alignment_cb(Fl_Widget *, void *) {
|
void show_alignment_cb(Fl_Widget *, void *) {
|
||||||
make_alignment_window();
|
if(alignment_window==0) make_alignment_window();
|
||||||
|
include_H_from_C_button->value(include_H_from_C);
|
||||||
header_file_input->value(header_file_name);
|
header_file_input->value(header_file_name);
|
||||||
code_file_input->value(code_file_name);
|
code_file_input->value(code_file_name);
|
||||||
char buf[128];
|
char buf[128];
|
||||||
@ -53,6 +56,10 @@ void code_input_cb(Fl_Input* i, void*) {
|
|||||||
printf("code file name set to %s\n", code_file_name);
|
printf("code file name set to %s\n", code_file_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void include_H_from_C_button_cb(Fl_Light_Button* b, void*) {
|
||||||
|
include_H_from_C = b->value();
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
static Fl_Menu_Item window_type_menu[] = {
|
static Fl_Menu_Item window_type_menu[] = {
|
||||||
|
@ -19,7 +19,8 @@ static void cb_OK(Fl_Return_Button* o, void*) {
|
|||||||
|
|
||||||
Fl_Window* make_about_panel(const char *copyright) {
|
Fl_Window* make_about_panel(const char *copyright) {
|
||||||
Fl_Window* w;
|
Fl_Window* w;
|
||||||
{ Fl_Window* o = about_panel = w = new Fl_Window(309, 221, "about fluid");
|
{ Fl_Window* o = about_panel = new Fl_Window(309, 221, "about fluid");
|
||||||
|
w = o;
|
||||||
o->box(FL_UP_BOX);
|
o->box(FL_UP_BOX);
|
||||||
o->color(97);
|
o->color(97);
|
||||||
o->selection_color(47);
|
o->selection_color(47);
|
||||||
|
@ -18,9 +18,12 @@ Fl_Input *header_file_input;
|
|||||||
|
|
||||||
Fl_Input *code_file_input;
|
Fl_Input *code_file_input;
|
||||||
|
|
||||||
|
Fl_Light_Button *include_H_from_C_button;
|
||||||
|
|
||||||
Fl_Window* make_alignment_window() {
|
Fl_Window* make_alignment_window() {
|
||||||
Fl_Window *w;
|
Fl_Window* w;
|
||||||
{ Fl_Window* o = alignment_window = w = new Fl_Window(210, 282, "fluid Preferences");
|
{ Fl_Window* o = alignment_window = new Fl_Window(210, 310, "fluid Preferences");
|
||||||
|
w = o;
|
||||||
{ Fl_Box* o = new Fl_Box(10, 20, 190, 100, "ALIGNMENT:");
|
{ Fl_Box* o = new Fl_Box(10, 20, 190, 100, "ALIGNMENT:");
|
||||||
o->box(FL_ENGRAVED_FRAME);
|
o->box(FL_ENGRAVED_FRAME);
|
||||||
o->labelsize(10);
|
o->labelsize(10);
|
||||||
@ -44,9 +47,8 @@ Fl_Window* make_alignment_window() {
|
|||||||
o->callback((Fl_Callback*)alignment_cb, (void*)(3));
|
o->callback((Fl_Callback*)alignment_cb, (void*)(3));
|
||||||
o->when(FL_WHEN_RELEASE|FL_WHEN_ENTER_KEY);
|
o->when(FL_WHEN_RELEASE|FL_WHEN_ENTER_KEY);
|
||||||
}
|
}
|
||||||
{ Fl_Button* o = new Fl_Button(10, 250, 190, 20, "close");
|
{ Fl_Button* o = new Fl_Button(10, 280, 190, 20, "close");
|
||||||
o->callback((Fl_Callback*)cb_close);
|
o->callback((Fl_Callback*)cb_close);
|
||||||
w->hotspot(o);
|
|
||||||
}
|
}
|
||||||
{ Fl_Box* o = new Fl_Box(10, 140, 190, 100, "OUTPUT FILE NAMES:");
|
{ Fl_Box* o = new Fl_Box(10, 140, 190, 100, "OUTPUT FILE NAMES:");
|
||||||
o->box(FL_ENGRAVED_FRAME);
|
o->box(FL_ENGRAVED_FRAME);
|
||||||
@ -67,6 +69,11 @@ Fl_Window* make_alignment_window() {
|
|||||||
o->callback((Fl_Callback*)code_input_cb, (void*)(1));
|
o->callback((Fl_Callback*)code_input_cb, (void*)(1));
|
||||||
o->when(1);
|
o->when(1);
|
||||||
}
|
}
|
||||||
|
{ Fl_Light_Button* o = include_H_from_C_button = new Fl_Light_Button(60, 250, 140, 20, "Include .H from .C");
|
||||||
|
o->value(1);
|
||||||
|
o->callback((Fl_Callback*)include_H_from_C_button_cb);
|
||||||
|
}
|
||||||
|
o->set_modal();
|
||||||
o->end();
|
o->end();
|
||||||
}
|
}
|
||||||
return w;
|
return w;
|
||||||
|
@ -8,8 +8,8 @@ snap 3
|
|||||||
Function {make_alignment_window()} {open
|
Function {make_alignment_window()} {open
|
||||||
} {
|
} {
|
||||||
Fl_Window alignment_window {
|
Fl_Window alignment_window {
|
||||||
label {fluid Preferences} open selected
|
label {fluid Preferences} open
|
||||||
xywh {303 187 210 282} visible
|
xywh {0 22 210 310} modal visible
|
||||||
} {
|
} {
|
||||||
Fl_Box {} {
|
Fl_Box {} {
|
||||||
label {ALIGNMENT:}
|
label {ALIGNMENT:}
|
||||||
@ -39,7 +39,7 @@ Function {make_alignment_window()} {open
|
|||||||
Fl_Button {} {
|
Fl_Button {} {
|
||||||
label close
|
label close
|
||||||
callback {alignment_window->hide();}
|
callback {alignment_window->hide();}
|
||||||
xywh {10 250 190 20} hotspot
|
xywh {10 280 190 20}
|
||||||
}
|
}
|
||||||
Fl_Box {} {
|
Fl_Box {} {
|
||||||
label {OUTPUT FILE NAMES:}
|
label {OUTPUT FILE NAMES:}
|
||||||
@ -61,5 +61,10 @@ Function {make_alignment_window()} {open
|
|||||||
callback code_input_cb
|
callback code_input_cb
|
||||||
xywh {90 210 100 20} box THIN_DOWN_BOX when 1
|
xywh {90 210 100 20} box THIN_DOWN_BOX when 1
|
||||||
}
|
}
|
||||||
|
Fl_Light_Button include_H_from_C_button {
|
||||||
|
label {Include .H from .C}
|
||||||
|
callback include_H_from_C_button_cb
|
||||||
|
xywh {60 250 140 20} value 1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,14 +4,17 @@
|
|||||||
#include <FL/Fl_Box.H>
|
#include <FL/Fl_Box.H>
|
||||||
#include <FL/Fl_Button.H>
|
#include <FL/Fl_Button.H>
|
||||||
#include <FL/Fl_Input.H>
|
#include <FL/Fl_Input.H>
|
||||||
|
#include <FL/Fl_Light_Button.H>
|
||||||
#include <FL/Fl_Window.H>
|
#include <FL/Fl_Window.H>
|
||||||
extern void alignment_cb(Fl_Input*, long);
|
extern void alignment_cb(Fl_Input*, long);
|
||||||
extern void code_input_cb(Fl_Input*, void*);
|
extern void code_input_cb(Fl_Input*, void*);
|
||||||
extern void header_input_cb(Fl_Input*, void*);
|
extern void header_input_cb(Fl_Input*, void*);
|
||||||
|
extern void include_H_from_C_button_cb(Fl_Light_Button*, void*);
|
||||||
extern Fl_Window *alignment_window;
|
extern Fl_Window *alignment_window;
|
||||||
extern Fl_Input *horizontal_input;
|
extern Fl_Input *horizontal_input;
|
||||||
extern Fl_Input *vertical_input;
|
extern Fl_Input *vertical_input;
|
||||||
extern Fl_Input *snap_input;
|
extern Fl_Input *snap_input;
|
||||||
extern Fl_Input *header_file_input;
|
extern Fl_Input *header_file_input;
|
||||||
extern Fl_Input *code_file_input;
|
extern Fl_Input *code_file_input;
|
||||||
|
extern Fl_Light_Button *include_H_from_C_button;
|
||||||
Fl_Window* make_alignment_window();
|
Fl_Window* make_alignment_window();
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
#include <FL/Fl.H>
|
#include <FL/Fl.H>
|
||||||
#include "Fl_Type.H"
|
#include "Fl_Type.H"
|
||||||
|
#include "alignment_panel.H"
|
||||||
|
|
||||||
static FILE *code_file;
|
static FILE *code_file;
|
||||||
static FILE *header_file;
|
static FILE *header_file;
|
||||||
@ -240,7 +241,8 @@ int write_code(const char *s, const char *t) {
|
|||||||
for (p = Fl_Type::first; p; p = p->next) p->write_declare();
|
for (p = Fl_Type::first; p; p = p->next) p->write_declare();
|
||||||
delete included_root; included_root = 0;
|
delete included_root; included_root = 0;
|
||||||
|
|
||||||
if (t) write_c("#include \"%s\"\n", filename_name(t));
|
if (t && include_H_from_C)
|
||||||
|
write_c("#include \"%s\"\n", filename_name(t));
|
||||||
for (p = Fl_Type::first; p; p = p->next) p->write_static();
|
for (p = Fl_Type::first; p; p = p->next) p->write_static();
|
||||||
for (p = Fl_Type::first; p;) p = write_code(p);
|
for (p = Fl_Type::first; p;) p = write_code(p);
|
||||||
|
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
#include "alignment_panel.H"
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////
|
||||||
// BASIC FILE WRITING:
|
// BASIC FILE WRITING:
|
||||||
@ -298,6 +299,8 @@ int write_file(const char *filename, int selected_only) {
|
|||||||
if (!open_write(filename)) return 0;
|
if (!open_write(filename)) return 0;
|
||||||
write_string("# data file for the Fltk User Interface Designer (fluid)\n"
|
write_string("# data file for the Fltk User Interface Designer (fluid)\n"
|
||||||
"version %.2f",FL_VERSION);
|
"version %.2f",FL_VERSION);
|
||||||
|
if(!include_H_from_C)
|
||||||
|
write_string("\ndo_not_include_H_from_C");
|
||||||
if (!selected_only) {
|
if (!selected_only) {
|
||||||
write_string("\nheader_name"); write_word(header_file_name);
|
write_string("\nheader_name"); write_word(header_file_name);
|
||||||
write_string("\ncode_name"); write_word(code_file_name);
|
write_string("\ncode_name"); write_word(code_file_name);
|
||||||
@ -365,6 +368,11 @@ static void read_children(Fl_Type *p, int paste) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!strcmp(c,"do_not_include_H_from_C"))
|
||||||
|
{
|
||||||
|
include_H_from_C=0;
|
||||||
|
goto CONTINUE;
|
||||||
|
}
|
||||||
if (!strcmp(c,"header_name")) {
|
if (!strcmp(c,"header_name")) {
|
||||||
header_file_name = strdup(read_word());
|
header_file_name = strdup(read_word());
|
||||||
goto CONTINUE;
|
goto CONTINUE;
|
||||||
|
@ -365,6 +365,7 @@ int main(int argc,char **argv) {
|
|||||||
}
|
}
|
||||||
const char *c = argv[i];
|
const char *c = argv[i];
|
||||||
make_main_window();
|
make_main_window();
|
||||||
|
include_H_from_C=1;
|
||||||
if (c) set_filename(c);
|
if (c) set_filename(c);
|
||||||
if (!compile_only) {
|
if (!compile_only) {
|
||||||
Fl::visual((Fl_Mode)(FL_DOUBLE|FL_INDEX));
|
Fl::visual((Fl_Mode)(FL_DOUBLE|FL_INDEX));
|
||||||
|
@ -5,8 +5,9 @@
|
|||||||
Fl_Input *v_input[4];
|
Fl_Input *v_input[4];
|
||||||
|
|
||||||
Fl_Window* make_widget_panel() {
|
Fl_Window* make_widget_panel() {
|
||||||
Fl_Window *w;
|
Fl_Window* w;
|
||||||
{ Fl_Window* o = w = new Fl_Window(370, 480);
|
{ Fl_Window* o = new Fl_Window(370, 480);
|
||||||
|
w = o;
|
||||||
w->hotspot(o);
|
w->hotspot(o);
|
||||||
{ Fl_Input* o = new Fl_Input(90, 10, 210, 20, "name:");
|
{ Fl_Input* o = new Fl_Input(90, 10, 210, 20, "name:");
|
||||||
o->box(FL_THIN_UP_BOX);
|
o->box(FL_THIN_UP_BOX);
|
||||||
|
@ -62,7 +62,7 @@ void Fl_Window::cursor(Fl_Cursor c, Fl_Color, Fl_Color) {
|
|||||||
|
|
||||||
#define CURSORSIZE 16
|
#define CURSORSIZE 16
|
||||||
#define HOTXY 7
|
#define HOTXY 7
|
||||||
struct TableEntry {
|
static struct TableEntry {
|
||||||
uchar bits[CURSORSIZE*CURSORSIZE/8];
|
uchar bits[CURSORSIZE*CURSORSIZE/8];
|
||||||
uchar mask[CURSORSIZE*CURSORSIZE/8];
|
uchar mask[CURSORSIZE*CURSORSIZE/8];
|
||||||
Cursor cursor;
|
Cursor cursor;
|
||||||
|
Loading…
Reference in New Issue
Block a user