forked from mia/Aegisub
Implemented delete point function to vector clip tool.
Originally committed to SVN as r1388.
This commit is contained in:
parent
d1d8302548
commit
ee832d642d
3 changed files with 38 additions and 12 deletions
|
@ -175,8 +175,7 @@ void VisualTool::OnMouseEvent (wxMouseEvent &event) {
|
||||||
if (realTime) {
|
if (realTime) {
|
||||||
// Commit
|
// Commit
|
||||||
CommitDrag(features[curFeature]);
|
CommitDrag(features[curFeature]);
|
||||||
grid->editBox->CommitText(true);
|
Commit();
|
||||||
grid->CommitChanges(false,true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -188,9 +187,7 @@ void VisualTool::OnMouseEvent (wxMouseEvent &event) {
|
||||||
// Commit
|
// Commit
|
||||||
dragging = false;
|
dragging = false;
|
||||||
CommitDrag(features[curFeature]);
|
CommitDrag(features[curFeature]);
|
||||||
grid->editBox->CommitText();
|
Commit(true);
|
||||||
grid->ass->FlagAsModified(_("visual typesetting"));
|
|
||||||
grid->CommitChanges(false);
|
|
||||||
|
|
||||||
// Clean up
|
// Clean up
|
||||||
curFeature = -1;
|
curFeature = -1;
|
||||||
|
@ -227,8 +224,7 @@ void VisualTool::OnMouseEvent (wxMouseEvent &event) {
|
||||||
if (realTime) {
|
if (realTime) {
|
||||||
// Commit
|
// Commit
|
||||||
CommitHold();
|
CommitHold();
|
||||||
grid->editBox->CommitText(true);
|
Commit();
|
||||||
grid->CommitChanges(false,true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -240,9 +236,7 @@ void VisualTool::OnMouseEvent (wxMouseEvent &event) {
|
||||||
// Commit
|
// Commit
|
||||||
holding = false;
|
holding = false;
|
||||||
CommitHold();
|
CommitHold();
|
||||||
grid->editBox->CommitText();
|
Commit(true);
|
||||||
grid->ass->FlagAsModified(_("visual typesetting"));
|
|
||||||
grid->CommitChanges(false);
|
|
||||||
|
|
||||||
// Clean up
|
// Clean up
|
||||||
curDiag = NULL;
|
curDiag = NULL;
|
||||||
|
@ -257,6 +251,16 @@ void VisualTool::OnMouseEvent (wxMouseEvent &event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//////////
|
||||||
|
// Commit
|
||||||
|
void VisualTool::Commit(bool full) {
|
||||||
|
SubtitlesGrid *grid = VideoContext::Get()->grid;
|
||||||
|
if (full) grid->editBox->CommitText();
|
||||||
|
grid->ass->FlagAsModified(_("visual typesetting"));
|
||||||
|
grid->CommitChanges(false,!full);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////
|
////////////////////////////
|
||||||
// Get active dialogue line
|
// Get active dialogue line
|
||||||
AssDialogue* VisualTool::GetActiveDialogueLine() {
|
AssDialogue* VisualTool::GetActiveDialogueLine() {
|
||||||
|
|
|
@ -115,6 +115,7 @@ protected:
|
||||||
AssDialogue *GetActiveDialogueLine();
|
AssDialogue *GetActiveDialogueLine();
|
||||||
int GetHighlightedFeature();
|
int GetHighlightedFeature();
|
||||||
void DrawAllFeatures();
|
void DrawAllFeatures();
|
||||||
|
void Commit(bool full=false);
|
||||||
|
|
||||||
void ConnectButton(wxButton *button);
|
void ConnectButton(wxButton *button);
|
||||||
virtual void OnButton(wxCommandEvent &event) {}
|
virtual void OnButton(wxCommandEvent &event) {}
|
||||||
|
|
|
@ -46,9 +46,9 @@ enum {
|
||||||
BUTTON_DRAG = VISUAL_SUB_TOOL_START,
|
BUTTON_DRAG = VISUAL_SUB_TOOL_START,
|
||||||
BUTTON_LINE,
|
BUTTON_LINE,
|
||||||
BUTTON_BICUBIC,
|
BUTTON_BICUBIC,
|
||||||
|
BUTTON_CONVERT,
|
||||||
BUTTON_INSERT,
|
BUTTON_INSERT,
|
||||||
BUTTON_REMOVE,
|
BUTTON_REMOVE,
|
||||||
BUTTON_CONVERT,
|
|
||||||
BUTTON_FREEHAND,
|
BUTTON_FREEHAND,
|
||||||
BUTTON_FREEHAND_SMOOTH,
|
BUTTON_FREEHAND_SMOOTH,
|
||||||
BUTTON_LAST // Leave this at the end and don't use it
|
BUTTON_LAST // Leave this at the end and don't use it
|
||||||
|
@ -256,6 +256,27 @@ void VisualToolVectorClip::CommitDrag(VisualDraggableFeature &feature) {
|
||||||
/////////////////////
|
/////////////////////
|
||||||
// Clicked a feature
|
// Clicked a feature
|
||||||
void VisualToolVectorClip::ClickedFeature(VisualDraggableFeature &feature) {
|
void VisualToolVectorClip::ClickedFeature(VisualDraggableFeature &feature) {
|
||||||
|
// Delete a control point
|
||||||
|
if (mode == 5) {
|
||||||
|
int i = 0;
|
||||||
|
for (std::list<SplineCurve>::iterator cur=spline.curves.begin();cur!=spline.curves.end();i++,cur++) {
|
||||||
|
if (i == feature.value) {
|
||||||
|
// Update next
|
||||||
|
if (i != 0 || feature.value2 != 0) {
|
||||||
|
std::list<SplineCurve>::iterator next = cur;
|
||||||
|
next++;
|
||||||
|
if (next != spline.curves.end()) next->p1 = cur->p1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Erase and save changes
|
||||||
|
spline.curves.erase(cur);
|
||||||
|
SetOverride(_T("\\clip"),_T("(") + spline.EncodeToASS() + _T(")"));
|
||||||
|
curFeature = -1;
|
||||||
|
Commit(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -375,7 +396,7 @@ void VisualToolVectorClip::DoRefresh() {
|
||||||
wxString vect;
|
wxString vect;
|
||||||
int scale;
|
int scale;
|
||||||
vect = GetLineVectorClip(line,scale);
|
vect = GetLineVectorClip(line,scale);
|
||||||
if (vect.IsEmpty()) return;
|
//if (!vect.IsEmpty()) return;
|
||||||
spline.DecodeFromASS(vect);
|
spline.DecodeFromASS(vect);
|
||||||
PopulateFeatureList();
|
PopulateFeatureList();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue