From 97d4c33a9fa547d6af151927eb88b59d78695f76 Mon Sep 17 00:00:00 2001 From: Cirilo Bernardo Date: Mon, 4 Jan 2016 09:15:53 +1100 Subject: [PATCH] Fixed preview pane resizing --- .../3d_cache/dialogs/panel_prev_model.cpp | 54 ++++++++----------- 3d-viewer/3d_cache/dialogs/panel_prev_model.h | 2 +- 2 files changed, 23 insertions(+), 33 deletions(-) diff --git a/3d-viewer/3d_cache/dialogs/panel_prev_model.cpp b/3d-viewer/3d_cache/dialogs/panel_prev_model.cpp index 1fa0a08451..af2638ebd7 100644 --- a/3d-viewer/3d_cache/dialogs/panel_prev_model.cpp +++ b/3d-viewer/3d_cache/dialogs/panel_prev_model.cpp @@ -84,26 +84,25 @@ enum { }; wxBEGIN_EVENT_TABLE( PANEL_PREV_3D, wxPanel) - EVT_SIZE( PANEL_PREV_3D::resize ) - EVT_CHOICE( ID_SET_DIR, PANEL_PREV_3D::SetRootDir ) - EVT_TEXT_ENTER( ID_SCALEX, PANEL_PREV_3D::updateOrientation ) - EVT_TEXT_ENTER( ID_SCALEY, PANEL_PREV_3D::updateOrientation ) - EVT_TEXT_ENTER( ID_SCALEZ, PANEL_PREV_3D::updateOrientation ) - EVT_TEXT_ENTER( ID_ROTX, PANEL_PREV_3D::updateOrientation ) - EVT_TEXT_ENTER( ID_ROTY, PANEL_PREV_3D::updateOrientation ) - EVT_TEXT_ENTER( ID_ROTZ, PANEL_PREV_3D::updateOrientation ) - EVT_TEXT_ENTER( ID_OFFX, PANEL_PREV_3D::updateOrientation ) - EVT_TEXT_ENTER( ID_OFFY, PANEL_PREV_3D::updateOrientation ) - EVT_TEXT_ENTER( ID_OFFZ, PANEL_PREV_3D::updateOrientation ) - EVT_BUTTON( ID_CFG_PATHS, PANEL_PREV_3D::Cfg3DPaths ) - EVT_BUTTON( ID_3D_ISO, PANEL_PREV_3D::View3DISO ) - EVT_BUTTON( ID_3D_UPDATE, PANEL_PREV_3D::View3DUpdate ) - EVT_BUTTON( ID_3D_LEFT, PANEL_PREV_3D::View3DLeft ) - EVT_BUTTON( ID_3D_RIGHT, PANEL_PREV_3D::View3DRight ) - EVT_BUTTON( ID_3D_FRONT, PANEL_PREV_3D::View3DFront ) - EVT_BUTTON( ID_3D_BACK, PANEL_PREV_3D::View3DBack ) - EVT_BUTTON( ID_3D_TOP, PANEL_PREV_3D::View3DTop ) - EVT_BUTTON( ID_3D_BOTTOM, PANEL_PREV_3D::View3DBottom ) + EVT_CHOICE( ID_SET_DIR, PANEL_PREV_3D::SetRootDir ) + EVT_TEXT_ENTER( ID_SCALEX, PANEL_PREV_3D::updateOrientation ) + EVT_TEXT_ENTER( ID_SCALEY, PANEL_PREV_3D::updateOrientation ) + EVT_TEXT_ENTER( ID_SCALEZ, PANEL_PREV_3D::updateOrientation ) + EVT_TEXT_ENTER( ID_ROTX, PANEL_PREV_3D::updateOrientation ) + EVT_TEXT_ENTER( ID_ROTY, PANEL_PREV_3D::updateOrientation ) + EVT_TEXT_ENTER( ID_ROTZ, PANEL_PREV_3D::updateOrientation ) + EVT_TEXT_ENTER( ID_OFFX, PANEL_PREV_3D::updateOrientation ) + EVT_TEXT_ENTER( ID_OFFY, PANEL_PREV_3D::updateOrientation ) + EVT_TEXT_ENTER( ID_OFFZ, PANEL_PREV_3D::updateOrientation ) + EVT_BUTTON( ID_CFG_PATHS, PANEL_PREV_3D::Cfg3DPaths ) + EVT_BUTTON( ID_3D_ISO, PANEL_PREV_3D::View3DISO ) + EVT_BUTTON( ID_3D_UPDATE, PANEL_PREV_3D::View3DUpdate ) + EVT_BUTTON( ID_3D_LEFT, PANEL_PREV_3D::View3DLeft ) + EVT_BUTTON( ID_3D_RIGHT, PANEL_PREV_3D::View3DRight ) + EVT_BUTTON( ID_3D_FRONT, PANEL_PREV_3D::View3DFront ) + EVT_BUTTON( ID_3D_BACK, PANEL_PREV_3D::View3DBack ) + EVT_BUTTON( ID_3D_TOP, PANEL_PREV_3D::View3DTop ) + EVT_BUTTON( ID_3D_BOTTOM, PANEL_PREV_3D::View3DBottom ) wxEND_EVENT_TABLE() @@ -616,7 +615,9 @@ void PANEL_PREV_3D::UpdateModelName( wxString const& aModelName ) std::cout << "[3dv] Update Model: canvas creation FAILED\n"; #endif - canvas->SetSize( preview->GetClientSize() ); + wxSizer* ws = new wxBoxSizer( wxHORIZONTAL ); + ws->Add( canvas, 10, wxEXPAND ); + preview->SetSizerAndFit( ws ); } canvas->Set3DModel( *model ); @@ -649,17 +650,6 @@ void PANEL_PREV_3D::UpdateWindowUI( long flags ) } -void PANEL_PREV_3D::resize( wxSizeEvent &event ) -{ - event.Skip(); - - if( NULL != canvas ) - canvas->SetSize( preview->GetClientSize() ); - - return; -} - - void PANEL_PREV_3D::updateOrientation( wxCommandEvent &event ) { // note: process even if the canvas is NULL since the user may diff --git a/3d-viewer/3d_cache/dialogs/panel_prev_model.h b/3d-viewer/3d_cache/dialogs/panel_prev_model.h index 8815c49f9c..1aae21e017 100644 --- a/3d-viewer/3d_cache/dialogs/panel_prev_model.h +++ b/3d-viewer/3d_cache/dialogs/panel_prev_model.h @@ -88,9 +88,9 @@ private: S3DMODEL* model; S3D_INFO modelInfo; + private: void updateDirChoiceList( void ); - void resize( wxSizeEvent &event ); void updateOrientation( wxCommandEvent &event ); void getOrientationVars( SGPOINT& scale, SGPOINT& rotation, SGPOINT& offset );