From ca90f64323114034cccbf5eb4c6a63b25c619a30 Mon Sep 17 00:00:00 2001 From: John Spray Date: Mon, 6 Feb 2006 21:46:25 +0000 Subject: [PATCH] Use GtkLengthEntry in GGraphics, tweak glade a little git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10815 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/gtk/ChangeLog | 4 + src/frontends/gtk/GGraphics.C | 37 +-- src/frontends/gtk/GGraphics.h | 8 +- src/frontends/gtk/glade/graphics.glade | 317 ++++++++++++++----------- 4 files changed, 190 insertions(+), 176 deletions(-) diff --git a/src/frontends/gtk/ChangeLog b/src/frontends/gtk/ChangeLog index 17444fbb3b..70d0304ddd 100644 --- a/src/frontends/gtk/ChangeLog +++ b/src/frontends/gtk/ChangeLog @@ -1,3 +1,7 @@ +2006-02-06 John Spray + + * GGraphics.[Ch], glade/graphics.glade: Use GtkLengthEntry, touch up glade + 2006-02-05 John Spray * GPreferences.[Ch], glade/preferences.glade: Start work on diff --git a/src/frontends/gtk/GGraphics.C b/src/frontends/gtk/GGraphics.C index 3f5ea476e9..14f53632b4 100644 --- a/src/frontends/gtk/GGraphics.C +++ b/src/frontends/gtk/GGraphics.C @@ -78,18 +78,10 @@ void GGraphics::doBuild() xml_->get_widget("Browse", browsebutton_); xml_->get_widget("Edit", editbutton_); xml_->get_widget("Display", displaycombo_); - xml_->get_widget("Width", widthspin_); - xml_->get_widget("Height", heightspin_); + xml_->get_widget_derived("Width", widthlengthentry_); + xml_->get_widget_derived("Height", heightlengthentry_); xml_->get_widget("MaintainAspectRatio", aspectcheck_); - Gtk::VBox * box; - xml_->get_widget("WidthUnits", box); - box->pack_start(widthunitscombo_, true, true, 0); - box->show_all(); - xml_->get_widget("HeightUnits", box); - box->pack_start(heightunitscombo_, true, true, 0); - box->show_all(); - xml_->get_widget("SetScaling", setscalingradio_); xml_->get_widget("SetSize", setsizeradio_); @@ -128,13 +120,9 @@ void GGraphics::doBuild() sigc::mem_fun(*this, &GGraphics::onInput)); outputscalespin_->signal_changed().connect( sigc::mem_fun(*this, &GGraphics::onInput)); - heightspin_->signal_changed().connect( - sigc::mem_fun(*this, &GGraphics::onInput)); - heightunitscombo_.signal_changed().connect( + heightlengthentry_->signal_changed().connect( sigc::mem_fun(*this, &GGraphics::onInput)); - widthspin_->signal_changed().connect( - sigc::mem_fun(*this, &GGraphics::onInput)); - widthunitscombo_.signal_changed().connect( + widthlengthentry_->signal_changed().connect( sigc::mem_fun(*this, &GGraphics::onInput)); aspectcheck_->signal_toggled().connect( sigc::mem_fun(*this, &GGraphics::onInput)); @@ -150,9 +138,6 @@ void GGraphics::doBuild() editbutton_->signal_clicked().connect( sigc::mem_fun(*this, &GGraphics::onEditClicked)); - populateUnitCombo(widthunitscombo_, true); - populateUnitCombo(heightunitscombo_, true); - // the bounding box page leftbottomxspin_->signal_changed().connect( sigc::mem_fun(*this, &GGraphics::onBBChange)); @@ -215,10 +200,8 @@ void GGraphics::onSizingModeChange() bool const scalingmode = setscalingradio_->get_active(); outputscalespin_->set_sensitive(scalingmode); - widthspin_->set_sensitive(!scalingmode); - heightspin_->set_sensitive(!scalingmode); - widthunitscombo_.set_sensitive(!scalingmode); - heightunitscombo_.set_sensitive(!scalingmode); + widthlengthentry_->set_sensitive(!scalingmode); + heightlengthentry_->set_sensitive(!scalingmode); aspectcheck_->set_sensitive(!scalingmode); bc().input(ButtonPolicy::SMI_VALID); } @@ -282,10 +265,10 @@ void GGraphics::apply() igp.width = LyXLength(); } else { igp.scale = string(); - igp.width = LyXLength(getLengthFromWidgets(*widthspin_->get_adjustment(), widthunitscombo_)); + igp.width = widthlengthentry_->get_length(); } - igp.height = LyXLength(getLengthFromWidgets(*heightspin_->get_adjustment(), heightunitscombo_)); + igp.height = heightlengthentry_->get_length(); igp.keepAspectRatio = aspectcheck_->get_active(); igp.draft = draftcheck_->get_active(); @@ -377,8 +360,8 @@ void GGraphics::update() { outputscalespin_->get_adjustment()->set_value(convert(igp.scale)); - setWidgetsFromLength(*widthspin_->get_adjustment(), widthunitscombo_, igp.width); - setWidgetsFromLength(*heightspin_->get_adjustment(), heightunitscombo_, igp.height); + widthlengthentry_->set_length(igp.width); + heightlengthentry_->set_length(igp.height); if (!igp.scale.empty() && !float_equal(convert(igp.scale), 0.0, 0.05)) { diff --git a/src/frontends/gtk/GGraphics.h b/src/frontends/gtk/GGraphics.h index 1907d81b9d..149410e0b1 100644 --- a/src/frontends/gtk/GGraphics.h +++ b/src/frontends/gtk/GGraphics.h @@ -14,6 +14,8 @@ #include "GViewBase.h" +#include "GtkLengthEntry.h" + #include "lyxlength.h" #include @@ -62,11 +64,9 @@ private: Gtk::Button * browsebutton_; Gtk::Button * editbutton_; Gtk::ComboBox * displaycombo_; - Gtk::SpinButton * widthspin_; - Gtk::SpinButton * heightspin_; + GtkLengthEntry * widthlengthentry_; + GtkLengthEntry * heightlengthentry_; Gtk::CheckButton * aspectcheck_; - Gtk::ComboBoxText widthunitscombo_; - Gtk::ComboBoxText heightunitscombo_; Gtk::RadioButton * setscalingradio_; Gtk::RadioButton * setsizeradio_; diff --git a/src/frontends/gtk/glade/graphics.glade b/src/frontends/gtk/glade/graphics.glade index 2ef1b3f616..2043ad44f1 100644 --- a/src/frontends/gtk/glade/graphics.glade +++ b/src/frontends/gtk/glade/graphics.glade @@ -15,6 +15,7 @@ False GDK_WINDOW_TYPE_HINT_DIALOG GDK_GRAVITY_NORTH_WEST + True False @@ -85,6 +86,10 @@ 0.5 0 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 0 @@ -122,6 +127,7 @@ GTK_RELIEF_NORMAL True -6 + @@ -129,6 +135,7 @@ True True + True True gtk-ok True @@ -148,6 +155,7 @@ + 6 True True True @@ -247,6 +255,10 @@ 0.5 0 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 0 @@ -324,6 +336,10 @@ 0.5 0 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 0 @@ -360,6 +376,10 @@ 0 0 File + PANGO_ELLIPSIZE_NONE + -1 + False + 0 0 @@ -380,7 +400,7 @@ 0 True - * + * False @@ -409,6 +429,10 @@ 0.5 0 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 label_item @@ -461,6 +485,10 @@ 0 0 DisplayScale + PANGO_ELLIPSIZE_NONE + -1 + False + 0 0 @@ -501,6 +529,10 @@ 0.5 0 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 0 @@ -521,6 +553,8 @@ Monochrome Grayscale Color Do not display + False + True 6 @@ -543,6 +577,10 @@ Do not display 0.5 0 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 0 @@ -569,6 +607,10 @@ Do not display 0.5 0 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 label_item @@ -605,33 +647,11 @@ Do not display True 5 - 4 + 3 False 6 6 - - - True - False - True - 1 - 2 - True - GTK_UPDATE_ALWAYS - False - False - 1 0.1 1e+06 1 10 10 - - - 2 - 3 - 2 - 3 - - - - True @@ -691,6 +711,10 @@ Do not display 0 0 OutputScale + PANGO_ELLIPSIZE_NONE + -1 + False + 0 1 @@ -737,6 +761,10 @@ Do not display 0 0 Width + PANGO_ELLIPSIZE_NONE + -1 + False + 0 1 @@ -762,6 +790,10 @@ Do not display 0 0 Height + PANGO_ELLIPSIZE_NONE + -1 + False + 0 1 @@ -779,7 +811,7 @@ Do not display 1 - 4 + 3 1 2 fill @@ -810,53 +842,7 @@ Do not display - - True - False - True - 1 - 2 - True - GTK_UPDATE_ALWAYS - False - False - 1 0.1 1e+06 1 10 10 - - - 2 - 3 - 3 - 4 - - - - - - - True - % - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - - - 3 - 4 - 0 - 1 - fill - - - - - - + True False 0 @@ -864,10 +850,14 @@ Do not display + + + + - 3 - 4 + 2 + 3 2 3 fill @@ -876,7 +866,7 @@ Do not display - + True False 0 @@ -884,10 +874,14 @@ Do not display + + + + - 3 - 4 + 2 + 3 3 4 fill @@ -912,6 +906,10 @@ Do not display 0.5 0 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 label_item @@ -944,6 +942,10 @@ Do not display 0.5 0 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 tab @@ -955,7 +957,7 @@ Do not display 6 True False - 0 + 6 @@ -967,7 +969,7 @@ Do not display True 3 - 3 + 4 False 6 6 @@ -985,6 +987,10 @@ Do not display 0.5 0 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 0 @@ -1009,6 +1015,10 @@ Do not display 0.5 0 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 0 @@ -1033,6 +1043,10 @@ Do not display 0.5 0 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 1 @@ -1057,6 +1071,10 @@ Do not display 0.5 0 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 2 @@ -1078,7 +1096,7 @@ Do not display GTK_UPDATE_ALWAYS False False - 0 0 1e+06 1 10 10 + 0 0 1000000 1 10 10 1 @@ -1099,7 +1117,7 @@ Do not display GTK_UPDATE_ALWAYS False False - 1 0 1e+06 1 10 10 + 1 0 1000000 1 10 10 1 @@ -1120,7 +1138,7 @@ Do not display GTK_UPDATE_ALWAYS False False - 1 0 1e+06 1 10 10 + 1 0 1000000 1 10 10 2 @@ -1141,7 +1159,7 @@ Do not display GTK_UPDATE_ALWAYS False False - 1 0 1e+06 1 10 10 + 1 0 1000000 1 10 10 2 @@ -1151,23 +1169,6 @@ Do not display - - - 0 - True - True - - - - - - True - False - 0 - - - - @@ -1175,13 +1176,11 @@ Do not display False 0 - - - - True + False + True 0 @@ -1204,6 +1203,10 @@ Do not display 0.5 0 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 0 @@ -1212,21 +1215,16 @@ Do not display GTK_PACK_END - - - - - 0 - False - True + 3 + 4 + 1 + 3 + fill + - - - - 0 @@ -1243,34 +1241,11 @@ Do not display - - - - - + True False 0 - - - True - True - Clip to bounding box - True - GTK_RELIEF_NORMAL - True - False - False - True - - - 0 - False - False - - - True @@ -1316,7 +1291,7 @@ Do not display True - Get from file + Get bounds from file True False GTK_JUSTIFY_LEFT @@ -1326,6 +1301,10 @@ Do not display 0.5 0 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 0 @@ -1342,19 +1321,37 @@ Do not display 0 False False - GTK_PACK_END + + + + 0 False - True + False - + + True + True + Clip image to bounding box + True + GTK_RELIEF_NORMAL + True + False + False + True + + + 0 + False + False + @@ -1376,6 +1373,10 @@ Do not display 0.5 0 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 tab @@ -1408,6 +1409,10 @@ Do not display 0.5 0 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 0 @@ -1448,6 +1453,10 @@ Do not display 0.5 0 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 0 @@ -1463,6 +1472,8 @@ Do not display True + False + True 5 @@ -1485,6 +1496,10 @@ Do not display 0.5 0 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 0 @@ -1539,6 +1554,10 @@ Do not display 0.5 0 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 12 @@ -1556,7 +1575,7 @@ Do not display 0 True - * + * False @@ -1592,6 +1611,10 @@ Do not display 0.5 0 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 0 @@ -1609,7 +1632,7 @@ Do not display 0 True - * + * False @@ -1683,6 +1706,10 @@ Do not display 0.5 0 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 tab -- 2.39.5