Merge pull request #976 from manongjohn/fix_xsheet_wrong_starting_orientation

Fix xsheet/timeline starting with wrong orientation
This commit is contained in:
manongjohn 2022-04-20 07:32:43 -04:00 committed by GitHub
commit 984c91e8b7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 78 additions and 9 deletions

View file

@ -95,39 +95,77 @@
#include <QAction>
//=============================================================================
// XsheetViewer
// XsheetViewerFactory
//-----------------------------------------------------------------------------
class XsheetViewerFactory final : public TPanelFactory {
class XsheetViewerFactory : public TPanelFactory {
public:
XsheetViewerFactory() : TPanelFactory("Xsheet") {}
void initialize(TPanel *panel) override {
panel->setWidget(new XsheetViewer(panel));
TPanel *createPanel(QWidget *parent) override {
XsheetViewerPanel *panel = new XsheetViewerPanel(parent);
panel->setObjectName(getPanelType());
panel->reset();
panel->resize(500, 300);
panel->getTitleBar()->showTitleBar(TApp::instance()->getShowTitleBars());
connect(TApp::instance(), SIGNAL(showTitleBars(bool)), panel->getTitleBar(),
SLOT(showTitleBar(bool)));
return panel;
}
void initialize(TPanel *panel) override {}
} xsheetViewerFactory;
//=============================================================================
// XsheetViewer - Timeline mode
// XsheetViewer
//-----------------------------------------------------------------------------
XsheetViewerPanel::XsheetViewerPanel(QWidget *parent) : TPanel(parent) {
m_xsheetViewer = new XsheetViewer(this);
setWidget(m_xsheetViewer);
}
void XsheetViewerPanel::reset() {
if (!m_xsheetViewer->orientation()->isVerticalTimeline())
m_xsheetViewer->flipOrientation();
}
//=============================================================================
// TimelineViewerFactory
//-----------------------------------------------------------------------------
class TimelineViewerFactory final : public TPanelFactory {
public:
TimelineViewerFactory() : TPanelFactory("Timeline") {}
void initialize(TPanel *panel) override {
panel->setWidget(new XsheetViewer(panel));
XsheetViewer *xsh = (XsheetViewer *)panel->widget();
xsh->flipOrientation();
TPanel *createPanel(QWidget *parent) override {
TimelineViewerPanel *panel = new TimelineViewerPanel(parent);
panel->setObjectName(getPanelType());
panel->reset();
panel->resize(500, 300);
panel->getTitleBar()->showTitleBar(TApp::instance()->getShowTitleBars());
connect(TApp::instance(), SIGNAL(showTitleBars(bool)), panel->getTitleBar(),
SLOT(showTitleBar(bool)));
return panel;
}
void initialize(TPanel *panel) override {}
} timelineViewerFactory;
//=============================================================================
// TimelineViewer
//-----------------------------------------------------------------------------
TimelineViewerPanel::TimelineViewerPanel(QWidget *parent) : TPanel(parent) {
m_timelineViewer = new XsheetViewer(this);
setWidget(m_timelineViewer);
}
void TimelineViewerPanel::reset() {
if (m_timelineViewer->orientation()->isVerticalTimeline())
m_timelineViewer->flipOrientation();
}
//=============================================================================
// SchematicSceneViewer
//-----------------------------------------------------------------------------

View file

@ -32,6 +32,7 @@ class FxSettings;
class VectorGuidedDrawingPane;
class FxSelection;
class StageObjectSelection;
class XsheetViewer;
//=========================================================
// PaletteViewerPanel
@ -338,4 +339,34 @@ public:
VectorGuidedDrawingPanel(QWidget *parent);
};
//=========================================================
// XsheetViewerPanel
//---------------------------------------------------------
class XsheetViewerPanel final : public TPanel {
Q_OBJECT
XsheetViewer *m_xsheetViewer;
public:
XsheetViewerPanel(QWidget *parent = 0);
void reset() override;
};
//=========================================================
// TimelineViewerPanel
//---------------------------------------------------------
class TimelineViewerPanel final : public TPanel {
Q_OBJECT
XsheetViewer *m_timelineViewer;
public:
TimelineViewerPanel(QWidget *parent = 0);
void reset() override;
};
#endif