Code

Cmake: Improve Gtkmm dependency checking, add new files to CMakeLists.txts, remove...
[inkscape.git] / src / ege-adjustment-action.cpp
index 2d303c63d6a21dfecf67711b697b1cef5759da87..1983534df49797a5be255f22c04b245096315a11 100644 (file)
@@ -228,7 +228,7 @@ static void ege_adjustment_action_init( EgeAdjustmentAction* action )
     action->private_data->focusWidget = 0;
     action->private_data->climbRate = 0.0;
     action->private_data->digits = 2;
-    action->private_data->epsilon = 0.01;
+    action->private_data->epsilon = 0.009;
     action->private_data->format = g_strdup_printf("%%0.%df%%s%%s", action->private_data->digits);
     action->private_data->selfId = 0;
     action->private_data->toolPost = 0;
@@ -348,11 +348,11 @@ void ege_adjustment_action_set_property( GObject* obj, guint propId, const GValu
             /* TODO pass on */
             action->private_data->digits = g_value_get_uint( value );
             switch ( action->private_data->digits ) {
-                case 0: action->private_data->epsilon = 1.0; break;
-                case 1: action->private_data->epsilon = 0.1; break;
-                case 2: action->private_data->epsilon = 0.01; break;
-                case 3: action->private_data->epsilon = 0.001; break;
-                case 4: action->private_data->epsilon = 0.0001; break;
+                case 0: action->private_data->epsilon = 0.9; break;
+                case 1: action->private_data->epsilon = 0.09; break;
+                case 2: action->private_data->epsilon = 0.009; break;
+                case 3: action->private_data->epsilon = 0.0009; break;
+                case 4: action->private_data->epsilon = 0.00009; break;
             }
             if ( action->private_data->format ) {
                 g_free( action->private_data->format );
@@ -453,10 +453,8 @@ void ege_adjustment_action_set_descriptions( EgeAdjustmentAction* action, gchar
         guint i = 0;
         for ( i = 0; i < count; i++ ) {
             EgeAdjustmentDescr* descr = g_new0( EgeAdjustmentDescr, 1 );
-            if ( descriptions[i] ) {
-                descr->descr = g_strdup( descriptions[i] );
-                descr->value = values[i];
-            }
+            descr->descr = descriptions[i] ? g_strdup( descriptions[i] ) : 0;
+            descr->value = values[i];
             action->private_data->descriptions = g_list_insert_sorted( action->private_data->descriptions, (gpointer)descr, egeAct_compare_descriptions );
         }
     }
@@ -540,7 +538,9 @@ static void create_single_menu_item( GCallback toggleCb, int val, GtkWidget* men
         cur = g_list_next( cur );
     }
 
-    str = g_strdup_printf( act->private_data->format, num, (marker?" ":""), (marker?marker->descr:"") );
+    str = g_strdup_printf( act->private_data->format, num, 
+                           ((marker && marker->descr) ? ": " : ""),
+                           ((marker && marker->descr) ? marker->descr : ""));
 
     *dst = gtk_radio_menu_item_new_with_label( *group, str );
     if ( !*group) {
@@ -713,9 +713,11 @@ static GtkWidget* create_tool_item( GtkAction* action )
 
         memset( &value, 0, sizeof(value) );
         g_value_init( &value, G_TYPE_STRING );
-        g_object_get_property( G_OBJECT(action), "label", &value );
+        g_object_get_property( G_OBJECT(action), "short_label", &value );
         const gchar* sss = g_value_get_string( &value );
+
         GtkWidget* lbl = gtk_label_new( sss ? sss : "wwww" );
+        GtkWidget* filler1 = gtk_label_new(" ");
 
         {
             GValue tooltip;
@@ -733,8 +735,10 @@ static GtkWidget* create_tool_item( GtkAction* action )
 
         gtk_misc_set_alignment( GTK_MISC(lbl), 1.0, 0.5 );
 
+        gtk_box_pack_start( GTK_BOX(hb), filler1, FALSE, FALSE, 0 );
         gtk_box_pack_start( GTK_BOX(hb), lbl, FALSE, FALSE, 0 );
-        gtk_box_pack_end( GTK_BOX(hb), spinbutton, FALSE, FALSE, 0 );
+        gtk_box_pack_start( GTK_BOX(hb), spinbutton, FALSE, FALSE, 0 );
+
         gtk_container_add( GTK_CONTAINER(item), hb );
 
         if ( act->private_data->selfId ) {
@@ -748,6 +752,7 @@ static GtkWidget* create_tool_item( GtkAction* action )
         g_signal_connect( G_OBJECT(spinbutton), "value-changed", G_CALLBACK(value_changed_cb), action );
 
         g_signal_connect_swapped( G_OBJECT(spinbutton), "event", G_CALLBACK(event_cb), action );
+        gtk_entry_set_width_chars( GTK_ENTRY(spinbutton), act->private_data->digits + 3 );
 
         gtk_widget_show_all( item );