r15605 by jghali - merge trunk revisions up to r15604

scribus-commit scribus-commit at lists.scribus.net
Thu Oct 21 02:22:03 CEST 2010


Author: jghali
Date: Thu Oct 21 00:22:03 2010
New Revision: 15605

URL: http://scribus.info/websvn/listing.php?repname=Scribus&sc=1&rev=15605
Log:
merge trunk revisions up to r15604

Added:
    branches/ScribusOIF/scribus/ui/paintmanager.cpp
      - copied unchanged from r15603, trunk/Scribus/scribus/ui/paintmanager.cpp
    branches/ScribusOIF/scribus/ui/paintmanager.h
      - copied unchanged from r15603, trunk/Scribus/scribus/ui/paintmanager.h
    branches/ScribusOIF/scribus/ui/paintmanager.ui
      - copied unchanged from r15603, trunk/Scribus/scribus/ui/paintmanager.ui
Modified:
    branches/ScribusOIF/scribus/CMakeLists.txt
    branches/ScribusOIF/scribus/actionmanager.cpp
    branches/ScribusOIF/scribus/pslib.cpp
    branches/ScribusOIF/scribus/scribus.cpp
    branches/ScribusOIF/scribus/scribus.h
    branches/ScribusOIF/scribus/util_color.cpp
    branches/ScribusOIF/scribus/util_color.h
    branches/ScribusOIF/win32/vc8/Scribus.vcproj

Modified: branches/ScribusOIF/scribus/CMakeLists.txt
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15605&path=/branches/ScribusOIF/scribus/CMakeLists.txt
==============================================================================
--- branches/ScribusOIF/scribus/CMakeLists.txt (original)
+++ branches/ScribusOIF/scribus/CMakeLists.txt Thu Oct 21 00:22:03 2010
@@ -89,6 +89,7 @@
   ui/nftdialog.ui
   ui/nftwidget.ui
   ui/pageitemattributes.ui
+  ui/paintmanager.ui
   ui/patterndialog.ui
   ui/picsearch.ui
   ui/picsearchoptions.ui
@@ -304,6 +305,7 @@
   ui/pagelayout.h
   ui/pagepalette.h
   ui/pageselector.h
+  ui/paintmanager.h
   ui/patterndialog.h
   ui/patternpropsdialog.h
   ui/pdfopts.h
@@ -706,6 +708,7 @@
   ui/pagelayout.cpp
   ui/pagepalette.cpp
   ui/pageselector.cpp
+  ui/paintmanager.cpp
   ui/patterndialog.cpp
   ui/patternpropsdialog.cpp
   ui/pdfopts.cpp

Modified: branches/ScribusOIF/scribus/actionmanager.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15605&path=/branches/ScribusOIF/scribus/actionmanager.cpp
==============================================================================
--- branches/ScribusOIF/scribus/actionmanager.cpp (original)
+++ branches/ScribusOIF/scribus/actionmanager.cpp Thu Oct 21 00:22:03 2010
@@ -234,6 +234,8 @@
 	scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
 	name="editGradients";
 	scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
+	name="editPaints";
+	scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
 	name="editStyles";
 	scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
 	name="editMasterPages";
@@ -262,6 +264,7 @@
 	connect( (*scrActions)["editReplaceColors"], SIGNAL(triggered()), mainWindow, SLOT(slotReplaceColors()) );
 	connect( (*scrActions)["editPatterns"], SIGNAL(triggered()), mainWindow, SLOT(managePatterns()) );
 	connect( (*scrActions)["editGradients"], SIGNAL(triggered()), mainWindow, SLOT(manageGradients()) );
+	connect( (*scrActions)["editPaints"], SIGNAL(triggered()), mainWindow, SLOT(managePaints()) );
 	connect( (*scrActions)["editMasterPages"], SIGNAL(triggered()), mainWindow, SLOT(manageMasterPages()) );
 	connect( (*scrActions)["editJavascripts"], SIGNAL(triggered()), mainWindow, SLOT(ManageJava()) );
 }
@@ -1317,6 +1320,7 @@
 	(*scrActions)["editReplaceColors"]->setTexts( tr("Replace Colors..."));
 	(*scrActions)["editPatterns"]->setTexts( tr("Patterns..."));
 	(*scrActions)["editGradients"]->setTexts( tr("Gradients..."));
+	(*scrActions)["editPaints"]->setTexts( tr("Paints..."));
 	(*scrActions)["editStyles"]->setTexts( tr("S&tyles..."));
 	(*scrActions)["editMasterPages"]->setTexts( tr("&Master Pages..."));
 	(*scrActions)["editJavascripts"]->setTexts( tr("&JavaScripts..."));
@@ -1759,7 +1763,7 @@
 	itmenu->second << "fileDocSetup" << "fileDocSetup150" << "filePreferences" << "filePreferences150" << "filePrint" << "PrintPreview" << "fileQuit";
 	++itmenu;
 	//Edit
-	itmenu->second << "editUndoAction" << "editRedoAction" << "editActionMode" << "editCut" << "editCopy" << "editPaste" << "editCopyContents" << "editPasteContents" << "editPasteContentsAbs" << "editClearContents" << "editSelectAll" << "editSelectAllOnLayer" << "editDeselectAll" << "editSearchReplace" << "toolsEditWithStoryEditor" << "editEditWithImageEditor" << "editEditRenderSource" << "editExtendedImageProperties" << "editColors" << "editReplaceColors" << "editPatterns" << "editGradients" << "editStyles" << "editMasterPages" << "editJavascripts";
+	itmenu->second << "editUndoAction" << "editRedoAction" << "editActionMode" << "editCut" << "editCopy" << "editPaste" << "editCopyContents" << "editPasteContents" << "editPasteContentsAbs" << "editClearContents" << "editSelectAll" << "editSelectAllOnLayer" << "editDeselectAll" << "editSearchReplace" << "toolsEditWithStoryEditor" << "editEditWithImageEditor" << "editEditRenderSource" << "editExtendedImageProperties" << "editColors" << "editReplaceColors" << "editPatterns" << "editGradients" << "editPaints" << "editStyles" << "editMasterPages" << "editJavascripts";
 	//Style
 	++itmenu;
 	int font_sizes[] = {7, 9, 10, 11, 12, 14, 18, 24, 36, 48, 60, 72};

Modified: branches/ScribusOIF/scribus/pslib.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15605&path=/branches/ScribusOIF/scribus/pslib.cpp
==============================================================================
--- branches/ScribusOIF/scribus/pslib.cpp (original)
+++ branches/ScribusOIF/scribus/pslib.cpp Thu Oct 21 00:22:03 2010
@@ -679,7 +679,7 @@
 	double maxBoxX = ActPage->width()+bleedLeft+bleedRight+markOffs*2.0;
 	double maxBoxY = ActPage->height()+Options.bleeds.Bottom+Options.bleeds.Top+markOffs*2.0;
 	PutStream("gs\n");
-	if(ActPage->PageOri == 1 && psExport)
+	if(ActPage->orientation() == 1 && psExport)
 		PutStream("90 rotate 0 "+IToStr(qRound(maxBoxY))+" neg translate\n");
 	if ((Options.cropMarks) || (Options.bleedMarks) || (Options.registrationMarks) || (Options.colorMarks))
 	{

Modified: branches/ScribusOIF/scribus/scribus.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15605&path=/branches/ScribusOIF/scribus/scribus.cpp
==============================================================================
--- branches/ScribusOIF/scribus/scribus.cpp (original)
+++ branches/ScribusOIF/scribus/scribus.cpp Thu Oct 21 00:22:03 2010
@@ -179,6 +179,7 @@
 #include "ui/pagelayout.h"
 #include "ui/pagepalette.h"
 #include "ui/pageselector.h"
+#include "ui/paintmanager.h"
 #include "ui/patterndialog.h"
 #include "ui/pdfopts.h"
 #include "ui/picstatus.h"
@@ -695,6 +696,7 @@
 	scrMenuMgr->addMenuItem(scrActions["editColors"], "Edit", true);
 	scrMenuMgr->addMenuItem(scrActions["editReplaceColors"], "Edit", false);
 	scrMenuMgr->addMenuItem(scrActions["editGradients"], "Edit", false);
+	scrMenuMgr->addMenuItem(scrActions["editPaints"], "Edit", true);
 	scrMenuMgr->addMenuItem(scrActions["editPatterns"], "Edit", false);
 	scrMenuMgr->addMenuItem(scrActions["editStyles"], "Edit", false);
 	scrMenuMgr->addMenuItem(scrActions["editMasterPages"], "Edit", false);
@@ -2346,7 +2348,7 @@
 	scrActions["editDeselectAll"]->setEnabled(false);
 	scrActions["editReplaceColors"]->setEnabled(true);
 	scrActions["editPatterns"]->setEnabled(true);
-//	scrActions["editGradients"]->setEnabled(true);
+	scrActions["editGradients"]->setEnabled(true);
  	scrActions["editStyles"]->setEnabled(true);
 	scrActions["editMasterPages"]->setEnabled(true);
 	scrActions["editJavascripts"]->setEnabled(true);
@@ -4491,7 +4493,7 @@
 		scrActions["editDeselectAll"]->setEnabled(false);
 		scrActions["editReplaceColors"]->setEnabled(false);
 		scrActions["editPatterns"]->setEnabled(false);
-//		scrActions["editGradients"]->setEnabled(false);
+		scrActions["editGradients"]->setEnabled(false);
  		scrActions["editStyles"]->setEnabled(false);
 		scrActions["editSearchReplace"]->setEnabled(false);
 		scrActions["editMasterPages"]->setEnabled(false);
@@ -9923,6 +9925,76 @@
 	}
 }
 
+void ScribusMainWindow::managePaints()
+{
+	ColorList edc;
+	QMap<QString, VGradient> *Gradients;
+	if (HaveDoc)
+	{
+		Gradients = &doc->docGradients;
+		edc = doc->PageColors;
+	}
+	else
+	{
+		Gradients = &prefsManager->appPrefs.defaultGradients;
+		edc = prefsManager->colorSet();
+	}
+	undoManager->setUndoEnabled(false);
+	paintManagerDialog *dia = new paintManagerDialog(this, Gradients, edc, prefsManager->colorSetName(), prefsManager->appPrefs.colorPrefs.CustomColorSets, doc, this);
+	if (dia->exec())
+	{
+		if (HaveDoc)
+		{
+			QColor tmpc;
+			slotDocCh();
+			doc->PageColors = dia->m_colorList;
+			if (dia->replaceColorMap.isEmpty())
+			{
+				// invalidate all charstyles, as replaceNamedResources() wont do it if all maps are empty
+				const StyleSet<CharStyle> dummy;
+				doc->redefineCharStyles(dummy, false);
+			}
+			else
+			{
+				ResourceCollection colorrsc;
+				colorrsc.mapColors(dia->replaceColorMap);
+				// Update tools colors
+				PrefsManager::replaceToolColors(doc->itemToolPrefs(), colorrsc.colors());
+				// Update objects and styles colors
+				doc->replaceNamedResources(colorrsc);
+				// Temporary code until LineStyle is effectively used
+				doc->replaceLineStyleColors(dia->replaceColorMap);
+			}
+			doc->recalculateColors();
+			doc->recalcPicturesRes();
+			doc->setGradients(dia->dialogGradients);
+			if (!dia->replaceMap.isEmpty())
+			{
+				ResourceCollection gradrsc;
+				gradrsc.mapPatterns(dia->replaceMap);
+				doc->replaceNamedResources(gradrsc);
+			}
+			updateColorLists();
+			if (doc->m_Selection->count() != 0)
+				doc->m_Selection->itemAt(0)->emitAllToGUI();
+			view->DrawNew();
+		}
+		else
+		{
+			// Update tools colors if needed
+			prefsManager->replaceToolColors(dia->replaceColorMap);
+			prefsManager->setColorSet(dia->m_colorList);
+			prefsManager->setColorSetName(dia->getColorSetName());
+			propertiesPalette->Cpal->SetColors(prefsManager->colorSet());
+			prefsManager->appPrefs.defaultGradients = dia->dialogGradients;
+		}
+	}
+	if (!HaveDoc)
+		prefsManager->appPrefs.colorPrefs.CustomColorSets = dia->customColSet;
+	delete dia;
+	undoManager->setUndoEnabled(true);
+}
+
 void ScribusMainWindow::manageGradients()
 {
 	if (HaveDoc)

Modified: branches/ScribusOIF/scribus/scribus.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15605&path=/branches/ScribusOIF/scribus/scribus.h
==============================================================================
--- branches/ScribusOIF/scribus/scribus.h (original)
+++ branches/ScribusOIF/scribus/scribus.h Thu Oct 21 00:22:03 2010
@@ -555,6 +555,8 @@
 	void managePatterns();
 	//! \brief manages the documents gradients
 	void manageGradients();
+	//! \brief manages paints
+	void managePaints();
 	//! \brief enable or disable the unicode actions and their menus
 	void enableTextActions(QMap<QString, QPointer<ScrAction> > *actionMap, bool enabled, const QString& fontName=QString::null);
 	//! \brief allow SE to get the SM for edit stlyes

Modified: branches/ScribusOIF/scribus/util_color.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15605&path=/branches/ScribusOIF/scribus/util_color.cpp
==============================================================================
--- branches/ScribusOIF/scribus/util_color.cpp (original)
+++ branches/ScribusOIF/scribus/util_color.cpp Thu Oct 21 00:22:03 2010
@@ -184,8 +184,19 @@
 static quint64 code64(const ScColor & col) {
 	int C, M, Y, K, R, G, B;
 	quint64 result=0;
-	col.getRGB( &R, &G, &B );
-	col.getCMYK( &C, &M, &Y, &K );
+	if (col.getColorModel() == colorModelRGB)
+	{
+		col.getRGB( &R, &G, &B );
+		QColor color = QColor(R, G, B);
+		color.getCmyk(&C, &M, &Y, &K);
+	}
+	else
+	{
+		col.getCMYK( &C, &M, &Y, &K );
+		R = 255-qMin(255, C + K);
+		G = 255-qMin(255, M + K);
+		B = 255-qMin(255, Y + K);
+	}
 	result |= col.getColorModel() == colorModelRGB ? 1 : 0;
 	result |= col.isSpotColor() ? 64 : 0;
 	result |= col.isRegistrationColor() ? 32 : 0;
@@ -230,7 +241,8 @@
 		return pxCache[res];
 
 	QPixmap *pa=new QPixmap(60, 15);
-	QPixmap *pm=getSmallPixmap(col.getRawRGBColor());
+	QPixmap *pm=getSmallPixmap(ScColorEngine::getDisplayColor(col, doc));
+//	QPixmap *pm=getSmallPixmap(col.getRawRGBColor());
 	pa->fill(Qt::white);
 	paintAlert(*pm, *pa, 0, 0);
 	if (ScColorEngine::isOutOfGamut(col, doc))
@@ -583,7 +595,7 @@
 	return CommonStrings::trUnknownCS;
 }
 
-bool importColorsFromFile(QString fileName, ColorList &EditColors)
+bool importColorsFromFile(QString fileName, ColorList &EditColors, QMap<QString,VGradient> *dialogGradients)
 {
 	int oldCount = EditColors.count();
 	if (!fileName.isEmpty())
@@ -768,6 +780,42 @@
 								if (!EditColors.contains(pg.attribute("NAME")))
 									EditColors.insert(pg.attribute("NAME"), lf);
 							}
+							else if (pg.tagName() == "Gradient")
+							{
+								if (dialogGradients != NULL)
+								{
+									VGradient gra = VGradient(VGradient::linear);
+									gra.clearStops();
+									QDomNode grad = pg.firstChild();
+									while(!grad.isNull())
+									{
+										QDomElement stop = grad.toElement();
+										QString name = stop.attribute("NAME");
+										double ramp  = ScCLocale::toDoubleC(stop.attribute("RAMP"), 0.0);
+										int shade    = stop.attribute("SHADE", "100").toInt();
+										double opa   = ScCLocale::toDoubleC(stop.attribute("TRANS"), 1.0);
+										QColor color;
+										if (name == CommonStrings::None)
+											color = QColor(255, 255, 255, 0);
+										else
+										{
+											const ScColor& col = EditColors[name];
+											color = ScColorEngine::getShadeColorProof(col, NULL, shade);
+										}
+										gra.addStop(color, ramp, 0.5, opa, name, shade);
+										grad = grad.nextSibling();
+									}
+									if (!dialogGradients->contains(pg.attribute("Name")))
+										dialogGradients->insert(pg.attribute("Name"), gra);
+									else
+									{
+										QString tmp;
+										QString name = pg.attribute("Name");
+										name += "("+tmp.setNum(dialogGradients->count())+")";
+										dialogGradients->insert(name, gra);
+									}
+								}
+							}
 							else if (pg.tagName()=="draw:color" && pg.attribute("draw:name")!=CommonStrings::None)
 							{
 								if (pg.hasAttribute("draw:color"))

Modified: branches/ScribusOIF/scribus/util_color.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15605&path=/branches/ScribusOIF/scribus/util_color.h
==============================================================================
--- branches/ScribusOIF/scribus/util_color.h (original)
+++ branches/ScribusOIF/scribus/util_color.h Thu Oct 21 00:22:03 2010
@@ -13,6 +13,7 @@
 #include <QString>
 
 #include "fpointarray.h"
+#include "vgradient.h"
 #include "sccolor.h"
 #include "scribusapi.h"
 
@@ -110,6 +111,6 @@
  * \param EditColors Color list to store the imported colors
  * \return true if any colors have been found
 */
-bool SCRIBUS_API importColorsFromFile(QString fileName, ColorList &EditColors);
+bool SCRIBUS_API importColorsFromFile(QString fileName, ColorList &EditColors, QMap<QString,VGradient> *dialogGradients = NULL);
 
 #endif

Modified: branches/ScribusOIF/win32/vc8/Scribus.vcproj
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15605&path=/branches/ScribusOIF/win32/vc8/Scribus.vcproj
==============================================================================
--- branches/ScribusOIF/win32/vc8/Scribus.vcproj (original)
+++ branches/ScribusOIF/win32/vc8/Scribus.vcproj Thu Oct 21 00:22:03 2010
@@ -1299,6 +1299,10 @@
 				>
 			</File>
 			<File
+				RelativePath="..\..\scribus\ui\paintmanager.cpp"
+				>
+			</File>
+			<File
 				RelativePath="..\..\scribus\styles\paragraphstyle.cpp"
 				>
 			</File>
@@ -6844,6 +6848,38 @@
 				>
 			</File>
 			<File
+				RelativePath="..\..\scribus\ui\paintmanager.h"
+				>
+				<FileConfiguration
+					Name="Debug-cairo|Win32"
+					>
+					<Tool
+						Name="moc.exe"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release-cairo|Win32"
+					>
+					<Tool
+						Name="moc.exe"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug-arthur|Win32"
+					>
+					<Tool
+						Name="moc.exe"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release-arthur|Win32"
+					>
+					<Tool
+						Name="moc.exe"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
 				RelativePath="..\..\scribus\styles\paragraphstyle.h"
 				>
 			</File>
@@ -12253,6 +12289,10 @@
 				>
 			</File>
 			<File
+				RelativePath="..\..\scribus\ui\ui_paintmanager.h"
+				>
+			</File>
+			<File
 				RelativePath="..\..\scribus\ui\ui_patterndialog.h"
 				>
 			</File>
@@ -12990,6 +13030,10 @@
 				>
 			</File>
 			<File
+				RelativePath="..\..\scribus\ui\moc_paintmanager.cpp"
+				>
+			</File>
+			<File
 				RelativePath="..\..\scribus\ui\moc_patterndialog.cpp"
 				>
 			</File>
@@ -13691,6 +13735,10 @@
 				>
 			</File>
 			<File
+				RelativePath="..\..\scribus\ui\paintmanager.ui"
+				>
+			</File>
+			<File
 				RelativePath="..\..\scribus\ui\patterndialog.ui"
 				>
 			</File>




More information about the scribus-commit mailing list