From 52153a589b4224d794de4f61f3f55b8d8832186f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20Gullik=20Bj=C3=B8nnes?= Date: Fri, 4 May 2001 10:36:36 +0000 Subject: [PATCH] floatlist work + handle lyxfuncs with args. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1984 a592a061-630c-0410-9148-cb99ea01b6c8 --- lib/ChangeLog | 4 + lib/ui/default.ui | 11 +-- po/POTFILES.in | 61 ++++++------ src/BufferView_pimpl.C | 24 +++-- src/ChangeLog | 31 ++++++ src/Floating.C | 2 +- src/Floating.h | 2 +- src/LyXAction.C | 13 +-- src/MenuBackend.C | 94 ++++++++++++++---- src/MenuBackend.h | 8 +- src/ToolbarDefaults.C | 3 - src/buffer.C | 131 +++++++++++++------------ src/commandtags.h | 7 +- src/frontends/controllers/ChangeLog | 4 + src/frontends/controllers/ControlToc.C | 13 +-- src/frontends/controllers/ControlToc.h | 3 +- src/frontends/xforms/ChangeLog | 6 ++ src/frontends/xforms/FormToc.h | 2 +- src/frontends/xforms/Menubar_pimpl.C | 126 +++++++----------------- src/importer.C | 2 + src/insets/ChangeLog | 13 +++ src/insets/Makefile.am | 2 + src/insets/insetbutton.C | 35 ++++--- src/insets/insetfloatlist.C | 115 ++++++++++++++++++++++ src/insets/insetfloatlist.h | 60 +++++++++++ src/insets/insettoc.C | 45 +-------- src/insets/lyxinset.h | 36 +++---- src/lyxfunc.C | 13 +-- src/minibuffer.C | 7 ++ 29 files changed, 537 insertions(+), 336 deletions(-) create mode 100644 src/insets/insetfloatlist.C create mode 100644 src/insets/insetfloatlist.h diff --git a/lib/ChangeLog b/lib/ChangeLog index 7d0d90ebb3..103b8db92e 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,7 @@ +2001-05-04 Lars Gullik Bjønnes + + * ui/default.ui: add FloatInsert and FloatListInsert + 2001-04-18 Jean-Marc Lasgouttes * examples/eu_splash.lyx: update from Dooteo diff --git a/lib/ui/default.ui b/lib/ui/default.ui index 915b41a0b0..50f812e94c 100644 --- a/lib/ui/default.ui +++ b/lib/ui/default.ui @@ -201,19 +201,12 @@ Menuset End Menu "insert_floats" - Item "Figure|F" "float-insert figure" - Item "Table|T" "float-insert table" - Item "Wide Figure|W" "float-insert wide-fig" - Item "Wide Table|d" "float-insert wide-tab" - Separator - Item "Algorithm|A" "float-insert algorithm" + FloatInsert End Menu "insert_toc" Item "Table of Contents|C" "toc-insert" - Item "List of Figures|F" "lof-insert" - Item "List of Tables|T" "lot-insert" - Item "List of Algorithms|A" "loa-insert" + FloatListInsert Item "Index List|I" "index-print" Item "BibTeX Reference...|B" "bibtex-insert" End diff --git a/po/POTFILES.in b/po/POTFILES.in index f94c783564..04b1702eba 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -10,8 +10,8 @@ src/CutAndPaste.C src/debug.C src/exporter.C src/ext_l10n.h -src/figureForm.C src/figure_form.C +src/figureForm.C src/FontLoader.C src/frontends/controllers/ButtonController.h src/frontends/controllers/character.C @@ -90,67 +90,67 @@ src/frontends/qt2/paragraphdlgimpl.C src/frontends/qt2/tabularcreatedlgimpl.C src/frontends/xforms/combox.C src/frontends/xforms/FileDialog.C -src/frontends/xforms/FormBibitem.C src/frontends/xforms/form_bibitem.C -src/frontends/xforms/FormBibtex.C +src/frontends/xforms/FormBibitem.C src/frontends/xforms/form_bibtex.C +src/frontends/xforms/FormBibtex.C src/frontends/xforms/form_browser.C -src/frontends/xforms/FormCharacter.C src/frontends/xforms/form_character.C -src/frontends/xforms/FormCitation.C +src/frontends/xforms/FormCharacter.C src/frontends/xforms/form_citation.C -src/frontends/xforms/FormCopyright.C +src/frontends/xforms/FormCitation.C src/frontends/xforms/form_copyright.C -src/frontends/xforms/FormCredits.C +src/frontends/xforms/FormCopyright.C src/frontends/xforms/form_credits.C -src/frontends/xforms/FormDocument.C +src/frontends/xforms/FormCredits.C src/frontends/xforms/form_document.C -src/frontends/xforms/FormError.C +src/frontends/xforms/FormDocument.C src/frontends/xforms/form_error.C -src/frontends/xforms/FormExternal.C +src/frontends/xforms/FormError.C src/frontends/xforms/form_external.C -src/frontends/xforms/FormFiledialog.C +src/frontends/xforms/FormExternal.C src/frontends/xforms/form_filedialog.C -src/frontends/xforms/FormGraphics.C +src/frontends/xforms/FormFiledialog.C src/frontends/xforms/form_graphics.C -src/frontends/xforms/FormInclude.C +src/frontends/xforms/FormGraphics.C src/frontends/xforms/form_include.C -src/frontends/xforms/FormIndex.C +src/frontends/xforms/FormInclude.C src/frontends/xforms/form_index.C +src/frontends/xforms/FormIndex.C src/frontends/xforms/FormLog.C src/frontends/xforms/FormMathsBitmap.C -src/frontends/xforms/FormMathsDeco.C src/frontends/xforms/form_maths_deco.C -src/frontends/xforms/FormMathsDelim.C +src/frontends/xforms/FormMathsDeco.C src/frontends/xforms/form_maths_delim.C -src/frontends/xforms/FormMathsMatrix.C +src/frontends/xforms/FormMathsDelim.C src/frontends/xforms/form_maths_matrix.C -src/frontends/xforms/FormMathsPanel.C +src/frontends/xforms/FormMathsMatrix.C src/frontends/xforms/form_maths_panel.C -src/frontends/xforms/FormMathsSpace.C +src/frontends/xforms/FormMathsPanel.C src/frontends/xforms/form_maths_space.C -src/frontends/xforms/FormMinipage.C +src/frontends/xforms/FormMathsSpace.C src/frontends/xforms/form_minipage.C -src/frontends/xforms/FormParagraph.C +src/frontends/xforms/FormMinipage.C src/frontends/xforms/form_paragraph.C -src/frontends/xforms/FormPreamble.C +src/frontends/xforms/FormParagraph.C src/frontends/xforms/form_preamble.C -src/frontends/xforms/FormPreferences.C +src/frontends/xforms/FormPreamble.C src/frontends/xforms/form_preferences.C -src/frontends/xforms/FormPrint.C +src/frontends/xforms/FormPreferences.C src/frontends/xforms/form_print.C -src/frontends/xforms/FormRef.C +src/frontends/xforms/FormPrint.C src/frontends/xforms/form_ref.C -src/frontends/xforms/FormSearch.C +src/frontends/xforms/FormRef.C src/frontends/xforms/form_search.C -src/frontends/xforms/FormTabular.C +src/frontends/xforms/FormSearch.C src/frontends/xforms/form_tabular.C -src/frontends/xforms/FormTabularCreate.C +src/frontends/xforms/FormTabular.C src/frontends/xforms/form_tabular_create.C -src/frontends/xforms/FormToc.C +src/frontends/xforms/FormTabularCreate.C src/frontends/xforms/form_toc.C -src/frontends/xforms/FormUrl.C +src/frontends/xforms/FormToc.C src/frontends/xforms/form_url.C +src/frontends/xforms/FormUrl.C src/frontends/xforms/FormVCLog.C src/frontends/xforms/input_validators.C src/frontends/xforms/Menubar_pimpl.C @@ -166,6 +166,7 @@ src/insets/inseterror.C src/insets/insetert.C src/insets/insetexternal.C src/insets/insetfloat.C +src/insets/insetfloatlist.C src/insets/insetfoot.C src/insets/insetgraphics.C src/insets/insetinclude.C diff --git a/src/BufferView_pimpl.C b/src/BufferView_pimpl.C index 017cd95f06..508fa79aa6 100644 --- a/src/BufferView_pimpl.C +++ b/src/BufferView_pimpl.C @@ -53,6 +53,7 @@ #include "insets/insettabular.h" #include "insets/insettheorem.h" #include "insets/insetcaption.h" +#include "insets/insetfloatlist.h" #include "mathed/formulamacro.h" #include "gettext.h" @@ -1428,21 +1429,9 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) break; case LFUN_TOC_INSERT: - case LFUN_LOA_INSERT: - case LFUN_LOF_INSERT: - case LFUN_LOT_INSERT: { InsetCommandParams p; - - if (action == LFUN_TOC_INSERT ) - p.setCmdName("tableofcontents"); - else if (action == LFUN_LOA_INSERT ) - p.setCmdName("listof{algorithm}{List of Algorithms}"); - else if (action == LFUN_LOF_INSERT ) - p.setCmdName("listoffigures"); - else - p.setCmdName("listoftables"); - + p.setCmdName("tableofcontents"); Inset * inset = new InsetTOC(p); if (!bv_->insertInset(inset, "Standard", true)) delete inset; @@ -2868,6 +2857,15 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) } break; + case LFUN_FLOAT_LIST: + { + // We should check the argument for validity. (Lgb) + Inset * inset = new InsetFloatList(argument); + if (!bv_->insertInset(inset, "Standard", true)) + delete inset; + } + break; + case LFUN_INSERT_NOTE: bv_->insertNote(); break; diff --git a/src/ChangeLog b/src/ChangeLog index bb89050691..46b1603593 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,34 @@ +2001-05-04 Lars Gullik Bjønnes + + * minibuffer.C (peek_event): temporarily reduce the functionality + of the minibuffer (to allow args on lfuns) + + * commandtags.h: remove LFUN_LOA_INSERT, LFUN_LOF_INSERT, + LFUN_LOT_INSERT. add LFUN_FLOAT_LIST + + * buffer.C (readInset): add compability reading of old float + lists, add reading of new style float list. + (readInset): avoid reevaluation of inscmd.getCmdName() + (getLists): reindent + + * MenuBackend.C (MenuItem): implement parsing of + md_floatlistinsert and md_floatinsert. + (expand::LastFiles): move initalizaton of iterators out of loop, + avoid reevaluation. + (expand::Documents): introduce typdedef vector Strings, + and use it. + (expand::ExportFormats): introduce typedef vector + Formats, and use it. + (expand): implement FloatListInsert and FloatInsert. + + * LyXAction.C (init): remove entries for LFUN_LOA_INSERT, + LFUN_LOA_VIEW, LFUN_LOF_INSERT, LFUN_LOFVIEW, LFUN_LOT_INSERT, + LFUN_LOTVIEW. Add entry for LFUN_FLOAT_LIST + + * BufferView_pimpl.C (Dispatch::LFUN_TOC_INSERT): remvoe the float + handling. + (Dispatch::LFUN_FLOAT_LIST): implement + 2001-04-28 Kayvan A. Sylvan * LaTeX.C (run): Fix problem with --export code. diff --git a/src/Floating.C b/src/Floating.C index bda65447b4..e06c0aa3e3 100644 --- a/src/Floating.C +++ b/src/Floating.C @@ -3,7 +3,7 @@ * * LyX, The Document Processor * - * Copyright 1998-2000 The LyX Team. + * Copyright 1998-2001 The LyX Team. * * ====================================================== */ diff --git a/src/Floating.h b/src/Floating.h index cdbe80ed5c..b9c7eb8e4e 100644 --- a/src/Floating.h +++ b/src/Floating.h @@ -4,7 +4,7 @@ * * LyX, The Document Processor * - * Copyright 1998-2000 The LyX Team. + * Copyright 1998-2001 The LyX Team. * * ====================================================== */ diff --git a/src/LyXAction.C b/src/LyXAction.C index f789969da6..1c945e9589 100644 --- a/src/LyXAction.C +++ b/src/LyXAction.C @@ -272,18 +272,6 @@ void LyXAction::init() { LFUN_ENDSEL, "line-end-select", N_("Select to end of line"), ReadOnly }, { LFUN_INSET_LIST, "list-insert", "", Noop }, - { LFUN_LOA_INSERT, "loa-insert", - N_("Insert list of algorithms"), Noop }, - { LFUN_LOAVIEW, "loa-view", - N_("View list of algorithms"), ReadOnly }, - { LFUN_LOF_INSERT, "lof-insert", - N_("Insert list of figures"), Noop }, - { LFUN_LOFVIEW, "lof-view", - N_("View list of figures"), ReadOnly }, - { LFUN_LOT_INSERT, "lot-insert", - N_("Insert list of tables"), Noop }, - { LFUN_LOTVIEW, "lot-view", - N_("View list of tables"), ReadOnly }, { LFUN_QUIT, "lyx-quit", N_("Exit"), NoBuffer }, { LFUN_INSET_MARGINAL, "marginalnote-insert", N_("Insert Marginalnote"), Noop }, @@ -418,6 +406,7 @@ void LyXAction::init() N_("Pop old message and show it in the minibuffer"), NoBuffer }, { LFUN_TRANSPOSE_CHARS, "chars-transpose", "", Noop }, + { LFUN_FLOAT_LIST, "float-list", "Insert a float list", Noop }, { LFUN_NOACTION, "", "", Noop } }; diff --git a/src/MenuBackend.C b/src/MenuBackend.C index fb9409be0a..f7aaa81e46 100644 --- a/src/MenuBackend.C +++ b/src/MenuBackend.C @@ -4,18 +4,17 @@ * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich - * Copyright 1995-2000 The LyX Team. + * Copyright 1995-2001 The LyX Team. * * * ====================================================== */ +#include + #ifdef __GNUG__ #pragma implementation #endif -#include -#include -#include "support/LAssert.h" #include "MenuBackend.h" #include "lyxlex.h" #include "LyXAction.h" @@ -26,6 +25,8 @@ #include "converter.h" #include "exporter.h" #include "importer.h" +#include "FloatList.h" +#include "support/LAssert.h" #include "support/filetools.h" #include "support/lyxfunctional.h" @@ -56,6 +57,8 @@ MenuItem::MenuItem(Kind kind, string const & label, case UpdateFormats: case ExportFormats: case ImportFormats: + case FloatListInsert: + case FloatInsert: break; case Command: action_ = lyxaction.LookupFunc(command); @@ -97,6 +100,8 @@ Menu & Menu::read(LyXLex & lex) md_toc, md_updateformats, md_viewformats, + md_floatlistinsert, + md_floatinsert, md_last }; @@ -104,6 +109,8 @@ Menu & Menu::read(LyXLex & lex) { "documents", md_documents }, { "end", md_endmenu }, { "exportformats", md_exportformats }, + { "floatinsert", md_floatinsert }, + { "floatlistinsert", md_floatlistinsert }, { "importformats", md_importformats }, { "item", md_item }, { "lastfiles", md_lastfiles }, @@ -129,7 +136,7 @@ Menu & Menu::read(LyXLex & lex) // fallback to md_item case md_item: { lex.next(); - string name = _(lex.GetString()); + string const name = _(lex.GetString()); lex.next(); string const command = lex.GetString(); add(MenuItem(MenuItem::Command, name, @@ -170,6 +177,14 @@ Menu & Menu::read(LyXLex & lex) add(MenuItem(MenuItem::ImportFormats)); break; + case md_floatlistinsert: + add(MenuItem(MenuItem::FloatListInsert)); + break; + + case md_floatinsert: + add(MenuItem(MenuItem::FloatInsert)); + break; + case md_submenu: { lex.next(); string mlabel = _(lex.GetString()); @@ -239,9 +254,10 @@ void Menu::expand(Menu & tomenu, Buffer * buf) const switch ((*cit).kind()) { case MenuItem::Lastfiles: { int ii = 1; - for (LastFiles::const_iterator lfit = lastfiles->begin(); - lfit != lastfiles->end() && ii < 10; - ++lfit, ++ii) { + LastFiles::const_iterator lfit = lastfiles->begin(); + LastFiles::const_iterator end = lastfiles->end(); + + for (; lfit != end && ii < 10; ++lfit, ++ii) { string const label = tostr(ii) + ". " + MakeDisplayPath((*lfit), 30) + '|' + tostr(ii); @@ -255,7 +271,9 @@ void Menu::expand(Menu & tomenu, Buffer * buf) const break; case MenuItem::Documents: { - vector const names = bufferlist.getFileNames(); + typedef vector Strings; + + Strings const names = bufferlist.getFileNames(); if (names.empty()) { tomenu.add(MenuItem(MenuItem::Command, @@ -264,10 +282,12 @@ void Menu::expand(Menu & tomenu, Buffer * buf) const break; } - for (vector::const_iterator docit = names.begin(); - docit != names.end() ; ++docit) { - int const action = - lyxaction.getPseudoAction(LFUN_SWITCHBUFFER, *docit); + Strings::const_iterator docit = names.begin(); + Strings::const_iterator end = names.end(); + for (; docit != end ; ++docit) { + int const action = lyxaction + .getPseudoAction(LFUN_SWITCHBUFFER, + *docit); string const label = MakeDisplayPath(*docit, 30); tomenu.add(MenuItem(MenuItem::Command, @@ -280,7 +300,10 @@ void Menu::expand(Menu & tomenu, Buffer * buf) const case MenuItem::ViewFormats: case MenuItem::UpdateFormats: case MenuItem::ExportFormats: { - vector formats; + typedef vector Formats; + + Formats formats; + kb_action action; switch ((*cit).kind()) { case MenuItem::ImportFormats: @@ -301,8 +324,10 @@ void Menu::expand(Menu & tomenu, Buffer * buf) const } sort(formats.begin(), formats.end(), compare_format()); - for (vector::const_iterator fit = formats.begin(); - fit != formats.end() ; ++fit) { + Formats::const_iterator fit = formats.begin(); + Formats::const_iterator end = formats.end(); + + for (; fit != end ; ++fit) { if ((*fit)->dummy()) continue; string label = (*fit)->prettyname(); @@ -314,13 +339,45 @@ void Menu::expand(Menu & tomenu, Buffer * buf) const if (!(*fit)->shortcut().empty()) label += "|" + (*fit)->shortcut(); int const action2 = lyxaction. - getPseudoAction(action, (*fit)->name()); + getPseudoAction(action, + (*fit)->name()); tomenu.add(MenuItem(MenuItem::Command, label, action2)); } } break; - + + case MenuItem::FloatListInsert: + { + FloatList::const_iterator cit = floatList.begin(); + FloatList::const_iterator end = floatList.end(); + for (; cit != end; ++cit) { + int const action = lyxaction + .getPseudoAction(LFUN_FLOAT_LIST, + cit->second.type()); + string label = "List of "; + label += cit->second.name(); + tomenu.add(MenuItem(MenuItem::Command, + label, action)); + } + } + break; + + case MenuItem::FloatInsert: + { + FloatList::const_iterator cit = floatList.begin(); + FloatList::const_iterator end = floatList.end(); + for (; cit != end; ++cit) { + int const action = lyxaction + .getPseudoAction(LFUN_INSET_FLOAT, + cit->second.type()); + string const label = cit->second.name(); + tomenu.add(MenuItem(MenuItem::Command, + label, action)); + } + } + break; + default: tomenu.add(*cit); } @@ -331,6 +388,7 @@ void Menu::expand(Menu & tomenu, Buffer * buf) const checkShortcuts(); } + bool Menu::hasSubmenu(string const & name) const { return find_if(begin(), end(), diff --git a/src/MenuBackend.h b/src/MenuBackend.h index d21df33408..32d3af6912 100644 --- a/src/MenuBackend.h +++ b/src/MenuBackend.h @@ -55,7 +55,13 @@ public: ExportFormats, /** This is a list of importable formats typically for the File->Export menu. */ - ImportFormats + ImportFormats, + /** This is the list of floats that we can + insert a list for. */ + FloatListInsert, + /** This is the list of floats that we can + insert. */ + FloatInsert }; /// Create a Command type MenuItem MenuItem(Kind kind, diff --git a/src/ToolbarDefaults.C b/src/ToolbarDefaults.C index 087ec6d652..28813df5e8 100644 --- a/src/ToolbarDefaults.C +++ b/src/ToolbarDefaults.C @@ -70,9 +70,6 @@ void ToolbarDefaults::init() add(LFUN_FIGURE); add(LFUN_DIALOG_TABULAR_INSERT); -#if 0 - //add(LFUN_MELT); -#endif } diff --git a/src/buffer.C b/src/buffer.C index b5ff03380e..329048aef0 100644 --- a/src/buffer.C +++ b/src/buffer.C @@ -77,6 +77,7 @@ #include "insets/insettabular.h" #include "insets/insettheorem.h" #include "insets/insetcaption.h" +#include "insets/insetfloatlist.h" #include "support/filetools.h" #include "support/path.h" #include "LaTeX.h" @@ -1181,40 +1182,44 @@ void Buffer::readInset(LyXLex & lex, LyXParagraph *& par, InsetCommandParams inscmd; inscmd.Read(lex); - if (inscmd.getCmdName() == "cite") { + string const cmdName = inscmd.getCmdName(); + + if (cmdName == "cite") { inset = new InsetCitation(inscmd); - } else if (inscmd.getCmdName() == "bibitem") { + } else if (cmdName == "bibitem") { lex.printError("Wrong place for bibitem"); inset = new InsetBibKey(inscmd); - } else if (inscmd.getCmdName() == "BibTeX") { + } else if (cmdName == "BibTeX") { inset = new InsetBibtex(inscmd); - } else if (inscmd.getCmdName() == "index") { + } else if (cmdName == "index") { inset = new InsetIndex(inscmd); - } else if (inscmd.getCmdName() == "include") { + } else if (cmdName == "include") { inset = new InsetInclude(inscmd, *this); - } else if (inscmd.getCmdName() == "label") { + } else if (cmdName == "label") { inset = new InsetLabel(inscmd); - } else if (inscmd.getCmdName() == "url" - || inscmd.getCmdName() == "htmlurl") { + } else if (cmdName == "url" + || cmdName == "htmlurl") { inset = new InsetUrl(inscmd); - } else if (inscmd.getCmdName() == "ref" - || inscmd.getCmdName() == "pageref" - || inscmd.getCmdName() == "vref" - || inscmd.getCmdName() == "vpageref" - || inscmd.getCmdName() == "prettyref") { + } else if (cmdName == "ref" + || cmdName == "pageref" + || cmdName == "vref" + || cmdName == "vpageref" + || cmdName == "prettyref") { if (!inscmd.getOptions().empty() || !inscmd.getContents().empty()) { inset = new InsetRef(inscmd, *this); } - } else if (inscmd.getCmdName() == "tableofcontents" - || inscmd.getCmdName() == "listofalgorithms" - || inscmd.getCmdName() == "listoffigures" - || inscmd.getCmdName() == "listoftables" - || inscmd.getCmdName() == "listof{algorithm}{List of Algorithms}") { + } else if (cmdName == "tableofcontents") { inset = new InsetTOC(inscmd); - } else if (inscmd.getCmdName() == "printindex") { + } else if (cmdName == "listofalgorithms") { + inset = new InsetFloatList("algorithm"); + } else if (cmdName == "listoffigures") { + inset = new InsetFloatList("figure"); + } else if (cmdName == "listoftables") { + inset = new InsetFloatList("table"); + } else if (cmdName == "printindex") { inset = new InsetPrintIndex(inscmd); - } else if (inscmd.getCmdName() == "lyxparent") { + } else if (cmdName == "lyxparent") { inset = new InsetParent(inscmd, *this); } } else { @@ -1257,6 +1262,8 @@ void Buffer::readInset(LyXLex & lex, LyXParagraph *& par, inset = new InsetCaption; } else if (tmptok == "GRAPHICS") { inset = new InsetGraphics; + } else if (tmptok == "FloatList") { + inset = new InsetFloatList; } if (inset) inset->Read(this, lex); @@ -3362,54 +3369,54 @@ Buffer::Lists const Buffer::getLists() const .NumberOfLayout(params.textclass, "Caption"); while (par) { - char const labeltype = - textclasslist.Style(params.textclass, - par->GetLayout()).labeltype; - - if (labeltype >= LABEL_COUNTER_CHAPTER - && labeltype <= LABEL_COUNTER_CHAPTER + params.tocdepth) { + char const labeltype = + textclasslist.Style(params.textclass, + par->GetLayout()).labeltype; + + if (labeltype >= LABEL_COUNTER_CHAPTER + && labeltype <= LABEL_COUNTER_CHAPTER + params.tocdepth) { // insert this into the table of contents - SingleList & item = l["TOC"]; - int depth = max(0, - labeltype - - textclasslist.TextClass(params.textclass).maxcounter()); - item.push_back(TocItem(par, depth, par->String(this, true))); - } - // For each paragrph, traverse its insets and look for - // FLOAT_CODE + SingleList & item = l["TOC"]; + int depth = max(0, + labeltype - + textclasslist.TextClass(params.textclass).maxcounter()); + item.push_back(TocItem(par, depth, par->String(this, true))); + } + // For each paragrph, traverse its insets and look for + // FLOAT_CODE + + if (found) { + LyXParagraph::inset_iterator it = + par->inset_iterator_begin(); + LyXParagraph::inset_iterator end = + par->inset_iterator_end(); - if (found) { - LyXParagraph::inset_iterator it = - par->inset_iterator_begin(); - LyXParagraph::inset_iterator end = - par->inset_iterator_end(); - - for (; it != end; ++it) { - if ((*it)->LyxCode() == Inset::FLOAT_CODE) { - InsetFloat * il = - static_cast(*it); - - string const type = il->type(); - - // Now find the caption in the float... - // We now tranverse the paragraphs of - // the inset... - LyXParagraph * tmp = il->inset.par; - while (tmp) { - if (tmp->layout == cap) { - SingleList & item = l[type]; - string const str = - tostr(item.size()+1) + ". " + tmp->String(this, false); - item.push_back(TocItem(tmp, 0 , str)); - } - tmp = tmp->next(); + for (; it != end; ++it) { + if ((*it)->LyxCode() == Inset::FLOAT_CODE) { + InsetFloat * il = + static_cast(*it); + + string const type = il->type(); + + // Now find the caption in the float... + // We now tranverse the paragraphs of + // the inset... + LyXParagraph * tmp = il->inset.par; + while (tmp) { + if (tmp->layout == cap) { + SingleList & item = l[type]; + string const str = + tostr(item.size()+1) + ". " + tmp->String(this, false); + item.push_back(TocItem(tmp, 0 , str)); } + tmp = tmp->next(); } } - } else { - lyxerr << "caption not found" << endl; } - + } else { + lyxerr << "caption not found" << endl; + } + par = par->next(); } return l; diff --git a/src/commandtags.h b/src/commandtags.h index b40b042f55..c82c5017c8 100644 --- a/src/commandtags.h +++ b/src/commandtags.h @@ -144,9 +144,6 @@ enum kb_action { LFUN_MATH_EXTERN, // Andre' 20010424 LFUN_MATH_PANEL, LFUN_FIGURE, -#if 0 - LFUN_MELT, -#endif LFUN_DELETE_WORD_FORWARD, LFUN_DELETE_WORD_BACKWARD, LFUN_DELETE_LINE_FORWARD, @@ -208,9 +205,7 @@ enum kb_action { LFUN_CHILD_INSERT, // Ale 970521 LFUN_CHILDOPEN, // Ale 970528 LFUN_TOC_INSERT, // Lgb 97-05-27 - LFUN_LOA_INSERT, // Bernhard 97-08-07 - LFUN_LOF_INSERT, // Lgb 97-05-27 - LFUN_LOT_INSERT, // Lgb 97-05-27 + LFUN_FLOAT_LIST, // Lgb 20010503 LFUN_READ_ONLY_TOGGLE, // Lgb 97-05-27 LFUN_BIBDB_ADD, // Ale 970530 LFUN_BIBDB_DEL, // Ale 970530 diff --git a/src/frontends/controllers/ChangeLog b/src/frontends/controllers/ChangeLog index e3ef6a705a..1109fe489b 100644 --- a/src/frontends/controllers/ChangeLog +++ b/src/frontends/controllers/ChangeLog @@ -1,3 +1,7 @@ +2001-05-04 Lars Gullik Bjønnes + + * ControlToc.C (getType): remove support for old float list. + 2001-04-26 Angus Leeming * ControlButtons.h: no longer include ButtonControllerBase.h, ViewBase.h diff --git a/src/frontends/controllers/ControlToc.C b/src/frontends/controllers/ControlToc.C index 03351a1888..855c13d7ea 100644 --- a/src/frontends/controllers/ControlToc.C +++ b/src/frontends/controllers/ControlToc.C @@ -92,7 +92,7 @@ Buffer::SingleList const ControlToc::getContents(string const & type) const namespace toc { -string getType(string const & cmdName) +string const getType(string const & cmdName) { string type; @@ -101,16 +101,7 @@ string getType(string const & cmdName) if (cmdName == "tableofcontents" ) type = "TOC"; - else if (cmdName == "listofalgorithms" ) - type = "algorithm"; - - else if (cmdName == "listoffigures" ) - type = "figure"; - - else - type = "table"; - - return type; + return cmdName; } } // namespace toc diff --git a/src/frontends/controllers/ControlToc.h b/src/frontends/controllers/ControlToc.h index cc06c42e81..fc3823b871 100644 --- a/src/frontends/controllers/ControlToc.h +++ b/src/frontends/controllers/ControlToc.h @@ -1,3 +1,4 @@ +// -*- C++ -*- /* This file is part of * ====================================================== * @@ -43,7 +44,7 @@ namespace toc { /** Given the cmdName of the TOC param, returns the type used by ControlToc::getContents() */ - string getType(string const & cmdName); + string const getType(string const & cmdName); } // namespace toc diff --git a/src/frontends/xforms/ChangeLog b/src/frontends/xforms/ChangeLog index 5d288647ad..c6e99db8b6 100644 --- a/src/frontends/xforms/ChangeLog +++ b/src/frontends/xforms/ChangeLog @@ -1,3 +1,9 @@ +2001-05-04 Lars Gullik Bjønnes + + * Menubar_pimpl.C (add_toc): use name and not type with float. + (create_submenu): correct call of new object + (create_submenu): add FloatListInsert and FloatInsert to dummy clause. + 2001-05-03 Lars Gullik Bjønnes * FormParagraph.[Ch]: remove !NO_PEXTRA and !NEW_INSETS cruft diff --git a/src/frontends/xforms/FormToc.h b/src/frontends/xforms/FormToc.h index 215b0c1a7a..1e5bfeb1fc 100644 --- a/src/frontends/xforms/FormToc.h +++ b/src/frontends/xforms/FormToc.h @@ -1,3 +1,4 @@ +// -*- C++ -*- /* This file is part of * ====================================================== * @@ -30,7 +31,6 @@ class FormToc : public FormCB > { public: /// FormToc(ControlToc &); - private: /// not needed virtual void apply() {} diff --git a/src/frontends/xforms/Menubar_pimpl.C b/src/frontends/xforms/Menubar_pimpl.C index c6dfb0afeb..cb2fa4fd3d 100644 --- a/src/frontends/xforms/Menubar_pimpl.C +++ b/src/frontends/xforms/Menubar_pimpl.C @@ -3,9 +3,9 @@ * * LyX, The Document Processor * -* Copyright (C) 1999 The LyX Team. +* Copyright 1999-2001 The LyX Team. * -*======================================================*/ +* ======================================================*/ #include @@ -15,18 +15,19 @@ #pragma implementation #endif -#include "support/lstrings.h" -#include "support/LAssert.h" -#include "debug.h" +#include "Menubar_pimpl.h" +#include "MenuBackend.h" #include "LyXAction.h" #include "kbmap.h" #include "buffer.h" #include "Dialogs.h" #include "LyXView.h" #include "lyxfunc.h" -#include "MenuBackend.h" -#include "Menubar_pimpl.h" +#include "FloatList.h" +#include "support/lstrings.h" +#include "support/LAssert.h" #include "gettext.h" +#include "debug.h" using std::endl; using std::vector; @@ -41,21 +42,21 @@ extern LyXAction lyxaction; namespace { // Some constants -const int MENU_LABEL_SIZE = FL_NORMAL_SIZE; -const int mheight = 30; -const int mbheight= 22; +int const MENU_LABEL_SIZE = FL_NORMAL_SIZE; +int const mheight = 30; +int const mbheight= 22; // where to place the menubar? -const int yloc = (mheight - mbheight)/2; //air + bw; -const int mbadd = 20; // menu button add (to width) +int const yloc = (mheight - mbheight)/2; //air + bw; +int const mbadd = 20; // menu button add (to width) // Some space between buttons on the menubar -const int air = 2; +int const air = 2; char const * menu_tabstop = "aa"; char const * default_tabstop = "aaaaaaaa"; // We do not want to mix position values in a menu (like the index of // a submenu) with the action numbers which convey actual information. // Therefore we offset all the action values by an arbitrary large // constant. -const int action_offset = 1000; +int const action_offset = 1000; // This is used a few times below. inline @@ -94,7 +95,7 @@ Menubar::Pimpl::Pimpl(LyXView * view, MenuBackend const & mb) } -void Menubar::Pimpl::makeMenubar(Menu const &menu) +void Menubar::Pimpl::makeMenubar(Menu const & menu) { FL_FORM * form = owner_->getForm(); int moffset = 0; @@ -106,17 +107,18 @@ void Menubar::Pimpl::makeMenubar(Menu const &menu) fl_set_object_gravity(frame, NorthWestGravity, NorthEastGravity); - for (Menu::const_iterator i = menu.begin(); - i != menu.end(); ++i) { + Menu::const_iterator i = menu.begin(); + Menu::const_iterator end = menu.end(); + for (; i != end; ++i) { FL_OBJECT * obj; if (i->kind() != MenuItem::Submenu) { lyxerr << "ERROR: Menubar::Pimpl::createMenubar:" " only submenus can appear in a menubar"; break; } - string label = i->label(); - string shortcut = "#" + i->shortcut(); - int width = string_width(label); + string const label = i->label(); + string const shortcut = "#" + i->shortcut(); + int const width = string_width(label); obj = fl_add_button(FL_MENU_BUTTON, air + moffset, yloc, width + mbadd, @@ -133,14 +135,15 @@ void Menubar::Pimpl::makeMenubar(Menu const &menu) fl_set_object_shortcut(obj, shortcut.c_str(), 1); fl_set_object_callback(obj, C_Menubar_Pimpl_MenuCallback, 1); - boost::shared_ptr iteminfo(new ItemInfo(this, - new MenuItem(*i), obj)); + boost::shared_ptr + iteminfo(new ItemInfo(this, new MenuItem(*i), obj)); buttonlist_.push_back(iteminfo); obj->u_vdata = iteminfo.get(); } } + void Menubar::Pimpl::set(string const & menu_name) { lyxerr[Debug::GUI] << "Entering Menubar::Pimpl::set " @@ -168,12 +171,12 @@ void Menubar::Pimpl::set(string const & menu_name) current_group_ = mbit->second; lyxerr[Debug::GUI] << "Menubar::Pimpl::set: Menubar set." << endl; - } - else + } else lyxerr [Debug::GUI] << "Menubar::Pimpl::set: Nothing to do." << endl; } + void Menubar::Pimpl::openByName(string const & name) { if (menubackend_->getMenu(current_menu_name_).hasSubmenu(name)) { @@ -319,67 +322,14 @@ void add_toc2(int menu, string const & extra_label, void Menubar::Pimpl::add_toc(int menu, string const & extra_label, vector & smn, Window win) { -#if 0 - //xgettext:no-c-format - static char const * MenuNames[3] = { N_("List of Figures%m"), - //xgettext:no-c-format - N_("List of Tables%m"), - //xgettext:no-c-format - N_("List of Algorithms%m") }; - - vector > toc_list = - owner_->buffer()->getTocList(); - - // Handle LOF/LOT/LOA - int max_nonempty = 0; - for (int i = 1; i <= 3; ++i) - if (!toc_list[i].empty()) - max_nonempty = i; - - for (int j = 1; j <= 3; ++j) - if (!toc_list[j].empty()) { - int menu2 = get_new_submenu(smn, win); - for (size_type i = 0; i < toc_list[j].size(); ++i) { - if (i > max_number_of_items) { - fl_addtopup(menu2, ". . .%d"); - break; - } - int const action = lyxaction. - getPseudoAction(LFUN_GOTO_PARAGRAPH, - tostr(toc_list[j][i].par->id())); - string label = fixlabel(toc_list[j][i].str); - label = limit_string_length(label); - label += "%x" + tostr(action + action_offset); - fl_addtopup(menu2, label.c_str()); - } - if (j == max_nonempty) { - string label = _(MenuNames[j - 1]); - label += "%l"; - fl_addtopup(menu, label.c_str(), menu2); - } else - fl_addtopup(menu, _(MenuNames[j - 1]), menu2); - } - - // Handle normal TOC - if (max_nonempty == 0 && toc_list[0].empty()) { - fl_addtopup(menu, (_("No Table of Contents%i") - + extra_label).c_str()); - return; - } - - add_toc2(menu, extra_label, smn, win, - toc_list[0], 0, toc_list[0].size(), 0); -#else -#ifdef WITH_WARNINGS -#warning Fix Me! (Lgb) -#endif Buffer::Lists toc_list = owner_->buffer()->getLists(); Buffer::Lists::const_iterator cit = toc_list.begin(); Buffer::Lists::const_iterator end = toc_list.end(); for (; cit != end; ++cit) { // Handle this elsewhere if (cit->first == "TOC") continue; - + + // All the rest is for floats int menu2 = get_new_submenu(smn, win); Buffer::SingleList::const_iterator ccit = cit->second.begin(); Buffer::SingleList::const_iterator eend = cit->second.end(); @@ -393,7 +343,7 @@ void Menubar::Pimpl::add_toc(int menu, string const & extra_label, label += "%x" + tostr(action + action_offset); fl_addtopup(menu2, label.c_str()); } - string const m = cit->first + "%m"; + string const m = floatList[cit->first]->second.name() + "%m"; fl_addtopup(menu, m.c_str(), menu2); } @@ -408,10 +358,9 @@ void Menubar::Pimpl::add_toc(int menu, string const & extra_label, add_toc2(menu, extra_label, smn, win, cit->second, 0, cit->second.size(), 0); } - -#endif } + int Menubar::Pimpl::create_submenu(Window win, LyXView * view, string const & menu_name, vector & smn) @@ -421,10 +370,10 @@ int Menubar::Pimpl::create_submenu(Window win, LyXView * view, << menu_name << "'" << endl; return -1; } - Menu md = Menu(); + Menu md; menubackend_->getMenu(menu_name).expand(md, owner_->buffer()); - int menu = get_new_submenu(smn, win); + int const menu = get_new_submenu(smn, win); fl_setpup_softedge(menu, true); fl_setpup_bw(menu, -1); lyxerr[Debug::GUI] << "Adding menu " << menu @@ -438,8 +387,8 @@ int Menubar::Pimpl::create_submenu(Window win, LyXView * view, for (Menu::const_iterator i = md.begin(); i != end; ++i) { MenuItem const & item = (*i); if (item.kind() == MenuItem::Command) { - string label = item.label() + '\t'; - int width = string_width(label); + string const label = item.label() + '\t'; + int const width = string_width(label); if (width > max_width) { max_width = width; widest_label = label; @@ -538,8 +487,7 @@ int Menubar::Pimpl::create_submenu(Window win, LyXView * view, label += "%h"; fl_addtopup(menu, label.c_str(), submenu, shortcut.c_str()); - } - else { + } else { fl_addtopup(menu, label.c_str(), submenu); } break; @@ -560,6 +508,8 @@ int Menubar::Pimpl::create_submenu(Window win, LyXView * view, case MenuItem::UpdateFormats: case MenuItem::ExportFormats: case MenuItem::ImportFormats: + case MenuItem::FloatListInsert: + case MenuItem::FloatInsert: lyxerr << "Menubar::Pimpl::create_submenu: " "this should not happen" << endl; break; diff --git a/src/importer.C b/src/importer.C index 1f6d770257..119be0ea82 100644 --- a/src/importer.C +++ b/src/importer.C @@ -84,6 +84,7 @@ bool Importer::Import(LyXView * lv, string const & filename, return true; } + #if 0 bool Importer::IsImportable(string const & format) { @@ -96,6 +97,7 @@ bool Importer::IsImportable(string const & format) } #endif + vector const Importer::GetImportableFormats() { vector loaders = Loaders(); diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index ad41b1fd35..931590d3e5 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,3 +1,16 @@ +2001-05-04 Lars Gullik Bjønnes + + * lyxinset.h: remve LOF_CODE, LOT_CODE, LOA_CODE, add + FLOAT_LIST_CODE, renumber code list. + + * insettoc.C (getScreenLabel): remove support for float lists + (LyxCode): ditto + (Ascii): ditto + + * insetfloatlist.[Ch]: new files + + * Makefile.am (libinsets_la_SOURCES): add insetfloatlist.[Ch] + 2001-04-27 Angus Leeming * insettabular.C (LocalDispatch): diff --git a/src/insets/Makefile.am b/src/insets/Makefile.am index aa39a5d659..cb6998712d 100644 --- a/src/insets/Makefile.am +++ b/src/insets/Makefile.am @@ -33,6 +33,8 @@ libinsets_la_SOURCES = \ insetexternal.h \ insetfloat.h \ insetfloat.C \ + insetfloatlist.C \ + insetfloatlist.h \ insetfoot.C \ insetfoot.h \ insetfootlike.C \ diff --git a/src/insets/insetbutton.C b/src/insets/insetbutton.C index e63832d9aa..4871739fda 100644 --- a/src/insets/insetbutton.C +++ b/src/insets/insetbutton.C @@ -18,6 +18,7 @@ #include "debug.h" #include "BufferView.h" #include "Painter.h" +#include "support/LAssert.h" using std::ostream; using std::endl; @@ -25,11 +26,15 @@ using std::endl; int InsetButton::ascent(BufferView * bv, LyXFont const &) const { + lyx::Assert(bv); + LyXFont font(LyXFont::ALL_SANE); font.decSize(); - int width, ascent, descent; - string s = getScreenLabel(); + int width; + int ascent; + int descent; + string const s = getScreenLabel(); if (Editable()) { bv->painter().buttonText(0, 0, s, font, @@ -45,11 +50,15 @@ int InsetButton::ascent(BufferView * bv, LyXFont const &) const int InsetButton::descent(BufferView * bv, LyXFont const &) const { + lyx::Assert(bv); + LyXFont font(LyXFont::ALL_SANE); font.decSize(); - int width, ascent, descent; - string s = getScreenLabel(); + int width; + int ascent; + int descent; + string const s = getScreenLabel(); if (Editable()) { bv->painter().buttonText(0, 0, s, font, @@ -65,13 +74,15 @@ int InsetButton::descent(BufferView * bv, LyXFont const &) const int InsetButton::width(BufferView * bv, LyXFont const &) const { + lyx::Assert(bv); + LyXFont font(LyXFont::ALL_SANE); font.decSize(); - int width, ascent, descent; - string s = getScreenLabel(); - //if (!bv) - // int(s.length()); + int width; + int ascent; + int descent; + string const s = getScreenLabel(); if (Editable()) { bv->painter().buttonText(0, 0, s, font, @@ -88,18 +99,20 @@ int InsetButton::width(BufferView * bv, LyXFont const &) const void InsetButton::draw(BufferView * bv, LyXFont const &, int baseline, float & x, bool) const { + lyx::Assert(bv); + Painter & pain = bv->painter(); // Draw it as a box with the LaTeX text LyXFont font(LyXFont::ALL_SANE); font.setColor(LColor::command).decSize(); int width; - string s = getScreenLabel(); + string const s = getScreenLabel(); if (Editable()) { - pain.buttonText(int(x)+2, baseline, s, font, true, width); + pain.buttonText(int(x) + 2, baseline, s, font, true, width); } else { - pain.rectText(int(x)+2, baseline, s, font, + pain.rectText(int(x) + 2, baseline, s, font, LColor::commandbg, LColor::commandframe, true, width); } diff --git a/src/insets/insetfloatlist.C b/src/insets/insetfloatlist.C new file mode 100644 index 0000000000..63b0ba6bcf --- /dev/null +++ b/src/insets/insetfloatlist.C @@ -0,0 +1,115 @@ +#include + +#ifdef __GNUG__ +#pragma implementation +#endif + +#include "insetfloatlist.h" +#include "FloatList.h" +#include "buffer.h" +#include "gettext.h" +#include "debug.h" + + +string const InsetFloatList::getScreenLabel() const +{ + string const guiName = floatList[float_type]->second.name(); + if (!guiName.empty()) { + string const res = _("List of ") + guiName; + return res; + } + return _("ERROR nonexistant float type!"); +} + + +Inset::Code InsetFloatList::LyxCode() const +{ + return Inset::FLOAT_LIST_CODE; +} + + +void InsetFloatList::Write(Buffer const *, ostream & os) const +{ + os << "FloatList " << float_type << "\n"; +} + + +void InsetFloatList::Read(Buffer const *, LyXLex & lex) +{ + string token; + + if (lex.EatLine()) { + float_type = lex.GetString(); + lyxerr << "FloatList::float_type: " << float_type << endl; + } else + lex.printError("InsetFloatList: Parse error: `$$Token'"); + while (lex.IsOK()) { + lex.nextToken(); + token = lex.GetString(); + if (token == "\\end_inset") + break; + } + if (token != "\\end_inset") { + lex.printError("Missing \\end_inset at this point. " + "Read: `$$Token'"); + } +} + + +void InsetFloatList::Edit(BufferView *, int, int, unsigned int) +{ +#ifdef WITH_WARNINGS +#warning Implement me please. +#endif +#if 0 + bv->owner()->getDialogs()->showFloatList(this); +#endif +} + + +int InsetFloatList::Latex(Buffer const *, ostream & os, bool, bool) const +{ + FloatList::const_iterator cit = floatList[float_type]; + + + if (cit != floatList.end()) { + if (cit->second.builtin()) { + // Only two different types allowed here: + string const type = cit->second.type(); + if (type == "table") { + os << "\\listoftables\n"; + } else if (type == "figure") { + os << "\\listoffigures\n"; + } else { + os << "%% unknown builtin float\n"; + } + } else { + os << "\\listof{" << float_type << "}{" + << _("List of ") << cit->second.name() << "}\n"; + } + } else { + os << "%%\\listof{" << float_type << "}{" + << _("List of ") << cit->second.name() << "}\n"; + } + return 1; +} + + +int InsetFloatList::Ascii(Buffer const * buffer, std::ostream & os, int) const +{ + os << getScreenLabel() << "\n\n"; + + Buffer::Lists const toc_list = buffer->getLists(); + Buffer::Lists::const_iterator cit = + toc_list.find(float_type); + if (cit != toc_list.end()) { + Buffer::SingleList::const_iterator ccit = cit->second.begin(); + Buffer::SingleList::const_iterator end = cit->second.end(); + for (; ccit != end; ++ccit) + os << string(4 * ccit->depth, ' ') + << ccit->str << "\n"; + } + + os << "\n"; + return 0; +} diff --git a/src/insets/insetfloatlist.h b/src/insets/insetfloatlist.h new file mode 100644 index 0000000000..0e449f9e62 --- /dev/null +++ b/src/insets/insetfloatlist.h @@ -0,0 +1,60 @@ +// -*- C++ -*- +/* This file is part of* + * ====================================================== + * + * LyX, The Document Word Processor + * + * Copyright 1995 Matthias Ettrich + * Copyright 1996-2001 The LyX Team. + * + * ====================================================== */ + +#ifndef INSET_FLOATLIST_H +#define INSET_FLOATLIST_H + +#ifdef __GNUG__ +#pragma interface +#endif + +#include "insetbutton.h" + +/** Used to insert table of contents + */ +class InsetFloatList : public InsetButton { +public: + /// + InsetFloatList() {} + /// + InsetFloatList(string const & type) + : float_type(type) {} + /// + Inset * Clone(Buffer const &) const { + return new InsetFloatList(*this); + } + /// + string const getScreenLabel() const; + /// + void Edit(BufferView * bv, int, int, unsigned int); + /// + EDITABLE Editable() const { return IS_EDITABLE; } + /// + bool display() const { return true; } + /// + Inset::Code LyxCode() const; + /// + void Write(Buffer const *, ostream &) const; + /// + void Read(Buffer const *, LyXLex &); + /// + int Latex(Buffer const *, ostream &, bool, bool) const; + /// + int Linuxdoc(Buffer const *, ostream &) const { return 0; } + /// + int DocBook(Buffer const *, ostream &) const { return 0; } + /// + int Ascii(Buffer const *, std::ostream &, int linelen) const; +private: + string float_type; +}; + +#endif diff --git a/src/insets/insettoc.C b/src/insets/insettoc.C index 72b8861d0c..0e9685fb5b 100644 --- a/src/insets/insettoc.C +++ b/src/insets/insettoc.C @@ -20,12 +20,7 @@ string const InsetTOC::getScreenLabel() const if (cmdname == "tableofcontents") return _("Table of Contents"); - else if (cmdname == "listof{algorithm}{List of Algorithms}") - return _("List of Algorithms"); - else if (cmdname == "listoffigures") - return _("List of Figures"); - else - return _("List of Tables"); + return _("Unknown toc list"); } @@ -34,12 +29,7 @@ Inset::Code InsetTOC::LyxCode() const string const cmdname(getCmdName()); if (cmdname == "tableofcontents") return Inset::TOC_CODE; - else if (cmdname == "listof{algorithm}{List of Algorithms}") - return Inset::LOA_CODE; - else if (cmdname == "listoffigures") - return Inset::LOF_CODE; - else - return Inset::LOT_CODE; + return Inset::NO_CODE; } @@ -53,39 +43,10 @@ int InsetTOC::Ascii(Buffer const * buffer, std::ostream & os, int) const { os << getScreenLabel() << "\n\n"; -#if 0 - Buffer::TocType type; - string cmdname = getCmdName(); - if (cmdname == "tableofcontents") - type = Buffer::TOC_TOC; - else if (cmdname == "listof{algorithm}{List of Algorithms}") - type = Buffer::TOC_LOA; - else if (cmdname == "listoffigures") - type = Buffer::TOC_LOF; - else - type = Buffer::TOC_LOT; - - vector > const toc_list = - buffer->getTocList(); - vector const & toc = toc_list[type]; - for (vector::const_iterator it = toc.begin(); - it != toc.end(); ++it) - os << string(4 * it->depth, ' ') << it->str << endl; -#else -#ifdef WITH_WARNINGS -#warning Fix Me! (Lgb) -#endif string type; string const cmdname = getCmdName(); if (cmdname == "tableofcontents") type = "TOC"; - else if (cmdname == "listof{algorithm}{List of Algorithms}") - type = "LOA"; - else if (cmdname == "listoffigures") - type = "LOF"; - else - type = "LOT"; - Buffer::Lists const toc_list = buffer->getLists(); Buffer::Lists::const_iterator cit = toc_list.find(type); @@ -96,7 +57,7 @@ int InsetTOC::Ascii(Buffer const * buffer, std::ostream & os, int) const os << string(4 * ccit->depth, ' ') << ccit->str << "\n"; } -#endif + os << "\n"; return 0; } diff --git a/src/insets/lyxinset.h b/src/insets/lyxinset.h index ba83658890..5d14cd0ae3 100644 --- a/src/insets/lyxinset.h +++ b/src/insets/lyxinset.h @@ -45,71 +45,67 @@ public: /// TOC_CODE, // do these insets really need a code? (ale) /// - LOF_CODE, // 2 - /// - LOT_CODE, - /// - LOA_CODE, - /// - QUOTE_CODE, // 5 + QUOTE_CODE, /// MARK_CODE, /// - REF_CODE, + REF_CODE, // 5 /// URL_CODE, /// HTMLURL_CODE, /// - SEPARATOR_CODE, // 10 + SEPARATOR_CODE, /// ENDING_CODE, /// - LABEL_CODE, + LABEL_CODE, // 10 /// IGNORE_CODE, /// ACCENT_CODE, /// - MATH_CODE, // 15 + MATH_CODE, /// INDEX_CODE, /// - INCLUDE_CODE, + INCLUDE_CODE, // 15 /// GRAPHICS_CODE, /// PARENT_CODE, /// - BIBTEX_CODE, // 20 + BIBTEX_CODE, /// TEXT_CODE, /// - ERT_CODE, + ERT_CODE, // 20 /// FOOT_CODE, /// MARGIN_CODE, /// - FLOAT_CODE, // 25 + FLOAT_CODE, /// MINIPAGE_CODE, /// - SPECIALCHAR_CODE, + SPECIALCHAR_CODE, // 25 /// TABULAR_CODE, /// EXTERNAL_CODE, /// - THEOREM_CODE, // 30 + THEOREM_CODE, /// CAPTION_CODE, /// - MATHMACRO_CODE, + MATHMACRO_CODE, // 30 /// ERROR_CODE, /// - CITE_CODE + CITE_CODE, + /// + FLOAT_LIST_CODE }; /// @@ -130,7 +126,7 @@ public: /// Inset() : top_x(0), top_baseline(0), scx(0), owner_(0) {} - /// + /// Virtual base destructor virtual ~Inset() {} /// virtual int ascent(BufferView *, LyXFont const &) const = 0; diff --git a/src/lyxfunc.C b/src/lyxfunc.C index 2cc377cde6..0165701bd5 100644 --- a/src/lyxfunc.C +++ b/src/lyxfunc.C @@ -456,10 +456,6 @@ LyXFunc::func_status LyXFunc::getStatus(int ac, break; case LFUN_INSERTFOOTNOTE: -#if 0 - case LFUN_FOOTMELT: - case LFUN_MARGINMELT: -#endif // Disable insertion of floats in a tabular. disable = false; if (owner->view()->theLockingInset()) { @@ -918,21 +914,26 @@ string const LyXFunc::Dispatch(int ac, break; case LFUN_TOCVIEW: +#if 0 case LFUN_LOFVIEW: case LFUN_LOTVIEW: case LFUN_LOAVIEW: +#endif { InsetCommandParams p; - + +#if 0 if (action == LFUN_TOCVIEW) +#endif p.setCmdName("tableofcontents"); +#if 0 else if (action == LFUN_LOAVIEW ) p.setCmdName("listof{algorithm}{List of Algorithms}"); else if (action == LFUN_LOFVIEW) p.setCmdName("listoffigures"); else p.setCmdName("listoftables"); - +#endif owner->getDialogs()->createTOC(p.getAsString()); break; } diff --git a/src/minibuffer.C b/src/minibuffer.C index 96d00c99a4..3ea3b88de1 100644 --- a/src/minibuffer.C +++ b/src/minibuffer.C @@ -174,6 +174,10 @@ int MiniBuffer::peek_event(FL_OBJECT * ob, int event, int key) case 13: case XK_Return: { +#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::const_iterator cit = std::find(completion_.begin(), @@ -185,12 +189,15 @@ int MiniBuffer::peek_event(FL_OBJECT * ob, int event, int key) string const tmp = input + _(" [no match]"); fl_set_input(ob, tmp.c_str()); } else { +#endif // Return the inputted string deactivate(); owner_->view()->focus(true); history_->push_back(input); stringReady.emit(input); +# if 0 } +#endif return 1; } case XK_space: