Skip to content

Commit 65919bc

Browse files
TorstennatorAtkinsSJ
authored andcommitted
PixelPaint: Remember visibility for histogram and vectorscope
This patch allows pixelpaint to remember if the histogram or vectorscope was visible last time the application was used.
1 parent e86cab0 commit 65919bc

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

Userland/Applications/PixelPaint/MainWidget.cpp

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -510,15 +510,24 @@ void MainWidget::initialize_menubar(GUI::Window& window)
510510
m_view_menu->add_action(*m_show_active_layer_boundary_action);
511511

512512
m_view_menu->add_separator();
513-
auto& scopes_menu = m_view_menu->add_submenu("&Scopes");
514513

515-
scopes_menu.add_action(GUI::Action::create_checkable("&Histogram", [&](auto& action) {
514+
auto histogram_action = GUI::Action::create_checkable("&Histogram", [&](auto& action) {
515+
Config::write_bool("PixelPaint"sv, "Scopes"sv, "ShowHistogram"sv, action.is_checked());
516516
m_histogram_widget->parent_widget()->set_visible(action.is_checked());
517-
}));
517+
});
518+
histogram_action->set_checked(Config::read_bool("PixelPaint"sv, "Scopes"sv, "ShowHistogram"sv, false));
519+
m_histogram_widget->parent_widget()->set_visible(histogram_action->is_checked());
518520

519-
scopes_menu.add_action(GUI::Action::create_checkable("&Vectorscope", [&](auto& action) {
521+
auto vectorscope_action = GUI::Action::create_checkable("&Vectorscope", [&](auto& action) {
522+
Config::write_bool("PixelPaint"sv, "Scopes"sv, "ShowVectorscope"sv, action.is_checked());
520523
m_vectorscope_widget->parent_widget()->set_visible(action.is_checked());
521-
}));
524+
});
525+
vectorscope_action->set_checked(Config::read_bool("PixelPaint"sv, "Scopes"sv, "ShowVectorscope"sv, false));
526+
m_vectorscope_widget->parent_widget()->set_visible(vectorscope_action->is_checked());
527+
528+
auto& scopes_menu = m_view_menu->add_submenu("&Scopes");
529+
scopes_menu.add_action(histogram_action);
530+
scopes_menu.add_action(vectorscope_action);
522531

523532
m_tool_menu = window.add_menu("&Tool");
524533
m_toolbox->for_each_tool([&](auto& tool) {

0 commit comments

Comments
 (0)