From 09383c6e55612a7268efc7222cbe266b13fe2b43 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Lars=20Gullik=20Bj=C3=B8nnes?= Date: Tue, 20 Feb 2001 13:34:05 +0000 Subject: [PATCH] preamble2.diff.gz git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1567 a592a061-630c-0410-9148-cb99ea01b6c8 --- ChangeLog | 6 ++ po/POTFILES.in | 36 +++---- src/ChangeLog | 10 ++ src/frontends/xforms/ChangeLog | 10 ++ src/frontends/xforms/Dialogs.C | 2 + src/frontends/xforms/FormPreamble.C | 102 +++++++++++++++++++ src/frontends/xforms/FormPreamble.h | 49 +++++++++ src/frontends/xforms/Makefile.am | 4 + src/frontends/xforms/form_preamble.C | 63 ++++++++++++ src/frontends/xforms/form_preamble.h | 25 +++++ src/frontends/xforms/forms/form_preamble.fd | 107 ++++++++++++++++++++ src/layout_forms.C | 30 ------ src/layout_forms.h | 16 --- src/lyx_cb.C | 82 --------------- src/lyx_cb.h | 4 - src/lyx_gui.C | 6 -- src/lyx_gui_misc.C | 10 -- src/lyxfunc.C | 2 +- 18 files changed, 398 insertions(+), 166 deletions(-) create mode 100644 src/frontends/xforms/FormPreamble.C create mode 100644 src/frontends/xforms/FormPreamble.h create mode 100644 src/frontends/xforms/form_preamble.C create mode 100644 src/frontends/xforms/form_preamble.h create mode 100644 src/frontends/xforms/forms/form_preamble.fd diff --git a/ChangeLog b/ChangeLog index f1dfc5a913..f85839e527 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2001-02-20 Edwin Leuven + + * move latex preamble to guii xforms dir, see: + * src/ChangeLog + * src/frontends/xforms/ChangeLog + 2001-02-13 Lars Gullik Bjønnes * autogen.sh (AUTOCONF): use spaces insteadt of '\t' for echo diff --git a/po/POTFILES.in b/po/POTFILES.in index 3b7b1bd1e4..ead986dd4a 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -71,44 +71,46 @@ src/frontends/qt2/FormTabularCreate.C src/frontends/qt2/paragraphdlgimpl.C src/frontends/qt2/tabularcreatedlgimpl.C src/frontends/xforms/FormBase.h -src/frontends/xforms/FormBibitem.C src/frontends/xforms/form_bibitem.C -src/frontends/xforms/FormBibtex.C +src/frontends/xforms/FormBibitem.C src/frontends/xforms/form_bibtex.C +src/frontends/xforms/FormBibtex.C src/frontends/xforms/form_browser.C -src/frontends/xforms/FormCitation.C src/frontends/xforms/form_citation.C -src/frontends/xforms/FormCopyright.C +src/frontends/xforms/FormCitation.C src/frontends/xforms/form_copyright.C -src/frontends/xforms/FormDocument.C +src/frontends/xforms/FormCopyright.C src/frontends/xforms/form_document.C -src/frontends/xforms/FormError.C +src/frontends/xforms/FormDocument.C src/frontends/xforms/form_error.C -src/frontends/xforms/FormGraphics.C +src/frontends/xforms/FormError.C src/frontends/xforms/form_graphics.C -src/frontends/xforms/FormInclude.C +src/frontends/xforms/FormGraphics.C src/frontends/xforms/form_include.C -src/frontends/xforms/FormIndex.C +src/frontends/xforms/FormInclude.C src/frontends/xforms/form_index.C +src/frontends/xforms/FormIndex.C src/frontends/xforms/FormInset.h src/frontends/xforms/FormLog.C -src/frontends/xforms/FormParagraph.C src/frontends/xforms/form_paragraph.C -src/frontends/xforms/FormPreferences.C +src/frontends/xforms/FormParagraph.C +src/frontends/xforms/form_preamble.C +src/frontends/xforms/FormPreamble.C src/frontends/xforms/form_preferences.C -src/frontends/xforms/FormPrint.C +src/frontends/xforms/FormPreferences.C src/frontends/xforms/form_print.C -src/frontends/xforms/FormRef.C +src/frontends/xforms/FormPrint.C src/frontends/xforms/form_ref.C +src/frontends/xforms/FormRef.C src/frontends/xforms/FormSplash.C -src/frontends/xforms/FormTabular.C src/frontends/xforms/form_tabular.C -src/frontends/xforms/FormTabularCreate.C +src/frontends/xforms/FormTabular.C src/frontends/xforms/form_tabular_create.C -src/frontends/xforms/FormToc.C +src/frontends/xforms/FormTabularCreate.C src/frontends/xforms/form_toc.C -src/frontends/xforms/FormUrl.C +src/frontends/xforms/FormToc.C src/frontends/xforms/form_url.C +src/frontends/xforms/FormUrl.C src/frontends/xforms/FormVCLog.C src/frontends/xforms/input_validators.C src/frontends/xforms/Menubar_pimpl.C diff --git a/src/ChangeLog b/src/ChangeLog index 001068ecf9..66153a2338 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,13 @@ +2001-02-20 Edwin Leuven + + * src/layout_forms.C: out preamble + * src/layout_forms.h: out preamble + * src/lyx_cb.C: out preamble + * src/lyx_cb.h: out preamble + * src/lyx_gui.C: out preamble + * src/lyx_gui_misc.C: out preamble + * src/lyxfunc.C: connect with guii preamble + 2001-02-19 Angus Leeming * src/buffer.h: tiny clean-ups to allow compilation with DEC cxx. diff --git a/src/frontends/xforms/ChangeLog b/src/frontends/xforms/ChangeLog index ee597a0f36..d74a793638 100644 --- a/src/frontends/xforms/ChangeLog +++ b/src/frontends/xforms/ChangeLog @@ -1,3 +1,13 @@ +2001-02-20 Edwin Leuven + + * src/frontends/xforms/Dialogs.C: added preamble + * src/frontends/xforms/FormPreamble.C: added + * src/frontends/xforms/FormPreamble.h: added + * src/frontends/xforms/Makefile.am: added + * src/frontends/xforms/form_preamble.C: added + * src/frontends/xforms/form_preamble.h: added + * src/frontends/xforms/form_preamble.fd: added + 2001-02-19 Angus Leeming * FormBase.h: moved noncopyable derivation to DialogBase. diff --git a/src/frontends/xforms/Dialogs.C b/src/frontends/xforms/Dialogs.C index c24df64879..6bbabbe2e7 100644 --- a/src/frontends/xforms/Dialogs.C +++ b/src/frontends/xforms/Dialogs.C @@ -23,6 +23,7 @@ #include "FormIndex.h" #include "FormLog.h" #include "FormParagraph.h" +#include "FormPreamble.h" #include "FormPreferences.h" #include "FormPrint.h" #include "FormRef.h" @@ -61,6 +62,7 @@ Dialogs::Dialogs(LyXView * lv) dialogs_.push_back(new FormIndex(lv, this)); dialogs_.push_back(new FormLog(lv, this)); dialogs_.push_back(new FormParagraph(lv, this)); + dialogs_.push_back(new FormPreamble(lv, this)); dialogs_.push_back(new FormPreferences(lv, this)); dialogs_.push_back(new FormPrint(lv, this)); dialogs_.push_back(new FormRef(lv, this)); diff --git a/src/frontends/xforms/FormPreamble.C b/src/frontends/xforms/FormPreamble.C new file mode 100644 index 0000000000..1075d8a77b --- /dev/null +++ b/src/frontends/xforms/FormPreamble.C @@ -0,0 +1,102 @@ +/** + * \file FormPreamble.C + * Copyright 2001 The LyX Team. + * See the file COPYING. + * + * \author Edwin Leuven, leuven@fee.uva.nl + */ + +#include + +#include FORMS_H_LOCATION + +#include "form_preamble.h" +#include "FormPreamble.h" +#include "Dialogs.h" +#include "Liason.h" +#include "LyXView.h" +#include "buffer.h" +#include "gettext.h" + +#ifdef CXX_WORKING_NAMESPACES +using Liason::setMinibuffer; +#endif + +FormPreamble::FormPreamble(LyXView * lv, Dialogs * d) + : FormBaseBD(lv, d, _("LaTeX preamble"), new NoRepeatedApplyReadOnlyPolicy), + dialog_(0) +{ + // let the popup be shown + // This is a permanent connection so we won't bother + // storing a copy because we won't be disconnecting. + d->showPreamble.connect(slot(this, &FormPreamble::show)); +} + + +FormPreamble::~FormPreamble() +{ + delete dialog_; +} + + +FL_FORM * FormPreamble::form() const +{ + if (dialog_) return dialog_->form; + return 0; +} + +void FormPreamble::build() +{ + dialog_ = build_preamble(); + // Workaround dumb xforms sizing bug + minw_ = form()->w; + minh_ = form()->h; + + fl_set_input_return(dialog_->input_preamble, FL_RETURN_CHANGED); + // Manage the ok, apply and cancel/close buttons + bc_.setOK(dialog_->button_ok); + bc_.setApply(dialog_->button_apply); + bc_.setCancel(dialog_->button_cancel); + bc_.addReadOnly(dialog_->input_preamble); + bc_.refresh(); +} + +void FormPreamble::apply() +{ + if (!lv_->view()->available() || !dialog_) + return; + + // is this needed?: + // lv_->view()->update(BufferView::SELECT | BufferView::FITCUR | BufferView::CHANGE); + + lv_->buffer()->params.preamble = fl_get_input(dialog_->input_preamble); + lv_->buffer()->markDirty(); + setMinibuffer(lv_, _("LaTeX preamble set")); +} + + +void FormPreamble::update() +{ + if (!dialog_) + return; + + fl_set_input(dialog_->input_preamble,lv_->buffer()->params.preamble.c_str()); + if (lv_->buffer()->isReadonly()) { + fl_deactivate_object(dialog_->input_preamble); + fl_deactivate_object(dialog_->button_ok); + fl_deactivate_object(dialog_->button_apply); + fl_set_object_lcol(dialog_->button_ok, FL_INACTIVE); + fl_set_object_lcol(dialog_->button_apply, FL_INACTIVE); + } else { + fl_activate_object(dialog_->input_preamble); + fl_activate_object(dialog_->button_ok); + fl_activate_object(dialog_->button_apply); + fl_set_object_lcol(dialog_->button_ok, FL_BLACK); + fl_set_object_lcol(dialog_->button_apply, FL_BLACK); + } + + // need this? + // bc_.readOnly(lv_->buffer()->isReadonly()); +} + + diff --git a/src/frontends/xforms/FormPreamble.h b/src/frontends/xforms/FormPreamble.h new file mode 100644 index 0000000000..ac681dedf8 --- /dev/null +++ b/src/frontends/xforms/FormPreamble.h @@ -0,0 +1,49 @@ +/** + * \file FormPreamble.h + * Copyright 2001 The LyX Team. + * See the file COPYING. + * + * \author Edwin Leuven, leuven@fee.uva.nl + */ + +#ifndef FORMPREAMBLE_H +#define FORMPREAMBLE_H + +#include "FormBase.h" + +struct FD_form_preamble; + +/** This class provides an XForms implementation of the FormPreamble Dialog. + */ +class FormPreamble : public FormBaseBD { +public: + /// + FormPreamble(LyXView *, Dialogs *); + /// + ~FormPreamble(); + +private: + /** Redraw the form (on receipt of a Signal indicating, for example, + * that the xform colours have been re-mapped). + */ + + /// Filter the inputs + // virtual bool input(FL_OBJECT *, long); + + /// Build the popup + virtual void build(); + /// Apply from popup + virtual void apply(); + /// Update the popup. + virtual void update(); + /// + virtual FL_FORM * form() const; + + /// Typedefinitions from the fdesign produced Header file + FD_form_preamble * build_preamble(); + + /// Real GUI implementation. + FD_form_preamble * dialog_; +}; + +#endif diff --git a/src/frontends/xforms/Makefile.am b/src/frontends/xforms/Makefile.am index 87502a6403..1ed52add36 100644 --- a/src/frontends/xforms/Makefile.am +++ b/src/frontends/xforms/Makefile.am @@ -68,6 +68,10 @@ libxforms_la_SOURCES = \ FormParagraph.h \ form_paragraph.C \ form_paragraph.h \ + FormPreamble.C \ + FormPreamble.h \ + form_preamble.C \ + form_preamble.h \ FormPreferences.C \ FormPreferences.h \ form_preferences.C \ diff --git a/src/frontends/xforms/form_preamble.C b/src/frontends/xforms/form_preamble.C new file mode 100644 index 0000000000..85e301e14b --- /dev/null +++ b/src/frontends/xforms/form_preamble.C @@ -0,0 +1,63 @@ +// 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_preamble.h" +#include "FormPreamble.h" + +FD_form_preamble::~FD_form_preamble() +{ + if ( form->visible ) fl_hide_form( form ); + fl_free_form( form ); +} + + +FD_form_preamble * FormPreamble::build_preamble() +{ + FL_OBJECT *obj; + FD_form_preamble *fdui = new FD_form_preamble; + + fdui->form = fl_bgn_form(FL_NO_BOX, 380, 420); + fdui->form->u_vdata = this; + obj = fl_add_box(FL_UP_BOX, 0, 0, 380, 420, ""); + { + char const * const dummy = N_("OK|#O"); + fdui->button_ok = obj = fl_add_button(FL_NORMAL_BUTTON, 50, 380, 100, 30, idex(_(dummy))); + fl_set_button_shortcut(obj, scex(_(dummy)), 1); + } + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast); + fl_set_object_callback(obj, C_FormBaseOKCB, 0); + { + char const * const dummy = N_("Apply|#A"); + fdui->button_apply = obj = fl_add_button(FL_NORMAL_BUTTON, 160, 380, 100, 30, idex(_(dummy))); + fl_set_button_shortcut(obj, scex(_(dummy)), 1); + } + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast); + fl_set_object_callback(obj, C_FormBaseApplyCB, 0); + { + char const * const dummy = N_("Cancel|^["); + fdui->button_cancel = obj = fl_add_button(FL_NORMAL_BUTTON, 270, 380, 100, 30, idex(_(dummy))); + fl_set_button_shortcut(obj, scex(_(dummy)), 1); + } + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast); + fl_set_object_callback(obj, C_FormBaseCancelCB, 0); + fdui->input_preamble = obj = fl_add_input(FL_MULTILINE_INPUT, 10, 10, 360, 360, ""); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_gravity(obj, FL_NorthWest, FL_SouthEast); + fl_set_object_callback(obj, C_FormBaseInputCB, 0); + fl_end_form(); + + fdui->form->fdui = fdui; + + return fdui; +} +/*---------------------------------------*/ + diff --git a/src/frontends/xforms/form_preamble.h b/src/frontends/xforms/form_preamble.h new file mode 100644 index 0000000000..6e826d0ddb --- /dev/null +++ b/src/frontends/xforms/form_preamble.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_preamble_h_ +#define FD_form_preamble_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); +extern "C" void C_FormBaseInputCB(FL_OBJECT *, long); + + +/**** Forms and Objects ****/ +struct FD_form_preamble { + ~FD_form_preamble(); + + FL_FORM *form; + FL_OBJECT *button_ok; + FL_OBJECT *button_apply; + FL_OBJECT *button_cancel; + FL_OBJECT *input_preamble; +}; + +#endif /* FD_form_preamble_h_ */ diff --git a/src/frontends/xforms/forms/form_preamble.fd b/src/frontends/xforms/forms/form_preamble.fd new file mode 100644 index 0000000000..65b17ed7ed --- /dev/null +++ b/src/frontends/xforms/forms/form_preamble.fd @@ -0,0 +1,107 @@ +Magic: 13000 + +Internal Form Definition File + (do not change) + +Number of forms: 1 +Unit of measure: FL_COORD_PIXEL +SnapGrid: 5 + +=============== FORM =============== +Name: form_preamble +Width: 380 +Height: 420 +Number of Objects: 5 + +-------------------- +class: FL_BOX +type: UP_BOX +box: 0 0 380 420 +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: NORMAL_BUTTON +box: 50 380 100 30 +boxtype: FL_UP_BOX +colors: FL_COL1 FL_COL1 +alignment: FL_ALIGN_CENTER +style: FL_NORMAL_STYLE +size: FL_NORMAL_SIZE +lcol: FL_BLACK +label: OK|#O +shortcut: +resize: FL_RESIZE_NONE +gravity: FL_SouthEast FL_SouthEast +name: button_ok +callback: C_FormBaseOKCB +argument: 0 + +-------------------- +class: FL_BUTTON +type: NORMAL_BUTTON +box: 160 380 100 30 +boxtype: FL_UP_BOX +colors: FL_COL1 FL_COL1 +alignment: FL_ALIGN_CENTER +style: FL_NORMAL_STYLE +size: FL_NORMAL_SIZE +lcol: FL_BLACK +label: Apply|#A +shortcut: +resize: FL_RESIZE_NONE +gravity: FL_SouthEast FL_SouthEast +name: button_apply +callback: C_FormBaseApplyCB +argument: 0 + +-------------------- +class: FL_BUTTON +type: NORMAL_BUTTON +box: 270 380 100 30 +boxtype: FL_UP_BOX +colors: FL_COL1 FL_COL1 +alignment: FL_ALIGN_CENTER +style: FL_NORMAL_STYLE +size: FL_NORMAL_SIZE +lcol: FL_BLACK +label: Cancel|^[ +shortcut: +resize: FL_RESIZE_NONE +gravity: FL_SouthEast FL_SouthEast +name: button_cancel +callback: C_FormBaseCancelCB +argument: 0 + +-------------------- +class: FL_INPUT +type: MULTILINE_INPUT +box: 10 10 360 360 +boxtype: FL_DOWN_BOX +colors: FL_COL1 FL_MCOL +alignment: FL_ALIGN_LEFT +style: FL_NORMAL_STYLE +size: FL_NORMAL_SIZE +lcol: FL_BLACK +label: +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NorthWest FL_SouthEast +name: input_preamble +callback: C_FormBaseInputCB +argument: + +============================== +create_the_forms diff --git a/src/layout_forms.C b/src/layout_forms.C index 4b5ba67d65..d74289cb84 100644 --- a/src/layout_forms.C +++ b/src/layout_forms.C @@ -80,33 +80,3 @@ FD_form_character *create_form_form_character(void) } /*---------------------------------------*/ -FD_form_preamble *create_form_form_preamble(void) -{ - FL_OBJECT *obj; - FD_form_preamble *fdui = (FD_form_preamble *) fl_calloc(1, sizeof(FD_form_preamble)); - - fdui->form_preamble = fl_bgn_form(FL_NO_BOX, 380, 420); - obj = fl_add_box(FL_UP_BOX, 0, 0, 380, 420, ""); - fdui->button_ok = obj = fl_add_button(FL_NORMAL_BUTTON, 50, 380, 100, 30, idex(_("OK|#O")));fl_set_button_shortcut(obj, scex(_("OK|#O")), 1); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast); - fl_set_object_callback(obj, PreambleOKCB, 0); - fdui->button_apply = obj = fl_add_button(FL_NORMAL_BUTTON, 160, 380, 100, 30, idex(_("Apply|#A")));fl_set_button_shortcut(obj, scex(_("Apply|#A")), 1); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast); - fl_set_object_callback(obj, PreambleApplyCB, 0); - fdui->button_cancel = obj = fl_add_button(FL_NORMAL_BUTTON, 270, 380, 100, 30, idex(_("Cancel|^[")));fl_set_button_shortcut(obj, scex(_("Cancel|^[")), 1); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast); - fl_set_object_callback(obj, PreambleCancelCB, 0); - fdui->input_preamble = obj = fl_add_input(FL_MULTILINE_INPUT, 10, 10, 360, 360, ""); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_gravity(obj, FL_NorthWest, FL_SouthEast); - fl_end_form(); - - fdui->form_preamble->fdui = fdui; - - return fdui; -} -/*---------------------------------------*/ - diff --git a/src/layout_forms.h b/src/layout_forms.h index 8805853cf8..268d4153c3 100644 --- a/src/layout_forms.h +++ b/src/layout_forms.h @@ -7,10 +7,6 @@ extern "C" void CharacterApplyCB(FL_OBJECT *, long); extern "C" void CharacterCloseCB(FL_OBJECT *, long); -extern "C" void PreambleOKCB(FL_OBJECT *, long); -extern "C" void PreambleApplyCB(FL_OBJECT *, long); -extern "C" void PreambleCancelCB(FL_OBJECT *, long); - /**** Forms and Objects ****/ typedef struct { @@ -31,17 +27,5 @@ typedef struct { } FD_form_character; extern FD_form_character * create_form_form_character(void); -typedef struct { - FL_FORM *form_preamble; - void *vdata; - char *cdata; - long ldata; - FL_OBJECT *button_ok; - FL_OBJECT *button_apply; - FL_OBJECT *button_cancel; - FL_OBJECT *input_preamble; -} FD_form_preamble; - -extern FD_form_preamble * create_form_form_preamble(void); #endif /* FD_form_character_h_ */ diff --git a/src/lyx_cb.C b/src/lyx_cb.C index 6107267694..22d31e4fbc 100644 --- a/src/lyx_cb.C +++ b/src/lyx_cb.C @@ -54,7 +54,6 @@ extern Combox * combo_language2; extern BufferList bufferlist; extern void show_symbols_form(); extern FD_form_character * fd_form_character; -extern FD_form_preamble * fd_form_preamble; extern FD_form_figure * fd_form_figure; extern BufferView * current_view; // called too many times in this file... @@ -595,58 +594,6 @@ void MenuLayoutCharacter() } -bool UpdateLayoutPreamble(BufferView * bv) -{ - bool update = true; - if (!bv->available()) - update = false; - - if (update) { - fl_set_input(fd_form_preamble->input_preamble, - bv->buffer()->params.preamble.c_str()); - - if (bv->buffer()->isReadonly()) { - fl_deactivate_object(fd_form_preamble->input_preamble); - fl_deactivate_object(fd_form_preamble->button_ok); - fl_deactivate_object(fd_form_preamble->button_apply); - fl_set_object_lcol(fd_form_preamble->button_ok, FL_INACTIVE); - fl_set_object_lcol(fd_form_preamble->button_apply, FL_INACTIVE); - } else { - fl_activate_object(fd_form_preamble->input_preamble); - fl_activate_object(fd_form_preamble->button_ok); - fl_activate_object(fd_form_preamble->button_apply); - fl_set_object_lcol(fd_form_preamble->button_ok, FL_BLACK); - fl_set_object_lcol(fd_form_preamble->button_apply, FL_BLACK); - } - } else if (fd_form_preamble->form_preamble->visible) { - fl_hide_form(fd_form_preamble->form_preamble); - } - return update; -} - - -void MenuLayoutPreamble() -{ - static int ow = -1, oh; - - if (UpdateLayoutPreamble(current_view)) { - if (fd_form_preamble->form_preamble->visible) { - fl_raise_form(fd_form_preamble->form_preamble); - } else { - fl_show_form(fd_form_preamble->form_preamble, - FL_PLACE_MOUSE | FL_FREE_SIZE, - FL_TRANSIENT, - _("LaTeX Preamble")); - if (ow < 0) { - ow = fd_form_preamble->form_preamble->w; - oh = fd_form_preamble->form_preamble->h; - } - fl_set_form_minsize(fd_form_preamble->form_preamble, - ow, oh); - } - } -} - void MenuLayoutSave(BufferView * bv) { @@ -785,35 +732,6 @@ void CharacterOKCB(FL_OBJECT * ob, long data) } -/* callbacks for form form_preamble */ - -extern "C" -void PreambleCancelCB(FL_OBJECT *, long) -{ - fl_hide_form(fd_form_preamble->form_preamble); -} - - -extern "C" -void PreambleApplyCB(FL_OBJECT *, long) -{ - if (!current_view->available()) - return; - - current_view->buffer()->params.preamble = - fl_get_input(fd_form_preamble->input_preamble); - current_view->buffer()->markDirty(); - current_view->owner()->getMiniBuffer()->Set(_("LaTeX preamble set")); -} - - -extern "C" -void PreambleOKCB(FL_OBJECT * ob, long data) -{ - PreambleApplyCB(ob, data); - PreambleCancelCB(ob, data); -} - void Figure() { diff --git a/src/lyx_cb.h b/src/lyx_cb.h index 40d9de315d..4ece4bdfc3 100644 --- a/src/lyx_cb.h +++ b/src/lyx_cb.h @@ -46,10 +46,6 @@ void LayoutsCB(int sel, void *, Combox *); /// void MenuLayoutCharacter(); /// -bool UpdateLayoutPreamble(BufferView * bv); -/// -void MenuLayoutPreamble(); -/// void MenuLayoutSave(BufferView * bv); /// LyXFont const UserFreeFont(BufferParams const & params); diff --git a/src/lyx_gui.C b/src/lyx_gui.C index 6003d63680..3ea7067556 100644 --- a/src/lyx_gui.C +++ b/src/lyx_gui.C @@ -48,7 +48,6 @@ using std::endl; FD_form_character * fd_form_character; -FD_form_preamble * fd_form_preamble; FD_form_sendto * fd_form_sendto; FD_form_figure * fd_form_figure; Combox * combo_language; @@ -326,11 +325,6 @@ void LyXGUI::create_forms() combo_language2->addto((*cit).second.lang()); } - // the preamble form - fd_form_preamble = create_form_form_preamble(); - fl_set_form_atclose(fd_form_preamble->form_preamble, - CancelCloseBoxCB, 0); - // the sendto form fd_form_sendto = create_form_form_sendto(); fl_set_form_atclose(fd_form_sendto->form_sendto, CancelCloseBoxCB, 0); diff --git a/src/lyx_gui_misc.C b/src/lyx_gui_misc.C index 99ea77f214..56325a5613 100644 --- a/src/lyx_gui_misc.C +++ b/src/lyx_gui_misc.C @@ -44,7 +44,6 @@ extern BufferView * current_view; extern FD_form_character * fd_form_character; extern FD_form_credits * fd_form_credits; extern FD_form_figure * fd_form_figure; -extern FD_form_preamble * fd_form_preamble; extern FD_form_sendto * fd_form_sendto; extern FD_form_spell_check * fd_form_spell_check; extern FD_form_spell_options * fd_form_spell_options; @@ -80,9 +79,6 @@ void RedrawAllBufferRelatedDialogs() if (fd_form_figure->form_figure->visible) { fl_redraw_form(fd_form_figure->form_figure); } - if (fd_form_preamble->form_preamble->visible) { - fl_redraw_form(fd_form_preamble->form_preamble); - } if (fd_form_sendto->form_sendto->visible) { fl_redraw_form(fd_form_sendto->form_sendto); } @@ -118,9 +114,6 @@ void CloseAllBufferRelatedDialogs() if (fd_form_character->form_character->visible) { fl_hide_form(fd_form_character->form_character); } - if (fd_form_preamble->form_preamble->visible) { - fl_hide_form(fd_form_preamble->form_preamble); - } if (fd_form_figure->form_figure->visible) { fl_hide_form(fd_form_figure->form_figure); } @@ -164,9 +157,6 @@ void CloseAllBufferRelatedDialogs() // Again the Signal/Slot mechanism is tailor made for this task. void updateAllVisibleBufferRelatedDialogs(bool) { - if (fd_form_preamble->form_preamble->visible) { - UpdateLayoutPreamble(current_view); - } if (current_view->buffer() && current_view->buffer()->isReadonly()) { // a little crude perhaps but it works. ARRae if (fd_form_character->form_character->visible) { diff --git a/src/lyxfunc.C b/src/lyxfunc.C index 8a3e757772..a21c3e84d5 100644 --- a/src/lyxfunc.C +++ b/src/lyxfunc.C @@ -1300,7 +1300,7 @@ string const LyXFunc::Dispatch(int ac, break; case LFUN_LAYOUT_PREAMBLE: - MenuLayoutPreamble(); + owner->getDialogs()->showPreamble(); break; case LFUN_LAYOUT_SAVE_DEFAULT: -- 2.39.2