# HG changeset patch
# User insilmaril
# Date 1177516974 0
# Node ID 494a5b8c131e42fec5da28c8ba90cd446a11f423
# Parent  b0d72eb511c9138ad9bd7a1890d5d5753cd87f8d
started doxygen documentation

diff -r b0d72eb511c9 -r 494a5b8c131e branchobj.cpp
--- a/branchobj.cpp	Wed Apr 25 16:02:54 2007 +0000
+++ b/branchobj.cpp	Wed Apr 25 16:02:54 2007 +0000
@@ -16,11 +16,6 @@
 BranchObj* BranchObj::itFirst=NULL;
 
 
-HeadingObj* BranchObj::getHO()  //FIXME testing only
-{
-	return heading;
-}
-
 BranchObj::BranchObj () :OrnamentedObj()
 {
 //    cout << "Const BranchObj ()\n";
@@ -232,7 +227,7 @@
 				// Don't try to find that branch, guess 12 pixels
 				y=o->getChildPos().y()  -height() + 12; 
 		}	
-		if (o->getOrientation()==OrientLeftOfCenter)
+		if (o->getOrientation()==LinkableMapObj::LeftOfCenter)
 			move ( o->getChildPos().x() - linkwidth, y );
 		else	
 			move (o->getChildPos().x() + linkwidth, y );
@@ -627,7 +622,7 @@
 				}		
 				if (includeImagesHor)
 				{
-					if (orientation==OrientRightOfCenter)
+					if (orientation==LinkableMapObj::RightOfCenter)
 					{
 						if (-rp.x()-w > 0) 
 							leftPad=max (leftPad,-rp.x()-w);
@@ -648,8 +643,8 @@
 	}
 
 	// Frame thickness
-    w+=frame->getBorder();
-    h+=frame->getBorder();
+    w+=frame->getPadding();
+    h+=frame->getPadding();
 	
 	// Finally set size
     bbox.setSize (QSizeF (w,h));
@@ -658,7 +653,7 @@
 void BranchObj::setDockPos()
 {
 	// Sets childpos and parpos depending on orientation
-	if (getOrientation()==OrientLeftOfCenter )
+	if (getOrientation()==LinkableMapObj::LeftOfCenter )
     {
 		childPos=QPointF (
 			ornamentsBBox.bottomLeft().x(), 
@@ -791,7 +786,7 @@
 		attribut ("textColor",QColor(heading->getColor()).name()));
 
 	// Save frame
-	if (frame->getFrameType()!=NoFrame) 
+	if (frame->getFrameType()!=FrameObj::NoFrame) 
 		s+=frame->saveToDir ();
 
 	// save names of flags set
@@ -1288,14 +1283,14 @@
     {
 		// Align myself depending on orientation and parent, but
 		// only if I am not a mainbranch or mapcenter itself
-		LinkOrient o;
+		LinkableMapObj::Orientation o;
 		o=parObj->getOrientation();
 		switch (orientation) 
 		{
-			case OrientLeftOfCenter:
+			case LinkableMapObj::LeftOfCenter:
 				move (ref.x() - bbox.width(), ref.y() + (th-bbox.height())/2 );
 			break;
-			case OrientRightOfCenter:	
+			case LinkableMapObj::RightOfCenter:	
 				move (ref.x() , ref.y() + (th-bbox.height())/2  );
 			break;
 			default:
@@ -1308,7 +1303,7 @@
 
     // Set reference point for alignment of childs
     QPointF ref2;
-    if (orientation==OrientLeftOfCenter)
+    if (orientation==LinkableMapObj::LeftOfCenter)
 		ref2.setX(bbox.topLeft().x() - linkwidth);
     else	
 		ref2.setX(bbox.topRight().x() + linkwidth);
@@ -1526,3 +1521,10 @@
 	return s;
 }
 
+
+void BranchObj::animate()
+{
+	//relPos.animate();
+	cout << "BO::animate  x,y="<<relPos.x()<<","<<relPos.y()<<endl;
+}
+
diff -r b0d72eb511c9 -r 494a5b8c131e branchobj.h
--- a/branchobj.h	Wed Apr 25 16:02:54 2007 +0000
+++ b/branchobj.h	Wed Apr 25 16:02:54 2007 +0000
@@ -7,15 +7,19 @@
 #include "xlinkobj.h"
 
 
-enum BranchModification {NewBranch, MovedBranch};
-enum HideTmpMode {HideNone, HideExport};
+bool isAbove(BranchObj*,BranchObj*);
 
-bool isAbove(BranchObj*,BranchObj*);
+/*! \brief A branch visible in the map */
 
 /////////////////////////////////////////////////////////////////////////////
 class BranchObj:public OrnamentedObj {
 public:
-	HeadingObj* getHO();	//FIXME testing
+	/*! New branches will get use same color for heading as parent */
+	enum BranchModification {NewBranch, MovedBranch};
+
+	/*! If HideExport is used, this branch and its childs will be hidden in export */
+	enum HideTmpMode {HideNone, HideExport};
+
     BranchObj ();
     BranchObj (QGraphicsScene*);
     BranchObj (QGraphicsScene*, LinkableMapObj* parent);
@@ -119,6 +123,7 @@
     virtual void select();
     virtual void unselect();
 	virtual QString getSelectString();
+	virtual void animate();
 
 protected:
 	static BranchObj* itLast;		// iterator for first(), next()
diff -r b0d72eb511c9 -r 494a5b8c131e branchpropwindow.cpp
--- a/branchpropwindow.cpp	Wed Apr 25 16:02:54 2007 +0000
+++ b/branchpropwindow.cpp	Wed Apr 25 16:02:54 2007 +0000
@@ -3,7 +3,9 @@
 #include <QColorDialog>
 
 #include "frameobj.h"
+#include "settings.h"
 
+extern Settings settings;
 
 BranchPropertyWindow::BranchPropertyWindow (QWidget *parent):QDialog(parent)
 {
@@ -20,36 +22,33 @@
     pix.fill (penColor);
 	ui.framePenColorButton->setPixmap (pix);
 	ui.frameBrushColorButton->setPixmap (pix);
+}
 
-	connect ( 
-		ui.framePenColorButton, SIGNAL (clicked()), 
-		this, SLOT (framePenColorClicked()));
-	connect ( 
-		ui.frameBrushColorButton, SIGNAL (clicked()), 
-		this, SLOT (frameBrushColorClicked()));
-	connect ( 
-		ui.frameTypeCombo, SIGNAL (currentIndexChanged( int)), 
-		this, SLOT (frameTypeChanged (int)));
-	connect ( 
-		ui.hideLinkIfUnselected, SIGNAL (stateChanged( int)), 
-		this, SLOT (linkHideUnselectedChanged (int)));
+BranchPropertyWindow::~BranchPropertyWindow ()
+{
+	settings.setValue( "/branchpropertywindow/geometry/size", size() );
+	settings.setValue( "/branchpropertywindow/geometry/pos", pos() );
+	//settings.setValue( "/branchpropertywindow/showWithMain",showWithMain());	//FIXME add this!
 }
 
 void BranchPropertyWindow::setBranch (BranchObj *bo)
 {
+	disconnectSignals();
 	branch=bo;
 	if (bo) 
 	{
 		ui.tabWidget->setEnabled (true);
 
 		// Frame
-		FrameType t=branch->getFrameType();
-		if (t==NoFrame)
+		FrameObj::FrameType t=branch->getFrameType();
+		if (t==FrameObj::NoFrame)
 		{
 			ui.frameTypeCombo->setCurrentIndex (0);
 			penColor=Qt::white;
 			brushColor=Qt::white;
 			ui.colorGroupBox->setEnabled (false);
+			ui.framePaddingSpinBox->setEnabled (false);
+			ui.frameWidthSpinBox->setEnabled (false);
 		} else	
 		{
 			penColor=bo->getFramePenColor();
@@ -60,13 +59,17 @@
 			pix.fill (brushColor);
 			ui.frameBrushColorButton->setPixmap (pix);
 			ui.colorGroupBox->setEnabled (true);
+			ui.framePaddingSpinBox->setEnabled (true);
+			ui.framePaddingSpinBox->setValue (bo->getFramePadding());
+			ui.frameWidthSpinBox->setEnabled (true);
+			ui.frameWidthSpinBox->setValue (bo->getFrameBorderWidth());
 
 			switch (t)
 			{
-				case Rectangle: 
+				case FrameObj::Rectangle: 
 					ui.frameTypeCombo->setCurrentIndex (1);
 					break;
-				case Ellipse: 
+				case FrameObj::Ellipse: 
 					ui.frameTypeCombo->setCurrentIndex (2);
 					break;
 				default: 
@@ -79,6 +82,19 @@
 			ui.hideLinkIfUnselected->setCheckState (Qt::Checked);
 		else	
 			ui.hideLinkIfUnselected->setCheckState (Qt::Unchecked);
+
+		// Layout
+		if (branch->getIncludeImagesVer())
+			ui.incImgVer->setCheckState (Qt::Checked);
+		else	
+			ui.incImgVer->setCheckState (Qt::Unchecked);
+		if (branch->getIncludeImagesHor())
+			ui.incImgHor->setCheckState (Qt::Checked);
+		else	
+			ui.incImgHor->setCheckState (Qt::Unchecked);
+
+		// Finally activate signals
+		connectSignals();
 	} else
 	{
 		ui.tabWidget->setEnabled (false);
@@ -100,9 +116,9 @@
 	if (mapEditor)
 		switch (i)
 		{
-			case 0: mapEditor->setFrameType (NoFrame); break;
-			case 1: mapEditor->setFrameType (Rectangle); break;
-			case 2: mapEditor->setFrameType (Ellipse); break;
+			case 0: mapEditor->setFrameType (FrameObj::NoFrame); break;
+			case 1: mapEditor->setFrameType (FrameObj::Rectangle); break;
+			case 2: mapEditor->setFrameType (FrameObj::Ellipse); break;
 		}
 }
 
@@ -132,9 +148,82 @@
 	}	
 }
 
+void BranchPropertyWindow::framePaddingChanged(int i)
+{
+	if (mapEditor) mapEditor->setFramePadding (i);
+}
+
+void BranchPropertyWindow::frameBorderWidthChanged(int i)
+{
+	if (mapEditor) mapEditor->setFrameBorderWidth(i);
+}
+
 void BranchPropertyWindow::linkHideUnselectedChanged (int i)
 {
 	if (!branch) return;
-	branch->setHideLinkUnselected(i);
+	mapEditor->setHideLinkUnselected(i);
 }
 
+void BranchPropertyWindow::incImgVerChanged (int  i)
+{
+	if (mapEditor) mapEditor->setIncludeImagesVer (i);
+}
+
+void BranchPropertyWindow::incImgHorChanged (int  i)
+{
+	if (mapEditor) mapEditor->setIncludeImagesHor (i);
+}
+
+void BranchPropertyWindow::connectSignals()
+{
+	// Frame
+	connect ( 
+		ui.framePenColorButton, SIGNAL (clicked()), 
+		this, SLOT (framePenColorClicked()));
+	connect ( 
+		ui.framePaddingSpinBox, SIGNAL (valueChanged( int)), 
+		this, SLOT (framePaddingChanged (int)));
+	connect ( 
+		ui.frameWidthSpinBox, SIGNAL (valueChanged( int)), 
+		this, SLOT (frameBorderWidthChanged (int)));
+	connect ( 
+		ui.frameBrushColorButton, SIGNAL (clicked()), 
+		this, SLOT (frameBrushColorClicked()));
+	connect ( 
+		ui.frameTypeCombo, SIGNAL (currentIndexChanged( int)), 
+		this, SLOT (frameTypeChanged (int)));
+
+
+	// Link	
+	connect ( 
+		ui.hideLinkIfUnselected, SIGNAL (stateChanged( int)), 
+		this, SLOT (linkHideUnselectedChanged (int)));
+
+	// Layout	
+	connect ( 
+		ui.incImgVer, SIGNAL (stateChanged( int)), 
+		this, SLOT (incImgVerChanged (int)));
+	connect ( 
+		ui.incImgHor, SIGNAL (stateChanged( int)), 
+		this, SLOT (incImgHorChanged (int)));
+}
+
+
+void BranchPropertyWindow::disconnectSignals()
+{
+	// Frame
+	disconnect ( ui.frameTypeCombo, 0,0,0);
+	disconnect ( ui.framePenColorButton, 0,0,0);
+	disconnect ( ui.framePaddingSpinBox, 0,0,0);
+	disconnect ( ui.frameWidthSpinBox, 0,0,0);
+	disconnect ( ui.frameBrushColorButton, 0,0,0);
+
+	// Link	
+	disconnect ( ui.hideLinkIfUnselected, 0,0,0);
+
+	// Layout	
+	disconnect ( ui.incImgVer, 0,0,0);
+	disconnect ( ui.incImgHor, 0,0,0);
+}
+
+
diff -r b0d72eb511c9 -r 494a5b8c131e branchpropwindow.h
--- a/branchpropwindow.h	Wed Apr 25 16:02:54 2007 +0000
+++ b/branchpropwindow.h	Wed Apr 25 16:02:54 2007 +0000
@@ -11,6 +11,7 @@
 	Q_OBJECT
 public:
 	BranchPropertyWindow (QWidget *parent=0);
+	~BranchPropertyWindow ();
 	void setBranch (BranchObj *);
 	void setMapEditor (MapEditor *);
 
@@ -18,15 +19,22 @@
 	void frameTypeChanged (int);
 	void framePenColorClicked ();
 	void frameBrushColorClicked ();
+	void framePaddingChanged(int);
+	void frameBorderWidthChanged(int);
 	void linkHideUnselectedChanged (int);
+	void incImgVerChanged (int);
+	void incImgHorChanged (int);
 
 private:
+	void connectSignals();
+	void disconnectSignals();
+	
 	Ui::BranchPropertyWindow ui;
 
 	BranchObj *branch;
 	MapEditor *mapEditor;
 
-	QColor penColor;	// FIXME replace this with Palette
+	QColor penColor;
 	QColor brushColor;
 };
 
diff -r b0d72eb511c9 -r 494a5b8c131e branchpropwindow.ui
--- a/branchpropwindow.ui	Wed Apr 25 16:02:54 2007 +0000
+++ b/branchpropwindow.ui	Wed Apr 25 16:02:54 2007 +0000
@@ -5,20 +5,14 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>395</width>
-    <height>282</height>
+    <width>255</width>
+    <height>327</height>
    </rect>
   </property>
   <property name="windowTitle" >
    <string>Branch Property Editor</string>
   </property>
   <layout class="QVBoxLayout" >
-   <property name="margin" >
-    <number>9</number>
-   </property>
-   <property name="spacing" >
-    <number>6</number>
-   </property>
    <item>
     <widget class="QTabWidget" name="tabWidget" >
      <property name="currentIndex" >
@@ -29,45 +23,120 @@
        <string>Frame</string>
       </attribute>
       <layout class="QVBoxLayout" >
-       <property name="margin" >
-        <number>9</number>
-       </property>
        <property name="spacing" >
         <number>6</number>
        </property>
+       <property name="leftMargin" >
+        <number>9</number>
+       </property>
+       <property name="topMargin" >
+        <number>9</number>
+       </property>
+       <property name="rightMargin" >
+        <number>9</number>
+       </property>
+       <property name="bottomMargin" >
+        <number>9</number>
+       </property>
+       <item>
+        <widget class="QGroupBox" name="groupBox" >
+         <property name="title" >
+          <string>Geometry</string>
+         </property>
+         <layout class="QGridLayout" >
+          <item row="0" column="0" colspan="4" >
+           <widget class="QComboBox" name="frameTypeCombo" >
+            <property name="sizePolicy" >
+             <sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
+              <horstretch>0</horstretch>
+              <verstretch>0</verstretch>
+             </sizepolicy>
+            </property>
+            <item>
+             <property name="text" >
+              <string>No Frame</string>
+             </property>
+            </item>
+            <item>
+             <property name="text" >
+              <string>Rectangle</string>
+             </property>
+            </item>
+            <item>
+             <property name="text" >
+              <string>Ellipse</string>
+             </property>
+            </item>
+           </widget>
+          </item>
+          <item row="1" column="3" >
+           <spacer>
+            <property name="orientation" >
+             <enum>Qt::Horizontal</enum>
+            </property>
+            <property name="sizeHint" >
+             <size>
+              <width>40</width>
+              <height>20</height>
+             </size>
+            </property>
+           </spacer>
+          </item>
+          <item row="1" column="1" colspan="2" >
+           <widget class="QLabel" name="label_3" >
+            <property name="text" >
+             <string>Padding</string>
+            </property>
+           </widget>
+          </item>
+          <item row="2" column="1" colspan="2" >
+           <widget class="QLabel" name="label_4" >
+            <property name="text" >
+             <string>Borderline width</string>
+            </property>
+           </widget>
+          </item>
+          <item row="1" column="0" >
+           <widget class="QSpinBox" name="framePaddingSpinBox" >
+            <property name="maximum" >
+             <number>50</number>
+            </property>
+           </widget>
+          </item>
+          <item row="2" column="0" >
+           <widget class="QSpinBox" name="frameWidthSpinBox" >
+            <property name="minimum" >
+             <number>1</number>
+            </property>
+            <property name="maximum" >
+             <number>20</number>
+            </property>
+           </widget>
+          </item>
+         </layout>
+        </widget>
+       </item>
        <item>
         <layout class="QVBoxLayout" >
-         <property name="margin" >
-          <number>0</number>
-         </property>
          <property name="spacing" >
           <number>6</number>
          </property>
-         <item>
-          <widget class="QComboBox" name="frameTypeCombo" >
-           <item>
-            <property name="text" >
-             <string>No Frame</string>
-            </property>
-           </item>
-           <item>
-            <property name="text" >
-             <string>Rectangle</string>
-            </property>
-           </item>
-           <item>
-            <property name="text" >
-             <string>Ellipse</string>
-            </property>
-           </item>
-          </widget>
-         </item>
+         <property name="leftMargin" >
+          <number>0</number>
+         </property>
+         <property name="topMargin" >
+          <number>0</number>
+         </property>
+         <property name="rightMargin" >
+          <number>0</number>
+         </property>
+         <property name="bottomMargin" >
+          <number>0</number>
+         </property>
          <item>
           <widget class="QGroupBox" name="colorGroupBox" >
            <property name="sizePolicy" >
-            <sizepolicy>
-             <hsizetype>7</hsizetype>
-             <vsizetype>5</vsizetype>
+            <sizepolicy vsizetype="Preferred" hsizetype="Expanding" >
              <horstretch>0</horstretch>
              <verstretch>0</verstretch>
             </sizepolicy>
@@ -76,10 +145,22 @@
             <string>Colors</string>
            </property>
            <layout class="QGridLayout" >
-            <property name="margin" >
+            <property name="leftMargin" >
              <number>7</number>
             </property>
-            <property name="spacing" >
+            <property name="topMargin" >
+             <number>7</number>
+            </property>
+            <property name="rightMargin" >
+             <number>7</number>
+            </property>
+            <property name="bottomMargin" >
+             <number>7</number>
+            </property>
+            <property name="horizontalSpacing" >
+             <number>6</number>
+            </property>
+            <property name="verticalSpacing" >
              <number>6</number>
             </property>
             <item row="0" column="0" >
@@ -98,9 +179,7 @@
             <item row="0" column="1" >
              <widget class="QLabel" name="penColorLabelDesc" >
               <property name="sizePolicy" >
-               <sizepolicy>
-                <hsizetype>7</hsizetype>
-                <vsizetype>5</vsizetype>
+               <sizepolicy vsizetype="Preferred" hsizetype="Expanding" >
                 <horstretch>0</horstretch>
                 <verstretch>0</verstretch>
                </sizepolicy>
@@ -156,23 +235,70 @@
        </item>
       </layout>
      </widget>
+     <widget class="QWidget" name="Layout" >
+      <attribute name="title" >
+       <string>Layout</string>
+      </attribute>
+      <layout class="QVBoxLayout" >
+       <item>
+        <layout class="QVBoxLayout" >
+         <item>
+          <widget class="QCheckBox" name="incImgHor" >
+           <property name="text" >
+            <string>Include images horizontally</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QCheckBox" name="incImgVer" >
+           <property name="text" >
+            <string>Include images vertically</string>
+           </property>
+          </widget>
+         </item>
+        </layout>
+       </item>
+       <item>
+        <spacer>
+         <property name="orientation" >
+          <enum>Qt::Vertical</enum>
+         </property>
+         <property name="sizeHint" >
+          <size>
+           <width>20</width>
+           <height>40</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
+      </layout>
+     </widget>
      <widget class="QWidget" name="tab_2" >
       <attribute name="title" >
        <string>Link</string>
       </attribute>
-      <widget class="QCheckBox" name="hideLinkIfUnselected" >
-       <property name="geometry" >
-        <rect>
-         <x>20</x>
-         <y>10</y>
-         <width>231</width>
-         <height>21</height>
-        </rect>
-       </property>
-       <property name="text" >
-        <string>Hide link if unselected</string>
-       </property>
-      </widget>
+      <layout class="QVBoxLayout" >
+       <item>
+        <widget class="QCheckBox" name="hideLinkIfUnselected" >
+         <property name="text" >
+          <string>Hide link if unselected</string>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <spacer>
+         <property name="orientation" >
+          <enum>Qt::Vertical</enum>
+         </property>
+         <property name="sizeHint" >
+          <size>
+           <width>20</width>
+           <height>40</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
+      </layout>
      </widget>
     </widget>
    </item>
@@ -191,11 +317,20 @@
    </item>
    <item>
     <layout class="QHBoxLayout" >
-     <property name="margin" >
+     <property name="spacing" >
+      <number>6</number>
+     </property>
+     <property name="leftMargin" >
       <number>0</number>
      </property>
-     <property name="spacing" >
-      <number>6</number>
+     <property name="topMargin" >
+      <number>0</number>
+     </property>
+     <property name="rightMargin" >
+      <number>0</number>
+     </property>
+     <property name="bottomMargin" >
+      <number>0</number>
      </property>
      <item>
       <spacer>