** \legal
** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
** Copyright 2006 Yue Shi Lai
+** Copyright (c) 2007 Chris Moore
**
** This package is free software; you can redistribute it and/or
** modify it under the terms of the GNU General Public License as
#include <synfig/mutex.h>
+#include "general.h"
+
#endif
/* === U S I N G =========================================================== */
render_idle_func_id=0;
}
+bool
+WorkArea::get_updating()const
+{
+ return App::single_threaded && async_renderer && async_renderer->updating;
+}
+
+void
+WorkArea::stop_updating(bool cancel)
+{
+ async_renderer->stop();
+ if (cancel) canceled_=true;
+}
+
void
WorkArea::save_meta_data()
{
WorkArea::set_focus_point(const synfig::Point &point)
{
// These next three lines try to ensure that we place the
- // focus on a pixel boundry
+ // focus on a pixel boundary
/*Point adjusted(point[0]/abs(get_pw()),point[1]/abs(get_ph()));
adjusted[0]=(abs(adjusted[0]-floor(adjusted[0]))<0.5)?floor(adjusted[0])*abs(get_pw()):ceil(adjusted[0])*abs(get_ph());
adjusted[1]=(abs(adjusted[1]-floor(adjusted[1]))<0.5)?floor(adjusted[1])*abs(get_ph()):ceil(adjusted[1])*abs(get_ph());
modifier=Gdk::ModifierType(event->button.state);
}
- // Make sure we recognise the device
+ // Make sure we recognize the device
if(curr_input_device)
{
if(curr_input_device!=device)
// GDK mouse scrolling events
else if(event->any.type==GDK_SCROLL)
{
- // GDK information needed to properly interprete mouse
+ // GDK information needed to properly interpret mouse
// scrolling events are: scroll.state, scroll.x/scroll.y, and
// scroll.direction. The value of scroll.direction will be
// obtained later.
if(get_selected_ducks().size()<=1)
duck->signal_user_click(2)();
else
- {
canvas_view->get_smach().process_event(EventMouse(EVENT_WORKAREA_MULTIPLE_DUCKS_CLICKED,BUTTON_RIGHT,mouse_pos,pressure,modifier));
- }
return true;
}
- else
- if(bezier)
+ else if(bezier)
{
bezier->signal_user_click(2)(bezier_click_pos);
return true;
}
- else
- if(layer)
+ else if (layer)
{
if(canvas_view->get_smach().process_event(EventLayerClick(layer,BUTTON_RIGHT,mouse_pos))==Smach::RESULT_OK)
return false;
signal_cursor_moved_();
- // Guide/Duck hilights on hover
+ // Guide/Duck highlights on hover
if(dragging==DRAG_NONE)
{
GuideList::iterator iter;
drawing_area->queue_draw();
}
+
if(dragging==DRAG_BOX)
{
curr_point=mouse_pos;
drawing_area->queue_draw();
}
+
if(dragging==DRAG_GUIDE)
{
if(curr_guide_is_x)
*curr_guide=mouse_pos[1];
drawing_area->queue_draw();
}
+
if(dragging!=DRAG_WINDOW)
{ // Update those triangle things on the rulers
const synfig::Point point(mouse_pos);
hruler->property_position()=Distance(point[0],Distance::SYSTEM_UNITS).get(App::distance_system,get_canvas()->rend_desc());
vruler->property_position()=Distance(point[1],Distance::SYSTEM_UNITS).get(App::distance_system,get_canvas()->rend_desc());
}
- if(dragging==DRAG_WINDOW)
- {
- set_focus_point(get_focus_point()+mouse_pos-drag_point);
- }
- else
- if(event->motion.state&GDK_BUTTON1_MASK && canvas_view->get_smach().process_event(EventMouse(EVENT_WORKAREA_MOUSE_BUTTON_DRAG,BUTTON_LEFT,mouse_pos,pressure,modifier))==Smach::RESULT_ACCEPT)
+
+ if(dragging == DRAG_WINDOW)
+ set_focus_point(get_focus_point() + mouse_pos-drag_point);
+ else if (event->motion.state & GDK_BUTTON1_MASK &&
+ canvas_view->get_smach().process_event(EventMouse(EVENT_WORKAREA_MOUSE_BUTTON_DRAG, BUTTON_LEFT,
+ mouse_pos,pressure,modifier)) == Smach::RESULT_ACCEPT)
return true;
- else
- if(event->motion.state&GDK_BUTTON2_MASK && canvas_view->get_smach().process_event(EventMouse(EVENT_WORKAREA_MOUSE_BUTTON_DRAG,BUTTON_MIDDLE,mouse_pos,pressure,modifier))==Smach::RESULT_ACCEPT)
+ else if (event->motion.state & GDK_BUTTON2_MASK &&
+ canvas_view->get_smach().process_event(EventMouse(EVENT_WORKAREA_MOUSE_BUTTON_DRAG, BUTTON_MIDDLE,
+ mouse_pos, pressure, modifier)) == Smach::RESULT_ACCEPT)
return true;
- else
- if(event->motion.state&GDK_BUTTON3_MASK && canvas_view->get_smach().process_event(EventMouse(EVENT_WORKAREA_MOUSE_BUTTON_DRAG,BUTTON_RIGHT,mouse_pos,pressure,modifier))==Smach::RESULT_ACCEPT)
+ else if (event->motion.state & GDK_BUTTON3_MASK &&
+ canvas_view->get_smach().process_event(EventMouse(EVENT_WORKAREA_MOUSE_BUTTON_DRAG, BUTTON_RIGHT,
+ mouse_pos, pressure, modifier)) == Smach::RESULT_ACCEPT)
return true;
- else
- if(canvas_view->get_smach().process_event(EventMouse(EVENT_WORKAREA_MOUSE_MOTION,BUTTON_NONE,mouse_pos,pressure,modifier))==Smach::RESULT_ACCEPT)
+ else if(canvas_view->get_smach().process_event(EventMouse(EVENT_WORKAREA_MOUSE_MOTION, BUTTON_NONE,
+ mouse_pos, pressure,modifier)) == Smach::RESULT_ACCEPT)
return true;
break;
+
case GDK_BUTTON_RELEASE:
{
bool ret(false);
bool
studio::WorkArea::async_update_preview()
{
+ if (get_updating())
+ {
+ stop_updating();
+ queue_render_preview();
+ return false;
+ }
+
async_renderer=0;
queued=false;
// Create the render target
handle<Target> target;
- if(w*h>(low_resolution?480*270:480*270/2))
+ // if we have lots of pixels to render and the tile renderer isn't disabled, use it
+ if(w*h>(low_resolution?480*270:480*270/2) &&
+ !getenv("SYNFIG_DISABLE_TILE_RENDER"))
{
+ // do a tile render
handle<WorkAreaTarget> trgt(new class WorkAreaTarget(this,w,h));
trgt->set_rend_desc(&desc);
}
else
{
+ // do a scanline render
handle<WorkAreaTarget_Full> trgt(new class WorkAreaTarget_Full(this,w,h));
trgt->set_rend_desc(&desc);
drawing_area->get_window()->set_cursor(Gdk::Cursor(x));
}
-#include "iconcontroler.h"
+#include "iconcontroller.h"
void
studio::WorkArea::refresh_cursor()
{
-// set_cursor(IconControler::get_tool_cursor(canvas_view->get_smach().get_state_name(),drawing_area->get_window()));
+// set_cursor(IconController::get_tool_cursor(canvas_view->get_smach().get_state_name(),drawing_area->get_window()));
}
void