Put the new custom tod dialog into use.

This commit is contained in:
fendrin 2013-05-29 12:18:47 +02:00
parent 73d9465783
commit 16dd13cab4
6 changed files with 26 additions and 11 deletions

View file

@ -65,7 +65,7 @@
#image=button_menu/menu_button_small_copper_H18
#image=lite
font_size=9
items=statustable,unitlist,editor-map-new,editor-map-load,editor-map-revert,editor-map-save,editor-map-save-as,editor-map-save-all,preferences,editor-settings,help,editor-close-map,quit-editor,editor-quit-to-desktop
items=statustable,unitlist,editor-map-new,editor-map-load,editor-map-revert,editor-map-save,editor-map-save-as,editor-map-save-all,preferences,help,editor-close-map,quit-editor,editor-quit-to-desktop
ref=top-panel
rect="=+1,=+1,+100,+20"
#rect="=+3,=+1,+55,=-4"
@ -483,7 +483,7 @@
[/panel]
[menu]
id=switch_time
items=editor-switch-time, menu-editor-schedule
items=editor-switch-time, menu-editor-schedule, editor-custom-tods
image=button_square/button_square_30
overlay=icons/action/editor-switch-time_30
tooltip= _ "Time Schedule Menu"

View file

@ -346,6 +346,7 @@ wesnoth_sources = Split("""
gui/dialogs/dialog.cpp
gui/dialogs/edit_label.cpp
gui/dialogs/editor/editor_edit_label.cpp
gui/dialogs/editor/custom_tod.cpp
gui/dialogs/editor_generate_map.cpp
gui/dialogs/editor_new_map.cpp
gui/dialogs/editor_resize_map.cpp

View file

@ -29,7 +29,7 @@
#include "editor_preferences.hpp"
#include "gui/dialogs/edit_text.hpp"
#include "gui/dialogs/editor_settings.hpp"
#include "gui/dialogs/editor/custom_tod.hpp"
#include "gui/dialogs/message.hpp"
#include "gui/dialogs/transient_message.hpp"
#include "gui/widgets/window.hpp"
@ -214,7 +214,7 @@ void editor_controller::quit_confirm(EXIT_STATUS mode)
}
}
void editor_controller::editor_settings_dialog()
void editor_controller::custom_tods_dialog()
{
if (tods_.empty()) {
gui2::show_error_message(gui().video(),
@ -223,9 +223,23 @@ void editor_controller::editor_settings_dialog()
}
image::color_adjustment_resetter adjust_resetter;
if(!gui2::teditor_settings::execute(&(gui()), tods_["test"].second, gui().video())) {
std::vector<time_of_day> schedule = context_manager_->get_map_context().get_time_manager()->times();
if(!gui2::tcustom_tod::execute(&(gui()), schedule, gui().video())) {
adjust_resetter.reset();
} else {
// TODO save the new tod here
}
context_manager_->refresh_all();
}
void editor_controller::editor_settings_dialog_redraw_callback(int r, int g, int b)
{
SCOPE_ED;
image::set_color_adjustment(r, g, b);
gui().redraw_everything();
}
bool editor_controller::can_execute_command(hotkey::HOTKEY_COMMAND command, int index) const
@ -307,7 +321,7 @@ bool editor_controller::can_execute_command(hotkey::HOTKEY_COMMAND command, int
return context_manager_->get_map_context().can_undo();
case TITLE_SCREEN__RELOAD_WML:
case HOTKEY_EDITOR_QUIT_TO_DESKTOP:
case HOTKEY_EDITOR_SETTINGS:
case HOTKEY_EDITOR_CUSTOM_TODS:
case HOTKEY_EDITOR_MAP_NEW:
case HOTKEY_EDITOR_SIDE_NEW:
case HOTKEY_EDITOR_SIDE_SWITCH:
@ -627,8 +641,8 @@ bool editor_controller::execute_command(hotkey::HOTKEY_COMMAND command, int inde
do_quit_ = true;
quit_mode_ = EXIT_RELOAD_DATA;
return true;
case HOTKEY_EDITOR_SETTINGS:
editor_settings_dialog();
case HOTKEY_EDITOR_CUSTOM_TODS:
custom_tods_dialog();
return true;
case HOTKEY_EDITOR_PALETTE_ITEM_SWAP:
toolkit_->get_palette_manager()->active_palette().swap();

View file

@ -101,7 +101,7 @@ class editor_controller : public controller_base,
void quit_confirm(EXIT_STATUS status);
/** Display the settings dialog, used to control e.g. the lighting settings */
void editor_settings_dialog();
void custom_tods_dialog();
/** Save the map, open dialog if not named yet. */
void save_map() {context_manager_->save_map();};

View file

@ -146,7 +146,7 @@ const hotkey_command hotkey_list_[] = {
{ hotkey::HOTKEY_EDITOR_SWITCH_MAP, "editor-switch-map", N_("Switch Map"), false, hotkey::SCOPE_EDITOR, NULL },
{ hotkey::HOTKEY_EDITOR_SWITCH_AREA, "editor-switch-area", N_("Switch Area"), false, hotkey::SCOPE_EDITOR, NULL },
{ hotkey::HOTKEY_EDITOR_SETTINGS, "editor-settings", N_("Editor Settings"), false, hotkey::SCOPE_EDITOR, NULL },
{ hotkey::HOTKEY_EDITOR_CUSTOM_TODS, "editor-custom-tods", N_("Custom Time of Day Creator"), false, hotkey::SCOPE_EDITOR, NULL },
{ hotkey::HOTKEY_EDITOR_PARTIAL_UNDO, "editor-partial-undo", N_("Partial Undo"), false, hotkey::SCOPE_EDITOR, NULL },
{ hotkey::HOTKEY_EDITOR_MAP_NEW, "editor-map-new", N_("New Map"), false, hotkey::SCOPE_EDITOR, NULL },
{ hotkey::HOTKEY_EDITOR_MAP_LOAD, "editor-map-load", N_("Load Map"), false, hotkey::SCOPE_EDITOR, NULL },

View file

@ -86,7 +86,7 @@ enum HOTKEY_COMMAND {
HOTKEY_EDITOR_QUIT_TO_DESKTOP,
HOTKEY_EDITOR_CLOSE_MAP,
HOTKEY_EDITOR_SWITCH_MAP, HOTKEY_EDITOR_SWITCH_AREA,
HOTKEY_EDITOR_SETTINGS,
HOTKEY_EDITOR_CUSTOM_TODS,
HOTKEY_EDITOR_PARTIAL_UNDO,
HOTKEY_EDITOR_MAP_NEW, HOTKEY_EDITOR_MAP_LOAD, HOTKEY_EDITOR_MAP_SAVE,
HOTKEY_EDITOR_MAP_SAVE_AS, HOTKEY_EDITOR_MAP_SAVE_ALL,