1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-28 17:24:47 +01:00

Renamed Colour Schemes to Themes

Themes window now opens to settings/presets tab so it's less confusing
for others.
Can no longer change default presets, you get a warning when you try.
now stores themes in themes folder.
Now clips theme names.
This commit is contained in:
Robert Jordan
2015-06-01 11:02:09 -04:00
parent 0a5236be1c
commit 765bf976ee
60 changed files with 988 additions and 991 deletions

View File

@@ -780,8 +780,8 @@ static int cc_open(const char **argv, int argc) {
window_editor_inventions_list_open();
} else if (strcmp(argv[0], "options") == 0) {
window_options_open();
} else if (strcmp(argv[0], "colour_schemes") == 0) {
window_colour_schemes_open();
} else if (strcmp(argv[0], "themes") == 0) {
window_themes_open();
}
else {
console_writeline_error("Invalid window.");
@@ -831,7 +831,7 @@ char* console_window_table[] = {
"object_selection",
"inventions_list",
"options",
"colour_schemes"
"themes"
};
console_command console_command_table[] = {

View File

@@ -21,7 +21,7 @@
#include "../config.h"
#include "../localisation/string_ids.h"
#include "window.h"
#include "colour_schemes.h"
#include "themes.h"
window_colour_scheme gColourSchemes[] = {
{ WC_TOP_TOOLBAR, { 7, 12, 24, 1, 0, 0 }, 4, 5245, "top_toolbar" },
@@ -70,7 +70,7 @@ window_colour_scheme gColourSchemes[] = {
{ WC_LOADSAVE_OVERWRITE_PROMPT, { 154, 0, 0, 0, 0, 0 }, 1, 5227, "loadsave_overwrite_prompt" },
{ WC_TITLE_OPTIONS, { 140, 140, 140, 0, 0, 0 }, 3, 5251, "title_options" },
{ WC_LAND_RIGHTS, { 19, 19, 19, 0, 0, 0 }, 3, 5196, "land_rights" },
{ WC_COLOUR_SCHEMES, { 1, 12, 12, 0, 0, 0 }, 3, 5218, "colour_schemes" },
{ WC_THEMES, { 1, 12, 12, 0, 0, 0 }, 3, 5218, "themes" },
{ WC_STAFF, { 1, 4, 4, 0, 0, 0 }, 3, 5207, "staff" },
{ WC_EDITOR_TRACK_BOTTOM_TOOLBAR, { 135, 135, 135, 0, 0, 0 }, 3, 5247, "editor_track_bottom_toolbar" },
{ WC_EDITOR_SCENARIO_BOTTOM_TOOLBAR, { 150, 150, 141, 0, 0, 0 }, 3, 5248, "editor_scenario_bottom_toolbar" },
@@ -97,7 +97,7 @@ marked_window_colours gColourSchemesRCT1[sizeof(gColourSchemes)] = {
{ 0xFF, { 0, 0, 0, 0, 0, 0 } } // End
};
uint16 gCurrentColourSchemePreset = 0;
uint16 gCurrentTheme = 0;
uint32 gNumColourSchemeWindows = sizeof(gColourSchemes) / sizeof(window_colour_scheme);
window_colour_scheme* colour_scheme_get_by_class(rct_windowclass classification)
@@ -155,78 +155,78 @@ void colour_scheme_update_by_class(rct_window *window, rct_windowclass classific
// window->flags &= ~WF_TRANSPARENT;
}
void colour_scheme_change_preset(int preset)
void theme_change_preset(int preset)
{
if (preset >= 0 && preset < gConfigColourSchemes.num_presets) {
if (preset >= 0 && preset < gConfigThemes.num_presets) {
switch (preset) {
case 0:
gConfigInterface.current_colour_scheme_preset = "*RCT2";
gConfigInterface.current_theme_preset = "*RCT2";
break;
case 1:
gConfigInterface.current_colour_scheme_preset = "*RCT1";
gConfigInterface.current_theme_preset = "*RCT1";
break;
default:
gConfigInterface.current_colour_scheme_preset = gConfigColourSchemes.presets[preset].name;
gConfigInterface.current_theme_preset = gConfigThemes.presets[preset].name;
break;
}
gCurrentColourSchemePreset = preset;
gCurrentTheme = preset;
for (int i = 0; i < (int)gNumColourSchemeWindows; i++) {
for (int j = 0; j < gColourSchemes[i].num_colours; j++) {
gColourSchemes[i].colours[j] = gConfigColourSchemes.presets[preset].colour_schemes[i].colours[j];
gColourSchemes[i].colours[j] = gConfigThemes.presets[preset].colour_schemes[i].colours[j];
}
}
}
window_invalidate_all();
}
void colour_scheme_create_preset(const char *name)
void theme_create_preset(const char *name)
{
int preset = gConfigColourSchemes.num_presets;
gConfigColourSchemes.num_presets++;
gConfigColourSchemes.presets = realloc(gConfigColourSchemes.presets, sizeof(colour_scheme_preset) * gConfigColourSchemes.num_presets);
strcpy(gConfigColourSchemes.presets[preset].name, name);
gConfigColourSchemes.presets[preset].colour_schemes = malloc(sizeof(window_colours) * gNumColourSchemeWindows);
int preset = gConfigThemes.num_presets;
gConfigThemes.num_presets++;
gConfigThemes.presets = realloc(gConfigThemes.presets, sizeof(theme_preset) * gConfigThemes.num_presets);
strcpy(gConfigThemes.presets[preset].name, name);
gConfigThemes.presets[preset].colour_schemes = malloc(sizeof(window_colours) * gNumColourSchemeWindows);
for (int i = 0; i < (int)gNumColourSchemeWindows; i++) {
for (int j = 0; j < 6; j++)
gConfigColourSchemes.presets[preset].colour_schemes[i].colours[j] = gColourSchemes[i].colours[j];
gConfigThemes.presets[preset].colour_schemes[i].colours[j] = gColourSchemes[i].colours[j];
}
colour_schemes_save_preset(preset);
colour_scheme_change_preset(preset);
themes_save_preset(preset);
theme_change_preset(preset);
}
void colour_scheme_delete_preset(int preset)
void theme_delete_preset(int preset)
{
if (preset >= 2) {
utf8 path[MAX_PATH];
platform_get_user_directory(path, "colour schemes");
strcat(path, gConfigColourSchemes.presets[preset].name);
platform_get_user_directory(path, "themes");
strcat(path, gConfigThemes.presets[preset].name);
strcat(path, ".ini");
platform_file_delete(path);
for (int i = preset; i < gConfigColourSchemes.num_presets - 1; i++) {
gConfigColourSchemes.presets[i] = gConfigColourSchemes.presets[i + 1];
for (int i = preset; i < gConfigThemes.num_presets - 1; i++) {
gConfigThemes.presets[i] = gConfigThemes.presets[i + 1];
}
gConfigColourSchemes.num_presets--;
colour_scheme_change_preset(0);
gConfigThemes.num_presets--;
theme_change_preset(0);
}
}
void colour_scheme_rename_preset(int preset, const char *newName)
void theme_rename_preset(int preset, const char *newName)
{
if (preset >= 2) {
utf8 src[MAX_PATH], dest[MAX_PATH];
platform_get_user_directory(src, "colour schemes");
platform_get_user_directory(dest, "colour schemes");
strcat(src, gConfigColourSchemes.presets[preset].name);
platform_get_user_directory(src, "themes");
platform_get_user_directory(dest, "themes");
strcat(src, gConfigThemes.presets[preset].name);
strcat(dest, newName);
strcat(src, ".ini");
strcat(dest, ".ini");
platform_file_move(src, dest);
strcpy(gConfigColourSchemes.presets[gCurrentColourSchemePreset].name, newName);
strcpy(gConfigThemes.presets[gCurrentTheme].name, newName);
if (preset == gCurrentColourSchemePreset) {
gConfigInterface.current_colour_scheme_preset = gConfigColourSchemes.presets[gCurrentColourSchemePreset].name;
if (preset == gCurrentTheme) {
gConfigInterface.current_theme_preset = gConfigThemes.presets[gCurrentTheme].name;
}
}
}

View File

@@ -42,7 +42,7 @@ extern window_colour_scheme gColourSchemes[];
extern marked_window_colours gColourSchemesRCT1[];
extern uint16 gCurrentColourSchemePreset;
extern uint16 gCurrentTheme;
extern uint32 gNumColourSchemeWindows;
@@ -52,9 +52,9 @@ int colour_scheme_get_index_by_class(rct_windowclass classification);
void colour_scheme_update(rct_window *window);
void colour_scheme_update_by_class(rct_window *window, rct_windowclass classification);
void colour_scheme_change_preset(int preset);
void colour_scheme_create_preset(const char *name);
void colour_scheme_delete_preset(int preset);
void colour_scheme_rename_preset(int preset, const char *newName);
void theme_change_preset(int preset);
void theme_create_preset(const char *name);
void theme_delete_preset(int preset);
void theme_rename_preset(int preset, const char *newName);
#endif

View File

@@ -405,7 +405,7 @@ enum {
WC_LOADSAVE_OVERWRITE_PROMPT = 116,
WC_TITLE_OPTIONS = 117,
WC_LAND_RIGHTS = 118,
WC_COLOUR_SCHEMES = 119,
WC_THEMES = 119,
// Only used for colour schemes
WC_STAFF = 220,
@@ -566,7 +566,7 @@ void window_music_credits_open();
void window_publisher_credits_open();
void window_track_manage_open();
void window_viewport_open();
void window_colour_schemes_open();
void window_themes_open();
void window_text_input_open(rct_window* call_w, int call_widget, rct_string_id title, rct_string_id description, rct_string_id existing_text, uint32 existing_args, int maxLength);
void window_text_input_raw_open(rct_window* call_w, int call_widget, rct_string_id title, rct_string_id description, utf8string existing_text, int maxLength);
rct_window *window_mapgen_open();