Skip to content

fix: menu refactor bugs#1335

Merged
Pentalimbed merged 1 commit into
community-shaders:devfrom
alandtse:menu_refactor_bugs
Jul 30, 2025
Merged

fix: menu refactor bugs#1335
Pentalimbed merged 1 commit into
community-shaders:devfrom
alandtse:menu_refactor_bugs

Conversation

@alandtse
Copy link
Copy Markdown
Collaborator

@alandtse alandtse commented Jul 30, 2025

closes #1334

Summary by CodeRabbit

  • New Features

    • Expanded font size range for customization, allowing larger and smaller font sizes in the menu.
    • Improved clarity and consistency for font and theme settings throughout the menu interface.
  • Style

    • Updated tab colors in the menu to better reflect the selected theme palette.
  • Chores

    • Streamlined and reorganized font and theme configuration settings for improved maintainability.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jul 30, 2025

Walkthrough

This change consolidates font and rendering-related constants from Menu::Constants into ThemeManager::Constants, updates all references accordingly, and expands the font size range. It also corrects tab color assignments in the ImGui style setup to use the theme palette instead of transparent colors.

Changes

Cohort / File(s) Change Summary
Menu Constants Refactor
src/Menu.cpp, src/Menu.h, src/Menu/SettingsTabRenderer.cpp
Removed font and rendering constants from Menu::Constants, updated all usages to reference ThemeManager::Constants, and adjusted initializations and slider ranges to use the new constants.
ThemeManager Constants Expansion
src/Menu/ThemeManager.h
Added and reorganized font size and font config constants, expanded font size range (min 16.0f, max 108.0f), increased vertical oversampling, and clarified default values with comments.
ImGui Tab Color Fix
src/Menu/ThemeManager.cpp
Changed ImGui tab color assignments to use the theme palette for all tab states instead of transparent or copied colors.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Menu
    participant ThemeManager

    User->>Menu: Adjusts font size or opens menu
    Menu->>ThemeManager: Requests font constants (size, oversample, etc.)
    ThemeManager-->>Menu: Returns constants from ThemeManager::Constants
    Menu->>Menu: Applies font settings using ThemeManager constants
    Menu->>ThemeManager: Requests tab color palette
    ThemeManager-->>Menu: Returns FullPalette colors
    Menu->>Menu: Applies tab colors in ImGui style
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Assessment against linked issues

Objective Addressed Explanation
Remove duplicate font and rendering constants from Menu.h and consolidate in ThemeManager.h (#1334)
Ensure font size can be set above 32, up to 108, and update all usages (#1334)
Fix issue with active tab color being transparent in ImGui style (#1334)

Assessment against linked issues: Out-of-scope changes

No out-of-scope changes found.

Possibly related PRs

Poem

In the meadow where constants once grew,
Rabbits hopped, unsure what to do.
Now all fonts and colors, neat in one place,
Bring clarity, order, and style to the race.
Tabs are no longer see-through, oh what a view!
🐇✨ Constants united, the meadow feels new!

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 02e2adb and 7ce2338.

📒 Files selected for processing (5)
  • src/Menu.cpp (1 hunks)
  • src/Menu.h (2 hunks)
  • src/Menu/SettingsTabRenderer.cpp (1 hunks)
  • src/Menu/ThemeManager.cpp (1 hunks)
  • src/Menu/ThemeManager.h (1 hunks)
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
Learnt from: alandtse
PR: doodlum/skyrim-community-shaders#0
File: :0-0
Timestamp: 2025-06-24T07:17:36.604Z
Learning: When reviewing PRs, always clarify the scope if there are multiple related features or dependencies. WeatherPicker was a separate PR that was already merged, while this PR focuses specifically on WetnessEffects climate preset system enhancements.
Learnt from: alandtse
PR: doodlum/skyrim-community-shaders#0
File: :0-0
Timestamp: 2025-07-05T05:20:45.823Z
Learning: In the skyrim-community-shaders repository, file deletion error handling improvements that replace existence checks and try-catch blocks with std::filesystem::remove error-code-based approaches are considered bug fixes rather than refactoring, as they address inadequate error handling and misleading log messages.
src/Menu.cpp (1)

Learnt from: davo0411
PR: #1107
File: src/Menu.cpp:310-315
Timestamp: 2025-05-31T02:51:24.195Z
Learning: In the Community Shaders codebase, when validating UI icons, checking for texture presence (non-null pointer) is sufficient. Avoid adding dimension validation checks as icon sizes should vary based on user needs (4K+ resolution users may want higher resolution icons). Don't artificially limit icon dimensions.

src/Menu.h (4)

Learnt from: davo0411
PR: #1107
File: src/Menu.cpp:310-315
Timestamp: 2025-05-31T02:51:24.195Z
Learning: In the Community Shaders codebase, when validating UI icons, checking for texture presence (non-null pointer) is sufficient. Avoid adding dimension validation checks as icon sizes should vary based on user needs (4K+ resolution users may want higher resolution icons). Don't artificially limit icon dimensions.

Learnt from: alandtse
PR: doodlum/skyrim-community-shaders#0
File: :0-0
Timestamp: 2025-07-01T18:01:07.079Z
Learning: In the skyrim-community-shaders project, simple scalar constants in HLSL shaders use #define (e.g., #define NTHREADS 128), while more complex constants use static const within namespaces (e.g., Math namespace in Math.hlsli). For epsilon standardization, #define is the appropriate choice since epsilon values are simple scalar constants.

Learnt from: alandtse
PR: #577
File: src/Features/WetnessEffects.h:36-36
Timestamp: 2025-06-08T11:25:14.536Z
Learning: In the skyrim-community-shaders project, boolean flags in C++ structs that interface with HLSL shaders use uint type instead of bool for compatibility reasons. This ensures consistent size, alignment, and cross-platform compatibility when passing data to shader constant buffers.

Learnt from: alandtse
PR: #577
File: src/Features/WetnessEffects.h:36-36
Timestamp: 2025-06-08T11:25:14.536Z
Learning: In the skyrim-community-shaders project, boolean flags in C++ structs that interface with HLSL shaders use uint type instead of bool for compatibility reasons. This ensures consistent 4-byte size, proper 16-byte alignment in constant buffers, and cross-platform compatibility when passing data between C++ and HLSL shaders.

src/Menu/ThemeManager.h (1)

Learnt from: alandtse
PR: doodlum/skyrim-community-shaders#0
File: :0-0
Timestamp: 2025-07-01T18:01:07.079Z
Learning: In the skyrim-community-shaders project, simple scalar constants in HLSL shaders use #define (e.g., #define NTHREADS 128), while more complex constants use static const within namespaces (e.g., Math namespace in Math.hlsli). For epsilon standardization, #define is the appropriate choice since epsilon values are simple scalar constants.

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Build plugin and addons
🔇 Additional comments (7)
src/Menu/ThemeManager.h (1)

13-24: LGTM! Well-structured font constants consolidation.

The font size constants are properly documented with clear rationale (percentage of screen height), and the expanded range from 16.0f-108.0f addresses the issue where font sizes above 32 had no effect. The font configuration constants now include helpful comments about ImGui defaults, improving maintainability.

src/Menu/SettingsTabRenderer.cpp (1)

184-184: LGTM! Consistent constant reference update.

The font size slider now correctly uses the consolidated ThemeManager::Constants for min/max values, enabling the expanded font size range (16.0f-108.0f) that was previously limited.

src/Menu/ThemeManager.cpp (1)

95-99: Critical fix for tab color transparency issue.

This change addresses the key issue mentioned in PR #1334 where the active tab was transparent. By using themeSettings.FullPalette instead of transparent colors, tabs now have proper visual distinction and clarity.

src/Menu.cpp (2)

166-169: LGTM! Font configuration constants properly updated.

The font configuration parameters now correctly reference the consolidated ThemeManager::Constants, maintaining consistency with the refactoring while preserving the existing initialization logic.


176-184: LGTM! Font size logic consistently updated.

The font size calculation and clamping logic now properly uses the consolidated constants from ThemeManager::Constants, including the expanded range that addresses the font size limitation issue.

src/Menu.h (2)

97-97: LGTM! Font size initialization properly updated.

The FontSize member now correctly initializes from the consolidated ThemeManager::Constants::DEFAULT_FONT_SIZE, completing the elimination of duplicate constants.


273-273: LGTM! Cached font size initialization updated.

The cachedFontSize member now correctly uses the consolidated constant, ensuring consistency across the font management system.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions
Copy link
Copy Markdown

Using provided base ref: 02e2adb
Using base ref: 02e2adb
Base commit date: 2025-07-29T22:33:09+01:00 (Tuesday, July 29, 2025 10:33 PM)
No actionable suggestions for changed features.

@github-actions
Copy link
Copy Markdown

✅ A pre-release build is available for this PR:
Download

@Pentalimbed Pentalimbed merged commit 3d4e996 into community-shaders:dev Jul 30, 2025
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants