|
From: Foster B. <fos...@us...> - 2006-02-27 20:42:14
|
Update of /cvsroot/adobe-source/sandbox/adobe-source/adobe/future/widgets/sources/mac In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8667/adobe/future/widgets/sources/mac Modified Files: label_t_impl.cpp metrics.cpp os_utilities.cpp ui_core_implementation.cpp Added Files: image_t_impl.cpp Log Message: image_t (icons and pictures) support for Mac and Win32, along with a GIL image factory and a (sample) Targa file format importing module for that factory. Also added alert.adm/eve as a sample for the icon support. Added the notion of a working directory to the modal dialog interface to reference external resources. Also added an alert API that leverages modal_dialog_interface. Other misc. bug fixes and changes. Index: metrics.cpp =================================================================== RCS file: /cvsroot/adobe-source/sandbox/adobe-source/adobe/future/widgets/sources/mac/metrics.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** metrics.cpp 23 Feb 2006 23:28:55 -0000 1.7 --- metrics.cpp 27 Feb 2006 20:41:59 -0000 1.8 *************** *** 29,32 **** --- 29,117 ---- /****************************************************************************************************/ + const char* mac_metrics_g = + "<xstr id='metric:global'>{ gap: 4 }</xstr>" + "" + "<xstr id='metric:window'>{ spacing: 20 }</xstr>" + "" + "<xstr id='metric:checkbox' theme='normal'>" + " { adjust_size: [ 2, 4 ], adjust_position: [ -2, -2 ], outset: [ 1, 2, 0, 1 ], adjust_baseline: -2 }</xstr>" + "<xstr id='metric:checkbox' theme='small'>" + " { adjust_size: [ 1, 4 ], adjust_position: [ -1, -2 ], outset: [ 1, 2, 0, 1 ], adjust_baseline: -2 }</xstr>" + "<xstr id='metric:checkbox' theme='mini'>" + " { adjust_size: [ 0, 1 ], adjust_position: [ 0, -1 ], outset: [ 0, 1, 0, 0 ], adjust_baseline: -1 }</xstr>" + "" + "<xstr id='metric:radio_button' theme='normal'>" + " { adjust_size: [ 0, 3 ], adjust_position: [ -2, -2 ], outset: [ 1, 0, 1, 1 ], adjust_baseline: -2 }</xstr>" + "<xstr id='metric:radio_button' theme='small'>" + " { adjust_size: [ 0, 2 ], adjust_position: [ 0, -1 ], outset: [ 0, 0, 0, 1 ] }</xstr>" + "<xstr id='metric:radio_button' theme='mini'>" + " { adjust_size: [ 0, 1 ], adjust_position: [ 0, 0 ], outset: [ 0, 0, 0, 1 ] }</xstr>" + "" + "<xstr id='metric:button' theme='normal'>" + " { adjust_size: [ 0, -1 ], outset: [ 1, 0, 1, 2 ] }</xstr>" + "<xstr id='metric:button' theme='small'>" + " { adjust_size: [ -2, 2 ], adjust_position: [ 1, -1 ], outset: [ 0, 0, 0, 1 ], adjust_baseline: -2 }</xstr>" + "<xstr id='metric:button' theme='mini'>" + " { adjust_size: [ 2, 5 ], adjust_position: [ -1, 0 ], outset: [ 1, 0, 1, 1 ], adjust_baseline: -3 }</xstr>" + "" + "<xstr id='metric:group' label='true' theme='normal'>" + " { adjust_size: [ 0, 3 ], adjust_position: [ 0, -2 ], frame: [ 1, 2, 1, 1 ], spacing: 20 }</xstr>" + "<xstr id='metric:group' label='true' theme='small'>" + " { adjust_size: [ 0, 3 ], adjust_position: [ 0, -2 ], frame: [ 1, 2, 1, 1 ], spacing: 20 }</xstr>" + "<xstr id='metric:group' label='true' theme='mini'>" + " { adjust_size: [ 0, 3 ], adjust_position: [ 0, -2 ], frame: [ 1, 3, 1, 1 ], spacing: 20 }</xstr>" + "" + "<xstr id='metric:group' label='false' theme='normal'>" + " { adjust_size: [ 0, 1 ], frame: [ 1, 4, 1, 1 ] }</xstr>" + "<xstr id='metric:group' label='false' theme='small'>" + " { adjust_size: [ 0, 1 ], frame: [ 1, 2, 1, 1 ] }</xstr>" + "<xstr id='metric:group' label='false' theme='mini'>" + " { adjust_size: [ 0, 1 ], frame: [ 1, 2, 1, 1 ] }</xstr>" + "" + "<xstr id='metric:tab_group' theme='normal'>" + " { adjust_size: [ 0, 8 ], adjust_position: [ 0, -7 ], frame: [ 1, 8, 1, 1 ], spacing: 24 }</xstr>" + "<xstr id='metric:tab_group' theme='small'>" + " { adjust_size: [ 0, 5 ], adjust_position: [ 0, -4 ], frame: [ 1, 8, 1, 1 ], spacing: 19 }</xstr>" + "<xstr id='metric:tab_group' theme='mini'>" + " { adjust_size: [ 0, 3 ], adjust_position: [ 0, -2 ], frame: [ 1, 6, 1, 1 ], spacing: 16 }</xstr>" + "" + "<xstr id='metric:static_text' theme='normal'>" + " { adjust_size: [ 0, 3 ], adjust_position: [ 0, -3 ], adjust_baseline: -3 }</xstr>" + "<xstr id='metric:static_text' theme='small'>" + " { adjust_size: [ 0, 3 ], adjust_position: [ 0, -2 ], adjust_baseline: -2 }</xstr>" + "<xstr id='metric:static_text' theme='mini'>" + " { adjust_size: [ 0, 3 ], adjust_position: [ 0, -2 ], adjust_baseline: -2 }</xstr>" + "" + "<xstr id='metric:edit_text' scroll='false' theme='normal'>" + " { adjust_size: [ -6, -6 ], adjust_position: [ 3, 3 ], outset: [ 3, 3, 3, 3 ], adjust_baseline: 3 }</xstr>" + "<xstr id='metric:edit_text' scroll='false' theme='small'>" + " { adjust_size: [ -6, -6 ], adjust_position: [ 3, 3 ], outset: [ 3, 3, 3, 3 ], adjust_baseline: 3 }</xstr>" + "<xstr id='metric:edit_text' scroll='false' theme='mini'>" + " { adjust_size: [ -6, -6 ], adjust_position: [ 3, 3 ], outset: [ 3, 3, 3, 3 ], adjust_baseline: 3 }</xstr>" + "" + "<xstr id='metric:edit_text' scroll='true' theme='normal'>" + " { }</xstr>" + "<xstr id='metric:edit_text' scroll='true' theme='small'>" + " { }</xstr>" + "<xstr id='metric:edit_text' scroll='true' theme='mini'>" + " { }</xstr>" + "" + "<xstr id='metric:popup' label='false' theme='normal'>" + " { adjust_size: [ 1, -1 ], adjust_position: [ -1, 0 ], outset: [ 1, 0, 1, 1 ] }</xstr>" + "<xstr id='metric:popup' label='false' theme='small'>" + " { adjust_size: [ 1, -1 ], adjust_position: [ 1, 0 ], outset: [ 1, 0, 1, 1 ], adjust_baseline: 1 }</xstr>" + "<xstr id='metric:popup' label='false' theme='mini'>" + " { adjust_size: [ 2, 0 ], adjust_position: [ -1, 0 ] }</xstr>" + "" + "<xstr id='metric:popup' label='true' theme='normal'>" + " { adjust_size: [ 0, -1 ], outset: [ 0, 0, 1, 1 ] }</xstr>" + "<xstr id='metric:popup' label='true' theme='small'>" + " { adjust_size: [ 1, -1 ], adjust_position: [ 0, 0 ], outset: [ 0, 0, 1, 1 ], adjust_baseline: 1 }</xstr>" + "<xstr id='metric:popup' label='true' theme='mini'>" + " { adjust_size: [ 1, 0 ] }</xstr>" + ; + + /****************************************************************************************************/ + ADOBE_THREAD_LOCAL_STORAGE(adobe::virtual_machine_t, metrics_vm) *************** *** 38,41 **** --- 123,139 ---- ADOBE_THREAD_LOCAL_STORAGE_INITIALIZE(metrics_vm); + + // initialize the mac-specific metrics glossary + // we have to make a copy of the buffer because the parsing context takes ownership of it. + + std::size_t metrics_len(std::strlen(mac_metrics_g)); + char* metrics_data(new char[metrics_len] + 1); + + std::copy(&mac_metrics_g[0], &mac_metrics_g[0] + metrics_len, &metrics_data[0]); + + metrics_data[metrics_len] = 0; + + static adobe::xstring_context_t mac_metrics_context(&metrics_data[0], &metrics_data[metrics_len], + adobe::line_position_t( "mac metrics" ) ); } --- NEW FILE: image_t_impl.cpp --- /* 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) */ /****************************************************************************************************/ #include <adobe/future/widgets/headers/image_t.hpp> #include "image_t_impl.hpp" #include "display.hpp" #include "ui_overlay.hpp" /****************************************************************************************************/ namespace adobe { /****************************************************************************************************/ ADOBE_WIDGET_TAG_BOILERPLATE(adobe::image_t::implementation_t, "<xstr id='metric:label'/>"); /****************************************************************************************************/ struct label_holder_t { GIL::rgba8_view* view_m; GIL::rgba8_view::iterator first_m; GIL::rgba8_view::iterator last_m; std::size_t size_m; }; /****************************************************************************************************/ void provider_skip_bytes ( void *info, std::size_t count ) { label_holder_t& holder(*reinterpret_cast<label_holder_t*>(info)); assert (count % 4 == 0); std::size_t adv_count(count / 4); holder.first_m += adv_count; holder.size_m -= adv_count; } /****************************************************************************************************/ std::size_t provider_get_bytes ( void *info, void *buffer, std::size_t count ) { assert (count % 4 == 0); label_holder_t& holder(*reinterpret_cast<label_holder_t*>(info)); if (holder.first_m == holder.last_m) return 0; std::size_t dst_pixel_count(count / 4); std::size_t to_copy(std::min(holder.size_m, dst_pixel_count)); GIL::rgba8_view::iterator src_end(holder.first_m + to_copy); GIL::rgba8_pixel* buffer_pixel(static_cast<GIL::rgba8_pixel*>(buffer)); std::copy(holder.first_m, src_end, buffer_pixel); provider_skip_bytes(info, count); return to_copy * 4; } /****************************************************************************************************/ void provider_rewind_bytes ( void *info ) { label_holder_t& holder(*reinterpret_cast<label_holder_t*>(info)); holder.first_m = holder.view_m->begin(); holder.size_m = holder.view_m->size(); } /****************************************************************************************************/ pascal void draw_label_image(ControlRef control, SInt16) try { assert(control); adobe::image_t::implementation_t& label(*reinterpret_cast<adobe::image_t::implementation_t*>(::GetControlReference(control))); ::WindowRef our_window(::GetControlOwner(control)); ::CGrafPtr window_port(::GetWindowPort(our_window)); ::CGContextRef context(0); ::Rect window_bounds = { 0 }; ::Rect bounds = { 0 }; ::GetWindowBounds(our_window, kWindowContentRgn, &window_bounds); implementation::get_bounds(control, bounds, true); ADOBE_REQUIRE_STATUS(::QDBeginCGContext(window_port, &context)); ::CGContextTranslateCTM(context, 0.0, static_cast<float>(window_bounds.bottom - window_bounds.top - 1)); ::CGContextScaleCTM(context, 1.0, -1.0); ::CGContextSetLineWidth(context, 1); ::CGContextSetShouldAntialias(context, false); GIL::rgba8_view view(GIL::view(label.image_m)); label_holder_t holder; holder.view_m = &view; holder.first_m = view.begin(); holder.last_m = view.end(); holder.size_m = view.size(); ::CGDataProviderCallbacks cg_callbacks; cg_callbacks.getBytes = &provider_get_bytes; cg_callbacks.skipBytes = &provider_skip_bytes; cg_callbacks.rewind = &provider_rewind_bytes; cg_callbacks.releaseProvider = NULL; // REVISIT (fbrereto) release me ::CGDataProviderRef provider(::CGDataProviderCreate ( &holder, &cg_callbacks )); // REVISIT (fbrereto) release me ::CGColorSpaceRef rgb_colorspace(::CGColorSpaceCreateDeviceRGB()); std::size_t image_width(view.width()); std::size_t image_height(view.height()); std::size_t bits_per_component(8); std::size_t bits_per_pixel(32); std::size_t bytes_per_row(4 * image_width); adobe::auto_resource< ::CGImageRef > auto_image(::CGImageCreate( image_width, image_height, bits_per_component, bits_per_pixel, bytes_per_row, rgb_colorspace, kCGImageAlphaLast/* | kCGBitmapByteOrderDefault*/, provider, 0, false, /* no pixel interpolation */ kCGRenderingIntentDefault /* no gamut correction */ )); // what we're going to want to do here is call CGImageCreate with a CGDataProviderRef // that has been bound to the image data so we can fetch it when the OS asks for it. float x(bounds.left); float y(bounds.top - 1); float width(bounds.right - x); float height(bounds.bottom - y - 1); ::CGContextDrawImage(context, ::CGRectMake(x, y, width, height), auto_image.get()); // Final actions ::CGContextSynchronize(context); ADOBE_REQUIRE_STATUS(::QDEndCGContext(window_port, &context)); } catch (const adobe::stream_error_t& err) { adobe::report_ui_element_error(adobe::format_stream_error(err)); } catch (const std::exception& err) { adobe::report_ui_element_error(std::string("Exception: ") + err.what()); } catch (...) { adobe::report_ui_element_error("Exception: Unknown"); } /****************************************************************************************************/ ControlUserPaneDrawUPP draw_handler_upp() { static adobe::auto_resource< ::ControlUserPaneDrawUPP > draw_handler_s(::NewControlUserPaneDrawUPP(draw_label_image)); return draw_handler_s.get(); } /****************************************************************************************************/ image_t::implementation_t::implementation_t(GIL::rgba8_image& image) : image_m(image) { initialize(); } /****************************************************************************************************/ image_t::implementation_t::implementation_t(const implementation_t& rhs) : image_m(rhs.image_m) { initialize(); } /****************************************************************************************************/ image_t::implementation_t& image_t::implementation_t::operator= (const implementation_t& rhs) { image_m = rhs.image_m; initialize(); return *this; } /****************************************************************************************************/ void image_t::implementation_t::initialize() { ::Rect bounds = { 0, 0, image_m.width(), image_m.height() }; ::ControlRef tmp_control; ::ADOBE_REQUIRE_STATUS(::CreateUserPaneControl(0, &bounds, 0, &tmp_control)); control_m.reset(tmp_control); ::SetControlReference(control_m.get(), reinterpret_cast< ::SInt32 >(this)); implementation::set_widget_data(control_m.get(), kControlEntireControl, kControlUserPaneDrawProcTag, draw_handler_upp()); } /****************************************************************************************************/ extents_t image_t::implementation_t::measure() { extents_t result; ::Rect bounds = { 0 }; implementation::get_bounds(control_m.get(), bounds); result.width() = bounds.right - bounds.left; result.height() = bounds.bottom - bounds.top; return result; } /****************************************************************************************************/ void image_t::implementation_t::place(const point_2d_t& position, const extents_t& extents) { implementation::set_bounds(*this, position, extents); } /****************************************************************************************************/ void image_t::implementation_t::enable(bool /*make_enabled*/) { } /****************************************************************************************************/ void image_t::implementation_t::set(GIL::rgba8_image& image) { image_m = image; implementation::set_refresh(control_m); } /****************************************************************************************************/ template <> ::HIViewRef view_for_element< ::HIViewRef, adobe::image_t >(adobe::image_t& widget) { return widget.implementation().control_m.get(); } /****************************************************************************************************/ template <> \ display_t::position_t insert<adobe::image_t>(display_t& display, display_t::position_t& parent, adobe::image_t& element) { ::HIViewRef ref(adobe::view_for_element< ::HIViewRef >(element)); return display.insert< ::HIViewRef >(parent, ref); } /****************************************************************************************************/ } // namespace adobe /****************************************************************************************************/ Index: os_utilities.cpp =================================================================== RCS file: /cvsroot/adobe-source/sandbox/adobe-source/adobe/future/widgets/sources/mac/os_utilities.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** os_utilities.cpp 23 Feb 2006 23:28:55 -0000 1.2 --- os_utilities.cpp 27 Feb 2006 20:41:59 -0000 1.3 *************** *** 75,79 **** template <> ! std::string get_field_text< ::ControlRef >(::ControlRef& control) { if (!control) return std::string(); --- 75,79 ---- template <> ! std::string get_field_text< ::ControlRef >(const ::ControlRef& control) { if (!control) return std::string(); *************** *** 90,94 **** /****************************************************************************************************/ ! std::string get_name(const ::ControlRef& control) { assert (control); --- 90,95 ---- /****************************************************************************************************/ ! template <> ! std::string get_name< ::ControlRef >(const ::ControlRef& control) { assert (control); *************** *** 105,109 **** /****************************************************************************************************/ ! std::string get_name(const ::WindowRef& window) { assert(window); --- 106,111 ---- /****************************************************************************************************/ ! template <> ! std::string get_name< ::WindowRef >(const ::WindowRef& window) { assert(window); *************** *** 206,210 **** /****************************************************************************************************/ ! adobe::extents_t measure(::ControlRef& control) { assert(control); --- 208,213 ---- /****************************************************************************************************/ ! template<> ! adobe::extents_t measure< ::ControlRef >(const ::ControlRef& control) { assert(control); *************** *** 357,361 **** /****************************************************************************************************/ ! void set_bounds(::ControlRef control, const ::Rect& new_bounds) { assert(control); --- 360,365 ---- /****************************************************************************************************/ ! template<> ! void set_bounds< ::ControlRef >(::ControlRef& control, const ::Rect& new_bounds) { assert(control); *************** *** 508,511 **** --- 512,597 ---- /****************************************************************************************************/ + // + /// Convert a MacOS FSRef into a Boost path. This allows us to use the + /// boost::filesystem library to perform operations on the path, rather + /// than using the FSRef API. + /// + /// \param location the FSRef to make into a bfs::path + /// \return a bfs path of the given location. + // + boost::filesystem::path fsref_to_path( const ::FSRef& location ) + { + std::size_t max_size (1024); + std::vector<char> path_buffer(max_size); + OSStatus error(noErr); + + while (true) + { + error = ::FSRefMakePath(&location, reinterpret_cast<UInt8*>(&path_buffer[0]), max_size); + if (error != pathTooLongErr) break; + + max_size *= 2; + path_buffer.resize(max_size); + } + + ADOBE_REQUIRE_STATUS(error); + + return boost::filesystem::path( &path_buffer[0], boost::filesystem::native ); + } + + /****************************************************************************************************/ + + bool pick_save_path(boost::filesystem::path& path) + { + ::NavDialogRef nav_dialog; + ::NavDialogCreationOptions nav_options; + + ::NavGetDefaultDialogCreationOptions(&nav_options); + + ::NavCreatePutFileDialog(&nav_options, + OSType('utf8'), + OSType('R*ch'), // BBEdit + 0, + 0, + &nav_dialog); + + adobe::auto_resource< ::NavDialogRef > auto_nav_dialog(nav_dialog); + + ::NavDialogRun(nav_dialog); + + ::NavUserAction user_action = ::NavDialogGetUserAction(nav_dialog); + + if (user_action != kNavUserActionCancel && user_action != kNavUserActionNone) + { + ::NavReplyRecord reply; + + ::NavDialogGetReply(nav_dialog, &reply); + + adobe::auto_resource< ::NavReplyRecord* > auto_reply(&reply); + + // filter out the answer from the reply + if (reply.validRecord) + { + ::FSRef file; + ::Size actual_size; + ::AEKeyword keyword; + ::DescType type_code; + + ::AEGetNthPtr( &reply.selection, 1, typeFSRef, &keyword, &type_code, + (Ptr) &file, sizeof(file), (actual_size = sizeof(file), &actual_size)); + + path = fsref_to_path(file); + + path /= implementation::cfstring_to_string(reply.saveFileName); + + return true; + } + } + + return false; + } + + /****************************************************************************************************/ + } // namespace implementation Index: ui_core_implementation.cpp =================================================================== RCS file: /cvsroot/adobe-source/sandbox/adobe-source/adobe/future/widgets/sources/mac/ui_core_implementation.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** ui_core_implementation.cpp 23 Feb 2006 23:28:55 -0000 1.11 --- ui_core_implementation.cpp 27 Feb 2006 20:41:59 -0000 1.12 *************** *** 25,28 **** --- 25,31 ---- #include <adobe/future/memory.hpp> + #include <adobe/gil/core/image_view_factory.hpp> + #include <adobe/gil/core/algorithm.hpp> + #include <boost/type_traits.hpp> #include <boost/cstdint.hpp> *************** *** 944,948 **** template <> ! void shed_fudges<panel_t::implementation_t>(const panel_t::implementation_t& control, adobe::point_2d_t& position, adobe::extents_t& extents) { /* --- 947,951 ---- template <> ! void shed_fudges<panel_t::implementation_t>(panel_t::implementation_t& control, adobe::point_2d_t& position, adobe::extents_t& extents) { /* *************** *** 1890,1894 **** template <> ! std::string get_field_text<adobe::edit_text_t::implementation_t>(adobe::edit_text_t::implementation_t& widget) { if (!widget.control_m) --- 1893,1897 ---- template <> ! std::string get_field_text<adobe::edit_text_t::implementation_t>(const adobe::edit_text_t::implementation_t& widget) { if (!widget.control_m) *************** *** 1914,1918 **** implementation::get_widget_data(widget.control_m, kControlEntireControl, kControlEditTextCFStringTag, cfstring); ! adobe::auto_resource< ::CFStringRef > auto_cfstring(cfstring); return implementation::cfstring_to_string(auto_cfstring); --- 1917,1921 ---- implementation::get_widget_data(widget.control_m, kControlEntireControl, kControlEditTextCFStringTag, cfstring); ! auto_cfstring_t auto_cfstring(cfstring); return implementation::cfstring_to_string(auto_cfstring); *************** *** 2121,2126 **** theme_m(adobe::theme_normal_s), scroll_control_m(0), - name_m("dummy", 0, adobe::theme_normal_s), - static_disabled_text_m("dummy", 0, adobe::theme_normal_s), static_disabled_m(false), using_label_m(false), --- 2124,2127 ---- *************** *** 2138,2144 **** control_m(0), scroll_control_m(rhs.scroll_control_m), - name_m(rhs.name_m), field_text_m(rhs.field_text_m), - static_disabled_text_m(rhs.static_disabled_text_m), static_disabled_m(rhs.static_disabled_m), using_label_m(rhs.using_label_m), --- 2139,2143 ---- *************** *** 2159,2163 **** implementation::get_bounds(rhs.control_m, bounds); ! initialize(bounds, implementation::get_name(name_m.implementation()), scrollable_m, password_m, cols_m, rows_m); set_theme(rhs.theme_m); --- 2158,2171 ---- implementation::get_bounds(rhs.control_m, bounds); ! if (rhs.name_m.get()) ! ! initialize( bounds, ! rhs.name_m.get() ? ! implementation::get_name(rhs.name_m->implementation()) : ! std::string(), ! scrollable_m, ! password_m, ! cols_m, ! rows_m); set_theme(rhs.theme_m); *************** *** 2248,2252 **** if (using_label_m) ! get_label() = label_t(name, 0, theme_m); } --- 2256,2260 ---- if (using_label_m) ! name_m.reset(new label_t(name, 0, theme_m)); } *************** *** 2258,2262 **** extents_t result; ! std::string base_text(cols_m, std::string::value_type('0')); if (rows_m > 1) --- 2266,2270 ---- extents_t result; ! std::string base_text(cols_m * 2, std::string::value_type('0')); if (rows_m > 1) *************** *** 2264,2267 **** --- 2272,2279 ---- result = measure_label_text(base_text, theme_m); + // REVISIT (fbrereto) : There is an issue here where the attributes of an edit_text + // widget don't propagate properly to a static_text widget, so + // measurement is inherently inaccurate. A better solution should + // be found than simply doubling the row count. result.height() *= rows_m; } *************** *** 2372,2377 **** rect.height() = bounds.bottom - bounds.top; rect.width() = bounds.right - bounds.left; - - static_disabled_text_m.place(position, rect); } } --- 2384,2387 ---- *************** *** 2402,2410 **** rect.width() = bounds.right - bounds.left; ! static_disabled_text_m = label_t(implementation::get_field_text(*this), 0, theme_m); ! static_disabled_text_m.place(position, rect); } set_visible(active); //static_disabled_text_m.set_visible(!active); } --- 2412,2429 ---- rect.width() = bounds.right - bounds.left; ! static_disabled_label_m.reset(new label_t(implementation::get_field_text(*this), 0, theme_m)); ! static_disabled_label_m->place(position, rect); ! } ! else ! { ! static_disabled_label_m.reset(0); } set_visible(active); + + // REVISIT : (fbrereto) Should we be disabling the label, or only the edit field? + //if (using_label_m && !static_disabled_m) + // get_label().set_active(active); + //static_disabled_text_m.set_visible(!active); } *************** *** 2553,2557 **** /****************************************************************************************************/ ! std::string get_popup_menu_item_text(adobe::popup_t::implementation_t& widget, ::UInt16 index) { ::MenuRef menu(0); --- 2572,2576 ---- /****************************************************************************************************/ ! std::string get_popup_menu_item_text(const adobe::popup_t::implementation_t& widget, ::UInt16 index) { ::MenuRef menu(0); *************** *** 2562,2566 **** ADOBE_REQUIRE_STATUS(::CopyMenuItemTextAsCFString(menu, index, &menu_item)); ! adobe::auto_resource< ::CFStringRef > auto_string(menu_item); return implementation::cfstring_to_string(menu_item); --- 2581,2585 ---- ADOBE_REQUIRE_STATUS(::CopyMenuItemTextAsCFString(menu, index, &menu_item)); ! auto_cfstring_t auto_string(menu_item); return implementation::cfstring_to_string(menu_item); *************** *** 2602,2606 **** template <> ! std::string get_field_text<adobe::popup_t::implementation_t>(adobe::popup_t::implementation_t& widget) { ::UInt16 value(static_cast< ::UInt16 >(implementation::get_value(widget))); --- 2621,2625 ---- template <> ! std::string get_field_text<adobe::popup_t::implementation_t>(const adobe::popup_t::implementation_t& widget) { ::UInt16 value(static_cast< ::UInt16 >(implementation::get_value(widget))); *************** *** 2698,2702 **** control_m(0), theme_m(adobe::theme_normal_s), - static_disabled_text_m("dummy", 0, adobe::theme_normal_s), static_disabled_m(false), using_label_m(false), --- 2717,2720 ---- *************** *** 2708,2712 **** popup_t::implementation_t::implementation_t(const implementation_t& rhs) : control_m(0), - static_disabled_text_m(rhs.static_disabled_text_m), static_disabled_m(rhs.static_disabled_m), value_handler_m(*this) --- 2726,2729 ---- *************** *** 2783,2787 **** rect.width() = bounds.right - bounds.left; ! static_disabled_text_m.place(position, rect); } } --- 2800,2804 ---- rect.width() = bounds.right - bounds.left; ! //static_disabled_text_m.place(position, rect); } } *************** *** 2811,2816 **** rect.width() = bounds.right - bounds.left; ! static_disabled_text_m = label_t(implementation::get_field_text(*this), 0, theme_m); ! static_disabled_text_m.place(position, rect); } --- 2828,2833 ---- rect.width() = bounds.right - bounds.left; ! //static_disabled_text_m = label_t(implementation::get_field_text(*this), 0, theme_m); ! //static_disabled_tex... [truncated message content] |