<?xml version="1.0" encoding="UTF-8"?>
<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
    <name>Scaler</name>
    <id>burghoff.scaleplots</id>
    <param name="tab" type="notebook">
    
        <page name="correction" gui-text="Correction mode">
            <label>Scale the lines and data of a plot without affecting text, ticks, and groups.</label>
            <label>Correction mode corrects plots that have already been manually scaled.</label>
            <label>1. Flatten each plot and group its objects together.</label>
            <label>2. Manually scale grouped plots to their desired size.</label>
            <label>3. Select manually-scaled plots and click Apply.</label>
            <label>Text, ticks, and groups are now restored to their original state. Note that multiple plots can be corrected at once.</label>
            
            <spacer/>
            <param name="figuremode" type="optiongroup" appearance="combo"
                    gui-text="Maintain size of">
                       <option value="1">Plot area (axis)</option>
                       <option value="2">Bounding box (figure)</option>
                    </param>
            
            <label appearance="header">Note</label>
            <label>It is important that you scale the plot after grouping it, because the extension infers the scale from the group's properties. In addition, when scaling the default scale options should be selected, as shown below:</label>
            <image>pngs/scale_options.png</image>
            <label>Otherwise, the final stroke widths may change.</label>
            <spacer/><param name="wholeplot3" type="bool" gui-text="Selection has no well-defined plot area"
            gui-description="Scale objects without axis or tick correction. This lets you scale arbitrary objects without affecting text or groups.">false</param>
            <spacer/>
            <label>Scientific Inkscape v1.4.23</label>
            <label appearance="url">https://github.com/burghoff/Scientific-Inkscape</label>
            <label>David Burghoff, University of Texas at Austin</label>
        </page>
        
        <page name="matching" gui-text="Matching mode">
            <label>Scale the lines and data of a plot without affecting text, ticks, and groups.</label>
            <label>Matching mode matches plots to the size of the first selected plot, which is useful for subfigure generation.</label>
            <label>1. Flatten each plot and group its objects together.</label>
            <label>2. Select two or more grouped plots and click Apply.</label>
            <label>Every selected plot will inherit the size of the first selected plot.</label>
            
            <spacer/>
            <!--
            <param name="hmatch" type="bool" gui-text="Match width?">true</param>
            <param name="vmatch" type="bool" gui-text="Match height?">true</param>
                   
              
            <param name="matchwhat" type="optiongroup" appearance="combo"
                    gui-text="Match plot's">
                       <option value="1">Bounding box</option>
                       <option value="2">Plot area</option>2
                    </param>
                    
            <param name="matchto" type="optiongroup" appearance="combo"
                    gui-text="Match to"
                    gui-description="Property to be matched. To match to the first selection's plot area, the first selection must be a grouped plot.">
                       <option value="1">First selection's bounding box</option>
                       <option value="2">First selection's plot area</option>1
                    </param>
            -->
            
            <param name="hmatchopts" type="optiongroup" appearance="combo"
                    gui-text="Horizontal " indent="0"
                    gui-description="Matching the width makes each selection have the same width, while aligning also ensures they have the same x position.">
                       <option value="1">Do not match</option>
                       <option value="2">Match width</option>
                       <option value="3">Match width and align</option>
                    </param>
                    
            <param name="vmatchopts" type="optiongroup" appearance="combo"
                    gui-text="Vertical      " indent="0"
                    gui-description="Matching the height makes each selection have the same height, while aligning also ensures they have the same y position.">
                       <option value="1">Do not match</option>
                       <option value="2">Match height</option>
                       <option value="3">Match height and align</option>
                    </param>
            
            <param name="matchprop" type="optiongroup" appearance="combo"
                    gui-text="Match the " indent="0"
                    gui-description="Property to be matched. For plot area matching, the first selection should be a grouped plot.">
                       <option value="1">Plot areas</option>
                       <option value="2">Bounding boxes</option>
                    </param>
            <spacer/>
            
            <param name="deletematch" type="bool" gui-text="Delete first selection after completion?" 
            gui-description="Useful if you are replacing the first selection with the second">false</param>
            
            <param name="wholeplot2" type="bool" gui-text="Selection has no well-defined plot area"
            gui-description="Scale objects without axis or tick correction. This lets you scale arbitrary objects without affecting text or groups.">false</param>
            <spacer/>
            <label>Scientific Inkscape v1.4.23</label>
            <label appearance="url">https://github.com/burghoff/Scientific-Inkscape</label>
            <label>David Burghoff, University of Texas at Austin</label>
        </page>
        
        <!--
        <page name="scaling" gui-text="Fixed mode">
            <label>Scale the lines and data of a plot without affecting text, ticks, and groups.</label>
            <label>Fixed mode applies a numerical scale factor to a plot.</label>
            <label>1. Flatten each plot and group its objects together.</label>
            <label>2. Select grouped plots and click Apply.</label>
            <label>Every selected plot will be scaled according to the values set here.</label>
            
            <spacer/>
            <param name="hscale" type="float" precision="0" min="1" max="9999" gui-text="Horizontal scaling (%)">100</param>
            <param name="vscale" type="float" precision="0" min="1" max="9999" gui-text="Vertical scaling (%)">100</param>
            <spacer/><param name="wholeplot1" type="bool" gui-text="Selection has no well-defined plot area"
            gui-description="Scale objects without axis or tick correction. This lets you scale arbitrary objects without affecting text or groups.">false</param>
            <spacer/>
            <label>Scientific Inkscape v1.4.23</label>
            <label appearance="url">https://github.com/burghoff/Scientific-Inkscape</label>
            <label>David Burghoff, University of Texas at Austin</label>
        </page>
        -->
        
        
        

        
        <page name="options" gui-text="Advanced">                
            <label appearance="header">Tick correction</label>
            <label>If tick correction is enabled, any horizontal or vertical lines smaller than the threshold will be corrected for size and position.</label>
            <param name="tickcorrect" type="bool" gui-text="Auto tick correct?">true</param>
            <param name="tickthreshold" type="float" precision="0" min="0" max="100" gui-text="Tick threshold (% plot area)">10</param>
            
            <label appearance="header">Markings</label>         
            <label>Running with this tab selected adds hidden markings to objects.</label>
            <label>Scale markings: Text and groups are unscaled by default, but other objects can be left unscaled or scaled with a fixed aspect ratio (useful for markers).</label>
            <label>Plot area markings: Allows objects to be used in the determination of the plot area.</label>
            <param name="marksf" type="optiongroup" appearance="combo"
                    gui-text="Mark selection as" 
                    gui-description="Unscaled: Will not be scaled at all &#13;Scaled with locked aspect ratio: Will be scaled without affecting aspect ratio &#13;Scaled: Will be scaled, even if a text or group &#13;Plot area-determining: Allows objects to determine plot area &#13;(Clear markings): Restore default settings">
                       <option value="1">Unscaled</option>
                       <option value="2">Scaled with locked aspect ratio</option>
                       <option value="3">Scaled</option>
                       <option value="4">Plot area-determining</option>
                       <option value="5">(Clear markings)</option>
                    </param>
            <spacer/>
            <label>Scientific Inkscape v1.4.23</label>
            <label appearance="url">https://github.com/burghoff/Scientific-Inkscape</label>
            <label>David Burghoff, University of Texas at Austin</label>
        </page>
    </param>
    <effect needs-live-preview="false">
        <object-type>text</object-type>
        <effects-menu>
            <submenu name="Scientific"/>
        </effects-menu>
    </effect>
    <script>
        <command location="inx" interpreter="python">scale_plots.py</command>
    </script>
</inkscape-extension>
