/* === S Y N F I G ========================================================= */
-/*! \file template.cpp
+/*! \file renderer_guides.cpp
** \brief Template File
**
-** $Id: renderer_guides.cpp,v 1.1.1.1 2005/01/07 03:34:36 darco Exp $
+** $Id$
**
** \legal
** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
Renderer_Guides::Renderer_Guides():
dragging(false)
{
-
+
}
Renderer_Guides::~Renderer_Guides()
float pressure(0);
bool is_mouse(false);
Gdk::ModifierType modifier(Gdk::ModifierType(0));
-
+
// Handle input stuff
if(
event->any.type==GDK_MOTION_NOTIFY ||
device=event->button.device;
modifier=Gdk::ModifierType(event->button.state);
}
-
- // Make sure we recognise the device
+
+ // Make sure we recognize the device
/*if(curr_input_device)
{
if(curr_input_device!=device)
curr_input_device=device;
signal_input_device_changed()(curr_input_device);
}
- }
+ }
else*/ if(device)
{
//curr_input_device=device;
//signal_input_device_changed()(curr_input_device);
- }
+ }
//assert(curr_input_device);
-
+
// Calculate the position of the
// input device in canvas coordinates
// and the buttons
//synfig::info("pressure=%f",pressure);
pressure-=0.04f;
pressure/=1.0f-0.04f;
-
-
+
+
assert(!isnan(pressure));
-
+
mouse_pos=synfig::Point(screen_to_comp_coords(synfig::Point(x,y)));
-
+
button_pressed=event->button.button;
-
+
if(button_pressed==1 && pressure<0 && (event->any.type!=GDK_BUTTON_RELEASE && event->any.type!=GDK_BUTTON_PRESS))
button_pressed=0;
if(pressure<0)
//if(event->any.type==GDK_BUTTON_PRESS && button_pressed)
// synfig::info("Button pressed on input device = %d",event->button.button);
-
+
//if(event->button.axes[2]>0.1)
// button_pressed=1;
//else
- // button_pressed=0;
+ // button_pressed=0;
}
}
switch(event->type)
default:
break;
}
-
+
return false;
}
void
Renderer_Guides::render_vfunc(
const Glib::RefPtr<Gdk::Drawable>& drawable,
- const Gdk::Rectangle& expose_area
+ const Gdk::Rectangle& /*expose_area*/
)
{
assert(get_work_area());
if(!get_work_area())
return;
-
+
// const synfig::RendDesc &rend_desc(get_work_area()->get_canvas()->rend_desc());
-
+
const synfig::Vector focus_point(get_work_area()->get_focus_point());
//std::vector< std::pair<Glib::RefPtr<Gdk::Pixbuf>,int> >& tile_book(get_tile_book());
-
+
int drawable_w,drawable_h;
drawable->get_size(drawable_w,drawable_h);
-
+
// Calculate the window coordinates of the top-left
// corner of the canvas.
// const synfig::Vector::value_type
// const int
// w(get_w()),
// h(get_h());
-
+
Glib::RefPtr<Gdk::GC> gc(Gdk::GC::create(drawable));
-
+
//const synfig::Vector grid_size(get_grid_size());
const synfig::Vector::value_type window_startx(get_work_area()->get_window_tl()[0]);
gc->set_function(Gdk::COPY);
gc->set_rgb_fg_color(Gdk::Color("#9f9fff"));
gc->set_line_attributes(1,Gdk::LINE_ON_OFF_DASH,Gdk::CAP_BUTT,Gdk::JOIN_MITER);
-
+
Duckmatic::GuideList::const_iterator iter;
-
+
// vertical
for(iter=get_guide_list_x().begin();iter!=get_guide_list_x().end();++iter)
{
const float x((*iter-window_startx)/pw);
-
+
if(iter==get_work_area()->curr_guide)
gc->set_rgb_fg_color(Gdk::Color("#ff6f6f"));
else
gc->set_rgb_fg_color(Gdk::Color("#6f6fff"));
-
+
drawable->draw_line(gc,
round_to_int(x),
0,