+2000-08-03 Angus Leeming <a.leeming@ic.ac.uk>
+
+ * src/commandtags.h: renamed, created some flags for citation
+ and index
+
+ * src/lyx_gui_misc.C: stripped out old FD_index_form code
+
+ * src/lyxfunc.C (dispatch): use signals to insert index entry
+
+ * src/frontends/Dialogs.h: new signal createIndex
+
+ * src/frontends/xforms/FormCommand.[Ch],
+ src/frontends/xforms/FormCitation.[Ch],
+ src/frontends/xforms/FormToc.[Ch],
+ src/frontends/xforms/FormUrl.[Ch]: clean up and comment better
+
+ * src/insets/insetindex.[Ch]: GUI-independent
+
+ * src/frontends/xforms/FormIndex.[Ch],
+ * src/frontends/xforms/forms/form_index.fd: xforms implementation
+ of the Index dialog
+
+ 2000-08-02 Lars Gullik Bjønnes <larsbj@lyx.org>
+
+ * src/insets/insetref.C (Latex): rewrite so that there is now
+2000-08-01 Dekel Tsur <dekel@math.tau.ac.il>
+
+ * src/mathed/math_write.C (MathDecorationInset::Write) Put \protect
+ before \overbrace, \underbrace, \overleftarrow, or \overrightarrow.
+
2000-08-02 Lars Gullik Bjønnes <larsbj@lyx.org>
* src/insets/insetref.C (Latex): rewrite so that there is now
OptItem "as LinuxDoc|L" "buffer-export linuxdoc"
OptItem "as DocBook|B" "buffer-export docbook"
Item "as DVI|D" "buffer-export dvi"
- Item "as Postscript|P" "buffer-export postscript"
+# Item "as Postscript|P" "buffer-export postscript"
Item "as Ascii|A" "buffer-export ascii"
Item "as HTML|H" "buffer-export html"
OptItem "Custom...|C" "buffer-export custom"
src/frontends/xforms/form_copyright.C
src/frontends/xforms/FormGraphics.C
src/frontends/xforms/form_graphics.C
+src/frontends/xforms/FormIndex.C
+src/frontends/xforms/form_index.C
src/frontends/xforms/FormPreferences.C
src/frontends/xforms/form_preferences.C
src/frontends/xforms/FormPrint.C
ReadOnly },
{ LFUN_RIGHT, "char-forward", N_("Go one char forward"),
ReadOnly },
- { LFUN_CREATE_CITATION, "citation-insert",
+ { LFUN_CITATION_CREATE, "citation-insert",
N_("Insert citation"), Noop },
{ LFUN_EXEC_COMMAND, "command-execute", "", NoBuffer },
{ LFUN_PREFIX, "command-prefix",
{ LFUN_HTMLURL, "html-insert", "", Noop },
{ LFUN_HYPHENATION, "hyphenation-point-insert",
N_("Insert hyphenation point"), Noop },
- { LFUN_INDEX_INSERT, "index-insert",
+ { LFUN_INDEX_CREATE, "index-insert",
N_("Insert index item"), Noop },
- { LFUN_INDEX_INSERT_LAST, "index-insert-last",
+ { LFUN_INDEX_CREATE_LAST, "index-insert-last",
N_("Insert last index item"), Noop },
{ LFUN_INDEX_PRINT, "index-print", N_("Insert index list"),
Noop },
} else if (inscmd.getCmdName() == "BibTeX") {
inset = new InsetBibtex(inscmd.getContents(), inscmd.getOptions(), this);
} else if (inscmd.getCmdName() == "index") {
- inset = new InsetIndex(inscmd.getContents());
+ inset = new InsetIndex(inscmd.params());
} else if (inscmd.getCmdName() == "include") {
inset = new InsetInclude(inscmd.getContents(), this);
} else if (inscmd.getCmdName() == "label") {
|| inscmd.getCmdName() == "listoftables") {
inset = new InsetTOC(inscmd.params());
} else if (inscmd.getCmdName() == "printindex") {
- inset = new InsetPrintIndex(this);
+ inset = new InsetPrintIndex(inscmd.params());
} else if (inscmd.getCmdName() == "lyxparent") {
inset = new InsetParent(inscmd.getContents(), this);
}
inset = new InsetBibtex(inscmd.getContents(),
inscmd.getOptions(), this);
} else if (inscmd.getCmdName() == "index") {
- inset = new InsetIndex(inscmd.getContents());
+ inset = new InsetIndex(inscmd.params());
} else if (inscmd.getCmdName() == "include") {
inset = new InsetInclude(inscmd.getContents(), this);
} else if (inscmd.getCmdName() == "label") {
|| inscmd.getCmdName() == "listoftables") {
inset = new InsetTOC(inscmd.params());
} else if (inscmd.getCmdName() == "printindex") {
- inset = new InsetPrintIndex(this);
+ inset = new InsetPrintIndex(inscmd.params());
} else if (inscmd.getCmdName() == "lyxparent") {
inset = new InsetParent(inscmd.getContents(), this);
}
LFUN_MENURELOAD, // Asger 1997-02-02
LFUN_FAX, // Asger 1997-02-10
LFUN_RECONFIGURE, // Asger 1997-02-14
- LFUN_INSERT_CITATION, // AAS 97-02-23
+ LFUN_CITATION_INSERT, // AAS 97-02-23
LFUN_INSERT_BIBTEX, // AAS 97-02-23
- LFUN_INDEX_INSERT, // Lgb 97-02-27
- LFUN_INDEX_INSERT_LAST, // 180 // Reh 98-09-17
+ LFUN_INDEX_CREATE, // Lgb 97-02-27
+ LFUN_INDEX_CREATE_LAST, // 180 // Reh 98-09-17
LFUN_INDEX_PRINT, // Lgb 97-02-27
LFUN_APROPOS, // Asger 1997-02-27
LFUN_LATEX_LOG, // Lgb 97-04-05
LFUN_INSET_FLOAT, // Lgb 20000627
LFUN_INSET_LIST, // Lgb 20000627
LFUN_INSET_THEOREM, // Lgb 20000630
- LFUN_CREATE_CITATION, // Angus 20000705
+ LFUN_CITATION_CREATE, // Angus 20000705
LFUN_INSET_CAPTION, // Lgb 20000718
LFUN_SWITCHBUFFER, // and where is this comming from?
LFUN_INSERT_URL, // Angus 20000726
LFUN_TABULAR_FEATURE, // Jug 20000728
LFUN_LAYOUT_TABULAR, // Jug 20000731
+ LFUN_INDEX_INSERT, // Angus 20000803
LFUN_LASTACTION /* this marks the end of the table */
};
class InsetBibKey;
class InsetBibtex;
class InsetInclude;
-class InsetIndex;
class InsetInfo;
class InsetTabular;
class InsetCommand;
///
Signal1<void, InsetInclude *> showInclude;
///
- Signal1<void, InsetIndex *> showIndex;
+ Signal1<void, InsetCommand *> showIndex;
+ ///
+ Signal1<void, string const &> createIndex;
///
Signal1<void, InsetBibKey *> showBibkey;
///
#include FORMS_H_LOCATION
#include "Dialogs.h"
+#include "FormCitation.h"
#include "FormCopyright.h"
-#include "FormPreferences.h"
#include "FormGraphics.h"
-#include "FormCitation.h"
+#include "FormIndex.h"
+#include "FormPreferences.h"
#include "FormPrint.h"
#include "FormTabular.h"
#include "FormToc.h"
Dialogs::Dialogs(LyXView * lv)
{
+ dialogs_.push_back(new FormCitation(lv, this));
dialogs_.push_back(new FormCopyright(lv, this));
- dialogs_.push_back(new FormPreferences(lv, this));
dialogs_.push_back(new FormGraphics(lv, this));
- dialogs_.push_back(new FormCitation(lv, this));
+ dialogs_.push_back(new FormIndex(lv, this));
+ dialogs_.push_back(new FormPreferences(lv, this));
dialogs_.push_back(new FormPrint(lv, this));
dialogs_.push_back(new FormTabular(lv, this));
dialogs_.push_back(new FormToc(lv, this));
static vector<string> bibkeysInfo;
FormCitation::FormCitation(LyXView * lv, Dialogs * d)
- : FormCommand(lv, d, _("Citation")), dialog_(0)
+ : FormCommand(lv, d, _("Citation")), dialog_(0)
{
// let the dialog be shown
// These are permanent connections so we won't bother
FormCitation::~FormCitation()
{
- free();
delete dialog_;
}
+void FormCitation::clearStore()
+{
+ citekeys.clear();
+ bibkeys.clear();
+ bibkeysInfo.clear();
+}
+
+
void FormCitation::build()
{
dialog_ = build_citation();
lv_->view()->updateInset( inset_, true );
}
} else {
- lv_->getLyXFunc()->Dispatch( LFUN_INSERT_CITATION,
+ lv_->getLyXFunc()->Dispatch( LFUN_CITATION_INSERT,
params.getAsString().c_str() );
}
}
//@}
private:
- /**@name Slot Methods */
- //@{
- virtual void update();
- /// Apply from dialog
- virtual void apply();
- /// Filter the inputs
- virtual void input( long );
/// Build the dialog
virtual void build();
- ///
+ /// Filter the inputs
+ virtual void input( long );
+ /// Update dialog before showing it
+ virtual void update();
+ /// Apply from dialog (modify or create inset)
+ virtual void apply();
+ /// delete derived class variables from hide()
+ virtual void clearStore();
+ /// Pointer to the actual instantiation of the xform's form
virtual FL_FORM * const form() const;
+
///
void updateBrowser( FL_OBJECT *, std::vector<string> const & ) const;
///
void setSize( int, bool ) const;
///
FD_form_citation * build_citation();
- //@}
/// Real GUI implementation.
FD_form_citation * dialog_;
{}
+FormCommand::~FormCommand()
+{
+ free();
+}
+
+
void FormCommand::showInset( InsetCommand * const inset )
{
if( dialogIsOpen || inset == 0 ) return;
inset_ = inset;
- // companion to Lars' commenting out in insetcommand.
- // need a better plan perhaps since there seems to be a small
- // flaw here if we copy an inset while it's visible
- // ih_ = inset_->hide.connect(slot(this, &FormCommand::hide));
+ ih_ = inset_->hide.connect(slot(this, &FormCommand::hide));
params = inset->params();
show();
inset_ = 0;
ih_.disconnect();
dialogIsOpen = false;
+ clearStore();
}
public:
/// Constructor
FormCommand(LyXView *, Dialogs *, string const & );
+ /// Destructor
+ virtual ~FormCommand();
/**@name Real per-instance Callback Methods */
//@{
protected:
/**@name Slot Methods */
//@{
- /// Create the dialog if necessary, update it and display it.
+ /// Slot launching dialog to (possibly) create a new inset
void createInset( string const & );
- ///
+ /// Slot launching dialog to an existing inset
void showInset( InsetCommand * const );
- ///
- void show();
- /// Hide the dialog.
- void hide();
- /// Explicitly free the dialog.
- void free();
- ///
+ //@}
+
+ /// Build the dialog
+ virtual void build() = 0;
+ /// Filter the inputs on callback from xforms
virtual void input( long ) = 0;
- ///
+ /// Update dialog before showing it
virtual void update() = 0;
- /// Apply from dialog
+ /// Apply from dialog (modify or create inset)
virtual void apply() = 0;
- /// Build the dialog
- virtual void build() = 0;
- ///
+ /// delete derived class variables from hide()
+ virtual void clearStore() {}
+ /// Pointer to the actual instantiation of the xform's form
virtual FL_FORM * const form() const = 0;
- //@}
- /**@name Private Data */
+ /**@name Protected Data */
//@{
/** Which LyXFunc do we use?
We could modify Dialogs to have a visible LyXFunc* instead and
Used so we can get at the signals we have to connect to.
*/
Dialogs * d_;
+ /// pointer to the inset passed through showInset (if any)
+ InsetCommand * inset_;
+ /// the nitty-griity. What is modified and passed back
+ InsetCommandParams params;
+ //@}
+
+private:
+ /// Create the dialog if necessary, update it and display it.
+ void show();
+ /// Hide the dialog.
+ void hide();
+ /// Explicitly free the dialog.
+ void free();
+
+
+ /**@name Private Data */
+ //@{
/// Update connection.
Connection u_;
/// Hide connection.
Connection h_;
/// inset::hide connection.
Connection ih_;
- ///
- InsetCommand * inset_;
- ///
+ /// block opening of form from more than one inset
bool dialogIsOpen;
- ///
- InsetCommandParams params;
- ///
+ /// dialog title, displayed by WM.
string title;
//@}
};
--- /dev/null
+// -*- C++ -*-
+/* This file is part of
+ * ======================================================
+ *
+ * LyX, The Document Processor
+ *
+ * Copyright 2000 The LyX Team.
+ *
+ * ======================================================
+ */
+
+#include <config.h>
+
+#include FORMS_H_LOCATION
+
+#ifdef __GNUG__
+#pragma implementation
+#endif
+
+
+#include "gettext.h"
+#include "Dialogs.h"
+#include "FormIndex.h"
+#include "LyXView.h"
+#include "buffer.h"
+#include "form_index.h"
+#include "lyxfunc.h"
+
+FormIndex::FormIndex(LyXView * lv, Dialogs * d)
+ : FormCommand(lv, d, _("Index")), dialog_(0)
+{
+ // let the dialog be shown
+ // These are permanent connections so we won't bother
+ // storing a copy because we won't be disconnecting.
+ d->showIndex.connect(slot(this, &FormIndex::showInset));
+ d->createIndex.connect(slot(this, &FormIndex::createInset));
+}
+
+
+FormIndex::~FormIndex()
+{
+ delete dialog_;
+}
+
+
+void FormIndex::build()
+{
+ dialog_ = build_index();
+}
+
+
+FL_FORM * const FormIndex::form() const
+{
+ if( dialog_ && dialog_->form_index )
+ return dialog_->form_index;
+ else
+ return 0;
+}
+
+
+void FormIndex::update()
+{
+ static int ow = -1, oh;
+
+ if (ow < 0) {
+ ow = dialog_->form_index->w;
+ oh = dialog_->form_index->h;
+
+ fl_set_form_minsize(dialog_->form_index, ow, oh);
+ fl_set_form_maxsize(dialog_->form_index, 2*ow, oh);
+ }
+
+ fl_freeze_form( dialog_->form_index );
+
+ fl_set_input(dialog_->key, params.getContents().c_str());
+
+ if( lv_->buffer()->isReadonly() ) {
+ fl_deactivate_object( dialog_->key );
+ fl_deactivate_object( dialog_->ok );
+ fl_set_object_lcol( dialog_->ok, FL_INACTIVE );
+ } else {
+ fl_activate_object( dialog_->key );
+ fl_activate_object( dialog_->ok );
+ fl_set_object_lcol( dialog_->ok, FL_BLACK );
+ }
+
+ fl_unfreeze_form( dialog_->form_index );
+}
+
+
+void FormIndex::apply()
+{
+ if( lv_->buffer()->isReadonly() ) return;
+
+ params.setContents( fl_get_input(dialog_->key) );
+
+ if( inset_ != 0 )
+ {
+ // Only update if contents have changed
+ if( params.getContents() != inset_->getContents() ) {
+ inset_->setParams( params );
+ lv_->view()->updateInset( inset_, true );
+ }
+ } else {
+ lv_->getLyXFunc()->Dispatch( LFUN_INDEX_INSERT,
+ params.getAsString().c_str() );
+ }
+}
--- /dev/null
+// -*- C++ -*-
+/* This file is part of
+ * ======================================================
+ *
+ * LyX, The Document Processor
+ *
+ * Copyright 2000 The LyX Team.
+ *
+ * ======================================================
+ */
+
+#ifndef FORMINDEX_H
+#define FORMINDEX_H
+
+#ifdef __GNUG__
+#pragma interface
+#endif
+
+#include "FormCommand.h"
+struct FD_form_index;
+
+/** This class provides an XForms implementation of the FormIndex Dialog.
+ */
+class FormIndex : public FormCommand {
+public:
+ /**@name Constructors and Destructors */
+ //@{
+ ///
+ FormIndex(LyXView *, Dialogs *);
+ ///
+ ~FormIndex();
+ //@}
+
+private:
+ /// Build the dialog
+ virtual void build();
+ /// Not used but must be instantiated
+ virtual void input( long ) {}
+ /// Update dialog before showing it
+ virtual void update();
+ /// Apply from dialog (modify or create inset)
+ virtual void apply();
+ /// Pointer to the actual instantiation of the xform's form
+ virtual FL_FORM * const form() const;
+ ///
+ FD_form_index * build_index();
+ //@}
+
+ /// Real GUI implementation.
+ FD_form_index * dialog_;
+};
+
+#endif
static vector<Buffer::TocItem> toclist;
FormToc::FormToc(LyXView * lv, Dialogs * d)
- : FormCommand(lv, d, _("Table of Contents")), dialog_(0)
+ : FormCommand(lv, d, _("Table of Contents")), dialog_(0)
{
// let the dialog be shown
// These are permanent connections so we won't bother
FormToc::~FormToc()
{
- free();
delete dialog_;
}
+void FormToc::clearStore()
+{
+ toclist.clear();
+}
+
+
void FormToc::build()
{
dialog_ = build_toc();
~FormToc();
private:
- /**@name Slot Methods */
- //@{
- ///
- virtual void update();
- /// Apply from dialog
- virtual void apply();
- ///
- virtual void input( long ) {};
/// Build the dialog
virtual void build();
- ///
+ /// Not used but must be instantiated
+ virtual void input( long ) {}
+ /// Update dialog before showing it
+ virtual void update();
+ /// Apply from dialog (modify or create inset)
+ virtual void apply();
+ /// delete derived class variables from hide()
+ virtual void clearStore();
+ /// Pointer to the actual instantiation of the xform's form
virtual FL_FORM * const form() const;
///
void updateToc();
///
FD_form_toc * build_toc();
- //@}
/// Real GUI implementation.
FD_form_toc * dialog_;
#include "gettext.h"
-#include "BufferView.h"
#include "Dialogs.h"
#include "FormUrl.h"
#include "LyXView.h"
#include "buffer.h"
#include "form_url.h"
#include "lyxfunc.h"
-#include "xform_macros.h"
-#include "insets/insetcommand.h"
-#include "insets/inseturl.h"
-#include "support/filetools.h"
FormUrl::FormUrl(LyXView * lv, Dialogs * d)
- : FormCommand(lv, d, _("Url")), dialog_(0)
+ : FormCommand(lv, d, _("Url")), dialog_(0)
{
// let the dialog be shown
// These are permanent connections so we won't bother
FormUrl::~FormUrl()
{
- free();
delete dialog_;
}
//@}
private:
- /**@name Slot Methods */
- //@{
- ///
- virtual void update();
- /// Apply from dialog
- void apply();
- ///
- virtual void input( long ) {};
/// Build the dialog
- void build();
- ///
+ virtual void build();
+ /// Not used but must be instantiated
+ virtual void input( long ) {}
+ /// Update dialog before showing it
+ virtual void update();
+ /// Apply from dialog (modify or create inset)
+ virtual void apply();
+ /// Pointer to the actual instantiation of the xform's form
virtual FL_FORM * const form() const;
///
FD_form_url * build_url();
FormGraphics.h \
form_graphics.C \
form_graphics.h \
+ FormIndex.C \
+ FormIndex.h \
+ form_index.C \
+ form_index.h \
FormPreferences.C \
FormPreferences.h \
form_preferences.C \
--- /dev/null
+// File modified by fdfix.sh for use by lyx (with xforms >= 0.88) and gettext
+#include <config.h>
+#include "lyx_gui_misc.h"
+#include "gettext.h"
+
+/* Form definition file generated with fdesign. */
+
+#include FORMS_H_LOCATION
+#include <stdlib.h>
+#include "form_index.h"
+#include "FormIndex.h"
+
+FD_form_index * FormIndex::build_index()
+{
+ FL_OBJECT *obj;
+ FD_form_index *fdui = new FD_form_index;
+
+ fdui->form_index = fl_bgn_form(FL_NO_BOX, 520, 100);
+ fdui->form_index->u_vdata = this;
+ obj = fl_add_box(FL_UP_BOX, 0, 0, 520, 100, "");
+ fdui->key = obj = fl_add_input(FL_NORMAL_INPUT, 90, 10, 420, 30, _("Keyword"));
+ fl_set_input_shortcut(obj, scex(_("Keyword|#K#k")), 1);
+ fl_set_object_lsize(obj, FL_NORMAL_SIZE);
+ fl_set_object_resize(obj, FL_RESIZE_X);
+ fdui->cancel = obj = fl_add_button(FL_NORMAL_BUTTON, 410, 60, 100, 30, _("Cancel"));
+ fl_set_button_shortcut(obj, _("^["), 1);
+ fl_set_object_lsize(obj, FL_NORMAL_SIZE);
+ fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast);
+ fl_set_object_callback(obj, C_FormCommandCancelCB, 0);
+ fdui->ok = obj = fl_add_button(FL_RETURN_BUTTON, 300, 60, 100, 30, _("OK"));
+ fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast);
+ fl_set_object_callback(obj, C_FormCommandOKCB, 0);
+ fl_end_form();
+
+ fdui->form_index->fdui = fdui;
+
+ return fdui;
+}
+/*---------------------------------------*/
+
--- /dev/null
+/** Header file generated with fdesign on Thu Aug 3 11:33:50 2000.**/
+
+#ifndef FD_form_index_h_
+#define FD_form_index_h_
+
+/** Callbacks, globals and object handlers **/
+extern "C" void C_FormCommandCancelCB(FL_OBJECT *, long);
+extern "C" void C_FormCommandOKCB(FL_OBJECT *, long);
+
+
+/**** Forms and Objects ****/
+struct FD_form_index {
+
+ FL_FORM *form_index;
+ FL_OBJECT *key;
+ FL_OBJECT *cancel;
+ FL_OBJECT *ok;
+};
+
+#endif /* FD_form_index_h_ */
--- /dev/null
+Magic: 13000
+
+Internal Form Definition File
+ (do not change)
+
+Number of forms: 1
+Unit of measure: FL_COORD_PIXEL
+
+=============== FORM ===============
+Name: form_index
+Width: 520
+Height: 100
+Number of Objects: 4
+
+--------------------
+class: FL_BOX
+type: UP_BOX
+box: 0 0 520 100
+boxtype: FL_UP_BOX
+colors: FL_COL1 FL_COL1
+alignment: FL_ALIGN_CENTER
+style: FL_NORMAL_STYLE
+size: FL_DEFAULT_SIZE
+lcol: FL_BLACK
+label:
+shortcut:
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name:
+callback:
+argument:
+
+--------------------
+class: FL_INPUT
+type: NORMAL_INPUT
+box: 90 10 420 30
+boxtype: FL_DOWN_BOX
+colors: FL_COL1 FL_MCOL
+alignment: FL_ALIGN_LEFT
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label: Keyword
+shortcut: Keyword|#K#k
+resize: FL_RESIZE_X
+gravity: FL_NoGravity FL_NoGravity
+name: key
+callback:
+argument:
+
+--------------------
+class: FL_BUTTON
+type: NORMAL_BUTTON
+box: 410 60 100 30
+boxtype: FL_UP_BOX
+colors: FL_COL1 FL_COL1
+alignment: FL_ALIGN_CENTER
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label: Cancel
+shortcut: ^[
+resize: FL_RESIZE_NONE
+gravity: FL_SouthEast FL_SouthEast
+name: cancel
+callback: C_FormCommandCancelCB
+argument: 0
+
+--------------------
+class: FL_BUTTON
+type: RETURN_BUTTON
+box: 300 60 100 30
+boxtype: FL_UP_BOX
+colors: FL_COL1 FL_COL1
+alignment: FL_ALIGN_CENTER
+style: FL_NORMAL_STYLE
+size: FL_DEFAULT_SIZE
+lcol: FL_BLACK
+label: OK
+shortcut: ^M
+resize: FL_RESIZE_ALL
+gravity: FL_SouthEast FL_SouthEast
+name: ok
+callback: C_FormCommandOKCB
+argument: 0
+
+==============================
+create_the_forms
SRCS := form_citation.fd \
form_copyright.fd \
+ form_index.fd \
form_preferences.fd \
form_print.fd \
form_graphics.fd \
#include "support/lstrings.h"
InsetCitation::InsetCitation(InsetCommandParams const & p)
- : InsetCommand(p)
+ : InsetCommand(p)
{}
string InsetCitation::getScreenLabel() const
#endif
#include "insetcommand.h"
+#include "support/utility.hpp"
/** Used to insert citations
*/
-class InsetCitation : public InsetCommand {
+class InsetCitation : public InsetCommand, public noncopyable {
public:
///
- explicit
InsetCitation(InsetCommandParams const &);
///
Inset * Clone() const { return new InsetCitation(params()); }
#include <config.h>
-#include <cstdlib>
-
#ifdef __GNUG__
#pragma implementation
#endif
-#include FORMS_H_LOCATION
#include "insetindex.h"
-#include "buffer.h"
-#include "debug.h"
+#include "BufferView.h"
+#include "LyXView.h"
+#include "frontends/Dialogs.h"
#include "LaTeXFeatures.h"
-#include "gettext.h"
-#include "LString.h"
-#include "lyx_gui_misc.h" // WarnReadonly
-
-FD_index_form * index_form = 0;
-
-extern "C"
-void index_cb(FL_OBJECT *, long data)
-{
- InsetIndex::Holder * holder =
- static_cast<InsetIndex::Holder*>
- (index_form->index_form->u_vdata);
-
- holder->inset->callback( index_form, data );
-}
-
-
-static
-FD_index_form * create_form_index_form()
-{
- FL_OBJECT * obj;
- FD_index_form *fdui = (FD_index_form *) fl_calloc(1, sizeof(FD_index_form));
-
- fdui->index_form = fl_bgn_form(FL_NO_BOX, 258, 196);
- obj = fl_add_box(FL_UP_BOX, 0, 0, 258, 196, "");
- fdui->key = obj = fl_add_input(FL_NORMAL_INPUT, 93, 26, 130, 30,
- idex(_("Keyword:|#K")));
- fl_set_object_shortcut(obj, scex(_("Keyword:|#K")), 1);
- fl_set_object_lsize(obj, FL_NORMAL_SIZE);
- obj = fl_add_button(FL_RETURN_BUTTON, 50, 140, 80, 30, _("OK"));
- obj->u_vdata = index_form;
- fl_set_object_callback(obj, index_cb, 1);
- obj = fl_add_button(FL_NORMAL_BUTTON, 150, 140, 80, 30,
- idex(_("Cancel|^[")));
- fl_set_object_shortcut(obj, scex(_("Cancel|^[")), 1);
- obj->u_vdata = index_form;
- fl_set_object_callback(obj, index_cb, 0);
- fl_end_form();
-
- return fdui;
-}
-
-
-/*---------------------------------------*/
-
-
-InsetIndex::InsetIndex(string const & key)
- : InsetCommand("index", key)
+InsetIndex::InsetIndex(InsetCommandParams const & p)
+ : InsetCommand(p)
{}
-InsetIndex::~InsetIndex()
-{
- if(index_form && index_form->index_form
- && index_form->index_form->visible
- && index_form->index_form->u_vdata == &holder)
- fl_hide_form(index_form->index_form);
-}
-
-
-void InsetIndex::callback( FD_index_form * form, long data )
-{
- switch (data)
- {
- case 1: // OK
- if(!holder.view->buffer()->isReadonly())
- {
- string tmp = fl_get_input(form->key);
- if(tmp != getContents())
- {
- setContents(tmp);
- holder.view->updateInset( this, true );
- }
- } // fall through to Cancel
- case 0:
- fl_hide_form(form->index_form);
- break;
- }
-}
-
-
-void InsetIndex::Edit(BufferView * bv, int, int, unsigned int)
-{
- if(bv->buffer()->isReadonly())
- WarnReadonly(bv->buffer()->fileName());
-
- if (!index_form) {
- index_form = create_form_index_form();
- fl_set_form_atclose(index_form->index_form,
- CancelCloseBoxCB, 0);
- }
-
- holder.inset = this;
- holder.view = bv;
-
- index_form->index_form->u_vdata = &holder;
- fl_set_input(index_form->key, getContents().c_str());
- if (index_form->index_form->visible) {
- fl_raise_form(index_form->index_form);
- } else {
- fl_show_form(index_form->index_form,
- FL_PLACE_MOUSE, FL_FULLBORDER,
- _("Index"));
- }
-}
-
-
string InsetIndex::getScreenLabel() const
{
return _("Idx");
}
-//
-// InsetPrintIndex
-//
-
-#if 0
-InsetPrintIndex::InsetPrintIndex()
- : InsetCommand("printindex")
+void InsetIndex::Edit(BufferView * bv, int, int, unsigned int)
{
- owner = 0;
+ bv->owner()->getDialogs()->showIndex( this );
}
-#endif
-InsetPrintIndex::InsetPrintIndex(Buffer * o)
- : InsetCommand("printindex"), owner(o)
+InsetPrintIndex::InsetPrintIndex(InsetCommandParams const & p)
+ : InsetCommand(p)
{}
-
-#if 0
-InsetPrintIndex::~InsetPrintIndex()
-{
-}
-#endif
-
-
string InsetPrintIndex::getScreenLabel() const
{
- return _("PrintIndex");
+ return _("Index");
}
#endif
#include "insetcommand.h"
+#include "support/utility.hpp"
-class Buffer;
struct LaTeXFeatures;
-struct FD_index_form;
-
-// Created by Lgb 970227
-
/** Used to insert index labels
*/
-class InsetIndex : public InsetCommand {
+class InsetIndex : public InsetCommand, public noncopyable {
public:
///
- InsetIndex() : InsetCommand("index") {}
- ///
- explicit
- InsetIndex(string const & key);
- ///
- ~InsetIndex();
+ InsetIndex(InsetCommandParams const &);
///
- Inset * Clone() const { return new InsetIndex(getContents());}
- ///
- void Edit(BufferView *, int, int, unsigned int);
- ///
- EDITABLE Editable() const
- {
- return IS_EDITABLE;
- }
+ Inset * Clone() const { return new InsetIndex(params());}
///
string getScreenLabel() const;
///
- void callback( FD_index_form *, long );
- ///
- struct Holder {
- InsetIndex * inset;
- BufferView * view;
- };
- private:
+ EDITABLE Editable() const { return IS_EDITABLE; }
///
- Holder holder;
+ void Edit(BufferView *, int, int, unsigned int);
};
-class InsetPrintIndex : public InsetCommand {
+class InsetPrintIndex : public InsetCommand, public noncopyable {
public:
-#if 0
- ///
- InsetPrintIndex();
-#endif
///
- InsetPrintIndex(Buffer *);
-#if 0
+ InsetPrintIndex(InsetCommandParams const &);
///
- ~InsetPrintIndex();
-#endif
+ Inset * Clone() const { return new InsetPrintIndex(params());}
/// Updates needed features for this inset.
void Validate(LaTeXFeatures & features) const;
///
void Edit(BufferView *, int, int, unsigned int) {}
///
- EDITABLE Editable() const{
- return IS_EDITABLE;
- }
- /// WHY is clone missing? (Lgb)
+ EDITABLE Editable() const{ return NOT_EDITABLE; }
///
bool display() const { return true; }
///
Inset::Code LyxCode() const;
///
string getScreenLabel() const;
-private:
- ///
- Buffer * owner;
-};
-
-// this was shifted here rather than a separate
-// file because its little and only need by
-// insetindex.C and lyx_gui_misc.C ARRae 981020
-struct FD_index_form {
- FL_FORM * index_form;
- FL_OBJECT * key;
};
-extern FD_index_form * index_form;
#endif
#endif
#include "insetcommand.h"
+#include "support/utility.hpp"
/** Used to insert table of contents
*/
-class InsetTOC : public InsetCommand {
+class InsetTOC : public InsetCommand, public noncopyable {
public:
///
InsetTOC(InsetCommandParams const & p) : InsetCommand(p) {}
#endif
#include "insetcommand.h"
+#include "support/utility.hpp"
struct LaTeXFeatures;
/** The url inset
*/
-class InsetUrl : public InsetCommand {
+class InsetUrl : public InsetCommand, public noncopyable {
public:
///
explicit
#include "minibuffer.h"
#include "print_form.h"
#include "sp_form.h"
-#include "insets/insetindex.h"
#include "LyXView.h"
#include "bufferview_funcs.h"
#include "support/filetools.h"
extern FD_matrix * fd_matrix;
extern FD_bibitem_form * bibitem_form;
extern FD_include * form;
-extern FD_index_form * index_form;
extern void HideFiguresPopups();
fl_hide_form(form->include);
}
}
- if (index_form) {
- if (index_form->index_form->visible) {
- fl_hide_form(index_form->index_form);
- }
- }
HideFiguresPopups();
}
fl_hide_form(form->include);
}
}
- if (index_form) {
- if (index_form->index_form->visible) {
- fl_hide_form(index_form->index_form);
- }
- }
HideFiguresPopups();
}
}
break;
- case LFUN_CREATE_CITATION:
+ case LFUN_CITATION_CREATE:
{
// Should do this "at source"
- InsetCommandParams p;
- p.setCmdName( "cite" );
+ InsetCommandParams p( "cite" );
if (contains(argument, "|")) {
p.setContents( token(argument, '|', 0) );
}
break;
- case LFUN_INSERT_CITATION:
+ case LFUN_CITATION_INSERT:
{
InsetCommandParams p;
p.setFromString( argument );
}
break;
- case LFUN_INDEX_INSERT:
- case LFUN_INDEX_INSERT_LAST:
+ case LFUN_INDEX_CREATE:
+ case LFUN_INDEX_CREATE_LAST:
{
// Can't do that at the beginning of a paragraph.
if (owner->view()->text->cursor.pos() - 1 < 0)
break;
- InsetIndex * new_inset = new InsetIndex();
+ InsetCommandParams p( "index" );
+
if (!argument.empty()) {
- string lsarg(argument);
- new_inset->setContents(lsarg);
- if (!owner->view()->insertInset(new_inset))
- delete new_inset;
+ p.setContents( argument );
} else {
- //reh 98/09/21
//get the current word for an argument
LyXParagraph::size_type lastpos =
owner->view()->text->cursor.pos() - 1;
->text->cursor.par()->GetWord(lastpos));
//make the new inset and write the current word into it
- InsetIndex * new_inset = new InsetIndex();
-
- new_inset->setContents(curstring);
-
- //don't edit it if the call was to INSERT_LAST
- if(action != LFUN_INDEX_INSERT_LAST) {
- new_inset->Edit(owner->view(), 0, 0, 0);
- } else {
- //it looks blank on the screen unless
- //we do something. put it here.
-
- // move the cursor to the returned value of lastpos
- // but only for the auto-insert
- owner->view()->text->cursor.pos(lastpos);
- }
-
- //put the new inset into the buffer.
- // there should be some way of knowing the user
- //cancelled & avoiding this, but i don't know how
- if (!owner->view()->insertInset(new_inset))
- delete new_inset;
+ p.setContents( curstring );
}
+
+ owner->getDialogs()->createIndex( p.getAsString() );
}
break;
+
+ case LFUN_INDEX_INSERT:
+ {
+ InsetCommandParams p;
+ p.setFromString( argument );
+ InsetIndex * inset = new InsetIndex( p );
+ if (!owner->view()->insertInset(inset))
+ delete inset;
+ else
+ owner->view()->updateInset( inset, true );
+ }
+ break;
+
case LFUN_INDEX_PRINT:
{
- Inset * new_inset = new InsetPrintIndex(owner->buffer());
- if (!owner->view()->insertInset(new_inset, "Standard", true))
- delete new_inset;
+ InsetCommandParams p("printindex");
+ Inset * inset = new InsetPrintIndex(p);
+ if (!owner->view()->insertInset(inset, "Standard", true))
+ delete inset;
}
break;
void MathDecorationInset::Write(ostream & os, bool fragile)
{
latexkeys * l = lm_get_key_by_id(deco, LM_TK_WIDE);
+ if (fragile &&
+ (strcmp(l->name, "overbrace") == 0 ||
+ strcmp(l->name, "underbrace") == 0 ||
+ strcmp(l->name, "overleftarrow") == 0 ||
+ strcmp(l->name, "overrightarrow") == 0))
+ os << "\\protect";
os << '\\' << l->name << '{';
MathParInset::Write(os, fragile);
os << '}';
case 12: tmpfunc->Dispatch(LFUN_INSERT_NOTE); break;
case 13: tmpfunc->Dispatch(LFUN_INSERT_LABEL); break;
case 14: tmpfunc->Dispatch(LFUN_INSERT_REF); break;
- case 15: tmpfunc->Dispatch(LFUN_CREATE_CITATION); break;
- case 16: tmpfunc->Dispatch(LFUN_INDEX_INSERT); break;
- case 17: tmpfunc->Dispatch(LFUN_INDEX_INSERT_LAST); break;
+ case 15: tmpfunc->Dispatch(LFUN_CITATION_CREATE); break;
+ case 16: tmpfunc->Dispatch(LFUN_INDEX_CREATE); break;
+ case 17: tmpfunc->Dispatch(LFUN_INDEX_CREATE_LAST); break;
case 18: tmpfunc->Dispatch(LFUN_URL); break;
}
}