summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ed781c9)
raw | patch | inline | side by side (parent: ed781c9)
author | JucaBlues <JucaBlues@users.sourceforge.net> | |
Sat, 24 Jan 2009 08:09:52 +0000 (08:09 +0000) | ||
committer | JucaBlues <JucaBlues@users.sourceforge.net> | |
Sat, 24 Jan 2009 08:09:52 +0000 (08:09 +0000) |
share/icons/Makefile.am | patch | blob | history | |
share/icons/remove-color.png | [new file with mode: 0644] | patch | blob |
share/icons/remove-color.svg | [new file with mode: 0644] | patch | blob |
src/dialogs/eek-preview.cpp | patch | blob | history | |
src/dialogs/eek-preview.h | patch | blob | history | |
src/dialogs/swatches.cpp | patch | blob | history | |
src/dialogs/swatches.h | patch | blob | history |
index 0c666d212c66e11663124599f5929c3e6df53393..e3bc8e05bed1cb2fd983c9e4dae3a82bd1a16e2e 100644 (file)
--- a/share/icons/Makefile.am
+++ b/share/icons/Makefile.am
iconsdir = $(datadir)/inkscape/icons
pixmaps = \
+ remove-color.png \
+ remove-color.svg \
ticotico.jpg \
feBlend-icon.png \
feBlend-icon.svg \
diff --git a/share/icons/remove-color.png b/share/icons/remove-color.png
new file mode 100644 (file)
index 0000000..24ab982
Binary files /dev/null and b/share/icons/remove-color.png differ
index 0000000..24ab982
Binary files /dev/null and b/share/icons/remove-color.png differ
diff --git a/share/icons/remove-color.svg b/share/icons/remove-color.svg
--- /dev/null
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="32"
+ height="32"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.46+devel r custom"
+ version="1.0"
+ sodipodi:docname="remove-color.svg"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape"
+ inkscape:export-filename="/home/felipe/devel/inkscape/share/icons/remove-color.png"
+ inkscape:export-xdpi="300"
+ inkscape:export-ydpi="300">
+ <defs
+ id="defs4">
+ <inkscape:perspective
+ sodipodi:type="inkscape:persp3d"
+ inkscape:vp_x="0 : 526.18109 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_z="744.09448 : 526.18109 : 1"
+ inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
+ id="perspective10" />
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="1"
+ inkscape:pageshadow="2"
+ inkscape:zoom="17.4375"
+ inkscape:cx="16"
+ inkscape:cy="16"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="false"
+ inkscape:window-width="1440"
+ inkscape:window-height="825"
+ inkscape:window-x="0"
+ inkscape:window-y="25" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Camada 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <path
+ style="stroke-width:8;fill:none;stroke:#ff0000;stroke-opacity:1;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-linecap:round"
+ d="M 4,28 28,4"
+ id="path2842"
+ sodipodi:nodetypes="cc"
+ inkscape:export-filename="/home/felipe/Área de Trabalho/remove-color.png"
+ inkscape:export-xdpi="90"
+ inkscape:export-ydpi="90" />
+ <path
+ sodipodi:nodetypes="cc"
+ id="path3616"
+ d="M 28,28 4,4"
+ style="stroke-width:8;fill:none;stroke:#ff0000;stroke-opacity:1;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-linecap:round"
+ inkscape:export-filename="/home/felipe/Área de Trabalho/remove-color.png"
+ inkscape:export-xdpi="90"
+ inkscape:export-ydpi="90" />
+ </g>
+</svg>
index f9aadc561f8e9c4a98b3bdd869fca99a371c484a..a4e28b2fd82a8db92719567072e64785ca0c78f6 100644 (file)
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
#include <gtk/gtk.h>
#include "eek-preview.h"
+#include "path-prefix.h"
#define PRIME_BUTTON_MAGIC_NUMBER 1
void eek_preview_set_color( EekPreview* preview, int r, int g, int b )
{
- if ( (preview->_r = r)
- || (preview->_g = g)
- || (preview->_b = b) ) {
- preview->_r = r;
- preview->_g = g;
- preview->_b = b;
-
- gtk_widget_queue_draw(GTK_WIDGET(preview));
- }
+ preview->_r = r;
+ preview->_g = g;
+ preview->_b = b;
+
+ gtk_widget_queue_draw(GTK_WIDGET(preview));
}
GdkGC *gc = gdk_gc_new( widget->window );
EekPreview* preview = EEK_PREVIEW(widget);
GdkColor fg = {0, preview->_r, preview->_g, preview->_b};
+
gdk_colormap_alloc_color( gdk_colormap_get_system(), &fg, FALSE, TRUE );
gdk_gc_set_foreground( gc, &fg );
}
}
+ if (preview->_isRemove){
+ GtkDrawingArea* da = &(preview->drawing);
+ GdkDrawable* drawable = (GdkDrawable*) (((GtkWidget*)da)->window);
+ gint w,h;
+ gdk_drawable_get_size(drawable, &w, &h);
+ GError *error = NULL;
+ gchar *filepath = (gchar *) g_strdup_printf("%s/remove-color.png", INKSCAPE_PIXMAPDIR);
+ g_warning("filepath: %s", filepath);
+ gsize bytesRead = 0;
+ gsize bytesWritten = 0;
+ gchar *localFilename = g_filename_from_utf8( filepath,
+ -1,
+ &bytesRead,
+ &bytesWritten,
+ &error);
+ GdkPixbuf* pixbuf = gdk_pixbuf_new_from_file_at_size(localFilename, w, h, &error);
+ gdk_draw_pixbuf(drawable, 0, pixbuf, 0, 0, 0, 0, w, h, GDK_RGB_DITHER_NONE, 0, 0);
+ g_free(localFilename);
+ g_free(filepath);
+ }
+
+
if ( GTK_WIDGET_HAS_FOCUS(widget) ) {
gtk_paint_focus( style,
widget->window,
preview->_hot = FALSE;
preview->_within = FALSE;
preview->_takesFocus = FALSE;
+ preview->_isRemove = FALSE;
preview->_prevstyle = PREVIEW_STYLE_ICON;
preview->_view = VIEW_TYPE_LIST;
index 40597eb486c84f908e7eb3925bd2ca04b724bbc2..e01472f1e79e7106ae12239b607a8649cf305f3f 100644 (file)
gboolean _hot;
gboolean _within;
gboolean _takesFocus;
+ gboolean _isRemove;
PreviewStyle _prevstyle;
ViewType _view;
index 2eb30f27cadca86a3906b3ce1931ff0f6f91a46f..13c65f7075b59979216a1759389aa224ad97774a 100644 (file)
--- a/src/dialogs/swatches.cpp
+++ b/src/dialogs/swatches.cpp
namespace UI {
namespace Dialogs {
-
+ColorItem::ColorItem() : _isRemove(true){};
ColorItem::ColorItem( unsigned int r, unsigned int g, unsigned int b, Glib::ustring& name ) :
def( r, g, b, name ),
+ _isRemove(false),
_isLive(false),
_linkIsTone(false),
_linkPercent(0),
Gtk::Widget* ColorItem::getPreview(PreviewStyle style, ViewType view, ::PreviewSize size, guint ratio)
{
Gtk::Widget* widget = 0;
- if ( style == PREVIEW_STYLE_BLURB ) {
+ if ( style == PREVIEW_STYLE_BLURB) {
Gtk::Label *lbl = new Gtk::Label(def.descr);
lbl->set_alignment(Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER);
widget = lbl;
@@ -547,6 +548,7 @@ Gtk::Widget* ColorItem::getPreview(PreviewStyle style, ViewType view, ::PreviewS
Gtk::Widget* newBlot = Glib::wrap(eekWidget);
eek_preview_set_color( preview, (def.getR() << 8) | def.getR(), (def.getG() << 8) | def.getG(), (def.getB() << 8) | def.getB());
+ preview->_isRemove = _isRemove;
eek_preview_set_details( preview, (::PreviewStyle)style, (::ViewType)view, (::PreviewSize)size, ratio );
eek_preview_set_linked( preview, (LinkType)((_linkSrc ? PREVIEW_LINK_IN:0)
@@ -658,25 +660,29 @@ Gtk::Widget* ColorItem::getPreview(PreviewStyle style, ViewType view, ::PreviewS
void ColorItem::buttonClicked(bool secondary)
{
SPDesktop *desktop = SP_ACTIVE_DESKTOP;
- if (desktop) {
- char const * attrName = secondary ? "stroke" : "fill";
+ if (!desktop) return;
+ char const * attrName = secondary ? "stroke" : "fill";
+
+ gchar c[64];
+ if (!_isRemove){
guint32 rgba = (def.getR() << 24) | (def.getG() << 16) | (def.getB() << 8) | 0xff;
- gchar c[64];
sp_svg_write_color(c, sizeof(c), rgba);
+ }
- SPCSSAttr *css = sp_repr_css_attr_new();
- sp_repr_css_set_property( css, attrName, c );
- sp_desktop_set_style(desktop, css);
+ SPCSSAttr *css = sp_repr_css_attr_new();
+ sp_repr_css_set_property( css, attrName, _isRemove ? "none" : c );
+ sp_desktop_set_style(desktop, css);
+ sp_repr_css_attr_unref(css);
- sp_repr_css_attr_unref(css);
+ if (_isRemove){
sp_document_done (sp_desktop_document (desktop), SP_VERB_DIALOG_SWATCHES,
- secondary? _("Set stroke color from swatch") : _("Set fill color from swatch"));
+ secondary? _("Remove stroke color") : _("Remove fill color"));
+ } else {
+ sp_document_done (sp_desktop_document (desktop), SP_VERB_DIALOG_SWATCHES,
+ secondary? _("Set stroke color from swatch") : _("Set fill color from swatch"));
}
}
-
-
-
static char* trim( char* str ) {
char* ret = str;
while ( *str && (*str == ' ' || *str == '\t') ) {
{
Gtk::RadioMenuItem* hotItem = 0;
_holder = new PreviewHolder();
+ _remove = new ColorItem();
loadEmUp();
-
if ( !possible.empty() ) {
JustForNow* first = 0;
Glib::ustring targetName;
_holder->setColumnPref( first->_prefWidth );
}
_holder->freezeUpdates();
+ _holder->addPreview(_remove);
for ( std::vector<ColorItem*>::iterator it = first->_colors.begin(); it != first->_colors.end(); it++ ) {
_holder->addPreview(*it);
}
_holder->thawUpdates();
Gtk::RadioMenuItem::Group groupOne;
+
int i = 0;
for ( std::vector<JustForNow*>::iterator it = possible.begin(); it != possible.end(); it++ ) {
JustForNow* curr = *it;
_regItem( single, 3, i );
i++;
}
-
}
SwatchesPanel::~SwatchesPanel()
{
+ if (_remove) delete _remove;
+ if (_holder) delete _holder;
}
void SwatchesPanel::setOrientation( Gtk::AnchorType how )
_holder->setColumnPref( curr->_prefWidth );
}
_holder->freezeUpdates();
+ _holder->addPreview(_remove);
for ( std::vector<ColorItem*>::iterator it = curr->_colors.begin(); it != curr->_colors.end(); it++ ) {
_holder->addPreview(*it);
}
diff --git a/src/dialogs/swatches.h b/src/dialogs/swatches.h
index fc3c772b869cdb7a1c8d2cd54aca840f09d68059..cc0cf89561681ed8591774c0942e5a029bf53e50 100644 (file)
--- a/src/dialogs/swatches.h
+++ b/src/dialogs/swatches.h
void _loadPaletteFile( gchar const *filename );
-
/**
* The color swatch you see on screen as a clickable box.
*/
{
friend void _loadPaletteFile( gchar const *filename );
public:
+ ColorItem();
ColorItem( unsigned int r, unsigned int g, unsigned int b,
Glib::ustring& name );
virtual ~ColorItem();
Gtk::Tooltips tips;
std::vector<Gtk::Widget*> _previews;
+ bool _isRemove;
bool _isLive;
bool _linkIsTone;
int _linkPercent;
ColorItem* _linkSrc;
std::vector<ColorItem*> _listeners;
};
-
+class RemoveColorItem;
/**
* A panel that displays color swatches.
static SwatchesPanel* instance;
PreviewHolder* _holder;
+ ColorItem* _remove;
};
} //namespace Dialogs