From: Foster B. <fos...@us...> - 2006-02-03 18:34:24
|
Update of /cvsroot/adobe-source/sandbox/adobe-source/adobe/future/widgets/sources/mac In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6755/adobe/future/widgets/sources/mac Modified Files: display.cpp metrics.cpp ui_core_implementation.cpp ui_overlay.cpp Added Files: os_utilities.cpp Log Message: asl 1.0.13 Index: display.cpp =================================================================== RCS file: /cvsroot/adobe-source/sandbox/adobe-source/adobe/future/widgets/sources/mac/display.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** display.cpp 24 Jan 2006 19:38:47 -0000 1.4 --- display.cpp 3 Feb 2006 18:33:37 -0000 1.5 *************** *** 1,6 **** /* ! Copyright 2005-2006 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) */ --- 1,6 ---- /* ! Copyright 2005-2006 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) */ *************** *** 20,28 **** struct view_wrap { ! explicit view_wrap(HIViewRef ref) : ! ref_m(ref) ! { } ! HIViewRef ref_m; }; --- 20,28 ---- struct view_wrap { ! explicit view_wrap(HIViewRef ref) : ! ref_m(ref) ! { } ! HIViewRef ref_m; }; *************** *** 31,35 **** HIViewRef unwrap(adobe::display_t::position_t& position) { ! return (boost::any_cast<view_wrap>(position)).ref_m; } --- 31,35 ---- HIViewRef unwrap(adobe::display_t::position_t& position) { ! return (boost::any_cast<view_wrap>(position)).ref_m; } *************** *** 38,42 **** adobe::display_t::position_t wrap(HIViewRef view) { ! return adobe::display_t::position_t(view_wrap(view)); } --- 38,42 ---- adobe::display_t::position_t wrap(HIViewRef view) { ! return adobe::display_t::position_t(view_wrap(view)); } *************** *** 48,52 **** #if 0 ! #pragma mark - #endif --- 48,52 ---- #if 0 ! #pragma mark - #endif *************** *** 63,69 **** display_t& get_main_display() { ! static display_t display_s; ! return display_s; } --- 63,69 ---- display_t& get_main_display() { ! static display_t display_s; ! return display_s; } *************** *** 72,78 **** struct display_t::implementation_t { ! void erase(display_t::position_t& position); ! std::vector<HIViewRef> roots_m; }; --- 72,78 ---- struct display_t::implementation_t { ! void erase(display_t::position_t& position); ! std::vector<HIViewRef> roots_m; }; *************** *** 92,96 **** #if 0 ! #pragma mark - #endif --- 92,96 ---- #if 0 ! #pragma mark - #endif *************** *** 98,122 **** display_t::display_t() : ! object_m(new implementation_t()) ! { } display_t::~display_t() ! { delete object_m; object_m = 0; } display_t::implementation_t& display_t::implementation() ! { return *object_m; } const display_t::implementation_t& display_t::implementation() const ! { return *object_m; } display_t::position_t display_t::root() ! { return display_t::position_t(root_token()); } void display_t::erase(position_t& position) ! { return object_m->erase(position); } template <typename DisplayElement> display_t::position_t display_t::insert(position_t& parent, DisplayElement& element) ! { return insert(parent, adobe::view_for_element<HIViewRef>(element)); } /****************************************************************************************************/ --- 98,122 ---- display_t::display_t() : ! object_m(new implementation_t()) ! { } display_t::~display_t() ! { delete object_m; object_m = 0; } display_t::implementation_t& display_t::implementation() ! { return *object_m; } const display_t::implementation_t& display_t::implementation() const ! { return *object_m; } display_t::position_t display_t::root() ! { return display_t::position_t(root_token()); } void display_t::erase(position_t& position) ! { return object_m->erase(position); } template <typename DisplayElement> display_t::position_t display_t::insert(position_t& parent, DisplayElement& element) ! { return insert(parent, adobe::view_for_element<HIViewRef>(element)); } /****************************************************************************************************/ *************** *** 125,140 **** display_t::position_t display_t::insert<HIViewRef>(position_t& parent, HIViewRef& element) { ! if (parent.type() == typeid(view_wrap)) ! { ! HIViewRef parent_view(unwrap(parent)); ! ADOBE_REQUIRE_STATUS(::HIViewAddSubview(parent_view, element)); ! } ! else if (parent.type() == typeid(root_token)) ! { ! object_m->roots_m.push_back(element); ! } ! return wrap(element); } --- 125,140 ---- display_t::position_t display_t::insert<HIViewRef>(position_t& parent, HIViewRef& element) { ! if (parent.type() == typeid(view_wrap)) ! { ! HIViewRef parent_view(unwrap(parent)); ! ADOBE_REQUIRE_STATUS(::HIViewAddSubview(parent_view, element)); ! } ! else if (parent.type() == typeid(root_token)) ! { ! object_m->roots_m.push_back(element); ! } ! return wrap(element); } *************** *** 142,146 **** #if 0 ! #pragma mark - #endif --- 142,146 ---- #if 0 ! #pragma mark - #endif *************** *** 149,158 **** void display_t::implementation_t::erase(display_t::position_t&) { ! // REVISIT (fbrereto) : What should we do here? ! // 1) Call DetachSubView on the position? ! // 2) Call erase recursively for all children of the position? ! // 3) Invalidate (wipe) the position data? ! // 4) Invoke some (currently nonexistent) detach() callback for the client? ! // 4a) With what parameters, considering questions 1, 2, & 3? } --- 149,158 ---- void display_t::implementation_t::erase(display_t::position_t&) { ! // REVISIT (fbrereto) : What should we do here? ! // 1) Call DetachSubView on the position? ! // 2) Call erase recursively for all children of the position? ! // 3) Invalidate (wipe) the position data? ! // 4) Invoke some (currently nonexistent) detach() callback for the client? ! // 4a) With what parameters, considering questions 1, 2, & 3? } Index: metrics.cpp =================================================================== RCS file: /cvsroot/adobe-source/sandbox/adobe-source/adobe/future/widgets/sources/mac/metrics.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** metrics.cpp 6 Jan 2006 18:02:59 -0000 1.5 --- metrics.cpp 3 Feb 2006 18:33:37 -0000 1.6 *************** *** 1,6 **** /* ! Copyright 2005-2006 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) */ --- 1,6 ---- /* ! Copyright 2005-2006 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) */ *************** *** 26,63 **** adobe::dictionary_t widget_metrics(const std::string& xstr, const adobe::dictionary_t& context) { ! std::vector<adobe::attribute_set_t::value_type> context_attribute_set; ! if (!context.count(adobe::static_name_t("theme"))) ! context_attribute_set.push_back(std::make_pair(adobe::static_token_range("theme"), adobe::static_token_range("normal"))); ! for ( dictionary_t::const_iterator first(context.begin()), last(context.end()); ! first != last; ++first) ! { ! const char* key_c_str(first->first.get()); ! const char* value_c_str(first->second.get<adobe::name_t>().get()); ! adobe::token_range_t key(key_c_str, key_c_str + std::strlen(key_c_str)); ! adobe::token_range_t value(value_c_str, value_c_str + std::strlen(value_c_str)); ! context_attribute_set.push_back(std::make_pair(key, value)); ! } ! adobe::xstring_context_t local_context(context_attribute_set.begin(), context_attribute_set.end()); ! std::string utf8(adobe::xstring(xstr.c_str(), xstr.size())); ! if (utf8.empty()) return adobe::dictionary_t(); ! std::stringstream expression_stream(utf8); ! expression_parser parser(expression_stream, line_position_t("widget_metrics")); ! array_t expression; ! parser.require_expression(expression); ! virtual_machine_t machine; ! machine.evaluate(expression); ! return machine.back().value_m.get<adobe::dictionary_t>(); } --- 26,63 ---- adobe::dictionary_t widget_metrics(const std::string& xstr, const adobe::dictionary_t& context) { ! std::vector<adobe::attribute_set_t::value_type> context_attribute_set; ! if (!context.count(adobe::static_name_t("theme"))) ! context_attribute_set.push_back(std::make_pair(adobe::static_token_range("theme"), adobe::static_token_range("normal"))); ! for ( dictionary_t::const_iterator first(context.begin()), last(context.end()); ! first != last; ++first) ! { ! const char* key_c_str(first->first.get()); ! const char* value_c_str(first->second.get<adobe::name_t>().get()); ! adobe::token_range_t key(key_c_str, key_c_str + std::strlen(key_c_str)); ! adobe::token_range_t value(value_c_str, value_c_str + std::strlen(value_c_str)); ! context_attribute_set.push_back(std::make_pair(key, value)); ! } ! adobe::xstring_context_t local_context(context_attribute_set.begin(), context_attribute_set.end()); ! std::string utf8(adobe::xstring(xstr.c_str(), xstr.size())); ! if (utf8.empty()) return adobe::dictionary_t(); ! std::stringstream expression_stream(utf8); ! expression_parser parser(expression_stream, line_position_t("widget_metrics")); ! array_t expression; ! parser.require_expression(expression); ! virtual_machine_t machine; ! machine.evaluate(expression); ! return machine.back().value_m.get<adobe::dictionary_t>(); } Index: ui_overlay.cpp =================================================================== RCS file: /cvsroot/adobe-source/sandbox/adobe-source/adobe/future/widgets/sources/mac/ui_overlay.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ui_overlay.cpp 24 Jan 2006 19:38:47 -0000 1.5 --- ui_overlay.cpp 3 Feb 2006 18:33:37 -0000 1.6 *************** *** 1,6 **** /* ! Copyright 2005-2006 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) */ --- 1,6 ---- /* ! Copyright 2005-2006 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) */ *************** *** 24,34 **** struct overlay_data_t { ! adobe::point_2d_t origin_m; ! adobe::extents_t extents_m; }; /****************************************************************************************************/ ! typedef adobe::forest<overlay_data_t> overlay_forest_t; /****************************************************************************************************/ --- 24,34 ---- struct overlay_data_t { ! adobe::point_2d_t origin_m; ! adobe::extents_t extents_m; }; /****************************************************************************************************/ ! typedef adobe::forest<overlay_data_t> overlay_forest_t; /****************************************************************************************************/ *************** *** 36,40 **** overlay_forest_t::iterator unwrap(adobe::ui_overlay_t::position_t& position) { ! return boost::any_cast<overlay_forest_t::iterator>(position); } --- 36,40 ---- overlay_forest_t::iterator unwrap(adobe::ui_overlay_t::position_t& position) { ! return boost::any_cast<overlay_forest_t::iterator>(position); } *************** *** 43,47 **** adobe::ui_overlay_t::position_t wrap(overlay_forest_t::iterator view) { ! return adobe::ui_overlay_t::position_t(view); } --- 43,47 ---- adobe::ui_overlay_t::position_t wrap(overlay_forest_t::iterator view) { ! return adobe::ui_overlay_t::position_t(view); } *************** *** 58,114 **** struct ui_overlay_t::implementation_t { ! implementation_t(); ! ~implementation_t(); ! struct draw_element_t ! { ! enum element_type ! { ! element_type_top_left, ! element_type_top_right, ! element_type_bottom_left, ! element_type_bottom_right, ! element_type_horizontal_poi, ! element_type_vertical_poi, ! element_type_count // always be last ! }; ! draw_element_t(element_type type, const CGRect& rect, const RGBColor& color) : ! type_m(type), rect_m(rect), color_m(color) ! { } ! draw_element_t(const draw_element_t& rhs) : ! type_m(rhs.type_m), rect_m(rhs.rect_m), color_m(rhs.color_m) ! { } ! element_type type_m; ! CGRect rect_m; ! RGBColor color_m; ! }; ! typedef std::vector<draw_element_t> draw_element_set_t; ! position_t root(HIViewRef& element); ! position_t insert(position_t parent); ! void place(position_t node, const point_2d_t& origin, const extents_t& extents); ! void framing(bool do_framing); ! overlay_data_t flatten_overlay_data(overlay_forest_t::iterator iter); ! void tick_extents(const overlay_data_t& overlay_data, draw_element_set_t& set); ! void overlay_bounds_update(); ! void draw_tick(CGContextRef context, const draw_element_set_t::value_type& element); ! WindowRef overlay_m; ! WindowRef source_m; ! ControlRef control_m; ! bool framing_m; ! overlay_forest_t tree_m; }; --- 58,114 ---- struct ui_overlay_t::implementation_t { ! implementation_t(); ! ~implementation_t(); ! struct draw_element_t ! { ! enum element_type ! { ! element_type_top_left, ! element_type_top_right, ! element_type_bottom_left, ! element_type_bottom_right, ! element_type_horizontal_poi, ! element_type_vertical_poi, ! element_type_count // always be last ! }; ! draw_element_t(element_type type, const CGRect& rect, const RGBColor& color) : ! type_m(type), rect_m(rect), color_m(color) ! { } ! draw_element_t(const draw_element_t& rhs) : ! type_m(rhs.type_m), rect_m(rhs.rect_m), color_m(rhs.color_m) ! { } ! element_type type_m; ! CGRect rect_m; ! RGBColor color_m; ! }; ! typedef std::vector<draw_element_t> draw_element_set_t; ! position_t root(HIViewRef& element); ! position_t insert(position_t parent); ! void place(position_t node, const point_2d_t& origin, const extents_t& extents); ! void framing(bool do_framing); ! overlay_data_t flatten_overlay_data(overlay_forest_t::iterator iter); ! void tick_extents(const overlay_data_t& overlay_data, draw_element_set_t& set); ! void overlay_bounds_update(); ! void draw_tick(CGContextRef context, const draw_element_set_t::value_type& element); ! WindowRef overlay_m; ! WindowRef source_m; ! ControlRef control_m; ! bool framing_m; ! overlay_forest_t tree_m; }; *************** *** 125,139 **** pascal void draw_overlay(ControlRef control, SInt16) { ! adobe::ui_overlay_t::implementation_t& overlay ! (*reinterpret_cast<adobe::ui_overlay_t::implementation_t*> ! (::GetControlReference(control))); ! overlay.framing(overlay.framing_m); } /****************************************************************************************************/ ! typedef adobe::point_2d<float> coord_t; ! typedef std::vector<coord_t> coord_set_t; /****************************************************************************************************/ --- 125,139 ---- pascal void draw_overlay(ControlRef control, SInt16) { ! adobe::ui_overlay_t::implementation_t& overlay ! (*reinterpret_cast<adobe::ui_overlay_t::implementation_t*> ! (::GetControlReference(control))); ! overlay.framing(overlay.framing_m); } /****************************************************************************************************/ ! typedef adobe::point_2d<float> coord_t; ! typedef std::vector<coord_t> coord_set_t; /****************************************************************************************************/ *************** *** 141,157 **** void draw_line_path(CGContextRef context, coord_set_t& coord_set) { ! if (coord_set.size() < 2) return; ! coord_set_t::iterator iter(coord_set.begin()); ! coord_set_t::iterator last(coord_set.end()); ! ::CGContextMoveToPoint(context, iter->x_m, iter->y_m); ! while (++iter != last) ::CGContextAddLineToPoint(context, iter->x_m, iter->y_m); ! ::CGContextStrokePath(context); ! ::CGContextClosePath(context); ! coord_set.clear(); } --- 141,157 ---- void draw_line_path(CGContextRef context, coord_set_t& coord_set) { ! if (coord_set.size() < 2) return; ! coord_set_t::iterator iter(coord_set.begin()); ! coord_set_t::iterator last(coord_set.end()); ! ::CGContextMoveToPoint(context, iter->x_m, iter->y_m); ! while (++iter != last) ::CGContextAddLineToPoint(context, iter->x_m, iter->y_m); ! ::CGContextStrokePath(context); ! ::CGContextClosePath(context); ! coord_set.clear(); } *************** *** 167,171 **** ui_overlay_t::ui_overlay_t() : ! object_m(new implementation_t()) { } --- 167,171 ---- ui_overlay_t::ui_overlay_t() : ! object_m(new implementation_t()) { } *************** *** 199,203 **** #if 0 ! #pragma mark - #endif --- 199,203 ---- #if 0 ! #pragma mark - #endif *************** *** 205,212 **** ui_overlay_t::implementation_t::implementation_t() : ! overlay_m(0), ! source_m(0), ! control_m(0), ! framing_m(false) { } --- 205,212 ---- ui_overlay_t::implementation_t::implementation_t() : ! overlay_m(0), ! source_m(0), ! control_m(0), ! framing_m(false) { } *************** *** 215,221 **** ui_overlay_t::implementation_t::~implementation_t() { ! if (overlay_m) ::DisposeWindow(overlay_m); ! overlay_m = 0; } --- 215,221 ---- ui_overlay_t::implementation_t::~implementation_t() { ! if (overlay_m) ::DisposeWindow(overlay_m); ! overlay_m = 0; } *************** *** 224,255 **** ui_overlay_t::position_t ui_overlay_t::implementation_t::root(HIViewRef& element) { ! assert(!control_m); ! assert(element); ! Rect global_bounds; ! WindowGroupRef new_group; ! Rect one_bounds = { 0, 0, 1, 1 }; ! WindowRef owner(::GetControlOwner(element)); ! static ControlUserPaneDrawUPP draw_handler(::NewControlUserPaneDrawUPP(draw_overlay)); ! source_m = owner; ! ADOBE_REQUIRE_STATUS(::GetWindowBounds(source_m, kWindowGlobalPortRgn, &global_bounds)); ! ADOBE_REQUIRE_STATUS(::CreateNewWindow(kOverlayWindowClass, kWindowCompositingAttribute, &global_bounds, &overlay_m)); ! ADOBE_REQUIRE_STATUS(::CreateUserPaneControl(overlay_m, &one_bounds, 0, &control_m)); ! ::ShowWindow(overlay_m); ! ::SetControlReference(control_m, reinterpret_cast<SInt32>(this)); ! ::SetControlData(control_m, kControlEntireControl, kControlUserPaneDrawProcTag, sizeof(ControlUserPaneDrawUPP), &draw_handler); ! ADOBE_REQUIRE_STATUS(::CreateWindowGroup(kWindowGroupAttrMoveTogether | kWindowGroupAttrLayerTogether, &new_group)); ! ADOBE_REQUIRE_STATUS(::SetWindowGroupParent(new_group, ::GetWindowGroup(source_m))); ! ADOBE_REQUIRE_STATUS(::SetWindowGroup(source_m, new_group)); ! ADOBE_REQUIRE_STATUS(::SetWindowGroup(overlay_m, new_group)); ! return wrap(tree_m.insert(tree_m.begin(), overlay_data_t())); } --- 224,255 ---- ui_overlay_t::position_t ui_overlay_t::implementation_t::root(HIViewRef& element) { ! assert(!control_m); ! assert(element); ! Rect global_bounds; ! WindowGroupRef new_group; ! Rect one_bounds = { 0, 0, 1, 1 }; ! WindowRef owner(::GetControlOwner(element)); ! static ControlUserPaneDrawUPP draw_handler(::NewControlUserPaneDrawUPP(draw_overlay)); ! source_m = owner; ! ADOBE_REQUIRE_STATUS(::GetWindowBounds(source_m, kWindowGlobalPortRgn, &global_bounds)); ! ADOBE_REQUIRE_STATUS(::CreateNewWindow(kOverlayWindowClass, kWindowCompositingAttribute, &global_bounds, &overlay_m)); ! ADOBE_REQUIRE_STATUS(::CreateUserPaneControl(overlay_m, &one_bounds, 0, &control_m)); ! ::ShowWindow(overlay_m); ! ::SetControlReference(control_m, reinterpret_cast<SInt32>(this)); ! ::SetControlData(control_m, kControlEntireControl, kControlUserPaneDrawProcTag, sizeof(ControlUserPaneDrawUPP), &draw_handler); ! ADOBE_REQUIRE_STATUS(::CreateWindowGroup(kWindowGroupAttrMoveTogether | kWindowGroupAttrLayerTogether, &new_group)); ! ADOBE_REQUIRE_STATUS(::SetWindowGroupParent(new_group, ::GetWindowGroup(source_m))); ! ADOBE_REQUIRE_STATUS(::SetWindowGroup(source_m, new_group)); ! ADOBE_REQUIRE_STATUS(::SetWindowGroup(overlay_m, new_group)); ! return wrap(tree_m.insert(tree_m.begin(), overlay_data_t())); } *************** *** 258,262 **** ui_overlay_t::position_t ui_overlay_t::implementation_t::insert(position_t parent) { ! return wrap(tree_m.insert(adobe::trailing_of(unwrap(parent)), overlay_data_t())); } --- 258,262 ---- ui_overlay_t::position_t ui_overlay_t::implementation_t::insert(position_t parent) { ! return wrap(tree_m.insert(adobe::trailing_of(unwrap(parent)), overlay_data_t())); } *************** *** 265,277 **** void ui_overlay_t::implementation_t::place(position_t node, const point_2d_t& origin, const extents_t& extents) { ! assert(control_m); ! overlay_forest_t::iterator position(unwrap(node)); ! position->origin_m = origin; ! position->extents_m = extents; ! if (framing_m) ! ADOBE_REQUIRE_STATUS(::HIViewSetNeedsDisplay(control_m, true)); } --- 265,277 ---- void ui_overlay_t::implementation_t::place(position_t node, const point_2d_t& origin, const extents_t& extents) { ! assert(control_m); ! overlay_forest_t::iterator position(unwrap(node)); ! position->origin_m = origin; ! position->extents_m = extents; ! if (framing_m) ! ADOBE_REQUIRE_STATUS(::HIViewSetNeedsDisplay(control_m, true)); } *************** *** 280,330 **** void ui_overlay_t::implementation_t::framing(bool do_framing) { ! assert(control_m); ! framing_m = do_framing; ! if (do_framing) ! { ! ::ShowWindow(overlay_m); ! draw_element_set_t tick_set; ! overlay_forest_t::preorder_iterator first(tree_m.begin()); ! overlay_forest_t::preorder_iterator last(tree_m.end()); ! for (; first != last; ++first) ! tick_extents(flatten_overlay_data(first.base()), tick_set); ! if (!tick_set.empty()) ! { ! CGrafPtr window_port(::GetWindowPort(overlay_m)); ! CGContextRef context(0); ! Rect bounds; ! overlay_bounds_update(); ! ::GetWindowBounds(overlay_m, kWindowContentRgn, &bounds); ! ADOBE_REQUIRE_STATUS(::QDBeginCGContext(window_port, &context)); ! ::CGContextTranslateCTM(context, 0.0, static_cast<float>(bounds.bottom - bounds.top)); ! ::CGContextScaleCTM(context, 1.0, -1.0); ! ::CGContextSetLineWidth(context, 1); ! ::CGContextSetShouldAntialias(context, false); ! ::CGContextSetAlpha(context, .75f); ! ::CGContextBeginPath(context); ! adobe::for_each(tick_set, boost::bind(&implementation_t::draw_tick, boost::ref(*this), context, _1)); ! ::CGContextFlush(context); ! ADOBE_REQUIRE_STATUS(::QDEndCGContext(window_port, &context)); ! } ! } ! else ! { ! ::HideWindow(overlay_m); ! } } --- 280,330 ---- void ui_overlay_t::implementation_t::framing(bool do_framing) { ! assert(control_m); ! framing_m = do_framing; ! if (do_framing) ! { ! ::ShowWindow(overlay_m); ! draw_element_set_t tick_set; ! overlay_forest_t::preorder_iterator first(tree_m.begin()); ! overlay_forest_t::preorder_iterator last(tree_m.end()); ! for (; first != last; ++first) ! tick_extents(flatten_overlay_data(first.base()), tick_set); ! if (!tick_set.empty()) ! { ! CGrafPtr window_port(::GetWindowPort(overlay_m)); ! CGContextRef context(0); ! Rect bounds; ! overlay_bounds_update(); ! ::GetWindowBounds(overlay_m, kWindowContentRgn, &bounds); ! ADOBE_REQUIRE_STATUS(::QDBeginCGContext(window_port, &context)); ! ::CGContextTranslateCTM(context, 0.0, static_cast<float>(bounds.bottom - bounds.top)); ! ::CGContextScaleCTM(context, 1.0, -1.0); ! ::CGContextSetLineWidth(context, 1); ! ::CGContextSetShouldAntialias(context, false); ! ::CGContextSetAlpha(context, .75f); ! ::CGContextBeginPath(context); ! adobe::for_each(tick_set, boost::bind(&implementation_t::draw_tick, boost::ref(*this), context, _1)); ! ::CGContextFlush(context); ! ADOBE_REQUIRE_STATUS(::QDEndCGContext(window_port, &context)); ! } ! } ! else ! { ! ::HideWindow(overlay_m); ! } } *************** *** 333,349 **** overlay_data_t ui_overlay_t::implementation_t::flatten_overlay_data(overlay_forest_t::iterator iter) { ! overlay_data_t result; ! point_2d_t& origin(result.origin_m); ! overlay_forest_t::iterator last(tree_m.end()); ! result.extents_m = iter->extents_m; ! for (; iter != last; iter = find_parent(iter)) ! { ! origin.x_m += iter->origin_m.x_m; ! origin.y_m += iter->origin_m.y_m; ! } ! return result; } --- 333,349 ---- overlay_data_t ui_overlay_t::implementation_t::flatten_overlay_data(overlay_forest_t::iterator iter) { ! overlay_data_t result; ! point_2d_t& origin(result.origin_m); ! overlay_forest_t::iterator last(tree_m.end()); ! result.extents_m = iter->extents_m; ! for (; iter != last; iter = find_parent(iter)) ! { ! origin.x_m += iter->origin_m.x_m; ! origin.y_m += iter->origin_m.y_m; ! } ! return result; } *************** *** 352,376 **** struct frame_rect_t { ! frame_rect_t(float left, float top, float right, float bottom, float tick = 3) : ! tick_width_m(adobe::pin(0.0f, right - left, tick)), ! tick_height_m(adobe::pin(0.0f, bottom - top, tick)), ! tick_start_right_m(std::max(right - tick, left)), ! tick_start_bottom_m(std::max(bottom - tick, top)), ! tl_m(::CGRectMake(left, top, tick_width_m, tick_height_m)), ! tr_m(::CGRectMake(tick_start_right_m, top, tick_width_m, tick_height_m)), ! bl_m(::CGRectMake(left, tick_start_bottom_m, tick_width_m, tick_height_m)), ! br_m(::CGRectMake(tick_start_right_m, tick_start_bottom_m, tick_width_m, tick_height_m)) ! { ! } ! float tick_width_m; ! float tick_height_m; ! float tick_start_right_m; ! float tick_start_bottom_m; ! CGRect tl_m; ! CGRect tr_m; ! CGRect bl_m; ! CGRect br_m; }; --- 352,376 ---- struct frame_rect_t { ! frame_rect_t(float left, float top, float right, float bottom, float tick = 3) : ! tick_width_m(adobe::pin(0.0f, right - left, tick)), ! tick_height_m(adobe::pin(0.0f, bottom - top, tick)), ! tick_start_right_m(std::max(right - tick, left)), ! tick_start_bottom_m(std::max(bottom - tick, top)), ! tl_m(::CGRectMake(left, top, tick_width_m, tick_height_m)), ! tr_m(::CGRectMake(tick_start_right_m, top, tick_width_m, tick_height_m)), ! bl_m(::CGRectMake(left, tick_start_bottom_m, tick_width_m, tick_height_m)), ! br_m(::CGRectMake(tick_start_right_m, tick_start_bottom_m, tick_width_m, tick_height_m)) ! { ! } ! float tick_width_m; ! float tick_height_m; ! float tick_start_right_m; ! float tick_start_bottom_m; ! CGRect tl_m; ! CGRect tr_m; ! CGRect bl_m; ! CGRect br_m; }; *************** *** 379,453 **** void ui_overlay_t::implementation_t::tick_extents(const overlay_data_t& overlay_data, draw_element_set_t& set) { ! typedef draw_element_t de_t; ! static const RGBColor red = { USHRT_MAX, 0, 0 }; ! static const RGBColor green = { 0, USHRT_MAX, 0 }; ! static const RGBColor blue = { 0, 0, USHRT_MAX }; ! const point_2d_t& position(overlay_data.origin_m); ! const extents_t& extents(overlay_data.extents_m); ! float top(static_cast<float>(position.y_m)); ! float left(static_cast<float>(position.x_m)); ! float bottom(top + extents.height()); ! float right(left + extents.width()); ! frame_rect_t bounds(left, top, right, bottom); ! set.push_back(de_t(de_t::element_type_top_left, bounds.tl_m, blue)); ! set.push_back(de_t(de_t::element_type_top_right, bounds.tr_m, blue)); ! set.push_back(de_t(de_t::element_type_bottom_left, bounds.bl_m, blue)); ! set.push_back(de_t(de_t::element_type_bottom_right, bounds.br_m, blue)); ! if (extents.vertical().outset_m.first || extents.vertical().outset_m.second || ! extents.horizontal().outset_m.first || extents.horizontal().outset_m.second) ! { ! float top_outset(top - extents.vertical().outset_m.first); ! float bottom_outset(bottom + extents.vertical().outset_m.second); ! float left_outset(left - extents.horizontal().outset_m.first); ! float right_outs... [truncated message content] |