+2003-12-01 Michael Schmitt <michael.schmitt@teststep.org>
+
+ * vspace.[Ch]: remove VSpace::NONE
2003-12-01 André Pönitz <poenitz@gmx.net>
+2003-12-01 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
+
+ * ControlVSpace.C: enable the buttons for new insets.
2003-11-28 André Pönitz <poenitz@gmx.net>
#include <config.h>
#include "ControlVSpace.h"
+#include "ButtonController.h"
#include "funcrequest.h"
#include "insets/insetvspace.h"
bool ControlVSpace::initialiseParams(string const & data)
{
InsetVSpaceMailer::string2params(data, params_);
+
+ // so that the user can press Ok
+ dialog().bc().valid();
+
return true;
}
+2003-12-01 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
+
+ * QVSpace.C: remove VSPACE::NONE, remove restore button.
+ * ui/QVSpaceDialogBase.ui: remove restore button, fix tooltip.
+
2003-12-01 Juergen Spitzmueller <j.spitzmueller@gmx.de>
* QDocumentDialog.[Ch]: (branches) don't insert a coloritem
{
int item = 0;
switch (space.kind()) {
- case VSpace::NONE:
- item = 0;
- break;
case VSpace::DEFSKIP:
- item = 1;
+ item = 0;
break;
case VSpace::SMALLSKIP:
- item = 2;
+ item = 1;
break;
case VSpace::MEDSKIP:
- item = 3;
+ item = 2;
break;
case VSpace::BIGSKIP:
- item = 4;
+ item = 3;
break;
case VSpace::VFILL:
- item = 5;
+ item = 4;
break;
case VSpace::LENGTH:
- item = 6;
+ item = 5;
break;
}
spacing->setCurrentItem(item);
LengthCombo * unit,
bool keep)
{
- VSpace space = VSpace(VSpace::NONE);
+ VSpace space = VSpace(VSpace::DEFSKIP);
switch (spacing) {
case 0:
- space = VSpace(VSpace::NONE);
- break;
- case 1:
space = VSpace(VSpace::DEFSKIP);
break;
- case 2:
+ case 1:
space = VSpace(VSpace::SMALLSKIP);
break;
- case 3:
+ case 2:
space = VSpace(VSpace::MEDSKIP);
break;
- case 4:
+ case 3:
space = VSpace(VSpace::BIGSKIP);
break;
- case 5:
+ case 4:
space = VSpace(VSpace::VFILL);
break;
- case 6:
+ case 5:
space = VSpace(LyXGlueLength(
widgetsToLength(value, unit)));
break;
bcview().setOK(dialog_->okPB);
bcview().setApply(dialog_->applyPB);
bcview().setCancel(dialog_->closePB);
- bcview().setRestore(dialog_->restorePB);
// disable for read-only documents
bcview().addReadOnly(dialog_->spacingCO);
{
// spacing
// If a vspace choice is "Length" but there's no text in
- // the input field, reset the choice to "None".
+ // the input field, do not insert a vspace at all.
if (dialog_->spacingCO->currentItem() == 6
&& dialog_->valueLE->text().isEmpty())
- dialog_->spacingCO->setCurrentItem(0);
+ return;
VSpace const space =
setVSpaceFromWidgets(dialog_->spacingCO->currentItem(),
void QVSpaceDialog::enableCustom(int)
{
- bool const enable = spacingCO->currentItem()==6;
+ bool const enable = spacingCO->currentItem()==5;
valueLE->setEnabled(enable);
unitCO->setEnabled(enable);
}
<rect>
<x>0</x>
<y>0</y>
- <width>335</width>
+ <width>233</width>
<height>140</height>
</rect>
</property>
</property>
<property>
<name>toolTip</name>
- <string>Do not reset the spacing on page break</string>
+ <string>Insert the spacing even after a page break</string>
</property>
</widget>
<widget row="1" column="1" >
</widget>
<widget row="0" column="1" >
<class>QComboBox</class>
- <item>
- <property>
- <name>text</name>
- <string>None</string>
- </property>
- </item>
<item>
<property>
<name>text</name>
<string>Supported spacing types</string>
</property>
</widget>
- <spacer row="0" column="2" rowspan="1" colspan="2" >
- <property>
- <name>name</name>
- <cstring>Spacer8</cstring>
- </property>
- <property stdset="1">
- <name>orientation</name>
- <enum>Horizontal</enum>
- </property>
+ <widget row="1" column="2" >
+ <class>LengthCombo</class>
<property stdset="1">
- <name>sizeType</name>
- <enum>Expanding</enum>
- </property>
- <property>
- <name>sizeHint</name>
- <size>
- <width>20</width>
- <height>20</height>
- </size>
+ <name>name</name>
+ <cstring>unitCO</cstring>
</property>
- </spacer>
- <spacer row="2" column="2" rowspan="1" colspan="2" >
+ </widget>
+ <spacer row="3" column="1" >
<property>
<name>name</name>
- <cstring>Spacer9</cstring>
+ <cstring>Spacer28</cstring>
</property>
<property stdset="1">
<name>orientation</name>
- <enum>Horizontal</enum>
+ <enum>Vertical</enum>
</property>
<property stdset="1">
<name>sizeType</name>
</size>
</property>
</spacer>
- <widget row="4" column="0" rowspan="1" colspan="4" >
+ <widget row="4" column="0" rowspan="1" colspan="3" >
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
<name>spacing</name>
<number>6</number>
</property>
- <widget>
- <class>QPushButton</class>
- <property stdset="1">
- <name>name</name>
- <cstring>restorePB</cstring>
- </property>
- <property stdset="1">
- <name>text</name>
- <string>&Restore</string>
- </property>
- <property stdset="1">
- <name>autoDefault</name>
- <bool>false</bool>
- </property>
- </widget>
- <spacer>
- <property>
- <name>name</name>
- <cstring>Spacer1</cstring>
- </property>
- <property stdset="1">
- <name>orientation</name>
- <enum>Horizontal</enum>
- </property>
- <property stdset="1">
- <name>sizeType</name>
- <enum>Expanding</enum>
- </property>
- <property>
- <name>sizeHint</name>
- <size>
- <width>20</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
<widget>
<class>QPushButton</class>
<property stdset="1">
</widget>
</hbox>
</widget>
- <spacer row="3" column="1" >
+ <spacer row="0" column="2" >
<property>
<name>name</name>
- <cstring>Spacer28</cstring>
+ <cstring>Spacer8</cstring>
</property>
<property stdset="1">
<name>orientation</name>
- <enum>Vertical</enum>
+ <enum>Horizontal</enum>
</property>
<property stdset="1">
<name>sizeType</name>
</size>
</property>
</spacer>
- <widget row="1" column="2" >
- <class>LengthCombo</class>
- <property stdset="1">
- <name>name</name>
- <cstring>unitCO</cstring>
- </property>
- </widget>
- <spacer row="1" column="3" >
+ <spacer row="2" column="2" >
<property>
<name>name</name>
- <cstring>Spacer5</cstring>
+ <cstring>Spacer9</cstring>
</property>
<property stdset="1">
<name>orientation</name>
<slot access="protected">enableCustom(int)</slot>
</connections>
<tabstops>
- <tabstop>restorePB</tabstop>
<tabstop>okPB</tabstop>
<tabstop>applyPB</tabstop>
<tabstop>closePB</tabstop>
+2003-12-01 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
+
+ * FormVSpace.C: remove VSPACE::NONE.
+
2003-11-29 Angus Leeming <leeming@lyx.org>
* Makefile.am (stamp-forms, stamp-xpm): don't use "if test return
BOOST_ASSERT(choice_type && choice_type->objclass == FL_CHOICE &&
input_length && input_length->objclass == FL_INPUT);
- if (fl_get_choice(choice_type) != 7)
+ if (fl_get_choice(choice_type) != 6)
return;
// If a vspace kind is "Length" but there's no text in
- // the input field, reset the kind to "None".
+ // the input field, insert nothing.
string const input = rtrim(getString(input_length));
if (input.empty())
- fl_set_choice(choice_type, 1);
+ return;
}
input_length && input_length->objclass == FL_INPUT &&
choice_length && choice_length->objclass == FL_CHOICE);
- VSpace space = VSpace(VSpace::NONE);
+ VSpace space = VSpace(VSpace::DEFSKIP);
switch (fl_get_choice(choice_type)) {
case 1:
- space = VSpace(VSpace::NONE);
- break;
- case 2:
space = VSpace(VSpace::DEFSKIP);
break;
- case 3:
+ case 2:
space = VSpace(VSpace::SMALLSKIP);
break;
- case 4:
+ case 3:
space = VSpace(VSpace::MEDSKIP);
break;
- case 5:
+ case 4:
space = VSpace(VSpace::BIGSKIP);
break;
- case 6:
+ case 5:
space = VSpace(VSpace::VFILL);
break;
- case 7:
+ case 6:
space = VSpace(LyXGlueLength(
getLengthFromWidgets(input_length, choice_length)));
break;
int pos = 1;
switch (space.kind()) {
- case VSpace::NONE:
- pos = 1;
- break;
case VSpace::DEFSKIP:
- pos = 2;
+ pos = 1;
break;
case VSpace::SMALLSKIP:
- pos = 3;
+ pos = 2;
break;
case VSpace::MEDSKIP:
- pos = 4;
+ pos = 3;
break;
case VSpace::BIGSKIP:
- pos = 5;
+ pos = 4;
break;
case VSpace::VFILL:
- pos = 6;
+ pos = 5;
break;
case VSpace::LENGTH:
- pos = 7;
+ pos = 6;
break;
}
fl_set_choice(choice_type, pos);
fl_set_input_return(dialog_->input_space, FL_RETURN_CHANGED);
string const spacing =
- _("None|DefSkip|SmallSkip|MedSkip|BigSkip|VFill|Length");
+ _("DefSkip|SmallSkip|MedSkip|BigSkip|VFill|Length");
fl_addto_choice(dialog_->choice_space, spacing.c_str());
// Create the contents of the unit choices; don't include the "%" terms.
// spacing
// If a vspace choice is "Length" but there's no text in
- // the input field, reset the choice to "None".
+ // the input field, insert nothing.
validateVSpaceWidgets(dialog_->choice_space, dialog_->input_space);
VSpace const space =
dialog_->check_keep);
bool const custom_length =
- fl_get_choice(dialog_->choice_space) == 7;
+ fl_get_choice(dialog_->choice_space) == 6;
setEnabled(dialog_->input_space, custom_length);
setEnabled(dialog_->choice_unit_space, custom_length);
}
// disable 'keep' when no space is choosen
if (ob == dialog_->choice_space) {
bool const custom_length =
- fl_get_choice(dialog_->choice_space) == 7;
+ fl_get_choice(dialog_->choice_space) == 6;
setEnabled(dialog_->input_space, custom_length);
setEnabled(dialog_->choice_unit_space, custom_length);
}
+2003-12-01 Michael Schmitt <michael.schmitt@teststep.org>
+
+ * insetvspace.C: remove VSpace::NONE; increase inset width
2003-12-01 André Pönitz <poenitz@gmx.net>
using std::max;
+namespace {
+
+int const ADD_TO_VSPACE_WIDTH = 5;
+
+} // namespace anon
+
InsetVSpace::InsetVSpace(VSpace const & space)
: space_(space)
void InsetVSpace::metrics(MetricsInfo & mi, Dimension & dim) const
{
int size = 10;
- if (space_.kind() != VSpace::NONE) {
- int const arrow_size = 4;
- int const space_size = space_.inPixels(*mi.base.bv);
-
- LyXFont font;
- font.decSize();
- int const min_size = max(3 * arrow_size, font_metrics::maxHeight(font));
-
- if (space_.length().len().value() < 0.0)
- size = min_size;
- else
- size = max(min_size, space_size);
- }
+ int const arrow_size = 4;
+ int const space_size = space_.inPixels(*mi.base.bv);
+
+ LyXFont font;
+ font.decSize();
+ int const min_size = max(3 * arrow_size, font_metrics::maxHeight(font));
+
+ if (space_.length().len().value() < 0.0)
+ size = min_size;
+ else
+ size = max(min_size, space_size);
dim.asc = size / 2;
dim.des = size / 2;
- dim.wid = 10;
+ dim.wid = 10 + 2 * ADD_TO_VSPACE_WIDTH;
dim_ = dim;
}
xo_ = x;
yo_ = y;
- //if (space_.kind() == VSpace::NONE)
- // return 0;
+ x += ADD_TO_VSPACE_WIDTH;
int const arrow_size = 4;
int const start = y - dim_.asc;
by2 = added ? end : (end - arrow_size);
}
- int const midx = xo_ + arrow_size;
+ int const midx = x + arrow_size;
int const rightx = midx + arrow_size;
// first the string
//
VSpace::VSpace()
- : kind_(NONE), len_(), keep_(false)
+ : kind_(DEFSKIP), len_(), keep_(false)
{}
VSpace::VSpace(string const & data)
- : kind_(NONE), len_(), keep_(false)
+ : kind_(DEFSKIP), len_(), keep_(false)
{
if (data.empty())
return;
{
string result;
switch (kind_) {
- case NONE: break;
case DEFSKIP: result = "defskip"; break;
case SMALLSKIP: result = "smallskip"; break;
case MEDSKIP: result = "medskip"; break;
case VFILL: result = "vfill"; break;
case LENGTH: result = len_.asString(); break;
}
- if (keep_ && kind_ != NONE && kind_ != DEFSKIP)
+ if (keep_)
result += '*';
return result;
}
return keep_ ? "\\vspace*{" + len_.asLatexString() + '}'
: "\\vspace{" + len_.asLatexString() + '}';
- case NONE:
- return string();
-
default:
BOOST_ASSERT(false);
return string();
case LENGTH:
return len_.len().inPixels(bv.workWidth());
- case NONE:
- return 0;
-
default:
BOOST_ASSERT(false);
return 0;
public:
/// The different kinds of spaces.
enum vspace_kind {
- NONE, ///< no added vertical space
DEFSKIP,
SMALLSKIP,
MEDSKIP,