/*
* Gradient aux toolbar
*
* Authors:
* bulia byak <bulia@dr.com>
* Johan Engelen <j.b.c.engelen@ewi.utwente.nl>
* Abhishek Sharma
* Tavmjong Bah <tavjong@free.fr>
*
* Copyright (C) 2012 Tavmjong Bah
* Copyright (C) 2007 Johan Engelen
* Copyright (C) 2005 authors
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
// REVIEW THESE AT END OF REWRITE
#include "ui/widget/color-preview.h"
#include "toolbox.h"
#include "mesh-toolbar.h"
#include "verbs.h"
#include "macros.h"
#include "widgets/widget-sizes.h"
#include "widgets/spw-utilities.h"
#include "widgets/spinbutton-events.h"
#include "widgets/gradient-vector.h"
#include "widgets/gradient-image.h"
#include "style.h"
#include "inkscape.h"
#include "preferences.h"
#include "document-private.h"
#include "document-undo.h"
#include "desktop.h"
#include "ui/tools/gradient-tool.h"
#include "ui/tools/mesh-tool.h"
#include "gradient-drag.h"
#include "sp-mesh.h"
#include "gradient-chemistry.h"
#include "gradient-selector.h"
#include "selection.h"
#include "ui/icon-names.h"
#include "widgets/ege-adjustment-action.h"
#include "widgets/ege-output-action.h"
#include "widgets/ege-select-one-action.h"
#include "widgets/ink-action.h"
#include "widgets/ink-comboboxentry-action.h"
#include "sp-stop.h"
#include "svg/css-ostringstream.h"
#include "svg/svg-color.h"
#include "desktop-style.h"
#include "toolbox.h"
using Inkscape::DocumentUndo;
static bool blocked = false;
//########################
//## Mesh ##
//########################
/*
* Get the current selection and dragger status from the desktop
*/
bool &ms_selected_multi,
bool &ms_type_multi )
{
// Read desktop selection
bool first = true;
if ( SP_IS_MESH(server) ) {
if (gradient != ms_selected) {
if (ms_selected) {
ms_selected_multi = true;
} else {
}
}
ms_type_multi = true;
} else {
}
}
first = false;
}
}
if ( SP_IS_MESH(server) ) {
if (gradient != ms_selected) {
if (ms_selected) {
ms_selected_multi = true;
} else {
}
}
ms_type_multi = true;
} else {
}
}
first = false;
}
}
}
}
/*
* Core function, setup all the widgets whenever something changes on the desktop
*/
{
// std::cout << "ms_tb_selection_changed" << std::endl;
if (blocked)
return;
if (!desktop) {
return;
}
if (selection) {
// ToolBase *ev = sp_desktop_event_context(desktop);
// GrDrag *drag = NULL;
// if (ev) {
// drag = ev->get_drag();
// }
bool ms_selected_multi = false;
bool ms_type_multi = false;
// std::cout << " type: " << ms_type << std::endl;
EgeSelectOneAction* type = (EgeSelectOneAction *) g_object_get_data(G_OBJECT(widget), "mesh_select_type_action");
if (ms_selected) {
}
}
}
static void ms_tb_selection_modified(Inkscape::Selection *selection, guint /*flags*/, gpointer data)
{
}
{
}
{
}
{
}
{
}
}
if ( SP_IS_MESH(server) ) {
}
}
if (gradient) {
}
}
/*
* Callback functions for user actions
*/
{
gint geometrymode = ege_select_one_action_get_active( act ) == 0 ? SP_MESH_GEOMETRY_NORMAL : SP_MESH_GEOMETRY_CONICAL;
}
{
Inkscape::PaintTarget fsmode = (ege_select_one_action_get_active( act ) == 0) ? Inkscape::FOR_FILL : Inkscape::FOR_STROKE;
}
{
if (blocked) {
return;
}
}
{
if (blocked) {
return;
}
}
/**
* Sets mesh type: Coons, Bicubic
*/
{
// std::cout << "ms_type_changed" << std::endl;
if (blocked) {
return;
}
if (gradient) {
// std::cout << " type: " << type << std::endl;
gradient->updateRepr();
_("Set mesh type"));
}
}
/** Temporary hack: Returns the mesh tool in the active desktop.
* Will go away during tool refactoring. */
{
if (SP_ACTIVE_DESKTOP ) {
if (SP_IS_MESH_CONTEXT(ec)) {
}
}
return tool;
}
static void ms_toggle_sides(void)
{
if (mt) {
}
}
static void ms_make_elliptical(void)
{
if (mt) {
}
}
static void ms_pick_colors(void)
{
if (mt) {
}
}
static void mesh_toolbox_watch_ec(SPDesktop* dt, Inkscape::UI::Tools::ToolBase* ec, GObject* holder);
/**
* Mesh auxiliary toolbar construction and setup.
* Don't forget to add to XML in widgets/toolbox.cpp!
*
*/
{
/* New mesh: normal or conical */
{
EgeSelectOneAction* act = ege_select_one_action_new( "MeshNewTypeAction", (""), (""), NULL, GTK_TREE_MODEL(model) );
gint mode = prefs->getInt("/tools/mesh/mesh_geometry", SP_MESH_GEOMETRY_NORMAL) != SP_MESH_GEOMETRY_NORMAL;
}
/* New gradient on fill or stroke*/
{
EgeSelectOneAction* act = ege_select_one_action_new( "MeshNewFillStrokeAction", (""), (""), NULL, GTK_TREE_MODEL(model) );
/// @todo Convert to boolean?
}
/* Number of mesh rows */
{
_("Rows"), _("Rows:"), _("Number of rows in new mesh"),
1, 20, 1, 1,
1.0, 0 );
}
/* Number of mesh columns */
{
_("Columns"), _("Columns:"), _("Number of columns in new mesh"),
1, 20, 1, 1,
1.0, 0 );
}
/* Edit fill mesh */
{
_("Edit Fill"),
_("Edit fill mesh"),
INKSCAPE_ICON("object-fill"),
}
/* Edit stroke mesh */
{
_("Edit Stroke"),
_("Edit stroke mesh"),
INKSCAPE_ICON("object-stroke"),
}
{
_("Show Handles"),
_("Show side and tensor handles"),
INKSCAPE_ICON("show-node-handles"),
}
/* Warning */
{
}
/* Type */
{
_("Coons: no smoothing. Bicubic: smoothing across patch boundaries."),
}
{
_("Toggle Sides"),
_("Toggle selected sides between Beziers and lines."),
INKSCAPE_ICON("node-segment-line"),
}
{
_("Make elliptical"),
_("Make selected sides elliptical by changing length of handles. Works best if handles already approximate ellipse."),
INKSCAPE_ICON("node-segment-curve"),
}
{
_("Pick colors:"),
_("Pick colors for selected corner nodes from underneath mesh."),
INKSCAPE_ICON("color-picker"),
}
}
static void mesh_toolbox_watch_ec(SPDesktop* desktop, Inkscape::UI::Tools::ToolBase* ec, GObject* holder)
{
if (SP_IS_MESH_CONTEXT(ec)) {
// connect to selection modified and changed signals
c_selection_changed = selection->connectChanged(sigc::bind(sigc::ptr_fun(&ms_tb_selection_changed), holder));
c_selection_modified = selection->connectModified(sigc::bind(sigc::ptr_fun(&ms_tb_selection_modified), holder));
c_subselection_changed = desktop->connectToolSubselectionChanged(sigc::bind(sigc::ptr_fun(&ms_drag_selection_changed), holder));
c_defs_release = document->getDefs()->connectRelease(sigc::bind<1>(sigc::ptr_fun(&ms_defs_release), holder));
c_defs_modified = document->getDefs()->connectModified(sigc::bind<2>(sigc::ptr_fun(&ms_defs_modified), holder));
} else {
if (c_selection_changed)
if (c_selection_modified)
if (c_defs_release)
if (c_defs_modified)
}
}
/*
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 :