mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 21:21:32 +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);
|
||||
if (math_mode_) {
|
||||
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();
|
||||
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,25 +201,33 @@ 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) {
|
||||
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;
|
||||
@ -273,15 +239,23 @@ static InsetSpaceParams setHSpaceFromWidgets(int spacing,
|
||||
case 8: params.kind = InsetSpaceParams::QQUAD; break;
|
||||
case 9:
|
||||
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));
|
||||
}
|
||||
|
||||
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)
|
||||
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,18 +1,18 @@
|
||||
<ui version="4.0">
|
||||
<class>HSpaceUi</class>
|
||||
<widget class="QDialog" name="HSpaceUi" >
|
||||
<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">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="sizeGripEnabled" >
|
||||
<property name="sizeGripEnabled" stdset="0">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QGridLayout">
|
||||
@ -49,7 +49,7 @@
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>-----------></string>
|
||||
<string>-----------></string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
@ -97,7 +97,7 @@
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Custom value. Needs spacing type "Custom".</string>
|
||||
<string>Custom value. Needs spacing type "Custom".</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -137,49 +137,6 @@
|
||||
</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,9 +149,6 @@
|
||||
<tabstops>
|
||||
<tabstop>spacingCO</tabstop>
|
||||
<tabstop>valueLE</tabstop>
|
||||
<tabstop>okPB</tabstop>
|
||||
<tabstop>applyPB</tabstop>
|
||||
<tabstop>closePB</tabstop>
|
||||
<tabstop>keepCB</tabstop>
|
||||
</tabstops>
|
||||
<includes>
|
||||
|
@ -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));
|
||||
} else if (name == "mathspace") {
|
||||
InsetMathSpace tmp;
|
||||
data = tmp.createDialogStr();
|
||||
}
|
||||
cur.bv().showDialog(to_utf8(name), data);
|
||||
} else if (name == "mathspace") {
|
||||
cur.bv().showDialog(to_utf8(name));
|
||||
}
|
||||
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