From c24e9194af68607a3f877710c52874c1df592d57 Mon Sep 17 00:00:00 2001 From: Michael Gerz Date: Wed, 12 Feb 2003 06:10:42 +0000 Subject: [PATCH] Changes Dialog for gnome frontend. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6110 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/gnome/ChangeLog | 6 + src/frontends/gnome/Dialogs.C | 1 + src/frontends/gnome/Dialogs2.C | 4 + src/frontends/gnome/Dialogs_impl.h | 7 + src/frontends/gnome/GChanges.C | 118 +++++++ src/frontends/gnome/GChanges.h | 69 +++++ src/frontends/gnome/Makefile.am | 2 + src/frontends/gnome/dialogs/GChanges.glade | 342 +++++++++++++++++++++ 8 files changed, 549 insertions(+) create mode 100644 src/frontends/gnome/GChanges.C create mode 100644 src/frontends/gnome/GChanges.h create mode 100644 src/frontends/gnome/dialogs/GChanges.glade diff --git a/src/frontends/gnome/ChangeLog b/src/frontends/gnome/ChangeLog index 66cbe1a3f8..5fc6268b4b 100644 --- a/src/frontends/gnome/ChangeLog +++ b/src/frontends/gnome/ChangeLog @@ -1,3 +1,9 @@ +2003-02-12 Michael A. Koziarski + + * GChanges.C + * GChanges.h + * dialogs/GChanges.glade: implement the Changes dialog + 2003-02-01 Michael A. Koziarski Major changes to make the gnome frontend compile and work again. diff --git a/src/frontends/gnome/Dialogs.C b/src/frontends/gnome/Dialogs.C index 103f52831f..9e0fbac8b5 100644 --- a/src/frontends/gnome/Dialogs.C +++ b/src/frontends/gnome/Dialogs.C @@ -49,6 +49,7 @@ Dialogs::Impl::Impl(LyXView & lv, Dialogs & d) bibitem(lv, d), bibtex(lv, d), character(lv, d), + changes(lv, d), citation(lv, d), document(lv, d), error(lv, d), diff --git a/src/frontends/gnome/Dialogs2.C b/src/frontends/gnome/Dialogs2.C index 46541712eb..21768121a7 100644 --- a/src/frontends/gnome/Dialogs2.C +++ b/src/frontends/gnome/Dialogs2.C @@ -144,6 +144,10 @@ void Dialogs::showMathPanel() pimpl_->mathpanel.controller().show(); } +void Dialogs::showMergeChanges() +{ + pimpl_->changes.controller().show(); +} void Dialogs::showMinipage(InsetMinipage * im) { diff --git a/src/frontends/gnome/Dialogs_impl.h b/src/frontends/gnome/Dialogs_impl.h index 276dd68cdc..52e740c91a 100644 --- a/src/frontends/gnome/Dialogs_impl.h +++ b/src/frontends/gnome/Dialogs_impl.h @@ -45,6 +45,9 @@ #include "FormCitation.h" #include "forms/form_citation.h" +#include "ControlChanges.h" +#include "GChanges.h" + #include "ControlDocument.h" #include "FormDocument.h" #include "forms/form_document.h" @@ -167,6 +170,9 @@ BibtexDialog; typedef GUI CharacterDialog; +typedef GUI +ChangesDialog; + typedef GUI CitationDialog; @@ -266,6 +272,7 @@ struct Dialogs::Impl { BibitemDialog bibitem; BibtexDialog bibtex; CharacterDialog character; + ChangesDialog changes; CitationDialog citation; DocumentDialog document; ErrorDialog error; diff --git a/src/frontends/gnome/GChanges.C b/src/frontends/gnome/GChanges.C new file mode 100644 index 0000000000..4462e5495c --- /dev/null +++ b/src/frontends/gnome/GChanges.C @@ -0,0 +1,118 @@ +/** + * \file GChanges.C + * This file is part of LyX, the document processor. + * Licence details can be found in the file COPYING. + * + * \author Michael Koziarski + * + * Full author contact details are available in file CREDITS + */ + +#ifdef __GNUG__ +#pragma implementation +#endif + +#include + +#include "gnomeBC.h" +#include "GChanges.h" + +#include +#include +#include + +GChanges::GChanges() + : GnomeCB("GChanges") +{} + + +GChanges::~GChanges() +{} + + +void GChanges::build() +{ + // Connect the buttons. + cancel_btn()->signal_clicked().connect(SigC::slot(*this, &GChanges::CancelClicked)); + accept_btn()->signal_clicked().connect(SigC::slot(*this, &GChanges::accept)); + reject_btn()->signal_clicked().connect(SigC::slot(*this, &GChanges::reject)); + + bc().setCancel(cancel_btn()); + + // Manage the read-only aware widgets. + bc().addReadOnly(accept_btn()); + bc().addReadOnly(cancel_btn()); + bc().addReadOnly(reject_btn()); + + // Make sure everything is in the correct state. + bc().refresh(); +} + + +void GChanges::connect_signals() +{} + + +void GChanges::disconnect_signals() +{} + +void GChanges::accept() +{ + controller().accept(); +} + +void GChanges::reject() +{ + controller().reject(); +} + +void GChanges::apply() +{} + + +void GChanges::update() +{ + using std::string; + disconnect_signals(); + controller().find(); + + string text; + string author(controller().getChangeAuthor()); + string date(controller().getChangeDate()); + + if (!author.empty()) + text += "Change by " + author + "\n\n"; + if (!date.empty()) + text += "Change made at " + date + "\n"; + + changes()->get_buffer()->set_text(Glib::locale_to_utf8(text)); + + connect_signals(); +} + + +bool GChanges::validate() const +{ + return true; +} +Gtk::Button * GChanges::next_btn() const +{ + return getWidget("r_next_btn"); +} +Gtk::Button * GChanges::cancel_btn() const +{ + return getWidget("r_cancel_btn"); +} +Gtk::TextView * GChanges::changes() const +{ + return getWidget("r_changes"); +} +Gtk::Button * GChanges::accept_btn() const +{ + return getWidget("r_accept_btn"); +} +Gtk::Button * GChanges::reject_btn() const +{ + return getWidget("r_reject_btn"); +} + diff --git a/src/frontends/gnome/GChanges.h b/src/frontends/gnome/GChanges.h new file mode 100644 index 0000000000..9ef700c0e3 --- /dev/null +++ b/src/frontends/gnome/GChanges.h @@ -0,0 +1,69 @@ +// -*- C++ -*- +/** + * \file GChanges.h + * This file is part of LyX, the document processor. + * Licence details can be found in the file COPYING. + * + * \author Michael Koziarski + * + * Full author contact details are available in file CREDITS + */ + +#ifndef GCHANGES_H +#define GCHANGES_H + +#ifdef __GNUG__ +#pragma interface +#endif + +#include "ControlChanges.h" +#include "GnomeBase.h" + +namespace Gtk { +class Button; +class TextView; +} + +/** + * This class implements the dialog to Track changes + */ +class GChanges : public GnomeCB { +public: + /// + GChanges(); + /// + ~GChanges(); + + 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(); + + void reject(); + + void accept(); + + /// generated by accessors.py + Gtk::Button * next_btn() const; + /// generated by accessors.py + Gtk::Button * cancel_btn() const; + /// generated by accessors.py + Gtk::TextView * changes() const; + /// generated by accessors.py + Gtk::Button * accept_btn() const; + /// generated by accessors.py + Gtk::Button * reject_btn() const; + +}; + +#endif diff --git a/src/frontends/gnome/Makefile.am b/src/frontends/gnome/Makefile.am index ac9a70b4e0..37859adb26 100644 --- a/src/frontends/gnome/Makefile.am +++ b/src/frontends/gnome/Makefile.am @@ -129,6 +129,8 @@ libgnome_la_SOURCES = \ FileDialog.C \ GAbout.C \ GAbout.h \ + GChanges.C \ + GChanges.h \ GError.C \ GError.h \ GERT.C \ diff --git a/src/frontends/gnome/dialogs/GChanges.glade b/src/frontends/gnome/dialogs/GChanges.glade new file mode 100644 index 0000000000..c43c1e3cd4 --- /dev/null +++ b/src/frontends/gnome/dialogs/GChanges.glade @@ -0,0 +1,342 @@ + + + + + + + Changes + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_CENTER + False + True + False + True + + + + 2 + True + False + 0 + + + + 5 + True + GTK_BUTTONBOX_END + 10 + + + + True + True + True + GTK_RELIEF_NORMAL + -6 + + + + True + 0.5 + 0.5 + 0 + 0 + + + + True + False + 2 + + + + True + gtk-go-forward + 4 + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + True + _Next change + True + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + + + + + + + True + True + True + gtk-cancel + True + GTK_RELIEF_NORMAL + -6 + + + + + 0 + False + True + GTK_PACK_END + + + + + + True + False + 4 + + + + True + False + 4 + + + + True + Change: + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + True + True + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_SHADOW_NONE + GTK_CORNER_TOP_LEFT + + + + True + True + False + GTK_JUSTIFY_LEFT + GTK_WRAP_NONE + True + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + 0 + True + True + + + + + 0 + True + True + + + + + + True + GTK_BUTTONBOX_START + 12 + + + + True + True + True + GTK_RELIEF_NORMAL + + + + True + 0.5 + 0.5 + 0 + 0 + + + + True + False + 2 + + + + True + gtk-yes + 4 + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + True + _Accept + True + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + + + + + + + True + True + True + GTK_RELIEF_NORMAL + + + + True + 0.5 + 0.5 + 0 + 0 + + + + True + False + 2 + + + + True + gtk-no + 4 + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + True + _Reject + True + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + + + + + + 0 + False + False + + + + + 0 + True + True + + + + + + +