Skip to content

Commit

Permalink
Merge af6e68d into c1e2f98
Browse files Browse the repository at this point in the history
  • Loading branch information
agarny committed Oct 1, 2019
2 parents c1e2f98 + af6e68d commit fb36948
Show file tree
Hide file tree
Showing 5 changed files with 110 additions and 73 deletions.
1 change: 1 addition & 0 deletions doc/downloads/index.js
Expand Up @@ -37,6 +37,7 @@ var jsonData = { "versions": [
}
],
"changes": [
{ "change": "<strong>Simulation Experiment view:</strong> properly handle the Graph Panel properties (see issue <a href=\"https://github.com/opencor/opencor/issues/2171\">#2171</a>)." },
{ "change": "<strong>Third-party libraries:</strong> upgraded the <a href=\"https://www.openssl.org/\">OpenSSL</a> library to version 1.1.1d (see issue <a href=\"https://github.com/opencor/opencor/issues/2157\">#2157</a>). Upgraded <a href=\"http://www.llvm.org/\">LLVM</a>+<a href=\"http://clang.llvm.org/\">Clang</a> to version 9.0.0 (see issue <a href=\"https://github.com/opencor/opencor/issues/2161\">#2161</a>)." }
]
},
Expand Down
1 change: 1 addition & 0 deletions doc/whatIsNew.js
Expand Up @@ -45,6 +45,7 @@ var jsonData = { "versions": [
{ "type": "added", "description": "Basic support for the import of external data." },
{ "type": "improved", "description": "Rendering of the <a href=\"https://en.wikipedia.org/wiki/Graphical_user_interface\">GUI</a>." },
{ "type": "improved", "description": "Plotting of simulations." },
{ "type": "fixed", "description": "Issue with handling the Graph Panel properties." },
{ "type": "fixed", "description": "Various issues with saving a file under a new name." },
{ "type": "fixed", "description": "Issue with a <a href=\"https://sed-ml.github.io/\">SED-ML</a> file / <a href=\"https://co.mbine.org/documents/archive\">COMBINE archive</a> being considered modified after changing languages." }
]
Expand Down
Expand Up @@ -1463,77 +1463,88 @@ void SimulationExperimentViewInformationGraphPanelAndGraphsWidget::graphPanelPro
Core::PropertyEditorWidget *propertyEditor = pProperty->owner();
GraphPanelWidget::GraphPanelPlotWidget *graphPanelPlot = mGraphPanels.value(propertyEditor)->plot();
Core::Properties properties = propertyEditor->properties();
Core::Properties gridLinesProperties = properties[3]->properties();
Core::Properties pointCoordinatesProperties = properties[5]->properties();
Core::Properties surroundingAreaProperties = properties[6]->properties();
Core::Properties xAxisProperties = properties[8]->properties();
Core::Properties yAxisProperties = properties[9]->properties();
Core::Properties zoomRegionProperties = properties[10]->properties();

// Graph panel

if (pProperty == properties[0]) {
graphPanelPlot->setBackgroundColor(pProperty->colorValue());
} else if (pProperty == properties[1]) {
graphPanelPlot->setFontSize(pProperty->integerValue());
} else if (pProperty == properties[2]) {
graphPanelPlot->setForegroundColor(pProperty->colorValue());

processEvents();
// Note: this ensures that our GUI is all fine before we start disabling
// updates...

graphPanelPlot->setUpdatesEnabled(false);
// Graph panel

graphPanelPlot->setBackgroundColor(properties[0]->colorValue());
graphPanelPlot->setFontSize(properties[1]->integerValue());
graphPanelPlot->setForegroundColor(properties[2]->colorValue());

// Grid lines

Core::Properties gridLinesProperties = properties[3]->properties();

graphPanelPlot->setGridLinesStyle(SEDMLSupport::lineStyle(gridLinesProperties[0]->listValueIndex()));
graphPanelPlot->setGridLinesWidth(gridLinesProperties[1]->integerValue());
graphPanelPlot->setGridLinesColor(gridLinesProperties[2]->colorValue());

// Legend

graphPanelPlot->setLegendActive(properties[4]->booleanValue());

// Point coordinates

Core::Properties pointCoordinatesProperties = properties[5]->properties();

graphPanelPlot->setPointCoordinatesStyle(SEDMLSupport::lineStyle(pointCoordinatesProperties[0]->listValueIndex()));
graphPanelPlot->setPointCoordinatesWidth(pointCoordinatesProperties[1]->integerValue());
graphPanelPlot->setPointCoordinatesColor(pointCoordinatesProperties[2]->colorValue());
graphPanelPlot->setPointCoordinatesFontColor(pointCoordinatesProperties[3]->colorValue());
// Grid lines

// Surrounding area
} else if (pProperty == gridLinesProperties[0]) {
graphPanelPlot->setGridLinesStyle(SEDMLSupport::lineStyle(pProperty->listValueIndex()));
} else if (pProperty == gridLinesProperties[1]) {
graphPanelPlot->setGridLinesWidth(pProperty->integerValue());
} else if (pProperty == gridLinesProperties[2]) {
graphPanelPlot->setGridLinesColor(pProperty->colorValue());

Core::Properties surroundingAreaProperties = properties[6]->properties();
// Legend

graphPanelPlot->setSurroundingAreaBackgroundColor(surroundingAreaProperties[0]->colorValue());
graphPanelPlot->setSurroundingAreaForegroundColor(surroundingAreaProperties[1]->colorValue());
} else if (pProperty == properties[4]) {
graphPanelPlot->setLegendActive(pProperty->booleanValue());

// Title
// Point coordinates

graphPanelPlot->setTitle(properties[7]->value());
} else if (pProperty == pointCoordinatesProperties[0]) {
graphPanelPlot->setPointCoordinatesStyle(SEDMLSupport::lineStyle(pProperty->listValueIndex()));
} else if (pProperty == pointCoordinatesProperties[1]) {
graphPanelPlot->setPointCoordinatesWidth(pProperty->integerValue());
} else if (pProperty == pointCoordinatesProperties[2]) {
graphPanelPlot->setPointCoordinatesColor(pProperty->colorValue());
} else if (pProperty == pointCoordinatesProperties[3]) {
graphPanelPlot->setPointCoordinatesFontColor(pProperty->colorValue());

// X axis
// Surrounding area

Core::Properties xAxisProperties = properties[8]->properties();
} else if (pProperty == surroundingAreaProperties[0]) {
graphPanelPlot->setSurroundingAreaBackgroundColor(pProperty->colorValue());
} else if (pProperty == surroundingAreaProperties[1]) {
graphPanelPlot->setSurroundingAreaForegroundColor(pProperty->colorValue());

graphPanelPlot->setLogAxisX(xAxisProperties[0]->booleanValue());
graphPanelPlot->setTitleAxisX(xAxisProperties[1]->value());
// Title

// Y axis
} else if (pProperty == properties[7]) {
graphPanelPlot->setTitle(pProperty->value());

Core::Properties yAxisProperties = properties[9]->properties();
// X axis

graphPanelPlot->setLogAxisY(yAxisProperties[0]->booleanValue());
graphPanelPlot->setTitleAxisY(yAxisProperties[1]->value());
} else if (pProperty == xAxisProperties[0]) {
graphPanelPlot->setLogAxisX(pProperty->booleanValue());
} else if (pProperty == xAxisProperties[1]) {
graphPanelPlot->setTitleAxisX(pProperty->value());

// Zoom region
// Y axis

Core::Properties zoomRegionProperties = properties[10]->properties();
} else if (pProperty == yAxisProperties[0]) {
graphPanelPlot->setLogAxisY(pProperty->booleanValue());
} else if (pProperty == yAxisProperties[1]) {
graphPanelPlot->setTitleAxisY(pProperty->value());

graphPanelPlot->setZoomRegionStyle(SEDMLSupport::lineStyle(zoomRegionProperties[0]->listValueIndex()));
graphPanelPlot->setZoomRegionWidth(zoomRegionProperties[1]->integerValue());
graphPanelPlot->setZoomRegionColor(zoomRegionProperties[2]->colorValue());
graphPanelPlot->setZoomRegionFontColor(zoomRegionProperties[3]->colorValue());
graphPanelPlot->setZoomRegionFilled(zoomRegionProperties[4]->booleanValue());
graphPanelPlot->setZoomRegionFillColor(zoomRegionProperties[5]->colorValue());
// Zoom region

graphPanelPlot->updateGui(false, true);
graphPanelPlot->setUpdatesEnabled(true);
} else if (pProperty == zoomRegionProperties[0]) {
graphPanelPlot->setZoomRegionStyle(SEDMLSupport::lineStyle(pProperty->listValueIndex()));
} else if (pProperty == zoomRegionProperties[1]) {
graphPanelPlot->setZoomRegionWidth(pProperty->integerValue());
} else if (pProperty == zoomRegionProperties[2]) {
graphPanelPlot->setZoomRegionColor(pProperty->colorValue());
} else if (pProperty == zoomRegionProperties[3]) {
graphPanelPlot->setZoomRegionFontColor(pProperty->colorValue());
} else if (pProperty == zoomRegionProperties[4]) {
graphPanelPlot->setZoomRegionFilled(pProperty->booleanValue());
} else if (pProperty == zoomRegionProperties[5]) {
graphPanelPlot->setZoomRegionFillColor(pProperty->colorValue());
}
}

//==============================================================================
Expand Down
Expand Up @@ -1852,6 +1852,7 @@ bool SimulationExperimentViewSimulationWidget::createSedmlFile(SEDMLSupport::Sed
int graphPlotCounter;
bool logAxisX;
bool logAxisY;
char padding[2];
};

SimulationExperimentViewInformationGraphPanelAndGraphsWidget *graphPanelAndGraphsWidget = mContentsWidget->informationWidget()->graphPanelAndGraphsWidget();
Expand Down Expand Up @@ -1960,7 +1961,7 @@ bool SimulationExperimentViewSimulationWidget::createSedmlFile(SEDMLSupport::Sed
+SedmlProperty.arg(SEDMLSupport::Filled)
.arg(zoomRegionProperties[4]->stringValue())
+SedmlProperty.arg(SEDMLSupport::FillColor)
.arg(zoomRegionProperties[5]->stringValue()));;
.arg(zoomRegionProperties[5]->stringValue()));

// Add our properties as an annotation

Expand Down
57 changes: 40 additions & 17 deletions src/plugins/widget/GraphPanelWidget/src/graphpanelplotwidget.cpp
Expand Up @@ -2114,6 +2114,11 @@ void GraphPanelPlotWidget::setFontSize(int pFontSize, bool pForceSetting)

setAxisFont(QwtPlot::yLeft, newFont);
setTitleAxisY(titleAxisY());

// Our new font size may have some effects on the alignment with our
// neighbours, so update ourselves

updateGui(false, true);
}
}

Expand Down Expand Up @@ -2239,6 +2244,11 @@ void GraphPanelPlotWidget::setLegendActive(bool pLegendActive)
if (pLegendActive != isLegendActive()) {
mLegend->setActive(pLegendActive);
mLegendAction->setChecked(pLegendActive);

// To show/hide our legend may have some effects on the alignment with
// our neighbours, so update ourselves

updateGui(false, true);
}
}

Expand Down Expand Up @@ -2523,7 +2533,16 @@ void GraphPanelPlotWidget::setTitleAxisY(const QString &pTitleAxisY)
{
// Set the title for our Y axis

QwtText oldAxisTitle = axisTitle(QwtPlot::yLeft);

setTitleAxis(QwtPlot::yLeft, pTitleAxisY);

// To change the title of our Y axis may have some effects on the alignment
// with our neighbours, so update ourselves

if (axisTitle(QwtPlot::yLeft) != oldAxisTitle) {
updateGui(false, true);
}
}

//==============================================================================
Expand Down Expand Up @@ -3211,18 +3230,16 @@ void GraphPanelPlotWidget::setTitleAxis(int pAxisId, const QString &pTitleAxis)
{
// Set the title for our axis

if (pTitleAxis.isEmpty()) {
setAxisTitle(pAxisId, QString());
} else {
QwtText axisTitle = QwtText(pTitleAxis);
QFont axisTitleFont = axisTitle.font();
QwtText newAxisTitle = QwtText(pTitleAxis);
QFont newAxisTitleFont = newAxisTitle.font();

axisTitleFont.setPointSizeF(1.25*fontSize());
newAxisTitleFont.setPointSizeF(1.25*fontSize());

axisTitle.setColor(mSurroundingAreaForegroundColor);
axisTitle.setFont(axisTitleFont);
newAxisTitle.setColor(mSurroundingAreaForegroundColor);
newAxisTitle.setFont(newAxisTitleFont);

setAxisTitle(pAxisId, axisTitle);
if (newAxisTitle != axisTitle(pAxisId)) {
setAxisTitle(pAxisId, newAxisTitle);
}
}

Expand All @@ -3238,26 +3255,32 @@ void GraphPanelPlotWidget::doUpdateGui(bool pForceAlignment)
for (auto plot : selfPlusNeighbors) {
auto legend = static_cast<GraphPanelPlotLegendWidget *>(plot->legend());

legendWidth = qMax(legendWidth, legend->QwtLegend::sizeHint().width());
if (legend != nullptr) {
legendWidth = qMax(legendWidth, legend->QwtLegend::sizeHint().width());

if (legend->needScrollBar()) {
legendWidth = qMax(legendWidth,
legend->QwtLegend::sizeHint().width()+legend->scrollExtent(Qt::Vertical));
if (legend->needScrollBar()) {
legendWidth = qMax(legendWidth,
legend->QwtLegend::sizeHint().width()+legend->scrollExtent(Qt::Vertical));
}
}
}

for (auto plot : selfPlusNeighbors) {
auto legend = static_cast<GraphPanelPlotLegendWidget *>(plot->legend());

legend->setSizeHintWidth(legend->needScrollBar()?
legendWidth-legend->scrollExtent(Qt::Vertical):
legendWidth);
if (legend != nullptr) {
legend->setSizeHintWidth(legend->needScrollBar()?
legendWidth-legend->scrollExtent(Qt::Vertical):
legendWidth);
}
}

// Reenable updates for our legend
// Note: see addGraph() for the reasoning behind it...

legend()->setUpdatesEnabled(true);
if (legend() != nullptr) {
legend()->setUpdatesEnabled(true);
}

// Make sure that we are still properly aligned with our neighbours

Expand Down

0 comments on commit fb36948

Please sign in to comment.