From c238196fb25a6a04f7e516943a3d069821f49317 Mon Sep 17 00:00:00 2001 From: Angus Leeming Date: Mon, 11 Feb 2002 10:22:27 +0000 Subject: [PATCH] Michael Koziarski's gnome patch. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3516 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/gnome/ChangeLog | 11 ++ src/frontends/gnome/Dialogs.C | 5 +- src/frontends/gnome/FormERT.C | 132 ++++++++++++++++++ src/frontends/gnome/FormERT.h | 75 ++++++++++ src/frontends/gnome/GnomeBase.C | 1 + src/frontends/gnome/Makefile.am | 2 + src/frontends/gnome/dialogs/FormERT.glade | 160 ++++++++++++++++++++++ src/frontends/gnome/gnomeBC.C | 1 + 8 files changed, 386 insertions(+), 1 deletion(-) create mode 100644 src/frontends/gnome/FormERT.C create mode 100644 src/frontends/gnome/FormERT.h create mode 100644 src/frontends/gnome/dialogs/FormERT.glade diff --git a/src/frontends/gnome/ChangeLog b/src/frontends/gnome/ChangeLog index f35c1ecbb9..86a491a08b 100644 --- a/src/frontends/gnome/ChangeLog +++ b/src/frontends/gnome/ChangeLog @@ -1,3 +1,14 @@ +2002-02-10 Michael A. Koziarski + + * FormERT.C + * FormERT.h + * Dialogs.C + * dialogs/FormERT.glade: Implemented FormERT, still seeing the + weird crashes + * GnomeBase.C: add debug message to help track down the "twice OK" + bug + * gnomeBC.C: Fix compilation + 2002-01-12 Michael A. Koziarski * Menubar_pimpl.C diff --git a/src/frontends/gnome/Dialogs.C b/src/frontends/gnome/Dialogs.C index 85a44ae0cf..5461718385 100644 --- a/src/frontends/gnome/Dialogs.C +++ b/src/frontends/gnome/Dialogs.C @@ -30,11 +30,13 @@ #include "ControlUrl.h" #include "ControlVCLog.h" #include "ControlTabularCreate.h" +#include "ControlERT.h" #include "GUI.h" #include "FormUrl.h" #include "FormError.h" #include "FormTabularCreate.h" +#include "FormERT.h" /* #include "FormBibitem.h" #include "FormBibtex.h" @@ -56,7 +58,7 @@ #include "FormRef.h" #include "FormSearch.h" #include "FormTabular.h" -#include "FormTabularCreate.h" +#include "FormTabul./arCreate.h" #include "FormToc.h" #include "FormUrl.h" #include "FormMinipage.h" @@ -71,6 +73,7 @@ Dialogs::Dialogs(LyXView * lv) add(new GUIUrl(*lv, *this)); add(new GUIError(*lv, *this)); add(new GUITabularCreate(*lv, *this)); + add(new GUIERT(*lv, *this)); /* add(new GUIBibitem(*lv, *this)); diff --git a/src/frontends/gnome/FormERT.C b/src/frontends/gnome/FormERT.C new file mode 100644 index 0000000000..cac6f18b7f --- /dev/null +++ b/src/frontends/gnome/FormERT.C @@ -0,0 +1,132 @@ +/* This file is part of + * ================================================= + * + * LyX, The Document Processor + * Copyright 1995-2000 The LyX Team. + * + * ================================================= + * + * \author Michael Koziarski + */ + +#ifdef __GNUG__ +#pragma implementation +#endif + +#include + +#include "gnomeBC.h" +#include "FormERT.h" + +#include +#include + +FormERT::FormERT(ControlERT & c) + : FormCB(c, "FormERT") +{} + + +FormERT::~FormERT() +{} + + +void FormERT::build() +{ + // Connect the buttons. + ok_btn()->clicked.connect(SigC::slot(this, &FormERT::OKClicked)); + cancel_btn()->clicked.connect(SigC::slot(this, &FormERT::CancelClicked)); + apply_btn()->clicked.connect(SigC::slot(this, &FormERT::ApplyClicked)); + + // Manage the buttons state + bc().setOK(ok_btn()); + bc().setCancel(cancel_btn()); + bc().setApply(apply_btn()); + + // Make sure everything is in the correct state. + bc().refresh(); + + // Manage the read-only aware widgets. + bc().addReadOnly(open()); + bc().addReadOnly(inlined()); + bc().addReadOnly(collapsed()); + +} + + +void FormERT::connect_signals() +{ + slot_open = open()->clicked.connect(SigC::slot(this, &FormERT::InputChanged)); + slot_collapsed = collapsed()->clicked.connect(SigC::slot(this, &FormERT::InputChanged)); + slot_inlined = inlined()->clicked.connect(SigC::slot(this, &FormERT::InputChanged)); +} + + +void FormERT::disconnect_signals() +{ + slot_open.disconnect(); + slot_collapsed.disconnect(); + slot_inlined.disconnect(); +} + + +void FormERT::apply() +{ + + if (open()->get_active()) + controller().params().status = InsetERT::Open; + else if (collapsed()->get_active()) + controller().params().status = InsetERT::Collapsed; + else + controller().params().status = InsetERT::Inlined; + +} + + +void FormERT::update() +{ + disconnect_signals(); + switch (controller().params().status) { + case InsetERT::Open: + open()->set_active(true); + break; + case InsetERT::Collapsed: + collapsed()->set_active(true); + break; + case InsetERT::Inlined: + inlined()->set_active(true); + break; + } + connect_signals(); + +} + +bool FormERT::validate() const +{ + return true; +} + + +Gtk::Button * FormERT::ok_btn() const +{ + return getWidget("r_ok_btn"); +} +Gtk::Button * FormERT::apply_btn() const +{ + return getWidget("r_apply_btn"); +} +Gtk::Button * FormERT::cancel_btn() const +{ + return getWidget("r_cancel_btn"); +} +Gtk::RadioButton * FormERT::open() const +{ + return getWidget("r_open"); +} +Gtk::RadioButton * FormERT::collapsed() const +{ + return getWidget("r_collapsed"); +} +Gtk::RadioButton * FormERT::inlined() const +{ + return getWidget("r_inlined"); +} diff --git a/src/frontends/gnome/FormERT.h b/src/frontends/gnome/FormERT.h new file mode 100644 index 0000000000..a294947f04 --- /dev/null +++ b/src/frontends/gnome/FormERT.h @@ -0,0 +1,75 @@ +// -*- C++ -*- +/* This file is part of + * ================================================= + * + * LyX, The Document Processor + * Copyright 1995 Matthias Ettrich. + * Copyright 1995-2000 The LyX Team. + * + * ================================================= + * + * \author Michael Koziarski + * */ + +#ifndef FORMERT_H +#define FORMERT_H + +#ifdef __GNUG__ +#pragma interface +#endif + +#include "ControlERT.h" +#include "GnomeBase.h" + +namespace Gtk { + class RadioButton; + class Button; +} + +/** + * This class implements the dialog to insert/modify urls. + */ +class FormERT : public FormCB { +public: + /// + FormERT(ControlERT & c); + /// + ~FormERT(); + + void apply(); + void update(); + +private: + /// Build the dialog + void build(); + + /// Returns true if the dialog input is in a valid state. + bool validate() const; + + /// Do the connection of signals + void connect_signals(); + /// Disconnect the signals. + void disconnect_signals(); + + /// generated by accessors.py + Gtk::Button * ok_btn() const; + /// generated by accessors.py + Gtk::Button * apply_btn() const; + /// genearated by accessors.py + Gtk::Button * cancel_btn() const; + /// generated by accessors.py + Gtk::RadioButton * open() const; + /// generated by accessors.py + Gtk::RadioButton * collapsed() const; + /// generated by accessors.py + Gtk::RadioButton * inlined() const; + + + /// do input validation + SigC::Connection slot_open; + SigC::Connection slot_collapsed; + SigC::Connection slot_inlined; + +}; + +#endif diff --git a/src/frontends/gnome/GnomeBase.C b/src/frontends/gnome/GnomeBase.C index 72e80aa385..b524d9833a 100644 --- a/src/frontends/gnome/GnomeBase.C +++ b/src/frontends/gnome/GnomeBase.C @@ -78,6 +78,7 @@ bool GnomeBase::validate() void GnomeBase::OKClicked() { + lyxerr[Debug::GUI] << "OKClicked()\n"; OKButton(); } diff --git a/src/frontends/gnome/Makefile.am b/src/frontends/gnome/Makefile.am index 44ba737352..18b4f51af6 100644 --- a/src/frontends/gnome/Makefile.am +++ b/src/frontends/gnome/Makefile.am @@ -78,6 +78,8 @@ libgnome_la_SOURCES = \ FormTabularCreate.h \ FormUrl.C \ FormUrl.h \ + FormERT.C \ + FormERT.h \ gnome_helpers.C \ gnome_helpers.h \ GnomeBase.C \ diff --git a/src/frontends/gnome/dialogs/FormERT.glade b/src/frontends/gnome/dialogs/FormERT.glade new file mode 100644 index 0000000000..dc088cd63d --- /dev/null +++ b/src/frontends/gnome/dialogs/FormERT.glade @@ -0,0 +1,160 @@ + + + + + diainserturl + diainserturl + + + pixmaps + C + True + True + True + False + False + True + diainserturl_interface.c + diainserturl_interface.h + diainserturl_callbacks.c + diainserturl_callbacks.h + + + + GnomeDialog + FormERT + 2 + False + ERT Options + GTK_WINDOW_DIALOG + GTK_WIN_POS_NONE + False + True + True + False + False + True + + + GtkVBox + GnomeDialog:vbox + dialog-vbox1 + False + 8 + + 4 + True + True + + + + GtkHButtonBox + GnomeDialog:action_area + dialog-action_area1 + GTK_BUTTONBOX_DEFAULT_STYLE + 8 + 85 + 27 + 7 + 0 + + 0 + False + True + GTK_PACK_END + + + + GtkButton + r_ok_btn + True + True + GNOME_STOCK_BUTTON_OK + + + + GtkButton + r_apply_btn + True + True + GNOME_STOCK_BUTTON_APPLY + + + + GtkButton + r_cancel_btn + True + True + True + GNOME_STOCK_BUTTON_CANCEL + + + + + GtkFrame + frame1 + + 0 + GTK_SHADOW_ETCHED_IN + + 0 + True + True + + + + GtkVBox + vbox1 + False + 0 + + + GtkRadioButton + r_open + True + + True + True + status + + 0 + False + False + + + + + GtkRadioButton + r_collapsed + True + + False + True + status + + 0 + False + False + + + + + GtkRadioButton + r_inlined + True + + False + True + status + + 0 + False + False + + + + + + + + diff --git a/src/frontends/gnome/gnomeBC.C b/src/frontends/gnome/gnomeBC.C index e9f9f66178..a4e7d34405 100644 --- a/src/frontends/gnome/gnomeBC.C +++ b/src/frontends/gnome/gnomeBC.C @@ -5,6 +5,7 @@ #endif #include "gnomeBC.h" +#include "ButtonController.tmpl" #include "gtk--/widget.h" #include "gtk--/button.h" -- 2.39.2