floatlist work + handle lyxfuncs with args.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1984 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2001-05-04 10:36:36 +00:00
parent 407dc56e97
commit 52153a589b
29 changed files with 537 additions and 336 deletions

View File

@ -1,3 +1,7 @@
2001-05-04 Lars Gullik Bjřnnes <larsbj@birdstep.com>
* ui/default.ui: add FloatInsert and FloatListInsert
2001-04-18 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr> 2001-04-18 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
* examples/eu_splash.lyx: update from Dooteo * examples/eu_splash.lyx: update from Dooteo

View File

@ -201,19 +201,12 @@ Menuset
End End
Menu "insert_floats" Menu "insert_floats"
Item "Figure|F" "float-insert figure" FloatInsert
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"
End End
Menu "insert_toc" Menu "insert_toc"
Item "Table of Contents|C" "toc-insert" Item "Table of Contents|C" "toc-insert"
Item "List of Figures|F" "lof-insert" FloatListInsert
Item "List of Tables|T" "lot-insert"
Item "List of Algorithms|A" "loa-insert"
Item "Index List|I" "index-print" Item "Index List|I" "index-print"
Item "BibTeX Reference...|B" "bibtex-insert" Item "BibTeX Reference...|B" "bibtex-insert"
End End

View File

@ -10,8 +10,8 @@ src/CutAndPaste.C
src/debug.C src/debug.C
src/exporter.C src/exporter.C
src/ext_l10n.h src/ext_l10n.h
src/figureForm.C
src/figure_form.C src/figure_form.C
src/figureForm.C
src/FontLoader.C src/FontLoader.C
src/frontends/controllers/ButtonController.h src/frontends/controllers/ButtonController.h
src/frontends/controllers/character.C src/frontends/controllers/character.C
@ -90,67 +90,67 @@ src/frontends/qt2/paragraphdlgimpl.C
src/frontends/qt2/tabularcreatedlgimpl.C src/frontends/qt2/tabularcreatedlgimpl.C
src/frontends/xforms/combox.C src/frontends/xforms/combox.C
src/frontends/xforms/FileDialog.C src/frontends/xforms/FileDialog.C
src/frontends/xforms/FormBibitem.C
src/frontends/xforms/form_bibitem.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/form_bibtex.C
src/frontends/xforms/FormBibtex.C
src/frontends/xforms/form_browser.C src/frontends/xforms/form_browser.C
src/frontends/xforms/FormCharacter.C
src/frontends/xforms/form_character.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/form_citation.C
src/frontends/xforms/FormCopyright.C src/frontends/xforms/FormCitation.C
src/frontends/xforms/form_copyright.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/form_credits.C
src/frontends/xforms/FormDocument.C src/frontends/xforms/FormCredits.C
src/frontends/xforms/form_document.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/form_error.C
src/frontends/xforms/FormExternal.C src/frontends/xforms/FormError.C
src/frontends/xforms/form_external.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/form_filedialog.C
src/frontends/xforms/FormGraphics.C src/frontends/xforms/FormFiledialog.C
src/frontends/xforms/form_graphics.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/form_include.C
src/frontends/xforms/FormIndex.C src/frontends/xforms/FormInclude.C
src/frontends/xforms/form_index.C src/frontends/xforms/form_index.C
src/frontends/xforms/FormIndex.C
src/frontends/xforms/FormLog.C src/frontends/xforms/FormLog.C
src/frontends/xforms/FormMathsBitmap.C src/frontends/xforms/FormMathsBitmap.C
src/frontends/xforms/FormMathsDeco.C
src/frontends/xforms/form_maths_deco.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/form_maths_delim.C
src/frontends/xforms/FormMathsMatrix.C src/frontends/xforms/FormMathsDelim.C
src/frontends/xforms/form_maths_matrix.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/form_maths_panel.C
src/frontends/xforms/FormMathsSpace.C src/frontends/xforms/FormMathsPanel.C
src/frontends/xforms/form_maths_space.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/form_minipage.C
src/frontends/xforms/FormParagraph.C src/frontends/xforms/FormMinipage.C
src/frontends/xforms/form_paragraph.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/form_preamble.C
src/frontends/xforms/FormPreferences.C src/frontends/xforms/FormPreamble.C
src/frontends/xforms/form_preferences.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/form_print.C
src/frontends/xforms/FormRef.C src/frontends/xforms/FormPrint.C
src/frontends/xforms/form_ref.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/form_search.C
src/frontends/xforms/FormTabular.C src/frontends/xforms/FormSearch.C
src/frontends/xforms/form_tabular.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/form_tabular_create.C
src/frontends/xforms/FormToc.C src/frontends/xforms/FormTabularCreate.C
src/frontends/xforms/form_toc.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/form_url.C
src/frontends/xforms/FormUrl.C
src/frontends/xforms/FormVCLog.C src/frontends/xforms/FormVCLog.C
src/frontends/xforms/input_validators.C src/frontends/xforms/input_validators.C
src/frontends/xforms/Menubar_pimpl.C src/frontends/xforms/Menubar_pimpl.C
@ -166,6 +166,7 @@ src/insets/inseterror.C
src/insets/insetert.C src/insets/insetert.C
src/insets/insetexternal.C src/insets/insetexternal.C
src/insets/insetfloat.C src/insets/insetfloat.C
src/insets/insetfloatlist.C
src/insets/insetfoot.C src/insets/insetfoot.C
src/insets/insetgraphics.C src/insets/insetgraphics.C
src/insets/insetinclude.C src/insets/insetinclude.C

View File

@ -53,6 +53,7 @@
#include "insets/insettabular.h" #include "insets/insettabular.h"
#include "insets/insettheorem.h" #include "insets/insettheorem.h"
#include "insets/insetcaption.h" #include "insets/insetcaption.h"
#include "insets/insetfloatlist.h"
#include "mathed/formulamacro.h" #include "mathed/formulamacro.h"
#include "gettext.h" #include "gettext.h"
@ -1428,21 +1429,9 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
break; break;
case LFUN_TOC_INSERT: case LFUN_TOC_INSERT:
case LFUN_LOA_INSERT:
case LFUN_LOF_INSERT:
case LFUN_LOT_INSERT:
{ {
InsetCommandParams p; InsetCommandParams p;
p.setCmdName("tableofcontents");
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");
Inset * inset = new InsetTOC(p); Inset * inset = new InsetTOC(p);
if (!bv_->insertInset(inset, "Standard", true)) if (!bv_->insertInset(inset, "Standard", true))
delete inset; delete inset;
@ -2868,6 +2857,15 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
} }
break; 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: case LFUN_INSERT_NOTE:
bv_->insertNote(); bv_->insertNote();
break; break;

View File

@ -1,3 +1,34 @@
2001-05-04 Lars Gullik Bjønnes <larsbj@birdstep.com>
* 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<string> Strings,
and use it.
(expand::ExportFormats): introduce typedef vector<Format const *>
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 <kayvan@sylvan.com> 2001-04-28 Kayvan A. Sylvan <kayvan@sylvan.com>
* LaTeX.C (run): Fix problem with --export code. * LaTeX.C (run): Fix problem with --export code.

View File

@ -3,7 +3,7 @@
* *
* LyX, The Document Processor * LyX, The Document Processor
* *
* Copyright 1998-2000 The LyX Team. * Copyright 1998-2001 The LyX Team.
* *
* ====================================================== * ======================================================
*/ */

View File

@ -4,7 +4,7 @@
* *
* LyX, The Document Processor * LyX, The Document Processor
* *
* Copyright 1998-2000 The LyX Team. * Copyright 1998-2001 The LyX Team.
* *
* ====================================================== * ======================================================
*/ */

View File

@ -272,18 +272,6 @@ void LyXAction::init()
{ LFUN_ENDSEL, "line-end-select", { LFUN_ENDSEL, "line-end-select",
N_("Select to end of line"), ReadOnly }, N_("Select to end of line"), ReadOnly },
{ LFUN_INSET_LIST, "list-insert", "", Noop }, { 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_QUIT, "lyx-quit", N_("Exit"), NoBuffer },
{ LFUN_INSET_MARGINAL, "marginalnote-insert", { LFUN_INSET_MARGINAL, "marginalnote-insert",
N_("Insert Marginalnote"), Noop }, N_("Insert Marginalnote"), Noop },
@ -418,6 +406,7 @@ void LyXAction::init()
N_("Pop old message and show it in the minibuffer"), N_("Pop old message and show it in the minibuffer"),
NoBuffer }, NoBuffer },
{ LFUN_TRANSPOSE_CHARS, "chars-transpose", "", Noop }, { LFUN_TRANSPOSE_CHARS, "chars-transpose", "", Noop },
{ LFUN_FLOAT_LIST, "float-list", "Insert a float list", Noop },
{ LFUN_NOACTION, "", "", Noop } { LFUN_NOACTION, "", "", Noop }
}; };

View File

@ -4,18 +4,17 @@
* LyX, The Document Processor * LyX, The Document Processor
* *
* Copyright 1995 Matthias Ettrich * Copyright 1995 Matthias Ettrich
* Copyright 1995-2000 The LyX Team. * Copyright 1995-2001 The LyX Team.
* *
* *
* ====================================================== */ * ====================================================== */
#include <config.h>
#ifdef __GNUG__ #ifdef __GNUG__
#pragma implementation #pragma implementation
#endif #endif
#include <config.h>
#include <memory>
#include "support/LAssert.h"
#include "MenuBackend.h" #include "MenuBackend.h"
#include "lyxlex.h" #include "lyxlex.h"
#include "LyXAction.h" #include "LyXAction.h"
@ -26,6 +25,8 @@
#include "converter.h" #include "converter.h"
#include "exporter.h" #include "exporter.h"
#include "importer.h" #include "importer.h"
#include "FloatList.h"
#include "support/LAssert.h"
#include "support/filetools.h" #include "support/filetools.h"
#include "support/lyxfunctional.h" #include "support/lyxfunctional.h"
@ -56,6 +57,8 @@ MenuItem::MenuItem(Kind kind, string const & label,
case UpdateFormats: case UpdateFormats:
case ExportFormats: case ExportFormats:
case ImportFormats: case ImportFormats:
case FloatListInsert:
case FloatInsert:
break; break;
case Command: case Command:
action_ = lyxaction.LookupFunc(command); action_ = lyxaction.LookupFunc(command);
@ -97,6 +100,8 @@ Menu & Menu::read(LyXLex & lex)
md_toc, md_toc,
md_updateformats, md_updateformats,
md_viewformats, md_viewformats,
md_floatlistinsert,
md_floatinsert,
md_last md_last
}; };
@ -104,6 +109,8 @@ Menu & Menu::read(LyXLex & lex)
{ "documents", md_documents }, { "documents", md_documents },
{ "end", md_endmenu }, { "end", md_endmenu },
{ "exportformats", md_exportformats }, { "exportformats", md_exportformats },
{ "floatinsert", md_floatinsert },
{ "floatlistinsert", md_floatlistinsert },
{ "importformats", md_importformats }, { "importformats", md_importformats },
{ "item", md_item }, { "item", md_item },
{ "lastfiles", md_lastfiles }, { "lastfiles", md_lastfiles },
@ -129,7 +136,7 @@ Menu & Menu::read(LyXLex & lex)
// fallback to md_item // fallback to md_item
case md_item: { case md_item: {
lex.next(); lex.next();
string name = _(lex.GetString()); string const name = _(lex.GetString());
lex.next(); lex.next();
string const command = lex.GetString(); string const command = lex.GetString();
add(MenuItem(MenuItem::Command, name, add(MenuItem(MenuItem::Command, name,
@ -170,6 +177,14 @@ Menu & Menu::read(LyXLex & lex)
add(MenuItem(MenuItem::ImportFormats)); add(MenuItem(MenuItem::ImportFormats));
break; break;
case md_floatlistinsert:
add(MenuItem(MenuItem::FloatListInsert));
break;
case md_floatinsert:
add(MenuItem(MenuItem::FloatInsert));
break;
case md_submenu: { case md_submenu: {
lex.next(); lex.next();
string mlabel = _(lex.GetString()); string mlabel = _(lex.GetString());
@ -239,9 +254,10 @@ void Menu::expand(Menu & tomenu, Buffer * buf) const
switch ((*cit).kind()) { switch ((*cit).kind()) {
case MenuItem::Lastfiles: { case MenuItem::Lastfiles: {
int ii = 1; int ii = 1;
for (LastFiles::const_iterator lfit = lastfiles->begin(); LastFiles::const_iterator lfit = lastfiles->begin();
lfit != lastfiles->end() && ii < 10; LastFiles::const_iterator end = lastfiles->end();
++lfit, ++ii) {
for (; lfit != end && ii < 10; ++lfit, ++ii) {
string const label = tostr(ii) + ". " string const label = tostr(ii) + ". "
+ MakeDisplayPath((*lfit), 30) + MakeDisplayPath((*lfit), 30)
+ '|' + tostr(ii); + '|' + tostr(ii);
@ -255,7 +271,9 @@ void Menu::expand(Menu & tomenu, Buffer * buf) const
break; break;
case MenuItem::Documents: { case MenuItem::Documents: {
vector<string> const names = bufferlist.getFileNames(); typedef vector<string> Strings;
Strings const names = bufferlist.getFileNames();
if (names.empty()) { if (names.empty()) {
tomenu.add(MenuItem(MenuItem::Command, tomenu.add(MenuItem(MenuItem::Command,
@ -264,10 +282,12 @@ void Menu::expand(Menu & tomenu, Buffer * buf) const
break; break;
} }
for (vector<string>::const_iterator docit = names.begin(); Strings::const_iterator docit = names.begin();
docit != names.end() ; ++docit) { Strings::const_iterator end = names.end();
int const action = for (; docit != end ; ++docit) {
lyxaction.getPseudoAction(LFUN_SWITCHBUFFER, *docit); int const action = lyxaction
.getPseudoAction(LFUN_SWITCHBUFFER,
*docit);
string const label = string const label =
MakeDisplayPath(*docit, 30); MakeDisplayPath(*docit, 30);
tomenu.add(MenuItem(MenuItem::Command, tomenu.add(MenuItem(MenuItem::Command,
@ -280,7 +300,10 @@ void Menu::expand(Menu & tomenu, Buffer * buf) const
case MenuItem::ViewFormats: case MenuItem::ViewFormats:
case MenuItem::UpdateFormats: case MenuItem::UpdateFormats:
case MenuItem::ExportFormats: { case MenuItem::ExportFormats: {
vector<Format const *> formats; typedef vector<Format const *> Formats;
Formats formats;
kb_action action; kb_action action;
switch ((*cit).kind()) { switch ((*cit).kind()) {
case MenuItem::ImportFormats: case MenuItem::ImportFormats:
@ -301,8 +324,10 @@ void Menu::expand(Menu & tomenu, Buffer * buf) const
} }
sort(formats.begin(), formats.end(), compare_format()); sort(formats.begin(), formats.end(), compare_format());
for (vector<Format const *>::const_iterator fit = formats.begin(); Formats::const_iterator fit = formats.begin();
fit != formats.end() ; ++fit) { Formats::const_iterator end = formats.end();
for (; fit != end ; ++fit) {
if ((*fit)->dummy()) if ((*fit)->dummy())
continue; continue;
string label = (*fit)->prettyname(); string label = (*fit)->prettyname();
@ -314,13 +339,45 @@ void Menu::expand(Menu & tomenu, Buffer * buf) const
if (!(*fit)->shortcut().empty()) if (!(*fit)->shortcut().empty())
label += "|" + (*fit)->shortcut(); label += "|" + (*fit)->shortcut();
int const action2 = lyxaction. int const action2 = lyxaction.
getPseudoAction(action, (*fit)->name()); getPseudoAction(action,
(*fit)->name());
tomenu.add(MenuItem(MenuItem::Command, tomenu.add(MenuItem(MenuItem::Command,
label, action2)); label, action2));
} }
} }
break; 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: default:
tomenu.add(*cit); tomenu.add(*cit);
} }
@ -331,6 +388,7 @@ void Menu::expand(Menu & tomenu, Buffer * buf) const
checkShortcuts(); checkShortcuts();
} }
bool Menu::hasSubmenu(string const & name) const bool Menu::hasSubmenu(string const & name) const
{ {
return find_if(begin(), end(), return find_if(begin(), end(),

View File

@ -55,7 +55,13 @@ public:
ExportFormats, ExportFormats,
/** This is a list of importable formats /** This is a list of importable formats
typically for the File->Export menu. */ 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 /// Create a Command type MenuItem
MenuItem(Kind kind, MenuItem(Kind kind,

View File

@ -70,9 +70,6 @@ void ToolbarDefaults::init()
add(LFUN_FIGURE); add(LFUN_FIGURE);
add(LFUN_DIALOG_TABULAR_INSERT); add(LFUN_DIALOG_TABULAR_INSERT);
#if 0
//add(LFUN_MELT);
#endif
} }

View File

@ -77,6 +77,7 @@
#include "insets/insettabular.h" #include "insets/insettabular.h"
#include "insets/insettheorem.h" #include "insets/insettheorem.h"
#include "insets/insetcaption.h" #include "insets/insetcaption.h"
#include "insets/insetfloatlist.h"
#include "support/filetools.h" #include "support/filetools.h"
#include "support/path.h" #include "support/path.h"
#include "LaTeX.h" #include "LaTeX.h"
@ -1181,40 +1182,44 @@ void Buffer::readInset(LyXLex & lex, LyXParagraph *& par,
InsetCommandParams inscmd; InsetCommandParams inscmd;
inscmd.Read(lex); inscmd.Read(lex);
if (inscmd.getCmdName() == "cite") { string const cmdName = inscmd.getCmdName();
if (cmdName == "cite") {
inset = new InsetCitation(inscmd); inset = new InsetCitation(inscmd);
} else if (inscmd.getCmdName() == "bibitem") { } else if (cmdName == "bibitem") {
lex.printError("Wrong place for bibitem"); lex.printError("Wrong place for bibitem");
inset = new InsetBibKey(inscmd); inset = new InsetBibKey(inscmd);
} else if (inscmd.getCmdName() == "BibTeX") { } else if (cmdName == "BibTeX") {
inset = new InsetBibtex(inscmd); inset = new InsetBibtex(inscmd);
} else if (inscmd.getCmdName() == "index") { } else if (cmdName == "index") {
inset = new InsetIndex(inscmd); inset = new InsetIndex(inscmd);
} else if (inscmd.getCmdName() == "include") { } else if (cmdName == "include") {
inset = new InsetInclude(inscmd, *this); inset = new InsetInclude(inscmd, *this);
} else if (inscmd.getCmdName() == "label") { } else if (cmdName == "label") {
inset = new InsetLabel(inscmd); inset = new InsetLabel(inscmd);
} else if (inscmd.getCmdName() == "url" } else if (cmdName == "url"
|| inscmd.getCmdName() == "htmlurl") { || cmdName == "htmlurl") {
inset = new InsetUrl(inscmd); inset = new InsetUrl(inscmd);
} else if (inscmd.getCmdName() == "ref" } else if (cmdName == "ref"
|| inscmd.getCmdName() == "pageref" || cmdName == "pageref"
|| inscmd.getCmdName() == "vref" || cmdName == "vref"
|| inscmd.getCmdName() == "vpageref" || cmdName == "vpageref"
|| inscmd.getCmdName() == "prettyref") { || cmdName == "prettyref") {
if (!inscmd.getOptions().empty() if (!inscmd.getOptions().empty()
|| !inscmd.getContents().empty()) { || !inscmd.getContents().empty()) {
inset = new InsetRef(inscmd, *this); inset = new InsetRef(inscmd, *this);
} }
} else if (inscmd.getCmdName() == "tableofcontents" } else if (cmdName == "tableofcontents") {
|| inscmd.getCmdName() == "listofalgorithms"
|| inscmd.getCmdName() == "listoffigures"
|| inscmd.getCmdName() == "listoftables"
|| inscmd.getCmdName() == "listof{algorithm}{List of Algorithms}") {
inset = new InsetTOC(inscmd); 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); inset = new InsetPrintIndex(inscmd);
} else if (inscmd.getCmdName() == "lyxparent") { } else if (cmdName == "lyxparent") {
inset = new InsetParent(inscmd, *this); inset = new InsetParent(inscmd, *this);
} }
} else { } else {
@ -1257,6 +1262,8 @@ void Buffer::readInset(LyXLex & lex, LyXParagraph *& par,
inset = new InsetCaption; inset = new InsetCaption;
} else if (tmptok == "GRAPHICS") { } else if (tmptok == "GRAPHICS") {
inset = new InsetGraphics; inset = new InsetGraphics;
} else if (tmptok == "FloatList") {
inset = new InsetFloatList;
} }
if (inset) inset->Read(this, lex); if (inset) inset->Read(this, lex);
@ -3362,53 +3369,53 @@ Buffer::Lists const Buffer::getLists() const
.NumberOfLayout(params.textclass, "Caption"); .NumberOfLayout(params.textclass, "Caption");
while (par) { while (par) {
char const labeltype = char const labeltype =
textclasslist.Style(params.textclass, textclasslist.Style(params.textclass,
par->GetLayout()).labeltype; par->GetLayout()).labeltype;
if (labeltype >= LABEL_COUNTER_CHAPTER if (labeltype >= LABEL_COUNTER_CHAPTER
&& labeltype <= LABEL_COUNTER_CHAPTER + params.tocdepth) { && labeltype <= LABEL_COUNTER_CHAPTER + params.tocdepth) {
// insert this into the table of contents // insert this into the table of contents
SingleList & item = l["TOC"]; SingleList & item = l["TOC"];
int depth = max(0, int depth = max(0,
labeltype - labeltype -
textclasslist.TextClass(params.textclass).maxcounter()); textclasslist.TextClass(params.textclass).maxcounter());
item.push_back(TocItem(par, depth, par->String(this, true))); item.push_back(TocItem(par, depth, par->String(this, true)));
} }
// For each paragrph, traverse its insets and look for // For each paragrph, traverse its insets and look for
// FLOAT_CODE // FLOAT_CODE
if (found) { if (found) {
LyXParagraph::inset_iterator it = LyXParagraph::inset_iterator it =
par->inset_iterator_begin(); par->inset_iterator_begin();
LyXParagraph::inset_iterator end = LyXParagraph::inset_iterator end =
par->inset_iterator_end(); par->inset_iterator_end();
for (; it != end; ++it) { for (; it != end; ++it) {
if ((*it)->LyxCode() == Inset::FLOAT_CODE) { if ((*it)->LyxCode() == Inset::FLOAT_CODE) {
InsetFloat * il = InsetFloat * il =
static_cast<InsetFloat*>(*it); static_cast<InsetFloat*>(*it);
string const type = il->type(); string const type = il->type();
// Now find the caption in the float... // Now find the caption in the float...
// We now tranverse the paragraphs of // We now tranverse the paragraphs of
// the inset... // the inset...
LyXParagraph * tmp = il->inset.par; LyXParagraph * tmp = il->inset.par;
while (tmp) { while (tmp) {
if (tmp->layout == cap) { if (tmp->layout == cap) {
SingleList & item = l[type]; SingleList & item = l[type];
string const str = string const str =
tostr(item.size()+1) + ". " + tmp->String(this, false); tostr(item.size()+1) + ". " + tmp->String(this, false);
item.push_back(TocItem(tmp, 0 , str)); item.push_back(TocItem(tmp, 0 , str));
}
tmp = tmp->next();
} }
tmp = tmp->next();
} }
} }
} else {
lyxerr << "caption not found" << endl;
} }
} else {
lyxerr << "caption not found" << endl;
}
par = par->next(); par = par->next();
} }

View File

@ -144,9 +144,6 @@ enum kb_action {
LFUN_MATH_EXTERN, // Andre' 20010424 LFUN_MATH_EXTERN, // Andre' 20010424
LFUN_MATH_PANEL, LFUN_MATH_PANEL,
LFUN_FIGURE, LFUN_FIGURE,
#if 0
LFUN_MELT,
#endif
LFUN_DELETE_WORD_FORWARD, LFUN_DELETE_WORD_FORWARD,
LFUN_DELETE_WORD_BACKWARD, LFUN_DELETE_WORD_BACKWARD,
LFUN_DELETE_LINE_FORWARD, LFUN_DELETE_LINE_FORWARD,
@ -208,9 +205,7 @@ enum kb_action {
LFUN_CHILD_INSERT, // Ale 970521 LFUN_CHILD_INSERT, // Ale 970521
LFUN_CHILDOPEN, // Ale 970528 LFUN_CHILDOPEN, // Ale 970528
LFUN_TOC_INSERT, // Lgb 97-05-27 LFUN_TOC_INSERT, // Lgb 97-05-27
LFUN_LOA_INSERT, // Bernhard 97-08-07 LFUN_FLOAT_LIST, // Lgb 20010503
LFUN_LOF_INSERT, // Lgb 97-05-27
LFUN_LOT_INSERT, // Lgb 97-05-27
LFUN_READ_ONLY_TOGGLE, // Lgb 97-05-27 LFUN_READ_ONLY_TOGGLE, // Lgb 97-05-27
LFUN_BIBDB_ADD, // Ale 970530 LFUN_BIBDB_ADD, // Ale 970530
LFUN_BIBDB_DEL, // Ale 970530 LFUN_BIBDB_DEL, // Ale 970530

View File

@ -1,3 +1,7 @@
2001-05-04 Lars Gullik Bjønnes <larsbj@birdstep.com>
* ControlToc.C (getType): remove support for old float list.
2001-04-26 Angus Leeming <a.leeming@ic.ac.uk> 2001-04-26 Angus Leeming <a.leeming@ic.ac.uk>
* ControlButtons.h: no longer include ButtonControllerBase.h, ViewBase.h * ControlButtons.h: no longer include ButtonControllerBase.h, ViewBase.h

View File

@ -92,7 +92,7 @@ Buffer::SingleList const ControlToc::getContents(string const & type) const
namespace toc namespace toc
{ {
string getType(string const & cmdName) string const getType(string const & cmdName)
{ {
string type; string type;
@ -101,16 +101,7 @@ string getType(string const & cmdName)
if (cmdName == "tableofcontents" ) if (cmdName == "tableofcontents" )
type = "TOC"; type = "TOC";
else if (cmdName == "listofalgorithms" ) return cmdName;
type = "algorithm";
else if (cmdName == "listoffigures" )
type = "figure";
else
type = "table";
return type;
} }
} // namespace toc } // namespace toc

View File

@ -1,3 +1,4 @@
// -*- C++ -*-
/* This file is part of /* This file is part of
* ====================================================== * ======================================================
* *
@ -43,7 +44,7 @@ namespace toc
{ {
/** Given the cmdName of the TOC param, returns the type used /** Given the cmdName of the TOC param, returns the type used
by ControlToc::getContents() */ by ControlToc::getContents() */
string getType(string const & cmdName); string const getType(string const & cmdName);
} // namespace toc } // namespace toc

View File

@ -1,3 +1,9 @@
2001-05-04 Lars Gullik Bjønnes <larsbj@birdstep.com>
* 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 <larsbj@birdstep.com> 2001-05-03 Lars Gullik Bjønnes <larsbj@birdstep.com>
* FormParagraph.[Ch]: remove !NO_PEXTRA and !NEW_INSETS cruft * FormParagraph.[Ch]: remove !NO_PEXTRA and !NEW_INSETS cruft

View File

@ -1,3 +1,4 @@
// -*- C++ -*-
/* This file is part of /* This file is part of
* ====================================================== * ======================================================
* *
@ -30,7 +31,6 @@ class FormToc : public FormCB<ControlToc, FormDB<FD_form_toc> > {
public: public:
/// ///
FormToc(ControlToc &); FormToc(ControlToc &);
private: private:
/// not needed /// not needed
virtual void apply() {} virtual void apply() {}

View File

@ -3,9 +3,9 @@
* *
* LyX, The Document Processor * LyX, The Document Processor
* *
* Copyright (C) 1999 The LyX Team. * Copyright 1999-2001 The LyX Team.
* *
*======================================================*/ * ======================================================*/
#include <config.h> #include <config.h>
@ -15,18 +15,19 @@
#pragma implementation #pragma implementation
#endif #endif
#include "support/lstrings.h" #include "Menubar_pimpl.h"
#include "support/LAssert.h" #include "MenuBackend.h"
#include "debug.h"
#include "LyXAction.h" #include "LyXAction.h"
#include "kbmap.h" #include "kbmap.h"
#include "buffer.h" #include "buffer.h"
#include "Dialogs.h" #include "Dialogs.h"
#include "LyXView.h" #include "LyXView.h"
#include "lyxfunc.h" #include "lyxfunc.h"
#include "MenuBackend.h" #include "FloatList.h"
#include "Menubar_pimpl.h" #include "support/lstrings.h"
#include "support/LAssert.h"
#include "gettext.h" #include "gettext.h"
#include "debug.h"
using std::endl; using std::endl;
using std::vector; using std::vector;
@ -41,21 +42,21 @@ extern LyXAction lyxaction;
namespace { namespace {
// Some constants // Some constants
const int MENU_LABEL_SIZE = FL_NORMAL_SIZE; int const MENU_LABEL_SIZE = FL_NORMAL_SIZE;
const int mheight = 30; int const mheight = 30;
const int mbheight= 22; int const mbheight= 22;
// where to place the menubar? // where to place the menubar?
const int yloc = (mheight - mbheight)/2; //air + bw; int const yloc = (mheight - mbheight)/2; //air + bw;
const int mbadd = 20; // menu button add (to width) int const mbadd = 20; // menu button add (to width)
// Some space between buttons on the menubar // Some space between buttons on the menubar
const int air = 2; int const air = 2;
char const * menu_tabstop = "aa"; char const * menu_tabstop = "aa";
char const * default_tabstop = "aaaaaaaa"; char const * default_tabstop = "aaaaaaaa";
// We do not want to mix position values in a menu (like the index of // 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. // a submenu) with the action numbers which convey actual information.
// Therefore we offset all the action values by an arbitrary large // Therefore we offset all the action values by an arbitrary large
// constant. // constant.
const int action_offset = 1000; int const action_offset = 1000;
// This is used a few times below. // This is used a few times below.
inline 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(); FL_FORM * form = owner_->getForm();
int moffset = 0; int moffset = 0;
@ -106,17 +107,18 @@ void Menubar::Pimpl::makeMenubar(Menu const &menu)
fl_set_object_gravity(frame, NorthWestGravity, fl_set_object_gravity(frame, NorthWestGravity,
NorthEastGravity); NorthEastGravity);
for (Menu::const_iterator i = menu.begin(); Menu::const_iterator i = menu.begin();
i != menu.end(); ++i) { Menu::const_iterator end = menu.end();
for (; i != end; ++i) {
FL_OBJECT * obj; FL_OBJECT * obj;
if (i->kind() != MenuItem::Submenu) { if (i->kind() != MenuItem::Submenu) {
lyxerr << "ERROR: Menubar::Pimpl::createMenubar:" lyxerr << "ERROR: Menubar::Pimpl::createMenubar:"
" only submenus can appear in a menubar"; " only submenus can appear in a menubar";
break; break;
} }
string label = i->label(); string const label = i->label();
string shortcut = "#" + i->shortcut(); string const shortcut = "#" + i->shortcut();
int width = string_width(label); int const width = string_width(label);
obj = fl_add_button(FL_MENU_BUTTON, obj = fl_add_button(FL_MENU_BUTTON,
air + moffset, yloc, air + moffset, yloc,
width + mbadd, 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_shortcut(obj, shortcut.c_str(), 1);
fl_set_object_callback(obj, C_Menubar_Pimpl_MenuCallback, 1); fl_set_object_callback(obj, C_Menubar_Pimpl_MenuCallback, 1);
boost::shared_ptr<ItemInfo> iteminfo(new ItemInfo(this, boost::shared_ptr<ItemInfo>
new MenuItem(*i), obj)); iteminfo(new ItemInfo(this, new MenuItem(*i), obj));
buttonlist_.push_back(iteminfo); buttonlist_.push_back(iteminfo);
obj->u_vdata = iteminfo.get(); obj->u_vdata = iteminfo.get();
} }
} }
void Menubar::Pimpl::set(string const & menu_name) void Menubar::Pimpl::set(string const & menu_name)
{ {
lyxerr[Debug::GUI] << "Entering Menubar::Pimpl::set " lyxerr[Debug::GUI] << "Entering Menubar::Pimpl::set "
@ -168,12 +171,12 @@ void Menubar::Pimpl::set(string const & menu_name)
current_group_ = mbit->second; current_group_ = mbit->second;
lyxerr[Debug::GUI] << "Menubar::Pimpl::set: Menubar set." lyxerr[Debug::GUI] << "Menubar::Pimpl::set: Menubar set."
<< endl; << endl;
} } else
else
lyxerr [Debug::GUI] << "Menubar::Pimpl::set: Nothing to do." lyxerr [Debug::GUI] << "Menubar::Pimpl::set: Nothing to do."
<< endl; << endl;
} }
void Menubar::Pimpl::openByName(string const & name) void Menubar::Pimpl::openByName(string const & name)
{ {
if (menubackend_->getMenu(current_menu_name_).hasSubmenu(name)) { if (menubackend_->getMenu(current_menu_name_).hasSubmenu(name)) {
@ -319,60 +322,6 @@ void add_toc2(int menu, string const & extra_label,
void Menubar::Pimpl::add_toc(int menu, string const & extra_label, void Menubar::Pimpl::add_toc(int menu, string const & extra_label,
vector<int> & smn, Window win) vector<int> & 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<vector<Buffer::TocItem> > 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 toc_list = owner_->buffer()->getLists();
Buffer::Lists::const_iterator cit = toc_list.begin(); Buffer::Lists::const_iterator cit = toc_list.begin();
Buffer::Lists::const_iterator end = toc_list.end(); Buffer::Lists::const_iterator end = toc_list.end();
@ -380,6 +329,7 @@ void Menubar::Pimpl::add_toc(int menu, string const & extra_label,
// Handle this elsewhere // Handle this elsewhere
if (cit->first == "TOC") continue; if (cit->first == "TOC") continue;
// All the rest is for floats
int menu2 = get_new_submenu(smn, win); int menu2 = get_new_submenu(smn, win);
Buffer::SingleList::const_iterator ccit = cit->second.begin(); Buffer::SingleList::const_iterator ccit = cit->second.begin();
Buffer::SingleList::const_iterator eend = cit->second.end(); 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); label += "%x" + tostr(action + action_offset);
fl_addtopup(menu2, label.c_str()); 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); 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, add_toc2(menu, extra_label, smn, win,
cit->second, 0, cit->second.size(), 0); cit->second, 0, cit->second.size(), 0);
} }
#endif
} }
int Menubar::Pimpl::create_submenu(Window win, LyXView * view, int Menubar::Pimpl::create_submenu(Window win, LyXView * view,
string const & menu_name, string const & menu_name,
vector<int> & smn) vector<int> & smn)
@ -421,10 +370,10 @@ int Menubar::Pimpl::create_submenu(Window win, LyXView * view,
<< menu_name << "'" << endl; << menu_name << "'" << endl;
return -1; return -1;
} }
Menu md = Menu(); Menu md;
menubackend_->getMenu(menu_name).expand(md, owner_->buffer()); 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_softedge(menu, true);
fl_setpup_bw(menu, -1); fl_setpup_bw(menu, -1);
lyxerr[Debug::GUI] << "Adding menu " << menu 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) { for (Menu::const_iterator i = md.begin(); i != end; ++i) {
MenuItem const & item = (*i); MenuItem const & item = (*i);
if (item.kind() == MenuItem::Command) { if (item.kind() == MenuItem::Command) {
string label = item.label() + '\t'; string const label = item.label() + '\t';
int width = string_width(label); int const width = string_width(label);
if (width > max_width) { if (width > max_width) {
max_width = width; max_width = width;
widest_label = label; widest_label = label;
@ -538,8 +487,7 @@ int Menubar::Pimpl::create_submenu(Window win, LyXView * view,
label += "%h"; label += "%h";
fl_addtopup(menu, label.c_str(), fl_addtopup(menu, label.c_str(),
submenu, shortcut.c_str()); submenu, shortcut.c_str());
} } else {
else {
fl_addtopup(menu, label.c_str(), submenu); fl_addtopup(menu, label.c_str(), submenu);
} }
break; break;
@ -560,6 +508,8 @@ int Menubar::Pimpl::create_submenu(Window win, LyXView * view,
case MenuItem::UpdateFormats: case MenuItem::UpdateFormats:
case MenuItem::ExportFormats: case MenuItem::ExportFormats:
case MenuItem::ImportFormats: case MenuItem::ImportFormats:
case MenuItem::FloatListInsert:
case MenuItem::FloatInsert:
lyxerr << "Menubar::Pimpl::create_submenu: " lyxerr << "Menubar::Pimpl::create_submenu: "
"this should not happen" << endl; "this should not happen" << endl;
break; break;

View File

@ -84,6 +84,7 @@ bool Importer::Import(LyXView * lv, string const & filename,
return true; return true;
} }
#if 0 #if 0
bool Importer::IsImportable(string const & format) bool Importer::IsImportable(string const & format)
{ {
@ -96,6 +97,7 @@ bool Importer::IsImportable(string const & format)
} }
#endif #endif
vector<Format const *> const Importer::GetImportableFormats() vector<Format const *> const Importer::GetImportableFormats()
{ {
vector<string> loaders = Loaders(); vector<string> loaders = Loaders();

View File

@ -1,3 +1,16 @@
2001-05-04 Lars Gullik Bjønnes <larsbj@birdstep.com>
* 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 <a.leeming@ic.ac.uk> 2001-04-27 Angus Leeming <a.leeming@ic.ac.uk>
* insettabular.C (LocalDispatch): * insettabular.C (LocalDispatch):

View File

@ -33,6 +33,8 @@ libinsets_la_SOURCES = \
insetexternal.h \ insetexternal.h \
insetfloat.h \ insetfloat.h \
insetfloat.C \ insetfloat.C \
insetfloatlist.C \
insetfloatlist.h \
insetfoot.C \ insetfoot.C \
insetfoot.h \ insetfoot.h \
insetfootlike.C \ insetfootlike.C \

View File

@ -18,6 +18,7 @@
#include "debug.h" #include "debug.h"
#include "BufferView.h" #include "BufferView.h"
#include "Painter.h" #include "Painter.h"
#include "support/LAssert.h"
using std::ostream; using std::ostream;
using std::endl; using std::endl;
@ -25,11 +26,15 @@ using std::endl;
int InsetButton::ascent(BufferView * bv, LyXFont const &) const int InsetButton::ascent(BufferView * bv, LyXFont const &) const
{ {
lyx::Assert(bv);
LyXFont font(LyXFont::ALL_SANE); LyXFont font(LyXFont::ALL_SANE);
font.decSize(); font.decSize();
int width, ascent, descent; int width;
string s = getScreenLabel(); int ascent;
int descent;
string const s = getScreenLabel();
if (Editable()) { if (Editable()) {
bv->painter().buttonText(0, 0, s, font, 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 int InsetButton::descent(BufferView * bv, LyXFont const &) const
{ {
lyx::Assert(bv);
LyXFont font(LyXFont::ALL_SANE); LyXFont font(LyXFont::ALL_SANE);
font.decSize(); font.decSize();
int width, ascent, descent; int width;
string s = getScreenLabel(); int ascent;
int descent;
string const s = getScreenLabel();
if (Editable()) { if (Editable()) {
bv->painter().buttonText(0, 0, s, font, 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 int InsetButton::width(BufferView * bv, LyXFont const &) const
{ {
lyx::Assert(bv);
LyXFont font(LyXFont::ALL_SANE); LyXFont font(LyXFont::ALL_SANE);
font.decSize(); font.decSize();
int width, ascent, descent; int width;
string s = getScreenLabel(); int ascent;
//if (!bv) int descent;
// int(s.length()); string const s = getScreenLabel();
if (Editable()) { if (Editable()) {
bv->painter().buttonText(0, 0, s, font, 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 &, void InsetButton::draw(BufferView * bv, LyXFont const &,
int baseline, float & x, bool) const int baseline, float & x, bool) const
{ {
lyx::Assert(bv);
Painter & pain = bv->painter(); Painter & pain = bv->painter();
// Draw it as a box with the LaTeX text // Draw it as a box with the LaTeX text
LyXFont font(LyXFont::ALL_SANE); LyXFont font(LyXFont::ALL_SANE);
font.setColor(LColor::command).decSize(); font.setColor(LColor::command).decSize();
int width; int width;
string s = getScreenLabel(); string const s = getScreenLabel();
if (Editable()) { if (Editable()) {
pain.buttonText(int(x)+2, baseline, s, font, true, width); pain.buttonText(int(x) + 2, baseline, s, font, true, width);
} else { } else {
pain.rectText(int(x)+2, baseline, s, font, pain.rectText(int(x) + 2, baseline, s, font,
LColor::commandbg, LColor::commandframe, LColor::commandbg, LColor::commandframe,
true, width); true, width);
} }

115
src/insets/insetfloatlist.C Normal file
View File

@ -0,0 +1,115 @@
#include <config.h>
#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;
}

View File

@ -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

View File

@ -20,12 +20,7 @@ string const InsetTOC::getScreenLabel() const
if (cmdname == "tableofcontents") if (cmdname == "tableofcontents")
return _("Table of Contents"); return _("Table of Contents");
else if (cmdname == "listof{algorithm}{List of Algorithms}") return _("Unknown toc list");
return _("List of Algorithms");
else if (cmdname == "listoffigures")
return _("List of Figures");
else
return _("List of Tables");
} }
@ -34,12 +29,7 @@ Inset::Code InsetTOC::LyxCode() const
string const cmdname(getCmdName()); string const cmdname(getCmdName());
if (cmdname == "tableofcontents") if (cmdname == "tableofcontents")
return Inset::TOC_CODE; return Inset::TOC_CODE;
else if (cmdname == "listof{algorithm}{List of Algorithms}") return Inset::NO_CODE;
return Inset::LOA_CODE;
else if (cmdname == "listoffigures")
return Inset::LOF_CODE;
else
return Inset::LOT_CODE;
} }
@ -53,39 +43,10 @@ int InsetTOC::Ascii(Buffer const * buffer, std::ostream & os, int) const
{ {
os << getScreenLabel() << "\n\n"; 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<vector<Buffer::TocItem> > const toc_list =
buffer->getTocList();
vector<Buffer::TocItem> const & toc = toc_list[type];
for (vector<Buffer::TocItem>::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 type;
string const cmdname = getCmdName(); string const cmdname = getCmdName();
if (cmdname == "tableofcontents") if (cmdname == "tableofcontents")
type = "TOC"; 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 toc_list = buffer->getLists();
Buffer::Lists::const_iterator cit = Buffer::Lists::const_iterator cit =
toc_list.find(type); toc_list.find(type);
@ -96,7 +57,7 @@ int InsetTOC::Ascii(Buffer const * buffer, std::ostream & os, int) const
os << string(4 * ccit->depth, ' ') os << string(4 * ccit->depth, ' ')
<< ccit->str << "\n"; << ccit->str << "\n";
} }
#endif
os << "\n"; os << "\n";
return 0; return 0;
} }

View File

@ -45,71 +45,67 @@ public:
/// ///
TOC_CODE, // do these insets really need a code? (ale) TOC_CODE, // do these insets really need a code? (ale)
/// ///
LOF_CODE, // 2 QUOTE_CODE,
///
LOT_CODE,
///
LOA_CODE,
///
QUOTE_CODE, // 5
/// ///
MARK_CODE, MARK_CODE,
/// ///
REF_CODE, REF_CODE, // 5
/// ///
URL_CODE, URL_CODE,
/// ///
HTMLURL_CODE, HTMLURL_CODE,
/// ///
SEPARATOR_CODE, // 10 SEPARATOR_CODE,
/// ///
ENDING_CODE, ENDING_CODE,
/// ///
LABEL_CODE, LABEL_CODE, // 10
/// ///
IGNORE_CODE, IGNORE_CODE,
/// ///
ACCENT_CODE, ACCENT_CODE,
/// ///
MATH_CODE, // 15 MATH_CODE,
/// ///
INDEX_CODE, INDEX_CODE,
/// ///
INCLUDE_CODE, INCLUDE_CODE, // 15
/// ///
GRAPHICS_CODE, GRAPHICS_CODE,
/// ///
PARENT_CODE, PARENT_CODE,
/// ///
BIBTEX_CODE, // 20 BIBTEX_CODE,
/// ///
TEXT_CODE, TEXT_CODE,
/// ///
ERT_CODE, ERT_CODE, // 20
/// ///
FOOT_CODE, FOOT_CODE,
/// ///
MARGIN_CODE, MARGIN_CODE,
/// ///
FLOAT_CODE, // 25 FLOAT_CODE,
/// ///
MINIPAGE_CODE, MINIPAGE_CODE,
/// ///
SPECIALCHAR_CODE, SPECIALCHAR_CODE, // 25
/// ///
TABULAR_CODE, TABULAR_CODE,
/// ///
EXTERNAL_CODE, EXTERNAL_CODE,
/// ///
THEOREM_CODE, // 30 THEOREM_CODE,
/// ///
CAPTION_CODE, CAPTION_CODE,
/// ///
MATHMACRO_CODE, MATHMACRO_CODE, // 30
/// ///
ERROR_CODE, 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) {} Inset() : top_x(0), top_baseline(0), scx(0), owner_(0) {}
/// /// Virtual base destructor
virtual ~Inset() {} virtual ~Inset() {}
/// ///
virtual int ascent(BufferView *, LyXFont const &) const = 0; virtual int ascent(BufferView *, LyXFont const &) const = 0;

View File

@ -456,10 +456,6 @@ LyXFunc::func_status LyXFunc::getStatus(int ac,
break; break;
case LFUN_INSERTFOOTNOTE: case LFUN_INSERTFOOTNOTE:
#if 0
case LFUN_FOOTMELT:
case LFUN_MARGINMELT:
#endif
// Disable insertion of floats in a tabular. // Disable insertion of floats in a tabular.
disable = false; disable = false;
if (owner->view()->theLockingInset()) { if (owner->view()->theLockingInset()) {
@ -918,21 +914,26 @@ string const LyXFunc::Dispatch(int ac,
break; break;
case LFUN_TOCVIEW: case LFUN_TOCVIEW:
#if 0
case LFUN_LOFVIEW: case LFUN_LOFVIEW:
case LFUN_LOTVIEW: case LFUN_LOTVIEW:
case LFUN_LOAVIEW: case LFUN_LOAVIEW:
#endif
{ {
InsetCommandParams p; InsetCommandParams p;
#if 0
if (action == LFUN_TOCVIEW) if (action == LFUN_TOCVIEW)
#endif
p.setCmdName("tableofcontents"); p.setCmdName("tableofcontents");
#if 0
else if (action == LFUN_LOAVIEW ) else if (action == LFUN_LOAVIEW )
p.setCmdName("listof{algorithm}{List of Algorithms}"); p.setCmdName("listof{algorithm}{List of Algorithms}");
else if (action == LFUN_LOFVIEW) else if (action == LFUN_LOFVIEW)
p.setCmdName("listoffigures"); p.setCmdName("listoffigures");
else else
p.setCmdName("listoftables"); p.setCmdName("listoftables");
#endif
owner->getDialogs()->createTOC(p.getAsString()); owner->getDialogs()->createTOC(p.getAsString());
break; break;
} }

View File

@ -174,6 +174,10 @@ int MiniBuffer::peek_event(FL_OBJECT * ob, int event, int key)
case 13: case 13:
case XK_Return: 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 // First check for match
vector<string>::const_iterator cit = vector<string>::const_iterator cit =
std::find(completion_.begin(), 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]"); string const tmp = input + _(" [no match]");
fl_set_input(ob, tmp.c_str()); fl_set_input(ob, tmp.c_str());
} else { } else {
#endif
// Return the inputted string // Return the inputted string
deactivate(); deactivate();
owner_->view()->focus(true); owner_->view()->focus(true);
history_->push_back(input); history_->push_back(input);
stringReady.emit(input); stringReady.emit(input);
# if 0
} }
#endif
return 1; return 1;
} }
case XK_space: case XK_space: