# features (the more the better)
ENABLE_TCL := 1
-ENABLE_QT4 := 1
ENABLE_ABC := 1
ENABLE_PLUGINS := 1
ENABLE_READLINE := 1
LDFLAGS += -pg
endif
-ifeq ($(ENABLE_QT4),1)
-TARGETS += yosys-svgviewer
-endif
-
ifeq ($(ENABLE_ABC),1)
TARGETS += yosys-abc
endif
-e 's,@BINDIR@,$(DESTDIR)/bin,;' -e 's,@DATDIR@,$(DESTDIR)/share/yosys,;' < yosys-config.in > yosys-config
$(Q) chmod +x yosys-config
-yosys-svgviewer: libs/svgviewer/*.h libs/svgviewer/*.cpp
- $(P) cd libs/svgviewer && $(QMAKE) && $(MAKE) $(S)
- $(Q) cp `find libs/svgviewer -name svgviewer -type f` yosys-svgviewer
-
abc/abc-$(ABCREV):
$(P)
ifneq ($(ABCREV),default)
rm -f $(OBJS) $(GENFILES) $(TARGETS) $(EXTRA_TARGETS)
rm -f kernel/version_*.o kernel/version_*.cc abc/abc-[0-9a-f]*
rm -f libs/*/*.d frontends/*/*.d passes/*/*.d backends/*/*.d kernel/*.d techlibs/*/*.d
- test ! -f libs/svgviewer/Makefile || make -C libs/svgviewer distclean
clean-abc:
make -C abc clean
config-emcc: clean
echo 'CONFIG := emcc' > Makefile.conf
echo 'ENABLE_TCL := 0' >> Makefile.conf
- echo 'ENABLE_QT4 := 0' >> Makefile.conf
echo 'ENABLE_ABC := 0' >> Makefile.conf
echo 'ENABLE_PLUGINS := 0' >> Makefile.conf
echo 'ENABLE_READLINE := 0' >> Makefile.conf
You need a C++ compiler with C++11 support (up-to-date CLANG or GCC is
recommended) and some standard tools such as GNU Flex, GNU Bison, and GNU Make.
-The Qt4 library is needed for the yosys SVG viewer, that is used to display
-schematics, the minisat library is required for the SAT features in yosys
-and TCL for the scripting functionality. The extensive test suite requires
-Icarus Verilog. For example on Ubuntu Linux 12.04 LTS the following commands
-will install all prerequisites for building yosys:
-
- $ yosys_deps="git g++ clang make bison flex libreadline-dev
- tcl8.5-dev zlib1g-dev libqt4-dev libffi-dev
- mercurial iverilog graphviz xdot"
+TCL, readline and libffi are optional (see ENABLE_* settings in Makefile).
+Xdot (graphviz) is used by the "show" command in yosys to display schematics.
+For example on Ubuntu Linux 14.04 LTS the following commands will install all
+prerequisites for building yosys:
+
+ $ yosys_deps="build-essential clang bison flex libreadline-dev
+ tcl8.5-dev libffi-dev git mercurial graphviz xdot"
$ sudo apt-get install $yosys_deps
There are also pre-compiled packages for Yosys on Ubuntu. Visit the Yosys
http://www.clifford.at/yosys/download.html
-To configure the build system to use a specific set of compiler and
-build configuration, use one of
+To configure the build system to use a specific compiler, use one of
- $ make config-clang-debug
- $ make config-gcc-debug
- $ make config-release
+ $ make config-clang
+ $ make config-gcc
For other compilers and build configurations it might be
necessary to make some changes to the config section of the
yosys> proc; opt
-display design netlist using the yosys svg viewer:
+display design netlist using xdot:
yosys> show
$ ./yosys -o synth.v tests/simple/fiedler-cooley.v synth.ys
-The following synthesis script works reasonable for all designs:
+The following very basic synthesis script should work well with all designs:
# check design hierarchy
hierarchy
- # translate processes (always blocks) and memories (arrays)
- proc; memory; opt
+ # translate processes (always blocks)
+ proc; opt
# detect and optimize FSM encodings
fsm; opt
+ # implement memories (arrays)
+ memory; opt
+
# convert to gate logic
techmap; opt
for the given cell library:
# the high-level stuff
- hierarchy; proc; memory; opt; fsm; opt
+ hierarchy; proc; fsm; opt; memory; opt
# mapping to internal cell library
techmap; opt
+++ /dev/null
-Makefile
-moc_mainwindow.cpp
-moc_svgview.cpp
-qrc_svgviewer.cpp
-svgviewer
-svgviewer.app
+++ /dev/null
-<?xml version="1.0" standalone="no"?>
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
-<svg width="20cm" height="15cm" viewBox="0 0 800 600"
- xmlns="http://www.w3.org/2000/svg"
- xmlns:xlink="http://www.w3.org/1999/xlink/"
- baseProfile="tiny" version="1.2">
- <title>Spheres</title>
- <desc>Semi-transparent bubbles on a colored background.</desc>
- <defs>
- <!-- Create radial gradients for each bubble. -->
- <radialGradient id="blueBubble" gradientUnits="userSpaceOnUse"
- cx="0" cy="0" r="100" fx="-50" fy="-50">
- <stop offset="0%" stop-color="white" stop-opacity="1" />
- <stop offset="25%" stop-color="#cdcdff" stop-opacity=".65" />
- <stop offset="100%" stop-color="#cdaacd" stop-opacity=".75" />
- </radialGradient>
- <radialGradient id="redBubble" gradientUnits="userSpaceOnUse"
- cx="0" cy="0" r="100" fx="-50" fy="-50">
- <stop offset="0%" stop-color="white" stop-opacity="1" />
- <stop offset="25%" stop-color="#ffcdcd" stop-opacity=".65" />
- <stop offset="100%" stop-color="#bbbb99" stop-opacity=".75" />
- </radialGradient>
- <radialGradient id="greenBubble" gradientUnits="userSpaceOnUse"
- cx="0" cy="0" r="100" fx="-50" fy="-50">
- <stop offset="0%" stop-color="white" stop-opacity="1" />
- <stop offset="25%" stop-color="#cdffcd" stop-opacity=".65" />
- <stop offset="100%" stop-color="#99aaaa" stop-opacity=".75" />
- </radialGradient>
- <radialGradient id="yellowBubble" gradientUnits="userSpaceOnUse"
- cx="0" cy="0" r="100" fx="-50" fy="-50">
- <stop offset="0%" stop-color="white" stop-opacity="1" />
- <stop offset="25%" stop-color="#ffffcd" stop-opacity=".65" />
- <stop offset="100%" stop-color="#bbbbaa" stop-opacity=".75" />
- </radialGradient>
- <radialGradient id="background" gradientUnits="userSpaceOnUse"
- cx="0" cy="0" r="400" fx="250" fy="250">
- <stop offset="0%" stop-color="#ffffee" />
- <stop offset="100%" stop-color="#ccccaa" />
- </radialGradient>
- <linearGradient id="surface" gradientUnits="userSpaceOnUse"
- x1="-100" y1="200" x2="400" y2="200">
- <stop offset="0%" stop-color="#ffffcc" />
- <stop offset="100%" stop-color="#bbbb88" />
- </linearGradient>
-
- <!-- Create radial gradients for each circle to make them look like
- spheres. -->
- <radialGradient id="blueSphere" gradientUnits="userSpaceOnUse"
- cx="0" cy="0" r="100" fx="-50" fy="-50">
- <stop offset="0%" stop-color="white" />
- <stop offset="75%" stop-color="blue" />
- <stop offset="100%" stop-color="#222244" />
- </radialGradient>
- <radialGradient id="redSphere" gradientUnits="userSpaceOnUse"
- cx="0" cy="0" r="100" fx="-50" fy="-50">
- <stop offset="0%" stop-color="white" />
- <stop offset="75%" stop-color="red" />
- <stop offset="100%" stop-color="#442222" />
- </radialGradient>
- <radialGradient id="greenSphere" gradientUnits="userSpaceOnUse"
- cx="0" cy="0" r="100" fx="-50" fy="-50">
- <stop offset="0%" stop-color="white" />
- <stop offset="75%" stop-color="green" />
- <stop offset="100%" stop-color="#113311" />
- </radialGradient>
- <radialGradient id="yellowSphere" gradientUnits="userSpaceOnUse"
- cx="0" cy="0" r="100" fx="-50" fy="-50">
- <stop offset="0%" stop-color="white" />
- <stop offset="75%" stop-color="yellow" />
- <stop offset="100%" stop-color="#444422" />
- </radialGradient>
- <radialGradient id="shadowGrad" gradientUnits="userSpaceOnUse"
- cx="0" cy="0" r="100" fx="-50" fy="50">
- <stop offset="0%" stop-color="black" stop-opacity="1.0" />
- <stop offset="100%" stop-color="black" stop-opacity="0.0" />
- </radialGradient>
-
- <!-- Define a shadow for each sphere. -->
- <circle id="shadow" fill="url(#shadowGrad)" cx="0" cy="0" r="100" />
- <g id="bubble">
- <circle fill="black" cx="0" cy="0" r="50" />
- <circle fill="#a6ce39" cx="0" cy="0" r="33" />
- <path fill="black" d="M 37,50 L 50,37 L 12,-1 L 22,-11 L 10,-24 L -24,10
- L -11,22 L -1,12 Z" />
- <circle cx="0" cy="0" r="100" />
- </g>
- </defs>
- <g>
- <rect fill="url(#background)" x="0" y="0" width="800" height="600" />
- </g>
-
- <g transform="translate(200,700)">
- <use xlink:href="#bubble" fill="url(#blueBubble)" />
- <animateTransform attributeName="transform" type="translate" additive="sum"
- values="0,0; 0,-800" begin="1s" dur="10s" fill="freeze" repeatCount="indefinite" />
- </g>
- <g transform="translate(315,700)">
- <g transform="scale(0.5,0.5)">
- <use xlink:href="#bubble" fill="url(#redBubble)" />
- </g>
- <animateTransform attributeName="transform" type="translate" additive="sum"
- values="0,0; 0,-800" begin="3s" dur="7s" fill="freeze" repeatCount="indefinite" />
- </g>
- <g transform="translate(80,700)">
- <g transform="scale(0.65,0.65)">
- <use xlink:href="#bubble" fill="url(#greenBubble)" />
- </g>
- <animateTransform attributeName="transform" type="translate" additive="sum"
- values="0,0; 0,-800" begin="5s" dur="9s" fill="freeze" repeatCount="indefinite" />
- </g>
- <g transform="translate(255,700)">
- <g transform="scale(0.3,0.3)">
- <use xlink:href="#bubble" fill="url(#yellowBubble)" />
- </g>
- <animateTransform attributeName="transform" type="translate" additive="sum"
- values="0,0; 0,-800" begin="2s" dur="6s" fill="freeze" repeatCount="indefinite" />
- </g>
- <g transform="translate(565,700)">
- <g transform="scale(0.4,0.4)">
- <use xlink:href="#bubble" fill="url(#blueBubble)" />
- </g>
- <animateTransform attributeName="transform" type="translate" additive="sum"
- values="0,0; 0,-800" begin="4s" dur="8s" fill="freeze" repeatCount="indefinite" />
- </g>
- <g transform="translate(715,700)">
- <g transform="scale(0.6,0.6)">
- <use xlink:href="#bubble" fill="url(#redBubble)" />
- </g>
- <animateTransform attributeName="transform" type="translate" additive="sum"
- values="0,0; 0,-800" begin="1s" dur="4s" fill="freeze" repeatCount="indefinite" />
- </g>
- <g transform="translate(645,700)">
- <g transform="scale(0.375,0.375)">
- <use xlink:href="#bubble" fill="url(#greenBubble)" />
- </g>
- <animateTransform attributeName="transform" type="translate" additive="sum"
- values="0,0; 0,-800" begin="0s" dur="11s" fill="freeze" repeatCount="indefinite" />
- </g>
- <g transform="translate(555,700)">
- <g transform="scale(0.9,0.9)">
- <use xlink:href="#bubble" fill="url(#yellowBubble)" />
- </g>
- <animateTransform attributeName="transform" type="translate" additive="sum"
- values="0,0; 0,-800" begin="3s" dur="7.5s" fill="freeze" repeatCount="indefinite" />
- </g>
-
- <g transform="translate(360,700)">
- <g transform="scale(0.5,0.5)">
- <use xlink:href="#bubble" fill="url(#blueBubble)" />
- </g>
- <animateTransform attributeName="transform" type="translate" additive="sum"
- values="0,0; 0,-800" begin="3s" dur="6s" fill="freeze" repeatCount="indefinite" />
- </g>
- <g transform="translate(215,700)">
- <g transform="scale(0.45,0.45)">
- <use xlink:href="#bubble" fill="url(#redBubble)" />
- </g>
- <animateTransform attributeName="transform" type="translate" additive="sum"
- values="0,0; 0,-800" begin="5.5s" dur="7s" fill="freeze" repeatCount="indefinite" />
- </g>
- <g transform="translate(420,700)">
- <g transform="scale(0.75,0.75)">
- <use xlink:href="#bubble" fill="url(#greenBubble)" />
- </g>
- <animateTransform attributeName="transform" type="translate" additive="sum"
- values="0,0; 0,-800" begin="1s" dur="9s" fill="freeze" repeatCount="indefinite" />
- </g>
- <g transform="translate(815,700)">
- <g transform="scale(0.6,0.6)">
- <use xlink:href="#bubble" fill="url(#yellowBubble)" />
- </g>
- <animateTransform attributeName="transform" type="translate" additive="sum"
- values="0,0; 0,-800" begin="2s" dur="9.5s" fill="freeze" repeatCount="indefinite" />
- </g>
-
- <g transform="translate(225,375)" >
- <g transform="scale(1.0,0.5)" >
- <path d="M 0 0 L 350 0 L 450 450 L -100 450 z"
- fill="url(#surface)" stroke="none" />
- </g>
- </g>
- <g transform="translate(200,0)" >
- <g transform="translate(200,490) scale(2.0,1.0) rotate(45)" >
- <rect fill="#a6ce39" x="-69" y="-69" width="138" height="138" />
- <circle fill="black" cx="0" cy="0" r="50" />
- <circle fill="#a6ce39" cx="0" cy="0" r="33" />
- <path fill="black" d="M 37,50 L 50,37 L 12,-1 L 22,-11 L 10,-24 L -24,10
- L -11,22 L -1,12 Z" />
- <animateTransform attributeName="transform" type="rotate" additive="sum" values="0; 360"
- begin="0s" dur="10s" fill="freeze" repeatCount="indefinite" />
- </g>
- <g transform="translate(200,375)">
- <use xlink:href="#shadow" transform="translate(25,55) scale(1.0,0.5)" />
- <circle fill="url(#blueSphere)" cx="0" cy="0" r="100" />
- </g>
- <g transform="translate(315,440)">
- <g transform="scale(0.5,0.5)">
- <use xlink:href="#shadow" transform="translate(25,55) scale(1.0,0.5)" />
- <circle fill="url(#redSphere)" cx="0" cy="0" r="100" />
- </g>
- </g>
- <g transform="translate(80,475)">
- <g transform="scale(0.65,0.65)">
- <use xlink:href="#shadow" transform="translate(25,55) scale(1.0,0.5)" />
- <circle fill="url(#greenSphere)" cx="0" cy="0" r="100" />
- </g>
- </g>
- <g transform="translate(255,525)">
- <g transform="scale(0.3,0.3)">
- <use xlink:href="#shadow" transform="translate(25,55) scale(1.0,0.5)" />
- <circle fill="url(#yellowSphere)" cx="0" cy="0" r="100" />
- </g>
- </g>
- </g>
-</svg>
+++ /dev/null
-<?xml version="1.0" standalone="no"?>
-<svg width="10cm" height="10cm" viewBox="0 0 1000 1000"
- xmlns="http://www.w3.org/2000/svg" version="1.2" baseProfile="tiny">
- <title>Example cubic02 - cubic Bezier commands in path data</title>
- <desc>Picture showing examples of "C" and "S" commands,
- along with annotations showing the control points
- and end points</desc>
-
- <rect fill="none" stroke="blue" stroke-width="1" x="1" y="1" width="998" height="998" />
-
- <!-- Path 1 -->
- <polyline fill="none" stroke="#888888" stroke-width="2" points="100,200 100,100" />
- <polyline fill="none" stroke="#888888" stroke-width="2" points="400,100 400,200" />
- <path fill="none" stroke="red" stroke-width="5" d="M100,200 C100,100 400,100 400,200" />
- <circle fill="none" stroke="#888888" stroke-width="2" cx="100" cy="200" r="10" />
- <circle fill="none" stroke="#888888" stroke-width="2" cx="400" cy="200" r="10" />
- <circle class="CtlPoint" cx="100" cy="100" r="10" />
- <circle class="CtlPoint" cx="400" cy="100" r="10" />
- <text text-anchor="middle" font-size="22" font-family="Verdana" x="250" y="275">M100,200 C100,100 400,100 400,200</text>
-
- <!-- Path 2 -->
- <polyline fill="none" stroke="#888888" stroke-width="2" points="100,500 25,400" />
- <polyline fill="none" stroke="#888888" stroke-width="2" points="475,400 400,500" />
- <path fill="none" stroke="red" stroke-width="5" d="M100,500 C25,400 475,400 400,500" />
- <circle fill="none" stroke="#888888" stroke-width="2" cx="100" cy="500" r="10" />
- <circle fill="none" stroke="#888888" stroke-width="2" cx="400" cy="500" r="10" />
- <circle fill="#888888" stroke="none" cx="25" cy="400" r="10" />
- <circle fill="#888888" stroke="none" cx="475" cy="400" r="10" />
- <text text-anchor="middle" font-size="22" font-family="Verdana" x="250" y="575">M100,500 C25,400 475,400 400,500</text>
-
- <!-- Path 3 -->
- <polyline fill="none" stroke="#888888" stroke-width="2" points="100,800 175,700" />
- <polyline fill="none" stroke="#888888" stroke-width="2" points="325,700 400,800" />
- <path fill="none" stroke="red" stroke-width="5" d="M100,800 C175,700 325,700 400,800" />
- <circle fill="none" stroke="#888888" stroke-width="2" cx="100" cy="800" r="10" />
- <circle fill="none" stroke="#888888" stroke-width="2" cx="400" cy="800" r="10" />
- <circle fill="#888888" stroke="none" cx="175" cy="700" r="10" />
- <circle fill="#888888" stroke="none" cx="325" cy="700" r="10" />
- <text text-anchor="middle" font-size="22" font-family="Verdana" x="250" y="875">M100,800 C175,700 325,700 400,800</text>
-
- <!-- Path 4 -->
- <polyline fill="none" stroke="#888888" stroke-width="2" points="600,200 675,100" />
- <polyline fill="none" stroke="#888888" stroke-width="2" points="975,100 900,200" />
- <path fill="none" stroke="red" stroke-width="5" d="M600,200 C675,100 975,100 900,200" />
- <circle fill="none" stroke="#888888" stroke-width="2" cx="600" cy="200" r="10" />
- <circle fill="none" stroke="#888888" stroke-width="2" cx="900" cy="200" r="10" />
- <circle fill="#888888" stroke="none" cx="675" cy="100" r="10" />
- <circle fill="#888888" stroke="none" cx="975" cy="100" r="10" />
- <text text-anchor="middle" font-size="22" font-family="Verdana" x="750" y="275">M600,200 C675,100 975,100 900,200</text>
-
- <!-- Path 5 -->
- <polyline fill="none" stroke="#888888" stroke-width="2" points="600,500 600,350" />
- <polyline fill="none" stroke="#888888" stroke-width="2" points="900,650 900,500" />
- <path fill="none" stroke="red" stroke-width="5" d="M600,500 C600,350 900,650 900,500" />
- <circle fill="none" stroke="#888888" stroke-width="2" cx="600" cy="500" r="10" />
- <circle fill="none" stroke="#888888" stroke-width="2" cx="900" cy="500" r="10" />
- <circle fill="#888888" stroke="none" cx="600" cy="350" r="10" />
- <circle fill="#888888" stroke="none" cx="900" cy="650" r="10" />
- <text text-anchor="middle" font-size="22" font-family="Verdana" x="750" y="575">M600,500 C600,350 900,650 900,500</text>
-
- <!-- Path 6 (C and S command) -->
- <polyline fill="none" stroke="#888888" stroke-width="2" points="600,800 625,700" />
- <polyline fill="none" stroke="#888888" stroke-width="2" points="725,700 750,800" />
- <polyline fill="none" stroke="#888888" stroke-width="2" points="750,800 775,900" />
- <polyline fill="none" stroke="#888888" stroke-width="2" points="875,900 900,800" />
- <path fill="none" stroke="red" stroke-width="5" d="M600,800 C625,700 725,700 750,800
- S875,900 900,800" />
- <circle fill="none" stroke="#888888" stroke-width="2" cx="600" cy="800" r="10" />
- <circle fill="none" stroke="#888888" stroke-width="2" cx="750" cy="800" r="10" />
- <circle fill="none" stroke="#888888" stroke-width="2" cx="900" cy="800" r="10" />
- <circle fill="#888888" stroke="none" cx="625" cy="700" r="10" />
- <circle fill="#888888" stroke="none" cx="725" cy="700" r="10" />
- <circle fill="#888888" stroke="none" cx="875" cy="900" r="10" />
- <circle fill="none" stroke="blue" stroke-width="4" cx="775" cy="900" r="9" />
- <text text-anchor="middle" font-size="22" font-family="Verdana" x="750" y="945">M600,800 C625,700 725,700 750,800</text>
- <text text-anchor="middle" font-size="22" font-family="Verdana" x="750" y="975">S875,900 900,800</text>
-</svg>
+++ /dev/null
-<?xml version="1.0" standalone="no"?>
-<svg width="8cm" height="8cm" viewBox="0 0 400 400"
- xmlns="http://www.w3.org/2000/svg"
- xmlns:xlink="http://www.w3.org/1999/xlink/"
- baseProfile="tiny" version="1.2">
- <title>Spheres</title>
- <desc>Gradient filled spheres with different colors.</desc>
- <defs>
- <!-- Create radial gradients for each circle to make them look like
- spheres. -->
- <radialGradient id="blueSphere" gradientUnits="userSpaceOnUse"
- cx="0" cy="0" r="100" fx="-50" fy="-50">
- <stop offset="0%" stop-color="white" />
- <stop offset="75%" stop-color="blue" />
- <stop offset="100%" stop-color="#222244" />
- </radialGradient>
- <radialGradient id="redSphere" gradientUnits="userSpaceOnUse"
- cx="0" cy="0" r="100" fx="-50" fy="-50">
- <stop offset="0%" stop-color="white" />
- <stop offset="75%" stop-color="red" />
- <stop offset="100%" stop-color="#442222" />
- </radialGradient>
- <radialGradient id="greenSphere" gradientUnits="userSpaceOnUse"
- cx="0" cy="0" r="100" fx="-50" fy="-50">
- <stop offset="0%" stop-color="white" />
- <stop offset="75%" stop-color="green" />
- <stop offset="100%" stop-color="#113311" />
- </radialGradient>
- <radialGradient id="yellowSphere" gradientUnits="userSpaceOnUse"
- cx="0" cy="0" r="100" fx="-50" fy="-50">
- <stop offset="0%" stop-color="white" />
- <stop offset="75%" stop-color="yellow" />
- <stop offset="100%" stop-color="#444422" />
- </radialGradient>
- <radialGradient id="shadowGrad" gradientUnits="userSpaceOnUse"
- cx="0" cy="0" r="100" fx="-50" fy="50">
- <stop offset="0%" stop-color="black" stop-opacity="1.0" />
- <stop offset="100%" stop-color="white" stop-opacity="0.0" />
- </radialGradient>
-
- <!-- Define a shadow for each sphere. -->
- <circle id="shadow" fill="url(#shadowGrad)" cx="0" cy="0" r="100" />
- </defs>
- <g fill="#ffee99" stroke="none" >
- <rect x="0" y="0" width="400" height="400" />
- </g>
- <g fill="white" stroke="none" >
- <rect x="0" y="175" width="400" height="225" />
- </g>
- <g transform="translate(200,175)">
- <use xlink:href="#shadow" transform="translate(25,55) scale(1.0,0.5)" />
- <circle fill="url(#blueSphere)" cx="0" cy="0" r="100" />
- </g>
- <g transform="translate(315,240)">
- <g transform="scale(0.5,0.5)">
- <use xlink:href="#shadow" transform="translate(25,55) scale(1.0,0.5)" />
- <circle fill="url(#redSphere)" cx="0" cy="0" r="100" />
- </g>
- </g>
- <g transform="translate(80,275)">
- <g transform="scale(0.65,0.65)">
- <use xlink:href="#shadow" transform="translate(25,55) scale(1.0,0.5)" />
- <circle fill="url(#greenSphere)" cx="0" cy="0" r="100" />
- </g>
- </g>
- <g transform="translate(255,325)">
- <g transform="scale(0.3,0.3)">
- <use xlink:href="#shadow" transform="translate(25,55) scale(1.0,0.5)" />
- <circle fill="url(#yellowSphere)" cx="0" cy="0" r="100" />
- </g>
- </g>
-</svg>
+++ /dev/null
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QApplication>
-#include <QString>
-#ifndef QT_NO_OPENGL
-#include <QGLFormat>
-#endif
-
-#include "mainwindow.h"
-
-int main(int argc, char **argv)
-{
- Q_INIT_RESOURCE(svgviewer);
-
- QApplication app(argc, argv);
-
- MainWindow window;
- if (argc == 2)
- window.openFile(argv[1]);
- else
- window.openFile(":/files/bubbles.svg");
-#if defined(Q_OS_SYMBIAN)
- window.showMaximized();
-#else
- window.show();
-#endif
- return app.exec();
-}
+++ /dev/null
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "mainwindow.h"
-
-#include <QtGui>
-#include <unistd.h>
-#include <QFileSystemWatcher>
-
-#include "svgview.h"
-
-MainWindow::MainWindow()
- : QMainWindow()
- , m_view(new SvgView)
- , m_watcher(NULL)
- , m_filehandle(NULL)
-{
- QMenu *fileMenu = new QMenu(tr("&File"), this);
- QAction *openAction = fileMenu->addAction(tr("&Open..."));
- openAction->setShortcut(QKeySequence(tr("Ctrl+O")));
- QAction *quitAction = fileMenu->addAction(tr("E&xit"));
- quitAction->setShortcuts(QKeySequence::Quit);
-
- menuBar()->addMenu(fileMenu);
-
- QMenu *viewMenu = new QMenu(tr("&View"), this);
-
- m_interactiveAction = viewMenu->addAction(tr("&Interactive"));
- m_interactiveAction->setEnabled(false);
- m_interactiveAction->setCheckable(true);
- m_interactiveAction->setChecked(false);
- connect(m_interactiveAction, SIGNAL(toggled(bool)), m_view, SLOT(setViewInteractive(bool)));
-
- m_backgroundAction = viewMenu->addAction(tr("&Background"));
- m_backgroundAction->setEnabled(false);
- m_backgroundAction->setCheckable(true);
- m_backgroundAction->setChecked(false);
- m_backgroundAction->setVisible(false);
- connect(m_backgroundAction, SIGNAL(toggled(bool)), m_view, SLOT(setViewBackground(bool)));
-
- m_outlineAction = viewMenu->addAction(tr("&Outline"));
- m_outlineAction->setEnabled(false);
- m_outlineAction->setCheckable(true);
- m_outlineAction->setChecked(true);
- connect(m_outlineAction, SIGNAL(toggled(bool)), m_view, SLOT(setViewOutline(bool)));
-
- menuBar()->addMenu(viewMenu);
-
- QMenu *rendererMenu = new QMenu(tr("&Renderer"), this);
- m_nativeAction = rendererMenu->addAction(tr("&Native"));
- m_nativeAction->setCheckable(true);
- m_nativeAction->setChecked(true);
-#ifndef QT_NO_OPENGL
- m_glAction = rendererMenu->addAction(tr("&OpenGL"));
- m_glAction->setCheckable(true);
-#endif
- m_imageAction = rendererMenu->addAction(tr("&Image"));
- m_imageAction->setCheckable(true);
-
-#ifndef QT_NO_OPENGL
- rendererMenu->addSeparator();
- m_highQualityAntialiasingAction = rendererMenu->addAction(tr("&High Quality Antialiasing"));
- m_highQualityAntialiasingAction->setEnabled(false);
- m_highQualityAntialiasingAction->setCheckable(true);
- m_highQualityAntialiasingAction->setChecked(false);
- connect(m_highQualityAntialiasingAction, SIGNAL(toggled(bool)), m_view, SLOT(setHighQualityAntialiasing(bool)));
-#endif
-
- QActionGroup *rendererGroup = new QActionGroup(this);
- rendererGroup->addAction(m_nativeAction);
-#ifndef QT_NO_OPENGL
- rendererGroup->addAction(m_glAction);
-#endif
- rendererGroup->addAction(m_imageAction);
-
- menuBar()->addMenu(rendererMenu);
-
- connect(openAction, SIGNAL(triggered()), this, SLOT(openFile()));
- connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit()));
- connect(rendererGroup, SIGNAL(triggered(QAction*)),
- this, SLOT(setRenderer(QAction*)));
-
- setCentralWidget(m_view);
- setWindowTitle(tr("Yosys SVG Viewer"));
-}
-
-void MainWindow::openFile(const QString &path, bool reload)
-{
- QString fileName;
- if (path.isNull())
- fileName = QFileDialog::getOpenFileName(this, tr("Open SVG File"),
- m_currentPath, "SVG files (*.svg *.svgz *.svg.gz)");
- else
- fileName = path;
-
- if (m_watcher) {
- delete m_watcher;
- m_watcher = NULL;
- }
- if (m_filehandle) {
- fclose(m_filehandle);
- m_filehandle = NULL;
- }
-
- if (!fileName.isEmpty()) {
- QFile file(fileName);
- if (!file.exists()) {
- QMessageBox::critical(this, tr("Open SVG File"),
- QString("Could not open file '%1'.").arg(fileName));
-
- m_interactiveAction->setEnabled(false);
- m_outlineAction->setEnabled(false);
- m_backgroundAction->setEnabled(false);
- return;
- }
-
- QTransform oldTransform = m_view->transform();
- m_view->openFile(file);
-
- if (!fileName.startsWith(":/"))
- {
- m_currentPath = fileName;
- setWindowTitle(tr("%1 - Yosys SVG Viewer").arg(m_currentPath));
-
- // just keep the file open so this process is found using 'fuser'
- m_filehandle = fopen(fileName.toAscii(), "r");
-
- m_watcher = new QFileSystemWatcher(this);
- m_watcher->addPath(fileName);
- connect(m_watcher, SIGNAL(fileChanged(const QString&)), this, SLOT(reloadFile()));
- }
-
- m_interactiveAction->setEnabled(true);
- m_outlineAction->setEnabled(true);
- m_backgroundAction->setEnabled(true);
-
- if (reload)
- m_view->setTransform(oldTransform);
- else
- resize(m_view->sizeHint() + QSize(80, 80 + menuBar()->height()));
- }
-}
-
-void MainWindow::reloadFile()
-{
- // give the writer ~100 ms to finish writing
- usleep(100000);
- openFile(m_currentPath, true);
-}
-
-void MainWindow::setRenderer(QAction *action)
-{
-#ifndef QT_NO_OPENGL
- m_highQualityAntialiasingAction->setEnabled(false);
-#endif
-
- if (action == m_nativeAction)
- m_view->setRenderer(SvgView::Native);
-#ifndef QT_NO_OPENGL
- else if (action == m_glAction) {
- m_highQualityAntialiasingAction->setEnabled(true);
- m_view->setRenderer(SvgView::OpenGL);
- }
-#endif
- else if (action == m_imageAction) {
- m_view->setRenderer(SvgView::Image);
- }
-}
+++ /dev/null
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef MAINWINDOW_H
-#define MAINWINDOW_H
-
-#include <QMainWindow>
-#include <QString>
-#include <stdio.h>
-
-class SvgView;
-
-QT_BEGIN_NAMESPACE
-class QAction;
-class QGraphicsView;
-class QGraphicsScene;
-class QGraphicsRectItem;
-class QFileSystemWatcher;
-QT_END_NAMESPACE
-
-class MainWindow : public QMainWindow
-{
- Q_OBJECT
-
-public:
- MainWindow();
-
-public slots:
- void openFile(const QString &path = QString(), bool reload = false);
- void setRenderer(QAction *action);
- void reloadFile();
-
-private:
- QAction *m_nativeAction;
- QAction *m_glAction;
- QAction *m_imageAction;
- QAction *m_highQualityAntialiasingAction;
- QAction *m_interactiveAction;
- QAction *m_backgroundAction;
- QAction *m_outlineAction;
-
- SvgView *m_view;
-
- QString m_currentPath;
- QFileSystemWatcher *m_watcher;
- FILE *m_filehandle;
-};
-
-#endif
+++ /dev/null
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#include "svgview.h"
-
-#include <QFile>
-#include <QWheelEvent>
-#include <QMouseEvent>
-#include <QGraphicsRectItem>
-#include <QGraphicsSvgItem>
-#include <QGraphicsWebView>
-#include <QPaintEvent>
-#include <qmath.h>
-#include <unistd.h>
-
-#ifndef QT_NO_OPENGL
-#include <QGLWidget>
-#endif
-
-SvgView::SvgView(QWidget *parent)
- : QGraphicsView(parent)
- , m_renderer(Native)
- , m_svgItem(0)
- , m_webview(0)
- , m_backgroundItem(0)
- , m_outlineItem(0)
-{
- setScene(new QGraphicsScene(this));
- setTransformationAnchor(AnchorUnderMouse);
- setDragMode(ScrollHandDrag);
- setViewportUpdateMode(FullViewportUpdate);
-
- // Prepare background check-board pattern
- QPixmap tilePixmap(64, 64);
- tilePixmap.fill(Qt::white);
- QPainter tilePainter(&tilePixmap);
- QColor color(220, 220, 220);
- tilePainter.fillRect(0, 0, 32, 32, color);
- tilePainter.fillRect(32, 32, 32, 32, color);
- tilePainter.end();
-
- setBackgroundBrush(tilePixmap);
-}
-
-void SvgView::drawBackground(QPainter *p, const QRectF &)
-{
- p->save();
- p->resetTransform();
- p->drawTiledPixmap(viewport()->rect(), backgroundBrush().texture());
- p->restore();
-}
-
-void SvgView::openFile(const QFile &file)
-{
- if (!file.exists())
- return;
-
- QGraphicsScene *s = scene();
-
- fn = file.fileName();
- if (fn[0] != '/') {
- char cwd_buffer[4096];
- if (getcwd(cwd_buffer, 4096) != NULL)
- fn = cwd_buffer + ("/" + fn);
- }
-
- bool drawBackground = (m_backgroundItem ? m_backgroundItem->isVisible() : false);
- bool drawOutline = (m_outlineItem ? m_outlineItem->isVisible() : true);
- bool useWebview = (m_webview ? m_webview->isVisible() : false);
-
- s->clear();
- resetTransform();
-
- m_svgItem = new QGraphicsSvgItem(file.fileName());
- m_svgItem->setFlags(QGraphicsItem::ItemClipsToShape);
- m_svgItem->setCacheMode(QGraphicsItem::NoCache);
- m_svgItem->setVisible(!useWebview);
- m_svgItem->setZValue(1);
- s->addItem(m_svgItem);
-
- if (useWebview) {
- m_webview = new QGraphicsWebView();
- m_webview->load(QUrl::fromLocalFile(fn));
- m_webview->setResizesToContents(true);
- m_webview->setZoomFactor(0.75);
- m_webview->setVisible(useWebview);
- m_webview->setZValue(1);
- s->addItem(m_webview);
- } else
- m_webview = NULL;
-
- m_backgroundItem = new QGraphicsRectItem(m_svgItem->boundingRect());
- m_backgroundItem->setBrush(Qt::white);
- m_backgroundItem->setPen(Qt::NoPen);
- m_backgroundItem->setVisible(drawBackground);
- m_backgroundItem->setZValue(0);
- s->addItem(m_backgroundItem);
-
- m_outlineItem = new QGraphicsRectItem(m_svgItem->boundingRect());
- QPen outline(Qt::black, 2, Qt::DashLine);
- outline.setCosmetic(true);
- m_outlineItem->setPen(outline);
- m_outlineItem->setBrush(Qt::NoBrush);
- m_outlineItem->setVisible(drawOutline);
- m_outlineItem->setZValue(2);
- s->addItem(m_outlineItem);
-
- s->setSceneRect(m_outlineItem->boundingRect().adjusted(-10, -10, 10, 10));
-}
-
-void SvgView::setRenderer(RendererType type)
-{
- m_renderer = type;
-
- if (m_renderer == OpenGL) {
-#ifndef QT_NO_OPENGL
- setViewport(new QGLWidget(QGLFormat(QGL::SampleBuffers)));
-#endif
- } else {
- setViewport(new QWidget);
- }
-}
-
-void SvgView::setHighQualityAntialiasing(bool highQualityAntialiasing)
-{
-#ifndef QT_NO_OPENGL
- setRenderHint(QPainter::HighQualityAntialiasing, highQualityAntialiasing);
-#else
- Q_UNUSED(highQualityAntialiasing);
-#endif
-}
-
-void SvgView::setViewInteractive(bool enable)
-{
- if (!m_svgItem)
- return;
- if (!m_webview) {
- m_webview = new QGraphicsWebView();
- m_webview->load(QUrl::fromLocalFile(fn));
- m_webview->setResizesToContents(true);
- m_webview->setZoomFactor(0.75);
- m_webview->setVisible(false);
- m_webview->setZValue(1);
- m_svgItem->scene()->addItem(m_webview);
- }
- m_svgItem->setVisible(!enable);
- m_webview->setVisible(enable);
-}
-
-void SvgView::setViewBackground(bool enable)
-{
- if (!m_backgroundItem)
- return;
-
- m_backgroundItem->setVisible(enable);
-}
-
-void SvgView::setViewOutline(bool enable)
-{
- if (!m_outlineItem)
- return;
-
- m_outlineItem->setVisible(enable);
-}
-
-void SvgView::paintEvent(QPaintEvent *event)
-{
- if (m_renderer == Image) {
- if (m_image.size() != viewport()->size()) {
- m_image = QImage(viewport()->size(), QImage::Format_ARGB32_Premultiplied);
- }
-
- QPainter imagePainter(&m_image);
- QGraphicsView::render(&imagePainter);
- imagePainter.end();
-
- QPainter p(viewport());
- p.drawImage(0, 0, m_image);
-
- } else {
- QGraphicsView::paintEvent(event);
- }
-}
-
-void SvgView::wheelEvent(QWheelEvent *event)
-{
- qreal factor = qPow(1.2, event->delta() / 240.0);
- scale(factor, factor);
- event->accept();
-}
-
+++ /dev/null
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef SVGVIEW_H
-#define SVGVIEW_H
-
-#include <QGraphicsView>
-#include <QGraphicsWebView>
-
-QT_BEGIN_NAMESPACE
-class QWheelEvent;
-class QPaintEvent;
-class QFile;
-QT_END_NAMESPACE
-
-class SvgView : public QGraphicsView
-{
- Q_OBJECT
-
-public:
- enum RendererType { Native, OpenGL, Image };
-
- SvgView(QWidget *parent = 0);
-
- void openFile(const QFile &file);
- void setRenderer(RendererType type = Native);
- void drawBackground(QPainter *p, const QRectF &rect);
-
-public slots:
- void setHighQualityAntialiasing(bool highQualityAntialiasing);
- void setViewInteractive(bool enable);
- void setViewBackground(bool enable);
- void setViewOutline(bool enable);
-
-protected:
- void wheelEvent(QWheelEvent *event);
- void paintEvent(QPaintEvent *event);
-
-private:
- RendererType m_renderer;
-
- QString fn;
- QGraphicsItem *m_svgItem;
- QGraphicsWebView *m_webview;
- QGraphicsRectItem *m_backgroundItem;
- QGraphicsRectItem *m_outlineItem;
-
- QImage m_image;
-};
-#endif // SVGVIEW_H
+++ /dev/null
-[Desktop Entry]
-Encoding=UTF-8
-Version=1.0
-Type=Application
-Terminal=false
-Name=SVG Viewer
-Exec=/opt/usr/bin/svgviewer
-Icon=svgviewer
-X-Window-Icon=
-X-HildonDesk-ShowInToolbar=true
-X-Osso-Type=application/x-executable
+++ /dev/null
-HEADERS = mainwindow.h \
- svgview.h
-RESOURCES = svgviewer.qrc
-SOURCES = main.cpp \
- mainwindow.cpp \
- svgview.cpp
-QT += webkit svg xml
-
-contains(QT_CONFIG, opengl): QT += opengl
-
-CONFIG += console
-
-# install
-target.path = $$[QT_INSTALL_EXAMPLES]/painting/svgviewer
-sources.files = $$SOURCES $$HEADERS $$RESOURCES svgviewer.pro files
-sources.path = $$[QT_INSTALL_EXAMPLES]/painting/svgviewer
-INSTALLS += target sources
-
-wince*: {
- addFiles.files = files\\*.svg
- addFiles.path = "\\My Documents"
- DEPLOYMENT += addFiles
-}
-
-symbian: {
- TARGET.UID3 = 0xA000A64E
- include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri)
- addFiles.files = files\\*.svg
- addFiles.path = .
- DEPLOYMENT += addFiles
-}
-maemo5: include($$QT_SOURCE_TREE/examples/maemo5pkgrules.pri)
-
+++ /dev/null
-<!DOCTYPE RCC><RCC version="1.0">
-<qresource prefix="/">
- <file>files/bubbles.svg</file>
-</qresource>
-</RCC>
-