tab style fixes

This commit is contained in:
Tomasz Śniatowski 2009-02-24 20:10:53 +01:00
parent 69364188fe
commit 180cc653e3
9 changed files with 154 additions and 154 deletions

View file

@ -124,7 +124,7 @@ editor_action_chain* editor_action_chain::perform(map_context& mc) const {
}
void editor_action_chain::perform_without_undo(map_context& mc) const
{
foreach (editor_action* a, actions_) {
foreach (editor_action* a, actions_) {
if (a != NULL) {
a->perform_without_undo(mc);
}

View file

@ -42,14 +42,14 @@ namespace editor2 {
*/
class editor_action_whole_map : public editor_action
{
public:
editor_action_whole_map(const editor_map& m)
: m_(m)
{
}
void perform_without_undo(map_context& m) const;
protected:
editor_map m_;
public:
editor_action_whole_map(const editor_map& m)
: m_(m)
{
}
void perform_without_undo(map_context& m) const;
protected:
editor_map m_;
};
/**
@ -154,13 +154,13 @@ class editor_action_chain : public editor_action
/**
* Perform all the actions in order
*/
void perform_without_undo(map_context& m) const;
void perform_without_undo(map_context& m) const;
protected:
protected:
/**
* The action pointers owned by this action chain
*/
std::deque<editor_action*> actions_;
std::deque<editor_action*> actions_;
};
@ -170,13 +170,13 @@ class editor_action_chain : public editor_action
*/
class editor_action_location : public editor_action
{
public:
editor_action_location(map_location loc)
: loc_(loc)
{
}
protected:
map_location loc_;
public:
editor_action_location(map_location loc)
: loc_(loc)
{
}
protected:
map_location loc_;
};
/** Base class for actions which in addition to acting on a hex,
@ -184,14 +184,14 @@ class editor_action_location : public editor_action
*/
class editor_action_location_terrain : public editor_action_location
{
public:
editor_action_location_terrain(map_location loc,
public:
editor_action_location_terrain(map_location loc,
t_translation::t_terrain t)
: editor_action_location(loc), t_(t)
{
}
protected:
t_translation::t_terrain t_;
: editor_action_location(loc), t_(t)
{
}
protected:
t_translation::t_terrain t_;
};
/**
@ -199,15 +199,15 @@ class editor_action_location_terrain : public editor_action_location
*/
class editor_action_area : public editor_action_extendable
{
public:
editor_action_area(const std::set<map_location>& area)
: area_(area)
{
}
public:
editor_action_area(const std::set<map_location>& area)
: area_(area)
{
}
bool add_location(const map_location& loc);
void add_locations(const std::set<map_location>& locs);
void extend(const editor_map& map, const std::set<map_location>& locs);
protected:
protected:
std::set<map_location> area_;
};
@ -216,17 +216,17 @@ class editor_action_area : public editor_action_extendable
*/
class editor_action_paste : public editor_action_extendable
{
public:
editor_action_paste(const map_fragment& paste, const map_location& offset = map_location(0,0))
: offset_(offset), paste_(paste)
{
}
editor_action_paste* perform(map_context& mc) const;
void perform_without_undo(map_context& mc) const;
public:
editor_action_paste(const map_fragment& paste, const map_location& offset = map_location(0,0))
: offset_(offset), paste_(paste)
{
}
editor_action_paste* perform(map_context& mc) const;
void perform_without_undo(map_context& mc) const;
void extend(const editor_map& map, const std::set<map_location>& locs);
protected:
protected:
map_location offset_;
map_fragment paste_;
map_fragment paste_;
};
/**
@ -236,13 +236,13 @@ class editor_action_paste : public editor_action_extendable
*/
class editor_action_paint_hex : public editor_action_location_terrain
{
public:
editor_action_paint_hex(const map_location& loc, t_translation::t_terrain t)
: editor_action_location_terrain(loc, t)
{
}
editor_action_paint_hex* perform(map_context& mc) const;
void perform_without_undo(map_context& mc) const;
public:
editor_action_paint_hex(const map_location& loc, t_translation::t_terrain t)
: editor_action_location_terrain(loc, t)
{
}
editor_action_paint_hex* perform(map_context& mc) const;
void perform_without_undo(map_context& mc) const;
};
/**
@ -250,15 +250,15 @@ class editor_action_paint_hex : public editor_action_location_terrain
*/
class editor_action_paint_area : public editor_action_area
{
public:
editor_action_paint_area(const std::set<map_location>& area,
public:
editor_action_paint_area(const std::set<map_location>& area,
t_translation::t_terrain t, bool one_layer=false)
: editor_action_area(area), t_(t), one_layer_(one_layer)
{
}
editor_action_paste* perform(map_context& mc) const;
void perform_without_undo(map_context& mc) const;
protected:
: editor_action_area(area), t_(t), one_layer_(one_layer)
{
}
editor_action_paste* perform(map_context& mc) const;
void perform_without_undo(map_context& mc) const;
protected:
t_translation::t_terrain t_;
bool one_layer_;
};
@ -268,14 +268,14 @@ class editor_action_paint_area : public editor_action_area
*/
class editor_action_fill : public editor_action_location_terrain
{
public:
editor_action_fill(map_location loc,
public:
editor_action_fill(map_location loc,
t_translation::t_terrain t, bool one_layer=false)
: editor_action_location_terrain(loc, t), one_layer_(one_layer)
{
}
editor_action_paint_area* perform(map_context& mc) const;
void perform_without_undo(map_context& mc) const;
: editor_action_location_terrain(loc, t), one_layer_(one_layer)
{
}
editor_action_paint_area* perform(map_context& mc) const;
void perform_without_undo(map_context& mc) const;
protected:
bool one_layer_;
};
@ -285,13 +285,13 @@ class editor_action_fill : public editor_action_location_terrain
*/
class editor_action_starting_position : public editor_action_location
{
public:
editor_action_starting_position(map_location loc, int player)
: editor_action_location(loc), player_(player)
{
}
editor_action* perform(map_context& mc) const;
void perform_without_undo(map_context& mc) const;
public:
editor_action_starting_position(map_location loc, int player)
: editor_action_location(loc), player_(player)
{
}
editor_action* perform(map_context& mc) const;
void perform_without_undo(map_context& mc) const;
protected:
int player_;
};

View file

@ -45,9 +45,9 @@ namespace editor2 {
*/
class editor_action
{
public:
editor_action();
virtual ~editor_action();
public:
editor_action();
virtual ~editor_action();
/**
* Perform the action, returning an undo action that,

View file

@ -50,9 +50,9 @@ brush::brush(const config& cfg)
add_relative_location(x, y);
++cfg_range.first;
}
if (relative_tiles_.empty()) {
WRN_ED << "Empty brush definition, name=" << name_ << "\n";
}
if (relative_tiles_.empty()) {
WRN_ED << "Empty brush definition, name=" << name_ << "\n";
}
}
void brush::add_relative_location(int relative_x, int relative_y)

View file

@ -116,23 +116,23 @@ editor_controller::editor_controller(const config &game_config, CVideo& video, m
init_map_generators(game_config);
init_tods(game_config);
init_sidebar(game_config);
init_music(game_config);
init_music(game_config);
hotkey_set_mouse_action(hotkey::HOTKEY_EDITOR_TOOL_PAINT);
rng_.reset(new rand_rng::rng());
rng_setter_.reset(new rand_rng::set_random_generator(rng_.get()));
hotkey::get_hotkey(hotkey::HOTKEY_QUIT_GAME).set_description(_("Quit Editor"));
get_map_context().set_starting_position_labels(gui());
cursor::set(cursor::NORMAL);
image::set_colour_adjustment(preferences::editor_r(), preferences::editor_g(), preferences::editor_b());
theme& theme = gui().get_theme();
const theme::menu* default_tool_menu = NULL;
foreach (const theme::menu& m, theme.menus()) {
std::string s = m.get_id();
if (m.get_id() == "draw_button_editor") {
default_tool_menu = &m;
break;
}
}
image::set_colour_adjustment(preferences::editor_r(), preferences::editor_g(), preferences::editor_b());
theme& theme = gui().get_theme();
const theme::menu* default_tool_menu = NULL;
foreach (const theme::menu& m, theme.menus()) {
std::string s = m.get_id();
if (m.get_id() == "draw_button_editor") {
default_tool_menu = &m;
break;
}
}
refresh_all();
events::raise_draw_event();
if (default_tool_menu != NULL) {
@ -190,7 +190,7 @@ void editor_controller::init_mouse_actions(const config& game_config)
new mouse_action_paste(clipboard_, key_)));
foreach (const theme::menu& menu, gui().get_theme().menus()) {
if (menu.items().size() == 1) {
hotkey::HOTKEY_COMMAND hk = hotkey::get_hotkey(menu.items().front()).get_id();
hotkey::HOTKEY_COMMAND hk = hotkey::get_hotkey(menu.items().front()).get_id();
mouse_action_map::iterator i = mouse_actions_.find(hk);
if (i != mouse_actions_.end()) {
i->second->set_toolbar_button(&menu);
@ -200,13 +200,13 @@ void editor_controller::init_mouse_actions(const config& game_config)
foreach (const config* c, game_config.get_children("editor_tool_hint")) {
mouse_action_map::iterator i = mouse_actions_.find(hotkey::get_hotkey((*c)["id"]).get_id());
if (i != mouse_actions_.end()) {
if ((*c)["id"] != "editor-paste") {
std::stringstream dss;
dss << hotkey::get_hotkey((*c)["id"]).get_description();
dss << "\n";
dss << (*c)["text"];
hotkey::get_hotkey((*c)["id"]).set_description(dss.str());
}
if ((*c)["id"] != "editor-paste") {
std::stringstream dss;
dss << hotkey::get_hotkey((*c)["id"]).get_description();
dss << "\n";
dss << (*c)["text"];
hotkey::get_hotkey((*c)["id"]).set_description(dss.str());
}
mouse_action_hints_.insert(std::make_pair(i->first, (*c)["text"]));
}
}
@ -249,7 +249,7 @@ void editor_controller::init_music(const config& game_config)
foreach (const config* i, cfg->get_children("music")) {
sound::play_music_config(*i);
}
sound::commit_music_changes();
sound::commit_music_changes();
}
@ -1032,10 +1032,10 @@ void editor_controller::show_menu(const std::vector<std::string>& items_arg, int
}
++i;
}
if (!items.empty() && items.front() == "editor-switch-map") {
expand_open_maps_menu(items);
context_menu = true; //FIXME hack to display a one-item menu
}
if (!items.empty() && items.front() == "editor-switch-map") {
expand_open_maps_menu(items);
context_menu = true; //FIXME hack to display a one-item menu
}
command_executor::show_menu(items, xloc, yloc, context_menu, gui());
}

View file

@ -297,8 +297,8 @@ class editor_controller : public controller_base,
/** init the available time-of-day settings */
void init_tods(const config& game_config);
/** init background music for the editor */
void init_music(const config& game_config);
/** init background music for the editor */
void init_music(const config& game_config);
/** Load editor-specific tooltips */
void load_tooltips();

View file

@ -25,7 +25,7 @@ editor_display::editor_display(CVideo& video, const editor_map& map,
, brush_locations_()
, toolbar_hint_()
{
clear_screen();
clear_screen();
}
void editor_display::add_brush_loc(const map_location& hex)
@ -54,7 +54,7 @@ void editor_display::remove_brush_loc(const map_location& hex)
}
void editor_display::rebuild_terrain(const map_location &loc) {
builder_->rebuild_terrain(loc);
builder_->rebuild_terrain(loc);
}
void editor_display::pre_draw()
@ -64,13 +64,13 @@ void editor_display::pre_draw()
image::TYPE editor_display::get_image_type(const map_location& loc)
{
if (brush_locations_.find(loc) != brush_locations_.end()) {
return image::BRIGHTENED;
} else if (highlighted_locations_.find(loc) != highlighted_locations_.end()) {
return image::SEMI_BRIGHTENED;
} else if (map().in_selection(loc)) {
return image::BRIGHTENED;
} else if (highlighted_locations_.find(loc) != highlighted_locations_.end()) {
return image::SEMI_BRIGHTENED;
} else if (map().in_selection(loc)) {
return image::SEMI_BRIGHTENED;
}
return image::SCALED_TO_HEX;
return image::SCALED_TO_HEX;
}
void editor_display::draw_hex(const map_location& loc)
@ -89,7 +89,7 @@ void editor_display::draw_hex(const map_location& loc)
const SDL_Rect& editor_display::get_clip_rect()
{
return map_outside_area();
return map_outside_area();
}
void editor_display::draw_sidebar()

View file

@ -35,7 +35,7 @@ static bool is_invalid_terrain(t_translation::t_terrain c) {
terrain_group::terrain_group(const config& cfg, display& gui):
id(cfg["id"]), name(cfg["name"]),
button(gui.video(), "", gui::button::TYPE_CHECK, cfg["icon"]),
core(utils::string_bool(cfg["core"], false))
core(utils::string_bool(cfg["core"], false))
{
}
@ -66,7 +66,7 @@ terrain_palette::terrain_palette(display &gui, const size_specs &sizes,
terrains_ = map().get_terrain_list();
//move "invalid" terrains to the end
size_t size = terrains_.size();
size_t size = terrains_.size();
for (size_t i = 0; i < size; ++i) {
if (is_invalid_terrain(terrains_[i])) {
terrains_.push_back(terrains_[i]);
@ -77,7 +77,7 @@ terrain_palette::terrain_palette(display &gui, const size_specs &sizes,
}
// Get the available groups and add them to the structure
const config::child_list& groups = cfg.get_children("editor_group");
const config::child_list& groups = cfg.get_children("editor_group");
config::child_list::const_iterator g_itor = groups.begin();
std::set<std::string> group_names;
for(; g_itor != groups.end(); ++ g_itor) {
@ -91,42 +91,42 @@ terrain_palette::terrain_palette(display &gui, const size_specs &sizes,
}
}
}
std::map<std::string, terrain_group*> id_to_group;
foreach (terrain_group& tg, terrain_groups_) {
id_to_group.insert(std::make_pair(tg.id, &tg));
}
std::map<std::string, terrain_group*> id_to_group;
foreach (terrain_group& tg, terrain_groups_) {
id_to_group.insert(std::make_pair(tg.id, &tg));
}
// The rest of the code assumes this is a valid pointer
assert(checked_group_btn_ != 0);
// add the groups for all terrains to the map
foreach (const t_translation::t_terrain& t, terrains_) {
const terrain_type& t_info = map().get_terrain_info(t);
const terrain_type& t_info = map().get_terrain_info(t);
// don't display terrains that were automatically created from base+overlay
// don't display terrains that were automatically created from base+overlay
if (t_info.is_combined()) continue;
// nor display terrains that have hide_in_editor=true
if (t_info.hide_in_editor()) continue;
// add the terrain to the requested groups
const std::vector<std::string>& keys = utils::split(t_info.editor_group());
bool core = true;
bool core = true;
foreach (const std::string& k, keys) {
terrain_map_[k].push_back(t);
std::map<std::string, terrain_group*>::iterator i = id_to_group.find(k);
if (i != id_to_group.end()) {
if (!i->second->core) {
core = false;
}
}
std::map<std::string, terrain_group*>::iterator i = id_to_group.find(k);
if (i != id_to_group.end()) {
if (!i->second->core) {
core = false;
}
}
}
// A terrain is considered core iff it does not appear in any
// non-core terrain group
if (core) {
// Add the terrain to the default group
terrain_map_["all"].push_back(t);
} else {
non_core_terrains_.insert(t);
}
// A terrain is considered core iff it does not appear in any
// non-core terrain group
if (core) {
// Add the terrain to the default group
terrain_map_["all"].push_back(t);
} else {
non_core_terrains_.insert(t);
}
}
typedef std::pair<std::string, t_translation::t_list> map_pair;
@ -319,7 +319,7 @@ std::string terrain_palette::get_terrain_string(const t_translation::t_terrain t
void terrain_palette::left_mouse_click(const int mousex, const int mousey) {
int tselect = tile_selected(mousex, mousey);
if(tselect >= 0 && (tstart_+tselect) < terrains_.size()) {
if(tselect >= 0 && (tstart_+tselect) < terrains_.size()) {
select_fg_terrain(terrains_[tstart_+tselect]);
gui_.invalidate_game_status();
}
@ -422,7 +422,7 @@ void terrain_palette::draw(bool force) {
palrect.y = terrain_start_;
palrect.w = size_specs_.palette_w;
palrect.h = size_specs_.palette_h;
tooltips::clear_tooltips(palrect);
tooltips::clear_tooltips(palrect);
for(unsigned int counter = starting; counter < ending; counter++){
const t_translation::t_terrain terrain = terrains_[counter];
const t_translation::t_terrain base_terrain = map().get_terrain_info(terrain).default_base();
@ -486,16 +486,16 @@ void terrain_palette::draw(bool force) {
}
draw_rectangle(dstrect.x, dstrect.y, image->w, image->h, color, screen);
std::stringstream tooltip_text;
if (non_core_terrains_.find(terrain) == non_core_terrains_.end()) {
//no special for now
} else {
tooltip_text << "#";
}
tooltip_text << map().get_terrain_string(terrain);
if (gui_.get_draw_terrain_codes()) {
tooltip_text << " - " << terrain;
}
std::stringstream tooltip_text;
if (non_core_terrains_.find(terrain) == non_core_terrains_.end()) {
//no special for now
} else {
tooltip_text << "#";
}
tooltip_text << map().get_terrain_string(terrain);
if (gui_.get_draw_terrain_codes()) {
tooltip_text << " - " << terrain;
}
tooltips::add_tooltip(dstrect, tooltip_text.str());
if (counter_from_zero % size_specs_.terrain_width == size_specs_.terrain_width - 1)
y += size_specs_.terrain_space;
@ -648,8 +648,8 @@ int brush_bar::selected_index(int x, int y) const {
const int bar_y = size_specs_.brush_y;
if ((x < bar_x || static_cast<size_t>(x) > bar_x + size_ * brushes_.size() +
brushes_.size() * size_specs_.brush_padding) ||
(y < bar_y || static_cast<size_t>(y) > bar_y + size_)) {
brushes_.size() * size_specs_.brush_padding) ||
(y < bar_y || static_cast<size_t>(y) > bar_y + size_)) {
return -1;
}

View file

@ -66,9 +66,9 @@ map_context::~map_context()
void map_context::draw_terrain(t_translation::t_terrain terrain,
const map_location& loc, bool one_layer_only)
{
if (!one_layer_only) {
terrain = map_.get_terrain_info(terrain).terrain_with_default_base();
}
if (!one_layer_only) {
terrain = map_.get_terrain_info(terrain).terrain_with_default_base();
}
draw_terrain_actual(terrain, loc, one_layer_only);
}
@ -97,9 +97,9 @@ void map_context::draw_terrain_actual(t_translation::t_terrain terrain,
void map_context::draw_terrain(t_translation::t_terrain terrain,
const std::set<map_location>& locs, bool one_layer_only)
{
if (!one_layer_only) {
terrain = map_.get_terrain_info(terrain).terrain_with_default_base();
}
if (!one_layer_only) {
terrain = map_.get_terrain_info(terrain).terrain_with_default_base();
}
foreach (const map_location& loc, locs) {
draw_terrain_actual(terrain, loc, one_layer_only);
}