From: Garux Date: Tue, 1 Aug 2017 11:25:41 +0000 (+0300) Subject: Radiant: X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=6592d65469e5386216a692ba3b5d6e7cc590c617;p=xonotic%2Fnetradiant.git Radiant: misc... * made shaderplug msg to look not like error (but barely noticeable) * removed Texdef_FitTexture copypasted code * ctrl+shift+mouse strafe mode: moving mouse forward moves camera forward, back - back * add map to recent ones on SaveMap (instead of doing that in 'open by cmd line': spoils the list) * fix: spin buttons alignment in patch inspector * fix: patch inspector window pos save/restore during run time * removed console, texbro buttons in regular layout * ent inspector: saving window splits pos in non regular layouts * ent inspector: saving lower split pos aswell * ent inspector: fix of: minimizing part behind middle to 0 * saving find/replace wnd pos; bringing ontop, if is (present + called) * moved 'find unique name for' output to _DEBUG * fix of 'GLib-CRITICAL **: Source ID was not found when attempting to remove it' in buid monitor timer * fix: build menu customizing: command field is reachable right after creating new entry --- diff --git a/libs/uniquenames.h b/libs/uniquenames.h index 8ff67f15..9f89ba45 100644 --- a/libs/uniquenames.h +++ b/libs/uniquenames.h @@ -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; } diff --git a/radiant/brush.h b/radiant/brush.h index 5504f954..0fb6ffe2 100644 --- a/radiant/brush.h +++ b/radiant/brush.h @@ -598,14 +598,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 ); } @@ -1207,18 +1199,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 ); } diff --git a/radiant/brush_primit.cpp b/radiant/brush_primit.cpp index 85ee1e46..3e7e4775 100644 --- a/radiant/brush_primit.cpp +++ b/radiant/brush_primit.cpp @@ -1108,90 +1108,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 ); diff --git a/radiant/brush_primit.h b/radiant/brush_primit.h index 5e68c146..79d27f3e 100644 --- a/radiant/brush_primit.h +++ b/radiant/brush_primit.h @@ -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 ); diff --git a/radiant/brushmanip.cpp b/radiant/brushmanip.cpp index 0502e988..090ab4cf 100644 --- a/radiant/brushmanip.cpp +++ b/radiant/brushmanip.cpp @@ -631,28 +631,6 @@ void operator()( Face& face ) 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, FaceFitTexture( s_repeat, t_repeat ) ); SceneChangeNotify(); @@ -663,26 +641,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(){ TexDef_Construct_Default( g_defaultTextureProjection ); diff --git a/radiant/brushmanip.h b/radiant/brushmanip.h index f26e68ab..06f67271 100644 --- a/radiant/brushmanip.h +++ b/radiant/brushmanip.h @@ -70,10 +70,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 ); typedef struct _GtkMenu GtkMenu; void Brush_constructMenu( GtkMenu* menu ); diff --git a/radiant/build.cpp b/radiant/build.cpp index 073e0ddf..793ab5a5 100644 --- a/radiant/build.cpp +++ b/radiant/build.cpp @@ -671,6 +671,7 @@ class ProjectList public: Project& m_project; GtkListStore* m_store; +GtkWidget* m_buildView; bool m_changed; ProjectList( Project& project ) : m_project( project ), m_changed( false ){ } @@ -706,6 +707,8 @@ gboolean project_cell_edited( GtkCellRendererText* cell, gchar* path_string, gch gtk_list_store_set( projectList->m_store, &iter, 0, new_text, -1 ); GtkTreeIter lastIter; gtk_list_store_append( projectList->m_store, &lastIter ); + //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 ); @@ -894,6 +897,7 @@ GtkWindow* BuildMenuDialog_construct( ModalDialog& modal, ProjectList& projectLi gtk_widget_show( view ); buildView = view; + projectList.m_buildView = buildView; projectList.m_store = store; gtk_container_add( GTK_CONTAINER( scr ), view ); diff --git a/radiant/camwindow.cpp b/radiant/camwindow.cpp index 9a9e6bf2..46281295 100644 --- a/radiant/camwindow.cpp +++ b/radiant/camwindow.cpp @@ -280,7 +280,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; diff --git a/radiant/entityinspector.cpp b/radiant/entityinspector.cpp index 407aaa1a..e187d803 100644 --- a/radiant/entityinspector.cpp +++ b/radiant/entityinspector.cpp @@ -715,8 +715,10 @@ typedef MemberCaller UpdateCaller; namespace { +GtkWidget* g_entity_split0 = 0; GtkWidget* g_entity_split1 = 0; GtkWidget* g_entity_split2 = 0; +int g_entitysplit0_position; int g_entitysplit1_position; int g_entitysplit2_position; @@ -1322,18 +1324,18 @@ static gint EntityEntry_keypress( GtkEntry* widget, GdkEventKey* event, gpointer } void EntityInspector_destroyWindow( GtkWidget* 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 ) { @@ -1348,7 +1350,7 @@ GtkWidget* EntityInspector_constructWindow( GtkWindow* toplevel ){ gtk_widget_show( vbox ); 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 ); g_signal_connect( G_OBJECT( vbox ), "destroy", G_CALLBACK( EntityInspector_destroyWindow ), 0 ); { @@ -1360,7 +1362,8 @@ GtkWidget* EntityInspector_constructWindow( GtkWindow* toplevel ){ { GtkWidget* split2 = gtk_vpaned_new(); - gtk_paned_add1( GTK_PANED( split1 ), split2 ); + //gtk_paned_add1( GTK_PANED( split1 ), split2 ); + gtk_paned_pack1( GTK_PANED( split1 ), split2, FALSE, FALSE ); gtk_widget_show( split2 ); g_entity_split2 = split2; @@ -1369,7 +1372,8 @@ GtkWidget* EntityInspector_constructWindow( GtkWindow* toplevel ){ // class list GtkWidget* scr = gtk_scrolled_window_new( 0, 0 ); gtk_widget_show( scr ); - 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 ); @@ -1406,7 +1410,8 @@ GtkWidget* EntityInspector_constructWindow( GtkWindow* toplevel ){ { GtkWidget* scr = gtk_scrolled_window_new( 0, 0 ); gtk_widget_show( scr ); - 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 ); @@ -1423,14 +1428,16 @@ GtkWidget* EntityInspector_constructWindow( GtkWindow* toplevel ){ } { - GtkWidget* split2 = gtk_vpaned_new(); - gtk_paned_add2( GTK_PANED( split1 ), split2 ); - gtk_widget_show( split2 ); + GtkWidget* split0 = gtk_vpaned_new(); + //gtk_paned_add2( GTK_PANED( split1 ), split0 ); + gtk_paned_pack2( GTK_PANED( split1 ), split0, FALSE, FALSE ); + gtk_widget_show( split0 ); + g_entity_split0 = split0; { GtkWidget* vbox2 = gtk_vbox_new( FALSE, 2 ); gtk_widget_show( vbox2 ); - 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.) @@ -1575,27 +1582,23 @@ GtkWidget* EntityInspector_constructWindow( GtkWindow* toplevel ){ gtk_container_add( GTK_CONTAINER( viewport ), GTK_WIDGET( g_attributeBox ) ); gtk_container_add( GTK_CONTAINER( scr ), 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; @@ -1643,6 +1646,7 @@ EntityInspector g_EntityInspector; void EntityInspector_construct(){ GlobalEntityClassManager().attach( g_EntityInspector ); + GlobalPreferenceSystem().registerPreference( "EntitySplit0", IntImportStringCaller( g_entitysplit0_position ), IntExportStringCaller( g_entitysplit0_position ) ); GlobalPreferenceSystem().registerPreference( "EntitySplit1", IntImportStringCaller( g_entitysplit1_position ), IntExportStringCaller( g_entitysplit1_position ) ); GlobalPreferenceSystem().registerPreference( "EntitySplit2", IntImportStringCaller( g_entitysplit2_position ), IntExportStringCaller( g_entitysplit2_position ) ); diff --git a/radiant/findtexturedialog.cpp b/radiant/findtexturedialog.cpp index 5fd58f7c..37379c57 100644 --- a/radiant/findtexturedialog.cpp +++ b/radiant/findtexturedialog.cpp @@ -56,6 +56,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(); @@ -132,6 +133,7 @@ static gint replace_focus_in( GtkWidget* widget, GdkEventFocus *event, gpointer FindTextureDialog::FindTextureDialog(){ m_bSelectedOnly = FALSE; + //m_position_tracker.setPosition( c_default_window_pos ); } FindTextureDialog::~FindTextureDialog(){ @@ -143,6 +145,8 @@ GtkWindow* FindTextureDialog::BuildDialog(){ GtkWindow* dlg = create_floating_window( "Find / Replace Texture(s)", m_parent ); + m_position_tracker.connect( dlg ); + hbox = gtk_hbox_new( FALSE, 5 ); gtk_widget_show( hbox ); gtk_container_add( GTK_CONTAINER( dlg ), GTK_WIDGET( hbox ) ); @@ -247,7 +251,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() ); } @@ -267,8 +274,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", WindowPositionTrackerImportStringCaller( g_FindTextureDialog.m_position_tracker ), WindowPositionTrackerExportStringCaller( g_FindTextureDialog.m_position_tracker ) ); } void FindTextureDialog_Destroy(){ diff --git a/radiant/gtkdlgs.cpp b/radiant/gtkdlgs.cpp index 8cc7aeb6..8f841e5f 100644 --- a/radiant/gtkdlgs.cpp +++ b/radiant/gtkdlgs.cpp @@ -500,10 +500,12 @@ void DoAbout(){ { GtkButton* button = create_dialog_button( "Credits", G_CALLBACK( about_button_credits ), 0 ); gtk_box_pack_start( GTK_BOX( vbox2 ), GTK_WIDGET( button ), FALSE, FALSE, 0 ); + gtk_widget_set_sensitive( GTK_WIDGET( button ), FALSE); } { GtkButton* button = create_dialog_button( "Changelog", G_CALLBACK( about_button_changelog ), 0 ); gtk_box_pack_start( GTK_BOX( vbox2 ), GTK_WIDGET( button ), FALSE, FALSE, 0 ); + gtk_widget_set_sensitive( GTK_WIDGET( button ), FALSE); } } } diff --git a/radiant/mainframe.cpp b/radiant/mainframe.cpp index 2758e8ee..c801ccd9 100644 --- a/radiant/mainframe.cpp +++ b/radiant/mainframe.cpp @@ -2338,7 +2338,7 @@ void Clipper_constructToolbar( GtkToolbar* toolbar ){ } void XYWnd_constructToolbar( GtkToolbar* 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( GtkToolbar* toolbar ){ @@ -2379,7 +2379,7 @@ GtkToolbar* 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 ) { gtk_toolbar_append_space( GTK_TOOLBAR( toolbar ) ); XYWnd_constructToolbar( toolbar ); @@ -2406,21 +2406,18 @@ GtkToolbar* create_main_toolbar( MainFrame::EViewStyle style ){ gtk_toolbar_append_space( GTK_TOOLBAR( toolbar ) ); GtkButton* g_view_entities_button = toolbar_append_button( toolbar, "Entities (N)", "entities.png", "ToggleEntityInspector" ); - GtkButton* g_view_console_button = toolbar_append_button( toolbar, "Console (O)", "console.png", "ToggleConsole" ); - GtkButton* g_view_textures_button = toolbar_append_button( toolbar, "Texture Browser (T)", "texture_browser.png", "ToggleTextures" ); + // disable the console and texture button in the regular layouts + if ( style != MainFrame::eRegular && style != MainFrame::eRegularLeft ) { + GtkButton* g_view_console_button = toolbar_append_button( toolbar, "Console (O)", "console.png", "ToggleConsole" ); + GtkButton* 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"); gtk_toolbar_append_space( GTK_TOOLBAR( toolbar ) ); GtkButton* 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( GTK_WIDGET( g_view_console_button ), FALSE ); - gtk_widget_set_sensitive( GTK_WIDGET( g_view_textures_button ), FALSE ); - } - return toolbar; } @@ -2820,6 +2817,10 @@ void MainFrame::Create(){ gtk_box_pack_end( GTK_BOX( vbox ), 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() ) { diff --git a/radiant/map.cpp b/radiant/map.cpp index e664667b..a66229b7 100644 --- a/radiant/map.cpp +++ b/radiant/map.cpp @@ -1842,6 +1842,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 } } diff --git a/radiant/patchdialog.cpp b/radiant/patchdialog.cpp index 62822dc2..7ce797e7 100644 --- a/radiant/patchdialog.cpp +++ b/radiant/patchdialog.cpp @@ -301,6 +301,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(); } } @@ -907,7 +909,7 @@ GtkWindow* PatchInspector::BuildDialog(){ gtk_table_attach( table, GTK_WIDGET( spin ), 1, 2, 0, 1, (GtkAttachOptions)( 0 ), (GtkAttachOptions)( 0 ), 0, 0 ); - gtk_widget_set_usize( GTK_WIDGET( spin ), 10, -2 ); + gtk_widget_set_usize( GTK_WIDGET( spin ), 16, -2 ); GTK_WIDGET_UNSET_FLAGS( spin, GTK_CAN_FOCUS ); } { @@ -928,7 +930,7 @@ GtkWindow* PatchInspector::BuildDialog(){ gtk_table_attach( table, GTK_WIDGET( spin ), 1, 2, 1, 2, (GtkAttachOptions)( 0 ), (GtkAttachOptions)( 0 ), 0, 0 ); - gtk_widget_set_usize( GTK_WIDGET( spin ), 10, -2 ); + gtk_widget_set_usize( GTK_WIDGET( spin ), 16, -2 ); GTK_WIDGET_UNSET_FLAGS( spin, GTK_CAN_FOCUS ); } { @@ -949,7 +951,7 @@ GtkWindow* PatchInspector::BuildDialog(){ gtk_table_attach( table, GTK_WIDGET( spin ), 1, 2, 2, 3, (GtkAttachOptions)( 0 ), (GtkAttachOptions)( 0 ), 0, 0 ); - gtk_widget_set_usize( GTK_WIDGET( spin ), 10, -2 ); + gtk_widget_set_usize( GTK_WIDGET( spin ), 16, -2 ); GTK_WIDGET_UNSET_FLAGS( spin, GTK_CAN_FOCUS ); } { @@ -970,7 +972,7 @@ GtkWindow* PatchInspector::BuildDialog(){ gtk_table_attach( table, GTK_WIDGET( spin ), 1, 2, 3, 4, (GtkAttachOptions)( 0 ), (GtkAttachOptions)( 0 ), 0, 0 ); - gtk_widget_set_usize( GTK_WIDGET( spin ), 10, -2 ); + gtk_widget_set_usize( GTK_WIDGET( spin ), 16, -2 ); GTK_WIDGET_UNSET_FLAGS( spin, GTK_CAN_FOCUS ); } { @@ -991,7 +993,7 @@ GtkWindow* PatchInspector::BuildDialog(){ gtk_table_attach( table, GTK_WIDGET( spin ), 1, 2, 4, 5, (GtkAttachOptions)( 0 ), (GtkAttachOptions)( 0 ), 0, 0 ); - gtk_widget_set_usize( GTK_WIDGET( spin ), 10, -2 ); + gtk_widget_set_usize( GTK_WIDGET( spin ), 16, -2 ); GTK_WIDGET_UNSET_FLAGS( spin, GTK_CAN_FOCUS ); } } diff --git a/radiant/select.cpp b/radiant/select.cpp index 4c9b30f9..175af349 100644 --- a/radiant/select.cpp +++ b/radiant/select.cpp @@ -692,24 +692,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 ) diff --git a/radiant/select.h b/radiant/select.h index cc5660e7..4a158fd4 100644 --- a/radiant/select.h +++ b/radiant/select.h @@ -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(); diff --git a/radiant/surfacedialog.cpp b/radiant/surfacedialog.cpp index 55946cfe..d0ff4c1c 100644 --- a/radiant/surfacedialog.cpp +++ b/radiant/surfacedialog.cpp @@ -422,7 +422,7 @@ void DoSurface( void ){ } getSurfaceInspector().Update(); - getSurfaceInspector().importData(); + //getSurfaceInspector().importData(); //happens in .ShowDlg() anyway getSurfaceInspector().ShowDlg(); } @@ -443,12 +443,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( GtkWidget *widget, gpointer data ){ diff --git a/radiant/texwindow.cpp b/radiant/texwindow.cpp index 36d6eb84..afdba811 100644 --- a/radiant/texwindow.cpp +++ b/radiant/texwindow.cpp @@ -2019,7 +2019,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"; } } } diff --git a/radiant/watchbsp.cpp b/radiant/watchbsp.cpp index a598ff51..79348257 100644 --- a/radiant/watchbsp.cpp +++ b/radiant/watchbsp.cpp @@ -467,7 +467,7 @@ static xmlSAXHandler saxParser = { // ------------------------------------------------------------------------------------------------ -guint s_routine_id; +guint s_routine_id = 0; static gint watchbsp_routine( gpointer data ){ reinterpret_cast( data )->RoutineProcessing(); return TRUE; @@ -487,8 +487,9 @@ void CWatchBSP::Reset(){ m_xmlInputBuffer = NULL; } m_eState = EIdle; - if ( s_routine_id ) { + if ( s_routine_id != 0 ) { gtk_timeout_remove( s_routine_id ); + s_routine_id = 0; } }