add 'show staff' to palette cell properties

This commit is contained in:
Werner Schweer 2013-02-06 18:37:18 +01:00
parent a92f394203
commit 84012d5b4b
2 changed files with 76 additions and 61 deletions

View file

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>413</width>
<height>161</height>
<width>461</width>
<height>199</height>
</rect>
</property>
<property name="windowTitle">
@ -50,6 +50,40 @@
<bool>false</bool>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Name:</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Content Offset</string>
</property>
</widget>
</item>
<item row="4" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Content scale</string>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QLabel" name="label_4">
<property name="text">
@ -70,56 +104,6 @@
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Content Offset</string>
</property>
</widget>
</item>
<item row="3" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Content scale</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QDoubleSpinBox" name="scale">
<property name="minimum">
<double>0.010000000000000</double>
</property>
<property name="maximum">
<double>10.000000000000000</double>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Name:</string>
</property>
</widget>
</item>
<item row="0" column="1" colspan="4">
<widget class="QLineEdit" name="name"/>
</item>
<item row="1" column="2">
<widget class="QDoubleSpinBox" name="xoffset">
<property name="suffix">
@ -140,6 +124,29 @@
</property>
</widget>
</item>
<item row="0" column="1" colspan="4">
<widget class="QLineEdit" name="name"/>
</item>
<item row="2" column="1" colspan="2">
<widget class="QDoubleSpinBox" name="scale">
<property name="minimum">
<double>0.010000000000000</double>
</property>
<property name="maximum">
<double>10.000000000000000</double>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="drawStaff">
<property name="text">
<string>draw Staff</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>

View file

@ -1025,7 +1025,6 @@ void Palette::write(const QString& p)
void Palette::read(XmlReader& e)
{
// QString name = e.attribute("name");
while (e.readNextStartElement()) {
const QStringRef& t(e.name());
if (t == "gridWidth")
@ -1042,7 +1041,9 @@ void Palette::read(XmlReader& e)
e.skipCurrentElement();
else if (t == "Cell") {
QString name = e.attribute("name");
bool drawStaff = false;
Element* element = 0;
QString tag;
bool drawStaff = false;
double xoffset = 0.0;
double yoffset = 0.0;
qreal mag = 1.0;
@ -1056,10 +1057,10 @@ void Palette::read(XmlReader& e)
yoffset = e.readDouble();
else if (t == "mag")
mag = e.readDouble();
//TODOxx else if (t == "tag")
// tag = e.value();
else if (t == "tag")
tag = e.readElementText();
else {
Element* element = Element::name2Element(t, gscore);
element = Element::name2Element(t, gscore);
if (element == 0) {
e.unknown();
return;
@ -1075,10 +1076,15 @@ void Palette::read(XmlReader& e)
}
}
}
cells.back()->drawStaff = drawStaff;
cells.back()->xoffset = xoffset;
cells.back()->yoffset = yoffset;
cells.back()->mag = mag;
if (!element)
cells.append(new PaletteCell()); // add empty cell
else {
cells.back()->tag = tag;
cells.back()->drawStaff = drawStaff;
cells.back()->xoffset = xoffset;
cells.back()->yoffset = yoffset;
cells.back()->mag = mag;
}
}
else
e.unknown();
@ -1613,6 +1619,7 @@ PaletteCellProperties::PaletteCellProperties(PaletteCell* p, QWidget* parent)
xoffset->setValue(cell->xoffset);
yoffset->setValue(cell->yoffset);
scale->setValue(cell->mag);
drawStaff->setChecked(cell->drawStaff);
name->setText(p->name);
}
@ -1626,5 +1633,6 @@ void PaletteCellProperties::accept()
cell->yoffset = yoffset->value();
cell->mag = scale->value();
cell->name = name->text();
cell->drawStaff = drawStaff->isChecked();
QDialog::accept();
}