Progress So Far

Not going into details in this post, I will just mention about what progress I have made in the past two weeks.

  1. Adding Objects to Selector, in XML repr too
  2. Deleting objects from Style Dialog as well as from repr (this was a tough one)
  3. Selecting all matching objects when any row(selector) in Style Dialog
  4. Selecting matching selectors when objects in the drawing are selected
  5. Opening CSS dialog on double clicking selector
  6. Populating CSS dialog with properties of selector selected in Style Dialog
  7. Make properties editable in CSS dialog and update XML repr so changes are reflected in the drawing

Besides polishing the last two above, dragging selectors along with undo-redo support is left. It has been a pleasure so far! 😀

I will dig the details on each of the above in coming posts.

A Step Back & Ahead

Well adding selector to class seemed pretty easy, eh? I was feeling pretty accomplished unless I became aware I am heading not towards the target. Yesterday morning, I was told that selector was not to be added to the class attribute and rather to style attribute to the object. And this messy head confused style element with style attribute.

Selectors should be a part of style element and not style attribute. After spending entire June 8 playing and making it almost work with style attribute and moving to style element today, things seem to be working to some extent. Yes, on clicking the + at bottom of style dialog, the text in entry box is written as selector to style element. A new style element is created on a click on + of the form shown below:

Screenshot from 2016-06-09 23:04:00

Making use of attributeList() to get the style properties posed a challenge in itself, it kept returning a 0 or a 1 and no attributes. Finally iterated them using List<AttributeRecord> to get only the style property’s value and then suffixing it to the selector name gave me what is visible in the style element in the picture above.

Next I used createElement() to create a node svg:style. The content is set using createTextNode() and adding it to the svg:style element. While writing this, I encountered the issue: parsing error: 1:0:could not recognize next production, solved it by enclosing the content value in braces {}.

Currently, I am working on a map, that maps a selector’s name to style properties. Using this map will help in selection of objects corresponding to a selector and vice-versa. Any manipulation to this map will also keep the stylesheet updated.

Also using this map, I am trying to populate the treeview, whenever a stylesheet with some selectors entailed is opened, with the selecotor names available.