Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default options #2948

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

InfusOnWoW
Copy link
Contributor

Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

Fixes #(issue)

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Test A
  • Test B

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings

@Stanzilla
Copy link
Contributor

Stanzilla commented Feb 20, 2021

One file is DefaultOptions the other DefaultsOption we should settle on one, I think I prefer DefaultOptions and I think it's more grammatically correct as well` @emptyrivers?

* Default Options for Glows are missing
* Options dialog needs a lot of work
* Default Options need to be applied to
  * templates
  * imports
@InfusOnWoW
Copy link
Contributor Author

So, I've rebased this on top of current main and checked that some basic things work. I'm a bit suprised how much actually worked. The biggest missing thing is templates, where the introduction of defaults break the old way region defaults are mixed into templates. And the UI. E.g. the new UI clips the settings frame. And it's quite ugly. I guess it would much better if there was a bit of identation, but there's also a lot of options

Anyway a quick overview of the code:
Observe that in https://github.com/WeakAuras/WeakAuras2/blob/13f790d038f8dc6a5aa47012513478064a803514/WeakAuras/SubRegionTypes/SubText.lua#LL13C26-L13C26
the defaults for the SubText depend on the parent's region type. So depending on whether a subtext is added to an icon or an aurabar, e.g. the position, font flags, shadow settings are different.

This is a source of complexity, in this PR that is kept, thus:
a) There are still base defaults in SubText depending on the parent type:
https://github.com/InfusOnWoW/WeakAuras2/blob/44ffbd891ea3481e398464fd4078119681d339a1/WeakAuras/SubRegionTypes/SubText.lua#L10

b) There are user defaults settings that allow overriding these:
https://github.com/InfusOnWoW/WeakAuras2/blob/44ffbd891ea3481e398464fd4078119681d339a1/WeakAurasOptions/SubRegionOptions/SubText.lua#L528

So there's subtext_pb_font for overriding the font for progress bars, and subtext_icon_font for overriding the font on icons

c) How these override settings (that is subtext_pb_font) should be applied to the base defaults to get the effective defaults is the mapping
https://github.com/InfusOnWoW/WeakAuras2/blob/44ffbd891ea3481e398464fd4078119681d339a1/WeakAuras/SubRegionTypes/SubText.lua#L88

Each mapping has a name, that is the top-level key, a base, and a map that e.g. maps global settings paths to keys in the defaults table. So the values in the map, are the keys of the default table that are potentially overriden.

That's the core idea, some more random things:
Each user override has two settings, first if this override should apply to a) new auras/subelements or b) on imports or c) on both,
so Private.GetDefault/ Private.SetDefault return two values: a) the setting for when a override should be applied, and b) the actual override value. Th

The effective defaults tables are kept in a cache, the "defaults cache", which takes care of not recreating the defaults all the time.

There are a bunch of TODOs in the code that indicate areas where I though more work was needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants