From b3c975de36808e17b4845e4e226036add956caa9 Mon Sep 17 00:00:00 2001 From: John Levon Date: Thu, 20 Jun 2002 23:01:16 +0000 Subject: [PATCH] bug 458 (dtrt with index entry insert) git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4445 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/BufferView_pimpl.C | 46 ++++++++--------------------- src/ChangeLog | 8 +++++ src/LyXAction.C | 4 +-- src/commandtags.h | 2 -- src/frontends/ChangeLog | 6 ++++ src/frontends/Dialogs.C | 4 +-- src/frontends/Dialogs.h | 2 +- src/frontends/controllers/ChangeLog | 4 +++ src/frontends/controllers/GUI.h | 2 +- src/frontends/guiapi.h | 2 +- src/frontends/qt2/ChangeLog | 4 +++ src/frontends/qt2/guiapi.C | 4 +-- src/frontends/xforms/ChangeLog | 4 +++ src/frontends/xforms/guiapi.C | 4 +-- src/lyxfunc.C | 2 -- 15 files changed, 48 insertions(+), 50 deletions(-) diff --git a/src/BufferView_pimpl.C b/src/BufferView_pimpl.C index 370afc9fed..cd2b197a73 100644 --- a/src/BufferView_pimpl.C +++ b/src/BufferView_pimpl.C @@ -2987,46 +2987,24 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) } break; - case LFUN_INDEX_CREATE: + case LFUN_INDEX_INSERT: { - InsetCommandParams p("index"); - if (argument.empty()) { - string const idxstring(bv_->getLyXText()->getStringToIndex(bv_)); - p.setContents(idxstring); - } else { - p.setContents(argument); + string entry = argument; + if (entry.empty()) { + entry = bv_->getLyXText()->getStringToIndex(bv_); } - owner_->getDialogs()->createIndex(p.getAsString()); - } - break; - - case LFUN_INDEX_INSERT: - { - InsetCommandParams p; - p.setFromString(argument); - InsetIndex * inset = new InsetIndex(p); + if (entry.empty()) { + owner_->getDialogs()->createIndex(); + break; + } - if (!insertInset(inset)) + InsetIndex * inset = new InsetIndex(InsetCommandParams("index", entry)); + + if (!insertInset(inset)) { delete inset; - else + } else { updateInset(inset, true); - } - break; - - case LFUN_INDEX_INSERT_LAST: - { - string const idxstring(bv_->getLyXText()->getStringToIndex(bv_)); - if (!idxstring.empty()) { - owner_->message(_("Word `") - + idxstring + _(("' indexed."))); - InsetCommandParams p("index", idxstring); - InsetIndex * inset = new InsetIndex(p); - - if (!insertInset(inset)) - delete inset; - else - updateInset(inset, true); } } break; diff --git a/src/ChangeLog b/src/ChangeLog index 52bfe6be88..0237d5c9b3 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,11 @@ +2002-06-20 John Levon + + * BufferView_pimpl.C: + * LyXAction.C: + * commandtags.h: + * lyxfunc.C: remove the six million index lyxfuncs to just + one, and DTRT (bug 458) + 2002-06-20 John Levon * BufferView.h: diff --git a/src/LyXAction.C b/src/LyXAction.C index ca434957ff..97872c3ebf 100644 --- a/src/LyXAction.C +++ b/src/LyXAction.C @@ -233,10 +233,8 @@ void LyXAction::init() N_("Insert hyphenation point"), Noop }, { LFUN_LIGATURE_BREAK, "ligature-break-insert", N_("Insert ligature break"), Noop }, - { LFUN_INDEX_CREATE, "index-insert", + { LFUN_INDEX_INSERT, "index-insert", N_("Insert index item"), Noop }, - { LFUN_INDEX_INSERT_LAST, "index-insert-last", - N_("Insert last index item"), Noop }, { LFUN_INDEX_PRINT, "index-print", N_("Insert index list"), Noop }, { LFUN_KMAP_OFF, "keymap-off", N_("Turn off keymap"), diff --git a/src/commandtags.h b/src/commandtags.h index 249e6bd105..19e6c611b7 100644 --- a/src/commandtags.h +++ b/src/commandtags.h @@ -201,8 +201,6 @@ enum kb_action { LFUN_RECONFIGURE, // 170 // Asger 1997-02-14 LFUN_CITATION_INSERT, // AAS 97-02-23 LFUN_INSERT_BIBTEX, // AAS 97-02-23 - LFUN_INDEX_CREATE, // Lgb 97-02-27 - LFUN_INDEX_INSERT_LAST, // Reh 98-09-17 LFUN_INDEX_PRINT, // Lgb 97-02-27 LFUN_APROPOS, // Asger 1997-02-27 LFUN_LATEX_LOG, // Lgb 97-04-05 diff --git a/src/frontends/ChangeLog b/src/frontends/ChangeLog index 9646213750..5ca86d3dd7 100644 --- a/src/frontends/ChangeLog +++ b/src/frontends/ChangeLog @@ -1,3 +1,9 @@ +2002-06-20 John Levon + + * guiapi.h: + * Dialogs.h: + * Dialogs.C: createIndex() doesn't take string + 2002-06-20 John Levon * WorkArea.h: remove unused resize(..) and change name diff --git a/src/frontends/Dialogs.C b/src/frontends/Dialogs.C index 01a67137ea..41fcf70ca6 100644 --- a/src/frontends/Dialogs.C +++ b/src/frontends/Dialogs.C @@ -144,9 +144,9 @@ void Dialogs::showIndex(InsetCommand * ic) } -void Dialogs::createIndex(string const & s) +void Dialogs::createIndex() { - gui_CreateIndex(s, *dialogs_lyxview, *this); + gui_CreateIndex(*dialogs_lyxview, *this); } diff --git a/src/frontends/Dialogs.h b/src/frontends/Dialogs.h index fd32e5ea90..b031c09408 100644 --- a/src/frontends/Dialogs.h +++ b/src/frontends/Dialogs.h @@ -123,7 +123,7 @@ public: /// void showIndex(InsetCommand *); /// - void createIndex(string const &); + void createIndex(); /// void showInfo(InsetInfo *); /// show the LaTeX log or build file diff --git a/src/frontends/controllers/ChangeLog b/src/frontends/controllers/ChangeLog index 927b1d9d99..1c5513137b 100644 --- a/src/frontends/controllers/ChangeLog +++ b/src/frontends/controllers/ChangeLog @@ -1,3 +1,7 @@ +2002-06-20 John Levon + + * GUI.h: createIndex() changed + 2002-06-18 Herbert Voss * tex_helpers.[Ch]: move functions from ControlTexinfo into this diff --git a/src/frontends/controllers/GUI.h b/src/frontends/controllers/GUI.h index 49f62ea290..8034816155 100644 --- a/src/frontends/controllers/GUI.h +++ b/src/frontends/controllers/GUI.h @@ -43,7 +43,7 @@ public: friend void gui_ShowGraphics(InsetGraphics *, LyXView &, Dialogs &); friend void gui_ShowInclude(InsetInclude *, LyXView &, Dialogs &); friend void gui_ShowIndex(InsetCommand *, LyXView &, Dialogs &); - friend void gui_CreateIndex(string const &, LyXView &, Dialogs &); + friend void gui_CreateIndex(LyXView &, Dialogs &); friend void gui_ShowLogFile(LyXView &, Dialogs &); friend void gui_ShowMathPanel(LyXView &, Dialogs &); friend void gui_ShowMinipage(InsetMinipage *, LyXView &, Dialogs &); diff --git a/src/frontends/guiapi.h b/src/frontends/guiapi.h index e7abe92950..bd75a4f70f 100644 --- a/src/frontends/guiapi.h +++ b/src/frontends/guiapi.h @@ -35,7 +35,7 @@ extern "C" { void gui_ShowGraphics(InsetGraphics *, LyXView & lv, Dialogs & d); void gui_ShowInclude(InsetInclude *, LyXView & lv, Dialogs & d); void gui_ShowIndex(InsetCommand *, LyXView & lv, Dialogs & d); - void gui_CreateIndex(string const &, LyXView & lv, Dialogs & d); + void gui_CreateIndex(LyXView & lv, Dialogs & d); void gui_ShowInfo(InsetInfo *, LyXView & lv, Dialogs & d); void gui_ShowLogFile(LyXView & lv, Dialogs & d); void gui_ShowMathPanel(LyXView & lv, Dialogs & d); diff --git a/src/frontends/qt2/ChangeLog b/src/frontends/qt2/ChangeLog index 0f2e09d474..b725495186 100644 --- a/src/frontends/qt2/ChangeLog +++ b/src/frontends/qt2/ChangeLog @@ -1,3 +1,7 @@ +2002-06-20 John Levon + + * guiapi.C: createIndex() changed + 2002-06-20 John Levon * QWorkArea.h: remove unused resize(...) diff --git a/src/frontends/qt2/guiapi.C b/src/frontends/qt2/guiapi.C index b1736bbc32..f8ec2e7282 100644 --- a/src/frontends/qt2/guiapi.C +++ b/src/frontends/qt2/guiapi.C @@ -302,9 +302,9 @@ extern "C" { } - void gui_CreateIndex(string const & s, LyXView & lv, Dialogs & d) + void gui_CreateIndex(LyXView & lv, Dialogs & d) { - controlIndexSingleton.get(lv, d).createInset(s); + controlIndexSingleton.get(lv, d).createInset(""); } diff --git a/src/frontends/xforms/ChangeLog b/src/frontends/xforms/ChangeLog index 0e5c1c9c04..e9ab31370b 100644 --- a/src/frontends/xforms/ChangeLog +++ b/src/frontends/xforms/ChangeLog @@ -1,3 +1,7 @@ +2002-06-20 John Levon + + * guiapi.C: createIndex() changed + 2002-06-20 John Levon * FormBibtex.C: use new lyx::eliminate_duplicates diff --git a/src/frontends/xforms/guiapi.C b/src/frontends/xforms/guiapi.C index d62d44812a..13ccdb1d33 100644 --- a/src/frontends/xforms/guiapi.C +++ b/src/frontends/xforms/guiapi.C @@ -341,9 +341,9 @@ extern "C" { } - void gui_CreateIndex(string const & s, LyXView & lv, Dialogs & d) + void gui_CreateIndex(LyXView & lv, Dialogs & d) { - controlIndexSingleton.get(lv, d).createInset(s); + controlIndexSingleton.get(lv, d).createInset(""); } diff --git a/src/lyxfunc.C b/src/lyxfunc.C index ec2dae2015..832aa76e44 100644 --- a/src/lyxfunc.C +++ b/src/lyxfunc.C @@ -613,8 +613,6 @@ FuncStatus LyXFunc::getStatus(kb_action action, code = Inset::BIBTEX_CODE; break; case LFUN_INDEX_INSERT: - case LFUN_INDEX_INSERT_LAST: - case LFUN_INDEX_CREATE: code = Inset::INDEX_CODE; break; case LFUN_INDEX_PRINT: -- 2.39.2