diff options
Diffstat (limited to 'src/dialogs/clonetiler.cpp')
| -rw-r--r-- | src/dialogs/clonetiler.cpp | 80 |
1 files changed, 44 insertions, 36 deletions
diff --git a/src/dialogs/clonetiler.cpp b/src/dialogs/clonetiler.cpp index b9e490dcf..f8553f2aa 100644 --- a/src/dialogs/clonetiler.cpp +++ b/src/dialogs/clonetiler.cpp @@ -1557,10 +1557,10 @@ static GtkWidget * clonetiler_spinbox(const char *tip, const char *attr, double return hb; } -static void clonetiler_symgroup_changed(GtkMenuItem */*item*/, gpointer data) +static void clonetiler_symgroup_changed(GtkComboBox *cb, gpointer /*data*/) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - gint group_new = GPOINTER_TO_INT (data); + gint group_new = gtk_combo_box_get_active (cb); prefs->setInt(prefs_path + "symmetrygroup", group_new); } @@ -1589,21 +1589,21 @@ static void clonetiler_reset_recursive(GtkWidget *w) { if (w && GTK_IS_OBJECT(w)) { { - int r = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT(w), "zeroable")); + int r = GPOINTER_TO_INT (g_object_get_data(G_OBJECT(w), "zeroable")); if (r && GTK_IS_SPIN_BUTTON(w)) { // spinbutton GtkAdjustment *a = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON(w)); gtk_adjustment_set_value (a, 0); } } { - int r = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT(w), "oneable")); + int r = GPOINTER_TO_INT (g_object_get_data(G_OBJECT(w), "oneable")); if (r && GTK_IS_SPIN_BUTTON(w)) { // spinbutton GtkAdjustment *a = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON(w)); gtk_adjustment_set_value (a, 1); } } { - int r = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT(w), "uncheckable")); + int r = GPOINTER_TO_INT (g_object_get_data(G_OBJECT(w), "uncheckable")); if (r && GTK_IS_TOGGLE_BUTTON(w)) { // checkbox gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(w), FALSE); } @@ -1812,21 +1812,14 @@ void clonetiler_dialog(void) // Symmetry { GtkWidget *vb = clonetiler_new_tab (nb, _("_Symmetry")); - - GtkWidget *om = gtk_option_menu_new (); - /* TRANSLATORS: For the following 17 symmetry groups, see + + /* TRANSLATORS: For the following 17 symmetry groups, see * http://www.bib.ulb.ac.be/coursmath/doc/17.htm (visual examples); * http://www.clarku.edu/~djoyce/wallpaper/seventeen.html (English vocabulary); or * http://membres.lycos.fr/villemingerard/Geometri/Sym1D.htm (French vocabulary). */ - gtk_widget_set_tooltip_text (om, _("Select one of the 17 symmetry groups for the tiling")); - gtk_box_pack_start (GTK_BOX (vb), om, FALSE, FALSE, SB_MARGIN); - - GtkWidget *m = gtk_menu_new (); - int current = prefs->getInt(prefs_path + "symmetrygroup", 0); - struct SymGroups { - int group; + gint group; gchar const *label; } const sym_groups[] = { // TRANSLATORS: "translation" means "shift" / "displacement" here. @@ -1851,25 +1844,40 @@ void clonetiler_dialog(void) {TILE_P6M, _("<b>P6M</b>: reflection + 60° rotation")}, }; - for (unsigned j = 0; j < G_N_ELEMENTS(sym_groups); ++j) { + gint current = prefs->getInt(prefs_path + "symmetrygroup", 0); + + // Create a list structure containing all the data to be displayed in + // the symmetry group combo box. + GtkListStore *store = gtk_list_store_new (1, G_TYPE_STRING); + GtkTreeIter iter; + + for (unsigned j = 0; j < G_N_ELEMENTS(sym_groups); ++j) { SymGroups const &sg = sym_groups[j]; - GtkWidget *l = gtk_label_new (""); - gtk_label_set_markup (GTK_LABEL(l), sg.label); - gtk_misc_set_alignment (GTK_MISC(l), 0, 0.5); + // Add the description of the symgroup to a new row + gtk_list_store_append (store, &iter); + gtk_list_store_set (store, &iter, + 0, sg.label, + -1); + } - GtkWidget *item = gtk_menu_item_new (); - gtk_container_add (GTK_CONTAINER (item), l); + // Add a new combo box widget with the list of symmetry groups to the vbox + GtkWidget *combo = gtk_combo_box_new_with_model (GTK_TREE_MODEL (store)); + gtk_widget_set_tooltip_text (combo, _("Select one of the 17 symmetry groups for the tiling")); + gtk_box_pack_start (GTK_BOX (vb), combo, FALSE, FALSE, SB_MARGIN); - g_signal_connect ( G_OBJECT (item), "activate", - G_CALLBACK (clonetiler_symgroup_changed), - GINT_TO_POINTER (sg.group) ); + // Specify the rendering of data from the list in a combo box cell + GtkCellRenderer *renderer = gtk_cell_renderer_text_new (); + gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), renderer, FALSE); + gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo), renderer, + "markup", 0, + NULL); - gtk_menu_append (GTK_MENU (m), item); - } + gtk_combo_box_set_active (GTK_COMBO_BOX (combo), current); - gtk_option_menu_set_menu (GTK_OPTION_MENU (om), m); - gtk_option_menu_set_history ( GTK_OPTION_MENU (om), current); + g_signal_connect (G_OBJECT (combo), "changed", + G_CALLBACK (clonetiler_symgroup_changed), + NULL); } table_row_labels = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); @@ -2515,7 +2523,7 @@ void clonetiler_dialog(void) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), prefs->getInt(prefs_path + "pick", 0) == PICK_COLOR); } { - radio = gtk_radio_button_new_with_label (gtk_radio_button_group (GTK_RADIO_BUTTON (radio)), _("Opacity")); + radio = gtk_radio_button_new_with_label (gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio)), _("Opacity")); gtk_widget_set_tooltip_text (radio, _("Pick the total accumulated opacity")); clonetiler_table_attach (table, radio, 0.0, 2, 1); g_signal_connect (G_OBJECT (radio), "toggled", @@ -2523,7 +2531,7 @@ void clonetiler_dialog(void) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), prefs->getInt(prefs_path + "pick", 0) == PICK_OPACITY); } { - radio = gtk_radio_button_new_with_label (gtk_radio_button_group (GTK_RADIO_BUTTON (radio)), _("R")); + radio = gtk_radio_button_new_with_label (gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio)), _("R")); gtk_widget_set_tooltip_text (radio, _("Pick the Red component of the color")); clonetiler_table_attach (table, radio, 0.0, 1, 2); g_signal_connect (G_OBJECT (radio), "toggled", @@ -2531,7 +2539,7 @@ void clonetiler_dialog(void) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), prefs->getInt(prefs_path + "pick", 0) == PICK_R); } { - radio = gtk_radio_button_new_with_label (gtk_radio_button_group (GTK_RADIO_BUTTON (radio)), _("G")); + radio = gtk_radio_button_new_with_label (gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio)), _("G")); gtk_widget_set_tooltip_text (radio, _("Pick the Green component of the color")); clonetiler_table_attach (table, radio, 0.0, 2, 2); g_signal_connect (G_OBJECT (radio), "toggled", @@ -2539,7 +2547,7 @@ void clonetiler_dialog(void) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), prefs->getInt(prefs_path + "pick", 0) == PICK_G); } { - radio = gtk_radio_button_new_with_label (gtk_radio_button_group (GTK_RADIO_BUTTON (radio)), _("B")); + radio = gtk_radio_button_new_with_label (gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio)), _("B")); gtk_widget_set_tooltip_text (radio, _("Pick the Blue component of the color")); clonetiler_table_attach (table, radio, 0.0, 3, 2); g_signal_connect (G_OBJECT (radio), "toggled", @@ -2547,7 +2555,7 @@ void clonetiler_dialog(void) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), prefs->getInt(prefs_path + "pick", 0) == PICK_B); } { - radio = gtk_radio_button_new_with_label (gtk_radio_button_group (GTK_RADIO_BUTTON (radio)), C_("Clonetiler color hue", "H")); + radio = gtk_radio_button_new_with_label (gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio)), C_("Clonetiler color hue", "H")); gtk_widget_set_tooltip_text (radio, _("Pick the hue of the color")); clonetiler_table_attach (table, radio, 0.0, 1, 3); g_signal_connect (G_OBJECT (radio), "toggled", @@ -2555,7 +2563,7 @@ void clonetiler_dialog(void) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), prefs->getInt(prefs_path + "pick", 0) == PICK_H); } { - radio = gtk_radio_button_new_with_label (gtk_radio_button_group (GTK_RADIO_BUTTON (radio)), C_("Clonetiler color saturation", "S")); + radio = gtk_radio_button_new_with_label (gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio)), C_("Clonetiler color saturation", "S")); gtk_widget_set_tooltip_text (radio, _("Pick the saturation of the color")); clonetiler_table_attach (table, radio, 0.0, 2, 3); g_signal_connect (G_OBJECT (radio), "toggled", @@ -2563,7 +2571,7 @@ void clonetiler_dialog(void) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), prefs->getInt(prefs_path + "pick", 0) == PICK_S); } { - radio = gtk_radio_button_new_with_label (gtk_radio_button_group (GTK_RADIO_BUTTON (radio)), C_("Clonetiler color lightness", "L")); + radio = gtk_radio_button_new_with_label (gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio)), C_("Clonetiler color lightness", "L")); gtk_widget_set_tooltip_text (radio, _("Pick the lightness of the color")); clonetiler_table_attach (table, radio, 0.0, 3, 3); g_signal_connect (G_OBJECT (radio), "toggled", @@ -2786,7 +2794,7 @@ void clonetiler_dialog(void) gtk_toggle_button_toggled (GTK_TOGGLE_BUTTON (radio)); } { - radio = gtk_radio_button_new_with_label (gtk_radio_button_group (GTK_RADIO_BUTTON (radio)), _("Width, height: ")); + radio = gtk_radio_button_new_with_label (gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio)), _("Width, height: ")); gtk_widget_set_tooltip_text (radio, _("Fill the specified width and height with the tiling")); clonetiler_table_attach (table, radio, 0.0, 2, 1); g_signal_connect (G_OBJECT (radio), "toggled", G_CALLBACK (clonetiler_switch_to_fill), (gpointer) dlg); |
