Adding Objects to Selector (Part 2)

Any changes in the Style Dialog like adding an object to a selector must be updated in XML representation of the drawing. Clicking ‘+’ in front of a selector adds objects to that selector.

If the selector to which object is added is a class selector, then the class attribute of the object is set to the selector name. The screenshot below shows this:

Screenshot from 2016-07-27 12:10:58

If the object is deleted by clicking ‘-‘ in front of its row, then the class attribute that was set due to the selector is unset.

Screenshot from 2016-07-27 12:11:19

This is implemented in _handleButtonEvent(GdkEventButton event). Whenever first column of the selector row that is a ‘+’ is clicked, the _desktop is checked for selection. If it is not empty, those objects are added to selector. Rows are added with their content set as:

childrow =
(_store->append(row->children()));
childrow[_mColumns._selectorLabel] = "#" + std::string(obj->getId());
childrow[_mColumns._colAddRemove] = false;
childrow[_mColumns._colObj] = _desktop->selection->list();

Finally, _styleChild i.e. the style element is obtained and _updateStyleContent() is called to update the XML representation.

Leave a Reply

Follow

Get notified with the latest posts

Plugin Supporter WordPress Post Navigation
%d bloggers like this: