Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #include "editor/editor_preferences.hpp"
00017 #include "game_preferences.hpp"
00018 #include "serialization/string_utils.hpp"
00019 #include "util.hpp"
00020
00021 namespace preferences {
00022
00023 namespace editor {
00024
00025 int auto_update_transitions() {
00026 return lexical_cast_default<int>(preferences::get("editor_auto_update_transitions"), TransitionUpdateMode::partial);
00027 }
00028
00029 void set_auto_update_transitions(int value) {
00030 preferences::set("editor_auto_update_transitions", lexical_cast<std::string>(value));
00031 }
00032
00033 bool use_mdi() {
00034 return preferences::get("editor_use_mdi", true);
00035 }
00036
00037 void set_use_mdi(bool value) {
00038 preferences::set("editor_use_mdi", value);
00039 }
00040
00041 std::string default_dir() {
00042 return preferences::get("editor_default_dir");
00043 }
00044
00045 bool draw_terrain_codes() {
00046 return preferences::get("editor_draw_terrain_codes", false);
00047 }
00048
00049 void set_draw_terrain_codes(bool value) {
00050 preferences::set("editor_draw_terrain_codes", value);
00051 }
00052
00053 bool draw_hex_coordinates() {
00054 return preferences::get("editor_draw_hex_coordinates", false);
00055 }
00056
00057 void set_draw_hex_coordinates(bool value) {
00058 preferences::set("editor_draw_hex_coordinates", value);
00059 }
00060
00061 namespace {
00062 void normalize_editor_rgb(int rval)
00063 {
00064 if (rval < -255) {
00065 rval = -255;
00066 }
00067 else if (rval > 255) {
00068 rval = 255;
00069 }
00070 }
00071 }
00072
00073 void set_tod_r(int value)
00074 {
00075 normalize_editor_rgb(value);
00076 preferences::set("editor_r",lexical_cast<std::string>(value));
00077 }
00078
00079 void set_tod_g(int value)
00080 {
00081 normalize_editor_rgb(value);
00082 preferences::set("editor_g",lexical_cast<std::string>(value));
00083 }
00084
00085 void set_tod_b(int value)
00086 {
00087 normalize_editor_rgb(value);
00088 preferences::set("editor_b",lexical_cast<std::string>(value));
00089 }
00090
00091 int tod_r()
00092 {
00093 return lexical_cast_in_range<int>(preferences::get("editor_r"), 0, -255, 255);
00094 }
00095
00096 int tod_g()
00097 {
00098 return lexical_cast_in_range<int>(preferences::get("editor_g"), 0, -255, 255);
00099 }
00100
00101 int tod_b()
00102 {
00103 return lexical_cast_in_range<int>(preferences::get("editor_b"), 0, -255, 255);
00104 }
00105
00106 }
00107
00108 }
00109