From 9074c57a285735b4395d13757f221d9f803f3711 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Tue, 7 Feb 2017 11:05:08 +0100 Subject: [PATCH] panel_prev_model.cpp: try a better way to fix issue with wxSpinButtons on Linux. --- .../3d_cache/dialogs/panel_prev_model.cpp | 43 +++---------------- 1 file changed, 6 insertions(+), 37 deletions(-) diff --git a/3d-viewer/3d_cache/dialogs/panel_prev_model.cpp b/3d-viewer/3d_cache/dialogs/panel_prev_model.cpp index ccca19cf61..c9854aec69 100644 --- a/3d-viewer/3d_cache/dialogs/panel_prev_model.cpp +++ b/3d-viewer/3d_cache/dialogs/panel_prev_model.cpp @@ -31,6 +31,7 @@ #include <3d_canvas/eda_3d_canvas.h> #include #include +#include #include #include @@ -101,9 +102,10 @@ void PANEL_PREV_3D_B::initPanel() m_bpUpdate->SetBitmap( KiBitmap( reload_xpm ) ); // Set the min and max values of spin buttons (mandatory on Linux) - // This is an arbitray value, but it avoids blocking the up or down - // arrows when reaching a limit. The current value will be forced to 0 - // because it is not used in dialog + // They are not used, so they are set to min and max 32 bits int values + // (the min and max values supported by a wxSpinButton) + // It avoids blocking the up or down arrows when reaching this limit after + // a few clicks. wxSpinButton* spinButtonList[] = { m_spinXscale, m_spinYscale, m_spinZscale, @@ -112,10 +114,7 @@ void PANEL_PREV_3D_B::initPanel() }; for( int ii = 0; ii < 9; ii++ ) - { - spinButtonList[ii]->SetRange( -10, 10 ); - spinButtonList[ii]->SetValue( 0 ); - } + spinButtonList[ii]->SetRange( INT_MIN, INT_MAX ); } @@ -382,11 +381,6 @@ void PANEL_PREV_3D::onIncrementRot( wxSpinEvent& event ) textCtrl = zrot; incrementTextCtrl( textCtrl, ROTATION_INCREMENT, -MAX_ROTATION, MAX_ROTATION ); - - // Reset the currentl spin button value (not used in this dialog, - // to avoid on Linux blocking the up or down arrow after a few click - // on arrow - spinCtrl->SetValue( 0 ); } @@ -402,11 +396,6 @@ void PANEL_PREV_3D::onDecrementRot( wxSpinEvent& event ) textCtrl = zrot; incrementTextCtrl( textCtrl, -ROTATION_INCREMENT, -MAX_ROTATION, MAX_ROTATION ); - - // Reset the currentl spin button value (not used in this dialog, - // to avoid on Linux blocking the up or down arrow after a few click - // on arrow - spinCtrl->SetValue( 0 ); } @@ -422,11 +411,6 @@ void PANEL_PREV_3D::onIncrementScale( wxSpinEvent& event ) textCtrl = zscale; incrementTextCtrl( textCtrl, SCALE_INCREMENT, 1/MAX_SCALE, MAX_SCALE ); - - // Reset the currentl spin button value (not used in this dialog, - // to avoid on Linux blocking the up or down arrow after a few click - // on arrow - spinCtrl->SetValue( 0 ); } @@ -442,11 +426,6 @@ void PANEL_PREV_3D::onDecrementScale( wxSpinEvent& event ) textCtrl = zscale; incrementTextCtrl( textCtrl, -SCALE_INCREMENT, 1/MAX_SCALE, MAX_SCALE ); - - // Reset the currentl spin button value (not used in this dialog, - // to avoid on Linux blocking the up or down arrow after a few click - // on arrow - spinCtrl->SetValue( 0 ); } @@ -467,11 +446,6 @@ void PANEL_PREV_3D::onIncrementOffset( wxSpinEvent& event ) step = OFFSET_INCREMENT_MIL/1000.0; incrementTextCtrl( textCtrl, step, -MAX_OFFSET, MAX_OFFSET ); - - // Reset the currentl spin button value (not used in this dialog, - // to avoid on Linux blocking the up or down arrow after a few click - // on arrow - spinCtrl->SetValue( 0 ); } @@ -492,11 +466,6 @@ void PANEL_PREV_3D::onDecrementOffset( wxSpinEvent& event ) step = OFFSET_INCREMENT_MIL/1000.0; incrementTextCtrl( textCtrl, -step, -MAX_OFFSET, MAX_OFFSET ); - - // Reset the currentl spin button value (not used in this dialog, - // to avoid on Linux blocking the up or down arrow after a few click - // on arrow - spinCtrl->SetValue( 0 ); }