Merge pull request #468 from Pan7/numfields

Turn text fields into numeric text fields only
This commit is contained in:
Timothee "TTimo" Besset 2017-04-28 07:11:48 -05:00 committed by GitHub
commit cadc00939f

View file

@ -2302,12 +2302,12 @@ void PrefsDlg::BuildDialog(){
gtk_box_pack_start( GTK_BOX( hbox2 ), label, FALSE, FALSE, 0 ); gtk_box_pack_start( GTK_BOX( hbox2 ), label, FALSE, FALSE, 0 );
gtk_widget_show( label ); gtk_widget_show( label );
// entry spin = gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 64, 0, 65535, 1, 10, 0 ) ), 1, 0 );
entry = gtk_entry_new(); gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( spin ), TRUE );
gtk_entry_set_alignment( GTK_ENTRY( entry ), 1.0 ); //right gtk_entry_set_alignment( GTK_ENTRY( spin ), 1.0 ); //right
gtk_box_pack_start( GTK_BOX( hbox2 ), entry, FALSE, FALSE, 0 ); gtk_box_pack_start( GTK_BOX( hbox2 ), spin, FALSE, FALSE, 0 );
gtk_widget_show( entry ); gtk_widget_show( spin );
AddDialogData( entry, &m_nWheelInc, DLG_ENTRY_INT ); AddDialogData( spin, &m_nWheelInc, DLG_SPIN_INT );
// Add the page to the notebook // Add the page to the notebook
gtk_notebook_append_page( GTK_NOTEBOOK( notebook ), pageframe, preflabel ); gtk_notebook_append_page( GTK_NOTEBOOK( notebook ), pageframe, preflabel );
@ -2375,20 +2375,20 @@ void PrefsDlg::BuildDialog(){
gtk_misc_set_alignment( GTK_MISC( label ), 0.0, 0.5 ); gtk_misc_set_alignment( GTK_MISC( label ), 0.0, 0.5 );
gtk_widget_show( label ); gtk_widget_show( label );
// entry spin = gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 45, 0, 65535, 1, 10, 0 ) ), 1, 0 );
entry = gtk_entry_new(); gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( spin ), TRUE );
gtk_entry_set_alignment( GTK_ENTRY( entry ), 1.0 ); //right gtk_entry_set_alignment( GTK_ENTRY( spin ), 1.0 ); //right
gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 0, 1, gtk_table_attach( GTK_TABLE( table ), spin, 1, 2, 0, 1,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( entry ); gtk_widget_show( spin );
AddDialogData( entry, &m_nRotation, DLG_ENTRY_INT ); AddDialogData( spin, &m_nRotation, DLG_SPIN_INT );
// Undo levels // Undo levels
// label // label
label = gtk_label_new( _( "Undo Levels:" ) ); label = gtk_label_new( _( "Undo Levels:" ) );
gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 1, 2, gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 1, 2,
(GtkAttachOptions) ( 0 ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_misc_set_alignment( GTK_MISC( label ), 0.0, 0.5 ); gtk_misc_set_alignment( GTK_MISC( label ), 0.0, 0.5 );
gtk_widget_show( label ); gtk_widget_show( label );
@ -2412,14 +2412,15 @@ void PrefsDlg::BuildDialog(){
gtk_misc_set_alignment( GTK_MISC( label ), 0.0, 0.5 ); gtk_misc_set_alignment( GTK_MISC( label ), 0.0, 0.5 );
gtk_widget_show( label ); gtk_widget_show( label );
// entry (spinner perhaps? [2-16]) // (spinner perhaps? [2-16])
entry = gtk_entry_new(); spin = gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 4, 0, 65535, 1, 10, 0 ) ), 1, 0 );
gtk_entry_set_alignment( GTK_ENTRY( entry ), 1.0 ); //right gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( spin ), TRUE );
gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 2, 3, gtk_entry_set_alignment( GTK_ENTRY( spin ), 1.0 ); //right
gtk_table_attach( GTK_TABLE( table ), spin, 1, 2, 2, 3,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( entry ); gtk_widget_show( spin );
AddDialogData( entry, &m_nSubdivisions, DLG_ENTRY_INT ); AddDialogData( spin, &m_nSubdivisions, DLG_SPIN_INT );
// Add the page to the notebook // Add the page to the notebook
gtk_notebook_append_page( GTK_NOTEBOOK( notebook ), pageframe, preflabel ); gtk_notebook_append_page( GTK_NOTEBOOK( notebook ), pageframe, preflabel );
@ -2510,7 +2511,7 @@ void PrefsDlg::BuildDialog(){
// label // label
label = gtk_label_new( _( "Prefab path:" ) ); label = gtk_label_new( _( "Prefab path:" ) );
gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1, gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1,
(GtkAttachOptions) ( 0 ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_misc_set_alignment( GTK_MISC( label ), 0.0, 0.5 ); gtk_misc_set_alignment( GTK_MISC( label ), 0.0, 0.5 );
gtk_widget_show( label ); gtk_widget_show( label );
@ -2590,15 +2591,14 @@ void PrefsDlg::BuildDialog(){
gtk_misc_set_alignment( GTK_MISC( label ), 0.0, 0.5 ); gtk_misc_set_alignment( GTK_MISC( label ), 0.0, 0.5 );
gtk_widget_show( label ); gtk_widget_show( label );
// scale entry spin = gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 0.5, 0, 65535, 0.1, 1, 0 ) ), 1, 1 );
entry = gtk_entry_new(); gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( spin ), TRUE );
gtk_entry_set_alignment( GTK_ENTRY( entry ), 1.0 ); //right gtk_entry_set_alignment( GTK_ENTRY( spin ), 1.0 ); //right
gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 0, 1, gtk_table_attach( GTK_TABLE( table ), spin, 1, 2, 0, 1,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( entry ); gtk_widget_show( spin );
AddDialogData( entry, &m_fDefTextureScale, DLG_ENTRY_FLOAT ); AddDialogData( spin, &m_fDefTextureScale, DLG_SPIN_FLOAT );
// caulk new brushes // caulk new brushes
check = gtk_check_button_new_with_label( _( "Always use caulk for new brushes" ) ); check = gtk_check_button_new_with_label( _( "Always use caulk for new brushes" ) );