This removes the global accessors for individual options in favor of a
proxy template class with a simpler per-type API. This adds compile-time
checks to validate that the right option is used with the right type
when accessing it directly.
Fix some source strings in the source code that are marked for
translation to be more formally/grammatically correct and easier to
localize.
References #1029
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
* Clean-up ConfigManager options
Many of the options in ConfigManager were not actually used.
* Some options are only used by wx, they have been moved to gopts. In
addition, the type of the option has been changed to "bool" when
applicable.
* Some options are only used by SDL and do not have a corresponding
configuration option, they have been moved to the SDL implementation.
* Some options are not used at all, they have been removed.
Move ru.po to ru_RU.po because it is the more complete translation, and
the latter is checked first.
Fix#1057
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
This reverts commit 1ac7ac999b.
The %% sequence turned out to not be dealt with specially by gettext
tools.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Add a few translation markers for strings that are translated in the
wxWidgets catalogs, which we do not pull yet.
Also change the string "% of normal:" to "percent of normal:" because
the percent sign was causing an error in poedit.
Fix#1029.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
* Add convenience direct accessors to individual Options.
* Move BasicOptionObserver to a separate header and allow it to
observer multiple options. This also removes the include for
"config/option.h" for using this observer, reducing build time.
* Never skip the "Plugin" option when changing filters. This is
already handled properly in the GameArea class. If the plugin is
unusable, GameArea resets the filter to the default value.
* Make the OptionID names slightly less long and fix the inconsistent
naming in the enum.
This adds a generic Observer interface to config::Option. To
demonstrate its intended usage, the Display Configuration dialog and
the options it controls have been updated to be entirely handled via
the config::Option class.
Implementations for wxValidator are used to validate the flow between
the UI and the underlying Option. In turn, modifying the Option value
triggers all of its observers that should then do what they need to
do.
Rather than explicitly calling all of the needed methods after
modifying a global option value, the UI elements that need to be
notified when an Option value is modified will be notified via their
observers. Runtime assert checks are put in place to prevent infinite
recursion if an observer attempts to modify an Option while handling
the observer callback.
Once all uses of Options have been updated, we should get into a state
where the following will be true:
* cmdevents.cpp will no longer rely on the application state.
* All dialogs will have been moved to specific implementations,
reducing the size of guiinit.cpp
* update_opts() will no longer need to be called and will be removed.
This will then make it easier to update accelerator handling to be
done with config::UserInput.
Bug: #745
Add support for `eglSwapInterval()` to enable or disable VSync on
Wayland.
Also add status messages for enabling or disabling VSync, for both EGL
and GLX.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
This change introduces a new class to handle all of the INI options
data, VbamOption. A VbamOption represents a single option in the INI
file. It is not constructible outside of its implementation, which
prevents the initialization of incorrectly formatted options.
Internally, a VbamOption points to a global variable in memory, which
holds the value used at runtime. This is because various parts of the
codebase edit the global variable rather than going through a central
registry. This also means we need to separately update the INI values.
In the future, we may be able to convert all existing reads and writes
to the global variable to go through VbamOption. Individual UX elements
could link directly to getters/setters for a specific VbamOption rather
than have duplicate data.
VbamOption replaces the opt_desc struct and the global opts array. All
users of opt_desc and the global opts array have been updated.
This is a necessary preliminary change to better support a refactor of
accelerators, through wxUserInput.
Issue: #745, #158