diff options
| author | Jon A. Cruz <jon@joncruz.org> | 2006-03-28 17:14:27 +0000 |
|---|---|---|
| committer | joncruz <joncruz@users.sourceforge.net> | 2006-03-28 17:14:27 +0000 |
| commit | 0ffc5334227542731ecdf06eca1a59e0a4457272 (patch) | |
| tree | 6b6e14bbd246b62492dadf4f2738eaed167041c5 /src/dialogs | |
| parent | optimization: create side knots and lines only on demand (diff) | |
| download | inkscape-0ffc5334227542731ecdf06eca1a59e0a4457272.tar.gz inkscape-0ffc5334227542731ecdf06eca1a59e0a4457272.zip | |
Changed objects to only get linked to "linkable" colors.
(bzr r321)
Diffstat (limited to 'src/dialogs')
| -rw-r--r-- | src/dialogs/eek-preview.cpp | 35 | ||||
| -rw-r--r-- | src/dialogs/eek-preview.h | 3 | ||||
| -rw-r--r-- | src/dialogs/swatches.cpp | 41 | ||||
| -rw-r--r-- | src/dialogs/swatches.h | 8 |
4 files changed, 63 insertions, 24 deletions
diff --git a/src/dialogs/eek-preview.cpp b/src/dialogs/eek-preview.cpp index d2ac8db5d..0108d4777 100644 --- a/src/dialogs/eek-preview.cpp +++ b/src/dialogs/eek-preview.cpp @@ -210,11 +210,12 @@ gboolean eek_preview_expose_event( GtkWidget* widget, GdkEventExpose* event ) ); } - if ( area.height < possible.height ) { - area.y = possible.y + (possible.height - area.height); - } - if ( preview->_linked & PREVIEW_LINK_OUT ) { + GdkRectangle otherArea = {area.x, area.y, area.width, area.height}; + if ( otherArea.height < possible.height ) { + otherArea.y = possible.y + (possible.height - otherArea.height); + } + gtk_paint_arrow( style, widget->window, (GtkStateType)widget->state, @@ -224,8 +225,28 @@ gboolean eek_preview_expose_event( GtkWidget* widget, GdkEventExpose* event ) NULL, /* detail */ GTK_ARROW_UP, FALSE, - area.x, area.y, - area.width, area.height + otherArea.x, otherArea.y, + otherArea.width, otherArea.height + ); + } + + if ( preview->_linked & PREVIEW_LINK_OTHER ) { + GdkRectangle otherArea = {insetX, area.y, area.width, area.height}; + if ( otherArea.height < possible.height ) { + otherArea.y = possible.y + (possible.height - otherArea.height) / 2; + } + + gtk_paint_arrow( style, + widget->window, + (GtkStateType)widget->state, + GTK_SHADOW_ETCHED_OUT, + NULL, /* clip area. &area, */ + widget, /* may be NULL */ + NULL, /* detail */ + GTK_ARROW_LEFT, + FALSE, + otherArea.x, otherArea.y, + otherArea.width, otherArea.height ); } } @@ -485,7 +506,7 @@ static void eek_preview_class_init( EekPreviewClass *klass ) void eek_preview_set_linked( EekPreview* splat, LinkType link ) { - link = (LinkType)(link & PREVIEW_LINK_BOTH); + link = (LinkType)(link & PREVIEW_LINK_ALL); if ( link != (LinkType)splat->_linked ) { splat->_linked = link; diff --git a/src/dialogs/eek-preview.h b/src/dialogs/eek-preview.h index 736d71058..114be8742 100644 --- a/src/dialogs/eek-preview.h +++ b/src/dialogs/eek-preview.h @@ -71,7 +71,8 @@ typedef enum { PREVIEW_LINK_NONE = 0, PREVIEW_LINK_IN = 1, PREVIEW_LINK_OUT = 2, - PREVIEW_LINK_BOTH = 3 + PREVIEW_LINK_OTHER = 4, + PREVIEW_LINK_ALL = 7 } LinkType; typedef struct _EekPreview EekPreview; diff --git a/src/dialogs/swatches.cpp b/src/dialogs/swatches.cpp index 1d429603d..8d81c3b99 100644 --- a/src/dialogs/swatches.cpp +++ b/src/dialogs/swatches.cpp @@ -42,6 +42,7 @@ SwatchesPanel* SwatchesPanel::instance = 0; ColorItem::ColorItem( unsigned int r, unsigned int g, unsigned int b, Glib::ustring& name ) : def( r, g, b, name ), + _isLive(false), _linkIsTone(false), _linkPercent(0), _linkGray(0), @@ -102,12 +103,12 @@ static const GtkTargetEntry sourceColorEntries[] = { {"text/plain", 0, TEXT_DATA}, }; -static void dragGetColorData( GtkWidget *widget, - GdkDragContext *drag_context, - GtkSelectionData *data, - guint info, - guint time, - gpointer user_data) +void ColorItem::_dragGetColorData( GtkWidget *widget, + GdkDragContext *drag_context, + GtkSelectionData *data, + guint info, + guint time, + gpointer user_data) { static GdkAtom typeXColor = gdk_atom_intern("application/x-color", FALSE); static GdkAtom typeText = gdk_atom_intern("text/plain", FALSE); @@ -148,19 +149,19 @@ static void dragGetColorData( GtkWidget *widget, // } else { // g_message("Unable to find the color"); // } - int itemCount = 4 + 1 + 1 + paletteName.length(); + int itemCount = 4 + 2 + 1 + paletteName.length(); - guint16* tmp = new guint16[itemCount] -; + guint16* tmp = new guint16[itemCount]; tmp[0] = (item->def.getR() << 8) | item->def.getR(); tmp[1] = (item->def.getG() << 8) | item->def.getG(); tmp[2] = (item->def.getB() << 8) | item->def.getB(); tmp[3] = 0xffff; + tmp[4] = (item->_isLive || !item->_listeners.empty() || (item->_linkSrc != 0) ) ? 1 : 0; - tmp[4] = index; - tmp[5] = paletteName.length(); + tmp[5] = index; + tmp[6] = paletteName.length(); for ( unsigned int i = 0; i < paletteName.length(); i++ ) { - tmp[6 + i] = paletteName[i]; + tmp[7 + i] = paletteName[i]; } gtk_selection_data_set( data, typeXColor, @@ -351,7 +352,9 @@ void ColorItem::_colorDefChanged(void* data) (item->def.getG() << 8) | item->def.getG(), (item->def.getB() << 8) | item->def.getB() ); - eek_preview_set_linked( preview, (LinkType)((item->_linkSrc ? PREVIEW_LINK_IN:0) | (item->_listeners.empty() ? 0:PREVIEW_LINK_OUT)) ); + eek_preview_set_linked( preview, (LinkType)((item->_linkSrc ? PREVIEW_LINK_IN:0) + | (item->_listeners.empty() ? 0:PREVIEW_LINK_OUT) + | (item->_isLive ? PREVIEW_LINK_OTHER:0)) ); widget->queue_draw(); } @@ -439,7 +442,9 @@ Gtk::Widget* ColorItem::getPreview(PreviewStyle style, ViewType view, Gtk::Built eek_preview_set_color( preview, (def.getR() << 8) | def.getR(), (def.getG() << 8) | def.getG(), (def.getB() << 8) | def.getB()); eek_preview_set_details( preview, (::PreviewStyle)style, (::ViewType)view, (::GtkIconSize)size ); - eek_preview_set_linked( preview, (LinkType)((_linkSrc ? PREVIEW_LINK_IN:0) | (_listeners.empty() ? 0:PREVIEW_LINK_OUT)) ); + eek_preview_set_linked( preview, (LinkType)((_linkSrc ? PREVIEW_LINK_IN:0) + | (_listeners.empty() ? 0:PREVIEW_LINK_OUT) + | (_isLive ? PREVIEW_LINK_OTHER:0)) ); def.addCallback( _colorDefChanged, this ); @@ -485,7 +490,7 @@ Gtk::Widget* ColorItem::getPreview(PreviewStyle style, ViewType view, Gtk::Built g_signal_connect( G_OBJECT(newBlot->gobj()), "drag-data-get", - G_CALLBACK(dragGetColorData), + G_CALLBACK(ColorItem::_dragGetColorData), this); g_signal_connect( G_OBJECT(newBlot->gobj()), @@ -645,10 +650,14 @@ void ColorItem::_wireMagicColors( void* p ) if ( subby.find('E') != std::string::npos ) { - //g_message(" HOT!"); (*it)->def.setEditable( true ); } + if ( subby.find('L') != std::string::npos ) + { + (*it)->_isLive = true; + } + std::string part; // Tint. index + 1 more val. if ( getBlock( part, 'T', subby ) ) { diff --git a/src/dialogs/swatches.h b/src/dialogs/swatches.h index b6f28f182..965c32240 100644 --- a/src/dialogs/swatches.h +++ b/src/dialogs/swatches.h @@ -57,6 +57,13 @@ private: guint event_time, gpointer user_data); + static void _dragGetColorData( GtkWidget *widget, + GdkDragContext *drag_context, + GtkSelectionData *data, + guint info, + guint time, + gpointer user_data); + static void _wireMagicColors( void* p ); static void _colorDefChanged(void* data); @@ -66,6 +73,7 @@ private: Gtk::Tooltips tips; std::vector<Gtk::Widget*> _previews; + bool _isLive; bool _linkIsTone; int _linkPercent; int _linkGray; |
