[Kst] branches/work/kst/portto4/kst/src/libkstapp
Barth Netterfield
netterfield at astro.utoronto.ca
Tue Oct 2 20:40:14 UTC 2012
SVN commit 1318898 by netterfield:
Toggling tied zoom, tied between tabs used to vote if you were tieing
per tab, rather than globally. This fixes it, so all tabs end up in the
same tie state.
M +3 -0 mainwindow.cpp
M +24 -6 plotitemmanager.cpp
M +2 -1 plotitemmanager.h
--- branches/work/kst/portto4/kst/src/libkstapp/mainwindow.cpp #1318897:1318898
@@ -181,10 +181,13 @@
void MainWindow::toggleTiedZoom() {
if (isTiedTabs()) {
+ PlotItemManager::self()->toggleAllTiedZoom(0);
+ /*
QList<View*> views = tabWidget()->views();
foreach (View* view, views) {
PlotItemManager::self()->toggleAllTiedZoom(view);
}
+ */
} else {
PlotItemManager::self()->toggleAllTiedZoom(tabWidget()->currentView());
}
--- branches/work/kst/portto4/kst/src/libkstapp/plotitemmanager.cpp #1318897:1318898
@@ -78,8 +78,14 @@
// vote on if we should tie all, or untie all
int n_plots=0, n_tied=0;
- QList<ViewItem *> tieableItems = tieableItemsForView(view);
- foreach(ViewItem* viewItem, tieableItems) {
+ QList<ViewItem *> tieable_items;
+ if (view) {
+ tieable_items = tieableItemsForView(view);
+ } else {
+ tieable_items = tieableItems();
+ }
+
+ foreach(ViewItem* viewItem, tieable_items) {
if (viewItem->supportsTiedZoom()) {
++n_plots;
if (viewItem->isTiedZoom()) {
@@ -94,7 +100,7 @@
tiedZoom = true;
}
- foreach(ViewItem* viewItem, tieableItems) {
+ foreach(ViewItem* viewItem, tieable_items) {
if (viewItem->supportsTiedZoom()) {
viewItem->setTiedZoom(tiedZoom, tiedZoom, false);
}
@@ -155,6 +161,17 @@
return plot_items;
}
+QList<ViewItem*> PlotItemManager::tieableItems() {
+ QList<ViewItem*> allViewItems = ViewItem::getItems<ViewItem>();
+ QList<ViewItem*> view_items;
+ foreach (ViewItem *item, allViewItems) {
+ if (item && item->isVisible() && item->supportsTiedZoom()) {
+ view_items.append(item);
+ }
+ }
+ return view_items;
+}
+
QList<ViewItem*> PlotItemManager::tieableItemsForView(View *view) {
QList<QGraphicsItem*> graphics_items = view->scene()->items();
QList<ViewItem *> view_items;
@@ -207,7 +224,6 @@
void PlotItemManager::setFocusPlot(PlotItem *plotItem) {
- _focusedPlots.append(plotItem);
QList<PlotItem*> plots = plotsForView(plotItem->view());
foreach (PlotItem* plot, plots) {
if (plotItem != plot) {
@@ -245,7 +261,6 @@
void PlotItemManager::removeFocusPlot(PlotItem *plotItem) {
- _focusedPlots.removeAll(plotItem);
QList<PlotItem*> plots = plotsForView(plotItem->view());
foreach (PlotItem* plot, plots) {
if (plotItem != plot) {
@@ -256,10 +271,13 @@
void PlotItemManager::clearFocusedPlots() {
- foreach (PlotItem* plotItem, _focusedPlots) {
+ QList<PlotItem*> plotItems = ViewItem::getItems<PlotItem>();
+ foreach (PlotItem* plotItem, plotItems) {
+ if (plotItem->isMaximized()) {
plotItem->plotMaximize();
}
}
+}
}
--- branches/work/kst/portto4/kst/src/libkstapp/plotitemmanager.h #1318897:1318898
@@ -34,6 +34,8 @@
static QList<PlotItem*> plotsForView(View *view);
static QList<ViewItem*> tieableItemsForView(View *view);
+ static QList<ViewItem*> tieableItems();
+
static void clearPlotsForView(View *view);
static QList<PlotItem*> tiedZoomPlotsForView(View *view);
@@ -73,7 +75,6 @@
QHash< View*, QList<PlotItem*> > _tiedZoomViewPlotLists;
QHash< View*, QList<ViewItem*> > _tiedZoomViewItemLists;
QHash< ViewItem*, QList<PlotItem*> > _tiedZoomViewItemPlotLists;
- QList<PlotItem*> _focusedPlots;
};
}
More information about the Kst
mailing list