Change the uses of -1 for invalid positions in the visual typesetting tools to INT_MIN, as -1 is sometimes a perfectly valid coordinate
Originally committed to SVN as r4258.
This commit is contained in:
parent
5cbabf2d35
commit
c7e06e9451
7 changed files with 22 additions and 24 deletions
|
@ -120,7 +120,7 @@ VideoDisplay::VideoDisplay(VideoBox *box, VideoSlider *ControlSlider, wxTextCtrl
|
|||
, origSize(size)
|
||||
, currentFrame(-1)
|
||||
, w(8), h(8), dx1(0), dx2(8), dy1(0), dy2(8)
|
||||
, mouse_x(-1), mouse_y(-1)
|
||||
, mouse_x(INT_MIN), mouse_y(INT_MIN)
|
||||
, locked(false)
|
||||
, zoomValue(1.0)
|
||||
, ControlSlider(ControlSlider)
|
||||
|
|
|
@ -48,8 +48,8 @@
|
|||
///
|
||||
VisualDraggableFeature::VisualDraggableFeature() {
|
||||
type = DRAG_NONE;
|
||||
x = -1;
|
||||
y = -1;
|
||||
x = INT_MIN;
|
||||
y = INT_MIN;
|
||||
value = value2 = 0;
|
||||
layer = 0;
|
||||
lineN = -1;
|
||||
|
|
|
@ -87,7 +87,7 @@ VisualTool::VisualTool(VideoDisplay *par) : eventSink(this) {
|
|||
dragListOK = false;
|
||||
|
||||
// Video options
|
||||
mouseX = mouseY = -1;
|
||||
mouseX = mouseY = INT_MIN;
|
||||
frame_n = 0;
|
||||
if (VideoContext::Get()->IsLoaded()) {
|
||||
parent->GetClientSize(&w,&h);
|
||||
|
@ -124,10 +124,10 @@ void VisualTool::OnMouseEvent (wxMouseEvent &event) {
|
|||
|
||||
// Mouse leaving control
|
||||
if (event.Leaving()) {
|
||||
mouseX = -1;
|
||||
mouseY = -1;
|
||||
mx = -1;
|
||||
my = -1;
|
||||
mouseX = INT_MIN;
|
||||
mouseY = INT_MIN;
|
||||
mx = INT_MIN;
|
||||
my = INT_MIN;
|
||||
Update();
|
||||
return;
|
||||
}
|
||||
|
@ -393,10 +393,10 @@ void VisualTool::GetLinePosition(AssDialogue *diag,int &x, int &y) {
|
|||
void VisualTool::GetLinePosition(AssDialogue *diag,int &x, int &y, int &orgx, int &orgy) {
|
||||
// No dialogue
|
||||
if (!diag) {
|
||||
x = -1;
|
||||
y = -1;
|
||||
orgx = -1;
|
||||
orgy = -1;
|
||||
x = INT_MIN;
|
||||
y = INT_MIN;
|
||||
orgx = INT_MIN;
|
||||
orgy = INT_MIN;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -426,8 +426,8 @@ void VisualTool::GetLinePosition(AssDialogue *diag,int &x, int &y, int &orgx, in
|
|||
// Position
|
||||
bool posSet = false;
|
||||
bool orgSet = false;
|
||||
int posx = -1;
|
||||
int posy = -1;
|
||||
int posx = INT_MIN;
|
||||
int posy = INT_MIN;
|
||||
|
||||
// Overrides processing
|
||||
diag->ParseASSTags();
|
||||
|
|
|
@ -80,7 +80,7 @@ void VisualToolClip::Update() {
|
|||
/// @return
|
||||
///
|
||||
void VisualToolClip::Draw() {
|
||||
if (mouseX == -1 || mouseY == -1) return;
|
||||
if (mouseX == INT_MIN || mouseY == INT_MIN) return;
|
||||
// Get current line
|
||||
AssDialogue *line = GetActiveDialogueLine();
|
||||
if (!line) return;
|
||||
|
|
|
@ -90,7 +90,7 @@ void VisualToolCross::Update() {
|
|||
/// @brief Draw
|
||||
///
|
||||
void VisualToolCross::Draw() {
|
||||
if (mouseX == -1 || mouseY == -1) return;
|
||||
if (mouseX == INT_MIN || mouseY == INT_MIN) return;
|
||||
|
||||
// Draw cross
|
||||
glDisable(GL_LINE_SMOOTH);
|
||||
|
|
|
@ -160,7 +160,7 @@ void VisualToolRotateZ::Draw() {
|
|||
glPopMatrix();
|
||||
|
||||
// Draw line to mouse
|
||||
if (mouseX != -1 && !dragging && GetHighlightedFeature() == -1) {
|
||||
if (!dragging && GetHighlightedFeature() == -1) {
|
||||
SetLineColour(colour[0]);
|
||||
DrawLine(dx,dy,mx,my);
|
||||
}
|
||||
|
|
|
@ -214,12 +214,10 @@ void VisualToolVectorClip::Draw() {
|
|||
// Draw preview of inserted line
|
||||
if (mode == 1 || mode == 2) {
|
||||
if (spline.curves.size()) {
|
||||
if (mx != -1 || my != -1) {
|
||||
SplineCurve *c0 = &spline.curves.front();
|
||||
SplineCurve *c1 = &spline.curves.back();
|
||||
DrawDashedLine(mx,my,c0->p1.x,c0->p1.y,6);
|
||||
DrawDashedLine(mx,my,c1->GetEndPoint().x,c1->GetEndPoint().y,6);
|
||||
}
|
||||
SplineCurve *c0 = &spline.curves.front();
|
||||
SplineCurve *c1 = &spline.curves.back();
|
||||
DrawDashedLine(mx,my,c0->p1.x,c0->p1.y,6);
|
||||
DrawDashedLine(mx,my,c1->GetEndPoint().x,c1->GetEndPoint().y,6);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -492,7 +490,7 @@ void VisualToolVectorClip::UpdateHold() {
|
|||
|
||||
// Freehand
|
||||
if (mode == 6 || mode == 7) {
|
||||
if (lastX != -100000 && lastY != -100000) {
|
||||
if (lastX != -100000 && lastY != -100000) {
|
||||
// See if distance is enough
|
||||
Vector2D delta(lastX-mx,lastY-my);
|
||||
int len = (int)delta.Len();
|
||||
|
|
Loading…
Reference in a new issue