]> git.lyx.org Git - features.git/commitdiff
Dispatch->dispatch, some trans work
authorLars Gullik Bjønnes <larsbj@gullik.org>
Mon, 16 Jul 2001 15:42:57 +0000 (15:42 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Mon, 16 Jul 2001 15:42:57 +0000 (15:42 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2254 a592a061-630c-0410-9148-cb99ea01b6c8

30 files changed:
src/BufferView_pimpl.C
src/ChangeLog
src/LaTeX.C
src/frontends/controllers/ControlCommand.C
src/frontends/controllers/ControlRef.C
src/frontends/controllers/ControlTabularCreate.C
src/frontends/controllers/ControlToc.C
src/frontends/xforms/FormMathsDelim.C
src/frontends/xforms/FormMathsMatrix.C
src/frontends/xforms/FormMathsPanel.C
src/frontends/xforms/FormPreferences.C
src/frontends/xforms/Menubar_pimpl.C
src/frontends/xforms/Toolbar_pimpl.C
src/importer.C
src/insets/ChangeLog
src/insets/insetert.C
src/insets/insetparent.C
src/insets/insetref.C
src/insets/insettext.C
src/lyx_main.C
src/lyxfunc.C
src/lyxfunc.h
src/lyxserver.C
src/lyxvc.C
src/trans.C
src/trans.h
src/trans_decl.h
src/trans_mgr.C
src/trans_mgr.h
src/vc-backend.C

index 7fde8f3361a6b64a5400df941d9b50e23e45b690..45ec862af5433f26073b680f2fd869630097f006 100644 (file)
@@ -598,7 +598,7 @@ void BufferView::Pimpl::workAreaButtonPress(int xpos, int ypos,
        bool paste_internally = false;
        if (button == 2
            && bv_->text->selection.set()) {
-               owner_->getLyXFunc()->Dispatch(LFUN_COPY);
+               owner_->getLyXFunc()->dispatch(LFUN_COPY);
                paste_internally = true;
        }
        
@@ -644,9 +644,9 @@ void BufferView::Pimpl::workAreaButtonPress(int xpos, int ypos,
        // insert this
        if (button == 2) {
                if (paste_internally)
-                       owner_->getLyXFunc()->Dispatch(LFUN_PASTE);
+                       owner_->getLyXFunc()->dispatch(LFUN_PASTE);
                else
-                       owner_->getLyXFunc()->Dispatch(LFUN_PASTESELECTION,
+                       owner_->getLyXFunc()->dispatch(LFUN_PASTESELECTION,
                                                       "paragraph");
                selection_possible = false;
                return;
index eae98645e1eb51c2db625888152121281d3c5db9..6f975a09f36d3c5ff18a054030684991a6d30b77 100644 (file)
@@ -1,3 +1,7 @@
+2001-07-12  Lars Gullik Bjønnes  <larsbj@birdstep.com>
+
+       * lyxfunc.h: change more methods to begin with lower char.
+
 2001-07-16  Dekel Tsur  <dekelts@tau.ac.il>
 
        * buffer.C (parseSingleLyXformat2Token): Generate error insets
index 1b7c5bb16dd13d626c6169519ced52a98b0d00ba..5a83f1d9e44dd65aa8c552a6991f1063877de4cf 100644 (file)
@@ -177,7 +177,7 @@ int LaTeX::run(TeXErrors & terr, LyXFunc * lfun)
        if (lfun) {
                ostringstream str;
                str << _("LaTeX run number") << ' ' << count;
-               lfun->Dispatch(LFUN_MESSAGE, str.str().c_str());
+               lfun->dispatch(LFUN_MESSAGE, str.str().c_str());
        }
        
        
@@ -214,7 +214,7 @@ int LaTeX::run(TeXErrors & terr, LyXFunc * lfun)
        if (head.haschanged(OnlyFilename(ChangeExtension(file, ".idx")))) {
                // no checks for now
                lyxerr[Debug::LATEX] << "Running MakeIndex." << endl;
-               if (lfun) lfun->Dispatch(LFUN_MESSAGE, _("Running MakeIndex."));
+               if (lfun) lfun->dispatch(LFUN_MESSAGE, _("Running MakeIndex."));
 //             WriteStatus(minib, _("Running MakeIndex."));
                rerun = runMakeIndex(OnlyFilename(ChangeExtension(file, ".idx")));
        }
@@ -227,7 +227,7 @@ int LaTeX::run(TeXErrors & terr, LyXFunc * lfun)
                // tags is found -> run bibtex and set rerun = true;
                // no checks for now
                lyxerr[Debug::LATEX] << "Running BibTeX." << endl;
-               if (lfun) lfun->Dispatch(LFUN_MESSAGE, _("Running BibTeX."));
+               if (lfun) lfun->dispatch(LFUN_MESSAGE, _("Running BibTeX."));
                //WriteStatus(minib, _("Running BibTeX."));
                updateBibtexDependencies(head, bibtex_info);
                rerun |= runBibTeX(bibtex_info);
@@ -259,7 +259,7 @@ int LaTeX::run(TeXErrors & terr, LyXFunc * lfun)
                if (lfun) {
                        ostringstream str;
                        str << _("LaTeX run number") << ' ' << count;
-                       lfun->Dispatch(LFUN_MESSAGE, str.str().c_str());
+                       lfun->dispatch(LFUN_MESSAGE, str.str().c_str());
                }
                
 //             WriteStatus(minib,
@@ -290,7 +290,7 @@ int LaTeX::run(TeXErrors & terr, LyXFunc * lfun)
        if (head.haschanged(OnlyFilename(ChangeExtension(file, ".idx")))) {
                // no checks for now
                lyxerr[Debug::LATEX] << "Running MakeIndex." << endl;
-               if (lfun) lfun->Dispatch(LFUN_MESSAGE, _("Running MakeIndex."));
+               if (lfun) lfun->dispatch(LFUN_MESSAGE, _("Running MakeIndex."));
                //WriteStatus(minib, _("Running MakeIndex."));
                rerun = runMakeIndex(OnlyFilename(ChangeExtension(file, ".idx")));
        }
@@ -315,7 +315,7 @@ int LaTeX::run(TeXErrors & terr, LyXFunc * lfun)
                if (lfun) {
                        ostringstream str;
                        str << _("LaTeX run number") << ' ' << count;
-                       lfun->Dispatch(LFUN_MESSAGE, str.str().c_str());
+                       lfun->dispatch(LFUN_MESSAGE, str.str().c_str());
                }
                
 //             WriteStatus(minib, string(_("LaTeX run number ")) + tostr(count));
index e68a30065168647afa9d1c6b5eec15f259797bdd..9a81d08cc6d7f4dff15cc78542a0191af835801a 100644 (file)
@@ -56,6 +56,6 @@ void ControlCommand::applyParamsToInset()
 void ControlCommand::applyParamsNoInset()
 {
        if (action_ == LFUN_NOACTION) return;
-       lv_.getLyXFunc()->Dispatch(action_, params().getAsString());
+       lv_.getLyXFunc()->dispatch(action_, params().getAsString());
 }
 
index b909d5bb88d4560f4692c1bd13c3ba76e6dde7fc..c208a6dbdbbf7bdcaa00796ba57c056bc31315fc 100644 (file)
@@ -43,13 +43,13 @@ std::vector<string> const ControlRef::getLabelList() const
 
 void ControlRef::gotoRef(string const & ref) const
 {
-       lv_.getLyXFunc()->Dispatch(LFUN_BOOKMARK_SAVE, "0");
-       lv_.getLyXFunc()->Dispatch(LFUN_REF_GOTO, ref);
+       lv_.getLyXFunc()->dispatch(LFUN_BOOKMARK_SAVE, "0");
+       lv_.getLyXFunc()->dispatch(LFUN_REF_GOTO, ref);
 }
 
 
 void ControlRef::gotoBookmark() const
 {
-       lv_.getLyXFunc()->Dispatch(LFUN_BOOKMARK_GOTO, "0");
+       lv_.getLyXFunc()->dispatch(LFUN_BOOKMARK_GOTO, "0");
 }
 
index cad18eccde77d209f15a5e60e28ba7ac0bf5f6ea..fa55e9e6a1ab989e93031b0f41e05373cf778abd 100644 (file)
@@ -54,5 +54,5 @@ void ControlTabularCreate::apply()
 
        string const val(tostr(params().first) + " " + tostr(params().second)); 
  
-       lv_.getLyXFunc()->Dispatch(LFUN_INSET_TABULAR, val);
+       lv_.getLyXFunc()->dispatch(LFUN_INSET_TABULAR, val);
 }
index c4eae44f551b0e768aa0bc59610ffcc487964313..9498787396c0e7eb285e89d70b953ad3fe2bfec6 100644 (file)
@@ -42,7 +42,7 @@ ControlToc::ControlToc(LyXView & lv, Dialogs & d)
 void ControlToc::Goto(int const & id) const
 {
        string const tmp = tostr(id);
-       lv_.getLyXFunc()->Dispatch(LFUN_GOTO_PARAGRAPH, tmp);
+       lv_.getLyXFunc()->dispatch(LFUN_GOTO_PARAGRAPH, tmp);
 }
 
 
index 414fcb04da90dd4208e74325c1e7bbd535770aa1..27432b56d8f2c3393ba3e69db3400aeb8a9592f6 100644 (file)
@@ -86,7 +86,7 @@ void FormMathsDelim::apply()
        ostringstream ost;
        ost << delim_values[left] << ' ' << delim_values[right];
 
-       lv_->getLyXFunc()->Dispatch(LFUN_MATH_DELIM, ost.str().c_str());
+       lv_->getLyXFunc()->dispatch(LFUN_MATH_DELIM, ost.str().c_str());
 }
 
 bool FormMathsDelim::input(FL_OBJECT *, long)
index 2421d32674b3e7ee3fdb518f69e4cd26544eb191..6e5ec9d2868a6b4518048892fa787b77687e9796 100644 (file)
@@ -88,7 +88,7 @@ void FormMathsMatrix::apply()
        ostringstream ost;
        ost << nx << ' ' << ny << ' ' << c << sh;
  
-       lv_->getLyXFunc()->Dispatch(LFUN_INSERT_MATRIX, ost.str().c_str());
+       lv_->getLyXFunc()->dispatch(LFUN_INSERT_MATRIX, ost.str().c_str());
 }
 
 bool FormMathsMatrix::input(FL_OBJECT * ob, long)
index fffe677b2dfb5a85c24ded3304587bb3d68d7217..ef7a55cb9ca652940e5e6cbed44d43bd1dcae55e 100644 (file)
@@ -249,13 +249,13 @@ bool FormMathsPanel::input(FL_OBJECT *, long data)
 
 void FormMathsPanel::insertSymbol(string const & sym) const
 {
-       lv_->getLyXFunc()->Dispatch(LFUN_INSERT_MATH, sym);
+       lv_->getLyXFunc()->dispatch(LFUN_INSERT_MATH, sym);
 }
 
 
 void FormMathsPanel::mathDisplay() const
 {
-       lv_->getLyXFunc()->Dispatch(LFUN_MATH_DISPLAY);
+       lv_->getLyXFunc()->dispatch(LFUN_MATH_DISPLAY);
 }
 
 
index ea746e0d3833b3cf934700a17d243edcbc0375d2..0f2a087a5612a4966728cef78594fe75b62b62de 100644 (file)
@@ -158,7 +158,7 @@ void FormPreferences::ok()
                colors_.modifiedXformsPrefs = !XformsColor::write(filename);
        }
        
-       lv_->getLyXFunc()->Dispatch(LFUN_SAVEPREFERENCES);
+       lv_->getLyXFunc()->dispatch(LFUN_SAVEPREFERENCES);
 }
 
 
@@ -468,7 +468,7 @@ void FormPreferences::Colors::apply()
 
                        string const s = lcolor.getLyXName(lc) + string(" ") +
                                hexname;
-                       parent_.lv_->getLyXFunc()->Dispatch(LFUN_SET_COLOR, s);
+                       parent_.lv_->getLyXFunc()->dispatch(LFUN_SET_COLOR, s);
                }
        }
 }
@@ -778,7 +778,7 @@ void FormPreferences::Colors::LoadBrowserLyX()
 
                        string const arg = lcolor.getLyXName(lc) + " black";
                        parent_.lv_->getLyXFunc()->
-                               Dispatch(LFUN_SET_COLOR, arg);
+                               dispatch(LFUN_SET_COLOR, arg);
                        continue;
                }
 
@@ -2553,7 +2553,7 @@ void FormPreferences::ScreenFonts::apply() const
        if (changed) {
                // Now update the buffers
                // Can anything below here affect the redraw process?
-               parent_.lv_->getLyXFunc()->Dispatch(LFUN_SCREEN_FONT_UPDATE);
+               parent_.lv_->getLyXFunc()->dispatch(LFUN_SCREEN_FONT_UPDATE);
        }
 }
 
index 5fbcc6b7163de24475b69517a4fdb17a6809c06b..878b73f41d3bbd06f2df29e5ad8e31fa4d7358e9 100644 (file)
@@ -578,16 +578,15 @@ void Menubar::Pimpl::MenuCallback(FL_OBJECT * ob, long button)
                // If the action value is too low, then it is not a
                // valid action, but something else.
                if (choice >= action_offset + 1) {
-                       view->getLyXFunc()->Dispatch(choice - action_offset);
-               }
-               else {
+                       view->getLyXFunc()->dispatch(choice - action_offset);
+               } else {
                        lyxerr[Debug::GUI]
                                << "MenuCallback: ignoring bogus action "
                                << choice << endl;
                }
-       }
-       else 
+       } else {
                lyxerr << "Error in MenuCallback" << endl;
+       }
        
        std::for_each(submenus.begin(), submenus.end(), fl_freepup);
        // restore tabstop length
index fee4d5e1826dd70e09842be0c30381e3a440953a..833642632d783f85a0abf780d70bfe74bca450dd 100644 (file)
@@ -157,7 +157,7 @@ void Toolbar::Pimpl::layoutSelectedCB(int sel, void * arg, Combox *)
 void Toolbar::Pimpl::layoutSelected(int sel)
 {
        string const tmp = tostr(sel);
-       owner->getLyXFunc()->Dispatch(LFUN_LAYOUTNO, tmp);
+       owner->getLyXFunc()->dispatch(LFUN_LAYOUTNO, tmp);
 }
  
 
@@ -270,7 +270,7 @@ void ToolbarCB(FL_OBJECT * ob, long ac)
 {
        XFormsView * owner = static_cast<XFormsView *>(ob->u_vdata);
        
-       string res = owner->getLyXFunc()->Dispatch(int(ac));
+       string res = owner->getLyXFunc()->dispatch(int(ac));
        if (!res.empty())
                lyxerr[Debug::GUI] << "ToolbarCB: Function returned: " 
                                   << res << endl;
index 8b7193954714b8cdf0e17414fcc8646f8be44466..21310d7e02bf406c7342ddeafd7e6cc304c946d4 100644 (file)
@@ -78,7 +78,7 @@ bool Importer::Import(LyXView * lv, string const & filename,
                        : ChangeExtension(filename,
                                          formats.Extension(loader_format));
                InsertAsciiFile(lv->view(), filename2, as_paragraphs);
-               lv->getLyXFunc()->Dispatch(LFUN_MARK_OFF);
+               lv->getLyXFunc()->dispatch(LFUN_MARK_OFF);
        }
 
        // we are done
index 7b574e28502f3d1f3aca9b6aafa3a9b9f6964da2..cb8dbae101017888c10db45a0a54f8e34b5e302e 100644 (file)
@@ -1,3 +1,7 @@
+2001-07-16  Lars Gullik Bjønnes  <larsbj@birdstep.com>
+
+       * insetert.C (latex): write out all paragraphs.
+
 2001-07-17  Baruch Even  <baruch@lyx.org>
 
        * insetgraphics.C (draw): Removed unneeded casts.
index 2528a5a50d4a31660d4ec3227656405e77d14234..d81701590edd5b630c1cfead3e04dd75ee45d99e 100644 (file)
@@ -117,18 +117,23 @@ void InsetERT::edit(BufferView * bv, int x, int y, unsigned int button)
 int InsetERT::latex(Buffer const *, std::ostream & os, bool /*fragile*/,
                    bool /*free_spc*/) const
 {
-       Paragraph::size_type siz = inset.paragraph()->size();
-       for (Paragraph::size_type i = 0; i != siz; ++i) {
-               char c = inset.paragraph()->getChar(i);
-               switch (c) {
-               case Paragraph::META_NEWLINE:
-                       os << '\n';
-                       break;
-               default:
-                       os << c;
-                       break;
+       Paragraph * par = inset.paragraph();
+       while (par) {
+               Paragraph::size_type siz = inset.paragraph()->size();
+               for (Paragraph::size_type i = 0; i != siz; ++i) {
+                       char c = inset.paragraph()->getChar(i);
+                       switch (c) {
+                       case Paragraph::META_NEWLINE:
+                               os << '\n';
+                               break;
+                       default:
+                               os << c;
+                               break;
+                       }
                }
+               par = par->next();
        }
+       
        return 1;
 }
 
index d63c783a5e2c5c72b340bdd1a94c080268a7c51a..5df4a8d7eecf99ff261da3f92c1fb63a2db0c43b 100644 (file)
@@ -46,7 +46,7 @@ string const InsetParent::getScreenLabel() const
 void InsetParent::edit(BufferView * bv, int, int, unsigned int)
 {    
        bv->owner()->getLyXFunc()->
-               Dispatch(LFUN_CHILDOPEN, getContents());
+               dispatch(LFUN_CHILDOPEN, getContents());
 }
 
 
index 1e9cf3ceee90321112366168bf23a88dfaf1bbcb..4624c1d97bbd4906c8fc7c56cb39117daea5754b 100644 (file)
@@ -27,7 +27,7 @@ void InsetRef::edit(BufferView * bv, int, int, unsigned int button)
        // Eventually trigger dialog with button 3 not 1
        if (button == 3 )
                bv->owner()->getLyXFunc()->
-                       Dispatch(LFUN_REF_GOTO, getContents());
+                       dispatch(LFUN_REF_GOTO, getContents());
        else if (button == 1 )
                bv->owner()->getDialogs()->showRef( this );
 }
index 6d33d8496f2e8d250fb5e21357b8388143362423..bbb7aa4cf0528a314000a3e6381ea2cc9e448f38 100644 (file)
@@ -1120,7 +1120,7 @@ InsetText::localDispatch(BufferView * bv,
                        // see if we found the layout number:
                        if (!layout.first) {
                                string const msg = string(N_("Layout ")) + arg + N_(" not known");
-                               bv->owner()->getLyXFunc()->Dispatch(LFUN_MESSAGE, msg);
+                               bv->owner()->getLyXFunc()->dispatch(LFUN_MESSAGE, msg);
                                break;
                        }
 
index 3332523282335668f59dcf855fe008caa0d1952c..367911132c2fc604564ba71358426577d5a3a972 100644 (file)
@@ -169,7 +169,7 @@ LyX::LyX(int * argc, char * argv[])
 
                // otherwise, let the GUI handle the batch command
                lyxGUI->regBuf(last_loaded);
-               lyxGUI->getLyXView()->getLyXFunc()->Dispatch(batch_command);
+               lyxGUI->getLyXView()->getLyXFunc()->dispatch(batch_command);
 
                // fall through...
        }
index 6369647b40fb6b3397a86fa770c397a6b5f48666..9a6fbe629a1847622d0f6d76eb0509bd2af27e98 100644 (file)
@@ -344,7 +344,7 @@ void LyXFunc::processKeySym(KeySym keysym, unsigned int state)
        
         bool tmp_sc = show_sc;
        show_sc = false;
-       Dispatch(action, argument);
+       dispatch(action, argument);
        show_sc = tmp_sc;
        
        //return 0;
@@ -638,23 +638,23 @@ func_status::value_type LyXFunc::getStatus(int ac,
 void LyXFunc::miniDispatch(string const & s) 
 {
        if (!s.empty()) {
-               Dispatch(s);
+               dispatch(s);
        }
 }
 
 
-string const LyXFunc::Dispatch(string const & s) 
+string const LyXFunc::dispatch(string const & s) 
 {
        // Split command string into command and argument
        string cmd;
        string line = frontStrip(s);
        string const arg = strip(frontStrip(split(line, cmd, ' ')));
 
-       return Dispatch(lyxaction.LookupFunc(cmd), arg);
+       return dispatch(lyxaction.LookupFunc(cmd), arg);
 }
 
 
-string const LyXFunc::Dispatch(int ac,
+string const LyXFunc::dispatch(int ac,
                               string const & do_not_use_this_arg)
 {
        lyxerr[Debug::ACTION] << "LyXFunc::Dispatch: action[" << ac
@@ -897,7 +897,7 @@ string const LyXFunc::Dispatch(int ac,
                meta_fake_bit = 0;
                if (owner->view()->available())
                        // cancel any selection
-                       Dispatch(LFUN_MARK_OFF);
+                       dispatch(LFUN_MARK_OFF);
                setMessage(N_("Cancel"));
                break;
 
@@ -925,15 +925,15 @@ string const LyXFunc::Dispatch(int ac,
                
                // --- Menus -----------------------------------------------
        case LFUN_MENUNEW:
-               MenuNew(false);
+               menuNew(false);
                break;
                
        case LFUN_MENUNEWTMPLT:
-               MenuNew(true);
+               menuNew(true);
                break;
                
        case LFUN_CLOSEBUFFER:
-               CloseBuffer();
+               closeBuffer();
                break;
                
        case LFUN_MENUWRITE:
@@ -1182,7 +1182,7 @@ string const LyXFunc::Dispatch(int ac,
        break;
                        
        case LFUN_FILE_OPEN:
-               Open(argument);
+               open(argument);
                break;
 
        case LFUN_LATEX_LOG:
@@ -1202,7 +1202,7 @@ string const LyXFunc::Dispatch(int ac,
                --sel; // sel 1..., but layout 0...
 
                // Pretend we got the name instead.
-               Dispatch(int(LFUN_LAYOUT), 
+               dispatch(int(LFUN_LAYOUT), 
                         textclasslist.NameOfLayout(owner->view()
                                                    ->buffer()->params.textclass,
                                                    sel));
@@ -1422,7 +1422,7 @@ string const LyXFunc::Dispatch(int ac,
                        } else {
                                p.setContents( argument );
                        }
-                       Dispatch(LFUN_CITATION_INSERT, p.getAsString());
+                       dispatch(LFUN_CITATION_INSERT, p.getAsString());
                } else
                        owner->getDialogs()->createCitation( p.getAsString() );
        }
@@ -1469,7 +1469,7 @@ string const LyXFunc::Dispatch(int ac,
                while (argument.find(';') != string::npos) {
                        string first;
                        argument = split(argument, first, ';');
-                       Dispatch(first);
+                       dispatch(first);
                }
        }
        break;
@@ -1619,7 +1619,7 @@ void LyXFunc::setupLocalKeymap()
 }
 
 
-void LyXFunc::MenuNew(bool fromTemplate)
+void LyXFunc::menuNew(bool fromTemplate)
 {
        string initpath = lyxrc.document_path;
 
@@ -1745,7 +1745,7 @@ void LyXFunc::MenuNew(bool fromTemplate)
 }
 
 
-void LyXFunc::Open(string const & fname)
+void LyXFunc::open(string const & fname)
 {
        string initpath = lyxrc.document_path;
   
@@ -1906,7 +1906,7 @@ void LyXFunc::reloadBuffer()
 }
 
 
-void LyXFunc::CloseBuffer()
+void LyXFunc::closeBuffer()
 {
        if (bufferlist.close(owner->buffer()) && !quitting) {
                if (bufferlist.empty()) {
index 0572daf6bbf69ccbe00b510d52564979b26c1a29..735e2798fe77b4bc2b398225b30cf248ba45453d 100644 (file)
@@ -30,10 +30,10 @@ public:
        LyXFunc(LyXView *);
     
        /// LyX dispatcher, executes lyx actions.
-       string const Dispatch(int action, string const & arg = string());
+       string const dispatch(int action, string const & arg = string());
                         
        /// The same but uses the name of a lyx command.
-       string const Dispatch(string const & cmd);
+       string const dispatch(string const & cmd);
 
        ///
        void miniDispatch(string const & cmd);
@@ -109,16 +109,16 @@ private:
        // I think the following should be moved to BufferView. (Asger)
 
        ///
-       void MenuNew(bool fromTemplate);
+       void menuNew(bool fromTemplate);
 
        ///
-       void Open(string const &);
+       void open(string const &);
 
        ///
        void doImport(string const &);
 
        ///
-       void CloseBuffer();
+       void closeBuffer();
        ///
        void reloadBuffer();
        ///
index 86be56793a9769102876c760c95f450f337dd5cc..0d6662cd96371c358186f68fddffd025369e8ee5 100644 (file)
@@ -528,7 +528,7 @@ void LyXServer::callback(LyXServer * serv, string const & msg)
                        string rval, buf;
                    
                        if (action>= 0) {
-                               rval = serv->func->Dispatch(action, arg);
+                               rval = serv->func->dispatch(action, arg);
                        } else {
                                rval = "Unknown command";
                        }
index b1b94c6861facfb15374f4596d2e289b54d130dc..40dcf2547d6164aa2f95435f6f3e881dfb9d2ae6 100644 (file)
@@ -87,7 +87,7 @@ void LyXVC::registrer()
                        MakeDisplayPath(vcs->owner()->fileName(), 50),
                        _("Save document and proceed?"))) {
                vcs->owner()->getUser()->owner()
-                       ->getLyXFunc()->Dispatch(LFUN_MENUWRITE);
+                       ->getLyXFunc()->dispatch(LFUN_MENUWRITE);
        }
 
        // Maybe the save fails, or we answered "no". In both cases,
@@ -120,7 +120,7 @@ void LyXVC::checkIn()
                        MakeDisplayPath(vcs->owner()->fileName(), 50),
                        _("Save document and proceed?"))) {
                vcs->owner()->getUser()->owner()
-                       ->getLyXFunc()->Dispatch(LFUN_MENUWRITE);
+                       ->getLyXFunc()->dispatch(LFUN_MENUWRITE);
        }
 
        // Maybe the save fails, or we answered "no". In both cases,
index 29621b4ca6a645c9bb1085489fd89011d494416b..ff0fbf398674a693e0fda6ad3adc9766575e964c 100644 (file)
@@ -18,10 +18,13 @@ using std::endl;
 // KmodInfo
 KmodInfo::KmodInfo()
 {
+#if 0
        exception_list = 0;
+#endif
 }
 
 
+#if 0
 // Default Trans
 bool DefaultTrans::init_ = false;
 
@@ -49,14 +52,16 @@ string const DefaultTrans::process(char c, TransManager & k)
        return k.normalkey(c);
 }
 #endif
-
+#endif
 
 // Trans class
 
 Trans::Trans()
 {
+#if 0
        for (int i = 0; i < TEX_MAX_ACCENT + 1; ++i)
                kmod_list_[i] = 0;
+#endif
 }
 
 
@@ -66,9 +71,10 @@ Trans::~Trans()
 }
 
 
-void Trans::InsertException(Trans::keyexc & exclist, char c,
+void Trans::InsertException(KmodException & exclist, char c,
                            string const & data, bool flag, tex_accent accent)
 {
+#if 0
        keyexc p = new Keyexc; 
        p->next = exclist;
        p->c = c;
@@ -78,22 +84,37 @@ void Trans::InsertException(Trans::keyexc & exclist, char c,
        p->accent = accent;
 
        exclist = p;
+#else
+       Keyexc p;
+       p.c = c;
+       p.data = data;
+       p.combined = flag;
+       p.accent = accent;
+       exclist.insert(exclist.begin(), p);
+       // or just
+       // exclist.push_back(p);
+#endif
 }
 
 
-void Trans::FreeException(Trans::keyexc & exclist)
+void Trans::FreeException(KmodException & exclist)
 {
+#if 0
        Trans::keyexc p = exclist;
        while (p) {
                p = exclist->next;
                delete exclist;
                exclist = p;
        }
+#else
+       exclist.clear();
+#endif
 }
 
 
 void Trans::FreeKeymap()
 {
+#if 0
        for (int i = 0; i < 256; ++i)
                if (!keymap_[i].empty()) {
                        keymap_[i].erase();
@@ -104,6 +125,10 @@ void Trans::FreeKeymap()
                        delete kmod_list_[i];
                        kmod_list_[i] = 0;
                }
+#else
+       kmod_list_.clear();
+       keymap_.clear();
+#endif
 }
 
 
@@ -146,27 +171,29 @@ void Trans::AddDeadkey(tex_accent accent, string const & keys,
 void Trans::AddDeadkey(tex_accent accent, string const & keys)
 #endif
 {
+#if 0
        if (kmod_list_[accent]) {
                FreeException(kmod_list_[accent]->exception_list);
                
                delete kmod_list_[accent];
        }
        
-       kmod_list_[accent] = new kmod_list_decl;
+       kmod_list_[accent] = new KmodInfo;
        kmod_list_[accent]->data = keys;
        kmod_list_[accent]->accent = accent;
+#else
+       KmodInfo tmp;
+       tmp.data = keys;
+       tmp.accent = accent;
+       kmod_list_[accent] = tmp;
+#endif
 #if 0
        if (allowed == "native") { 
                kmod_list_[accent]->allowed= lyx_accent_table[accent].native;
        } else {
-#endif
-#if 0
                kmod_list_[accent]->allowed = allowed;
-#endif
-#if 0
        }
-#endif
-       
+
        for (string::size_type i = 0; i < keys.length(); ++i) {
                string & temp =
                        keymap_[static_cast<unsigned char>(keys[i])];
@@ -179,7 +206,17 @@ void Trans::AddDeadkey(tex_accent accent, string const & keys)
                temp += char(0);
                temp += char(accent);
        }
+#else
+       for (string::size_type i = 0; i < keys.length(); ++i) {
+               string tmp;
+               tmp += char(0);
+               tmp += char(accent);
+               keymap_[keys[i]] = tmp;
+       }
+#endif
+#if 0
        kmod_list_[accent]->exception_list = 0;
+#endif
 }
 
 
@@ -254,12 +291,24 @@ int Trans::Load(LyXLex & lex)
                        tex_accent accent_2= getkeymod(str);
                        if (accent_2 == TEX_NOACCENT) return -1;
 
+#if 0
                        if (kmod_list_[accent_1] == 0
                            || kmod_list_[accent_2] == 0)
                                return -1;
+#else
+                       std::map<int, KmodInfo>::iterator it1 =
+                               kmod_list_.find(accent_1);
+                       std::map<int, KmodInfo>::iterator it2 =
+                               kmod_list_.find(accent_2);
+                       if (it1 == kmod_list_.end()
+                           || it2 == kmod_list_.end()) {
+                               return -1;
+                       }
+#endif
 
                        // Find what key accent_2 is on - should
                        // check about accent_1 also
+#if 0
                        int key = 0;
                        for (; key < 256; ++key) {
                                if (!keymap_[key].empty()
@@ -276,9 +325,31 @@ int Trans::Load(LyXLex & lex)
                        } else
                                return -1;
 
-                       InsertException(kmod_list_[accent_1]->exception_list,
+                       InsertException(kmod_list_[accent_1].exception_list,
                                        static_cast<char>(key), allowed,
                                        true, accent_2);
+#else
+                       std::map<int, string>::iterator it = keymap_.begin();
+                       std::map<int, string>::iterator end = keymap_.end();
+                       for (; it != end; ++it) {
+                               if (!it->second.empty()
+                                   && it->second[0] == 0
+                                   && it->second[1] == accent_2)
+                                       break;
+                       }
+                       string allowed;
+                       if (lex.next()) {
+                               allowed = lex.GetString();
+                               lyxerr[Debug::KBMAP] << "allowed: "
+                                                    << allowed << endl;
+                       } else {
+                               return -1;
+                       }
+                       
+                       InsertException(kmod_list_[accent_1].exception_list,
+                                       static_cast<char>(it->first), allowed,
+                                       true, accent_2);
+#endif
                }
                break;
                case KMAP: {
@@ -296,9 +367,11 @@ int Trans::Load(LyXLex & lex)
 
                        if (lex.next(true)) {
                                string string_to = lex.text();
-                               //char * string_to =
-                               //      strcpy(new char[strlen(t)+1], t);
+#if 0
+                               keymap_[key_from] = string_to;
+#else
                                keymap_[key_from] = string_to;
+#endif
                                if (lyxerr.debugging(Debug::KBMAP))
                                        lyxerr << "\t`" << string_to << "'"
                                               << endl;
@@ -338,7 +411,7 @@ int Trans::Load(LyXLex & lex)
                        } else
                                return -1;
 
-                       InsertException(kmod_list_[accent]->exception_list,
+                       InsertException(kmod_list_[accent].exception_list,
                                        key, str);
                        break;
                }
@@ -357,11 +430,20 @@ int Trans::Load(LyXLex & lex)
 
 bool Trans::isAccentDefined(tex_accent accent, KmodInfo & i) const
 {
+#if 0
        if (kmod_list_[accent] != 0) {
                i = *kmod_list_[accent];
                return true;
        }
        return false;
+#else
+       std::map<int, KmodInfo>::const_iterator cit = kmod_list_.find(accent);
+       if (cit != kmod_list_.end()) {
+               i = cit->second;
+               return true;
+       }
+       return false;
+#endif
 }
 
 
@@ -390,10 +472,16 @@ string const Trans::process(char c, TransManager & k)
        if (t.empty() && c != 0) {
                return k.normalkey(c);
        } else if (!t.empty() && t[0] != char(0)) {
-               return k.normalkey(c);
+               //return k.normalkey(c);
+               return t;
        } else {
+#if 0
                return k.deadkey(c,
                                 *kmod_list_[static_cast<tex_accent>(t[1])]);
+#else
+               return k.deadkey(c,
+                                kmod_list_[static_cast<tex_accent>(t[1])]);
+#endif
        }
 }
 #endif
index bb896ee9a79880fb15a93b87bcd6f8770de58107..4b923e87e6e35289f9b986e4bef1dddb34955ef2 100644 (file)
@@ -6,6 +6,8 @@
 #pragma interface
 #endif
 
+#include <map>
+
 #include "tex-accent.h"
 #include "LString.h"
 #include "trans_decl.h"
@@ -14,6 +16,7 @@ class LyXLex;
 
 class TransManager;
 
+#if 0
 /**
   TransInterface: the interface that every translation class
   should obey too.
@@ -41,17 +44,18 @@ private:
        ///
        static bool init_;
 };
-
+#endif
 
 /**
   Trans: holds a .kmap file 
   */
-class Trans : public TransInterface {
+//class Trans : public TransInterface {
+class Trans {
 public:
        ///
        Trans();
        ///
-       virtual ~Trans();
+       ~Trans();
 
        ///
        int Load(string const & language);
@@ -65,10 +69,12 @@ public:
        bool isAccentDefined(tex_accent, KmodInfo &) const;
     
 private:
+#if 0
        ///
        typedef KmodInfo kmod_list_decl;
        ///
        typedef KmodException keyexc;
+#endif
 #if 0
        ///
        void AddDeadkey(tex_accent, string const &, string const &);
@@ -83,26 +89,44 @@ private:
        ///
        inline string const & Match(unsigned char c);
        ///
-       void InsertException(keyexc & exclist, char c,
+       void InsertException(KmodException & exclist, char c,
                             string const & data, bool = false,
                             tex_accent = TEX_NOACCENT);
        ///
-       void FreeException(keyexc & exclist);
+       void FreeException(KmodException & exclist);
 
        ///
        string name_;
+#if 0
        ///
        string keymap_[256];
+#else
+       std::map<int, string> keymap_;
+#endif
+#if 0
        ///
        kmod_list_decl * kmod_list_[TEX_MAX_ACCENT+1];
-
+#else
+       ///
+       //KmodInfo * kmod_list_[TEX_MAX_ACCENT+1];
+       std::map<int, KmodInfo> kmod_list_;
+#endif
 };
 
 
 ///
 string const & Trans::Match(unsigned char c)
 {
+#if 0
        return keymap_[c];
+#else
+       std::map<int, string>::iterator it = keymap_.find(c);
+       if (it != keymap_.end()) {
+               return it->second;
+       }
+       static string dummy;
+       return dummy;
+#endif
 }
 
 #endif 
index d26f05cecfdf58571b30d067b5fd05900187a5d6..71ab9d5d59689ed013ac5a812b1a630484367665 100644 (file)
@@ -2,6 +2,8 @@
 #ifndef Trans_Decl_h
 #define Trans_Decl_h
 
+#include <list>
+
 #include "LString.h"
 #include "tex-accent.h"
 
@@ -11,16 +13,23 @@ struct Keyexc {
        char c;
        /// exception data
        string data;
+#if 0
        ///
        Keyexc * next;
+#endif
        /// Combination with another deadkey
        bool combined;
        /// The accent comined with
        tex_accent accent;
 };
 
+#if 0
 ///
 typedef Keyexc * KmodException;
+#else
+///
+typedef std::list<Keyexc> KmodException;
+#endif
 
 ///
 struct KmodInfo {
index f158438e6d6536b463c341cf7491e92d6b9bf1f5..3c5a6904d93011bebd40a32042d3eb7a9009fafd 100644 (file)
@@ -30,7 +30,9 @@ TransFSMData::TransFSMData()
 {
        deadkey_ = deadkey2_ = 0;
        deadkey_info_.accent = deadkey2_info_.accent = TEX_NOACCENT;
+#if 0
        comb_info_ = 0;
+#endif
 }
 
 
@@ -112,6 +114,7 @@ string const TransDeadkeyState::normalkey(char c, string const & trans)
 #else
 string const TransDeadkeyState::normalkey(char c)
 {
+#if 0
        string res;
        
        // Check if it is an exception
@@ -128,6 +131,24 @@ string const TransDeadkeyState::normalkey(char c)
        }
        currentState = init_state_;
        return res;
+#else
+       string res;
+       
+       KmodException::iterator it = deadkey_info_.exception_list.begin();
+       KmodException::iterator end = deadkey_info_.exception_list.end();
+
+       for (; it != end; ++it) {
+               if (it->c == c) {
+                       res = it->data;
+                       break;
+               }
+       }
+       if (it == end) {
+               res = DoAccent(c, deadkey_info_.accent);
+       }
+       currentState = init_state_;
+       return res;
+#endif
 }
 #endif
 
@@ -146,6 +167,7 @@ string const TransDeadkeyState::deadkey(char c, KmodInfo d)
        }
        
        // Check if it is a combination or an exception
+#if 0
        KmodException l;
        l = deadkey_info_.exception_list;
        
@@ -166,7 +188,26 @@ string const TransDeadkeyState::deadkey(char c, KmodInfo d)
                }
                l = l->next;
        }
-       
+#else
+       KmodException::const_iterator cit = deadkey_info_.exception_list.begin();
+       KmodException::const_iterator end = deadkey_info_.exception_list.end();
+       for (; cit != end; ++cit) {
+               if (cit->combined == true && cit->accent == d.accent) {
+                       deadkey2_ = c;
+                       deadkey2_info_ = d;
+                       comb_info_ = (*cit);
+                       currentState = combined_state_;
+                       return string();
+               }
+               if (cit->c == c) {
+                       res = cit->data;
+                       deadkey_ = 0;
+                       deadkey_info_.accent = TEX_NOACCENT;
+                       currentState = init_state_;
+                       return res;
+               }
+       }
+#endif
        // Not a combination or an exception. 
        // Output deadkey1 and keep deadkey2
        
@@ -359,13 +400,15 @@ void TransManager::insert(string const & str, LyXText * text)
                // Could not find an encoding
                InsetLatexAccent ins(str);
                if (ins.canDisplay()) {
-                       text->insertInset(current_view, new InsetLatexAccent(ins));
+                       text->insertInset(current_view,
+                                         new InsetLatexAccent(ins));
                } else {
                        insertVerbatim(str, text);
                }
                return;
        }
-       string tmp; tmp += static_cast<char>(enc.second);
+       string tmp;
+       tmp += static_cast<char>(enc.second);
        insertVerbatim(tmp, text);
 }
 
@@ -391,8 +434,9 @@ void TransManager::deadkey(char c, tex_accent accent, LyXText * t)
                i.allowed = lyx_accent_table[accent].native;
 #endif
                i.data.erase();
+#if 0
                i.exception_list = 0;
-               
+#endif 
                string res = trans_fsm_.currentState->deadkey(c, i);
                insert(res, t);
        } else {
index 2145f6a5df839fa3454529e822abe5743cfec860..7b7e812c328baf60eabdbacafacd89ed0fcd40fb 100644 (file)
@@ -48,8 +48,13 @@ protected:
        char deadkey2_;
        ///
        KmodInfo deadkey2_info_;
+#if 0
        ///
        KmodException comb_info_;
+#else
+       ///
+       Keyexc comb_info_;
+#endif
        ///
        TransState * init_state_;
        ///
index d903a232d95f25e3c7664de3347130b33d5a4c0a..b624f72fbdfc17930f010b861ef3feb07846c98e 100644 (file)
@@ -147,7 +147,7 @@ void RCS::registrer(string const & msg)
        cmd += OnlyFilename(owner_->fileName());
        cmd += "\"";
        doVCCommand(cmd, owner_->filepath);
-       owner_->getUser()->owner()->getLyXFunc()->Dispatch("buffer-reload");
+       owner_->getUser()->owner()->getLyXFunc()->dispatch("buffer-reload");
 }
 
 
@@ -155,7 +155,7 @@ void RCS::checkIn(string const & msg)
 {
        doVCCommand("ci -q -u -m\"" + msg + "\" \""
                    + OnlyFilename(owner_->fileName()) + "\"", owner_->filepath);
-       owner_->getUser()->owner()->getLyXFunc()->Dispatch("buffer-reload");
+       owner_->getUser()->owner()->getLyXFunc()->dispatch("buffer-reload");
 }
 
 
@@ -164,7 +164,7 @@ void RCS::checkOut()
        owner_->markLyxClean();
        doVCCommand("co -q -l \""
                    + OnlyFilename(owner_->fileName()) + "\"", owner_->filepath);
-       owner_->getUser()->owner()->getLyXFunc()->Dispatch("buffer-reload");
+       owner_->getUser()->owner()->getLyXFunc()->dispatch("buffer-reload");
 }
 
 
@@ -175,7 +175,7 @@ void RCS::revert()
        // We ignore changes and just reload!
        owner_->markLyxClean();
        owner_->getUser()->owner()
-               ->getLyXFunc()->Dispatch("buffer-reload");
+               ->getLyXFunc()->dispatch("buffer-reload");
 }
 
 
@@ -277,7 +277,7 @@ void CVS::registrer(string const & msg)
 {
        doVCCommand("cvs -q add -m \"" + msg + "\" \""
                    + OnlyFilename(owner_->fileName()) + "\"", owner_->filepath);
-       owner_->getUser()->owner()->getLyXFunc()->Dispatch("buffer-reload");
+       owner_->getUser()->owner()->getLyXFunc()->dispatch("buffer-reload");
 }
 
 
@@ -286,7 +286,7 @@ void CVS::checkIn(string const & msg)
        doVCCommand("cvs -q commit -m \"" + msg + "\" \""
                    + OnlyFilename(owner_->fileName()) + "\"",
                    owner_->filepath);
-       owner_->getUser()->owner()->getLyXFunc()->Dispatch("buffer-reload");
+       owner_->getUser()->owner()->getLyXFunc()->dispatch("buffer-reload");
 }
 
 
@@ -307,7 +307,7 @@ void CVS::revert()
                    owner_->filepath);
        owner_->markLyxClean();
        owner_->getUser()->owner()
-               ->getLyXFunc()->Dispatch("buffer-reload");
+               ->getLyXFunc()->dispatch("buffer-reload");
 }