editor2: toolbar tooltips: buttons and terrain palette groups.

Old editor's toolbar glitch appears to be fixed though I'm not sure
what was the cause.
This commit is contained in:
Tomasz Śniatowski 2008-08-12 12:39:34 +01:00
parent 37422d6a65
commit 24784c4788
3 changed files with 24 additions and 4 deletions

View file

@ -175,6 +175,7 @@
id=draw_button_editor
image=draw_button_editor
items=editor-tool-paint
auto_tooltip=yes
ref=top-right-panel
#harcoded since the brushes are above, which are hardcoded in src/editor/editor_layout.cpp
rect="=+15,200,+24,+24"
@ -185,6 +186,7 @@
id=flood_button_editor
image=flood_button_editor
items=editor-tool-fill
auto_tooltip=yes
rect="+6,=,+24,+24"
xanchor=right
yanchor=fixed
@ -193,6 +195,7 @@
id=start_position_button_editor
image=start_position_button_editor
items=editor-tool-starting-position
auto_tooltip=yes
rect="+6,=,+24,+24"
xanchor=right
yanchor=fixed
@ -201,6 +204,7 @@
id=select_button_editor
image=resize_button_editor
items=editor-tool-select
auto_tooltip=yes
rect="+6,=,+24,+24"
xanchor=right
yachnor=fixed
@ -209,6 +213,7 @@
id=undo_button_editor
image=undo_button_editor
items=undo
auto_tooltip=yes
ref=draw_button_editor
rect="=,+6,+24,+24"
xanchor=right
@ -218,6 +223,7 @@
id=redo_button_editor
image=redo_button_editor
items=redo
auto_tooltip=yes
rect="+6,=,+24,+24"
xanchor=right
yachnor=fixed
@ -226,6 +232,7 @@
id=zoom_in_button_editor
image=zoom_in_button_editor
items=zoomin
auto_tooltip=yes
rect="+6,=,+24,+24"
xanchor=right
yachnor=fixed
@ -234,6 +241,7 @@
id=zoom_out_button_editor
image=zoom_out_button_editor
items=zoomout
auto_tooltip=yes
rect="+6,=,+24,+24"
xanchor=right
yanchor=fixed

View file

@ -51,7 +51,8 @@ editor_controller::editor_controller(const config &game_config, CVideo& video)
: controller_base(SDL_GetTicks(), game_config, video)
, mouse_handler_base(get_map())
, map_context_(editor_map(game_config, 44, 33, t_translation::GRASS_LAND))
, gui_(NULL), map_generator_(NULL), do_quit_(false), quit_mode_(EXIT_ERROR)
, gui_(NULL), map_generator_(NULL), tooltip_manager_(video), floating_label_manager_(NULL)
, do_quit_(false), quit_mode_(EXIT_ERROR)
, toolbar_dirty_(true), auto_update_transitions_(true)
{
init(video);
@ -61,7 +62,6 @@ editor_controller::editor_controller(const config &game_config, CVideo& video)
palette_ = new terrain_palette(gui(), *size_specs_, get_map(), game_config,
foreground_terrain_, background_terrain_);
//brush_bar_ = new brush_bar(gui(), *size_specs_);
const config::child_list& children = game_config.get_children("brush");
foreach (const config* i, game_config.get_children("brush")) {
brushes_.push_back(brush(*i));
@ -102,6 +102,7 @@ editor_controller::editor_controller(const config &game_config, CVideo& video)
refresh_all();
gui_->draw();
palette_->draw(true);
load_tooltips();
events::raise_draw_event();
}
@ -116,6 +117,12 @@ void editor_controller::init(CVideo& video)
gui_->add_redraw_observer(boost::bind(&editor_controller::display_redraw_callback, this, _1));
}
void editor_controller::load_tooltips()
{
// Tooltips for the groups
palette_->load_tooltips();
}
editor_controller::~editor_controller()
{
delete palette_;
@ -794,6 +801,8 @@ void editor_controller::display_redraw_callback(display&)
adjust_sizes(gui(), *size_specs_);
palette_->adjust_size();
palette_->draw(true);
//display::redraw_everything removes our custom tooltips so reload them
load_tooltips();
gui().invalidate_all();
}

View file

@ -28,6 +28,7 @@
#include "../key.hpp"
#include "../mouse_handler_base.hpp"
#include "../sdl_utils.hpp"
#include "../tooltips.hpp"
#include <deque>
#include <boost/utility.hpp>
@ -116,6 +117,8 @@ class editor_controller : public controller_base,
/** init the display object and general set-up */
void init(CVideo& video);
void load_tooltips();
void redraw_toolbar();
void refresh_image_cache();
@ -149,8 +152,8 @@ class editor_controller : public controller_base,
brush_bar* brush_bar_;
preferences::display_manager* prefs_disp_manager_;
tooltips::manager* tooltip_manager_;
font::floating_label_context* floating_label_manager_;
tooltips::manager tooltip_manager_;
font::floating_label_context* floating_label_manager_;
bool do_quit_;
EXIT_STATUS quit_mode_;