]> git.lyx.org Git - features.git/commitdiff
John's FormExternal patch, Edwin's Qt2 patch and Baruch's gnome patch.
authorAngus Leeming <leeming@lyx.org>
Mon, 12 Mar 2001 11:22:26 +0000 (11:22 +0000)
committerAngus Leeming <leeming@lyx.org>
Mon, 12 Mar 2001 11:22:26 +0000 (11:22 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1739 a592a061-630c-0410-9148-cb99ea01b6c8

30 files changed:
forms/ChangeLog
forms/lyx.fd
po/POTFILES.in
src/ChangeLog
src/frontends/ChangeLog
src/frontends/Dialogs.h
src/frontends/gnome/ChangeLog
src/frontends/gnome/Dialogs.C
src/frontends/gnome/Makefile.am
src/frontends/gnome/Menubar_pimpl.C
src/frontends/qt2/ChangeLog
src/frontends/qt2/Dialogs.C
src/frontends/qt2/FormParagraph.C
src/frontends/qt2/Makefile.am
src/frontends/qt2/paragraphdlg.C
src/frontends/qt2/paragraphdlg.h
src/frontends/qt2/paragraphdlg.ui
src/frontends/qt2/paragraphdlgimpl.C
src/frontends/xforms/ChangeLog
src/frontends/xforms/Dialogs.C
src/frontends/xforms/FormGraphics.C
src/frontends/xforms/Makefile.am
src/frontends/xforms/forms/makefile
src/insets/ChangeLog
src/insets/ExternalTemplate.C
src/insets/ExternalTemplate.h
src/insets/insetexternal.C
src/insets/insetexternal.h
src/lyx.C
src/lyx.h

index c73dd50cfff23781a7622c61d1f871fc3abbc3ca..a39114a126223ede54f451c7d5fe7ce06055a12b 100644 (file)
@@ -1,3 +1,7 @@
+2001-03-09  John Levon  <moz@compsoc.man.ac.uk>
+
+       * lyx.fd: strip external form
+
 2001-03-05  Edwin Leuven  <leuven@fee.uva.nl>
 
        * form1.fd: search_form deleted
index 6756b5d736940520fd005375c1129ee39490ddb9..b3238efc1f4468ed53d28be84e61eb639912f133 100644 (file)
@@ -3,7 +3,7 @@ Magic: 13000
 Internal Form Definition File
     (do not change)
 
-Number of forms: 2
+Number of forms: 1
 Unit of measure: FL_COORD_PIXEL
 
 =============== FORM ===============
@@ -192,209 +192,5 @@ name:
 callback: 
 argument: 
 
-=============== FORM ===============
-Name: form_external
-Width: 560
-Height: 310
-Number of Objects: 11
-
---------------------
-class: FL_BOX
-type: UP_BOX
-box: 0 0 560 310
-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_CHOICE
-type: NORMAL_CHOICE
-box: 130 10 300 30
-boxtype: FL_FRAME_BOX
-colors: FL_COL1 FL_BLACK
-alignment: FL_ALIGN_LEFT
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: Template|#t
-shortcut: 
-resize: FL_RESIZE_ALL
-gravity: FL_NorthWest FL_NorthEast
-name: templatechoice
-callback: ExternalTemplateCB
-argument: 0
-
---------------------
-class: FL_INPUT
-type: NORMAL_INPUT
-box: 130 190 190 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: File|#F
-shortcut: 
-resize: FL_RESIZE_ALL
-gravity: FL_SouthWest FL_SouthEast
-name: filename
-callback: 
-argument: 
-
---------------------
-class: FL_BUTTON
-type: NORMAL_BUTTON
-box: 330 190 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: Browse...|#B
-shortcut: 
-resize: FL_RESIZE_ALL
-gravity: FL_SouthEast FL_SouthEast
-name: filenamebrowse
-callback: ExternalBrowseCB
-argument: 0
-
---------------------
-class: FL_INPUT
-type: NORMAL_INPUT
-box: 130 230 300 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: Parameters|#P
-shortcut: 
-resize: FL_RESIZE_ALL
-gravity: FL_SouthWest FL_SouthEast
-name: parameters
-callback: 
-argument: 
-
---------------------
-class: FL_BUTTON
-type: NORMAL_BUTTON
-box: 435 50 110 30
-boxtype: FL_UP_BOX
-colors: FL_COL1 FL_BLACK
-alignment: FL_ALIGN_CENTER
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: Edit file|#E
-shortcut: 
-resize: FL_RESIZE_ALL
-gravity: FL_NorthEast FL_NorthEast
-name: edit
-callback: ExternalEditCB
-argument: 0
-
---------------------
-class: FL_BUTTON
-type: NORMAL_BUTTON
-box: 435 90 110 30
-boxtype: FL_UP_BOX
-colors: FL_COL1 FL_BLACK
-alignment: FL_ALIGN_CENTER
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: View result|#V
-shortcut: 
-resize: FL_RESIZE_ALL
-gravity: FL_NorthEast FL_NorthEast
-name: view
-callback: ExternalViewCB
-argument: 0
-
---------------------
-class: FL_BUTTON
-type: NORMAL_BUTTON
-box: 435 130 110 30
-boxtype: FL_UP_BOX
-colors: FL_COL1 FL_BLACK
-alignment: FL_ALIGN_CENTER
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: Update result|#U
-shortcut: 
-resize: FL_RESIZE_ALL
-gravity: FL_NorthEast FL_NorthEast
-name: update
-callback: ExternalUpdateCB
-argument: 0
-
---------------------
-class: FL_BUTTON
-type: RETURN_BUTTON
-box: 315 270 110 30
-boxtype: FL_UP_BOX
-colors: FL_COL1 FL_BLACK
-alignment: FL_ALIGN_CENTER
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: OK
-shortcut: ^M
-resize: FL_RESIZE_ALL
-gravity: FL_SouthEast FL_SouthEast
-name: ok
-callback: ExternalOKCB
-argument: 0
-
---------------------
-class: FL_BUTTON
-type: NORMAL_BUTTON
-box: 435 270 110 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|#C^[
-shortcut: 
-resize: FL_RESIZE_ALL
-gravity: FL_SouthEast FL_SouthEast
-name: cancel
-callback: ExternalCancelCB
-argument: 0
-
---------------------
-class: FL_BROWSER
-type: NORMAL_BROWSER
-box: 130 50 300 130
-boxtype: FL_DOWN_BOX
-colors: FL_COL1 FL_YELLOW
-alignment: FL_ALIGN_TOP
-style: FL_NORMAL_STYLE
-size: FL_DEFAULT_SIZE
-lcol: FL_BLACK
-label: 
-shortcut: 
-resize: FL_RESIZE_ALL
-gravity: FL_NorthWest FL_SouthEast
-name: helptext
-callback: 
-argument: 
-
 ==============================
 create_the_forms
index 0c414a861fbc19b4170a7eb54a638daf242836c9..6a9e2f179de7422376ebcba05abfefb659c3d112 100644 (file)
@@ -62,6 +62,7 @@ src/frontends/kde/refdlg.C
 src/frontends/kde/tabcreatedlg.C
 src/frontends/kde/tocdlg.C
 src/frontends/kde/urldlg.C
+src/frontends/qt2/FileDialog.C
 src/frontends/qt2/FormCharacter.C
 src/frontends/qt2/FormCopyright.C
 src/frontends/qt2/FormParagraph.C
@@ -72,54 +73,56 @@ src/frontends/qt2/paragraphdlgimpl.C
 src/frontends/qt2/tabularcreatedlgimpl.C
 src/frontends/xforms/FileDialog.C
 src/frontends/xforms/FormBase.h
-src/frontends/xforms/form_bibitem.C
 src/frontends/xforms/FormBibitem.C
-src/frontends/xforms/form_bibtex.C
+src/frontends/xforms/form_bibitem.C
 src/frontends/xforms/FormBibtex.C
+src/frontends/xforms/form_bibtex.C
 src/frontends/xforms/form_browser.C
-src/frontends/xforms/form_character.C
 src/frontends/xforms/FormCharacter.C
-src/frontends/xforms/form_citation.C
+src/frontends/xforms/form_character.C
 src/frontends/xforms/FormCitation.C
-src/frontends/xforms/form_copyright.C
+src/frontends/xforms/form_citation.C
 src/frontends/xforms/FormCopyright.C
-src/frontends/xforms/form_credits.C
+src/frontends/xforms/form_copyright.C
 src/frontends/xforms/FormCredits.C
-src/frontends/xforms/form_document.C
+src/frontends/xforms/form_credits.C
 src/frontends/xforms/FormDocument.C
-src/frontends/xforms/form_error.C
+src/frontends/xforms/form_document.C
 src/frontends/xforms/FormError.C
-src/frontends/xforms/form_filedialog.C
+src/frontends/xforms/form_error.C
+src/frontends/xforms/FormExternal.C
+src/frontends/xforms/form_external.C
 src/frontends/xforms/FormFiledialog.C
-src/frontends/xforms/form_graphics.C
+src/frontends/xforms/form_filedialog.C
 src/frontends/xforms/FormGraphics.C
-src/frontends/xforms/form_include.C
+src/frontends/xforms/form_graphics.C
 src/frontends/xforms/FormInclude.C
-src/frontends/xforms/form_index.C
+src/frontends/xforms/form_include.C
 src/frontends/xforms/FormIndex.C
+src/frontends/xforms/form_index.C
 src/frontends/xforms/FormInset.h
 src/frontends/xforms/FormLog.C
-src/frontends/xforms/form_paragraph.C
 src/frontends/xforms/FormParagraph.C
-src/frontends/xforms/form_preamble.C
+src/frontends/xforms/form_paragraph.C
 src/frontends/xforms/FormPreamble.C
-src/frontends/xforms/form_preferences.C
+src/frontends/xforms/form_preamble.C
 src/frontends/xforms/FormPreferences.C
-src/frontends/xforms/form_print.C
+src/frontends/xforms/form_preferences.C
 src/frontends/xforms/FormPrint.C
-src/frontends/xforms/form_ref.C
+src/frontends/xforms/form_print.C
 src/frontends/xforms/FormRef.C
-src/frontends/xforms/form_search.C
+src/frontends/xforms/form_ref.C
 src/frontends/xforms/FormSearch.C
+src/frontends/xforms/form_search.C
 src/frontends/xforms/FormSplash.C
-src/frontends/xforms/form_tabular.C
 src/frontends/xforms/FormTabular.C
-src/frontends/xforms/form_tabular_create.C
+src/frontends/xforms/form_tabular.C
 src/frontends/xforms/FormTabularCreate.C
-src/frontends/xforms/form_toc.C
+src/frontends/xforms/form_tabular_create.C
 src/frontends/xforms/FormToc.C
-src/frontends/xforms/form_url.C
+src/frontends/xforms/form_toc.C
 src/frontends/xforms/FormUrl.C
+src/frontends/xforms/form_url.C
 src/frontends/xforms/FormVCLog.C
 src/frontends/xforms/input_validators.C
 src/frontends/xforms/Menubar_pimpl.C
@@ -129,6 +132,7 @@ src/importer.C
 src/insets/figinset.C
 src/insets/insetbib.C
 src/insets/inset.C
+src/insets/insetcaption.C
 src/insets/inseterror.C
 src/insets/insetert.C
 src/insets/insetexternal.C
index 875ebce4bf578c426339fbe3bc8fbce412597adf..a91ace0bbffadc5448b1300bf4330f1996debec2 100644 (file)
@@ -1,3 +1,8 @@
+2001-03-09  John Levon  <moz@compsoc.man.ac.uk>
+
+       * lyx.C:
+       * lyx.h: strip external form
+
 2001-03-12  Lars Gullik Bjønnes  <larsbj@trylle.birdstep.com>
 
        * buffer.C: add using std::stringstream.
index b5d61f7184147f49d12f12330c9da9c3c9cfc938..f7420413f52ab883489d94ebfa9e34d93c227c36 100644 (file)
@@ -1,3 +1,7 @@
+2001-03-09  John Levon  <moz@compsoc.man.ac.uk>
+
+       * Dialogs.h: add showExternal signal
+
 2001-02-26  John Levon  <moz@compsoc.man.ac.uk>
 
        * Makefile.am
index 734976425bf89b6243568c297974c7fcd57ee658..dec8d1e20742a7519c9e49e6dd90e44277f29b10 100644 (file)
@@ -33,6 +33,7 @@ class InsetGraphics;
 class InsetBibKey;
 class InsetBibtex;
 class InsetError;
+class InsetExternal;
 class InsetInclude;
 class InsetInfo;
 class InsetTabular;
@@ -98,6 +99,8 @@ public:
        Signal0<void> showCredits;
        ///
        Signal1<void, InsetError *> showError;
+       /// show the external inset dialog
+       Signal1<void, InsetExternal *> showExternal; 
        ///
        Signal1<void, InsetGraphics *> showGraphics;
        /// show the details of a LyX file include inset
index 72378e459640f5d5d524aacf7122f65ccc737d88..bd42dbf9fc68745dff66098765019be9caaaa1da 100644 (file)
@@ -1,3 +1,7 @@
+2001-03-11  Baruch Even  <baruch@lyx.org>
+
+       * Various files: More fixes to get it compiled again.
+
 2001-03-06  Baruch Even  <baruch@lyx.org>
 
        * Various files: Small fixes to get the gnome frontend to compile again.
index aff72684e12142e67dd9696946c2354f15d15083..7247dcb39c239e5234e746944485229c10d01d0c 100644 (file)
@@ -12,6 +12,7 @@
 #include "FormPreferences.h"
 #include "FormPrint.h"
 #include "FormRef.h"
+#include "FormSplash.h"
 #include "FormTabular.h"
 #include "FormToc.h"
 #include "FormUrl.h"
@@ -39,12 +40,11 @@ Dialogs::Dialogs(LyXView * lv)
        dialogs_.push_back(new FormParagraph(lv, this));
        dialogs_.push_back(new FormPrint(lv, this));
        dialogs_.push_back(new FormRef(lv, this));
+       dialogs_.push_back(new FormSplash(lv, this));
        dialogs_.push_back(new FormTabular(lv, this));
        dialogs_.push_back(new FormToc(lv, this));
        dialogs_.push_back(new FormUrl(lv, this));
 
-       showCredits.connect(slot(ShowCredits));
-
        // reduce the number of connections needed in
        // dialogs by a simple connection here.
        hideAll.connect(hideBufferDependent.slot());
index 16104ef45e07f51fb876956da7c93096e67c4c05..5789ec57511fa4268789516290c86f8b3bafea71 100644 (file)
@@ -9,6 +9,9 @@ INCLUDES = ${FRONTEND_INCLUDES} -I${top_srcdir}/src/ \
 libgnome_la_OBJADD = \
        ../xforms/ButtonController.lo \
        ../xforms/Color.lo \
+       ../xforms/FileDialog.lo \
+       ../xforms/FormFiledialog.lo \
+       ../xforms/form_filedialog.lo \
        ../xforms/FormBase.lo \
        ../xforms/FormCitation.lo \
        ../xforms/form_citation.lo \
@@ -31,6 +34,8 @@ libgnome_la_OBJADD = \
        ../xforms/form_print.lo \
        ../xforms/FormRef.lo \
        ../xforms/form_ref.lo \
+       ../xforms/FormSplash.lo \
+       ../xforms/form_splash.lo \
        ../xforms/FormTabular.lo \
        ../xforms/form_tabular.lo \
        ../xforms/FormTabularCreate.lo \
index 2a0201cb4c9cd00f55fa3394fbf4954ed77ff9b2..b0a2ee1fa7d25e0bf2c92512a89c29ddc80c876c 100644 (file)
@@ -246,7 +246,7 @@ void Menubar::Pimpl::composeUIInfo(string const & menu_name, vector<Gnome::UI::I
            action = static_cast<kb_action>(ac);
 
          switch(action) {
-         case LFUN_MENUOPEN:
+         case LFUN_FILE_OPEN:
            gitem = Open(cback);
            break;
          case LFUN_QUIT:
@@ -258,7 +258,7 @@ void Menubar::Pimpl::composeUIInfo(string const & menu_name, vector<Gnome::UI::I
          case LFUN_MENUWRITE:
            gitem = Save(cback);
            break;
-         case LFUN_MENUWRITEAS:
+         case LFUN_WRITEAS:
            gitem = SaveAs(cback);
            break;
          case LFUN_BUFFER_PRINT:
index 099fcfdbd5793edc50909d316ae4eae4c4f76949..a2cb6718d7ec8e2c841744944211d0777011d41f 100644 (file)
@@ -1,3 +1,13 @@
+2001-03-09  Edwin Leuven  <leuven@fee.uva.nl>
+
+       * Makefile.am: updated
+       * paragraphdlg.ui: manually enabled items in minipage settings
+       * paragraphdlgimpl.C: tweak enable code on extra page
+       * Stuff sent in by Denis Perchine <dyp@perchine.com> to compile again:
+       * FileDialog_private.[Ch]: added
+       * FileDialog.C: added
+       * FormParagraph.C: params settings updated
+
 2001-03-06  Edwin Leuven  <leuven@fee.uva.nl>
 
        * Search dialog added:
index b4ba40154c0ae40febef2c39726ef4d8e5ea11e7..562bb2f3d463601abc928d7e6a044dcb3d627337 100644 (file)
@@ -14,6 +14,7 @@
 #include "Dialogs.h"
 #include "FormCharacter.h"
 #include "FormCitation.h"
+#include "FormCredits.h"
 #include "FormCopyright.h"
 #include "FormDocument.h"
 #include "FormError.h"
 
 using std::endl;
 
-// temporary till ported
-extern void ShowCredits();
-
-
 // Signal enabling all visible popups to be redrawn if so desired.
 // E.g., when the GUI colours have been remapped.
 Signal0<void> Dialogs::redrawGUI;
@@ -49,6 +46,7 @@ Dialogs::Dialogs(LyXView * lv)
        dialogs_.push_back(new FormCharacter(lv, this));
        dialogs_.push_back(new FormCitation(lv, this));
        dialogs_.push_back(new FormCopyright(lv, this));
+       dialogs_.push_back(new FormCredits(lv, this));
        dialogs_.push_back(new FormDocument(lv, this));
        dialogs_.push_back(new FormError(lv, this));
        dialogs_.push_back(new FormGraphics(lv, this));
@@ -63,8 +61,6 @@ Dialogs::Dialogs(LyXView * lv)
        dialogs_.push_back(new FormToc(lv, this));
        dialogs_.push_back(new FormUrl(lv, this));
 
-       showCredits.connect(slot(ShowCredits));
-
        // reduce the number of connections needed in
        // dialogs by a simple connection here.
        hideAll.connect(hideBufferDependent.slot());
index 6fd2c80864fdb3fd5c1b1674d4dff81f1b67bdf0..e42633d4f8c936283f7124a09cd71066975165ac 100644 (file)
@@ -72,22 +72,22 @@ void FormParagraph::update(bool switched)
                align = textclasslist.Style(buf->params.textclass, par->GetLayout()).align;
 
 #ifndef NEW_INSETS
-       LyXParagraph *physpar = par->FirstPhysicalPar();
+       ParagraphParameters *params = &(par->FirstPhysicalPar()->params);
 #else
-       LyXParagraph *physpar = par;
+       ParagraphParameters *params = &(par->params);
 #endif
-
-       if (physpar->added_space_top.kind()==VSpace::LENGTH) {
-               LyXGlueLength above = physpar->added_space_top.length();
-               lyxerr[Debug::GUI] << "Reading above space : \"" << physpar->added_space_top.length().asString() << "\"" << endl;
+    
+       if (params->spaceTop().kind() == VSpace::LENGTH) {
+               LyXGlueLength above = params->spaceTop().length();
+               lyxerr[Debug::GUI] << "Reading above space : \"" << params->spaceTop().length().asString() << "\"" << endl;
                dialog_->setAboveLength(above.value(), above.plusValue(), above.minusValue(),
                        above.unit(), above.plusUnit(), above.minusUnit());
        } else
                dialog_->setAboveLength(0.0, 0.0, 0.0, LyXLength::UNIT_NONE, LyXLength::UNIT_NONE, LyXLength::UNIT_NONE);
 
-       if (physpar->added_space_bottom.kind()==VSpace::LENGTH) {
-               LyXGlueLength below = physpar->added_space_bottom.length();
-               lyxerr[Debug::GUI] << "Reading below space : \"" << physpar->added_space_bottom.length().asString() << "\"" << endl;
+       if (params->spaceBottom().kind() == VSpace::LENGTH) {
+               LyXGlueLength below = params->spaceBottom().length();
+               lyxerr[Debug::GUI] << "Reading below space : \"" << params->spaceBottom().length().asString() << "\"" << endl;
                dialog_->setBelowLength(below.value(), below.plusValue(), below.minusValue(),
                        below.unit(), below.plusUnit(), below.minusUnit());
        } else
@@ -95,30 +95,31 @@ void FormParagraph::update(bool switched)
 
        dialog_->setLabelWidth(text->cursor.par()->GetLabelWidthString().c_str());
        dialog_->setAlign(align);
-       dialog_->setChecks(physpar->line_top, physpar->line_bottom,
-               physpar->pagebreak_top, physpar->pagebreak_bottom, physpar->noindent);
-       dialog_->setSpace(physpar->added_space_top.kind(), physpar->added_space_bottom.kind(),
-               physpar->added_space_top.keep(), physpar->added_space_bottom.keep());
+       dialog_->setChecks(params->lineTop(), params->lineBottom(),
+               params->pagebreakTop(), params->pagebreakBottom(), params->noindent());
+       dialog_->setSpace(params->spaceTop().kind(), params->spaceBottom().kind(),
+               params->spaceTop().keep(), params->spaceBottom().keep());
 
        // now the extras page
 
        LyXLength extrawidth;
        float val = 0.0;
        LyXLength::UNIT unit = LyXLength::CM;
+       params = &(par->params);
 
-       if (isValidLength(par->pextra_width, &extrawidth)) {
+       if (isValidLength(params->pextraWidth(), &extrawidth)) {
                lyxerr[Debug::GUI] << "Reading extra width \"" << extrawidth.asString() << "\"" << endl;
                val = extrawidth.value();
                unit = extrawidth.unit();
        }
 
-       lyxerr[Debug::GUI] << "Reading widthp \"" << par->pextra_widthp << "\"" << endl;
+       lyxerr[Debug::GUI] << "Reading widthp \"" << params->pextraWidthp() << "\"" << endl;
 
-       dialog_->setExtra(val, unit, par->pextra_widthp,
-               par->pextra_alignment,
-               par->pextra_hfill,
-               par->pextra_start_minipage,
-               static_cast<LyXParagraph::PEXTRA_TYPE>(par->pextra_type));
+       dialog_->setExtra(val, unit, params->pextraWidthp(),
+               params->pextraAlignment(),
+               params->pextraHfill(),
+               params->pextraStartMinipage(),
+               static_cast<LyXParagraph::PEXTRA_TYPE>(params->pextraType()));
 }
 
 void FormParagraph::apply()
index f029fbf535db3e5e5746ba3f035c81826ee8f67a..111510068ba21966ef5c1e21c542dd03b1a11f2d 100644 (file)
@@ -9,7 +9,9 @@ DEFINES = -DQT_CLEAN_NAMESPACE
 CXXFLAGS= $(DEFINES)
 
 # moc generated files
-BUILTSOURCES =         moc_FormCopyrightDialogBase.C \
+BUILTSOURCES = \
+       moc_FileDialog_private.C \
+       moc_FormCopyrightDialogBase.C \
                 moc_FormCopyrightDialog.C \
               moc_chardlg.C \
               moc_chardlgimpl.C \
@@ -32,6 +34,7 @@ libqt2_la_OBJADD = \
        ../xforms/Color.lo \
        ../xforms/FormBase.lo \
        ../xforms/FormCitation.lo \
+       ../xforms/FormCredits.lo \
        ../xforms/FormDocument.lo \
        ../xforms/FormError.lo \
        ../xforms/FormGraphics.lo \
@@ -48,6 +51,7 @@ libqt2_la_OBJADD = \
        ../xforms/Toolbar_pimpl.lo \
        ../xforms/Timeout_pimpl.lo \
        ../xforms/form_citation.lo \
+       ../xforms/form_credits.lo \
        ../xforms/form_copyright.lo \
        ../xforms/form_document.lo \
        ../xforms/form_error.lo \
@@ -76,6 +80,8 @@ libqt2_la_SOURCES = \
        chardlg.h \
        chardlgimpl.C \
        chardlgimpl.h \
+       FileDialog.C \
+       FileDialog_private.C \
        FormCopyright.C \
        FormCopyright.h \
        FormCopyrightDialog.C \
@@ -128,6 +134,8 @@ FormCopyrightDialogBase.h: FormCopyrightDialogBase.ui
        $(UIC) -o $@ $<
 FormCopyrightDialogBase.C: FormCopyrightDialogBase.ui
        $(UIC) -impl FormCopyrightDialogBase.h -o $@ $<
+moc_FileDialog_private.C: FileDialog_private.h
+       $(MOC) -o $@ $<
 moc_FormCopyrightDialogBase.C: FormCopyrightDialogBase.h
        $(MOC) -o $@ $<
 moc_FormCopyrightDialog.C: FormCopyrightDialog.h
index 31791b9618dd21d957a401379a6f458b9ba951e6..2a57051cb6ca83a86c8d0a3cdb9a65c8a471b1cd 100644 (file)
@@ -1,7 +1,7 @@
 /****************************************************************************
 ** Form implementation generated from reading ui file 'paragraphdlg.ui'
 **
-** Created: Sat Feb 10 14:22:28 2001
+** Created: Fri Mar 9 13:08:59 2001
 **      by:  The User Interface Compiler (uic)
 **
 ** WARNING! All changes made in this file will be lost!
@@ -465,12 +465,12 @@ ParagraphDlg::ParagraphDlg( QWidget* parent,  const char* name, bool modal, WFla
 
     minipageStart = new QCheckBox( minipageOptions, "minipageStart" );
     minipageStart->setText( tr( "Start new minipage" ) );
-    minipageStart->setEnabled( FALSE );
+    minipageStart->setEnabled( TRUE );
     minipageOptionsLayout->addWidget( minipageStart );
 
     minipageHfill = new QCheckBox( minipageOptions, "minipageHfill" );
     minipageHfill->setText( tr( "HFill between minipage paragraphs" ) );
-    minipageHfill->setEnabled( FALSE );
+    minipageHfill->setEnabled( TRUE );
     minipageOptionsLayout->addWidget( minipageHfill );
 
     Layout15 = new QHBoxLayout; 
index 39c08770e572dfac4baeb37e36f1b43aa7413d4e..a1552206988f5612d4debf9cfcf1fe5609c47601 100644 (file)
@@ -1,7 +1,7 @@
 /****************************************************************************
 ** Form interface generated from reading ui file 'paragraphdlg.ui'
 **
-** Created: Sat Feb 10 14:22:05 2001
+** Created: Fri Mar 9 13:08:44 2001
 **      by:  The User Interface Compiler (uic)
 **
 ** WARNING! All changes made in this file will be lost!
index 777e2c8a57d29e69741b74d6f615eef904bb6314..6de2b8596b8912cc799a6bbcd2a9fd3260bc97c8 100644 (file)
                                 </property>
                                 <property stdset="1">
                                     <name>enabled</name>
-                                    <bool>false</bool>
+                                    <bool>true</bool>
                                 </property>
                             </widget>
                             <widget>
                                 </property>
                                 <property stdset="1">
                                     <name>enabled</name>
-                                    <bool>false</bool>
+                                    <bool>true</bool>
                                 </property>
                             </widget>
                             <widget>
index afbfbbeac19984e163cb166888b1a2f1ae3d9d3e..590069ac80101d50ddb161c3f50f62438a3361cf 100644 (file)
@@ -395,7 +395,7 @@ int ParagraphDlgImpl::getItem(LyXLength::UNIT unit) const {
 
 void ParagraphDlgImpl::enable_extraOptions(int item)
 {
-   bool enable = (item==0);
+   bool enable = (item!=0);
    extraWidth->setEnabled(enable);
    extraWidthL->setEnabled(enable);
    extraUnit->setEnabled(enable);
index 9808217b9f38a5945b3ac3331f58be284f12fc8e..c3d6c8c39d259bc651dbcaa4ee3e3d4dc02a6cab 100644 (file)
@@ -1,3 +1,14 @@
+2001-03-09  John Levon  <moz@compsoc.man.ac.uk>
+
+       * Makefile.am:
+       * Dialogs.C:
+       * FormExternal.C:
+       * FormExternal.h:
+       * form_external.C:
+       * form_external.h:
+       * xforms/forms/makefile:
+       * forms/form_external.fd: add FormExternal
+
 2001-03-12  Lars Gullik Bjønnes  <larsbj@trylle.birdstep.com>
 
        * FormToc.h: use Buffer::typedef
index 1a177293298b0dfdbaf0ac9fb01c5834bdc6af30..7aa1eb11975219092ec79d883606b428290060bc 100644 (file)
@@ -20,6 +20,7 @@
 #include "FormCredits.h"
 #include "FormDocument.h"
 #include "FormError.h"
+#include "FormExternal.h" 
 #include "FormGraphics.h"
 #include "FormInclude.h"
 #include "FormIndex.h"
@@ -58,6 +59,7 @@ Dialogs::Dialogs(LyXView * lv)
        dialogs_.push_back(new FormCredits(lv, this));
        dialogs_.push_back(new FormDocument(lv, this));
        dialogs_.push_back(new FormError(lv, this));
+       dialogs_.push_back(new FormExternal(lv, this)); 
        dialogs_.push_back(new FormGraphics(lv, this));
        dialogs_.push_back(new FormInclude(lv, this));
        dialogs_.push_back(new FormIndex(lv, this));
index 3d781b1b590732a52290d5a477661b1963366134..b64ce5da37f7202b3b09dd73edad2fbf7c27b04f 100644 (file)
@@ -357,8 +357,9 @@ void FormGraphics::browse()
        string const filename = fl_get_input(dialog_->input_filename);
 
        string const title = N_("Graphics");
-       // we need the second '|' to prevent mis-interpretation 
-       string const pattern = "*.(ps|png)|";
+       // FIXME: currently we need the second '|' to prevent mis-interpretation 
+       // FIXME: rfind() in split() seems to be broken hence the second space 
+       string const pattern = "*.(ps|png)| ";
 
        // Does user clipart directory exist?
        string clipdir = AddName (user_lyxdir, "clipart");
index 4a18c9462362186d801415e0bed7edde059e2000..a5a2e9bdff8e9ba6aaf8c37463a3ca618a437a94 100644 (file)
@@ -61,6 +61,10 @@ libxforms_la_SOURCES = \
        FormError.h \
        form_error.C \
        form_error.h \
+       FormExternal.C \
+       FormExternal.h \
+       form_external.C \
+       form_external.h \
        FormGraphics.C \
        FormGraphics.h \
        form_graphics.C \
index 4987348d4dd86d3f15c335667d2ecb033b71e2aa..37b7f297ece3e97525dd14cefd5fb584d1a4b768 100644 (file)
@@ -25,6 +25,7 @@ SRCS := form_bibitem.fd \
        form_credits.fd \
        form_document.fd \
        form_error.fd \
+       form_external.fd \
        form_filedialog.fd \
        form_graphics.fd \
        form_include.fd \
index 1523dcfffaa1b682f540ab641d5579e6dae09836..11d84bbd92588887db1b4e12bd08c712456467b3 100644 (file)
@@ -1,3 +1,15 @@
+2001-03-12  Angus Leeming  <a.leeming@ic.ac.uk>
+
+       * ExternalTemplate.C (read): the reading of external insets now checks
+       for \end_inset and removes it form the input stream.
+
+2001-03-09  John Levon  <moz@compsoc.man.ac.uk>
+
+       * ExternalTemplate.h:
+       * ExternalTemplate.C:
+       * insetexternal.h:
+       * insetexternal.C: move form to GUII
+
 2001-03-12  Lars Gullik Bjønnes  <larsbj@trylle.birdstep.com>
 
        * insettoc.C (Ascii): use the Buffer typedefs
index 15b8fecc11d05af3153503e0e303cda528f2aa56..960a829260f3cb7f19518a62c6ed255f1db82246 100644 (file)
@@ -129,6 +129,12 @@ ExternalTemplateManager::getTemplates() const
 }
 
 
+ExternalTemplate const & ExternalTemplateManager::getTemplateByName(string const & name)
+{
+       return templates[name];
+}
+
 void ExternalTemplateManager::readTemplates(string const & path) 
 {
        Path p(path);
index d643f5d4837b9645861d3bdc301ad4a7347c024e..c02cd865a1e5b78b00399a145b0eb862711fe812 100644 (file)
@@ -76,10 +76,12 @@ class ExternalTemplateManager : public noncopyable {
 public:
        /// Map from the LyX name of the template to the template structure
        typedef std::map<string, ExternalTemplate> Templates;
-       
+
        static ExternalTemplateManager & get();
        Templates & getTemplates();
        Templates const & getTemplates() const;
+       /// return the template by LyX name 
+       ExternalTemplate const & getTemplateByName(const string & name);
 private:
        ExternalTemplateManager();
        void readTemplates(string const & path);
@@ -88,4 +90,3 @@ private:
 };
 
 #endif
-
index 8bddd24839475b7739521ebcb7adee7f3aa7fe70..1d22fd9931dee040e2541c3e39e431fb9102977d 100644 (file)
@@ -1,8 +1,8 @@
 /* This file is part of
  * ======================================================
- * 
+ *
  *           LyX, The Document Processor
- *      
+ *     
  *         Copyright 1995 Matthias Ettrich
  *          Copyright 1995-2000 The LyX Team.
  *
 #pragma implementation
 #endif
 
-#include FORMS_H_LOCATION
 #include <cstdio>
-#include <utility> 
+#include <utility>
 
 #include "insetexternal.h"
 #include "ExternalTemplate.h"
-#include "lyx_gui_misc.h" // CancelCloseBoxCB
 #include "BufferView.h"
 #include "buffer.h"
-#include "frontends/FileDialog.h"
+#include "LyXView.h"
+#include "frontends/Dialogs.h"
 #include "lyx_main.h"
 #include "LaTeXFeatures.h"
 #include "support/filetools.h"
 #include "support/lstrings.h"
 #include "support/path.h"
 #include "support/syscall.h"
-#include "frontends/Dialogs.h" // redrawGUI
 
 #ifdef SIGC_CXX_NAMESPACES
 using SigC::slot;
 #endif
 
 using std::endl;
-using std::pair;
-using std::make_pair; 
 
 InsetExternal::InsetExternal() 
-       : form_external(0)
+       : view(0)
 {
        tempname = lyx::tempName(string(), "lyxext");
-       r_ = Dialogs::redrawGUI.connect(slot(this, &InsetExternal::redraw));
+       ExternalTemplateManager::Templates::const_iterator i1;
+       params_.templ = ExternalTemplateManager::get().getTemplates().begin()->second;
 }
 
 
 InsetExternal::~InsetExternal()
 {
        lyx::unlink(tempname);
-       r_.disconnect();
-}
-
-
-void InsetExternal::redraw()
-{
-       if (form_external && form_external->form_external->visible)
-               fl_redraw_form(form_external->form_external);
-}
-
-
-extern "C"
-void ExternalTemplateCB(FL_OBJECT * ob, long data)
-{
-       InsetExternal::templateCB(ob, data);
-}
-
-
-extern "C"
-void ExternalBrowseCB(FL_OBJECT * ob, long data)
-{
-       InsetExternal::browseCB(ob, data);
-}
-
-
-extern "C"
-void ExternalEditCB(FL_OBJECT * ob, long data)
-{
-       InsetExternal::editCB(ob, data);
+       hideDialog();
 }
 
 
-extern "C"
-void ExternalViewCB(FL_OBJECT * ob, long data)
+InsetExternal::InsetExternalParams InsetExternal::params() const
 {
-       InsetExternal::viewCB(ob, data);
-}
-
-
-extern "C"
-void ExternalUpdateCB(FL_OBJECT * ob, long data)
-{
-       InsetExternal::updateCB(ob, data);
-}
-
-
-extern "C"
-void ExternalOKCB(FL_OBJECT * ob, long data)
-{
-       InsetExternal::okCB(ob, data);
-}
-
-
-extern "C"
-void ExternalCancelCB(FL_OBJECT * ob, long data)
-{
-       InsetExternal::cancelCB(ob, data);
-}
-
-
-void InsetExternal::templateCB(FL_OBJECT * ob, long)
-{
-       Holder * holder = static_cast<Holder*>(ob->form->u_vdata);
-       InsetExternal * inset = holder->inset;
-       ExternalTemplate et = inset->getTemplate(inset->getCurrentTemplate());
-       // Update the help text
-       fl_clear_browser(inset->form_external->helptext);
-       fl_addto_browser(inset->form_external->helptext, et.helpText.c_str());
-       fl_set_browser_topline(inset->form_external->helptext, 0);
-}
-
-
-void InsetExternal::browseCB(FL_OBJECT * ob, long)
-{
-       Holder * holder = static_cast<Holder*>(ob->form->u_vdata);
-       InsetExternal * inset = holder->inset;
-
-       static string current_path;
-       static int once = 0;
-       
-       string p = inset->filename;
-       string buf = MakeAbsPath(holder->view->buffer()->fileName());
-       string buf2 = OnlyPath(buf);
-       if (!p.empty()) {
-               buf = MakeAbsPath(p, buf2);
-               buf = OnlyPath(buf);
-       } else {
-               buf = OnlyPath(holder->view->buffer()->fileName());
-       }
-       
-       FileDialog fileDlg(holder->view->owner(), _("Select external file"),
-               LFUN_SELECT_FILE_SYNC,
-               make_pair(string(_("Document")), string(buf)));
-       
-       // FIXME: should have "nice name" for file type e.g. "Xfig files"
-
-       /// Determine the template file extension
-       ExternalTemplate et = inset->getTemplate(inset->getCurrentTemplate());
-       string regexp = et.fileRegExp;
-       if (regexp.empty()) {
-               regexp = "*";
-       }
-
-       regexp += "|";
-
-       bool error = false;
-       do {
-               string const path = (once) ? current_path : buf;
-               FileDialog::Result result = fileDlg.Select(path, regexp);
-
-               if (result.second.empty()) 
-                       return;
-
-               string p = result.second;
-
-               buf = MakeRelPath(p, buf2);
-               current_path = OnlyPath(p);
-               once = 1;
-               
-               if (contains(p, "#") || contains(p, "~") || contains(p, "$")
-                   || contains(p, "%")) {
-                       WriteAlert(_("Filename can't contain any "
-                                    "of these characters:"),
-                                  // xgettext:no-c-format
-                                  _("'#', '~', '$' or '%'.")); 
-                       error = true;
-               }
-       } while (error);
-
-       if (inset->form_external) 
-               fl_set_input(inset->form_external->filename, buf.c_str());
-       
-}
-
-
-void InsetExternal::editCB(FL_OBJECT * ob, long)
-{
-       Holder * holder = static_cast<Holder*>(ob->form->u_vdata);
-       InsetExternal * inset = holder->inset;
-       inset->doApply(holder->view);
-       inset->doEdit(holder->view);
-}
-
-
-void InsetExternal::viewCB(FL_OBJECT * ob, long)
-{
-       Holder * holder = static_cast<Holder*>(ob->form->u_vdata);
-       InsetExternal * inset = holder->inset;
-       inset->doApply(holder->view);
-       inset->doView(holder->view);
-}
-
-
-void InsetExternal::updateCB(FL_OBJECT * ob, long)
-{
-       Holder * holder = static_cast<Holder*>(ob->form->u_vdata);
-       InsetExternal * inset = holder->inset;
-       inset->doApply(holder->view);
-       inset->doUpdate(holder->view);
-}
-
-
-void InsetExternal::okCB(FL_OBJECT * ob, long data)
-{
-       Holder * holder = static_cast<Holder*>(ob->form->u_vdata);
-       InsetExternal * inset = holder->inset;
-       inset->doApply(holder->view);
-       cancelCB(ob,data);
-}
-
-
-void InsetExternal::doApply(BufferView * bufview)
-{
-       bool update = false;
-       if (templatename != getCurrentTemplate()) {
-               templatename = getCurrentTemplate();
-               update = true;
-       }
-       if (filename != fl_get_input(form_external->filename)) {
-               filename = fl_get_input(form_external->filename);
-               update = true;
-       }
-       if (parameters != fl_get_input(form_external->parameters)) {
-               parameters = fl_get_input(form_external->parameters);
-               update = true;
-       }
-
-       if (update) {
-               // The text might have change,
-               // so we should update the button look
-               bufview->updateInset(this, true);
-       }
+       return params_;
 }
-
-
-void InsetExternal::cancelCB(FL_OBJECT * ob, long)
+void InsetExternal::setFromParams(InsetExternalParams const & p)
 {
-       Holder * holder = static_cast<Holder*>(ob->form->u_vdata);
-
-       InsetExternal * inset = holder->inset;
-       // BufferView * bv = holder->view;
-
-       if (inset->form_external) {
-               fl_hide_form(inset->form_external->form_external);
-               fl_free_form(inset->form_external->form_external);
-               inset->form_external = 0;
-       }
-}
+       params_.filename = p.filename;
+       params_.parameters = p.parameters;
+       params_.templ = p.templ;
+}      
 
 
 string const InsetExternal::EditMessage() const
 {
-       ExternalTemplate const & et = getTemplate(templatename);
-       return doSubstitution(0, et.guiName);
+       return doSubstitution(0, params_.templ.guiName);
 }
 
 
 void InsetExternal::Edit(BufferView * bv,
                         int /*x*/, int /*y*/, unsigned int /*button*/)
 {
-       static int ow = -1, oh;
-
-       if (bv->buffer()->isReadonly())
-               WarnReadonly(bv->buffer()->fileName());
-
-       if (!form_external) {
-               form_external = create_form_form_external();
-               holder.inset = this;
-               //              form_external->ok->u_vdata = &holder;
-               form_external->form_external->u_vdata = &holder;
-               fl_set_form_atclose(form_external->form_external,
-                                   CancelCloseBoxCB, 0);
-       }
-       holder.view = bv;
-       fl_addto_choice(form_external->templatechoice,
-                       getTemplateString().c_str());
-       fl_set_input(form_external->filename, filename.c_str());
-       fl_set_input(form_external->parameters, parameters.c_str());
-       if (!templatename.empty()) {
-               fl_set_choice(form_external->templatechoice,
-                             getTemplateNumber(templatename));
-       }
-       // Update the help text
-       templateCB(form_external->templatechoice, 0);
-
-       ExternalTemplate const & et = getTemplate(templatename);
-       if (et.automaticProduction) {
-               fl_deactivate_object(form_external->update);
-               fl_set_object_lcol(form_external->update, FL_INACTIVE);
-       } else {
-               fl_activate_object(form_external->update);
-               fl_set_object_lcol(form_external->update, FL_BLACK);
-       }
-
-       if (form_external->form_external->visible) {
-               fl_raise_form(form_external->form_external);
-       } else {
-               fl_show_form(form_external->form_external,
-                            FL_PLACE_MOUSE | FL_FREE_SIZE, FL_TRANSIENT,
-                            _("Insert external inset"));
-               if (ow < 0) {
-                       ow = form_external->form_external->w;
-                       oh = form_external->form_external->h;
-               }
-               fl_set_form_minsize(form_external->form_external, ow, oh);
-       }
+       view = bv;
+       view->owner()->getDialogs()->showExternal(this);
 }
 
 
 void InsetExternal::Write(Buffer const *, std::ostream & os) const
 {
-       os << "External " << templatename << ",\"" << filename 
-          << "\",\"" << parameters << "\"\n";
+       os << "External " << params_.templ.lyxName << ",\"" << params_.filename 
+          << "\",\"" << params_.parameters << "\"\n";
 }
 
 
 void InsetExternal::Read(Buffer const *, LyXLex & lex)
 {
-       lex.EatLine();
-       string const format = lex.GetString();
+       string format;
+       string token;
+
+       // Read inset data from lex and store in format
+       if (lex.EatLine()) {
+               format = lex.GetString();
+       } else
+               lex.printError("InsetExternal: Parse error: `$$Token'");
+       while (lex.IsOK()) {
+               lex.nextToken();
+               token = lex.GetString();
+               if (token == "\\end_inset")
+                       break;
+       }
+       if (token != "\\end_inset") {
+               lex.printError("Missing \\end_inset at this point. "
+                              "Read: `$$Token'");
+       }
+
+       // Parse string format...
        string::size_type const pos1 = format.find(",");
-       templatename = format.substr(0, pos1);
+       params_.templ = ExternalTemplateManager::get().getTemplateByName(format.substr(0, pos1));
        string::size_type const pos2 = format.find("\",\"", pos1);
-       filename = format.substr(pos1 + 2, pos2 - (pos1 + 2));
-       parameters = format.substr(pos2 + 3, format.length() - (pos2 + 4));
+       params_.filename = format.substr(pos1 + 2, pos2 - (pos1 + 2));
+       params_.parameters = format.substr(pos2 + 3, format.length() - (pos2 + 4));
 
-       lyxerr[Debug::INFO] << "InsetExternal::Read: " << templatename
-                           << " " << filename
-                           << " " << parameters << endl;
+       lyxerr[Debug::INFO] << "InsetExternal::Read: " << params_.templ.lyxName
+                           << " " << params_.filename
+                           << " " << params_.parameters << endl;
 }
 
 
 int InsetExternal::write(string const & format,
                         Buffer const * buf, std::ostream & os) const
 {
-       ExternalTemplate const & et = getTemplate(templatename);
+       ExternalTemplate const & et = params_.templ;
        ExternalTemplate::Formats::const_iterator cit =
                et.formats.find(format);
        if (cit == et.formats.end()) {
                lyxerr << "External template format '" << format
-                      << "' not specified in template " << templatename
+                      << "' not specified in template " << params_.templ.lyxName
                       << endl;
                return 0;
        }
@@ -363,7 +141,7 @@ int InsetExternal::write(string const & format,
        }
        
        os << doSubstitution(buf, (*cit).second.product);
-       return 0; // CHECK
+       return 0; // CHECK  (FIXME check what ? - jbl)
 }
 
 
@@ -394,12 +172,12 @@ int InsetExternal::DocBook(Buffer const * buf, std::ostream & os) const
 
 void InsetExternal::Validate(LaTeXFeatures & features) const
 {
-       ExternalTemplate const & et = getTemplate(templatename);
+       ExternalTemplate const & et = params_.templ;
        ExternalTemplate::Formats::const_iterator cit =
                et.formats.find("LaTeX");
-       if (cit == et.formats.end()) {
+
+       if (cit == et.formats.end())
                return;
-       }
        
        if (!(*cit).second.requirement.empty()) {
                features.require((*cit).second.requirement);
@@ -413,56 +191,18 @@ void InsetExternal::Validate(LaTeXFeatures & features) const
 Inset * InsetExternal::Clone(Buffer const &) const
 {
        InsetExternal * inset = new InsetExternal();
-       inset->templatename = templatename;
-       inset->filename = filename;
-       inset->parameters = parameters;
+       inset->params_ = params_;
        return inset;
 }
 
 
 string const InsetExternal::getScreenLabel() const
 {
-       if (templatename.empty()) {
+       ExternalTemplate const & et = params_.templ;
+       if (et.guiName.empty())
                return _("External");
-       } else {
-               ExternalTemplate const & et = getTemplate(templatename);
-               if (et.guiName.empty())
-                       return "ext: ???";
-               else
-                       return doSubstitution(0, et.guiName);
-       }
-}
-
-
-void InsetExternal::doUpdate(BufferView const * bv) const
-{
-       ExternalTemplate const & et = getTemplate(getCurrentTemplate());
-       ExternalTemplate::Formats::const_iterator cit =
-               et.formats.find("LaTeX");
-       if (cit == et.formats.end())
-               return;
-       
-       executeCommand(doSubstitution(bv->buffer(),
-                                     (*cit).second.updateCommand),
-                      bv->buffer());
-}
-
-
-void InsetExternal::doView(BufferView const * bv) const
-{
-       automaticUpdate(bv);
-       ExternalTemplate const & et = getTemplate(getCurrentTemplate());
-       executeCommand(doSubstitution(bv->buffer(), et.viewCommand),
-                      bv->buffer());
-}
-
-
-void InsetExternal::doEdit(BufferView const * bv) const
-{
-       automaticUpdate(bv);
-       ExternalTemplate const & et = getTemplate(getCurrentTemplate());
-       executeCommand(doSubstitution(bv->buffer(), et.editCommand),
-                      bv->buffer());
+       else
+               return doSubstitution(0, et.guiName);
 }
 
 
@@ -481,23 +221,14 @@ void InsetExternal::executeCommand(string const & s,
 }
 
 
-void InsetExternal::automaticUpdate(BufferView const * bv) const
-{
-       ExternalTemplate const & et = getTemplate(templatename);
-       if (et.automaticProduction) {
-               doUpdate(bv);
-       }
-}
-
-
 string const InsetExternal::doSubstitution(Buffer const * buffer,
                                     string const & s) const
 {
        string result;
-       string const basename = ChangeExtension(filename, string());
-       result = subst(s, "$$FName", filename);
+       string const basename = ChangeExtension(params_.filename, string());
+       result = subst(s, "$$FName", params_.filename);
        result = subst(result, "$$Basename", basename);
-       result = subst(result, "$$Parameters", parameters);
+       result = subst(result, "$$Parameters", params_.parameters);
        result = ReplaceEnvironmentPath(result);
        result = subst(result, "$$Tempname", tempname);
        result = subst(result, "$$Sysdir", system_lyxdir);
@@ -527,70 +258,39 @@ string const InsetExternal::doSubstitution(Buffer const * buffer,
 }
 
 
-string const InsetExternal::getCurrentTemplate() const
+void InsetExternal::updateExternal() const
 {
-       return getTemplateName(fl_get_choice(form_external->templatechoice));
+       ExternalTemplate const & et = params_.templ;
+       ExternalTemplate::Formats::const_iterator cit =
+               et.formats.find("LaTeX");
+       if (cit == et.formats.end())
+               return;
+       
+       executeCommand(doSubstitution(view->buffer(),
+                       (*cit).second.updateCommand),
+                       view->buffer());
 }
 
 
-ExternalTemplate const InsetExternal::getTemplate(string const & name) const
+void InsetExternal::viewExternal() const
 {
-       ExternalTemplateManager::Templates::iterator i = 
-               ExternalTemplateManager::get().getTemplates().find(name);
-       // Make sure that the template exists in the map
-       if (i == ExternalTemplateManager::get().getTemplates().end()) {
-               lyxerr << "Unknown external material template: "
-                      << name << endl;
-               return ExternalTemplate();
-       }
-       return (*i).second;
-}
-
+       ExternalTemplate const & et = params_.templ;
+       if (et.automaticProduction)
+               updateExternal();
 
-int InsetExternal::getTemplateNumber(string const & name) const
-{
-       int i = 1;
-       ExternalTemplateManager::Templates::const_iterator i1, i2;
-       i1 = ExternalTemplateManager::get().getTemplates().begin();
-       i2 = ExternalTemplateManager::get().getTemplates().end();
-       for (; i1 != i2; ++i1) {
-               if ((*i1).second.lyxName == name)
-                       return i;
-               ++i;
-       }
-       // This should never happen
-       ///  This can happen if someone sends you a lyx file that uses
-       ///  external templates that are defined only on his machine
-       //Assert(false);
-       return 0;
+       executeCommand(doSubstitution(view->buffer(),
+                       et.viewCommand),
+                       view->buffer());
 }
 
 
-string const InsetExternal::getTemplateName(int i) const
+void InsetExternal::editExternal() const
 {
-       ExternalTemplateManager::Templates::const_iterator i1;
-       i1 = ExternalTemplateManager::get().getTemplates().begin();
-       for (int n = 1; n < i; ++n) {
-               ++i1;
-       }
-       return (*i1).second.lyxName;
-}
-
+       ExternalTemplate const & et = params_.templ;
+       if (et.automaticProduction)
+               updateExternal();
 
-string const InsetExternal::getTemplateString() const
-{
-       string result;
-       bool first = true;
-       ExternalTemplateManager::Templates::const_iterator i1, i2;
-       i1 = ExternalTemplateManager::get().getTemplates().begin();
-       i2 = ExternalTemplateManager::get().getTemplates().end();
-       for (; i1 != i2; ++i1) {
-               if (!first) {
-                       result += "|";
-               } else {
-                       first = false;
-               }
-               result += (*i1).second.lyxName;
-       }
-       return result;
+       executeCommand(doSubstitution(view->buffer(),
+                       et.editCommand),
+                       view->buffer());
 }
index 565316d2f2b2297f5743478f5069b563ef2c6060..278ad8a8275df008016364bc5d2573439034c01e 100644 (file)
@@ -1,9 +1,9 @@
 // -*- C++ -*-
 /* This file is part of*
- * ====================================================== 
+ * ======================================================
  *
  *           LyX, The Document Processor
- *      
+ *     
  *           Copyright 1995 Matthias Ettrich
  *           Copyright 1995-2000 The LyX Team.
  *
 #endif
 
 #include "insetbutton.h"
+#include "ExternalTemplate.h"
 #include "LString.h"
-#include "../lyx.h"
 #include <sigc++/signal_system.h>
 
-struct ExternalTemplate;
-
 #ifdef SIGC_CXX_NAMESPACES
-using SigC::Object;
-using SigC::Connection;
+using SigC::Signal0;
 #endif
 
 ///
-class InsetExternal : public InsetButton, public Object {
+class InsetExternal : public InsetButton {
 public:
+       /// hold parameters settable from the GUI
+       struct InsetExternalParams {
+               InsetExternalParams(string const & f = string(), 
+                                       string const & p = string(), 
+                                       ExternalTemplate const & t = ExternalTemplate())
+                       : filename(f), parameters(p), templ(t) {}
+               /// the filename
+               string filename;
+               /// the parameters of the current choice
+               string parameters;
+               /// the current template used
+               ExternalTemplate templ;
+       };
+
        InsetExternal();
        ///
        virtual ~InsetExternal();
@@ -44,6 +55,7 @@ public:
        virtual void Write(Buffer const *, std::ostream &) const;
        ///
        virtual void Read(Buffer const *, LyXLex & lex);
+
        /** returns the number of rows (\n's) of generated tex code.
         fragile == true means, that the inset should take care about
         fragile commands by adding a \protect before.
@@ -52,118 +64,64 @@ public:
         */
        virtual int Latex(Buffer const *, std::ostream &, bool fragile,
                          bool free_spc) const;
-       ///
+       /// write ASCII output to the ostream
        virtual int Ascii(Buffer const *, std::ostream &, int linelen) const;
-       ///
+       /// write LinuxDoc output to the ostream
        virtual int Linuxdoc(Buffer const *, std::ostream &) const;
-       ///
+       /// write DocBook output to the ostream
        virtual int DocBook(Buffer const *, std::ostream &) const;
+
        /// Updates needed features for this inset.
        virtual void Validate(LaTeXFeatures & features) const;
 
        /// returns LyX code associated with the inset. Used for TOC, ...)
        virtual Inset::Code LyxCode() const { return EXTERNAL_CODE; }
-  
        ///
        virtual Inset * Clone(Buffer const &) const;
 
        /// returns the text of the button
        virtual string const getScreenLabel() const;
 
-       /// Callback function for the template drop-down
-       static void templateCB(FL_OBJECT *, long);
+       // The following public members are used from the frontends code
 
-       /// Callback function for the browse button
-       static void browseCB(FL_OBJECT *, long);
+       /// set the parameters from a Params structure
+       virtual void setFromParams(InsetExternalParams const &);
 
-       /// Callback function for the edit button
-       static void editCB(FL_OBJECT *, long);
+       /// update the file represented by the template
+       void updateExternal() const;
 
-       /// Callback function for the view button
-       static void viewCB(FL_OBJECT *, long);
+       /// edit file of this template
+       void editExternal() const;
 
-       /// Callback function for the update production button
-       static void updateCB(FL_OBJECT *, long);
+       /// view file of this template
+       void viewExternal() const;
 
-       /// Callback function for the ok button
-       static void okCB(FL_OBJECT *, long);
+       /// return a copy of our current params
+       InsetExternalParams params() const;
 
-       /// Callback function for the cancel button
-       static void cancelCB(FL_OBJECT *, long);
-private:
-       /** Redraw the form (on receipt of a Signal indicating, for example,
-           that the xform colors have been re-mapped).
-       */
-       void redraw();
+       /// hide connection
+       Signal0<void> hideDialog;
 
+private:
        /// Write the output for a specific file format
        int write(string const & format, Buffer const *,
                  std::ostream &) const;
 
-       /// Apply the changes
-       void doApply(BufferView * bv);
-
        /// Execute this command in the directory of this document
        void executeCommand(string const & s, Buffer const * buf) const;
 
-       /// Update if automatic
-       void automaticUpdate(BufferView const *) const;
-
-       /// Do update
-       void doUpdate(BufferView const *) const;
-       /// Do edit
-       void doEdit(BufferView const *) const;
-       /// Do view
-       void doView(BufferView const *) const;
-
        /// Substitute meta-variables in this string
        string const doSubstitution(Buffer const *, string const & s) const;
 
-       /** Get the LyX name of the currently selected
-           template in the choice list
-       */
-       string const getCurrentTemplate() const;
-
-       /// Get a certain template from a LyX name
-       ExternalTemplate const getTemplate(string const & lyxname) const;
+       /// our owning view
+       BufferView * view;
 
-       /**
-         Get the number starting from 1 of a template with a 
-         specific LyX name for the choice list
-        */
-       int getTemplateNumber(string const & guiname) const;
-
-       /// Get the LyX name of a template with a given number starting from 1
-       string const getTemplateName(int n) const;
-
-       /// Get a string with all the GUI template names separated by |
-       string const getTemplateString() const;
-
-       ///
-       struct Holder {
-               InsetExternal * inset;
-               BufferView * view;
-       };
-       ///
-       Holder holder;
-
-       /// The external inset form
-       FD_form_external * form_external;
-
-       ///
-       string templatename;
-
-       ///
-       string filename;
-
-       ///
-       string parameters;
+       /// the current params
+       InsetExternalParams params_;
 
        /// A temp filename
        string tempname;
-
-       /// Redraw connection.
-       Connection r_;
 };
 
 #endif
index 2e79c1fc945a96d6af694afd00bfc2e09aeca3fc..5253dd96e11ed36b11db42cadd07c6a431fe98b2 100644 (file)
--- a/src/lyx.C
+++ b/src/lyx.C
@@ -45,62 +45,3 @@ FD_form_figure *create_form_form_figure(void)
 
   return fdui;
 }
-/*---------------------------------------*/
-
-FD_form_external *create_form_form_external(void)
-{
-  FL_OBJECT *obj;
-  FD_form_external *fdui = (FD_form_external *) fl_calloc(1, sizeof(FD_form_external));
-
-  fdui->form_external = fl_bgn_form(FL_NO_BOX, 560, 310);
-  obj = fl_add_box(FL_UP_BOX, 0, 0, 560, 310, "");
-  fdui->templatechoice = obj = fl_add_choice(FL_NORMAL_CHOICE, 130, 10, 300, 30, idex(_("Template|#t")));fl_set_button_shortcut(obj, scex(_("Template|#t")), 1);
-    fl_set_object_boxtype(obj, FL_FRAME_BOX);
-    fl_set_object_lsize(obj, FL_NORMAL_SIZE);
-    fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast);
-    fl_set_object_callback(obj, ExternalTemplateCB, 0);
-  fdui->filename = obj = fl_add_input(FL_NORMAL_INPUT, 130, 190, 190, 30, idex(_("File|#F")));fl_set_button_shortcut(obj, scex(_("File|#F")), 1);
-    fl_set_object_lsize(obj, FL_NORMAL_SIZE);
-    fl_set_object_gravity(obj, FL_SouthWest, FL_SouthEast);
-  fdui->filenamebrowse = obj = fl_add_button(FL_NORMAL_BUTTON, 330, 190, 100, 30, idex(_("Browse...|#B")));fl_set_button_shortcut(obj, scex(_("Browse...|#B")), 1);
-    fl_set_object_lsize(obj, FL_NORMAL_SIZE);
-    fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast);
-    fl_set_object_callback(obj, ExternalBrowseCB, 0);
-  fdui->parameters = obj = fl_add_input(FL_NORMAL_INPUT, 130, 230, 300, 30, idex(_("Parameters|#P")));fl_set_button_shortcut(obj, scex(_("Parameters|#P")), 1);
-    fl_set_object_lsize(obj, FL_NORMAL_SIZE);
-    fl_set_object_gravity(obj, FL_SouthWest, FL_SouthEast);
-  fdui->edit = obj = fl_add_button(FL_NORMAL_BUTTON, 435, 50, 110, 30, idex(_("Edit file|#E")));fl_set_button_shortcut(obj, scex(_("Edit file|#E")), 1);
-    fl_set_object_color(obj, FL_COL1, FL_BLACK);
-    fl_set_object_lsize(obj, FL_NORMAL_SIZE);
-    fl_set_object_gravity(obj, FL_NorthEast, FL_NorthEast);
-    fl_set_object_callback(obj, ExternalEditCB, 0);
-  fdui->view = obj = fl_add_button(FL_NORMAL_BUTTON, 435, 90, 110, 30, idex(_("View result|#V")));fl_set_button_shortcut(obj, scex(_("View result|#V")), 1);
-    fl_set_object_color(obj, FL_COL1, FL_BLACK);
-    fl_set_object_lsize(obj, FL_NORMAL_SIZE);
-    fl_set_object_gravity(obj, FL_NorthEast, FL_NorthEast);
-    fl_set_object_callback(obj, ExternalViewCB, 0);
-  fdui->update = obj = fl_add_button(FL_NORMAL_BUTTON, 435, 130, 110, 30, idex(_("Update result|#U")));fl_set_button_shortcut(obj, scex(_("Update result|#U")), 1);
-    fl_set_object_color(obj, FL_COL1, FL_BLACK);
-    fl_set_object_lsize(obj, FL_NORMAL_SIZE);
-    fl_set_object_gravity(obj, FL_NorthEast, FL_NorthEast);
-    fl_set_object_callback(obj, ExternalUpdateCB, 0);
-  fdui->ok = obj = fl_add_button(FL_RETURN_BUTTON, 315, 270, 110, 30, _("OK"));
-    fl_set_object_color(obj, FL_COL1, FL_BLACK);
-    fl_set_object_lsize(obj, FL_NORMAL_SIZE);
-    fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast);
-    fl_set_object_callback(obj, ExternalOKCB, 0);
-  fdui->cancel = obj = fl_add_button(FL_NORMAL_BUTTON, 435, 270, 110, 30, idex(_("Cancel|#C^[")));fl_set_button_shortcut(obj, scex(_("Cancel|#C^[")), 1);
-    fl_set_object_lsize(obj, FL_NORMAL_SIZE);
-    fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast);
-    fl_set_object_callback(obj, ExternalCancelCB, 0);
-  fdui->helptext = obj = fl_add_browser(FL_NORMAL_BROWSER, 130, 50, 300, 130, "");
-    fl_set_object_lalign(obj, FL_ALIGN_TOP);
-    fl_set_object_gravity(obj, FL_NorthWest, FL_SouthEast);
-  fl_end_form();
-
-  fdui->form_external->fdui = fdui;
-
-  return fdui;
-}
-/*---------------------------------------*/
-
index 9172685e08d51fd90737aa5d398ea6284086a109..534f9c927a1b180a65dc3c93b1c6d12c5ebbf139 100644 (file)
--- a/src/lyx.h
+++ b/src/lyx.h
@@ -8,15 +8,6 @@ extern "C" void FigureOKCB(FL_OBJECT *, long);
 extern "C" void FigureApplyCB(FL_OBJECT *, long);
 extern "C" void FigureCancelCB(FL_OBJECT *, long);
 
-extern "C" void ExternalTemplateCB(FL_OBJECT *, long);
-extern "C" void ExternalBrowseCB(FL_OBJECT *, long);
-extern "C" void ExternalEditCB(FL_OBJECT *, long);
-extern "C" void ExternalViewCB(FL_OBJECT *, long);
-extern "C" void ExternalUpdateCB(FL_OBJECT *, long);
-extern "C" void ExternalOKCB(FL_OBJECT *, long);
-extern "C" void ExternalCancelCB(FL_OBJECT *, long);
-
-
 /**** Forms and Objects ****/
 typedef struct {
        FL_FORM *form_figure;
@@ -29,23 +20,5 @@ typedef struct {
 } FD_form_figure;
 
 extern FD_form_figure * create_form_form_figure(void);
-typedef struct {
-       FL_FORM *form_external;
-       void *vdata;
-       char *cdata;
-       long  ldata;
-       FL_OBJECT *templatechoice;
-       FL_OBJECT *filename;
-       FL_OBJECT *filenamebrowse;
-       FL_OBJECT *parameters;
-       FL_OBJECT *edit;
-       FL_OBJECT *view;
-       FL_OBJECT *update;
-       FL_OBJECT *ok;
-       FL_OBJECT *cancel;
-       FL_OBJECT *helptext;
-} FD_form_external;
-
-extern FD_form_external * create_form_form_external(void);
 
 #endif /* FD_form_title_h_ */