Skip to content

Commit

Permalink
Orbs fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
CelticMinstrel committed Feb 17, 2016
1 parent 14c97bc commit bf4e2a4
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 35 deletions.
11 changes: 5 additions & 6 deletions data/gui/default/window/select_orb_colors.cfg
Expand Up @@ -52,7 +52,7 @@

[window]
id = "select_orb_colors"
description = "Select the colours of orbs displayed on units for various purposes."
description = "Select the colors of orbs displayed on units for various purposes."

[resolution]
definition = "default"
Expand All @@ -70,18 +70,15 @@

[grid]
[row]
#grow_factor = 0
[column]
#grow_factor = 1
border = "all"
border_size = 5
horizontal_alignment = "left"
[label]
definition = "title"
label = _ "Choose Orb/Minimap Colours"
label = _ "Choose Orb/Minimap Colors"
[/label]
[/column]

[/row]
{_GUI_ORB_GROUP unmoved (_"Show unmoved orb")}
{_GUI_ORB_GROUP partial (_"Show partial moved orb")}
Expand All @@ -94,6 +91,7 @@
[row]
[column]
horizontal_alignment = "left"
grow_factor = 1
border = "all"
border_size = 5
[button]
Expand All @@ -104,7 +102,7 @@
[/column]
[column]
horizontal_alignment = "right"
grow_factor = 1
grow_factor = 0
border = "all"
border_size = 5
[button]
Expand All @@ -115,6 +113,7 @@
[/column]
[column]
horizontal_alignment = "right"
grow_factor = 0
border = "all"
border_size = 5
[button]
Expand Down
41 changes: 13 additions & 28 deletions src/gui/dialogs/select_orb_colors.cpp
Expand Up @@ -25,16 +25,13 @@
#include "gui/widgets/window.hpp"

#include "preferences.hpp"
#include "game_config.hpp"

#include <boost/bind.hpp>

namespace gui2 {
REGISTER_DIALOG(select_orb_colors);

const char* const tselect_orb_colors::allowed_colors[] = {
"brightgreen", "brightorange", "red"
};

tselect_orb_colors::tselect_orb_colors()
: show_unmoved_(preferences::show_unmoved_orb())
, show_partial_(preferences::show_partial_orb())
Expand Down Expand Up @@ -67,7 +64,7 @@ void tselect_orb_colors::pre_show(CVideo&, twindow& window)
void tselect_orb_colors::display(CVideo& video)
{
tselect_orb_colors dialog;
if(dialog.show(video) == twindow::OK) {
if(dialog.show(video)) {
preferences::set_show_unmoved_orb(dialog.show_unmoved_);
preferences::set_show_partial_orb(dialog.show_partial_);
preferences::set_show_moved_orb(dialog.show_moved_);
Expand All @@ -77,7 +74,7 @@ void tselect_orb_colors::display(CVideo& video)
preferences::set_unmoved_color(dialog.unmoved_);
preferences::set_partial_color(dialog.partial_);
preferences::set_moved_color(dialog.moved_);
preferences::set_allied_color(dialog.moved_);
preferences::set_allied_color(dialog.ally_);
preferences::set_enemy_color(dialog.enemy_);
}
}
Expand Down Expand Up @@ -142,29 +139,17 @@ void tselect_orb_colors::handle_toggle_click(ttoggle_button* clicked, bool& stor

void tselect_orb_colors::handle_reset_click(twindow& window)
{
preferences::clear("show_unmoved_orb");
preferences::clear("show_partial_orb");
preferences::clear("show_moved_orb");
preferences::clear("show_ally_orb");
preferences::clear("show_enemy_orb");

preferences::clear("unmoved_orb_color");
preferences::clear("partial_orb_color");
preferences::clear("moved_orb_color");
preferences::clear("ally_orb_color");
preferences::clear("enemy_orb_color");

show_unmoved_ = preferences::show_unmoved_orb();
show_partial_ = preferences::show_partial_orb();
show_moved_ = preferences::show_moved_orb();
show_ally_ = preferences::show_allied_orb();
show_enemy_ = preferences::show_enemy_orb();
show_unmoved_ = game_config::show_unmoved_orb;
show_partial_ = game_config::show_partial_orb;
show_moved_ = game_config::show_moved_orb;
show_ally_ = game_config::show_ally_orb;
show_enemy_ = game_config::show_enemy_orb;

unmoved_ = preferences::unmoved_color();
partial_ = preferences::partial_color();
moved_ = preferences::moved_color();
ally_ = preferences::allied_color();
enemy_ = preferences::enemy_color();
unmoved_ = game_config::colors::unmoved_orb_color;
partial_ = game_config::colors::partial_orb_color;
moved_ = game_config::colors::moved_orb_color;
ally_ = game_config::colors::ally_orb_color;
enemy_ = game_config::colors::enemy_orb_color;

setup_orb_group("unmoved", show_unmoved_, unmoved_, window, false);
setup_orb_group("partial", show_partial_, partial_, window, false);
Expand Down
1 change: 0 additions & 1 deletion src/gui/dialogs/select_orb_colors.hpp
Expand Up @@ -32,7 +32,6 @@ class tselect_orb_colors : public tdialog {
*/
static void display(CVideo& video);
private:
static const char* const allowed_colors[10];
void setup_orb_group(std::string base_id, bool& shown, std::string& color, twindow& window, bool connect = true);
void handle_orb_click(ttoggle_button* clicked, const std::vector<ttoggle_button*>& group, std::string& storage);
void handle_toggle_click(ttoggle_button* clicked, bool& storage);
Expand Down

0 comments on commit bf4e2a4

Please sign in to comment.