mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
Dark mode
This commit is contained in:
@@ -43,6 +43,10 @@ SCRIPT_FUNCTION(get_mse_locale) {
|
||||
SCRIPT_RETURN(settings.locale);
|
||||
}
|
||||
|
||||
SCRIPT_FUNCTION(get_mse_dark_mode) {
|
||||
SCRIPT_RETURN(settings.darkMode());
|
||||
}
|
||||
|
||||
SCRIPT_FUNCTION(trace) {
|
||||
SCRIPT_PARAM_C(String, input);
|
||||
#if defined(_DEBUG) && 0
|
||||
@@ -866,10 +870,12 @@ SCRIPT_FUNCTION(rule) {
|
||||
// ----------------------------------------------------------------------------- : Init
|
||||
|
||||
void init_script_basic_functions(Context& ctx) {
|
||||
// debugging
|
||||
// app info
|
||||
ctx.setVariable(_("get_mse_version"), script_get_mse_version);
|
||||
ctx.setVariable(_("get_mse_locale"), script_get_mse_locale);
|
||||
ctx.setVariable(_("get_mse_path"), script_get_mse_path);
|
||||
ctx.setVariable(_("get_mse_dark_mode"), script_get_mse_dark_mode);
|
||||
// debugging
|
||||
ctx.setVariable(_("trace"), script_trace);
|
||||
ctx.setVariable(_("warning"), script_warning);
|
||||
ctx.setVariable(_("error"), script_error);
|
||||
|
||||
@@ -193,6 +193,17 @@ void TokenIterator::readToken() {
|
||||
addToken(TOK_STRING, include_file, pos);
|
||||
addToken(TOK_RPAREN, ")", eol);
|
||||
pos = eol;
|
||||
} else if (is_substr(pos, end, "include dark file:")) {
|
||||
pos += 18; // "include dark file:"
|
||||
const char* newlines = "\r\n";
|
||||
auto eol = find_first_of(pos, end, newlines, newlines + 2);
|
||||
String include_file = trim(StringView(pos, eol)) + (settings.darkMode() ? _("_dark") : _(""));
|
||||
// include_file("filename_dark")
|
||||
addToken(TOK_NAME, "include_file", pos - 18);
|
||||
addToken(TOK_LPAREN, "(", pos);
|
||||
addToken(TOK_STRING, include_file, pos);
|
||||
addToken(TOK_RPAREN, ")", eol);
|
||||
pos = eol;
|
||||
} else if (is_substr(pos, end, "include file:")) {
|
||||
pos += 13; // "include file:"
|
||||
const char* newlines = "\r\n";
|
||||
|
||||
Reference in New Issue
Block a user