From 498629f82d9453cb7222ab642b867c183fdf1666 Mon Sep 17 00:00:00 2001 From: Krzysztof Kosi??ski Date: Thu, 5 Aug 2010 01:56:47 +0200 Subject: Wholesale cruft removal part 3 (bzr r9508.1.47) --- src/interface.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/interface.cpp') diff --git a/src/interface.cpp b/src/interface.cpp index 47563238a..085eca6bd 100644 --- a/src/interface.cpp +++ b/src/interface.cpp @@ -1318,7 +1318,7 @@ sp_ui_drag_data_received(GtkWidget *widget, ( !SP_OBJECT_STYLE(item)->stroke.isNone() ? desktop->current_zoom() * SP_OBJECT_STYLE (item)->stroke_width.computed * - to_2geom(sp_item_i2d_affine(item)).descrim() * 0.5 + sp_item_i2d_affine(item).descrim() * 0.5 : 0.0) + prefs->getIntLimited("/options/dragtolerance/value", 0, 0, 100); @@ -1421,7 +1421,7 @@ sp_ui_drag_data_received(GtkWidget *widget, ( !SP_OBJECT_STYLE(item)->stroke.isNone() ? desktop->current_zoom() * SP_OBJECT_STYLE (item)->stroke_width.computed * - to_2geom(sp_item_i2d_affine(item)).descrim() * 0.5 + sp_item_i2d_affine(item).descrim() * 0.5 : 0.0) + prefs->getIntLimited("/options/dragtolerance/value", 0, 0, 100); -- cgit v1.2.3 From 4e01c64b6094fa1f4bf63ec8a8f77cf21696b711 Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Sat, 19 Mar 2011 23:42:59 -0700 Subject: Cleaned up memory patch. Fixes bug #737298. Fixed bugs: - https://launchpad.net/bugs/737298 (bzr r10118) --- src/interface.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'src/interface.cpp') diff --git a/src/interface.cpp b/src/interface.cpp index f69cd5673..4ac82a509 100644 --- a/src/interface.cpp +++ b/src/interface.cpp @@ -776,12 +776,20 @@ sp_menu_append_new_templates(GtkWidget *menu, Inkscape::UI::View::View *view) if (dir) { for (gchar const *file = g_dir_read_name(dir); file != NULL; file = g_dir_read_name(dir)) { - if (!g_str_has_suffix(file, ".svg") && !g_str_has_suffix(file, ".svgz")) + if (!g_str_has_suffix(file, ".svg") && !g_str_has_suffix(file, ".svgz")) { continue; // skip non-svg files + } - gchar *basename = g_path_get_basename(file); - if (g_str_has_suffix(basename, ".svg") && g_str_has_prefix(basename, "default.")) - continue; // skip default.*.svg (i.e. default.svg and translations) - it's in the menu already + { + gchar *basename = g_path_get_basename(file); + if (g_str_has_suffix(basename, ".svg") && g_str_has_prefix(basename, "default.")) { + g_free(basename); + basename = 0; + continue; // skip default.*.svg (i.e. default.svg and translations) - it's in the menu already + } + g_free(basename); + basename = 0; + } gchar const *filepath = g_build_filename(dirname, file, NULL); gchar *dupfile = g_strndup(file, strlen(file) - 4); -- cgit v1.2.3 From 6b38df080f453bfade2625985d2e6753e9a3f196 Mon Sep 17 00:00:00 2001 From: Nicolas Dufour Date: Thu, 21 Apr 2011 17:14:10 +0200 Subject: UI. New mnemonics (see Bug #768277 , Add mnemonics for menu items without verbs / default key mapping). Fixed bugs: - https://launchpad.net/bugs/768277 (bzr r10187) --- src/interface.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/interface.cpp') diff --git a/src/interface.cpp b/src/interface.cpp index 4ac82a509..f27700c25 100644 --- a/src/interface.cpp +++ b/src/interface.cpp @@ -829,11 +829,11 @@ sp_ui_checkboxes_menus(GtkMenu *m, Inkscape::UI::View::View *view) { //sp_ui_menu_append_check_item_from_verb(m, view, _("_Menu"), _("Show or hide the menu bar"), "menu", // checkitem_toggled, checkitem_update, 0); - sp_ui_menu_append_check_item_from_verb(m, view, _("Commands Bar"), _("Show or hide the Commands bar (under the menu)"), "commands", + sp_ui_menu_append_check_item_from_verb(m, view, _("_Commands Bar"), _("Show or hide the Commands bar (under the menu)"), "commands", checkitem_toggled, checkitem_update, 0); - sp_ui_menu_append_check_item_from_verb(m, view, _("Snap Controls Bar"), _("Show or hide the snapping controls"), "snaptoolbox", + sp_ui_menu_append_check_item_from_verb(m, view, _("Sn_ap Controls Bar"), _("Show or hide the snapping controls"), "snaptoolbox", checkitem_toggled, checkitem_update, 0); - sp_ui_menu_append_check_item_from_verb(m, view, _("Tool Controls Bar"), _("Show or hide the Tool Controls bar"), "toppanel", + sp_ui_menu_append_check_item_from_verb(m, view, _("T_ool Controls Bar"), _("Show or hide the Tool Controls bar"), "toppanel", checkitem_toggled, checkitem_update, 0); sp_ui_menu_append_check_item_from_verb(m, view, _("_Toolbox"), _("Show or hide the main toolbox (on the left)"), "toolbox", checkitem_toggled, checkitem_update, 0); -- cgit v1.2.3 From f27307a481f64c0b2d70f02eb3828910981c02e0 Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Fri, 24 Jun 2011 00:42:12 +0100 Subject: Remove/replace deprecated gtk_window_set_policy symbol (bzr r10350.1.2) --- src/interface.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/interface.cpp') diff --git a/src/interface.cpp b/src/interface.cpp index 11882ddf9..209f32fd7 100644 --- a/src/interface.cpp +++ b/src/interface.cpp @@ -216,9 +216,7 @@ sp_create_window(SPViewWidget *vw, gboolean editable) } } - } else { - gtk_window_set_policy(GTK_WINDOW(win->gobj()), TRUE, TRUE, TRUE); - } + } if ( completeDropTargets == 0 || completeDropTargetsCount == 0 ) { -- cgit v1.2.3 From f5437faac0a6b2d95f6acad0dd3a03c1759bc255 Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Sun, 26 Jun 2011 01:30:49 +0100 Subject: Gtk cleanup: gtk_menu_append (bzr r10350.1.7) --- src/interface.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/interface.cpp') diff --git a/src/interface.cpp b/src/interface.cpp index 209f32fd7..c7946cf18 100644 --- a/src/interface.cpp +++ b/src/interface.cpp @@ -456,7 +456,7 @@ sp_ui_menu_append_item( GtkMenu *menu, gchar const *stock, g_signal_connect( G_OBJECT(item), "deselect", G_CALLBACK(sp_ui_menu_deselect), NULL); } - gtk_menu_append(GTK_MENU(menu), item); + gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); return item; @@ -562,7 +562,7 @@ sp_ui_menu_append_item_from_verb(GtkMenu *menu, Inkscape::Verb *verb, Inkscape:: } gtk_widget_show(item); - gtk_menu_append(GTK_MENU(menu), item); + gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); return item; @@ -953,7 +953,7 @@ sp_ui_build_dyn_menus(Inkscape::XML::Node *menus, GtkWidget *menu, Inkscape::UI: GtkWidget *item = gtk_menu_item_new_with_label(string); gtk_widget_set_sensitive(item, false); gtk_widget_show(item); - gtk_menu_append(GTK_MENU(menu), item); + gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); } continue; } @@ -964,7 +964,7 @@ sp_ui_build_dyn_menus(Inkscape::XML::Node *menus, GtkWidget *menu, Inkscape::UI: || !strcmp(menu_pntr->name(), "seperator")) { GtkWidget *item = gtk_separator_menu_item_new(); gtk_widget_show(item); - gtk_menu_append(GTK_MENU(menu), item); + gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); continue; } if (!strcmp(menu_pntr->name(), "template-list")) { @@ -993,7 +993,7 @@ sp_ui_build_dyn_menus(Inkscape::XML::Node *menus, GtkWidget *menu, Inkscape::UI: GtkWidget *recent_item = gtk_menu_item_new_with_mnemonic(_("Open _Recent")); gtk_menu_item_set_submenu(GTK_MENU_ITEM(recent_item), recent_menu); - gtk_menu_append(GTK_MENU(menu), GTK_WIDGET(recent_item)); + gtk_menu_shell_append(GTK_MENU_SHELL(menu), GTK_WIDGET(recent_item)); // this will just sit and update the list's item count static MaxRecentObserver *mro = new MaxRecentObserver(recent_menu); prefs->addObserver(*mro); -- cgit v1.2.3 From b40f9bd37abc96d579f930dee9e6fb95031d74f0 Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Wed, 6 Jul 2011 00:26:32 -0700 Subject: Refactoring color profile to bring more internal. Help to prep for optional lcms2 support. (bzr r10420) --- src/interface.cpp | 4 ---- 1 file changed, 4 deletions(-) (limited to 'src/interface.cpp') diff --git a/src/interface.cpp b/src/interface.cpp index c7946cf18..9aa5cad31 100644 --- a/src/interface.cpp +++ b/src/interface.cpp @@ -56,10 +56,6 @@ #include "message-context.h" #include "ui/uxmanager.h" -// Added for color drag-n-drop -#if ENABLE_LCMS -#include "lcms.h" -#endif // ENABLE_LCMS #include "display/sp-canvas.h" #include "color.h" #include "svg/svg-color.h" -- cgit v1.2.3 From eed6e9c2c229b10911a23976c47da79fc70a5b87 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Sun, 17 Jul 2011 21:47:09 +0200 Subject: - rename SPItem::i2d_affine to i2dt_affine, to clarify that it is item-to-desktop, not item-to-document. This should make it easier to spot bugs. - tag some instances where the document-to-desktop transform has been hardcoded (bzr r10466) --- src/interface.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/interface.cpp') diff --git a/src/interface.cpp b/src/interface.cpp index 9aa5cad31..25153097d 100644 --- a/src/interface.cpp +++ b/src/interface.cpp @@ -1261,7 +1261,7 @@ sp_ui_drag_data_received(GtkWidget *widget, ( !item->style->stroke.isNone() ? desktop->current_zoom() * item->style->stroke_width.computed * - item->i2d_affine().descrim() * 0.5 + item->i2dt_affine().descrim() * 0.5 : 0.0) + prefs->getIntLimited("/options/dragtolerance/value", 0, 0, 100); @@ -1364,7 +1364,7 @@ sp_ui_drag_data_received(GtkWidget *widget, ( !item->style->stroke.isNone() ? desktop->current_zoom() * item->style->stroke_width.computed * - item->i2d_affine().descrim() * 0.5 + item->i2dt_affine().descrim() * 0.5 : 0.0) + prefs->getIntLimited("/options/dragtolerance/value", 0, 0, 100); -- cgit v1.2.3 From 4dd33aa4d5c57706c7f64f63391174954160a308 Mon Sep 17 00:00:00 2001 From: Krzysztof Kosi??ski Date: Sat, 6 Aug 2011 14:18:32 +0200 Subject: Rewrite NRArenaItem hierarchy into C++ (bzr r10347.1.21) --- src/interface.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/interface.cpp') diff --git a/src/interface.cpp b/src/interface.cpp index 25153097d..a981424fa 100644 --- a/src/interface.cpp +++ b/src/interface.cpp @@ -646,7 +646,7 @@ update_view_menu(GtkWidget *widget, GdkEventExpose */*event*/, gpointer user_dat Inkscape::UI::View::View *view = (Inkscape::UI::View::View *) g_object_get_data(G_OBJECT(widget), "view"); SPDesktop *dt = static_cast(view); Inkscape::RenderMode mode = dt->getMode(); - Inkscape::ColorRenderMode colormode = dt->getColorMode(); + Inkscape::ColorMode colormode = dt->getColorMode(); bool new_state = false; if (!strcmp(action->id, "ViewModeNormal")) { @@ -656,11 +656,11 @@ update_view_menu(GtkWidget *widget, GdkEventExpose */*event*/, gpointer user_dat } else if (!strcmp(action->id, "ViewModeOutline")) { new_state = mode == Inkscape::RENDERMODE_OUTLINE; } else if (!strcmp(action->id, "ViewColorModeNormal")) { - new_state = colormode == Inkscape::COLORRENDERMODE_NORMAL; + new_state = colormode == Inkscape::COLORMODE_NORMAL; } else if (!strcmp(action->id, "ViewColorModeGrayscale")) { - new_state = colormode == Inkscape::COLORRENDERMODE_GRAYSCALE; + new_state = colormode == Inkscape::COLORMODE_GRAYSCALE; } else if (!strcmp(action->id, "ViewColorModePrintColorsPreview")) { - new_state = colormode == Inkscape::COLORRENDERMODE_PRINT_COLORS_PREVIEW; + new_state = colormode == Inkscape::COLORMODE_PRINT_COLORS_PREVIEW; } else { g_warning("update_view_menu does not handle this verb"); } -- cgit v1.2.3 From 72cc39b9f0b340548f395c7f61ca9662b34aea09 Mon Sep 17 00:00:00 2001 From: Krzysztof Kosi??ski Date: Sat, 27 Aug 2011 11:04:37 +0200 Subject: Refactor SPItem bounding box methods: remove NRRect usage and make code using them more obvious. Fix filter region computation. (bzr r10582.1.1) --- src/interface.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/interface.cpp') diff --git a/src/interface.cpp b/src/interface.cpp index a981424fa..fb0d23e1b 100644 --- a/src/interface.cpp +++ b/src/interface.cpp @@ -1425,7 +1425,7 @@ sp_ui_drag_data_received(GtkWidget *widget, // move to mouse pointer { sp_desktop_document(desktop)->ensureUpToDate(); - Geom::OptRect sel_bbox = selection->bounds(); + Geom::OptRect sel_bbox = selection->visualBounds(); if (sel_bbox) { Geom::Point m( desktop->point() - sel_bbox->midpoint() ); sp_selection_move_relative(selection, m, false); -- cgit v1.2.3 From be7df18d6aef42dd657426b6a9d30834e5f54ca6 Mon Sep 17 00:00:00 2001 From: Krzysztof Kosi??ski Date: Sun, 28 Aug 2011 21:18:21 +0200 Subject: Remove nr-object.h and nr-macros.h (bzr r10582.1.10) --- src/interface.cpp | 37 ++++++++++++------------------------- 1 file changed, 12 insertions(+), 25 deletions(-) (limited to 'src/interface.cpp') diff --git a/src/interface.cpp b/src/interface.cpp index fb0d23e1b..8cb9698b7 100644 --- a/src/interface.cpp +++ b/src/interface.cpp @@ -125,25 +125,12 @@ static void sp_ui_drag_leave( GtkWidget *widget, GdkDragContext *drag_context, guint event_time, gpointer user_data ); -static void sp_ui_menu_item_set_sensitive(SPAction *action, - unsigned int sensitive, - void *data); -static void sp_ui_menu_item_set_name(SPAction *action, - Glib::ustring name, - void *data); +static void sp_ui_menu_item_set_name(GtkWidget *data, + Glib::ustring const &name); static void sp_recent_open(GtkRecentChooser *, gpointer); static void injectRenamedIcons(); -SPActionEventVector menu_item_event_vector = { - {NULL}, - NULL, - NULL, /* set_active */ - sp_ui_menu_item_set_sensitive, /* set_sensitive */ - NULL, /* set_shortcut */ - sp_ui_menu_item_set_name /* set_name */ -}; - static const int MIN_ONSCREEN_DISTANCE = 50; void @@ -508,7 +495,6 @@ sp_ui_menu_append_item_from_verb(GtkMenu *menu, Inkscape::Verb *verb, Inkscape:: unsigned int shortcut; action = verb->get_action(view); - if (!action) return NULL; shortcut = sp_shortcut_get_primary(verb); @@ -542,7 +528,15 @@ sp_ui_menu_append_item_from_verb(GtkMenu *menu, Inkscape::Verb *verb, Inkscape:: gtk_container_add((GtkContainer *) item, name_lbl); } - nr_active_object_add_listener((NRActiveObject *)action, (NRObjectEventVector *)&menu_item_event_vector, sizeof(SPActionEventVector), item); + action->signal_set_sensitive.connect( + sigc::bind<0>( + sigc::ptr_fun(>k_widget_set_sensitive), + item)); + action->signal_set_name.connect( + sigc::bind<0>( + sigc::ptr_fun(&sp_ui_menu_item_set_name), + item)); + if (!action->sensitive) { gtk_widget_set_sensitive(item, FALSE); } @@ -716,7 +710,6 @@ sp_ui_menu_append_check_item_from_verb(GtkMenu *menu, Inkscape::UI::View::View * gtk_container_add((GtkContainer *) item, l); } #if 0 - nr_active_object_add_listener((NRActiveObject *)action, (NRObjectEventVector *)&menu_item_event_vector, sizeof(SPActionEventVector), item); if (!action->sensitive) { gtk_widget_set_sensitive(item, FALSE); } @@ -1587,13 +1580,7 @@ sp_ui_overwrite_file(gchar const *filename) } static void -sp_ui_menu_item_set_sensitive(SPAction */*action*/, unsigned int sensitive, void *data) -{ - return gtk_widget_set_sensitive(GTK_WIDGET(data), sensitive); -} - -static void -sp_ui_menu_item_set_name(SPAction */*action*/, Glib::ustring name, void *data) +sp_ui_menu_item_set_name(GtkWidget *data, Glib::ustring const &name) { void *child = GTK_BIN (data)->child; //child is either -- cgit v1.2.3 From 20097d47e6945bceb57d2335d23fe764f493ab59 Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Sun, 2 Oct 2011 20:44:17 -0700 Subject: Another minor pass of Doxygen cleanup. (bzr r10659) --- src/interface.cpp | 69 +++++++++++++++++++++++++++++-------------------------- 1 file changed, 36 insertions(+), 33 deletions(-) (limited to 'src/interface.cpp') diff --git a/src/interface.cpp b/src/interface.cpp index 8cb9698b7..646400dd6 100644 --- a/src/interface.cpp +++ b/src/interface.cpp @@ -1,5 +1,6 @@ -/** @file - * @brief Main UI stuff +/** + * @file + * Main UI stuff. */ /* Authors: * Lauris Kaplinski @@ -628,11 +629,9 @@ static void taskToggled(GtkCheckMenuItem *menuitem, gpointer userData) /** - * \brief Callback function to update the status of the radio buttons in the View -> Display mode menu (Normal, No Filters, Outline) and Color display mode + * Callback function to update the status of the radio buttons in the View -> Display mode menu (Normal, No Filters, Outline) and Color display mode. */ - -static gboolean -update_view_menu(GtkWidget *widget, GdkEventExpose */*event*/, gpointer user_data) +static gboolean update_view_menu(GtkWidget *widget, GdkEventExpose */*event*/, gpointer user_data) { SPAction *action = (SPAction *) user_data; g_assert(action->id != NULL); @@ -867,7 +866,9 @@ void addTaskMenuItems(GtkMenu *menu, Inkscape::UI::View::View *view) } -/** @brief Observer that updates the recent list's max document count */ +/** + * Observer that updates the recent list's max document count. + */ class MaxRecentObserver : public Inkscape::Preferences::Observer { public: MaxRecentObserver(GtkWidget *recent_menu) : @@ -883,23 +884,24 @@ private: GtkWidget *_rm; }; -/** \brief This function turns XML into a menu - \param menus This is the XML that defines the menu - \param menu Menu to be added to - \param view The View that this menu is being built for - - This function is realitively simple as it just goes through the XML - and parses the individual elements. In the case of a submenu, it - just calls itself recursively. Because it is only reasonable to have - a couple of submenus, it is unlikely this will go more than two or - three times. - - In the case of an unrecognized verb, a menu item is made to identify - the verb that is missing, and display that. The menu item is also made - insensitive. -*/ -void -sp_ui_build_dyn_menus(Inkscape::XML::Node *menus, GtkWidget *menu, Inkscape::UI::View::View *view) +/** + * This function turns XML into a menu. + * + * This function is realitively simple as it just goes through the XML + * and parses the individual elements. In the case of a submenu, it + * just calls itself recursively. Because it is only reasonable to have + * a couple of submenus, it is unlikely this will go more than two or + * three times. + * + * In the case of an unrecognized verb, a menu item is made to identify + * the verb that is missing, and display that. The menu item is also made + * insensitive. + * + * @param menus This is the XML that defines the menu + * @param menu Menu to be added to + * @param view The View that this menu is being built for + */ +void sp_ui_build_dyn_menus(Inkscape::XML::Node *menus, GtkWidget *menu, Inkscape::UI::View::View *view) { if (menus == NULL) return; if (menu == NULL) return; @@ -999,15 +1001,16 @@ sp_ui_build_dyn_menus(Inkscape::XML::Node *menus, GtkWidget *menu, Inkscape::UI: } } -/** \brief Build the main tool bar - \param view View to build the bar for - - Currently the main tool bar is built as a dynamic XML menu using - \c sp_ui_build_dyn_menus. This function builds the bar, and then - pass it to get items attached to it. -*/ -GtkWidget * -sp_ui_main_menubar(Inkscape::UI::View::View *view) +/** + * Build the main tool bar. + * + * Currently the main tool bar is built as a dynamic XML menu using + * \c sp_ui_build_dyn_menus. This function builds the bar, and then + * pass it to get items attached to it. + * + * @param view View to build the bar for + */ +GtkWidget *sp_ui_main_menubar(Inkscape::UI::View::View *view) { GtkWidget *mbar = gtk_menu_bar_new(); -- cgit v1.2.3