<chapter label="7" id="selecting-chapter">
  <title>Selecting Objects</title>
  <sect1 id="selecting-introduction">
    <title>Selection Introduction</title>
    <para>
      Selecting one or more objects is a very common task
      when using <application>Dia</application>. Whenever you wish to move, 
      copy, delete, or edit an object or change it's properties, you must first 
      select it. You can also work with a set of selected objects -- for example,
      to move a group of related objects while keeping their relative positions
      in tact or to change the properties of a group of objects.
    </para>
    <para>
      Selecting objects can be done in several ways, including clicking with
      the mouse, selecting by area, or using the Select menu to perform 
      additional selection options.
    </para>
  </sect1>


  <sect1 id="how-to-select">
    <title>How To Select Objects</title>
    <sect2 id="basic-selection">
      <title>Selecting a Single Object</title>
      <para>
        To select a single object, just click it with the mouse. Also, when an
        object is first placed on the canvas, it is automatically selected.
      </para>
      <para>
        Once an object is selected, its handles are 
        illuminated. For shapes, the handles are green points on its corners 
        and sides. For a line, the handles are green or red at the ends, and 
        orange in the middle. Once the object is
        selected, you may work with it as desired. To access the object's properties,
        you can double-click it or right-click and select Properties from the
        pop-up menu. 
      </para>
      <figure>
        <title>Selected Object</title>
        <screenshot>
          <screeninfo>Selected Object</screeninfo>
          <graphic format="PNG" fileref="graphics/selected-object" 
              srccredit=
              "Mark Dexter" />
        </screenshot>
      </figure>  
    </sect2>
    <sect2 id="basic-deselection">
      <title>Deselecting Objects</title>
      <para>
        You can deselect one or more selected objects by double-clicking on
        any empty space on the canvas or by selecting any other object. The 
        handles will diObjects / Align Optionssappear, indicating that the object is no longer selected.
        Selecting the Layers option from the Diagram menu will also deselect 
        all selected objects. 

      </para>

    </sect2>

    <sect2 id="multi-selection">
      <title>Selecting Multiple Objects</title>
      <para>
        Multiple selection is useful when you want to apply the same operation to two
        or more objects. When selected, you may work with these objects as a set or 
        individually. See the section 
        <link linkend="working-with-selected">Working With Selected Objects</link>
        for more information.
      </para>
      <para>

        <application>Dia</application> provides a number of ways to select multiple 
        objects. These are outlined below. Note that either double-clicking on an empty 
        region of the canvas or single-clicking on an unselected object  
        deselects all selected objects.
      </para>

      <sect3 id="shift-click">
        <title>Shift+Click Selection</title>

        <para>
          A simple way to select two or more objects is to hold the Shift key down
          while clicking the objects with the mouse. The Shift+Click acts as a toggle.
          If you Shift+Click once, the object is selected. Shift+Click a second time 
          to deselect the object. 
        </para>
        <tip><para>
            You can combine Shift+Click with any of the other methods outlined below 
            to either select an additional object or deselect a selected object.
          </para></tip>
        <note>
          <para>
            When you have a set of objects selected, it is still possible
            to resize or change the properties of one object without 
            affected the other selected
            objects. See the section 
            <link linkend="working-with-selected">Working With Selected Objects</link>
            for more information.
          </para>
        </note>
      </sect3>
      <sect3 id="select-area">
        <title>Select By Area</title>
        <para>
          You can select all of the objects within a rectangular region of the 
          screen by placing the mouse pointer to the upper left of the top-left
          object in the set and then dragging the mouse to a point below and to 
          the right of the lower-right object in the set. A thin dashed rectangle will
          be drawn on the canvas as shown in the screenshot below. 
          All objects that COMPLETELY FIT inside this
          rectangle are selected. Objects that are only partly inside the 
          rectangle are not selected.

        </para>
        <figure>
          <title>Select By Area Example</title>
          <screenshot>
            <screeninfo>Select By Area Example</screeninfo>
            <graphic format="PNG" fileref="graphics/select-area" 
                srccredit= "Mark Dexter" />
          </screenshot>
          <blockquote>
            <simpara>Only objects entirely inside rectangle are selected.</simpara>
          </blockquote>
        </figure>  
        <tip>
          <para>
            You can select multiple regions using select by area. Objects previously selected
            will continue to be selected as long as you don't deselect all (e.g., by 
            double-clicking on an empty region of the canvas or by clicking on an 
            unselected object without using the Shift key). As noted above, you can
            also use Shift+Click to select or deselect an individual object at any time.
          </para> </tip>
        <tip>
          <para>
            Normally, selecting from top-left to bottom-right is the same as a "reverse 
            drag" --  
            starting on the bottom-right and dragging toward the top-left.
            However, you can set an option in <application>Dia</application> that allows you 
            to select objects that are only partially contained in the selection rectangle
            when you "reverse drag". See <link linkend="user-interface">User Interface /
              Reverse Dragging</link> for more information.
          </para> </tip>  


      </sect3>
      <sect3 id="select-all">
        <title>Select All</title>
        <para>
          The Select menu shown below has six options for selecting multiple objects. 
          The first option is All.
        </para>
        <figure>
          <title>Select Menu</title>
          <screenshot>
            <screeninfo>Select Menu</screeninfo>
            <graphic format="PNG" fileref="graphics/select-menu" 
                srccredit= "Mark Dexter" />
          </screenshot>
        </figure>   


        <para>
          You can select all objects on the canvas using the 
          <menuchoice><guimenu>Select</guimenu>
            <guimenuitem>All</guimenuitem>
          </menuchoice> option  or by pressing Ctrl+A. This selects 
          all objects whether they are visible or not. 
        </para>
        <note>
          <para>
            As with any of the selection methods, if you are using layers, 
            only objects in the current layer will be selected. See 
            <link linkend="layers-chapter">Managing Layers</link> for
            more information on working with layers.
          </para>
        </note>
      </sect3>

      <sect3 id="select-none">
        <title>Select None</title>
        <para>
          <menuchoice><guimenu>Select</guimenu>
            <guimenuitem>None</guimenuitem>
          </menuchoice>
          option will deselect all objects. It has the
          same effect as double-clicking on a blank region of the canvas.
        </para>
      </sect3>


      <sect3 id="select-invert">
        <title>Select Invert</title>    


        <para>
          This option allows you to select all objects except for those currently
          selected. Say, for example, that you have 20 objects and wish to select
          all but two of them. You can do this by (1) selecting the two objects
          to be excluded and then (2) using the 
          <menuchoice>
            <guimenu>Select</guimenu>
            <guimenuitem>Invert</guimenuitem></menuchoice> menu (or Ctrl+I). 
          This will
          deselect the two currently-selected objects and select the 18 unselected
          objects. 
        </para>

        <tip>
          <para>
            Another way to do this is to <menuchoice><guimenu>Select</guimenu>
              <guimenuitem>All</guimenuitem>
            </menuchoice> (or Ctrl+A) and then use Shift+Click to deselect the 
            objects you don't need.
          </para>
        </tip>


      </sect3>
      <sect3 id="selection-transitive">
        <title>Select Transitive</title>
        <para>
          Objects in <application>Dia</application> can be connected using lines. The
          Select Transitive and Select Connected options allow you to select 
          objects based on how they are connected.
        </para>
        <para>
          The Select Transitive option selects ALL objects connected directly or 
          indirectly to the currently 
          selected objects,
          no matter how many levels deep the connection might be. To use this, select
          one or more objects and then choose    
          <menuchoice>
            <guimenu>Select</guimenu>
            <guimenuitem>Transitive</guimenuitem></menuchoice>. 
          All objects connected to the 
          initially selected objects will be added to the selected set.
        </para>

      </sect3>
      <sect3 id="selection-connected">
        <title>Select Connected</title>

        <para>
          This option is similar to Select Transitive except that it only adds
          objects that are immediately connected to an already-selected object.
          To use this option, first select one or more objects. Then choose 
          <menuchoice>  <guimenu>Select</guimenu> <guimenuitem>Connected</guimenuitem>
          </menuchoice>. Any objects that are directly connected to the currently 
          selected objects will be added to the selected set. 
        </para>
        <note>
          <para>
            The Select Connected option only goes out one level. For example, if box
            A is connected by a line to box B, and box A is selected, 
            <menuchoice>  <guimenu>Select</guimenu> <guimenuitem>Connected</guimenuitem>
            </menuchoice>
            will only select the line, not box B. If you do 
            <menuchoice>  <guimenu>Select</guimenu> <guimenuitem>Connected</guimenuitem>
            </menuchoice>
            a second time, then box B will also be connected.
          </para>
          <para>
            You can use <menuchoice>  <guimenu>Select</guimenu> <guimenuitem>Transitive
              </guimenuitem> </menuchoice>
            to select all objects connected to the currently selected objects in one operation.
          </para>
        </note>
      </sect3>

      <sect3 id="selection-same-type">
        <title>Select Same Type</title>                                            
        <para>
          This option allows you to select all objects that are the same type
          of object as one already selected. To use this option, select one or more
          objects and then choose the <menuchoice>
            <guimenu>Select</guimenu>
            <guimenuitem>Same Type</guimenuitem> </menuchoice> option. 
          All objects that are the 
          same type as one of the previously selected objects will be added to
          the set of selected objects.
        </para>
        <para>
          For example, if you want to select all of the Line objects on your diagram, 
          select one Line object and then use <menuchoice><guimenu>Select</guimenu>
            <guimenuitem>Same Type</guimenuitem></menuchoice> to select all other lines. 
        </para>
        <tip>
          <para>
            The menu choice 
            <menuchoice><guimenu>Select</guimenu>
              <guimenuitem>Same Type</guimenuitem></menuchoice> can be combined with 
            the menu choice 
            <menuchoice><guimenu>Objects</guimenu>
              <guimenuitem>Group</guimenuitem></menuchoice> to quickly change one or more
            properties of all objects of one type on your diagram. See
            <link linkend="changing-group-properties">
              Changing Properties for a Group of Objects</link> for 
            more information.
          </para>
        </tip>
        <note>
          <para>
            The object type must match exactly. For example, a Line object and a 
            Zigzagline object are different types.
          </para></note>
      </sect3>
    </sect2>
  </sect1>
  <sect1 id="working-with-selected">
    <title>Working With Selected Objects</title>
    <para>
      Once you have a set of selected objects, there are several things you may do with
      them.
    </para>
    <sect2 id="working-with-all">
      <title>Operations on All Selected Objects</title>
      <para>
        The following operations can be done on all selected objects as a set.
      </para>
      <sect3 id="move-selected">
        <title>Move Selected Objects</title>
        <para>
          You can move selected objects as a group, without changing their
          relative positions. To do this, place the mouse pointer inside a shape or
          on a blank spot on a line that is part of the selected set and then drag 
          to the desired new location. 
        </para>
      </sect3>
      <sect3 id="copy-selected0">
        <title>Copy, Cut, Paste, Duplicate, Delete</title>
        <para>
          You can perform any of the normal edit operations on a set of selected objects,
          just as you would for a single object, using either the shortcut key or the Edit
          menu. For example, to Duplicate a set of selected objects, select Edit / Duplicate
          or press Ctrl+D. A copy of the entire set of objects will be created on your
          canvas, just below and to the left of the original objects. Note that when you 
          Duplicate or Paste a set of objects, after the operation only the newly-created
          objects are selected.
        </para>
      </sect3>
      <sect3 id="individual-selected">
        <title>Working With Individual Objects</title>
        <para>
	  Due to limitations in the implementation some operations on single objects
	  in a selection were still only modifying the single object. Since dia 0.97
	  these inconsistency got resolved so the properties dialog allows to change
	  multiple objects properties at once - without first grouping them. 
	</para>
        <para>
          Also the single objects handles change behaviour in a selection (shown by 
	  slightly dimming them). Instead of resizing the single object they can just
	  be used to move the whole selection an align it on the grid, see 
	  <link linkend="gridlines">snap to grid</link> for details.
        </para>
        <tip>
          <para>
            When pulling up the properties dialog, be sure not to double-click on the 
            blank canvas or all of the objects will be deselected.
          </para>
        </tip>
      </sect3>
      <sect3 id="copy-selected">
        <title>Creating an Object Group</title>
        <para>
          As noted above, it is easy to create and remove sets of selected objects, 
          and a selection can be removed accidentally by double-clicking on a blank
          area of the canvas. If you wish to
          keep a set of selected objects as a permanent group so that you will not 
          accidentally deselect them, you can create an object group. Just select 
          <menuchoice>
            <guimenu>Objects</guimenu>
            <guimenuitem>Group</guimenuitem>
          </menuchoice> to create the group. 
          You can select 
          <menuchoice>
            <guimenu>Objects</guimenu>
            <guimenuitem>Ungroup</guimenuitem>
          </menuchoice> to remove the group.
          See <link linkend="grouping-objects">Grouping Objects</link> for 
          more information on groups.
        </para>
      </sect3>
    </sect2>
  </sect1>
</chapter>
