From: Foster B. <fos...@us...> - 2006-02-27 20:42:05
|
Update of /cvsroot/adobe-source/sandbox/adobe-source/adobe/future In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8667/adobe/future Modified Files: modal_dialog_interface.hpp Added Files: alert.hpp endian.hpp 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. --- NEW FILE: alert.hpp --- /* 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/name.hpp> #include <utility> #include <boost/filesystem/path.hpp> /****************************************************************************************************/ namespace adobe { /****************************************************************************************************/ // The Uber Alert API std::pair<adobe::name_t, bool> alert(const char* window_name, const char* message_text, adobe::name_t* first_button_name, adobe::name_t* last_button_name, const char* checkbox_name = 0, const boost::filesystem::path& icon_path = boost::filesystem::path(), std::size_t default_button_index = 0, std::size_t cancel_button_index = 1); /****************************************************************************************************/ struct alert_helper_t { typedef std::vector<adobe::name_t> name_set_t; alert_helper_t() : window_name_m(""), message_m("I'm trying to think but nothing happens!"), default_button_index_m(0), cancel_button_index_m(1) { } std::pair<adobe::name_t, bool> run() { if (name_set_m.empty()) name_set_m.push_back(adobe::static_name_t("OK")); adobe::name_t* first(&name_set_m[0]); return adobe::alert(window_name_m.c_str(), message_m.c_str(), first, first + name_set_m.size(), checkbox_name_m.empty() ? 0 : checkbox_name_m.c_str(), icon_path_m, default_button_index_m, cancel_button_index_m); } std::string window_name_m; std::string message_m; name_set_t name_set_m; std::string checkbox_name_m; boost::filesystem::path icon_path_m; std::size_t default_button_index_m; std::size_t cancel_button_index_m; }; /****************************************************************************************************/ } // namespace adobe /****************************************************************************************************/ Index: modal_dialog_interface.hpp =================================================================== RCS file: /cvsroot/adobe-source/sandbox/adobe-source/adobe/future/modal_dialog_interface.hpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** modal_dialog_interface.hpp 3 Feb 2006 18:33:36 -0000 1.2 --- modal_dialog_interface.hpp 27 Feb 2006 20:41:58 -0000 1.3 *************** *** 7,14 **** /****************************************************************************************************/ - #include <utility> #include <adobe/dictionary.hpp> #include <adobe/array.hpp> /****************************************************************************************************/ --- 7,18 ---- /****************************************************************************************************/ #include <adobe/dictionary.hpp> #include <adobe/array.hpp> + #include <boost/function.hpp> + #include <boost/filesystem/path.hpp> + + #include <utility> + /****************************************************************************************************/ *************** *** 34,43 **** }; ! adobe::dialog_result_t handle_dialog( const adobe::dictionary_t& input, ! const adobe::record_info_t& record, ! const adobe::dictionary_t& display_state, ! adobe::display_options_t display_options, ! std::istream& layout_definition, ! std::istream& sheet_definition); /****************************************************************************************************/ --- 38,52 ---- }; ! ! typedef boost::function <bool (adobe::name_t, const adobe::value_t&)> action_callback_t; ! ! adobe::dialog_result_t handle_dialog( const adobe::dictionary_t& input, ! const adobe::record_info_t& record, ! const adobe::dictionary_t& display_state, ! adobe::display_options_t display_options, ! std::istream& layout_definition, ! std::istream& sheet_definition, ! action_callback_t callback, ! const boost::filesystem::path& working_directory); /****************************************************************************************************/ --- NEW FILE: endian.hpp --- /* 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) */ /****************************************************************************************************/ #ifndef ADOBE_ENDIAN_HPP #define ADOBE_ENDIAN_HPP /****************************************************************************************************/ #include <adobe/config.hpp> #include <boost/detail/endian.hpp> /*************************************************************************************************/ namespace adobe { /*************************************************************************************************/ struct endian { enum type { big, little, #if defined(BOOST_BIG_ENDIAN) platform = big, #elif defined(BOOST_LITTLE_ENDIAN) platform = little, #endif }; enum platform_test { is_big = platform == big, is_little = platform == little }; }; /*************************************************************************************************/ namespace implementation { /*************************************************************************************************/ template <bool NeedsIt> struct byteswap { template <typename T> void operator()(T& x) const { enum { size = sizeof(T), end = size >> 1 }; for (std::size_t i(0); i < end; ++i) std::swap(reinterpret_cast<char*>(&x)[i], reinterpret_cast<char*>(&x)[size - i - 1]); } }; template <> struct byteswap<false> { template <typename T> void operator()(T&) const { } }; /*************************************************************************************************/ } // namespace implementation /*************************************************************************************************/ template <adobe::endian::type SourceEndian> struct endian_swap { enum { need_swap = SourceEndian != adobe::endian::platform }; template <typename T> void operator()(T& x) const { adobe::implementation::byteswap<need_swap>()(x); } }; /****************************************************************************************************/ } // namespace adobe /****************************************************************************************************/ #endif /****************************************************************************************************/ |