interface.cpp revision 126aa5b056be3aec870a698c7a7d99df41ce12d8
919N/A#ifdef HAVE_CONFIG_H
919N/A#include "inkscape-private.h"
469N/A#include "preferences.h"
469N/A#include "path-prefix.h"
469N/A#include "shortcuts.h"
469N/A#include "document.h"
469N/A#include "desktop-handles.h"
469N/A#include "interface.h"
1233N/A#include "selection.h"
1233N/A#include "selection-chemistry.h"
1233N/A#include "svg-view-widget.h"
1233N/A#include "widgets/desktop-widget.h"
469N/A#include "sp-item-group.h"
469N/A#include "sp-gradient-fns.h"
469N/A#include "sp-gradient.h"
469N/A#include "sp-flowtext.h"
469N/A#include "sp-namedview.h"
469N/A#include "helper/gnome-utils.h"
469N/A#include "dialogs/dialog-events.h"
469N/A#include "message-context.h"
469N/A#include "ui/uxmanager.h"
469N/A#include "display/sp-canvas.h"
469N/A#include "svg/svg-color.h"
469N/A#include "desktop-style.h"
469N/A#include "event-context.h"
469N/A#include "gradient-drag.h"
469N/A#include "widgets/ege-paint-def.h"
469N/A#include "document-undo.h"
469N/A#include "sp-anchor.h"
469N/A#include "sp-clippath.h"
469N/A#include "sp-image.h"
469N/A#include "message-stack.h"
469N/A// #include "inkscape.h"
469N/A#include "ui/dialog/dialog-manager.h"
469N/Astatic int completeDropTargetsCount = 0;
469N/Astatic bool temporarily_block_actions = false;
469N/A#define ENTRIES_SIZE(n) sizeof(n)/sizeof(n[0])
469N/Astatic void injectRenamedIcons();
469N/A win->signal_delete_event().connect(sigc::mem_fun(*(SPDesktop*)vw->view, &SPDesktop::onDeleteUI));
469N/A win->signal_window_state_event().connect(sigc::mem_fun(*desktop, &SPDesktop::onWindowStateEvent));
469N/A win->signal_focus_in_event().connect(sigc::mem_fun(*desktop_widget, &SPDesktopWidget::onFocusInEvent));
469N/A if (prefs_geometry) {
469N/A for ( int i = 0; i < (int)nui_drop_target_entries; i++ ) {
469N/Avoid sp_ui_new_view_preview()
469N/A // Shutdown can proceed; use the stored reference to the desktop here instead of the current SP_ACTIVE_DESKTOP,
469N/A // because the user might have changed the focus in the meantime (see bug #381357 on Launchpad)
469N/Asp_ui_close_all(void)
469N/A while (SP_ACTIVE_DESKTOP) {
469N/A // Shutdown can proceed; use the stored reference to the desktop here instead of the current SP_ACTIVE_DESKTOP,
469N/A // because the user might have changed the focus in the meantime (see bug #381357 on Launchpad)
469N/A if (!temporarily_block_actions) {
469N/A Inkscape::UI::View::View *view = static_cast<Inkscape::UI::View::View*> (g_object_get_data(G_OBJECT(object), "view"));
469N/A Inkscape::UI::View::View *view = static_cast<Inkscape::UI::View::View*> (g_object_get_data(G_OBJECT(object), "view"));
469N/A static bool iconsInjected = false;
469N/A if ( !iconsInjected ) {
469N/A iconsInjected = true;
469N/A * @see ContextMenu::AppendItemFromVerb for a c++ified alternative. Consider dropping sp_ui_menu_append_item_from_verb when c++ifying interface.cpp.
469N/Astatic GtkWidget *sp_ui_menu_append_item_from_verb(GtkMenu *menu, Inkscape::Verb *verb, Inkscape::UI::View::View *view, bool radio = false, GSList *group = NULL)
469N/A g_signal_connect( G_OBJECT(item), "deselect", G_CALLBACK(sp_ui_menu_deselect_action), action );
Inkscape::UI::View::View *view = (Inkscape::UI::View::View *) g_object_get_data(G_OBJECT(menuitem), "view");
static gboolean
Inkscape::UI::View::View *view = (Inkscape::UI::View::View *) g_object_get_data(G_OBJECT(menuitem), "view");
g_signal_handlers_block_by_func(G_OBJECT(menuitem), (gpointer)(GCallback)checkitem_toggled, user_data);
g_signal_handlers_unblock_by_func(G_OBJECT(menuitem), (gpointer)(GCallback)checkitem_toggled, user_data);
return FALSE;
Inkscape::UI::View::View *view = (Inkscape::UI::View::View *) g_object_get_data(G_OBJECT(menuitem), "view");
* Callback function to update the status of the radio buttons in the View -> Display mode menu (Normal, No Filters, Outline) and Color display mode.
Inkscape::UI::View::View *view = (Inkscape::UI::View::View *) g_object_get_data(G_OBJECT(widget), "view");
bool new_state = false;
if (new_state) { //only one of the radio buttons has to be activated; the others will automatically be deactivated
// When the GtkMenuItem version of the "activate" signal has been emitted by a GtkRadioMenuItem, there is a second
// emission as the most recently active item is toggled to inactive. This is dealt with before the original signal is handled.
temporarily_block_actions = true;
temporarily_block_actions = false;
return FALSE;
sp_ui_menu_append_check_item_from_verb(GtkMenu *menu, Inkscape::UI::View::View *view, gchar const *label, gchar const *tip, gchar const *pref,
g_free(c);
g_signal_connect( G_OBJECT(item), "select", G_CALLBACK(sp_ui_menu_select), (gpointer) (action ? action->tip : tip));
if (dir) {
basename = 0;
continue; // skip default.*.svg (i.e. default.svg and translations) - it's in the menu already
basename = 0;
if (view) {
//sp_ui_menu_append_check_item_from_verb(m, view, _("_Menu"), _("Show or hide the menu bar"), "menu",
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, _("Sn_ap Controls Bar"), _("Show or hide the snapping controls"), "snaptoolbox",
sp_ui_menu_append_check_item_from_verb(m, view, _("T_ool Controls Bar"), _("Show or hide the Tool Controls bar"), "toppanel",
sp_ui_menu_append_check_item_from_verb(m, view, _("_Toolbox"), _("Show or hide the main toolbox (on the left)"), "toolbox",
sp_ui_menu_append_check_item_from_verb(m, view, _("_Palette"), _("Show or hide the color palette"), "panels",
sp_ui_menu_append_check_item_from_verb(m, view, _("_Statusbar"), _("Show or hide the statusbar (at the bottom of the window)"), "statusbar",
int count = 0;
gint active = Inkscape::UI::UXManager::getInstance()->getDefaultTask( dynamic_cast<SPDesktop*>(view) );
g_signal_connect( G_OBJECT(item), "toggled", reinterpret_cast<GCallback>(taskToggled), GINT_TO_POINTER(count) );
g_signal_connect( G_OBJECT(item), "select", G_CALLBACK(sp_ui_menu_select), const_cast<gchar*>(strs[1]) );
void sp_ui_build_dyn_menus(Inkscape::XML::Node *menus, GtkWidget *menu, Inkscape::UI::View::View *view)
g_signal_connect(G_OBJECT(recent_menu), "item-activated", G_CALLBACK(sp_recent_open), (gpointer) NULL);
return mbar;
switch (info) {
case APP_X_INKY_COLOR:
int destX = 0;
int destY = 0;
if ( item )
sp_svg_write_color( c, sizeof(c),
bool updatePerformed = false;
str = 0;
updatePerformed = true;
if ( !updatePerformed ) {
if ( srgbProf ) {
case APP_X_COLOR:
int destX = 0;
int destY = 0;
bool consumed = false;
if (consumed) {
if (fillnotstroke &&
boost::optional<Path::cut_position> position = get_nearest_position_on_Path(livarot_path, button_doc);
if (position) {
double stroke_tolerance =
fillnotstroke = false;
delete livarot_path;
case APP_OSWB_COLOR:
bool worked = false;
if ( worked ) {
if (matches) {
if ( worked ) {
int destX = 0;
int destY = 0;
bool consumed = false;
if (consumed) {
if (fillnotstroke &&
boost::optional<Path::cut_position> position = get_nearest_position_on_Path(livarot_path, button_doc);
if (position) {
double stroke_tolerance =
fillnotstroke = false;
delete livarot_path;
case SVG_DATA:
case SVG_XML_DATA: {
Inkscape::XML::Document *rnewdoc = sp_repr_read_mem(svgdata, gtk_selection_data_get_length (data), SP_SVG_NS_URI);
if (sel_bbox) {
case URI_LIST: {
case PNG_DATA:
case JPEG_DATA:
case IMAGE_DATA: {
NULL);
#include "gradient-context.h"
if (!list)
if (filename) {
if (!doc) return;
_( "<span weight=\"bold\" size=\"larger\">A file named \"%s\" already exists. Do you want to replace it?</span>\n\n"
NULL );
return return_value;
void injectRenamedIcons()
for ( std::vector< std::pair<Glib::ustring, Glib::ustring> >::iterator it = renamed.begin(); it < renamed.end(); ++it ) {
if ( pb ) {
separators(),
MIGroup(),
AddSeparator();
AddSeparator();
positionOfLastDialog = 10; // 9 in front + 1 for the separator in the next if; used to position the dialog menu entries below each other
AddSeparator();
if (item) {
( _desktop->currentLayer() != _desktop->currentRoot() && _desktop->currentLayer()->parent != _desktop->currentRoot() ) ) {
AddSeparator();
MIGroup.signal_activate().connect(sigc::bind(sigc::mem_fun(*this, &ContextMenu::EnterGroup),&MIGroup));
return sep;
void ContextMenu::AppendItemFromVerb(Inkscape::Verb *verb)//, SPDesktop *view)//, bool radio, GSList *group)
if (!action)
g_free(c);
MakeItemMenu ();
MakeTextMenu();
AddSeparator();
bool ClipRefOK=false;
bool MaskRefOK=false;
if (_item){
ClipRefOK=true;
if (_item){
MaskRefOK=true;
if (MaskRefOK) {
if (ClipRefOK) {
return value;
#ifdef WIN32
if ( index >= 0 ) {
//g_warning("##Command line: %s\n", cmdline.c_str());
if ( errThing ) {
errThing = 0;
if (verb) {
if (action) {
if (verb) {
if (action) {