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 BUGGYICD_KEY "BuggyICD"
#define CHASEMOUSE_KEY "ChaseMouse"
#define MOUSEWHEELZOOM_KEY "MousewheelZoom"
#define ENTITYSHOW_KEY "EntityShow"
#define TEXTURESCALE_KEY "TextureScale"
#define TEXTURESCROLLBAR_KEY "TextureScrollbar"
@ -620,6 +621,7 @@ PrefsDlg::PrefsDlg (){
m_strUserPath = "";
m_nRotation = 0;
m_bChaseMouse = FALSE;
m_bMousewheelZoom = FALSE;
m_bTextureScrollbar = TRUE;
m_bDisplayLists = TRUE;
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 );
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
// container
hbox2 = gtk_hbox_new( FALSE, 5 );
@ -2996,6 +3004,7 @@ void PrefsDlg::LoadPrefs(){
mLocalPrefs.GetPref( USERINI_KEY, &m_strUserPath, "" );
mLocalPrefs.GetPref( ROTATION_KEY, &m_nRotation, 45 );
mLocalPrefs.GetPref( CHASEMOUSE_KEY, &m_bChaseMouse, TRUE );
mLocalPrefs.GetPref( MOUSEWHEELZOOM_KEY, &m_bMousewheelZoom, FALSE );
mLocalPrefs.GetPref( ENTITYSHOW_KEY, &m_nEntityShowState, ENTITY_SKINNED_BOXED );
// this will probably need to be 75 or 100 for Q1.

View file

@ -619,6 +619,7 @@ bool m_bSnap;
Str m_strUserPath;
int m_nRotation;
bool m_bChaseMouse;
bool m_bMousewheelZoom;
bool m_bTextureScrollbar;
bool m_bDisplayLists;
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 ){
if ( bUp ) {
// improved zoom-in
// frame coverges to part of window where the cursor currently resides
float old_scale = m_fScale;
g_pParentWnd->OnViewZoomin();
float scale_diff = 1.0 / old_scale - 1.0 / m_fScale;
int nDim1 = ( m_nViewType == YZ ) ? 1 : 0;
int nDim2 = ( m_nViewType == XY ) ? 1 : 2;
m_vOrigin[nDim1] += scale_diff * (pointx - 0.5 * m_nWidth);
m_vOrigin[nDim2] -= scale_diff * (pointy - 0.5 * m_nHeight);
if ( g_PrefsDlg.m_bMousewheelZoom == TRUE ) {
// improved zoom-in
// frame coverges to part of window where the cursor currently resides
float old_scale = m_fScale;
g_pParentWnd->OnViewZoomin();
float scale_diff = 1.0 / old_scale - 1.0 / m_fScale;
int nDim1 = ( m_nViewType == YZ ) ? 1 : 0;
int nDim2 = ( m_nViewType == XY ) ? 1 : 2;
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{
g_pParentWnd->OnViewZoomout();