Adjust the palette size for low resolutions.

This commit is contained in:
fendrin 2013-05-03 20:37:28 +02:00
parent 1a3a7b3dce
commit a8b7bb529b
5 changed files with 5 additions and 6 deletions

View File

@ -225,7 +225,7 @@ void editor_palette<Item>::adjust_size(const SDL_Rect& target)
static_cast<unsigned> (space_for_items / item_space_) *
item_width_;
nitems_ = std::min<int>(items_fitting, nmax_items_);
buttons_.resize(nitems_, gui::tristate_button(gui_.video(), "", this));
buttons_.resize(nitems_, gui::tristate_button(gui_.video(), this));
set_location(target);
set_dirty(true);
}

View File

@ -219,7 +219,7 @@ void terrain_palette::draw_item(const t_translation::t_terrain& terrain,
terrain_palette::terrain_palette(editor_display &gui, const config& cfg,
mouse_action** active_mouse_action)
//TODO avoid magic numbers
: editor_palette<t_translation::t_terrain>(gui, cfg, 38, 4, active_mouse_action)
: editor_palette<t_translation::t_terrain>(gui, cfg, 36, 4, active_mouse_action)
{
}

View File

@ -38,12 +38,11 @@ const int horizontal_padding = font::SIZE_SMALL;
const int checkbox_horizontal_padding = font::SIZE_SMALL / 2;
const int vertical_padding = font::SIZE_SMALL / 2;
tristate_button::tristate_button(CVideo& video, const std::string& label,
tristate_button::tristate_button(CVideo& video,
editor::common_palette* palette,
std::string button_image_name, SPACE_CONSUMPTION spacing,
const bool auto_join) :
widget(video, auto_join),
label_(label),
baseImage_(NULL), touchedBaseImage_(NULL), activeBaseImage_(NULL),
itemImage_(NULL),
pressedDownImage_(NULL), pressedUpImage_(NULL), pressedBothImage_(NULL),

View File

@ -36,7 +36,7 @@ public:
enum SPACE_CONSUMPTION { DEFAULT_SPACE, MINIMUM_SPACE };
tristate_button(CVideo& video, const std::string& label,
tristate_button(CVideo& video,
editor::common_palette* palette,
std::string button_image="",
SPACE_CONSUMPTION spacing=DEFAULT_SPACE,

View File

@ -119,7 +119,7 @@ void unit_palette::draw_item(const unit_type& u, surface& image, std::stringstre
unit_palette::unit_palette(editor_display &gui, const config& cfg,
mouse_action** active_mouse_action)
//TODO avoid magic numbers
: editor_palette<unit_type>(gui, cfg, 72, 2, active_mouse_action)
: editor_palette<unit_type>(gui, cfg, 36, 4, active_mouse_action)
{
}