
On Tue, Sep 16, 2008 at 2:36 PM, Krzysztof KosiĆski <tweenk.pl@...400...> wrote:
I have committed a rewrite of the preferences system. The old Inkscape::Preferences stub class was replaced by a meaningful singleton, and everything in prefs-utils.h except the recent file list was replaced with stub functions using the new class. I replaced all instances of prefs_get_string_attribute(), create_pref(), pref_path_number_of_children() and pref_path_get_nth_children().
Just curious, what are the advantages of this? Performance, maintainability?
I'll now concentrate on refactoring code which contains calls to inkscape_get_repr() - it is equivalent to the new _getNode member function, but it should be private. I have also introduced boolean preferences in a backwards-compatible way - generally you can replace prefs_get_int_attribute_limited(blah1, blah2, 0, 1, 0) with prefs->getBool(blah1, blah2).
and what happens to the default which was returned if no such repr was in the prefs?
There is however some weird breakage in the Calligraphy tool - e.g. sometimes it seems that tracing is on while the widgets indicate that it is off. I don't know whether this is something introduced by the rewrite or a pre-existing bug. Can someone more familiar with this code (widgets/toolbox.cpp) take a look?
The widget simply does not watch for changes in the repr, so if it is changed by someone outside, such a discrepancy will arise. Typically the repr is changed by the button's toggle callback only, and therefore there's no discrepancy. Please check if something else can change this pref value (e.g. for this reason, such prefs that are editable on the control bars of tools, should not be in the Preferences dialog).