FLUID: Adds image scaling to widget dialog

This commit is contained in:
Matthias Melcher
2023-12-14 23:37:05 +01:00
parent 33d0718756
commit 14f4dec0b9
8 changed files with 863 additions and 147 deletions
+72 -10
View File
@@ -151,8 +151,17 @@ void Fl_Widget_Type::setimage(Fluid_Image *i) {
if (image) image->decrement();
if (i) i->increment();
image = i;
if (i) i->image(o);
else o->image(0);
if (i) {
i->image(o);
if (o->image() && (scale_image_w_ || scale_image_h_)) {
int iw = scale_image_w_>0 ? scale_image_w_ : o->image()->data_w();
int ih = scale_image_h_>0 ? scale_image_h_ : o->image()->data_h();
o->image()->scale(iw, ih, 0, 1);
}
} else {
o->image(0);
//scale_image_w_ = scale_image_h_ = 0;
}
redraw();
}
@@ -161,8 +170,17 @@ void Fl_Widget_Type::setinactive(Fluid_Image *i) {
if (inactive) inactive->decrement();
if (i) i->increment();
inactive = i;
if (i) i->deimage(o);
else o->deimage(0);
if (i) {
i->deimage(o);
if (o->deimage()) {
int iw = scale_deimage_w_>0 ? scale_deimage_w_ : o->deimage()->data_w();
int ih = scale_deimage_h_>0 ? scale_deimage_h_ : o->deimage()->data_h();
o->deimage()->scale(iw, ih, 0, 1);
}
} else {
o->deimage(0);
//scale_deimage_w_ = scale_deimage_h_ = 0;
}
redraw();
}
@@ -188,6 +206,10 @@ Fl_Widget_Type::Fl_Widget_Type()
compress_image_ = 1;
bind_deimage_ = 0;
compress_deimage_ = 1;
scale_image_w_ = 0;
scale_image_h_ = 0;
scale_deimage_w_ = 0;
scale_deimage_h_ = 0;
}
Fl_Widget_Type::~Fl_Widget_Type() {
@@ -457,7 +479,7 @@ void image_browse_cb(Fl_Button* b, void *v) {
}
}
void bind_image_cb(Fl_Button* b, void *v) {
void bind_image_cb(Fl_Check_Button* b, void *v) {
if (v == LOAD) {
if (current_widget->is_widget() && !current_widget->is_a(ID_Window)) {
b->activate();
@@ -477,7 +499,7 @@ void bind_image_cb(Fl_Button* b, void *v) {
}
}
void compress_image_cb(Fl_Button* b, void *v) {
void compress_image_cb(Fl_Check_Button* b, void *v) {
if (v == LOAD) {
if (current_widget->is_widget() && !current_widget->is_a(ID_Window)) {
b->activate();
@@ -539,7 +561,7 @@ void inactive_browse_cb(Fl_Button* b, void *v) {
}
}
void bind_deimage_cb(Fl_Button* b, void *v) {
void bind_deimage_cb(Fl_Check_Button* b, void *v) {
if (v == LOAD) {
if (current_widget->is_widget() && !current_widget->is_a(ID_Window)) {
b->activate();
@@ -559,7 +581,7 @@ void bind_deimage_cb(Fl_Button* b, void *v) {
}
}
void compress_deimage_cb(Fl_Button* b, void *v) {
void compress_deimage_cb(Fl_Check_Button* b, void *v) {
if (v == LOAD) {
if (current_widget->is_widget() && !current_widget->is_a(ID_Window)) {
b->activate();
@@ -3109,8 +3131,34 @@ void Fl_Widget_Type::write_widget_code(Fd_Code_Writer& f) {
write_color(f, "color", o->color());
if (o->selection_color() != tplate->selection_color() || subclass())
write_color(f, "selection_color", o->selection_color());
if (image) image->write_code(f, bind_image_, var);
if (inactive) inactive->write_code(f, bind_deimage_, var, 1);
if (image) {
image->write_code(f, bind_image_, var);
if (scale_image_w_ || scale_image_h_) {
f.write_c("%s%s->image()->scale(", f.indent(), var);
if (scale_image_w_>0)
f.write_c("%d, ", scale_image_w_);
else
f.write_c("%s->image()->data_w(), ", var);
if (scale_image_h_>0)
f.write_c("%d, 0, 1);\n", scale_image_h_);
else
f.write_c("%s->image()->data_h(), 0, 1);\n", var);
}
}
if (inactive) {
inactive->write_code(f, bind_deimage_, var, 1);
if (scale_deimage_w_ || scale_deimage_h_) {
f.write_c("%s%s->deimage()->scale(", f.indent(), var);
if (scale_deimage_w_>0)
f.write_c("%d, ", scale_deimage_w_);
else
f.write_c("%s->deimage()->data_w(), ", var);
if (scale_deimage_h_>0)
f.write_c("%d, 0, 1);\n", scale_deimage_h_);
else
f.write_c("%s->deimage()->data_h(), 0, 1);\n", var);
}
}
if (o->labeltype() != tplate->labeltype() || subclass())
f.write_c("%s%s->labeltype(FL_%s);\n", f.indent(), var,
item_name(labeltypemenu, o->labeltype()));
@@ -3232,12 +3280,16 @@ void Fl_Widget_Type::write_properties(Fd_Project_Writer &f) {
f.write_word(tooltip());
}
if (image_name() && *image_name()) {
if (scale_image_w_ || scale_image_h_)
f.write_string("scale_image {%d %d}", scale_image_w_, scale_image_h_);
f.write_string("image");
f.write_word(image_name());
f.write_string("compress_image %d", compress_image_);
}
if (bind_image_) f.write_string("bind_image 1");
if (inactive_name() && *inactive_name()) {
if (scale_deimage_w_ || scale_deimage_h_)
f.write_string("scale_deimage {%d %d}", scale_deimage_w_, scale_deimage_h_);
f.write_string("deimage");
f.write_word(inactive_name());
f.write_string("compress_deimage %d", compress_deimage_);
@@ -3361,6 +3413,11 @@ void Fl_Widget_Type::read_property(Fd_Project_Reader &f, const char *c) {
}
} else if (!strcmp(c,"tooltip")) {
tooltip(f.read_word());
} else if (!strcmp(c,"scale_image")) {
if (sscanf(f.read_word(),"%d %d",&w,&h) == 2) {
scale_image_w_ = w;
scale_image_h_ = h;
}
} else if (!strcmp(c,"image")) {
image_name(f.read_word());
// starting in 2023, `image` is always followed by `compress_image`
@@ -3374,6 +3431,11 @@ void Fl_Widget_Type::read_property(Fd_Project_Reader &f, const char *c) {
bind_image_ = (int)atol(f.read_word());
} else if (!strcmp(c,"compress_image")) {
compress_image_ = (int)atol(f.read_word());
} else if (!strcmp(c,"scale_deimage")) {
if (sscanf(f.read_word(),"%d %d",&w,&h) == 2) {
scale_deimage_w_ = w;
scale_deimage_h_ = h;
}
} else if (!strcmp(c,"deimage")) {
inactive_name(f.read_word());
// starting in 2023, `deimage` is always followed by `compress_deimage`
+2
View File
@@ -76,6 +76,8 @@ public:
int compress_image_;
int bind_deimage_;
int compress_deimage_;
int scale_image_w_, scale_image_h_;
int scale_deimage_w_, scale_deimage_h_;
Fluid_Image *image;
void setimage(Fluid_Image *);
+2
View File
@@ -439,9 +439,11 @@ Type "Fl_Widget" <word> : C++ variable name
none or "private" or "protected" : default is public
"xywh" <word> : "{%d %d %d %d}" x, y, w, h
"tooltip" <word> : tooltip text
"scale_image <word>: "{%d %d}" width, height, default is 0, 0
"image" <word> : image name
"compress_image" <word> : integer (1.4 and up, only if `image` is set)
"bind_image" <word> : integer (1.4 and up)
"scale_deimage <word>: "{%d %d}" width, height, default is 0, 0
"deimage" <word> : deactivated image name
"compress_deimage" <word> : integer (1.4 and up, only if `deimage` is set)
"bind_deimage" <word> : integer (1.4 and up)
+9 -9
View File
@@ -2207,6 +2207,7 @@ Fl_Double_Window* make_settings_window() {
w_settings_tabs->callback((Fl_Callback*)cb_w_settings_tabs);
{ Fl_Group* o = new Fl_Group(10, 60, 320, 480, "General");
o->image( image_general_64() );
o->image()->scale(36, 24, 0, 1);
o->labelsize(11);
{ Fl_Group* o = new Fl_Group(120, 78, 130, 25);
o->callback((Fl_Callback*)cb_);
@@ -2347,12 +2348,12 @@ th a dim outline in the editing window only");
o->hide();
Fl_Group::current()->resizable(o);
} // Fl_Box* o
o->image()->scale(36, 24);
o->end();
Fl_Group::current()->resizable(o);
} // Fl_Group* o
{ Fl_Group* o = w_settings_project_tab = new Fl_Group(10, 60, 320, 480, "Project");
{ w_settings_project_tab = new Fl_Group(10, 60, 320, 480, "Project");
w_settings_project_tab->image( image_document_64() );
w_settings_project_tab->image()->scale(36, 24, 0, 1);
w_settings_project_tab->labelsize(11);
w_settings_project_tab->callback((Fl_Callback*)cb_w_settings_project_tab);
w_settings_project_tab->hide();
@@ -2438,11 +2439,11 @@ itional data in code and project files.");
o->hide();
Fl_Group::current()->resizable(o);
} // Fl_Box* o
o->image()->scale(36, 24);
w_settings_project_tab->end();
} // Fl_Group* w_settings_project_tab
{ Fl_Group* o = w_settings_layout_tab = new Fl_Group(10, 60, 320, 480, "Layout");
{ w_settings_layout_tab = new Fl_Group(10, 60, 320, 480, "Layout");
w_settings_layout_tab->image( image_layout_64() );
w_settings_layout_tab->image()->scale(36, 24, 0, 1);
w_settings_layout_tab->labelsize(11);
w_settings_layout_tab->callback((Fl_Callback*)cb_w_settings_layout_tab);
w_settings_layout_tab->hide();
@@ -2762,11 +2763,11 @@ itional data in code and project files.");
o->hide();
Fl_Group::current()->resizable(o);
} // Fl_Box* o
o->image()->scale(36, 24);
w_settings_layout_tab->end();
} // Fl_Group* w_settings_layout_tab
{ Fl_Group* o = w_settings_shell_tab = new Fl_Group(10, 60, 320, 480, "Shell");
{ w_settings_shell_tab = new Fl_Group(10, 60, 320, 480, "Shell");
w_settings_shell_tab->image( image_shell_64() );
w_settings_shell_tab->image()->scale(36, 24, 0, 1);
w_settings_shell_tab->labelsize(11);
w_settings_shell_tab->callback((Fl_Callback*)propagate_load);
w_settings_shell_tab->hide();
@@ -2981,11 +2982,11 @@ le");
w_settings_shell_fd_user->deactivate();
o->image()->scale(16, 16);
} // Fl_Box* w_settings_shell_fd_user
o->image()->scale(36, 24);
w_settings_shell_tab->end();
} // Fl_Group* w_settings_shell_tab
{ Fl_Group* o = w_settings_i18n_tab = new Fl_Group(10, 60, 320, 480, "Locale");
{ w_settings_i18n_tab = new Fl_Group(10, 60, 320, 480, "Locale");
w_settings_i18n_tab->image( image_language_64() );
w_settings_i18n_tab->image()->scale(36, 24, 0, 1);
w_settings_i18n_tab->labelsize(11);
w_settings_i18n_tab->callback((Fl_Callback*)cb_w_settings_i18n_tab);
w_settings_i18n_tab->hide();
@@ -3096,7 +3097,6 @@ le FLTK_GETTEXT_FOUND");
o->hide();
Fl_Group::current()->resizable(o);
} // Fl_Box* o
o->image()->scale(36, 24);
w_settings_i18n_tab->end();
} // Fl_Group* w_settings_i18n_tab
w_settings_tabs->end();
+5 -10
View File
@@ -157,8 +157,7 @@ Function {make_settings_window()} {open
} {
Fl_Group {} {
label General open selected
image {icons/general_64.png} compress_image 1 xywh {10 60 320 480} labelsize 11 resizable
code0 {o->image()->scale(36, 24);}
scale_image {36 24} image {icons/general_64.png} compress_image 1 xywh {10 60 320 480} labelsize 11 resizable
} {
Fl_Group {} {
callback {propagate_load(o, v);} open
@@ -293,8 +292,7 @@ Examples:
Fl_Group w_settings_project_tab {
label Project
callback {propagate_load(o, v);} open
image {icons/document_64.png} compress_image 1 xywh {10 60 320 480} labelsize 11 hide
code0 {o->image()->scale(36, 24);}
scale_image {36 24} image {icons/document_64.png} compress_image 1 xywh {10 60 320 480} labelsize 11 hide
} {
Fl_Group {} {open
xywh {100 78 220 30}
@@ -410,8 +408,7 @@ or just ".ext" to set extension.}
Fl_Group w_settings_layout_tab {
label Layout
callback {propagate_load(o, v);} open
image {icons/layout_64.png} compress_image 1 xywh {10 60 320 480} labelsize 11 hide
code0 {o->image()->scale(36, 24);}
scale_image {36 24} image {icons/layout_64.png} compress_image 1 xywh {10 60 320 480} labelsize 11 hide
} {
Fl_Box {} {
label {Layout:}
@@ -856,8 +853,7 @@ g_layout_list.update_dialogs();}
Fl_Group w_settings_shell_tab {
label Shell
callback propagate_load open
image {icons/shell_64.png} compress_image 1 xywh {10 60 320 480} labelsize 11 hide
code0 {o->image()->scale(36, 24);}
scale_image {36 24} image {icons/shell_64.png} compress_image 1 xywh {10 60 320 480} labelsize 11 hide
} {
Fl_Group {} {
callback propagate_load open
@@ -1483,8 +1479,7 @@ if (v == LOAD) {
Fl_Group w_settings_i18n_tab {
label Locale
callback {propagate_load(o, v);} open
image {icons/language_64.png} compress_image 1 xywh {10 60 320 480} labelsize 11 hide
code0 {o->image()->scale(36, 24);}
scale_image {36 24} image {icons/language_64.png} compress_image 1 xywh {10 60 320 480} labelsize 11 hide
} {
Fl_Group {} {
callback propagate_load open
+441 -68
View File
File diff suppressed because it is too large Load Diff
+308 -40
View File
@@ -43,12 +43,299 @@ decl {\#include "custom_widgets.h"} {public global
decl {extern void set_modflag(int mf, int mfc=-1);} {private local
}
Function {make_image_panel()} {
comment {Create a panel for editing widget image data} open
} {
Fl_Window image_panel_window {
label {Image Options}
callback {propagate_load(o, v);} open
xywh {527 684 260 332} type Double modal visible
} {
Fl_Group image_panel_imagegroup {
callback propagate_load open
xywh {10 15 235 125}
} {
Fl_Box {} {
label { ---- Active Image ----}
xywh {75 15 170 20} labelfont 1 labelsize 11 align 20
}
Fl_Box image_panel_data {
label {... x ... pixels, ...}
callback {if (v == LOAD) {
Fl_Shared_Image *img = Fl_Shared_Image::get(widget_image_input->value());
o->user_data(img);
if (img) {
char buf[256];
snprintf(buf, 255, "%d x %d pixels, %d channels", img->data_w(), img->data_h(), img->d());
o->copy_label(buf);
image_panel_imagegroup->activate();
} else if (widget_image_input->value() && widget_image_input->value()[0]) {
o->label("Can't load image");
image_panel_imagegroup->activate();
} else {
o->label("... x ... pixels, ...");
image_panel_imagegroup->deactivate();
}
}}
xywh {75 35 170 20} labelsize 11 align 20
code0 {\#include <FL/Fl_Shared_Image.H>}
}
Fl_Group {} {
callback propagate_load open
xywh {75 75 170 20}
} {
Fl_Input image_panel_imagew {
label {Width:}
callback {if (v == LOAD) {
if (current_widget->is_widget() && !current_widget->is_a(ID_Window)) {
o->value(current_widget->scale_image_w_);
}
} else {
int mod = 0;
for (Fl_Type *t = Fl_Type::first; t; t = t->next) {
if (t->selected && t->is_widget()) {
Fl_Widget_Type* wt = ((Fl_Widget_Type*)t);
wt->scale_image_w_ = o->value();
Fl_Image *img = wt->o->image();
if (img) {
int iw = wt->scale_image_w_;
if (iw<=0) iw = img->data_w();
int ih = wt->scale_image_h_;
if (ih<=0) ih = img->data_w();
img->scale(iw, ih, 0, 1);
wt->o->redraw();
if (wt->o->parent()) wt->o->parent()->redraw();
}
mod = 1;
}
}
if (mod) set_modflag(1);
}}
tooltip {Scale image to this width in pixel units} xywh {75 75 55 20} labelsize 11 align 5 textsize 11
class Fluid_Coord_Input
}
Fl_Input image_panel_imageh {
label {Height:}
callback {if (v == LOAD) {
if (current_widget->is_widget() && !current_widget->is_a(ID_Window)) {
o->value(current_widget->scale_image_h_);
}
} else {
int mod = 0;
for (Fl_Type *t = Fl_Type::first; t; t = t->next) {
if (t->selected && t->is_widget()) {
Fl_Widget_Type* wt = ((Fl_Widget_Type*)t);
wt->scale_image_h_ = o->value();
Fl_Image *img = wt->o->image();
if (img) {
int iw = wt->scale_image_w_;
if (iw<=0) iw = img->data_w();
int ih = wt->scale_image_h_;
if (ih<=0) ih = img->data_w();
img->scale(iw, ih, 0, 1);
wt->o->redraw();
if (wt->o->parent()) wt->o->parent()->redraw();
}
mod = 1;
}
}
if (mod) set_modflag(1);
}}
tooltip {Scale image to this height in pixel units} xywh {135 75 55 20} labelsize 11 align 5 textsize 11
class Fluid_Coord_Input
}
Fl_Button {} {
label Reset
callback {if (v != LOAD) {
image_panel_imagew->value(0);
image_panel_imageh->value(0);
image_panel_imagew->do_callback();
image_panel_imageh->do_callback();
}}
tooltip {Reset scale to original size} xywh {195 75 50 20} labelsize 11
}
}
Fl_Box {} {
label {Scale:}
xywh {10 75 60 20} labelfont 1 labelsize 11 align 24
}
Fl_Box {} {
label {Storage:}
xywh {10 100 60 20} labelfont 1 labelsize 11 align 24
}
Fl_Check_Button {} {
label compressed
callback compress_image_cb
tooltip {store image uncompressed as RGBA data
or compressed in the original file format} xywh {75 100 170 20} down_box DOWN_BOX labelsize 11
}
Fl_Check_Button {} {
label {bind to widget}
callback bind_image_cb
tooltip {bind the image to the widget, so it will be deleted automatically} xywh {75 120 170 20} down_box DOWN_BOX labelsize 11 hotspot
}
}
Fl_Group image_panel_deimagegroup {
callback propagate_load open
xywh {10 155 235 125}
} {
Fl_Box {} {
label { ---- Inactive Image ----}
xywh {75 155 170 20} labelfont 1 labelsize 11 align 20
}
Fl_Box image_panel_dedata {
label {... x ... pixels, ...}
callback {if (v == LOAD) {
Fl_Shared_Image *img = Fl_Shared_Image::get(widget_deimage_input->value());
o->user_data(img);
if (img) {
char buf[256];
snprintf(buf, 255, "%d x %d pixels, %d channels", img->data_w(), img->data_h(), img->d());
o->copy_label(buf);
image_panel_deimagegroup->activate();
} else if (widget_deimage_input->value() && widget_deimage_input->value()[0]) {
o->label("Can't load image");
image_panel_deimagegroup->activate();
} else {
o->label("... x ... pixels, ...");
image_panel_deimagegroup->deactivate();
}
}}
xywh {75 175 170 20} labelsize 11 align 20
}
Fl_Group {} {
callback propagate_load open
xywh {75 215 170 20}
} {
Fl_Input image_panel_deimagew {
label {Width:}
callback {if (v == LOAD) {
if (current_widget->is_widget() && !current_widget->is_a(ID_Window)) {
o->value(current_widget->scale_deimage_w_);
}
} else {
int mod = 0;
for (Fl_Type *t = Fl_Type::first; t; t = t->next) {
if (t->selected && t->is_widget()) {
Fl_Widget_Type* wt = ((Fl_Widget_Type*)t);
wt->scale_deimage_w_ = o->value();
Fl_Image *img = wt->o->deimage();
if (img) {
int iw = wt->scale_deimage_w_;
if (iw<=0) iw = img->data_w();
int ih = wt->scale_deimage_h_;
if (ih<=0) ih = img->data_w();
img->scale(iw, ih, 0, 1);
wt->o->redraw();
if (wt->o->parent()) wt->o->parent()->redraw();
}
mod = 1;
}
}
if (mod) set_modflag(1);
}}
tooltip {Scale image to this width in pixel units} xywh {75 215 55 20} labelsize 11 align 5 textsize 11
class Fluid_Coord_Input
}
Fl_Input image_panel_deimageh {
label {Height:}
callback {if (v == LOAD) {
if (current_widget->is_widget() && !current_widget->is_a(ID_Window)) {
o->value(current_widget->scale_deimage_h_);
}
} else {
int mod = 0;
for (Fl_Type *t = Fl_Type::first; t; t = t->next) {
if (t->selected && t->is_widget()) {
Fl_Widget_Type* wt = ((Fl_Widget_Type*)t);
wt->scale_deimage_h_ = o->value();
Fl_Image *img = wt->o->deimage();
if (img) {
int iw = wt->scale_deimage_w_;
if (iw<=0) iw = img->data_w();
int ih = wt->scale_deimage_h_;
if (ih<=0) ih = img->data_w();
img->scale(iw, ih, 0, 1);
wt->o->redraw();
if (wt->o->parent()) wt->o->parent()->redraw();
}
mod = 1;
}
}
if (mod) set_modflag(1);
}}
tooltip {Scale image to this height in pixel units} xywh {135 215 55 20} labelsize 11 align 5 textsize 11
class Fluid_Coord_Input
}
Fl_Button {} {
label Reset
callback {if (v != LOAD) {
image_panel_deimagew->value(0);
image_panel_deimageh->value(0);
image_panel_deimagew->do_callback();
image_panel_deimageh->do_callback();
}}
tooltip {Reset scale to original size} xywh {195 215 50 20} labelsize 11
}
}
Fl_Box {} {
label {Scale:}
xywh {10 215 60 20} labelfont 1 labelsize 11 align 24
}
Fl_Box {} {
label {Storage:}
xywh {10 240 60 20} labelfont 1 labelsize 11 align 24
}
Fl_Check_Button {} {
label compressed
callback compress_deimage_cb
tooltip {store image uncompressed as RGBA data
or compressed in the original file format} xywh {75 240 170 20} down_box DOWN_BOX labelsize 11
}
Fl_Check_Button {} {
label {bind to widget}
callback bind_deimage_cb
tooltip {bind the image to the widget, so it will be deleted automatically} xywh {75 260 170 20} down_box DOWN_BOX labelsize 11
}
}
Fl_Button image_panel_close {
label Close
callback {if (v != LOAD)
image_panel_window->hide();}
xywh {165 295 80 20} labelsize 11
}
}
}
Function {run_image_panel()} {open return_type void
} {
code {if (!image_panel_window)
make_image_panel();
image_panel_window->do_callback(image_panel_window, LOAD);
Fl::pushed(0);
Fl_Window *g = Fl::grab();
if (g) Fl::grab(0);
image_panel_window->show();
while (image_panel_window->shown())
Fl::wait();
if (g)
Fl::grab(g);
Fl_Shared_Image *img = (Fl_Shared_Image*)image_panel_data->user_data();
if (img) {
img->release();
image_panel_data->user_data(NULL);
}} {}
}
Function {make_widget_panel()} {
comment {Create a panel that can be used with all known widgets} open
} {
Fl_Window {} {
comment {Use a Double Window to avoid flickering.} open
xywh {430 248 420 400} type Double labelsize 11 align 80 resizable hotspot
xywh {160 297 420 400} type Double labelsize 11 align 80 resizable hotspot
code0 {o->size_range(o->w(), o->h());} size_range {420 400 0 0} visible
} {
Fl_Tabs widget_tabs {
@@ -58,8 +345,8 @@ Function {make_widget_panel()} {
} {
Fl_Group {} {
label GUI
callback propagate_load
xywh {10 30 400 330} labelsize 11 when 0 hide resizable
callback propagate_load open
xywh {10 30 400 330} labelsize 11 when 0 resizable
} {
Fl_Group {} {
label {Label:}
@@ -83,27 +370,21 @@ Use Ctrl-J for newlines.} xywh {95 40 190 20} labelfont 1 labelsize 11 when 15 t
callback propagate_load open
xywh {95 65 309 20} labelfont 1 labelsize 11 align 4
} {
Fl_Input {} {
Fl_Input widget_image_input {
callback image_cb
tooltip {The active image for the widget.} xywh {95 65 200 20} labelfont 1 labelsize 11 textsize 11 resizable
}
Fl_Button {} {
label {Browse...}
callback image_browse_cb
tooltip {Click to choose the active image.} xywh {295 65 69 20} labelsize 11
callback image_browse_cb selected
tooltip {Click to choose the active image.} xywh {295 65 89 20} labelsize 11 align 256
}
Fl_Button {} {
callback compress_image_cb
tooltip {store image uncompressed as RGBA data
or compressed in the original file format} xywh {364 65 20 20} type Toggle
code0 {o->image(compressed_pixmap);}
code3 {\#include "pixmaps.h"}
}
Fl_Button {} {
callback bind_image_cb
tooltip {bind the image to the widget, so it will be deleted automatically} xywh {384 65 20 20} type Toggle
code0 {o->image(bind_pixmap);}
code3 {\#include "pixmaps.h"}
label {...}
callback {if (v != LOAD) {
run_image_panel();
}}
tooltip {more image options} bind_image 1 xywh {384 65 20 20}
}
}
Fl_Group {} {
@@ -111,27 +392,14 @@ or compressed in the original file format} xywh {364 65 20 20} type Toggle
callback propagate_load open
xywh {95 90 309 20} labelfont 1 labelsize 11 align 4
} {
Fl_Input {} {
Fl_Input widget_deimage_input {
callback inactive_cb
tooltip {The inactive image for the widget.} xywh {95 90 200 20} labelfont 1 labelsize 11 textsize 11 resizable
}
Fl_Button {} {
label {Browse...}
callback inactive_browse_cb
tooltip {Click to choose the inactive image.} xywh {295 90 69 20} labelsize 11
}
Fl_Button {} {
callback compress_deimage_cb
tooltip {store image uncompressed as RGBA data
or compressed in the original file format} xywh {364 90 20 20} type Toggle
code0 {o->image(compressed_pixmap);}
code3 {\#include "pixmaps.h"}
}
Fl_Button {} {
callback bind_deimage_cb
tooltip {bind the image to the widget, so it will be deleted automatically} xywh {384 90 20 20} type Toggle
code0 {o->image(bind_pixmap);}
code3 {\#include "pixmaps.h"}
tooltip {Click to choose the inactive image.} xywh {295 90 89 20} labelsize 11
}
}
Fl_Group {} {
@@ -835,7 +1103,7 @@ wCallback->do_callback(wCallback, v);} open
Fl_Group widget_tab_grid_child {
label {Grid Child}
callback propagate_load open
xywh {10 30 400 330} labelsize 11
xywh {10 30 400 330} labelsize 11 hide
} {
Fl_Group {} {
label {Location:}
@@ -903,7 +1171,7 @@ wCallback->do_callback(wCallback, v);} open
} else if (!g->cell(child)) {
widget_grid_unlinked->show();
}
}} selected
}}
xywh {250 60 80 20} labelsize 11 labelcolor 1
}
Fl_Box widget_grid_unlinked {
@@ -914,7 +1182,7 @@ wCallback->do_callback(wCallback, v);} open
Fl_Group {} {
label {Align:}
callback propagate_load open
xywh {95 90 315 30} labelfont 1 labelsize 11 align 4
xywh {95 100 315 20} labelfont 1 labelsize 11 align 4
} {
Fl_Choice {} {
label Horizontal
@@ -969,13 +1237,13 @@ wCallback->do_callback(wCallback, v);} open
}
}
Fl_Box {} {
xywh {395 90 1 20} hide resizable
xywh {395 100 1 20} hide resizable
}
}
Fl_Group {} {
label {Min. Size:}
callback propagate_load open
xywh {95 125 315 30} labelfont 1 labelsize 11 align 4
xywh {95 135 315 20} labelfont 1 labelsize 11 align 4
} {
Fl_Input {} {
label {Width:}
@@ -990,13 +1258,13 @@ wCallback->do_callback(wCallback, v);} open
class Fluid_Coord_Input
}
Fl_Box {} {
xywh {395 125 1 20} hide resizable
xywh {395 135 1 20} hide resizable
}
}
Fl_Group {} {
label {Span:}
callback propagate_load open
xywh {95 160 315 30} labelfont 1 labelsize 11 align 4
xywh {95 170 315 20} labelfont 1 labelsize 11 align 4
} {
Fl_Input widget_grid_rowspan_input {
label {Row Span:}
@@ -1043,7 +1311,7 @@ wCallback->do_callback(wCallback, v);} open
}
}
Fl_Box {} {
xywh {395 160 1 20} hide resizable
xywh {395 170 1 20} hide resizable
}
}
Fl_Box {} {
+24 -10
View File
@@ -21,29 +21,44 @@
#include <FL/Fl.H>
#include "custom_widgets.h"
#include <FL/Fl_Double_Window.H>
#include <FL/Fl_Tabs.H>
extern Fl_Tabs *widget_tabs;
extern Fl_Double_Window *image_panel_window;
#include <FL/Fl_Group.H>
extern void propagate_load(Fl_Group*, void*);
extern Fl_Group *image_panel_imagegroup;
#include <FL/Fl_Box.H>
#include <FL/Fl_Shared_Image.H>
extern Fl_Box *image_panel_data;
extern Fluid_Coord_Input *image_panel_imagew;
extern Fluid_Coord_Input *image_panel_imageh;
#include <FL/Fl_Button.H>
#include <FL/Fl_Check_Button.H>
extern void compress_image_cb(Fl_Check_Button*, void*);
extern void bind_image_cb(Fl_Check_Button*, void*);
extern Fl_Group *image_panel_deimagegroup;
extern Fl_Box *image_panel_dedata;
extern Fluid_Coord_Input *image_panel_deimagew;
extern Fluid_Coord_Input *image_panel_deimageh;
extern void compress_deimage_cb(Fl_Check_Button*, void*);
extern void bind_deimage_cb(Fl_Check_Button*, void*);
extern Fl_Button *image_panel_close;
Fl_Double_Window* make_image_panel();
void run_image_panel();
#include <FL/Fl_Tabs.H>
extern Fl_Tabs *widget_tabs;
#include <FL/Fl_Input.H>
extern void label_cb(Fl_Input*, void*);
#include <FL/Fl_Choice.H>
extern Fl_Menu_Item labeltypemenu[];
extern void labeltype_cb(Fl_Choice*, void*);
extern void image_cb(Fl_Input*, void*);
#include <FL/Fl_Button.H>
extern Fl_Input *widget_image_input;
extern void image_browse_cb(Fl_Button*, void*);
#include "pixmaps.h"
extern void compress_image_cb(Fl_Button*, void*);
extern void bind_image_cb(Fl_Button*, void*);
extern void inactive_cb(Fl_Input*, void*);
extern Fl_Input *widget_deimage_input;
extern void inactive_browse_cb(Fl_Button*, void*);
extern void compress_deimage_cb(Fl_Button*, void*);
extern void bind_deimage_cb(Fl_Button*, void*);
extern void align_cb(Fl_Button*, void*);
extern void align_text_image_cb(Fl_Choice*, void*);
extern void align_position_cb(Fl_Choice*, void*);
#include <FL/Fl_Box.H>
extern void position_group_cb(Fl_Group*, void*);
extern void x_cb(Fluid_Coord_Input*, void*);
extern Fluid_Coord_Input *widget_x_input;
@@ -58,7 +73,6 @@ extern void flex_size_group_cb(Fl_Group*, void*);
#include <FL/Fl_Value_Input.H>
extern void flex_size_cb(Fl_Value_Input*, void*);
extern Fl_Value_Input *widget_flex_size;
#include <FL/Fl_Check_Button.H>
extern void flex_fixed_cb(Fl_Check_Button*, void*);
extern Fl_Check_Button *widget_flex_fixed;
extern void values_group_cb(Fl_Group*, void*);