forked from mia/Aegisub
Move all userdata in VisualDraggableFeature not used by VisualTool to subclasses specific to each tool that needs userdata.
Originally committed to SVN as r4321.
This commit is contained in:
parent
a282393b47
commit
8ff2728322
9 changed files with 149 additions and 129 deletions
|
@ -44,12 +44,9 @@ VisualDraggableFeature::VisualDraggableFeature()
|
||||||
, x(INT_MIN)
|
, x(INT_MIN)
|
||||||
, y(INT_MIN)
|
, y(INT_MIN)
|
||||||
, layer(0)
|
, layer(0)
|
||||||
, value(0)
|
|
||||||
, value2(0)
|
|
||||||
, line(NULL)
|
, line(NULL)
|
||||||
, lineN(-1)
|
, lineN(-1)
|
||||||
{
|
{
|
||||||
for (int i=0;i<4;i++) brother[i] = -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool VisualDraggableFeature::IsMouseOver(int mx,int my) {
|
bool VisualDraggableFeature::IsMouseOver(int mx,int my) {
|
||||||
|
|
|
@ -77,14 +77,9 @@ public:
|
||||||
|
|
||||||
int layer; /// Layer; Higher = above
|
int layer; /// Layer; Higher = above
|
||||||
|
|
||||||
int value; /// userdata; used by drag tool for time
|
|
||||||
int value2; /// more userdata
|
|
||||||
|
|
||||||
AssDialogue* line; /// The dialogue line this feature is for
|
AssDialogue* line; /// The dialogue line this feature is for
|
||||||
int lineN; /// The line's index in the file
|
int lineN; /// The line's index in the file
|
||||||
|
|
||||||
int brother[4]; /// userdata; generally indexes of other features in an array
|
|
||||||
|
|
||||||
/// @brief Is the given point over this feature?
|
/// @brief Is the given point over this feature?
|
||||||
/// @param mx x coordinate to test
|
/// @param mx x coordinate to test
|
||||||
/// @param my y coordinate to test
|
/// @param my y coordinate to test
|
||||||
|
|
|
@ -61,6 +61,9 @@
|
||||||
#include "video_provider_manager.h"
|
#include "video_provider_manager.h"
|
||||||
#include "visual_feature.h"
|
#include "visual_feature.h"
|
||||||
#include "visual_tool.h"
|
#include "visual_tool.h"
|
||||||
|
#include "visual_tool_clip.h"
|
||||||
|
#include "visual_tool_drag.h"
|
||||||
|
#include "visual_tool_vector_clip.h"
|
||||||
|
|
||||||
const wxColour IVisualTool::colour[4] = {wxColour(106,32,19), wxColour(255,169,40), wxColour(255,253,185), wxColour(187,0,0)};
|
const wxColour IVisualTool::colour[4] = {wxColour(106,32,19), wxColour(255,169,40), wxColour(255,253,185), wxColour(187,0,0)};
|
||||||
|
|
||||||
|
@ -676,4 +679,8 @@ void VisualTool<FeatureType>::SetOverride(AssDialogue* line, wxString tag, wxStr
|
||||||
parent->SetFocus();
|
parent->SetFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If only export worked
|
||||||
template class VisualTool<VisualDraggableFeature>;
|
template class VisualTool<VisualDraggableFeature>;
|
||||||
|
template class VisualTool<ClipCorner>;
|
||||||
|
template class VisualTool<VisualToolDragDraggableFeature>;
|
||||||
|
template class VisualTool<VisualToolVectorClipDraggableFeature>;
|
||||||
|
|
|
@ -150,43 +150,39 @@ void VisualToolClip::PopulateFeatureList() {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
features[i].x = curX1;
|
features[i].x = curX1;
|
||||||
features[i].y = curY1;
|
features[i].y = curY1;
|
||||||
features[i].brother[0] = 1;
|
features[i].horiz = &features[1];
|
||||||
features[i].brother[1] = 2;
|
features[i].vert = &features[2];
|
||||||
features[i].brother[2] = 3;
|
|
||||||
features[i].type = DRAG_SMALL_CIRCLE;
|
features[i].type = DRAG_SMALL_CIRCLE;
|
||||||
i++;
|
i++;
|
||||||
|
|
||||||
// Top-right
|
// Top-right
|
||||||
features[i].x = curX2;
|
features[i].x = curX2;
|
||||||
features[i].y = curY1;
|
features[i].y = curY1;
|
||||||
features[i].brother[0] = 0;
|
features[i].horiz = &features[0];
|
||||||
features[i].brother[1] = 3;
|
features[i].vert = &features[3];
|
||||||
features[i].brother[2] = 2;
|
|
||||||
features[i].type = DRAG_SMALL_CIRCLE;
|
features[i].type = DRAG_SMALL_CIRCLE;
|
||||||
i++;
|
i++;
|
||||||
|
|
||||||
// Bottom-left
|
// Bottom-left
|
||||||
features[i].x = curX1;
|
features[i].x = curX1;
|
||||||
features[i].y = curY2;
|
features[i].y = curY2;
|
||||||
features[i].brother[0] = 3;
|
features[i].horiz = &features[3];
|
||||||
features[i].brother[1] = 0;
|
features[i].vert = &features[0];
|
||||||
features[i].brother[2] = 1;
|
|
||||||
features[i].type = DRAG_SMALL_CIRCLE;
|
features[i].type = DRAG_SMALL_CIRCLE;
|
||||||
i++;
|
i++;
|
||||||
|
|
||||||
// Bottom-right
|
// Bottom-right
|
||||||
features[i].x = curX2;
|
features[i].x = curX2;
|
||||||
features[i].y = curY2;
|
features[i].y = curY2;
|
||||||
features[i].brother[0] = 2;
|
features[i].horiz = &features[2];
|
||||||
features[i].brother[1] = 1;
|
features[i].vert = &features[1];
|
||||||
features[i].brother[2] = 0;
|
|
||||||
features[i].type = DRAG_SMALL_CIRCLE;
|
features[i].type = DRAG_SMALL_CIRCLE;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Initialize
|
/// @brief Initialize
|
||||||
/// @param feature
|
/// @param feature
|
||||||
bool VisualToolClip::InitializeDrag(VisualDraggableFeature &feature) {
|
bool VisualToolClip::InitializeDrag(ClipCorner &feature) {
|
||||||
curDiag = GetActiveDialogueLine();
|
curDiag = GetActiveDialogueLine();
|
||||||
curDiag->StripTag(L"\\clip");
|
curDiag->StripTag(L"\\clip");
|
||||||
curDiag->StripTag(L"\\iclip");
|
curDiag->StripTag(L"\\iclip");
|
||||||
|
@ -195,10 +191,10 @@ bool VisualToolClip::InitializeDrag(VisualDraggableFeature &feature) {
|
||||||
|
|
||||||
/// @brief Update drag
|
/// @brief Update drag
|
||||||
/// @param feature
|
/// @param feature
|
||||||
void VisualToolClip::UpdateDrag(VisualDraggableFeature &feature) {
|
void VisualToolClip::UpdateDrag(ClipCorner &feature) {
|
||||||
// Update brothers
|
// Update brothers
|
||||||
features[feature.brother[0]].y = feature.y;
|
feature.horiz->y = feature.y;
|
||||||
features[feature.brother[1]].x = feature.x;
|
feature.vert->x = feature.x;
|
||||||
|
|
||||||
// Get "cur" from features
|
// Get "cur" from features
|
||||||
curX1 = features[0].x;
|
curX1 = features[0].x;
|
||||||
|
@ -213,6 +209,6 @@ void VisualToolClip::UpdateDrag(VisualDraggableFeature &feature) {
|
||||||
|
|
||||||
/// @brief Done dragging
|
/// @brief Done dragging
|
||||||
/// @param feature
|
/// @param feature
|
||||||
void VisualToolClip::CommitDrag(VisualDraggableFeature &feature) {
|
void VisualToolClip::CommitDrag(ClipCorner &feature) {
|
||||||
CommitHold();
|
CommitHold();
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,12 +37,26 @@
|
||||||
#include "visual_feature.h"
|
#include "visual_feature.h"
|
||||||
#include "visual_tool.h"
|
#include "visual_tool.h"
|
||||||
|
|
||||||
|
/// @class ClipCorner
|
||||||
|
/// @brief VisualDraggableFeature with siblings
|
||||||
|
class ClipCorner : public VisualDraggableFeature {
|
||||||
|
public:
|
||||||
|
ClipCorner* horiz; /// Other corner on this corner's horizontal line
|
||||||
|
ClipCorner* vert; /// Other corner on this corner's vertical line
|
||||||
|
/// @brief Constructor
|
||||||
|
ClipCorner()
|
||||||
|
: VisualDraggableFeature()
|
||||||
|
, horiz(NULL)
|
||||||
|
, vert(NULL)
|
||||||
|
{ }
|
||||||
|
};
|
||||||
|
|
||||||
/// DOCME
|
/// DOCME
|
||||||
/// @class VisualToolClip
|
/// @class VisualToolClip
|
||||||
/// @brief DOCME
|
/// @brief DOCME
|
||||||
///
|
///
|
||||||
/// DOCME
|
/// DOCME
|
||||||
class VisualToolClip : public VisualTool<VisualDraggableFeature> {
|
class VisualToolClip : public VisualTool<ClipCorner> {
|
||||||
private:
|
private:
|
||||||
|
|
||||||
/// DOCME
|
/// DOCME
|
||||||
|
@ -73,9 +87,9 @@ private:
|
||||||
/// @brief DOCME
|
/// @brief DOCME
|
||||||
///
|
///
|
||||||
void PopulateFeatureList();
|
void PopulateFeatureList();
|
||||||
bool InitializeDrag(VisualDraggableFeature &feature);
|
bool InitializeDrag(ClipCorner &feature);
|
||||||
void UpdateDrag(VisualDraggableFeature &feature);
|
void UpdateDrag(ClipCorner &feature);
|
||||||
void CommitDrag(VisualDraggableFeature &feature);
|
void CommitDrag(ClipCorner &feature);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
VisualToolClip(VideoDisplay *parent, VideoState const& video, wxToolBar *);
|
VisualToolClip(VideoDisplay *parent, VideoState const& video, wxToolBar *);
|
||||||
|
|
|
@ -128,11 +128,9 @@ void VisualToolDrag::Draw() {
|
||||||
|
|
||||||
// Draw arrows
|
// Draw arrows
|
||||||
for (size_t i=0;i<features.size();i++) {
|
for (size_t i=0;i<features.size();i++) {
|
||||||
if (features[i].brother[0] != -1 && (features[i].type == DRAG_BIG_CIRCLE || features[i].type == DRAG_BIG_TRIANGLE)) {
|
if (features[i].type == DRAG_BIG_SQUARE) continue;
|
||||||
// Get features
|
VisualDraggableFeature *p2 = &features[i];
|
||||||
VisualDraggableFeature *p1,*p2;
|
VisualDraggableFeature *p1 = &features[features[i].parent];
|
||||||
p2 = &features[i];
|
|
||||||
p1 = &features[p2->brother[0]];
|
|
||||||
|
|
||||||
// Has arrow?
|
// Has arrow?
|
||||||
bool hasArrow = p2->type == DRAG_BIG_CIRCLE;
|
bool hasArrow = p2->type == DRAG_BIG_CIRCLE;
|
||||||
|
@ -174,11 +172,9 @@ void VisualToolDrag::Draw() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/// @brief Populate list
|
/// @brief Populate list
|
||||||
void VisualToolDrag::PopulateFeatureList() {
|
void VisualToolDrag::PopulateFeatureList() {
|
||||||
// Clear features
|
|
||||||
features.clear();
|
features.clear();
|
||||||
|
|
||||||
// Get video data
|
// Get video data
|
||||||
|
@ -204,16 +200,16 @@ void VisualToolDrag::PopulateFeatureList() {
|
||||||
GetLineMove(diag,hasMove,x1,y1,x2,y2,t1,t2);
|
GetLineMove(diag,hasMove,x1,y1,x2,y2,t1,t2);
|
||||||
|
|
||||||
// Create \pos feature
|
// Create \pos feature
|
||||||
VisualDraggableFeature feat;
|
VisualToolDragDraggableFeature feat;
|
||||||
feat.x = x1;
|
feat.x = x1;
|
||||||
feat.y = y1;
|
feat.y = y1;
|
||||||
feat.layer = 0;
|
feat.layer = 0;
|
||||||
feat.type = DRAG_BIG_SQUARE;
|
feat.type = DRAG_BIG_SQUARE;
|
||||||
feat.value = t1;
|
feat.time = t1;
|
||||||
feat.line = diag;
|
feat.line = diag;
|
||||||
feat.lineN = i;
|
feat.lineN = i;
|
||||||
features.push_back(feat);
|
features.push_back(feat);
|
||||||
int parentN = features.size()-1;
|
feat.parent = features.size() - 1;
|
||||||
|
|
||||||
// Create move destination feature
|
// Create move destination feature
|
||||||
if (hasMove) {
|
if (hasMove) {
|
||||||
|
@ -221,32 +217,22 @@ void VisualToolDrag::PopulateFeatureList() {
|
||||||
feat.y = y2;
|
feat.y = y2;
|
||||||
feat.layer = 1;
|
feat.layer = 1;
|
||||||
feat.type = DRAG_BIG_CIRCLE;
|
feat.type = DRAG_BIG_CIRCLE;
|
||||||
feat.value = t2;
|
feat.time = t2;
|
||||||
feat.line = diag;
|
feat.line = diag;
|
||||||
feat.lineN = i;
|
feat.lineN = i;
|
||||||
features.push_back(feat);
|
features.push_back(feat);
|
||||||
|
features[feat.parent].parent = features.size() - 1;
|
||||||
// Add each other as brothers.
|
|
||||||
int n = features.size();
|
|
||||||
features[n-1].brother[0] = parentN;
|
|
||||||
features[parentN].brother[0] = n-1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create org feature
|
// Create org feature
|
||||||
if (torgx != x1 || torgy != y1) {
|
if (torgx != x1 || torgy != y1) {
|
||||||
feat.x = torgx;
|
feat.x = torgx;
|
||||||
feat.y = torgy;
|
feat.y = torgy;
|
||||||
feat.layer = -1;
|
feat.layer = -1;
|
||||||
feat.type = DRAG_BIG_TRIANGLE;
|
feat.type = DRAG_BIG_TRIANGLE;
|
||||||
feat.value = 0;
|
feat.time = 0;
|
||||||
feat.line = diag;
|
feat.line = diag;
|
||||||
feat.lineN = i;
|
feat.lineN = i;
|
||||||
features.push_back(feat);
|
features.push_back(feat);
|
||||||
|
|
||||||
// Add each other as brothers.
|
|
||||||
int n = features.size();
|
|
||||||
features[n-1].brother[0] = parentN;
|
|
||||||
features[parentN].brother[1] = n-1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -255,47 +241,44 @@ void VisualToolDrag::PopulateFeatureList() {
|
||||||
|
|
||||||
/// @brief Update drag
|
/// @brief Update drag
|
||||||
/// @param feature
|
/// @param feature
|
||||||
void VisualToolDrag::UpdateDrag(VisualDraggableFeature &feature) {
|
void VisualToolDrag::UpdateDrag(VisualToolDragDraggableFeature &feature) {
|
||||||
// Update "value" to reflect the time of the frame in which the feature is being dragged
|
// Update "time" to reflect the time of the frame in which the feature is being dragged
|
||||||
int time = VFR_Output.GetTimeAtFrame(frame_n,true,true);
|
int time = VFR_Output.GetTimeAtFrame(frame_n,true,true);
|
||||||
feature.value = MID(0,time - feature.line->Start.GetMS(),feature.line->End.GetMS()-feature.line->Start.GetMS());
|
feature.time = MID(0,time - feature.line->Start.GetMS(),feature.line->End.GetMS()-feature.line->Start.GetMS());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Commit drag
|
/// @brief Commit drag
|
||||||
/// @param feature
|
/// @param feature
|
||||||
void VisualToolDrag::CommitDrag(VisualDraggableFeature &feature) {
|
void VisualToolDrag::CommitDrag(VisualToolDragDraggableFeature &feature) {
|
||||||
// Origin
|
// Origin
|
||||||
if (feature.type == DRAG_BIG_TRIANGLE) {
|
if (feature.type == DRAG_BIG_TRIANGLE) {
|
||||||
int x = feature.x;
|
int x = feature.x;
|
||||||
int y = feature.y;
|
int y = feature.y;
|
||||||
parent->ToScriptCoords(&x, &y);
|
parent->ToScriptCoords(&x, &y);
|
||||||
SetOverride(feature.line, L"\\org",wxString::Format(L"(%i,%i)",x,y));
|
SetOverride(feature.line, L"\\org",wxString::Format(L"(%i,%i)",x,y));
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VisualToolDragDraggableFeature *p = feature->parent > -1 ? &features[feature->parent] : NULL;
|
||||||
|
if (feature->type == DRAG_BIG_CIRCLE) {
|
||||||
|
std::swap(feature, p);
|
||||||
|
}
|
||||||
|
|
||||||
|
int x1 = feature->x;
|
||||||
|
int y1 = feature->y;
|
||||||
|
parent->ToScriptCoords(&x1, &y1);
|
||||||
|
|
||||||
// Position
|
// Position
|
||||||
else if (feature.brother[0] == -1) {
|
if (!p) {
|
||||||
int x = feature.x;
|
SetOverride(feature.line, L"\\pos", wxString::Format(L"(%i,%i)", x1, y1));
|
||||||
int y = feature.y;
|
|
||||||
parent->ToScriptCoords(&x, &y);
|
|
||||||
SetOverride(feature.line, L"\\pos",wxString::Format(L"(%i,%i)",x,y));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Move
|
// Move
|
||||||
else {
|
else {
|
||||||
// Get source on p1 and dest on p2
|
int x2 = p->x;
|
||||||
VisualDraggableFeature *p1,*p2;
|
int y2 = p->y;
|
||||||
p1 = &feature;
|
|
||||||
if (p1->type == DRAG_BIG_CIRCLE) p1 = &features[p1->brother[0]];
|
|
||||||
p2 = &features[p1->brother[0]];
|
|
||||||
|
|
||||||
int x1 = p1->x;
|
|
||||||
int y1 = p1->y;
|
|
||||||
parent->ToScriptCoords(&x1, &y1);
|
|
||||||
int x2 = p2->x;
|
|
||||||
int y2 = p2->y;
|
|
||||||
parent->ToScriptCoords(&x2, &y2);
|
parent->ToScriptCoords(&x2, &y2);
|
||||||
|
|
||||||
// Set override
|
// Set override
|
||||||
SetOverride(feature.line, L"\\move", wxString::Format(L"(%i,%i,%i,%i,%i,%i)", x1, y1, x2, y2, p1->value, p2->value));
|
SetOverride(feature->line, L"\\move", wxString::Format(L"(%i,%i,%i,%i,%i,%i)", x1, y1, x2, y2, feature->time, p->time));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,13 +42,26 @@
|
||||||
#include "visual_feature.h"
|
#include "visual_feature.h"
|
||||||
#include "visual_tool.h"
|
#include "visual_tool.h"
|
||||||
|
|
||||||
|
/// @class VisualToolDragDraggableFeature
|
||||||
|
/// @brief VisualDraggableFeature with a time value
|
||||||
|
class VisualToolDragDraggableFeature : public VisualDraggableFeature {
|
||||||
|
public:
|
||||||
|
int time;
|
||||||
|
int parent;
|
||||||
|
VisualToolDragDraggableFeature()
|
||||||
|
: VisualDraggableFeature()
|
||||||
|
, time(0)
|
||||||
|
, parent(-1)
|
||||||
|
{ }
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/// DOCME
|
/// DOCME
|
||||||
/// @class VisualToolDrag
|
/// @class VisualToolDrag
|
||||||
/// @brief DOCME
|
/// @brief DOCME
|
||||||
///
|
///
|
||||||
/// DOCME
|
/// DOCME
|
||||||
class VisualToolDrag : public VisualTool<VisualDraggableFeature> {
|
class VisualToolDrag : public VisualTool<VisualToolDragDraggableFeature> {
|
||||||
private:
|
private:
|
||||||
/// DOCME
|
/// DOCME
|
||||||
wxToolBar *toolBar;
|
wxToolBar *toolBar;
|
||||||
|
@ -60,8 +73,8 @@ private:
|
||||||
///
|
///
|
||||||
bool CanDrag() { return true; }
|
bool CanDrag() { return true; }
|
||||||
void PopulateFeatureList();
|
void PopulateFeatureList();
|
||||||
void UpdateDrag(VisualDraggableFeature &feature);
|
void UpdateDrag(VisualToolDragDraggableFeature &feature);
|
||||||
void CommitDrag(VisualDraggableFeature &feature);
|
void CommitDrag(VisualToolDragDraggableFeature &feature);
|
||||||
|
|
||||||
void UpdateToggleButtons();
|
void UpdateToggleButtons();
|
||||||
void DoRefresh();
|
void DoRefresh();
|
||||||
|
|
|
@ -206,7 +206,7 @@ void VisualToolVectorClip::Draw() {
|
||||||
void VisualToolVectorClip::PopulateFeatureList() {
|
void VisualToolVectorClip::PopulateFeatureList() {
|
||||||
// Clear
|
// Clear
|
||||||
features.clear();
|
features.clear();
|
||||||
VisualDraggableFeature feat;
|
VisualToolVectorClipDraggableFeature feat;
|
||||||
|
|
||||||
// Go through each curve
|
// Go through each curve
|
||||||
bool isFirst = true;
|
bool isFirst = true;
|
||||||
|
@ -218,8 +218,8 @@ void VisualToolVectorClip::PopulateFeatureList() {
|
||||||
feat.x = (int)cur->p1.x;
|
feat.x = (int)cur->p1.x;
|
||||||
feat.y = (int)cur->p1.y;
|
feat.y = (int)cur->p1.y;
|
||||||
feat.type = DRAG_SMALL_CIRCLE;
|
feat.type = DRAG_SMALL_CIRCLE;
|
||||||
feat.value = i;
|
feat.index = i;
|
||||||
feat.value2 = 0;
|
feat.point = 0;
|
||||||
features.push_back(feat);
|
features.push_back(feat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -228,8 +228,8 @@ void VisualToolVectorClip::PopulateFeatureList() {
|
||||||
feat.x = (int)cur->p2.x;
|
feat.x = (int)cur->p2.x;
|
||||||
feat.y = (int)cur->p2.y;
|
feat.y = (int)cur->p2.y;
|
||||||
feat.type = DRAG_SMALL_CIRCLE;
|
feat.type = DRAG_SMALL_CIRCLE;
|
||||||
feat.value = i;
|
feat.index = i;
|
||||||
feat.value2 = 1;
|
feat.point = 1;
|
||||||
features.push_back(feat);
|
features.push_back(feat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -241,22 +241,20 @@ void VisualToolVectorClip::PopulateFeatureList() {
|
||||||
// Control points
|
// Control points
|
||||||
feat.x = (int)cur->p2.x;
|
feat.x = (int)cur->p2.x;
|
||||||
feat.y = (int)cur->p2.y;
|
feat.y = (int)cur->p2.y;
|
||||||
feat.value = i;
|
feat.index = i;
|
||||||
feat.value2 = 1;
|
feat.point = 1;
|
||||||
feat.brother[0] = size-1;
|
|
||||||
feat.type = DRAG_SMALL_SQUARE;
|
feat.type = DRAG_SMALL_SQUARE;
|
||||||
features.push_back(feat);
|
features.push_back(feat);
|
||||||
feat.x = (int)cur->p3.x;
|
feat.x = (int)cur->p3.x;
|
||||||
feat.y = (int)cur->p3.y;
|
feat.y = (int)cur->p3.y;
|
||||||
feat.value2 = 2;
|
feat.point = 2;
|
||||||
feat.brother[0] = size+2;
|
|
||||||
features.push_back(feat);
|
features.push_back(feat);
|
||||||
|
|
||||||
// End point
|
// End point
|
||||||
feat.x = (int)cur->p4.x;
|
feat.x = (int)cur->p4.x;
|
||||||
feat.y = (int)cur->p4.y;
|
feat.y = (int)cur->p4.y;
|
||||||
feat.type = DRAG_SMALL_CIRCLE;
|
feat.type = DRAG_SMALL_CIRCLE;
|
||||||
feat.value2 = 3;
|
feat.point = 3;
|
||||||
features.push_back(feat);
|
features.push_back(feat);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -264,27 +262,27 @@ void VisualToolVectorClip::PopulateFeatureList() {
|
||||||
|
|
||||||
/// @brief Update
|
/// @brief Update
|
||||||
/// @param feature
|
/// @param feature
|
||||||
void VisualToolVectorClip::UpdateDrag(VisualDraggableFeature &feature) {
|
void VisualToolVectorClip::UpdateDrag(VisualToolVectorClipDraggableFeature &feature) {
|
||||||
spline.MovePoint(feature.value,feature.value2,wxPoint(feature.x,feature.y));
|
spline.MovePoint(feature.index,feature.point,wxPoint(feature.x,feature.y));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Commit
|
/// @brief Commit
|
||||||
/// @param feature
|
/// @param feature
|
||||||
void VisualToolVectorClip::CommitDrag(VisualDraggableFeature &feature) {
|
void VisualToolVectorClip::CommitDrag(VisualToolVectorClipDraggableFeature &feature) {
|
||||||
SetOverride(GetActiveDialogueLine(), inverse ? L"\\iclip" : L"\\clip", L"(" + spline.EncodeToASS() + L")");
|
SetOverride(GetActiveDialogueLine(), inverse ? L"\\iclip" : L"\\clip", L"(" + spline.EncodeToASS() + L")");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Clicked a feature
|
/// @brief Clicked a feature
|
||||||
/// @param feature
|
/// @param feature
|
||||||
/// @return
|
/// @return
|
||||||
bool VisualToolVectorClip::InitializeDrag(VisualDraggableFeature &feature) {
|
bool VisualToolVectorClip::InitializeDrag(VisualToolVectorClipDraggableFeature &feature) {
|
||||||
// Delete a control point
|
// Delete a control point
|
||||||
if (mode == 5) {
|
if (mode == 5) {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (std::list<SplineCurve>::iterator cur=spline.curves.begin();cur!=spline.curves.end();i++,cur++) {
|
for (std::list<SplineCurve>::iterator cur=spline.curves.begin();cur!=spline.curves.end();i++,cur++) {
|
||||||
if (i == feature.value) {
|
if (i == feature.index) {
|
||||||
// Update next
|
// Update next
|
||||||
if (i != 0 || feature.value2 != 0) {
|
if (i != 0 || feature.point != 0) {
|
||||||
std::list<SplineCurve>::iterator next = cur;
|
std::list<SplineCurve>::iterator next = cur;
|
||||||
next++;
|
next++;
|
||||||
if (next != spline.curves.end()) next->p1 = cur->p1;
|
if (next != spline.curves.end()) next->p1 = cur->p1;
|
||||||
|
|
|
@ -40,10 +40,27 @@
|
||||||
|
|
||||||
class wxToolBar;
|
class wxToolBar;
|
||||||
|
|
||||||
|
/// @class VisualToolVectorClipDraggableFeature
|
||||||
|
/// @brief VisualDraggableFeature with information about a feature's location
|
||||||
|
/// in the spline
|
||||||
|
class VisualToolVectorClipDraggableFeature : public VisualDraggableFeature {
|
||||||
|
public:
|
||||||
|
/// Which curve in the spline this feature is a point on
|
||||||
|
int index;
|
||||||
|
/// 0-3; indicates which part of the curve this point is
|
||||||
|
int point;
|
||||||
|
/// @brief Constructor
|
||||||
|
VisualToolVectorClipDraggableFeature()
|
||||||
|
: VisualDraggableFeature()
|
||||||
|
, index(0)
|
||||||
|
, point(0)
|
||||||
|
{ }
|
||||||
|
};
|
||||||
|
|
||||||
/// DOCME
|
/// DOCME
|
||||||
/// @class VisualToolVectorClip
|
/// @class VisualToolVectorClip
|
||||||
/// @brief DOCME
|
/// @brief DOCME
|
||||||
class VisualToolVectorClip : public VisualTool<VisualDraggableFeature> {
|
class VisualToolVectorClip : public VisualTool<VisualToolVectorClipDraggableFeature> {
|
||||||
private:
|
private:
|
||||||
|
|
||||||
/// DOCME
|
/// DOCME
|
||||||
|
@ -75,9 +92,9 @@ private:
|
||||||
|
|
||||||
|
|
||||||
void PopulateFeatureList();
|
void PopulateFeatureList();
|
||||||
void UpdateDrag(VisualDraggableFeature &feature);
|
void UpdateDrag(VisualToolVectorClipDraggableFeature &feature);
|
||||||
void CommitDrag(VisualDraggableFeature &feature);
|
void CommitDrag(VisualToolVectorClipDraggableFeature &feature);
|
||||||
bool InitializeDrag(VisualDraggableFeature &feature);
|
bool InitializeDrag(VisualToolVectorClipDraggableFeature &feature);
|
||||||
|
|
||||||
void DoRefresh();
|
void DoRefresh();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue