Exemplo n.º 1
0
static void custom_currency_window_text_input([[maybe_unused]] struct rct_window * w, rct_widgetindex widgetIndex, char * text)
{
    if (text == nullptr)
        return;
    sint32 rate;
    char* end;
    switch(widgetIndex){
    case WIDX_SYMBOL_TEXT:
        safe_strcpy(
            CurrencyDescriptors[CURRENCY_CUSTOM].symbol_unicode,
            text,
            CURRENCY_SYMBOL_MAX_SIZE
        );

        safe_strcpy(
            gConfigGeneral.custom_currency_symbol,
            CurrencyDescriptors[CURRENCY_CUSTOM].symbol_unicode,
            CURRENCY_SYMBOL_MAX_SIZE
        );

        config_save_default();
        window_invalidate_all();
        break;

    case WIDX_RATE:
        rate = strtol(text, &end, 10);
        if (*end == '\0') {
            CurrencyDescriptors[CURRENCY_CUSTOM].rate = rate;
            gConfigGeneral.custom_currency_rate = CurrencyDescriptors[CURRENCY_CUSTOM].rate;
            config_save_default();
            window_invalidate_all();
        }
        break;
    }
}
Exemplo n.º 2
0
static void window_themes_dropdown(rct_window *w, rct_widgetindex widgetIndex, sint32 dropdownIndex)
{
    switch (widgetIndex) {
    case WIDX_THEMES_LIST:
        if (dropdownIndex != -1) {
            rct_windowclass wc = get_window_class_tab_index(_colour_index_1);
            uint8 colour = theme_get_colour(wc, _colour_index_2);
            colour = (colour & COLOUR_FLAG_TRANSLUCENT) | dropdownIndex;
            theme_set_colour(wc, _colour_index_2, colour);
            colour_scheme_update_all();
            window_invalidate_all();
            _colour_index_1 = -1;
            _colour_index_2 = -1;

            // if (gCurrentTheme >= 2)
            //  themes_save_preset(gCurrentTheme);
        }
        break;
    case WIDX_THEMES_PRESETS_DROPDOWN:
        if (dropdownIndex != -1) {
            theme_manager_set_active_available_theme(dropdownIndex);
        }
        break;
    }

}
Exemplo n.º 3
0
void theme_change_preset(int preset)
{
	if (preset >= 0 && preset < gConfigThemes.num_presets) {
		switch (preset) {
		case 0:
			gConfigInterface.current_theme_preset = "*RCT2";
			break;
		case 1:
			gConfigInterface.current_theme_preset = "*RCT1";
			break;
		default:
			gConfigInterface.current_theme_preset = gConfigThemes.presets[preset].name;
			break;
		}
		gCurrentTheme = preset;
	}
	window_invalidate_all();
}
Exemplo n.º 4
0
void window_themes_scrollmousedown(rct_window *w, sint32 scrollIndex, sint32 x, sint32 y)
{
    if (y / _row_height < get_colour_scheme_tab_count()) {
        sint32 y2 = y % _row_height;
        _colour_index_1 = y / _row_height;
        _colour_index_2 = ((x - _button_offset_x) / 12);

        rct_windowclass wc = get_window_class_tab_index(_colour_index_1);
        sint32 numColours = theme_desc_get_num_colours(wc);
        if (_colour_index_2 < numColours) {
            if (x >= _button_offset_x && x < _button_offset_x + 12 * 6 && y2 >= _button_offset_y && y2 < _button_offset_y + 11) {
                if (theme_get_flags() & UITHEME_FLAG_PREDEFINED) {
                    window_error_open(STR_THEMES_ERR_CANT_CHANGE_THIS_THEME, STR_THEMES_DESC_CANT_CHANGE_THIS_THEME);
                } else {
                    window_themes_widgets[WIDX_THEMES_COLOURBTN_MASK].type = WWT_COLOURBTN;
                    window_themes_widgets[WIDX_THEMES_COLOURBTN_MASK].left = _button_offset_x + _colour_index_2 * 12 + window_themes_widgets[WIDX_THEMES_LIST].left;
                    window_themes_widgets[WIDX_THEMES_COLOURBTN_MASK].top = _colour_index_1 * _row_height + _button_offset_y - w->scrolls[0].v_top + window_themes_widgets[WIDX_THEMES_LIST].top;
                    window_themes_widgets[WIDX_THEMES_COLOURBTN_MASK].right = window_themes_widgets[WIDX_THEMES_COLOURBTN_MASK].left + 12;
                    window_themes_widgets[WIDX_THEMES_COLOURBTN_MASK].bottom = window_themes_widgets[WIDX_THEMES_COLOURBTN_MASK].top + 12;

                    uint8 colour = theme_get_colour(wc, _colour_index_2);
                    window_dropdown_show_colour(w, &(window_themes_widgets[WIDX_THEMES_COLOURBTN_MASK]), w->colours[1], colour);
                    widget_invalidate(w, WIDX_THEMES_LIST);
                }
            }
            else if (x >= _button_offset_x && x < _button_offset_x + 12 * 6 - 1 && y2 >= _check_offset_y && y2 < _check_offset_y + 11) {
                if (theme_get_flags() & UITHEME_FLAG_PREDEFINED) {
                    window_error_open(STR_THEMES_ERR_CANT_CHANGE_THIS_THEME, STR_THEMES_DESC_CANT_CHANGE_THIS_THEME);
                } else {
                    uint8 colour = theme_get_colour(wc, _colour_index_2);
                    if (colour & COLOUR_FLAG_TRANSLUCENT) {
                        colour &= ~COLOUR_FLAG_TRANSLUCENT;
                    } else {
                        colour |= COLOUR_FLAG_TRANSLUCENT;
                    }
                    theme_set_colour(wc, _colour_index_2, colour);
                    colour_scheme_update_all();
                    window_invalidate_all();
                }
            }
        }
    }
}
Exemplo n.º 5
0
void title_sequence_change_preset(int preset)
{
	if (preset >= 0 && preset < gConfigTitleSequences.num_presets) {
		switch (preset) {
		case 0:
			gConfigInterface.current_title_sequence_preset = "*RCT2";
			break;
		case 1:
			gConfigInterface.current_title_sequence_preset = "*OPENRCT2";
			break;
		default:
			gConfigInterface.current_title_sequence_preset = gConfigTitleSequences.presets[preset].name;
			break;
		}
		gCurrentPreviewTitleSequence = preset;
	}
	window_invalidate_all();

	// Switch to (and restart) this title sequence if it's valid
	title_refresh_sequence();
}
Exemplo n.º 6
0
static void custom_currency_window_dropdown([[maybe_unused]] rct_window * w, rct_widgetindex widgetIndex, sint32 dropdownIndex)
{
    if(dropdownIndex == -1)
        return;

    if(widgetIndex == WIDX_AFFIX_DROPDOWN_BUTTON) {

        if(dropdownIndex == 0) {
            CurrencyDescriptors[CURRENCY_CUSTOM].affix_ascii = CURRENCY_PREFIX;
            CurrencyDescriptors[CURRENCY_CUSTOM].affix_unicode = CURRENCY_PREFIX;
        } else if(dropdownIndex == 1) {
            CurrencyDescriptors[CURRENCY_CUSTOM].affix_ascii = CURRENCY_SUFFIX;
            CurrencyDescriptors[CURRENCY_CUSTOM].affix_unicode = CURRENCY_SUFFIX;
        }


        gConfigGeneral.custom_currency_affix = CurrencyDescriptors[CURRENCY_CUSTOM].affix_unicode;
        config_save_default();

        window_invalidate_all();

    }
}
Exemplo n.º 7
0
static void custom_currency_window_mousedown(rct_window *w, rct_widgetindex widgetIndex, rct_widget *widget)
{
    widget = &w->widgets[widgetIndex - 1];

    switch(widgetIndex) {

    case WIDX_CLOSE:
        window_close(w);
        break;

    case WIDX_RATE_UP:
        CurrencyDescriptors[CURRENCY_CUSTOM].rate += 1;
        gConfigGeneral.custom_currency_rate = CurrencyDescriptors[CURRENCY_CUSTOM].rate;
        config_save_default();
        window_invalidate_all();
        break;

    case WIDX_RATE_DOWN:
        if(CurrencyDescriptors[CURRENCY_CUSTOM].rate > 1) {
            CurrencyDescriptors[CURRENCY_CUSTOM].rate -= 1;
            gConfigGeneral.custom_currency_rate = CurrencyDescriptors[CURRENCY_CUSTOM].rate;
            config_save_default();
            window_invalidate_all();
        }
        break;

    case WIDX_AFFIX_DROPDOWN_BUTTON:
        gDropdownItemsFormat[0] = STR_DROPDOWN_MENU_LABEL;
        gDropdownItemsArgs[0] = STR_PREFIX;

        gDropdownItemsFormat[1] = STR_DROPDOWN_MENU_LABEL;
        gDropdownItemsArgs[1] = STR_SUFFIX;

        window_dropdown_show_text_custom_width(
            w->x + widget->left,
            w->y + widget->top,
            widget->bottom - widget->top + 1,
            w->colours[1],
            0,
            DROPDOWN_FLAG_STAY_OPEN,
            2,
            widget->right - widget->left - 3
        );

        if(CurrencyDescriptors[CURRENCY_CUSTOM].affix_unicode == CURRENCY_PREFIX) {
            dropdown_set_checked(0, true);
        } else {
            dropdown_set_checked(1, true);
        }

        break;

    case WIDX_SYMBOL_TEXT:
        window_text_input_raw_open(
            w,
            WIDX_SYMBOL_TEXT,
            STR_CUSTOM_CURRENCY_SYMBOL_INPUT_TITLE,
            STR_CUSTOM_CURRENCY_SYMBOL_INPUT_DESC,
            CurrencyDescriptors[CURRENCY_CUSTOM].symbol_unicode,
            CURRENCY_SYMBOL_MAX_SIZE
        );
        break;

    }
}
Exemplo n.º 8
0
static void window_themes_mousedown(rct_window *w, rct_widgetindex widgetIndex, rct_widget* widget)
{
    sint16 newSelectedTab;
    sint32 num_items;

    switch (widgetIndex) {
    case WIDX_THEMES_SETTINGS_TAB:
    case WIDX_THEMES_MAIN_UI_TAB:
    case WIDX_THEMES_PARK_TAB:
    case WIDX_THEMES_TOOLS_TAB:
    case WIDX_THEMES_RIDE_PEEPS_TAB:
    case WIDX_THEMES_EDITORS_TAB:
    case WIDX_THEMES_MISC_TAB:
    case WIDX_THEMES_PROMPTS_TAB:
    case WIDX_THEMES_FEATURES_TAB:
        newSelectedTab = widgetIndex - WIDX_THEMES_SETTINGS_TAB;
        if (_selected_tab == newSelectedTab)
            break;
        _selected_tab = (uint8)newSelectedTab;
        w->scrolls[0].v_top = 0;
        w->frame_no = 0;
        window_event_resize_call(w);
        window_invalidate(w);
        break;
    case WIDX_THEMES_PRESETS_DROPDOWN:
        theme_manager_load_available_themes();
        num_items = (sint32)theme_manager_get_num_available_themes();

        widget--;
        for (sint32 i = 0; i < num_items; i++) {
            gDropdownItemsFormat[i] = STR_OPTIONS_DROPDOWN_ITEM;
            gDropdownItemsArgs[i] = (uintptr_t)theme_manager_get_available_theme_name(i);
        }

        window_dropdown_show_text_custom_width(
            w->x + widget->left,
            w->y + widget->top,
            widget->bottom - widget->top + 1,
            w->colours[1],
            0,
            DROPDOWN_FLAG_STAY_OPEN,
            num_items,
            widget->right - widget->left - 3
        );

        dropdown_set_checked((sint32)theme_manager_get_active_available_theme_index(), true);
        break;
    case WIDX_THEMES_RCT1_RIDE_LIGHTS:
        if (theme_get_flags() & UITHEME_FLAG_PREDEFINED) {
            window_error_open(STR_THEMES_ERR_CANT_CHANGE_THIS_THEME, STR_NONE);
        } else {
            theme_set_flags(theme_get_flags() ^ UITHEME_FLAG_USE_LIGHTS_RIDE);
            theme_save();
            window_invalidate_all();
        }
        break;
    case WIDX_THEMES_RCT1_PARK_LIGHTS:
        if (theme_get_flags() & UITHEME_FLAG_PREDEFINED) {
            window_error_open(STR_THEMES_ERR_CANT_CHANGE_THIS_THEME, STR_NONE);
        } else {
            theme_set_flags(theme_get_flags() ^ UITHEME_FLAG_USE_LIGHTS_PARK);
            theme_save();
            window_invalidate_all();
        }
        break;
    case WIDX_THEMES_RCT1_SCENARIO_FONT:
        if (theme_get_flags() & UITHEME_FLAG_PREDEFINED) {
            window_error_open(STR_THEMES_ERR_CANT_CHANGE_THIS_THEME, STR_NONE);
        } else {
            theme_set_flags(theme_get_flags() ^ UITHEME_FLAG_USE_ALTERNATIVE_SCENARIO_SELECT_FONT);
            theme_save();
            window_invalidate_all();
        }
        break;
    }
}