diff --git a/3d-viewer/3d_cache/dialogs/panel_prev_3d_base.cpp b/3d-viewer/3d_cache/dialogs/panel_prev_3d_base.cpp index 35efd84ae3..12f012dcea 100644 --- a/3d-viewer/3d_cache/dialogs/panel_prev_3d_base.cpp +++ b/3d-viewer/3d_cache/dialogs/panel_prev_3d_base.cpp @@ -21,7 +21,7 @@ PANEL_PREV_3D_BASE::PANEL_PREV_3D_BASE( wxWindow* parent, wxWindowID id, const w vbScale = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Scale") ), wxVERTICAL ); wxFlexGridSizer* fgSizerScale; - fgSizerScale = new wxFlexGridSizer( 0, 2, 0, 0 ); + fgSizerScale = new wxFlexGridSizer( 0, 3, 0, 0 ); fgSizerScale->SetFlexibleDirection( wxBOTH ); fgSizerScale->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); @@ -30,21 +30,30 @@ PANEL_PREV_3D_BASE::PANEL_PREV_3D_BASE( wxWindow* parent, wxWindowID id, const w fgSizerScale->Add( m_staticText1, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); xscale = new wxTextCtrl( vbScale->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - fgSizerScale->Add( xscale, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); + fgSizerScale->Add( xscale, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); + + m_spinXscale = new wxSpinButton( vbScale->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_VERTICAL ); + fgSizerScale->Add( m_spinXscale, 0, wxALIGN_CENTER_VERTICAL, 5 ); m_staticText2 = new wxStaticText( vbScale->GetStaticBox(), wxID_ANY, _("Y:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText2->Wrap( -1 ); fgSizerScale->Add( m_staticText2, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); yscale = new wxTextCtrl( vbScale->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - fgSizerScale->Add( yscale, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); + fgSizerScale->Add( yscale, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); + + m_spinYscale = new wxSpinButton( vbScale->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_VERTICAL ); + fgSizerScale->Add( m_spinYscale, 0, wxALIGN_CENTER_VERTICAL, 5 ); m_staticText3 = new wxStaticText( vbScale->GetStaticBox(), wxID_ANY, _("Z:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText3->Wrap( -1 ); fgSizerScale->Add( m_staticText3, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); zscale = new wxTextCtrl( vbScale->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - fgSizerScale->Add( zscale, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); + fgSizerScale->Add( zscale, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT, 5 ); + + m_spinZscale = new wxSpinButton( vbScale->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_VERTICAL ); + fgSizerScale->Add( m_spinZscale, 0, wxALIGN_CENTER_VERTICAL, 5 ); vbScale->Add( fgSizerScale, 1, wxEXPAND, 5 ); @@ -56,7 +65,7 @@ PANEL_PREV_3D_BASE::PANEL_PREV_3D_BASE( wxWindow* parent, wxWindowID id, const w vbRotate = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Rotation (degrees)") ), wxVERTICAL ); wxFlexGridSizer* fgSizerRotate; - fgSizerRotate = new wxFlexGridSizer( 0, 2, 0, 0 ); + fgSizerRotate = new wxFlexGridSizer( 0, 3, 0, 0 ); fgSizerRotate->SetFlexibleDirection( wxBOTH ); fgSizerRotate->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); @@ -73,7 +82,10 @@ PANEL_PREV_3D_BASE::PANEL_PREV_3D_BASE( wxWindow* parent, wxWindowID id, const w #else xrot->SetMaxLength( 9 ); #endif - fgSizerRotate->Add( xrot, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); + fgSizerRotate->Add( xrot, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); + + m_spinXrot = new wxSpinButton( vbRotate->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_VERTICAL ); + fgSizerRotate->Add( m_spinXrot, 0, wxALIGN_CENTER_VERTICAL, 5 ); m_staticText21 = new wxStaticText( vbRotate->GetStaticBox(), wxID_ANY, _("Y:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText21->Wrap( -1 ); @@ -88,7 +100,10 @@ PANEL_PREV_3D_BASE::PANEL_PREV_3D_BASE( wxWindow* parent, wxWindowID id, const w #else yrot->SetMaxLength( 9 ); #endif - fgSizerRotate->Add( yrot, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); + fgSizerRotate->Add( yrot, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); + + m_spinYrot = new wxSpinButton( vbRotate->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_VERTICAL ); + fgSizerRotate->Add( m_spinYrot, 0, wxALIGN_CENTER_VERTICAL, 5 ); m_staticText31 = new wxStaticText( vbRotate->GetStaticBox(), wxID_ANY, _("Z:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText31->Wrap( -1 ); @@ -103,7 +118,10 @@ PANEL_PREV_3D_BASE::PANEL_PREV_3D_BASE( wxWindow* parent, wxWindowID id, const w #else zrot->SetMaxLength( 9 ); #endif - fgSizerRotate->Add( zrot, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); + fgSizerRotate->Add( zrot, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT, 5 ); + + m_spinZrot = new wxSpinButton( vbRotate->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_VERTICAL ); + fgSizerRotate->Add( m_spinZrot, 0, wxALIGN_CENTER_VERTICAL, 5 ); vbRotate->Add( fgSizerRotate, 1, wxEXPAND, 5 ); @@ -115,7 +133,7 @@ PANEL_PREV_3D_BASE::PANEL_PREV_3D_BASE( wxWindow* parent, wxWindowID id, const w vbOffset = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Offset") ), wxVERTICAL ); wxFlexGridSizer* fgSizerOffset; - fgSizerOffset = new wxFlexGridSizer( 0, 2, 0, 0 ); + fgSizerOffset = new wxFlexGridSizer( 0, 3, 0, 0 ); fgSizerOffset->SetFlexibleDirection( wxBOTH ); fgSizerOffset->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); @@ -124,21 +142,30 @@ PANEL_PREV_3D_BASE::PANEL_PREV_3D_BASE( wxWindow* parent, wxWindowID id, const w fgSizerOffset->Add( m_staticText12, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); xoff = new wxTextCtrl( vbOffset->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - fgSizerOffset->Add( xoff, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); + fgSizerOffset->Add( xoff, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); + + m_spinXoffset = new wxSpinButton( vbOffset->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_VERTICAL ); + fgSizerOffset->Add( m_spinXoffset, 0, wxALIGN_CENTER_VERTICAL, 5 ); m_staticText22 = new wxStaticText( vbOffset->GetStaticBox(), wxID_ANY, _("Y:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText22->Wrap( -1 ); fgSizerOffset->Add( m_staticText22, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); yoff = new wxTextCtrl( vbOffset->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - fgSizerOffset->Add( yoff, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); + fgSizerOffset->Add( yoff, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); + + m_spinYoffset = new wxSpinButton( vbOffset->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_VERTICAL ); + fgSizerOffset->Add( m_spinYoffset, 0, wxALIGN_CENTER_VERTICAL, 5 ); m_staticText32 = new wxStaticText( vbOffset->GetStaticBox(), wxID_ANY, _("Z:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText32->Wrap( -1 ); fgSizerOffset->Add( m_staticText32, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); zoff = new wxTextCtrl( vbOffset->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - fgSizerOffset->Add( zoff, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); + fgSizerOffset->Add( zoff, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT, 5 ); + + m_spinZoffset = new wxSpinButton( vbOffset->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_VERTICAL ); + fgSizerOffset->Add( m_spinZoffset, 0, wxALIGN_CENTER_VERTICAL, 5 ); vbOffset->Add( fgSizerOffset, 1, wxEXPAND, 5 ); @@ -216,15 +243,42 @@ PANEL_PREV_3D_BASE::PANEL_PREV_3D_BASE( wxWindow* parent, wxWindowID id, const w this->Layout(); // Connect Events + xscale->Connect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( PANEL_PREV_3D_BASE::onMouseWheelScale ), NULL, this ); xscale->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_PREV_3D_BASE::updateOrientation ), NULL, this ); + m_spinXscale->Connect( wxEVT_SCROLL_LINEDOWN, wxSpinEventHandler( PANEL_PREV_3D_BASE::onDecrementScale ), NULL, this ); + m_spinXscale->Connect( wxEVT_SCROLL_LINEUP, wxSpinEventHandler( PANEL_PREV_3D_BASE::onIncrementScale ), NULL, this ); + yscale->Connect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( PANEL_PREV_3D_BASE::onMouseWheelScale ), NULL, this ); yscale->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_PREV_3D_BASE::updateOrientation ), NULL, this ); + m_spinYscale->Connect( wxEVT_SCROLL_LINEDOWN, wxSpinEventHandler( PANEL_PREV_3D_BASE::onDecrementScale ), NULL, this ); + m_spinYscale->Connect( wxEVT_SCROLL_LINEUP, wxSpinEventHandler( PANEL_PREV_3D_BASE::onIncrementScale ), NULL, this ); + zscale->Connect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( PANEL_PREV_3D_BASE::onMouseWheelScale ), NULL, this ); zscale->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_PREV_3D_BASE::updateOrientation ), NULL, this ); + m_spinZscale->Connect( wxEVT_SCROLL_LINEDOWN, wxSpinEventHandler( PANEL_PREV_3D_BASE::onDecrementScale ), NULL, this ); + m_spinZscale->Connect( wxEVT_SCROLL_LINEUP, wxSpinEventHandler( PANEL_PREV_3D_BASE::onIncrementScale ), NULL, this ); + xrot->Connect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( PANEL_PREV_3D_BASE::onMouseWheelRot ), NULL, this ); xrot->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_PREV_3D_BASE::updateOrientation ), NULL, this ); + m_spinXrot->Connect( wxEVT_SCROLL_LINEDOWN, wxSpinEventHandler( PANEL_PREV_3D_BASE::onDecrementRot ), NULL, this ); + m_spinXrot->Connect( wxEVT_SCROLL_LINEUP, wxSpinEventHandler( PANEL_PREV_3D_BASE::onIncrementRot ), NULL, this ); + yrot->Connect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( PANEL_PREV_3D_BASE::onMouseWheelRot ), NULL, this ); yrot->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_PREV_3D_BASE::updateOrientation ), NULL, this ); + m_spinYrot->Connect( wxEVT_SCROLL_LINEDOWN, wxSpinEventHandler( PANEL_PREV_3D_BASE::onDecrementRot ), NULL, this ); + m_spinYrot->Connect( wxEVT_SCROLL_LINEUP, wxSpinEventHandler( PANEL_PREV_3D_BASE::onIncrementRot ), NULL, this ); + zrot->Connect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( PANEL_PREV_3D_BASE::onMouseWheelRot ), NULL, this ); zrot->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_PREV_3D_BASE::updateOrientation ), NULL, this ); + m_spinZrot->Connect( wxEVT_SCROLL_LINEDOWN, wxSpinEventHandler( PANEL_PREV_3D_BASE::onDecrementRot ), NULL, this ); + m_spinZrot->Connect( wxEVT_SCROLL_LINEUP, wxSpinEventHandler( PANEL_PREV_3D_BASE::onIncrementRot ), NULL, this ); + xoff->Connect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( PANEL_PREV_3D_BASE::onMouseWheelOffset ), NULL, this ); xoff->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_PREV_3D_BASE::updateOrientation ), NULL, this ); + m_spinXoffset->Connect( wxEVT_SCROLL_LINEDOWN, wxSpinEventHandler( PANEL_PREV_3D_BASE::onDecrementOffset ), NULL, this ); + m_spinXoffset->Connect( wxEVT_SCROLL_LINEUP, wxSpinEventHandler( PANEL_PREV_3D_BASE::onIncrementOffset ), NULL, this ); + yoff->Connect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( PANEL_PREV_3D_BASE::onMouseWheelOffset ), NULL, this ); yoff->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_PREV_3D_BASE::updateOrientation ), NULL, this ); + m_spinYoffset->Connect( wxEVT_SCROLL_LINEDOWN, wxSpinEventHandler( PANEL_PREV_3D_BASE::onDecrementOffset ), NULL, this ); + m_spinYoffset->Connect( wxEVT_SCROLL_LINEUP, wxSpinEventHandler( PANEL_PREV_3D_BASE::onIncrementOffset ), NULL, this ); + zoff->Connect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( PANEL_PREV_3D_BASE::onMouseWheelOffset ), NULL, this ); zoff->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_PREV_3D_BASE::updateOrientation ), NULL, this ); + m_spinZoffset->Connect( wxEVT_SCROLL_LINEDOWN, wxSpinEventHandler( PANEL_PREV_3D_BASE::onDecrementOffset ), NULL, this ); + m_spinZoffset->Connect( wxEVT_SCROLL_LINEUP, wxSpinEventHandler( PANEL_PREV_3D_BASE::onIncrementOffset ), NULL, this ); m_bpvISO->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREV_3D_BASE::View3DISO ), NULL, this ); m_bpvLeft->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREV_3D_BASE::View3DLeft ), NULL, this ); m_bpvFront->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREV_3D_BASE::View3DFront ), NULL, this ); @@ -238,15 +292,42 @@ PANEL_PREV_3D_BASE::PANEL_PREV_3D_BASE( wxWindow* parent, wxWindowID id, const w PANEL_PREV_3D_BASE::~PANEL_PREV_3D_BASE() { // Disconnect Events + xscale->Disconnect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( PANEL_PREV_3D_BASE::onMouseWheelScale ), NULL, this ); xscale->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_PREV_3D_BASE::updateOrientation ), NULL, this ); + m_spinXscale->Disconnect( wxEVT_SCROLL_LINEDOWN, wxSpinEventHandler( PANEL_PREV_3D_BASE::onDecrementScale ), NULL, this ); + m_spinXscale->Disconnect( wxEVT_SCROLL_LINEUP, wxSpinEventHandler( PANEL_PREV_3D_BASE::onIncrementScale ), NULL, this ); + yscale->Disconnect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( PANEL_PREV_3D_BASE::onMouseWheelScale ), NULL, this ); yscale->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_PREV_3D_BASE::updateOrientation ), NULL, this ); + m_spinYscale->Disconnect( wxEVT_SCROLL_LINEDOWN, wxSpinEventHandler( PANEL_PREV_3D_BASE::onDecrementScale ), NULL, this ); + m_spinYscale->Disconnect( wxEVT_SCROLL_LINEUP, wxSpinEventHandler( PANEL_PREV_3D_BASE::onIncrementScale ), NULL, this ); + zscale->Disconnect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( PANEL_PREV_3D_BASE::onMouseWheelScale ), NULL, this ); zscale->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_PREV_3D_BASE::updateOrientation ), NULL, this ); + m_spinZscale->Disconnect( wxEVT_SCROLL_LINEDOWN, wxSpinEventHandler( PANEL_PREV_3D_BASE::onDecrementScale ), NULL, this ); + m_spinZscale->Disconnect( wxEVT_SCROLL_LINEUP, wxSpinEventHandler( PANEL_PREV_3D_BASE::onIncrementScale ), NULL, this ); + xrot->Disconnect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( PANEL_PREV_3D_BASE::onMouseWheelRot ), NULL, this ); xrot->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_PREV_3D_BASE::updateOrientation ), NULL, this ); + m_spinXrot->Disconnect( wxEVT_SCROLL_LINEDOWN, wxSpinEventHandler( PANEL_PREV_3D_BASE::onDecrementRot ), NULL, this ); + m_spinXrot->Disconnect( wxEVT_SCROLL_LINEUP, wxSpinEventHandler( PANEL_PREV_3D_BASE::onIncrementRot ), NULL, this ); + yrot->Disconnect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( PANEL_PREV_3D_BASE::onMouseWheelRot ), NULL, this ); yrot->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_PREV_3D_BASE::updateOrientation ), NULL, this ); + m_spinYrot->Disconnect( wxEVT_SCROLL_LINEDOWN, wxSpinEventHandler( PANEL_PREV_3D_BASE::onDecrementRot ), NULL, this ); + m_spinYrot->Disconnect( wxEVT_SCROLL_LINEUP, wxSpinEventHandler( PANEL_PREV_3D_BASE::onIncrementRot ), NULL, this ); + zrot->Disconnect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( PANEL_PREV_3D_BASE::onMouseWheelRot ), NULL, this ); zrot->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_PREV_3D_BASE::updateOrientation ), NULL, this ); + m_spinZrot->Disconnect( wxEVT_SCROLL_LINEDOWN, wxSpinEventHandler( PANEL_PREV_3D_BASE::onDecrementRot ), NULL, this ); + m_spinZrot->Disconnect( wxEVT_SCROLL_LINEUP, wxSpinEventHandler( PANEL_PREV_3D_BASE::onIncrementRot ), NULL, this ); + xoff->Disconnect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( PANEL_PREV_3D_BASE::onMouseWheelOffset ), NULL, this ); xoff->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_PREV_3D_BASE::updateOrientation ), NULL, this ); + m_spinXoffset->Disconnect( wxEVT_SCROLL_LINEDOWN, wxSpinEventHandler( PANEL_PREV_3D_BASE::onDecrementOffset ), NULL, this ); + m_spinXoffset->Disconnect( wxEVT_SCROLL_LINEUP, wxSpinEventHandler( PANEL_PREV_3D_BASE::onIncrementOffset ), NULL, this ); + yoff->Disconnect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( PANEL_PREV_3D_BASE::onMouseWheelOffset ), NULL, this ); yoff->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_PREV_3D_BASE::updateOrientation ), NULL, this ); + m_spinYoffset->Disconnect( wxEVT_SCROLL_LINEDOWN, wxSpinEventHandler( PANEL_PREV_3D_BASE::onDecrementOffset ), NULL, this ); + m_spinYoffset->Disconnect( wxEVT_SCROLL_LINEUP, wxSpinEventHandler( PANEL_PREV_3D_BASE::onIncrementOffset ), NULL, this ); + zoff->Disconnect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( PANEL_PREV_3D_BASE::onMouseWheelOffset ), NULL, this ); zoff->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_PREV_3D_BASE::updateOrientation ), NULL, this ); + m_spinZoffset->Disconnect( wxEVT_SCROLL_LINEDOWN, wxSpinEventHandler( PANEL_PREV_3D_BASE::onDecrementOffset ), NULL, this ); + m_spinZoffset->Disconnect( wxEVT_SCROLL_LINEUP, wxSpinEventHandler( PANEL_PREV_3D_BASE::onIncrementOffset ), NULL, this ); m_bpvISO->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREV_3D_BASE::View3DISO ), NULL, this ); m_bpvLeft->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREV_3D_BASE::View3DLeft ), NULL, this ); m_bpvFront->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREV_3D_BASE::View3DFront ), NULL, this ); diff --git a/3d-viewer/3d_cache/dialogs/panel_prev_3d_base.fbp b/3d-viewer/3d_cache/dialogs/panel_prev_3d_base.fbp index 7ee26d67d4..64d70a3fcd 100644 --- a/3d-viewer/3d_cache/dialogs/panel_prev_3d_base.fbp +++ b/3d-viewer/3d_cache/dialogs/panel_prev_3d_base.fbp @@ -42,7 +42,7 @@ PANEL_PREV_3D_BASE - 504,285 + 503,371 @@ -110,7 +110,7 @@ wxEXPAND 1 - 2 + 3 wxBOTH @@ -206,7 +206,7 @@ 5 - wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL + wxALIGN_CENTER_VERTICAL|wxLEFT 0 1 @@ -281,7 +281,7 @@ - + onMouseWheelScale @@ -295,6 +295,90 @@ + + 5 + wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_spinXscale + 1 + + + protected + 1 + + Resizable + 1 + + wxSP_ARROW_KEYS|wxSP_VERTICAL + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + onDecrementScale + onIncrementScale + + + 5 wxALIGN_CENTER_VERTICAL|wxLEFT @@ -380,7 +464,7 @@ 5 - wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL + wxALIGN_CENTER_VERTICAL|wxLEFT 0 1 @@ -455,7 +539,7 @@ - + onMouseWheelScale @@ -469,6 +553,90 @@ + + 5 + wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_spinYscale + 1 + + + protected + 1 + + Resizable + 1 + + wxSP_ARROW_KEYS|wxSP_VERTICAL + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + onDecrementScale + onIncrementScale + + + 5 wxALIGN_CENTER_VERTICAL|wxLEFT @@ -554,7 +722,7 @@ 5 - wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL + wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT 0 1 @@ -629,7 +797,7 @@ - + onMouseWheelScale @@ -643,6 +811,90 @@ + + 5 + wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_spinZscale + 1 + + + protected + 1 + + Resizable + 1 + + wxSP_ARROW_KEYS|wxSP_VERTICAL + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + onDecrementScale + onIncrementScale + + + @@ -665,7 +917,7 @@ wxEXPAND 1 - 2 + 3 wxBOTH @@ -761,7 +1013,7 @@ 5 - wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL + wxALIGN_CENTER_VERTICAL|wxLEFT 0 1 @@ -836,7 +1088,7 @@ - + onMouseWheelRot @@ -850,6 +1102,90 @@ + + 5 + wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_spinXrot + 1 + + + protected + 1 + + Resizable + 1 + + wxSP_ARROW_KEYS|wxSP_VERTICAL + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + onDecrementRot + onIncrementRot + + + 5 wxALIGN_CENTER_VERTICAL|wxLEFT @@ -935,7 +1271,7 @@ 5 - wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL + wxALIGN_CENTER_VERTICAL|wxLEFT 0 1 @@ -1010,7 +1346,7 @@ - + onMouseWheelRot @@ -1024,6 +1360,90 @@ + + 5 + wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_spinYrot + 1 + + + protected + 1 + + Resizable + 1 + + wxSP_ARROW_KEYS|wxSP_VERTICAL + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + onDecrementRot + onIncrementRot + + + 5 wxALIGN_CENTER_VERTICAL|wxLEFT @@ -1109,7 +1529,7 @@ 5 - wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL + wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT 0 1 @@ -1184,7 +1604,7 @@ - + onMouseWheelRot @@ -1198,6 +1618,90 @@ + + 5 + wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_spinZrot + 1 + + + protected + 1 + + Resizable + 1 + + wxSP_ARROW_KEYS|wxSP_VERTICAL + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + onDecrementRot + onIncrementRot + + + @@ -1220,7 +1724,7 @@ wxEXPAND 1 - 2 + 3 wxBOTH @@ -1316,7 +1820,7 @@ 5 - wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL + wxALIGN_CENTER_VERTICAL|wxLEFT 0 1 @@ -1391,7 +1895,7 @@ - + onMouseWheelOffset @@ -1405,6 +1909,90 @@ + + 5 + wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_spinXoffset + 1 + + + protected + 1 + + Resizable + 1 + + wxSP_ARROW_KEYS|wxSP_VERTICAL + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + onDecrementOffset + onIncrementOffset + + + 5 wxALIGN_CENTER_VERTICAL|wxLEFT @@ -1490,7 +2078,7 @@ 5 - wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL + wxALIGN_CENTER_VERTICAL|wxLEFT 0 1 @@ -1565,7 +2153,7 @@ - + onMouseWheelOffset @@ -1579,6 +2167,90 @@ + + 5 + wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_spinYoffset + 1 + + + protected + 1 + + Resizable + 1 + + wxSP_ARROW_KEYS|wxSP_VERTICAL + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + onDecrementOffset + onIncrementOffset + + + 5 wxALIGN_CENTER_VERTICAL|wxLEFT @@ -1664,7 +2336,7 @@ 5 - wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL + wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT 0 1 @@ -1739,7 +2411,7 @@ - + onMouseWheelOffset @@ -1753,6 +2425,90 @@ + + 5 + wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_spinZoffset + 1 + + + protected + 1 + + Resizable + 1 + + wxSP_ARROW_KEYS|wxSP_VERTICAL + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + onDecrementOffset + onIncrementOffset + + + diff --git a/3d-viewer/3d_cache/dialogs/panel_prev_3d_base.h b/3d-viewer/3d_cache/dialogs/panel_prev_3d_base.h index c4f54398a1..6e439cc0a9 100644 --- a/3d-viewer/3d_cache/dialogs/panel_prev_3d_base.h +++ b/3d-viewer/3d_cache/dialogs/panel_prev_3d_base.h @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -40,22 +41,31 @@ class PANEL_PREV_3D_BASE : public wxPanel protected: wxStaticText* m_staticText1; wxTextCtrl* xscale; + wxSpinButton* m_spinXscale; wxStaticText* m_staticText2; wxTextCtrl* yscale; + wxSpinButton* m_spinYscale; wxStaticText* m_staticText3; wxTextCtrl* zscale; + wxSpinButton* m_spinZscale; wxStaticText* m_staticText11; wxTextCtrl* xrot; + wxSpinButton* m_spinXrot; wxStaticText* m_staticText21; wxTextCtrl* yrot; + wxSpinButton* m_spinYrot; wxStaticText* m_staticText31; wxTextCtrl* zrot; + wxSpinButton* m_spinZrot; wxStaticText* m_staticText12; wxTextCtrl* xoff; + wxSpinButton* m_spinXoffset; wxStaticText* m_staticText22; wxTextCtrl* yoff; + wxSpinButton* m_spinYoffset; wxStaticText* m_staticText32; wxTextCtrl* zoff; + wxSpinButton* m_spinZoffset; wxBoxSizer* m_SizerPanelView; wxFlexGridSizer* m_fgSizerButtons; wxBitmapButton* m_bpvISO; @@ -68,7 +78,16 @@ class PANEL_PREV_3D_BASE : public wxPanel wxBitmapButton* m_bpvBottom; // Virtual event handlers, overide them in your derived class + virtual void onMouseWheelScale( wxMouseEvent& event ) { event.Skip(); } virtual void updateOrientation( wxCommandEvent& event ) { event.Skip(); } + virtual void onDecrementScale( wxSpinEvent& event ) { event.Skip(); } + virtual void onIncrementScale( wxSpinEvent& event ) { event.Skip(); } + virtual void onMouseWheelRot( wxMouseEvent& event ) { event.Skip(); } + virtual void onDecrementRot( wxSpinEvent& event ) { event.Skip(); } + virtual void onIncrementRot( wxSpinEvent& event ) { event.Skip(); } + virtual void onMouseWheelOffset( wxMouseEvent& event ) { event.Skip(); } + virtual void onDecrementOffset( wxSpinEvent& event ) { event.Skip(); } + virtual void onIncrementOffset( wxSpinEvent& event ) { event.Skip(); } virtual void View3DISO( wxCommandEvent& event ) { event.Skip(); } virtual void View3DLeft( wxCommandEvent& event ) { event.Skip(); } virtual void View3DFront( wxCommandEvent& event ) { event.Skip(); } @@ -81,7 +100,7 @@ class PANEL_PREV_3D_BASE : public wxPanel public: - PANEL_PREV_3D_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 504,285 ), long style = wxTAB_TRAVERSAL ); + PANEL_PREV_3D_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 503,371 ), long style = wxTAB_TRAVERSAL ); ~PANEL_PREV_3D_BASE(); }; diff --git a/3d-viewer/3d_cache/dialogs/panel_prev_model.cpp b/3d-viewer/3d_cache/dialogs/panel_prev_model.cpp index 796f2aa1a8..6697b6cc77 100644 --- a/3d-viewer/3d_cache/dialogs/panel_prev_model.cpp +++ b/3d-viewer/3d_cache/dialogs/panel_prev_model.cpp @@ -123,13 +123,38 @@ static void checkRotation( double& rot ) return; } +static bool validateFloatTextCtrl( wxTextCtrl* aTextCtrl ) + { + if( aTextCtrl == NULL ) + return false; -void PANEL_PREV_3D::OnCloseWindow( wxCloseEvent &event ) + if( aTextCtrl->GetLineLength(0) == 0 ) // This will skip the got and event with empty field + return false; + + if( aTextCtrl->GetLineLength(0) == 1 ) + { + if( (aTextCtrl->GetLineText(0).compare( "." ) == 0) || + (aTextCtrl->GetLineText(0).compare( "," ) == 0) ) + return false; + } + + return true; +} + +static void incrementTextCtrl( wxTextCtrl* aTextCtrl, double aInc, double aMinval, double aMaxval ) { - if( m_previewPane ) - m_previewPane->Close(); + if( !validateFloatTextCtrl( aTextCtrl ) ) + return; - event.Skip(); + double curr_value = 0; + + aTextCtrl->GetValue().ToDouble( &curr_value ); + curr_value += aInc; + + if ( curr_value > aMaxval || curr_value < aMinval ) + return; + + aTextCtrl->SetValue( wxString::Format( "%.4f", curr_value ) ); } @@ -323,6 +348,146 @@ void PANEL_PREV_3D::updateOrientation( wxCommandEvent &event ) } +void PANEL_PREV_3D::onIncrementRot( wxSpinEvent& event ) +{ + wxSpinButton* spinCtrl = (wxSpinButton*) event.GetEventObject(); + + wxTextCtrl * textCtrl = xrot; + + if( spinCtrl == m_spinYrot ) + textCtrl = yrot; + else if( spinCtrl == m_spinZrot ) + textCtrl = zrot; + + incrementTextCtrl( textCtrl, ROTATION_INCREMENT, MIN_ROTATION, MAX_ROTATION ); +} + + +void PANEL_PREV_3D::onDecrementRot( wxSpinEvent& event ) +{ + wxSpinButton* spinCtrl = (wxSpinButton*) event.GetEventObject(); + + wxTextCtrl * textCtrl = xrot; + + if( spinCtrl == m_spinYrot ) + textCtrl = yrot; + else if( spinCtrl == m_spinZrot ) + textCtrl = zrot; + + incrementTextCtrl( textCtrl, -ROTATION_INCREMENT, MIN_ROTATION, MAX_ROTATION ); +} + + +void PANEL_PREV_3D::onIncrementScale( wxSpinEvent& event ) +{ + wxSpinButton* spinCtrl = (wxSpinButton*) event.GetEventObject(); + + wxTextCtrl * textCtrl = xscale; + + if( spinCtrl == m_spinYscale ) + textCtrl = yscale; + else if( spinCtrl == m_spinZscale ) + textCtrl = zscale; + + incrementTextCtrl( textCtrl, SCALE_INCREMENT, MIN_SCALE, MAX_SCALE ); +} + + +void PANEL_PREV_3D::onDecrementScale( wxSpinEvent& event ) +{ + wxSpinButton* spinCtrl = (wxSpinButton*) event.GetEventObject(); + + wxTextCtrl * textCtrl = xscale; + + if( spinCtrl == m_spinYscale ) + textCtrl = yscale; + else if( spinCtrl == m_spinZscale ) + textCtrl = zscale; + + incrementTextCtrl( textCtrl, -SCALE_INCREMENT, MIN_SCALE, MAX_SCALE ); +} + + +void PANEL_PREV_3D::onIncrementOffset( wxSpinEvent& event ) +{ + wxSpinButton* spinCtrl = (wxSpinButton*) event.GetEventObject(); + + wxTextCtrl * textCtrl = xoff; + + if( spinCtrl == m_spinYoffset ) + textCtrl = yoff; + else if( spinCtrl == m_spinZoffset ) + textCtrl = zoff; + + double step = OFFSET_INCREMENT_MM; + + if( g_UserUnit == INCHES ) + step = OFFSET_INCREMENT_MIL/1000.0; + + incrementTextCtrl( textCtrl, step, MIN_OFFSET, MAX_OFFSET ); +} + + +void PANEL_PREV_3D::onDecrementOffset( wxSpinEvent& event ) +{ + wxSpinButton* spinCtrl = (wxSpinButton*) event.GetEventObject(); + + wxTextCtrl * textCtrl = xoff; + + if( spinCtrl == m_spinYoffset ) + textCtrl = yoff; + else if( spinCtrl == m_spinZoffset ) + textCtrl = zoff; + + double step = OFFSET_INCREMENT_MM; + + if( g_UserUnit == INCHES ) + step = OFFSET_INCREMENT_MIL/1000.0; + + incrementTextCtrl( textCtrl, -step, MIN_OFFSET, MAX_OFFSET ); +} + + +void PANEL_PREV_3D::onMouseWheelScale( wxMouseEvent& event ) +{ + wxTextCtrl* textCtrl = (wxTextCtrl*) event.GetEventObject(); + + double step = SCALE_INCREMENT; + + if( event.GetWheelRotation() >= 0 ) + step = -step; + + incrementTextCtrl( textCtrl, step, MIN_SCALE, MAX_SCALE ); +} + + +void PANEL_PREV_3D::onMouseWheelRot( wxMouseEvent& event ) +{ + wxTextCtrl* textCtrl = (wxTextCtrl*) event.GetEventObject(); + + double step = ROTATION_INCREMENT_WHEEL; + + if( event.GetWheelRotation() >= 0 ) + step = -step; + + incrementTextCtrl( textCtrl, step, MIN_ROTATION, MAX_ROTATION ); +} + +void PANEL_PREV_3D::onMouseWheelOffset( wxMouseEvent& event ) +{ + wxTextCtrl* textCtrl = (wxTextCtrl*) event.GetEventObject(); + + double step = OFFSET_INCREMENT_MM; + + if( g_UserUnit == INCHES ) + step = OFFSET_INCREMENT_MIL/1000.0; + + if( event.GetWheelRotation() >= 0 ) + step = -step; + + incrementTextCtrl( textCtrl, step, MIN_OFFSET, MAX_OFFSET ); +} + void PANEL_PREV_3D::getOrientationVars( SGPOINT& aScale, SGPOINT& aRotation, SGPOINT& aOffset ) { if( NULL == xscale || NULL == yscale || NULL == zscale @@ -374,8 +539,6 @@ void PANEL_PREV_3D::getOrientationVars( SGPOINT& aScale, SGPOINT& aRotation, SGP bool PANEL_PREV_3D::ValidateWithMessage( wxString& aErrorMessage ) { bool invalidScale = false; - #define MIN_SCALE 0.001 - #define MAX_SCALE 1000.0 for( unsigned int idx = 0; idx < m_parentInfoList->size(); ++idx ) { diff --git a/3d-viewer/3d_cache/dialogs/panel_prev_model.h b/3d-viewer/3d_cache/dialogs/panel_prev_model.h index f27eb2bfea..6076f32e31 100644 --- a/3d-viewer/3d_cache/dialogs/panel_prev_model.h +++ b/3d-viewer/3d_cache/dialogs/panel_prev_model.h @@ -38,16 +38,29 @@ #include "panel_prev_3d_base.h" -//#include #include "../3d_info.h" #include #include <3d_canvas/eda_3d_canvas.h> +// Define min and max parameter values +#define MIN_SCALE 0.01 +#define MAX_SCALE 100.0 +#define MIN_ROTATION -180.0 +#define MAX_ROTATION 180.0 +#define MIN_OFFSET -1000.0 +#define MAX_OFFSET 1000.0 + +#define SCALE_INCREMENT 0.02 +#define ROTATION_INCREMENT 5 // in degrees, for spin button command +#define ROTATION_INCREMENT_WHEEL 1 // in degrees, for mouse wheel command +#define OFFSET_INCREMENT_MM 0.1 +#define OFFSET_INCREMENT_MIL 5.0 + + // Declared classes to create pointers class S3D_CACHE; class S3D_FILENAME_RESOLVER; -class EDA_3D_CANVAS; class BOARD; class CINFO3D_VISU; class MODULE; @@ -98,6 +111,17 @@ private: */ void updateOrientation( wxCommandEvent &event ) override; + void onMouseWheelScale( wxMouseEvent& event ) override; + void onMouseWheelRot( wxMouseEvent& event ) override; + void onMouseWheelOffset( wxMouseEvent& event ) override; + + void onIncrementRot( wxSpinEvent& event ) override; + void onDecrementRot( wxSpinEvent& event ) override; + void onIncrementScale( wxSpinEvent& event ) override; + void onDecrementScale( wxSpinEvent& event ) override; + void onIncrementOffset( wxSpinEvent& event ) override; + void onDecrementOffset( wxSpinEvent& event ) override; + /** * @brief getOrientationVars - gets the transformation from entries and validate it * @param aScale: output scale var @@ -112,11 +136,6 @@ private: */ void updateListOnModelCopy(); - /** - * @brief OnCloseWindow - called when the frame is closed - * @param event - */ - void OnCloseWindow( wxCloseEvent &event ); void onEnterPreviewCanvas( wxMouseEvent& event ) {