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
This commit is contained in:
Garux 2017-08-01 14:25:41 +03:00
parent 9d6e27e4e3
commit 6592d65469
19 changed files with 103 additions and 216 deletions

View File

@ -187,17 +187,25 @@ name_t make_unique( const name_t& name ) const {
char buf[80]; char buf[80];
name_t r( "","" ); name_t r( "","" );
name_write( buf, name ); name_write( buf, name );
#ifdef _DEBUG
globalErrorStream() << "find unique name for " << buf << "\n"; globalErrorStream() << "find unique name for " << buf << "\n";
globalErrorStream() << "> currently registered names:\n"; globalErrorStream() << "> currently registered names:\n";
#endif
for ( names_t::const_iterator i = m_names.begin(); i != m_names.end(); ++i ) for ( names_t::const_iterator i = m_names.begin(); i != m_names.end(); ++i )
{ {
#ifdef _DEBUG
globalErrorStream() << ">> " << i->first.c_str() << ": "; 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 ) for ( PostFixes::postfixes_t::const_iterator j = i->second.m_postfixes.begin(); j != i->second.m_postfixes.end(); ++j )
{ {
j->first.write( buf ); j->first.write( buf );
#ifdef _DEBUG
globalErrorStream() << " '" << buf << "'"; globalErrorStream() << " '" << buf << "'";
#endif
} }
#ifdef _DEBUG
globalErrorStream() << "\n"; globalErrorStream() << "\n";
#endif
} }
names_t::const_iterator i = m_names.find( name.first ); names_t::const_iterator i = m_names.find( name.first );
if ( i == m_names.end() ) { 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 ) ); r = name_t( name.first, ( *i ).second.make_unique( name.second ) );
} }
name_write( buf, r ); name_write( buf, r );
#ifdef _DEBUG
globalErrorStream() << "> unique name is " << buf << "\n"; globalErrorStream() << "> unique name is " << buf << "\n";
#endif
return r; return r;
} }

View File

@ -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 ); 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 ){ void emitTextureCoordinates( Winding& winding, const Vector3& normal, const Matrix4& localToWorld ){
Texdef_EmitTextureCoordinates( m_projection, m_shader.width(), m_shader.height(), winding, normal, 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(); 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(){ void EmitTextureCoordinates(){
Texdef_EmitTextureCoordinates( m_texdefTransformed, m_shader.width(), m_shader.height(), m_winding, plane3().normal(), g_matrix4_identity ); Texdef_EmitTextureCoordinates( m_texdefTransformed, m_shader.width(), m_shader.height(), m_winding, plane3().normal(), g_matrix4_identity );
} }

View File

@ -1108,90 +1108,28 @@ void Texdef_FitTexture( TextureProjection& projection, std::size_t width, std::s
bounds.extents.z() = 1; bounds.extents.z() = 1;
// the bounds of a perfectly fitted texture transform // 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 ) ); AABB perfect;
if( t_repeat == 0 && s_repeat == 0 ){
// the difference between the current texture transform and the perfectly fitted transform //bad user's input
Matrix4 matrix( matrix4_translation_for_vec3( bounds.origin - perfect.origin ) ); t_repeat = s_repeat = 1;
matrix4_pivoted_scale_by_vec3( matrix, bounds.extents / perfect.extents, perfect.origin ); perfect.origin = Vector3( s_repeat * 0.5, t_repeat * 0.5, 0 );
matrix4_affine_invert( matrix ); perfect.extents = Vector3( s_repeat * 0.5, t_repeat * 0.5, 1 );
// 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;
} }
if( t_repeat == 0 ){
Matrix4 st2tex; //fit width
Texdef_toTransform( projection, (float)width, (float)height, st2tex ); 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 );
// the current texture transform
Matrix4 local2tex = st2tex;
{
Matrix4 xyz2st;
Texdef_basisForNormal( projection, normal, xyz2st );
matrix4_multiply_by_matrix4( local2tex, xyz2st );
} }
else if( s_repeat == 0 ){
// the bounds of the current texture transform //fit height
AABB bounds; perfect.origin = Vector3( t_repeat * 0.5 * bounds.extents.x() / bounds.extents.y(), t_repeat * 0.5, 0 );
for ( Winding::const_iterator i = w.begin(); i != w.end(); ++i ) perfect.extents = Vector3( t_repeat * 0.5 * bounds.extents.x() / bounds.extents.y(), t_repeat * 0.5, 1 );
{
Vector3 texcoord = matrix4_transformed_point( local2tex, ( *i ).vertex );
aabb_extend_by_point_safe( bounds, texcoord );
} }
bounds.origin.z() = 0; else{
bounds.extents.z() = 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 );
// 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 // the difference between the current texture transform and the perfectly fitted transform
Matrix4 matrix( matrix4_translation_for_vec3( bounds.origin - perfect.origin ) ); Matrix4 matrix( matrix4_translation_for_vec3( bounds.origin - perfect.origin ) );
matrix4_pivoted_scale_by_vec3( matrix, bounds.extents / perfect.extents, perfect.origin ); matrix4_pivoted_scale_by_vec3( matrix, bounds.extents / perfect.extents, perfect.origin );

View 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_Scale( TextureProjection& projection, float s, float t );
void Texdef_Rotate( TextureProjection& projection, float angle ); 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_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 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 ); void ShiftScaleRotate_fromFace( texdef_t& shiftScaleRotate, const TextureProjection& projection );

View File

@ -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 ){ void Scene_BrushFitTexture_Selected( scene::Graph& graph, float s_repeat, float t_repeat ){
Scene_ForEachSelectedBrush_ForEachFace( graph, FaceFitTexture( s_repeat, t_repeat ) ); Scene_ForEachSelectedBrush_ForEachFace( graph, FaceFitTexture( s_repeat, t_repeat ) );
SceneChangeNotify(); SceneChangeNotify();
@ -663,26 +641,6 @@ void Scene_BrushFitTexture_Component_Selected( scene::Graph& graph, float s_repe
SceneChangeNotify(); 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; TextureProjection g_defaultTextureProjection;
const TextureProjection& TextureTransform_getDefault(){ const TextureProjection& TextureTransform_getDefault(){
TexDef_Construct_Default( g_defaultTextureProjection ); TexDef_Construct_Default( g_defaultTextureProjection );

View File

@ -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_BrushSelectByShader_Component( scene::Graph& graph, const char* name );
void Scene_BrushFitTexture_Selected( scene::Graph& graph, float s_repeat, float t_repeat ); 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_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; typedef struct _GtkMenu GtkMenu;
void Brush_constructMenu( GtkMenu* menu ); void Brush_constructMenu( GtkMenu* menu );

View File

@ -671,6 +671,7 @@ class ProjectList
public: public:
Project& m_project; Project& m_project;
GtkListStore* m_store; GtkListStore* m_store;
GtkWidget* m_buildView;
bool m_changed; bool m_changed;
ProjectList( Project& project ) : m_project( project ), m_changed( false ){ 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 ); gtk_list_store_set( projectList->m_store, &iter, 0, new_text, -1 );
GtkTreeIter lastIter; GtkTreeIter lastIter;
gtk_list_store_append( projectList->m_store, &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 ); gtk_tree_path_free( path );
@ -894,6 +897,7 @@ GtkWindow* BuildMenuDialog_construct( ModalDialog& modal, ProjectList& projectLi
gtk_widget_show( view ); gtk_widget_show( view );
buildView = view; buildView = view;
projectList.m_buildView = buildView;
projectList.m_store = store; projectList.m_store = store;
gtk_container_add( GTK_CONTAINER( scr ), view ); gtk_container_add( GTK_CONTAINER( scr ), view );

View File

@ -280,7 +280,7 @@ void Camera_FreeMove( camera_t& camera, int dx, int dy ){
camera.origin -= camera.vright * strafespeed * dx; camera.origin -= camera.vright * strafespeed * dx;
if ( camera.m_strafe_forward ) { if ( camera.m_strafe_forward ) {
camera.origin += camera.vpn * strafespeed * dy; camera.origin -= camera.vpn * strafespeed * dy;
} }
else{ else{
camera.origin += camera.vup * strafespeed * dy; camera.origin += camera.vup * strafespeed * dy;

View File

@ -715,8 +715,10 @@ typedef MemberCaller<ListAttribute, &ListAttribute::update> UpdateCaller;
namespace namespace
{ {
GtkWidget* g_entity_split0 = 0;
GtkWidget* g_entity_split1 = 0; GtkWidget* g_entity_split1 = 0;
GtkWidget* g_entity_split2 = 0; GtkWidget* g_entity_split2 = 0;
int g_entitysplit0_position;
int g_entitysplit1_position; int g_entitysplit1_position;
int g_entitysplit2_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 ){ 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_entitysplit1_position = gtk_paned_get_position( GTK_PANED( g_entity_split1 ) );
g_entitysplit2_position = gtk_paned_get_position( GTK_PANED( g_entity_split2 ) ); g_entitysplit2_position = gtk_paned_get_position( GTK_PANED( g_entity_split2 ) );
g_entityInspector_windowConstructed = false; g_entityInspector_windowConstructed = false;
GlobalEntityAttributes_clear(); 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 && GTK_WIDGET_VISIBLE( GTK_WIDGET( widget ) ) ) {
if ( event->keyval == GDK_Escape ) { 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; return TRUE;
} }
if ( event->keyval == GDK_Tab ) { if ( event->keyval == GDK_Tab ) {
@ -1348,7 +1350,7 @@ GtkWidget* EntityInspector_constructWindow( GtkWindow* toplevel ){
gtk_widget_show( vbox ); gtk_widget_show( vbox );
gtk_container_set_border_width( GTK_CONTAINER( vbox ), 2 ); 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 ); 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(); 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 ); gtk_widget_show( split2 );
g_entity_split2 = split2; g_entity_split2 = split2;
@ -1369,7 +1372,8 @@ GtkWidget* EntityInspector_constructWindow( GtkWindow* toplevel ){
// class list // class list
GtkWidget* scr = gtk_scrolled_window_new( 0, 0 ); GtkWidget* scr = gtk_scrolled_window_new( 0, 0 );
gtk_widget_show( scr ); 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_policy( GTK_SCROLLED_WINDOW( scr ), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS );
gtk_scrolled_window_set_shadow_type( GTK_SCROLLED_WINDOW( scr ), GTK_SHADOW_IN ); 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 ); GtkWidget* scr = gtk_scrolled_window_new( 0, 0 );
gtk_widget_show( scr ); 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_policy( GTK_SCROLLED_WINDOW( scr ), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS );
gtk_scrolled_window_set_shadow_type( GTK_SCROLLED_WINDOW( scr ), GTK_SHADOW_IN ); 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(); GtkWidget* split0 = gtk_vpaned_new();
gtk_paned_add2( GTK_PANED( split1 ), split2 ); //gtk_paned_add2( GTK_PANED( split1 ), split0 );
gtk_widget_show( split2 ); gtk_paned_pack2( GTK_PANED( split1 ), split0, FALSE, FALSE );
gtk_widget_show( split0 );
g_entity_split0 = split0;
{ {
GtkWidget* vbox2 = gtk_vbox_new( FALSE, 2 ); GtkWidget* vbox2 = gtk_vbox_new( FALSE, 2 );
gtk_widget_show( vbox2 ); 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.) // 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( viewport ), GTK_WIDGET( g_attributeBox ) );
gtk_container_add( GTK_CONTAINER( scr ), viewport ); 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 // show the sliders in any case //no need, gtk can care
if ( g_entitysplit2_position > 22 ) { /*if ( g_entitysplit2_position < 22 ) {
gtk_paned_set_position( GTK_PANED( g_entity_split2 ), g_entitysplit2_position );
}
else {
g_entitysplit2_position = 22; g_entitysplit2_position = 22;
gtk_paned_set_position( GTK_PANED( g_entity_split2 ), 22 ); }*/
} gtk_paned_set_position( GTK_PANED( g_entity_split2 ), g_entitysplit2_position );
if ( ( g_entitysplit1_position - g_entitysplit2_position ) > 27 ) { /*if ( ( g_entitysplit1_position - g_entitysplit2_position ) < 27 ) {
gtk_paned_set_position( GTK_PANED( g_entity_split1 ), g_entitysplit1_position ); g_entitysplit1_position = g_entitysplit2_position + 27;
} }*/
else { gtk_paned_set_position( GTK_PANED( g_entity_split1 ), g_entitysplit1_position );
gtk_paned_set_position( GTK_PANED( g_entity_split1 ), g_entitysplit2_position + 27 ); gtk_paned_set_position( GTK_PANED( g_entity_split0 ), g_entitysplit0_position );
}
} }
g_entityInspector_windowConstructed = true; g_entityInspector_windowConstructed = true;
@ -1643,6 +1646,7 @@ EntityInspector g_EntityInspector;
void EntityInspector_construct(){ void EntityInspector_construct(){
GlobalEntityClassManager().attach( g_EntityInspector ); 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( "EntitySplit1", IntImportStringCaller( g_entitysplit1_position ), IntExportStringCaller( g_entitysplit1_position ) );
GlobalPreferenceSystem().registerPreference( "EntitySplit2", IntImportStringCaller( g_entitysplit2_position ), IntExportStringCaller( g_entitysplit2_position ) ); GlobalPreferenceSystem().registerPreference( "EntitySplit2", IntImportStringCaller( g_entitysplit2_position ), IntExportStringCaller( g_entitysplit2_position ) );

View File

@ -56,6 +56,7 @@
class FindTextureDialog : public Dialog class FindTextureDialog : public Dialog
{ {
public: public:
WindowPositionTracker m_position_tracker;
static void setReplaceStr( const char* name ); static void setReplaceStr( const char* name );
static void setFindStr( const char* name ); static void setFindStr( const char* name );
static bool isOpen(); static bool isOpen();
@ -132,6 +133,7 @@ static gint replace_focus_in( GtkWidget* widget, GdkEventFocus *event, gpointer
FindTextureDialog::FindTextureDialog(){ FindTextureDialog::FindTextureDialog(){
m_bSelectedOnly = FALSE; m_bSelectedOnly = FALSE;
//m_position_tracker.setPosition( c_default_window_pos );
} }
FindTextureDialog::~FindTextureDialog(){ FindTextureDialog::~FindTextureDialog(){
@ -143,6 +145,8 @@ GtkWindow* FindTextureDialog::BuildDialog(){
GtkWindow* dlg = create_floating_window( "Find / Replace Texture(s)", m_parent ); GtkWindow* dlg = create_floating_window( "Find / Replace Texture(s)", m_parent );
m_position_tracker.connect( dlg );
hbox = gtk_hbox_new( FALSE, 5 ); hbox = gtk_hbox_new( FALSE, 5 );
gtk_widget_show( hbox ); gtk_widget_show( hbox );
gtk_container_add( GTK_CONTAINER( dlg ), GTK_WIDGET( hbox ) ); gtk_container_add( GTK_CONTAINER( dlg ), GTK_WIDGET( hbox ) );
@ -247,7 +251,10 @@ void FindTextureDialog::setReplaceStr( const char* name ){
} }
void FindTextureDialog::show(){ 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(); g_FindTextureDialog.ShowDlg();
gtk_window_present( g_FindTextureDialog.GetWidget() );
} }
@ -267,8 +274,11 @@ void FindTextureDialog_selectTexture( const char* name ){
g_FindTextureDialog.updateTextures( name ); g_FindTextureDialog.updateTextures( name );
} }
#include "preferencesystem.h"
void FindTextureDialog_Construct(){ void FindTextureDialog_Construct(){
GlobalCommands_insert( "FindReplaceTextures", FindTextureDialog::ShowCaller() ); GlobalCommands_insert( "FindReplaceTextures", FindTextureDialog::ShowCaller() );
GlobalPreferenceSystem().registerPreference( "FindReplacehWnd", WindowPositionTrackerImportStringCaller( g_FindTextureDialog.m_position_tracker ), WindowPositionTrackerExportStringCaller( g_FindTextureDialog.m_position_tracker ) );
} }
void FindTextureDialog_Destroy(){ void FindTextureDialog_Destroy(){

View File

@ -500,10 +500,12 @@ void DoAbout(){
{ {
GtkButton* button = create_dialog_button( "Credits", G_CALLBACK( about_button_credits ), 0 ); 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_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 ); 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_box_pack_start( GTK_BOX( vbox2 ), GTK_WIDGET( button ), FALSE, FALSE, 0 );
gtk_widget_set_sensitive( GTK_WIDGET( button ), FALSE);
} }
} }
} }

View File

@ -2338,7 +2338,7 @@ void Clipper_constructToolbar( GtkToolbar* toolbar ){
} }
void XYWnd_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 ){ void Manipulators_constructToolbar( GtkToolbar* toolbar ){
@ -2379,7 +2379,7 @@ GtkToolbar* create_main_toolbar( MainFrame::EViewStyle style ){
ComponentModes_constructToolbar( toolbar ); 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 ) ); gtk_toolbar_append_space( GTK_TOOLBAR( toolbar ) );
XYWnd_constructToolbar( toolbar ); XYWnd_constructToolbar( toolbar );
@ -2406,21 +2406,18 @@ GtkToolbar* create_main_toolbar( MainFrame::EViewStyle style ){
gtk_toolbar_append_space( GTK_TOOLBAR( toolbar ) ); gtk_toolbar_append_space( GTK_TOOLBAR( toolbar ) );
GtkButton* g_view_entities_button = toolbar_append_button( toolbar, "Entities (N)", "entities.png", "ToggleEntityInspector" ); 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" ); // disable the console and texture button in the regular layouts
GtkButton* g_view_textures_button = toolbar_append_button( toolbar, "Texture Browser (T)", "texture_browser.png", "ToggleTextures" ); 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 // TODO: call light inspector
//GtkButton* g_view_lightinspector_button = toolbar_append_button(toolbar, "Light Inspector", "lightinspector.png", "ToggleLightInspector"); //GtkButton* g_view_lightinspector_button = toolbar_append_button(toolbar, "Light Inspector", "lightinspector.png", "ToggleLightInspector");
gtk_toolbar_append_space( GTK_TOOLBAR( toolbar ) ); gtk_toolbar_append_space( GTK_TOOLBAR( toolbar ) );
GtkButton* g_refresh_models_button = toolbar_append_button( toolbar, "Refresh Models", "refresh_models.png", "RefreshReferences" ); 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; return toolbar;
} }
@ -2820,6 +2817,10 @@ void MainFrame::Create(){
gtk_box_pack_end( GTK_BOX( vbox ), main_statusbar, FALSE, TRUE, 2 ); gtk_box_pack_end( GTK_BOX( vbox ), main_statusbar, FALSE, TRUE, 2 );
GroupDialog_constructWindow( window ); 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" ) ); g_page_entity = GroupDialog_addPage( "Entities", EntityInspector_constructWindow( GroupDialog_getWindow() ), RawStringExportCaller( "Entities" ) );
if ( FloatingGroupDialog() ) { if ( FloatingGroupDialog() ) {

View File

@ -1842,6 +1842,9 @@ void SaveMap(){
} }
else if ( Map_Modified( g_map ) ) { else if ( Map_Modified( g_map ) ) {
Map_Save(); 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
} }
} }

View File

@ -301,6 +301,8 @@ void PatchInspector_queueDraw(){
void DoPatchInspector(){ void DoPatchInspector(){
g_PatchInspector.GetPatchInfo(); g_PatchInspector.GetPatchInfo();
if ( !g_PatchInspector.visible() ) { 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(); g_PatchInspector.ShowDlg();
} }
} }
@ -907,7 +909,7 @@ GtkWindow* PatchInspector::BuildDialog(){
gtk_table_attach( table, GTK_WIDGET( spin ), 1, 2, 0, 1, gtk_table_attach( table, GTK_WIDGET( spin ), 1, 2, 0, 1,
(GtkAttachOptions)( 0 ), (GtkAttachOptions)( 0 ),
(GtkAttachOptions)( 0 ), 0, 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 ); 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, gtk_table_attach( table, GTK_WIDGET( spin ), 1, 2, 1, 2,
(GtkAttachOptions)( 0 ), (GtkAttachOptions)( 0 ),
(GtkAttachOptions)( 0 ), 0, 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 ); 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, gtk_table_attach( table, GTK_WIDGET( spin ), 1, 2, 2, 3,
(GtkAttachOptions)( 0 ), (GtkAttachOptions)( 0 ),
(GtkAttachOptions)( 0 ), 0, 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 ); 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, gtk_table_attach( table, GTK_WIDGET( spin ), 1, 2, 3, 4,
(GtkAttachOptions)( 0 ), (GtkAttachOptions)( 0 ),
(GtkAttachOptions)( 0 ), 0, 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 ); 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, gtk_table_attach( table, GTK_WIDGET( spin ), 1, 2, 4, 5,
(GtkAttachOptions)( 0 ), (GtkAttachOptions)( 0 ),
(GtkAttachOptions)( 0 ), 0, 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 ); GTK_WIDGET_UNSET_FLAGS( spin, GTK_CAN_FOCUS );
} }
} }

View File

@ -692,24 +692,6 @@ void Select_FitTexture( float horizontal, float vertical ){
SceneChangeNotify(); 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 ){ inline void hide_node( scene::Node& node, bool hide ){
hide hide
? node.enable( scene::Node::eHidden ) ? node.enable( scene::Node::eHidden )

View File

@ -62,8 +62,6 @@ void Select_RotateTexture( float amt );
void Select_ScaleTexture( float x, float y ); void Select_ScaleTexture( float x, float y );
void Select_ShiftTexture( float x, float y ); void Select_ShiftTexture( float x, float y );
void Select_FitTexture( float horizontal = 1, float vertical = 1 ); 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 FindReplaceTextures( const char* pFind, const char* pReplace, bool bSelected );
void HideSelected(); void HideSelected();

View File

@ -422,7 +422,7 @@ void DoSurface( void ){
} }
getSurfaceInspector().Update(); getSurfaceInspector().Update();
getSurfaceInspector().importData(); //getSurfaceInspector().importData(); //happens in .ShowDlg() anyway
getSurfaceInspector().ShowDlg(); getSurfaceInspector().ShowDlg();
} }
@ -443,12 +443,12 @@ void SurfaceInspector_FitTexture(){
void SurfaceInspector_FitTextureW(){ void SurfaceInspector_FitTextureW(){
UndoableCommand undo( "textureAutoFitW" ); UndoableCommand undo( "textureAutoFitW" );
Select_FitTextureW( getSurfaceInspector().m_fitHorizontal, getSurfaceInspector().m_fitVertical ); Select_FitTexture( getSurfaceInspector().m_fitHorizontal, 0 );
} }
void SurfaceInspector_FitTextureH(){ void SurfaceInspector_FitTextureH(){
UndoableCommand undo( "textureAutoFitH" ); UndoableCommand undo( "textureAutoFitH" );
Select_FitTextureH( getSurfaceInspector().m_fitHorizontal, getSurfaceInspector().m_fitVertical ); Select_FitTexture( 0, getSurfaceInspector().m_fitVertical );
} }
static void OnBtnPatchdetails( GtkWidget *widget, gpointer data ){ static void OnBtnPatchdetails( GtkWidget *widget, gpointer data ){

View File

@ -2019,7 +2019,7 @@ void TextureBrowser_checkTagFile(){
} }
else 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";
} }
} }
} }

View File

@ -467,7 +467,7 @@ static xmlSAXHandler saxParser = {
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
guint s_routine_id; guint s_routine_id = 0;
static gint watchbsp_routine( gpointer data ){ static gint watchbsp_routine( gpointer data ){
reinterpret_cast<CWatchBSP*>( data )->RoutineProcessing(); reinterpret_cast<CWatchBSP*>( data )->RoutineProcessing();
return TRUE; return TRUE;
@ -487,8 +487,9 @@ void CWatchBSP::Reset(){
m_xmlInputBuffer = NULL; m_xmlInputBuffer = NULL;
} }
m_eState = EIdle; m_eState = EIdle;
if ( s_routine_id ) { if ( s_routine_id != 0 ) {
gtk_timeout_remove( s_routine_id ); gtk_timeout_remove( s_routine_id );
s_routine_id = 0;
} }
} }