From 1a786c8e171f0319dd5da53b0908b7873749b5b0 Mon Sep 17 00:00:00 2001 From: Abdelrazak Younes Date: Sun, 17 Sep 2006 10:03:00 +0000 Subject: [PATCH] * Transfer Intl member from LyXView to BufferView. * delete unused offset_ref() method. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15030 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/BufferView.C | 20 ++++++++------------ src/BufferView.h | 11 +++++++++-- src/frontends/LyXView.C | 3 --- src/frontends/LyXView.h | 8 -------- src/lyxfunc.C | 10 +++++----- src/mathed/InsetMathHull.C | 2 +- src/text3.C | 6 +++--- 7 files changed, 26 insertions(+), 34 deletions(-) diff --git a/src/BufferView.C b/src/BufferView.C index 86d8c8e761..e16a2da665 100644 --- a/src/BufferView.C +++ b/src/BufferView.C @@ -136,7 +136,8 @@ T * getInsetByCode(LCursor & cur, InsetBase::Code code) BufferView::BufferView(LyXView * owner) : owner_(owner), buffer_(0), wh_(0), cursor_(*this), - multiparsel_cache_(false), anchor_ref_(0), offset_ref_(0) + multiparsel_cache_(false), anchor_ref_(0), offset_ref_(0), + intl_(new Intl) { xsel_cache_.set = false; @@ -149,6 +150,8 @@ BufferView::BufferView(LyXView * owner) saved_positions[bm->get<0>()] = Position( bm->get<1>(), bm->get<2>(), bm->get<3>() ); // and then clear them bmList.clear(); + + intl_->initKeyMapper(lyxrc.use_kbmap); } @@ -594,13 +597,12 @@ void BufferView::switchKeyMap() if (!lyxrc.rtl_support) return; - Intl & intl = owner_->getIntl(); if (getLyXText()->real_current_font.isRightToLeft()) { - if (intl.keymap == Intl::PRIMARY) - intl.keyMapSec(); + if (intl_->keymap == Intl::PRIMARY) + intl_->keyMapSec(); } else { - if (intl.keymap == Intl::SECONDARY) - intl.keyMapPrim(); + if (intl_->keymap == Intl::SECONDARY) + intl_->keyMapPrim(); } } @@ -1261,12 +1263,6 @@ lyx::pit_type BufferView::anchor_ref() const } -int BufferView::offset_ref() const -{ - return offset_ref_; -} - - ViewMetricsInfo const & BufferView::viewMetricsInfo() { return metrics_info_; diff --git a/src/BufferView.h b/src/BufferView.h index 2483667893..43f197be7a 100644 --- a/src/BufferView.h +++ b/src/BufferView.h @@ -32,6 +32,7 @@ class Change; class DocIterator; class FuncRequest; class FuncStatus; +class Intl; class Language; class LCursor; class LyXText; @@ -184,8 +185,6 @@ public: /// a function should be executed from the workarea bool workAreaDispatch(FuncRequest const & ev); - /// access to offset - int offset_ref() const; /// access to anchor lyx::pit_type anchor_ref() const; @@ -210,6 +209,11 @@ public: /// void updateMetrics(bool singlepar = false); + /// get this view's keyboard map handler + Intl & getIntl() { return *intl_.get(); } + /// + Intl const & getIntl() const { return *intl_.get(); } + /// This signal is emitted when some message shows up. boost::signal message; @@ -270,6 +274,9 @@ private: lyx::pit_type anchor_ref_; /// int offset_ref_; + + /// keyboard mapping object + boost::scoped_ptr const intl_; }; #endif // BUFFERVIEW_H diff --git a/src/frontends/LyXView.C b/src/frontends/LyXView.C index 62d41ff69f..7b06cf9684 100644 --- a/src/frontends/LyXView.C +++ b/src/frontends/LyXView.C @@ -75,7 +75,6 @@ LyXView::LyXView(Gui & owner) : work_area_(0), owner_(owner), toolbars_(new Toolbars(*this)), - intl_(new Intl), autosave_timeout_(new Timeout(5000)), lyxfunc_(new LyXFunc(this)), dialogs_(new Dialogs(*this)), @@ -119,8 +118,6 @@ void LyXView::init() autosave_timeout_->setTimeout(lyxrc.autosave * 1000); autosave_timeout_->start(); } - - intl_->initKeyMapper(lyxrc.use_kbmap); } diff --git a/src/frontends/LyXView.h b/src/frontends/LyXView.h index 0ef9ee778f..b353571f03 100644 --- a/src/frontends/LyXView.h +++ b/src/frontends/LyXView.h @@ -23,7 +23,6 @@ class Buffer; class InsetBase; -class Intl; class Menubar; class BufferView; @@ -107,11 +106,6 @@ public: /// Dialogs const & getDialogs() const { return *dialogs_.get(); } - /// get this view's keyboard map handler - Intl & getIntl() { return *intl_.get(); } - /// - Intl const & getIntl() const { return *intl_.get(); } - //@} /// load a buffer into the current workarea @@ -195,8 +189,6 @@ private: /// view's toolbar boost::scoped_ptr toolbars_; - /// keyboard mapping object - boost::scoped_ptr const intl_; /// auto-saving of buffers boost::scoped_ptr const autosave_timeout_; /// our function handler diff --git a/src/lyxfunc.C b/src/lyxfunc.C index 89c92637b8..a861048e66 100644 --- a/src/lyxfunc.C +++ b/src/lyxfunc.C @@ -220,7 +220,7 @@ void LyXFunc::handleKeyFunc(kb_action action) c = 0; } - owner->getIntl().getTransManager() + owner->view()->getIntl().getTransManager() .deadkey(c, get_accent(action).accent, view()->getLyXText()); // Need to clear, in case the minibuffer calls these // actions @@ -1304,19 +1304,19 @@ void LyXFunc::dispatch(FuncRequest const & cmd) break; case LFUN_KEYMAP_OFF: - owner->getIntl().keyMapOn(false); + owner->view()->getIntl().keyMapOn(false); break; case LFUN_KEYMAP_PRIMARY: - owner->getIntl().keyMapPrim(); + owner->view()->getIntl().keyMapPrim(); break; case LFUN_KEYMAP_SECONDARY: - owner->getIntl().keyMapSec(); + owner->view()->getIntl().keyMapSec(); break; case LFUN_KEYMAP_TOGGLE: - owner->getIntl().toggleKeyMap(); + owner->view()->getIntl().toggleKeyMap(); break; case LFUN_REPEAT: { diff --git a/src/mathed/InsetMathHull.C b/src/mathed/InsetMathHull.C index 81af5ffa74..08d9d147a0 100644 --- a/src/mathed/InsetMathHull.C +++ b/src/mathed/InsetMathHull.C @@ -1261,7 +1261,7 @@ void InsetMathHull::mutateToText() string::const_iterator cit = str.begin(); string::const_iterator end = str.end(); for (; cit != end; ++cit) - view_->owner()->getIntl()->getTransManager().TranslateAndInsert(*cit, lt); + view_->getIntl()->getTransManager().TranslateAndInsert(*cit, lt); // remove ourselves //view_->owner()->dispatch(LFUN_ESCAPE); diff --git a/src/text3.C b/src/text3.C index 9917005793..7f0e846572 100644 --- a/src/text3.C +++ b/src/text3.C @@ -606,7 +606,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd) case LFUN_CHAR_DELETE_BACKWARD: if (!cur.selection()) { - if (bv->owner()->getIntl().getTransManager().backspace()) { + if (bv->getIntl().getTransManager().backspace()) { // Par boundary, full-screen update if (cur.pos() == 0) singleParUpdate = false; @@ -1077,7 +1077,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd) docstring::const_iterator end = cmd.argument().end(); for (; cit != end; ++cit) #if 0 - bv->owner()->getIntl().getTransManager(). + bv->getIntl().getTransManager(). translateAndInsert(*cit, this); #else insertChar(bv->cursor(), *cit); @@ -1389,7 +1389,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd) bv->owner()->getLyXFunc().handleKeyFunc(cmd.action); if (!cmd.argument().empty()) // FIXME: Are all these characters encoded in one byte in utf8? - bv->owner()->getIntl().getTransManager() + bv->getIntl().getTransManager() .translateAndInsert(cmd.argument()[0], this); break;