]> git.rm.cloudns.org Git - xonotic/netradiant.git/commitdiff
Radiant:
authorGarux <garux@mail.ru>
Wed, 2 Aug 2017 06:18:45 +0000 (09:18 +0300)
committerGarux <garux@mail.ru>
Wed, 2 Aug 2017 06:18:45 +0000 (09:18 +0300)
binds...
* ctrl + shift + m1 (in texbro): open shader in external editor
misc...
* fix: do not unmaximize external shader editor on win
* fix: blank cursor in radiant after calling external shader editor on win
* fix shader editors stuff for non uindowses
* 'Shader Editor Command' preference is available on win (is used, if set; otherwise try default os action for file)
* fix: 'Shader Editor Command' preference allows selecting executable via dialog
* GDK_HAND2 cursor in clipper tool mode
* fix: clipper points have numeric labels
* '2d zoom in to mouse pointer' option works for alt + m2 zoom
* '3d zoom in to mouse pointer' option (def = yes)

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 fdad03e1d15c7230f27b82491f26f30c02524db5..ca7e26a0ac360ab15bc623ac72d1bc5ac446f420 100644 (file)
@@ -888,7 +888,32 @@ gboolean selection_motion_freemove( GtkWidget *widget, GdkEventMotion *event, Wi
 gboolean wheelmove_scroll( GtkWidget* 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() );
@@ -1891,6 +1916,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",
                FreeCaller1<bool, CamWnd_Move_Discrete_Import>(),
@@ -2026,6 +2052,7 @@ void CamWnd_Construct(){
        GlobalPreferenceSystem().registerPreference( "SI_Colors12", Vector3ImportStringCaller( g_camwindow_globals.color_selbrushes3d ), Vector3ExportStringCaller( g_camwindow_globals.color_selbrushes3d ) );
        GlobalPreferenceSystem().registerPreference( "CameraRenderMode", makeIntStringImportCallback( RenderModeImportCaller() ), makeIntStringExportCallback( RenderModeExportCaller() ) );
        GlobalPreferenceSystem().registerPreference( "StrafeMode", IntImportStringCaller( g_camwindow_globals_private.m_nStrafeMode ), IntExportStringCaller( g_camwindow_globals_private.m_nStrafeMode ) );
+       GlobalPreferenceSystem().registerPreference( "3DZoomInToPointer", BoolImportStringCaller( g_camwindow_globals.m_bZoomInToPointer ), BoolExportStringCaller( g_camwindow_globals.m_bZoomInToPointer ) );
 
        CamWnd_constructStatic();
 
index c40c8fb08be89a1da6b13046602b042d4914a140..ce8db6e2538d32f8c49c69511615a3d7bf35bada 100644 (file)
@@ -68,10 +68,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 e187d8030fd8158ab64b713c52745c53ef9ac029..f1096bf087dc4c73346f5fc7a23a4860db5bb8a0 100644 (file)
@@ -1338,6 +1338,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 32ee3f3ec6af874edc0bfadc645e4ea637ca3d87..d0738e8d11b3891357728787673215c85179e29a 100644 (file)
@@ -874,9 +874,9 @@ static void DoGtkTextEditor( const char* filename, guint cursorpos, int length )
                gtk_widget_show( text_editor );
                gtk_window_present( GTK_WINDOW( text_editor ) );
 
-#ifdef WIN32
+//#ifdef WIN32
                process_gui();
-#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
@@ -890,9 +890,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);
                }
 
-#ifdef WIN32
+//#ifdef WIN32
                gtk_widget_queue_draw( text_widget );
-#endif
+//#endif
 
                text_buffer_ = text_buffer;
                free( buf );
@@ -1088,77 +1088,72 @@ EMessageBoxReturn DoShaderInfoDlg( const char* name, const char* filename, char*
 #include <gdk/gdkwin32.h>
 #endif
 
-#ifdef WIN32
-// 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 ){
-#ifdef WIN32
-       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( MainFrame_getWindow() )->window ), "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( MainFrame_getWindow() )->window ), "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 a0ad74018e8d6fd37d02654d9593b2c4847ed630..dfebe8f805decc252711624cf3c698301cc2cf7f 100644 (file)
@@ -38,7 +38,7 @@ EMessageBoxReturn DoLightIntensityDlg( int *intensity );
 EMessageBoxReturn DoShaderTagDlg( CopiedString *tag, char* title );
 EMessageBoxReturn DoShaderInfoDlg( const char* name, const char* filename, 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();
 
@@ -47,13 +47,8 @@ void DoSides( int type, int axis );
 void DoAbout();
 
 
-#ifdef WIN32
-extern bool g_TextEditor_useWin32Editor;
-#else
 #include "string/stringfwd.h"
-extern bool g_TextEditor_useCustomEditor;
 extern CopiedString g_TextEditor_editorCommand;
-#endif
 
 
 #endif
index b3d176ba21a89d814e3c28cad4685e51bdcd22b5..52ea88774d627f3d63e98d95c925373e2a93b976 100644 (file)
@@ -70,15 +70,7 @@ void Global_constructPreferences( PreferencesPage& page ){
 }
 
 void Interface_constructPreferences( PreferencesPage& page ){
-#ifdef WIN32
-       page.appendCheckBox( "", "External Shader Editor", g_TextEditor_useWin32Editor );
-#else
-       {
-               GtkWidget* use_custom = page.appendCheckBox( "Text Editor", "Custom", g_TextEditor_useCustomEditor );
-               GtkWidget* 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 ){
@@ -87,7 +79,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" ) );
@@ -702,7 +694,7 @@ PreferencesPage createPage( const char* treeName, const char* frameName ){
 
 GtkWindow* PrefsDlg::BuildDialog(){
        PreferencesDialog_addInterfacePreferences( FreeCaller1<PreferencesPage&, Interface_constructPreferences>() );
-       Mouse_registerPreferencesPage();
+       //Mouse_registerPreferencesPage();
 
        GtkWindow* dialog = create_floating_window( "NetRadiant Preferences", m_parent );
 
@@ -972,12 +964,7 @@ typedef FreeCaller1<const StringImportCallback&, GameMode_exportString> GameMode
 
 
 void RegisterPreferences( PreferenceSystem& preferences ){
-#ifdef WIN32
-       preferences.registerPreference( "UseCustomShaderEditor", BoolImportStringCaller( g_TextEditor_useWin32Editor ), BoolExportStringCaller( g_TextEditor_useWin32Editor ) );
-#else
-       preferences.registerPreference( "UseCustomShaderEditor", BoolImportStringCaller( g_TextEditor_useCustomEditor ), BoolExportStringCaller( g_TextEditor_useCustomEditor ) );
        preferences.registerPreference( "CustomShaderEditorCommand", CopiedStringImportStringCaller( g_TextEditor_editorCommand ), CopiedStringExportStringCaller( g_TextEditor_editorCommand ) );
-#endif
 
        preferences.registerPreference( "GameName", GameNameImportStringCaller(), GameNameExportStringCaller() );
        preferences.registerPreference( "GameMode", GameModeImportStringCaller(), GameModeExportStringCaller() );
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 366019ca897ff8752b3a29ca721f779c82ea6dc8..926937ea55341ee7e8ede09b21c8eda668ae4ff4 100644 (file)
@@ -973,19 +973,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() );
 
@@ -1034,7 +1025,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 );
+                       }
+               }
+       }
 }
 
 /*
@@ -1434,6 +1439,9 @@ gboolean TextureBrowser_button_release( GtkWidget* 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 ee957abe7a67c2e780821803d246232d1374fcb6..8b2da7cbd24ecec059b97671c0e48142cead2595 100644 (file)
@@ -136,7 +136,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 ){
@@ -537,7 +539,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;
@@ -982,14 +984,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( m_gl_widget->window, 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( m_gl_widget->window, 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( m_gl_widget->window, cursor );
+                       gdk_cursor_unref( cursor );
+
+               }
        }
        else
        {
@@ -1285,6 +1303,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 ) {
@@ -1297,7 +1317,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;
                        }
                }
@@ -1309,12 +1334,14 @@ gboolean XYWnd_Zoom_focusOut( GtkWidget* 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 != 0 ? m_parent : MainFrame_getWindow(), m_gl_widget, XYWnd_zoomDelta, this );
        m_zoom_focusOut = g_signal_connect( G_OBJECT( m_gl_widget ), "focus_out_event", G_CALLBACK( XYWnd_Zoom_focusOut ), this );
 }
@@ -1361,7 +1388,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 );
@@ -2983,6 +3010,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" ) );
@@ -3040,7 +3068,7 @@ void XYWindow_Construct(){
        GlobalPreferenceSystem().registerPreference( "ClipCaulk", BoolImportStringCaller( g_clip_useCaulk ), BoolExportStringCaller( g_clip_useCaulk ) );
 
 //     GlobalPreferenceSystem().registerPreference( "NewRightClick", BoolImportStringCaller( g_xywindow_globals.m_bRightClick ), BoolExportStringCaller( g_xywindow_globals.m_bRightClick ) );
-       GlobalPreferenceSystem().registerPreference( "ImprovedWheelZoom", BoolImportStringCaller( g_xywindow_globals.m_bImprovedWheelZoom ), BoolExportStringCaller( g_xywindow_globals.m_bImprovedWheelZoom ) );
+       GlobalPreferenceSystem().registerPreference( "2DZoomInToPointer", BoolImportStringCaller( g_xywindow_globals.m_bZoomInToPointer ), BoolExportStringCaller( g_xywindow_globals.m_bZoomInToPointer ) );
        GlobalPreferenceSystem().registerPreference( "ChaseMouse", BoolImportStringCaller( g_xywindow_globals_private.m_bChaseMouse ), BoolExportStringCaller( g_xywindow_globals_private.m_bChaseMouse ) );
        GlobalPreferenceSystem().registerPreference( "SizePainting", BoolImportStringCaller( g_xywindow_globals_private.m_bSizePaint ), BoolExportStringCaller( g_xywindow_globals_private.m_bSizePaint ) );
        GlobalPreferenceSystem().registerPreference( "ShowCrosshair", BoolImportStringCaller( g_bCrossHairs ), BoolExportStringCaller( g_bCrossHairs ) );
index 822045a5726c30c4524a6ccd86a9e6f7fafdb1ce..a3fbd3019d731982e33c372cc29dfb81671b7213 100644 (file)
@@ -121,7 +121,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;
@@ -269,7 +269,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 ),
@@ -287,7 +287,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 1b8275dfe090287969b0c4bb9ccf2850cc2ca1d2..ff95bbdf478f958cc44a3200bcf3c7a05b8e3fc4 100644 (file)
@@ -1596,6 +1596,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;