]> git.lyx.org Git - features.git/commitdiff
fiix FIXMEs by moving message() from FuncRequest to the cursor
authorAndré Pönitz <poenitz@gmx.net>
Tue, 3 Feb 2004 11:49:05 +0000 (11:49 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Tue, 3 Feb 2004 11:49:05 +0000 (11:49 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8390 a592a061-630c-0410-9148-cb99ea01b6c8

src/BufferView_pimpl.C
src/cursor.C
src/cursor.h
src/funcrequest.C
src/funcrequest.h
src/text3.C

index 29d9d1ac19a9bd2f65d7057d3cefc540cf66b68a..29fcc5391dbc36ee7299943f288d9324d19627ea 100644 (file)
@@ -1184,7 +1184,7 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & cmd)
                cur.clearSelection();
                bv_->update();
                cur.resetAnchor();
-               cmd.message(N_("Mark off"));
+               cur.message(N_("Mark off"));
                break;
 
        case LFUN_MARK_ON:
@@ -1192,23 +1192,23 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & cmd)
                cur.mark() = true;
                bv_->update();
                cur.resetAnchor();
-               cmd.message(N_("Mark on"));
+               cur.message(N_("Mark on"));
                break;
 
        case LFUN_SETMARK:
                cur.clearSelection();
                if (cur.mark()) {
-                       cmd.message(N_("Mark removed"));
+                       cur.message(N_("Mark removed"));
                } else {
                        cur.mark() = true;
-                       cmd.message(N_("Mark set"));
+                       cur.message(N_("Mark set"));
                }
                cur.resetAnchor();
                bv_->update();
                break;
 
        case LFUN_UNKNOWN_ACTION:
-               cmd.errorMessage(N_("Unknown function!"));
+               cur.errorMessage(N_("Unknown function!"));
                break;
 
        default:
index 0722215073d2200be904fb7653098db50cdd3776..854886481bdc481dd8f368ec4520d763f2f0b084 100644 (file)
 #include "funcrequest.h"
 #include "iterators.h"
 #include "lfuns.h"
+#include "lyxfunc.h" // only for setMessage()
 #include "lyxrc.h"
-#include "lyxtext.h"
 #include "lyxrow.h"
+#include "lyxtext.h"
 #include "paragraph.h"
 
 #include "insets/updatableinset.h"
@@ -34,6 +35,7 @@
 #include "mathed/math_support.h"
 
 #include "support/limited_stack.h"
+#include "frontends/LyXView.h"
 
 #include <boost/assert.hpp>
 
@@ -574,9 +576,8 @@ void LCursor::info(std::ostream & os)
                cursor_[i].inset()->infoize(os);
                os << "  ";
        }
-#warning FIXME
-       //if (pos() != 0)
-       //      prevAtom()->infoize2(os);
+       if (pos() != 0)
+               prevInset()->infoize2(os);
        // overwite old message
        os << "                    ";
 }
@@ -1831,3 +1832,14 @@ InsetBase * LCursor::prevInset()
        return par.isInset(pos() - 1) ? par.getInset(pos() - 1) : 0;
 }
 
+
+void LCursor::message(string const & msg) const
+{
+       bv().owner()->getLyXFunc().setMessage(msg);
+}
+
+
+void LCursor::errorMessage(string const & msg) const
+{
+       bv().owner()->getLyXFunc().setErrorMessage(msg);
+}
index 0d316b2fac98667e6bdc4f9976207b7ab99395b3..c4003b3fc68a3ee5351229e42d74422168d9e029 100644 (file)
@@ -401,9 +401,14 @@ public:
        void handleFont(std::string const & font);
 
        void releaseMathCursor();
-
+       /// are we in mathed?
        bool inMathed() const;
 
+       /// display a message
+       void message(std::string const & msg) const;
+       /// display an error message
+       void errorMessage(std::string const & msg) const;
+
 private:
        /// moves cursor index one cell to the left
        bool idxLeft();
index 8dfd9f6d792f3e10cdf3a6906fa822824f97a297..c3b0c2d4bcf7d6e91b0d8d5484674cb610048f4f 100644 (file)
 #include <config.h>
 
 #include "funcrequest.h"
-#include "BufferView.h"
-#include "lyxfunc.h" // only for setMessage()
-#include "frontends/LyXView.h"
-#include "debug.h"
+
 #include "support/std_sstream.h"
 
 #include <iostream>
+#include <vector>
 
-using std::endl;
 using std::getline;
 
 using std::istringstream;
@@ -59,26 +56,6 @@ mouse_button::state FuncRequest::button() const
 }
 
 
-void FuncRequest::message(string const & msg) const
-{
-#warning FIXME
-       //if (view_)
-       //      view_->owner()->getLyXFunc().setMessage(msg);
-       //else
-       lyxerr  << "Dropping message '" << msg << "'" << endl;
-}
-
-
-void FuncRequest::errorMessage(string const & msg) const
-{
-#warning FIXME
-       //if (view_)
-       //      view_->owner()->getLyXFunc().setErrorMessage(msg);
-       //else
-       lyxerr  << "Dropping error message '" << msg << "'" << endl;
-}
-
-
 void split(vector<string> & args, string str)
 {
        istringstream is(str);
index 8224d29460e857cdc41e92648cec43c2f0ad9fb2..d38ed13bfc04bcde45730507352ea4cbb399efcb 100644 (file)
@@ -18,6 +18,7 @@
 #include <string>
 #include <iosfwd>
 
+
 /**
  * This class encapsulates a LyX action and its argument
  * in order to pass it around easily.
@@ -38,11 +39,6 @@ public:
        /// access to button
        mouse_button::state button() const;
 
-       /// output a message
-       void message(std::string const & msg) const;
-       /// output an error message
-       void errorMessage(std::string const & msg) const;
-
        /// argument parsing, extract argument i as std::string
        std::string getArg(unsigned int i) const;
 
index a5432ea4e0775f3e74a9c077b425564db15f5ed4..7e3e694dcdf1838a00efe90fcb55173f7b3bb6a8 100644 (file)
@@ -935,7 +935,7 @@ DispatchResult LyXText::dispatch(LCursor & cur, FuncRequest const & cmd)
                break;
 
        case LFUN_PASTE:
-               cmd.message(_("Paste"));
+               cur.message(_("Paste"));
                replaceSelection(bv->getLyXText());
 #warning FIXME Check if the arg is in the domain of available selections.
                if (isStrUnsignedInt(cmd.argument))
@@ -950,13 +950,13 @@ DispatchResult LyXText::dispatch(LCursor & cur, FuncRequest const & cmd)
 
        case LFUN_CUT:
                cutSelection(true, true);
-               cmd.message(_("Cut"));
+               cur.message(_("Cut"));
                bv->update();
                break;
 
        case LFUN_COPY:
                copySelection();
-               cmd.message(_("Copy"));
+               cur.message(_("Copy"));
                break;
 
        case LFUN_BEGINNINGBUFSEL:
@@ -978,7 +978,7 @@ DispatchResult LyXText::dispatch(LCursor & cur, FuncRequest const & cmd)
                break;
 
        case LFUN_GETXY:
-               cmd.message(tostr(cursorX(cur.current())) + ' '
+               cur.message(tostr(cursorX(cur.current())) + ' '
                          + tostr(cursorY(cur.current())));
                break;
 
@@ -997,15 +997,15 @@ DispatchResult LyXText::dispatch(LCursor & cur, FuncRequest const & cmd)
 
        case LFUN_GETFONT:
                if (current_font.shape() == LyXFont::ITALIC_SHAPE)
-                       cmd.message("E");
+                       cur.message("E");
                else if (current_font.shape() == LyXFont::SMALLCAPS_SHAPE)
-                       cmd.message("N");
+                       cur.message("N");
                else
-                       cmd.message("0");
+                       cur.message("0");
                break;
 
        case LFUN_GETLAYOUT:
-               cmd.message(cursorPar()->layout()->name());
+               cur.message(cursorPar()->layout()->name());
                break;
 
        case LFUN_LAYOUT: {
@@ -1018,7 +1018,7 @@ DispatchResult LyXText::dispatch(LCursor & cur, FuncRequest const & cmd)
                // function list/array with information about what
                // functions needs arguments and their type.
                if (cmd.argument.empty()) {
-                       cmd.errorMessage(_("LyX function 'layout' needs an argument."));
+                       cur.errorMessage(_("LyX function 'layout' needs an argument."));
                        break;
                }
 
@@ -1036,7 +1036,7 @@ DispatchResult LyXText::dispatch(LCursor & cur, FuncRequest const & cmd)
                }
 
                if (!hasLayout) {
-                       cmd.errorMessage(string(N_("Layout ")) + cmd.argument +
+                       cur.errorMessage(string(N_("Layout ")) + cmd.argument +
                                N_(" not known"));
                        break;
                }