Skip to content

Interactive 2D wave optics simulator. Turn any image into a refractive scene, add sources, watch waves refract, diffract and interfere. Probes, intensity maps, video export.

C#

The scene image: rows for an image scene only, an X that removes it, a missing file named

Alexander Graef39b9f775438e
diff --git a/CLAUDE.md b/CLAUDE.md
index 7e05391..a7eb414 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -227,7 +227,10 @@ FrameStore: native memory up to the budget, the rest in a temp file (%LOCALAPPDA
above 8 bits per channel is a possible future goal). A better algorithm than Bayer may come later.
- **Colour schemes** are stop lists in `.wdscheme` XML, shipped ones embedded, user ones in
`%LOCALAPPDATA%\WaveDudeNext\ColorSchemes`, project ones in the `.wdproj`; an in-house picker edits stops;
- renaming a project scheme repoints its layers. **The scene image** is embedded and follows its file on disk;
+ renaming a project scheme repoints its layers. **The scene image** is embedded and follows its file on disk, the
+ path being where it came from (2026-10-26, Jeroen's report: the scene form shows the image rows for an image scene
+ only, says "(not found)" beside a path whose file is gone, which changes nothing, and has an X beside Browse, which
+ drops the name, the path and the bytes and leaves a blank canvas of the image's size);
the "glowing edges" outline overlays the pictures. **Import** of Jeroen's `configuration.json` is key for key; a source whose position was
never picked (`has_position` false) stays enabled at its x/y, since his program simulated it there (Example 11's
lattice came in disabled and ran black until 2026-10-16).
diff --git a/WaveDudeNext.WPF/Commands/ProjectCommands.cs b/WaveDudeNext.WPF/Commands/ProjectCommands.cs
index ec34929..bfe1eb5 100644
--- a/WaveDudeNext.WPF/Commands/ProjectCommands.cs
+++ b/WaveDudeNext.WPF/Commands/ProjectCommands.cs
@@ -61,4 +61,7 @@ public static class ProjectCommands
/// <summary>Picks an image file and embeds it as the scene image.</summary>
public static readonly RoutedUICommand BrowseSceneImage = new("Browse for a scene image", nameof(BrowseSceneImage), typeof(ProjectCommands));
+
+ /// <summary>Drops the scene image: a blank canvas of the image's size remains (2026-10-26, Jeroen's report: there was no way).</summary>
+ public static readonly RoutedUICommand RemoveSceneImage = new("Remove the scene image", nameof(RemoveSceneImage), typeof(ProjectCommands));
}
diff --git a/WaveDudeNext.WPF/MainWindow.Project.cs b/WaveDudeNext.WPF/MainWindow.Project.cs
index 22ba6f4..0b1491f 100644
--- a/WaveDudeNext.WPF/MainWindow.Project.cs
+++ b/WaveDudeNext.WPF/MainWindow.Project.cs
@@ -355,4 +355,32 @@ public partial class MainWindow
Logger.Error(ex, "The image could not be loaded: {Message}", ex.Message);
}
}
+
+ private void CanRemoveSceneImage(object sender, CanExecuteRoutedEventArgs e) =>
+ e.CanExecute = Project.Scene is { } scene && (scene.ImageData != null || scene.Image.Length > 0 || scene.ImagePath.Length > 0);
+
+ /// <summary>
+ /// Remove beside Browse (2026-10-26, Jeroen's report: there was no way to drop an image): the canvas takes the image's
+ /// size, so nothing moves, then the scene drops the name, the path and the embedded bytes and is a blank canvas. The
+ /// watcher treats it like any scene edit, one undo step.
+ /// </summary>
+ private void OnRemoveSceneImage(object sender, ExecutedRoutedEventArgs e)
+ {
+ Scene scene = Project.Scene;
+ if (scene.ImageData != null)
+ {
+ try
+ {
+ ScenePixels pixels = SceneImageLoader.Load(scene.ImageData);
+ scene.Width = pixels.Width;
+ scene.Height = pixels.Height;
+ }
+ catch (Exception ex) when (ex is NotSupportedException or FileFormatException or IOException)
+ {
+ Logger.Debug("The embedded image could not be decoded for its size; the canvas keeps {Width}×{Height}: {Message}", scene.Width, scene.Height, ex.Message);
+ }
+ }
+ scene.RemoveImage();
+ Logger.Info("Scene image removed: a blank canvas of {Width}×{Height}", scene.Width, scene.Height);
+ }
}
diff --git a/WaveDudeNext.WPF/MainWindow.SceneImageWatch.cs b/WaveDudeNext.WPF/MainWindow.SceneImageWatch.cs
index 77c96f2..4176749 100644
--- a/WaveDudeNext.WPF/MainWindow.SceneImageWatch.cs
+++ b/WaveDudeNext.WPF/MainWindow.SceneImageWatch.cs
@@ -16,6 +16,7 @@
// <https://www.gnu.org/licenses/>.
using System.IO;
+using System.Windows;
using System.Windows.Threading;
using WaveDudeNext.Model;
using WaveDudeNext.Runs;
@@ -29,11 +30,17 @@ namespace WaveDudeNext.WPF;
/// on disk (debounced, read again while the editor still holds it), and when a project is opened the file is
/// compared with the embedded bytes once and taken instead when it differs. Either way the change goes
/// through the model, so it marks the project dirty, makes the run stale and asks the scratch runner for the
-/// frame, like a scene edit. The embedded bytes are the baseline, so "changed" is a byte comparison; no hash.
-/// UI thread; the watcher's events are marshalled to it.
+/// frame, like a scene edit. The embedded bytes are the baseline, so "changed" is a byte comparison; no hash. A file
+/// that is gone changes nothing but is reported (<see cref="SceneImageFileMissing"/>, 2026-10-26, Jeroen's report: a
+/// deleted file still showed its path, which is right, but nothing said so). UI thread; the watcher's events are
+/// marshalled to it.
/// </summary>
public partial class MainWindow
{
+ /// <summary>Identifies the <see cref="SceneImageFileMissing"/> property.</summary>
+ public static readonly DependencyProperty SceneImageFileMissingProperty = DependencyProperty.Register(
+ nameof(SceneImageFileMissing), typeof(bool), typeof(MainWindow), new PropertyMetadata(false));
+
/// <summary>How long after the last file event the image is read: editors write in several steps.</summary>
private static readonly TimeSpan SceneImageDebounce = TimeSpan.FromMilliseconds(400);
@@ -43,6 +50,17 @@ public partial class MainWindow
/// <summary>Folders beside the project file where a project without a path may find its image by name: the folder itself and the author's layout.</summary>
private static readonly string[] SceneImageFolders = ["", "scene_images"];
+ /// <summary>
+ /// Whether the scene's image file (<see cref="Scene.ImagePath"/>) is named but not on disk: the scene form says so beside
+ /// the path. The embedded image is what is simulated, so nothing else follows. An unsaved project with a relative path
+ /// cannot tell and says no. Kept up to date by the watch.
+ /// </summary>
+ public bool SceneImageFileMissing
+ {
+ get => (bool)GetValue(SceneImageFileMissingProperty);
+ private set => SetValue(SceneImageFileMissingProperty, value);
+ }
+
/// <summary>Arms the watch on the current scene image file (after a project, path or file name change) and takes the file at once when it differs from the embedded image.</summary>
private void SyncSceneImage(string reason)
{
@@ -82,6 +100,7 @@ public partial class MainWindow
DisarmSceneImageWatch();
Scene scene = Project.Scene;
string path = scene.ResolveImagePath(ProjectFolder);
+ SceneImageFileMissing = IsSceneImageFileMissing();
if (path.Length == 0 || scene.ImageData == null)
{
return;
@@ -100,6 +119,7 @@ public partial class MainWindow
_sceneImageWatcher.Changed += OnSceneImageFileEvent;
_sceneImageWatcher.Created += OnSceneImageFileEvent;
_sceneImageWatcher.Renamed += OnSceneImageFileEvent;
+ _sceneImageWatcher.Deleted += OnSceneImageFileEvent;
_sceneImageWatcher.EnableRaisingEvents = true;
Logger.Debug("Watching the scene image file '{Path}'", path);
}
@@ -121,18 +141,27 @@ public partial class MainWindow
}
}
- /// <summary>A file event (on the watcher's thread): restarts the debounce on the UI thread.</summary>
+ /// <summary>A file event (on the watcher's thread): restarts the debounce on the UI thread; the file is then read again, or found gone.</summary>
private void OnSceneImageFileEvent(object sender, FileSystemEventArgs e) => Dispatcher.BeginInvoke(() =>
{
_sceneImageTimer ??= MakeTimer(SceneImageDebounce, () =>
{
_sceneImageTimer!.Stop();
ReloadSceneImageIfChanged("changed on disk");
+ SceneImageFileMissing = IsSceneImageFileMissing();
});
_sceneImageTimer.Stop();
_sceneImageTimer.Start();
});
+ /// <summary>Whether the scene names an image file that is not on disk (see <see cref="SceneImageFileMissing"/>).</summary>
+ private bool IsSceneImageFileMissing()
+ {
+ Scene scene = Project.Scene;
+ string path = scene.ResolveImagePath(ProjectFolder);
+ return path.Length > 0 && scene.ImageData != null && !File.Exists(path);
+ }
+
/// <summary>
/// Reads the scene image's source file and embeds it when its bytes differ from the embedded ones; a file
/// that is not an image is reported and left alone. True when the image was replaced.
diff --git a/WaveDudeNext.WPF/MainWindow.xaml b/WaveDudeNext.WPF/MainWindow.xaml
index 69ce2ac..ce522dd 100644
--- a/WaveDudeNext.WPF/MainWindow.xaml
+++ b/WaveDudeNext.WPF/MainWindow.xaml
@@ -206,6 +206,7 @@ version. It is distributed WITHOUT ANY WARRANTY. See the LICENSE.md file or
<CommandBinding Command="{x:Static commands:ProjectCommands.SelectAll}" CanExecute="CanSelectAll" Executed="OnSelectAll" />
<CommandBinding Command="{x:Static commands:ProjectCommands.ToggleSelected}" CanExecute="CanToggleSelected" Executed="OnToggleSelected" />
<CommandBinding Command="{x:Static commands:ProjectCommands.BrowseSceneImage}" Executed="OnBrowseSceneImage" />
+ <CommandBinding Command="{x:Static commands:ProjectCommands.RemoveSceneImage}" CanExecute="CanRemoveSceneImage" Executed="OnRemoveSceneImage" />
<CommandBinding Command="{x:Static commands:HelpCommands.About}" Executed="OnHelpAbout" />
</Window.CommandBindings>
diff --git a/WaveDudeNext.WPF/Strings/Strings.DE.xaml b/WaveDudeNext.WPF/Strings/Strings.DE.xaml
index 442405e..2cbaf73 100644
--- a/WaveDudeNext.WPF/Strings/Strings.DE.xaml
+++ b/WaveDudeNext.WPF/Strings/Strings.DE.xaml
@@ -332,6 +332,8 @@ version. It is distributed WITHOUT ANY WARRANTY. See the LICENSE.md file or
<s:String x:Key="ButtonBrowse">Durchsuchen…</s:String>
<s:String x:Key="TipBrowseSceneImage">Bilddatei wählen; sie wird in das Projekt eingebettet</s:String>
+ <s:String x:Key="TipRemoveSceneImage">Eingebettetes Bild und Dateipfad verwerfen; die Leinwand behält die Bildgröße</s:String>
+ <s:String x:Key="SceneImageNotFound">(nicht gefunden)</s:String>
<s:String x:Key="LabelEmbeddedImage">Eingebettetes Bild</s:String>
<s:String x:Key="TipEmbeddedImage">Größe des eingebetteten Szenenbilds; die Leinwand übernimmt diese Größe</s:String>
<s:String x:Key="SceneImageFilter">Bilder (*.png;*.bmp;*.jpg;*.jpeg;*.tif;*.tiff;*.gif)|*.png;*.bmp;*.jpg;*.jpeg;*.tif;*.tiff;*.gif|Alle Dateien (*.*)|*.*</s:String>
@@ -454,7 +456,7 @@ version. It is distributed WITHOUT ANY WARRANTY. See the LICENSE.md file or
<s:String x:Key="Label.Scene.Image">Szenenbild</s:String>
<s:String x:Key="Hint.Scene.Image">Bild, aus dem die Leinwand gebaut wird: Rot = Brechungsindex (Rot 0 = ein Spiegel), Grün = Quellen, Blau = Dämpfung. Der Name des eingebetteten Bilds oder ein Pfad relativ zum Projektordner.</s:String>
<s:String x:Key="Label.Scene.ImagePath">Bilddatei</s:String>
- <s:String x:Key="Hint.Scene.ImagePath">Herkunft des eingebetteten Bilds. Die Datei wird beobachtet, solange das Projekt offen ist, und bei Änderung neu eingebettet; beim Öffnen des Projekts ersetzt eine geänderte Datei das eingebettete Bild ebenfalls.</s:String>
+ <s:String x:Key="Hint.Scene.ImagePath">Herkunft des eingebetteten Bilds; simuliert wird das eingebettete Bild, eine fehlende Datei ändert nichts. Die Datei wird beobachtet, solange das Projekt offen ist, und bei Änderung neu eingebettet; beim Öffnen des Projekts ersetzt eine geänderte Datei das eingebettete Bild ebenfalls.</s:String>
<s:String x:Key="Label.Scene.Width">Breite</s:String>
<s:String x:Key="Hint.Scene.Width">Breite einer leeren Leinwand in Pixeln.</s:String>
<s:String x:Key="Label.Scene.Height">Höhe</s:String>
diff --git a/WaveDudeNext.WPF/Strings/Strings.EN.xaml b/WaveDudeNext.WPF/Strings/Strings.EN.xaml
index 320b455..a7e7428 100644
--- a/WaveDudeNext.WPF/Strings/Strings.EN.xaml
+++ b/WaveDudeNext.WPF/Strings/Strings.EN.xaml
@@ -334,6 +334,8 @@ version. It is distributed WITHOUT ANY WARRANTY. See the LICENSE.md file or
<s:String x:Key="ButtonBrowse">Browse…</s:String>
<s:String x:Key="TipBrowseSceneImage">Pick an image file; it is embedded in the project</s:String>
+ <s:String x:Key="TipRemoveSceneImage">Drop the embedded image and its file path; the canvas keeps the image's size</s:String>
+ <s:String x:Key="SceneImageNotFound">(not found)</s:String>
<s:String x:Key="LabelEmbeddedImage">Embedded image</s:String>
<s:String x:Key="TipEmbeddedImage">Size of the embedded scene image; the canvas takes this size</s:String>
<s:String x:Key="SceneImageFilter">Images (*.png;*.bmp;*.jpg;*.jpeg;*.tif;*.tiff;*.gif)|*.png;*.bmp;*.jpg;*.jpeg;*.tif;*.tiff;*.gif|All files (*.*)|*.*</s:String>
@@ -456,7 +458,7 @@ version. It is distributed WITHOUT ANY WARRANTY. See the LICENSE.md file or
<s:String x:Key="Label.Scene.Image">Scene image</s:String>
<s:String x:Key="Hint.Scene.Image">Image the canvas is built from: red = refractive index (red 0 = a mirror), green = sources, blue = damping. The name of the embedded image, or a path relative to the project folder.</s:String>
<s:String x:Key="Label.Scene.ImagePath">Image file</s:String>
- <s:String x:Key="Hint.Scene.ImagePath">Where the embedded image came from. It is watched while the project is open and re-embedded when it changes; on opening the project a changed file replaces the embedded image too.</s:String>
+ <s:String x:Key="Hint.Scene.ImagePath">Where the embedded image came from; the embedded image is what is simulated, a missing file changes nothing. The file is watched while the project is open and re-embedded when it changes; on opening the project a changed file replaces the embedded image too.</s:String>
<s:String x:Key="Label.Scene.Width">Width</s:String>
<s:String x:Key="Hint.Scene.Width">Width of a blank canvas in pixels.</s:String>
<s:String x:Key="Label.Scene.Height">Height</s:String>
diff --git a/WaveDudeNext.WPF/Strings/Strings.FR.xaml b/WaveDudeNext.WPF/Strings/Strings.FR.xaml
index c39ef82..3853847 100644
--- a/WaveDudeNext.WPF/Strings/Strings.FR.xaml
+++ b/WaveDudeNext.WPF/Strings/Strings.FR.xaml
@@ -332,6 +332,8 @@ version. It is distributed WITHOUT ANY WARRANTY. See the LICENSE.md file or
<s:String x:Key="ButtonBrowse">Parcourir…</s:String>
<s:String x:Key="TipBrowseSceneImage">Choisir un fichier image ; il est intégré au projet</s:String>
+ <s:String x:Key="TipRemoveSceneImage">Abandonne l'image intégrée et son chemin ; la toile garde la taille de l'image</s:String>
+ <s:String x:Key="SceneImageNotFound">(introuvable)</s:String>
<s:String x:Key="LabelEmbeddedImage">Image intégrée</s:String>
<s:String x:Key="TipEmbeddedImage">Taille de l'image de scène intégrée ; la toile prend cette taille</s:String>
<s:String x:Key="SceneImageFilter">Images (*.png;*.bmp;*.jpg;*.jpeg;*.tif;*.tiff;*.gif)|*.png;*.bmp;*.jpg;*.jpeg;*.tif;*.tiff;*.gif|Tous les fichiers (*.*)|*.*</s:String>
@@ -454,7 +456,7 @@ version. It is distributed WITHOUT ANY WARRANTY. See the LICENSE.md file or
<s:String x:Key="Label.Scene.Image">Image de scène</s:String>
<s:String x:Key="Hint.Scene.Image">Image dont la toile est construite : rouge = indice de réfraction (rouge 0 = un miroir), vert = sources, bleu = amortissement. Le nom de l'image intégrée, ou un chemin relatif au dossier du projet.</s:String>
<s:String x:Key="Label.Scene.ImagePath">Fichier image</s:String>
- <s:String x:Key="Hint.Scene.ImagePath">Origine de l'image intégrée. Le fichier est surveillé tant que le projet est ouvert et réintégré quand il change ; à l'ouverture du projet, un fichier modifié remplace aussi l'image intégrée.</s:String>
+ <s:String x:Key="Hint.Scene.ImagePath">Origine de l'image intégrée ; c'est l'image intégrée qui est simulée, un fichier manquant ne change rien. Le fichier est surveillé tant que le projet est ouvert et réintégré quand il change ; à l'ouverture du projet, un fichier modifié remplace aussi l'image intégrée.</s:String>
<s:String x:Key="Label.Scene.Width">Largeur</s:String>
<s:String x:Key="Hint.Scene.Width">Largeur d'une toile vierge en pixels.</s:String>
<s:String x:Key="Label.Scene.Height">Hauteur</s:String>
diff --git a/WaveDudeNext.WPF/Strings/Strings.NL.xaml b/WaveDudeNext.WPF/Strings/Strings.NL.xaml
index ab19b74..0a64755 100644
--- a/WaveDudeNext.WPF/Strings/Strings.NL.xaml
+++ b/WaveDudeNext.WPF/Strings/Strings.NL.xaml
@@ -332,6 +332,8 @@ version. It is distributed WITHOUT ANY WARRANTY. See the LICENSE.md file or
<s:String x:Key="ButtonBrowse">Bladeren…</s:String>
<s:String x:Key="TipBrowseSceneImage">Kies een afbeeldingsbestand; het wordt in het project ingebed</s:String>
+ <s:String x:Key="TipRemoveSceneImage">Laat de ingebedde afbeelding en het bestandspad vallen; het canvas houdt de grootte van de afbeelding</s:String>
+ <s:String x:Key="SceneImageNotFound">(niet gevonden)</s:String>
<s:String x:Key="LabelEmbeddedImage">Ingebedde afbeelding</s:String>
<s:String x:Key="TipEmbeddedImage">Grootte van de ingebedde scèneafbeelding; het canvas neemt deze grootte over</s:String>
<s:String x:Key="SceneImageFilter">Afbeeldingen (*.png;*.bmp;*.jpg;*.jpeg;*.tif;*.tiff;*.gif)|*.png;*.bmp;*.jpg;*.jpeg;*.tif;*.tiff;*.gif|Alle bestanden (*.*)|*.*</s:String>
@@ -454,7 +456,7 @@ version. It is distributed WITHOUT ANY WARRANTY. See the LICENSE.md file or
<s:String x:Key="Label.Scene.Image">Scèneafbeelding</s:String>
<s:String x:Key="Hint.Scene.Image">Afbeelding waaruit het canvas wordt opgebouwd: rood = brekingsindex (rood 0 = een spiegel), groen = bronnen, blauw = demping. De naam van de ingebedde afbeelding, of een pad relatief aan de projectmap.</s:String>
<s:String x:Key="Label.Scene.ImagePath">Afbeeldingsbestand</s:String>
- <s:String x:Key="Hint.Scene.ImagePath">Herkomst van de ingebedde afbeelding. Het bestand wordt bewaakt zolang het project open is en opnieuw ingebed als het verandert; bij het openen van het project vervangt een gewijzigd bestand de ingebedde afbeelding ook.</s:String>
+ <s:String x:Key="Hint.Scene.ImagePath">Herkomst van de ingebedde afbeelding; gesimuleerd wordt de ingebedde afbeelding, een ontbrekend bestand verandert niets. Het bestand wordt bewaakt zolang het project open is en opnieuw ingebed als het verandert; bij het openen van het project vervangt een gewijzigd bestand de ingebedde afbeelding ook.</s:String>
<s:String x:Key="Label.Scene.Width">Breedte</s:String>
<s:String x:Key="Hint.Scene.Width">Breedte van een leeg canvas in pixels.</s:String>
<s:String x:Key="Label.Scene.Height">Hoogte</s:String>
diff --git a/WaveDudeNext.WPF/Views/SceneView.xaml b/WaveDudeNext.WPF/Views/SceneView.xaml
index a4a056a..5e677b4 100644
--- a/WaveDudeNext.WPF/Views/SceneView.xaml
+++ b/WaveDudeNext.WPF/Views/SceneView.xaml
@@ -24,11 +24,13 @@ version. It is distributed WITHOUT ANY WARRANTY. See the LICENSE.md file or
xmlns:commands="clr-namespace:WaveDudeNext.WPF.Commands"
xmlns:converters="clr-namespace:WaveDudeNext.WPF.Converters"
xmlns:meta="clr-namespace:WaveDudeNext.WPF.Markup"
+ xmlns:local="clr-namespace:WaveDudeNext.WPF"
xmlns:model="clr-namespace:WaveDudeNext.Model;assembly=WaveDudeNext">
<UserControl.Resources>
<converters:ImageInfoConverter x:Key="ImageInfo" />
- <!-- the size applies to a blank canvas, the image path to an image scene -->
+ <!-- the size applies to a blank canvas; the image rows (name, file, embedded size) show for an image scene and are gone
+ for a canvas (2026-10-26, Jeroen's report: the path of an image no longer in use kept showing) -->
<Style x:Key="CanvasOnly" TargetType="{x:Type controls:NumberBox}" BasedOn="{StaticResource {x:Type controls:NumberBox}}">
<Style.Triggers>
<DataTrigger Binding="{Binding Mode}" Value="Image">
@@ -36,10 +38,17 @@ version. It is distributed WITHOUT ANY WARRANTY. See the LICENSE.md file or
</DataTrigger>
</Style.Triggers>
</Style>
- <Style x:Key="ImageOnly" TargetType="{x:Type TextBox}" BasedOn="{StaticResource {x:Type TextBox}}">
+ <Style x:Key="ImageRow" TargetType="{x:Type FrameworkElement}">
<Style.Triggers>
<DataTrigger Binding="{Binding Mode}" Value="Canvas">
- <Setter Property="IsEnabled" Value="False" />
+ <Setter Property="Visibility" Value="Collapsed" />
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ <Style x:Key="ImageRowLabel" TargetType="{x:Type TextBlock}" BasedOn="{StaticResource FormLabel}">
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding Mode}" Value="Canvas">
+ <Setter Property="Visibility" Value="Collapsed" />
</DataTrigger>
</Style.Triggers>
</Style>
@@ -53,28 +62,43 @@ version. It is distributed WITHOUT ANY WARRANTY. See the LICENSE.md file or
<ComboBox Style="{StaticResource EnumComboBox}" ItemsSource="{meta:EnumValues model:SceneMode}"
SelectedItem="{Binding Mode}" ToolTip="{meta:Hint model:Scene.Mode}" />
- <TextBlock Style="{StaticResource FormLabel}" Text="{meta:Label model:Scene.Image}" />
- <!-- the name of the embedded image (or a legacy path), and the picker that embeds a file -->
- <DockPanel>
+ <TextBlock Style="{StaticResource ImageRowLabel}" Text="{meta:Label model:Scene.Image}" />
+ <!-- the name of the embedded image (or a legacy path), the picker that embeds a file, and the X that removes the image
+ (2026-10-26, Jeroen's report: there was no way to drop one), leaving a blank canvas of the image's size; the X is
+ the panes' close glyph in the button's text colour, so it greys with the button -->
+ <DockPanel Style="{StaticResource ImageRow}">
+ <Button DockPanel.Dock="Right" Margin="4,0,0,0" Padding="7,0" ToolTip="{DynamicResource TipRemoveSceneImage}"
+ AutomationProperties.Name="{DynamicResource TipRemoveSceneImage}" Command="{x:Static commands:ProjectCommands.RemoveSceneImage}"
+ AutomationProperties.AutomationId="SceneRemoveImage">
+ <Path Data="{StaticResource CloseGeometry}" Width="8" Height="8" Stretch="Uniform" Fill="{Binding (TextElement.Foreground), RelativeSource={RelativeSource Self}}" />
+ </Button>
<Button DockPanel.Dock="Right" Margin="4,0,0,0" Padding="8,0" Content="{DynamicResource ButtonBrowse}"
ToolTip="{DynamicResource TipBrowseSceneImage}" Command="{x:Static commands:ProjectCommands.BrowseSceneImage}"
AutomationProperties.AutomationId="SceneBrowse" />
- <TextBox Style="{StaticResource ImageOnly}" Text="{Binding Image, UpdateSourceTrigger=PropertyChanged}" ToolTip="{meta:Hint model:Scene.Image}" />
+ <TextBox Text="{Binding Image, UpdateSourceTrigger=PropertyChanged}" ToolTip="{meta:Hint model:Scene.Image}" />
</DockPanel>
- <TextBlock Style="{StaticResource FormLabel}" Text="{meta:Label model:Scene.ImagePath}" />
- <TextBlock VerticalAlignment="Center" Text="{Binding ImagePath}" TextTrimming="CharacterEllipsis" ToolTip="{meta:Hint model:Scene.ImagePath}"
- AutomationProperties.AutomationId="SceneImagePath" />
+ <TextBlock Style="{StaticResource ImageRowLabel}" Text="{meta:Label model:Scene.ImagePath}" />
+ <!-- the path and, when the file is not on disk, a note (the window checks; the embedded image is what is simulated) -->
+ <DockPanel Style="{StaticResource ImageRow}">
+ <TextBlock DockPanel.Dock="Right" Margin="4,0,0,0" VerticalAlignment="Center" Text="{DynamicResource SceneImageNotFound}"
+ Visibility="{Binding SceneImageFileMissing, RelativeSource={RelativeSource AncestorType={x:Type local:MainWindow}}, Converter={StaticResource BoolToVisibility}}"
+ AutomationProperties.AutomationId="SceneImageNotFound" />
+ <TextBlock VerticalAlignment="Center" Text="{Binding ImagePath}" TextTrimming="CharacterEllipsis" ToolTip="{meta:Hint model:Scene.ImagePath}"
+ AutomationProperties.AutomationId="SceneImagePath" />
+ </DockPanel>
- <TextBlock Style="{StaticResource FormLabel}" Text="{DynamicResource LabelEmbeddedImage}" />
- <TextBlock VerticalAlignment="Center" Text="{Binding ImageData, Converter={StaticResource ImageInfo}}"
- ToolTip="{DynamicResource TipEmbeddedImage}" AutomationProperties.AutomationId="SceneImageInfo" />
+ <TextBlock Style="{StaticResource ImageRowLabel}" Text="{DynamicResource LabelEmbeddedImage}" />
+ <DockPanel Style="{StaticResource ImageRow}">
+ <TextBlock VerticalAlignment="Center" Text="{Binding ImageData, Converter={StaticResource ImageInfo}}"
+ ToolTip="{DynamicResource TipEmbeddedImage}" AutomationProperties.AutomationId="SceneImageInfo" />
+ </DockPanel>
<TextBlock Style="{StaticResource FormLabel}" Text="{meta:Label model:Scene.Width}" />
- <controls:NumberBox Style="{StaticResource CanvasOnly}" Text="{Binding Width}" Minimum="8" Maximum="16384" ToolTip="{meta:Hint model:Scene.Width}" />
+ <controls:NumberBox Style="{StaticResource CanvasOnly}" Text="{Binding Width}" Minimum="8" Maximum="16384" ToolTip="{meta:Hint model:Scene.Width}" AutomationProperties.AutomationId="SceneWidth" />
<TextBlock Style="{StaticResource FormLabel}" Text="{meta:Label model:Scene.Height}" />
- <controls:NumberBox Style="{StaticResource CanvasOnly}" Text="{Binding Height}" Minimum="8" Maximum="16384" ToolTip="{meta:Hint model:Scene.Height}" />
+ <controls:NumberBox Style="{StaticResource CanvasOnly}" Text="{Binding Height}" Minimum="8" Maximum="16384" ToolTip="{meta:Hint model:Scene.Height}" AutomationProperties.AutomationId="SceneHeight" />
<TextBlock Style="{StaticResource FormLabel}" Text="{meta:Label model:Scene.Edges}" />
<ComboBox Style="{StaticResource EnumComboBox}" ItemsSource="{meta:EnumValues model:EdgeMode}"
diff --git a/WaveDudeNext/Model/Scene.cs b/WaveDudeNext/Model/Scene.cs
index d7343a4..d51d099 100644
--- a/WaveDudeNext/Model/Scene.cs
+++ b/WaveDudeNext/Model/Scene.cs
@@ -136,7 +136,7 @@ public sealed class Scene : ObservableObject
[DefaultValue("")]
[Category("Canvas")]
[DisplayName("Image file")]
- [Description("Where the embedded image came from. It is watched while the project is open and re-embedded when it changes; on opening the project a changed file replaces the embedded image too.")]
+ [Description("Where the embedded image came from; the embedded image is what is simulated, a missing file changes nothing. The file is watched while the project is open and re-embedded when it changes; on opening the project a changed file replaces the embedded image too.")]
public string ImagePath
{
get => _imagePath;
@@ -179,6 +179,19 @@ public sealed class Scene : ObservableObject
}
}
+ /// <summary>
+ /// Drops the scene image (2026-10-26, Jeroen's report: there was no way): the name, the file path and the embedded
+ /// bytes go, and the scene is a blank canvas of <see cref="Width"/> × <see cref="Height"/> again (the application sets
+ /// those to the image's size first, so the canvas keeps its size and the sources their places).
+ /// </summary>
+ public void RemoveImage()
+ {
+ Image = "";
+ ImagePath = "";
+ ImageData = null;
+ Mode = SceneMode.Canvas;
+ }
+
/// <summary>Width of a blank canvas in pixels.</summary>
[XmlAttribute]
[DefaultValue(DefaultWidth)]
diff --git a/_tools/library_check/Program.cs b/_tools/library_check/Program.cs
index 8757e4d..d3d53f8 100644
--- a/_tools/library_check/Program.cs
+++ b/_tools/library_check/Program.cs
@@ -2146,6 +2146,10 @@ internal static class Program
var abs = new Scene { ImagePath = Path.Combine(projectFolder, "a.png") };
abs.RelativizeImagePath(projectFolder);
Check(abs.ImagePath == "a.png", "RelativizeImagePath on save");
+ var pictured = new Scene { Mode = SceneMode.Image, Image = "a.png", ImagePath = "a.png", ImageData = [1, 2, 3] };
+ pictured.RemoveImage();
+ Check(pictured.Mode == SceneMode.Canvas && pictured.Image.Length == 0 && pictured.ImagePath.Length == 0 && pictured.ImageData == null && pictured.IsDefault,
+ "RemoveImage drops the name, the path and the bytes and leaves a blank canvas, the default scene");
var edited = loaded.ColorSchemes[0];
int changes = 0;
edited.PropertyChanged += (_, args) => changes += args.PropertyName == nameof(ColorScheme.Stops) ? 1 : 0;