sp-attribute-widget.cpp revision 7e1c92f7578b71cbc486c26021786aca921d64cf
/**
* @file
* Base widget for user input of object properties.
*/
/* Authors:
* Lauris Kaplinski <lauris@ximian.com>
* Abhishek Sharma
* Kris De Gussem <Kris.DeGussem@gmail.com>
*
* Copyright (C) 2001 Ximian, Inc.
* Copyright (C) 2012, authors
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#include "sp-object.h"
#include "macros.h"
#include "document.h"
#include "document-undo.h"
#include "verbs.h"
#include "sp-attribute-widget.h"
using Inkscape::DocumentUndo;
/**
* Callback for user input in one of the entries.
*
* sp_attribute_table_entry_changed set the object property
* to the new value and updates history. It is a callback from
* the entries created by SPAttributeTable.
*
* @param editable pointer to the entry box.
* @param spat pointer to the SPAttributeTable instance.
*/
/**
* Callback for a modification of the selected object (size, color, properties, etc.).
*
* sp_attribute_table_object_modified rereads the object properties
* and shows the values in the entry boxes. It is a callback from a
* connection of the SPObject.
*
* @param object the SPObject to which this instance is referring to.
* @param flags gives the applied modifications
* @param spat pointer to the SPAttributeTable instance.
*/
static void sp_attribute_table_object_modified (SPObject *object, guint flags, SPAttributeTable *spaw);
/**
* Callback for the delection of the selected object.
*
* sp_attribute_table_object_release invalidates all data of
* SPAttributeTable and disables the widget.
*/
#define XPAD 4
#define YPAD 0
blocked(false),
_attributes(),
_entries(),
{
}
SPAttributeTable::SPAttributeTable (SPObject *object, std::vector<Glib::ustring> &labels, std::vector<Glib::ustring> &attributes, GtkWidget* parent) :
blocked(false),
_attributes(),
_entries(),
{
}
{
clear();
}
void SPAttributeTable::clear(void)
{
if (table)
{
{
w = ch[i];
if (w != NULL)
{
try
{
sp_signal_disconnect_by_data (w->gobj(), this);
delete w;
}
catch(...)
{
}
}
}
_attributes.clear();
delete table;
}
if (_object)
{
}
}
{
clear();
if (object) {
blocked = true;
// Set up object
modified_connection = object->connectModified(sigc::bind<2>(sigc::ptr_fun(&sp_attribute_table_object_modified), this));
release_connection = object->connectRelease (sigc::bind<1>(sigc::ptr_fun(&sp_attribute_table_object_release), this));
// Create table
{
}
// Fill rows
this );
}
/* Show table */
blocked = false;
}
}
{
if (_object)
{
}
if (_object) {
blocked = true;
// Set up object
modified_connection = _object->connectModified(sigc::bind<2>(sigc::ptr_fun(&sp_attribute_table_object_modified), this));
release_connection = _object->connectRelease (sigc::bind<1>(sigc::ptr_fun(&sp_attribute_table_object_release), this));
}
blocked = false;
}
}
void SPAttributeTable::reread_properties(void)
{
blocked = true;
{
}
blocked = false;
}
{
if (flags && SP_OBJECT_MODIFIED_FLAG)
{
/* We are different */
}
}
}
}
} // end of sp_attribute_table_object_modified()
{
{
_("Set attribute"));
}
return;
}
}
g_warning ("file %s: line %d: Entry signalled change, but there is no such entry", __FILE__, __LINE__);
}
} // end of sp_attribute_table_entry_changed()
{
}
/*
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 :