X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-studio%2Ftrunk%2Fsrc%2Fgtkmm%2Fworkarea.cpp;h=edc989dc64f0e53691e0926ff1f5d7cda3c1e6a9;hb=9459638ad6797b8139f1e9f0715c96076dbf0890;hp=c4ab7d7a0b2dcff55fc71543b07c7cf7a86a0bd4;hpb=4460b1f4e8e6417f12630963a46325b2e107c1d7;p=synfig.git diff --git a/synfig-studio/trunk/src/gtkmm/workarea.cpp b/synfig-studio/trunk/src/gtkmm/workarea.cpp index c4ab7d7..edc989d 100644 --- a/synfig-studio/trunk/src/gtkmm/workarea.cpp +++ b/synfig-studio/trunk/src/gtkmm/workarea.cpp @@ -117,34 +117,38 @@ public: synfig::Mutex mutex; - void set_onion_skin(bool x) + void set_onion_skin(bool x, int *onions) { onionskin=x; Time time(rend_desc().get_time_start()); + if(!onionskin) + return; onion_skin_queue.push_back(time); - //onion_skin_queue.push_back(time-1); - //onion_skin_queue.push_back(time+1); try { - onion_skin_queue.push_back( - get_canvas()->keyframe_list().find_prev( - time - )->get_time() - ); + Time thistime=time; + for(int i=0; ikeyframe_list().find_prev(thistime)->get_time(); + onion_skin_queue.push_back(keytime); + thistime=keytime; + } } catch(...) { } try { - onion_skin_queue.push_back( - get_canvas()->keyframe_list().find_next( - time - )->get_time() - ); + Time thistime=time; + for(int i=0; ikeyframe_list().find_next(thistime)->get_time(); + onion_skin_queue.push_back(keytime); + thistime=keytime; + } } catch(...) { } @@ -413,36 +417,39 @@ public: std::list onion_skin_queue; - void set_onion_skin(bool x) + void set_onion_skin(bool x, int *onions) { onionskin=x; Time time(rend_desc().get_time_start()); + if(!onionskin) + return; onion_skin_queue.push_back(time); //onion_skin_queue.push_back(time-1); //onion_skin_queue.push_back(time+1); - if(!onionskin) - return; - try { - onion_skin_queue.push_back( - get_canvas()->keyframe_list().find_prev( - time - )->get_time() - ); + Time thistime=time; + for(int i=0; ikeyframe_list().find_prev(thistime)->get_time(); + onion_skin_queue.push_back(keytime); + thistime=keytime; + } } catch(...) { } try { - onion_skin_queue.push_back( - get_canvas()->keyframe_list().find_next( - time - )->get_time() - ); + Time thistime=time; + for(int i=0; ikeyframe_list().find_next(thistime)->get_time(); + onion_skin_queue.push_back(keytime); + thistime=keytime; + } } catch(...) { } @@ -672,6 +679,8 @@ WorkArea::WorkArea(etl::loose_handle canvas_interfac ph=0.001; last_focus_point=Point(0,0); onion_skin=false; + onion_skins[0]=0; + onion_skins[1]=0; queued=false; dirty_trap_enabled=false; solid_lines=true; @@ -1019,6 +1028,14 @@ WorkArea::get_onion_skin()const return onion_skin; } +void WorkArea::set_onion_skins(int *onions) +{ + onion_skins[0]=onions[0]; + onion_skins[1]=onions[1]; + if(onion_skin) + queue_render_preview(); +} + void WorkArea::enable_grid() { @@ -2283,13 +2300,13 @@ studio::WorkArea::async_update_preview() // if we have lots of pixels to render and the tile renderer isn't disabled, use it int div; div = low_resolution ? low_res_pixel_size : 1; - if (w*h > 240*div*135*div && !getenv("SYNFIG_DISABLE_TILE_RENDER")) + if ((w*h > 240*div*135*div && !getenv("SYNFIG_DISABLE_TILE_RENDER")) || getenv("SYNFIG_FORCE_TILE_RENDER")) { // do a tile render handle trgt(new class WorkAreaTarget(this,w,h)); trgt->set_rend_desc(&desc); - trgt->set_onion_skin(get_onion_skin()); + trgt->set_onion_skin(get_onion_skin(), onion_skins); target=trgt; } else @@ -2298,7 +2315,7 @@ studio::WorkArea::async_update_preview() handle trgt(new class WorkAreaTarget_Full(this,w,h)); trgt->set_rend_desc(&desc); - trgt->set_onion_skin(get_onion_skin()); + trgt->set_onion_skin(get_onion_skin(), onion_skins); target=trgt; } @@ -2545,7 +2562,7 @@ WorkArea::queue_scroll() drawing_area->queue_draw_area( 0, 0, 1, maxy); drawing_area->queue_draw_area(maxx-dx, 0, maxx-dx, maxy); } - else if (dx < 0) + else if (dx < 0) { drawing_area->queue_draw_area( maxx, 0, maxx, maxy); drawing_area->queue_draw_area( -dx, 0, -dx, maxy); @@ -2555,7 +2572,7 @@ WorkArea::queue_scroll() drawing_area->queue_draw_area(0, 0, maxx, 1); drawing_area->queue_draw_area(0, maxy-dy, maxx, maxy-dy); } - else if (dy < 0) + else if (dy < 0) { drawing_area->queue_draw_area(0, maxy, maxx, maxy); drawing_area->queue_draw_area(0, -dy, maxx, -dy); @@ -2581,7 +2598,8 @@ studio::WorkArea::zoom_out() void studio::WorkArea::zoom_fit() { - float new_zoom(min(drawing_area->get_width() * zoom / w, drawing_area->get_height() * zoom / h)); + float new_zoom(min(drawing_area->get_width() * zoom / w, + drawing_area->get_height() * zoom / h) * 0.995); if (zoom / new_zoom > 0.995 && new_zoom / zoom > 0.995) { set_zoom(prev_zoom); @@ -2649,7 +2667,7 @@ studio::WorkArea::queue_render_preview() //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, // priority - + 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