Ejemplo n.º 1
0
ccColorScaleEditorDialog::ccColorScaleEditorDialog(ccColorScale::Shared currentScale/*=0*/, QWidget* parent/*=0*/)
	: QDialog(parent)
	, Ui::ColorScaleEditorDlg()
	, m_colorScale(currentScale)
	, m_scaleWidget(new ccColorScaleEditorWidget(this,Qt::Horizontal))
	, m_associatedSF(0)
	, m_modified(false)
	, m_minAbsoluteVal(0.0)
	, m_maxAbsoluteVal(1.0)
{
    setupUi(this);

	colorScaleEditorFrame->setLayout(new QHBoxLayout());
	colorScaleEditorFrame->layout()->setContentsMargins(0,0,0,0);
	colorScaleEditorFrame->layout()->addWidget(m_scaleWidget);

	//main combo box
	connect(rampComboBox, SIGNAL(activated(int)), this, SLOT(colorScaleChanged(int)));

	//upper buttons
	connect(renameToolButton,		SIGNAL(clicked()),				this,	SLOT(renameCurrentScale()));
	connect(saveToolButton,			SIGNAL(clicked()),				this,	SLOT(saveCurrentScale()));
	connect(deleteToolButton,		SIGNAL(clicked()),				this,	SLOT(deleteCurrentScale()));
	connect(copyToolButton,			SIGNAL(clicked()),				this,	SLOT(copyCurrentScale()));
	connect(newToolButton,			SIGNAL(clicked()),				this,	SLOT(createNewScale()));
	connect(scaleModeComboBox,		SIGNAL(activated(int)),			this,	SLOT(relativeModeChanged(int)));

	//scale widget
	connect(m_scaleWidget,			SIGNAL(stepSelected(int)),		this,	SLOT(onStepSelected(int)));
	connect(m_scaleWidget,			SIGNAL(stepModified(int)),		this,	SLOT(onStepModified(int)));

	//slider editor
	connect(deleteSliderToolButton,	SIGNAL(clicked()),				this,	SLOT(deletecSelectedStep()));
	connect(colorToolButton,		SIGNAL(clicked()),				this,	SLOT(changeSelectedStepColor()));
	connect(valueDoubleSpinBox,		SIGNAL(valueChanged(double)),	this,	SLOT(changeSelectedStepValue(double)));

	//close button
	connect(closePushButton,		SIGNAL(clicked()),				this,	SLOT(onClose()));

	//populate main combox box with all known scales
	updateMainComboBox();

	if (!m_colorScale)
		m_colorScale = ccColorScalesManager::GetDefaultScale();

	setActiveScale(m_colorScale);
}
Ejemplo n.º 2
0
ccColorScaleEditorDialog::ccColorScaleEditorDialog(	ccColorScalesManager* manager,
													ccMainAppInterface* mainApp,
													ccColorScale::Shared currentScale/*=0*/,
													QWidget* parent/*=0*/)
	: QDialog(parent)
	, Ui::ColorScaleEditorDlg()
	, m_manager(manager)
	, m_colorScale(currentScale)
	, m_scaleWidget(new ccColorScaleEditorWidget(this,Qt::Horizontal))
	, m_associatedSF(0)
	, m_modified(false)
	, m_minAbsoluteVal(0.0)
	, m_maxAbsoluteVal(1.0)
	, m_mainApp(mainApp)
{
	assert(m_manager);

	setupUi(this);

	colorScaleEditorFrame->setLayout(new QHBoxLayout());
	colorScaleEditorFrame->layout()->setContentsMargins(0,0,0,0);
	colorScaleEditorFrame->layout()->addWidget(m_scaleWidget);

	//main combo box
	connect(rampComboBox, SIGNAL(activated(int)), this, SLOT(colorScaleChanged(int)));

	//import/export buttons
	connect(exportToolButton,		SIGNAL(clicked()),				this,	SLOT(exportCurrentScale()));
	connect(importToolButton,		SIGNAL(clicked()),				this,	SLOT(importScale()));

	//upper buttons
	connect(renameToolButton,		SIGNAL(clicked()),				this,	SLOT(renameCurrentScale()));
	connect(saveToolButton,			SIGNAL(clicked()),				this,	SLOT(saveCurrentScale()));
	connect(deleteToolButton,		SIGNAL(clicked()),				this,	SLOT(deleteCurrentScale()));
	connect(copyToolButton,			SIGNAL(clicked()),				this,	SLOT(copyCurrentScale()));
	connect(newToolButton,			SIGNAL(clicked()),				this,	SLOT(createNewScale()));
	connect(scaleModeComboBox,		SIGNAL(activated(int)),			this,	SLOT(relativeModeChanged(int)));

	//scale widget
	connect(m_scaleWidget,			SIGNAL(stepSelected(int)),		this,	SLOT(onStepSelected(int)));
	connect(m_scaleWidget,			SIGNAL(stepModified(int)),		this,	SLOT(onStepModified(int)));

	//slider editor
	connect(deleteSliderToolButton,	SIGNAL(clicked()),				this,	SLOT(deletecSelectedStep()));
	connect(colorToolButton,		SIGNAL(clicked()),				this,	SLOT(changeSelectedStepColor()));
	connect(valueDoubleSpinBox,		SIGNAL(valueChanged(double)),	this,	SLOT(changeSelectedStepValue(double)));

	//labels list widget
	connect(customLabelsGroupBox,		SIGNAL(toggled(bool)),		this,	SLOT(toggleCustomLabelsList(bool)));
	connect(customLabelsPlainTextEdit,	SIGNAL(textChanged()),		this,	SLOT(onCustomLabelsListChanged()));

	//apply button
	connect(applyPushButton,		SIGNAL(clicked()),				this,	SLOT(onApply()));
	//close button
	connect(closePushButton,		SIGNAL(clicked()),				this,	SLOT(onClose()));

	//populate main combox box with all known scales
	updateMainComboBox();

	if (!m_colorScale)
		m_colorScale = m_manager->getDefaultScale(ccColorScalesManager::BGYR);

	setActiveScale(m_colorScale);
}