mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-07 12:32:26 +00:00
Migrate GuiHSPace to InsetParamsDialog.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33525 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
37974532f6
commit
5d235f5251
@ -21,6 +21,8 @@
|
||||
|
||||
#include "insets/InsetSpace.h"
|
||||
|
||||
#include "mathed/InsetMathSpace.h"
|
||||
|
||||
#include "support/gettext.h"
|
||||
#include "support/lstrings.h"
|
||||
|
||||
@ -34,133 +36,89 @@ using namespace std;
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
GuiHSpace::GuiHSpace(GuiView & lv, bool math)
|
||||
: GuiDialog(lv, math ? "mathspace" : "space", qt_("Horizontal Space Settings"))
|
||||
GuiHSpace::GuiHSpace(bool math_mode, QWidget * parent)
|
||||
: InsetParamsWidget(parent), math_mode_(math_mode)
|
||||
{
|
||||
params_.math = math;
|
||||
setupUi(this);
|
||||
|
||||
connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK()));
|
||||
connect(applyPB, SIGNAL(clicked()), this, SLOT(slotApply()));
|
||||
connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
|
||||
spacingCO->clear();
|
||||
if (math_mode_) {
|
||||
spacingCO->addItem(qt_("Thin space"));
|
||||
spacingCO->addItem(qt_("Medium space"));
|
||||
spacingCO->addItem(qt_("Thick space"));
|
||||
spacingCO->addItem(qt_("Negative thin space"));
|
||||
spacingCO->addItem(qt_("Negative medium space"));
|
||||
spacingCO->addItem(qt_("Negative thick space"));
|
||||
spacingCO->addItem(qt_("Half Quad (0.5 em)"));
|
||||
spacingCO->addItem(qt_("Quad (1 em)"));
|
||||
spacingCO->addItem(qt_("Double Quad (2 em)"));
|
||||
spacingCO->addItem(qt_("Custom"));
|
||||
} else {
|
||||
spacingCO->addItem(qt_("Inter-word space"));
|
||||
spacingCO->addItem(qt_("Thin space"));
|
||||
spacingCO->addItem(qt_("Negative thin space"));
|
||||
spacingCO->addItem(qt_("Half Quad (0.5 em)"));
|
||||
spacingCO->addItem(qt_("Quad (1 em)"));
|
||||
spacingCO->addItem(qt_("Double Quad (2 em)"));
|
||||
spacingCO->addItem(qt_("Horizontal Fill"));
|
||||
spacingCO->addItem(qt_("Custom"));
|
||||
}
|
||||
|
||||
connect(spacingCO, SIGNAL(highlighted(QString)),
|
||||
this, SLOT(change_adaptor()));
|
||||
this, SLOT(changedSlot()));
|
||||
connect(valueLE, SIGNAL(textChanged(QString)),
|
||||
this, SLOT(change_adaptor()));
|
||||
this, SLOT(changedSlot()));
|
||||
connect(spacingCO, SIGNAL(activated(int)),
|
||||
this, SLOT(enableWidgets(int)));
|
||||
this, SLOT(changedSlot()));
|
||||
connect(keepCB, SIGNAL(clicked()),
|
||||
this, SLOT(change_adaptor()));
|
||||
this, SLOT(changedSlot()));
|
||||
connect(unitCO, SIGNAL(selectionChanged(lyx::Length::UNIT)),
|
||||
this, SLOT(change_adaptor()));
|
||||
this, SLOT(changedSlot()));
|
||||
connect(fillPatternCO, SIGNAL(activated(int)),
|
||||
this, SLOT(patternChanged()));
|
||||
this, SLOT(changedSlot()));
|
||||
|
||||
if (params_.math)
|
||||
if (math_mode_)
|
||||
valueLE->setValidator(unsignedLengthValidator(valueLE));
|
||||
else
|
||||
valueLE->setValidator(unsignedGlueLengthValidator(valueLE));
|
||||
|
||||
// Manage the ok, apply, restore and cancel/close buttons
|
||||
bc().setPolicy(ButtonPolicy::OkApplyCancelReadOnlyPolicy);
|
||||
bc().setOK(okPB);
|
||||
bc().setApply(applyPB);
|
||||
bc().setCancel(closePB);
|
||||
|
||||
// disable for read-only documents
|
||||
bc().addReadOnly(spacingCO);
|
||||
bc().addReadOnly(valueLE);
|
||||
bc().addReadOnly(unitCO);
|
||||
bc().addReadOnly(keepCB);
|
||||
bc().addReadOnly(fillPatternCO);
|
||||
|
||||
// initialize the length validator
|
||||
bc().addCheckedLineEdit(valueLE, valueL);
|
||||
addCheckedWidget(valueLE, valueL);
|
||||
}
|
||||
|
||||
|
||||
void GuiHSpace::change_adaptor()
|
||||
void GuiHSpace::changedSlot()
|
||||
{
|
||||
enableWidgets();
|
||||
changed();
|
||||
}
|
||||
|
||||
|
||||
void GuiHSpace::setMath(bool custom)
|
||||
void GuiHSpace::enableWidgets()
|
||||
{
|
||||
int const selection = spacingCO->currentIndex();
|
||||
bool const custom = (selection == spacingCO->count() - 1);
|
||||
valueLE->setEnabled(custom);
|
||||
unitCO->setEnabled(custom);
|
||||
fillPatternCO->setEnabled(false);
|
||||
keepCB->setToolTip(qt_("Insert the spacing even after a line break"));
|
||||
keepCB->setEnabled(false);
|
||||
}
|
||||
|
||||
|
||||
void GuiHSpace::enableWidgets(int selection)
|
||||
{
|
||||
if (params_.math) {
|
||||
setMath(selection == 9);
|
||||
changed();
|
||||
if (math_mode_) {
|
||||
fillPatternCO->setEnabled(false);
|
||||
keepCB->setEnabled(false);
|
||||
return;
|
||||
}
|
||||
valueLE->setEnabled(selection == 7);
|
||||
unitCO->setEnabled(selection == 7);
|
||||
fillPatternCO->setEnabled(selection == 6);
|
||||
int pattern = fillPatternCO->currentIndex();
|
||||
bool const no_pattern = fillPatternCO->currentIndex() == 0;
|
||||
bool const enable_keep =
|
||||
selection == 0 || selection == 3 ||
|
||||
(selection == 6 && pattern == 0) || selection == 7;
|
||||
(selection == 6 && no_pattern) || custom;
|
||||
keepCB->setEnabled(enable_keep);
|
||||
if (selection == 3)
|
||||
keepCB->setToolTip(qt_("Insert the spacing even after a line break.\n"
|
||||
"Note that a protected Half Quad will be turned into\n"
|
||||
"a vertical space if used at the beginning of a paragraph!"));
|
||||
else
|
||||
keepCB->setToolTip(qt_("Insert the spacing even after a line break"));
|
||||
changed();
|
||||
}
|
||||
|
||||
|
||||
void GuiHSpace::patternChanged()
|
||||
void GuiHSpace::paramsToDialog(Inset const * inset)
|
||||
{
|
||||
enableWidgets(spacingCO->currentIndex());
|
||||
changed();
|
||||
}
|
||||
|
||||
|
||||
static void setWidgetsFromHSpace(InsetSpaceParams const & params,
|
||||
QComboBox * spacing,
|
||||
QLineEdit * value,
|
||||
LengthCombo * unit,
|
||||
QCheckBox * keep,
|
||||
QComboBox * fillPattern)
|
||||
{
|
||||
spacing->clear();
|
||||
if (params.math) {
|
||||
spacing->addItem(qt_("Thin space"));
|
||||
spacing->addItem(qt_("Medium space"));
|
||||
spacing->addItem(qt_("Thick space"));
|
||||
spacing->addItem(qt_("Negative thin space"));
|
||||
spacing->addItem(qt_("Negative medium space"));
|
||||
spacing->addItem(qt_("Negative thick space"));
|
||||
spacing->addItem(qt_("Half Quad (0.5 em)"));
|
||||
spacing->addItem(qt_("Quad (1 em)"));
|
||||
spacing->addItem(qt_("Double Quad (2 em)"));
|
||||
spacing->addItem(qt_("Custom"));
|
||||
keep->setEnabled(false);
|
||||
fillPattern->setEnabled(false);
|
||||
} else {
|
||||
spacing->addItem(qt_("Inter-word space"));
|
||||
spacing->addItem(qt_("Thin space"));
|
||||
spacing->addItem(qt_("Negative thin space"));
|
||||
spacing->addItem(qt_("Half Quad (0.5 em)"));
|
||||
spacing->addItem(qt_("Quad (1 em)"));
|
||||
spacing->addItem(qt_("Double Quad (2 em)"));
|
||||
spacing->addItem(qt_("Horizontal Fill"));
|
||||
spacing->addItem(qt_("Custom"));
|
||||
keep->setEnabled(true);
|
||||
fillPattern->setEnabled(true);
|
||||
}
|
||||
InsetSpaceParams const params = math_mode_
|
||||
? static_cast<InsetMathSpace const *>(inset)->params()
|
||||
: static_cast<InsetSpace const *>(inset)->params();
|
||||
|
||||
int item = 0;
|
||||
int pattern = 0;
|
||||
@ -243,45 +201,61 @@ static void setWidgetsFromHSpace(InsetSpaceParams const & params,
|
||||
protect = !params.math;
|
||||
break;
|
||||
}
|
||||
spacing->setCurrentIndex(item);
|
||||
fillPattern->setCurrentIndex(pattern);
|
||||
keep->setChecked(protect);
|
||||
|
||||
spacingCO->setCurrentIndex(item);
|
||||
fillPatternCO->setCurrentIndex(pattern);
|
||||
keepCB->setChecked(protect);
|
||||
if (math_mode_) {
|
||||
keepCB->setToolTip(qt_("Insert the spacing even after a line break"));
|
||||
} else if (item == 3) {
|
||||
keepCB->setToolTip(qt_("Insert the spacing even after a line break.\n"
|
||||
"Note that a protected Half Quad will be turned into\n"
|
||||
"a vertical space if used at the beginning of a paragraph!"));
|
||||
} else {
|
||||
keepCB->setToolTip(qt_("Insert the spacing even after a line break"));
|
||||
}
|
||||
Length::UNIT const default_unit = Length::defaultUnit();
|
||||
if (item == (params.math ? 9 : 7)) {
|
||||
string length = params.length.asString();
|
||||
lengthToWidgets(value, unit, length, default_unit);
|
||||
lengthToWidgets(valueLE, unitCO, length, default_unit);
|
||||
} else
|
||||
lengthToWidgets(value, unit, "", default_unit);
|
||||
lengthToWidgets(valueLE, unitCO, "", default_unit);
|
||||
|
||||
enableWidgets();
|
||||
}
|
||||
|
||||
|
||||
static InsetSpaceParams setHSpaceFromWidgets(int spacing,
|
||||
QLineEdit * value, LengthCombo * unit, bool keep, int fill, bool math)
|
||||
docstring GuiHSpace::dialogToMathParams() const
|
||||
{
|
||||
InsetSpaceParams params(math);
|
||||
if (math) {
|
||||
switch (spacing) {
|
||||
case 0: params.kind = InsetSpaceParams::THIN; break;
|
||||
case 1: params.kind = InsetSpaceParams::MEDIUM; break;
|
||||
case 2: params.kind = InsetSpaceParams::THICK; break;
|
||||
case 3: params.kind = InsetSpaceParams::NEGTHIN; break;
|
||||
case 4: params.kind = InsetSpaceParams::NEGMEDIUM; break;
|
||||
case 5: params.kind = InsetSpaceParams::NEGTHICK; break;
|
||||
case 6: params.kind = InsetSpaceParams::ENSKIP; break;
|
||||
case 7: params.kind = InsetSpaceParams::QUAD; break;
|
||||
case 8: params.kind = InsetSpaceParams::QQUAD; break;
|
||||
case 9:
|
||||
params.kind = InsetSpaceParams::CUSTOM;
|
||||
params.length = GlueLength(widgetsToLength(value, unit));
|
||||
break;
|
||||
}
|
||||
return params;
|
||||
InsetSpaceParams params(true);
|
||||
switch (spacingCO->currentIndex()) {
|
||||
case 0: params.kind = InsetSpaceParams::THIN; break;
|
||||
case 1: params.kind = InsetSpaceParams::MEDIUM; break;
|
||||
case 2: params.kind = InsetSpaceParams::THICK; break;
|
||||
case 3: params.kind = InsetSpaceParams::NEGTHIN; break;
|
||||
case 4: params.kind = InsetSpaceParams::NEGMEDIUM; break;
|
||||
case 5: params.kind = InsetSpaceParams::NEGTHICK; break;
|
||||
case 6: params.kind = InsetSpaceParams::ENSKIP; break;
|
||||
case 7: params.kind = InsetSpaceParams::QUAD; break;
|
||||
case 8: params.kind = InsetSpaceParams::QQUAD; break;
|
||||
case 9:
|
||||
params.kind = InsetSpaceParams::CUSTOM;
|
||||
params.length = GlueLength(widgetsToLength(valueLE, unitCO));
|
||||
break;
|
||||
}
|
||||
return from_ascii(InsetSpace::params2string(params));
|
||||
}
|
||||
|
||||
switch (spacing) {
|
||||
|
||||
docstring GuiHSpace::dialogToParams() const
|
||||
{
|
||||
if (math_mode_)
|
||||
return dialogToMathParams();
|
||||
|
||||
InsetSpaceParams params(false);
|
||||
|
||||
switch (spacingCO->currentIndex()) {
|
||||
case 0:
|
||||
if (keep)
|
||||
if (keepCB->isChecked())
|
||||
params.kind = InsetSpaceParams::PROTECTED;
|
||||
else
|
||||
params.kind = InsetSpaceParams::NORMAL;
|
||||
@ -293,7 +267,7 @@ static InsetSpaceParams setHSpaceFromWidgets(int spacing,
|
||||
params.kind = InsetSpaceParams::NEGTHIN;
|
||||
break;
|
||||
case 3:
|
||||
if (keep)
|
||||
if (keepCB->isChecked())
|
||||
params.kind = InsetSpaceParams::ENSPACE;
|
||||
else
|
||||
params.kind = InsetSpaceParams::ENSKIP;
|
||||
@ -305,88 +279,53 @@ static InsetSpaceParams setHSpaceFromWidgets(int spacing,
|
||||
params.kind = InsetSpaceParams::QQUAD;
|
||||
break;
|
||||
case 6:
|
||||
if (fill == 1)
|
||||
switch (fillPatternCO->currentIndex()) {
|
||||
case 1:
|
||||
params.kind = InsetSpaceParams::DOTFILL;
|
||||
else if (fill == 2)
|
||||
break;
|
||||
case 2:
|
||||
params.kind = InsetSpaceParams::HRULEFILL;
|
||||
else if (fill == 3)
|
||||
break;
|
||||
case 3:
|
||||
params.kind = InsetSpaceParams::LEFTARROWFILL;
|
||||
else if (fill == 4)
|
||||
break;
|
||||
case 4:
|
||||
params.kind = InsetSpaceParams::RIGHTARROWFILL;
|
||||
else if (fill == 5)
|
||||
break;
|
||||
case 5:
|
||||
params.kind = InsetSpaceParams::UPBRACEFILL;
|
||||
else if (fill == 6)
|
||||
break;
|
||||
case 6:
|
||||
params.kind = InsetSpaceParams::DOWNBRACEFILL;
|
||||
else if (keep)
|
||||
params.kind = InsetSpaceParams::HFILL_PROTECTED;
|
||||
else
|
||||
params.kind = InsetSpaceParams::HFILL;
|
||||
break;
|
||||
default:
|
||||
if (keepCB->isChecked())
|
||||
params.kind = InsetSpaceParams::HFILL_PROTECTED;
|
||||
else
|
||||
params.kind = InsetSpaceParams::HFILL;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 7:
|
||||
if (keep)
|
||||
if (keepCB->isChecked())
|
||||
params.kind = InsetSpaceParams::CUSTOM_PROTECTED;
|
||||
else
|
||||
params.kind = InsetSpaceParams::CUSTOM;
|
||||
params.length = GlueLength(widgetsToLength(value, unit));
|
||||
params.length = GlueLength(widgetsToLength(valueLE, unitCO));
|
||||
break;
|
||||
}
|
||||
return params;
|
||||
return from_ascii(InsetSpace::params2string(params));
|
||||
}
|
||||
|
||||
|
||||
void GuiHSpace::applyView()
|
||||
bool GuiHSpace::checkWidgets() const
|
||||
{
|
||||
params_ = setHSpaceFromWidgets(spacingCO->currentIndex(),
|
||||
valueLE, unitCO, keepCB->isChecked(),
|
||||
fillPatternCO->currentIndex(), params_.math);
|
||||
}
|
||||
|
||||
|
||||
void GuiHSpace::updateContents()
|
||||
{
|
||||
setWidgetsFromHSpace(params_, spacingCO, valueLE, unitCO, keepCB,
|
||||
fillPatternCO);
|
||||
enableWidgets(spacingCO->currentIndex());
|
||||
}
|
||||
|
||||
|
||||
bool GuiHSpace::initialiseParams(string const & data)
|
||||
{
|
||||
bool const math = params_.math;
|
||||
InsetSpace::string2params(data, params_);
|
||||
params_.math = math;
|
||||
if (params_.math)
|
||||
setMath(params_.kind == InsetSpaceParams::CUSTOM);
|
||||
setButtonsValid(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void GuiHSpace::clearParams()
|
||||
{
|
||||
params_ = InsetSpaceParams(params_.math);
|
||||
}
|
||||
|
||||
|
||||
void GuiHSpace::dispatchParams()
|
||||
{
|
||||
dispatch(FuncRequest(getLfun(), InsetSpace::params2string(params_)));
|
||||
}
|
||||
|
||||
|
||||
bool GuiHSpace::isValid()
|
||||
{
|
||||
return spacingCO->currentIndex() != (params_.math ? 9 : 7)
|
||||
if (!InsetParamsWidget::checkWidgets())
|
||||
return false;
|
||||
return spacingCO->currentIndex() != (math_mode_ ? 9 : 7)
|
||||
|| !valueLE->text().isEmpty();
|
||||
}
|
||||
|
||||
|
||||
Dialog * createGuiMathHSpace(GuiView & lv) { return new GuiHSpace(lv, true); }
|
||||
|
||||
|
||||
Dialog * createGuiTextHSpace(GuiView & lv) { return new GuiHSpace(lv, false); }
|
||||
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
|
@ -12,48 +12,38 @@
|
||||
#ifndef GUIHSPACE_H
|
||||
#define GUIHSPACE_H
|
||||
|
||||
#include "GuiDialog.h"
|
||||
#include "InsetParamsWidget.h"
|
||||
#include "ui_HSpaceUi.h"
|
||||
#include "insets/InsetSpace.h"
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
class GuiHSpace : public GuiDialog, public Ui::HSpaceUi
|
||||
class GuiHSpace : public InsetParamsWidget, public Ui::HSpaceUi
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
GuiHSpace(GuiView & lv, bool math);
|
||||
GuiHSpace(bool math_mode, QWidget * parent = 0);
|
||||
|
||||
private Q_SLOTS:
|
||||
///
|
||||
void change_adaptor();
|
||||
void changedSlot();
|
||||
///
|
||||
void enableWidgets(int);
|
||||
///
|
||||
void patternChanged();
|
||||
void enableWidgets();
|
||||
|
||||
private:
|
||||
/// \name InsetParamsWidget inherited methods
|
||||
//@{
|
||||
InsetCode insetCode() const { return SPACE_CODE; }
|
||||
FuncCode creationCode() const { return LFUN_INSET_INSERT; }
|
||||
void paramsToDialog(Inset const *);
|
||||
docstring dialogToParams() const;
|
||||
bool checkWidgets() const;
|
||||
//@}
|
||||
///
|
||||
void setMath(bool custom);
|
||||
/// Apply from dialog
|
||||
void applyView();
|
||||
/// Update the dialog
|
||||
void updateContents();
|
||||
docstring dialogToMathParams() const;
|
||||
///
|
||||
bool isValid();
|
||||
///
|
||||
bool initialiseParams(std::string const & data);
|
||||
/// clean-up on hide.
|
||||
void clearParams();
|
||||
/// clean-up on hide.
|
||||
void dispatchParams();
|
||||
///
|
||||
bool isBufferDependent() const { return true; }
|
||||
|
||||
///
|
||||
InsetSpaceParams params_;
|
||||
bool const math_mode_;
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
|
@ -3457,7 +3457,6 @@ Dialog * createGuiIndex(GuiView & lv);
|
||||
Dialog * createGuiLabel(GuiView & lv);
|
||||
Dialog * createGuiListings(GuiView & lv);
|
||||
Dialog * createGuiLog(GuiView & lv);
|
||||
Dialog * createGuiMathHSpace(GuiView & lv);
|
||||
Dialog * createGuiMathMatrix(GuiView & lv);
|
||||
Dialog * createGuiNomenclature(GuiView & lv);
|
||||
Dialog * createGuiNote(GuiView & lv);
|
||||
@ -3476,7 +3475,6 @@ Dialog * createGuiSpellchecker(GuiView & lv);
|
||||
Dialog * createGuiSymbols(GuiView & lv);
|
||||
Dialog * createGuiTabularCreate(GuiView & lv);
|
||||
Dialog * createGuiTexInfo(GuiView & lv);
|
||||
Dialog * createGuiTextHSpace(GuiView & lv);
|
||||
Dialog * createGuiToc(GuiView & lv);
|
||||
Dialog * createGuiThesaurus(GuiView & lv);
|
||||
Dialog * createGuiHyperlink(GuiView & lv);
|
||||
@ -3538,8 +3536,6 @@ Dialog * GuiView::build(string const & name)
|
||||
return createGuiLog(*this);
|
||||
if (name == "mathdelimiter")
|
||||
return createGuiDelimiter(*this);
|
||||
if (name == "mathspace")
|
||||
return createGuiMathHSpace(*this);
|
||||
if (name == "mathmatrix")
|
||||
return createGuiMathMatrix(*this);
|
||||
if (name == "nomenclature")
|
||||
@ -3560,8 +3556,6 @@ Dialog * GuiView::build(string const & name)
|
||||
return createGuiRef(*this);
|
||||
if (name == "sendto")
|
||||
return createGuiSendTo(*this);
|
||||
if (name == "space")
|
||||
return createGuiTextHSpace(*this);
|
||||
if (name == "spellchecker")
|
||||
return createGuiSpellchecker(*this);
|
||||
if (name == "symbols")
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "GuiBranch.h"
|
||||
#include "GuiERT.h"
|
||||
#include "GuiInfo.h"
|
||||
#include "GuiHSpace.h"
|
||||
#include "GuiTabular.h"
|
||||
#include "GuiVSpace.h"
|
||||
#include "FloatPlacement.h"
|
||||
@ -214,6 +215,12 @@ Dialog * createDialog(GuiView & lv, InsetCode code)
|
||||
case INFO_CODE:
|
||||
widget = new GuiInfo;
|
||||
break;
|
||||
case MATH_SPACE_CODE:
|
||||
widget = new GuiHSpace(true);
|
||||
break;
|
||||
case SPACE_CODE:
|
||||
widget = new GuiHSpace(false);
|
||||
break;
|
||||
case TABULAR_CODE:
|
||||
widget = new GuiTabular;
|
||||
break;
|
||||
|
@ -67,7 +67,7 @@ public:
|
||||
virtual docstring dialogToParams() const = 0;
|
||||
|
||||
/// \return true if all CheckedWidgets are in a valid state.
|
||||
bool checkWidgets() const;
|
||||
virtual bool checkWidgets() const;
|
||||
|
||||
protected:
|
||||
/// Add a widget to the list of all widgets whose validity should
|
||||
|
@ -1,185 +1,142 @@
|
||||
<ui version="4.0" >
|
||||
<ui version="4.0">
|
||||
<class>HSpaceUi</class>
|
||||
<widget class="QDialog" name="HSpaceUi" >
|
||||
<property name="geometry" >
|
||||
<widget class="QWidget" name="HSpaceUi">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>259</width>
|
||||
<height>160</height>
|
||||
<width>239</width>
|
||||
<height>109</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<property name="windowTitle">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="sizeGripEnabled" >
|
||||
<property name="sizeGripEnabled" stdset="0">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QGridLayout" >
|
||||
<property name="margin" >
|
||||
<layout class="QGridLayout">
|
||||
<property name="margin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="2" column="1" >
|
||||
<widget class="QComboBox" name="fillPatternCO" >
|
||||
<property name="toolTip" >
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="fillPatternCO">
|
||||
<property name="toolTip">
|
||||
<string>Select a fill pattern style for HFills</string>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<property name="text">
|
||||
<string>None</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<property name="text">
|
||||
<string>...............</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<property name="text">
|
||||
<string>________</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<property name="text">
|
||||
<string><-----------</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>-----------></string>
|
||||
<property name="text">
|
||||
<string>-----------></string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<property name="text">
|
||||
<string>\-----v-----/</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<property name="text">
|
||||
<string>/-----^-----\</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QLabel" name="spacingL" >
|
||||
<property name="text" >
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="spacingL">
|
||||
<property name="text">
|
||||
<string>&Spacing:</string>
|
||||
</property>
|
||||
<property name="buddy" >
|
||||
<property name="buddy">
|
||||
<cstring>spacingCO</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" colspan="2" >
|
||||
<widget class="QComboBox" name="spacingCO" >
|
||||
<property name="toolTip" >
|
||||
<item row="0" column="1" colspan="2">
|
||||
<widget class="QComboBox" name="spacingCO">
|
||||
<property name="toolTip">
|
||||
<string>Supported spacing types</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QLabel" name="valueL" >
|
||||
<property name="text" >
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="valueL">
|
||||
<property name="text">
|
||||
<string>&Value:</string>
|
||||
</property>
|
||||
<property name="buddy" >
|
||||
<property name="buddy">
|
||||
<cstring>valueLE</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" >
|
||||
<widget class="QLineEdit" name="valueLE" >
|
||||
<property name="enabled" >
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="valueLE">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip" >
|
||||
<string>Custom value. Needs spacing type "Custom".</string>
|
||||
<property name="toolTip">
|
||||
<string>Custom value. Needs spacing type "Custom".</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2" >
|
||||
<widget class="LengthCombo" name="unitCO" />
|
||||
<item row="1" column="2">
|
||||
<widget class="LengthCombo" name="unitCO"/>
|
||||
</item>
|
||||
<item row="2" column="0" >
|
||||
<widget class="QLabel" name="fillPatternL" >
|
||||
<property name="text" >
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="fillPatternL">
|
||||
<property name="text">
|
||||
<string>&Fill Pattern:</string>
|
||||
</property>
|
||||
<property name="buddy" >
|
||||
<property name="buddy">
|
||||
<cstring>fillPatternCO</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" >
|
||||
<widget class="QLabel" name="keepL" >
|
||||
<property name="toolTip" >
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="keepL">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<property name="text">
|
||||
<string>&Protect:</string>
|
||||
</property>
|
||||
<property name="buddy" >
|
||||
<property name="buddy">
|
||||
<cstring>keepCB</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1" colspan="2" >
|
||||
<widget class="QCheckBox" name="keepCB" >
|
||||
<property name="toolTip" >
|
||||
<item row="3" column="1" colspan="2">
|
||||
<widget class="QCheckBox" name="keepCB">
|
||||
<property name="toolTip">
|
||||
<string>Insert the spacing even after a line break</string>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="3" >
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QPushButton" name="okPB" >
|
||||
<property name="text" >
|
||||
<string>&OK</string>
|
||||
</property>
|
||||
<property name="autoDefault" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="default" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="applyPB" >
|
||||
<property name="text" >
|
||||
<string>&Apply</string>
|
||||
</property>
|
||||
<property name="autoDefault" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="closePB" >
|
||||
<property name="text" >
|
||||
<string>&Close</string>
|
||||
</property>
|
||||
<property name="autoDefault" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
@ -192,13 +149,10 @@
|
||||
<tabstops>
|
||||
<tabstop>spacingCO</tabstop>
|
||||
<tabstop>valueLE</tabstop>
|
||||
<tabstop>okPB</tabstop>
|
||||
<tabstop>applyPB</tabstop>
|
||||
<tabstop>closePB</tabstop>
|
||||
<tabstop>keepCB</tabstop>
|
||||
</tabstops>
|
||||
<includes>
|
||||
<include location="local" >qt_i18n.h</include>
|
||||
<include location="local">qt_i18n.h</include>
|
||||
</includes>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
@ -103,7 +103,7 @@ static void build_translator()
|
||||
insetnames[BRANCH_CODE] = InsetName("branch", _("Branch"));
|
||||
insetnames[BOX_CODE] = InsetName("box", _("Box"));
|
||||
insetnames[FLEX_CODE] = InsetName("flex");
|
||||
insetnames[SPACE_CODE] = InsetName("space");
|
||||
insetnames[SPACE_CODE] = InsetName("space", _("Horizontal Space"));
|
||||
insetnames[VSPACE_CODE] = InsetName("vspace", _("Vertical Space"));
|
||||
insetnames[MATH_MACROARG_CODE] = InsetName("mathmacroarg");
|
||||
insetnames[LISTINGS_CODE] = InsetName("listings");
|
||||
@ -149,7 +149,7 @@ static void build_translator()
|
||||
insetnames[MATH_ROOT_CODE] = InsetName("mathroot");
|
||||
insetnames[MATH_SCRIPT_CODE] = InsetName("mathscript");
|
||||
insetnames[MATH_SIZE_CODE] = InsetName("mathsize");
|
||||
insetnames[MATH_SPACE_CODE] = InsetName("mathspace");
|
||||
insetnames[MATH_SPACE_CODE] = InsetName("mathspace", _("Horizontal Math Space"));
|
||||
insetnames[MATH_SPECIALCHAR_CODE] = InsetName("mathspecialchar");
|
||||
insetnames[MATH_SPLIT_CODE] = InsetName("mathsplit");
|
||||
insetnames[MATH_SQRT_CODE] = InsetName("mathsqrt");
|
||||
@ -298,6 +298,8 @@ bool Inset::showInsetDialog(BufferView * bv) const
|
||||
case BOX_CODE:
|
||||
case BRANCH_CODE:
|
||||
case INFO_CODE:
|
||||
case MATH_SPACE_CODE:
|
||||
case SPACE_CODE:
|
||||
case TABULAR_CODE:
|
||||
case VSPACE_CODE:
|
||||
bv->showDialog(insetName(code));
|
||||
|
@ -60,12 +60,6 @@ GlueLength InsetSpace::length() const
|
||||
}
|
||||
|
||||
|
||||
InsetSpace::~InsetSpace()
|
||||
{
|
||||
hideDialogs("space", this);
|
||||
}
|
||||
|
||||
|
||||
docstring InsetSpace::toolTip(BufferView const &, int, int) const
|
||||
{
|
||||
docstring message;
|
||||
@ -185,14 +179,6 @@ bool InsetSpace::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
}
|
||||
|
||||
|
||||
bool InsetSpace::showInsetDialog(BufferView * bv) const
|
||||
{
|
||||
bv->showDialog("space", params2string(params()),
|
||||
const_cast<InsetSpace *>(this));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
namespace {
|
||||
int const arrow_size = 8;
|
||||
}
|
||||
|
@ -23,8 +23,7 @@ namespace lyx {
|
||||
|
||||
class LaTeXFeatures;
|
||||
|
||||
class InsetSpaceParams {
|
||||
public:
|
||||
struct InsetSpaceParams {
|
||||
/// The different kinds of spaces we support
|
||||
enum Kind {
|
||||
/// Normal space ('\ ')
|
||||
@ -99,11 +98,9 @@ public:
|
||||
///
|
||||
explicit InsetSpace(InsetSpaceParams const & par);
|
||||
///
|
||||
InsetSpaceParams params() const { return params_; }
|
||||
InsetSpaceParams const & params() const { return params_; }
|
||||
///
|
||||
InsetSpaceParams::Kind kind() const;
|
||||
///
|
||||
~InsetSpace();
|
||||
|
||||
///
|
||||
static void string2params(std::string const &, InsetSpaceParams &);
|
||||
@ -160,8 +157,6 @@ public:
|
||||
bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const;
|
||||
|
||||
private:
|
||||
///
|
||||
bool showInsetDialog(BufferView * bv) const;
|
||||
///
|
||||
InsetSpaceParams params_;
|
||||
};
|
||||
|
@ -1191,11 +1191,10 @@ void InsetMathNest::doDispatch(Cursor & cur, FuncRequest & cmd)
|
||||
if (name == "ref") {
|
||||
InsetMathRef tmp(buffer_, name);
|
||||
data = tmp.createDialogStr(to_utf8(name));
|
||||
cur.bv().showDialog(to_utf8(name), data);
|
||||
} else if (name == "mathspace") {
|
||||
InsetMathSpace tmp;
|
||||
data = tmp.createDialogStr();
|
||||
cur.bv().showDialog(to_utf8(name));
|
||||
}
|
||||
cur.bv().showDialog(to_utf8(name), data);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -104,12 +104,6 @@ InsetMathSpace::InsetMathSpace(Length const & length)
|
||||
}
|
||||
|
||||
|
||||
InsetMathSpace::~InsetMathSpace()
|
||||
{
|
||||
hideDialogs("mathspace", this);
|
||||
}
|
||||
|
||||
|
||||
Inset * InsetMathSpace::clone() const
|
||||
{
|
||||
return new InsetMathSpace(*this);
|
||||
@ -230,13 +224,13 @@ void InsetMathSpace::write(WriteStream & os) const
|
||||
}
|
||||
|
||||
|
||||
string const InsetMathSpace::createDialogStr() const
|
||||
InsetSpaceParams InsetMathSpace::params() const
|
||||
{
|
||||
LASSERT(space_info[space_].visible, /**/);
|
||||
InsetSpaceParams isp(true);
|
||||
isp.kind = space_info[space_].kind;
|
||||
isp.length = GlueLength(length_);
|
||||
return InsetSpace::params2string(isp);
|
||||
return isp;
|
||||
}
|
||||
|
||||
|
||||
@ -279,14 +273,9 @@ void InsetMathSpace::doDispatch(Cursor & cur, FuncRequest & cmd)
|
||||
cur.undispatched();
|
||||
break;
|
||||
|
||||
case LFUN_INSET_DIALOG_UPDATE:
|
||||
cur.bv().updateDialog("mathspace", createDialogStr());
|
||||
break;
|
||||
|
||||
case LFUN_MOUSE_RELEASE:
|
||||
if (cmd.button() == mouse_button::button1) {
|
||||
string const data = createDialogStr();
|
||||
cur.bv().showDialog("mathspace", data, this);
|
||||
showInsetDialog(&cur.bv());
|
||||
break;
|
||||
}
|
||||
cur.undispatched();
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
namespace lyx {
|
||||
|
||||
struct InsetSpaceParams;
|
||||
|
||||
/// Smart spaces
|
||||
class InsetMathSpace : public InsetMath {
|
||||
@ -29,8 +30,6 @@ public:
|
||||
///
|
||||
explicit InsetMathSpace(Length const & length);
|
||||
///
|
||||
~InsetMathSpace();
|
||||
///
|
||||
InsetMathSpace const * asSpaceInset() const { return this; }
|
||||
///
|
||||
InsetMathSpace * asSpaceInset() { return this; }
|
||||
@ -56,7 +55,7 @@ public:
|
||||
///
|
||||
void write(WriteStream & os) const;
|
||||
/// generate something that will be understood by the Dialogs.
|
||||
std::string const createDialogStr() const;
|
||||
InsetSpaceParams params() const;
|
||||
///
|
||||
bool hasSettings() const { return true; }
|
||||
///
|
||||
|
Loading…
Reference in New Issue
Block a user