mapeditor.cpp
changeset 534 32b71ba642aa
parent 531 be24af55da40
child 537 16d3598f611f
     1.1 --- a/mapeditor.cpp	Fri Jun 29 09:43:54 2007 +0000
     1.2 +++ b/mapeditor.cpp	Fri Jun 29 15:12:04 2007 +0000
     1.3 @@ -775,7 +775,10 @@
     1.4  						// Get number in parent
     1.5  						x=parser.parInt (ok,1);
     1.6  						if (ok)
     1.7 +						{
     1.8  							selb->linkTo ((BranchObj*)(dst),x);
     1.9 +							xelection.update();
    1.10 +						}	
    1.11  					} else if (typeid(*dst) == typeid(MapCenterObj) ) 
    1.12  					{
    1.13  						selb->linkTo ((BranchObj*)(dst),-1);
    1.14 @@ -784,7 +787,11 @@
    1.15  						if (ok)
    1.16  						{
    1.17  							y=parser.parInt (ok,3);
    1.18 -							if (ok) selb->move (x,y);
    1.19 +							if (ok) 
    1.20 +							{
    1.21 +								selb->move (x,y);
    1.22 +								xelection.update();
    1.23 +							}
    1.24  						}
    1.25  					}	
    1.26  				}	
    1.27 @@ -2450,11 +2457,9 @@
    1.28  			// so we have to pass on this information via saveState.
    1.29  			// TODO: Get rid of this positioning workaround
    1.30  			QString ps=qpointfToString (newbo->getAbsPos());
    1.31 -			saveState(
    1.32 -				newbo, "move "+ps, 
    1.33 -				newbo, "move "+ps, 
    1.34 -				QString("Move %1 to  %2").arg(getName(newbo)).arg(ps));
    1.35 -
    1.36 +			sendData ("selectLastBranch ()");
    1.37 +			sendData (QString("move %1").arg(ps));
    1.38 +			sendSelection();
    1.39  			xelection.update();
    1.40  		}
    1.41  	}	
    1.42 @@ -4090,7 +4095,6 @@
    1.43  
    1.44  void MapEditor::testFunction1()
    1.45  {
    1.46 -	newServer();
    1.47  
    1.48  /*
    1.49  	BranchObj *bo=xelection.getBranch();
    1.50 @@ -4139,7 +4143,6 @@
    1.51  	
    1.52  void MapEditor::testFunction2()
    1.53  {
    1.54 -	sendData("Foo");
    1.55  }
    1.56  
    1.57  void MapEditor::contextMenuEvent ( QContextMenuEvent * e )
    1.58 @@ -4800,8 +4803,7 @@
    1.59      }
    1.60  	connect(tcpServer, SIGNAL(newConnection()), this, SLOT(newClient()));
    1.61  	netstate=Server;
    1.62 -	if (debug)
    1.63 -		cout<<"Server is running on port "<<tcpServer->serverPort()<<endl;
    1.64 +	cout<<"Server is running on port "<<tcpServer->serverPort()<<endl;
    1.65  }
    1.66  
    1.67  void MapEditor::connectToServer()
    1.68 @@ -4865,33 +4867,24 @@
    1.69  
    1.70  void MapEditor::readData ()
    1.71  {
    1.72 -	cout <<"readData  bytesAvail="<<clientSocket->bytesAvailable()<<endl;
    1.73 -    quint16 recCounter;
    1.74 -	quint16 blockSize;
    1.75 -
    1.76 -    QDataStream in(clientSocket);
    1.77 -    in.setVersion(QDataStream::Qt_4_0);
    1.78 -
    1.79 -    in >> blockSize;
    1.80 -    in >> recCounter;
    1.81 -	
    1.82 -	char *sp; 
    1.83 -	uint l;
    1.84 -	in.readBytes (sp,l);
    1.85 -	cout << "  sp="<<sp<<"  l="<<l<<endl;
    1.86 -	QString t;
    1.87 -	in >>t;
    1.88 -	cout << "  t="<<t.ascii()<<endl;
    1.89 -
    1.90  	while (clientSocket->bytesAvailable() >=(int)sizeof(quint16) )
    1.91  	{
    1.92 -		//cout <<"readData 1 bytesAvail="<<clientSocket->bytesAvailable()<<"  readData bS="<<blockSize<<"  rC="<<recCounter<<endl;
    1.93 -		QString s;
    1.94 -		in >> s;
    1.95 -		//cout << "Received: "<< recCounter<< "  "<<s.ascii() <<endl;
    1.96 -	cout <<"  bytesAvail="<<clientSocket->bytesAvailable()<<"   bS="<<blockSize<<"  counter="<<recCounter<<"  s="<<s.ascii()<<endl;
    1.97 -		parseAtom (s);
    1.98 +		cout <<"readData  bytesAvail="<<clientSocket->bytesAvailable();
    1.99 +		quint16 recCounter;
   1.100 +		quint16 blockSize;
   1.101 +
   1.102 +		QDataStream in(clientSocket);
   1.103 +		in.setVersion(QDataStream::Qt_4_0);
   1.104 +
   1.105 +		in >> blockSize;
   1.106 +		in >> recCounter;
   1.107 +		
   1.108 +		QString t;
   1.109 +		in >>t;
   1.110 +		cout << "  t="<<t.ascii()<<endl;
   1.111 +		parseAtom (t);
   1.112  	}
   1.113 +	return;
   1.114  }
   1.115  
   1.116  void MapEditor::displayNetworkError(QAbstractSocket::SocketError socketError)