Makes the texture layout dialog remember last used values, corrects x entry not having its value selected when showing the dialog.
This commit is contained in:
parent
847a61d888
commit
c4901d2532
|
|
@ -590,6 +590,10 @@ void DoAbout(){
|
||||||
// =============================================================================
|
// =============================================================================
|
||||||
// TextureLayout dialog
|
// TextureLayout dialog
|
||||||
|
|
||||||
|
// remembers last used texture scale values
|
||||||
|
static float last_used_texture_layout_scale_x = 4.0;
|
||||||
|
static float last_used_texture_layout_scale_y = 4.0;
|
||||||
|
|
||||||
EMessageBoxReturn DoTextureLayout( float *fx, float *fy ){
|
EMessageBoxReturn DoTextureLayout( float *fx, float *fy ){
|
||||||
ModalDialog dialog;
|
ModalDialog dialog;
|
||||||
ModalDialogButton ok_button( dialog, eIDOK );
|
ModalDialogButton ok_button( dialog, eIDOK );
|
||||||
|
|
@ -644,8 +648,6 @@ EMessageBoxReturn DoTextureLayout( float *fx, float *fy ){
|
||||||
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
|
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
|
||||||
(GtkAttachOptions) ( 0 ), 0, 0 );
|
(GtkAttachOptions) ( 0 ), 0, 0 );
|
||||||
|
|
||||||
gtk_widget_grab_focus( GTK_WIDGET( entry ) );
|
|
||||||
|
|
||||||
x = entry;
|
x = entry;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
|
|
@ -676,15 +678,25 @@ EMessageBoxReturn DoTextureLayout( float *fx, float *fy ){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize
|
// Initialize with last used values
|
||||||
gtk_entry_set_text( x, "4.0" );
|
char buf[16];
|
||||||
gtk_entry_set_text( y, "4.0" );
|
|
||||||
|
|
||||||
|
sprintf( buf, "%f", last_used_texture_layout_scale_x );
|
||||||
|
gtk_entry_set_text( x, buf );
|
||||||
|
|
||||||
|
sprintf( buf, "%f", last_used_texture_layout_scale_y );
|
||||||
|
gtk_entry_set_text( y, buf );
|
||||||
|
|
||||||
|
// Set focus
|
||||||
|
gtk_widget_grab_focus( GTK_WIDGET( x ) );
|
||||||
|
|
||||||
EMessageBoxReturn ret = modal_dialog_show( window, dialog );
|
EMessageBoxReturn ret = modal_dialog_show( window, dialog );
|
||||||
if ( ret == eIDOK ) {
|
if ( ret == eIDOK ) {
|
||||||
*fx = static_cast<float>( atof( gtk_entry_get_text( x ) ) );
|
*fx = static_cast<float>( atof( gtk_entry_get_text( x ) ) );
|
||||||
*fy = static_cast<float>( atof( gtk_entry_get_text( y ) ) );
|
*fy = static_cast<float>( atof( gtk_entry_get_text( y ) ) );
|
||||||
|
|
||||||
|
last_used_texture_layout_scale_x = *fx;
|
||||||
|
last_used_texture_layout_scale_y = *fy;
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_widget_destroy( GTK_WIDGET( window ) );
|
gtk_widget_destroy( GTK_WIDGET( window ) );
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user