diff -r c6a8651e6bbc -r 494a5b8c131e branchpropwindow.cpp --- a/branchpropwindow.cpp Sat Mar 31 09:28:27 2007 +0000 +++ b/branchpropwindow.cpp Wed Apr 25 16:02:54 2007 +0000 @@ -3,7 +3,9 @@ #include #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); +} + +