Use rubberband for box selection

This commit is contained in:
wmayer 2013-07-02 10:04:33 +02:00
parent 7533517bb2
commit 20c57d3a33
7 changed files with 24 additions and 20 deletions

View File

@ -1972,7 +1972,7 @@ void StdBoxSelection::activated(int iMsg)
if (view) {
View3DInventorViewer* viewer = view->getViewer();
if (!viewer->isSelecting()) {
viewer->startSelection(View3DInventorViewer::Rectangle);
viewer->startSelection(View3DInventorViewer::Rubberband);
viewer->addEventCallback(SoMouseButtonEvent::getClassTypeId(), selectionCallback);
}
}

View File

@ -576,7 +576,6 @@ bool Document::saveAs(void)
if (!fn.isEmpty()) {
QFileInfo fi;
fi.setFile(fn);
QString bn = fi.baseName();
const char * DocName = App::GetApplication().getDocumentName(getDocument());

View File

@ -755,7 +755,7 @@ int RectangleSelection::keyboardEvent( const SoKeyboardEvent * const e )
// -----------------------------------------------------------------------------------
class Rubberband::Private : public Gui::GLGraphicsItem
class RubberbandSelection::Private : public Gui::GLGraphicsItem
{
Gui::View3DInventorViewer* viewer;
int x_old, y_old, x_new, y_new;
@ -813,16 +813,16 @@ public:
}
};
Rubberband::Rubberband()
RubberbandSelection::RubberbandSelection()
{
d = 0;
}
Rubberband::~Rubberband()
RubberbandSelection::~RubberbandSelection()
{
}
void Rubberband::initialize()
void RubberbandSelection::initialize()
{
d = new Private(_pcView3D);
_pcView3D->addGraphicsItem(d);
@ -830,7 +830,7 @@ void Rubberband::initialize()
_pcView3D->scheduleRedraw();
}
void Rubberband::terminate()
void RubberbandSelection::terminate()
{
_pcView3D->removeGraphicsItem(d);
delete d; d = 0;
@ -838,11 +838,11 @@ void Rubberband::terminate()
_pcView3D->scheduleRedraw();
}
void Rubberband::draw ()
void RubberbandSelection::draw ()
{
}
int Rubberband::mouseButtonEvent(const SoMouseButtonEvent * const e, const QPoint& pos)
int RubberbandSelection::mouseButtonEvent(const SoMouseButtonEvent * const e, const QPoint& pos)
{
const int button = e->getButton();
const SbBool press = e->getState() == SoButtonEvent::DOWN ? TRUE : FALSE;
@ -881,7 +881,7 @@ int Rubberband::mouseButtonEvent(const SoMouseButtonEvent * const e, const QPoin
return ret;
}
int Rubberband::locationEvent(const SoLocation2Event * const e, const QPoint& pos)
int RubberbandSelection::locationEvent(const SoLocation2Event * const e, const QPoint& pos)
{
m_iXnew = pos.x();
m_iYnew = pos.y();
@ -890,7 +890,7 @@ int Rubberband::locationEvent(const SoLocation2Event * const e, const QPoint& po
return Continue;
}
int Rubberband::keyboardEvent(const SoKeyboardEvent * const e)
int RubberbandSelection::keyboardEvent(const SoKeyboardEvent * const e)
{
return Continue;
}
@ -907,7 +907,7 @@ BoxZoomSelection::~BoxZoomSelection()
void BoxZoomSelection::terminate()
{
Rubberband::terminate();
RubberbandSelection::terminate();
int xmin = std::min<int>(m_iXold, m_iXnew);
int xmax = std::max<int>(m_iXold, m_iXnew);

View File

@ -231,11 +231,11 @@ private:
* Draws a rectangle for selection
* \author Werner Mayer
*/
class GuiExport Rubberband : public BaseMouseSelection
class GuiExport RubberbandSelection : public BaseMouseSelection
{
public:
Rubberband();
virtual ~Rubberband();
RubberbandSelection();
virtual ~RubberbandSelection();
/// do nothing
virtual void initialize();
@ -262,7 +262,7 @@ private:
* Draws a rectangle for box zooming
* \author Werner Mayer
*/
class GuiExport BoxZoomSelection : public Rubberband
class GuiExport BoxZoomSelection : public RubberbandSelection
{
public:
BoxZoomSelection();

View File

@ -1068,6 +1068,9 @@ void NavigationStyle::startSelection(NavigationStyle::SelectionMode mode)
case Rectangle:
mouseSelection = new RectangleSelection();
break;
case Rubberband:
mouseSelection = new RubberbandSelection();
break;
case BoxZoom:
mouseSelection = new BoxZoomSelection();
break;

View File

@ -87,8 +87,9 @@ public:
enum SelectionMode {
Lasso = 0, /**< Select objects using a lasso. */
Rectangle = 1, /**< Select objects using a rectangle. */
BoxZoom = 2, /**< Perform a box zoom. */
Clip = 3, /**< Clip objects using a lasso. */
Rubberband = 2, /**< Select objects using a rubberband. */
BoxZoom = 3, /**< Perform a box zoom. */
Clip = 4, /**< Clip objects using a lasso. */
};
enum OrbitStyle {

View File

@ -78,8 +78,9 @@ public:
enum SelectionMode {
Lasso = 0, /**< Select objects using a lasso. */
Rectangle = 1, /**< Select objects using a rectangle. */
BoxZoom = 2, /**< Perform a box zoom. */
Clip = 3, /**< Clip objects using a lasso. */
Rubberband = 2, /**< Select objects using a rubberband. */
BoxZoom = 3, /**< Perform a box zoom. */
Clip = 4, /**< Clip objects using a lasso. */
};
/** @name Modus handling of the viewer
* Here the you can switch on/off several features