The original design of using a "null" command to indicate a disabled hot-key is ambiguous with regards to when to save a user hot-key to preferences as well as when a default hot-key should be flagged as disabled. So introduce a separate disabled flag to resolve the ambiguity.
Where the disabled flag is set to true, the hot-key should not be written to preferences unless it is a default hot-key.
Only save non-default hot-keys to the preferences file if the hot-key is active (ie command != 'null').
Clearing hot-keys in memory (via the hot-key functions in the game) only sets the command to 'null', which currently gets written to the preferences file if it is a custom, ie non-default, hot-key. Over time, creating and clearing hot-keys results in a lot of redundant hot-key entries. The nice thing about this update is that it will remove redundant command='null' entries for existing preferences files as well as prevent it from being included in future ones..
I am making this change against the sdl2 branch instead of master because the sdl2 branch already contains a lot of rewriting of the hot-key functionality. Testing against master was also hopeless because hot-key handling is still rather broken building against SDL 1.2.
images/editor/brush.png and images/misc/hover-hex.png were being drawn
on top of each other, resulting in an unsightly editor brush. Removed the
latter.
This sets the restore_ flag to true for the obvious dialogs I've found
that are used on the title-screen.
Also, make GUI1 dialogs mark all buttons dirty on a DRAW_ALL_EVENT to
ensure the buttons get redrawn.
Groups are handled on a per-dialog basis, and are currently specialized for tselectable_
inheritors. They provide a convenient vector-of-pairs interface that ensure only one
widget is selected at one time and allows binding of values to widgets which can be
fetched at a later point.
This makes the map-editor aware of the draw-layering. Since it's a
subclass of the display-class, but relies on the buttons being
re-created in the superclass I've moved that code into the subclass
instead. This way there won't be any infinite loops with a full redraw
triggering another full redraw.
I have also introduced a small workaround in the GUI1 button widget,
where it would sometimes add the postfix to overlay image names that
already contained the postfix. If the image name ends in the postfix,
the postfix is removed from the name before re-added. This ensures
that the files are successfully found.
#include <iterator> is needed for back_insert_iterator. This was included in config.hpp, but inclusion of that header here was removed in the previous commit.