]> git.xonotic.org Git - xonotic/netradiant.git/commitdiff
Merge commit 'a764616a9c1b2f9148e3381f808b600c512592c9' into master-merge
authorThomas Debesse <dev@illwieckz.net>
Tue, 21 Jun 2022 01:38:14 +0000 (03:38 +0200)
committerThomas Debesse <dev@illwieckz.net>
Tue, 21 Jun 2022 01:38:14 +0000 (03:38 +0200)
22 files changed:
libs/gtkutil/cursor.cpp
libs/gtkutil/cursor.h
libs/uniquenames.h
radiant/brush.h
radiant/brush_primit.cpp
radiant/brush_primit.h
radiant/brushmanip.cpp
radiant/brushmanip.h
radiant/build.cpp
radiant/camwindow.cpp
radiant/entityinspector.cpp
radiant/findtexturedialog.cpp
radiant/gtkdlgs.cpp
radiant/mainframe.cpp
radiant/map.cpp
radiant/patchdialog.cpp
radiant/select.cpp
radiant/select.h
radiant/surfacedialog.cpp
radiant/texwindow.cpp
radiant/watchbsp.cpp
radiant/xywindow.cpp

index 46f227fce03c65ea49abf02e843481852a3acd52..e4d34b7d1607345ad734c6a362b3399969f48ae9 100644 (file)
@@ -106,7 +106,6 @@ gboolean FreezePointer::motion_delta(ui::Widget widget, GdkEventMotion *event, F
 
                gdk_window_get_origin( gtk_widget_get_window( widget ), &window_x, &window_y);
 
-
                translated_x = current_x - ( window_x );
                translated_y = current_y - ( window_y );
 
@@ -159,11 +158,20 @@ gboolean FreezePointer::motion_delta(ui::Widget widget, GdkEventMotion *event, F
                        self->last_x = reposition_x;
                        self->last_y = reposition_y;
                }
+#else
+#if 0 // NetRadiantCustom
+               int ddx = current_x - self->center_x;
+               int ddy = current_y - self->center_y;
 #else
                int ddx = current_x - self->recorded_x;
                int ddy = current_y - self->recorded_y;
+#endif
                if (ddx < -32 || ddx > 32 || ddy < -32 || ddy > 32) {
+#if 0 // NetRadiantCustom
+                       Sys_SetCursorPos( widget, self->center_x, self->center_y );
+#else
                        Sys_SetCursorPos( widget, self->recorded_x, self->recorded_y );
+#endif
                        self->last_x = self->recorded_x;
                        self->last_y = self->recorded_y;
                }
@@ -173,7 +181,8 @@ gboolean FreezePointer::motion_delta(ui::Widget widget, GdkEventMotion *event, F
        return FALSE;
 }
 
-// Note: NetRadiantCustom pass both parent and widget.
+/* NetRadiantCustom did this instead:
+void FreezePointer::freeze_pointer(ui::Window window, ui::Widget widget, FreezePointer::MotionDeltaFunction function, void *data) */
 void FreezePointer::freeze_pointer(ui::Widget widget, FreezePointer::MotionDeltaFunction function, void *data)
 {
        /* FIXME: This bug can happen if the pointer goes outside of the
@@ -213,18 +222,41 @@ void FreezePointer::freeze_pointer(ui::Widget widget, FreezePointer::MotionDelta
        third-party updates that may fix the mouse pointer
        visibility issue. */
 #else
+#if 0 // NetRadiantCustom
        GdkCursor* cursor = create_blank_cursor();
        //GdkGrabStatus status =
+       /*      fixes cursor runaways during srsly quick drags in camera
+       drags with pressed buttons have no problem at all w/o this      */
+       gdk_pointer_grab( gtk_widget_get_window( widget ), TRUE, mask, 0, cursor, GDK_CURRENT_TIME );
+       //gdk_window_set_cursor ( GTK_WIDGET( window )->window, cursor );
+       /*      is needed to fix activating neighbour widgets, that happens, if using upper one */
+       gtk_grab_add( widget );
+       weedjet = widget;
+#else
+       GdkCursor* cursor = create_blank_cursor();
+       //GdkGrabStatus status =
        gdk_pointer_grab( gtk_widget_get_window( widget ), TRUE, mask, 0, cursor, GDK_CURRENT_TIME );
        gdk_cursor_unref( cursor );
+#endif
 #endif
 
        Sys_GetCursorPos( widget, &recorded_x, &recorded_y );
 
-       Sys_SetCursorPos( widget, recorded_x, recorded_y );
+#if 0 // NetRadiantCustom
+       /*      using center for tracking for max safety        */
+       gdk_window_get_origin( GTK_WIDGET( widget )->window, &center_x, &center_y );
+       auto allocation = widget.dimensions();
+       center_y += allocation.height / 2;
+       center_x += allocation.width / 2;
+
+       Sys_SetCursorPos( widget, center_x, center_y );
 
+       last_x = center_x;
+       last_y = center_y;
+#else
        last_x = recorded_x;
        last_y = recorded_y;
+#endif
 
        m_function = function;
        m_data = data;
@@ -243,9 +275,17 @@ void FreezePointer::unfreeze_pointer(ui::Widget widget)
        /* The pointer was visible during all the move operation,
        so, keep the current position. */
 #else
-       // Note: NetRadiantCustom still uses window instead of widget.
+       // NetRadiantCustom still uses window instead of widget.
+#if 0 // NetRadiantCustom
+//     Sys_SetCursorPos( widget, center_x, center_y );
+#else
        Sys_SetCursorPos( widget, recorded_x, recorded_y );
+#endif
 #endif
 
        gdk_pointer_ungrab( GDK_CURRENT_TIME );
+
+#if 0 // NetRadiantCustom
+       gtk_grab_remove( weedjet );
+#endif
 }
index db0234d7c50e1ed58efb5bf6bcb4c6869e2e4659..f7a66a37d3b193f99e913229f39973a9d2c0da3a 100644 (file)
@@ -30,7 +30,7 @@
 typedef struct _GdkCursor GdkCursor;
 typedef struct _GdkEventMotion GdkEventMotion;
 
-// Note: NetRadiantCustom disables them but we still make use of them.
+// NetRadiantCustom disables them but we still make use of them.
 #if 1
 GdkCursor* create_blank_cursor();
 void set_cursor( ui::Widget widget, GdkCursorType cursor_type );
@@ -111,16 +111,23 @@ class FreezePointer
 {
 unsigned int handle_motion;
 int recorded_x, recorded_y, last_x, last_y, center_x, center_y;
+ui::Widget weedjet{ui::null};
 typedef void ( *MotionDeltaFunction )( int x, int y, unsigned int state, void* data );
 MotionDeltaFunction m_function;
 void* m_data;
 public:
 FreezePointer() : handle_motion( 0 ), m_function( 0 ), m_data( 0 ){
 }
+/* NetRadiantCustom does this instead:
+static gboolean motion_delta( ui::Window widget, GdkEventMotion *event, FreezePointer* self ); */
 static gboolean motion_delta( ui::Widget widget, GdkEventMotion *event, FreezePointer* self );
 
+/* NetRadiantCustom does this instead:
+void freeze_pointer( ui::Window window, ui::Widget widget, MotionDeltaFunction function, void* data ); */
 void freeze_pointer( ui::Widget widget, MotionDeltaFunction function, void* data );
 
+/* NetRadiantCustom does this instead:
+void unfreeze_pointer( ui::Window window ); */
 void unfreeze_pointer( ui::Widget widget );
 };
 
index 8ff67f15b55150829fa103413b03593d4e3f1992..9f89ba4556bdc2352517946c3eadf3f6b8d1a04c 100644 (file)
@@ -187,17 +187,25 @@ name_t make_unique( const name_t& name ) const {
        char buf[80];
        name_t r( "","" );
        name_write( buf, name );
+       #ifdef _DEBUG
        globalErrorStream() << "find unique name for " << buf << "\n";
        globalErrorStream() << "> currently registered names:\n";
+       #endif
        for ( names_t::const_iterator i = m_names.begin(); i != m_names.end(); ++i )
        {
+               #ifdef _DEBUG
                globalErrorStream() << ">> " << i->first.c_str() << ": ";
+               #endif
                for ( PostFixes::postfixes_t::const_iterator j = i->second.m_postfixes.begin(); j != i->second.m_postfixes.end(); ++j )
                {
                        j->first.write( buf );
+                       #ifdef _DEBUG
                        globalErrorStream() << " '" << buf << "'";
+                       #endif
                }
+               #ifdef _DEBUG
                globalErrorStream() << "\n";
+               #endif
        }
        names_t::const_iterator i = m_names.find( name.first );
        if ( i == m_names.end() ) {
@@ -208,7 +216,9 @@ name_t make_unique( const name_t& name ) const {
                r = name_t( name.first, ( *i ).second.make_unique( name.second ) );
        }
        name_write( buf, r );
+       #ifdef _DEBUG
        globalErrorStream() << "> unique name is " << buf << "\n";
+       #endif
        return r;
 }
 
index f258d84afb6694632d0ad1a0ab1081b596c5810e..3b0b8c7c472b0ea427673503c6f7ad748ca15abb 100644 (file)
@@ -599,14 +599,6 @@ void fit( const Vector3& normal, const Winding& winding, float s_repeat, float t
        Texdef_FitTexture( m_projection, m_shader.width(), m_shader.height(), normal, winding, s_repeat, t_repeat );
 }
 
-void fitW( const Vector3& normal, const Winding& winding, float s_repeat, float t_repeat ){
-       Texdef_FitTextureW( m_projection, m_shader.width(), m_shader.height(), normal, winding, s_repeat, t_repeat );
-}
-
-void fitH( const Vector3& normal, const Winding& winding, float s_repeat, float t_repeat ){
-       Texdef_FitTextureH( m_projection, m_shader.width(), m_shader.height(), normal, winding, s_repeat, t_repeat );
-}
-
 void emitTextureCoordinates( Winding& winding, const Vector3& normal, const Matrix4& localToWorld ){
        Texdef_EmitTextureCoordinates( m_projection, m_shader.width(), m_shader.height(), winding, normal, localToWorld );
 }
@@ -1235,18 +1227,6 @@ void FitTexture( float s_repeat, float t_repeat ){
        texdefChanged();
 }
 
-void FitTextureW( float s_repeat, float t_repeat ){
-       undoSave();
-       m_texdef.fitW( m_plane.plane3().normal(), m_winding, s_repeat, t_repeat );
-       texdefChanged();
-}
-
-void FitTextureH( float s_repeat, float t_repeat ){
-       undoSave();
-       m_texdef.fitH( m_plane.plane3().normal(), m_winding, s_repeat, t_repeat );
-       texdefChanged();
-}
-
 void EmitTextureCoordinates(){
        Texdef_EmitTextureCoordinates( m_texdefTransformed, m_shader.width(), m_shader.height(), m_winding, plane3().normal(), g_matrix4_identity );
 }
index 872dfafb5e6bba9bb66c6b14acebb06c443f1c34..c2042d1e6e2dcdb8174aaa5b237141165af0ca5e 100644 (file)
@@ -1109,90 +1109,28 @@ void Texdef_FitTexture( TextureProjection& projection, std::size_t width, std::s
        bounds.extents.z() = 1;
 
        // the bounds of a perfectly fitted texture transform
-       AABB perfect( Vector3( s_repeat * 0.5, t_repeat * 0.5, 0 ), Vector3( s_repeat * 0.5, t_repeat * 0.5, 1 ) );
-
-       // the difference between the current texture transform and the perfectly fitted transform
-       Matrix4 matrix( matrix4_translation_for_vec3( bounds.origin - perfect.origin ) );
-       matrix4_pivoted_scale_by_vec3( matrix, bounds.extents / perfect.extents, perfect.origin );
-       matrix4_affine_invert( matrix );
-
-       // apply the difference to the current texture transform
-       matrix4_premultiply_by_matrix4( st2tex, matrix );
-
-       Texdef_fromTransform( projection, (float)width, (float)height, st2tex );
-       Texdef_normalise( projection, (float)width, (float)height );
-}
-
-void Texdef_FitTextureW( TextureProjection& projection, std::size_t width, std::size_t height, const Vector3& normal, const Winding& w, float s_repeat, float t_repeat ){
-       if ( w.numpoints < 3 ) {
-               return;
+       AABB perfect;
+       if( t_repeat == 0 && s_repeat == 0 ){
+               //bad user's input
+               t_repeat = s_repeat = 1;
+               perfect.origin = Vector3( s_repeat * 0.5, t_repeat * 0.5, 0 );
+               perfect.extents = Vector3( s_repeat * 0.5, t_repeat * 0.5, 1 );
+       }
+       if( t_repeat == 0 ){
+               //fit width
+               perfect.origin = Vector3( s_repeat * 0.5, s_repeat * 0.5 * bounds.extents.y() / bounds.extents.x(), 0 );
+               perfect.extents = Vector3( s_repeat * 0.5, s_repeat * 0.5 * bounds.extents.y() / bounds.extents.x(), 1 );
+       }
+       else if( s_repeat == 0 ){
+               //fit height
+               perfect.origin = Vector3( t_repeat * 0.5 * bounds.extents.x() / bounds.extents.y(), t_repeat * 0.5, 0 );
+               perfect.extents = Vector3( t_repeat * 0.5 * bounds.extents.x() / bounds.extents.y(), t_repeat * 0.5, 1 );
+       }
+       else{
+               perfect.origin = Vector3( s_repeat * 0.5, t_repeat * 0.5, 0 );
+               perfect.extents = Vector3( s_repeat * 0.5, t_repeat * 0.5, 1 );
        }
 
-       Matrix4 st2tex;
-       Texdef_toTransform( projection, (float)width, (float)height, st2tex );
-
-       // the current texture transform
-       Matrix4 local2tex = st2tex;
-       {
-               Matrix4 xyz2st;
-               Texdef_basisForNormal( projection, normal, xyz2st );
-               matrix4_multiply_by_matrix4( local2tex, xyz2st );
-       }
-
-       // the bounds of the current texture transform
-       AABB bounds;
-       for ( Winding::const_iterator i = w.begin(); i != w.end(); ++i )
-       {
-               Vector3 texcoord = matrix4_transformed_point( local2tex, ( *i ).vertex );
-               aabb_extend_by_point_safe( bounds, texcoord );
-       }
-       bounds.origin.z() = 0;
-       bounds.extents.z() = 1;
-
-       // the bounds of a perfectly fitted texture transform
-       AABB perfect( Vector3( s_repeat * 0.5, s_repeat * 0.5 * bounds.extents.y() / bounds.extents.x(), 0 ), Vector3( s_repeat * 0.5, s_repeat * 0.5 * bounds.extents.y() / bounds.extents.x(), 1 ) );
-
-       // the difference between the current texture transform and the perfectly fitted transform
-       Matrix4 matrix( matrix4_translation_for_vec3( bounds.origin - perfect.origin ) );
-       matrix4_pivoted_scale_by_vec3( matrix, bounds.extents / perfect.extents, perfect.origin );
-       matrix4_affine_invert( matrix );
-
-       // apply the difference to the current texture transform
-       matrix4_premultiply_by_matrix4( st2tex, matrix );
-
-       Texdef_fromTransform( projection, (float)width, (float)height, st2tex );
-       Texdef_normalise( projection, (float)width, (float)height );
-}
-
-void Texdef_FitTextureH( TextureProjection& projection, std::size_t width, std::size_t height, const Vector3& normal, const Winding& w, float s_repeat, float t_repeat ){
-       if ( w.numpoints < 3 ) {
-               return;
-       }
-
-       Matrix4 st2tex;
-       Texdef_toTransform( projection, (float)width, (float)height, st2tex );
-
-       // the current texture transform
-       Matrix4 local2tex = st2tex;
-       {
-               Matrix4 xyz2st;
-               Texdef_basisForNormal( projection, normal, xyz2st );
-               matrix4_multiply_by_matrix4( local2tex, xyz2st );
-       }
-
-       // the bounds of the current texture transform
-       AABB bounds;
-       for ( Winding::const_iterator i = w.begin(); i != w.end(); ++i )
-       {
-               Vector3 texcoord = matrix4_transformed_point( local2tex, ( *i ).vertex );
-               aabb_extend_by_point_safe( bounds, texcoord );
-       }
-       bounds.origin.z() = 0;
-       bounds.extents.z() = 1;
-
-       // the bounds of a perfectly fitted texture transform
-       AABB perfect( Vector3( t_repeat * 0.5 * bounds.extents.x() / bounds.extents.y(), t_repeat * 0.5, 0 ), Vector3( t_repeat * 0.5 * bounds.extents.x() / bounds.extents.y(), t_repeat * 0.5, 1 ) );
-
        // the difference between the current texture transform and the perfectly fitted transform
        Matrix4 matrix( matrix4_translation_for_vec3( bounds.origin - perfect.origin ) );
        matrix4_pivoted_scale_by_vec3( matrix, bounds.extents / perfect.extents, perfect.origin );
index 5e68c1463e8c4c62c08759fdee7c74659158285e..79d27f3e98c188e0be76d9da19bca09bd115d859 100644 (file)
@@ -106,8 +106,6 @@ void Texdef_Shift( TextureProjection& projection, float s, float t );
 void Texdef_Scale( TextureProjection& projection, float s, float t );
 void Texdef_Rotate( TextureProjection& projection, float angle );
 void Texdef_FitTexture( TextureProjection& projection, std::size_t width, std::size_t height, const Vector3& normal, const Winding& w, float s_repeat, float t_repeat );
-void Texdef_FitTextureW( TextureProjection& projection, std::size_t width, std::size_t height, const Vector3& normal, const Winding& w, float s_repeat, float t_repeat );
-void Texdef_FitTextureH( TextureProjection& projection, std::size_t width, std::size_t height, const Vector3& normal, const Winding& w, float s_repeat, float t_repeat );
 void Texdef_EmitTextureCoordinates( const TextureProjection& projection, std::size_t width, std::size_t height, Winding& w, const Vector3& normal, const Matrix4& localToWorld );
 
 void ShiftScaleRotate_fromFace( texdef_t& shiftScaleRotate, const TextureProjection& projection );
index 7f3742194a192c182d8c22781f8f556c41b1b99a..114fc4414e5fdb11c3c006f9bc0c88b7ea808e56 100644 (file)
@@ -555,28 +555,6 @@ void Scene_BrushFindReplaceShader_Component_Selected( scene::Graph& graph, const
 }
 
 
-class FaceFitTextureW
-{
-float m_s_repeat, m_t_repeat;
-public:
-FaceFitTextureW( float s_repeat, float t_repeat ) : m_s_repeat( s_repeat ), m_t_repeat( t_repeat ){
-}
-void operator()( Face& face ) const {
-       face.FitTextureW( m_s_repeat, m_t_repeat );
-}
-};
-
-class FaceFitTextureH
-{
-float m_s_repeat, m_t_repeat;
-public:
-FaceFitTextureH( float s_repeat, float t_repeat ) : m_s_repeat( s_repeat ), m_t_repeat( t_repeat ){
-}
-void operator()( Face& face ) const {
-       face.FitTextureH( m_s_repeat, m_t_repeat );
-}
-};
-
 void Scene_BrushFitTexture_Selected( scene::Graph& graph, float s_repeat, float t_repeat ){
        Scene_ForEachSelectedBrush_ForEachFace(graph, [&](Face &face) {
                face.FitTexture(s_repeat, t_repeat);
@@ -591,26 +569,6 @@ void Scene_BrushFitTexture_Component_Selected( scene::Graph& graph, float s_repe
        SceneChangeNotify();
 }
 
-void Scene_BrushFitTexture_SelectedW( scene::Graph& graph, float s_repeat, float t_repeat ){
-       Scene_ForEachSelectedBrush_ForEachFace( graph, FaceFitTextureW( s_repeat, t_repeat ) );
-       SceneChangeNotify();
-}
-
-void Scene_BrushFitTexture_Component_SelectedW( scene::Graph& graph, float s_repeat, float t_repeat ){
-       Scene_ForEachSelectedBrushFace( graph, FaceFitTextureW( s_repeat, t_repeat ) );
-       SceneChangeNotify();
-}
-
-void Scene_BrushFitTexture_SelectedH( scene::Graph& graph, float s_repeat, float t_repeat ){
-       Scene_ForEachSelectedBrush_ForEachFace( graph, FaceFitTextureH( s_repeat, t_repeat ) );
-       SceneChangeNotify();
-}
-
-void Scene_BrushFitTexture_Component_SelectedH( scene::Graph& graph, float s_repeat, float t_repeat ){
-       Scene_ForEachSelectedBrushFace( graph, FaceFitTextureH( s_repeat, t_repeat ) );
-       SceneChangeNotify();
-}
-
 TextureProjection g_defaultTextureProjection;
 
 const TextureProjection& TextureTransform_getDefault(){
index ac34e45528215e1280e1ebd45e9bb28cb327048a..5a1f62b00cd060894501d61753ecafb602427d5e 100644 (file)
@@ -71,10 +71,6 @@ void Scene_BrushSelectByShader( scene::Graph& graph, const char* name );
 void Scene_BrushSelectByShader_Component( scene::Graph& graph, const char* name );
 void Scene_BrushFitTexture_Selected( scene::Graph& graph, float s_repeat, float t_repeat );
 void Scene_BrushFitTexture_Component_Selected( scene::Graph& graph, float s_repeat, float t_repeat );
-void Scene_BrushFitTexture_SelectedW( scene::Graph& graph, float s_repeat, float t_repeat );
-void Scene_BrushFitTexture_Component_SelectedW( scene::Graph& graph, float s_repeat, float t_repeat );
-void Scene_BrushFitTexture_SelectedH( scene::Graph& graph, float s_repeat, float t_repeat );
-void Scene_BrushFitTexture_Component_SelectedH( scene::Graph& graph, float s_repeat, float t_repeat );
 
 void Brush_constructMenu( ui::Menu menu );
 
index 4e5ca1863a75fa86136835ac37b444be2c26b941..179ae632342194b3148c7c78b90930845afb7e67 100644 (file)
@@ -677,6 +677,7 @@ class ProjectList
 public:
 Project& m_project;
 ui::ListStore m_store{ui::null};
+GtkWidget* m_buildView;
 bool m_changed;
 ProjectList( Project& project ) : m_project( project ), m_changed( false ){
 }
@@ -711,6 +712,8 @@ gboolean project_cell_edited(ui::CellRendererText cell, gchar* path_string, gcha
 
                gtk_list_store_set( projectList->m_store, &iter, 0, new_text, -1 );
                projectList->m_store.append();
+               //make command field activatable
+               g_signal_emit_by_name( G_OBJECT( gtk_tree_view_get_selection( GTK_TREE_VIEW( projectList->m_buildView ) ) ), "changed" );
        }
 
        gtk_tree_path_free( path );
@@ -895,6 +898,7 @@ ui::Window BuildMenuDialog_construct( ModalDialog& modal, ProjectList& projectLi
 
                                        view.show();
 
+                                       projectList.m_buildView = buildView;
                                        projectList.m_store = store;
                                        scr.add(view);
 
index ee6634e6ea4dad5f6f5efa1e055eda0583fd8c48..6ccf3ec642383733e6424451e4774f3eb388ab2f 100644 (file)
@@ -285,7 +285,7 @@ void Camera_FreeMove( camera_t& camera, int dx, int dy ){
 
                camera.origin -= camera.vright * strafespeed * dx;
                if ( camera.m_strafe_forward ) {
-                       camera.origin += camera.vpn * strafespeed * dy;
+                       camera.origin -= camera.vpn * strafespeed * dy;
                }
                else{
                        camera.origin += camera.vup * strafespeed * dy;
@@ -1324,7 +1324,7 @@ void CamWnd::EnableFreeMove(){
 
        gtk_window_set_focus( m_parent, m_gl_widget );
        m_freemove_handle_focusout = m_gl_widget.connect( "focus_out_event", G_CALLBACK( camwindow_freemove_focusout ), this );
-       /* Note: We chose to replace m_parent by m_gl_widget but NetRadiantCustom does:
+       /* We chose to replace m_parent by m_gl_widget but NetRadiantCustom does:
        m_freezePointer.freeze_pointer( m_parent, m_gl_widget, Camera_motionDelta, &m_Camera ); */
        m_freezePointer.freeze_pointer( m_gl_widget, Camera_motionDelta, &m_Camera );
 
index d2acdc80f3be71214fb9e73fcdf1c3ae4fe8be4d..0ae57f60ab268882fc9c6113af02f67466a51990 100644 (file)
@@ -703,8 +703,10 @@ typedef MemberCaller<ListAttribute, void(), &ListAttribute::update> UpdateCaller
 
 namespace
 {
+GtkWidget* g_entity_split0 = 0;
 ui::Widget g_entity_split1{ui::null};
 ui::Widget g_entity_split2{ui::null};
+int g_entitysplit0_position;
 int g_entitysplit1_position;
 int g_entitysplit2_position;
 
@@ -1304,18 +1306,18 @@ static gint EntityEntry_keypress( ui::Entry widget, GdkEventKey* event, gpointer
 }
 
 void EntityInspector_destroyWindow( ui::Widget widget, gpointer data ){
+       g_entitysplit0_position = gtk_paned_get_position( GTK_PANED( g_entity_split0 ) );
        g_entitysplit1_position = gtk_paned_get_position( GTK_PANED( g_entity_split1 ) );
        g_entitysplit2_position = gtk_paned_get_position( GTK_PANED( g_entity_split2 ) );
-
        g_entityInspector_windowConstructed = false;
        GlobalEntityAttributes_clear();
 }
 
-static gint EntityInspector_destroyWindowKB( GtkWidget* widget, GdkEventKey* event, gpointer data ){
+static gint EntityInspector_hideWindowKB( GtkWidget* widget, GdkEventKey* event, gpointer data ){
        //if ( event->keyval == GDK_Escape && GTK_WIDGET_VISIBLE( GTK_WIDGET( widget ) ) ) {
        if ( event->keyval == GDK_Escape  ) {
-               //globalErrorStream() << "Doom3Light_getBounds: failed to parse default light radius\n";
-               GroupDialog_showPage( g_page_entity );
+               //GroupDialog_showPage( g_page_entity );
+               gtk_widget_hide( GTK_WIDGET( GroupDialog_getWindow() ) );
                return TRUE;
        }
        if ( event->keyval == GDK_Tab  ) {
@@ -1330,7 +1332,7 @@ ui::Widget EntityInspector_constructWindow( ui::Window toplevel ){
        vbox.show();
        gtk_container_set_border_width( GTK_CONTAINER( vbox ), 2 );
 
-       g_signal_connect( G_OBJECT( toplevel ), "key_press_event", G_CALLBACK( EntityInspector_destroyWindowKB ), 0 );
+       g_signal_connect( G_OBJECT( toplevel ), "key_press_event", G_CALLBACK( EntityInspector_hideWindowKB ), 0 );
        vbox.connect( "destroy", G_CALLBACK( EntityInspector_destroyWindow ), 0 );
 
        {
@@ -1342,7 +1344,8 @@ ui::Widget EntityInspector_constructWindow( ui::Window toplevel ){
 
                {
                        ui::Widget split2 = ui::VPaned(ui::New);
-                       gtk_paned_add1( GTK_PANED( split1 ), split2 );
+                       //gtk_paned_add1( GTK_PANED( split1 ), split2 );
+                       gtk_paned_pack1( GTK_PANED( split1 ), split2, FALSE, FALSE );
                        split2.show();
 
                        g_entity_split2 = split2;
@@ -1351,7 +1354,8 @@ ui::Widget EntityInspector_constructWindow( ui::Window toplevel ){
                                // class list
                                auto scr = ui::ScrolledWindow(ui::New);
                                scr.show();
-                               gtk_paned_add1( GTK_PANED( split2 ), scr );
+                               //gtk_paned_add1( GTK_PANED( split2 ), scr );
+                               gtk_paned_pack1( GTK_PANED( split2 ), scr, FALSE, FALSE );
                                gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scr ), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS );
                                gtk_scrolled_window_set_shadow_type( GTK_SCROLLED_WINDOW( scr ), GTK_SHADOW_IN );
 
@@ -1388,7 +1392,8 @@ ui::Widget EntityInspector_constructWindow( ui::Window toplevel ){
                        {
                                auto scr = ui::ScrolledWindow(ui::New);
                                scr.show();
-                               gtk_paned_add2( GTK_PANED( split2 ), scr );
+                               //gtk_paned_add2( GTK_PANED( split2 ), scr );
+                               gtk_paned_pack2( GTK_PANED( split2 ), scr, FALSE, FALSE );
                                gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scr ), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS );
                                gtk_scrolled_window_set_shadow_type( GTK_SCROLLED_WINDOW( scr ), GTK_SHADOW_IN );
 
@@ -1405,14 +1410,16 @@ ui::Widget EntityInspector_constructWindow( ui::Window toplevel ){
                }
 
                {
-                       ui::Widget split2 = ui::VPaned(ui::New);
-                       gtk_paned_add2( GTK_PANED( split1 ), split2 );
-                       split2.show();
+                       ui::Widget split0 = ui::VPaned(ui::New);
+                       //gtk_paned_add2( GTK_PANED( split1 ), split0 );
+                       gtk_paned_pack2( GTK_PANED( split1 ), split0, FALSE, FALSE );
+                       split0.show();
+                       g_entity_split0 = split0;
 
                        {
                 auto vbox2 = ui::VBox( FALSE, 2 );
                                vbox2.show();
-                               gtk_paned_pack1( GTK_PANED( split2 ), vbox2, FALSE, FALSE );
+                               gtk_paned_pack1( GTK_PANED( split0 ), vbox2, FALSE, FALSE );
 
                                {
                                        // Spawnflags (4 colums wide max, or window gets too wide.)
@@ -1549,27 +1556,23 @@ ui::Widget EntityInspector_constructWindow( ui::Window toplevel ){
 
                                viewport.add(g_attributeBox);
                                scr.add(viewport);
-                               gtk_paned_pack2( GTK_PANED( split2 ), scr, FALSE, FALSE );
+                               gtk_paned_pack2( GTK_PANED( split0 ), scr, FALSE, FALSE );
                        }
                }
        }
 
 
        {
-               // show the sliders in any case
-               if ( g_entitysplit2_position > 22 ) {
-                       gtk_paned_set_position( GTK_PANED( g_entity_split2 ), g_entitysplit2_position );
-               }
-               else {
+               // show the sliders in any case //no need, gtk can care
+               /*if ( g_entitysplit2_position < 22 ) {
                        g_entitysplit2_position = 22;
-                       gtk_paned_set_position( GTK_PANED( g_entity_split2 ), 22 );
-               }
-               if ( ( g_entitysplit1_position - g_entitysplit2_position ) > 27 ) {
-                       gtk_paned_set_position( GTK_PANED( g_entity_split1 ), g_entitysplit1_position );
-               }
-               else {
-                       gtk_paned_set_position( GTK_PANED( g_entity_split1 ), g_entitysplit2_position + 27 );
-               }
+               }*/
+               gtk_paned_set_position( GTK_PANED( g_entity_split2 ), g_entitysplit2_position );
+               /*if ( ( g_entitysplit1_position - g_entitysplit2_position ) < 27 ) {
+                       g_entitysplit1_position = g_entitysplit2_position + 27;
+               }*/
+               gtk_paned_set_position( GTK_PANED( g_entity_split1 ), g_entitysplit1_position );
+               gtk_paned_set_position( GTK_PANED( g_entity_split0 ), g_entitysplit0_position );
        }
 
        g_entityInspector_windowConstructed = true;
@@ -1617,6 +1620,7 @@ EntityInspector g_EntityInspector;
 void EntityInspector_construct(){
        GlobalEntityClassManager().attach( g_EntityInspector );
 
+       GlobalPreferenceSystem().registerPreference( "EntitySplit0", make_property_string( g_entitysplit0_position ) );
        GlobalPreferenceSystem().registerPreference( "EntitySplit1", make_property_string( g_entitysplit1_position ) );
        GlobalPreferenceSystem().registerPreference( "EntitySplit2", make_property_string( g_entitysplit2_position ) );
 
index d74fc6578ac7dcabc442a1ee328a58019e839659..d9811d3e48c6f58d2b1780fa31f50f23e47cc3d6 100644 (file)
@@ -46,6 +46,7 @@
 class FindTextureDialog : public Dialog
 {
 public:
+WindowPositionTracker m_position_tracker;
 static void setReplaceStr( const char* name );
 static void setFindStr( const char* name );
 static bool isOpen();
@@ -122,6 +123,7 @@ static gint replace_focus_in( ui::Widget widget, GdkEventFocus *event, gpointer
 
 FindTextureDialog::FindTextureDialog(){
        m_bSelectedOnly = FALSE;
+       //m_position_tracker.setPosition( c_default_window_pos );
 }
 
 FindTextureDialog::~FindTextureDialog(){
@@ -134,6 +136,8 @@ ui::Window FindTextureDialog::BuildDialog(){
 
        auto dlg = ui::Window(create_floating_window( "Find / Replace Texture(s)", m_parent ));
 
+       m_position_tracker.connect( dlg );
+
        auto hbox = ui::HBox( FALSE, 5 );
        hbox.show();
        dlg.add(hbox);
@@ -230,7 +234,10 @@ void FindTextureDialog::setReplaceStr( const char* name ){
 }
 
 void FindTextureDialog::show(){
+       // workaround for strange gtk behaviour - modifying the contents of a window while it is not visible causes the window position to change without sending a configure_event
+       g_FindTextureDialog.m_position_tracker.sync( g_FindTextureDialog.GetWidget() );
        g_FindTextureDialog.ShowDlg();
+       gtk_window_present( g_FindTextureDialog.GetWidget() );
 }
 
 
@@ -250,8 +257,11 @@ void FindTextureDialog_selectTexture( const char* name ){
        g_FindTextureDialog.updateTextures( name );
 }
 
+#include "preferencesystem.h"
+
 void FindTextureDialog_Construct(){
        GlobalCommands_insert( "FindReplaceTextures", FindTextureDialog::ShowCaller() );
+       GlobalPreferenceSystem().registerPreference( "FindReplacehWnd",  make_property_string<WindowPositionTracker_String>( g_FindTextureDialog.m_position_tracker ) );
 }
 
 void FindTextureDialog_Destroy(){
index 2630f10e8d8f2db7f2441c641aa6382802831f81..d052ff125a7eb75b2121027f73e55440baba65b1 100644 (file)
@@ -507,6 +507,7 @@ void DoAbout(){
                                {
                     auto button = create_dialog_button( "Credits", G_CALLBACK( about_button_credits ), 0 );
                                        vbox2.pack_start( button, FALSE, FALSE, 0 );
+                                       gtk_widget_set_sensitive( GTK_WIDGET( button ), FALSE);
                                }
                                {
                     auto button = create_dialog_button( "Changes", G_CALLBACK( about_button_changelog ), 0 );
@@ -515,6 +516,7 @@ void DoAbout(){
                                {
                     auto button = create_dialog_button( "Issues", G_CALLBACK( about_button_issues ), 0 );
                                        vbox2.pack_start( button, FALSE, FALSE, 0 );
+                                       gtk_widget_set_sensitive( GTK_WIDGET( button ), FALSE);
                                }
                        }
                }
index 689d797d934c3111423b1fd46367c6195d99df32..dd5c3ec700b4119152c53503e0e68100de63b387 100644 (file)
@@ -2568,7 +2568,7 @@ void Clipper_constructToolbar( ui::Toolbar toolbar ){
 }
 
 void XYWnd_constructToolbar( ui::Toolbar toolbar ){
-       toolbar_append_button( toolbar, "Change views", "view_change.png", "NextView" );
+       toolbar_append_button( toolbar, "Change views (CTRL + TAB)", "view_change.png", "NextView" );
 }
 
 void Manipulators_constructToolbar( ui::Toolbar toolbar ){
@@ -2615,7 +2615,7 @@ ui::Toolbar create_main_toolbar( MainFrame::EViewStyle style ){
 
        ComponentModes_constructToolbar( toolbar );
 
-       if ( style == MainFrame::eRegular || style == MainFrame::eRegularLeft || style == MainFrame::eFloating ) {
+       if ( style == MainFrame::eRegular || style == MainFrame::eRegularLeft ) {
                space();
 
                XYWnd_constructToolbar( toolbar );
@@ -2642,21 +2642,16 @@ ui::Toolbar create_main_toolbar( MainFrame::EViewStyle style ){
        space();
 
        /*auto g_view_entities_button =*/ toolbar_append_button( toolbar, "Entities (N)", "entities.png", "ToggleEntityInspector" );
-       auto g_view_console_button = toolbar_append_button( toolbar, "Console (O)", "console.png", "ToggleConsole" );
-       auto g_view_textures_button = toolbar_append_button( toolbar, "Texture Browser (T)", "texture_browser.png", "ToggleTextures" );
+       if ( style == MainFrame::eRegular || style == MainFrame::eRegularLeft ) {
+               auto g_view_console_button = toolbar_append_button( toolbar, "Console (O)", "console.png", "ToggleConsole" );
+               auto g_view_textures_button = toolbar_append_button( toolbar, "Texture Browser (T)", "texture_browser.png", "ToggleTextures" );
+       }
        // TODO: call light inspector
        //GtkButton* g_view_lightinspector_button = toolbar_append_button(toolbar, "Light Inspector", "lightinspector.png", "ToggleLightInspector");
 
        space();
        /*auto g_refresh_models_button =*/ toolbar_append_button( toolbar, "Refresh Models", "refresh_models.png", "RefreshReferences" );
 
-
-       // disable the console and texture button in the regular layouts
-       if ( style == MainFrame::eRegular || style == MainFrame::eRegularLeft ) {
-               gtk_widget_set_sensitive( g_view_console_button , FALSE );
-               gtk_widget_set_sensitive( g_view_textures_button , FALSE );
-       }
-
        return toolbar;
 }
 
@@ -3055,6 +3050,10 @@ void MainFrame::Create(){
        vbox.pack_end(main_statusbar, FALSE, TRUE, 2);
 
        GroupDialog_constructWindow( window );
+
+       /* want to realize it immediately; otherwise gtk paned splits positions wont be set correctly for floating group dlg */
+       gtk_widget_realize ( GTK_WIDGET( GroupDialog_getWindow() ) );
+
        g_page_entity = GroupDialog_addPage( "Entities", EntityInspector_constructWindow( GroupDialog_getWindow() ), RawStringExportCaller( "Entities" ) );
 
        if ( FloatingGroupDialog() ) {
index b8c727ba3d8e87bf6f6b833013fca1b10f099a2b..e1e6a727bca7fad9cc8d51ffbc6fa9523edc3320 100644 (file)
@@ -1949,6 +1949,9 @@ void SaveMap(){
        }
        else if ( Map_Modified( g_map ) ) {
                Map_Save();
+#ifdef WIN32
+               MRU_AddFile( g_map.m_name.c_str() );    //add on saving, but not opening via cmd line: spoils the list
+#endif
        }
 }
 
index 6a29298d592f8de1a599863a37669c572c66af22..ab228654a90147ac254ab987286aa977129d0440 100644 (file)
@@ -283,6 +283,8 @@ void PatchInspector_queueDraw(){
 void DoPatchInspector(){
        g_PatchInspector.GetPatchInfo();
        if ( !g_PatchInspector.visible() ) {
+               // workaround for strange gtk behaviour - modifying the contents of a window while it is not visible causes the window position to change without sending a configure_event
+               g_PatchInspector.m_position_tracker.sync( g_PatchInspector.GetWidget() );
                g_PatchInspector.ShowDlg();
        }
 }
@@ -800,7 +802,7 @@ ui::Window PatchInspector::BuildDialog(){
                                                        auto spin = ui::SpinButton( adj, 1, 0 );
                                                        spin.show();
                             table.attach(spin, {1, 2, 0, 1}, {0, 0});
-                                                       spin.dimensions(10, -1);
+                                                       spin.dimensions(16, -2);
                                                        gtk_widget_set_can_focus( spin, false );
                                                }
                                                {
@@ -817,7 +819,7 @@ ui::Window PatchInspector::BuildDialog(){
                                                        auto spin = ui::SpinButton( adj, 1, 0 );
                                                        spin.show();
                             table.attach(spin, {1, 2, 1, 2}, {0, 0});
-                                                       spin.dimensions(10, -1);
+                                                       spin.dimensions(16, -2);
                                                        gtk_widget_set_can_focus( spin, false );
                                                }
                                                {
@@ -834,7 +836,7 @@ ui::Window PatchInspector::BuildDialog(){
                                                        auto spin = ui::SpinButton( adj, 1, 0 );
                                                        spin.show();
                             table.attach(spin, {1, 2, 2, 3}, {0, 0});
-                                                       spin.dimensions(10, -1);
+                                                       spin.dimensions(16, -2);
                                                        gtk_widget_set_can_focus( spin, false );
                                                }
                                                {
@@ -851,7 +853,7 @@ ui::Window PatchInspector::BuildDialog(){
                                                        auto spin = ui::SpinButton( adj, 1, 0 );
                                                        spin.show();
                             table.attach(spin, {1, 2, 3, 4}, {0, 0});
-                                                       spin.dimensions(10, -1);
+                                                       spin.dimensions(16, -2);
                                                        gtk_widget_set_can_focus( spin, false );
                                                }
                                                {
@@ -868,7 +870,7 @@ ui::Window PatchInspector::BuildDialog(){
                                                        auto spin = ui::SpinButton( adj, 1, 0 );
                                                        spin.show();
                             table.attach(spin, {1, 2, 4, 5}, {0, 0});
-                                                       spin.dimensions(10, -1);
+                                                       spin.dimensions(16, -2);
                                                        gtk_widget_set_can_focus( spin, false );
                                                }
                                        }
index eb2cacbd8129ea80a5d76decef17c5a6aabf248a..8447897a4ab7b3a99aaa110a7ffd4153e55c2c44 100644 (file)
@@ -694,24 +694,6 @@ void Select_FitTexture( float horizontal, float vertical ){
        SceneChangeNotify();
 }
 
-void Select_FitTextureW( float horizontal, float vertical ){
-       if ( GlobalSelectionSystem().Mode() != SelectionSystem::eComponent ) {
-               Scene_BrushFitTexture_SelectedW( GlobalSceneGraph(), horizontal, vertical );
-       }
-       Scene_BrushFitTexture_Component_SelectedW( GlobalSceneGraph(), horizontal, vertical );
-
-       SceneChangeNotify();
-}
-
-void Select_FitTextureH( float horizontal, float vertical ){
-       if ( GlobalSelectionSystem().Mode() != SelectionSystem::eComponent ) {
-               Scene_BrushFitTexture_SelectedH( GlobalSceneGraph(), horizontal, vertical );
-       }
-       Scene_BrushFitTexture_Component_SelectedH( GlobalSceneGraph(), horizontal, vertical );
-
-       SceneChangeNotify();
-}
-
 inline void hide_node( scene::Node& node, bool hide ){
        hide
        ? node.enable( scene::Node::eHidden )
index cc5660e748f863bd165042be9b9b3f12a0745398..4a158fd41d86994e629d507ccd15ba2f8a693741 100644 (file)
@@ -62,8 +62,6 @@ void Select_RotateTexture( float amt );
 void Select_ScaleTexture( float x, float y );
 void Select_ShiftTexture( float x, float y );
 void Select_FitTexture( float horizontal = 1, float vertical = 1 );
-void Select_FitTextureW( float horizontal = 1, float vertical = 1 );
-void Select_FitTextureH( float horizontal = 1, float vertical = 1 );
 void FindReplaceTextures( const char* pFind, const char* pReplace, bool bSelected );
 
 void HideSelected();
index 67fa6b782234130520895c5961eecad54869e3a0..8cab31e469b84bae4a2cc470d55d074f194d7008 100644 (file)
@@ -412,7 +412,7 @@ void DoSurface( void ){
 
        }
        getSurfaceInspector().Update();
-       getSurfaceInspector().importData();
+       //getSurfaceInspector().importData(); //happens in .ShowDlg() anyway
        getSurfaceInspector().ShowDlg();
 }
 
@@ -433,12 +433,12 @@ void SurfaceInspector_FitTexture(){
 
 void SurfaceInspector_FitTextureW(){
        UndoableCommand undo( "textureAutoFitW" );
-       Select_FitTextureW( getSurfaceInspector().m_fitHorizontal, getSurfaceInspector().m_fitVertical );
+       Select_FitTexture( getSurfaceInspector().m_fitHorizontal, 0 );
 }
 
 void SurfaceInspector_FitTextureH(){
        UndoableCommand undo( "textureAutoFitH" );
-       Select_FitTextureH( getSurfaceInspector().m_fitHorizontal, getSurfaceInspector().m_fitVertical );
+       Select_FitTexture( 0, getSurfaceInspector().m_fitVertical );
 }
 
 static void OnBtnPatchdetails( ui::Widget widget, gpointer data ){
index 27baf5edb10f821989663c7634ccc2fc8ee23226..451f94a64237869f06ff0a4a27a2af3aa44ad65d 100644 (file)
@@ -1176,7 +1176,7 @@ void TextureBrowser_trackingDelta( int x, int y, unsigned int state, void* data
 
 void TextureBrowser_Tracking_MouseUp( TextureBrowser& textureBrowser ){
        textureBrowser.m_move_started = false;
-       /* Note: NetRadiantCustom did this instead:
+       /* NetRadiantCustom did this instead:
        textureBrowser.m_freezePointer.unfreeze_pointer( textureBrowser.m_gl_widget ); */
 
        textureBrowser.m_freezePointer.unfreeze_pointer( textureBrowser.m_gl_widget );
@@ -1187,7 +1187,7 @@ void TextureBrowser_Tracking_MouseDown( TextureBrowser& textureBrowser ){
                TextureBrowser_Tracking_MouseUp( textureBrowser );
        }
        textureBrowser.m_move_started = true;
-       /* Note: NetRadiantCustom did this instead:
+       /* NetRadiantCustom did this instead:
        textureBrowser.m_freezePointer.freeze_pointer( textureBrowser.m_parent, textureBrowser.m_gl_widget, TextureBrowser_trackingDelta, &textureBrowser ); */
        textureBrowser.m_freezePointer.freeze_pointer( textureBrowser.m_gl_widget, TextureBrowser_trackingDelta, &textureBrowser );
 }
@@ -2207,7 +2207,7 @@ void TextureBrowser_checkTagFile(){
                }
                else
                {
-                       globalErrorStream() << "Unable to find default tag file " << default_filename.c_str() << ". No tag support.\n";
+                       globalOutputStream() << "Unable to find default tag file " << default_filename.c_str() << ". No tag support. Plugins -> ShaderPlug -> Create tag file: to start using tags\n";
                }
        }
 }
index bb65e57337b331c5161a7f894e9c00111481899b..9754831701be404ed3dbbaa139cc326a644c6958 100644 (file)
@@ -469,7 +469,7 @@ static xmlSAXHandler saxParser = {
 // ------------------------------------------------------------------------------------------------
 
 
-guint s_routine_id;
+guint s_routine_id = 0;
 static gint watchbsp_routine( gpointer data ){
        reinterpret_cast<CWatchBSP*>( data )->RoutineProcessing();
        return TRUE;
@@ -489,8 +489,9 @@ void CWatchBSP::Reset(){
                m_xmlInputBuffer = NULL;
        }
        m_eState = EIdle;
-       if ( s_routine_id ) {
+       if ( s_routine_id != 0 ) {
                g_source_remove( s_routine_id );
+               s_routine_id = 0;
        }
 }
 
index 4c07a7fefb03eade4f3210a18df0ab08b57d3062..0d8625fa03ca5834f13d8f40248a826ee76688df 100644 (file)
@@ -1215,7 +1215,7 @@ void XYWnd::Move_Begin(){
                Move_End();
        }
        m_move_started = true;
-       /* Note: NetRadiantCustom did this instead:
+       /* NetRadiantCustom did this instead:
        g_xywnd_freezePointer.freeze_pointer( m_parent  ? m_parent : MainFrame_getWindow(), m_gl_widget, XYWnd_moveDelta, this ); */
        g_xywnd_freezePointer.freeze_pointer( m_gl_widget, XYWnd_moveDelta, this );
        m_move_focusOut = m_gl_widget.connect( "focus_out_event", G_CALLBACK( XYWnd_Move_focusOut ), this );
@@ -1262,7 +1262,7 @@ void XYWnd::Zoom_Begin(){
        }
        m_zoom_started = true;
        g_dragZoom = 0;
-       /* Note: NetRadiantCustom did this instead:
+       /* NetRadiantCustom did this instead:
        g_xywnd_freezePointer.freeze_pointer( m_parent ? m_parent : MainFrame_getWindow(), m_gl_widget, XYWnd_zoomDelta, this ); */
        g_xywnd_freezePointer.freeze_pointer( m_parent ? m_parent : MainFrame_getWindow(), XYWnd_zoomDelta, this );
        m_zoom_focusOut = m_gl_widget.connect( "focus_out_event", G_CALLBACK( XYWnd_Zoom_focusOut ), this );