+2004-11-14 John Spray <spray_john@users.sourceforge.net>
+
+ * The Box dialog:
+ Dialogs.C, Makefile.am, GBox.C, GBox.h
+ * ghelpers.[Ch], GGraphics.[Ch]: new functions unitsComboFromLength
+ and getDefaultUnit take functionality that was in GGraphics into
+ ghelpers
+
2004-11-08 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* GToolbar.C (selected): use layoutSelected()
#include "GMathDelim.h"
#include "FormBibitem.h"
#include "FormBibtex.h"
-#include "FormBox.h"
+#include "GBox.h"
#include "FormBranch.h"
#include "GChanges.h"
#include "GCharacter.h"
dialog->setView(new FormBibtex(*dialog));
dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
} else if (name == "box") {
+ dialog->bc().view(new GBC(dialog->bc()));
dialog->setController(new ControlBox(*dialog));
- dialog->setView(new FormBox(*dialog));
+ dialog->setView(new GBox(*dialog));
dialog->bc().bp(new OkApplyCancelReadOnlyPolicy);
} else if (name == "changes") {
dialog->bc().view(new GBC(dialog->bc()));
--- /dev/null
+/**
+ * \file GBox.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author John Spray
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#include <config.h>
+
+#include "GBox.h"
+
+#include "ghelpers.h"
+
+#include "controllers/ControlBox.h"
+
+#include "insets/insetbox.h"
+#include "lengthcommon.h"
+#include "lyxrc.h" // to set the default length values
+
+using std::string;
+using std::vector;
+
+namespace lyx {
+namespace frontend {
+
+namespace {
+string defaultUnit("cm");
+} // namespace anon
+
+GBox::GBox(Dialog & parent)
+ : GViewCB<ControlBox, GViewGladeB>(parent, _("Box Settings"), false)
+{}
+
+
+void GBox::doBuild()
+{
+ string const gladeName = findGladeFile("box");
+ xml_ = Gnome::Glade::Xml::create(gladeName);
+
+ Gtk::Button * closebutton;
+ xml_->get_widget("Close", closebutton);
+ setCancel(closebutton);
+
+ xml_->get_widget("Type", typecombo_);
+ bcview().addReadOnly(typecombo_);
+ xml_->get_widget("InnerBox", innerboxcombo_);
+ bcview().addReadOnly(innerboxcombo_);
+ xml_->get_widget("WidthUnits", widthunitscombo_);
+ bcview().addReadOnly(widthunitscombo_);
+ xml_->get_widget("HeightUnits", heightunitscombo_);
+ bcview().addReadOnly(heightunitscombo_);
+ xml_->get_widget("BoxVertical", boxvertcombo_);
+ bcview().addReadOnly(boxvertcombo_);
+ xml_->get_widget("ContentVertical", contentvertcombo_);
+ bcview().addReadOnly(contentvertcombo_);
+ xml_->get_widget("ContentHorizontal", contenthorzcombo_);
+ bcview().addReadOnly(contenthorzcombo_);
+ xml_->get_widget("Width", widthspin_);
+ bcview().addReadOnly(widthspin_);
+ xml_->get_widget("Height", heightspin_);
+ bcview().addReadOnly(heightspin_);
+
+ cols_.add(stringcol_);
+
+ // fill the box type choice
+ box_gui_tokens(ids_, gui_names_);
+ PopulateComboBox(typecombo_, gui_names_);
+ typecombo_->signal_changed().connect(
+ sigc::mem_fun(*this, &GBox::onTypeComboChanged));
+
+ // set up innerbox (populated in setInnerType)
+ innerboxstore_ = Gtk::ListStore::create(cols_);
+ innerboxcombo_->set_model(innerboxstore_);
+ Gtk::CellRendererText * cell = Gtk::manage(new Gtk::CellRendererText);
+ innerboxcombo_->pack_start(*cell, true);
+ innerboxcombo_->add_attribute(*cell, "text", 0);
+
+ innerboxcombo_->signal_changed().connect(
+ sigc::mem_fun(*this, &GBox::onInnerBoxComboChanged));
+
+ boxvertcombo_->signal_changed().connect(
+ sigc::mem_fun(*this, &GBox::onAlignChanged));
+ contenthorzcombo_->signal_changed().connect(
+ sigc::mem_fun(*this, &GBox::onAlignChanged));
+ contentvertcombo_->signal_changed().connect(
+ sigc::mem_fun(*this, &GBox::onAlignChanged));
+
+ heightunitscombo_->signal_changed().connect(
+ sigc::mem_fun(*this, &GBox::onHeightChanged));
+ widthunitscombo_->signal_changed().connect(
+ sigc::mem_fun(*this, &GBox::onWidthChanged));
+
+ heightspin_->signal_value_changed().connect(
+ sigc::mem_fun(*this, &GBox::onHeightChanged));
+ widthspin_->signal_value_changed().connect(
+ sigc::mem_fun(*this, &GBox::onWidthChanged));
+
+
+ widthunitsstore_ = Gtk::ListStore::create(cols_);
+ widthunitscombo_->set_model(widthunitsstore_);
+ cell = Gtk::manage(new Gtk::CellRendererText);
+ widthunitscombo_->pack_start(*cell, true);
+ widthunitscombo_->add_attribute(*cell, "text", 0);
+ //widthunitscombo_ is populated in setSpecial
+
+ box_gui_tokens_special_length(ids_spec_, gui_names_spec_);
+ vector<string> heightunits = buildLengthUnitList();
+ // Append special entries, skipping the first item "None"
+ heightunits.insert(heightunits.end(),
+ ++gui_names_spec_.begin(), gui_names_spec_.end());
+
+ PopulateComboBox(heightunitscombo_, heightunits);
+}
+
+
+void GBox::PopulateComboBox(Gtk::ComboBox * combo,
+ vector<string> const & strings
+ )
+{
+ Glib::RefPtr<Gtk::ListStore> model = Gtk::ListStore::create(cols_);
+ vector<string>::const_iterator it = strings.begin();
+ vector<string>::const_iterator end = strings.end();
+ for(; it != end; ++it)
+ (*model->append())[stringcol_] = *it;
+
+ combo->set_model(model);
+ Gtk::CellRendererText * cell = Gtk::manage(new Gtk::CellRendererText);
+ combo->pack_start(*cell, true);
+ combo->add_attribute(*cell, "text", 0);
+}
+
+
+void GBox::update()
+{
+ applylock_ = true;
+
+ defaultUnit = getDefaultUnit();
+
+ char c = controller().params().pos;
+ boxvertcombo_->set_active(string("tcb").find(c, 0));
+ c = controller().params().inner_pos;
+ contentvertcombo_->set_active(string("tcbs").find(c, 0));
+ c = controller().params().hor_pos;
+ contenthorzcombo_->set_active(string("lcrs").find(c, 0));
+
+ string type(controller().params().type);
+ for (unsigned int i = 0; i < gui_names_.size(); ++i) {
+ if (type == ids_[i])
+ typecombo_->set_active(i);
+ }
+
+ applylock_ = false;
+ updateInnerBoxCombo();
+ applylock_ = true;
+
+ bool ibox = controller().params().inner_box;
+ boxvertcombo_->set_sensitive(ibox);
+ contentvertcombo_->set_sensitive(ibox);
+ contenthorzcombo_->set_sensitive(!ibox);
+ setSpecial(ibox);
+
+ widthspin_->get_adjustment()->set_value(controller().params().width.value());
+ unitsComboFromLength(widthunitscombo_, stringcol_,
+ controller().params().width, defaultUnit);
+
+ string const special(controller().params().special);
+ if (!special.empty() && special != "none") {
+ string spc;
+ for (unsigned int i = 0; i < gui_names_spec_.size(); ++i) {
+ if (special == ids_spec_[i])
+ spc = gui_names_spec_[i];
+ }
+ for (int j = 0; j < widthunitsstore_->children().size(); ++j) {
+ if (widthunitsstore_->children()[j][stringcol_] == spc)
+ widthunitscombo_->set_active(j);
+ }
+ }
+
+ heightspin_->get_adjustment()->set_value(controller().params().height.value());
+ unitsComboFromLength(heightunitscombo_, stringcol_,
+ controller().params().height, defaultUnit);
+
+ string const height_special(controller().params().height_special);
+ if (!height_special.empty() && height_special != "none") {
+ string hspc;
+ for (unsigned int i = 0; i < gui_names_spec_.size(); ++i) {
+ if (height_special == ids_spec_[i]) {
+ hspc = gui_names_spec_[i];
+ }
+ }
+ for (int j = 0; j < heightunitscombo_->get_model()->children().size(); ++j) {
+ if (heightunitscombo_->get_model()->children()[j][stringcol_] == hspc) {
+ heightunitscombo_->set_active(j);
+ }
+ }
+ }
+
+ heightspin_->set_sensitive(ibox);
+ heightunitscombo_->set_sensitive(ibox);
+ applylock_ = false;
+}
+
+
+void GBox::setSpecial(bool ibox)
+{
+ bool const oldlock = applylock_;
+ applylock_ = true;
+
+ unsigned int const initselection = widthunitscombo_->get_active_row_number();
+ widthunitsstore_->clear();
+ vector<string> normalunits = buildLengthUnitList();
+ if (ibox) {
+ vector<string>::const_iterator it = normalunits.begin();
+ vector<string>::const_iterator end = normalunits.end();
+ for(; it != end; ++it)
+ (*widthunitsstore_->append())[stringcol_] = *it;
+ } else {
+ vector<string>::const_iterator it = normalunits.begin();
+ vector<string>::const_iterator end = normalunits.end();
+ for(; it != end; ++it)
+ (*widthunitsstore_->append())[stringcol_] = *it;
+ // Skip the first item "None"
+ it = ++gui_names_spec_.begin();
+ end = gui_names_spec_.end();
+ for(; it != end; ++it)
+ (*widthunitsstore_->append())[stringcol_] = *it;
+ }
+
+ int const store_size = widthunitsstore_->children().size();
+ if (initselection >= store_size) {
+ widthunitscombo_->set_active(0);
+ onWidthChanged();
+ } else {
+ widthunitscombo_->set_active(initselection);
+ }
+ applylock_ = oldlock;
+}
+
+
+void GBox::updateInnerBoxCombo()
+{
+ bool const oldlock = applylock_;
+ applylock_ = true;
+ // with "frameless" boxes, inner box is mandatory (i.e. is the actual box)
+ // we have to remove "none" then and adjust the combo
+
+ // default: minipage
+ unsigned int i = 2;
+ if (!controller().params().inner_box)
+ // none
+ i = 0;
+ if (controller().params().use_parbox)
+ // parbox
+ i = 1;
+ bool frameless = (controller().params().type == "Frameless");
+
+ int const oldsize = innerboxstore_->children().size();
+ // Store the initial selection in 0,1,2 format
+ int oldselection = -1;
+ if (oldsize == 2)
+ oldselection = innerboxcombo_->get_active_row_number() + 1;
+ else if (oldsize == 3)
+ oldselection = innerboxcombo_->get_active_row_number();
+
+ if (frameless && oldsize != 2) {
+ innerboxstore_->clear();
+ (*innerboxstore_->append())[stringcol_] = _("Parbox");
+ (*innerboxstore_->append())[stringcol_] = _("Minipage");
+ // Cope when the backend asks for no inner box in
+ // a frameless box
+ if (i == 0) {
+ applylock_ = false;
+ innerboxcombo_->set_active(i);
+ applylock_ = true;
+ } else
+ innerboxcombo_->set_active(i - 1);
+ } else if (!frameless && oldsize != 3) {
+ innerboxstore_->clear();
+ (*innerboxstore_->append())[stringcol_] = _("None");
+ (*innerboxstore_->append())[stringcol_] = _("Parbox");
+ (*innerboxstore_->append())[stringcol_] = _("Minipage");
+ innerboxcombo_->set_active(i);
+ } else {
+ // we're not changing the liststore, just selecting i
+ if (!frameless)
+ innerboxcombo_->set_active(i);
+ if (frameless)
+ innerboxcombo_->set_active(i - 1);
+ }
+
+ // Update the width units list if we've changed inner box type
+ if (i != oldselection)
+ setSpecial(i != 0);
+
+ applylock_ = oldlock;
+}
+
+
+void GBox::onInnerBoxComboChanged()
+{
+ if (applylock_)
+ return;
+
+ controller().params().use_parbox =
+ (*innerboxcombo_->get_active())[stringcol_] == _("Parbox");
+
+ bool const ibox = (*innerboxcombo_->get_active())[stringcol_] != _("None");
+ controller().params().inner_box = ibox;
+ setSpecial(ibox);
+
+ boxvertcombo_->set_sensitive(ibox);
+ contentvertcombo_->set_sensitive(ibox);
+ contenthorzcombo_->set_sensitive(!ibox);
+ heightspin_->set_sensitive(ibox);
+ heightunitscombo_->set_sensitive(ibox);
+ // wtf? form_->set_sensitive(ibox);
+
+ controller().dispatchParams();
+}
+
+
+void GBox::onTypeComboChanged()
+{
+ int const index = typecombo_->get_active_row_number();
+ controller().params().type = ids_[index];
+
+ bool frameless = (index == 0);
+ if (frameless) {
+ boxvertcombo_->set_sensitive(true);
+ contentvertcombo_->set_sensitive(true);
+ contenthorzcombo_->set_sensitive(false);
+ heightspin_->set_sensitive(true);
+ heightunitscombo_->set_sensitive(true);
+ //wtf? form_->setSpecial(true);
+ }
+ //int itype = innerboxcombo_->get_active_row_number();
+ controller().dispatchParams();
+
+ updateInnerBoxCombo();
+}
+
+
+void GBox::onHeightChanged()
+{
+ if (applylock_)
+ return;
+
+ // "None"
+ int i = 0;
+ bool spec = false;
+ Glib::ustring special = (*heightunitscombo_->get_active())[stringcol_];
+ for (int j = 1; j < gui_names_spec_.size() ; ++j) {
+ if (gui_names_spec_[j] == special) {
+ i=j;
+ spec = true;
+ }
+ }
+ controller().params().height_special = ids_spec_[i];
+
+ string height;
+ if (spec) {
+ height = heightspin_->get_text();
+ // beware: bogosity! the unit is simply ignored in this case
+ height += "in";
+ } else {
+ Glib::ustring const heightunit =
+ (*heightunitscombo_->get_active())[stringcol_];
+ height = heightspin_->get_text() + heightunit;
+ }
+
+ controller().params().height = LyXLength(height);
+ controller().dispatchParams();
+}
+
+
+void GBox::onWidthChanged()
+{
+ if (applylock_)
+ return;
+
+ int i = 0;
+ bool spec = false;
+ Glib::ustring special = (*widthunitscombo_->get_active())[stringcol_];
+ for (int j = 1; j < gui_names_spec_.size() ; ++j) {
+ if (gui_names_spec_[j] == special) {
+ i=j;
+ spec = true;
+ }
+ }
+ controller().params().special = ids_spec_[i];
+
+ string width;
+ if (spec) {
+ width = widthspin_->get_text();
+ // beware: bogosity! the unit is simply ignored in this case
+ width += "in";
+ } else {
+ Glib::ustring const widthunit =
+ (*widthunitscombo_->get_active())[stringcol_];
+ width = widthspin_->get_text() + widthunit;
+ }
+
+ controller().params().width = LyXLength(width);
+ controller().dispatchParams();
+}
+
+
+void GBox::onAlignChanged()
+{
+ if (applylock_)
+ return;
+
+ controller().params().pos =
+ "tcb"[boxvertcombo_->get_active_row_number()];
+ controller().params().inner_pos =
+ "tcbs"[contenthorzcombo_->get_active_row_number()];
+ controller().params().hor_pos =
+ "lcrs"[contentvertcombo_->get_active_row_number()];
+
+ controller().dispatchParams();
+}
+
+} // namespace frontend
+} // namespace lyx
--- /dev/null
+// -*- C++ -*-
+/**
+ * \file GBox.h
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author John Spray
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#ifndef GBOX_H
+#define GBOX_H
+
+#include "GViewBase.h"
+
+#include "lyxlength.h"
+
+#include <vector>
+#include <string>
+
+namespace lyx {
+namespace frontend {
+
+class ControlBox;
+
+class GBox
+ : public GViewCB<ControlBox, GViewGladeB>
+{
+public:
+ GBox(Dialog &);
+
+ // This dialog is instant-apply
+ virtual void apply() {}
+ // update
+ virtual void update();
+ // build the dialog
+ virtual void doBuild();
+
+ // Put strings into combo
+ void PopulateComboBox(Gtk::ComboBox * combo,
+ std::vector<std::string> const & strings);
+
+ // add or remove special lengths in widthunits combo
+ void setSpecial(bool ibox);
+ // only show valid inner box options
+ void updateInnerBoxCombo();
+
+ // Signal handlers
+ void onTypeComboChanged();
+ void onInnerBoxComboChanged();
+ void onAlignChanged();
+ void onHeightChanged();
+ void onWidthChanged();
+
+ // Some event handlers are disabled when this is true
+ bool applylock_;
+
+ // The 'type' field keys and display strings
+ std::vector<std::string> ids_;
+ std::vector<std::string> gui_names_;
+
+ // The special units for width and height
+ std::vector<std::string> ids_spec_;
+ std::vector<std::string> gui_names_spec_;
+
+ // Widgets from glade
+ Gtk::ComboBox * typecombo_;
+ Gtk::ComboBox * innerboxcombo_;
+ Glib::RefPtr<Gtk::ListStore> innerboxstore_;
+ Gtk::ComboBox * widthunitscombo_;
+ Glib::RefPtr<Gtk::ListStore> widthunitsstore_;
+ Gtk::ComboBox * heightunitscombo_;
+ Gtk::ComboBox * boxvertcombo_;
+ Gtk::ComboBox * contentvertcombo_;
+ Gtk::ComboBox * contenthorzcombo_;
+ Gtk::SpinButton * widthspin_;
+ Gtk::SpinButton * heightspin_;
+
+ // Treemodel objects for use in combobox liststores
+ Gtk::TreeModelColumn<Glib::ustring> stringcol_;
+ Gtk::TreeModel::ColumnRecord cols_;
+};
+
+} // namespace frontend
+} // namespace lyx
+
+#endif // GBOX_H
// Store the identifiers for later
origins_ = getSecond(origindata);
PopulateComboBox(origincombo_, getFirst(origindata));
-
- // set the right default unit
- switch (lyxrc.default_papersize) {
- case PAPER_DEFAULT: break;
- case PAPER_USLETTER:
- case PAPER_LEGALPAPER:
- case PAPER_EXECUTIVEPAPER: defaultUnit = "in"; break;
- case PAPER_A3PAPER:
- case PAPER_A4PAPER:
- case PAPER_A5PAPER:
- case PAPER_B5PAPER: defaultUnit = "cm"; break;
- }
}
}
-void GGraphics::updateComboFromLength(Gtk::ComboBox * combo,
- LyXLength const & len)
-{
- string unit = stringFromUnit(len.unit());
- if (unit.empty())
- unit = defaultUnit;
-
- Gtk::TreeModel::iterator it = combo->get_model()->children().begin();
- Gtk::TreeModel::iterator end = combo->get_model()->children().end();
- for (; it != end ; ++it) {
- if ((*it)[stringcol_] == unit) {
- combo->set_active(it);
- return;
- }
- }
- // Fallen through, we didn't find the target length!
- combo->set_active(0);
- lyxerr << "GGraphics::updateComboFromLength: couldn't find "
- "target unit '" << unit << "'\n";
-}
-
-
void GGraphics::apply()
{
// Create the parameters structure and fill the data from the dialog.
void GGraphics::update() {
+ // set the right default unit
+ defaultUnit = getDefaultUnit();
+
// Update dialog with details from inset
InsetGraphicsParams & igp = controller().params();
outputscalespin_->get_adjustment()->set_value(igp.scale);
widthspin_->get_adjustment()->set_value(igp.width.value());
- updateComboFromLength(widthunitscombo_, igp.width);
+ unitsComboFromLength(widthunitscombo_, stringcol_,
+ igp.width, defaultUnit);
heightspin_->get_adjustment()->set_value(igp.height.value());
- updateComboFromLength(heightunitscombo_, igp.height);
+ unitsComboFromLength(heightunitscombo_, stringcol_,
+ igp.height, defaultUnit);
if (!float_equal(igp.scale, 0.0, 0.05)) {
// scaling sizing mode
righttopxspin_->set_text("");
righttopyspin_->set_text("");
}
- updateComboFromLength(bbunitscombo_,LyXLength("bp"));
+ unitsComboFromLength(bbunitscombo_, stringcol_,
+ LyXLength("bp"), defaultUnit);
} else {
// get the values from the inset
lyxerr[Debug::GRAPHICS]
LyXLength anyLength;
anyLength = LyXLength(token(bb_inset, ' ', 0));
- updateComboFromLength(bbunitscombo_, anyLength);
+ unitsComboFromLength(bbunitscombo_, stringcol_, anyLength, defaultUnit);
leftbottomxspin_->get_adjustment()->set_value(anyLength.value());
leftbottomyspin_->set_text(token(bb, ' ', 1));
righttopxspin_->set_text(token(bb, ' ', 2));
righttopyspin_->set_text(token(bb, ' ', 3));
- updateComboFromLength(bbunitscombo_,LyXLength("bp"));
+ unitsComboFromLength(bbunitscombo_, stringcol_,
+ LyXLength("bp"), defaultUnit);
}
controller().bbChanged = false;
} else {
leftbottomyspin_->set_text("");
righttopxspin_->set_text("");
righttopyspin_->set_text("");
- updateComboFromLength(bbunitscombo_,LyXLength("bp"));
+ unitsComboFromLength(bbunitscombo_, stringcol_,
+ LyXLength("bp"), defaultUnit);
}
bc().input(ButtonPolicy::SMI_VALID);
}
void PopulateComboBox(Gtk::ComboBox * combo,
std::vector<std::string> const & strings);
- void updateComboFromLength(Gtk::ComboBox * combo,
- LyXLength const & len);
-
bool updating_;
/// Store the LaTeX names for the rotation origins.
case 5:
return mouse_button::button5;
}
-
+
// This shouldn't happen, according to gdk docs
lyxerr << "gButtonToLyx: unhandled button index\n";
return mouse_button::button1;
GAboutlyx.h \
GBC.C \
GBC.h \
+ GBox.C \
+ GBox.h \
GChanges.C \
GChanges.h \
GCharacter.C \
../xforms/fdesign_base.lo \
../xforms/FormBibitem.lo \
../xforms/FormBibtex.lo \
- ../xforms/FormBox.lo \
../xforms/FormBranch.lo \
../xforms/FormBrowser.lo \
../xforms/FormCitation.lo \
#include "ghelpers.h"
+#include "lyxrc.h"
#include "debug.h"
-#include "lengthcommon.h"
#include "support/filetools.h"
#include "support/path_defines.h"
namespace lyx {
namespace frontend {
+string const getDefaultUnit()
+{
+ switch (lyxrc.default_papersize) {
+ case PAPER_DEFAULT: return "cm";
+ case PAPER_USLETTER:
+ case PAPER_LEGALPAPER:
+ case PAPER_EXECUTIVEPAPER: return "in"; break;
+ case PAPER_A3PAPER:
+ case PAPER_A4PAPER:
+ case PAPER_A5PAPER:
+ case PAPER_B5PAPER: return "cm"; break;
+ }
+}
+
+
+void unitsComboFromLength(Gtk::ComboBox * combo,
+ Gtk::TreeModelColumn<Glib::ustring> const & stringcol,
+ LyXLength const & len,
+ std::string defunit)
+{
+ string unit = stringFromUnit(len.unit());
+ if (unit.empty())
+ unit = defunit;
+
+ Gtk::TreeModel::iterator it = combo->get_model()->children().begin();
+ Gtk::TreeModel::iterator end = combo->get_model()->children().end();
+ for (; it != end ; ++it) {
+ if ((*it)[stringcol] == unit) {
+ combo->set_active(it);
+ return;
+ }
+ }
+
+ // Fallen through, we didn't find the target length!
+ combo->set_active(0);
+ lyxerr << "unitsComboFromLength: couldn't find "
+ "target unit '" << unit << "'\n";
+}
+
+
vector<string> const buildLengthUnitList()
{
vector<string> data(unit_name_gui, unit_name_gui + num_units);
#ifndef GHELPERS_H
#define GHELPERS_H
+#include "lengthcommon.h"
+
+#include <gtkmm.h>
+
#include <string>
#include <vector>
namespace lyx {
namespace frontend {
+std::string const getDefaultUnit();
+
+void unitsComboFromLength(Gtk::ComboBox * combo,
+ Gtk::TreeModelColumn<Glib::ustring> const & stringcol,
+ LyXLength const & len,
+ std::string defunit);
+
std::vector<std::string> const buildLengthUnitList();
/** name is the name of the glade file, without path or extension.
--- /dev/null
+<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
+<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
+
+<glade-interface>
+
+<widget class="GtkDialog" id="dialog">
+ <property name="title" translatable="yes">dialog1</property>
+ <property name="type">GTK_WINDOW_TOPLEVEL</property>
+ <property name="window_position">GTK_WIN_POS_NONE</property>
+ <property name="modal">False</property>
+ <property name="resizable">False</property>
+ <property name="destroy_with_parent">False</property>
+ <property name="decorated">True</property>
+ <property name="skip_taskbar_hint">False</property>
+ <property name="skip_pager_hint">False</property>
+ <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
+ <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
+ <property name="has_separator">False</property>
+
+ <child internal-child="vbox">
+ <widget class="GtkVBox" id="dialog-vbox1">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child internal-child="action_area">
+ <widget class="GtkHButtonBox" id="dialog-action_area1">
+ <property name="visible">True</property>
+ <property name="layout_style">GTK_BUTTONBOX_END</property>
+
+ <child>
+ <widget class="GtkButton" id="Close">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="label">gtk-close</property>
+ <property name="use_stock">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <property name="response_id">-7</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack_type">GTK_PACK_END</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVBox" id="vbox1">
+ <property name="border_width">12</property>
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkLabel" id="label14">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"><b>Box</b></property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkAlignment" id="alignment11">
+ <property name="visible">True</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xscale">1</property>
+ <property name="yscale">1</property>
+ <property name="top_padding">6</property>
+ <property name="bottom_padding">6</property>
+ <property name="left_padding">12</property>
+ <property name="right_padding">0</property>
+
+ <child>
+ <widget class="GtkTable" id="table4">
+ <property name="visible">True</property>
+ <property name="n_rows">2</property>
+ <property name="n_columns">2</property>
+ <property name="homogeneous">False</property>
+ <property name="row_spacing">6</property>
+ <property name="column_spacing">6</property>
+
+ <child>
+ <widget class="GtkLabel" id="label17">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">T_ype:</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="mnemonic_widget">Type</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label18">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Inner Box:</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="mnemonic_widget">InnerBox</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkComboBox" id="InnerBox">
+ <property name="visible">True</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">fill</property>
+ <property name="y_options">fill</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkComboBox" id="Type">
+ <property name="visible">True</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="x_options">fill</property>
+ <property name="y_options">fill</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label13">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"><b>Size</b></property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkAlignment" id="alignment10">
+ <property name="visible">True</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xscale">1</property>
+ <property name="yscale">1</property>
+ <property name="top_padding">6</property>
+ <property name="bottom_padding">6</property>
+ <property name="left_padding">12</property>
+ <property name="right_padding">0</property>
+
+ <child>
+ <widget class="GtkTable" id="table2">
+ <property name="visible">True</property>
+ <property name="n_rows">2</property>
+ <property name="n_columns">3</property>
+ <property name="homogeneous">False</property>
+ <property name="row_spacing">6</property>
+ <property name="column_spacing">6</property>
+
+ <child>
+ <widget class="GtkLabel" id="label15">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Width:</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="mnemonic_widget">Width</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label16">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Height:</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="mnemonic_widget">Height</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkComboBox" id="HeightUnits">
+ <property name="visible">True</property>
+ </widget>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">fill</property>
+ <property name="y_options">fill</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkComboBox" id="WidthUnits">
+ <property name="visible">True</property>
+ </widget>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="x_options">fill</property>
+ <property name="y_options">fill</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkSpinButton" id="Width">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="climb_rate">1</property>
+ <property name="digits">0</property>
+ <property name="numeric">False</property>
+ <property name="update_policy">GTK_UPDATE_ALWAYS</property>
+ <property name="snap_to_ticks">False</property>
+ <property name="wrap">False</property>
+ <property name="adjustment">666 0 10000 1 10 10</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkSpinButton" id="Height">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="climb_rate">1</property>
+ <property name="digits">0</property>
+ <property name="numeric">False</property>
+ <property name="update_policy">GTK_UPDATE_ALWAYS</property>
+ <property name="snap_to_ticks">False</property>
+ <property name="wrap">False</property>
+ <property name="adjustment">666 0 10000 1 10 10</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label2">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"><b>Alignment</b></property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkAlignment" id="alignment2">
+ <property name="visible">True</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xscale">1</property>
+ <property name="yscale">1</property>
+ <property name="top_padding">6</property>
+ <property name="bottom_padding">6</property>
+ <property name="left_padding">12</property>
+ <property name="right_padding">0</property>
+
+ <child>
+ <widget class="GtkTable" id="table1">
+ <property name="visible">True</property>
+ <property name="n_rows">3</property>
+ <property name="n_columns">2</property>
+ <property name="homogeneous">False</property>
+ <property name="row_spacing">6</property>
+ <property name="column_spacing">6</property>
+
+ <child>
+ <widget class="GtkLabel" id="label3">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Box vertical:</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="mnemonic_widget">BoxVertical</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label4">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">C_ontent vertical:</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="mnemonic_widget">ContentVertical</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label5">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Co_ntent horizontal:</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="mnemonic_widget">ContentHorizontal</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkComboBox" id="ContentVertical">
+ <property name="visible">True</property>
+ <property name="items" translatable="yes">Top
+Center
+Bottom
+Fill</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">fill</property>
+ <property name="y_options">fill</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkComboBox" id="BoxVertical">
+ <property name="visible">True</property>
+ <property name="items" translatable="yes">Top
+Center
+Bottom</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="x_options">fill</property>
+ <property name="y_options">fill</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkComboBox" id="ContentHorizontal">
+ <property name="visible">True</property>
+ <property name="items" translatable="yes">Left
+Center
+Right
+Fill</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">fill</property>
+ <property name="y_options">fill</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+</widget>
+
+</glade-interface>