]> git.lyx.org Git - features.git/commitdiff
fix dispatch calls as suggested by Herbert
authorJohn Levon <levon@movementarian.org>
Sat, 20 Jul 2002 17:27:03 +0000 (17:27 +0000)
committerJohn Levon <levon@movementarian.org>
Sat, 20 Jul 2002 17:27:03 +0000 (17:27 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4725 a592a061-630c-0410-9148-cb99ea01b6c8

src/ChangeLog
src/LaTeX.C
src/frontends/controllers/ChangeLog
src/frontends/controllers/ControlRef.C
src/frontends/xforms/ChangeLog
src/frontends/xforms/FormMathsDelim.C
src/frontends/xforms/FormMathsMatrix.C
src/frontends/xforms/XMiniBuffer.C
src/frontends/xforms/XMiniBuffer.h
src/lyxfunc.C
src/paragraph_pimpl.C

index 88a4cf7a931f65d9a75a3e8e98f1a69d836d9742..04558c167ed10d8969c8111eb57e314d3805f779 100644 (file)
@@ -1,3 +1,11 @@
+2002-07-20  John Levon  <moz@compsoc.man.ac.uk>
+
+       * paragraph_pimpl.C: constify 
+
+       * BufferView_pimpl.C:
+       * LaTeX.C:
+       * lyxfunc.C: fix dispatch in a nicer way
 2002-07-20  Jean-Marc Lasgouttes  <lasgouttes@freesurf.fr>
 
        * version.C.in: update lyx_docversion
index 664486e801187ce649ce55d8b12fc7cc34244a19..b1817790ea804cc5ebe76b4024d1f224577913ee 100644 (file)
@@ -197,8 +197,7 @@ int LaTeX::run(TeXErrors & terr, LyXFunc * lfun)
        if (lfun) {
                ostringstream str;
                str << _("LaTeX run number") << ' ' << count;
-               // check lyxstring string stream and gcc 3.1 before fixing
-               lfun->dispatch(LFUN_MESSAGE, string(str.str().c_str()));
+               lfun->dispatch(LFUN_MESSAGE, str.str().c_str(), false);
        }
 
        this->operator()();
@@ -234,7 +233,7 @@ int LaTeX::run(TeXErrors & terr, LyXFunc * lfun)
                // no checks for now
                lyxerr[Debug::LATEX] << "Running MakeIndex." << endl;
                if (lfun) {
-                       lfun->dispatch(LFUN_MESSAGE, string(_("Running MakeIndex.")));
+                       lfun->dispatch(LFUN_MESSAGE, _("Running MakeIndex."), false);
                }
 
                rerun = runMakeIndex(OnlyFilename(ChangeExtension(file, ".idx")));
@@ -249,7 +248,7 @@ int LaTeX::run(TeXErrors & terr, LyXFunc * lfun)
                // no checks for now
                lyxerr[Debug::LATEX] << "Running BibTeX." << endl;
                if (lfun) {
-                       lfun->dispatch(LFUN_MESSAGE, string(_("Running BibTeX.")));
+                       lfun->dispatch(LFUN_MESSAGE, _("Running BibTeX."), false);
                }
 
                updateBibtexDependencies(head, bibtex_info);
@@ -284,7 +283,7 @@ int LaTeX::run(TeXErrors & terr, LyXFunc * lfun)
                        ostringstream str;
                        str << _("LaTeX run number") << ' ' << count;
                        // check lyxstring string stream and gcc 3.1 before fixing
-                       lfun->dispatch(LFUN_MESSAGE, string(str.str().c_str()));
+                       lfun->dispatch(LFUN_MESSAGE, str.str().c_str(), false);
                }
 
                this->operator()();
@@ -314,7 +313,7 @@ int LaTeX::run(TeXErrors & terr, LyXFunc * lfun)
                // no checks for now
                lyxerr[Debug::LATEX] << "Running MakeIndex." << endl;
                if (lfun) {
-                       lfun->dispatch(LFUN_MESSAGE, string(_("Running MakeIndex.")));
+                       lfun->dispatch(LFUN_MESSAGE, _("Running MakeIndex."), false);
                }
 
                rerun = runMakeIndex(OnlyFilename(ChangeExtension(file, ".idx")));
@@ -340,8 +339,7 @@ int LaTeX::run(TeXErrors & terr, LyXFunc * lfun)
                if (lfun) {
                        ostringstream str;
                        str << _("LaTeX run number") << ' ' << count;
-                       // check lyxstring string stream and gcc 3.1 before fixing
-                       lfun->dispatch(LFUN_MESSAGE, string(str.str().c_str()));
+                       lfun->dispatch(LFUN_MESSAGE, str.str().c_str(), false);
                }
 
                this->operator()();
index 2b62ad73a076fa67e4eb30966e1d891fd9779708..2531e10007ea80ecb8380a9b8eddf6680b2a1edd 100644 (file)
@@ -1,3 +1,7 @@
+2002-07-20  John Levon  <moz@compsoc.man.ac.uk>
+
+       * ControlRef.C: fix dispatch call nicely
 2002-07-19  John Levon  <moz@compsoc.man.ac.uk>
 
        * Makefile.am:
index 6c0f6a604b41fae6aff6f55a668b272645e07f29..5e1ea07ef4bd7a597653e28b35e92b278aac287b 100644 (file)
@@ -44,14 +44,14 @@ vector<string> const ControlRef::getLabelList(string const & name) const
 
 void ControlRef::gotoRef(string const & ref) const
 {
-       lv_.getLyXFunc()->dispatch(LFUN_BOOKMARK_SAVE, string("0"));
+       lv_.getLyXFunc()->dispatch(LFUN_BOOKMARK_SAVE, "0", false);
        lv_.getLyXFunc()->dispatch(LFUN_REF_GOTO, ref);
 }
 
 
 void ControlRef::gotoBookmark() const
 {
-       lv_.getLyXFunc()->dispatch(LFUN_BOOKMARK_GOTO, string("0"));
+       lv_.getLyXFunc()->dispatch(LFUN_BOOKMARK_GOTO, "0", false);
 }
 
 
index f97cb60f12799a7dd5d46bfecaba4927270c3c25..2c93c21f51cf1f2499855fe0fa705f3fe825821f 100644 (file)
@@ -1,3 +1,8 @@
+2002-07-20  John Levon  <moz@compsoc.man.ac.uk>
+
+       * FormMathsDelim.C:
+       * FormMathsMatrix.C: fix dispatch calls nicely
 2002-07-20  Jean-Marc Lasgouttes  <lasgouttes@freesurf.fr>
 
        * Menubar_pimpl.C (add_toc): avoid crash when there is no document
index 6908337cd3b73b0ae4c30d9a36b9c2e63fb8a17c..1b5531f44d996a99f70e78a05886d034cf6797f9 100644 (file)
@@ -91,8 +91,7 @@ void FormMathsDelim::apply()
        ostringstream ost;
        ost << delim_values[left] << ' ' << delim_values[right];
 
-       // the unusual formulation here is necessary for lyxstring stringstream 
-       lv_->getLyXFunc()->dispatch(LFUN_MATH_DELIM, string(ost.str().c_str()));
+       lv_->getLyXFunc()->dispatch(LFUN_MATH_DELIM, ost.str().c_str(), false);
 }
 
 bool FormMathsDelim::input(FL_OBJECT *, long)
index 05c9b9246621fdd0924b8cfef31b78e43ae88ad5..6e2f650050dffb62ffe6bba42c14410fc6c0708f 100644 (file)
@@ -99,8 +99,7 @@ void FormMathsMatrix::apply()
        ostringstream ost;
        ost << nx << ' ' << ny << ' ' << c << ' ' << sh;
 
-       // remeber gcc 3.1 and lyxstring stringstream before "fixing"
-       lv_->getLyXFunc()->dispatch(LFUN_INSERT_MATRIX, string(ost.str().c_str()));
+       lv_->getLyXFunc()->dispatch(LFUN_INSERT_MATRIX, ost.str().c_str(), false);
 }
 
 bool FormMathsMatrix::input(FL_OBJECT * ob, long)
index e9e1f4f4dc1688b733c563e3f800c84b56660365..0cdfd349edd078694b10232e15ad13249d9b5d87 100644 (file)
@@ -39,12 +39,12 @@ using std::vector;
 XMiniBuffer::XMiniBuffer(XFormsView * v, ControlCommandBuffer & control,
        FL_Coord x, FL_Coord y, FL_Coord h, FL_Coord w)
        : controller_(control), view_(v),
-       info_suffix_shown_(false)
+       info_shown_(false)
 {
        input_obj_ = create_input_box(FL_NORMAL_INPUT, x, y, h, w);
-       suffix_timer_.reset(new Timeout(1500));
+       info_timer_.reset(new Timeout(1500));
        idle_timer_.reset(new Timeout(6000));
-       suffix_timer_->timeout.connect(boost::bind(&XMiniBuffer::suffix_timeout, this));
+       info_timer_->timeout.connect(boost::bind(&XMiniBuffer::info_timeout, this));
        idle_timer_->timeout.connect(boost::bind(&XMiniBuffer::idle_timeout, this));
        idle_timer_->start(); 
        messageMode();
@@ -68,12 +68,6 @@ XMiniBuffer::~XMiniBuffer()
 int XMiniBuffer::peek_event(FL_OBJECT * ob, int event,
                            int key, XEvent * /*xev*/)
 {
-#if 0
-       if (dropdown_->isVisible()) {
-               return dropdown_->peek(xev);
-       }
-#endif
-
        switch (event) {
        case FL_FOCUS:
                messageMode(false);
@@ -84,9 +78,9 @@ int XMiniBuffer::peek_event(FL_OBJECT * ob, int event,
        case FL_KEYBOARD:
        {
                string input;
-               if (info_suffix_shown_) {
-                       suffix_timer_->stop();
-                       suffix_timeout();
+               if (info_shown_) {
+                       info_timer_->stop();
+                       info_timeout();
                }
  
                char const * tmp = fl_get_input(ob);
@@ -100,7 +94,7 @@ int XMiniBuffer::peek_event(FL_OBJECT * ob, int event,
                {
                        string const h(controller_.historyDown());
                        if (h.empty()) {
-                               show_info_suffix(_("[End of history]"), input);
+                               show_info(_("[End of history]"), input, false);
                        } else {
                                set_input(h);
                        }
@@ -114,7 +108,7 @@ int XMiniBuffer::peek_event(FL_OBJECT * ob, int event,
                {
                        string const h(controller_.historyUp());
                        if (h.empty()) {
-                               show_info_suffix(_("[Beginning of history]"), input);
+                               show_info(_("[Beginning of history]"), input, false);
                        } else {
                                set_input(h);
                        }
@@ -128,13 +122,13 @@ int XMiniBuffer::peek_event(FL_OBJECT * ob, int event,
                        vector<string> comp = controller_.completions(input, new_input);
                         
                        if (comp.empty() && new_input == input) {
-                               show_info_suffix(_("[no match]"), input);
+                               show_info(_("[no match]"), input);
                                break;
                        }
 
                        if (comp.empty()) {
                                set_input(new_input);
-                               show_info_suffix(("[only completion]"), new_input + " ");
+                               show_info(("[only completion]"), new_input + " ");
                                break;
                        }
                                 
@@ -162,27 +156,9 @@ int XMiniBuffer::peek_event(FL_OBJECT * ob, int event,
                case XK_KP_Enter:
 #endif
                {
-#if 0
-                       // This will go in again in a little while
-                       // we need to be able to declare what types
-                       // of argumetns LFUN's should have first. (Lgb)
-                       // First check for match
-                       vector<string>::const_iterator cit =
-                               find(completion_.begin(),
-                                    completion_.end(),
-                                    input);
-                       if (cit == completion_.end()) {
-                               // no such func/item
-                               string const tmp = input + _(" [no match]");
-                               show_info_suffix(tmp, input);
-                       } else {
-#endif
                        messageMode();
                        redraw();
                        controller_.dispatch(input);
-# if 0
-                       }
-#endif
                        return 1;
                }
                default:
@@ -240,12 +216,15 @@ void XMiniBuffer::freeze()
 }
 
  
-void XMiniBuffer::show_info_suffix(string const & suffix, string const & input)
+void XMiniBuffer::show_info(string const & info, string const & input, bool append)
 {
        stored_input_ = input;
-       info_suffix_shown_ = true;
-       set_input(input + " " + suffix); 
-       suffix_timer_->start();
+       info_shown_ = true;
+       if (append)
+               set_input(input + " " + info);
+       else
+               set_input(info);
+       info_timer_->start();
 }
  
 
@@ -255,9 +234,9 @@ void XMiniBuffer::idle_timeout()
 }
 
  
-void XMiniBuffer::suffix_timeout()
+void XMiniBuffer::info_timeout()
 {
-       info_suffix_shown_ = false;
+       info_shown_ = false;
        set_input(stored_input_);
 }
 
index f48ada3a0c1f8273e9098c5fba3d802a91468e61..0388b6f5f448ed2f0fdf147d3becbd7835cc69de 100644 (file)
@@ -55,7 +55,7 @@ protected:
        bool isEditingMode() const;
 
        /// reset buffer to stored input text
-       void suffix_timeout();
+       void info_timeout();
 
        /// go back to "at rest" message
        void idle_timeout();
@@ -79,13 +79,13 @@ protected:
        void messageMode(bool on = true);
  
        /// show a temporary message whilst in edit mode
-       void show_info_suffix(string const & suffix, string const & input);
+       void show_info(string const & info, string const & input, bool append = true);
 
        /// the dropdown menu
        boost::scoped_ptr<DropDown> dropdown_;
 
-       /// info suffix timer
-       boost::scoped_ptr<Timeout> suffix_timer_;
+       /// info timer
+       boost::scoped_ptr<Timeout> info_timer_;
 
        /// idle timer
        boost::scoped_ptr<Timeout> idle_timer_;
@@ -102,11 +102,11 @@ protected:
        /// the lyx view
        XFormsView * view_;
 
-       /// stored input when showing suffix info
+       /// stored input when showing info
        string stored_input_;
 
-       /// are we showing an informational suffix of the mesage ?
-       bool info_suffix_shown_;
+       /// are we showing an informational temporary message ?
+       bool info_shown_;
 };
  
 #endif // XMINIBUFFER_H
index e658408d1a504dba75e68a064aa67682173d8b03..c4cc77737248fa7cc5403081bb9a6443accbf34f 100644 (file)
@@ -1363,10 +1363,10 @@ void LyXFunc::dispatch(kb_action action, string argument, bool verbose)
 
        // passthrough hat and underscore outside mathed:
        case LFUN_SUBSCRIPT:
-               dispatch(LFUN_SELFINSERT, string("_"));
+               dispatch(LFUN_SELFINSERT, "_", false);
                break;
        case LFUN_SUPERSCRIPT:
-               dispatch(LFUN_SELFINSERT, string("^"));
+               dispatch(LFUN_SELFINSERT, "^", false);
                break;
 
        case LFUN_MATH_PANEL:
index 0126b79e2ea3cb67a4e35dea46cce48bb7c43dc2..45c81b9736d70339de9676792d56b54d14e8df01 100644 (file)
@@ -55,7 +55,7 @@ special_phrase special_phrases[] = {
        { "LaTeX", "\\LaTeX{}", true },
 };
 
-size_t phrases_nr = sizeof(special_phrases)/sizeof(special_phrase);
+size_t const phrases_nr = sizeof(special_phrases)/sizeof(special_phrase);
 
 } // namespace anon