void SMLineStyleWidget::fillEndCombo()
{
	IconManager* im  = IconManager::instance();

	endCombo->clear();
	endCombo->addItem(im->loadIcon("ButtCap.png"), tr( "Flat Cap" ) );
	endCombo->addItem(im->loadIcon("SquareCap.png"), tr( "Square Cap" ) );
	endCombo->addItem(im->loadIcon("RoundCap.png"), tr( "Round Cap" ) );
}
void SMLineStyleWidget::fillJoinCombo()
{
	IconManager* im  = IconManager::instance();

	joinCombo->clear();
	joinCombo->addItem(im->loadIcon("MiterJoin.png"), tr( "Miter Join" ) );
	joinCombo->addItem(im->loadIcon("BevelJoin.png"), tr( "Bevel Join" ) );
	joinCombo->addItem(im->loadIcon("RoundJoin.png"), tr( "Round Join" ) );
}
SMLineStyleWidget::SMLineStyleWidget() : QWidget()
{
	setupUi(this);
	IconManager* im  = IconManager::instance();
	addButton->setIcon(im->loadIcon("penciladd.png"));
	removeButton->setIcon(im->loadIcon("pencilsub.png"));

	lineWidth->setMinimum(0.0);
	lineWidth->setMaximum(300.0);

	fillEndCombo();
	fillJoinCombo();

	languageChange();
}
SMLineStyleWidget::SMLineStyleWidget() : QWidget()
{
	setupUi(this);
	IconManager* im  = IconManager::instance();
	addButton->setIcon(im->loadIcon("penciladd.png"));
	removeButton->setIcon(im->loadIcon("pencilsub.png"));

	lineWidth->setMinimum(0.0);
	lineWidth->setMaximum(300.0);

	endCombo->addItem(im->loadIcon("ButtCap.png"), tr( "Flat Cap" ) );
	endCombo->addItem(im->loadIcon("SquareCap.png"), tr( "Square Cap" ) );
	endCombo->addItem(im->loadIcon("RoundCap.png"), tr( "Round Cap" ) );

	joinCombo->addItem(im->loadIcon("MiterJoin.png"), tr( "Miter Join" ) );
	joinCombo->addItem(im->loadIcon("BevelJoin.png"), tr( "Bevel Join" ) );
	joinCombo->addItem(im->loadIcon("RoundJoin.png"), tr( "Round Join" ) );

	languageChange();
}
void AlignDistributePalette::init()
{
	undoManager = UndoManager::instance();
	IconManager* im = IconManager::instance();
	alignLeftOutToolButton->setIcon(im->loadIcon("22/align-horizontal-left-out.png"));
	alignLeftInToolButton->setIcon(im->loadIcon("22/align-horizontal-left.png"));
	alignCenterHorToolButton->setIcon(im->loadIcon("22/align-horizontal-center.png"));
	alignRightInToolButton->setIcon(im->loadIcon("22/align-horizontal-right.png"));
	alignRightOutToolButton->setIcon(im->loadIcon("22/align-horizontal-right-out.png"));

	alignTopOutToolButton->setIcon(im->loadIcon("22/align-vertical-top-out.png"));
	alignTopInToolButton->setIcon(im->loadIcon("22/align-vertical-top.png"));
	alignCenterVerToolButton->setIcon(im->loadIcon("22/align-vertical-center.png"));
	alignBottomInToolButton->setIcon(im->loadIcon("22/align-vertical-bottom.png"));
	alignBottomOutToolButton->setIcon(im->loadIcon("22/align-vertical-bottom-out.png"));

	distributeLeftToolButton->setIcon(im->loadIcon("22/distribute-horizontal-left.png"));
	distributeCenterHToolButton->setIcon(im->loadIcon("22/distribute-horizontal-center.png"));
	distributeRightToolButton->setIcon(im->loadIcon("22/distribute-horizontal-right.png"));
	distributeDistHToolButton->setIcon(im->loadIcon("22/distribute-horizontal-equal.png"));

	distributeBottomToolButton->setIcon(im->loadIcon("22/distribute-vertical-bottom.png"));
	distributeCenterVToolButton->setIcon(im->loadIcon("22/distribute-vertical-center.png"));
	distributeTopToolButton->setIcon(im->loadIcon("22/distribute-vertical-top.png"));
	distributeDistVToolButton->setIcon(im->loadIcon("22/distribute-vertical-equal.png"));

	distributeAcrossPageToolButton->setIcon(im->loadIcon("22/distribute-horizontal-page.png"));
	distributeDownPageToolButton->setIcon(im->loadIcon("22/distribute-vertical-page.png"));
	distributeAcrossMarginsToolButton->setIcon(im->loadIcon("22/distribute-horizontal-margin.png"));
	distributeDownMarginsToolButton->setIcon(im->loadIcon("22/distribute-vertical-margin.png"));
	distributeDistValueHToolButton->setIcon(im->loadIcon("22/distribute-horizontal-x.png"));
	distributeDistValueVToolButton->setIcon(im->loadIcon("22/distribute-vertical-y.png"));

	swapLeftToolButton->setIcon(im->loadIcon("22/swap-left.png"));
	swapRightToolButton->setIcon(im->loadIcon("22/swap-right.png"));

	QSize s(24,24);
	alignLeftOutToolButton->setMinimumSize(s);
	alignLeftInToolButton->setMinimumSize(s);
	alignCenterHorToolButton->setMinimumSize(s);
	alignRightInToolButton->setMinimumSize(s);
	alignRightOutToolButton->setMinimumSize(s);

	alignTopOutToolButton->setMinimumSize(s);
	alignTopInToolButton->setMinimumSize(s);
	alignCenterVerToolButton->setMinimumSize(s);
	alignBottomInToolButton->setMinimumSize(s);
	alignBottomOutToolButton->setMinimumSize(s);

	distributeLeftToolButton->setMinimumSize(s);
	distributeCenterHToolButton->setMinimumSize(s);
	distributeRightToolButton->setMinimumSize(s);
	distributeDistHToolButton->setMinimumSize(s);

	distributeBottomToolButton->setMinimumSize(s);
	distributeCenterVToolButton->setMinimumSize(s);
	distributeTopToolButton->setMinimumSize(s);
	distributeDistVToolButton->setMinimumSize(s);

	distributeAcrossPageToolButton->setMinimumSize(s);
	distributeDownPageToolButton->setMinimumSize(s);
	distributeAcrossMarginsToolButton->setMinimumSize(s);
	distributeDownMarginsToolButton->setMinimumSize(s);
	distributeDistValueHToolButton->setMinimumSize(s);
	distributeDistValueVToolButton->setMinimumSize(s);

	swapLeftToolButton->setMinimumSize(s);
	swapRightToolButton->setMinimumSize(s);

	alignLeftOutToolButton->setMaximumSize(s);
	alignLeftInToolButton->setMaximumSize(s);
	alignCenterHorToolButton->setMaximumSize(s);
	alignRightInToolButton->setMaximumSize(s);
	alignRightOutToolButton->setMaximumSize(s);

	alignTopOutToolButton->setMaximumSize(s);
	alignTopInToolButton->setMaximumSize(s);
	alignCenterVerToolButton->setMaximumSize(s);
	alignBottomInToolButton->setMaximumSize(s);
	alignBottomOutToolButton->setMaximumSize(s);

	distributeLeftToolButton->setMaximumSize(s);
	distributeCenterHToolButton->setMaximumSize(s);
	distributeRightToolButton->setMaximumSize(s);
	distributeDistHToolButton->setMaximumSize(s);

	distributeBottomToolButton->setMaximumSize(s);
	distributeCenterVToolButton->setMaximumSize(s);
	distributeTopToolButton->setMaximumSize(s);
	distributeDistVToolButton->setMaximumSize(s);

	distributeAcrossPageToolButton->setMaximumSize(s);
	distributeDownPageToolButton->setMaximumSize(s);
	distributeAcrossMarginsToolButton->setMaximumSize(s);
	distributeDownMarginsToolButton->setMaximumSize(s);
	distributeDistValueHToolButton->setMaximumSize(s);
	distributeDistValueVToolButton->setMaximumSize(s);

	swapLeftToolButton->setMaximumSize(s);
	swapRightToolButton->setMaximumSize(s);


	connect(alignLeftOutToolButton, SIGNAL(clicked()), this, SLOT(alignLeftOut()));
	connect(alignRightOutToolButton, SIGNAL(clicked()), this, SLOT(alignRightOut()));
	connect(alignBottomInToolButton, SIGNAL(clicked()), this, SLOT(alignBottomIn()));
	connect(alignRightInToolButton, SIGNAL(clicked()), this, SLOT(alignRightIn()));
	connect(alignBottomOutToolButton, SIGNAL(clicked()), this, SLOT(alignBottomOut()));
	connect(alignCenterHorToolButton, SIGNAL(clicked()), this, SLOT(alignCenterHor()));
	connect(alignLeftInToolButton, SIGNAL(clicked()), this, SLOT(alignLeftIn()));
	connect(alignCenterVerToolButton, SIGNAL(clicked()), this, SLOT(alignCenterVer()));
	connect(alignTopOutToolButton, SIGNAL(clicked()), this, SLOT(alignTopOut()));
	connect(alignTopInToolButton, SIGNAL(clicked()), this, SLOT(alignTopIn()));
	connect(distributeDistHToolButton, SIGNAL(clicked()), this, SLOT(distributeDistH()));
	connect(distributeDistValueHToolButton, SIGNAL(clicked()), this, SLOT(distributeDistValH()));
	connect(distributeRightToolButton, SIGNAL(clicked()), this, SLOT(distributeRight()));
	connect(distributeBottomToolButton, SIGNAL(clicked()), this, SLOT(distributeBottom()));
	connect(distributeCenterHToolButton, SIGNAL(clicked()), this, SLOT(distributeCenterH()));
	connect(distributeDistVToolButton, SIGNAL(clicked()), this, SLOT(distributeDistV()));
	connect(distributeDistValueVToolButton, SIGNAL(clicked()), this, SLOT(distributeDistValV()));
	connect(distributeLeftToolButton, SIGNAL(clicked()), this, SLOT(distributeLeft()));
	connect(distributeCenterVToolButton, SIGNAL(clicked()), this, SLOT(distributeCenterV()));
	connect(distributeTopToolButton, SIGNAL(clicked()), this, SLOT(distributeTop()));
	connect(distributeAcrossPageToolButton, SIGNAL(clicked()), this, SLOT(distributeDistAcrossPage()));
	connect(distributeDownPageToolButton, SIGNAL(clicked()), this, SLOT(distributeDistDownPage()));
	connect(distributeAcrossMarginsToolButton, SIGNAL(clicked()), this, SLOT(distributeDistAcrossMargins()));
	connect(distributeDownMarginsToolButton, SIGNAL(clicked()), this, SLOT(distributeDistDownMargins()));
	connect(swapLeftToolButton, SIGNAL(clicked()), this, SLOT(swapLeft()));
	connect(swapRightToolButton, SIGNAL(clicked()), this, SLOT(swapRight()));
	
	alignRelativeToCombo->setCurrentIndex(0);
	alignToChanged(0);
	alignMethodChanged(0);
	connect(alignRelativeToCombo, SIGNAL(activated(int)), this, SLOT(alignToChanged(int)));
	connect(alignMoveOrResizeCombo, SIGNAL(activated(int)), this, SLOT(alignMethodChanged(int)));
	
	unitRatio=1.0;
	guideDirection=-1;
	
	guideInfoText = guideInfoTextNone;
	alignGuideLineEdit->setText(guideInfoTextNone);
}