]> git.xonotic.org Git - xonotic/netradiant.git/commitdiff
Merge commit 'dd7f4f1689e8ede7580bdfa8e08d0b78d08f5253' into garux-merge
authorThomas Debesse <dev@illwieckz.net>
Mon, 22 Feb 2021 23:01:16 +0000 (00:01 +0100)
committerThomas Debesse <dev@illwieckz.net>
Mon, 22 Feb 2021 23:01:16 +0000 (00:01 +0100)
12 files changed:
radiant/camwindow.cpp
radiant/camwindow.h
radiant/entityinspector.cpp
radiant/gtkdlgs.cpp
radiant/gtkdlgs.h
radiant/preferences.cpp
radiant/shaders.cpp
radiant/shaders.h
radiant/texwindow.cpp
radiant/xywindow.cpp
radiant/xywindow.h
tools/quake3/q3map2/main.c

index 1ddc01779fb4e1bc4b9fbdcb68bba5dbe6a60351..8344ef4700595b7886b88547d140d283469f4734 100644 (file)
@@ -883,7 +883,32 @@ gboolean selection_motion_freemove( ui::Widget widget, GdkEventMotion *event, Wi
 gboolean wheelmove_scroll( ui::Widget widget, GdkEventScroll* event, CamWnd* camwnd ){
        if ( event->direction == GDK_SCROLL_UP ) {
                Camera_Freemove_updateAxes( camwnd->getCamera() );
-               Camera_setOrigin( *camwnd, vector3_added( Camera_getOrigin( *camwnd ), vector3_scaled( camwnd->getCamera().forward, static_cast<float>( g_camwindow_globals_private.m_nMoveSpeed ) ) ) );
+               if( camwnd->m_bFreeMove || !g_camwindow_globals.m_bZoomInToPointer ){
+                       Camera_setOrigin( *camwnd, vector3_added( Camera_getOrigin( *camwnd ), vector3_scaled( camwnd->getCamera().forward, static_cast<float>( g_camwindow_globals_private.m_nMoveSpeed ) ) ) );
+               }
+               else{
+                       //Matrix4 maa = matrix4_multiplied_by_matrix4( camwnd->getCamera().projection, camwnd->getCamera().modelview );
+                       Matrix4 maa = camwnd->getCamera().m_view->GetViewMatrix();
+                       matrix4_affine_invert( maa );
+
+                       float x = static_cast<float>( event->x );
+                       float y = static_cast<float>( event->y );
+                       Vector3 normalized;
+
+                       normalized[0] = 2.0f * ( x ) / static_cast<float>( camwnd->getCamera().width ) - 1.0f;
+                       normalized[1] = 2.0f * ( y )/ static_cast<float>( camwnd->getCamera().height ) - 1.0f;
+                       normalized[1] *= -1.f;
+                       normalized[2] = 0.f;
+
+                       normalized *= 16.0f;
+                               //globalOutputStream() << normalized << " normalized    ";
+                       matrix4_transform_point( maa, normalized );
+                               //globalOutputStream() << normalized << "\n";
+                       Vector3 norm = vector3_normalised( normalized - Camera_getOrigin( *camwnd ) );
+                               //globalOutputStream() << normalized - Camera_getOrigin( *camwnd ) << "  normalized - Camera_getOrigin( *camwnd )\n";
+                               //globalOutputStream() << norm << "  norm\n";
+                       Camera_setOrigin( *camwnd, vector3_added( Camera_getOrigin( *camwnd ), vector3_scaled( norm, static_cast<float>( g_camwindow_globals_private.m_nMoveSpeed ) ) ) );
+               }
        }
        else if ( event->direction == GDK_SCROLL_DOWN ) {
                Camera_Freemove_updateAxes( camwnd->getCamera() );
@@ -1899,6 +1924,7 @@ void Camera_constructPreferences( PreferencesPage& page ){
        page.appendCheckBox( "", "Link strafe speed to movement speed", g_camwindow_globals_private.m_bCamLinkSpeed );
        page.appendSlider( "Rotation Speed", g_camwindow_globals_private.m_nAngleSpeed, TRUE, 0, 0, 3, 1, 180, 1, 10 );
        page.appendCheckBox( "", "Invert mouse vertical axis", g_camwindow_globals_private.m_bCamInverseMouse );
+       page.appendCheckBox( "", "Zoom In to Mouse pointer", g_camwindow_globals.m_bZoomInToPointer );
        page.appendCheckBox(
                "", "Discrete movement",
                make_property<CamWnd_Move_Discrete>()
@@ -2028,6 +2054,7 @@ void CamWnd_Construct(){
        GlobalPreferenceSystem().registerPreference( "SI_Colors12", make_property_string( g_camwindow_globals.color_selbrushes3d ) );
        GlobalPreferenceSystem().registerPreference( "CameraRenderMode", make_property_string<RenderMode>() );
        GlobalPreferenceSystem().registerPreference( "StrafeMode", make_property_string( g_camwindow_globals_private.m_nStrafeMode ) );
+       GlobalPreferenceSystem().registerPreference( "3DZoomInToPointer", make_property_string( g_camwindow_globals.m_bZoomInToPointer ) );
 
        CamWnd_constructStatic();
 
index a838e18ab1a9b3449f301caa297189bee4a971cb..438af28fc349d5ee08c9766c69ffe8a15451f8d8 100644 (file)
@@ -65,10 +65,13 @@ struct camwindow_globals_t
 
        int m_nCubicScale;
 
+       bool m_bZoomInToPointer;
+
        camwindow_globals_t() :
                color_cameraback( 0.25f, 0.25f, 0.25f ),
                color_selbrushes3d( 1.0f, 0.f, 0.f ),
-               m_nCubicScale( 14 ){
+               m_nCubicScale( 14 ),
+               m_bZoomInToPointer( true ){
        }
 
 };
index 0ae57f60ab268882fc9c6113af02f67466a51990..81bcd06c8031cd65741b8ad2b3b18da84e8e9572 100644 (file)
@@ -1320,6 +1320,7 @@ static gint EntityInspector_hideWindowKB( GtkWidget* widget, GdkEventKey* event,
                gtk_widget_hide( GTK_WIDGET( GroupDialog_getWindow() ) );
                return TRUE;
        }
+       /* this doesn't work, if tab is bound (func is not called then) */
        if ( event->keyval == GDK_Tab  ) {
                gtk_window_set_focus( GTK_WINDOW( gtk_widget_get_toplevel( GTK_WIDGET( widget ) ) ), GTK_WIDGET( g_entityKeyEntry ) );
                return TRUE;
index 476e189f81af041ae8761d204d9b4e5bdb8b5540..4e38e3822e18d66c2aea6e20dced9d4f80ba83d3 100644 (file)
@@ -836,9 +836,9 @@ static void DoGtkTextEditor( const char* filename, guint cursorpos, int length )
                text_editor.show();
                gtk_window_present( GTK_WINDOW( text_editor ) );
 
-#if GDEF_OS_WINDOWS
+//#if GDEF_OS_WINDOWS
                ui::process();
-#endif
+//#endif
 
                // only move the cursor if it's not exceeding the size..
                // NOTE: this is erroneous, cursorpos is the offset in bytes, not in characters
@@ -852,9 +852,9 @@ static void DoGtkTextEditor( const char* filename, guint cursorpos, int length )
                        gtk_text_view_scroll_to_iter( GTK_TEXT_VIEW( text_widget ), &text_iter, 0, TRUE, 0, 0);
                }
 
-#if GDEF_OS_WINDOWS
+//#if GDEF_OS_WINDOWS
                gtk_widget_queue_draw( text_widget );
-#endif
+//#endif
 
                text_buffer_ = text_buffer;
                free( buf );
@@ -1048,77 +1048,72 @@ EMessageBoxReturn DoShaderInfoDlg( const char* name, const char* filename, const
 #include <gdk/gdkwin32.h>
 #endif
 
-#if GDEF_OS_WINDOWS
-// use the file associations to open files instead of builtin Gtk editor
-bool g_TextEditor_useWin32Editor = false;
-#else
-// custom shader editor
-bool g_TextEditor_useCustomEditor = false;
 CopiedString g_TextEditor_editorCommand( "" );
-#endif
 
-void DoTextEditor( const char* filename, int cursorpos, int length ){
-#if GDEF_OS_WINDOWS
-       if ( g_TextEditor_useWin32Editor ) {
-               StringOutputStream path( 256 );
-               StringOutputStream modpath( 256 );
-               const char* gamename = GlobalRadiant().getGameName();
-               const char* basegame = GlobalRadiant().getRequiredGameDescriptionKeyValue( "basegame" );
-               const char* enginePath = GlobalRadiant().getEnginePath();
-               path << enginePath << basegame << '/' << filename;
-               modpath << enginePath << gamename << '/' << filename;
-               if ( file_exists( modpath.c_str() ) ){
-                       globalOutputStream() << "opening file '" << modpath.c_str() << "' (line " << cursorpos << " info ignored)\n";
-                       ShellExecute( (HWND)GDK_WINDOW_HWND( gtk_widget_get_window( MainFrame_getWindow() ) ), "open", modpath.c_str(), 0, 0, SW_SHOW );
+void DoTextEditor( const char* filename, int cursorpos, int length, bool external_editor ){
+       //StringOutputStream paths[4]( 256 );
+       StringOutputStream paths[4] = { StringOutputStream(256) };
+       StringOutputStream* goodpath = 0;
+
+       const char* gamename = GlobalRadiant().getGameName();
+       const char* basegame = GlobalRadiant().getRequiredGameDescriptionKeyValue( "basegame" );
+       const char* enginePath = GlobalRadiant().getEnginePath();
+       const char* homeEnginePath = g_qeglobals.m_userEnginePath.c_str();
+
+       paths[0] << homeEnginePath << gamename << '/' << filename;
+       paths[1] << enginePath << gamename << '/' << filename;
+       paths[2] << homeEnginePath << basegame << '/' << filename;
+       paths[3] << enginePath << basegame << '/' << filename;
+
+       for ( std::size_t i = 0; i < 4; ++i ){
+               if ( file_exists( paths[i].c_str() ) ){
+                       goodpath = &paths[i];
+                       break;
                }
-               else if ( file_exists( path.c_str() ) ){
-                       globalOutputStream() << "opening file '" << path.c_str() << "' (line " << cursorpos << " info ignored)\n";
-                       ShellExecute( (HWND)GDK_WINDOW_HWND( gtk_widget_get_window( MainFrame_getWindow() ) ), "open", path.c_str(), 0, 0, SW_SHOW );
-               }
-               else{
-                       globalOutputStream() << "Failed to open '" << filename << "'\nOne sits in .pk3 most likely!\n";
-               }
-               return;
        }
-       else{
-               StringOutputStream path( 256 );
-               StringOutputStream modpath( 256 );
-               const char* gamename = GlobalRadiant().getGameName();
-               const char* basegame = GlobalRadiant().getRequiredGameDescriptionKeyValue( "basegame" );
-               const char* enginePath = GlobalRadiant().getEnginePath();
-               path << enginePath << basegame << '/' << filename;
-               modpath << enginePath << gamename << '/' << filename;
-               if ( file_exists( modpath.c_str() ) ){
-                       globalOutputStream() << "opening file '" << modpath.c_str() << "' (line " << cursorpos << " info ignored)\n";
-                       DoGtkTextEditor( modpath.c_str(), cursorpos, length );
-               }
-               else if ( file_exists( path.c_str() ) ){
-                       globalOutputStream() << "opening file '" << path.c_str() << "' (line " << cursorpos << " info ignored)\n";
-                       DoGtkTextEditor( path.c_str(), cursorpos, length );
+
+       if( goodpath ){
+               globalOutputStream() << "opening file '" << goodpath->c_str() << "' (line " << cursorpos << " info ignored)\n";
+               if( external_editor ){
+                       if( g_TextEditor_editorCommand.empty() ){
+#ifdef WIN32
+                               ShellExecute( (HWND)GDK_WINDOW_HWND( GTK_WIDGET( MainFrame_getWindow() )->window ), 0, goodpath->c_str(), 0, 0, SW_SHOWNORMAL );
+//                             SHELLEXECUTEINFO ShExecInfo;
+//                             ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
+//                             ShExecInfo.fMask = 0;
+//                             ShExecInfo.hwnd = (HWND)GDK_WINDOW_HWND( GTK_WIDGET( MainFrame_getWindow() )->window );
+//                             ShExecInfo.lpVerb = NULL;
+//                             ShExecInfo.lpFile = goodpath->c_str();
+//                             ShExecInfo.lpParameters = NULL;
+//                             ShExecInfo.lpDirectory = NULL;
+//                             ShExecInfo.nShow = SW_SHOWNORMAL;
+//                             ShExecInfo.hInstApp = NULL;
+//                             ShellExecuteEx(&ShExecInfo);
+#else
+                               globalOutputStream() << "Failed to open '" << goodpath->c_str() << "'\nSet Shader Editor Command in preferences\n";
+#endif
+                       }
+                       else{
+                               StringOutputStream strEditCommand( 256 );
+                               strEditCommand << g_TextEditor_editorCommand.c_str() << " \"" << goodpath->c_str() << "\"";
+
+                               globalOutputStream() << "Launching: " << strEditCommand.c_str() << "\n";
+                               // note: linux does not return false if the command failed so it will assume success
+                               if ( Q_Exec( 0, const_cast<char*>( strEditCommand.c_str() ), 0, true, false ) == false ) {
+                                       globalOutputStream() << "Failed to execute " << strEditCommand.c_str() << "\n";
+                               }
+                               else
+                               {
+                                       // the command (appeared) to run successfully, no need to do anything more
+                                       return;
+                               }
+                       }
                }
                else{
-                       globalOutputStream() << "Failed to open '" << filename << "'\nOne sits in .pk3 most likely!\n";
+                       DoGtkTextEditor( goodpath->c_str(), cursorpos, length );
                }
-               return;
        }
-#else
-       // check if a custom editor is set
-       if ( g_TextEditor_useCustomEditor && !g_TextEditor_editorCommand.empty() ) {
-               StringOutputStream strEditCommand( 256 );
-               strEditCommand << g_TextEditor_editorCommand.c_str() << " \"" << filename << "\"";
-
-               globalOutputStream() << "Launching: " << strEditCommand.c_str() << "\n";
-               // note: linux does not return false if the command failed so it will assume success
-               if ( Q_Exec( 0, const_cast<char*>( strEditCommand.c_str() ), 0, true, false ) == false ) {
-                       globalOutputStream() << "Failed to execute " << strEditCommand.c_str() << ", using default\n";
-               }
-               else
-               {
-                       // the command (appeared) to run successfully, no need to do anything more
-                       return;
-               }
+       else{
+               globalOutputStream() << "Failed to open '" << filename << "'\nOne sits in .pk3 most likely!\n";
        }
-
-       DoGtkTextEditor( filename, cursorpos, length );
-#endif
 }
index 78646534e04531ac1306a03a693306235c435a9c..551102a4c5edccd25687409ad303128229685e4f 100644 (file)
@@ -39,7 +39,7 @@ EMessageBoxReturn DoLightIntensityDlg( int *intensity );
 EMessageBoxReturn DoShaderTagDlg( CopiedString *tag, const char* title );
 EMessageBoxReturn DoShaderInfoDlg( const char* name, const char* filename, const char* title );
 EMessageBoxReturn DoTextureLayout( float *fx, float *fy );
-void DoTextEditor( const char* filename, int cursorpos, int length );
+void DoTextEditor( const char* filename, int cursorpos, int length, bool external_editor );
 
 void DoProjectSettings();
 
@@ -48,13 +48,8 @@ void DoSides( int type, int axis );
 void DoAbout();
 
 
-#if GDEF_OS_WINDOWS
-extern bool g_TextEditor_useWin32Editor;
-#else
 #include "string/stringfwd.h"
-extern bool g_TextEditor_useCustomEditor;
 extern CopiedString g_TextEditor_editorCommand;
-#endif
 
 
 #endif
index 3735e31e4a829d5427b07a1524e2ecbf96549ab8..adbfefba46874f292a975ddfdd96a378c165fbd9 100644 (file)
@@ -58,15 +58,7 @@ void Global_constructPreferences( PreferencesPage& page ){
 }
 
 void Interface_constructPreferences( PreferencesPage& page ){
-#if GDEF_OS_WINDOWS
-       page.appendCheckBox( "", "External Shader Editor", g_TextEditor_useWin32Editor );
-#else
-       {
-               ui::CheckButton use_custom = page.appendCheckBox( "Text Editor", "Custom", g_TextEditor_useCustomEditor );
-               ui::Widget custom_editor = page.appendPathEntry( "Text Editor Command", g_TextEditor_editorCommand, true );
-               Widget_connectToggleDependency( custom_editor, use_custom );
-       }
-#endif
+       page.appendPathEntry( "Shader Editor Command", g_TextEditor_editorCommand, false );
 }
 
 void Mouse_constructPreferences( PreferencesPage& page ){
@@ -75,7 +67,7 @@ void Mouse_constructPreferences( PreferencesPage& page ){
 //             page.appendRadio( "Mouse Type",  g_glwindow_globals.m_nMouseType, STRING_ARRAY_RANGE( buttons ) );
 //     }
 //     page.appendCheckBox( "Right Button", "Activates Context Menu", g_xywindow_globals.m_bRightClick );
-       page.appendCheckBox( "", "Improved mousewheel zoom", g_xywindow_globals.m_bImprovedWheelZoom );
+       page.appendCheckBox( "", "Zoom to mouse pointer", g_xywindow_globals.m_bZoomInToPointer );
 }
 void Mouse_constructPage( PreferenceGroup& group ){
        PreferencesPage page( group.createPage( "Mouse", "Mouse Preferences" ) );
@@ -675,7 +667,7 @@ PreferencesPage createPage( const char* treeName, const char* frameName ){
 
 ui::Window PrefsDlg::BuildDialog(){
        PreferencesDialog_addInterfacePreferences( makeCallbackF(Interface_constructPreferences) );
-       Mouse_registerPreferencesPage();
+       //Mouse_registerPreferencesPage();
 
        ui::Window dialog = ui::Window(create_floating_window( "NetRadiant Preferences", m_parent ));
 
@@ -942,12 +934,7 @@ struct GameMode {
 };
 
 void RegisterPreferences( PreferenceSystem& preferences ){
-#if GDEF_OS_WINDOWS
-       preferences.registerPreference( "UseCustomShaderEditor", make_property_string( g_TextEditor_useWin32Editor ) );
-#else
-       preferences.registerPreference( "UseCustomShaderEditor", make_property_string( g_TextEditor_useCustomEditor ) );
        preferences.registerPreference( "CustomShaderEditorCommand", make_property_string( g_TextEditor_editorCommand ) );
-#endif
 
        preferences.registerPreference( "GameName", make_property<GameName>() );
        preferences.registerPreference( "GameMode", make_property<GameMode>() );
index f02474e0686f7e3ff13b7e4316396d6f7655f6e9..6612c335d6f6da83f3bcb60a4ae850552b89db02 100644 (file)
@@ -27,7 +27,7 @@
 
 #include "gtkdlgs.h"
 
-void ViewShader( const char *pFile, const char *pName ){
+void ViewShader( const char *pFile, const char *pName, bool external_editor ){
        char* pBuff = 0;
        //int nSize =
        vfsLoadFile( pFile, reinterpret_cast<void**>( &pBuff ) );
@@ -123,5 +123,5 @@ void ViewShader( const char *pFile, const char *pName ){
        // now close the file
        vfsFreeFile( pBuff );
 
-       DoTextEditor( pFile, static_cast<int>( nOffset ), length );
+       DoTextEditor( pFile, static_cast<int>( nOffset ), length, external_editor );
 }
index 6cf0ec853d9ab8e3bbee67c9e7840bafca4dd37b..7758853aef268c5bef754d2e517e5d1a9d8cd6c5 100644 (file)
@@ -22,6 +22,6 @@
 #if !defined( INCLUDED_SHADERS_H )
 #define INCLUDED_SHADERS_H
 
-void ViewShader( const char* file, const char* shader );
+void ViewShader( const char* file, const char* shader, bool external_editor );
 
 #endif
index f0e331c4f68f399e672bf5aa7f499d1ba9b1696f..a76c0d99e912783deb95ad95e949b4a96d09d771 100644 (file)
@@ -1075,19 +1075,10 @@ IShader* Texture_At( TextureBrowser& textureBrowser, int mx, int my ){
    By mouse click
    ==============
  */
-void SelectTexture( TextureBrowser& textureBrowser, int mx, int my, bool bShift ){
-       IShader* shader = Texture_At( textureBrowser, mx, my );
-       if ( shader != 0 ) {
-               if ( bShift ) {
-                       if ( shader->IsDefault() ) {
-                               globalOutputStream() << "ERROR: " << shader->getName() << " is not a shader, it's a texture.\n";
-                       }
-                       else{
-                               ViewShader( shader->getShaderFileName(), shader->getName() );
-                       }
-               }
-               else
-               {
+void SelectTexture( TextureBrowser& textureBrowser, int mx, int my, guint32 flags ){
+       if ( ( flags & GDK_SHIFT_MASK ) == 0 ) {
+               IShader* shader = Texture_At( textureBrowser, mx, my );
+               if ( shader != 0 ) {
                        TextureBrowser_SetSelectedShader( textureBrowser, shader->getName() );
                        TextureBrowser_textureSelected( shader->getName() );
 
@@ -1136,7 +1127,21 @@ void TextureBrowser_Tracking_MouseDown( TextureBrowser& textureBrowser ){
 }
 
 void TextureBrowser_Selection_MouseDown( TextureBrowser& textureBrowser, guint32 flags, int pointx, int pointy ){
-       SelectTexture( textureBrowser, pointx, textureBrowser.height - 1 - pointy, ( flags & GDK_SHIFT_MASK ) != 0 );
+       SelectTexture( textureBrowser, pointx, textureBrowser.height - 1 - pointy, flags );
+}
+
+void TextureBrowser_Selection_MouseUp( TextureBrowser& textureBrowser, guint32 flags, int pointx, int pointy ){
+       if ( ( flags & GDK_SHIFT_MASK ) != 0 ) {
+               IShader* shader = Texture_At( textureBrowser, pointx, textureBrowser.height - 1 - pointy );
+               if ( shader != 0 ) {
+                       if ( shader->IsDefault() ) {
+                               globalOutputStream() << "ERROR: " << shader->getName() << " is not a shader, it's a texture.\n";
+                       }
+                       else{
+                               ViewShader( shader->getShaderFileName(), shader->getName(), ( flags & GDK_CONTROL_MASK ) != 0 );
+                       }
+               }
+       }
 }
 
 /*
@@ -1537,6 +1542,9 @@ gboolean TextureBrowser_button_release( ui::Widget widget, GdkEventButton* event
                                TextureBrowser_Tracking_MouseUp( *textureBrowser );
                        }
                }
+               if ( event->button == 1 ) {
+                       TextureBrowser_Selection_MouseUp( *textureBrowser, event->state, static_cast<int>( event->x ), static_cast<int>( event->y ) );
+               }
        }
        return FALSE;
 }
index ccc5f5e7df31a7607a9331ffe8e020a10ffd27db..6da0a4b25fefd0907a712493a7da1f2906553915 100644 (file)
@@ -138,7 +138,9 @@ void ClipPoint::Draw( const char *label, float scale ){
 
        // draw label
        glRasterPos3f( m_ptClip[0] + offset, m_ptClip[1] + offset, m_ptClip[2] + offset );
-       glCallLists( GLsizei( strlen( label ) ), GL_UNSIGNED_BYTE, label );
+       //glCallLists( GLsizei( strlen( label ) ), GL_UNSIGNED_BYTE, label );   //fails with GCC
+       //glCallLists( GLsizei( strlen( label ) ), GL_UNSIGNED_BYTE, reinterpret_cast<const GLubyte*>( label ) );       //worx
+       GlobalOpenGL().drawString( label );
 }
 
 float fDiff( float f1, float f2 ){
@@ -544,7 +546,7 @@ void XYWnd::ZoomOut(){
 void XYWnd::ZoomInWithMouse( int pointx, int pointy ){
        float old_scale = Scale();
        ZoomIn();
-       if ( g_xywindow_globals.m_bImprovedWheelZoom ) {
+       if ( g_xywindow_globals.m_bZoomInToPointer ) {
                float scale_diff = 1.0 / old_scale - 1.0 / Scale();
                int nDim1 = ( m_viewType == YZ ) ? 1 : 0;
                int nDim2 = ( m_viewType == XY ) ? 1 : 2;
@@ -987,14 +989,30 @@ void XYWnd::Clipper_OnMouseMoved( int x, int y ){
        }
 }
 
+//#include "gtkutil/image.h"
+
+/* is called on every mouse move fraction; ain't good! */
 void XYWnd::Clipper_Crosshair_OnMouseMoved( int x, int y ){
        Vector3 mousePosition;
        XY_ToPoint( x, y, mousePosition );
-       if ( ClipMode() && GlobalClipPoints_Find( mousePosition, (VIEWTYPE)m_viewType, m_fScale ) != 0 ) {
-               GdkCursor *cursor;
-               cursor = gdk_cursor_new( GDK_CROSSHAIR );
-               gdk_window_set_cursor( gtk_widget_get_window(m_gl_widget), cursor );
-               gdk_cursor_unref( cursor );
+       if ( ClipMode() ) {
+               if( GlobalClipPoints_Find( mousePosition, (VIEWTYPE)m_viewType, m_fScale ) != 0 ){
+                       GdkCursor *cursor;
+                       cursor = gdk_cursor_new( GDK_CROSSHAIR );
+                       //cursor = gdk_cursor_new( GDK_FLEUR );
+                       gdk_window_set_cursor( gtk_widget_get_window(m_gl_widget), cursor );
+                       gdk_cursor_unref( cursor );
+               }
+               else{
+                       GdkCursor *cursor;
+                       cursor = gdk_cursor_new( GDK_HAND2 );
+//                     GdkPixbuf* pixbuf = pixbuf_new_from_file_with_mask( "bitmaps/icon.png" );
+//                     cursor = gdk_cursor_new_from_pixbuf( gdk_display_get_default(), pixbuf, 0, 0 );
+//                     g_object_unref( pixbuf );
+                       gdk_window_set_cursor( gtk_widget_get_window(m_gl_widget), cursor );
+                       gdk_cursor_unref( cursor );
+
+               }
        }
        else
        {
@@ -1290,6 +1308,8 @@ unsigned int Zoom_buttons(){
 }
 
 int g_dragZoom = 0;
+int g_zoom2x = 0;
+int g_zoom2y = 0;
 
 void XYWnd_zoomDelta( int x, int y, unsigned int state, void* data ){
        if ( y != 0 ) {
@@ -1302,7 +1322,12 @@ void XYWnd_zoomDelta( int x, int y, unsigned int state, void* data ){
                        }
                        else
                        {
-                               reinterpret_cast<XYWnd*>( data )->ZoomIn();
+                               if ( g_xywindow_globals.m_bZoomInToPointer ) {
+                                       reinterpret_cast<XYWnd*>( data )->ZoomInWithMouse( g_zoom2x, g_zoom2y );
+                               }
+                               else{
+                                       reinterpret_cast<XYWnd*>( data )->ZoomIn();
+                               }
                                g_dragZoom += 8;
                        }
                }
@@ -1314,12 +1339,14 @@ gboolean XYWnd_Zoom_focusOut( ui::Widget widget, GdkEventFocus* event, XYWnd* xy
        return FALSE;
 }
 
-void XYWnd::Zoom_Begin(){
+void XYWnd::Zoom_Begin( int x, int y ){
        if ( m_zoom_started ) {
                Zoom_End();
        }
        m_zoom_started = true;
        g_dragZoom = 0;
+       g_zoom2x = x;
+       g_zoom2y = y;
        g_xywnd_freezePointer.freeze_pointer( m_parent ? m_parent : MainFrame_getWindow(), m_gl_widget, XYWnd_zoomDelta, this );
        m_zoom_focusOut = m_gl_widget.connect( "focus_out_event", G_CALLBACK( XYWnd_Zoom_focusOut ), this );
 }
@@ -1366,7 +1393,7 @@ void XYWnd::XY_MouseDown( int x, int y, unsigned int buttons ){
                EntityCreate_MouseDown( x, y );
        }
        else if ( buttons == Zoom_buttons() ) {
-               Zoom_Begin();
+               Zoom_Begin( x, y );
        }
        else if ( ClipMode() && ( buttons == Clipper_buttons() || buttons == Clipper_quick_buttons() ) ) {
                Clipper_OnLButtonDown( x, y );
@@ -3071,6 +3098,7 @@ void Orthographic_constructPreferences( PreferencesPage& page ){
        //page.appendCheckBox( "", "Display size info", g_xywindow_globals_private.m_bSizePaint );
        page.appendCheckBox( "", "Chase mouse during drags", g_xywindow_globals_private.m_bChaseMouse );
 //     page.appendCheckBox( "", "Update views on camera move", g_xywindow_globals_private.m_bCamXYUpdate );
+       page.appendCheckBox( "", "Zoom In to Mouse pointer", g_xywindow_globals.m_bZoomInToPointer );
 }
 void Orthographic_constructPage( PreferenceGroup& group ){
        PreferencesPage page( group.createPage( "Orthographic", "Orthographic View Preferences" ) );
@@ -3127,7 +3155,7 @@ void XYWindow_Construct(){
        GlobalPreferenceSystem().registerPreference( "ClipCaulk", make_property_string( g_clip_useCaulk ) );
 
 //     GlobalPreferenceSystem().registerPreference( "NewRightClick", make_property_string( g_xywindow_globals.m_bRightClick ) );
-       GlobalPreferenceSystem().registerPreference( "ImprovedWheelZoom", make_property_string( g_xywindow_globals.m_bImprovedWheelZoom ) );
+       GlobalPreferenceSystem().registerPreference( "2DZoomInToPointer", make_property_string( g_xywindow_globals.m_bZoomInToPointer ) );
        GlobalPreferenceSystem().registerPreference( "ChaseMouse", make_property_string( g_xywindow_globals_private.m_bChaseMouse ) );
        GlobalPreferenceSystem().registerPreference( "SizePainting", make_property_string( g_xywindow_globals_private.m_bSizePaint ) );
        GlobalPreferenceSystem().registerPreference( "ShowCrosshair", make_property_string( g_xywindow_globals_private.g_bCrossHairs ) );
index 1097a28c82a703bd9a56a47deb4122f94db9b1a3..966f374996a95f6b738eaf2b3bf16855b651c49b 100644 (file)
@@ -119,7 +119,7 @@ void Move_End();
 bool m_move_started;
 guint m_move_focusOut;
 
-void Zoom_Begin();
+void Zoom_Begin( int x, int y );
 void Zoom_End();
 bool m_zoom_started;
 guint m_zoom_focusOut;
@@ -267,7 +267,7 @@ struct xywindow_globals_t
 
 //     bool m_bRightClick;
        bool m_bNoStipple;
-       bool m_bImprovedWheelZoom;
+       bool m_bZoomInToPointer;
 
        xywindow_globals_t() :
                color_gridback( 0.77f, 0.77f, 0.77f ),
@@ -285,7 +285,7 @@ struct xywindow_globals_t
                AxisColorZ( 0.f, 0.f, 1.f ),
 //             m_bRightClick( true ),
                m_bNoStipple( true ),
-               m_bImprovedWheelZoom( true ){
+               m_bZoomInToPointer( true ){
        }
 
 };
index c592a1daf5a734860675d0570658432af4c43286..b7c91f15e1e3b7a2a1abf842a47ea054a39cd2ea 100644 (file)
@@ -220,6 +220,7 @@ int ShiftBSPMain( int argc, char **argv ){
        {
                //find point on plane
                for ( j=0; j<3; j++ ){
+                       //point[j] = bspPlanes[ i ].dist * bspPlanes[ i ].normal[j];
                        if ( fabs( bspPlanes[ i ].normal[j] ) > 0.5 ){
                                point[j] = bspPlanes[ i ].dist / bspPlanes[ i ].normal[j];
                                point[(j+1)%3] = point[(j+2)%3] = 0;