mesh-toolbar.cpp revision 652485ad88d2a42f827c7e355220efeb3b2e37af
/*
* 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 "preferences.h"
#include "document-private.h"
#include "document-undo.h"
#include "desktop.h"
#include "desktop-handles.h"
#include "ui/tools/gradient-tool.h"
#include "ui/tools/mesh-tool.h"
#include "gradient-drag.h"
#include "sp-mesh-gradient.h"
#include "gradient-chemistry.h"
#include "gradient-selector.h"
#include "selection.h"
#include "ui/icon-names.h"
#include "ege-adjustment-action.h"
#include "ege-output-action.h"
#include "ege-select-one-action.h"
#include "ink-action.h"
#include "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 ##
//########################
/*
* Core function, setup all the widgets whenever something changes on the desktop
*/
{
// DOES NOTHING AT MOMENT
// std::cout << "ms_tb_selection_changed" << std::endl;
// if (blocked)
// return;
// GtkWidget *widget = GTK_WIDGET(data);
// SPDesktop *desktop = static_cast<SPDesktop *>(g_object_get_data(G_OBJECT(widget), "desktop"));
// if (!desktop) {
// return;
// }
// Inkscape::Selection *selection = sp_desktop_selection(desktop); // take from desktop, not from args
// if (selection) {
// ToolBase *ev = sp_desktop_event_context(desktop);
// GrDrag *drag = NULL;
// if (ev) {
// drag = ev->get_drag();
// }
// }
}
static void ms_tb_selection_modified(Inkscape::Selection *selection, guint /*flags*/, gpointer data)
{
}
{
}
{
}
{
}
/*
* Callback functions for user actions
*/
{
gint typemode = ege_select_one_action_get_active( act ) == 0 ? SP_GRADIENT_MESH_TYPE_NORMAL : SP_GRADIENT_MESH_TYPE_CONICAL;
}
{
Inkscape::PaintTarget fsmode = (ege_select_one_action_get_active( act ) == 0) ? Inkscape::FOR_FILL : Inkscape::FOR_STROKE;
}
{
if (blocked) {
return;
}
}
{
if (blocked) {
return;
}
}
static void mesh_toolbox_watch_ec(SPDesktop* dt, Inkscape::UI::Tools::ToolBase* ec, GObject* holder);
/**
* Mesh auxiliary toolbar construction and setup.
*
*/
{
EgeAdjustmentAction* eact = 0;
/* 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_type", SP_GRADIENT_MESH_TYPE_NORMAL) != SP_GRADIENT_MESH_TYPE_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"),
}
}
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 :