/*! \file preview.cpp
** \brief Preview implementation file
**
-** $Id: preview.cpp,v 1.2 2005/01/10 08:13:44 darco Exp $
+** $Id$
**
** \legal
** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
+** 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 <algorithm>
#include "asyncrenderer.h"
+
+#include "general.h"
+
#endif
/* === U S I N G =========================================================== */
return false;
}
- virtual bool start_frame(ProgressCallback *cb=NULL)
+ virtual bool start_frame(ProgressCallback */*cb*/=NULL)
{
return true;
}
//setting the description
- //HACK - BECAUSE THE RENDERER CAN'T RENDER INCLUDING THE LAST FRAME
- desc.set_time_end(desc.get_time_end() + 1.3/fps);
+ //HACK - add on one extra frame because the renderer can't render the last frame
+ desc.set_time_end(desc.get_time_end() + 1.000001/fps);
target->set_rend_desc(&desc);
if(!buffer)
return;
- //convert all the pixles to the pixbuf... buffer... thing...
+ //convert all the pixels to the pixbuf... buffer... thing...
//synfig::warning("Converting...");
convert_color_format(buffer, surf[0], surf.get_w()*surf.get_h(), pf, App::gamma);
hbox = manage(new Gtk::HBox);
button = &b_loop;
- IMAGIFY_BUTTON(button,Gtk::Stock::REFRESH,"Toggle Looping");
+ IMAGIFY_BUTTON(button,Gtk::Stock::REFRESH,_("Toggle Looping"));
hbox->pack_start(b_loop,Gtk::PACK_SHRINK,0);
//attach(b_loop,0,1,2,3,Gtk::EXPAND|Gtk::FILL,Gtk::SHRINK);
button = manage(new Gtk::Button(/*_("Play")*/));
button->signal_clicked().connect(sigc::mem_fun(*this,&Widget_Preview::play));
- IMAGIFY_BUTTON(button,Gtk::Stock::GO_FORWARD,"Play");
+ IMAGIFY_BUTTON(button,Gtk::Stock::GO_FORWARD,_("Play"));
hbox->pack_start(*button,Gtk::PACK_SHRINK,0);
//attach(*button,1,2,2,3,Gtk::EXPAND|Gtk::FILL,Gtk::SHRINK);
button = manage(new Gtk::Button(/*_("Stop")*/));
button->signal_clicked().connect(sigc::mem_fun(*this,&Widget_Preview::stop));
- IMAGIFY_BUTTON(button,Gtk::Stock::NO,"Stop");
+ IMAGIFY_BUTTON(button,Gtk::Stock::NO,_("Stop"));
hbox->pack_start(*button,Gtk::PACK_SHRINK,0);
//attach(*button,2,3,2,3,Gtk::EXPAND|Gtk::FILL,Gtk::SHRINK);
button = manage(new Gtk::Button(/*_("Halt Render")*/));
button->signal_clicked().connect(sigc::mem_fun(*this,&Widget_Preview::stoprender));
- IMAGIFY_BUTTON(button,Gtk::Stock::STOP,"Halt Render");
+ IMAGIFY_BUTTON(button,Gtk::Stock::STOP,_("Halt Render"));
hbox->pack_start(*button,Gtk::PACK_SHRINK,0);
//attach(*button,2,3,3,4,Gtk::EXPAND|Gtk::FILL,Gtk::SHRINK);
button = manage(new Gtk::Button(/*_("Re-Preview")*/));
button->signal_clicked().connect(sigc::mem_fun(*this,&Widget_Preview::repreview));
- IMAGIFY_BUTTON(button,Gtk::Stock::CONVERT,"Re-Preview");
+ IMAGIFY_BUTTON(button,Gtk::Stock::CONVERT,_("Re-Preview"));
hbox->pack_start(*button,Gtk::PACK_SHRINK,0);
//attach(*button,0,2,4,5,Gtk::EXPAND|Gtk::FILL,Gtk::SHRINK);
button = manage(new Gtk::Button(/*_("Erase All")*/));
button->signal_clicked().connect(sigc::mem_fun(*this,&Widget_Preview::eraseall));
- IMAGIFY_BUTTON(button,Gtk::Stock::DELETE,"Erase All");
+ IMAGIFY_BUTTON(button,Gtk::Stock::DELETE,_("Erase All"));
hbox->pack_start(*button,Gtk::PACK_SHRINK,0);
//attach(*button,2,3,4,5,Gtk::EXPAND|Gtk::FILL,Gtk::SHRINK);
//3rd row
hbox = manage(new Gtk::HBox);
{
- Gtk::Label *label = manage(new Gtk::Label("Last Rendered: "));
+ Gtk::Label *label = manage(new Gtk::Label(_("Last Rendered: ")));
//label->show();
hbox->pack_start(*label,Gtk::PACK_SHRINK,10);
- //attach(*manage(new Gtk::Label("Last Rendered: ")),0,1,3,4,Gtk::SHRINK,Gtk::SHRINK);
+ //attach(*manage(new Gtk::Label(_("Last Rendered: "))),0,1,3,4,Gtk::SHRINK,Gtk::SHRINK);
}
//l_lasttime.show();
hbox->pack_start(l_lasttime,Gtk::PACK_SHRINK,0);
draw_area.queue_draw();//on_expose_event();
}
-bool studio::Widget_Preview::redraw(GdkEventExpose *heh)
+bool studio::Widget_Preview::redraw(GdkEventExpose */*heh*/)
{
//And render the drawing area
Glib::RefPtr<Gdk::Pixbuf> pxnew, px = currentbuf;
}
}
-void studio::Widget_Preview::set_preview(handle<Preview> prev)
+void studio::Widget_Preview::set_preview(etl::handle<Preview> prev)
{
preview = prev;
{
if(preview)
{
- preview->renderer.detach();
+ // don't crash if the render has already been stopped
+ if (!preview->renderer)
+ return;
+
+ if (preview->renderer->updating)
+ preview->renderer->stop();
+ else
+ preview->renderer.detach();
}
}