On 16-4-2011 18:17, Jon Cruz wrote:
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.
Shared with which other projects? It is nice that we benefit by this sharing, and as such, I see that the code is updated very regularly from improvements by the other sharing projects.
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.
Didn't my commit just do that? "tell it to use another class" ?
This also uses GTK+ directly, which is our main toolkit.
Sorry, I do not understand what you meant by that comment.
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.
Exactly what I meant: subclassing is not done, maybe because it is a pain in C-style.
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.
I think Krzysztof's comments about the GSoC C++-ification were meant as a disappointment (which I share). C++-ification does not mean changing functions to class::member stuff. It means, for example, getting rid of elaborate code to get polymorphism and virtual functions in C-style, by using C++ classes and virtual functions.
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.
I suppose the added functionality in Inkscape is not worth "breaking" the "sharing of code" that changes approximately once every year. Upon reverting, please add your arguments to the 5+ wishlist reports on Launchpad for math expression support in input fields, and mark them as "won't fix".
-Johan