]> Shamusworld >> Repos - ttedit/commitdiff
Fix for missing ampersand in QApplication.
authorShamus Hammons <jlhamm@acm.org>
Fri, 14 Sep 2012 16:57:37 +0000 (16:57 +0000)
committerShamus Hammons <jlhamm@acm.org>
Fri, 14 Sep 2012 16:57:37 +0000 (16:57 +0000)
Makefile
src/charwindow.cpp
src/editwindow.cpp
src/ttedit.cpp
src/ttedit.h
src/ttemainwindow.cpp
ttedit.pro

index 77744df6faeb2a18bb3defa7a6a9dc5cc2625ab5..30e8c201e0034b305d0f9b331130493ec4625d87 100755 (executable)
--- a/Makefile
+++ b/Makefile
@@ -1,9 +1,9 @@
 #############################################################################
 # Makefile for building: ttedit
-# Generated by qmake (2.01a) (Qt 4.8.0) on: Mon Feb 6 15:32:02 2012
+# Generated by qmake (2.01a) (Qt 4.8.2) on: Fri Sep 14 09:37:18 2012
 # Project:  ttedit.pro
 # Template: app
-# Command: /usr/bin/qmake -unix -o Makefile ttedit.pro
+# Command: /usr/bin/qmake -o Makefile ttedit.pro
 #############################################################################
 
 ####### Compiler, tools and options
@@ -16,7 +16,7 @@ CXXFLAGS      = -pipe -O2 -D_REENTRANT -Wall -W $(DEFINES)
 INCPATH       = -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -Iobj
 LINK          = g++
 LFLAGS        = -Wl,-O1
-LIBS          = $(SUBLIBS)  -L/usr/lib64/qt4 -lQtGui -L/usr/lib64 -L/usr/lib64/qt4 -L/usr/X11R6/lib -lQtCore -lgthread-2.0 -lrt -lglib-2.0 -lpthread 
+LIBS          = $(SUBLIBS)  -L/usr/lib64/qt4 -lQtGui -L/usr/lib64 -L/usr/lib64/qt4 -L/usr/X11R6/lib -lQtCore -lglib-2.0 -lgthread-2.0 -lrt -lpthread 
 AR            = ar cqs
 RANLIB        = 
 QMAKE         = /usr/bin/qmake
@@ -152,7 +152,7 @@ Makefile: ttedit.pro  /usr/share/qt4/mkspecs/linux-g++/qmake.conf /usr/share/qt4
                /usr/share/qt4/mkspecs/features/lex.prf \
                /usr/lib64/qt4/libQtGui.prl \
                /usr/lib64/qt4/libQtCore.prl
-       $(QMAKE) -unix -o Makefile ttedit.pro
+       $(QMAKE) -o Makefile ttedit.pro
 /usr/share/qt4/mkspecs/common/unix.conf:
 /usr/share/qt4/mkspecs/common/linux.conf:
 /usr/share/qt4/mkspecs/common/gcc-base.conf:
@@ -180,7 +180,7 @@ Makefile: ttedit.pro  /usr/share/qt4/mkspecs/linux-g++/qmake.conf /usr/share/qt4
 /usr/lib64/qt4/libQtGui.prl:
 /usr/lib64/qt4/libQtCore.prl:
 qmake:  FORCE
-       @$(QMAKE) -unix -o Makefile ttedit.pro
+       @$(QMAKE) -o Makefile ttedit.pro
 
 dist: 
        @$(CHK_DIR_EXISTS) obj/ttedit1.0.0 || $(MKDIR) obj/ttedit1.0.0 
index 769c20fe8ff4c52f28bee76a3d1760cba3b03e49..cea3baad3d74f848d94056f22bde8be0444ef3c3 100755 (executable)
@@ -45,86 +45,42 @@ void CharWindow::MakePathFromPoints(GlyphPoints * gp)
 
        for(int poly=0; poly<gp->GetNumPolys(); poly++)
        {
-               if (gp->GetNumPoints(poly) > 2)
+               if (gp->GetNumPoints(poly) < 3)
+                       continue;
+
+               // Initial move: If our start point is on curve, then go to it. Otherwise,
+               // check previous point. If it's on curve, go to it otherwise go the
+               // midpoint between start point and previous (since it's between two curve
+               // control points).
+               IPoint pt = (gp->GetOnCurve(poly, 0)
+                       ? gp->GetPoint(poly, 0) : (gp->GetPrevOnCurve(poly, 0)
+                               ? gp->GetPrevPoint(poly, 0) : gp->GetMidpointToPrev(poly, 0)));
+               path->moveTo(pt.x, pt.y);
+
+               for(int i=0; i<gp->GetNumPoints(poly); i++)
                {
-                       // Initial move...
-                       // If last point is on curve then move to it, otherwise move to first point...
-
-//NOTE: This is basically doing the below for i=-1.
-//      Find some way to integrate this crap.
-/*
-Could do in pairs: get i and i+1, connect them depending on whether the pair
-is a line or a curve.
-4 cases: on to on (line),
-         on to off (begin curve),
-         off to on (end curve),
-         off to off (begin curve)
-*/
-#if 1
-                       for(int i=0; i<gp->GetNumPoints(poly); i++)
-                       {
-                               if (i == 0)
-                               {
-                                       IPoint pt = (gp->GetOnCurve(poly, 0)
-                                               ? gp->GetPoint(poly, 0) : (gp->GetPrevOnCurve(poly, 0)
-                                                       ? gp->GetPrevPoint(poly, 0) : gp->GetMidpointToPrev(poly, 0)));
-                                       path->moveTo(pt.x, pt.y);
-                               }
-
-                               if (gp->GetOnCurve(poly, i) && gp->GetNextOnCurve(poly, i))
-                               {
-                                       // Handle lines...
-                                       path->lineTo(gp->GetNextX(poly, i), gp->GetNextY(poly, i));
-                               }
-                               else
-                               {
-                                       // Skip point if it's on curve (start of curve--it's already
-                                       // been plotted so we don't care about it...
-                                       if (gp->GetOnCurve(poly, i))
-                                               i++;
-
-                                       // We may have moved past the end; if not, handle curve
-                                       if (i < gp->GetNumPoints(poly))
-                                       {
-                                               // Handle curves...
-                                               IPoint pt = (gp->GetNextOnCurve(poly, i)
-                                                       ? gp->GetNextPoint(poly, i) : gp->GetMidpointToNext(poly, i));
-
-                                               path->quadTo(gp->GetX(poly, i), gp->GetY(poly, i), pt.x, pt.y);
-                                       }
-                               }
-                       }
-#else
-                       IPoint pt;
-
-                       if (gp->GetPrevOnCurve(poly, 0))
-                               pt = gp->GetPrevPoint(poly, 0);
+                       // If this point and then next are both on curve, we have a line...
+                       if (gp->GetOnCurve(poly, i) && gp->GetNextOnCurve(poly, i))
+                               path->lineTo(gp->GetNextX(poly, i), gp->GetNextY(poly, i));
                        else
-                               pt = (gp->GetOnCurve(poly, 0)
-                                       ? gp->GetPoint(poly, 0) : gp->GetMidpointToPrev(poly, 0));
-
-                       path->moveTo(pt.x, pt.y);
-
-                       for(int i=0; i<gp->GetNumPoints(poly); i++)
                        {
+                               // Skip point if it's on curve (start of curve--it's already
+                               // been plotted so we don't need to handle it...)
                                if (gp->GetOnCurve(poly, i))
-                                       path->lineTo(gp->GetX(poly, i), gp->GetY(poly, i));
-                               else
-                               {
-                                       pt = (gp->GetNextOnCurve(poly, i)
-                                               ? gp->GetNextPoint(poly, i) : gp->GetMidpointToNext(poly, i));
-
-                                       path->quadTo(gp->GetX(poly, i), gp->GetY(poly, i), pt.x, pt.y);
-
-                                       // If following point is on curve, move past it
-                                       if (gp->GetNextOnCurve(poly, i))
-                                               i++;
-                               }
-                       }
-#endif
+                                       continue;
+
+                               // We are now guaranteed that we are sitting on a curve control point
+                               // (off curve). Figure the extent of the curve: If the following is a
+                               // curve control point, then use the midpoint to it otherwise go to
+                               // the next point since it's on curve.
+                               IPoint pt = (gp->GetNextOnCurve(poly, i)
+                                       ? gp->GetNextPoint(poly, i) : gp->GetMidpointToNext(poly, i));
 
-                       path->closeSubpath();
+                               path->quadTo(gp->GetX(poly, i), gp->GetY(poly, i), pt.x, pt.y);
+                       }
                }
+
+               path->closeSubpath();
        }
 }
 
@@ -145,28 +101,18 @@ void CharWindow::paintEvent(QPaintEvent * /*event*/)
 
        QPainter p(this);
 
+//     p.setBrush(QColor(0, 163, 200));        // Nice, aqua color...
        p.setPen(QPen(Qt::black, 1.0, Qt::SolidLine));
-//     p.setBrush(QColor(122, 163, 39));
        p.setBrush(Qt::black);
 
-/*
-1.0 -> 3.0, height = 400
-r.h / ps.h = 2/400 <-- do it the other way!
-
-height works, width does not
-
-2-step process:
-compare aspect ratios
-
-ps.w - ((r.h / ps.h) * ps.w)
-
-0.5 -> where in the 400? -> 100
-0.5/r.h(2.0) = 0.25 * ps.h(400) = 100
-conv.fac. -> (ps.h / r.h)
-*/
        QRectF rect = path->boundingRect();
        QSize paintSize = size();
 
+       // For some reason, this code cuts off two pixels when rendering the path.
+       // Not sure why, but we compensate for that here.
+       paintSize.rwidth() -= 2;
+       paintSize.rheight() -= 2;
+
        p.translate(0, paintSize.height());
        float extraX = 0.0f, extraY = 0.0f;
        float xConvFac = (float)paintSize.width() / rect.width();
@@ -174,13 +120,13 @@ conv.fac. -> (ps.h / r.h)
 
        if (xConvFac > yConvFac)
        {
-               // height is limiting factor
+               // height is limiting factor (smaller than width)
                p.scale(yConvFac, -yConvFac);
                extraX = (((float)paintSize.width() / yConvFac) - rect.width()) / 2.0f;
        }
        else
        {
-               // width is limiting factor
+               // width is limiting factor (smaller than height)
                p.scale(xConvFac, -xConvFac);
 //extraY = (rect.width() / (float)paintSize.width()) * (float)paintSize.height();
 //extraY = (extraY - rect.height()) / 2.0f;
index 97546ef5c3a54ea151eed268410e6c4a2be940e2..f3cc70fdebc03d551e9186fc9efa898b92217202 100755 (executable)
@@ -106,8 +106,8 @@ TODO:
 void EditWindow::paintEvent(QPaintEvent * /*event*/)
 {
        QPainter p(this);
-//hm, causes lockup
-//     p.setRenderHint(QPainter::Antialiasing);
+//hm, causes lockup (or does it???)
+       p.setRenderHint(QPainter::Antialiasing);
 //Doesn't do crap!
 //dc.SetBackground(*wxWHITE_BRUSH);
 
@@ -491,8 +491,10 @@ void EditWindow::mouseMoveEvent(QMouseEvent * event)
 //ex ey 1
 //px py 1
 //
-//(???) By translating the start point to the origin, this can be rewritten as:
+//By translating the start point to the origin, this can be rewritten as:
 //By subtracting row 1 from all rows, you get the following:
+//[because sx = sy = 0. you could leave out the -sx/y terms below. because we subtracted
+// row 1 from all rows (including row 1) row 1 turns out to be zero. duh!]
 //
 //0         0         0
 //(ex - sx) (ey - sy) 0
index a657cad17a48bb10d259299b5ad786b1b68aadd3..62417b5fd010ff88c20f6bfed5a2e60ecdd33856 100755 (executable)
 // JLH  03/05/2009  Initial conversion from wxWidgets to Qt
 //
 
-// FIXED:
-//
-// - Fix problem with tool palette not getting focus 1st time it's called up [DONE]
-// - Split out windows/classes defined here into their own files [DONE]
-//
-// STILL TO BE DONE:
-//
-// - Fix bug in Glyphpoints when dragging on an empty canvas or loading a font
-// - Fix scrolling, zooming, settings (ini)
-// - Finish conversion to wxWidgets for cross-platform portability
-// - Fix problem with owned window causing main window refresh problems
-//   (ironically enough, it doesn't seem to be a problem anymore...)
-//
-
-// Uncomment this for debugging...
-//#define DEBUG
-//#define DEBUGFOO                     // Various tool debugging...
-//#define DEBUGTP                              // Toolpalette debugging...
-
 #include "ttedit.h"
 #include <QApplication>
 #include "ttemainwindow.h"
-//#include "charwindow.h"
 
 // Main app constructor--we stick globally accessible stuff here...
 
-TTEdit::TTEdit(int argc, char * argv[]): QApplication(argc, argv), charWnd(NULL)
+TTEdit::TTEdit(int argc, char * argv[]): QApplication(argc, argv), charWnd(NULL)
 {
        mainWindow = new TTEMainWindow;
 //printf("mainWindow.show();\n");
@@ -63,4 +43,3 @@ int main(int argc, char * argv[])
 //printf("return app.exec();\n");
        return app.exec();
 }
-
index 1aa2b0e20dbb904d9e221c9af32aac4bd1c21e30..9bc6b598ab813b0be990c89c404bc43cefeb61ad 100755 (executable)
@@ -18,7 +18,7 @@ class TTEMainWindow;
 class TTEdit: public QApplication
 {
        public:
-               TTEdit(int argc, char * argv[]);
+               TTEdit(int argc, char * argv[]);
 
        public:
                CharWindow * charWnd;
index 2b2b6a1be539a4c5757e5159c0ae05af57912913..2e155d385fd5aa0f522273a49d3b66770e51e1b2 100644 (file)
@@ -25,9 +25,8 @@
 //
 // - Fix bug in Glyphpoints when dragging on an empty canvas or loading a font
 // - Fix scrolling, zooming, settings (ini)
-// - Finish conversion to wxWidgets for cross-platform portability
-// - Fix problem with owned window causing main window refresh problems
-//   (ironically enough, it doesn't seem to be a problem anymore...)
+// - Fix problem with character window disappearing when bringing up the tool
+//   palette
 //
 
 // Uncomment this for debugging...
index 1e7c4433bfd33b9e56b8422f4c86125fbaa64611..dd20f26e529da47b6f203d982c5aaacff83fc2cf 100644 (file)
@@ -1,7 +1,7 @@
 # Use 'qmake -o Makefile ttedit.pro'
 
 CONFIG += qt
-#debug doesn't do shit
+#debug doesn't do shit (Actually, it does seem to do *something*)
 #CONFIG += qt debug
 
 HEADERS += src/ttedit.h