[Kst] branches/work/kst/portto4/kst/src
Barth Netterfield
netterfield at astro.utoronto.ca
Thu Apr 12 13:44:19 UTC 2012
SVN commit 1289132 by netterfield:
Three minor fixes and one significant bugfix
-Recent files used from the command line get picked up into the recent
files list
-Make Position/Size label consistent for all view objects
-add the layout menu back into view objects local menu so you can adjust
layout with a full window.
-Fix and off by one error in the ascii data reader - comment lines were
being ascribed to the following lines, leading to NaNs in the data
vectors (and missing data) where comments lived.
M +41 -5 datasources/ascii/asciisource.cpp
M +2 -2 libkst/scalarfactory.cpp
M +1 -0 libkst/updatemanager.cpp
M +1 -1 libkstapp/circleitemdialog.cpp
M +6 -0 libkstapp/commandlineparser.cpp
M +7 -0 libkstapp/document.cpp
M +2 -0 libkstapp/document.h
M +1 -1 libkstapp/labelitemdialog.cpp
M +1 -1 libkstapp/lineitemdialog.cpp
M +1 -1 libkstapp/mainwindow.h
M +6 -6 libkstapp/viewitem.cpp
--- branches/work/kst/portto4/kst/src/datasources/ascii/asciisource.cpp #1289131:1289132
@@ -417,7 +417,45 @@
return (!new_data && !force_update ? NoChange : Updated);
}
+#if 1
+template<typename IsLineBreak, typename CommentDelimiter>
+bool AsciiSource::findDataRows(const char* buffer, int bufstart, int bufread, const IsLineBreak& isLineBreak, const CommentDelimiter& comment_del)
+{
+ const IsWhiteSpace isWhiteSpace;
+ bool new_data = false;
+ bool row_has_data = false;
+ bool is_comment = false;
+ const int row_offset = bufstart + isLineBreak.size;
+ int row_start = bufstart;
+
+ for (int i = 0; i < bufread; i++) {
+ if (comment_del(buffer[i])) {
+ is_comment = true;
+ } else if (isLineBreak(buffer[i])) {
+ if (row_has_data) {
+ _rowIndex[_numFrames] = row_start;
+ ++_numFrames;
+ if (_numFrames >= _rowIndex.size()) {
+ _rowIndex.resize(_rowIndex.size() + MAXBUFREADLEN);
+ }
+ new_data = true;
+ row_start = row_offset+i;
+ } else if (is_comment) {
+ row_start = row_offset+i;
+ }
+ row_has_data = false;
+ is_comment = false;
+ } else if (!row_has_data && !isWhiteSpace(buffer[i]) && !is_comment) {
+ row_has_data = true;
+ }
+ }
+ _rowIndex[_numFrames] = row_start;
+ return new_data;
+}
+#endif
+
+#if 0
template<typename IsLineBreak, typename CommentDelimiter>
bool AsciiSource::findDataRows(const char* buffer, int bufstart, int bufread, const IsLineBreak& isLineBreak, const CommentDelimiter& comment_del)
{
@@ -426,12 +464,11 @@
bool new_data = false;
bool is_data = false;
bool is_comment = false;
-
const int row_offset = bufstart + isLineBreak.size;
-
for (int i = 0; i < bufread; i++) {
if (comment_del(buffer[i])) {
is_comment = true;
+ is_data = false;
} else if (isLineBreak(buffer[i])) {
is_comment = false;
if (is_data) {
@@ -444,13 +481,12 @@
new_data = true;
}
} else if (!is_data && !isWhiteSpace(buffer[i]) && !comment_del(buffer[i])) {
- is_data = is_comment ? false : true;
+ is_data = !is_comment;
}
}
return new_data;
}
-
-
+#endif
//-------------------------------------------------------------------------------------------
int AsciiSource::columnOfField(const QString& field) const
{
--- branches/work/kst/portto4/kst/src/libkst/scalarfactory.cpp #1289131:1289132
@@ -45,8 +45,8 @@
if (n == Scalar::staticTypeTag) {
QXmlStreamAttributes attrs = xml.attributes();
value = attrs.value("value").toString().toDouble();
- orphan = attrs.value("orphan").toString() == "true" ? true : false;
- editable = attrs.value("editable").toString() == "true" ? true : false;
+ orphan = attrs.value("orphan").toString() != "false" ? true : false;
+ editable = attrs.value("editable").toString() != "false" ? true : false;
if (attrs.value("descriptiveNameIsManual").toString() == "true") {
descriptiveName = attrs.value("descriptiveName").toString();
}
--- branches/work/kst/portto4/kst/src/libkst/updatemanager.cpp #1289131:1289132
@@ -125,6 +125,7 @@
i_loop++;
} while ((n_deferred + n_updated > 0) && (i_loop<=maxloop));
+ //qDebug() << " update elapsed:" << i_loop << double(_time.elapsed())/1000.0;
emit objectsUpdated(_serial);
}
}
--- branches/work/kst/portto4/kst/src/libkstapp/circleitemdialog.cpp #1289131:1289132
@@ -28,7 +28,7 @@
_circleDimensionsTab = new CircleDimensionsTab(item, this);
DialogPage *circleDimensionsPage = new DialogPage(this);
- circleDimensionsPage->setPageTitle(tr("Position/Size"));
+ circleDimensionsPage->setPageTitle(tr("Size/Position"));
circleDimensionsPage->addDialogTab(_circleDimensionsTab);
addDialogPage(circleDimensionsPage);
selectDialogPage(circleDimensionsPage);
--- branches/work/kst/portto4/kst/src/libkstapp/commandlineparser.cpp #1289131:1289132
@@ -603,6 +603,9 @@
_paperSize = QPrinter::Letter;
} else { // arg is not an option... must be a file
if (new_fileList) { // if the file list has been used, clear it.
+ if (dataPlotted) {
+ _document->updateRecentDataFiles(_fileNames);
+ }
_fileNames.clear();
new_fileList = false;
}
@@ -649,6 +652,9 @@
}
}
}
+ if (dataPlotted) {
+ _document->updateRecentDataFiles(_fileNames);
+ }
// set defaults to match what has been set.
_dialogDefaults->setValue("print/landscape", _landscape);
--- branches/work/kst/portto4/kst/src/libkstapp/document.cpp #1289131:1289132
@@ -135,6 +135,12 @@
return true;
}
+void Document::updateRecentDataFiles(const QStringList &datafiles) {
+ foreach(const QString &file, datafiles) {
+ _win->updateRecentDataFiles(file);
+ }
+}
+
bool Document::initFromCommandLine(CommandLineParser *P) {
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
@@ -150,6 +156,7 @@
if (dataPlotted) {
UpdateManager::self()->doUpdates(true);
setChanged(false);
+ _win->updateRecentKstFiles(kstfile);
}
}
}
--- branches/work/kst/portto4/kst/src/libkstapp/document.h #1289131:1289132
@@ -50,6 +50,8 @@
View *currentView() const;
+ void updateRecentDataFiles(const QStringList &datafiles);
+
private:
QPointer<MainWindow> _win;
SessionModel *_session;
--- branches/work/kst/portto4/kst/src/libkstapp/labelitemdialog.cpp #1289131:1289132
@@ -41,7 +41,7 @@
_labelDimensionsTab = new LabelDimensionsTab(item, this);
DialogPage *labelDimensionsPage = new DialogPage(this);
- labelDimensionsPage->setPageTitle(tr("Position/Size"));
+ labelDimensionsPage->setPageTitle(tr("Size/Position"));
labelDimensionsPage->addDialogTab(_labelDimensionsTab);
addDialogPage(labelDimensionsPage);
selectDialogPage(labelDimensionsPage);
--- branches/work/kst/portto4/kst/src/libkstapp/lineitemdialog.cpp #1289131:1289132
@@ -27,7 +27,7 @@
_lineDimensionsTab = new LineDimensionsTab(item, this);
DialogPage *lineDimensionsPage = new DialogPage(this);
- lineDimensionsPage->setPageTitle(tr("Position/Size"));
+ lineDimensionsPage->setPageTitle(tr("Size/Position"));
lineDimensionsPage->addDialogTab(_lineDimensionsTab);
addDialogPage(lineDimensionsPage);
selectDialogPage(lineDimensionsPage);
--- branches/work/kst/portto4/kst/src/libkstapp/mainwindow.h #1289131:1289132
@@ -61,6 +61,7 @@
void setStatusMessage(QString message);
static void setWidgetFlags(QWidget*);
+ void updateRecentKstFiles(const QString& newfilename = QString());
public Q_SLOTS:
void showDataManager();
@@ -153,7 +154,6 @@
void openRecentKstFile();
void openRecentDataFile();
- void updateRecentKstFiles(const QString& newfilename = QString());
void checkRecentFilesOnExistence();
protected:
--- branches/work/kst/portto4/kst/src/libkstapp/viewitem.cpp #1289131:1289132
@@ -1169,16 +1169,16 @@
menu.addAction(_editAction);
-// QMenu layoutMenu;
+ QMenu layoutMenu;
if (!(lockParent() || (parentViewItem() && parentViewItem()->lockParent()))) {
menu.addAction(_raiseAction);
menu.addAction(_lowerAction);
-// layoutMenu.setTitle(tr("Cleanup Layout"));
-// layoutMenu.addAction(_autoLayoutAction);
-// layoutMenu.addAction(_protectedLayoutAction);
-// layoutMenu.addAction(_customLayoutAction);
-// menu.addMenu(&layoutMenu);
+ layoutMenu.setTitle(tr("Cleanup Layout"));
+ layoutMenu.addAction(_autoLayoutAction);
+ layoutMenu.addAction(_protectedLayoutAction);
+ layoutMenu.addAction(_customLayoutAction);
+ menu.addMenu(&layoutMenu);
menu.addSeparator();
menu.addAction(_deleteAction);
More information about the Kst
mailing list