If the value field for scrollbars was not zero, Fluid would generate code that accesses the hidden function Fl_Scrollbar::value(double), causing a compile time error. The fix circumevents the hidden function by calling Fl_Slider::value. It would be better to change the entire Fluid interface to reflect the Scrollbar interface.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@5214 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Matthias Melcher 2006-06-19 08:34:19 +00:00
parent 0148f1cfd0
commit 11de032d6d
4 changed files with 21 additions and 13 deletions

View File

@ -1,5 +1,7 @@
CHANGES IN FLTK 1.1.8
- Fixed wrong code generated by Fluid
for Scrollbars (STR #1287)
- Loading a file would not update the Widget
Propertis dialog in FLUID (STR #1326)
- Fixed key compose sequences for

View File

@ -1421,7 +1421,7 @@ void slider_size_cb(Fl_Value_Input* i, void* v) {
i->parent()->hide();
else
i->parent()->show();
if (current_widget->is_valuator()!=2) {i->deactivate(); return;}
if (current_widget->is_valuator()<2) {i->deactivate(); return;}
i->activate();
i->value(((Fl_Slider*)(current_widget->o))->slider_size());
} else {
@ -1430,7 +1430,7 @@ void slider_size_cb(Fl_Value_Input* i, void* v) {
for (Fl_Type *o = Fl_Type::first; o; o = o->next) {
if (o->selected && o->is_widget()) {
Fl_Widget_Type* q = (Fl_Widget_Type*)o;
if (q->is_valuator()==2) {
if (q->is_valuator()>=2) {
((Fl_Slider*)(q->o))->slider_size(n);
q->o->redraw();
mod = 1;
@ -2105,9 +2105,14 @@ void Fl_Widget_Type::write_widget_code() {
write_c("%so->maximum(%g);\n", indent(), v->maximum());
if (v->step()!=f->step())
write_c("%so->step(%g);\n", indent(), v->step());
if (v->value())
write_c("%so->value(%g);\n", indent(), v->value());
if (is_valuator()==2) {
if (v->value()) {
if (is_valuator()==3) { // Fl_Scrollbar::value(double) is nott available
write_c("%so->Fl_Slider::value(%g);\n", indent(), v->value());
} else {
write_c("%so->value(%g);\n", indent(), v->value());
}
}
if (is_valuator()>=2) {
double x = ((Fl_Slider*)v)->slider_size();
double y = ((Fl_Slider*)f)->slider_size();
if (x != y) write_c("%so->slider_size(%g);\n", indent(), x);
@ -2244,7 +2249,7 @@ void Fl_Widget_Type::write_properties() {
if (v->maximum()!=f->maximum()) write_string("maximum %g",v->maximum());
if (v->step()!=f->step()) write_string("step %g",v->step());
if (v->value()!=0.0) write_string("value %g",v->value());
if (is_valuator()==2) {
if (is_valuator()>=2) {
double x = ((Fl_Slider*)v)->slider_size();
double y = ((Fl_Slider*)f)->slider_size();
if (x != y) write_string("slider_size %g", x);
@ -2567,7 +2572,7 @@ void Fl_Widget_Type::copy_properties() {
d->maximum(s->maximum());
d->step(s->step());
d->value(s->value());
if (is_valuator()==2) {
if (is_valuator()>=2) {
Fl_Slider *d = (Fl_Slider*)live_widget, *s = (Fl_Slider*)o;
d->slider_size(s->slider_size());
}

View File

@ -725,6 +725,7 @@ static Fl_Menu_Item scrollbar_type_menu[] = {
{0}};
class Fl_Scrollbar_Type : public Fl_Slider_Type {
Fl_Menu_Item *subtypes() {return scrollbar_type_menu;}
int is_valuator() const {return 3;}
public:
virtual const char *type_name() {return "Fl_Scrollbar";}
Fl_Widget *widget(int x,int y,int w,int h) {

View File

@ -1,5 +1,5 @@
# data file for the Fltk User Interface Designer (fluid)
version 1.0100
version 1.0107
header_name {.h}
code_name {.cxx}
Function {callback(Fl_Widget* o, void*)} {open private return_type void
@ -12,7 +12,7 @@ Function {} {open
} {
Fl_Window {} {
label {Valuator classes, showing values for type()} open
xywh {635 288 565 505} color 43 selection_color 43
xywh {204 225 565 505} type Double color 43 selection_color 43
code0 {\#include <stdio.h>} visible
} {
Fl_Box {} {
@ -165,7 +165,7 @@ Function {} {open
}
Fl_Value_Output {} {
label 0
callback callback selected
callback callback
tooltip {Value Output} xywh {170 460 110 30} labelsize 8 maximum 100 step 0.1
}
Fl_Box {} {
@ -175,12 +175,12 @@ Function {} {open
Fl_Scrollbar {} {
label 0
callback callback
tooltip {Vertical Scrollbar} xywh {395 20 20 105} labelsize 8 align 1 maximum 100 slider_size 0.3
tooltip {Vertical Scrollbar} xywh {395 20 20 105} labelsize 8 align 1 maximum 100
}
Fl_Scrollbar {} {
label FL_HORIZONTAL
callback callback
tooltip {Horizontal Scrollbar} xywh {300 65 95 20} type Horizontal labelsize 8 maximum 100 slider_size 0.3
callback callback selected
tooltip {Horizontal Scrollbar} xywh {300 65 95 20} type Horizontal labelsize 8 maximum 100 value 20
}
}
}