branchpropwindow.cpp
changeset 462 494a5b8c131e
parent 440 c6a8651e6bbc
child 480 4e2c9394c7da
     1.1 --- a/branchpropwindow.cpp	Wed Apr 25 16:02:54 2007 +0000
     1.2 +++ b/branchpropwindow.cpp	Wed Apr 25 16:02:54 2007 +0000
     1.3 @@ -3,7 +3,9 @@
     1.4  #include <QColorDialog>
     1.5  
     1.6  #include "frameobj.h"
     1.7 +#include "settings.h"
     1.8  
     1.9 +extern Settings settings;
    1.10  
    1.11  BranchPropertyWindow::BranchPropertyWindow (QWidget *parent):QDialog(parent)
    1.12  {
    1.13 @@ -20,36 +22,33 @@
    1.14      pix.fill (penColor);
    1.15  	ui.framePenColorButton->setPixmap (pix);
    1.16  	ui.frameBrushColorButton->setPixmap (pix);
    1.17 +}
    1.18  
    1.19 -	connect ( 
    1.20 -		ui.framePenColorButton, SIGNAL (clicked()), 
    1.21 -		this, SLOT (framePenColorClicked()));
    1.22 -	connect ( 
    1.23 -		ui.frameBrushColorButton, SIGNAL (clicked()), 
    1.24 -		this, SLOT (frameBrushColorClicked()));
    1.25 -	connect ( 
    1.26 -		ui.frameTypeCombo, SIGNAL (currentIndexChanged( int)), 
    1.27 -		this, SLOT (frameTypeChanged (int)));
    1.28 -	connect ( 
    1.29 -		ui.hideLinkIfUnselected, SIGNAL (stateChanged( int)), 
    1.30 -		this, SLOT (linkHideUnselectedChanged (int)));
    1.31 +BranchPropertyWindow::~BranchPropertyWindow ()
    1.32 +{
    1.33 +	settings.setValue( "/branchpropertywindow/geometry/size", size() );
    1.34 +	settings.setValue( "/branchpropertywindow/geometry/pos", pos() );
    1.35 +	//settings.setValue( "/branchpropertywindow/showWithMain",showWithMain());	//FIXME add this!
    1.36  }
    1.37  
    1.38  void BranchPropertyWindow::setBranch (BranchObj *bo)
    1.39  {
    1.40 +	disconnectSignals();
    1.41  	branch=bo;
    1.42  	if (bo) 
    1.43  	{
    1.44  		ui.tabWidget->setEnabled (true);
    1.45  
    1.46  		// Frame
    1.47 -		FrameType t=branch->getFrameType();
    1.48 -		if (t==NoFrame)
    1.49 +		FrameObj::FrameType t=branch->getFrameType();
    1.50 +		if (t==FrameObj::NoFrame)
    1.51  		{
    1.52  			ui.frameTypeCombo->setCurrentIndex (0);
    1.53  			penColor=Qt::white;
    1.54  			brushColor=Qt::white;
    1.55  			ui.colorGroupBox->setEnabled (false);
    1.56 +			ui.framePaddingSpinBox->setEnabled (false);
    1.57 +			ui.frameWidthSpinBox->setEnabled (false);
    1.58  		} else	
    1.59  		{
    1.60  			penColor=bo->getFramePenColor();
    1.61 @@ -60,13 +59,17 @@
    1.62  			pix.fill (brushColor);
    1.63  			ui.frameBrushColorButton->setPixmap (pix);
    1.64  			ui.colorGroupBox->setEnabled (true);
    1.65 +			ui.framePaddingSpinBox->setEnabled (true);
    1.66 +			ui.framePaddingSpinBox->setValue (bo->getFramePadding());
    1.67 +			ui.frameWidthSpinBox->setEnabled (true);
    1.68 +			ui.frameWidthSpinBox->setValue (bo->getFrameBorderWidth());
    1.69  
    1.70  			switch (t)
    1.71  			{
    1.72 -				case Rectangle: 
    1.73 +				case FrameObj::Rectangle: 
    1.74  					ui.frameTypeCombo->setCurrentIndex (1);
    1.75  					break;
    1.76 -				case Ellipse: 
    1.77 +				case FrameObj::Ellipse: 
    1.78  					ui.frameTypeCombo->setCurrentIndex (2);
    1.79  					break;
    1.80  				default: 
    1.81 @@ -79,6 +82,19 @@
    1.82  			ui.hideLinkIfUnselected->setCheckState (Qt::Checked);
    1.83  		else	
    1.84  			ui.hideLinkIfUnselected->setCheckState (Qt::Unchecked);
    1.85 +
    1.86 +		// Layout
    1.87 +		if (branch->getIncludeImagesVer())
    1.88 +			ui.incImgVer->setCheckState (Qt::Checked);
    1.89 +		else	
    1.90 +			ui.incImgVer->setCheckState (Qt::Unchecked);
    1.91 +		if (branch->getIncludeImagesHor())
    1.92 +			ui.incImgHor->setCheckState (Qt::Checked);
    1.93 +		else	
    1.94 +			ui.incImgHor->setCheckState (Qt::Unchecked);
    1.95 +
    1.96 +		// Finally activate signals
    1.97 +		connectSignals();
    1.98  	} else
    1.99  	{
   1.100  		ui.tabWidget->setEnabled (false);
   1.101 @@ -100,9 +116,9 @@
   1.102  	if (mapEditor)
   1.103  		switch (i)
   1.104  		{
   1.105 -			case 0: mapEditor->setFrameType (NoFrame); break;
   1.106 -			case 1: mapEditor->setFrameType (Rectangle); break;
   1.107 -			case 2: mapEditor->setFrameType (Ellipse); break;
   1.108 +			case 0: mapEditor->setFrameType (FrameObj::NoFrame); break;
   1.109 +			case 1: mapEditor->setFrameType (FrameObj::Rectangle); break;
   1.110 +			case 2: mapEditor->setFrameType (FrameObj::Ellipse); break;
   1.111  		}
   1.112  }
   1.113  
   1.114 @@ -132,9 +148,82 @@
   1.115  	}	
   1.116  }
   1.117  
   1.118 +void BranchPropertyWindow::framePaddingChanged(int i)
   1.119 +{
   1.120 +	if (mapEditor) mapEditor->setFramePadding (i);
   1.121 +}
   1.122 +
   1.123 +void BranchPropertyWindow::frameBorderWidthChanged(int i)
   1.124 +{
   1.125 +	if (mapEditor) mapEditor->setFrameBorderWidth(i);
   1.126 +}
   1.127 +
   1.128  void BranchPropertyWindow::linkHideUnselectedChanged (int i)
   1.129  {
   1.130  	if (!branch) return;
   1.131 -	branch->setHideLinkUnselected(i);
   1.132 +	mapEditor->setHideLinkUnselected(i);
   1.133  }
   1.134  
   1.135 +void BranchPropertyWindow::incImgVerChanged (int  i)
   1.136 +{
   1.137 +	if (mapEditor) mapEditor->setIncludeImagesVer (i);
   1.138 +}
   1.139 +
   1.140 +void BranchPropertyWindow::incImgHorChanged (int  i)
   1.141 +{
   1.142 +	if (mapEditor) mapEditor->setIncludeImagesHor (i);
   1.143 +}
   1.144 +
   1.145 +void BranchPropertyWindow::connectSignals()
   1.146 +{
   1.147 +	// Frame
   1.148 +	connect ( 
   1.149 +		ui.framePenColorButton, SIGNAL (clicked()), 
   1.150 +		this, SLOT (framePenColorClicked()));
   1.151 +	connect ( 
   1.152 +		ui.framePaddingSpinBox, SIGNAL (valueChanged( int)), 
   1.153 +		this, SLOT (framePaddingChanged (int)));
   1.154 +	connect ( 
   1.155 +		ui.frameWidthSpinBox, SIGNAL (valueChanged( int)), 
   1.156 +		this, SLOT (frameBorderWidthChanged (int)));
   1.157 +	connect ( 
   1.158 +		ui.frameBrushColorButton, SIGNAL (clicked()), 
   1.159 +		this, SLOT (frameBrushColorClicked()));
   1.160 +	connect ( 
   1.161 +		ui.frameTypeCombo, SIGNAL (currentIndexChanged( int)), 
   1.162 +		this, SLOT (frameTypeChanged (int)));
   1.163 +
   1.164 +
   1.165 +	// Link	
   1.166 +	connect ( 
   1.167 +		ui.hideLinkIfUnselected, SIGNAL (stateChanged( int)), 
   1.168 +		this, SLOT (linkHideUnselectedChanged (int)));
   1.169 +
   1.170 +	// Layout	
   1.171 +	connect ( 
   1.172 +		ui.incImgVer, SIGNAL (stateChanged( int)), 
   1.173 +		this, SLOT (incImgVerChanged (int)));
   1.174 +	connect ( 
   1.175 +		ui.incImgHor, SIGNAL (stateChanged( int)), 
   1.176 +		this, SLOT (incImgHorChanged (int)));
   1.177 +}
   1.178 +
   1.179 +
   1.180 +void BranchPropertyWindow::disconnectSignals()
   1.181 +{
   1.182 +	// Frame
   1.183 +	disconnect ( ui.frameTypeCombo, 0,0,0);
   1.184 +	disconnect ( ui.framePenColorButton, 0,0,0);
   1.185 +	disconnect ( ui.framePaddingSpinBox, 0,0,0);
   1.186 +	disconnect ( ui.frameWidthSpinBox, 0,0,0);
   1.187 +	disconnect ( ui.frameBrushColorButton, 0,0,0);
   1.188 +
   1.189 +	// Link	
   1.190 +	disconnect ( ui.hideLinkIfUnselected, 0,0,0);
   1.191 +
   1.192 +	// Layout	
   1.193 +	disconnect ( ui.incImgVer, 0,0,0);
   1.194 +	disconnect ( ui.incImgHor, 0,0,0);
   1.195 +}
   1.196 +
   1.197 +