(Sorry if this comes in several copies, I'm having trouble sending to the list)
I just did a temporary hack: now sp_document_undo emits the selection_changed signal. The node editor catches it and redraws the path. This fixes bug 848355 for now. As an unwanted side effect, selected nodes are deselected after an undo. A better solution would require figuring out what's up with selection_modified signal and using it instead (see my previous mail - attached below).
On the bright side, today I implemented duplicate node in node editor (shift-d). As a regular duplicate object (ctrl-d), it places the new node(s) exactly over the previously selected ones (and selects the new node(s) instead). By using together with Tab and Ctrl-a, this makes possible some nice keyboard-only effects. Here are some ideas for eyecandy screenshots for 0.36:
- create a filled star with about 30 rays, press ctrl-shift-c, F2, ctrl-a, shift-d, some arrow keys (maybe with shift)....
- create a spiral with about 30 revolutions, ctrl-shift-c, F2, ctrl-a, shift-d, some arrow keys...
Also, I fixed shift-b (break nodes) so that it breaks all selected nodes and only selects one end of each break (previously it selected both ends). So you can add more fun to the above examples by pressing shift-b, some arrow keys, then ctrl-a again, shift-d, more arrow keys, etc.
More usefully, this allows to easily "draw" with keyboard. Use tab to move to the end node of an unclosed path and go like this: shift-d, arrows, shift-d, more arrows, etc. It's an easy way to create rectangular shapes, very useful for diagrams.
So what remains in node editor is implementing the []<> keys to edit control points, and voila - a totally keyboard-driven path editor! Something I've dreamed about for long, but did not see to date in any vector editor.
P.S. Looks like my previous mail was lost, here it goes:
Does anyone have an idea why sp_selection_idle_handler in selection.c is constantly emitting the "selection modified" signal - even two signals, one on the selection and the other on the inkscape object???
There is indeed a constant flood of these signals even when absolutely nothing is happening, not even a mouse move.
Is this by design? I'm sure there must be a better way. I was investigating why undo and XML-editor changes in node edit do not work, and found that nodepath context lacks any callback that would update the path when its repr has changed. I tried to hook it up to the "modified" signal but that rendered the program unusable because that signal is "always on" like white noise.
Can someone share any insights? It seems to me that something is seriously broken here. I think that it's the repr subsystem that must issue a signal when the document is changed, but that subsystem apparently emits no signals whatsoever.
_________________________________________________________________ Don�t worry if your Inbox will max out while you are enjoying the holidays. Get MSN Extra Storage! http://join.msn.com/?PAGE=features/es
On Thu, 2003-12-04 at 16:25, bulia byak wrote:
(Sorry if this comes in several copies, I'm having trouble sending to the list)
I just did a temporary hack: now sp_document_undo emits the selection_changed signal. The node editor catches it and redraws the path. This fixes bug 848355 for now. As an unwanted side effect, selected nodes are deselected after an undo. A better solution would require figuring out what's up with selection_modified signal and using it instead (see my previous mail - attached below).
I think for now unselecting the nodes is acceptable.
More usefully, this allows to easily "draw" with keyboard. Use tab to move to the end node of an unclosed path and go like this: shift-d, arrows, shift-d, more arrows, etc. It's an easy way to create rectangular shapes, very useful for diagrams.
Nice~
So what remains in node editor is implementing the []<> keys to edit control points, and voila - a totally keyboard-driven path editor! Something I've dreamed about for long, but did not see to date in any vector editor.
oooh~~~
P.S. Looks like my previous mail was lost, here it goes:
Does anyone have an idea why sp_selection_idle_handler in selection.c is constantly emitting the "selection modified" signal - even two signals, one on the selection and the other on the inkscape object???
Hmm... I will have to look into that. It should not ever be doing that.
Can someone share any insights? It seems to me that something is seriously broken here. I think that it's the repr subsystem that must issue a signal when the document is changed, but that subsystem apparently emits no signals whatsoever.
Though SPRepr provides "signals" for notification when individual nodes change, there is no mechanism to recieve notification for overall document changes.
However, with the addition of the transactions code, it would not be very hard to implement if you wanted it.
SPRepr itself doesn't use GObject signals at present -- SPReprs maintain lists of SPReprEventVectors (added via sp_repr_add_listener), which are used to specify callbacks when something changes.
Here are the current callbacks in an event vector (they may be NULL):
void (* destroy) (SPRepr *repr, void * data);
Called when the repr is destroyed.
unsigned int (* add_child) (SPRepr *repr, SPRepr *child, SPRepr *ref, void * data);
Called before a child is added; the handler can return FALSE to veto the addition. ref is the child after which the new child is to be added.
void (* child_added) (SPRepr *repr, SPRepr *child, SPRepr *ref, void * data);
Called once a child has been added.
unsigned int (* remove_child) (SPRepr *repr, SPRepr *child, SPRepr *ref, void * data);
Called before a child is to be removed; it may veto the removal by returning FALSE. ref is the child before the child to be removed.
void (* child_removed) (SPRepr *repr, SPRepr *child, SPRepr *ref, void * data);
Called after a child is removed; ref is the child that used to precede the removed child.
unsigned int (* change_attr) (SPRepr *repr, const gchar *key, const gchar *oldval, const gchar *newval, void * data);
For Element nodes. Called before an attribute is changed; can veto by returning FALSE.
void (* attr_changed) (SPRepr *repr, const gchar *key, const gchar *oldval, const gchar *newval, void * data);
Called after an attribute has been changed.
unsigned int (* change_content) (SPRepr *repr, const gchar *oldcontent, const gchar *newcontent, void * data);
For Text nodes. Called before an element's content is changed; can veto by returning FALSE.
void (* content_changed) (SPRepr *repr, const gchar *oldcontent, const gchar *newcontent, void * data);
Called after an element's content has been changed.
unsigned int (* change_order) (SPRepr *repr, SPRepr *child, SPRepr *oldref, SPRepr *newref, void * data);
Called before a child of repr is rearranged in its list of children. oldref is the child currently preceding the child; the child will be moved to the position after newref. Can veto by returning FALSE.
void (* order_changed) (SPRepr *repr, SPRepr *child, SPRepr *oldref, SPRepr *newref, void * data);
Called once the child has been moved to its new position in the child order.
NOTE!!!!! the veto callbacks are currently not useful because some functions SPObjects register for callbacks have side-effects -- by the time the veto was made, other callbacks might already have modified things...
(Although it wasn't seen as a problem in Sodipodi, this is on my personal list of things to fix...)
-mental
I've added this function documentation to the repr.h file as it looked very handy to hold onto. It perhaps should be reorganized or moved to a more appropriate file - go ahead.
Bryce
On Fri, 5 Dec 2003, MenTaLguY wrote:
On Thu, 2003-12-04 at 16:25, bulia byak wrote: Though SPRepr provides "signals" for notification when individual nodes change, there is no mechanism to recieve notification for overall document changes.
However, with the addition of the transactions code, it would not be very hard to implement if you wanted it.
SPRepr itself doesn't use GObject signals at present -- SPReprs maintain lists of SPReprEventVectors (added via sp_repr_add_listener), which are used to specify callbacks when something changes.
Here are the current callbacks in an event vector (they may be NULL):
void (* destroy) (SPRepr *repr, void * data);
Called when the repr is destroyed.
unsigned int (* add_child) (SPRepr *repr, SPRepr *child, SPRepr
*ref, void * data);
Called before a child is added; the handler can return FALSE to veto the addition. ref is the child after which the new child is to be added.
<snip>
On Thu, 2003-12-04 at 16:25, bulia byak wrote:
Does anyone have an idea why sp_selection_idle_handler in selection.c is constantly emitting the "selection modified" signal - even two signals, one on the selection and the other on the inkscape object???
There is indeed a constant flood of these signals even when absolutely nothing is happening, not even a mouse move.
Try adding an assert to sp_selection_idle_handler -- selection->idle should never equal 0 when the function is first entered (if it is, then there's a bug in your installed libgtk+).
Another possibility is that one of the handlers for either the "modifed" signal of the SPSelection, or the "selection_modified" signal is actually modifying one of the selected objects.
Try moving the assignment selection->idle = 0 until after both signals have been sent. If that prevents the idle handler from being run constantly, that is your problem...
-mental
participants (3)
-
Bryce Harrington
-
bulia byak
-
MenTaLguY