1313#include " DeviceSelectorObserver.hpp"
1414#include " OutputOptionsState.hpp"
1515#include " PreferencesView.hpp"
16+ #include " PresetPanel.hpp"
1617#include " PreviewPanel.hpp"
1718#include " ScanOptionsPanel.hpp"
1819#include " Writers/FileWriter.hpp"
@@ -113,7 +114,7 @@ GtkWidget *ZooScan::App::CreateContent()
113114 auto deviceSelected = !GetSelectorDeviceName ().empty ();
114115
115116 auto *paned = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL);
116- gtk_widget_set_margin_bottom (paned, 15 );
117+ gtk_widget_set_margin_bottom (paned, 0 );
117118 gtk_widget_set_margin_top (paned, 0 );
118119 gtk_widget_set_margin_start (paned, 10 );
119120 gtk_widget_set_margin_end (paned, 10 );
@@ -128,31 +129,53 @@ GtkWidget *ZooScan::App::CreateContent()
128129 gtk_orientable_set_orientation (GTK_ORIENTABLE (clamp), GTK_ORIENTATION_HORIZONTAL);
129130 gtk_paned_set_start_child (GTK_PANED (paned), clamp);
130131
131- m_SettingsBox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8 );
132+ m_SettingsBox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0 );
132133 gtk_widget_set_margin_bottom (m_SettingsBox, 0 );
133134 gtk_widget_set_margin_top (m_SettingsBox, 0 );
134135 gtk_widget_set_margin_start (m_SettingsBox, 0 );
135136 gtk_widget_set_margin_end (m_SettingsBox, 10 );
136137 adw_clamp_set_child (ADW_CLAMP (clamp), m_SettingsBox);
137138
139+ auto buttonBox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8 );
140+ gtk_widget_set_margin_bottom (buttonBox, 20 );
141+ gtk_widget_set_margin_top (buttonBox, 20 );
142+ gtk_widget_set_margin_start (buttonBox, 0 );
143+ gtk_widget_set_margin_end (buttonBox, 0 );
144+ gtk_box_append (GTK_BOX (m_SettingsBox), buttonBox);
145+
138146 m_PreviewButton = gtk_button_new_with_label (_ (" Preview" ));
139147 ConnectGtkSignal (this , &App::OnPreviewClicked, m_PreviewButton, " clicked" );
140148 gtk_widget_set_sensitive (m_PreviewButton, deviceSelected);
141- gtk_box_append (GTK_BOX (m_SettingsBox ), m_PreviewButton);
149+ gtk_box_append (GTK_BOX (buttonBox ), m_PreviewButton);
142150
143151 m_ScanButton = gtk_button_new_with_label (_ (" Scan" ));
144152 ConnectGtkSignal (this , &App::OnScanClicked, m_ScanButton, " clicked" );
145153 gtk_widget_set_sensitive (m_ScanButton, deviceSelected);
146- gtk_box_append (GTK_BOX (m_SettingsBox ), m_ScanButton);
154+ gtk_box_append (GTK_BOX (buttonBox ), m_ScanButton);
147155
148156 m_CancelButton = gtk_button_new_with_label (_ (" Cancel Scan" ));
149157 ConnectGtkSignal (this , &App::OnCancelClicked, m_CancelButton, " clicked" );
150158 gtk_widget_set_sensitive (m_CancelButton, false );
151- gtk_box_append (GTK_BOX (m_SettingsBox), m_CancelButton);
159+ gtk_box_append (GTK_BOX (buttonBox), m_CancelButton);
160+
161+ auto bottomAlignedSection = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0 );
162+ gtk_widget_set_hexpand (bottomAlignedSection, true );
163+ gtk_widget_set_vexpand (bottomAlignedSection, true );
164+ gtk_widget_set_valign (bottomAlignedSection, GTK_ALIGN_END);
165+ gtk_box_append (GTK_BOX (m_SettingsBox), bottomAlignedSection);
166+
167+ m_PresetPanel = ZooLib::View::Create<PresetPanel>(&m_Dispatcher, this );
168+ auto presetsBox = m_PresetPanel->GetRootWidget ();
169+ gtk_widget_set_margin_bottom (presetsBox, 0 );
170+ gtk_widget_set_margin_top (presetsBox, 0 );
171+ gtk_widget_set_margin_start (presetsBox, 0 );
172+ gtk_widget_set_margin_end (presetsBox, 0 );
173+ gtk_box_append (GTK_BOX (bottomAlignedSection), presetsBox);
174+ gtk_widget_set_hexpand (presetsBox, true );
152175
153176 m_PreviewPanel = ZooLib::View::Create<PreviewPanel>(&m_Dispatcher, this );
154177 auto previewBox = m_PreviewPanel->GetRootWidget ();
155- gtk_widget_set_margin_bottom (previewBox, 0 );
178+ gtk_widget_set_margin_bottom (previewBox, 10 );
156179 gtk_widget_set_margin_top (previewBox, 0 );
157180 gtk_widget_set_margin_start (previewBox, 10 );
158181 gtk_widget_set_margin_end (previewBox, 0 );
@@ -268,7 +291,7 @@ void ZooScan::App::Update(const std::vector<uint64_t> &lastSeenVersions)
268291 }
269292
270293 gtk_box_remove (GTK_BOX (m_SettingsBox), m_ScanOptionsPanel->GetRootWidget ());
271- // m_DeviceOptionsPanel is automatically deleted when its root widget is destroyed.
294+ // m_ScanOptionsPanel is automatically deleted when its root widget is destroyed.
272295 m_ScanOptionsPanel = nullptr ;
273296 m_Dispatcher.UnregisterHandler <SetScanAreaCommand>();
274297 }
@@ -315,18 +338,26 @@ void ZooScan::App::Update(const std::vector<uint64_t> &lastSeenVersions)
315338 }
316339}
317340
318- const ZooScan::DeviceOptionsState *ZooScan::App::GetDeviceOptions () const
341+ ZooScan::DeviceOptionsState *ZooScan::App::GetDeviceOptions () const
319342{
320343 if (m_ScanOptionsPanel == nullptr )
321344 return nullptr ;
322345
323346 return m_ScanOptionsPanel->GetDeviceOptionsState ();
324347}
325348
326- void ZooScan::App::RestoreScanOptions () const
349+ ZooScan::OutputOptionsState *ZooScan::App::GetOutputOptions ()
350+ {
351+ if (m_ScanOptionsPanel == nullptr )
352+ return nullptr ;
353+
354+ return m_ScanOptionsPanel->GetOutputOptionsState ();
355+ }
356+
357+ void ZooScan::App::RestoreScanOptions ()
327358{
328359 auto device = GetDevice ();
329- const auto options = GetDeviceOptions ();
360+ auto options = GetDeviceOptions ();
330361 if (device == nullptr || options == nullptr )
331362 {
332363 return ;
0 commit comments