rotateable.cpp revision d2174ac16313900853b5b9bc82b6227fc348e2a6
/**
* \brief widget adjustable by dragging it to rotate away from a zero-change axis
*
* Authors:
* buliabyak@gmail.com
*
* Copyright (C) 2007 authors
*
* Released under GNU GPL. Read the file 'COPYING' for more information.
*/
#include "event-context.h"
#include "rotateable.h"
#include "libnr/nr-point.h"
#include "libnr/nr-point-fns.h"
#include <gtkmm/eventbox.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) {
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
dragging = false;
working = false;
current_axis = axis;
return true;
}
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 :