
On Apr 16, 2011, at 6:04 AM, Johan Engelen wrote:
I stick to the commit message of r10168.
The C code is very verbose, difficult to read, and no fun to maintain. Especially subclassing is terrible in C-style, and I guess this is why there is so much duplicate code to be found in the UI: nobody can re-use widgets from other parts.
In all C++ dialogs/widgets it is easy to add the extra functionality, and I will do it. In all C code, I will not.
Yes, but the big problem is that you are looking at *shared* code, not Inkscape-only code.
There are actually many other ways to get things in there, with the design such that an ege action can be set to create widgets of other types... so the ege code does not need to be changed, just told which class to use.
This also uses GTK+ directly, which is our main toolkit.
Also the main reason for duplicate code is not inability to subclass, but lack of understanding by many implementing things. Too much is just copied and pasted instead of subclassed, etc. As Krzysztof noted looking into the GSoC C++-ification project, much of the code being changed was extremely similar in C++ as in C, with mainly the long function names being changed to class::member declarations, etc.
Also keep in mind that we have several different things going on here:
* C code * GTK+ C code * C++ code * GtkMM code
And all are different.
But again, the bottom line is that when you changed the C files that were commented as needing to be in C, you broke shared code that was being used in other projects and that will need to be reverted. And there is a proper way to tell that C code to use your C++ widgets so that you don't have to worry about mucking with 'no fun' C code at all.