branchpropwindow.cpp
author insilmaril
Wed, 21 Mar 2007 11:51:38 +0000
changeset 436 19e5907b7818
parent 421 5522d1da7e37
child 440 c6a8651e6bbc
permissions -rw-r--r--
Slightly improved scripting abilities
insilmaril@421
     1
#include "branchpropwindow.h"
insilmaril@421
     2
insilmaril@421
     3
#include "frameobj.h"
insilmaril@421
     4
insilmaril@421
     5
insilmaril@421
     6
BranchPropertyWindow::BranchPropertyWindow (QWidget *parent):QDialog(parent)
insilmaril@421
     7
{
insilmaril@421
     8
	ui.setupUi (this);
insilmaril@421
     9
insilmaril@421
    10
	branch=NULL;
insilmaril@421
    11
	mapEditor=NULL;
insilmaril@421
    12
insilmaril@421
    13
	connect ( ui.frameTypeCombo, SIGNAL (currentIndexChanged( int)), this, SLOT (frameTypeChanged (int)));
insilmaril@421
    14
	connect ( ui.hideLinkIfUnselected, SIGNAL (stateChanged( int)), this, SLOT (linkHideUnselectedChanged (int)));
insilmaril@421
    15
}
insilmaril@421
    16
insilmaril@421
    17
void BranchPropertyWindow::setBranch (BranchObj *bo)
insilmaril@421
    18
{
insilmaril@421
    19
	if (!bo) return;
insilmaril@421
    20
	branch=bo;
insilmaril@421
    21
insilmaril@421
    22
	// Frame
insilmaril@421
    23
	switch (branch->getFrameType())
insilmaril@421
    24
	{
insilmaril@421
    25
		case NoFrame: 
insilmaril@421
    26
			ui.frameTypeCombo->setCurrentIndex (0);
insilmaril@421
    27
			break;
insilmaril@421
    28
		case Rectangle: 
insilmaril@421
    29
			ui.frameTypeCombo->setCurrentIndex (1);
insilmaril@421
    30
			break;
insilmaril@421
    31
		case Ellipse: 
insilmaril@421
    32
			ui.frameTypeCombo->setCurrentIndex (2);
insilmaril@421
    33
			break;
insilmaril@421
    34
	}
insilmaril@421
    35
	
insilmaril@421
    36
	// Link
insilmaril@421
    37
	if (branch->getHideLinkUnselected())
insilmaril@421
    38
		ui.hideLinkIfUnselected->setCheckState (Qt::Checked);
insilmaril@421
    39
	else	
insilmaril@421
    40
		ui.hideLinkIfUnselected->setCheckState (Qt::Unchecked);
insilmaril@421
    41
}
insilmaril@421
    42
insilmaril@421
    43
void BranchPropertyWindow::setMapEditor (MapEditor *me)
insilmaril@421
    44
{
insilmaril@421
    45
	if (me) mapEditor=me;
insilmaril@421
    46
}
insilmaril@421
    47
insilmaril@421
    48
void BranchPropertyWindow::frameTypeChanged (int i)
insilmaril@421
    49
{
insilmaril@421
    50
	if (mapEditor)
insilmaril@421
    51
		switch (i)
insilmaril@421
    52
		{
insilmaril@421
    53
			case 0: mapEditor->setFrame (NoFrame); break;
insilmaril@421
    54
			case 1: mapEditor->setFrame (Rectangle); break;
insilmaril@421
    55
			case 2: mapEditor->setFrame (Ellipse); break;
insilmaril@421
    56
		}
insilmaril@421
    57
}
insilmaril@421
    58
insilmaril@421
    59
void BranchPropertyWindow::linkHideUnselectedChanged (int i)
insilmaril@421
    60
{
insilmaril@421
    61
	if (!branch) return;
insilmaril@421
    62
	branch->setHideLinkUnselected(i);
insilmaril@421
    63
}
insilmaril@421
    64