PDFViewer: Let users change clipping paths visibility

Now that the Renderer accepts preferences, PDFViewer can offer ways for
changing these preferences. The first step in this direction is to add a
checkbox that allows toggling whether clipping paths are visible or not.
A Config item has also been added to remember this setting.
This commit is contained in:
Rodrigo Tobar 2022-11-23 21:16:52 +08:00 committed by Andreas Kling
parent e92ec26771
commit bc7da24fe6
Notes: sideshowbarker 2024-07-17 04:07:27 +09:00
4 changed files with 26 additions and 4 deletions

View file

@ -167,6 +167,12 @@ void PDFViewerWidget::initialize_toolbar(GUI::Toolbar& toolbar)
toolbar.add_action(*m_reset_zoom_action);
toolbar.add_action(*m_rotate_counterclockwise_action);
toolbar.add_action(*m_rotate_clockwise_action);
toolbar.add_separator();
m_show_clipping_paths = toolbar.add<GUI::CheckBox>();
m_show_clipping_paths->set_text("Show clipping paths");
m_show_clipping_paths->set_checked(m_viewer->show_clipping_paths(), GUI::AllowCallback::No);
m_show_clipping_paths->on_checked = [&](auto checked) { m_viewer->set_show_clipping_paths(checked); };
}
void PDFViewerWidget::open_file(Core::File& file)
@ -214,6 +220,7 @@ void PDFViewerWidget::open_file(Core::File& file)
m_reset_zoom_action->set_enabled(true);
m_rotate_counterclockwise_action->set_enabled(true);
m_rotate_clockwise_action->set_enabled(true);
m_show_clipping_paths->set_checked(m_viewer->show_clipping_paths(), GUI::AllowCallback::No);
if (document->outline()) {
auto outline = document->outline();