/*! \file preview.cpp
** \brief Preview implementation file
**
** $Id: preview.cpp,v 1.2 2005/01/10 08:13:44 darco Exp $
**
** \legal
/*! \file preview.cpp
** \brief Preview implementation file
**
** $Id: preview.cpp,v 1.2 2005/01/10 08:13:44 darco Exp $
**
** \legal
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
+** This package is free software; you can redistribute it and/or
+** modify it under the terms of the GNU General Public License as
+** published by the Free Software Foundation; either version 2 of
+** the License, or (at your option) any later version.
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
+** This package is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+** General Public License for more details.
- /*sinfg::warning("Succeeded in setting the desc to new one: %d x %d, %.2f fps [%.2f,%.2f]",
+ /*synfig::warning("Succeeded in setting the desc to new one: %d x %d, %.2f fps [%.2f,%.2f]",
desc.get_w(),desc.get_h(),desc.get_frame_rate(),
(float)desc.get_time_start(),(float)desc.get_time_end());*/
desc.get_w(),desc.get_h(),desc.get_frame_rate(),
(float)desc.get_time_start(),(float)desc.get_time_end());*/
- /*sinfg::warning("Setting the render description: %d x %d, %f fps, [%f,%f]",
+ /*synfig::warning("Setting the render description: %d x %d, %f fps, [%f,%f]",
neww,newh,newfps, overbegin?begintime:(float)desc.get_time_start(),
overend?endtime:(float)desc.get_time_end());*/
neww,newh,newfps, overbegin?begintime:(float)desc.get_time_start(),
overend?endtime:(float)desc.get_time_end());*/
unsigned char *buffer((unsigned char*)malloc(total_bytes));
if(!buffer)
return;
//convert all the pixles to the pixbuf... buffer... thing...
unsigned char *buffer((unsigned char*)malloc(total_bytes));
if(!buffer)
return;
//convert all the pixles to the pixbuf... buffer... thing...
convert_color_format(buffer, surf[0], surf.get_w()*surf.get_h(), pf, App::gamma);
//load time
fe.t = time;
//uses and manages the memory for the buffer...
convert_color_format(buffer, surf[0], surf.get_w()*surf.get_h(), pf, App::gamma);
//load time
fe.t = time;
//uses and manages the memory for the buffer...
fe.buf =
Gdk::Pixbuf::create_from_data(
buffer, // pointer to the data
fe.buf =
Gdk::Pixbuf::create_from_data(
buffer, // pointer to the data
adj_time_scrub(0,0,1000,1,10,0),
scr_time_scrub(adj_time_scrub),
b_loop(/*_("Loop")*/),
adj_time_scrub(0,0,1000,1,10,0),
scr_time_scrub(adj_time_scrub),
b_loop(/*_("Loop")*/),
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));
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));
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));
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));
hbox->pack_start(*button,Gtk::PACK_SHRINK,0);
//attach(*button,2,3,2,3,Gtk::EXPAND|Gtk::FILL,Gtk::SHRINK);
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));
button = manage(new Gtk::Button(/*_("Halt Render")*/));
button->signal_clicked().connect(sigc::mem_fun(*this,&Widget_Preview::stoprender));
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));
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));
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));
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));
hbox->pack_start(*button,Gtk::PACK_SHRINK,0);
//attach(*button,2,3,4,5,Gtk::EXPAND|Gtk::FILL,Gtk::SHRINK);
hbox->pack_start(*button,Gtk::PACK_SHRINK,0);
//attach(*button,2,3,4,5,Gtk::EXPAND|Gtk::FILL,Gtk::SHRINK);
//use time to find closest frame...
studio::Preview::FlipBook::const_iterator beg = preview->begin(),end = preview->end();
//use time to find closest frame...
studio::Preview::FlipBook::const_iterator beg = preview->begin(),end = preview->end();
//incrementally go in either direction
//(bias downward towards beg, because that's what we want)
for(;i != end;++i)
{
//incrementally go in either direction
//(bias downward towards beg, because that's what we want)
for(;i != end;++i)
{
sx = draw_area.get_width() / (float)px->get_width();
sy = draw_area.get_height() / (float)px->get_height();
sx = draw_area.get_width() / (float)px->get_width();
sy = draw_area.get_height() / (float)px->get_height();
//copy to window
Glib::RefPtr<Gdk::Window> wind = draw_area.get_window();
Glib::RefPtr<Gdk::Drawable> surf = Glib::RefPtr<Gdk::Drawable>::cast_static(wind);
//copy to window
Glib::RefPtr<Gdk::Window> wind = draw_area.get_window();
Glib::RefPtr<Gdk::Drawable> surf = Glib::RefPtr<Gdk::Drawable>::cast_static(wind);
- if(!wind) sinfg::warning("The destination window is broken...");
- if(!surf) sinfg::warning("The destination is not drawable...");
+ if(!wind) synfig::warning("The destination window is broken...");
+ if(!surf) synfig::warning("The destination is not drawable...");
Glib::ustring timecode(Time((double)timedisp).round(preview->get_global_fps())
.get_string(preview->get_global_fps(),
App::get_time_format()));
Glib::ustring timecode(Time((double)timedisp).round(preview->get_global_fps())
.get_string(preview->get_global_fps(),
App::get_time_format()));
- //sinfg::info("Time for preview draw is: %s for time %g", timecode.c_str(), adj_time_scrub.get_value());
+ //synfig::info("Time for preview draw is: %s for time %g", timecode.c_str(), adj_time_scrub.get_value());
- //sinfg::info("Scrubbing to %.3f, setting adj to %.3f",oldt,t);
+ //synfig::info("Scrubbing to %.3f, setting adj to %.3f",oldt,t);
prevchanged = prev->signal_changed().connect(sigc::mem_fun(*this,&Widget_Preview::whenupdated));
prev->signal_destroyed().connect(sigc::mem_fun(*this,&Widget_Preview::disconnect_preview));
update();
prevchanged = prev->signal_changed().connect(sigc::mem_fun(*this,&Widget_Preview::whenupdated));
prev->signal_destroyed().connect(sigc::mem_fun(*this,&Widget_Preview::disconnect_preview));
update();
//audiotime = adj_time_scrub.get_value();
playing = true;
//adj_time_scrub.set_value(adj_time_scrub.get_lower());
update(); //we don't want to call play update because that will try to advance the timer
//audiotime = adj_time_scrub.get_value();
playing = true;
//adj_time_scrub.set_value(adj_time_scrub.get_lower());
update(); //we don't want to call play update because that will try to advance the timer
//approximate length of time in seconds, right?
double rate = /*std::min(*/adj_time_scrub.get_step_increment()/*,1/30.0)*/;
int timeout = (int)floor(1000*rate);
//approximate length of time in seconds, right?
double rate = /*std::min(*/adj_time_scrub.get_step_increment()/*,1/30.0)*/;
int timeout = (int)floor(1000*rate);