GtkSpinButtons are numeric only in SI, arbitrary rotation dialog, preferences

SI: fit: fewer trailing zeros
SI: rotate: page_increment = 45 (activatable by scroll click on arrows; RMB = min/max)
This commit is contained in:
Garux 2017-10-19 21:51:22 +03:00
parent 9c415afaae
commit 5761c6006b
5 changed files with 18 additions and 8 deletions

View File

@ -394,20 +394,20 @@ void MapCoordinator(){
gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT ); // align text to the left side
gtk_table_attach_defaults( GTK_TABLE( table ), label, 0, 1, 1, 2 ); // insert label into table
spinnerMinX = gtk_spin_button_new( spinner_adj_MinX, 1.0, 0 ); // create textbox wiht value spin, value and value range
spinnerMinX = gtk_spin_button_new( spinner_adj_MinX, 1.0, 0 ); // create textbox with value spin, value and value range
gtk_table_attach_defaults( GTK_TABLE( table ), spinnerMinX, 1, 2, 1, 2 ); // insert spinbox into table
spinnerMinY = gtk_spin_button_new( spinner_adj_MinY, 1.0, 0 ); // create textbox wiht value spin, value and value range
spinnerMinY = gtk_spin_button_new( spinner_adj_MinY, 1.0, 0 ); // create textbox with value spin, value and value range
gtk_table_attach_defaults( GTK_TABLE( table ), spinnerMinY, 2, 3, 1, 2 ); // insert spinbox into table
label = gtk_label_new( "mapcoordsmaxs" ); // create label
gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT ); // align text to the left side
gtk_table_attach_defaults( GTK_TABLE( table ), label, 0, 1, 2, 3 ); // insert label into table
spinnerMaxX = gtk_spin_button_new( spinner_adj_MaxX, 1.0, 0 ); // create textbox wiht value spin, value and value range
spinnerMaxX = gtk_spin_button_new( spinner_adj_MaxX, 1.0, 0 ); // create textbox with value spin, value and value range
gtk_table_attach_defaults( GTK_TABLE( table ), spinnerMaxX, 1, 2, 2, 3 ); // insert spinbox into table
spinnerMaxY = gtk_spin_button_new( spinner_adj_MaxY, 1.0, 0 ); // create textbox wiht value spin, value and value range
spinnerMaxY = gtk_spin_button_new( spinner_adj_MaxY, 1.0, 0 ); // create textbox with value spin, value and value range
gtk_table_attach_defaults( GTK_TABLE( table ), spinnerMaxY, 2, 3, 2, 3 ); // insert spinbox into table
// put the references to the spinboxes and the worldspawn into the global exchange

View File

@ -93,6 +93,7 @@ GtkSpinButton* DialogSpinner_new( double value, double lower, double upper, int
++digits;
}
GtkSpinButton* spin = GTK_SPIN_BUTTON( gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( value, lower, upper, step, 10, 0 ) ), step, digits ) );
gtk_spin_button_set_numeric( spin, TRUE );
gtk_widget_show( GTK_WIDGET( spin ) );
gtk_widget_set_size_request( GTK_WIDGET( spin ), 64, -1 );
return spin;

View File

@ -1162,7 +1162,6 @@ void DoPatchDeformDlg(){
// }
{
GtkAdjustment* adj = GTK_ADJUSTMENT( gtk_adjustment_new( 64, -9999, 9999, 1, 10, 0 ) );
//GtkSpinButton* spin = GTK_SPIN_BUTTON( gtk_spin_button_new( adj, 1, 0 ) );
GtkWidget* spin = gtk_spin_button_new( adj, 1, 0 );
gtk_widget_show( spin );
gtk_table_attach( table, spin, 1, 2, 0, 1,

View File

@ -1272,6 +1272,7 @@ void DoRotateDlg(){
{
GtkAdjustment* adj = GTK_ADJUSTMENT( gtk_adjustment_new( 0, -359, 359, 1, 10, 0 ) );
GtkSpinButton* spin = GTK_SPIN_BUTTON( gtk_spin_button_new( adj, 1, 1 ) );
gtk_spin_button_set_numeric( spin, TRUE );
gtk_widget_show( GTK_WIDGET( spin ) );
gtk_table_attach( table, GTK_WIDGET( spin ), 1, 2, 0, 1,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
@ -1286,6 +1287,7 @@ void DoRotateDlg(){
{
GtkAdjustment* adj = GTK_ADJUSTMENT( gtk_adjustment_new( 0, -359, 359, 1, 10, 0 ) );
GtkSpinButton* spin = GTK_SPIN_BUTTON( gtk_spin_button_new( adj, 1, 1 ) );
gtk_spin_button_set_numeric( spin, TRUE );
gtk_widget_show( GTK_WIDGET( spin ) );
gtk_table_attach( table, GTK_WIDGET( spin ), 1, 2, 1, 2,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
@ -1298,6 +1300,7 @@ void DoRotateDlg(){
{
GtkAdjustment* adj = GTK_ADJUSTMENT( gtk_adjustment_new( 0, -359, 359, 1, 10, 0 ) );
GtkSpinButton* spin = GTK_SPIN_BUTTON( gtk_spin_button_new( adj, 1, 1 ) );
gtk_spin_button_set_numeric( spin, TRUE );
gtk_widget_show( GTK_WIDGET( spin ) );
gtk_table_attach( table, GTK_WIDGET( spin ), 1, 2, 2, 3,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),

View File

@ -722,6 +722,7 @@ GtkWindow* SurfaceInspector::BuildDialog(){
GtkSpinButton* spin = GTK_SPIN_BUTTON( gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 0, -8192, 8192, 2, 8, 0 ) ), 0, 2 ) );
m_hshiftIncrement.m_spin = spin;
m_hshiftSpinner.connect( spin );
gtk_spin_button_set_numeric( spin, TRUE );
gtk_widget_show( GTK_WIDGET( spin ) );
gtk_table_attach( GTK_TABLE( table ), GTK_WIDGET( spin ), 1, 2, 0, 1,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
@ -758,6 +759,7 @@ GtkWindow* SurfaceInspector::BuildDialog(){
GtkSpinButton* spin = GTK_SPIN_BUTTON( gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 0, -8192, 8192, 2, 8, 0 ) ), 0, 2 ) );
m_vshiftIncrement.m_spin = spin;
m_vshiftSpinner.connect( spin );
gtk_spin_button_set_numeric( spin, TRUE );
gtk_widget_show( GTK_WIDGET( spin ) );
gtk_table_attach( GTK_TABLE( table ), GTK_WIDGET( spin ), 1, 2, 1, 2,
(GtkAttachOptions) ( GTK_FILL ),
@ -794,6 +796,7 @@ GtkWindow* SurfaceInspector::BuildDialog(){
GtkSpinButton* spin = GTK_SPIN_BUTTON( gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 0, -8192, 8192, 2, 8, 0 ) ), 0, 5 ) );
m_hscaleIncrement.m_spin = spin;
m_hscaleSpinner.connect( spin );
gtk_spin_button_set_numeric( spin, TRUE );
gtk_widget_show( GTK_WIDGET( spin ) );
gtk_table_attach( GTK_TABLE( table ), GTK_WIDGET( spin ), 1, 2, 2, 3,
(GtkAttachOptions) ( GTK_FILL ),
@ -830,6 +833,7 @@ GtkWindow* SurfaceInspector::BuildDialog(){
GtkSpinButton* spin = GTK_SPIN_BUTTON( gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 0, -8192, 8192, 2, 8, 0 ) ), 0, 5 ) );
m_vscaleIncrement.m_spin = spin;
m_vscaleSpinner.connect( spin );
gtk_spin_button_set_numeric( spin, TRUE );
gtk_widget_show( GTK_WIDGET( spin ) );
gtk_table_attach( GTK_TABLE( table ), GTK_WIDGET( spin ), 1, 2, 3, 4,
(GtkAttachOptions) ( GTK_FILL ),
@ -863,9 +867,10 @@ GtkWindow* SurfaceInspector::BuildDialog(){
(GtkAttachOptions) ( 0 ), 0, 0 );
}
{
GtkSpinButton* spin = GTK_SPIN_BUTTON( gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 0, -8192, 8192, 2, 8, 0 ) ), 0, 2 ) );
GtkSpinButton* spin = GTK_SPIN_BUTTON( gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 0, -8192, 8192, 2, 45, 0 ) ), 0, 2 ) );
m_rotateIncrement.m_spin = spin;
m_rotateSpinner.connect( spin );
gtk_spin_button_set_numeric( spin, TRUE );
gtk_widget_show( GTK_WIDGET( spin ) );
gtk_table_attach( GTK_TABLE( table ), GTK_WIDGET( spin ), 1, 2, 4, 5,
(GtkAttachOptions) ( GTK_FILL ),
@ -1040,7 +1045,8 @@ GtkWindow* SurfaceInspector::BuildDialog(){
gtk_widget_set_usize( button, 60, -2 );
}
{
GtkWidget* spin = gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 1, 0, 1 << 16, 1, 10, 0 ) ), 0, 6 );
GtkWidget* spin = gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 1, 0, 1 << 16, 1, 10, 0 ) ), 0, 2 );
gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( spin ), TRUE );
gtk_widget_show( spin );
gtk_table_attach( GTK_TABLE( table ), spin, 2, 3, 1, 2,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
@ -1049,7 +1055,8 @@ GtkWindow* SurfaceInspector::BuildDialog(){
AddDialogData( *GTK_SPIN_BUTTON( spin ), m_fitHorizontal );
}
{
GtkWidget* spin = gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 1, 0, 1 << 16, 1, 10, 0 ) ), 0, 6 );
GtkWidget* spin = gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 1, 0, 1 << 16, 1, 10, 0 ) ), 0, 2 );
gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( spin ), TRUE );
gtk_widget_show( spin );
gtk_table_attach( GTK_TABLE( table ), spin, 3, 4, 1, 2,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),