ValaCAT. Some design aspects (Part 2).
por Marcos Chavarría Teijeiro
These are some details I’m including into the new application. I’m really a newbie in most of this aspects so any kind of feedback is welcome.
Many parts of the core program and the plugins need to highlight some part of a message. In order to make this easy to developers and extensible I have create Filters. This design is a simple decorator pattern applied to message strings.
The code for get_string method in Filter class can be something similar to:
Where filter is a template method that has to be implemented by the Filter subclasses. So the idea is that when some part of the program needs to highlight some part of an string then it adds a filter to that string. This filter has to implement the filter method so it modifies the input string adding the desired Pango markup.
It could be also a good idea to provide some useful filter methods such as a method that highlights the n occurrence of a substring inside a string.
I have decide to make a Virtaal like user interface. Here you can see a mockup:
As you can see I’m quite terrible with design 😉 but I think that the idea is clear. Have the edit boxes inside the message list. The part of having tabs inside the edit panel is just an idea and I don’t even know if GTK allows to do it so if there is a GTK expert out there a hint about this will be really appreciated.