livepatheffect-editor.cpp revision dd0ae0a28fda34d3805f7fe6deece97c4192910a
/**
* @file
* Live Path Effect editing dialog - implementation.
*/
/* Authors:
* Johan Engelen <j.b.c.engelen@utwente.nl>
* Steren Giannini <steren.giannini@gmail.com>
* Bastien Bouclet <bgkweb@gmail.com>
* Abhishek Sharma
*
* Copyright (C) 2007 Authors
* Released under GNU GPL. Read the file 'COPYING' for more information.
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "livepatheffect-editor.h"
#include <vector>
#include "desktop.h"
#include "desktop-handles.h"
#include "document.h"
#include "document-undo.h"
#include "inkscape.h"
#include "live_effects/effect.h"
#include "live_effects/lpeobject.h"
#include "live_effects/lpeobject-reference.h"
#include "path-chemistry.h"
#include "selection-chemistry.h"
#include "selection.h"
#include "sp-item-group.h"
#include "sp-lpe-item.h"
#include "sp-path.h"
#include "sp-rect.h"
#include "sp-use.h"
#include "sp-text.h"
#include "sp-shape.h"
#include "ui/icon-names.h"
#include "ui/widget/imagetoggler.h"
#include "verbs.h"
#include "livepatheffect-add.h"
namespace Inkscape {
namespace UI {
namespace Dialog {
/*####################
* Callback functions
*/
{
lpeeditor->lpe_list_locked = false;
}
static void lpeeditor_selection_modified (Inkscape::Selection * selection, guint /*flags*/, gpointer data)
{
}
/*
* LivePathEffectEditor
*
* TRANSLATORS: this dialog is accessible via menu Path - Path Effect Editor...
*
*/
deskTrack(),
lpe_list_locked(false),
effectcontrol_frame(""),
button_add(),
button_up(),
button_down(),
{
//Add the TreeView, inside a ScrolledWindow, with the button underneath:
#if WITH_GTKMM_3_10
#else
#endif
#if WITH_GTKMM_3_10
#else
#endif
#if WITH_GTKMM_3_10
#else
#endif
#if WITH_GTKMM_3_10
#else
#endif
// Add toolbar items to toolbar
#if !WITH_GTKMM_3_0
// TODO: This has been removed from Gtkmm 3.0. Check that
// everything still looks OK!
#endif
//Create the Tree model:
effectlist_view.set_headers_visible(false);
// Handle tree selections
effectlist_selection->signal_changed().connect( sigc::mem_fun(*this, &LivePathEffectEditor::on_effect_selection_changed) );
//Add the visibility icon column:
Inkscape::UI::Widget::ImageToggler *eyeRenderer = Gtk::manage( new Inkscape::UI::Widget::ImageToggler(
eyeRenderer->signal_toggled().connect( sigc::mem_fun(*this, &LivePathEffectEditor::on_visibility_toggled) );
eyeRenderer->property_activatable() = true;
if ( col ) {
}
//Add the effect name column:
// connect callback functions to buttons
desktopChangeConn = deskTrack.connectDesktopChanged( sigc::mem_fun(*this, &LivePathEffectEditor::setDesktop) );
}
{
if (effectwidget) {
delete effectwidget;
effectwidget = NULL;
}
if (current_desktop) {
}
}
void
{
if (effectwidget) {
delete effectwidget;
effectwidget = NULL;
}
if (effectwidget) {
}
status_label.hide();
// fixme: add resizing of dialog
}
void
{
}
}
void
{
if (effectwidget) {
delete effectwidget;
effectwidget = NULL;
}
status_label.show();
// fixme: do resizing of dialog ?
}
void
{
//combo_effecttype.set_sensitive(sensitive);
}
void
{
if (lpe_list_locked) {
// this was triggered by selecting a row in the list, so skip reloading
lpe_list_locked = false;
return;
}
if ( item ) {
if ( lpeitem ) {
set_sensitize_all(true);
if ( lpeitem->hasPathEffect() ) {
if (lpe) {
showParams(*lpe);
lpe_list_locked = true;
} else {
showText(_("Unknown effect is applied"));
}
} else {
showText(_("Click button to add an effect"));
button_remove.set_sensitive(false);
button_up.set_sensitive(false);
button_down.set_sensitive(false);
}
} else {
if ( use ) {
// test whether linked object is supported by the CLONE_ORIGINAL LPE
{
// Note that an SP_USE cannot have an LPE applied, so we only need to worry about the "add effect" case.
set_sensitize_all(true);
showText(_("Click add button to convert clone"));
button_remove.set_sensitive(false);
button_up.set_sensitive(false);
button_down.set_sensitive(false);
} else {
showText(_("Select a path or shape"));
set_sensitize_all(false);
}
} else {
showText(_("Select a path or shape"));
set_sensitize_all(false);
}
}
} else {
showText(_("Only one item can be selected"));
set_sensitize_all(false);
}
} else {
showText(_("Select a path or shape"));
set_sensitize_all(false);
}
}
/*
* First clears the effectlist_store, then appends all effects from the effectlist.
*/
void
{
{
continue;
}
} else {
}
}
}
void
{
if ( desktop == current_desktop ) {
return;
}
if (current_desktop) {
}
lpe_list_locked = false;
if (desktop) {
} else {
}
}
/*########################################################################
# BUTTON CLICK HANDLERS (callbacks)
########################################################################*/
// TODO: factor out the effect applying code which can be called from anywhere. (selection-chemistry.cpp also needs it)
void
{
if (item) {
// show effectlist dialog
if ( !LivePathEffectAdd::isApplied()) {
return;
}
if (!data) {
return;
}
// If item is a SPRect, convert it to path first:
}
_("Create and apply path effect"));
lpe_list_locked = false;
} else {
if ( use ) {
// item is a clone. do not show effectlist dialog.
// convert to path, apply CLONE_ORIGINAL LPE, link it to the cloned path
// test whether linked object is supported by the CLONE_ORIGINAL LPE
{
// select original
// delete clone but remember its id and transform
item->deleteObject(false);
// run sp_selection_clone_original_path_lpe
// Check that the cloning was successful. We don't want to change the ID of the original referenced path!
}
/// \todo Add the LPE stack of the original path?
_("Create and apply Clone original path effect"));
lpe_list_locked = false;
}
}
}
}
}
}
void
{
if ( lpeitem ) {
lpeitem->removeCurrentPathEffect(false);
_("Remove path effect") );
}
}
}
void LivePathEffectEditor::onUp()
{
if ( lpeitem ) {
_("Move path effect up") );
}
}
}
void LivePathEffectEditor::onDown()
{
if ( lpeitem ) {
_("Move path effect down") );
}
}
}
{
if (sel->count_selected_rows () == 0)
return;
if (lperef && current_lpeitem) {
lpe_list_locked = true; // prevent reload of the list which would lose selection
}
}
}
{
/* FIXME: this explicit writing to SVG is wrong. The lpe_item should have a method to disable/enable an effect within its stack.
* So one can call: lpe_item->setActive(lpeobjref->lpeobject); */
lpeobjref->lpeobject->get_lpe()->getRepr()->setAttribute("is_visible", newValue ? "true" : "false");
}
}
} // namespace Dialog
} // 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 :