if(!data.empty())
{
if(!load_sketch(data))
- load_sketch(dirname(canvas->get_file_name())+ETL_DIRECTORY_SEPERATOR+basename(data));
+ load_sketch(dirname(canvas->get_file_name())+ETL_DIRECTORY_SEPARATOR+basename(data));
}
}
WorkArea::~WorkArea()
{
// delete [] buffer;
+
+ // don't leave the render function queued if we are about to vanish;
+ // that causes crashes
+ if(render_idle_func_id)
+ {
+ synfig::info("g_source_remove() returns %d", g_source_remove(render_idle_func_id));
+ render_idle_func_id=0;
+ } else
+ synfig::info("no render_idle_func_id to clear\n");
}
void
}
}
-
// Calculate the window coordinates of the top-left
// corner of the canvas.
//const synfig::Vector::value_type
Glib::RefPtr<Gdk::GC> gc=Gdk::GC::create(drawing_area->get_window());
-
-
// If we are in animate mode, draw a red border around the screen
if(canvas_interface->get_mode()&synfigapp::MODE_ANIMATE)
{
- /*gc->set_rgb_fg_color(Gdk::Color("#FF0000"));
+// #define USE_FRAME_BACKGROUND_TO_SHOW_EDIT_MODE
+#ifdef USE_FRAME_BACKGROUND_TO_SHOW_EDIT_MODE
+ // This method of drawing the red border doesn't work on any
+ // Gtk theme which uses the crux-engine, hcengine, industrial,
+ // mist, or ubuntulooks engine, such as the default ubuntu
+ // 'Human' theme.
+ drawing_frame->modify_bg(Gtk::STATE_NORMAL,Gdk::Color("#FF0000"));
+#else
+ // So let's do it in a more primitive fashion.
+ gc->set_rgb_fg_color(Gdk::Color("#FF0000"));
gc->set_line_attributes(1,Gdk::LINE_SOLID,Gdk::CAP_BUTT,Gdk::JOIN_MITER);
drawing_area->get_window()->draw_rectangle(
gc,
false, // Fill?
0,0, // x,y
- drawing_area->get_width()-1,drawing_area->get_height()-1 //w,h
- );
- */
- drawing_frame->modify_bg(Gtk::STATE_NORMAL,Gdk::Color("#FF0000"));
- //get_window()->set_background(Gdk::Color("#FF0000"));
+ drawing_area->get_width()-1,drawing_area->get_height()-1); // w,h
+#endif
}
+#ifdef USE_FRAME_BACKGROUND_TO_SHOW_EDIT_MODE
else
drawing_frame->unset_bg(Gtk::STATE_NORMAL);
-
-
+#endif
previous_focus=get_focus_point();
}
+namespace studio
+{
class WorkAreaProgress : public synfig::ProgressCallback
{
WorkArea *work_area;
return cb->amount_complete(current,total);
}
};
+}
bool
studio::WorkArea::async_update_preview()
if(!async_renderer)
return;
- // If we completed successfuly, then
+ // If we completed successfully, then
// we aren't dirty anymore
if(async_renderer->has_success())
{
dirty=false;
get_canvas_view()->reset_cancel_status();
- bool ret=false;
RendDesc desc=get_canvas()->rend_desc();
//newdesc->set_flags(RendDesc::PX_ASPECT|RendDesc::IM_SPAN);
if(cb)
cb->task(strprintf("Rendering canvas %s...",get_canvas()->get_name().c_str()));
- target->render(cb);
+ bool ret = target->render(cb);
if(!ret && !get_canvas_view()->get_cancel_status() && dirty)
{
// it is being displayed correctly
drawing_area->queue_draw();
- // If we completed successfuly, then
+ // If we completed successfully, then
// we aren't dirty anymore
if(ret)
{
gboolean
studio::WorkArea::__render_preview(gpointer data)
{
-
WorkArea *work_area(static_cast<WorkArea*>(data));
+ // there's no point anyone trying to cancel the timer now - it's gone off already
+ work_area->render_idle_func_id = 0;
+
work_area->queued=false;
work_area->async_render_preview(work_area->get_canvas_view()->get_time());
{
//synfig::info("queue_render_preview(): (re)queuing...");
//render_idle_func_id=g_idle_add_full(G_PRIORITY_DEFAULT,__render_preview,this,NULL);
- render_idle_func_id=g_timeout_add_full(G_PRIORITY_DEFAULT,queue_time,__render_preview,this,NULL);
+ render_idle_func_id=g_timeout_add_full(
+ G_PRIORITY_DEFAULT, // priority -
+ queue_time, // interval - the time between calls to the function, in milliseconds (1/1000ths of a second)
+ __render_preview, // function - function to call
+ this, // data - data to pass to function
+ NULL); // notify - function to call when the idle is removed, or NULL
queued=true;
}
/* else if(rendering)