Esempio n. 1
0
void CropTool::buttonEvent(ButtonType type, bool isPress, int x, int y)
{
    if (!isPress || (type != LEFT))
    {
        return;
    }

    if (x1 == -1)
    {
        x1 = x;
        y1 = y;

        x2 = x;
        y2 = y;

        draw_xor_rect(getRect());
    }
    else
    {
        draw_xor_rect(getRect());

        x2 = x;
        y2 = y;

        crop();

        // disable drawing in deactivate
        x1 = -1;
    }
}
Esempio n. 2
0
void ZoomInTool::moveEvent(int x, int y)
{
    draw_xor_rect(rect);

    rect.x = x;
    rect.y = y;

    draw_xor_rect(rect);
}
Esempio n. 3
0
void CropTool::moveEvent(int x, int y)
{
    if (x1 != -1)
    {
        draw_xor_rect(getRect());

        x2 = x;
        y2 = y;

        draw_xor_rect(getRect());
    }
}
Esempio n. 4
0
void ZoomInTool::buttonEvent(ButtonType type, bool isPress, int x, int y)
{
    if (!isPress)
    {
        // button has been released, stop changing zoom box size if we
        // were doing that
        killTimer();

        return;
    }

    // don't accept additional clicks while timer is active (other than
    // middle click)
    if ((timer_id != -1) && ((type == LEFT) || (type == RIGHT)))
    {
        return;
    }

    intptr_t zoom_dir = 0;

    if (type == LEFT)
    {
        zoom_dir = 1;
    }
    else if (type == MIDDLE)
    {
        zoom();
    }
    else if (type == RIGHT)
    {
        zoom_dir = -1;
    }

    if (zoom_dir)
    {
        draw_xor_rect(rect);

        resizeRect(zoom_dir);

        if (!rectIsValidSize())
        {
            resizeRect(-zoom_dir);
        }
        else
        {
            timer_id = g_timeout_add(ZOOM_INTERVAL,
                                     (GtkFunction)zoom_in_callback,
                                     (void*)(2 * zoom_dir));
        }

        draw_xor_rect(rect);
    }
}
Esempio n. 5
0
void ZoomInTool::timerCallback(int arg)
{
    draw_xor_rect(rect);

    resizeRect(arg);

    if (!rectIsValidSize())
    {
        resizeRect(-arg);
    }

    draw_xor_rect(rect);
}
Esempio n. 6
0
void
meta_effects_update_wireframe (MetaScreen          *screen,
                               const MetaRectangle *old_rect,
                               int                  old_width,
                               int                  old_height,
                               const MetaRectangle *new_rect,
                               int                  new_width,
                               int                  new_height)
{
  if (old_rect)
    draw_xor_rect (screen, old_rect, old_width, old_height);

  if (new_rect)
    draw_xor_rect (screen, new_rect, new_width, new_height);

  XFlush (screen->display->xdisplay);
}
Esempio n. 7
0
void ZoomInTool::deactivate()
{
    draw_xor_rect(rect);

    killTimer();

    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbarButton), FALSE);
}
Esempio n. 8
0
void CropTool::deactivate()
{
    if (x1 != -1)
    {
        draw_xor_rect(getRect());
        x1 = -1;
    }

    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbarButton), FALSE);
}
Esempio n. 9
0
bool ZoomInTool::activate()
{
    rect.x = 0;
    rect.y = 0;
    rect.width = int(ZOOM_BOX_WIDTH * img->user_width);
    rect.height = int(rect.width / img->ratio);

    draw_xor_rect(rect);

    return true;
}