From: Foster B. <fos...@us...> - 2005-03-28 19:33:38
|
Update of /cvsroot/adobe-source/sandbox/adobe-source/adobe/test/visual/sources/win In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25713/visual/sources/win Modified Files: ui_core_implementation.cpp Log Message: More Win32 implementation updates 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.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ui_core_implementation.cpp 24 Mar 2005 19:37:55 -0000 1.3 --- ui_core_implementation.cpp 28 Mar 2005 19:33:27 -0000 1.4 *************** *** 248,252 **** void apply_fudges(adobe::rectangle_t& geometry, const adobe::fudge_t& fudges) { - #if 0 geometry.slice_m[adobe::rectangle_slices_t::vertical].length_m += fudges.top() + fudges.bottom(); geometry.slice_m[adobe::rectangle_slices_t::horizontal].length_m += fudges.left() + fudges.right(); --- 248,251 ---- *************** *** 255,259 **** if (poi.size()) poi[0] += fudges.baseline_m; - #endif } --- 254,257 ---- *************** *** 262,266 **** void shed_fudges(adobe::point_t& position, adobe::rectangle_t& geometry, const adobe::fudge_t& fudges) { - #if 0 position.second -= fudges.top(); position.first -= fudges.left(); --- 260,263 ---- *************** *** 268,272 **** geometry.height() -= fudges.bottom(); geometry.width() -= fudges.right(); - #endif } --- 265,268 ---- *************** *** 435,442 **** switch (theme & adobe::theme_mask_s) { ! case adobe::theme_large_s: return 12; break; ! case adobe::theme_normal_s: return 11; break; // confirmed; WinXP classic mode ASCII charset ! case adobe::theme_small_s: return 10; break; ! case adobe::theme_mini_s: return 9; break; } --- 431,438 ---- switch (theme & adobe::theme_mask_s) { ! case adobe::theme_large_s: return 13; break; ! case adobe::theme_normal_s: return 12; break; // confirmed; WinXP classic mode ASCII charset ! case adobe::theme_small_s: return 11; break; ! case adobe::theme_mini_s: return 10; break; } *************** *** 504,507 **** --- 500,545 ---- /****************************************************************************************************/ + RECT get_window_client_offset_rect(HWND window) + { + assert(window); + + RECT window_rect; + RECT client_rect; + + ::GetWindowRect(window, &window_rect); + ::GetClientRect(window, &client_rect); + + ::ClientToScreen(window, (LPPOINT) &client_rect.left); + ::ClientToScreen(window, (LPPOINT) &client_rect.right); + + RECT result; + + result.left = std::abs(window_rect.left - client_rect.left); + result.top = std::abs(window_rect.top - client_rect.top); + result.right = std::abs(window_rect.right - client_rect.right); + result.bottom = std::abs(window_rect.bottom - client_rect.bottom); + + return result; + } + + /****************************************************************************************************/ + + std::pair<long, long> get_window_client_offsets(HWND window) + { + assert(window); + + RECT window_rect; + RECT client_rect; + + ::GetWindowRect(window, &window_rect); + ::GetClientRect(window, &client_rect); + + long extra_width = (window_rect.right - window_rect.left) - (client_rect.right - client_rect.left); + long extra_height = (window_rect.bottom - window_rect.top) - (client_rect.bottom - client_rect.top); + + return std::make_pair(extra_width, extra_height); + } + + /****************************************************************************************************/ #if 0 *************** *** 810,826 **** typedef draw_element_set_t::value_type de_t; ! draw_element_set_t frame_set; ! HWND window(control.control_m); ! HDC context(::GetWindowDC(window)); ! RECT bounds; ! COLORREF green(RGB(0, 255, 0)); ! COLORREF red(RGB(255, 0, 0)); ! ! ::GetClientRect(window, &bounds); long tick(3); ! long top(bounds.top); ! long left(bounds.left); ! long bottom(top + control.geometry_m.height()); long right(left + control.geometry_m.width()); long tick_width(std::min<long>(tick, control.geometry_m.width())); --- 848,863 ---- typedef draw_element_set_t::value_type de_t; ! draw_element_set_t frame_set; ! HWND window(control.control_m); ! HWND main_window(::GetAncestor(window, GA_ROOT)); ! HDC context(::GetWindowDC(main_window)); ! COLORREF green(RGB(0, 255, 0)); ! COLORREF red(RGB(255, 0, 0)); ! RECT extra(get_window_client_offset_rect(main_window)); long tick(3); ! long top(control.position_m.second + extra.top - 1); ! long left(control.position_m.first + extra.left); ! long bottom(top + control.geometry_m.height() - 1); long right(left + control.geometry_m.width()); long tick_width(std::min<long>(tick, control.geometry_m.width())); *************** *** 1144,1148 **** --- 1181,1189 ---- 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"; *************** *** 1259,1275 **** geometry_m = geometry; ! RECT window_rect; ! RECT client_rect; ::GetWindowRect(window_m, &window_rect); - ::GetClientRect(window_m, &client_rect); - - int extra_width = (window_rect.right - window_rect.left) - (client_rect.right - client_rect.left); - int extra_height = (window_rect.bottom - window_rect.top) - (client_rect.bottom - client_rect.top); ::MoveWindow( window_m, position.first + window_rect.left, position.second + window_rect.top, ! geometry_m.width() + extra_width, ! geometry_m.height() + extra_height, TRUE); #ifndef NDEBUG --- 1300,1312 ---- geometry_m = geometry; ! RECT window_rect; ! std::pair<long, long> extra(get_window_client_offsets(window_m)); ::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); #ifndef NDEBUG *************** *** 1439,1442 **** --- 1476,1480 ---- geometry_m = geometry; + position_m = position; #ifndef NDEBUG *************** *** 2024,2027 **** --- 2062,2067 ---- result.height() += 2 * button_height_padding; + result.slice_m[rectangle_slices_t::vertical].poi_m[0] += 2; + return result; } *************** *** 2029,2032 **** --- 2069,2079 ---- /****************************************************************************************************/ + void button_t::implementation_t::set_bounds(const point_t& position, const rectangle_t& geometry) + { + _super::set_bounds(position, geometry); + } + + /****************************************************************************************************/ + void button_t::implementation_t::set_default(bool is_default) { *************** *** 2219,2223 **** } ! long radio_button_width_padding(16); result.width() += radio_button_width_padding; --- 2266,2270 ---- } ! long radio_button_width_padding(20); result.width() += radio_button_width_padding; *************** *** 2365,2369 **** } ! long checkbox_width_padding(16); result.width() += checkbox_width_padding; --- 2412,2416 ---- } ! long checkbox_width_padding(20); result.width() += checkbox_width_padding; *************** *** 2969,2972 **** --- 3016,3029 ---- points_of_interest_t::value_type& edit_baseline(result.slice_m[rectangle_slices_t::vertical].poi_m[0]); + long frame_fudge(2 * extra); + long cursor_fudge(1); + long lines_height(result.height() * rows_m); + + result.width() += frame_fudge + cursor_fudge; + result.height() = frame_fudge + lines_height; + + if (rows_m == 1) + edit_baseline += 3; + if (using_label_m) { *************** *** 2997,3014 **** } - long frame_fudge(2 * extra); - long cursor_fudge(1); - long lines_height(result.height() * rows_m); - - result.width() += frame_fudge + cursor_fudge; - result.height() = frame_fudge + lines_height; - - // clear the baseline for multiline edit texts. - //if (rows_m > 1) - // result.slice_m[rectangle_slices_t::vertical].poi_m = points_of_interest_t(); - //else - //if (rows_m == 1) - // result.slice_m[rectangle_slices_t::vertical].poi_m[0] += extra; - #if 0 if (scroll_control_m) --- 3054,3057 ---- *************** *** 3036,3039 **** --- 3079,3083 ---- geometry_m = geometry; + position_m = position; long edit_additional(0); *************** *** 3044,3048 **** width_adjust = geometry_m.slice_m[adobe::rectangle_slices_t::horizontal].poi_m[0] - static_width_m; ! adobe::rectangle_t label_impose; adobe::point_t label_position(position.first + width_adjust, position.second + static_adjust_m + edit_additional); --- 3088,3092 ---- width_adjust = geometry_m.slice_m[adobe::rectangle_slices_t::horizontal].poi_m[0] - static_width_m; ! adobe::rectangle_t label_impose(geometry_m); adobe::point_t label_position(position.first + width_adjust, position.second + static_adjust_m + edit_additional); *************** *** 3050,3053 **** --- 3094,3099 ---- label_impose.width() = static_width_m; + label_impose.slice_m[rectangle_slices_t::vertical].poi_m[0] -= static_adjust_m; + get_label().set_bounds(label_position, label_impose); *************** *** 3058,3061 **** --- 3104,3109 ---- position.second += edit_additional; + geometry_m.slice_m[rectangle_slices_t::horizontal].poi_m.clear(); + geometry_m.height() -= 2 * edit_additional; geometry_m.width() -= width_adjust + 2 * edit_additional; *************** *** 3340,3343 **** --- 3388,3399 ---- points_of_interest_t::value_type& popup_baseline(result.slice_m[rectangle_slices_t::vertical].poi_m[0]); + long popup_fudge_height(7); + long popup_fudge_width(30); + + result.height() += popup_fudge_height; + result.width() += popup_fudge_width; + + popup_baseline += 4; + if (using_label_m) { *************** *** 3368,3377 **** } - long popup_fudge_height(0); - long popup_fudge_width(30); - - result.height() += popup_fudge_height; - result.width() += popup_fudge_width; - return result; } --- 3424,3427 ---- *************** *** 3386,3389 **** --- 3436,3440 ---- geometry_m = geometry; + position_m = position; long width_adjust(0); *************** *** 3393,3397 **** width_adjust = geometry_m.slice_m[adobe::rectangle_slices_t::horizontal].poi_m[0] - static_width_m; ! adobe::rectangle_t label_impose; adobe::point_t label_position(position.first + width_adjust, position.second + static_adjust_m); --- 3444,3448 ---- width_adjust = geometry_m.slice_m[adobe::rectangle_slices_t::horizontal].poi_m[0] - static_width_m; ! adobe::rectangle_t label_impose(geometry_m); adobe::point_t label_position(position.first + width_adjust, position.second + static_adjust_m); *************** *** 3399,3402 **** --- 3450,3455 ---- label_impose.width() = static_width_m; + label_impose.slice_m[rectangle_slices_t::vertical].poi_m[0] -= static_adjust_m; + get_label().set_bounds(label_position, label_impose); *************** *** 3407,3410 **** --- 3460,3465 ---- geometry_m.width() -= width_adjust; + geometry_m.slice_m[rectangle_slices_t::horizontal].poi_m.clear(); + long old_height = geometry_m.height(); *************** *** 3666,3686 **** // set the baseline to the (possibly new) baseline edit_baseline = baseline; - - #if 0 - // REVISIT (fbrereto) : This is an interesting problem because we're interested - // in popup alignment from the right hand side of the widget. - // Omit for now. - // popup alignment guide - result.slice_m[adobe::rectangle_slices_t::horizontal].poi_m.push_back(popup_width_m); - #endif - - // REVISIT (fbrereto) : If the widget is using a label then there are two horizontal - // guides, and the second should be adjusted to take the first - // into account. - #if 0 - if (using_label_m) - result.slice_m[adobe::rectangle_slices_t::horizontal].poi_m[1] += - result.slice_m[adobe::rectangle_slices_t::horizontal].poi_m[0]; - #endif } --- 3721,3724 ---- *************** *** 3699,3708 **** long width_adjust(0); ! adobe::rectangle_t edit_impose; adobe::point_t edit_position(pos); - if (using_label_m) - edit_impose.slice_m[rectangle_slices_t::horizontal].poi_m.push_back(geometry.slice_m[rectangle_slices_t::horizontal].poi_m[0]); - edit_impose.width() = edit_width_m; edit_impose.height() = geometry.slice_m[rectangle_slices_t::vertical].length_m; --- 3737,3743 ---- long width_adjust(0); ! adobe::rectangle_t edit_impose(geometry); adobe::point_t edit_position(pos); edit_impose.width() = edit_width_m; edit_impose.height() = geometry.slice_m[rectangle_slices_t::vertical].length_m; *************** *** 3714,3718 **** if (using_popup_m) { ! adobe::rectangle_t popup_impose; adobe::point_t popup_position(pos.first + width_adjust, pos.second + popup_adjust_m); --- 3749,3753 ---- if (using_popup_m) { ! adobe::rectangle_t popup_impose(geometry); adobe::point_t popup_position(pos.first + width_adjust, pos.second + popup_adjust_m); *************** *** 3728,3731 **** --- 3763,3767 ---- geometry_m = geometry; + position_m = position; } |