Fix bad coordinate conversion in the clip visual tool

Originally committed to SVN as r4315.
This commit is contained in:
Thomas Goyne 2010-05-20 08:55:18 +00:00
parent 0e527355eb
commit 2ec4a97dbb
3 changed files with 10 additions and 10 deletions

View file

@ -100,6 +100,7 @@ private:
/// DOCME /// DOCME
VisualToolEvent eventSink; VisualToolEvent eventSink;
int GetHighlightedFeature();
protected: protected:
/// DOCME /// DOCME
VideoDisplay *parent; VideoDisplay *parent;
@ -165,12 +166,10 @@ protected:
void GetLineScale(AssDialogue *diag,float &scalX,float &scalY); void GetLineScale(AssDialogue *diag,float &scalX,float &scalY);
void GetLineClip(AssDialogue *diag,int &x1,int &y1,int &x2,int &y2,bool &inverse); void GetLineClip(AssDialogue *diag,int &x1,int &y1,int &x2,int &y2,bool &inverse);
wxString GetLineVectorClip(AssDialogue *diag,int &scale,bool &inverse); wxString GetLineVectorClip(AssDialogue *diag,int &scale,bool &inverse);
void FillPositionData();
void SetOverride(wxString tag,wxString value); void SetOverride(wxString tag,wxString value);
AssDialogue *GetActiveDialogueLine(); AssDialogue *GetActiveDialogueLine();
int GetHighlightedFeature();
void DrawAllFeatures(); void DrawAllFeatures();
void Commit(bool full=false); void Commit(bool full=false);
@ -252,7 +251,7 @@ public:
/// @brief DOCME /// @brief DOCME
/// @param event /// @param event
/// ///
virtual void OnSubTool(wxCommandEvent &event) {} virtual void OnSubTool(wxCommandEvent &) {}
virtual void Update() { }; virtual void Update() { };
virtual void Draw()=0; virtual void Draw()=0;
void Refresh(); void Refresh();

View file

@ -144,12 +144,13 @@ void VisualToolClip::UpdateHold() {
/// @brief Commit hold /// @brief Commit hold
/// ///
void VisualToolClip::CommitHold() { void VisualToolClip::CommitHold() {
parent->ToScriptCoords(&curX1, &curY1); int x1 = curX1;
parent->ToScriptCoords(&curX2, &curY2); int x2 = curX2;
if (inverse) int y1 = curY1;
SetOverride(L"\\iclip",wxString::Format(L"(%i,%i,%i,%i)",curX1,curY1,curX2,curY2)); int y2 = curY2;
else parent->ToScriptCoords(&x1, &y1);
SetOverride(L"\\clip",wxString::Format(L"(%i,%i,%i,%i)",curX1,curY1,curX2,curY2)); parent->ToScriptCoords(&x2, &y2);
SetOverride(GetActiveDialogueLine(), inverse ? L"\\iclip" : L"\\clip",wxString::Format(L"(%i,%i,%i,%i)",x1,y1,x2,y2));
} }

View file

@ -147,7 +147,7 @@ void VisualToolRotateZ::Draw() {
glPopMatrix(); glPopMatrix();
// Draw line to mouse // Draw line to mouse
if (!dragging && GetHighlightedFeature() == -1) { if (!dragging && curFeature == -1) {
SetLineColour(colour[0]); SetLineColour(colour[0]);
DrawLine(dx,dy,video.x,video.y); DrawLine(dx,dy,video.x,video.y);
} }