[Kst] branches/work/kst/portto4/kst/src
Barth Netterfield
netterfield at astro.utoronto.ca
Mon Jul 2 16:23:57 UTC 2012
SVN commit 1303760 by netterfield:
-Fix apply button in view item dialogs (including labels).
-Add ability to set left or right alignment point for labels in creator.
-Make alignment defaults work in label dialog.
-Add a help window for label formatting.
M +1 -0 libkstapp/arrowitemdialog.cpp
M +13 -1 libkstapp/labelcreator.cpp
M +2 -0 libkstapp/labelcreator.h
M +54 -4 libkstapp/labelcreator.ui
M +5 -0 libkstapp/labelitem.cpp
M +5 -1 libkstapp/labelitemdialog.cpp
M +1 -0 libkstapp/legenditemdialog.cpp
M +2 -1 libkstapp/viewitem.cpp
M +77 -1 widgets/labelbuilder.cpp
M +5 -0 widgets/labelbuilder.h
M +24 -13 widgets/labelbuilder.ui
A widgets/modelessinfobox.cpp [License: UNKNOWN]
A widgets/modelessinfobox.h [License: UNKNOWN]
AM widgets/modelessinfobox.ui
--- branches/work/kst/portto4/kst/src/libkstapp/arrowitemdialog.cpp #1303759:1303760
@@ -66,6 +66,7 @@
_dialogDefaults->setValue("arrow/startHeadScale", _arrowItem->startArrowScale());
}
}
+ _arrowItem->update();
}
}
--- branches/work/kst/portto4/kst/src/libkstapp/labelcreator.cpp #1303759:1303760
@@ -47,7 +47,12 @@
_labelColor->setColor(_dialogDefaults->value("label/color",QColor(Qt::black)).value<QColor>());
_labelFontScale->setValue(_dialogDefaults->value("label/fontScale",12).toDouble());
-
+ if (_dialogDefaults->value("label/fixLeft",true).toBool()) {
+ _left->setChecked(true);
+ } else {
+ _right->setChecked(true);
+ }
+ _lockPosToData->setChecked(dialogDefaultsLockPosToData("label"));
_saveAsDefault->show();
_Label_11->setProperty("si","Font &size:");
@@ -81,6 +86,13 @@
return font;
}
+bool LabelCreator::fixLeft() const {
+ return _left->isChecked();
}
+bool LabelCreator::lockPosToData() const {
+ return _lockPosToData->isChecked();
+}
+}
+
// vim: ts=2 sw=2 et
--- branches/work/kst/portto4/kst/src/libkstapp/labelcreator.h #1303759:1303760
@@ -35,6 +35,8 @@
qreal labelScale() const;
QColor labelColor() const;
QFont labelFont() const;
+ bool fixLeft() const;
+ bool lockPosToData() const;
bool saveAsDefaults() const {return _saveAsDefault->isChecked();}
};
--- branches/work/kst/portto4/kst/src/libkstapp/labelcreator.ui #1303759:1303760
@@ -7,13 +7,13 @@
<x>0</x>
<y>0</y>
<width>358</width>
- <height>162</height>
+ <height>281</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
- <layout class="QGridLayout" name="gridLayout_2">
+ <layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0" colspan="2">
<widget class="Kst::LabelBuilder" name="_labelText" native="true">
<property name="sizePolicy">
@@ -25,6 +25,56 @@
</widget>
</item>
<item row="1" column="0" colspan="2">
+ <layout class="QGridLayout" name="gridLayout_2">
+ <item row="0" column="3">
+ <widget class="QCheckBox" name="_lockPosToData">
+ <property name="text">
+ <string>Lock Position To Data</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="2">
+ <widget class="QRadioButton" name="_right">
+ <property name="text">
+ <string>Right</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QRadioButton" name="_left">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Left</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="0">
+ <widget class="QLabel" name="label_4">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Reference Point:</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignCenter</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="2" column="0" colspan="2">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="_Label_11">
@@ -137,14 +187,14 @@
</item>
</layout>
</item>
- <item row="2" column="0">
+ <item row="3" column="0">
<widget class="QCheckBox" name="_saveAsDefault">
<property name="text">
<string>Save as default</string>
</property>
</widget>
</item>
- <item row="2" column="1">
+ <item row="3" column="1">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
--- branches/work/kst/portto4/kst/src/libkstapp/labelitem.cpp #1303759:1303760
@@ -47,6 +47,7 @@
_font = font;
_color = _dialogDefaults->value(defaultsGroupName()+"/color",QColor(Qt::black)).value<QColor>();
_scale = _dialogDefaults->value(defaultsGroupName()+"/fontScale",12).toDouble();
+ _fixleft = _dialogDefaults->value(defaultsGroupName()+"/fixLeft",true).toBool();
applyDialogDefaultsLockPosToData();
}
@@ -281,8 +282,12 @@
label->setLabelScale(dialog.labelScale());
label->setLabelColor(dialog.labelColor());
label->setLabelFont(dialog.labelFont());
+ label->setFixLeft(dialog.fixLeft());
+ label->setLockPosToData(dialog.lockPosToData());
if (dialog.saveAsDefaults()) {
label->saveAsDialogDefaults();
+ _dialogDefaults->setValue(label->staticDefaultsGroupName()+"/fixLeft",dialog.fixLeft());
+ _dialogDefaults->setValue(label->staticDefaultsGroupName()+"/lockPosToData",dialog.lockPosToData());
}
}
_item->view()->scene()->addItem(_item);
--- branches/work/kst/portto4/kst/src/libkstapp/labelitemdialog.cpp #1303759:1303760
@@ -21,6 +21,7 @@
#include "objectstore.h"
#include "mainwindow.h"
#include "document.h"
+#include "dialogdefaults.h"
namespace Kst {
@@ -78,7 +79,7 @@
_labelItem->saveAsDialogDefaults();
}
kstApp->mainWindow()->document()->setChanged(true);
-
+ _labelItem->update();
}
@@ -138,7 +139,10 @@
item->setTransform(transform);
item->updateRelativeSize(true);
+ if (_saveAsDefault->isChecked()) {
+ _dialogDefaults->setValue(item->staticDefaultsGroupName()+"/fixLeft",_labelDimensionsTab->fixLeft());
}
}
+}
// vim: ts=2 sw=2 et
--- branches/work/kst/portto4/kst/src/libkstapp/legenditemdialog.cpp #1303759:1303760
@@ -164,6 +164,7 @@
}
legendItem->setRelations(newRelations);
}
+ legendItem->update();
}
}
--- branches/work/kst/portto4/kst/src/libkstapp/viewitem.cpp #1303759:1303760
@@ -1252,7 +1252,8 @@
if (ApplicationSettings::self()->transparentDrag()) {
pixmap.fill(Qt::transparent);
} else {
- pixmap.fill(brush().color());
+ //pixmap.fill(brush().color());
+ pixmap.fill(view()->backgroundBrush().color());
}
QPainter painter(&pixmap);
--- branches/work/kst/portto4/kst/src/widgets/labelbuilder.cpp #1303759:1303760
@@ -17,7 +17,7 @@
namespace Kst {
LabelBuilder::LabelBuilder(QWidget *parent, ObjectStore *store)
- : QWidget(parent), _store(store) {
+ : QWidget(parent), _store(store), _helpBox(0) {
setupUi(this);
@@ -37,15 +37,91 @@
_label->setToolTip(tr("Label text. A subset of LaTeX is supported. See What's This."));
connect(_label, SIGNAL(textChanged()), this, SIGNAL(labelChanged()));
+ connect(_help, SIGNAL(clicked()), this, SLOT(showHelp()));
_label->setFocus();
}
LabelBuilder::~LabelBuilder() {
+ if (_helpBox) {
+ delete _helpBox;
+ _helpBox = 0;
}
+}
+void LabelBuilder::showHelp() {
+ if (!_helpBox) {
+ _helpBox = new ModelessInfoBox(this);
+ }
+ _helpBox->show();
+ _helpBox->setText("<qt>"
+ "<P ALIGN=LEFT STYLE=\"margin-bottom: 0in\"><FONT SIZE=4><B>Scalars & equations</B></FONT><br>"
+ "Scalars and scalar equations can be displayed live in labels. When the scalar "
+ "is updated, the label is updated. Scalar names are autocompleted. The format is:</P>"
+
+ "<P STYLE=\"margin-bottom: 0in\"><B>Scalar:</B> <FONT FACE=\"Courier New, monospace\">[</FONT><I>scalar"
+ "name</I><FONT FACE=\"Courier New, monospace\">]</FONT>, eg <FONT FACE=\"Courier New, monospace\">[GYRO1:Mean"
+ "(X4)]</FONT></P>"
+ "<P STYLE=\"margin-bottom: 0in\"><B>Vector Element:</B>"
+ "<FONT FACE=\"Courier New, monospace\">[</FONT><I>vectorName</I><FONT FACE=\"Courier New, monospace\">[</FONT><I>index</I><FONT FACE=\"Courier New, monospace\">]]</FONT><FONT FACE=\"Times New Roman, serif\">,"
+ "eg, </FONT><FONT FACE=\"Courier New, monospace\">[GYRO1 (V2)[4]]</FONT>"
+ "</P>"
+ "<P STYLE=\"margin-bottom: 0in\"><B>Equation:</B> <FONT FACE=\"Courier New, monospace\">[=</FONT><I>equation</I><FONT FACE=\"Courier New, monospace\">]</FONT>,"
+ "eg <FONT FACE=\"Courier New, monospace\">[=[GYRO1:Mean"
+ "(X4)]/[GYRO1:Sigma (X4)]]</FONT></P>"
+
+ "<P ALIGN=LEFT STYLE=\"margin-bottom: 0in\"><FONT SIZE=4><B>Supported LaTeX Subset</B></FONT><br>"
+ "Labels in <i>kst</i> "
+ "support a derrivitive subset of LaTeX. For example, to display the equation for the area of a "
+ "circle, you could set the label to A=2\\pir^2. Unlike LaTeX, it is not necessary to enter math mode using '$'. Also, "
+ "unlike LaTeX, variables are not automatically displayed in italic font. If desired, this must "
+ "be done explicitly using \\textit{}. Supported sequences are:</P>"
+
+ "<P STYLE=\"margin-bottom: 0in\"><B>Greek letters:</B> \\<I>name</I> or "
+ "\\<I>Name</I>. eg: <FONT FACE=\"Courier New, monospace\">\\alpha</FONT></P>"
+ "<P STYLE=\"margin-bottom: 0in\"><B>Other symbols:</B> <FONT FACE=\"Courier New, monospace\">\\approx</FONT><FONT FACE=\"Times New Roman, serif\">,</FONT><FONT FACE=\"Courier New, monospace\">"
+ "\\cdot</FONT><FONT FACE=\"Times New Roman, serif\">,</FONT><FONT FACE=\"Courier New, monospace\">"
+ "\\ge</FONT><FONT FACE=\"Times New Roman, serif\">,</FONT><FONT FACE=\"Courier New, monospace\">"
+ "\\geq</FONT><FONT FACE=\"Times New Roman, serif\">,</FONT><FONT FACE=\"Courier New, monospace\">"
+ "\\inf</FONT><FONT FACE=\"Times New Roman, serif\">,</FONT><FONT FACE=\"Courier New, monospace\">"
+ "\\approx</FONT><FONT FACE=\"Times New Roman, serif\">,</FONT><FONT FACE=\"Courier New, monospace\">"
+ "\\cdot</FONT><FONT FACE=\"Times New Roman, serif\">,</FONT><FONT FACE=\"Courier New, monospace\">"
+ "\\ge</FONT><FONT FACE=\"Times New Roman, serif\">,</FONT><FONT FACE=\"Courier New, monospace\">"
+ "\\geq</FONT><FONT FACE=\"Times New Roman, serif\">,</FONT><FONT FACE=\"Courier New, monospace\">"
+ "\\inf</FONT><FONT FACE=\"Times New Roman, serif\">,</FONT><FONT FACE=\"Courier New, monospace\">"
+ "\\int</FONT><FONT FACE=\"Times New Roman, serif\">,</FONT><FONT FACE=\"Courier New, monospace\">"
+ "\\le</FONT><FONT FACE=\"Times New Roman, serif\">,</FONT><FONT FACE=\"Courier New, monospace\">"
+ "\\leq</FONT><FONT FACE=\"Times New Roman, serif\">,</FONT><FONT FACE=\"Courier New, monospace\">"
+ "\\ne</FONT><FONT FACE=\"Times New Roman, serif\">,</FONT><FONT FACE=\"Courier New, monospace\">"
+ "\\n</FONT><FONT FACE=\"Times New Roman, serif\">,</FONT><FONT FACE=\"Courier New, monospace\">"
+ "\\partial</FONT><FONT FACE=\"Times New Roman, serif\">,</FONT><FONT FACE=\"Courier New, monospace\">"
+ "\\prod</FONT><FONT FACE=\"Times New Roman, serif\">,</FONT><FONT FACE=\"Courier New, monospace\">"
+ "\\pm</FONT><FONT FACE=\"Times New Roman, serif\">,</FONT><FONT FACE=\"Courier New, monospace\">"
+ "\\sum</FONT><FONT FACE=\"Times New Roman, serif\">,</FONT><FONT FACE=\"Courier New, monospace\">"
+ "\\sqrt</FONT></P>"
+ "<P STYLE=\"margin-bottom: 0in\"><B>Font effects:</B> <FONT FACE=\"Courier New, monospace\">\\textcolor{</FONT><I>color"
+ "name</I><FONT FACE=\"Courier New, monospace\">}{</FONT><I>colored "
+ "text</I><FONT FACE=\"Courier New, monospace\">}</FONT>, <FONT FACE=\"Courier New, monospace\">\\textbf{</FONT><I>bold "
+ "text</I><FONT FACE=\"Courier New, monospace\">}</FONT>,"
+ "<FONT FACE=\"Courier New, monospace\">\\textit{</FONT><I>italicized "
+ "text</I><FONT FACE=\"Courier New, monospace\">}</FONT>,"
+ "<FONT FACE=\"Courier New, monospace\">\\underline{</FONT><I>underlined "
+ "text</I><FONT FACE=\"Courier New, monospace\">}</FONT>,"
+ "<FONT FACE=\"Courier New, monospace\">\\overline{</FONT><I>overlined "
+ "text</I><FONT FACE=\"Courier New, monospace\">}</FONT>."
+
+ "<P STYLE=\"margin-bottom: 0in\"><B>Other:</B><I>x</I><FONT FACE=\"Courier New, monospace\">^</FONT><I>y</I>,"
+ "<I>x</I><FONT FACE=\"Courier New, monospace\">_</FONT><I>y</I>, <FONT FACE=\"Courier New, monospace\">\\t</FONT>,"
+ "<FONT FACE=\"Courier New, monospace\">\\n</FONT>, <FONT FACE=\"Courier New, monospace\">\\[</FONT></P>"
+
+ );
+ _helpBox->setWidth(100);
+
+}
+
+
void LabelBuilder::setObjectStore(ObjectStore *store) {
_store = store;
_label->setObjectStore(store);
--- branches/work/kst/portto4/kst/src/widgets/labelbuilder.h #1303759:1303760
@@ -19,6 +19,7 @@
#include <string_kst.h>
#include "kstwidgets_export.h"
+#include "modelessinfobox.h"
namespace Kst {
@@ -38,8 +39,12 @@
Q_SIGNALS:
void labelChanged();
+ public Q_SLOTS:
+ void showHelp();
+
private:
ObjectStore *_store;
+ ModelessInfoBox *_helpBox;
};
}
--- branches/work/kst/portto4/kst/src/widgets/labelbuilder.ui #1303759:1303760
@@ -23,6 +23,24 @@
</size>
</property>
<layout class="QGridLayout" name="gridLayout">
+ <item row="1" column="1">
+ <widget class="QLabel" name="label">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="font">
+ <font>
+ <italic>true</italic>
+ </font>
+ </property>
+ <property name="text">
+ <string>Supports LaTeX symbols, live strings & scalars, and embedded equations.</string>
+ </property>
+ </widget>
+ </item>
<item row="0" column="0">
<widget class="QLabel" name="_Label_13">
<property name="sizePolicy">
@@ -42,29 +60,22 @@
</property>
</widget>
</item>
- <item row="0" column="1">
- <widget class="Kst::SVCCTextEdit" name="_label"/>
- </item>
- <item row="1" column="1">
- <widget class="QLabel" name="label">
+ <item row="1" column="2">
+ <widget class="QPushButton" name="_help">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
- <property name="font">
- <font>
- <italic>true</italic>
- </font>
- </property>
<property name="text">
- <string>Supports scalars & strings (name in square brackets) - eg, [INDEX:Max (X2)],
-embedded equations - eg, [=[INDEX:Max] / 2]
-and LaTeX symbols - eg, \theta. Names and symbols are autocompleted.</string>
+ <string>More</string>
</property>
</widget>
</item>
+ <item row="0" column="1" colspan="2">
+ <widget class="Kst::SVCCTextEdit" name="_label"/>
+ </item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11"/>
More information about the Kst
mailing list