From: Foster B. <fos...@us...> - 2006-02-27 20:42:13
|
Update of /cvsroot/adobe-source/sandbox/adobe-source/adobe/test/begin/sources In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8667/adobe/test/begin/sources Modified Files: express_viewer.cpp file.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: file.cpp =================================================================== RCS file: /cvsroot/adobe-source/sandbox/adobe-source/adobe/test/begin/sources/file.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** file.cpp 23 Feb 2006 23:28:57 -0000 1.1 --- file.cpp 27 Feb 2006 20:42:00 -0000 1.2 *************** *** 9,12 **** --- 9,23 ---- #include "file.hpp" + #include <adobe/future/alert.hpp> + #include <adobe/name.hpp> + + #include <vector> + + #if ADOBE_PLATFORM_MAC + #include <adobe/future/widgets/headers/mac/os_utilities.hpp> + #elif ADOBE_PLATFORM_WIN + #include <adobe/future/widgets/headers/win32/os_utilities.hpp> + #endif + /****************************************************************************************************/ *************** *** 47,51 **** void file_buffer_t::save() { ! if (!dirty_m) return; bfs::ofstream output( path_m, std::ios_base::out | std::ios_base::binary ); --- 58,66 ---- void file_buffer_t::save() { ! if (!dirty_m) ! return; ! ! if (!is_valid() && !ask_for_path()) ! return; bfs::ofstream output( path_m, std::ios_base::out | std::ios_base::binary ); *************** *** 69,72 **** --- 84,117 ---- /****************************************************************************************************/ + bool file_buffer_t::ask_for_path() + { + adobe::alert_helper_t helper; + + adobe::name_t ok_button(adobe::static_name_t("OK")); + adobe::name_t cancel_button(adobe::static_name_t("Cancel")); + + helper.window_name_m = "Where Should Adobe Begin Save the File?"; + helper.message_m = "A location has not been specified for where " + "you would like to save the file. Would you " + "like to select a location?"; + helper.name_set_m.push_back(ok_button); + helper.name_set_m.push_back(cancel_button); + + adobe::name_t result = helper.run().first; + + if (result != ok_button) + return false; + + // Pick a file path dialog + + #if ADOBE_PLATFORM_MAC || ADOBE_PLATFORM_WIN + return implementation::pick_save_path(path_m); + #else + return false; + #endif + } + + /****************************************************************************************************/ + void file_buffer_t::set_dirty(bool to) { Index: express_viewer.cpp =================================================================== RCS file: /cvsroot/adobe-source/sandbox/adobe-source/adobe/test/begin/sources/express_viewer.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** express_viewer.cpp 23 Feb 2006 23:28:57 -0000 1.11 --- express_viewer.cpp 27 Feb 2006 20:42:00 -0000 1.12 *************** *** 45,50 **** --- 45,52 ---- #include <adobe/config.hpp> #include <adobe/future/widgets/headers/ui_core.hpp> + #include <adobe/future/widgets/headers/label_t.hpp> #include <boost/version.hpp> + #include <boost/filesystem/path.hpp> #include <boost/filesystem/convenience.hpp> #include <boost/filesystem/operations.hpp> *************** *** 87,94 **** " view dialog(name: 'My Dialog')\n" " {\n" - " edit_number(bind: @my_value, format: '#');\n" " slider(bind: @my_value, format: {first: 0, last: 100});\n" " }\n" ! "}"; /****************************************************************************************************/ --- 89,97 ---- " view dialog(name: 'My Dialog')\n" " {\n" " slider(bind: @my_value, format: {first: 0, last: 100});\n" + " edit_number(bind: @my_value, format: '#');\n" + " button(name: 'OK', bind: @result, action: @ok, default: true);\n" " }\n" ! "}\n"; /****************************************************************************************************/ *************** *** 99,103 **** "interface:\n" " my_value: 42;\n" ! "}"; /****************************************************************************************************/ --- 102,108 ---- "interface:\n" " my_value: 42;\n" ! "output:\n" ! " result <== { value: my_value };\n" ! "}\n"; /****************************************************************************************************/ *************** *** 130,133 **** --- 135,152 ---- if ( _initialized ) return true; + #if ADOBE_PLATFORM_MAC + // This is a lame hack to inject the mac metrics glossary + // into the context stack before any more work is done. + // Otherwise it will get injected when it is first used, + // which is when the first widget measurement will take + // place, which is also *after* the glossary call below. + // The glossary call will fall out of scope at the end + // of this function, but instead of popping the glossary + // it'll pop the injected mac metrics glossary, which is + // not what we want. + + (void)label_t("dummy", 0, adobe::theme_normal_s).measure_horizontal(); + #endif + // // The os_initialize function is implemented in win/main.cpp or *************** *** 136,150 **** if ( !os_initialize( this ) ) return false; - #if ADOBE_PLATFORM_MAC - // - // Load up the mac metrics glossary - // - adobe::file_slurp<char> metrics_slurp( _resource_dir_m / "metrics_glossary.xstr" ); - adobe::xstring_context_t mac_metrics_context(metrics_slurp.begin(), metrics_slurp.end(), - adobe::line_position_t( "metrics_glossary.xstr" ) ); - - metrics_slurp.release(); - #endif - // // Load up the default string glossary for localization --- 155,158 ---- *************** *** 190,194 **** this, _1, _2 ), size_small_s, ! default_factory ).release() ); // --- 198,203 ---- this, _1, _2 ), size_small_s, ! default_factory, ! _eve_file_m.directory_path() ).release() ); // *************** *** 300,304 **** stream << "\tFoster Brereton, Mat Marcus, Sean Parent,\n"; stream << "\tEric Berdahl, Lubomir Bourdev, Hailin Jin,\n"; ! stream << "\tJon Reid\n"; stream << "Opensource community contributions by\n"; stream << "\tDavid Catmull, Jamie Gadd, Peter Kummel,\n"; --- 309,313 ---- stream << "\tFoster Brereton, Mat Marcus, Sean Parent,\n"; stream << "\tEric Berdahl, Lubomir Bourdev, Hailin Jin,\n"; ! stream << "\tJon Reid, Mark Ruzon\n"; stream << "Opensource community contributions by\n"; stream << "\tDavid Catmull, Jamie Gadd, Peter Kummel,\n"; *************** *** 386,400 **** // - #if ADOBE_PLATFORM_MAC - // - // Load up the mac metrics glossary - // - adobe::file_slurp<char> metrics_slurp( _resource_dir_m / "metrics_glossary.xstr" ); - adobe::xstring_context_t mac_metrics_context(metrics_slurp.begin(), metrics_slurp.end(), - adobe::line_position_t( "metrics_glossary.xstr" ) ); - - metrics_slurp.release(); - #endif - // // Load up the default string glossary for localization --- 395,398 ---- *************** *** 613,616 **** --- 611,621 ---- /****************************************************************************************************/ + bool always_break(adobe::name_t, const adobe::value_t&) + { + return true; + } + + /****************************************************************************************************/ + void application_t::run_current_as_modal() { *************** *** 626,630 **** adobe::dialog_display_s, eve_stream, ! adam_stream); } --- 631,637 ---- adobe::dialog_display_s, eve_stream, ! adam_stream, ! &always_break, ! _eve_file_m.directory_path()); } |