/**
* @file
* Inkscape color swatch UI item.
*/
/* Authors:
* Jon A. Cruz
* Abhishek Sharma
*
* Copyright (C) 2010 Jon A. Cruz
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <errno.h>
#include <cairo.h>
#include "color-item.h"
#include "desktop.h"
#include "desktop-style.h"
#include "display/cairo-utils.h"
#include "document.h"
#include "document-undo.h"
#include "inkscape.h" // for SP_ACTIVE_DESKTOP
#include "io/resource.h"
#include "message-context.h"
#include "sp-gradient.h"
#include "sp-item.h"
#include "svg/svg-color.h"
#include "verbs.h"
#include "widgets/gradient-vector.h"
#include "color.h" // for SP_RGBA32_U_COMPOSE
namespace Inkscape {
namespace UI {
namespace Dialogs {
// TODO remove this soon:
#endif // ENABLE_MAGIC_COLORS
static bool bruteForce( SPDocument* document, Inkscape::XML::Node* node, Glib::ustring const& match, int r, int g, int b )
{
bool changed = false;
if ( node ) {
gchar c[64] = {0};
changed = true;
}
gchar c[64] = {0};
changed = true;
}
}
return changed;
}
#endif // ENABLE_MAGIC_COLORS
if ( item ) {
item->buttonClicked(false);
}
}
if ( item ) {
item->buttonClicked(true);
}
}
static gboolean handleEnterNotify( GtkWidget* /*widget*/, GdkEventCrossing* /*event*/, gpointer callback_data ) {
if ( item ) {
if ( desktop ) {
gchar* msg = g_strdup_printf(_("Color: <b>%s</b>; <b>Click</b> to set fill, <b>Shift+click</b> to set stroke"),
}
}
return FALSE;
}
static gboolean handleLeaveNotify( GtkWidget* /*widget*/, GdkEventCrossing* /*event*/, gpointer callback_data ) {
if ( item ) {
if ( desktop ) {
}
}
return FALSE;
}
{
}
{
bool good = false;
{
good = true;
}
}
}
return good;
}
{
bool good = false;
}
// overflow
// failed conversion
} else {
good = true;
}
}
return good;
}
// TODO resolve this more cleanly:
extern gboolean colorItemHandleButtonPress( GtkWidget* /*widget*/, GdkEventButton* event, gpointer user_data);
{
if ( item )
{
-1,
&error);
} else {
if ( item->getGradient() ){
} else {
Glib::RefPtr<Gdk::Pixbuf> thumb = Gdk::Pixbuf::create( Gdk::COLORSPACE_RGB, false, 8, width, height );
}
}
}
}
//"drag-drop"
// gboolean dragDropColorData( GtkWidget *widget,
// GdkDragContext *drag_context,
// gint x,
// gint y,
// guint time,
// gpointer user_data)
// {
// // TODO finish
// return TRUE;
// }
: _prefWidth(0)
{
}
SwatchPage::~SwatchPage()
{
}
_isFill(false),
_isStroke(false),
_isLive(false),
_linkIsTone(false),
_linkPercent(0),
_linkGray(0),
_linkSrc(0),
_grad(0),
_pattern(0)
{
}
_isFill(false),
_isStroke(false),
_isLive(false),
_linkIsTone(false),
_linkPercent(0),
_linkGray(0),
_linkSrc(0),
_grad(0),
_pattern(0)
{
}
{
}
}
{
if ( this != &other ) {
*this = other;
}
}
{
if ( this != &other ) {
// TODO - correct linkage
g_message("Erk!");
}
return *this;
}
{
if ( _isFill ) {
val |= PREVIEW_FILL;
}
if ( _isStroke ) {
val |= PREVIEW_STROKE;
}
}
}
}
}
{
// TODO regen and push to listeners
}
}
{
//def.descr = name;
}
}
}
}
{
if (pattern) {
}
if (_pattern) {
}
}
GdkDragContext */*drag_context*/,
guint /*time*/,
{
} else {
}
char* tmp = 0;
int len = 0;
int format = 0;
if ( tmp ) {
delete[] tmp;
}
}
}
GdkDragContext */*drag_context*/,
GtkSelectionData */*data*/,
guint /*info*/,
guint /*event_time*/,
gpointer /*user_data*/)
{
}
{
if ( item ) {
item->_updatePreviews();
}
}
{
widget->queue_draw();
}
}
if ( (*it)->_linkIsTone ) {
} else {
}
}
// Look for objects using this color
{
if ( desktop ) {
if ( rroot ) {
// Find where this thing came from
bool found = false;
int index = 0;
for ( std::vector<SwatchPage*>::iterator it2 = possible.begin(); it2 != possible.end() && !found; ++it2 ) {
index = 0;
for ( boost::ptr_vector<ColorItem>::iterator zz = curr->_colors.begin(); zz != curr->_colors.end(); ++zz ) {
if ( this == &*zz ) {
found = true;
break;
} else {
index++;
}
}
}
if ( !paletteName.empty() ) {
str = 0;
_("Change color definition"));
}
}
}
}
}
#endif // ENABLE_MAGIC_COLORS
}
{
-1,
&error);
if (!pixbuf) {
}
}
else if ( !_pattern ){
} else {
// These correspond to PREVIEW_PIXBUF_WIDTH and VBLOCK from swatches.cpp
// TODO: the pattern to draw should be in the widget that draws the preview,
// so the preview can be scalable
int w = 128;
int h = 16;
}
| (_isLive ? PREVIEW_LINK_OTHER:0)) );
}
Gtk::Widget* ColorItem::getPreview(PreviewStyle style, ViewType view, ::PreviewSize size, guint ratio, guint border)
{
if ( style == PREVIEW_STYLE_BLURB) {
} else {
(::PreviewSize)size,
border );
"clicked",
this);
"alt-clicked",
this);
"button-press-event",
this);
{
// these next lines are order-dependent:
}
curr++;
}
for ( int i = 0; i < entryCount; i++ ) {
}
delete[] entries;
}
"drag-data-get",
this);
"drag-begin",
this );
"enter-notify-event",
this);
"leave-notify-event",
this);
"destroy",
this);
}
return widget;
}
{
if (desktop) {
// TODO actually make this clear
break;
}
break;
}
//mark
if ( _grad ){
colorspec = "url(#";
colorspec += ")";
} else {
gchar c[64];
sp_svg_write_color(c, sizeof(c), rgba);
colorspec = c;
}
//end mark
break;
}
}
}
}
{
if ( colorSet )
{
for ( boost::ptr_vector<ColorItem>::iterator it = colorSet->_colors.begin(); it != colorSet->_colors.end(); ++it )
{
{
{
//g_message("FOUND MAGIC at '%s'", (*it)->def.descr.c_str());
//g_message(" '%s'", subby.c_str());
{
}
{
}
// Tint. index + 1 more val.
}
}
}
grayLevel = 0;
}
}
}
}
}
}
}
}
}
{
if ( !_linkSrc )
{
_linkIsTone = false;
if ( _linkPercent > 100 )
_linkPercent = 100;
if ( _linkPercent < 0 )
_linkPercent = 0;
_linkGray = 0;
}
}
{
if ( !_linkSrc )
{
_linkIsTone = true;
if ( _linkPercent > 100 )
_linkPercent = 100;
if ( _linkPercent < 0 )
_linkPercent = 0;
}
}
} // namespace Dialogs
} // namespace UI
} // namespace Inkscape
/*
Local Variables:
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
indent-tabs-mode:nil
fill-column:99
End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :