livepatheffect-editor.cpp revision c730b7fa118ad88d7cc6047dcc78e7098cdf79ca
/** @file
* @brief 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 <vector>
#include "desktop.h"
#include "desktop-handles.h"
#include "document.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.h"
#include "sp-item-group.h"
#include "sp-lpe-item.h"
#include "sp-path.h"
#include "sp-rect.h"
#include "sp-shape.h"
#include "ui/icon-names.h"
#include "ui/widget/imagetoggler.h"
#include "verbs.h"
#include "livepatheffect-editor.h"
namespace Inkscape {
class Application;
namespace UI {
namespace Dialog {
/*####################
* Callback functions
*/
{
lpeeditor->lpe_list_locked = false;
}
static void lpeeditor_selection_modified (Inkscape::Selection * selection, guint /*flags*/, gpointer data)
{
}
/*#######################
* LivePathEffectEditor
*/
lpe_list_locked(false),
// TRANSLATORS: this dialog is accessible via menu Path - Path Effect Editor...
effectapplication_frame(_("Apply new effect")),
effectcontrol_frame(_("Current effect")),
effectlist_frame(_("Effect list")),
{
//Add the TreeView, inside a ScrolledWindow, with the button underneath:
//Only show the scrollbars when they are necessary:
// effectlist_vbox.pack_end(button_hbox, Gtk::PACK_SHRINK);
// button_hbox.pack_start(button_up, true, true);
// button_hbox.pack_start(button_down, true, true);
// button_hbox.pack_end(button_remove, true, true);
// Add toolbar items to toolbar
// Add toolbar
//add_toolbar(toolbar);
//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:
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
//button_remove.hide();
}
{
if (effectwidget) {
delete effectwidget;
effectwidget = NULL;
}
if (current_desktop) {
}
}
void
{
if (effectwidget) {
delete effectwidget;
effectwidget = NULL;
}
if (effectwidget) {
}
// fixme: add resizing of dialog
}
void
{
}
}
void
{
if (effectwidget) {
delete effectwidget;
effectwidget = NULL;
}
//button_remove.hide();
// fixme: do resizing of dialog ?
}
void
{
}
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 ( SP_IS_LPE_ITEM(item) ) {
set_sensitize_all(true);
if ( sp_lpe_item_has_path_effect(lpeitem) ) {
if (lpe) {
showParams(*lpe);
lpe_list_locked = true;
} else {
showText(_("Unknown effect is applied"));
}
} else {
showText(_("No effect applied"));
button_remove.set_sensitive(false);
}
} else {
showText(_("Item is not a path or shape"));
set_sensitize_all(false);
}
} else {
showText(_("Only one item can be selected"));
set_sensitize_all(false);
}
} else {
showText(_("Empty selection"));
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 (!data) return;
// If item is a SPRect, convert it to path first:
if ( SP_IS_RECT(item) ) {
}
_("Create and apply path effect"));
lpe_list_locked = false;
}
}
}
void
{
_("Remove path effect") );
}
}
}
void LivePathEffectEditor::onUp()
{
_("Move path effect up") );
}
}
}
void LivePathEffectEditor::onDown()
{
_("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 :