<?xml version="1.0" encoding="UTF-8"?>
<!--
 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
 * Copyright (C) INRIA
 *
 * Copyright (C) 2012 - 2016 - Scilab Enterprises
 *
 * This file is hereby licensed under the terms of the GNU GPL v2.0,
 * pursuant to article 5.3.4 of the CeCILL v.2.1.
 * This file was originally licensed under the terms of the CeCILL v2.1,
 * and continues to be available under such terms.
 * For more information, see the COPYING file which you should have received
 * along with this program.
 *
 -->
<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns4="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="rubberbox" xml:lang="pt">
    <refnamediv>
        <refname>rubberbox</refname>
        <refpurpose>Caixa tipo liga de borracha para seleção de um
            retângulo
        </refpurpose>
    </refnamediv>
    <refsynopsisdiv>
        <title>Seqüência de Chamamento</title>
        <synopsis>[final_rect,btn]=rubberbox()
            [final_rect,btn]=rubberbox(initial_rect)
            [final_rect,btn]=rubberbox(edition_mode)
            [final_rect,btn]=rubberbox(initial_rect, edition_mode)
        </synopsis>
    </refsynopsisdiv>
    <refsection>
        <title>Parâmetros</title>
        <variablelist>
            <varlistentry>
                <term>initial_rect</term>
                <listitem>
                    <para>vetor de duas a quatro entradas. Com quatro entradas fornece o
                        retângulo inicial definido por [x_esquerdo, y_topo, largura,
                        altura]. Com duas entradas, largura e altura são supostas 0.
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>edition_mode</term>
                <listitem>
                    <para>um booleano, se edition_mode==%t; um aperto de botão seleciona
                        a primeira quina, soltar seleciona a quina oposta. Se edition_mode==
                        %f, aperto de botão ou clique seleciona a primeira quina, um clique
                        é requerido para selecionar a quina oposta. O valor padrão é
                        edition_mode=%f
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>final_rect</term>
                <listitem>
                    <para>um retângulo definido por [x_esquerdo, y_topo, largura,
                        altura]
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>btn</term>
                <listitem>
                    <para>um inteiro, o número do botão do mouse clicado</para>
                </listitem>
            </varlistentry>
        </variablelist>
    </refsection>
    <refsection>
        <title>Descrição</title>
        <para>
            <literal>rubberbox(initial_rect)</literal> trilha uma caixa liga de
            borracha na janela de gráficos corrente, seguindo o mouse. Quando um botão
            é clicado, <literal>rubberbox</literal> retorna a definição dos retângulos
            finais <literal>final_Rect</literal>. Se o argumento
            <literal>initial_rect</literal> estiver presente, o usuário deve clicar
            para fixar a posição da quina inicial.
        </para>
    </refsection>
    <refsection>
        <title>Exemplos</title>
        <programlisting role="example"><![CDATA[
clf
plot2d()
a = gca();
db = a.data_bounds;
x0 = (db(1)*2+db(2))/3;
dx = (db(2)-db(1))/3;
y0 = (db(3)+db(4)*2)/3;
dy = (db(4)-db(3))/3;
xtitle(msprintf("With an initial starting corner: x0 = %0.2f, y0 = %0.2f",x0,y0))
r = rubberbox([x0 y0])
]]></programlisting>
        <programlisting role="example"><![CDATA[
clf
plot2d()
a = gca();
db = a.data_bounds;
x0 = (db(1)*2+db(2))/3;
dx = (db(2)-db(1))/3;
y0 = (db(3)+db(4)*2)/3;
dy = (db(4)-db(3))/3;
xtitle(msprintf("With an initial box: x0 = %0.2f, y0 = %0.2f, width = %0.2f, height = %0.2f,",x0-dx/4,y0+dy/5,2*dx,dy))
r = rubberbox([x0-dx/4 y0+dy/5 2*dx dy])
]]></programlisting>
        <programlisting role="example"><![CDATA[
clf
plot2d()
a = gca();
db = a.data_bounds;
x0 = (db(1)*2+db(2))/3;
dx = (db(2)-db(1))/3;
y0 = (db(3)+db(4)*2)/3;
dy = (db(4)-db(3))/3;
xtitle("In press -- drag -- release mode selection:")
r = rubberbox(%t)
]]></programlisting>
        <programlisting role="example"><![CDATA[
clf
plot2d()
a = gca();
db = a.data_bounds;
x0 = (db(1)*2+db(2))/3;
dx = (db(2)-db(1))/3;
y0 = (db(3)+db(4)*2)/3;
dy = (db(4)-db(3))/3;
xtitle("In starting click -- drag -- stopping click mode selection:")
r = rubberbox()
]]></programlisting>
    </refsection>
    <refsection role="see also">
        <title>Ver Também</title>
        <simplelist type="inline">
            <member>
                <link linkend="xrect">xrect</link>
            </member>
            <member>
                <link linkend="xrects">xrects</link>
            </member>
            <member>
                <link linkend="xclick">xclick</link>
            </member>
            <member>
                <link linkend="xgetmouse">xgetmouse</link>
            </member>
            <member>
                <link linkend="dragrect">dragrect</link>
            </member>
        </simplelist>
    </refsection>
</refentry>
