**
** This package is free software; you can redistribute it and/or
** modify it under the terms of the GNU General Public License as
**
** This package is free software; you can redistribute it and/or
** modify it under the terms of the GNU General Public License as
- x.set_rgb_p(
- x.get_red_p()*amount,
- x.get_green_p()*amount,
- x.get_blue_p()*amount
- );
+ double red = x.get_red_p() * amount;
+ double green = x.get_green_p() * amount;
+ double blue = x.get_blue_p() * amount;
+
+ x.set_rgb_p( red > 1 ? 1 : red,
+ green > 1 ? 1 : green,
+ blue > 1 ? 1 : blue);
+
if(selected)
gc->set_line_attributes(2,Gdk::LINE_SOLID,Gdk::CAP_BUTT,Gdk::JOIN_MITER);
else
if(selected)
gc->set_line_attributes(2,Gdk::LINE_SOLID,Gdk::CAP_BUTT,Gdk::JOIN_MITER);
else
points.push_back(Gdk::Point(area.get_x()+area.get_width()/2,area.get_y()+area.get_height()));
window->draw_polygon(gc,true,points);
gc->set_rgb_fg_color(black);
points.push_back(Gdk::Point(area.get_x()+area.get_width()/2,area.get_y()+area.get_height()));
window->draw_polygon(gc,true,points);
gc->set_rgb_fg_color(black);
points.push_back(Gdk::Point(area.get_x()+area.get_width()/2,area.get_y()+area.get_height()));
window->draw_polygon(gc,true,points);
gc->set_rgb_fg_color(black);
points.push_back(Gdk::Point(area.get_x()+area.get_width()/2,area.get_y()+area.get_height()));
window->draw_polygon(gc,true,points);
gc->set_rgb_fg_color(black);
points.push_back(Gdk::Point(area.get_x()+area.get_width()/2,area.get_y()));
points.push_back(Gdk::Point(area.get_x()+area.get_width()/3,area.get_y()));
points.push_back(Gdk::Point(area.get_x(),area.get_y()+area.get_height()/3));
points.push_back(Gdk::Point(area.get_x()+area.get_width()/2,area.get_y()));
points.push_back(Gdk::Point(area.get_x()+area.get_width()/3,area.get_y()));
points.push_back(Gdk::Point(area.get_x(),area.get_y()+area.get_height()/3));
points.push_back(Gdk::Point(area.get_x()+area.get_width()/3,area.get_y()+area.get_height()));
points.push_back(Gdk::Point(area.get_x()+area.get_width()/2,area.get_y()+area.get_height()));
window->draw_polygon(gc,true,points);
gc->set_rgb_fg_color(black);
points.push_back(Gdk::Point(area.get_x()+area.get_width()/3,area.get_y()+area.get_height()));
points.push_back(Gdk::Point(area.get_x()+area.get_width()/2,area.get_y()+area.get_height()));
window->draw_polygon(gc,true,points);
gc->set_rgb_fg_color(black);
points.push_back(Gdk::Point(area.get_x()+area.get_width()/2,area.get_y()+area.get_height()));
window->draw_polygon(gc,true,points);
gc->set_rgb_fg_color(black);
points.push_back(Gdk::Point(area.get_x()+area.get_width()/2,area.get_y()+area.get_height()));
window->draw_polygon(gc,true,points);
gc->set_rgb_fg_color(black);
points.push_back(Gdk::Point(area.get_x()+area.get_width()/2,area.get_y()));
points.push_back(Gdk::Point(area.get_x()+area.get_width(),area.get_y()));
points.push_back(Gdk::Point(area.get_x()+area.get_width(),area.get_y()+area.get_height()/2));
points.push_back(Gdk::Point(area.get_x()+area.get_width()/2,area.get_y()));
points.push_back(Gdk::Point(area.get_x()+area.get_width(),area.get_y()));
points.push_back(Gdk::Point(area.get_x()+area.get_width(),area.get_y()+area.get_height()/2));
- points.push_back(Gdk::Point(area.get_x()+area.get_width()*3/4,area.get_y()+area.get_height()/2));
- points.push_back(Gdk::Point(area.get_x()+area.get_width()*3/4,area.get_y()+area.get_height()));
+ points.push_back(Gdk::Point(area.get_x()+area.get_width()-area.get_width()/4,area.get_y()+area.get_height()/2));
+ points.push_back(Gdk::Point(area.get_x()+area.get_width()-area.get_width()/4,area.get_y()+area.get_height()));
points.push_back(Gdk::Point(area.get_x()+area.get_width()/2,area.get_y()+area.get_height()));
window->draw_polygon(gc,true,points);
gc->set_rgb_fg_color(black);
points.push_back(Gdk::Point(area.get_x()+area.get_width()/2,area.get_y()+area.get_height()));
window->draw_polygon(gc,true,points);
gc->set_rgb_fg_color(black);
break;
case INTERPOLATION_UNDEFINED: default:
points.clear();
points.push_back(Gdk::Point(area.get_x()+area.get_width()/2,area.get_y()));
break;
case INTERPOLATION_UNDEFINED: default:
points.clear();
points.push_back(Gdk::Point(area.get_x()+area.get_width()/2,area.get_y()));
- points.push_back(Gdk::Point(area.get_x()+area.get_width(),area.get_y()+area.get_height()*2/3));
- points.push_back(Gdk::Point(area.get_x()+area.get_width()*2/3,area.get_y()+area.get_height()));
+ points.push_back(Gdk::Point(area.get_x()+area.get_width(),area.get_y()+area.get_height()-area.get_height()/3));
+ points.push_back(Gdk::Point(area.get_x()+area.get_width()-area.get_width()/3,area.get_y()+area.get_height()));
points.push_back(Gdk::Point(area.get_x()+area.get_width()/2,area.get_y()+area.get_height()));
window->draw_polygon(gc,true,points);
gc->set_rgb_fg_color(black);
points.push_back(Gdk::Point(area.get_x()+area.get_width()/2,area.get_y()+area.get_height()));
window->draw_polygon(gc,true,points);
gc->set_rgb_fg_color(black);
/* === M E T H O D S ======================================================= */
/* === E N T R Y P O I N T ================================================= */
/* === M E T H O D S ======================================================= */
/* === E N T R Y P O I N T ================================================= */
//disconnect old connections
time_value_change.disconnect();
time_other_change.disconnect();
//disconnect old connections
time_value_change.disconnect();
time_other_change.disconnect();
double l = adj_timescale->get_lower(),
u = adj_timescale->get_upper(),
v = adj_timescale->get_value();
double l = adj_timescale->get_lower(),
u = adj_timescale->get_upper(),
v = adj_timescale->get_value();
//Get the data for the window and the params to draw it...
int w = get_width(), h = get_height();
//Get the data for the window and the params to draw it...
int w = get_width(), h = get_height();
-
- window->draw_rectangle(gc,true,0,0,w,h);
-
+
+ window->draw_rectangle(gc,true,0,0,w,h);
+
double start = adj_timescale->get_lower(),
end = adj_timescale->get_upper(),
current = adj_timescale->get_value();
double start = adj_timescale->get_lower(),
end = adj_timescale->get_upper(),
current = adj_timescale->get_value();
//Draw the time line...
double tpx = (current-start)*dpdt;
gc->set_rgb_fg_color(Gdk::Color("#ffaf00"));
window->draw_line(gc,round_to_int(tpx),0,round_to_int(tpx),fullheight);
//Draw the time line...
double tpx = (current-start)*dpdt;
gc->set_rgb_fg_color(Gdk::Color("#ffaf00"));
window->draw_line(gc,round_to_int(tpx),0,round_to_int(tpx),fullheight);
//1h 45 30 20 10 5
//..., 3m, 2m, 1m30s, 1m, 30s, 20s, 10s, 5s, 3s, 2s, 1s, 0.5s
//frames... (how???)
//1h 45 30 20 10 5
//..., 3m, 2m, 1m30s, 1m, 30s, 20s, 10s, 5s, 3s, 2s, 1s, 0.5s
//frames... (how???)
{ 1.0/fps,subdiv/fps,0.25,0.5, 1, 2, 3, 5, 10, 20, 30, 60, 90, 120, 180, 300, 600, 1200, 1800, 2700, 3600 };
//{ 3600, 2700, 1800, 1200, 600, 300, 180, 120, 90, 60, 30, 20, 10, 5, 3, 2, 1, 0.5 };
const int ranges_size = sizeof(ranges)/sizeof(double);
{ 1.0/fps,subdiv/fps,0.25,0.5, 1, 2, 3, 5, 10, 20, 30, 60, 90, 120, 180, 300, 600, 1200, 1800, 2700, 3600 };
//{ 3600, 2700, 1800, 1200, 600, 300, 180, 120, 90, 60, 30, 20, 10, 5, 3, 2, 1, 0.5 };
const int ranges_size = sizeof(ranges)/sizeof(double);
double lowerrange = dtdp*75, upperrange = dtdp*150;
double midrange = (lowerrange + upperrange)/2;
double lowerrange = dtdp*75, upperrange = dtdp*150;
double midrange = (lowerrange + upperrange)/2;
//find most ideal scale
double scale = ranges[0];
{
double *val = binary_find(ranges, ranges+ranges_size, midrange);
double *after = val+1;
//find most ideal scale
double scale = ranges[0];
{
double *val = binary_find(ranges, ranges+ranges_size, midrange);
double *after = val+1;
-
- //synfig::info("Range found: (l %.2lf,u %.2lf - m %.2lf) -> %.2lf",lowerrange,upperrange,midrange,scale);
-
- //search around this area to get the right one
-
-
- //get first valid line and it's position in pixel space
+
+ //synfig::info("Range found: (l %.2lf,u %.2lf - m %.2lf) -> %.2lf",lowerrange,upperrange,midrange,scale);
+
+ //search around this area to get the right one
+
+
+ //get first valid line and its position in pixel space
{ //inside the big'n
double t = (time/scale - floor(time/scale))*subdiv; // the difference from the big mark in 0:1
//sdindex = (int)floor(t + 0.5); //get how far through the range it is...
sdindex = round_to_int(t); //get how far through the range it is...
{ //inside the big'n
double t = (time/scale - floor(time/scale))*subdiv; // the difference from the big mark in 0:1
//sdindex = (int)floor(t + 0.5); //get how far through the range it is...
sdindex = round_to_int(t); //get how far through the range it is...
//synfig::info("Initial values: %.4lf t, %.1lf pixels, %d i", time,pixel,sdindex);
//synfig::info("Initial values: %.4lf t, %.1lf pixels, %d i", time,pixel,sdindex);
if(sdindex == 0)
{
window->draw_line(gc,xpx,0,xpx,heightbig);
if(sdindex == 0)
{
window->draw_line(gc,xpx,0,xpx,heightbig);
Time tm((double)time);
if(get_global_fps()) tm.round(get_global_fps());
Glib::ustring timecode(tm.get_string(get_global_fps(),App::get_time_format()));
Time tm((double)time);
if(get_global_fps()) tm.round(get_global_fps());
Glib::ustring timecode(tm.get_string(get_global_fps(),App::get_time_format()));
//gc->set_rgb_fg_color(Gdk::Color("#000000"));
layout->set_text(timecode);
window->draw_layout(gc,xpx+2,heightsmall,layout);
}else
{
//gc->set_rgb_fg_color(Gdk::Color("#000000"));
layout->set_text(timecode);
window->draw_layout(gc,xpx+2,heightsmall,layout);
}else
{
- window->draw_line(gc,xpx,0,xpx,heightsmall);
+ window->draw_line(gc,xpx,0,xpx,heightsmall);
double start = adj_timescale->get_lower(),
end = adj_timescale->get_upper();
double start = adj_timescale->get_lower(),
end = adj_timescale->get_upper();
//Note: Use inverse of mouse movement because of conceptual space relationship
double diff = lastx - curx; //curx - lastx;
//Note: Use inverse of mouse movement because of conceptual space relationship
double diff = lastx - curx; //curx - lastx;
//synfig::info("Scrolling timerange to (%.4f,%.4f)",start,end);
//synfig::info("Scrolling timerange to (%.4f,%.4f)",start,end);
//get time from drag...
double start = adj_timescale->get_lower(),
end = adj_timescale->get_upper(),
current = adj_timescale->get_value();
double t = start + curx*(end - start)/get_width();
//get time from drag...
double start = adj_timescale->get_lower(),
end = adj_timescale->get_upper(),
current = adj_timescale->get_value();
double t = start + curx*(end - start)/get_width();
+
+ return true;
+ }
+
+ case GDK_SCROLL_RIGHT:
+ case GDK_SCROLL_LEFT:
+ {
+ double t = adj_timescale->get_value();
+ double start = adj_timescale->get_lower();
+ double end = adj_timescale->get_upper();
+ /*
+ FIXME: be more intelligent about how far to scroll
+ Perhaps it should be based on the tickmarks?
+ for e.g. 1/4 of a tick mark per scroll event
+ Obviously this would need post-rounding to 1/fps
+ */
+ double adj = 1.0/fps;
+
+ if( event->direction == GDK_SCROLL_RIGHT )
+ t += adj;
+ else
+ t -= adj;
+
+ if( t < start ){
+ adj_timescale->set_lower(t);
+ adj_timescale->set_upper(t+end-start);
+ } else if( t > end ){
+ adj_timescale->set_upper(t);
+ adj_timescale->set_lower(t-end+start);
+ }
+
+ if(adj_timescale)
+ {
+ adj_timescale->set_value(t);
+ adj_timescale->value_changed();
+ }
double start = adj_timescale->get_lower(),
end = adj_timescale->get_upper(),
current = adj_timescale->get_value();
double start = adj_timescale->get_lower(),
end = adj_timescale->get_upper(),
current = adj_timescale->get_value();
//calculate new beginning and end
end = focuspoint + (end-focuspoint)*zoominfactor;
start = focuspoint + (start-focuspoint)*zoominfactor;
//calculate new beginning and end
end = focuspoint + (end-focuspoint)*zoominfactor;
start = focuspoint + (start-focuspoint)*zoominfactor;
//synfig::info("Zooming in timerange to (%.4f,%.4f)",start,end);
if(adj_bounds)
{
//synfig::info("Zooming in timerange to (%.4f,%.4f)",start,end);
if(adj_bounds)
{
double start = adj_timescale->get_lower(),
end = adj_timescale->get_upper(),
current = adj_timescale->get_value();
double start = adj_timescale->get_lower(),
end = adj_timescale->get_upper(),
current = adj_timescale->get_value();
//calculate new beginning and end
end = focuspoint + (end-focuspoint)*zoomoutfactor;
start = focuspoint + (start-focuspoint)*zoomoutfactor;
//calculate new beginning and end
end = focuspoint + (end-focuspoint)*zoomoutfactor;
start = focuspoint + (start-focuspoint)*zoomoutfactor;
//synfig::info("Zooming out timerange to (%.4f,%.4f)",start,end);
if(adj_bounds)
{
//synfig::info("Zooming out timerange to (%.4f,%.4f)",start,end);
if(adj_bounds)
{
double start = adj_timescale->get_lower(),
end = adj_timescale->get_upper(),
current = adj_timescale->get_value();
double start = adj_timescale->get_lower(),
end = adj_timescale->get_upper(),
current = adj_timescale->get_value();
current, vt, start, end, event->x, w, fps);*/
current, vt, start, end, event->x, w, fps);*/