Merge pull request #322 from Pan7/gtk3

More Gtk3
This commit is contained in:
Timothee "TTimo" Besset 2015-10-31 09:39:51 -05:00
commit 2486a8185a
16 changed files with 509 additions and 343 deletions

View File

@ -49,7 +49,6 @@
* - '_obj_load' code crashes in a weird way after * - '_obj_load' code crashes in a weird way after
* '_obj_mtl_load' for a few .mtl files * '_obj_mtl_load' for a few .mtl files
* - process 'mtllib' rather than using <model>.mtl * - process 'mtllib' rather than using <model>.mtl
* - handle 'usemtl' statements
*/ */
/* uncomment when debugging this module */ /* uncomment when debugging this module */
/* #define DEBUG_PM_OBJ */ /* #define DEBUG_PM_OBJ */
@ -859,6 +858,22 @@ static picoModel_t *_obj_load( PM_PARAMS_LOAD ){
/* increase vertex count */ /* increase vertex count */
curVertex += max; curVertex += max;
} }
}
else if ( !_pico_stricmp( p->token, "usemtl" ) ) {
char *materialName;
materialName = _pico_parse( p, 0 );
if( materialName || strlen( materialName ) ) {
picoShader_t *shader;
shader = PicoFindShader( model, materialName, 0 );
if( !shader ) {
shader = PicoNewShader( model );
PicoSetShaderName( shader, materialName );
}
if( shader && curSurface ) {
PicoSetSurfaceShader( curSurface, shader );
}
}
} }
/* skip unparsed rest of line and continue */ /* skip unparsed rest of line and continue */
_pico_parse_skip_rest( p ); _pico_parse_skip_rest( p );

View File

@ -629,15 +629,15 @@ GtkWidget* create_SurfaceInspector( void ){
GtkWidget *viewport; GtkWidget *viewport;
GtkWidget *table1; GtkWidget *table1, *table3;
GtkWidget *table4; GtkWidget *table4;
GtkWidget *table5; GtkWidget *table5;
GtkWidget *content_area; GtkWidget *content_area;
GtkWidget *hbox1, *hbox2; GtkWidget *hbox1, *hbox2, *hbox3;
GtkSizeGroup *button_group; GtkSizeGroup *size_group;
SurfaceInspector = gtk_window_new( GTK_WINDOW_TOPLEVEL ); SurfaceInspector = gtk_window_new( GTK_WINDOW_TOPLEVEL );
gtk_container_set_border_width( GTK_CONTAINER( SurfaceInspector ), 4 ); gtk_container_set_border_width( GTK_CONTAINER( SurfaceInspector ), 4 );
@ -689,6 +689,7 @@ GtkWidget* create_SurfaceInspector( void ){
gtk_grid_set_column_spacing( GTK_GRID( table1 ), 5 ); gtk_grid_set_column_spacing( GTK_GRID( table1 ), 5 );
gtk_container_add( GTK_CONTAINER( viewport ), table1 ); gtk_container_add( GTK_CONTAINER( viewport ), table1 );
gtk_container_set_border_width( GTK_CONTAINER( table1 ), 5 ); gtk_container_set_border_width( GTK_CONTAINER( table1 ), 5 );
gtk_widget_set_hexpand( GTK_WIDGET( table1 ), TRUE );
gtk_widget_show( table1 ); gtk_widget_show( table1 );
label = gtk_label_new( _( "Value" ) ); label = gtk_label_new( _( "Value" ) );
@ -734,50 +735,50 @@ GtkWidget* create_SurfaceInspector( void ){
// Value Spins // Value Spins
hshift_value_spinbutton_adj = gtk_adjustment_new( 0.0, -8192.0, 8192.0, 2.0, 8.0, 0.0 ); hshift_value_spinbutton_adj = gtk_adjustment_new( 0.0, -8192.0, 8192.0, 2.0, 8.0, 0.0 );
hshift_value_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( hshift_value_spinbutton_adj ), 1, 2 ); hshift_value_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( hshift_value_spinbutton_adj ), 1, 2 );
gtk_widget_set_hexpand( hshift_value_spinbutton, TRUE );
gtk_grid_attach( GTK_GRID( table1 ), hshift_value_spinbutton, 1, 1, 1, 1 ); gtk_grid_attach( GTK_GRID( table1 ), hshift_value_spinbutton, 1, 1, 1, 1 );
gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( hshift_value_spinbutton ), GTK_UPDATE_IF_VALID ); gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( hshift_value_spinbutton ), GTK_UPDATE_IF_VALID );
gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( hshift_value_spinbutton ), TRUE ); gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( hshift_value_spinbutton ), TRUE );
gtk_widget_set_hexpand( hshift_value_spinbutton, TRUE );
gtk_widget_set_sensitive( GTK_WIDGET( hshift_value_spinbutton ), TRUE ); gtk_widget_set_sensitive( GTK_WIDGET( hshift_value_spinbutton ), TRUE );
gtk_widget_show( hshift_value_spinbutton ); gtk_widget_show( hshift_value_spinbutton );
g_object_set( hshift_value_spinbutton, "xalign", 1.0, NULL ); g_object_set( hshift_value_spinbutton, "xalign", 1.0, NULL );
vshift_value_spinbutton_adj = gtk_adjustment_new( 0.0, -8192.0, 8192.0, 2.0, 8.0, 0.0 ); vshift_value_spinbutton_adj = gtk_adjustment_new( 0.0, -8192.0, 8192.0, 2.0, 8.0, 0.0 );
vshift_value_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( vshift_value_spinbutton_adj ), 1, 2 ); vshift_value_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( vshift_value_spinbutton_adj ), 1, 2 );
gtk_widget_set_hexpand( vshift_value_spinbutton, TRUE );
gtk_grid_attach( GTK_GRID( table1 ), vshift_value_spinbutton, 1, 2, 1, 1 ); gtk_grid_attach( GTK_GRID( table1 ), vshift_value_spinbutton, 1, 2, 1, 1 );
gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( vshift_value_spinbutton ), GTK_UPDATE_IF_VALID ); gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( vshift_value_spinbutton ), GTK_UPDATE_IF_VALID );
gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( vshift_value_spinbutton ), TRUE ); gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( vshift_value_spinbutton ), TRUE );
gtk_widget_set_hexpand( vshift_value_spinbutton, TRUE );
gtk_widget_set_sensitive( GTK_WIDGET( vshift_value_spinbutton ), TRUE ); gtk_widget_set_sensitive( GTK_WIDGET( vshift_value_spinbutton ), TRUE );
gtk_widget_show( vshift_value_spinbutton ); gtk_widget_show( vshift_value_spinbutton );
g_object_set( vshift_value_spinbutton, "xalign", 1.0, NULL ); g_object_set( vshift_value_spinbutton, "xalign", 1.0, NULL );
hscale_value_spinbutton_adj = gtk_adjustment_new( 0.0, -1024.0, 1024.0, 1.0, 4.0, 0.0 ); hscale_value_spinbutton_adj = gtk_adjustment_new( 0.0, -1024.0, 1024.0, 1.0, 4.0, 0.0 );
hscale_value_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( hscale_value_spinbutton_adj ), 1, 4 ); hscale_value_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( hscale_value_spinbutton_adj ), 1, 4 );
gtk_widget_set_hexpand( hscale_value_spinbutton, TRUE );
gtk_grid_attach( GTK_GRID( table1 ), hscale_value_spinbutton, 1, 3, 1, 1 ); gtk_grid_attach( GTK_GRID( table1 ), hscale_value_spinbutton, 1, 3, 1, 1 );
gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( hscale_value_spinbutton ), GTK_UPDATE_IF_VALID ); gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( hscale_value_spinbutton ), GTK_UPDATE_IF_VALID );
gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( hscale_value_spinbutton ), TRUE ); gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( hscale_value_spinbutton ), TRUE );
gtk_widget_set_hexpand( hscale_value_spinbutton, TRUE );
gtk_widget_set_sensitive( GTK_WIDGET( hscale_value_spinbutton ), TRUE ); gtk_widget_set_sensitive( GTK_WIDGET( hscale_value_spinbutton ), TRUE );
gtk_widget_show( hscale_value_spinbutton ); gtk_widget_show( hscale_value_spinbutton );
g_object_set( hscale_value_spinbutton, "xalign", 1.0, NULL ); g_object_set( hscale_value_spinbutton, "xalign", 1.0, NULL );
vscale_value_spinbutton_adj = gtk_adjustment_new( 0.0, -1024.0, 1024.0, 1.0, 4.0, 0.0 ); vscale_value_spinbutton_adj = gtk_adjustment_new( 0.0, -1024.0, 1024.0, 1.0, 4.0, 0.0 );
vscale_value_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( vscale_value_spinbutton_adj ), 1, 4 ); vscale_value_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( vscale_value_spinbutton_adj ), 1, 4 );
gtk_widget_set_hexpand( vscale_value_spinbutton, TRUE );
gtk_grid_attach( GTK_GRID( table1 ), vscale_value_spinbutton, 1, 4, 1, 1 ); gtk_grid_attach( GTK_GRID( table1 ), vscale_value_spinbutton, 1, 4, 1, 1 );
gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( vscale_value_spinbutton ), GTK_UPDATE_IF_VALID ); gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( vscale_value_spinbutton ), GTK_UPDATE_IF_VALID );
gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( vscale_value_spinbutton ), TRUE ); gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( vscale_value_spinbutton ), TRUE );
gtk_widget_set_hexpand( vscale_value_spinbutton, TRUE );
gtk_widget_set_sensitive( GTK_WIDGET( vscale_value_spinbutton ), TRUE ); gtk_widget_set_sensitive( GTK_WIDGET( vscale_value_spinbutton ), TRUE );
gtk_widget_show( vscale_value_spinbutton ); gtk_widget_show( vscale_value_spinbutton );
g_object_set( vscale_value_spinbutton, "xalign", 1.0, NULL ); g_object_set( vscale_value_spinbutton, "xalign", 1.0, NULL );
rotate_value_spinbutton_adj = gtk_adjustment_new( 0.0, -360.0, 360.0, 1.0, 10.0, 0.0 ); rotate_value_spinbutton_adj = gtk_adjustment_new( 0.0, -360.0, 360.0, 1.0, 10.0, 0.0 );
rotate_value_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( rotate_value_spinbutton_adj ), 1, 4 ); rotate_value_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( rotate_value_spinbutton_adj ), 1, 4 );
gtk_widget_set_hexpand( rotate_value_spinbutton, TRUE );
gtk_grid_attach( GTK_GRID( table1 ), rotate_value_spinbutton, 1, 5, 1, 1 ); gtk_grid_attach( GTK_GRID( table1 ), rotate_value_spinbutton, 1, 5, 1, 1 );
gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( rotate_value_spinbutton ), GTK_UPDATE_IF_VALID ); gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( rotate_value_spinbutton ), GTK_UPDATE_IF_VALID );
gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( rotate_value_spinbutton ), TRUE ); gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( rotate_value_spinbutton ), TRUE );
gtk_widget_set_hexpand( rotate_value_spinbutton, TRUE );
gtk_widget_set_sensitive( GTK_WIDGET( rotate_value_spinbutton ), TRUE ); gtk_widget_set_sensitive( GTK_WIDGET( rotate_value_spinbutton ), TRUE );
gtk_widget_show( rotate_value_spinbutton ); gtk_widget_show( rotate_value_spinbutton );
g_object_set( rotate_value_spinbutton, "xalign", 1.0, NULL ); g_object_set( rotate_value_spinbutton, "xalign", 1.0, NULL );
@ -785,41 +786,41 @@ GtkWidget* create_SurfaceInspector( void ){
// Step Spins // Step Spins
hshift_step_spinbutton_adj = gtk_adjustment_new( 0.0, -8192.0, 8192.0, 2.0, 8.0, 0.0 ); hshift_step_spinbutton_adj = gtk_adjustment_new( 0.0, -8192.0, 8192.0, 2.0, 8.0, 0.0 );
hshift_step_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( hshift_step_spinbutton_adj ), 1, 2 ); hshift_step_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( hshift_step_spinbutton_adj ), 1, 2 );
gtk_widget_set_hexpand( hshift_step_spinbutton, TRUE );
gtk_grid_attach( GTK_GRID( table1 ), hshift_step_spinbutton, 2, 1, 1, 1 ); gtk_grid_attach( GTK_GRID( table1 ), hshift_step_spinbutton, 2, 1, 1, 1 );
gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( hshift_step_spinbutton ), GTK_UPDATE_IF_VALID ); gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( hshift_step_spinbutton ), GTK_UPDATE_IF_VALID );
gtk_widget_set_hexpand( hshift_step_spinbutton, TRUE );
gtk_widget_show( hshift_step_spinbutton ); gtk_widget_show( hshift_step_spinbutton );
g_object_set( hshift_step_spinbutton, "xalign", 1.0, NULL ); g_object_set( hshift_step_spinbutton, "xalign", 1.0, NULL );
vshift_step_spinbutton_adj = gtk_adjustment_new( 0.0, -8192.0, 8192.0, 2.0, 8.0, 0.0 ); vshift_step_spinbutton_adj = gtk_adjustment_new( 0.0, -8192.0, 8192.0, 2.0, 8.0, 0.0 );
vshift_step_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( vshift_step_spinbutton_adj ), 1, 2 ); vshift_step_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( vshift_step_spinbutton_adj ), 1, 2 );
gtk_widget_set_hexpand( vshift_step_spinbutton, TRUE );
gtk_grid_attach( GTK_GRID( table1 ), vshift_step_spinbutton, 2, 2, 1, 1 ); gtk_grid_attach( GTK_GRID( table1 ), vshift_step_spinbutton, 2, 2, 1, 1 );
gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( vshift_step_spinbutton ), GTK_UPDATE_IF_VALID ); gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( vshift_step_spinbutton ), GTK_UPDATE_IF_VALID );
gtk_widget_set_hexpand( vshift_step_spinbutton, TRUE );
gtk_widget_show( vshift_step_spinbutton ); gtk_widget_show( vshift_step_spinbutton );
g_object_set( vshift_step_spinbutton, "xalign", 1.0, NULL ); g_object_set( vshift_step_spinbutton, "xalign", 1.0, NULL );
hscale_step_spinbutton_adj = gtk_adjustment_new( 0.0, -1024.0, 1024.0, 1.0, 4.0, 0.0 ); hscale_step_spinbutton_adj = gtk_adjustment_new( 0.0, -1024.0, 1024.0, 1.0, 4.0, 0.0 );
hscale_step_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( hscale_step_spinbutton_adj ), 1, 4 ); hscale_step_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( hscale_step_spinbutton_adj ), 1, 4 );
gtk_widget_set_hexpand( hscale_step_spinbutton, TRUE );
gtk_grid_attach( GTK_GRID( table1 ), hscale_step_spinbutton, 2, 3, 1, 1 ); gtk_grid_attach( GTK_GRID( table1 ), hscale_step_spinbutton, 2, 3, 1, 1 );
gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( hscale_step_spinbutton ), GTK_UPDATE_IF_VALID ); gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( hscale_step_spinbutton ), GTK_UPDATE_IF_VALID );
gtk_widget_set_hexpand( hscale_step_spinbutton, TRUE );
gtk_widget_show( hscale_step_spinbutton ); gtk_widget_show( hscale_step_spinbutton );
g_object_set( hscale_step_spinbutton, "xalign", 1.0, NULL ); g_object_set( hscale_step_spinbutton, "xalign", 1.0, NULL );
vscale_step_spinbutton_adj = gtk_adjustment_new( 0.0, -1024.0, 1024.0, 1.0, 4.0, 0.0 ); vscale_step_spinbutton_adj = gtk_adjustment_new( 0.0, -1024.0, 1024.0, 1.0, 4.0, 0.0 );
vscale_step_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( vscale_step_spinbutton_adj ), 1, 4 ); vscale_step_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( vscale_step_spinbutton_adj ), 1, 4 );
gtk_widget_set_hexpand( vscale_step_spinbutton, TRUE );
gtk_grid_attach( GTK_GRID( table1 ), vscale_step_spinbutton, 2, 4, 1, 1 ); gtk_grid_attach( GTK_GRID( table1 ), vscale_step_spinbutton, 2, 4, 1, 1 );
gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( vscale_step_spinbutton ), GTK_UPDATE_IF_VALID ); gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( vscale_step_spinbutton ), GTK_UPDATE_IF_VALID );
gtk_widget_set_hexpand( vscale_step_spinbutton, TRUE );
gtk_widget_show( vscale_step_spinbutton ); gtk_widget_show( vscale_step_spinbutton );
g_object_set( vscale_step_spinbutton, "xalign", 1.0, NULL ); g_object_set( vscale_step_spinbutton, "xalign", 1.0, NULL );
rotate_step_spinbutton_adj = gtk_adjustment_new( 0.0, -360.0, 360.0, 1.0, 10.0, 0.0 ); rotate_step_spinbutton_adj = gtk_adjustment_new( 0.0, -360.0, 360.0, 1.0, 10.0, 0.0 );
rotate_step_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( rotate_step_spinbutton_adj ), 1, 4 ); rotate_step_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( rotate_step_spinbutton_adj ), 1, 4 );
gtk_widget_set_hexpand( rotate_step_spinbutton, TRUE );
gtk_grid_attach( GTK_GRID( table1 ), rotate_step_spinbutton, 2, 5, 1, 1 ); gtk_grid_attach( GTK_GRID( table1 ), rotate_step_spinbutton, 2, 5, 1, 1 );
gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( rotate_step_spinbutton ), GTK_UPDATE_IF_VALID ); gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( rotate_step_spinbutton ), GTK_UPDATE_IF_VALID );
gtk_widget_set_hexpand( rotate_step_spinbutton, TRUE );
gtk_widget_show( rotate_step_spinbutton ); gtk_widget_show( rotate_step_spinbutton );
g_object_set( rotate_step_spinbutton, "xalign", 1.0, NULL ); g_object_set( rotate_step_spinbutton, "xalign", 1.0, NULL );
@ -835,7 +836,7 @@ GtkWidget* create_SurfaceInspector( void ){
hbox2 = gtk_box_new( GTK_ORIENTATION_HORIZONTAL, 0 ); hbox2 = gtk_box_new( GTK_ORIENTATION_HORIZONTAL, 0 );
gtk_container_add( GTK_CONTAINER( viewport ), hbox2 ); gtk_container_add( GTK_CONTAINER( viewport ), hbox2 );
gtk_container_set_border_width( GTK_CONTAINER( hbox2 ), 4 ); gtk_container_set_border_width( GTK_CONTAINER( hbox2 ), 4 );
gtk_widget_set_hexpand( hbox2, FALSE ); gtk_widget_set_hexpand( hbox2, TRUE );
gtk_widget_set_vexpand( hbox2, FALSE ); gtk_widget_set_vexpand( hbox2, FALSE );
gtk_widget_show( hbox2 ); gtk_widget_show( hbox2 );
@ -843,14 +844,16 @@ GtkWidget* create_SurfaceInspector( void ){
gtk_frame_set_shadow_type( GTK_FRAME( viewport ), GTK_SHADOW_NONE ); gtk_frame_set_shadow_type( GTK_FRAME( viewport ), GTK_SHADOW_NONE );
gtk_container_add( GTK_CONTAINER( hbox2 ), viewport ); gtk_container_add( GTK_CONTAINER( hbox2 ), viewport );
gtk_container_set_border_width( GTK_CONTAINER( viewport ), 6 ); gtk_container_set_border_width( GTK_CONTAINER( viewport ), 6 );
gtk_widget_set_hexpand( viewport, FALSE ); gtk_widget_set_hexpand( viewport, TRUE );
gtk_widget_set_vexpand( viewport, FALSE ); gtk_widget_set_vexpand( viewport, FALSE );
gtk_widget_show( viewport ); gtk_widget_show( viewport );
table4 = gtk_grid_new(); //only need this for layout table4 = gtk_grid_new(); //only need this for layout
gtk_grid_set_row_homogeneous( GTK_GRID( table4 ), TRUE );
gtk_grid_set_column_spacing( GTK_GRID( table4 ), 2 );
gtk_container_add( GTK_CONTAINER( viewport ), table4 ); gtk_container_add( GTK_CONTAINER( viewport ), table4 );
gtk_container_set_border_width( GTK_CONTAINER( table4 ), 5 ); gtk_container_set_border_width( GTK_CONTAINER( table4 ), 5 );
gtk_grid_set_column_spacing( GTK_GRID( table4 ), 2 ); gtk_widget_set_hexpand( table4, TRUE );
gtk_widget_show( table4 ); gtk_widget_show( table4 );
label = gtk_label_new( "" ); //only need this for layout label = gtk_label_new( "" ); //only need this for layout
@ -860,58 +863,89 @@ GtkWidget* create_SurfaceInspector( void ){
axial_button = gtk_button_new_with_mnemonic( _( "Axial" ) ); axial_button = gtk_button_new_with_mnemonic( _( "Axial" ) );
gtk_grid_attach( GTK_GRID( table4 ), axial_button, 0, 1, 1, 1 ); gtk_grid_attach( GTK_GRID( table4 ), axial_button, 0, 1, 1, 1 );
gtk_widget_set_hexpand( axial_button, TRUE );
gtk_widget_show( axial_button ); gtk_widget_show( axial_button );
viewport = gtk_frame_new( NULL ); viewport = gtk_frame_new( NULL );
gtk_frame_set_shadow_type( GTK_FRAME( viewport ), GTK_SHADOW_ETCHED_OUT ); gtk_frame_set_shadow_type( GTK_FRAME( viewport ), GTK_SHADOW_ETCHED_OUT );
gtk_box_pack_start( GTK_BOX( hbox2 ), viewport, FALSE, FALSE, 0 ); gtk_box_pack_start( GTK_BOX( hbox2 ), viewport, FALSE, TRUE, 0 );
gtk_container_set_border_width( GTK_CONTAINER( viewport ), 6 ); gtk_container_set_border_width( GTK_CONTAINER( viewport ), 6 );
gtk_widget_set_hexpand( viewport, FALSE ); gtk_widget_set_hexpand( viewport, TRUE );
gtk_widget_set_vexpand( viewport, FALSE ); gtk_widget_set_vexpand( viewport, FALSE );
gtk_widget_show( viewport ); gtk_widget_show( viewport );
table5 = gtk_grid_new(); hbox3 = gtk_box_new( GTK_ORIENTATION_HORIZONTAL, 0 );
gtk_container_add( GTK_CONTAINER( viewport ), table5 ); gtk_container_add( GTK_CONTAINER( viewport ), hbox3 );
gtk_container_set_border_width( GTK_CONTAINER( table5 ), 5 ); gtk_widget_set_hexpand( hbox3, TRUE );
gtk_grid_set_column_spacing( GTK_GRID( table5 ), 2 ); gtk_widget_set_vexpand( hbox3, FALSE );
gtk_widget_show( table5 ); gtk_widget_show( hbox3 );
label = gtk_label_new( _( "Height" ) ); table3 = gtk_grid_new(); //only need this for layout
gtk_grid_attach( GTK_GRID( table5 ), label, 1, 0, 1, 1 ); gtk_grid_set_row_homogeneous( GTK_GRID( table3 ), TRUE );
gtk_widget_set_halign( label, GTK_ALIGN_START ); gtk_grid_set_column_spacing( GTK_GRID( table3 ), 2 );
gtk_widget_show( label ); gtk_container_add( GTK_CONTAINER( hbox3 ), table3 );
gtk_container_set_border_width( GTK_CONTAINER( table3 ), 5 );
gtk_widget_set_hexpand( table3, TRUE );
gtk_widget_show( table3 );
label = gtk_label_new( _( "Width" ) ); label = gtk_label_new( "" ); //only need this for layout
gtk_grid_attach( GTK_GRID( table5 ), label, 2, 0, 1, 1 ); gtk_grid_attach( GTK_GRID( table3 ), label, 0, 0, 1, 1 );
gtk_widget_set_halign( label, GTK_ALIGN_START ); gtk_widget_set_halign( label, GTK_ALIGN_START );
gtk_widget_show( label ); gtk_widget_show( label );
fit_button = gtk_button_new_with_mnemonic( _( "Fit" ) ); fit_button = gtk_button_new_with_mnemonic( _( "Fit" ) );
gtk_grid_attach( GTK_GRID( table5 ), fit_button, 0, 1, 1, 1 ); gtk_grid_attach( GTK_GRID( table3 ), fit_button, 0, 1, 2, 1 );
gtk_widget_set_hexpand( fit_button, TRUE );
gtk_widget_show( fit_button ); gtk_widget_show( fit_button );
table5 = gtk_grid_new();
gtk_grid_set_column_spacing( GTK_GRID( table5 ), 2 );
gtk_grid_set_row_homogeneous( GTK_GRID( table5 ), TRUE );
gtk_box_pack_start( GTK_BOX( hbox3 ), table5, FALSE, TRUE, 0 );
gtk_container_set_border_width( GTK_CONTAINER( table5 ), 5 );
gtk_widget_set_hexpand( table5, TRUE );
gtk_widget_show( table5 );
label = gtk_label_new( _( "Height" ) );
gtk_grid_attach( GTK_GRID( table5 ), label, 1, 0, 1, 1 );
gtk_widget_set_halign( label, GTK_ALIGN_START );
gtk_widget_show( label );
label = gtk_label_new( _( "Width" ) );
gtk_grid_attach( GTK_GRID( table5 ), label, 0, 0, 1, 1 );
gtk_widget_set_halign( label, GTK_ALIGN_START );
gtk_widget_show( label );
fit_width_spinbutton_adj = gtk_adjustment_new( 1, 1, 32, 1, 10, 0 ); fit_width_spinbutton_adj = gtk_adjustment_new( 1, 1, 32, 1, 10, 0 );
fit_width_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( fit_width_spinbutton_adj ), 1, 0 ); fit_width_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( fit_width_spinbutton_adj ), 1, 0 );
gtk_grid_attach( GTK_GRID( table5 ), fit_width_spinbutton, 1, 1, 1, 1 ); gtk_grid_attach( GTK_GRID( table5 ), fit_width_spinbutton, 0, 1, 1, 1 );
gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( fit_width_spinbutton ), TRUE ); gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( fit_width_spinbutton ), TRUE );
gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( fit_width_spinbutton ), GTK_UPDATE_IF_VALID ); gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( fit_width_spinbutton ), GTK_UPDATE_IF_VALID );
gtk_widget_set_hexpand( fit_width_spinbutton, TRUE );
gtk_widget_show( fit_width_spinbutton ); gtk_widget_show( fit_width_spinbutton );
g_object_set( fit_width_spinbutton, "xalign", 1.0, NULL ); g_object_set( fit_width_spinbutton, "xalign", 1.0, NULL );
fit_height_spinbutton_adj = gtk_adjustment_new( 1, 1, 32, 1, 10, 0 ); fit_height_spinbutton_adj = gtk_adjustment_new( 1, 1, 32, 1, 10, 0 );
fit_height_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( fit_height_spinbutton_adj ), 1, 0 ); fit_height_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( fit_height_spinbutton_adj ), 1, 0 );
gtk_grid_attach( GTK_GRID( table5 ), fit_height_spinbutton, 2, 1, 1, 1 ); gtk_grid_attach( GTK_GRID( table5 ), fit_height_spinbutton, 1, 1, 1, 1 );
gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( fit_height_spinbutton ), TRUE ); gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( fit_height_spinbutton ), TRUE );
gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( fit_height_spinbutton ), GTK_UPDATE_IF_VALID ); gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( fit_height_spinbutton ), GTK_UPDATE_IF_VALID );
gtk_widget_set_hexpand( fit_height_spinbutton, TRUE );
gtk_widget_show( fit_height_spinbutton ); gtk_widget_show( fit_height_spinbutton );
g_object_set( fit_height_spinbutton, "xalign", 1.0, NULL ); g_object_set( fit_height_spinbutton, "xalign", 1.0, NULL );
button_group = gtk_size_group_new( GTK_SIZE_GROUP_BOTH ); size_group = gtk_size_group_new( GTK_SIZE_GROUP_BOTH );
gtk_size_group_add_widget( button_group, axial_button ); gtk_size_group_add_widget( size_group, axial_button );
gtk_size_group_add_widget( button_group, fit_button ); gtk_size_group_add_widget( size_group, fit_button );
g_object_unref( button_group ); g_object_unref( size_group );
size_group = gtk_size_group_new( GTK_SIZE_GROUP_BOTH );
gtk_size_group_add_widget( size_group, table3 );
gtk_size_group_add_widget( size_group, table4 );
g_object_unref( size_group );
// closing the window (upper right window manager click) // closing the window (upper right window manager click)
g_signal_connect( (gpointer) SurfaceInspector, g_signal_connect( (gpointer) SurfaceInspector,

View File

@ -588,59 +588,46 @@ GtkWidget* create_SurfaceInspector( void ){
gtk_container_add( GTK_CONTAINER( vbox1 ), frame1 ); gtk_container_add( GTK_CONTAINER( vbox1 ), frame1 );
gtk_widget_show( frame1 ); gtk_widget_show( frame1 );
table1 = gtk_table_new( 7, 3, FALSE ); table1 = gtk_grid_new();
gtk_table_set_col_spacings( GTK_TABLE( table1 ), 5 ); gtk_grid_set_row_spacing( GTK_GRID( table1 ), 5 );
gtk_table_set_row_spacings( GTK_TABLE( table1 ), 5 ); gtk_grid_set_column_spacing( GTK_GRID( table1 ), 5 );
gtk_container_set_border_width( GTK_CONTAINER( table1 ), 5 ); gtk_container_set_border_width( GTK_CONTAINER( table1 ), 5 );
gtk_container_add( GTK_CONTAINER( frame1 ), table1 ); gtk_container_add( GTK_CONTAINER( frame1 ), table1 );
gtk_widget_set_hexpand( GTK_WIDGET( table1 ), TRUE );
gtk_widget_show( table1 ); gtk_widget_show( table1 );
label = gtk_label_new( "Step" ); label = gtk_label_new( "Value" );
gtk_table_attach( GTK_TABLE( table1 ), label, 2, 3, 0, 1, gtk_grid_attach( GTK_GRID( table1 ), label, 1, 0, 1, 1 );
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_set_halign( label, GTK_ALIGN_START ); gtk_widget_set_halign( label, GTK_ALIGN_START );
gtk_widget_show( label ); gtk_widget_show( label );
label = gtk_label_new( "Value" ); label = gtk_label_new( "Step" );
gtk_table_attach( GTK_TABLE( table1 ), label, 1, 2, 0, 1, gtk_grid_attach( GTK_GRID( table1 ), label, 2, 0, 1, 1 );
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_set_halign( label, GTK_ALIGN_START ); gtk_widget_set_halign( label, GTK_ALIGN_START );
gtk_widget_show( label ); gtk_widget_show( label );
label = gtk_label_new( "Horizontal shift: " ); label = gtk_label_new( "Horizontal shift: " );
gtk_table_attach( GTK_TABLE( table1 ), label, 0, 1, 1, 2, gtk_grid_attach( GTK_GRID( table1 ), label, 0, 1, 1, 1 );
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 );
gtk_widget_set_halign( label, GTK_ALIGN_START ); gtk_widget_set_halign( label, GTK_ALIGN_START );
gtk_widget_show( label ); gtk_widget_show( label );
label = gtk_label_new( "Vertical shift: " ); label = gtk_label_new( "Vertical shift: " );
gtk_table_attach( GTK_TABLE( table1 ), label, 0, 1, 2, 3, gtk_grid_attach( GTK_GRID( table1 ), label, 0, 2, 1, 1 );
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 );
gtk_widget_set_halign( label, GTK_ALIGN_START ); gtk_widget_set_halign( label, GTK_ALIGN_START );
gtk_widget_show( label ); gtk_widget_show( label );
label = gtk_label_new( "Horizontal scale: " ); label = gtk_label_new( "Horizontal scale: " );
gtk_table_attach( GTK_TABLE( table1 ), label, 0, 1, 3, 4, gtk_grid_attach( GTK_GRID( table1 ), label, 0, 3, 1, 1 );
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 );
gtk_widget_set_halign( label, GTK_ALIGN_START ); gtk_widget_set_halign( label, GTK_ALIGN_START );
gtk_widget_show( label ); gtk_widget_show( label );
label = gtk_label_new( "Vertical scale: " ); label = gtk_label_new( "Vertical scale: " );
gtk_table_attach( GTK_TABLE( table1 ), label, 0, 1, 4, 5, gtk_grid_attach( GTK_GRID( table1 ), label, 0, 4, 1, 1 );
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 );
gtk_widget_set_halign( label, GTK_ALIGN_START ); gtk_widget_set_halign( label, GTK_ALIGN_START );
gtk_widget_show( label ); gtk_widget_show( label );
label = gtk_label_new( "Rotate: " ); label = gtk_label_new( "Rotate: " );
gtk_table_attach( GTK_TABLE( table1 ), label, 0, 1, 5, 6, gtk_grid_attach( GTK_GRID( table1 ), label, 0, 5, 1, 1 );
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 );
gtk_widget_set_halign( label, GTK_ALIGN_START ); gtk_widget_set_halign( label, GTK_ALIGN_START );
gtk_widget_show( label ); gtk_widget_show( label );
@ -649,9 +636,8 @@ GtkWidget* create_SurfaceInspector( void ){
hshift_value_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( adjustment ), 1, 2 ); hshift_value_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( adjustment ), 1, 2 );
gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( hshift_value_spinbutton ), GTK_UPDATE_IF_VALID ); gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( hshift_value_spinbutton ), GTK_UPDATE_IF_VALID );
gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( hshift_value_spinbutton ), TRUE ); gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( hshift_value_spinbutton ), TRUE );
gtk_table_attach( GTK_TABLE( table1 ), hshift_value_spinbutton, 1, 2, 1, 2, gtk_grid_attach( GTK_GRID( table1 ), hshift_value_spinbutton, 1, 1, 1, 1 );
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), gtk_widget_set_hexpand( GTK_WIDGET( hshift_value_spinbutton ), TRUE );
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( hshift_value_spinbutton ); gtk_widget_show( hshift_value_spinbutton );
g_object_set( hshift_value_spinbutton, "xalign", 1.0, NULL ); g_object_set( hshift_value_spinbutton, "xalign", 1.0, NULL );
@ -660,9 +646,8 @@ GtkWidget* create_SurfaceInspector( void ){
vshift_value_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( adjustment ), 1, 2 ); vshift_value_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( adjustment ), 1, 2 );
gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( vshift_value_spinbutton ), GTK_UPDATE_IF_VALID ); gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( vshift_value_spinbutton ), GTK_UPDATE_IF_VALID );
gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( vshift_value_spinbutton ), TRUE ); gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( vshift_value_spinbutton ), TRUE );
gtk_table_attach( GTK_TABLE( table1 ), vshift_value_spinbutton, 1, 2, 2, 3, gtk_grid_attach( GTK_GRID( table1 ), vshift_value_spinbutton, 1, 2, 1, 1 );
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), gtk_widget_set_hexpand( GTK_WIDGET( vshift_value_spinbutton ), TRUE );
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( vshift_value_spinbutton ); gtk_widget_show( vshift_value_spinbutton );
g_object_set( vshift_value_spinbutton, "xalign", 1.0, NULL ); g_object_set( vshift_value_spinbutton, "xalign", 1.0, NULL );
@ -670,18 +655,16 @@ GtkWidget* create_SurfaceInspector( void ){
hscale_value_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( adjustment ), 1, 4 ); hscale_value_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( adjustment ), 1, 4 );
gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( hscale_value_spinbutton ), GTK_UPDATE_IF_VALID ); gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( hscale_value_spinbutton ), GTK_UPDATE_IF_VALID );
gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( hscale_value_spinbutton ), TRUE ); gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( hscale_value_spinbutton ), TRUE );
gtk_table_attach( GTK_TABLE( table1 ), hscale_value_spinbutton, 1, 2, 3, 4, gtk_grid_attach( GTK_GRID( table1 ), hscale_value_spinbutton, 1, 3, 1, 1 );
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), gtk_widget_set_hexpand( GTK_WIDGET( hscale_value_spinbutton ), TRUE );
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( hscale_value_spinbutton ); gtk_widget_show( hscale_value_spinbutton );
g_object_set( hscale_value_spinbutton, "xalign", 1.0, NULL ); g_object_set( hscale_value_spinbutton, "xalign", 1.0, NULL );
adjustment = gtk_adjustment_new( 0.0, -1024.0, 1024.0, 1.0, 4.0, 0.0 ); adjustment = gtk_adjustment_new( 0.0, -1024.0, 1024.0, 1.0, 4.0, 0.0 );
vscale_value_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( adjustment ), 1, 4 ); vscale_value_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( adjustment ), 1, 4 );
gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( vscale_value_spinbutton ), GTK_UPDATE_IF_VALID ); gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( vscale_value_spinbutton ), GTK_UPDATE_IF_VALID );
gtk_table_attach( GTK_TABLE( table1 ), vscale_value_spinbutton, 1, 2, 4, 5, gtk_grid_attach( GTK_GRID( table1 ), vscale_value_spinbutton, 1, 4, 1, 1 );
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), gtk_widget_set_hexpand( GTK_WIDGET( vscale_value_spinbutton ), TRUE );
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( vscale_value_spinbutton ); gtk_widget_show( vscale_value_spinbutton );
g_object_set( vscale_value_spinbutton, "xalign", 1.0, NULL ); g_object_set( vscale_value_spinbutton, "xalign", 1.0, NULL );
@ -689,9 +672,8 @@ GtkWidget* create_SurfaceInspector( void ){
rotate_value_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( adjustment ), 1, 2 ); rotate_value_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( adjustment ), 1, 2 );
gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( rotate_value_spinbutton ), GTK_UPDATE_IF_VALID ); gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( rotate_value_spinbutton ), GTK_UPDATE_IF_VALID );
gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( rotate_value_spinbutton ), TRUE ); gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( rotate_value_spinbutton ), TRUE );
gtk_table_attach( GTK_TABLE( table1 ), rotate_value_spinbutton, 1, 2, 5, 6, gtk_grid_attach( GTK_GRID( table1 ), rotate_value_spinbutton, 1, 5, 1, 1 );
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), gtk_widget_set_hexpand( GTK_WIDGET( rotate_value_spinbutton ), TRUE );
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( rotate_value_spinbutton ); gtk_widget_show( rotate_value_spinbutton );
g_object_set( rotate_value_spinbutton, "xalign", 1.0, NULL ); g_object_set( rotate_value_spinbutton, "xalign", 1.0, NULL );
@ -699,117 +681,101 @@ GtkWidget* create_SurfaceInspector( void ){
adjustment = gtk_adjustment_new( 0.0, -8192.0, 8192.0, 2.0, 8.0, 0.0 ); adjustment = gtk_adjustment_new( 0.0, -8192.0, 8192.0, 2.0, 8.0, 0.0 );
hshift_step_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( adjustment ), 1, 2 ); hshift_step_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( adjustment ), 1, 2 );
gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( hshift_step_spinbutton ), GTK_UPDATE_IF_VALID ); gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( hshift_step_spinbutton ), GTK_UPDATE_IF_VALID );
gtk_table_attach( GTK_TABLE( table1 ), hshift_step_spinbutton, 2, 3, 1, 2, gtk_grid_attach( GTK_GRID( table1 ), hshift_step_spinbutton, 2, 1, 1, 1 );
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), gtk_widget_set_hexpand( GTK_WIDGET( hshift_step_spinbutton ), TRUE );
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( hshift_step_spinbutton ); gtk_widget_show( hshift_step_spinbutton );
g_object_set( hshift_step_spinbutton, "xalign", 1.0, NULL ); g_object_set( hshift_step_spinbutton, "xalign", 1.0, NULL );
adjustment = gtk_adjustment_new( 0.0, -8192.0, 8192.0, 2.0, 8.0, 0.0 ); adjustment = gtk_adjustment_new( 0.0, -8192.0, 8192.0, 2.0, 8.0, 0.0 );
vshift_step_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( adjustment ), 1, 2 ); vshift_step_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( adjustment ), 1, 2 );
gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( vshift_step_spinbutton ), GTK_UPDATE_IF_VALID ); gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( vshift_step_spinbutton ), GTK_UPDATE_IF_VALID );
gtk_table_attach( GTK_TABLE( table1 ), vshift_step_spinbutton, 2, 3, 2, 3, gtk_grid_attach( GTK_GRID( table1 ), vshift_step_spinbutton, 2, 2, 1, 1 );
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), gtk_widget_set_hexpand( GTK_WIDGET( vshift_step_spinbutton ), TRUE );
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( vshift_step_spinbutton ); gtk_widget_show( vshift_step_spinbutton );
g_object_set( vshift_step_spinbutton, "xalign", 1.0, NULL ); g_object_set( vshift_step_spinbutton, "xalign", 1.0, NULL );
adjustment = gtk_adjustment_new( 0.0, -1024.0, 1024.0, 1.0, 4.0, 0.0 ); adjustment = gtk_adjustment_new( 0.0, -1024.0, 1024.0, 1.0, 4.0, 0.0 );
hscale_step_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( adjustment ), 1, 4 ); hscale_step_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( adjustment ), 1, 4 );
gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( hscale_step_spinbutton ), GTK_UPDATE_IF_VALID ); gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( hscale_step_spinbutton ), GTK_UPDATE_IF_VALID );
gtk_table_attach( GTK_TABLE( table1 ), hscale_step_spinbutton, 2, 3, 3, 4, gtk_grid_attach( GTK_GRID( table1 ), hscale_step_spinbutton, 2, 3, 1, 1 );
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), gtk_widget_set_hexpand( GTK_WIDGET( hscale_step_spinbutton ), TRUE );
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( hscale_step_spinbutton ); gtk_widget_show( hscale_step_spinbutton );
g_object_set( hscale_step_spinbutton, "xalign", 1.0, NULL ); g_object_set( hscale_step_spinbutton, "xalign", 1.0, NULL );
adjustment = gtk_adjustment_new( 0.0, -1024.0, 1024.0, 1.0, 4.0, 0.0 ); adjustment = gtk_adjustment_new( 0.0, -1024.0, 1024.0, 1.0, 4.0, 0.0 );
vscale_step_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( adjustment ), 1, 4 ); vscale_step_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( adjustment ), 1, 4 );
gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( vscale_step_spinbutton ), GTK_UPDATE_IF_VALID ); gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( vscale_step_spinbutton ), GTK_UPDATE_IF_VALID );
gtk_table_attach( GTK_TABLE( table1 ), vscale_step_spinbutton, 2, 3, 4, 5, gtk_grid_attach( GTK_GRID( table1 ), vscale_step_spinbutton, 2, 4, 1, 1 );
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), gtk_widget_set_hexpand( GTK_WIDGET( vscale_step_spinbutton ), TRUE );
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( vscale_step_spinbutton ); gtk_widget_show( vscale_step_spinbutton );
g_object_set( vscale_step_spinbutton, "xalign", 1.0, NULL ); g_object_set( vscale_step_spinbutton, "xalign", 1.0, NULL );
adjustment = gtk_adjustment_new( 0.0, -360.0, 360.0, 1.0, 10.0, 0.0 ); adjustment = gtk_adjustment_new( 0.0, -360.0, 360.0, 1.0, 10.0, 0.0 );
rotate_step_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( adjustment ), 1, 2 ); rotate_step_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( adjustment ), 1, 2 );
gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( rotate_step_spinbutton ), GTK_UPDATE_IF_VALID ); gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( rotate_step_spinbutton ), GTK_UPDATE_IF_VALID );
gtk_table_attach( GTK_TABLE( table1 ), rotate_step_spinbutton, 2, 3, 5, 6, gtk_grid_attach( GTK_GRID( table1 ), rotate_step_spinbutton, 2, 5, 1, 1 );
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), gtk_widget_set_hexpand( GTK_WIDGET( rotate_step_spinbutton ), TRUE );
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( rotate_step_spinbutton ); gtk_widget_show( rotate_step_spinbutton );
g_object_set( rotate_step_spinbutton, "xalign", 1.0, NULL ); g_object_set( rotate_step_spinbutton, "xalign", 1.0, NULL );
match_grid_button = gtk_button_new_with_mnemonic( "Match Grid" ); match_grid_button = gtk_button_new_with_mnemonic( "Match Grid" );
gtk_table_attach( GTK_TABLE( table1 ), match_grid_button, 2, 3, 6, 7, gtk_grid_attach( GTK_GRID( table1 ), match_grid_button, 2, 6, 1, 1 );
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( match_grid_button ); gtk_widget_show( match_grid_button );
frame2 = gtk_frame_new( "Tools" ); frame2 = gtk_frame_new( "Tools" );
gtk_container_add( GTK_CONTAINER( vbox1 ), frame2 ); gtk_container_add( GTK_CONTAINER( vbox1 ), frame2 );
gtk_widget_show( frame2 ); gtk_widget_show( frame2 );
table2 = gtk_table_new( 2, 4, TRUE ); table2 = gtk_grid_new();
gtk_table_set_col_spacings( GTK_TABLE( table2), 5 ); gtk_grid_set_row_spacing( GTK_GRID( table2 ), 5 );
gtk_table_set_row_spacings( GTK_TABLE( table2 ), 0 ); gtk_grid_set_column_spacing( GTK_GRID( table2 ), 5 );
gtk_container_set_border_width( GTK_CONTAINER( table2 ), 5 );
gtk_container_add( GTK_CONTAINER( frame2 ), table2 ); gtk_container_add( GTK_CONTAINER( frame2 ), table2 );
gtk_container_set_border_width( GTK_CONTAINER( table2 ), 5 );
gtk_widget_set_hexpand( GTK_WIDGET( table2 ), TRUE );
gtk_widget_show( table2 ); gtk_widget_show( table2 );
label = gtk_label_new( "Height" ); label = gtk_label_new( "Brush" );
gtk_widget_show( label ); gtk_grid_attach( GTK_GRID( table2 ), label, 0, 0, 1, 1 );
gtk_table_attach( GTK_TABLE( table2 ), label, 3, 4, 0, 1,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_set_halign( label, GTK_ALIGN_START ); gtk_widget_set_halign( label, GTK_ALIGN_START );
gtk_widget_set_hexpand( GTK_WIDGET( label ), TRUE );
gtk_widget_show( label );
label = gtk_label_new( "Height" );
gtk_grid_attach( GTK_GRID( table2 ), label, 2, 0, 1, 1 );
gtk_widget_set_halign( label, GTK_ALIGN_START );
gtk_widget_set_hexpand( GTK_WIDGET( label ), TRUE );
gtk_widget_show( label ); gtk_widget_show( label );
label = gtk_label_new( "Width" ); label = gtk_label_new( "Width" );
gtk_table_attach( GTK_TABLE( table2 ), label, 2, 3, 0, 1, gtk_grid_attach( GTK_GRID( table2 ), label, 3, 0, 1, 1 );
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_set_halign( label, GTK_ALIGN_START ); gtk_widget_set_halign( label, GTK_ALIGN_START );
gtk_widget_set_hexpand( GTK_WIDGET( label ), TRUE );
gtk_widget_show( label ); gtk_widget_show( label );
label = gtk_label_new( "Brush" );
gtk_table_attach( GTK_TABLE( table2 ), label, 0, 2, 0, 1,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_set_halign( label, GTK_ALIGN_START );
gtk_widget_show( label );
adjustment = gtk_adjustment_new( 1, 1, 32, 1, 10, 0 );
fit_height_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( adjustment ), 1, 0 );
gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( fit_height_spinbutton ), TRUE );
gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( fit_height_spinbutton ), GTK_UPDATE_IF_VALID );
gtk_table_attach( GTK_TABLE( table2 ), fit_height_spinbutton, 3, 4, 1, 2,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( fit_height_spinbutton );
g_object_set( fit_height_spinbutton, "xalign", 1.0, NULL );
adjustment = gtk_adjustment_new( 1, 1, 32, 1, 10, 0 ); adjustment = gtk_adjustment_new( 1, 1, 32, 1, 10, 0 );
fit_width_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( adjustment ), 1, 0 ); fit_width_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( adjustment ), 1, 0 );
gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( fit_width_spinbutton ), TRUE ); gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( fit_width_spinbutton ), TRUE );
gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( fit_width_spinbutton ), GTK_UPDATE_IF_VALID ); gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( fit_width_spinbutton ), GTK_UPDATE_IF_VALID );
gtk_table_attach( GTK_TABLE( table2 ), fit_width_spinbutton, 2, 3, 1, 2, gtk_grid_attach( GTK_GRID( table2 ), fit_width_spinbutton, 2, 1, 1, 1 );
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( fit_width_spinbutton ); gtk_widget_show( fit_width_spinbutton );
g_object_set( fit_width_spinbutton, "xalign", 1.0, NULL ); g_object_set( fit_width_spinbutton, "xalign", 1.0, NULL );
adjustment = gtk_adjustment_new( 1, 1, 32, 1, 10, 0 );
fit_height_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( adjustment ), 1, 0 );
gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( fit_height_spinbutton ), TRUE );
gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( fit_height_spinbutton ), GTK_UPDATE_IF_VALID );
gtk_grid_attach( GTK_GRID( table2 ), fit_height_spinbutton, 3, 1, 1, 1 );
gtk_widget_show( fit_height_spinbutton );
g_object_set( fit_height_spinbutton, "xalign", 1.0, NULL );
fit_button = gtk_button_new_with_mnemonic( "Fit" ); fit_button = gtk_button_new_with_mnemonic( "Fit" );
gtk_table_attach( GTK_TABLE( table2 ), fit_button, 1, 2, 1, 2, gtk_grid_attach( GTK_GRID( table2 ), fit_button, 0, 1, 1, 1 );
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), gtk_widget_set_hexpand( GTK_WIDGET( fit_button ), TRUE );
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( fit_button ); gtk_widget_show( fit_button );
axial_button = gtk_button_new_with_mnemonic( "Axial" ); axial_button = gtk_button_new_with_mnemonic( "Axial" );
gtk_table_attach( GTK_TABLE( table2 ), axial_button, 0, 1, 1, 2, gtk_grid_attach( GTK_GRID( table2 ), axial_button, 1, 1, 1, 1 );
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), gtk_widget_set_hexpand( GTK_WIDGET( axial_button ), TRUE );
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( axial_button ); gtk_widget_show( axial_button );
size_group = gtk_size_group_new( GTK_SIZE_GROUP_BOTH ); size_group = gtk_size_group_new( GTK_SIZE_GROUP_BOTH );

View File

@ -321,10 +321,12 @@ GtkWidget* create_SurfaceFlagsFrame( GtkWidget* surfacedialog_widget ){
gtk_container_add( GTK_CONTAINER( notebook1 ), vbox2 ); gtk_container_add( GTK_CONTAINER( notebook1 ), vbox2 );
gtk_widget_show( vbox2 ); gtk_widget_show( vbox2 );
table4 = gtk_table_new( 8, 4, TRUE ); table4 = gtk_grid_new();
gtk_table_set_col_spacings( GTK_TABLE( table4 ), 5 ); gtk_grid_set_column_spacing( GTK_GRID( table4 ), 5 );
gtk_table_set_row_spacings( GTK_TABLE( table4 ), 5 ); gtk_grid_set_row_spacing( GTK_GRID( table4 ), 5 );
gtk_box_pack_start( GTK_BOX( vbox2 ), table4, TRUE, TRUE, 0 ); gtk_box_pack_start( GTK_BOX( vbox2 ), table4, TRUE, TRUE, 0 );
gtk_container_set_border_width( GTK_CONTAINER( table4 ), 5 );
gtk_widget_set_hexpand( table4, TRUE );
gtk_widget_show( table4 ); gtk_widget_show( table4 );
y = -1; y = -1;
@ -338,14 +340,14 @@ GtkWidget* create_SurfaceFlagsFrame( GtkWidget* surfacedialog_widget ){
//Sys_Printf( "%s: %s\n", buffer, buttonLabel ); //Sys_Printf( "%s: %s\n", buffer, buttonLabel );
surface_buttons[i] = gtk_toggle_button_new_with_label( buttonLabel ); surface_buttons[i] = gtk_toggle_button_new_with_label( buttonLabel );
g_signal_connect( surface_buttons[i], "toggled", G_CALLBACK( on_surface_button_toggled ), GINT_TO_POINTER( 1 << i ) ); g_signal_connect( surface_buttons[i], "toggled", G_CALLBACK( on_surface_button_toggled ), GINT_TO_POINTER( 1 << i ) );
gtk_grid_attach( GTK_GRID( table4 ), surface_buttons[i], x, y, 1, 1 );
gtk_widget_set_hexpand( surface_buttons[i], TRUE );
gtk_widget_show( surface_buttons[i] ); gtk_widget_show( surface_buttons[i] );
gtk_table_attach( GTK_TABLE( table4 ), surface_buttons[i], 0 + x, 1 + x, ( 0 + y ), ( 1 + y ),
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 );
} }
hbox2 = gtk_box_new( GTK_ORIENTATION_HORIZONTAL, 0 ); hbox2 = gtk_box_new( GTK_ORIENTATION_HORIZONTAL, 0 );
gtk_box_pack_start( GTK_BOX( vbox2 ), hbox2, FALSE, FALSE, 0 ); gtk_box_pack_start( GTK_BOX( vbox2 ), hbox2, FALSE, FALSE, 0 );
gtk_container_set_border_width( GTK_CONTAINER( hbox2 ), 4 );
gtk_widget_show( hbox2 ); gtk_widget_show( hbox2 );
hbox3 = gtk_box_new( GTK_ORIENTATION_HORIZONTAL, 0 ); hbox3 = gtk_box_new( GTK_ORIENTATION_HORIZONTAL, 0 );
@ -353,10 +355,10 @@ GtkWidget* create_SurfaceFlagsFrame( GtkWidget* surfacedialog_widget ){
gtk_widget_show( hbox3 ); gtk_widget_show( hbox3 );
vbox4 = gtk_box_new( GTK_ORIENTATION_VERTICAL, 0 ); vbox4 = gtk_box_new( GTK_ORIENTATION_VERTICAL, 0 );
gtk_box_pack_start( GTK_BOX( hbox3 ), vbox4, TRUE, TRUE, 0 ); gtk_box_pack_start( GTK_BOX( hbox3 ), vbox4, TRUE, TRUE, 0 );
gtk_widget_show( vbox4 ); gtk_widget_show( vbox4 );
value_label = gtk_label_new( "Value: " ); value_label = gtk_label_new( "Value:" );
gtk_box_pack_start( GTK_BOX( hbox3 ), value_label, FALSE, FALSE, 0 ); gtk_box_pack_start( GTK_BOX( hbox3 ), value_label, FALSE, FALSE, 0 );
gtk_widget_set_halign( value_label, GTK_ALIGN_START ); gtk_widget_set_halign( value_label, GTK_ALIGN_START );
gtk_widget_show( value_label ); gtk_widget_show( value_label );
@ -381,10 +383,12 @@ GtkWidget* create_SurfaceFlagsFrame( GtkWidget* surfacedialog_widget ){
gtk_notebook_set_tab_label( GTK_NOTEBOOK( notebook1 ), gtk_notebook_get_nth_page( GTK_NOTEBOOK( notebook1 ), 0 ), label5 ); gtk_notebook_set_tab_label( GTK_NOTEBOOK( notebook1 ), gtk_notebook_get_nth_page( GTK_NOTEBOOK( notebook1 ), 0 ), label5 );
gtk_widget_show( label5 ); gtk_widget_show( label5 );
table3 = gtk_table_new( 8, 4, TRUE ); table3 = gtk_grid_new();
gtk_table_set_col_spacings( GTK_TABLE( table3 ), 5 ); gtk_grid_set_column_spacing( GTK_GRID( table3 ), 5 );
gtk_table_set_row_spacings( GTK_TABLE( table3 ), 5 ); gtk_grid_set_row_spacing( GTK_GRID( table3 ), 5 );
gtk_container_add( GTK_CONTAINER( notebook1 ), table3 ); gtk_container_add( GTK_CONTAINER( notebook1 ), table3 );
gtk_container_set_border_width( GTK_CONTAINER( table3 ), 5 );
gtk_widget_set_hexpand( table3, TRUE );
gtk_widget_show( table3 ); gtk_widget_show( table3 );
y = -1; y = -1;
@ -397,9 +401,8 @@ GtkWidget* create_SurfaceFlagsFrame( GtkWidget* surfacedialog_widget ){
buttonLabel = g_FuncTable.m_pfnReadProjectKey( buffer ); buttonLabel = g_FuncTable.m_pfnReadProjectKey( buffer );
content_buttons[i] = gtk_toggle_button_new_with_label( buttonLabel ); content_buttons[i] = gtk_toggle_button_new_with_label( buttonLabel );
g_signal_connect( content_buttons[i], "toggled", G_CALLBACK( on_content_button_toggled ), GINT_TO_POINTER( 1 << i ) ); g_signal_connect( content_buttons[i], "toggled", G_CALLBACK( on_content_button_toggled ), GINT_TO_POINTER( 1 << i ) );
gtk_table_attach( GTK_TABLE( table3 ), content_buttons[i], 0 + x, 1 + x, ( 0 + y ), ( 1 + y ), gtk_grid_attach( GTK_GRID( table3 ), content_buttons[i], x, y, 1, 1 );
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), gtk_widget_set_hexpand( content_buttons[i], TRUE );
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 );
gtk_widget_show( content_buttons[i] ); gtk_widget_show( content_buttons[i] );
} }

View File

@ -39,6 +39,7 @@
#endif #endif
#include <stdio.h> #include <stdio.h>
#include <errno.h>
#include "vfspk3.h" #include "vfspk3.h"
#include "vfs.h" #include "vfs.h"

View File

@ -367,7 +367,7 @@ void Drag_Begin( int x, int y, int buttons,
// ctrl-shift LBUTTON = select single face // ctrl-shift LBUTTON = select single face
if ( sf_camera && buttons == ( MK_LBUTTON | MK_CONTROL | MK_SHIFT ) && g_qeglobals.d_select_mode != sel_curvepoint ) { if ( sf_camera && buttons == ( MK_LBUTTON | MK_CONTROL | MK_SHIFT ) && g_qeglobals.d_select_mode != sel_curvepoint ) {
if ( Sys_AltDown() ) { if ( !Sys_AltDown() ) {
brush_t *b; brush_t *b;
for ( b = selected_brushes.next ; b != &selected_brushes ; b = b->next ) for ( b = selected_brushes.next ; b != &selected_brushes ; b = b->next )
{ {

View File

@ -120,6 +120,8 @@ void setSpecialLoad( eclass_t *e, const char* pWhat, char*& p ){
} }
} }
qboolean IsModelEntity( const char *name );
eclass_t *Eclass_InitFromText( char *text ){ eclass_t *Eclass_InitFromText( char *text ){
char *t; char *t;
int len; int len;
@ -260,7 +262,7 @@ eclass_t *Eclass_InitFromText( char *text ){
if ( strcmpi( e->name, "path" ) == 0 ) { if ( strcmpi( e->name, "path" ) == 0 ) {
e->nShowFlags |= ECLASS_PATH; e->nShowFlags |= ECLASS_PATH;
} }
if ( strcmpi( e->name, "misc_model" ) == 0 ) { if ( IsModelEntity( e->name ) == qtrue ) {
e->nShowFlags |= ECLASS_MISCMODEL; e->nShowFlags |= ECLASS_MISCMODEL;
} }

View File

@ -141,6 +141,8 @@ bfilter_t *FilterAddBase( bfilter_t *pFilter ){
pFilter = FilterAddImpl( pFilter,3,0,"trigger",EXCLUDE_TRIGGERS,true ); pFilter = FilterAddImpl( pFilter,3,0,"trigger",EXCLUDE_TRIGGERS,true );
pFilter = FilterAddImpl( pFilter,3,0,"misc_model",EXCLUDE_MODELS,true ); pFilter = FilterAddImpl( pFilter,3,0,"misc_model",EXCLUDE_MODELS,true );
pFilter = FilterAddImpl( pFilter,3,0,"misc_gamemodel",EXCLUDE_MODELS,true ); pFilter = FilterAddImpl( pFilter,3,0,"misc_gamemodel",EXCLUDE_MODELS,true );
pFilter = FilterAddImpl( pFilter,3,0,"misc_model_static",EXCLUDE_MODELS,true );
pFilter = FilterAddImpl( pFilter,3,0,"model_static",EXCLUDE_MODELS,true );
pFilter = FilterAddImpl( pFilter,4,ECLASS_LIGHT,NULL,EXCLUDE_LIGHTS,true ); pFilter = FilterAddImpl( pFilter,4,ECLASS_LIGHT,NULL,EXCLUDE_LIGHTS,true );
pFilter = FilterAddImpl( pFilter,4,ECLASS_PATH,NULL,EXCLUDE_PATHS,true ); pFilter = FilterAddImpl( pFilter,4,ECLASS_PATH,NULL,EXCLUDE_PATHS,true );
pFilter = FilterAddImpl( pFilter,1,0,"lightgrid",EXCLUDE_LIGHTGRID,true ); pFilter = FilterAddImpl( pFilter,1,0,"lightgrid",EXCLUDE_LIGHTGRID,true );

View File

@ -3487,6 +3487,41 @@ int DoLightIntensityDlg( int *intensity ){
return ret; return ret;
} }
static void limitHistory( GtkWidget *combo, gint max_count )
{
GtkTreeModel *model;
gint length;
if( max_count <= 0 )
return;
model = gtk_combo_box_get_model( GTK_COMBO_BOX( combo ) );
if( !model )
return;
length = gtk_tree_model_iter_n_children( model, NULL );
if( length > max_count )
{
int i;
gint count = length - max_count;
for( i = 0; i < count; i++ )
{
gtk_combo_box_text_remove( GTK_COMBO_BOX_TEXT( combo ), 0 );
}
}
}
static void AddToFindHistory( GtkWidget *combo, const gchar *strFind )
{
gtk_combo_box_text_append( GTK_COMBO_BOX_TEXT( combo ), strFind, strFind );
limitHistory( combo, 20 );
}
static void AddToReplaceHistory( GtkWidget *combo, const gchar *strReplace )
{
gtk_combo_box_text_append( GTK_COMBO_BOX_TEXT( combo ), strReplace, strReplace );
limitHistory( combo, 20 );
}
static void OnReplace_clicked( GtkButton *button, gpointer data ) static void OnReplace_clicked( GtkButton *button, gpointer data )
{ {
gboolean bSelectedOnly, bForce; gboolean bSelectedOnly, bForce;
@ -3511,6 +3546,9 @@ static void OnReplace_clicked( GtkButton *button, gpointer data )
strReplace = gtk_entry_get_text( GTK_ENTRY( entry ) ); strReplace = gtk_entry_get_text( GTK_ENTRY( entry ) );
FindReplaceTextures( strFind, strReplace, bSelectedOnly, bForce, FALSE ); FindReplaceTextures( strFind, strReplace, bSelectedOnly, bForce, FALSE );
AddToFindHistory( find_combo, strFind );
AddToReplaceHistory( replace_combo, strReplace );
} }
static void OnFind_clicked( GtkButton *button, gpointer data ) static void OnFind_clicked( GtkButton *button, gpointer data )
{ {
@ -3533,13 +3571,72 @@ static void OnFind_clicked( GtkButton *button, gpointer data )
strReplace = gtk_entry_get_text( GTK_ENTRY( entry ) ); strReplace = gtk_entry_get_text( GTK_ENTRY( entry ) );
FindReplaceTextures( strFind, strReplace, bSelectedOnly, FALSE, TRUE ); FindReplaceTextures( strFind, strReplace, bSelectedOnly, FALSE, TRUE );
AddToFindHistory( find_combo, strFind );
}
static void findpopup_selected( GtkWidget *widget, gpointer data )
{
const gchar *str;
GtkWidget *label;
GtkWidget *texlabel = GTK_WIDGET( g_object_get_data( G_OBJECT( widget ), "texture-label" ) );
if( texlabel )
{
label = texlabel;
} else
{
label = gtk_bin_get_child( GTK_BIN( widget ) );
}
str = gtk_label_get_text( GTK_LABEL( label ) );
gtk_entry_set_text( GTK_ENTRY( data ), str );
}
static void findbutton_clicked( GtkWidget *widget, gpointer data )
{
GtkWidget *menu, *item;
menu = gtk_menu_new();
for ( int i = 0; i < QERApp_GetActiveShaderCount(); i++ )
{
IShader *pShader = QERApp_ActiveShader_ForIndex( i );
if( strcmp( g_qeglobals.d_texturewin.texdef.GetName(), pShader->getName() ) == 0 )
{
GtkWidget *label, *box;
item = gtk_menu_item_new();
box = gtk_box_new( GTK_ORIENTATION_HORIZONTAL, 6 );
gtk_container_add( GTK_CONTAINER( item ), box );
gtk_widget_show( box );
label = gtk_label_new( pShader->getName() );
gtk_container_add( GTK_CONTAINER( box ), label );
gtk_widget_show( label );
g_object_set_data( G_OBJECT( item ), "texture-label", label );
label = gtk_label_new( _( "!" ) );
gtk_container_add( GTK_CONTAINER( box ), label );
gtk_widget_show( label );
} else
{
item = gtk_menu_item_new_with_label( pShader->getName() );
}
gtk_menu_shell_append( GTK_MENU_SHELL( menu ), item );
gtk_widget_show( item );
g_signal_connect( item, "activate", G_CALLBACK( findpopup_selected ), data );
}
gtk_menu_popup( GTK_MENU( menu ), NULL, widget, NULL, NULL, 1, GDK_CURRENT_TIME );
} }
void DoFindReplaceTexturesDialog() void DoFindReplaceTexturesDialog()
{ {
GtkWidget *dialog, *content_area, *combo, *hbox; GtkWidget *dialog, *content_area, *combo, *hbox;
GtkWidget *vbox, *table, *label, *button, *find_button, *replace_button; GtkWidget *vbox, *table, *label, *button, *find_button, *replace_button;
GtkWidget *find_combo, *replace_combo, *check; GtkWidget *find_combo, *replace_combo, *check, *entry;
GtkSizeGroup *button_group; GtkSizeGroup *button_group;
GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT; GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT;
@ -3570,23 +3667,34 @@ void DoFindReplaceTexturesDialog()
gtk_widget_set_halign( label, GTK_ALIGN_START ); gtk_widget_set_halign( label, GTK_ALIGN_START );
gtk_widget_show( label ); gtk_widget_show( label );
label = gtk_label_new( "Replace:" );
gtk_grid_attach( GTK_GRID( table ), label, 0, 1, 1, 1 );
gtk_widget_set_halign( label, GTK_ALIGN_START );
gtk_widget_show( label );
find_combo = combo = gtk_combo_box_text_new_with_entry(); find_combo = combo = gtk_combo_box_text_new_with_entry();
gtk_grid_attach( GTK_GRID( table ), combo, 1, 0, 1, 1 ); gtk_grid_attach( GTK_GRID( table ), combo, 1, 0, 1, 1 );
gtk_widget_set_hexpand( combo, TRUE ); gtk_widget_set_hexpand( combo, TRUE );
gtk_widget_show( combo ); gtk_widget_show( combo );
g_object_set_data( G_OBJECT( dialog ), "find_combo", find_combo ); g_object_set_data( G_OBJECT( dialog ), "find_combo", find_combo );
button = gtk_button_new_with_label( "..." );
gtk_grid_attach( GTK_GRID( table ), button, 2, 0, 1, 1 );
gtk_widget_show( button );
entry = gtk_bin_get_child( GTK_BIN( find_combo ) );
g_signal_connect( button, "clicked", G_CALLBACK( findbutton_clicked ), entry );
label = gtk_label_new( "Replace:" );
gtk_grid_attach( GTK_GRID( table ), label, 0, 1, 1, 1 );
gtk_widget_set_halign( label, GTK_ALIGN_START );
gtk_widget_show( label );
replace_combo = combo = gtk_combo_box_text_new_with_entry(); replace_combo = combo = gtk_combo_box_text_new_with_entry();
gtk_grid_attach( GTK_GRID( table ), combo, 1, 1, 1, 1 ); gtk_grid_attach( GTK_GRID( table ), combo, 1, 1, 1, 1 );
gtk_widget_set_hexpand( combo, TRUE ); gtk_widget_set_hexpand( combo, TRUE );
gtk_widget_show( combo ); gtk_widget_show( combo );
g_object_set_data( G_OBJECT( dialog ), "replace_combo", replace_combo ); g_object_set_data( G_OBJECT( dialog ), "replace_combo", replace_combo );
button = gtk_button_new_with_label( "..." );
gtk_grid_attach( GTK_GRID( table ), button, 2, 1, 1, 1 );
gtk_widget_show( button );
entry = gtk_bin_get_child( GTK_BIN( replace_combo ) );
g_signal_connect( button, "clicked", G_CALLBACK( findbutton_clicked ), entry );
check = gtk_check_button_new_with_label( "Use selected brushes only" ); check = gtk_check_button_new_with_label( "Use selected brushes only" );
gtk_box_pack_start( GTK_BOX( vbox ), check, TRUE, TRUE, 0 ); gtk_box_pack_start( GTK_BOX( vbox ), check, TRUE, TRUE, 0 );

View File

@ -910,7 +910,7 @@ int WINAPI gtk_MessageBoxNew( void *parent, const char *message,
// add message // add message
GtkWidget *dlg_msg = gtk_label_new( message ); GtkWidget *dlg_msg = gtk_label_new( message );
gtk_box_pack_start( GTK_BOX( icon_text_hbox ), dlg_msg, FALSE, FALSE, MSGBOX_PAD_MINOR ); gtk_box_pack_start( GTK_BOX( icon_text_hbox ), dlg_msg, FALSE, FALSE, MSGBOX_PAD_MINOR );
gtk_label_set_justify( GTK_LABEL( dlg_msg ), GTK_JUSTIFY_LEFT ); gtk_widget_set_halign( dlg_msg, GTK_ALIGN_START );
gtk_widget_show( dlg_msg ); gtk_widget_show( dlg_msg );
// add buttons // add buttons

View File

@ -421,6 +421,10 @@ int main( int argc, char* argv[] ) {
const char *libgl; const char *libgl;
int i, j, k; int i, j, k;
#if defined( _WIN32 ) && defined( _MSC_VER )
//increase the max open files to its maximum for the C run-time of MSVC
_setmaxstdio( 2048 );
#endif
/* /*
Rambetter on Sat Nov 13, 2010: Rambetter on Sat Nov 13, 2010:

View File

@ -2780,7 +2780,7 @@ void MainFrame::Create(){
else if ( CurrentStyle() == eFloating ) { else if ( CurrentStyle() == eFloating ) {
{ {
GtkWidget* wnd = create_floating( this ); GtkWidget* wnd = create_floating( this );
gtk_window_set_title( GTK_WINDOW( wnd ), "Camera" ); gtk_window_set_title( GTK_WINDOW( wnd ), _( "Camera" ) );
#ifdef _WIN32 #ifdef _WIN32
if ( g_PrefsDlg.m_bStartOnPrimMon ) { if ( g_PrefsDlg.m_bStartOnPrimMon ) {
@ -2806,7 +2806,7 @@ void MainFrame::Create(){
{ {
GtkWidget* wnd = create_floating( this ); GtkWidget* wnd = create_floating( this );
gtk_window_set_title( GTK_WINDOW( wnd ), "XY View" ); gtk_window_set_title( GTK_WINDOW( wnd ), _( "XY View" ) );
#ifdef _WIN32 #ifdef _WIN32
if ( g_PrefsDlg.m_bStartOnPrimMon ) { if ( g_PrefsDlg.m_bStartOnPrimMon ) {
@ -2831,7 +2831,7 @@ void MainFrame::Create(){
else else
{ {
GtkWidget* wnd = create_floating( this ); GtkWidget* wnd = create_floating( this );
gtk_window_set_title( GTK_WINDOW( wnd ), "XY View" ); gtk_window_set_title( GTK_WINDOW( wnd ), _( "XY View" ) );
#ifdef _WIN32 #ifdef _WIN32
if ( g_PrefsDlg.m_bStartOnPrimMon ) { if ( g_PrefsDlg.m_bStartOnPrimMon ) {
@ -2924,9 +2924,26 @@ void MainFrame::Create(){
GtkWidget* frame = create_framed_texwnd( m_pTexWnd ); GtkWidget* frame = create_framed_texwnd( m_pTexWnd );
m_pTexWnd->m_pParent = g_pGroupDlg->m_pWidget; m_pTexWnd->m_pParent = g_pGroupDlg->m_pWidget;
GtkWidget* w = gtk_label_new( _( "Textures" ) );
gtk_widget_show( w );
if( g_PrefsDlg.m_bShowTexDirList )
{
gint pos = 0;
GtkWidget* texDirList = create_texdirlist_widget( &pos );
GtkWidget* texSplit = gtk_paned_new( GTK_ORIENTATION_HORIZONTAL );
gtk_paned_add1( GTK_PANED( texSplit ), texDirList );
gtk_paned_add2( GTK_PANED( texSplit ), frame );
gtk_paned_set_position( GTK_PANED( texSplit ), pos );
gtk_widget_show( texSplit );
gtk_notebook_insert_page( GTK_NOTEBOOK( g_pGroupDlg->m_pNotebook ), texSplit, w, 1 );
} else
{ {
GtkWidget* w = gtk_label_new( _( "Textures" ) );
gtk_widget_show( w );
gtk_notebook_insert_page( GTK_NOTEBOOK( g_pGroupDlg->m_pNotebook ), frame, w, 1 ); gtk_notebook_insert_page( GTK_NOTEBOOK( g_pGroupDlg->m_pNotebook ), frame, w, 1 );
} }
} }
@ -2987,9 +3004,26 @@ void MainFrame::Create(){
m_pTexWnd = new TexWnd(); m_pTexWnd = new TexWnd();
GtkWidget* frame = create_framed_texwnd( m_pTexWnd ); GtkWidget* frame = create_framed_texwnd( m_pTexWnd );
GtkWidget* w = gtk_label_new( _( "Textures" ) );
gtk_widget_show( w );
if( g_PrefsDlg.m_bShowTexDirList )
{
gint pos = 0;
GtkWidget* texDirList = create_texdirlist_widget( &pos );
GtkWidget* texSplit = gtk_paned_new( GTK_ORIENTATION_HORIZONTAL );
gtk_paned_add1( GTK_PANED( texSplit ), texDirList );
gtk_paned_add2( GTK_PANED( texSplit ), frame );
gtk_paned_set_position( GTK_PANED( texSplit ), pos );
gtk_widget_show( texSplit );
gtk_notebook_insert_page( GTK_NOTEBOOK( g_pGroupDlg->m_pNotebook ), texSplit, w, 1 );
} else
{ {
GtkWidget* w = gtk_label_new( _( "Textures" ) );
gtk_widget_show( w );
gtk_notebook_insert_page( GTK_NOTEBOOK( g_pGroupDlg->m_pNotebook ), frame, w, 1 ); gtk_notebook_insert_page( GTK_NOTEBOOK( g_pGroupDlg->m_pNotebook ), frame, w, 1 );
} }
} }
@ -3002,18 +3036,21 @@ void MainFrame::Create(){
{ {
gint max_position; gint max_position;
g_object_get( m_pSplits[0], "max-position", &max_position, NULL ); //g_object_get( m_pSplits[0], "max-position", &max_position, NULL );
max_position = gtk_widget_get_allocated_width( m_pSplits[0] );
int x = max_position / 2 - gutter; int x = max_position / 2 - gutter;
gtk_paned_set_position( GTK_PANED( m_pSplits[0] ), x ); gtk_paned_set_position( GTK_PANED( m_pSplits[0] ), x );
} }
{ {
gint max_position; gint max_position;
g_object_get( m_pSplits[0], "max-position", &max_position, NULL ); //g_object_get( m_pSplits[0], "max-position", &max_position, NULL );
max_position = gtk_widget_get_allocated_height( m_pSplits[0] );
int y = max_position / 2 - gutter; int y = max_position / 2 - gutter;
gtk_paned_set_position( GTK_PANED( m_pSplits[1] ), y ); gtk_paned_set_position( GTK_PANED( m_pSplits[1] ), y );
gtk_paned_set_position( GTK_PANED( m_pSplits[2] ), y ); gtk_paned_set_position( GTK_PANED( m_pSplits[2] ), y );
} }
} }
if ( g_PrefsDlg.mWindowInfo.nState & GDK_WINDOW_STATE_MAXIMIZED ) { if ( g_PrefsDlg.mWindowInfo.nState & GDK_WINDOW_STATE_MAXIMIZED ) {

View File

@ -733,7 +733,7 @@ CGameDescription::CGameDescription( xmlDocPtr pDoc, const Str &GameFile ){
// on win32, game tools path can now be specified relative to the exe's cwd // on win32, game tools path can now be specified relative to the exe's cwd
prop = (char*)xmlGetProp( pNode, (xmlChar*)TOOLS_ATTRIBUTE ); prop = (char*)xmlGetProp( pNode, (xmlChar*)TOOLS_ATTRIBUTE );
if ( prop == NULL ) { if ( prop == NULL ) {
Error( "Didn't find '"TOOLS_ATTRIBUTE "' node in the game description file '%s'\n", pDoc->URL ); Error( "Didn't find '" TOOLS_ATTRIBUTE "' node in the game description file '%s'\n", pDoc->URL );
} }
{ {
char full[PATH_MAX]; char full[PATH_MAX];
@ -1882,7 +1882,7 @@ void PrefsDlg::BuildDialog(){
gtk_widget_show( label ); gtk_widget_show( label );
// adjustment // adjustment
adj = gtk_adjustment_new( 100, 50, 300, 1, 10, 10 ); adj = gtk_adjustment_new( 100, 1, 300, 1, 10, 10 );
AddDialogData( G_OBJECT( adj ), &m_nMoveSpeed, DLG_ADJ_INT ); AddDialogData( G_OBJECT( adj ), &m_nMoveSpeed, DLG_ADJ_INT );
// scale // scale
@ -3687,11 +3687,11 @@ void CGameInstall::Run() {
// - TTimo // - TTimo
fprintf( fg, "<?xml version=\"1.0\" encoding=\"iso-8859-1\" standalone=\"yes\"?>\n<game\n" ); fprintf( fg, "<?xml version=\"1.0\" encoding=\"iso-8859-1\" standalone=\"yes\"?>\n<game\n" );
fprintf( fg, " name=\"%s\"\n", m_strName.GetBuffer() ); fprintf( fg, " name=\"%s\"\n", m_strName.GetBuffer() );
fprintf( fg, " "ENGINEPATH_ATTRIBUTE "=\"%s\"\n", m_strEngine.GetBuffer() ); fprintf( fg, " " ENGINEPATH_ATTRIBUTE "=\"%s\"\n", m_strEngine.GetBuffer() );
fprintf( fg, " "TOOLS_ATTRIBUTE "=\"%sinstalls/%s/game\"\n", g_strAppPath.GetBuffer(), gamePack.GetBuffer() ); fprintf( fg, " " TOOLS_ATTRIBUTE "=\"%sinstalls/%s/game\"\n", g_strAppPath.GetBuffer(), gamePack.GetBuffer() );
if ( m_strExecutables.GetLength() > 0 ) { if ( m_strExecutables.GetLength() > 0 ) {
fprintf( fg, " "EXECUTABLES_ATTRIBUTE "=\"%s\"\n", m_strExecutables.GetBuffer() ); fprintf( fg, " " EXECUTABLES_ATTRIBUTE "=\"%s\"\n", m_strExecutables.GetBuffer() );
} }
switch ( m_availGames[ m_nComboSelect ] ) { switch ( m_availGames[ m_nComboSelect ] ) {
@ -3790,9 +3790,9 @@ void CGameInstall::Run() {
} }
case GAME_ET: { case GAME_ET: {
#ifdef _WIN32 #ifdef _WIN32
fprintf( fg, " "ENGINE_ATTRIBUTE "=\"ET.exe\"\n"); fprintf( fg, " " ENGINE_ATTRIBUTE "=\"ET.exe\"\n");
#elif __linux__ #elif __linux__
fprintf( fg, " "ENGINE_ATTRIBUTE "=\"et\"\n" ); fprintf( fg, " " ENGINE_ATTRIBUTE "=\"et\"\n" );
#endif #endif
fprintf( fg, " prefix=\".etwolf\"\n" ); fprintf( fg, " prefix=\".etwolf\"\n" );
fprintf( fg, " basegame=\"etmain\"\n" ); fprintf( fg, " basegame=\"etmain\"\n" );

View File

@ -537,169 +537,128 @@ void SurfaceDlg::BuildDialog() {
g_signal_connect( entry, "key_press_event", G_CALLBACK( OnTextureKey ), NULL ); g_signal_connect( entry, "key_press_event", G_CALLBACK( OnTextureKey ), NULL );
g_object_set_data( G_OBJECT( m_pWidget ), "texture", entry ); g_object_set_data( G_OBJECT( m_pWidget ), "texture", entry );
// table = gtk_table_new (5, 4, FALSE); table = gtk_grid_new();
table = gtk_table_new( 6, 4, FALSE ); gtk_grid_set_row_spacing( GTK_GRID( table ), 5 );
gtk_table_set_row_spacings( GTK_TABLE( table ), 5 ); gtk_grid_set_column_spacing( GTK_GRID( table ), 5 );
gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
gtk_box_pack_start( GTK_BOX( vbox ), table, FALSE, TRUE, 0 ); gtk_box_pack_start( GTK_BOX( vbox ), table, FALSE, TRUE, 0 );
gtk_widget_show( table ); gtk_widget_show( table );
label = gtk_label_new( _( "Horizontal shift" ) ); label = gtk_label_new( _( "Horizontal shift" ) );
gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1, gtk_grid_attach( GTK_GRID( table ), label, 0, 0, 1, 1 );
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_set_halign( label, GTK_ALIGN_START ); gtk_widget_set_halign( label, GTK_ALIGN_START );
gtk_widget_show( label ); gtk_widget_show( label );
spin = gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 0, -8192, 8192, 2, 8, 0 ) ), 0, 0 ); spin = gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 0, -8192, 8192, 2, 8, 0 ) ), 0, 0 );
gtk_table_attach( GTK_TABLE( table ), spin, 1, 2, 0, 1, gtk_grid_attach( GTK_GRID( table ), spin, 1, 0, 1, 1 );
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( spin ); gtk_widget_show( spin );
g_object_set_data( G_OBJECT( dlg ), "hshift", spin ); g_object_set_data( G_OBJECT( dlg ), "hshift", spin );
g_signal_connect( gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) ), "value_changed", g_signal_connect( gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) ), "value_changed",
G_CALLBACK( OnUpdate ), NULL ); G_CALLBACK( OnUpdate ), NULL );
label = gtk_label_new( _( "Step" ) ); label = gtk_label_new( _( "Step" ) );
gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 0, 1, gtk_grid_attach( GTK_GRID( table ), label, 2, 0, 1, 1 );
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_set_halign( label, GTK_ALIGN_START ); gtk_widget_set_halign( label, GTK_ALIGN_START );
gtk_widget_show( label ); gtk_widget_show( label );
entry = gtk_entry_new(); entry = gtk_entry_new();
gtk_table_attach( GTK_TABLE( table ), entry, 3, 4, 0, 1, gtk_grid_attach( GTK_GRID( table ), entry, 3, 0, 1, 1 );
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( entry ); gtk_widget_show( entry );
g_object_set_data( G_OBJECT( dlg ), "hshift_inc", entry ); g_object_set_data( G_OBJECT( dlg ), "hshift_inc", entry );
g_signal_connect( entry, "changed", g_signal_connect( entry, "changed",
G_CALLBACK( OnIncrementChanged ), NULL ); G_CALLBACK( OnIncrementChanged ), NULL );
label = gtk_label_new( _( "Vertical shift" ) ); label = gtk_label_new( _( "Vertical shift" ) );
gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 1, 2, gtk_grid_attach( GTK_GRID( table ), label, 0, 1, 1, 1 );
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_set_halign( label, GTK_ALIGN_START ); gtk_widget_set_halign( label, GTK_ALIGN_START );
gtk_widget_show( label ); gtk_widget_show( label );
spin = gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 0, -8192, 8192, 2, 8, 0 ) ), 0, 0 ); spin = gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 0, -8192, 8192, 2, 8, 0 ) ), 0, 0 );
gtk_table_attach( GTK_TABLE( table ), spin, 1, 2, 1, 2, gtk_grid_attach( GTK_GRID( table ), spin, 1, 1, 1, 1 );
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( spin ); gtk_widget_show( spin );
g_object_set_data( G_OBJECT( dlg ), "vshift", spin ); g_object_set_data( G_OBJECT( dlg ), "vshift", spin );
g_signal_connect( gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) ), "value_changed", g_signal_connect( gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) ), "value_changed",
G_CALLBACK( OnUpdate ), NULL ); G_CALLBACK( OnUpdate ), NULL );
label = gtk_label_new( _( "Step" ) ); label = gtk_label_new( _( "Step" ) );
gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 1, 2, gtk_grid_attach( GTK_GRID( table ), label, 2, 1, 1, 1 );
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_set_halign( label, GTK_ALIGN_START ); gtk_widget_set_halign( label, GTK_ALIGN_START );
gtk_widget_show( label ); gtk_widget_show( label );
entry = gtk_entry_new(); entry = gtk_entry_new();
gtk_table_attach( GTK_TABLE( table ), entry, 3, 4, 1, 2, gtk_grid_attach( GTK_GRID( table ), entry, 3, 1, 1, 1 );
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( entry ); gtk_widget_show( entry );
g_object_set_data( G_OBJECT( dlg ), "vshift_inc", entry ); g_object_set_data( G_OBJECT( dlg ), "vshift_inc", entry );
g_signal_connect( entry, "changed", g_signal_connect( entry, "changed",
G_CALLBACK( OnIncrementChanged ), NULL ); G_CALLBACK( OnIncrementChanged ), NULL );
label = gtk_label_new( _( "Horizontal stretch" ) ); label = gtk_label_new( _( "Horizontal stretch" ) );
gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 2, 3, gtk_grid_attach( GTK_GRID( table ), label, 0, 2, 1, 1 );
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_set_halign( label, GTK_ALIGN_START ); gtk_widget_set_halign( label, GTK_ALIGN_START );
gtk_widget_show( label ); gtk_widget_show( label );
spin = gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 0, -1000, 1000, 1, 10, 0 ) ), 0, 0 ); spin = gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 0, -1000, 1000, 1, 10, 0 ) ), 0, 0 );
gtk_table_attach( GTK_TABLE( table ), spin, 1, 2, 2, 3, gtk_grid_attach( GTK_GRID( table ), spin, 1, 2, 1, 1 );
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( spin ); gtk_widget_show( spin );
g_object_set_data( G_OBJECT( dlg ), "hscale", spin ); g_object_set_data( G_OBJECT( dlg ), "hscale", spin );
g_signal_connect( gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) ), "value_changed", g_signal_connect( gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) ), "value_changed",
G_CALLBACK( OnUpdate ), NULL ); G_CALLBACK( OnUpdate ), NULL );
label = gtk_label_new( _( "Step" ) ); label = gtk_label_new( _( "Step" ) );
gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 2, 3, gtk_grid_attach( GTK_GRID( table ), label, 2, 2, 1, 1 );
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 2, 3 );
gtk_widget_set_halign( label, GTK_ALIGN_START ); gtk_widget_set_halign( label, GTK_ALIGN_START );
gtk_widget_show( label ); gtk_widget_show( label );
entry = gtk_entry_new(); entry = gtk_entry_new();
gtk_table_attach( GTK_TABLE( table ), entry, 3, 4, 2, 3, gtk_grid_attach( GTK_GRID( table ), entry, 3, 2, 1, 1 );
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 2, 3 );
gtk_widget_show( entry ); gtk_widget_show( entry );
g_object_set_data( G_OBJECT( dlg ), "hscale_inc", entry ); g_object_set_data( G_OBJECT( dlg ), "hscale_inc", entry );
g_signal_connect( entry, "changed", g_signal_connect( entry, "changed",
G_CALLBACK( OnIncrementChanged ), NULL ); G_CALLBACK( OnIncrementChanged ), NULL );
label = gtk_label_new( _( "Vertical stretch" ) ); label = gtk_label_new( _( "Vertical stretch" ) );
gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 3, 4, gtk_grid_attach( GTK_GRID( table ), label, 0, 3, 1, 1 );
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_set_halign( label, GTK_ALIGN_START ); gtk_widget_set_halign( label, GTK_ALIGN_START );
gtk_widget_show( label ); gtk_widget_show( label );
spin = gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 0, -1000, 1000, 1, 10, 0 ) ), 0, 0 ); spin = gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 0, -1000, 1000, 1, 10, 0 ) ), 0, 0 );
gtk_table_attach( GTK_TABLE( table ), spin, 1, 2, 3, 4, gtk_grid_attach( GTK_GRID( table ), spin, 1, 3, 1, 1 );
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( spin ); gtk_widget_show( spin );
g_object_set_data( G_OBJECT( dlg ), "vscale", spin ); g_object_set_data( G_OBJECT( dlg ), "vscale", spin );
g_signal_connect( gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) ), "value_changed", g_signal_connect( gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) ), "value_changed",
G_CALLBACK( OnUpdate ), NULL ); G_CALLBACK( OnUpdate ), NULL );
label = gtk_label_new( _( "Step" ) ); label = gtk_label_new( _( "Step" ) );
gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 3, 4, gtk_grid_attach( GTK_GRID( table ), label, 2, 3, 1, 1 );
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_set_halign( label, GTK_ALIGN_START ); gtk_widget_set_halign( label, GTK_ALIGN_START );
gtk_widget_show( label ); gtk_widget_show( label );
entry = gtk_entry_new(); entry = gtk_entry_new();
gtk_table_attach( GTK_TABLE( table ), entry, 3, 4, 3, 4, gtk_grid_attach( GTK_GRID( table ), entry, 3, 3, 1, 1 );
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( entry ); gtk_widget_show( entry );
g_object_set_data( G_OBJECT( dlg ), "vscale_inc", entry ); g_object_set_data( G_OBJECT( dlg ), "vscale_inc", entry );
g_signal_connect( entry, "changed", g_signal_connect( entry, "changed",
G_CALLBACK( OnIncrementChanged ), NULL ); G_CALLBACK( OnIncrementChanged ), NULL );
label = gtk_label_new( _( "Rotate" ) ); label = gtk_label_new( _( "Rotate" ) );
gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 4, 5, gtk_grid_attach( GTK_GRID( table ), label, 0, 4, 1, 1 );
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_set_halign( label, GTK_ALIGN_START ); gtk_widget_set_halign( label, GTK_ALIGN_START );
gtk_widget_show( label ); gtk_widget_show( label );
spin = gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 0, -360, 360, 1, 10, 0 ) ), 1, 0 ); spin = gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 0, -360, 360, 1, 10, 0 ) ), 1, 0 );
gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( spin ), TRUE ); gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( spin ), TRUE );
gtk_table_attach( GTK_TABLE( table ), spin, 1, 2, 4, 5, gtk_grid_attach( GTK_GRID( table ), spin, 1, 4, 1, 1 );
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( spin ); gtk_widget_show( spin );
g_object_set_data( G_OBJECT( dlg ), "rotate", spin ); g_object_set_data( G_OBJECT( dlg ), "rotate", spin );
g_signal_connect( gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) ), "value_changed", g_signal_connect( gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) ), "value_changed",
G_CALLBACK( OnUpdate ), NULL ); G_CALLBACK( OnUpdate ), NULL );
label = gtk_label_new( _( "Step" ) ); label = gtk_label_new( _( "Step" ) );
gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 4, 5, gtk_grid_attach( GTK_GRID( table ), label, 2, 4, 1, 1 );
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_set_halign( label, GTK_ALIGN_START ); gtk_widget_set_halign( label, GTK_ALIGN_START );
gtk_widget_show( label ); gtk_widget_show( label );
entry = gtk_entry_new(); entry = gtk_entry_new();
gtk_table_attach( GTK_TABLE( table ), entry, 3, 4, 4, 5, gtk_grid_attach( GTK_GRID( table ), entry, 3, 4, 1, 1 );
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( entry ); gtk_widget_show( entry );
g_object_set_data( G_OBJECT( dlg ), "rotate_inc", entry ); g_object_set_data( G_OBJECT( dlg ), "rotate_inc", entry );
g_signal_connect( entry, "changed", g_signal_connect( entry, "changed",
@ -707,9 +666,7 @@ void SurfaceDlg::BuildDialog() {
// match grid button // match grid button
button = gtk_button_new_with_label( _( "Match Grid" ) ); button = gtk_button_new_with_label( _( "Match Grid" ) );
gtk_table_attach( GTK_TABLE( table ), button, 2, 4, 5, 6, gtk_grid_attach( GTK_GRID( table ), button, 3, 5, 1, 1 );
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( button ); gtk_widget_show( button );
g_signal_connect( button, "clicked", g_signal_connect( button, "clicked",
G_CALLBACK( OnBtnMatchGrid ), NULL ); G_CALLBACK( OnBtnMatchGrid ), NULL );
@ -718,53 +675,41 @@ void SurfaceDlg::BuildDialog() {
gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 ); gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 );
gtk_widget_show( frame ); gtk_widget_show( frame );
table = gtk_table_new( 4, 4, FALSE ); table = gtk_grid_new();
gtk_table_set_row_spacings( GTK_TABLE( table ), 5 ); gtk_grid_set_row_spacing( GTK_GRID( table ), 5 );
gtk_table_set_col_spacings( GTK_TABLE( table ), 5 ); gtk_grid_set_column_spacing( GTK_GRID( table ), 5 );
gtk_container_add( GTK_CONTAINER( frame ), table ); gtk_container_add( GTK_CONTAINER( frame ), table );
gtk_container_set_border_width( GTK_CONTAINER( table ), 5 ); gtk_container_set_border_width( GTK_CONTAINER( table ), 5 );
gtk_widget_show( table ); gtk_widget_show( table );
label = gtk_label_new( "Brush" ); label = gtk_label_new( "Brush" );
gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1, gtk_grid_attach( GTK_GRID( table ), label, 0, 0, 1, 1 );
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_set_halign( label, GTK_ALIGN_START ); gtk_widget_set_halign( label, GTK_ALIGN_START );
gtk_widget_show( label ); gtk_widget_show( label );
label = gtk_label_new( "Patch" ); label = gtk_label_new( "Patch" );
gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 2, 3, gtk_grid_attach( GTK_GRID( table ), label, 0, 2, 1, 1 );
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_set_halign( label, GTK_ALIGN_START ); gtk_widget_set_halign( label, GTK_ALIGN_START );
gtk_widget_show( label ); gtk_widget_show( label );
label = gtk_label_new( "Width" ); label = gtk_label_new( "Width" );
gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 0, 1, gtk_grid_attach( GTK_GRID( table ), label, 2, 0, 1, 1 );
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_set_halign( label, GTK_ALIGN_START ); gtk_widget_set_halign( label, GTK_ALIGN_START );
gtk_widget_show( label ); gtk_widget_show( label );
label = gtk_label_new( _( "Height" ) ); label = gtk_label_new( _( "Height" ) );
gtk_table_attach( GTK_TABLE( table ), label, 3, 4, 0, 1, gtk_grid_attach( GTK_GRID( table ), label, 3, 0, 1, 1 );
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_set_halign( label, GTK_ALIGN_START ); gtk_widget_set_halign( label, GTK_ALIGN_START );
gtk_widget_show( label ); gtk_widget_show( label );
axial_button = button = gtk_button_new_with_label( _( "Axial" ) ); axial_button = button = gtk_button_new_with_label( _( "Axial" ) );
gtk_table_attach( GTK_TABLE( table ), button, 0, 1, 1, 2, gtk_grid_attach( GTK_GRID( table ), button, 0, 1, 1, 1 );
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( button ); gtk_widget_show( button );
g_signal_connect( button, "clicked", g_signal_connect( button, "clicked",
G_CALLBACK( OnBtnAxial ), NULL ); G_CALLBACK( OnBtnAxial ), NULL );
fit_button = button = gtk_button_new_with_label( _( "Fit" ) ); fit_button = button = gtk_button_new_with_label( _( "Fit" ) );
gtk_table_attach( GTK_TABLE( table ), button, 1, 2, 1, 2, gtk_grid_attach( GTK_GRID( table ), button, 1, 1, 1, 1 );
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( button ); gtk_widget_show( button );
g_signal_connect( button, "clicked", g_signal_connect( button, "clicked",
G_CALLBACK( OnBtnFaceFit ), NULL ); G_CALLBACK( OnBtnFaceFit ), NULL );
@ -775,33 +720,25 @@ void SurfaceDlg::BuildDialog() {
g_object_unref( button_group ); g_object_unref( button_group );
cap_button = button = gtk_button_new_with_label( _( "CAP" ) ); cap_button = button = gtk_button_new_with_label( _( "CAP" ) );
gtk_table_attach( GTK_TABLE( table ), button, 0, 1, 3, 4, gtk_grid_attach( GTK_GRID( table ), button, 0, 3, 1, 1 );
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( button ); gtk_widget_show( button );
g_signal_connect( button, "clicked", g_signal_connect( button, "clicked",
G_CALLBACK( OnBtnPatchdetails ), NULL ); G_CALLBACK( OnBtnPatchdetails ), NULL );
set_button = button = gtk_button_new_with_label( _( "Set..." ) ); set_button = button = gtk_button_new_with_label( _( "Set..." ) );
gtk_table_attach( GTK_TABLE( table ), button, 1, 2, 3, 4, gtk_grid_attach( GTK_GRID( table ), button, 1, 3, 1, 1 );
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( button ); gtk_widget_show( button );
g_signal_connect( button, "clicked", g_signal_connect( button, "clicked",
G_CALLBACK( OnBtnPatchreset ), NULL ); G_CALLBACK( OnBtnPatchreset ), NULL );
nat_button = button = gtk_button_new_with_label( _( "Natural" ) ); nat_button = button = gtk_button_new_with_label( _( "Natural" ) );
gtk_table_attach( GTK_TABLE( table ), button, 2, 3, 3, 4, gtk_grid_attach( GTK_GRID( table ), button, 2, 3, 1, 1 );
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( button ); gtk_widget_show( button );
g_signal_connect( button, "clicked", g_signal_connect( button, "clicked",
G_CALLBACK( OnBtnPatchnatural ), NULL ); G_CALLBACK( OnBtnPatchnatural ), NULL );
fit_button = button = gtk_button_new_with_label( _( "Fit" ) ); fit_button = button = gtk_button_new_with_label( _( "Fit" ) );
gtk_table_attach( GTK_TABLE( table ), button, 3, 4, 3, 4, gtk_grid_attach( GTK_GRID( table ), button, 3, 3, 1, 1 );
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( button ); gtk_widget_show( button );
g_signal_connect( button, "clicked", g_signal_connect( button, "clicked",
G_CALLBACK( OnBtnPatchFit ), NULL ); G_CALLBACK( OnBtnPatchFit ), NULL );
@ -814,16 +751,12 @@ void SurfaceDlg::BuildDialog() {
g_object_unref( button_group ); g_object_unref( button_group );
spin = gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 1, 1, 32, 1, 10, 0 ) ), 1, 0 ); spin = gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 1, 1, 32, 1, 10, 0 ) ), 1, 0 );
gtk_table_attach( GTK_TABLE( table ), spin, 2, 3, 1, 2, gtk_grid_attach( GTK_GRID( table ), spin, 2, 1, 1, 1 );
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( spin ); gtk_widget_show( spin );
AddDialogData( spin, &m_nWidth, DLG_SPIN_INT ); AddDialogData( spin, &m_nWidth, DLG_SPIN_INT );
spin = gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 1, 1, 32, 1, 10, 0 ) ), 1, 0 ); spin = gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 1, 1, 32, 1, 10, 0 ) ), 1, 0 );
gtk_table_attach( GTK_TABLE( table ), spin, 3, 4, 1, 2, gtk_grid_attach( GTK_GRID( table ), spin, 3, 1, 1, 1 );
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( spin ); gtk_widget_show( spin );
AddDialogData( spin, &m_nHeight, DLG_SPIN_INT ); AddDialogData( spin, &m_nHeight, DLG_SPIN_INT );

View File

@ -1224,6 +1224,44 @@ void Texture_ShowStartupShaders(){
============================================================================ ============================================================================
*/ */
void Texture_GetSize( qtexture_t *tex, int & nWidth, int & nHeight ){
if( !tex )
return;
if( g_PrefsDlg.m_bFixedTextureSize && g_PrefsDlg.m_nFixedTextureSizeWidth > 0 && g_PrefsDlg.m_nFixedTextureSizeHeight > 0 )
{
nWidth = g_PrefsDlg.m_nFixedTextureSizeWidth;
nHeight = g_PrefsDlg.m_nFixedTextureSizeHeight;
float ratioWidth = nHeight / nWidth;
float ratioHeight = nWidth / nHeight;
if( tex->width * ratioWidth > tex->height * ratioHeight )
{
nHeight *= tex->height * 1.0f / tex->width * ratioWidth;
} else
if( tex->height * ratioHeight > tex->width * ratioWidth )
{
nWidth *= tex->width * 1.0f / tex->height * ratioHeight;
}
} else {
nWidth = (int)( tex->width * ( (float)g_PrefsDlg.m_nTextureScale / 100 ) );
nHeight = (int)( tex->height * ( (float)g_PrefsDlg.m_nTextureScale / 100 ) );
}
}
void Texture_GetPosSize( qtexture_t *tex, int & nWidth, int & nHeight ){
if( !tex )
return;
if( g_PrefsDlg.m_bFixedTextureSize && g_PrefsDlg.m_nFixedTextureSizeWidth > 0 && g_PrefsDlg.m_nFixedTextureSizeHeight > 0 )
{
nWidth = g_PrefsDlg.m_nFixedTextureSizeWidth;
nHeight = g_PrefsDlg.m_nFixedTextureSizeHeight;
} else {
nWidth = (int)( tex->width * ( (float)g_PrefsDlg.m_nTextureScale / 100 ) );
nHeight = (int)( tex->height * ( (float)g_PrefsDlg.m_nTextureScale / 100 ) );
}
}
void Texture_StartPos( void ){ void Texture_StartPos( void ){
//++timo TODO: check use of current_texture and current_row? //++timo TODO: check use of current_texture and current_row?
current_x = 8; current_x = 8;
@ -1290,8 +1328,9 @@ IShader* Texture_NextPos( int *x, int *y ){
continue; continue;
} }
int nWidth = (int)( q->width * ( (float)g_PrefsDlg.m_nTextureScale / 100 ) ); int nWidth;
int nHeight = (int)( q->height * ( (float)g_PrefsDlg.m_nTextureScale / 100 ) ); int nHeight;
Texture_GetPosSize( q, nWidth, nHeight );
if ( current_x + nWidth > g_qeglobals.d_texturewin.width - 8 && current_row ) { // go to the next row unless the texture is the first on the row if ( current_x + nWidth > g_qeglobals.d_texturewin.width - 8 && current_row ) { // go to the next row unless the texture is the first on the row
current_x = 8; current_x = 8;
current_y -= current_row + FONT_HEIGHT + 4; current_y -= current_row + FONT_HEIGHT + 4;
@ -1442,8 +1481,9 @@ void SelectTexture( int mx, int my, bool bShift, bool bFitScale ){
if ( !q ) { if ( !q ) {
break; break;
} }
int nWidth = (int)( q->width * ( (float)g_PrefsDlg.m_nTextureScale / 100 ) ); int nWidth;
int nHeight = (int)( q->height * ( (float)g_PrefsDlg.m_nTextureScale / 100 ) ); int nHeight;
Texture_GetPosSize( q, nWidth, nHeight );
if ( mx > x && mx - x < nWidth if ( mx > x && mx - x < nWidth
&& my < y && y - my < nHeight + FONT_HEIGHT ) { && my < y && y - my < nHeight + FONT_HEIGHT ) {
if ( bShift ) { if ( bShift ) {
@ -1613,14 +1653,8 @@ void Texture_Draw( int width, int height ){
break; break;
} }
if( g_PrefsDlg.m_bFixedTextureSize && g_PrefsDlg.m_nFixedTextureSizeWidth > 0 && g_PrefsDlg.m_nFixedTextureSizeHeight > 0 ) Texture_GetSize( q, nWidth, nHeight );
{
nWidth = g_PrefsDlg.m_nFixedTextureSizeWidth;
nHeight = g_PrefsDlg.m_nFixedTextureSizeHeight;
} else {
nWidth = (int)( q->width * ( (float)g_PrefsDlg.m_nTextureScale / 100 ) );
nHeight = (int)( q->height * ( (float)g_PrefsDlg.m_nTextureScale / 100 ) );
}
if ( y != last_y ) { if ( y != last_y ) {
last_y = y; last_y = y;
last_height = 0; last_height = 0;

View File

@ -359,6 +359,29 @@ void DrawPathLines( void ){
extern void AssignModel(); extern void AssignModel();
static const char *model_classnames[] =
{
"misc_model",
"misc_model_static",
"misc_model_breakable",
"misc_gamemodel",
"model_static",
};
static const size_t model_classnames_count = sizeof( model_classnames ) / sizeof( *model_classnames );
qboolean IsModelEntity( const char *name )
{
for ( size_t i = 0; i < model_classnames_count; i++ )
{
if ( stricmp( name, model_classnames[i] ) == 0 )
{
return qtrue;
}
}
return qfalse;
}
void CreateEntityFromName( const char* name, const vec3_t origin ){ void CreateEntityFromName( const char* name, const vec3_t origin ){
entity_t *e; entity_t *e;
brush_t* b; brush_t* b;
@ -434,7 +457,7 @@ void CreateEntityFromName( const char* name, const vec3_t origin ){
} }
Select_Brush( e->brushes.onext ); Select_Brush( e->brushes.onext );
if ( ( stricmp( name, "misc_model" ) == 0 ) || ( stricmp( name, "misc_gamemodel" ) == 0 ) || ( strcmpi( name, "model_static" ) == 0 ) ) { if ( IsModelEntity( name ) == qtrue ) {
SetInspectorMode( W_ENTITY ); SetInspectorMode( W_ENTITY );
AssignModel(); AssignModel();
} }
@ -1179,24 +1202,24 @@ void XYWnd::OnMouseMove( guint32 nFlags, int pointx, int pointy ){
update_xor_rectangle_xy( m_XORRectangle ); update_xor_rectangle_xy( m_XORRectangle );
} }
void XYWnd::OnMouseWheel( bool bUp, int pointx, int pointy ){ void XYWnd::OnMouseWheel( bool bUp, int pointx, int pointy ) {
if ( bUp ) { if ( bUp ) {
if ( g_PrefsDlg.m_bMousewheelZoom == TRUE ) { if ( g_PrefsDlg.m_bMousewheelZoom == TRUE ) {
// improved zoom-in // improved zoom-in
// frame coverges to part of window where the cursor currently resides // frame coverges to part of window where the cursor currently resides
float old_scale = m_fScale; float old_scale = m_fScale;
g_pParentWnd->OnViewZoomin(); g_pParentWnd->OnViewZoomin();
float scale_diff = 1.0 / old_scale - 1.0 / m_fScale; float scale_diff = 1.0 / old_scale - 1.0 / m_fScale;
int nDim1 = ( m_nViewType == YZ ) ? 1 : 0; int nDim1 = ( m_nViewType == YZ ) ? 1 : 0;
int nDim2 = ( m_nViewType == XY ) ? 1 : 2; int nDim2 = ( m_nViewType == XY ) ? 1 : 2;
m_vOrigin[nDim1] += scale_diff * (pointx - 0.5 * m_nWidth); m_vOrigin[nDim1] += scale_diff * (pointx - 0.5 * m_nWidth);
m_vOrigin[nDim2] -= scale_diff * (pointy - 0.5 * m_nHeight); m_vOrigin[nDim2] -= scale_diff * (pointy - 0.5 * m_nHeight);
} }
else{ else {
g_pParentWnd->OnViewZoomin(); g_pParentWnd->OnViewZoomin();
} }
} }
else{ else {
g_pParentWnd->OnViewZoomout(); g_pParentWnd->OnViewZoomout();
} }
@ -1516,16 +1539,16 @@ void XYWnd::HandleDrop(){
menu_separator( menu ); nID++; menu_separator( menu ); nID++;
// NOTE: temporary commented out until we put it back in for good (that is with actual features) // NOTE: temporary commented out until we put it back in for good (that is with actual features)
/* /*
menu_in_menu = create_menu_in_menu_with_mnemonic (menu, "Group",); menu_in_menu = create_menu_in_menu_with_mnemonic (menu, "Group",);
create_menu_item_with_mnemonic (menu_in_menu, "Add to...", create_menu_item_with_mnemonic (menu_in_menu, "Add to...",
G_CALLBACK (HandleCommand), ID_DROP_GROUP_ADDTO); G_CALLBACK (HandleCommand), ID_DROP_GROUP_ADDTO);
create_menu_item_with_mnemonic (menu_in_menu, "Remove", create_menu_item_with_mnemonic (menu_in_menu, "Remove",
G_CALLBACK (HandleCommand), ID_DROP_GROUP_REMOVE); G_CALLBACK (HandleCommand), ID_DROP_GROUP_REMOVE);
create_menu_item_with_mnemonic (menu_in_menu, "Name...", create_menu_item_with_mnemonic (menu_in_menu, "Name...",
G_CALLBACK (HandleCommand), ID_DROP_GROUP_NAME); G_CALLBACK (HandleCommand), ID_DROP_GROUP_NAME);
menu_separator (menu_in_menu); nID++; menu_separator (menu_in_menu); nID++;
create_menu_item_with_mnemonic (menu_in_menu, "New Group...", create_menu_item_with_mnemonic (menu_in_menu, "New Group...",
G_CALLBACK (HandleCommand), ID_DROP_GROUP_NEWGROUP); G_CALLBACK (HandleCommand), ID_DROP_GROUP_NEWGROUP);
*/ */
create_menu_item_with_mnemonic( menu, "Ungroup Entity", create_menu_item_with_mnemonic( menu, "Ungroup Entity",
G_CALLBACK( HandleCommand ), ID_SELECTION_UNGROUPENTITY ); G_CALLBACK( HandleCommand ), ID_SELECTION_UNGROUPENTITY );
@ -2172,16 +2195,15 @@ void XYWnd::XY_DrawGrid(){
int step, stepx, stepy, colour; int step, stepx, stepy, colour;
step = stepx = stepy = MAX( 64, (int)g_qeglobals.d_gridsize ); step = stepx = stepy = MAX( 64, (int)g_qeglobals.d_gridsize );
/* /*
int stepSize = (int)(8 / m_fScale); int stepSize = (int)(8 / m_fScale);
if (stepSize > step) if (stepSize > step)
{ {
int i; int i;
for (i = 1; i < stepSize; i <<= 1) for (i = 1; i < stepSize; i <<= 1);
; step = i;
step = i; }
} */
*/
//Sys_Printf("scale: %f\n", m_fScale); //Sys_Printf("scale: %f\n", m_fScale);
//Sys_Printf("step before: %i\n", step); //Sys_Printf("step before: %i\n", step);
@ -2309,8 +2331,9 @@ void XYWnd::XY_DrawGrid(){
// Pixels between left of label and // Pixels between left of label and
// - left of grid view window (for horizontal grid line label) or // - left of grid view window (for horizontal grid line label) or
// - drawn vertical grid line (for vertical grid line label). // - drawn vertical grid line (for vertical grid line label).
const int pixelsLeftCushion = 2; // IMPORTANT! Must be at least 1 otherwise labels might not be drawn // IMPORTANT! Must be at least 1 otherwise labels might not be drawn,
// because the origin of the text might be off screen due to rounding. // because the origin of the text might be off screen due to rounding
const int pixelsLeftCushion = 2;
// Pixels between baseline of horizontal grid line label and drawn horizontal grid line. // Pixels between baseline of horizontal grid line label and drawn horizontal grid line.
const int pixelsButtomCushion = 2; const int pixelsButtomCushion = 2;
@ -2338,9 +2361,9 @@ void XYWnd::XY_DrawGrid(){
qglColor3fv( g_qeglobals.d_savedinfo.colors[COLOR_VIEWNAME] ); qglColor3fv( g_qeglobals.d_savedinfo.colors[COLOR_VIEWNAME] );
} }
// we do this part (the old way) only if show_axis is disabled // We do this part (the old way) only if show_axis is disabled
if ( !g_qeglobals.d_savedinfo.show_axis ) { if ( !g_qeglobals.d_savedinfo.show_axis ) {
qglRasterPos2f( m_vOrigin[nDim1] - w + 35 / m_fScale, m_vOrigin[nDim2] + h - 20 / m_fScale ); qglRasterPos2f( m_vOrigin[nDim1] - w + 35 / m_fScale, m_vOrigin[nDim2] + h - 30 / m_fScale );
char cView[20]; char cView[20];
if ( m_nViewType == XY ) { if ( m_nViewType == XY ) {
@ -2350,7 +2373,7 @@ void XYWnd::XY_DrawGrid(){
if ( m_nViewType == XZ ) { if ( m_nViewType == XZ ) {
strcpy( cView, "XZ Front" ); strcpy( cView, "XZ Front" );
} }
else{ else {
strcpy( cView, "YZ Side" ); strcpy( cView, "YZ Side" );
} }
@ -2359,9 +2382,10 @@ void XYWnd::XY_DrawGrid(){
} }
if ( g_qeglobals.d_savedinfo.show_axis ) { if ( g_qeglobals.d_savedinfo.show_axis ) {
// draw two lines with corresponding axis colors to highlight current view // Draw two lines with corresponding axis colors to highlight current view
// horizontal line: nDim1 color // Horizontal line: nDim1 color
qglLineWidth( 2 ); qglLineWidth( 2 );
qglBegin( GL_LINES ); qglBegin( GL_LINES );
qglColor3fv( g_qeglobals.d_savedinfo.AxisColors[nDim1] ); qglColor3fv( g_qeglobals.d_savedinfo.AxisColors[nDim1] );
qglVertex2f( m_vOrigin[nDim1] - w + 40 / m_fScale, m_vOrigin[nDim2] + h - 45 / m_fScale ); qglVertex2f( m_vOrigin[nDim1] - w + 40 / m_fScale, m_vOrigin[nDim2] + h - 45 / m_fScale );
@ -2374,17 +2398,20 @@ void XYWnd::XY_DrawGrid(){
qglVertex2f( 0, 0 ); qglVertex2f( 0, 0 );
qglVertex2f( 0, 32 / m_fScale ); qglVertex2f( 0, 32 / m_fScale );
qglEnd(); qglEnd();
qglLineWidth( 1 ); qglLineWidth( 1 );
// now print axis symbols
// Now print axis symbols
qglColor3fv( g_qeglobals.d_savedinfo.AxisColors[nDim1] ); qglColor3fv( g_qeglobals.d_savedinfo.AxisColors[nDim1] );
qglRasterPos2f( m_vOrigin[nDim1] - w + 55 / m_fScale, m_vOrigin[nDim2] + h - 55 / m_fScale ); qglRasterPos2f( m_vOrigin[nDim1] - w + 57 / m_fScale, m_vOrigin[nDim2] + h - 60 / m_fScale );
gtk_glwidget_print_char( g_AxisName[nDim1] ); gtk_glwidget_print_char( g_AxisName[nDim1] );
qglRasterPos2f( 28 / m_fScale, -10 / m_fScale ); qglRasterPos2f( 25 / m_fScale, -15 / m_fScale );
gtk_glwidget_print_char( g_AxisName[nDim1] ); gtk_glwidget_print_char( g_AxisName[nDim1] );
qglColor3fv( g_qeglobals.d_savedinfo.AxisColors[nDim2] ); qglColor3fv( g_qeglobals.d_savedinfo.AxisColors[nDim2] );
qglRasterPos2f( m_vOrigin[nDim1] - w + 25 / m_fScale, m_vOrigin[nDim2] + h - 30 / m_fScale ); qglRasterPos2f( m_vOrigin[nDim1] - w + 30 / m_fScale, m_vOrigin[nDim2] + h - 30 / m_fScale );
gtk_glwidget_print_char( g_AxisName[nDim2] ); gtk_glwidget_print_char( g_AxisName[nDim2] );
qglRasterPos2f( -10 / m_fScale, 28 / m_fScale ); qglRasterPos2f( -10 / m_fScale, 20 / m_fScale );
gtk_glwidget_print_char( g_AxisName[nDim2] ); gtk_glwidget_print_char( g_AxisName[nDim2] );
} }
@ -2632,8 +2659,8 @@ void XYWnd::DrawZIcon( void ){
// can be greatly simplified but per usual i am in a hurry // can be greatly simplified but per usual i am in a hurry
// which is not an excuse, just a fact // which is not an excuse, just a fact
void XYWnd::PaintSizeInfo( int nDim1, int nDim2, vec3_t vMinBounds, vec3_t vMaxBounds ){ void XYWnd::PaintSizeInfo( int nDim1, int nDim2, vec3_t vMinBounds, vec3_t vMaxBounds ){
const char* g_pDimStrings[] = {"x:%.f", "y:%.f", "z:%.f"}; const char* g_pDimStrings[] = {"x: %.f", "y: %.f", "z: %.f"};
const char* g_pOrgStrings[] = {"(x:%.f y:%.f)", "(x:%.f z:%.f)", "(y:%.f z:%.f)"}; const char* g_pOrgStrings[] = {"(x: %.f, y: %.f)", "(x: %.f, z: %.f)", "(y: %.f, z: %.f)"};
CString g_strDim; CString g_strDim;
@ -2668,7 +2695,7 @@ void XYWnd::PaintSizeInfo( int nDim1, int nDim2, vec3_t vMinBounds, vec3_t vMaxB
qglEnd(); qglEnd();
qglRasterPos3f( Betwixt( vMinBounds[nDim1], vMaxBounds[nDim1] ), vMinBounds[nDim2] - 20.0 / m_fScale, 0.0f ); qglRasterPos3f( Betwixt( vMinBounds[nDim1], vMaxBounds[nDim1] ), vMinBounds[nDim2] - 25.0 / m_fScale, 0.0f );
g_strDim.Format( g_pDimStrings[nDim1], vSize[nDim1] ); g_strDim.Format( g_pDimStrings[nDim1], vSize[nDim1] );
gtk_glwidget_print_string( (char *) g_strDim.GetBuffer() ); gtk_glwidget_print_string( (char *) g_strDim.GetBuffer() );