Redesign of the empty palette.
This commit is contained in:
parent
1815c59217
commit
58527b376c
3 changed files with 45 additions and 25 deletions
|
@ -28,12 +28,9 @@
|
|||
|
||||
namespace editor {
|
||||
|
||||
//TODO move to the palette
|
||||
template<class Item>
|
||||
void editor_palette<Item>::expand_palette_groups_menu(std::vector<std::string>& items)
|
||||
{
|
||||
//TODO
|
||||
//active_menu_ = editor::PALETTE;
|
||||
for (unsigned int i = 0; i < items.size(); ++i) {
|
||||
if (items[i] == "editor-palette-groups") {
|
||||
items.erase(items.begin() + i);
|
||||
|
@ -144,7 +141,6 @@ void editor_palette<Item>::set_group(const std::string& id)
|
|||
}
|
||||
template void editor_palette<t_translation::t_terrain>::set_group(const std::string& id);
|
||||
template void editor_palette<unit_type>::set_group(const std::string& id);
|
||||
//template void editor_palette<void*>::set_group(const std::string& id);
|
||||
|
||||
template<class Item>
|
||||
void editor_palette<Item>::set_group(size_t index)
|
||||
|
@ -154,7 +150,6 @@ void editor_palette<Item>::set_group(size_t index)
|
|||
}
|
||||
template void editor_palette<t_translation::t_terrain>::set_group(size_t index);
|
||||
template void editor_palette<unit_type>::set_group(size_t index);
|
||||
//template void editor_palette<void*>::set_group(size_t index);
|
||||
|
||||
template<class Item>
|
||||
size_t editor_palette<Item>::active_group_index()
|
||||
|
@ -170,7 +165,6 @@ size_t editor_palette<Item>::active_group_index()
|
|||
}
|
||||
template size_t editor_palette<t_translation::t_terrain>::active_group_index();
|
||||
template size_t editor_palette<unit_type>::active_group_index();
|
||||
//template size_t editor_palette<void*>::active_group_index();
|
||||
|
||||
template<class Item>
|
||||
const config editor_palette<Item>::active_group_report()
|
||||
|
@ -188,7 +182,6 @@ const config editor_palette<Item>::active_group_report()
|
|||
}
|
||||
template const config editor_palette<t_translation::t_terrain>::active_group_report();
|
||||
template const config editor_palette<unit_type>::active_group_report();
|
||||
//template const config editor_palette<void*>::active_group_report();
|
||||
|
||||
template<class Item>
|
||||
void editor_palette<Item>::adjust_size(const SDL_Rect& target)
|
||||
|
@ -203,7 +196,6 @@ void editor_palette<Item>::adjust_size(const SDL_Rect& target)
|
|||
}
|
||||
template void editor_palette<t_translation::t_terrain>::adjust_size(const SDL_Rect& target);
|
||||
template void editor_palette<unit_type>::adjust_size(const SDL_Rect& target);
|
||||
//template void editor_palette<void*>::adjust_size(const SDL_Rect& target);
|
||||
|
||||
template<class Item>
|
||||
void editor_palette<Item>::select_fg_item(std::string item_id)
|
||||
|
@ -214,7 +206,6 @@ void editor_palette<Item>::select_fg_item(std::string item_id)
|
|||
}
|
||||
template void editor_palette<t_translation::t_terrain>::select_fg_item(std::string terrain_id);
|
||||
template void editor_palette<unit_type>::select_fg_item(std::string unit_id);
|
||||
//template void editor_palette<void*>::select_fg_item(std::string unit_id);
|
||||
|
||||
template<class Item>
|
||||
void editor_palette<Item>::select_bg_item(std::string item_id)
|
||||
|
@ -225,7 +216,6 @@ void editor_palette<Item>::select_bg_item(std::string item_id)
|
|||
}
|
||||
template void editor_palette<t_translation::t_terrain>::select_bg_item(std::string terrain_id);
|
||||
template void editor_palette<unit_type>::select_bg_item(std::string unit_id);
|
||||
//template void editor_palette<void*>::select_bg_item(std::string unit_id);
|
||||
|
||||
template<class Item>
|
||||
void editor_palette<Item>::swap()
|
||||
|
@ -234,7 +224,6 @@ void editor_palette<Item>::swap()
|
|||
}
|
||||
template void editor_palette<t_translation::t_terrain>::swap();
|
||||
template void editor_palette<unit_type>::swap();
|
||||
//template void editor_palette<void*>::swap();
|
||||
|
||||
template<class Item>
|
||||
size_t editor_palette<Item>::num_items()
|
||||
|
@ -318,7 +307,6 @@ void editor_palette<Item>::draw(bool)
|
|||
}
|
||||
template void editor_palette<t_translation::t_terrain>::draw(bool);
|
||||
template void editor_palette<unit_type>::draw(bool);
|
||||
//template void editor_palette<void*>::draw(bool);
|
||||
|
||||
template<class Item>
|
||||
int editor_palette<Item>::tile_selected(const int x, const int y) const
|
||||
|
|
|
@ -22,27 +22,52 @@
|
|||
#include "editor_palettes.hpp"
|
||||
|
||||
namespace editor {
|
||||
static const std::string empty_string = "";
|
||||
|
||||
/** Empty palette */
|
||||
class empty_palette : public editor_palette<unit_type> {
|
||||
class empty_palette : public common_palette {
|
||||
|
||||
public:
|
||||
|
||||
empty_palette(editor_display &gui, const config& cfg,
|
||||
mouse_action** active_mouse_action)
|
||||
: editor_palette<unit_type>(gui, cfg, 0, 0, active_mouse_action) {};
|
||||
empty_palette(display& gui) : gui_(gui), empty_() {};
|
||||
|
||||
// think about removing it
|
||||
virtual void setup(const config& /*cfg*/) {};
|
||||
//event handling
|
||||
virtual bool left_mouse_click(const int /*x*/, const int /*y*/) { return false;};
|
||||
virtual bool right_mouse_click(const int /*x*/, const int /*y*/) { return false;};
|
||||
|
||||
bool scroll_up() { return false; };
|
||||
bool scroll_down() { return false; };
|
||||
virtual bool scroll_up() { return false;};
|
||||
virtual bool scroll_down() { return false;};
|
||||
|
||||
//drawing
|
||||
virtual void adjust_size(const SDL_Rect& /*target*/) {};
|
||||
virtual void draw(bool) {
|
||||
gui::button* upscroll_button = gui_.find_button("upscroll-button-editor");
|
||||
upscroll_button->hide(true);
|
||||
gui::button* downscroll_button = gui_.find_button("downscroll-button-editor");
|
||||
downscroll_button->hide(true);
|
||||
gui::button* palette_menu_button = gui_.find_button("menu-editor-terrain");
|
||||
palette_menu_button->hide(true);
|
||||
};
|
||||
|
||||
//group
|
||||
virtual void set_group(size_t /*index*/) {};
|
||||
virtual void next_group() {};
|
||||
virtual void prev_group() {};
|
||||
virtual const config active_group_report() { return config();};
|
||||
virtual const std::vector<item_group>& get_groups() const { return empty_; };
|
||||
|
||||
/** Menu expanding for palette group list */
|
||||
virtual void expand_palette_groups_menu(std::vector<std::string>& /*items*/) {};
|
||||
|
||||
//item
|
||||
virtual size_t num_items() {return 0;};
|
||||
virtual size_t start_num() {return 0;};
|
||||
virtual void set_start_item(size_t /*index*/) {};
|
||||
virtual void swap() {};
|
||||
|
||||
private:
|
||||
virtual const std::string& get_id(const unit_type& /*terrain*/) { return empty_string; };
|
||||
display& gui_;
|
||||
std::vector<item_group> empty_;
|
||||
|
||||
virtual void draw_item(SDL_Rect& /*dstrect*/, const unit_type& /*terrain*/,
|
||||
std::stringstream& /*tooltip_text*/) {};
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ palette_manager::palette_manager(editor_display& gui, const config& cfg
|
|||
mouse_action_(active_mouse_action),
|
||||
terrain_palette_(new terrain_palette(gui, cfg, active_mouse_action)),
|
||||
unit_palette_(new unit_palette(gui, cfg, active_mouse_action)),
|
||||
empty_palette_(new empty_palette(gui, cfg, active_mouse_action))
|
||||
empty_palette_(new empty_palette(gui))
|
||||
{
|
||||
unit_palette_->setup(cfg);
|
||||
terrain_palette_->setup(cfg);
|
||||
|
@ -108,6 +108,13 @@ void palette_manager::draw(bool force)
|
|||
|
||||
tooltips::clear_tooltips(loc);
|
||||
|
||||
gui::button* upscroll_button = gui_.find_button("upscroll-button-editor");
|
||||
upscroll_button->hide(false);
|
||||
gui::button* downscroll_button = gui_.find_button("downscroll-button-editor");
|
||||
downscroll_button->hide(false);
|
||||
gui::button* palette_menu_button = gui_.find_button("menu-editor-terrain");
|
||||
palette_menu_button->hide(false);
|
||||
|
||||
active_palette().draw(force);
|
||||
|
||||
update_rect(loc);
|
||||
|
|
Loading…
Add table
Reference in a new issue