diff options
| author | Matthias Melcher <fltk@matthiasm.com> | 2009-10-02 19:08:55 +0000 |
|---|---|---|
| committer | Matthias Melcher <fltk@matthiasm.com> | 2009-10-02 19:08:55 +0000 |
| commit | 1238d1576b8e2bc15c097b23ebe0fdc4d3cdb527 (patch) | |
| tree | 47ee6159eb30ae6bb15722ecc91b6ee8b85bb460 /fluid/Fl_Widget_Type.cxx | |
| parent | f1ef3c10477609be6bea13f7e49d137631fa9297 (diff) | |
Very crude extension of Fluid 1 to read Fluid 2 files (and possibly write them back as Fluid 1 files, but not Fluid 2!). Also, I started a README that points out the differences between FLTK 1 and FLTK 2 and tries to give some help in designing a downward compatible FLTK 3.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@6912 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'fluid/Fl_Widget_Type.cxx')
| -rw-r--r-- | fluid/Fl_Widget_Type.cxx | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/fluid/Fl_Widget_Type.cxx b/fluid/Fl_Widget_Type.cxx index 8fe4c9edf..dc6215dec 100644 --- a/fluid/Fl_Widget_Type.cxx +++ b/fluid/Fl_Widget_Type.cxx @@ -2431,7 +2431,7 @@ void Fl_Widget_Type::write_properties() { } int pasteoffset; - +extern double read_version; void Fl_Widget_Type::read_property(const char *c) { int x,y,w,h; Fl_Font f; int s; Fl_Color cc; if (!strcmp(c,"private")) { @@ -2442,6 +2442,11 @@ void Fl_Widget_Type::read_property(const char *c) { if (sscanf(read_word(),"%d %d %d %d",&x,&y,&w,&h) == 4) { x += pasteoffset; y += pasteoffset; + // FIXME temporary change! + if (read_version>=2.0 && o->parent() && o->parent()!=o->window()) { + x += o->parent()->x(); + y += o->parent()->y(); + } o->resize(x,y,w,h); } } else if (!strcmp(c,"tooltip")) { @@ -2483,12 +2488,18 @@ void Fl_Widget_Type::read_property(const char *c) { const char* value = read_word(); ((Fl_Button*)o)->value(atoi(value)); } else if (!strcmp(c,"color")) { - int n = sscanf(read_word(),"%d %d",&x,&y); - if (n == 2) { // back compatibility... - if (x != 47) o->color(x); - o->selection_color(y); - } else { + const char *cw = read_word(); + if (cw[0]=='0' && cw[1]=='x') { + sscanf(cw,"0x%x",&x); o->color(x); + } else { + int n = sscanf(cw,"%d %d",&x,&y); + if (n == 2) { // back compatibility... + if (x != 47) o->color(x); + o->selection_color(y); + } else { + o->color(x); + } } } else if (!strcmp(c,"selection_color")) { if (sscanf(read_word(),"%d",&x)) o->selection_color(x); @@ -2553,9 +2564,12 @@ void Fl_Widget_Type::read_property(const char *c) { if (!strncmp(c,"code",4)) { int n = atoi(c+4); if (n >= 0 && n <= NUM_EXTRA_CODE) { - extra_code(n,read_word()); - return; + extra_code(n,read_word()); + return; } + } else if (!strcmp(c,"extra_code")) { + extra_code(0,read_word()); + return; } Fl_Type::read_property(c); } |
