diff --git a/src/interface.cpp b/src/interface.cpp
index 5de76aff170a9bfc6dacf880730887e0e9c825d0..55a9601eec10b6b56fd332bbc0fb424a795e5519 100644 (file)
--- a/src/interface.cpp
+++ b/src/interface.cpp
#include "message-context.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"
{"image/svg", 0, SVG_DATA},
{"image/png", 0, PNG_DATA},
{"image/jpeg", 0, JPEG_DATA},
+#if ENABLE_LCMS
{"application/x-inkscape-color", 0, APP_X_INKY_COLOR},
+#endif // ENABLE_LCMS
{"application/x-color", 0, APP_X_COLOR}
};
{
GtkWidget *icon;
- icon = sp_icon_new( GTK_ICON_SIZE_MENU, icon_name );
+ icon = sp_icon_new( Inkscape::ICON_SIZE_MENU, icon_name );
gtk_widget_show(icon);
gtk_image_menu_item_set_image((GtkImageMenuItem *) item, icon);
} // end of sp_ui_menu_add_icon
gpointer user_data)
{
switch (info) {
+#if ENABLE_LCMS
case APP_X_INKY_COLOR:
{
SPDesktop *desktop = SP_ACTIVE_DESKTOP;
if ( item )
{
if ( data->length >= 8 ) {
+ cmsHPROFILE srgbProf = cmsCreate_sRGBProfile();
+
gchar c[64] = {0};
// Careful about endian issues.
guint16* dataVals = (guint16*)data->data;
//0x0ff & (data->data[3] >> 8),
));
SPCSSAttr *css = sp_repr_css_attr_new();
- sp_repr_css_set_property( css, (drag_context->action != GDK_ACTION_MOVE) ? "fill":"stroke", c );
+ bool updatePerformed = false;
- sp_desktop_apply_css_recursive( item, css, true );
- item->updateRepr();
+ if ( data->length > 14 ) {
+ int flags = dataVals[4];
- if ( data->length > 12 ) {
// piggie-backed palette entry info
- int index = dataVals[4];
+ int index = dataVals[5];
Glib::ustring palName;
- for ( int i = 0; i < dataVals[5]; i++ ) {
- palName += (gunichar)dataVals[6+i];
+ for ( int i = 0; i < dataVals[6]; i++ ) {
+ palName += (gunichar)dataVals[7+i];
}
// Now hook in a magic tag of some sort.
- if ( !palName.empty() ) {
+ if ( !palName.empty() && (flags & 1) ) {
gchar* str = g_strdup_printf("%d|", index);
palName.insert( 0, str );
g_free(str);
str = 0;
sp_object_setAttribute( SP_OBJECT(item),
- (drag_context->action != GDK_ACTION_MOVE) ? "HOTFill":"HOTStroke",
+ (drag_context->action != GDK_ACTION_MOVE) ? "inkscape:x-fill-tag":"inkscape:x-stroke-tag",
palName.c_str(),
false );
item->updateRepr();
+
+ sp_repr_css_set_property( css, (drag_context->action != GDK_ACTION_MOVE) ? "fill":"stroke", c );
+ updatePerformed = true;
}
}
+ if ( !updatePerformed ) {
+ sp_repr_css_set_property( css, (drag_context->action != GDK_ACTION_MOVE) ? "fill":"stroke", c );
+ }
+
+ sp_desktop_apply_css_recursive( item, css, true );
+ item->updateRepr();
+
SPDocument *doc = SP_ACTIVE_DOCUMENT;
sp_document_done( doc );
+
+ if ( srgbProf ) {
+ cmsCloseProfile( srgbProf );
+ }
}
}
}
break;
+#endif // ENABLE_LCMS
case APP_X_COLOR:
{
gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE);
hbox = gtk_hbox_new(FALSE, 5);
+
+ // TODO - replace with Inkscape-specific call
boxdata = gtk_image_new_from_stock(GTK_STOCK_DIALOG_QUESTION, GTK_ICON_SIZE_DIALOG);
+
gtk_widget_show(boxdata);
gtk_box_pack_start(GTK_BOX(hbox), boxdata, TRUE, TRUE, 5);
text = g_strdup_printf(_("The file %s already exists. Do you want to overwrite that file with the current document?"), filename);