3 # Patch managed by http://www.mn-logistik.de/unsupported/pxa250/patcher
6 --- FreeNote_1.6.1_arm/FmtEngine.cpp~compile 2003-12-23 15:53:46.000000000 +0100
7 +++ FreeNote_1.6.1_arm/FmtEngine.cpp 2004-02-01 18:42:32.000000000 +0100
9 -/* FreeNote for Sharp SLA300, B500, C7x0 Linux PDA
10 - Copyright (C) 2003 Joe Kanemori.<kanemori@ymg.urban.ne.jp>
12 - This program is free software; you can redistribute it and/or modify
13 - it under the terms of the GNU General Public License as published by
14 - the Free Software Foundation; either version 2 of the License, or
15 - (at your option) any later version.
17 - This program is distributed in the hope that it will be useful,
18 - but WITHOUT ANY WARRANTY; without even the implied warranty of
19 - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 - GNU General Public License for more details.
22 - You should have received a copy of the GNU General Public License
23 - along with this program; if not, write to the Free Software
24 - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 -2003/12/16-19 FreeNote ver 1.5.5pre
28 -
\81E
\8bÈ
\90ü
\95`
\89æ
\83\8d\83W
\83b
\83N
\82Ì
\89ü
\97Ç
30 -2003/12/14 FreeNote 1.5.4pre
31 -
\81E
\8bÈ
\90ü
\95`
\89æ
\83\8d\83W
\83b
\83N
\82Ì
\89ü
\97Ç
33 -2003/11/30-2003/12/04 FreeNote 1.5.3pre
34 -
\81E
\83x
\83W
\83F
\8aÖ
\90\94\82Ì
\83X
\83y
\83\8b\83~
\83X
\82ð
\8fC
\90³
36 -2003/11/16 FreeNote 1.5.2pre
37 -
\81E
\89~
\95`
\89æ
\82Ì
\83\8d\83W
\83b
\83N
\82ð
\92Ç
\89Á
39 -2003/11/13 FreeNote 1.5.1pre
40 -
\81E
\83X
\83\80\81[
\83W
\83\93\83O
\92Ç
\89Á
42 -
\81E
\8bÈ
\90ü
\90®
\8c`
\83\82\81[
\83h
\92Ç
\89Á
45 -#include "fmtengine.h"
46 -#include <qpointarray.h>
47 -#include <qpe/qmath.h>
50 -int PHASE1_ANGLE = 30;
51 -int PHASE2_ANGLE = 30;
52 -double Surface(const QPoint& p1, const QPoint& p2)
54 - return 0.5 * abs(p1.x() * p2.y() - p1.y() * p2.x());
57 -bool IsLinear(const QPoint& p1, const QPoint& p2, const QPoint& p3)
59 - double s1 = Surface(p1, p2);
60 - double s2 = Surface(p2, p3);
61 - double s3 = Surface(p1, p3);
62 - if (s1 + s2 == s3) {
69 -const double Angle(const QPoint& p1, const QPoint& p2)
71 - return qATan2((double)(p2.y() - p1.y()), (double)(p2.x() - p1.x()));
74 -const double DiffAngle(const QPoint& p1, const QPoint& p2, const QPoint& p3)
76 - return fabs(Angle(p1, p2) - Angle(p2, p3));
79 -const double ToDegree(double t)
81 - return t * 180 / M_PI;
84 -const double ToRadian(double d)
86 - return d * M_PI / 180;
89 -const double Distance(const QPoint& p1, const QPoint& p2)
91 - return hypot(p1.x() - p2.x(), p1.y() - p2.y());
94 -const QPoint SnapPoint(const QPoint& p)
96 - int x = ((int)(p.x() + SNAP_SIZE / 2) / SNAP_SIZE) * SNAP_SIZE;
97 - int y = ((int)(p.y() + SNAP_SIZE / 2) / SNAP_SIZE) * SNAP_SIZE;
98 - return QPoint(x, y);
101 -const QPoint ArrangePoint(const QPoint& p1, const QPoint& p2)
105 - if (p1.x() - SNAP_SIZE / 2 <= x && p1.x() + SNAP_SIZE / 2 >= x) {
108 - if (p1.y() - SNAP_SIZE / 2 <= y && p1.y() + SNAP_SIZE / 2 >= y) {
111 - return QPoint(x, y);
114 -FNPointList ReducePoints(FNPointList& p)
116 - if (3 >= p.count()) {
120 - rt.append(p.first());
121 - QPoint* p1 = p.first();
122 - QPoint* p2 = p.at(1);
124 - for (uint i = 2; i < p.count(); ++i) {
126 - if (false == IsLinear(*p1, *p2, *p3)) {
136 -FNPointList ExtractAngle2(FNPointList& p, const int deg)
139 - rt.append(p.first());
140 - QPoint* st = p.first();
141 - QPoint* mp = p.at(1);
142 - QPoint* ed = p.last();
143 - for (uint i = 2; i < p.count(); ++i) {
145 - if (ToRadian(deg) <= DiffAngle(*st, *mp, *ed)) {
155 -FNPointList ExtractAngle(FNPointList& p, const int deg)
158 - rt.append(p.first());
159 - QPoint* st = p.first();
160 - QPoint* mp = p.at(1);
161 - QPoint* ed = p.last();
162 - for (uint i = 2; i < p.count(); ++i) {
164 - if (ToRadian(deg) <= DiffAngle(*st, *mp, *ed)) {
170 - if (SNAP_SIZE / 2 > Distance(*p.first(), *p.last()) && 3 < p.count()) {
171 - rt.append(p.first());
178 -FNPointList SumupPoints(FNPointList& p)
180 - if (3 >= p.count()) {
184 - rt.append(p.first());
185 - QPoint* p1 = p.first();
188 - for (uint i = 1; i < p.count() - 1; ++i) {
190 - double d = Distance(*p1, *p2);
191 - if (SNAP_SIZE / 2 < d || pred > d) {
198 - rt.append(p.last());
202 -FNPointList SnapPoints(FNPointList& p)
205 - for (uint i = 0; i < p.count(); ++i) {
206 - QPoint tp = SnapPoint(*p.at(i));
207 - p.at(i)->setX(tp.x());
208 - p.at(i)->setY(tp.y());
209 - rt.append(p.at(i));
214 -FNPointList ArrangePoints(FNPointList& p)
216 - if (3 >= p.count() && 2 != p.count()) {
220 - rt.append(p.first());
221 - QPoint* p1 = p.first();
223 - for (uint i = 1; i < p.count(); ++i) {
225 - QPoint tp = ArrangePoint(*p1, *p2);
231 - if (*p.first() == *p.last()) {
232 - QPoint tp = ArrangePoint(*p1, *p.first());
233 - rt.first()->setX(tp.x());
234 - rt.first()->setY(tp.y());
239 -FNPointList TuningPoints(FNPointList& p)
242 - if (3 >= p.count()) {
243 - for (uint i = 0; i < p.count(); ++i) {
244 - rt.append(new QPoint(*p.at(i)));
248 - rt.append(new QPoint(*p.at(0)));
249 - for (uint i = 1; i < p.count() - 1; ++i) {
250 - QPoint* p1 = p.at(i);
251 - QPoint* p2 = p.at(i + 1);
252 - rt.append(new QPoint(*p1));
253 - if (i < p.count() - 2) {
254 - rt.append(new QPoint((p1->x() + p2->x())/2, (p1->y() + p2->y())/2));
257 - rt.append(new QPoint(*p.at(p.count()-1)));
261 -FNPointList ToBezier(FNPointList& p) {
263 - rt.append(new QPoint(*p.at(0)));
264 - for (uint i = 0; i < p.count() - 2; i += 2) {
265 - int x1 = p.at(i)->x();
266 - int xa = p.at(i + 1)->x();
267 - int x4 = p.at(i + 2)->x();
269 - int x2 = (x1 + xa) / 2;
270 - int x3 = (xa + x4) / 2;
272 - int y1 = p.at(i)->y();
273 - int ya = p.at(i + 1)->y();
274 - int y4 = p.at(i + 2)->y();
276 - int y2 = (y1 + ya) / 2;
277 - int y3 = (ya + y4) / 2;
279 - rt.append(new QPoint(x2 ,y2));
280 - rt.append(new QPoint(x3 ,y3));
281 - rt.append(new QPoint(x4 ,y4));
286 -FNPointList ToCurves(FNPointList& p) {
287 - if (3 <= p.count()) {
288 - //
\83x
\83W
\83F
\82É
\82æ
\82é
\95â
\8a®
289 - return ToBezier(p);
292 - for (uint i = 0; i < p.count(); ++i) {
293 - rt.append(new QPoint(*p.at(i)));
299 -FNPointList AutoFormat(FNPointList& p)
301 - FNPointList tp = ExtractAngle(p, PHASE1_ANGLE);
305 - tp = SumupPoints(tp);
306 - tp = ExtractAngle(tp, PHASE1_ANGLE);
307 - tp = ArrangePoints(tp);
308 - } while (n > tp.count());
309 - tp = SnapPoints(tp);
310 - tp = ReducePoints(tp);
312 - if (2 == tp.count()) {
313 - if (*tp.first() == *tp.last()) {
317 - for (uint i = 0; i < tp.count(); ++i) {
318 - rt.append(new QPoint(*tp.at(i)));
323 -FNPointList ToEllipse(int x, int y, int w, int h) {
326 - pa.makeEllipse(x, y, w, h);
327 - for (uint i = 0; i < pa.count(); ++i) {
328 - rt.append(new QPoint(pa.point(i)));
333 -FNPointList AutoCurve(FNPointList& p)
336 - tp2.setAutoDelete(true);
338 - tp4.setAutoDelete(true);
339 - QPoint sp = SnapPoint(*p.at(0));
340 - QPoint ep = SnapPoint(*p.at(p.count()-1));
343 - int sx = p.at(0)->x();
344 - int sy = p.at(0)->y();
347 - for (uint i = 1; i < p.count(); ++i) {
348 - QPoint tp = *p.at(i);
351 - } else if (ex < tp.x()) {
356 - } else if (ey < tp.y()) {
360 - sp = SnapPoint(QPoint(sx, sy));
361 - ep = SnapPoint(QPoint(ex, ey));
362 - tp2.append(new QPoint(sp.x(), sp.y()));
363 - tp2.append(new QPoint(ep.x(), ep.y()));
365 - FNPointList tp = ExtractAngle2(p, PHASE2_ANGLE);
369 - tp = SumupPoints(tp);
370 - tp = ExtractAngle2(tp, PHASE2_ANGLE);
371 - tp = SnapPoints(tp);
372 - } while (n > tp.count());
373 - tp = SumupPoints(tp);
374 - tp = ReducePoints(tp);
375 - tp4 = TuningPoints(tp);
376 - tp2 = ToCurves(tp4);
379 - if (2 == tp2.count()) {
380 - if (*tp2.first() == *tp2.last()) {
384 - for (uint i = 0; i < tp2.count(); ++i) {
385 - rt.append(new QPoint(*tp2.at(i)));
390 -FNPointList Smoothing(FNPointList& p)
392 - int tsnap = SNAP_SIZE;
394 - FNPointList tp = ExtractAngle2(p, PHASE2_ANGLE);
395 - tp = SumupPoints(tp);
396 - tp = ReducePoints(tp);
397 - FNPointList tp4 = TuningPoints(tp);
398 - tp4.setAutoDelete(true);
399 - FNPointList tp2 = ToCurves(tp4);
400 - tp2.setAutoDelete(true);
402 - for (uint i = 0; i < tp2.count(); ++i) {
403 - rt.append(new QPoint(*tp2.at(i)));
409 -FNPointList Reduce(FNPointList& p)
411 - FNPointList tp = ReducePoints(p);
413 - for (uint i = 0; i < tp.count(); ++i) {
414 - rt.append(new QPoint(*tp.at(i)));
418 +/* FreeNote for Sharp SLA300, B500, C7x0 Linux PDA
419 + Copyright (C) 2003 Joe Kanemori.<kanemori@ymg.urban.ne.jp>
421 + This program is free software; you can redistribute it and/or modify
422 + it under the terms of the GNU General Public License as published by
423 + the Free Software Foundation; either version 2 of the License, or
424 + (at your option) any later version.
426 + This program is distributed in the hope that it will be useful,
427 + but WITHOUT ANY WARRANTY; without even the implied warranty of
428 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
429 + GNU General Public License for more details.
431 + You should have received a copy of the GNU General Public License
432 + along with this program; if not, write to the Free Software
433 + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
436 +2003/12/16-19 FreeNote ver 1.5.5pre
437 +
\81E
\8bÈ
\90ü
\95`
\89æ
\83\8d\83W
\83b
\83N
\82Ì
\89ü
\97Ç
439 +2003/12/14 FreeNote 1.5.4pre
440 +
\81E
\8bÈ
\90ü
\95`
\89æ
\83\8d\83W
\83b
\83N
\82Ì
\89ü
\97Ç
442 +2003/11/30-2003/12/04 FreeNote 1.5.3pre
443 +
\81E
\83x
\83W
\83F
\8aÖ
\90\94\82Ì
\83X
\83y
\83\8b\83~
\83X
\82ð
\8fC
\90³
445 +2003/11/16 FreeNote 1.5.2pre
446 +
\81E
\89~
\95`
\89æ
\82Ì
\83\8d\83W
\83b
\83N
\82ð
\92Ç
\89Á
448 +2003/11/13 FreeNote 1.5.1pre
449 +
\81E
\83X
\83\80\81[
\83W
\83\93\83O
\92Ç
\89Á
451 +
\81E
\8bÈ
\90ü
\90®
\8c`
\83\82\81[
\83h
\92Ç
\89Á
454 +#include "fmtengine.h"
455 +#include <qpointarray.h>
456 +#include <qpe/qmath.h>
458 +#include <stdlib.h> // abs
460 +int PHASE1_ANGLE = 30;
461 +int PHASE2_ANGLE = 30;
462 +double Surface(const QPoint& p1, const QPoint& p2)
464 + return 0.5 * abs(p1.x() * p2.y() - p1.y() * p2.x());
467 +bool IsLinear(const QPoint& p1, const QPoint& p2, const QPoint& p3)
469 + double s1 = Surface(p1, p2);
470 + double s2 = Surface(p2, p3);
471 + double s3 = Surface(p1, p3);
472 + if (s1 + s2 == s3) {
479 +const double Angle(const QPoint& p1, const QPoint& p2)
481 + return qATan2((double)(p2.y() - p1.y()), (double)(p2.x() - p1.x()));
484 +const double DiffAngle(const QPoint& p1, const QPoint& p2, const QPoint& p3)
486 + return fabs(Angle(p1, p2) - Angle(p2, p3));
489 +const double ToDegree(double t)
491 + return t * 180 / M_PI;
494 +const double ToRadian(double d)
496 + return d * M_PI / 180;
499 +const double Distance(const QPoint& p1, const QPoint& p2)
501 + return hypot(p1.x() - p2.x(), p1.y() - p2.y());
504 +const QPoint SnapPoint(const QPoint& p)
506 + int x = ((int)(p.x() + SNAP_SIZE / 2) / SNAP_SIZE) * SNAP_SIZE;
507 + int y = ((int)(p.y() + SNAP_SIZE / 2) / SNAP_SIZE) * SNAP_SIZE;
508 + return QPoint(x, y);
511 +const QPoint ArrangePoint(const QPoint& p1, const QPoint& p2)
515 + if (p1.x() - SNAP_SIZE / 2 <= x && p1.x() + SNAP_SIZE / 2 >= x) {
518 + if (p1.y() - SNAP_SIZE / 2 <= y && p1.y() + SNAP_SIZE / 2 >= y) {
521 + return QPoint(x, y);
524 +FNPointList ReducePoints(FNPointList& p)
526 + if (3 >= p.count()) {
530 + rt.append(p.first());
531 + QPoint* p1 = p.first();
532 + QPoint* p2 = p.at(1);
534 + for (uint i = 2; i < p.count(); ++i) {
536 + if (false == IsLinear(*p1, *p2, *p3)) {
546 +FNPointList ExtractAngle2(FNPointList& p, const int deg)
549 + rt.append(p.first());
550 + QPoint* st = p.first();
551 + QPoint* mp = p.at(1);
552 + QPoint* ed = p.last();
553 + for (uint i = 2; i < p.count(); ++i) {
555 + if (ToRadian(deg) <= DiffAngle(*st, *mp, *ed)) {
565 +FNPointList ExtractAngle(FNPointList& p, const int deg)
568 + rt.append(p.first());
569 + QPoint* st = p.first();
570 + QPoint* mp = p.at(1);
571 + QPoint* ed = p.last();
572 + for (uint i = 2; i < p.count(); ++i) {
574 + if (ToRadian(deg) <= DiffAngle(*st, *mp, *ed)) {
580 + if (SNAP_SIZE / 2 > Distance(*p.first(), *p.last()) && 3 < p.count()) {
581 + rt.append(p.first());
588 +FNPointList SumupPoints(FNPointList& p)
590 + if (3 >= p.count()) {
594 + rt.append(p.first());
595 + QPoint* p1 = p.first();
598 + for (uint i = 1; i < p.count() - 1; ++i) {
600 + double d = Distance(*p1, *p2);
601 + if (SNAP_SIZE / 2 < d || pred > d) {
608 + rt.append(p.last());
612 +FNPointList SnapPoints(FNPointList& p)
615 + for (uint i = 0; i < p.count(); ++i) {
616 + QPoint tp = SnapPoint(*p.at(i));
617 + p.at(i)->setX(tp.x());
618 + p.at(i)->setY(tp.y());
619 + rt.append(p.at(i));
624 +FNPointList ArrangePoints(FNPointList& p)
626 + if (3 >= p.count() && 2 != p.count()) {
630 + rt.append(p.first());
631 + QPoint* p1 = p.first();
633 + for (uint i = 1; i < p.count(); ++i) {
635 + QPoint tp = ArrangePoint(*p1, *p2);
641 + if (*p.first() == *p.last()) {
642 + QPoint tp = ArrangePoint(*p1, *p.first());
643 + rt.first()->setX(tp.x());
644 + rt.first()->setY(tp.y());
649 +FNPointList TuningPoints(FNPointList& p)
652 + if (3 >= p.count()) {
653 + for (uint i = 0; i < p.count(); ++i) {
654 + rt.append(new QPoint(*p.at(i)));
658 + rt.append(new QPoint(*p.at(0)));
659 + for (uint i = 1; i < p.count() - 1; ++i) {
660 + QPoint* p1 = p.at(i);
661 + QPoint* p2 = p.at(i + 1);
662 + rt.append(new QPoint(*p1));
663 + if (i < p.count() - 2) {
664 + rt.append(new QPoint((p1->x() + p2->x())/2, (p1->y() + p2->y())/2));
667 + rt.append(new QPoint(*p.at(p.count()-1)));
671 +FNPointList ToBezier(FNPointList& p) {
673 + rt.append(new QPoint(*p.at(0)));
674 + for (uint i = 0; i < p.count() - 2; i += 2) {
675 + int x1 = p.at(i)->x();
676 + int xa = p.at(i + 1)->x();
677 + int x4 = p.at(i + 2)->x();
679 + int x2 = (x1 + xa) / 2;
680 + int x3 = (xa + x4) / 2;
682 + int y1 = p.at(i)->y();
683 + int ya = p.at(i + 1)->y();
684 + int y4 = p.at(i + 2)->y();
686 + int y2 = (y1 + ya) / 2;
687 + int y3 = (ya + y4) / 2;
689 + rt.append(new QPoint(x2 ,y2));
690 + rt.append(new QPoint(x3 ,y3));
691 + rt.append(new QPoint(x4 ,y4));
696 +FNPointList ToCurves(FNPointList& p) {
697 + if (3 <= p.count()) {
698 + //
\83x
\83W
\83F
\82É
\82æ
\82é
\95â
\8a®
699 + return ToBezier(p);
702 + for (uint i = 0; i < p.count(); ++i) {
703 + rt.append(new QPoint(*p.at(i)));
709 +FNPointList AutoFormat(FNPointList& p)
711 + FNPointList tp = ExtractAngle(p, PHASE1_ANGLE);
715 + tp = SumupPoints(tp);
716 + tp = ExtractAngle(tp, PHASE1_ANGLE);
717 + tp = ArrangePoints(tp);
718 + } while (n > tp.count());
719 + tp = SnapPoints(tp);
720 + tp = ReducePoints(tp);
722 + if (2 == tp.count()) {
723 + if (*tp.first() == *tp.last()) {
727 + for (uint i = 0; i < tp.count(); ++i) {
728 + rt.append(new QPoint(*tp.at(i)));
733 +FNPointList ToEllipse(int x, int y, int w, int h) {
736 + pa.makeEllipse(x, y, w, h);
737 + for (uint i = 0; i < pa.count(); ++i) {
738 + rt.append(new QPoint(pa.point(i)));
743 +FNPointList AutoCurve(FNPointList& p)
746 + tp2.setAutoDelete(true);
748 + tp4.setAutoDelete(true);
749 + QPoint sp = SnapPoint(*p.at(0));
750 + QPoint ep = SnapPoint(*p.at(p.count()-1));
753 + int sx = p.at(0)->x();
754 + int sy = p.at(0)->y();
757 + for (uint i = 1; i < p.count(); ++i) {
758 + QPoint tp = *p.at(i);
761 + } else if (ex < tp.x()) {
766 + } else if (ey < tp.y()) {
770 + sp = SnapPoint(QPoint(sx, sy));
771 + ep = SnapPoint(QPoint(ex, ey));
772 + tp2.append(new QPoint(sp.x(), sp.y()));
773 + tp2.append(new QPoint(ep.x(), ep.y()));
775 + FNPointList tp = ExtractAngle2(p, PHASE2_ANGLE);
779 + tp = SumupPoints(tp);
780 + tp = ExtractAngle2(tp, PHASE2_ANGLE);
781 + tp = SnapPoints(tp);
782 + } while (n > tp.count());
783 + tp = SumupPoints(tp);
784 + tp = ReducePoints(tp);
785 + tp4 = TuningPoints(tp);
786 + tp2 = ToCurves(tp4);
789 + if (2 == tp2.count()) {
790 + if (*tp2.first() == *tp2.last()) {
794 + for (uint i = 0; i < tp2.count(); ++i) {
795 + rt.append(new QPoint(*tp2.at(i)));
800 +FNPointList Smoothing(FNPointList& p)
802 + int tsnap = SNAP_SIZE;
804 + FNPointList tp = ExtractAngle2(p, PHASE2_ANGLE);
805 + tp = SumupPoints(tp);
806 + tp = ReducePoints(tp);
807 + FNPointList tp4 = TuningPoints(tp);
808 + tp4.setAutoDelete(true);
809 + FNPointList tp2 = ToCurves(tp4);
810 + tp2.setAutoDelete(true);
812 + for (uint i = 0; i < tp2.count(); ++i) {
813 + rt.append(new QPoint(*tp2.at(i)));
819 +FNPointList Reduce(FNPointList& p)
821 + FNPointList tp = ReducePoints(p);
823 + for (uint i = 0; i < tp.count(); ++i) {
824 + rt.append(new QPoint(*tp.at(i)));
828 --- FreeNote_1.6.1_arm/FNCanvas.cpp~compile 2003-12-24 15:20:16.000000000 +0100
829 +++ FreeNote_1.6.1_arm/FNCanvas.cpp 2004-02-01 18:43:35.000000000 +0100
830 @@ -1,1227 +1,1228 @@
831 -/* FreeNote for Sharp SLA300, B500, C7x0 Linux PDA
832 - Copyright (C) 2003 Joe Kanemori.<kanemori@ymg.urban.ne.jp>
834 - This program is free software; you can redistribute it and/or modify
835 - it under the terms of the GNU General Public License as published by
836 - the Free Software Foundation; either version 2 of the License, or
837 - (at your option) any later version.
839 - This program is distributed in the hope that it will be useful,
840 - but WITHOUT ANY WARRANTY; without even the implied warranty of
841 - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
842 - GNU General Public License for more details.
844 - You should have received a copy of the GNU General Public License
845 - along with this program; if not, write to the Free Software
846 - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
849 -2003/12/23 ver 1.6.1
850 -
\81E
\95Û
\91¶
\8fî
\95ñ
\82Ì
\83T
\83C
\83Y
\8fk
\8f¬
852 -2003/12/16-19 ver 1.5.5pre
853 -
\81E
\83y
\83\93\83T
\83C
\83Y
\82Ì
\92Ç
\89Á(1-8)
854 -
\81E
\83A
\83\93\83h
\83D
\81E
\83\8a\83h
\83D
\82Ì
\8eÀ
\91\95
856 -2003/12/14 ver 1.5.4pre
857 -
\81E
\83y
\83\93\83T
\83C
\83Y
\82ð
\91I
\91ð
\89Â
\94\
\82É
\81B
859 -2003/12/05 ver 1.5.3Apre
860 -
\81E
\83O
\83\8a\83b
\83h
\82Ì
\90F
\82ð
\8fC
\90³
862 -2003/12/04 ver 1.5.3pre
863 -
\81E
\83O
\83\8a\83b
\83h
\82Ì
\95`
\89æ
\82ð
\88ê
\95\94\8fC
\90³
865 -2003/11/10 ver 1.5.1pre
866 -
\81E
\8bÈ
\90ü
\90®
\8c`
\83\82\81[
\83h
\92Ç
\89Á
868 -2003/11/09 ver 1.5.0pre
869 -
\81E
\8e©
\93®
\90®
\8c`
\83\82\81[
\83h
\92Ç
\89Á
871 -2003/09/03 ver 1.3.4pre
872 -
\81EUse all quadrant OFF
\8e\9e\82É
\95\
\8e¦
\88Ê
\92u
\82ª
\83\8a\83Z
\83b
\83g
\82³
\82ê
\82é
\8fê
\8d\87\82ª
\82 \82é
\83o
\83O
\91Î
\89\9e\81B
874 -2003/09/01-03 ver 1.3.3pre
875 -
\81E
\83X
\83N
\83\8d\81[
\83\8b\82Ì
\89ü
\97Ç
876 -
\81EUse all quadrant(
\91S
\8fÛ
\8cÀ
\82ð
\8eg
\97p
\82·
\82é)
\83\81\83j
\83\85\81[
\82ð
\92Ç
\89Á
878 -2003/08/31 FreeNote 1.3.2pre
879 -
\81E
\91S
\95û
\8cü
\83X
\83N
\83\8d\81[
\83\8b
881 -2003/08/23 FreeNote 1.3.0pre
882 -
\81ECR
\93®
\8dì
\82Ì
\8fC
\90³
884 -2003/08/15 FreeNote 1.2.1
\82ð
\8cö
\8aJ
885 -
\81E
\95Û
\91¶
\8e\9e\82Ì
\83o
\83O
\8fC
\90³
886 -
\81E
\8a®
\97¹
\83_
\83C
\83A
\83\8d\83O
\82Ì
\8e©
\93®
\8fÁ
\8b\8e
887 -
\81EPNG
\83t
\83@
\83C
\83\8b\82Ö
\82Ì
\8fo
\97Í
889 -2003/08/15 FreeNote 1.2
\82ð
\8cö
\8aJ
890 -
\81E
\83I
\83v
\83V
\83\87\83\93\92Ç
\89Á
891 -
\81E
\83X
\83N
\83\8d\81[
\83\8b\83K
\83C
\83h
892 -
\81EFree
\83t
\83@
\83C
\83\8b\8aÖ
\98A
\95t
\82¯
893 -
\81E
\83A
\83C
\83R
\83\93\82Ì
\95Ï
\8dX
895 -2003/08/05 FreeNote 1.1.1pre
\82ð
\8cö
\8aJ
896 -
\81E
\8d\82\91¬
\8bN
\93®
\8e\9e\82É
\95Â
\82¶
\82½
\8fó
\91Ô
\82ð
\95Û
\8e\9d
897 -
\81E
\95`
\89æ
\83\82\81[
\83h
\90Ø
\91Ö
\82¦
\8e\9e\82É
\8fÁ
\82µ
\83S
\83\80\95\
\8e¦
898 -
\81E
\95Û
\91¶
\8e\9e\8aÔ
\92Z
\8fk
899 -
\81EView
\83\82\81[
\83h
\82Ì
\8b\93\93®
\82ð
\95Ï
\8dX
900 -
\81E
\83\81\83j
\83\85\81[
\82Ì
\8c©
\82½
\96Ú
\82ð
\95Ï
\8dX
902 -#include "fncanvas.h"
905 -#include <qmessagebox.h>
906 -#include <qtextstream.h>
910 -#include <qthread.h>
913 -#include "fnmessagebox.h"
914 -#include "fmtengine.h"
918 - tv = ((int)(tv + SNAP_SIZE / 2) / SNAP_SIZE) * SNAP_SIZE;
926 -FNCanvas::FNCanvas(QWidget* parent = 0, const char* name = 0, WFlags f = 0)
927 - :QWidget(parent, name, f),
928 - _pen(black, 1, SolidLine, RoundCap, RoundJoin),
930 - _drawMode(MODE_DRAW),
937 - _scrollTiming(800),
940 - _isDragging(false),
941 - _isHeadingEnables(false),
942 - _isShowGuide(false),
943 - _isUseAllQuadrant(false),
947 - _tracks.setAutoDelete(true);
948 - this->setBackgroundMode(NoBackground);
949 - _timer = new QTimer(this);
950 - connect(_timer, SIGNAL(timeout()), this, SLOT(autoScroll()));
953 -FNCanvas::~FNCanvas()
962 -void FNCanvas::setScrollTiming(int v)
968 -void FNCanvas::setVStep(int v)
973 -void FNCanvas::setHStep(int v)
978 -void FNCanvas::setSEraser(int v)
983 -void FNCanvas::setLEraser(int v)
989 -void FNCanvas::setMargin(int v)
997 -void FNCanvas::setScrollMode(int as)
1003 -void FNCanvas::autoScroll()
1005 - if (AS_NONE == _asMode) {
1006 - if (MODE_FORMAT == _drawMode || MODE_CURVE == _drawMode || MODE_SMOOTH == _drawMode) {
1007 - setOrigin(_origin.x(), _origin.y());
1011 - bool tmp = _isHeadingEnables;
1014 - if (AS_BOTH == _asMode || AS_HORIZONTAL == _asMode) {
1015 - if (_last.x() > width() * (_margin - 1) / _margin) {
1017 - } else if (_last.x() < width() / _margin) {
1021 - if (AS_BOTH == _asMode || AS_VERTICAL == _asMode) {
1022 - if (_last.y() > height() * (_margin - 1) / _margin) {
1024 - } else if (_last.y() < height() / _margin) {
1028 - setOrigin(_origin.x() + dx, _origin.y() + dy);
1029 - _isHeadingEnables = tmp;
1032 -void FNCanvas::mousePressEvent(QMouseEvent* evt)
1038 - _isWaiting = true;
1039 - _viewMode = false;
1040 - setOrigin((int)((evt->x()) / _scale_x) - width() / 2, (int)((evt->y()) / _scale_y) - height() / 2);
1042 - emit resetViewMode();
1043 - } else if (MODE_ERASE != _drawMode) {
1044 - _last = evt->pos();
1045 - _tracks.append(new QPoint(_last));
1048 - _last = evt->pos();
1049 - _tracks.append(new QPoint(_last));
1053 - pbuf.begin(&_buffer);
1056 - int w = _eraser_s;
1057 - if (PENWIDTH_MAX / 2 < _pen.width()) {
1060 - pbuf.setRasterOp(XorROP);
1061 - pbuf.setPen(QPen(white, 1));
1062 - pbuf.drawRect(_last.x() - w / 2, _last.y() - w / 2, w, w);
1064 - pwin.setRasterOp(XorROP);
1065 - pwin.setPen(QPen(white, 1));
1066 - pwin.drawRect(_last.x() - w / 2, _last.y() - w / 2, w, w);
1071 - _isDragging = true;
1074 -void FNCanvas::mouseMoveEvent(QMouseEvent* evt)
1079 - if (MODE_ERASE != _drawMode) {
1084 - pbuf.begin(&_buffer);
1086 - pwin.setPen(_pen);
1087 - pbuf.setPen(_pen);
1089 - pwin.drawLine(_last, evt->pos());
1090 - pbuf.drawLine(_last, evt->pos());
1094 - _last = evt->pos();
1095 - _tracks.append(new QPoint(_last));
1098 - if (_last.x() == -1) {
1104 - pbuf.begin(&_buffer);
1107 - int w = _eraser_s;
1108 - if (PENWIDTH_MAX / 2 < _pen.width()) {
1111 - pbuf.setRasterOp(XorROP);
1112 - pwin.setRasterOp(XorROP);
1113 - pbuf.setPen(QPen(white, 1));
1114 - pwin.setPen(QPen(white, 1));
1115 - pbuf.drawRect(_last.x() - w / 2, _last.y() - w / 2, w, w);
1116 - pwin.drawRect(_last.x() - w / 2, _last.y() - w / 2, w, w);
1118 - _tracks.append(new QPoint(evt->pos()));
1119 - _last = evt->pos();
1121 - pbuf.setRasterOp(CopyROP);
1122 - pwin.setRasterOp(CopyROP);
1123 - QRect r = QRect(0, 0, width(), height());
1124 - for (uint i = 0; i < _draws.count() - _disp_offset; ++i) {
1125 - FNPolygon* p = _draws.at(i);
1126 - if (r.intersects(p->boundingRect())) {
1128 - QRect selected(_last.x() - w / 2, _last.y() - w / 2, w, w);
1129 - for (uint j = 0; j < p->points().count(); ++j) {
1130 - QPoint& pts = p->points().at(j);
1131 - if (selected.contains(pts)) {
1137 - p->drawShape(pbuf, f);
1138 - p->drawShape(pwin, f);
1142 - pbuf.setRasterOp(XorROP);
1143 - pwin.setRasterOp(XorROP);
1144 - pbuf.setPen(QPen(white, 1));
1145 - pwin.setPen(QPen(white, 1));
1146 - pbuf.drawRect(_last.x() - w / 2, _last.y() - w / 2, w, w);
1147 - pwin.drawRect(_last.x() - w / 2, _last.y() - w / 2, w, w);
1153 -void FNCanvas::mouseReleaseEvent(QMouseEvent* evt)
1155 - _isDragging = false;
1157 - _isWaiting = false;
1160 - _last = evt->pos();
1161 - if (MODE_ERASE != _drawMode) {
1162 - if (1 < _tracks.count()) {
1163 - FNPolygon* p = NULL;
1164 - if (MODE_FORMAT == _drawMode) {
1165 - p = new FNPolygon(_pen);
1166 - _tracks = AutoFormat(_tracks);
1167 - } else if (MODE_CURVE == _drawMode) {
1168 - QPoint sp = SnapPoint(*_tracks.at(0));
1169 - QPoint ep = SnapPoint(*_tracks.at(_tracks.count()-1));
1170 - _tracks = AutoCurve(_tracks);
1172 - p = new FNEllipse(_pen);
1173 - } else if (2 < _tracks.count()) {
1174 - p = new FNBezier(_pen);
1176 - p = new FNPolygon(_pen);
1178 - } else if (MODE_SMOOTH == _drawMode) {
1179 - _tracks = Smoothing(_tracks);
1180 - if (2 < _tracks.count()) {
1181 - p = new FNBezier(_pen);
1183 - p = new FNPolygon(_pen);
1186 - _tracks = Reduce(_tracks);
1187 - p = new FNPolygon(_pen);
1189 - if (1 < _tracks.count()) {
1190 - p->setPoints(_tracks);
1196 - _isHeadingEnables = true;
1197 - _timer->start(_scrollTiming, true);
1199 - _last = QPoint(-1, -1);
1200 - _tracks.append(new QPoint(evt->pos()));
1205 -void FNCanvas::paintEvent(QPaintEvent* evt)
1207 - bitBlt(this, 0, 0, &_buffer);
1210 -void FNCanvas::resizeEvent(QResizeEvent* evt)
1212 - QPixmap save(_buffer);
1213 - _buffer.resize(evt->size());
1214 - _buffer.fill(white);
1215 - bitBlt(&_buffer, 0, 0, &save);
1219 -void FNCanvas::setOrigin(QPoint& o)
1221 - this->setOrigin(o.x(), o.y());
1224 -QPoint FNCanvas::getTopLeft()
1226 - if (0 == _draws.count() || !_isUseAllQuadrant) {
1230 - int dx = ((FNPolygon*)_draws.at(0))->boundingRect().x();
1231 - int dy = ((FNPolygon*)_draws.at(0))->boundingRect().y();
1232 - for (uint i = 1; i < _draws.count(); ++i) {
1233 - FNPolygon* p = _draws.at(i);
1234 - if (dx > p->boundingRect().x()) {
1235 - dx = p->boundingRect().x();
1237 - if (dy > p->boundingRect().y()) {
1238 - dy = p->boundingRect().y();
1241 - return QPoint(snap(dx), snap(dy));
1245 -void FNCanvas::rebuild()
1247 - if (0 == _draws.count() || !_isUseAllQuadrant) {
1251 - QPoint d = getTopLeft();
1252 - for (uint i = 0; i < _draws.count(); ++i) {
1253 - FNPolygon* p = _draws.at(i);
1254 - p->translate(-d.x(), -d.y());
1257 - _origin = QPoint(0, 0);
1261 -void FNCanvas::setOrigin(int ox, int oy)
1265 - _isHeadingEnables = false;
1271 - if (!_isUseAllQuadrant) {
1278 - dx = _origin.x() - ox;
1279 - dy = _origin.y() - oy;
1281 - dx = _origin.x() - ox;
1282 - dy = _origin.y() - oy;
1290 - for (uint i = 0; i < _tracks.count(); ++i) {
1291 - QPoint* p = _tracks.at(i);
1292 - p->setX(p->x() + dx);
1293 - p->setY(p->y() + dy);
1296 - for (uint i = 0; i < _draws.count(); ++i) {
1297 - FNPolygon* p = _draws.at(i);
1298 - p->translate(dx, dy);
1300 - _origin = QPoint(ox, oy);
1301 - emit originChanged(ox, oy);
1305 -void FNCanvas::redraw()
1307 - if (!this->isVisible()) {
1310 - _buffer.fill(white);
1312 - QRect r = QRect(0, 0, width(), height());
1313 - pbuf.begin(&_buffer);
1317 - for (uint i = 0; i < _draws.count() - _disp_offset; ++i) {
1318 - FNPolygon* p = _draws.at(i);
1319 - QRect r = p->boundingRect();
1320 - if (wx < r.right()) {
1323 - if (wy < r.bottom()) {
1329 - wx = snap((int)wx);
1330 - wy = snap((int)wy);
1331 - wx = wx + _origin.x();
1332 - wy = wy + _origin.y();
1333 - _scale_x = (float)width() / wx;
1334 - _scale_y = (float)height() / wy;
1335 - if (1.0f < _scale_x) {
1338 - if (1.0f < _scale_y) {
1341 - if (_scale_x > _scale_y) {
1342 - _scale_x = _scale_y;
1343 - } else if (_scale_x < _scale_y) {
1344 - _scale_y = _scale_x;
1346 - for (uint i = 0; i < _draws.count() - _disp_offset; ++i) {
1347 - FNPolygon* p = _draws.at(i);
1348 - FNPolygon* t = NULL;
1349 - if (p->type() == FN_BEZIER) {
1350 - t = new FNBezier(*(FNBezier*)p);
1351 - } else if (p->type() == FN_ELLIPSE) {
1352 - t = new FNEllipse(*(FNEllipse*)p);
1354 - t = new FNPolygon(*p);
1356 - t->translate(-_origin.x(), -_origin.y());
1357 - for (uint j = 0; j < t->points().count(); ++j) {
1358 - QPoint& pts = t->points().at(j);
1359 - int x = (int)(pts.x() * _scale_x);
1360 - int y = (int)(pts.y() * _scale_y);
1364 - double pensize = t->pen().width();
1365 - if (_scale_x > _scale_y) {
1366 - pensize = pensize * _scale_y;
1368 - pensize = pensize * _scale_x;
1370 - if (0 >= pensize) {
1373 - t->pen().setWidth(pensize);
1374 - t->drawShape(pbuf);
1377 - } else if (MODE_ERASE != _drawMode) {
1378 - if (MODE_FORMAT == _drawMode || MODE_CURVE == _drawMode) {
1379 - QPen pen1(QColor(0, 240, 240), 1);
1380 - QPen pen2(QColor(0, 0, 0), 1);
1381 - pbuf.setPen(QPen(QColor(0, 240, 240), 1));
1382 - pbuf.setPen(pen1);
1383 - for (int x = 0; x < width() + SNAP_SIZE; x += SNAP_SIZE) {
1384 - pbuf.drawLine(x - SNAP_SIZE / 2, 0, x - SNAP_SIZE / 2, height());
1385 - for (int y = 0; y < height() + SNAP_SIZE; y += SNAP_SIZE) {
1386 - pbuf.drawLine(0, y - SNAP_SIZE / 2, width(), y - SNAP_SIZE / 2);
1387 - pbuf.drawRect(x-1,y-1,2,2);
1391 - if (_isShowGuide) {
1392 - pbuf.setPen(QPen(cyan, 1, DashLine));
1393 - if (AS_HORIZONTAL == _asMode || AS_BOTH == _asMode) {
1394 - if (0 != _origin.x() || _isUseAllQuadrant) {
1395 - pbuf.drawLine(width() / _margin, 0, width() / _margin, height());
1397 - pbuf.drawLine(width() * (_margin - 1) / _margin, 0, width() * (_margin - 1) / _margin, height());
1400 - if (AS_VERTICAL == _asMode || AS_BOTH == _asMode) {
1401 - if (0 != _origin.y() || _isUseAllQuadrant) {
1402 - pbuf.drawLine(0, height() / _margin, width(), height() / _margin);
1404 - pbuf.drawLine(0, height() * (_margin - 1) / _margin, width(), height() * (_margin - 1) / _margin);
1408 - for (uint i = 0; i < _draws.count() - _disp_offset; ++i) {
1409 - FNPolygon* p = _draws.at(i);
1410 - if (r.intersects(p->boundingRect())) {
1411 - p->drawShape(pbuf);
1415 - int w = _eraser_s;
1416 - if (PENWIDTH_MAX / 2 < _pen.width()) {
1419 - FNPointList removes;
1420 - for (uint i = 0; i < _tracks.count(); ++i) {
1421 - removes.append(_tracks.at(i));
1423 - for (uint i = 0; i < _draws.count() - _disp_offset; ++i) {
1424 - FNPolygon* p = _draws.at(i);
1425 - if (r.intersects(p->boundingRect())) {
1427 - for (uint j = 0; j < _tracks.count(); ++j) {
1428 - QPoint* pts = _tracks.at(j);
1429 - QRect selected(pts->x() - w / 2, pts->y() - w / 2, w, w);
1430 - for (uint k = 0; k < p->points().count(); ++k) {
1431 - QPoint& pts2 = p->points().at(k);
1432 - if (selected.contains(pts2)) {
1434 - removes.remove(pts);
1442 - p->drawShape(pbuf, f);
1445 - for (uint i = 0; i < removes.count(); ++i) {
1446 - _tracks.remove(removes.at(i));
1449 - if (_isDragging) {
1450 - pbuf.setPen(QPen(black, 1));
1451 - pbuf.drawRect(_last.x() - w / 2, _last.y() - w / 2, w, w);
1459 -void FNCanvas::changeColor(QRgb c)
1461 - _pen.setColor(QColor(c));
1464 -void FNCanvas::undo()
1466 - if (MODE_ERASE != _drawMode) {
1468 - if (_disp_offset > _draws.count()) {
1469 - _disp_offset = _draws.count();
1472 - _draws = _undobuf;
1478 -void FNCanvas::redo()
1480 - if (MODE_ERASE != _drawMode) {
1481 - if (0 < _disp_offset) {
1488 -void FNCanvas::clearList(FNPolygonList& list)
1490 - list.setAutoDelete(true);
1492 - list.setAutoDelete(false);
1495 -void FNCanvas::clear()
1498 - clearList(_draws);
1504 -void FNCanvas::viewChanged(bool flg)
1509 - if (_isUseAllQuadrant) {
1517 -void FNCanvas::redobuf_flush()
1519 - for (uint i = 0; i < _disp_offset; ++i) {
1520 - FNPolygon* p = _draws.last();
1527 -void FNCanvas::modeChanged(int mode)
1532 - if (MODE_ERASE == _drawMode) {
1534 - _undobuf = _draws;
1536 - if (_draws.count() != _undobuf.count()) {
1537 - for (uint i = 0; i < _marks.count(); ++i) {
1538 - FNPolygon* p = _marks.at(i);
1541 - clearList(_marks);
1547 -QRect FNCanvas::getMatrix(const QRect& r) const
1549 - int ox = _origin.x();
1550 - int oy = _origin.y();
1551 - const int wide = 100;
1553 - int left = r.left() + ox;
1554 - int top = r.top() + oy;
1555 - int right = r.right() + ox;
1556 - int bottom = r.bottom() + oy;
1558 - left = (int)(left / wide) * wide;
1559 - top = (int)(top / wide) * wide;
1560 - right = (right % wide == 0 && left != right) ? right : (int)((right + wide) / wide) * wide;
1561 - bottom = (bottom % wide == 0 && top != bottom) ? bottom : (int)((bottom + wide) / wide) * wide;
1563 - return QRect(left - ox, top - oy, right - left, bottom - top);
1566 -void FNCanvas::CR()
1568 - if (MODE_ERASE == _drawMode) {
1571 - if (_isHeadingEnables) {
1572 - //last
\82©
\82ç
\81A
\8d¶
\95û
\8cü
\82É
\8cü
\82¯
\82Ä
\92T
\8dõ
\82·
\82é
\81B
1573 - QRect r = getMatrix(_draws.last()->boundingRect());
1574 - bool isSearching = true;
1575 - r.moveBy(-100, 0);
1576 - while (isSearching) {
1577 - isSearching = false;
1578 - for (uint i = 0; i < _draws.count(); ++i) {
1579 - FNPolygon* p = _draws.at(i);
1580 - const QRect& r2 = p->boundingRect();
1581 - if (r.intersects(r2)) {
1582 - if (r.left() + 100 > r2.left()) {
1583 - r = getMatrix(r2);
1584 - r.moveBy(-100, 0);
1585 - isSearching = true;
1592 - //last
\82ª
\89æ
\96Ê
\82Ì4/5
\88È
\89º
\82È
\82ç
\82Î
\81A
\83X
\83N
\83\8d\81[
\83\8b\83A
\83b
\83v
\82·
\82é
\81B
1593 - //
\82»
\82¤
\82Å
\82È
\82¯
\82ê
\82Î
\81A
\83w
\83b
\83f
\83B
\83\93\83O
\82Ì
\82Ý
\81B
1594 - if (_last.y() > height() * 4 / 5) {
1595 - setOrigin(_origin.x() + r.x(), _origin.y() + 50);
1597 - setOrigin(_origin.x() + r.x(), _origin.y());
1599 - _isHeadingEnables = false;
1601 - //last
\82Ì
\8eü
\88Í
\82É
\89½
\82à
\96³
\82¢
\8fê
\8d\87\82Í
\81A
\8fc
\82É
\83X
\83N
\83\8d\81[
\83\8b\82·
\82é
\81B
1602 - setOrigin(_origin.x(), _origin.y() + 50);
1606 -void FNCanvas::erase()
1608 - if (MODE_ERASE != _drawMode) {
1611 - FNPolygonList temp;
1612 - int w = _eraser_s;
1613 - if (PENWIDTH_MAX / 2 < _pen.width()) {
1616 - QRect r = QRect(0, 0, width(), height());
1617 - for (uint i = 0; i < _draws.count(); ++i) {
1618 - FNPolygon* p = _draws.at(i);
1620 - if (r.intersects(p->boundingRect())) {
1621 - for (uint j = 0; j < _tracks.count(); ++j) {
1622 - QPoint* pts = _tracks.at(j);
1623 - QRect selected(pts->x() - w / 2, pts->y() - w / 2, w, w);
1624 - for (uint k = 0; k < p->points().count(); ++k) {
1625 - QPoint& pts2 = p->points().at(k);
1626 - if (selected.contains(pts2)) {
1638 - for (uint i = 0; i < temp.count(); ++i) {
1639 - _draws.remove(temp.at(i));
1640 - _marks.append(temp.at(i));
1646 -void FNCanvas::setPensize(int sz)
1648 - _pen.setWidth(sz);
1651 -bool FNCanvas::exportPNG(const QFileInfo& info, QPixmap& buf)
1653 - if (0 == info.fileName().length()) {
1654 - QMessageBox::warning(0,"FreeNoteQt", "file name is empty.");
1657 - if (info.extension(false) != "png") {
1658 - QMessageBox::warning(0,"FreeNoteQt", "extension '.png' expected.");
1662 - bool ret = buf.save(info.absFilePath(), "PNG");
1664 - FNMessageBox::information(0,"FreeNoteQt", "export PNG complete.");
1666 - QMessageBox::warning(0,"FreeNoteQt", "could not export file.");
1671 -QString FNCanvas::mkPDFscript(FNPolygon* elm)
1676 - float r = (float)elm->pen().color().red() / 255.0f;
1677 - float g = (float)elm->pen().color().green() / 255.0f;
1678 - float b = (float)elm->pen().color().blue() / 255.0f;
1680 - sprintf(buf, "%f %f %f RG\n", r, g, b);
1682 - QPointArray points = elm->points().copy();
1683 - points.translate(_origin.x(), _origin.y());
1684 - if (elm->type() == FN_BEZIER) {
1685 - sprintf(buf, "%d %d m\n", points[0].x(), points[0].y());
1687 - for (uint j = 1; j < points.count(); j += 3) {
1688 - sprintf(buf, "%d %d %d %d %d %d c\n",
1689 - points[j].x(), points[j].y(),
1690 - points[j + 1].x(), points[j + 1].y(),
1691 - points[j + 2].x(), points[j + 2].y()
1695 - } else if (elm->type() == FN_ELLIPSE) {
1696 - int x = points[0].x();
1697 - int y = points[0].y();
1698 - int ex = points[1].x();
1699 - int ey = points[1].y();
1704 - int x1 = x + 3*w/4;
1711 - sprintf(buf, "%d %d m\n%d %d %d %d %d %d c\n", cx, cy, x1, y1, x2, y2, x3, y3);
1714 - y1 = y + 3 * h / 4;
1715 - x2 = x + 3 * w / 4;
1719 - sprintf(buf, "%d %d %d %d %d %d c\n", x1, y1, x2, y2, x3, y3);
1725 - y2 = y + 3 * h / 4;
1728 - sprintf(buf, "%d %d %d %d %d %d c\n", x1, y1, x2, y2, x3, y3);
1736 - sprintf(buf, "%d %d %d %d %d %d c\n", x1, y1, x2, y2, x3, y3);
1739 - sprintf(buf, "%d %d m\n", points[0].x(), points[0].y());
1741 - for (uint j = 1; j < points.count(); ++j) {
1742 - sprintf(buf, "%d %d l\n", points[j].x(), points[j].y());
1746 - sprintf(buf, "%d w\n", elm->pen().width());
1753 -bool FNCanvas::exportPDF(const QFileInfo& info)
1755 - if (0 == info.fileName().length()) {
1756 - QMessageBox::warning(0,"FreeNoteQt", "file name is empty.");
1759 - if (info.extension(false) != "pdf") {
1760 - QMessageBox::warning(0,"FreeNoteQt", "extension '.pdf' expected.");
1765 - if (!(fp = fopen(info.absFilePath().utf8(), "wt"))) {
1766 - QMessageBox::warning(0,"FreeNoteQt", "could not export file.");
1770 - QPoint o = getTopLeft();
1775 - for (uint i = 0; i < _draws.count() - _disp_offset; ++i) {
1776 - FNPolygon* p = _draws.at(i);
1777 - QRect r = p->boundingRect();
1778 - r.moveBy(_origin.x(), _origin.y());
1779 - if (wx < r.right()) {
1782 - if (wy < r.bottom()) {
1789 - sprintf(buf, "1 0 0 -1 0 %d cm\n", wy);
1791 - len += cm.length();
1793 - for (uint i = 0; i < _draws.count() - _disp_offset; ++i) {
1794 - QString s = mkPDFscript(_draws.at(i));
1795 - len += s.length();
1798 - QString header = "";
1799 - header += "%PDF-1.3\n";
1800 - header += "1 0 obj\n";
1802 - header += "/Type /Page\n";
1803 - header += "/Parent 3 0 R\n";
1804 - header += "/Resources\n";
1806 - header += "/ProcSet [ /PDF ]\n";
1808 - sprintf(buf, "/MediaBox [ 0 0 %010d %010d ]\n", wx, wy);
1810 - header += "/Contents 4 0 R\n";
1812 - header += "endobj\n";
1813 - header += "2 0 obj\n";
1815 - header += "/Type /Catalog\n";
1816 - header += "/Pages 3 0 R\n";
1817 - header += "/PageLayout /OneColumn\n";
1818 - header += "/OpenAction [1 0 R /XYZ null null 1 ]\n";
1820 - header += "endobj\n";
1821 - header += "3 0 obj\n";
1823 - header += "/Type /Pages\n";
1824 - header += "/Kids [ 1 0 R ]\n";
1825 - header += "/Count 1\n";
1827 - header += "endobj\n";
1828 - header += "4 0 obj\n";
1829 - sprintf(buf, "<< /Length %010d >>\n", len);
1831 - header += "stream\n";
1833 - QString footer = "";
1834 - footer += "xref\n";
1835 - footer += "0 5\n";
1836 - footer += "0000000000 65535 f \n";
1837 - footer += "0000000009 00000 n \n";
1838 - footer += "0000000147 00000 n \n";
1839 - footer += "0000000257 00000 n \n";
1840 - footer += "0000000316 00000 n \n";
1841 - footer += "trailer\n";
1843 - footer += "/Size 5\n";
1844 - footer += "/Root 2 0 R\n";
1846 - footer += "startxref\n";
1848 - len = cm.length();
1849 - len += header.length();
1850 - fputs(header, fp);
1853 - for (uint i = 0; i < _draws.count() - _disp_offset; ++i) {
1854 - QString s = mkPDFscript(_draws.at(i));
1855 - len += s.length();
1858 - QString streamfooter = "endstream\nendobj\n";
1859 - len += streamfooter.length();
1860 - fputs(streamfooter, fp);
1862 - fputs(footer, fp);
1863 - sprintf(buf, "%d\n", len);
1865 - fputs("%%EOF\n", fp);
1867 - if (_isUseAllQuadrant) {
1868 - setOrigin(-o.x(), -o.y());
1870 - FNMessageBox::information(0,"FreeNoteQt", "export PDF complete.");
1874 -bool FNCanvas::save(const QFileInfo& info)
1876 - if (0 == info.fileName().length()) {
1877 - QMessageBox::warning(0,"FreeNoteQt", "file name is empty.");
1880 - if (info.extension(false) != "free") {
1881 - QMessageBox::warning(0,"FreeNoteQt", "extension '.free' expected.");
1885 - if (!(fp = fopen(info.absFilePath().utf8(), "wt"))) {
1886 - QMessageBox::warning(0,"FreeNoteQt", "could not save file.");
1889 - QPoint o = getTopLeft();
1891 - fputs("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n", fp);
1892 - fputs("<freenote version=\"2.0\">\n", fp);
1894 - for (uint i = 0; i < _draws.count() - _disp_offset; ++i) {
1895 - FNPolygon p(*_draws.at(i));
1896 - p.translate(_origin.x(), _origin.y());
1897 - if (p.type() == FN_BEZIER) {
1898 - sprintf(buf, "\t<bz color=\"%x\" width=\"%d\">\n", (uint)p.pen().color().rgb(), p.pen().width());
1899 - } else if (p.type() == FN_ELLIPSE) {
1900 - sprintf(buf, "\t<el color=\"%x\" width=\"%d\">\n", (uint)p.pen().color().rgb(), p.pen().width());
1902 - sprintf(buf, "\t<po color=\"%x\" width=\"%d\">\n", (uint)p.pen().color().rgb(), p.pen().width());
1905 - QPointArray& points = p.points();
1906 - for (uint j = 0; j < points.count(); ++j) {
1907 - QPoint point = points.point(j);
1908 - sprintf(buf, "\t\t<p x=\"%d\" y=\"%d\"/>\n", point.x(), point.y());
1911 - if (p.type() == FN_BEZIER) {
1912 - fputs("\t</bz>\n", fp);
1913 - } else if (p.type() == FN_ELLIPSE) {
1914 - fputs("\t</el>\n", fp);
1916 - fputs("\t</po>\n", fp);
1919 - fputs("</freenote>\n", fp);
1921 - if (_isUseAllQuadrant) {
1922 - setOrigin(-o.x(), -o.y());
1924 - FNMessageBox::information(0, "FreeNoteQt", "save complete.");
1928 -bool FNCanvas::load(const QFileInfo& info)
1930 - if (0 == info.fileName().length()) {
1931 - QMessageBox::warning(0,"FreeNoteQt", "file name is empty.");
1934 - if (!info.exists()) {
1935 - QMessageBox::warning(0,"FreeNoteQt", "file not exists.");
1939 - if (!(fp = fopen(info.absFilePath().utf8(), "rt"))) {
1940 - QMessageBox::warning(0,"FreeNoteQt", "could not open file.");
1946 - FNPointList points;
1947 - points.setAutoDelete(true);
1950 - QPen pen(Qt::black, 1);
1951 - FNPolygon* polygon;
1955 - QString type = "";
1956 - while (!feof(fp)) {
1957 - fgets(rdbuf, sizeof(rdbuf), fp);
1959 - if (-1 != line.find("<fnpolygon ") ||
1960 - -1 != line.find("<po ") ||
1961 - -1 != line.find("<bz ") ||
1962 - -1 != line.find("<el ")
1964 - if (-1 != line.find("<el ")) {
1966 - } else if (-1 != line.find("<bz ")) {
1972 - int st = line.find("color") + 7;
1973 - int ed = line.find("\"", st);
1974 - strcpy(buf, line.mid(st, ed - st).utf8());
1975 - sscanf(buf, "%x", &c);
1976 - st = line.find("width") + 7;
1977 - ed = line.find("\"", st);
1978 - strcpy(buf, line.mid(st, ed - st).utf8());
1979 - sscanf(buf, "%d", &w);
1980 - } else if (-1 != line.find("<point ") ||
1981 - -1 != line.find("<p ")
1983 - int st = line.find("x=") + 3;
1984 - int ed = line.find("\"", st);
1985 - strcpy(buf, line.mid(st, ed - st).utf8());
1987 - sscanf(buf, "%d", &x);
1989 - st = line.find("y=") + 3;
1990 - ed = line.find("\"", st);
1991 - strcpy(buf, line.mid(st, ed - st).utf8());
1993 - sscanf(buf, "%d", &y);
1994 - points.append(createPts(x, y)); //
\83o
\83O
\91Î
\8dô
1995 - } else if (-1 != line.find("</fnpolygon") ||
1996 - -1 != line.find("</bz") ||
1997 - -1 != line.find("</el") ||
1998 - -1 != line.find("</po")) {
1999 - pen.setColor((QRgb)c);
2001 - if (type == "Bezier") {
2002 - _draws.append(polygon = createBezier(pen)); //
\83o
\83O
\91Î
\8dô
2003 - } else if (type == "Ellipse") {
2004 - _draws.append(polygon = createEllipse(pen)); //
\83o
\83O
\91Î
\8dô
2006 - _draws.append(polygon = createPolygon(pen)); //
\83o
\83O
\91Î
\8dô
2008 - polygon->setPoints(points);
2015 - for (uint i = 0; i < _draws.count(); ++i) {
2016 - if (y > _draws.at(i)->boundingRect().top()) {
2017 - y = _draws.at(i)->boundingRect().top();
2019 - if (x > _draws.at(i)->boundingRect().left()) {
2020 - x = _draws.at(i)->boundingRect().left();
2023 - for (uint i = 0; i < _draws.count(); ++i) {
2024 - _draws.at(i)->translate(-x, -y);
2027 - FNMessageBox::information(0,"FreeNoteQt", "load complete.");
2032 -FNPolygon* FNCanvas::createPolygon(QPen& pen)
2034 - return new FNPolygon(pen);
2037 -FNPolygon* FNCanvas::createBezier(QPen& pen)
2039 - return new FNBezier(pen);
2043 -FNPolygon* FNCanvas::createEllipse(QPen& pen)
2045 - return new FNEllipse(pen);
2048 -QPoint* FNCanvas::createPts(int x, int y)
2050 - return new QPoint(x, y);
2053 -void FNCanvas::setGuide(bool f)
2058 +/* FreeNote for Sharp SLA300, B500, C7x0 Linux PDA
2059 + Copyright (C) 2003 Joe Kanemori.<kanemori@ymg.urban.ne.jp>
2061 + This program is free software; you can redistribute it and/or modify
2062 + it under the terms of the GNU General Public License as published by
2063 + the Free Software Foundation; either version 2 of the License, or
2064 + (at your option) any later version.
2066 + This program is distributed in the hope that it will be useful,
2067 + but WITHOUT ANY WARRANTY; without even the implied warranty of
2068 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2069 + GNU General Public License for more details.
2071 + You should have received a copy of the GNU General Public License
2072 + along with this program; if not, write to the Free Software
2073 + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
2076 +2003/12/23 ver 1.6.1
2077 +
\81E
\95Û
\91¶
\8fî
\95ñ
\82Ì
\83T
\83C
\83Y
\8fk
\8f¬
2079 +2003/12/16-19 ver 1.5.5pre
2080 +
\81E
\83y
\83\93\83T
\83C
\83Y
\82Ì
\92Ç
\89Á(1-8)
2081 +
\81E
\83A
\83\93\83h
\83D
\81E
\83\8a\83h
\83D
\82Ì
\8eÀ
\91\95
2083 +2003/12/14 ver 1.5.4pre
2084 +
\81E
\83y
\83\93\83T
\83C
\83Y
\82ð
\91I
\91ð
\89Â
\94\
\82É
\81B
2086 +2003/12/05 ver 1.5.3Apre
2087 +
\81E
\83O
\83\8a\83b
\83h
\82Ì
\90F
\82ð
\8fC
\90³
2089 +2003/12/04 ver 1.5.3pre
2090 +
\81E
\83O
\83\8a\83b
\83h
\82Ì
\95`
\89æ
\82ð
\88ê
\95\94\8fC
\90³
2092 +2003/11/10 ver 1.5.1pre
2093 +
\81E
\8bÈ
\90ü
\90®
\8c`
\83\82\81[
\83h
\92Ç
\89Á
2095 +2003/11/09 ver 1.5.0pre
2096 +
\81E
\8e©
\93®
\90®
\8c`
\83\82\81[
\83h
\92Ç
\89Á
2098 +2003/09/03 ver 1.3.4pre
2099 +
\81EUse all quadrant OFF
\8e\9e\82É
\95\
\8e¦
\88Ê
\92u
\82ª
\83\8a\83Z
\83b
\83g
\82³
\82ê
\82é
\8fê
\8d\87\82ª
\82 \82é
\83o
\83O
\91Î
\89\9e\81B
2101 +2003/09/01-03 ver 1.3.3pre
2102 +
\81E
\83X
\83N
\83\8d\81[
\83\8b\82Ì
\89ü
\97Ç
2103 +
\81EUse all quadrant(
\91S
\8fÛ
\8cÀ
\82ð
\8eg
\97p
\82·
\82é)
\83\81\83j
\83\85\81[
\82ð
\92Ç
\89Á
2105 +2003/08/31 FreeNote 1.3.2pre
2106 +
\81E
\91S
\95û
\8cü
\83X
\83N
\83\8d\81[
\83\8b
2108 +2003/08/23 FreeNote 1.3.0pre
2109 +
\81ECR
\93®
\8dì
\82Ì
\8fC
\90³
2111 +2003/08/15 FreeNote 1.2.1
\82ð
\8cö
\8aJ
2112 +
\81E
\95Û
\91¶
\8e\9e\82Ì
\83o
\83O
\8fC
\90³
2113 +
\81E
\8a®
\97¹
\83_
\83C
\83A
\83\8d\83O
\82Ì
\8e©
\93®
\8fÁ
\8b\8e
2114 +
\81EPNG
\83t
\83@
\83C
\83\8b\82Ö
\82Ì
\8fo
\97Í
2116 +2003/08/15 FreeNote 1.2
\82ð
\8cö
\8aJ
2117 +
\81E
\83I
\83v
\83V
\83\87\83\93\92Ç
\89Á
2118 +
\81E
\83X
\83N
\83\8d\81[
\83\8b\83K
\83C
\83h
2119 +
\81EFree
\83t
\83@
\83C
\83\8b\8aÖ
\98A
\95t
\82¯
2120 +
\81E
\83A
\83C
\83R
\83\93\82Ì
\95Ï
\8dX
2122 +2003/08/05 FreeNote 1.1.1pre
\82ð
\8cö
\8aJ
2123 +
\81E
\8d\82\91¬
\8bN
\93®
\8e\9e\82É
\95Â
\82¶
\82½
\8fó
\91Ô
\82ð
\95Û
\8e\9d
2124 +
\81E
\95`
\89æ
\83\82\81[
\83h
\90Ø
\91Ö
\82¦
\8e\9e\82É
\8fÁ
\82µ
\83S
\83\80\95\
\8e¦
2125 +
\81E
\95Û
\91¶
\8e\9e\8aÔ
\92Z
\8fk
2126 +
\81EView
\83\82\81[
\83h
\82Ì
\8b\93\93®
\82ð
\95Ï
\8dX
2127 +
\81E
\83\81\83j
\83\85\81[
\82Ì
\8c©
\82½
\96Ú
\82ð
\95Ï
\8dX
2129 +#include "fncanvas.h"
2132 +#include <qmessagebox.h>
2133 +#include <qtextstream.h>
2135 +#include <qcolor.h>
2136 +#include <qpoint.h>
2137 +#include <qthread.h>
2138 +#include <qimage.h>
2140 +#include <stdlib.h> // abs
2141 +#include "fnmessagebox.h"
2142 +#include "fmtengine.h"
2146 + tv = ((int)(tv + SNAP_SIZE / 2) / SNAP_SIZE) * SNAP_SIZE;
2154 +FNCanvas::FNCanvas(QWidget* parent, const char* name, WFlags f )
2155 + :QWidget(parent, name, f),
2156 + _pen(black, 1, SolidLine, RoundCap, RoundJoin),
2158 + _drawMode(MODE_DRAW),
2165 + _scrollTiming(800),
2167 + _isWaiting(false),
2168 + _isDragging(false),
2169 + _isHeadingEnables(false),
2170 + _isShowGuide(false),
2171 + _isUseAllQuadrant(false),
2175 + _tracks.setAutoDelete(true);
2176 + this->setBackgroundMode(NoBackground);
2177 + _timer = new QTimer(this);
2178 + connect(_timer, SIGNAL(timeout()), this, SLOT(autoScroll()));
2181 +FNCanvas::~FNCanvas()
2187 + clearList(_draws);
2190 +void FNCanvas::setScrollTiming(int v)
2192 + _scrollTiming = v;
2196 +void FNCanvas::setVStep(int v)
2201 +void FNCanvas::setHStep(int v)
2206 +void FNCanvas::setSEraser(int v)
2211 +void FNCanvas::setLEraser(int v)
2217 +void FNCanvas::setMargin(int v)
2225 +void FNCanvas::setScrollMode(int as)
2231 +void FNCanvas::autoScroll()
2233 + if (AS_NONE == _asMode) {
2234 + if (MODE_FORMAT == _drawMode || MODE_CURVE == _drawMode || MODE_SMOOTH == _drawMode) {
2235 + setOrigin(_origin.x(), _origin.y());
2239 + bool tmp = _isHeadingEnables;
2242 + if (AS_BOTH == _asMode || AS_HORIZONTAL == _asMode) {
2243 + if (_last.x() > width() * (_margin - 1) / _margin) {
2245 + } else if (_last.x() < width() / _margin) {
2249 + if (AS_BOTH == _asMode || AS_VERTICAL == _asMode) {
2250 + if (_last.y() > height() * (_margin - 1) / _margin) {
2252 + } else if (_last.y() < height() / _margin) {
2256 + setOrigin(_origin.x() + dx, _origin.y() + dy);
2257 + _isHeadingEnables = tmp;
2260 +void FNCanvas::mousePressEvent(QMouseEvent* evt)
2266 + _isWaiting = true;
2267 + _viewMode = false;
2268 + setOrigin((int)((evt->x()) / _scale_x) - width() / 2, (int)((evt->y()) / _scale_y) - height() / 2);
2270 + emit resetViewMode();
2271 + } else if (MODE_ERASE != _drawMode) {
2272 + _last = evt->pos();
2273 + _tracks.append(new QPoint(_last));
2276 + _last = evt->pos();
2277 + _tracks.append(new QPoint(_last));
2281 + pbuf.begin(&_buffer);
2284 + int w = _eraser_s;
2285 + if (PENWIDTH_MAX / 2 < _pen.width()) {
2288 + pbuf.setRasterOp(XorROP);
2289 + pbuf.setPen(QPen(white, 1));
2290 + pbuf.drawRect(_last.x() - w / 2, _last.y() - w / 2, w, w);
2292 + pwin.setRasterOp(XorROP);
2293 + pwin.setPen(QPen(white, 1));
2294 + pwin.drawRect(_last.x() - w / 2, _last.y() - w / 2, w, w);
2299 + _isDragging = true;
2302 +void FNCanvas::mouseMoveEvent(QMouseEvent* evt)
2307 + if (MODE_ERASE != _drawMode) {
2312 + pbuf.begin(&_buffer);
2314 + pwin.setPen(_pen);
2315 + pbuf.setPen(_pen);
2317 + pwin.drawLine(_last, evt->pos());
2318 + pbuf.drawLine(_last, evt->pos());
2322 + _last = evt->pos();
2323 + _tracks.append(new QPoint(_last));
2326 + if (_last.x() == -1) {
2332 + pbuf.begin(&_buffer);
2335 + int w = _eraser_s;
2336 + if (PENWIDTH_MAX / 2 < _pen.width()) {
2339 + pbuf.setRasterOp(XorROP);
2340 + pwin.setRasterOp(XorROP);
2341 + pbuf.setPen(QPen(white, 1));
2342 + pwin.setPen(QPen(white, 1));
2343 + pbuf.drawRect(_last.x() - w / 2, _last.y() - w / 2, w, w);
2344 + pwin.drawRect(_last.x() - w / 2, _last.y() - w / 2, w, w);
2346 + _tracks.append(new QPoint(evt->pos()));
2347 + _last = evt->pos();
2349 + pbuf.setRasterOp(CopyROP);
2350 + pwin.setRasterOp(CopyROP);
2351 + QRect r = QRect(0, 0, width(), height());
2352 + for (uint i = 0; i < _draws.count() - _disp_offset; ++i) {
2353 + FNPolygon* p = _draws.at(i);
2354 + if (r.intersects(p->boundingRect())) {
2356 + QRect selected(_last.x() - w / 2, _last.y() - w / 2, w, w);
2357 + for (uint j = 0; j < p->points().count(); ++j) {
2358 + QPoint& pts = p->points().at(j);
2359 + if (selected.contains(pts)) {
2365 + p->drawShape(pbuf, f);
2366 + p->drawShape(pwin, f);
2370 + pbuf.setRasterOp(XorROP);
2371 + pwin.setRasterOp(XorROP);
2372 + pbuf.setPen(QPen(white, 1));
2373 + pwin.setPen(QPen(white, 1));
2374 + pbuf.drawRect(_last.x() - w / 2, _last.y() - w / 2, w, w);
2375 + pwin.drawRect(_last.x() - w / 2, _last.y() - w / 2, w, w);
2381 +void FNCanvas::mouseReleaseEvent(QMouseEvent* evt)
2383 + _isDragging = false;
2385 + _isWaiting = false;
2388 + _last = evt->pos();
2389 + if (MODE_ERASE != _drawMode) {
2390 + if (1 < _tracks.count()) {
2391 + FNPolygon* p = NULL;
2392 + if (MODE_FORMAT == _drawMode) {
2393 + p = new FNPolygon(_pen);
2394 + _tracks = AutoFormat(_tracks);
2395 + } else if (MODE_CURVE == _drawMode) {
2396 + QPoint sp = SnapPoint(*_tracks.at(0));
2397 + QPoint ep = SnapPoint(*_tracks.at(_tracks.count()-1));
2398 + _tracks = AutoCurve(_tracks);
2400 + p = new FNEllipse(_pen);
2401 + } else if (2 < _tracks.count()) {
2402 + p = new FNBezier(_pen);
2404 + p = new FNPolygon(_pen);
2406 + } else if (MODE_SMOOTH == _drawMode) {
2407 + _tracks = Smoothing(_tracks);
2408 + if (2 < _tracks.count()) {
2409 + p = new FNBezier(_pen);
2411 + p = new FNPolygon(_pen);
2414 + _tracks = Reduce(_tracks);
2415 + p = new FNPolygon(_pen);
2417 + if (1 < _tracks.count()) {
2418 + p->setPoints(_tracks);
2424 + _isHeadingEnables = true;
2425 + _timer->start(_scrollTiming, true);
2427 + _last = QPoint(-1, -1);
2428 + _tracks.append(new QPoint(evt->pos()));
2433 +void FNCanvas::paintEvent(QPaintEvent* evt)
2435 + bitBlt(this, 0, 0, &_buffer);
2438 +void FNCanvas::resizeEvent(QResizeEvent* evt)
2440 + QPixmap save(_buffer);
2441 + _buffer.resize(evt->size());
2442 + _buffer.fill(white);
2443 + bitBlt(&_buffer, 0, 0, &save);
2447 +void FNCanvas::setOrigin(QPoint& o)
2449 + this->setOrigin(o.x(), o.y());
2452 +QPoint FNCanvas::getTopLeft()
2454 + if (0 == _draws.count() || !_isUseAllQuadrant) {
2458 + int dx = ((FNPolygon*)_draws.at(0))->boundingRect().x();
2459 + int dy = ((FNPolygon*)_draws.at(0))->boundingRect().y();
2460 + for (uint i = 1; i < _draws.count(); ++i) {
2461 + FNPolygon* p = _draws.at(i);
2462 + if (dx > p->boundingRect().x()) {
2463 + dx = p->boundingRect().x();
2465 + if (dy > p->boundingRect().y()) {
2466 + dy = p->boundingRect().y();
2469 + return QPoint(snap(dx), snap(dy));
2473 +void FNCanvas::rebuild()
2475 + if (0 == _draws.count() || !_isUseAllQuadrant) {
2479 + QPoint d = getTopLeft();
2480 + for (uint i = 0; i < _draws.count(); ++i) {
2481 + FNPolygon* p = _draws.at(i);
2482 + p->translate(-d.x(), -d.y());
2485 + _origin = QPoint(0, 0);
2489 +void FNCanvas::setOrigin(int ox, int oy)
2493 + _isHeadingEnables = false;
2499 + if (!_isUseAllQuadrant) {
2506 + dx = _origin.x() - ox;
2507 + dy = _origin.y() - oy;
2509 + dx = _origin.x() - ox;
2510 + dy = _origin.y() - oy;
2518 + for (uint i = 0; i < _tracks.count(); ++i) {
2519 + QPoint* p = _tracks.at(i);
2520 + p->setX(p->x() + dx);
2521 + p->setY(p->y() + dy);
2524 + for (uint i = 0; i < _draws.count(); ++i) {
2525 + FNPolygon* p = _draws.at(i);
2526 + p->translate(dx, dy);
2528 + _origin = QPoint(ox, oy);
2529 + emit originChanged(ox, oy);
2533 +void FNCanvas::redraw()
2535 + if (!this->isVisible()) {
2538 + _buffer.fill(white);
2540 + QRect r = QRect(0, 0, width(), height());
2541 + pbuf.begin(&_buffer);
2545 + for (uint i = 0; i < _draws.count() - _disp_offset; ++i) {
2546 + FNPolygon* p = _draws.at(i);
2547 + QRect r = p->boundingRect();
2548 + if (wx < r.right()) {
2551 + if (wy < r.bottom()) {
2557 + wx = snap((int)wx);
2558 + wy = snap((int)wy);
2559 + wx = wx + _origin.x();
2560 + wy = wy + _origin.y();
2561 + _scale_x = (float)width() / wx;
2562 + _scale_y = (float)height() / wy;
2563 + if (1.0f < _scale_x) {
2566 + if (1.0f < _scale_y) {
2569 + if (_scale_x > _scale_y) {
2570 + _scale_x = _scale_y;
2571 + } else if (_scale_x < _scale_y) {
2572 + _scale_y = _scale_x;
2574 + for (uint i = 0; i < _draws.count() - _disp_offset; ++i) {
2575 + FNPolygon* p = _draws.at(i);
2576 + FNPolygon* t = NULL;
2577 + if (p->type() == FN_BEZIER) {
2578 + t = new FNBezier(*(FNBezier*)p);
2579 + } else if (p->type() == FN_ELLIPSE) {
2580 + t = new FNEllipse(*(FNEllipse*)p);
2582 + t = new FNPolygon(*p);
2584 + t->translate(-_origin.x(), -_origin.y());
2585 + for (uint j = 0; j < t->points().count(); ++j) {
2586 + QPoint& pts = t->points().at(j);
2587 + int x = (int)(pts.x() * _scale_x);
2588 + int y = (int)(pts.y() * _scale_y);
2592 + double pensize = t->pen().width();
2593 + if (_scale_x > _scale_y) {
2594 + pensize = pensize * _scale_y;
2596 + pensize = pensize * _scale_x;
2598 + if (0 >= pensize) {
2601 + t->pen().setWidth(pensize);
2602 + t->drawShape(pbuf);
2605 + } else if (MODE_ERASE != _drawMode) {
2606 + if (MODE_FORMAT == _drawMode || MODE_CURVE == _drawMode) {
2607 + QPen pen1(QColor(0, 240, 240), 1);
2608 + QPen pen2(QColor(0, 0, 0), 1);
2609 + pbuf.setPen(QPen(QColor(0, 240, 240), 1));
2610 + pbuf.setPen(pen1);
2611 + for (int x = 0; x < width() + SNAP_SIZE; x += SNAP_SIZE) {
2612 + pbuf.drawLine(x - SNAP_SIZE / 2, 0, x - SNAP_SIZE / 2, height());
2613 + for (int y = 0; y < height() + SNAP_SIZE; y += SNAP_SIZE) {
2614 + pbuf.drawLine(0, y - SNAP_SIZE / 2, width(), y - SNAP_SIZE / 2);
2615 + pbuf.drawRect(x-1,y-1,2,2);
2619 + if (_isShowGuide) {
2620 + pbuf.setPen(QPen(cyan, 1, DashLine));
2621 + if (AS_HORIZONTAL == _asMode || AS_BOTH == _asMode) {
2622 + if (0 != _origin.x() || _isUseAllQuadrant) {
2623 + pbuf.drawLine(width() / _margin, 0, width() / _margin, height());
2625 + pbuf.drawLine(width() * (_margin - 1) / _margin, 0, width() * (_margin - 1) / _margin, height());
2628 + if (AS_VERTICAL == _asMode || AS_BOTH == _asMode) {
2629 + if (0 != _origin.y() || _isUseAllQuadrant) {
2630 + pbuf.drawLine(0, height() / _margin, width(), height() / _margin);
2632 + pbuf.drawLine(0, height() * (_margin - 1) / _margin, width(), height() * (_margin - 1) / _margin);
2636 + for (uint i = 0; i < _draws.count() - _disp_offset; ++i) {
2637 + FNPolygon* p = _draws.at(i);
2638 + if (r.intersects(p->boundingRect())) {
2639 + p->drawShape(pbuf);
2643 + int w = _eraser_s;
2644 + if (PENWIDTH_MAX / 2 < _pen.width()) {
2647 + FNPointList removes;
2648 + for (uint i = 0; i < _tracks.count(); ++i) {
2649 + removes.append(_tracks.at(i));
2651 + for (uint i = 0; i < _draws.count() - _disp_offset; ++i) {
2652 + FNPolygon* p = _draws.at(i);
2653 + if (r.intersects(p->boundingRect())) {
2655 + for (uint j = 0; j < _tracks.count(); ++j) {
2656 + QPoint* pts = _tracks.at(j);
2657 + QRect selected(pts->x() - w / 2, pts->y() - w / 2, w, w);
2658 + for (uint k = 0; k < p->points().count(); ++k) {
2659 + QPoint& pts2 = p->points().at(k);
2660 + if (selected.contains(pts2)) {
2662 + removes.remove(pts);
2670 + p->drawShape(pbuf, f);
2673 + for (uint i = 0; i < removes.count(); ++i) {
2674 + _tracks.remove(removes.at(i));
2677 + if (_isDragging) {
2678 + pbuf.setPen(QPen(black, 1));
2679 + pbuf.drawRect(_last.x() - w / 2, _last.y() - w / 2, w, w);
2687 +void FNCanvas::changeColor(QRgb c)
2689 + _pen.setColor(QColor(c));
2692 +void FNCanvas::undo()
2694 + if (MODE_ERASE != _drawMode) {
2696 + if (_disp_offset > _draws.count()) {
2697 + _disp_offset = _draws.count();
2700 + _draws = _undobuf;
2706 +void FNCanvas::redo()
2708 + if (MODE_ERASE != _drawMode) {
2709 + if (0 < _disp_offset) {
2716 +void FNCanvas::clearList(FNPolygonList& list)
2718 + list.setAutoDelete(true);
2720 + list.setAutoDelete(false);
2723 +void FNCanvas::clear()
2726 + clearList(_draws);
2732 +void FNCanvas::viewChanged(bool flg)
2737 + if (_isUseAllQuadrant) {
2745 +void FNCanvas::redobuf_flush()
2747 + for (uint i = 0; i < _disp_offset; ++i) {
2748 + FNPolygon* p = _draws.last();
2755 +void FNCanvas::modeChanged(int mode)
2760 + if (MODE_ERASE == _drawMode) {
2762 + _undobuf = _draws;
2764 + if (_draws.count() != _undobuf.count()) {
2765 + for (uint i = 0; i < _marks.count(); ++i) {
2766 + FNPolygon* p = _marks.at(i);
2769 + clearList(_marks);
2775 +QRect FNCanvas::getMatrix(const QRect& r) const
2777 + int ox = _origin.x();
2778 + int oy = _origin.y();
2779 + const int wide = 100;
2781 + int left = r.left() + ox;
2782 + int top = r.top() + oy;
2783 + int right = r.right() + ox;
2784 + int bottom = r.bottom() + oy;
2786 + left = (int)(left / wide) * wide;
2787 + top = (int)(top / wide) * wide;
2788 + right = (right % wide == 0 && left != right) ? right : (int)((right + wide) / wide) * wide;
2789 + bottom = (bottom % wide == 0 && top != bottom) ? bottom : (int)((bottom + wide) / wide) * wide;
2791 + return QRect(left - ox, top - oy, right - left, bottom - top);
2794 +void FNCanvas::CR()
2796 + if (MODE_ERASE == _drawMode) {
2799 + if (_isHeadingEnables) {
2800 + //last
\82©
\82ç
\81A
\8d¶
\95û
\8cü
\82É
\8cü
\82¯
\82Ä
\92T
\8dõ
\82·
\82é
\81B
2801 + QRect r = getMatrix(_draws.last()->boundingRect());
2802 + bool isSearching = true;
2803 + r.moveBy(-100, 0);
2804 + while (isSearching) {
2805 + isSearching = false;
2806 + for (uint i = 0; i < _draws.count(); ++i) {
2807 + FNPolygon* p = _draws.at(i);
2808 + const QRect& r2 = p->boundingRect();
2809 + if (r.intersects(r2)) {
2810 + if (r.left() + 100 > r2.left()) {
2811 + r = getMatrix(r2);
2812 + r.moveBy(-100, 0);
2813 + isSearching = true;
2820 + //last
\82ª
\89æ
\96Ê
\82Ì4/5
\88È
\89º
\82È
\82ç
\82Î
\81A
\83X
\83N
\83\8d\81[
\83\8b\83A
\83b
\83v
\82·
\82é
\81B
2821 + //
\82»
\82¤
\82Å
\82È
\82¯
\82ê
\82Î
\81A
\83w
\83b
\83f
\83B
\83\93\83O
\82Ì
\82Ý
\81B
2822 + if (_last.y() > height() * 4 / 5) {
2823 + setOrigin(_origin.x() + r.x(), _origin.y() + 50);
2825 + setOrigin(_origin.x() + r.x(), _origin.y());
2827 + _isHeadingEnables = false;
2829 + //last
\82Ì
\8eü
\88Í
\82É
\89½
\82à
\96³
\82¢
\8fê
\8d\87\82Í
\81A
\8fc
\82É
\83X
\83N
\83\8d\81[
\83\8b\82·
\82é
\81B
2830 + setOrigin(_origin.x(), _origin.y() + 50);
2834 +void FNCanvas::erase()
2836 + if (MODE_ERASE != _drawMode) {
2839 + FNPolygonList temp;
2840 + int w = _eraser_s;
2841 + if (PENWIDTH_MAX / 2 < _pen.width()) {
2844 + QRect r = QRect(0, 0, width(), height());
2845 + for (uint i = 0; i < _draws.count(); ++i) {
2846 + FNPolygon* p = _draws.at(i);
2848 + if (r.intersects(p->boundingRect())) {
2849 + for (uint j = 0; j < _tracks.count(); ++j) {
2850 + QPoint* pts = _tracks.at(j);
2851 + QRect selected(pts->x() - w / 2, pts->y() - w / 2, w, w);
2852 + for (uint k = 0; k < p->points().count(); ++k) {
2853 + QPoint& pts2 = p->points().at(k);
2854 + if (selected.contains(pts2)) {
2866 + for (uint i = 0; i < temp.count(); ++i) {
2867 + _draws.remove(temp.at(i));
2868 + _marks.append(temp.at(i));
2874 +void FNCanvas::setPensize(int sz)
2876 + _pen.setWidth(sz);
2879 +bool FNCanvas::exportPNG(const QFileInfo& info, QPixmap& buf)
2881 + if (0 == info.fileName().length()) {
2882 + QMessageBox::warning(0,"FreeNoteQt", "file name is empty.");
2885 + if (info.extension(false) != "png") {
2886 + QMessageBox::warning(0,"FreeNoteQt", "extension '.png' expected.");
2890 + bool ret = buf.save(info.absFilePath(), "PNG");
2892 + FNMessageBox::information(0,"FreeNoteQt", "export PNG complete.");
2894 + QMessageBox::warning(0,"FreeNoteQt", "could not export file.");
2899 +QString FNCanvas::mkPDFscript(FNPolygon* elm)
2904 + float r = (float)elm->pen().color().red() / 255.0f;
2905 + float g = (float)elm->pen().color().green() / 255.0f;
2906 + float b = (float)elm->pen().color().blue() / 255.0f;
2908 + sprintf(buf, "%f %f %f RG\n", r, g, b);
2910 + QPointArray points = elm->points().copy();
2911 + points.translate(_origin.x(), _origin.y());
2912 + if (elm->type() == FN_BEZIER) {
2913 + sprintf(buf, "%d %d m\n", points[0].x(), points[0].y());
2915 + for (uint j = 1; j < points.count(); j += 3) {
2916 + sprintf(buf, "%d %d %d %d %d %d c\n",
2917 + points[j].x(), points[j].y(),
2918 + points[j + 1].x(), points[j + 1].y(),
2919 + points[j + 2].x(), points[j + 2].y()
2923 + } else if (elm->type() == FN_ELLIPSE) {
2924 + int x = points[0].x();
2925 + int y = points[0].y();
2926 + int ex = points[1].x();
2927 + int ey = points[1].y();
2932 + int x1 = x + 3*w/4;
2939 + sprintf(buf, "%d %d m\n%d %d %d %d %d %d c\n", cx, cy, x1, y1, x2, y2, x3, y3);
2942 + y1 = y + 3 * h / 4;
2943 + x2 = x + 3 * w / 4;
2947 + sprintf(buf, "%d %d %d %d %d %d c\n", x1, y1, x2, y2, x3, y3);
2953 + y2 = y + 3 * h / 4;
2956 + sprintf(buf, "%d %d %d %d %d %d c\n", x1, y1, x2, y2, x3, y3);
2964 + sprintf(buf, "%d %d %d %d %d %d c\n", x1, y1, x2, y2, x3, y3);
2967 + sprintf(buf, "%d %d m\n", points[0].x(), points[0].y());
2969 + for (uint j = 1; j < points.count(); ++j) {
2970 + sprintf(buf, "%d %d l\n", points[j].x(), points[j].y());
2974 + sprintf(buf, "%d w\n", elm->pen().width());
2981 +bool FNCanvas::exportPDF(const QFileInfo& info)
2983 + if (0 == info.fileName().length()) {
2984 + QMessageBox::warning(0,"FreeNoteQt", "file name is empty.");
2987 + if (info.extension(false) != "pdf") {
2988 + QMessageBox::warning(0,"FreeNoteQt", "extension '.pdf' expected.");
2993 + if (!(fp = fopen(info.absFilePath().utf8(), "wt"))) {
2994 + QMessageBox::warning(0,"FreeNoteQt", "could not export file.");
2998 + QPoint o = getTopLeft();
3003 + for (uint i = 0; i < _draws.count() - _disp_offset; ++i) {
3004 + FNPolygon* p = _draws.at(i);
3005 + QRect r = p->boundingRect();
3006 + r.moveBy(_origin.x(), _origin.y());
3007 + if (wx < r.right()) {
3010 + if (wy < r.bottom()) {
3017 + sprintf(buf, "1 0 0 -1 0 %d cm\n", wy);
3019 + len += cm.length();
3021 + for (uint i = 0; i < _draws.count() - _disp_offset; ++i) {
3022 + QString s = mkPDFscript(_draws.at(i));
3023 + len += s.length();
3026 + QString header = "";
3027 + header += "%PDF-1.3\n";
3028 + header += "1 0 obj\n";
3030 + header += "/Type /Page\n";
3031 + header += "/Parent 3 0 R\n";
3032 + header += "/Resources\n";
3034 + header += "/ProcSet [ /PDF ]\n";
3036 + sprintf(buf, "/MediaBox [ 0 0 %010d %010d ]\n", wx, wy);
3038 + header += "/Contents 4 0 R\n";
3040 + header += "endobj\n";
3041 + header += "2 0 obj\n";
3043 + header += "/Type /Catalog\n";
3044 + header += "/Pages 3 0 R\n";
3045 + header += "/PageLayout /OneColumn\n";
3046 + header += "/OpenAction [1 0 R /XYZ null null 1 ]\n";
3048 + header += "endobj\n";
3049 + header += "3 0 obj\n";
3051 + header += "/Type /Pages\n";
3052 + header += "/Kids [ 1 0 R ]\n";
3053 + header += "/Count 1\n";
3055 + header += "endobj\n";
3056 + header += "4 0 obj\n";
3057 + sprintf(buf, "<< /Length %010d >>\n", len);
3059 + header += "stream\n";
3061 + QString footer = "";
3062 + footer += "xref\n";
3063 + footer += "0 5\n";
3064 + footer += "0000000000 65535 f \n";
3065 + footer += "0000000009 00000 n \n";
3066 + footer += "0000000147 00000 n \n";
3067 + footer += "0000000257 00000 n \n";
3068 + footer += "0000000316 00000 n \n";
3069 + footer += "trailer\n";
3071 + footer += "/Size 5\n";
3072 + footer += "/Root 2 0 R\n";
3074 + footer += "startxref\n";
3076 + len = cm.length();
3077 + len += header.length();
3078 + fputs(header, fp);
3081 + for (uint i = 0; i < _draws.count() - _disp_offset; ++i) {
3082 + QString s = mkPDFscript(_draws.at(i));
3083 + len += s.length();
3086 + QString streamfooter = "endstream\nendobj\n";
3087 + len += streamfooter.length();
3088 + fputs(streamfooter, fp);
3090 + fputs(footer, fp);
3091 + sprintf(buf, "%d\n", len);
3093 + fputs("%%EOF\n", fp);
3095 + if (_isUseAllQuadrant) {
3096 + setOrigin(-o.x(), -o.y());
3098 + FNMessageBox::information(0,"FreeNoteQt", "export PDF complete.");
3102 +bool FNCanvas::save(const QFileInfo& info)
3104 + if (0 == info.fileName().length()) {
3105 + QMessageBox::warning(0,"FreeNoteQt", "file name is empty.");
3108 + if (info.extension(false) != "free") {
3109 + QMessageBox::warning(0,"FreeNoteQt", "extension '.free' expected.");
3113 + if (!(fp = fopen(info.absFilePath().utf8(), "wt"))) {
3114 + QMessageBox::warning(0,"FreeNoteQt", "could not save file.");
3117 + QPoint o = getTopLeft();
3119 + fputs("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n", fp);
3120 + fputs("<freenote version=\"2.0\">\n", fp);
3122 + for (uint i = 0; i < _draws.count() - _disp_offset; ++i) {
3123 + FNPolygon p(*_draws.at(i));
3124 + p.translate(_origin.x(), _origin.y());
3125 + if (p.type() == FN_BEZIER) {
3126 + sprintf(buf, "\t<bz color=\"%x\" width=\"%d\">\n", (uint)p.pen().color().rgb(), p.pen().width());
3127 + } else if (p.type() == FN_ELLIPSE) {
3128 + sprintf(buf, "\t<el color=\"%x\" width=\"%d\">\n", (uint)p.pen().color().rgb(), p.pen().width());
3130 + sprintf(buf, "\t<po color=\"%x\" width=\"%d\">\n", (uint)p.pen().color().rgb(), p.pen().width());
3133 + QPointArray& points = p.points();
3134 + for (uint j = 0; j < points.count(); ++j) {
3135 + QPoint point = points.point(j);
3136 + sprintf(buf, "\t\t<p x=\"%d\" y=\"%d\"/>\n", point.x(), point.y());
3139 + if (p.type() == FN_BEZIER) {
3140 + fputs("\t</bz>\n", fp);
3141 + } else if (p.type() == FN_ELLIPSE) {
3142 + fputs("\t</el>\n", fp);
3144 + fputs("\t</po>\n", fp);
3147 + fputs("</freenote>\n", fp);
3149 + if (_isUseAllQuadrant) {
3150 + setOrigin(-o.x(), -o.y());
3152 + FNMessageBox::information(0, "FreeNoteQt", "save complete.");
3156 +bool FNCanvas::load(const QFileInfo& info)
3158 + if (0 == info.fileName().length()) {
3159 + QMessageBox::warning(0,"FreeNoteQt", "file name is empty.");
3162 + if (!info.exists()) {
3163 + QMessageBox::warning(0,"FreeNoteQt", "file not exists.");
3167 + if (!(fp = fopen(info.absFilePath().utf8(), "rt"))) {
3168 + QMessageBox::warning(0,"FreeNoteQt", "could not open file.");
3174 + FNPointList points;
3175 + points.setAutoDelete(true);
3178 + QPen pen(Qt::black, 1);
3179 + FNPolygon* polygon;
3183 + QString type = "";
3184 + while (!feof(fp)) {
3185 + fgets(rdbuf, sizeof(rdbuf), fp);
3187 + if (-1 != line.find("<fnpolygon ") ||
3188 + -1 != line.find("<po ") ||
3189 + -1 != line.find("<bz ") ||
3190 + -1 != line.find("<el ")
3192 + if (-1 != line.find("<el ")) {
3194 + } else if (-1 != line.find("<bz ")) {
3200 + int st = line.find("color") + 7;
3201 + int ed = line.find("\"", st);
3202 + strcpy(buf, line.mid(st, ed - st).utf8());
3203 + sscanf(buf, "%x", &c);
3204 + st = line.find("width") + 7;
3205 + ed = line.find("\"", st);
3206 + strcpy(buf, line.mid(st, ed - st).utf8());
3207 + sscanf(buf, "%d", &w);
3208 + } else if (-1 != line.find("<point ") ||
3209 + -1 != line.find("<p ")
3211 + int st = line.find("x=") + 3;
3212 + int ed = line.find("\"", st);
3213 + strcpy(buf, line.mid(st, ed - st).utf8());
3215 + sscanf(buf, "%d", &x);
3217 + st = line.find("y=") + 3;
3218 + ed = line.find("\"", st);
3219 + strcpy(buf, line.mid(st, ed - st).utf8());
3221 + sscanf(buf, "%d", &y);
3222 + points.append(createPts(x, y)); //
\83o
\83O
\91Î
\8dô
3223 + } else if (-1 != line.find("</fnpolygon") ||
3224 + -1 != line.find("</bz") ||
3225 + -1 != line.find("</el") ||
3226 + -1 != line.find("</po")) {
3227 + pen.setColor((QRgb)c);
3229 + if (type == "Bezier") {
3230 + _draws.append(polygon = createBezier(pen)); //
\83o
\83O
\91Î
\8dô
3231 + } else if (type == "Ellipse") {
3232 + _draws.append(polygon = createEllipse(pen)); //
\83o
\83O
\91Î
\8dô
3234 + _draws.append(polygon = createPolygon(pen)); //
\83o
\83O
\91Î
\8dô
3236 + polygon->setPoints(points);
3243 + for (uint i = 0; i < _draws.count(); ++i) {
3244 + if (y > _draws.at(i)->boundingRect().top()) {
3245 + y = _draws.at(i)->boundingRect().top();
3247 + if (x > _draws.at(i)->boundingRect().left()) {
3248 + x = _draws.at(i)->boundingRect().left();
3251 + for (uint i = 0; i < _draws.count(); ++i) {
3252 + _draws.at(i)->translate(-x, -y);
3255 + FNMessageBox::information(0,"FreeNoteQt", "load complete.");
3260 +FNPolygon* FNCanvas::createPolygon(QPen& pen)
3262 + return new FNPolygon(pen);
3265 +FNPolygon* FNCanvas::createBezier(QPen& pen)
3267 + return new FNBezier(pen);
3271 +FNPolygon* FNCanvas::createEllipse(QPen& pen)
3273 + return new FNEllipse(pen);
3276 +QPoint* FNCanvas::createPts(int x, int y)
3278 + return new QPoint(x, y);
3281 +void FNCanvas::setGuide(bool f)