From def5f7f7193e74ded5c6fb5741397a6d10c0f488 Mon Sep 17 00:00:00 2001 From: Craig Watson <craig@watsons.ch> Date: Fri, 2 Sep 2016 22:44:46 -0400 Subject: [PATCH] Added ruled background --- resources/OpenBoard.qrc | 4 + resources/forms/mainWindow.ui | 38 +++++ .../images/backgroundPalette/background5.svg | 146 +++++++++++++++++ .../backgroundPalette/background5On.svg | 149 +++++++++++++++++ .../images/backgroundPalette/background6.svg | 146 +++++++++++++++++ .../backgroundPalette/background6On.svg | 150 ++++++++++++++++++ src/adaptors/UBExportFullPDF.cpp | 6 +- src/adaptors/UBExportPDF.cpp | 6 +- src/adaptors/UBSvgSubsetAdaptor.cpp | 37 ++++- src/api/UBWidgetUniboardAPI.cpp | 8 +- src/board/UBBoardController.cpp | 47 ++++-- src/board/UBBoardController.h | 4 +- src/board/UBBoardPaletteManager.cpp | 21 ++- src/board/UBBoardView.cpp | 12 +- src/core/UB.h | 7 + src/core/UBApplicationController.cpp | 2 +- src/core/UBPersistenceManager.cpp | 2 +- src/core/UBSettings.cpp | 28 +++- src/core/UBSettings.h | 4 +- src/desktop/UBDesktopAnnotationController.cpp | 4 +- src/domain/UBGraphicsScene.cpp | 22 ++- src/domain/UBGraphicsScene.h | 8 +- 22 files changed, 797 insertions(+), 54 deletions(-) create mode 100644 resources/images/backgroundPalette/background5.svg create mode 100644 resources/images/backgroundPalette/background5On.svg create mode 100644 resources/images/backgroundPalette/background6.svg create mode 100644 resources/images/backgroundPalette/background6On.svg diff --git a/resources/OpenBoard.qrc b/resources/OpenBoard.qrc index 07f0d10a..1a2f3d1e 100644 --- a/resources/OpenBoard.qrc +++ b/resources/OpenBoard.qrc @@ -159,6 +159,10 @@ <file>images/backgroundPalette/background3On.svg</file> <file>images/backgroundPalette/background4.svg</file> <file>images/backgroundPalette/background4On.svg</file> + <file>images/backgroundPalette/background5.svg</file> + <file>images/backgroundPalette/background5On.svg</file> + <file>images/backgroundPalette/background6.svg</file> + <file>images/backgroundPalette/background6On.svg</file> <file>images/toolPalette/podcast.svg</file> <file>images/toolPalette/podcastOn.svg</file> <file>images/toolPalette/rulerTool.png</file> diff --git a/resources/forms/mainWindow.ui b/resources/forms/mainWindow.ui index 287d4e0a..d1c27a4b 100644 --- a/resources/forms/mainWindow.ui +++ b/resources/forms/mainWindow.ui @@ -1004,6 +1004,25 @@ <string>Grid Light Background</string> </property> </action> + <action name="actionRuledLightBackground"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="icon"> + <iconset resource="../OpenBoard.qrc"> + <normaloff>:/images/backgroundPalette/background5.svg</normaloff> + <normalon>:/images/backgroundPalette/background5On.svg</normalon>:/images/backgroundPalette/background5.svg</iconset> + </property> + <property name="text"> + <string>Ruled Light Background</string> + </property> + <property name="iconText"> + <string>Light</string> + </property> + <property name="toolTip"> + <string>Ruled Light Background</string> + </property> + </action> <action name="actionPlainDarkBackground"> <property name="checkable"> <bool>true</bool> @@ -1042,6 +1061,25 @@ <string>Grid Dark Background</string> </property> </action> + <action name="actionRuledDarkBackground"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="icon"> + <iconset resource="../OpenBoard.qrc"> + <normaloff>:/images/backgroundPalette/background6.svg</normaloff> + <normalon>:/images/backgroundPalette/background6On.svg</normalon>:/images/backgroundPalette/background6.svg</iconset> + </property> + <property name="text"> + <string>Ruled Dark Background</string> + </property> + <property name="iconText"> + <string>Dark</string> + </property> + <property name="toolTip"> + <string>Ruled Dark Background</string> + </property> + </action> <action name="actionPodcast"> <property name="checkable"> <bool>true</bool> diff --git a/resources/images/backgroundPalette/background5.svg b/resources/images/backgroundPalette/background5.svg new file mode 100644 index 00000000..ac6e870e --- /dev/null +++ b/resources/images/backgroundPalette/background5.svg @@ -0,0 +1,146 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Generator: Adobe Illustrator 13.0.2, SVG Export Plug-In . SVG Version: 6.00 Build 14948) --> + +<svg + xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/" + xmlns:ns="&ns_sfw;" + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + version="1.2" + x="0px" + y="0px" + width="128px" + height="128px" + viewBox="0 0 128 128" + xml:space="preserve" + id="svg2" + inkscape:version="0.91 r13725" + sodipodi:docname="background5.svg"><defs + id="defs37"><linearGradient + y2="101.9506" + x2="63.4995" + y1="24.5024" + x1="63.4995" + gradientUnits="userSpaceOnUse" + id="SVGID_1_"><stop + id="stop8" + style="stop-color:#FCFCFC" + offset="0" /><stop + id="stop10" + style="stop-color:#E6E6E6" + offset="1" /><a:midPointStop + style="stop-color:#FCFCFC" + offset="0" /><a:midPointStop + style="stop-color:#FCFCFC" + offset="0.5" /><a:midPointStop + style="stop-color:#E6E6E6" + offset="1" /></linearGradient><linearGradient + y2="77.0022" + x2="66.1289" + y1="104.8428" + x1="66.1289" + gradientUnits="userSpaceOnUse" + id="SVGID_2_"><stop + id="stop17" + style="stop-color:#E0E0E0" + offset="0" /><stop + id="stop19" + style="stop-color:#999999" + offset="1" /><a:midPointStop + style="stop-color:#E0E0E0" + offset="0" /><a:midPointStop + style="stop-color:#E0E0E0" + offset="0.5" /><a:midPointStop + style="stop-color:#999999" + offset="1" /></linearGradient></defs><sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1919" + inkscape:window-height="2109" + id="namedview35" + showgrid="false" + inkscape:zoom="7.375" + inkscape:cx="63.701455" + inkscape:cy="48.396424" + inkscape:window-x="1920" + inkscape:window-y="0" + inkscape:window-maximized="0" + inkscape:current-layer="svg2" /><metadata + id="metadata4"><ns:sfw><ns:slices /><ns:sliceSourceBounds + x="8.255" + y="22.924" + width="110.488" + height="82.884" + bottomLeftOrigin="true" /></ns:sfw><rdf:RDF><cc:Work + rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><g + id="g4207"><path + d="m 104.906,102.468 -82.815,0 c -6.19,0 -11.227,-5.038 -11.227,-11.231 l 0,-55.209 c 0,-6.191 5.036,-11.227 11.227,-11.227 l 82.815,0 c 6.19,0 11.229,5.036 11.229,11.227 l 0,55.208 c 0,6.194 -5.038,11.232 -11.229,11.232 l 0,0 z" + id="path12" + style="fill:url(#SVGID_1_)" + inkscape:connector-curvature="0" /><path + d="m 113.525,71.782 c 0,0 0.02,-0.042 0.052,-0.114 -0.018,0.041 -0.034,0.074 -0.052,0.114 z m 0,0 c -5.221,11.31 -14.791,12.181 -14.791,12.181 l -81.273,13.92 -3.946,4.193 c 2.36,1.872 5.337,3 8.577,3 l 82.815,0 c 7.629,0 13.837,-6.207 13.837,-13.84 l 0,-19.454 -5.219,0 z" + id="path21" + style="fill:url(#SVGID_2_)" + inkscape:connector-curvature="0" /><path + d="m 104.906,22.192 c 7.629,0 13.837,6.207 13.837,13.836 l 0,55.208 c 0,7.633 -6.208,13.84 -13.837,13.84 l -82.815,0 c -7.629,0 -13.836,-6.207 -13.836,-13.84 l 0,-55.208 c 0,-7.629 6.207,-13.836 13.836,-13.836 l 82.815,0 m 0,5.22 -82.815,0 c -4.751,0 -8.616,3.865 -8.616,8.616 l 0,55.208 c 0,4.753 3.865,8.619 8.616,8.619 l 82.815,0 c 4.751,0 8.617,-3.866 8.617,-8.619 l 0,-55.208 c 0,-4.751 -3.866,-8.616 -8.617,-8.616 l 0,0 z" + id="path23" + inkscape:connector-curvature="0" + style="fill:#ffffff" /><path + d="m 104.906,22.192 c 7.629,0 13.837,6.207 13.837,13.836 l 0,55.208 c 0,7.633 -6.208,13.84 -13.837,13.84 l -82.815,0 c -7.629,0 -13.836,-6.207 -13.836,-13.84 l 0,-55.208 c 0,-7.629 6.207,-13.836 13.836,-13.836 l 82.815,0 m 0,3.48 -82.815,0 c -5.71,0 -10.356,4.646 -10.356,10.356 l 0,55.208 c 0,5.713 4.646,10.359 10.356,10.359 l 82.815,0 c 5.711,0 10.357,-4.646 10.357,-10.359 l 0,-55.208 c 10e-4,-5.71 -4.646,-10.356 -10.357,-10.356 l 0,0 z" + id="path25" + inkscape:connector-curvature="0" + style="fill:#b0b9c4" /><g + id="g4808" + transform="translate(-1.2260701,-1.3567863)"><rect + style="fill:#afafaf;fill-opacity:1;stroke:none;stroke-opacity:1" + id="rect4737" + width="92.856682" + height="2.1642509" + x="17.035017" + y="80.529778" /><rect + style="fill:#afafaf;fill-opacity:1;stroke:none;stroke-opacity:1" + id="rect4731" + width="92.856682" + height="2.1642509" + x="17.035017" + y="46.934799" /><rect + y="63.841599" + x="17.035017" + height="2.1642509" + width="92.856682" + id="rect4735" + style="fill:#afafaf;fill-opacity:1;stroke:none;stroke-opacity:1" /></g><g + id="Layer_1"><linearGradient + y2="78.9319" + x2="63.4618" + y1="92.8516" + x1="68.6816" + gradientUnits="userSpaceOnUse" + id="SVGID_3_"><stop + id="stop29" + style="stop-color:#657180" + offset="0" /><stop + id="stop31" + style="stop-color:#AFB9C5" + offset="1" /><a:midPointStop + style="stop-color:#657180" + offset="0" /><a:midPointStop + style="stop-color:#657180" + offset="0.5" /><a:midPointStop + style="stop-color:#AFB9C5" + offset="1" /></linearGradient><path + id="path33" + d="M96.125,87.346C79.1,91.045,17.461,97.883,17.461,97.883l70.542-26.666 c0,0,20.494,17.185,25.521-0.401C113.525,70.815,113.148,83.646,96.125,87.346z" + fill="url(#SVGID_3_)" /></g></g></svg> \ No newline at end of file diff --git a/resources/images/backgroundPalette/background5On.svg b/resources/images/backgroundPalette/background5On.svg new file mode 100644 index 00000000..25d0a1c3 --- /dev/null +++ b/resources/images/backgroundPalette/background5On.svg @@ -0,0 +1,149 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Generator: Adobe Illustrator 13.0.2, SVG Export Plug-In . SVG Version: 6.00 Build 14948) --> + +<svg + xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/" + xmlns:ns="&ns_sfw;" + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + version="1.2" + x="0px" + y="0px" + width="128px" + height="128px" + viewBox="0 0 128 128" + xml:space="preserve" + id="svg2" + inkscape:version="0.91 r13725" + sodipodi:docname="background5On.svg"><defs + id="defs39"><linearGradient + y2="101.9506" + x2="63.4995" + y1="24.5024" + x1="63.4995" + gradientUnits="userSpaceOnUse" + id="SVGID_1_"><stop + id="stop10" + style="stop-color:#FCFCFC" + offset="0" /><stop + id="stop12" + style="stop-color:#E6E6E6" + offset="1" /><a:midPointStop + style="stop-color:#FCFCFC" + offset="0" /><a:midPointStop + style="stop-color:#FCFCFC" + offset="0.5" /><a:midPointStop + style="stop-color:#E6E6E6" + offset="1" /></linearGradient><linearGradient + y2="77.0022" + x2="66.1289" + y1="104.8428" + x1="66.1289" + gradientUnits="userSpaceOnUse" + id="SVGID_2_"><stop + id="stop19" + style="stop-color:#E0E0E0" + offset="0" /><stop + id="stop21" + style="stop-color:#999999" + offset="1" /><a:midPointStop + style="stop-color:#E0E0E0" + offset="0" /><a:midPointStop + style="stop-color:#E0E0E0" + offset="0.5" /><a:midPointStop + style="stop-color:#999999" + offset="1" /></linearGradient><linearGradient + y2="78.9319" + x2="63.4618" + y1="92.8516" + x1="68.6816" + gradientUnits="userSpaceOnUse" + id="SVGID_3_"><stop + id="stop31" + style="stop-color:#657180" + offset="0" /><stop + id="stop33" + style="stop-color:#AFB9C5" + offset="1" /><a:midPointStop + style="stop-color:#657180" + offset="0" /><a:midPointStop + style="stop-color:#657180" + offset="0.5" /><a:midPointStop + style="stop-color:#AFB9C5" + offset="1" /></linearGradient></defs><sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1919" + inkscape:window-height="2109" + id="namedview37" + showgrid="false" + inkscape:zoom="5.2149125" + inkscape:cx="58.012474" + inkscape:cy="26.623553" + inkscape:window-x="0" + inkscape:window-y="0" + inkscape:window-maximized="0" + inkscape:current-layer="svg2" /><metadata + id="metadata4"><ns:sfw><ns:slices /><ns:sliceSourceBounds + x="5" + y="19" + width="117" + height="90" + bottomLeftOrigin="true" /></ns:sfw><rdf:RDF><cc:Work + rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><g + id="g4279"><path + d="m 122,93 c 0,8.837 -7.164,16 -16,16 l -85,0 C 12.164,109 5,101.837 5,93 L 5,35 C 5,26.164 12.164,19 21,19 l 85,0 c 8.836,0 16,7.164 16,16 l 0,58 z" + id="path7" + inkscape:connector-curvature="0" + style="fill:#666666" /><path + d="m 104.906,102.468 -82.815,0 c -6.19,0 -11.227,-5.038 -11.227,-11.231 l 0,-55.209 c 0,-6.191 5.036,-11.227 11.227,-11.227 l 82.815,0 c 6.19,0 11.229,5.036 11.229,11.227 l 0,55.208 c 0,6.194 -5.038,11.232 -11.229,11.232 l 0,0 z" + id="path14" + style="fill:url(#SVGID_1_)" + inkscape:connector-curvature="0" /><path + d="m 113.525,71.782 c 0,0 0.02,-0.042 0.052,-0.114 -0.018,0.041 -0.034,0.074 -0.052,0.114 z m 0,0 c -5.221,11.31 -14.791,12.181 -14.791,12.181 l -81.273,13.92 -3.946,4.193 c 2.36,1.872 5.337,3 8.577,3 l 82.815,0 c 7.629,0 13.837,-6.207 13.837,-13.84 l 0,-19.454 -5.219,0 z" + id="path23" + style="fill:url(#SVGID_2_)" + inkscape:connector-curvature="0" /><path + d="m 104.906,22.192 c 7.629,0 13.837,6.207 13.837,13.836 l 0,55.208 c 0,7.633 -6.208,13.84 -13.837,13.84 l -82.815,0 c -7.629,0 -13.836,-6.207 -13.836,-13.84 l 0,-55.208 c 0,-7.629 6.207,-13.836 13.836,-13.836 l 82.815,0 m 0,5.22 -82.815,0 c -4.751,0 -8.616,3.865 -8.616,8.616 l 0,55.208 c 0,4.753 3.865,8.619 8.616,8.619 l 82.815,0 c 4.751,0 8.617,-3.866 8.617,-8.619 l 0,-55.208 c 0,-4.751 -3.866,-8.616 -8.617,-8.616 l 0,0 z" + id="path25" + inkscape:connector-curvature="0" + style="fill:#ffffff" /><path + d="m 104.906,22.192 c 7.629,0 13.837,6.207 13.837,13.836 l 0,55.208 c 0,7.633 -6.208,13.84 -13.837,13.84 l -82.815,0 c -7.629,0 -13.836,-6.207 -13.836,-13.84 l 0,-55.208 c 0,-7.629 6.207,-13.836 13.836,-13.836 l 82.815,0 m 0,3.48 -82.815,0 c -5.71,0 -10.356,4.646 -10.356,10.356 l 0,55.208 c 0,5.713 4.646,10.359 10.356,10.359 l 82.815,0 c 5.711,0 10.357,-4.646 10.357,-10.359 l 0,-55.208 c 10e-4,-5.71 -4.646,-10.356 -10.357,-10.356 l 0,0 z" + id="path27" + inkscape:connector-curvature="0" + style="fill:#b0b9c4" /><g + id="g4198"><rect + style="fill:#afafaf;fill-opacity:1;stroke:none;stroke-opacity:1" + id="rect4737" + width="92.856682" + height="2.1642509" + x="15.892935" + y="79.476509" /><rect + style="fill:#afafaf;fill-opacity:1;stroke:none;stroke-opacity:1" + id="rect4731" + width="92.856682" + height="2.1642509" + x="15.892935" + y="45.881531" /><rect + y="62.78833" + x="15.892935" + height="2.1642509" + width="92.856682" + id="rect4735" + style="fill:#afafaf;fill-opacity:1;stroke:none;stroke-opacity:1" /></g><path + d="M 96.125,87.346 C 79.1,91.045 17.461,97.883 17.461,97.883 L 88.003,71.217 c 0,0 20.494,17.185 25.521,-0.401 0.001,-0.001 -0.376,12.83 -17.399,16.53 z" + id="path35" + style="fill:url(#SVGID_3_)" + inkscape:connector-curvature="0" /></g></svg> \ No newline at end of file diff --git a/resources/images/backgroundPalette/background6.svg b/resources/images/backgroundPalette/background6.svg new file mode 100644 index 00000000..1c38545b --- /dev/null +++ b/resources/images/backgroundPalette/background6.svg @@ -0,0 +1,146 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Generator: Adobe Illustrator 13.0.2, SVG Export Plug-In . SVG Version: 6.00 Build 14948) --> + +<svg + xmlns:ns0="&#38;ns_sfw;" + xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/" + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + version="1.2" + x="0px" + y="0px" + width="128px" + height="128px" + viewBox="0 0 128 128" + xml:space="preserve" + id="svg5179" + inkscape:version="0.91 r13725" + sodipodi:docname="background6.svg"><defs + id="defs5216"><linearGradient + y2="102.1488" + x2="63.3647" + y1="24.7017" + x1="63.3647" + gradientUnits="userSpaceOnUse" + id="SVGID_1_"><stop + id="stop5187" + style="stop-color:#4D4D4D" + offset="0" /><stop + id="stop5189" + style="stop-color:#000000" + offset="1" /><a:midPointStop + style="stop-color:#4D4D4D" + offset="0" /><a:midPointStop + style="stop-color:#4D4D4D" + offset="0.5" /><a:midPointStop + style="stop-color:#000000" + offset="1" /></linearGradient><linearGradient + y2="77.0022" + x2="66.1289" + y1="104.8428" + x1="66.1289" + gradientUnits="userSpaceOnUse" + id="SVGID_2_"><stop + id="stop5196" + style="stop-color:#E0E0E0" + offset="0" /><stop + id="stop5198" + style="stop-color:#999999" + offset="1" /><a:midPointStop + style="stop-color:#E0E0E0" + offset="0" /><a:midPointStop + style="stop-color:#E0E0E0" + offset="0.5" /><a:midPointStop + style="stop-color:#999999" + offset="1" /></linearGradient></defs><sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="2182" + inkscape:window-height="2109" + id="namedview5214" + showgrid="false" + inkscape:zoom="9.703125" + inkscape:cx="73.508789" + inkscape:cy="54.309019" + inkscape:window-x="0" + inkscape:window-y="0" + inkscape:window-maximized="0" + inkscape:current-layer="svg5179" /><metadata + id="metadata5181"><ns0:sfw><ns0:slices /><ns0:sliceSourceBounds + x="5" + y="19" + width="117" + height="90" + bottomLeftOrigin="true" /></ns0:sfw><rdf:RDF><cc:Work + rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><g + id="g4825"><path + d="m 104.771,102.666 -82.814,0 c -6.19,0 -11.227,-5.037 -11.227,-11.23 l 0,-55.209 C 10.73,30.036 15.766,25 21.957,25 l 82.815,0 C 110.963,25 116,30.036 116,36.227 l 0,55.208 c 0,6.194 -5.037,11.231 -11.229,11.231 l 0,0 z" + id="path5191" + style="fill:url(#SVGID_1_)" + inkscape:connector-curvature="0" /><path + d="m 113.525,71.782 c 0,0 0.02,-0.042 0.052,-0.114 -0.018,0.041 -0.034,0.074 -0.052,0.114 z m 0,0 c -5.221,11.31 -14.791,12.181 -14.791,12.181 l -81.273,13.92 -3.946,4.193 c 2.36,1.872 5.337,3 8.577,3 l 82.815,0 c 7.629,0 13.837,-6.207 13.837,-13.84 l 0,-19.454 -5.219,0 z" + id="path5200" + style="fill:url(#SVGID_2_)" + inkscape:connector-curvature="0" /><path + d="m 104.906,22.192 c 7.629,0 13.837,6.207 13.837,13.836 l 0,55.208 c 0,7.633 -6.208,13.84 -13.837,13.84 l -82.815,0 c -7.629,0 -13.836,-6.207 -13.836,-13.84 l 0,-55.208 c 0,-7.629 6.207,-13.836 13.836,-13.836 l 82.815,0 m 0,5.22 -82.815,0 c -4.751,0 -8.616,3.865 -8.616,8.616 l 0,55.208 c 0,4.753 3.865,8.619 8.616,8.619 l 82.815,0 c 4.751,0 8.617,-3.866 8.617,-8.619 l 0,-55.208 c 0,-4.751 -3.866,-8.616 -8.617,-8.616 l 0,0 z" + id="path5202" + inkscape:connector-curvature="0" + style="fill:#ffffff" /><path + d="m 104.906,22.192 c 7.629,0 13.837,6.207 13.837,13.836 l 0,55.208 c 0,7.633 -6.208,13.84 -13.837,13.84 l -82.815,0 c -7.629,0 -13.836,-6.207 -13.836,-13.84 l 0,-55.208 c 0,-7.629 6.207,-13.836 13.836,-13.836 l 82.815,0 m 0,3.48 -82.815,0 c -5.71,0 -10.356,4.646 -10.356,10.356 l 0,55.208 c 0,5.713 4.646,10.359 10.356,10.359 l 82.815,0 c 5.711,0 10.357,-4.646 10.357,-10.359 l 0,-55.208 c 10e-4,-5.71 -4.646,-10.356 -10.357,-10.356 l 0,0 z" + id="path5204" + inkscape:connector-curvature="0" + style="fill:#b0b9c4" /><g + id="g4808"><rect + style="fill:#afafaf;fill-opacity:1;stroke:none;stroke-opacity:1" + id="rect4737" + width="92.856682" + height="2.1642509" + x="17.035017" + y="80.529778" /><rect + style="fill:#afafaf;fill-opacity:1;stroke:none;stroke-opacity:1" + id="rect4731" + width="92.856682" + height="2.1642509" + x="17.035017" + y="46.934799" /><rect + y="63.841599" + x="17.035017" + height="2.1642509" + width="92.856682" + id="rect4735" + style="fill:#afafaf;fill-opacity:1;stroke:none;stroke-opacity:1" /></g><g + id="Layer_1"><linearGradient + y2="78.9319" + x2="63.4618" + y1="92.851601" + x1="68.681602" + gradientUnits="userSpaceOnUse" + id="SVGID_3_"><stop + id="stop5208" + style="stop-color:#657180" + offset="0" /><stop + id="stop5210" + style="stop-color:#AFB9C5" + offset="1" /><a:midPointStop + style="stop-color:#657180" + offset="0" /><a:midPointStop + style="stop-color:#657180" + offset="0.5" /><a:midPointStop + style="stop-color:#AFB9C5" + offset="1" /></linearGradient><path + id="path5212" + d="M 96.125,87.346 C 79.1,91.045 17.461,97.883 17.461,97.883 L 88.003,71.217 c 0,0 20.494,17.185 25.521,-0.401 0.001,-0.001 -0.376,12.83 -17.399,16.53 z" + style="fill:url(#SVGID_3_)" + inkscape:connector-curvature="0" /></g></g></svg> \ No newline at end of file diff --git a/resources/images/backgroundPalette/background6On.svg b/resources/images/backgroundPalette/background6On.svg new file mode 100644 index 00000000..1210a251 --- /dev/null +++ b/resources/images/backgroundPalette/background6On.svg @@ -0,0 +1,150 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Generator: Adobe Illustrator 13.0.2, SVG Export Plug-In . SVG Version: 6.00 Build 14948) --> + +<svg + xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/" + xmlns:ns="&ns_sfw;" + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + version="1.2" + x="0px" + y="0px" + width="128px" + height="128px" + viewBox="0 0 128 128" + xml:space="preserve" + id="svg2" + inkscape:version="0.91 r13725" + sodipodi:docname="background6On.svg"><defs + id="defs39"><linearGradient + y2="102.1488" + x2="63.3647" + y1="24.7017" + x1="63.3647" + gradientUnits="userSpaceOnUse" + id="SVGID_1_"><stop + id="stop10" + style="stop-color:#4D4D4D" + offset="0" /><stop + id="stop12" + style="stop-color:#000000" + offset="1" /><a:midPointStop + style="stop-color:#4D4D4D" + offset="0" /><a:midPointStop + style="stop-color:#4D4D4D" + offset="0.5" /><a:midPointStop + style="stop-color:#000000" + offset="1" /></linearGradient><linearGradient + y2="77.0022" + x2="66.1289" + y1="104.8428" + x1="66.1289" + gradientUnits="userSpaceOnUse" + id="SVGID_2_"><stop + id="stop19" + style="stop-color:#E0E0E0" + offset="0" /><stop + id="stop21" + style="stop-color:#999999" + offset="1" /><a:midPointStop + style="stop-color:#E0E0E0" + offset="0" /><a:midPointStop + style="stop-color:#E0E0E0" + offset="0.5" /><a:midPointStop + style="stop-color:#999999" + offset="1" /></linearGradient><linearGradient + y2="78.9319" + x2="63.4618" + y1="92.8516" + x1="68.6816" + gradientUnits="userSpaceOnUse" + id="SVGID_3_"><stop + id="stop31" + style="stop-color:#657180" + offset="0" /><stop + id="stop33" + style="stop-color:#AFB9C5" + offset="1" /><a:midPointStop + style="stop-color:#657180" + offset="0" /><a:midPointStop + style="stop-color:#657180" + offset="0.5" /><a:midPointStop + style="stop-color:#AFB9C5" + offset="1" /></linearGradient></defs><sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1919" + inkscape:window-height="2109" + id="namedview37" + showgrid="false" + inkscape:zoom="7.375" + inkscape:cx="77.80969" + inkscape:cy="62.069929" + inkscape:window-x="1920" + inkscape:window-y="0" + inkscape:window-maximized="0" + inkscape:current-layer="svg2" /><metadata + id="metadata4"><ns:sfw><ns:slices /><ns:sliceSourceBounds + x="5" + y="19" + width="117" + height="90" + bottomLeftOrigin="true" /></ns:sfw><rdf:RDF><cc:Work + rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><g + id="g4195"><path + d="m 122,93 c 0,8.837 -7.164,16 -16,16 l -85,0 C 12.164,109 5,101.837 5,93 L 5,35 C 5,26.164 12.164,19 21,19 l 85,0 c 8.836,0 16,7.164 16,16 l 0,58 z" + id="path7" + inkscape:connector-curvature="0" + style="fill:#666666" /><path + d="m 104.771,102.666 -82.814,0 c -6.19,0 -11.227,-5.037 -11.227,-11.23 l 0,-55.209 C 10.73,30.036 15.766,25 21.957,25 l 82.815,0 C 110.963,25 116,30.036 116,36.227 l 0,55.208 c 0,6.194 -5.037,11.231 -11.229,11.231 l 0,0 z" + id="path14" + style="fill:url(#SVGID_1_)" + inkscape:connector-curvature="0" /><path + d="m 113.525,71.782 c 0,0 0.02,-0.042 0.052,-0.114 -0.018,0.041 -0.034,0.074 -0.052,0.114 z m 0,0 c -5.221,11.31 -14.791,12.181 -14.791,12.181 l -81.273,13.92 -3.946,4.193 c 2.36,1.872 5.337,3 8.577,3 l 82.815,0 c 7.629,0 13.837,-6.207 13.837,-13.84 l 0,-19.454 -5.219,0 z" + id="path23" + style="fill:url(#SVGID_2_)" + inkscape:connector-curvature="0" /><path + d="m 104.906,22.192 c 7.629,0 13.837,6.207 13.837,13.836 l 0,55.208 c 0,7.633 -6.208,13.84 -13.837,13.84 l -82.815,0 c -7.629,0 -13.836,-6.207 -13.836,-13.84 l 0,-55.208 c 0,-7.629 6.207,-13.836 13.836,-13.836 l 82.815,0 m 0,5.22 -82.815,0 c -4.751,0 -8.616,3.865 -8.616,8.616 l 0,55.208 c 0,4.753 3.865,8.619 8.616,8.619 l 82.815,0 c 4.751,0 8.617,-3.866 8.617,-8.619 l 0,-55.208 c 0,-4.751 -3.866,-8.616 -8.617,-8.616 l 0,0 z" + id="path25" + inkscape:connector-curvature="0" + style="fill:#ffffff" /><path + d="m 104.906,22.192 c 7.629,0 13.837,6.207 13.837,13.836 l 0,55.208 c 0,7.633 -6.208,13.84 -13.837,13.84 l -82.815,0 c -7.629,0 -13.836,-6.207 -13.836,-13.84 l 0,-55.208 c 0,-7.629 6.207,-13.836 13.836,-13.836 l 82.815,0 m 0,3.48 -82.815,0 c -5.71,0 -10.356,4.646 -10.356,10.356 l 0,55.208 c 0,5.713 4.646,10.359 10.356,10.359 l 82.815,0 c 5.711,0 10.357,-4.646 10.357,-10.359 l 0,-55.208 c 10e-4,-5.71 -4.646,-10.356 -10.357,-10.356 l 0,0 z" + id="path27" + inkscape:connector-curvature="0" + style="fill:#b0b9c4" /><g + id="g4198" + transform="translate(1.271945,1.1880072)"><rect + style="fill:#afafaf;fill-opacity:1;stroke:none;stroke-opacity:1" + id="rect4737" + width="92.856682" + height="2.1642509" + x="15.892935" + y="79.476509" /><rect + style="fill:#afafaf;fill-opacity:1;stroke:none;stroke-opacity:1" + id="rect4731" + width="92.856682" + height="2.1642509" + x="15.892935" + y="45.881531" /><rect + y="62.78833" + x="15.892935" + height="2.1642509" + width="92.856682" + id="rect4735" + style="fill:#afafaf;fill-opacity:1;stroke:none;stroke-opacity:1" /></g><path + d="M 96.125,87.346 C 79.1,91.045 17.461,97.883 17.461,97.883 L 88.003,71.217 c 0,0 20.494,17.185 25.521,-0.401 0.001,-0.001 -0.376,12.83 -17.399,16.53 z" + id="path35" + style="fill:url(#SVGID_3_)" + inkscape:connector-curvature="0" /></g></svg> \ No newline at end of file diff --git a/src/adaptors/UBExportFullPDF.cpp b/src/adaptors/UBExportFullPDF.cpp index 64b989a0..9b6684f0 100644 --- a/src/adaptors/UBExportFullPDF.cpp +++ b/src/adaptors/UBExportFullPDF.cpp @@ -97,8 +97,8 @@ void UBExportFullPDF::saveOverlayPdf(UBDocumentProxy* pDocumentProxy, const QStr UBGraphicsScene* scene = UBPersistenceManager::persistenceManager()->loadDocumentScene(pDocumentProxy, pageIndex); // set background to white, no grid for PDF output bool isDark = scene->isDarkBackground(); - bool isCrossed = scene->isCrossedBackground(); - scene->setBackground(false, false); + UBPageBackground pageBackground = scene->pageBackground(); + scene->setBackground(false, UBPageBackground::plain); // set high res rendering scene->setRenderingQuality(UBItem::RenderingQualityHigh); @@ -126,7 +126,7 @@ void UBExportFullPDF::saveOverlayPdf(UBDocumentProxy* pDocumentProxy, const QStr //restore background state scene->setDrawingMode(false); - scene->setBackground(isDark, isCrossed); + scene->setBackground(isDark, pageBackground); } if (pdfPainter) delete pdfPainter; diff --git a/src/adaptors/UBExportPDF.cpp b/src/adaptors/UBExportPDF.cpp index ad9aaa5a..9f70c57b 100644 --- a/src/adaptors/UBExportPDF.cpp +++ b/src/adaptors/UBExportPDF.cpp @@ -91,8 +91,8 @@ bool UBExportPDF::persistsDocument(UBDocumentProxy* pDocumentProxy, const QStrin UBApplication::showMessage(tr("Exporting page %1 of %2").arg(pageIndex + 1).arg(existingPageCount)); // set background to white, no crossing for PDF output bool isDark = scene->isDarkBackground(); - bool isCrossed = scene->isCrossedBackground(); - scene->setBackground(false, false); + UBPageBackground pageBackground = scene->pageBackground(); + scene->setBackground(false, UBPageBackground::plain); QSize pageSize = scene->nominalSize(); @@ -113,7 +113,7 @@ bool UBExportPDF::persistsDocument(UBDocumentProxy* pDocumentProxy, const QStrin scene->setRenderingQuality(UBItem::RenderingQualityNormal); //restore background state - scene->setBackground(isDark, isCrossed); + scene->setBackground(isDark, pageBackground); } if(!painterNeedsBegin) pdfPainter.end(); diff --git a/src/adaptors/UBSvgSubsetAdaptor.cpp b/src/adaptors/UBSvgSubsetAdaptor.cpp index 82da8160..bf04c400 100644 --- a/src/adaptors/UBSvgSubsetAdaptor.cpp +++ b/src/adaptors/UBSvgSubsetAdaptor.cpp @@ -445,6 +445,7 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene(UBDocumentProx bool darkBackground = false; bool crossedBackground = false; + bool ruledBackground = false; QStringRef ubDarkBackground = mXmlReader.attributes().value(mNamespaceUri, "dark-background"); @@ -456,7 +457,6 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene(UBDocumentProx if (!ubCrossedBackground.isNull()) crossedBackground = (ubCrossedBackground.toString() == xmlTrue); - mScene->setBackground(darkBackground, crossedBackground); if (crossedBackground) { QStringRef ubGridSize = mXmlReader.attributes().value(mNamespaceUri, "grid-size"); @@ -469,6 +469,32 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene(UBDocumentProx } } + QStringRef ubRuledBackground = mXmlReader.attributes().value(mNamespaceUri, "ruled-background"); + + if (!ubRuledBackground.isNull()) + ruledBackground = (ubRuledBackground.toString() == xmlTrue); + + if (ruledBackground && !crossedBackground) { // if for some reason both are true, the background will be a grid + QStringRef ubGridSize = mXmlReader.attributes().value(mNamespaceUri, "grid-size"); + + if (!ubGridSize.isNull()) { + int gridSize = ubGridSize.toInt(); + + UBSettings::settings()->crossSize = gridSize; + mScene->setBackgroundGridSize(gridSize); + } + } + + UBPageBackground bg; + if (crossedBackground) + bg = UBPageBackground::crossed; + else if (ruledBackground) + bg = UBPageBackground::ruled; + else + bg = UBPageBackground::plain; + + mScene->setBackground(darkBackground, bg); + QStringRef pageNominalSize = mXmlReader.attributes().value(mNamespaceUri, "nominal-size"); if (!pageNominalSize.isNull()) { @@ -1077,9 +1103,14 @@ void UBSvgSubsetAdaptor::UBSvgSubsetWriter::writeSvgElement(UBDocumentProxy* pro } mXmlWriter.writeAttribute(UBSettings::uniboardDocumentNamespaceUri, "dark-background", mScene->isDarkBackground() ? xmlTrue : xmlFalse); - mXmlWriter.writeAttribute(UBSettings::uniboardDocumentNamespaceUri, "crossed-background", mScene->isCrossedBackground() ? xmlTrue : xmlFalse); - if (mScene->isCrossedBackground()) { + bool crossedBackground = mScene->pageBackground() == UBPageBackground::crossed; + bool ruledBackground = mScene->pageBackground() == UBPageBackground::ruled; + + mXmlWriter.writeAttribute(UBSettings::uniboardDocumentNamespaceUri, "crossed-background", crossedBackground ? xmlTrue : xmlFalse); + mXmlWriter.writeAttribute(UBSettings::uniboardDocumentNamespaceUri, "ruled-background", ruledBackground ? xmlTrue : xmlFalse); + + if (crossedBackground || ruledBackground) { int gridSize = mScene->backgroundGridSize(); mXmlWriter.writeAttribute(UBSettings::uniboardDocumentNamespaceUri, "grid-size", QString::number(gridSize)); diff --git a/src/api/UBWidgetUniboardAPI.cpp b/src/api/UBWidgetUniboardAPI.cpp index c84bb546..5645519c 100644 --- a/src/api/UBWidgetUniboardAPI.cpp +++ b/src/api/UBWidgetUniboardAPI.cpp @@ -223,8 +223,12 @@ void UBWidgetUniboardAPI::addObject(QString pUrl, int width, int height, int x, void UBWidgetUniboardAPI::setBackground(bool pIsDark, bool pIsCrossed) { - if (mScene) - mScene->setBackground(pIsDark, pIsCrossed); + if (mScene) { + if (pIsCrossed) + mScene->setBackground(pIsDark, UBPageBackground::crossed); + else + mScene->setBackground(pIsDark, UBPageBackground::plain); + } } diff --git a/src/board/UBBoardController.cpp b/src/board/UBBoardController.cpp index a87524d2..b1dac51f 100644 --- a/src/board/UBBoardController.cpp +++ b/src/board/UBBoardController.cpp @@ -1527,14 +1527,14 @@ void UBBoardController::setActiveDocumentScene(UBDocumentProxy* pDocumentProxy, adjustDisplayViews(); UBSettings::settings()->setDarkBackground(mActiveScene->isDarkBackground()); - UBSettings::settings()->setCrossedBackground(mActiveScene->isCrossedBackground()); + UBSettings::settings()->setPageBackground(mActiveScene->pageBackground()); freezeW3CWidgets(false); } selectionChanged(); - updateBackgroundActionsState(mActiveScene->isDarkBackground(), mActiveScene->isCrossedBackground()); + updateBackgroundActionsState(mActiveScene->isDarkBackground(), mActiveScene->pageBackground()); if(documentChange) UBGraphicsTextItem::lastUsedTextColor = QColor(); @@ -1650,17 +1650,17 @@ int UBBoardController::autosaveTimeoutFromSettings() return value * minute; } -void UBBoardController::changeBackground(bool isDark, bool isCrossed) +void UBBoardController::changeBackground(bool isDark, UBPageBackground pageBackground) { bool currentIsDark = mActiveScene->isDarkBackground(); - bool currentIsCrossed = mActiveScene->isCrossedBackground(); + UBPageBackground currentBackgroundType = mActiveScene->pageBackground(); - if ((isDark != currentIsDark) || (currentIsCrossed != isCrossed)) + if ((isDark != currentIsDark) || (currentBackgroundType != pageBackground)) { UBSettings::settings()->setDarkBackground(isDark); - UBSettings::settings()->setCrossedBackground(isCrossed); + UBSettings::settings()->setPageBackground(pageBackground); - mActiveScene->setBackground(isDark, isCrossed); + mActiveScene->setBackground(isDark, pageBackground); emit backgroundChanged(); } @@ -2449,16 +2449,31 @@ void UBBoardController::moveToolWidgetToScene(UBToolWidget* toolWidget) } -void UBBoardController::updateBackgroundActionsState(bool isDark, bool isCrossed) +void UBBoardController::updateBackgroundActionsState(bool isDark, UBPageBackground pageBackground) { - if (isDark && !isCrossed) - mMainWindow->actionPlainDarkBackground->setChecked(true); - else if (isDark && isCrossed) - mMainWindow->actionCrossedDarkBackground->setChecked(true); - else if (!isDark && isCrossed) - mMainWindow->actionCrossedLightBackground->setChecked(true); - else - mMainWindow->actionPlainLightBackground->setChecked(true); + switch (pageBackground) { + + case UBPageBackground::crossed: + if (isDark) + mMainWindow->actionCrossedDarkBackground->setChecked(true); + else + mMainWindow->actionCrossedLightBackground->setChecked(true); + break; + + case UBPageBackground::ruled : + if (isDark) + mMainWindow->actionRuledDarkBackground->setChecked(true); + else + mMainWindow->actionRuledLightBackground->setChecked(true); + break; + + default: + if (isDark) + mMainWindow->actionPlainDarkBackground->setChecked(true); + else + mMainWindow->actionPlainLightBackground->setChecked(true); + break; + } } diff --git a/src/board/UBBoardController.h b/src/board/UBBoardController.h index f57b21ef..5631299a 100644 --- a/src/board/UBBoardController.h +++ b/src/board/UBBoardController.h @@ -220,7 +220,7 @@ class UBBoardController : public UBDocumentContainer UBItem *downloadFinished(bool pSuccess, QUrl sourceUrl, QUrl contentUrl, QString pHeader, QByteArray pData, QPointF pPos, QSize pSize, bool isBackground = false, bool internalData = false); - void changeBackground(bool isDark, bool isCrossed); + void changeBackground(bool isDark, UBPageBackground pageBackground); void setToolCursor(int tool); void showMessage(const QString& message, bool showSpinningWheel = false); void hideMessage(); @@ -321,7 +321,7 @@ class UBBoardController : public UBDocumentContainer void stylusToolDoubleClicked(int tool); void boardViewResized(QResizeEvent* event); void documentWillBeDeleted(UBDocumentProxy* pProxy); - void updateBackgroundActionsState(bool isDark, bool isCrossed); + void updateBackgroundActionsState(bool isDark, UBPageBackground pageBackground); void colorPaletteChanged(); void libraryDialogClosed(int ret); void lastWindowClosed(); diff --git a/src/board/UBBoardPaletteManager.cpp b/src/board/UBBoardPaletteManager.cpp index cbff6491..449d0831 100644 --- a/src/board/UBBoardPaletteManager.cpp +++ b/src/board/UBBoardPaletteManager.cpp @@ -251,8 +251,10 @@ void UBBoardPaletteManager::setupPalettes() backgroundsActions << UBApplication::mainWindow->actionPlainLightBackground; backgroundsActions << UBApplication::mainWindow->actionCrossedLightBackground; + backgroundsActions << UBApplication::mainWindow->actionRuledLightBackground; backgroundsActions << UBApplication::mainWindow->actionPlainDarkBackground; backgroundsActions << UBApplication::mainWindow->actionCrossedDarkBackground; + backgroundsActions << UBApplication::mainWindow->actionRuledDarkBackground; mBackgroundsPalette = new UBBackgroundPalette(backgroundsActions, mContainer); mBackgroundsPalette->setButtonIconSize(QSize(128, 128)); @@ -434,8 +436,10 @@ void UBBoardPaletteManager::connectPalettes() connect(UBApplication::mainWindow->actionPlainLightBackground, SIGNAL(triggered()), this, SLOT(changeBackground())); connect(UBApplication::mainWindow->actionCrossedLightBackground, SIGNAL(triggered()), this, SLOT(changeBackground())); + connect(UBApplication::mainWindow->actionRuledLightBackground, SIGNAL(triggered()), this, SLOT(changeBackground())); connect(UBApplication::mainWindow->actionPlainDarkBackground, SIGNAL(triggered()), this, SLOT(changeBackground())); connect(UBApplication::mainWindow->actionCrossedDarkBackground, SIGNAL(triggered()), this, SLOT(changeBackground())); + connect(UBApplication::mainWindow->actionRuledDarkBackground, SIGNAL(triggered()), this, SLOT(changeBackground())); connect(UBApplication::mainWindow->actionPodcast, SIGNAL(triggered(bool)), this, SLOT(tooglePodcastPalette(bool))); connect(UBApplication::mainWindow->actionAddItemToCurrentPage, SIGNAL(triggered()), this, SLOT(addItemToCurrentPage())); @@ -525,13 +529,22 @@ void UBBoardPaletteManager::containerResized() void UBBoardPaletteManager::changeBackground() { if (UBApplication::mainWindow->actionCrossedLightBackground->isChecked()) - UBApplication::boardController->changeBackground(false, true); + UBApplication::boardController->changeBackground(false, UBPageBackground::crossed); + + else if (UBApplication::mainWindow->actionRuledLightBackground->isChecked()) + UBApplication::boardController->changeBackground(false, UBPageBackground::ruled); + else if (UBApplication::mainWindow->actionPlainDarkBackground->isChecked()) - UBApplication::boardController->changeBackground(true, false); + UBApplication::boardController->changeBackground(true, UBPageBackground::plain); + else if (UBApplication::mainWindow->actionCrossedDarkBackground->isChecked()) - UBApplication::boardController->changeBackground(true, true); + UBApplication::boardController->changeBackground(true, UBPageBackground::crossed); + + else if (UBApplication::mainWindow->actionRuledDarkBackground->isChecked()) + UBApplication::boardController->changeBackground(true, UBPageBackground::ruled); + else - UBApplication::boardController->changeBackground(false, false); + UBApplication::boardController->changeBackground(false, UBPageBackground::plain); mBackgroundsPalette->backgroundChanged(); } diff --git a/src/board/UBBoardView.cpp b/src/board/UBBoardView.cpp index b50d0115..490e3955 100644 --- a/src/board/UBBoardView.cpp +++ b/src/board/UBBoardView.cpp @@ -1607,7 +1607,7 @@ void UBBoardView::drawBackground (QPainter *painter, const QRectF &rect) painter->setPen (bgCrossColor); - if (scene () && scene ()->isCrossedBackground ()) + if (scene () && scene ()->pageBackground() == UBPageBackground::crossed) { qreal firstY = ((int) (rect.y () / scene()->backgroundGridSize())) * scene()->backgroundGridSize(); @@ -1623,6 +1623,16 @@ void UBBoardView::drawBackground (QPainter *painter, const QRectF &rect) painter->drawLine (xPos, rect.y (), xPos, rect.y () + rect.height ()); } } + + if (scene() && scene()->pageBackground() == UBPageBackground::ruled) + { + qreal firstY = ((int) (rect.y () / scene()->backgroundGridSize())) * scene()->backgroundGridSize(); + + for (qreal yPos = firstY; yPos < rect.y () + rect.height (); yPos += scene()->backgroundGridSize()) + { + painter->drawLine (rect.x (), yPos, rect.x () + rect.width (), yPos); + } + } } if (!mFilterZIndex && scene ()) diff --git a/src/core/UB.h b/src/core/UB.h index 651ac139..4c791615 100644 --- a/src/core/UB.h +++ b/src/core/UB.h @@ -212,4 +212,11 @@ struct UBUndoType }; }; +enum UBPageBackground +{ + plain = 0, + crossed, + ruled +}; + #endif /* UB_H_ */ diff --git a/src/core/UBApplicationController.cpp b/src/core/UBApplicationController.cpp index 48d670ad..7e45d365 100644 --- a/src/core/UBApplicationController.cpp +++ b/src/core/UBApplicationController.cpp @@ -111,7 +111,7 @@ UBApplicationController::UBApplicationController(UBBoardView *pControlView, } mBlackScene = new UBGraphicsScene(0); // deleted by UBApplicationController::destructor - mBlackScene->setBackground(true, false); + mBlackScene->setBackground(true, UBPageBackground::plain); if (mDisplayManager->numScreens() >= 2) { diff --git a/src/core/UBPersistenceManager.cpp b/src/core/UBPersistenceManager.cpp index bcef40aa..9b951b1e 100644 --- a/src/core/UBPersistenceManager.cpp +++ b/src/core/UBPersistenceManager.cpp @@ -653,7 +653,7 @@ UBGraphicsScene* UBPersistenceManager::createDocumentSceneAt(UBDocumentProxy* pr UBGraphicsScene *newScene = mSceneCache.createScene(proxy, index, useUndoRedoStack); newScene->setBackground(UBSettings::settings()->isDarkBackground(), - UBSettings::settings()->UBSettings::isCrossedBackground()); + UBSettings::settings()->UBSettings::pageBackground()); persistDocumentScene(proxy, newScene, index); diff --git a/src/core/UBSettings.cpp b/src/core/UBSettings.cpp index ad9bc861..3b1bc4f5 100644 --- a/src/core/UBSettings.cpp +++ b/src/core/UBSettings.cpp @@ -735,9 +735,16 @@ bool UBSettings::isDarkBackground() } -bool UBSettings::isCrossedBackground() +UBPageBackground UBSettings::pageBackground() { - return value("Board/CrossedBackground", 0).toBool(); + QString val = value("Board/PageBackground", 0).toString(); + + if (val == "crossed") + return UBPageBackground::crossed; + else if (val == "ruled") + return UBPageBackground::ruled; + else + return UBPageBackground::plain; } @@ -748,9 +755,18 @@ void UBSettings::setDarkBackground(bool isDarkBackground) } -void UBSettings::setCrossedBackground(bool isCrossedBackground) +void UBSettings::setPageBackground(UBPageBackground background) { - setValue("Board/CrossedBackground", isCrossedBackground); + QString val; + + if (background == UBPageBackground::crossed) + val = "crossed"; + else if (background == UBPageBackground::ruled) + val = "ruled"; + else + val = "plain"; + + setValue("Board/PageBackground", val); } @@ -1413,4 +1429,8 @@ void UBSettings::checkNewSettings() // A typo was corrected in version 1.3 removeSetting("Board/useSystemOnScreenKeybard"); + + // CrossedBackground changed in 1.4 (no longer a bool but an enum; can be crossed or ruled) + removeSetting("Board/CrossedBackground"); + } diff --git a/src/core/UBSettings.h b/src/core/UBSettings.h index b0bf73ca..6be12962 100644 --- a/src/core/UBSettings.h +++ b/src/core/UBSettings.h @@ -87,9 +87,9 @@ class UBSettings : public QObject // Background related bool isDarkBackground(); - bool isCrossedBackground(); + UBPageBackground pageBackground(); void setDarkBackground(bool isDarkBackground); - void setCrossedBackground(bool isCrossedBackground); + void setPageBackground(UBPageBackground background); // Stylus palette related bool isStylusPaletteVisible(); diff --git a/src/desktop/UBDesktopAnnotationController.cpp b/src/desktop/UBDesktopAnnotationController.cpp index 894b33bc..40188703 100644 --- a/src/desktop/UBDesktopAnnotationController.cpp +++ b/src/desktop/UBDesktopAnnotationController.cpp @@ -185,9 +185,9 @@ UBDesktopAnnotationController::~UBDesktopAnnotationController() void UBDesktopAnnotationController::updateColors(){ if(UBApplication::boardController->activeScene()->isDarkBackground()){ - mTransparentDrawingScene->setBackground(true, false); + mTransparentDrawingScene->setBackground(true, UBPageBackground::plain); }else{ - mTransparentDrawingScene->setBackground(false, false); + mTransparentDrawingScene->setBackground(false, UBPageBackground::plain); } } diff --git a/src/domain/UBGraphicsScene.cpp b/src/domain/UBGraphicsScene.cpp index acd54ee7..6a451a28 100644 --- a/src/domain/UBGraphicsScene.cpp +++ b/src/domain/UBGraphicsScene.cpp @@ -321,7 +321,7 @@ UBGraphicsScene::UBGraphicsScene(UBDocumentProxy* parent, bool enableUndoRedoSta , mMarkerCircle(0) , mDocument(parent) , mDarkBackground(false) - , mCrossedBackground(false) + , mPageBackground(UBPageBackground::plain) , mIsDesktopMode(false) , mZoomFactor(1) , mBackgroundObject(0) @@ -1010,7 +1010,7 @@ void UBGraphicsScene::drawArcTo(const QPointF& pCenterPoint, qreal pSpanAngle) setDocumentUpdated(); } -void UBGraphicsScene::setBackground(bool pIsDark, bool pIsCrossed) +void UBGraphicsScene::setBackground(bool pIsDark, UBPageBackground pBackground) { bool needRepaint = false; @@ -1026,9 +1026,9 @@ void UBGraphicsScene::setBackground(bool pIsDark, bool pIsCrossed) setModified(true); } - if (mCrossedBackground != pIsCrossed) + if (mPageBackground != pBackground) { - mCrossedBackground = pIsCrossed; + mPageBackground = pBackground; needRepaint = true; setModified(true); } @@ -1243,7 +1243,7 @@ UBGraphicsScene* UBGraphicsScene::sceneDeepCopy() const { UBGraphicsScene* copy = new UBGraphicsScene(this->document(), this->mUndoRedoStackEnabled); - copy->setBackground(this->isDarkBackground(), this->isCrossedBackground()); + copy->setBackground(this->isDarkBackground(), mPageBackground); copy->setBackgroundGridSize(mBackgroundGridSize); copy->setSceneRect(this->sceneRect()); @@ -2489,7 +2489,7 @@ void UBGraphicsScene::drawBackground(QPainter *painter, const QRectF &rect) painter->setPen (bgCrossColor); - if (isCrossedBackground()) + if (mPageBackground == UBPageBackground::crossed) { qreal firstY = ((int) (rect.y () / backgroundGridSize())) * backgroundGridSize(); @@ -2505,6 +2505,16 @@ void UBGraphicsScene::drawBackground(QPainter *painter, const QRectF &rect) painter->drawLine (xPos, rect.y (), xPos, rect.y () + rect.height ()); } } + + else if (mPageBackground == UBPageBackground::ruled) + { + qreal firstY = ((int) (rect.y () / backgroundGridSize())) * backgroundGridSize(); + + for (qreal yPos = firstY; yPos < rect.y () + rect.height (); yPos += backgroundGridSize()) + { + painter->drawLine (rect.x (), yPos, rect.x () + rect.width (), yPos); + } + } } } diff --git a/src/domain/UBGraphicsScene.h b/src/domain/UBGraphicsScene.h index 05674873..37f1a470 100644 --- a/src/domain/UBGraphicsScene.h +++ b/src/domain/UBGraphicsScene.h @@ -217,9 +217,9 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem return !mDarkBackground; } - bool isCrossedBackground() const + UBPageBackground pageBackground() const { - return mCrossedBackground; + return mPageBackground; } int backgroundGridSize() const @@ -336,7 +336,7 @@ public slots: void initStroke(); void hideTool(); - void setBackground(bool pIsDark, bool pIsCrossed); + void setBackground(bool pIsDark, UBPageBackground pBackground); void setBackgroundZoomFactor(qreal zoom); void setBackgroundGridSize(int pSize); void setDrawingMode(bool bModeDesktop); @@ -413,7 +413,7 @@ public slots: UBDocumentProxy* mDocument; bool mDarkBackground; - bool mCrossedBackground; + UBPageBackground mPageBackground; int mBackgroundGridSize; bool mIsDesktopMode;