3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
8 * Full author contact details are available in file CREDITS.
13 // Too hard to make concept checks work with this file
14 #ifdef _GLIBCXX_CONCEPT_CHECKS
15 #undef _GLIBCXX_CONCEPT_CHECKS
17 #ifdef _GLIBCPP_CONCEPT_CHECKS
18 #undef _GLIBCPP_CONCEPT_CHECKS
22 #include "ControlVSpace.h"
25 #include <libglademm.h>
33 GVSpace::GVSpace(Dialog & parent)
34 : GViewCB<ControlVSpace, GViewGladeB>(parent, _("VSpace Settings"), false)
38 void GVSpace::doBuild()
40 string const gladeName = findGladeFile("vspace");
41 xml_ = Gnome::Glade::Xml::create(gladeName);
44 xml_->get_widget("Cancel", button);
46 xml_->get_widget("OK", button);
49 xml_->get_widget("Spacing", spacingcombo_);
50 xml_->get_widget_derived("Size", sizelengthentry_);
51 sizelengthentry_->set_relative(false);
53 xml_->get_widget("Protect", protectcheck_);
55 spacingcombo_->signal_changed().connect(
56 sigc::mem_fun(*this, &GVSpace::onSpacingComboChanged));
60 void GVSpace::update()
62 VSpace const space = controller().params();
65 switch (space.kind()) {
69 case VSpace::SMALLSKIP:
86 spacingcombo_->set_active(pos);
88 protectcheck_->set_active(space.keep());
90 bool const custom_vspace = space.kind() == VSpace::LENGTH;
92 sizelengthentry_->set_length(space.length().len());
94 sizelengthentry_->set_length("");
102 switch (spacingcombo_->get_active_row_number()) {
104 space = VSpace(VSpace::DEFSKIP);
107 space = VSpace(VSpace::SMALLSKIP);
110 space = VSpace(VSpace::MEDSKIP);
113 space = VSpace(VSpace::BIGSKIP);
116 space = VSpace(VSpace::VFILL);
119 space = VSpace(LyXGlueLength(sizelengthentry_->get_length()));
123 space.setKeep(protectcheck_->get_active());
125 controller().params() = space;
129 void GVSpace::onSpacingComboChanged()
131 bool const custom = spacingcombo_->get_active_row_number() == 5;
132 sizelengthentry_->set_sensitive(custom);
135 } // namespace frontend