1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:37:35 +00:00

PixelPaint: Use config to get default values for Guides/Rulers/PixelGrid

Someone may not want to have these things enabled by default on every
startup, but toggle them on manually. So instead of having hard-coded
everything to be enabled by default, we now query LibConfig to find
out what the preference is. These values can still always be changed
from the Menus / with shortcuts.

It's not really ideal querying LibConfig twice, but when initializing
the menu we may not have an active editor, so we need to get the
value for both the menu checkbox as well as the internal property.
This shouldn't be too much of a big deal since LibConfig caches the
values anyway :^)
This commit is contained in:
Mustafa Quraish 2021-09-11 23:40:59 -04:00 committed by Andreas Kling
parent dd0cc58d6c
commit 677aa7b769
2 changed files with 9 additions and 3 deletions

View file

@ -30,7 +30,12 @@ ImageEditor::ImageEditor(NonnullRefPtr<Image> image)
m_undo_stack = make<GUI::UndoStack>();
m_undo_stack->push(make<ImageUndoCommand>(*m_image));
m_image->add_client(*this);
m_pixel_grid_threshold = (float)Config::read_i32("PixelPaint", "PixelGrid", "Threshold", 15);
m_show_pixel_grid = Config::read_bool("PixelPaint", "PixelGrid", "Show", true);
m_show_rulers = Config::read_bool("PixelPaint", "Rulers", "Show", true);
m_show_guides = Config::read_bool("PixelPaint", "Guides", "Show", true);
}
ImageEditor::~ImageEditor()