diff options
| author | Liam P. White <inkscapebrony@gmail.com> | 2014-07-27 01:17:50 +0000 |
|---|---|---|
| committer | Liam P. White <inkscapebrony@gmail.com> | 2014-07-27 01:17:50 +0000 |
| commit | 0ac6f5cccf5aaa8bb8d97fdf96d040646b7056c1 (patch) | |
| tree | f3f00d4c95db349232b1e201fd2e45118d511f6e | |
| parent | Fix for 1309050 (diff) | |
| parent | Properly fix 1309050, revert incorrect fix for 601336 (diff) | |
| download | inkscape-0ac6f5cccf5aaa8bb8d97fdf96d040646b7056c1.tar.gz inkscape-0ac6f5cccf5aaa8bb8d97fdf96d040646b7056c1.zip | |
Merge from trunk 13472
(bzr r13341.1.102)
46 files changed, 262 insertions, 169 deletions
diff --git a/.bzrignore b/.bzrignore index 925be4fb7..107ffc16a 100644 --- a/.bzrignore +++ b/.bzrignore @@ -160,6 +160,7 @@ src/algorithms/makefile src/application/makefile src/bind/makefile src/check-header-compile +src/cxxtests.cpp src/debug/makefile src/dialogs/makefile src/display/makefile diff --git a/autogen.sh b/autogen.sh index fcac2d4de..0a9cb7924 100755 --- a/autogen.sh +++ b/autogen.sh @@ -15,18 +15,24 @@ test -n "$srcdir" || srcdir=. olddir=`pwd` cd $srcdir -AUTORECONF=`which autoreconf` -if test -z $AUTORECONF; then +WHICH_AUTORECONF=`which autoreconf` +if test -z $WHICH_AUTORECONF; then echo "*** No autoreconf found, please install it ***" exit 1 fi -INTLTOOLIZE=`which intltoolize` -if test -z $INTLTOOLIZE; then +WHICH_INTLTOOLIZE=`which intltoolize` +if test -z $WHICH_INTLTOOLIZE; then echo "*** No intltoolize found, please install the intltool package ***" exit 1 fi +WHICH_AUTOPOINT=`which autopoint` +if test -z $WHICH_AUTOPOINT; then + echo "*** No autopoint found, please install the autopoint package ***" + exit 1 +fi + autopoint --force AUTOPOINT='intltoolize --automake --copy' autoreconf --force --install --verbose @@ -453,7 +453,7 @@ stripcommand="${archutil}strip" objcopycommand="${archutil}objcopy"> <flags> - -mconsole + -mwindows -mthreads </flags> <fileset dir="${build}/obj"> diff --git a/packaging/wix/files.py b/packaging/wix/files.py index 93a7c8dd1..ada4d62f2 100644 --- a/packaging/wix/files.py +++ b/packaging/wix/files.py @@ -27,7 +27,7 @@ def directory(root, breadcrumb, level, exclude=[]): file_key = os.path.join(root, file) _id = '_%06d' % (len(file_ids.keys()) + 1) file_ids[file_key] = 'component' + _id - wxs.write(indent(level)+ "<Component Id='component" + _id + "' Guid='" + str(uuid.uuid4()) + "' DiskId='1'>\n") + wxs.write(indent(level)+ "<Component Id='component" + _id + "' Guid='" + str(uuid.uuid4()) + "' DiskId='1' Win64='$(var.Win64)'>\n") if file == 'inkscape.exe': # we refenrence inkscape.exe in inkscape.wxs _id = '_inkscape_exe' @@ -62,10 +62,11 @@ def ComponentGroup(name, condition, level): with open('files.wxs', 'w') as wxs: wxs.write("<!-- do not edit, this file is created by files.py tool any changes will be lost -->\n") wxs.write("<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>\n") + wxs.write(indent(1) + "<?include version.wxi?>\n") wxs.write(indent(1) + "<Fragment>\n") wxs.write(indent(2) + "<!-- Step 1: Define the directory structure -->\n") wxs.write(indent(2) + "<Directory Id='TARGETDIR' Name='SourceDir'>\n") - wxs.write(indent(3) + "<Directory Id='ProgramFilesFolder' Name='PFiles'>\n") + wxs.write(indent(3) + "<Directory Id='$(var.ProgramFilesFolder)' Name='PFiles'>\n") wxs.write(indent(4) + "<Directory Id='INSTALLDIR' Name='Inkscape'>\n") print "start parsing ..\..\inkscape" directory('..\..\inkscape', 'inkscape', 5, ['inkscape.dbg', 'inkview.dbg', 'gdb.exe']) @@ -74,7 +75,7 @@ with open('files.wxs', 'w') as wxs: wxs.write(indent(3) + "</Directory>\n") # link to ProgrmMenu wxs.write(indent(3) + "<Directory Id='ProgramMenuFolder'>\n") - wxs.write(indent(4) + "<Directory Id='ApplicationProgramsFolder' Name='Inkscape 0.48'/>\n") + wxs.write(indent(4) + "<Directory Id='ApplicationProgramsFolder' Name='$(var.FullProductName)'/>\n") wxs.write(indent(3) + "</Directory>\n") wxs.write(indent(3) + "<Directory Id='DesktopFolder' Name='Desktop' />\n") wxs.write(indent(2) + "</Directory>\n") diff --git a/packaging/wix/inkscape.wxs b/packaging/wix/inkscape.wxs index dfe61defd..3b4152a5f 100644 --- a/packaging/wix/inkscape.wxs +++ b/packaging/wix/inkscape.wxs @@ -1,10 +1,10 @@ <?xml version='1.0' encoding='windows-1252'?>
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi' xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<?include version.wxi?>
-
- <Product Name="$(var.FullProductName)" Id='81922150-317e-4bb0-a31d-ff1c14f707c5' UpgradeCode='4d5fedaa-84a0-48be-bd2a-08246398361a' Language='1033' Codepage='1252' Version='0.48' Manufacturer='inkscape.org'>
- <Package Id='*' Keywords='Installer' Description="Inkscape Installer" Comments='inkscape is registered trademark of inkscape.org' Manufacturer='inkscape.org' InstallerVersion='100' Languages='1033' Compressed='yes' SummaryCodepage='1252' />
+ <Product Name="$(var.FullProductName)" Id='81922150-317e-4bb0-a31d-ff1c14f707c5' UpgradeCode='4d5fedaa-84a0-48be-bd2a-08246398361a' Language='1033' Codepage='1252' Version='$(var.ProductVersion)' Manufacturer='inkscape.org'>
+
+ <Package Id='*' Keywords='Installer' Description="Inkscape Installer" Comments='inkscape is registered trademark of inkscape.org' Manufacturer='inkscape.org' InstallerVersion='$(var.InstallerVersion)' Platform='$(var.Platform)' Languages='1033' Compressed='yes' SummaryCodepage='1252' />
<Media Id='1' Cabinet='Sample.cab' EmbedCab='yes' DiskPrompt="CD-ROM #1" />
<Property Id='DiskPrompt' Value="inkscape Installation [1]" />
@@ -12,7 +12,7 @@ <Property Id='ALLUSERS' Value="2" />
<DirectoryRef Id="ApplicationProgramsFolder">
- <Component Id="ApplicationShortcut" Guid="37de8ea4-e83a-4e40-8f9c-c6066b78d935">
+ <Component Id="ApplicationShortcut" Guid="37de8ea4-e83a-4e40-8f9c-c6066b78d935" Win64='$(var.Win64)' >
<Shortcut Id="ApplicationStartMenuShortcut"
Name="$(var.FullProductName)"
Description="Inkscape Vector Graphics Application"
@@ -27,16 +27,16 @@ </DirectoryRef>
<DirectoryRef Id="DesktopFolder">
- <Component Id="DesktopShortcut" Guid="3afc08a7-05a1-40cf-90c2-0d6c042bfc41">
- <!-- Shortcut Id="desktopFoobar10" Directory="DesktopFolder" Target="[INSTALLDIR]inkscape.exe" Name="Inkscape 0.48" WorkingDirectory='INSTALLDIR' Icon="file_inkscape_exe" IconIndex="0" / -->
+ <Component Id="DesktopShortcut" Guid="3afc08a7-05a1-40cf-90c2-0d6c042bfc41" Win64='$(var.Win64)'>
+ <!-- Shortcut Id="desktopFoobar10" Directory="DesktopFolder" Target="[INSTALLDIR]inkscape.exe" Name="$(var.FullProductName)" WorkingDirectory='INSTALLDIR' Icon="file_inkscape_exe" IconIndex="0" / -->
<Shortcut Id="desktopFoobar10" Directory="DesktopFolder" Target="[INSTALLDIR]inkscape.exe" Name="$(var.FullProductName)" WorkingDirectory='INSTALLDIR' />
<RemoveFolder Id="DesktopFolder" On="uninstall"/>
<RegistryValue Root="HKCU" Key="Software\Microsoft\MyApplicationName" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
</Component>
</DirectoryRef>
-
+
<DirectoryRef Id="INSTALLDIR">
- <Component Id="RegisterExtension" Guid="d544e040-573e-4ea8-983e-4bcae6b87f3d">
+ <Component Id="RegisterExtension" Guid="d544e040-573e-4ea8-983e-4bcae6b87f3d" Win64='$(var.Win64)'>
<ProgId Id="inkscape.svg" Description='scalable vector graphics file' Icon='file_inkscape_exe'>
<Extension Id='svg' ContentType='application/svg'>
<Verb Id='edit' Command='Edit with Inkscape' TargetFile='file_inkscape_exe' Argument='"%1"' />
@@ -44,15 +44,15 @@ <Extension Id='svgz' ContentType='application/svgz'>
<Verb Id='open' Command='Open with Inkscape' TargetFile='file_inkscape_exe' Argument='"%1"' />
</Extension>
-
+
</ProgId>
</Component>
</DirectoryRef>
-
+
<Feature Id='Complete' Title="$(var.FullProductName)" Description='The complete Package' Display='expand' Level='1' ConfigurableDirectory='INSTALLDIR' Absent="disallow" AllowAdvertise='no'>
-<!--
+ <!--
<Feature Id='MainProgram' Level='1' Title='inkscape Application' Description='the inkscape Application' Absent="disallow" AllowAdvertise='no'>
<ComponentRef Id='MainExecutable' />
</Feature>
@@ -60,20 +60,20 @@ <!--
<Feature Id='MainProgram' Level='1' Title='inkscape Application' Description='the inkscape Application' Absent="disallow" AllowAdvertise='no'>
-->
- <ComponentGroupRef Id='AllOther' />
+ <ComponentGroupRef Id='AllOther' />
<!--
</Feature>
-->
-
+
<!-- shortcuts -->
<Feature Id='ApplicationShortcut' Level='1' Title='Start Menu entry' Description='an entry in the start Menu' AllowAdvertise='no'>
<ComponentRef Id='ApplicationShortcut' />
</Feature>
-
+
<Feature Id='DesktopShortcut' Level='1' Title='Desktop link' Description='an link on the desktop' AllowAdvertise='no'>
<ComponentRef Id='DesktopShortcut' />
</Feature>
-
+
<Feature Id='RegisterExtension' Level='1' Title='register file extension' Description='register .svg and .svgz file extension to explorer context menu' AllowAdvertise='no'>
<ComponentRef Id='RegisterExtension' />
</Feature>
@@ -89,7 +89,7 @@ <Feature Id='Tutorials' Level='1' Title='Tutorials' Description='tutorials as svg' AllowAdvertise='no'>
<ComponentGroupRef Id='Tutorials' />
</Feature>
-<!--
+ <!--
<ComponentRef Id='ProgramMenuDir' />
-->
</Feature>
diff --git a/packaging/wix/version.py b/packaging/wix/version.py index 46968c90c..dc5e06de9 100644 --- a/packaging/wix/version.py +++ b/packaging/wix/version.py @@ -1,20 +1,59 @@ #!/usr/bin/python
import os
+import struct
version = ''
+versionstr = ''
+architecture = ''
+
+def is64bitArchitecture(filename):
+ ''' test if a executable is of x64 format @see http://stackoverflow.com/questions/1001404/check-if-unmanaged-dll-is-32-bit-or-64-bit/1002672#1002672
+ @see http://www.microsoft.com/whdc/system/platform/firmware/PECOFF.mspx
+ //offset to PE header is always at 0x3C
+ //PE header starts with "PE\0\0" = 0x50 0x45 0x00 0x00
+ //followed by 2-byte machine type field (see document above for enum)
+ '''
+ with open(filename, 'rb') as cofffile:
+ cofffile.seek(0x3c)
+ peOffset = struct.unpack('H', cofffile.read(2))[0]
+ cofffile.seek(peOffset)
+ peHead = struct.unpack('I', cofffile.read(4))[0]
+ if peHead != 0x00004550: # "PE\0\0", little-endian
+ # throw new Exception("Can't find PE header")
+ pass
+ machineType = struct.unpack('H', cofffile.read(2))[0]
+ if machineType in (0x8664, 0x200):
+ return True
+ return False
+
+if is64bitArchitecture('..\..\inkscape\inkscape.exe'):
+ architecture = '-x64'
+else:
+ architecture = ''
# retrieve the version information from the inkscape.rc file
# VALUE "ProductVersion", "0.48+devel"
with open('..\..\src\inkscape.rc', 'r') as rc:
+ isversioninfo = False
+
for line in rc.readlines():
if 'productversion' in line.lower() and 'value' in line.lower():
items = line.split()
- version = items[2]
- version = version.replace('"', '')
- version = version.replace("'", "")
+ versionstr = items[2]
+ versionstr = versionstr.replace('"', '')
+ versionstr = versionstr.replace("'", "")
# version = version.replace("+", "_")
- print version
+ print versionstr + architecture
+ if 'versioninfo' in line.lower():
+ isversioninfo = True
+ if 'begin' in line.lower():
+ isversioninfo = False
+ if isversioninfo and 'productversion' in line.lower():
+ items = line.split()
+ ''' the second element contains now version info in the form major,minor,fix,build'''
+ veritems = items[1].split(',')
+ version = veritems[0] + '.' + veritems[1]
with open('version.wxi', 'w') as wxi:
@@ -22,8 +61,16 @@ with open('version.wxi', 'w') as wxi: wxi.write("<!-- do not edit, this file is created by version.py tool any changes will be lost -->\n")
wxi.write("<Include>\n")
wxi.write("<?define ProductVersion='" + version + "' ?>\n")
- wxi.write("<?define FullProductName='Inkscape " + version + "' ?>\n")
+ wxi.write("<?define FullProductName='Inkscape " + versionstr + "' ?>\n")
+ if 'x64' in architecture:
+ wxi.write("<?define ProgramFilesFolder='ProgramFiles64Folder' ?>\n")
+ wxi.write("<?define Win64='yes' ?>\n")
+ wxi.write("<?define InstallerVersion='200' ?>\n")
+ wxi.write("<?define Platform='x64' ?>\n")
+ else:
+ wxi.write("<?define ProgramFilesFolder='ProgramFilesFolder' ?>\n")
+ wxi.write("<?define Win64='no' ?>\n")
+ wxi.write("<?define InstallerVersion='100' ?>\n")
+ wxi.write("<?define Platform='x86' ?>\n")
wxi.write("</Include>\n")
-
-
diff --git a/packaging/wix/wixenv.bat b/packaging/wix/wixenv.bat index 5f1f7e90c..c798a9ce1 100644 --- a/packaging/wix/wixenv.bat +++ b/packaging/wix/wixenv.bat @@ -5,12 +5,12 @@ ver | findstr /i "6\.1\." > nul IF %ERRORLEVEL% EQU 0 goto win7
@rem all other cases
-IF "%WIX_PATH%"=="" set WIX_PATH=C:\Programme\WiX Toolset v3.7\bin
+IF "%WIX_PATH%"=="" set WIX_PATH=C:\Programme\WiX Toolset v3.8\bin
IF "%DEVLIBS_PATH%"=="" set DEVLIBS_PATH=c:\devlibs
goto setpath
:win7
-IF "%WIX_PATH%"=="" set WIX_PATH=C:\Program Files (x86)\WiX Toolset v3.7\bin
+IF "%WIX_PATH%"=="" set WIX_PATH=C:\Program Files (x86)\WiX Toolset v3.8\bin
IF "%DEVLIBS_PATH%"=="" set DEVLIBS_PATH=c:\devlibs
:setpath
@@ -18,15 +18,15 @@ msgstr "" "Project-Id-Version: inkscape\n" "Report-Msgid-Bugs-To: inkscape-devel@lists.sourceforge.net\n" "POT-Creation-Date: 2013-11-07 15:09+0100\n" -"PO-Revision-Date: 2013-12-21 12:02+0100\n" -"Last-Translator: Uwe Schoeler <uwesch@gmail.com>\n" +"PO-Revision-Date: 2014-06-23 20:15+0100\n" +"Last-Translator: Uwe Schoeler <UweSch@gmail.com>\n" "Language-Team: <de@li.org>\n" "Language: de\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -"X-Generator: Poedit 1.6.1\n" +"X-Generator: Poedit 1.6.5\n" "X-Poedit-Basepath: .\n" "X-Poedit-SourceCharset: utf-8\n" @@ -9435,9 +9435,8 @@ msgid "Scale:" msgstr "Skalierung:" #: ../src/live_effects/lpe-path_length.cpp:26 -#, fuzzy msgid "Scaling factor" -msgstr "Saklierungs-Faktor" +msgstr "Saklierungsfaktor" #: ../src/live_effects/lpe-path_length.cpp:28 #: ../src/live_effects/lpe-ruler.cpp:42 @@ -9454,9 +9453,8 @@ msgid "Unit" msgstr "Einheit" #: ../src/live_effects/lpe-path_length.cpp:29 -#, fuzzy msgid "Display unit" -msgstr "Anzeige Anpassungen" +msgstr "Anzeige-Einheit" #: ../src/live_effects/lpe-path_length.cpp:29 #, fuzzy @@ -12213,14 +12211,12 @@ msgid "Flow Excluded Region" msgstr "Ausgeschlossenen Bereich umfließen" #: ../src/sp-flowtext.cpp:289 -#, fuzzy msgid "Flowed Text" msgstr "Fließtext" #: ../src/sp-flowtext.cpp:291 -#, fuzzy msgid "Linked Flowed Text" -msgstr "Fließtext" +msgstr "Verknüpfter Fließtext" #: ../src/sp-flowtext.cpp:298 ../src/sp-text.cpp:357 #: ../src/text-context.cpp:1597 @@ -22862,7 +22858,7 @@ msgstr "Zur nächste Ebene wechseln" #: ../src/verbs.cpp:1228 msgid "Switched to next layer." -msgstr "Zur nächsten Ebene gewächselt." +msgstr "Zur nächsten Ebene gewechselt." #: ../src/verbs.cpp:1230 msgid "Cannot go past last layer." diff --git a/share/extensions/inkex.py b/share/extensions/inkex.py index a8adfa43d..0f880005d 100755 --- a/share/extensions/inkex.py +++ b/share/extensions/inkex.py @@ -168,7 +168,7 @@ class Effect: try: stream = open(self.svg_file, 'r') except Exception: - errormsg(_("Unable to open specified file: %s") % self.svg_file) + errormsg(_("Unable to open object member file: %s") % self.svg_file) sys.exit() # Finally, if the filename was not specified anywhere, use diff --git a/share/extensions/render_barcode_datamatrix.py b/share/extensions/render_barcode_datamatrix.py index bca1d2241..83d009db8 100755 --- a/share/extensions/render_barcode_datamatrix.py +++ b/share/extensions/render_barcode_datamatrix.py @@ -140,7 +140,7 @@ def get_parameters(nrow, ncol): elif ( nrow == 20 and ncol == 20 ): return 18, 18, 1, 1, 22, 18, 1 elif ( nrow == 22 and ncol == 22 ): - return 18, 18, 1, 1, 30, 20, 1 + return 20, 20, 1, 1, 30, 20, 1 elif ( nrow == 24 and ncol == 24 ): return 22, 22, 1, 1, 36, 24, 1 elif ( nrow == 26 and ncol == 26 ): diff --git a/share/symbols/FlowSymbols.svg b/share/symbols/FlowSymbols.svg index a9dde4798..91495034e 100644 --- a/share/symbols/FlowSymbols.svg +++ b/share/symbols/FlowSymbols.svg @@ -110,7 +110,7 @@ </symbol> <symbol id="AuxillaryOp"> - <title>Auxillary Operation</title> + <title>Auxiliary Operation</title> <desc>Offline operation.</desc> <rect x="35" y="35" width="80" height="80" style="stroke-width:2"/> </symbol> @@ -123,12 +123,12 @@ <symbol id="Extract"> <title>Extract</title> - <desc>Removel of one or more specific sets of times from a set. (ISO)</desc> + <desc>Removal of one or more specific sets of times from a set. (ISO)</desc> <path d="m 35,115 40,-70 40,70 z" style="stroke-width:2"/> </symbol> <symbol id="Terminal"> - <title>Terminal/Interupt</title> + <title>Terminal/Interrupt</title> <desc>A terminal point in a flowchart: start, stop, halt, etc.</desc> <path d="m 35,95 a 20,20 0 0 1 0,-40 l 80,0 a 20,20 0 0 1 0,40 z" style="stroke-width:2"/> </symbol> diff --git a/src/2geom/path.cpp b/src/2geom/path.cpp index fc4d72028..3558af3b3 100644 --- a/src/2geom/path.cpp +++ b/src/2geom/path.cpp @@ -110,7 +110,7 @@ Path &Path::operator*=(Translate const &m) { Sequence::iterator it; Point prev; for (it = get_curves().begin() ; it != last ; ++it) { - //*(const_cast<Curve*>(&**it)) *= m; + // *(const_cast<Curve*>(&**it)) *= m; const_cast<Curve*>(it->get())->operator*=(m); if ( it != get_curves().begin() && (*it)->initialPoint() != prev ) { THROW_CONTINUITYERROR(); diff --git a/src/box3d.cpp b/src/box3d.cpp index 13a8d0e3e..eb82524dd 100644 --- a/src/box3d.cpp +++ b/src/box3d.cpp @@ -672,15 +672,6 @@ box3d_aux_set_z_orders (int z_orders[6], int a, int b, int c, int d, int e, int z_orders[5] = f; } -static inline void -box3d_swap_z_orders (int z_orders[6]) { - int tmp; - for (int i = 0; i < 3; ++i) { - tmp = z_orders[i]; - z_orders[i] = z_orders[5-i]; - z_orders[5-i] = tmp; - } -} /* * In standard perspective we have: @@ -695,11 +686,6 @@ box3d_swap_z_orders (int z_orders[6]) { /* All VPs infinite */ static void box3d_set_new_z_orders_case0 (SPBox3D *box, int z_orders[6], Box3D::Axis central_axis) { - Persp3D *persp = box3d_get_perspective(box); - Geom::Point xdir(persp3d_get_infinite_dir(persp, Proj::X)); - Geom::Point ydir(persp3d_get_infinite_dir(persp, Proj::Y)); - Geom::Point zdir(persp3d_get_infinite_dir(persp, Proj::Z)); - bool swapped = box3d_XY_axes_are_swapped(box); switch(central_axis) { @@ -811,12 +797,7 @@ box3d_set_new_z_orders_case1 (SPBox3D *box, int z_orders[6], Box3D::Axis central /* Precisely 2 finite VPs */ static void box3d_set_new_z_orders_case2 (SPBox3D *box, int z_orders[6], Box3D::Axis central_axis, Box3D::Axis /*infinite_axis*/) { - Persp3D *persp = box3d_get_perspective(box); - Geom::Point c3(box3d_get_corner_screen(box, 3, false)); - Geom::Point xdir(persp3d_get_PL_dir_from_pt(persp, c3, Proj::X)); - Geom::Point ydir(persp3d_get_PL_dir_from_pt(persp, c3, Proj::Y)); - Geom::Point zdir(persp3d_get_PL_dir_from_pt(persp, c3, Proj::Z)); bool swapped = box3d_XY_axes_are_swapped(box); diff --git a/src/desktop-events.cpp b/src/desktop-events.cpp index 0129a382d..8be5e001b 100644 --- a/src/desktop-events.cpp +++ b/src/desktop-events.cpp @@ -365,7 +365,7 @@ gint sp_dt_guide_event(SPCanvasItem *item, GdkEvent *event, gpointer data) if (event->motion.state & GDK_CONTROL_MASK) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); unsigned const snaps = abs(prefs->getInt("/options/rotationsnapsperpi/value", 12)); - bool const relative_snaps = abs(prefs->getBool("/options/relativeguiderotationsnap/value", false)); + bool const relative_snaps = prefs->getBool("/options/relativeguiderotationsnap/value", false); if (snaps) { if (relative_snaps) { Geom::Angle orig_angle(guide->normal_to_line); @@ -442,7 +442,7 @@ gint sp_dt_guide_event(SPCanvasItem *item, GdkEvent *event, gpointer data) if (event->motion.state & GDK_CONTROL_MASK) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); unsigned const snaps = abs(prefs->getInt("/options/rotationsnapsperpi/value", 12)); - bool const relative_snaps = abs(prefs->getBool("/options/relativeguiderotationsnap/value", false)); + bool const relative_snaps = prefs->getBool("/options/relativeguiderotationsnap/value", false); if (snaps) { if (relative_snaps) { Geom::Angle orig_angle(guide->normal_to_line); @@ -491,7 +491,6 @@ gint sp_dt_guide_event(SPCanvasItem *item, GdkEvent *event, gpointer data) // set move or rotate cursor Geom::Point const event_w(event->crossing.x, event->crossing.y); - Geom::Point const event_dt(desktop->w2d(event_w)); if ((event->crossing.state & GDK_SHIFT_MASK) && (drag_type != SP_DRAG_MOVE_ORIGIN)) { GdkCursor *guide_cursor; diff --git a/src/display/drawing-text.cpp b/src/display/drawing-text.cpp index 05a2c3c2a..9f3b447df 100644 --- a/src/display/drawing-text.cpp +++ b/src/display/drawing-text.cpp @@ -150,25 +150,26 @@ unsigned DrawingGlyphs::_updateItem(Geom::IntRect const &/*area*/, UpdateContext return STATE_ALL; } -DrawingItem * -DrawingGlyphs::_pickItem(Geom::Point const &p, double delta, unsigned /*flags*/) +DrawingItem *DrawingGlyphs::_pickItem(Geom::Point const &p, double /*delta*/, unsigned /*flags*/) { DrawingText *ggroup = dynamic_cast<DrawingText *>(_parent); if (!ggroup) { throw InvalidItemException(); } + DrawingItem *result = NULL; bool invisible = (ggroup->_nrstyle.fill.type == NRStyle::PAINT_NONE) && (ggroup->_nrstyle.stroke.type == NRStyle::PAINT_NONE); - if (!_font || !_bbox || (!_drawing.outline() && invisible) ) { - return NULL; - } - // With text we take a simple approach: pick if the point is in a character bbox - Geom::Rect expanded(_pick_bbox); - // FIXME, why expand by delta? When is the next line needed? - // expanded.expandBy(delta); - if (expanded.contains(p)) return this; - return NULL; + if (_font && _bbox && (_drawing.outline() || !invisible) ) { + // With text we take a simple approach: pick if the point is in a character bbox + Geom::Rect expanded(_pick_bbox); + // FIXME, why expand by delta? When is the next line needed? + // expanded.expandBy(delta); + if (expanded.contains(p)) { + result = this; + } + } + return result; } diff --git a/src/extension/internal/emf-inout.cpp b/src/extension/internal/emf-inout.cpp index 863d1e006..084fbcd58 100644 --- a/src/extension/internal/emf-inout.cpp +++ b/src/extension/internal/emf-inout.cpp @@ -1641,11 +1641,19 @@ int Emf::myEnhMetaFileProc(char *contents, unsigned int length, PEMF_CALLBACK_DA // next record is valid type and forces pending text to be drawn immediately if ((d->dc[d->level].dirty & DIRTY_TEXT) || ((emr_mask != U_EMR_INVALID) && (emr_mask & U_DRAW_TEXT) && d->tri->dirty)){ TR_layout_analyze(d->tri); + if (d->dc[d->level].clip_id){ + SVGOStringStream tmp_clip; + tmp_clip << "\n<g\n\tclip-path=\"url(#clipEmfPath" << d->dc[d->level].clip_id << ")\"\n>"; + d->outsvg += tmp_clip.str().c_str(); + } TR_layout_2_svg(d->tri); SVGOStringStream ts; ts << d->tri->out; d->outsvg += ts.str().c_str(); d->tri = trinfo_clear(d->tri); + if (d->dc[d->level].clip_id){ + d->outsvg += "\n</g>\n"; + } } if(d->dc[d->level].dirty){ //Apply the delayed background changes, clear the flag d->dc[d->level].bkMode = tbkMode; @@ -2524,8 +2532,8 @@ std::cout << "BEFORE DRAW" double cx = pix_to_x_point( d, (rclBox.left + rclBox.right)/2.0, (rclBox.bottom + rclBox.top)/2.0 ); double cy = pix_to_y_point( d, (rclBox.left + rclBox.right)/2.0, (rclBox.bottom + rclBox.top)/2.0 ); - double rx = pix_to_abs_size( d, fabs(rclBox.right - rclBox.left )/2.0 ); - double ry = pix_to_abs_size( d, fabs(rclBox.top - rclBox.bottom)/2.0 ); + double rx = pix_to_abs_size( d, std::abs(rclBox.right - rclBox.left )/2.0 ); + double ry = pix_to_abs_size( d, std::abs(rclBox.top - rclBox.bottom)/2.0 ); SVGOStringStream tmp_ellipse; tmp_ellipse << "cx=\"" << cx << "\" "; @@ -3141,11 +3149,19 @@ std::cout << "BEFORE DRAW" int status = trinfo_load_textrec(d->tri, &tsp, tsp.ori,TR_EMFBOT); // ori is actually escapement if(status==-1){ // change of escapement, emit what we have and reset TR_layout_analyze(d->tri); + if (d->dc[d->level].clip_id){ + SVGOStringStream tmp_clip; + tmp_clip << "\n<g\n\tclip-path=\"url(#clipEmfPath" << d->dc[d->level].clip_id << ")\"\n>"; + d->outsvg += tmp_clip.str().c_str(); + } TR_layout_2_svg(d->tri); ts << d->tri->out; d->outsvg += ts.str().c_str(); d->tri = trinfo_clear(d->tri); (void) trinfo_load_textrec(d->tri, &tsp, tsp.ori,TR_EMFBOT); // ignore return status, it must work + if (d->dc[d->level].clip_id){ + d->outsvg += "\n</g>\n"; + } } g_free(escaped_text); @@ -3479,7 +3495,7 @@ Emf::open( Inkscape::Extension::Input * /*mod*/, const gchar *uri ) if (d.pDesc){ free( d.pDesc ); } -// std::cout << "SVG Output: " << std::endl << *(d.outsvg) << std::endl; +// std::cout << "SVG Output: " << std::endl << d.outsvg << std::endl; SPDocument *doc = SPDocument::createNewDocFromMem(d.outsvg.c_str(), strlen(d.outsvg.c_str()), TRUE); diff --git a/src/extension/internal/emf-print.cpp b/src/extension/internal/emf-print.cpp index 9c68e40a4..e054829b5 100644 --- a/src/extension/internal/emf-print.cpp +++ b/src/extension/internal/emf-print.cpp @@ -977,8 +977,8 @@ unsigned int PrintEmf::fill( using Geom::X; using Geom::Y; - SPItem *item = SP_ITEM(style->object); - SPClipPath *scp = (item->clip_ref ? item->clip_ref->getObject() : NULL); + //SPItem *item = SP_ITEM(style->object); + //SPClipPath *scp = (item->clip_ref ? item->clip_ref->getObject() : NULL); Geom::Affine tf = m_tr_stack.top(); @@ -1882,7 +1882,7 @@ unsigned int PrintEmf::text(Inkscape::Extension::Print * /*mod*/, char const *te fix90n = 1; //assume vertical rot = (double)(((int) round(rot)) - irem); rotb = rot * M_PI / 1800.0; - if (abs(rot) == 900.0) { + if (std::abs(rot) == 900.0) { fix90n = 2; } } diff --git a/src/extension/internal/emf-print.h b/src/extension/internal/emf-print.h index 1e4970a46..9a1251b38 100644 --- a/src/extension/internal/emf-print.h +++ b/src/extension/internal/emf-print.h @@ -29,7 +29,7 @@ namespace Internal { class PrintEmf : public PrintMetafile { - uint32_t hbrush, hbrushOld, hpen, hpenOld; + uint32_t hbrush, hbrushOld, hpen; unsigned int print_pathv (Geom::PathVector const &pathv, const Geom::Affine &transform); bool print_simple_shape (Geom::PathVector const &pathv, const Geom::Affine &transform); diff --git a/src/extension/internal/text_reassemble.c b/src/extension/internal/text_reassemble.c index 810e3f8cc..4dfc49420 100644 --- a/src/extension/internal/text_reassemble.c +++ b/src/extension/internal/text_reassemble.c @@ -67,8 +67,8 @@ Optional compiler switches for development: File: text_reassemble.c -Version: 0.0.14 -Date: 25-MAR-2014 +Version: 0.0.15 +Date: 24-JUL-2014 Author: David Mathog, Biology Division, Caltech email: mathog@caltech.edu Copyright: 2014 David Mathog and California Institute of Technology (Caltech) @@ -550,7 +550,7 @@ int TR_check_set_vadvance(TR_INFO *tri, int src, int lines){ See if the line to be added is compatible. All text fields in a complex have the same advance, so just set/check the first one. vadvance must be within 1% or do not add a new line */ - if(fabs(1.0 - (tpi->chunks[trec].vadvance/newV) > 0.01)){ + if(fabs(1.0 - (tpi->chunks[trec].vadvance/newV)) > 0.01){ status = 1; } else { /* recalculate the weighted vadvance */ @@ -1820,7 +1820,9 @@ printf("Face idx:%d bbox: xMax/Min:%ld,%ld yMax/Min:%ld,%ld UpEM:%d asc/des:%d,% fasc = ((double) (fsp->face->ascender) )/64.0; fdsc = ((double) (fsp->face->descender))/64.0; - if(tri->load_flags & FT_LOAD_NO_SCALE) xe *= tsp->fs/32.0; + /* originally the denominator was just 32.0, but it broke when units_per_EM wasn't 2048 */ + double fixscale = tsp->fs/(((double) fsp->face->units_per_EM)/64.0); + if(tri->load_flags & FT_LOAD_NO_SCALE) xe *= fixscale; /* now place the rectangle using ALN information */ if( taln & ALIHORI & ALILEFT ){ @@ -1837,11 +1839,11 @@ printf("Face idx:%d bbox: xMax/Min:%ld,%ld yMax/Min:%ld,%ld UpEM:%d asc/des:%d,% } tpi->chunks[current].ldir = tsp->ldir; - if(tri->load_flags & FT_LOAD_NO_SCALE){ - asc *= tsp->fs/32.0; - dsc *= tsp->fs/32.0; - fasc *= tsp->fs/32.0; - fdsc *= tsp->fs/32.0; + if(tri->load_flags & FT_LOAD_NO_SCALE){ + asc *= fixscale; + dsc *= fixscale; + fasc *= fixscale; + fdsc *= fixscale; } diff --git a/src/extension/internal/wmf-inout.cpp b/src/extension/internal/wmf-inout.cpp index 85060470b..beb6190d3 100644 --- a/src/extension/internal/wmf-inout.cpp +++ b/src/extension/internal/wmf-inout.cpp @@ -63,7 +63,6 @@ namespace Extension { namespace Internal { -static U_RECT16 rc_old; static bool clipset = false; static uint32_t BLTmode=0; @@ -2054,8 +2053,8 @@ std::cout << "BEFORE DRAW" double cx = pix_to_x_point( d, (rc.left + rc.right)/2.0, (rc.bottom + rc.top)/2.0 ); double cy = pix_to_y_point( d, (rc.left + rc.right)/2.0, (rc.bottom + rc.top)/2.0 ); - double rx = pix_to_abs_size( d, fabs(rc.right - rc.left )/2.0 ); - double ry = pix_to_abs_size( d, fabs(rc.top - rc.bottom)/2.0 ); + double rx = pix_to_abs_size( d, std::abs(rc.right - rc.left )/2.0 ); + double ry = pix_to_abs_size( d, std::abs(rc.top - rc.bottom)/2.0 ); SVGOStringStream tmp_ellipse; tmp_ellipse << "cx=\"" << cx << "\" "; diff --git a/src/extension/internal/wmf-print.cpp b/src/extension/internal/wmf-print.cpp index 55ad5da5f..e5ff34009 100644 --- a/src/extension/internal/wmf-print.cpp +++ b/src/extension/internal/wmf-print.cpp @@ -1396,7 +1396,7 @@ unsigned int PrintWmf::text(Inkscape::Extension::Print * /*mod*/, char const *te fix90n = 1; //assume vertical rot = (double)(((int) round(rot)) - irem); rotb = rot * M_PI / 1800.0; - if (abs(rot) == 900.0) { + if (std::abs(rot) == 900.0) { fix90n = 2; } } diff --git a/src/extension/internal/wmf-print.h b/src/extension/internal/wmf-print.h index 1e5d4c323..e4cf19184 100644 --- a/src/extension/internal/wmf-print.h +++ b/src/extension/internal/wmf-print.h @@ -28,7 +28,7 @@ namespace Internal { class PrintWmf : public PrintMetafile { - uint32_t hbrush, hpen, hpenOld, hbrush_null, hpen_null; + uint32_t hbrush, hpen, hbrush_null, hpen_null; uint32_t hmiterlimit; // used to minimize redundant records that set this unsigned int print_pathv (Geom::PathVector const &pathv, const Geom::Affine &transform); diff --git a/src/gradient-chemistry.cpp b/src/gradient-chemistry.cpp index 89b7968fc..27f4d7a98 100644 --- a/src/gradient-chemistry.cpp +++ b/src/gradient-chemistry.cpp @@ -1296,6 +1296,10 @@ Geom::Point getGradientCoords(SPItem *item, GrPointType point_type, guint point_ break; case POINT_LG_MID: { + if (lg->vector.stops.size() < point_i) { + g_message("POINT_LG_MID bug trigger, see LP bug #453067"); + break; + } gdouble offset = lg->vector.stops.at(point_i).offset; p = (1-offset) * Geom::Point(lg->x1.computed, lg->y1.computed) + offset * Geom::Point(lg->x2.computed, lg->y2.computed); } @@ -1321,12 +1325,20 @@ Geom::Point getGradientCoords(SPItem *item, GrPointType point_type, guint point_ break; case POINT_RG_MID1: { + if (rg->vector.stops.size() < point_i) { + g_message("POINT_RG_MID1 bug trigger, see LP bug #453067"); + break; + } gdouble offset = rg->vector.stops.at(point_i).offset; p = (1-offset) * Geom::Point (rg->cx.computed, rg->cy.computed) + offset * Geom::Point(rg->cx.computed + rg->r.computed, rg->cy.computed); } break; case POINT_RG_MID2: { + if (rg->vector.stops.size() < point_i) { + g_message("POINT_RG_MID2 bug trigger, see LP bug #453067"); + break; + } gdouble offset = rg->vector.stops.at(point_i).offset; p = (1-offset) * Geom::Point (rg->cx.computed, rg->cy.computed) + offset * Geom::Point(rg->cx.computed, rg->cy.computed - rg->r.computed); } diff --git a/src/gradient-drag.cpp b/src/gradient-drag.cpp index 42b8ad8fe..a14220cfa 100644 --- a/src/gradient-drag.cpp +++ b/src/gradient-drag.cpp @@ -21,7 +21,6 @@ #include <glibmm/i18n.h> #include <cstring> #include <string> -//#include <2geom/bezier-curve.h> #include "desktop-handles.h" #include "selection.h" @@ -795,8 +794,7 @@ static void gr_knot_moved_handler(SPKnot *knot, Geom::Point const &ppointer, gui d_new->updateKnotShape (); d_new->updateTip (); d_new->updateDependencies(true); - DocumentUndo::done(sp_desktop_document (d_new->parent->desktop), SP_VERB_CONTEXT_GRADIENT, - _("Merge gradient handles")); + DocumentUndo::done(sp_desktop_document (d_new->parent->desktop), SP_VERB_CONTEXT_GRADIENT, _("Merge gradient handles")); return; } } diff --git a/src/knot.cpp b/src/knot.cpp index 61d0dff39..2f8f55a2e 100644 --- a/src/knot.cpp +++ b/src/knot.cpp @@ -162,6 +162,9 @@ SPKnot::~SPKnot() { g_free(this->tip); this->tip = NULL; } + + // FIXME: cannot snap to destroyed knot (lp:1309050) + //sp_event_context_discard_delayed_snap_event(this->desktop->event_context); } void SPKnot::startDragging(Geom::Point const &p, gint x, gint y, guint32 etime) { @@ -282,7 +285,7 @@ static int sp_knot_handler(SPCanvasItem */*item*/, GdkEvent *event, SPKnot *knot knot->setFlag(SP_KNOT_DRAGGING, TRUE); } - sp_event_context_snap_delay_handler(knot->desktop->event_context, NULL, (gpointer) knot, (GdkEventMotion *)event, Inkscape::UI::Tools::DelayedSnapEvent::KNOT_HANDLER); + sp_event_context_snap_delay_handler(knot->desktop->event_context, NULL, knot, (GdkEventMotion *)event, Inkscape::UI::Tools::DelayedSnapEvent::KNOT_HANDLER); sp_knot_handler_request_position(event, knot); moved = TRUE; } diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp index 868a9d743..f058189d3 100644 --- a/src/selection-chemistry.cpp +++ b/src/selection-chemistry.cpp @@ -1621,10 +1621,13 @@ void sp_selection_apply_affine(Inkscape::Selection *selection, Geom::Affine cons item->doWriteTransform(item->getRepr(), item->transform, NULL, compensate); } - // if we're moving the actual object, not just updating the repr, we can transform the + // if we're transforming the actual object, not just updating the repr, we can transform the // center by the same matrix (only necessary for non-translations) if (set_i2d && item->isCenterSet() && !(affine.isTranslation() || affine.isIdentity())) { - item->setCenter(old_center * affine); + // If there's a viewbox, we might have an affine with a translation component; + // we will only apply the scaling/skewing components, not the translations + // because otherwise the center will move relative to the item + item->setCenter(old_center * affine.withoutTranslation()); item->updateRepr(); } } diff --git a/src/seltrans.cpp b/src/seltrans.cpp index d6f31f073..4b1a3a5fa 100644 --- a/src/seltrans.cpp +++ b/src/seltrans.cpp @@ -377,12 +377,6 @@ void Inkscape::SelTrans::transform(Geom::Affine const &rel_affine, Geom::Point c g_return_if_fail(_grabbed); g_return_if_fail(!_empty); - // E.g. scaling a perfectly vertical line in horizontal direction will not work, and will produce an identity affine - - if (rel_affine.isIdentity()) { - return; - } - Geom::Affine const affine( Geom::Translate(-norm) * rel_affine * Geom::Translate(norm) ); if (_show == SHOW_CONTENT) { diff --git a/src/sp-flowregion.cpp b/src/sp-flowregion.cpp index 709e9e464..e8e5c3d95 100644 --- a/src/sp-flowregion.cpp +++ b/src/sp-flowregion.cpp @@ -185,6 +185,8 @@ Inkscape::XML::Node *SPFlowregion::write(Inkscape::XML::Document *xml_doc, Inksc SPItem::write(xml_doc, repr, flags); + this->UpdateComputed(); // copied from update(), see LP Bug 1339305 + return repr; } @@ -372,6 +374,8 @@ static void GetDest(SPObject* child,Shape **computed) tr_mat = SP_ITEM(u_child)->transform; } if ( SP_IS_SHAPE (u_child) ) { + if (!(SP_SHAPE(u_child)->_curve)) + SP_SHAPE (u_child)->set_shape (); curve = SP_SHAPE (u_child)->getCurve (); } else if ( SP_IS_TEXT (u_child) ) { curve = SP_TEXT (u_child)->getNormalizedBpath (); diff --git a/src/sp-flowtext.cpp b/src/sp-flowtext.cpp index b4fd54ee4..59832a2b4 100644 --- a/src/sp-flowtext.cpp +++ b/src/sp-flowtext.cpp @@ -255,6 +255,8 @@ Inkscape::XML::Node* SPFlowtext::write(Inkscape::XML::Document* doc, Inkscape::X } } + this->rebuildLayout(); // copied from update(), see LP Bug 1339305 + SPItem::write(doc, repr, flags); return repr; diff --git a/src/sp-item-group.cpp b/src/sp-item-group.cpp index 2cfe97db8..7af4e3320 100644 --- a/src/sp-item-group.cpp +++ b/src/sp-item-group.cpp @@ -664,7 +664,8 @@ void SPGroup::scaleChildItemsRec(Geom::Scale const &sc, Geom::Point const &p) Geom::Point old_center(0,0); if (item->isCenterSet()) { - old_center = item->getCenter(); + item->scaleCenter(sc.inverse()); // Convert the old relative center position to the new coordinates already now + old_center = item->getCenter(); // because getCenter() will use the bbox midpoint, which is also already in the new coordinates } gchar const *conn_type = NULL; diff --git a/src/sp-item.cpp b/src/sp-item.cpp index b10aae1c6..0cdff6546 100644 --- a/src/sp-item.cpp +++ b/src/sp-item.cpp @@ -271,6 +271,11 @@ Geom::Point SPItem::getCenter() const { } } +void +SPItem::scaleCenter(Geom::Scale const &sc) { + transform_center_x *= sc[Geom::X]; + transform_center_y *= sc[Geom::Y]; +} namespace { diff --git a/src/sp-item.h b/src/sp-item.h index d605c99b9..ce93b1d40 100644 --- a/src/sp-item.h +++ b/src/sp-item.h @@ -159,6 +159,7 @@ public: void unsetCenter(); bool isCenterSet() const; Geom::Point getCenter() const; + void scaleCenter(Geom::Scale const &sc); bool isVisibleAndUnlocked() const; diff --git a/src/sp-lpe-item.cpp b/src/sp-lpe-item.cpp index 439e44508..bb7d9f273 100644 --- a/src/sp-lpe-item.cpp +++ b/src/sp-lpe-item.cpp @@ -340,6 +340,7 @@ static void sp_lpe_item_create_original_path_recursive(SPLPEItem *lpeitem) { g_return_if_fail(lpeitem != NULL); + if (SP_IS_GROUP(lpeitem)) { GSList const *item_list = sp_item_group_item_list(SP_GROUP(lpeitem)); for ( GSList const *iter = item_list; iter; iter = iter->next ) { @@ -361,6 +362,7 @@ static void sp_lpe_item_cleanup_original_path_recursive(SPLPEItem *lpeitem) { g_return_if_fail(lpeitem != NULL); + if (SP_IS_GROUP(lpeitem)) { GSList const *item_list = sp_item_group_item_list(SP_GROUP(lpeitem)); for ( GSList const *iter = item_list; iter; iter = iter->next ) { diff --git a/src/sp-text.cpp b/src/sp-text.cpp index bbc7ec43d..9a7f0b7a0 100644 --- a/src/sp-text.cpp +++ b/src/sp-text.cpp @@ -278,6 +278,7 @@ Inkscape::XML::Node *SPText::write(Inkscape::XML::Document *xml_doc, Inkscape::X } this->attributes.writeTo(repr); + this->rebuildLayout(); // copied from update(), see LP Bug 1339305 // deprecated attribute, but keep it around for backwards compatibility if (this->style->line_height.set && !this->style->line_height.inherit && !this->style->line_height.normal && this->style->line_height.unit == SP_CSS_UNIT_PERCENT) { diff --git a/src/sp-use.cpp b/src/sp-use.cpp index e8fe3687f..e3fcd252a 100644 --- a/src/sp-use.cpp +++ b/src/sp-use.cpp @@ -37,6 +37,9 @@ #include "sp-symbol.h" #include "sp-use.h" #include "sp-use-reference.h" +#include "sp-shape.h" +#include "sp-text.h" +#include "sp-flowtext.h" namespace { SPObject* createUse() { @@ -176,6 +179,16 @@ Inkscape::XML::Node* SPUse::write(Inkscape::XML::Document *xml_doc, Inkscape::XM g_free(uri_string); } + if (SP_IS_SHAPE(this->child)) { + SP_SHAPE(this->child)->set_shape(); // evaluate SPCurve of child + } else if (SP_IS_TEXT(this->child)) { + SP_TEXT(this->child)->rebuildLayout(); // refresh Layout, LP Bug 1339305 + } else if (SP_IS_FLOWTEXT(this->child)) { + if (SP_IS_FLOWREGION(SP_FLOWTEXT(this->child)->firstChild())) + SP_FLOWREGION(SP_FLOWTEXT(this->child)->firstChild())->UpdateComputed(); + SP_FLOWTEXT(this->child)->rebuildLayout(); + } + return repr; } diff --git a/src/style-internal.cpp b/src/style-internal.cpp index c686a1807..ae70fc10d 100644 --- a/src/style-internal.cpp +++ b/src/style-internal.cpp @@ -270,18 +270,18 @@ SPILength::read( gchar const *str ) { } else if (!strcmp(e, "em")) { /* EM square */ unit = SP_CSS_UNIT_EM; - if( style && &style->font_size ) { + if( style ) { computed = value * style->font_size.computed; } else { - computed = value * style->font_size.font_size_default; + computed = value * SPIFontSize::font_size_default; } } else if (!strcmp(e, "ex")) { /* ex square */ unit = SP_CSS_UNIT_EX; - if( style && &style->font_size ) { + if( style ) { computed = value * style->font_size.computed * 0.5; // FIXME } else { - computed = value * style->font_size.font_size_default * 0.5; + computed = value * SPIFontSize::font_size_default * 0.5; } } else if (!strcmp(e, "%")) { /* Percentage */ @@ -1390,9 +1390,8 @@ SPIFilter::read( gchar const *str ) { } } -const Glib::ustring -SPIFilter::write( guint const flags, SPIBase const *const base) const { - +const Glib::ustring SPIFilter::write( guint const flags, SPIBase const *const /*base*/) const +{ // TODO: fix base //SPILength const *const my_base = dynamic_cast<const SPILength*>(base); if ( (flags & SP_STYLE_FLAG_ALWAYS) || @@ -1440,7 +1439,7 @@ SPIFilter::cascade( const SPIBase* const parent ) { void SPIFilter::merge( const SPIBase* const parent ) { if( const SPIFilter* p = dynamic_cast<const SPIFilter*>(parent) ) { - // The "correct" thing to due is to combine the filter primitives. + // The "correct" thing to do is to combine the filter primitives. // The next best thing is to keep any filter on this object. If there // is no filter on this object, then use any filter on the parent. if( (!set || inherit) && p->href && p->href->getObject() ) { // is the getObject() needed? @@ -1453,9 +1452,11 @@ SPIFilter::merge( const SPIBase* const parent ) { } } else { // If we don't have an href, create it - if( &style->document ) { // FIXME + if( style->document ) { // FIXME href = new SPFilterReference(style->document); //href->changedSignal().connect(sigc::bind(sigc::ptr_fun(sp_style_filter_ref_changed), style)); + } else if (style->object) { + href = new SPFilterReference(style->object); } } if( href ) { @@ -1921,9 +1922,8 @@ SPIFont::read( gchar const *str ) { } } -const Glib::ustring -SPIFont::write( guint const flags, SPIBase const *const base) const { - +const Glib::ustring SPIFont::write( guint const /*flags*/, SPIBase const *const /*base*/) const +{ // At the moment, do nothing. We could add a preference to write out // 'font' shorthand rather than longhand properties. diff --git a/src/ui/dialog/clonetiler.cpp b/src/ui/dialog/clonetiler.cpp index fb131d8da..e5f18216c 100644 --- a/src/ui/dialog/clonetiler.cpp +++ b/src/ui/dialog/clonetiler.cpp @@ -2242,6 +2242,8 @@ void CloneTiler::clonetiler_apply(GtkWidget */*widget*/, GtkWidget *dlg) clonetiler_remove (NULL, dlg, false); + double scale_units = Inkscape::Util::Quantity::convert(1, "px", sp_desktop_document(desktop)->getDefaultUnit()); + double shiftx_per_i = 0.01 * prefs->getDoubleLimited(prefs_path + "shiftx_per_i", 0, -10000, 10000); double shifty_per_i = 0.01 * prefs->getDoubleLimited(prefs_path + "shifty_per_i", 0, -10000, 10000); double shiftx_per_j = 0.01 * prefs->getDoubleLimited(prefs_path + "shiftx_per_j", 0, -10000, 10000); @@ -2311,8 +2313,8 @@ void CloneTiler::clonetiler_apply(GtkWidget */*widget*/, GtkWidget *dlg) int jmax = prefs->getInt(prefs_path + "jmax", 2); bool fillrect = prefs->getBool(prefs_path + "fillrect"); - double fillwidth = prefs->getDoubleLimited(prefs_path + "fillwidth", 50, 0, 1e6); - double fillheight = prefs->getDoubleLimited(prefs_path + "fillheight", 50, 0, 1e6); + double fillwidth = scale_units*prefs->getDoubleLimited(prefs_path + "fillwidth", 50, 0, 1e6); + double fillheight = scale_units*prefs->getDoubleLimited(prefs_path + "fillheight", 50, 0, 1e6); bool dotrace = prefs->getBool(prefs_path + "dotrace"); int pick = prefs->getInt(prefs_path + "pick"); @@ -2358,11 +2360,11 @@ void CloneTiler::clonetiler_apply(GtkWidget */*widget*/, GtkWidget *dlg) SPItem::VISUAL_BBOX : SPItem::GEOMETRIC_BBOX ); Geom::OptRect r = item->documentBounds(bbox_type); if (r) { - w = r->dimensions()[Geom::X]; - h = r->dimensions()[Geom::Y]; - x0 = r->min()[Geom::X]; - y0 = r->min()[Geom::Y]; - center = desktop->dt2doc(item->getCenter()); + w = scale_units*r->dimensions()[Geom::X]; + h = scale_units*r->dimensions()[Geom::Y]; + x0 = scale_units*r->min()[Geom::X]; + y0 = scale_units*r->min()[Geom::Y]; + center = scale_units*desktop->dt2doc(item->getCenter()); sp_repr_set_svg_double(obj_repr, "inkscape:tile-cx", center[Geom::X]); sp_repr_set_svg_double(obj_repr, "inkscape:tile-cy", center[Geom::Y]); @@ -2578,7 +2580,7 @@ void CloneTiler::clonetiler_apply(GtkWidget */*widget*/, GtkWidget *dlg) Geom::Point new_center; bool center_set = false; if (obj_repr->attribute("inkscape:transform-center-x") || obj_repr->attribute("inkscape:transform-center-y")) { - new_center = desktop->dt2doc(item->getCenter()) * t; + new_center = scale_units*desktop->dt2doc(item->getCenter()) * t; center_set = true; } diff --git a/src/ui/dialog/dialog-manager.cpp b/src/ui/dialog/dialog-manager.cpp index d427e3590..7e69e439a 100644 --- a/src/ui/dialog/dialog-manager.cpp +++ b/src/ui/dialog/dialog-manager.cpp @@ -251,7 +251,7 @@ void DialogManager::showDialog(gchar const *name, bool grabfocus) { /** * Shows the named dialog, creating it if necessary. */ -void DialogManager::showDialog(GQuark name, bool grabfocus) { +void DialogManager::showDialog(GQuark name, bool /*grabfocus*/) { bool wantTiming = Inkscape::Preferences::get()->getBool("/dialogs/debug/trackAppear", false); GTimer *timer = (wantTiming) ? g_timer_new() : 0; // if needed, must be created/started before getDialog() Dialog *dialog = getDialog(name); @@ -262,8 +262,8 @@ void DialogManager::showDialog(GQuark name, bool grabfocus) { tracker->setAutodelete(true); timer = 0; } - if (grabfocus) - dialog->present(); + // should check for grabfocus, but lp:1348927 prevents it + dialog->present(); } if ( timer ) { diff --git a/src/ui/dialog/layers.cpp b/src/ui/dialog/layers.cpp index b5dac0595..65351cb68 100644 --- a/src/ui/dialog/layers.cpp +++ b/src/ui/dialog/layers.cpp @@ -926,9 +926,8 @@ LayersPanel::LayersPanel() : // ------------------------------------------------------- { - _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_RENAME, 0, "Rename", (int)BUTTON_RENAME ) ); - _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_DUPLICATE, 0, "Duplicate", (int)BUTTON_DUPLICATE ) ); _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_NEW, 0, "New", (int)BUTTON_NEW ) ); + _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_RENAME, 0, "Rename", (int)BUTTON_RENAME ) ); _popupMenu.append(*Gtk::manage(new Gtk::SeparatorMenuItem())); @@ -944,9 +943,14 @@ LayersPanel::LayersPanel() : _popupMenu.append(*Gtk::manage(new Gtk::SeparatorMenuItem())); - _watchingNonTop.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_RAISE, INKSCAPE_ICON("go-up"), "Up", (int)BUTTON_UP ) ); - _watchingNonBottom.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_LOWER, INKSCAPE_ICON("go-down"), "Down", (int)BUTTON_DOWN ) ); + _watchingNonTop.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_RAISE, INKSCAPE_ICON("layer-raise"), "Up", (int)BUTTON_UP ) ); + _watchingNonBottom.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_LOWER, INKSCAPE_ICON("layer-lower"), "Down", (int)BUTTON_DOWN ) ); + _popupMenu.append(*Gtk::manage(new Gtk::SeparatorMenuItem())); + + _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_DUPLICATE, 0, "Duplicate", (int)BUTTON_DUPLICATE ) ); + _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_DELETE, 0, "Delete", (int)BUTTON_DELETE ) ); + _popupMenu.show_all_children(); } // ------------------------------------------------------- diff --git a/src/ui/dialog/template-widget.cpp b/src/ui/dialog/template-widget.cpp index ef91962d4..9758b35ac 100644 --- a/src/ui/dialog/template-widget.cpp +++ b/src/ui/dialog/template-widget.cpp @@ -120,7 +120,7 @@ void TemplateWidget::_displayTemplateDetails() if (_current_template.long_description != "") message += _("Description: ") + _current_template.long_description + "\n\n"; - if (~_current_template.keywords.empty()){ + if (!_current_template.keywords.empty()){ message += _("Keywords: "); for (std::set<Glib::ustring>::iterator it = _current_template.keywords.begin(); it != _current_template.keywords.end(); ++it) message += *it + " "; diff --git a/src/ui/tools/pen-tool.cpp b/src/ui/tools/pen-tool.cpp index 56bcbef0d..d826eaf48 100644 --- a/src/ui/tools/pen-tool.cpp +++ b/src/ui/tools/pen-tool.cpp @@ -86,15 +86,15 @@ static bool pen_within_tolerance = false; static int pen_last_paraxial_dir = 0; // last used direction in horizontal/vertical mode; 0 = horizontal, 1 = vertical namespace { - ToolBase* createPenContext() { - return new PenTool(); - } + ToolBase* createPenContext() { + return new PenTool(); + } - bool penContextRegistered = ToolFactory::instance().registerObject("/tools/freehand/pen", createPenContext); + bool penContextRegistered = ToolFactory::instance().registerObject("/tools/freehand/pen", createPenContext); } const std::string& PenTool::getPrefsPath() { - return PenTool::prefsPath; + return PenTool::prefsPath; } const std::string PenTool::prefsPath = "/tools/freehand/pen"; @@ -321,7 +321,7 @@ bool PenTool::item_handler(SPItem* item, GdkEvent* event) { } if (!ret) { - ret = FreehandBase::item_handler(item, event); + ret = FreehandBase::item_handler(item, event); } return ret; @@ -359,7 +359,7 @@ bool PenTool::root_handler(GdkEvent* event) { } if (!ret) { - ret = FreehandBase::root_handler(event); + ret = FreehandBase::root_handler(event); } return ret; @@ -1268,15 +1268,15 @@ bool PenTool::_handleKeyPress(GdkEvent *event) { } // asign the value in a third of the distance of the last segment. - if(this->bspline){ + if (this->bspline){ this->p[1] = this->p[0] + (1./3)*(this->p[3] - this->p[0]); } Geom::Point const pt( (this->npoints < 4) ? crv->finalPoint() : this->p[3] ); - + this->npoints = 2; // delete the last segment of the green curve - if( this->green_curve->get_segment_count() == 1){ + if (this->green_curve->get_segment_count() == 1) { this->npoints = 5; if (this->green_bpaths) { if (this->green_bpaths->data) { @@ -1285,11 +1285,12 @@ bool PenTool::_handleKeyPress(GdkEvent *event) { this->green_bpaths = g_slist_remove(this->green_bpaths, this->green_bpaths->data); } this->green_curve->reset(); - }else{ + } else { this->green_curve->backspace(); } + // assign the value of this->p[1] to the oposite of the green line last segment - if(this->spiro){ + if (this->spiro){ Geom::CubicBezier const *cubic = dynamic_cast<Geom::CubicBezier const *>(this->green_curve->last_segment()); if ( cubic ) { this->p[1] = (*cubic)[3] + (*cubic)[3] - (*cubic)[2]; @@ -1298,6 +1299,7 @@ bool PenTool::_handleKeyPress(GdkEvent *event) { this->p[1] = this->p[0]; } } + sp_canvas_item_hide(this->c0); sp_canvas_item_hide(this->c1); sp_canvas_item_hide(this->cl0); @@ -2084,7 +2086,7 @@ void PenTool::_setSubsequentPoint(Geom::Point const p, bool statusbar, guint sta // we are drawing horizontal/vertical lines and hit an anchor; Geom::Point const origin = this->p[0]; // if the previous point and the anchor are not aligned either horizontally or vertically... - if ((abs(p[Geom::X] - origin[Geom::X]) > 1e-9) && (abs(p[Geom::Y] - origin[Geom::Y]) > 1e-9)) { + if ((std::abs(p[Geom::X] - origin[Geom::X]) > 1e-9) && (std::abs(p[Geom::Y] - origin[Geom::Y]) > 1e-9)) { // ...then we should draw an L-shaped path, consisting of two paraxial segments Geom::Point intermed = p; this->_setToNearestHorizVert(intermed, status, false); diff --git a/src/ui/tools/spray-tool.cpp b/src/ui/tools/spray-tool.cpp index 08d3119a1..29f1b9a73 100644 --- a/src/ui/tools/spray-tool.cpp +++ b/src/ui/tools/spray-tool.cpp @@ -677,7 +677,7 @@ bool SprayTool::root_handler(GdkEvent* event) { desktop->setToolboxAdjustmentValue("population", this->population * 100); Geom::Point const scroll_w(event->button.x, event->button.y); Geom::Point const scroll_dt = desktop->point();; - Geom::Point motion_doc(desktop->dt2doc(scroll_dt)); + switch (event->scroll.direction) { case GDK_SCROLL_DOWN: case GDK_SCROLL_UP: { diff --git a/src/ui/tools/tool-base.cpp b/src/ui/tools/tool-base.cpp index 4195c9eb2..f1d90f6c6 100644 --- a/src/ui/tools/tool-base.cpp +++ b/src/ui/tools/tool-base.cpp @@ -1289,8 +1289,7 @@ void sp_event_context_snap_delay_handler(ToolBase *ec, // now, just in case there's no future motion event that drops under the speed limit (when // stopping abruptly) delete ec->_delayed_snap_event; - ec->_delayed_snap_event = new DelayedSnapEvent(ec, dse_item, dse_item2, - event, origin); // watchdog is reset, i.e. pushed forward in time + ec->_delayed_snap_event = new DelayedSnapEvent(ec, dse_item, dse_item2, event, origin); // watchdog is reset, i.e. pushed forward in time // If the watchdog expires before a new motion event is received, we will snap (as explained // above). This means however that when the timer is too short, we will always snap and that the // speed threshold is ineffective. In the extreme case the delay is set to zero, and snapping will @@ -1301,15 +1300,13 @@ void sp_event_context_snap_delay_handler(ToolBase *ec, // snap, and set a new watchdog again. if (ec->_delayed_snap_event == NULL) { // no watchdog has been set // it might have already expired, so we'll set a new one; the snapping frequency will be limited this way - ec->_delayed_snap_event = new DelayedSnapEvent(ec, dse_item, - dse_item2, event, origin); + ec->_delayed_snap_event = new DelayedSnapEvent(ec, dse_item, dse_item2, event, origin); } // else: watchdog has been set before and we'll wait for it to expire } } else { // This is the first GDK_MOTION_NOTIFY event, so postpone snapping and set the watchdog g_assert(ec->_delayed_snap_event == NULL); - ec->_delayed_snap_event = new DelayedSnapEvent(ec, dse_item, dse_item2, - event, origin); + ec->_delayed_snap_event = new DelayedSnapEvent(ec, dse_item, dse_item2, event, origin); } prev_pos = event_pos; diff --git a/src/ui/widget/style-swatch.cpp b/src/ui/widget/style-swatch.cpp index a33c1d09f..98f4e47cd 100644 --- a/src/ui/widget/style-swatch.cpp +++ b/src/ui/widget/style-swatch.cpp @@ -261,7 +261,7 @@ void StyleSwatch::setStyle(SPCSSAttr *css) Glib::ustring css_string; sp_repr_css_write_string (_css, css_string); SPStyle *temp_spstyle = sp_style_new(SP_ACTIVE_DOCUMENT); - if (~css_string.empty()) { + if (!css_string.empty()) { sp_style_merge_from_style_string (temp_spstyle, css_string.c_str()); } diff --git a/src/widgets/desktop-widget.cpp b/src/widgets/desktop-widget.cpp index 2c28dfbfa..1b4648286 100644 --- a/src/widgets/desktop-widget.cpp +++ b/src/widgets/desktop-widget.cpp @@ -1247,8 +1247,8 @@ SPDesktopWidget::shutdown() void SPDesktopWidget::requestCanvasUpdate() { // ^^ also this->desktop != 0 - g_return_if_fail (this->desktop != NULL); - g_return_if_fail (this->desktop->main != NULL); + g_return_if_fail(this->desktop != NULL); + g_return_if_fail(this->desktop->main != NULL); gtk_widget_queue_draw (GTK_WIDGET (SP_CANVAS_ITEM (this->desktop->main)->canvas)); } diff --git a/src/widgets/ruler.cpp b/src/widgets/ruler.cpp index 5d5151343..8e818843d 100644 --- a/src/widgets/ruler.cpp +++ b/src/widgets/ruler.cpp @@ -1394,7 +1394,7 @@ sp_ruler_draw_ticks (SPRuler *ruler) (label_spacing_px > 6*digit_height || tick_index%2 == 0 || cur == 0) && (label_spacing_px > 3*digit_height || tick_index%4 == 0 || cur == 0)) { - if (fabs((int)cur) >= 2000 && (((int) cur)/1000)*1000 == ((int) cur)) + if (std::abs((int)cur) >= 2000 && (((int) cur)/1000)*1000 == ((int) cur)) sprintf (unit_str, "%dk", ((int) cur)/1000); else sprintf (unit_str, "%d", (int) cur); |
