forked from mia/Aegisub
Simplify the VisualTool interface a bit.
Originally committed to SVN as r4318.
This commit is contained in:
parent
e023831134
commit
40a0c8994a
12 changed files with 115 additions and 169 deletions
|
@ -79,7 +79,7 @@ VisualTool::VisualTool(VideoDisplay *parent, VideoState const& video)
|
||||||
frame_n = VideoContext::Get()->GetFrameN();
|
frame_n = VideoContext::Get()->GetFrameN();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CanDrag()) PopulateFeatureList();
|
PopulateFeatureList();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Destructor
|
/// @brief Destructor
|
||||||
|
@ -106,42 +106,13 @@ void VisualTool::OnMouseEvent (wxMouseEvent &event) {
|
||||||
#endif
|
#endif
|
||||||
altDown = event.m_altDown;
|
altDown = event.m_altDown;
|
||||||
|
|
||||||
// Drag a feature
|
|
||||||
if (CanDrag()) {
|
|
||||||
if (!dragListOK) {
|
if (!dragListOK) {
|
||||||
PopulateFeatureList();
|
PopulateFeatureList();
|
||||||
dragListOK = true;
|
dragListOK = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Click on feature
|
|
||||||
if (!dragging && leftClick && !DragEnabled()) {
|
|
||||||
curFeature = GetHighlightedFeature();
|
|
||||||
if (curFeature != -1) {
|
|
||||||
ClickedFeature(features[curFeature]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!dragging && leftClick && DragEnabled()) {
|
|
||||||
curFeature = GetHighlightedFeature();
|
|
||||||
if (curFeature != -1) {
|
|
||||||
InitializeDrag(features[curFeature]);
|
|
||||||
if (features[curFeature].lineN != -1) {
|
|
||||||
VideoContext::Get()->grid->editBox->SetToLine(features[curFeature].lineN,true);
|
|
||||||
VideoContext::Get()->grid->SelectRow(features[curFeature].lineN);
|
|
||||||
}
|
|
||||||
|
|
||||||
dragStartX = video.x;
|
|
||||||
dragStartY = video.y;
|
|
||||||
dragOrigX = features[curFeature].x;
|
|
||||||
dragOrigY = features[curFeature].y;
|
|
||||||
|
|
||||||
dragging = true;
|
|
||||||
parent->CaptureMouse();
|
|
||||||
if (realTime) AssLimitToVisibleFilter::SetFrame(frame_n);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dragging) {
|
if (dragging) {
|
||||||
|
// continue drag
|
||||||
if (event.LeftIsDown()) {
|
if (event.LeftIsDown()) {
|
||||||
features[curFeature].x = (video.x - dragStartX + dragOrigX);
|
features[curFeature].x = (video.x - dragStartX + dragOrigX);
|
||||||
features[curFeature].y = (video.y - dragStartY + dragOrigY);
|
features[curFeature].y = (video.y - dragStartY + dragOrigY);
|
||||||
|
@ -160,6 +131,7 @@ void VisualTool::OnMouseEvent (wxMouseEvent &event) {
|
||||||
Commit();
|
Commit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// end drag
|
||||||
else {
|
else {
|
||||||
if (realTime) AssLimitToVisibleFilter::SetFrame(-1);
|
if (realTime) AssLimitToVisibleFilter::SetFrame(-1);
|
||||||
|
|
||||||
|
@ -172,22 +144,8 @@ void VisualTool::OnMouseEvent (wxMouseEvent &event) {
|
||||||
parent->SetFocus();
|
parent->SetFocus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
else if (holding) {
|
||||||
|
// continue hold
|
||||||
// Hold
|
|
||||||
if (!dragging && CanHold()) {
|
|
||||||
if (!holding && event.LeftIsDown() && HoldEnabled()) {
|
|
||||||
curDiag = GetActiveDialogueLine();
|
|
||||||
if (curDiag) {
|
|
||||||
InitializeHold();
|
|
||||||
|
|
||||||
holding = true;
|
|
||||||
parent->CaptureMouse();
|
|
||||||
if (realTime) AssLimitToVisibleFilter::SetFrame(frame_n);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (holding) {
|
|
||||||
if (event.LeftIsDown()) {
|
if (event.LeftIsDown()) {
|
||||||
UpdateHold();
|
UpdateHold();
|
||||||
|
|
||||||
|
@ -196,6 +154,7 @@ void VisualTool::OnMouseEvent (wxMouseEvent &event) {
|
||||||
Commit();
|
Commit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// end hold
|
||||||
else {
|
else {
|
||||||
if (realTime) AssLimitToVisibleFilter::SetFrame(-1);
|
if (realTime) AssLimitToVisibleFilter::SetFrame(-1);
|
||||||
|
|
||||||
|
@ -208,6 +167,35 @@ void VisualTool::OnMouseEvent (wxMouseEvent &event) {
|
||||||
parent->SetFocus();
|
parent->SetFocus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (leftClick) {
|
||||||
|
curFeature = GetHighlightedFeature();
|
||||||
|
// start drag
|
||||||
|
if (curFeature > -1) {
|
||||||
|
if (InitializeDrag(features[curFeature])) {
|
||||||
|
if (features[curFeature].lineN != -1) {
|
||||||
|
VideoContext::Get()->grid->editBox->SetToLine(features[curFeature].lineN,true);
|
||||||
|
VideoContext::Get()->grid->SelectRow(features[curFeature].lineN);
|
||||||
|
}
|
||||||
|
|
||||||
|
dragStartX = video.x;
|
||||||
|
dragStartY = video.y;
|
||||||
|
dragOrigX = features[curFeature].x;
|
||||||
|
dragOrigY = features[curFeature].y;
|
||||||
|
|
||||||
|
dragging = true;
|
||||||
|
parent->CaptureMouse();
|
||||||
|
if (realTime) AssLimitToVisibleFilter::SetFrame(frame_n);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// start hold
|
||||||
|
else {
|
||||||
|
curDiag = GetActiveDialogueLine();
|
||||||
|
if (curDiag && InitializeHold()) {
|
||||||
|
holding = true;
|
||||||
|
parent->CaptureMouse();
|
||||||
|
if (realTime) AssLimitToVisibleFilter::SetFrame(frame_n);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Update();
|
Update();
|
||||||
|
|
|
@ -66,6 +66,15 @@ struct VideoState;
|
||||||
/// @brief DOCME
|
/// @brief DOCME
|
||||||
/// DOCME
|
/// DOCME
|
||||||
class VisualTool : public OpenGLWrapper {
|
class VisualTool : public OpenGLWrapper {
|
||||||
|
private:
|
||||||
|
/// DOCME
|
||||||
|
|
||||||
|
/// DOCME
|
||||||
|
|
||||||
|
/// DOCME
|
||||||
|
|
||||||
|
/// DOCME
|
||||||
|
int dragStartX,dragStartY,dragOrigX,dragOrigY;
|
||||||
int GetHighlightedFeature();
|
int GetHighlightedFeature();
|
||||||
protected:
|
protected:
|
||||||
/// DOCME
|
/// DOCME
|
||||||
|
@ -89,15 +98,6 @@ protected:
|
||||||
/// DOCME
|
/// DOCME
|
||||||
std::vector<VisualDraggableFeature> features;
|
std::vector<VisualDraggableFeature> features;
|
||||||
|
|
||||||
/// DOCME
|
|
||||||
|
|
||||||
/// DOCME
|
|
||||||
|
|
||||||
/// DOCME
|
|
||||||
|
|
||||||
/// DOCME
|
|
||||||
int dragStartX,dragStartY,dragOrigX,dragOrigY;
|
|
||||||
|
|
||||||
/// DOCME
|
/// DOCME
|
||||||
bool dragListOK;
|
bool dragListOK;
|
||||||
|
|
||||||
|
@ -135,18 +135,8 @@ protected:
|
||||||
void Commit(bool full=false);
|
void Commit(bool full=false);
|
||||||
|
|
||||||
/// @brief DOCME
|
/// @brief DOCME
|
||||||
/// @return
|
|
||||||
///
|
///
|
||||||
virtual bool CanHold() { return false; }
|
virtual bool InitializeHold() { return false; }
|
||||||
|
|
||||||
/// @brief DOCME
|
|
||||||
/// @return
|
|
||||||
///
|
|
||||||
virtual bool HoldEnabled() { return true; }
|
|
||||||
|
|
||||||
/// @brief DOCME
|
|
||||||
///
|
|
||||||
virtual void InitializeHold() {}
|
|
||||||
|
|
||||||
/// @brief DOCME
|
/// @brief DOCME
|
||||||
///
|
///
|
||||||
|
@ -158,23 +148,13 @@ protected:
|
||||||
virtual void CommitHold() {}
|
virtual void CommitHold() {}
|
||||||
|
|
||||||
/// @brief DOCME
|
/// @brief DOCME
|
||||||
/// @return
|
|
||||||
///
|
///
|
||||||
virtual bool CanDrag() { return false; }
|
virtual void PopulateFeatureList() { }
|
||||||
|
|
||||||
/// @brief DOCME
|
|
||||||
/// @return
|
|
||||||
///
|
|
||||||
virtual bool DragEnabled() { return true; }
|
|
||||||
|
|
||||||
/// @brief DOCME
|
|
||||||
///
|
|
||||||
virtual void PopulateFeatureList() { wxLogMessage(_T("wtf?")); }
|
|
||||||
|
|
||||||
/// @brief DOCME
|
/// @brief DOCME
|
||||||
/// @param feature
|
/// @param feature
|
||||||
///
|
///
|
||||||
virtual void InitializeDrag(VisualDraggableFeature &feature) {}
|
virtual bool InitializeDrag(VisualDraggableFeature &feature) { return true; }
|
||||||
|
|
||||||
/// @brief DOCME
|
/// @brief DOCME
|
||||||
/// @param feature
|
/// @param feature
|
||||||
|
@ -186,11 +166,6 @@ protected:
|
||||||
///
|
///
|
||||||
virtual void CommitDrag(VisualDraggableFeature &feature) {}
|
virtual void CommitDrag(VisualDraggableFeature &feature) {}
|
||||||
|
|
||||||
/// @brief DOCME
|
|
||||||
/// @param feature
|
|
||||||
///
|
|
||||||
virtual void ClickedFeature(VisualDraggableFeature &feature) {}
|
|
||||||
|
|
||||||
/// @brief DOCME
|
/// @brief DOCME
|
||||||
///
|
///
|
||||||
virtual void DoRefresh() {}
|
virtual void DoRefresh() {}
|
||||||
|
|
|
@ -93,21 +93,16 @@ void VisualToolClip::Draw() {
|
||||||
// Draw circles
|
// Draw circles
|
||||||
SetLineColour(colour[0]);
|
SetLineColour(colour[0]);
|
||||||
SetFillColour(colour[1],0.5);
|
SetFillColour(colour[1],0.5);
|
||||||
if (CanDrag()) DrawAllFeatures();
|
DrawAllFeatures();
|
||||||
else {
|
|
||||||
DrawCircle(dx1,dy1,4);
|
|
||||||
DrawCircle(dx2,dy1,4);
|
|
||||||
DrawCircle(dx2,dy2,4);
|
|
||||||
DrawCircle(dx1,dy2,4);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Start holding
|
/// @brief Start holding
|
||||||
void VisualToolClip::InitializeHold() {
|
bool VisualToolClip::InitializeHold() {
|
||||||
startX = video.x;
|
startX = video.x;
|
||||||
startY = video.y;
|
startY = video.y;
|
||||||
curDiag->StripTag(L"\\clip");
|
curDiag->StripTag(L"\\clip");
|
||||||
curDiag->StripTag(L"\\iclip");
|
curDiag->StripTag(L"\\iclip");
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Update hold
|
/// @brief Update hold
|
||||||
|
@ -129,7 +124,7 @@ void VisualToolClip::UpdateHold() {
|
||||||
curY2 = MID(0,curY2,video.h);
|
curY2 = MID(0,curY2,video.h);
|
||||||
|
|
||||||
// Features
|
// Features
|
||||||
if (CanDrag()) PopulateFeatureList();
|
PopulateFeatureList();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Commit hold
|
/// @brief Commit hold
|
||||||
|
@ -191,10 +186,11 @@ void VisualToolClip::PopulateFeatureList() {
|
||||||
|
|
||||||
/// @brief Initialize
|
/// @brief Initialize
|
||||||
/// @param feature
|
/// @param feature
|
||||||
void VisualToolClip::InitializeDrag(VisualDraggableFeature &feature) {
|
bool VisualToolClip::InitializeDrag(VisualDraggableFeature &feature) {
|
||||||
curDiag = GetActiveDialogueLine();
|
curDiag = GetActiveDialogueLine();
|
||||||
curDiag->StripTag(L"\\clip");
|
curDiag->StripTag(L"\\clip");
|
||||||
curDiag->StripTag(L"\\iclip");
|
curDiag->StripTag(L"\\iclip");
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Update drag
|
/// @brief Update drag
|
||||||
|
|
|
@ -70,17 +70,15 @@ private:
|
||||||
/// @brief DOCME
|
/// @brief DOCME
|
||||||
/// @return
|
/// @return
|
||||||
///
|
///
|
||||||
bool CanHold() { return true; }
|
bool InitializeHold();
|
||||||
void InitializeHold();
|
|
||||||
void UpdateHold();
|
void UpdateHold();
|
||||||
void CommitHold();
|
void CommitHold();
|
||||||
|
|
||||||
|
|
||||||
/// @brief DOCME
|
/// @brief DOCME
|
||||||
///
|
///
|
||||||
bool CanDrag() { return true; }
|
|
||||||
void PopulateFeatureList();
|
void PopulateFeatureList();
|
||||||
void InitializeDrag(VisualDraggableFeature &feature);
|
bool InitializeDrag(VisualDraggableFeature &feature);
|
||||||
void UpdateDrag(VisualDraggableFeature &feature);
|
void UpdateDrag(VisualDraggableFeature &feature);
|
||||||
void CommitDrag(VisualDraggableFeature &feature);
|
void CommitDrag(VisualDraggableFeature &feature);
|
||||||
|
|
||||||
|
|
|
@ -166,7 +166,7 @@ void VisualToolRotateXY::Draw() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Start holding
|
/// @brief Start holding
|
||||||
void VisualToolRotateXY::InitializeHold() {
|
bool VisualToolRotateXY::InitializeHold() {
|
||||||
GetLinePosition(curDiag,odx,ody,orgx,orgy);
|
GetLinePosition(curDiag,odx,ody,orgx,orgy);
|
||||||
GetLineRotation(curDiag,origAngleX,origAngleY,rz);
|
GetLineRotation(curDiag,origAngleX,origAngleY,rz);
|
||||||
startAngleX = (orgy-video.x)*2.0;
|
startAngleX = (orgy-video.x)*2.0;
|
||||||
|
@ -175,6 +175,8 @@ void VisualToolRotateXY::InitializeHold() {
|
||||||
curAngleY = origAngleY;
|
curAngleY = origAngleY;
|
||||||
curDiag->StripTag(L"\\frx");
|
curDiag->StripTag(L"\\frx");
|
||||||
curDiag->StripTag(L"\\fry");
|
curDiag->StripTag(L"\\fry");
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Update hold
|
/// @brief Update hold
|
||||||
|
|
|
@ -72,15 +72,13 @@ private:
|
||||||
/// @brief DOCME
|
/// @brief DOCME
|
||||||
/// @return
|
/// @return
|
||||||
///
|
///
|
||||||
bool CanHold() { return true; }
|
bool InitializeHold();
|
||||||
void InitializeHold();
|
|
||||||
void UpdateHold();
|
void UpdateHold();
|
||||||
void CommitHold();
|
void CommitHold();
|
||||||
|
|
||||||
|
|
||||||
/// @brief DOCME
|
/// @brief DOCME
|
||||||
///
|
///
|
||||||
bool CanDrag() { return true; }
|
|
||||||
void PopulateFeatureList();
|
void PopulateFeatureList();
|
||||||
void UpdateDrag(VisualDraggableFeature &feature);
|
void UpdateDrag(VisualDraggableFeature &feature);
|
||||||
void CommitDrag(VisualDraggableFeature &feature);
|
void CommitDrag(VisualDraggableFeature &feature);
|
||||||
|
|
|
@ -151,13 +151,15 @@ void VisualToolRotateZ::Draw() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Start holding
|
/// @brief Start holding
|
||||||
void VisualToolRotateZ::InitializeHold() {
|
bool VisualToolRotateZ::InitializeHold() {
|
||||||
GetLinePosition(curDiag,odx,ody,orgx,orgy);
|
GetLinePosition(curDiag,odx,ody,orgx,orgy);
|
||||||
startAngle = atan2(double(orgy-video.y),double(video.x-orgx)) * 180.0 / 3.1415926535897932;
|
startAngle = atan2(double(orgy-video.y),double(video.x-orgx)) * 180.0 / 3.1415926535897932;
|
||||||
GetLineRotation(curDiag,rx,ry,origAngle);
|
GetLineRotation(curDiag,rx,ry,origAngle);
|
||||||
curAngle = origAngle;
|
curAngle = origAngle;
|
||||||
curDiag->StripTag(L"\\frz");
|
curDiag->StripTag(L"\\frz");
|
||||||
curDiag->StripTag(L"\\fr");
|
curDiag->StripTag(L"\\fr");
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Update hold
|
/// @brief Update hold
|
||||||
|
|
|
@ -70,15 +70,13 @@ private:
|
||||||
/// @brief DOCME
|
/// @brief DOCME
|
||||||
/// @return
|
/// @return
|
||||||
///
|
///
|
||||||
bool CanHold() { return true; }
|
bool InitializeHold();
|
||||||
void InitializeHold();
|
|
||||||
void UpdateHold();
|
void UpdateHold();
|
||||||
void CommitHold();
|
void CommitHold();
|
||||||
|
|
||||||
|
|
||||||
/// @brief DOCME
|
/// @brief DOCME
|
||||||
///
|
///
|
||||||
bool CanDrag() { return true; }
|
|
||||||
void PopulateFeatureList();
|
void PopulateFeatureList();
|
||||||
void UpdateDrag(VisualDraggableFeature &feature);
|
void UpdateDrag(VisualDraggableFeature &feature);
|
||||||
void CommitDrag(VisualDraggableFeature &feature);
|
void CommitDrag(VisualDraggableFeature &feature);
|
||||||
|
|
|
@ -124,7 +124,7 @@ void VisualToolScale::Draw() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Start holding
|
/// @brief Start holding
|
||||||
void VisualToolScale::InitializeHold() {
|
bool VisualToolScale::InitializeHold() {
|
||||||
startX = video.x;
|
startX = video.x;
|
||||||
startY = video.y;
|
startY = video.y;
|
||||||
GetLineScale(curDiag,origScaleX,origScaleY);
|
GetLineScale(curDiag,origScaleX,origScaleY);
|
||||||
|
@ -132,6 +132,8 @@ void VisualToolScale::InitializeHold() {
|
||||||
curScaleY = origScaleY;
|
curScaleY = origScaleY;
|
||||||
curDiag->StripTag(_T("\\fscx"));
|
curDiag->StripTag(_T("\\fscx"));
|
||||||
curDiag->StripTag(_T("\\fscy"));
|
curDiag->StripTag(_T("\\fscy"));
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Update hold
|
/// @brief Update hold
|
||||||
|
|
|
@ -64,8 +64,7 @@ private:
|
||||||
|
|
||||||
/// @brief DOCME
|
/// @brief DOCME
|
||||||
///
|
///
|
||||||
bool CanHold() { return true; }
|
bool InitializeHold();
|
||||||
void InitializeHold();
|
|
||||||
void UpdateHold();
|
void UpdateHold();
|
||||||
void CommitHold();
|
void CommitHold();
|
||||||
|
|
||||||
|
|
|
@ -262,12 +262,6 @@ void VisualToolVectorClip::PopulateFeatureList() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Can drag?
|
|
||||||
/// @return
|
|
||||||
bool VisualToolVectorClip::DragEnabled() {
|
|
||||||
return mode <= 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @brief Update
|
/// @brief Update
|
||||||
/// @param feature
|
/// @param feature
|
||||||
void VisualToolVectorClip::UpdateDrag(VisualDraggableFeature &feature) {
|
void VisualToolVectorClip::UpdateDrag(VisualDraggableFeature &feature) {
|
||||||
|
@ -283,7 +277,7 @@ void VisualToolVectorClip::CommitDrag(VisualDraggableFeature &feature) {
|
||||||
/// @brief Clicked a feature
|
/// @brief Clicked a feature
|
||||||
/// @param feature
|
/// @param feature
|
||||||
/// @return
|
/// @return
|
||||||
void VisualToolVectorClip::ClickedFeature(VisualDraggableFeature &feature) {
|
bool VisualToolVectorClip::InitializeDrag(VisualDraggableFeature &feature) {
|
||||||
// Delete a control point
|
// Delete a control point
|
||||||
if (mode == 5) {
|
if (mode == 5) {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
@ -301,21 +295,16 @@ void VisualToolVectorClip::ClickedFeature(VisualDraggableFeature &feature) {
|
||||||
CommitDrag(feature);
|
CommitDrag(feature);
|
||||||
curFeature = -1;
|
curFeature = -1;
|
||||||
Commit(true);
|
Commit(true);
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
return true;
|
||||||
|
|
||||||
/// @brief Can hold?
|
|
||||||
/// @return
|
|
||||||
bool VisualToolVectorClip::HoldEnabled() {
|
|
||||||
return mode <= 4 || mode == 6 || mode == 7;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Initialize hold
|
/// @brief Initialize hold
|
||||||
/// @return
|
/// @return
|
||||||
void VisualToolVectorClip::InitializeHold() {
|
bool VisualToolVectorClip::InitializeHold() {
|
||||||
// Insert line/bicubic
|
// Insert line/bicubic
|
||||||
if (mode == 1 || mode == 2) {
|
if (mode == 1 || mode == 2) {
|
||||||
SplineCurve curve;
|
SplineCurve curve;
|
||||||
|
@ -338,10 +327,12 @@ void VisualToolVectorClip::InitializeHold() {
|
||||||
|
|
||||||
// Insert
|
// Insert
|
||||||
spline.AppendCurve(curve);
|
spline.AppendCurve(curve);
|
||||||
|
UpdateHold();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert and insert
|
// Convert and insert
|
||||||
else if (mode == 3 || mode == 4) {
|
if (mode == 3 || mode == 4) {
|
||||||
// Get closest point
|
// Get closest point
|
||||||
Vector2D pt;
|
Vector2D pt;
|
||||||
int curve;
|
int curve;
|
||||||
|
@ -371,7 +362,7 @@ void VisualToolVectorClip::InitializeHold() {
|
||||||
// Insert
|
// Insert
|
||||||
else {
|
else {
|
||||||
// Check if there is at least one curve to split
|
// Check if there is at least one curve to split
|
||||||
if (spline.curves.size() == 0) return;
|
if (spline.curves.size() == 0) return false;
|
||||||
|
|
||||||
// Split the curve
|
// Split the curve
|
||||||
SplineCurve *c1 = spline.GetCurve(curve);
|
SplineCurve *c1 = spline.GetCurve(curve);
|
||||||
|
@ -393,15 +384,18 @@ void VisualToolVectorClip::InitializeHold() {
|
||||||
// Commit
|
// Commit
|
||||||
SetOverride(GetActiveDialogueLine(), inverse ? L"\\iclip" : L"\\clip", L"(" + spline.EncodeToASS() + L")");
|
SetOverride(GetActiveDialogueLine(), inverse ? L"\\iclip" : L"\\clip", L"(" + spline.EncodeToASS() + L")");
|
||||||
Commit(true);
|
Commit(true);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Freehand
|
// Freehand
|
||||||
else if (mode == 6 || mode == 7) {
|
if (mode == 6 || mode == 7) {
|
||||||
features.clear();
|
features.clear();
|
||||||
spline.curves.clear();
|
spline.curves.clear();
|
||||||
lastX = -100000;
|
lastX = INT_MIN;
|
||||||
lastY = -100000;
|
lastY = INT_MIN;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Update hold
|
/// @brief Update hold
|
||||||
|
@ -434,7 +428,7 @@ void VisualToolVectorClip::UpdateHold() {
|
||||||
|
|
||||||
// Freehand
|
// Freehand
|
||||||
if (mode == 6 || mode == 7) {
|
if (mode == 6 || mode == 7) {
|
||||||
if (lastX != -100000 && lastY != -100000) {
|
if (lastX != INT_MIN && lastY != INT_MIN) {
|
||||||
// See if distance is enough
|
// See if distance is enough
|
||||||
Vector2D delta(lastX-video.x,lastY-video.y);
|
Vector2D delta(lastX-video.x,lastY-video.y);
|
||||||
int len = (int)delta.Len();
|
int len = (int)delta.Len();
|
||||||
|
|
|
@ -68,21 +68,15 @@ private:
|
||||||
/// @brief DOCME
|
/// @brief DOCME
|
||||||
/// @return
|
/// @return
|
||||||
///
|
///
|
||||||
bool CanHold() { return true; }
|
bool InitializeHold();
|
||||||
bool HoldEnabled();
|
|
||||||
void InitializeHold();
|
|
||||||
void UpdateHold();
|
void UpdateHold();
|
||||||
void CommitHold();
|
void CommitHold();
|
||||||
|
|
||||||
|
|
||||||
/// @brief DOCME
|
|
||||||
///
|
|
||||||
bool CanDrag() { return true; }
|
|
||||||
bool DragEnabled();
|
|
||||||
void PopulateFeatureList();
|
void PopulateFeatureList();
|
||||||
void UpdateDrag(VisualDraggableFeature &feature);
|
void UpdateDrag(VisualDraggableFeature &feature);
|
||||||
void CommitDrag(VisualDraggableFeature &feature);
|
void CommitDrag(VisualDraggableFeature &feature);
|
||||||
void ClickedFeature(VisualDraggableFeature &feature);
|
bool InitializeDrag(VisualDraggableFeature &feature);
|
||||||
|
|
||||||
void DoRefresh();
|
void DoRefresh();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue