spray-toolbar.cpp revision 697b11488283824ba02d89a002384737af86e437
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz/**
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz * @file
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz * Spray aux toolbar
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz */
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz/* Authors:
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz * MenTaLguY <mental@rydia.net>
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz * Lauris Kaplinski <lauris@kaplinski.com>
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz * bulia byak <buliabyak@users.sf.net>
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz * Frank Felfe <innerspace@iname.com>
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz * John Cliff <simarilius@yahoo.com>
00339f176618a0eebcbb2261306a9cd841ad43ecJon A. Cruz * David Turner <novalis@gnu.org>
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz * Josh Andler <scislac@scislac.com>
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz * Jon A. Cruz <jon@joncruz.org>
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz * Maximilian Albert <maximilian.albert@gmail.com>
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz * Tavmjong Bah <tavmjong@free.fr>
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz * Abhishek Sharma
00339f176618a0eebcbb2261306a9cd841ad43ecJon A. Cruz * Kris De Gussem <Kris.DeGussem@gmail.com>
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz * Jabiertxo Arraiza <jabier.arraiza@marker.es>
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz *
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz * Copyright (C) 2004 David Turner
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz * Copyright (C) 2003 MenTaLguY
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz * Copyright (C) 1999-2015 authors
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz * Copyright (C) 2001-2002 Ximian, Inc.
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz *
47badd0035ae8c9135c51444f3770b17ae504ddaAlex Valavanis * Released under GNU GPL, read the file 'COPYING' for more information
47badd0035ae8c9135c51444f3770b17ae504ddaAlex Valavanis */
47badd0035ae8c9135c51444f3770b17ae504ddaAlex Valavanis
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz#ifdef HAVE_CONFIG_H
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz# include "config.h"
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz#endif
17238dd97c572210f1036dd8a7a8657e67bfa9c3Campbell Barton
c864652e7fca4ed7605835d5cb6661dc422cabaaJon A. Cruz#include <gtkmm.h>
c864652e7fca4ed7605835d5cb6661dc422cabaaJon A. Cruz
c864652e7fca4ed7605835d5cb6661dc422cabaaJon A. Cruz#include "spray-toolbar.h"
c864652e7fca4ed7605835d5cb6661dc422cabaaJon A. Cruz#include "desktop.h"
c864652e7fca4ed7605835d5cb6661dc422cabaaJon A. Cruz#include "inkscape.h"
c864652e7fca4ed7605835d5cb6661dc422cabaaJon A. Cruz#include "document-undo.h"
c864652e7fca4ed7605835d5cb6661dc422cabaaJon A. Cruz#include "widgets/ege-adjustment-action.h"
c864652e7fca4ed7605835d5cb6661dc422cabaaJon A. Cruz#include "widgets/ege-select-one-action.h"
c864652e7fca4ed7605835d5cb6661dc422cabaaJon A. Cruz#include "widgets/ink-action.h"
c864652e7fca4ed7605835d5cb6661dc422cabaaJon A. Cruz#include "preferences.h"
c864652e7fca4ed7605835d5cb6661dc422cabaaJon A. Cruz#include "toolbox.h"
c864652e7fca4ed7605835d5cb6661dc422cabaaJon A. Cruz#include "ui/dialog/clonetiler.h"
c864652e7fca4ed7605835d5cb6661dc422cabaaJon A. Cruz#include "ui/dialog/dialog-manager.h"
2c312e5f8adf7306ce4b41fb6639475df9c3ea87Jon A. Cruz#include "ui/dialog/panel-dialog.h"
2c312e5f8adf7306ce4b41fb6639475df9c3ea87Jon A. Cruz#include "ui/icon-names.h"
2c312e5f8adf7306ce4b41fb6639475df9c3ea87Jon A. Cruz
c864652e7fca4ed7605835d5cb6661dc422cabaaJon A. Cruz#include <glibmm/i18n.h>
c864652e7fca4ed7605835d5cb6661dc422cabaaJon A. Cruz
c864652e7fca4ed7605835d5cb6661dc422cabaaJon A. Cruzusing Inkscape::DocumentUndo;
c864652e7fca4ed7605835d5cb6661dc422cabaaJon A. Cruzusing Inkscape::UI::ToolboxFactory;
c864652e7fca4ed7605835d5cb6661dc422cabaaJon A. Cruzusing Inkscape::UI::PrefPusher;
17238dd97c572210f1036dd8a7a8657e67bfa9c3Campbell Barton
c864652e7fca4ed7605835d5cb6661dc422cabaaJon A. Cruz// Disabled in 0.91 because of Bug #1274831 (crash, spraying an object
c864652e7fca4ed7605835d5cb6661dc422cabaaJon A. Cruz// with the mode: spray object in single path)
c864652e7fca4ed7605835d5cb6661dc422cabaaJon A. Cruz// Please enable again when working on 1.0
c864652e7fca4ed7605835d5cb6661dc422cabaaJon A. Cruz#define ENABLE_SPRAY_MODE_SINGLE_PATH
c864652e7fca4ed7605835d5cb6661dc422cabaaJon A. Cruz
c864652e7fca4ed7605835d5cb6661dc422cabaaJon A. Cruz//########################
c864652e7fca4ed7605835d5cb6661dc422cabaaJon A. Cruz//## Spray ##
c864652e7fca4ed7605835d5cb6661dc422cabaaJon A. Cruz//########################
c864652e7fca4ed7605835d5cb6661dc422cabaaJon A. Cruz
c864652e7fca4ed7605835d5cb6661dc422cabaaJon A. Cruzstatic void sp_stb_sensitivize( GObject *tbl )
c864652e7fca4ed7605835d5cb6661dc422cabaaJon A. Cruz{
c864652e7fca4ed7605835d5cb6661dc422cabaaJon A. Cruz GtkAction* offset = GTK_ACTION( g_object_get_data(tbl, "offset") );
c864652e7fca4ed7605835d5cb6661dc422cabaaJon A. Cruz GtkAction* spray_scale = GTK_ACTION( g_object_get_data(tbl, "spray_scale") );
c864652e7fca4ed7605835d5cb6661dc422cabaaJon A. Cruz GtkAdjustment *adj_offset = ege_adjustment_action_get_adjustment( EGE_ADJUSTMENT_ACTION(offset) );
c864652e7fca4ed7605835d5cb6661dc422cabaaJon A. Cruz GtkAdjustment *adj_scale = ege_adjustment_action_get_adjustment( EGE_ADJUSTMENT_ACTION(spray_scale) );
c864652e7fca4ed7605835d5cb6661dc422cabaaJon A. Cruz GtkToggleAction *no_overlap = GTK_TOGGLE_ACTION( g_object_get_data(tbl, "no_overlap") );
c864652e7fca4ed7605835d5cb6661dc422cabaaJon A. Cruz GtkToggleAction *picker = GTK_TOGGLE_ACTION( g_object_get_data(tbl, "picker") );
c864652e7fca4ed7605835d5cb6661dc422cabaaJon A. Cruz GtkAction* picker_action = GTK_ACTION( g_object_get_data(tbl, "picker") );
c864652e7fca4ed7605835d5cb6661dc422cabaaJon A. Cruz GtkToggleAction *usepressurescale = GTK_TOGGLE_ACTION( g_object_get_data(tbl, "usepressurescale") );
c864652e7fca4ed7605835d5cb6661dc422cabaaJon A. Cruz GtkAction *pick_fill = GTK_ACTION( g_object_get_data(tbl, "pick_fill") );
c864652e7fca4ed7605835d5cb6661dc422cabaaJon A. Cruz GtkAction *pick_stroke = GTK_ACTION( g_object_get_data(tbl, "pick_stroke") );
c864652e7fca4ed7605835d5cb6661dc422cabaaJon A. Cruz GtkAction *pick_inverse_value = GTK_ACTION( g_object_get_data(tbl, "pick_inverse_value") );
c864652e7fca4ed7605835d5cb6661dc422cabaaJon A. Cruz GtkAction *pick_center = GTK_ACTION( g_object_get_data(tbl, "pick_center") );
c864652e7fca4ed7605835d5cb6661dc422cabaaJon A. Cruz gtk_adjustment_set_value( adj_offset, 100.0 );
c864652e7fca4ed7605835d5cb6661dc422cabaaJon A. Cruz if (gtk_toggle_action_get_active(no_overlap) && gtk_action_get_sensitive(picker_action)) {
c864652e7fca4ed7605835d5cb6661dc422cabaaJon A. Cruz gtk_action_set_sensitive( offset, TRUE );
c864652e7fca4ed7605835d5cb6661dc422cabaaJon A. Cruz } else {
c864652e7fca4ed7605835d5cb6661dc422cabaaJon A. Cruz gtk_action_set_sensitive( offset, FALSE );
c864652e7fca4ed7605835d5cb6661dc422cabaaJon A. Cruz }
c864652e7fca4ed7605835d5cb6661dc422cabaaJon A. Cruz if (gtk_toggle_action_get_active(usepressurescale)) {
c864652e7fca4ed7605835d5cb6661dc422cabaaJon A. Cruz gtk_adjustment_set_value( adj_scale, 0.0 );
c864652e7fca4ed7605835d5cb6661dc422cabaaJon A. Cruz gtk_action_set_sensitive( spray_scale, FALSE );
c864652e7fca4ed7605835d5cb6661dc422cabaaJon A. Cruz } else {
c864652e7fca4ed7605835d5cb6661dc422cabaaJon A. Cruz gtk_action_set_sensitive( spray_scale, TRUE );
c864652e7fca4ed7605835d5cb6661dc422cabaaJon A. Cruz }
c864652e7fca4ed7605835d5cb6661dc422cabaaJon A. Cruz if(gtk_toggle_action_get_active(picker) && gtk_action_get_sensitive(picker_action)){
c864652e7fca4ed7605835d5cb6661dc422cabaaJon A. Cruz gtk_action_set_sensitive( pick_fill, TRUE );
c864652e7fca4ed7605835d5cb6661dc422cabaaJon A. Cruz gtk_action_set_sensitive( pick_stroke, TRUE );
c864652e7fca4ed7605835d5cb6661dc422cabaaJon A. Cruz gtk_action_set_sensitive( pick_inverse_value, TRUE );
c864652e7fca4ed7605835d5cb6661dc422cabaaJon A. Cruz gtk_action_set_sensitive( pick_center, TRUE );
c864652e7fca4ed7605835d5cb6661dc422cabaaJon A. Cruz } else {
c864652e7fca4ed7605835d5cb6661dc422cabaaJon A. Cruz gtk_action_set_sensitive( pick_fill, FALSE );
c864652e7fca4ed7605835d5cb6661dc422cabaaJon A. Cruz gtk_action_set_sensitive( pick_stroke, FALSE );
c864652e7fca4ed7605835d5cb6661dc422cabaaJon A. Cruz gtk_action_set_sensitive( pick_inverse_value, FALSE );
c864652e7fca4ed7605835d5cb6661dc422cabaaJon A. Cruz gtk_action_set_sensitive( pick_center, FALSE );
c864652e7fca4ed7605835d5cb6661dc422cabaaJon A. Cruz }
c864652e7fca4ed7605835d5cb6661dc422cabaaJon A. Cruz}
c864652e7fca4ed7605835d5cb6661dc422cabaaJon A. Cruz
c864652e7fca4ed7605835d5cb6661dc422cabaaJon A. Cruzstatic void sp_spray_erase_sensitivize( GObject *tbl, bool sensitive){
c864652e7fca4ed7605835d5cb6661dc422cabaaJon A. Cruz gtk_action_set_sensitive( GTK_ACTION( g_object_get_data(tbl, "rotate") ), sensitive );
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz gtk_action_set_sensitive( GTK_ACTION( g_object_get_data(tbl, "no_overlap") ), sensitive );
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz gtk_action_set_sensitive( GTK_ACTION( g_object_get_data(tbl, "over_no_transparent") ), sensitive );
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz gtk_action_set_sensitive( GTK_ACTION( g_object_get_data(tbl, "over_transparent") ), sensitive );
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz gtk_action_set_sensitive( GTK_ACTION( g_object_get_data(tbl, "pick_no_overlap") ), sensitive );
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz gtk_action_set_sensitive( GTK_ACTION( g_object_get_data(tbl, "pick_stroke") ), sensitive );
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz gtk_action_set_sensitive( GTK_ACTION( g_object_get_data(tbl, "pick_fill") ), sensitive );
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz gtk_action_set_sensitive( GTK_ACTION( g_object_get_data(tbl, "pick_inverse_value") ), sensitive );
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz gtk_action_set_sensitive( GTK_ACTION( g_object_get_data(tbl, "pick_center") ), sensitive );
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz gtk_action_set_sensitive( GTK_ACTION( g_object_get_data(tbl, "picker") ), sensitive );
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz gtk_action_set_sensitive( GTK_ACTION( g_object_get_data(tbl, "offset") ), sensitive );
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz sp_stb_sensitivize( tbl );
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz}
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. CruzInkscape::UI::Dialog::CloneTiler *get_clone_tiler_panel(SPDesktop *desktop)
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz{
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz if (Inkscape::UI::Dialog::PanelDialogBase *panel_dialog =
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz dynamic_cast<Inkscape::UI::Dialog::PanelDialogBase *>(desktop->_dlg_mgr->getDialog("CloneTiler"))) {
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz try {
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz Inkscape::UI::Dialog::CloneTiler &clone_tiler =
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz dynamic_cast<Inkscape::UI::Dialog::CloneTiler &>(panel_dialog->getPanel());
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz return &clone_tiler;
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz } catch (std::exception &e) { }
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz }
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz return 0;
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz}
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruzstatic void sp_spray_width_value_changed( GtkAdjustment *adj, GObject * /*tbl*/ )
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz{
2c312e5f8adf7306ce4b41fb6639475df9c3ea87Jon A. Cruz Inkscape::Preferences *prefs = Inkscape::Preferences::get();
2c312e5f8adf7306ce4b41fb6639475df9c3ea87Jon A. Cruz prefs->setDouble( "/tools/spray/width",
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz gtk_adjustment_get_value(adj));
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz}
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruzstatic void sp_spray_mean_value_changed( GtkAdjustment *adj, GObject * /*tbl*/ )
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz{
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz Inkscape::Preferences *prefs = Inkscape::Preferences::get();
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz prefs->setDouble( "/tools/spray/mean",
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz gtk_adjustment_get_value(adj));
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz}
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruzstatic void sp_spray_standard_deviation_value_changed( GtkAdjustment *adj, GObject * /*tbl*/ )
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz{
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz Inkscape::Preferences *prefs = Inkscape::Preferences::get();
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz prefs->setDouble( "/tools/spray/standard_deviation",
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz gtk_adjustment_get_value(adj));
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz}
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruzstatic void sp_spray_mode_changed( EgeSelectOneAction *act, GObject * tbl )
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz{
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz int mode = ege_select_one_action_get_active( act );
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz Inkscape::Preferences *prefs = Inkscape::Preferences::get();
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz prefs->setInt("/tools/spray/mode", mode);
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz if(mode != 3){
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz sp_spray_erase_sensitivize(tbl, true);
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz } else {
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz sp_spray_erase_sensitivize(tbl, false);
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz }
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz}
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruzstatic void sp_spray_population_value_changed( GtkAdjustment *adj, GObject * /*tbl*/ )
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz{
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz Inkscape::Preferences *prefs = Inkscape::Preferences::get();
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz prefs->setDouble( "/tools/spray/population",
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz gtk_adjustment_get_value(adj));
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz}
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruzstatic void sp_spray_rotation_value_changed( GtkAdjustment *adj, GObject * /*tbl*/ )
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz{
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz Inkscape::Preferences *prefs = Inkscape::Preferences::get();
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz prefs->setDouble( "/tools/spray/rotation_variation",
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz gtk_adjustment_get_value(adj));
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz}
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruzstatic void sp_spray_scale_value_changed( GtkAdjustment *adj, GObject * /*tbl*/ )
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz{
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz Inkscape::Preferences *prefs = Inkscape::Preferences::get();
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz prefs->setDouble( "/tools/spray/scale_variation",
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz gtk_adjustment_get_value(adj));
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz}
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruzstatic void sp_spray_offset_value_changed( GtkAdjustment *adj, GObject * /*tbl*/ )
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz{
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz Inkscape::Preferences *prefs = Inkscape::Preferences::get();
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz prefs->setDouble( "/tools/spray/offset",
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz gtk_adjustment_get_value(adj));
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz}
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruzstatic void sp_toggle_no_overlap( GtkToggleAction* act, gpointer data)
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz{
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz Inkscape::Preferences *prefs = Inkscape::Preferences::get();
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz gboolean active = gtk_toggle_action_get_active(act);
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz prefs->setBool("/tools/spray/no_overlap", active);
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz GObject *tbl = G_OBJECT(data);
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz sp_stb_sensitivize(tbl);
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz}
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruzstatic void sp_toggle_pressure_scale( GtkToggleAction* act, gpointer data)
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz{
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz Inkscape::Preferences *prefs = Inkscape::Preferences::get();
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz gboolean active = gtk_toggle_action_get_active(act);
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz prefs->setBool("/tools/spray/usepressurescale", active);
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz if(active == true){
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz prefs->setDouble("/tools/spray/scale_variation", 0);
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz }
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz GObject *tbl = G_OBJECT(data);
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz sp_stb_sensitivize( tbl );
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz}
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruzstatic void sp_toggle_over_no_transparent( GtkToggleAction* act, gpointer data)
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz{
00339f176618a0eebcbb2261306a9cd841ad43ecJon A. Cruz Inkscape::Preferences *prefs = Inkscape::Preferences::get();
00339f176618a0eebcbb2261306a9cd841ad43ecJon A. Cruz gboolean active = gtk_toggle_action_get_active(act);
00339f176618a0eebcbb2261306a9cd841ad43ecJon A. Cruz prefs->setBool("/tools/spray/over_no_transparent", active);
00339f176618a0eebcbb2261306a9cd841ad43ecJon A. Cruz}
00339f176618a0eebcbb2261306a9cd841ad43ecJon A. Cruz
00339f176618a0eebcbb2261306a9cd841ad43ecJon A. Cruzstatic void sp_toggle_over_transparent( GtkToggleAction* act, gpointer data)
00339f176618a0eebcbb2261306a9cd841ad43ecJon A. Cruz{
00339f176618a0eebcbb2261306a9cd841ad43ecJon A. Cruz Inkscape::Preferences *prefs = Inkscape::Preferences::get();
00339f176618a0eebcbb2261306a9cd841ad43ecJon A. Cruz gboolean active = gtk_toggle_action_get_active(act);
00339f176618a0eebcbb2261306a9cd841ad43ecJon A. Cruz prefs->setBool("/tools/spray/over_transparent", active);
00339f176618a0eebcbb2261306a9cd841ad43ecJon A. Cruz}
00339f176618a0eebcbb2261306a9cd841ad43ecJon A. Cruz
00339f176618a0eebcbb2261306a9cd841ad43ecJon A. Cruz
00339f176618a0eebcbb2261306a9cd841ad43ecJon A. Cruzstatic void sp_toggle_picker( GtkToggleAction* act, gpointer data )
00339f176618a0eebcbb2261306a9cd841ad43ecJon A. Cruz{
00339f176618a0eebcbb2261306a9cd841ad43ecJon A. Cruz Inkscape::Preferences *prefs = Inkscape::Preferences::get();
00339f176618a0eebcbb2261306a9cd841ad43ecJon A. Cruz gboolean active = gtk_toggle_action_get_active(act);
00339f176618a0eebcbb2261306a9cd841ad43ecJon A. Cruz prefs->setBool("/tools/spray/picker", active);
00339f176618a0eebcbb2261306a9cd841ad43ecJon A. Cruz if(active == true){
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz prefs->setBool("/dialogs/clonetiler/dotrace", false);
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz SPDesktop *dt = SP_ACTIVE_DESKTOP;
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz if (Inkscape::UI::Dialog::CloneTiler *ct = get_clone_tiler_panel(dt)){
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz dt->_dlg_mgr->showDialog("CloneTiler");
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz ct->show_page_trace();
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz }
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz }
00339f176618a0eebcbb2261306a9cd841ad43ecJon A. Cruz GObject *tbl = G_OBJECT(data);
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz sp_stb_sensitivize(tbl);
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz}
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruzstatic void sp_toggle_pick_center( GtkToggleAction* act, gpointer data )
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz{
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz Inkscape::Preferences *prefs = Inkscape::Preferences::get();
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz gboolean active = gtk_toggle_action_get_active(act);
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz prefs->setBool("/tools/spray/pick_center", active);
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz}
2c312e5f8adf7306ce4b41fb6639475df9c3ea87Jon A. Cruz
00339f176618a0eebcbb2261306a9cd841ad43ecJon A. Cruzstatic void sp_toggle_pick_fill( GtkToggleAction* act, gpointer data )
00339f176618a0eebcbb2261306a9cd841ad43ecJon A. Cruz{
00339f176618a0eebcbb2261306a9cd841ad43ecJon A. Cruz Inkscape::Preferences *prefs = Inkscape::Preferences::get();
00339f176618a0eebcbb2261306a9cd841ad43ecJon A. Cruz gboolean active = gtk_toggle_action_get_active(act);
00339f176618a0eebcbb2261306a9cd841ad43ecJon A. Cruz prefs->setBool("/tools/spray/pick_fill", active);
00339f176618a0eebcbb2261306a9cd841ad43ecJon A. Cruz}
00339f176618a0eebcbb2261306a9cd841ad43ecJon A. Cruz
2c312e5f8adf7306ce4b41fb6639475df9c3ea87Jon A. Cruzstatic void sp_toggle_pick_stroke( GtkToggleAction* act, gpointer data )
00339f176618a0eebcbb2261306a9cd841ad43ecJon A. Cruz{
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz Inkscape::Preferences *prefs = Inkscape::Preferences::get();
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz gboolean active = gtk_toggle_action_get_active(act);
00339f176618a0eebcbb2261306a9cd841ad43ecJon A. Cruz prefs->setBool("/tools/spray/pick_stroke", active);
00339f176618a0eebcbb2261306a9cd841ad43ecJon A. Cruz}
c864652e7fca4ed7605835d5cb6661dc422cabaaJon A. Cruz
c864652e7fca4ed7605835d5cb6661dc422cabaaJon A. Cruzstatic void sp_toggle_pick_no_overlap( GtkToggleAction* act, gpointer data )
c864652e7fca4ed7605835d5cb6661dc422cabaaJon A. Cruz{
c864652e7fca4ed7605835d5cb6661dc422cabaaJon A. Cruz Inkscape::Preferences *prefs = Inkscape::Preferences::get();
c864652e7fca4ed7605835d5cb6661dc422cabaaJon A. Cruz gboolean active = gtk_toggle_action_get_active(act);
00339f176618a0eebcbb2261306a9cd841ad43ecJon A. Cruz prefs->setBool("/tools/spray/pick_no_overlap", active);
00339f176618a0eebcbb2261306a9cd841ad43ecJon A. Cruz}
00339f176618a0eebcbb2261306a9cd841ad43ecJon A. Cruz
00339f176618a0eebcbb2261306a9cd841ad43ecJon A. Cruzstatic void sp_toggle_pick_inverse_value( GtkToggleAction* act, gpointer data )
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz{
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz Inkscape::Preferences *prefs = Inkscape::Preferences::get();
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz gboolean active = gtk_toggle_action_get_active(act);
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz prefs->setBool("/tools/spray/pick_inverse_value", active);
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz}
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruzvoid sp_spray_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder)
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz{
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz Inkscape::IconSize secondarySize = ToolboxFactory::prefToSize("/toolbox/secondary", 1);
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz Inkscape::Preferences *prefs = Inkscape::Preferences::get();
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz {
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz /* Width */
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz gchar const* labels[] = {_("(narrow spray)"), 0, 0, 0, _("(default)"), 0, 0, 0, 0, _("(broad spray)")};
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz gdouble values[] = {1, 3, 5, 10, 15, 20, 30, 50, 75, 100};
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz EgeAdjustmentAction *eact = create_adjustment_action( "SprayWidthAction",
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz _("Width"), _("Width:"), _("The width of the spray area (relative to the visible canvas area)"),
00339f176618a0eebcbb2261306a9cd841ad43ecJon A. Cruz "/tools/spray/width", 15,
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz GTK_WIDGET(desktop->canvas), holder, TRUE, "altx-spray",
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz 1, 100, 1.0, 10.0,
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz labels, values, G_N_ELEMENTS(labels),
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz sp_spray_width_value_changed, NULL /*unit tracker*/, 1, 0 );
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz ege_adjustment_action_set_appearance( eact, TOOLBAR_SLIDER_HINT );
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz gtk_action_group_add_action( mainActions, GTK_ACTION(eact) );
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz gtk_action_set_sensitive( GTK_ACTION(eact), TRUE );
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz }
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz /* Use Pressure Width button */
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz {
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz InkToggleAction* act = ink_toggle_action_new( "SprayPressureWidthAction",
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz _("Pressure"),
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz _("Use the pressure of the input device to alter the width of spray area"),
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz INKSCAPE_ICON("draw-use-pressure"),
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz Inkscape::ICON_SIZE_DECORATION );
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz gtk_action_group_add_action( mainActions, GTK_ACTION(act) );
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz PrefPusher *pusher = new PrefPusher(GTK_TOGGLE_ACTION(act), "/tools/spray/usepressurewidth");
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz g_signal_connect(holder, "destroy", G_CALLBACK(delete_prefspusher), pusher);
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz }
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz {
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz /* Mean */
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz gchar const* labels[] = {_("(default)"), 0, 0, 0, 0, 0, 0, _("(maximum mean)")};
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz gdouble values[] = {0, 5, 10, 20, 30, 50, 70, 100};
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz EgeAdjustmentAction *eact = create_adjustment_action( "SprayMeanAction",
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz _("Focus"), _("Focus:"), _("0 to spray a spot; increase to enlarge the ring radius"),
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz "/tools/spray/mean", 0,
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz GTK_WIDGET(desktop->canvas), holder, TRUE, "spray-mean",
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz 0, 100, 1.0, 10.0,
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz labels, values, G_N_ELEMENTS(labels),
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz sp_spray_mean_value_changed, NULL /*unit tracker*/, 1, 0 );
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz ege_adjustment_action_set_appearance( eact, TOOLBAR_SLIDER_HINT );
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz gtk_action_group_add_action( mainActions, GTK_ACTION(eact) );
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz gtk_action_set_sensitive( GTK_ACTION(eact), TRUE );
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz }
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz {
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz /* Standard_deviation */
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz gchar const* labels[] = {_("(minimum scatter)"), 0, 0, 0, 0, 0, _("(default)"), _("(maximum scatter)")};
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz gdouble values[] = {1, 5, 10, 20, 30, 50, 70, 100};
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz EgeAdjustmentAction *eact = create_adjustment_action( "SprayStandard_deviationAction",
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz C_("Spray tool", "Scatter"), C_("Spray tool", "Scatter:"), _("Increase to scatter sprayed objects"),
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz "/tools/spray/standard_deviation", 70,
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz GTK_WIDGET(desktop->canvas), holder, TRUE, "spray-standard_deviation",
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz 1, 100, 1.0, 10.0,
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz labels, values, G_N_ELEMENTS(labels),
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz sp_spray_standard_deviation_value_changed, NULL /*unit tracker*/, 1, 0 );
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz ege_adjustment_action_set_appearance( eact, TOOLBAR_SLIDER_HINT );
2c312e5f8adf7306ce4b41fb6639475df9c3ea87Jon A. Cruz gtk_action_group_add_action( mainActions, GTK_ACTION(eact) );
2c312e5f8adf7306ce4b41fb6639475df9c3ea87Jon A. Cruz gtk_action_set_sensitive( GTK_ACTION(eact), TRUE );
2c312e5f8adf7306ce4b41fb6639475df9c3ea87Jon A. Cruz }
2c312e5f8adf7306ce4b41fb6639475df9c3ea87Jon A. Cruz
2c312e5f8adf7306ce4b41fb6639475df9c3ea87Jon A. Cruz /* Mode */
2c312e5f8adf7306ce4b41fb6639475df9c3ea87Jon A. Cruz {
2c312e5f8adf7306ce4b41fb6639475df9c3ea87Jon A. Cruz GtkListStore* model = gtk_list_store_new( 4, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING );
2c312e5f8adf7306ce4b41fb6639475df9c3ea87Jon A. Cruz
2c312e5f8adf7306ce4b41fb6639475df9c3ea87Jon A. Cruz GtkTreeIter iter;
2c312e5f8adf7306ce4b41fb6639475df9c3ea87Jon A. Cruz gtk_list_store_append( model, &iter );
2c312e5f8adf7306ce4b41fb6639475df9c3ea87Jon A. Cruz gtk_list_store_set( model, &iter,
2c312e5f8adf7306ce4b41fb6639475df9c3ea87Jon A. Cruz 0, _("Spray with copies"),
2c312e5f8adf7306ce4b41fb6639475df9c3ea87Jon A. Cruz 1, _("Spray copies of the initial selection"),
2c312e5f8adf7306ce4b41fb6639475df9c3ea87Jon A. Cruz 2, INKSCAPE_ICON("spray-mode-copy"),
2c312e5f8adf7306ce4b41fb6639475df9c3ea87Jon A. Cruz -1 );
2c312e5f8adf7306ce4b41fb6639475df9c3ea87Jon A. Cruz
2c312e5f8adf7306ce4b41fb6639475df9c3ea87Jon A. Cruz gtk_list_store_append( model, &iter );
2c312e5f8adf7306ce4b41fb6639475df9c3ea87Jon A. Cruz gtk_list_store_set( model, &iter,
2c312e5f8adf7306ce4b41fb6639475df9c3ea87Jon A. Cruz 0, _("Spray with clones"),
2c312e5f8adf7306ce4b41fb6639475df9c3ea87Jon A. Cruz 1, _("Spray clones of the initial selection"),
2c312e5f8adf7306ce4b41fb6639475df9c3ea87Jon A. Cruz 2, INKSCAPE_ICON("spray-mode-clone"),
2c312e5f8adf7306ce4b41fb6639475df9c3ea87Jon A. Cruz -1 );
2c312e5f8adf7306ce4b41fb6639475df9c3ea87Jon A. Cruz
2c312e5f8adf7306ce4b41fb6639475df9c3ea87Jon A. Cruz#ifdef ENABLE_SPRAY_MODE_SINGLE_PATH
2c312e5f8adf7306ce4b41fb6639475df9c3ea87Jon A. Cruz gtk_list_store_append( model, &iter );
2c312e5f8adf7306ce4b41fb6639475df9c3ea87Jon A. Cruz gtk_list_store_set( model, &iter,
2c312e5f8adf7306ce4b41fb6639475df9c3ea87Jon A. Cruz 0, _("Spray single path"),
2c312e5f8adf7306ce4b41fb6639475df9c3ea87Jon A. Cruz 1, _("Spray objects in a single path"),
2c312e5f8adf7306ce4b41fb6639475df9c3ea87Jon A. Cruz 2, INKSCAPE_ICON("spray-mode-union"),
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz -1 );
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz#endif
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz gtk_list_store_append( model, &iter );
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz gtk_list_store_set( model, &iter,
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz 0, _("Delete sprayed items"),
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz 1, _("Delete sprayed items from selection"),
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz 2, INKSCAPE_ICON("draw-eraser"),
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz -1 );
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz EgeSelectOneAction* act = ege_select_one_action_new( "SprayModeAction", _("Mode"), (""), NULL, GTK_TREE_MODEL(model) );
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz g_object_set( act, "short_label", _("Mode:"), NULL );
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz gtk_action_group_add_action( mainActions, GTK_ACTION(act) );
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz g_object_set_data( holder, "mode_action", act );
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz ege_select_one_action_set_appearance( act, "full" );
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz ege_select_one_action_set_radio_action_type( act, INK_RADIO_ACTION_TYPE );
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz g_object_set( G_OBJECT(act), "icon-property", "iconId", NULL );
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz ege_select_one_action_set_icon_column( act, 2 );
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz ege_select_one_action_set_icon_size( act, secondarySize );
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz ege_select_one_action_set_tooltip_column( act, 1 );
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz gint mode = prefs->getInt("/tools/spray/mode", 1);
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz ege_select_one_action_set_active( act, mode );
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz g_signal_connect_after( G_OBJECT(act), "changed", G_CALLBACK(sp_spray_mode_changed), holder );
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz g_object_set_data( G_OBJECT(holder), "spray_tool_mode", act);
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz }
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz { /* Population */
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz gchar const* labels[] = {_("(low population)"), 0, 0, 0, _("(default)"), 0, _("(high population)")};
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz gdouble values[] = {5, 20, 35, 50, 70, 85, 100};
a63dbee6633e3ed991bb2b34cbed7c9f02c1a839Jon A. Cruz EgeAdjustmentAction *eact = create_adjustment_action( "SprayPopulationAction",
_("Amount"), _("Amount:"),
_("Adjusts the number of items sprayed per click"),
"/tools/spray/population", 70,
GTK_WIDGET(desktop->canvas), holder, TRUE, "spray-population",
1, 100, 1.0, 10.0,
labels, values, G_N_ELEMENTS(labels),
sp_spray_population_value_changed, NULL /*unit tracker*/, 1, 0 );
ege_adjustment_action_set_appearance( eact, TOOLBAR_SLIDER_HINT );
gtk_action_group_add_action( mainActions, GTK_ACTION(eact) );
gtk_action_set_sensitive( GTK_ACTION(eact), TRUE );
g_object_set_data( holder, "spray_population", eact );
}
/* Use Pressure Population button */
{
InkToggleAction* act = ink_toggle_action_new( "SprayPressurePopulationAction",
_("Pressure"),
_("Use the pressure of the input device to alter the amount of sprayed objects"),
INKSCAPE_ICON("draw-use-pressure"),
Inkscape::ICON_SIZE_DECORATION );
gtk_action_group_add_action( mainActions, GTK_ACTION(act) );
PrefPusher *pusher = new PrefPusher(GTK_TOGGLE_ACTION(act), "/tools/spray/usepressurepopulation");
g_signal_connect(holder, "destroy", G_CALLBACK(delete_prefspusher), pusher);
}
{ /* Rotation */
gchar const* labels[] = {_("(default)"), 0, 0, 0, 0, 0, 0, _("(high rotation variation)")};
gdouble values[] = {0, 10, 25, 35, 50, 60, 80, 100};
EgeAdjustmentAction *eact = create_adjustment_action( "SprayRotationAction",
_("Rotation"), _("Rotation:"),
// xgettext:no-c-format
_("Variation of the rotation of the sprayed objects; 0% for the same rotation than the original object"),
"/tools/spray/rotation_variation", 0,
GTK_WIDGET(desktop->canvas), holder, TRUE, "spray-rotation",
0, 100, 1.0, 10.0,
labels, values, G_N_ELEMENTS(labels),
sp_spray_rotation_value_changed, NULL /*unit tracker*/, 1, 0 );
ege_adjustment_action_set_appearance( eact, TOOLBAR_SLIDER_HINT );
gtk_action_group_add_action( mainActions, GTK_ACTION(eact) );
gtk_action_set_sensitive( GTK_ACTION(eact), TRUE );
g_object_set_data( holder, "spray_rotation", eact );
}
{ /* Scale */
gchar const* labels[] = {_("(default)"), 0, 0, 0, 0, 0, 0, _("(high scale variation)")};
gdouble values[] = {0, 10, 25, 35, 50, 60, 80, 100};
EgeAdjustmentAction *eact = create_adjustment_action( "SprayScaleAction",
C_("Spray tool", "Scale"), C_("Spray tool", "Scale:"),
// xgettext:no-c-format
_("Variation in the scale of the sprayed objects; 0% for the same scale than the original object"),
"/tools/spray/scale_variation", 0,
GTK_WIDGET(desktop->canvas), holder, TRUE, "spray-scale",
0, 100, 1.0, 10.0,
labels, values, G_N_ELEMENTS(labels),
sp_spray_scale_value_changed, NULL /*unit tracker*/, 1, 0 );
ege_adjustment_action_set_appearance( eact, TOOLBAR_SLIDER_HINT );
gtk_action_group_add_action( mainActions, GTK_ACTION(eact) );
gtk_action_set_sensitive( GTK_ACTION(eact), TRUE );
g_object_set_data( holder, "spray_scale", eact );
}
/* Use Pressure Scale button */
{
InkToggleAction* act = ink_toggle_action_new( "SprayPressureScaleAction",
_("Pressure"),
_("Use the pressure of the input device to alter the scale of new items"),
INKSCAPE_ICON("draw-use-pressure"),
Inkscape::ICON_SIZE_DECORATION);
gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(act), prefs->getBool("/tools/spray/usepressurescale", false) );
g_object_set_data( holder, "usepressurescale", act );
g_signal_connect_after( G_OBJECT(act), "toggled", G_CALLBACK(sp_toggle_pressure_scale), holder) ;
gtk_action_group_add_action( mainActions, GTK_ACTION(act) );
}
/* Picker */
{
InkToggleAction* act = ink_toggle_action_new( "SprayPickColorAction",
_("Pick color from the drawing. You can use clonetiler trace dialog for avanced effects. In clone mode original fill or stroke colors must be unset."),
_("Pick color from the drawing. You can use clonetiler trace dialog for avanced effects. In clone mode original fill or stroke colors must be unset."),
INKSCAPE_ICON("color-picker"),
secondarySize );
gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(act), prefs->getBool("/tools/spray/picker", false) );
g_object_set_data( holder, "picker", act );
g_signal_connect_after( G_OBJECT(act), "toggled", G_CALLBACK(sp_toggle_picker), holder) ;
gtk_action_group_add_action( mainActions, GTK_ACTION(act) );
}
/* Pick from center */
{
InkToggleAction* act = ink_toggle_action_new( "SprayPickCenterAction",
_("Pick from center instead average area."),
_("Pick from center instead average area."),
INKSCAPE_ICON("snap-bounding-box-center"),
secondarySize );
gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(act), prefs->getBool("/tools/spray/pick_center", true) );
g_object_set_data( holder, "pick_center", act );
g_signal_connect_after( G_OBJECT(act), "toggled", G_CALLBACK(sp_toggle_pick_center), holder) ;
gtk_action_group_add_action( mainActions, GTK_ACTION(act) );
}
/* Inverse Value Size */
{
InkToggleAction* act = ink_toggle_action_new( "SprayPickInverseValueAction",
_("Inversed pick value, retaining color in advanced trace mode"),
_("Inversed pick value, retaining color in advanced trace mode"),
INKSCAPE_ICON("object-tweak-shrink"),
secondarySize );
gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(act), prefs->getBool("/tools/spray/pick_inverse_value", false) );
g_object_set_data( holder, "pick_inverse_value", act );
g_signal_connect_after( G_OBJECT(act), "toggled", G_CALLBACK(sp_toggle_pick_inverse_value), holder) ;
gtk_action_group_add_action( mainActions, GTK_ACTION(act) );
}
/* Pick Fill */
{
InkToggleAction* act = ink_toggle_action_new( "SprayPickFillAction",
_("Apply picked color to fill"),
_("Apply picked color to fill"),
INKSCAPE_ICON("paint-solid"),
secondarySize );
gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(act), prefs->getBool("/tools/spray/pick_fill", false) );
g_object_set_data( holder, "pick_fill", act );
g_signal_connect_after( G_OBJECT(act), "toggled", G_CALLBACK(sp_toggle_pick_fill), holder) ;
gtk_action_group_add_action( mainActions, GTK_ACTION(act) );
}
/* Pick Stroke */
{
InkToggleAction* act = ink_toggle_action_new( "SprayPickStrokeAction",
_("Apply picked color to stroke"),
_("Apply picked color to stroke"),
INKSCAPE_ICON("no-marker"),
secondarySize );
gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(act), prefs->getBool("/tools/spray/pick_stroke", false) );
g_object_set_data( holder, "pick_stroke", act );
g_signal_connect_after( G_OBJECT(act), "toggled", G_CALLBACK(sp_toggle_pick_stroke), holder) ;
gtk_action_group_add_action( mainActions, GTK_ACTION(act) );
}
/* Pick No Overlap */
{
InkToggleAction* act = ink_toggle_action_new( "SprayPickNoOverlapAction",
_("No overlap between colors"),
_("No overlap between colors"),
INKSCAPE_ICON("symbol-bigger"),
secondarySize );
gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(act), prefs->getBool("/tools/spray/pick_no_overlap", false) );
g_object_set_data( holder, "pick_no_overlap", act );
g_signal_connect_after( G_OBJECT(act), "toggled", G_CALLBACK(sp_toggle_pick_no_overlap), holder) ;
gtk_action_group_add_action( mainActions, GTK_ACTION(act) );
}
/* Over Transparent */
{
InkToggleAction* act = ink_toggle_action_new( "SprayOverTransparentAction",
_("Apply over transparent areas"),
_("Apply over transparent areas"),
INKSCAPE_ICON("object-hidden"),
secondarySize );
gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(act), prefs->getBool("/tools/spray/over_transparent", true) );
g_object_set_data( holder, "over_transparent", act );
g_signal_connect_after( G_OBJECT(act), "toggled", G_CALLBACK(sp_toggle_over_transparent), holder) ;
gtk_action_group_add_action( mainActions, GTK_ACTION(act) );
}
/* Over No Transparent */
{
InkToggleAction* act = ink_toggle_action_new( "SprayOverNoTransparentAction",
_("Apply over no transparent areas"),
_("Apply over no transparent areas"),
INKSCAPE_ICON("object-visible"),
secondarySize );
gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(act), prefs->getBool("/tools/spray/over_no_transparent", true) );
g_object_set_data( holder, "over_no_transparent", act );
g_signal_connect_after( G_OBJECT(act), "toggled", G_CALLBACK(sp_toggle_over_no_transparent), holder) ;
gtk_action_group_add_action( mainActions, GTK_ACTION(act) );
}
/* Overlap */
{
InkToggleAction* act = ink_toggle_action_new( "SprayNoOverlapAction",
_("Prevent overlapping objects"),
_("Prevent overlapping objects"),
INKSCAPE_ICON("distribute-randomize"),
secondarySize );
gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(act), prefs->getBool("/tools/spray/no_overlap", false) );
g_object_set_data( holder, "no_overlap", act );
g_signal_connect_after( G_OBJECT(act), "toggled", G_CALLBACK(sp_toggle_no_overlap), holder) ;
gtk_action_group_add_action( mainActions, GTK_ACTION(act) );
}
/* Offset */
{
EgeAdjustmentAction *eact = create_adjustment_action( "SprayToolOffsetAction",
_("Offset %"), _("Offset %:"),
_("Increase to segregate objects more (value in percent)"),
"/tools/spray/offset", 100,
GTK_WIDGET(desktop->canvas), holder, FALSE, NULL,
0, 10000, 1, 4,
0, 0, 0,
sp_spray_offset_value_changed, NULL, 0 , 0);
g_object_set_data( holder, "offset", eact );
gtk_action_group_add_action( mainActions, GTK_ACTION(eact) );
}
sp_spray_erase_sensitivize(holder, prefs->getInt("/tools/spray/mode") != 3);
}
/*
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 :