[fondue-commits] [SCM] Fondue Font Editor branch, master, updated. 205db8b90d51df350ea98143e2b53dcb5e901eef

Eugeniy Meshcheryakov eugen at debian.org
Fri Jan 4 20:55:43 UTC 2008


The branch, master has been updated
       via  205db8b90d51df350ea98143e2b53dcb5e901eef (commit)
       via  66bbbef4ab3bb49f0bd59d5786a2345815f274de (commit)
       via  7027a483a5fbd0bde4818e78b26ddc50ef9dec70 (commit)
       via  1a9fda8ccb6004cf4ea58861bf9ee0cc6ce30a71 (commit)
       via  9c9773d64cc253d364eef02a9dc8823e44537b16 (commit)
      from  215f1949ba6c3b57dc8e9b43325fb312846b55dc (commit)


- Shortlog ------------------------------------------------------------
205db8b forward change signals from glyphs to GlyphsModel via FontDocument
66bbbef do not build 'script' binary
7027a48 integrates script console into main window
1a9fda8 add 'document' property for MainWindow class
9c9773d move ControlPoint:s in contructor

Summary of changes:
 .gitignore                |    1 -
 gui/controlpoint.cxx      |    7 +++
 gui/glyphgraphics.cxx     |    4 --
 gui/glyphsmodel.cxx       |   95 +++++++++++++++++++-------------------------
 gui/glyphsmodel.h         |    7 +++-
 gui/gui.rules             |    2 +-
 gui/mainwindow.cxx        |   31 ++++++++++++++-
 gui/mainwindow.h          |    8 ++++
 nongui/fontdocument.cxx   |   60 +++++++++++++++++++++++-----
 nongui/fontdocument.h     |   12 +++++-
 qscript/scriptconsole.cxx |   23 ++++++++++-
 src/script.cxx            |   33 ---------------
 src/src.rules             |   10 +----
 13 files changed, 176 insertions(+), 117 deletions(-)
-----------------------------------------------------------------------
Details of changes:

commit 205db8b90d51df350ea98143e2b53dcb5e901eef
Author: Eugeniy Meshcheryakov <eugen at debian.org>
Date:   Fri Jan 4 21:55:29 2008 +0100

    forward change signals from glyphs to GlyphsModel via FontDocument

diff --git a/gui/glyphsmodel.cxx b/gui/glyphsmodel.cxx
index b78b9d5..d52e039 100644
--- a/gui/glyphsmodel.cxx
+++ b/gui/glyphsmodel.cxx
@@ -89,33 +89,6 @@ QVariant GlyphsModel::data(const QModelIndex &index, int role) const
 	return QVariant();
 }
 
-// TODO this really belongs to FontDocument or Glyph
-bool GlyphsModel::setColor(Glyph *glyph, const QModelIndex &index, QVariant value)
-{
-	QColor color = value.value<QColor>();
-	QString oldstring = glyph->colorString();
-	QString newstring = color.name();
-
-	qDebug() << color << oldstring << newstring;
-	qDebug() << color.isValid() << oldstring.isEmpty();
-
-	if (color.isValid()) {
-		if (oldstring != newstring) {
-			glyph->setColorString(newstring);
-			doc->setChanged();
-			emit dataChanged(index, index);
-		}
-	}
-	else {
-		if (!oldstring.isEmpty()) {
-			glyph->setColorString(QString());
-			doc->setChanged();
-			emit dataChanged(index, index);
-		}
-	}
-	return true;
-}
-
 bool GlyphsModel::setData(const QModelIndex &index, const QVariant &value, int role)
 {
 	bool ret = false;
@@ -133,40 +106,18 @@ bool GlyphsModel::setData(const QModelIndex &index, const QVariant &value, int r
 		switch (index.column()) {
 		case NameColumn:
 			ret = glyph->setGlyphName(value.toString());
-			if (ret)
-				emitChangeSignals(index);
 			break;
 		case ColorColumn:
-			ret = setColor(glyph, index, value);
-			if (ret)
-				emitChangeSignals(index);
+			glyph->setColorString(value.toString());
 			break;
 		case UnicodeColumn:
-			qDebug() << value;
 			ret = glyph->setUnicode(value.toInt());
-			qDebug() << ret;
-			if (ret)
-				emitChangeSignals(index);
 			break;
-		case CommentColumn: {
-				QString newComment = value.toString();
-				if (newComment.isEmpty())
-					newComment = QString(); //make it null
-				if (glyph->comment().isEmpty() && newComment.isEmpty())
-					return false;
-				if (glyph->comment() != newComment) {
-					qDebug() << glyph->comment() << newComment;
-					glyph->setComment(newComment);
-					doc->setChanged();
-					emit dataChanged(index, index);
-					// FIXME no need to change column 0
-				}
-			}
-			ret = true;
+		case CommentColumn:
+			glyph->setComment(value.toString());
 			break;
 		case InstructionsColumn:
 			glyph->setInstructions(value.toString());
-			emit dataChanged(index, index);
 			break;
 		default:
 			break;
@@ -206,7 +157,13 @@ void GlyphsModel::setDocument(FontDocument *d)
 	beginInsertRows(QModelIndex(), 0, doc->glyphs().size() + 1);
 	endInsertRows();
 
-	connect(doc, SIGNAL(glyphChanged(int)), this, SLOT(glyphChanged(int)));
+	connect(doc, SIGNAL(glyphOutlineChanged(int)), this, SLOT(glyphOutlineChanged(int)));
+	connect(doc, SIGNAL(glyphInstructionsChanged(int)), this, SLOT(glyphInstructionsChanged(int)));
+	connect(doc, SIGNAL(glyphColorStringChanged(int)), this, SLOT(glyphColorStringChanged(int)));
+	connect(doc, SIGNAL(glyphCommentChanged(int)), this, SLOT(glyphCommentChanged(int)));
+	connect(doc, SIGNAL(glyphNameChanged(int)), this, SLOT(glyphNameChanged(int)));
+	connect(doc, SIGNAL(glyphUnicodeChanged(int)), this, SLOT(glyphUnicodeChanged(int)));
+
 	connect(doc, SIGNAL(glyphsAboutToBeRemoved(int, int)), this, SLOT(glyphsAboutToBeRemoved(int, int)));
 	connect(doc, SIGNAL(glyphsRemoved(int, int)), this, SLOT(glyphsRemoved(int, int)));
 	connect(doc, SIGNAL(glyphsAboutToBeAdded(int, int)), this, SLOT(glyphsAboutToBeAdded(int, int)));
@@ -283,7 +240,7 @@ bool GlyphsModel::removeRows(int row, int count, const QModelIndex &index)
 	return doc->removeGlyphs(row, count);
 }
 
-void GlyphsModel::glyphChanged(int glyphNo)
+void GlyphsModel::glyphOutlineChanged(int glyphNo)
 {
 	QModelIndex idx = createIndex(glyphNo, GlyphColumn);
 	emit dataChanged(idx, idx);
@@ -314,3 +271,33 @@ void GlyphsModel::glyphsAdded(int start, int end)
 
 	endInsertRows();
 }
+
+void GlyphsModel::glyphInstructionsChanged(int index)
+{
+	QModelIndex idx = createIndex(index, InstructionsColumn);
+	emit dataChanged(idx, idx);
+}
+
+void GlyphsModel::glyphColorStringChanged(int index)
+{
+	QModelIndex idx = createIndex(index, ColorColumn);
+	emitChangeSignals(idx);
+}
+
+void GlyphsModel::glyphCommentChanged(int index)
+{
+	QModelIndex idx = createIndex(index, CommentColumn);
+	emit dataChanged(idx, idx);
+}
+
+void GlyphsModel::glyphNameChanged(int index)
+{
+	QModelIndex idx = createIndex(index, NameColumn);
+	emitChangeSignals(idx);
+}
+
+void GlyphsModel::glyphUnicodeChanged(int index)
+{
+	QModelIndex idx = createIndex(index, UnicodeColumn);
+	emitChangeSignals(idx);
+}
diff --git a/gui/glyphsmodel.h b/gui/glyphsmodel.h
index 1109540..be361e1 100644
--- a/gui/glyphsmodel.h
+++ b/gui/glyphsmodel.h
@@ -48,7 +48,12 @@ public:
 	void setDocument(FontDocument *d);
 	bool removeRows(int row, int count, const QModelIndex &index);
 private slots:
-	void glyphChanged(int glyphNo);
+	void glyphOutlineChanged(int glyphNo);
+	void glyphInstructionsChanged(int index);
+	void glyphColorStringChanged(int index);
+	void glyphCommentChanged(int index);
+	void glyphNameChanged(int index);
+	void glyphUnicodeChanged(int index);
 
 	void glyphsAboutToBeRemoved(int start, int end);
 	void glyphsRemoved(int start, int end);
diff --git a/nongui/fontdocument.cxx b/nongui/fontdocument.cxx
index 93f5e34..44af6de 100644
--- a/nongui/fontdocument.cxx
+++ b/nongui/fontdocument.cxx
@@ -170,7 +170,10 @@ bool FontDocument::addGlyph(Glyph *glyph)
 		unicodeHash[unicode] = glyph;
 	glyph->setParent(this);
 
-	connect(glyph, SIGNAL(outlineChanged()), this, SLOT(glyphOutlineChanged()));
+	connect(glyph, SIGNAL(outlineChanged()), this, SLOT(_glyphOutlineChanged()));
+	connect(glyph, SIGNAL(instructionsChanged()), this, SLOT(_glyphInstructionsChanged()));
+	connect(glyph, SIGNAL(colorStringChanged()), this, SLOT(_glyphColorStringChanged()));
+	connect(glyph, SIGNAL(commentChanged()), this, SLOT(_glyphCommentChanged()));
 	connect(glyph, SIGNAL(glyphNameChanged(const QString&, const QString&)),
 			this, SLOT(glyphRenamed(const QString&, const QString&)));
 	connect(glyph, SIGNAL(unicodeChanged(int, int)),
@@ -323,8 +326,12 @@ void FontDocument::glyphRenamed(const QString &oldName, const QString &newName)
 	Q_ASSERT(!hasGlyph(newName));
 
 	Glyph *glyph = getGlyph(oldName);
+	Q_ASSERT(glyph);
 	nameHash.remove(oldName);
 	nameHash[newName] = glyph;
+	int idx = glyphIndex(glyph);
+	Q_ASSERT(idx != -1);
+	emit glyphNameChanged(idx);
 	setChanged();
 }
 
@@ -337,7 +344,8 @@ void FontDocument::unicodeValueChanged(int oldUnicode, int newUnicode)
 {
 	Q_ASSERT(hasUnicodeGlyph(oldUnicode));
 	Q_ASSERT(!hasUnicodeGlyph(newUnicode));
-	Q_ASSERT(qobject_cast<Glyph *>(sender()));
+	Glyph *g = qobject_cast<Glyph *>(sender());
+	Q_ASSERT(g);
 
 	newUnicode = (newUnicode < 0) ? -1 : newUnicode;
 
@@ -346,7 +354,10 @@ void FontDocument::unicodeValueChanged(int oldUnicode, int newUnicode)
 	if (oldUnicode != -1)
 		unicodeHash.remove(oldUnicode);
 	if (newUnicode != -1)
-		unicodeHash[newUnicode] = qobject_cast<Glyph *>(sender());
+		unicodeHash[newUnicode] = g;
+	int idx = glyphIndex(g);
+	Q_ASSERT(idx != 0);
+	emit glyphUnicodeChanged(idx);
 	setChanged();
 }
 
@@ -501,17 +512,14 @@ bool FontDocument::setMaxStackDepth(unsigned depth)
 	return true;
 }
 
-void FontDocument::glyphOutlineChanged()
+void FontDocument::_glyphOutlineChanged()
 {
-	Glyph *g = qobject_cast<Glyph *>(sender());
-
-	if (!g)
-		return;
-
-	int idx = m_glyphs.indexOf(g);
+	const Glyph *g = qobject_cast<const Glyph *>(sender());
+	Q_ASSERT(g);
+	int idx = glyphIndex(g);
 	Q_ASSERT(idx != -1);
 
-	emit glyphChanged(idx);
+	emit glyphOutlineChanged(idx);
 	setChanged();
 }
 
@@ -519,3 +527,33 @@ int FontDocument::glyphIndex(const Glyph *glyph) const
 {
 	return m_glyphs.indexOf(const_cast<Glyph *>(glyph)); // FIXME bug?
 }
+
+void FontDocument::_glyphInstructionsChanged()
+{
+	const Glyph *g = qobject_cast<const Glyph *>(sender());
+	Q_ASSERT(g);
+	int idx = glyphIndex(g);
+	Q_ASSERT(idx != -1);
+	emit glyphInstructionsChanged(idx);
+	setChanged();
+}
+
+void FontDocument::_glyphColorStringChanged()
+{
+	const Glyph *g = qobject_cast<const Glyph *>(sender());
+	Q_ASSERT(g);
+	int idx = glyphIndex(g);
+	Q_ASSERT(idx != -1);
+	emit glyphColorStringChanged(idx);
+	setChanged();
+}
+
+void FontDocument::_glyphCommentChanged()
+{
+	const Glyph *g = qobject_cast<const Glyph *>(sender());
+	Q_ASSERT(g);
+	int idx = glyphIndex(g);
+	Q_ASSERT(idx != -1);
+	emit glyphCommentChanged(idx);
+	setChanged();
+}
diff --git a/nongui/fontdocument.h b/nongui/fontdocument.h
index affb079..122d9aa 100644
--- a/nongui/fontdocument.h
+++ b/nongui/fontdocument.h
@@ -128,9 +128,12 @@ public slots:
 
 	bool hasUnicodeGlyph(int unicode) const;
 protected slots:
-	void glyphOutlineChanged();
+	void _glyphOutlineChanged();
 	void glyphRenamed(const QString &oldName, const QString &newName);
 	void unicodeValueChanged(int oldUnicode, int newUnicode);
+	void _glyphInstructionsChanged();
+	void _glyphColorStringChanged();
+	void _glyphCommentChanged();
 signals:
 	void copyrightChanged();
 	void prepChanged();
@@ -151,7 +154,12 @@ signals:
 	void maxIDEFsChanged();
 	void maxStackDepthChanged();
 
-	void glyphChanged(int index);
+	void glyphOutlineChanged(int index);
+	void glyphInstructionsChanged(int index);
+	void glyphColorStringChanged(int index);
+	void glyphCommentChanged(int index);
+	void glyphNameChanged(int index);
+	void glyphUnicodeChanged(int index);
 
 	void glyphsAboutToBeRemoved(int start, int end);
 	void glyphsRemoved(int start, int end);

commit 66bbbef4ab3bb49f0bd59d5786a2345815f274de
Author: Eugeniy Meshcheryakov <eugen at debian.org>
Date:   Fri Jan 4 16:23:34 2008 +0100

    do not build 'script' binary

diff --git a/.gitignore b/.gitignore
index 3c4587a..4b126f4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,7 +1,6 @@
 # programs
 src/fondue
 src/ufondue
-src/script
 
 # objects and libraries
 *.[oa]
diff --git a/src/script.cxx b/src/script.cxx
deleted file mode 100644
index 2ca51f0..0000000
--- a/src/script.cxx
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Copyright (C) 2007 Євгеній Мещеряков <eugen at debian.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
- */
-#include <QApplication>
-#include <QtScript>
-#include <QString>
-#include "scriptconsole.h"
-
-int main(int  argc, char **argv)
-{
-	QApplication app(argc, argv);
-
-	ScriptConsole *con = new ScriptConsole;
-
-	con->setWindowTitle("Script Console");
-	con->resize(640, 480);
-	con->show();
-
-	return app.exec();
-}
diff --git a/src/src.rules b/src/src.rules
index 75a43fa..4c0e238 100644
--- a/src/src.rules
+++ b/src/src.rules
@@ -12,10 +12,4 @@ src_fondue_SOURCES = src/main.cxx
 src_fondue_CPPFLAGS = $(QtCore_CFLAGS) $(QtGui_CFLAGS) $(QtXml_CFLAGS) $(QtScript_CFLAGS)
 src_fondue_LDADD = libfonduegui.a libfonduenongui.a libfondueqscript.a $(QtCore_LIBS) $(QtGui_LIBS) $(QtXml_LIBS) $(QtScript_LIBS)
 
-bin_PROGRAMS += src/script
-
-src_script_SOURCES = src/script.cxx
-src_script_CPPFLAGS = $(QtCore_CFLAGS) $(QtXml_CFLAGS) $(QtGui_CFLAGS) $(QtScript_CFLAGS)
-src_script_LDADD = libfondueqscript.a libfonduenongui.a $(QtCore_LIBS) $(QtGui_LIBS) $(QtXml_LIBS) $(QtScript_LIBS)
-
 ## vim:ft=automake

commit 7027a483a5fbd0bde4818e78b26ddc50ef9dec70
Author: Eugeniy Meshcheryakov <eugen at debian.org>
Date:   Fri Jan 4 16:22:26 2008 +0100

    integrates script console into main window

diff --git a/gui/gui.rules b/gui/gui.rules
index b57b6c7..f0b54f2 100644
--- a/gui/gui.rules
+++ b/gui/gui.rules
@@ -44,7 +44,7 @@ nodist_libfonduegui_a_SOURCES =			\
 gui/instnames.tbl.cxx: data/instructions.xml
 gui/instnames.tbl.cxx: DATAFILE=$(srcdir)/data/instructions.xml
 
-libfonduegui_a_CPPFLAGS = $(QtCore_CFLAGS) $(QtGui_CFLAGS) $(QtXml_CFLAGS)
+libfonduegui_a_CPPFLAGS = $(QtCore_CFLAGS) $(QtGui_CFLAGS) $(QtXml_CFLAGS) $(QtScript_CFLAGS)
 
 noinst_HEADERS += 			\
 	gui/controlpoint.h		\
diff --git a/gui/mainwindow.cxx b/gui/mainwindow.cxx
index 6d31311..ac09c14 100644
--- a/gui/mainwindow.cxx
+++ b/gui/mainwindow.cxx
@@ -38,11 +38,12 @@
 #include "maxpeditor.h"
 #include "documentinfomodel.h"
 #include "documentinfoeditor.h"
+#include "scriptconsole.h"
 
 #include "config.h"
 
 MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent),
-	model(0), unicodeProxy(0)
+	model(0), unicodeProxy(0), m_scriptConsole(0)
 {
 	setAttribute(Qt::WA_DeleteOnClose);
 
@@ -98,6 +99,11 @@ void MainWindow::createActions()
 	}
 	connect(cellSizeGroup, SIGNAL(triggered(QAction *)), this, SLOT(changeCellSize(QAction *)));
 
+	scriptConsoleAction = new QAction("&Script Console", this);
+	scriptConsoleAction->setCheckable(true);
+	scriptConsoleAction->setChecked(false);
+	connect(scriptConsoleAction, SIGNAL(toggled(bool)), this, SLOT(showScriptConsole(bool)));
+
 	editPrepAction = new QAction("Edit prep Table...", this);
 	connect(editPrepAction, SIGNAL(triggered()), this, SLOT(editPrep()));
 
@@ -148,6 +154,8 @@ void MainWindow::createMenus()
 	viewMenu = menuBar()->addMenu("&View");
 	for (int i = 0; i < 5; i++)
 		viewMenu->addAction(cellSizeActions[i]);
+	viewMenu->addSeparator();
+	viewMenu->addAction(scriptConsoleAction);
 
 	instructionsMenu = menuBar()->addMenu("&Instructions");
 	instructionsMenu->addAction(editPrepAction);
@@ -478,3 +486,19 @@ FontDocument *MainWindow::document() const
 {
 	return m_doc;
 }
+
+void MainWindow::showScriptConsole(bool v)
+{
+	// XXX FIXME menu entry is not updated when window is closed
+
+	if (v) {
+		if (!m_scriptConsole) {
+			m_scriptConsole = new ScriptConsole(this);
+		}
+		m_scriptConsole->show();
+	}
+	else {
+		Q_ASSERT(m_scriptConsole);
+		m_scriptConsole->hide();
+	}
+}
diff --git a/gui/mainwindow.h b/gui/mainwindow.h
index 0f48171..0e1c514 100644
--- a/gui/mainwindow.h
+++ b/gui/mainwindow.h
@@ -29,6 +29,7 @@ class QActionGroup;
 class UnicodeProxyModel;
 class DocumentInfoModel;
 class CVTModel;
+class ScriptConsole;
 
 class MainWindow: public QMainWindow {
 	Q_OBJECT
@@ -59,6 +60,8 @@ public slots:
 	void editGlyph(const QModelIndex &index);
 	void changeCellSize(QAction *action);
 
+	void showScriptConsole(bool v);
+
 	void documentChanged();
 signals:
 	void documentAvailable(bool available);
@@ -99,6 +102,7 @@ private:
 
 	QActionGroup *cellSizeGroup;
 	QAction *cellSizeActions[5];
+	QAction *scriptConsoleAction;
 
 	QAction *editPrepAction;
 	QAction *editFpgmAction;
@@ -112,6 +116,8 @@ private:
 	UnicodeProxyModel *unicodeProxy;
 	DocumentInfoModel *documentInfoModel;
 	CVTModel *cvtModel;
+
+	ScriptConsole *m_scriptConsole;
 };
 
 #endif
diff --git a/qscript/scriptconsole.cxx b/qscript/scriptconsole.cxx
index b712cfb..ecffd07 100644
--- a/qscript/scriptconsole.cxx
+++ b/qscript/scriptconsole.cxx
@@ -26,9 +26,10 @@
 #include "fontdocument.h"
 
 static QScriptValue printFunction(QScriptContext *context, QScriptEngine *engine);
+static QScriptValue documentPropertyGetter(QScriptContext *context, QScriptEngine *engine);
 
 ScriptConsole::ScriptConsole(QWidget *parent) :
-	QWidget(parent)
+	QWidget(parent, Qt::Window)
 {
 	QVBoxLayout *vbox = new QVBoxLayout;
 
@@ -55,6 +56,9 @@ ScriptConsole::ScriptConsole(QWidget *parent) :
 	m_scriptEngine = new QScriptEngine(this);
 	m_scriptEngine->globalObject().setProperty("print",
 			m_scriptEngine->newFunction(printFunction));
+	m_scriptEngine->globalObject().setProperty("document",
+			m_scriptEngine->newFunction(documentPropertyGetter),
+			QScriptValue::PropertyGetter);
 	initScripting(m_scriptEngine);
 
 	userTextFormat.setFontWeight(QFont::DemiBold);
@@ -107,3 +111,20 @@ static QScriptValue printFunction(QScriptContext *context, QScriptEngine *engine
 
 	return engine->undefinedValue();
 }
+
+static QScriptValue documentPropertyGetter(QScriptContext *context, QScriptEngine *engine)
+{
+	Q_UNUSED(context);
+
+	ScriptConsole *console = qobject_cast<ScriptConsole *>(engine->parent());
+	if (!console)
+		return engine->undefinedValue();
+
+	if (console->parent()) {
+		FontDocument *doc = qvariant_cast<FontDocument *>(console->parent()->property("document"));
+		if (doc)
+			return engine->newQObject(doc, QScriptEngine::AutoOwnership);
+	}
+
+	return engine->undefinedValue();
+}
diff --git a/src/src.rules b/src/src.rules
index 15d6564..75a43fa 100644
--- a/src/src.rules
+++ b/src/src.rules
@@ -9,8 +9,8 @@ endif
 bin_PROGRAMS += src/fondue
 
 src_fondue_SOURCES = src/main.cxx
-src_fondue_CPPFLAGS = $(QtCore_CFLAGS) $(QtGui_CFLAGS) $(QtXml_CFLAGS)
-src_fondue_LDADD = libfonduegui.a libfonduenongui.a $(QtCore_LIBS) $(QtGui_LIBS) $(QtXml_LIBS)
+src_fondue_CPPFLAGS = $(QtCore_CFLAGS) $(QtGui_CFLAGS) $(QtXml_CFLAGS) $(QtScript_CFLAGS)
+src_fondue_LDADD = libfonduegui.a libfonduenongui.a libfondueqscript.a $(QtCore_LIBS) $(QtGui_LIBS) $(QtXml_LIBS) $(QtScript_LIBS)
 
 bin_PROGRAMS += src/script
 

commit 1a9fda8ccb6004cf4ea58861bf9ee0cc6ce30a71
Author: Eugeniy Meshcheryakov <eugen at debian.org>
Date:   Fri Jan 4 15:32:45 2008 +0100

    add 'document' property for MainWindow class

diff --git a/gui/mainwindow.cxx b/gui/mainwindow.cxx
index 661ee72..6d31311 100644
--- a/gui/mainwindow.cxx
+++ b/gui/mainwindow.cxx
@@ -473,3 +473,8 @@ void MainWindow::writeSettings()
 	settings.setValue("outlineSize", cellSizeGroup->checkedAction()->data());
 	settings.endGroup();
 }
+
+FontDocument *MainWindow::document() const
+{
+	return m_doc;
+}
diff --git a/gui/mainwindow.h b/gui/mainwindow.h
index 6f7bf45..0f48171 100644
--- a/gui/mainwindow.h
+++ b/gui/mainwindow.h
@@ -32,6 +32,7 @@ class CVTModel;
 
 class MainWindow: public QMainWindow {
 	Q_OBJECT
+	Q_PROPERTY(FontDocument *document READ document)
 public:
 	MainWindow(QWidget *parent = 0);
 
@@ -39,6 +40,7 @@ public:
 	QString currentFile() const {return m_currentFile;}
 	bool documentLoaded() const {return m_doc;}
 	void loadFile(const QString &fileName);
+	FontDocument *document() const;
 public slots:
 	void open();
 	bool save();

commit 9c9773d64cc253d364eef02a9dc8823e44537b16
Author: Eugeniy Meshcheryakov <eugen at debian.org>
Date:   Fri Jan 4 15:28:59 2008 +0100

    move ControlPoint:s in contructor
    set flag ItemClipsToShape on ControlPoint:s

diff --git a/gui/controlpoint.cxx b/gui/controlpoint.cxx
index 3316df2..8723f91 100644
--- a/gui/controlpoint.cxx
+++ b/gui/controlpoint.cxx
@@ -21,11 +21,18 @@
 ControlPoint::ControlPoint(GlyphContour *contour, int pointNumber, QGraphicsItem *parent) :
 	QObject(), QGraphicsItem(parent), m_contour(contour), m_pointNumber(pointNumber)
 {
+	Q_ASSERT(contour);
+	Q_ASSERT(pointNumber < contour->points().size());
+
 	setFlag(ItemIsMovable);
 	setFlag(ItemIsSelectable);
 	setFlag(ItemIgnoresTransformations);
+	setFlag(ItemClipsToShape);
 	setZValue(1);
 
+	GlyphPoint pt = contour->points().at(m_pointNumber);
+	setPos(pt.x(), -pt.y());
+
 	connect(m_contour, SIGNAL(pointChanged(int)), this, SLOT(glyphPointChanged(int)));
 }
 
diff --git a/gui/glyphgraphics.cxx b/gui/glyphgraphics.cxx
index bb16c35..723142d 100644
--- a/gui/glyphgraphics.cxx
+++ b/gui/glyphgraphics.cxx
@@ -42,10 +42,8 @@ GlyphGraphics::GlyphGraphics(GlyphCell *parent, Glyph *glyph) :
 			Q_ASSERT(c);
 
 			for (int j = 0; j < c->points().size(); j++) {
-				const GlyphPoint pt = c->points().at(j);
 				ControlPoint *cp = new ControlPoint(c, j, item);
 				points.append(cp);
-				cp->setPos(pt.x(), -pt.y());
 			}
 			connect(c, SIGNAL(pointsAdded(int, int)), this, SLOT(contourPointsAdded(int, int)));
 		}
@@ -153,9 +151,7 @@ void GlyphGraphics::contourPointsAdded(int start, int end)
 
 	for (int i = start; i <= end; i++) {
 		qDebug() << "Adding a point";
-		const GlyphPoint pt = contour->points().at(i);
 		ControlPoint *cp = new ControlPoint(contour, i, item);
 		points.append(cp);
-		cp->setPos(pt.x(), -pt.y()); // TODO ControlPoint should be able to do this by itself
 	}
 }

-- 
Fondue Font Editor



More information about the fondue-commits mailing list