index 4fa2d6044f87c95e1488b754e7de03fa7df01c59..ed9259aef9b93d340e37f0124c0f5b859dbe2733 100644 (file)
--- a/src/widgets/toolbox.cpp
+++ b/src/widgets/toolbox.cpp
free (sample_escaped);
}
+static void delete_completion(GObject *obj, GtkWidget *entry) {
+ GObject *completion = (GObject *) gtk_object_get_data(GTK_OBJECT(entry), "completion");
+ if (completion) {
+ gtk_entry_set_completion (GTK_ENTRY(entry), NULL);
+ g_object_unref (completion);
+ }
+}
+
GtkWidget*
sp_text_toolbox_new (SPDesktop *desktop)
{
gtk_entry_completion_set_minimum_key_length (completion, 1);
g_object_set (G_OBJECT(completion), "inline-completion", TRUE, "popup-completion", TRUE, NULL);
gtk_entry_set_completion (GTK_ENTRY(entry), completion);
+ gtk_object_set_data(GTK_OBJECT(entry), "completion", completion);
aux_toolbox_space (tbl, 1);
gtk_box_pack_start (GTK_BOX (tbl), entry, FALSE, FALSE, 0);
+ g_signal_connect(G_OBJECT(tbl), "destroy", G_CALLBACK(delete_completion), entry);
//Button
GtkWidget *button = gtk_button_new ();
{
if (!SP_ACTIVE_DESKTOP) return;
- // see comment in ActionAlign above
+ // hack for clones, see comment in align-and-distribute.cpp
int saved_compensation = prefs_get_int_attribute("options.clonecompensation", "value", SP_CLONE_COMPENSATION_UNMOVED);
prefs_set_int_attribute("options.clonecompensation", "value", SP_CLONE_COMPENSATION_UNMOVED);
- graphlayout(sp_desktop_selection(SP_ACTIVE_DESKTOP)->itemList(),
- prefs_get_double_attribute("tools.connector","length",100));
+ graphlayout(sp_desktop_selection(SP_ACTIVE_DESKTOP)->itemList());
- // restore compensation setting
prefs_set_int_attribute("options.clonecompensation", "value", saved_compensation);
sp_document_done(sp_desktop_document(SP_ACTIVE_DESKTOP), SP_VERB_DIALOG_ALIGN_DISTRIBUTE, /* TODO: annotate */ "toolbox.cpp:129");
}
+static void
+sp_directed_graph_layout_toggled(GtkWidget *widget, GtkObject *tbl)
+{
+ if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) {
+ prefs_set_string_attribute("tools.connector", "directedlayout",
+ "true");
+ } else {
+ prefs_set_string_attribute("tools.connector", "directedlayout",
+ "false");
+ }
+}
+static void
+sp_nooverlaps_graph_layout_toggled(GtkWidget *widget, GtkObject *tbl)
+{
+ if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) {
+ prefs_set_string_attribute("tools.connector", "avoidoverlaplayout",
+ "true");
+ } else {
+ prefs_set_string_attribute("tools.connector", "avoidoverlaplayout",
+ "false");
+ }
+}
+
+
static void connector_length_changed(GtkAdjustment *adj, GtkWidget *tbl)
{
prefs_set_double_attribute("tools.connector", "length", adj->value);
gtk_box_pack_start(GTK_BOX(tbl), connector_length, FALSE, FALSE,
AUX_SPACING);
}
+ gchar const *tbuttonstate;
+ // Directed edges toggle button
+ {
+ GtkWidget *tbutton = gtk_toggle_button_new ();
+ gtk_button_set_relief (GTK_BUTTON (tbutton), GTK_RELIEF_NONE);
+ gtk_container_add (GTK_CONTAINER (tbutton), sp_icon_new (Inkscape::ICON_SIZE_SMALL_TOOLBAR, "directed_graph"));
+ gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (tbutton), FALSE);
+ gtk_tooltips_set_tip(tt, tbutton, _("Make connectors with end-markers (arrows) point downwards"), NULL);
+
+ gtk_box_pack_start (GTK_BOX (tbl), tbutton, FALSE, FALSE, 0);
+ g_signal_connect(G_OBJECT(tbutton), "toggled", GTK_SIGNAL_FUNC(sp_directed_graph_layout_toggled), tbl);
+ tbuttonstate = prefs_get_string_attribute("tools.connector", "directedlayout");
+ gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(tbutton),
+ (tbuttonstate && !strcmp(tbuttonstate, "true"))?TRUE:FALSE );
+ }
+ // Avoid overlaps toggle button
+ {
+ GtkWidget *tbutton = gtk_toggle_button_new ();
+ gtk_button_set_relief (GTK_BUTTON (tbutton), GTK_RELIEF_NONE);
+ gtk_container_add (GTK_CONTAINER (tbutton), sp_icon_new (Inkscape::ICON_SIZE_SMALL_TOOLBAR, "remove_overlaps"));
+ gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (tbutton), FALSE);
+ gtk_tooltips_set_tip(tt, tbutton, _("Do not allow overlapping shapes"), NULL);
+
+ gtk_box_pack_start (GTK_BOX (tbl), tbutton, FALSE, FALSE, 0);
+ g_signal_connect(G_OBJECT(tbutton), "toggled", GTK_SIGNAL_FUNC(sp_nooverlaps_graph_layout_toggled), tbl);
+ tbuttonstate = prefs_get_string_attribute("tools.connector", "avoidoverlaplayout");
+ gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(tbutton),
+ (tbuttonstate && !strcmp(tbuttonstate, "true"))?TRUE:FALSE );
+ }
gtk_widget_show_all(tbl);
sp_set_font_size_smaller (tbl);