gradient-selector.cpp revision a5c9d6f74fbecefbafc2457013bdb40868f817af
/*
* Gradient vector widget
*
* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
* bulia byak <buliabyak@users.sf.net>
* Jon A. Cruz <jon@joncruz.org>
*
* Copyright (C) 2001-2002 Lauris Kaplinski
* Copyright (C) 2001 Ximian, Inc.
* Copyright (C) 2010 Jon A. Cruz
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#endif
#include <gtkmm/treeview.h>
#include "gradient-vector.h"
#include "document.h"
#include "document-undo.h"
#include "document-private.h"
#include "gradient-chemistry.h"
#include "inkscape.h"
#include "verbs.h"
#include "helper/action-context.h"
#include "preferences.h"
#include "gradient-selector.h"
#include "paint-selector.h"
#include "style.h"
#include "id-clash.h"
#include "ui/icon-names.h"
enum {
};
/* Signal handlers */
static void sp_gradient_selector_vector_set (SPGradientVectorSelector *gvs, SPGradient *gr, SPGradientSelector *sel);
#if GTK_CHECK_VERSION(3,0,0)
#else
#endif
{
G_TYPE_NONE, 0);
G_TYPE_NONE, 0);
G_TYPE_NONE, 0);
G_TYPE_NONE, 0);
}
{
}
{
sel->safelyInit = true;
#if GTK_CHECK_VERSION(3,0,0)
#endif
/* Vectors */
icon_column->set_clickable(true);
name_column->set_clickable(true);
name_column->set_resizable(true);
count_column->set_clickable(true);
count_column->set_resizable(true);
icon_column->signal_clicked().connect( sigc::mem_fun(*sel, &SPGradientSelector::onTreeColorColClick) );
name_column->signal_clicked().connect( sigc::mem_fun(*sel, &SPGradientSelector::onTreeNameColClick) );
count_column->signal_clicked().connect( sigc::mem_fun(*sel, &SPGradientSelector::onTreeCountColClick) );
gvs->tree_select_connection = sel->treeview->get_selection()->signal_changed().connect( sigc::mem_fun(*sel, &SPGradientSelector::onTreeSelection) );
sel->text_renderer->signal_edited().connect( sigc::mem_fun(*sel, &SPGradientSelector::onGradientRename) );
/* Create box for buttons */
#if GTK_CHECK_VERSION(3,0,0)
#else
#endif
//sel->nonsolid.push_back(hb);
g_signal_connect (G_OBJECT (sel->add), "clicked", G_CALLBACK (sp_gradient_selector_add_vector_clicked), sel);
// FIXME: Probably better to either use something from the icon naming spec or ship our own "edit-gradient" icon
g_signal_connect (G_OBJECT (sel->edit), "clicked", G_CALLBACK (sp_gradient_selector_edit_vector_clicked), sel);
g_signal_connect (G_OBJECT (sel->del), "clicked", G_CALLBACK (sp_gradient_selector_delete_vector_clicked), sel);
}
{
if ( sel->safelyInit ) {
sel->safelyInit = false;
}
if (sel->icon_renderer) {
delete sel->icon_renderer;
}
if (sel->text_renderer) {
delete sel->text_renderer;
}
}
}
{
//gtk_combo_box_set_active (GTK_COMBO_BOX(this->spread), gradientSpread);
}
{
return GTK_WIDGET(sel);
}
{
if (mode == MODE_SWATCH) {
{
}
for (std::vector<GtkWidget*>::iterator it = swatch_widgets.begin(); it != swatch_widgets.end(); ++it)
{
}
vs->setSwatched();
} else {
{
}
for (std::vector<GtkWidget*>::iterator it = swatch_widgets.begin(); it != swatch_widgets.end(); ++it)
{
}
}
}
}
{
}
{
return gradientUnits;
}
{
return gradientSpread;
}
void SPGradientSelector::onGradientRename( const Glib::ustring& path_string, const Glib::ustring& new_text)
{
if( iter )
{
if ( row ) {
if ( obj ) {
_("Rename gradient"));
}
}
}
}
}
void SPGradientSelector::onTreeColorColClick() {
}
void SPGradientSelector::onTreeNameColClick() {
}
void SPGradientSelector::onTreeCountColClick() {
}
void SPGradientSelector::onTreeSelection()
{
if (!treeview) {
return;
}
if (blocked) {
return;
}
* When the treeview initially doesn't have focus and is clicked
* sometimes get_selection()->signal_changed() has the wrong selection
*/
treeview->grab_focus();
}
if (!sel) {
return;
}
/* Single selection */
if ( iter ) {
}
if (obj) {
}
}
bool SPGradientSelector::_checkForSelected(const Gtk::TreePath &path, const Gtk::TreeIter& iter, SPGradient *vector)
{
bool found = false;
{
bool wasBlocked = blocked;
blocked = true;
found = true;
}
return found;
}
{
store->foreach( sigc::bind<SPGradient*>(sigc::mem_fun(*this, &SPGradientSelector::_checkForSelected), vector) );
}
{
return;
}
if (vector) {
{
}
} else {
{
}
}
} else if (mode != MODE_SWATCH) {
for (std::vector<GtkWidget*>::iterator it = swatch_widgets.begin(); it != swatch_widgets.end(); ++it)
{
}
{
}
}
if (edit) {
}
if (add) {
}
if (del) {
}
} else {
if (edit) {
}
if (add) {
}
if (del) {
}
}
}
{
/* fixme: */
}
static void sp_gradient_selector_vector_set(SPGradientVectorSelector * /*gvs*/, SPGradient *gr, SPGradientSelector *sel)
{
}
}
static void
{
if (!selection) {
return;
}
/* Single selection */
if ( iter ) {
}
if (obj) {
}
}
static void
{
// Legacy gradient dialog
} else {
// Invoke the gradient tool
if ( verb ) {
SPAction *action = verb->get_action( Inkscape::ActionContext( ( Inkscape::UI::View::View * ) SP_ACTIVE_DESKTOP ) );
if ( action ) {
}
}
}
}
static void
{
SPDocument *doc = sp_gradient_vector_selector_get_document (SP_GRADIENT_VECTOR_SELECTOR (sel->vectors));
if (!doc)
return;
SPGradient *gr = sp_gradient_vector_selector_get_gradient( SP_GRADIENT_VECTOR_SELECTOR (sel->vectors));
if (gr) {
// Rename the new gradients id to be similar to the cloned gradients
} else {
}
}
/*
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 :