From c1cfd4547713f4c7c5f9f13f1ed6d804b116f781 Mon Sep 17 00:00:00 2001 From: Baruch Even Date: Sat, 12 May 2001 20:13:52 +0000 Subject: [PATCH] FormTabularCreate dialog implementation for Gnome. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1996 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/gnome/ChangeLog | 8 + src/frontends/gnome/Dialogs.C | 5 +- src/frontends/gnome/FormTabularCreate.C | 109 +++++++++ src/frontends/gnome/FormTabularCreate.h | 63 +++++ src/frontends/gnome/Makefile.am | 2 + .../gnome/dialogs/diainserttabular.glade | 215 ++++++++++++++++++ 6 files changed, 400 insertions(+), 2 deletions(-) create mode 100644 src/frontends/gnome/FormTabularCreate.C create mode 100644 src/frontends/gnome/FormTabularCreate.h create mode 100644 src/frontends/gnome/dialogs/diainserttabular.glade diff --git a/src/frontends/gnome/ChangeLog b/src/frontends/gnome/ChangeLog index 539b8940f7..4df083dffd 100644 --- a/src/frontends/gnome/ChangeLog +++ b/src/frontends/gnome/ChangeLog @@ -1,3 +1,11 @@ +2001-05-08 Michael A. Koziarski + + * FormTabularCreate[Ch]: + * dialogs: + * Makefile.am: + * Dialogs.C: Created the FormCharacter Dialog and altered the + other files to include it. + 2001-04-29 Baruch Even * Dialogs.C: Added an include for ControlSplash which is required diff --git a/src/frontends/gnome/Dialogs.C b/src/frontends/gnome/Dialogs.C index 8886d5187b..8ba830fcc9 100644 --- a/src/frontends/gnome/Dialogs.C +++ b/src/frontends/gnome/Dialogs.C @@ -31,14 +31,14 @@ #include "ControlLog.h" #include "ControlUrl.h" #include "ControlVCLog.h" - +#include "ControlTabularCreate.h" #include "GUI.h" #include "FormUrl.h" #include "FormCredits.h" #include "FormCopyright.h" #include "FormError.h" - +#include "FormTabularCreate.h" /* #include "FormBibitem.h" #include "FormBibtex.h" @@ -77,6 +77,7 @@ Dialogs::Dialogs(LyXView * lv) add(new GUICredits(*lv, *this)); add(new GUICopyright(*lv, *this)); add(new GUIError(*lv, *this)); + add(new GUITabularCreate(*lv, *this)); /* splash_.reset(new FormSplash(lv, this)); diff --git a/src/frontends/gnome/FormTabularCreate.C b/src/frontends/gnome/FormTabularCreate.C new file mode 100644 index 0000000000..a5e20f0134 --- /dev/null +++ b/src/frontends/gnome/FormTabularCreate.C @@ -0,0 +1,109 @@ +// -*- C++ -*- +/* 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 + +#include "gnomeBC.h" +#include "FormTabularCreate.h" + +#include +#include + +FormTabularCreate::FormTabularCreate(ControlTabularCreate & c) + : FormCB(c, "diainserttabular.glade", + "DiaInsertTabular") +{} + + +FormTabularCreate::~FormTabularCreate() +{ + // Note that there is no need to destroy the class itself, it seems + // like everything is managed inside it. Deleting the class itself will + // a crash at the end of the program. + //dialog_->destroy(); +} + + +void FormTabularCreate::build() +{ + // Connect the buttons. + ok_btn()->clicked.connect(SigC::slot(this, + &FormTabularCreate::OKClicked)); + cancel_btn()->clicked.connect(SigC::slot(this, + &FormTabularCreate::CancelClicked)); + apply_btn()->clicked.connect(SigC::slot(this, + &FormTabularCreate::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(); +} + + +void FormTabularCreate::apply() +{ + unsigned int ysize = (unsigned int)(rows_spin()->get_value_as_int()); + unsigned int xsize = (unsigned int)(columns_spin()->get_value_as_int()); + + controller().params() = std::make_pair(xsize, ysize); +} + + +void FormTabularCreate::update() +{ +} + + +bool FormTabularCreate::validate() const +{ + // Always valid! (not really so, needs fixing). + return true; +} + + +Gtk::SpinButton * FormTabularCreate::rows_spin() const +{ + return getWidget("tabular_spin_rows"); +} + + +Gtk::SpinButton * FormTabularCreate::columns_spin() const +{ + return getWidget("tabular_spin_columns"); +} + + +Gtk::Button * FormTabularCreate::ok_btn() const +{ + return getWidget("button_ok"); +} + + +Gtk::Button * FormTabularCreate::cancel_btn() const +{ + return getWidget("button_cancel"); +} + + +Gtk::Button * FormTabularCreate::apply_btn() const +{ + return getWidget("button_apply"); +} diff --git a/src/frontends/gnome/FormTabularCreate.h b/src/frontends/gnome/FormTabularCreate.h new file mode 100644 index 0000000000..f2d59722e2 --- /dev/null +++ b/src/frontends/gnome/FormTabularCreate.h @@ -0,0 +1,63 @@ +// -*- c++ -*- +/* This file is part of + * ================================================= + * + * LyX, The Document Processor + * Copyright 1995 Matthias Ettrich. + * Copyright 1995-2000 The LyX Team. + * + * ================================================= + * + * \author Michael Koziarski + * */ + +#ifndef FORMTABULARCREATE_H +#define FORMTABULARCREATE_H + +#ifdef __GNUG__ +#pragma interface +#endif + +#include "ControlTabularCreate.h" +#include "GnomeBase.h" + +namespace Gtk { +class SpinButton; +} + +/** + * This class implements the dialog to insert/modify urls. + */ +class FormTabularCreate : public FormCB { +public: + /// + FormTabularCreate(ControlTabularCreate & c); + /// + ~FormTabularCreate(); + + void apply(); + +private: + /// Build the dialog + void build(); + + /// Returns true if the dialog input is in a valid state. + bool validate() const; + void update(); + + void OKClicked() { OKButton(); } + void CancelClicked() { CancelButton(); } + void ApplyClicked() { ApplyButton(); } + + /// The SpinButtons + Gtk::SpinButton * rows_spin() const; + Gtk::SpinButton * columns_spin() const; + /// The ok button + Gtk::Button * ok_btn() const; + /// The cancel button + Gtk::Button * cancel_btn() const; + /// The apply button + Gtk::Button * apply_btn() const; +}; + +#endif diff --git a/src/frontends/gnome/Makefile.am b/src/frontends/gnome/Makefile.am index e20ceb6c5a..b16440fb4d 100644 --- a/src/frontends/gnome/Makefile.am +++ b/src/frontends/gnome/Makefile.am @@ -81,6 +81,8 @@ libgnome_la_SOURCES = \ FileDialog.C \ FormCopyright.C \ FormCopyright.h \ + FormTabularCreate.C \ + FormTabularCreate.h \ FormCredits.C \ FormCredits.h \ FormError.C \ diff --git a/src/frontends/gnome/dialogs/diainserttabular.glade b/src/frontends/gnome/dialogs/diainserttabular.glade new file mode 100644 index 0000000000..0df3c102b7 --- /dev/null +++ b/src/frontends/gnome/dialogs/diainserttabular.glade @@ -0,0 +1,215 @@ + + + + + DiaInsertTabular + diainserttabular + + src + pixmaps + C + True + True + + + + GnomeDialog + DiaInsertTabular + Insert Tabular + GTK_WINDOW_DIALOG + GTK_WIN_POS_NONE + False + False + False + False + False + True + + + GtkVBox + GnomeDialog:vbox + dialog-vbox1 + False + 8 + + 4 + True + True + + + + GtkHButtonBox + GnomeDialog:action_area + dialog-action_area1 + GTK_BUTTONBOX_END + 8 + 85 + 27 + 7 + 0 + + 0 + False + True + GTK_PACK_END + + + + GtkButton + button_ok + True + True + GNOME_STOCK_BUTTON_OK + + + + GtkButton + button_apply + True + True + GNOME_STOCK_BUTTON_APPLY + + + + GtkButton + button_cancel + True + True + GNOME_STOCK_BUTTON_CANCEL + + + + + GtkTable + table1 + 2 + 2 + True + 0 + 0 + + 0 + True + True + + + + GtkLabel + label2 + + GTK_JUSTIFY_RIGHT + False + 0 + 0.5 + 0 + 0 + + 0 + 1 + 0 + 1 + 0 + 0 + False + False + False + False + True + False + + + + + GtkLabel + label3 + + GTK_JUSTIFY_RIGHT + False + 0 + 0.5 + 0 + 0 + + 0 + 1 + 1 + 2 + 0 + 0 + False + False + False + False + True + False + + + + + GtkSpinButton + tabular_spin_rows + True + 1 + 0 + False + GTK_UPDATE_ALWAYS + False + False + 1 + 1 + 50 + 1 + 10 + 10 + + 1 + 2 + 0 + 1 + 0 + 0 + True + False + False + False + True + False + + + + + GtkSpinButton + tabular_spin_columns + True + 1 + 0 + False + GTK_UPDATE_ALWAYS + False + False + 1 + 1 + 50 + 1 + 10 + 10 + + 1 + 2 + 1 + 2 + 0 + 0 + True + False + False + False + True + False + + + + + + + -- 2.39.2