# HG changeset patch # User insilmaril # Date 1175333307 0 # Node ID c6a8651e6bbcec7cb8130d14be52761a8ae9a64a # Parent 717b20c563583b1a51b2e3a871431c20bc4be173 1.8.70 Fixes in property window diff -r 717b20c56358 -r c6a8651e6bbc branchobj.cpp --- a/branchobj.cpp Wed Mar 21 11:51:38 2007 +0000 +++ b/branchobj.cpp Sat Mar 31 09:28:27 2007 +0000 @@ -572,7 +572,6 @@ QPointF ap=getAbsPos(); bbox.moveTopLeft (ap); positionContents(); - setSelBox(); // set the frame frame->setRect(QRectF(bbox.x(),bbox.y(),bbox.width(),bbox.height() ) ); @@ -661,12 +660,20 @@ // Sets childpos and parpos depending on orientation if (getOrientation()==OrientLeftOfCenter ) { - childPos=QPointF (ornamentsBBox.bottomLeft().x(), ornamentsBBox.bottomLeft().y() ); - parPos=QPointF (ornamentsBBox.bottomRight().x(),ornamentsBBox.bottomRight().y() ); + childPos=QPointF ( + ornamentsBBox.bottomLeft().x(), + bottomlineY); + parPos=QPointF ( + ornamentsBBox.bottomRight().x(), + bottomlineY); } else { - childPos=QPointF (ornamentsBBox.bottomRight().x(), ornamentsBBox.bottomRight().y() ); - parPos=QPointF (ornamentsBBox.bottomLeft().x(),ornamentsBBox.bottomLeft().y() ); + childPos=QPointF ( + ornamentsBBox.bottomRight().x(), + bottomlineY); + parPos=QPointF ( + ornamentsBBox.bottomLeft().x(), + bottomlineY); } } @@ -1451,7 +1458,7 @@ void BranchObj::select() { - // set Text in Editor + // update NoteEditor textEditor->setText(note.getNote() ); QString fnh=note.getFilenameHint(); if (fnh!="") @@ -1461,7 +1468,9 @@ textEditor->setFontHint (note.getFontHint() ); isNoteInEditor=true; + // set selected and visible LinkableMapObj::select(); + // Tell parent that I am selected now: BranchObj* po=(BranchObj*)(parObj); if (po) // TODO Try to get rid of this cast... diff -r 717b20c56358 -r c6a8651e6bbc branchpropwindow.cpp --- a/branchpropwindow.cpp Wed Mar 21 11:51:38 2007 +0000 +++ b/branchpropwindow.cpp Sat Mar 31 09:28:27 2007 +0000 @@ -1,5 +1,7 @@ #include "branchpropwindow.h" +#include + #include "frameobj.h" @@ -10,39 +12,87 @@ branch=NULL; mapEditor=NULL; - connect ( ui.frameTypeCombo, SIGNAL (currentIndexChanged( int)), this, SLOT (frameTypeChanged (int))); - connect ( ui.hideLinkIfUnselected, SIGNAL (stateChanged( int)), this, SLOT (linkHideUnselectedChanged (int))); + ui.tabWidget->setEnabled(false); + + penColor=QColor (Qt::black); + brushColor=QColor (Qt::black); + QPixmap pix( 16,16); + 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))); } void BranchPropertyWindow::setBranch (BranchObj *bo) { - if (!bo) return; branch=bo; + if (bo) + { + ui.tabWidget->setEnabled (true); - // Frame - switch (branch->getFrameType()) + // Frame + FrameType t=branch->getFrameType(); + if (t==NoFrame) + { + ui.frameTypeCombo->setCurrentIndex (0); + penColor=Qt::white; + brushColor=Qt::white; + ui.colorGroupBox->setEnabled (false); + } else + { + penColor=bo->getFramePenColor(); + brushColor=bo->getFrameBrushColor(); + QPixmap pix( 16,16); + pix.fill (penColor); + ui.frameBrushColorButton->setPixmap (pix); + pix.fill (brushColor); + ui.frameBrushColorButton->setPixmap (pix); + ui.colorGroupBox->setEnabled (true); + + switch (t) + { + case Rectangle: + ui.frameTypeCombo->setCurrentIndex (1); + break; + case Ellipse: + ui.frameTypeCombo->setCurrentIndex (2); + break; + default: + break; + } + } + + // Link + if (branch->getHideLinkUnselected()) + ui.hideLinkIfUnselected->setCheckState (Qt::Checked); + else + ui.hideLinkIfUnselected->setCheckState (Qt::Unchecked); + } else { - case NoFrame: - ui.frameTypeCombo->setCurrentIndex (0); - break; - case Rectangle: - ui.frameTypeCombo->setCurrentIndex (1); - break; - case Ellipse: - ui.frameTypeCombo->setCurrentIndex (2); - break; + ui.tabWidget->setEnabled (false); } - - // Link - if (branch->getHideLinkUnselected()) - ui.hideLinkIfUnselected->setCheckState (Qt::Checked); - else - ui.hideLinkIfUnselected->setCheckState (Qt::Unchecked); } void BranchPropertyWindow::setMapEditor (MapEditor *me) { - if (me) mapEditor=me; + mapEditor=me; + if (mapEditor) + setBranch (mapEditor->getSelectedBranch() ); + else + ui.tabWidget->setEnabled (false); + } void BranchPropertyWindow::frameTypeChanged (int i) @@ -50,12 +100,38 @@ if (mapEditor) switch (i) { - case 0: mapEditor->setFrame (NoFrame); break; - case 1: mapEditor->setFrame (Rectangle); break; - case 2: mapEditor->setFrame (Ellipse); break; + case 0: mapEditor->setFrameType (NoFrame); break; + case 1: mapEditor->setFrameType (Rectangle); break; + case 2: mapEditor->setFrameType (Ellipse); break; } } +void BranchPropertyWindow::framePenColorClicked() +{ + if (mapEditor) + { + QColor col = QColorDialog::getColor( penColor, this ); + if ( col.isValid() ) + { + penColor=col; + mapEditor->setFramePenColor (penColor); + } + } +} + +void BranchPropertyWindow::frameBrushColorClicked() +{ + if (mapEditor) + { + QColor col = QColorDialog::getColor( brushColor, this ); + if ( col.isValid() ) + { + brushColor=col; + mapEditor->setFrameBrushColor (brushColor); + } + } +} + void BranchPropertyWindow::linkHideUnselectedChanged (int i) { if (!branch) return; diff -r 717b20c56358 -r c6a8651e6bbc branchpropwindow.h --- a/branchpropwindow.h Wed Mar 21 11:51:38 2007 +0000 +++ b/branchpropwindow.h Sat Mar 31 09:28:27 2007 +0000 @@ -16,6 +16,8 @@ private slots: void frameTypeChanged (int); + void framePenColorClicked (); + void frameBrushColorClicked (); void linkHideUnselectedChanged (int); private: @@ -23,6 +25,9 @@ BranchObj *branch; MapEditor *mapEditor; + + QColor penColor; // FIXME replace this with Palette + QColor brushColor; }; #endif // diff -r 717b20c56358 -r c6a8651e6bbc branchpropwindow.ui --- a/branchpropwindow.ui Wed Mar 21 11:51:38 2007 +0000 +++ b/branchpropwindow.ui Sat Mar 31 09:28:27 2007 +0000 @@ -5,12 +5,12 @@ 0 0 - 343 - 208 + 395 + 282 - Form + Branch Property Editor @@ -28,31 +28,133 @@ Frame - - - - 10 - 10 - 301 - 22 - + + + 9 + + + 6 - - No Frame - + + + 0 + + + 6 + + + + + + No Frame + + + + + Rectangle + + + + + Ellipse + + + + + + + + + 7 + 5 + 0 + 0 + + + + Colors + + + + 7 + + + 6 + + + + + + 20 + 16777215 + + + + + + + + + + + + 7 + 5 + 0 + 0 + + + + Borderline color + + + framePenColorButton + + + + + + + + 20 + 16777215 + + + + + + + + + + + Background color + + + frameBrushColorButton + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + - - - Rectangle - - - - - Ellipse - - - + @@ -75,6 +177,19 @@ + + + Qt::Vertical + + + + 20 + 71 + + + + + 0 @@ -89,8 +204,8 @@ - 251 - 20 + 41 + 31 diff -r 717b20c56358 -r c6a8651e6bbc exports.cpp --- a/exports.cpp Wed Mar 21 11:51:38 2007 +0000 +++ b/exports.cpp Sat Mar 31 09:28:27 2007 +0000 @@ -131,6 +131,7 @@ bo=mapCenter->first(); while (bo) { + cout << "export bo="<getHeading().ascii()<getDepth();i++) actIndent+= indentPerDepth; @@ -142,6 +143,8 @@ } else if (bo->getDepth()==1) ts << ("\n"+getSectionString(bo) + bo->getHeading()+ "\n"); else if (bo->getDepth()==2) + ts << (actIndent + " * " + bo->getHeading()+ "\n"); + else if (bo->getDepth()==3) ts << (actIndent + " o " + bo->getHeading()+ "\n"); else ts << (actIndent + " - " + bo->getHeading()+ "\n"); diff -r 717b20c56358 -r c6a8651e6bbc selection.cpp --- a/selection.cpp Wed Mar 21 11:51:38 2007 +0000 +++ b/selection.cpp Sat Mar 31 09:28:27 2007 +0000 @@ -1,17 +1,26 @@ #include "selection.h" +#include "mainwindow.h" +#include "mapeditor.h" + + + +extern Main *mainWindow; Selection::Selection() { + color= QColor(255,255,0); } Selection::~Selection() { } -void Selection::setMapCenter(MapCenterObj *mco) +void Selection::setMapEditor (MapEditor *me) { - mapCenter=mco; + mapEditor=me; + mapCenter=me->getMapCenter(); + scene=mapCenter->getScene(); } void Selection::copy(const Selection &other) @@ -27,11 +36,44 @@ lastSelectList.clear(); } +void Selection::update() +{ + QRectF bbox; + int w=0; + for (int i=0; i< selectList.count(); ++i) + { + bbox=selectList.at(i)->getBBox(); + selboxList.at(i)->setRect ( + bbox.x()-w,bbox.y()-w, + bbox.width()+2*w, bbox.height()+2*w); + selboxList.at(i)->setPen (color); + selboxList.at(i)->setBrush (color); + } +} + +void Selection::setColor (QColor col) +{ + color=col; + update(); +} + +QColor Selection::getColor () +{ + return color; +} + bool Selection::select(LinkableMapObj *lmo) // TODO no multiselections yet { if (!selectList.isEmpty()) unselect(); selectList.append (lmo); + QGraphicsRectItem *sb = scene->addRect( + QRectF(0,0,0,0), + QPen(color), + color); + sb->setZValue(Z_SELBOX); + selboxList.append (sb); lmo->select(); + mainWindow->updateSatellites (mapEditor); // update branchPropWindow... return true; } @@ -69,6 +111,9 @@ selectList.at(i)->unselect(); lastSelectList=selectList; selectList.clear(); + while (!selboxList.isEmpty() ) + delete selboxList.takeFirst(); + } } diff -r 717b20c56358 -r c6a8651e6bbc selection.h --- a/selection.h Wed Mar 21 11:51:38 2007 +0000 +++ b/selection.h Sat Mar 31 09:28:27 2007 +0000 @@ -1,8 +1,18 @@ #ifndef SELECTION_H #define SELECTION_H -#include "linkablemapobj.h" -#include "mapcenterobj.h" +#include +#include +#include + + +class MapEditor; +class BranchObj; +class FloatImageObj; +class MapCenterObj; +class LinkableMapObj; + + enum SelectionType {Undefined,Branch,MapCenter,FloatImage}; @@ -13,8 +23,10 @@ ~Selection(); void copy(const Selection&); void clear(); - void setMapCenter (MapCenterObj *); - + void setMapEditor (MapEditor *); + void update(); + void setColor (QColor c); + QColor getColor (); bool select (LinkableMapObj*); bool select (const QString &); bool reselect (); @@ -33,7 +45,12 @@ void init(); QList selectList; QList lastSelectList; + QList selboxList; + MapEditor *mapEditor; MapCenterObj *mapCenter; + QGraphicsScene *scene; + + QColor color; }; #endif