diff --git a/src/frontends/gnome/ChangeLog b/src/frontends/gnome/ChangeLog index d13dfdaf21..58473f95f8 100644 --- a/src/frontends/gnome/ChangeLog +++ b/src/frontends/gnome/ChangeLog @@ -1,3 +1,19 @@ +2002-06-15 Michael A. Koziarski + + * Dialogs.C + * Makefile.am: Necessary changes for the various new dialogs + * GERT.C + * GERT.h + * dialogs/GERT.glade: Make ERT Properties dialog follow the GNOME hig. + * GLog.C: use std::string, all the conversion is wasteful + * GFloat.C + * GFloat.h + * dialogs/GFloat.glade: Implement the Float Properties Dialog + * dialogs/GAbout.glade + * GAbout.C + * GAbout.h: Temporary Aboutlyx implementation, waiting on some + gtkmm bugs to finalise it. + 2002-06-10 Lars Gullik Bjønnes * gnomeBC.C: do not include ButtonController.tmpl diff --git a/src/frontends/gnome/Dialogs.C b/src/frontends/gnome/Dialogs.C index d8fdbefab2..1b97dcb564 100644 --- a/src/frontends/gnome/Dialogs.C +++ b/src/frontends/gnome/Dialogs.C @@ -22,14 +22,15 @@ #include "frontends/LyXView.h" +#include "GAbout.h" #include "GError.h" #include "GERT.h" +#include "GFloat.h" #include "GLog.h" #include "GPreamble.h" #include "GTabularCreate.h" #include "GUrl.h" - #include "Tooltips.h" bool Dialogs::tooltipsEnabled() @@ -50,8 +51,11 @@ Dialogs::Dialogs(LyXView * lv) add(new GUI(*lv, *this)); add(new GUI(*lv, *this)); - + OkCancelPolicy, gnomeBC>(*lv, *this)); + add(new GUI(*lv, *this)); + add(new GUI(*lv, *this)); // reduce the number of connections needed in // dialogs by a simple connection here. hideAll.connect(hideBufferDependent); diff --git a/src/frontends/gnome/GAbout.C b/src/frontends/gnome/GAbout.C new file mode 100644 index 0000000000..11b81bd72d --- /dev/null +++ b/src/frontends/gnome/GAbout.C @@ -0,0 +1,104 @@ +/** + * ile GAbout.C + * Copyright 2001 The LyX Team. + * See the file COPYING. + * + * \author Michael Koziarski + */ + +#ifdef __GNUG__ +#pragma implementation +#endif + +#include + +#include "support/lstrings.h" +#include "Lsstream.h" + + +#include "gnomeBC.h" +#include "GAbout.h" + +#include +#include + +GAbout::GAbout(ControlAboutlyx & c) + : FormCB(c, "GAbout") +{} + + +GAbout::~GAbout() +{} + + +void GAbout::build() +{ + // Connect the buttons. + close_btn()->signal_clicked().connect(SigC::slot(*this, &GAbout::CancelClicked)); + + // Manage the buttons state + bc().setCancel(close_btn()); + bc().refresh(); +} + +void GAbout::apply() +{} + + +void GAbout::update() +{ + using namespace std; + + string cr; + cr += controller().getCopyright(); + cr += "\n"; + cr += controller().getLicense(); + cr += "\n"; + cr += controller().getDisclaimer(); + copyright()->get_buffer()->set_text(cr); + + + + version()->set_text(controller().getVersion()); + + stringstream in; + controller().getCredits(in); + + istringstream ss(in.str().c_str()); + + string s; + string out; + Gtk::TextIter e; + + while (getline(ss, s)) { + + if (prefixIs(s, "@b")) + out += s.substr(2); + else if (prefixIs(s, "@i")) + out += s.substr(2); + else + out += s.substr(2); + + out += "\n"; + } + credits()->get_buffer()->set_text(out); +} + + + +Gtk::Button * GAbout::close_btn() const +{ + return getWidget("r_close_btn"); +} +Gtk::Label * GAbout::version() const +{ + return getWidget("r_version"); +} +Gtk::TextView * GAbout::credits() const +{ + return getWidget("r_credits"); +} +Gtk::TextView * GAbout::copyright() const +{ + return getWidget("r_copyright"); +} diff --git a/src/frontends/gnome/GAbout.h b/src/frontends/gnome/GAbout.h new file mode 100644 index 0000000000..8f43712855 --- /dev/null +++ b/src/frontends/gnome/GAbout.h @@ -0,0 +1,59 @@ + +// -*- C++ -*- +/** + * \file GAbout.h + * Copyright 2001 The LyX Team. + * See the file COPYING. + * + * \author Michael Koziarski + */ + +#ifndef GABOUT_H +#define GABOUT_H + +#ifdef __GNUG__ +#pragma interface +#endif + +#include "ControlAboutlyx.h" +#include "GnomeBase.h" + +namespace Gtk { + class Button; + class Label; + class TextView; +} + +/** + * This class implements the dialog to display the information About LyX + */ +class GAbout : public FormCB { +public: + /// + GAbout(ControlAboutlyx & c); + /// + ~GAbout(); + + void apply(); + void update(); + +private: + /// Build the dialog + void build(); + + /// Returns true if the dialog input is in a valid state. + bool validate() const; + + /// generated by accessors.py + Gtk::Button * close_btn() const; + /// generated by accessors.py + Gtk::Label * version() const; + /// generated by accessors.py + Gtk::TextView * credits() const; + /// generated by accessors.py + Gtk::TextView * copyright() const; + + +}; + +#endif diff --git a/src/frontends/gnome/GERT.C b/src/frontends/gnome/GERT.C index 1b4b2f17ac..f6ac82a0ad 100644 --- a/src/frontends/gnome/GERT.C +++ b/src/frontends/gnome/GERT.C @@ -33,14 +33,8 @@ GERT::~GERT() void GERT::build() { // Connect the buttons. - ok_btn()->signal_clicked().connect(SigC::slot(*this, &GERT::OKClicked)); - cancel_btn()->signal_clicked().connect(SigC::slot(*this, &GERT::CancelClicked)); - apply_btn()->signal_clicked().connect(SigC::slot(*this, &GERT::ApplyClicked)); + close_btn()->signal_clicked().connect(SigC::slot(*this, &GERT::OKClicked)); - // 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(); @@ -55,9 +49,15 @@ void GERT::build() void GERT::connect_signals() { - slot_open = open()->signal_clicked().connect(SigC::slot(*this, &GERT::InputChanged)); - slot_collapsed = collapsed()->signal_clicked().connect(SigC::slot(*this, &GERT::InputChanged)); - slot_inlined = inlined()->signal_clicked().connect(SigC::slot(*this, &GERT::InputChanged)); + slot_open = open()->signal_clicked().connect( + SigC::slot(*this, &GERT::ApplyClicked) + ); + slot_collapsed = collapsed()->signal_clicked().connect( + SigC::slot(*this, &GERT::ApplyClicked) + ); + slot_inlined = inlined()->signal_clicked().connect( + SigC::slot(*this, &GERT::ApplyClicked) + ); } @@ -100,23 +100,9 @@ void GERT::update() } -bool GERT::validate() const +Gtk::Button * GERT::close_btn() const { - return true; -} - - -Gtk::Button * GERT::ok_btn() const -{ - return getWidget("r_ok_btn"); -} -Gtk::Button * GERT::apply_btn() const -{ - return getWidget("r_apply_btn"); -} -Gtk::Button * GERT::cancel_btn() const -{ - return getWidget("r_cancel_btn"); + return getWidget("r_close_btn"); } Gtk::RadioButton * GERT::open() const { diff --git a/src/frontends/gnome/GERT.h b/src/frontends/gnome/GERT.h index 0d690400e2..b5a39125c2 100644 --- a/src/frontends/gnome/GERT.h +++ b/src/frontends/gnome/GERT.h @@ -52,11 +52,7 @@ private: 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; + Gtk::Button * close_btn() const; /// generated by accessors.py Gtk::RadioButton * open() const; /// generated by accessors.py diff --git a/src/frontends/gnome/GFloat.C b/src/frontends/gnome/GFloat.C new file mode 100644 index 0000000000..de51528e8d --- /dev/null +++ b/src/frontends/gnome/GFloat.C @@ -0,0 +1,171 @@ +/** + * \file GFloat.C + * Copyright 2001 The LyX Team. + * See the file COPYING. + * + * \author Michael Koziarski + */ + +#ifdef __GNUG__ +#pragma implementation +#endif + +#include + +#include "gnomeBC.h" +#include "GFloat.h" +#include "support/lstrings.h" + +#include +#include +#include +#include + +GFloat::GFloat(ControlFloat & c) + : FormCB(c, "GFloat") +{} + + +GFloat::~GFloat() +{} + + +void GFloat::build() +{ + // Connect the buttons. + close_btn()->signal_clicked().connect(SigC::slot(*this, &GFloat::OKClicked)); + // Manage the buttons state + bc().setCancel(close_btn()); + bc().refresh(); + connect_signals(); +} + +void GFloat::apply() +{ + string placement; + if (here_definitely()->get_active()) { + placement += "H"; + } else { + if (top_of_page()->get_active()) { + placement += "t"; + } + if (bottom_of_page()->get_active()) { + placement += "b"; + } + if (page_of_floats()->get_active()) { + placement += "p"; + } + if (here_if_possible()->get_active()) { + placement += "h"; + } + } + controller().params().placement = placement; +} + + +void GFloat::update() +{ + disconnect_signals(); + bool top = false; + bool bottom = false; + bool page = false; + bool here = false; + bool forcehere = false; + + string placement(controller().params().placement); + + if (contains(placement, "H")) { + forcehere = true; + } else { + if (contains(placement, "t")) { + top = true; + } + if (contains(placement, "b")) { + bottom = true; + } + if (contains(placement, "p")) { + page = true; + } + if (contains(placement, "h")) { + here = true; + } + } + + top_of_page()->set_active(top); + page_of_floats()->set_active(page); + bottom_of_page()->set_active(bottom); + here_if_possible()->set_active(here); + here_definitely()->set_active(forcehere); + connect_signals(); +} + +void GFloat::connect_signals() +{ + conn_top_ = top_of_page()->signal_toggled().connect( + SigC::slot(*this, &GFloat::ApplyClicked) + ); + conn_bottom_ = bottom_of_page()->signal_toggled().connect( + SigC::slot(*this, &GFloat::ApplyClicked) + ); + conn_page_ = page_of_floats()->signal_toggled().connect( + SigC::slot(*this, &GFloat::ApplyClicked) + ); + conn_ifposs_ = here_if_possible()->signal_toggled().connect( + SigC::slot(*this, &GFloat::ApplyClicked) + ); + conn_definitely_ = here_definitely()->signal_toggled().connect( + SigC::slot(*this, &GFloat::ApplyClicked) + ); + conn_disable_ = here_definitely()->signal_toggled().connect( + SigC::slot(*this, &GFloat::update_sensitive) + ); +} + +void GFloat::disconnect_signals() +{ + conn_top_.disconnect(); + conn_bottom_.disconnect(); + conn_page_.disconnect(); + conn_ifposs_.disconnect(); + conn_definitely_.disconnect(); + conn_disable_.disconnect(); +} + +void GFloat::update_sensitive() +{ + if (here_definitely()->get_active()) + other_options()->set_sensitive(false); + else + other_options()->set_sensitive(true); + +} + +Gtk::HBox * GFloat::other_options() const +{ + return getWidget("r_other_options"); +} +Gtk::CheckButton * GFloat::page_of_floats() const +{ + return getWidget("r_page_of_floats"); +} +Gtk::CheckButton * GFloat::top_of_page() const +{ + return getWidget("r_top_of_page"); +} +Gtk::CheckButton * GFloat::bottom_of_page() const +{ + return getWidget("r_bottom_of_page"); +} +Gtk::CheckButton * GFloat::here_if_possible() const +{ + return getWidget("r_here_if_possible"); +} +Gtk::RadioButton * GFloat::here_definitely() const +{ + return getWidget("r_here_definitely"); +} + +Gtk::Button * GFloat::close_btn() const +{ + return getWidget("r_close_btn"); +} diff --git a/src/frontends/gnome/GFloat.h b/src/frontends/gnome/GFloat.h new file mode 100644 index 0000000000..c0225a7bcb --- /dev/null +++ b/src/frontends/gnome/GFloat.h @@ -0,0 +1,78 @@ + +// -*- C++ -*- +/** + * \file GFloat.h + * Copyright 2001 The LyX Team. + * See the file COPYING. + * + * \author Michael Koziarski + */ + +#ifndef GFLOAT_H +#define GFLOAT_H + +#ifdef __GNUG__ +#pragma interface +#endif + +#include "ControlFloat.h" +#include "GnomeBase.h" + +namespace Gtk { + class Buttton; + class CheckButton; + class RadioButton; + class HBox; +} + +/** + * This class implements the dialog to modify the LaTeX preamble + */ +class GFloat : public FormCB { +public: + /// + GFloat(ControlFloat & c); + /// + ~GFloat(); + + void apply(); + void update(); + +private: + /// Build the dialog + void build(); + + /// Returns true if the dialog input is in a valid state. + bool validate() const; + + /// + void connect_signals(); + /// + void disconnect_signals(); + + /// generated by accessors.py + Gtk::HBox * other_options() const; + /// generated by accessors.py + Gtk::CheckButton * page_of_floats() const; + /// generated by accessors.py + Gtk::CheckButton * top_of_page() const; + /// generated by accessors.py + Gtk::CheckButton * bottom_of_page() const; + /// generated by accessors.py + Gtk::CheckButton * here_if_possible() const; + /// generated by accessors.py + Gtk::RadioButton * here_definitely() const; + /// generated by accessors.py + Gtk::Button * close_btn() const; + /// Disable all the uncheckable buttons + void update_sensitive(); + + SigC::Connection conn_top_; + SigC::Connection conn_bottom_; + SigC::Connection conn_page_; + SigC::Connection conn_ifposs_; + SigC::Connection conn_definitely_; + SigC::Connection conn_disable_; +}; + +#endif diff --git a/src/frontends/gnome/GLog.C b/src/frontends/gnome/GLog.C index c262e761e7..17738efef8 100644 --- a/src/frontends/gnome/GLog.C +++ b/src/frontends/gnome/GLog.C @@ -71,7 +71,7 @@ void GLog::update() while (getline(ifstr, line)) text += line + "\n"; - log_text()->get_buffer()->set_text(text.c_str()); + log_text()->get_buffer()->set_text(text); } diff --git a/src/frontends/gnome/Makefile.am b/src/frontends/gnome/Makefile.am index 19f5d57905..780722419e 100644 --- a/src/frontends/gnome/Makefile.am +++ b/src/frontends/gnome/Makefile.am @@ -63,15 +63,16 @@ xforms.lo: $(xforms_objects) # KOZ 20020315 Large commented out removed. ### -#LDFLAGS= $(libgnome_la_OBJADD) -#LYXDATADIRS = - libgnome_la_SOURCES = \ Dialogs.C \ + GAbout.C \ + GAbout.h \ GError.C \ GError.h \ GERT.C \ GERT.h \ + GFloat.C \ + GFloat.h \ GLog.C \ GLog.h \ GPreamble.C \ @@ -89,36 +90,4 @@ libgnome_la_SOURCES = \ GUIRunTime.C \ pixbutton.h \ Timeout_pimpl.C \ - Timeout_pimpl.h - - - -# Trying to make things a litte more tidy. -- Koz-2002-01-11 -# mainapp.C \ -# mainapp.h \ -# Menubar_pimpl.C \ -# Menubar_pimpl.h \ -# -# FormCopyright.C \ -# FormCopyright.h \ -# FormCredits.C \ -# FormCredits.h \ -# These still have to be added. Sooner or later. ARRae-20000411 -# GUI_defaults.C \ -# GUI_initialize.C \ -# GUI_postlyxrc.C \ -# GUI_applymenu.C - -# just copied from old lyx repository -#dist-hook: -# for subdir in $(LYXDATADIRS) ; do \ -# test -d $(distdir)/$$subdir \ -# || mkdir $(distdir)/$$subdir \ -# || exit 1; \ -# chmod 777 $(distdir)/$$subdir; \ -# list=`(cd $(srcdir)/$$subdir && ls -1 | grep -v CVS)`; \ -# echo $$list ; \ -# for fil in $$list ; do \ -# cp -p $(srcdir)/$$subdir/$$fil $(distdir)/$$subdir ; \ -# done ; \ -# done + Timeout_pimpl.h \ No newline at end of file diff --git a/src/frontends/gnome/dialogs/GAbout.glade b/src/frontends/gnome/dialogs/GAbout.glade new file mode 100644 index 0000000000..28f59d8eef --- /dev/null +++ b/src/frontends/gnome/dialogs/GAbout.glade @@ -0,0 +1,215 @@ + + + + + + + About LyX + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False + True + False + True + + + + 2 + True + False + 0 + + + + 5 + True + GTK_BUTTONBOX_END + 10 + + + + True + True + True + gtk-close + True + GTK_RELIEF_NORMAL + -7 + + + + + 0 + False + True + GTK_PACK_END + + + + + + True + True + True + True + GTK_POS_TOP + False + 2 + 2 + False + + + + True + True + r_version + False + True + GTK_JUSTIFY_CENTER + False + True + 0.5 + 0.5 + 0 + 0 + + + False + True + + + + + + True + Version + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + tab + + + + + + True + True + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_SHADOW_NONE + GTK_CORNER_TOP_LEFT + + + + True + True + True + GTK_JUSTIFY_LEFT + GTK_WRAP_NONE + True + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + False + True + + + + + + True + Credits + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + tab + + + + + + True + True + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_SHADOW_NONE + GTK_CORNER_TOP_LEFT + + + + True + True + True + GTK_JUSTIFY_LEFT + GTK_WRAP_NONE + True + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + False + True + + + + + + True + Copyright + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + tab + + + + + 0 + True + True + + + + + + + diff --git a/src/frontends/gnome/dialogs/GERT.glade b/src/frontends/gnome/dialogs/GERT.glade index a52c7e04e4..aeb0f66632 100644 --- a/src/frontends/gnome/dialogs/GERT.glade +++ b/src/frontends/gnome/dialogs/GERT.glade @@ -1,148 +1,150 @@ - + - - 2 - no - ERT Options - GTK_WINDOW_DIALOG - no - yes - yes - GTK_WIN_POS_NONE - - - no - 8 - yes + + 2 + ERT Properties + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False + True + False + True - - - GTK_BUTTONBOX_DEFAULT_STYLE - 8 - yes + + + 2 + True + False + 8 - - - yes - yes - yes - gtk-ok - yes - yes - - + + + 5 + True + GTK_BUTTONBOX_END + 10 - - - yes - yes - yes - gtk-apply - yes - yes - - + + + True + True + True + gtk-close + True + GTK_RELIEF_NORMAL + -7 + + + + + 0 + False + True + GTK_PACK_END + + - - - yes - yes - yes - yes - gtk-cancel - yes - yes - - - - - 0 - no - yes - GTK_PACK_END - - + + + True + 0 + 0.5 + GTK_SHADOW_ETCHED_IN - - - Status - 0 - GTK_SHADOW_ETCHED_IN - yes + + + True + False + 0 - - - no - 0 - yes + + + True + True + _Open + True + GTK_RELIEF_NORMAL + True + False + True + + + 0 + False + False + + - - - yes - _Open - yes - yes - yes - yes - - - 0 - no - no - - + + + True + True + _Collapsed + True + GTK_RELIEF_NORMAL + False + False + True + r_open + + + 0 + False + False + + - - - yes - _Collapsed - no - yes - yes - r_open - yes - - - 0 - no - no - - + + + True + True + _Inlined View + True + GTK_RELIEF_NORMAL + False + False + True + r_open + + + 0 + False + False + + + + + + + + True + Status + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + label_item + + + + + 0 + True + True + + + + + - - - yes - _Inlined View - no - yes - yes - r_open - yes - - - 0 - no - no - - - - - - - 0 - yes - yes - - - - - 4 - yes - yes - - - diff --git a/src/frontends/gnome/dialogs/GFloat.glade b/src/frontends/gnome/dialogs/GFloat.glade new file mode 100644 index 0000000000..82d74fe0c5 --- /dev/null +++ b/src/frontends/gnome/dialogs/GFloat.glade @@ -0,0 +1,203 @@ + + + + + + + True + True + Float Properties + 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-close + True + GTK_RELIEF_NORMAL + -7 + + + + + 0 + False + True + GTK_PACK_END + + + + + + 5 + True + False + 3 + + + + True + True + Placement + True + GTK_RELIEF_NORMAL + False + False + True + + + 0 + False + False + + + + + + True + False + 0 + + + + True + False + 0 + + + + True + True + Page of floats + True + GTK_RELIEF_NORMAL + False + False + True + + + 0 + False + False + + + + + + True + True + Top of the page + True + GTK_RELIEF_NORMAL + False + False + True + + + 0 + False + False + + + + + + True + True + Bottom of the page + True + GTK_RELIEF_NORMAL + False + False + True + + + 0 + False + False + + + + + + True + True + Here, if possible + True + GTK_RELIEF_NORMAL + False + False + True + + + 0 + False + False + + + + + 20 + True + True + + + + + 0 + False + False + + + + + + True + True + Here, definitely + True + GTK_RELIEF_NORMAL + False + False + True + b_placement + + + 0 + False + False + + + + + 0 + True + True + + + + + + +