Skip to content

Commit

Permalink
Merge 7043e76 into e8234f4
Browse files Browse the repository at this point in the history
  • Loading branch information
agarny committed Aug 23, 2018
2 parents e8234f4 + 7043e76 commit 8ce2947
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 20 deletions.
20 changes: 15 additions & 5 deletions src/plugins/miscellaneous/Core/src/coreplugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,11 @@ void CorePlugin::fileOpened(const QString &pFileName)

FileManager *fileManagerInstance = FileManager::instance();

mRecentFiles.removeOne(fileManagerInstance->isRemote(pFileName)?
fileManagerInstance->url(pFileName):
pFileName);
if (mRecentFiles.removeOne(fileManagerInstance->isRemote(pFileName)?
fileManagerInstance->url(pFileName):
pFileName)) {
updateFileReopenMenu();
}
}

//==============================================================================
Expand Down Expand Up @@ -191,7 +193,8 @@ void CorePlugin::fileRenamed(const QString &pOldFileName,
// done in that case (thus avoiding us from having to test for its
// presence)...

mRecentFiles.removeOne(pNewFileName);
if (mRecentFiles.removeOne(pNewFileName))
updateFileReopenMenu();

// A file has been created or saved under a new name, so we want the old
// file name to be added to our list of recent files, i.e. as if it had been
Expand Down Expand Up @@ -219,6 +222,8 @@ void CorePlugin::fileClosed(const QString &pFileName)

while (mRecentFiles.count() > 10)
mRecentFiles.removeLast();

updateFileReopenMenu();
}
}

Expand Down Expand Up @@ -620,6 +625,8 @@ void CorePlugin::loadSettings(QSettings *pSettings)

mRecentFiles = pSettings->value(SettingsRecentFiles).toStringList();

updateFileReopenMenu();

// Retrieve the central widget settings

pSettings->beginGroup(mCentralWidget->objectName());
Expand Down Expand Up @@ -770,7 +777,8 @@ void CorePlugin::reopenFile(const QString &pFileName)
{
// Remove the file from our list of recent files

mRecentFiles.removeOne(pFileName);
if (mRecentFiles.removeOne(pFileName))
updateFileReopenMenu();

// Open the recent file after checking that it still exists, if needed

Expand Down Expand Up @@ -820,6 +828,8 @@ void CorePlugin::clearReopenSubMenu()
// Indirectly clear our Reopen sub-menu

mRecentFiles.clear();

updateFileReopenMenu();
}

//==============================================================================
Expand Down
33 changes: 18 additions & 15 deletions src/plugins/widget/GraphPanelWidget/src/graphpanelplotwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1470,14 +1470,17 @@ GraphPanelPlotWidget::GraphPanelPlotWidget(const GraphPanelPlotWidgets &pNeighbo
plotCanvas->setFrameShape(QFrame::NoFrame);
plotCanvas->setPaintAttribute(QwtPlotCanvas::ImmediatePaint);

// Add some axes to ourselves
// Add some axes to ourselves and prevent them from auto-scaling

mAxisX = new GraphPanelPlotScaleDraw();
mAxisY = new GraphPanelPlotScaleDraw();

setAxisScaleDraw(QwtPlot::xBottom, mAxisX);
setAxisScaleDraw(QwtPlot::yLeft, mAxisY);

setAxisAutoScale(QwtPlot::xBottom, false);
setAxisAutoScale(QwtPlot::yLeft, false);

// Attach a grid to ourselves

mGrid = new QwtPlotGrid();
Expand Down Expand Up @@ -1677,10 +1680,10 @@ void GraphPanelPlotWidget::updateActions()
double crtRangeY = crtMaxY-crtMinY;

mCanZoomInX = crtRangeX > MinAxisRange;
mCanZoomOutX = crtRangeX < (logAxisX()?MaxLogAxisRange:MaxAxisRange);
mCanZoomOutX = crtRangeX < (mLogAxisX?MaxLogAxisRange:MaxAxisRange);

mCanZoomInY = crtRangeY > MinAxisRange;
mCanZoomOutY = crtRangeY < (logAxisY()?MaxLogAxisRange:MaxAxisRange);
mCanZoomOutY = crtRangeY < (mLogAxisY?MaxLogAxisRange:MaxAxisRange);

// Update the enabled status of our actions

Expand Down Expand Up @@ -2549,29 +2552,29 @@ bool GraphPanelPlotWidget::dataLogRect(QRectF &pDataLogRect) const

QRectF GraphPanelPlotWidget::realDataRect() const
{
// Return an optimised version of dataRect() or a default rectangle, if no
// dataRect() exists
// Return an optimised version of dataRect()/dataLogRect() or a default
// rectangle, if no dataRect()/dataLogRect() exists

QRectF dRect = QRectF();
QRectF dLogRect = QRectF();

if (dataRect(dRect) && dataLogRect(dLogRect)) {
// Optimise our axes' values

double minX = logAxisX()?dLogRect.left():dRect.left();
double maxX = minX+(logAxisX()?dLogRect.width():dRect.width());
double minY = logAxisY()?dLogRect.top():dRect.top();
double maxY = minY+(logAxisY()?dLogRect.height():dRect.height());
double minX = mLogAxisX?dLogRect.left():dRect.left();
double maxX = minX+(mLogAxisX?dLogRect.width():dRect.width());
double minY = mLogAxisY?dLogRect.top():dRect.top();
double maxY = minY+(mLogAxisY?dLogRect.height():dRect.height());

optimiseAxis(minX, maxX);
optimiseAxis(minY, maxY);

return QRectF(minX, minY, maxX-minX, maxY-minY);
} else {
double minX = logAxisX()?mDefaultMinLogX:mDefaultMinX;
double maxX = logAxisX()?mDefaultMaxLogX:mDefaultMaxX;
double minY = logAxisY()?mDefaultMinLogY:mDefaultMinY;
double maxY = logAxisY()?mDefaultMaxLogY:mDefaultMaxY;
double minX = mLogAxisX?mDefaultMinLogX:mDefaultMinX;
double maxX = mLogAxisX?mDefaultMaxLogX:mDefaultMaxX;
double minY = mLogAxisY?mDefaultMinLogY:mDefaultMinY;
double maxY = mLogAxisY?mDefaultMaxLogY:mDefaultMaxY;

return QRectF(minX, minY, maxX-minX, maxY-minY);
}
Expand Down Expand Up @@ -2636,8 +2639,8 @@ bool GraphPanelPlotWidget::setAxes(double pMinX, double pMaxX, double pMinY,

// Make sure that the given axes' values are fine

checkAxisValues(logAxisX(), pMinX, pMaxX);
checkAxisValues(logAxisY(), pMinY, pMaxY);
checkAxisValues(mLogAxisX, pMinX, pMaxX);
checkAxisValues(mLogAxisY, pMinY, pMaxY);

// Update our axes' values, if needed

Expand Down

0 comments on commit 8ce2947

Please sign in to comment.