2 // TTEDIT.CPP - The TrueType Editor
4 // (C) 2004 Underground Software
6 // JLH = James L. Hammons <jlhamm@acm.org>
9 // --- ---------- -------------------------------------------------------------
10 // JLH 08/28/2008 Created this file
11 // JLH 09/02/2008 Separated scrolling from dedicated tool to MMB drag
12 // JLH 03/13/2009 Converted from wxWidgets to Qt
21 // - Fix bug in Glyphpoints when dragging on an empty canvas or loading a font
22 // - Fix zooming, settings (ini)
23 // - Fix point adding bug 1: should be able to add points to empty canvas
24 // - Fix point adding bug 2: should be able to add point successfully to single
26 // - Add poly multi-select
27 // - Add point multi-select
31 // Uncomment this for debugging...
33 #define DEBUGFOO // Various tool debugging...
34 #define DEBUGTP // Toolpalette debugging...
36 #include "editwindow.h"
37 #include "charwindow.h"
39 #include "graphicprimitives.h"
40 #include "mainwindow.h"
45 EditWindow::EditWindow(QWidget * parent/*= NULL*/): QWidget(parent),
46 scale(1.0), offsetX(-10), offsetY(-10), tool(TOOLSelect),
47 ptHighlight(-1), oldPtHighlight(-1), ptNextHighlight(-1), oldPtNextHighlight(-1),
48 polyFirstPoint(true), showRotationCenter(false), haveZeroPoint(false)
50 setBackgroundRole(QPalette::Base);
51 setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
53 toolPalette = new ToolWindow();
55 setCursor(cur[TOOLSelect]);
56 setMouseTracking(true);
60 QSize EditWindow::minimumSizeHint() const
66 QSize EditWindow::sizeHint() const
68 return QSize(400, 400);
72 void EditWindow::CreateCursors(void)
74 int hotx[10] = { 1, 1, 11, 15, 1, 1, 1, 1, 1, 1 };
75 int hoty[10] = { 1, 1, 11, 13, 1, 1, 1, 1, 1, 1 };
76 char cursorName[10][48] = { "select", "select-poly", "scroll", "zoom", "add-point",
77 "add-poly", "del-point", "del-poly", "rotate", "rotate" };
79 for(int i=0; i<10; i++)
82 s.sprintf(":/res/cursor-%s.png", cursorName[i]);
84 cur[i] = QCursor(pmTmp, hotx[i], hoty[i]);
89 QPoint EditWindow::GetAdjustedMousePosition(QMouseEvent * event)
91 QSize winSize = size();
92 // This is undoing the transform, e.g. going from client coords to local coords.
93 // In essence, the height - y is height + (y * -1), the (y * -1) term doing the
94 // conversion of the y-axis from increasing bottom to top.
95 return QPoint(offsetX + event->x(), offsetY + (winSize.height() - event->y()));
99 QPoint EditWindow::GetAdjustedClientPosition(int x, int y)
101 QSize winSize = size();
103 // VOODOO ALERT (ON Y COMPONENT!!!!)
104 return QPoint(-offsetX + x, (winSize.height() - (-offsetY + y)) * +1.0);
110 o Different colors for polys on selected points
111 o Different colors for handles on non-selected polys
112 o Line of sight (dashed, dotted) for off-curve points
113 o Repaints for press/release of CTRL/SHIFT during point creation
115 void EditWindow::paintEvent(QPaintEvent * /*event*/)
118 //hm, causes lockup (or does it???)
119 p.setRenderHint(QPainter::Antialiasing);
121 //dc.SetBackground(*wxWHITE_BRUSH);
123 // Due to the screwiness of wxWidgets coord system, the origin is ALWAYS
124 // the upper left corner--regardless of axis orientation, etc...
125 // int width, height;
126 // dc.GetSize(&width, &height);
127 QSize winSize = size();
129 // dc.SetDeviceOrigin(-offsetX, height - (-offsetY));
130 // dc.SetAxisOrientation(true, true);
131 p.translate(QPoint(-offsetX, winSize.height() - (-offsetY)));
134 // Scrolling can be done by using OffsetViewportOrgEx
135 // Scaling can be done by adjusting SetWindowExtEx (it's denominator of txform)
136 // you'd use: % = ViewportExt / WindowExt
137 // But it makes the window look like crap: fuggetuboutit.
138 // Instead, we have to scale EVERYTHING by hand. Crap!
139 // It's not *that* bad, but not as convenient either...
141 // dc.SetPen(*(wxThePenList->FindOrCreatePen(wxColour(0x00, 0x00, 0xFF), 1, wxDOT)));
142 //// dc.DrawLine(0, 0, 10, 10);
143 p.setPen(QPen(Qt::blue, 1.0, Qt::DotLine));
145 // Draw coordinate axes
147 // dc.CrossHair(0, 0);
148 p.drawLine(0, -16384, 0, 16384);
149 p.drawLine(-16384, 0, 16384, 0);
151 // Draw rotation center (if active)
153 if (showRotationCenter)
155 p.setPen(QPen(Qt::red, 2.0, Qt::SolidLine));
156 p.drawLine(rotationCenter.x() + 7, rotationCenter.y(), rotationCenter.x() - 7, rotationCenter.y());
157 p.drawLine(rotationCenter.x(), rotationCenter.y() + 7, rotationCenter.x(), rotationCenter.y() - 7);
162 for(int i=0; i<pts.GetNumPoints(); i++)
164 if (i == ptHighlight)
166 // dc.SetPen(*(wxThePenList->FindOrCreatePen(wxColour(0xFF, 0x00, 0x00), 1, wxSOLID)));
167 //// SelectObject(hdc, hRedPen1);
168 p.setPen(QPen(Qt::red, 1.0, Qt::SolidLine));
170 if (pts.GetOnCurve(i))
172 DrawSquareDotN(p, pts.GetX(i), pts.GetY(i), 7);
173 DrawSquareDotN(p, pts.GetX(i), pts.GetY(i), 9);
177 DrawRoundDotN(p, pts.GetX(i), pts.GetY(i), 7);
178 DrawRoundDotN(p, pts.GetX(i), pts.GetY(i), 9);
181 else if ((i == ptHighlight || i == ptNextHighlight) && tool == TOOLAddPt)
183 // dc.SetPen(*(wxThePenList->FindOrCreatePen(wxColour(0x00, 0xAF, 0x00), 1, wxSOLID)));
184 //// SelectObject(hdc, hGreenPen1);
185 p.setPen(QPen(Qt::green, 1.0, Qt::SolidLine));
187 if (pts.GetOnCurve(i))
189 DrawSquareDotN(p, pts.GetX(i), pts.GetY(i), 7);
190 DrawSquareDotN(p, pts.GetX(i), pts.GetY(i), 9);
194 DrawRoundDotN(p, pts.GetX(i), pts.GetY(i), 7);
195 DrawRoundDotN(p, pts.GetX(i), pts.GetY(i), 9);
200 // dc.SetPen(*(wxThePenList->FindOrCreatePen(wxColour(0x00, 0x00, 0x00), 1, wxSOLID)));
201 //// SelectObject(hdc, hBlackPen1);
202 p.setPen(QPen(Qt::black, 1.0, Qt::SolidLine));
204 if (pts.GetOnCurve(i))
205 DrawSquareDot(p, pts.GetX(i), pts.GetY(i));
207 DrawRoundDot(p, pts.GetX(i), pts.GetY(i));
210 if (tool == TOOLDelPt && i == ptHighlight)
213 dc.SetPen(*(wxThePenList->FindOrCreatePen(wxColour(0xFF, 0x00, 0x00), 1, wxSOLID)));
214 // SelectObject(hdc, hRedPen1);
215 // MoveToEx(hdc, pts.GetX(i) - 5, pts.GetY(i) - 5, NULL);
216 // LineTo(hdc, pts.GetX(i) + 5, pts.GetY(i) + 5);
217 // LineTo(hdc, pts.GetX(i) - 5, pts.GetY(i) - 5);//Lameness!
218 // MoveToEx(hdc, pts.GetX(i) - 5, pts.GetY(i) + 5, NULL);
219 // LineTo(hdc, pts.GetX(i) + 5, pts.GetY(i) - 5);
220 // LineTo(hdc, pts.GetX(i) - 5, pts.GetY(i) + 5);//More lameness!!
222 p.setPen(QPen(Qt::red, 1.0, Qt::SolidLine));
223 p.drawLine(pts.GetX(i) - 5, pts.GetY(i) - 5, pts.GetX(i) + 5, pts.GetY(i) + 5);
224 p.drawLine(pts.GetX(i) + 5, pts.GetY(i) - 5, pts.GetX(i) - 5, pts.GetY(i) + 5);
228 //// SelectObject(hdc, hBlackPen1);
229 // dc.SetPen(*(wxThePenList->FindOrCreatePen(wxColour(0x00, 0x00, 0x00), 1, wxSOLID)));
230 p.setPen(QPen(Qt::black, 1.0, Qt::SolidLine));
232 // Draw curve formed by points
234 for(int poly=0; poly<pts.GetNumPolys(); poly++)
236 if (pts.GetNumPoints(poly) > 2)
239 // If it's not on curve, then move to it, otherwise move to last point...
243 if (pts.GetOnCurve(poly, pts.GetNumPoints(poly) - 1))
244 x = (int)pts.GetX(poly, pts.GetNumPoints(poly) - 1), y = (int)pts.GetY(poly, pts.GetNumPoints(poly) - 1);
246 x = (int)pts.GetX(poly, 0), y = (int)pts.GetY(poly, 0);
248 for(int i=0; i<pts.GetNumPoints(poly); i++)
250 if (pts.GetOnCurve(poly, i))
251 // LineTo(hdc, pts.GetX(poly, i), pts.GetY(poly, i));
253 p.drawLine(x, y, pts.GetX(poly, i), pts.GetY(poly, i));
254 x = (int)pts.GetX(poly, i), y = (int)pts.GetY(poly, i);
258 uint32 prev = pts.GetPrev(poly, i), next = pts.GetNext(poly, i);
259 float px = pts.GetX(poly, prev), py = pts.GetY(poly, prev),
260 nx = pts.GetX(poly, next), ny = pts.GetY(poly, next);
262 if (!pts.GetOnCurve(poly, prev))
263 px = (px + pts.GetX(poly, i)) / 2.0f,
264 py = (py + pts.GetY(poly, i)) / 2.0f;
266 if (!pts.GetOnCurve(poly, next))
267 nx = (nx + pts.GetX(poly, i)) / 2.0f,
268 ny = (ny + pts.GetY(poly, i)) / 2.0f;
270 Bezier(p, point(px, py), point(pts.GetX(poly, i), pts.GetY(poly, i)), point(nx, ny));
271 x = (int)nx, y = (int)ny;
273 if (pts.GetOnCurve(poly, next))
274 i++; // Following point is on curve, so move past it
283 GlyphPoints rotated = pts;
284 rotated.RotatePoints(rotationAngle, IPoint(rotationCenter.x(), rotationCenter.y()));
285 p.setPen(QPen(QColor(255, 0, 255), 1.0, Qt::SolidLine));
287 for(int poly=0; poly<rotated.GetNumPolys(); poly++)
289 if (rotated.GetNumPoints(poly) > 2)
292 // If it's not on curve, then move to it, otherwise move to last point...
296 if (rotated.GetOnCurve(poly, rotated.GetNumPoints(poly) - 1))
297 x = (int)rotated.GetX(poly, rotated.GetNumPoints(poly) - 1), y = (int)rotated.GetY(poly, rotated.GetNumPoints(poly) - 1);
299 x = (int)rotated.GetX(poly, 0), y = (int)rotated.GetY(poly, 0);
301 for(int i=0; i<rotated.GetNumPoints(poly); i++)
303 if (rotated.GetOnCurve(poly, i))
304 // LineTo(hdc, rotated.GetX(poly, i), rotated.GetY(poly, i));
306 p.drawLine(x, y, rotated.GetX(poly, i), rotated.GetY(poly, i));
307 x = (int)rotated.GetX(poly, i), y = (int)rotated.GetY(poly, i);
311 uint32 prev = rotated.GetPrev(poly, i), next = rotated.GetNext(poly, i);
312 float px = rotated.GetX(poly, prev), py = rotated.GetY(poly, prev),
313 nx = rotated.GetX(poly, next), ny = rotated.GetY(poly, next);
315 if (!rotated.GetOnCurve(poly, prev))
316 px = (px + rotated.GetX(poly, i)) / 2.0f,
317 py = (py + rotated.GetY(poly, i)) / 2.0f;
319 if (!rotated.GetOnCurve(poly, next))
320 nx = (nx + rotated.GetX(poly, i)) / 2.0f,
321 ny = (ny + rotated.GetY(poly, i)) / 2.0f;
323 Bezier(p, point(px, py), point(rotated.GetX(poly, i), rotated.GetY(poly, i)), point(nx, ny));
324 x = (int)nx, y = (int)ny;
326 if (rotated.GetOnCurve(poly, next))
327 i++; // Following point is on curve, so move past it
333 DrawGlyph(p, rotated);
339 void EditWindow::DrawGlyph(QPainter & p, GlyphPoints & glyph)
341 for(int poly=0; poly<glyph.GetNumPolys(); poly++)
343 if (glyph.GetNumPoints(poly) > 2)
346 // If it's not on curve, then move to it, otherwise move to last point...
350 if (glyph.GetOnCurve(poly, glyph.GetNumPoints(poly) - 1))
351 x = (int)glyph.GetX(poly, glyph.GetNumPoints(poly) - 1), y = (int)glyph.GetY(poly, glyph.GetNumPoints(poly) - 1);
353 x = (int)glyph.GetX(poly, 0), y = (int)glyph.GetY(poly, 0);
355 for(int i=0; i<glyph.GetNumPoints(poly); i++)
357 if (glyph.GetOnCurve(poly, i))
359 p.drawLine(x, y, glyph.GetX(poly, i), glyph.GetY(poly, i));
360 x = (int)glyph.GetX(poly, i), y = (int)glyph.GetY(poly, i);
364 uint32 prev = glyph.GetPrev(poly, i), next = glyph.GetNext(poly, i);
365 float px = glyph.GetX(poly, prev), py = glyph.GetY(poly, prev),
366 nx = glyph.GetX(poly, next), ny = glyph.GetY(poly, next);
368 if (!glyph.GetOnCurve(poly, prev))
369 px = (px + glyph.GetX(poly, i)) / 2.0f,
370 py = (py + glyph.GetY(poly, i)) / 2.0f;
372 if (!glyph.GetOnCurve(poly, next))
373 nx = (nx + glyph.GetX(poly, i)) / 2.0f,
374 ny = (ny + glyph.GetY(poly, i)) / 2.0f;
376 Bezier(p, point(px, py), point(glyph.GetX(poly, i), glyph.GetY(poly, i)), point(nx, ny));
377 x = (int)nx, y = (int)ny;
379 if (glyph.GetOnCurve(poly, next))
380 i++; // Following point is on curve, so move past it
388 void EditWindow::mousePressEvent(QMouseEvent * event)
390 if (event->button() == Qt::RightButton)
392 toolPalette->move(event->globalPos());
393 toolPalette->setVisible(true);
394 setCursor(cur[TOOLSelect]);
395 toolPalette->prevTool = TOOLSelect;
397 else if (event->button() == Qt::MidButton)
399 setCursor(cur[2]); // Scrolling cursor
401 else if (event->button() == Qt::LeftButton)
403 if (tool == TOOLScroll || tool == TOOLZoom)
404 ;//meh CaptureMouse(); // Make sure we capture the mouse when in scroll/zoom mode
405 else if (tool == TOOLAddPt) // "Add Point" tool
407 if (pts.GetNumPoints() > 0)
409 QPoint pt = GetAdjustedMousePosition(event);
410 pts.InsertPoint(pts.GetNext(ptHighlight), pt.x(), pt.y(), ((event->modifiers() == Qt::ShiftModifier || event->modifiers() == Qt::ControlModifier) ? false : true));
411 ptHighlight = ptNextHighlight;
415 else if (tool == TOOLAddPoly) // "Add Poly" tool
418 WriteLogMsg("Adding point... # polys: %u, # points: %u", pts.GetNumPolys(), pts.GetNumPoints());
422 polyFirstPoint = false;
423 pts.AddNewPolyAtEnd();
426 QPoint pt = GetAdjustedMousePosition(event);
427 //printf("GetAdjustedMousePosition = %i, %i\n", pt.x(), pt.y());
428 // Append a point to the end of the structure
429 pts += IPoint(pt.x(), pt.y(), ((event->modifiers() == Qt::ShiftModifier || event->modifiers() == Qt::ControlModifier) ? false : true));
430 ptHighlight = pts.GetNumPoints() - 1;
433 WriteLogMsg(" --> [# polys: %u, # points: %u]\n", pts.GetNumPolys(), pts.GetNumPoints());
436 else if (tool == TOOLSelect || tool == TOOLPolySelect)
438 if (pts.GetNumPoints() > 0)
440 pt = GetAdjustedClientPosition(pts.GetX(ptHighlight), pts.GetY(ptHighlight));
441 //printf("GetAdjustedClientPosition = %i, %i\n", pt.x(), pt.y());
442 // WarpPointer(pt.x, pt.y);
443 QCursor::setPos(mapToGlobal(pt));
445 if (event->modifiers() == Qt::ShiftModifier || event->modifiers() == Qt::ControlModifier)
447 pts.SetOnCurve(ptHighlight, !pts.GetOnCurve(ptHighlight));
452 else if (tool == TOOLDelPt)
454 if (pts.GetNumPoints() > 0)
456 // if (ptHighlight != -1)
458 //This assumes that WM_MOUSEMOVE happens before this!
459 //The above commented out line should take care of this contingency... !!! FIX !!!
460 pts.DeletePoint(ptHighlight);
464 else if (tool == TOOLRotate)
466 // I think what's needed here is to keep the initial mouse click,
467 // paint the rotation center, then use the 1st mouse move event to establish
468 // the rotation "zero line", which becomes the line of reference to all
469 // subsequent mouse moves.
470 rotationCenter = GetAdjustedMousePosition(event);
471 showRotationCenter = true;
472 haveZeroPoint = false;
482 void EditWindow::mouseMoveEvent(QMouseEvent * event)
484 if (event->buttons() == Qt::RightButton)
486 ToolType newTool = toolPalette->FindSelectedTool();
488 if (newTool != toolPalette->prevTool)
490 toolPalette->prevTool = newTool;
491 toolPalette->repaint();
494 else if (event->buttons() == Qt::MidButton)
496 // Calc offset from previous point
498 ptOffset = QPoint(pt.x() - ptPrevious.x(), pt.y() - ptPrevious.y());
500 // Then multiply it by the scaling factor. Whee!
501 // This looks wacky because we're using screen coords for the offset...
502 // Otherwise, we would subtract both offsets!
503 offsetX -= ptOffset.x(), offsetY += ptOffset.y();
507 else if (event->buttons() == Qt::LeftButton)
509 if (tool == TOOLAddPt || tool == TOOLAddPoly || tool == TOOLSelect)
511 if (tool != TOOLAddPt || pts.GetNumPoints() > 0)//yecch.
513 //temporary, for testing. BTW, Select drag bug is here...!
515 QPoint pt2 = GetAdjustedMousePosition(event);
516 pts.SetXY(ptHighlight, pt2.x(), pt2.y());
521 else if (tool == TOOLPolySelect)
523 if (pts.GetNumPoints() > 0)
525 QPoint pt2 = GetAdjustedMousePosition(event);
526 // Should also set onCurve here as well, depending on keystate
528 pts.OffsetPoly(pts.GetPoly(ptHighlight), pt2.x() - pts.GetX(ptHighlight), pt2.y() - pts.GetY(ptHighlight));
532 else if (tool == TOOLRotate)
534 if (pts.GetNumPoints() > 0)
538 rotationZeroPoint = GetAdjustedMousePosition(event);
539 haveZeroPoint = true;
543 // Figure out the angle between the "zero" vector and the current one,
544 // then rotate all points relative to the "zero" vector (done by paint())
545 QPoint currentPoint = GetAdjustedMousePosition(event);
546 Vector v1(rotationZeroPoint.x(), rotationZeroPoint.y(), 0,
547 rotationCenter.x(), rotationCenter.y(), 0);
548 Vector v2(currentPoint.x(), currentPoint.y(), 0,
549 rotationCenter.x(), rotationCenter.y(), 0);
550 // rotationAngle = v1.Angle(v2);
551 rotationAngle = v2.Angle(v1);
554 s.sprintf("%.3f degrees", rotationAngle * 180.0 / 3.14159265358979323);
555 ((TTEdit *)qApp)->mainWindow->statusBar()->showMessage(s);
562 else if (event->buttons() == Qt::NoButton)
564 // Moving, not dragging...
565 if (tool == TOOLSelect || tool == TOOLDelPt || tool == TOOLAddPt
566 || tool == TOOLPolySelect)// || tool == TOOLAddPoly)
568 QPoint pt2 = GetAdjustedMousePosition(event);
569 double closest = 1.0e+99;
571 for(int i=0; i<pts.GetNumPoints(); i++)
573 double dist = ((pt2.x() - pts.GetX(i)) * (pt2.x() - pts.GetX(i)))
574 + ((pt2.y() - pts.GetY(i)) * (pt2.y() - pts.GetY(i)));
577 closest = dist, ptHighlight = i;
580 if (ptHighlight != oldPtHighlight)
582 oldPtHighlight = ptHighlight;
586 // What follows here looks like voodoo, but is really simple. What we do is
587 // check to see if the mouse point has a perpendicular intersection with any of
588 // the line segments. If it does, calculate the length of the perpendicular
589 // and choose the smallest length. If there is no perpendicular, then choose the
590 // length of line connecting the closer of either the first endpoint or the
591 // second and choose the smallest of those.
593 // There is one bit of math that looks like voodoo to me ATM--will explain once
594 // I understand it better (the calculation of the length of the perpendicular).
596 if (pts.GetNumPoints() > 1 && tool == TOOLAddPt)
598 double smallest = 1.0e+99;
600 for(int i=0; i<pts.GetNumPoints(); i++)
602 int32 p1x = pts.GetX(i), p1y = pts.GetY(i),
603 p2x = pts.GetX(pts.GetNext(i)), p2y = pts.GetY(pts.GetNext(i));
605 Vector ls(p2x, p2y, 0, p1x, p1y, 0), v1(pt2.x(), pt2.y(), 0, p1x, p1y, 0),
606 v2(pt2.x(), pt2.y(), 0, p2x, p2y, 0);
607 double pp = ls.Dot(v1) / ls.Magnitude(), dist;
608 // Geometric interpretation:
609 // pp is the paremeterized point on the vector ls where the perpendicular intersects ls.
610 // If pp < 0, then the perpendicular lies beyond the 1st endpoint. If pp > length of ls,
611 // then the perpendicular lies beyond the 2nd endpoint.
614 dist = v1.Magnitude();
615 else if (pp > ls.Magnitude())
616 dist = v2.Magnitude();
617 else // distance = ?Det?(ls, v1) / |ls|
618 dist = fabs((ls.x * v1.y - v1.x * ls.y) / ls.Magnitude());
620 //The answer to the above looks like it might be found here:
622 //If the segment endpoints are s and e, and the point is p, then the test for the perpendicular
623 //intercepting the segment is equivalent to insisting that the two dot products {s-e}.{s-p} and
624 //{e-s}.{e-p} are both non-negative. Perpendicular distance from the point to the segment is
625 //computed by first computing the area of the triangle the three points form, then dividing by the
626 //length of the segment. Distances are done just by the Pythagorean theorem. Twice the area of the
627 //triangle formed by three points is the determinant of the following matrix:
633 //By translating the start point to the origin, this can be rewritten as:
634 //By subtracting row 1 from all rows, you get the following:
635 //[because sx = sy = 0. you could leave out the -sx/y terms below. because we subtracted
636 // row 1 from all rows (including row 1) row 1 turns out to be zero. duh!]
639 //(ex - sx) (ey - sy) 0
640 //(px - sx) (py - sy) 0
642 //which greatly simplifies the calculation of the determinant.
645 smallest = dist, ptNextHighlight = pts.GetNext(i), ptHighlight = i;
648 if (ptNextHighlight != oldPtNextHighlight)
650 oldPtNextHighlight = ptNextHighlight;
656 ptPrevious = event->pos();
663 void EditWindow::mouseReleaseEvent(QMouseEvent * event)
665 if (event->button() == Qt::RightButton)
667 ToolType newTool = toolPalette->FindSelectedTool();
669 // We only change the tool if a new one was actually selected. Otherwise, we do nothing.
670 if (newTool != TOOLNone)
674 if (tool == TOOLScroll || tool == TOOLZoom || tool == TOOLAddPoly
675 || tool == TOOLDelPoly)
678 if (tool == TOOLAddPoly)
679 polyFirstPoint = true;
682 toolPalette->setVisible(false);
683 setCursor(cur[tool]);
684 // Just in case we changed highlighting style with the new tool...
687 else if (event->button() == Qt::MidButton)
689 setCursor(cur[tool]); // Restore previous cursor
691 else if (event->button() == Qt::LeftButton)
693 if (showRotationCenter)
695 showRotationCenter = false;
696 haveZeroPoint = false;
697 pts.RotatePoints(rotationAngle, IPoint(rotationCenter.x(), rotationCenter.y()));
699 ((TTEdit *)qApp)->mainWindow->statusBar()->showMessage("");
702 // if (tool == TOOLScroll || tool == TOOLZoom)
704 //this is prolly too much
705 ((TTEdit *)qApp)->charWnd->MakePathFromPoints(&pts);
706 ((TTEdit *)qApp)->charWnd->update();