From: Lars Gullik Bjønnes Date: Sun, 26 Sep 2004 08:05:05 +0000 (+0000) Subject: GPrint dialog from John Spray X-Git-Tag: 1.6.10~15003 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=48e9df18b2d5e0e1041c62ee2104f04804e449f4;p=features.git GPrint dialog from John Spray git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9006 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/frontends/gtk/ChangeLog b/src/frontends/gtk/ChangeLog index 1def5b2a91..1fe81f6ca2 100644 --- a/src/frontends/gtk/ChangeLog +++ b/src/frontends/gtk/ChangeLog @@ -1,3 +1,12 @@ +2004-09-25 John Spray + + * GPrint.C: minor fixes to make it compile and work, get rid of + "Apply" + * Dialogs.C: move from FormPrint to GPrint + * Makefile.am: move from FormPrint to GPrint + * glade/print.glade: rearrange, gtk stock button for Print, get + rid of "Apply" + 2004-09-24 John Spray * GSearch.[Ch]: new files diff --git a/src/frontends/gtk/Dialogs.C b/src/frontends/gtk/Dialogs.C index 92ca067f46..54dd0fcdf6 100644 --- a/src/frontends/gtk/Dialogs.C +++ b/src/frontends/gtk/Dialogs.C @@ -76,7 +76,7 @@ #include "FormParagraph.h" #include "FormPreamble.h" #include "FormPreferences.h" -#include "FormPrint.h" +#include "GPrint.h" #include "FormRef.h" #include "GSearch.h" #include "FormSendto.h" @@ -463,9 +463,10 @@ Dialogs::DialogPtr Dialogs::build(string const & name) dialog->setView(new FormPreferences(*dialog)); dialog->bc().bp(new PreferencesPolicy); } else if (name == "print") { + dialog->bc().view(new GBC(dialog->bc())); dialog->setController(new ControlPrint(*dialog)); - dialog->setView(new FormPrint(*dialog)); - dialog->bc().bp(new OkApplyCancelPolicy); + dialog->setView(new GPrint(*dialog)); + dialog->bc().bp(new OkCancelPolicy); } else if (name == "ref") { dialog->setController(new ControlRef(*dialog)); dialog->setView(new FormRef(*dialog)); diff --git a/src/frontends/gtk/GPrint.C b/src/frontends/gtk/GPrint.C index d4d5c0eff0..011642da2a 100644 --- a/src/frontends/gtk/GPrint.C +++ b/src/frontends/gtk/GPrint.C @@ -18,6 +18,10 @@ #include "PrinterParams.h" #include "support/lstrings.h" +#include "support/tostr.h" + +using std::string; +using namespace lyx::support; namespace lyx { namespace frontend { @@ -33,7 +37,7 @@ void GPrint::apply() PrinterParams pp; pp.target = printer_->get_active() ? PrinterParams::PRINTER : PrinterParams::FILE; pp.printer_name = printerEntry_->get_text(); - pp.file_name = printerEntry_->get_text(); + pp.file_name = fileEntry_->get_text(); pp.all_pages = all_->get_active(); pp.from_page = pp.to_page = 0; if (!fromEntry_->get_text().empty()) { @@ -97,7 +101,7 @@ void GPrint::updateUI() void GPrint::onBrowse() { string const inName = fileEntry_->get_text(); - string const outName = Glib::locale_to_utf8(controller().Browse(Glib::locale_from_utf8(inName))); + string const outName = Glib::locale_to_utf8(controller().browse(Glib::locale_from_utf8(inName))); if (outName != inName && !outName.empty()) fileEntry_->set_text(outName); if (!outName.empty()) @@ -135,26 +139,24 @@ void GPrint::doBuild() xml_->get_widget("Even", even_); xml_->get_widget("Reverse", reverse_); xml_->get_widget("Number", number_); - xml_->get_widget("Sorted", sorted_); + xml_->get_widget("Collate", sorted_); xml_->get_widget("FromEntry", fromEntry_); xml_->get_widget("ToEntry", toEntry_); xml_->get_widget("PrinterEntry", printerEntry_); xml_->get_widget("FileEntry", fileEntry_); + Gtk::Button * ok; Gtk::Button * cancel; Gtk::Button * apply; - xml_->get_widget("OkButton", ok); + xml_->get_widget("PrintButton", ok); xml_->get_widget("CancelButton", cancel); - xml_->get_widget("ApplyButton", apply); - bc().setOK(ok); - bc().setApply(apply); - bc().setCancel(cancel); - ok->signal_clicked().connect(SigC::slot(*this, &GViewBase::onOK)); - apply->signal_clicked().connect(SigC::slot(*this, &GViewBase::onApply)); - cancel->signal_clicked().connect(SigC::slot(*this, &GViewBase::onCancel)); + setOK(ok); + setCancel(cancel); + Gtk::Button * browse; xml_->get_widget("Browse", browse); browse->signal_clicked().connect(SigC::slot(*this, &GPrint::onBrowse)); + fileEntry_->signal_changed().connect(SigC::bind(SigC::slot(*this, &GPrint::onTargetEdit), fileEntry_)); printerEntry_->signal_changed().connect(SigC::bind(SigC::slot(*this, &GPrint::onTargetEdit), printerEntry_)); fromEntry_->signal_changed().connect(SigC::slot(*this, &GPrint::onFromToEdit)); @@ -164,6 +166,10 @@ void GPrint::doBuild() all_->signal_toggled().connect(SigC::slot(*this, &GPrint::updateUI)); fromTo_->signal_toggled().connect(SigC::slot(*this, &GPrint::updateUI)); number_->signal_changed().connect(SigC::slot(*this, &GPrint::updateUI)); + + controller().initialiseParams(""); + update(); + updateUI(); } } // namespace frontend diff --git a/src/frontends/gtk/Makefile.am b/src/frontends/gtk/Makefile.am index e55cd35566..a46f161e5f 100644 --- a/src/frontends/gtk/Makefile.am +++ b/src/frontends/gtk/Makefile.am @@ -36,6 +36,8 @@ libgtk_la_SOURCES = \ GMiniBuffer.h \ GPainter.C \ GPainter.h \ + GPrint.C \ + GPrint.h \ GScreen.C \ GScreen.h \ GSearch.C \ @@ -75,9 +77,6 @@ libgtk_la_SOURCES = \ xftFontMetrics.C -# GPrint.h -# GPrint.C - xforms_objects = \ ../xforms/bmtable.lo \ ../xforms/checkedwidgets.lo \ @@ -112,7 +111,6 @@ xforms_objects = \ ../xforms/FormParagraph.lo \ ../xforms/FormPreamble.lo \ ../xforms/FormPreferences.lo \ - ../xforms/FormPrint.lo \ ../xforms/FormRef.lo \ ../xforms/FormSendto.lo \ ../xforms/forms_gettext.lo \ diff --git a/src/frontends/gtk/glade/print.glade b/src/frontends/gtk/glade/print.glade index f8e8efb99c..e1eea05029 100644 --- a/src/frontends/gtk/glade/print.glade +++ b/src/frontends/gtk/glade/print.glade @@ -5,22 +5,27 @@ True - LyX:Print + Print GTK_WINDOW_TOPLEVEL GTK_WIN_POS_NONE False False False - False + True + False + False + GDK_WINDOW_TYPE_HINT_DIALOG + GDK_GRAVITY_NORTH_WEST + True - + True False 0 - + True GTK_BUTTONBOX_END @@ -32,30 +37,21 @@ gtk-cancel True GTK_RELIEF_NORMAL + True -6 - + True True + True True - gtk-apply - True - GTK_RELIEF_NORMAL - -10 - - - - - - True - True - True - gtk-ok + gtk-print True GTK_RELIEF_NORMAL + True -5 @@ -69,7 +65,7 @@ - + True False 0 @@ -85,48 +81,12 @@ 5 True - 3 - 2 + 2 + 3 False 0 0 - - - True - False - 0 - - - - True - True - _Browse... - True - GTK_RELIEF_NORMAL - - - 5 - False - True - - - - - - - - - 1 - 2 - 2 - 3 - 5 - shrink|fill - fill - - - True @@ -180,6 +140,7 @@ _File: True GTK_RELIEF_NORMAL + True False False True @@ -203,6 +164,7 @@ _Printer: True GTK_RELIEF_NORMAL + True False False True @@ -219,6 +181,25 @@ + + + + True + True + _Browse... + True + GTK_RELIEF_NORMAL + True + + + 2 + 3 + 1 + 2 + fill + + + @@ -242,197 +223,261 @@ - 0 - True + 3 + False True - + True - 0 - 0.5 - GTK_SHADOW_ETCHED_IN + False + 0 - - 5 + True - False - 10 + 0 + 0.5 + GTK_SHADOW_ETCHED_IN - - True - True - A_ll - True - GTK_RELIEF_NORMAL - False - False - True - - - 0 - False - False - - - - - + True False 0 - + + 5 True - True - Fro_m: - True - GTK_RELIEF_NORMAL - False - False - True - All + False + 10 + + + + True + True + A_ll + True + GTK_RELIEF_NORMAL + True + False + False + True + + + 0 + False + False + + + + + + True + False + 0 + + + + True + True + Fro_m: + True + GTK_RELIEF_NORMAL + True + False + False + True + All + + + 0 + False + False + + + + + + True + True + True + True + 5 + + True + * + False + 5 + + + 10 + False + False + + + + + + True + To: + True + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + ToEntry + + + 0 + False + False + + + + + + True + True + True + True + 5 + + True + * + False + 5 + + + 10 + False + False + + + + + 0 + False + True + + 0 False - False - - - - - - True - True - True - True - 5 - - True - * - False - 5 - - - 10 - False - False + True - + True - To: - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 + False + 0 + + + + True + True + _Odd numbered pages + True + GTK_RELIEF_NORMAL + True + False + False + True + + + 0 + False + False + + + + + + True + True + _Even numbered pages + True + GTK_RELIEF_NORMAL + True + False + False + True + + + 0 + False + False + + + + + + True + True + _Reverse order + True + GTK_RELIEF_NORMAL + True + False + False + True + + + 0 + False + False + + 0 - False - False - - - - - - True - True - True - True - 5 - - True - * - False - 5 - - - 10 - False - False + True + True - - 0 - True - True - - - - - - True - True - _Odd numbered pages - True - GTK_RELIEF_NORMAL - False - False - True - - - 0 - False - False - - + True - True - _Even numbered pages - True - GTK_RELIEF_NORMAL - False - False - True - - - 0 - False - False - - - - - - True - True - _Reverse order - True - GTK_RELIEF_NORMAL - False - False - True + Pages + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 - 0 - False - False + label_item + + 0 + True + True + - + True - Pages + False False GTK_JUSTIFY_LEFT @@ -444,35 +489,101 @@ 0 - label_item + 5 + False + False - - - 0 - True - True - - - - - - True - 0 - 0.5 - GTK_SHADOW_ETCHED_IN - - 10 + True - True - 5 + 0 + 0.5 + GTK_SHADOW_ETCHED_IN + + + + True + 2 + 2 + False + 0 + 0 + + + + True + True + 1 + 0 + True + GTK_UPDATE_ALWAYS + False + False + 1 0 100 1 10 10 + + + 1 + 2 + 0 + 1 + + + + + + + True + Number: + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + 0 + 1 + 0 + 1 + fill + expand + + + + + + True + True + Colla_te + True + GTK_RELIEF_NORMAL + True + False + False + True + + + 1 + 2 + 1 + 2 + fill + expand + + + + - + True - Number + Copies False False GTK_JUSTIFY_LEFT @@ -484,73 +595,20 @@ 0 - 0 - False - False - - - - - - True - True - 1 - 0 - True - GTK_UPDATE_ALWAYS - False - False - 1 0 100 1 10 10 - - - 0 - True - True - - - - - - True - True - _Sorted - True - GTK_RELIEF_NORMAL - False - False - True - - - 0 - False - False + label_item - - - - - True - Copies - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - - label_item + 0 + True + True - 0 - True + 4 + False True