///////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2019- Equinor ASA // // ResInsight is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or // FITNESS FOR A PARTICULAR PURPOSE. // // See the GNU General Public License at // for more details. // ///////////////////////////////////////////////////////////////////////////////// #pragma once #include "RiuInterfaceToViewWindow.h" #include "RiuMultiPlotPage.h" #include "cafPdmPointer.h" #include "cafSelectionChangedReceiver.h" #include #include #include #include #include #include #include class RiaPlotWindowRedrawScheduler; class RimMultiPlot; class RiuMultiPlotPage; class RiuQwtPlotWidget; class BookFrame; class QFocusEvent; class QLabel; class QPaintDevice; class QScrollArea; class QScrollBar; class QwtPlot; //================================================================================================== // // RiuMultiPlotWindow // //================================================================================================== class RiuMultiPlotBook : public QWidget, public RiuInterfaceToViewWindow { Q_OBJECT public: using ColumnCount = RiuMultiPlotPage::ColumnCount; public: RiuMultiPlotBook( RimMultiPlot* plotDefinition, QWidget* parent = nullptr ); ~RiuMultiPlotBook() override; RimViewWindow* ownerViewWindow() const override; void addPlot( RiuQwtPlotWidget* plotWidget ); void insertPlot( RiuQwtPlotWidget* plotWidget, size_t index ); void removePlot( RiuQwtPlotWidget* plotWidget ); void removeAllPlots(); void setPlotTitle( const QString& plotTitle ); void setTitleVisible( bool visible ); void setSubTitlesVisible( bool visible ); void setTitleFontSizes( int titleFontSize, int subTitleFontSize ); void setLegendFontSize( int legendFontSize ); void setAxisFontSizes( int axisTitleFontSize, int axisValueFontSize ); int indexOfPlotWidget( RiuQwtPlotWidget* plotWidget ); bool pagePreviewModeEnabled() const; void setPagePreviewModeEnabled( bool previewMode ); void scheduleUpdate(); void scheduleReplotOfAllPlots(); void renderTo( QPaintDevice* painter ); protected: void contextMenuEvent( QContextMenuEvent* ) override; void showEvent( QShowEvent* event ) override; void resizeEvent( QResizeEvent* event ) override; void applyPagePreviewBookSize( int frameWidth ); void applyBookSize( int frameWidth, int frameHeight ); std::pair rowAndColumnCount( int plotWidgetCount ) const; virtual bool showYAxis( int row, int column ) const; QList> visiblePlotWidgets() const; private: void deleteAllPages(); void createPages(); const QList>& pages() const; RiuMultiPlotPage* createPage(); void applyLook(); private slots: virtual void performUpdate(); protected: friend class RiaPlotWindowRedrawScheduler; QPointer m_layout; QPointer m_scrollArea; QPointer m_book; QPointer m_bookLayout; QList> m_pages; QList> m_plotWidgets; caf::PdmPointer m_plotDefinition; QString m_plotTitle; bool m_titleVisible; bool m_subTitlesVisible; bool m_previewMode; };