|
From: Foster B. <fos...@us...> - 2005-04-12 17:25:16
|
Update of /cvsroot/adobe-source/sandbox/adobe-source/adobe/test/visual/sources In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29764/adobe-source/adobe/test/visual/sources Modified Files: client_assembler.cpp express_viewer.cpp Log Message: Adding error diagnostics to xstr; beginning metrics work on Mac Begin Index: express_viewer.cpp =================================================================== RCS file: /cvsroot/adobe-source/sandbox/adobe-source/adobe/test/visual/sources/express_viewer.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** express_viewer.cpp 31 Mar 2005 01:37:54 -0000 1.7 --- express_viewer.cpp 12 Apr 2005 17:24:47 -0000 1.8 *************** *** 14,17 **** --- 14,18 ---- #include <adobe/adam_evaluate.hpp> + #include <adobe/xstr.hpp> #ifndef NDEBUG *************** *** 72,107 **** /****************************************************************************************************/ - // - /// The stream_sucker is used to extract the data available from a stream and - /// deposit it into a string. - /// - /// \param stream the stream to extract data from. - /// \return all of the data in the stream. - // - template<typename InputStream> - std::string stream_sucker( InputStream& stream ) - { - std::string result; - - if ( stream.is_open() ) - { - std::istream::char_type c( 0 ); - // - // Read from the stream character by character until we - // reach the end. - // - while( !stream.eof() ) - { - stream.get( c ); - if ( c == '\n' ) c = '\r'; - if ( !stream.eof() ) result += c; - } - } - - return result; - } - - /****************************************************************************************************/ - simpleApplication::simpleApplication() : _sheet_m( 0 ), _holder_m( 0 ), --- 73,76 ---- *************** *** 134,137 **** --- 103,108 ---- #if ADOBE_PLATFORM_MAC + _load_metrics_glossary(); + // // We need to load the editor.adm and editor.eve files. *************** *** 175,179 **** editor_view_s->window_m->set_visible( true ); editor_view_s->window_m->draw_controls(); ! #elif defined(BOOST_MSVC) // REVISIT (fbrereto) Until we have the main window up and running on Win32, // we will treat Begin like a simple viewer application, --- 146,151 ---- editor_view_s->window_m->set_visible( true ); editor_view_s->window_m->draw_controls(); ! ! #elif ADOBE_PLATFORM_WIN // REVISIT (fbrereto) Until we have the main window up and running on Win32, // we will treat Begin like a simple viewer application, *************** *** 321,324 **** --- 293,315 ---- /****************************************************************************************************/ + #if ADOBE_PLATFORM_MAC + void simpleApplication::_load_metrics_glossary() + { + adobe::dictionary_t default_context(adobe::xstr_t::get_default_context()); + + default_context.write()[adobe::static_name_t("widget")] = adobe::value_t(adobe::static_name_t("unknown")); + default_context.write()[adobe::static_name_t("theme")] = adobe::value_t(adobe::static_name_t("normal")); + + adobe::xstr_t::set_default_context(default_context); + + std::ifstream metrics_glossary( ( _resource_dir_m / "metrics_glossary.xstr" ).native_file_string().c_str() ); + std::string glossary(stream_sucker(metrics_glossary)); + + adobe::xstr_t::assign_glossary(std::make_pair(&glossary[0], &glossary[0] + glossary.size())); + } + #endif + + /****************************************************************************************************/ + simpleApplication* simpleApplication::getInstance() { *************** *** 364,367 **** --- 355,366 ---- if ( !_holder_m ) { + #if ADOBE_PLATFORM_MAC + // We do this every time we load a window because we want to be able to see + // changes reflected in the glossary without needing to relaunch the + // application every time we make a change. + + _load_metrics_glossary(); + #endif + // // Note that the sheet is passed straight to the window_server Index: client_assembler.cpp =================================================================== RCS file: /cvsroot/adobe-source/sandbox/adobe-source/adobe/test/visual/sources/client_assembler.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** client_assembler.cpp 10 Apr 2005 01:24:35 -0000 1.6 --- client_assembler.cpp 12 Apr 2005 17:24:47 -0000 1.7 *************** *** 866,874 **** if (slice == adobe::rectangle_slices_t::horizontal) ! result.first.first = src_slice.position_m - src_slice.outset_m.first; else ! result.first.second = src_slice.position_m - src_slice.outset_m.first; ! dst_slice.length_m = src_slice.length_m + src_slice.outset_m.first + src_slice.outset_m.second; dst_slice.outset_m = src_slice.outset_m; --- 866,874 ---- if (slice == adobe::rectangle_slices_t::horizontal) ! result.first.first = src_slice.position_m; else ! result.first.second = src_slice.position_m; ! dst_slice.length_m = src_slice.length_m; dst_slice.outset_m = src_slice.outset_m; |