From c9dbe4fd82bf88c1b8c8abb7be24f86c6ec25e3f Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Tue, 24 Oct 2000 13:13:59 +0000 Subject: [PATCH] Cleanup patches for xforms (Angus) and KDE (John) git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1148 a592a061-630c-0410-9148-cb99ea01b6c8 --- ChangeLog | 79 +- po/POTFILES.in | 2 + src/buffer.C | 1 - src/frontends/DialogBase.h | 4 +- src/frontends/kde/copyrightdlgdata.C | 3 +- src/frontends/kde/copyrightdlgdata.h | 2 +- src/frontends/kde/indexdlgdata.C | 5 +- src/frontends/kde/indexdlgdata.h | 2 +- src/frontends/kde/paraextradlgdata.C | 5 +- src/frontends/kde/paraextradlgdata.h | 2 +- src/frontends/kde/parageneraldlgdata.C | 17 +- src/frontends/kde/parageneraldlgdata.h | 2 +- src/frontends/kde/printdlgdata.C | 17 +- src/frontends/kde/printdlgdata.h | 2 +- src/frontends/xforms/Dialogs.C | 2 + src/frontends/xforms/FormBase.C | 2 +- src/frontends/xforms/FormBase.h | 6 +- src/frontends/xforms/FormCitation.C | 10 +- src/frontends/xforms/FormCitation.h | 2 +- src/frontends/xforms/FormDocument.C | 3 +- src/frontends/xforms/FormDocument.h | 2 +- src/frontends/xforms/FormError.C | 12 +- src/frontends/xforms/FormError.h | 2 +- src/frontends/xforms/FormGraphics.C | 224 ++--- src/frontends/xforms/FormGraphics.h | 86 +- src/frontends/xforms/FormIndex.C | 7 +- src/frontends/xforms/FormIndex.h | 2 +- src/frontends/xforms/FormInset.C | 17 +- src/frontends/xforms/FormInset.h | 5 +- src/frontends/xforms/FormParagraph.C | 3 +- src/frontends/xforms/FormParagraph.h | 2 +- src/frontends/xforms/FormPreferences.C | 3 +- src/frontends/xforms/FormPreferences.h | 2 +- src/frontends/xforms/FormPrint.C | 3 +- src/frontends/xforms/FormPrint.h | 2 +- src/frontends/xforms/FormRef.C | 7 +- src/frontends/xforms/FormRef.h | 2 +- src/frontends/xforms/FormTabular.C | 871 ++++++++---------- src/frontends/xforms/FormTabular.h | 133 +-- src/frontends/xforms/FormTabularCreate.C | 88 ++ src/frontends/xforms/FormTabularCreate.h | 56 ++ src/frontends/xforms/FormToc.C | 3 +- src/frontends/xforms/FormToc.h | 4 +- src/frontends/xforms/FormUrl.C | 7 +- src/frontends/xforms/FormUrl.h | 2 +- src/frontends/xforms/Makefile.am | 4 + src/frontends/xforms/form_graphics.C | 42 +- src/frontends/xforms/form_graphics.h | 9 +- src/frontends/xforms/form_tabular.C | 124 +-- src/frontends/xforms/form_tabular.h | 24 +- src/frontends/xforms/form_tabular_create.C | 54 ++ src/frontends/xforms/form_tabular_create.h | 25 + src/frontends/xforms/forms/fdfix.sh | 71 +- src/frontends/xforms/forms/form_graphics.fd | 78 +- src/frontends/xforms/forms/form_tabular.fd | 198 +--- .../xforms/forms/form_tabular_create.fd | 125 +++ src/frontends/xforms/forms/makefile | 1 + src/insets/insettabular.C | 25 +- src/insets/insettabular.h | 10 +- src/support/lstrings.h | 2 +- 60 files changed, 1220 insertions(+), 1285 deletions(-) create mode 100644 src/frontends/xforms/FormTabularCreate.C create mode 100644 src/frontends/xforms/FormTabularCreate.h create mode 100644 src/frontends/xforms/form_tabular_create.C create mode 100644 src/frontends/xforms/form_tabular_create.h create mode 100644 src/frontends/xforms/forms/form_tabular_create.fd diff --git a/ChangeLog b/ChangeLog index 51c8c2eb91..3975594503 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,56 @@ +2000-10-24 John Levon + + * src/frontends/kde/*data.[Ch]: _("") is not + allowed + +2000-10-24 Angus Leeming + + * src/buffer.C: removed redundant using directive. + + * src/frontends/DialogBase.h: revert to original definition of + update(). + + * src/frontends/xforms/Dialogs.C (c-tor): splitting the tabular + stuff into two classes, one for each dialog, requires a new + element in the dialogs vector, FormTabularCreate. + + * src/frontends/xforms/FormXXX.[Ch] (update): revert to original + definition. + + * src/frontends/xforms/FormBase.[Ch] (FormBaseBD::updateSlot): new + method. Continues Allan's idea, but means that derived classes + don't need to worry about "update or hide?". + + * src/frontends/xforms/FormError.C (showInset): add connection + again ;-) + + * src/frontends/xforms/FormTabular.[Ch]: split into two classes, + one for each dialog. FormTabular now contains main tabular dialog + only. + + * src/frontends/xforms/FormTabularCreate.[Ch]: + * src/frontends/xforms/forms/form_tabular_create.fd: the create + dialog. + + * src/frontends/xforms/FormGraphics.[Ch]: + * src/frontends/xforms/forms/form_graphics.fd + * src/frontends/xforms/FormTabular.[Ch]: + * src/frontends/xforms/forms/form_tabular.fd: made daughter + classes of FormInset. + + * src/frontends/xforms/forms/fdfix.sh: small fix. Can now create + class names properly. Eg, form_my_new_dialog -> FormMyNewDialog. + + * src/frontends/xforms/Makefile.am: + * src/frontends/xforms/forms/makefile: added new files. + + * src/insets/insettabular.[Ch]: removed (Dialogs *) member + variable. added Signal0 hide signal, in keeping with other GUI-I + insets. + + * src/support/lstrings.h: removed redundant std:: qualifier as + it's already declared in Lsstream.h. + 2000-10-23 Jean-Marc Lasgouttes * src/insets/figinset.C (GhostscriptMsg): use DisplayString() to @@ -90,23 +143,23 @@ 2000-10-18 Angus Leeming - * src/support/lstrings.C (lowercase, uppercase): - use explicit casts to remove compiler warnings. + * src/support/lstrings.C (lowercase, uppercase): + use explicit casts to remove compiler warnings. - * src/support/LRegex.C (Impl): - * src/support/StrPool.C (add): - * src/support/filetools.C (MakeAbsPath, NormalizePath, MakeRelPath) - (AddPath, MakeDisplayPath): - * src/support/lstrings.C (prefixIs, subst): - use correct type to remove compiler warnings. + * src/support/LRegex.C (Impl): + * src/support/StrPool.C (add): + * src/support/filetools.C (MakeAbsPath, NormalizePath, MakeRelPath) + (AddPath, MakeDisplayPath): + * src/support/lstrings.C (prefixIs, subst): + use correct type to remove compiler warnings. - * src/support/lstrings.[Ch] (countChar): returns string::size_type. + * src/support/lstrings.[Ch] (countChar): returns string::size_type. - * src/support/lyxlib.h: - * src/support/mkdir.C (mkdir): change parameter to mode_t for - portability and to remove compiler warning with DEC cxx. + * src/support/lyxlib.h: + * src/support/mkdir.C (mkdir): change parameter to mode_t for + portability and to remove compiler warning with DEC cxx. - * src/support/FileInfo.[Ch] (flagRWX): ditto. + * src/support/FileInfo.[Ch] (flagRWX): ditto. 2000-10-18 Jean-Marc Lasgouttes diff --git a/po/POTFILES.in b/po/POTFILES.in index 3a9041874f..814cab19bf 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -70,6 +70,8 @@ src/frontends/xforms/FormRef.C src/frontends/xforms/form_ref.C src/frontends/xforms/FormTabular.C src/frontends/xforms/form_tabular.C +src/frontends/xforms/FormTabularCreate.C +src/frontends/xforms/form_tabular_create.C src/frontends/xforms/FormToc.C src/frontends/xforms/form_toc.C src/frontends/xforms/FormUrl.C diff --git a/src/buffer.C b/src/buffer.C index 0cf6c642fe..c904567a4b 100644 --- a/src/buffer.C +++ b/src/buffer.C @@ -105,7 +105,6 @@ using std::pair; using std::vector; using std::max; using std::set; -using std::istringstream; // all these externs should eventually be removed. extern BufferList bufferlist; diff --git a/src/frontends/DialogBase.h b/src/frontends/DialogBase.h index 650df6a398..5ef76e4d14 100644 --- a/src/frontends/DialogBase.h +++ b/src/frontends/DialogBase.h @@ -50,8 +50,8 @@ public: virtual void show() = 0; /// virtual void hide() = 0; - /// Parameter defines if a buffer switch occurred - virtual void update(bool = false) = 0; + /// + virtual void update() = 0; //@} }; diff --git a/src/frontends/kde/copyrightdlgdata.C b/src/frontends/kde/copyrightdlgdata.C index 090421af34..d28a130063 100644 --- a/src/frontends/kde/copyrightdlgdata.C +++ b/src/frontends/kde/copyrightdlgdata.C @@ -3,7 +3,7 @@ --- Qt Architect generated file --- File: copyrightdlgdata.C - Last generated: Sat Oct 14 03:43:37 2000 + Last generated: Tue Oct 24 13:38:02 2000 DO NOT EDIT!!! This file will be automatically regenerated by qtarch. All changes will be lost. @@ -11,6 +11,7 @@ *********************************************************************/ #include + #include #include #include "copyrightdlgdata.h" diff --git a/src/frontends/kde/copyrightdlgdata.h b/src/frontends/kde/copyrightdlgdata.h index 2f5e97cf18..c16ca66b9c 100644 --- a/src/frontends/kde/copyrightdlgdata.h +++ b/src/frontends/kde/copyrightdlgdata.h @@ -3,7 +3,7 @@ --- Qt Architect generated file --- File: copyrightdlgdata.h - Last generated: Sat Oct 14 03:43:37 2000 + Last generated: Tue Oct 24 13:38:02 2000 DO NOT EDIT!!! This file will be automatically regenerated by qtarch. All changes will be lost. diff --git a/src/frontends/kde/indexdlgdata.C b/src/frontends/kde/indexdlgdata.C index 1c20c9ac0c..803f7ee447 100644 --- a/src/frontends/kde/indexdlgdata.C +++ b/src/frontends/kde/indexdlgdata.C @@ -3,7 +3,7 @@ --- Qt Architect generated file --- File: indexdlgdata.C - Last generated: Sat Oct 14 03:43:39 2000 + Last generated: Tue Oct 24 13:38:07 2000 DO NOT EDIT!!! This file will be automatically regenerated by qtarch. All changes will be lost. @@ -11,6 +11,7 @@ *********************************************************************/ #include + #include #include #include "indexdlgdata.h" @@ -50,7 +51,7 @@ IndexDialogData::IndexDialogData index->setBackgroundMode( QWidget::PaletteBase ); index->setFontPropagation( QWidget::NoChildren ); index->setPalettePropagation( QWidget::NoChildren ); - index->setText( _("")); + index->setText( "" ); index->setMaxLength( 32767 ); index->setFrame( QLineEdit::Normal ); index->setFrame( TRUE ); diff --git a/src/frontends/kde/indexdlgdata.h b/src/frontends/kde/indexdlgdata.h index ccb6737431..32f04f335d 100644 --- a/src/frontends/kde/indexdlgdata.h +++ b/src/frontends/kde/indexdlgdata.h @@ -3,7 +3,7 @@ --- Qt Architect generated file --- File: indexdlgdata.h - Last generated: Sat Oct 14 03:43:39 2000 + Last generated: Tue Oct 24 13:38:07 2000 DO NOT EDIT!!! This file will be automatically regenerated by qtarch. All changes will be lost. diff --git a/src/frontends/kde/paraextradlgdata.C b/src/frontends/kde/paraextradlgdata.C index bb242ddc6b..2e8591641c 100644 --- a/src/frontends/kde/paraextradlgdata.C +++ b/src/frontends/kde/paraextradlgdata.C @@ -3,7 +3,7 @@ --- Qt Architect generated file --- File: paraextradlgdata.C - Last generated: Sun Oct 15 05:49:46 2000 + Last generated: Tue Oct 24 13:38:14 2000 DO NOT EDIT!!! This file will be automatically regenerated by qtarch. All changes will be lost. @@ -11,6 +11,7 @@ *********************************************************************/ #include + #include #include #include "paraextradlgdata.h" @@ -177,7 +178,7 @@ ParaExtraDialogData::ParaExtraDialogData widthvalue->setBackgroundMode( QWidget::PaletteBase ); widthvalue->setFontPropagation( QWidget::NoChildren ); widthvalue->setPalettePropagation( QWidget::NoChildren ); - widthvalue->setText( _("") ); + widthvalue->setText( "" ); widthvalue->setMaxLength( 32767 ); widthvalue->setFrame( QLineEdit::Normal ); widthvalue->setFrame( TRUE ); diff --git a/src/frontends/kde/paraextradlgdata.h b/src/frontends/kde/paraextradlgdata.h index 28562f9441..226fc366be 100644 --- a/src/frontends/kde/paraextradlgdata.h +++ b/src/frontends/kde/paraextradlgdata.h @@ -3,7 +3,7 @@ --- Qt Architect generated file --- File: paraextradlgdata.h - Last generated: Sun Oct 15 05:49:46 2000 + Last generated: Tue Oct 24 13:38:14 2000 DO NOT EDIT!!! This file will be automatically regenerated by qtarch. All changes will be lost. diff --git a/src/frontends/kde/parageneraldlgdata.C b/src/frontends/kde/parageneraldlgdata.C index 35b410b057..53f850b090 100644 --- a/src/frontends/kde/parageneraldlgdata.C +++ b/src/frontends/kde/parageneraldlgdata.C @@ -3,7 +3,7 @@ --- Qt Architect generated file --- File: parageneraldlgdata.C - Last generated: Sun Oct 15 16:00:50 2000 + Last generated: Tue Oct 24 13:38:19 2000 DO NOT EDIT!!! This file will be automatically regenerated by qtarch. All changes will be lost. @@ -11,6 +11,7 @@ *********************************************************************/ #include + #include #include #include "parageneraldlgdata.h" @@ -280,7 +281,7 @@ ParaGeneralDialogData::ParaGeneralDialogData labelwidth->setBackgroundMode( QWidget::PaletteBase ); labelwidth->setFontPropagation( QWidget::NoChildren ); labelwidth->setPalettePropagation( QWidget::NoChildren ); - labelwidth->setText( _("") ); + labelwidth->setText( "" ); labelwidth->setMaxLength( 32767 ); labelwidth->setFrame( QLineEdit::Normal ); labelwidth->setFrame( TRUE ); @@ -294,7 +295,7 @@ ParaGeneralDialogData::ParaGeneralDialogData spaceabovevalue->setBackgroundMode( QWidget::PaletteBase ); spaceabovevalue->setFontPropagation( QWidget::NoChildren ); spaceabovevalue->setPalettePropagation( QWidget::NoChildren ); - spaceabovevalue->setText( _("") ); + spaceabovevalue->setText( "" ); spaceabovevalue->setMaxLength( 32767 ); spaceabovevalue->setFrame( QLineEdit::Normal ); spaceabovevalue->setFrame( TRUE ); @@ -356,7 +357,7 @@ ParaGeneralDialogData::ParaGeneralDialogData spaceaboveminus->setBackgroundMode( QWidget::PaletteBase ); spaceaboveminus->setFontPropagation( QWidget::NoChildren ); spaceaboveminus->setPalettePropagation( QWidget::NoChildren ); - spaceaboveminus->setText( _("") ); + spaceaboveminus->setText( "" ); spaceaboveminus->setMaxLength( 32767 ); spaceaboveminus->setFrame( QLineEdit::Normal ); spaceaboveminus->setFrame( TRUE ); @@ -401,7 +402,7 @@ ParaGeneralDialogData::ParaGeneralDialogData spaceaboveplus->setBackgroundMode( QWidget::PaletteBase ); spaceaboveplus->setFontPropagation( QWidget::NoChildren ); spaceaboveplus->setPalettePropagation( QWidget::NoChildren ); - spaceaboveplus->setText( _("") ); + spaceaboveplus->setText( "" ); spaceaboveplus->setMaxLength( 32767 ); spaceaboveplus->setFrame( QLineEdit::Normal ); spaceaboveplus->setFrame( TRUE ); @@ -480,7 +481,7 @@ ParaGeneralDialogData::ParaGeneralDialogData spacebelowminus->setBackgroundMode( QWidget::PaletteBase ); spacebelowminus->setFontPropagation( QWidget::NoChildren ); spacebelowminus->setPalettePropagation( QWidget::NoChildren ); - spacebelowminus->setText( _("") ); + spacebelowminus->setText( "" ); spacebelowminus->setMaxLength( 32767 ); spacebelowminus->setFrame( QLineEdit::Normal ); spacebelowminus->setFrame( TRUE ); @@ -495,7 +496,7 @@ ParaGeneralDialogData::ParaGeneralDialogData spacebelowplus->setBackgroundMode( QWidget::PaletteBase ); spacebelowplus->setFontPropagation( QWidget::NoChildren ); spacebelowplus->setPalettePropagation( QWidget::NoChildren ); - spacebelowplus->setText( _("") ); + spacebelowplus->setText( "" ); spacebelowplus->setMaxLength( 32767 ); spacebelowplus->setFrame( QLineEdit::Normal ); spacebelowplus->setFrame( TRUE ); @@ -510,7 +511,7 @@ ParaGeneralDialogData::ParaGeneralDialogData spacebelowvalue->setBackgroundMode( QWidget::PaletteBase ); spacebelowvalue->setFontPropagation( QWidget::NoChildren ); spacebelowvalue->setPalettePropagation( QWidget::NoChildren ); - spacebelowvalue->setText( _("") ); + spacebelowvalue->setText( "" ); spacebelowvalue->setMaxLength( 32767 ); spacebelowvalue->setFrame( QLineEdit::Normal ); spacebelowvalue->setFrame( TRUE ); diff --git a/src/frontends/kde/parageneraldlgdata.h b/src/frontends/kde/parageneraldlgdata.h index 96715ecd96..daea0d124f 100644 --- a/src/frontends/kde/parageneraldlgdata.h +++ b/src/frontends/kde/parageneraldlgdata.h @@ -3,7 +3,7 @@ --- Qt Architect generated file --- File: parageneraldlgdata.h - Last generated: Sun Oct 15 16:00:50 2000 + Last generated: Tue Oct 24 13:38:19 2000 DO NOT EDIT!!! This file will be automatically regenerated by qtarch. All changes will be lost. diff --git a/src/frontends/kde/printdlgdata.C b/src/frontends/kde/printdlgdata.C index ee62d40196..9a78e91de3 100644 --- a/src/frontends/kde/printdlgdata.C +++ b/src/frontends/kde/printdlgdata.C @@ -3,7 +3,7 @@ --- Qt Architect generated file --- File: printdlgdata.C - Last generated: Sat Oct 14 03:43:43 2000 + Last generated: Tue Oct 24 13:38:22 2000 DO NOT EDIT!!! This file will be automatically regenerated by qtarch. All changes will be lost. @@ -11,6 +11,7 @@ *********************************************************************/ #include + #include #include #include "printdlgdata.h" @@ -53,7 +54,7 @@ PrintDialogData::PrintDialogData pagesRadioGroup->setLineWidth( 1 ); pagesRadioGroup->setMidLineWidth( 0 ); pagesRadioGroup->QFrame::setMargin( 0 ); - pagesRadioGroup->setTitle( _("") ); + pagesRadioGroup->setTitle( "" ); pagesRadioGroup->setAlignment( 1 ); pagesRadioGroup->setExclusive( TRUE ); @@ -99,7 +100,7 @@ PrintDialogData::PrintDialogData printToRadioGroup->setLineWidth( 1 ); printToRadioGroup->setMidLineWidth( 0 ); printToRadioGroup->QFrame::setMargin( 0 ); - printToRadioGroup->setTitle( _("") ); + printToRadioGroup->setTitle( "" ); printToRadioGroup->setAlignment( 1 ); printToRadioGroup->setExclusive( TRUE ); @@ -171,7 +172,7 @@ PrintDialogData::PrintDialogData from->setBackgroundMode( QWidget::PaletteBase ); from->setFontPropagation( QWidget::NoChildren ); from->setPalettePropagation( QWidget::NoChildren ); - from->setText( _("") ); + from->setText( "" ); from->setMaxLength( 32767 ); from->setFrame( QLineEdit::Normal ); from->setFrame( TRUE ); @@ -255,7 +256,7 @@ PrintDialogData::PrintDialogData printername->setBackgroundMode( QWidget::PaletteBase ); printername->setFontPropagation( QWidget::NoChildren ); printername->setPalettePropagation( QWidget::NoChildren ); - printername->setText( _("") ); + printername->setText( "" ); printername->setMaxLength( 32767 ); printername->setFrame( QLineEdit::Normal ); printername->setFrame( TRUE ); @@ -281,7 +282,7 @@ PrintDialogData::PrintDialogData filename->setBackgroundMode( QWidget::PaletteBase ); filename->setFontPropagation( QWidget::NoChildren ); filename->setPalettePropagation( QWidget::NoChildren ); - filename->setText( _("") ); + filename->setText( "" ); filename->setMaxLength( 32767 ); filename->setFrame( QLineEdit::Normal ); filename->setFrame( TRUE ); @@ -325,7 +326,7 @@ PrintDialogData::PrintDialogData count->setBackgroundMode( QWidget::PaletteBase ); count->setFontPropagation( QWidget::NoChildren ); count->setPalettePropagation( QWidget::NoChildren ); - count->setText( _("") ); + count->setText( "" ); count->setMaxLength( 32767 ); count->setFrame( QLineEdit::Normal ); count->setFrame( TRUE ); @@ -354,7 +355,7 @@ PrintDialogData::PrintDialogData to->setBackgroundMode( QWidget::PaletteBase ); to->setFontPropagation( QWidget::NoChildren ); to->setPalettePropagation( QWidget::NoChildren ); - to->setText( _("") ); + to->setText( "" ); to->setMaxLength( 32767 ); to->setFrame( QLineEdit::Normal ); to->setFrame( TRUE ); diff --git a/src/frontends/kde/printdlgdata.h b/src/frontends/kde/printdlgdata.h index 3e9b84ed62..2c46bfe8ca 100644 --- a/src/frontends/kde/printdlgdata.h +++ b/src/frontends/kde/printdlgdata.h @@ -3,7 +3,7 @@ --- Qt Architect generated file --- File: printdlgdata.h - Last generated: Sat Oct 14 03:43:43 2000 + Last generated: Tue Oct 24 13:38:22 2000 DO NOT EDIT!!! This file will be automatically regenerated by qtarch. All changes will be lost. diff --git a/src/frontends/xforms/Dialogs.C b/src/frontends/xforms/Dialogs.C index 0aaea3fcf9..0892d444b5 100644 --- a/src/frontends/xforms/Dialogs.C +++ b/src/frontends/xforms/Dialogs.C @@ -13,6 +13,7 @@ #include "FormPrint.h" #include "FormRef.h" #include "FormTabular.h" +#include "FormTabularCreate.h" #include "FormToc.h" #include "FormUrl.h" @@ -37,6 +38,7 @@ Dialogs::Dialogs(LyXView * lv) dialogs_.push_back(new FormPrint(lv, this)); dialogs_.push_back(new FormRef(lv, this)); dialogs_.push_back(new FormTabular(lv, this)); + dialogs_.push_back(new FormTabularCreate(lv, this)); dialogs_.push_back(new FormToc(lv, this)); dialogs_.push_back(new FormUrl(lv, this)); diff --git a/src/frontends/xforms/FormBase.C b/src/frontends/xforms/FormBase.C index deb7168a0d..1583e7f960 100644 --- a/src/frontends/xforms/FormBase.C +++ b/src/frontends/xforms/FormBase.C @@ -167,7 +167,7 @@ FormBaseBD::FormBaseBD(LyXView * lv, Dialogs * d, string const & t, void FormBaseBD::connect() { u_ = d_->updateBufferDependent. - connect(slot(this, &FormBaseBD::update)); + connect(slot(this, &FormBaseBD::updateSlot)); h_ = d_->hideBufferDependent. connect(slot(this, &FormBaseBD::hide)); FormBase::connect(); diff --git a/src/frontends/xforms/FormBase.h b/src/frontends/xforms/FormBase.h index 26febe08f2..3eca8ca3ed 100644 --- a/src/frontends/xforms/FormBase.h +++ b/src/frontends/xforms/FormBase.h @@ -59,8 +59,8 @@ protected: // methods void show(); /// Hide the dialog. virtual void hide(); - /// bool indicates if a buffer switch took place - virtual void update(bool = false) {} + /// Update the dialog. + virtual void update() {} /// Connect signals. Also perform any necessary initialisation. virtual void connect(); /// Disconnect signals. Also perform any necessary housekeeping. @@ -146,6 +146,8 @@ protected: virtual void connect(); /// Disconnect signals virtual void disconnect(); + /// bool indicates if a buffer switch took place + virtual void updateSlot(bool) { update(); } /// Update connection. Connection u_; diff --git a/src/frontends/xforms/FormCitation.C b/src/frontends/xforms/FormCitation.C index d304045288..c782adcaae 100644 --- a/src/frontends/xforms/FormCitation.C +++ b/src/frontends/xforms/FormCitation.C @@ -10,9 +10,6 @@ */ #include - -#include FORMS_H_LOCATION - #include #ifdef __GNUG__ @@ -86,13 +83,8 @@ void FormCitation::build() } -void FormCitation::update(bool switched) +void FormCitation::update() { - if (switched) { - hide(); - return; - } - bibkeys.clear(); bibkeysInfo.clear(); diff --git a/src/frontends/xforms/FormCitation.h b/src/frontends/xforms/FormCitation.h index a8ac4cfb33..175832d430 100644 --- a/src/frontends/xforms/FormCitation.h +++ b/src/frontends/xforms/FormCitation.h @@ -57,7 +57,7 @@ private: /// Filter the inputs virtual bool input( FL_OBJECT *, long ); /// Update dialog before showing it - virtual void update(bool switched = false); + virtual void update(); /// Apply from dialog (modify or create inset) virtual void apply(); /// Pointer to the actual instantiation of the xform's form diff --git a/src/frontends/xforms/FormDocument.C b/src/frontends/xforms/FormDocument.C index e3051215e9..3452f6ee57 100644 --- a/src/frontends/xforms/FormDocument.C +++ b/src/frontends/xforms/FormDocument.C @@ -303,8 +303,7 @@ void FormDocument::cancel() } -// we can safely ignore the parameter because we can always update -void FormDocument::update(bool) +void FormDocument::update() { if (!dialog_) return; diff --git a/src/frontends/xforms/FormDocument.h b/src/frontends/xforms/FormDocument.h index 76a413c950..2805d4cf76 100644 --- a/src/frontends/xforms/FormDocument.h +++ b/src/frontends/xforms/FormDocument.h @@ -84,7 +84,7 @@ private: /// Filter the inputs virtual bool input( FL_OBJECT *, long ); /// Update the popup. - virtual void update(bool switched = false); + virtual void update(); /// Apply from popup virtual void apply(); /// Cancel from popup diff --git a/src/frontends/xforms/FormError.C b/src/frontends/xforms/FormError.C index 9bdf9dfb69..34b0b5077e 100644 --- a/src/frontends/xforms/FormError.C +++ b/src/frontends/xforms/FormError.C @@ -60,19 +60,15 @@ void FormError::showInset( InsetError * inset ) if (inset_) ih_.disconnect(); - inset_ = inset; - message_ = inset->getContents(); + inset_ = inset; + message_ = inset->getContents(); + ih_ = inset->hide.connect(slot(this, &FormError::hide)); show(); } -void FormError::update(bool switched) +void FormError::update() { - if (switched) { - hide(); - return; - } - fl_set_object_label(dialog_->message, message_.c_str()); } diff --git a/src/frontends/xforms/FormError.h b/src/frontends/xforms/FormError.h index 5ce6f6d3ea..4211bc8981 100644 --- a/src/frontends/xforms/FormError.h +++ b/src/frontends/xforms/FormError.h @@ -36,7 +36,7 @@ private: /// Slot launching dialog to an existing inset void showInset( InsetError * ); /// Update dialog before showing it - virtual void update(bool switched = false); + virtual void update(); /// Build the dialog virtual void build(); /// Pointer to the actual instantiation of the xform's form diff --git a/src/frontends/xforms/FormGraphics.C b/src/frontends/xforms/FormGraphics.C index d04ebfddbd..49cb50d87d 100644 --- a/src/frontends/xforms/FormGraphics.C +++ b/src/frontends/xforms/FormGraphics.C @@ -16,10 +16,6 @@ #endif #include "lyx_gui_misc.h" -#include "gettext.h" -#include FORMS_H_LOCATION - -#include "xform_macros.h" #include "input_validators.h" #include "FormGraphics.h" #include "form_graphics.h" @@ -42,30 +38,15 @@ using std::endl; -C_RETURNCB(FormGraphics, WMHideCB) -C_GENERICCB(FormGraphics, OKCB) -C_GENERICCB(FormGraphics, ApplyCB) -C_GENERICCB(FormGraphics, CancelCB) -C_GENERICCB(FormGraphics, BrowseCB) -C_GENERICCB(FormGraphics, AdvancedOptionsCB) -C_GENERICCB(FormGraphics, InputCB) - FormGraphics::FormGraphics(LyXView * lv, Dialogs * d) - : dialog_(0), lv_(lv), d_(d), inset_(0), - // The buttons c-tor values are the number of buttons we use - // This is only to reduce memory waste. - widthButtons(5), heightButtons(4), displayButtons(4), - bc_(new ButtonController - (new NoRepeatedApplyReadOnlyPolicy, _("Cancel"), _("Close") ) - ), - ih_(0), h_(0), u_(0), - last_image_path(".") + : FormInset( lv, d, _("Graphics"), new NoRepeatedApplyReadOnlyPolicy ), + dialog_(0), inset_(0), + // The buttons c-tor values are the number of buttons we use + // This is only to reduce memory waste. + widthButtons(5), heightButtons(4), displayButtons(4), + last_image_path(".") { - Assert(lv_ != 0); - Assert(d != 0); - Assert(bc_ != 0); - // let the dialog be shown // This is a permanent connection so we won't bother // storing a copy because we won't be disconnecting. @@ -76,9 +57,6 @@ FormGraphics::FormGraphics(LyXView * lv, Dialogs * d) FormGraphics::~FormGraphics() { free(); - - // Free the button controller. - delete bc_; } @@ -91,6 +69,10 @@ void FormGraphics::build() return ; } + // Workaround dumb xforms sizing bug + minw_ = form()->w; + minh_ = form()->h; + // This is the place to add settings of the dialog that did not go // to the .fd file. @@ -154,81 +136,39 @@ void FormGraphics::build() displayButtons.registerRadioButton(dialog_->radio_no_display, InsetGraphicsParams::NONE); - // Connect a signal to hide the window when the window manager orders it. - fl_set_form_atclose(dialog_->form, - C_FormGraphicsWMHideCB, 0); - - bc_->setOK(dialog_->button_ok); - bc_->setApply(dialog_->button_apply); - bc_->setCancel(dialog_->button_cancel); - bc_->setUndoAll(0); - bc_->refresh(); + // manage the ok, apply and cancel/close buttons + bc_.setOK(dialog_->button_ok); + bc_.setApply(dialog_->button_apply); + bc_.setCancel(dialog_->button_cancel); + bc_.setUndoAll(0); + bc_.refresh(); } -void FormGraphics::show() -{ - // If the dialog doesn't exist yet, build it. - if (!dialog_) { - build(); - } - // Update the form with the data from the inset. - update(); - - // If the form is visible - if (dialog_->form->visible) { - // Raise it. - fl_raise_form(dialog_->form); - } else { - // Otherwise (invisible), show it. - fl_show_form(dialog_->form, - FL_PLACE_MOUSE, - FL_TRANSIENT, - _("Graphics")); - - // And connect the signals 'updateBufferDependent', - // 'hideBufferDependent' and 'hideGraphics'. - u_ = d_->updateBufferDependent.connect(slot(this, - &FormGraphics::update)); - h_ = d_->hideBufferDependent.connect(slot(this, - &FormGraphics::hide)); - } +FL_FORM * FormGraphics::form() const +{ + if ( dialog_ ) return dialog_->form; + return 0; } -void FormGraphics::showDialog(InsetGraphics* inset) + +void FormGraphics::disconnect() { - Assert(inset != 0); + inset_ = 0; + FormInset::disconnect(); +} + +void FormGraphics::showDialog(InsetGraphics * inset) +{ // If we are connected to another inset, disconnect. if (inset_) ih_.disconnect(); inset_ = inset; - if (inset_) { - ih_ = inset_->hide.connect(slot(this, &FormGraphics::hide)); - show(); - } -} - - -void FormGraphics::hide() -{ - // If the dialog exists, and the form is allocated and visible. - if (dialog_ - && dialog_->form - && dialog_->form->visible) { - // Hide the form - fl_hide_form(dialog_->form); - - // And disconnect the signals. - u_.disconnect(); - h_.disconnect(); - ih_.disconnect(); - - // Forget the inset. - inset_ = 0; - } + ih_ = inset_->hide.connect(slot(this, &FormGraphics::hide)); + show(); } @@ -245,6 +185,7 @@ void FormGraphics::free() dialog_ = 0; } + void FormGraphics::apply() { Assert(inset_ != 0); @@ -289,16 +230,8 @@ void FormGraphics::apply() } -// it doesn't look this is capable of updating on a buffer switch -// inset_ would be accessible but it's not in the new buffer so -// ok or apply will call something that won't like it. ARRae. -void FormGraphics::update(bool switched) +void FormGraphics::update() { - if (switched) { - hide(); - return; - } - Assert(inset_ != 0); // Update dialog with details from inset @@ -336,9 +269,36 @@ void FormGraphics::update(bool switched) igp.inlineFigure); // Now make sure that the buttons are set correctly. - checkInput(); + input(0, 0); } + +bool FormGraphics::input(FL_OBJECT *, long data ) +{ + State cb = static_cast( data ); + + bool inputOK = true; + + switch( cb ) { + case CHECKINPUT: + inputOK = checkInput(); + break; + case BROWSE: + browse(); + break; + case ADVANCEDINPUT: + lyxerr << "Advanced Options button depressed, " + << "show advanced options dialog" + << endl; + break; + default: + break; + } + + return inputOK; +} + + bool FormGraphics::checkInput() { // Put verifications that the dialog shows some sane values, @@ -392,6 +352,7 @@ extern string system_lyxdir; extern string user_lyxdir; //extern string system_tempdir; + // Need to move this to the form_graphics string FormGraphics::browseFile(string const & filename) { @@ -434,6 +395,7 @@ string FormGraphics::browseFile(string const & filename) return buf; } + void FormGraphics::browse() { // Get the filename from the dialog @@ -449,67 +411,7 @@ void FormGraphics::browse() // The above set input doesn't cause an input event so we do // it manually. Otherwise the user needs to cause an input event // to get the ok/apply buttons to be activated. - checkInput(); + input(0, 0); } } - -int FormGraphics::WMHideCB(FL_FORM * form, void *) -{ - // Ensure that the signal h is disconnected even if the - // window manager is used to close the dialog. - FormGraphics * pre = static_cast < FormGraphics* > (form->u_vdata); - pre->hide(); - - pre->bc_->hide(); - - return FL_CANCEL; -} - - -void FormGraphics::OKCB(FL_OBJECT * ob, long) -{ - FormGraphics * pre = static_cast < FormGraphics* > (ob->form->u_vdata); - pre->apply(); - pre->hide(); - - pre->bc_->ok(); -} - -void FormGraphics::ApplyCB(FL_OBJECT * ob, long) -{ - FormGraphics * pre = static_cast < FormGraphics* > (ob->form->u_vdata); - pre->apply(); - - pre->bc_->apply(); -} - -void FormGraphics::CancelCB(FL_OBJECT * ob, long) -{ - FormGraphics * pre = static_cast < FormGraphics* > (ob->form->u_vdata); - pre->hide(); - - pre->bc_->cancel(); -} - -void FormGraphics::BrowseCB(FL_OBJECT * ob, long) -{ - FormGraphics * pre = static_cast < FormGraphics* > (ob->form->u_vdata); - pre->browse(); -} - -void FormGraphics::AdvancedOptionsCB(FL_OBJECT * /* ob */, long) -{ - // FormGraphics * pre = static_cast(ob->form->u_vdata); - // pre->showAdvancedOptions(); - lyxerr << "Advanced Options button depressed, " - "show advanced options dialog" - << endl; -} - -void FormGraphics::InputCB(FL_OBJECT * ob, long) -{ - FormGraphics * pre = static_cast < FormGraphics* > (ob->form->u_vdata); - pre->bc_->valid(pre->checkInput()); -} - diff --git a/src/frontends/xforms/FormGraphics.h b/src/frontends/xforms/FormGraphics.h index bad8f82232..ce3b853ce7 100644 --- a/src/frontends/xforms/FormGraphics.h +++ b/src/frontends/xforms/FormGraphics.h @@ -17,19 +17,15 @@ #define FORMGRAPHICS_H #include "LString.h" -#include "frontends/DialogBase.h" #include "RadioButtonGroup.h" -#include -#include "ButtonController.h" #include "ButtonPolicies.h" +#include "FormInset.h" #ifdef __GNUG__ #pragma interface #endif // Forward declarations for classes we use only as pointers. -class Dialogs; -class LyXView; class InsetGraphics; struct FD_form_graphics; @@ -38,26 +34,12 @@ struct FD_form_graphics; * * @Author Baruch Even */ -class FormGraphics: public DialogBase, public noncopyable { +class FormGraphics : public FormInset { public: /// #FormGraphics x(LyXFunc ..., Dialogs ...);# FormGraphics(LyXView *, Dialogs *); /// ~FormGraphics(); - /// - 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 BrowseCB(FL_OBJECT *, long); - /// - static void AdvancedOptionsCB(FL_OBJECT *, long); - /// - static void InputCB(FL_OBJECT *, long); private: /// The maximum digits for the image width (cm, inch, percent) @@ -80,43 +62,46 @@ private: /// FILENAME_MAXCHARS = 1024 }; + /// + enum State { + /// + CHECKINPUT, + /// + BROWSE, + /// + ADVANCEDINPUT + }; - /// Save the active inset and show the dialog. - void showDialog(InsetGraphics * inset); - /// Create the dialog if necessary, update it and display it. - void show(); - /// Hide the dialog. - void hide(); - /// Update the dialog - void update(bool switched = false); + /// Build the dialog + virtual void build(); + /// Filter the inputs + virtual bool input( FL_OBJECT *, long ); + /// Update the popup. + virtual void update(); + /// Apply from popup + virtual void apply(); + + /// Disconnect signals. Also perform any necessary housekeeping. + virtual void disconnect(); - /// Apply the changes to the inset. - void apply(); + /// Save the active inset and show the dialog. + void showDialog(InsetGraphics *); + /// Explicitly free the dialog. + void free(); /// Verify that the input is correct. If not disable ok/apply buttons. bool checkInput(); /// Open the file browse dialog to select an image file. void browse(); - - /// Build the dialog - void build(); - /// - FD_form_graphics * build_graphics(); - /// Explicitly free the dialog. - void free(); /// Display a file browser dialog and return the file chosen. string browseFile(string const & filename); + /// Pointer to the actual instantiation of the xform's form + virtual FL_FORM * form() const; + /// Fdesign generated method + FD_form_graphics * build_graphics(); + /// Real GUI implementation. FD_form_graphics * 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_; /** Which Inset do we belong to? Used to set and update data to/from the inset. */ @@ -127,15 +112,6 @@ private: RadioButtonGroup heightButtons; /// RadioButtonGroup displayButtons; - /// Controls the actions of the buttons. - ButtonController * bc_; - - /// Inset Hide connection, connected to the calling inset hide signal. - Connection ih_; - /// Hide connection. - Connection h_; - /// Update connection. - Connection u_; /// Last used figure path string last_image_path; }; diff --git a/src/frontends/xforms/FormIndex.C b/src/frontends/xforms/FormIndex.C index cefacea8db..45bcebe8dc 100644 --- a/src/frontends/xforms/FormIndex.C +++ b/src/frontends/xforms/FormIndex.C @@ -69,13 +69,8 @@ void FormIndex::build() } -void FormIndex::update(bool switched) +void FormIndex::update() { - if (switched) { - hide(); - return; - } - fl_set_input(dialog_->key, params.getContents().c_str()); if ( lv_->buffer()->isReadonly() ) { diff --git a/src/frontends/xforms/FormIndex.h b/src/frontends/xforms/FormIndex.h index 19f93e2391..6714b1d06f 100644 --- a/src/frontends/xforms/FormIndex.h +++ b/src/frontends/xforms/FormIndex.h @@ -33,7 +33,7 @@ private: /// Build the dialog virtual void build(); /// Update dialog before showing it - virtual void update(bool switched = false); + virtual void update(); /// Apply from dialog (modify or create inset) virtual void apply(); /// Pointer to the actual instantiation of the xform's form diff --git a/src/frontends/xforms/FormInset.C b/src/frontends/xforms/FormInset.C index 743293f864..d45f507768 100644 --- a/src/frontends/xforms/FormInset.C +++ b/src/frontends/xforms/FormInset.C @@ -29,20 +29,19 @@ FormInset::FormInset(LyXView * lv, Dialogs * d, string const & t, {} -void FormInset::connect() +void FormInset::disconnect() { - u_ = d_->updateBufferDependent. - connect(slot(this, &FormInset::update)); - h_ = d_->hideBufferDependent. - connect(slot(this, &FormInset::hide)); - FormBase::connect(); + ih_.disconnect(); + FormBaseBD::disconnect(); } -void FormInset::disconnect() +void FormInset::updateSlot( bool switched ) { - ih_.disconnect(); - FormBaseBD::disconnect(); + if (switched) + hide(); + else + update(); } diff --git a/src/frontends/xforms/FormInset.h b/src/frontends/xforms/FormInset.h index 1ffd4d2359..f523336ae3 100644 --- a/src/frontends/xforms/FormInset.h +++ b/src/frontends/xforms/FormInset.h @@ -30,11 +30,12 @@ protected: char const * close = N_("Close"), char const * cancel = N_("Cancel")); - /// Connect signals. Also perform any necessary initialisation. - virtual void connect(); /// Disconnect signals. Also perform any necessary housekeeping. virtual void disconnect(); + /// bool indicates if a buffer switch took place + virtual void updateSlot(bool); + /// inset::hide connection. Connection ih_; }; diff --git a/src/frontends/xforms/FormParagraph.C b/src/frontends/xforms/FormParagraph.C index 0e2f85a95f..0f9beea210 100644 --- a/src/frontends/xforms/FormParagraph.C +++ b/src/frontends/xforms/FormParagraph.C @@ -136,8 +136,7 @@ void FormParagraph::apply() } -// we can safely ignore the parameter because we can always update -void FormParagraph::update(bool) +void FormParagraph::update() { if (!dialog_) return; diff --git a/src/frontends/xforms/FormParagraph.h b/src/frontends/xforms/FormParagraph.h index 4870989da8..3e6d1b105d 100644 --- a/src/frontends/xforms/FormParagraph.h +++ b/src/frontends/xforms/FormParagraph.h @@ -40,7 +40,7 @@ private: /// Apply from popup virtual void apply(); /// Update the popup. - virtual void update(bool); + virtual void update(); /// Filter the inputs on callback from xforms virtual bool input(FL_OBJECT * ob, long); diff --git a/src/frontends/xforms/FormPreferences.C b/src/frontends/xforms/FormPreferences.C index 5815dd11ad..4ab43da97b 100644 --- a/src/frontends/xforms/FormPreferences.C +++ b/src/frontends/xforms/FormPreferences.C @@ -372,8 +372,7 @@ void FormPreferences::apply() } -// we can safely ignore the parameter because we can always update -void FormPreferences::update(bool) +void FormPreferences::update() { if (dialog_) { // read lyxrc entries diff --git a/src/frontends/xforms/FormPreferences.h b/src/frontends/xforms/FormPreferences.h index 5657707cb9..b7a809b603 100644 --- a/src/frontends/xforms/FormPreferences.h +++ b/src/frontends/xforms/FormPreferences.h @@ -46,7 +46,7 @@ public: ~FormPreferences(); private: /// Update the dialog. - virtual void update(bool = false); + virtual void update(); /// virtual void hide(); /// OK from dialog diff --git a/src/frontends/xforms/FormPrint.C b/src/frontends/xforms/FormPrint.C index 4c9dff6571..a8aab2b8af 100644 --- a/src/frontends/xforms/FormPrint.C +++ b/src/frontends/xforms/FormPrint.C @@ -158,8 +158,7 @@ void FormPrint::apply() } -// we can safely ignore the parameter because we can always update -void FormPrint::update(bool) +void FormPrint::update() { if (dialog_ && lv_->view()->available()) { diff --git a/src/frontends/xforms/FormPrint.h b/src/frontends/xforms/FormPrint.h index 28acdcc4ca..0f9f69dda1 100644 --- a/src/frontends/xforms/FormPrint.h +++ b/src/frontends/xforms/FormPrint.h @@ -40,7 +40,7 @@ public: private: /// Update the dialog. - virtual void update(bool switched = false); + virtual void update(); /// Apply from dialog virtual void apply(); /// Filter the inputs diff --git a/src/frontends/xforms/FormRef.C b/src/frontends/xforms/FormRef.C index ecbd5db944..8acdaa6502 100644 --- a/src/frontends/xforms/FormRef.C +++ b/src/frontends/xforms/FormRef.C @@ -95,13 +95,8 @@ void FormRef::build() } -void FormRef::update(bool switched) +void FormRef::update() { - if (switched) { - hide(); - return; - } - fl_set_input(dialog_->ref, params.getContents().c_str()); fl_set_input(dialog_->name, params.getOptions().c_str()); diff --git a/src/frontends/xforms/FormRef.h b/src/frontends/xforms/FormRef.h index e7ad15d418..f314d837fd 100644 --- a/src/frontends/xforms/FormRef.h +++ b/src/frontends/xforms/FormRef.h @@ -61,7 +61,7 @@ private: /// Filter the input virtual bool input( FL_OBJECT *, long ); /// Update dialog before showing it - virtual void update(bool switched = false); + virtual void update(); /// Not used but must be instantiated virtual void apply(); /// Pointer to the actual instantiation of the xform's form diff --git a/src/frontends/xforms/FormTabular.C b/src/frontends/xforms/FormTabular.C index 096a7573ca..4c7806d7e1 100644 --- a/src/frontends/xforms/FormTabular.C +++ b/src/frontends/xforms/FormTabular.C @@ -1,490 +1,421 @@ +// -*- C++ -*- +/* This file is part of + * ====================================================== + * + * LyX, The Document Processor + * + * Copyright 1995 Matthias Ettrich + * Copyright 1995-2000 The LyX Team. + * + *======================================================*/ /* FormTabular.C * FormTabular Interface Class Implementation */ #include -#include "lyx_gui_misc.h" -#include "gettext.h" -#include FORMS_H_LOCATION #include "FormTabular.h" #include "form_tabular.h" -#include "xform_macros.h" -#include "input_validators.h" #include "LyXView.h" -#include "lyxfunc.h" #include "Dialogs.h" -#include "lyxrc.h" -#include "debug.h" #include "insets/insettabular.h" #include "buffer.h" -#ifdef SIGC_CXX_NAMESPACES -using SigC::slot; -#endif - -C_RETURNCB(FormTabular, WMHideCB) -C_GENERICCB(FormTabular, CloseCB) -C_GENERICCB(FormTabular, InputCB) -C_GENERICCB(FormTabular, OKCB) -C_GENERICCB(FormTabular, ApplyCB) -C_GENERICCB(FormTabular, CancelCB) - - FormTabular::FormTabular(LyXView * lv, Dialogs * d) - : dialog_(0), tabular_options_(0), column_options_(0), - cell_options_(0), longtable_options_(0), create_tabular_(0), - lv_(lv), d_(d), u_(0), h_(0), inset_(0), actCell_(-1) + : FormInset( lv, d, _("Tabular Layout") ), + dialog_(0), tabular_options_(0), column_options_(0), + cell_options_(0), longtable_options_(0), + inset_(0), actCell_(-1) { - // let the dialog be shown - // This is a permanent connection so we won't bother - // storing a copy because we won't be disconnecting. - d->showTabular.connect(slot(this, &FormTabular::showInset)); - d->updateTabular.connect(slot(this, &FormTabular::updateInset)); - d->hideTabular.connect(slot(this, &FormTabular::hideInset)); - d->showTabularCreate.connect(slot(this, &FormTabular::show_create)); + // let the dialog be shown + // This is a permanent connection so we won't bother + // storing a copy because we won't be disconnecting. + d->showTabular.connect(slot(this, &FormTabular::showInset)); + d->updateTabular.connect(slot(this, &FormTabular::updateInset)); } FormTabular::~FormTabular() { - // we don't need to disconnect u and h here because - // their destructors do that. - delete dialog_; - delete tabular_options_; - delete column_options_; - delete cell_options_; - delete longtable_options_; - delete create_tabular_; -} - - -void FormTabular::build() -{ - dialog_ = build_tabular(); - tabular_options_ = build_tabular_options(); - column_options_ = build_column_options(); - cell_options_ = build_cell_options(); - longtable_options_ = build_longtable_options(); - create_tabular_ = build_create_tabular(); - - fl_set_input_return(column_options_->input_column_width, - FL_RETURN_END); - fl_set_input_return(column_options_->input_special_alignment, - FL_RETURN_CHANGED); - fl_set_input_return(cell_options_->input_mcolumn_width, - FL_RETURN_CHANGED); - fl_set_input_return(cell_options_->input_special_multialign, - FL_RETURN_CHANGED); - - fl_addto_tabfolder(dialog_->tabFolder, _("Tabular"), - tabular_options_->form); - fl_addto_tabfolder(dialog_->tabFolder, _("Column/Row"), - column_options_->form); - fl_addto_tabfolder(dialog_->tabFolder, _("Cell"), - cell_options_->form); - fl_addto_tabfolder(dialog_->tabFolder, _("LongTable"), - longtable_options_->form); - - fl_set_form_atclose(dialog_->form, - C_FormTabularWMHideCB, 0); - - fl_set_slider_bounds(create_tabular_->slider_rows, 1, 50); - fl_set_slider_bounds(create_tabular_->slider_columns, 1, 50); - fl_set_slider_value(create_tabular_->slider_rows, 5); - fl_set_slider_value(create_tabular_->slider_columns, 5); - fl_set_slider_precision(create_tabular_->slider_rows, 0); - fl_set_slider_precision(create_tabular_->slider_columns, 0); - fl_set_form_atclose(create_tabular_->form, - C_FormTabularWMHideCB, 0); + delete dialog_; + delete tabular_options_; + delete column_options_; + delete cell_options_; + delete longtable_options_; } -void FormTabular::show() +FL_FORM * FormTabular::form() const { - if (!dialog_) { - build(); - } - update(); // make sure its up-to-date - - if (dialog_->form->visible) { - fl_raise_form(dialog_->form); - } else { - fl_show_form(dialog_->form, - FL_PLACE_MOUSE | FL_FREE_SIZE, - FL_TRANSIENT, - _("Tabular Layout")); -// u_ = d_->updateBufferDependent.connect(slot(this, -// &FormTabular::update)); - h_ = d_->hideBufferDependent.connect(slot(this, - &FormTabular::hide)); - } + if ( dialog_ ) return dialog_->form; + return 0; } -void FormTabular::showInset(InsetTabular * ti) -{ - inset_ = ti; - if (ti) { - show(); - } -} -void FormTabular::hide() +void FormTabular::disconnect() { - if (dialog_ && dialog_->form && dialog_->form->visible) { - fl_hide_form(dialog_->form); - u_.disconnect(); - h_.disconnect(); inset_ = 0; - } + FormInset::disconnect(); } -void FormTabular::hideInset(InsetTabular * ti) +void FormTabular::showInset( InsetTabular * inset ) { - if (inset_ == ti) { - inset_ = 0; - hide(); - } -} + if (inset == 0) return; + // If connected to another inset, disconnect from it. + if (inset_ != inset) { + ih_.disconnect(); + ih_ = inset->hideDialog.connect(slot(this, &FormTabular::hide)); + inset_ = inset; + } -void FormTabular::update(bool) -{ - if (dialog_) { - local_update(true); - } -} - -void FormTabular::updateInset(InsetTabular * ti) -{ - inset_ = ti; - if (ti && dialog_ && dialog_->form->visible) { - update(); - } + show(); } -int FormTabular::WMHideCB(FL_FORM * form, void *) +void FormTabular::updateInset( InsetTabular * inset ) { - // Ensure that the signals (u and h) are disconnected even if the - // window manager is used to close the dialog. - FormTabular * pre = static_cast(form->u_vdata); - pre->hide(); - return FL_CANCEL; -} + if (inset == 0 || inset_ == 0) return; + // If connected to another inset, disconnect from it. + if (inset_ != inset) { + ih_.disconnect(); + ih_ = inset->hideDialog.connect(slot(this, &FormTabular::hide)); + inset_ = inset; + } -void FormTabular::CloseCB(FL_OBJECT * ob, long) -{ - FormTabular * pre = static_cast(ob->form->u_vdata); - pre->hide(); + update(); } -void FormTabular::InputCB(FL_OBJECT * ob, long l) +void FormTabular::build() { - FormTabular * pre = static_cast(ob->form->u_vdata); - pre->SetTabularOptions(ob, l); + dialog_ = build_tabular(); + tabular_options_ = build_tabular_options(); + column_options_ = build_column_options(); + cell_options_ = build_cell_options(); + longtable_options_ = build_longtable_options(); + + // Workaround dumb xforms sizing bug + minw_ = form()->w; + minh_ = form()->h; + + fl_set_input_return(column_options_->input_column_width, + FL_RETURN_END); + fl_set_input_return(column_options_->input_special_alignment, + FL_RETURN_CHANGED); + fl_set_input_return(cell_options_->input_mcolumn_width, + FL_RETURN_CHANGED); + fl_set_input_return(cell_options_->input_special_multialign, + FL_RETURN_CHANGED); + + fl_addto_tabfolder(dialog_->tabFolder, _("Tabular"), + tabular_options_->form); + fl_addto_tabfolder(dialog_->tabFolder, _("Column/Row"), + column_options_->form); + fl_addto_tabfolder(dialog_->tabFolder, _("Cell"), + cell_options_->form); + fl_addto_tabfolder(dialog_->tabFolder, _("LongTable"), + longtable_options_->form); } -bool FormTabular::local_update(bool) +void FormTabular::update() { - if (!inset_ || !inset_->tabular) - return false; - - LyXTabular - * tabular = inset_->tabular; - int - align, - cell, - column,row; - char - buf[12]; - string - pwidth, special; - - actCell_ = cell = inset_->GetActCell(); - column = tabular->column_of_cell(cell)+1; - fl_set_object_label(dialog_->text_warning,""); - fl_activate_object(column_options_->input_special_alignment); - fl_activate_object(cell_options_->input_special_multialign); - fl_activate_object(column_options_->input_column_width); - sprintf(buf,"%d",column); - fl_set_input(dialog_->input_tabular_column, buf); - fl_deactivate_object(dialog_->input_tabular_column); - row = tabular->row_of_cell(cell)+1; - sprintf(buf,"%d",row); - fl_set_input(dialog_->input_tabular_row, buf); - fl_deactivate_object(dialog_->input_tabular_row); - if (tabular->IsMultiColumn(cell)) { - fl_set_button(cell_options_->radio_multicolumn, 1); - fl_set_button(cell_options_->radio_border_top, - tabular->TopLine(cell)?1:0); - fl_activate_object(cell_options_->radio_border_top); - fl_set_object_lcol(cell_options_->radio_border_top, FL_BLACK); - fl_set_button(cell_options_->radio_border_bottom, - tabular->BottomLine(cell)?1:0); - fl_activate_object(cell_options_->radio_border_bottom); - fl_set_object_lcol(cell_options_->radio_border_bottom, FL_BLACK); - fl_set_button(cell_options_->radio_border_left, - tabular->LeftLine(cell)?1:0); - fl_activate_object(cell_options_->radio_border_left); - fl_set_object_lcol(cell_options_->radio_border_left, FL_BLACK); - fl_set_button(cell_options_->radio_border_right, - tabular->RightLine(cell)?1:0); - fl_activate_object(cell_options_->radio_border_right); - fl_set_object_lcol(cell_options_->radio_border_right, FL_BLACK); - pwidth = tabular->GetMColumnPWidth(cell); - align = tabular->GetAlignment(cell); + if (!inset_ || !inset_->tabular) + return; + + LyXTabular + * tabular = inset_->tabular; + int + align, + cell, + column,row; + char + buf[12]; + string + pwidth, special; + + actCell_ = cell = inset_->GetActCell(); + column = tabular->column_of_cell(cell)+1; + fl_set_object_label(dialog_->text_warning,""); + fl_activate_object(column_options_->input_special_alignment); + fl_activate_object(cell_options_->input_special_multialign); + fl_activate_object(column_options_->input_column_width); + sprintf(buf,"%d",column); + fl_set_input(dialog_->input_tabular_column, buf); + fl_deactivate_object(dialog_->input_tabular_column); + row = tabular->row_of_cell(cell)+1; + sprintf(buf,"%d",row); + fl_set_input(dialog_->input_tabular_row, buf); + fl_deactivate_object(dialog_->input_tabular_row); + if (tabular->IsMultiColumn(cell)) { + fl_set_button(cell_options_->radio_multicolumn, 1); + fl_set_button(cell_options_->radio_border_top, + tabular->TopLine(cell)?1:0); + fl_activate_object(cell_options_->radio_border_top); + fl_set_object_lcol(cell_options_->radio_border_top, FL_BLACK); + fl_set_button(cell_options_->radio_border_bottom, + tabular->BottomLine(cell)?1:0); + fl_activate_object(cell_options_->radio_border_bottom); + fl_set_object_lcol(cell_options_->radio_border_bottom, FL_BLACK); + fl_set_button(cell_options_->radio_border_left, + tabular->LeftLine(cell)?1:0); + fl_activate_object(cell_options_->radio_border_left); + fl_set_object_lcol(cell_options_->radio_border_left, FL_BLACK); + fl_set_button(cell_options_->radio_border_right, + tabular->RightLine(cell)?1:0); + fl_activate_object(cell_options_->radio_border_right); + fl_set_object_lcol(cell_options_->radio_border_right, FL_BLACK); + pwidth = tabular->GetMColumnPWidth(cell); + align = tabular->GetAlignment(cell); + if (!pwidth.empty() || (align == LYX_ALIGN_LEFT)) + fl_set_button(cell_options_->radio_align_left, 1); + else if (align == LYX_ALIGN_RIGHT) + fl_set_button(cell_options_->radio_align_right, 1); + else + fl_set_button(cell_options_->radio_align_center, 1); + fl_activate_object(cell_options_->radio_align_left); + fl_set_object_lcol(cell_options_->radio_align_left, FL_BLACK); + fl_activate_object(cell_options_->radio_align_right); + fl_set_object_lcol(cell_options_->radio_align_right, FL_BLACK); + fl_activate_object(cell_options_->radio_align_center); + fl_set_object_lcol(cell_options_->radio_align_center, FL_BLACK); + align = tabular->GetVAlignment(cell); + fl_set_button(cell_options_->radio_valign_top, 0); + fl_set_button(cell_options_->radio_valign_bottom, 0); + fl_set_button(cell_options_->radio_valign_center, 0); + if (pwidth.empty() || (align == LyXTabular::LYX_VALIGN_CENTER)) + fl_set_button(cell_options_->radio_valign_center, 1); + else if (align == LyXTabular::LYX_VALIGN_BOTTOM) + fl_set_button(cell_options_->radio_valign_bottom, 1); + else + fl_set_button(cell_options_->radio_valign_top, 1); + fl_activate_object(cell_options_->radio_valign_top); + fl_set_object_lcol(cell_options_->radio_valign_top, FL_BLACK); + fl_activate_object(cell_options_->radio_valign_bottom); + fl_set_object_lcol(cell_options_->radio_valign_bottom, FL_BLACK); + fl_activate_object(cell_options_->radio_valign_center); + fl_set_object_lcol(cell_options_->radio_valign_center, FL_BLACK); + special = tabular->GetAlignSpecial(cell,LyXTabular::SET_SPECIAL_MULTI); + fl_set_input(cell_options_->input_special_multialign, special.c_str()); + fl_set_input(cell_options_->input_mcolumn_width,pwidth.c_str()); + if (!lv_->buffer()->isReadonly()) { + fl_activate_object(cell_options_->input_special_multialign); + fl_set_object_lcol(cell_options_->input_special_multialign, + FL_BLACK); + fl_activate_object(cell_options_->input_mcolumn_width); + fl_set_object_lcol(cell_options_->input_mcolumn_width, FL_BLACK); + } + if (!pwidth.empty()) { + fl_deactivate_object(cell_options_->radio_align_left); + fl_deactivate_object(cell_options_->radio_align_right); + fl_deactivate_object(cell_options_->radio_align_center); + fl_set_object_lcol(cell_options_->radio_align_left, FL_INACTIVE); + fl_set_object_lcol(cell_options_->radio_align_right, FL_INACTIVE); + fl_set_object_lcol(cell_options_->radio_align_center, FL_INACTIVE); + fl_activate_object(cell_options_->radio_valign_top); + fl_activate_object(cell_options_->radio_valign_bottom); + fl_activate_object(cell_options_->radio_valign_center); + fl_set_object_lcol(cell_options_->radio_valign_top, FL_BLACK); + fl_set_object_lcol(cell_options_->radio_valign_bottom, FL_BLACK); + fl_set_object_lcol(cell_options_->radio_valign_center, FL_BLACK); + } else { + fl_activate_object(cell_options_->radio_align_left); + fl_activate_object(cell_options_->radio_align_right); + fl_activate_object(cell_options_->radio_align_center); + fl_set_object_lcol(cell_options_->radio_align_left, FL_BLACK); + fl_set_object_lcol(cell_options_->radio_align_right, FL_BLACK); + fl_set_object_lcol(cell_options_->radio_align_center, FL_BLACK); + fl_deactivate_object(cell_options_->radio_valign_top); + fl_deactivate_object(cell_options_->radio_valign_bottom); + fl_deactivate_object(cell_options_->radio_valign_center); + fl_set_object_lcol(cell_options_->radio_valign_top, FL_INACTIVE); + fl_set_object_lcol(cell_options_->radio_valign_bottom,FL_INACTIVE); + fl_set_object_lcol(cell_options_->radio_valign_center,FL_INACTIVE); + } + } else { + fl_set_button(cell_options_->radio_multicolumn, 0); + fl_set_button(cell_options_->radio_border_top, 0); + fl_deactivate_object(cell_options_->radio_border_top); + fl_set_object_lcol(cell_options_->radio_border_top, FL_INACTIVE); + fl_set_button(cell_options_->radio_border_bottom, 0); + fl_deactivate_object(cell_options_->radio_border_bottom); + fl_set_object_lcol(cell_options_->radio_border_bottom, FL_INACTIVE); + fl_set_button(cell_options_->radio_border_left, 0); + fl_deactivate_object(cell_options_->radio_border_left); + fl_set_object_lcol(cell_options_->radio_border_left, FL_INACTIVE); + fl_set_button(cell_options_->radio_border_right, 0); + fl_deactivate_object(cell_options_->radio_border_right); + fl_set_object_lcol(cell_options_->radio_border_right, FL_INACTIVE); + fl_set_button(cell_options_->radio_align_left, 0); + fl_deactivate_object(cell_options_->radio_align_left); + fl_set_object_lcol(cell_options_->radio_align_left, FL_INACTIVE); + fl_set_button(cell_options_->radio_align_right, 0); + fl_deactivate_object(cell_options_->radio_align_right); + fl_set_object_lcol(cell_options_->radio_align_right, FL_INACTIVE); + fl_set_button(cell_options_->radio_align_center, 0); + fl_deactivate_object(cell_options_->radio_align_center); + fl_set_object_lcol(cell_options_->radio_align_center, FL_INACTIVE); + fl_set_button(cell_options_->radio_valign_top, 0); + fl_deactivate_object(cell_options_->radio_valign_top); + fl_set_object_lcol(cell_options_->radio_valign_top, FL_INACTIVE); + fl_set_button(cell_options_->radio_valign_bottom, 0); + fl_deactivate_object(cell_options_->radio_valign_bottom); + fl_set_object_lcol(cell_options_->radio_valign_bottom, FL_INACTIVE); + fl_set_button(cell_options_->radio_valign_center, 0); + fl_deactivate_object(cell_options_->radio_valign_center); + fl_set_object_lcol(cell_options_->radio_valign_center, FL_INACTIVE); + fl_set_input(cell_options_->input_special_multialign, ""); + fl_deactivate_object(cell_options_->input_special_multialign); + fl_set_object_lcol(cell_options_->input_special_multialign, FL_INACTIVE); + fl_set_input(cell_options_->input_mcolumn_width,""); + fl_deactivate_object(cell_options_->input_mcolumn_width); + fl_set_object_lcol(cell_options_->input_mcolumn_width, FL_INACTIVE); + } + if (tabular->GetRotateCell(cell)) + fl_set_button(cell_options_->radio_rotate_cell, 1); + else + fl_set_button(cell_options_->radio_rotate_cell, 0); + if (tabular->TopLine(cell, true)) + fl_set_button(column_options_->radio_border_top, 1); + else + fl_set_button(column_options_->radio_border_top, 0); + if (tabular->BottomLine(cell, true)) + fl_set_button(column_options_->radio_border_bottom, 1); + else + fl_set_button(column_options_->radio_border_bottom, 0); + if (tabular->LeftLine(cell, true)) + fl_set_button(column_options_->radio_border_left, 1); + else + fl_set_button(column_options_->radio_border_left, 0); + if (tabular->RightLine(cell, true)) + fl_set_button(column_options_->radio_border_right, 1); + else + fl_set_button(column_options_->radio_border_right, 0); + special = tabular->GetAlignSpecial(cell,LyXTabular::SET_SPECIAL_COLUMN); + fl_set_input(column_options_->input_special_alignment, special.c_str()); + if (lv_->buffer()->isReadonly()) + fl_deactivate_object(column_options_->input_special_alignment); + else + fl_activate_object(column_options_->input_special_alignment); + pwidth = tabular->GetColumnPWidth(cell); + fl_set_input(column_options_->input_column_width,pwidth.c_str()); + if (lv_->buffer()->isReadonly()) { + fl_deactivate_object(column_options_->input_column_width); + } else { + fl_activate_object(column_options_->input_column_width); + } + if (!pwidth.empty()) { + fl_activate_object(cell_options_->radio_useminipage); + fl_set_object_lcol(cell_options_->radio_useminipage, FL_BLACK); + if (tabular->GetUsebox(cell) == 2) + fl_set_button(cell_options_->radio_useminipage, 1); + else + fl_set_button(cell_options_->radio_useminipage, 0); + } else { + fl_deactivate_object(cell_options_->radio_useminipage); + fl_set_object_lcol(cell_options_->radio_useminipage, FL_INACTIVE); + fl_set_button(cell_options_->radio_useminipage,0); + } + align = tabular->GetAlignment(cell, true); + fl_set_button(column_options_->radio_align_left, 0); + fl_set_button(column_options_->radio_align_right, 0); + fl_set_button(column_options_->radio_align_center, 0); if (!pwidth.empty() || (align == LYX_ALIGN_LEFT)) - fl_set_button(cell_options_->radio_align_left, 1); + fl_set_button(column_options_->radio_align_left, 1); else if (align == LYX_ALIGN_RIGHT) - fl_set_button(cell_options_->radio_align_right, 1); + fl_set_button(column_options_->radio_align_right, 1); else - fl_set_button(cell_options_->radio_align_center, 1); - fl_activate_object(cell_options_->radio_align_left); - fl_set_object_lcol(cell_options_->radio_align_left, FL_BLACK); - fl_activate_object(cell_options_->radio_align_right); - fl_set_object_lcol(cell_options_->radio_align_right, FL_BLACK); - fl_activate_object(cell_options_->radio_align_center); - fl_set_object_lcol(cell_options_->radio_align_center, FL_BLACK); - align = tabular->GetVAlignment(cell); - fl_set_button(cell_options_->radio_valign_top, 0); - fl_set_button(cell_options_->radio_valign_bottom, 0); - fl_set_button(cell_options_->radio_valign_center, 0); + fl_set_button(column_options_->radio_align_center, 1); + align = tabular->GetVAlignment(cell, true); + fl_set_button(column_options_->radio_valign_top, 0); + fl_set_button(column_options_->radio_valign_bottom, 0); + fl_set_button(column_options_->radio_valign_center, 0); if (pwidth.empty() || (align == LyXTabular::LYX_VALIGN_CENTER)) - fl_set_button(cell_options_->radio_valign_center, 1); + fl_set_button(column_options_->radio_valign_center, 1); else if (align == LyXTabular::LYX_VALIGN_BOTTOM) - fl_set_button(cell_options_->radio_valign_bottom, 1); + fl_set_button(column_options_->radio_valign_bottom, 1); else - fl_set_button(cell_options_->radio_valign_top, 1); - fl_activate_object(cell_options_->radio_valign_top); - fl_set_object_lcol(cell_options_->radio_valign_top, FL_BLACK); - fl_activate_object(cell_options_->radio_valign_bottom); - fl_set_object_lcol(cell_options_->radio_valign_bottom, FL_BLACK); - fl_activate_object(cell_options_->radio_valign_center); - fl_set_object_lcol(cell_options_->radio_valign_center, FL_BLACK); - special = tabular->GetAlignSpecial(cell,LyXTabular::SET_SPECIAL_MULTI); - fl_set_input(cell_options_->input_special_multialign, special.c_str()); - fl_set_input(cell_options_->input_mcolumn_width,pwidth.c_str()); - if (!lv_->buffer()->isReadonly()) { - fl_activate_object(cell_options_->input_special_multialign); - fl_set_object_lcol(cell_options_->input_special_multialign, - FL_BLACK); - fl_activate_object(cell_options_->input_mcolumn_width); - fl_set_object_lcol(cell_options_->input_mcolumn_width, FL_BLACK); - } + fl_set_button(column_options_->radio_valign_top, 1); if (!pwidth.empty()) { - fl_deactivate_object(cell_options_->radio_align_left); - fl_deactivate_object(cell_options_->radio_align_right); - fl_deactivate_object(cell_options_->radio_align_center); - fl_set_object_lcol(cell_options_->radio_align_left, FL_INACTIVE); - fl_set_object_lcol(cell_options_->radio_align_right, FL_INACTIVE); - fl_set_object_lcol(cell_options_->radio_align_center, FL_INACTIVE); - fl_activate_object(cell_options_->radio_valign_top); - fl_activate_object(cell_options_->radio_valign_bottom); - fl_activate_object(cell_options_->radio_valign_center); - fl_set_object_lcol(cell_options_->radio_valign_top, FL_BLACK); - fl_set_object_lcol(cell_options_->radio_valign_bottom, FL_BLACK); - fl_set_object_lcol(cell_options_->radio_valign_center, FL_BLACK); + fl_deactivate_object(column_options_->radio_align_left); + fl_deactivate_object(column_options_->radio_align_right); + fl_deactivate_object(column_options_->radio_align_center); + fl_set_object_lcol(column_options_->radio_align_left, FL_INACTIVE); + fl_set_object_lcol(column_options_->radio_align_right, FL_INACTIVE); + fl_set_object_lcol(column_options_->radio_align_center, FL_INACTIVE); + fl_activate_object(column_options_->radio_valign_top); + fl_activate_object(column_options_->radio_valign_bottom); + fl_activate_object(column_options_->radio_valign_center); + fl_set_object_lcol(column_options_->radio_valign_top, FL_BLACK); + fl_set_object_lcol(column_options_->radio_valign_bottom, FL_BLACK); + fl_set_object_lcol(column_options_->radio_valign_center, FL_BLACK); } else { - fl_activate_object(cell_options_->radio_align_left); - fl_activate_object(cell_options_->radio_align_right); - fl_activate_object(cell_options_->radio_align_center); - fl_set_object_lcol(cell_options_->radio_align_left, FL_BLACK); - fl_set_object_lcol(cell_options_->radio_align_right, FL_BLACK); - fl_set_object_lcol(cell_options_->radio_align_center, FL_BLACK); - fl_deactivate_object(cell_options_->radio_valign_top); - fl_deactivate_object(cell_options_->radio_valign_bottom); - fl_deactivate_object(cell_options_->radio_valign_center); - fl_set_object_lcol(cell_options_->radio_valign_top, FL_INACTIVE); - fl_set_object_lcol(cell_options_->radio_valign_bottom,FL_INACTIVE); - fl_set_object_lcol(cell_options_->radio_valign_center,FL_INACTIVE); + fl_activate_object(column_options_->radio_align_left); + fl_activate_object(column_options_->radio_align_right); + fl_activate_object(column_options_->radio_align_center); + fl_set_object_lcol(column_options_->radio_align_left, FL_BLACK); + fl_set_object_lcol(column_options_->radio_align_right, FL_BLACK); + fl_set_object_lcol(column_options_->radio_align_center, FL_BLACK); + fl_deactivate_object(column_options_->radio_valign_top); + fl_deactivate_object(column_options_->radio_valign_bottom); + fl_deactivate_object(column_options_->radio_valign_center); + fl_set_object_lcol(column_options_->radio_valign_top, FL_INACTIVE); + fl_set_object_lcol(column_options_->radio_valign_bottom, FL_INACTIVE); + fl_set_object_lcol(column_options_->radio_valign_center, FL_INACTIVE); } - } else { - fl_set_button(cell_options_->radio_multicolumn, 0); - fl_set_button(cell_options_->radio_border_top, 0); - fl_deactivate_object(cell_options_->radio_border_top); - fl_set_object_lcol(cell_options_->radio_border_top, FL_INACTIVE); - fl_set_button(cell_options_->radio_border_bottom, 0); - fl_deactivate_object(cell_options_->radio_border_bottom); - fl_set_object_lcol(cell_options_->radio_border_bottom, FL_INACTIVE); - fl_set_button(cell_options_->radio_border_left, 0); - fl_deactivate_object(cell_options_->radio_border_left); - fl_set_object_lcol(cell_options_->radio_border_left, FL_INACTIVE); - fl_set_button(cell_options_->radio_border_right, 0); - fl_deactivate_object(cell_options_->radio_border_right); - fl_set_object_lcol(cell_options_->radio_border_right, FL_INACTIVE); - fl_set_button(cell_options_->radio_align_left, 0); - fl_deactivate_object(cell_options_->radio_align_left); - fl_set_object_lcol(cell_options_->radio_align_left, FL_INACTIVE); - fl_set_button(cell_options_->radio_align_right, 0); - fl_deactivate_object(cell_options_->radio_align_right); - fl_set_object_lcol(cell_options_->radio_align_right, FL_INACTIVE); - fl_set_button(cell_options_->radio_align_center, 0); - fl_deactivate_object(cell_options_->radio_align_center); - fl_set_object_lcol(cell_options_->radio_align_center, FL_INACTIVE); - fl_set_button(cell_options_->radio_valign_top, 0); - fl_deactivate_object(cell_options_->radio_valign_top); - fl_set_object_lcol(cell_options_->radio_valign_top, FL_INACTIVE); - fl_set_button(cell_options_->radio_valign_bottom, 0); - fl_deactivate_object(cell_options_->radio_valign_bottom); - fl_set_object_lcol(cell_options_->radio_valign_bottom, FL_INACTIVE); - fl_set_button(cell_options_->radio_valign_center, 0); - fl_deactivate_object(cell_options_->radio_valign_center); - fl_set_object_lcol(cell_options_->radio_valign_center, FL_INACTIVE); - fl_set_input(cell_options_->input_special_multialign, ""); - fl_deactivate_object(cell_options_->input_special_multialign); - fl_set_object_lcol(cell_options_->input_special_multialign, FL_INACTIVE); - fl_set_input(cell_options_->input_mcolumn_width,""); - fl_deactivate_object(cell_options_->input_mcolumn_width); - fl_set_object_lcol(cell_options_->input_mcolumn_width, FL_INACTIVE); - } - if (tabular->GetRotateCell(cell)) - fl_set_button(cell_options_->radio_rotate_cell, 1); - else - fl_set_button(cell_options_->radio_rotate_cell, 0); - if (tabular->TopLine(cell, true)) - fl_set_button(column_options_->radio_border_top, 1); - else - fl_set_button(column_options_->radio_border_top, 0); - if (tabular->BottomLine(cell, true)) - fl_set_button(column_options_->radio_border_bottom, 1); - else - fl_set_button(column_options_->radio_border_bottom, 0); - if (tabular->LeftLine(cell, true)) - fl_set_button(column_options_->radio_border_left, 1); - else - fl_set_button(column_options_->radio_border_left, 0); - if (tabular->RightLine(cell, true)) - fl_set_button(column_options_->radio_border_right, 1); - else - fl_set_button(column_options_->radio_border_right, 0); - special = tabular->GetAlignSpecial(cell,LyXTabular::SET_SPECIAL_COLUMN); - fl_set_input(column_options_->input_special_alignment, special.c_str()); - if (lv_->buffer()->isReadonly()) - fl_deactivate_object(column_options_->input_special_alignment); - else - fl_activate_object(column_options_->input_special_alignment); - pwidth = tabular->GetColumnPWidth(cell); - fl_set_input(column_options_->input_column_width,pwidth.c_str()); - if (lv_->buffer()->isReadonly()) { - fl_deactivate_object(column_options_->input_column_width); - } else { - fl_activate_object(column_options_->input_column_width); - } - if (!pwidth.empty()) { - fl_activate_object(cell_options_->radio_useminipage); - fl_set_object_lcol(cell_options_->radio_useminipage, FL_BLACK); - if (tabular->GetUsebox(cell) == 2) - fl_set_button(cell_options_->radio_useminipage, 1); - else - fl_set_button(cell_options_->radio_useminipage, 0); - } else { - fl_deactivate_object(cell_options_->radio_useminipage); - fl_set_object_lcol(cell_options_->radio_useminipage, FL_INACTIVE); - fl_set_button(cell_options_->radio_useminipage,0); - } - align = tabular->GetAlignment(cell, true); - fl_set_button(column_options_->radio_align_left, 0); - fl_set_button(column_options_->radio_align_right, 0); - fl_set_button(column_options_->radio_align_center, 0); - if (!pwidth.empty() || (align == LYX_ALIGN_LEFT)) - fl_set_button(column_options_->radio_align_left, 1); - else if (align == LYX_ALIGN_RIGHT) - fl_set_button(column_options_->radio_align_right, 1); - else - fl_set_button(column_options_->radio_align_center, 1); - align = tabular->GetVAlignment(cell, true); - fl_set_button(column_options_->radio_valign_top, 0); - fl_set_button(column_options_->radio_valign_bottom, 0); - fl_set_button(column_options_->radio_valign_center, 0); - if (pwidth.empty() || (align == LyXTabular::LYX_VALIGN_CENTER)) - fl_set_button(column_options_->radio_valign_center, 1); - else if (align == LyXTabular::LYX_VALIGN_BOTTOM) - fl_set_button(column_options_->radio_valign_bottom, 1); - else - fl_set_button(column_options_->radio_valign_top, 1); - if (!pwidth.empty()) { - fl_deactivate_object(column_options_->radio_align_left); - fl_deactivate_object(column_options_->radio_align_right); - fl_deactivate_object(column_options_->radio_align_center); - fl_set_object_lcol(column_options_->radio_align_left, FL_INACTIVE); - fl_set_object_lcol(column_options_->radio_align_right, FL_INACTIVE); - fl_set_object_lcol(column_options_->radio_align_center, FL_INACTIVE); - fl_activate_object(column_options_->radio_valign_top); - fl_activate_object(column_options_->radio_valign_bottom); - fl_activate_object(column_options_->radio_valign_center); - fl_set_object_lcol(column_options_->radio_valign_top, FL_BLACK); - fl_set_object_lcol(column_options_->radio_valign_bottom, FL_BLACK); - fl_set_object_lcol(column_options_->radio_valign_center, FL_BLACK); - } else { - fl_activate_object(column_options_->radio_align_left); - fl_activate_object(column_options_->radio_align_right); - fl_activate_object(column_options_->radio_align_center); - fl_set_object_lcol(column_options_->radio_align_left, FL_BLACK); - fl_set_object_lcol(column_options_->radio_align_right, FL_BLACK); - fl_set_object_lcol(column_options_->radio_align_center, FL_BLACK); - fl_deactivate_object(column_options_->radio_valign_top); - fl_deactivate_object(column_options_->radio_valign_bottom); - fl_deactivate_object(column_options_->radio_valign_center); - fl_set_object_lcol(column_options_->radio_valign_top, FL_INACTIVE); - fl_set_object_lcol(column_options_->radio_valign_bottom, FL_INACTIVE); - fl_set_object_lcol(column_options_->radio_valign_center, FL_INACTIVE); - } - fl_set_button(tabular_options_->radio_longtable, - tabular->IsLongTabular()); - if (tabular->IsLongTabular()) { - fl_activate_object(longtable_options_->radio_lt_firsthead); - fl_activate_object(longtable_options_->radio_lt_head); - fl_activate_object(longtable_options_->radio_lt_foot); - fl_activate_object(longtable_options_->radio_lt_lastfoot); - fl_activate_object(longtable_options_->radio_lt_newpage); - fl_set_object_lcol(longtable_options_->radio_lt_firsthead, FL_BLACK); - fl_set_object_lcol(longtable_options_->radio_lt_head, FL_BLACK); - fl_set_object_lcol(longtable_options_->radio_lt_foot, FL_BLACK); - fl_set_object_lcol(longtable_options_->radio_lt_lastfoot, FL_BLACK); - fl_set_object_lcol(longtable_options_->radio_lt_newpage, FL_BLACK); - int dummy; - fl_set_button(longtable_options_->radio_lt_firsthead, - tabular->GetRowOfLTFirstHead(cell, dummy)); - fl_set_button(longtable_options_->radio_lt_head, - tabular->GetRowOfLTHead(cell, dummy)); - fl_set_button(longtable_options_->radio_lt_foot, - tabular->GetRowOfLTFoot(cell, dummy)); - fl_set_button(longtable_options_->radio_lt_lastfoot, - tabular->GetRowOfLTLastFoot(cell, dummy)); - fl_set_button(longtable_options_->radio_lt_newpage, - tabular->GetLTNewPage(cell)); - } else { - fl_deactivate_object(longtable_options_->radio_lt_firsthead); - fl_deactivate_object(longtable_options_->radio_lt_head); - fl_deactivate_object(longtable_options_->radio_lt_foot); - fl_deactivate_object(longtable_options_->radio_lt_lastfoot); - fl_deactivate_object(longtable_options_->radio_lt_newpage); - fl_set_button(longtable_options_->radio_lt_firsthead,0); - fl_set_button(longtable_options_->radio_lt_head,0); - fl_set_button(longtable_options_->radio_lt_foot,0); - fl_set_button(longtable_options_->radio_lt_lastfoot,0); - fl_set_button(longtable_options_->radio_lt_newpage,0); - fl_set_object_lcol(longtable_options_->radio_lt_firsthead,FL_INACTIVE); - fl_set_object_lcol(longtable_options_->radio_lt_head, FL_INACTIVE); - fl_set_object_lcol(longtable_options_->radio_lt_foot, FL_INACTIVE); - fl_set_object_lcol(longtable_options_->radio_lt_lastfoot, FL_INACTIVE); - fl_set_object_lcol(longtable_options_->radio_lt_newpage, FL_INACTIVE); - } - fl_set_button(tabular_options_->radio_rotate_tabular, - tabular->GetRotateTabular()); - return true; + fl_set_button(tabular_options_->radio_longtable, + tabular->IsLongTabular()); + if (tabular->IsLongTabular()) { + fl_activate_object(longtable_options_->radio_lt_firsthead); + fl_activate_object(longtable_options_->radio_lt_head); + fl_activate_object(longtable_options_->radio_lt_foot); + fl_activate_object(longtable_options_->radio_lt_lastfoot); + fl_activate_object(longtable_options_->radio_lt_newpage); + fl_set_object_lcol(longtable_options_->radio_lt_firsthead, FL_BLACK); + fl_set_object_lcol(longtable_options_->radio_lt_head, FL_BLACK); + fl_set_object_lcol(longtable_options_->radio_lt_foot, FL_BLACK); + fl_set_object_lcol(longtable_options_->radio_lt_lastfoot, FL_BLACK); + fl_set_object_lcol(longtable_options_->radio_lt_newpage, FL_BLACK); + int dummy; + fl_set_button(longtable_options_->radio_lt_firsthead, + tabular->GetRowOfLTFirstHead(cell, dummy)); + fl_set_button(longtable_options_->radio_lt_head, + tabular->GetRowOfLTHead(cell, dummy)); + fl_set_button(longtable_options_->radio_lt_foot, + tabular->GetRowOfLTFoot(cell, dummy)); + fl_set_button(longtable_options_->radio_lt_lastfoot, + tabular->GetRowOfLTLastFoot(cell, dummy)); + fl_set_button(longtable_options_->radio_lt_newpage, + tabular->GetLTNewPage(cell)); + } else { + fl_deactivate_object(longtable_options_->radio_lt_firsthead); + fl_deactivate_object(longtable_options_->radio_lt_head); + fl_deactivate_object(longtable_options_->radio_lt_foot); + fl_deactivate_object(longtable_options_->radio_lt_lastfoot); + fl_deactivate_object(longtable_options_->radio_lt_newpage); + fl_set_button(longtable_options_->radio_lt_firsthead,0); + fl_set_button(longtable_options_->radio_lt_head,0); + fl_set_button(longtable_options_->radio_lt_foot,0); + fl_set_button(longtable_options_->radio_lt_lastfoot,0); + fl_set_button(longtable_options_->radio_lt_newpage,0); + fl_set_object_lcol(longtable_options_->radio_lt_firsthead,FL_INACTIVE); + fl_set_object_lcol(longtable_options_->radio_lt_head, FL_INACTIVE); + fl_set_object_lcol(longtable_options_->radio_lt_foot, FL_INACTIVE); + fl_set_object_lcol(longtable_options_->radio_lt_lastfoot, FL_INACTIVE); + fl_set_object_lcol(longtable_options_->radio_lt_newpage, FL_INACTIVE); + } + fl_set_button(tabular_options_->radio_rotate_tabular, + tabular->GetRotateTabular()); } -void FormTabular::SetTabularOptions(FL_OBJECT * ob, long) +bool FormTabular::input(FL_OBJECT * ob, long) { if (!inset_) - return; + return false; LyXTabular * tabular = inset_->tabular; @@ -499,17 +430,17 @@ void FormTabular::SetTabularOptions(FL_OBJECT * ob, long) cell = inset_->GetActCell(); if (actCell_ != cell) { - local_update(false); + update(); fl_set_object_label(dialog_->text_warning, _("Warning: Wrong Cursor position, updated window")); fl_show_object(dialog_->text_warning); - return; + return false; } // No point in processing directives that you can't do anything with // anyhow, so exit now if the buffer is read-only. if (lv_->buffer()->isReadonly()) { - local_update(false); - return; + update(); + return false; } if (ob == column_options_->input_column_width) { string @@ -519,11 +450,11 @@ void FormTabular::SetTabularOptions(FL_OBJECT * ob, long) fl_set_object_label(dialog_->text_warning, _("Warning: Invalid Length (valid example: 10mm)")); fl_show_object(dialog_->text_warning); - return; + return false; } inset_->TabularFeatures(lv_->view(), LyXTabular::SET_PWIDTH,str); - local_update(false); // update for alignment - return; + update(); // update for alignment + return true; } if (ob == cell_options_->input_mcolumn_width) { string @@ -533,11 +464,11 @@ void FormTabular::SetTabularOptions(FL_OBJECT * ob, long) fl_set_object_label(dialog_->text_warning, _("Warning: Invalid Length (valid example: 10mm)")); fl_show_object(dialog_->text_warning); - return; + return false; } inset_->TabularFeatures(lv_->view(), LyXTabular::SET_MPWIDTH,str); - local_update(false); // update for alignment - return; + update(); // update for alignment + return true; } str = fl_get_input(column_options_->input_column_width); if (!str.empty() && !isValidLength(str)) { @@ -545,7 +476,7 @@ void FormTabular::SetTabularOptions(FL_OBJECT * ob, long) dialog_->text_warning, _("Warning: Invalid Length (valid example: 10mm)")); fl_show_object(dialog_->text_warning); - return; + return false; } if (ob == tabular_options_->button_append_row) num = LyXTabular::APPEND_ROW; @@ -674,74 +605,10 @@ void FormTabular::SetTabularOptions(FL_OBJECT * ob, long) else if (ob == cell_options_->radio_valign_center) num = LyXTabular::M_VALIGN_CENTER; else - return; + return false; inset_->TabularFeatures(lv_->view(), num, special); - local_update(false); -} - -// +-----------------------------------------------------------------------+ -// | Functions/Dialogs for creating tabular insets | -// +-----------------------------------------------------------------------+ - -void FormTabular::show_create() -{ - if (!dialog_) { - build(); - } - if (create_tabular_->form->visible) { - fl_raise_form(create_tabular_->form); - } else { - fl_show_form(create_tabular_->form, - FL_PLACE_MOUSE | FL_FREE_SIZE, - FL_FULLBORDER, _("Insert Tabular")); - } -} - - -void FormTabular::apply_create() -{ - int - xsize,ysize; - -// comm->setMinibuffer(_("Inserting tabular inset...")); - ysize = int(fl_get_slider_value(create_tabular_->slider_columns) + 0.5); - xsize = int(fl_get_slider_value(create_tabular_->slider_rows) + 0.5); - InsetTabular * in = new InsetTabular(*lv_->buffer(),xsize,ysize); - if (!lv_->view()->open_new_inset(in)) { - delete in; - } -// comm->setMinibuffer(_("Tabular mode")); -} - - -void FormTabular::hide_create() -{ - if (create_tabular_->form && - create_tabular_->form->visible) - fl_hide_form(create_tabular_->form); -} - - -void FormTabular::OKCB(FL_OBJECT * ob, long) -{ - FormTabular * pre = (FormTabular*)ob->form->u_vdata; - pre->apply_create(); - pre->hide_create(); -} - - -void FormTabular::ApplyCB(FL_OBJECT * ob, long) -{ - FormTabular * pre = (FormTabular*)ob->form->u_vdata; - pre->apply_create(); -} + update(); - -void FormTabular::CancelCB(FL_OBJECT * ob, long) -{ - FormTabular * pre = (FormTabular*)ob->form->u_vdata; - pre->hide_create(); + return true; } - - diff --git a/src/frontends/xforms/FormTabular.h b/src/frontends/xforms/FormTabular.h index f21aba995c..bebdf51327 100644 --- a/src/frontends/xforms/FormTabular.h +++ b/src/frontends/xforms/FormTabular.h @@ -15,109 +15,68 @@ #ifndef FORMTABULAR_H #define FORMTABULAR_H -#include "DialogBase.h" -#include +#include "FormInset.h" -#ifdef SIGC_CXX_NAMESPACES -using SigC::Connection; -#endif - -class LyXView; -class Dialogs; class InsetTabular; struct FD_form_tabular; struct FD_form_tabular_options; struct FD_form_column_options; struct FD_form_cell_options; struct FD_form_longtable_options; -struct FD_form_create_tabular; /** This class provides an XForms implementation of the FormTabular Dialog. The tabular dialog allows users to set/save their tabular. */ -class FormTabular : public DialogBase, public noncopyable { +class FormTabular : public FormInset { public: - /// #FormTabular x(LyXFunc ..., Dialogs ...);# - FormTabular(LyXView *, Dialogs *); - /// - ~FormTabular(); - /// - static int WMHideCB(FL_FORM *, void *); - /// - static void CloseCB(FL_OBJECT *, long); - /// - static void OKCB(FL_OBJECT *, long); - /// - static void CancelCB(FL_OBJECT *, long); - /// - static void ApplyCB(FL_OBJECT *, long); - /// - static void InputCB(FL_OBJECT *, long); + /// #FormTabular x(LyXFunc ..., Dialogs ...);# + FormTabular(LyXView *, Dialogs *); + /// + ~FormTabular(); private: - /// Create the dialog if necessary, update it and display it. - void show(); - /// - void show_create(); - /// - void showInset(InsetTabular *); - /// Hide the dialog. - void hide(); - /// - void hide_create(); - /// - void hideInset(InsetTabular *); - /// Update the dialog. - void update(bool = false); - /// - void updateInset(InsetTabular *); - /// - bool local_update(bool); - - /// Apply from dialog - void apply_create(); - /// Build the dialog - void build(); - /// - void SetTabularOptions(FL_OBJECT *, long); - /// - FD_form_tabular * build_tabular(); - /// - FD_form_tabular_options * build_tabular_options(); - /// - FD_form_column_options * build_column_options(); - /// - FD_form_cell_options * build_cell_options(); - /// - FD_form_longtable_options * build_longtable_options(); - /// - FD_form_create_tabular * build_create_tabular(); + /// Disconnect signals. Also perform any necessary housekeeping. + virtual void disconnect(); + + /// Slot launching dialog to an existing inset + void showInset(InsetTabular *); + /// Slot launching dialog to an existing inset + void updateInset(InsetTabular *); + /// Update dialog before showing it + virtual void update(); + /// Build the dialog + virtual void build(); + /// Filter the inputs + virtual bool input(FL_OBJECT *, long); + /// Pointer to the actual instantiation of the xform's form + virtual FL_FORM * form() const; + + /// Fdesign generated methods + FD_form_tabular * build_tabular(); + /// + FD_form_tabular_options * build_tabular_options(); + /// + FD_form_column_options * build_column_options(); + /// + FD_form_cell_options * build_cell_options(); + /// + FD_form_longtable_options * build_longtable_options(); - /// Real GUI implementation. - FD_form_tabular * dialog_; - /// - FD_form_tabular_options * tabular_options_; - /// - FD_form_column_options * column_options_; - /// - FD_form_cell_options * cell_options_; - /// - FD_form_longtable_options * longtable_options_; - /// - FD_form_create_tabular * create_tabular_; + /// Real GUI implementation. + FD_form_tabular * dialog_; + /// + FD_form_tabular_options * tabular_options_; + /// + FD_form_column_options * column_options_; + /// + FD_form_cell_options * cell_options_; + /// + FD_form_longtable_options * longtable_options_; - /// Which LyXView do we belong to? - LyXView * lv_; - /// - Dialogs * d_; - /// Update connection. - Connection u_; - /// Hide connection. - Connection h_; - /// - InsetTabular * inset_; - /// - int actCell_; + /// pointer to the inset passed through showInset + InsetTabular * inset_; + /// + int actCell_; }; #endif diff --git a/src/frontends/xforms/FormTabularCreate.C b/src/frontends/xforms/FormTabularCreate.C new file mode 100644 index 0000000000..dc37c2b50b --- /dev/null +++ b/src/frontends/xforms/FormTabularCreate.C @@ -0,0 +1,88 @@ +// -*- C++ -*- +/* This file is part of + * ====================================================== + * + * LyX, The Document Processor + * + * Copyright 2000 The LyX Team. + * + * ====================================================== + */ +/* FormTabularCreate.C + * FormTabularCreate Interface Class Implementation + */ + +#include + +#include "FormTabularCreate.h" +#include "form_tabular_create.h" +#include "BufferView.h" +#include "Dialogs.h" +#include "LyXView.h" +#include "insets/insettabular.h" + + +FormTabularCreate::FormTabularCreate(LyXView * lv, Dialogs * d) + : FormBaseBD(lv, d, _("Insert Tabular")), + dialog_(0) +{ + // let the dialog be shown + // This is a permanent connection so we won't bother + // storing a copy because we won't be disconnecting. + d->showTabularCreate.connect(slot(this, &FormTabularCreate::show)); +} + + +FormTabularCreate::~FormTabularCreate() +{ + delete dialog_; +} + + +FL_FORM * FormTabularCreate::form() const +{ + if ( dialog_ ) return dialog_->form; + return 0; +} + + +void FormTabularCreate::connect() +{ + bc_.valid(true); + FormBaseBD::connect(); +} + + +void FormTabularCreate::build() +{ + dialog_ = build_tabular_create(); + + // Workaround dumb xforms sizing bug + minw_ = form()->w; + minh_ = form()->h; + + fl_set_slider_bounds(dialog_->slider_rows, 1, 50); + fl_set_slider_bounds(dialog_->slider_columns, 1, 50); + fl_set_slider_value(dialog_->slider_rows, 5); + fl_set_slider_value(dialog_->slider_columns, 5); + fl_set_slider_precision(dialog_->slider_rows, 0); + fl_set_slider_precision(dialog_->slider_columns, 0); + + // manage the ok, apply and cancel/close buttons + bc_.setOK(dialog_->button_ok); + bc_.setApply(dialog_->button_apply); + bc_.setCancel(dialog_->button_cancel); + bc_.refresh(); +} + + +void FormTabularCreate::apply() +{ + int ysize = int(fl_get_slider_value(dialog_->slider_columns) + 0.5); + int xsize = int(fl_get_slider_value(dialog_->slider_rows) + 0.5); + + InsetTabular * in = new InsetTabular( *lv_->buffer(), xsize, ysize ); + if (!lv_->view()->open_new_inset(in)) { + delete in; + } +} diff --git a/src/frontends/xforms/FormTabularCreate.h b/src/frontends/xforms/FormTabularCreate.h new file mode 100644 index 0000000000..cfcb4bb29a --- /dev/null +++ b/src/frontends/xforms/FormTabularCreate.h @@ -0,0 +1,56 @@ +// -*- C++ -*- +/* This file is part of + * ====================================================== + * + * LyX, The Document Processor + * + * Copyright 1995 Matthias Ettrich + * Copyright 1995-2000 The LyX Team. + * + *======================================================*/ +/* FormTabularCreate.h + * FormTabularCreate Interface Class + */ + +#ifndef FORMTABULARCREATE_H +#define FORMTABULARCREATE_H + +#include "FormBase.h" + +#ifdef __GNUG__ +#pragma interface +#endif + +class LyXView; +class Dialogs; +struct FD_form_tabular_create; + +/** This class provides an XForms implementation of the FormTabularCreate + Dialog. + */ +class FormTabularCreate : public FormBaseBD { +public: + /// #FormTabularCreate x(LyXView ..., Dialogs ...);# + FormTabularCreate(LyXView *, Dialogs *); + /// + ~FormTabularCreate(); + +private: + /// Connect signals etc. + virtual void connect(); + + /// Apply from dialog + virtual void apply(); + /// Pointer to the actual instantiation of the xform's form + virtual FL_FORM * form() const; + /// Build the dialog + virtual void build(); + + /// + FD_form_tabular_create * build_tabular_create(); + + /// Real GUI implementation. + FD_form_tabular_create * dialog_; +}; + +#endif diff --git a/src/frontends/xforms/FormToc.C b/src/frontends/xforms/FormToc.C index 2191473c4f..40ca12b595 100644 --- a/src/frontends/xforms/FormToc.C +++ b/src/frontends/xforms/FormToc.C @@ -78,8 +78,7 @@ void FormToc::build() } -// we can safely ignore the parameter because we can always update -void FormToc::update(bool) +void FormToc::update() { Buffer::TocType type; diff --git a/src/frontends/xforms/FormToc.h b/src/frontends/xforms/FormToc.h index 906ff7ad78..c8bf93d8c2 100644 --- a/src/frontends/xforms/FormToc.h +++ b/src/frontends/xforms/FormToc.h @@ -34,8 +34,10 @@ private: /// Build the dialog virtual void build(); + /// bool indicates if a buffer switch took place + virtual void updateSlot(bool) { update(); } /// Update dialog before showing it - virtual void update(bool switched = false); + virtual void update(); /// Apply from dialog (modify or create inset) virtual void apply(); /// Pointer to the actual instantiation of the xform's form diff --git a/src/frontends/xforms/FormUrl.C b/src/frontends/xforms/FormUrl.C index b32450b5c1..fc0ac2b40a 100644 --- a/src/frontends/xforms/FormUrl.C +++ b/src/frontends/xforms/FormUrl.C @@ -69,13 +69,8 @@ void FormUrl::build() } -void FormUrl::update(bool switched) +void FormUrl::update() { - if (switched) { - hide(); - return; - } - fl_set_input(dialog_->url, params.getContents().c_str()); fl_set_input(dialog_->name, params.getOptions().c_str()); diff --git a/src/frontends/xforms/FormUrl.h b/src/frontends/xforms/FormUrl.h index e6f718ab0a..3aa21d665b 100644 --- a/src/frontends/xforms/FormUrl.h +++ b/src/frontends/xforms/FormUrl.h @@ -33,7 +33,7 @@ private: /// Build the dialog virtual void build(); /// Update dialog before showing it - virtual void update(bool switched = false); + virtual void update(); /// Apply from dialog (modify or create inset) virtual void apply(); /// Pointer to the actual instantiation of the xform's form diff --git a/src/frontends/xforms/Makefile.am b/src/frontends/xforms/Makefile.am index 16f621108a..f696cf53be 100644 --- a/src/frontends/xforms/Makefile.am +++ b/src/frontends/xforms/Makefile.am @@ -63,6 +63,10 @@ libxforms_la_SOURCES = \ FormTabular.h \ form_tabular.C \ form_tabular.h \ + FormTabularCreate.C \ + FormTabularCreate.h \ + form_tabular_create.C \ + form_tabular_create.h \ FormToc.C \ FormToc.h \ form_toc.C \ diff --git a/src/frontends/xforms/form_graphics.C b/src/frontends/xforms/form_graphics.C index 14dc5a5e4a..a7e724e98d 100644 --- a/src/frontends/xforms/form_graphics.C +++ b/src/frontends/xforms/form_graphics.C @@ -26,60 +26,60 @@ FD_form_graphics * FormGraphics::build_graphics() fdui->form->u_vdata = this; obj = fl_add_box(FL_UP_BOX, 0, 0, 410, 390, ""); fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_resize(obj, FL_RESIZE_NONE); + fl_set_object_gravity(obj, FL_NorthWest, FL_SouthEast); obj = fl_add_frame(FL_ENGRAVED_FRAME, 10, 310, 390, 30, ""); obj = fl_add_frame(FL_ENGRAVED_FRAME, 230, 250, 170, 50, ""); fdui->input_filename = obj = fl_add_input(FL_NORMAL_INPUT, 90, 20, 210, 30, idex(_("Graphics File|F#F"))); fl_set_button_shortcut(obj, scex(_("Graphics File|F#F")), 1); - fl_set_object_callback(obj, C_FormGraphicsInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, CHECKINPUT); fdui->button_browse = obj = fl_add_button(FL_NORMAL_BUTTON, 310, 20, 90, 30, idex(_("Browse|B#B"))); fl_set_button_shortcut(obj, scex(_("Browse|B#B")), 1); - fl_set_object_callback(obj, C_FormGraphicsBrowseCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, BROWSE); obj = fl_add_labelframe(FL_ENGRAVED_FRAME, 10, 70, 200, 160, _("Width")); fl_set_object_lalign(obj, FL_ALIGN_CENTER); obj = fl_add_text(FL_NORMAL_TEXT, 130, 60, 50, 20, _("Height")); fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE); fdui->input_width = obj = fl_add_input(FL_NORMAL_INPUT, 20, 190, 90, 30, ""); fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, C_FormGraphicsInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, CHECKINPUT); fdui->input_height = obj = fl_add_input(FL_NORMAL_INPUT, 120, 190, 80, 30, ""); fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, C_FormGraphicsInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, CHECKINPUT); obj = fl_add_labelframe(FL_ENGRAVED_FRAME, 230, 70, 170, 160, _("Display")); fl_set_object_lalign(obj, FL_ALIGN_CENTER); fdui->button_ok = obj = fl_add_button(FL_RETURN_BUTTON, 10, 350, 70, 30, _("Ok")); - fl_set_object_callback(obj, C_FormGraphicsOKCB, 0); + fl_set_object_callback(obj, C_FormBaseOKCB, 0); fdui->button_apply = obj = fl_add_button(FL_NORMAL_BUTTON, 100, 350, 70, 30, idex(_("Apply|A#A"))); fl_set_button_shortcut(obj, scex(_("Apply|A#A")), 1); - fl_set_object_callback(obj, C_FormGraphicsApplyCB, 0); + fl_set_object_callback(obj, C_FormBaseApplyCB, 0); fdui->button_cancel = obj = fl_add_button(FL_NORMAL_BUTTON, 190, 350, 70, 30, idex(_("Cancel|C#C^["))); fl_set_button_shortcut(obj, scex(_("Cancel|C#C^[")), 1); - fl_set_object_callback(obj, C_FormGraphicsCancelCB, 0); + fl_set_object_callback(obj, C_FormBaseCancelCB, 0); fdui->radio_button_group_width = fl_bgn_group(); fdui->radio_width_percent_page = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 10, 140, 80, 30, _("% of Page")); - fl_set_object_callback(obj, C_FormGraphicsInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, CHECKINPUT); fdui->radio_width_default = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 10, 80, 80, 30, _("Default")); - fl_set_object_callback(obj, C_FormGraphicsInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, CHECKINPUT); fl_set_button(obj, 1); fdui->radio_width_cm = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 10, 100, 80, 30, _("cm")); - fl_set_object_callback(obj, C_FormGraphicsInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, CHECKINPUT); fdui->radio_width_inch = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 10, 120, 80, 30, _("Inch")); - fl_set_object_callback(obj, C_FormGraphicsInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, CHECKINPUT); fdui->radio_width_percent_column = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 10, 160, 80, 30, _("% of Column")); - fl_set_object_callback(obj, C_FormGraphicsInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, CHECKINPUT); fl_end_group(); fdui->radio_button_group_height = fl_bgn_group(); fdui->radio_height_percent_page = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 110, 140, 80, 30, _("% of Page")); - fl_set_object_callback(obj, C_FormGraphicsInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, CHECKINPUT); fdui->radio_height_inch = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 110, 120, 80, 30, _("Inch")); - fl_set_object_callback(obj, C_FormGraphicsInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, CHECKINPUT); fdui->radio_height_cm = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 110, 100, 80, 30, _("cm")); - fl_set_object_callback(obj, C_FormGraphicsInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, CHECKINPUT); fdui->radio_height_default = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 110, 80, 80, 30, _("Default")); - fl_set_object_callback(obj, C_FormGraphicsInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, CHECKINPUT); fl_set_button(obj, 1); fl_end_group(); @@ -94,14 +94,14 @@ FD_form_graphics * FormGraphics::build_graphics() obj = fl_add_labelframe(FL_ENGRAVED_FRAME, 10, 250, 200, 50, _("Rotate")); fdui->input_rotate_angle = obj = fl_add_input(FL_INT_INPUT, 70, 260, 80, 30, _("Angle")); - fl_set_object_callback(obj, C_FormGraphicsInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, CHECKINPUT); fdui->check_inline = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 230, 260, 170, 30, _("Inline Figure")); - fl_set_object_callback(obj, C_FormGraphicsInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, CHECKINPUT); fdui->input_subcaption = obj = fl_add_input(FL_NORMAL_INPUT, 120, 310, 280, 30, ""); - fl_set_object_callback(obj, C_FormGraphicsInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, CHECKINPUT); fdui->check_subcaption = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 10, 310, 110, 30, idex(_("Subcaption|S#S"))); fl_set_button_shortcut(obj, scex(_("Subcaption|S#S")), 1); - fl_set_object_callback(obj, C_FormGraphicsInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, CHECKINPUT); fl_end_form(); fdui->form->fdui = fdui; diff --git a/src/frontends/xforms/form_graphics.h b/src/frontends/xforms/form_graphics.h index 492394db21..107be0440c 100644 --- a/src/frontends/xforms/form_graphics.h +++ b/src/frontends/xforms/form_graphics.h @@ -5,11 +5,10 @@ #define FD_form_graphics_h_ /** Callbacks, globals and object handlers **/ -extern "C" void C_FormGraphicsInputCB(FL_OBJECT *, long); -extern "C" void C_FormGraphicsBrowseCB(FL_OBJECT *, long); -extern "C" void C_FormGraphicsOKCB(FL_OBJECT *, long); -extern "C" void C_FormGraphicsApplyCB(FL_OBJECT *, long); -extern "C" void C_FormGraphicsCancelCB(FL_OBJECT *, long); +extern "C" void C_FormBaseInputCB(FL_OBJECT *, long); +extern "C" void C_FormBaseOKCB(FL_OBJECT *, long); +extern "C" void C_FormBaseApplyCB(FL_OBJECT *, long); +extern "C" void C_FormBaseCancelCB(FL_OBJECT *, long); /**** Forms and Objects ****/ diff --git a/src/frontends/xforms/form_tabular.C b/src/frontends/xforms/form_tabular.C index 51d53ae80c..afe2ebe91d 100644 --- a/src/frontends/xforms/form_tabular.C +++ b/src/frontends/xforms/form_tabular.C @@ -30,7 +30,7 @@ FD_form_tabular * FormTabular::build_tabular() fdui->button_close = obj = fl_add_button(FL_NORMAL_BUTTON, 415, 260, 90, 30, idex(_("Close|#C"))); fl_set_button_shortcut(obj, scex(_("Close|#C")), 1); fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, C_FormTabularCloseCB, 0); + fl_set_object_callback(obj, C_FormBaseCancelCB, 0); fdui->input_tabular_column = obj = fl_add_input(FL_NORMAL_INPUT, 65, 260, 60, 30, ""); fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_lalign(obj, FL_ALIGN_TOP_LEFT); @@ -69,32 +69,32 @@ FD_form_tabular_options * FormTabular::build_tabular_options() fdui->button_append_column = obj = fl_add_button(FL_NORMAL_BUTTON, 10, 40, 120, 30, idex(_("Append Column|#A"))); fl_set_button_shortcut(obj, scex(_("Append Column|#A")), 1); fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, C_FormTabularInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, 0); fdui->button_delete_column = obj = fl_add_button(FL_NORMAL_BUTTON, 140, 40, 120, 30, idex(_("Delete Column|#O"))); fl_set_button_shortcut(obj, scex(_("Delete Column|#O")), 1); fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, C_FormTabularInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, 0); fdui->button_append_row = obj = fl_add_button(FL_NORMAL_BUTTON, 10, 70, 120, 30, idex(_("Append Row|#p"))); fl_set_button_shortcut(obj, scex(_("Append Row|#p")), 1); fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, C_FormTabularInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, 0); fdui->button_delete_row = obj = fl_add_button(FL_NORMAL_BUTTON, 140, 70, 120, 30, idex(_("Delete Row|#w"))); fl_set_button_shortcut(obj, scex(_("Delete Row|#w")), 1); fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, C_FormTabularInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, 0); fdui->button_set_borders = obj = fl_add_button(FL_NORMAL_BUTTON, 10, 10, 120, 30, idex(_("Set Borders|#S"))); fl_set_button_shortcut(obj, scex(_("Set Borders|#S")), 1); fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, C_FormTabularInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, 0); fdui->button_unset_borders = obj = fl_add_button(FL_NORMAL_BUTTON, 140, 10, 120, 30, idex(_("Unset Borders|#U"))); fl_set_button_shortcut(obj, scex(_("Unset Borders|#U")), 1); fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, C_FormTabularInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, 0); fdui->radio_longtable = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 280, 30, 90, 25, _("Longtable")); - fl_set_object_callback(obj, C_FormTabularInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, 0); fdui->radio_rotate_tabular = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 280, 55, 90, 25, idex(_("Rotate 90°|#9"))); fl_set_button_shortcut(obj, scex(_("Rotate 90°|#9")), 1); - fl_set_object_callback(obj, C_FormTabularInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, 0); obj = fl_add_text(FL_NORMAL_TEXT, 285, 10, 100, 20, _("Spec. Table")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE); @@ -133,22 +133,22 @@ FD_form_column_options * FormTabular::build_column_options() fl_set_button_shortcut(obj, scex(_("Top|#t")), 1); fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_lalign(obj, FL_ALIGN_TOP_LEFT); - fl_set_object_callback(obj, C_FormTabularInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, 0); fdui->radio_border_bottom = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 85, 75, 25, 25, idex(_("Bottom|#b"))); fl_set_button_shortcut(obj, scex(_("Bottom|#b")), 1); fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_lalign(obj, FL_ALIGN_BOTTOM_LEFT); - fl_set_object_callback(obj, C_FormTabularInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, 0); fdui->radio_border_left = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 65, 60, 25, 25, idex(_("Left|#l"))); fl_set_button_shortcut(obj, scex(_("Left|#l")), 1); fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_lalign(obj, FL_ALIGN_LEFT); - fl_set_object_callback(obj, C_FormTabularInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, 0); fdui->radio_border_right = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 105, 60, 25, 25, idex(_("Right|#r"))); fl_set_button_shortcut(obj, scex(_("Right|#r")), 1); fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_lalign(obj, FL_ALIGN_RIGHT); - fl_set_object_callback(obj, C_FormTabularInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, 0); obj = fl_add_frame(FL_ENGRAVED_FRAME, 200, 20, 130, 105, ""); fl_set_object_color(obj, FL_COL1, FL_COL1); obj = fl_add_text(FL_NORMAL_TEXT, 205, 10, 115, 20, _("H. Alignment")); @@ -158,18 +158,18 @@ FD_form_column_options * FormTabular::build_column_options() fdui->radio_align_left = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 205, 30, 110, 25, idex(_("Left|#e"))); fl_set_button_shortcut(obj, scex(_("Left|#e")), 1); fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, C_FormTabularInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, 0); fdui->radio_align_right = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 205, 80, 115, 25, idex(_("Right|#i"))); fl_set_button_shortcut(obj, scex(_("Right|#i")), 1); fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, C_FormTabularInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, 0); fdui->radio_align_center = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 205, 55, 115, 25, idex(_("Center|#c"))); fl_set_button_shortcut(obj, scex(_("Center|#c")), 1); fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, C_FormTabularInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, 0); fdui->input_column_width = obj = fl_add_input(FL_NORMAL_INPUT, 375, 150, 95, 30, _("Width of column:")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, C_FormTabularInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, 0); obj = fl_add_frame(FL_ENGRAVED_FRAME, 340, 20, 130, 105, ""); fl_set_object_color(obj, FL_COL1, FL_COL1); obj = fl_add_text(FL_NORMAL_TEXT, 345, 10, 115, 20, _("V. Alignment")); @@ -181,7 +181,7 @@ FD_form_column_options * FormTabular::build_column_options() fl_set_object_lsize(obj, FL_NORMAL_SIZE); fdui->input_special_alignment = obj = fl_add_input(FL_NORMAL_INPUT, 30, 150, 200, 30, ""); fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, C_FormTabularInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, 0); obj = fl_add_text(FL_NORMAL_TEXT, 25, 130, 170, 20, _("Special Column Alignment")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE); @@ -189,15 +189,15 @@ FD_form_column_options * FormTabular::build_column_options() fdui->radio_valign_top = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 345, 30, 125, 25, idex(_("Top|#p"))); fl_set_button_shortcut(obj, scex(_("Top|#p")), 1); fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, C_FormTabularInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, 0); fdui->radio_valign_center = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 345, 55, 125, 25, idex(_("Center|#n"))); fl_set_button_shortcut(obj, scex(_("Center|#n")), 1); fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, C_FormTabularInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, 0); fdui->radio_valign_bottom = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 345, 80, 120, 25, idex(_("Bottom|#o"))); fl_set_button_shortcut(obj, scex(_("Bottom|#o")), 1); fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, C_FormTabularInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, 0); fl_end_form(); fdui->form->fdui = fdui; @@ -246,69 +246,69 @@ FD_form_cell_options * FormTabular::build_cell_options() fl_set_object_lstyle(obj, FL_BOLD_STYLE); fdui->radio_multicolumn = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 10, 25, 145, 25, idex(_("Multicolumn|#M"))); fl_set_button_shortcut(obj, scex(_("Multicolumn|#M")), 1); - fl_set_object_callback(obj, C_FormTabularInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, 0); fdui->radio_rotate_cell = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 10, 75, 145, 25, _("Rotate 90°")); - fl_set_object_callback(obj, C_FormTabularInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, 0); obj = fl_add_frame(FL_ENGRAVED_FRAME, 165, 15, 325, 90, ""); fl_set_object_color(obj, FL_COL1, FL_COL1); fl_set_object_lsize(obj, FL_NORMAL_SIZE); fdui->input_special_multialign = obj = fl_add_input(FL_NORMAL_INPUT, 175, 30, 310, 30, ""); fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, C_FormTabularInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, 0); obj = fl_add_text(FL_NORMAL_TEXT, 170, 5, 290, 20, _("Special Multicolumn Alignment")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE); fl_set_object_lstyle(obj, FL_BOLD_STYLE); fdui->input_mcolumn_width = obj = fl_add_input(FL_NORMAL_INPUT, 360, 65, 125, 30, _("Width of multi-column:")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, C_FormTabularInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, 0); fdui->radio_border_top = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 75, 140, 25, 25, idex(_("Top|#t"))); fl_set_button_shortcut(obj, scex(_("Top|#t")), 1); fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_lalign(obj, FL_ALIGN_TOP_LEFT); - fl_set_object_callback(obj, C_FormTabularInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, 0); fdui->radio_border_bottom = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 75, 170, 25, 25, idex(_("Bottom|#b"))); fl_set_button_shortcut(obj, scex(_("Bottom|#b")), 1); fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_lalign(obj, FL_ALIGN_BOTTOM_LEFT); - fl_set_object_callback(obj, C_FormTabularInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, 0); fdui->radio_border_left = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 55, 155, 25, 25, idex(_("Left|#l"))); fl_set_button_shortcut(obj, scex(_("Left|#l")), 1); fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_lalign(obj, FL_ALIGN_LEFT); - fl_set_object_callback(obj, C_FormTabularInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, 0); fdui->radio_border_right = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 95, 155, 25, 25, idex(_("Right|#r"))); fl_set_button_shortcut(obj, scex(_("Right|#r")), 1); fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_lalign(obj, FL_ALIGN_RIGHT); - fl_set_object_callback(obj, C_FormTabularInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, 0); fdui->radio_align_left = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 195, 125, 110, 25, idex(_("Left|#e"))); fl_set_button_shortcut(obj, scex(_("Left|#e")), 1); fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, C_FormTabularInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, 0); fdui->radio_align_right = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 195, 175, 115, 25, idex(_("Right|#i"))); fl_set_button_shortcut(obj, scex(_("Right|#i")), 1); fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, C_FormTabularInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, 0); fdui->radio_align_center = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 195, 150, 115, 25, idex(_("Center|#c"))); fl_set_button_shortcut(obj, scex(_("Center|#c")), 1); fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, C_FormTabularInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, 0); fdui->radio_valign_top = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 345, 125, 140, 25, idex(_("Top|#p"))); fl_set_button_shortcut(obj, scex(_("Top|#p")), 1); fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, C_FormTabularInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, 0); fdui->radio_valign_center = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 345, 150, 140, 25, idex(_("Center|#n"))); fl_set_button_shortcut(obj, scex(_("Center|#n")), 1); fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, C_FormTabularInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, 0); fdui->radio_valign_bottom = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 345, 175, 140, 25, idex(_("Bottom|#o"))); fl_set_button_shortcut(obj, scex(_("Bottom|#o")), 1); fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, C_FormTabularInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, 0); fdui->radio_useminipage = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 10, 50, 145, 25, idex(_("Use Minipage|#s"))); fl_set_button_shortcut(obj, scex(_("Use Minipage|#s")), 1); - fl_set_object_callback(obj, C_FormTabularInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, 0); fl_end_form(); fdui->form->fdui = fdui; @@ -338,67 +338,25 @@ FD_form_longtable_options * FormTabular::build_longtable_options() fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE); fl_set_object_lstyle(obj, FL_BOLD_STYLE); fdui->radio_lt_firsthead = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 15, 30, 90, 25, _("First Head")); - fl_set_object_callback(obj, C_FormTabularInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, 0); fdui->radio_lt_head = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 15, 60, 90, 25, _("Head")); - fl_set_object_callback(obj, C_FormTabularInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, 0); obj = fl_add_frame(FL_ENGRAVED_FRAME, 130, 20, 100, 75, ""); obj = fl_add_text(FL_NORMAL_TEXT, 135, 10, 85, 20, _("Footer")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE); fl_set_object_lstyle(obj, FL_BOLD_STYLE); fdui->radio_lt_foot = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 135, 30, 90, 25, _("Foot")); - fl_set_object_callback(obj, C_FormTabularInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, 0); fdui->radio_lt_lastfoot = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 135, 60, 90, 25, _("Last Foot")); - fl_set_object_callback(obj, C_FormTabularInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, 0); obj = fl_add_frame(FL_ENGRAVED_FRAME, 245, 20, 95, 75, ""); obj = fl_add_text(FL_NORMAL_TEXT, 250, 10, 85, 20, _("Special")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE); fl_set_object_lstyle(obj, FL_BOLD_STYLE); fdui->radio_lt_newpage = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 250, 30, 90, 25, _("New Page")); - fl_set_object_callback(obj, C_FormTabularInputCB, 0); - fl_end_form(); - - fdui->form->fdui = fdui; - - return fdui; -} -/*---------------------------------------*/ - -FD_form_create_tabular::~FD_form_create_tabular() -{ - if( form->visible ) fl_hide_form( form ); - fl_free_form( form ); -} - - -FD_form_create_tabular * FormTabular::build_create_tabular() -{ - FL_OBJECT *obj; - FD_form_create_tabular *fdui = new FD_form_create_tabular; - - fdui->form = fl_bgn_form(FL_NO_BOX, 310, 130); - fdui->form->u_vdata = this; - obj = fl_add_box(FL_UP_BOX, 0, 0, 310, 130, ""); - fdui->button_ok = obj = fl_add_button(FL_RETURN_BUTTON, 10, 90, 90, 30, _("OK")); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, C_FormTabularOKCB, 0); - fdui->button_apply = obj = fl_add_button(FL_NORMAL_BUTTON, 110, 90, 90, 30, idex(_("Apply|#A"))); - fl_set_button_shortcut(obj, scex(_("Apply|#A")), 1); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, C_FormTabularApplyCB, 0); - fdui->button_cancel = obj = fl_add_button(FL_NORMAL_BUTTON, 210, 90, 90, 30, idex(_("Cancel|^["))); - fl_set_button_shortcut(obj, scex(_("Cancel|^[")), 1); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, C_FormTabularCancelCB, 0); - fdui->slider_columns = obj = fl_add_valslider(FL_HOR_SLIDER, 80, 50, 220, 30, _("Columns")); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_lalign(obj, FL_ALIGN_LEFT); - fl_set_object_resize(obj, FL_RESIZE_X); - fdui->slider_rows = obj = fl_add_valslider(FL_HOR_SLIDER, 80, 10, 220, 30, _("Rows")); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_lalign(obj, FL_ALIGN_LEFT); - fl_set_object_resize(obj, FL_RESIZE_X); + fl_set_object_callback(obj, C_FormBaseInputCB, 0); fl_end_form(); fdui->form->fdui = fdui; diff --git a/src/frontends/xforms/form_tabular.h b/src/frontends/xforms/form_tabular.h index ab59e23360..b888f02f7e 100644 --- a/src/frontends/xforms/form_tabular.h +++ b/src/frontends/xforms/form_tabular.h @@ -5,19 +5,15 @@ #define FD_form_tabular_h_ /** Callbacks, globals and object handlers **/ -extern "C" void C_FormTabularCloseCB(FL_OBJECT *, long); +extern "C" void C_FormBaseCancelCB(FL_OBJECT *, long); -extern "C" void C_FormTabularInputCB(FL_OBJECT *, long); +extern "C" void C_FormBaseInputCB(FL_OBJECT *, long); -extern "C" void C_FormTabularInputCB(FL_OBJECT *, long); +extern "C" void C_FormBaseInputCB(FL_OBJECT *, long); -extern "C" void C_FormTabularInputCB(FL_OBJECT *, long); +extern "C" void C_FormBaseInputCB(FL_OBJECT *, long); -extern "C" void C_FormTabularInputCB(FL_OBJECT *, long); - -extern "C" void C_FormTabularOKCB(FL_OBJECT *, long); -extern "C" void C_FormTabularApplyCB(FL_OBJECT *, long); -extern "C" void C_FormTabularCancelCB(FL_OBJECT *, long); +extern "C" void C_FormBaseInputCB(FL_OBJECT *, long); /**** Forms and Objects ****/ @@ -91,15 +87,5 @@ struct FD_form_longtable_options { FL_OBJECT *radio_lt_lastfoot; FL_OBJECT *radio_lt_newpage; }; -struct FD_form_create_tabular { - ~FD_form_create_tabular(); - - FL_FORM *form; - FL_OBJECT *button_ok; - FL_OBJECT *button_apply; - FL_OBJECT *button_cancel; - FL_OBJECT *slider_columns; - FL_OBJECT *slider_rows; -}; #endif /* FD_form_tabular_h_ */ diff --git a/src/frontends/xforms/form_tabular_create.C b/src/frontends/xforms/form_tabular_create.C new file mode 100644 index 0000000000..18b72f8b74 --- /dev/null +++ b/src/frontends/xforms/form_tabular_create.C @@ -0,0 +1,54 @@ +// File modified by fdfix.sh for use by lyx (with xforms >= 0.88) and gettext +#include +#include "lyx_gui_misc.h" +#include "gettext.h" + +/* Form definition file generated with fdesign. */ + +#include FORMS_H_LOCATION +#include +#include "form_tabular_create.h" +#include "FormTabularCreate.h" + +FD_form_tabular_create::~FD_form_tabular_create() +{ + if( form->visible ) fl_hide_form( form ); + fl_free_form( form ); +} + + +FD_form_tabular_create * FormTabularCreate::build_tabular_create() +{ + FL_OBJECT *obj; + FD_form_tabular_create *fdui = new FD_form_tabular_create; + + fdui->form = fl_bgn_form(FL_NO_BOX, 310, 130); + fdui->form->u_vdata = this; + obj = fl_add_box(FL_UP_BOX, 0, 0, 310, 130, ""); + fdui->button_ok = obj = fl_add_button(FL_RETURN_BUTTON, 10, 90, 90, 30, _("OK")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, C_FormBaseOKCB, 0); + fdui->button_apply = obj = fl_add_button(FL_NORMAL_BUTTON, 110, 90, 90, 30, idex(_("Apply|#A"))); + fl_set_button_shortcut(obj, scex(_("Apply|#A")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, C_FormBaseApplyCB, 0); + fdui->button_cancel = obj = fl_add_button(FL_NORMAL_BUTTON, 210, 90, 90, 30, idex(_("Cancel|^["))); + fl_set_button_shortcut(obj, scex(_("Cancel|^[")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, C_FormBaseCancelCB, 0); + fdui->slider_columns = obj = fl_add_valslider(FL_HOR_SLIDER, 80, 50, 220, 30, _("Columns")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_LEFT); + fl_set_object_resize(obj, FL_RESIZE_X); + fdui->slider_rows = obj = fl_add_valslider(FL_HOR_SLIDER, 80, 10, 220, 30, _("Rows")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_LEFT); + fl_set_object_resize(obj, FL_RESIZE_X); + fl_end_form(); + + fdui->form->fdui = fdui; + + return fdui; +} +/*---------------------------------------*/ + diff --git a/src/frontends/xforms/form_tabular_create.h b/src/frontends/xforms/form_tabular_create.h new file mode 100644 index 0000000000..677c9ac1f2 --- /dev/null +++ b/src/frontends/xforms/form_tabular_create.h @@ -0,0 +1,25 @@ +// File modified by fdfix.sh for use by lyx (with xforms >= 0.88) and gettext +/** Header file generated with fdesign **/ + +#ifndef FD_form_tabular_create_h_ +#define FD_form_tabular_create_h_ + +/** Callbacks, globals and object handlers **/ +extern "C" void C_FormBaseOKCB(FL_OBJECT *, long); +extern "C" void C_FormBaseApplyCB(FL_OBJECT *, long); +extern "C" void C_FormBaseCancelCB(FL_OBJECT *, long); + + +/**** Forms and Objects ****/ +struct FD_form_tabular_create { + ~FD_form_tabular_create(); + + FL_FORM *form; + FL_OBJECT *button_ok; + FL_OBJECT *button_apply; + FL_OBJECT *button_cancel; + FL_OBJECT *slider_columns; + FL_OBJECT *slider_rows; +}; + +#endif /* FD_form_tabular_create_h_ */ diff --git a/src/frontends/xforms/forms/fdfix.sh b/src/frontends/xforms/forms/fdfix.sh index 550dc6818a..d381dede0a 100644 --- a/src/frontends/xforms/forms/fdfix.sh +++ b/src/frontends/xforms/forms/fdfix.sh @@ -10,51 +10,70 @@ if [ ! -f $1 ]; then fi FDESIGN=fdesign -base=`basename $1 .fd` -if [ $1 = $base ]; then +# names of the files generated by fdesign and by running the sed scripts +BASE=`basename $1 .fd` + +if [ $1 = $BASE ]; then echo "Input file is not a .fd file. Cannot continue" exit 1 fi -cin=$base.c -cout=$base.C -hin=$base.h -hout=$base.H +CIN=$BASE.c +COUT=$BASE.C +HIN=$BASE.h +HOUT=$BASE.H + +# Ascertain the class name from the name of the file +# eg form_my_new_dialog -> FormMyNewDialog +CLASSNAME="" +SECTION="start" +i=1 +while : +do + SECTION=`echo $BASE | cut -d_ -f$i` + i=`expr $i + 1 ` -classname=`echo $base | cut -c6-` -firstchar=`echo $classname | cut -c1 | tr a-z A-Z` -rest=`echo $classname | cut -c2-` -classname=Form$firstchar$rest + if [ $SECTION ] + then + FIRST=`echo $SECTION | cut -c1 | tr a-z A-Z` + SECOND=`echo $SECTION | cut -c2-` + CLASSNAME=$CLASSNAME$FIRST$SECOND + else + break + fi +done # Create .c and .h files $FDESIGN -convert $1 +FDFIXH=fdfixh.sed +FDFIXC=fdfixc.sed # Modify .h file for use by LyX -echo "// File modified by fdfix.sh for use by lyx (with xforms >= 0.88) and gettext" > $hout -sed -f fdfixh.sed < $hin >> $hout +echo "// File modified by fdfix.sh for use by lyx (with xforms >= 0.88) and gettext" > $HOUT +sed -f $FDFIXH < $HIN >> $HOUT # Patch the .h file if a patch exists -if [ -f "$hout.patch" ] ; then - echo "Patching $hout with $hout.patch" - patch -s $hout < $hout.patch +if [ -f "$HOUT.patch" ] ; then + echo "Patching $HOUT with $HOUT.patch" + patch -s $HOUT < $HOUT.patch fi # Modify .c file for use by LyX -echo "// File modified by fdfix.sh for use by lyx (with xforms >= 0.88) and gettext" > $cout -echo "#include " >> $cout -echo "#include \"lyx_gui_misc.h\"" >> $cout -echo "#include \"gettext.h\"" >> $cout -echo >> $cout +echo "// File modified by fdfix.sh for use by lyx (with xforms >= 0.88) and gettext" > $COUT +echo "#include " >> $COUT +echo "#include \"lyx_gui_misc.h\"" >> $COUT +echo "#include \"gettext.h\"" >> $COUT +echo >> $COUT -sed -f fdfixc.sed < $cin | sed -e "s/CLASSNAME/$classname/" >> $cout +sed -f $FDFIXC < $CIN | sed -e "s/CLASSNAME/$CLASSNAME/" >> $COUT # Patch the .C file if a patch exists -if [ -f "$cout.patch" ] ; then - echo "Patching $cout with $cout.patch" - patch -s $cout < $cout.patch +if [ -f "$COUT.patch" ] ; then + echo "Patching $COUT with $COUT.patch" + patch -s $COUT < $COUT.patch fi # Clean up, to leave .C and .h files -rm -f $cin $hin -mv $hout $hin +rm -f $CIN $HIN +mv $HOUT $HIN diff --git a/src/frontends/xforms/forms/form_graphics.fd b/src/frontends/xforms/forms/form_graphics.fd index 0707cc314a..8c18887180 100644 --- a/src/frontends/xforms/forms/form_graphics.fd +++ b/src/frontends/xforms/forms/form_graphics.fd @@ -24,8 +24,8 @@ size: FL_NORMAL_SIZE lcol: FL_BLACK label: shortcut: -resize: FL_RESIZE_NONE -gravity: FL_NoGravity FL_NoGravity +resize: FL_RESIZE_ALL +gravity: FL_NorthWest FL_SouthEast name: callback: argument: @@ -81,8 +81,8 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: input_filename -callback: C_FormGraphicsInputCB -argument: 0 +callback: C_FormBaseInputCB +argument: CHECKINPUT -------------------- class: FL_BUTTON @@ -99,8 +99,8 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: button_browse -callback: C_FormGraphicsBrowseCB -argument: 0 +callback: C_FormBaseInputCB +argument: BROWSE -------------------- class: FL_LABELFRAME @@ -153,8 +153,8 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: input_width -callback: C_FormGraphicsInputCB -argument: 0 +callback: C_FormBaseInputCB +argument: CHECKINPUT -------------------- class: FL_INPUT @@ -171,8 +171,8 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: input_height -callback: C_FormGraphicsInputCB -argument: 0 +callback: C_FormBaseInputCB +argument: CHECKINPUT -------------------- class: FL_LABELFRAME @@ -207,7 +207,7 @@ shortcut: ^M resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: button_ok -callback: C_FormGraphicsOKCB +callback: C_FormBaseOKCB argument: 0 -------------------- @@ -225,7 +225,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: button_apply -callback: C_FormGraphicsApplyCB +callback: C_FormBaseApplyCB argument: 0 -------------------- @@ -243,7 +243,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: button_cancel -callback: C_FormGraphicsCancelCB +callback: C_FormBaseCancelCB argument: 0 -------------------- @@ -279,8 +279,8 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: radio_width_percent_page -callback: C_FormGraphicsInputCB -argument: 0 +callback: C_FormBaseInputCB +argument: CHECKINPUT -------------------- class: FL_CHECKBUTTON @@ -297,8 +297,8 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: radio_width_default -callback: C_FormGraphicsInputCB -argument: 0 +callback: C_FormBaseInputCB +argument: CHECKINPUT value: 1 -------------------- @@ -316,8 +316,8 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: radio_width_cm -callback: C_FormGraphicsInputCB -argument: 0 +callback: C_FormBaseInputCB +argument: CHECKINPUT -------------------- class: FL_CHECKBUTTON @@ -334,8 +334,8 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: radio_width_inch -callback: C_FormGraphicsInputCB -argument: 0 +callback: C_FormBaseInputCB +argument: CHECKINPUT -------------------- class: FL_CHECKBUTTON @@ -352,8 +352,8 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: radio_width_percent_column -callback: C_FormGraphicsInputCB -argument: 0 +callback: C_FormBaseInputCB +argument: CHECKINPUT -------------------- class: FL_END_GROUP @@ -406,8 +406,8 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: radio_height_percent_page -callback: C_FormGraphicsInputCB -argument: 0 +callback: C_FormBaseInputCB +argument: CHECKINPUT -------------------- class: FL_CHECKBUTTON @@ -424,8 +424,8 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: radio_height_inch -callback: C_FormGraphicsInputCB -argument: 0 +callback: C_FormBaseInputCB +argument: CHECKINPUT -------------------- class: FL_CHECKBUTTON @@ -442,8 +442,8 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: radio_height_cm -callback: C_FormGraphicsInputCB -argument: 0 +callback: C_FormBaseInputCB +argument: CHECKINPUT -------------------- class: FL_CHECKBUTTON @@ -460,8 +460,8 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: radio_height_default -callback: C_FormGraphicsInputCB -argument: 0 +callback: C_FormBaseInputCB +argument: CHECKINPUT value: 1 -------------------- @@ -624,8 +624,8 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: input_rotate_angle -callback: C_FormGraphicsInputCB -argument: 0 +callback: C_FormBaseInputCB +argument: CHECKINPUT -------------------- class: FL_CHECKBUTTON @@ -642,8 +642,8 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: check_inline -callback: C_FormGraphicsInputCB -argument: 0 +callback: C_FormBaseInputCB +argument: CHECKINPUT -------------------- class: FL_INPUT @@ -660,8 +660,8 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: input_subcaption -callback: C_FormGraphicsInputCB -argument: 0 +callback: C_FormBaseInputCB +argument: CHECKINPUT -------------------- class: FL_CHECKBUTTON @@ -678,8 +678,8 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: check_subcaption -callback: C_FormGraphicsInputCB -argument: 0 +callback: C_FormBaseInputCB +argument: CHECKINPUT ============================== create_the_forms diff --git a/src/frontends/xforms/forms/form_tabular.fd b/src/frontends/xforms/forms/form_tabular.fd index 8b2f61982f..c5a51a3ef5 100644 --- a/src/frontends/xforms/forms/form_tabular.fd +++ b/src/frontends/xforms/forms/form_tabular.fd @@ -3,7 +3,7 @@ Magic: 13000 Internal Form Definition File (do not change) -Number of forms: 6 +Number of forms: 5 Unit of measure: FL_COORD_PIXEL SnapGrid: 5 @@ -64,7 +64,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: button_close -callback: C_FormTabularCloseCB +callback: C_FormBaseCancelCB argument: 0 -------------------- @@ -178,7 +178,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: button_append_column -callback: C_FormTabularInputCB +callback: C_FormBaseInputCB argument: 0 -------------------- @@ -196,7 +196,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: button_delete_column -callback: C_FormTabularInputCB +callback: C_FormBaseInputCB argument: 0 -------------------- @@ -214,7 +214,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: button_append_row -callback: C_FormTabularInputCB +callback: C_FormBaseInputCB argument: 0 -------------------- @@ -232,7 +232,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: button_delete_row -callback: C_FormTabularInputCB +callback: C_FormBaseInputCB argument: 0 -------------------- @@ -250,7 +250,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: button_set_borders -callback: C_FormTabularInputCB +callback: C_FormBaseInputCB argument: 0 -------------------- @@ -268,7 +268,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: button_unset_borders -callback: C_FormTabularInputCB +callback: C_FormBaseInputCB argument: 0 -------------------- @@ -286,7 +286,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: radio_longtable -callback: C_FormTabularInputCB +callback: C_FormBaseInputCB argument: 0 -------------------- @@ -304,7 +304,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: radio_rotate_tabular -callback: C_FormTabularInputCB +callback: C_FormBaseInputCB argument: 0 -------------------- @@ -400,7 +400,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: radio_border_top -callback: C_FormTabularInputCB +callback: C_FormBaseInputCB argument: 0 -------------------- @@ -418,7 +418,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: radio_border_bottom -callback: C_FormTabularInputCB +callback: C_FormBaseInputCB argument: 0 -------------------- @@ -436,7 +436,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: radio_border_left -callback: C_FormTabularInputCB +callback: C_FormBaseInputCB argument: 0 -------------------- @@ -454,7 +454,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: radio_border_right -callback: C_FormTabularInputCB +callback: C_FormBaseInputCB argument: 0 -------------------- @@ -508,7 +508,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: radio_align_left -callback: C_FormTabularInputCB +callback: C_FormBaseInputCB argument: 0 -------------------- @@ -526,7 +526,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: radio_align_right -callback: C_FormTabularInputCB +callback: C_FormBaseInputCB argument: 0 -------------------- @@ -544,7 +544,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: radio_align_center -callback: C_FormTabularInputCB +callback: C_FormBaseInputCB argument: 0 -------------------- @@ -562,7 +562,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: input_column_width -callback: C_FormTabularInputCB +callback: C_FormBaseInputCB argument: 0 -------------------- @@ -634,7 +634,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: input_special_alignment -callback: C_FormTabularInputCB +callback: C_FormBaseInputCB argument: 0 -------------------- @@ -670,7 +670,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: radio_valign_top -callback: C_FormTabularInputCB +callback: C_FormBaseInputCB argument: 0 -------------------- @@ -688,7 +688,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: radio_valign_center -callback: C_FormTabularInputCB +callback: C_FormBaseInputCB argument: 0 -------------------- @@ -706,7 +706,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: radio_valign_bottom -callback: C_FormTabularInputCB +callback: C_FormBaseInputCB argument: 0 =============== FORM =============== @@ -892,7 +892,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: radio_multicolumn -callback: C_FormTabularInputCB +callback: C_FormBaseInputCB argument: 0 -------------------- @@ -910,7 +910,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: radio_rotate_cell -callback: C_FormTabularInputCB +callback: C_FormBaseInputCB argument: 0 -------------------- @@ -946,7 +946,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: input_special_multialign -callback: C_FormTabularInputCB +callback: C_FormBaseInputCB argument: 0 -------------------- @@ -982,7 +982,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: input_mcolumn_width -callback: C_FormTabularInputCB +callback: C_FormBaseInputCB argument: 0 -------------------- @@ -1000,7 +1000,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: radio_border_top -callback: C_FormTabularInputCB +callback: C_FormBaseInputCB argument: 0 -------------------- @@ -1018,7 +1018,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: radio_border_bottom -callback: C_FormTabularInputCB +callback: C_FormBaseInputCB argument: 0 -------------------- @@ -1036,7 +1036,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: radio_border_left -callback: C_FormTabularInputCB +callback: C_FormBaseInputCB argument: 0 -------------------- @@ -1054,7 +1054,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: radio_border_right -callback: C_FormTabularInputCB +callback: C_FormBaseInputCB argument: 0 -------------------- @@ -1072,7 +1072,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: radio_align_left -callback: C_FormTabularInputCB +callback: C_FormBaseInputCB argument: 0 -------------------- @@ -1090,7 +1090,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: radio_align_right -callback: C_FormTabularInputCB +callback: C_FormBaseInputCB argument: 0 -------------------- @@ -1108,7 +1108,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: radio_align_center -callback: C_FormTabularInputCB +callback: C_FormBaseInputCB argument: 0 -------------------- @@ -1126,7 +1126,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: radio_valign_top -callback: C_FormTabularInputCB +callback: C_FormBaseInputCB argument: 0 -------------------- @@ -1144,7 +1144,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: radio_valign_center -callback: C_FormTabularInputCB +callback: C_FormBaseInputCB argument: 0 -------------------- @@ -1162,7 +1162,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: radio_valign_bottom -callback: C_FormTabularInputCB +callback: C_FormBaseInputCB argument: 0 -------------------- @@ -1180,7 +1180,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: radio_useminipage -callback: C_FormTabularInputCB +callback: C_FormBaseInputCB argument: 0 =============== FORM =============== @@ -1258,7 +1258,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: radio_lt_firsthead -callback: C_FormTabularInputCB +callback: C_FormBaseInputCB argument: 0 -------------------- @@ -1276,7 +1276,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: radio_lt_head -callback: C_FormTabularInputCB +callback: C_FormBaseInputCB argument: 0 -------------------- @@ -1330,7 +1330,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: radio_lt_foot -callback: C_FormTabularInputCB +callback: C_FormBaseInputCB argument: 0 -------------------- @@ -1348,7 +1348,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: radio_lt_lastfoot -callback: C_FormTabularInputCB +callback: C_FormBaseInputCB argument: 0 -------------------- @@ -1402,122 +1402,8 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: radio_lt_newpage -callback: C_FormTabularInputCB +callback: C_FormBaseInputCB argument: 0 -=============== FORM =============== -Name: form_create_tabular -Width: 310 -Height: 130 -Number of Objects: 6 - --------------------- -class: FL_BOX -type: UP_BOX -box: 0 0 310 130 -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_BUTTON -type: RETURN_BUTTON -box: 10 90 90 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: OK -shortcut: ^M -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: button_ok -callback: C_FormTabularOKCB -argument: 0 - --------------------- -class: FL_BUTTON -type: NORMAL_BUTTON -box: 110 90 90 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: Apply|#A -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: button_apply -callback: C_FormTabularApplyCB -argument: 0 - --------------------- -class: FL_BUTTON -type: NORMAL_BUTTON -box: 210 90 90 30 -boxtype: FL_UP_BOX -colors: FL_COL1 FL_COL1 -alignment: FL_ALIGN_CENTER -style: FL_NORMAL_STYLE -size: FL_NORMAL_SIZE -lcol: FL_BLACK -label: Cancel|^[ -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: button_cancel -callback: C_FormTabularCancelCB -argument: 0 - --------------------- -class: FL_VALSLIDER -type: HOR_SLIDER -box: 80 50 220 30 -boxtype: FL_DOWN_BOX -colors: FL_COL1 FL_COL1 -alignment: FL_ALIGN_LEFT -style: FL_NORMAL_STYLE -size: FL_NORMAL_SIZE -lcol: FL_BLACK -label: Columns -shortcut: -resize: FL_RESIZE_X -gravity: FL_NoGravity FL_NoGravity -name: slider_columns -callback: -argument: - --------------------- -class: FL_VALSLIDER -type: HOR_SLIDER -box: 80 10 220 30 -boxtype: FL_DOWN_BOX -colors: FL_COL1 FL_COL1 -alignment: FL_ALIGN_LEFT -style: FL_NORMAL_STYLE -size: FL_NORMAL_SIZE -lcol: FL_BLACK -label: Rows -shortcut: -resize: FL_RESIZE_X -gravity: FL_NoGravity FL_NoGravity -name: slider_rows -callback: -argument: - ============================== create_the_forms diff --git a/src/frontends/xforms/forms/form_tabular_create.fd b/src/frontends/xforms/forms/form_tabular_create.fd new file mode 100644 index 0000000000..838c000b14 --- /dev/null +++ b/src/frontends/xforms/forms/form_tabular_create.fd @@ -0,0 +1,125 @@ +Magic: 13000 + +Internal Form Definition File + (do not change) + +Number of forms: 1 +Unit of measure: FL_COORD_PIXEL +SnapGrid: 5 + +=============== FORM =============== +Name: form_tabular_create +Width: 310 +Height: 130 +Number of Objects: 6 + +-------------------- +class: FL_BOX +type: UP_BOX +box: 0 0 310 130 +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_BUTTON +type: RETURN_BUTTON +box: 10 90 90 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: OK +shortcut: ^M +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: button_ok +callback: C_FormBaseOKCB +argument: 0 + +-------------------- +class: FL_BUTTON +type: NORMAL_BUTTON +box: 110 90 90 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: Apply|#A +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: button_apply +callback: C_FormBaseApplyCB +argument: 0 + +-------------------- +class: FL_BUTTON +type: NORMAL_BUTTON +box: 210 90 90 30 +boxtype: FL_UP_BOX +colors: FL_COL1 FL_COL1 +alignment: FL_ALIGN_CENTER +style: FL_NORMAL_STYLE +size: FL_NORMAL_SIZE +lcol: FL_BLACK +label: Cancel|^[ +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: button_cancel +callback: C_FormBaseCancelCB +argument: 0 + +-------------------- +class: FL_VALSLIDER +type: HOR_SLIDER +box: 80 50 220 30 +boxtype: FL_DOWN_BOX +colors: FL_COL1 FL_COL1 +alignment: FL_ALIGN_LEFT +style: FL_NORMAL_STYLE +size: FL_NORMAL_SIZE +lcol: FL_BLACK +label: Columns +shortcut: +resize: FL_RESIZE_X +gravity: FL_NoGravity FL_NoGravity +name: slider_columns +callback: +argument: + +-------------------- +class: FL_VALSLIDER +type: HOR_SLIDER +box: 80 10 220 30 +boxtype: FL_DOWN_BOX +colors: FL_COL1 FL_COL1 +alignment: FL_ALIGN_LEFT +style: FL_NORMAL_STYLE +size: FL_NORMAL_SIZE +lcol: FL_BLACK +label: Rows +shortcut: +resize: FL_RESIZE_X +gravity: FL_NoGravity FL_NoGravity +name: slider_rows +callback: +argument: + +============================== +create_the_forms diff --git a/src/frontends/xforms/forms/makefile b/src/frontends/xforms/forms/makefile index 6c24c3f9cb..f64419ea6f 100644 --- a/src/frontends/xforms/forms/makefile +++ b/src/frontends/xforms/forms/makefile @@ -31,6 +31,7 @@ SRCS := form_citation.fd \ form_print.fd \ form_ref.fd \ form_tabular.fd \ + form_tabular_create.fd \ form_toc.fd \ form_url.fd diff --git a/src/insets/insettabular.C b/src/insets/insettabular.C index 6e47e90b13..bed00cf7c8 100644 --- a/src/insets/insettabular.C +++ b/src/insets/insettabular.C @@ -132,7 +132,6 @@ InsetTabular::InsetTabular(Buffer const & buf, int rows, int columns) actcell = 0; cursor.pos(0); sel_pos_start = sel_pos_end = sel_cell_start = sel_cell_end = 0; - dialogs_ = 0; need_update = INIT; } @@ -148,7 +147,6 @@ InsetTabular::InsetTabular(InsetTabular const & tab, Buffer const & buf) actcell = 0; cursor.pos(0); sel_pos_start = sel_pos_end = sel_cell_start = sel_cell_end = 0; - dialogs_ = 0; need_update = INIT; } @@ -156,8 +154,7 @@ InsetTabular::InsetTabular(InsetTabular const & tab, Buffer const & buf) InsetTabular::~InsetTabular() { delete tabular; - if (dialogs_) - dialogs_->hideTabular(this); + hideDialog(); } @@ -534,9 +531,8 @@ bool InsetTabular::UnlockInsetInInset(BufferView * bv, UpdatableInset * inset, if (inset->LyxCode() == TABULAR_CODE && !the_locking_inset->GetFirstLockingInsetOfType(TABULAR_CODE)) { - dialogs_ = bv->owner()->getDialogs(); - dialogs_->updateTabular(this); - oldcell = actcell; + bv->owner()->getDialogs()->updateTabular(this); + oldcell = actcell; } return true; } @@ -639,8 +635,7 @@ void InsetTabular::InsetButtonRelease(BufferView * bv, return; } } - dialogs_ = bv->owner()->getDialogs(); - dialogs_->showTabular(this); + bv->owner()->getDialogs()->showTabular(this); return; } if (the_locking_inset) { @@ -848,8 +843,7 @@ UpdatableInset::RESULT InsetTabular::LocalDispatch(BufferView * bv, int action, break; case LFUN_LAYOUT_TABULAR: { - dialogs_ = bv->owner()->getDialogs(); - dialogs_->showTabular(this); + bv->owner()->getDialogs()->showTabular(this); } break; case LFUN_TABULAR_FEATURE: @@ -1135,9 +1129,9 @@ void InsetTabular::resetPos(BufferView * bv) const if ((!the_locking_inset || !the_locking_inset->GetFirstLockingInsetOfType(TABULAR_CODE)) && (actcell != oldcell)) { - dialogs_ = bv->owner()->getDialogs(); - dialogs_->updateTabular(const_cast(this)); - oldcell = actcell; + InsetTabular * inset = const_cast(this); + bv->owner()->getDialogs()->updateTabular(inset); + oldcell = actcell; } } @@ -1673,8 +1667,7 @@ void InsetTabular::OpenLayoutDialog(BufferView * bv) const return; } } - dialogs_ = bv->owner()->getDialogs(); - dialogs_->showTabular(const_cast(this)); + bv->owner()->getDialogs()->showTabular(const_cast(this)); } // diff --git a/src/insets/insettabular.h b/src/insets/insettabular.h index 9cece3c890..39ee7b6bf6 100644 --- a/src/insets/insettabular.h +++ b/src/insets/insettabular.h @@ -54,12 +54,16 @@ #include "LString.h" #include "lyxcursor.h" #include "lyxfunc.h" +#include + +#ifdef SIGC_CXX_NAMESPACES +using SigC::Signal0; +#endif class LyXLex; class Painter; class BufferView; class Buffer; -class Dialogs; class InsetTabular : public UpdatableInset { public: @@ -174,6 +178,8 @@ public: // Public structures and variables /// LyXTabular * tabular; + /// + Signal0 hideDialog; private: /// @@ -268,7 +274,5 @@ private: mutable bool locked; /// mutable UpdateCodes need_update; - /// - mutable Dialogs * dialogs_; }; #endif diff --git a/src/support/lstrings.h b/src/support/lstrings.h index cc3e88acda..963a5779fd 100644 --- a/src/support/lstrings.h +++ b/src/support/lstrings.h @@ -70,7 +70,7 @@ template inline string const tostr(T const & t) { - std::ostringstream ostr; + ostringstream ostr; ostr << t; return ostr.str().c_str(); // We need to use the .c_str since we sometimes are using -- 2.39.2