mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 13:18:28 +00:00
The VSpace fixes (removal of VSPACE::NONE) from Michael and myself
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8168 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
302f32d7fa
commit
b06de5044f
@ -1,3 +1,6 @@
|
||||
2003-12-01 Michael Schmitt <michael.schmitt@teststep.org>
|
||||
|
||||
* vspace.[Ch]: remove VSpace::NONE
|
||||
|
||||
2003-12-01 André Pönitz <poenitz@gmx.net>
|
||||
|
||||
|
@ -1,3 +1,6 @@
|
||||
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>
|
||||
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include <config.h>
|
||||
|
||||
#include "ControlVSpace.h"
|
||||
#include "ButtonController.h"
|
||||
|
||||
#include "funcrequest.h"
|
||||
#include "insets/insetvspace.h"
|
||||
@ -29,6 +30,10 @@ ControlVSpace::ControlVSpace(Dialog & parent)
|
||||
bool ControlVSpace::initialiseParams(string const & data)
|
||||
{
|
||||
InsetVSpaceMailer::string2params(data, params_);
|
||||
|
||||
// so that the user can press Ok
|
||||
dialog().bc().valid();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1,3 +1,8 @@
|
||||
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
|
||||
|
@ -50,26 +50,23 @@ void setWidgetsFromVSpace(VSpace const & space,
|
||||
{
|
||||
int item = 0;
|
||||
switch (space.kind()) {
|
||||
case VSpace::NONE:
|
||||
case VSpace::DEFSKIP:
|
||||
item = 0;
|
||||
break;
|
||||
case VSpace::DEFSKIP:
|
||||
case VSpace::SMALLSKIP:
|
||||
item = 1;
|
||||
break;
|
||||
case VSpace::SMALLSKIP:
|
||||
case VSpace::MEDSKIP:
|
||||
item = 2;
|
||||
break;
|
||||
case VSpace::MEDSKIP:
|
||||
case VSpace::BIGSKIP:
|
||||
item = 3;
|
||||
break;
|
||||
case VSpace::BIGSKIP:
|
||||
case VSpace::VFILL:
|
||||
item = 4;
|
||||
break;
|
||||
case VSpace::VFILL:
|
||||
item = 5;
|
||||
break;
|
||||
case VSpace::LENGTH:
|
||||
item = 6;
|
||||
item = 5;
|
||||
break;
|
||||
}
|
||||
spacing->setCurrentItem(item);
|
||||
@ -96,28 +93,25 @@ VSpace setVSpaceFromWidgets(int spacing,
|
||||
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;
|
||||
@ -146,7 +140,6 @@ void QVSpace::build_dialog()
|
||||
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);
|
||||
@ -163,10 +156,10 @@ void QVSpace::apply()
|
||||
{
|
||||
// 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(),
|
||||
|
@ -52,7 +52,7 @@ void QVSpaceDialog::change_adaptor()
|
||||
|
||||
void QVSpaceDialog::enableCustom(int)
|
||||
{
|
||||
bool const enable = spacingCO->currentItem()==6;
|
||||
bool const enable = spacingCO->currentItem()==5;
|
||||
valueLE->setEnabled(enable);
|
||||
unitCO->setEnabled(enable);
|
||||
}
|
||||
|
@ -13,7 +13,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>335</width>
|
||||
<width>233</width>
|
||||
<height>140</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -95,7 +95,7 @@
|
||||
</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" >
|
||||
@ -115,12 +115,6 @@
|
||||
</widget>
|
||||
<widget row="0" column="1" >
|
||||
<class>QComboBox</class>
|
||||
<item>
|
||||
<property>
|
||||
<name>text</name>
|
||||
<string>None</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property>
|
||||
<name>text</name>
|
||||
@ -166,14 +160,21 @@
|
||||
<string>Supported spacing types</string>
|
||||
</property>
|
||||
</widget>
|
||||
<spacer row="0" column="2" rowspan="1" colspan="2" >
|
||||
<widget row="1" column="2" >
|
||||
<class>LengthCombo</class>
|
||||
<property stdset="1">
|
||||
<name>name</name>
|
||||
<cstring>unitCO</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
<spacer row="3" column="1" >
|
||||
<property>
|
||||
<name>name</name>
|
||||
<cstring>Spacer8</cstring>
|
||||
<cstring>Spacer28</cstring>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>orientation</name>
|
||||
<enum>Horizontal</enum>
|
||||
<enum>Vertical</enum>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>sizeType</name>
|
||||
@ -187,28 +188,7 @@
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
<spacer row="2" column="2" rowspan="1" colspan="2" >
|
||||
<property>
|
||||
<name>name</name>
|
||||
<cstring>Spacer9</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 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>
|
||||
@ -223,42 +203,6 @@
|
||||
<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">
|
||||
@ -310,14 +254,14 @@
|
||||
</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>
|
||||
@ -331,17 +275,10 @@
|
||||
</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>
|
||||
@ -419,7 +356,6 @@
|
||||
<slot access="protected">enableCustom(int)</slot>
|
||||
</connections>
|
||||
<tabstops>
|
||||
<tabstop>restorePB</tabstop>
|
||||
<tabstop>okPB</tabstop>
|
||||
<tabstop>applyPB</tabstop>
|
||||
<tabstop>closePB</tabstop>
|
||||
|
@ -1,3 +1,7 @@
|
||||
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
|
||||
|
@ -54,14 +54,14 @@ void validateVSpaceWidgets(FL_OBJECT * choice_type, FL_OBJECT * input_length)
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@ -75,28 +75,25 @@ VSpace const setVSpaceFromWidgets(FL_OBJECT * choice_type,
|
||||
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;
|
||||
@ -121,26 +118,23 @@ void setWidgetsFromVSpace(VSpace const & space,
|
||||
|
||||
int pos = 1;
|
||||
switch (space.kind()) {
|
||||
case VSpace::NONE:
|
||||
case VSpace::DEFSKIP:
|
||||
pos = 1;
|
||||
break;
|
||||
case VSpace::DEFSKIP:
|
||||
case VSpace::SMALLSKIP:
|
||||
pos = 2;
|
||||
break;
|
||||
case VSpace::SMALLSKIP:
|
||||
case VSpace::MEDSKIP:
|
||||
pos = 3;
|
||||
break;
|
||||
case VSpace::MEDSKIP:
|
||||
case VSpace::BIGSKIP:
|
||||
pos = 4;
|
||||
break;
|
||||
case VSpace::BIGSKIP:
|
||||
case VSpace::VFILL:
|
||||
pos = 5;
|
||||
break;
|
||||
case VSpace::VFILL:
|
||||
pos = 6;
|
||||
break;
|
||||
case VSpace::LENGTH:
|
||||
pos = 7;
|
||||
pos = 6;
|
||||
break;
|
||||
}
|
||||
fl_set_choice(choice_type, pos);
|
||||
@ -195,7 +189,7 @@ void FormVSpace::build()
|
||||
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.
|
||||
@ -237,7 +231,7 @@ void FormVSpace::apply()
|
||||
|
||||
// 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 =
|
||||
@ -259,7 +253,7 @@ void FormVSpace::update()
|
||||
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);
|
||||
}
|
||||
@ -271,7 +265,7 @@ ButtonPolicy::SMInput FormVSpace::input(FL_OBJECT * ob, long)
|
||||
// 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);
|
||||
}
|
||||
|
@ -1,3 +1,6 @@
|
||||
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>
|
||||
|
||||
|
@ -35,6 +35,12 @@ using std::string;
|
||||
using std::max;
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
int const ADD_TO_VSPACE_WIDTH = 5;
|
||||
|
||||
} // namespace anon
|
||||
|
||||
|
||||
InsetVSpace::InsetVSpace(VSpace const & space)
|
||||
: space_(space)
|
||||
@ -92,23 +98,21 @@ void InsetVSpace::write(Buffer const &, ostream & os) const
|
||||
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);
|
||||
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));
|
||||
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);
|
||||
}
|
||||
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;
|
||||
}
|
||||
@ -121,8 +125,7 @@ void InsetVSpace::draw(PainterInfo & pi, int x, int y) const
|
||||
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;
|
||||
@ -150,7 +153,7 @@ void InsetVSpace::draw(PainterInfo & pi, int x, int y) const
|
||||
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
|
||||
|
13
src/vspace.C
13
src/vspace.C
@ -337,7 +337,7 @@ bool isValidLength(string const & data, LyXLength * result)
|
||||
//
|
||||
|
||||
VSpace::VSpace()
|
||||
: kind_(NONE), len_(), keep_(false)
|
||||
: kind_(DEFSKIP), len_(), keep_(false)
|
||||
{}
|
||||
|
||||
|
||||
@ -357,7 +357,7 @@ VSpace::VSpace(LyXGlueLength const & l)
|
||||
|
||||
|
||||
VSpace::VSpace(string const & data)
|
||||
: kind_(NONE), len_(), keep_(false)
|
||||
: kind_(DEFSKIP), len_(), keep_(false)
|
||||
{
|
||||
if (data.empty())
|
||||
return;
|
||||
@ -436,7 +436,6 @@ string const VSpace::asLyXCommand() const
|
||||
{
|
||||
string result;
|
||||
switch (kind_) {
|
||||
case NONE: break;
|
||||
case DEFSKIP: result = "defskip"; break;
|
||||
case SMALLSKIP: result = "smallskip"; break;
|
||||
case MEDSKIP: result = "medskip"; break;
|
||||
@ -444,7 +443,7 @@ string const VSpace::asLyXCommand() const
|
||||
case VFILL: result = "vfill"; break;
|
||||
case LENGTH: result = len_.asString(); break;
|
||||
}
|
||||
if (keep_ && kind_ != NONE && kind_ != DEFSKIP)
|
||||
if (keep_)
|
||||
result += '*';
|
||||
return result;
|
||||
}
|
||||
@ -472,9 +471,6 @@ string const VSpace::asLatexCommand(BufferParams const & params) const
|
||||
return keep_ ? "\\vspace*{" + len_.asLatexString() + '}'
|
||||
: "\\vspace{" + len_.asLatexString() + '}';
|
||||
|
||||
case NONE:
|
||||
return string();
|
||||
|
||||
default:
|
||||
BOOST_ASSERT(false);
|
||||
return string();
|
||||
@ -511,9 +507,6 @@ int VSpace::inPixels(BufferView const & bv) const
|
||||
case LENGTH:
|
||||
return len_.len().inPixels(bv.workWidth());
|
||||
|
||||
case NONE:
|
||||
return 0;
|
||||
|
||||
default:
|
||||
BOOST_ASSERT(false);
|
||||
return 0;
|
||||
|
@ -24,7 +24,6 @@ class VSpace {
|
||||
public:
|
||||
/// The different kinds of spaces.
|
||||
enum vspace_kind {
|
||||
NONE, ///< no added vertical space
|
||||
DEFSKIP,
|
||||
SMALLSKIP,
|
||||
MEDSKIP,
|
||||
|
Loading…
Reference in New Issue
Block a user