aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRubén Beltrán del Río <jj@r.bdr.sh>2026-01-16 15:33:52 +0100
committerRubén Beltrán del Río <jj@r.bdr.sh>2026-01-16 15:42:08 +0100
commit439cd0d998571506dd7971fe1e357d09cb2ff36e (patch)
treef9f2667865c3816736b3f009c0841510b97fcb76 /src
parent5a902f8b350f8b2b33c4e19c70f3425802faaa1b (diff)
Add license, and expand variables
Diffstat (limited to 'src')
-rw-r--r--src/actions.rs16
-rw-r--r--src/constants.rs16
-rw-r--r--src/dialogs.rs16
-rw-r--r--src/file_registry.rs15
-rw-r--r--src/handlers/export.rs15
-rw-r--r--src/handlers/file.rs15
-rw-r--r--src/handlers/mod.rs15
-rw-r--r--src/handlers/view.rs15
-rw-r--r--src/handlers/zoom.rs15
-rw-r--r--src/main.rs17
-rw-r--r--src/preferences/mod.rs11
-rw-r--r--src/preferences/models.rs11
-rw-r--r--src/preferences/pages/editor.rs56
-rw-r--r--src/preferences/pages/general.rs11
-rw-r--r--src/preferences/pages/map.rs65
-rw-r--r--src/preferences/pages/mod.rs11
-rw-r--r--src/preferences/pages/stages.rs23
-rw-r--r--src/preferences/pages/templates.rs11
-rw-r--r--src/preferences/storage.rs36
-rw-r--r--src/preferences/window.rs30
-rw-r--r--src/stages.rs16
-rw-r--r--src/ui_helpers.rs34
22 files changed, 334 insertions, 136 deletions
diff --git a/src/actions.rs b/src/actions.rs
index ee25e20..859d559 100644
--- a/src/actions.rs
+++ b/src/actions.rs
@@ -1,3 +1,19 @@
+// Map, wardley map editor for linux
+// Copyright (C) 2026 Rubén Beltrán del Río
+
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
use std::path::PathBuf;
use crate::preferences::UserPreferences;
diff --git a/src/constants.rs b/src/constants.rs
index 1677828..3e7ac12 100644
--- a/src/constants.rs
+++ b/src/constants.rs
@@ -1,3 +1,19 @@
+// Map, wardley map editor for linux
+// Copyright (C) 2026 Rubén Beltrán del Río
+
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
// Zoom configuration
pub const MIN_ZOOM: f64 = 0.1;
pub const MAX_ZOOM: f64 = 2.0;
diff --git a/src/dialogs.rs b/src/dialogs.rs
index 6ee7717..f7fb9cf 100644
--- a/src/dialogs.rs
+++ b/src/dialogs.rs
@@ -1,3 +1,19 @@
+// Map, wardley map editor for linux
+// Copyright (C) 2026 Rubén Beltrán del Río
+
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
//! Dialog helper functions for file operations and error display.
use std::path::PathBuf;
diff --git a/src/file_registry.rs b/src/file_registry.rs
index 7f062c8..73299f6 100644
--- a/src/file_registry.rs
+++ b/src/file_registry.rs
@@ -1,3 +1,18 @@
+// Map, wardley map editor for linux
+// Copyright (C) 2026 Rubén Beltrán del Río
+
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
//! Manages tracking of open files and window controllers.
//!
//! GTK is single-threaded, so thread-local storage is safe here.
diff --git a/src/handlers/export.rs b/src/handlers/export.rs
index 45e980e..0b64a73 100644
--- a/src/handlers/export.rs
+++ b/src/handlers/export.rs
@@ -1,3 +1,18 @@
+// Map, wardley map editor for linux
+// Copyright (C) 2026 Rubén Beltrán del Río
+
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
use std::path::PathBuf;
use crate::AppModel;
diff --git a/src/handlers/file.rs b/src/handlers/file.rs
index 55eaffa..615a1f7 100644
--- a/src/handlers/file.rs
+++ b/src/handlers/file.rs
@@ -1,3 +1,18 @@
+// Map, wardley map editor for linux
+// Copyright (C) 2026 Rubén Beltrán del Río
+
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
use std::path::PathBuf;
use gtk::prelude::*;
diff --git a/src/handlers/mod.rs b/src/handlers/mod.rs
index 168feb8..235afc2 100644
--- a/src/handlers/mod.rs
+++ b/src/handlers/mod.rs
@@ -1,3 +1,18 @@
+// Map, wardley map editor for linux
+// Copyright (C) 2026 Rubén Beltrán del Río
+
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
pub mod export;
pub mod file;
pub mod view;
diff --git a/src/handlers/view.rs b/src/handlers/view.rs
index 020b756..58d44b2 100644
--- a/src/handlers/view.rs
+++ b/src/handlers/view.rs
@@ -1,3 +1,18 @@
+// Map, wardley map editor for linux
+// Copyright (C) 2026 Rubén Beltrán del Río
+
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
use relm4::gtk;
use crate::AppModel;
diff --git a/src/handlers/zoom.rs b/src/handlers/zoom.rs
index 3acbb2c..575f5f9 100644
--- a/src/handlers/zoom.rs
+++ b/src/handlers/zoom.rs
@@ -1,3 +1,18 @@
+// Map, wardley map editor for linux
+// Copyright (C) 2026 Rubén Beltrán del Río
+
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
use crate::AppModel;
use crate::constants;
diff --git a/src/main.rs b/src/main.rs
index 4ba95c1..60be618 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,3 +1,19 @@
+// Map, wardley map editor for linux
+// Copyright (C) 2026 Rubén Beltrán del Río
+
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
// Suppress warnings from relm4 view! macro internals
#![allow(unused_assignments)]
@@ -8,6 +24,7 @@ mod file_registry;
mod handlers;
mod preferences;
mod stages;
+mod ui_helpers;
mod icon_names {
include!(concat!(env!("OUT_DIR"), "/icon_names.rs"));
diff --git a/src/preferences/mod.rs b/src/preferences/mod.rs
index 900869f..b369e88 100644
--- a/src/preferences/mod.rs
+++ b/src/preferences/mod.rs
@@ -1,17 +1,18 @@
-// Copyright (C) 2024 Rubén Beltrán del Río
+// Map, wardley map editor for linux
+// Copyright (C) 2026 Rubén Beltrán del Río
// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
+// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
+// GNU Affero General Public License for more details.
-// You should have received a copy of the GNU General Public License
-// along with this program. If not, see https://map.tranquil.systems.
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
pub mod models;
pub mod pages;
diff --git a/src/preferences/models.rs b/src/preferences/models.rs
index e980805..dee84e6 100644
--- a/src/preferences/models.rs
+++ b/src/preferences/models.rs
@@ -1,17 +1,18 @@
-// Copyright (C) 2024 Rubén Beltrán del Río
+// Map, wardley map editor for linux
+// Copyright (C) 2026 Rubén Beltrán del Río
// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
+// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
+// GNU Affero General Public License for more details.
-// You should have received a copy of the GNU General Public License
-// along with this program. If not, see https://map.tranquil.systems.
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
use serde::{Deserialize, Serialize};
use uuid::Uuid;
diff --git a/src/preferences/pages/editor.rs b/src/preferences/pages/editor.rs
index 5334a37..9f10d43 100644
--- a/src/preferences/pages/editor.rs
+++ b/src/preferences/pages/editor.rs
@@ -1,22 +1,25 @@
-// Copyright (C) 2024 Rubén Beltrán del Río
+// Map, wardley map editor for linux
+// Copyright (C) 2026 Rubén Beltrán del Río
// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
+// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
+// GNU Affero General Public License for more details.
-// You should have received a copy of the GNU General Public License
-// along with this program. If not, see https://map.tranquil.systems.
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
use gtk::prelude::*;
use relm4::Sender;
use relm4::gtk;
+use crate::ui_helpers::create_switch_row;
+
use super::super::models::UserPreferences;
use super::super::window::PreferencesInput;
@@ -29,7 +32,7 @@ pub struct EditorPage {
}
impl EditorPage {
- pub fn new(prefs: &UserPreferences, sender: Sender<PreferencesInput>) -> Self {
+ pub fn new(preferences: &UserPreferences, sender: Sender<PreferencesInput>) -> Self {
let container = gtk::Box::new(gtk::Orientation::Vertical, 20);
container.set_margin_top(20);
container.set_margin_bottom(20);
@@ -45,7 +48,7 @@ impl EditorPage {
let font_size_box = gtk::Box::new(gtk::Orientation::Horizontal, 10);
let font_size_spin = gtk::SpinButton::with_range(7.0, 21.0, 1.0);
- font_size_spin.set_value(prefs.editor_font_size);
+ font_size_spin.set_value(preferences.editor_font_size);
{
let sender = sender.clone();
font_size_spin.connect_value_changed(move |spin| {
@@ -64,7 +67,7 @@ impl EditorPage {
container.append(&style_label);
// Soft Wrap Lines
- let soft_wrap_row = create_switch_row("Soft Wrap Lines", prefs.soft_wrap_lines);
+ let soft_wrap_row = create_switch_row("Soft Wrap Lines", preferences.soft_wrap_lines);
let soft_wrap_switch = soft_wrap_row.1.clone();
{
let sender = sender.clone();
@@ -77,7 +80,7 @@ impl EditorPage {
// Use Custom Font
let custom_font_row =
- create_switch_row("Use Custom Editor Font", prefs.use_custom_editor_font);
+ create_switch_row("Use Custom Editor Font", preferences.use_custom_editor_font);
let custom_font_switch = custom_font_row.1.clone();
container.append(&custom_font_row.0);
@@ -88,15 +91,15 @@ impl EditorPage {
let font_button = gtk::FontButton::new();
font_button.set_font(&format!(
"{} {}",
- prefs.custom_editor_font_name, prefs.editor_font_size as i32
+ preferences.custom_editor_font_name, preferences.editor_font_size as i32
));
- font_button.set_sensitive(prefs.use_custom_editor_font);
+ font_button.set_sensitive(preferences.use_custom_editor_font);
font_button.set_hexpand(true);
font_button.set_use_font(true);
{
let sender = sender.clone();
- font_button.connect_font_set(move |btn| {
- if let Some(font) = btn.font() {
+ font_button.connect_font_set(move |button| {
+ if let Some(font) = button.font() {
// Extract font family from the font string
let font_desc = gtk::pango::FontDescription::from_string(&font);
if let Some(family) = font_desc.family() {
@@ -134,30 +137,17 @@ impl EditorPage {
self.container.clone()
}
- pub fn sync_from(&self, prefs: &UserPreferences) {
- self.font_size_spin.set_value(prefs.editor_font_size);
- self.soft_wrap_switch.set_active(prefs.soft_wrap_lines);
+ pub fn sync_from(&self, preferences: &UserPreferences) {
+ self.font_size_spin.set_value(preferences.editor_font_size);
+ self.soft_wrap_switch.set_active(preferences.soft_wrap_lines);
self.custom_font_switch
- .set_active(prefs.use_custom_editor_font);
- self.font_button.set_sensitive(prefs.use_custom_editor_font);
+ .set_active(preferences.use_custom_editor_font);
+ self.font_button
+ .set_sensitive(preferences.use_custom_editor_font);
self.font_button.set_font(&format!(
"{} {}",
- prefs.custom_editor_font_name, prefs.editor_font_size as i32
+ preferences.custom_editor_font_name, preferences.editor_font_size as i32
));
}
}
-fn create_switch_row(label: &str, initial_state: bool) -> (gtk::Box, gtk::Switch) {
- let row = gtk::Box::new(gtk::Orientation::Horizontal, 10);
- row.append(&gtk::Label::new(Some(label)));
-
- let spacer = gtk::Box::new(gtk::Orientation::Horizontal, 0);
- spacer.set_hexpand(true);
- row.append(&spacer);
-
- let switch = gtk::Switch::new();
- switch.set_active(initial_state);
- row.append(&switch);
-
- (row, switch)
-}
diff --git a/src/preferences/pages/general.rs b/src/preferences/pages/general.rs
index 9c71bd4..43cd784 100644
--- a/src/preferences/pages/general.rs
+++ b/src/preferences/pages/general.rs
@@ -1,17 +1,18 @@
-// Copyright (C) 2024 Rubén Beltrán del Río
+// Map, wardley map editor for linux
+// Copyright (C) 2026 Rubén Beltrán del Río
// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
+// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
+// GNU Affero General Public License for more details.
-// You should have received a copy of the GNU General Public License
-// along with this program. If not, see https://map.tranquil.systems.
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
use gtk::FileFilter;
use gtk::prelude::*;
diff --git a/src/preferences/pages/map.rs b/src/preferences/pages/map.rs
index f3537c0..8deae20 100644
--- a/src/preferences/pages/map.rs
+++ b/src/preferences/pages/map.rs
@@ -1,22 +1,25 @@
-// Copyright (C) 2024 Rubén Beltrán del Río
+// Map, wardley map editor for linux
+// Copyright (C) 2026 Rubén Beltrán del Río
// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
+// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
+// GNU Affero General Public License for more details.
-// You should have received a copy of the GNU General Public License
-// along with this program. If not, see https://map.tranquil.systems.
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
use gtk::prelude::*;
use relm4::Sender;
use relm4::gtk;
+use crate::ui_helpers::create_switch_row;
+
use super::super::models::UserPreferences;
use super::super::window::PreferencesInput;
@@ -30,7 +33,7 @@ pub struct MapPage {
}
impl MapPage {
- pub fn new(prefs: &UserPreferences, sender: Sender<PreferencesInput>) -> Self {
+ pub fn new(preferences: &UserPreferences, sender: Sender<PreferencesInput>) -> Self {
let container = gtk::Box::new(gtk::Orientation::Vertical, 20);
container.set_margin_top(20);
container.set_margin_bottom(20);
@@ -45,8 +48,9 @@ impl MapPage {
container.append(&style_label);
// Show Background
- let bg_row = create_switch_row("Show Map Background", prefs.show_map_background);
- let show_background_switch = bg_row.1.clone();
+ let background_row =
+ create_switch_row("Show Map Background", preferences.show_map_background);
+ let show_background_switch = background_row.1.clone();
{
let sender = sender.clone();
show_background_switch.connect_state_set(move |_, state| {
@@ -54,12 +58,12 @@ impl MapPage {
gtk::glib::Propagation::Proceed
});
}
- container.append(&bg_row.0);
+ container.append(&background_row.0);
// Smart Label Positioning
let smart_row = create_switch_row(
"Use Smart Label Positioning",
- prefs.use_smart_label_positioning,
+ preferences.use_smart_label_positioning,
);
let smart_positioning_switch = smart_row.1.clone();
{
@@ -72,7 +76,7 @@ impl MapPage {
container.append(&smart_row.0);
// Use Custom Font
- let custom_font_row = create_switch_row("Use Custom Font", prefs.use_custom_font);
+ let custom_font_row = create_switch_row("Use Custom Font", preferences.use_custom_font);
let custom_font_switch = custom_font_row.1.clone();
container.append(&custom_font_row.0);
@@ -81,14 +85,14 @@ impl MapPage {
font_row.append(&gtk::Label::new(Some("Font")));
let font_button = gtk::FontButton::new();
- font_button.set_font(&prefs.custom_font_name);
- font_button.set_sensitive(prefs.use_custom_font);
+ font_button.set_font(&preferences.custom_font_name);
+ font_button.set_sensitive(preferences.use_custom_font);
font_button.set_hexpand(true);
font_button.set_use_font(true);
{
let sender = sender.clone();
- font_button.connect_font_set(move |btn| {
- if let Some(font) = btn.font() {
+ font_button.connect_font_set(move |button| {
+ if let Some(font) = button.font() {
let font_desc = gtk::pango::FontDescription::from_string(&font);
if let Some(family) = font_desc.family() {
sender.emit(PreferencesInput::SetCustomFontName(family.to_string()));
@@ -122,7 +126,7 @@ impl MapPage {
let formats = gtk::StringList::new(&["PNG", "SVG"]);
let export_format_dropdown = gtk::DropDown::new(Some(formats), None::<gtk::Expression>);
- let selected = match prefs.default_export_format.as_str() {
+ let selected = match preferences.default_export_format.as_str() {
"svg" => 1,
_ => 0,
};
@@ -154,16 +158,17 @@ impl MapPage {
self.container.clone()
}
- pub fn sync_from(&self, prefs: &UserPreferences) {
+ pub fn sync_from(&self, preferences: &UserPreferences) {
self.show_background_switch
- .set_active(prefs.show_map_background);
+ .set_active(preferences.show_map_background);
self.smart_positioning_switch
- .set_active(prefs.use_smart_label_positioning);
- self.custom_font_switch.set_active(prefs.use_custom_font);
- self.font_button.set_sensitive(prefs.use_custom_font);
- self.font_button.set_font(&prefs.custom_font_name);
+ .set_active(preferences.use_smart_label_positioning);
+ self.custom_font_switch
+ .set_active(preferences.use_custom_font);
+ self.font_button.set_sensitive(preferences.use_custom_font);
+ self.font_button.set_font(&preferences.custom_font_name);
- let selected = match prefs.default_export_format.as_str() {
+ let selected = match preferences.default_export_format.as_str() {
"svg" => 1,
_ => 0,
};
@@ -171,17 +176,3 @@ impl MapPage {
}
}
-fn create_switch_row(label: &str, initial_state: bool) -> (gtk::Box, gtk::Switch) {
- let row = gtk::Box::new(gtk::Orientation::Horizontal, 10);
- row.append(&gtk::Label::new(Some(label)));
-
- let spacer = gtk::Box::new(gtk::Orientation::Horizontal, 0);
- spacer.set_hexpand(true);
- row.append(&spacer);
-
- let switch = gtk::Switch::new();
- switch.set_active(initial_state);
- row.append(&switch);
-
- (row, switch)
-}
diff --git a/src/preferences/pages/mod.rs b/src/preferences/pages/mod.rs
index 3d2db71..2ace921 100644
--- a/src/preferences/pages/mod.rs
+++ b/src/preferences/pages/mod.rs
@@ -1,17 +1,18 @@
-// Copyright (C) 2024 Rubén Beltrán del Río
+// Map, wardley map editor for linux
+// Copyright (C) 2026 Rubén Beltrán del Río
// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
+// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
+// GNU Affero General Public License for more details.
-// You should have received a copy of the GNU General Public License
-// along with this program. If not, see https://map.tranquil.systems.
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
pub mod editor;
pub mod general;
diff --git a/src/preferences/pages/stages.rs b/src/preferences/pages/stages.rs
index c002bdb..6f4121e 100644
--- a/src/preferences/pages/stages.rs
+++ b/src/preferences/pages/stages.rs
@@ -1,17 +1,18 @@
-// Copyright (C) 2024 Rubén Beltrán del Río
+// Map, wardley map editor for linux
+// Copyright (C) 2026 Rubén Beltrán del Río
// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
+// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
+// GNU Affero General Public License for more details.
-// You should have received a copy of the GNU General Public License
-// along with this program. If not, see https://map.tranquil.systems.
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
use gtk::prelude::*;
use relm4::Sender;
@@ -28,7 +29,7 @@ pub struct StagesPage {
}
impl StagesPage {
- pub fn new(prefs: &UserPreferences, sender: Sender<PreferencesInput>) -> Self {
+ pub fn new(preferences: &UserPreferences, sender: Sender<PreferencesInput>) -> Self {
let container = gtk::Box::new(gtk::Orientation::Vertical, 10);
container.set_margin_top(20);
container.set_margin_bottom(20);
@@ -119,7 +120,7 @@ impl StagesPage {
sender,
};
- page.populate_stages(prefs);
+ page.populate_stages(preferences);
page
}
@@ -127,16 +128,16 @@ impl StagesPage {
self.container.clone()
}
- pub fn refresh(&self, prefs: &UserPreferences) {
+ pub fn refresh(&self, preferences: &UserPreferences) {
// Clear existing rows
while let Some(child) = self.list_box.first_child() {
self.list_box.remove(&child);
}
- self.populate_stages(prefs);
+ self.populate_stages(preferences);
}
- fn populate_stages(&self, prefs: &UserPreferences) {
- for stage in &prefs.custom_stages {
+ fn populate_stages(&self, preferences: &UserPreferences) {
+ for stage in &preferences.custom_stages {
let row = self.create_stage_row(stage.id, &stage.name, &stage.stage);
self.list_box.append(&row);
}
diff --git a/src/preferences/pages/templates.rs b/src/preferences/pages/templates.rs
index 2611896..da3cafc 100644
--- a/src/preferences/pages/templates.rs
+++ b/src/preferences/pages/templates.rs
@@ -1,17 +1,18 @@
-// Copyright (C) 2024 Rubén Beltrán del Río
+// Map, wardley map editor for linux
+// Copyright (C) 2026 Rubén Beltrán del Río
// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
+// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
+// GNU Affero General Public License for more details.
-// You should have received a copy of the GNU General Public License
-// along with this program. If not, see https://map.tranquil.systems.
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
use std::cell::RefCell;
use std::rc::Rc;
diff --git a/src/preferences/storage.rs b/src/preferences/storage.rs
index 83db786..b61266b 100644
--- a/src/preferences/storage.rs
+++ b/src/preferences/storage.rs
@@ -1,17 +1,18 @@
-// Copyright (C) 2024 Rubén Beltrán del Río
+// Map, wardley map editor for linux
+// Copyright (C) 2026 Rubén Beltrán del Río
// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
+// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
+// GNU Affero General Public License for more details.
-// You should have received a copy of the GNU General Public License
-// along with this program. If not, see https://map.tranquil.systems.
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
use std::fs;
use std::path::PathBuf;
@@ -47,30 +48,30 @@ pub fn load() -> UserPreferences {
}
/// Saves preferences to disk
-pub fn save(prefs: &UserPreferences) -> Result<(), std::io::Error> {
+pub fn save(preferences: &UserPreferences) -> Result<(), std::io::Error> {
let path = preferences_path();
if let Some(parent) = path.parent() {
fs::create_dir_all(parent)?;
}
- let content = serde_json::to_string_pretty(prefs).map_err(std::io::Error::other)?;
+ let content = serde_json::to_string_pretty(preferences).map_err(std::io::Error::other)?;
fs::write(path, content)
}
/// Exports preferences to JSON string (for file export)
-pub fn export_json(prefs: &UserPreferences) -> Option<String> {
- let json_prefs = prefs.to_json();
- serde_json::to_string_pretty(&json_prefs).ok()
+pub fn export_json(preferences: &UserPreferences) -> Option<String> {
+ let json_preferences = preferences.to_json();
+ serde_json::to_string_pretty(&json_preferences).ok()
}
/// Imports preferences from JSON string (partial updates supported)
/// Returns true on success, false on parse error
-pub fn import_json(prefs: &mut UserPreferences, json: &str) -> bool {
+pub fn import_json(preferences: &mut UserPreferences, json: &str) -> bool {
match serde_json::from_str::<UserPreferencesJson>(json) {
Ok(imported) => {
- prefs.update_from_json(&imported);
+ preferences.update_from_json(&imported);
true
}
Err(_) => false,
@@ -78,16 +79,19 @@ pub fn import_json(prefs: &mut UserPreferences, json: &str) -> bool {
}
/// Saves preferences to a specific file path (for export dialog)
-pub fn export_to_file(prefs: &UserPreferences, path: &PathBuf) -> Result<(), std::io::Error> {
+pub fn export_to_file(preferences: &UserPreferences, path: &PathBuf) -> Result<(), std::io::Error> {
let content =
- export_json(prefs).ok_or_else(|| std::io::Error::other("Serialization failed"))?;
+ export_json(preferences).ok_or_else(|| std::io::Error::other("Serialization failed"))?;
fs::write(path, content)
}
/// Loads preferences from a specific file path (for import dialog)
-pub fn import_from_file(prefs: &mut UserPreferences, path: &PathBuf) -> Result<(), std::io::Error> {
+pub fn import_from_file(
+ preferences: &mut UserPreferences,
+ path: &PathBuf,
+) -> Result<(), std::io::Error> {
let content = fs::read_to_string(path)?;
- if import_json(prefs, &content) {
+ if import_json(preferences, &content) {
Ok(())
} else {
Err(std::io::Error::new(
diff --git a/src/preferences/window.rs b/src/preferences/window.rs
index 7daa926..8b38c29 100644
--- a/src/preferences/window.rs
+++ b/src/preferences/window.rs
@@ -1,20 +1,21 @@
-// Copyright (C) 2024 Rubén Beltrán del Río
-
-// Suppress warnings from relm4 view! macro internals
-#![allow(unused_assignments)]
+// Map, wardley map editor for linux
+// Copyright (C) 2026 Rubén Beltrán del Río
// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
+// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
+// GNU Affero General Public License for more details.
-// You should have received a copy of the GNU General Public License
-// along with this program. If not, see https://map.tranquil.systems.
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+// Suppress warnings from relm4 view! macro internals
+#![allow(unused_assignments)]
use std::path::PathBuf;
@@ -137,18 +138,19 @@ impl SimpleComponent for PreferencesWindow {
}
fn init(
- prefs: Self::Init,
+ preferences: Self::Init,
root: Self::Root,
sender: ComponentSender<Self>,
) -> ComponentParts<Self> {
let general_page = general::GeneralPage::new(sender.input_sender().clone());
- let editor_page = editor::EditorPage::new(&prefs, sender.input_sender().clone());
- let map_page = map::MapPage::new(&prefs, sender.input_sender().clone());
- let stages_page = stages::StagesPage::new(&prefs, sender.input_sender().clone());
- let templates_page = templates::TemplatesPage::new(&prefs, sender.input_sender().clone());
+ let editor_page = editor::EditorPage::new(&preferences, sender.input_sender().clone());
+ let map_page = map::MapPage::new(&preferences, sender.input_sender().clone());
+ let stages_page = stages::StagesPage::new(&preferences, sender.input_sender().clone());
+ let templates_page =
+ templates::TemplatesPage::new(&preferences, sender.input_sender().clone());
let model = PreferencesWindow {
- preferences: prefs,
+ preferences,
window: root.clone(),
general_page,
editor_page,
diff --git a/src/stages.rs b/src/stages.rs
index 278cd92..fba86b3 100644
--- a/src/stages.rs
+++ b/src/stages.rs
@@ -1,3 +1,19 @@
+// Map, wardley map editor for linux
+// Copyright (C) 2026 Rubén Beltrán del Río
+
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
use wmap_renderer::StageType;
/// All available stage types for rendering Wardley Maps.
diff --git a/src/ui_helpers.rs b/src/ui_helpers.rs
new file mode 100644
index 0000000..6737c62
--- /dev/null
+++ b/src/ui_helpers.rs
@@ -0,0 +1,34 @@
+// Map, wardley map editor for linux
+// Copyright (C) 2026 Rubén Beltrán del Río
+
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+use gtk::prelude::*;
+use relm4::gtk;
+
+/// Creates a horizontal row with a label on the left and a switch on the right.
+pub fn create_switch_row(label: &str, initial_state: bool) -> (gtk::Box, gtk::Switch) {
+ let row = gtk::Box::new(gtk::Orientation::Horizontal, 10);
+ row.append(&gtk::Label::new(Some(label)));
+
+ let spacer = gtk::Box::new(gtk::Orientation::Horizontal, 0);
+ spacer.set_hexpand(true);
+ row.append(&spacer);
+
+ let switch = gtk::Switch::new();
+ switch.set_active(initial_state);
+ row.append(&switch);
+
+ (row, switch)
+}