patch from Angus

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@944 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2000-08-01 17:33:32 +00:00
parent d4767f7915
commit db47e6bc77
44 changed files with 902 additions and 1129 deletions

View File

@ -1,3 +1,50 @@
2000-08-01 Angus Leeming <a.leeming@ic.ac.uk>
* src/insets/insetcommand.h (hide): new SigC::Signal0
(d-tor) new virtual destructor emits hide signal
* src/insets/insetcite.[Ch] (hide, d-tor, EditMessage): removed
* src/insets/inseturl.[Ch] (hide, d-tor): ditto
* src/insets/insettoc.[Ch]: one inset now deals with TOC, LOA,
LOF and LOT. Inset is now GUI-independent
* src/insets/insetloa.[Ch]: redundant
* src/insets/insetlof.[Ch]: ditto
* src/insets/insetlot.[Ch]: ditto
* src/frontends/xforms/forms/form_url.fd: tweaked!
* src/frontends/xforms/forms/form_citation.fd: ditto
* src/frontends/xforms/FormCommand.[Ch]: new base class to those
dialogs dealing with InsetCommand insets
* src/frontends/xforms/FormCitation.[Ch]: now makes use of
FormCommand base class
* src/frontends/xforms/FormUrl.[Ch]: ditto
* src/frontends/xforms/forms/form_toc.fd: Xforms implementation
of the TOC dialog
* src/frontends/xforms/FormToc.[Ch]: ditto
* src/frontends/Dialogs.h (showCitation, showTOC, showUrl): all
passed a generic InsetCommand pointer
* src/frontends/xforms/Dialogs.C (c-tor): create instance of FormToc
* src/lyxfunc.C (Dispatch) : modified to accomodate new FormToc class
and modified InsetTOC class
* src/buffer.C: ditto
* forms/lyx.fd: strip out old FD_form_toc code
* src/lyx_gui_misc.C: ditto
* src/lyx_gui.C: ditto
* src/lyx_cb.C: ditto
* src/lyx.[Ch]: ditto
2000-08-01 Lars Gullik Bjønnes <larsbj@lyx.org>
* src/support/utility.hpp: tr -d '\r'
2000-08-01 Juergen Vigna <jug@sad.it> 2000-08-01 Juergen Vigna <jug@sad.it>
* src/insets/insettabular.h: removed initFeatures() as it's not needed. * src/insets/insettabular.h: removed initFeatures() as it's not needed.

View File

@ -3,7 +3,7 @@ Magic: 13000
Internal Form Definition File Internal Form Definition File
(do not change) (do not change)
Number of forms: 6 Number of forms: 5
Unit of measure: FL_COORD_PIXEL Unit of measure: FL_COORD_PIXEL
=============== FORM =============== =============== FORM ===============
@ -402,102 +402,6 @@ name:
callback: ScreenCancelCB callback: ScreenCancelCB
argument: 0 argument: 0
=============== FORM ===============
Name: form_toc
Width: 420
Height: 340
Number of Objects: 5
--------------------
class: FL_BOX
type: UP_BOX
box: 0 0 420 340
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_BROWSER
type: HOLD_BROWSER
box: 10 10 400 280
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_YELLOW
alignment: FL_ALIGN_BOTTOM
style: FL_NORMAL_STYLE
size: FL_DEFAULT_SIZE
lcol: FL_BLACK
label:
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NorthWest FL_SouthEast
name: browser_toc
callback: TocSelectCB
argument: 0
--------------------
class: FL_BUTTON
type: RETURN_BUTTON
box: 310 300 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: Close
shortcut: ^M
resize: FL_RESIZE_NONE
gravity: FL_SouthEast FL_SouthEast
name:
callback: TocCancelCB
argument: 0
--------------------
class: FL_BUTTON
type: NORMAL_BUTTON
box: 200 300 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: Update|Uu#u
shortcut:
resize: FL_RESIZE_NONE
gravity: FL_SouthEast FL_SouthEast
name:
callback: TocUpdateCB
argument: 0
--------------------
class: FL_CHOICE
type: NORMAL_CHOICE
box: 60 300 130 30
boxtype: FL_FRAME_BOX
colors: FL_COL1 FL_BLACK
alignment: FL_ALIGN_LEFT
style: FL_NORMAL_STYLE
size: FL_DEFAULT_SIZE
lcol: FL_BLACK
label: Type|Tt#t
shortcut:
resize: FL_RESIZE_NONE
gravity: FL_SouthEast FL_SouthEast
name: toctype
callback: TocUpdateCB
argument: 0
=============== FORM =============== =============== FORM ===============
Name: form_ref Name: form_ref
Width: 590 Width: 590

View File

@ -38,6 +38,7 @@ src/frontends/xforms/FormPrint.C
src/frontends/xforms/form_print.C src/frontends/xforms/form_print.C
src/frontends/xforms/FormTabular.C src/frontends/xforms/FormTabular.C
src/frontends/xforms/form_tabular.C src/frontends/xforms/form_tabular.C
src/frontends/xforms/FormToc.C
src/frontends/xforms/FormUrl.C src/frontends/xforms/FormUrl.C
src/frontends/xforms/form_url.C src/frontends/xforms/form_url.C
src/frontends/xforms/Menubar_pimpl.C src/frontends/xforms/Menubar_pimpl.C
@ -57,9 +58,6 @@ src/insets/insetindex.C
src/insets/insetinfo.C src/insets/insetinfo.C
src/insets/insetlabel.C src/insets/insetlabel.C
src/insets/insetlist.C src/insets/insetlist.C
src/insets/insetloa.C
src/insets/insetlof.C
src/insets/insetlot.C
src/insets/insetmarginal.C src/insets/insetmarginal.C
src/insets/insetminipage.C src/insets/insetminipage.C
src/insets/insetparent.C src/insets/insetparent.C

View File

@ -18,6 +18,7 @@
#include FORMS_H_LOCATION #include FORMS_H_LOCATION
#include "undo.h" #include "undo.h"
#include "support/utility.hpp"
class LyXView; class LyXView;
class LyXText; class LyXText;
@ -27,7 +28,7 @@ class LyXScreen;
class WorkArea; class WorkArea;
/// ///
class BufferView { class BufferView : public noncopyable {
public: public:
/// ///
enum UpdateCodes { enum UpdateCodes {

View File

@ -19,6 +19,7 @@
#include FORMS_H_LOCATION #include FORMS_H_LOCATION
#include "Timeout.h" #include "Timeout.h"
#include "support/utility.hpp"
// uncomment this line to try out the new menus // uncomment this line to try out the new menus
#define NEW_MENUBAR 1 #define NEW_MENUBAR 1
@ -47,7 +48,7 @@ using SigC::Object;
view is supposed (at least IMHO) to be another class, that shows its output view is supposed (at least IMHO) to be another class, that shows its output
in one or more LyXView's. in one or more LyXView's.
*/ */
class LyXView : public Object { class LyXView : public Object, public noncopyable {
public: public:
/// constructor /// constructor
LyXView(int w, int h); LyXView(int w, int h);

View File

@ -56,9 +56,6 @@
#include "insets/insetindex.h" #include "insets/insetindex.h"
#include "insets/insetinclude.h" #include "insets/insetinclude.h"
#include "insets/insettoc.h" #include "insets/insettoc.h"
#include "insets/insetlof.h"
#include "insets/insetlot.h"
#include "insets/insetloa.h"
#include "insets/insetparent.h" #include "insets/insetparent.h"
#include "insets/insetspecialchar.h" #include "insets/insetspecialchar.h"
#include "insets/figinset.h" #include "insets/figinset.h"
@ -981,14 +978,11 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
if (!inscmd.getOptions().empty() || !inscmd.getContents().empty()) { if (!inscmd.getOptions().empty() || !inscmd.getContents().empty()) {
inset = new InsetRef(inscmd, this); inset = new InsetRef(inscmd, this);
} }
} else if (inscmd.getCmdName() == "tableofcontents") { } else if (inscmd.getCmdName() == "tableofcontents"
inset = new InsetTOC(this); || inscmd.getCmdName() == "listofalgorithms"
} else if (inscmd.getCmdName() == "listoffigures") { || inscmd.getCmdName() == "listoffigures"
inset = new InsetLOF(this); || inscmd.getCmdName() == "listoftables") {
} else if (inscmd.getCmdName() == "listofalgorithms") { inset = new InsetTOC(inscmd.params());
inset = new InsetLOA(this);
} else if (inscmd.getCmdName() == "listoftables") {
inset = new InsetLOT(this);
} else if (inscmd.getCmdName() == "printindex") { } else if (inscmd.getCmdName() == "printindex") {
inset = new InsetPrintIndex(this); inset = new InsetPrintIndex(this);
} else if (inscmd.getCmdName() == "lyxparent") { } else if (inscmd.getCmdName() == "lyxparent") {
@ -1216,14 +1210,11 @@ void Buffer::readInset(LyXLex & lex, LyXParagraph *& par,
|| !inscmd.getContents().empty()) { || !inscmd.getContents().empty()) {
inset = new InsetRef(inscmd, this); inset = new InsetRef(inscmd, this);
} }
} else if (inscmd.getCmdName() == "tableofcontents") { } else if (inscmd.getCmdName() == "tableofcontents"
inset = new InsetTOC(this); || inscmd.getCmdName() == "listofalgorithms"
} else if (inscmd.getCmdName() == "listoffigures") { || inscmd.getCmdName() == "listoffigures"
inset = new InsetLOF(this); || inscmd.getCmdName() == "listoftables") {
} else if (inscmd.getCmdName() == "listofalgorithms") { inset = new InsetTOC(inscmd.params());
inset = new InsetLOA(this);
} else if (inscmd.getCmdName() == "listoftables") {
inset = new InsetLOT(this);
} else if (inscmd.getCmdName() == "printindex") { } else if (inscmd.getCmdName() == "printindex") {
inset = new InsetPrintIndex(this); inset = new InsetPrintIndex(this);
} else if (inscmd.getCmdName() == "lyxparent") { } else if (inscmd.getCmdName() == "lyxparent") {

View File

@ -59,6 +59,21 @@ _("Table of Contents|b");
_("Version control"); _("Version control");
_("View LaTeX log file|w"); _("View LaTeX log file|w");
_("Paste primary selection"); _("Paste primary selection");
_("Multicolumn|M");
_("Line Top|T");
_("Line Bottom|B");
_("Line Left|L");
_("Line Right|R");
_("Align Left|e");
_("Align Center|C");
_("Align Right|i");
_("V.Align Top|o");
_("V.Align Center|n");
_("V.Align Bottom|v");
_("Append Row|A");
_("Append Column|u");
_("Delete Row|w");
_("Delete Column|D");
_("as Lines|L"); _("as Lines|L");
_("as Paragraphs|g"); _("as Paragraphs|g");
_("Register|R"); _("Register|R");
@ -72,6 +87,7 @@ _("Paragraph...|P");
_("Paper...|a"); _("Paper...|a");
_("Document...|D"); _("Document...|D");
_("Table...|T"); _("Table...|T");
_("Tabular...|a");
_("Quotes...|Q"); _("Quotes...|Q");
_("Emphasize Style|E"); _("Emphasize Style|E");
_("Noun Style|N"); _("Noun Style|N");

View File

@ -32,12 +32,11 @@ class LyXView;
class InsetGraphics; class InsetGraphics;
class InsetBibKey; class InsetBibKey;
class InsetBibtex; class InsetBibtex;
class InsetCitation;
class InsetInclude; class InsetInclude;
class InsetIndex; class InsetIndex;
class InsetInfo; class InsetInfo;
class InsetTabular; class InsetTabular;
class InsetUrl; class InsetCommand;
using std::vector; using std::vector;
@ -114,11 +113,15 @@ public:
/// ///
Signal1<void, InsetBibKey *> showBibkey; Signal1<void, InsetBibKey *> showBibkey;
/// ///
Signal1<void, InsetCitation *> showCitation; Signal1<void, InsetCommand *> showCitation;
/// ///
Signal1<void, string const &> createCitation; Signal1<void, string const &> createCitation;
/// ///
Signal1<void, InsetUrl *> showUrl; Signal1<void, InsetCommand *> showTOC;
///
Signal1<void, string const &> createTOC;
///
Signal1<void, InsetCommand *> showUrl;
/// ///
Signal1<void, string const &> createUrl; Signal1<void, string const &> createUrl;
/// ///

View File

@ -8,6 +8,7 @@
#include "FormCitation.h" #include "FormCitation.h"
#include "FormPrint.h" #include "FormPrint.h"
#include "FormTabular.h" #include "FormTabular.h"
#include "FormToc.h"
#include "FormUrl.h" #include "FormUrl.h"
#ifdef __GNUG__ #ifdef __GNUG__
@ -23,6 +24,7 @@ Dialogs::Dialogs(LyXView * lv)
dialogs_.push_back(new FormCitation(lv, this)); dialogs_.push_back(new FormCitation(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 FormUrl(lv, this)); dialogs_.push_back(new FormUrl(lv, this));
// reduce the number of connections needed in // reduce the number of connections needed in

View File

@ -11,8 +11,6 @@
#include <config.h> #include <config.h>
#include <algorithm>
#include FORMS_H_LOCATION #include FORMS_H_LOCATION
#ifdef __GNUG__ #ifdef __GNUG__
@ -21,15 +19,12 @@
#include "gettext.h" #include "gettext.h"
#include "BufferView.h"
#include "Dialogs.h" #include "Dialogs.h"
#include "FormCitation.h" #include "FormCitation.h"
#include "LyXView.h" #include "LyXView.h"
#include "buffer.h" #include "buffer.h"
#include "form_citation.h" #include "form_citation.h"
#include "lyxfunc.h" #include "lyxfunc.h"
#include "xform_macros.h"
#include "insets/insetcite.h"
#include "support/filetools.h" #include "support/filetools.h"
using std::vector; using std::vector;
@ -38,14 +33,12 @@ using std::max;
using std::min; using std::min;
using std::find; using std::find;
C_RETURNCB(FormCitation, WMHideCB) static vector<string> citekeys;
C_GENERICCB(FormCitation, OKCB) static vector<string> bibkeys;
C_GENERICCB(FormCitation, CancelCB) static vector<string> bibkeysInfo;
C_GENERICCB(FormCitation, InputCB)
FormCitation::FormCitation(LyXView * lv, Dialogs * d) FormCitation::FormCitation(LyXView * lv, Dialogs * d)
: dialog_(0), lv_(lv), d_(d), u_(0), h_(0), ih_(0), : FormCommand(lv, d, _("Citation"))
inset_(0), dialogIsOpen(false)
{ {
// let the dialog be shown // let the dialog be shown
// These are permanent connections so we won't bother // These are permanent connections so we won't bother
@ -58,6 +51,7 @@ FormCitation::FormCitation(LyXView * lv, Dialogs * d)
FormCitation::~FormCitation() FormCitation::~FormCitation()
{ {
free(); free();
delete dialog_;
} }
@ -67,60 +61,12 @@ void FormCitation::build()
} }
void FormCitation::showInset( InsetCitation * inset ) FL_FORM * const FormCitation::form() const
{ {
if( dialogIsOpen || inset == 0 ) return; if( dialog_ && dialog_->form_citation )
return dialog_->form_citation;
inset_ = inset; else
ih_ = inset_->hide.connect(slot(this, &FormCitation::hide)); return 0;
textAfter = inset->getOptions();
updateCitekeys(inset->getContents());
show();
}
void FormCitation::createInset( string const & arg )
{
if( dialogIsOpen ) return;
string keys;
if (contains(arg, "|")) {
keys = token(arg, '|', 0);
textAfter = token(arg, '|', 1);
} else {
keys = arg;
textAfter.erase();
}
updateCitekeys(keys);
show();
}
void FormCitation::show()
{
if (!dialog_) {
build();
fl_set_form_atclose(dialog_->form_citation,
C_FormCitationWMHideCB, 0);
}
update(); // make sure its up-to-date
dialogIsOpen = true;
if (dialog_->form_citation->visible) {
fl_raise_form(dialog_->form_citation);
} else {
fl_show_form(dialog_->form_citation,
FL_PLACE_MOUSE | FL_FREE_SIZE,
FL_TRANSIENT,
_("Citation"));
u_ = d_->updateBufferDependent.
connect(slot(this, &FormCitation::update));
h_ = d_->hideBufferDependent.
connect(slot(this, &FormCitation::hide));
}
} }
@ -136,12 +82,19 @@ void FormCitation::update()
bibkeys.push_back(blist[i].first); bibkeys.push_back(blist[i].first);
bibkeysInfo.push_back(blist[i].second); bibkeysInfo.push_back(blist[i].second);
} }
blist.clear(); blist.clear();
citekeys.clear();
string tmp, keys( params.getContents() );
keys = frontStrip( split(keys, tmp, ',') );
while( !tmp.empty() ) {
citekeys.push_back( tmp );
keys = frontStrip( split(keys, tmp, ',') );
}
fl_freeze_form( dialog_->form_citation ); fl_freeze_form( dialog_->form_citation );
updateBrowser( dialog_->bibBrsr, bibkeys ); updateBrowser( dialog_->bibBrsr, bibkeys );
updateBrowser( dialog_->citeBrsr, citekeys ); updateBrowser( dialog_->citeBrsr, citekeys );
fl_clear_browser( dialog_->infoBrsr ); fl_clear_browser( dialog_->infoBrsr );
@ -159,26 +112,12 @@ void FormCitation::update()
bool bibPresent = ( bibkeys.size() > 0 ); bool bibPresent = ( bibkeys.size() > 0 );
setSize( size, bibPresent ); setSize( size, bibPresent );
fl_set_input( dialog_->textAftr, textAfter.c_str() ); fl_set_input( dialog_->textAftr, params.getOptions().c_str() );
fl_unfreeze_form( dialog_->form_citation ); fl_unfreeze_form( dialog_->form_citation );
} }
void FormCitation::updateCitekeys( string const & keysIn )
{
citekeys.clear();
string tmp;
string keys = keysIn;
keys = frontStrip( split(keys, tmp, ',') );
while( !tmp.empty() ) {
citekeys.push_back( tmp );
keys = frontStrip( split(keys, tmp, ',') );
}
}
void FormCitation::updateBrowser( FL_OBJECT * browser, void FormCitation::updateBrowser( FL_OBJECT * browser,
vector<string> const & keys ) const vector<string> const & keys ) const
{ {
@ -253,60 +192,63 @@ void FormCitation::setCiteButtons( State status ) const
} }
void FormCitation::setSize( int brsrHeight, bool bibPresent ) const void FormCitation::setSize( int hbrsr, bool bibPresent ) const
{ {
int const infoHeight = 110; int const hinfo = dialog_->infoBrsr->h;
int const otherHeight = 140; int const hother = 140;
brsrHeight = max( brsrHeight, 175 ); hbrsr = max( hbrsr, 175 );
int formHeight = brsrHeight + otherHeight; int wform = dialog_->form_citation->w;
int hform = hbrsr + hother;
if( bibPresent ) formHeight += infoHeight + 30; if( bibPresent ) hform += hinfo + 30;
fl_set_form_size( dialog_->form_citation, 430, formHeight ); fl_set_form_size( dialog_->form_citation, wform, hform );
// No resizing is alowed in the y-direction // No resizing is alowed in the y-direction
fl_set_form_minsize( dialog_->form_citation, 430, formHeight ); fl_set_form_minsize( dialog_->form_citation, wform, hform );
fl_set_form_maxsize( dialog_->form_citation, 1000, formHeight ); fl_set_form_maxsize( dialog_->form_citation, 3*wform, hform );
int ypos = 0; int y = 0;
fl_set_object_geometry( dialog_->box, 0, ypos, 430, formHeight ); fl_set_object_geometry( dialog_->box, 0, y, wform, hform );
ypos += 30; y += 30;
fl_set_object_geometry( dialog_->citeBrsr, 10, ypos, 180, brsrHeight ); fl_set_object_geometry( dialog_->citeBrsr, 10, y, 180, hbrsr );
fl_set_object_geometry( dialog_->bibBrsr, 240, ypos, 180, brsrHeight ); fl_set_object_geometry( dialog_->bibBrsr, 240, y, 180, hbrsr );
fl_set_object_position( dialog_->addBtn, 200, ypos ); fl_set_object_position( dialog_->addBtn, 200, y );
ypos += 35; y += 5 + dialog_->addBtn->h;
fl_set_object_position( dialog_->delBtn, 200, ypos ); fl_set_object_position( dialog_->delBtn, 200, y );
ypos += 35; y += 5 + dialog_->delBtn->h;
fl_set_object_position( dialog_->upBtn, 200, ypos ); fl_set_object_position( dialog_->upBtn, 200, y );
ypos += 35; y += 5 + dialog_->upBtn->h;
fl_set_object_position( dialog_->downBtn, 200, ypos ); fl_set_object_position( dialog_->downBtn, 200, y );
ypos = brsrHeight+30; // base of Citation/Bibliography browsers y = dialog_->bibBrsr->y + dialog_->bibBrsr->h;
// awaiting natbib support // awaiting natbib support
fl_hide_object( dialog_->style ); fl_hide_object( dialog_->style );
if( bibPresent ) { if( bibPresent ) {
ypos += 30; y += 30;
fl_set_object_position( dialog_->infoBrsr, 10, ypos ); fl_set_object_position( dialog_->infoBrsr, 10, y );
fl_show_object( dialog_->infoBrsr ); fl_show_object( dialog_->infoBrsr );
ypos += infoHeight; y += hinfo;
} }
else else
fl_hide_object( dialog_->infoBrsr ); fl_hide_object( dialog_->infoBrsr );
ypos += 20; y += 20;
// awaiting natbib support // awaiting natbib support
fl_hide_object( dialog_->textBefore ); fl_hide_object( dialog_->textBefore );
fl_set_object_position( dialog_->textAftr, 100, ypos ); fl_set_object_position( dialog_->textAftr, 100, y );
fl_set_object_position( dialog_->ok, 230, ypos+50 ); fl_set_object_position( dialog_->ok, 230, y+50 );
fl_set_object_position( dialog_->cancel, 330, ypos+50 ); fl_set_object_position( dialog_->cancel, 330, y+50 );
} }
void FormCitation::input( State cb ) void FormCitation::input( long data )
{ {
State cb = static_cast<FormCitation::State>( data );
switch( cb ) { switch( cb ) {
case BIBBRSR: case BIBBRSR:
{ {
@ -459,81 +401,20 @@ void FormCitation::apply()
contents += citekeys[i]; contents += citekeys[i];
} }
textAfter = fl_get_input(dialog_->textAftr); params.setContents( contents );
params.setOptions( fl_get_input(dialog_->textAftr) );
if( inset_ != 0 ) if( inset_ != 0 )
{ {
inset_->setContents( contents ); // Only update if contents have changed
inset_->setOptions( textAfter ); if( params.getCmdName() != inset_->getCmdName() ||
lv_->view()->updateInset( inset_, true ); params.getContents() != inset_->getContents() ||
} else { params.getOptions() != inset_->getOptions() ) {
InsetCommandParams p( "cite", contents, textAfter ); inset_->setParams( params );
lv_->getLyXFunc()->Dispatch( LFUN_INSERT_CITATION, lv_->view()->updateInset( inset_, true );
p.getAsString().c_str() );
}
}
void FormCitation::hide()
{
if (dialog_
&& dialog_->form_citation
&& dialog_->form_citation->visible) {
fl_hide_form(dialog_->form_citation);
u_.disconnect();
h_.disconnect();
}
// free up the dialog for another inset
inset_ = 0;
ih_.disconnect();
dialogIsOpen = false;
}
void FormCitation::free()
{
// we don't need to delete u and h here because
// hide() does that after disconnecting.
if (dialog_) {
if (dialog_->form_citation
&& dialog_->form_citation->visible) {
hide();
} }
fl_free_form(dialog_->form_citation); } else {
delete dialog_; lv_->getLyXFunc()->Dispatch( LFUN_INSERT_CITATION,
dialog_ = 0; params.getAsString().c_str() );
} }
} }
int FormCitation::WMHideCB(FL_FORM * form, void *)
{
// Ensure that the signals (u and h) are disconnected even if the
// window manager is used to close the dialog.
FormCitation * pre = static_cast<FormCitation*>(form->u_vdata);
pre->hide();
return FL_CANCEL;
}
void FormCitation::OKCB(FL_OBJECT * ob, long)
{
FormCitation * pre = static_cast<FormCitation*>(ob->form->u_vdata);
pre->apply();
pre->hide();
}
void FormCitation::CancelCB(FL_OBJECT * ob, long)
{
FormCitation * pre = static_cast<FormCitation*>(ob->form->u_vdata);
pre->hide();
}
void FormCitation::InputCB(FL_OBJECT * ob, long data)
{
FormCitation * pre = static_cast<FormCitation*>(ob->form->u_vdata);
pre->input( static_cast<FormCitation::State>(data) );
}

View File

@ -12,25 +12,16 @@
#ifndef FORMCITATION_H #ifndef FORMCITATION_H
#define FORMCITATION_H #define FORMCITATION_H
#include <vector>
#include "DialogBase.h"
#include "LString.h"
#include "support/utility.hpp"
#ifdef __GNUG__ #ifdef __GNUG__
#pragma interface #pragma interface
#endif #endif
class Dialogs; #include "FormCommand.h"
// same arguement as in Dialogs.h s/LyX/UI/
class LyXView;
class InsetCitation;
struct FD_form_citation; struct FD_form_citation;
/** This class provides an XForms implementation of the FormCitation Dialog. /** This class provides an XForms implementation of the FormCitation Dialog.
*/ */
class FormCitation : public DialogBase, public noncopyable { class FormCitation : public FormCommand, public noncopyable {
public: public:
/// ///
enum State { enum State {
@ -51,39 +42,18 @@ public:
~FormCitation(); ~FormCitation();
//@} //@}
/**@name Real per-instance Callback Methods */
//@{
static int WMHideCB(FL_FORM *, void *);
static void OKCB(FL_OBJECT *, long);
static void CancelCB(FL_OBJECT *, long);
static void InputCB(FL_OBJECT *, long);
//@}
private: private:
/**@name Slot Methods */ /**@name Slot Methods */
//@{ //@{
/// Create the dialog if necessary, update it and display it. virtual void update();
void createInset( string const & );
///
void showInset( InsetCitation * );
///
void show();
/// Hide the dialog.
void hide();
///
void update();
//@}
/**@name Dialog internal methods */
//@{
/// Apply from dialog /// Apply from dialog
void apply(); virtual void apply();
/// Filter the inputs /// Filter the inputs
void input( State ); virtual void input( long );
/// Build the dialog /// Build the dialog
void build(); virtual void build();
/// ///
void updateCitekeys( string 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;
/// ///
@ -94,42 +64,10 @@ private:
void setSize( int, bool ) const; void setSize( int, bool ) const;
/// ///
FD_form_citation * build_citation(); FD_form_citation * build_citation();
/// Explicitly free the dialog.
void free();
//@} //@}
/**@name Private Data */
//@{
/// Real GUI implementation. /// Real GUI implementation.
FD_form_citation * dialog_; FD_form_citation * dialog_;
/** Which LyXFunc do we use?
We could modify Dialogs to have a visible LyXFunc* instead and
save a couple of bytes per dialog.
*/
LyXView * lv_;
/** Which Dialogs do we belong to?
Used so we can get at the signals we have to connect to.
*/
Dialogs * d_;
/// Update connection.
Connection u_;
/// Hide connection.
Connection h_;
/// inset::hide connection.
Connection ih_;
///
InsetCitation * inset_;
///
bool dialogIsOpen;
///
string textAfter;
///
std::vector<string> citekeys;
///
std::vector<string> bibkeys;
///
std::vector<string> bibkeysInfo;
//@}
}; };
#endif #endif

View File

@ -0,0 +1,151 @@
// -*- 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 "Dialogs.h"
#include "FormCommand.h"
#include "xform_macros.h"
C_RETURNCB(FormCommand, WMHideCB)
C_GENERICCB(FormCommand, ApplyCB)
C_GENERICCB(FormCommand, CancelCB)
C_GENERICCB(FormCommand, InputCB)
C_GENERICCB(FormCommand, OKCB)
FormCommand::FormCommand(LyXView * lv, Dialogs * d, string const & t)
: lv_(lv), d_(d), u_(0), h_(0), ih_(0),
inset_(0), dialogIsOpen(false), title(t)
{}
void FormCommand::showInset( InsetCommand * const inset )
{
if( dialogIsOpen || inset == 0 ) return;
inset_ = inset;
ih_ = inset_->hide.connect(slot(this, &FormCommand::hide));
params = inset->params();
show();
}
void FormCommand::createInset( string const & arg )
{
if( dialogIsOpen ) return;
params.setFromString( arg );
show();
}
void FormCommand::show()
{
if (!form()) {
build();
fl_set_form_atclose(form(),
C_FormCommandWMHideCB, 0);
}
fl_freeze_form( form() );
update(); // make sure its up-to-date
fl_unfreeze_form( form() );
dialogIsOpen = true;
if (form()->visible) {
fl_raise_form(form());
} else {
fl_show_form(form(),
FL_PLACE_MOUSE | FL_FREE_SIZE,
FL_TRANSIENT,
title.c_str());
u_ = d_->updateBufferDependent.
connect(slot(this, &FormCommand::update));
h_ = d_->hideBufferDependent.
connect(slot(this, &FormCommand::hide));
}
}
void FormCommand::free()
{
// we don't need to delete u and h here because
// hide() does that after disconnecting.
if( form() ) {
if( form()->visible)
hide();
fl_free_form(form());
}
}
void FormCommand::hide()
{
if (form() && form()->visible) {
fl_hide_form(form());
u_.disconnect();
h_.disconnect();
}
// free up the dialog for another inset
inset_ = 0;
ih_.disconnect();
dialogIsOpen = false;
}
int FormCommand::WMHideCB(FL_FORM * form, void *)
{
// Ensure that the signals (u and h) are disconnected even if the
// window manager is used to close the dialog.
FormCommand * pre = static_cast<FormCommand*>(form->u_vdata);
pre->hide();
return FL_CANCEL;
}
void FormCommand::ApplyCB(FL_OBJECT * ob, long)
{
FormCommand * pre = static_cast<FormCommand*>(ob->form->u_vdata);
pre->apply();
}
void FormCommand::CancelCB(FL_OBJECT * ob, long)
{
FormCommand * pre = static_cast<FormCommand*>(ob->form->u_vdata);
pre->hide();
}
void FormCommand::InputCB(FL_OBJECT * ob, long data )
{
FormCommand * pre = static_cast<FormCommand*>(ob->form->u_vdata);
pre->input( data );
}
void FormCommand::OKCB(FL_OBJECT * ob, long)
{
FormCommand * pre = static_cast<FormCommand*>(ob->form->u_vdata);
pre->apply();
pre->hide();
}

View File

@ -0,0 +1,97 @@
// -*- C++ -*-
/* This file is part of
* ======================================================
*
* LyX, The Document Processor
*
* Copyright 2000 The LyX Team.
*
* ======================================================
*/
#ifndef FORMCOMMAND_H
#define FORMCOMMAND_H
#include "DialogBase.h"
#include "LString.h"
#include "support/utility.hpp"
#include "insets/insetcommand.h"
class Dialogs;
class LyXView;
#ifdef __GNUG__
#pragma interface
#endif
/** This class is an XForms GUI base class to insets derived from
InsetCommand
*/
class FormCommand : public DialogBase, public noncopyable {
public:
/// Constructor
FormCommand(LyXView *, Dialogs *, string const & );
/**@name Real per-instance Callback Methods */
//@{
static int WMHideCB(FL_FORM *, void *);
static void OKCB(FL_OBJECT *, long);
static void ApplyCB(FL_OBJECT *, long);
static void CancelCB(FL_OBJECT *, long);
static void InputCB(FL_OBJECT *, long);
//@}
protected:
/**@name Slot Methods */
//@{
/// Create the dialog if necessary, update it and display it.
void createInset( string 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 */
//@{
/** Which LyXFunc do we use?
We could modify Dialogs to have a visible LyXFunc* instead and
save a couple of bytes per dialog.
*/
LyXView * lv_;
/** Which Dialogs do we belong to?
Used so we can get at the signals we have to connect to.
*/
Dialogs * d_;
/// Update connection.
Connection u_;
/// Hide connection.
Connection h_;
/// inset::hide connection.
Connection ih_;
///
InsetCommand * inset_;
///
bool dialogIsOpen;
///
InsetCommandParams params;
///
string title;
//@}
};
#endif

View File

@ -0,0 +1,161 @@
// -*- C++ -*-
/* This file is part of
* ======================================================
*
* LyX, The Document Processor
*
* Copyright 2000 The LyX Team.
*
* ======================================================
*/
#include <config.h>
#include <vector>
#include FORMS_H_LOCATION
#ifdef __GNUG__
#pragma implementation
#endif
#include "gettext.h"
#include "Dialogs.h"
#include "FormToc.h"
#include "LyXView.h"
#include "buffer.h"
#include "form_toc.h"
#include "lyxtext.h"
static vector<Buffer::TocItem> toclist;
FormToc::FormToc(LyXView * lv, Dialogs * d)
: FormCommand(lv, d, _("Table of Contents"))
{
// let the dialog be shown
// These are permanent connections so we won't bother
// storing a copy because we won't be disconnecting.
d->showTOC.connect(slot(this, &FormToc::showInset));
d->createTOC.connect(slot(this, &FormToc::createInset));
}
FormToc::~FormToc()
{
free();
delete dialog_;
}
void FormToc::build()
{
dialog_ = build_toc();
fl_addto_choice(dialog_->type,
_(" TOC | LOF | LOT | LOA "));
}
FL_FORM * const FormToc::form() const
{
if( dialog_ && dialog_->form_toc )
return dialog_->form_toc;
else
return 0;
}
void FormToc::update()
{
static int ow = -1, oh;
if (ow < 0) {
ow = form()->w;
oh = form()->h;
fl_set_form_minsize(form(), ow, oh);
fl_set_form_maxsize(form(), 2*ow, oh);
}
Buffer::TocType type;
if( params.getCmdName() == "tableofcontents" )
type = Buffer::TOC_TOC;
else if( params.getCmdName() == "listofalgorithms" )
type = Buffer::TOC_LOA;
else if( params.getCmdName() == "listoffigures" )
type = Buffer::TOC_LOF;
else
type = Buffer::TOC_LOT;
fl_set_choice( dialog_->type, type+1 );
updateToc();
}
void FormToc::updateToc()
{
if (!lv_->view()->available()) {
toclist.clear();
fl_clear_browser( dialog_->browser );
fl_add_browser_line( dialog_->browser, _("*** No Document ***"));
return;
}
vector<vector<Buffer::TocItem> > tmp =
lv_->view()->buffer()->getTocList();
int type = fl_get_choice( dialog_->type ) - 1;
// Check if all elements are the same.
if (toclist.size() == tmp[type].size()) {
unsigned int i = 0;
for (; i < toclist.size(); ++i) {
if (toclist[i] != tmp[type][i])
break;
}
if (i >= toclist.size()) return;
}
// List has changed. Update browser
toclist = tmp[type];
static Buffer * buffer = 0;
int topline = 0;
int line = 0;
if (buffer == lv_->view()->buffer()) {
topline = fl_get_browser_topline( dialog_->browser );
line = fl_get_browser( dialog_->browser );
} else
buffer = lv_->view()->buffer();
fl_clear_browser( dialog_->browser );
for (vector<Buffer::TocItem>::const_iterator it = toclist.begin();
it != toclist.end(); ++it)
fl_add_browser_line( dialog_->browser,
(string(4*(*it).depth,' ')+(*it).str).c_str());
fl_set_browser_topline( dialog_->browser, topline );
fl_select_browser_line( dialog_->browser, line );
}
void FormToc::apply()
{
if (!lv_->view()->available())
return;
updateToc();
unsigned int choice = fl_get_browser( dialog_->browser );
if (0 < choice && choice - 1 < toclist.size()) {
lv_->view()->beforeChange();
lv_->view()->text->SetCursor( lv_->view(), toclist[choice-1].par, 0 );
lv_->view()->text->sel_cursor =
lv_->view()->text->cursor;
lv_->view()->update(BufferView::SELECT|BufferView::FITCUR);
}
}

View File

@ -0,0 +1,56 @@
// -*- C++ -*-
/* This file is part of
* ======================================================
*
* LyX, The Document Processor
*
* Copyright 2000 The LyX Team.
*
* ======================================================
*/
#ifndef FORMTOC_H
#define FORMTOC_H
#ifdef __GNUG__
#pragma interface
#endif
#include "FormCommand.h"
struct FD_form_toc;
/** This class provides an XForms implementation of the FormToc Dialog.
*/
class FormToc : public FormCommand, public noncopyable {
public:
/**@name Constructors and Destructors */
//@{
///
FormToc(LyXView *, Dialogs *);
///
~FormToc();
private:
/**@name Slot Methods */
//@{
///
virtual void update();
/// Apply from dialog
virtual void apply();
///
virtual void input( long ) {};
/// Build the dialog
virtual void build();
///
virtual FL_FORM * const form() const;
///
void updateToc();
///
FD_form_toc * build_toc();
//@}
/// Real GUI implementation.
FD_form_toc * dialog_;
};
#endif

View File

@ -31,27 +31,21 @@
#include "insets/inseturl.h" #include "insets/inseturl.h"
#include "support/filetools.h" #include "support/filetools.h"
C_RETURNCB(FormUrl, WMHideCB)
C_GENERICCB(FormUrl, OKCB)
C_GENERICCB(FormUrl, CancelCB)
FormUrl::FormUrl(LyXView * lv, Dialogs * d) FormUrl::FormUrl(LyXView * lv, Dialogs * d)
: dialog_(0), lv_(lv), d_(d), u_(0), h_(0), ih_(0), : FormCommand(lv, d, _("Url"))
inset_(0), dialogIsOpen(false)
{ {
// let the dialog be shown // let the dialog be shown
// These are permanent connections so we won't bother // These are permanent connections so we won't bother
// storing a copy because we won't be disconnecting. // storing a copy because we won't be disconnecting.
d->showUrl.connect(slot(this, &FormUrl::showInset)); d->showUrl.connect(slot(this, &FormUrl::showInset));
d->createUrl.connect(slot(this, &FormUrl::createInset)); d->createUrl.connect(slot(this, &FormUrl::createInset));
params = new InsetCommandParams();
} }
FormUrl::~FormUrl() FormUrl::~FormUrl()
{ {
free(); free();
delete params; delete dialog_;
} }
@ -61,72 +55,52 @@ void FormUrl::build()
} }
void FormUrl::showInset( InsetUrl * inset ) FL_FORM * const FormUrl::form() const
{ {
if( dialogIsOpen || inset == 0 ) return; if( dialog_ && dialog_->form_url )
return dialog_->form_url;
inset_ = inset; else
ih_ = inset_->hide.connect(slot(this, &FormUrl::hide)); return 0;
(*params) = inset->params();
show();
}
void FormUrl::createInset( string const & arg )
{
if( dialogIsOpen ) return;
params->setFromString( arg );
show();
}
void FormUrl::show()
{
if (!dialog_) {
build();
fl_set_form_atclose(dialog_->form_url,
C_FormUrlWMHideCB, 0);
}
update(); // make sure its up-to-date
dialogIsOpen = true;
if (dialog_->form_url->visible) {
fl_raise_form(dialog_->form_url);
} else {
fl_show_form(dialog_->form_url,
FL_PLACE_MOUSE | FL_FREE_SIZE,
FL_TRANSIENT,
_("Url"));
u_ = d_->updateBufferDependent.
connect(slot(this, &FormUrl::update));
h_ = d_->hideBufferDependent.
connect(slot(this, &FormUrl::hide));
}
} }
void FormUrl::update() void FormUrl::update()
{ {
fl_set_input(dialog_->url, params->getContents().c_str());
fl_set_input(dialog_->name, params->getOptions().c_str());
if ( params->getCmdName() == "url" )
fl_set_button(dialog_->radio_html, 0);
else
fl_set_button(dialog_->radio_html, 1);
static int ow = -1, oh; static int ow = -1, oh;
if (ow < 0) { if (ow < 0) {
ow = dialog_->form_url->w; ow = dialog_->form_url->w;
oh = dialog_->form_url->h; oh = dialog_->form_url->h;
fl_set_form_minsize(dialog_->form_url, ow, oh);
fl_set_form_maxsize(dialog_->form_url, 2*ow, oh);
} }
fl_set_form_minsize(dialog_->form_url, ow, oh); fl_freeze_form( dialog_->form_url );
fl_set_form_maxsize(dialog_->form_url, 2*ow, oh);
fl_set_input(dialog_->url, params.getContents().c_str());
fl_set_input(dialog_->name, params.getOptions().c_str());
if ( params.getCmdName() == "url" )
fl_set_button(dialog_->radio_html, 0);
else
fl_set_button(dialog_->radio_html, 1);
if( lv_->buffer()->isReadonly() ) {
fl_deactivate_object( dialog_->url );
fl_deactivate_object( dialog_->name );
fl_deactivate_object( dialog_->radio_html );
fl_deactivate_object( dialog_->ok );
fl_set_object_lcol( dialog_->ok, FL_INACTIVE );
} else {
fl_activate_object( dialog_->url );
fl_activate_object( dialog_->name );
fl_activate_object( dialog_->radio_html );
fl_activate_object( dialog_->ok );
fl_set_object_lcol( dialog_->ok, FL_BLACK );
}
fl_unfreeze_form( dialog_->form_url );
} }
@ -134,78 +108,25 @@ void FormUrl::apply()
{ {
if( lv_->buffer()->isReadonly() ) return; if( lv_->buffer()->isReadonly() ) return;
params->setContents( fl_get_input(dialog_->url) ); params.setContents( fl_get_input(dialog_->url) );
params->setOptions( fl_get_input(dialog_->name) ); params.setOptions( fl_get_input(dialog_->name) );
if (fl_get_button(dialog_->radio_html)) if (fl_get_button(dialog_->radio_html))
params->setCmdName("htmlurl"); params.setCmdName("htmlurl");
else else
params->setCmdName("url"); params.setCmdName("url");
if( inset_ != 0 ) if( inset_ != 0 )
{ {
inset_->setParams( *params ); // Only update if contents have changed
lv_->view()->updateInset( inset_, true ); if( params.getCmdName() != inset_->getCmdName() ||
params.getContents() != inset_->getContents() ||
params.getOptions() != inset_->getOptions() ) {
inset_->setParams( params );
lv_->view()->updateInset( inset_, true );
}
} else { } else {
lv_->getLyXFunc()->Dispatch( LFUN_INSERT_URL, lv_->getLyXFunc()->Dispatch( LFUN_INSERT_URL,
params->getAsString().c_str() ); params.getAsString().c_str() );
} }
} }
void FormUrl::hide()
{
if (dialog_
&& dialog_->form_url
&& dialog_->form_url->visible) {
fl_hide_form(dialog_->form_url);
u_.disconnect();
h_.disconnect();
}
// free up the dialog for another inset
inset_ = 0;
ih_.disconnect();
dialogIsOpen = false;
}
void FormUrl::free()
{
// we don't need to delete u and h here because
// hide() does that after disconnecting.
if (dialog_) {
if (dialog_->form_url
&& dialog_->form_url->visible) {
hide();
}
fl_free_form(dialog_->form_url);
delete dialog_;
dialog_ = 0;
}
}
int FormUrl::WMHideCB(FL_FORM * form, void *)
{
// Ensure that the signals (u and h) are disconnected even if the
// window manager is used to close the dialog.
FormUrl * pre = static_cast<FormUrl*>(form->u_vdata);
pre->hide();
return FL_CANCEL;
}
void FormUrl::OKCB(FL_OBJECT * ob, long)
{
FormUrl * pre = static_cast<FormUrl*>(ob->form->u_vdata);
pre->apply();
pre->hide();
}
void FormUrl::CancelCB(FL_OBJECT * ob, long)
{
FormUrl * pre = static_cast<FormUrl*>(ob->form->u_vdata);
pre->hide();
}

View File

@ -12,24 +12,16 @@
#ifndef FORMURL_H #ifndef FORMURL_H
#define FORMURL_H #define FORMURL_H
#include "DialogBase.h"
#include "LString.h"
#include "support/utility.hpp"
class Dialogs;
class LyXView;
class InsetCommandParams;
class InsetUrl;
struct FD_form_url;
#ifdef __GNUG__ #ifdef __GNUG__
#pragma interface #pragma interface
#endif #endif
#include "FormCommand.h"
struct FD_form_url;
/** This class provides an XForms implementation of the FormUrl Dialog. /** This class provides an XForms implementation of the FormUrl Dialog.
*/ */
class FormUrl : public DialogBase, public noncopyable { class FormUrl : public FormCommand, public noncopyable {
public: public:
/**@name Constructors and Destructors */ /**@name Constructors and Destructors */
//@{ //@{
@ -39,66 +31,25 @@ public:
~FormUrl(); ~FormUrl();
//@} //@}
/**@name Real per-instance Callback Methods */
//@{
static int WMHideCB(FL_FORM *, void *);
static void OKCB(FL_OBJECT *, long);
static void CancelCB(FL_OBJECT *, long);
//@}
private: private:
/**@name Slot Methods */ /**@name Slot Methods */
//@{ //@{
/// Create the dialog if necessary, update it and display it.
void createInset( string const & );
///
void showInset( InsetUrl * );
///
void show();
/// Hide the dialog.
void hide();
/// ///
void update(); virtual void update();
//@}
/**@name Dialog internal methods */
//@{
/// Apply from dialog /// Apply from dialog
void apply(); void apply();
///
virtual void input( long ) {};
/// Build the dialog /// Build the dialog
void build(); void build();
/// ///
virtual FL_FORM * const form() const;
///
FD_form_url * build_url(); FD_form_url * build_url();
/// Explicitly free the dialog.
void free();
//@} //@}
/**@name Private Data */
//@{
/// Real GUI implementation. /// Real GUI implementation.
FD_form_url * dialog_; FD_form_url * dialog_;
/** Which LyXFunc do we use?
We could modify Dialogs to have a visible LyXFunc* instead and
save a couple of bytes per dialog.
*/
LyXView * lv_;
/** Which Dialogs do we belong to?
Used so we can get at the signals we have to connect to.
*/
Dialogs * d_;
/// Update connection.
Connection u_;
/// Hide connection.
Connection h_;
/// inset::hide connection.
Connection ih_;
///
InsetUrl * inset_;
///
bool dialogIsOpen;
///
InsetCommandParams * params;
//@}
}; };
#endif #endif

View File

@ -8,14 +8,14 @@ Unit of measure: FL_COORD_PIXEL
=============== FORM =============== =============== FORM ===============
Name: form_citation Name: form_citation
Width: 450 Width: 430
Height: 780 Height: 770
Number of Objects: 13 Number of Objects: 13
-------------------- --------------------
class: FL_BOX class: FL_BOX
type: UP_BOX type: UP_BOX
box: 0 0 430 780 box: 0 0 430 770
boxtype: FL_UP_BOX boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1 colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER alignment: FL_ALIGN_CENTER
@ -45,7 +45,7 @@ shortcut:
resize: FL_RESIZE_X resize: FL_RESIZE_X
gravity: FL_NoGravity FL_NoGravity gravity: FL_NoGravity FL_NoGravity
name: citeBrsr name: citeBrsr
callback: C_FormCitationInputCB callback: C_FormCommandInputCB
argument: CITEBRSR argument: CITEBRSR
-------------------- --------------------
@ -63,7 +63,7 @@ shortcut:
resize: FL_RESIZE_X resize: FL_RESIZE_X
gravity: FL_NoGravity FL_NoGravity gravity: FL_NoGravity FL_NoGravity
name: bibBrsr name: bibBrsr
callback: C_FormCitationInputCB callback: C_FormCommandInputCB
argument: BIBBRSR argument: BIBBRSR
-------------------- --------------------
@ -81,7 +81,7 @@ shortcut:
resize: FL_RESIZE_NONE resize: FL_RESIZE_NONE
gravity: FL_NoGravity FL_NoGravity gravity: FL_NoGravity FL_NoGravity
name: addBtn name: addBtn
callback: C_FormCitationInputCB callback: C_FormCommandInputCB
argument: ADD argument: ADD
-------------------- --------------------
@ -99,7 +99,7 @@ shortcut:
resize: FL_RESIZE_NONE resize: FL_RESIZE_NONE
gravity: FL_NoGravity FL_NoGravity gravity: FL_NoGravity FL_NoGravity
name: delBtn name: delBtn
callback: C_FormCitationInputCB callback: C_FormCommandInputCB
argument: DELETE argument: DELETE
-------------------- --------------------
@ -117,7 +117,7 @@ shortcut:
resize: FL_RESIZE_NONE resize: FL_RESIZE_NONE
gravity: FL_NoGravity FL_NoGravity gravity: FL_NoGravity FL_NoGravity
name: upBtn name: upBtn
callback: C_FormCitationInputCB callback: C_FormCommandInputCB
argument: UP argument: UP
-------------------- --------------------
@ -135,13 +135,13 @@ shortcut:
resize: FL_RESIZE_NONE resize: FL_RESIZE_NONE
gravity: FL_NoGravity FL_NoGravity gravity: FL_NoGravity FL_NoGravity
name: downBtn name: downBtn
callback: C_FormCitationInputCB callback: C_FormCommandInputCB
argument: DOWN argument: DOWN
-------------------- --------------------
class: FL_BROWSER class: FL_BROWSER
type: NORMAL_BROWSER type: NORMAL_BROWSER
box: 10 440 430 110 box: 10 440 410 110
boxtype: FL_DOWN_BOX boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_YELLOW colors: FL_COL1 FL_YELLOW
alignment: FL_ALIGN_TOP_LEFT alignment: FL_ALIGN_TOP_LEFT
@ -225,7 +225,7 @@ shortcut: ^M
resize: FL_RESIZE_ALL resize: FL_RESIZE_ALL
gravity: FL_SouthEast FL_SouthEast gravity: FL_SouthEast FL_SouthEast
name: ok name: ok
callback: C_FormCitationOKCB callback: C_FormCommandOKCB
argument: 0 argument: 0
-------------------- --------------------
@ -243,7 +243,7 @@ shortcut: ^[
resize: FL_RESIZE_ALL resize: FL_RESIZE_ALL
gravity: FL_SouthEast FL_SouthEast gravity: FL_SouthEast FL_SouthEast
name: cancel name: cancel
callback: C_FormCitationCancelCB callback: C_FormCommandCancelCB
argument: 0 argument: 0
============================== ==============================

View File

@ -0,0 +1,106 @@
Magic: 13000
Internal Form Definition File
(do not change)
Number of forms: 1
Unit of measure: FL_COORD_PIXEL
=============== FORM ===============
Name: form_toc
Width: 420
Height: 340
Number of Objects: 5
--------------------
class: FL_BOX
type: UP_BOX
box: 0 0 420 340
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_BROWSER
type: HOLD_BROWSER
box: 10 10 400 280
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_YELLOW
alignment: FL_ALIGN_BOTTOM
style: FL_NORMAL_STYLE
size: FL_DEFAULT_SIZE
lcol: FL_BLACK
label:
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NorthWest FL_SouthEast
name: browser
callback: C_FormCommandApplyCB
argument: 0
--------------------
class: FL_BUTTON
type: RETURN_BUTTON
box: 310 300 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: Close
shortcut: ^M
resize: FL_RESIZE_NONE
gravity: FL_SouthEast FL_SouthEast
name:
callback: C_FormCommandCancelCB
argument: 0
--------------------
class: FL_BUTTON
type: NORMAL_BUTTON
box: 200 300 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: Update
shortcut: Update|#U#u
resize: FL_RESIZE_NONE
gravity: FL_SouthEast FL_SouthEast
name:
callback: C_FormCommandApplyCB
argument: 0
--------------------
class: FL_CHOICE
type: NORMAL_CHOICE
box: 60 300 130 30
boxtype: FL_FRAME_BOX
colors: FL_COL1 FL_BLACK
alignment: FL_ALIGN_LEFT
style: FL_NORMAL_STYLE
size: FL_DEFAULT_SIZE
lcol: FL_BLACK
label: Type
shortcut: Type|#T#t
resize: FL_RESIZE_NONE
gravity: FL_SouthEast FL_SouthEast
name: type
callback: C_FormCommandApplyCB
argument: 0
==============================
create_the_forms

View File

@ -99,7 +99,7 @@ shortcut: ^[
resize: FL_RESIZE_NONE resize: FL_RESIZE_NONE
gravity: FL_SouthEast FL_SouthEast gravity: FL_SouthEast FL_SouthEast
name: cancel name: cancel
callback: C_FormUrlCancelCB callback: C_FormCommandCancelCB
argument: 0 argument: 0
-------------------- --------------------
@ -117,7 +117,7 @@ shortcut: ^M
resize: FL_RESIZE_ALL resize: FL_RESIZE_ALL
gravity: FL_SouthEast FL_SouthEast gravity: FL_SouthEast FL_SouthEast
name: ok name: ok
callback: C_FormUrlOKCB callback: C_FormCommandOKCB
argument: 0 argument: 0
============================== ==============================

View File

@ -25,6 +25,7 @@ SRCS := form_citation.fd \
form_print.fd \ form_print.fd \
form_graphics.fd \ form_graphics.fd \
form_tabular.fd \ form_tabular.fd \
form_toc.fd \
form_url.fd form_url.fd

View File

@ -55,12 +55,6 @@ libinsets_la_SOURCES = \
insetlatexaccent.h \ insetlatexaccent.h \
insetlist.C \ insetlist.C \
insetlist.h \ insetlist.h \
insetloa.C \
insetloa.h \
insetlof.C \
insetlof.h \
insetlot.C \
insetlot.h \
insetmarginal.h \ insetmarginal.h \
insetmarginal.C \ insetmarginal.C \
insetminipage.C \ insetminipage.C \

View File

@ -15,8 +15,8 @@
#endif #endif
#include "insetcite.h" #include "insetcite.h"
#include "LyXView.h"
#include "BufferView.h" #include "BufferView.h"
#include "LyXView.h"
#include "frontends/Dialogs.h" #include "frontends/Dialogs.h"
#include "support/lstrings.h" #include "support/lstrings.h"
@ -24,11 +24,6 @@ InsetCitation::InsetCitation(InsetCommandParams const & p)
: InsetCommand(p) : InsetCommand(p)
{} {}
InsetCitation::~InsetCitation()
{
hide();
}
string InsetCitation::getScreenLabel() const string InsetCitation::getScreenLabel() const
{ {
string keys(getContents()); string keys(getContents());

View File

@ -16,11 +16,6 @@
#endif #endif
#include "insetcommand.h" #include "insetcommand.h"
#include <sigc++/signal_system.h>
#ifdef SIGC_CXX_NAMESPACES
using SigC::Signal0;
#endif
/** Used to insert citations /** Used to insert citations
*/ */
@ -30,8 +25,6 @@ public:
explicit explicit
InsetCitation(InsetCommandParams const &); InsetCitation(InsetCommandParams const &);
/// ///
~InsetCitation();
///
Inset * Clone() const { return new InsetCitation(params()); } Inset * Clone() const { return new InsetCitation(params()); }
/// ///
string getScreenLabel() const; string getScreenLabel() const;
@ -39,8 +32,6 @@ public:
EDITABLE Editable() const { return IS_EDITABLE; } EDITABLE Editable() const { return IS_EDITABLE; }
/// ///
void Edit(BufferView *, int, int, unsigned int); void Edit(BufferView *, int, int, unsigned int);
///
Signal0<void> hide;
}; };
#endif // INSET_CITE_H #endif // INSET_CITE_H

View File

@ -17,6 +17,11 @@
#endif #endif
#include "insetbutton.h" #include "insetbutton.h"
#include <sigc++/signal_system.h>
#ifdef SIGC_CXX_NAMESPACES
using SigC::Signal0;
#endif
// Created by Alejandro 970222 // Created by Alejandro 970222
/** Used to insert a LaTeX command automatically /** Used to insert a LaTeX command automatically
@ -73,6 +78,8 @@ public:
explicit explicit
InsetCommand(InsetCommandParams const &); InsetCommand(InsetCommandParams const &);
/// ///
virtual ~InsetCommand() { hide(); };
///
void Write(Buffer const *, std::ostream &) const; void Write(Buffer const *, std::ostream &) const;
/// Parse the command. /// Parse the command.
@ -121,6 +128,8 @@ public:
InsetCommandParams const & params() const { return p_; } InsetCommandParams const & params() const { return p_; }
/// ///
void setParams(InsetCommandParams const &); void setParams(InsetCommandParams const &);
///
Signal0<void> hide;
private: private:
/// ///
InsetCommandParams p_; InsetCommandParams p_;

View File

@ -1,42 +0,0 @@
// -*- C++ -*-
/* This file is part of*
* ======================================================
*
* LyX, The Document Processor
*
* Copyright 1995 Matthias Ettrich
* Copyright 1996-2000 The LyX Team.
*
* ====================================================== */
// Created by Bernhard 970908
#include <config.h>
#ifdef __GNUG__
#pragma implementation
#endif
#include "gettext.h"
#include "insetloa.h"
#include "LaTeXFeatures.h"
#include "BufferView.h"
#include "LyXView.h"
#include "lyxfunc.h"
#include "commandtags.h"
void InsetLOA::Validate(LaTeXFeatures & features) const
{
features.algorithm = true;
}
string InsetLOA::getScreenLabel() const
{
return _("List of Algorithms");
}
void InsetLOA::Edit(BufferView * bv, int, int, unsigned int)
{
bv->owner()->getLyXFunc()->Dispatch(LFUN_LOAVIEW);
}

View File

@ -1,53 +0,0 @@
// -*- C++ -*-
/* This file is part of*
* ======================================================
*
* LyX, The Document Processor
*
* Copyright 1995 Matthias Ettrich
* Copyright 1996-2000 the LyX Team.
*
* ====================================================== */
#ifndef INSET_LOA_H
#define INSET_LOA_H
#ifdef __GNUG__
#pragma interface
#endif
#include "insetcommand.h"
class Buffer;
/** Used to insert table of algorithms
*/
class InsetLOA : public InsetCommand {
public:
///
InsetLOA() : InsetCommand("listofalgorithms") {}
///
explicit
InsetLOA(Buffer * b) : InsetCommand("listofalgorithms"), owner(b) {}
///
void Validate(LaTeXFeatures & features) const;
///
Inset * Clone() const { return new InsetLOA(owner); }
///
string getScreenLabel() const;
///
void Edit(BufferView * bv, int, int, unsigned int);
///
EDITABLE Editable() const {
return IS_EDITABLE; // not yet
}
///
bool display() const { return true; }
///
Inset::Code LyxCode() const { return Inset::LOA_CODE; }
private:
///
Buffer * owner;
};
#endif

View File

@ -1,22 +0,0 @@
#include <config.h>
#ifdef __GNUG__
#pragma implementation
#endif
#include "gettext.h"
#include "insetlof.h"
#include "BufferView.h"
#include "LyXView.h"
#include "lyxfunc.h"
#include "commandtags.h"
string InsetLOF::getScreenLabel() const
{
return _("List of Figures");
}
void InsetLOF::Edit(BufferView * bv, int, int, unsigned int)
{
bv->owner()->getLyXFunc()->Dispatch(LFUN_LOFVIEW);
}

View File

@ -1,52 +0,0 @@
// -*- C++ -*-
/* This file is part of*
* ======================================================
*
* LyX, The Document Processor
*
* Copyright 1995 Matthias Ettrich
* Copyright 1996-2000 the LyX Team.
*
* ====================================================== */
#ifndef INSET_LOF_H
#define INSET_LOF_H
#include "insetcommand.h"
// Created by Lgb 970527
#ifdef __GNUG__
#pragma interface
#endif
class Buffer;
/** Used to insert table of contents
*/
class InsetLOF : public InsetCommand {
public:
///
InsetLOF() : InsetCommand("listoffigures") {}
///
explicit
InsetLOF(Buffer * b) : InsetCommand("listoffigures"), owner(b) {}
///
Inset * Clone() const { return new InsetLOF(owner); }
///
string getScreenLabel() const;
///
void Edit(BufferView * bv, int, int, unsigned int);
///
EDITABLE Editable() const {
return IS_EDITABLE; // Finally!
}
///
bool display() const { return true; }
///
Inset::Code LyxCode() const { return Inset::LOF_CODE; }
private:
///
Buffer * owner;
};
#endif

View File

@ -1,23 +0,0 @@
#include <config.h>
#ifdef __GNUG__
#pragma implementation
#endif
#include "gettext.h"
#include "insetlot.h"
#include "BufferView.h"
#include "LyXView.h"
#include "lyxfunc.h"
#include "commandtags.h"
string InsetLOT::getScreenLabel() const
{
return _("List of Tables");
}
void InsetLOT::Edit(BufferView * bv, int, int, unsigned int)
{
bv->owner()->getLyXFunc()->Dispatch(LFUN_LOTVIEW);
}

View File

@ -1,53 +0,0 @@
// -*- C++ -*-
/* This file is part of*
* ======================================================
*
* LyX, The Document Processor
*
* Copyright 1995 Matthias Ettrich
* Copyright 1996-2000 LyX Team
*
* ====================================================== */
#ifndef INSET_LOT_H
#define INSET_LOT_H
#ifdef __GNUG__
#pragma interface
#endif
#include "insetcommand.h"
// Created by Lgb 970527
class Buffer;
/** Used to insert table of contents
*/
class InsetLOT : public InsetCommand {
public:
///
InsetLOT() : InsetCommand("listoftables") {}
///
explicit
InsetLOT(Buffer * b) : InsetCommand("listoftables"), owner(b) {}
///
Inset * Clone() const { return new InsetLOT(owner); }
///
string getScreenLabel() const;
///
void Edit(BufferView * bv, int, int, unsigned int);
///
EDITABLE Editable() const {
return IS_EDITABLE; // not yet
}
///
bool display() const { return true; }
///
Inset::Code LyxCode() const { return Inset::LOT_CODE; }
private:
///
Buffer * owner;
};
#endif

View File

@ -6,35 +6,59 @@
#include "gettext.h" #include "gettext.h"
#include "insettoc.h" #include "insettoc.h"
#include "commandtags.h"
#include "debug.h"
#include "lyxfunc.h"
#include "LyXView.h"
#include "BufferView.h" #include "BufferView.h"
#include "LyXView.h"
#include "frontends/Dialogs.h"
#include "debug.h"
using std::ostream; using std::ostream;
string InsetTOC::getScreenLabel() const string InsetTOC::getScreenLabel() const
{ {
return _("Table of Contents"); string cmdname( getCmdName() );
if( cmdname == "tableofcontents" )
return _("Table of Contents");
else if( cmdname == "listofalgorithms" )
return _("List of Algorithms");
else if( cmdname == "listoffigures" )
return _("List of Figures");
else
return _("List of Tables");
}
Inset::Code InsetTOC::LyxCode() const
{
string cmdname( getCmdName() );
if( cmdname == "tableofcontents" )
return Inset::TOC_CODE;
else if( cmdname == "listofalgorithms" )
return Inset::LOA_CODE;
else if( cmdname == "listoffigures" )
return Inset::LOF_CODE;
else
return Inset::LOT_CODE;
} }
void InsetTOC::Edit(BufferView * bv, int, int, unsigned int) void InsetTOC::Edit(BufferView * bv, int, int, unsigned int)
{ {
bv->owner()->getLyXFunc()->Dispatch(LFUN_TOCVIEW); bv->owner()->getDialogs()->showTOC( this );
} }
int InsetTOC::Linuxdoc(Buffer const *, ostream & os) const int InsetTOC::Linuxdoc(Buffer const *, ostream & os) const
{ {
os << "<toc>"; if( getCmdName() == "tableofcontents" )
os << "<toc>";
return 0; return 0;
} }
int InsetTOC::DocBook(Buffer const *, ostream & os) const int InsetTOC::DocBook(Buffer const *, ostream & os) const
{ {
os << "<toc></toc>"; if( getCmdName() == "tableofcontents" )
os << "<toc></toc>";
return 0; return 0;
} }

View File

@ -18,38 +18,28 @@
#include "insetcommand.h" #include "insetcommand.h"
class Buffer;
/** Used to insert table of contents /** Used to insert table of contents
*/ */
class InsetTOC : public InsetCommand { class InsetTOC : public InsetCommand {
public: public:
/// ///
InsetTOC() : InsetCommand("tableofcontents") {} InsetTOC(InsetCommandParams const & p) : InsetCommand(p) {}
/// ///
explicit Inset * Clone() const { return new InsetTOC(params()); }
InsetTOC(Buffer * b) : InsetCommand("tableofcontents"), owner(b) {}
///
Inset * Clone() const { return new InsetTOC(owner); }
/// ///
string getScreenLabel() const; string getScreenLabel() const;
/// On edit, we open the TOC pop-up ///
void Edit(BufferView * bv, int, int, unsigned int); void Edit(BufferView * bv, int, int, unsigned int);
/// ///
EDITABLE Editable() const { EDITABLE Editable() const { return IS_EDITABLE; }
return IS_EDITABLE;
}
/// ///
bool display() const { return true; } bool display() const { return true; }
/// ///
Inset::Code LyxCode() const { return Inset::TOC_CODE; } Inset::Code LyxCode() const;
/// ///
int Linuxdoc(Buffer const *, std::ostream &) const; int Linuxdoc(Buffer const *, std::ostream &) const;
/// ///
int DocBook(Buffer const *, std::ostream &) const; int DocBook(Buffer const *, std::ostream &) const;
private:
///
Buffer * owner;
}; };
#endif #endif

View File

@ -19,18 +19,6 @@ InsetUrl::InsetUrl(InsetCommandParams const & p)
{} {}
InsetUrl::~InsetUrl()
{
hide();
}
char const * InsetUrl::EditMessage() const
{
return _("Opened Url");
}
void InsetUrl::Edit(BufferView * bv, int, int, unsigned int) void InsetUrl::Edit(BufferView * bv, int, int, unsigned int)
{ {
bv->owner()->getDialogs()->showUrl( this ); bv->owner()->getDialogs()->showUrl( this );

View File

@ -16,14 +16,9 @@
#endif #endif
#include "insetcommand.h" #include "insetcommand.h"
#include <sigc++/signal_system.h>
struct LaTeXFeatures; struct LaTeXFeatures;
#ifdef SIGC_CXX_NAMESPACES
using SigC::Signal0;
#endif
/** The url inset /** The url inset
*/ */
class InsetUrl : public InsetCommand { class InsetUrl : public InsetCommand {
@ -31,8 +26,6 @@ public:
/// ///
explicit explicit
InsetUrl(InsetCommandParams const &); InsetUrl(InsetCommandParams const &);
///
~InsetUrl();
/// ///
Inset * Clone() const { return new InsetUrl(params()); } Inset * Clone() const { return new InsetUrl(params()); }
/// ///
@ -44,8 +37,6 @@ public:
/// ///
EDITABLE Editable() const { return IS_EDITABLE; } EDITABLE Editable() const { return IS_EDITABLE; }
/// ///
char const * EditMessage() const;
///
void Edit(BufferView *, int, int, unsigned int); void Edit(BufferView *, int, int, unsigned int);
/// ///
bool display() const { return false; } bool display() const { return false; }
@ -58,8 +49,6 @@ public:
int Linuxdoc(Buffer const *, std::ostream &) const; int Linuxdoc(Buffer const *, std::ostream &) const;
/// ///
int DocBook(Buffer const *, std::ostream &) const; int DocBook(Buffer const *, std::ostream &) const;
///
Signal0<void> hide;
}; };
#endif #endif

View File

@ -112,36 +112,6 @@ FD_form_screen *create_form_form_screen(void)
} }
/*---------------------------------------*/ /*---------------------------------------*/
FD_form_toc *create_form_form_toc(void)
{
FL_OBJECT *obj;
FD_form_toc *fdui = (FD_form_toc *) fl_calloc(1, sizeof(FD_form_toc));
fdui->form_toc = fl_bgn_form(FL_NO_BOX, 420, 340);
obj = fl_add_box(FL_UP_BOX, 0, 0, 420, 340, "");
fdui->browser_toc = obj = fl_add_browser(FL_HOLD_BROWSER, 10, 10, 400, 280, "");
fl_set_object_gravity(obj, FL_NorthWest, FL_SouthEast);
fl_set_object_callback(obj, TocSelectCB, 0);
obj = fl_add_button(FL_RETURN_BUTTON, 310, 300, 100, 30, _("Close"));
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast);
fl_set_object_callback(obj, TocCancelCB, 0);
obj = fl_add_button(FL_NORMAL_BUTTON, 200, 300, 100, 30, idex(_("Update|Uu#u")));fl_set_button_shortcut(obj, scex(_("Update|Uu#u")), 1);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast);
fl_set_object_callback(obj, TocUpdateCB, 0);
fdui->toctype = obj = fl_add_choice(FL_NORMAL_CHOICE, 60, 300, 130, 30, idex(_("Type|Tt#t")));fl_set_button_shortcut(obj, scex(_("Type|Tt#t")), 1);
fl_set_object_boxtype(obj, FL_FRAME_BOX);
fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast);
fl_set_object_callback(obj, TocUpdateCB, 0);
fl_end_form();
//fdui->form_toc->fdui = fdui;
return fdui;
}
/*---------------------------------------*/
FD_form_ref *create_form_form_ref(void) FD_form_ref *create_form_form_ref(void)
{ {
FL_OBJECT *obj; FL_OBJECT *obj;

View File

@ -1,4 +1,4 @@
/** Header file generated with fdesign on Mon Jun 19 12:55:08 2000.**/ /** Header file generated with fdesign on Mon Jul 31 11:17:12 2000.**/
#ifndef FD_form_title_h_ #ifndef FD_form_title_h_
#define FD_form_title_h_ #define FD_form_title_h_
@ -14,10 +14,6 @@ extern "C" void ScreenOKCB(FL_OBJECT *, long);
extern "C" void ScreenApplyCB(FL_OBJECT *, long); extern "C" void ScreenApplyCB(FL_OBJECT *, long);
extern "C" void ScreenCancelCB(FL_OBJECT *, long); extern "C" void ScreenCancelCB(FL_OBJECT *, long);
extern "C" void TocSelectCB(FL_OBJECT *, long);
extern "C" void TocCancelCB(FL_OBJECT *, long);
extern "C" void TocUpdateCB(FL_OBJECT *, long);
extern "C" void RefUpdateCB(FL_OBJECT *, long); extern "C" void RefUpdateCB(FL_OBJECT *, long);
extern "C" void RefHideCB(FL_OBJECT *, long); extern "C" void RefHideCB(FL_OBJECT *, long);
extern "C" void RefSelectCB(FL_OBJECT *, long); extern "C" void RefSelectCB(FL_OBJECT *, long);
@ -65,16 +61,6 @@ typedef struct {
} FD_form_screen; } FD_form_screen;
extern FD_form_screen * create_form_form_screen(void); extern FD_form_screen * create_form_form_screen(void);
typedef struct {
FL_FORM *form_toc;
void *vdata;
char *cdata;
long ldata;
FL_OBJECT *browser_toc;
FL_OBJECT *toctype;
} FD_form_toc;
extern FD_form_toc * create_form_form_toc(void);
typedef struct { typedef struct {
FL_FORM *form_ref; FL_FORM *form_ref;
void *vdata; void *vdata;

View File

@ -71,7 +71,6 @@ extern FD_form_preamble * fd_form_preamble;
extern FD_form_table * fd_form_table; extern FD_form_table * fd_form_table;
extern FD_form_figure * fd_form_figure; extern FD_form_figure * fd_form_figure;
extern FD_form_screen * fd_form_screen; extern FD_form_screen * fd_form_screen;
extern FD_form_toc * fd_form_toc;
extern FD_form_ref * fd_form_ref; extern FD_form_ref * fd_form_ref;
extern FD_form_bullet * fd_form_bullet; extern FD_form_bullet * fd_form_bullet;
@ -1134,26 +1133,6 @@ void InsertAsciiFile(BufferView * bv, string const & f, bool asParagraph)
} }
void MenuShowTableOfContents()
{
static int ow = -1, oh;
TocUpdateCB(0, 0);
if (fd_form_toc->form_toc->visible) {
fl_raise_form(fd_form_toc->form_toc);
} else {
fl_show_form(fd_form_toc->form_toc,
FL_PLACE_MOUSE | FL_FREE_SIZE, FL_FULLBORDER,
_("Table Of Contents"));
if (ow < 0) {
ow = fd_form_toc->form_toc->w;
oh = fd_form_toc->form_toc->h;
}
fl_set_form_minsize(fd_form_toc->form_toc, ow, oh);
}
}
void MenuInsertLabel(char const * arg) void MenuInsertLabel(char const * arg)
{ {
string label = arg; string label = arg;
@ -2919,92 +2898,6 @@ void Reconfigure(BufferView * bv)
} }
//
// Table of Contents
//
static vector<Buffer::TocItem> toclist;
extern "C" void TocSelectCB(FL_OBJECT * ob, long)
{
if (!current_view->available())
return;
TocUpdateCB(0, 0);
unsigned int choice = fl_get_browser(ob);
if (0 < choice && choice - 1 < toclist.size()) {
current_view->beforeChange();
current_view->text->SetCursor(current_view, toclist[choice-1].par, 0);
current_view->text->sel_cursor =
current_view->text->cursor;
current_view->update(BufferView::SELECT|BufferView::FITCUR);
} else {
WriteAlert(_("Error"),
_("Couldn't find this label"),
_("in current document."));
}
}
extern "C" void TocCancelCB(FL_OBJECT *, long)
{
fl_hide_form(fd_form_toc->form_toc);
}
extern "C"
void TocUpdateCB(FL_OBJECT *, long)
{
if (!current_view->available()) {
toclist.clear();
fl_clear_browser(fd_form_toc->browser_toc);
fl_add_browser_line(fd_form_toc->browser_toc,
_("*** No Document ***"));
return;
}
vector<vector<Buffer::TocItem> > tmp =
current_view->buffer()->getTocList();
int type = fl_get_choice(fd_form_toc->toctype)-1;
//if (toclist == tmp[type])
// return;
if (toclist.size() == tmp[type].size()) {
// Check if all elements are the same.
unsigned int i = 0;
for (; i < toclist.size(); ++i) {
if (toclist[i] != tmp[type][i])
break;
}
if (i >= toclist.size()) return;
}
toclist = tmp[type];
static Buffer * buffer = 0;
int topline = 0;
int line = 0;
if (buffer == current_view->buffer()) {
topline = fl_get_browser_topline(fd_form_toc->browser_toc);
line = fl_get_browser(fd_form_toc->browser_toc);
} else
buffer = current_view->buffer();
fl_clear_browser(fd_form_toc->browser_toc);
fl_hide_object(fd_form_toc->browser_toc);
for (vector<Buffer::TocItem>::const_iterator it = toclist.begin();
it != toclist.end(); ++it)
fl_add_browser_line(fd_form_toc->browser_toc,
(string(4*(*it).depth,' ')+
(*it).str).c_str());
fl_set_browser_topline(fd_form_toc->browser_toc, topline);
fl_select_browser_line(fd_form_toc->browser_toc, line);
fl_show_object(fd_form_toc->browser_toc);
}
/* callbacks for form form_ref */ /* callbacks for form form_ref */
extern "C" void RefSelectCB(FL_OBJECT *, long data) extern "C" void RefSelectCB(FL_OBJECT *, long data)
{ {

View File

@ -64,7 +64,6 @@ FD_form_table * fd_form_table;
FD_form_sendto * fd_form_sendto; FD_form_sendto * fd_form_sendto;
FD_form_figure * fd_form_figure; FD_form_figure * fd_form_figure;
FD_form_screen * fd_form_screen; FD_form_screen * fd_form_screen;
FD_form_toc * fd_form_toc;
FD_form_ref * fd_form_ref; FD_form_ref * fd_form_ref;
FD_LaTeXLog * fd_latex_log; // from log_form.h FD_LaTeXLog * fd_latex_log; // from log_form.h
Combox * combo_language; Combox * combo_language;
@ -532,12 +531,6 @@ void LyXGUI::create_forms()
fl_set_form_atclose(fd_form_screen->form_screen, fl_set_form_atclose(fd_form_screen->form_screen,
CancelCloseBoxCB, 0); CancelCloseBoxCB, 0);
// the toc form
fd_form_toc = create_form_form_toc();
fl_addto_choice(fd_form_toc->toctype,
_(" TOC | LOF | LOT | LOA "));
fl_set_form_atclose(fd_form_toc->form_toc, CancelCloseBoxCB, 0);
// the ref form // the ref form
fd_form_ref = create_form_form_ref(); fd_form_ref = create_form_form_ref();
fl_set_form_atclose(fd_form_ref->form_ref, CancelCloseBoxCB, 0); fl_set_form_atclose(fd_form_ref->form_ref, CancelCloseBoxCB, 0);

View File

@ -54,7 +54,6 @@ extern FD_form_preamble * fd_form_preamble;
extern FD_form_table * fd_form_table; extern FD_form_table * fd_form_table;
extern FD_form_sendto * fd_form_sendto; extern FD_form_sendto * fd_form_sendto;
extern FD_form_figure * fd_form_figure; extern FD_form_figure * fd_form_figure;
extern FD_form_toc * fd_form_toc;
extern FD_form_ref * fd_form_ref; extern FD_form_ref * fd_form_ref;
extern FD_form_paragraph_extra * fd_form_paragraph_extra; extern FD_form_paragraph_extra * fd_form_paragraph_extra;
extern FD_LaTeXLog * fd_latex_log; extern FD_LaTeXLog * fd_latex_log;
@ -69,7 +68,6 @@ extern FD_bibitem_form * bibitem_form;
extern FD_include * form; extern FD_include * form;
extern FD_index_form * index_form; extern FD_index_form * index_form;
extern void TocUpdateCB();
extern void HideFiguresPopups(); extern void HideFiguresPopups();
// Prevents LyX from being killed when the close box is pressed in a popup. // Prevents LyX from being killed when the close box is pressed in a popup.
@ -120,9 +118,6 @@ void CloseAllBufferRelatedDialogs()
if (fd_form_figure->form_figure->visible) { if (fd_form_figure->form_figure->visible) {
fl_hide_form(fd_form_figure->form_figure); fl_hide_form(fd_form_figure->form_figure);
} }
if (fd_form_toc->form_toc->visible) {
fl_hide_form(fd_form_toc->form_toc);
}
if (fd_form_ref->form_ref->visible) { if (fd_form_ref->form_ref->visible) {
fl_hide_form(fd_form_ref->form_ref); fl_hide_form(fd_form_ref->form_ref);
} }
@ -221,9 +216,6 @@ void updateAllVisibleBufferRelatedDialogs()
updateBulletForm(); updateBulletForm();
} }
} }
if (fd_form_toc->browser_toc->visible) {
TocUpdateCB(0, 0);
}
if (fd_latex_log->LaTeXLog->visible) { if (fd_latex_log->LaTeXLog->visible) {
LatexLogUpdate(0,0); LatexLogUpdate(0,0);
} }

View File

@ -22,6 +22,7 @@
#include <csignal> #include <csignal>
#include "LString.h" #include "LString.h"
#include "support/utility.hpp"
class LyXGUI; class LyXGUI;
class LyXRC; class LyXRC;
@ -40,7 +41,7 @@ extern LastFiles * lastfiles; /* we should hopefully be able to move this
/** /**
This is the main LyX object it encapsulates most of the other objects. This is the main LyX object it encapsulates most of the other objects.
*/ */
class LyX { class LyX : public noncopyable {
public: public:
/**@name Constructors and Deconstructors */ /**@name Constructors and Deconstructors */
//@{ //@{
@ -56,22 +57,12 @@ public:
LyXGUI * lyxGUI; // should be only one of this LyXGUI * lyxGUI; // should be only one of this
//@} //@}
private: private:
/**@name Constructors and Deconstructors */
//@{
/// not allowed
LyX(const LyX &) {} // not allowed
/// not allowed
LyX() {} // not allowed
//@}
/**@name Private variables */ /**@name Private variables */
//@{ //@{
/// does this user start lyx for the first time? /// does this user start lyx for the first time?
bool first_start; bool first_start;
/// ///
string batch_command; string batch_command;
///
// struct sigaction act_; // seems to be unused
//@} //@}
/**@name Private Members */ /**@name Private Members */
//@{ //@{

View File

@ -43,9 +43,6 @@ using std::istringstream;
#include "insets/inseturl.h" #include "insets/inseturl.h"
#include "insets/insetlatexaccent.h" #include "insets/insetlatexaccent.h"
#include "insets/insettoc.h" #include "insets/insettoc.h"
#include "insets/insetlof.h"
#include "insets/insetloa.h"
#include "insets/insetlot.h"
#include "insets/insetref.h" #include "insets/insetref.h"
#include "insets/insetparent.h" #include "insets/insetparent.h"
#include "insets/insetindex.h" #include "insets/insetindex.h"
@ -107,7 +104,6 @@ extern bool math_insert_greek(char);
extern BufferList bufferlist; extern BufferList bufferlist;
extern LyXServer * lyxserver; extern LyXServer * lyxserver;
extern int greek_kb_flag; extern int greek_kb_flag;
extern FD_form_toc * fd_form_toc;
extern bool selection_possible; extern bool selection_possible;
extern kb_keymap * toplevel_keymap; extern kb_keymap * toplevel_keymap;
@ -888,60 +884,40 @@ string LyXFunc::Dispatch(int ac,
case LFUN_LOTVIEW: case LFUN_LOTVIEW:
case LFUN_LOAVIEW: case LFUN_LOAVIEW:
{ {
Buffer::TocType type = Buffer::TOC_TOC; InsetCommandParams p;
if (action == LFUN_LOFVIEW)
type = Buffer::TOC_LOF; if( action == LFUN_TOCVIEW )
else if (action == LFUN_LOTVIEW) p.setCmdName( "tableofcontents" );
type = Buffer::TOC_LOT; else if( action == LFUN_LOAVIEW )
else if (action == LFUN_LOAVIEW) p.setCmdName( "listofalgorithms" );
type = Buffer::TOC_LOA; else if( action == LFUN_LOFVIEW )
fl_set_choice(fd_form_toc->toctype,type + 1); p.setCmdName( "listoffigures" );
TocUpdateCB(0, 0); else
if (fd_form_toc->form_toc->visible) { p.setCmdName( "listoftables" );
fl_raise_form(fd_form_toc->form_toc);
} else { owner->getDialogs()->createTOC( p.getAsString() );
static int ow = -1, oh;
fl_show_form(fd_form_toc->form_toc,
FL_PLACE_MOUSE |
FL_FREE_SIZE, FL_FULLBORDER,
_("Table of Contents"));
if (ow < 0) {
ow = fd_form_toc->form_toc->w;
oh = fd_form_toc->form_toc->h;
}
fl_set_form_minsize(fd_form_toc->form_toc, ow, oh);
}
break; break;
} }
case LFUN_TOC_INSERT:
{
Inset * new_inset = new InsetTOC(owner->buffer());
if (!owner->view()->insertInset(new_inset, "Standard", true))
delete new_inset;
break;
}
case LFUN_LOF_INSERT:
{
Inset * new_inset = new InsetLOF(owner->buffer());
if (!owner->view()->insertInset(new_inset, "Standard", true))
delete new_inset;
break;
}
case LFUN_LOA_INSERT:
{
Inset * new_inset = new InsetLOA(owner->buffer());
if (!owner->view()->insertInset(new_inset, "Standard", true))
delete new_inset;
break;
}
case LFUN_TOC_INSERT:
case LFUN_LOA_INSERT:
case LFUN_LOF_INSERT:
case LFUN_LOT_INSERT: case LFUN_LOT_INSERT:
{ {
Inset * new_inset = new InsetLOT(owner->buffer()); InsetCommandParams p;
if (!owner->view()->insertInset(new_inset, "Standard", true))
delete new_inset; if( action == LFUN_TOC_INSERT )
p.setCmdName( "tableofcontents" );
else if( action == LFUN_LOA_INSERT )
p.setCmdName( "listofalgorithms" );
else if( action == LFUN_LOF_INSERT )
p.setCmdName( "listoffigures" );
else
p.setCmdName( "listoftables" );
Inset * inset = new InsetTOC( p );
if( !owner->view()->insertInset( inset, "Standard", true ) )
delete inset;
break; break;
} }
@ -2564,7 +2540,18 @@ string LyXFunc::Dispatch(int ac,
case LFUN_CREATE_CITATION: case LFUN_CREATE_CITATION:
{ {
owner->getDialogs()->createCitation( argument ); // Should do this "at source"
InsetCommandParams p;
p.setCmdName( "cite" );
if (contains(argument, "|")) {
p.setContents( token(argument, '|', 0) );
p.setOptions( token(argument, '|', 1) );
} else {
p.setContents( argument );
}
owner->getDialogs()->createCitation( p.getAsString() );
} }
break; break;

View File

@ -1,7 +1,3 @@
#ifdef __GNUG__
#pragma implementation
#endif
#include <config.h> #include <config.h>
#include <sys/types.h> #include <sys/types.h>
@ -12,6 +8,10 @@
#include "lyxregex.h" #include "lyxregex.h"
#endif #endif
#ifdef __GNUG__
#pragma implementation
#endif
#include "LRegex.h" #include "LRegex.h"
using std::make_pair; using std::make_pair;
@ -55,7 +55,7 @@ struct LRegex::Impl {
} }
/// ///
LRegex::MatchPair first_match(string const & str) const LRegex::MatchPair const first_match(string const & str) const
{ {
regmatch_t tmp; regmatch_t tmp;
regexec(preg, str.c_str(), 1, &tmp, 0); regexec(preg, str.c_str(), 1, &tmp, 0);
@ -67,7 +67,7 @@ struct LRegex::Impl {
} }
/// ///
string getError() const string const getError() const
{ {
size_t nr = regerror(error_code, preg, 0, 0); size_t nr = regerror(error_code, preg, 0, 0);
char * tmp = new char[nr]; char * tmp = new char[nr];
@ -134,13 +134,13 @@ bool LRegex::exact_match(string const & str) const
} }
LRegex::MatchPair LRegex::first_match(string const & str) const LRegex::MatchPair const LRegex::first_match(string const & str) const
{ {
return impl->first_match(str); return impl->first_match(str);
} }
string LRegex::getError() const string const LRegex::getError() const
{ {
return impl->getError(); return impl->getError();
} }

View File

@ -38,10 +38,10 @@ public:
bool exact_match(string const & str) const; bool exact_match(string const & str) const;
/// ///
MatchPair first_match(string const & str) const; MatchPair const first_match(string const & str) const;
/// ///
string getError() const; string const getError() const;
/// ///
int getErrorCode() const; int getErrorCode() const;