From 53cf203fb9622303b4b074b0c54061e505eb58af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20Gullik=20Bj=C3=B8nnes?= Date: Tue, 17 Apr 2001 14:20:21 +0000 Subject: [PATCH] use LFUN_MESSAGE, inhritprivately from noncpopyable, remove warnings git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1932 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/mathed/ChangeLog | 9 +++++++++ src/mathed/formula.C | 32 +++++++++++++++++++------------- src/mathed/math_macro.C | 6 +++--- src/mathed/math_macrotemplate.h | 2 +- src/mathed/math_parser.C | 2 +- 5 files changed, 33 insertions(+), 18 deletions(-) diff --git a/src/mathed/ChangeLog b/src/mathed/ChangeLog index c65f7aa00d..a0fd587918 100644 --- a/src/mathed/ChangeLog +++ b/src/mathed/ChangeLog @@ -1,3 +1,12 @@ +2001-04-17 Lars Gullik Bjønnes + + * math_macrotemplate.h: inherit privately from noncopyable + + * math_macro.C (Metrics): reindent, use unsigned int as loop var + (setArgumentIdx): change test to avoid unsigned warning + + * formula.C (LocalDispatch): use LFUN_MESSAGE + 2001-04-16 Allan Rae * formula.C (Latex, getLabelList, LocalDispatch): diff --git a/src/mathed/formula.C b/src/mathed/formula.C index e4fc8957f9..5bd4ef0d0b 100644 --- a/src/mathed/formula.C +++ b/src/mathed/formula.C @@ -26,7 +26,6 @@ #include "math_cursor.h" #include "math_parser.h" #include "lyx_main.h" -#include "minibuffer.h" #include "BufferView.h" #include "lyxtext.h" #include "gettext.h" @@ -46,6 +45,7 @@ #include "math_spaceinset.h" #include "math_deliminset.h" #include "mathed/support.h" +#include "lyxfunc.h" using std::ostream; using std::istream; @@ -846,7 +846,7 @@ InsetFormula::LocalDispatch(BufferView * bv, kb_action action, case LFUN_GREEK: if (!greek_kb_flag) { greek_kb_flag = 1; - bv->owner()->getMiniBuffer()->Set(_("Math greek mode on")); + bv->owner()->getLyXFunc()->Dispatch(LFUN_MESSAGE, _("Math greek mode on")); } else greek_kb_flag = 0; break; @@ -855,9 +855,9 @@ InsetFormula::LocalDispatch(BufferView * bv, kb_action action, case LFUN_GREEK_TOGGLE: greek_kb_flag = (greek_kb_flag) ? 0 : 2; if (greek_kb_flag) - bv->owner()->getMiniBuffer()->Set(_("Math greek keyboard on")); + bv->owner()->getLyXFunc()->Dispatch(LFUN_MESSAGE, _("Math greek keyboard on")); else - bv->owner()->getMiniBuffer()->Set(_("Math greek keyboard off")); + bv->owner()->getLyXFunc()->Dispatch(LFUN_MESSAGE, _("Math greek keyboard off")); break; // Math fonts @@ -871,7 +871,7 @@ InsetFormula::LocalDispatch(BufferView * bv, kb_action action, case LFUN_TEX: // varcode = LM_TC_TEX; mathcursor->setLastCode(LM_TC_TEX); - bv->owner()->getMiniBuffer()->Set(_("TeX mode")); + bv->owner()->getLyXFunc()->Dispatch(LFUN_MESSAGE, _("TeX mode")); break; case LFUN_MATH_NUMBER: @@ -883,10 +883,10 @@ InsetFormula::LocalDispatch(BufferView * bv, kb_action action, if (!label_.empty()) { label_.erase(); } - bv->owner()->getMiniBuffer()->Set(_("No number")); + bv->owner()->getLyXFunc()->Dispatch(LFUN_MESSAGE, _("No number")); } else { ++type; - bv->owner()->getMiniBuffer()->Set(_("Number")); + bv->owner()->getLyXFunc()->Dispatch(LFUN_MESSAGE, _("Number")); } par->SetType(type); UpdateLocal(bv); @@ -1085,7 +1085,8 @@ InsetFormula::LocalDispatch(BufferView * bv, kb_action action, // Invalid actions under math mode case LFUN_MATH_MODE: if (mathcursor->getLastCode()!= LM_TC_TEXTRM) { - bv->owner()->getMiniBuffer()->Set(_("math text mode")); + bv->owner()->getLyXFunc() + ->Dispatch(LFUN_MESSAGE, _("math text mode")); varcode = LM_TC_TEXTRM; } else { varcode = LM_TC_VAR; @@ -1094,13 +1095,16 @@ InsetFormula::LocalDispatch(BufferView * bv, kb_action action, break; case LFUN_UNDO: - bv->owner()->getMiniBuffer()->Set(_("Invalid action in math mode!")); + bv->owner()->getLyXFunc() + ->Dispatch(LFUN_MESSAGE, + _("Invalid action in math mode!")); break; //------- dummy actions - case LFUN_EXEC_COMMAND: - bv->owner()->getMiniBuffer()->PrepareForCommand(); - break; +#warning Is this needed here? Shouldnt the main dispatch handle this? (Lgb) + //case LFUN_EXEC_COMMAND: + //bv->owner()->getMiniBuffer()->PrepareForCommand(); + //break; default: if ((action == -1 || action == LFUN_SELFINSERT) @@ -1209,7 +1213,9 @@ InsetFormula::LocalDispatch(BufferView * bv, kb_action action, } else if (c == '\\') { if (was_macro) mathcursor->MacroModeClose(); - bv->owner()->getMiniBuffer()->Set(_("TeX mode")); + bv->owner()->getLyXFunc() + ->Dispatch(LFUN_MESSAGE, + _("TeX mode")); mathcursor->setLastCode(LM_TC_TEX); } UpdateLocal(bv); diff --git a/src/mathed/math_macro.C b/src/mathed/math_macro.C index d22a422106..eb83d1587a 100644 --- a/src/mathed/math_macro.C +++ b/src/mathed/math_macro.C @@ -74,8 +74,8 @@ MathedInset * MathMacro::Clone() void MathMacro::Metrics() { - for (int i = 0; i < args_.size(); ++i) - tmplate_->args_[i] = getArg(i); + for (unsigned int i = 0; i < args_.size(); ++i) + tmplate_->args_[i] = getArg(i); tmplate_->SetStyle(size()); tmplate_->Metrics(); width = tmplate_->Width(); @@ -96,7 +96,7 @@ void MathMacro::draw(Painter & pain, int x, int y) bool MathMacro::setArgumentIdx(int i) { - if (i >= 0 && i < args_.size()) { + if (i >= 0 && 0 < (args_.size() - i)) { idx_ = i; return true; } else diff --git a/src/mathed/math_macrotemplate.h b/src/mathed/math_macrotemplate.h index e000e0aa67..e30ef406e8 100644 --- a/src/mathed/math_macrotemplate.h +++ b/src/mathed/math_macrotemplate.h @@ -19,7 +19,7 @@ class MathMacro; /** This class contains the macro definition \author Alejandro Aguilar Sierra */ -class MathMacroTemplate : public MathParInset, public boost::noncopyable { +class MathMacroTemplate : public MathParInset, boost::noncopyable { public: friend class MathMacro; diff --git a/src/mathed/math_parser.C b/src/mathed/math_parser.C index f67700da4b..7f48842081 100644 --- a/src/mathed/math_parser.C +++ b/src/mathed/math_parser.C @@ -138,7 +138,7 @@ lexcode_enum lexcode[256]; #warning Replace with string #endif //char yytext[256]; -array yytext; +boost::array yytext; int yylineno; istream * yyis; bool yy_mtextmode= false;