summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 7e2bb19)
raw | patch | inline | side by side (parent: 7e2bb19)
author | joncruz <joncruz@users.sourceforge.net> | |
Thu, 5 Mar 2009 08:11:54 +0000 (08:11 +0000) | ||
committer | joncruz <joncruz@users.sourceforge.net> | |
Thu, 5 Mar 2009 08:11:54 +0000 (08:11 +0000) |
diff --git a/src/interface.cpp b/src/interface.cpp
index e7a3d6f28399c88c5986a24933ec5c947d70d7ac..f03df2917cfccddb08b4f7c8100e9fea0ab1a828 100644 (file)
--- a/src/interface.cpp
+++ b/src/interface.cpp
IMAGE_DATA,
APP_X_INKY_COLOR,
APP_X_COLOR,
- APP_X_NOCOLOR
+ APP_X_NOCOLOR,
+ APP_X_XCOLOR
} ui_drop_target_info;
static GtkTargetEntry ui_drop_target_entries [] = {
{(gchar *)"application/x-inkscape-color", 0, APP_X_INKY_COLOR},
#endif // ENABLE_MAGIC_COLORS
{(gchar *)"application/x-inkscape-nocolor", 0, APP_X_NOCOLOR },
+ {(gchar *)"application/x-inkscape-xcolor", 0, APP_X_XCOLOR },
{(gchar *)"application/x-color", 0, APP_X_COLOR }
};
break;
case APP_X_NOCOLOR:
+ case APP_X_XCOLOR:
{
gchar* c = g_strdup("none"); // temp
int destX = 0;
index 1a5ef85210a085192d3020346f4b833275261ad5..5cd357673b4bf68b7a5e443b8fc8d60f9e21a32f 100644 (file)
namespace UI {
namespace Dialogs {
-// create a None color swatch
-ColorItem::ColorItem() :
- def(),
+ColorItem::ColorItem(eek::ColorDef::ColorType type) :
+ def(type),
_isLive(false),
_linkIsTone(false),
_linkPercent(0),
APP_X_INKY_COLOR = 0,
APP_X_COLOR,
APP_X_NOCOLOR,
+ APP_X_XCOLOR,
TEXT_DATA
} colorFlavorType;
{"text/plain", 0, TEXT_DATA},
};
+static const GtkTargetEntry sourceClearColorEntries[] = {
+ {"application/x-inkscape-xcolor", 0, APP_X_XCOLOR},
+ {"application/x-color", 0, APP_X_COLOR},
+ {"text/plain", 0, TEXT_DATA},
+};
+
void ColorItem::_dragGetColorData( GtkWidget */*widget*/,
GdkDragContext */*drag_context*/,
GtkSelectionData *data,
reinterpret_cast<const guchar*>(tmp),
itemCount * 2);
delete[] tmp;
- } else if ( info == APP_X_NOCOLOR ) {
+ } else if ( (info == APP_X_NOCOLOR) || (info == APP_X_XCOLOR) ) {
Glib::ustring paletteName;
// Find where this thing came from
break;
}
case APP_X_NOCOLOR:
+ case APP_X_XCOLOR:
{
// g_message("APP_X_NOCOLOR dropping through to x-color");
}
@@ -695,9 +702,10 @@ Gtk::Widget* ColorItem::getPreview(PreviewStyle style, ViewType view, ::PreviewS
gtk_drag_source_set( GTK_WIDGET(newBlot->gobj()),
GDK_BUTTON1_MASK,
- (def.getType() != eek::ColorDef::RGB) ? sourceNoColorEntries :
- sourceColorEntries,
- (def.getType() != eek::ColorDef::RGB) ? G_N_ELEMENTS(sourceNoColorEntries) :
+ (def.getType() == eek::ColorDef::CLEAR) ? sourceClearColorEntries :
+ (def.getType() == eek::ColorDef::NONE) ? sourceNoColorEntries : sourceColorEntries,
+ (def.getType() == eek::ColorDef::CLEAR) ? G_N_ELEMENTS(sourceClearColorEntries) :
+ (def.getType() == eek::ColorDef::NONE) ? G_N_ELEMENTS(sourceNoColorEntries) :
G_N_ELEMENTS(sourceColorEntries),
GdkDragAction(GDK_ACTION_MOVE | GDK_ACTION_COPY) );
{
Gtk::RadioMenuItem* hotItem = 0;
_holder = new PreviewHolder();
- _remove = new ColorItem();
+ _clear = new ColorItem( eek::ColorDef::CLEAR );
+ _remove = new ColorItem( eek::ColorDef::NONE );
loadEmUp();
if ( !possible.empty() ) {
JustForNow* first = 0;
_holder->setColumnPref( first->_prefWidth );
}
_holder->freezeUpdates();
+ // TODO restore once 'clear' works _holder->addPreview(_clear);
_holder->addPreview(_remove);
for ( std::vector<ColorItem*>::iterator it = first->_colors.begin(); it != first->_colors.end(); it++ ) {
_holder->addPreview(*it);
SwatchesPanel::~SwatchesPanel()
{
- if (_remove) delete _remove;
- if (_holder) delete _holder;
+ if ( _clear ) {
+ delete _clear;
+ }
+ if ( _remove ) {
+ delete _remove;
+ }
+ if ( _holder ) {
+ delete _holder;
+ }
}
void SwatchesPanel::setOrientation( Gtk::AnchorType how )
_holder->setColumnPref( curr->_prefWidth );
}
_holder->freezeUpdates();
+ _holder->addPreview(_clear);
_holder->addPreview(_remove);
for ( std::vector<ColorItem*>::iterator it = curr->_colors.begin(); it != curr->_colors.end(); it++ ) {
_holder->addPreview(*it);
index 17081733d8912fd391c3a5d3760d2d50c6f336b0..560719ed243a4c36b105dbc2e90ebd830a38bd48 100644 (file)
--- a/src/ui/dialog/swatches.h
+++ b/src/ui/dialog/swatches.h
{
friend void _loadPaletteFile( gchar const *filename );
public:
- ColorItem();
+ ColorItem( eek::ColorDef::ColorType type );
ColorItem( unsigned int r, unsigned int g, unsigned int b,
Glib::ustring& name );
virtual ~ColorItem();
static SwatchesPanel* instance;
PreviewHolder* _holder;
+ ColorItem* _clear;
ColorItem* _remove;
};
index d7cb41b38970ae3b7f15f08bfa9444406b272988..6334061c2d80e3d3b2da3afe1ebdac2c049a850f 100644 (file)
{
}
+ColorDef::ColorDef( ColorType type ) :
+ descr(),
+ type(type),
+ r(0),
+ g(0),
+ b(0),
+ editable(false)
+{
+ switch (type) {
+ case CLEAR:
+ descr = _("remove");
+ break;
+ case NONE:
+ descr = _("none");
+ break;
+ case RGB:
+ descr = "";
+ break;
+ }
+}
+
ColorDef::ColorDef( unsigned int r, unsigned int g, unsigned int b, const std::string& description ) :
descr(description),
type(RGB),
index 764a28b12a105c70344ba5fed91c7eecadcfaefc..7e54182d6d8743f7c36ccd83b886e9c91fbad9e7 100644 (file)
enum ColorType{CLEAR, NONE, RGB};
ColorDef();
+ ColorDef(ColorType type);
ColorDef( unsigned int r, unsigned int g, unsigned int b, const std::string& description );
virtual ~ColorDef();