Qt TAS Editor bookmarks/branches view in work.
This commit is contained in:
parent
9cea7f1551
commit
b59ad1bf3b
|
@ -270,7 +270,7 @@ void applyMovieInputConfig(void)
|
|||
}
|
||||
//----------------------------------------------------------------------------
|
||||
TasEditorWindow::TasEditorWindow(QWidget *parent)
|
||||
: QDialog( parent, Qt::Window )
|
||||
: QDialog( parent, Qt::Window ), bookmarks(this), branches(this)
|
||||
{
|
||||
QSettings settings;
|
||||
QVBoxLayout *mainLayout;
|
||||
|
@ -1054,8 +1054,10 @@ void TasEditorWindow::buildSideControlPanel(void)
|
|||
recorderGBox = new QGroupBox( tr("Recorder") );
|
||||
splicerGBox = new QGroupBox( tr("Splicer") );
|
||||
luaGBox = new QGroupBox( tr("Lua") );
|
||||
bookmarksGBox = new QGroupBox( tr("BookMarks/Branches") );
|
||||
historyGBox = new QGroupBox( tr("History") );
|
||||
bbFrame = new QFrame();
|
||||
|
||||
bbFrame->setFrameShape( QFrame::StyledPanel );
|
||||
|
||||
rewindMkrBtn = new QPushButton();
|
||||
rewindFrmBtn = new QPushButton();
|
||||
|
@ -1090,7 +1092,6 @@ void TasEditorWindow::buildSideControlPanel(void)
|
|||
runLuaBtn->setEnabled(false);
|
||||
autoLuaCBox->setChecked(true);
|
||||
|
||||
bkbrTree = new QTreeWidget();
|
||||
histTree = new QTreeWidget();
|
||||
|
||||
histTree->setColumnCount(1);
|
||||
|
@ -1151,9 +1152,13 @@ void TasEditorWindow::buildSideControlPanel(void)
|
|||
hbox->addWidget( autoLuaCBox );
|
||||
luaGBox->setLayout( hbox );
|
||||
|
||||
bkmkBrnchStack = new QTabWidget();
|
||||
bkmkBrnchStack->addTab( &bookmarks, tr("Bookmarks") );
|
||||
bkmkBrnchStack->addTab( &branches , tr("Branches") );
|
||||
|
||||
vbox = new QVBoxLayout();
|
||||
vbox->addWidget( bkbrTree );
|
||||
bookmarksGBox->setLayout( vbox );
|
||||
vbox->addWidget( bkmkBrnchStack );
|
||||
bbFrame->setLayout( vbox );
|
||||
|
||||
vbox = new QVBoxLayout();
|
||||
vbox->addWidget( histTree );
|
||||
|
@ -1163,7 +1168,7 @@ void TasEditorWindow::buildSideControlPanel(void)
|
|||
ctlPanelMainVbox->addWidget( recorderGBox );
|
||||
ctlPanelMainVbox->addWidget( splicerGBox );
|
||||
ctlPanelMainVbox->addWidget( luaGBox );
|
||||
ctlPanelMainVbox->addWidget( bookmarksGBox );
|
||||
ctlPanelMainVbox->addWidget( bbFrame );
|
||||
ctlPanelMainVbox->addWidget( historyGBox );
|
||||
|
||||
hbox = new QHBoxLayout();
|
||||
|
|
|
@ -31,6 +31,8 @@
|
|||
#include <QFont>
|
||||
#include <QPainter>
|
||||
#include <QShortcut>
|
||||
#include <QTabWidget>
|
||||
#include <QStackedWidget>
|
||||
#include <QClipboard>
|
||||
|
||||
#include "Qt/TasEditor/taseditor_config.h"
|
||||
|
@ -221,14 +223,15 @@ class TasEditorWindow : public QDialog
|
|||
QLabel *lowerMarkerLabel;
|
||||
QLineEdit *upperMarkerNote;
|
||||
QLineEdit *lowerMarkerNote;
|
||||
QTabWidget *bkmkBrnchStack;
|
||||
|
||||
QVBoxLayout *ctlPanelMainVbox;
|
||||
QGroupBox *playbackGBox;
|
||||
QGroupBox *recorderGBox;
|
||||
QGroupBox *splicerGBox;
|
||||
QGroupBox *luaGBox;
|
||||
QGroupBox *bookmarksGBox;
|
||||
QGroupBox *historyGBox;
|
||||
QFrame *bbFrame;
|
||||
|
||||
QPushButton *rewindMkrBtn;
|
||||
QPushButton *rewindFrmBtn;
|
||||
|
@ -254,7 +257,6 @@ class TasEditorWindow : public QDialog
|
|||
QPushButton *runLuaBtn;
|
||||
QCheckBox *autoLuaCBox;
|
||||
|
||||
QTreeWidget *bkbrTree;
|
||||
QTreeWidget *histTree;
|
||||
|
||||
QPushButton *prevMkrBtn;
|
||||
|
|
|
@ -56,7 +56,8 @@ char bookmarksCaption[3][23] = { " Bookmarks ", " Bookmarks / Branches ", " Bran
|
|||
// // deploy
|
||||
// 0x43171d, 0x541d21, 0x652325, 0x762929, 0x872f2c, 0x983530, 0xa93b34, 0xba4137, 0xcb463b, 0xdc4c3f, 0xed5243, 0xff5947 };
|
||||
|
||||
BOOKMARKS::BOOKMARKS()
|
||||
BOOKMARKS::BOOKMARKS(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
// fill TrackMouseEvent struct
|
||||
//tme.cbSize = sizeof(tme);
|
||||
|
@ -67,6 +68,10 @@ BOOKMARKS::BOOKMARKS()
|
|||
//tmeList.hwndTrack = NULL;
|
||||
}
|
||||
|
||||
BOOKMARKS::~BOOKMARKS(void)
|
||||
{
|
||||
}
|
||||
|
||||
void BOOKMARKS::init()
|
||||
{
|
||||
free();
|
||||
|
@ -592,6 +597,32 @@ void BOOKMARKS::redrawBookmarksListRow(int rowIndex)
|
|||
//ListView_RedrawItems(hwndBookmarksList, rowIndex, rowIndex);
|
||||
}
|
||||
|
||||
void BOOKMARKS::resizeEvent(QResizeEvent *event)
|
||||
{
|
||||
viewWidth = event->size().width();
|
||||
viewHeight = event->size().height();
|
||||
}
|
||||
|
||||
void BOOKMARKS::paintEvent(QPaintEvent *event)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void BOOKMARKS::mousePressEvent(QMouseEvent * event)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void BOOKMARKS::mouseReleaseEvent(QMouseEvent * event)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void BOOKMARKS::mouseMoveEvent(QMouseEvent * event)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void BOOKMARKS::handleMouseMove(int newX, int newY)
|
||||
{
|
||||
mouseX = newX;
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
#pragma once
|
||||
#include <vector>
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
#include "fceu.h"
|
||||
#include "Qt/TasEditor/bookmark.h"
|
||||
|
||||
|
@ -51,10 +53,13 @@ enum
|
|||
|
||||
#define DEFAULT_SLOT 1
|
||||
|
||||
class BOOKMARKS
|
||||
class BOOKMARKS : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
BOOKMARKS();
|
||||
BOOKMARKS(QWidget *parent = 0);
|
||||
~BOOKMARKS(void);
|
||||
void init();
|
||||
void free();
|
||||
void reset();
|
||||
|
@ -100,6 +105,13 @@ public:
|
|||
|
||||
//HWND hwndBookmarksList, hwndBranchesBitmap, hwndBookmarks;
|
||||
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent *event);
|
||||
void paintEvent(QPaintEvent *event);
|
||||
void mousePressEvent(QMouseEvent * event);
|
||||
void mouseReleaseEvent(QMouseEvent * event);
|
||||
void mouseMoveEvent(QMouseEvent * event);
|
||||
|
||||
private:
|
||||
void set(int slot);
|
||||
void jump(int slot);
|
||||
|
@ -114,5 +126,7 @@ private:
|
|||
// GDI stuff
|
||||
//HFONT hBookmarksFont;
|
||||
//HIMAGELIST hImgList;
|
||||
int viewWidth;
|
||||
int viewHeight;
|
||||
|
||||
};
|
||||
|
|
|
@ -48,7 +48,17 @@ Branches - Manager of Branches
|
|||
// corners cursor animation
|
||||
int corners_cursor_shift[BRANCHES_ANIMATION_FRAMES] = {0, 0, 1, 1, 2, 2, 2, 2, 1, 1, 0, 0 };
|
||||
|
||||
BRANCHES::BRANCHES()
|
||||
BRANCHES::BRANCHES(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
//this->parent = qobject_cast <TasEditorWindow*>( parent );
|
||||
this->setFocusPolicy(Qt::StrongFocus);
|
||||
this->setMouseTracking(true);
|
||||
this->setMinimumWidth(256);
|
||||
this->setMinimumHeight(128);
|
||||
}
|
||||
|
||||
BRANCHES::~BRANCHES(void)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -461,32 +471,50 @@ error:
|
|||
// ----------------------------------------------------------
|
||||
void BRANCHES::redrawBranchesBitmap()
|
||||
{
|
||||
QWidget::update();
|
||||
}
|
||||
|
||||
void BRANCHES::paintEvent(QPaintEvent *event)
|
||||
{
|
||||
QPainter painter(this);
|
||||
|
||||
viewWidth = event->rect().width();
|
||||
viewHeight = event->rect().height();
|
||||
|
||||
// // draw background
|
||||
// GradientFill(hBitmapDC, vertex, 2, &gRect, 1, GRADIENT_FILL_RECT_H);
|
||||
QLinearGradient linearGrad(QPointF(0, 0), QPointF(viewWidth, viewHeight));
|
||||
linearGrad.setColorAt(0, QColor(0xBF,0xE2,0xEF));
|
||||
linearGrad.setColorAt(1, QColor(0xE5,0xFB,0xFF));
|
||||
|
||||
painter.fillRect( 0, 0, viewWidth, viewHeight, linearGrad );
|
||||
|
||||
// // lines
|
||||
// int branch, tempBranchX, tempBranchY, parentX, parentY, childID;
|
||||
// SelectObject(hBitmapDC, normalPen);
|
||||
// for (int t = children.size() - 1; t >= 0; t--)
|
||||
// {
|
||||
// if (t > 0)
|
||||
// {
|
||||
// parentX = branchCurrentX[t-1];
|
||||
// parentY = branchCurrentY[t-1];
|
||||
// } else
|
||||
// {
|
||||
// parentX = cloudCurrentX;
|
||||
// parentY = BRANCHES_CLOUD_Y;
|
||||
// }
|
||||
// for (int i = children[t].size() - 1; i >= 0; i--)
|
||||
// {
|
||||
// childID = children[t][i];
|
||||
// if (childID < TOTAL_BOOKMARKS)
|
||||
// {
|
||||
// MoveToEx(hBitmapDC, parentX, parentY, 0);
|
||||
// LineTo(hBitmapDC, branchCurrentX[childID], branchCurrentY[childID]);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
int branch, tempBranchX, tempBranchY, parentX, parentY, childID;
|
||||
//SelectObject(hBitmapDC, normalPen);
|
||||
painter.setPen( QColor( 0, 0, 0 ) );
|
||||
|
||||
for (int t = children.size() - 1; t >= 0; t--)
|
||||
{
|
||||
if (t > 0)
|
||||
{
|
||||
parentX = branchCurrentX[t-1];
|
||||
parentY = branchCurrentY[t-1];
|
||||
} else
|
||||
{
|
||||
parentX = cloudCurrentX;
|
||||
parentY = BRANCHES_CLOUD_Y;
|
||||
}
|
||||
for (int i = children[t].size() - 1; i >= 0; i--)
|
||||
{
|
||||
childID = children[t][i];
|
||||
if (childID < TOTAL_BOOKMARKS)
|
||||
{
|
||||
//MoveToEx(hBitmapDC, parentX, parentY, 0);
|
||||
//LineTo(hBitmapDC, branchCurrentX[childID], branchCurrentY[childID]);
|
||||
painter.drawLine( parentX, parentY, branchCurrentX[childID], branchCurrentY[childID] );
|
||||
}
|
||||
}
|
||||
}
|
||||
// // lines for current timeline
|
||||
// if (currentBranch != ITEM_UNDER_MOUSE_CLOUD)
|
||||
// {
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
#include <stdint.h>
|
||||
#include <vector>
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
#define BRANCHES_ANIMATION_TICK 40 // animate at 25FPS
|
||||
#define BRANCHES_TRANSITION_MAX 12
|
||||
#define CURSOR_MIN_DISTANCE 1.0
|
||||
|
@ -96,10 +98,13 @@
|
|||
|
||||
#define FIRST_DIFFERENCE_UNKNOWN -2
|
||||
|
||||
class BRANCHES
|
||||
class BRANCHES : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
BRANCHES();
|
||||
BRANCHES(QWidget *parent = 0);
|
||||
~BRANCHES(void);
|
||||
void init();
|
||||
void free();
|
||||
void reset();
|
||||
|
@ -133,6 +138,9 @@ public:
|
|||
bool mustRecalculateBranchesTree;
|
||||
int branchRightclicked;
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event);
|
||||
|
||||
private:
|
||||
void setCurrentPosTimestamp();
|
||||
|
||||
|
@ -177,11 +185,13 @@ private:
|
|||
//TRIVERTEX vertex[2];
|
||||
//GRADIENT_RECT gRect;
|
||||
//RECT branchesBitmapRect;
|
||||
|
||||
int viewWidth;
|
||||
int viewHeight;
|
||||
|
||||
// temps
|
||||
std::vector<int> gridX; // measured in grid units, not in pixels
|
||||
std::vector<int> gridY;
|
||||
std::vector<int> gridHeight;
|
||||
std::vector<std::vector<uint8_t>> children;
|
||||
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue