Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/typewriter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ jobs:
-c Release \
-r ${{ matrix.rid }} \
--self-contained true \
-p:PublishSingleFile=true \
-p:IncludeNativeLibrariesForSelfExtract=true \
-p:DebugType=None \
-p:DebugSymbols=false \
-o staging/TypewriterEffect

- name: Rewrite plugin.json for ${{ matrix.os }}
Expand Down
14 changes: 7 additions & 7 deletions se5-plugins.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@
{
"name": "Typewriter effect",
"description": "Splits each subtitle line into short timed parts that progressively reveal the text, character by character.",
"version": "1.0.0",
"version": "1.0.1",
"author": "Subtitle Edit",
"url": "https://github.com/SubtitleEdit/plugins/tree/main/se5/TypewriterEffect",
"date": "2026-05-17",
"minSeVersion": "5.0.0",
"downloads": {
"win-x64": "https://github.com/SubtitleEdit/plugins/releases/download/se5-typewriter-v1.0/TypewriterEffect-win-x64.zip",
"win-arm64": "https://github.com/SubtitleEdit/plugins/releases/download/se5-typewriter-v1.0/TypewriterEffect-win-arm64.zip",
"linux-x64": "https://github.com/SubtitleEdit/plugins/releases/download/se5-typewriter-v1.0/TypewriterEffect-linux-x64.zip",
"linux-arm64": "https://github.com/SubtitleEdit/plugins/releases/download/se5-typewriter-v1.0/TypewriterEffect-linux-arm64.zip",
"osx-x64": "https://github.com/SubtitleEdit/plugins/releases/download/se5-typewriter-v1.0/TypewriterEffect-osx-x64.zip",
"osx-arm64": "https://github.com/SubtitleEdit/plugins/releases/download/se5-typewriter-v1.0/TypewriterEffect-osx-arm64.zip"
"win-x64": "https://github.com/SubtitleEdit/plugins/releases/download/se5-typewriter-v1.0.1/TypewriterEffect-win-x64.zip",
"win-arm64": "https://github.com/SubtitleEdit/plugins/releases/download/se5-typewriter-v1.0.1/TypewriterEffect-win-arm64.zip",
"linux-x64": "https://github.com/SubtitleEdit/plugins/releases/download/se5-typewriter-v1.0.1/TypewriterEffect-linux-x64.zip",
"linux-arm64": "https://github.com/SubtitleEdit/plugins/releases/download/se5-typewriter-v1.0.1/TypewriterEffect-linux-arm64.zip",
"osx-x64": "https://github.com/SubtitleEdit/plugins/releases/download/se5-typewriter-v1.0.1/TypewriterEffect-osx-x64.zip",
"osx-arm64": "https://github.com/SubtitleEdit/plugins/releases/download/se5-typewriter-v1.0.1/TypewriterEffect-osx-arm64.zip"
}
},
{
Expand Down
21 changes: 15 additions & 6 deletions se5/TypewriterEffect/MainWindow.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,39 @@
using Avalonia.Interactivity;
using Avalonia.Markup.Xaml;
using System;
using System.Globalization;
using System.Text.Json;

namespace SubtitleEdit.Plugins.TypewriterEffect;

public partial class MainWindow : Window
{
private readonly PluginRequest _request;
private TextBlock _infoLabel = null!;
private NumericUpDown _endDelayInput = null!;

// Parameterless constructor only exists for the XAML designer.
public MainWindow() : this(new PluginRequest()) { }

public MainWindow(PluginRequest request)
{
InitializeComponent();
_request = request;
InitializeComponent();

var selectedCount = request.SelectedIndices.Count;
InfoLabel.Text = selectedCount > 0
_infoLabel.Text = selectedCount > 0
? $"Each of the {selectedCount} selected line(s) will be split into several short lines that progressively reveal the text."
: "Every line will be split into several short lines that progressively reveal the text.";

EndDelayInput.Value = (decimal)LoadEndDelaySetting(request.Settings, defaultValue: 0.5);
_endDelayInput.Value = (decimal)LoadEndDelaySetting(request.Settings, defaultValue: 0.5);
}

private void InitializeComponent() => AvaloniaXamlLoader.Load(this);
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
_infoLabel = this.FindControl<TextBlock>("InfoLabel")!;
_endDelayInput = this.FindControl<NumericUpDown>("EndDelayInput")!;
}

private void OnCancel(object? sender, RoutedEventArgs e)
{
Expand All @@ -36,7 +44,7 @@ private void OnCancel(object? sender, RoutedEventArgs e)

private void OnOk(object? sender, RoutedEventArgs e)
{
var endDelaySec = (double)(EndDelayInput.Value ?? 0m);
var endDelaySec = (double)(_endDelayInput.Value ?? 0m);

try
{
Expand Down Expand Up @@ -84,7 +92,8 @@ private static double LoadEndDelaySetting(JsonElement? settings, double defaultV

private static JsonElement BuildSettings(double endDelay)
{
using var doc = JsonDocument.Parse($"{{\"endDelay\":{endDelay.ToString("0.###", System.Globalization.CultureInfo.InvariantCulture)}}}");
var json = $"{{\"endDelay\":{endDelay.ToString("0.###", CultureInfo.InvariantCulture)}}}";
using var doc = JsonDocument.Parse(json);
return doc.RootElement.Clone();
}
}
2 changes: 1 addition & 1 deletion se5/TypewriterEffect/plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"apiVersion": 1,
"name": "Typewriter effect",
"description": "Splits each subtitle line into short timed parts that progressively reveal the text, character by character.",
"version": "1.0.0",
"version": "1.0.1",
"author": "Subtitle Edit",
"url": "https://github.com/SubtitleEdit/plugins/tree/main/se5/TypewriterEffect",
"menu": "Tools",
Expand Down
Loading