@-~ Installation ~-@
-Architektonas is built on the Qt 4 framework; it requires version 4.7.4 or
+Architektonas is built on the Qt 5 framework; it requires version 5.3.2 or
later. We build it using gcc v4.4.6; we can't guarantee that it will compile on
lesser versions but you never know. Building Architektonas should be as easy as
typing:
CONFIG += qt warn_on release
RESOURCES += res/architektonas.qrc
#LIBS += -Ldxflib/lib -ldxf
+QT += widgets
# We stuff all the intermediate crap into obj/ so it won't confuse us mere mortals ;-)
OBJECTS_DIR = obj
# (C) 2012 Underground Software
#
TARGET=architektonas
-echo "Cross compiling ${TARGET} for Win32..."
+#echo "Cross compiling ${TARGET} for Win32..."
+echo "Cross compiling ${TARGET} for Win64..."
export PATH=/opt/mxe/usr/bin:$PATH
rm Makefile
-/opt/mxe/usr/i686-pc-mingw32/qt/bin/qmake
-make
+#/opt/mxe/usr/i686-pc-mingw32/qt/bin/qmake
+/opt/mxe/usr/bin/x86_64-w64-mingw32.static-qmake-qt4
+make clean && make
#make CROSS=i686-pc-mingw32-
#rel=`svn info | grep Revision | cut -f 2 -d ' '`
rel=`git log -1 --pretty=format:%ci | cut -d ' ' -f 1 | tr -d -`
#echo ${TARGET}.exe
cd release && upx -9v ${TARGET}.exe && zip -9v ${TARGET}-${rel}.zip ${TARGET}.exe
+
#ifndef __ABOUT_H__
#define __ABOUT_H__
-#include <QtGui>
+#include <QtWidgets>
class AboutWindow: public QWidget
{
#ifndef __ACTION_H__
#define __ACTION_H__
-#include <QtGui>
+#include <QtWidgets>
#include "vector.h"
class Object;
if (filename.isEmpty())
return;
- FILE * file = fopen(filename.toAscii().data(), "r");
+ FILE * file = fopen(filename.toUtf8().data(), "r");
if (file == 0)
{
documentName = QFileDialog::getSaveFileName(this, tr("Save Drawing"),
"", tr("Architektonas drawings (*.drawing)"));
- FILE * file = fopen(documentName.toAscii().data(), "w");
+ FILE * file = fopen(documentName.toUtf8().data(), "w");
if (file == 0)
{
msg.setIcon(QMessageBox::Critical);
msg.exec();
// In this case, we should unlink the created file, since it's not right...
-// unlink(documentName.toAscii().data());
+// unlink(documentName.toUtf8().data());
QFile::remove(documentName);
return;
}
#ifndef __APPLICATIONWINDOW_H__
#define __APPLICATIONWINDOW_H__
-#include <QtGui>
+#include <QtWidgets>
// Forward declarations
#ifndef __BASEUNITTAB_H__
#define __BASEUNITTAB_H__
-#include <QtGui>
+#include <QtWidgets>
class BaseUnitTab: public QWidget
{
#ifndef __BLOCKITEMWIDGET_H__
#define __BLOCKITEMWIDGET_H__
-#include <QtGui>
+#include <QtWidgets>
class BlockItemWidget: public QWidget
{
#ifndef __BLOCKWIDGET_H__
#define __BLOCKWIDGET_H__
-#include <QtGui>
+#include <QtWidgets>
class BlockWidget: public QWidget
{
return false;
}
+/*
+Note that we can separate this out in the TLC, and it would probably make more sense
+to do it there as then we can be assured that all hit testing is done before we do
+any snapping. !!! FIX !!!
+*/
// Hit test tells us what we hit (if anything) through boolean variables. It
// also tells us whether or not the state changed.
SaveHitState();
double length = Vector::Magnitude(position, point);
//printf("Circle::length = %lf, radius = %lf\n", length, radius);
//How to translate this into pixels from Document space???
-//Maybe we need to pass a scaling factor in here from the caller? That would make sense, as
-//the caller knows about the zoom factor and all that good kinda crap
+//Maybe we need to pass a scaling factor in here from the caller? That would make
+//sense, as the caller knows about the zoom factor and all that good kinda crap
/*
Document passes in the correct Cartesian coordinates being pointed to by the mouse.
So all we have to be concerned with is properly scaling our hot zones/handle sizes,
if ((length * Painter::zoom) < 8.0)
{
hitCenter = true;
- snapPoint = position;
- snapPointIsValid = true;
+
+ // Make sure we don't try to snap to ourselves...!
+ if (!draggingCenter)
+ {
+ snapPoint = position;
+ snapPointIsValid = true;
+ }
}
//wrong: else if ((length < (radius + 2.0)) && (length > (radius - 2.0)))
/*NB: The following should be identical to what we have down below, but it doesn't work out that way... :-P */
// This returns true if we've moved over an object...
if (document.PointerMoved(point))
{
+/*
+Now objects handle mouse move snapping as well. The code below mainly works only
+for tools; we need to fix it so that objects work as well...
+
+There's a problem with the object point snapping in that it's dependent on the
+order of the objects in the document. Most likely this is because it counts the
+selected object last and thus fucks up the algorithm. Need to fix this...
+
+
+*/
// Do object snapping here. Grid snapping on mouse down is done in the
// objects themselves, only because we have to hit test the raw point,
// not the snapped point. There has to be a better way...!
#ifndef __DRAWINGVIEW_H__
#define __DRAWINGVIEW_H__
-#include <QtGui>
+#include <QtWidgets>
#include <stdint.h>
#include "action.h"
#include "container.h"
#ifndef __GENERALTAB_H__
#define __GENERALTAB_H__
-#include <QtGui>
+#include <QtWidgets>
class GeneralTab: public QWidget
{
#ifndef __LAYERITEMWIDGET_H__
#define __LAYERITEMWIDGET_H__
-#include <QtGui>
+#include <QtWidgets>
class LayerItemWidget: public QWidget
{
#ifndef __LAYERWIDGET_H__
#define __LAYERWIDGET_H__
-#include <QtGui>
+#include <QtWidgets>
class LayerWidget: public QWidget
{
#ifndef __MAIN_H__
#define __MAIN_H__
-#include <QtGui>
+#include <QtWidgets>
// Forward declarations
//class CharWindow;
#ifndef __PAINTER_H__
#define __PAINTER_H__
-#include <QtGui>
+#include <QtWidgets>
#include "vector.h"
//#define SCREEN_ZOOM (1.0 / 4.0)
#ifndef __SETTINGSDIALOG_H__
#define __SETTINGSDIALOG_H__
-#include <QtGui>
+#include <QtWidgets>
class GeneralTab;
class BaseUnitTab;
#define __TEXT_H__
#include "object.h"
-#include <QtGui>
+#include <QtWidgets>
class Text: public Object
{
// Class methods
-double Vector::Dot(Vector v1, Vector v2)
+/*static*/ double Vector::Dot(Vector v1, Vector v2)
{
return (v1.x * v2.x) + (v1.y * v2.y) + (v1.z * v2.z);
}
-double Vector::Magnitude(Vector v1, Vector v2)
+/*static*/ double Vector::Magnitude(Vector v1, Vector v2)
{
double xx = v1.x - v2.x;
double yy = v1.y - v2.y;
// Returns the parameter of a point in space to this vector. If the parameter
// is between 0 and 1, the normal of the vector to the point is on the vector.
// Note: v1 is the tail, v2 is the head of the line (vector).
-double Vector::Parameter(Vector tail, Vector head, Vector p)
+/*static*/ double Vector::Parameter(Vector tail, Vector head, Vector p)
{
// Geometric interpretation:
// The parameterized point on the vector lineSegment is where the normal of
}
-// Return the normal to the linesegment formed by the passed in points.
-// (Not sure which is head or tail, or which hand the normal lies)
-// [v1 should be the tail, v2 should be the head, in which case the normal should
-// rotate anti-clockwise.]
+// Return the 2D normal to the linesegment formed by the passed in points.
+// The normal thus calculated should rotate anti-clockwise.
/*static*/ Vector Vector::Normal(Vector tail, Vector head)
{
Vector v = (head - tail).Unit();
return Vector(-v.y, v.x);
}
+
+/*static*/ double Vector::AngleBetween(Vector a, Vector b)
+{
+ // This is done using the following formula:
+ // (a . b) = ||a|| ||b|| cos(theta)
+ // However, have to check for two degenerate cases, where a = cb:
+ // 1, if c > 0, theta = 0; 2, if c < 0, theta = 180°.
+ // Also, the vectors a & b have to be non-zero.
+ // Also, have to check using an epsilon because acos will not return an
+ // exact value if the vectors are orthogonal
+ if (a.isZero() || b.isZero())
+ return 0;
+
+ return acos(a.Dot(b) / (a.Magnitude() * b.Magnitude()));
+}
+
static double Magnitude(Vector v1, Vector v2);
static double Parameter(Vector v1, Vector v2, Vector p);
static Vector Normal(Vector v1, Vector v2);
+ static double AngleBetween(Vector a, Vector b);
public:
double x, y, z;