1.1 --- a/branchobj.cpp Wed Mar 21 11:51:38 2007 +0000
1.2 +++ b/branchobj.cpp Sat Mar 31 09:28:27 2007 +0000
1.3 @@ -572,7 +572,6 @@
1.4 QPointF ap=getAbsPos();
1.5 bbox.moveTopLeft (ap);
1.6 positionContents();
1.7 - setSelBox();
1.8
1.9 // set the frame
1.10 frame->setRect(QRectF(bbox.x(),bbox.y(),bbox.width(),bbox.height() ) );
1.11 @@ -661,12 +660,20 @@
1.12 // Sets childpos and parpos depending on orientation
1.13 if (getOrientation()==OrientLeftOfCenter )
1.14 {
1.15 - childPos=QPointF (ornamentsBBox.bottomLeft().x(), ornamentsBBox.bottomLeft().y() );
1.16 - parPos=QPointF (ornamentsBBox.bottomRight().x(),ornamentsBBox.bottomRight().y() );
1.17 + childPos=QPointF (
1.18 + ornamentsBBox.bottomLeft().x(),
1.19 + bottomlineY);
1.20 + parPos=QPointF (
1.21 + ornamentsBBox.bottomRight().x(),
1.22 + bottomlineY);
1.23 } else
1.24 {
1.25 - childPos=QPointF (ornamentsBBox.bottomRight().x(), ornamentsBBox.bottomRight().y() );
1.26 - parPos=QPointF (ornamentsBBox.bottomLeft().x(),ornamentsBBox.bottomLeft().y() );
1.27 + childPos=QPointF (
1.28 + ornamentsBBox.bottomRight().x(),
1.29 + bottomlineY);
1.30 + parPos=QPointF (
1.31 + ornamentsBBox.bottomLeft().x(),
1.32 + bottomlineY);
1.33 }
1.34 }
1.35
1.36 @@ -1451,7 +1458,7 @@
1.37
1.38 void BranchObj::select()
1.39 {
1.40 - // set Text in Editor
1.41 + // update NoteEditor
1.42 textEditor->setText(note.getNote() );
1.43 QString fnh=note.getFilenameHint();
1.44 if (fnh!="")
1.45 @@ -1461,7 +1468,9 @@
1.46 textEditor->setFontHint (note.getFontHint() );
1.47 isNoteInEditor=true;
1.48
1.49 + // set selected and visible
1.50 LinkableMapObj::select();
1.51 +
1.52 // Tell parent that I am selected now:
1.53 BranchObj* po=(BranchObj*)(parObj);
1.54 if (po) // TODO Try to get rid of this cast...
2.1 --- a/branchpropwindow.cpp Wed Mar 21 11:51:38 2007 +0000
2.2 +++ b/branchpropwindow.cpp Sat Mar 31 09:28:27 2007 +0000
2.3 @@ -1,5 +1,7 @@
2.4 #include "branchpropwindow.h"
2.5
2.6 +#include <QColorDialog>
2.7 +
2.8 #include "frameobj.h"
2.9
2.10
2.11 @@ -10,39 +12,87 @@
2.12 branch=NULL;
2.13 mapEditor=NULL;
2.14
2.15 - connect ( ui.frameTypeCombo, SIGNAL (currentIndexChanged( int)), this, SLOT (frameTypeChanged (int)));
2.16 - connect ( ui.hideLinkIfUnselected, SIGNAL (stateChanged( int)), this, SLOT (linkHideUnselectedChanged (int)));
2.17 + ui.tabWidget->setEnabled(false);
2.18 +
2.19 + penColor=QColor (Qt::black);
2.20 + brushColor=QColor (Qt::black);
2.21 + QPixmap pix( 16,16);
2.22 + pix.fill (penColor);
2.23 + ui.framePenColorButton->setPixmap (pix);
2.24 + ui.frameBrushColorButton->setPixmap (pix);
2.25 +
2.26 + connect (
2.27 + ui.framePenColorButton, SIGNAL (clicked()),
2.28 + this, SLOT (framePenColorClicked()));
2.29 + connect (
2.30 + ui.frameBrushColorButton, SIGNAL (clicked()),
2.31 + this, SLOT (frameBrushColorClicked()));
2.32 + connect (
2.33 + ui.frameTypeCombo, SIGNAL (currentIndexChanged( int)),
2.34 + this, SLOT (frameTypeChanged (int)));
2.35 + connect (
2.36 + ui.hideLinkIfUnselected, SIGNAL (stateChanged( int)),
2.37 + this, SLOT (linkHideUnselectedChanged (int)));
2.38 }
2.39
2.40 void BranchPropertyWindow::setBranch (BranchObj *bo)
2.41 {
2.42 - if (!bo) return;
2.43 branch=bo;
2.44 + if (bo)
2.45 + {
2.46 + ui.tabWidget->setEnabled (true);
2.47
2.48 - // Frame
2.49 - switch (branch->getFrameType())
2.50 + // Frame
2.51 + FrameType t=branch->getFrameType();
2.52 + if (t==NoFrame)
2.53 + {
2.54 + ui.frameTypeCombo->setCurrentIndex (0);
2.55 + penColor=Qt::white;
2.56 + brushColor=Qt::white;
2.57 + ui.colorGroupBox->setEnabled (false);
2.58 + } else
2.59 + {
2.60 + penColor=bo->getFramePenColor();
2.61 + brushColor=bo->getFrameBrushColor();
2.62 + QPixmap pix( 16,16);
2.63 + pix.fill (penColor);
2.64 + ui.frameBrushColorButton->setPixmap (pix);
2.65 + pix.fill (brushColor);
2.66 + ui.frameBrushColorButton->setPixmap (pix);
2.67 + ui.colorGroupBox->setEnabled (true);
2.68 +
2.69 + switch (t)
2.70 + {
2.71 + case Rectangle:
2.72 + ui.frameTypeCombo->setCurrentIndex (1);
2.73 + break;
2.74 + case Ellipse:
2.75 + ui.frameTypeCombo->setCurrentIndex (2);
2.76 + break;
2.77 + default:
2.78 + break;
2.79 + }
2.80 + }
2.81 +
2.82 + // Link
2.83 + if (branch->getHideLinkUnselected())
2.84 + ui.hideLinkIfUnselected->setCheckState (Qt::Checked);
2.85 + else
2.86 + ui.hideLinkIfUnselected->setCheckState (Qt::Unchecked);
2.87 + } else
2.88 {
2.89 - case NoFrame:
2.90 - ui.frameTypeCombo->setCurrentIndex (0);
2.91 - break;
2.92 - case Rectangle:
2.93 - ui.frameTypeCombo->setCurrentIndex (1);
2.94 - break;
2.95 - case Ellipse:
2.96 - ui.frameTypeCombo->setCurrentIndex (2);
2.97 - break;
2.98 + ui.tabWidget->setEnabled (false);
2.99 }
2.100 -
2.101 - // Link
2.102 - if (branch->getHideLinkUnselected())
2.103 - ui.hideLinkIfUnselected->setCheckState (Qt::Checked);
2.104 - else
2.105 - ui.hideLinkIfUnselected->setCheckState (Qt::Unchecked);
2.106 }
2.107
2.108 void BranchPropertyWindow::setMapEditor (MapEditor *me)
2.109 {
2.110 - if (me) mapEditor=me;
2.111 + mapEditor=me;
2.112 + if (mapEditor)
2.113 + setBranch (mapEditor->getSelectedBranch() );
2.114 + else
2.115 + ui.tabWidget->setEnabled (false);
2.116 +
2.117 }
2.118
2.119 void BranchPropertyWindow::frameTypeChanged (int i)
2.120 @@ -50,12 +100,38 @@
2.121 if (mapEditor)
2.122 switch (i)
2.123 {
2.124 - case 0: mapEditor->setFrame (NoFrame); break;
2.125 - case 1: mapEditor->setFrame (Rectangle); break;
2.126 - case 2: mapEditor->setFrame (Ellipse); break;
2.127 + case 0: mapEditor->setFrameType (NoFrame); break;
2.128 + case 1: mapEditor->setFrameType (Rectangle); break;
2.129 + case 2: mapEditor->setFrameType (Ellipse); break;
2.130 }
2.131 }
2.132
2.133 +void BranchPropertyWindow::framePenColorClicked()
2.134 +{
2.135 + if (mapEditor)
2.136 + {
2.137 + QColor col = QColorDialog::getColor( penColor, this );
2.138 + if ( col.isValid() )
2.139 + {
2.140 + penColor=col;
2.141 + mapEditor->setFramePenColor (penColor);
2.142 + }
2.143 + }
2.144 +}
2.145 +
2.146 +void BranchPropertyWindow::frameBrushColorClicked()
2.147 +{
2.148 + if (mapEditor)
2.149 + {
2.150 + QColor col = QColorDialog::getColor( brushColor, this );
2.151 + if ( col.isValid() )
2.152 + {
2.153 + brushColor=col;
2.154 + mapEditor->setFrameBrushColor (brushColor);
2.155 + }
2.156 + }
2.157 +}
2.158 +
2.159 void BranchPropertyWindow::linkHideUnselectedChanged (int i)
2.160 {
2.161 if (!branch) return;
3.1 --- a/branchpropwindow.h Wed Mar 21 11:51:38 2007 +0000
3.2 +++ b/branchpropwindow.h Sat Mar 31 09:28:27 2007 +0000
3.3 @@ -16,6 +16,8 @@
3.4
3.5 private slots:
3.6 void frameTypeChanged (int);
3.7 + void framePenColorClicked ();
3.8 + void frameBrushColorClicked ();
3.9 void linkHideUnselectedChanged (int);
3.10
3.11 private:
3.12 @@ -23,6 +25,9 @@
3.13
3.14 BranchObj *branch;
3.15 MapEditor *mapEditor;
3.16 +
3.17 + QColor penColor; // FIXME replace this with Palette
3.18 + QColor brushColor;
3.19 };
3.20
3.21 #endif //
4.1 --- a/branchpropwindow.ui Wed Mar 21 11:51:38 2007 +0000
4.2 +++ b/branchpropwindow.ui Sat Mar 31 09:28:27 2007 +0000
4.3 @@ -5,12 +5,12 @@
4.4 <rect>
4.5 <x>0</x>
4.6 <y>0</y>
4.7 - <width>343</width>
4.8 - <height>208</height>
4.9 + <width>395</width>
4.10 + <height>282</height>
4.11 </rect>
4.12 </property>
4.13 <property name="windowTitle" >
4.14 - <string>Form</string>
4.15 + <string>Branch Property Editor</string>
4.16 </property>
4.17 <layout class="QVBoxLayout" >
4.18 <property name="margin" >
4.19 @@ -28,31 +28,133 @@
4.20 <attribute name="title" >
4.21 <string>Frame</string>
4.22 </attribute>
4.23 - <widget class="QComboBox" name="frameTypeCombo" >
4.24 - <property name="geometry" >
4.25 - <rect>
4.26 - <x>10</x>
4.27 - <y>10</y>
4.28 - <width>301</width>
4.29 - <height>22</height>
4.30 - </rect>
4.31 + <layout class="QVBoxLayout" >
4.32 + <property name="margin" >
4.33 + <number>9</number>
4.34 + </property>
4.35 + <property name="spacing" >
4.36 + <number>6</number>
4.37 </property>
4.38 <item>
4.39 - <property name="text" >
4.40 - <string>No Frame</string>
4.41 - </property>
4.42 + <layout class="QVBoxLayout" >
4.43 + <property name="margin" >
4.44 + <number>0</number>
4.45 + </property>
4.46 + <property name="spacing" >
4.47 + <number>6</number>
4.48 + </property>
4.49 + <item>
4.50 + <widget class="QComboBox" name="frameTypeCombo" >
4.51 + <item>
4.52 + <property name="text" >
4.53 + <string>No Frame</string>
4.54 + </property>
4.55 + </item>
4.56 + <item>
4.57 + <property name="text" >
4.58 + <string>Rectangle</string>
4.59 + </property>
4.60 + </item>
4.61 + <item>
4.62 + <property name="text" >
4.63 + <string>Ellipse</string>
4.64 + </property>
4.65 + </item>
4.66 + </widget>
4.67 + </item>
4.68 + <item>
4.69 + <widget class="QGroupBox" name="colorGroupBox" >
4.70 + <property name="sizePolicy" >
4.71 + <sizepolicy>
4.72 + <hsizetype>7</hsizetype>
4.73 + <vsizetype>5</vsizetype>
4.74 + <horstretch>0</horstretch>
4.75 + <verstretch>0</verstretch>
4.76 + </sizepolicy>
4.77 + </property>
4.78 + <property name="title" >
4.79 + <string>Colors</string>
4.80 + </property>
4.81 + <layout class="QGridLayout" >
4.82 + <property name="margin" >
4.83 + <number>7</number>
4.84 + </property>
4.85 + <property name="spacing" >
4.86 + <number>6</number>
4.87 + </property>
4.88 + <item row="0" column="0" >
4.89 + <widget class="QPushButton" name="framePenColorButton" >
4.90 + <property name="maximumSize" >
4.91 + <size>
4.92 + <width>20</width>
4.93 + <height>16777215</height>
4.94 + </size>
4.95 + </property>
4.96 + <property name="text" >
4.97 + <string/>
4.98 + </property>
4.99 + </widget>
4.100 + </item>
4.101 + <item row="0" column="1" >
4.102 + <widget class="QLabel" name="penColorLabelDesc" >
4.103 + <property name="sizePolicy" >
4.104 + <sizepolicy>
4.105 + <hsizetype>7</hsizetype>
4.106 + <vsizetype>5</vsizetype>
4.107 + <horstretch>0</horstretch>
4.108 + <verstretch>0</verstretch>
4.109 + </sizepolicy>
4.110 + </property>
4.111 + <property name="text" >
4.112 + <string>Borderline color</string>
4.113 + </property>
4.114 + <property name="buddy" >
4.115 + <cstring>framePenColorButton</cstring>
4.116 + </property>
4.117 + </widget>
4.118 + </item>
4.119 + <item row="1" column="0" >
4.120 + <widget class="QPushButton" name="frameBrushColorButton" >
4.121 + <property name="maximumSize" >
4.122 + <size>
4.123 + <width>20</width>
4.124 + <height>16777215</height>
4.125 + </size>
4.126 + </property>
4.127 + <property name="text" >
4.128 + <string/>
4.129 + </property>
4.130 + </widget>
4.131 + </item>
4.132 + <item row="1" column="1" >
4.133 + <widget class="QLabel" name="brushColorLabelDesc" >
4.134 + <property name="text" >
4.135 + <string>Background color</string>
4.136 + </property>
4.137 + <property name="buddy" >
4.138 + <cstring>frameBrushColorButton</cstring>
4.139 + </property>
4.140 + </widget>
4.141 + </item>
4.142 + <item row="0" column="2" >
4.143 + <spacer>
4.144 + <property name="orientation" >
4.145 + <enum>Qt::Horizontal</enum>
4.146 + </property>
4.147 + <property name="sizeHint" >
4.148 + <size>
4.149 + <width>40</width>
4.150 + <height>20</height>
4.151 + </size>
4.152 + </property>
4.153 + </spacer>
4.154 + </item>
4.155 + </layout>
4.156 + </widget>
4.157 + </item>
4.158 + </layout>
4.159 </item>
4.160 - <item>
4.161 - <property name="text" >
4.162 - <string>Rectangle</string>
4.163 - </property>
4.164 - </item>
4.165 - <item>
4.166 - <property name="text" >
4.167 - <string>Ellipse</string>
4.168 - </property>
4.169 - </item>
4.170 - </widget>
4.171 + </layout>
4.172 </widget>
4.173 <widget class="QWidget" name="tab_2" >
4.174 <attribute name="title" >
4.175 @@ -75,6 +177,19 @@
4.176 </widget>
4.177 </item>
4.178 <item>
4.179 + <spacer>
4.180 + <property name="orientation" >
4.181 + <enum>Qt::Vertical</enum>
4.182 + </property>
4.183 + <property name="sizeHint" >
4.184 + <size>
4.185 + <width>20</width>
4.186 + <height>71</height>
4.187 + </size>
4.188 + </property>
4.189 + </spacer>
4.190 + </item>
4.191 + <item>
4.192 <layout class="QHBoxLayout" >
4.193 <property name="margin" >
4.194 <number>0</number>
4.195 @@ -89,8 +204,8 @@
4.196 </property>
4.197 <property name="sizeHint" >
4.198 <size>
4.199 - <width>251</width>
4.200 - <height>20</height>
4.201 + <width>41</width>
4.202 + <height>31</height>
4.203 </size>
4.204 </property>
4.205 </spacer>
5.1 --- a/exports.cpp Wed Mar 21 11:51:38 2007 +0000
5.2 +++ b/exports.cpp Sat Mar 31 09:28:27 2007 +0000
5.3 @@ -131,6 +131,7 @@
5.4 bo=mapCenter->first();
5.5 while (bo)
5.6 {
5.7 + cout << "export bo="<<bo->getHeading().ascii()<<endl;
5.8 // Make indentstring
5.9 for (i=0;i<bo->getDepth();i++) actIndent+= indentPerDepth;
5.10
5.11 @@ -142,6 +143,8 @@
5.12 } else if (bo->getDepth()==1)
5.13 ts << ("\n"+getSectionString(bo) + bo->getHeading()+ "\n");
5.14 else if (bo->getDepth()==2)
5.15 + ts << (actIndent + " * " + bo->getHeading()+ "\n");
5.16 + else if (bo->getDepth()==3)
5.17 ts << (actIndent + " o " + bo->getHeading()+ "\n");
5.18 else
5.19 ts << (actIndent + " - " + bo->getHeading()+ "\n");
6.1 --- a/selection.cpp Wed Mar 21 11:51:38 2007 +0000
6.2 +++ b/selection.cpp Sat Mar 31 09:28:27 2007 +0000
6.3 @@ -1,17 +1,26 @@
6.4 #include "selection.h"
6.5
6.6 +#include "mainwindow.h"
6.7 +#include "mapeditor.h"
6.8 +
6.9 +
6.10 +
6.11 +extern Main *mainWindow;
6.12
6.13 Selection::Selection()
6.14 {
6.15 + color= QColor(255,255,0);
6.16 }
6.17
6.18 Selection::~Selection()
6.19 {
6.20 }
6.21
6.22 -void Selection::setMapCenter(MapCenterObj *mco)
6.23 +void Selection::setMapEditor (MapEditor *me)
6.24 {
6.25 - mapCenter=mco;
6.26 + mapEditor=me;
6.27 + mapCenter=me->getMapCenter();
6.28 + scene=mapCenter->getScene();
6.29 }
6.30
6.31 void Selection::copy(const Selection &other)
6.32 @@ -27,11 +36,44 @@
6.33 lastSelectList.clear();
6.34 }
6.35
6.36 +void Selection::update()
6.37 +{
6.38 + QRectF bbox;
6.39 + int w=0;
6.40 + for (int i=0; i< selectList.count(); ++i)
6.41 + {
6.42 + bbox=selectList.at(i)->getBBox();
6.43 + selboxList.at(i)->setRect (
6.44 + bbox.x()-w,bbox.y()-w,
6.45 + bbox.width()+2*w, bbox.height()+2*w);
6.46 + selboxList.at(i)->setPen (color);
6.47 + selboxList.at(i)->setBrush (color);
6.48 + }
6.49 +}
6.50 +
6.51 +void Selection::setColor (QColor col)
6.52 +{
6.53 + color=col;
6.54 + update();
6.55 +}
6.56 +
6.57 +QColor Selection::getColor ()
6.58 +{
6.59 + return color;
6.60 +}
6.61 +
6.62 bool Selection::select(LinkableMapObj *lmo) // TODO no multiselections yet
6.63 {
6.64 if (!selectList.isEmpty()) unselect();
6.65 selectList.append (lmo);
6.66 + QGraphicsRectItem *sb = scene->addRect(
6.67 + QRectF(0,0,0,0),
6.68 + QPen(color),
6.69 + color);
6.70 + sb->setZValue(Z_SELBOX);
6.71 + selboxList.append (sb);
6.72 lmo->select();
6.73 + mainWindow->updateSatellites (mapEditor); // update branchPropWindow...
6.74 return true;
6.75 }
6.76
6.77 @@ -69,6 +111,9 @@
6.78 selectList.at(i)->unselect();
6.79 lastSelectList=selectList;
6.80 selectList.clear();
6.81 + while (!selboxList.isEmpty() )
6.82 + delete selboxList.takeFirst();
6.83 +
6.84 }
6.85 }
6.86
7.1 --- a/selection.h Wed Mar 21 11:51:38 2007 +0000
7.2 +++ b/selection.h Sat Mar 31 09:28:27 2007 +0000
7.3 @@ -1,8 +1,18 @@
7.4 #ifndef SELECTION_H
7.5 #define SELECTION_H
7.6
7.7 -#include "linkablemapobj.h"
7.8 -#include "mapcenterobj.h"
7.9 +#include <QString>
7.10 +#include <QList>
7.11 +#include <QGraphicsScene>
7.12 +
7.13 +
7.14 +class MapEditor;
7.15 +class BranchObj;
7.16 +class FloatImageObj;
7.17 +class MapCenterObj;
7.18 +class LinkableMapObj;
7.19 +
7.20 +
7.21
7.22 enum SelectionType {Undefined,Branch,MapCenter,FloatImage};
7.23
7.24 @@ -13,8 +23,10 @@
7.25 ~Selection();
7.26 void copy(const Selection&);
7.27 void clear();
7.28 - void setMapCenter (MapCenterObj *);
7.29 -
7.30 + void setMapEditor (MapEditor *);
7.31 + void update();
7.32 + void setColor (QColor c);
7.33 + QColor getColor ();
7.34 bool select (LinkableMapObj*);
7.35 bool select (const QString &);
7.36 bool reselect ();
7.37 @@ -33,7 +45,12 @@
7.38 void init();
7.39 QList <LinkableMapObj*> selectList;
7.40 QList <LinkableMapObj*> lastSelectList;
7.41 + QList <QGraphicsRectItem*> selboxList;
7.42 + MapEditor *mapEditor;
7.43 MapCenterObj *mapCenter;
7.44 + QGraphicsScene *scene;
7.45 +
7.46 + QColor color;
7.47 };
7.48 #endif
7.49