fill-style.cpp revision ef9d155a8149d4793471047b3836db719b9e0292
#define __SP_FILL_STYLE_C__
/**
* \brief Fill style widget
*
* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
* Frank Felfe <innerspace@iname.com>
* bulia byak <buliabyak@users.sf.net>
*
* Copyright (C) 1999-2005 authors
* Copyright (C) 2001-2002 Ximian, Inc.
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#define noSP_FS_VERBOSE
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <widgets/sp-widget.h>
#include <sp-linear-gradient.h>
#include <sp-pattern.h>
#include <sp-radial-gradient.h>
#include <widgets/paint-selector.h>
#include <style.h>
#include <gradient-chemistry.h>
#include <desktop-style.h>
#include <desktop-handles.h>
#include <selection.h>
#include <inkscape.h>
#include <document-private.h>
// These can be deleted once we sort out the libart dependence.
#define ART_WIND_RULE_NONZERO 0
SPPaintSelector *psel );
SPPaintSelector *psel );
static void sp_fill_style_widget_change_subselection ( Inkscape::Application *inkscape, SPDesktop *desktop, SPWidget *spw );
SPPaintSelector *psel );
sp_fill_style_widget_new (void)
{
spw );
spw );
spw );
spw );
//FIXME: switch these from spw signals to global inkscape object signals; spw just retranslates
//those anyway; then eliminate spw
g_signal_connect (INKSCAPE, "change_subselection", G_CALLBACK (sp_fill_style_widget_change_subselection), spw);
return spw;
} // end of sp_fill_style_widget_new()
static void
{
#ifdef SP_FS_VERBOSE
g_print ( "Fill style widget constructed: inkscape %p repr %p\n",
#endif
}
} // end of sp_fill_style_widget_construct()
static void
{
if (flags & ( SP_OBJECT_MODIFIED_FLAG |
{
}
}
static void
{
}
static void
{
}
/**
* \param sel Selection to use, or NULL.
*/
static void
{
return;
g_object_set_data (G_OBJECT (spw), "local", GINT_TO_POINTER (FALSE)); // local change; do nothing, but reset the flag
return;
}
// create temporary style
// query style from desktop into it. This returns a result flag and fills query with the style of subselection, if any, or selection
switch (result) {
case QUERY_STYLE_NOTHING:
{
/* No paint at all */
break;
}
case QUERY_STYLE_SINGLE:
case QUERY_STYLE_MULTIPLE_AVERAGED: // TODO: treat this slightly differently, e.g. display "averaged" somewhere in paint selector
{
gfloat d[3];
if (SP_IS_LINEARGRADIENT (server)) {
SP_GRADIENT_SPREAD (lg));
} else if (SP_IS_RADIALGRADIENT (server)) {
SP_GRADIENT_SPREAD (rg));
} else if (SP_IS_PATTERN (server)) {
}
}
break;
}
{
break;
}
}
}
static void
{
return;
/* TODO: Does this work? */
/* TODO: Not really, here we have to get old color back from object */
/* Instead of relying on paint widget having meaningful colors set */
}
static void
{
return;
sp_repr_css_set_property (css, "fill-rule", mode == SP_PAINT_SELECTOR_FILLRULE_EVENODD? "evenodd":"nonzero");
_("Change fill rule"));
}
/**
This is called repeatedly while you are dragging a color slider, only for flat color
modes. Previously it set the color in style but did not update the repr for efficiency, however
this was flakey and didn't buy us almost anything. So now it does the same as _changed, except
lumps all its changes for undo.
*/
static void
{
return;
}
return;
}
// previous local flag not cleared yet;
// this means dragged events come too fast, so we better skip this one to speed up display
// (it's safe to do this in any case)
return;
}
{
sp_document_maybe_done (sp_desktop_document(SP_ACTIVE_DESKTOP), undo_label, SP_VERB_DIALOG_FILL_STROKE,
_("Set fill color"));
g_object_set_data (G_OBJECT (spw), "local", GINT_TO_POINTER (TRUE)); // local change, do not update from selection
break;
}
default:
g_warning ( "file %s: line %d: Paint %d should not emit 'dragged'",
break;
}
}
/**
This is called (at least) when:
1 paint selector mode is switched (e.g. flat color -> gradient)
2 you finished dragging a gradient node and released mouse
3 you changed a gradient selector parameter (e.g. spread)
Must update repr.
*/
static void
{
return;
}
if (!desktop) {
return;
}
// This should not happen.
g_warning ( "file %s: line %d: Paint %d should not emit 'changed'",
break;
// This happens when you switch multiple objects with different gradients to flat color;
// nothing to do here.
break;
{
_("Remove fill"));
break;
}
{
_("Set fill color"));
// on release, toggle undo_label so that the next drag will not be lumped with this one
if (undo_label == undo_label_1)
else
break;
}
if (items) {
// HACK: reset fill-opacity - that 0.75 is annoying; BUT remove this when we have an opacity slider for all tabs
if (!vector) {
/* No vector in paint selector should mean that we just changed mode */
guint32 common_rgb = 0;
if (result == QUERY_STYLE_MULTIPLE_SAME) {
} else {
}
}
//FIXME: see above
if (!vector) {
gradient_type, true);
} else {
}
}
} else {
* this gradient type. */
//FIXME: see above
}
}
_("Set gradient on fill"));
}
break;
if (items) {
if (!pattern) {
/* No Pattern in paint selector should mean that we just
* changed mode - dont do jack.
*/
} else {
// HACK: reset fill-opacity - that 0.75 is annoying; BUT remove this when we have an opacity slider for all tabs
// cannot just call sp_desktop_set_style, because we don't want to touch those
// objects who already have the same root pattern but through a different href
// chain. FIXME: move this to a sp_item_set_pattern
// only if this object's pattern is not rooted in our selected pattern, apply
continue;
}
}
} // end if
_("Set pattern on fill"));
} // end if
break;
if (items) {
_("Unset fill"));
}
break;
default:
g_warning ( "file %s: line %d: Paint selector should not be in "
"mode %d",
break;
}
}
/*
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:encoding=utf-8:textwidth=99 :