From: Ralph T. <ra...@us...> - 2006-01-24 08:42:27
|
Update of /cvsroot/adobe-source/sandbox/adobe-source/adobe/future/widgets/sources/fltk In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12347/adobe-source/adobe/future/widgets/sources/fltk Modified Files: ui_core_implementation.cpp Log Message: Update of FLTK implementation to compile with recent ASL changes. Bugs with faulty baseline and placing widgets more often than required have been fixed, as well as a fix for popup placement (when the popup has a label). Index: ui_core_implementation.cpp =================================================================== RCS file: /cvsroot/adobe-source/sandbox/adobe-source/adobe/future/widgets/sources/fltk/ui_core_implementation.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ui_core_implementation.cpp 7 Nov 2005 18:08:58 -0000 1.4 --- ui_core_implementation.cpp 24 Jan 2006 08:42:18 -0000 1.5 *************** *** 13,16 **** --- 13,18 ---- #include "display.hpp" + //#include "report_exception.hpp" + #include <adobe/value.hpp> #include <adobe/future/memory.hpp> *************** *** 298,302 **** geometry_m = geometry; position_m = position; ! window_m->resize(position_m.x_m, position_m.y_m, geometry.width(), geometry.height()); } --- 300,304 ---- geometry_m = geometry; position_m = position; ! window_m->resize(window_m->x(), window_m->y(),//position_m.x_m, position_m.y_m, geometry.width(), geometry.height()); } *************** *** 307,311 **** geometry_m.width() = size.x_m; geometry_m.height() = size.y_m; ! window_m->resize(position_m.x_m, position_m.y_m, geometry_m.width(), geometry_m.height()); } --- 309,313 ---- geometry_m.width() = size.x_m; geometry_m.height() = size.y_m; ! window_m->resize(window_m->x(), window_m->y(),//position_m.x_m, position_m.y_m, geometry_m.width(), geometry_m.height()); } *************** *** 347,359 **** control_t::control_t(const control_t& rhs) : control_m(0), theme_m(rhs.theme_m), widget_type_m(rhs.widget_type_m) {} ! control_t::~control_t() ! { // ! // All child widgets get deleted by the parent, so we ! // only have to delete something if it is a root parent ! // (which seems unlikely, as only windows may be root ! // parents). // ! if (control_m && !control_m->parent()) delete control_m; } extents_t control_t::best_bounds() --- 349,363 ---- control_t::control_t(const control_t& rhs) : control_m(0), theme_m(rhs.theme_m), widget_type_m(rhs.widget_type_m) {} ! control_t::~control_t() { ! if (!control_m) return; // ! // We delete ourselves, but not any of our children (which ! // is the default in FLTK). // ! fltk::Group* g (dynamic_cast<fltk::Group*>(control_m)); ! if (g) { ! for (int i = 0; i < g->children(); i++ ) g->remove(i); ! } ! delete control_m; } extents_t control_t::best_bounds() *************** *** 414,429 **** control_m->box()->inset(unit); // ! // Resize the widget to be big enough to contain the label ! // and it's box. ! // ! control_m->resize(100 - unit.w() + result.width(), ! 100 - unit.h() + result.height()); ! // ! // Put the new size into the result, along with the baseline ! // calculated by the widget. // ! result.width() = control_m->w(); ! result.height() = control_m->h(); ! result.vertical().poi_m.push_back(control_m->baseline_y()); // // All calculated. --- 418,431 ---- control_m->box()->inset(unit); // ! // Previously we pushed the calculated dimensions into the ! // widget so that the widget would calculate it's baseline. ! // Unfortunately, the widget frequently calculated the wrong ! // baseline, and it made the GUI look funny as things often ! // got placed and then moved... Now we just make up a fake ! // baseline and things only get placed once. // ! result.width() = 100 - unit.w() + result.width(); ! result.height() = 100 - unit.h() + result.height(); ! result.vertical().poi_m.push_back(result.height() / 2); // // All calculated. *************** *** 650,654 **** for (; first != last; ++first) { ! fltk::Widget* item = new fltk::Widget(0, 0, 10, 10); item->copy_label(first->name_m.c_str()); g->add(item); --- 652,656 ---- for (; first != last; ++first) { ! fltk::Widget* item = new fltk::Widget(0, 0, 0, 0); item->copy_label(first->name_m.c_str()); g->add(item); *************** *** 673,680 **** // calculating the height and frame location. // ! extents_t result; ! result.height() = 30; ! result.vertical().frame_m.first = 35; ! return result; } void tab_group_t::implementation_t::set_value(const value_t& new_value) --- 675,683 ---- // calculating the height and frame location. // ! // extents_t result; ! // result.height() = 30; ! // result.vertical().frame_m.first = 35; ! // return result; ! return _super::best_bounds(); } void tab_group_t::implementation_t::set_value(const value_t& new_value) *************** *** 846,850 **** } void button_t::implementation_t::set_contributing( ! modifiers_t modifiers, const dictionary_t& value) { assert(control_m); --- 849,853 ---- } void button_t::implementation_t::set_contributing( ! modifiers_t modifiers, const std::pair<dictionary_t, array_t>& value) { assert(control_m); *************** *** 1670,1673 **** --- 1673,1693 ---- return result; } + void popup_t::implementation_t::set_bounds( + const point_2d_t& position, const extents_t& geometry) + { + // + // If we have a text label then we need to take the + // hint (the horizontal poi) that we set in best_bounds. + // + if (!using_label_m) return _super::set_bounds(position, geometry); + point_2d_t repos(position); + extents_t regeo(geometry); + if (geometry.horizontal().poi_m.size()) { + repos.x_m += geometry.horizontal().poi_m[0]; + regeo.width() -= geometry.horizontal().poi_m[0]; + } + _super::set_bounds(repos, regeo); + } + void popup_t::implementation_t::set_static_disabled( bool is_static_disabled) *************** *** 1707,1713 **** menu_items_t::iterator first(menu_items_m.begin()); menu_items_t::iterator last(menu_items_m.end()); ! for (; first != last; ++first) if((*first).second == item) choice->value(first - menu_items_m.begin()); } void popup_t::implementation_t::select_with_text( --- 1727,1734 ---- menu_items_t::iterator first(menu_items_m.begin()); menu_items_t::iterator last(menu_items_m.end()); ! for (; first != last; first++) { if((*first).second == item) choice->value(first - menu_items_m.begin()); + } } void popup_t::implementation_t::select_with_text( |