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:
Thomas Goyne 2010-05-01 01:45:16 +00:00
parent 5cbabf2d35
commit c7e06e9451
7 changed files with 22 additions and 24 deletions

View File

@ -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)

View File

@ -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;

View File

@ -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();

View File

@ -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;

View File

@ -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);

View File

@ -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);
}

View File

@ -214,14 +214,12 @@ 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);
}
}
}
// Draw preview of insert point
if (mode == 4) DrawCircle(pt.x,pt.y,4);