summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2022-10-12 23:21:09 +0200
committerCarl Hetherington <cth@carlh.net>2022-10-14 11:41:18 +0200
commitd85bd416c6267e9c86948b9b5f2e5dba5e67f755 (patch)
treee60c0ada656c185eef9f581dbc9682fb244ebe57 /src/lib
parentdeb61d087799d18cce97b1f0f99fe036d2214a42 (diff)
Save and restore sash positions in the main DoM.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/config.cc11
-rw-r--r--src/lib/config.h18
2 files changed, 29 insertions, 0 deletions
diff --git a/src/lib/config.cc b/src/lib/config.cc
index eeb009594..81daff5b6 100644
--- a/src/lib/config.cc
+++ b/src/lib/config.cc
@@ -207,6 +207,9 @@ Config::set_defaults ()
set_notification_email_to_default ();
set_cover_sheet_to_default ();
+ _main_divider_sash_position = {};
+ _main_content_divider_sash_position = {};
+
_export.set_defaults();
}
@@ -604,6 +607,8 @@ try
}
_auto_crop_threshold = f.optional_number_child<double>("AutoCropThreshold").get_value_or(0.1);
_last_release_notes_version = f.optional_string_child("LastReleaseNotesVersion");
+ _main_divider_sash_position = f.optional_number_child<int>("MainDividerSashPosition");
+ _main_content_divider_sash_position = f.optional_number_child<int>("MainContentDividerSashPosition");
_export.read(f.optional_node_child("Export"));
}
@@ -1071,6 +1076,12 @@ Config::write_config () const
if (_last_release_notes_version) {
root->add_child("LastReleaseNotesVersion")->add_child_text(*_last_release_notes_version);
}
+ if (_main_divider_sash_position) {
+ root->add_child("MainDividerSashPosition")->add_child_text(raw_convert<string>(*_main_divider_sash_position));
+ }
+ if (_main_content_divider_sash_position) {
+ root->add_child("MainContentDividerSashPosition")->add_child_text(raw_convert<string>(*_main_content_divider_sash_position));
+ }
_export.write(root->add_child("Export"));
diff --git a/src/lib/config.h b/src/lib/config.h
index 8fbdeaf95..1a11b4a41 100644
--- a/src/lib/config.h
+++ b/src/lib/config.h
@@ -590,6 +590,14 @@ public:
return _last_release_notes_version;
}
+ boost::optional<int> main_divider_sash_position() const {
+ return _main_divider_sash_position;
+ }
+
+ boost::optional<int> main_content_divider_sash_position() const {
+ return _main_content_divider_sash_position;
+ }
+
/* SET (mostly) */
void set_master_encoding_threads (int n) {
@@ -1138,6 +1146,14 @@ public:
return _export;
}
+ void set_main_divider_sash_position(int position) {
+ maybe_set(_main_divider_sash_position, position);
+ }
+
+ void set_main_content_divider_sash_position(int position) {
+ maybe_set(_main_content_divider_sash_position, position);
+ }
+
void changed (Property p = OTHER);
boost::signals2::signal<void (Property)> Changed;
/** Emitted if read() failed on an existing Config file. There is nothing
@@ -1370,6 +1386,8 @@ private:
RoughDuration _default_kdm_duration;
double _auto_crop_threshold;
boost::optional<std::string> _last_release_notes_version;
+ boost::optional<int> _main_divider_sash_position;
+ boost::optional<int> _main_content_divider_sash_position;
ExportConfig _export;