diff --git a/GUI/coregui/Views/IntensityDataWidgets/ProjectionCanvas.cpp b/GUI/coregui/Views/IntensityDataWidgets/ProjectionsPlot.cpp similarity index 93% rename from GUI/coregui/Views/IntensityDataWidgets/ProjectionCanvas.cpp rename to GUI/coregui/Views/IntensityDataWidgets/ProjectionsPlot.cpp index bd556b96460c02eb842253d8cd83c9c321a5e76e..5aa64f0755d0d3c00de5cc05be70917458b04a28 100644 --- a/GUI/coregui/Views/IntensityDataWidgets/ProjectionCanvas.cpp +++ b/GUI/coregui/Views/IntensityDataWidgets/ProjectionsPlot.cpp @@ -14,12 +14,12 @@ // // ************************************************************************** // -#include "ProjectionCanvas.h" +#include "ProjectionsPlot.h" #include "qcustomplot.h" #include "plot_constants.h" #include "ProjectionItems.h" -ProjectionCanvas::ProjectionCanvas(QWidget* parent) +ProjectionsPlot::ProjectionsPlot(QWidget* parent) : SessionItemWidget(parent) , m_customPlot(new QCustomPlot) { @@ -50,7 +50,7 @@ ProjectionCanvas::ProjectionCanvas(QWidget* parent) // m_customPlot->yAxis->setLabelFont(QFont(QFont().family(), Constants::plot_axes_label_size)); } -void ProjectionCanvas::setItem(SessionItem* projectionContainerItem) +void ProjectionsPlot::setItem(SessionItem* projectionContainerItem) { Q_ASSERT(projectionContainerItem); SessionItemWidget::setItem(projectionContainerItem); diff --git a/GUI/coregui/Views/IntensityDataWidgets/ProjectionCanvas.h b/GUI/coregui/Views/IntensityDataWidgets/ProjectionsPlot.h similarity index 79% rename from GUI/coregui/Views/IntensityDataWidgets/ProjectionCanvas.h rename to GUI/coregui/Views/IntensityDataWidgets/ProjectionsPlot.h index bd5dc7a574ff5502f45b4350c49af161044024a6..ce222734361d9551c3f5e2ed8ab26551deca8597 100644 --- a/GUI/coregui/Views/IntensityDataWidgets/ProjectionCanvas.h +++ b/GUI/coregui/Views/IntensityDataWidgets/ProjectionsPlot.h @@ -2,8 +2,8 @@ // // BornAgain: simulate and fit scattering at grazing incidence // -//! @file GUI/coregui/Views/IntensityDataWidgets/ProjectionCanvas.h -//! @brief Defines class ProjectionCanvas +//! @file GUI/coregui/Views/IntensityDataWidgets/ProjectionsPlot.h +//! @brief Defines class ProjectionsPlot //! //! @homepage http://www.bornagainproject.org //! @license GNU General Public License v3 or higher (see COPYING) @@ -14,8 +14,8 @@ // // ************************************************************************** // -#ifndef PROJECTIONCANVAS_H -#define PROJECTIONCANVAS_H +#ifndef PROJECTIONSPLOT_H +#define PROJECTIONSPLOT_H #include "SessionItemWidget.h" @@ -23,12 +23,12 @@ class QCustomPlot; //! A customplot based widget to display projections of IntensityDataItem on X,Y axes. -class BA_CORE_API_ ProjectionCanvas : public SessionItemWidget +class BA_CORE_API_ ProjectionsPlot : public SessionItemWidget { Q_OBJECT public: - ProjectionCanvas(QWidget* parent = 0); + ProjectionsPlot(QWidget* parent = 0); void setItem(SessionItem* projectionContainerItem); @@ -36,4 +36,4 @@ private: QCustomPlot* m_customPlot; }; -#endif // PROJECTIONCANVAS_H +#endif // PROJECTIONSPLOT_H diff --git a/GUI/coregui/Views/JobWidgets/JobProjectionsWidget.cpp b/GUI/coregui/Views/JobWidgets/JobProjectionsWidget.cpp index 443e6643d7bd7b5663288070634da7ed71afef0c..0f0e1e6e06c99aee609d3a041cc10d8d5127a4eb 100644 --- a/GUI/coregui/Views/JobWidgets/JobProjectionsWidget.cpp +++ b/GUI/coregui/Views/JobWidgets/JobProjectionsWidget.cpp @@ -15,40 +15,42 @@ // ************************************************************************** // #include "JobProjectionsWidget.h" -#include "IntensityDataCanvas.h" -#include "ProjectionCanvas.h" +//#include "IntensityDataCanvas.h" +//#include "ProjectionsPlot.h" #include "IntensityDataItem.h" #include "ProjectionItems.h" #include "SessionModel.h" #include "JobItem.h" -#include <QSplitter> +#include "ProjectionsEditor.h" +//#include <QSplitter> #include <QVBoxLayout> -#include <QTabWidget> +//#include <QTabWidget> JobProjectionsWidget::JobProjectionsWidget(QWidget* parent) : SessionItemWidget(parent) - , m_intensityCanvas(new IntensityDataCanvas) - , m_xProjection(new ProjectionCanvas) - , m_yProjection(new ProjectionCanvas) - , m_tabWidget(new QTabWidget) - , m_splitter(new QSplitter) + , m_projectionsEditor(new ProjectionsEditor) +// , m_intensityCanvas(new IntensityDataCanvas) +// , m_xProjection(new ProjectionsPlot) +// , m_yProjection(new ProjectionsPlot) +// , m_tabWidget(new QTabWidget) +// , m_splitter(new QSplitter) { - m_splitter->setOrientation(Qt::Vertical); - m_splitter->addWidget(m_intensityCanvas); +// m_splitter->setOrientation(Qt::Vertical); +// m_splitter->addWidget(m_intensityCanvas); - m_tabWidget->setTabPosition(QTabWidget::North); - m_tabWidget->insertTab(HORIZONTAL, m_xProjection, "Horizontal"); - m_tabWidget->insertTab(VERTICAL, m_yProjection, "Vertical"); +// m_tabWidget->setTabPosition(QTabWidget::North); +// m_tabWidget->insertTab(HORIZONTAL, m_xProjection, "Horizontal"); +// m_tabWidget->insertTab(VERTICAL, m_yProjection, "Vertical"); - // m_splitter->addWidget(m_projectionCanvas); - m_splitter->addWidget(m_tabWidget); - m_splitter->setStyleSheet("background-color:white;"); +// // m_splitter->addWidget(m_projectionCanvas); +// m_splitter->addWidget(m_tabWidget); +// m_splitter->setStyleSheet("background-color:white;"); QVBoxLayout *vlayout = new QVBoxLayout(this); vlayout->setMargin(0); vlayout->setSpacing(0); - vlayout->addWidget(m_splitter); + vlayout->addWidget(m_projectionsEditor); setLayout(vlayout); } @@ -57,11 +59,13 @@ void JobProjectionsWidget::setItem(SessionItem* jobItem) { SessionItemWidget::setItem(jobItem); - m_intensityCanvas->setItem(intensityDataItem()); +// m_intensityCanvas->setItem(intensityDataItem()); auto projectionContainer = createProjectionContainer(intensityDataItem()); - m_xProjection->setItem(projectionContainer); - m_yProjection->setItem(projectionContainer); +// m_xProjection->setItem(projectionContainer); +// m_yProjection->setItem(projectionContainer); + + m_projectionsEditor->setContext(intensityDataItem()->model(), projectionContainer->index(), intensityDataItem()); } IntensityDataItem* JobProjectionsWidget::intensityDataItem() diff --git a/GUI/coregui/Views/JobWidgets/JobProjectionsWidget.h b/GUI/coregui/Views/JobWidgets/JobProjectionsWidget.h index 206f80a18fa9e4d088345bdb7f5a150b5de3e8a0..01ae4d753239a167ae488b5724c17588f2532de4 100644 --- a/GUI/coregui/Views/JobWidgets/JobProjectionsWidget.h +++ b/GUI/coregui/Views/JobWidgets/JobProjectionsWidget.h @@ -19,14 +19,15 @@ #include "SessionItemWidget.h" -class IntensityDataCanvas; -class ProjectionCanvas; -class QSplitter; +//class IntensityDataCanvas; +//class ProjectionsPlot; +//class QSplitter; +class ProjectionsEditor; class IntensityDataItem; class ProjectionContainerItem; -class QTabWidget; +//class QTabWidget; -namespace Manhattan { class MiniSplitter; } +//namespace Manhattan { class MiniSplitter; } //! A common widget to display color map (IntensityDataCanvas) and properties //! (IntensityDataPropertyWidget) of intensity data item. @@ -46,11 +47,12 @@ private: IntensityDataItem* intensityDataItem(); ProjectionContainerItem* createProjectionContainer(IntensityDataItem* intensityItem); - IntensityDataCanvas* m_intensityCanvas; - ProjectionCanvas* m_xProjection; - ProjectionCanvas* m_yProjection; - QTabWidget* m_tabWidget; - QSplitter* m_splitter; + ProjectionsEditor* m_projectionsEditor; +// IntensityDataCanvas* m_intensityCanvas; +// ProjectionsPlot* m_xProjection; +// ProjectionsPlot* m_yProjection; +// QTabWidget* m_tabWidget; +// QSplitter* m_splitter; }; #endif // JOBPROJECTIONSWIDGET_H diff --git a/GUI/coregui/Views/JobWidgets/ProjectionsEditor.cpp b/GUI/coregui/Views/JobWidgets/ProjectionsEditor.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ecf9e740f652c529afb8bbd0a69b120048552f9a --- /dev/null +++ b/GUI/coregui/Views/JobWidgets/ProjectionsEditor.cpp @@ -0,0 +1,59 @@ +// ************************************************************************** // +// +// BornAgain: simulate and fit scattering at grazing incidence +// +//! @file GUI/coregui/Views/JobWidgets/ProjectionsEditor.cpp +//! @brief Implements class ProjectionsEditor +//! +//! @homepage http://www.bornagainproject.org +//! @license GNU General Public License v3 or higher (see COPYING) +//! @copyright Forschungszentrum Jülich GmbH 2016 +//! @authors Scientific Computing Group at MLZ Garching +//! @authors Céline Durniak, Marina Ganeva, David Li, Gennady Pospelov +//! @authors Walter Van Herck, Joachim Wuttke +// +// ************************************************************************** // + +#include "ProjectionsEditor.h" +#include "ProjectionsEditorActions.h" +#include "ProjectionsToolBar.h" +#include "ProjectionsWidget.h" +#include "ProjectionsPropertyPanel.h" +#include "ProjectionsEditorCanvas.h" +#include "minisplitter.h" +#include "SessionModel.h" +#include "IntensityDataItem.h" +#include <QSplitter> +#include <QVBoxLayout> +#include <QHBoxLayout> + +ProjectionsEditor::ProjectionsEditor(QWidget* parent) + : QMainWindow(parent) + , m_editorActions(new ProjectionsEditorActions(this)) + , m_toolBar(new ProjectionsToolBar(m_editorActions)) + , m_projectionsCanvas(new ProjectionsEditorCanvas) + , m_projectionsWidget(new ProjectionsWidget) + , m_propertyPanel(new ProjectionsPropertyPanel) + , m_rightSplitter(new Manhattan::MiniSplitter) + , m_bottomSplitter(new QSplitter) +{ + addToolBar(Qt::RightToolBarArea, m_toolBar); + + m_bottomSplitter->setOrientation(Qt::Vertical); + m_bottomSplitter->addWidget(m_projectionsCanvas); + m_bottomSplitter->addWidget(m_projectionsWidget); + m_bottomSplitter->setStyleSheet("background-color:white;"); + + m_rightSplitter->addWidget(m_bottomSplitter); + m_rightSplitter->addWidget(m_propertyPanel); + + setCentralWidget(m_rightSplitter); +} + +void ProjectionsEditor::setContext(SessionModel* model, const QModelIndex& shapeContainerIndex, + IntensityDataItem* intensityItem) +{ + Q_UNUSED(model); + Q_UNUSED(shapeContainerIndex); + m_propertyPanel->setItem(intensityItem); +} diff --git a/GUI/coregui/Views/JobWidgets/ProjectionsEditor.h b/GUI/coregui/Views/JobWidgets/ProjectionsEditor.h new file mode 100644 index 0000000000000000000000000000000000000000..c1d922540993c51e09b5c804e296ada2d96ec82b --- /dev/null +++ b/GUI/coregui/Views/JobWidgets/ProjectionsEditor.h @@ -0,0 +1,57 @@ +// ************************************************************************** // +// +// BornAgain: simulate and fit scattering at grazing incidence +// +//! @file GUI/coregui/Views/JobWidgets/ProjectionsEditor.h +//! @brief Defines class ProjectionsEditor +//! +//! @homepage http://www.bornagainproject.org +//! @license GNU General Public License v3 or higher (see COPYING) +//! @copyright Forschungszentrum Jülich GmbH 2016 +//! @authors Scientific Computing Group at MLZ Garching +//! @authors Céline Durniak, Marina Ganeva, David Li, Gennady Pospelov +//! @authors Walter Van Herck, Joachim Wuttke +// +// ************************************************************************** // + +#ifndef PROJECTIONSEDITOR_H +#define PROJECTIONSEDITOR_H + +#include "WinDllMacros.h" +#include <QMainWindow> + +class SessionModel; +class QModelIndex; +class IntensityDataItem; +class ProjectionsToolBar; +class ProjectionsEditorActions; +class ProjectionsActions; +class ProjectionsEditorCanvas; +class ProjectionsPropertyPanel; +class ProjectionsWidget; +class QSplitter; +namespace Manhattan { class MiniSplitter; } + +//! Editor to draw projections on top of intensity plot. Part of + +class BA_CORE_API_ ProjectionsEditor : public QMainWindow +{ + Q_OBJECT + +public: + ProjectionsEditor(QWidget* parent = 0); + + void setContext(SessionModel* model, const QModelIndex& shapeContainerIndex, + IntensityDataItem* intensityItem); + +private: + ProjectionsEditorActions* m_editorActions; + ProjectionsToolBar* m_toolBar; //! main tool bar with bottoms at the right + ProjectionsEditorCanvas* m_projectionsCanvas; //! canvas with color map at the top + ProjectionsWidget* m_projectionsWidget; //! bottom widget to draw projections plot + ProjectionsPropertyPanel* m_propertyPanel; //! pannel at the right with properties + Manhattan::MiniSplitter* m_rightSplitter; + QSplitter* m_bottomSplitter; +}; + +#endif // PROJECTIONSEDITOR_H diff --git a/GUI/coregui/Views/JobWidgets/ProjectionsEditorActions.cpp b/GUI/coregui/Views/JobWidgets/ProjectionsEditorActions.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ea804c5e69842680768165d81635529bcf5f6f33 --- /dev/null +++ b/GUI/coregui/Views/JobWidgets/ProjectionsEditorActions.cpp @@ -0,0 +1,42 @@ +// ************************************************************************** // +// +// BornAgain: simulate and fit scattering at grazing incidence +// +//! @file GUI/coregui/Views/JobWidgets/ProjectionsEditorActions.cpp +//! @brief Implements class ProjectionsEditorActions +//! +//! @homepage http://www.bornagainproject.org +//! @license GNU General Public License v3 or higher (see COPYING) +//! @copyright Forschungszentrum Jülich GmbH 2016 +//! @authors Scientific Computing Group at MLZ Garching +//! @authors Céline Durniak, Marina Ganeva, David Li, Gennady Pospelov +//! @authors Walter Van Herck, Joachim Wuttke +// +// ************************************************************************** // + +#include "ProjectionsEditorActions.h" +#include <QAction> + +ProjectionsEditorActions::ProjectionsEditorActions(QWidget* parent) + : QObject(parent) + , m_resetViewAction(new QAction(this)) + , m_togglePanelAction(new QAction(this)) +{ + // Actions for top toolbar + m_resetViewAction = new QAction(this); + m_resetViewAction->setText("Reset"); + m_resetViewAction->setIcon(QIcon(":/images/toolbar16light_refresh.svg")); + m_resetViewAction->setToolTip("Reset View"); + connect(m_resetViewAction, SIGNAL(triggered()), this, SIGNAL(resetViewRequest())); + + m_togglePanelAction = new QAction(this); + m_togglePanelAction->setText("Properties"); + m_togglePanelAction->setIcon(QIcon(":/images/toolbar16light_propertypanel.svg")); + m_togglePanelAction->setToolTip("Toggle Property Panel"); + connect(m_togglePanelAction, SIGNAL(triggered()), this, SIGNAL(propertyPanelRequest())); +} + +QList<QAction*> ProjectionsEditorActions::topToolBarActions() +{ + return QList<QAction*>() << m_resetViewAction << m_togglePanelAction; +} diff --git a/GUI/coregui/Views/JobWidgets/ProjectionsEditorActions.h b/GUI/coregui/Views/JobWidgets/ProjectionsEditorActions.h new file mode 100644 index 0000000000000000000000000000000000000000..df364460b976d5153ae6060a6fd99adc3ceba8c6 --- /dev/null +++ b/GUI/coregui/Views/JobWidgets/ProjectionsEditorActions.h @@ -0,0 +1,46 @@ +// ************************************************************************** // +// +// BornAgain: simulate and fit scattering at grazing incidence +// +//! @file GUI/coregui/Views/JobWidgets/ProjectionsEditorActions.h +//! @brief Defines class ProjectionsEditorActions +//! +//! @homepage http://www.bornagainproject.org +//! @license GNU General Public License v3 or higher (see COPYING) +//! @copyright Forschungszentrum Jülich GmbH 2016 +//! @authors Scientific Computing Group at MLZ Garching +//! @authors Céline Durniak, Marina Ganeva, David Li, Gennady Pospelov +//! @authors Walter Van Herck, Joachim Wuttke +// +// ************************************************************************** // + +#ifndef PROJECTIONSEDITORACTIONS_H +#define PROJECTIONSEDITORACTIONS_H + +#include "WinDllMacros.h" +#include <QObject> +#include <QList> + +class QAction; + +//! Provides various actions for ProjectionsEditor. + +class BA_CORE_API_ ProjectionsEditorActions : public QObject +{ + Q_OBJECT + +public: + ProjectionsEditorActions(QWidget* parent = 0); + + QList<QAction *> topToolBarActions(); + +signals: + void resetViewRequest(); + void propertyPanelRequest(); + +private: + QAction* m_resetViewAction; + QAction* m_togglePanelAction; +}; + +#endif // PROJECTIONSEDITORACTIONS_H diff --git a/GUI/coregui/Views/JobWidgets/ProjectionsEditorCanvas.cpp b/GUI/coregui/Views/JobWidgets/ProjectionsEditorCanvas.cpp new file mode 100644 index 0000000000000000000000000000000000000000..dd3d6e45b7e175daeb8ed76b518c1d5621a269ed --- /dev/null +++ b/GUI/coregui/Views/JobWidgets/ProjectionsEditorCanvas.cpp @@ -0,0 +1,23 @@ +// ************************************************************************** // +// +// BornAgain: simulate and fit scattering at grazing incidence +// +//! @file GUI/coregui/Views/JobWidgets/ProjectionsEditorCanvas.cpp +//! @brief Implements class ProjectionsEditorCanvas +//! +//! @homepage http://www.bornagainproject.org +//! @license GNU General Public License v3 or higher (see COPYING) +//! @copyright Forschungszentrum Jülich GmbH 2016 +//! @authors Scientific Computing Group at MLZ Garching +//! @authors Céline Durniak, Marina Ganeva, David Li, Gennady Pospelov +//! @authors Walter Van Herck, Joachim Wuttke +// +// ************************************************************************** // + +#include "ProjectionsEditorCanvas.h" + +ProjectionsEditorCanvas::ProjectionsEditorCanvas(QWidget* parent) + : QWidget(parent) +{ + +} diff --git a/GUI/coregui/Views/JobWidgets/ProjectionsEditorCanvas.h b/GUI/coregui/Views/JobWidgets/ProjectionsEditorCanvas.h new file mode 100644 index 0000000000000000000000000000000000000000..d4c77893fbaadd04e441a2a4808e4f3d8c347112 --- /dev/null +++ b/GUI/coregui/Views/JobWidgets/ProjectionsEditorCanvas.h @@ -0,0 +1,36 @@ +// ************************************************************************** // +// +// BornAgain: simulate and fit scattering at grazing incidence +// +//! @file GUI/coregui/Views/JobWidgets/ProjectionsEditorCanvas.h +//! @brief Defines class ProjectionsEditorCanvas +//! +//! @homepage http://www.bornagainproject.org +//! @license GNU General Public License v3 or higher (see COPYING) +//! @copyright Forschungszentrum Jülich GmbH 2016 +//! @authors Scientific Computing Group at MLZ Garching +//! @authors Céline Durniak, Marina Ganeva, David Li, Gennady Pospelov +//! @authors Walter Van Herck, Joachim Wuttke +// +// ************************************************************************** // + +#ifndef PROJECTIONSEDITORCANVAS_H +#define PROJECTIONSEDITORCANVAS_H + +#include "WinDllMacros.h" +#include <QWidget> + +//! Holds a graphics scene to draw projections on top of ColorMap. Being a part +//! of ProjectionEditor, provides interaction logic between graphics scene and ProjectionsWidget. + +class ProjectionsEditorCanvas : public QWidget +{ + Q_OBJECT + +public: + ProjectionsEditorCanvas(QWidget *parent = 0); + +}; + + +#endif // PROJECTIONSEDITORCANVAS_H diff --git a/GUI/coregui/Views/JobWidgets/ProjectionsPropertyPanel.cpp b/GUI/coregui/Views/JobWidgets/ProjectionsPropertyPanel.cpp new file mode 100644 index 0000000000000000000000000000000000000000..abaad4e33bdbb8e6e282a6eaef236a6885e0e95c --- /dev/null +++ b/GUI/coregui/Views/JobWidgets/ProjectionsPropertyPanel.cpp @@ -0,0 +1,54 @@ +// ************************************************************************** // +// +// BornAgain: simulate and fit scattering at grazing incidence +// +//! @file GUI/coregui/Views/JobWidgets/ProjectionsPropertyPanel.cpp +//! @brief Implements class ProjectionsPropertyPanel +//! +//! @homepage http://www.bornagainproject.org +//! @license GNU General Public License v3 or higher (see COPYING) +//! @copyright Forschungszentrum Jülich GmbH 2016 +//! @authors Scientific Computing Group at MLZ Garching +//! @authors Céline Durniak, Marina Ganeva, David Li, Gennady Pospelov +//! @authors Walter Van Herck, Joachim Wuttke +// +// ************************************************************************** // + +#include "ProjectionsPropertyPanel.h" +#include "ComponentEditor.h" +#include <QVBoxLayout> + +ProjectionsPropertyPanel::ProjectionsPropertyPanel(QWidget* parent) + : SessionItemWidget(parent) + , m_componentEditor(new ComponentEditor) +{ + setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding); + + QVBoxLayout *mainLayout = new QVBoxLayout; + mainLayout->setMargin(0); + mainLayout->setSpacing(0); + + m_componentEditor = new ComponentEditor(); + mainLayout->addWidget(m_componentEditor); + setLayout(mainLayout); +} + +QSize ProjectionsPropertyPanel::sizeHint() const +{ + return QSize(230, 256); +} + +QSize ProjectionsPropertyPanel::minimumSizeHint() const +{ + return QSize(230, 64); +} + +void ProjectionsPropertyPanel::subscribeToItem() +{ + m_componentEditor->setItem(currentItem()); +} + +void ProjectionsPropertyPanel::unsubscribeFromItem() +{ + m_componentEditor->setItem(nullptr); +} diff --git a/GUI/coregui/Views/JobWidgets/ProjectionsPropertyPanel.h b/GUI/coregui/Views/JobWidgets/ProjectionsPropertyPanel.h new file mode 100644 index 0000000000000000000000000000000000000000..a3ab71e4fa1090e9ac627bce65d947f109624d8f --- /dev/null +++ b/GUI/coregui/Views/JobWidgets/ProjectionsPropertyPanel.h @@ -0,0 +1,42 @@ +// ************************************************************************** // +// +// BornAgain: simulate and fit scattering at grazing incidence +// +//! @file GUI/coregui/Views/JobWidgets/ProjectionsPropertyPanel.h +//! @brief Defines class ProjectionsPropertyPanel +//! +//! @homepage http://www.bornagainproject.org +//! @license GNU General Public License v3 or higher (see COPYING) +//! @copyright Forschungszentrum Jülich GmbH 2016 +//! @authors Scientific Computing Group at MLZ Garching +//! @authors Céline Durniak, Marina Ganeva, David Li, Gennady Pospelov +//! @authors Walter Van Herck, Joachim Wuttke +// +// ************************************************************************** // + +#ifndef PROJECTIONSPROPERTYPANEL_H +#define PROJECTIONSPROPERTYPANEL_H + +#include "SessionItemWidget.h" + +class ComponentEditor; + +class BA_CORE_API_ ProjectionsPropertyPanel : public SessionItemWidget +{ + Q_OBJECT + +public: + ProjectionsPropertyPanel(QWidget* parent = 0); + + QSize sizeHint() const; + QSize minimumSizeHint() const; + +protected: + virtual void subscribeToItem(); + virtual void unsubscribeFromItem(); + +private: + ComponentEditor* m_componentEditor; +}; + +#endif // PROJECTIONSPROPERTYPANEL_H diff --git a/GUI/coregui/Views/JobWidgets/ProjectionsToolBar.cpp b/GUI/coregui/Views/JobWidgets/ProjectionsToolBar.cpp new file mode 100644 index 0000000000000000000000000000000000000000..1b074cd36ce6268529067635fd8d4e8fbed3d167 --- /dev/null +++ b/GUI/coregui/Views/JobWidgets/ProjectionsToolBar.cpp @@ -0,0 +1,27 @@ +// ************************************************************************** // +// +// BornAgain: simulate and fit scattering at grazing incidence +// +//! @file GUI/coregui/Views/JobWidgets/ProjectionsToolBar.cpp +//! @brief Implements class ProjectionsToolBar +//! +//! @homepage http://www.bornagainproject.org +//! @license GNU General Public License v3 or higher (see COPYING) +//! @copyright Forschungszentrum Jülich GmbH 2016 +//! @authors Scientific Computing Group at MLZ Garching +//! @authors Céline Durniak, Marina Ganeva, David Li, Gennady Pospelov +//! @authors Walter Van Herck, Joachim Wuttke +// +// ************************************************************************** // + +#include "ProjectionsToolBar.h" +#include "mainwindow_constants.h" + +ProjectionsToolBar::ProjectionsToolBar(ProjectionsEditorActions* editorActions, QWidget* parent) + : QToolBar(parent) + , m_editorActions(editorActions) +{ + setIconSize(QSize(Constants::toolbar_icon_size, Constants::toolbar_icon_size)); + setProperty("_q_custom_style_disabled", QVariant(true)); + +} diff --git a/GUI/coregui/Views/JobWidgets/ProjectionsToolBar.h b/GUI/coregui/Views/JobWidgets/ProjectionsToolBar.h new file mode 100644 index 0000000000000000000000000000000000000000..7ccc47f762242c644eb397c128fc0de0efbfcabd --- /dev/null +++ b/GUI/coregui/Views/JobWidgets/ProjectionsToolBar.h @@ -0,0 +1,40 @@ +// ************************************************************************** // +// +// BornAgain: simulate and fit scattering at grazing incidence +// +//! @file GUI/coregui/Views/JobWidgets/ProjectionsToolBar.h +//! @brief Defines class ProjectionsToolBar +//! +//! @homepage http://www.bornagainproject.org +//! @license GNU General Public License v3 or higher (see COPYING) +//! @copyright Forschungszentrum Jülich GmbH 2016 +//! @authors Scientific Computing Group at MLZ Garching +//! @authors Céline Durniak, Marina Ganeva, David Li, Gennady Pospelov +//! @authors Walter Van Herck, Joachim Wuttke +// +// ************************************************************************** // + +#ifndef PROJECTIONSTOOLBAR_H +#define PROJECTIONSTOOLBAR_H + +#include "WinDllMacros.h" +#include <QToolBar> + +class ProjectionsEditorActions; + +//! Toolbar with projections buttons (horizontal projections, vertical projections, select, zoom) +//! located at the right-hand side of ProjectionsEditor (part of JobProjectionsWidget). + +class ProjectionsToolBar : public QToolBar +{ + Q_OBJECT + +public: + ProjectionsToolBar(ProjectionsEditorActions* editorActions, QWidget* parent = 0); + +private: + ProjectionsEditorActions* m_editorActions; +}; + + +#endif // PROJECTIONSTOOLBAR_H diff --git a/GUI/coregui/Views/JobWidgets/ProjectionsWidget.cpp b/GUI/coregui/Views/JobWidgets/ProjectionsWidget.cpp new file mode 100644 index 0000000000000000000000000000000000000000..1ecd5ff62b14409980f3e69918a45a175fefee81 --- /dev/null +++ b/GUI/coregui/Views/JobWidgets/ProjectionsWidget.cpp @@ -0,0 +1,38 @@ +// ************************************************************************** // +// +// BornAgain: simulate and fit scattering at grazing incidence +// +//! @file GUI/coregui/Views/JobWidgets/ProjectionsWidget.cpp +//! @brief Implements class ProjectionsWidget +//! +//! @homepage http://www.bornagainproject.org +//! @license GNU General Public License v3 or higher (see COPYING) +//! @copyright Forschungszentrum Jülich GmbH 2016 +//! @authors Scientific Computing Group at MLZ Garching +//! @authors Céline Durniak, Marina Ganeva, David Li, Gennady Pospelov +//! @authors Walter Van Herck, Joachim Wuttke +// +// ************************************************************************** // + +#include "ProjectionsWidget.h" +#include "ProjectionsPlot.h" +#include <QTabWidget> +#include <QVBoxLayout> + +ProjectionsWidget::ProjectionsWidget(QWidget* parent) + : QWidget(parent) + , m_xProjection(new ProjectionsPlot) + , m_yProjection(new ProjectionsPlot) + , m_tabWidget(new QTabWidget) +{ + QVBoxLayout *layout = new QVBoxLayout; + layout->setMargin(0); + layout->setSpacing(0); + + m_tabWidget->setTabPosition(QTabWidget::North); + m_tabWidget->insertTab(HORIZONTAL, m_xProjection, "Horizontal"); + m_tabWidget->insertTab(VERTICAL, m_yProjection, "Vertical"); + + layout->addWidget(m_tabWidget); + setLayout(layout); +} diff --git a/GUI/coregui/Views/JobWidgets/ProjectionsWidget.h b/GUI/coregui/Views/JobWidgets/ProjectionsWidget.h new file mode 100644 index 0000000000000000000000000000000000000000..9c26f7cea28afea7caf4cdf263ab992964c06832 --- /dev/null +++ b/GUI/coregui/Views/JobWidgets/ProjectionsWidget.h @@ -0,0 +1,43 @@ +// ************************************************************************** // +// +// BornAgain: simulate and fit scattering at grazing incidence +// +//! @file GUI/coregui/Views/JobWidgets/ProjectionsWidget.h +//! @brief Defines class ProjectionsWidget +//! +//! @homepage http://www.bornagainproject.org +//! @license GNU General Public License v3 or higher (see COPYING) +//! @copyright Forschungszentrum Jülich GmbH 2016 +//! @authors Scientific Computing Group at MLZ Garching +//! @authors Céline Durniak, Marina Ganeva, David Li, Gennady Pospelov +//! @authors Walter Van Herck, Joachim Wuttke +// +// ************************************************************************** // + +#ifndef PROJECTIONSWIDGET_H +#define PROJECTIONSWIDGET_H + +#include "WinDllMacros.h" +#include <QMainWindow> + +class ProjectionsPlot; +class QTabWidget; + +//! Holds tabs of vertical and horizontal projections, located at the bottom of ProjectionsWidget. + +class BA_CORE_API_ ProjectionsWidget : public QWidget +{ + Q_OBJECT + +public: + enum ETabId {HORIZONTAL, VERTICAL}; + + ProjectionsWidget(QWidget* parent = 0); + +private: + ProjectionsPlot* m_xProjection; + ProjectionsPlot* m_yProjection; + QTabWidget* m_tabWidget; +}; + +#endif // PROJECTIONSWIDGET_H diff --git a/GUI/coregui/Views/MaskWidgets/MaskEditorToolBar.cpp b/GUI/coregui/Views/MaskWidgets/MaskEditorToolBar.cpp index f53ef40b92f96e0b76375c3bff787ba852566522..fd554d6c0fb837ff3cb839defc4d33399b1b605d 100644 --- a/GUI/coregui/Views/MaskWidgets/MaskEditorToolBar.cpp +++ b/GUI/coregui/Views/MaskWidgets/MaskEditorToolBar.cpp @@ -22,10 +22,7 @@ #include <QStyle> #include <QToolButton> #include <QVariant> - -namespace { -const int toolbar_icon_size = 32; -} +#include "mainwindow_constants.h" MaskEditorToolBar::MaskEditorToolBar(MaskEditorActions *editorActions, QWidget *parent) : QToolBar(parent) @@ -33,7 +30,7 @@ MaskEditorToolBar::MaskEditorToolBar(MaskEditorActions *editorActions, QWidget * , m_activityButtonGroup(new QButtonGroup(this)) , m_maskValueGroup(new QButtonGroup(this)) { - setIconSize(QSize(toolbar_icon_size, toolbar_icon_size)); + setIconSize(QSize(Constants::toolbar_icon_size, Constants::toolbar_icon_size)); setProperty("_q_custom_style_disabled", QVariant(true)); setup_selection_group(); diff --git a/GUI/coregui/mainwindow/mainwindow.cpp b/GUI/coregui/mainwindow/mainwindow.cpp index 97852221c5056261affee0ebc45813d2abf5d8f9..6506ac96e4568022fd4bd2f9d5d008b4a16c19f5 100644 --- a/GUI/coregui/mainwindow/mainwindow.cpp +++ b/GUI/coregui/mainwindow/mainwindow.cpp @@ -64,8 +64,8 @@ MainWindow::MainWindow(QWidget *parent) initViews(); initConnections(); -// m_applicationModels->createTestSample(); -// m_applicationModels->createTestJob(); + m_applicationModels->createTestSample(); + m_applicationModels->createTestJob(); // m_applicationModels->createTestRealData(); } diff --git a/GUI/coregui/mainwindow/mainwindow_constants.h b/GUI/coregui/mainwindow/mainwindow_constants.h index d2a8c37935f06641fae1c2a948c0644fb9c4e46a..66576aef877f552772d5b1e6075b40f0f4421c4f 100644 --- a/GUI/coregui/mainwindow/mainwindow_constants.h +++ b/GUI/coregui/mainwindow/mainwindow_constants.h @@ -78,8 +78,11 @@ const QString JobFittingActivityName = "Fitting Activity"; // const QString IntensityDataWidgetName = "Color Map"; const QString JobProjectionsWidgetName = "Projections"; + const QString FitComparisonWidgetName = "Fit Data"; +const int toolbar_icon_size = 32; + } #endif // MAINWINDOW_CONSTANTS_H