mirror of https://github.com/odrling/Aegisub
Completed \move support and fixed a bug related to dragging.
Originally committed to SVN as r1348.
This commit is contained in:
parent
598046e0f8
commit
92e61f885f
Binary file not shown.
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Binary file not shown.
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
|
@ -31,7 +31,7 @@ Please visit http://aegisub.net to download latest version
|
||||||
o Framegrabs from the video now also includes framenumber in the filename. (jfs)
|
o Framegrabs from the video now also includes framenumber in the filename. (jfs)
|
||||||
o Added a toggleable overscan mask to show which areas might get cropped by televisions. (AMZ)
|
o Added a toggleable overscan mask to show which areas might get cropped by televisions. (AMZ)
|
||||||
- Visual Typesetting functionality implemented, which should make typesetting much easier and faster. It supports: (AMZ)
|
- Visual Typesetting functionality implemented, which should make typesetting much easier and faster. It supports: (AMZ)
|
||||||
o Dragging;
|
o Dragging, including support for \move;
|
||||||
o Rotation on Z axis;
|
o Rotation on Z axis;
|
||||||
o Rotation on X/Y axes;
|
o Rotation on X/Y axes;
|
||||||
o Scaling on X/Y axes;
|
o Scaling on X/Y axes;
|
||||||
|
|
|
@ -131,6 +131,8 @@ toggle_video_autoscroll BITMAP "bitmaps/toggle_video_autoscroll.bmp"
|
||||||
|
|
||||||
visual_standard BITMAP "bitmaps/visual_standard.bmp"
|
visual_standard BITMAP "bitmaps/visual_standard.bmp"
|
||||||
visual_move BITMAP "bitmaps/visual_move.bmp"
|
visual_move BITMAP "bitmaps/visual_move.bmp"
|
||||||
|
visual_move_conv_move BITMAP "bitmaps/visual_move_conv_move.bmp"
|
||||||
|
visual_move_conv_pos BITMAP "bitmaps/visual_move_conv_pos.bmp"
|
||||||
visual_rotatez BITMAP "bitmaps/visual_rotatez.bmp"
|
visual_rotatez BITMAP "bitmaps/visual_rotatez.bmp"
|
||||||
visual_rotatexy BITMAP "bitmaps/visual_rotatexy.bmp"
|
visual_rotatexy BITMAP "bitmaps/visual_rotatexy.bmp"
|
||||||
visual_scale BITMAP "bitmaps/visual_scale.bmp"
|
visual_scale BITMAP "bitmaps/visual_scale.bmp"
|
||||||
|
|
|
@ -67,6 +67,9 @@ VideoBox::VideoBox(wxWindow *parent)
|
||||||
videoPage = this;
|
videoPage = this;
|
||||||
frame = AegisubApp::Get()->frame;
|
frame = AegisubApp::Get()->frame;
|
||||||
|
|
||||||
|
// Visual controls sub-toolbar
|
||||||
|
visualSubToolBar = new wxBoxSizer(wxHORIZONTAL);
|
||||||
|
|
||||||
// Buttons
|
// Buttons
|
||||||
wxBitmapButton *VideoPlayButton = new wxBitmapButton(videoPage,Video_Play,wxBITMAP(button_play),wxDefaultPosition,wxSize(25,-1));
|
wxBitmapButton *VideoPlayButton = new wxBitmapButton(videoPage,Video_Play,wxBITMAP(button_play),wxDefaultPosition,wxSize(25,-1));
|
||||||
VideoPlayButton->SetToolTip(_("Play video starting on this position"));
|
VideoPlayButton->SetToolTip(_("Play video starting on this position"));
|
||||||
|
@ -130,9 +133,13 @@ VideoBox::VideoBox(wxWindow *parent)
|
||||||
typeSizer->AddStretchSpacer(1);
|
typeSizer->AddStretchSpacer(1);
|
||||||
|
|
||||||
// Top sizer
|
// Top sizer
|
||||||
wxSizer *topSizer = new wxBoxSizer(wxHORIZONTAL);
|
wxFlexGridSizer *topSizer = new wxFlexGridSizer(2,2,0,0);
|
||||||
topSizer->Add(typeSizer,0,wxEXPAND,0);
|
topSizer->Add(typeSizer,0,wxEXPAND,0);
|
||||||
topSizer->Add(videoDisplay,1,wxEXPAND,0);
|
topSizer->Add(videoDisplay,1,wxEXPAND,0);
|
||||||
|
topSizer->AddSpacer(0);
|
||||||
|
topSizer->Add(visualSubToolBar,1,wxEXPAND,0);
|
||||||
|
topSizer->AddGrowableCol(1);
|
||||||
|
topSizer->AddGrowableRow(0);
|
||||||
|
|
||||||
// Sizers
|
// Sizers
|
||||||
videoSliderSizer = new wxBoxSizer(wxHORIZONTAL);
|
videoSliderSizer = new wxBoxSizer(wxHORIZONTAL);
|
||||||
|
@ -147,6 +154,7 @@ VideoBox::VideoBox(wxWindow *parent)
|
||||||
videoBottomSizer->Add(VideoSubsPos,1,wxALIGN_CENTER,0);
|
videoBottomSizer->Add(VideoSubsPos,1,wxALIGN_CENTER,0);
|
||||||
VideoSizer = new wxBoxSizer(wxVERTICAL);
|
VideoSizer = new wxBoxSizer(wxVERTICAL);
|
||||||
VideoSizer->Add(topSizer,1,wxEXPAND,0);
|
VideoSizer->Add(topSizer,1,wxEXPAND,0);
|
||||||
|
VideoSizer->Add(new wxStaticLine(videoPage),0,wxEXPAND,0);
|
||||||
VideoSizer->Add(videoSliderSizer,0,wxEXPAND,0);
|
VideoSizer->Add(videoSliderSizer,0,wxEXPAND,0);
|
||||||
VideoSizer->Add(videoBottomSizer,0,wxEXPAND,0);
|
VideoSizer->Add(videoBottomSizer,0,wxEXPAND,0);
|
||||||
SetSizer(VideoSizer);
|
SetSizer(VideoSizer);
|
||||||
|
|
|
@ -91,6 +91,7 @@ public:
|
||||||
VideoDisplay *videoDisplay;
|
VideoDisplay *videoDisplay;
|
||||||
VideoSlider *videoSlider;
|
VideoSlider *videoSlider;
|
||||||
FrameMain *frame;
|
FrameMain *frame;
|
||||||
|
wxSizer *visualSubToolBar;
|
||||||
|
|
||||||
VideoBox (wxWindow *parent);
|
VideoBox (wxWindow *parent);
|
||||||
|
|
||||||
|
|
|
@ -114,6 +114,7 @@ VideoDisplay::VideoDisplay(wxWindow* parent, wxWindowID id, const wxPoint& pos,
|
||||||
: wxGLCanvas (parent, id, attribList, pos, size, style, name)
|
: wxGLCanvas (parent, id, attribList, pos, size, style, name)
|
||||||
{
|
{
|
||||||
// Set options
|
// Set options
|
||||||
|
box = NULL;
|
||||||
locked = false;
|
locked = false;
|
||||||
ControlSlider = NULL;
|
ControlSlider = NULL;
|
||||||
PositionDisplay = NULL;
|
PositionDisplay = NULL;
|
||||||
|
@ -646,11 +647,20 @@ void VideoDisplay::ConvertMouseCoords(int &x,int &y) {
|
||||||
// Set mode
|
// Set mode
|
||||||
void VideoDisplay::SetVisualMode(int mode) {
|
void VideoDisplay::SetVisualMode(int mode) {
|
||||||
// Set visual
|
// Set visual
|
||||||
|
if (visualMode != mode) {
|
||||||
|
// Get toolbar
|
||||||
|
wxSizer *toolBar = NULL;
|
||||||
|
if (box) {
|
||||||
|
toolBar = box->visualSubToolBar;
|
||||||
|
toolBar->Clear(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Replace mode
|
||||||
visualMode = mode;
|
visualMode = mode;
|
||||||
delete visual;
|
delete visual;
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case 0: visual = new VisualToolCross(this); break;
|
case 0: visual = new VisualToolCross(this); break;
|
||||||
case 1: visual = new VisualToolDrag(this); break;
|
case 1: visual = new VisualToolDrag(this,toolBar,box); break;
|
||||||
case 2: visual = new VisualToolRotateZ(this); break;
|
case 2: visual = new VisualToolRotateZ(this); break;
|
||||||
case 3: visual = new VisualToolRotateXY(this); break;
|
case 3: visual = new VisualToolRotateXY(this); break;
|
||||||
case 4: visual = new VisualToolScale(this); break;
|
case 4: visual = new VisualToolScale(this); break;
|
||||||
|
@ -658,6 +668,10 @@ void VideoDisplay::SetVisualMode(int mode) {
|
||||||
default: visual = NULL;
|
default: visual = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Update size to reflect toolbar changes
|
||||||
|
UpdateSize();
|
||||||
|
}
|
||||||
|
|
||||||
// Render
|
// Render
|
||||||
Render();
|
Render();
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,7 +57,7 @@
|
||||||
|
|
||||||
///////////////
|
///////////////
|
||||||
// Constructor
|
// Constructor
|
||||||
VisualTool::VisualTool(VideoDisplay *par) {
|
VisualTool::VisualTool(VideoDisplay *par) : eventSink(this) {
|
||||||
parent = par;
|
parent = par;
|
||||||
colour[0] = wxColour(27,60,114);
|
colour[0] = wxColour(27,60,114);
|
||||||
colour[1] = wxColour(166,247,177);
|
colour[1] = wxColour(166,247,177);
|
||||||
|
@ -169,8 +169,9 @@ void VisualTool::OnMouseEvent (wxMouseEvent &event) {
|
||||||
|
|
||||||
// Commit
|
// Commit
|
||||||
CommitDrag(features[curFeature]);
|
CommitDrag(features[curFeature]);
|
||||||
|
grid->editBox->CommitText();
|
||||||
grid->ass->FlagAsModified(_("visual typesetting"));
|
grid->ass->FlagAsModified(_("visual typesetting"));
|
||||||
grid->CommitChanges(false,true);
|
grid->CommitChanges(false);
|
||||||
|
|
||||||
// Clean up
|
// Clean up
|
||||||
dragging = false;
|
dragging = false;
|
||||||
|
@ -222,7 +223,7 @@ void VisualTool::OnMouseEvent (wxMouseEvent &event) {
|
||||||
CommitHold();
|
CommitHold();
|
||||||
grid->editBox->CommitText();
|
grid->editBox->CommitText();
|
||||||
grid->ass->FlagAsModified(_("visual typesetting"));
|
grid->ass->FlagAsModified(_("visual typesetting"));
|
||||||
grid->CommitChanges(false,true);
|
grid->CommitChanges(false);
|
||||||
|
|
||||||
// Clean up
|
// Clean up
|
||||||
holding = false;
|
holding = false;
|
||||||
|
@ -293,6 +294,7 @@ void VisualTool::DrawAllFeatures() {
|
||||||
void VisualTool::Refresh() {
|
void VisualTool::Refresh() {
|
||||||
frame_n = VideoContext::Get()->GetFrameN();
|
frame_n = VideoContext::Get()->GetFrameN();
|
||||||
dragListOK = false;
|
dragListOK = false;
|
||||||
|
DoRefresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -568,3 +570,21 @@ void VisualTool::GetLineClip(AssDialogue *diag,int &x1,int &y1,int &x2,int &y2)
|
||||||
void VisualTool::SetOverride(wxString tag,wxString value) {
|
void VisualTool::SetOverride(wxString tag,wxString value) {
|
||||||
VideoContext::Get()->grid->editBox->SetOverride(tag,value,0,false);
|
VideoContext::Get()->grid->editBox->SetOverride(tag,value,0,false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////
|
||||||
|
// Connect button
|
||||||
|
void VisualTool::ConnectButton(wxButton *button) {
|
||||||
|
button->Connect(wxEVT_COMMAND_BUTTON_CLICKED,wxCommandEventHandler(VisualToolEvent::OnButton),NULL,&eventSink);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//////////////
|
||||||
|
// Event sink
|
||||||
|
VisualToolEvent::VisualToolEvent(VisualTool *_tool) {
|
||||||
|
tool = _tool;
|
||||||
|
}
|
||||||
|
void VisualToolEvent::OnButton(wxCommandEvent &event) {
|
||||||
|
tool->OnButton(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,13 +49,30 @@
|
||||||
// Prototypes
|
// Prototypes
|
||||||
class VideoDisplay;
|
class VideoDisplay;
|
||||||
class AssDialogue;
|
class AssDialogue;
|
||||||
|
class VisualTool;
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////
|
||||||
|
// Event sink class
|
||||||
|
class VisualToolEvent : public wxEvtHandler {
|
||||||
|
private:
|
||||||
|
VisualTool *tool;
|
||||||
|
|
||||||
|
public:
|
||||||
|
void OnButton(wxCommandEvent &event);
|
||||||
|
|
||||||
|
VisualToolEvent(VisualTool *tool);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
////////////////////////
|
////////////////////////
|
||||||
// Visual handler class
|
// Visual handler class
|
||||||
class VisualTool : public OpenGLWrapper {
|
class VisualTool : public OpenGLWrapper {
|
||||||
|
friend class VisualToolEvent;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
VideoDisplay *parent;
|
VideoDisplay *parent;
|
||||||
|
VisualToolEvent eventSink;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
wxColour colour[4];
|
wxColour colour[4];
|
||||||
|
@ -92,6 +109,9 @@ protected:
|
||||||
int GetHighlightedFeature();
|
int GetHighlightedFeature();
|
||||||
void DrawAllFeatures();
|
void DrawAllFeatures();
|
||||||
|
|
||||||
|
void ConnectButton(wxButton *button);
|
||||||
|
virtual void OnButton(wxCommandEvent &event) {}
|
||||||
|
|
||||||
virtual bool CanHold() { return false; }
|
virtual bool CanHold() { return false; }
|
||||||
virtual void InitializeHold() {}
|
virtual void InitializeHold() {}
|
||||||
virtual void UpdateHold() {}
|
virtual void UpdateHold() {}
|
||||||
|
@ -103,6 +123,8 @@ protected:
|
||||||
virtual void UpdateDrag(VisualDraggableFeature &feature) {}
|
virtual void UpdateDrag(VisualDraggableFeature &feature) {}
|
||||||
virtual void CommitDrag(VisualDraggableFeature &feature) {}
|
virtual void CommitDrag(VisualDraggableFeature &feature) {}
|
||||||
|
|
||||||
|
virtual void DoRefresh() {}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
int mouseX,mouseY;
|
int mouseX,mouseY;
|
||||||
|
|
||||||
|
@ -114,3 +136,4 @@ public:
|
||||||
VisualTool(VideoDisplay *parent);
|
VisualTool(VideoDisplay *parent);
|
||||||
virtual ~VisualTool();
|
virtual ~VisualTool();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -48,19 +48,90 @@
|
||||||
#include "vfr.h"
|
#include "vfr.h"
|
||||||
|
|
||||||
|
|
||||||
|
///////
|
||||||
|
// IDs
|
||||||
|
enum {
|
||||||
|
BUTTON_TOGGLE_MOVE = 1300
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
///////////////
|
///////////////
|
||||||
// Constructor
|
// Constructor
|
||||||
VisualToolDrag::VisualToolDrag(VideoDisplay *_parent)
|
VisualToolDrag::VisualToolDrag(VideoDisplay *_parent,wxSizer *toolbar,wxWindow *toolWindow)
|
||||||
: VisualTool(_parent)
|
: VisualTool(_parent)
|
||||||
{
|
{
|
||||||
_parent->ShowCursor(false);
|
_parent->ShowCursor(false);
|
||||||
|
toggleMove = new wxBitmapButton(toolWindow,BUTTON_TOGGLE_MOVE,wxBITMAP(visual_move_conv_move),wxDefaultPosition);
|
||||||
|
ConnectButton(toggleMove);
|
||||||
|
toolbar->Add(toggleMove,0,wxEXPAND);
|
||||||
|
toolbar->AddStretchSpacer(1);
|
||||||
|
toggleMoveOnMove = true;
|
||||||
|
UpdateToggleButtons();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////
|
||||||
|
// Update toggle buttons
|
||||||
|
void VisualToolDrag::UpdateToggleButtons() {
|
||||||
|
// Check which bitmap to use
|
||||||
|
bool toMove = true;
|
||||||
|
AssDialogue *line = GetActiveDialogueLine();
|
||||||
|
if (line) {
|
||||||
|
int x1,y1,x2,y2,t1,t2;
|
||||||
|
bool hasMove;
|
||||||
|
GetLineMove(line,hasMove,x1,y1,x2,y2,t1,t2);
|
||||||
|
toMove = !hasMove;
|
||||||
|
}
|
||||||
|
|
||||||
|
// No change needed
|
||||||
|
if (toMove == toggleMoveOnMove) return;
|
||||||
|
|
||||||
|
// Change bitmap
|
||||||
|
if (toMove) toggleMove->SetBitmapLabel(wxBITMAP(visual_move_conv_move));
|
||||||
|
else toggleMove->SetBitmapLabel(wxBITMAP(visual_move_conv_pos));
|
||||||
|
toggleMoveOnMove = toMove;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////
|
||||||
|
// Toggle button pressed
|
||||||
|
void VisualToolDrag::OnButton(wxCommandEvent &event) {
|
||||||
|
// Get line
|
||||||
|
AssDialogue *line = GetActiveDialogueLine();
|
||||||
|
if (!line) return;
|
||||||
|
|
||||||
|
// Toggle \move <-> \pos
|
||||||
|
if (event.GetId() == BUTTON_TOGGLE_MOVE) {
|
||||||
|
// Get coordinates
|
||||||
|
int x1,y1,x2,y2,t1,t2;
|
||||||
|
bool hasMove;
|
||||||
|
GetLinePosition(line,x1,y1);
|
||||||
|
GetLineMove(line,hasMove,x1,y1,x2,y2,t1,t2);
|
||||||
|
|
||||||
|
// Replace tag
|
||||||
|
if (hasMove) SetOverride(_T("\\pos"),wxString::Format(_T("(%i,%i)"),x1,y1));
|
||||||
|
else SetOverride(_T("\\move"),wxString::Format(_T("(%i,%i,%i,%i,%i,%i)"),x1,y1,x1,y1,0,line->End.GetMS() - line->Start.GetMS()));
|
||||||
|
SubtitlesGrid *grid = VideoContext::Get()->grid;
|
||||||
|
grid->editBox->CommitText();
|
||||||
|
grid->ass->FlagAsModified(_("visual typesetting"));
|
||||||
|
grid->CommitChanges(false,true);
|
||||||
|
|
||||||
|
// Update display
|
||||||
|
Refresh();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///////////
|
||||||
|
// Refresh
|
||||||
|
void VisualToolDrag::DoRefresh() {
|
||||||
|
UpdateToggleButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//////////
|
//////////
|
||||||
// Update
|
// Update
|
||||||
void VisualToolDrag::Update() {
|
void VisualToolDrag::Update() {
|
||||||
// Render parent
|
|
||||||
GetParent()->Render();
|
GetParent()->Render();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,14 +46,21 @@
|
||||||
// Drag tool class
|
// Drag tool class
|
||||||
class VisualToolDrag : public VisualTool {
|
class VisualToolDrag : public VisualTool {
|
||||||
private:
|
private:
|
||||||
|
wxBitmapButton *toggleMove;
|
||||||
|
bool toggleMoveOnMove;
|
||||||
|
|
||||||
bool CanDrag() { return true; }
|
bool CanDrag() { return true; }
|
||||||
void PopulateFeatureList();
|
void PopulateFeatureList();
|
||||||
void InitializeDrag(VisualDraggableFeature &feature);
|
void InitializeDrag(VisualDraggableFeature &feature);
|
||||||
void UpdateDrag(VisualDraggableFeature &feature);
|
void UpdateDrag(VisualDraggableFeature &feature);
|
||||||
void CommitDrag(VisualDraggableFeature &feature);
|
void CommitDrag(VisualDraggableFeature &feature);
|
||||||
|
|
||||||
|
void OnButton(wxCommandEvent &event);
|
||||||
|
void UpdateToggleButtons();
|
||||||
|
void DoRefresh();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
VisualToolDrag(VideoDisplay *parent);
|
VisualToolDrag(VideoDisplay *parent,wxSizer *toolbar,wxWindow *toolWindow);
|
||||||
|
|
||||||
void Update();
|
void Update();
|
||||||
void Draw();
|
void Draw();
|
||||||
|
|
Loading…
Reference in New Issue