* 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
This commit is contained in:
Abdelrazak Younes 2006-09-17 10:03:00 +00:00
parent 3537aa7448
commit 1a786c8e17
7 changed files with 26 additions and 34 deletions

View File

@ -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_;

View File

@ -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<void(lyx::docstring)> message;
@ -270,6 +274,9 @@ private:
lyx::pit_type anchor_ref_;
///
int offset_ref_;
/// keyboard mapping object
boost::scoped_ptr<Intl> const intl_;
};
#endif // BUFFERVIEW_H

View File

@ -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);
}

View File

@ -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> toolbars_;
/// keyboard mapping object
boost::scoped_ptr<Intl> const intl_;
/// auto-saving of buffers
boost::scoped_ptr<Timeout> const autosave_timeout_;
/// our function handler

View File

@ -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: {

View File

@ -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);

View File

@ -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;