void SingleCellViewGraphPanelPlotWidget::setLocalAxis(const int &pAxis,
                                                      const double &pMin,
                                                      const double &pMax)
{
    // Set our local axes
    // Note #1: to use setAxisScale() on its own is not sufficient unless we
    //          were to replot ourselves immediately after, but we don't want to
    //          do that, so instead we also use setAxisScaleDiv() to make sure
    //          that our local axes are indeed taken into account (i.e. we can
    //          retrieve them using localMinX(), localMaxX(), localMinY() and
    //          localMaxY()). Also, we must call setAxisScaleDiv() before
    //          setAxisScale() to make sure that the axis data is not considered
    //          as valid which is important when it comes to plotting
    //          ourselves...
    // Note #2: the way QwtPlot create ticks for an axis means that it cannot
    //          handle an axis that would go from -DBL_MAX to DBL_MAX, even
    //          though it would be a valid axis, so we check that the axis fits
    //          within what we know works fine with QwtPlot...

    static const double DBL_MAX_AXIS = 0.3*DBL_MAX;

    setAxisScaleDiv(pAxis, QwtScaleDiv(qMax(-DBL_MAX_AXIS, pMin),
                                       qMin( DBL_MAX_AXIS, pMax)));
    setAxisScale(pAxis, qMax(-DBL_MAX_AXIS, pMin),
                        qMin( DBL_MAX_AXIS, pMax));

    // Make sure that our zoom factors are up-to-date

    updateZoomFactors();
}
void TMGraphView::zoomToOverview()
{
    view_address = 0;
    view_time = 0;

    updateZoomFactors();

    emit positionChange(displayAddressToRealAddress(view_address), view_time);
    update();
}
void SingleCellViewGraphPanelPlotWidget::setMinMaxY(const double &pMinY,
                                                    const double &pMaxY)
{
    // Set our minimum/maximum Y values

    mMinY = pMinY;
    mMaxY = pMaxY;

    // Make sure that our zoom factors are up-to-date

    updateZoomFactors();
}
void TMGraphView::onWindowResize()
{
    // Special behaviour if overview: fit to new window size
    if (view_address == 0 && view_time == 0)
    {
        updateZoomFactors();
    }
    // Otherwise, repaint at the same zoom level, thus showing more stuff if you increase window size, less stuff if you decrease it

    emit positionChange(displayAddressToRealAddress(view_address), view_time);
    update();
}
// Enable or disable those menu items which are only available for
// a part of visualization types
void XmdvToolMainWnd::updateMenuToolbar(int pID, XmdvTool::VISTYPE visType) {
	// Enable or disable menu and tool bar items in terms of the current pipeline type.
	XmdvTool::PLTYPE plType = m_pipelineManager->getPipeline(pID)->getPipelineType();

	// enable the tool bar and menu buttons
	action_Pal->setEnabled(true);
	action_Scatter->setEnabled(true);
	action_Glyph->setEnabled(true);
	action_Stacking->setEnabled(true);
	action_Pixel->setEnabled(true);
	action_HierPal->setEnabled(true);
	action_HierScatter->setEnabled(true);
	action_HierGlyph->setEnabled(true);
	action_HierStacking->setEnabled(true);
	action_HierPixel->setEnabled(true);

	action_ColorCustom->setEnabled(true);
	action_ColorStrategy->setEnabled(true);

	switch (plType) {
	case XmdvTool::PLTYPE_FLATNORMAL :
		// Disable structure-based brush
		action_SBB->setEnabled(false);
		// Allow to turn on dimension reduction
		action_DimReductModeOn->setEnabled(true);
		action_DimReductModeOff->setEnabled(false);
		action_DimReductDlg->setEnabled(false);
		// Enable the dimension on/off/reordering
	    action_DimManual->setEnabled(true);
	    action_DimAuto->setEnabled(true);
		break;
	case XmdvTool::PLTYPE_DIMR :
		// Disable structure-based brush
		action_SBB->setEnabled(false);
		action_DimReductModeOn->setEnabled(false);
		action_DimReductModeOff->setEnabled(true);
		action_DimReductDlg->setEnabled(true);
		// Disable the dimension on/off/reordering
	    action_DimManual->setEnabled(false);
	    action_DimAuto->setEnabled(false);
		break;
	case XmdvTool::PLTYPE_SBB :
		// Enable structure-based brush
		action_SBB->setEnabled(true);
		// Disable dimension reduction mode
		action_DimReductModeOn->setEnabled(false);
		action_DimReductModeOff->setEnabled(false);
		action_DimReductDlg->setEnabled(false);
		// Enable the dimension on/off/reordering
	    action_DimManual->setEnabled(true);
	    action_DimAuto->setEnabled(true);
		break;
	}

	action_ScatterplotCustom->setEnabled(false);
	action_DimstackCustomization->setEnabled(false);
	action_PixelCustomization->setEnabled(false);
	action_GlyphCustom->setEnabled(false);

	switch (visType) {
	case XmdvTool::VISTYPE_PA : //= 0, Parallel coordinates
		if (plType==XmdvTool::PLTYPE_FLATNORMAL ||
				plType==XmdvTool::PLTYPE_DIMR ) {
			action_Pal->setChecked(true);
		} else {
			action_HierPal->setChecked(true);
		}
		break;
	case XmdvTool::VISTYPE_SC : //= 1, Scatterplot matrices
		if (plType==XmdvTool::PLTYPE_FLATNORMAL ||
				plType==XmdvTool::PLTYPE_DIMR ) {
			action_Scatter->setChecked(true);
		} else {
			action_HierScatter->setChecked(true);
		}
		action_ScatterplotCustom->setEnabled(true);
		break;
	case XmdvTool::VISTYPE_GL : //= 2, Glyphs
		if (plType==XmdvTool::PLTYPE_FLATNORMAL ||
				plType==XmdvTool::PLTYPE_DIMR ) {
			action_Glyph->setChecked(true);
		} else {
			action_HierGlyph->setChecked(true);
		}
		action_GlyphCustom->setEnabled(true);
		break;
	case XmdvTool::VISTYPE_DI : //= 3, Dimension Stacking
		if (plType==XmdvTool::PLTYPE_FLATNORMAL ||
				plType==XmdvTool::PLTYPE_DIMR ) {
			action_Stacking->setChecked(true);
		} else {
			action_HierStacking->setChecked(true);
		}
		action_DimstackCustomization->setEnabled(true);;
		break;
	case XmdvTool::VISTYPE_PI : //= 4, Pixel-oriented display
		if (plType==XmdvTool::PLTYPE_FLATNORMAL ||
				plType==XmdvTool::PLTYPE_DIMR ) {
			action_Pixel->setChecked(true);
		} else {
			action_HierPixel->setChecked(true);
		}
		if ( plType==XmdvTool::PLTYPE_FLATNORMAL ) {
			action_PixelCustomization->setEnabled(true);
		} else {
			action_PixelCustomization->setEnabled(false);
		}
		break;
	};

	updateZoomFactors();
}