Zoom option in preferences

This commit is contained in:
neumond 2014-03-24 07:46:49 +04:00
parent 09c0da616c
commit 27946b2e13
3 changed files with 24 additions and 9 deletions

View file

@ -102,6 +102,7 @@
#define ROTATION_KEY "Rotation" #define ROTATION_KEY "Rotation"
#define BUGGYICD_KEY "BuggyICD" #define BUGGYICD_KEY "BuggyICD"
#define CHASEMOUSE_KEY "ChaseMouse" #define CHASEMOUSE_KEY "ChaseMouse"
#define MOUSEWHEELZOOM_KEY "MousewheelZoom"
#define ENTITYSHOW_KEY "EntityShow" #define ENTITYSHOW_KEY "EntityShow"
#define TEXTURESCALE_KEY "TextureScale" #define TEXTURESCALE_KEY "TextureScale"
#define TEXTURESCROLLBAR_KEY "TextureScrollbar" #define TEXTURESCROLLBAR_KEY "TextureScrollbar"
@ -620,6 +621,7 @@ PrefsDlg::PrefsDlg (){
m_strUserPath = ""; m_strUserPath = "";
m_nRotation = 0; m_nRotation = 0;
m_bChaseMouse = FALSE; m_bChaseMouse = FALSE;
m_bMousewheelZoom = FALSE;
m_bTextureScrollbar = TRUE; m_bTextureScrollbar = TRUE;
m_bDisplayLists = TRUE; m_bDisplayLists = TRUE;
m_bAntialiasedPointsAndLines = FALSE; // Fishman - Add antialiazed points and lines support. 09/03/00 m_bAntialiasedPointsAndLines = FALSE; // Fishman - Add antialiazed points and lines support. 09/03/00
@ -2271,6 +2273,12 @@ void PrefsDlg::BuildDialog(){
gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, FALSE, 0 ); gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, FALSE, 0 );
AddDialogData( check, &m_bALTEdge, DLG_CHECK_BOOL ); AddDialogData( check, &m_bALTEdge, DLG_CHECK_BOOL );
// Imroved mouse wheel zoom in
check = gtk_check_button_new_with_label( _( "Improved mousewheel zoom-in" ) );
gtk_widget_show( check );
gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, FALSE, 0 );
AddDialogData( check, &m_bMousewheelZoom, DLG_CHECK_BOOL );
// Mouse wheel increments // Mouse wheel increments
// container // container
hbox2 = gtk_hbox_new( FALSE, 5 ); hbox2 = gtk_hbox_new( FALSE, 5 );
@ -2996,6 +3004,7 @@ void PrefsDlg::LoadPrefs(){
mLocalPrefs.GetPref( USERINI_KEY, &m_strUserPath, "" ); mLocalPrefs.GetPref( USERINI_KEY, &m_strUserPath, "" );
mLocalPrefs.GetPref( ROTATION_KEY, &m_nRotation, 45 ); mLocalPrefs.GetPref( ROTATION_KEY, &m_nRotation, 45 );
mLocalPrefs.GetPref( CHASEMOUSE_KEY, &m_bChaseMouse, TRUE ); mLocalPrefs.GetPref( CHASEMOUSE_KEY, &m_bChaseMouse, TRUE );
mLocalPrefs.GetPref( MOUSEWHEELZOOM_KEY, &m_bMousewheelZoom, FALSE );
mLocalPrefs.GetPref( ENTITYSHOW_KEY, &m_nEntityShowState, ENTITY_SKINNED_BOXED ); mLocalPrefs.GetPref( ENTITYSHOW_KEY, &m_nEntityShowState, ENTITY_SKINNED_BOXED );
// this will probably need to be 75 or 100 for Q1. // this will probably need to be 75 or 100 for Q1.

View file

@ -619,6 +619,7 @@ bool m_bSnap;
Str m_strUserPath; Str m_strUserPath;
int m_nRotation; int m_nRotation;
bool m_bChaseMouse; bool m_bChaseMouse;
bool m_bMousewheelZoom;
bool m_bTextureScrollbar; bool m_bTextureScrollbar;
bool m_bDisplayLists; bool m_bDisplayLists;
bool m_bAntialiasedPointsAndLines; // Fishman - Add antialiazed points and lines support. 09/03/00 bool m_bAntialiasedPointsAndLines; // Fishman - Add antialiazed points and lines support. 09/03/00

View file

@ -1158,15 +1158,20 @@ void XYWnd::OnMouseMove( guint32 nFlags, int pointx, int pointy ){
void XYWnd::OnMouseWheel( bool bUp, int pointx, int pointy ){ void XYWnd::OnMouseWheel( bool bUp, int pointx, int pointy ){
if ( bUp ) { if ( bUp ) {
// improved zoom-in if ( g_PrefsDlg.m_bMousewheelZoom == TRUE ) {
// frame coverges to part of window where the cursor currently resides // improved zoom-in
float old_scale = m_fScale; // frame coverges to part of window where the cursor currently resides
g_pParentWnd->OnViewZoomin(); float old_scale = m_fScale;
float scale_diff = 1.0 / old_scale - 1.0 / m_fScale; g_pParentWnd->OnViewZoomin();
int nDim1 = ( m_nViewType == YZ ) ? 1 : 0; float scale_diff = 1.0 / old_scale - 1.0 / m_fScale;
int nDim2 = ( m_nViewType == XY ) ? 1 : 2; int nDim1 = ( m_nViewType == YZ ) ? 1 : 0;
m_vOrigin[nDim1] += scale_diff * (pointx - 0.5 * m_nWidth); int nDim2 = ( m_nViewType == XY ) ? 1 : 2;
m_vOrigin[nDim2] -= scale_diff * (pointy - 0.5 * m_nHeight); m_vOrigin[nDim1] += scale_diff * (pointx - 0.5 * m_nWidth);
m_vOrigin[nDim2] -= scale_diff * (pointy - 0.5 * m_nHeight);
}
else{
g_pParentWnd->OnViewZoomin();
}
} }
else{ else{
g_pParentWnd->OnViewZoomout(); g_pParentWnd->OnViewZoomout();