diff options
| author | Jabier Arraiza Cenoz <jabier.arraiza@marker.es> | 2014-02-05 16:32:33 +0000 |
|---|---|---|
| committer | Jabiertxof <jtx@jtx.marker.es> | 2014-02-05 16:32:33 +0000 |
| commit | 274f1d5f9de902061dee7708955c6de2fed53ef5 (patch) | |
| tree | 0dceef73aa8a2411aa731b18050b7ffb759b582f | |
| parent | fixing su_v advertising memory bug (diff) | |
| parent | Fix for Bug #1250685 (Unnecessary gender-specific terms in code). (diff) | |
| download | inkscape-274f1d5f9de902061dee7708955c6de2fed53ef5.tar.gz inkscape-274f1d5f9de902061dee7708955c6de2fed53ef5.zip | |
update to trunk
(bzr r11950.1.248)
| -rw-r--r-- | share/extensions/hpgl_encoder.py | 51 | ||||
| -rw-r--r-- | share/extensions/hpgl_input.inx | 4 | ||||
| -rw-r--r-- | share/extensions/hpgl_output.inx | 19 | ||||
| -rwxr-xr-x | share/extensions/hpgl_output.py | 1 | ||||
| -rw-r--r-- | share/extensions/plotter.inx | 22 | ||||
| -rw-r--r-- | share/extensions/plotter.py | 10 | ||||
| -rw-r--r-- | src/factory.h | 7 | ||||
| -rw-r--r-- | src/libnrtype/FontFactory.cpp | 4 | ||||
| -rw-r--r-- | src/libnrtype/FontInstance.cpp | 40 | ||||
| -rw-r--r-- | src/libnrtype/TextWrapper.cpp | 2 | ||||
| -rw-r--r-- | src/libnrtype/font-instance.h | 2 | ||||
| -rw-r--r-- | src/livarot/AVL.cpp | 652 | ||||
| -rw-r--r-- | src/livarot/AVL.h | 6 | ||||
| -rw-r--r-- | src/livarot/PathCutting.cpp | 12 | ||||
| -rw-r--r-- | src/livarot/ShapeMisc.cpp | 12 | ||||
| -rw-r--r-- | src/livarot/sweep-event.cpp | 32 | ||||
| -rw-r--r-- | src/livarot/sweep-tree.cpp | 16 | ||||
| -rw-r--r-- | src/sp-item-transform.cpp | 10 | ||||
| -rw-r--r-- | src/splivarot.cpp | 10 | ||||
| -rw-r--r-- | src/ui/tools/connector-tool.cpp | 7 | ||||
| -rw-r--r-- | src/ui/tools/spray-tool.cpp | 56 |
21 files changed, 511 insertions, 464 deletions
diff --git a/share/extensions/hpgl_encoder.py b/share/extensions/hpgl_encoder.py index 98993cd79..2304ce261 100644 --- a/share/extensions/hpgl_encoder.py +++ b/share/extensions/hpgl_encoder.py @@ -61,15 +61,18 @@ class hpglEncoder: "precut":bool "offsetX":float "offsetY":float + "autoAlign":bool "debug":bool ''' - self.doc = effect.document.getroot() self.options = effect.options + self.doc = effect.document.getroot() self.documentUnit = self.doc.xpath('//sodipodi:namedview/@inkscape:document-units', namespaces=inkex.NSS) if self.documentUnit: self.documentUnit = self.documentUnit[0] else: self.documentUnit = 'px' + self.docWidth = self.unitToUserUnit(self.doc.get('width'), True) + self.docHeight = self.unitToUserUnit(self.doc.get('height'), True) self.divergenceX = 'False' self.divergenceY = 'False' self.sizeX = 'False' @@ -93,13 +96,12 @@ class hpglEncoder: self.mirrorY = 1.0 if self.options.debug: self.debugValues = [0, 0, 0, 0, 0, 0, 0, 0] + self.debugValues[0] = self.docWidth + self.debugValues[1] = self.docHeight # process viewBox attribute to correct page scaling - viewBox = self.doc.get('viewBox') self.viewBoxTransformX = 1 self.viewBoxTransformY = 1 - if self.options.debug: - self.debugValues[0] = self.unitToUserUnit(self.doc.get('width'), True) - self.debugValues[1] = self.unitToUserUnit(self.doc.get('height'), True) + viewBox = self.doc.get('viewBox') if viewBox: viewBox = string.split(viewBox, ' ') if viewBox[2] and viewBox[3]: @@ -108,8 +110,8 @@ class hpglEncoder: if self.options.debug: self.debugValues[2] = self.unitToUserUnit(viewBox[0]) self.debugValues[3] = self.unitToUserUnit(viewBox[1]) - self.viewBoxTransformX = self.unitToUserUnit(self.doc.get('width'), True) / self.unitToUserUnit(viewBox[0]) - self.viewBoxTransformY = self.unitToUserUnit(self.doc.get('height'), True) / self.unitToUserUnit(viewBox[1]) + self.viewBoxTransformX = self.docWidth / self.unitToUserUnit(viewBox[0]) + self.viewBoxTransformY = self.docHeight / self.unitToUserUnit(viewBox[1]) def getHpgl(self): # dryRun to find edges @@ -126,12 +128,39 @@ class hpglEncoder: self.debugValues[5] = self.sizeY - self.divergenceY self.debugValues[6] = self.unitToUserUnit(str(self.debugValues[4] / self.scaleX)) self.debugValues[7] = self.unitToUserUnit(str(self.debugValues[5] / self.scaleY)) - if self.options.center: - self.divergenceX += (self.sizeX - self.divergenceX) / 2 - self.divergenceY += (self.sizeY - self.divergenceY) / 2 - elif self.options.useToolOffset: + # move drawing according to various modifiers + if self.options.autoAlign: + if self.options.center: + self.divergenceX += (self.sizeX - self.divergenceX) / 2 + self.divergenceY += (self.sizeY - self.divergenceY) / 2 + else: + self.divergenceX = 0.0 + self.divergenceY = 0.0 + if self.options.center: + if self.options.orientation == '0': + self.offsetX -= (self.docWidth * self.scaleX) / 2 + self.offsetY += (self.docHeight * self.scaleY) / 2 + if self.options.orientation == '90': + self.offsetY += (self.docWidth * self.scaleX) / 2 + self.offsetX += (self.docHeight * self.scaleY) / 2 + if self.options.orientation == '180': + self.offsetX += (self.docWidth * self.scaleX) / 2 + self.offsetY -= (self.docHeight * self.scaleY) / 2 + if self.options.orientation == '270': + self.offsetY -= (self.docWidth * self.scaleX) / 2 + self.offsetX -= (self.docHeight * self.scaleY) / 2 + else: + if self.options.orientation == '0': + self.offsetY += self.docHeight * self.scaleY + if self.options.orientation == '90': + self.offsetY += self.docWidth * self.scaleX + self.offsetX += self.docHeight * self.scaleY + if self.options.orientation == '180': + self.offsetX += self.docWidth * self.scaleX + if not self.options.center and self.options.useToolOffset: self.offsetX += self.toolOffset self.offsetY += self.toolOffset + # initialize transformation matrix and cache groupmat = [[self.mirrorX * self.scaleX * self.viewBoxTransformX, 0.0, - self.divergenceX + self.offsetX], [0.0, self.mirrorY * self.scaleY * self.viewBoxTransformY, - self.divergenceY + self.offsetY]] groupmat = simpletransform.composeTransform(groupmat, simpletransform.parseTransform('rotate(' + self.options.orientation + ')')) diff --git a/share/extensions/hpgl_input.inx b/share/extensions/hpgl_input.inx index aba7a9308..f40fd4ec0 100644 --- a/share/extensions/hpgl_input.inx +++ b/share/extensions/hpgl_input.inx @@ -7,8 +7,8 @@ <dependency type="executable" location="extensions">inkex.py</dependency> <_param name="introduction" type="description">Please note that you can only open HPGL files written by Inkscape, to open other HPGL files please change their file extension to .plt, make sure you have UniConverter installed and open them again.</_param> <param name="space" type="description"> </param> - <param name="resolutionX" type="float" min="1.0" max="4096.0" precision="1" _gui-text="Resolution X (dpi)" _gui-description="The amount of steps in one inch on the X axis. (Default: 1016.0)">1016.0</param> - <param name="resolutionY" type="float" min="1.0" max="4096.0" precision="1" _gui-text="Resolution Y (dpi)" _gui-description="The amount of steps in one inch on the Y axis. (Default: 1016.0)">1016.0</param> + <param name="resolutionX" type="float" min="1.0" max="4096.0" precision="1" _gui-text="Resolution X (dpi)" _gui-description="The amount of steps the plotter moves if it moves for 1 inch on the X axis. (Default: 1016.0)">1016.0</param> + <param name="resolutionY" type="float" min="1.0" max="4096.0" precision="1" _gui-text="Resolution Y (dpi)" _gui-description="The amount of steps the plotter moves if it moves for 1 inch on the Y axis. (Default: 1016.0)">1016.0</param> <param name="showMovements" type="boolean" _gui-text="Show movements between paths" _gui-description="Check this to show movements between paths. (Default: Unchecked)">false</param> <input> <extension>.hpgl</extension> diff --git a/share/extensions/hpgl_output.inx b/share/extensions/hpgl_output.inx index a8ce7c7e0..bb0809386 100644 --- a/share/extensions/hpgl_output.inx +++ b/share/extensions/hpgl_output.inx @@ -6,15 +6,15 @@ <dependency type="executable" location="extensions">hpgl_output.py</dependency> <dependency type="executable" location="extensions">hpgl_encoder.py</dependency> <dependency type="executable" location="extensions">inkex.py</dependency> - <_param name="introduction" type="description">Please make sure that all objects you want to save are converted to paths. The drawing will be automatically aligned to the zero point. Please use the plotter extension (Extensions menu) to plot directly on a plotter.</_param> + <_param name="introduction" type="description">Please make sure that all objects you want to save are converted to paths. Please use the plotter extension (Extensions menu) to plot directly over a serial connection.</_param> <param name="tab" type="notebook"> <page name="plotter" _gui-text="Plotter Settings"> - <param name="resolutionX" type="float" min="1.0" max="4096.0" precision="1" _gui-text="Resolution X (dpi)" _gui-description="The amount of steps the cutter moves if it moves for 1 inch on the X axis. (Default: 1016.0)">1016.0</param> - <param name="resolutionY" type="float" min="1.0" max="4096.0" precision="1" _gui-text="Resolution Y (dpi)" _gui-description="The amount of steps the cutter moves if it moves for 1 inch on the Y axis. (Default: 1016.0)">1016.0</param> + <param name="resolutionX" type="float" min="1.0" max="4096.0" precision="1" _gui-text="Resolution X (dpi)" _gui-description="The amount of steps the plotter moves if it moves for 1 inch on the X axis. (Default: 1016.0)">1016.0</param> + <param name="resolutionY" type="float" min="1.0" max="4096.0" precision="1" _gui-text="Resolution Y (dpi)" _gui-description="The amount of steps the plotter moves if it moves for 1 inch on the Y axis. (Default: 1016.0)">1016.0</param> <param name="pen" type="int" min="0" max="99" _gui-text="Pen number" _gui-description="The number of the pen (tool) to use. (Standard: '1')">1</param> <param name="force" type="int" min="0" max="1000" _gui-text="Pen force (g)" _gui-description="The amount of force pushing down the pen in grams, set to 0 to omit command. Most plotters ignore this command. (Default: 0)">0</param> - <param name="speed" type="int" min="0" max="10000" _gui-text="Pen speed (cm/s or mm/s)" _gui-description="The speed the pen will move with in centimeters or millimeters per second (dependent on your plotter model), set to 0 to omit command. Most plotters ignore this command. (Default: 0)">0</param> - <param name="orientation" type="optiongroup" appearance="minimal" _gui-text="Rotation (Clockwise)" _gui-description="Rotation of the plot. (Default: 0°)"> + <param name="speed" type="int" min="0" max="10000" _gui-text="Pen speed (cm/s or mm/s)" _gui-description="The speed the pen will move with in centimeters or millimeters per second (depending on your plotter model), set to 0 to omit command. Most plotters ignore this command. (Default: 0)">0</param> + <param name="orientation" type="optiongroup" appearance="minimal" _gui-text="Rotation (Clockwise)" _gui-description="Rotation of the drawing. (Default: 0°)"> <option value="0">0°</option> <option value="90">90°</option> <option value="180">180°</option> @@ -30,14 +30,13 @@ <param name="space" type="description"> </param> <param name="useToolOffset" type="boolean" _gui-text="Use tool offset correction" _gui-description="Check this to use the tool offset correction, if not checked the 'Tool offset' and 'Precut' parameters are unused. (Default: Checked)">true</param> <param name="toolOffset" type="float" min="0.0" max="20.0" precision="2" _gui-text="Tool offset (mm)" _gui-description="The offset from the tool tip to the tool axis in mm. (Default: 0.25)">0.25</param> - <param name="precut" type="boolean" _gui-text="Use precut" _gui-description="Check this to plot a small line before the real plot to align the tool orientation for the first real plot. (Default: Checked)">true</param> - <param name="space" type="description"> </param> - <_param name="offsetNote" type="description">Please note that using the tool offset correction will move your plot away from the zero point by one tool offset length.</_param> + <param name="precut" type="boolean" _gui-text="Use precut" _gui-description="Check this to cut a small line before the real drawing starts to correctly align the tool orientation. (Default: Checked)">true</param> </page> <page name="misc" _gui-text="Miscellaneous"> <param name="flat" type="float" min="0.1" max="10.0" precision="1" _gui-text="Curve flatness" _gui-description="Curves are divided into lines, this number controls how fine the curves will be reproduced, the smaller the finer. (Default: '1.2')">1.2</param> - <param name="offsetX" type="float" min="-10000.0" max="10000.0" precision="2" _gui-text="X offset (mm)" _gui-description="The offset to move your plot away from the zero point on the X axis in mm. (Default: '0.00')">0.00</param> - <param name="offsetY" type="float" min="-10000.0" max="10000.0" precision="2" _gui-text="Y offset (mm)" _gui-description="The offset to move your plot away from the zero point on the Y axis in mm. (Default: '0.00')">0.00</param> + <param name="offsetX" type="float" min="-10000.0" max="10000.0" precision="2" _gui-text="X offset (mm)" _gui-description="Shifts your drawing on the X axis in mm. (Default: '0.00')">0.00</param> + <param name="offsetY" type="float" min="-10000.0" max="10000.0" precision="2" _gui-text="Y offset (mm)" _gui-description="Shifts your drawing on the Y axis in mm. (Default: '0.00')">0.00</param> + <param name="autoAlign" type="boolean" _gui-text="Auto align" _gui-description="Check this to auto align the drawing to the zero point (Plus the tool offset if used). If unchecked you have to make sure that all parts of your drawing are within the document border! (Default: Checked)">true</param> </page> </param> <_param name="settingsHelp" type="description">All these settings depend on the plotter you use, for more information please consult the manual or homepage for your plotter.</_param> diff --git a/share/extensions/hpgl_output.py b/share/extensions/hpgl_output.py index d6f6b8eec..02157eb95 100755 --- a/share/extensions/hpgl_output.py +++ b/share/extensions/hpgl_output.py @@ -49,6 +49,7 @@ class MyEffect(inkex.Effect): self.OptionParser.add_option('--precut', action='store', type='inkbool', dest='precut', default='TRUE', help='Use precut') self.OptionParser.add_option('--offsetX', action='store', type='float', dest='offsetX', default=0.0, help='X offset (mm)') self.OptionParser.add_option('--offsetY', action='store', type='float', dest='offsetY', default=0.0, help='Y offset (mm)') + self.OptionParser.add_option('--autoAlign', action='store', type='inkbool', dest='autoAlign', default='TRUE', help='Auto align') def effect(self): self.options.debug = False diff --git a/share/extensions/plotter.inx b/share/extensions/plotter.inx index 673922d2e..e30d61418 100644 --- a/share/extensions/plotter.inx +++ b/share/extensions/plotter.inx @@ -6,7 +6,7 @@ <dependency type="executable" location="extensions">hpgl_decoder.py</dependency> <dependency type="executable" location="extensions">hpgl_encoder.py</dependency> <dependency type="executable" location="extensions">inkex.py</dependency> - <_param name="introduction" type="description">Please make sure that all objects you want to plot are converted to paths. The plot will automatically be aligned to the zero point.</_param> + <_param name="introduction" type="description">Please make sure that all objects you want to plot are converted to paths.</_param> <param name="tab" type="notebook"> <page name="misc" _gui-text="Connection"> <param name="serialPort" type="string" _gui-text="Serial port" _gui-description="The port of your serial connection, on Windows something like 'COM1', on Linux something like: '/dev/ttyUSB0'. (Default: COM1)">COM1</param> @@ -39,17 +39,17 @@ <option value="ZING">KNK Zing (HPGL variant)</option> </param> <param name="space" type="description"> </param> - <_param name="freezeHelp" type="description">Using wrong settings can under certain circumstances cause Inkscape to freeze. Always save your work before plotting.</_param> + <_param name="freezeHelp" type="description">Using wrong settings can under certain circumstances cause Inkscape to freeze. Always save your work before plotting!</_param> <_param name="serialHelp" type="description">This can be a physical serial connection or a USB-to-Serial bridge. Ask your plotter manufacturer for drivers if needed.</_param> <_param name="parallelHelp" type="description">Parallel (LPT) connections are not supported.</_param> </page> <page name="plotter" _gui-text="Plotter Settings"> - <param name="resolutionX" type="float" min="1.0" max="4096.0" precision="1" _gui-text="Resolution X (dpi)" _gui-description="The amount of steps the cutter moves if it moves for 1 inch on the X axis. (Default: 1016.0)">1016.0</param> - <param name="resolutionY" type="float" min="1.0" max="4096.0" precision="1" _gui-text="Resolution Y (dpi)" _gui-description="The amount of steps the cutter moves if it moves for 1 inch on the Y axis. (Default: 1016.0)">1016.0</param> + <param name="resolutionX" type="float" min="1.0" max="4096.0" precision="1" _gui-text="Resolution X (dpi)" _gui-description="The amount of steps the plotter moves if it moves for 1 inch on the X axis. (Default: 1016.0)">1016.0</param> + <param name="resolutionY" type="float" min="1.0" max="4096.0" precision="1" _gui-text="Resolution Y (dpi)" _gui-description="The amount of steps the plotter moves if it moves for 1 inch on the Y axis. (Default: 1016.0)">1016.0</param> <param name="pen" type="int" min="0" max="99" _gui-text="Pen number" _gui-description="The number of the pen (tool) to use. (Standard: '1')">1</param> <param name="force" type="int" min="0" max="1000" _gui-text="Pen force (g)" _gui-description="The amount of force pushing down the pen in grams, set to 0 to omit command. Most plotters ignore this command. (Default: 0)">0</param> - <param name="speed" type="int" min="0" max="10000" _gui-text="Pen speed (cm/s or mm/s)" _gui-description="The speed the pen will move with in centimeters or millimeters per second (dependent on your plotter model), set to 0 to omit command. Most plotters ignore this command. (Default: 0)">0</param> - <param name="orientation" type="optiongroup" appearance="minimal" _gui-text="Rotation (Clockwise)" _gui-description="Rotation of the plot. (Default: 0°)"> + <param name="speed" type="int" min="0" max="10000" _gui-text="Pen speed (cm/s or mm/s)" _gui-description="The speed the pen will move with in centimeters or millimeters per second (depending on your plotter model), set to 0 to omit command. Most plotters ignore this command. (Default: 0)">0</param> + <param name="orientation" type="optiongroup" appearance="minimal" _gui-text="Rotation (Clockwise)" _gui-description="Rotation of the drawing. (Default: 0°)"> <option value="0">0°</option> <option value="90">90°</option> <option value="180">180°</option> @@ -65,14 +65,14 @@ <param name="space" type="description"> </param> <param name="useToolOffset" type="boolean" _gui-text="Use tool offset correction" _gui-description="Check this to use the tool offset correction, if not checked the 'Tool offset' and 'Precut' parameters are unused. (Default: Checked)">true</param> <param name="toolOffset" type="float" min="0.0" max="20.0" precision="2" _gui-text="Tool offset (mm)" _gui-description="The offset from the tool tip to the tool axis in mm. (Default: 0.25)">0.25</param> - <param name="precut" type="boolean" _gui-text="Use precut" _gui-description="Check this to plot a small line before the real plot to align the tool orientation for the first real plot. (Default: Checked)">true</param> - <param name="space" type="description"> </param> - <_param name="offsetNote" type="description">Please note that using the tool offset correction will move your plot away from the zero point by one tool offset length.</_param> + <param name="precut" type="boolean" _gui-text="Use precut" _gui-description="Check this to cut a small line before the real drawing starts to correctly align the tool orientation. (Default: Checked)">true</param> </page> <page name="misc" _gui-text="Miscellaneous"> <param name="flat" type="float" min="0.1" max="10.0" precision="1" _gui-text="Curve flatness" _gui-description="Curves are divided into lines, this number controls how fine the curves will be reproduced, the smaller the finer. (Default: '1.2')">1.2</param> - <param name="offsetX" type="float" min="-10000.0" max="10000.0" precision="2" _gui-text="X offset (mm)" _gui-description="The offset to move your plot away from the zero point on the X axis in mm. (Default: '0.00')">0.00</param> - <param name="offsetY" type="float" min="-10000.0" max="10000.0" precision="2" _gui-text="Y offset (mm)" _gui-description="The offset to move your plot away from the zero point on the Y axis in mm. (Default: '0.00')">0.00</param> + <param name="offsetX" type="float" min="-10000.0" max="10000.0" precision="2" _gui-text="X offset (mm)" _gui-description="Shifts your drawing on the X axis in mm. (Default: '0.00')">0.00</param> + <param name="offsetY" type="float" min="-10000.0" max="10000.0" precision="2" _gui-text="Y offset (mm)" _gui-description="Shifts your drawing on the Y axis in mm. (Default: '0.00')">0.00</param> + <param name="autoAlign" type="boolean" _gui-text="Auto align" _gui-description="Check this to auto align the drawing to the zero point (Plus the tool offset if used). If unchecked you have to make sure that all parts of your drawing are within the document border! (Default: Checked)">true</param> + <param name="space" type="description"> </param> <param name="debug" type="boolean" _gui-text="Show debug information" _gui-description="Check this to get verbose information about the plot without actually sending something to the plotter (A.k.a. data dump). (Default: Unchecked)">false</param> </page> </param> diff --git a/share/extensions/plotter.py b/share/extensions/plotter.py index 394f83786..84027b132 100644 --- a/share/extensions/plotter.py +++ b/share/extensions/plotter.py @@ -36,6 +36,10 @@ class MyEffect(inkex.Effect): def __init__(self): inkex.Effect.__init__(self) self.OptionParser.add_option('--tab', action='store', type='string', dest='tab') + self.OptionParser.add_option('--serialPort', action='store', type='string', dest='serialPort', default='COM1', help='Serial port') + self.OptionParser.add_option('--serialBaudRate', action='store', type='string', dest='serialBaudRate', default='9600', help='Serial Baud rate') + self.OptionParser.add_option('--flowControl', action='store', type='string', dest='flowControl', default='0', help='Flow control') + self.OptionParser.add_option('--commandLanguage', action='store', type='string', dest='commandLanguage', default='hpgl', help='Command Language') self.OptionParser.add_option('--resolutionX', action='store', type='float', dest='resolutionX', default=1016.0, help='Resolution X (dpi)') self.OptionParser.add_option('--resolutionY', action='store', type='float', dest='resolutionY', default=1016.0, help='Resolution Y (dpi)') self.OptionParser.add_option('--pen', action='store', type='int', dest='pen', default=1, help='Pen number') @@ -53,10 +57,7 @@ class MyEffect(inkex.Effect): self.OptionParser.add_option('--precut', action='store', type='inkbool', dest='precut', default='TRUE', help='Use precut') self.OptionParser.add_option('--offsetX', action='store', type='float', dest='offsetX', default=0.0, help='X offset (mm)') self.OptionParser.add_option('--offsetY', action='store', type='float', dest='offsetY', default=0.0, help='Y offset (mm)') - self.OptionParser.add_option('--serialPort', action='store', type='string', dest='serialPort', default='COM1', help='Serial port') - self.OptionParser.add_option('--serialBaudRate', action='store', type='string', dest='serialBaudRate', default='9600', help='Serial Baud rate') - self.OptionParser.add_option('--flowControl', action='store', type='string', dest='flowControl', default='0', help='Flow control') - self.OptionParser.add_option('--commandLanguage', action='store', type='string', dest='commandLanguage', default='hpgl', help='Command Language') + self.OptionParser.add_option('--autoAlign', action='store', type='inkbool', dest='autoAlign', default='TRUE', help='Auto align') self.OptionParser.add_option('--debug', action='store', type='inkbool', dest='debug', default='FALSE', help='Show debug information') def effect(self): @@ -181,6 +182,7 @@ class MyEffect(inkex.Effect): inkex.errormsg(' Curve flatness: ' + str(self.options.flat)) inkex.errormsg(' X offset (mm): ' + str(self.options.offsetX)) inkex.errormsg(' Y offset (mm): ' + str(self.options.offsetY)) + inkex.errormsg(' Auto align: ' + str(self.options.autoAlign)) inkex.errormsg(' Show debug information: ' + str(self.options.debug)) inkex.errormsg("\nDocument properties:\n") version = self.document.getroot().xpath('//@inkscape:version', namespaces=inkex.NSS) diff --git a/src/factory.h b/src/factory.h index d7f4cb2b9..7e466f95a 100644 --- a/src/factory.h +++ b/src/factory.h @@ -64,7 +64,12 @@ public: if (it == this->_object_map.end()) { //throw FactoryExceptions::TypeNotRegistered(id); - g_warning("unknown type: %s", id.c_str()); + if (!(id.empty() // comments, usually + or id == "rdf:RDF" // no SP node yet + or id == "inkscape:clipboard" // SP node not necessary + or id == "inkscape:_templateinfo")) { + g_warning("unknown type: %s", id.c_str()); + } return NULL; } diff --git a/src/libnrtype/FontFactory.cpp b/src/libnrtype/FontFactory.cpp index 9fc553efd..f05b75aaa 100644 --- a/src/libnrtype/FontFactory.cpp +++ b/src/libnrtype/FontFactory.cpp @@ -973,12 +973,12 @@ font_instance *font_factory::Face(PangoFontDescription *descr, bool canFail) // point) whether loadedFaces[that_descr] is free or not (and overwriting // an entry will bring deallocation problems) res->descr = pango_font_description_copy(descr); - res->daddy = this; + res->parent = this; res->InstallFace(nFace); if ( res->pFont == NULL ) { // failed to install face -> bitmap font // printf("face failed\n"); - res->daddy = NULL; + res->parent = NULL; delete res; res = NULL; if ( canFail ) { diff --git a/src/libnrtype/FontInstance.cpp b/src/libnrtype/FontInstance.cpp index 434f3ee47..a5b782344 100644 --- a/src/libnrtype/FontInstance.cpp +++ b/src/libnrtype/FontInstance.cpp @@ -174,7 +174,7 @@ font_instance::font_instance(void) : pFont(0), descr(0), refCount(0), - daddy(0), + parent(0), nbGlyph(0), maxGlyph(0), glyphs(0), @@ -185,9 +185,9 @@ font_instance::font_instance(void) : font_instance::~font_instance(void) { - if ( daddy ) { - daddy->UnrefFace(this); - daddy = 0; + if ( parent ) { + parent->UnrefFace(this); + parent = 0; } //printf("font instance death\n"); @@ -389,13 +389,13 @@ void font_instance::InitTheFace() if ( !theFace ) { LOGFONT *lf=pango_win32_font_logfont(pFont); g_assert(lf != NULL); - theFace=pango_win32_font_cache_load(daddy->pangoFontCache,lf); + theFace=pango_win32_font_cache_load(parent->pangoFontCache,lf); g_free(lf); } XFORM identity = {1.0, 0.0, 0.0, 1.0, 0.0, 0.0}; - SetWorldTransform(daddy->hScreenDC, &identity); - SetGraphicsMode(daddy->hScreenDC, GM_COMPATIBLE); - SelectObject(daddy->hScreenDC,theFace); + SetWorldTransform(parent->hScreenDC, &identity); + SetGraphicsMode(parent->hScreenDC, GM_COMPATIBLE); + SelectObject(parent->hScreenDC,theFace); #else theFace=pango_fc_font_lock_face(PANGO_FC_FONT(pFont)); if ( theFace ) { @@ -408,8 +408,8 @@ void font_instance::InitTheFace() void font_instance::FreeTheFace() { #ifdef USE_PANGO_WIN32 - SelectObject(daddy->hScreenDC,GetStockObject(SYSTEM_FONT)); - pango_win32_font_cache_unload(daddy->pangoFontCache,theFace); + SelectObject(parent->hScreenDC,GetStockObject(SYSTEM_FONT)); + pango_win32_font_cache_unload(parent->pangoFontCache,theFace); #else pango_fc_font_unlock_face(PANGO_FC_FONT(pFont)); #endif @@ -443,7 +443,7 @@ bool font_instance::IsOutlineFont(void) InitTheFace(); #ifdef USE_PANGO_WIN32 TEXTMETRIC tm; - return GetTextMetrics(daddy->hScreenDC,&tm) && tm.tmPitchAndFamily&(TMPF_TRUETYPE|TMPF_DEVICE); + return GetTextMetrics(parent->hScreenDC,&tm) && tm.tmPitchAndFamily&(TMPF_TRUETYPE|TMPF_DEVICE); #else return FT_IS_SCALABLE(theFace); #endif @@ -513,10 +513,10 @@ void font_instance::LoadGlyph(int glyph_id) MAT2 identity = {{0,1},{0,0},{0,0},{0,1}}; OUTLINETEXTMETRIC otm; - GetOutlineTextMetrics(daddy->hScreenDC, sizeof(otm), &otm); + GetOutlineTextMetrics(parent->hScreenDC, sizeof(otm), &otm); GLYPHMETRICS metrics; - DWORD bufferSize=GetGlyphOutline (daddy->hScreenDC, glyph_id, GGO_GLYPH_INDEX | GGO_NATIVE | GGO_UNHINTED, &metrics, 0, NULL, &identity); - double scale=1.0/daddy->fontSize; + DWORD bufferSize=GetGlyphOutline (parent->hScreenDC, glyph_id, GGO_GLYPH_INDEX | GGO_NATIVE | GGO_UNHINTED, &metrics, 0, NULL, &identity); + double scale=1.0/parent->fontSize; n_g.h_advance=metrics.gmCellIncX*scale; n_g.v_advance=otm.otmTextMetrics.tmHeight*scale; n_g.h_width=metrics.gmBlackBoxX*scale; @@ -528,7 +528,7 @@ void font_instance::LoadGlyph(int glyph_id) doAdd=true; } else { char *buffer = new char[bufferSize]; - if ( GetGlyphOutline (daddy->hScreenDC, glyph_id, GGO_GLYPH_INDEX | GGO_NATIVE | GGO_UNHINTED, &metrics, bufferSize, buffer, &identity) <= 0 ) { + if ( GetGlyphOutline (parent->hScreenDC, glyph_id, GGO_GLYPH_INDEX | GGO_NATIVE | GGO_UNHINTED, &metrics, bufferSize, buffer, &identity) <= 0 ) { // shit happened } else { // Platform SDK is rubbish, read KB87115 instead @@ -655,10 +655,10 @@ bool font_instance::FontMetrics(double &ascent,double &descent,double &leading) } #ifdef USE_PANGO_WIN32 OUTLINETEXTMETRIC otm; - if ( !GetOutlineTextMetrics(daddy->hScreenDC,sizeof(otm),&otm) ) { + if ( !GetOutlineTextMetrics(parent->hScreenDC,sizeof(otm),&otm) ) { return false; } - double scale=1.0/daddy->fontSize; + double scale=1.0/parent->fontSize; ascent=fabs(otm.otmAscent*scale); descent=fabs(otm.otmDescent*scale); leading=fabs(otm.otmLineGap*scale); @@ -688,10 +688,10 @@ bool font_instance::FontDecoration( } #ifdef USE_PANGO_WIN32 OUTLINETEXTMETRIC otm; - if ( !GetOutlineTextMetrics(daddy->hScreenDC,sizeof(otm),&otm) ) { + if ( !GetOutlineTextMetrics(parent->hScreenDC,sizeof(otm),&otm) ) { return false; } - double scale=1.0/daddy->fontSize; + double scale=1.0/parent->fontSize; underline_position = fabs(otm.otmUnderscorePosition *scale); underline_thickness = fabs(otm.otmUnderscoreSize *scale); linethrough_position = fabs(otm.otmStrikeoutPosition *scale); @@ -725,7 +725,7 @@ bool font_instance::FontSlope(double &run, double &rise) #ifdef USE_PANGO_WIN32 OUTLINETEXTMETRIC otm; - if ( !GetOutlineTextMetrics(daddy->hScreenDC,sizeof(otm),&otm) ) return false; + if ( !GetOutlineTextMetrics(parent->hScreenDC,sizeof(otm),&otm) ) return false; run=otm.otmsCharSlopeRun; rise=otm.otmsCharSlopeRise; #else diff --git a/src/libnrtype/TextWrapper.cpp b/src/libnrtype/TextWrapper.cpp index 32877e275..380e9ba3f 100644 --- a/src/libnrtype/TextWrapper.cpp +++ b/src/libnrtype/TextWrapper.cpp @@ -327,7 +327,7 @@ void text_wrapper::DoLayout(void) for (int i = 0; i < glyph_length; i++) { glyph_text[i].uni_st = uni32_codepoint[glyph_text[i].uni_st]; glyph_text[i].uni_en = uni32_codepoint[glyph_text[i].uni_en]; - glyph_text[i].x /= 512; // why is this not default_font->daddy->fontsize? + glyph_text[i].x /= 512; // why is this not default_font->parent->fontsize? glyph_text[i].y /= 512; } if ( glyph_length > 0 ) { diff --git a/src/libnrtype/font-instance.h b/src/libnrtype/font-instance.h index ef10a04d0..75106617b 100644 --- a/src/libnrtype/font-instance.h +++ b/src/libnrtype/font-instance.h @@ -29,7 +29,7 @@ public: // refcount int refCount; // font_factory owning this font_instance - font_factory* daddy; + font_factory* parent; // common glyph definitions for all the rasterfonts std::map<int, int> id_to_no; diff --git a/src/livarot/AVL.cpp b/src/livarot/AVL.cpp index e8ece7f8c..17af5ee66 100644 --- a/src/livarot/AVL.cpp +++ b/src/livarot/AVL.cpp @@ -28,10 +28,10 @@ void AVLTree::MakeNew() for (int i = 0; i < 2; i++) { elem[i] = NULL; - son[i] = NULL; + child[i] = NULL; } - dad = NULL; + parent = NULL; balance = 0; } @@ -47,32 +47,32 @@ void AVLTree::MakeDelete() AVLTree *AVLTree::Leftmost() { - return leafFromDad(NULL, LEFT); + return leafFromParent(NULL, LEFT); } AVLTree *AVLTree::leaf(AVLTree *from, Side s) { - if (from == son[1 - s]) { - if (son[s]) { - return son[s]->leafFromDad(this, s); + if (from == child[1 - s]) { + if (child[s]) { + return child[s]->leafFromParent(this, s); } - else if (dad) { - return dad->leaf(this, s); + else if (parent) { + return parent->leaf(this, s); } } - else if (from == son[s]) { - if (dad) { - return dad->leaf(this, s); + else if (from == child[s]) { + if (parent) { + return parent->leaf(this, s); } } return NULL; } -AVLTree *AVLTree::leafFromDad(AVLTree */*from*/, Side s) +AVLTree *AVLTree::leafFromParent(AVLTree */*from*/, Side s) { - if (son[s]) { - return son[s]->leafFromDad(this, s); + if (child[s]) { + return child[s]->leafFromParent(this, s); } return this; @@ -83,60 +83,60 @@ AVLTree::RestoreBalances (AVLTree * from, AVLTree * &racine) { if (from == NULL) { - if (dad) - return dad->RestoreBalances (this, racine); + if (parent) + return parent->RestoreBalances (this, racine); } else { if (balance == 0) { - if (from == son[LEFT]) + if (from == child[LEFT]) balance = 1; - if (from == son[RIGHT]) + if (from == child[RIGHT]) balance = -1; - if (dad) - return dad->RestoreBalances (this, racine); + if (parent) + return parent->RestoreBalances (this, racine); return avl_no_err; } else if (balance > 0) { - if (from == son[RIGHT]) + if (from == child[RIGHT]) { balance = 0; return avl_no_err; } - if (son[LEFT] == NULL) + if (child[LEFT] == NULL) { // cout << "mierda\n"; return avl_bal_err; } AVLTree *a = this; - AVLTree *b = son[LEFT]; - AVLTree *e = son[RIGHT]; - AVLTree *c = son[LEFT]->son[LEFT]; - AVLTree *d = son[LEFT]->son[RIGHT]; - if (son[LEFT]->balance > 0) + AVLTree *b = child[LEFT]; + AVLTree *e = child[RIGHT]; + AVLTree *c = child[LEFT]->child[LEFT]; + AVLTree *d = child[LEFT]->child[RIGHT]; + if (child[LEFT]->balance > 0) { - AVLTree *r = dad; + AVLTree *r = parent; - a->dad = b; - b->son[RIGHT] = a; - a->son[RIGHT] = e; + a->parent = b; + b->child[RIGHT] = a; + a->child[RIGHT] = e; if (e) - e->dad = a; - a->son[LEFT] = d; + e->parent = a; + a->child[LEFT] = d; if (d) - d->dad = a; - b->son[LEFT] = c; + d->parent = a; + b->child[LEFT] = c; if (c) - c->dad = b; - b->dad = r; + c->parent = b; + b->parent = r; if (r) { - if (r->son[LEFT] == a) - r->son[LEFT] = b; - if (r->son[RIGHT] == a) - r->son[RIGHT] = b; + if (r->child[LEFT] == a) + r->child[LEFT] = b; + if (r->child[RIGHT] == a) + r->child[RIGHT] = b; } if (racine == a) racine = b; @@ -147,39 +147,39 @@ AVLTree::RestoreBalances (AVLTree * from, AVLTree * &racine) } else { - if (son[LEFT]->son[RIGHT] == NULL) + if (child[LEFT]->child[RIGHT] == NULL) { // cout << "mierda\n"; return avl_bal_err; } - AVLTree *f = son[LEFT]->son[RIGHT]->son[LEFT]; - AVLTree *g = son[LEFT]->son[RIGHT]->son[RIGHT]; - AVLTree *r = dad; - - a->dad = d; - d->son[RIGHT] = a; - b->dad = d; - d->son[LEFT] = b; - a->son[LEFT] = g; + AVLTree *f = child[LEFT]->child[RIGHT]->child[LEFT]; + AVLTree *g = child[LEFT]->child[RIGHT]->child[RIGHT]; + AVLTree *r = parent; + + a->parent = d; + d->child[RIGHT] = a; + b->parent = d; + d->child[LEFT] = b; + a->child[LEFT] = g; if (g) - g->dad = a; - a->son[RIGHT] = e; + g->parent = a; + a->child[RIGHT] = e; if (e) - e->dad = a; - b->son[LEFT] = c; + e->parent = a; + b->child[LEFT] = c; if (c) - c->dad = b; - b->son[RIGHT] = f; + c->parent = b; + b->child[RIGHT] = f; if (f) - f->dad = b; + f->parent = b; - d->dad = r; + d->parent = r; if (r) { - if (r->son[LEFT] == a) - r->son[LEFT] = d; - if (r->son[RIGHT] == a) - r->son[RIGHT] = d; + if (r->child[LEFT] == a) + r->child[LEFT] = d; + if (r->child[RIGHT] == a) + r->child[RIGHT] = d; } if (racine == a) racine = d; @@ -206,43 +206,43 @@ AVLTree::RestoreBalances (AVLTree * from, AVLTree * &racine) } else if (balance < 0) { - if (from == son[LEFT]) + if (from == child[LEFT]) { balance = 0; return avl_no_err; } - if (son[RIGHT] == NULL) + if (child[RIGHT] == NULL) { // cout << "mierda\n"; return avl_bal_err; } AVLTree *a = this; - AVLTree *b = son[RIGHT]; - AVLTree *e = son[LEFT]; - AVLTree *c = son[RIGHT]->son[RIGHT]; - AVLTree *d = son[RIGHT]->son[LEFT]; - AVLTree *r = dad; - if (son[RIGHT]->balance < 0) + AVLTree *b = child[RIGHT]; + AVLTree *e = child[LEFT]; + AVLTree *c = child[RIGHT]->child[RIGHT]; + AVLTree *d = child[RIGHT]->child[LEFT]; + AVLTree *r = parent; + if (child[RIGHT]->balance < 0) { - a->dad = b; - b->son[LEFT] = a; - a->son[LEFT] = e; + a->parent = b; + b->child[LEFT] = a; + a->child[LEFT] = e; if (e) - e->dad = a; - a->son[RIGHT] = d; + e->parent = a; + a->child[RIGHT] = d; if (d) - d->dad = a; - b->son[RIGHT] = c; + d->parent = a; + b->child[RIGHT] = c; if (c) - c->dad = b; - b->dad = r; + c->parent = b; + b->parent = r; if (r) { - if (r->son[LEFT] == a) - r->son[LEFT] = b; - if (r->son[RIGHT] == a) - r->son[RIGHT] = b; + if (r->child[LEFT] == a) + r->child[LEFT] = b; + if (r->child[RIGHT] == a) + r->child[RIGHT] = b; } if (racine == a) racine = b; @@ -252,38 +252,38 @@ AVLTree::RestoreBalances (AVLTree * from, AVLTree * &racine) } else { - if (son[RIGHT]->son[LEFT] == NULL) + if (child[RIGHT]->child[LEFT] == NULL) { // cout << "mierda\n"; return avl_bal_err; } - AVLTree *f = son[RIGHT]->son[LEFT]->son[RIGHT]; - AVLTree *g = son[RIGHT]->son[LEFT]->son[LEFT]; - - a->dad = d; - d->son[LEFT] = a; - b->dad = d; - d->son[RIGHT] = b; - a->son[RIGHT] = g; + AVLTree *f = child[RIGHT]->child[LEFT]->child[RIGHT]; + AVLTree *g = child[RIGHT]->child[LEFT]->child[LEFT]; + + a->parent = d; + d->child[LEFT] = a; + b->parent = d; + d->child[RIGHT] = b; + a->child[RIGHT] = g; if (g) - g->dad = a; - a->son[LEFT] = e; + g->parent = a; + a->child[LEFT] = e; if (e) - e->dad = a; - b->son[RIGHT] = c; + e->parent = a; + b->child[RIGHT] = c; if (c) - c->dad = b; - b->son[LEFT] = f; + c->parent = b; + b->child[LEFT] = f; if (f) - f->dad = b; + f->parent = b; - d->dad = r; + d->parent = r; if (r) { - if (r->son[LEFT] == a) - r->son[LEFT] = d; - if (r->son[RIGHT] == a) - r->son[RIGHT] = d; + if (r->child[LEFT] == a) + r->child[LEFT] = d; + if (r->child[RIGHT] == a) + r->child[RIGHT] = d; } if (racine == a) racine = d; @@ -319,12 +319,12 @@ AVLTree::RestoreBalances (int diff, AVLTree * &racine) if (diff < 0) { balance = 0; - if (dad) + if (parent) { - if (this == dad->son[RIGHT]) - return dad->RestoreBalances (1, racine); - if (this == dad->son[LEFT]) - return dad->RestoreBalances (-1, racine); + if (this == parent->child[RIGHT]) + return parent->RestoreBalances (1, racine); + if (this == parent->child[LEFT]) + return parent->RestoreBalances (-1, racine); } return avl_no_err; } @@ -333,38 +333,38 @@ AVLTree::RestoreBalances (int diff, AVLTree * &racine) } else if (diff > 0) { - if (son[LEFT] == NULL) + if (child[LEFT] == NULL) { // cout << "un probleme\n"; return avl_bal_err; } - AVLTree *r = dad; + AVLTree *r = parent; AVLTree *a = this; - AVLTree *b = son[RIGHT]; - AVLTree *e = son[LEFT]; - AVLTree *f = e->son[RIGHT]; - AVLTree *g = e->son[LEFT]; + AVLTree *b = child[RIGHT]; + AVLTree *e = child[LEFT]; + AVLTree *f = e->child[RIGHT]; + AVLTree *g = e->child[LEFT]; if (e->balance > 0) { - e->son[RIGHT] = a; - e->son[LEFT] = g; - a->son[RIGHT] = b; - a->son[LEFT] = f; + e->child[RIGHT] = a; + e->child[LEFT] = g; + a->child[RIGHT] = b; + a->child[LEFT] = f; if (a) - a->dad = e; + a->parent = e; if (g) - g->dad = e; + g->parent = e; if (b) - b->dad = a; + b->parent = a; if (f) - f->dad = a; - e->dad = r; + f->parent = a; + e->parent = r; if (r) { - if (r->son[LEFT] == a) - r->son[LEFT] = e; - if (r->son[RIGHT] == a) - r->son[RIGHT] = e; + if (r->child[LEFT] == a) + r->child[LEFT] = e; + if (r->child[RIGHT] == a) + r->child[RIGHT] = e; } if (racine == this) racine = e; @@ -372,34 +372,34 @@ AVLTree::RestoreBalances (int diff, AVLTree * &racine) a->balance = 0; if (r) { - if (e == r->son[RIGHT]) + if (e == r->child[RIGHT]) return r->RestoreBalances (1, racine); - if (e == r->son[LEFT]) + if (e == r->child[LEFT]) return r->RestoreBalances (-1, racine); } return avl_no_err; } else if (e->balance == 0) { - e->son[RIGHT] = a; - e->son[LEFT] = g; - a->son[RIGHT] = b; - a->son[LEFT] = f; + e->child[RIGHT] = a; + e->child[LEFT] = g; + a->child[RIGHT] = b; + a->child[LEFT] = f; if (a) - a->dad = e; + a->parent = e; if (g) - g->dad = e; + g->parent = e; if (b) - b->dad = a; + b->parent = a; if (f) - f->dad = a; - e->dad = r; + f->parent = a; + e->parent = r; if (r) { - if (r->son[LEFT] == a) - r->son[LEFT] = e; - if (r->son[RIGHT] == a) - r->son[RIGHT] = e; + if (r->child[LEFT] == a) + r->child[LEFT] = e; + if (r->child[RIGHT] == a) + r->child[RIGHT] = e; } if (racine == this) racine = e; @@ -409,39 +409,39 @@ AVLTree::RestoreBalances (int diff, AVLTree * &racine) } else if (e->balance < 0) { - if (son[LEFT]->son[RIGHT] == NULL) + if (child[LEFT]->child[RIGHT] == NULL) { // cout << "un probleme\n"; return avl_bal_err; } - AVLTree *i = son[LEFT]->son[RIGHT]->son[RIGHT]; - AVLTree *j = son[LEFT]->son[RIGHT]->son[LEFT]; - - f->son[RIGHT] = a; - f->son[LEFT] = e; - a->son[RIGHT] = b; - a->son[LEFT] = i; - e->son[RIGHT] = j; - e->son[LEFT] = g; + AVLTree *i = child[LEFT]->child[RIGHT]->child[RIGHT]; + AVLTree *j = child[LEFT]->child[RIGHT]->child[LEFT]; + + f->child[RIGHT] = a; + f->child[LEFT] = e; + a->child[RIGHT] = b; + a->child[LEFT] = i; + e->child[RIGHT] = j; + e->child[LEFT] = g; if (b) - b->dad = a; + b->parent = a; if (i) - i->dad = a; + i->parent = a; if (g) - g->dad = e; + g->parent = e; if (j) - j->dad = e; + j->parent = e; if (a) - a->dad = f; + a->parent = f; if (e) - e->dad = f; - f->dad = r; + e->parent = f; + f->parent = r; if (r) { - if (r->son[LEFT] == a) - r->son[LEFT] = f; - if (r->son[RIGHT] == a) - r->son[RIGHT] = f; + if (r->child[LEFT] == a) + r->child[LEFT] = f; + if (r->child[RIGHT] == a) + r->child[RIGHT] = f; } if (racine == this) racine = f; @@ -464,9 +464,9 @@ AVLTree::RestoreBalances (int diff, AVLTree * &racine) } if (r) { - if (f == r->son[RIGHT]) + if (f == r->child[RIGHT]) return r->RestoreBalances (1, racine); - if (f == r->son[LEFT]) + if (f == r->child[LEFT]) return r->RestoreBalances (-1, racine); } return avl_no_err; @@ -492,38 +492,38 @@ AVLTree::RestoreBalances (int diff, AVLTree * &racine) { if (diff < 0) { - if (son[RIGHT] == NULL) + if (child[RIGHT] == NULL) { // cout << "un probleme\n"; return avl_bal_err; } - AVLTree *r = dad; + AVLTree *r = parent; AVLTree *a = this; - AVLTree *b = son[LEFT]; - AVLTree *e = son[RIGHT]; - AVLTree *f = e->son[LEFT]; - AVLTree *g = e->son[RIGHT]; + AVLTree *b = child[LEFT]; + AVLTree *e = child[RIGHT]; + AVLTree *f = e->child[LEFT]; + AVLTree *g = e->child[RIGHT]; if (e->balance < 0) { - e->son[LEFT] = a; - e->son[RIGHT] = g; - a->son[LEFT] = b; - a->son[RIGHT] = f; + e->child[LEFT] = a; + e->child[RIGHT] = g; + a->child[LEFT] = b; + a->child[RIGHT] = f; if (a) - a->dad = e; + a->parent = e; if (g) - g->dad = e; + g->parent = e; if (b) - b->dad = a; + b->parent = a; if (f) - f->dad = a; - e->dad = r; + f->parent = a; + e->parent = r; if (r) { - if (r->son[LEFT] == a) - r->son[LEFT] = e; - if (r->son[RIGHT] == a) - r->son[RIGHT] = e; + if (r->child[LEFT] == a) + r->child[LEFT] = e; + if (r->child[RIGHT] == a) + r->child[RIGHT] = e; } if (racine == this) racine = e; @@ -531,34 +531,34 @@ AVLTree::RestoreBalances (int diff, AVLTree * &racine) a->balance = 0; if (r) { - if (e == r->son[RIGHT]) + if (e == r->child[RIGHT]) return r->RestoreBalances (1, racine); - if (e == r->son[LEFT]) + if (e == r->child[LEFT]) return r->RestoreBalances (-1, racine); } return avl_no_err; } else if (e->balance == 0) { - e->son[LEFT] = a; - e->son[RIGHT] = g; - a->son[LEFT] = b; - a->son[RIGHT] = f; + e->child[LEFT] = a; + e->child[RIGHT] = g; + a->child[LEFT] = b; + a->child[RIGHT] = f; if (a) - a->dad = e; + a->parent = e; if (g) - g->dad = e; + g->parent = e; if (b) - b->dad = a; + b->parent = a; if (f) - f->dad = a; - e->dad = r; + f->parent = a; + e->parent = r; if (r) { - if (r->son[LEFT] == a) - r->son[LEFT] = e; - if (r->son[RIGHT] == a) - r->son[RIGHT] = e; + if (r->child[LEFT] == a) + r->child[LEFT] = e; + if (r->child[RIGHT] == a) + r->child[RIGHT] = e; } if (racine == this) racine = e; @@ -568,39 +568,39 @@ AVLTree::RestoreBalances (int diff, AVLTree * &racine) } else if (e->balance > 0) { - if (son[RIGHT]->son[LEFT] == NULL) + if (child[RIGHT]->child[LEFT] == NULL) { // cout << "un probleme\n"; return avl_bal_err; } - AVLTree *i = son[RIGHT]->son[LEFT]->son[LEFT]; - AVLTree *j = son[RIGHT]->son[LEFT]->son[RIGHT]; - - f->son[LEFT] = a; - f->son[RIGHT] = e; - a->son[LEFT] = b; - a->son[RIGHT] = i; - e->son[LEFT] = j; - e->son[RIGHT] = g; + AVLTree *i = child[RIGHT]->child[LEFT]->child[LEFT]; + AVLTree *j = child[RIGHT]->child[LEFT]->child[RIGHT]; + + f->child[LEFT] = a; + f->child[RIGHT] = e; + a->child[LEFT] = b; + a->child[RIGHT] = i; + e->child[LEFT] = j; + e->child[RIGHT] = g; if (b) - b->dad = a; + b->parent = a; if (i) - i->dad = a; + i->parent = a; if (g) - g->dad = e; + g->parent = e; if (j) - j->dad = e; + j->parent = e; if (a) - a->dad = f; + a->parent = f; if (e) - e->dad = f; - f->dad = r; + e->parent = f; + f->parent = r; if (r) { - if (r->son[LEFT] == a) - r->son[LEFT] = f; - if (r->son[RIGHT] == a) - r->son[RIGHT] = f; + if (r->child[LEFT] == a) + r->child[LEFT] = f; + if (r->child[RIGHT] == a) + r->child[RIGHT] = f; } if (racine == this) racine = f; @@ -623,9 +623,9 @@ AVLTree::RestoreBalances (int diff, AVLTree * &racine) } if (r) { - if (f == r->son[RIGHT]) + if (f == r->child[RIGHT]) return r->RestoreBalances (1, racine); - if (f == r->son[LEFT]) + if (f == r->child[LEFT]) return r->RestoreBalances (-1, racine); } return avl_no_err; @@ -637,12 +637,12 @@ AVLTree::RestoreBalances (int diff, AVLTree * &racine) else if (diff > 0) { balance = 0; - if (dad) + if (parent) { - if (this == dad->son[RIGHT]) - return dad->RestoreBalances (1, racine); - if (this == dad->son[LEFT]) - return dad->RestoreBalances (-1, racine); + if (this == parent->child[RIGHT]) + return parent->RestoreBalances (1, racine); + if (this == parent->child[LEFT]) + return parent->RestoreBalances (-1, racine); } return avl_no_err; } @@ -673,126 +673,126 @@ AVLTree::Remove (AVLTree * &racine, AVLTree * &startNode, int &diff) elem[RIGHT]->elem[LEFT] = elem[LEFT]; elem[LEFT] = elem[RIGHT] = NULL; - if (son[LEFT] && son[RIGHT]) + if (child[LEFT] && child[RIGHT]) { - AVLTree *newMe = son[LEFT]->leafFromDad(this, RIGHT); - if (newMe == NULL || newMe->son[RIGHT]) + AVLTree *newMe = child[LEFT]->leafFromParent(this, RIGHT); + if (newMe == NULL || newMe->child[RIGHT]) { // cout << "pas normal\n"; return avl_rm_err; } - if (newMe == son[LEFT]) + if (newMe == child[LEFT]) { startNode = newMe; diff = -1; - newMe->son[RIGHT] = son[RIGHT]; - son[RIGHT]->dad = newMe; - newMe->dad = dad; - if (dad) + newMe->child[RIGHT] = child[RIGHT]; + child[RIGHT]->parent = newMe; + newMe->parent = parent; + if (parent) { - if (dad->son[LEFT] == this) - dad->son[LEFT] = newMe; - if (dad->son[RIGHT] == this) - dad->son[RIGHT] = newMe; + if (parent->child[LEFT] == this) + parent->child[LEFT] = newMe; + if (parent->child[RIGHT] == this) + parent->child[RIGHT] = newMe; } } else { - AVLTree *oDad = newMe->dad; - startNode = oDad; + AVLTree *oParent = newMe->parent; + startNode = oParent; diff = 1; - oDad->son[RIGHT] = newMe->son[LEFT]; - if (newMe->son[LEFT]) - newMe->son[LEFT]->dad = oDad; + oParent->child[RIGHT] = newMe->child[LEFT]; + if (newMe->child[LEFT]) + newMe->child[LEFT]->parent = oParent; - newMe->dad = dad; - newMe->son[LEFT] = son[LEFT]; - newMe->son[RIGHT] = son[RIGHT]; - if (dad) + newMe->parent = parent; + newMe->child[LEFT] = child[LEFT]; + newMe->child[RIGHT] = child[RIGHT]; + if (parent) { - if (dad->son[LEFT] == this) - dad->son[LEFT] = newMe; - if (dad->son[RIGHT] == this) - dad->son[RIGHT] = newMe; + if (parent->child[LEFT] == this) + parent->child[LEFT] = newMe; + if (parent->child[RIGHT] == this) + parent->child[RIGHT] = newMe; } - if (son[LEFT]) - son[LEFT]->dad = newMe; - if (son[RIGHT]) - son[RIGHT]->dad = newMe; + if (child[LEFT]) + child[LEFT]->parent = newMe; + if (child[RIGHT]) + child[RIGHT]->parent = newMe; } newMe->balance = balance; if (racine == this) racine = newMe; } - else if (son[LEFT]) + else if (child[LEFT]) { - startNode = dad; + startNode = parent; diff = 0; - if (dad) + if (parent) { - if (this == dad->son[LEFT]) + if (this == parent->child[LEFT]) diff = -1; - if (this == dad->son[RIGHT]) + if (this == parent->child[RIGHT]) diff = 1; } - if (dad) + if (parent) { - if (dad->son[LEFT] == this) - dad->son[LEFT] = son[LEFT]; - if (dad->son[RIGHT] == this) - dad->son[RIGHT] = son[LEFT]; + if (parent->child[LEFT] == this) + parent->child[LEFT] = child[LEFT]; + if (parent->child[RIGHT] == this) + parent->child[RIGHT] = child[LEFT]; } - if (son[LEFT]->dad == this) - son[LEFT]->dad = dad; + if (child[LEFT]->parent == this) + child[LEFT]->parent = parent; if (racine == this) - racine = son[LEFT]; + racine = child[LEFT]; } - else if (son[RIGHT]) + else if (child[RIGHT]) { - startNode = dad; + startNode = parent; diff = 0; - if (dad) + if (parent) { - if (this == dad->son[LEFT]) + if (this == parent->child[LEFT]) diff = -1; - if (this == dad->son[RIGHT]) + if (this == parent->child[RIGHT]) diff = 1; } - if (dad) + if (parent) { - if (dad->son[LEFT] == this) - dad->son[LEFT] = son[RIGHT]; - if (dad->son[RIGHT] == this) - dad->son[RIGHT] = son[RIGHT]; + if (parent->child[LEFT] == this) + parent->child[LEFT] = child[RIGHT]; + if (parent->child[RIGHT] == this) + parent->child[RIGHT] = child[RIGHT]; } - if (son[RIGHT]->dad == this) - son[RIGHT]->dad = dad; + if (child[RIGHT]->parent == this) + child[RIGHT]->parent = parent; if (racine == this) - racine = son[RIGHT]; + racine = child[RIGHT]; } else { - startNode = dad; + startNode = parent; diff = 0; - if (dad) + if (parent) { - if (this == dad->son[LEFT]) + if (this == parent->child[LEFT]) diff = -1; - if (this == dad->son[RIGHT]) + if (this == parent->child[RIGHT]) diff = 1; } - if (dad) + if (parent) { - if (dad->son[LEFT] == this) - dad->son[LEFT] = NULL; - if (dad->son[RIGHT] == this) - dad->son[RIGHT] = NULL; + if (parent->child[LEFT] == this) + parent->child[LEFT] = NULL; + if (parent->child[RIGHT] == this) + parent->child[RIGHT] = NULL; } if (racine == this) racine = NULL; } - dad = son[RIGHT] = son[LEFT] = NULL; + parent = child[RIGHT] = child[LEFT] = NULL; balance = 0; return avl_no_err; } @@ -828,43 +828,43 @@ AVLTree::Insert (AVLTree * &racine, int insertType, AVLTree * insertL, } else if (insertType == found_on_left) { - if (insertR == NULL || insertR->son[LEFT]) + if (insertR == NULL || insertR->child[LEFT]) { // cout << "ngou?\n"; return avl_ins_err; } - insertR->son[LEFT] = this; - dad = insertR; + insertR->child[LEFT] = this; + parent = insertR; insertOn(LEFT, insertR); } else if (insertType == found_on_right) { - if (insertL == NULL || insertL->son[RIGHT]) + if (insertL == NULL || insertL->child[RIGHT]) { // cout << "ngou?\n"; return avl_ins_err; } - insertL->son[RIGHT] = this; - dad = insertL; + insertL->child[RIGHT] = this; + parent = insertL; insertOn(RIGHT, insertL); } else if (insertType == found_between) { if (insertR == NULL || insertL == NULL - || (insertR->son[LEFT] != NULL && insertL->son[RIGHT] != NULL)) + || (insertR->child[LEFT] != NULL && insertL->child[RIGHT] != NULL)) { // cout << "ngou?\n"; return avl_ins_err; } - if (insertR->son[LEFT] == NULL) + if (insertR->child[LEFT] == NULL) { - insertR->son[LEFT] = this; - dad = insertR; + insertR->child[LEFT] = this; + parent = insertR; } - else if (insertL->son[RIGHT] == NULL) + else if (insertL->child[RIGHT] == NULL) { - insertL->son[RIGHT] = this; - dad = insertL; + insertL->child[RIGHT] = this; + parent = insertL; } insertBetween (insertL, insertR); } @@ -877,22 +877,22 @@ AVLTree::Insert (AVLTree * &racine, int insertType, AVLTree * insertL, } // et on insere - if (insertL->son[RIGHT]) + if (insertL->child[RIGHT]) { - insertL = insertL->son[RIGHT]->leafFromDad(insertL, LEFT); - if (insertL->son[LEFT]) + insertL = insertL->child[RIGHT]->leafFromParent(insertL, LEFT); + if (insertL->child[LEFT]) { // cout << "ngou?\n"; return avl_ins_err; } - insertL->son[LEFT] = this; - this->dad = insertL; + insertL->child[LEFT] = this; + this->parent = insertL; insertBetween (insertL->elem[LEFT], insertL); } else { - insertL->son[RIGHT] = this; - dad = insertL; + insertL->child[RIGHT] = this; + parent = insertL; insertBetween (insertL, insertL->elem[RIGHT]); } } @@ -915,24 +915,24 @@ AVLTree::Relocate (AVLTree * to) to->elem[LEFT] = elem[LEFT]; to->elem[RIGHT] = elem[RIGHT]; - if (dad) + if (parent) { - if (dad->son[LEFT] == this) - dad->son[LEFT] = to; - if (dad->son[RIGHT] == this) - dad->son[RIGHT] = to; + if (parent->child[LEFT] == this) + parent->child[LEFT] = to; + if (parent->child[RIGHT] == this) + parent->child[RIGHT] = to; } - if (son[RIGHT]) + if (child[RIGHT]) { - son[RIGHT]->dad = to; + child[RIGHT]->parent = to; } - if (son[LEFT]) + if (child[LEFT]) { - son[LEFT]->dad = to; + child[LEFT]->parent = to; } - to->dad = dad; - to->son[RIGHT] = son[RIGHT]; - to->son[LEFT] = son[LEFT]; + to->parent = parent; + to->child[RIGHT] = child[RIGHT]; + to->child[LEFT] = child[LEFT]; } diff --git a/src/livarot/AVL.h b/src/livarot/AVL.h index cc0f095cc..741abfaf2 100644 --- a/src/livarot/AVL.h +++ b/src/livarot/AVL.h @@ -30,7 +30,7 @@ public: protected: - AVLTree *son[2]; + AVLTree *child[2]; AVLTree(); virtual ~AVLTree(); @@ -57,7 +57,7 @@ protected: private: - AVLTree *dad; + AVLTree *parent; int balance; @@ -78,7 +78,7 @@ private: void insertOn(Side s, AVLTree *of); void insertBetween(AVLTree *l, AVLTree *r); AVLTree *leaf(AVLTree *from, Side s); - AVLTree *leafFromDad(AVLTree *from, Side s); + AVLTree *leafFromParent(AVLTree *from, Side s); }; #endif diff --git a/src/livarot/PathCutting.cpp b/src/livarot/PathCutting.cpp index 201f64b54..0dc7ede50 100644 --- a/src/livarot/PathCutting.cpp +++ b/src/livarot/PathCutting.cpp @@ -641,21 +641,21 @@ Path** Path::SubPathsWithNesting(int &outNb,bool killNoSurf,int nbNest,int* } curAdd=NULL; } - Path* hasDad=NULL; + Path* hasParent=NULL; for (int j=0;j<nbNest;j++) { if ( conts[j] == i && nesting[j] >= 0 ) { - int dadMvt=conts[nesting[j]]; + int parentMvt=conts[nesting[j]]; for (int k=0;k<nbRes;k++) { - if ( res[k] && res[k]->descr_cmd.empty() == false && res[k]->descr_cmd[0]->associated == dadMvt ) { - hasDad=res[k]; + if ( res[k] && res[k]->descr_cmd.empty() == false && res[k]->descr_cmd[0]->associated == parentMvt ) { + hasParent=res[k]; break; } } } if ( conts[j] > i ) break; } - if ( hasDad ) { - curAdd=hasDad; + if ( hasParent ) { + curAdd=hasParent; increment=true; } else { curAdd=new Path; diff --git a/src/livarot/ShapeMisc.cpp b/src/livarot/ShapeMisc.cpp index e5a98f0cf..c0bfe9428 100644 --- a/src/livarot/ShapeMisc.cpp +++ b/src/livarot/ShapeMisc.cpp @@ -373,7 +373,7 @@ Shape::ConvertToFormeNested (Path * dest, int nbP, Path * *orig, int /*wildPath* int lastPtUsed = 0; do { - int dadContour=-1; + int parentContour=-1; int childEdge = -1; bool foundChild = false; int startBord = -1; @@ -387,10 +387,10 @@ Shape::ConvertToFormeNested (Path * dest, int nbP, Path * *orig, int /*wildPath* { int askTo = pData[fi].askForWindingB; if (askTo < 0 || askTo >= numberOfEdges() ) { - dadContour=-1; + parentContour=-1; } else { - dadContour = GPOINTER_TO_INT(swdData[askTo].misc); - dadContour-=1; // pour compenser le decalage + parentContour = GPOINTER_TO_INT(swdData[askTo].misc); + parentContour-=1; // pour compenser le decalage childEdge = getPoint(fi).incidentEdge[FIRST]; } } @@ -463,7 +463,7 @@ Shape::ConvertToFormeNested (Path * dest, int nbP, Path * *orig, int /*wildPath* contStart=(int*)g_realloc(contStart,(nbNest+1)*sizeof(int)); contStart[nbNest]=dest->descr_cmd.size(); if (foundChild) { - nesting[nbNest++]=dadContour; + nesting[nbNest++]=parentContour; foundChild = false; } else { nesting[nbNest++]=-1; // contient des bouts de coupure -> a part @@ -504,7 +504,7 @@ Shape::ConvertToFormeNested (Path * dest, int nbP, Path * *orig, int /*wildPath* contStart=(int*)g_realloc(contStart,(nbNest+1)*sizeof(int)); contStart[nbNest]=dest->descr_cmd.size(); if (foundChild) { - nesting[nbNest++]=dadContour; + nesting[nbNest++]=parentContour; foundChild = false; } else { nesting[nbNest++]=-1; // contient des bouts de coupure -> a part diff --git a/src/livarot/sweep-event.cpp b/src/livarot/sweep-event.cpp index 6f3a4d246..48354fc46 100644 --- a/src/livarot/sweep-event.cpp +++ b/src/livarot/sweep-event.cpp @@ -146,11 +146,11 @@ void SweepEventQueue::remove(SweepEvent *e) } while (2 * curInd + 1 < nbEvt) { - int const son1 = 2 * curInd + 1; - int const son2 = son1 + 1; - int const no1 = inds[son1]; - int const no2 = inds[son2]; - if (son2 < nbEvt) { + int const child1 = 2 * curInd + 1; + int const child2 = child1 + 1; + int const no1 = inds[child1]; + int const no2 = inds[child2]; + if (child2 < nbEvt) { if (px[1] > events[no1].posx[1] || (px[1] == events[no1].posx[1] && px[0] > events[no1].posx[0])) @@ -159,28 +159,28 @@ void SweepEventQueue::remove(SweepEvent *e) || (events[no2].posx[1] == events[no1].posx[1] && events[no2].posx[0] > events[no1].posx[0])) { - events[to].ind = son1; + events[to].ind = child1; events[no1].ind = curInd; - inds[son1] = to; + inds[child1] = to; inds[curInd] = no1; - curInd = son1; + curInd = child1; } else { - events[to].ind = son2; + events[to].ind = child2; events[no2].ind = curInd; - inds[son2] = to; + inds[child2] = to; inds[curInd] = no2; - curInd = son2; + curInd = child2; } } else { if (px[1] > events[no2].posx[1] || (px[1] == events[no2].posx[1] && px[0] > events[no2].posx[0])) { - events[to].ind = son2; + events[to].ind = child2; events[no2].ind = curInd; - inds[son2] = to; + inds[child2] = to; inds[curInd] = no2; - curInd = son2; + curInd = child2; } else { break; } @@ -190,9 +190,9 @@ void SweepEventQueue::remove(SweepEvent *e) || (px[1] == events[no1].posx[1] && px[0] > events[no1].posx[0])) { - events[to].ind = son1; + events[to].ind = child1; events[no1].ind = curInd; - inds[son1] = to; + inds[child1] = to; inds[curInd] = no1; } diff --git a/src/livarot/sweep-tree.cpp b/src/livarot/sweep-tree.cpp index 0cfd6bc52..7a016a2ee 100644 --- a/src/livarot/sweep-tree.cpp +++ b/src/livarot/sweep-tree.cpp @@ -131,8 +131,8 @@ SweepTree::Find(Geom::Point const &px, SweepTree *newOne, SweepTree *&insertL, } } if (y < 0) { - if (son[LEFT]) { - return (static_cast<SweepTree *>(son[LEFT]))->Find(px, newOne, + if (child[LEFT]) { + return (static_cast<SweepTree *>(child[LEFT]))->Find(px, newOne, insertL, insertR, sweepSens); } else { @@ -145,8 +145,8 @@ SweepTree::Find(Geom::Point const &px, SweepTree *newOne, SweepTree *&insertL, } } } else { - if (son[RIGHT]) { - return (static_cast<SweepTree *>(son[RIGHT]))->Find(px, newOne, + if (child[RIGHT]) { + return (static_cast<SweepTree *>(child[RIGHT]))->Find(px, newOne, insertL, insertR, sweepSens); } else { @@ -189,9 +189,9 @@ SweepTree::Find(Geom::Point const &px, SweepTree * &insertL, } if (y < 0) { - if (son[LEFT]) + if (child[LEFT]) { - return (static_cast<SweepTree *>(son[LEFT]))->Find(px, insertL, + return (static_cast<SweepTree *>(child[LEFT]))->Find(px, insertL, insertR); } else @@ -210,9 +210,9 @@ SweepTree::Find(Geom::Point const &px, SweepTree * &insertL, } else { - if (son[RIGHT]) + if (child[RIGHT]) { - return (static_cast<SweepTree *>(son[RIGHT]))->Find(px, insertL, + return (static_cast<SweepTree *>(child[RIGHT]))->Find(px, insertL, insertR); } else diff --git a/src/sp-item-transform.cpp b/src/sp-item-transform.cpp index 05390c910..1ab8edd51 100644 --- a/src/sp-item-transform.cpp +++ b/src/sp-item-transform.cpp @@ -146,9 +146,13 @@ Geom::Affine get_scale_transform_for_uniform_stroke(Geom::Rect const &bbox_visua if ((fabs(w0 - stroke_x) < 1e-6) || w1 == 0) { // We have a vertical line at hand scale_y = h1/h0; scale_x = transform_stroke ? 1 : scale_y; + unbudge *= Geom::Translate (-flip_x * 0.5 * (scale_x - 1.0) * w0, 0); + unbudge *= Geom::Translate ( flip_x * 0.5 * (w1 - w0), 0); // compensate for the fact that this operation cannot be performed } else if ((fabs(h0 - stroke_y) < 1e-6) || h1 == 0) { // We have a horizontal line at hand scale_x = w1/w0; scale_y = transform_stroke ? 1 : scale_x; + unbudge *= Geom::Translate (0, -flip_y * 0.5 * (scale_y - 1.0) * h0); + unbudge *= Geom::Translate (0, flip_y * 0.5 * (h1 - h0)); // compensate for the fact that this operation cannot be performed } else { // We have a true 2D object at hand if (transform_stroke && !preserve) { /* Initial area of the geometric bounding box: A0 = (w0-r0)*(h0-r0) @@ -299,11 +303,13 @@ Geom::Affine get_scale_transform_for_variable_stroke(Geom::Rect const &bbox_visu if ((fabs(w0 - r0w) < 1e-6) || w1 == 0) { // We have a vertical line at hand scale_y = h1/h0; scale_x = transform_stroke ? 1 : scale_y; - unbudge *= Geom::Translate (flip_x * 0.5 * (w1 - w0), 0); // compensate for the fact that this operation cannot be performed + unbudge *= Geom::Translate (-flip_x * 0.5 * (scale_x - 1.0) * w0, 0); + unbudge *= Geom::Translate ( flip_x * 0.5 * (w1 - w0), 0); // compensate for the fact that this operation cannot be performed } else if ((fabs(h0 - r0h) < 1e-6) || h1 == 0) { // We have a horizontal line at hand scale_x = w1/w0; scale_y = transform_stroke ? 1 : scale_x; - unbudge *= Geom::Translate (0, flip_y * 0.5 * (h1 - h0)); // compensate for the fact that this operation cannot be performed + unbudge *= Geom::Translate (0, -flip_y * 0.5 * (scale_y - 1.0) * h0); + unbudge *= Geom::Translate (0, flip_y * 0.5 * (h1 - h0)); // compensate for the fact that this operation cannot be performed } else { // We have a true 2D object at hand if (transform_stroke && !preserve) { /* Initial area of the geometric bounding box: A0 = (w0-r0w)*(h0-r0h) diff --git a/src/splivarot.cpp b/src/splivarot.cpp index e5006884c..5c7b389ff 100644 --- a/src/splivarot.cpp +++ b/src/splivarot.cpp @@ -371,18 +371,18 @@ sp_selected_path_boolop(Inkscape::Selection *selection, SPDesktop *desktop, bool // objects are not in parent/child relationship; // find their lowest common ancestor - Inkscape::XML::Node *dad = LCA(a, b); - if (dad == NULL) { + Inkscape::XML::Node *parent = LCA(a, b); + if (parent == NULL) { boolop_display_error_message(desktop, _("Unable to determine the <b>z-order</b> of the objects selected for difference, XOR, division, or path cut.")); return; } // find the children of the LCA that lead from it to the a and b - Inkscape::XML::Node *as = AncetreFils(a, dad); - Inkscape::XML::Node *bs = AncetreFils(b, dad); + Inkscape::XML::Node *as = AncetreFils(a, parent); + Inkscape::XML::Node *bs = AncetreFils(b, parent); // find out which comes first - for (Inkscape::XML::Node *child = dad->firstChild(); child; child = child->next()) { + for (Inkscape::XML::Node *child = parent->firstChild(); child; child = child->next()) { if (child == as) { /* a first, so reverse. */ reverseOrderForOp = true; diff --git a/src/ui/tools/connector-tool.cpp b/src/ui/tools/connector-tool.cpp index 62d52f6af..50cb00360 100644 --- a/src/ui/tools/connector-tool.cpp +++ b/src/ui/tools/connector-tool.cpp @@ -1080,7 +1080,12 @@ cc_generic_knot_handler(SPCanvasItem *, GdkEvent *event, SPKnot *knot) case GDK_LEAVE_NOTIFY: sp_knot_set_flag(knot, SP_KNOT_MOUSEOVER, FALSE); - cc->active_handle = NULL; + /* FIXME: the following test is a workaround for LP Bug #1273510. + * It seems that a signal is not correctly disconnected, maybe + * something missing in cc_clear_active_conn()? */ + if (cc) { + cc->active_handle = NULL; + } if (knot_tip) { knot->desktop->event_context->defaultMessageContext()->clear(); diff --git a/src/ui/tools/spray-tool.cpp b/src/ui/tools/spray-tool.cpp index 0ded1e44b..91c606e8e 100644 --- a/src/ui/tools/spray-tool.cpp +++ b/src/ui/tools/spray-tool.cpp @@ -404,7 +404,7 @@ static bool sp_spray_recursive(SPDesktop *desktop, SPItem *item_copied; if(_fid <= population) { - // duplicate + // Duplicate SPDocument *doc = item->document; Inkscape::XML::Document* xml_doc = doc->getReprDoc(); Inkscape::XML::Node *old_repr = item->getRepr(); @@ -413,13 +413,13 @@ static bool sp_spray_recursive(SPDesktop *desktop, parent->appendChild(copy); SPObject *new_obj = doc->getObjectByRepr(copy); - item_copied = SP_ITEM(new_obj); //convertion object->item + item_copied = SP_ITEM(new_obj); // Convertion object->item Geom::Point center=item->getCenter(); sp_spray_scale_rel(center,desktop, item_copied, Geom::Scale(_scale,_scale)); sp_spray_scale_rel(center,desktop, item_copied, Geom::Scale(scale,scale)); sp_spray_rotate_rel(center,desktop,item_copied, Geom::Rotate(angle)); - //Move the cursor p + // Move the cursor p Geom::Point move = (Geom::Point(cos(tilt)*cos(dp)*dr/(1-ratio)+sin(tilt)*sin(dp)*dr/(1+ratio), -sin(tilt)*cos(dp)*dr/(1-ratio)+cos(tilt)*sin(dp)*dr/(1+ratio)))+(p-a->midpoint()); sp_item_move_rel(item_copied, Geom::Translate(move[Geom::X], -move[Geom::Y])); did = true; @@ -427,10 +427,10 @@ static bool sp_spray_recursive(SPDesktop *desktop, } } else if (mode == SPRAY_MODE_SINGLE_PATH) { - SPItem *father = NULL; //initial Object - SPItem *item_copied = NULL; //Projected Object - SPItem *unionResult = NULL; //previous union - SPItem *son = NULL; //father copy + SPItem *parent_item = NULL; // Initial object + SPItem *item_copied = NULL; // Projected object + SPItem *unionResult = NULL; // Previous union + SPItem *child_item = NULL; // Parent copy int i=1; for (GSList *items = g_slist_copy(const_cast<GSList *>(selection->itemList())); @@ -439,31 +439,31 @@ static bool sp_spray_recursive(SPDesktop *desktop, SPItem *item1 = SP_ITEM(items->data); if (i == 1) { - father = item1; + parent_item = item1; } if (i == 2) { unionResult = item1; } i++; } - SPDocument *doc = father->document; + SPDocument *doc = parent_item->document; Inkscape::XML::Document* xml_doc = doc->getReprDoc(); - Inkscape::XML::Node *old_repr = father->getRepr(); + Inkscape::XML::Node *old_repr = parent_item->getRepr(); Inkscape::XML::Node *parent = old_repr->parent(); - Geom::OptRect a = father->documentVisualBounds(); + Geom::OptRect a = parent_item->documentVisualBounds(); if (a) { if (i == 2) { Inkscape::XML::Node *copy1 = old_repr->duplicate(xml_doc); parent->appendChild(copy1); SPObject *new_obj1 = doc->getObjectByRepr(copy1); - son = SP_ITEM(new_obj1); // conversion object->item - unionResult = son; + child_item = SP_ITEM(new_obj1); // Conversion object->item + unionResult = child_item; Inkscape::GC::release(copy1); } if (_fid <= population) { // Rules the population of objects sprayed - // duplicates the father + // Duplicates the parent item Inkscape::XML::Node *copy2 = old_repr->duplicate(xml_doc); parent->appendChild(copy2); SPObject *new_obj2 = doc->getObjectByRepr(copy2); @@ -472,18 +472,18 @@ static bool sp_spray_recursive(SPDesktop *desktop, // Move around the cursor Geom::Point move = (Geom::Point(cos(tilt)*cos(dp)*dr/(1-ratio)+sin(tilt)*sin(dp)*dr/(1+ratio), -sin(tilt)*cos(dp)*dr/(1-ratio)+cos(tilt)*sin(dp)*dr/(1+ratio)))+(p-a->midpoint()); - Geom::Point center=father->getCenter(); + Geom::Point center = parent_item->getCenter(); sp_spray_scale_rel(center, desktop, item_copied, Geom::Scale(_scale, _scale)); sp_spray_scale_rel(center, desktop, item_copied, Geom::Scale(scale, scale)); sp_spray_rotate_rel(center, desktop, item_copied, Geom::Rotate(angle)); sp_item_move_rel(item_copied, Geom::Translate(move[Geom::X], -move[Geom::Y])); - // union and duplication + // Union and duplication selection->clear(); selection->add(item_copied); selection->add(unionResult); sp_selected_path_union_skip_undo(selection, selection->desktop()); - selection->add(father); + selection->add(parent_item); Inkscape::GC::release(copy2); did = true; } @@ -500,15 +500,15 @@ static bool sp_spray_recursive(SPDesktop *desktop, // Creation of the clone Inkscape::XML::Node *clone = xml_doc->createElement("svg:use"); - // Ad the clone to the list of the father's sons + // Ad the clone to the list of the parent's children parent->appendChild(clone); - // Generates the link between father and son attributes + // Generates the link between parent and child attributes gchar *href_str = g_strdup_printf("#%s", old_repr->attribute("id")); clone->setAttribute("xlink:href", href_str, false); g_free(href_str); SPObject *clone_object = doc->getObjectByRepr(clone); - // conversion object->item + // Conversion object->item item_copied = SP_ITEM(clone_object); Geom::Point center = item->getCenter(); sp_spray_scale_rel(center, desktop, item_copied, Geom::Scale(_scale, _scale)); @@ -582,9 +582,9 @@ static void sp_spray_update_area(SprayTool *tc) static void sp_spray_switch_mode(SprayTool *tc, gint mode, bool with_shift) { - // select the button mode + // Select the button mode SP_EVENT_CONTEXT(tc)->desktop->setToolboxSelectOneValue("spray_tool_mode", mode); - // need to set explicitly, because the prefs may not have changed by the previous + // Need to set explicitly, because the prefs may not have changed by the previous tc->mode = mode; tc->update_cursor(with_shift); } @@ -631,7 +631,7 @@ bool SprayTool::root_handler(GdkEvent* event) { Geom::Point motion_doc(desktop->dt2doc(motion_dt)); sp_spray_extinput(this, event); - // draw the dilating cursor + // Draw the dilating cursor double radius = get_dilate_radius(this); Geom::Affine const sm (Geom::Scale(radius/(1-this->ratio), radius/(1+this->ratio)) ); sp_canvas_item_affine_absolute(this->dilate_area, (sm*Geom::Rotate(this->tilt))*Geom::Translate(desktop->w2d(motion_w))); @@ -645,19 +645,19 @@ bool SprayTool::root_handler(GdkEvent* event) { this->message_context->flash(Inkscape::ERROR_MESSAGE, _("<b>Nothing selected!</b> Select objects to spray.")); } - // dilating: + // Dilating: if (this->is_drawing && ( event->motion.state & GDK_BUTTON1_MASK )) { sp_spray_dilate(this, motion_w, motion_doc, motion_doc - this->last_push, event->button.state & GDK_SHIFT_MASK? true : false); //this->last_push = motion_doc; this->has_dilated = true; - // it's slow, so prevent clogging up with events + // It's slow, so prevent clogging up with events gobble_motion_events(GDK_BUTTON1_MASK); return TRUE; } } break; - /*Spray with the scroll*/ + /* Spray with the scroll */ case GDK_SCROLL: { if (event->scroll.state & GDK_BUTTON1_MASK) { double temp ; @@ -708,7 +708,7 @@ bool SprayTool::root_handler(GdkEvent* event) { if (this->is_dilating && event->button.button == 1 && !this->space_panning) { if (!this->has_dilated) { - // if we did not rub, do a light tap + // If we did not rub, do a light tap this->pressure = 0.03; sp_spray_dilate(this, motion_w, desktop->dt2doc(motion_dt), Geom::Point(0,0), MOD__SHIFT(event)); } @@ -784,7 +784,7 @@ bool SprayTool::root_handler(GdkEvent* event) { if (this->width > 1.0) { this->width = 1.0; } - // the same spinbutton is for alt+x + // The same spinbutton is for alt+x desktop->setToolboxAdjustmentValue("altx-spray", this->width * 100); sp_spray_update_area(this); ret = TRUE; |
