1.1 --- a/branchobj.cpp	Wed Jan 10 13:26:12 2007 +0000
     1.2 +++ b/branchobj.cpp	Tue Jan 23 11:50:53 2007 +0000
     1.3 @@ -16,6 +16,11 @@
     1.4  BranchObj* BranchObj::itFirst=NULL;
     1.5  
     1.6  
     1.7 +HeadingObj* BranchObj::getHO()  //FIXME testing only
     1.8 +{
     1.9 +	return heading;
    1.10 +}
    1.11 +
    1.12  BranchObj::BranchObj () :OrnamentedObj()
    1.13  {
    1.14  //    cout << "Const BranchObj ()\n";
    1.15 @@ -744,12 +749,6 @@
    1.16  	else
    1.17  		scrolledAttr="";
    1.18  
    1.19 -	QString frameAttr;
    1.20 -	if (frame->getFrameType()!=NoFrame)
    1.21 -		frameAttr=attribut ("frameType",frame->getFrameTypeName());
    1.22 -	else
    1.23 -		frameAttr="";
    1.24 -
    1.25  	// save area, if not scrolled
    1.26  	QString areaAttr;
    1.27  	if (!((BranchObj*)(parObj))->isScrolled() )
    1.28 @@ -773,21 +772,19 @@
    1.29      s=beginElement ("branch" 
    1.30  		+getOrnAttr() 
    1.31  		+scrolledAttr 
    1.32 -		+frameAttr 
    1.33  		+areaAttr 
    1.34  		+idAttr 
    1.35  		+getIncludeImageAttr() );
    1.36      incIndent();
    1.37  
    1.38 -	/* Testing
    1.39 -	for (int i=1; i<depth;i++) cout << "  ";
    1.40 -	cout <<getHeading().ascii()<<endl;
    1.41 -	*/
    1.42 -
    1.43  	// save heading
    1.44      s+=valueElement("heading", getHeading(),
    1.45  		attribut ("textColor",QColor(heading->getColor()).name()));
    1.46  
    1.47 +	// Save frame
    1.48 +	if (frame->getFrameType()!=NoFrame) 
    1.49 +		s+=frame->saveToDir ();
    1.50 +
    1.51  	// save names of flags set
    1.52  	s+=standardFlags->saveToDir(tmpdir,prefix,0);
    1.53  	
    1.54 @@ -1082,7 +1079,7 @@
    1.55  	int pos=borem->getNum();
    1.56  	while (bo)
    1.57  	{
    1.58 -		bo->moveBranchTo (this,pos+1);
    1.59 +		bo->linkTo (this,pos+1);
    1.60  		bo=borem->getLastBranch();
    1.61  	}	
    1.62  	removeBranch (borem);
    1.63 @@ -1210,7 +1207,7 @@
    1.64  		return NULL;
    1.65  }
    1.66  
    1.67 -BranchObj* BranchObj::moveBranchTo (BranchObj* dst, int pos)
    1.68 +BranchObj* BranchObj::linkTo (BranchObj* dst, int pos)
    1.69  {
    1.70  	// Find current parent and 
    1.71  	// remove pointer to myself there
     2.1 --- a/branchobj.h	Wed Jan 10 13:26:12 2007 +0000
     2.2 +++ b/branchobj.h	Tue Jan 23 11:50:53 2007 +0000
     2.3 @@ -15,6 +15,7 @@
     2.4  /////////////////////////////////////////////////////////////////////////////
     2.5  class BranchObj:public OrnamentedObj {
     2.6  public:
     2.7 +	HeadingObj* getHO();	//FIXME testing
     2.8      BranchObj ();
     2.9      BranchObj (QGraphicsScene*);
    2.10      BranchObj (QGraphicsScene*, LinkableMapObj* parent);
    2.11 @@ -106,7 +107,7 @@
    2.12      virtual BranchObj* moveBranchUp(BranchObj*);
    2.13      virtual bool canMoveBranchDown();
    2.14      virtual BranchObj* moveBranchDown(BranchObj*);
    2.15 -    virtual BranchObj* moveBranchTo (BranchObj*, int);
    2.16 +    virtual BranchObj* linkTo (BranchObj*, int);
    2.17      virtual void alignRelativeTo(const QPointF );
    2.18  	virtual void reposition();
    2.19  	virtual void unsetAllRepositionRequests();
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/branchpropwindow.cpp	Tue Jan 23 11:50:53 2007 +0000
     3.3 @@ -0,0 +1,64 @@
     3.4 +#include "branchpropwindow.h"
     3.5 +
     3.6 +#include "frameobj.h"
     3.7 +
     3.8 +
     3.9 +BranchPropertyWindow::BranchPropertyWindow (QWidget *parent):QDialog(parent)
    3.10 +{
    3.11 +	ui.setupUi (this);
    3.12 +
    3.13 +	branch=NULL;
    3.14 +	mapEditor=NULL;
    3.15 +
    3.16 +	connect ( ui.frameTypeCombo, SIGNAL (currentIndexChanged( int)), this, SLOT (frameTypeChanged (int)));
    3.17 +	connect ( ui.hideLinkIfUnselected, SIGNAL (stateChanged( int)), this, SLOT (linkHideUnselectedChanged (int)));
    3.18 +}
    3.19 +
    3.20 +void BranchPropertyWindow::setBranch (BranchObj *bo)
    3.21 +{
    3.22 +	if (!bo) return;
    3.23 +	branch=bo;
    3.24 +
    3.25 +	// Frame
    3.26 +	switch (branch->getFrameType())
    3.27 +	{
    3.28 +		case NoFrame: 
    3.29 +			ui.frameTypeCombo->setCurrentIndex (0);
    3.30 +			break;
    3.31 +		case Rectangle: 
    3.32 +			ui.frameTypeCombo->setCurrentIndex (1);
    3.33 +			break;
    3.34 +		case Ellipse: 
    3.35 +			ui.frameTypeCombo->setCurrentIndex (2);
    3.36 +			break;
    3.37 +	}
    3.38 +	
    3.39 +	// Link
    3.40 +	if (branch->getHideLinkUnselected())
    3.41 +		ui.hideLinkIfUnselected->setCheckState (Qt::Checked);
    3.42 +	else	
    3.43 +		ui.hideLinkIfUnselected->setCheckState (Qt::Unchecked);
    3.44 +}
    3.45 +
    3.46 +void BranchPropertyWindow::setMapEditor (MapEditor *me)
    3.47 +{
    3.48 +	if (me) mapEditor=me;
    3.49 +}
    3.50 +
    3.51 +void BranchPropertyWindow::frameTypeChanged (int i)
    3.52 +{
    3.53 +	if (mapEditor)
    3.54 +		switch (i)
    3.55 +		{
    3.56 +			case 0: mapEditor->setFrame (NoFrame); break;
    3.57 +			case 1: mapEditor->setFrame (Rectangle); break;
    3.58 +			case 2: mapEditor->setFrame (Ellipse); break;
    3.59 +		}
    3.60 +}
    3.61 +
    3.62 +void BranchPropertyWindow::linkHideUnselectedChanged (int i)
    3.63 +{
    3.64 +	if (!branch) return;
    3.65 +	branch->setHideLinkUnselected(i);
    3.66 +}
    3.67 +
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/branchpropwindow.h	Tue Jan 23 11:50:53 2007 +0000
     4.3 @@ -0,0 +1,28 @@
     4.4 +#ifndef BRANCHPROPERTYWINDOW_H
     4.5 +#define BRANCHPROPERTYWINDOW_H
     4.6 +
     4.7 +#include "ui_branchpropwindow.h"
     4.8 +
     4.9 +#include "branchobj.h"
    4.10 +#include "mapeditor.h"
    4.11 +
    4.12 +class BranchPropertyWindow:public QDialog
    4.13 +{
    4.14 +	Q_OBJECT
    4.15 +public:
    4.16 +	BranchPropertyWindow (QWidget *parent=0);
    4.17 +	void setBranch (BranchObj *);
    4.18 +	void setMapEditor (MapEditor *);
    4.19 +
    4.20 +private slots:
    4.21 +	void frameTypeChanged (int);
    4.22 +	void linkHideUnselectedChanged (int);
    4.23 +
    4.24 +private:
    4.25 +	Ui::BranchPropertyWindow ui;
    4.26 +
    4.27 +	BranchObj *branch;
    4.28 +	MapEditor *mapEditor;
    4.29 +};
    4.30 +
    4.31 +#endif // 
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/branchpropwindow.ui	Tue Jan 23 11:50:53 2007 +0000
     5.3 @@ -0,0 +1,128 @@
     5.4 +<ui version="4.0" >
     5.5 + <class>BranchPropertyWindow</class>
     5.6 + <widget class="QWidget" name="BranchPropertyWindow" >
     5.7 +  <property name="geometry" >
     5.8 +   <rect>
     5.9 +    <x>0</x>
    5.10 +    <y>0</y>
    5.11 +    <width>343</width>
    5.12 +    <height>208</height>
    5.13 +   </rect>
    5.14 +  </property>
    5.15 +  <property name="windowTitle" >
    5.16 +   <string>Form</string>
    5.17 +  </property>
    5.18 +  <layout class="QVBoxLayout" >
    5.19 +   <property name="margin" >
    5.20 +    <number>9</number>
    5.21 +   </property>
    5.22 +   <property name="spacing" >
    5.23 +    <number>6</number>
    5.24 +   </property>
    5.25 +   <item>
    5.26 +    <widget class="QTabWidget" name="tabWidget" >
    5.27 +     <property name="currentIndex" >
    5.28 +      <number>0</number>
    5.29 +     </property>
    5.30 +     <widget class="QWidget" name="tab" >
    5.31 +      <attribute name="title" >
    5.32 +       <string>Frame</string>
    5.33 +      </attribute>
    5.34 +      <widget class="QComboBox" name="frameTypeCombo" >
    5.35 +       <property name="geometry" >
    5.36 +        <rect>
    5.37 +         <x>10</x>
    5.38 +         <y>10</y>
    5.39 +         <width>301</width>
    5.40 +         <height>22</height>
    5.41 +        </rect>
    5.42 +       </property>
    5.43 +       <item>
    5.44 +        <property name="text" >
    5.45 +         <string>No Frame</string>
    5.46 +        </property>
    5.47 +       </item>
    5.48 +       <item>
    5.49 +        <property name="text" >
    5.50 +         <string>Rectangle</string>
    5.51 +        </property>
    5.52 +       </item>
    5.53 +       <item>
    5.54 +        <property name="text" >
    5.55 +         <string>Ellipse</string>
    5.56 +        </property>
    5.57 +       </item>
    5.58 +      </widget>
    5.59 +     </widget>
    5.60 +     <widget class="QWidget" name="tab_2" >
    5.61 +      <attribute name="title" >
    5.62 +       <string>Link</string>
    5.63 +      </attribute>
    5.64 +      <widget class="QCheckBox" name="hideLinkIfUnselected" >
    5.65 +       <property name="geometry" >
    5.66 +        <rect>
    5.67 +         <x>20</x>
    5.68 +         <y>10</y>
    5.69 +         <width>231</width>
    5.70 +         <height>21</height>
    5.71 +        </rect>
    5.72 +       </property>
    5.73 +       <property name="text" >
    5.74 +        <string>Hide link if unselected</string>
    5.75 +       </property>
    5.76 +      </widget>
    5.77 +     </widget>
    5.78 +    </widget>
    5.79 +   </item>
    5.80 +   <item>
    5.81 +    <layout class="QHBoxLayout" >
    5.82 +     <property name="margin" >
    5.83 +      <number>0</number>
    5.84 +     </property>
    5.85 +     <property name="spacing" >
    5.86 +      <number>6</number>
    5.87 +     </property>
    5.88 +     <item>
    5.89 +      <spacer>
    5.90 +       <property name="orientation" >
    5.91 +        <enum>Qt::Horizontal</enum>
    5.92 +       </property>
    5.93 +       <property name="sizeHint" >
    5.94 +        <size>
    5.95 +         <width>251</width>
    5.96 +         <height>20</height>
    5.97 +        </size>
    5.98 +       </property>
    5.99 +      </spacer>
   5.100 +     </item>
   5.101 +     <item>
   5.102 +      <widget class="QPushButton" name="closeButton" >
   5.103 +       <property name="text" >
   5.104 +        <string>Close</string>
   5.105 +       </property>
   5.106 +      </widget>
   5.107 +     </item>
   5.108 +    </layout>
   5.109 +   </item>
   5.110 +  </layout>
   5.111 + </widget>
   5.112 + <resources/>
   5.113 + <connections>
   5.114 +  <connection>
   5.115 +   <sender>closeButton</sender>
   5.116 +   <signal>clicked()</signal>
   5.117 +   <receiver>BranchPropertyWindow</receiver>
   5.118 +   <slot>hide()</slot>
   5.119 +   <hints>
   5.120 +    <hint type="sourcelabel" >
   5.121 +     <x>315</x>
   5.122 +     <y>173</y>
   5.123 +    </hint>
   5.124 +    <hint type="destinationlabel" >
   5.125 +     <x>171</x>
   5.126 +     <y>103</y>
   5.127 +    </hint>
   5.128 +   </hints>
   5.129 +  </connection>
   5.130 + </connections>
   5.131 +</ui>
     6.1 --- a/frameobj.cpp	Wed Jan 10 13:26:12 2007 +0000
     6.2 +++ b/frameobj.cpp	Tue Jan 23 11:50:53 2007 +0000
     6.3 @@ -37,6 +37,9 @@
     6.4  		case Rectangle:
     6.5  			delete rectFrame;
     6.6  			break;
     6.7 +		case Ellipse:
     6.8 +			delete ellipseFrame;
     6.9 +			break;
    6.10      }
    6.11  	type=NoFrame;
    6.12  	border=0;
    6.13 @@ -51,6 +54,9 @@
    6.14  		case Rectangle:
    6.15  			rectFrame->setPos (x,y);
    6.16  			break;
    6.17 +		case Ellipse:
    6.18 +			ellipseFrame->setPos (x,y);
    6.19 +			break;
    6.20      }
    6.21  }
    6.22  
    6.23 @@ -77,6 +83,9 @@
    6.24  		case Rectangle:
    6.25  			rectFrame->setRect (QRectF(bbox.x(),bbox.y(),bbox.width(),bbox.height() ));
    6.26  			break;
    6.27 +		case Ellipse:
    6.28 +			ellipseFrame->setRect (QRectF(bbox.x(),bbox.y(),bbox.width(),bbox.height() ));
    6.29 +			break;
    6.30      }
    6.31  }
    6.32  
    6.33 @@ -97,6 +106,9 @@
    6.34  		case Rectangle:
    6.35  			return "Rectangle";
    6.36  			break;
    6.37 +		case Ellipse:
    6.38 +			return "Ellipse";
    6.39 +			break;
    6.40  		default:
    6.41  			return "NoFrame";
    6.42      }
    6.43 @@ -117,7 +129,11 @@
    6.44  				border=10;
    6.45  				rectFrame = scene->addRect(QRectF(0,0,0,0), QPen(QColor("black") ), QColor("white"));
    6.46  				rectFrame->setZValue(Z_FRAME);
    6.47 -
    6.48 +				break;
    6.49 +			case Ellipse:
    6.50 +				border=10;
    6.51 +				ellipseFrame = scene->addEllipse(QRectF(0,0,0,0), QPen(QColor("black") ), QColor("white"));
    6.52 +				ellipseFrame->setZValue(Z_FRAME);
    6.53  				break;
    6.54  		}
    6.55  		setVisibility (visible);
    6.56 @@ -128,6 +144,8 @@
    6.57  {
    6.58  	if (t=="Rectangle")
    6.59  		FrameObj::setFrameType (Rectangle);
    6.60 +	else if (t=="Ellipse")	
    6.61 +		FrameObj::setFrameType (Ellipse);
    6.62  	else	
    6.63  		FrameObj::setFrameType (NoFrame);
    6.64  }
    6.65 @@ -145,6 +163,18 @@
    6.66  			else    
    6.67  				rectFrame->hide();
    6.68  			break;
    6.69 +		case Ellipse:
    6.70 +			if (visible)
    6.71 +				ellipseFrame->show();
    6.72 +			else    
    6.73 +				ellipseFrame->hide();
    6.74 +			break;
    6.75  	}
    6.76  }
    6.77  
    6.78 +QString FrameObj::saveToDir ()
    6.79 +{
    6.80 +	QString	frameTypeAttr=attribut ("frameType",getFrameTypeName());
    6.81 +	return singleElement ("frame",frameTypeAttr);
    6.82 +}
    6.83 +
     7.1 --- a/frameobj.h	Wed Jan 10 13:26:12 2007 +0000
     7.2 +++ b/frameobj.h	Tue Jan 23 11:50:53 2007 +0000
     7.3 @@ -3,7 +3,7 @@
     7.4  
     7.5  #include "mapobj.h"
     7.6  
     7.7 -enum FrameType {NoFrame,Rectangle};
     7.8 +enum FrameType {NoFrame,Rectangle,Ellipse};
     7.9  
    7.10  class FrameObj:public MapObj {
    7.11  public:
    7.12 @@ -23,10 +23,12 @@
    7.13      void setFrameType (const FrameType &);
    7.14      void setFrameType (const QString &);
    7.15      void setVisibility(bool);
    7.16 +	QString saveToDir ();
    7.17  
    7.18  protected:
    7.19      FrameType type;
    7.20      QGraphicsRectItem * rectFrame;
    7.21 +    QGraphicsEllipseItem * ellipseFrame;
    7.22      int border;									// distance text - frame
    7.23  };
    7.24  #endif
     8.1 --- a/headingobj.cpp	Wed Jan 10 13:26:12 2007 +0000
     8.2 +++ b/headingobj.cpp	Tue Jan 23 11:50:53 2007 +0000
     8.3 @@ -92,13 +92,10 @@
     8.4  
     8.5  QGraphicsTextItem* HeadingObj::newLine(QString s)
     8.6  {
     8.7 -    QGraphicsTextItem *t=scene->addText("");
     8.8 +    QGraphicsTextItem *t=scene->addText(s);
     8.9      t->setFont (font);
    8.10      t->setZValue(Z_TEXT);
    8.11      t->setDefaultTextColor(color);
    8.12 -    t->setPlainText(s);
    8.13 -	//t->setTextFlags(Qt::AlignLeft);
    8.14 -    t->show();
    8.15      return t;
    8.16  }
    8.17  
     9.1 --- a/historywindow.cpp	Wed Jan 10 13:26:12 2007 +0000
     9.2 +++ b/historywindow.cpp	Tue Jan 23 11:50:53 2007 +0000
     9.3 @@ -39,19 +39,19 @@
     9.4  
     9.5  	for (int i=0; i<3; ++i)
     9.6  		ui.historyTable->setColumnWidth (i,settings.value( QString("/historywindow/geometry/columnWidth/%1").arg(i),150).toInt());
     9.7 -/*
     9.8 +
     9.9  	if (settings.value ( "/historywindow/showWithMain",false).toBool())
    9.10  		setShowWithMain(true);
    9.11  	else	
    9.12  		setShowWithMain(false);
    9.13 -*/
    9.14 +
    9.15  }
    9.16  
    9.17  HistoryWindow::~HistoryWindow()
    9.18  {
    9.19  	settings.setValue( "/historywindow/geometry/size", size() );
    9.20  	settings.setValue( "/historywindow/geometry/pos", pos() );
    9.21 -	//settings.setValue( "/historywindow/showWithMain",showWithMain());
    9.22 +	settings.setValue( "/historywindow/showWithMain",showWithMain());
    9.23  	for (int i=0; i<3; ++i)
    9.24  		settings.setValue( QString("/historywindow/geometry/columnWidth/%1").arg(i), ui.historyTable->columnWidth (i) );
    9.25  }
    9.26 @@ -153,6 +153,16 @@
    9.27  
    9.28  }
    9.29  
    9.30 +void HistoryWindow::setShowWithMain (bool v)
    9.31 +{
    9.32 +	showwithmain=v;
    9.33 +}
    9.34 +
    9.35 +bool HistoryWindow::showWithMain()
    9.36 +{
    9.37 +	return showwithmain;
    9.38 +}
    9.39 +
    9.40  void HistoryWindow::undo()
    9.41  {
    9.42  	mainWindow->editUndo();
    10.1 --- a/historywindow.h	Wed Jan 10 13:26:12 2007 +0000
    10.2 +++ b/historywindow.h	Tue Jan 23 11:50:53 2007 +0000
    10.3 @@ -15,6 +15,8 @@
    10.4  	~HistoryWindow();
    10.5  	void update (SimpleSettings &);
    10.6  	void setStepsTotal (int);
    10.7 +	void setShowWithMain (bool);
    10.8 +	bool showWithMain ();
    10.9  
   10.10  private slots:	
   10.11  	void undo();
   10.12 @@ -25,6 +27,7 @@
   10.13  	void clearRow (int);
   10.14  	void updateRow (int, int, SimpleSettings &);
   10.15  	Ui::HistoryWindow ui;
   10.16 +	bool showwithmain;
   10.17  };
   10.18  
   10.19  
    11.1 --- a/imageobj.cpp	Wed Jan 10 13:26:12 2007 +0000
    11.2 +++ b/imageobj.cpp	Tue Jan 23 11:50:53 2007 +0000
    11.3 @@ -36,7 +36,7 @@
    11.4  
    11.5  void ImageObj::save(const QString &fn, const char *format)
    11.6  {
    11.7 -	pixmap().save (fn,format,-1);
    11.8 +	pixmap().save (fn,format,100);
    11.9  }
   11.10  
   11.11  bool ImageObj::load (const QString &fn)
    12.1 --- a/mainwindow.cpp	Wed Jan 10 13:26:12 2007 +0000
    12.2 +++ b/mainwindow.cpp	Tue Jan 23 11:50:53 2007 +0000
    12.3 @@ -5,6 +5,7 @@
    12.4  #include <iostream>
    12.5  
    12.6  #include "aboutdialog.h"
    12.7 +#include "branchpropwindow.h"
    12.8  #include "exportoofiledialog.h"
    12.9  #include "exports.h"
   12.10  #include "exportxhtmldialog.h"
   12.11 @@ -93,6 +94,10 @@
   12.12  	// Initialize history window;
   12.13  	historyWindow=new HistoryWindow();
   12.14  
   12.15 +	// Initialize properties window
   12.16 +	branchPropertyWindow = new BranchPropertyWindow();
   12.17 +	branchPropertyWindow->move (20,20);
   12.18 +
   12.19  	// Initialize some settings, which are platform dependant
   12.20  	QString p,s;
   12.21  
   12.22 @@ -763,6 +768,10 @@
   12.23      connect( a, SIGNAL( triggered() ), this, SLOT( editLoadImage() ) );
   12.24  	actionEditLoadImage=a;
   12.25  
   12.26 +    a = new QAction( tr( "Properties","Context menu for images and branches" )+QString ("..."), this);
   12.27 +	a->setStatusTip (tr( "Set properties for object" ));
   12.28 +    connect( a, SIGNAL( triggered() ), this, SLOT( showPropertyDialog() ) );
   12.29 +	actionOpenPropertyDialog=a;
   12.30  }
   12.31  
   12.32  // Format Actions
   12.33 @@ -840,19 +849,6 @@
   12.34  	formatMenu->addAction (a);
   12.35  	actionFormatLinkStylePolyParabel=a;
   12.36  	
   12.37 -	actionGroupFormatFrameTypes=new QActionGroup ( this);
   12.38 -	actionGroupFormatFrameTypes->setExclusive (true);
   12.39 -    a = new QAction( tr( "No Frame","Branch attribute" ), actionGroupFormatFrameTypes );
   12.40 -	a->setStatusTip (tr("No Frame"));
   12.41 -	a->setToggleAction(true);
   12.42 -    connect( a, SIGNAL( triggered() ), this, SLOT( formatFrameNone() ) );
   12.43 -	actionFormatFrameNone=a;
   12.44 -    a = new QAction( tr( "Rectangle""Branch attribute" ), actionGroupFormatFrameTypes);
   12.45 -	a->setStatusTip (tr( "Rectangle" ));
   12.46 -	a->setToggleAction(true);
   12.47 -    connect( a, SIGNAL( triggered() ), this, SLOT( formatFrameRectangle() ) );
   12.48 -	actionFormatFrameRectangle=a;
   12.49 -
   12.50      a = new QAction( tr( "Include images vertically","Branch attribute" ),  this);
   12.51  	a->setStatusTip ( tr ("Include top and bottom position of images into branch"));
   12.52  	a->setToggleAction(true);
   12.53 @@ -1444,6 +1440,9 @@
   12.54  	// Context Menu for branch or mapcenter
   12.55  	branchContextMenu =new QMenu (this);
   12.56  
   12.57 +	actionOpenPropertyDialog->addTo (branchContextMenu);
   12.58 +	branchContextMenu->addSeparator();	
   12.59 +
   12.60  		// Submenu "Add"
   12.61  		branchAddContextMenu =branchContextMenu->addMenu (tr("Add"));
   12.62  		branchAddContextMenu->addAction (actionEditPaste );
   12.63 @@ -1466,11 +1465,6 @@
   12.64  	actionEditSaveBranch->addTo( branchContextMenu );
   12.65  
   12.66  	branchContextMenu->addSeparator();	
   12.67 -	branchContextMenu->addAction ( actionFormatFrameNone );
   12.68 -	branchContextMenu->addAction ( actionFormatFrameRectangle);
   12.69 -	branchContextMenu->addAction ( actionFormatHideLinkUnselected );
   12.70 -
   12.71 -	branchContextMenu->addSeparator();	
   12.72  	branchContextMenu->addAction ( actionEditLoadImage);
   12.73  	branchContextMenu->addAction ( actionFormatIncludeImagesVer );
   12.74  	branchContextMenu->addAction ( actionFormatIncludeImagesHor );
   12.75 @@ -1605,6 +1599,7 @@
   12.76  	QFileDialog fd(this,caption);
   12.77  	fd.setMode (QFileDialog::DirectoryOnly);
   12.78  	fd.setCaption(vymName+ " - "+caption);
   12.79 +	fd.setDir (lastFileDir);
   12.80  	fd.show();
   12.81  	
   12.82  	if ( fd.exec() == QDialog::Accepted )
   12.83 @@ -2626,17 +2621,24 @@
   12.84  {
   12.85  	// only called from editHeading(), so there is a currentME
   12.86  	MapEditor *me=currentMapEditor();
   12.87 +	if (me)
   12.88 +	{
   12.89 +		QPoint p;	//Not used here, only to find out pos of branch
   12.90 +		bool ok;
   12.91 +		QString s=me->getHeading(ok,p);
   12.92  
   12.93  #if defined(Q_OS_MACX)
   12.94  #else
   12.95 -	me->setHeading(lineedit->text());
   12.96 -		
   12.97 -	lineedit->releaseKeyboard();
   12.98 -	lineedit->hide();
   12.99 -	setFocus();
  12.100 +		if (ok && s!=lineedit->text())
  12.101 +			me->setHeading(lineedit->text());
  12.102 +			
  12.103 +		lineedit->releaseKeyboard();
  12.104 +		lineedit->hide();
  12.105 +		setFocus();
  12.106  #endif	
  12.107 -	if (!prevSelection.isEmpty()) me->select(prevSelection);
  12.108 -	prevSelection="";
  12.109 +		if (!prevSelection.isEmpty()) me->select(prevSelection);
  12.110 +		prevSelection="";
  12.111 +	}
  12.112  }
  12.113  
  12.114  void Main::editHeading()
  12.115 @@ -2767,10 +2769,8 @@
  12.116  
  12.117  void Main::editMoveUp()
  12.118  {
  12.119 -	cout << "Main editMoveUp begin\n";
  12.120  	if (currentMapEditor())
  12.121  	    currentMapEditor()->moveBranchUp();
  12.122 -	cout << "Main editMoveUp end\n";
  12.123  }
  12.124  
  12.125  void Main::editMoveDown()
  12.126 @@ -3058,17 +3058,6 @@
  12.127  	currentMapEditor()->toggleMapLinkColorHint();
  12.128  }
  12.129  
  12.130 -void Main::formatFrameNone()
  12.131 -{
  12.132 -	if (currentMapEditor())
  12.133 -		currentMapEditor()->setFrame(NoFrame);
  12.134 -}
  12.135 -
  12.136 -void Main::formatFrameRectangle()
  12.137 -{
  12.138 -	if (currentMapEditor())
  12.139 -		currentMapEditor()->setFrame(Rectangle);
  12.140 -}
  12.141  
  12.142  void Main::formatIncludeImagesVer()
  12.143  {
  12.144 @@ -3082,7 +3071,7 @@
  12.145  		currentMapEditor()->setIncludeImagesHor(actionFormatIncludeImagesHor->isOn());
  12.146  }
  12.147  
  12.148 -void Main::formatHideLinkUnselected()
  12.149 +void Main::formatHideLinkUnselected()	//FIXME get rid of this with imagepropertydialog
  12.150  {
  12.151  	if (currentMapEditor())
  12.152  		currentMapEditor()->setHideLinkUnselected(actionFormatHideLinkUnselected->isOn());
  12.153 @@ -3340,17 +3329,6 @@
  12.154  			for (int i=0; i<actionListBranches.size(); ++i)	
  12.155  				actionListBranches.at(i)->setEnabled(true);
  12.156  			actionEditDelete->setEnabled (true);
  12.157 -			switch (selection->getFrameType())
  12.158 -			{
  12.159 -				case NoFrame: 
  12.160 -					actionFormatFrameNone->setOn(true);
  12.161 -					break;
  12.162 -				case Rectangle:
  12.163 -					actionFormatFrameRectangle->setOn(true);
  12.164 -					break;
  12.165 -				default:
  12.166 -					break;
  12.167 -			}	
  12.168  			actionFormatIncludeImagesVer->setOn
  12.169  				( ((BranchObj*)selection)->getIncludeImagesVer());
  12.170  			actionFormatIncludeImagesHor->setOn
  12.171 @@ -3438,6 +3416,23 @@
  12.172  	actionViewToggleNoteEditor->setOn (false);
  12.173  }
  12.174  
  12.175 +void Main::showPropertyDialog()
  12.176 +{
  12.177 +	if(currentMapEditor())
  12.178 +	{
  12.179 +		LinkableMapObj *sel=currentMapEditor()->getSelection();
  12.180 +		if (sel && typeid(*sel) == typeid(BranchObj))
  12.181 +		{
  12.182 +			branchPropertyWindow->show();
  12.183 +			branchPropertyWindow->setMapEditor(currentMapEditor());
  12.184 +			branchPropertyWindow->setBranch((BranchObj*)sel);
  12.185 +			return;
  12.186 +		}
  12.187 +		
  12.188 +	}	
  12.189 +	branchPropertyWindow->setBranch(NULL);
  12.190 +}
  12.191 +
  12.192  void Main::windowNextEditor()
  12.193  {
  12.194  	if (tabWidget->currentPageIndex() < tabWidget->count())
  12.195 @@ -3452,7 +3447,8 @@
  12.196  
  12.197  void Main::standardFlagChanged()
  12.198  {
  12.199 -	currentMapEditor()->toggleStandardFlag(sender()->name());
  12.200 +	if (currentMapEditor())
  12.201 +		currentMapEditor()->toggleStandardFlag(sender()->name());
  12.202  }
  12.203  
  12.204  void Main::testFunction()
    13.1 --- a/mainwindow.h	Wed Jan 10 13:26:12 2007 +0000
    13.2 +++ b/mainwindow.h	Tue Jan 23 11:50:53 2007 +0000
    13.3 @@ -3,6 +3,7 @@
    13.4  
    13.5  #include <QMainWindow>
    13.6  
    13.7 +#include "branchpropwindow.h"
    13.8  #include "file.h"
    13.9  #include "findwindow.h"
   13.10  #include "historywindow.h"
   13.11 @@ -146,8 +147,6 @@
   13.12      void formatSelectBackImage();
   13.13      void formatSelectLinkColor();
   13.14      void formatToggleLinkColorHint();
   13.15 -	void formatFrameNone();
   13.16 -	void formatFrameRectangle();
   13.17  	void formatIncludeImagesVer();
   13.18  	void formatIncludeImagesHor();
   13.19  	void formatHideLinkUnselected();
   13.20 @@ -174,6 +173,7 @@
   13.21  	bool useFlagGroups();
   13.22  
   13.23  private slots:
   13.24 +	void showPropertyDialog();
   13.25  	void windowNextEditor();
   13.26  	void windowPreviousEditor();
   13.27  	void windowShowNoteEditor();
   13.28 @@ -200,6 +200,8 @@
   13.29  
   13.30  	HistoryWindow *historyWindow;
   13.31  
   13.32 +	BranchPropertyWindow *branchPropertyWindow;
   13.33 +
   13.34  	QList <QAction*> actionListBranches;
   13.35  
   13.36  	QColor currentColor;
   13.37 @@ -263,8 +265,8 @@
   13.38  	QAction* actionModModeCopy;
   13.39  
   13.40  	QActionGroup *actionGroupFormatFrameTypes;
   13.41 -	QAction *actionFormatFrameNone;
   13.42 -	QAction *actionFormatFrameRectangle;
   13.43 +
   13.44 +	QAction *actionOpenPropertyDialog;
   13.45  
   13.46  	QActionGroup *actionGroupFormatLinkStyles;
   13.47  	QAction *actionFormatLinkStyleLine;
    14.1 --- a/mapcenterobj.cpp	Wed Jan 10 13:26:12 2007 +0000
    14.2 +++ b/mapcenterobj.cpp	Tue Jan 23 11:50:53 2007 +0000
    14.3 @@ -20,7 +20,7 @@
    14.4  
    14.5  MapCenterObj::~MapCenterObj() 
    14.6  {
    14.7 -    cout << "Destr MapCenterObj\n";
    14.8 +//    cout << "Destr MapCenterObj\n";
    14.9  }	
   14.10  
   14.11  void MapCenterObj::clear() 
   14.12 @@ -138,7 +138,6 @@
   14.13  
   14.14      s=beginElement ("mapcenter" 
   14.15  		+getOrnAttr() 
   14.16 -		+attribut("frameType",frame->getFrameTypeName()) 
   14.17  		+areaAttr 
   14.18  		+idAttr 
   14.19  		+getIncludeImageAttr() );
   14.20 @@ -151,7 +150,12 @@
   14.21  	// Save flags. If verbose is set (export to xml dir), also write
   14.22  	// the flags as picture
   14.23  	s+=standardFlags->saveToDir(tmpdir+"/flags", "/standardFlag-", verbose);
   14.24 -    s=s+valueElement("heading", getHeading(),a);
   14.25 +
   14.26 +	// Save heading
   14.27 +    s+=valueElement("heading", getHeading(),a);
   14.28 +
   14.29 +	// Save frame
   14.30 +	s+=frame->saveToDir ();
   14.31  
   14.32  	// add link to file in s
   14.33  	if (!note.isEmpty() )
    15.1 --- a/mapeditor.cpp	Wed Jan 10 13:26:12 2007 +0000
    15.2 +++ b/mapeditor.cpp	Tue Jan 23 11:50:53 2007 +0000
    15.3 @@ -1,8 +1,5 @@
    15.4  #include "mapeditor.h"
    15.5  
    15.6 -#include <q3dragobject.h>
    15.7 -#include <q3urloperator.h>
    15.8 -#include <q3networkprotocol.h>
    15.9  #include <q3filedialog.h>
   15.10  
   15.11  #include <iostream>
   15.12 @@ -51,13 +48,14 @@
   15.13  extern QString iconPath;
   15.14  extern QDir vymBaseDir;
   15.15  extern QDir lastImageDir;
   15.16 +extern QDir lastFileDir;
   15.17  
   15.18  int MapEditor::mapNum=0;	// make instance
   15.19  
   15.20  ///////////////////////////////////////////////////////////////////////
   15.21  ///////////////////////////////////////////////////////////////////////
   15.22  MapEditor::MapEditor( QWidget* parent) :
   15.23 -  QGraphicsView(parent), urlOperator(0), imageBuffer(0)
   15.24 +  QGraphicsView(parent)
   15.25  {
   15.26  	//cout << "Constructor ME "<<this<<endl;
   15.27  	mapNum++;
   15.28 @@ -102,6 +100,7 @@
   15.29      movingObj=NULL;
   15.30  
   15.31  	xelection.setMapCenter (mapCenter);
   15.32 +	xelection.clear();
   15.33  
   15.34  	defXLinkWidth=1;
   15.35  	defXLinkColor=QColor (230,230,230);
   15.36 @@ -141,12 +140,6 @@
   15.37  
   15.38  MapEditor::~MapEditor()
   15.39  {
   15.40 -  if (imageBuffer) delete imageBuffer;
   15.41 -  if (urlOperator) {
   15.42 -    urlOperator->stop();
   15.43 -    delete urlOperator;
   15.44 -  }
   15.45 -
   15.46  	//cout <<"Destructor MapEditor\n";
   15.47  }
   15.48  
   15.49 @@ -601,66 +594,59 @@
   15.50  		{	
   15.51  			deleteChilds();
   15.52  		}	
   15.53 -	} else if (com=="linkBranchToPos")
   15.54 -	{
   15.55 -		if (!selection)
   15.56 -		{
   15.57 -			api.setError (Aborted,"Nothing selected");
   15.58 -		} else if ( (typeid(*selection) != typeid(BranchObj) && 
   15.59 -					 typeid(*selection) != typeid(MapCenterObj)) )
   15.60 -		{				  
   15.61 -			api.setError (Aborted,"Type of selection is not a branch");
   15.62 -		} else if (api.checkParamCount(4))
   15.63 -		{
   15.64 -			// 0	selectstring of parent
   15.65 -			// 1	num in parent (for branches)
   15.66 -			// 2,3	x,y of mainbranch or mapcenter
   15.67 -			s=api.parString(ok,0);
   15.68 -			LinkableMapObj *dst=mapCenter->findObjBySelect (s);
   15.69 -			if (dst)
   15.70 -			{	
   15.71 -				if (typeid(*dst) == typeid(BranchObj) ) 
   15.72 -				{
   15.73 -					// Get number in parent
   15.74 -					x=api.parInt (ok,1);
   15.75 -					if (ok)
   15.76 -						((BranchObj*)selection)->moveBranchTo ((BranchObj*)(dst),x);
   15.77 -				} else if (typeid(*dst) == typeid(MapCenterObj) ) 
   15.78 -				{
   15.79 -					((BranchObj*)selection)->moveBranchTo ((BranchObj*)(dst),-1);
   15.80 -					// Get coordinates of mainbranch
   15.81 -					x=api.parInt (ok,2);
   15.82 -					if (ok)
   15.83 -					{
   15.84 -						y=api.parInt (ok,3);
   15.85 -						if (ok) ((BranchObj*)selection)->move (x,y);
   15.86 -					}
   15.87 -				}	
   15.88 -			}	
   15.89 -		}
   15.90  	} else if (com=="linkTo")
   15.91  	{
   15.92  		if (!selection)
   15.93  		{
   15.94  			api.setError (Aborted,"Nothing selected");
   15.95 -		} else if ( (typeid(*selection) != typeid(BranchObj) && 
   15.96 -					 typeid(*selection) != typeid(MapCenterObj) &&
   15.97 -					 typeid(*selection) != typeid(FloatImageObj)))
   15.98 -		{				  
   15.99 -			api.setError (Aborted,"Type of selection is not a floatimage");
  15.100 -		} else if (api.checkParamCount(1))
  15.101 +		} else if ( (typeid(*selection) == typeid(BranchObj) || 
  15.102 +					 typeid(*selection) == typeid(MapCenterObj)) )
  15.103  		{
  15.104 -			// 0	selectstring of parent
  15.105 -			s=api.parString(ok,0);
  15.106 -			LinkableMapObj *dst=mapCenter->findObjBySelect (s);
  15.107 -			if (dst)
  15.108 -			{	
  15.109 -				if (typeid(*dst) == typeid(BranchObj) ||
  15.110 -				    typeid(*dst) == typeid(MapCenterObj)) 
  15.111 -					linkTo (dst->getSelectString());
  15.112 -			} else	
  15.113 -				api.setError (Aborted,"Destination is not a branch");
  15.114 -		}
  15.115 +			if (api.checkParamCount(4))
  15.116 +			{
  15.117 +				// 0	selectstring of parent
  15.118 +				// 1	num in parent (for branches)
  15.119 +				// 2,3	x,y of mainbranch or mapcenter
  15.120 +				s=api.parString(ok,0);
  15.121 +				LinkableMapObj *dst=mapCenter->findObjBySelect (s);
  15.122 +				if (dst)
  15.123 +				{	
  15.124 +					if (typeid(*dst) == typeid(BranchObj) ) 
  15.125 +					{
  15.126 +						// Get number in parent
  15.127 +						x=api.parInt (ok,1);
  15.128 +						if (ok)
  15.129 +							((BranchObj*)selection)->linkTo ((BranchObj*)(dst),x);
  15.130 +					} else if (typeid(*dst) == typeid(MapCenterObj) ) 
  15.131 +					{
  15.132 +						((BranchObj*)selection)->linkTo ((BranchObj*)(dst),-1);
  15.133 +						// Get coordinates of mainbranch
  15.134 +						x=api.parInt (ok,2);
  15.135 +						if (ok)
  15.136 +						{
  15.137 +							y=api.parInt (ok,3);
  15.138 +							if (ok) ((BranchObj*)selection)->move (x,y);
  15.139 +						}
  15.140 +					}	
  15.141 +				}	
  15.142 +			}	
  15.143 +		} else if ( typeid(*selection) != typeid(FloatImageObj)) 
  15.144 +		{
  15.145 +			if (api.checkParamCount(1))
  15.146 +			{
  15.147 +				// 0	selectstring of parent
  15.148 +				s=api.parString(ok,0);
  15.149 +				LinkableMapObj *dst=mapCenter->findObjBySelect (s);
  15.150 +				if (dst)
  15.151 +				{	
  15.152 +					if (typeid(*dst) == typeid(BranchObj) ||
  15.153 +						typeid(*dst) == typeid(MapCenterObj)) 
  15.154 +						linkTo (dst->getSelectString());
  15.155 +				} else	
  15.156 +					api.setError (Aborted,"Destination is not a branch");
  15.157 +			}		
  15.158 +		} else
  15.159 +			api.setError (Aborted,"Type of selection is not a floatimage or branch");
  15.160  	} else if (com=="moveBranchUp")
  15.161  	{
  15.162  		if (!selection)
  15.163 @@ -892,9 +878,7 @@
  15.164  			}	
  15.165  		}
  15.166  	} else
  15.167 -	{
  15.168  		api.setError (Aborted,"Unknown command");
  15.169 -	}
  15.170  
  15.171  	// Any errors?
  15.172  	if (api.errorLevel()==NoError)
  15.173 @@ -1128,6 +1112,8 @@
  15.174  		printer->setOutputFileName(settings.value("/mainwindow/printerFileName",printer->outputFileName()).toString());
  15.175  	}
  15.176  
  15.177 +	// FIXME testing cout << "ME::print  printProgram="<<printer->printProgram().ascii()<<endl;
  15.178 +
  15.179  	QRectF totalBBox=mapCenter->getTotalBBox();
  15.180  
  15.181  	// Try to set orientation automagically
  15.182 @@ -1639,7 +1625,7 @@
  15.183  										handler.errorProtocol());
  15.184  			}
  15.185  			if (selection!=mapCenter)
  15.186 -				((BranchObj*)selection)->getLastBranch()->moveBranchTo ((BranchObj*)(selection),pos);
  15.187 +				((BranchObj*)selection)->getLastBranch()->linkTo ((BranchObj*)(selection),pos);
  15.188  		} else	
  15.189  			QMessageBox::critical( 0, tr( "Critical Error" ), tr("Could not read %1").arg(path));
  15.190  	}		
  15.191 @@ -1795,7 +1781,6 @@
  15.192  		  typeid(*selection) == typeid(MapCenterObj) ) ) 
  15.193  	{
  15.194  		ok=true;
  15.195 -		ensureSelectionVisible();
  15.196  		p=mapFromScene(selection->getAbsPos());
  15.197  		return ((BranchObj*)selection)->getHeading();
  15.198  	}
  15.199 @@ -1908,6 +1893,8 @@
  15.200  		 (typeid(*selection) == typeid(BranchObj) || 
  15.201  		  typeid(*selection) == typeid(MapCenterObj) ) ) 
  15.202  	{
  15.203 +		setCursor (Qt::ArrowCursor);
  15.204 +
  15.205  		newbo=addNewBranchInt (pos-2);
  15.206  
  15.207  		if (newbo)
  15.208 @@ -1946,7 +1933,7 @@
  15.209  			newbo->move2RelPos (p);
  15.210  
  15.211  			// Move selection to new branch
  15.212 -			((BranchObj*)selection)->moveBranchTo (newbo,-1);
  15.213 +			((BranchObj*)selection)->linkTo (newbo,-1);
  15.214  
  15.215  			saveState (newbo, "deleteKeepChilds ()", newbo, "addBranchBefore ()", 
  15.216  				QString ("Add branch before %1").arg(getName(bo)));
  15.217 @@ -1990,6 +1977,7 @@
  15.218  		ensureSelectionVisible();
  15.219  		mapCenter->reposition();
  15.220  	}
  15.221 +	mapScene->update();
  15.222  }
  15.223  
  15.224  LinkableMapObj* MapEditor::getSelection()
  15.225 @@ -3197,7 +3185,7 @@
  15.226  	}
  15.227  }
  15.228  
  15.229 -void MapEditor::setFrame(const FrameType &t)
  15.230 +void MapEditor::setFrame(const FrameType &t)	// FIXME missing saveState
  15.231  {
  15.232  	if (selection && 
  15.233  		(typeid(*selection) == typeid(BranchObj)) || 
  15.234 @@ -3209,7 +3197,7 @@
  15.235  	}
  15.236  }
  15.237  
  15.238 -void MapEditor::setIncludeImagesVer(bool b)
  15.239 +void MapEditor::setIncludeImagesVer(bool b)	// FIXME missing saveState
  15.240  {
  15.241  	if (selection && 
  15.242  		(typeid(*selection) == typeid(BranchObj)) || 
  15.243 @@ -3218,7 +3206,7 @@
  15.244  		mapCenter->reposition();
  15.245  }
  15.246  
  15.247 -void MapEditor::setIncludeImagesHor(bool b)
  15.248 +void MapEditor::setIncludeImagesHor(bool b)	// FIXME missing saveState
  15.249  {
  15.250  	if (selection && 
  15.251  		(typeid(*selection) == typeid(BranchObj)) || 
  15.252 @@ -3227,7 +3215,7 @@
  15.253  		mapCenter->reposition();
  15.254  }
  15.255  
  15.256 -void MapEditor::setHideLinkUnselected (bool b)
  15.257 +void MapEditor::setHideLinkUnselected (bool b)	// FIXME missing saveState
  15.258  {
  15.259  	if (selection && 
  15.260  		(typeid(*selection) == typeid(BranchObj)) || 
  15.261 @@ -3236,7 +3224,7 @@
  15.262  		selection->setHideLinkUnselected(b);
  15.263  }
  15.264  
  15.265 -void MapEditor::importDirInt(BranchObj *dst, QDir d)
  15.266 +void MapEditor::importDirInt(BranchObj *dst, QDir d)	// FIXME missing saveState
  15.267  {
  15.268  	if (selection && 
  15.269  		(typeid(*selection) == typeid(BranchObj)) || 
  15.270 @@ -3328,7 +3316,7 @@
  15.271  	}
  15.272  }
  15.273  
  15.274 -void MapEditor::editXLink(int i)
  15.275 +void MapEditor::editXLink(int i)	// FIXME missing saveState
  15.276  {
  15.277  	if (selection && 
  15.278  		(typeid(*selection) == typeid(BranchObj)) || 
  15.279 @@ -3349,7 +3337,6 @@
  15.280  				}
  15.281  				if (dia.deleteXLink())
  15.282  					((BranchObj*)selection)->deleteXLinkAt(i);
  15.283 -				//saveStateComplete("Edit xLink");	//FIXME editXLink undoCommand
  15.284  			}
  15.285  		}	
  15.286  	}
  15.287 @@ -3357,6 +3344,8 @@
  15.288  
  15.289  void MapEditor::testFunction()
  15.290  {
  15.291 +	// This is the playground
  15.292 +
  15.293  	WarningDialog dia;
  15.294  	dia.showCancelButton (true);
  15.295  	dia.setText("This is a longer \nWarning");
  15.296 @@ -3402,13 +3391,7 @@
  15.297  	if (selection)
  15.298  	{
  15.299  		LinkableMapObj* lmo= dynamic_cast <LinkableMapObj*> (selection);
  15.300 -		QPointF p;
  15.301 -		if (selection->getOrientation() == OrientLeftOfCenter)
  15.302 -			p= matrix().map(QPointF (lmo->x(),lmo->y()));
  15.303 -		else   
  15.304 -			p= matrix().map(QPointF (lmo->x()+lmo->width(),lmo->y()+lmo->height()));
  15.305 -		ensureVisible (QRectF(p.x(), p.y(),0,0 ));
  15.306 -
  15.307 +		ensureVisible (lmo->getBBox());
  15.308  	}
  15.309  
  15.310  }
  15.311 @@ -3589,7 +3572,8 @@
  15.312  					selection->select();
  15.313  					mapCenter->reposition();
  15.314  				}
  15.315 -			}	
  15.316 +			} 
  15.317 +
  15.318  			movingObj=selection;	
  15.319  		} else
  15.320  			// Middle Button    Toggle Scroll
  15.321 @@ -3621,6 +3605,10 @@
  15.322      // Move the selected MapObj
  15.323      if ( selection && movingObj) 
  15.324      {	
  15.325 +		// reset cursor if we are moving and don't copy
  15.326 +		if (mainWindow->getModMode()!=ModModeCopy)
  15.327 +			setCursor (Qt::ArrowCursor);
  15.328 +
  15.329  		// To avoid jumping of the sceneView, only 
  15.330  		// ensureSelectionVisible, if not tmp linked
  15.331  		if (!selection->hasParObjTmp())
  15.332 @@ -3854,27 +3842,27 @@
  15.333  				if (e->state() & Qt::ShiftModifier && dst->getParObj())
  15.334  				{	// Link above dst
  15.335  					preDstParStr=dst->getParObj()->getSelectString();
  15.336 -					bsel->moveBranchTo ( (BranchObj*)(bdst->getParObj()), bdst->getNum());
  15.337 +					bsel->linkTo ( (BranchObj*)(bdst->getParObj()), bdst->getNum());
  15.338  				} else 
  15.339  				if (e->state() & Qt::ControlModifier && dst->getParObj())
  15.340  				{
  15.341  					// Link below dst
  15.342  					preDstParStr=dst->getParObj()->getSelectString();
  15.343 -					bsel->moveBranchTo ( (BranchObj*)(bdst->getParObj()), bdst->getNum()+1);
  15.344 +					bsel->linkTo ( (BranchObj*)(bdst->getParObj()), bdst->getNum()+1);
  15.345  				} else	
  15.346  				{	// Append to dst
  15.347  					preDstParStr=dst->getSelectString();
  15.348 -					bsel->moveBranchTo (bdst,-1);
  15.349 +					bsel->linkTo (bdst,-1);
  15.350  					if (dst->getDepth()==0) bsel->move (savePos);
  15.351  				} 
  15.352  				QString postSelStr=selection->getSelectString();
  15.353  				QString postNum=QString::number (bsel->getNum(),10);
  15.354  
  15.355 -				QString undoCom="linkBranchToPos (\""+ 
  15.356 +				QString undoCom="linkTo (\""+ 
  15.357  					preParStr+ "\"," + preNum  +"," + 
  15.358  					QString ("%1,%2").arg(movingObj_orgPos.x()).arg(movingObj_orgPos.y())+ ")";
  15.359  
  15.360 -				QString redoCom="linkBranchToPos (\""+ 
  15.361 +				QString redoCom="linkTo (\""+ 
  15.362  					preDstParStr + "\"," + postNum + "," +
  15.363  					QString ("%1,%2").arg(savePos.x()).arg(savePos.y())+ ")";
  15.364  
    16.1 --- a/mapeditor.h	Wed Jan 10 13:26:12 2007 +0000
    16.2 +++ b/mapeditor.h	Tue Jan 23 11:50:53 2007 +0000
    16.3 @@ -10,8 +10,6 @@
    16.4  #include "selection.h"
    16.5  #include "settings.h"
    16.6  
    16.7 -class Q3NetworkOperation;
    16.8 -class Q3UrlOperator;
    16.9  
   16.10  class MapEditor : public QGraphicsView, public xmlObj {
   16.11      Q_OBJECT
   16.12 @@ -37,13 +35,6 @@
   16.13  private:
   16.14      void addFloatImageInt(const QPixmap &img);
   16.15  
   16.16 -/*
   16.17 -  private slots:
   16.18 -    void fetchImage(const QString &img);
   16.19 -    void imageDataFetched(const QByteArray &, Q3NetworkOperation *);
   16.20 -    void imageDataFinished(Q3NetworkOperation *);
   16.21 -	*/
   16.22 -
   16.23  public:
   16.24  	bool isDefault();		// false, if map was changed once
   16.25      bool isUnsaved();		// save necessary
   16.26 @@ -222,7 +213,7 @@
   16.27  	bool copyingObj;			// true while creating a link
   16.28  	XLinkObj* tmpXLink;
   16.29  
   16.30 -	Selection xelection;
   16.31 +	Selection xelection;			// FIXME  not used (yet)
   16.32      LinkableMapObj* selection;		// select a LinkableMapObj
   16.33      LinkableMapObj* selectionLast;	// last selection 
   16.34      MapObj* movingObj;				// moving a MapObj
   16.35 @@ -263,10 +254,6 @@
   16.36  	HideTmpMode hidemode;			// true while exporting to hide some stuff
   16.37  	
   16.38      void resizeEvent( QResizeEvent * );
   16.39 -
   16.40 -	Q3UrlOperator *urlOperator;
   16.41 -	QDataStream *imageData;
   16.42 -	QBuffer *imageBuffer;
   16.43  };
   16.44  #endif
   16.45  
    17.1 --- a/selection.cpp	Wed Jan 10 13:26:12 2007 +0000
    17.2 +++ b/selection.cpp	Tue Jan 23 11:50:53 2007 +0000
    17.3 @@ -18,21 +18,23 @@
    17.4  {
    17.5  	mapCenter=other.mapCenter;
    17.6  	selectList=other.selectList;
    17.7 +	lastSelectList=other.lastSelectList;
    17.8  }
    17.9  
   17.10  void Selection::clear()
   17.11  {
   17.12  	selectList.clear();
   17.13 +	lastSelectList.clear();
   17.14  }
   17.15  
   17.16 -bool Selection::select(LinkableMapObj *lmo)
   17.17 +bool Selection::select(LinkableMapObj *lmo)	// TODO no multiselections yet
   17.18  {
   17.19  	clear();
   17.20  	selectList.append (lmo);
   17.21  	return false;
   17.22  }
   17.23  
   17.24 -bool Selection::select (const QString &s)
   17.25 +bool Selection::select (const QString &s)	// TODO no multiselections yet
   17.26  {
   17.27  	LinkableMapObj *lmo=mapCenter->findObjBySelect(s);
   17.28  
   17.29 @@ -47,9 +49,21 @@
   17.30  
   17.31  }
   17.32  
   17.33 +bool Selection::reselect ()	// TODO no multiselections yet
   17.34 +{
   17.35 +	if (!lastSelectList.isEmpty())
   17.36 +	{
   17.37 +		select (lastSelectList.first());
   17.38 +		return true;
   17.39 +	}
   17.40 +	return false;
   17.41 +
   17.42 +}
   17.43 +
   17.44  void Selection::unselect()
   17.45  {
   17.46 -	clear();
   17.47 +	lastSelectList=selectList;
   17.48 +	selectList.clear();
   17.49  }
   17.50  
   17.51  bool Selection::isEmpty()
   17.52 @@ -62,9 +76,20 @@
   17.53  	return selectList.count();
   17.54  }
   17.55  
   17.56 -QString Selection::getSelectString()
   17.57 +SelectionType Selection::type() // TODO no multiselections yet
   17.58  {
   17.59 -	// TODO multiselection (maybe separated by ";")
   17.60 +	if (!selectList.isEmpty())
   17.61 +	{
   17.62 +		LinkableMapObj *sel=selectList.first();
   17.63 +		if (typeid (*sel)==typeid (BranchObj)) return Branch;
   17.64 +		if (typeid (*sel)==typeid (MapCenterObj)) return MapCenter;
   17.65 +		if (typeid (*sel)==typeid (FloatImageObj)) return FloatImage;
   17.66 +	}
   17.67 +	return Undefined;
   17.68 +}
   17.69 +
   17.70 +QString Selection::getSelectString()// TODO no multiselections yet
   17.71 +{
   17.72  	if (selectList.count()==1)
   17.73  		return selectList.first()->getSelectString();
   17.74  	else
    18.1 --- a/selection.h	Wed Jan 10 13:26:12 2007 +0000
    18.2 +++ b/selection.h	Tue Jan 23 11:50:53 2007 +0000
    18.3 @@ -4,6 +4,8 @@
    18.4  #include "linkablemapobj.h"
    18.5  #include "mapcenterobj.h"
    18.6  
    18.7 +enum SelectionType {Undefined,Branch,MapCenter,FloatImage};
    18.8 +
    18.9  class Selection 
   18.10  {
   18.11  public:
   18.12 @@ -15,15 +17,18 @@
   18.13  	
   18.14  	bool select (LinkableMapObj*);
   18.15  	bool select (const QString &);
   18.16 +	bool reselect ();
   18.17  	void unselect ();
   18.18  	bool isEmpty();
   18.19  	uint count();
   18.20 +	SelectionType type();
   18.21  
   18.22  	QString getSelectString();
   18.23  
   18.24  private:
   18.25  	void init();
   18.26  	QList <LinkableMapObj*> selectList;
   18.27 +	QList <LinkableMapObj*> lastSelectList;
   18.28  	MapCenterObj *mapCenter;
   18.29  };
   18.30  #endif
    19.1 --- a/xml.cpp	Wed Jan 10 13:26:12 2007 +0000
    19.2 +++ b/xml.cpp	Tue Jan 23 11:50:53 2007 +0000
    19.3 @@ -28,6 +28,8 @@
    19.4      errorProt = "";
    19.5      state = StateInit;
    19.6      laststate = StateInit;
    19.7 +	stateStack.clear();
    19.8 +	stateStack.append(StateInit);
    19.9      branchDepth=0;
   19.10  	htmldata="";
   19.11  	isVymPart=false;
   19.12 @@ -52,9 +54,10 @@
   19.13  	/* Testing
   19.14  	cout << "startElement <"<< eName.ascii()<<
   19.15  		">  state="<<state <<
   19.16 -		"  laststate="<<laststate<<
   19.17 +		"  laststate="<<stateStack.last()<<
   19.18  		"   loadMode="<<loadMode<<endl;
   19.19  	*/	
   19.20 +	stateStack.append (state);	
   19.21      if ( state == StateInit && (eName == "vymmap")  ) 
   19.22  	{
   19.23          state = StateMap;
   19.24 @@ -148,28 +151,33 @@
   19.25  				return false;
   19.26  		}
   19.27  		readBranchAttr (atts);
   19.28 -	} else if ( (eName == "standardflag" ||eName == "standardFlag") && state == StateMapCenter) 
   19.29 +	} else if ( 
   19.30 +		(eName == "standardflag" ||eName == "standardFlag") && 
   19.31 +		(state == StateMapCenter || state==StateBranch)) 
   19.32  	{
   19.33 -		state=StateMapCenterStandardFlag;
   19.34 -	} else if ( eName == "heading" && state == StateMapCenter) 
   19.35 +		state=StateStandardFlag;
   19.36 +	} else if ( eName == "heading" && (state == StateMapCenter||state==StateBranch)) 
   19.37  	{
   19.38 -		state=StateMapCenterHeading;
   19.39 +		laststate=state;
   19.40 +		state=StateHeading;
   19.41  		if (!atts.value( "textColor").isEmpty() ) 
   19.42  		{
   19.43  			col.setNamedColor(atts.value("textColor"));
   19.44  			lastBranch->setColor(col );
   19.45  		}	    
   19.46 -	} else if ( eName == "note" && state == StateMapCenter) 
   19.47 +	} else if ( eName == "note" && 
   19.48 +				(state == StateMapCenter ||state==StateBranch))
   19.49  	{	// only for backward compatibility (<1.4.6). Use htmlnote now.
   19.50 -		state=StateMapCenterNote;
   19.51 +		state=StateNote;
   19.52  		if (!readNoteAttr (atts) ) return false;
   19.53  	} else if ( eName == "htmlnote" && state == StateMapCenter) 
   19.54  	{
   19.55  		laststate=state;
   19.56  		state=StateHtmlNote;
   19.57 -    } else if ( eName == "floatimage" && state == StateMapCenter ) 
   19.58 +    } else if ( eName == "floatimage" && 
   19.59 +				(state == StateMapCenter ||state==StateBranch)) 
   19.60  	{
   19.61 -		state=StateMapCenterFloatImage;
   19.62 +		state=StateFloatImage;
   19.63          lastBranch->addFloatImage();
   19.64  		lastFloat=lastBranch->getLastFloatImage();
   19.65  		if (!readFloatImageAttr(atts)) return false;
   19.66 @@ -217,21 +225,6 @@
   19.67  		lastBranch->addBranch();
   19.68  		lastBranch=lastBranch->getLastBranch();
   19.69  		readBranchAttr (atts);
   19.70 -	} else if ( (eName=="standardflag" ||eName == "standardFlag") && state == StateBranch) 
   19.71 -	{
   19.72 -		state=StateBranchStandardFlag;
   19.73 -	} else if ( eName == "heading" && state == StateBranch) 
   19.74 -	{
   19.75 -		state=StateBranchHeading;
   19.76 -		if (!atts.value( "textColor").isEmpty() ) 
   19.77 -		{
   19.78 -			col.setNamedColor(atts.value("textColor"));
   19.79 -			lastBranch->setColor(col );
   19.80 -		}	    
   19.81 -    } else if ( eName == "note" && state == StateBranch) 
   19.82 -	{
   19.83 -        state=StateBranchNote;
   19.84 -		if (!readNoteAttr (atts) ) return false;
   19.85  	} else if ( eName == "htmlnote" && state == StateBranch) 
   19.86  	{
   19.87  		laststate=state;
   19.88 @@ -239,12 +232,11 @@
   19.89  		no.clear();
   19.90  		if (!atts.value( "fonthint").isEmpty() ) 
   19.91  			no.setFontHint(atts.value ("fonthint") );
   19.92 -    } else if ( eName == "floatimage" && state == StateBranch ) 
   19.93 +	} else if ( eName == "frame" && (state == StateBranch||state==StateMapCenter)) 
   19.94  	{
   19.95 -		state=StateBranchFloatImage;
   19.96 -        lastBranch->addFloatImage();
   19.97 -		lastFloat=lastBranch->getLastFloatImage();
   19.98 -		if (!readFloatImageAttr(atts)) return false;
   19.99 +		laststate=state;
  19.100 +		state=StateFrame;
  19.101 +		if (!readFrameAttr(atts)) return false;
  19.102      } else if ( eName == "xlink" && state == StateBranch ) 
  19.103  	{
  19.104  		state=StateBranchXLink;
  19.105 @@ -274,38 +266,18 @@
  19.106  
  19.107  bool mapBuilderHandler::endElement  ( const QString&, const QString&, const QString &eName)
  19.108  {
  19.109 -//	cout << "endElement </"<<eName<<">  state="<<state <<"  laststate="<<laststate<<endl;
  19.110 +	/* Testing
  19.111 +	cout << "endElement </" <<eName.ascii()
  19.112 +		<<">  state=" <<state 
  19.113 +		<<"  laststate=" <<laststate
  19.114 +		<<"  stateStack="<<stateStack.last() 
  19.115 +		<<endl;
  19.116 +	*/
  19.117      switch ( state ) 
  19.118  	{
  19.119 -        case StateMapSelect: state=StateMap;  return true;
  19.120 -        case StateMapSetting: state=StateMap;  return true;
  19.121 -        case StateMapCenter: state=StateMap;  return true;
  19.122 -        case StateMapCenterStandardFlag: state=StateMapCenter;  return true;
  19.123 -        case StateMapCenterHeading: state=StateMapCenter;  return true;
  19.124 -        case StateMapCenterNote: state=StateMapCenter;  return true;
  19.125 -        case StateMapCenterFloatImage: state=StateMapCenter;  return true;
  19.126 -        case StateFloatImage: state=StateMap; return true;
  19.127          case StateBranch: 
  19.128 -            if (branchDepth>1) 
  19.129 -			{
  19.130 -                branchDepth--;
  19.131 -                state=StateBranch;
  19.132 -            } else  
  19.133 -			{
  19.134 -                branchDepth=0;
  19.135 -				if (isVymPart)
  19.136 -					state=StateMap;
  19.137 -				else
  19.138 -					state=StateMapCenter;
  19.139 -            }   
  19.140  			lastBranch=(BranchObj*)(lastBranch->getParObj());
  19.141 -             return true;
  19.142 -        case StateBranchStandardFlag: state=StateBranch;  return true;
  19.143 -        case StateBranchHeading: state=StateBranch;  return true;
  19.144 -        case StateBranchNote: state=StateBranch; return true;
  19.145 -        case StateBranchFloatImage: state=StateBranch;  return true;
  19.146 -        case StateBranchXLink: state=StateBranch;  return true;
  19.147 -        case StateHtmlNote: state=laststate; return true;
  19.148 +            break;
  19.149          case StateHtml: 
  19.150  			htmldata+="</"+eName+">";
  19.151  			if (eName=="html")
  19.152 @@ -314,16 +286,13 @@
  19.153  				htmldata.replace ("<br></br>","<br />");
  19.154  				no.setNote (htmldata);
  19.155  				lastBranch->setNote (no);
  19.156 -				return true;
  19.157 -			}	else
  19.158 -			{
  19.159 -				return true;
  19.160  			}	
  19.161 -        case StateMap: state=StateInit;  return true;
  19.162 -        default : 
  19.163 -			// even for HTML includes, this should never be reached
  19.164 -			return false;
  19.165 -    }   
  19.166 +			break;
  19.167 +		default: 
  19.168 +			break;
  19.169 +    }  
  19.170 +	state=stateStack.takeLast();	
  19.171 +	return true;
  19.172  }
  19.173  
  19.174  bool mapBuilderHandler::characters   ( const QString& ch)
  19.175 @@ -343,30 +312,21 @@
  19.176  			break;
  19.177  		case StateMapSetting:break;
  19.178          case StateMapCenter: break;
  19.179 -        case StateMapCenterStandardFlag: 
  19.180 -            lastBranch->activateStandardFlag(ch_simplified); 
  19.181 -            break;
  19.182 -        case StateMapCenterHeading: 
  19.183 -            lastBranch->setHeading(ch_simplified); 
  19.184 -            break;
  19.185 -        case StateMapCenterNote:
  19.186 +        case StateNote:
  19.187  			lastBranch->setNote(ch_simplified);
  19.188  			break;
  19.189          case StateBranch: break;
  19.190 -        case StateBranchStandardFlag: 
  19.191 +        case StateStandardFlag: 
  19.192              lastBranch->activateStandardFlag(ch_simplified); 
  19.193              break;
  19.194 -        case StateBranchHeading: 
  19.195 -            lastBranch->setHeading(ch_simplified);
  19.196 -            break;
  19.197 -        case StateBranchNote: 
  19.198 -			lastBranch->setNote(ch_simplified);
  19.199 -			break;
  19.200 -        case StateBranchFloatImage: break;
  19.201 +        case StateFloatImage: break;
  19.202          case StateHtmlNote: break;
  19.203          case StateHtml:
  19.204  			htmldata+=ch_org;
  19.205  			break;
  19.206 +        case StateHeading: 
  19.207 +            lastBranch->setHeading(ch_simplified);
  19.208 +            break;
  19.209          default: 
  19.210  			return false;
  19.211      }
  19.212 @@ -452,6 +412,16 @@
  19.213  	return true;	
  19.214  }
  19.215  
  19.216 +bool mapBuilderHandler::readFrameAttr (const QXmlAttributes& a)
  19.217 +{
  19.218 +	if (lastOO)
  19.219 +	{
  19.220 +		if (!a.value( "frameType").isEmpty() ) 
  19.221 +			lastOO->setFrameType (a.value("frameType"));
  19.222 +	}		
  19.223 +	return true;
  19.224 +}
  19.225 +
  19.226  bool mapBuilderHandler::readOOAttr (const QXmlAttributes& a)
  19.227  {
  19.228  	if (lastOO)
  19.229 @@ -532,10 +502,7 @@
  19.230  	}		
  19.231  	if (!a.value( "fonthint").isEmpty() ) 
  19.232  		no.setFontHint(a.value ("fonthint") );
  19.233 -	if (state == StateMapCenterNote) 	
  19.234 -		mc->setNote(no);
  19.235 -	else
  19.236 -		lastBranch->setNote(no);
  19.237 +	lastBranch->setNote(no);
  19.238  	return true;
  19.239  }
  19.240  
    20.1 --- a/xml.h	Wed Jan 10 13:26:12 2007 +0000
    20.2 +++ b/xml.h	Tue Jan 23 11:50:53 2007 +0000
    20.3 @@ -29,6 +29,7 @@
    20.4  	void setInputFile (QString);
    20.5  	void setLoadMode (const LoadMode &);
    20.6  	bool readBranchAttr (const QXmlAttributes&);
    20.7 +	bool readFrameAttr (const QXmlAttributes&);
    20.8  	bool readOOAttr (const QXmlAttributes&);
    20.9  	bool readNoteAttr (const QXmlAttributes&);
   20.10  	bool readFloatImageAttr (const QXmlAttributes&);
   20.11 @@ -40,17 +41,20 @@
   20.12  	QString     errorProt;
   20.13  	enum State 
   20.14  	{ 
   20.15 -		StateInit, StateMap, StateMapSelect, 
   20.16 +		StateInit, 
   20.17 +		StateMap, 
   20.18 +		StateMapSelect, 
   20.19  		StateMapSetting,
   20.20 +		StateMapCenter, 
   20.21 +		StateBranch, 
   20.22 +		StateBranchXLink,			//
   20.23 +		StateHtmlNote, 
   20.24 +		StateHtml, 
   20.25 +		StateFrame,
   20.26 +		StateStandardFlag,
   20.27 +		StateNote,
   20.28  		StateFloatImage,
   20.29 -		StateMapCenter, StateMapCenterStandardFlag,
   20.30 -		StateMapCenterHeading, StateMapCenterNote, 
   20.31 -		StateMapCenterFloatImage,
   20.32 -		
   20.33 -		StateBranch, StateBranchStandardFlag,
   20.34 -		StateBranchHeading, StateBranchNote, 
   20.35 -		StateBranchFloatImage, StateBranchXLink,
   20.36 -		StateHtmlNote, StateHtml 
   20.37 +		StateHeading
   20.38  	 };
   20.39  				 
   20.40  
   20.41 @@ -58,6 +62,7 @@
   20.42  	bool isVymPart;
   20.43  	State state;			 
   20.44  	State laststate;
   20.45 +	QList <State> stateStack;
   20.46  	QString htmldata;
   20.47  	int branchDepth; 
   20.48  	NoteObj no;