From b9a8b8f4b6032b971efdd657bed34425ca93d1ed Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20P=C3=B6nitz?= Date: Thu, 2 Oct 2003 14:42:31 +0000 Subject: [PATCH] fix #1360 * lyxfunc.C: * text3.C: move handling of LFUN_DEPTH *; git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7853 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/ChangeLog | 7 ++++++- src/lyxfunc.C | 11 ----------- src/metricsinfo.C | 20 ++++++++++++++++++++ src/metricsinfo.h | 8 ++++++++ src/text3.C | 13 +++++++++++++ 5 files changed, 47 insertions(+), 12 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 672fa8715f..d5aec51a75 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,11 +1,16 @@ +2003-10-02 André Pönitz + + * lyxfunc.C: + * text3.C: move handling of LFUN_DEPTH *; fix #1360 + 2003-10-01 André Pönitz * factory.C: assert early 2003-09-26 Lars Gullik Bjønnes - * lyx_main.C: remove the glboal debug object + * lyx_main.C: remove the global debug object * debug.h: adjust for new debugstream diff --git a/src/lyxfunc.C b/src/lyxfunc.C index 3ffa92e641..8dcf405e94 100644 --- a/src/lyxfunc.C +++ b/src/lyxfunc.C @@ -72,7 +72,6 @@ #include "support/path.h" #include "support/path_defines.h" #include "support/tostr.h" - #include "support/std_sstream.h" using bv_funcs::apply_freefont; @@ -1202,16 +1201,6 @@ void LyXFunc::dispatch(FuncRequest const & func, bool verbose) view()->redo(); break; - case LFUN_DEPTH_MIN: - changeDepth(view(), view()->getLyXText(), DEC_DEPTH, false); - owner->view_state_changed(); - break; - - case LFUN_DEPTH_PLUS: - changeDepth(view(), view()->getLyXText(), INC_DEPTH, false); - owner->view_state_changed(); - break; - case LFUN_FREEFONT_APPLY: apply_freefont(view()); break; diff --git a/src/metricsinfo.C b/src/metricsinfo.C index aad69f7834..b715e14535 100644 --- a/src/metricsinfo.C +++ b/src/metricsinfo.C @@ -14,6 +14,7 @@ #include "mathed/math_support.h" #include "frontends/Painter.h" #include "BufferView.h" +#include "LColor.h" @@ -147,6 +148,7 @@ FontSetChanger::FontSetChanger(MetricsBase & mb, char const * name) augmentFont(mb.font, name); } + FontSetChanger::~FontSetChanger() { orig_ = save_; @@ -165,3 +167,21 @@ WidthChanger::~WidthChanger() { orig_ = save_; } + + + + +ColorChanger::ColorChanger(LyXFont & font, string const & color) + : Changer(font) +{ + save_ = lcolor.getFromGUIName(color); + font.setColor(lcolor.getFromGUIName(color)); +} + + +ColorChanger::~ColorChanger() +{ + orig_.setColor(lcolor.getFromGUIName(save_)); +} + + diff --git a/src/metricsinfo.h b/src/metricsinfo.h index 951d5f6680..b647dc458e 100644 --- a/src/metricsinfo.h +++ b/src/metricsinfo.h @@ -175,4 +175,12 @@ struct WidthChanger : public Changer }; +// temporarily change the used color +struct ColorChanger : public Changer { + /// + ColorChanger(LyXFont & font, string const & color); + /// + ~ColorChanger(); +}; + #endif diff --git a/src/text3.C b/src/text3.C index a19a5e17d9..85528c0a82 100644 --- a/src/text3.C +++ b/src/text3.C @@ -1534,6 +1534,19 @@ InsetOld::RESULT LyXText::dispatch(FuncRequest const & cmd) doInsertInset(this, cmd, false, false); break; + case LFUN_DEPTH_MIN: + bv_funcs::changeDepth(bv, this, bv_funcs::DEC_DEPTH, false); + clearSelection(); + bv->update(); + break; + + case LFUN_DEPTH_PLUS: + clearSelection(); + bv_funcs::changeDepth(bv, this, bv_funcs::INC_DEPTH, false); + clearSelection(); + bv->update(); + break; + default: return UNDISPATCHED; } -- 2.39.5