CVideo: removed "help string" interface

These will be handled by GUI2 tooltips once we get the editor all converted to
the new UI system.
This commit is contained in:
Charles Dang 2018-04-14 17:54:26 +11:00
parent 7aeca70cb0
commit 66dc67140f
8 changed files with 0 additions and 94 deletions

View file

@ -1099,7 +1099,6 @@ void editor_controller::show_menu(const std::vector<config>& items_arg, int xloc
void editor_controller::preferences()
{
gui_->video().clear_all_help_strings();
gui2::dialogs::preferences_dialog::display(game_config_);
}

View file

@ -179,8 +179,6 @@ void editor_palette<Item>::adjust_size(const SDL_Rect& target)
}
set_location(target);
set_dirty(true);
gui_.video().clear_help_string(help_handle_);
help_handle_ = gui_.video().set_help_string(get_help_string());
}
template<class Item>
@ -190,8 +188,6 @@ void editor_palette<Item>::select_fg_item(const std::string& item_id)
selected_fg_item_ = item_id;
set_dirty();
}
gui_.video().clear_help_string(help_handle_);
help_handle_ = gui_.video().set_help_string(get_help_string());
}
template<class Item>
@ -201,8 +197,6 @@ void editor_palette<Item>::select_bg_item(const std::string& item_id)
selected_bg_item_ = item_id;
set_dirty();
}
gui_.video().clear_help_string(help_handle_);
help_handle_ = gui_.video().set_help_string(get_help_string());
}
template<class Item>

View file

@ -49,7 +49,6 @@ public:
, selected_bg_item_()
, toolkit_(toolkit)
, buttons_()
, help_handle_(-1)
{
}
@ -125,9 +124,6 @@ private:
void hide(bool hidden) override {
widget::hide(hidden);
if (!hidden)
help_handle_ = gui_.video().set_help_string(get_help_string());
else gui_.video().clear_help_string(help_handle_);
for (gui::widget& w : buttons_) {
w.hide(hidden);
}
@ -180,8 +176,6 @@ private:
editor_toolkit& toolkit_;
std::vector<gui::tristate_button> buttons_;
int help_handle_;
};

View file

@ -143,7 +143,6 @@ location_palette::location_palette(editor_display &gui, const config& /*cfg*/,
//, button_add_()
//, button_delete_()
//, button_goto_()
, help_handle_(-1)
, disp_(gui)
{
for (int i = 1; i < 10; ++i) {
@ -170,8 +169,6 @@ void location_palette::hide(bool hidden)
{
widget::hide(hidden);
disp_.video().clear_help_string(help_handle_);
#if 0
std::shared_ptr<gui::button> palette_menu_button = disp_.find_menu_button("menu-editor-terrain");
palette_menu_button->set_overlay("");
@ -259,8 +256,6 @@ void location_palette::adjust_size(const SDL_Rect& target)
set_location(target);
set_dirty(true);
disp_.video().clear_help_string(help_handle_);
help_handle_ = disp_.video().set_help_string(get_help_string());
}
void location_palette::select_item(const std::string& item_id)
@ -269,8 +264,6 @@ void location_palette::select_item(const std::string& item_id)
selected_item_ = item_id;
set_dirty();
}
disp_.video().clear_help_string(help_handle_);
help_handle_ = disp_.video().set_help_string(get_help_string());
}
int location_palette::num_items()

View file

@ -120,7 +120,6 @@ private:
std::unique_ptr<location_palette_button> button_delete_;
std::unique_ptr<location_palette_button> button_goto_;
#endif
int help_handle_;
editor_display& disp_;
};

View file

@ -14,9 +14,6 @@
#include "video.hpp"
#include "display.hpp"
#include "floating_label.hpp"
#include "font/constants.hpp"
#include "log.hpp"
#include "ogl/utils.hpp"
#include "preferences/general.hpp"
@ -421,53 +418,6 @@ bool CVideo::is_fullscreen() const
return (window->get_flags() & SDL_WINDOW_FULLSCREEN_DESKTOP) != 0;
}
int CVideo::set_help_string(const std::string& str)
{
font::remove_floating_label(help_string_);
const color_t color{0, 0, 0, 0xbb};
int size = font::SIZE_LARGE;
#if 0
while(size > 0) {
if(font::line_width(str, size) > get_width()) {
size--;
} else {
break;
}
}
#endif
const int border = 5;
font::floating_label flabel(str);
flabel.set_font_size(size);
flabel.set_position(get_width() / 2, get_height());
flabel.set_bg_color(color);
flabel.set_border_size(border);
help_string_ = font::add_floating_label(flabel);
const SDL_Rect& rect = font::get_floating_label_rect(help_string_);
font::move_floating_label(help_string_, 0.0, -double(rect.h));
return help_string_;
}
void CVideo::clear_help_string(int handle)
{
if(handle == help_string_) {
font::remove_floating_label(handle);
help_string_ = 0;
}
}
void CVideo::clear_all_help_strings()
{
clear_help_string(help_string_);
}
void CVideo::set_fullscreen(bool ison)
{
if(window && is_fullscreen() != ison) {

View file

@ -185,24 +185,6 @@ public:
void lock_flips(bool);
/***** ***** ***** ***** Help string functions ***** ***** ****** *****/
/**
* Displays a help string with the given text. A 'help string' is like a tooltip,
* but appears at the bottom of the screen so as to not be intrusive.
*
* @param str The text to display.
*
* @returns The handle id of the new help string.
*/
int set_help_string(const std::string& str);
/** Removes the help string with the given handle. */
void clear_help_string(int handle);
/** Removes all help strings. */
void clear_all_help_strings();
/***** ***** ***** ***** General utils ***** ***** ****** *****/
/** Waits a given number of milliseconds before returning. */
@ -266,9 +248,6 @@ private:
video_event_handler event_handler_;
/** Curent ID of the help string. */
int help_string_;
int updated_locked_;
int flip_locked_;
};

View file

@ -298,10 +298,8 @@ void widget::process_help_string(int mousex, int mousey)
if (!hidden() && sdl::point_in_rect(mousex, mousey, rect_)) {
if(help_string_ == 0 && !help_text_.empty()) {
//std::cerr << "setting help string to '" << help_text_ << "'\n";
help_string_ = video().set_help_string(help_text_);
}
} else if(help_string_ > 0) {
video().clear_help_string(help_string_);
help_string_ = 0;
}
}