r20184 by fschmid - First version of an HLC Colorpicker

scribus-commit scribus-commit at lists.scribus.net
Sun Jun 21 19:29:16 UTC 2015


Author: fschmid
Date: Sun Jun 21 19:29:16 2015
New Revision: 20184

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=20184
Log:
First version of an HLC Colorpicker

Modified:
    trunk/Scribus/scribus/ui/cmykfw.cpp
    trunk/Scribus/scribus/ui/cmykfw.h
    trunk/Scribus/scribus/ui/cmykfwbase.ui
    trunk/Scribus/scribus/ui/colorchart.cpp
    trunk/Scribus/scribus/ui/colorchart.h

Modified: trunk/Scribus/scribus/ui/cmykfw.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20184&path=/trunk/Scribus/scribus/ui/cmykfw.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/cmykfw.cpp (original)
+++ trunk/Scribus/scribus/ui/cmykfw.cpp Sun Jun 21 19:29:16 2015
@@ -58,6 +58,7 @@
 	isNew = newCol;
 	dynamic = true;
 	Wsave = false;
+	isHLC = false;
 	EColors = Colors;
 	CurrSwatch.clear();
 	alertIcon = loadIcon("alert.png");
@@ -70,10 +71,6 @@
 	if ( ScColorEngine::isOutOfGamut(orig, m_doc) )
 		paintAlert(alertIcon, imageN, 2, 2, false);
 	Farbe = orig;
-	QPixmap image0 = sliderPix(180);
-	QPixmap image1 = sliderPix(300);
-	QPixmap image2 = sliderPix(60);
-	QPixmap image3 = sliderBlack();
 
 	resize( 498, 306 );
 	setWindowTitle( tr( "Edit Color" ) );
@@ -87,6 +84,7 @@
 	ComboBox1->addItem( tr( "RGB" ) );
 	ComboBox1->addItem( tr( "Web Safe RGB" ) );
 	ComboBox1->addItem( tr( "Lab" ) );
+	ComboBox1->addItem( tr( "HLC" ) );
 
 	Separations->setChecked(orig.isSpotColor());
 
@@ -114,32 +112,79 @@
 	// We set it in the dialog showEvent().
 	// Swatches->setCurrentComboItem( tr( "HSV Color Map" ));
 
-	slidersLayout->setSpacing(5);
-	slidersLayout->setMargin(0);
-
-	CyanP->setPixmap(image0);
 	CyanSp->setNewUnit(0);
 	CyanSp->setMinimum(0);
 	CyanSp->setMaximum(100);
 	CyanSp->setSuffix( tr(" %"));
 
-	MagentaP->setPixmap(image1);
+
+	CyanSL = new QSlider(this);
+	CyanSL->setObjectName(QStringLiteral("CyanSL"));
+	CyanSL->setMinimumSize(QSize(16, 255));
+	CyanSL->setAutoFillBackground(true);
+	CyanSL->setMinimum(0);
+	CyanSL->setMaximum(100);
+	CyanSL->setOrientation(Qt::Vertical);
+	CyanSL->setPalette(sliderPix(180));
+	cMenu = new QMenu("");
+	QWidgetAction *cAct = new QWidgetAction(this);
+	cAct->setDefaultWidget(CyanSL);
+	cMenu->addAction(cAct);
+	CyanP->setMenu(cMenu);
+
 	MagentaSp->setNewUnit(0);
 	MagentaSp->setMinimum(0);
 	MagentaSp->setMaximum(100);
 	MagentaSp->setSuffix( tr(" %"));
-
-	YellowP->setPixmap(image2);
+	MagentaSL = new QSlider(this);
+	MagentaSL->setObjectName(QStringLiteral("MagentaSL"));
+	MagentaSL->setMinimumSize(QSize(16, 255));
+	MagentaSL->setAutoFillBackground(true);
+	MagentaSL->setMinimum(0);
+	MagentaSL->setMaximum(100);
+	MagentaSL->setOrientation(Qt::Vertical);
+	MagentaSL->setPalette(sliderPix(300));
+	mMenu = new QMenu("");
+	QWidgetAction *mAct = new QWidgetAction(this);
+	mAct->setDefaultWidget(MagentaSL);
+	mMenu->addAction(mAct);
+	MagentaP->setMenu(mMenu);
+
 	YellowSp->setNewUnit(0);
 	YellowSp->setMinimum(0);
 	YellowSp->setMaximum(100);
 	YellowSp->setSuffix( tr(" %"));
-
-	BlackP->setPixmap(image3);
+	YellowSL = new QSlider(this);
+	YellowSL->setObjectName(QStringLiteral("YellowSL"));
+	YellowSL->setMinimumSize(QSize(16, 255));
+	YellowSL->setAutoFillBackground(true);
+	YellowSL->setMinimum(0);
+	YellowSL->setMaximum(100);
+	YellowSL->setOrientation(Qt::Vertical);
+	YellowSL->setPalette(sliderPix(60));
+	yMenu = new QMenu("");
+	QWidgetAction *yAct = new QWidgetAction(this);
+	yAct->setDefaultWidget(YellowSL);
+	yMenu->addAction(yAct);
+	YellowP->setMenu(yMenu);
+
 	BlackSp->setNewUnit(0);
 	BlackSp->setMinimum(0);
 	BlackSp->setMaximum(100);
 	BlackSp->setSuffix( tr(" %"));
+	BlackSL = new QSlider(this);
+	BlackSL->setObjectName(QStringLiteral("BlackSL"));
+	BlackSL->setMinimumSize(QSize(16, 255));
+	BlackSL->setAutoFillBackground(true);
+	BlackSL->setMinimum(0);
+	BlackSL->setMaximum(100);
+	BlackSL->setOrientation(Qt::Vertical);
+	BlackSL->setPalette(sliderBlack());
+	kMenu = new QMenu("");
+	QWidgetAction *bAct = new QWidgetAction(this);
+	bAct->setDefaultWidget(BlackSL);
+	kMenu->addAction(bAct);
+	BlackP->setMenu(kMenu);
 
 	if (orig.getColorModel () == colorModelCMYK)
 	{
@@ -157,11 +202,12 @@
 		YellowSp->setValue(cyd);
 		YellowSL->setValue(qRound(cyd * 1000));
 		BlackSp->setValue(ckd);
-		BlackSL->setValue(qRound(ckd));
+		BlackSL->setValue(qRound(ckd * 1000));
 		BlackComp = cmyk.k;
 	}
 	int h, s, v;
 	ScColorEngine::getRGBColor(orig, m_doc).getHsv(&h, &s, &v);
+	ColorMap->setFixedWidth(180);
 	ColorMap->drawPalette(v);
 	ColorMap->setMark(h, s);
 	Fnam = name;
@@ -231,6 +277,10 @@
 
 void CMYKChoose::setValSLiders(double value)
 {
+	disconnect( CyanSL, SIGNAL( valueChanged(int) ), this, SLOT( setColor() ) );
+	disconnect( MagentaSL, SIGNAL( valueChanged(int) ), this, SLOT( setColor() ) );
+	disconnect( YellowSL, SIGNAL( valueChanged(int) ), this, SLOT( setColor() ) );
+	disconnect( BlackSL, SIGNAL( valueChanged(int) ), this, SLOT( setColor() ) );
 	int val = qRound(value);
 	if (CyanSp == sender())
 		CyanSL->setValue(val * 1000);
@@ -240,6 +290,10 @@
 		YellowSL->setValue(val * 1000);
 	if (BlackSp == sender())
 		BlackSL->setValue(val * 1000);
+	connect( CyanSL, SIGNAL( valueChanged(int) ), this, SLOT( setColor() ) );
+	connect( MagentaSL, SIGNAL( valueChanged(int) ), this, SLOT( setColor() ) );
+	connect( YellowSL, SIGNAL( valueChanged(int) ), this, SLOT( setColor() ) );
+	connect( BlackSL, SIGNAL( valueChanged(int) ), this, SLOT( setColor() ) );
 }
 
 void CMYKChoose::slotRightClick()
@@ -279,18 +333,18 @@
 void CMYKChoose::toggleSL()
 {
 	dynamic = !dynamic;
-	CyanP->setPixmap(sliderPix(Farbe.getColorModel() == colorModelCMYK ? 180 : 0));
-	MagentaP->setPixmap(sliderPix(Farbe.getColorModel() == colorModelCMYK? 300 : 120));
-	YellowP->setPixmap(sliderPix(Farbe.getColorModel() == colorModelCMYK? 60 : 240));
+	CyanSL->setPalette(sliderPix(Farbe.getColorModel() == colorModelCMYK ? 180 : 0));
+	MagentaSL->setPalette(sliderPix(Farbe.getColorModel() == colorModelCMYK? 300 : 120));
+	YellowSL->setPalette(sliderPix(Farbe.getColorModel() == colorModelCMYK? 60 : 240));
 	if (Farbe.getColorModel() == colorModelCMYK)
-		BlackP->setPixmap(sliderBlack());
-}
-
-QPixmap CMYKChoose::sliderPix(int farbe)
+		BlackSL->setPalette(sliderBlack());
+}
+
+QPalette CMYKChoose::sliderPix(int farbe)
 {
 	RGBColor rgb;
 	CMYKColor cmyk;
-	QPixmap image0 = QPixmap(255,10);
+	QImage image0 = QImage(10, 255, QImage::Format_ARGB32);
 	QPainter p;
 	p.begin(&image0);
 	p.setPen(Qt::NoPen);
@@ -377,48 +431,106 @@
 			double L, a, b;
 			double val = static_cast<double>(x) / 255.0;
 			Farbe.getLab(&L, &a, &b);
-			if (dynamic)
+			if (isHLC)
 			{
-				switch (farbe)
+				QLineF lin;
+				lin.setP1(QPointF(0.0, 0.0));
+				lin.setP2(QPointF(a, b));
+				double H = lin.angle();
+				double C = lin.length();
+				double tmpA, tmpB;
+				if (dynamic)
 				{
-				case 0:
-					tmp = ScColorEngine::getDisplayColorGC(ScColor(100 * val, a, b), m_doc);
-					break;
-				case 120:
-					tmp = ScColorEngine::getDisplayColorGC(ScColor(L, 256 * val - 128.0, b), m_doc);
-					break;
-				case 240:
-					tmp = ScColorEngine::getDisplayColorGC(ScColor(L, a, 256 * val - 128.0), m_doc);
-					break;
+					switch (farbe)
+					{
+					case 0:
+						lin = QLineF::fromPolar(C, -360 * val);
+						tmpA = lin.p2().x();
+						tmpB = lin.p2().y();
+						tmp = ScColorEngine::getDisplayColorGC(ScColor(L, tmpA, tmpB), m_doc);
+						break;
+					case 120:
+						tmp = ScColorEngine::getDisplayColorGC(ScColor(100 * val, a, b), m_doc);
+						break;
+					case 240:
+						lin = QLineF::fromPolar(128 * val, H);
+						tmpA = lin.p2().x();
+						tmpB = lin.p2().y();
+						tmp = ScColorEngine::getDisplayColorGC(ScColor(L, tmpA, tmpB), m_doc);
+						break;
+					}
+					p.setBrush(tmp);
+				}
+				else
+				{
+					switch (farbe)
+					{
+					case 0:
+						lin = QLineF::fromPolar(128, -360 * val);
+						tmpA = lin.p2().x();
+						tmpB = lin.p2().y();
+						tmp = ScColorEngine::getDisplayColorGC(ScColor(100.0, tmpA, tmpB), m_doc);
+						break;
+					case 120:
+						tmp = ScColorEngine::getDisplayColorGC(ScColor(100 * val, 0.0, 0.0), m_doc);
+						break;
+					case 240:
+						lin = QLineF::fromPolar(128 * val, 0);
+						tmpA = lin.p2().x();
+						tmpB = lin.p2().y();
+						tmp = ScColorEngine::getDisplayColorGC(ScColor(100.0, tmpA, tmpB), m_doc);
+						break;
+					}
+					p.setBrush(tmp);
+				}
+			}
+			else
+			{
+				if (dynamic)
+				{
+					switch (farbe)
+					{
+					case 0:
+						tmp = ScColorEngine::getDisplayColorGC(ScColor(100 * val, a, b), m_doc);
+						break;
+					case 120:
+						tmp = ScColorEngine::getDisplayColorGC(ScColor(L, 256 * val - 128.0, b), m_doc);
+						break;
+					case 240:
+						tmp = ScColorEngine::getDisplayColorGC(ScColor(L, a, 256 * val - 128.0), m_doc);
+						break;
+					}
+					p.setBrush(tmp);
+				}
+				else
+				{
+					switch (farbe)
+					{
+					case 0:
+						tmp = ScColorEngine::getDisplayColorGC(ScColor(100 * val, 0.0, 0.0), m_doc);
+						break;
+					case 120:
+						tmp = ScColorEngine::getDisplayColorGC(ScColor(100.0, 256 * val - 128.0, 0.0), m_doc);
+						break;
+					case 240:
+						tmp = ScColorEngine::getDisplayColorGC(ScColor(100.0, 0.0, 256 * val - 128.0), m_doc);
+						break;
+					}
 				}
 				p.setBrush(tmp);
 			}
-			else
-			{
-				switch (farbe)
-				{
-				case 0:
-					tmp = ScColorEngine::getDisplayColorGC(ScColor(100 * val, 0.0, 0.0), m_doc);
-					break;
-				case 120:
-					tmp = ScColorEngine::getDisplayColorGC(ScColor(100.0, 256 * val - 128.0, 0.0), m_doc);
-					break;
-				case 240:
-					tmp = ScColorEngine::getDisplayColorGC(ScColor(100.0, 0.0, 256 * val - 128.0), m_doc);
-					break;
-				}
-				p.setBrush(tmp);
-			}
-		}
-		p.drawRect(x, 0, 5, 10);
+		}
+		p.drawRect(0, x, 10, 5);
 	}
 	p.end();
-	return image0;
-}
-
-QPixmap CMYKChoose::sliderBlack()
-{
-	QPixmap image0 = QPixmap(255,10);
+	QPalette pal;
+	pal.setBrush(QPalette::Window, QBrush(image0.mirrored(false, true)));
+	return pal;
+}
+
+QPalette CMYKChoose::sliderBlack()
+{
+	QImage image0 = QImage(10, 255, QImage::Format_ARGB32);
 	QPainter p;
 	int val = 255;
 	p.begin(&image0);
@@ -433,11 +545,13 @@
 			p.setBrush( ScColorEngine::getDisplayColorGC(ScColor(c, m, y, x), m_doc) );
 		else
 			p.setBrush( ScColorEngine::getDisplayColorGC(ScColor(0, 0, 0, x), m_doc) );
-		p.drawRect(x, 0, 5, 10);
+		p.drawRect(0, x, 10, 5);
 		val -= 5;
 	}
 	p.end();
-	return image0;
+	QPalette pal;
+	pal.setBrush(QPalette::Window, QBrush(image0.mirrored(false, true)));
+	return pal;
 }
 
 void CMYKChoose::selSwatch()
@@ -506,21 +620,26 @@
 	disconnect( MagentaSL, SIGNAL( valueChanged(int) ), this, SLOT( setColor() ) );
 	disconnect( YellowSL, SIGNAL( valueChanged(int) ), this, SLOT( setColor() ) );
 	disconnect( BlackSL, SIGNAL( valueChanged(int) ), this, SLOT( setColor() ) );
+	isHLC = false;
 	if (mod == tr("CMYK"))
 	{
 		Wsave = false;
 		CyanSL->setMaximum( 100 * 1000.0);
 		MagentaSL->setMaximum( 100 * 1000.0 );
 		YellowSL->setMaximum( 100 * 1000.0 );
+		BlackSL->setMaximum( 100 * 1000.0);
+		CyanSL->setMinimum( 0 * 1000.0 );
 		CyanSp->setMaximum( 100 );
 		MagentaSp->setMaximum( 100);
 		YellowSp->setMaximum( 100 );
 		CyanSL->setSingleStep(1 * 1000.0);
 		MagentaSL->setSingleStep(1 * 1000.0);
 		YellowSL->setSingleStep(1 * 1000.0);
+		BlackSL->setSingleStep(1 * 1000.0);
 		CyanSL->setPageStep(10 * 1000.0);
 		MagentaSL->setPageStep(10 * 1000.0);
 		YellowSL->setPageStep(10 * 1000.0);
+		BlackSL->setPageStep(10 * 1000.0);
 		CyanSp->setDecimals(1);
 		MagentaSp->setDecimals(1);
 		YellowSp->setDecimals(1);
@@ -535,21 +654,23 @@
 		MagentaT->setText( tr("M:"));
 		YellowT->setText( tr("Y:"));
 		BlackP->show();
-		BlackSL->show();
 		BlackSp->show();
 		BlackT->show();
-		Farbe = ScColorEngine::convertToModel(Farbe, m_doc, colorModelCMYK);
-		CyanP->setPixmap(sliderPix(180));
-		MagentaP->setPixmap(sliderPix(300));
-		YellowP->setPixmap(sliderPix(60));
-		BlackP->setPixmap(sliderBlack());
-		ColorMap->isLabMode = false;
+		if (Farbe.getColorModel() != colorModelCMYK)
+			Farbe = ScColorEngine::convertToModel(Farbe, m_doc, colorModelCMYK);
+		CyanSL->setPalette(sliderPix(180));
+		MagentaSL->setPalette(sliderPix(300));
+		YellowSL->setPalette(sliderPix(60));
+		BlackSL->setPalette(sliderBlack());
+		ColorMap->drawMode = 0;
+		ColorMap->setFixedWidth(180);
 		setValues();
 	}
 	else if ((mod == tr("Web Safe RGB")) || (mod == tr("RGB")))
 	{
 		Wsave = false;
 		CyanSL->setMaximum( 255 * 1000.0 );
+		CyanSL->setMinimum( 0 * 1000.0 );
 		MagentaSL->setMaximum( 255 * 1000.0 );
 		YellowSL->setMaximum( 255 * 1000.0 );
 		CyanSL->setSingleStep(1 * 1000.0);
@@ -573,9 +694,7 @@
 		CyanT->setText( tr("R:"));
 		MagentaT->setText( tr("G:"));
 		YellowT->setText( tr("B:"));
-		slidersLayout->setSizeConstraint(QLayout::SetFixedSize);
 		BlackP->hide();
-		BlackSL->hide();
 		BlackSp->hide();
 		BlackT->hide();
 		if (mod == tr("Web Safe RGB"))
@@ -591,11 +710,13 @@
 			MagentaSp->setSingleStep(51);
 			YellowSp->setSingleStep(51);
 		}
-		Farbe = ScColorEngine::convertToModel(Farbe, m_doc, colorModelRGB);
-		CyanP->setPixmap(sliderPix(0));
-		MagentaP->setPixmap(sliderPix(120));
-		YellowP->setPixmap(sliderPix(240));
-		ColorMap->isLabMode = false;
+		if (Farbe.getColorModel() != colorModelRGB)
+			Farbe = ScColorEngine::convertToModel(Farbe, m_doc, colorModelRGB);
+		CyanSL->setPalette(sliderPix(0));
+		MagentaSL->setPalette(sliderPix(120));
+		YellowSL->setPalette(sliderPix(240));
+		ColorMap->drawMode = 0;
+		ColorMap->setFixedWidth(180);
 		setValues();
 	}
 	else if (mod == tr("Lab"))
@@ -604,6 +725,7 @@
 		CyanSL->setSingleStep(1 * 1000.0);
 		CyanSL->setPageStep(10 * 1000.0);
 		CyanSL->setMaximum( 100 * 1000.0 );
+		CyanSL->setMinimum( 0 * 1000.0 );
 		MagentaSL->setSingleStep(1 * 1000.0);
 		MagentaSL->setPageStep(10 * 1000.0);
 		MagentaSL->setMaximum( 128 * 1000.0 );
@@ -634,19 +756,73 @@
 		MagentaT->setText( tr("a:"));
 		YellowT->setText( tr("b:"));
 
-		slidersLayout->setSizeConstraint(QLayout::SetFixedSize);
 		BlackP->hide();
-		BlackSL->hide();
 		BlackSp->hide();
 		BlackT->hide();
-		Farbe = ScColorEngine::convertToModel(Farbe, m_doc, colorModelLab);
-		CyanP->setPixmap(sliderPix(0));
-		MagentaP->setPixmap(sliderPix(120));
-		YellowP->setPixmap(sliderPix(240));
+		if (Farbe.getColorModel() != colorModelLab)
+			Farbe = ScColorEngine::convertToModel(Farbe, m_doc, colorModelLab);
+		CyanSL->setPalette(sliderPix(0));
+		MagentaSL->setPalette(sliderPix(120));
+		YellowSL->setPalette(sliderPix(240));
 		setValues();
-		ColorMap->isLabMode = true;
+		ColorMap->drawMode = 1;
+		ColorMap->setFixedWidth(180);
 		ColorMap->drawPalette(CyanSp->value() * 2.55);
 		ColorMap->setMark(MagentaSp->value(), YellowSp->value());
+	}
+	else if (mod == tr("HLC"))
+	{
+		Wsave = false;
+		CyanSL->setSingleStep(1 * 1000.0);
+		CyanSL->setPageStep(10 * 1000.0);
+		CyanSL->setMaximum( 360 * 1000.0 );
+		CyanSL->setMinimum( 0 * 1000.0 );
+		MagentaSL->setSingleStep(1 * 1000.0);
+		MagentaSL->setPageStep(10 * 1000.0);
+		MagentaSL->setMaximum( 100 * 1000.0 );
+		MagentaSL->setMinimum( 0 * 1000.0 );
+		YellowSL->setSingleStep(1 * 1000.0);
+		YellowSL->setPageStep(10 * 1000.0);
+		YellowSL->setMaximum( 128 * 1000.0 );
+		YellowSL->setMinimum( 0 * 1000.0 );
+
+		CyanSp->setDecimals(2);
+		CyanSp->setSingleStep(1);
+		CyanSp->setMaximum( 360 );
+		CyanSp->setSuffix( tr(""));
+
+		MagentaSp->setDecimals(2);
+		MagentaSp->setSingleStep(1);
+		MagentaSp->setMaximum( 100);
+		MagentaSp->setMinimum( 0 );
+		MagentaSp->setSuffix("");
+
+		YellowSp->setDecimals(2);
+		YellowSp->setMaximum( 128 );
+		YellowSp->setMinimum( 0 );
+		YellowSp->setSingleStep(1);
+		YellowSp->setSuffix("");
+
+		CyanT->setText( tr("H:"));
+		MagentaT->setText( tr("L:"));
+		YellowT->setText( tr("C:"));
+
+		BlackP->hide();
+		BlackSp->hide();
+		BlackT->hide();
+		if (Farbe.getColorModel() != colorModelLab)
+			Farbe = ScColorEngine::convertToModel(Farbe, m_doc, colorModelLab);
+		isHLC = true;
+		CyanSL->setPalette(sliderPix(0));
+		MagentaSL->setPalette(sliderPix(120));
+		YellowSL->setPalette(sliderPix(240));
+		setValues();
+		ColorMap->drawMode = 2;
+		ColorMap->setFixedWidth(128);
+		double L, a, b;
+		Farbe.getLab(&L, &a, &b);
+		ColorMap->drawPalette(L * 2.55);
+		ColorMap->setMark(a, b);
 	}
 	imageN.fill( ScColorEngine::getDisplayColor(Farbe, m_doc) );
 	if (ScColorEngine::isOutOfGamut(Farbe, m_doc))
@@ -686,10 +862,10 @@
 		Farbe = tmp;
 		if (dynamic)
 		{
-			CyanP->setPixmap(sliderPix(180));
-			MagentaP->setPixmap(sliderPix(300));
-			YellowP->setPixmap(sliderPix(60));
-			BlackP->setPixmap(sliderBlack());
+			CyanSL->setPalette(sliderPix(180));
+			MagentaSL->setPalette(sliderPix(300));
+			YellowSL->setPalette(sliderPix(60));
+			BlackSL->setPalette(sliderBlack());
 		}
 		BlackComp = k;
 		ScColorEngine::getRGBColor(tmp, m_doc).getHsv(&h, &s, &v);
@@ -723,9 +899,9 @@
 		Farbe = tmp;
 		if (dynamic)
 		{
-			CyanP->setPixmap(sliderPix(0));
-			MagentaP->setPixmap(sliderPix(120));
-			YellowP->setPixmap(sliderPix(240));
+			CyanSL->setPalette(sliderPix(0));
+			MagentaSL->setPalette(sliderPix(120));
+			YellowSL->setPalette(sliderPix(240));
 		}
 		BlackComp = k;
 		ScColorEngine::getRGBColor(tmp, m_doc).getHsv(&h, &s, &v);
@@ -736,16 +912,28 @@
 	{
 		double Lalt;
 		Farbe.getLab(&Lalt, &a, &b);
-		L = CyanSp->value();
-		a = MagentaSp->value();
-		b = YellowSp->value();
+		if (isHLC)
+		{
+			L = MagentaSp->value();
+			double cv = 360 - CyanSp->value();
+			double yv = YellowSp->value();
+			QLineF lin = QLineF::fromPolar(yv, cv);
+			a = lin.p2().x();
+			b = lin.p2().y();
+		}
+		else
+		{
+			L = CyanSp->value();
+			a = MagentaSp->value();
+			b = YellowSp->value();
+		}
 		tmp.setColor(L, a, b);
 		Farbe = tmp;
 		if (dynamic)
 		{
-			CyanP->setPixmap(sliderPix(0));
-			MagentaP->setPixmap(sliderPix(120));
-			YellowP->setPixmap(sliderPix(240));
+			CyanSL->setPalette(sliderPix(0));
+			MagentaSL->setPalette(sliderPix(120));
+			YellowSL->setPalette(sliderPix(240));
 		}
 		BlackComp = qRound(L * 2.55);
 		if (L != Lalt)
@@ -763,7 +951,10 @@
 	ScColor tmp;
 	if (Farbe.getColorModel() == colorModelLab)
 	{
-		tmp = ScColor(CyanSp->value(), static_cast<double>(h), static_cast<double>(s));
+		if (isHLC)
+			tmp = ScColor(MagentaSp->value(), static_cast<double>(h), static_cast<double>(s));
+		else
+			tmp = ScColor(CyanSp->value(), static_cast<double>(h), static_cast<double>(s));
 	}
 	else
 	{
@@ -848,10 +1039,10 @@
 		BlackSL->setValue(qRound(ck / 2.55) * 1000.0);
 		if (dynamic)
 		{
-			CyanP->setPixmap(sliderPix(180));
-			MagentaP->setPixmap(sliderPix(300));
-			YellowP->setPixmap(sliderPix(60));
-			BlackP->setPixmap(sliderBlack());
+			CyanSL->setPalette(sliderPix(180));
+			MagentaSL->setPalette(sliderPix(300));
+			YellowSL->setPalette(sliderPix(60));
+			BlackSL->setPalette(sliderBlack());
 		}
 	}
 	else if (Farbe.getColorModel() == colorModelRGB)
@@ -871,26 +1062,41 @@
 		BlackComp = 255 - v;
 		if (dynamic)
 		{
-			CyanP->setPixmap(sliderPix(0));
-			MagentaP->setPixmap(sliderPix(120));
-			YellowP->setPixmap(sliderPix(240));
+			CyanSL->setPalette(sliderPix(0));
+			MagentaSL->setPalette(sliderPix(120));
+			YellowSL->setPalette(sliderPix(240));
 		}
 	}
 	else if (Farbe.getColorModel() == colorModelLab)
 	{
 		double L, a, b;
 		Farbe.getLab(&L, &a, &b);
-		CyanSp->setValue(L);
-		CyanSL->setValue(L * 1000.0);
-		MagentaSp->setValue(a);
-		MagentaSL->setValue(a * 1000.0);
-		YellowSp->setValue(b);
-		YellowSL->setValue(b * 1000.0);
+		if (isHLC)
+		{
+			MagentaSp->setValue(L);
+			MagentaSL->setValue(L * 1000.0);
+			QLineF lin;
+			lin.setP1(QPointF(0.0, 0.0));
+			lin.setP2(QPointF(a, b));
+			CyanSp->setValue(360 - lin.angle());
+			CyanSL->setValue(360 - lin.angle() * 1000.0);
+			YellowSp->setValue(lin.length());
+			YellowSL->setValue(lin.length() * 1000.0);
+		}
+		else
+		{
+			CyanSp->setValue(L);
+			CyanSL->setValue(L * 1000.0);
+			MagentaSp->setValue(a);
+			MagentaSL->setValue(a * 1000.0);
+			YellowSp->setValue(b);
+			YellowSL->setValue(b * 1000.0);
+		}
 		if (dynamic)
 		{
-			CyanP->setPixmap(sliderPix(0));
-			MagentaP->setPixmap(sliderPix(120));
-			YellowP->setPixmap(sliderPix(240));
+			CyanSL->setPalette(sliderPix(0));
+			MagentaSL->setPalette(sliderPix(120));
+			YellowSL->setPalette(sliderPix(240));
 		}
 	}
 	CyanSp->blockSignals(false);

Modified: trunk/Scribus/scribus/ui/cmykfw.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20184&path=/trunk/Scribus/scribus/ui/cmykfw.h
==============================================================================
--- trunk/Scribus/scribus/ui/cmykfw.h (original)
+++ trunk/Scribus/scribus/ui/cmykfw.h Sun Jun 21 19:29:16 2015
@@ -64,11 +64,20 @@
 	QTreeWidgetItem *userSwatches;
 	QTreeWidgetItem *hsvSelector;
 	QStringList customColSet;
+	QMenu *cMenu;
+	QMenu *mMenu;
+	QMenu *yMenu;
+	QMenu *kMenu;
+	QSlider *CyanSL;
+	QSlider *MagentaSL;
+	QSlider *YellowSL;
+	QSlider *BlackSL;
+	bool isHLC;
 	
 	virtual void showEvent(QShowEvent * event);
 
-	QPixmap sliderPix(int farbe);
-	QPixmap sliderBlack();
+	QPalette sliderPix(int farbe);
+	QPalette sliderBlack();
 };
 
 #endif // CMYKFARBEN_H

Modified: trunk/Scribus/scribus/ui/cmykfwbase.ui
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20184&path=/trunk/Scribus/scribus/ui/cmykfwbase.ui
==============================================================================
--- trunk/Scribus/scribus/ui/cmykfwbase.ui (original)
+++ trunk/Scribus/scribus/ui/cmykfwbase.ui Sun Jun 21 19:29:16 2015
@@ -6,29 +6,14 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>652</width>
-    <height>361</height>
+    <width>497</width>
+    <height>317</height>
    </rect>
   </property>
   <property name="windowTitle">
    <string>Edit Color</string>
   </property>
   <layout class="QHBoxLayout" name="horizontalLayout">
-   <property name="spacing">
-    <number>5</number>
-   </property>
-   <property name="leftMargin">
-    <number>10</number>
-   </property>
-   <property name="topMargin">
-    <number>10</number>
-   </property>
-   <property name="rightMargin">
-    <number>10</number>
-   </property>
-   <property name="bottomMargin">
-    <number>10</number>
-   </property>
    <item>
     <layout class="QVBoxLayout" name="verticalLayout">
      <item>
@@ -97,116 +82,6 @@
       </spacer>
      </item>
      <item>
-      <layout class="QGridLayout" name="gridLayout">
-       <item row="0" column="1">
-        <widget class="QLabel" name="label_4">
-         <property name="minimumSize">
-          <size>
-           <width>50</width>
-           <height>22</height>
-          </size>
-         </property>
-         <property name="maximumSize">
-          <size>
-           <width>100</width>
-           <height>22</height>
-          </size>
-         </property>
-         <property name="text">
-          <string>New</string>
-         </property>
-         <property name="alignment">
-          <set>Qt::AlignCenter</set>
-         </property>
-        </widget>
-       </item>
-       <item row="0" column="0">
-        <widget class="QLabel" name="label_3">
-         <property name="minimumSize">
-          <size>
-           <width>50</width>
-           <height>22</height>
-          </size>
-         </property>
-         <property name="maximumSize">
-          <size>
-           <width>100</width>
-           <height>22</height>
-          </size>
-         </property>
-         <property name="text">
-          <string>Old</string>
-         </property>
-         <property name="alignment">
-          <set>Qt::AlignCenter</set>
-         </property>
-        </widget>
-       </item>
-       <item row="1" column="0">
-        <widget class="QLabel" name="OldC">
-         <property name="minimumSize">
-          <size>
-           <width>50</width>
-           <height>50</height>
-          </size>
-         </property>
-         <property name="maximumSize">
-          <size>
-           <width>50</width>
-           <height>50</height>
-          </size>
-         </property>
-         <property name="frameShape">
-          <enum>QFrame::WinPanel</enum>
-         </property>
-         <property name="frameShadow">
-          <enum>QFrame::Sunken</enum>
-         </property>
-         <property name="text">
-          <string/>
-         </property>
-         <property name="scaledContents">
-          <bool>true</bool>
-         </property>
-         <property name="alignment">
-          <set>Qt::AlignCenter</set>
-         </property>
-        </widget>
-       </item>
-       <item row="1" column="1">
-        <widget class="QLabel" name="NewC">
-         <property name="minimumSize">
-          <size>
-           <width>50</width>
-           <height>50</height>
-          </size>
-         </property>
-         <property name="maximumSize">
-          <size>
-           <width>50</width>
-           <height>50</height>
-          </size>
-         </property>
-         <property name="frameShape">
-          <enum>QFrame::WinPanel</enum>
-         </property>
-         <property name="frameShadow">
-          <enum>QFrame::Sunken</enum>
-         </property>
-         <property name="text">
-          <string/>
-         </property>
-         <property name="scaledContents">
-          <bool>true</bool>
-         </property>
-         <property name="alignment">
-          <set>Qt::AlignCenter</set>
-         </property>
-        </widget>
-       </item>
-      </layout>
-     </item>
-     <item>
       <layout class="QHBoxLayout" name="horizontalLayout_5">
        <property name="spacing">
         <number>20</number>
@@ -245,478 +120,393 @@
     </layout>
    </item>
    <item>
-    <widget class="QFrame" name="frame">
-     <property name="frameShape">
-      <enum>QFrame::NoFrame</enum>
-     </property>
-     <property name="frameShadow">
-      <enum>QFrame::Raised</enum>
-     </property>
-     <layout class="QVBoxLayout" name="verticalLayout_2">
-      <property name="spacing">
-       <number>5</number>
-      </property>
-      <property name="leftMargin">
-       <number>0</number>
-      </property>
-      <property name="topMargin">
-       <number>0</number>
-      </property>
-      <property name="rightMargin">
-       <number>0</number>
-      </property>
-      <property name="bottomMargin">
-       <number>0</number>
-      </property>
-      <item>
-       <widget class="SwatchCombo" name="Swatches">
-        <property name="sizePolicy">
-         <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
-          <horstretch>0</horstretch>
-          <verstretch>0</verstretch>
-         </sizepolicy>
-        </property>
-        <property name="text">
-         <string/>
-        </property>
-        <property name="popupMode">
-         <enum>QToolButton::MenuButtonPopup</enum>
-        </property>
+    <layout class="QVBoxLayout" name="verticalLayout_2">
+     <item>
+      <widget class="SwatchCombo" name="Swatches">
+       <property name="sizePolicy">
+        <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+         <horstretch>0</horstretch>
+         <verstretch>0</verstretch>
+        </sizepolicy>
+       </property>
+       <property name="text">
+        <string/>
+       </property>
+       <property name="popupMode">
+        <enum>QToolButton::MenuButtonPopup</enum>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QStackedWidget" name="TabStack">
+       <property name="frameShape">
+        <enum>QFrame::NoFrame</enum>
+       </property>
+       <property name="currentIndex">
+        <number>0</number>
+       </property>
+       <widget class="QWidget" name="page">
+        <layout class="QHBoxLayout" name="horizontalLayout_6">
+         <property name="spacing">
+          <number>0</number>
+         </property>
+         <property name="leftMargin">
+          <number>0</number>
+         </property>
+         <property name="topMargin">
+          <number>0</number>
+         </property>
+         <property name="rightMargin">
+          <number>0</number>
+         </property>
+         <property name="bottomMargin">
+          <number>0</number>
+         </property>
+         <item alignment="Qt::AlignHCenter|Qt::AlignVCenter">
+          <widget class="QFrame" name="frame_2">
+           <property name="frameShape">
+            <enum>QFrame::NoFrame</enum>
+           </property>
+           <property name="frameShadow">
+            <enum>QFrame::Sunken</enum>
+           </property>
+           <layout class="QVBoxLayout" name="verticalLayout_3">
+            <item>
+             <widget class="QFrame" name="frame_3">
+              <property name="minimumSize">
+               <size>
+                <width>182</width>
+                <height>130</height>
+               </size>
+              </property>
+              <property name="maximumSize">
+               <size>
+                <width>182</width>
+                <height>130</height>
+               </size>
+              </property>
+              <property name="frameShape">
+               <enum>QFrame::WinPanel</enum>
+              </property>
+              <property name="frameShadow">
+               <enum>QFrame::Sunken</enum>
+              </property>
+              <layout class="QHBoxLayout" name="horizontalLayout_7">
+               <property name="spacing">
+                <number>0</number>
+               </property>
+               <property name="leftMargin">
+                <number>0</number>
+               </property>
+               <property name="topMargin">
+                <number>0</number>
+               </property>
+               <property name="rightMargin">
+                <number>0</number>
+               </property>
+               <property name="bottomMargin">
+                <number>0</number>
+               </property>
+               <item>
+                <widget class="ColorChart" name="ColorMap" native="true">
+                 <property name="minimumSize">
+                  <size>
+                   <width>128</width>
+                   <height>128</height>
+                  </size>
+                 </property>
+                 <property name="maximumSize">
+                  <size>
+                   <width>180</width>
+                   <height>128</height>
+                  </size>
+                 </property>
+                </widget>
+               </item>
+              </layout>
+             </widget>
+            </item>
+           </layout>
+          </widget>
+         </item>
+        </layout>
        </widget>
-      </item>
-      <item>
-       <widget class="QStackedWidget" name="TabStack">
-        <property name="frameShape">
-         <enum>QFrame::NoFrame</enum>
-        </property>
-        <property name="currentIndex">
-         <number>0</number>
-        </property>
-        <widget class="QWidget" name="page">
-         <layout class="QHBoxLayout" name="horizontalLayout_6">
-          <property name="spacing">
-           <number>0</number>
-          </property>
-          <property name="leftMargin">
-           <number>0</number>
-          </property>
-          <property name="topMargin">
-           <number>0</number>
-          </property>
-          <property name="rightMargin">
-           <number>0</number>
-          </property>
-          <property name="bottomMargin">
-           <number>0</number>
-          </property>
-          <item alignment="Qt::AlignHCenter|Qt::AlignVCenter">
-           <widget class="QFrame" name="frame_2">
-            <property name="frameShape">
-             <enum>QFrame::NoFrame</enum>
-            </property>
-            <property name="frameShadow">
-             <enum>QFrame::Sunken</enum>
-            </property>
-            <layout class="QVBoxLayout" name="verticalLayout_3">
-             <item>
-              <widget class="QFrame" name="frame_3">
-               <property name="minimumSize">
-                <size>
-                 <width>182</width>
-                 <height>130</height>
-                </size>
-               </property>
-               <property name="maximumSize">
-                <size>
-                 <width>182</width>
-                 <height>130</height>
-                </size>
-               </property>
-               <property name="frameShape">
-                <enum>QFrame::WinPanel</enum>
-               </property>
-               <property name="frameShadow">
-                <enum>QFrame::Sunken</enum>
-               </property>
-               <layout class="QHBoxLayout" name="horizontalLayout_7">
-                <property name="spacing">
-                 <number>0</number>
-                </property>
-                <property name="leftMargin">
-                 <number>0</number>
-                </property>
-                <property name="topMargin">
-                 <number>0</number>
-                </property>
-                <property name="rightMargin">
-                 <number>0</number>
-                </property>
-                <property name="bottomMargin">
-                 <number>0</number>
-                </property>
-                <item>
-                 <widget class="ColorChart" name="ColorMap" native="true">
-                  <property name="minimumSize">
-                   <size>
-                    <width>180</width>
-                    <height>128</height>
-                   </size>
-                  </property>
-                  <property name="maximumSize">
-                   <size>
-                    <width>180</width>
-                    <height>128</height>
-                   </size>
-                  </property>
-                 </widget>
-                </item>
-               </layout>
-              </widget>
-             </item>
-            </layout>
-           </widget>
-          </item>
-         </layout>
-        </widget>
-        <widget class="QWidget" name="page_2">
-         <layout class="QHBoxLayout" name="horizontalLayout_2">
-          <property name="spacing">
-           <number>0</number>
-          </property>
-          <property name="leftMargin">
-           <number>0</number>
-          </property>
-          <property name="topMargin">
-           <number>0</number>
-          </property>
-          <property name="rightMargin">
-           <number>0</number>
-          </property>
-          <property name="bottomMargin">
-           <number>0</number>
-          </property>
-          <item>
-           <widget class="ColorListBox" name="ColorSwatch"/>
-          </item>
-         </layout>
-        </widget>
+       <widget class="QWidget" name="page_2">
+        <layout class="QHBoxLayout" name="horizontalLayout_2">
+         <property name="spacing">
+          <number>0</number>
+         </property>
+         <property name="leftMargin">
+          <number>0</number>
+         </property>
+         <property name="topMargin">
+          <number>0</number>
+         </property>
+         <property name="rightMargin">
+          <number>0</number>
+         </property>
+         <property name="bottomMargin">
+          <number>0</number>
+         </property>
+         <item>
+          <widget class="ColorListBox" name="ColorSwatch"/>
+         </item>
+        </layout>
        </widget>
-      </item>
-      <item>
-       <layout class="QGridLayout" name="slidersLayout">
-        <item row="2" column="1">
-         <layout class="QVBoxLayout" name="verticalLayout_6">
-          <property name="spacing">
-           <number>0</number>
-          </property>
-          <property name="leftMargin">
-           <number>0</number>
-          </property>
-          <property name="topMargin">
-           <number>0</number>
-          </property>
-          <property name="rightMargin">
-           <number>0</number>
-          </property>
-          <property name="bottomMargin">
-           <number>0</number>
-          </property>
-          <item>
-           <widget class="QLabel" name="YellowP">
-            <property name="minimumSize">
-             <size>
-              <width>200</width>
-              <height>10</height>
-             </size>
-            </property>
-            <property name="text">
-             <string/>
-            </property>
-            <property name="scaledContents">
-             <bool>true</bool>
-            </property>
-           </widget>
-          </item>
-          <item>
-           <widget class="QSlider" name="YellowSL">
-            <property name="minimumSize">
-             <size>
-              <width>200</width>
-              <height>16</height>
-             </size>
-            </property>
-            <property name="minimum">
-             <number>0</number>
-            </property>
-            <property name="maximum">
-             <number>100</number>
-            </property>
-            <property name="orientation">
-             <enum>Qt::Horizontal</enum>
-            </property>
-           </widget>
-          </item>
-         </layout>
-        </item>
-        <item row="0" column="1">
-         <layout class="QVBoxLayout" name="verticalLayout_4">
-          <property name="spacing">
-           <number>0</number>
-          </property>
-          <property name="leftMargin">
-           <number>0</number>
-          </property>
-          <property name="topMargin">
-           <number>0</number>
-          </property>
-          <property name="rightMargin">
-           <number>0</number>
-          </property>
-          <property name="bottomMargin">
-           <number>0</number>
-          </property>
-          <item>
-           <widget class="QLabel" name="CyanP">
-            <property name="minimumSize">
-             <size>
-              <width>200</width>
-              <height>10</height>
-             </size>
-            </property>
-            <property name="text">
-             <string/>
-            </property>
-            <property name="scaledContents">
-             <bool>true</bool>
-            </property>
-           </widget>
-          </item>
-          <item>
-           <widget class="QSlider" name="CyanSL">
-            <property name="minimumSize">
-             <size>
-              <width>200</width>
-              <height>16</height>
-             </size>
-            </property>
-            <property name="minimum">
-             <number>0</number>
-            </property>
-            <property name="maximum">
-             <number>100</number>
-            </property>
-            <property name="orientation">
-             <enum>Qt::Horizontal</enum>
-            </property>
-           </widget>
-          </item>
-         </layout>
-        </item>
-        <item row="2" column="0">
-         <widget class="QLabel" name="YellowT">
-          <property name="text">
-           <string>Y:</string>
-          </property>
-         </widget>
-        </item>
-        <item row="0" column="2">
-         <widget class="ScrSpinBox" name="CyanSp">
-          <property name="suffix">
-           <string> %</string>
-          </property>
-          <property name="minimum">
-           <double>0.000000000000000</double>
-          </property>
-          <property name="maximum">
-           <double>100.000000000000000</double>
-          </property>
-         </widget>
-        </item>
-        <item row="2" column="2">
-         <widget class="ScrSpinBox" name="YellowSp">
-          <property name="suffix">
-           <string> %</string>
-          </property>
-          <property name="minimum">
-           <double>0.000000000000000</double>
-          </property>
-          <property name="maximum">
-           <double>100.000000000000000</double>
-          </property>
-         </widget>
-        </item>
-        <item row="1" column="0">
-         <widget class="QLabel" name="MagentaT">
-          <property name="text">
-           <string>M:</string>
-          </property>
-         </widget>
-        </item>
-        <item row="1" column="2">
-         <widget class="ScrSpinBox" name="MagentaSp">
-          <property name="suffix">
-           <string> %</string>
-          </property>
-          <property name="minimum">
-           <double>0.000000000000000</double>
-          </property>
-          <property name="maximum">
-           <double>100.000000000000000</double>
-          </property>
-         </widget>
-        </item>
-        <item row="0" column="0">
-         <widget class="QLabel" name="CyanT">
-          <property name="text">
-           <string>C:</string>
-          </property>
-         </widget>
-        </item>
-        <item row="1" column="1">
-         <layout class="QVBoxLayout" name="verticalLayout_5">
-          <property name="spacing">
-           <number>0</number>
-          </property>
-          <property name="leftMargin">
-           <number>0</number>
-          </property>
-          <property name="topMargin">
-           <number>0</number>
-          </property>
-          <property name="rightMargin">
-           <number>0</number>
-          </property>
-          <property name="bottomMargin">
-           <number>0</number>
-          </property>
-          <item>
-           <widget class="QLabel" name="MagentaP">
-            <property name="minimumSize">
-             <size>
-              <width>200</width>
-              <height>10</height>
-             </size>
-            </property>
-            <property name="text">
-             <string/>
-            </property>
-            <property name="scaledContents">
-             <bool>true</bool>
-            </property>
-           </widget>
-          </item>
-          <item>
-           <widget class="QSlider" name="MagentaSL">
-            <property name="minimumSize">
-             <size>
-              <width>200</width>
-              <height>16</height>
-             </size>
-            </property>
-            <property name="minimum">
-             <number>0</number>
-            </property>
-            <property name="maximum">
-             <number>100</number>
-            </property>
-            <property name="orientation">
-             <enum>Qt::Horizontal</enum>
-            </property>
-           </widget>
-          </item>
-         </layout>
-        </item>
-        <item row="3" column="0">
-         <widget class="QLabel" name="BlackT">
-          <property name="text">
-           <string>K:</string>
-          </property>
-         </widget>
-        </item>
-        <item row="3" column="1">
-         <layout class="QVBoxLayout" name="verticalLayout_7">
-          <property name="spacing">
-           <number>0</number>
-          </property>
-          <property name="leftMargin">
-           <number>0</number>
-          </property>
-          <property name="topMargin">
-           <number>0</number>
-          </property>
-          <property name="rightMargin">
-           <number>0</number>
-          </property>
-          <property name="bottomMargin">
-           <number>0</number>
-          </property>
-          <item>
-           <widget class="QLabel" name="BlackP">
-            <property name="minimumSize">
-             <size>
-              <width>200</width>
-              <height>10</height>
-             </size>
-            </property>
-            <property name="text">
-             <string/>
-            </property>
-            <property name="scaledContents">
-             <bool>true</bool>
-            </property>
-           </widget>
-          </item>
-          <item>
-           <widget class="QSlider" name="BlackSL">
-            <property name="minimumSize">
-             <size>
-              <width>200</width>
-              <height>16</height>
-             </size>
-            </property>
-            <property name="minimum">
-             <number>0</number>
-            </property>
-            <property name="maximum">
-             <number>100</number>
-            </property>
-            <property name="orientation">
-             <enum>Qt::Horizontal</enum>
-            </property>
-           </widget>
-          </item>
-         </layout>
-        </item>
-        <item row="3" column="2">
-         <widget class="ScrSpinBox" name="BlackSp">
-          <property name="suffix">
-           <string> %</string>
-          </property>
-          <property name="minimum">
-           <double>0.000000000000000</double>
-          </property>
-          <property name="maximum">
-           <double>100.000000000000000</double>
-          </property>
-         </widget>
-        </item>
-       </layout>
-      </item>
-      <item>
-       <spacer name="verticalSpacer_2">
-        <property name="orientation">
-         <enum>Qt::Vertical</enum>
-        </property>
-        <property name="sizeHint" stdset="0">
-         <size>
-          <width>20</width>
-          <height>40</height>
-         </size>
-        </property>
-       </spacer>
-      </item>
-     </layout>
-    </widget>
+      </widget>
+     </item>
+     <item>
+      <layout class="QHBoxLayout" name="horizontalLayout_3">
+       <item>
+        <layout class="QGridLayout" name="gridLayout">
+         <item row="0" column="1">
+          <widget class="QLabel" name="label_4">
+           <property name="minimumSize">
+            <size>
+             <width>50</width>
+             <height>22</height>
+            </size>
+           </property>
+           <property name="maximumSize">
+            <size>
+             <width>100</width>
+             <height>22</height>
+            </size>
+           </property>
+           <property name="text">
+            <string>New</string>
+           </property>
+           <property name="alignment">
+            <set>Qt::AlignCenter</set>
+           </property>
+          </widget>
+         </item>
+         <item row="0" column="0">
+          <widget class="QLabel" name="label_3">
+           <property name="minimumSize">
+            <size>
+             <width>50</width>
+             <height>22</height>
+            </size>
+           </property>
+           <property name="maximumSize">
+            <size>
+             <width>100</width>
+             <height>22</height>
+            </size>
+           </property>
+           <property name="text">
+            <string>Old</string>
+           </property>
+           <property name="alignment">
+            <set>Qt::AlignCenter</set>
+           </property>
+          </widget>
+         </item>
+         <item row="1" column="0">
+          <widget class="QLabel" name="OldC">
+           <property name="minimumSize">
+            <size>
+             <width>50</width>
+             <height>50</height>
+            </size>
+           </property>
+           <property name="maximumSize">
+            <size>
+             <width>50</width>
+             <height>50</height>
+            </size>
+           </property>
+           <property name="frameShape">
+            <enum>QFrame::WinPanel</enum>
+           </property>
+           <property name="frameShadow">
+            <enum>QFrame::Sunken</enum>
+           </property>
+           <property name="text">
+            <string/>
+           </property>
+           <property name="scaledContents">
+            <bool>true</bool>
+           </property>
+           <property name="alignment">
+            <set>Qt::AlignCenter</set>
+           </property>
+          </widget>
+         </item>
+         <item row="1" column="1">
+          <widget class="QLabel" name="NewC">
+           <property name="minimumSize">
+            <size>
+             <width>50</width>
+             <height>50</height>
+            </size>
+           </property>
+           <property name="maximumSize">
+            <size>
+             <width>50</width>
+             <height>50</height>
+            </size>
+           </property>
+           <property name="frameShape">
+            <enum>QFrame::WinPanel</enum>
+           </property>
+           <property name="frameShadow">
+            <enum>QFrame::Sunken</enum>
+           </property>
+           <property name="text">
+            <string/>
+           </property>
+           <property name="scaledContents">
+            <bool>true</bool>
+           </property>
+           <property name="alignment">
+            <set>Qt::AlignCenter</set>
+           </property>
+          </widget>
+         </item>
+        </layout>
+       </item>
+       <item>
+        <layout class="QGridLayout" name="gridLayout_2">
+         <item row="0" column="0">
+          <widget class="QLabel" name="CyanT">
+           <property name="text">
+            <string>C:</string>
+           </property>
+          </widget>
+         </item>
+         <item row="0" column="1">
+          <widget class="ScrSpinBox" name="CyanSp">
+           <property name="suffix">
+            <string> %</string>
+           </property>
+           <property name="minimum">
+            <double>0.000000000000000</double>
+           </property>
+           <property name="maximum">
+            <double>100.000000000000000</double>
+           </property>
+          </widget>
+         </item>
+         <item row="0" column="2">
+          <widget class="QToolButton" name="CyanP">
+           <property name="text">
+            <string>...</string>
+           </property>
+           <property name="popupMode">
+            <enum>QToolButton::InstantPopup</enum>
+           </property>
+          </widget>
+         </item>
+         <item row="1" column="0">
+          <widget class="QLabel" name="MagentaT">
+           <property name="text">
+            <string>M:</string>
+           </property>
+          </widget>
+         </item>
+         <item row="1" column="1">
+          <widget class="ScrSpinBox" name="MagentaSp">
+           <property name="suffix">
+            <string> %</string>
+           </property>
+           <property name="minimum">
+            <double>0.000000000000000</double>
+           </property>
+           <property name="maximum">
+            <double>100.000000000000000</double>
+           </property>
+          </widget>
+         </item>
+         <item row="1" column="2">
+          <widget class="QToolButton" name="MagentaP">
+           <property name="text">
+            <string>...</string>
+           </property>
+           <property name="popupMode">
+            <enum>QToolButton::InstantPopup</enum>
+           </property>
+          </widget>
+         </item>
+         <item row="2" column="0">
+          <widget class="QLabel" name="YellowT">
+           <property name="text">
+            <string>Y:</string>
+           </property>
+          </widget>
+         </item>
+         <item row="2" column="1">
+          <widget class="ScrSpinBox" name="YellowSp">
+           <property name="suffix">
+            <string> %</string>
+           </property>
+           <property name="minimum">
+            <double>0.000000000000000</double>
+           </property>
+           <property name="maximum">
+            <double>100.000000000000000</double>
+           </property>
+          </widget>
+         </item>
+         <item row="2" column="2">
+          <widget class="QToolButton" name="YellowP">
+           <property name="text">
+            <string>...</string>
+           </property>
+           <property name="popupMode">
+            <enum>QToolButton::InstantPopup</enum>
+           </property>
+          </widget>
+         </item>
+         <item row="3" column="0">
+          <widget class="QLabel" name="BlackT">
+           <property name="text">
+            <string>K:</string>
+           </property>
+          </widget>
+         </item>
+         <item row="3" column="1">
+          <widget class="ScrSpinBox" name="BlackSp">
+           <property name="suffix">
+            <string> %</string>
+           </property>
+           <property name="minimum">
+            <double>0.000000000000000</double>
+           </property>
+           <property name="maximum">
+            <double>100.000000000000000</double>
+           </property>
+          </widget>
+         </item>
+         <item row="3" column="2">
+          <widget class="QToolButton" name="BlackP">
+           <property name="text">
+            <string>...</string>
+           </property>
+           <property name="popupMode">
+            <enum>QToolButton::InstantPopup</enum>
+           </property>
+          </widget>
+         </item>
+        </layout>
+       </item>
+       <item>
+        <spacer name="horizontalSpacer">
+         <property name="orientation">
+          <enum>Qt::Horizontal</enum>
+         </property>
+         <property name="sizeHint" stdset="0">
+          <size>
+           <width>40</width>
+           <height>20</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
+      </layout>
+     </item>
+    </layout>
    </item>
   </layout>
  </widget>

Modified: trunk/Scribus/scribus/ui/colorchart.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20184&path=/trunk/Scribus/scribus/ui/colorchart.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/colorchart.cpp (original)
+++ trunk/Scribus/scribus/ui/colorchart.cpp Sun Jun 21 19:29:16 2015
@@ -34,7 +34,7 @@
 	Xp = 0;
 	Yp = 0;
 	doDrawMark = false;
-	isLabMode = false;
+	drawMode = 0;
 	setAutoFillBackground(false);
 	drawPalette(255);
 }
@@ -44,7 +44,7 @@
 	Xp = 0;
 	Yp = 0;
 	doDrawMark = false;
-	isLabMode = false;
+	drawMode = 0;
 	setAutoFillBackground(false);
 	drawPalette(255);
 }
@@ -52,8 +52,18 @@
 void ColorChart::mouseMoveEvent(QMouseEvent *m)
 {
 	drawMark(m->x(), m->y());
-	if (isLabMode)
-		emit ColorVal(m->x() * 256 / width() - 128, m->y() * 256 / height() - 128, true);
+	if (drawMode > 0)
+	{
+		if (drawMode == 2)
+		{
+			QPainterPath clp;
+			clp.addEllipse(0, 0, width(), height());
+			if (clp.contains(QPointF(m->x(), m->y())))
+				emit ColorVal(m->x() * 256 / width() - 128, 256 - (m->y() * 256 / height()) - 128, true);
+		}
+		else
+			emit ColorVal(m->x() * 256 / width() - 128, 256 - (m->y() * 256 / height()) - 128, true);
+	}
 	else
 		emit ColorVal(m->x() * 359 / width(), m->y() * 255 / height(), true);
 }
@@ -61,8 +71,18 @@
 void ColorChart::mousePressEvent(QMouseEvent *m)
 {
 	drawMark(m->x(), m->y());
-	if (isLabMode)
-		emit ColorVal(m->x() * 256 / width() - 128, m->y() * 256 / height() - 128, true);
+	if (drawMode > 0)
+	{
+		if (drawMode == 2)
+		{
+			QPainterPath clp;
+			clp.addEllipse(0, 0, width(), height());
+			if (clp.contains(QPointF(m->x(), m->y())))
+				emit ColorVal(m->x() * 256 / width() - 128, 256 - (m->y() * 256 / height()) - 128, true);
+		}
+		else
+			emit ColorVal(m->x() * 256 / width() - 128, 256 - (m->y() * 256 / height()) - 128, true);
+	}
 	else
 		emit ColorVal(m->x() * 359 / width(), m->y() * 255 / height(), true);
 }
@@ -70,8 +90,18 @@
 void ColorChart::mouseReleaseEvent(QMouseEvent *m)
 {
 	drawMark(m->x(), m->y());
-	if (isLabMode)
-		emit ColorVal(m->x() * 256 / width() - 128, m->y() * 256 / height() - 128, true);
+	if (drawMode > 0)
+	{
+		if (drawMode == 2)
+		{
+			QPainterPath clp;
+			clp.addEllipse(0, 0, width(), height());
+			if (clp.contains(QPointF(m->x(), m->y())))
+				emit ColorVal(m->x() * 256 / width() - 128, 256 - (m->y() * 256 / height()) - 128, true);
+		}
+		else
+			emit ColorVal(m->x() * 256 / width() - 128, 256 - (m->y() * 256 / height()) - 128, true);
+	}
 	else
 		emit ColorVal(m->x() * 359 / width(), m->y() * 255 / height(), true);
 }
@@ -84,6 +114,13 @@
 	p.setClipRect(e->rect());
 	QImage tmp = QImage(width(), height(), QImage::Format_ARGB32_Premultiplied);
 	p2.begin(&tmp);
+	p2.fillRect(QRect(0, 0, width(), height()), palette().background());
+	if (drawMode == 2)
+	{
+		QPainterPath clp;
+		clp.addEllipse(0, 0, width(), height());
+		p2.setClipPath(clp);
+	}
 	p2.drawPixmap(0, 0, pmx);
 	if (doDrawMark)
 	{
@@ -109,8 +146,8 @@
 
 void ColorChart::setMark(int h, int s)
 {
-	if (isLabMode)
-		drawMark((h + 128) / 256.0 * width(), (s + 128) / 256.0 * height());
+	if (drawMode > 0)
+		drawMark((h + 128) / 256.0 * width(), (-s + 128) / 256.0 * height());
 	else
 		drawMark(h * width() / 359, (255-s) * height() / 255);
 }
@@ -119,7 +156,7 @@
 {
 	int xSize = width();
 	int ySize = height();
-	if (isLabMode)
+	if (drawMode > 0)
 	{
 		QImage image(128, 128, QImage::Format_ARGB32);
 		bool doSoftProofing = m_doc ? m_doc->SoftProofing : false;
@@ -139,7 +176,7 @@
 			unsigned int* p = reinterpret_cast<unsigned int*>(image.scanLine(y));
 			for (int x = 0; x < 128; x++)
 			{
-				double yy = y * 2.0;
+				double yy = 256 - (y * 2.0);
 				if (doSoftProofing && doGamutCheck)
 				{
 					bool outOfG = false;

Modified: trunk/Scribus/scribus/ui/colorchart.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20184&path=/trunk/Scribus/scribus/ui/colorchart.h
==============================================================================
--- trunk/Scribus/scribus/ui/colorchart.h (original)
+++ trunk/Scribus/scribus/ui/colorchart.h Sun Jun 21 19:29:16 2015
@@ -59,7 +59,7 @@
 	int Xp;
 	int Yp;
 	bool doDrawMark;
-	bool isLabMode;
+	int drawMode;
 	QPixmap pmx;
 
 protected:




More information about the scribus-commit mailing list