# HG changeset patch
# User insilmaril
# Date 1182436066 0
# Node ID f19bbd63972620a4349bd9f72cf70832755bac11
# Parent  eacf1b165d2d4b5dcd058aed184b2be386c283d7
1.9.0-beta1

diff -r eacf1b165d2d -r f19bbd639726 mainwindow.cpp
--- a/mainwindow.cpp	Wed Jun 20 11:58:47 2007 +0000
+++ b/mainwindow.cpp	Thu Jun 21 14:27:46 2007 +0000
@@ -1466,11 +1466,18 @@
     QMenu *testMenu = menuBar()->addMenu( tr( "&Test" ));
 
     QAction *a;
-    a = new QAction( "Test function" , this);
-    a->setStatusTip( "Call test function" );
+    a = new QAction( "Test function 1" , this);
+    a->setStatusTip( "Call test function 1" );
+	testMenu->addAction (a);
 	//a->setShortcut (Qt::Key_F4 );
-    connect( a, SIGNAL( triggered() ), this, SLOT( testFunction() ) );
+    connect( a, SIGNAL( triggered() ), this, SLOT( testFunction1() ) );
+
+    a = new QAction( "Test function 2" , this);
+    a->setStatusTip( "Call test function 2" );
+	//a->setShortcut (Qt::Key_F4 );
 	testMenu->addAction (a);
+    connect( a, SIGNAL( triggered() ), this, SLOT( testFunction2() ) );
+
     a = new QAction( "Command" , this);
     a->setStatusTip( "Enter command to call in editor" );
 	//a->setShortcut (Qt::Key_F5 );
@@ -3581,10 +3588,16 @@
 		currentMapEditor()->toggleStandardFlag(sender()->name());
 }
 
-void Main::testFunction()
+void Main::testFunction1()
 {
 	if (!currentMapEditor()) return;
-	currentMapEditor()->testFunction();
+	currentMapEditor()->testFunction1();
+}
+
+void Main::testFunction2()
+{
+	if (!currentMapEditor()) return;
+	currentMapEditor()->testFunction2();
 }
 
 void Main::testCommand()
diff -r eacf1b165d2d -r f19bbd639726 mainwindow.h
--- a/mainwindow.h	Wed Jun 20 11:58:47 2007 +0000
+++ b/mainwindow.h	Thu Jun 21 14:27:46 2007 +0000
@@ -200,7 +200,8 @@
 
 	void standardFlagChanged();
 
-    void testFunction();
+    void testFunction1();
+    void testFunction2();
     void testCommand();
 
     void helpDoc();
diff -r eacf1b165d2d -r f19bbd639726 mapeditor.cpp
--- a/mapeditor.cpp	Wed Jun 20 11:58:47 2007 +0000
+++ b/mapeditor.cpp	Thu Jun 21 14:27:46 2007 +0000
@@ -4041,10 +4041,25 @@
 	}
 }
 
-void MapEditor::testFunction()
+void MapEditor::testFunction1()
 {
+
+    tcpServer = new QTcpServer(this);
+    if (!tcpServer->listen(QHostAddress::Any,54321)) {
+        QMessageBox::critical(this, tr("Fortune Server"),
+                              tr("Unable to start the server: %1.")
+                              .arg(tcpServer->errorString()));
+        close();
+        return;
+    }
+	connect(tcpServer, SIGNAL(newConnection()), this, SLOT(newClient()));
+	if (debug)
+		cout<<"Server is running on port "<<tcpServer->serverPort()<<endl;
+
+/*
 	BranchObj *bo=xelection.getBranch();
 	if (bo) animObjList.append( bo );
+*/	
 	
 /*
 	WarningDialog dia;
@@ -4084,6 +4099,23 @@
 	}	
 	cout <<"  hidemode="<<hidemode<<endl;
 	*/
+}	
+	
+void MapEditor::testFunction2()
+{
+   QByteArray block;
+    QDataStream out(&block, QIODevice::WriteOnly);
+    out.setVersion(QDataStream::Qt_4_0);
+    out << (quint16)0;
+    out << xelection.getSelectString();
+    out.device()->seek(0);
+    out << (quint16)(block.size() - sizeof(quint16));
+
+	for (int i=0; i<clientList.size(); ++i)
+	{
+		cout << "Sending to "<<clientList.at(i)->peerAddress().toString().ascii()<<endl;
+		clientList.at(i)->write (block);
+	}
 }
 
 void MapEditor::contextMenuEvent ( QContextMenuEvent * e )
@@ -4735,6 +4767,27 @@
 		mainWindow->fileSave (this);
 }
 
+void MapEditor::newClient()
+{
+    QByteArray block;
+    QDataStream out(&block, QIODevice::WriteOnly);
+    out.setVersion(QDataStream::Qt_4_0);
+    out << (quint16)0;
+    out << xelection.getSelectString();
+    out.device()->seek(0);
+    out << (quint16)(block.size() - sizeof(quint16));
+
+    QTcpSocket *newClient = tcpServer->nextPendingConnection();
+    connect(newClient, SIGNAL(disconnected()),
+            newClient, SLOT(deleteLater()));
+
+	cout <<"ME::newClient  at "<<newClient->peerAddress().toString().ascii()<<endl;
+
+	clientList.append (newClient);
+
+    newClient->write(block);
+    //newClient->disconnectFromHost();
+}
 
 /*TODO not needed? void MapEditor::contentsDropEvent(QDropEvent *event) 
 {
diff -r eacf1b165d2d -r f19bbd639726 mapeditor.h
--- a/mapeditor.h	Wed Jun 20 11:58:47 2007 +0000
+++ b/mapeditor.h	Thu Jun 21 14:27:46 2007 +0000
@@ -2,6 +2,7 @@
 #define MAPEDITOR_H
 
 #include <QGraphicsView>
+#include <QtNetwork>
 
 #include "mapcenterobj.h"
 #include "file.h"
@@ -308,7 +309,8 @@
     void importDir();
 	void followXLink (int);
 	void editXLink (int);
-    void testFunction();					// just testing new stuff
+    void testFunction1();					// just testing new stuff
+    void testFunction2();					// just testing new stuff
 											// set /mainwindo/showTestMenu=true...
 
 protected:
@@ -330,6 +332,7 @@
 
 private slots:	
 	void autosave ();
+	void newClient();
 
 private:
 	State state;				// State of MapEditor
@@ -399,6 +402,9 @@
 	QPoint exportOffset;		// set before export, used in save
 	BranchObj::HideTmpMode hidemode;	// true while exporting to hide some stuff
 
+	QTcpServer *tcpServer;		// Act as server in conference mode (experimental)
+	QList <QTcpSocket*> clientList;
+
 	int timerId;				// animation timer
 	QList <MapObj*> animObjList;// list with animated objects
 };
diff -r eacf1b165d2d -r f19bbd639726 tex/vym.tex
--- a/tex/vym.tex	Wed Jun 20 11:58:47 2007 +0000
+++ b/tex/vym.tex	Thu Jun 21 14:27:46 2007 +0000
@@ -866,7 +866,12 @@
 }
 
 \subsection{Macros} \label{macros}
-Macros have been added to \vym in version~1.9.0. Each function key
+Macros have been added to \vym in version~1.9.0. 
+So far they have a preliminary character, maybe they are going to be
+replaced by full-featured scripting functionality later (though the
+commands will be more or less the same).
+
+Each function key
 \key{F1} to \key{F12} holds a macro, which is executed on the current
 selection if the key is pressed. The default macros change the colour of
 a subtree or set the frame of a branch:
diff -r eacf1b165d2d -r f19bbd639726 version.h
--- a/version.h	Wed Jun 20 11:58:47 2007 +0000
+++ b/version.h	Thu Jun 21 14:27:46 2007 +0000
@@ -5,9 +5,9 @@
 
 #define __VYM_NAME "VYM"
 #define __VYM_VERSION "1.8.74"
-//#define __VYM_CODENAME "Codename: 1.9.0-beta-1"
-#define __VYM_CODENAME "Codename: development version"
-#define __VYM_BUILD_DATE "June 20, 2007"
+#define __VYM_CODENAME "Codename: 1.9.0-beta-1"
+//#define __VYM_CODENAME "Codename: development version"
+#define __VYM_BUILD_DATE "June 21, 2007"
 
 
 bool checkVersion(const QString &);
diff -r eacf1b165d2d -r f19bbd639726 vym.pro
--- a/vym.pro	Wed Jun 20 11:58:47 2007 +0000
+++ b/vym.pro	Thu Jun 21 14:27:46 2007 +0000
@@ -6,6 +6,7 @@
 ICON =icons/vym.icns
 
 QT += qt3support
+QT += network
 
 HEADERS	+= \	
 	aboutdialog.h \