This re-creates the main display-gui() buttons on a full redraw to take
into account that the theme expects them to be out of sync. As a
consequence I have also been forced to refactor how said buttons are
managed and introduced a new method to join the same event context
as another component.
This commit converts the following function calls:
* boost::bind -> std::bind
* boost::function and boost::functionN -> std::function
* boost::ref and boost::cref -> std::ref and std::cref
* boost::bad_function_call -> std::bad_function_call
In the process, it was discovered that std::bind has trouble with overloaded
functions. There were two such cases in the code:
* gui2::twindow had an ancient unused overload to draw(). The overload was removed.
* gui2::trepeating_button was binding tdispatcher::fire. This case was converted
to a lambda.
This removes all legacy SDL1.2 code. It was done by invoking:
coan source --replace --no-transients -D"SDL_VERSION_ATLEAST(X, Y, Z)"=1 <file>
on each file.
This adds the necessary bells and whistles to resize the GUI1 buttons
used in the main game display. It is rather painful as it involves
re-setting most of the attributes that affect the size.
These changes also adds two new draw-methods to the display class and
gets rid of the default parameters. This is to avoid warnings from
clang since the draw() method comes from a superclass to display now.
The GUI1 button's set_image has been updated to treat the image path
in the same way as it is treated in the constructor. This should not
be a problem since the method is not called from anywhere but the
display class, and that call is added in this commit.
This fixes an assertion failure at exit which was caused by the event
contexts being cleaned up before the dummy display. There is no need
for the dummy display implementation to ever receive events so the
functionality has been extended for it to not join an event context,
resolving the assertion failure.
This makes the display class be aware of the layered rendering events (DRAW_ALL) and make it mark itself as dirty on certain window events. It also makes sure that the layers are redrawn in the correct order. GUI2 is now appearing to handle events properly, but GUI1 is still having issues with dialogs. And there's an assertion failure on program exit.
name= has no effect but can be used to delete the item. I also changed
[item] to automatically create an id (in case no id was given) and
return that (only usable if called from lua).
I used the id= field from overlay class for this, it was previously only
used by the editor. Not sure if it is a good idea to reuse the id field.
This adds dynamic layout functionality, which is invoked on a full
redraw and upon element creation. It also makes sure that there's no
attempt to do a surface restore on negative widhts or heights as
introduced support for in SDL2. Finally, there's a workaround for text
being clipped by 1-2 pixels in GUI1 buttons.
And related commits.
This reverts commit 545253ec2b.
This reverts commit 1215f65eb8.
This reverts commit 11664f4024.
This reverts commit e948df3424.
This reverts commit 3781e7839f.
This commits were reverted to exclude them from wesnoth 1.13.2 release because:
1) We are still unsure about the best name oftthese attributes
2) This breaks multiple campaigns, including LoW and the tutorial.
Feel free to revert this revert after 1.13.2 when thse issues can be solved..
Change more copies of the window surface to be references
instead. This will make sure they do not contain a stale version that
has a pointer that points to freed memory.
This makes it so errors in image::save_image() are printed to stderr
using our log facilities before returning, and also propagates the
function's result to screenshot()'s callers instead of a computed
screenshot size that doesn't hold true for PNG images.
Additionally, a couple of existing error messages have been reworded and
are now emitted through the log facilities instead of being sent
directly to stderr.
When the slider widget was added to ThemeWML, some work was not
done apparently to make it play nicely with regards to focus and
key events with the other theme wml widgets, causing it to retain
focus for keyboard events indefinitely. At the time this was
resolved by disabling these events, but this cripples the many
other sliders in the game. In this commit we introduce a subclass
zoom_slider which has this functionality disabled, and use that
for zoom sliders, so that we can get the desired functionality
back for the other sliders. See parent of this commit for more
info.
The filter context is, game_board + tod manager.
game_display can (and now does) implement this interface,
also game_state. This permits both animations and engine
components to use it.
According to clang boost/function.hpp does not have include guards,
and from inspecting clang diagnostics we include it many times
in several compilation units. This commit adds an external include
guard to all of our includes of this header, it was made using
find . -type f -exec sed -i 's/^#include <boost\/function\.hpp>$/\n#ifndef I
and inspecting the results.
drawable unit inherits from unit, and implements the draw function,
used only by the display. when the display wants to use the function,
it casts a unit pointer to a drawable_unit, and draws it. this
improves encapsulation.
This commit adds two classes -- fake_unit, and fake_unit_manager,
both split off from code contained in game_display. The display
object is reconfigured to hold a pointer to the manager and
display the units it contains. The rest of the code is configured
to add fake units to the manager, not the display.
This improves encapsulation and helps to reduce the game_display
class.
After this commit e4eb0a3ede the
replay viewer would segfault during prestart events. However, it
turns out that nothing in the replay viewer, or in that commit,
was directly causing the segault. Instead, the display object
was holding dangling pointers for no reason, when it could have.
been simply computing the correct value (very cheaply). We clean
up the code in the display objects to fix the segfault.
This commit adds virtual functions covering "observers",
"displayed_unit_hex", and "playing_side", in display:: object.
This allows to avoid dynamic casts in the reports.cpp file, and
to eliminate a header. It avoids the possibility of segfault when
using the editor if the reports context isn't set up correctly.