mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-25 22:06:15 +00:00
Angus insetindex patch + protect patch from Dekel
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@950 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
155f03b4a4
commit
046b5d824c
30
ChangeLog
30
ChangeLog
@ -1,3 +1,33 @@
|
|||||||
|
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>
|
2000-08-02 Lars Gullik Bjønnes <larsbj@lyx.org>
|
||||||
|
|
||||||
* src/insets/insetref.C (Latex): rewrite so that there is now
|
* src/insets/insetref.C (Latex): rewrite so that there is now
|
||||||
|
@ -72,7 +72,7 @@ Menuset
|
|||||||
OptItem "as LinuxDoc|L" "buffer-export linuxdoc"
|
OptItem "as LinuxDoc|L" "buffer-export linuxdoc"
|
||||||
OptItem "as DocBook|B" "buffer-export docbook"
|
OptItem "as DocBook|B" "buffer-export docbook"
|
||||||
Item "as DVI|D" "buffer-export dvi"
|
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 Ascii|A" "buffer-export ascii"
|
||||||
Item "as HTML|H" "buffer-export html"
|
Item "as HTML|H" "buffer-export html"
|
||||||
OptItem "Custom...|C" "buffer-export custom"
|
OptItem "Custom...|C" "buffer-export custom"
|
||||||
|
@ -32,6 +32,8 @@ src/frontends/xforms/FormCopyright.C
|
|||||||
src/frontends/xforms/form_copyright.C
|
src/frontends/xforms/form_copyright.C
|
||||||
src/frontends/xforms/FormGraphics.C
|
src/frontends/xforms/FormGraphics.C
|
||||||
src/frontends/xforms/form_graphics.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/FormPreferences.C
|
||||||
src/frontends/xforms/form_preferences.C
|
src/frontends/xforms/form_preferences.C
|
||||||
src/frontends/xforms/FormPrint.C
|
src/frontends/xforms/FormPrint.C
|
||||||
|
@ -164,7 +164,7 @@ void LyXAction::init()
|
|||||||
ReadOnly },
|
ReadOnly },
|
||||||
{ LFUN_RIGHT, "char-forward", N_("Go one char forward"),
|
{ LFUN_RIGHT, "char-forward", N_("Go one char forward"),
|
||||||
ReadOnly },
|
ReadOnly },
|
||||||
{ LFUN_CREATE_CITATION, "citation-insert",
|
{ LFUN_CITATION_CREATE, "citation-insert",
|
||||||
N_("Insert citation"), Noop },
|
N_("Insert citation"), Noop },
|
||||||
{ LFUN_EXEC_COMMAND, "command-execute", "", NoBuffer },
|
{ LFUN_EXEC_COMMAND, "command-execute", "", NoBuffer },
|
||||||
{ LFUN_PREFIX, "command-prefix",
|
{ LFUN_PREFIX, "command-prefix",
|
||||||
@ -247,9 +247,9 @@ void LyXAction::init()
|
|||||||
{ LFUN_HTMLURL, "html-insert", "", Noop },
|
{ LFUN_HTMLURL, "html-insert", "", Noop },
|
||||||
{ LFUN_HYPHENATION, "hyphenation-point-insert",
|
{ LFUN_HYPHENATION, "hyphenation-point-insert",
|
||||||
N_("Insert hyphenation point"), Noop },
|
N_("Insert hyphenation point"), Noop },
|
||||||
{ LFUN_INDEX_INSERT, "index-insert",
|
{ LFUN_INDEX_CREATE, "index-insert",
|
||||||
N_("Insert index item"), Noop },
|
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 },
|
N_("Insert last index item"), Noop },
|
||||||
{ LFUN_INDEX_PRINT, "index-print", N_("Insert index list"),
|
{ LFUN_INDEX_PRINT, "index-print", N_("Insert index list"),
|
||||||
Noop },
|
Noop },
|
||||||
|
@ -962,7 +962,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
|
|||||||
} else if (inscmd.getCmdName() == "BibTeX") {
|
} else if (inscmd.getCmdName() == "BibTeX") {
|
||||||
inset = new InsetBibtex(inscmd.getContents(), inscmd.getOptions(), this);
|
inset = new InsetBibtex(inscmd.getContents(), inscmd.getOptions(), this);
|
||||||
} else if (inscmd.getCmdName() == "index") {
|
} else if (inscmd.getCmdName() == "index") {
|
||||||
inset = new InsetIndex(inscmd.getContents());
|
inset = new InsetIndex(inscmd.params());
|
||||||
} else if (inscmd.getCmdName() == "include") {
|
} else if (inscmd.getCmdName() == "include") {
|
||||||
inset = new InsetInclude(inscmd.getContents(), this);
|
inset = new InsetInclude(inscmd.getContents(), this);
|
||||||
} else if (inscmd.getCmdName() == "label") {
|
} else if (inscmd.getCmdName() == "label") {
|
||||||
@ -984,7 +984,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
|
|||||||
|| inscmd.getCmdName() == "listoftables") {
|
|| inscmd.getCmdName() == "listoftables") {
|
||||||
inset = new InsetTOC(inscmd.params());
|
inset = new InsetTOC(inscmd.params());
|
||||||
} else if (inscmd.getCmdName() == "printindex") {
|
} else if (inscmd.getCmdName() == "printindex") {
|
||||||
inset = new InsetPrintIndex(this);
|
inset = new InsetPrintIndex(inscmd.params());
|
||||||
} else if (inscmd.getCmdName() == "lyxparent") {
|
} else if (inscmd.getCmdName() == "lyxparent") {
|
||||||
inset = new InsetParent(inscmd.getContents(), this);
|
inset = new InsetParent(inscmd.getContents(), this);
|
||||||
}
|
}
|
||||||
@ -1193,7 +1193,7 @@ void Buffer::readInset(LyXLex & lex, LyXParagraph *& par,
|
|||||||
inset = new InsetBibtex(inscmd.getContents(),
|
inset = new InsetBibtex(inscmd.getContents(),
|
||||||
inscmd.getOptions(), this);
|
inscmd.getOptions(), this);
|
||||||
} else if (inscmd.getCmdName() == "index") {
|
} else if (inscmd.getCmdName() == "index") {
|
||||||
inset = new InsetIndex(inscmd.getContents());
|
inset = new InsetIndex(inscmd.params());
|
||||||
} else if (inscmd.getCmdName() == "include") {
|
} else if (inscmd.getCmdName() == "include") {
|
||||||
inset = new InsetInclude(inscmd.getContents(), this);
|
inset = new InsetInclude(inscmd.getContents(), this);
|
||||||
} else if (inscmd.getCmdName() == "label") {
|
} else if (inscmd.getCmdName() == "label") {
|
||||||
@ -1216,7 +1216,7 @@ void Buffer::readInset(LyXLex & lex, LyXParagraph *& par,
|
|||||||
|| inscmd.getCmdName() == "listoftables") {
|
|| inscmd.getCmdName() == "listoftables") {
|
||||||
inset = new InsetTOC(inscmd.params());
|
inset = new InsetTOC(inscmd.params());
|
||||||
} else if (inscmd.getCmdName() == "printindex") {
|
} else if (inscmd.getCmdName() == "printindex") {
|
||||||
inset = new InsetPrintIndex(this);
|
inset = new InsetPrintIndex(inscmd.params());
|
||||||
} else if (inscmd.getCmdName() == "lyxparent") {
|
} else if (inscmd.getCmdName() == "lyxparent") {
|
||||||
inset = new InsetParent(inscmd.getContents(), this);
|
inset = new InsetParent(inscmd.getContents(), this);
|
||||||
}
|
}
|
||||||
|
@ -196,10 +196,10 @@ enum kb_action {
|
|||||||
LFUN_MENURELOAD, // Asger 1997-02-02
|
LFUN_MENURELOAD, // Asger 1997-02-02
|
||||||
LFUN_FAX, // Asger 1997-02-10
|
LFUN_FAX, // Asger 1997-02-10
|
||||||
LFUN_RECONFIGURE, // Asger 1997-02-14
|
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_INSERT_BIBTEX, // AAS 97-02-23
|
||||||
LFUN_INDEX_INSERT, // Lgb 97-02-27
|
LFUN_INDEX_CREATE, // Lgb 97-02-27
|
||||||
LFUN_INDEX_INSERT_LAST, // 180 // Reh 98-09-17
|
LFUN_INDEX_CREATE_LAST, // 180 // Reh 98-09-17
|
||||||
LFUN_INDEX_PRINT, // Lgb 97-02-27
|
LFUN_INDEX_PRINT, // Lgb 97-02-27
|
||||||
LFUN_APROPOS, // Asger 1997-02-27
|
LFUN_APROPOS, // Asger 1997-02-27
|
||||||
LFUN_LATEX_LOG, // Lgb 97-04-05
|
LFUN_LATEX_LOG, // Lgb 97-04-05
|
||||||
@ -267,12 +267,13 @@ enum kb_action {
|
|||||||
LFUN_INSET_FLOAT, // Lgb 20000627
|
LFUN_INSET_FLOAT, // Lgb 20000627
|
||||||
LFUN_INSET_LIST, // Lgb 20000627
|
LFUN_INSET_LIST, // Lgb 20000627
|
||||||
LFUN_INSET_THEOREM, // Lgb 20000630
|
LFUN_INSET_THEOREM, // Lgb 20000630
|
||||||
LFUN_CREATE_CITATION, // Angus 20000705
|
LFUN_CITATION_CREATE, // Angus 20000705
|
||||||
LFUN_INSET_CAPTION, // Lgb 20000718
|
LFUN_INSET_CAPTION, // Lgb 20000718
|
||||||
LFUN_SWITCHBUFFER, // and where is this comming from?
|
LFUN_SWITCHBUFFER, // and where is this comming from?
|
||||||
LFUN_INSERT_URL, // Angus 20000726
|
LFUN_INSERT_URL, // Angus 20000726
|
||||||
LFUN_TABULAR_FEATURE, // Jug 20000728
|
LFUN_TABULAR_FEATURE, // Jug 20000728
|
||||||
LFUN_LAYOUT_TABULAR, // Jug 20000731
|
LFUN_LAYOUT_TABULAR, // Jug 20000731
|
||||||
|
LFUN_INDEX_INSERT, // Angus 20000803
|
||||||
LFUN_LASTACTION /* this marks the end of the table */
|
LFUN_LASTACTION /* this marks the end of the table */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -33,7 +33,6 @@ class InsetGraphics;
|
|||||||
class InsetBibKey;
|
class InsetBibKey;
|
||||||
class InsetBibtex;
|
class InsetBibtex;
|
||||||
class InsetInclude;
|
class InsetInclude;
|
||||||
class InsetIndex;
|
|
||||||
class InsetInfo;
|
class InsetInfo;
|
||||||
class InsetTabular;
|
class InsetTabular;
|
||||||
class InsetCommand;
|
class InsetCommand;
|
||||||
@ -109,7 +108,9 @@ public:
|
|||||||
///
|
///
|
||||||
Signal1<void, InsetInclude *> showInclude;
|
Signal1<void, InsetInclude *> showInclude;
|
||||||
///
|
///
|
||||||
Signal1<void, InsetIndex *> showIndex;
|
Signal1<void, InsetCommand *> showIndex;
|
||||||
|
///
|
||||||
|
Signal1<void, string const &> createIndex;
|
||||||
///
|
///
|
||||||
Signal1<void, InsetBibKey *> showBibkey;
|
Signal1<void, InsetBibKey *> showBibkey;
|
||||||
///
|
///
|
||||||
|
@ -2,10 +2,11 @@
|
|||||||
#include FORMS_H_LOCATION
|
#include FORMS_H_LOCATION
|
||||||
|
|
||||||
#include "Dialogs.h"
|
#include "Dialogs.h"
|
||||||
#include "FormCopyright.h"
|
|
||||||
#include "FormPreferences.h"
|
|
||||||
#include "FormGraphics.h"
|
|
||||||
#include "FormCitation.h"
|
#include "FormCitation.h"
|
||||||
|
#include "FormCopyright.h"
|
||||||
|
#include "FormGraphics.h"
|
||||||
|
#include "FormIndex.h"
|
||||||
|
#include "FormPreferences.h"
|
||||||
#include "FormPrint.h"
|
#include "FormPrint.h"
|
||||||
#include "FormTabular.h"
|
#include "FormTabular.h"
|
||||||
#include "FormToc.h"
|
#include "FormToc.h"
|
||||||
@ -18,10 +19,11 @@
|
|||||||
|
|
||||||
Dialogs::Dialogs(LyXView * lv)
|
Dialogs::Dialogs(LyXView * lv)
|
||||||
{
|
{
|
||||||
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 FormCitation(lv, this));
|
||||||
|
dialogs_.push_back(new FormCopyright(lv, this));
|
||||||
|
dialogs_.push_back(new FormGraphics(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 FormPrint(lv, this));
|
||||||
dialogs_.push_back(new FormTabular(lv, this));
|
dialogs_.push_back(new FormTabular(lv, this));
|
||||||
dialogs_.push_back(new FormToc(lv, this));
|
dialogs_.push_back(new FormToc(lv, this));
|
||||||
|
@ -52,11 +52,18 @@ FormCitation::FormCitation(LyXView * lv, Dialogs * d)
|
|||||||
|
|
||||||
FormCitation::~FormCitation()
|
FormCitation::~FormCitation()
|
||||||
{
|
{
|
||||||
free();
|
|
||||||
delete dialog_;
|
delete dialog_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void FormCitation::clearStore()
|
||||||
|
{
|
||||||
|
citekeys.clear();
|
||||||
|
bibkeys.clear();
|
||||||
|
bibkeysInfo.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void FormCitation::build()
|
void FormCitation::build()
|
||||||
{
|
{
|
||||||
dialog_ = build_citation();
|
dialog_ = build_citation();
|
||||||
@ -416,7 +423,7 @@ void FormCitation::apply()
|
|||||||
lv_->view()->updateInset( inset_, true );
|
lv_->view()->updateInset( inset_, true );
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
lv_->getLyXFunc()->Dispatch( LFUN_INSERT_CITATION,
|
lv_->getLyXFunc()->Dispatch( LFUN_CITATION_INSERT,
|
||||||
params.getAsString().c_str() );
|
params.getAsString().c_str() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,17 +43,19 @@ public:
|
|||||||
//@}
|
//@}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**@name Slot Methods */
|
|
||||||
//@{
|
|
||||||
virtual void update();
|
|
||||||
/// Apply from dialog
|
|
||||||
virtual void apply();
|
|
||||||
/// Filter the inputs
|
|
||||||
virtual void input( long );
|
|
||||||
/// Build the dialog
|
/// Build the dialog
|
||||||
virtual void build();
|
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;
|
virtual FL_FORM * const form() const;
|
||||||
|
|
||||||
///
|
///
|
||||||
void updateBrowser( FL_OBJECT *, std::vector<string> const & ) const;
|
void updateBrowser( FL_OBJECT *, std::vector<string> const & ) const;
|
||||||
///
|
///
|
||||||
@ -64,7 +66,6 @@ private:
|
|||||||
void setSize( int, bool ) const;
|
void setSize( int, bool ) const;
|
||||||
///
|
///
|
||||||
FD_form_citation * build_citation();
|
FD_form_citation * build_citation();
|
||||||
//@}
|
|
||||||
|
|
||||||
/// Real GUI implementation.
|
/// Real GUI implementation.
|
||||||
FD_form_citation * dialog_;
|
FD_form_citation * dialog_;
|
||||||
|
@ -34,15 +34,18 @@ FormCommand::FormCommand(LyXView * lv, Dialogs * d, string const & t)
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
FormCommand::~FormCommand()
|
||||||
|
{
|
||||||
|
free();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void FormCommand::showInset( InsetCommand * const inset )
|
void FormCommand::showInset( InsetCommand * const inset )
|
||||||
{
|
{
|
||||||
if( dialogIsOpen || inset == 0 ) return;
|
if( dialogIsOpen || inset == 0 ) return;
|
||||||
|
|
||||||
inset_ = inset;
|
inset_ = inset;
|
||||||
// companion to Lars' commenting out in insetcommand.
|
ih_ = inset_->hide.connect(slot(this, &FormCommand::hide));
|
||||||
// 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));
|
|
||||||
|
|
||||||
params = inset->params();
|
params = inset->params();
|
||||||
show();
|
show();
|
||||||
@ -110,6 +113,7 @@ void FormCommand::hide()
|
|||||||
inset_ = 0;
|
inset_ = 0;
|
||||||
ih_.disconnect();
|
ih_.disconnect();
|
||||||
dialogIsOpen = false;
|
dialogIsOpen = false;
|
||||||
|
clearStore();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -31,6 +31,8 @@ class FormCommand : public DialogBase, public noncopyable {
|
|||||||
public:
|
public:
|
||||||
/// Constructor
|
/// Constructor
|
||||||
FormCommand(LyXView *, Dialogs *, string const & );
|
FormCommand(LyXView *, Dialogs *, string const & );
|
||||||
|
/// Destructor
|
||||||
|
virtual ~FormCommand();
|
||||||
|
|
||||||
/**@name Real per-instance Callback Methods */
|
/**@name Real per-instance Callback Methods */
|
||||||
//@{
|
//@{
|
||||||
@ -44,29 +46,26 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
/**@name Slot Methods */
|
/**@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 & );
|
void createInset( string const & );
|
||||||
///
|
/// Slot launching dialog to an existing inset
|
||||||
void showInset( InsetCommand * const );
|
void showInset( InsetCommand * const );
|
||||||
///
|
|
||||||
void show();
|
|
||||||
/// Hide the dialog.
|
|
||||||
void hide();
|
|
||||||
/// Explicitly free the dialog.
|
|
||||||
void free();
|
|
||||||
///
|
|
||||||
virtual void input( long ) = 0;
|
|
||||||
///
|
|
||||||
virtual void update() = 0;
|
|
||||||
/// Apply from dialog
|
|
||||||
virtual void apply() = 0;
|
|
||||||
/// Build the dialog
|
|
||||||
virtual void build() = 0;
|
|
||||||
///
|
|
||||||
virtual FL_FORM * const form() const = 0;
|
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
/**@name Private Data */
|
/// 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 (modify or create inset)
|
||||||
|
virtual void apply() = 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 Protected Data */
|
||||||
//@{
|
//@{
|
||||||
/** Which LyXFunc do we use?
|
/** Which LyXFunc do we use?
|
||||||
We could modify Dialogs to have a visible LyXFunc* instead and
|
We could modify Dialogs to have a visible LyXFunc* instead and
|
||||||
@ -77,19 +76,32 @@ protected:
|
|||||||
Used so we can get at the signals we have to connect to.
|
Used so we can get at the signals we have to connect to.
|
||||||
*/
|
*/
|
||||||
Dialogs * d_;
|
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.
|
/// Update connection.
|
||||||
Connection u_;
|
Connection u_;
|
||||||
/// Hide connection.
|
/// Hide connection.
|
||||||
Connection h_;
|
Connection h_;
|
||||||
/// inset::hide connection.
|
/// inset::hide connection.
|
||||||
Connection ih_;
|
Connection ih_;
|
||||||
///
|
/// block opening of form from more than one inset
|
||||||
InsetCommand * inset_;
|
|
||||||
///
|
|
||||||
bool dialogIsOpen;
|
bool dialogIsOpen;
|
||||||
///
|
/// dialog title, displayed by WM.
|
||||||
InsetCommandParams params;
|
|
||||||
///
|
|
||||||
string title;
|
string title;
|
||||||
//@}
|
//@}
|
||||||
};
|
};
|
||||||
|
108
src/frontends/xforms/FormIndex.C
Normal file
108
src/frontends/xforms/FormIndex.C
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
// -*- 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() );
|
||||||
|
}
|
||||||
|
}
|
53
src/frontends/xforms/FormIndex.h
Normal file
53
src/frontends/xforms/FormIndex.h
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
// -*- 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
|
@ -42,11 +42,16 @@ FormToc::FormToc(LyXView * lv, Dialogs * d)
|
|||||||
|
|
||||||
FormToc::~FormToc()
|
FormToc::~FormToc()
|
||||||
{
|
{
|
||||||
free();
|
|
||||||
delete dialog_;
|
delete dialog_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void FormToc::clearStore()
|
||||||
|
{
|
||||||
|
toclist.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void FormToc::build()
|
void FormToc::build()
|
||||||
{
|
{
|
||||||
dialog_ = build_toc();
|
dialog_ = build_toc();
|
||||||
|
@ -31,23 +31,22 @@ public:
|
|||||||
~FormToc();
|
~FormToc();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**@name Slot Methods */
|
|
||||||
//@{
|
|
||||||
///
|
|
||||||
virtual void update();
|
|
||||||
/// Apply from dialog
|
|
||||||
virtual void apply();
|
|
||||||
///
|
|
||||||
virtual void input( long ) {};
|
|
||||||
/// Build the dialog
|
/// Build the dialog
|
||||||
virtual 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();
|
||||||
|
/// 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;
|
virtual FL_FORM * const form() const;
|
||||||
///
|
///
|
||||||
void updateToc();
|
void updateToc();
|
||||||
///
|
///
|
||||||
FD_form_toc * build_toc();
|
FD_form_toc * build_toc();
|
||||||
//@}
|
|
||||||
|
|
||||||
/// Real GUI implementation.
|
/// Real GUI implementation.
|
||||||
FD_form_toc * dialog_;
|
FD_form_toc * dialog_;
|
||||||
|
@ -19,17 +19,12 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
#include "BufferView.h"
|
|
||||||
#include "Dialogs.h"
|
#include "Dialogs.h"
|
||||||
#include "FormUrl.h"
|
#include "FormUrl.h"
|
||||||
#include "LyXView.h"
|
#include "LyXView.h"
|
||||||
#include "buffer.h"
|
#include "buffer.h"
|
||||||
#include "form_url.h"
|
#include "form_url.h"
|
||||||
#include "lyxfunc.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)
|
FormUrl::FormUrl(LyXView * lv, Dialogs * d)
|
||||||
: FormCommand(lv, d, _("Url")), dialog_(0)
|
: FormCommand(lv, d, _("Url")), dialog_(0)
|
||||||
@ -44,7 +39,6 @@ FormUrl::FormUrl(LyXView * lv, Dialogs * d)
|
|||||||
|
|
||||||
FormUrl::~FormUrl()
|
FormUrl::~FormUrl()
|
||||||
{
|
{
|
||||||
free();
|
|
||||||
delete dialog_;
|
delete dialog_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,17 +32,15 @@ public:
|
|||||||
//@}
|
//@}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**@name Slot Methods */
|
|
||||||
//@{
|
|
||||||
///
|
|
||||||
virtual void update();
|
|
||||||
/// Apply from dialog
|
|
||||||
void apply();
|
|
||||||
///
|
|
||||||
virtual void input( long ) {};
|
|
||||||
/// Build the dialog
|
/// 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;
|
virtual FL_FORM * const form() const;
|
||||||
///
|
///
|
||||||
FD_form_url * build_url();
|
FD_form_url * build_url();
|
||||||
|
@ -26,6 +26,10 @@ libxforms_la_SOURCES = \
|
|||||||
FormGraphics.h \
|
FormGraphics.h \
|
||||||
form_graphics.C \
|
form_graphics.C \
|
||||||
form_graphics.h \
|
form_graphics.h \
|
||||||
|
FormIndex.C \
|
||||||
|
FormIndex.h \
|
||||||
|
form_index.C \
|
||||||
|
form_index.h \
|
||||||
FormPreferences.C \
|
FormPreferences.C \
|
||||||
FormPreferences.h \
|
FormPreferences.h \
|
||||||
form_preferences.C \
|
form_preferences.C \
|
||||||
|
40
src/frontends/xforms/form_index.C
Normal file
40
src/frontends/xforms/form_index.C
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
// 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;
|
||||||
|
}
|
||||||
|
/*---------------------------------------*/
|
||||||
|
|
20
src/frontends/xforms/form_index.h
Normal file
20
src/frontends/xforms/form_index.h
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
/** 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_ */
|
88
src/frontends/xforms/forms/form_index.fd
Normal file
88
src/frontends/xforms/forms/form_index.fd
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
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
|
@ -21,6 +21,7 @@ FDESIGN = fdesign
|
|||||||
|
|
||||||
SRCS := form_citation.fd \
|
SRCS := form_citation.fd \
|
||||||
form_copyright.fd \
|
form_copyright.fd \
|
||||||
|
form_index.fd \
|
||||||
form_preferences.fd \
|
form_preferences.fd \
|
||||||
form_print.fd \
|
form_print.fd \
|
||||||
form_graphics.fd \
|
form_graphics.fd \
|
||||||
|
@ -16,13 +16,13 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "insetcommand.h"
|
#include "insetcommand.h"
|
||||||
|
#include "support/utility.hpp"
|
||||||
|
|
||||||
/** Used to insert citations
|
/** Used to insert citations
|
||||||
*/
|
*/
|
||||||
class InsetCitation : public InsetCommand {
|
class InsetCitation : public InsetCommand, public noncopyable {
|
||||||
public:
|
public:
|
||||||
///
|
///
|
||||||
explicit
|
|
||||||
InsetCitation(InsetCommandParams const &);
|
InsetCitation(InsetCommandParams const &);
|
||||||
///
|
///
|
||||||
Inset * Clone() const { return new InsetCitation(params()); }
|
Inset * Clone() const { return new InsetCitation(params()); }
|
||||||
|
@ -1,158 +1,39 @@
|
|||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <cstdlib>
|
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma implementation
|
#pragma implementation
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include FORMS_H_LOCATION
|
|
||||||
#include "insetindex.h"
|
#include "insetindex.h"
|
||||||
#include "buffer.h"
|
#include "BufferView.h"
|
||||||
#include "debug.h"
|
#include "LyXView.h"
|
||||||
|
#include "frontends/Dialogs.h"
|
||||||
#include "LaTeXFeatures.h"
|
#include "LaTeXFeatures.h"
|
||||||
#include "gettext.h"
|
|
||||||
#include "LString.h"
|
|
||||||
#include "lyx_gui_misc.h" // WarnReadonly
|
|
||||||
|
|
||||||
FD_index_form * index_form = 0;
|
InsetIndex::InsetIndex(InsetCommandParams const & p)
|
||||||
|
: InsetCommand(p)
|
||||||
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()
|
|
||||||
{
|
|
||||||
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
|
string InsetIndex::getScreenLabel() const
|
||||||
{
|
{
|
||||||
return _("Idx");
|
return _("Idx");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
void InsetIndex::Edit(BufferView * bv, int, int, unsigned int)
|
||||||
// InsetPrintIndex
|
|
||||||
//
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
InsetPrintIndex::InsetPrintIndex()
|
|
||||||
: InsetCommand("printindex")
|
|
||||||
{
|
{
|
||||||
owner = 0;
|
bv->owner()->getDialogs()->showIndex( this );
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
InsetPrintIndex::InsetPrintIndex(Buffer * o)
|
InsetPrintIndex::InsetPrintIndex(InsetCommandParams const & p)
|
||||||
: InsetCommand("printindex"), owner(o)
|
: InsetCommand(p)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
InsetPrintIndex::~InsetPrintIndex()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
string InsetPrintIndex::getScreenLabel() const
|
string InsetPrintIndex::getScreenLabel() const
|
||||||
{
|
{
|
||||||
return _("PrintIndex");
|
return _("Index");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -17,88 +17,45 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "insetcommand.h"
|
#include "insetcommand.h"
|
||||||
|
#include "support/utility.hpp"
|
||||||
|
|
||||||
class Buffer;
|
|
||||||
struct LaTeXFeatures;
|
struct LaTeXFeatures;
|
||||||
struct FD_index_form;
|
|
||||||
|
|
||||||
// Created by Lgb 970227
|
|
||||||
|
|
||||||
|
|
||||||
/** Used to insert index labels
|
/** Used to insert index labels
|
||||||
*/
|
*/
|
||||||
class InsetIndex : public InsetCommand {
|
class InsetIndex : public InsetCommand, public noncopyable {
|
||||||
public:
|
public:
|
||||||
///
|
///
|
||||||
InsetIndex() : InsetCommand("index") {}
|
InsetIndex(InsetCommandParams const &);
|
||||||
///
|
///
|
||||||
explicit
|
Inset * Clone() const { return new InsetIndex(params());}
|
||||||
InsetIndex(string const & key);
|
|
||||||
///
|
|
||||||
~InsetIndex();
|
|
||||||
///
|
|
||||||
Inset * Clone() const { return new InsetIndex(getContents());}
|
|
||||||
///
|
|
||||||
void Edit(BufferView *, int, int, unsigned int);
|
|
||||||
///
|
|
||||||
EDITABLE Editable() const
|
|
||||||
{
|
|
||||||
return IS_EDITABLE;
|
|
||||||
}
|
|
||||||
///
|
///
|
||||||
string getScreenLabel() const;
|
string getScreenLabel() const;
|
||||||
///
|
///
|
||||||
void callback( FD_index_form *, long );
|
EDITABLE Editable() const { return IS_EDITABLE; }
|
||||||
///
|
///
|
||||||
struct Holder {
|
void Edit(BufferView *, int, int, unsigned int);
|
||||||
InsetIndex * inset;
|
|
||||||
BufferView * view;
|
|
||||||
};
|
|
||||||
private:
|
|
||||||
///
|
|
||||||
Holder holder;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class InsetPrintIndex : public InsetCommand {
|
class InsetPrintIndex : public InsetCommand, public noncopyable {
|
||||||
public:
|
public:
|
||||||
#if 0
|
|
||||||
///
|
///
|
||||||
InsetPrintIndex();
|
InsetPrintIndex(InsetCommandParams const &);
|
||||||
#endif
|
|
||||||
///
|
///
|
||||||
InsetPrintIndex(Buffer *);
|
Inset * Clone() const { return new InsetPrintIndex(params());}
|
||||||
#if 0
|
|
||||||
///
|
|
||||||
~InsetPrintIndex();
|
|
||||||
#endif
|
|
||||||
/// Updates needed features for this inset.
|
/// Updates needed features for this inset.
|
||||||
void Validate(LaTeXFeatures & features) const;
|
void Validate(LaTeXFeatures & features) const;
|
||||||
///
|
///
|
||||||
void Edit(BufferView *, int, int, unsigned int) {}
|
void Edit(BufferView *, int, int, unsigned int) {}
|
||||||
///
|
///
|
||||||
EDITABLE Editable() const{
|
EDITABLE Editable() const{ return NOT_EDITABLE; }
|
||||||
return IS_EDITABLE;
|
|
||||||
}
|
|
||||||
/// WHY is clone missing? (Lgb)
|
|
||||||
///
|
///
|
||||||
bool display() const { return true; }
|
bool display() const { return true; }
|
||||||
///
|
///
|
||||||
Inset::Code LyxCode() const;
|
Inset::Code LyxCode() const;
|
||||||
///
|
///
|
||||||
string getScreenLabel() 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
|
||||||
|
@ -17,10 +17,11 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "insetcommand.h"
|
#include "insetcommand.h"
|
||||||
|
#include "support/utility.hpp"
|
||||||
|
|
||||||
/** Used to insert table of contents
|
/** Used to insert table of contents
|
||||||
*/
|
*/
|
||||||
class InsetTOC : public InsetCommand {
|
class InsetTOC : public InsetCommand, public noncopyable {
|
||||||
public:
|
public:
|
||||||
///
|
///
|
||||||
InsetTOC(InsetCommandParams const & p) : InsetCommand(p) {}
|
InsetTOC(InsetCommandParams const & p) : InsetCommand(p) {}
|
||||||
|
@ -16,12 +16,13 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "insetcommand.h"
|
#include "insetcommand.h"
|
||||||
|
#include "support/utility.hpp"
|
||||||
|
|
||||||
struct LaTeXFeatures;
|
struct LaTeXFeatures;
|
||||||
|
|
||||||
/** The url inset
|
/** The url inset
|
||||||
*/
|
*/
|
||||||
class InsetUrl : public InsetCommand {
|
class InsetUrl : public InsetCommand, public noncopyable {
|
||||||
public:
|
public:
|
||||||
///
|
///
|
||||||
explicit
|
explicit
|
||||||
|
@ -33,7 +33,6 @@
|
|||||||
#include "minibuffer.h"
|
#include "minibuffer.h"
|
||||||
#include "print_form.h"
|
#include "print_form.h"
|
||||||
#include "sp_form.h"
|
#include "sp_form.h"
|
||||||
#include "insets/insetindex.h"
|
|
||||||
#include "LyXView.h"
|
#include "LyXView.h"
|
||||||
#include "bufferview_funcs.h"
|
#include "bufferview_funcs.h"
|
||||||
#include "support/filetools.h"
|
#include "support/filetools.h"
|
||||||
@ -66,7 +65,6 @@ extern FD_space * fd_space;
|
|||||||
extern FD_matrix * fd_matrix;
|
extern FD_matrix * fd_matrix;
|
||||||
extern FD_bibitem_form * bibitem_form;
|
extern FD_bibitem_form * bibitem_form;
|
||||||
extern FD_include * form;
|
extern FD_include * form;
|
||||||
extern FD_index_form * index_form;
|
|
||||||
|
|
||||||
extern void HideFiguresPopups();
|
extern void HideFiguresPopups();
|
||||||
|
|
||||||
@ -178,11 +176,6 @@ void CloseAllBufferRelatedDialogs()
|
|||||||
fl_hide_form(form->include);
|
fl_hide_form(form->include);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (index_form) {
|
|
||||||
if (index_form->index_form->visible) {
|
|
||||||
fl_hide_form(index_form->index_form);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
HideFiguresPopups();
|
HideFiguresPopups();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -321,11 +314,6 @@ void updateAllVisibleBufferRelatedDialogs()
|
|||||||
fl_hide_form(form->include);
|
fl_hide_form(form->include);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (index_form) {
|
|
||||||
if (index_form->index_form->visible) {
|
|
||||||
fl_hide_form(index_form->index_form);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
HideFiguresPopups();
|
HideFiguresPopups();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2538,11 +2538,10 @@ string LyXFunc::Dispatch(int ac,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_CREATE_CITATION:
|
case LFUN_CITATION_CREATE:
|
||||||
{
|
{
|
||||||
// Should do this "at source"
|
// Should do this "at source"
|
||||||
InsetCommandParams p;
|
InsetCommandParams p( "cite" );
|
||||||
p.setCmdName( "cite" );
|
|
||||||
|
|
||||||
if (contains(argument, "|")) {
|
if (contains(argument, "|")) {
|
||||||
p.setContents( token(argument, '|', 0) );
|
p.setContents( token(argument, '|', 0) );
|
||||||
@ -2555,7 +2554,7 @@ string LyXFunc::Dispatch(int ac,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_INSERT_CITATION:
|
case LFUN_CITATION_INSERT:
|
||||||
{
|
{
|
||||||
InsetCommandParams p;
|
InsetCommandParams p;
|
||||||
p.setFromString( argument );
|
p.setFromString( argument );
|
||||||
@ -2621,21 +2620,18 @@ string LyXFunc::Dispatch(int ac,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_INDEX_INSERT:
|
case LFUN_INDEX_CREATE:
|
||||||
case LFUN_INDEX_INSERT_LAST:
|
case LFUN_INDEX_CREATE_LAST:
|
||||||
{
|
{
|
||||||
// Can't do that at the beginning of a paragraph.
|
// Can't do that at the beginning of a paragraph.
|
||||||
if (owner->view()->text->cursor.pos() - 1 < 0)
|
if (owner->view()->text->cursor.pos() - 1 < 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
InsetIndex * new_inset = new InsetIndex();
|
InsetCommandParams p( "index" );
|
||||||
|
|
||||||
if (!argument.empty()) {
|
if (!argument.empty()) {
|
||||||
string lsarg(argument);
|
p.setContents( argument );
|
||||||
new_inset->setContents(lsarg);
|
|
||||||
if (!owner->view()->insertInset(new_inset))
|
|
||||||
delete new_inset;
|
|
||||||
} else {
|
} else {
|
||||||
//reh 98/09/21
|
|
||||||
//get the current word for an argument
|
//get the current word for an argument
|
||||||
LyXParagraph::size_type lastpos =
|
LyXParagraph::size_type lastpos =
|
||||||
owner->view()->text->cursor.pos() - 1;
|
owner->view()->text->cursor.pos() - 1;
|
||||||
@ -2646,36 +2642,32 @@ string LyXFunc::Dispatch(int ac,
|
|||||||
->text->cursor.par()->GetWord(lastpos));
|
->text->cursor.par()->GetWord(lastpos));
|
||||||
|
|
||||||
//make the new inset and write the current word into it
|
//make the new inset and write the current word into it
|
||||||
InsetIndex * new_inset = new InsetIndex();
|
p.setContents( curstring );
|
||||||
|
|
||||||
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.
|
owner->getDialogs()->createIndex( p.getAsString() );
|
||||||
// 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;
|
|
||||||
}
|
}
|
||||||
|
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;
|
break;
|
||||||
|
|
||||||
case LFUN_INDEX_PRINT:
|
case LFUN_INDEX_PRINT:
|
||||||
{
|
{
|
||||||
Inset * new_inset = new InsetPrintIndex(owner->buffer());
|
InsetCommandParams p("printindex");
|
||||||
if (!owner->view()->insertInset(new_inset, "Standard", true))
|
Inset * inset = new InsetPrintIndex(p);
|
||||||
delete new_inset;
|
if (!owner->view()->insertInset(inset, "Standard", true))
|
||||||
|
delete inset;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -99,6 +99,12 @@ void MathDelimInset::Write(ostream & os, bool fragile)
|
|||||||
void MathDecorationInset::Write(ostream & os, bool fragile)
|
void MathDecorationInset::Write(ostream & os, bool fragile)
|
||||||
{
|
{
|
||||||
latexkeys * l = lm_get_key_by_id(deco, LM_TK_WIDE);
|
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 << '{';
|
os << '\\' << l->name << '{';
|
||||||
MathParInset::Write(os, fragile);
|
MathParInset::Write(os, fragile);
|
||||||
os << '}';
|
os << '}';
|
||||||
|
@ -1899,9 +1899,9 @@ void Menus::ShowInsertMenu(FL_OBJECT * ob, long)
|
|||||||
case 12: tmpfunc->Dispatch(LFUN_INSERT_NOTE); break;
|
case 12: tmpfunc->Dispatch(LFUN_INSERT_NOTE); break;
|
||||||
case 13: tmpfunc->Dispatch(LFUN_INSERT_LABEL); break;
|
case 13: tmpfunc->Dispatch(LFUN_INSERT_LABEL); break;
|
||||||
case 14: tmpfunc->Dispatch(LFUN_INSERT_REF); break;
|
case 14: tmpfunc->Dispatch(LFUN_INSERT_REF); break;
|
||||||
case 15: tmpfunc->Dispatch(LFUN_CREATE_CITATION); break;
|
case 15: tmpfunc->Dispatch(LFUN_CITATION_CREATE); break;
|
||||||
case 16: tmpfunc->Dispatch(LFUN_INDEX_INSERT); break;
|
case 16: tmpfunc->Dispatch(LFUN_INDEX_CREATE); break;
|
||||||
case 17: tmpfunc->Dispatch(LFUN_INDEX_INSERT_LAST); break;
|
case 17: tmpfunc->Dispatch(LFUN_INDEX_CREATE_LAST); break;
|
||||||
case 18: tmpfunc->Dispatch(LFUN_URL); break;
|
case 18: tmpfunc->Dispatch(LFUN_URL); break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user