Fixes bug #4410
(Missing GUI elements after switching between windowed and fullscreen).
This commit is contained in:
parent
e7c0060052
commit
af4b15dd0a
4 changed files with 29 additions and 4 deletions
|
@ -139,15 +139,22 @@ void replay_controller::init_gui(){
|
|||
|
||||
void replay_controller::init_replay_display(){
|
||||
DBG_REPLAY << "initializing replay-display... " << (SDL_GetTicks() - ticks_) << "\n";
|
||||
|
||||
rebuild_replay_theme();
|
||||
gui_->get_theme().theme_reset().attach_handler(this);
|
||||
DBG_REPLAY << "done initializing replay-display... " << (SDL_GetTicks() - ticks_) << "\n";
|
||||
}
|
||||
|
||||
void replay_controller::rebuild_replay_theme(){
|
||||
const config* theme_cfg = get_theme(game_config_, level_["theme"]);
|
||||
if (theme_cfg) {
|
||||
const config* replay_theme_cfg = theme_cfg->child("resolution")->child("replay");
|
||||
if (NULL != replay_theme_cfg)
|
||||
gui_->get_theme().modify(replay_theme_cfg);
|
||||
gui_->get_theme().modify(replay_theme_cfg);
|
||||
//Make sure we get notified if the theme is redrawn completely. That way we have
|
||||
//a chance to restore the replay controls of the theme as well.
|
||||
gui_->invalidate_theme();
|
||||
}
|
||||
|
||||
DBG_REPLAY << "done initializing replay-display... " << (SDL_GetTicks() - ticks_) << "\n";
|
||||
}
|
||||
|
||||
void replay_controller::reset_replay(){
|
||||
|
@ -395,6 +402,10 @@ void replay_controller::show_statistics(){
|
|||
menu_handler_.show_statistics(gui_->playing_team()+1);
|
||||
}
|
||||
|
||||
void replay_controller::handle_generic_event(const std::string& name){
|
||||
rebuild_replay_theme();
|
||||
}
|
||||
|
||||
bool replay_controller::can_execute_command(hotkey::HOTKEY_COMMAND command, int index) const
|
||||
{
|
||||
bool result = play_controller::can_execute_command(command,index);
|
||||
|
|
|
@ -57,6 +57,8 @@ private:
|
|||
void update_teams();
|
||||
void update_gui();
|
||||
void init_replay_display();
|
||||
void rebuild_replay_theme();
|
||||
void handle_generic_event(const std::string& name);
|
||||
|
||||
game_state gamestate_start_;
|
||||
gamestatus status_start_;
|
||||
|
|
|
@ -498,7 +498,9 @@ theme::menu::menu(const config& cfg) : object(cfg), context_(cfg["is_context_men
|
|||
items_(utils::split(cfg["items"]))
|
||||
{}
|
||||
|
||||
theme::theme(const config& cfg, const SDL_Rect& screen) {
|
||||
theme::theme(const config& cfg, const SDL_Rect& screen) :
|
||||
theme_reset_("theme_reset")
|
||||
{
|
||||
config tmp;
|
||||
expand_partialresolution(tmp, cfg);
|
||||
do_resolve_rects(tmp, cfg_);
|
||||
|
@ -556,6 +558,9 @@ bool theme::set_resolution(const SDL_Rect& screen)
|
|||
if (title_stash.find(m->get_id()) != title_stash.end())
|
||||
m->set_title(title_stash[m->get_id()]);
|
||||
}
|
||||
|
||||
theme_reset_.notify_observers();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
|
||||
#include "SDL.h"
|
||||
#include "config.hpp"
|
||||
#include "generic_event.hpp"
|
||||
|
||||
typedef struct { size_t x1,y1,x2,y2; } _rect;
|
||||
|
||||
|
@ -220,12 +221,18 @@ public:
|
|||
|
||||
const tborder& border() const { return border_; }
|
||||
|
||||
events::generic_event& theme_reset() { return theme_reset_; }
|
||||
|
||||
private:
|
||||
theme::object& find_element(std::string id);
|
||||
void add_object(const config& cfg);
|
||||
void remove_object(std::string id);
|
||||
void set_object_location(theme::object& element, std::string rect_str, std::string ref_id);
|
||||
|
||||
//notify observers that the theme has been rebuilt completely
|
||||
//atm this is used for replay_controller to add replay controls to the standard theme
|
||||
events::generic_event theme_reset_;
|
||||
|
||||
static std::map<std::string, config> known_themes;
|
||||
std::string cur_theme;
|
||||
config cfg_;
|
||||
|
|
Loading…
Add table
Reference in a new issue