>>>>> "Bennett" == Bennett Helm <[EMAIL PROTECTED]> writes:
Bennett> It might help if there was a patch! Bennett> I'm going to be away for about a week starting today, so I'm Bennett> afraid testing will have to wait. OK, here is the patch. Test it when you can. JMarc
Index: src/lyxfunc.C =================================================================== --- src/lyxfunc.C (revision 16251) +++ src/lyxfunc.C (working copy) @@ -293,7 +293,7 @@ void LyXFunc::processKeySym(LyXKeySymPtr lyxerr << BOOST_CURRENT_FUNCTION << " Key [action=" << func.action << "][" - << keyseq->print() << ']' + << to_utf8(keyseq->print()) << ']' << endl; } @@ -302,7 +302,7 @@ void LyXFunc::processKeySym(LyXKeySymPtr // num_bytes == 0? (Lgb) if (keyseq->length() > 1) { - lyx_view_->message(from_utf8(keyseq->print())); + lyx_view_->message(keyseq->print()); } @@ -786,7 +786,7 @@ void LyXFunc::dispatch(FuncRequest const case LFUN_COMMAND_PREFIX: BOOST_ASSERT(lyx_view_); - lyx_view_->message(from_utf8(keyseq->printOptions())); + lyx_view_->message(keyseq->printOptions()); break; case LFUN_COMMAND_EXECUTE: @@ -807,7 +807,7 @@ void LyXFunc::dispatch(FuncRequest const case LFUN_META_PREFIX: meta_fake_bit = key_modifier::alt; - setMessage(from_utf8(keyseq->print())); + setMessage(keyseq->print()); break; case LFUN_BUFFER_TOGGLE_READ_ONLY: @@ -1167,7 +1167,7 @@ void LyXFunc::dispatch(FuncRequest const break; case LFUN_SERVER_NOTIFY: - dispatch_buffer = from_utf8(keyseq->print()); + dispatch_buffer = keyseq->print(); theLyXServer().notifyClient(to_utf8(dispatch_buffer)); break; @@ -1763,7 +1763,7 @@ void LyXFunc::sendDispatchMessage(docstr } } - string const shortcuts = theTopLevelKeymap().printbindings(cmd); + string const shortcuts = to_utf8(theTopLevelKeymap().printbindings(cmd)); if (!shortcuts.empty()) comname += ": " + shortcuts; @@ -2028,12 +2028,12 @@ string const LyXFunc::viewStatusMessage( { // When meta-fake key is pressed, show the key sequence so far + "M-". if (wasMetaKey()) - return keyseq->print() + "M-"; + return to_utf8(keyseq->print() + "M-"); // Else, when a non-complete key sequence is pressed, // show the available options. if (keyseq->length() > 0 && !keyseq->deleted()) - return keyseq->printOptions(); + return to_utf8(keyseq->printOptions()); if (!view()->buffer()) return to_utf8(_("Welcome to LyX!")); Index: src/frontends/LyXKeySym.h =================================================================== --- src/frontends/LyXKeySym.h (revision 16251) +++ src/frontends/LyXKeySym.h (working copy) @@ -16,6 +16,8 @@ #include "key_state.h" +#include "support/docstring.h" + #include <boost/shared_ptr.hpp> @@ -58,7 +60,7 @@ public: * Return a string describing the KeySym with modifier mod. * This should use the native UI format when applicable */ - virtual std::string const print(key_modifier::state mod) const = 0; + virtual docstring const print(key_modifier::state mod) const = 0; }; Index: src/frontends/qt4/QLyXKeySym.C =================================================================== --- src/frontends/qt4/QLyXKeySym.C (revision 16251) +++ src/frontends/qt4/QLyXKeySym.C (working copy) @@ -211,7 +211,7 @@ size_t QLyXKeySym::getUCSEncoded() const } -QString const QLyXKeySym::qprint(key_modifier::state mod) const +docstring const QLyXKeySym::print(key_modifier::state mod) const { int tmpkey = key_; @@ -222,13 +222,7 @@ QString const QLyXKeySym::qprint(key_mod if (mod & key_modifier::alt) tmpkey += Qt::ALT; - return QKeySequence(tmpkey).toString(); -} - - -string const QLyXKeySym::print(key_modifier::state mod) const -{ - return fromqstr(qprint(mod)); + return from_utf8(fromqstr(QKeySequence(tmpkey).toString())); } Index: src/frontends/qt4/QLyXKeySym.h =================================================================== --- src/frontends/qt4/QLyXKeySym.h (revision 16251) +++ src/frontends/qt4/QLyXKeySym.h (working copy) @@ -59,10 +59,7 @@ public: virtual size_t getUCSEncoded() const; /// Return a human-readable version of a key+modifier pair. - virtual std::string const print(key_modifier::state mod) const; - - /// - QString const qprint(key_modifier::state mod) const; + virtual docstring const print(key_modifier::state mod) const; /// int key() const { Index: src/frontends/qt4/QLPopupMenu.C =================================================================== --- src/frontends/qt4/QLPopupMenu.C (revision 16251) +++ src/frontends/qt4/QLPopupMenu.C (working copy) @@ -27,11 +27,6 @@ #include "debug.h" -#ifdef Q_WS_MACX -#include "kbmap.h" -#include "QLyXKeySym.h" -#endif - using std::make_pair; using std::string; using std::pair; @@ -146,31 +141,10 @@ docstring const QLPopupMenu::getLabel(Me /// \todo Mac specific binding handling. void QLPopupMenu::addBinding(docstring & label, MenuItem const & mi) { -#ifndef Q_WS_MACX - - docstring const binding(mi.binding()); - if (!binding.empty()) { - label += char_type('\t') + binding; - } - -#else - /* There are two constraints on Qt/Mac: (1) - the bindings require a unicode string to be - represented meaningfully and std::string - does not work (2) only 1-key bindings can - be represented in menus. - - This is why the unpleasant hack bellow is - needed (JMarc) - */ -/* pair<LyXKeySym const *, key_modifier::state> - binding = toplevel_keymap->find1keybinding(mi.func()); - if (binding.first) { - QLyXKeySym const *key = static_cast<QLyXKeySym const *>(binding.first); - label += '\t' + key->qprint(binding.second); - } -*/ -#endif + docstring const binding(mi.binding()); + if (!binding.empty()) { + label += char_type('\t') + binding; + } } /// \todo Fix Mac specific menu hack Index: src/kbsequence.C =================================================================== --- src/kbsequence.C (revision 16251) +++ src/kbsequence.C (working copy) @@ -130,9 +130,9 @@ string::size_type kb_sequence::parse(str } -string const kb_sequence::print() const +docstring const kb_sequence::print() const { - string buf; + docstring buf; //if (deleted_) // return buf; @@ -151,16 +151,16 @@ string const kb_sequence::print() const } -string const kb_sequence::printOptions() const +docstring const kb_sequence::printOptions() const { - string buf; + docstring buf; buf += print(); if (!curmap) return buf; - buf += to_utf8(_(" options: ")); + buf += _(" options: "); buf += curmap->print(); return buf; } Index: src/kbsequence.h =================================================================== --- src/kbsequence.h (revision 16251) +++ src/kbsequence.h (working copy) @@ -65,13 +65,13 @@ public: * Return the current sequence as a string. * @see parse() */ - std::string const print() const; + docstring const print() const; /** * Return the current sequence and available options as * a string. No options are added if no curmap kb map exists. */ - std::string const printOptions() const; + docstring const printOptions() const; /// Mark the sequence as deleted. void mark_deleted(); Index: src/kbmap.C =================================================================== --- src/kbmap.C (revision 16251) +++ src/kbmap.C (working copy) @@ -55,7 +55,7 @@ string const kb_keymap::printKeySym(LyXK } -string const kb_keymap::printKey(kb_key const & key) const +docstring const kb_keymap::printKey(kb_key const & key) const { return key.code->print(key.mod.first); } @@ -220,9 +220,9 @@ kb_keymap::lookup(LyXKeySymPtr key, } -string const kb_keymap::print() const +docstring const kb_keymap::print() const { - string buf; + docstring buf; Table::const_iterator end = table.end(); for (Table::const_iterator cit = table.begin(); cit != end; ++cit) { buf += printKey((*cit)); @@ -252,7 +252,7 @@ void kb_keymap::defkey(kb_sequence * seq if (r + 1 == seq->length()) { lyxerr[Debug::KBMAP] << "Warning: New binding for '" - << seq->print() + << to_utf8(seq->print()) << "' is overriding old binding..." << endl; if (it->table.get()) { @@ -262,7 +262,8 @@ void kb_keymap::defkey(kb_sequence * seq it->func.origin = FuncRequest::KEYBOARD; return; } else if (!it->table.get()) { - lyxerr << "Error: New binding for '" << seq->print() + lyxerr << "Error: New binding for '" + << to_utf8(seq->print()) << "' is overriding old binding..." << endl; return; @@ -289,9 +290,9 @@ void kb_keymap::defkey(kb_sequence * seq } -string const kb_keymap::printbindings(FuncRequest const & func) const +docstring const kb_keymap::printbindings(FuncRequest const & func) const { - std::ostringstream res; + odocstringstream res; Bindings bindings = findbindings(func); for (Bindings::const_iterator cit = bindings.begin(); cit != bindings.end() ; ++cit) Index: src/MenuBackend.C =================================================================== --- src/MenuBackend.C (revision 16251) +++ src/MenuBackend.C (working copy) @@ -144,7 +144,7 @@ docstring const MenuItem::binding() cons kb_keymap::Bindings bindings = theTopLevelKeymap().findbindings(func_); if (bindings.size()) { - return from_utf8(bindings.begin()->print()); + return bindings.begin()->print(); } else { lyxerr[Debug::KBMAP] << "No binding for " Index: src/kbmap.h =================================================================== --- src/kbmap.h (revision 16251) +++ src/kbmap.h (working copy) @@ -19,6 +19,8 @@ #include "frontends/key_state.h" #include "frontends/LyXKeySym.h" +#include "support/docstream.h" + #include <boost/shared_ptr.hpp> #include <vector> @@ -44,7 +46,7 @@ public: bool read(std::string const & bind_file); /// print all available keysyms - std::string const print() const; + docstring const print() const; /** * Look up a key press in the keymap. @@ -64,7 +66,7 @@ public: Bindings findbindings(FuncRequest const & func) const; /// Given an action, print the keybindings. - std::string const printbindings(FuncRequest const & func) const; + docstring const printbindings(FuncRequest const & func) const; /** * Given an action, find the first 1-key binding (if it exists). @@ -109,7 +111,7 @@ private: unsigned int r = 0); /// Returns a string of the given key - std::string const printKey(kb_key const & key) const; + docstring const printKey(kb_key const & key) const; /** * Given an action, find all keybindings