|
From: Foster B. <fos...@us...> - 2005-04-20 00:26:37
|
Update of /cvsroot/adobe-source/sandbox/visual_refactor/adobe/test/visual/sources/win In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12747/adobe/test/visual/sources/win Modified Files: ui_core_implementation.cpp Log Message: Building again on Win32 Index: ui_core_implementation.cpp =================================================================== RCS file: /cvsroot/adobe-source/sandbox/visual_refactor/adobe/test/visual/sources/win/ui_core_implementation.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ui_core_implementation.cpp 19 Apr 2005 17:56:00 -0000 1.2 --- ui_core_implementation.cpp 20 Apr 2005 00:25:40 -0000 1.3 *************** *** 151,156 **** if (s.poi_m.size()) { ! adobe::points_of_interest_t::const_iterator first(s.poi_m.begin()); ! adobe::points_of_interest_t::const_iterator last(s.poi_m.end()); adobe::array_t poi_array; --- 151,156 ---- if (s.poi_m.size()) { ! adobe::guide_set_t::const_iterator first(s.poi_m.begin()); ! adobe::guide_set_t::const_iterator last(s.poi_m.end()); adobe::array_t poi_array; *************** *** 640,648 **** { ! adobe::points_of_interest_t::const_iterator iter(control.geometry_m.slice_m[adobe::extents_slices_t::horizontal].poi_m.begin()); ! adobe::points_of_interest_t::const_iterator last(control.geometry_m.slice_m[adobe::extents_slices_t::horizontal].poi_m.end()); for (; iter != last; ++iter) { ! adobe::points_of_interest_t::value_type cur(*iter); long poi(left + cur); RECT top_tick = { poi, top, poi + 1, top + tick_height }; --- 640,648 ---- { ! adobe::guide_set_t::const_iterator iter(control.geometry_m.slice_m[adobe::extents_slices_t::horizontal].poi_m.begin()); ! adobe::guide_set_t::const_iterator last(control.geometry_m.slice_m[adobe::extents_slices_t::horizontal].poi_m.end()); for (; iter != last; ++iter) { ! adobe::guide_set_t::value_type cur(*iter); long poi(left + cur); RECT top_tick = { poi, top, poi + 1, top + tick_height }; *************** *** 655,663 **** { ! adobe::points_of_interest_t::const_iterator iter(control.geometry_m.slice_m[adobe::extents_slices_t::vertical].poi_m.begin()); ! adobe::points_of_interest_t::const_iterator last(control.geometry_m.slice_m[adobe::extents_slices_t::vertical].poi_m.end()); for (; iter != last; ++iter) { ! adobe::points_of_interest_t::value_type cur(*iter); long poi(top + cur); RECT left_tick = { left, poi, left + tick_width, poi + 1 }; --- 655,663 ---- { ! adobe::guide_set_t::const_iterator iter(control.geometry_m.slice_m[adobe::extents_slices_t::vertical].poi_m.begin()); ! adobe::guide_set_t::const_iterator last(control.geometry_m.slice_m[adobe::extents_slices_t::vertical].poi_m.end()); for (; iter != last; ++iter) { ! adobe::guide_set_t::value_type cur(*iter); long poi(top + cur); RECT left_tick = { left, poi, left + tick_width, poi + 1 }; *************** *** 1366,1370 **** /****************************************************************************************************/ ! void window_t::implementation_t::set_bounds(const point_t& position, const extents_t& geometry) { assert(window_m); --- 1366,1370 ---- /****************************************************************************************************/ ! void window_t::implementation_t::set_bounds(const point_2d_t& position, const extents_t& geometry) { assert(window_m); *************** *** 1377,1382 **** ::GetWindowRect(window_m, &window_rect); ! ::MoveWindow( window_m, position.first + window_rect.left, ! position.second + window_rect.top, geometry_m.width() + extra.first, geometry_m.height() + extra.second, TRUE); --- 1377,1382 ---- ::GetWindowRect(window_m, &window_rect); ! ::MoveWindow( window_m, position.x_m + window_rect.left, ! position.y_m + window_rect.top, geometry_m.width() + extra.first, geometry_m.height() + extra.second, TRUE); *************** *** 1540,1543 **** --- 1540,1585 ---- return DefWindowProc(window, message, wParam, lParam); } + + /****************************************************************************************************/ + + void register_invisible_parent(HWND& invisible_parent) + { + // + // If the invisible parent hasn't been created yet then we should create + // it here. + // + if (invisible_parent) return; + + WNDCLASSW wc; + // + // First we need to register the window class. As the static + // invisible parent hasn't been created yet, it's a pretty + // safe bet to assume that this class hasn't been registered + // yet. + // + wc.style = CS_HREDRAW | CS_VREDRAW; + wc.lpfnWndProc = invisible_window_proc; + wc.cbClsExtra = 0; + wc.cbWndExtra = 0; + wc.hInstance = ::GetModuleHandle(NULL); + wc.hIcon = 0; + wc.hCursor = LoadCursor(NULL, IDC_ARROW); + wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1); + wc.hbrBackground = (HBRUSH)(COLOR_BACKGROUND + 1); + wc.lpszMenuName = NULL; + wc.lpszClassName = L"eve_invisible_parent"; + + if (!RegisterClassW(&wc)) ADOBE_THROW_LAST_ERROR; + + // + // Now create the window. + // + invisible_parent = 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) ADOBE_THROW_LAST_ERROR; + } + /****************************************************************************************************/ *************** *** 1553,1590 **** // child_id_m = event_dispatcher_m.subscribe(this); // ! // If the invisible parent hasn't been created yet then we should create ! // it here. // ! if (!invisible_parent_m) ! { ! WNDCLASSW wc; ! // ! // First we need to register the window class. As the static ! // invisible parent hasn't been created yet, it's a pretty ! // safe bet to assume that this class hasn't been registered ! // yet. ! // ! wc.style = CS_HREDRAW | CS_VREDRAW; ! wc.lpfnWndProc = invisible_window_proc; ! wc.cbClsExtra = 0; ! wc.cbWndExtra = 0; ! wc.hInstance = ::GetModuleHandle(NULL); ! wc.hIcon = 0; ! wc.hCursor = LoadCursor(NULL, IDC_ARROW); ! wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1); ! wc.hbrBackground = (HBRUSH)(COLOR_BACKGROUND + 1); ! wc.lpszMenuName = NULL; ! wc.lpszClassName = L"eve_invisible_parent"; ! if (!RegisterClassW(&wc)) ADOBE_THROW_LAST_ERROR; ! // ! // 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; ! } } --- 1595,1617 ---- // child_id_m = event_dispatcher_m.subscribe(this); + + register_invisible_parent(invisible_parent_m); + } + + /****************************************************************************************************/ + + control_t::control_t(theme_t theme) : + control_m(0), uxtheme_type_m(0), theme_m(theme), default_window_proc_m(0), + child_id_m(0) + #ifndef NDEBUG + , placed_m(false) + #endif + { // ! // All controls *must* have a child id. // ! child_id_m = event_dispatcher_m.subscribe(this); ! register_invisible_parent(invisible_parent_m); } *************** *** 1671,1687 **** /****************************************************************************************************/ ! void control_t::set_bounds(const point_t& pos, const extents_t& geo) { assert(control_m); ! point_t position(pos); extents_t geometry(geo); RECT new_bounds = { ! position.first, ! position.second, ! position.first + geometry.width(), ! position.second + geometry.height() }; --- 1698,1714 ---- /****************************************************************************************************/ ! void control_t::set_bounds(const point_2d_t& pos, const extents_t& geo) { assert(control_m); ! point_2d_t position(pos); extents_t geometry(geo); RECT new_bounds = { ! position.x_m, ! position.y_m, ! position.x_m + geometry.width(), ! position.y_m + geometry.height() }; *************** *** 2439,2445 **** /****************************************************************************************************/ ! checkbox_t::implementation_t::implementation_t() : ! is_checked_m(false) { } --- 2466,2476 ---- /****************************************************************************************************/ ! checkbox_t::implementation_t::implementation_t( const std::string& name, ! adobe::value_t true_value, ! adobe::value_t false_value, ! theme_t theme) : ! _super(theme), true_value_m(true_value), false_value_m(false_value) { + initialize(initial_bounds_g, name); } *************** *** 2447,2451 **** checkbox_t::implementation_t::implementation_t(const implementation_t& rhs) : ! _super(rhs), is_checked_m(rhs.is_checked_m) { RECT bounds = { 0 }; --- 2478,2483 ---- checkbox_t::implementation_t::implementation_t(const implementation_t& rhs) : ! _super(rhs), true_value_m(rhs.true_value_m), false_value_m(rhs.false_value_m), ! current_value_m(rhs.current_value_m) { RECT bounds = { 0 }; *************** *** 2469,2473 **** control_m = ::CreateWindowEx( WS_EX_COMPOSITED, "BUTTON", name.c_str(), ! WS_CHILD | WS_VISIBLE | BS_CHECKBOX | WS_TABSTOP | BS_NOTIFY, bounds.left, bounds.top, width, height, invisible_parent_m, --- 2501,2505 ---- control_m = ::CreateWindowEx( WS_EX_COMPOSITED, "BUTTON", name.c_str(), ! WS_CHILD | WS_VISIBLE | BS_3STATE | WS_TABSTOP | BS_NOTIFY, bounds.left, bounds.top, width, height, invisible_parent_m, *************** *** 2477,2495 **** if (control_m == NULL) ADOBE_THROW_LAST_ERROR; #ifndef NDEBUG set_user_reference(control_m, this); trap_window_proc(control_window_proc); #endif } /****************************************************************************************************/ ! void checkbox_t::implementation_t::set_value(std::size_t is_checked) { assert(control_m); ! is_checked_m = is_checked; ! ::SendMessage(control_m, BM_SETCHECK, is_checked_m ? BST_CHECKED : BST_UNCHECKED, 0); } --- 2509,2544 ---- if (control_m == NULL) ADOBE_THROW_LAST_ERROR; + #ifndef NDEBUG set_user_reference(control_m, this); trap_window_proc(control_window_proc); #endif + + set_theme(theme_m); } /****************************************************************************************************/ ! extents_t checkbox_t::implementation_t::measure() ! { ! return _super::best_bounds(); ! } ! ! /****************************************************************************************************/ ! ! void checkbox_t::implementation_t::set_value(adobe::value_t new_value) { assert(control_m); ! if (current_value_m == new_value) return; ! current_value_m = new_value; ! ! WPARAM state(BST_INDETERMINATE); ! ! if (current_value_m == true_value_m) state = BST_CHECKED; ! else if (current_value_m == false_value_m) state = BST_UNCHECKED; ! ! ::SendMessage(control_m, BM_SETCHECK, state, 0); } *************** *** 2500,2504 **** assert(control_m); ! if (!hit_proc_m) hit_proc_m = proc; } --- 2549,2553 ---- assert(control_m); ! hit_proc_m = proc; } *************** *** 2521,2527 **** void checkbox_t::implementation_t::user_hit() { ! set_value(!is_checked_m); ! if (!hit_proc_m.empty()) hit_proc_m(modifiers_t(), is_checked_m); } --- 2570,2580 ---- void checkbox_t::implementation_t::user_hit() { ! adobe::value_t new_value(true_value_m); ! if (current_value_m == true_value_m) new_value = false_value_m; ! ! set_value(new_value); ! ! if (!hit_proc_m.empty()) hit_proc_m(new_value); } *************** *** 2626,2630 **** /****************************************************************************************************/ ! void link_t::implementation_t::set_bounds(const point_t& position, const extents_t& geometry) { assert(control_m); --- 2679,2683 ---- /****************************************************************************************************/ ! void link_t::implementation_t::set_bounds(const point_2d_t& position, const extents_t& geometry) { assert(control_m); *************** *** 3135,3143 **** /****************************************************************************************************/ ! void edit_text_t::implementation_t::set_bounds(const point_t& pos, const extents_t& geo) { assert(control_m); ! point_t position(pos); extents_t geometry(geo); --- 3188,3196 ---- /****************************************************************************************************/ ! void edit_text_t::implementation_t::set_bounds(const point_2d_t& pos, const extents_t& geo) { assert(control_m); ! point_2d_t position(pos); extents_t geometry(geo); *************** *** 3152,3156 **** // adobe::extents_t label_geometry; ! adobe::point_t label_position(position); // // We stored the height of the label in best_bounds. The width of --- 3205,3209 ---- // adobe::extents_t label_geometry; ! adobe::point_2d_t label_position(position); // // We stored the height of the label in best_bounds. The width of *************** *** 3164,3171 **** // edit widget. We stored the label's baseline in best_bounds. // ! label_position.second += baseline - static_baseline_m; get_label().set_bounds(label_position, label_geometry); ! position.first += label_geometry.width() + gap; geometry.width() -= label_geometry.width() + gap; } --- 3217,3224 ---- // edit widget. We stored the label's baseline in best_bounds. // ! label_position.y_m += baseline - static_baseline_m; get_label().set_bounds(label_position, label_geometry); ! position.x_m += label_geometry.width() + gap; geometry.width() -= label_geometry.width() + gap; } *************** *** 3174,3178 **** // alignment. // ! position.second += baseline - edit_baseline_m; geometry.height() = edit_height_m; _super::set_bounds(position, geometry); --- 3227,3231 ---- // alignment. // ! position.y_m += baseline - edit_baseline_m; geometry.height() = edit_height_m; _super::set_bounds(position, geometry); *************** *** 3204,3208 **** long left(bounds.left); extents_t rect; ! point_t position(left + left_adjust, top); rect.height() = bounds.bottom - bounds.top; --- 3257,3261 ---- long left(bounds.left); extents_t rect; ! point_2d_t position(left + left_adjust, top); rect.height() = bounds.bottom - bounds.top; *************** *** 3550,3558 **** /****************************************************************************************************/ ! void popup_t::implementation_t::set_bounds(const point_t& pos, const extents_t& geometry) { assert(control_m); ! point_t position(pos); geometry_m = geometry; // --- 3603,3611 ---- /****************************************************************************************************/ ! void popup_t::implementation_t::set_bounds(const point_2d_t& pos, const extents_t& geometry) { assert(control_m); ! point_2d_t position(pos); geometry_m = geometry; // *************** *** 3571,3575 **** // Apply the vertical offset. // ! point_t label_pos(pos.first, pos.second + (baseline - static_baseline_m)); // // The width of the label is the first horizontal --- 3624,3628 ---- // Apply the vertical offset. // ! point_2d_t label_pos(pos.x_m, pos.y_m + (baseline - static_baseline_m)); // // The width of the label is the first horizontal *************** *** 3589,3593 **** // long width = gap + label_size.width(); ! position.first += width; geometry_m.width() -= width; } --- 3642,3646 ---- // long width = gap + label_size.width(); ! position.x_m += width; geometry_m.width() -= width; } *************** *** 3623,3627 **** long top(bounds.top); long left(bounds.left); ! point_t position(left + left_adjust, top + top_adjust); extents_t rect; --- 3676,3680 ---- long top(bounds.top); long left(bounds.left); ! point_2d_t position(left + left_adjust, top + top_adjust); extents_t rect; *************** *** 3876,3887 **** /****************************************************************************************************/ ! void unit_edit_text_t::implementation_t::set_bounds(const point_t& pos, const extents_t& geometry) { assert(control_m); ! point_t position(pos); adobe::extents_t edit_geometry; adobe::extents_t copy_geometry(geometry); ! adobe::point_t edit_position(pos); long baseline(geometry.slice_m[extents_slices_t::vertical].poi_m[0]); // --- 3929,3940 ---- /****************************************************************************************************/ ! void unit_edit_text_t::implementation_t::set_bounds(const point_2d_t& pos, const extents_t& geometry) { assert(control_m); ! point_2d_t position(pos); adobe::extents_t edit_geometry; adobe::extents_t copy_geometry(geometry); ! adobe::point_2d_t edit_position(pos); long baseline(geometry.slice_m[extents_slices_t::vertical].poi_m[0]); // *************** *** 3918,3922 **** // adobe::extents_t popup_geometry; ! adobe::point_t popup_position(pos); popup_geometry.width() = copy_geometry.slice_m[extents_slices_t::horizontal].length_m - --- 3971,3975 ---- // adobe::extents_t popup_geometry; ! adobe::point_2d_t popup_position(pos); popup_geometry.width() = copy_geometry.slice_m[extents_slices_t::horizontal].length_m - *************** *** 3929,3938 **** // edit_geometry.width() -= popup_geometry.width() + gap; ! popup_position.first += edit_geometry.width() + gap; // // Apply any required vertical offset to the popup // position. // ! popup_position.second += baseline - popup_baseline_m; get_popup().set_bounds(popup_position, popup_geometry); --- 3982,3991 ---- // edit_geometry.width() -= popup_geometry.width() + gap; ! popup_position.x_m += edit_geometry.width() + gap; // // Apply any required vertical offset to the popup // position. // ! popup_position.y_m += baseline - popup_baseline_m; get_popup().set_bounds(popup_position, popup_geometry); *************** *** 3942,3946 **** // it. The position might have been shifted vertically. // ! edit_position.second += baseline - edit_baseline_m; _super::set_bounds(edit_position, edit_geometry); geometry_m = geometry; --- 3995,3999 ---- // it. The position might have been shifted vertically. // ! edit_position.y_m += baseline - edit_baseline_m; _super::set_bounds(edit_position, edit_geometry); geometry_m = geometry; *************** *** 4415,4419 **** /****************************************************************************************************/ ! void hitless_t::implementation_t::set_bounds(const point_t&, const extents_t&) { /* do nothing on Win for now */ --- 4468,4472 ---- /****************************************************************************************************/ ! void hitless_t::implementation_t::set_bounds(const point_2d_t&, const extents_t&) { /* do nothing on Win for now */ *************** *** 4467,4471 **** #ifndef NDEBUG ! void frame_geometry(window_t& window, const point_t& position, const extents_t& geometry) { #if 0 --- 4520,4524 ---- #ifndef NDEBUG ! void frame_extents(window_t& window, const point_2d_t& position, const extents_t& geometry) { #if 0 *************** *** 4500,4508 **** { ! points_of_interest_t::const_iterator iter(geometry.slice_m[extents_slices_t::horizontal].poi_m.begin()); ! points_of_interest_t::const_iterator last(geometry.slice_m[extents_slices_t::horizontal].poi_m.end()); for (; iter != last; ++iter) { ! points_of_interest_t::value_type cur(*iter); long poi(left + cur); CGRect top_tick(::CGRectMake(poi, top, 1, tick_height)); --- 4553,4561 ---- { ! guide_set_t::const_iterator iter(geometry.slice_m[extents_slices_t::horizontal].poi_m.begin()); ! guide_set_t::const_iterator last(geometry.slice_m[extents_slices_t::horizontal].poi_m.end()); for (; iter != last; ++iter) { ! guide_set_t::value_type cur(*iter); long poi(left + cur); CGRect top_tick(::CGRectMake(poi, top, 1, tick_height)); *************** *** 4515,4523 **** { ! points_of_interest_t::const_iterator iter(geometry.slice_m[extents_slices_t::vertical].poi_m.begin()); ! points_of_interest_t::const_iterator last(geometry.slice_m[extents_slices_t::vertical].poi_m.end()); for (; iter != last; ++iter) { ! points_of_interest_t::value_type cur(*iter); long poi(top + cur); CGRect left_tick(::CGRectMake(left, poi, tick_width, 1)); --- 4568,4576 ---- { ! guide_set_t::const_iterator iter(geometry.slice_m[extents_slices_t::vertical].poi_m.begin()); ! guide_set_t::const_iterator last(geometry.slice_m[extents_slices_t::vertical].poi_m.end()); for (; iter != last; ++iter) { ! guide_set_t::value_type cur(*iter); long poi(top + cur); CGRect left_tick(::CGRectMake(left, poi, tick_width, 1)); *************** *** 4540,4544 **** /****************************************************************************************************/ ! bool clear_geometry_frames(window_t& window) { hitless_t& hitless(window.implementation().framing_control_m); --- 4593,4597 ---- /****************************************************************************************************/ ! bool clear_extents_frames(window_t& window) { hitless_t& hitless(window.implementation().framing_control_m); |