<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
<article lang="en">
  <articleinfo>
    <title>How to add a new shape to Dia</title>

    <pubdate>$Date: 2010/03/04 08:53:32 $</pubdate>

    <copyright>
      <year>2007</year>

      <holder>Steffen Macke</holder>
    </copyright>

    <author>
      <personname>
        <firstname>Steffen</firstname>

        <surname>Macke</surname>
      </personname>

      <email>sdteffen@gmail.com</email>
    </author>
    
    <legalnotice id="legal-notice">

   <para>

    Permission is granted to copy, distribute and/or modify this

    document under the terms of the <citetitle>GNU Free Documentation

    License</citetitle>, Version 1.1 or any later version published

    by the Free Software Foundation with no Invariant Sections, no

    Front-Cover Texts, and no Back-Cover Texts. You may obtain a copy

    of the <citetitle>GNU Free Documentation License</citetitle> from

    the Free Software Foundation by visiting <ulink type="http"

    url="http://www.fsf.org">their Web site</ulink> or by writing to:

    Free Software Foundation, Inc., 59 Temple Place - Suite 330,

    Boston, MA 02111-1307, USA.
  </para>
  <para>
    
    CSS stylesheets referenced in this document and graphics referenced
    in those stylesheets are not part of this document and covered by
    a different license.

   </para>

  </legalnotice>
    
    
  </articleinfo>

  <sect1 id="introduction">
    <title>Introduction</title>

    <para>This document describes (step by step) how to add a custom shape to 
    Dia.</para>

    <para>Dia is a diagram editor. More information about dia can be found on
	    the dia homepage, <ulink
    	url="http://live.gnome.org/Dia">http://live.gnome.org/Dia</ulink>.</para>
    	
    <para>Dia for Windows is available from <ulink
    url="http://dia-installer.de">http://dia-installer.de</ulink>.</para>
  </sect1>

  <sect1 id="creating_a_shape">
    <title>Creating a shape</title>
	<para>Just draw your shape in Dia like you draw a diagram.</para>
	<tip><para>You can also use other tools such as Inkscape to draw your shape,
		save it in the SVG format and import it to Dia.</para></tip>
	<para>The following will illustrate how to add a pre-silo shape to the Civil
	 Engineering sheet. A pre-silo shape is just a square box with a circle drawn
	 inside. Draw your shape in Dia as shown in 
	 <xref linkend="fig_shape_in_dia" />.</para>
	<para>
	  <figure id="fig_shape_in_dia">
	    <title>Pre-silo shape in dia</title>
	    <mediaobject>
	    	<imageobject>
	      		<imagedata format="PNG" fileref="figure/shape_in_dia.png" />
	    	</imageobject>
	    </mediaobject>
	  </figure>  
	</para>
	<para>Select <menuchoice><guimenu>File</guimenu><guimenuitem
		>Export...</guimenuitem></menuchoice> from the menu to open the
		diagram export dialog (<xref linkend="fig_export_diagram" />).</para>
	<para>Select
		<guilabel>Dia Shape File (*.shape)</guilabel> as the file type.</para>
	<tip><para>Advanced users can use the option <guilabel
		>By extension</guilabel> and specify the <filename>*.shape</filename>
		 extension directly in the filename.</para></tip>
	<para>Provide a meaningful name for your shape (<filename
		>pre-silo.shape</filename> in this example) and remember the folder in
		which you are saving the file.</para>
	<para>
	  <figure id="fig_export_diagram">
	    <title>Export diagram dialog</title>
	    <mediaobject>
	      <imageobject>
	        <imagedata format="PNG" fileref="figure/export_diagram.png" />
	      </imageobject>
	    </mediaobject>
	  </figure>
	</para>
	
	<para>You will be asked for the resolution of the icon that will be used
		in the Dia toolbar. While you are free to select a resolution yourself,
		it is suggested that you use 22 pixels as the height like all the
		shapes that are included in the main Dia distribution.</para>
	<tip><para>If possible, also try to use the a width of 22 pixels for your 
		icons.</para></tip>
	<para>If you are following the example, specify a width of 22 pixels and
		a height of 22 pixels in the dialog (<xref 
		linkend="fig_png_export_options" />).</para>	
	<para>
		<figure id="fig_png_export_options">
			<title>Shape icon resolution</title>
			<mediaobject>
				<imageobject>
					<imagedata format="PNG" fileref="figure/png_export_options.png" />
				</imageobject>
			</mediaobject>
		</figure>
	</para>	
  </sect1>
  
  <sect1 id="add_shape_to_sheet">
  	<title>Adding a shape to a sheet</title>
  	<para>Once you have created a shape, you can add it to a sheet.</para>
  	<para>Select <menuchoice><guimenu>File</guimenu><guimenuitem>Sheets and 
	  	Objects</guimenuitem></menuchoice> from the menu to open the 
	  	<guilabel>Sheets and Objects</guilabel>
	  	dialog.</para>
	<tip><para>You can press <keycap>F9</keycap> to open the <guilabel>Sheets 
		and Objects</guilabel> dialog.</para></tip>
	<para>In the left drop-down, select <guilabel>Civil</guilabel> to see the
		existing Civil Engineering sheet as shown in <xref 
		linkend="fig_sheets_and_objects_dialog" />.</para>
	<para>
		<figure id="fig_sheets_and_objects_dialog">
			<title>Sheets and Objects dialog</title>
			<mediaobject>
				<imageobject>
					<imagedata format="PNG" fileref="figure/sheets_and_objects_dialog.png" />
				</imageobject>
			</mediaobject>
		</figure>
	</para>
	<para>To add the new shape to the sheet, click on the 
		<guibutton>New</guibutton> button - a new dialog will be opened
		(<xref linkend="fig_new_shape_empty" />).</para>
		<para>
		<figure id="fig_new_shape_empty">
			<title>Empty new shape dialog</title>
			<mediaobject>
				<imageobject>
					<imagedata format="PNG" fileref="figure/new_shape_empty.png" />
				</imageobject>
			</mediaobject>
		</figure>
	</para>		
	<para>In the new dialog, click on the <guibutton>Browse...</guibutton>
		browse button to select the location of the new shape file. A file
		selection dialog will be opened. Browse to the new shape file and
		select it. For the example, <filename>pre-silo.shape</filename> has
		been selected in <xref linkend="fig_select_shape_file"/>.</para>
	<para>
		<figure id="fig_select_shape_file">
			<title>Select SVG Shape File</title>
			<mediaobject>
				<imageobject>
					<imagedata format="PNG" fileref="figure/select_shape_file.png" />
				</imageobject>
			</mediaobject>
		</figure>
	</para>
	<para>Click the <guibutton>OK</guibutton> to close the file selection 
		dialog.</para>
	<para>Fill in a description for the new shape. Your dialog box should look
		now similar to <xref linkend="fig_new_shape_filled" />.</para>
	<para>
		<figure id="fig_new_shape_filled">
			<title>Filled new shape dialog</title>
			<mediaobject>
				<imageobject>
					<imagedata format="PNG" fileref="figure/new_shape_filled.png" />
				</imageobject>
			</mediaobject>
		</figure>
	</para>
	<para>Click on the <guibutton>OK</guibutton> button to close the 
		dialog.</para>
	<para>Congratulations! You've added a shape to the Civil Engineering sheet,
		which should look now like the one in <xref 
		linkend="fig_sheets_and_objects_with_new" />.</para>
	<para>
		<figure id="fig_sheets_and_objects_with_new">
			<title>Updated Sheets and Objects dialog</title>
			<mediaobject>
				<imageobject>
					<imagedata format="PNG" fileref="figure/sheets_and_objects_dialog_with_new_shape.png" />
				</imageobject>
			</mediaobject>
		</figure>
	</para>	
	<para>Click on the <guibutton>Close</guibutton> button to close the Sheets
		and Objects dialog and start a new diagram. You can add your newly
		created shape to this diagram.</para>
  </sect1>
  
  <sect1 id="share_shapes">
  	<title>Share your shapes</title>
  	<para>Consider sharing your shapes with others, e.g. by sending an email to 
  	<email>dia-list@gnome.org</email>, adding it to a website, etc. The best way
  	to do this is to create a new enhancement bug in Dia's bugtracker, 
  	<ulink url="http://bugzilla.gnome.org">http://bugzilla.gnome.org</ulink>.
  	</para>
  	<para>Note that you have to agree to place your shapes under the terms of
  	GPL, if you would like to have your shapes included in the Dia distribution.
  	</para>
  </sect1>
  
  <appendix>
  	<title>DocBook source</title>
  	<para><ulink url="http://dia-installer.de/howto/create_shape/dia_create_shape.xml">http://dia-installer.de/howto/shapes/dia_create_shape.xml</ulink></para>
  </appendix>
  
  <appendix>
  	<title>Other languages</title>
  	<para><ulink url="http://dia-installer.de/howto/create_shape/index.html.es">Español</ulink></para>
  </appendix>
  
</article>
