r15139 by cbradney - #1549: Add scratch space colour preference item, fix doc setup crash for page sizes

scribus-commit scribus-commit at lists.scribus.net
Sat May 29 16:30:37 CEST 2010


Revision: 15139
Author: cbradney
Date: 2010-05-29T14:29:13.668717Z
Commit message: #1549: Add scratch space colour preference item, fix doc setup crash for page sizes

Changeset: 
M  /trunk/Scribus/scribus/prefsmanager.cpp
M  /trunk/Scribus/scribus/prefsstructs.h
M  /trunk/Scribus/scribus/ui/preferencesdialog.cpp
M  /trunk/Scribus/scribus/ui/prefs_display.cpp
M  /trunk/Scribus/scribus/scribusview.cpp
M  /trunk/Scribus/scribus/ui/prefs_display.h
M  /trunk/Scribus/scribus/ui/prefs_displaybase.ui

Diffs:
Index: scribus/prefsmanager.cpp
===================================================================
--- scribus/prefsmanager.cpp	(revision 15138)
+++ scribus/prefsmanager.cpp	(revision 15139)
@@ -265,6 +265,7 @@
 	appPrefs.opToolPrefs.dispY = 10.0;
 	appPrefs.opToolPrefs.constrain = 15.0;
 	appPrefs.displayPrefs.paperColor = QColor(Qt::white);
+	appPrefs.displayPrefs.scratchColor = qApp->palette().color(QPalette::Active, QPalette::Window);
 	appPrefs.displayPrefs.showPageShadow = true;
 	appPrefs.displayPrefs.showVerifierWarningsOnCanvas = true;
 	appPrefs.displayPrefs.frameColor = QColor(Qt::red);
@@ -1344,6 +1345,7 @@
 	deDisplay.setAttribute("PageGapVertical", ScCLocale::toQStringC(appPrefs.displayPrefs.pageGapVertical));
 	deDisplay.setAttribute("ShowPageShadow",static_cast<int>(appPrefs.displayPrefs.showPageShadow));
 	deDisplay.setAttribute("PageColor",appPrefs.displayPrefs.paperColor.name());
+	deDisplay.setAttribute("ScratchColor",appPrefs.displayPrefs.scratchColor.name());
 	deDisplay.setAttribute("FrameSelectedColor",appPrefs.displayPrefs.frameColor.name());
 	deDisplay.setAttribute("FrameNormColor",appPrefs.displayPrefs.frameNormColor.name());
 	deDisplay.setAttribute("FrameGroupColor",appPrefs.displayPrefs.frameGroupColor.name());
@@ -1913,6 +1915,10 @@
 			appPrefs.displayPrefs.pageGapVertical    = ScCLocale::toDoubleC(dc.attribute("PageGapVertical"), 40.0);
 			appPrefs.displayPrefs.showPageShadow = static_cast<bool>(dc.attribute("ShowPageShadow", "1").toInt());
 			appPrefs.displayPrefs.paperColor = QColor(dc.attribute("PageColor"));
+			if (dc.hasAttribute("ScratchColor"))
+				appPrefs.displayPrefs.scratchColor = QColor(dc.attribute("ScratchColor"));
+			else
+				appPrefs.displayPrefs.scratchColor = qApp->palette().color(QPalette::Active, QPalette::Window);
 			appPrefs.displayPrefs.frameColor = QColor(dc.attribute("FrameSelectedColor","#ff0000"));
 			appPrefs.displayPrefs.frameNormColor = QColor(dc.attribute("FrameNormColor","#000000"));
 			appPrefs.displayPrefs.frameGroupColor = QColor(dc.attribute("FrameGroupColor","#008080"));
Index: scribus/prefsstructs.h
===================================================================
--- scribus/prefsstructs.h	(revision 15138)
+++ scribus/prefsstructs.h	(revision 15139)
@@ -293,6 +293,7 @@
 	bool marginColored; //! Indicates if the margin to edge of page area will be colored in some other color or not
 	bool showPageShadow; //! Show a shadow around the pages
 	QColor paperColor; //! Color of paper (onscreen only)
+	QColor scratchColor; //! Color of scratch space (onscreen only)
 	QColor frameColor; //! Color of frame border (onscreen only)
 	QColor frameNormColor; //! Color of normal frame border (onscreen only)
 	QColor frameGroupColor; //! Color of border of grouped frames (onscreen only)
Index: scribus/scribusview.cpp
===================================================================
--- scribus/scribusview.cpp	(revision 15138)
+++ scribus/scribusview.cpp	(revision 15139)
@@ -161,6 +161,9 @@
 	m_vhRulerHW(17)
 {
 	setObjectName("s");
+	QPalette p=palette();
+	p.setBrush(QPalette::Window, PrefsManager::instance()->appPrefs.displayPrefs.scratchColor);
+	setPalette(p);
 	setAttribute(Qt::WA_StaticContents);
 	setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
 	setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
Index: scribus/ui/prefs_display.h
===================================================================
--- scribus/ui/prefs_display.h	(revision 15138)
+++ scribus/ui/prefs_display.h	(revision 15139)
@@ -49,6 +49,7 @@
 		\brief Slots for changing colors
 		*/
 		virtual void changePaperColor();
+		virtual void changeScratchColor();
 		virtual void changeFrameColor();
 		virtual void changeNormFrameColor();
 		virtual void changeGroupFrameColor();
@@ -63,6 +64,7 @@
 	protected:
 		int docUnitIndex;
 		QColor colorPaper;
+		QColor colorScratch;
 		QColor colorFrame;
 		QColor colorFrameNorm;
 		QColor colorFrameGroup;
Index: scribus/ui/prefs_display.cpp
===================================================================
--- scribus/ui/prefs_display.cpp	(revision 15138)
+++ scribus/ui/prefs_display.cpp	(revision 15139)
@@ -26,6 +26,7 @@
 	buttonRestoreDPI->setIcon(QIcon(loadIcon("screen.png")));
 
 	connect(pageFillColorButton, SIGNAL(clicked()), this, SLOT(changePaperColor()));
+	connect(scratchSpaceColorButton, SIGNAL(clicked()), this, SLOT(changeScratchColor()));
 	connect(frameSelectedColorButton, SIGNAL(clicked()), this, SLOT(changeFrameColor()));
 	connect(frameColorButton, SIGNAL(clicked()), this, SLOT(changeNormFrameColor()));
 	connect(frameGroupedColorButton, SIGNAL(clicked()), this, SLOT(changeGroupFrameColor()));
@@ -107,6 +108,10 @@
 	pageFillColorButton->setText( QString::null );
 	pageFillColorButton->setIcon(pm);
 
+	pm.fill(prefsData->displayPrefs.scratchColor);
+	colorScratch = prefsData->displayPrefs.scratchColor;
+	scratchSpaceColorButton->setText( QString::null );
+	scratchSpaceColorButton->setIcon(pm);
 
 	pm.fill(prefsData->displayPrefs.frameColor);
 	colorFrame = prefsData->displayPrefs.frameColor;
@@ -259,6 +264,18 @@
 	}
 }
 
+void Prefs_Display::changeScratchColor()
+{
+	QColor newColor(QColorDialog::getColor(colorScratch, this));
+	if (newColor.isValid())
+	{
+		QPixmap pm(100, 30);
+		pm.fill(newColor);
+		colorScratch = newColor;
+		scratchSpaceColorButton->setIcon(pm);
+	}
+}
+
 void Prefs_Display::changeFrameColor()
 {
 	QColor newColor(QColorDialog::getColor(colorFrame, this));
@@ -377,6 +394,7 @@
 	prefsData->displayPrefs.pageGapVertical=pageGapVerticalSpinBox->value();
 
 	prefsData->displayPrefs.paperColor=colorPaper;
+	prefsData->displayPrefs.scratchColor=colorScratch;
 	prefsData->displayPrefs.frameColor=colorFrame;
 	prefsData->displayPrefs.frameNormColor=colorFrameNorm;
 	prefsData->displayPrefs.frameGroupColor=colorFrameGroup;
Index: scribus/ui/prefs_displaybase.ui
===================================================================
--- scribus/ui/prefs_displaybase.ui	(revision 15138)
+++ scribus/ui/prefs_displaybase.ui	(revision 15139)
@@ -389,122 +389,136 @@
          <item row="0" column="1">
           <widget class="QPushButton" name="pageFillColorButton">
            <property name="text">
-            <string>PushButton</string>
+            <string/>
            </property>
           </widget>
          </item>
-         <item row="1" column="0">
+         <item row="2" column="0">
           <widget class="QLabel" name="label_13">
            <property name="text">
             <string>Selected Page Border:</string>
            </property>
           </widget>
          </item>
-         <item row="1" column="1">
+         <item row="2" column="1">
           <widget class="QPushButton" name="selectedPageBorderButton">
            <property name="text">
-            <string>PushButton</string>
+            <string/>
            </property>
           </widget>
          </item>
-         <item row="2" column="0">
+         <item row="3" column="0">
           <widget class="QLabel" name="label_14">
            <property name="text">
             <string>Frames:</string>
            </property>
           </widget>
          </item>
-         <item row="2" column="1">
+         <item row="3" column="1">
           <widget class="QPushButton" name="frameColorButton">
            <property name="text">
-            <string>PushButton</string>
+            <string/>
            </property>
           </widget>
          </item>
-         <item row="3" column="0">
+         <item row="4" column="0">
           <widget class="QLabel" name="label_16">
            <property name="text">
             <string>Locked Frames:</string>
            </property>
           </widget>
          </item>
-         <item row="3" column="1">
+         <item row="4" column="1">
           <widget class="QPushButton" name="frameLockedColorButton">
            <property name="text">
-            <string>PushButton</string>
+            <string/>
            </property>
           </widget>
          </item>
-         <item row="4" column="0">
+         <item row="5" column="0">
           <widget class="QLabel" name="label_17">
            <property name="text">
             <string>Selected Frames:</string>
            </property>
           </widget>
          </item>
-         <item row="4" column="1">
+         <item row="5" column="1">
           <widget class="QPushButton" name="frameSelectedColorButton">
            <property name="text">
-            <string>PushButton</string>
+            <string/>
            </property>
           </widget>
          </item>
-         <item row="5" column="0">
+         <item row="6" column="0">
           <widget class="QLabel" name="label_31">
            <property name="text">
             <string>Linked Frames:</string>
            </property>
           </widget>
          </item>
-         <item row="5" column="1">
+         <item row="6" column="1">
           <widget class="QPushButton" name="frameLinkedColorButton">
            <property name="text">
-            <string>PushButton</string>
+            <string/>
            </property>
           </widget>
          </item>
-         <item row="6" column="0">
+         <item row="7" column="0">
           <widget class="QLabel" name="label_30">
            <property name="text">
             <string>Grouped Frames:</string>
            </property>
           </widget>
          </item>
-         <item row="6" column="1">
+         <item row="7" column="1">
           <widget class="QPushButton" name="frameGroupedColorButton">
            <property name="text">
-            <string>PushButton</string>
+            <string/>
            </property>
           </widget>
          </item>
-         <item row="7" column="0">
+         <item row="8" column="0">
           <widget class="QLabel" name="label_29">
            <property name="text">
             <string>Annotation Frames:</string>
            </property>
           </widget>
          </item>
-         <item row="8" column="0">
+         <item row="9" column="0">
           <widget class="QLabel" name="label_32">
            <property name="text">
             <string>Text Control Characters:</string>
            </property>
           </widget>
          </item>
-         <item row="7" column="1">
+         <item row="8" column="1">
           <widget class="QPushButton" name="frameAnnotationColorButton">
            <property name="text">
-            <string>PushButton</string>
+            <string/>
            </property>
           </widget>
          </item>
-         <item row="8" column="1">
+         <item row="9" column="1">
           <widget class="QPushButton" name="textControlCharsButton">
            <property name="text">
-            <string>PushButton</string>
+            <string/>
            </property>
           </widget>
          </item>
+         <item row="1" column="0">
+          <widget class="QLabel" name="label_2">
+           <property name="text">
+            <string>Scratch Space:</string>
+           </property>
+          </widget>
+         </item>
+         <item row="1" column="1">
+          <widget class="QPushButton" name="scratchSpaceColorButton">
+           <property name="text">
+            <string/>
+           </property>
+          </widget>
+         </item>
         </layout>
        </item>
        <item>
Index: scribus/ui/preferencesdialog.cpp
===================================================================
--- scribus/ui/preferencesdialog.cpp	(revision 15138)
+++ scribus/ui/preferencesdialog.cpp	(revision 15139)
@@ -35,6 +35,7 @@
 	prefs_Guides(0),
 	prefs_KeyboardShortcuts(0),
 	prefs_Paths(0),
+	prefs_PageSizes(0),
 	prefs_Printer(0),
 	prefs_Hyphenator(0),
 	prefs_Miscellaneous(0),




More information about the scribus-commit mailing list