Beispiel #1
0
static void window_news_options_invalidate(rct_window *w)
{
    // Set pressed tab
    w->pressed_widgets &= ~(1ULL << WIDX_TAB_PARK);
    w->pressed_widgets &= ~(1ULL << WIDX_TAB_RIDE);
    w->pressed_widgets &= ~(1ULL << WIDX_TAB_GUEST);
    w->pressed_widgets |= (1ULL << (WIDX_TAB_PARK + w->page));

    // Set checkboxes
    rct_widget *baseCheckBox = &w->widgets[WIDX_CHECKBOX_0];
    sint32 y = baseCheckBox->top;

    sint32 checkboxWidgetIndex = WIDX_CHECKBOX_0;
    rct_widget *checkboxWidget = &w->widgets[checkboxWidgetIndex];
    for (size_t i = 0; i < Util::CountOf(NewsItemOptionDefinitions); i++) {
        const notification_def *ndef = &NewsItemOptionDefinitions[i];
        if (ndef->category != w->page) continue;

        w->enabled_widgets |= (1ULL << checkboxWidgetIndex);

        checkboxWidget->type = WWT_CHECKBOX;
        checkboxWidget->left = baseCheckBox->left;
        checkboxWidget->right = baseCheckBox->right;
        checkboxWidget->top = y;
        checkboxWidget->bottom = checkboxWidget->top + LIST_ROW_HEIGHT + 3;
        checkboxWidget->text = ndef->caption;

        const bool *configValue = get_notification_value_ptr(ndef);
        widget_set_checkbox_value(w, checkboxWidgetIndex, *configValue);

        checkboxWidgetIndex++;
        checkboxWidget++;
        y += LIST_ROW_HEIGHT + 3;
    }

    // Remove unused checkboxes
    while (checkboxWidget->type != WWT_LAST) {
        w->enabled_widgets &= ~(1ULL << checkboxWidgetIndex);

        checkboxWidget->type = WWT_EMPTY;
        checkboxWidgetIndex++;
        checkboxWidget++;
    }

    // Resize window to fit checkboxes exactly
    y += 3;

    if (w->height != y) {
        window_invalidate(w);
        w->height = y;
        w->widgets[WIDX_BACKGROUND].bottom = y - 1;
        w->widgets[WIDX_TAB_CONTENT_PANEL].bottom = y - 1;
        window_invalidate(w);
    }
}
Beispiel #2
0
static void window_debug_paint_invalidate(rct_window * w)
{
	widget_set_checkbox_value(w, WIDX_TOGGLE_OLD_DRAWING, gUseOriginalRidePaint);
	widget_set_checkbox_value(w, WIDX_TOGGLE_SHOW_SEGMENT_HEIGHTS, gShowSupportSegmentHeights);
	widget_set_checkbox_value(w, WIDX_TOGGLE_SHOW_BOUND_BOXES, gPaintBoundingBoxes);
}
Beispiel #3
0
void window_themes_invalidate(rct_window *w)
{
    sint32 pressed_widgets = w->pressed_widgets & ~(
            (1LL << WIDX_THEMES_SETTINGS_TAB) |
            (1LL << WIDX_THEMES_MAIN_UI_TAB) |
            (1LL << WIDX_THEMES_PARK_TAB) |
            (1LL << WIDX_THEMES_TOOLS_TAB) |
            (1LL << WIDX_THEMES_RIDE_PEEPS_TAB) |
            (1LL << WIDX_THEMES_EDITORS_TAB) |
            (1LL << WIDX_THEMES_MISC_TAB) |
            (1LL << WIDX_THEMES_PROMPTS_TAB) |
            (1LL << WIDX_THEMES_FEATURES_TAB)
    );
    rct_widgetindex widgetIndex = _selected_tab + WIDX_THEMES_SETTINGS_TAB;

    w->pressed_widgets = pressed_widgets | (1 << widgetIndex);

    if (window_find_by_class(WC_DROPDOWN) == NULL) {
        _colour_index_1 = -1;
        _colour_index_2 = -1;
    }

    window_themes_widgets[WIDX_THEMES_BACKGROUND].right = w->width - 1;
    window_themes_widgets[WIDX_THEMES_BACKGROUND].bottom = w->height - 1;
    window_themes_widgets[WIDX_THEMES_TAB_CONTENT_PANEL].right = w->width - 1;
    window_themes_widgets[WIDX_THEMES_TAB_CONTENT_PANEL].bottom = w->height - 1;
    window_themes_widgets[WIDX_THEMES_TITLE].right = w->width - 2;
    window_themes_widgets[WIDX_THEMES_CLOSE].left = w->width - 2 - 0x0B;
    window_themes_widgets[WIDX_THEMES_CLOSE].right = w->width - 2 - 0x0B + 0x0A;
    window_themes_widgets[WIDX_THEMES_LIST].right = w->width - 4;
    window_themes_widgets[WIDX_THEMES_LIST].bottom = w->height - 0x0F;


    window_themes_widgets[WIDX_THEMES_LIST].type = WWT_EMPTY;
    window_themes_widgets[WIDX_THEMES_RCT1_RIDE_LIGHTS].type = WWT_EMPTY;
    window_themes_widgets[WIDX_THEMES_RCT1_PARK_LIGHTS].type = WWT_EMPTY;
    window_themes_widgets[WIDX_THEMES_RCT1_SCENARIO_FONT].type = WWT_EMPTY;
    window_themes_widgets[WIDX_THEMES_DUPLICATE_BUTTON].type = WWT_EMPTY;
    window_themes_widgets[WIDX_THEMES_DELETE_BUTTON].type = WWT_EMPTY;
    window_themes_widgets[WIDX_THEMES_RENAME_BUTTON].type = WWT_EMPTY;
    window_themes_widgets[WIDX_THEMES_PRESETS].type = WWT_EMPTY;
    window_themes_widgets[WIDX_THEMES_PRESETS_DROPDOWN].type = WWT_EMPTY;
    window_themes_widgets[WIDX_THEMES_COLOURBTN_MASK].type = WWT_EMPTY;

    if (_selected_tab == WINDOW_THEMES_TAB_SETTINGS) {
        window_themes_widgets[WIDX_THEMES_LIST].type = WWT_EMPTY;
        window_themes_widgets[WIDX_THEMES_RCT1_RIDE_LIGHTS].type = WWT_EMPTY;
        window_themes_widgets[WIDX_THEMES_RCT1_PARK_LIGHTS].type = WWT_EMPTY;
        window_themes_widgets[WIDX_THEMES_RCT1_SCENARIO_FONT].type = WWT_EMPTY;
        window_themes_widgets[WIDX_THEMES_DUPLICATE_BUTTON].type = WWT_DROPDOWN_BUTTON;
        window_themes_widgets[WIDX_THEMES_DELETE_BUTTON].type = WWT_DROPDOWN_BUTTON;
        window_themes_widgets[WIDX_THEMES_RENAME_BUTTON].type = WWT_DROPDOWN_BUTTON;
        window_themes_widgets[WIDX_THEMES_PRESETS].type = WWT_DROPDOWN;
        window_themes_widgets[WIDX_THEMES_PRESETS_DROPDOWN].type = WWT_DROPDOWN_BUTTON;
    }
    else if (_selected_tab == WINDOW_THEMES_TAB_FEATURES) {
        window_themes_widgets[WIDX_THEMES_LIST].type = WWT_EMPTY;
        window_themes_widgets[WIDX_THEMES_RCT1_RIDE_LIGHTS].type = WWT_CHECKBOX;
        window_themes_widgets[WIDX_THEMES_RCT1_PARK_LIGHTS].type = WWT_CHECKBOX;
        window_themes_widgets[WIDX_THEMES_RCT1_SCENARIO_FONT].type = WWT_CHECKBOX;
        window_themes_widgets[WIDX_THEMES_DUPLICATE_BUTTON].type = WWT_EMPTY;
        window_themes_widgets[WIDX_THEMES_DELETE_BUTTON].type = WWT_EMPTY;
        window_themes_widgets[WIDX_THEMES_RENAME_BUTTON].type = WWT_EMPTY;
        window_themes_widgets[WIDX_THEMES_PRESETS].type = WWT_EMPTY;
        window_themes_widgets[WIDX_THEMES_PRESETS_DROPDOWN].type = WWT_EMPTY;

        widget_set_checkbox_value(w, WIDX_THEMES_RCT1_RIDE_LIGHTS, theme_get_flags() & UITHEME_FLAG_USE_LIGHTS_RIDE);
        widget_set_checkbox_value(w, WIDX_THEMES_RCT1_PARK_LIGHTS, theme_get_flags() & UITHEME_FLAG_USE_LIGHTS_PARK);
        widget_set_checkbox_value(w, WIDX_THEMES_RCT1_SCENARIO_FONT, theme_get_flags() & UITHEME_FLAG_USE_ALTERNATIVE_SCENARIO_SELECT_FONT);
    }
    else {
        window_themes_widgets[WIDX_THEMES_LIST].type = WWT_SCROLL;
        window_themes_widgets[WIDX_THEMES_RCT1_RIDE_LIGHTS].type = WWT_EMPTY;
        window_themes_widgets[WIDX_THEMES_RCT1_PARK_LIGHTS].type = WWT_EMPTY;
        window_themes_widgets[WIDX_THEMES_RCT1_SCENARIO_FONT].type = WWT_EMPTY;
        window_themes_widgets[WIDX_THEMES_DUPLICATE_BUTTON].type = WWT_EMPTY;
        window_themes_widgets[WIDX_THEMES_DELETE_BUTTON].type = WWT_EMPTY;
        window_themes_widgets[WIDX_THEMES_RENAME_BUTTON].type = WWT_EMPTY;
        window_themes_widgets[WIDX_THEMES_PRESETS].type = WWT_EMPTY;
        window_themes_widgets[WIDX_THEMES_PRESETS_DROPDOWN].type = WWT_EMPTY;
    }
}