rotateable.cpp revision e1a317d2efe4c87286797c6cd13a5ccefefa5e7a
/*
* Authors:
* buliabyak@gmail.com
*
* Copyright (C) 2007 authors
*
* Released under GNU GPL. Read the file 'COPYING' for more information.
*/
#include <gtkmm/eventbox.h>
#include "event-context.h"
#include "rotateable.h"
namespace Inkscape {
namespace UI {
namespace Widget {
Rotateable::Rotateable():
{
dragging = false;
working = false;
modifier = 0;
current_axis = axis;
}
drag_started_x = event->x;
drag_started_y = event->y;
dragging = true;
working = false;
current_axis = axis;
return true;
}
return false;
}
if (state & GDK_CONTROL_MASK)
return 1; // ctrl
if (state & GDK_SHIFT_MASK)
return 2; // shift
if (state & GDK_MOD1_MASK)
return 3; // alt
return 0;
} else {
if (state & GDK_MOD1_MASK)
return 3; // alt
else
return 0; // none
}
if (old == 1) {
return 2; // shift
return 3; // alt
return 1;
}
if (old == 2) {
return 1; // ctrl
return 3; // alt
return 2;
}
return old;
}
}
if (dragging) {
double dist = Geom::L2(Geom::Point(event->x, event->y) - Geom::Point(drag_started_x, drag_started_y));
if (dist > 20) {
working = true;
force = 0; // snap to zero
// user has switched modifiers in mid drag, close past drag and start a new
// one, redefining axis temporarily
} else {
}
}
return true;
}
return false;
}
force = 0; // snap to zero
current_axis = axis;
dragging = false;
working = false;
return true;
}
dragging = false;
working = false;
return false;
}
Rotateable::~Rotateable() {
}
} // namespace Widget
} // namespace UI
} // namespace Inkscape
/*
Local Variables:
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0)(inline-open . 0))
indent-tabs-mode:nil
fill-column:99
End:
*/
// vim: filetype=c++:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :