index fcf43728801013084ad7a27f8bcaf9b9bd7d8b24..fcf3e0ce6bd874917ee2b0730179a33b326adf6e 100644 (file)
--- a/src/widgets/toolbox.cpp
+++ b/src/widgets/toolbox.cpp
#include "widgets/spw-utilities.h"
#include "widgets/spinbutton-events.h"
#include "dialogs/text-edit.h"
+#include "dialogs/dialog-events.h"
#include "ui/widget/style-swatch.h"
" <toolitem action='StrokeToPath' />"
" <separator />"
" <toolitem action='NodesShowHandlesAction' />"
+ " <toolitem action='NodesShowHelperpath' />"
" <separator />"
" <toolitem action='EditNextLPEParameterAction' />"
" <separator />"
@@ -506,7 +508,7 @@ static GtkAction* create_action_for_verb( Inkscape::Verb* verb, Inkscape::UI::Vi
GtkAction* act = 0;
SPAction* targetAction = verb->get_action(view);
- InkAction* inky = ink_action_new( verb->get_id(), verb->get_name(), verb->get_tip(), verb->get_image(), size );
+ InkAction* inky = ink_action_new( verb->get_id(), _(verb->get_name()), verb->get_tip(), verb->get_image(), size );
act = GTK_ACTION(inky);
gtk_action_set_sensitive( act, targetAction->sensitive );
if (shape_editor) shape_editor->show_handles(show);
}
+static void toggle_show_helperpath (GtkToggleAction *act, gpointer /*data*/) {
+ bool show = gtk_toggle_action_get_active( act );
+ prefs_set_int_attribute ("tools.nodes", "show_helperpath", show ? 1 : 0);
+ ShapeEditor *shape_editor = get_current_shape_editor();
+ if (shape_editor) shape_editor->show_helperpath(show);
+}
+
void sp_node_path_edit_nextLPEparam (GtkAction */*act*/, gpointer data) {
sp_selection_next_patheffect_param( reinterpret_cast<SPDesktop*>(data) );
}
@@ -1094,6 +1103,17 @@ static void sp_node_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions
gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(act), prefs_get_int_attribute( "tools.nodes", "show_handles", 1 ) );
}
+ {
+ InkToggleAction* act = ink_toggle_action_new( "NodesShowHelperpath",
+ _("Show Outline"),
+ _("Show the outline of the path"),
+ "nodes_show_helperpath",
+ Inkscape::ICON_SIZE_DECORATION );
+ gtk_action_group_add_action( mainActions, GTK_ACTION( act ) );
+ g_signal_connect_after( G_OBJECT(act), "toggled", G_CALLBACK(toggle_show_helperpath), desktop );
+ gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(act), prefs_get_int_attribute( "tools.nodes", "show_helperpath", 0 ) );
+ }
+
{
InkAction* inky = ink_action_new( "EditNextLPEParameterAction",
_("Next Path Effect Parameter"),
namespace {
-bool visible = false;
+bool popdown_visible = false;
+bool popdown_hasfocus = false;
void
sp_text_toolbox_selection_changed (Inkscape::Selection */*selection*/, GObject *tbl)
{
SPDesktop *desktop = SP_ACTIVE_DESKTOP;
GtkTreeModel *model = 0;
- GtkWidget *popdown = GTK_WIDGET (g_object_get_data (tbl, "family-popdown-window"));
GtkWidget *entry = GTK_WIDGET (g_object_get_data (tbl, "family-entry"));
GtkTreeIter iter;
char *family = 0;
- (void)popdown;
-
gdk_pointer_ungrab (GDK_CURRENT_TIME);
gdk_keyboard_ungrab (GDK_CURRENT_TIME);
int result_fontspec =
sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_FONT_SPECIFICATION);
-
+
font_instance * fontFromStyle = font_factory::Default()->FaceFromStyle(query);
SPCSSAttr *css = sp_repr_css_attr_new ();
// First try to get the font spec from the stored value
Glib::ustring fontSpec = query->text->font_specification.set ? query->text->font_specification.value : "";
-
+
if (fontSpec.empty()) {
// Construct a new font specification if it does not yet exist
font_instance * fontFromStyle = font_factory::Default()->FaceFromStyle(query);
}
}
- // If querying returned nothing, read the style from the text tool prefs (default style for new texts)
+ // If querying returned nothing, set the default style of the tool (for new texts)
if (result_fontspec == QUERY_STYLE_NOTHING)
{
sp_repr_css_change (inkscape_get_repr (INKSCAPE, "tools.text"), css, "style");
@@ -4485,10 +4503,19 @@ sp_text_toolbox_family_list_keypress (GtkWidget *w, GdkEventKey *event, GObject
case GDK_Return:
case GDK_Escape: // defocus
gtk_widget_hide (w);
- visible = false;
+ popdown_visible = false;
gtk_widget_grab_focus (GTK_WIDGET(desktop->canvas));
return TRUE; // I consumed the event
break;
+ case GDK_w:
+ case GDK_W:
+ if (event->state & GDK_CONTROL_MASK) {
+ gtk_widget_hide (w);
+ popdown_visible = false;
+ gtk_widget_grab_focus (GTK_WIDGET(desktop->canvas));
+ return TRUE; // I consumed the event
+ }
+ break;
}
return FALSE;
}
GtkWidget *widget = GTK_WIDGET (g_object_get_data (tbl, "family-entry"));
int x, y;
- if (!visible)
+ if (!popdown_visible)
{
gdk_window_get_origin (widget->window, &x, &y);
gtk_window_move (GTK_WINDOW (popdown), x, y + widget->allocation.height + 2); //2px of grace space
gtk_widget_show_all (popdown);
+ //sp_transientize (popdown);
gdk_pointer_grab (widget->window, TRUE,
GdkEventMask (GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
gdk_keyboard_grab (widget->window, TRUE, GDK_CURRENT_TIME);
- visible = true;
+ popdown_visible = true;
}
else
{
+ SPDesktop *desktop = SP_ACTIVE_DESKTOP;
gdk_pointer_ungrab (GDK_CURRENT_TIME);
gdk_keyboard_ungrab (GDK_CURRENT_TIME);
+ gtk_widget_grab_focus (GTK_WIDGET(desktop->canvas));
gtk_widget_hide (popdown);
- visible = false;
+ popdown_visible = false;
}
}
{
SPDesktop *desktop = SP_ACTIVE_DESKTOP;
- gtk_widget_hide (popdown);
- visible = false;
- gtk_widget_grab_focus (GTK_WIDGET(desktop->canvas));
+ if (popdown_hasfocus) {
+ gtk_widget_hide (popdown);
+ popdown_hasfocus = false;
+ popdown_visible = false;
+ gtk_widget_grab_focus (GTK_WIDGET(desktop->canvas));
+ return TRUE;
+ }
+ return FALSE;
+}
+
+gboolean
+sp_text_toolbox_popdown_focus_in (GtkWidget *popdown,
+ GdkEventFocus */*event*/,
+ GObject */*tbl*/)
+{
+ popdown_hasfocus = true;
return TRUE;
}
+
void
cell_data_func (GtkTreeViewColumn */*column*/,
GtkCellRenderer *cell,
g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (sp_text_toolbox_text_popdown_clicked), tbl);
g_signal_connect (G_OBJECT (window), "focus-out-event", G_CALLBACK (sp_text_toolbox_popdown_focus_out), tbl);
+ g_signal_connect (G_OBJECT (window), "focus-in-event", G_CALLBACK (sp_text_toolbox_popdown_focus_in), tbl);
g_signal_connect (G_OBJECT (window), "key-press-event", G_CALLBACK(sp_text_toolbox_family_list_keypress), tbl);
GtkTreeSelection *tselection = gtk_tree_view_get_selection (GTK_TREE_VIEW (treeview));
@@ -5280,7 +5325,9 @@ static void sp_paintbucket_toolbox_prep(SPDesktop *desktop, GtkActionGroup* main
// Create the units menu.
UnitTracker* tracker = new UnitTracker( SP_UNIT_ABSOLUTE | SP_UNIT_DEVICE );
- tracker->setActiveUnit(sp_unit_get_by_abbreviation(prefs_get_string_attribute("tools.paintbucket", "offsetunits")));
+ const gchar *stored_unit = prefs_get_string_attribute("tools.paintbucket", "offsetunits");
+ if (stored_unit)
+ tracker->setActiveUnit(sp_unit_get_by_abbreviation(stored_unit));
g_object_set_data( holder, "tracker", tracker );
{
GtkAction* act = tracker->createAction( "PaintbucketUnitsAction", _("Units"), ("") );