You can subscribe to this list here.
| 2005 |
Jan
|
Feb
|
Mar
(67) |
Apr
(455) |
May
(202) |
Jun
(136) |
Jul
(203) |
Aug
(60) |
Sep
(88) |
Oct
(64) |
Nov
(56) |
Dec
(78) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2006 |
Jan
(271) |
Feb
(207) |
Mar
|
Apr
|
May
(167) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Ralph T. <ra...@us...> - 2005-04-10 07:00:58
|
Update of /cvsroot/adobe-source/sandbox/adobe-source/adobe/test/visual In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25462 Modified Files: Jamfile Log Message: Fixes for Mac changes I made earlier (removing get_row_col_count function). Fix to link using bjam with darwin toolset (specify -framework Carbon). Index: Jamfile =================================================================== RCS file: /cvsroot/adobe-source/sandbox/adobe-source/adobe/test/visual/Jamfile,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Jamfile 8 Apr 2005 21:03:49 -0000 1.6 --- Jamfile 10 Apr 2005 07:00:45 -0000 1.7 *************** *** 26,29 **** --- 26,30 ---- project adobe/visual : requirements <toolset>msvc:<linkflags>"gdi32.lib user32.lib comctl32.lib /subsystem:windows" + : requirements <toolset>darwin:<linkflags>"-framework Carbon" : requirements <include>headers <link>static ; |
|
From: Ralph T. <ra...@us...> - 2005-04-10 07:00:58
|
Update of /cvsroot/adobe-source/sandbox/adobe-source/adobe/test/visual/sources/mac In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25462/sources/mac Modified Files: ui_core_implementation.cpp Log Message: Fixes for Mac changes I made earlier (removing get_row_col_count function). Fix to link using bjam with darwin toolset (specify -framework Carbon). Index: ui_core_implementation.cpp =================================================================== RCS file: /cvsroot/adobe-source/sandbox/adobe-source/adobe/test/visual/sources/mac/ui_core_implementation.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ui_core_implementation.cpp 10 Apr 2005 01:24:36 -0000 1.7 --- ui_core_implementation.cpp 10 Apr 2005 07:00:46 -0000 1.8 *************** *** 3626,3630 **** get_control_bounds(rhs.control_m, bounds); ! initialize(bounds, get_control_string(name_m), scrollable_m); } --- 3626,3630 ---- get_control_bounds(rhs.control_m, bounds); ! initialize(bounds, get_control_string(name_m), scrollable_m, cols_m, rows_m); } *************** *** 4344,4348 **** get_control_bounds(rhs.control_m, bounds); ! initialize(bounds, get_control_string(name_m), using_popup_m); } --- 4344,4348 ---- get_control_bounds(rhs.control_m, bounds); ! initialize(bounds, get_control_string(name_m), using_popup_m, cols_m, rows_m); } |
|
From: Ralph T. <ra...@us...> - 2005-04-10 01:24:46
|
Update of /cvsroot/adobe-source/sandbox/adobe-source/adobe/test/visual/sources/win In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24636/adobe-source/adobe/test/visual/sources/win Modified Files: metrics.cpp ui_core_implementation.cpp Log Message: multiline edit_text_t now works on Win32! I *think* that means that Windows now has all of the required widgets for Adobe Begin as it currently stands. This check-in changes the ui-core interface. I have removed the set_row_col_count function from edit_text_t. It made a Win32 implementation very hard, as you cannot go between a single- and multi-line edit control on Windows (at least, not without destroying the control and creating a new one, which is a hack). This change meant that changes had to be made to the Mac ui-core implementation. Index: metrics.cpp =================================================================== RCS file: /cvsroot/adobe-source/sandbox/adobe-source/adobe/test/visual/sources/win/metrics.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** metrics.cpp 8 Apr 2005 21:03:50 -0000 1.4 --- metrics.cpp 10 Apr 2005 01:24:36 -0000 1.5 *************** *** 130,133 **** --- 130,138 ---- return true; } + if ((widget_type == EP_EDITTEXT) && (measurement == TMT_BORDERSIZE)) + { + out_val = 1; + return true; + } out_val = 0; return false; Index: ui_core_implementation.cpp =================================================================== RCS file: /cvsroot/adobe-source/sandbox/adobe-source/adobe/test/visual/sources/win/ui_core_implementation.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** ui_core_implementation.cpp 8 Apr 2005 21:03:50 -0000 1.13 --- ui_core_implementation.cpp 10 Apr 2005 01:24:36 -0000 1.14 *************** *** 811,819 **** /// /// \param control the HWND of the edit control to obtain the best bounds for. ! /// \param extents the largest extents this edit control must contain. /// /// \return the best bounds for the edit control, including baseline. // ! ::adobe::rectangle_t calculate_edit_bounds(HWND control, RECT extents) { ::adobe::rectangle_t result; --- 811,820 ---- /// /// \param control the HWND of the edit control to obtain the best bounds for. ! /// \param cols the number of columns (or characters across) the edit control should contain ! /// \param rows the number of rows of text to contain. /// /// \return the best bounds for the edit control, including baseline. // ! ::adobe::rectangle_t calculate_edit_bounds(HWND control, int cols, int rows) { ::adobe::rectangle_t result; *************** *** 841,852 **** // TEXTMETRIC font_metrics; if (!::adobe::metrics_t::get_instance().set_window(control)) return result; if (!::adobe::metrics_t::get_instance().get_font_metrics(EP_EDITTEXT, font_metrics)) return result; // ! // Now we can calculate the rectangle! // ! result.height() = em_rect.bottom + (wi.rcClient.top - wi.rcWindow.top) + (wi.rcWindow.bottom - wi.rcClient.bottom); result.width() = (extents.right - extents.left) + (wi.rcClient.left - wi.rcWindow.left) + (wi.rcWindow.right - wi.rcClient.right); ! result.slice_m[::adobe::rectangle_slices_t::vertical].poi_m.push_back((wi.rcClient.top - wi.rcWindow.top) + font_metrics.tmAscent); return result; } --- 842,861 ---- // TEXTMETRIC font_metrics; + RECT extents = {0, 0, 0, 0}; + int border = 0; if (!::adobe::metrics_t::get_instance().set_window(control)) return result; + if (!::adobe::metrics_t::get_instance().get_text_extents(EP_EDITTEXT, std::wstring(L"0", cols), extents)) return result; if (!::adobe::metrics_t::get_instance().get_font_metrics(EP_EDITTEXT, font_metrics)) return result; + if (!::adobe::metrics_t::get_instance().get_integer(EP_EDITTEXT, TMT_BORDERSIZE, border)) return result; // ! // Now we can calculate the rectangle: // ! // Height: Top border + Bottom border + (rows * text height) + vertical text offset ! // Width : Left border + Right border + text extent ! // Baseline: Top border + font ascent + one if this has multiple lines... ! // ! result.height() = (wi.rcClient.top - wi.rcWindow.top) + (wi.rcWindow.bottom - wi.rcClient.bottom) + (rows * font_metrics.tmHeight) + em_rect.top + border; result.width() = (extents.right - extents.left) + (wi.rcClient.left - wi.rcWindow.left) + (wi.rcWindow.right - wi.rcClient.right); ! result.slice_m[::adobe::rectangle_slices_t::vertical].poi_m.push_back((wi.rcClient.top - wi.rcWindow.top) + font_metrics.tmAscent + border); return result; } *************** *** 1161,1165 **** if (b) DeleteObject(b); } ! else if ((message == WM_CTLCOLORSTATIC) || (message == WM_CTLCOLOREDIT)) { // --- 1170,1174 ---- if (b) DeleteObject(b); } ! else if (message == WM_CTLCOLORSTATIC) { // *************** *** 3052,3056 **** get_control_bounds(rhs.control_m, bounds); ! initialize(bounds, get_control_string(name_m), scrollable_m); } --- 3061,3065 ---- get_control_bounds(rhs.control_m, bounds); ! initialize(bounds, get_control_string(name_m), scrollable_m, cols_m, rows_m); } *************** *** 3063,3069 **** /****************************************************************************************************/ ! void edit_text_t::implementation_t::initialize( const RECT& bounds, ! const std::string& name, ! bool scrollable) { assert(!control_m); --- 3072,3080 ---- /****************************************************************************************************/ ! void edit_text_t::implementation_t::initialize( const RECT& bounds, ! const std::string& name, ! bool scrollable, ! long cols, ! long rows) { assert(!control_m); *************** *** 3076,3091 **** scrollable_m = scrollable; using_label_m = !name.empty(); ! ! if (scrollable) ! { ! } ! else ! { ! } control_m = ::CreateWindowEx( WS_EX_COMPOSITED | WS_EX_CLIENTEDGE, "EDIT", NULL, ! WS_CHILD | WS_VISIBLE | ES_AUTOHSCROLL | ES_AUTOVSCROLL | WS_TABSTOP, bounds.left, bounds.top, width, height, invisible_parent_m, --- 3087,3097 ---- scrollable_m = scrollable; using_label_m = !name.empty(); ! cols_m = cols; ! rows_m = rows; control_m = ::CreateWindowEx( WS_EX_COMPOSITED | WS_EX_CLIENTEDGE, "EDIT", NULL, ! get_window_style(), bounds.left, bounds.top, width, height, invisible_parent_m, *************** *** 3117,3128 **** assert(control_m); // ! // In order to calculate the best bounds we have to get the extents of our ! // text. We actually take the extents of "0", because we don't know the text ! // yet. // ! RECT extents = {0, 0, 0, 0}; ! metrics_t::get_instance().set_window(control_m); ! metrics_t::get_instance().get_text_extents(uxtheme_type_m, std::wstring(L"0", cols_m), extents); ! rectangle_t result = calculate_edit_bounds(control_m, extents); // // Store the height and baseline so that we can correctly align the edit widget --- 3123,3130 ---- assert(control_m); // ! // The calculate_edit_bounds function can figure out the size this edit box ! // should be, based on the number of rows and columns. // ! rectangle_t result = calculate_edit_bounds(control_m, cols_m, rows_m); // // Store the height and baseline so that we can correctly align the edit widget *************** *** 3289,3302 **** /****************************************************************************************************/ - void edit_text_t::implementation_t::set_row_col_count(long columns, long rows) - { - assert(control_m); - - cols_m = columns; - rows_m = rows; - } - - /****************************************************************************************************/ - void edit_text_t::implementation_t::set_selection(long start_char, long end_char) { --- 3291,3294 ---- *************** *** 3335,3338 **** --- 3327,3358 ---- /****************************************************************************************************/ + long edit_text_t::implementation_t::get_window_style() const + { + // + // Make it so that the edit box automatically scrolls when the + // user types beyond the visible region or clicks and drags + // inside the text box. + // + // The NoHideSel(ection) flag tells windows to make sure that + // the any selection in an edit is always visible -- not just + // when the edit control has focus. + // + long edit_style = ES_AUTOHSCROLL | ES_AUTOVSCROLL | ES_NOHIDESEL; + // + // We can set the ES_MULTILINE style if we have multiple rows. + // The ES_WANTRETURN flag tells the edit control to interpret + // the return key as a newline/return, rather than to tell the + // parent window about it. + // + if (rows_m > 1) edit_style |= ES_MULTILINE | ES_WANTRETURN; + // + // The WS_VSCROLL and WS_HSCROLL styles apply to any window. + // + if (scrollable_m) edit_style |= WS_VSCROLL | WS_HSCROLL; + return edit_style | WS_CHILD | WS_TABSTOP | WS_VISIBLE; + } + + /****************************************************************************************************/ + LRESULT edit_text_t::implementation_t::event(UINT message, WPARAM wParam, LPARAM lParam) { *************** *** 3811,3822 **** get_control_bounds(rhs.control_m, bounds); ! initialize(bounds, get_control_string(name_m), using_popup_m); } /****************************************************************************************************/ ! void unit_edit_text_t::implementation_t::initialize(const RECT& bounds, ! const std::string& name, ! bool using_popup) { assert(!control_m); --- 3831,3844 ---- get_control_bounds(rhs.control_m, bounds); ! initialize(bounds, get_control_string(name_m), using_popup_m, cols_m, rows_m); } /****************************************************************************************************/ ! void unit_edit_text_t::implementation_t::initialize( const RECT& bounds, ! const std::string& name, ! bool using_popup, ! long cols, ! long rows) { assert(!control_m); *************** *** 3824,3828 **** using_popup_m = using_popup; ! _super::initialize(bounds, name, false); if (using_popup_m) --- 3846,3850 ---- using_popup_m = using_popup; ! _super::initialize(bounds, name, false, cols, rows); if (using_popup_m) |
|
From: Ralph T. <ra...@us...> - 2005-04-10 01:24:46
|
Update of /cvsroot/adobe-source/sandbox/adobe-source/adobe/test/visual/sources/mac In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24636/adobe-source/adobe/test/visual/sources/mac Modified Files: ui_core_implementation.cpp Log Message: multiline edit_text_t now works on Win32! I *think* that means that Windows now has all of the required widgets for Adobe Begin as it currently stands. This check-in changes the ui-core interface. I have removed the set_row_col_count function from edit_text_t. It made a Win32 implementation very hard, as you cannot go between a single- and multi-line edit control on Windows (at least, not without destroying the control and creating a new one, which is a hack). This change meant that changes had to be made to the Mac ui-core implementation. Index: ui_core_implementation.cpp =================================================================== RCS file: /cvsroot/adobe-source/sandbox/adobe-source/adobe/test/visual/sources/mac/ui_core_implementation.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ui_core_implementation.cpp 31 Mar 2005 22:50:44 -0000 1.6 --- ui_core_implementation.cpp 10 Apr 2005 01:24:36 -0000 1.7 *************** *** 3637,3643 **** /****************************************************************************************************/ ! void edit_text_t::implementation_t::initialize( const Rect& bounds, ! const std::string& name, ! bool scrollable) { assert(!control_m); --- 3637,3645 ---- /****************************************************************************************************/ ! void edit_text_t::implementation_t::initialize( const Rect& bounds, ! const std::string& name, ! bool scrollable, ! long cols, ! long rows) { assert(!control_m); *************** *** 3645,3648 **** --- 3647,3652 ---- scrollable_m = scrollable; using_label_m = !name.empty(); + cols_m = cols; + rows_m = rows; if (scrollable) *************** *** 3725,3728 **** --- 3729,3735 ---- get_label().adorn_theme(theme_adornment_label_s); } + if (!scroll_control_m) + set_widget_data(control_m, kControlEditTextPart, + kControlEditTextSingleLineTag, Boolean(rows_m <= 1)); } *************** *** 3950,3967 **** /****************************************************************************************************/ - void edit_text_t::implementation_t::set_row_col_count(long columns, long rows) - { - assert(control_m); - - cols_m = columns; - rows_m = rows; - - if (!scroll_control_m) - set_widget_data(control_m, kControlEditTextPart, - kControlEditTextSingleLineTag, Boolean(rows_m <= 1)); - } - - /****************************************************************************************************/ - void edit_text_t::implementation_t::set_selection(long start_char, long end_char) { --- 3957,3960 ---- *************** *** 4356,4362 **** /****************************************************************************************************/ ! void unit_edit_text_t::implementation_t::initialize(const Rect& bounds, ! const std::string& name, ! bool using_popup) { assert(!control_m); --- 4349,4357 ---- /****************************************************************************************************/ ! void unit_edit_text_t::implementation_t::initialize( const Rect& bounds, ! const std::string& name, ! bool using_popup, ! long cols, ! long rows) { assert(!control_m); *************** *** 4364,4368 **** using_popup_m = using_popup; ! _super::initialize(bounds, name, false); if (using_popup_m) --- 4359,4363 ---- using_popup_m = using_popup; ! _super::initialize(bounds, name, false, cols, rows); if (using_popup_m) |
|
From: Ralph T. <ra...@us...> - 2005-04-10 01:24:45
|
Update of /cvsroot/adobe-source/sandbox/adobe-source/adobe/test/visual/sources In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24636/adobe-source/adobe/test/visual/sources Modified Files: client_assembler.cpp ui_core.cpp Log Message: multiline edit_text_t now works on Win32! I *think* that means that Windows now has all of the required widgets for Adobe Begin as it currently stands. This check-in changes the ui-core interface. I have removed the set_row_col_count function from edit_text_t. It made a Win32 implementation very hard, as you cannot go between a single- and multi-line edit control on Windows (at least, not without destroying the control and creating a new one, which is a hack). This change meant that changes had to be made to the Mac ui-core implementation. Index: ui_core.cpp =================================================================== RCS file: /cvsroot/adobe-source/sandbox/adobe-source/adobe/test/visual/sources/ui_core.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ui_core.cpp 3 Apr 2005 00:31:31 -0000 1.3 --- ui_core.cpp 10 Apr 2005 01:24:36 -0000 1.4 *************** *** 652,657 **** { delete object_m; } ! void edit_text_t::initialize(const std::string& name, bool scrollable) ! { object_m->initialize(initial_bounds_g, name, scrollable); } rectangle_t edit_text_t::best_bounds() --- 652,657 ---- { delete object_m; } ! void edit_text_t::initialize(const std::string& name, bool scrollable, long cols, long rows) ! { object_m->initialize(initial_bounds_g, name, scrollable, cols, rows); } rectangle_t edit_text_t::best_bounds() *************** *** 688,694 **** { object_m->set_static_disabled(is_static_disabled); } - void edit_text_t::set_row_col_count(long columns, long rows) - { object_m->set_row_col_count(columns, rows); } - void edit_text_t::set_selection(long start_char, long end_char) { object_m->set_selection(start_char, end_char); } --- 688,691 ---- *************** *** 795,800 **** { delete object_m; } ! void unit_edit_text_t::initialize(const std::string& name, bool using_popup) ! { object_m->initialize(initial_bounds_g, name, using_popup); } rectangle_t unit_edit_text_t::best_bounds() --- 792,797 ---- { delete object_m; } ! void unit_edit_text_t::initialize(const std::string& name, long cols, long rows, bool using_popup) ! { object_m->initialize(initial_bounds_g, name, using_popup, cols, rows); } rectangle_t unit_edit_text_t::best_bounds() *************** *** 831,837 **** { object_m->set_static_disabled(is_static_disabled); } - void unit_edit_text_t::set_row_col_count(long columns, long rows) - { object_m->set_row_col_count(columns, rows); } - void unit_edit_text_t::set_selection(long start_char, long end_char) { object_m->set_selection(start_char, end_char); } --- 828,831 ---- Index: client_assembler.cpp =================================================================== RCS file: /cvsroot/adobe-source/sandbox/adobe-source/adobe/test/visual/sources/client_assembler.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** client_assembler.cpp 31 Mar 2005 01:37:33 -0000 1.5 --- client_assembler.cpp 10 Apr 2005 01:24:35 -0000 1.6 *************** *** 1592,1596 **** edit_active_ref_m = &assemblage_m->hold_connection(adobe::assemblage_t::connection_t()); ! control_m.initialize(name_m, scrollable); set_up_control(*this, control_m, *parent, token); --- 1592,1596 ---- edit_active_ref_m = &assemblage_m->hold_connection(adobe::assemblage_t::connection_t()); ! control_m.initialize(name_m, scrollable, characters_m, num_lines_m); set_up_control(*this, control_m, *parent, token); *************** *** 1601,1606 **** control_m.signal_label_hit(boost::bind(&edit_text_proxy_t::edit_text_label_hit, boost::ref(*this), _1)); - control_m.set_row_col_count(characters_m, num_lines_m); - if (bind_indirect_m) { --- 1601,1604 ---- *************** *** 1835,1839 **** static_active_ref_m = &assemblage_m->hold_connection(adobe::assemblage_t::connection_t()); ! control_m.initialize(name_m, units_m.size()); control_m.set_static_disabled(go_static_m); --- 1833,1837 ---- static_active_ref_m = &assemblage_m->hold_connection(adobe::assemblage_t::connection_t()); ! control_m.initialize(name_m, units_m.size(), digits_m, 1); control_m.set_static_disabled(go_static_m); *************** *** 1847,1852 **** control_m.signal_label_hit(boost::bind(&edit_number_proxy_t::edit_number_label_hit, boost::ref(*this), _1)); - control_m.set_row_col_count(digits_m, 1); - control_m.signal_pre_edit(boost::bind(&edit_number_proxy_t::edit_number_value_changed, boost::ref(*this), _1, _2)); control_m.signal_post_edit(boost::bind(&edit_number_proxy_t::control_value, boost::ref(*this), _1)); --- 1845,1848 ---- |
|
From: Ralph T. <ra...@us...> - 2005-04-10 01:24:44
|
Update of /cvsroot/adobe-source/sandbox/adobe-source/adobe/test/visual/headers/win In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24636/adobe-source/adobe/test/visual/headers/win Modified Files: ui_core_implementation.hpp Log Message: multiline edit_text_t now works on Win32! I *think* that means that Windows now has all of the required widgets for Adobe Begin as it currently stands. This check-in changes the ui-core interface. I have removed the set_row_col_count function from edit_text_t. It made a Win32 implementation very hard, as you cannot go between a single- and multi-line edit control on Windows (at least, not without destroying the control and creating a new one, which is a hack). This change meant that changes had to be made to the Mac ui-core implementation. Index: ui_core_implementation.hpp =================================================================== RCS file: /cvsroot/adobe-source/sandbox/adobe-source/adobe/test/visual/headers/win/ui_core_implementation.hpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** ui_core_implementation.hpp 8 Apr 2005 21:03:50 -0000 1.9 --- ui_core_implementation.hpp 10 Apr 2005 01:24:35 -0000 1.10 *************** *** 426,431 **** void initialize( const RECT& bounds, ! const std::string& name, ! bool scrollable); static_text_t& get_label(); virtual rectangle_t best_bounds(); --- 426,433 ---- void initialize( const RECT& bounds, ! const std::string& name, ! bool scrollable, ! long cols, ! long rows); static_text_t& get_label(); virtual rectangle_t best_bounds(); *************** *** 436,444 **** void set_field_text(const std::string& text); void set_static_disabled(bool is_static_disabled); - void set_row_col_count(long columns, long rows); void set_selection(long start_char, long end_char); void signal_pre_edit(const implementation::edit_text_pre_edit_proc_t& proc); void signal_post_edit(const implementation::edit_text_post_edit_proc_t& proc); void signal_label_hit(const implementation::edit_text_label_hit_proc_t& proc); virtual LRESULT event(UINT msg, WPARAM wParam, LPARAM lParam); --- 438,452 ---- void set_field_text(const std::string& text); void set_static_disabled(bool is_static_disabled); void set_selection(long start_char, long end_char); void signal_pre_edit(const implementation::edit_text_pre_edit_proc_t& proc); void signal_post_edit(const implementation::edit_text_post_edit_proc_t& proc); void signal_label_hit(const implementation::edit_text_label_hit_proc_t& proc); + // + /// Recalculate the style which should be given as the Window style + /// of the edit control. + /// + /// \return the window style which should be applied to control_m. + // + long get_window_style() const; virtual LRESULT event(UINT msg, WPARAM wParam, LPARAM lParam); *************** *** 516,522 **** implementation_t(const implementation_t& rhs); ! void initialize( const RECT& bounds, ! const std::string& name, ! bool using_popup); popup_t& get_popup(); virtual rectangle_t best_bounds(); --- 524,532 ---- implementation_t(const implementation_t& rhs); ! void initialize( const RECT& bounds, ! const std::string& name, ! bool using_popup, ! long cols, ! long rows); popup_t& get_popup(); virtual rectangle_t best_bounds(); |
|
From: Ralph T. <ra...@us...> - 2005-04-10 01:24:44
|
Update of /cvsroot/adobe-source/sandbox/adobe-source/adobe/test/visual/headers/mac In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24636/adobe-source/adobe/test/visual/headers/mac Modified Files: ui_core_implementation.hpp Log Message: multiline edit_text_t now works on Win32! I *think* that means that Windows now has all of the required widgets for Adobe Begin as it currently stands. This check-in changes the ui-core interface. I have removed the set_row_col_count function from edit_text_t. It made a Win32 implementation very hard, as you cannot go between a single- and multi-line edit control on Windows (at least, not without destroying the control and creating a new one, which is a hack). This change meant that changes had to be made to the Mac ui-core implementation. Index: ui_core_implementation.hpp =================================================================== RCS file: /cvsroot/adobe-source/sandbox/adobe-source/adobe/test/visual/headers/mac/ui_core_implementation.hpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ui_core_implementation.hpp 30 Mar 2005 01:48:59 -0000 1.2 --- ui_core_implementation.hpp 10 Apr 2005 01:24:35 -0000 1.3 *************** *** 448,453 **** void initialize( const Rect& bounds, ! const std::string& name, ! bool scrollable); static_text_t& get_label(); virtual rectangle_t best_bounds(); --- 448,455 ---- void initialize( const Rect& bounds, ! const std::string& name, ! bool scrollable, ! long cols, ! long rows); static_text_t& get_label(); virtual rectangle_t best_bounds(); *************** *** 458,462 **** void set_field_text(const std::string& text); void set_static_disabled(bool is_static_disabled); - void set_row_col_count(long columns, long rows); void set_selection(long start_char, long end_char); void signal_pre_edit(const implementation::edit_text_pre_edit_proc_t& proc); --- 460,463 ---- *************** *** 531,535 **** implementation_t(const implementation_t& rhs); ! void initialize(const Rect& bounds, const std::string& name, bool using_popup); popup_t& get_popup(); virtual rectangle_t best_bounds(); --- 532,540 ---- implementation_t(const implementation_t& rhs); ! void initialize( const Rect& bounds, ! const std::string& name, ! bool using_popup, ! long cols, ! long rows); popup_t& get_popup(); virtual rectangle_t best_bounds(); |
|
From: Ralph T. <ra...@us...> - 2005-04-10 01:24:44
|
Update of /cvsroot/adobe-source/sandbox/adobe-source/adobe/test/visual/headers In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24636/adobe-source/adobe/test/visual/headers Modified Files: ui_core.hpp Log Message: multiline edit_text_t now works on Win32! I *think* that means that Windows now has all of the required widgets for Adobe Begin as it currently stands. This check-in changes the ui-core interface. I have removed the set_row_col_count function from edit_text_t. It made a Win32 implementation very hard, as you cannot go between a single- and multi-line edit control on Windows (at least, not without destroying the control and creating a new one, which is a hack). This change meant that changes had to be made to the Mac ui-core implementation. Index: ui_core.hpp =================================================================== RCS file: /cvsroot/adobe-source/sandbox/adobe-source/adobe/test/visual/headers/ui_core.hpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ui_core.hpp 3 Apr 2005 00:31:38 -0000 1.4 --- ui_core.hpp 10 Apr 2005 01:24:35 -0000 1.5 *************** *** 751,755 **** void initialize( const std::string& name, ! bool scrollable); rectangle_t best_bounds(); --- 751,757 ---- void initialize( const std::string& name, ! bool scrollable, ! long cols, ! long rows); rectangle_t best_bounds(); *************** *** 770,775 **** void set_static_disabled(bool is_static_disabled); - void set_row_col_count(long columns, long rows); - void set_selection(long start_char, long end_char); --- 772,775 ---- *************** *** 852,856 **** void initialize( const std::string& name, ! bool using_popup = true); rectangle_t best_bounds(); --- 852,858 ---- void initialize( const std::string& name, ! long cols, ! long rows, ! bool using_popup = true); rectangle_t best_bounds(); *************** *** 871,876 **** void set_static_disabled(bool is_static_disabled); - void set_row_col_count(long columns, long rows); - void set_selection(long start_char, long end_char); --- 873,876 ---- |
|
From: Peter K. <syn...@us...> - 2005-04-08 22:50:24
|
Update of /cvsroot/adobe-source/sandbox/adobe-source/adobe/test/adam_tutorial In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24787 Modified Files: main.cpp Log Message: avoid crash when checking range (msvc8 only) Index: main.cpp =================================================================== RCS file: /cvsroot/adobe-source/sandbox/adobe-source/adobe/test/adam_tutorial/main.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** main.cpp 19 Mar 2005 00:16:43 -0000 1.1 --- main.cpp 8 Apr 2005 22:50:15 -0000 1.2 *************** *** 145,148 **** --- 145,149 ---- cell_name_buffer.reserve(1024); new_value_buffer.reserve(1024); + new_value_buffer.resize(1); adobe::for_each(cell_set_m, boost::bind(setup_monitor, boost::ref(sheet_m), _1)); |
|
From: Ralph T. <ra...@us...> - 2005-04-08 22:47:57
|
Update of /cvsroot/adobe-source/sandbox/adobe-source/adobe/test/visual/sources/win In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23222/adobe-source/adobe/test/visual/sources/win Modified Files: main.cpp Log Message: Oops! Committed main.cpp without exception handling (which I use for debugging) by mistake, putting correct version back in again. Index: main.cpp =================================================================== RCS file: /cvsroot/adobe-source/sandbox/adobe-source/adobe/test/visual/sources/win/main.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** main.cpp 8 Apr 2005 21:03:50 -0000 1.4 --- main.cpp 8 Apr 2005 22:47:48 -0000 1.5 *************** *** 144,148 **** int WinMain( HINSTANCE hInst, HINSTANCE hInstPrev, LPSTR lpCmdLine, int nCmdShow ) { ! // try { adobe::simpleApplication* theApp = adobe::simpleApplication::getInstance(); --- 144,148 ---- int WinMain( HINSTANCE hInst, HINSTANCE hInstPrev, LPSTR lpCmdLine, int nCmdShow ) { ! try { adobe::simpleApplication* theApp = adobe::simpleApplication::getInstance(); *************** *** 150,157 **** if( theApp ) theApp->run(); } ! // catch( ... ) ! // { ! // adobe::report_exception(); ! // } return 0; --- 150,157 ---- if( theApp ) theApp->run(); } ! catch( ... ) ! { ! adobe::report_exception(); ! } return 0; |
|
From: Ralph T. <ra...@us...> - 2005-04-08 21:43:38
|
Update of /cvsroot/adobe-source/sandbox/adobe-source/adobe/build/boost_lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21312/adobe-source/adobe/build/boost_lib Modified Files: boost_lib.vcproj Log Message: Update Visual C++ project files, these work on MSVC 2003. Index: boost_lib.vcproj =================================================================== RCS file: /cvsroot/adobe-source/sandbox/adobe-source/adobe/build/boost_lib/boost_lib.vcproj,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** boost_lib.vcproj 23 Mar 2005 18:51:42 -0000 1.2 --- boost_lib.vcproj 8 Apr 2005 21:43:30 -0000 1.3 *************** *** 21,25 **** Optimization="0" AdditionalIncludeDirectories="..\..\..\third_party\boost_tp\boost;..\..\..\" ! PreprocessorDefinitions="WIN32;_DEBUG;_LIB;BOOST_ALL_NO_LIB=1" MinimalRebuild="TRUE" BasicRuntimeChecks="3" --- 21,25 ---- Optimization="0" AdditionalIncludeDirectories="..\..\..\third_party\boost_tp\boost;..\..\..\" ! PreprocessorDefinitions="WIN32;_DEBUG;_LIB;BOOST_ALL_NO_LIB=1;BOOST_THREAD_USE_LIB=1" MinimalRebuild="TRUE" BasicRuntimeChecks="3" |
|
From: Ralph T. <ra...@us...> - 2005-04-08 21:43:38
|
Update of /cvsroot/adobe-source/sandbox/adobe-source/adobe/test/visual In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21312/adobe-source/adobe/test/visual Modified Files: visual.vcproj Log Message: Update Visual C++ project files, these work on MSVC 2003. Index: visual.vcproj =================================================================== RCS file: /cvsroot/adobe-source/sandbox/adobe-source/adobe/test/visual/visual.vcproj,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** visual.vcproj 5 Apr 2005 15:43:57 -0000 1.4 --- visual.vcproj 8 Apr 2005 21:43:30 -0000 1.5 *************** *** 20,25 **** Name="VCCLCompilerTool" Optimization="0" ! AdditionalIncludeDirectories=".\headers\win;..\..\..\;..\..\..\third_party\boost_tp\boost;.\headers" ! PreprocessorDefinitions="WIN32;_LIB;NOMINMAX;ADOBE_SERIALIZATION=1;BOOST_ALL_NO_LIB=1" GeneratePreprocessedFile="0" MinimalRebuild="FALSE" --- 20,25 ---- Name="VCCLCompilerTool" Optimization="0" ! AdditionalIncludeDirectories=".\headers\win;.\resources;..\..\..\;..\..\..\third_party\boost_tp\boost;.\headers" ! PreprocessorDefinitions="WIN32;_LIB;NOMINMAX;ADOBE_SERIALIZATION=1;BOOST_ALL_NO_LIB=1;BOOST_THREAD_USE_LIB=1;WINVER=0x501;_WIN32_WINNT=0x501" GeneratePreprocessedFile="0" MinimalRebuild="FALSE" *************** *** 173,177 **** UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"> <File ! RelativePath=".\visual.rc"> </File> </Filter> --- 173,177 ---- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"> <File ! RelativePath=".\resources\resources.rc"> </File> </Filter> |
|
From: Ralph T. <ra...@us...> - 2005-04-08 21:04:02
|
Update of /cvsroot/adobe-source/sandbox/adobe-source/adobe/test/visual/sources/win In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31751/adobe-source/adobe/test/visual/sources/win Modified Files: main.cpp metrics.cpp ui_core_implementation.cpp Log Message: Visual Styles are enabled by default on Windows XP, and controls appear correctly on tabs, etc. A resource file has been added, and the generated exe now has the Adobe Begin icon. The following items still need to be completed on the Windows implementation of ui-core before it reaches parity with the Mac implementation: - slider_t needs to report changes, and actually set it's value. - progress_bar_t also needs work. - link_t's event mechanism should be looked at, it may not be painting when required. Index: metrics.cpp =================================================================== RCS file: /cvsroot/adobe-source/sandbox/adobe-source/adobe/test/visual/sources/win/metrics.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** metrics.cpp 2 Apr 2005 01:04:03 -0000 1.3 --- metrics.cpp 8 Apr 2005 21:03:50 -0000 1.4 *************** *** 167,170 **** --- 167,183 ---- return false; } + bool using_styles() const + { + return false; + } + void draw_parent_background(HWND window, HDC dc) + { + // + // REVISIT (ralpht): This function doesn't actually get called when visual + // styles aren't available, so there's no implementation here. That + // may not always be the case, however... + // + throw std::runtime_error("metrics::draw_parent_background not implemented without visual styles enabled"); + } }; *************** *** 209,212 **** --- 222,226 ---- typedef HRESULT (__stdcall *GetThemeFont_t)(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, int iPropId, LOGFONTW* pFont); typedef HRESULT (__stdcall *GetThemeSysFont_t)(HTHEME hTheme, int iFontId, LOGFONTW* pFont); + typedef HRESULT (__stdcall *DrawThemeParentBackground_t)(HWND window, HDC dc, LPRECT prc); typedef BOOL (__stdcall *IsThemeActive_t)(void); OpenThemeData_t OpenThemeDataPtr; *************** *** 219,222 **** --- 233,237 ---- GetThemeFont_t GetThemeFontPtr; GetThemeSysFont_t GetThemeSysFontPtr; + DrawThemeParentBackground_t DrawThemeParentBackgroundPtr; IsThemeActive_t IsThemeActivePtr; // *************** *** 229,233 **** GetThemeMarginsPtr(0), GetThemePartSizePtr(0), GetThemeIntPtr(0), GetThemeTextExtentPtr(0), GetThemeTextMetricsPtr(0), GetThemeFontPtr(0), ! GetThemeSysFontPtr(0), IsThemeActivePtr(0), loaded_m(false) { // --- 244,249 ---- GetThemeMarginsPtr(0), GetThemePartSizePtr(0), GetThemeIntPtr(0), GetThemeTextExtentPtr(0), GetThemeTextMetricsPtr(0), GetThemeFontPtr(0), ! GetThemeSysFontPtr(0), IsThemeActivePtr(0), DrawThemeParentBackgroundPtr(0), ! loaded_m(false) { // *************** *** 249,252 **** --- 265,269 ---- if (!(GetThemeSysFontPtr = (GetThemeSysFont_t)GetProcAddress(theme_dll_m, "GetThemeSysFont"))) return; if (!(IsThemeActivePtr = (IsThemeActive_t)GetProcAddress(theme_dll_m, "IsThemeActive"))) return; + if (!(DrawThemeParentBackgroundPtr = (DrawThemeParentBackground_t)GetProcAddress(theme_dll_m, "DrawThemeParentBackground"))) return; // // All loaded! *************** *** 369,372 **** --- 386,396 ---- return (S_OK == (*GetThemeMarginsPtr)(theme_m, 0, widget_type, kState, TMT_CONTENTMARGINS, 0, &out_margins)); } + bool using_styles() const { + return theme_active(); + } + void draw_parent_background(HWND window, HDC dc) { + if (!loaded_m) return; + (*DrawThemeParentBackgroundPtr)(window, dc, 0); + } }; /****************************************************************************************************/ Index: main.cpp =================================================================== RCS file: /cvsroot/adobe-source/sandbox/adobe-source/adobe/test/visual/sources/win/main.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** main.cpp 5 Apr 2005 05:46:05 -0000 1.3 --- main.cpp 8 Apr 2005 21:03:50 -0000 1.4 *************** *** 144,148 **** int WinMain( HINSTANCE hInst, HINSTANCE hInstPrev, LPSTR lpCmdLine, int nCmdShow ) { ! try { adobe::simpleApplication* theApp = adobe::simpleApplication::getInstance(); --- 144,148 ---- int WinMain( HINSTANCE hInst, HINSTANCE hInstPrev, LPSTR lpCmdLine, int nCmdShow ) { ! // try { adobe::simpleApplication* theApp = adobe::simpleApplication::getInstance(); *************** *** 150,157 **** if( theApp ) theApp->run(); } ! catch( ... ) ! { ! adobe::report_exception(); ! } return 0; --- 150,157 ---- if( theApp ) theApp->run(); } ! // catch( ... ) ! // { ! // adobe::report_exception(); ! // } return 0; Index: ui_core_implementation.cpp =================================================================== RCS file: /cvsroot/adobe-source/sandbox/adobe-source/adobe/test/visual/sources/win/ui_core_implementation.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** ui_core_implementation.cpp 5 Apr 2005 15:43:58 -0000 1.12 --- ui_core_implementation.cpp 8 Apr 2005 21:03:50 -0000 1.13 *************** *** 12,15 **** --- 12,16 ---- #include "display.hpp" #include "metrics.hpp" + #include "resources.h" #include <adobe/value.hpp> *************** *** 1067,1070 **** --- 1068,1222 ---- } // + /// This function is a hack to create a background brush which can be used by + /// children of panels on tabs. The brush is generated by creating a bitmap + /// the size of the panel, and drawing the panel background into the bitmap + /// before converting the bitmap into a patterned brush. + /// + /// \param panel the panel window to make a brush for. + // + HBRUSH make_background_brush(HWND panel) + { + HDC dc = GetDC(panel); + SetBkMode(dc, TRANSPARENT); + RECT dimensions = {0, 0, 0, 0}; + GetClientRect(panel, &dimensions); + // + // Make a memory device context and bitmap. + // + HDC memory_dc = CreateCompatibleDC(dc); + if (!memory_dc) ADOBE_THROW_LAST_ERROR; + HBITMAP memory_bmp = CreateCompatibleBitmap(dc, dimensions.right, dimensions.bottom); + if (!memory_bmp) ADOBE_THROW_LAST_ERROR; + // + // Select the new bitmap into the memory DC. + // + HGDIOBJ bmp_old = SelectObject(memory_dc, memory_bmp); + // + // Draw the background into the bitmap. + // + metrics_t::get_instance().draw_parent_background( panel, memory_dc ); + // + // Create the patterned brush, and verify that it was created. + // + HBRUSH b = CreatePatternBrush(memory_bmp); + if (!b) ADOBE_THROW_LAST_ERROR; + // + // Select out our bitmap. + // + SelectObject(memory_dc, bmp_old); + DeleteObject(memory_bmp); + DeleteDC(memory_dc); + // + // Return the created brush. + // + return b; + } + + // + /// This function is the event handler for the panel widget. The panel is a + /// container which does it's best to be transparent. It will forward events + /// it recieves from it's child controls on to them using + /// forward_events_to_control. + // + LRESULT CALLBACK panel_window_procedure(HWND panel, UINT message, WPARAM wParam, LPARAM lParam) + { + // + // First lets see if one of our children can handle this message. + // + bool handled(false); + LRESULT rv = forward_events_to_control(message, wParam, lParam, handled); + if (handled) return rv; + // + // We try to paint ourselves if visual styles are active. If we are + // a panel on top of a tab control then we must make sure that we get + // the tab background. + // + if (message == WM_PAINT) + { + PAINTSTRUCT ps; + // + // Only DIY if visual styles are on. + // + if (!metrics_t::get_instance().using_styles()) + return DefWindowProc(panel, message, wParam, lParam); + HDC window_dc = BeginPaint(panel, &ps); + metrics_t::get_instance().draw_parent_background(panel, window_dc); + EndPaint(panel, &ps); + return 0; + } + else if (message == WM_SIZE) + { + // + // We store the brush which we give to children in the panel_t. + // We only need this brush if visual styles are enabled -- the + // brush contains the background bitmap which controls need to + // draw behind themselves. + // + // We regenerate the background brush when a control requests it + // (rather than when we resize, we don't want to make resizing + // slow). In the size handler we just release the current brush + // and set the brush to zero. + // + HBRUSH b = (HBRUSH)SetWindowLong(panel, GWL_USERDATA, 0); + if (b) DeleteObject(b); + } + else if ((message == WM_CTLCOLORSTATIC) || (message == WM_CTLCOLOREDIT)) + { + // + // If we are not using visual styles then we don't have to do + // anything here -- the default window procedure is correct. + // + if (!metrics_t::get_instance().using_styles()) + return DefWindowProc(panel, message, wParam, lParam); + // + // Usually we store the brush as user data inside the HWND. + // + HBRUSH b = (HBRUSH)GetWindowLong(panel, GWL_USERDATA); + if (!b) + { + // + // There is no brush. Either the brush was deleted by + // the WM_SIZE handler or this is the first time a + // brush has been requested. We need to create a new + // brush and set it into the panel HWND. + // + b = make_background_brush(panel); + SetWindowLong(panel, GWL_USERDATA, (LONG)b); + } + // + // + // Set the child's DC drawing mode to transparent, and give + // it an empty brush. + // + RECT child_dim; RECT panel_dim; + HDC dc = (HDC)wParam; + HWND child = (HWND)lParam; + + SetBkMode(dc, TRANSPARENT); + GetWindowRect(child, &child_dim); + GetWindowRect(panel, &panel_dim); + SetBrushOrgEx(dc, -(child_dim.left - panel_dim.left), + -(child_dim.top - panel_dim.top), 0); + return (LRESULT)b; + } + else if (message == WM_CREATE) + { + // + // Make sure that we don't use uninitialized memory as a brush + // handle. + // + SetWindowLong(panel, GWL_USERDATA, 0); + } + else if (message == WM_DESTROY) + { + // + // Release any brush we might still own. + // + HBRUSH b = (HBRUSH)GetWindowLong(panel, GWL_USERDATA); + if (b) DeleteObject(b); + } + return DefWindowProc(panel, message, wParam, lParam); + } + // /// This function is the main event handler for ui-core on Win32. It delegates /// most of the events it recieves to individual control instances, via the *************** *** 1128,1142 **** wc.cbWndExtra = 0; wc.hInstance = ::GetModuleHandle(NULL); ! wc.hIcon = 0; //LoadIcon(NULL, IDI_APPLICATION); ! wc.hCursor = LoadCursor(NULL, IDC_ARROW); ! #if 1 wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1); - #else - wc.hbrBackground = (HBRUSH)(COLOR_BACKGROUND + 1); - #endif wc.lpszMenuName = NULL; wc.lpszClassName = L"eve_dialog"; RegisterClassW(&wc); } } --- 1280,1296 ---- wc.cbWndExtra = 0; wc.hInstance = ::GetModuleHandle(NULL); ! wc.hIcon = LoadIcon(wc.hInstance, MAKEINTRESOURCE(RES_APP_ICON)); ! wc.hCursor = LoadCursor(0, IDC_ARROW); wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1); wc.lpszMenuName = NULL; wc.lpszClassName = L"eve_dialog"; RegisterClassW(&wc); + // + // Register a new window class. + // + wc.lpfnWndProc = panel_window_procedure; + wc.lpszClassName = L"eve_panel"; + RegisterClassW(&wc); } } *************** *** 1223,1227 **** DWORD style) { ! DWORD dialog_extended_style = WS_EX_WINDOWEDGE | WS_EX_DLGMODALFRAME; int width = bounds.right - bounds.left; --- 1377,1381 ---- DWORD style) { ! DWORD dialog_extended_style = WS_EX_WINDOWEDGE | WS_EX_DLGMODALFRAME | WS_EX_COMPOSITED; int width = bounds.right - bounds.left; *************** *** 1417,1421 **** return DefWindowProc(window, message, wParam, lParam); } - /****************************************************************************************************/ --- 1571,1574 ---- *************** *** 1460,1465 **** // Now create the window. // ! invisible_parent_m = CreateWindowW(L"eve_invisible_parent", L"invisible", WS_POPUP, ! 0, 0, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, ::GetModuleHandle(NULL), NULL); if (!invisible_parent_m) ADOBE_THROW_LAST_ERROR; } --- 1613,1619 ---- // Now create the window. // ! invisible_parent_m = CreateWindowExW(WS_EX_COMPOSITED, L"eve_invisible_parent", ! L"invisible", WS_POPUP, 0, 0, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, ! ::GetModuleHandle(NULL), NULL); if (!invisible_parent_m) ADOBE_THROW_LAST_ERROR; } *************** *** 1779,1783 **** long height(bounds.bottom - bounds.top); ! control_m = ::CreateWindowEx( WS_EX_CONTROLPARENT, "BUTTON", name.c_str(), --- 1933,1937 ---- long height(bounds.bottom - bounds.top); ! control_m = ::CreateWindowEx( WS_EX_CONTROLPARENT | WS_EX_COMPOSITED, "BUTTON", name.c_str(), *************** *** 1852,1856 **** long height(bounds.bottom - bounds.top); ! control_m = ::CreateWindowEx( 0, WC_TABCONTROL, NULL, --- 2006,2010 ---- long height(bounds.bottom - bounds.top); ! control_m = ::CreateWindowEx( WS_EX_COMPOSITED, WC_TABCONTROL, NULL, *************** *** 1863,1867 **** if (control_m == NULL) ADOBE_THROW_LAST_ERROR; ! #ifdef NDEBUG set_user_reference(control_m, this); trap_window_proc(control_window_proc); --- 2017,2021 ---- if (control_m == NULL) ADOBE_THROW_LAST_ERROR; ! #ifndef NDEBUG set_user_reference(control_m, this); trap_window_proc(control_window_proc); *************** *** 2010,2030 **** long height(bounds.bottom - bounds.top); ! control_m = ::CreateWindowEx( WS_EX_CONTROLPARENT, ! "STATIC", ! NULL, ! WS_CHILD | WS_VISIBLE | WS_TABSTOP, ! bounds.left, bounds.top, width, height, ! invisible_parent_m, ! child_id_m, ! ::GetModuleHandle(NULL), ! NULL); if (control_m == NULL) ADOBE_THROW_LAST_ERROR; - - set_user_reference(control_m, this); - // - // This control is a container. - // - trap_window_proc(container_window_proc); } --- 2164,2178 ---- long height(bounds.bottom - bounds.top); ! control_m = ::CreateWindowEx( WS_EX_CONTROLPARENT | WS_EX_COMPOSITED, ! "eve_panel", ! NULL, ! WS_CHILD | WS_VISIBLE | WS_TABSTOP, ! bounds.left, bounds.top, width, height, ! invisible_parent_m, ! child_id_m, ! ::GetModuleHandle(NULL), ! NULL); if (control_m == NULL) ADOBE_THROW_LAST_ERROR; } *************** *** 2088,2092 **** long height(bounds.bottom - bounds.top); ! control_m = ::CreateWindow( "BUTTON", button_default_state(state_set_m)->name_m.c_str(), WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON | WS_TABSTOP | BS_NOTIFY, --- 2236,2240 ---- long height(bounds.bottom - bounds.top); ! control_m = ::CreateWindowEx( WS_EX_COMPOSITED, "BUTTON", button_default_state(state_set_m)->name_m.c_str(), WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON | WS_TABSTOP | BS_NOTIFY, *************** *** 2099,2103 **** if (control_m == NULL) ADOBE_THROW_LAST_ERROR; ! #ifdef NDEBUG set_user_reference(control_m, this); trap_window_proc(control_window_proc); --- 2247,2251 ---- if (control_m == NULL) ADOBE_THROW_LAST_ERROR; ! #ifndef NDEBUG set_user_reference(control_m, this); trap_window_proc(control_window_proc); *************** *** 2242,2246 **** long height(bounds.bottom - bounds.top); ! control_m = ::CreateWindow( "BUTTON", name.c_str(), WS_CHILD | WS_VISIBLE | BS_RADIOBUTTON | WS_TABSTOP | BS_NOTIFY, --- 2390,2394 ---- long height(bounds.bottom - bounds.top); ! control_m = ::CreateWindowEx( WS_EX_COMPOSITED | WS_EX_TRANSPARENT, "BUTTON", name.c_str(), WS_CHILD | WS_VISIBLE | BS_RADIOBUTTON | WS_TABSTOP | BS_NOTIFY, *************** *** 2252,2256 **** if (control_m == NULL) ADOBE_THROW_LAST_ERROR; ! #ifdef NDEBUG set_user_reference(control_m, this); trap_window_proc(control_window_proc); --- 2400,2404 ---- if (control_m == NULL) ADOBE_THROW_LAST_ERROR; ! #ifndef NDEBUG set_user_reference(control_m, this); trap_window_proc(control_window_proc); *************** *** 2337,2341 **** long height(bounds.bottom - bounds.top); ! control_m = ::CreateWindow( "BUTTON", name.c_str(), WS_CHILD | WS_VISIBLE | BS_CHECKBOX | WS_TABSTOP | BS_NOTIFY, --- 2485,2489 ---- long height(bounds.bottom - bounds.top); ! control_m = ::CreateWindowEx( WS_EX_COMPOSITED, "BUTTON", name.c_str(), WS_CHILD | WS_VISIBLE | BS_CHECKBOX | WS_TABSTOP | BS_NOTIFY, *************** *** 2347,2351 **** if (control_m == NULL) ADOBE_THROW_LAST_ERROR; ! #ifdef NDEBUG set_user_reference(control_m, this); trap_window_proc(control_window_proc); --- 2495,2499 ---- if (control_m == NULL) ADOBE_THROW_LAST_ERROR; ! #ifndef NDEBUG set_user_reference(control_m, this); trap_window_proc(control_window_proc); *************** *** 2444,2450 **** draw_link(*link, context); - #ifndef NDEBUG frame_widget(*control); // Done after the default wind proc has drawn the widget - #endif } --- 2592,2596 ---- *************** *** 2480,2484 **** long height(bounds.bottom - bounds.top); ! control_m = ::CreateWindow( "STATIC", NULL, WS_CHILD | WS_VISIBLE, --- 2626,2630 ---- long height(bounds.bottom - bounds.top); ! control_m = ::CreateWindowEx( WS_EX_COMPOSITED, "STATIC", NULL, WS_CHILD | WS_VISIBLE, *************** *** 2604,2608 **** long height(bounds.bottom - bounds.top); ! control_m = ::CreateWindowEx( 0, PROGRESS_CLASS, NULL, --- 2750,2754 ---- long height(bounds.bottom - bounds.top); ! control_m = ::CreateWindowEx( WS_EX_COMPOSITED, PROGRESS_CLASS, NULL, *************** *** 2706,2710 **** long height(bounds.bottom - bounds.top); ! control_m = ::CreateWindowEx( 0, WC_STATIC, NULL, --- 2852,2856 ---- long height(bounds.bottom - bounds.top); ! control_m = ::CreateWindowEx( WS_EX_COMPOSITED, WC_STATIC, NULL, *************** *** 2777,2781 **** // (we're going to have to figure out how to do this dynamically) ! control_m = ::CreateWindow( "STATIC", name.c_str(), WS_CHILD | WS_VISIBLE, --- 2923,2927 ---- // (we're going to have to figure out how to do this dynamically) ! control_m = ::CreateWindowEx( WS_EX_COMPOSITED, "STATIC", name.c_str(), WS_CHILD | WS_VISIBLE, *************** *** 2787,2791 **** if (control_m == NULL) ADOBE_THROW_LAST_ERROR; ! #ifdef NDEBUG set_user_reference(control_m, this); trap_window_proc(control_window_proc); --- 2933,2937 ---- if (control_m == NULL) ADOBE_THROW_LAST_ERROR; ! #ifndef NDEBUG set_user_reference(control_m, this); trap_window_proc(control_window_proc); *************** *** 2938,2942 **** } ! control_m = ::CreateWindowEx( WS_EX_CLIENTEDGE, "EDIT", NULL, --- 3084,3088 ---- } ! control_m = ::CreateWindowEx( WS_EX_COMPOSITED | WS_EX_CLIENTEDGE, "EDIT", NULL, *************** *** 3262,3266 **** long height(bounds.bottom - bounds.top); ! control_m = ::CreateWindow( WC_COMBOBOX, NULL, WS_CHILD | WS_VISIBLE | CBS_DROPDOWNLIST | WS_TABSTOP, --- 3408,3412 ---- long height(bounds.bottom - bounds.top); ! control_m = ::CreateWindowEx( WS_EX_COMPOSITED, WC_COMBOBOX, NULL, WS_CHILD | WS_VISIBLE | CBS_DROPDOWNLIST | WS_TABSTOP, *************** *** 3273,3277 **** if (control_m == NULL) ADOBE_THROW_LAST_ERROR; ! #ifdef NDEBUG set_user_reference(control_m, this); trap_window_proc(control_window_proc); --- 3419,3423 ---- if (control_m == NULL) ADOBE_THROW_LAST_ERROR; ! #ifndef NDEBUG set_user_reference(control_m, this); trap_window_proc(control_window_proc); *************** *** 3906,3912 **** void slider_t::implementation_t::initialize(const RECT* bounds, ! bool is_vertical, ! slider_style_t style, ! long num_tick_marks) { assert(!control_m); --- 4052,4058 ---- void slider_t::implementation_t::initialize(const RECT* bounds, ! bool is_vertical, ! slider_style_t style, ! long num_tick_marks) { assert(!control_m); *************** *** 3918,3921 **** --- 4064,4068 ---- style_m = style; num_tick_marks_m = num_tick_marks; + uxtheme_type_m = (is_vertical_m) ? TKP_THUMBTOP : TKP_THUMBLEFT; DWORD win32_style = WS_CHILD | WS_VISIBLE | WS_TABSTOP; *************** *** 3938,3942 **** } ! control_m = ::CreateWindowEx( 0, TRACKBAR_CLASS, NULL, --- 4085,4089 ---- } ! control_m = ::CreateWindowEx( WS_EX_COMPOSITED, TRACKBAR_CLASS, NULL, *************** *** 3958,3986 **** { rectangle_t result; ! ! result.width() = 20; ! result.height() = 20; ! ! if (is_vertical_m) ! result.height() += 1; ! else ! result.width() += 1; ! return result; } /****************************************************************************************************/ - - void slider_t::implementation_t::set_bounds(const point_t& position, const rectangle_t& geometry) - { - assert(control_m); - - /*::DeleteObject((HGDIOBJ)*/ ::SetClassLong(control_m, GCL_HBRBACKGROUND, (LONG)(COLOR_BTNFACE + 1))/*)*/; - - _super::set_bounds(position, geometry); - } - - /****************************************************************************************************/ - void slider_t::implementation_t::set_min_value(long min_value) { --- 4105,4129 ---- { rectangle_t result; ! // ! // Get the size of the thumb, and then multiply it by the number of tick ! // marks. ! // ! SIZE thumb_size; ! metrics_t::get_instance().set_window(control_m); ! if (!metrics_t::get_instance().get_size(uxtheme_type_m, TS_TRUE, thumb_size)) ! ADOBE_THROW_LAST_ERROR; ! result.width() = thumb_size.cx;//(is_vertical_m) ? thumb_size.cx : thumb_size.cx * 15; ! result.height() = thumb_size.cy; //(is_vertical_m) ? thumb_size.cy * 15 : thumb_size.cy; ! // ! // Add on any border. ! // ! int border; ! metrics_t::get_instance().get_integer(uxtheme_type_m, TMT_BORDERSIZE, border); ! result.width() += 2 * border; ! result.height() += 2 * border; return result; } /****************************************************************************************************/ void slider_t::implementation_t::set_min_value(long min_value) { |
|
From: Ralph T. <ra...@us...> - 2005-04-08 21:03:59
|
Update of /cvsroot/adobe-source/sandbox/adobe-source/adobe/test/visual/resources In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31751/adobe-source/adobe/test/visual/resources Added Files: aqua_button.ico resources.h resources.rc visual.exe.manifest Log Message: Visual Styles are enabled by default on Windows XP, and controls appear correctly on tabs, etc. A resource file has been added, and the generated exe now has the Adobe Begin icon. The following items still need to be completed on the Windows implementation of ui-core before it reaches parity with the Mac implementation: - slider_t needs to report changes, and actually set it's value. - progress_bar_t also needs work. - link_t's event mechanism should be looked at, it may not be painting when required. --- NEW FILE: visual.exe.manifest --- <?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> <assemblyIdentity processorArchitecture="*" version="5.1.0.0" type="win32" name="Microsoft.Windows.Shell.shell32" /> <description>Windows Shell</description> <dependency> <dependentAssembly> <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" publicKeyToken="6595b64144ccf1df" language="*" processorArchitecture="*" /> </dependentAssembly> </dependency> </assembly> --- NEW FILE: resources.h --- /* Copyright 2005 Ralph Thomas Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt or a copy at http://opensource.adobe.com/licenses.html) */ // /// This file defines the integer IDs for all of the resources /// which are built into visual.exe. // /****************************************************************************************************/ // /// The main application icon. // #define RES_APP_ICON 2 /****************************************************************************************************/ --- NEW FILE: aqua_button.ico --- (This appears to be a binary file; contents omitted.) --- NEW FILE: resources.rc --- #include "windows.h" // // Include the visual styles manifest. // CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "resources\\visual.exe.manifest" // // Include some icons. The icon with the lowest number seems to be // the one which the Windows shell shows. // 2 ICON "resources\\aqua_button.ico" |
|
From: Ralph T. <ra...@us...> - 2005-04-08 21:03:58
|
Update of /cvsroot/adobe-source/sandbox/adobe-source/adobe/test/visual/headers/win In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31751/adobe-source/adobe/test/visual/headers/win Modified Files: metrics.hpp ui_core_implementation.hpp Log Message: Visual Styles are enabled by default on Windows XP, and controls appear correctly on tabs, etc. A resource file has been added, and the generated exe now has the Adobe Begin icon. The following items still need to be completed on the Windows implementation of ui-core before it reaches parity with the Mac implementation: - slider_t needs to report changes, and actually set it's value. - progress_bar_t also needs work. - link_t's event mechanism should be looked at, it may not be painting when required. Index: metrics.hpp =================================================================== RCS file: /cvsroot/adobe-source/sandbox/adobe-source/adobe/test/visual/headers/win/metrics.hpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** metrics.hpp 2 Apr 2005 00:45:21 -0000 1.2 --- metrics.hpp 8 Apr 2005 21:03:50 -0000 1.3 *************** *** 123,126 **** --- 123,144 ---- virtual bool get_margins(int widget_type, MARGINS& out_margins) const = 0; // + /// Return true if visual styles are currently in use, false if they + /// are not being used. + /// + /// \return true if visual styles are in use, false otherwise. + // + virtual bool using_styles() const = 0; + // + /// Use the current style to draw the background of the parent control + /// of the given window using the given DC. This function is useful for + /// drawing the background of controls which appear on top of tab controls, + /// or other places where the color isn't regulation. + /// + /// \param window the window to draw the parent background of. + /// \param dc the DC to draw with. This DC does not have to be + /// drawing onto the given window. + // + virtual void draw_parent_background(HWND window, HDC dc) = 0; + // /// Before any of the other functions can be called, the theme data must be /// loaded from the window. This function should also be called any time the Index: ui_core_implementation.hpp =================================================================== RCS file: /cvsroot/adobe-source/sandbox/adobe-source/adobe/test/visual/headers/win/ui_core_implementation.hpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** ui_core_implementation.hpp 5 Apr 2005 05:46:04 -0000 1.8 --- ui_core_implementation.hpp 8 Apr 2005 21:03:50 -0000 1.9 *************** *** 552,560 **** void initialize( const RECT* bounds, ! bool is_vertical, ! slider_style_t style, ! long num_tick_marks); ! virtual rectangle_t best_bounds(); ! void set_bounds(const point_t& position, const rectangle_t& geometry); void set_min_value(long min_value); void set_max_value(long max_value); --- 552,559 ---- void initialize( const RECT* bounds, ! bool is_vertical, ! slider_style_t style, ! long num_tick_marks); ! virtual rectangle_t best_bounds(); void set_min_value(long min_value); void set_max_value(long max_value); |
|
From: Ralph T. <ra...@us...> - 2005-04-08 21:03:58
|
Update of /cvsroot/adobe-source/sandbox/adobe-source/adobe/test/visual In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31751/adobe-source/adobe/test/visual Modified Files: Jamfile Log Message: Visual Styles are enabled by default on Windows XP, and controls appear correctly on tabs, etc. A resource file has been added, and the generated exe now has the Adobe Begin icon. The following items still need to be completed on the Windows implementation of ui-core before it reaches parity with the Mac implementation: - slider_t needs to report changes, and actually set it's value. - progress_bar_t also needs work. - link_t's event mechanism should be looked at, it may not be painting when required. Index: Jamfile =================================================================== RCS file: /cvsroot/adobe-source/sandbox/adobe-source/adobe/test/visual/Jamfile,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Jamfile 5 Apr 2005 05:46:04 -0000 1.5 --- Jamfile 8 Apr 2005 21:03:49 -0000 1.6 *************** *** 8,22 **** if [ os.name ] = NT { ! PLATFORM_HEADERS = headers/win ; PLATFORM_SOURCE_DIR = sources/win ; ! PLATFORM_SOURCES = sources/win/metrics.cpp sources/win/event_dispatcher.cpp ; } else { PLATFORM_HEADERS = headers/mac ; PLATFORM_SOURCE_DIR = sources/mac ; PLATFORM_SOURCES = ; } project adobe/visual ! : requirements <toolset>msvc:<linkflags>"uxtheme.lib gdi32.lib user32.lib comctl32.lib /subsystem:windows" : requirements <include>headers <link>static ; --- 8,29 ---- if [ os.name ] = NT { ! PLATFORM_HEADERS = headers/win resources ; PLATFORM_SOURCE_DIR = sources/win ; ! PLATFORM_SOURCES = sources/win/metrics.cpp sources/win/event_dispatcher.cpp resources/resources.rc ; ! # ! # These two definitions say that we're targetting Windows XP. That ! # means that we get various preprocessor definitions which we need, ! # such as the WS_EX_COMPOSITED window style. ! # ! PLATFORM_DEFINITIONS = <define>WINVER=0x501 <define>_WIN32_WINNT=0x501 ; } else { PLATFORM_HEADERS = headers/mac ; PLATFORM_SOURCE_DIR = sources/mac ; PLATFORM_SOURCES = ; + PLATFORM_DEFINITIONS = ; } project adobe/visual ! : requirements <toolset>msvc:<linkflags>"gdi32.lib user32.lib comctl32.lib /subsystem:windows" : requirements <include>headers <link>static ; *************** *** 32,35 **** /adobe//asl_lib_dev /boost/filesystem//boost_filesystem ! : <include>$(PLATFORM_HEADERS) <link>static ; ! # <variant>release:<define>NDEBUG ; --- 39,41 ---- /adobe//asl_lib_dev /boost/filesystem//boost_filesystem ! : <include>$(PLATFORM_HEADERS) $(PLATFORM_DEFINITIONS) <link>static ; |
|
From: David C. <unc...@us...> - 2005-04-08 00:59:44
|
Update of /cvsroot/adobe-source/sandbox/adobe-source/adobe/build/asl_lib/asl_lib.xcode In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7240/sandbox/adobe-source/adobe/build/asl_lib/asl_lib.xcode Modified Files: project.pbxproj Log Message: added xstr Index: project.pbxproj =================================================================== RCS file: /cvsroot/adobe-source/sandbox/adobe-source/adobe/build/asl_lib/asl_lib.xcode/project.pbxproj,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** project.pbxproj 1 Apr 2005 17:23:42 -0000 1.2 --- project.pbxproj 8 Apr 2005 00:59:33 -0000 1.3 *************** *** 92,95 **** --- 92,96 ---- 89323C1107FA2B9500AB4B9B, 89323C1207FA2B9500AB4B9B, + 89E1BF2008060E58002A2B83, ); isa = PBXGroup; *************** *** 465,468 **** --- 466,470 ---- 89323C3D07FA2C1800AB4B9B, 89323C3E07FA2C1800AB4B9B, + 89E1BF1B08060E38002A2B83, ); isa = PBXGroup; *************** *** 611,614 **** --- 613,617 ---- buildActionMask = 2147483647; files = ( + 89E1BF1C08060E38002A2B83, ); isa = PBXHeadersBuildPhase; *************** *** 641,644 **** --- 644,648 ---- 89B8AB7607FD120400E27588, 89B8AB7707FD120400E27588, + 89E1BF2108060E58002A2B83, ); isa = PBXSourcesBuildPhase; *************** *** 942,945 **** --- 946,989 ---- }; }; + 89E1BF1B08060E38002A2B83 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.h; + path = xstr.hpp; + refType = 4; + sourceTree = "<group>"; + }; + 89E1BF1C08060E38002A2B83 = { + fileRef = 89E1BF1B08060E38002A2B83; + isa = PBXBuildFile; + settings = { + }; + }; + 89E1BF1D08060E38002A2B83 = { + fileRef = 89E1BF1B08060E38002A2B83; + isa = PBXBuildFile; + settings = { + }; + }; + 89E1BF2008060E58002A2B83 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + path = xstr.cpp; + refType = 4; + sourceTree = "<group>"; + }; + 89E1BF2108060E58002A2B83 = { + fileRef = 89E1BF2008060E58002A2B83; + isa = PBXBuildFile; + settings = { + }; + }; + 89E1BF2208060E58002A2B83 = { + fileRef = 89E1BF2008060E58002A2B83; + isa = PBXBuildFile; + settings = { + }; + }; //890 //891 *************** *** 962,965 **** --- 1006,1010 ---- buildActionMask = 2147483647; files = ( + 89E1BF1D08060E38002A2B83, ); isa = PBXHeadersBuildPhase; *************** *** 989,992 **** --- 1034,1038 ---- 89323C2A07FA2B9500AB4B9B, 89323C2B07FA2B9500AB4B9B, + 89E1BF2208060E58002A2B83, ); isa = PBXSourcesBuildPhase; |
|
From: Foster B. <fos...@us...> - 2005-04-07 23:35:40
|
Update of /cvsroot/adobe-source/sandbox/adobe-source/adobe/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26117 Modified Files: xstr.cpp Log Message: xstr bug fixes Index: xstr.cpp =================================================================== RCS file: /cvsroot/adobe-source/sandbox/adobe-source/adobe/source/xstr.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** xstr.cpp 7 Apr 2005 00:53:25 -0000 1.1 --- xstr.cpp 7 Apr 2005 23:35:15 -0000 1.2 *************** *** 212,216 **** typedef std::vector<attribute_t> attribute_set_t; ! void attribute_value(const adobe::name_t attribute, adobe::name_t& value) const; attribute_set_t attribute_set_m; --- 212,216 ---- typedef std::vector<attribute_t> attribute_set_t; ! void attribute_value(const adobe::name_t& attribute, adobe::name_t& value) const; attribute_set_t attribute_set_m; *************** *** 308,317 **** /*************************************************************************************************/ ! void node_t::attribute_value(const adobe::name_t attribute, adobe::name_t& value) const { attribute_set_t::const_iterator result = adobe::lower_bound( attribute_set_m, ! std::make_pair(value, adobe::name_t()), ! adobe::compare_members(&attribute_set_t::value_type::first)); if (result != attribute_set_m.end() && result->first == attribute) --- 308,317 ---- /*************************************************************************************************/ ! void node_t::attribute_value(const adobe::name_t& attribute, adobe::name_t& value) const { attribute_set_t::const_iterator result = adobe::lower_bound( attribute_set_m, ! node_t::attribute_set_t::value_type(attribute, adobe::name_t()), ! attribute_key_less_t()); if (result != attribute_set_m.end() && result->first == attribute) *************** *** 599,603 **** { adobe::name_t name(first->first); ! adobe::name_t att_value(first->second.template get<std::string>().c_str()); result.push_back(std::make_pair(name, att_value)); --- 599,603 ---- { adobe::name_t name(first->first); ! adobe::name_t att_value(first->second.template get<adobe::name_t>()); result.push_back(std::make_pair(name, att_value)); |
|
From: Foster B. <fos...@us...> - 2005-04-07 00:53:36
|
Update of /cvsroot/adobe-source/sandbox/adobe-source/adobe/build/asl_lib_dev In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25640/adobe/build/asl_lib_dev Modified Files: asl_lib_dev.mcp Log Message: xstr initial commmit. Index: asl_lib_dev.mcp =================================================================== RCS file: /cvsroot/adobe-source/sandbox/adobe-source/adobe/build/asl_lib_dev/asl_lib_dev.mcp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 Binary files /tmp/cvsAymnVA and /tmp/cvswTfLxt differ |
|
From: Foster B. <fos...@us...> - 2005-04-07 00:53:36
|
Update of /cvsroot/adobe-source/sandbox/adobe-source/adobe/documentation/sources/asl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25640/adobe/documentation/sources/asl Added Files: xstr.dox Log Message: xstr initial commmit. --- NEW FILE: xstr.dox --- /*! \class adobe::xstr_t xstr.hpp <adobe/xstr.hpp> \ingroup asl_libraries \brief A context-sensitive string lookup system (pronounced 'x-string') \par Model Of: - \ref concept_regular_type \note The xstr class is thread safe when compiled with BOOST_HAS_THREADS defined. \todo (fbrereto) The language code should be obtained at runtime instead of hard-coded to 'en-us' \section context Context Lookup \subsection context_overview Overview The context of a string is a runtime evaluated collection of information about the state of the machine and the xstr that we currently care about. This context is gathered from several locations: -# the context defaults of the xstr system -# the static attributes of the xstr definition -# a client-passed dictionary of additional context information The context defaults of the xstr system can be set by the client of the library. It is important to know that context already exists here for the xstr system. These pieces are: - lang : defaults to 'en-us' - platform : defaults to 'macintosh', 'windows', or 'unknown' depending on the platform on which the library was compiled. The static attributes of the xstr definition also provide context. Example: \verbatim <xstr id='hello_world' lang='es-sp'>Hola, mundo!</xstr> \endverbatim In the above example the two bits of context are 'id' and 'lang'. These override specific context information as outlined in the "Context Merging" section. Finally, the client can also pass in an adobe::dictionary_t with runtime-obtained context information. This is useful when you have both static information provided by the xstr defintion directly, as well as context information that can only be obtained at runtime. The runtime context overrides specific context information as outlines in the "Context Merging" section. \subsection context_merging Merging There are several context merges that take place in the use of the xstr system. Context merges are necessary because there are several places from which the context of a string is gathered, and conflicting pieces of context must be resolved before the string can be imported into or looked up in the xstr glossary. \subsubsection context_merging_import Importing Into the Glossary When importing into the glossary (either an append or an assign), the following contexts take precedence in the following order: -# static context defined in the xstr -# xstr system default context \subsubsection context_merging_lookup_static Lookup with Static Context When looking up an xstr in the glossary with only the static context of the xstr taken into account, the following contexts take precedence in the following order: -# static context defined in the xstr -# xstr system default context \subsubsection context_merging_lookup_runtime Lookup with Runtime Context When looking up an xstr in the glossary with the static context of the xstr and the runtime context taken into account, the following contexts take precedence in the following order: -# runtime defined context in the adobe::dictionary_t -# static context defined in the xstr -# xstr system default context */ /*! \typedef adobe::xstr_t::parse_range_t The range [first, second) that the parser will use to fill the content of the lookup glossary. */ /*! \fn adobe::xstr_t::xstr_t(const char* xstr) \param xstr the NTBS static xstr definition to be used for string lookup This is one of the constructors you want to use if you have only compile-time context. The context is the attribute set defined in the xstr. */ /*! \fn adobe::xstr_t::xstr_t(const char* xstr, std::size_t n) \param xstr the static xstr definition to be used for string lookup \param n the length of the xstr string This is one of the constructors you want to use if you have only compile-time context. The context is the attribute set defined in the xstr. */ /*! \fn adobe::xstr_t::xstr_t(const char* xstr, std::size_t n, const adobe::dictionary_t& context) \param xstr the static xstr definition to be used for string lookup \param n the length of the xstr string \param context Additional context obtained at runtime for use in string lookup Takes an xstr and an additional dictionary_t whose contents are additional context arguments that will augment the compile-time context found in the xstr. The dictionary arguments will replace the compile-time context if the keys are the same. */ /*! \fn const char* adobe::xstr_t::get() const \return The content of the xstr after glossary lookup as UTF-8. If no string was found to be the closest match, this returns the default string as defined by the xstr. The empty string is a valid default string. The result of this function will always be a valid string pointer. */ /*! \fn void adobe::xstr_t::set_default_context(const adobe::dictionary_t& context) \param context Runtime-obtained context to be used as default context information. Sets the default context of the xstr glossary system. Every xstr parsed after this call is made will have the default context imposed upon it. Note that this is done at the time of the parse, not at the time of the lookup, so it is possible to have a parsed glossary with xstr values that originated with differing default contexts. Therefore it is highly recommended to set the default context once, and to do so before you begin populating the xstr glossary. */ /*! \fn adobe::dictionary_t adobe::xstr_t::get_default_context() \return A dictionary containing the default context information currently stored in the xstr system. */ /*! \fn void adobe::xstr_t::assign_glossary(const parse_range_t& parse_range) \param parse_range The range of text the parser will traverse when assigning the contents of the lookup glossary This completely replaces the contents of the glossary in the xstr system. */ /*! \fn void adobe::xstr_t::append_glossary(const parse_range_t& parse_range) \param parse_range The range of text the parser will traverse when appending in the contents of the lookup glossary \todo (fbrereto) Right now the augmentation of the glossary will not replace strings already found in the glossary. This should not be the case (i.e., new strings that are identical to ones already in the glossary should replace the old one.) This also means that inside the glossary to parse, for the time being, specializations of a string should come BEFORE the general result for a string. */ |
|
From: Foster B. <fos...@us...> - 2005-04-07 00:53:36
|
Update of /cvsroot/adobe-source/sandbox/adobe-source/adobe/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25640/adobe/source Added Files: xstr.cpp Log Message: xstr initial commmit. --- NEW FILE: xstr.cpp --- /* Copyright 2005 Adobe Systems Incorporated Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt or a copy at http://opensource.adobe.com/licenses.html) */ /*************************************************************************************************/ #include <adobe/xstr.hpp> #include <adobe/config.hpp> #include <adobe/name.hpp> #include <adobe/dictionary.hpp> #include <adobe/once.hpp> #include <adobe/algorithm.hpp> #include <adobe/functional.hpp> #include <vector> #include <map> #include <boost/bind.hpp> #ifdef __MWERKS__ // Specific to Metrowerks, not to Macintosh platform. #pragma warn_unusedarg off #endif //#define BOOST_SPIRIT_DEBUG 1 #include <boost/spirit/core.hpp> #ifdef BOOST_SPIRIT_DEBUG #include <boost/spirit/debug.hpp> #endif #ifdef __MWERKS__ // Specific to Metrowerks, not to Macintosh platform. #pragma warn_unusedarg reset #endif #if !defined(NDEBUG) && defined(ADOBE_SERIALIZATION) #define DOING_SERIALIZATION 0 #endif #if DOING_SERIALIZATION #include <iostream> #include <sstream> #endif /*************************************************************************************************/ ADOBE_GLOBAL_MUTEX_DEFINITION(xstr_store) ADOBE_GLOBAL_MUTEX_DEFINITION(xstr_context) ADOBE_ONCE_DECLARATION(xstr_once) ADOBE_ONCE_STATIC_INSTANCE(xstr_once) /*************************************************************************************************/ namespace adobe { /*************************************************************************************************/ /* Just counts the number of outputs; doesn't copy anything. More efficient than a back_insert_iterator into a vector you'll never use if all you're interested in is the size of the resultant vector. */ class back_insert_counter : public std::iterator<std::output_iterator_tag, void, void, void, void> { public: back_insert_counter() : count_m(0) { } template <typename T> back_insert_counter& operator=(const T&) { return *this; } back_insert_counter& operator*() { return *this; } back_insert_counter& operator++() { ++count_m; return *this; } back_insert_counter& operator++(int) { ++count_m; return *this; } std::size_t count() const { return count_m; } private: std::size_t count_m; }; /*************************************************************************************************/ template <typename ForwardIterator1, typename ForwardIterator2> bool is_subset( const ForwardIterator1& first1, const ForwardIterator1& last1, const ForwardIterator2& first2, const ForwardIterator2& last2) { /* subset is a proper subset of superset if size(intersect(subset, superset)) == size(subset) */ std::size_t matches(adobe::set_intersection(first1, last1, first2, last2, back_insert_counter()).count()); std::size_t subset_size(std::distance(first2, last2)); return matches == subset_size; } /*************************************************************************************************/ template <typename ForwardIterator1, typename ForwardIterator2> bool is_subset( ForwardIterator1& first1, ForwardIterator1& last1, ForwardIterator2& first2, ForwardIterator2& last2) { return is_subset( const_cast<const ForwardIterator1>(first1), const_cast<const ForwardIterator1>(last1), const_cast<const ForwardIterator2>(first2), const_cast<const ForwardIterator2>(last2)); } /*************************************************************************************************/ template <typename ForwardIterator1, typename ForwardIterator2, typename BinaryPredicate> bool is_subset( const ForwardIterator1& first1, const ForwardIterator1& last1, const ForwardIterator2& first2, const ForwardIterator2& last2, BinaryPredicate comp) { /* subset is a proper subset of superset if size(intersect(subset, superset)) == size(subset) */ std::size_t matches(adobe::set_intersection(first1, last1, first2, last2, back_insert_counter(), comp).count()); std::size_t subset_size(std::distance(first2, last2)); return matches == subset_size; } /*************************************************************************************************/ template <typename ForwardIterator1, typename ForwardIterator2, typename BinaryPredicate> bool is_subset( ForwardIterator1& first1, ForwardIterator1& last1, ForwardIterator2& first2, ForwardIterator2& last2, BinaryPredicate comp) { return is_subset( const_cast<const ForwardIterator1>(first1), const_cast<const ForwardIterator1>(last1), const_cast<const ForwardIterator2>(first2), const_cast<const ForwardIterator2>(last2), comp); } /*************************************************************************************************/ template <typename ForwardRange1, typename ForwardRange2> inline bool is_subset(const ForwardRange1& superset, const ForwardRange2& subset) { return is_subset( boost::begin(superset), boost::end(superset), boost::begin(subset), boost::end(subset)); } /*************************************************************************************************/ template <typename ForwardRange1, typename ForwardRange2> inline bool is_subset(ForwardRange1& superset, ForwardRange2& subset) { return is_subset( const_cast<const ForwardRange1>(superset), const_cast<const ForwardRange2>(subset)); } /*************************************************************************************************/ template <typename ForwardRange1, typename ForwardRange2, typename BinaryPredicate> inline bool is_subset(const ForwardRange1& superset, const ForwardRange2& subset, BinaryPredicate comp) { return is_subset( boost::begin(superset), boost::end(superset), boost::begin(subset), boost::end(subset), comp); } /*************************************************************************************************/ template <typename ForwardRange1, typename ForwardRange2, typename BinaryPredicate> inline bool is_subset(ForwardRange1& superset, ForwardRange2& subset, BinaryPredicate comp) { return is_subset( const_cast<const ForwardRange1>(superset), const_cast<const ForwardRange2>(subset), comp); } /*************************************************************************************************/ } // namespace adobe /*************************************************************************************************/ namespace { /*************************************************************************************************/ struct str_less_t { bool operator () (const adobe::name_t& x, const adobe::name_t& y) const { return x.get() < y.get(); } }; /*************************************************************************************************/ struct node_t { typedef std::pair<adobe::name_t, adobe::name_t> attribute_t; typedef std::vector<attribute_t> attribute_set_t; void attribute_value(const adobe::name_t attribute, adobe::name_t& value) const; attribute_set_t attribute_set_m; adobe::name_t value_m; }; /*************************************************************************************************/ #if DOING_SERIALIZATION std::ostream& operator << (std::ostream& s, const node_t& node) { node_t::attribute_set_t::const_iterator first(node.attribute_set_m.begin()); node_t::attribute_set_t::const_iterator last(node.attribute_set_m.end()); s << "<xstr"; for (; first != last; ++first) s << " " << first->first.get() << "=\"" << first->second << "\""; s << ">"; s << node.value_m; s << "</xstr>"; return s; } #endif /*************************************************************************************************/ typedef std::multimap<adobe::name_t, node_t, str_less_t> store_t; typedef store_t::iterator store_iterator; typedef store_t::value_type store_value_type; typedef std::pair<store_iterator, store_iterator> store_range_pair_t; /*************************************************************************************************/ static const adobe::once_name_t attribute_id; static const adobe::once_name_t attribute_lang; static const adobe::once_name_t attribute_platform; static const adobe::once_name_t attribute_context; static store_t* xstr_store_g = 0; static node_t::attribute_set_t* default_context_g = 0; /*************************************************************************************************/ struct attribute_less_t { typedef bool result_type; result_type operator () ( const node_t::attribute_set_t::value_type& x, const node_t::attribute_set_t::value_type& y) const { return (x.first.get() < y.first.get()) || (x.first == y.first && x.second.get() < y.second.get()); } }; /*************************************************************************************************/ struct attribute_key_less_t { typedef bool result_type; result_type operator () ( const node_t::attribute_set_t::value_type& x, const node_t::attribute_set_t::value_type& y) const { return x.first.get() < y.first.get(); } }; /*************************************************************************************************/ void init_xstr_once() { static store_t xstr_store_s; static node_t::attribute_set_t default_context_s; adobe::remove_const(attribute_id) = adobe::name_t("id"); adobe::remove_const(attribute_lang) = adobe::name_t("lang"); adobe::remove_const(attribute_platform) = adobe::name_t("platform"); adobe::remove_const(attribute_context) = adobe::name_t("context"); #if ADOBE_PLATFORM_MAC default_context_s.push_back(std::make_pair(attribute_platform, adobe::static_name_t("macintosh"))); #elif ADOBE_PLATFORM_WIN default_context_s.push_back(std::make_pair(attribute_platform, adobe::static_name_t("windows"))); #else default_context_s.push_back(std::make_pair(attribute_platform, adobe::static_name_t("unknown"))); #endif default_context_s.push_back(std::make_pair(attribute_lang, adobe::static_name_t("en-us"))); adobe::sort(default_context_s, attribute_less_t()); xstr_store_g = &xstr_store_s; default_context_g = &default_context_s; } /*************************************************************************************************/ void node_t::attribute_value(const adobe::name_t attribute, adobe::name_t& value) const { attribute_set_t::const_iterator result = adobe::lower_bound( attribute_set_m, std::make_pair(value, adobe::name_t()), adobe::compare_members(&attribute_set_t::value_type::first)); if (result != attribute_set_m.end() && result->first == attribute) value = result->second; } /*************************************************************************************************/ long node_attribute_likeness(const node_t& original, const node_t& test) { bool is_proper_subset(is_subset(original.attribute_set_m, test.attribute_set_m, attribute_less_t())); long result(is_proper_subset ? test.attribute_set_m.size() : 0); #if 0 std::cerr << " Likeness test:\n" << " orig: " << original << "\n" << " test: " << test << "\n" << " rslt: " << result << std::endl; #endif return result; } /*************************************************************************************************/ bool operator == (const node_t& x, const node_t& y) { if (x.attribute_set_m.size() != y.attribute_set_m.size()) return false; // don't compare the value_m of the node, because it is not essential data return node_attribute_likeness(x, y) == x.attribute_set_m.size(); } /*************************************************************************************************/ store_iterator xstr_exact_match(store_range_pair_t range, const store_t::mapped_type& searching) { store_iterator first(range.first); store_iterator last(range.second); for (; first != last; ++first) if (first->second == searching) break; return first; } /*************************************************************************************************/ store_iterator xstr_closest_match(store_range_pair_t range, const store_t::mapped_type& searching) { typedef std::pair<long, store_iterator> likeness_t; typedef std::vector<likeness_t> likeness_set_t; store_iterator first(range.first); store_iterator last(range.second); long range_size(std::distance(first, last)); if (range_size < 2) return first; likeness_set_t likeness_set; for (; first != last; ++first) likeness_set.push_back(std::make_pair(node_attribute_likeness(first->second, searching), first)); adobe::sort(likeness_set, adobe::compare_members(&likeness_t::first)); if (likeness_set.size() > 1) { likeness_set_t::iterator highest(--likeness_set.end()); likeness_set_t::iterator next_highest(highest - 1); if (highest->first == next_highest->first) { #if DOING_SERIALIZATION std::stringstream errstr; errstr << "xstr: ambiguous closest match. Looking for:\n " << searching << "\nfound at least:\n " << highest->second->second << "\nand\n " << next_highest->second->second; throw std::runtime_error(errstr.str()); #else throw std::runtime_error("xstr: ambiguous closest match"); #endif } } return (--likeness_set.end())->second; } /*************************************************************************************************/ store_range_pair_t range_for_key(store_t& store, const store_t::key_type& key) { store_range_pair_t range(store.equal_range(key)); if (range.first != range.second && range.first->first != key) range.first = range.second; return range; } /*************************************************************************************************/ node_t* xstr_store(const store_t::key_type& key, const store_t::mapped_type& mapped) { if (key == store_t::key_type()) throw std::runtime_error("xstr: id missing"); // NOTE (fbrereto) : This has been commented out because copy_to_xstr_store is the only // function that accesses this function. We are interested in grabbing // the mutex only once to make this the fastest group add possible, so // we grab the mutex in copy_to_xstr_store instead of here. If you decide // to change this function's relationship to the rest of this code, make // sure you know what you are doing, lest you introduce a threading issue. // ADOBE_GLOBAL_MUTEX_INSTANCE(xstr_store); store_iterator result(xstr_store_g->end()); store_range_pair_t range(range_for_key(*xstr_store_g, key)); bool add(range.first == range.second); if (!add) { store_iterator match(xstr_exact_match(range, mapped)); if (match != range.second) result = match; else add = true; } if (add) result = xstr_store_g->insert(std::make_pair(key, mapped)); assert (result != xstr_store_g->end()); return &result->second; } /*************************************************************************************************/ void assign_name(adobe::name_t& name, const char* first, const char* last) { name = adobe::name_t(first, last - first); } /*************************************************************************************************/ typedef std::vector<node_t> node_set_t; /*************************************************************************************************/ void merge_attributes(const node_t::attribute_set_t& src1, const node_t::attribute_set_t& src2, node_t::attribute_set_t& dst) { // This merges two attribute sets together and places the union into dst. // In the case where both attribute sets have an element with the same name, // the value in the union will be from src1. The values are not compared when // performing the union. This means the "override" attribute set should be the // first source when you call this function. node_t::attribute_set_t merged; adobe::set_union(src1, src2, std::back_inserter(merged), attribute_key_less_t()); dst = merged; } /*************************************************************************************************/ void push_and_clear_node(node_set_t& node_set, node_t& new_node) { adobe::sort(new_node.attribute_set_m, attribute_less_t()); { ADOBE_GLOBAL_MUTEX_INSTANCE(xstr_context); merge_attributes(new_node.attribute_set_m, *default_context_g, new_node.attribute_set_m); } node_set.push_back(new_node); new_node = node_t(); } /*************************************************************************************************/ struct xstr_parser { explicit xstr_parser(node_set_t& node_set); void do_parse(const adobe::xstr_t::parse_range_t& parse_range); private: node_t::attribute_t cur_attribute; node_t cur_node; // NOTE (fbrereto) : Naming conventions for these rules should follow XML 1.1 spec: // http://www.w3.org/TR/2004/REC-xml11-20040204/ // Note that we are interested in following the XML spec as closely // as possible, but because we are intentionally using a subset of // XML the grammar is clipped in places. boost::spirit::rule<> s; // http://www.w3.org/TR/2004/REC-xml11-20040204/#NT-S boost::spirit::rule<> document; // http://www.w3.org/TR/2004/REC-xml11-20040204/#NT-document boost::spirit::rule<> element; // http://www.w3.org/TR/2004/REC-xml11-20040204/#NT-element boost::spirit::rule<> empty_elem_tag; // http://www.w3.org/TR/2004/REC-xml11-20040204/#NT-EmptyElemTag boost::spirit::rule<> s_tag; // http://www.w3.org/TR/2004/REC-xml11-20040204/#NT-STag boost::spirit::rule<> e_tag; // http://www.w3.org/TR/2004/REC-xml11-20040204/#NT-ETag boost::spirit::rule<> name_start_char; // http://www.w3.org/TR/2004/REC-xml11-20040204/#NT-NameStartChar boost::spirit::rule<> name_char; // http://www.w3.org/TR/2004/REC-xml11-20040204/#NT-NameChar boost::spirit::rule<> name; // http://www.w3.org/TR/2004/REC-xml11-20040204/#NT-Name boost::spirit::rule<> eq; // http://www.w3.org/TR/2004/REC-xml11-20040204/#NT-Eq boost::spirit::rule<> attribute; // http://www.w3.org/TR/2004/REC-xml11-20040204/#NT-Attribute boost::spirit::rule<> content; // http://www.w3.org/TR/2004/REC-xml11-20040204/#NT-content boost::spirit::rule<> att_value; // http://www.w3.org/TR/2004/REC-xml11-20040204/#NT-AttValue }; /*************************************************************************************************/ xstr_parser::xstr_parser(node_set_t& node_set) { s = +(boost::spirit::space_p); document = !s >> *(element[boost::bind(&push_and_clear_node, boost::ref(node_set), boost::ref(cur_node))] >> !s); element = (s_tag >> content[boost::bind(assign_name, boost::ref(cur_node.value_m), _1, _2)] >> e_tag) | empty_elem_tag; empty_elem_tag = "<xstr" >> *(s >> attribute) >> !s >> "/>"; s_tag = "<xstr" >> *(s >> attribute[boost::spirit::push_back_a(cur_node.attribute_set_m, cur_attribute)]) >> !s >> '>'; e_tag = "</xstr" >> !s >> '>'; name_start_char = boost::spirit::alpha_p | '_' | ':'; name_char = name_start_char | boost::spirit::digit_p | '-' | '.'; name = name_start_char >> *(name_char); eq = !s >> '=' >> !s; attribute = name[boost::bind(assign_name, boost::ref(cur_attribute.first), _1, _2)] >> eq >> att_value; content = *(boost::spirit::print_p - '<'); att_value = '\"' >> (*(boost::spirit::print_p - '<' - '&' - '\"'))[boost::bind(assign_name, boost::ref(cur_attribute.second), _1, _2)] >> '\"' | '\'' >> (*(boost::spirit::print_p - '<' - '&' - '\''))[boost::bind(assign_name, boost::ref(cur_attribute.second), _1, _2)] >> '\''; BOOST_SPIRIT_DEBUG_NODE(s); BOOST_SPIRIT_DEBUG_NODE(document); BOOST_SPIRIT_DEBUG_NODE(element); BOOST_SPIRIT_DEBUG_NODE(empty_elem_tag); BOOST_SPIRIT_DEBUG_NODE(s_tag); BOOST_SPIRIT_DEBUG_NODE(e_tag); BOOST_SPIRIT_DEBUG_NODE(name_start_char); BOOST_SPIRIT_DEBUG_NODE(name_char); BOOST_SPIRIT_DEBUG_NODE(name); BOOST_SPIRIT_DEBUG_NODE(eq); BOOST_SPIRIT_DEBUG_NODE(attribute); BOOST_SPIRIT_DEBUG_NODE(content); BOOST_SPIRIT_DEBUG_NODE(att_value); } /*************************************************************************************************/ void xstr_parser::do_parse(const adobe::xstr_t::parse_range_t& parse_range) { std::string definition(parse_range.first, parse_range.second); if (!boost::spirit::parse(definition.c_str(), document).full) throw std::runtime_error("xstr: parse string Ill-formed"); } /*************************************************************************************************/ void copy_to_xstr_store(const node_set_t::value_type& x) { adobe::name_t id; x.attribute_value(attribute_id, id); ADOBE_GLOBAL_MUTEX_INSTANCE(xstr_store); xstr_store(id, x); } /*************************************************************************************************/ node_t::attribute_set_t dictionary_to_attribute_set(const adobe::dictionary_t& dict) { node_t::attribute_set_t result; adobe::dictionary_t::const_iterator first(dict.begin()); adobe::dictionary_t::const_iterator last(dict.end()); for (; first != last; ++first) { adobe::name_t name(first->first); adobe::name_t att_value(first->second.template get<std::string>().c_str()); result.push_back(std::make_pair(name, att_value)); } adobe::sort(result, attribute_less_t()); return result; } /*************************************************************************************************/ void fill_glossary(const adobe::xstr_t::parse_range_t& parse_range, bool append) { if (!append) { ADOBE_GLOBAL_MUTEX_INSTANCE(xstr_store); xstr_store_g->clear(); } node_set_t node_set; xstr_parser(node_set).do_parse(parse_range); adobe::for_each(node_set, copy_to_xstr_store); } /*************************************************************************************************/ } // namespace /*************************************************************************************************/ namespace adobe { /*************************************************************************************************/ struct xstr_t::implementation_t { explicit implementation_t(const char* xstr) { initialize(xstr, xstr + std::strlen(xstr), adobe::dictionary_t()); } implementation_t(const char* xstr, std::size_t n) { initialize(xstr, xstr + n, adobe::dictionary_t()); } implementation_t(const char* xstr, std::size_t n, const adobe::dictionary_t& context) { initialize(xstr, xstr + n, context); } const char* get() const; private: implementation_t(); void initialize(const char* first, const char* last, const adobe::dictionary_t& context); adobe::name_t utf8_m; }; /*************************************************************************************************/ void xstr_t::implementation_t::initialize(const char* first, const char* last, const adobe::dictionary_t& context) { // parse out the xstr definition node_set_t node_set; xstr_parser(node_set).do_parse(std::make_pair(first, last)); if (node_set.size() > 1) throw std::runtime_error("xstr: Illegal initialization"); adobe::name_t key; node_t& node(*node_set.begin()); node.attribute_value(attribute_id, key); // impose the default context information { ADOBE_GLOBAL_MUTEX_INSTANCE(xstr_context); merge_attributes(node.attribute_set_m, *default_context_g, node.attribute_set_m); } // impose runtime context information if applicable if (!context.empty()) merge_attributes(dictionary_to_attribute_set(context), node.attribute_set_m, node.attribute_set_m); // do the actual lookup of the xstr ADOBE_GLOBAL_MUTEX_INSTANCE(xstr_store); store_iterator result(xstr_closest_match(range_for_key(*xstr_store_g, key), node)); utf8_m = (result != xstr_store_g->end()) ? result->second.value_m : node.value_m; } /*************************************************************************************************/ const char* xstr_t::implementation_t::get() const { return utf8_m.get(); } /*************************************************************************************************/ xstr_t::xstr_t(const char* xstr) : object_m(new implementation_t(xstr)) { } xstr_t::xstr_t(const char* xstr, std::size_t n) : object_m(new implementation_t(xstr, n)) { } xstr_t::xstr_t(const char* xstr, std::size_t n, const adobe::dictionary_t& context) : object_m(new implementation_t(xstr, n, context)) { } xstr_t::xstr_t(const xstr_t& rhs) : object_m(new implementation_t(*rhs.object_m)) { } xstr_t::~xstr_t() { delete object_m; } xstr_t& xstr_t::operator = (const xstr_t& rhs) { *object_m = *rhs.object_m; return *this; } const char* xstr_t::get() const { return object_m->get(); } void xstr_t::assign_glossary(const parse_range_t& parse_range) { fill_glossary(parse_range, false); } void xstr_t::append_glossary(const parse_range_t& parse_range) { fill_glossary(parse_range, true); } void xstr_t::set_default_context(const adobe::dictionary_t& context) { node_t::attribute_set_t new_context(dictionary_to_attribute_set(context)); adobe::sort(new_context, attribute_less_t()); ADOBE_GLOBAL_MUTEX_INSTANCE(xstr_context); *default_context_g = new_context; } adobe::dictionary_t xstr_t::get_default_context() { adobe::dictionary_t result; adobe::dictionary_t::write_reference dict(result.write()); { ADOBE_GLOBAL_MUTEX_INSTANCE(xstr_context); node_t::attribute_set_t::const_iterator first(default_context_g->begin()); node_t::attribute_set_t::const_iterator last(default_context_g->end()); for (; first != last; ++first) dict[first->first] = adobe::value_t(first->second); } return result; } /*************************************************************************************************/ } // namespace adobe /*************************************************************************************************/ ADOBE_ONCE_DEFINITION(xstr_once, init_xstr_once) /*************************************************************************************************/ |
|
From: Foster B. <fos...@us...> - 2005-04-07 00:53:36
|
Update of /cvsroot/adobe-source/sandbox/adobe-source/adobe/documentation/sources In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25640/adobe/documentation/sources Modified Files: documentation.doxygen Log Message: xstr initial commmit. Index: documentation.doxygen =================================================================== RCS file: /cvsroot/adobe-source/sandbox/adobe-source/adobe/documentation/sources/documentation.doxygen,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** documentation.doxygen 19 Mar 2005 00:16:40 -0000 1.1 --- documentation.doxygen 7 Apr 2005 00:53:25 -0000 1.2 *************** *** 528,531 **** --- 528,532 ---- ../../value_fwd.hpp \ ../../virtual_machine.hpp \ + ../../xstr.hpp \ ../../source/array.cpp \ ../../source/adam_evaluate.cpp \ *************** *** 544,548 **** ../../source/typeinfo.cpp \ ../../source/value.cpp \ ! ../../source/virtual_machine.cpp # If the value of the INPUT tag contains directories, you can use the --- 545,550 ---- ../../source/typeinfo.cpp \ ../../source/value.cpp \ ! ../../source/virtual_machine.cpp \ ! ../../source/xstr.cpp # If the value of the INPUT tag contains directories, you can use the |
|
From: Foster B. <fos...@us...> - 2005-04-07 00:53:34
|
Update of /cvsroot/adobe-source/sandbox/adobe-source/adobe/build/asl_lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25640/adobe/build/asl_lib Modified Files: asl_lib.mcp Log Message: xstr initial commmit. Index: asl_lib.mcp =================================================================== RCS file: /cvsroot/adobe-source/sandbox/adobe-source/adobe/build/asl_lib/asl_lib.mcp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 Binary files /tmp/cvsXrKAnB and /tmp/cvs4zFs0t differ |
|
From: Foster B. <fos...@us...> - 2005-04-07 00:53:34
|
Update of /cvsroot/adobe-source/sandbox/adobe-source/adobe/build In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25640/adobe/build Modified Files: Jamfile Log Message: xstr initial commmit. Index: Jamfile =================================================================== RCS file: /cvsroot/adobe-source/sandbox/adobe-source/adobe/build/Jamfile,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Jamfile 30 Mar 2005 22:34:32 -0000 1.3 --- Jamfile 7 Apr 2005 00:53:24 -0000 1.4 *************** *** 75,78 **** --- 75,79 ---- [ obj value_dev_o : source/value.cpp : $(ASL_DEV_OBJ_FLAGS) ] [ obj virtual_machine_dev_o : source/virtual_machine.cpp : $(ASL_DEV_OBJ_FLAGS) ] + [ obj xstr_dev_o : source/xstr.cpp : $(ASL_DEV_OBJ_FLAGS) ] # # Add the future sources to the dev build. *************** *** 107,110 **** --- 108,112 ---- [ obj value_o : source/value.cpp : $(ASL_OBJ_FLAGS) ] [ obj virtual_machine_o : source/virtual_machine.cpp : $(ASL_OBJ_FLAGS) ] + [ obj xstr_o : source/xstr.cpp : $(ASL_OBJ_FLAGS) ] : <use>boost_signals <use>boost_thread $(ASL_OBJ_FLAGS) <link>static : |
|
From: Foster B. <fos...@us...> - 2005-04-07 00:53:33
|
Update of /cvsroot/adobe-source/sandbox/adobe-source/adobe In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25640/adobe Added Files: xstr.hpp Log Message: xstr initial commmit. --- NEW FILE: xstr.hpp --- /* Copyright 2005 Adobe Systems Incorporated Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt or a copy at http://opensource.adobe.com/licenses.html) */ /*************************************************************************************************/ #ifndef ADOBE_XSTR_HPP #define ADOBE_XSTR_HPP /*************************************************************************************************/ #include <adobe/name_fwd.hpp> #include <adobe/dictionary_fwd.hpp> #include <adobe/algorithm.hpp> /*************************************************************************************************/ namespace adobe { /*************************************************************************************************/ class xstr_t; /*************************************************************************************************/ } // namespace adobe /*************************************************************************************************/ #if !defined(ADOBE_NO_DOCUMENTATION) void swap(adobe::xstr_t& x, adobe::xstr_t& y); #endif /*************************************************************************************************/ namespace adobe { /*************************************************************************************************/ class xstr_t { public: typedef std::pair<const char*, const char*> parse_range_t; explicit xstr_t(const char* xstr); xstr_t(const char* xstr, std::size_t n); xstr_t(const char* xstr, std::size_t n, const adobe::dictionary_t& context); #if !defined(ADOBE_NO_DOCUMENTATION) xstr_t(const xstr_t& rhs); ~xstr_t(); xstr_t& operator = (const xstr_t& rhs); #endif const char* get() const; static void assign_glossary(const parse_range_t& parse_range); static void append_glossary(const parse_range_t& parse_range); static void set_default_context(const adobe::dictionary_t& context); static adobe::dictionary_t get_default_context(); private: #if !defined(ADOBE_NO_DOCUMENTATION) friend void ::swap(adobe::xstr_t& x, adobe::xstr_t& y); struct implementation_t; implementation_t* object_m; #endif }; /*************************************************************************************************/ } // namespace adobe /*************************************************************************************************/ #if !defined(ADOBE_NO_DOCUMENTATION) inline void swap(adobe::xstr_t& x, adobe::xstr_t& y) { adobe::swap(x.object_m, y.object_m); } #endif /*************************************************************************************************/ #endif /*************************************************************************************************/ |