diff --git a/apps/cli/src/selftest/playback.rs b/apps/cli/src/selftest/playback.rs
index 866c22617d4..496c6b845aa 100644
--- a/apps/cli/src/selftest/playback.rs
+++ b/apps/cli/src/selftest/playback.rs
@@ -884,6 +884,7 @@ mod fixture {
status: Some(StudioRecordingStatus::Complete),
cursor_shape_version: 0,
audio_only: false,
+ blank: false,
},
};
diff --git a/apps/desktop-gpui/assets/icons/gem.svg b/apps/desktop-gpui/assets/icons/gem.svg
deleted file mode 100644
index a69fafa6503..00000000000
--- a/apps/desktop-gpui/assets/icons/gem.svg
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/apps/desktop-gpui/locales/de.toml b/apps/desktop-gpui/locales/de.toml
index 5dfc0b08922..20c2ce40a6a 100644
--- a/apps/desktop-gpui/locales/de.toml
+++ b/apps/desktop-gpui/locales/de.toml
@@ -30,6 +30,7 @@ website = "Website"
commit = "Commit"
[menu.file]
+new_blank_project = "Neues leeres Projekt"
open_prompt = "Aufnahme öffnen"
close_window = "Fenster schließen"
title = "Ablage"
@@ -1065,6 +1066,7 @@ copy_screenshot_failed = "Bildschirmfoto konnte nicht kopiert werden"
import_recordings = "Importieren"
import_screenshots = "Bild importieren"
importing = "Import läuft"
+new_project = "Neu"
no_matching_recordings = "Keine passenden Aufnahmen"
no_matching_screenshots = "Keine passenden Bildschirmfotos"
no_recordings = "Noch keine Aufnahmen"
@@ -1165,6 +1167,7 @@ no_displays = "Keine Bildschirme gefunden"
no_matching_displays = "Keine passenden Bildschirme"
no_matching_windows = "Keine passenden Fenster"
no_windows = "Keine Fenster gefunden"
+solo_title = "Nur Kamera oder Audio"
window = "Fenster"
[recordings_overlay]
@@ -1539,6 +1542,8 @@ words_per_minute = "{wpm} Wörter/Min."
[import]
audio_failed = "Audio konnte nicht importiert werden: {error}"
+blank_failed = "Projekt konnte nicht erstellt werden: {error}"
+blank_name = "Unbenannt"
error_title = "Importfehler"
image_failed = "Bild konnte nicht importiert werden: {error}"
unsupported = "Nicht unterstützte Mediendatei."
@@ -1854,9 +1859,9 @@ done = "Fertig"
import = "Datei importieren"
[editor.audio_only]
-add_visuals = "Visuals hinzufügen"
body = "Diese Aufnahme hat kein Video. Exportieren Sie den Ton als MP3 oder WAV, oder fügen Sie Visuals hinzu, um daraus ein Video zu machen."
export_audio = "Audio exportieren"
+make_video = "Ein Video daraus machen"
show_visuals = "Visuals anzeigen"
size_large = "Groß"
size_medium = "Mittel"
@@ -2310,12 +2315,16 @@ save_failed = "Dieser Verlauf konnte nicht gespeichert werden. Versuchen Sie es
save_tooltip = "Aktuellen Verlauf speichern"
saved = "Gespeichert"
still = "Still"
+style = "Stil"
+style_dither = "Dither"
+style_smooth = "Weich"
[editor.sidebar.animated_gradient.control]
contrast = "Kontrast"
curvature = "Krümmung"
detail = "Detail"
direction = "Richtung"
+dither_size = "Dither-Größe"
exposure = "Belichtung"
flow_scale = "Flussgröße"
flow_strength = "Flussstärke"
@@ -2381,6 +2390,23 @@ to = "Bis"
[editor.sidebar.image]
prompt = "Klicken Sie zum Auswählen oder ziehen Sie ein Bild hierher"
+[editor.sidebar.input_sounds]
+click_sounds = "Klickgeräusche"
+deep = "Tief"
+deep_description = "Lineare Schalter mit tiefem, rundem Klang."
+key_sounds = "Tastengeräusche"
+laptop = "Laptop"
+laptop_description = "Weiche, flache Laptoptasten."
+mechanical = "Mechanisch"
+mechanical_description = "Knackige Schalter mit hellem, taktilem Klacken."
+mouse = "Maus"
+mouse_description = "Drücken und Loslassen einer Maustaste."
+trackpad = "Trackpad"
+trackpad_description = "Der leisere Klick eines Laptop-Trackpads."
+typewriter = "Schreibmaschine"
+typewriter_description = "Anschlagende Typenhebel, mit Wagenrücklauf bei Eingabe."
+volume = "Lautstärke"
+
[editor.sidebar.layout]
background_blur = "Hintergrundunschärfe"
custom_position = "Eigene Bildschirmposition (auf der Leinwand verschoben)"
@@ -2498,6 +2524,7 @@ frames = { one = "{rendered} / {count} Frame", other = "{rendered} / {count} Fra
generating_preview = "Vorschau wird erstellt…"
link_unavailable_cursor = "Exporte nur mit Cursor können nur als Datei oder in die Zwischenablage gespeichert werden."
link_unavailable_transparent = "Transparente Exporte können nur als Datei oder in die Zwischenablage gespeichert werden."
+more_formats = "Mehr"
organization = "Organisation"
preview = "Vorschau"
preview_info = "Dies ist ein gerendertes Bild aus Ihrem Video. Passen Sie die Einstellungen an, um die Qualität des fertigen Exports zu sehen."
@@ -2545,7 +2572,9 @@ file = "Datei"
link = "Link zum Teilen"
[editor.export.done]
+copy_file = "In Zwischenablage kopieren"
copy_link = "Link kopieren"
+file_copied = "Kopiert"
instant_hint = "Verwenden Sie für Ihre nächste Aufnahme den Instant-Modus, wenn Sie direkt nach dem Stoppen einen Link möchten."
link_copied = "Link kopiert"
open_file = "Datei öffnen"
@@ -2640,14 +2669,16 @@ format = "Spuren"
microphone = "Mikrofon"
open_folder = "Ordner öffnen"
screen = "Bildschirm"
+separate = "Separate Spuren"
+separate_description = "Bildschirm, Kamera und Audio jeweils als eigene Datei"
studio_only = "Separate Spuren werden nur im Studio-Modus aufgenommen."
system_audio = "Systemaudio"
video_detail = "MP4 · {width}×{height}"
[editor.export.turbo]
title = "Turbo-Export"
-description = "Exportiert deutlich schneller mit allen CPU-Kernen und der GPU"
-warning = "Nutzt bis zum Ende des Exports die gesamte CPU, die GPU und ein Vielfaches an Arbeitsspeicher. Andere Apps können langsamer werden, und Ihr Computer kann warm und laut werden."
+description = "Schließt Exporte deutlich schneller ab, indem mehr Leistung Ihres Computers genutzt wird"
+warning = "Andere Apps können sich bis zum Ende des Exports etwas langsamer anfühlen."
[editor.modal]
cancel_export = "Export abbrechen"
@@ -2714,6 +2745,8 @@ advanced_shadow = "Erweiterte Schatteneinstellungen"
background = "Hintergrund"
corner_style = "Eckenstil"
custom_position = "Eigene Position (auf der Leinwand verschoben)"
+empty_description = "Wählen Sie vor der Aufnahme eine Kamera, dann können Sie sie hier gestalten und platzieren."
+empty_title = "Keine Kamera in dieser Aufnahme"
hide = "Kamera ausblenden"
keep_size_during_zoom = "Originalgröße beim Zoomen beibehalten"
mirror = "Kamera spiegeln"
@@ -2840,12 +2873,16 @@ minimal = "Minimal"
minimal_description = "Dezenter, umrandeter Text ohne Hintergrund."
pop = "Pop"
pop_description = "Verspielte Großbuchstaben, die mit einem kräftigen Akzent aufpoppen."
+soft = "Weich"
+soft_description = "Abgerundete anthrazitfarbene Karte passend zu den Tasten."
[editor.tabs.corner]
rounded = "Abgerundet"
squircle = "Squircle"
[editor.tabs.cursor]
+empty_description = "Diese Aufnahme hat den Cursor nicht erfasst, daher gibt es hier noch nichts zu gestalten."
+empty_title = "Kein Cursor in dieser Aufnahme"
follow_hover = "Hover-Hervorhebungen folgen"
friction = "Reibung"
hide_when_idle = "Bei Inaktivität ausblenden"
@@ -2871,6 +2908,7 @@ smooth = "Weich"
smooth_description = "Weiche, schwebende Bewegung"
[editor.tabs.keyboard]
+add_to_timeline = "Zur Timeline hinzufügen"
animation = "Animation"
background_color = "Hintergrundfarbe"
background_opacity = "Hintergrunddeckkraft"
@@ -2887,18 +2925,38 @@ font_weight = "Schriftstärke"
generate = "Tastatursegmente erstellen"
generating = "Tastatursegmente werden erstellt..."
grouping_threshold = "Gruppierungsschwelle"
+key_style = "Tastenstil"
+key_theme = "Tastenfarben"
linger_duration = "Anzeigedauer"
load_failed = "Aufnahmedaten konnten nicht geladen werden: {error}"
no_presses = "Es wurden keine aufgezeichneten Tastendrücke gefunden."
position = "Position"
regenerate = "Tastatursegmente neu erstellen"
+show_as = "Anzeigen als"
show_modifiers = "Modifikatortasten anzeigen"
show_special_keys = "Spezialtasten anzeigen"
+show_typing = "Getippten Text zeigen"
size_label = "Größe"
+split_keys = "Tasten"
+split_sentence = "Satz"
+split_words = "Wörter"
+style_classic = "Klassisch"
+style_linux = "Linux"
+style_macos = "macOS"
+style_mechanical = "Mechanisch"
+style_windows = "Windows"
text_color = "Textfarbe"
+theme_dark = "Dunkel"
+theme_light = "Hell"
+theme_retro = "Retro"
timeline_unavailable = "Die Projektzeitleiste ist nicht verfügbar."
timeline_unreadable = "Die Projektzeitleiste konnte nicht gelesen werden."
title = "Tastatur anzeigen"
+type_keys = "Tasten eingeben"
+type_keys_button = "Tasten eingeben…"
+type_keys_hint = "Füge einen Satz, ein Skript oder ein Transkript ein, oder ein Kürzel wie cmd+shift+p. Es wird ab hier als Tastenanschläge getippt."
+type_keys_placeholder = "Ein Satz oder ein Kürzel wie cmd+k"
+type_keys_summary = "Etwa {seconds} s Tippen"
uppercase = "Großbuchstaben"
[editor.tabs.padding]
@@ -2909,7 +2967,10 @@ proportional = "Proportional"
bottom_center = "Unten mittig"
bottom_left = "Unten links"
bottom_right = "Unten rechts"
+center = "Mitte"
manual = "Manuell"
+middle_left = "Mitte links"
+middle_right = "Mitte rechts"
top_center = "Oben mittig"
top_left = "Oben links"
top_right = "Oben rechts"
@@ -2979,6 +3040,7 @@ title = "Zeitleiste"
[editor.timeline.empty]
add_audio = "Audio hinzufügen"
+add_key = "Tastendruck hinzufügen"
add_scene = "Szene hinzufügen"
audio = "Fügen Sie Hintergrundmusik hinzu oder importieren Sie eigenes Audio"
captions = "Keine Untertitel"
@@ -3117,6 +3179,7 @@ crop = "Zuschneiden"
crop_tooltip = "Video zuschneiden"
no_room_for_3d_shot = "Kein Platz für eine weitere 3D-Einstellung"
no_room_for_caption = "Hier ist kein Platz für einen weiteren Untertitel"
+no_room_for_key = "Hier ist kein Platz für einen weiteren Tastendruck"
redo = "Wiederholen"
save_failed = "{path} konnte nicht gespeichert werden. Lassen Sie den Editor geöffnet und versuchen Sie es erneut: {error}"
undo = "Rückgängig"
@@ -3231,6 +3294,26 @@ no_segments = "Die Aufnahme hat keine Segmente. Möglicherweise muss sie zuerst
not_found = "Videopfad {path} nicht gefunden!"
not_studio = "Nur Studio-Aufnahmen können bearbeitet werden"
+[editor.window.looks]
+launch_day = "Launch-Tag"
+launch_day_description = "Ein kräftiger Verlauf, schnelle Zooms und auffällige Untertitel."
+mac_native = "Mac pur"
+mac_native_description = "Ein macOS-Fenster auf Tahoe mit weißen Mac-Tasten."
+midnight = "Mitternacht"
+midnight_description = "Ein tiefer, dunkler Hintergrund mit klarer Kante."
+minimal = "Minimal"
+minimal_description = "Eine ruhige, cremeweiße Fläche und nichts weiter."
+retro_desk = "Retro-Schreibtisch"
+retro_desk_description = "Warmes Beige und kräftige mechanische Tasten."
+saved = "Ihre Vorlagen"
+smooth_demo = "Sanfte Demo"
+smooth_demo_description = "Weiche Wolken, sanfte Zooms und ein ruhiger Cursor."
+title = "Looks"
+tutorial = "Tutorial"
+tutorial_description = "Langsame, ruhige Zooms und Tasten, denen jeder folgen kann."
+web_product = "Webprodukt"
+web_product_description = "Ein Browserfenster für Website- und App-Demos."
+
[editor.window.presets]
apply = "Anwenden"
create = "Erstellen"
@@ -3445,4 +3528,4 @@ no_resumable_state = "Für diese Aufnahme gibt es keinen fortsetzbaren Upload"
verification_failed = "Die Prüfung der Aufnahme ist fehlgeschlagen: {status}"
[message.cli]
-binary_missing = "Mitgelieferte CLI unter {path} nicht gefunden"
\ No newline at end of file
+binary_missing = "Mitgelieferte CLI unter {path} nicht gefunden"
diff --git a/apps/desktop-gpui/locales/en.toml b/apps/desktop-gpui/locales/en.toml
index 530c312d80c..ee592ce4047 100644
--- a/apps/desktop-gpui/locales/en.toml
+++ b/apps/desktop-gpui/locales/en.toml
@@ -30,6 +30,7 @@ website = "Website"
commit = "Commit"
[menu.file]
+new_blank_project = "New Blank Project"
open_prompt = "Open Recording"
close_window = "Close Window"
title = "File"
@@ -1067,6 +1068,7 @@ copy_screenshot_failed = "Could not copy screenshot"
import_recordings = "Import"
import_screenshots = "Import image"
importing = "Importing"
+new_project = { text = "New", context = "Button that starts a new blank project, with no recording, to build a video from backgrounds, music, keys and text." }
no_matching_recordings = "No matching recordings"
no_matching_screenshots = "No matching screenshots"
no_recordings = "No recordings yet"
@@ -1167,6 +1169,7 @@ no_displays = "No displays found"
no_matching_displays = "No matching displays"
no_matching_windows = "No matching windows"
no_windows = "No windows found"
+solo_title = { text = "Camera or audio only", context = "Title of the panel choosing between camera-only and audio-only recording, and the tooltip on its chevron." }
window = { text = "Window", max_px = 100, size = 12 }
[recordings_overlay]
@@ -1541,6 +1544,8 @@ words_per_minute = { text = "{wpm} wpm", context = "Teleprompter scroll speed in
[import]
audio_failed = { text = "Failed to import audio: {error}", context = "{error} is a technical error message, usually in English." }
+blank_failed = { text = "Failed to create a project: {error}", context = "{error} is a technical error message, usually in English." }
+blank_name = { text = "Untitled", context = "The name of a new blank project, made without recording anything." }
error_title = "Import Error"
image_failed = { text = "Failed to import image: {error}", context = "{error} is a technical error message, usually in English." }
unsupported = "Unsupported media file."
@@ -1856,9 +1861,9 @@ done = "Done"
import = "Import file"
[editor.audio_only]
-add_visuals = "Add Visuals"
body = "This recording has no video. Export the sound as MP3 or WAV, or add visuals to turn it into a video."
export_audio = "Export Audio"
+make_video = { text = "Make it a video", context = "Heading over visualiser choices that turn an audio-only recording into a video." }
show_visuals = "Show visuals"
size_large = "Large"
size_medium = "Medium"
@@ -2312,12 +2317,16 @@ save_failed = "Could not save this gradient. Try again."
save_tooltip = "Save the current gradient"
saved = "Saved"
still = { text = "Still", context = "Motion speed readout when the speed is zero." }
+style = "Style"
+style_dither = { text = "Dither", context = "A background style drawn as a fine ordered dither of a few colours, like an old print." }
+style_smooth = "Smooth"
[editor.sidebar.animated_gradient.control]
contrast = "Contrast"
curvature = "Curvature"
detail = "Detail"
direction = "Direction"
+dither_size = "Dither Size"
exposure = "Exposure"
flow_scale = "Flow Scale"
flow_strength = "Flow Strength"
@@ -2383,6 +2392,23 @@ to = "To"
[editor.sidebar.image]
prompt = "Click to select or drag and drop image"
+[editor.sidebar.input_sounds]
+click_sounds = "Click Sounds"
+deep = "Deep"
+deep_description = "Linear switches with a low, rounded thock."
+key_sounds = "Key Sounds"
+laptop = "Laptop"
+laptop_description = "Soft, shallow laptop keys."
+mechanical = "Mechanical"
+mechanical_description = "Crisp switches with a bright, tactile clack."
+mouse = "Mouse"
+mouse_description = "The press and release of a mouse button."
+trackpad = "Trackpad"
+trackpad_description = "The softer click of a laptop trackpad."
+typewriter = "Typewriter"
+typewriter_description = "Type bars striking, with a carriage return on enter."
+volume = "Volume"
+
[editor.sidebar.layout]
background_blur = "Background Blur"
custom_position = "Custom screen position (dragged on canvas)"
@@ -2500,6 +2526,7 @@ frames = { one = "{rendered} / {count} frame", other = "{rendered} / {count} fra
generating_preview = "Generating preview…"
link_unavailable_cursor = "Cursor-only exports can only be saved to a file or clipboard."
link_unavailable_transparent = "Transparent exports can only be saved to a file or clipboard."
+more_formats = { text = "More", context = "Export format option that reveals less common formats, such as separate tracks." }
organization = "Organization"
preview = "Preview"
preview_info = "This is a rendered frame from your video. Adjust the settings to see the quality of the final export."
@@ -2547,7 +2574,9 @@ file = { text = "File", context = "Export destination." }
link = { text = "Shareable Link", context = "Export destination." }
[editor.export.done]
+copy_file = "Copy to Clipboard"
copy_link = "Copy link"
+file_copied = "Copied"
instant_hint = "Use Instant Mode for your next recording if you want a link the moment you stop."
link_copied = "Link copied"
open_file = "Open File"
@@ -2642,14 +2671,16 @@ format = { text = "Tracks", context = "Export format: separate screen, camera an
microphone = "Microphone"
open_folder = "Open Folder"
screen = "Screen"
+separate = "Separate tracks"
+separate_description = "Screen, camera and audio, each as its own file"
studio_only = "Separate tracks are only recorded in Studio Mode."
system_audio = "System audio"
video_detail = { text = "MP4 · {width}×{height}", context = "Video track file type and size, for example MP4 · 1920×1080." }
[editor.export.turbo]
title = "Turbo export"
-description = "Exports much faster using every CPU core and the GPU"
-warning = "Uses all of your CPU, the GPU and several times more memory until the export finishes. Other apps may slow down, and your computer may get warm and loud."
+description = "Finishes exports much faster by using more of your computer's power"
+warning = "Other apps may feel a little slower until the export finishes."
[editor.modal]
cancel_export = "Cancel export"
@@ -2716,6 +2747,8 @@ advanced_shadow = "Advanced shadow settings"
background = "Background"
corner_style = "Corner Style"
custom_position = "Custom position (dragged on canvas)"
+empty_description = "Choose a camera before you record and you can shape and place it here."
+empty_title = "No camera in this recording"
hide = "Hide Camera"
keep_size_during_zoom = "Keep original size during zoom"
mirror = "Mirror Camera"
@@ -2842,12 +2875,16 @@ minimal = "Minimal"
minimal_description = "Subtle outlined text with no background."
pop = "Pop"
pop_description = "Playful caps that pop in with a vibrant accent."
+soft = "Soft"
+soft_description = "Rounded charcoal card that matches the keys."
[editor.tabs.corner]
rounded = "Rounded"
squircle = "Squircle"
[editor.tabs.cursor]
+empty_description = "This recording didn't capture the cursor, so there's nothing to style yet."
+empty_title = "No cursor in this recording"
follow_hover = "Follow Hover Highlights"
friction = "Friction"
hide_when_idle = "Hide When Idle"
@@ -2873,6 +2910,7 @@ smooth = "Smooth"
smooth_description = "Soft, floaty movement"
[editor.tabs.keyboard]
+add_to_timeline = "Add to Timeline"
animation = "Animation"
background_color = "Background Color"
background_opacity = "Background Opacity"
@@ -2889,18 +2927,38 @@ font_weight = "Font Weight"
generate = "Generate Keyboard Segments"
generating = "Generating Keyboard Segments..."
grouping_threshold = "Grouping Threshold"
+key_style = "Key Style"
+key_theme = "Key Theme"
linger_duration = "Linger Duration"
load_failed = "Failed to load recording data: {error}"
no_presses = "No recorded keyboard presses were found."
position = "Position"
regenerate = "Regenerate Keyboard Segments"
+show_as = "Show As"
show_modifiers = "Show Modifiers"
show_special_keys = "Show Special Keys"
+show_typing = "Show Typing"
size_label = "Size"
+split_keys = { text = "Keys", context = "How typed text shows: one key per keystroke." }
+split_sentence = { text = "Sentence", context = "How typed text shows: the whole sentence on one key." }
+split_words = { text = "Words", context = "How typed text shows: one key per word." }
+style_classic = "Classic"
+style_linux = "Linux"
+style_macos = "macOS"
+style_mechanical = "Mechanical"
+style_windows = "Windows"
text_color = "Text Color"
+theme_dark = "Dark"
+theme_light = "Light"
+theme_retro = "Retro"
timeline_unavailable = "The project timeline is unavailable."
timeline_unreadable = "The project timeline could not be read."
title = "Show keyboard"
+type_keys = "Type Keys"
+type_keys_button = "Type Keys…"
+type_keys_hint = { text = "Paste a sentence, a script or a transcript, or a shortcut like cmd+shift+p. It types out as key presses from where you opened this.", context = "cmd+shift+p is typed as is and must stay in English." }
+type_keys_placeholder = { text = "A sentence, or a shortcut like cmd+k", context = "Placeholder in a text box; cmd+k is typed as is and must stay in English." }
+type_keys_summary = { text = "About {seconds} s of typing", context = "{seconds} is a number of seconds, like 4.2." }
uppercase = "Uppercase"
[editor.tabs.padding]
@@ -2911,7 +2969,10 @@ proportional = "Proportional"
bottom_center = "Bottom Center"
bottom_left = "Bottom Left"
bottom_right = "Bottom Right"
+center = "Center"
manual = "Manual"
+middle_left = "Middle Left"
+middle_right = "Middle Right"
top_center = "Top Center"
top_left = "Top Left"
top_right = "Top Right"
@@ -2981,6 +3042,7 @@ title = { text = "Timeline", context = "Label above the timeline while the edito
[editor.timeline.empty]
add_audio = "Add audio"
+add_key = "Add a key press"
add_scene = "Add scene"
audio = "Add background music or import your own audio"
captions = "No captions"
@@ -3119,6 +3181,7 @@ crop = "Crop"
crop_tooltip = "Crop Video"
no_room_for_3d_shot = "No room for another 3D shot"
no_room_for_caption = "No room for another caption here"
+no_room_for_key = "No room for another key press here"
redo = "Redo"
save_failed = { text = "Could not save {path}. Keep the editor open and try again: {error}", context = "{path} is the recording's folder; {error} is a technical message that stays in English." }
undo = "Undo"
@@ -3233,6 +3296,26 @@ no_segments = "Recording has no segments. It may need to be recovered first."
not_found = "Video path {path} not found!"
not_studio = "Cannot edit non-studio recordings"
+[editor.window.looks]
+launch_day = "Launch Day"
+launch_day_description = "A vivid gradient, snappy zooms and bold captions."
+mac_native = "Mac Native"
+mac_native_description = "A macOS window on Tahoe with white Mac keys."
+midnight = "Midnight"
+midnight_description = "A deep, dark backdrop with a crisp edge."
+minimal = "Minimal"
+minimal_description = "A quiet off-white canvas and nothing extra."
+retro_desk = "Retro Desk"
+retro_desk_description = "Warm beige and chunky mechanical keys."
+saved = "Your Presets"
+smooth_demo = "Smooth Demo"
+smooth_demo_description = "Soft clouds, gentle zooms and a calm cursor."
+title = "Looks"
+tutorial = "Tutorial"
+tutorial_description = "Slow, steady zooms and keys anyone can follow."
+web_product = "Web Product"
+web_product_description = "A browser window for site and app demos."
+
[editor.window.presets]
apply = "Apply"
create = "Create"
@@ -3447,4 +3530,4 @@ no_resumable_state = "This recording has no resumable upload state"
verification_failed = { text = "Recording verification failed: {status}", context = "{status} is a technical status, usually in English." }
[message.cli]
-binary_missing = { text = "Bundled CLI binary not found at {path}", context = "{path} is a file path." }
\ No newline at end of file
+binary_missing = { text = "Bundled CLI binary not found at {path}", context = "{path} is a file path." }
diff --git a/apps/desktop-gpui/locales/es.toml b/apps/desktop-gpui/locales/es.toml
index 920cd1dd872..ea649bde39b 100644
--- a/apps/desktop-gpui/locales/es.toml
+++ b/apps/desktop-gpui/locales/es.toml
@@ -30,6 +30,7 @@ website = "Sitio web"
commit = "Commit"
[menu.file]
+new_blank_project = "Nuevo proyecto en blanco"
open_prompt = "Abrir grabación"
close_window = "Cerrar ventana"
title = "Archivo"
@@ -1065,6 +1066,7 @@ copy_screenshot_failed = "No se pudo copiar la captura de pantalla"
import_recordings = "Importar"
import_screenshots = "Importar imagen"
importing = "Importando"
+new_project = "Nuevo"
no_matching_recordings = "No hay grabaciones que coincidan"
no_matching_screenshots = "No hay capturas que coincidan"
no_recordings = "Aún no hay grabaciones"
@@ -1165,6 +1167,7 @@ no_displays = "No se encontraron pantallas"
no_matching_displays = "No hay pantallas que coincidan"
no_matching_windows = "No hay ventanas que coincidan"
no_windows = "No se encontraron ventanas"
+solo_title = "Solo cámara o audio"
window = "Ventana"
[recordings_overlay]
@@ -1539,6 +1542,8 @@ words_per_minute = "{wpm} ppm"
[import]
audio_failed = "No se pudo importar el audio: {error}"
+blank_failed = "No se pudo crear el proyecto: {error}"
+blank_name = "Sin título"
error_title = "Error de importación"
image_failed = "No se pudo importar la imagen: {error}"
unsupported = "Archivo multimedia no compatible."
@@ -1854,9 +1859,9 @@ done = "Listo"
import = "Importar archivo"
[editor.audio_only]
-add_visuals = "Añadir visuales"
body = "Esta grabación no tiene vídeo. Exporta el sonido como MP3 o WAV, o añade elementos visuales para convertirla en un vídeo."
export_audio = "Exportar audio"
+make_video = "Convertirlo en vídeo"
show_visuals = "Mostrar visuales"
size_large = "Grande"
size_medium = "Mediano"
@@ -2310,12 +2315,16 @@ save_failed = "No se pudo guardar este degradado. Inténtalo de nuevo."
save_tooltip = "Guardar el degradado actual"
saved = "Guardados"
still = "Quieto"
+style = "Estilo"
+style_dither = "Tramado"
+style_smooth = "Suave"
[editor.sidebar.animated_gradient.control]
contrast = "Contraste"
curvature = "Curvatura"
detail = "Detalle"
direction = "Dirección"
+dither_size = "Tamaño del tramado"
exposure = "Exposición"
flow_scale = "Escala del flujo"
flow_strength = "Fuerza del flujo"
@@ -2381,6 +2390,23 @@ to = "Hasta"
[editor.sidebar.image]
prompt = "Haz clic para elegir o arrastra y suelta una imagen"
+[editor.sidebar.input_sounds]
+click_sounds = "Sonidos de clic"
+deep = "Grave"
+deep_description = "Interruptores lineales con un golpe grave y redondo."
+key_sounds = "Sonidos de teclas"
+laptop = "Portátil"
+laptop_description = "Teclas de portátil suaves y de poco recorrido."
+mechanical = "Mecánico"
+mechanical_description = "Interruptores nítidos con un clac brillante y táctil."
+mouse = "Ratón"
+mouse_description = "Pulsar y soltar un botón del ratón."
+trackpad = "Trackpad"
+trackpad_description = "El clic más suave de un trackpad de portátil."
+typewriter = "Máquina de escribir"
+typewriter_description = "Tipos que golpean, con retorno de carro al pulsar Intro."
+volume = "Volumen"
+
[editor.sidebar.layout]
background_blur = "Desenfoque del fondo"
custom_position = "Posición de pantalla personalizada (arrastrada en el lienzo)"
@@ -2498,6 +2524,7 @@ frames = { one = "{rendered} / {count} fotograma", other = "{rendered} / {count}
generating_preview = "Generando vista previa…"
link_unavailable_cursor = "Las exportaciones solo del cursor solo se pueden guardar en un archivo o en el portapapeles."
link_unavailable_transparent = "Las exportaciones transparentes solo se pueden guardar en un archivo o en el portapapeles."
+more_formats = "Más"
organization = "Organización"
preview = "Vista previa"
preview_info = "Este es un fotograma renderizado de tu vídeo. Ajusta la configuración para ver la calidad de la exportación final."
@@ -2545,7 +2572,9 @@ file = "Archivo"
link = "Enlace para compartir"
[editor.export.done]
+copy_file = "Copiar al portapapeles"
copy_link = "Copiar enlace"
+file_copied = "Copiado"
instant_hint = "Usa el modo Instant en tu próxima grabación si quieres un enlace en cuanto te detengas."
link_copied = "Enlace copiado"
open_file = "Abrir archivo"
@@ -2640,14 +2669,16 @@ format = "Pistas"
microphone = "Micrófono"
open_folder = "Abrir carpeta"
screen = "Pantalla"
+separate = "Pistas separadas"
+separate_description = "Pantalla, cámara y audio, cada uno en su propio archivo"
studio_only = "Las pistas separadas solo se graban en el modo Studio."
system_audio = "Audio del sistema"
video_detail = "MP4 · {width}×{height}"
[editor.export.turbo]
title = "Exportación turbo"
-description = "Exporta mucho más rápido usando todos los núcleos de la CPU y la GPU"
-warning = "Usa toda tu CPU, la GPU y varias veces más memoria hasta que termina la exportación. Otras apps pueden ir más lentas, y tu ordenador puede calentarse y hacer ruido."
+description = "Termina las exportaciones mucho más rápido usando más potencia de tu ordenador"
+warning = "Otras apps pueden ir un poco más lentas hasta que termine la exportación."
[editor.modal]
cancel_export = "Cancelar exportación"
@@ -2714,6 +2745,8 @@ advanced_shadow = "Ajustes avanzados de sombra"
background = "Fondo"
corner_style = "Estilo de esquinas"
custom_position = "Posición personalizada (arrastrada en el lienzo)"
+empty_description = "Elige una cámara antes de grabar y podrás darle forma y colocarla aquí."
+empty_title = "No hay cámara en esta grabación"
hide = "Ocultar cámara"
keep_size_during_zoom = "Mantener el tamaño original durante el zoom"
mirror = "Reflejar cámara"
@@ -2840,12 +2873,16 @@ minimal = "Mínimo"
minimal_description = "Texto sutil con contorno y sin fondo."
pop = "Pop"
pop_description = "Mayúsculas divertidas que aparecen con un acento vibrante."
+soft = "Suave"
+soft_description = "Tarjeta redondeada en gris carbón a juego con las teclas."
[editor.tabs.corner]
rounded = "Redondeadas"
squircle = "Squircle"
[editor.tabs.cursor]
+empty_description = "Esta grabación no capturó el cursor, así que todavía no hay nada que ajustar."
+empty_title = "No hay cursor en esta grabación"
follow_hover = "Seguir resaltados al pasar"
friction = "Fricción"
hide_when_idle = "Ocultar en reposo"
@@ -2871,6 +2908,7 @@ smooth = "Suave"
smooth_description = "Movimiento suave y flotante"
[editor.tabs.keyboard]
+add_to_timeline = "Añadir a la línea de tiempo"
animation = "Animación"
background_color = "Color de fondo"
background_opacity = "Opacidad del fondo"
@@ -2887,18 +2925,38 @@ font_weight = "Grosor de fuente"
generate = "Generar segmentos de teclado"
generating = "Generando segmentos de teclado..."
grouping_threshold = "Umbral de agrupación"
+key_style = "Estilo de teclas"
+key_theme = "Tema de teclas"
linger_duration = "Tiempo en pantalla"
load_failed = "No se pudieron cargar los datos de la grabación: {error}"
no_presses = "No se encontraron pulsaciones de teclado grabadas."
position = "Posición"
regenerate = "Regenerar segmentos de teclado"
+show_as = "Mostrar como"
show_modifiers = "Mostrar modificadores"
show_special_keys = "Mostrar teclas especiales"
+show_typing = "Mostrar lo que escribes"
size_label = "Tamaño"
+split_keys = "Teclas"
+split_sentence = "Frase"
+split_words = "Palabras"
+style_classic = "Clásico"
+style_linux = "Linux"
+style_macos = "macOS"
+style_mechanical = "Mecánico"
+style_windows = "Windows"
text_color = "Color del texto"
+theme_dark = "Oscuro"
+theme_light = "Claro"
+theme_retro = "Retro"
timeline_unavailable = "La línea de tiempo del proyecto no está disponible."
timeline_unreadable = "No se pudo leer la línea de tiempo del proyecto."
title = "Mostrar teclado"
+type_keys = "Escribir teclas"
+type_keys_button = "Escribir teclas…"
+type_keys_hint = "Pega una frase, un guion o una transcripción, o un atajo como cmd+shift+p. Se escribe como pulsaciones desde donde abriste esto."
+type_keys_placeholder = "Una frase o un atajo como cmd+k"
+type_keys_summary = "Unos {seconds} s de escritura"
uppercase = "Mayúsculas"
[editor.tabs.padding]
@@ -2909,7 +2967,10 @@ proportional = "Proporcional"
bottom_center = "Abajo al centro"
bottom_left = "Abajo a la izquierda"
bottom_right = "Abajo a la derecha"
+center = "Centro"
manual = "Manual"
+middle_left = "Centro izquierda"
+middle_right = "Centro derecha"
top_center = "Arriba al centro"
top_left = "Arriba a la izquierda"
top_right = "Arriba a la derecha"
@@ -2979,6 +3040,7 @@ title = "Línea de tiempo"
[editor.timeline.empty]
add_audio = "Añadir audio"
+add_key = "Añadir una pulsación"
add_scene = "Añadir escena"
audio = "Añade música de fondo o importa tu propio audio"
captions = "Sin subtítulos"
@@ -3117,6 +3179,7 @@ crop = "Recortar"
crop_tooltip = "Recortar vídeo"
no_room_for_3d_shot = "No hay espacio para otra toma 3D"
no_room_for_caption = "No hay espacio para otro subtítulo aquí"
+no_room_for_key = "No hay espacio para otra pulsación aquí"
redo = "Rehacer"
save_failed = "No se pudo guardar {path}. Mantén el editor abierto e inténtalo de nuevo: {error}"
undo = "Deshacer"
@@ -3231,6 +3294,26 @@ no_segments = "La grabación no tiene segmentos. Puede que primero haya que recu
not_found = "¡No se encontró la ruta de vídeo {path}!"
not_studio = "Solo se pueden editar grabaciones Studio"
+[editor.window.looks]
+launch_day = "Día de lanzamiento"
+launch_day_description = "Un degradado vivo, zooms ágiles y subtítulos llamativos."
+mac_native = "Mac nativo"
+mac_native_description = "Una ventana de macOS sobre Tahoe con teclas blancas de Mac."
+midnight = "Medianoche"
+midnight_description = "Un fondo oscuro y profundo con un borde nítido."
+minimal = "Minimalista"
+minimal_description = "Un lienzo blanco roto, tranquilo y sin nada más."
+retro_desk = "Escritorio retro"
+retro_desk_description = "Beige cálido y teclas mecánicas robustas."
+saved = "Tus preajustes"
+smooth_demo = "Demo suave"
+smooth_demo_description = "Nubes suaves, zooms delicados y un cursor tranquilo."
+title = "Estilos"
+tutorial = "Tutorial"
+tutorial_description = "Zooms lentos y estables, y teclas que cualquiera puede seguir."
+web_product = "Producto web"
+web_product_description = "Una ventana de navegador para demos de webs y apps."
+
[editor.window.presets]
apply = "Aplicar"
create = "Crear"
@@ -3445,4 +3528,4 @@ no_resumable_state = "Esta grabación no tiene una subida que se pueda reanudar"
verification_failed = "La verificación de la grabación ha fallado: {status}"
[message.cli]
-binary_missing = "No se encontró la CLI incluida en {path}"
\ No newline at end of file
+binary_missing = "No se encontró la CLI incluida en {path}"
diff --git a/apps/desktop-gpui/locales/fr.toml b/apps/desktop-gpui/locales/fr.toml
index cab06798301..4b3e957ad44 100644
--- a/apps/desktop-gpui/locales/fr.toml
+++ b/apps/desktop-gpui/locales/fr.toml
@@ -30,6 +30,7 @@ website = "Site web"
commit = "Commit"
[menu.file]
+new_blank_project = "Nouveau projet vierge"
open_prompt = "Ouvrir l'enregistrement"
close_window = "Fermer la fenêtre"
title = "Fichier"
@@ -1065,6 +1066,7 @@ copy_screenshot_failed = "Impossible de copier la capture d'écran"
import_recordings = "Importer"
import_screenshots = "Importer une image"
importing = "Importation"
+new_project = "Nouveau"
no_matching_recordings = "Aucun enregistrement correspondant"
no_matching_screenshots = "Aucune capture d'écran correspondante"
no_recordings = "Aucun enregistrement pour l'instant"
@@ -1165,6 +1167,7 @@ no_displays = "Aucun écran trouvé"
no_matching_displays = "Aucun écran correspondant"
no_matching_windows = "Aucune fenêtre correspondante"
no_windows = "Aucune fenêtre trouvée"
+solo_title = "Caméra ou audio seul"
window = "Fenêtre"
[recordings_overlay]
@@ -1539,6 +1542,8 @@ words_per_minute = "{wpm} mots/min"
[import]
audio_failed = "Impossible d'importer l'audio : {error}"
+blank_failed = "Impossible de créer le projet : {error}"
+blank_name = "Sans titre"
error_title = "Erreur d'importation"
image_failed = "Impossible d'importer l'image : {error}"
unsupported = "Fichier multimédia non pris en charge."
@@ -1854,9 +1859,9 @@ done = "Terminé"
import = "Importer un fichier"
[editor.audio_only]
-add_visuals = "Ajouter des visuels"
body = "Cet enregistrement n'a pas de vidéo. Exportez le son en MP3 ou WAV, ou ajoutez des visuels pour en faire une vidéo."
export_audio = "Exporter l'audio"
+make_video = "En faire une vidéo"
show_visuals = "Afficher les visuels"
size_large = "Grand"
size_medium = "Moyen"
@@ -2310,12 +2315,16 @@ save_failed = "Impossible d'enregistrer ce dégradé. Réessayez."
save_tooltip = "Enregistrer le dégradé actuel"
saved = "Enregistrés"
still = "Immobile"
+style = "Style"
+style_dither = "Tramé"
+style_smooth = "Lisse"
[editor.sidebar.animated_gradient.control]
contrast = "Contraste"
curvature = "Courbure"
detail = "Détail"
direction = "Direction"
+dither_size = "Taille du tramé"
exposure = "Exposition"
flow_scale = "Échelle du flux"
flow_strength = "Force du flux"
@@ -2381,6 +2390,23 @@ to = "À"
[editor.sidebar.image]
prompt = "Cliquez pour choisir ou glissez-déposez une image"
+[editor.sidebar.input_sounds]
+click_sounds = "Sons des clics"
+deep = "Grave"
+deep_description = "Interrupteurs linéaires au son grave et rond."
+key_sounds = "Sons des touches"
+laptop = "Portable"
+laptop_description = "Touches de portable douces et peu profondes."
+mechanical = "Mécanique"
+mechanical_description = "Interrupteurs nets au clac vif et tactile."
+mouse = "Souris"
+mouse_description = "L'appui et le relâchement d'un bouton de souris."
+trackpad = "Trackpad"
+trackpad_description = "Le clic plus doux d'un trackpad de portable."
+typewriter = "Machine à écrire"
+typewriter_description = "Des barres qui frappent, avec un retour chariot sur Entrée."
+volume = "Volume"
+
[editor.sidebar.layout]
background_blur = "Flou de l'arrière-plan"
custom_position = "Position d'écran personnalisée (déplacée sur le canevas)"
@@ -2498,6 +2524,7 @@ frames = { one = "{rendered} / {count} image", other = "{rendered} / {count} ima
generating_preview = "Génération de l'aperçu…"
link_unavailable_cursor = "Les exportations du curseur seul ne peuvent être enregistrées que dans un fichier ou le presse-papiers."
link_unavailable_transparent = "Les exportations transparentes ne peuvent être enregistrées que dans un fichier ou le presse-papiers."
+more_formats = "Plus"
organization = "Organisation"
preview = "Aperçu"
preview_info = "Ceci est une image rendue de votre vidéo. Ajustez les paramètres pour voir la qualité de l'exportation finale."
@@ -2545,7 +2572,9 @@ file = "Fichier"
link = "Lien de partage"
[editor.export.done]
+copy_file = "Copier dans le presse-papiers"
copy_link = "Copier le lien"
+file_copied = "Copié"
instant_hint = "Utilisez le mode Instant pour votre prochain enregistrement si vous voulez un lien dès que vous arrêtez."
link_copied = "Lien copié"
open_file = "Ouvrir le fichier"
@@ -2640,14 +2669,16 @@ format = "Pistes"
microphone = "Micro"
open_folder = "Ouvrir le dossier"
screen = "Écran"
+separate = "Pistes séparées"
+separate_description = "Écran, caméra et audio, chacun dans son propre fichier"
studio_only = "Les pistes séparées ne sont enregistrées qu'en mode Studio."
system_audio = "Audio système"
video_detail = "MP4 · {width}×{height}"
[editor.export.turbo]
title = "Exportation turbo"
-description = "Exporte beaucoup plus vite en utilisant tous les cœurs du processeur et le GPU"
-warning = "Utilise tout votre processeur, le GPU et plusieurs fois plus de mémoire jusqu'à la fin de l'exportation. Les autres apps peuvent ralentir, et votre ordinateur peut chauffer et devenir bruyant."
+description = "Termine les exportations beaucoup plus vite en utilisant davantage la puissance de votre ordinateur"
+warning = "Les autres apps peuvent sembler un peu plus lentes jusqu'à la fin de l'exportation."
[editor.modal]
cancel_export = "Annuler l'exportation"
@@ -2714,6 +2745,8 @@ advanced_shadow = "Réglages avancés de l'ombre"
background = "Arrière-plan"
corner_style = "Style des coins"
custom_position = "Position personnalisée (déplacée sur le canevas)"
+empty_description = "Choisissez une caméra avant d'enregistrer pour pouvoir la mettre en forme et la placer ici."
+empty_title = "Aucune caméra dans cet enregistrement"
hide = "Masquer la caméra"
keep_size_during_zoom = "Conserver la taille d'origine pendant le zoom"
mirror = "Effet miroir"
@@ -2840,12 +2873,16 @@ minimal = "Minimal"
minimal_description = "Texte discret avec contour, sans arrière-plan."
pop = "Pop"
pop_description = "Majuscules ludiques qui apparaissent avec une touche de couleur vive."
+soft = "Doux"
+soft_description = "Carte arrondie anthracite assortie aux touches."
[editor.tabs.corner]
rounded = "Arrondi"
squircle = "Squircle"
[editor.tabs.cursor]
+empty_description = "Cet enregistrement n'a pas capturé le curseur, il n'y a donc encore rien à styliser."
+empty_title = "Aucun curseur dans cet enregistrement"
follow_hover = "Suivre les survols"
friction = "Friction"
hide_when_idle = "Masquer en cas d'inactivité"
@@ -2871,6 +2908,7 @@ smooth = "Fluide"
smooth_description = "Mouvement souple et flottant"
[editor.tabs.keyboard]
+add_to_timeline = "Ajouter à la timeline"
animation = "Animation"
background_color = "Couleur d'arrière-plan"
background_opacity = "Opacité de l'arrière-plan"
@@ -2887,18 +2925,38 @@ font_weight = "Graisse"
generate = "Générer les segments clavier"
generating = "Génération des segments clavier..."
grouping_threshold = "Seuil de regroupement"
+key_style = "Style des touches"
+key_theme = "Thème des touches"
linger_duration = "Durée d'affichage"
load_failed = "Impossible de charger les données d'enregistrement : {error}"
no_presses = "Aucune frappe enregistrée n'a été trouvée."
position = "Position"
regenerate = "Régénérer les segments clavier"
+show_as = "Afficher en"
show_modifiers = "Afficher les modificateurs"
show_special_keys = "Afficher les touches spéciales"
+show_typing = "Afficher la saisie"
size_label = "Taille"
+split_keys = "Touches"
+split_sentence = "Phrase"
+split_words = "Mots"
+style_classic = "Classique"
+style_linux = "Linux"
+style_macos = "macOS"
+style_mechanical = "Mécanique"
+style_windows = "Windows"
text_color = "Couleur du texte"
+theme_dark = "Sombre"
+theme_light = "Clair"
+theme_retro = "Rétro"
timeline_unavailable = "La timeline du projet n'est pas disponible."
timeline_unreadable = "Impossible de lire la timeline du projet."
title = "Afficher le clavier"
+type_keys = "Taper des touches"
+type_keys_button = "Taper des touches…"
+type_keys_hint = "Collez une phrase, un script ou une transcription, ou un raccourci comme cmd+shift+p. Le texte est tapé en touches à partir d’ici."
+type_keys_placeholder = "Une phrase ou un raccourci comme cmd+k"
+type_keys_summary = "Environ {seconds} s de frappe"
uppercase = "Majuscules"
[editor.tabs.padding]
@@ -2909,7 +2967,10 @@ proportional = "Proportionnelle"
bottom_center = "En bas au centre"
bottom_left = "En bas à gauche"
bottom_right = "En bas à droite"
+center = "Centre"
manual = "Manuelle"
+middle_left = "Milieu gauche"
+middle_right = "Milieu droite"
top_center = "En haut au centre"
top_left = "En haut à gauche"
top_right = "En haut à droite"
@@ -2979,6 +3040,7 @@ title = "Timeline"
[editor.timeline.empty]
add_audio = "Ajouter de l'audio"
+add_key = "Ajouter une touche"
add_scene = "Ajouter une scène"
audio = "Ajoutez une musique de fond ou importez votre propre audio"
captions = "Aucun sous-titre"
@@ -3117,6 +3179,7 @@ crop = "Recadrer"
crop_tooltip = "Recadrer la vidéo"
no_room_for_3d_shot = "Plus de place pour un autre plan 3D"
no_room_for_caption = "Pas de place pour un autre sous-titre ici"
+no_room_for_key = "Pas de place pour une autre touche ici"
redo = "Rétablir"
save_failed = "Impossible d'enregistrer {path}. Gardez l'éditeur ouvert et réessayez : {error}"
undo = "Annuler"
@@ -3231,6 +3294,26 @@ no_segments = "L'enregistrement n'a aucun segment. Il faut peut-être d'abord le
not_found = "Chemin vidéo {path} introuvable !"
not_studio = "Seuls les enregistrements Studio peuvent être modifiés"
+[editor.window.looks]
+launch_day = "Jour de lancement"
+launch_day_description = "Un dégradé éclatant, des zooms vifs et des sous-titres marquants."
+mac_native = "Mac natif"
+mac_native_description = "Une fenêtre macOS sur Tahoe avec des touches Mac blanches."
+midnight = "Minuit"
+midnight_description = "Un fond sombre et profond au contour net."
+minimal = "Minimal"
+minimal_description = "Une toile blanc cassé, calme, sans rien de plus."
+retro_desk = "Bureau rétro"
+retro_desk_description = "Un beige chaleureux et de grosses touches mécaniques."
+saved = "Vos préréglages"
+smooth_demo = "Démo fluide"
+smooth_demo_description = "Des nuages doux, des zooms délicats et un curseur posé."
+title = "Styles"
+tutorial = "Tutoriel"
+tutorial_description = "Des zooms lents et réguliers, et des touches faciles à suivre."
+web_product = "Produit web"
+web_product_description = "Une fenêtre de navigateur pour les démos de sites et d'apps."
+
[editor.window.presets]
apply = "Appliquer"
create = "Créer"
@@ -3445,4 +3528,4 @@ no_resumable_state = "Cet enregistrement n'a pas d'envoi pouvant reprendre"
verification_failed = "La vérification de l'enregistrement a échoué : {status}"
[message.cli]
-binary_missing = "CLI intégrée introuvable dans {path}"
\ No newline at end of file
+binary_missing = "CLI intégrée introuvable dans {path}"
diff --git a/apps/desktop-gpui/locales/hi.toml b/apps/desktop-gpui/locales/hi.toml
index 539cb62f991..0a8b538ba50 100644
--- a/apps/desktop-gpui/locales/hi.toml
+++ b/apps/desktop-gpui/locales/hi.toml
@@ -30,6 +30,7 @@ website = "वेबसाइट"
commit = "कमिट"
[menu.file]
+new_blank_project = "नया खाली प्रोजेक्ट"
open_prompt = "रिकॉर्डिंग खोलें"
close_window = "विंडो बंद करें"
title = "फ़ाइल"
@@ -1065,6 +1066,7 @@ copy_screenshot_failed = "स्क्रीनशॉट कॉपी नही
import_recordings = "इम्पोर्ट करें"
import_screenshots = "इमेज इम्पोर्ट करें"
importing = "इम्पोर्ट हो रहा है"
+new_project = "नया"
no_matching_recordings = "कोई मिलती-जुलती रिकॉर्डिंग नहीं"
no_matching_screenshots = "कोई मिलता-जुलता स्क्रीनशॉट नहीं"
no_recordings = "अभी कोई रिकॉर्डिंग नहीं"
@@ -1165,6 +1167,7 @@ no_displays = "कोई डिस्प्ले नहीं मिला"
no_matching_displays = "कोई मिलता-जुलता डिस्प्ले नहीं"
no_matching_windows = "कोई मिलती-जुलती विंडो नहीं"
no_windows = "कोई विंडो नहीं मिली"
+solo_title = "सिर्फ़ कैमरा या ऑडियो"
window = "विंडो"
[recordings_overlay]
@@ -1539,6 +1542,8 @@ words_per_minute = "{wpm} शब्द/मिनट"
[import]
audio_failed = "ऑडियो इंपोर्ट नहीं हो सका: {error}"
+blank_failed = "प्रोजेक्ट नहीं बन सका: {error}"
+blank_name = "बिना शीर्षक"
error_title = "इम्पोर्ट त्रुटि"
image_failed = "इमेज इम्पोर्ट नहीं हो सकी: {error}"
unsupported = "यह मीडिया फ़ाइल समर्थित नहीं है।"
@@ -1854,9 +1859,9 @@ done = "हो गया"
import = "फ़ाइल इम्पोर्ट करें"
[editor.audio_only]
-add_visuals = "विज़ुअल जोड़ें"
body = "इस रिकॉर्डिंग में वीडियो नहीं है। आवाज़ को MP3 या WAV के रूप में एक्सपोर्ट करें, या इसे वीडियो बनाने के लिए विज़ुअल जोड़ें।"
export_audio = "ऑडियो एक्सपोर्ट करें"
+make_video = "इसे वीडियो बनाएँ"
show_visuals = "विज़ुअल दिखाएं"
size_large = "बड़ा"
size_medium = "मध्यम"
@@ -2310,12 +2315,16 @@ save_failed = "यह ग्रेडिएंट सेव नहीं हो
save_tooltip = "मौजूदा ग्रेडिएंट सेव करें"
saved = "सेव किए गए"
still = "स्थिर"
+style = "स्टाइल"
+style_dither = "डिथर"
+style_smooth = "स्मूद"
[editor.sidebar.animated_gradient.control]
contrast = "कंट्रास्ट"
curvature = "वक्रता"
detail = "डिटेल"
direction = "दिशा"
+dither_size = "डिथर आकार"
exposure = "एक्सपोज़र"
flow_scale = "फ़्लो स्केल"
flow_strength = "फ़्लो की ताकत"
@@ -2381,6 +2390,23 @@ to = "तक"
[editor.sidebar.image]
prompt = "चुनने के लिए क्लिक करें या इमेज ड्रैग करके छोड़ें"
+[editor.sidebar.input_sounds]
+click_sounds = "क्लिक ध्वनियाँ"
+deep = "गहरी"
+deep_description = "गहरी, गोल आवाज़ वाले लीनियर स्विच।"
+key_sounds = "कुंजी ध्वनियाँ"
+laptop = "लैपटॉप"
+laptop_description = "नरम, उथली लैपटॉप कुंजियाँ।"
+mechanical = "मैकेनिकल"
+mechanical_description = "साफ़, स्पर्शनीय खटखट वाले कुरकुरे स्विच।"
+mouse = "माउस"
+mouse_description = "माउस बटन को दबाना और छोड़ना।"
+trackpad = "ट्रैकपैड"
+trackpad_description = "लैपटॉप ट्रैकपैड का हल्का क्लिक।"
+typewriter = "टाइपराइटर"
+typewriter_description = "टकराती टाइप बार, एंटर पर कैरिज रिटर्न के साथ।"
+volume = "वॉल्यूम"
+
[editor.sidebar.layout]
background_blur = "बैकग्राउंड ब्लर"
custom_position = "कस्टम स्क्रीन पोज़िशन (कैनवास पर ड्रैग की गई)"
@@ -2498,6 +2524,7 @@ frames = { one = "{rendered} / {count} फ़्रेम", other = "{rendered}
generating_preview = "प्रीव्यू बनाया जा रहा है…"
link_unavailable_cursor = "सिर्फ़ कर्सर वाले एक्सपोर्ट को फ़ाइल या क्लिपबोर्ड में ही सेव किया जा सकता है।"
link_unavailable_transparent = "पारदर्शी एक्सपोर्ट को फ़ाइल या क्लिपबोर्ड में ही सेव किया जा सकता है।"
+more_formats = "और"
organization = "संगठन"
preview = "प्रीव्यू"
preview_info = "यह आपके वीडियो का रेंडर किया गया फ़्रेम है। फ़ाइनल एक्सपोर्ट की क्वालिटी देखने के लिए सेटिंग्स बदलें।"
@@ -2545,7 +2572,9 @@ file = "फ़ाइल"
link = "शेयर लिंक"
[editor.export.done]
+copy_file = "क्लिपबोर्ड पर कॉपी करें"
copy_link = "लिंक कॉपी करें"
+file_copied = "कॉपी हो गया"
instant_hint = "अगर आप रोकते ही लिंक चाहते हैं, तो अगली रिकॉर्डिंग के लिए Instant मोड इस्तेमाल करें।"
link_copied = "लिंक कॉपी हो गया"
open_file = "फ़ाइल खोलें"
@@ -2640,14 +2669,16 @@ format = "ट्रैक"
microphone = "माइक्रोफ़ोन"
open_folder = "फ़ोल्डर खोलें"
screen = "स्क्रीन"
+separate = "अलग-अलग ट्रैक"
+separate_description = "स्क्रीन, कैमरा और ऑडियो, हर एक अपनी अलग फ़ाइल में"
studio_only = "अलग-अलग ट्रैक सिर्फ़ Studio मोड में रिकॉर्ड होते हैं।"
system_audio = "सिस्टम ऑडियो"
video_detail = "MP4 · {width}×{height}"
[editor.export.turbo]
title = "टर्बो एक्सपोर्ट"
-description = "हर CPU कोर और GPU का इस्तेमाल करके कहीं तेज़ी से एक्सपोर्ट करता है"
-warning = "एक्सपोर्ट पूरा होने तक आपका पूरा CPU, GPU और कई गुना ज़्यादा मेमोरी इस्तेमाल करता है। दूसरे ऐप्स धीमे हो सकते हैं, और आपका कंप्यूटर गर्म होकर ज़्यादा आवाज़ कर सकता है।"
+description = "आपके कंप्यूटर की ज़्यादा ताक़त इस्तेमाल करके एक्सपोर्ट कहीं तेज़ी से पूरा करता है"
+warning = "एक्सपोर्ट पूरा होने तक दूसरे ऐप्स थोड़े धीमे लग सकते हैं।"
[editor.modal]
cancel_export = "एक्सपोर्ट रद्द करें"
@@ -2714,6 +2745,8 @@ advanced_shadow = "छाया की एडवांस्ड सेटिं
background = "बैकग्राउंड"
corner_style = "कोने की स्टाइल"
custom_position = "कस्टम पोज़िशन (कैनवास पर ड्रैग की गई)"
+empty_description = "रिकॉर्ड करने से पहले कैमरा चुनें, फिर आप उसे यहाँ आकार दे सकते हैं और जगह तय कर सकते हैं।"
+empty_title = "इस रिकॉर्डिंग में कैमरा नहीं है"
hide = "कैमरा छिपाएँ"
keep_size_during_zoom = "ज़ूम के दौरान मूल आकार बनाए रखें"
mirror = "कैमरा मिरर करें"
@@ -2840,12 +2873,16 @@ minimal = "मिनिमल"
minimal_description = "बिना बैकग्राउंड के हल्का आउटलाइन टेक्स्ट।"
pop = "पॉप"
pop_description = "चटक रंग के साथ उभरते मज़ेदार बड़े अक्षर।"
+soft = "सॉफ़्ट"
+soft_description = "कुंजियों से मेल खाता गोल चारकोल कार्ड।"
[editor.tabs.corner]
rounded = "गोल"
squircle = "स्क्वर्कल"
[editor.tabs.cursor]
+empty_description = "इस रिकॉर्डिंग में कर्सर कैप्चर नहीं हुआ, इसलिए अभी स्टाइल करने को कुछ नहीं है।"
+empty_title = "इस रिकॉर्डिंग में कर्सर नहीं है"
follow_hover = "होवर हाइलाइट का अनुसरण करें"
friction = "घर्षण"
hide_when_idle = "निष्क्रिय होने पर छिपाएँ"
@@ -2871,6 +2908,7 @@ smooth = "स्मूथ"
smooth_description = "मुलायम, तैरता हुआ मूवमेंट"
[editor.tabs.keyboard]
+add_to_timeline = "टाइमलाइन में जोड़ें"
animation = "एनिमेशन"
background_color = "बैकग्राउंड रंग"
background_opacity = "बैकग्राउंड अपारदर्शिता"
@@ -2887,18 +2925,38 @@ font_weight = "फ़ॉन्ट वेट"
generate = "कीबोर्ड सेगमेंट बनाएँ"
generating = "कीबोर्ड सेगमेंट बनाए जा रहे हैं..."
grouping_threshold = "ग्रुपिंग सीमा"
+key_style = "की स्टाइल"
+key_theme = "की थीम"
linger_duration = "दिखने की अवधि"
load_failed = "रिकॉर्डिंग डेटा लोड नहीं हो सका: {error}"
no_presses = "कोई रिकॉर्ड किया गया की-प्रेस नहीं मिला।"
position = "पोज़िशन"
regenerate = "कीबोर्ड सेगमेंट दोबारा बनाएँ"
+show_as = "ऐसे दिखाएँ"
show_modifiers = "मॉडिफ़ायर दिखाएँ"
show_special_keys = "विशेष कुंजियाँ दिखाएँ"
+show_typing = "टाइपिंग दिखाएँ"
size_label = "आकार"
+split_keys = "की"
+split_sentence = "वाक्य"
+split_words = "शब्द"
+style_classic = "क्लासिक"
+style_linux = "Linux"
+style_macos = "macOS"
+style_mechanical = "मैकेनिकल"
+style_windows = "Windows"
text_color = "टेक्स्ट रंग"
+theme_dark = "डार्क"
+theme_light = "लाइट"
+theme_retro = "रेट्रो"
timeline_unavailable = "प्रोजेक्ट टाइमलाइन उपलब्ध नहीं है।"
timeline_unreadable = "प्रोजेक्ट टाइमलाइन पढ़ी नहीं जा सकी।"
title = "कीबोर्ड दिखाएँ"
+type_keys = "की टाइप करें"
+type_keys_button = "की टाइप करें…"
+type_keys_hint = "कोई वाक्य, स्क्रिप्ट या ट्रांसक्रिप्ट पेस्ट करें, या cmd+shift+p जैसा शॉर्टकट। यह यहीं से की प्रेस के रूप में टाइप होगा।"
+type_keys_placeholder = "कोई वाक्य, या cmd+k जैसा शॉर्टकट"
+type_keys_summary = "लगभग {seconds} से. की टाइपिंग"
uppercase = "बड़े अक्षर"
[editor.tabs.padding]
@@ -2909,7 +2967,10 @@ proportional = "आनुपातिक"
bottom_center = "नीचे बीच में"
bottom_left = "नीचे बाएँ"
bottom_right = "नीचे दाएँ"
+center = "बीच"
manual = "मैनुअल"
+middle_left = "बीच बाएँ"
+middle_right = "बीच दाएँ"
top_center = "ऊपर बीच में"
top_left = "ऊपर बाएँ"
top_right = "ऊपर दाएँ"
@@ -2979,6 +3040,7 @@ title = "टाइमलाइन"
[editor.timeline.empty]
add_audio = "ऑडियो जोड़ें"
+add_key = "की प्रेस जोड़ें"
add_scene = "सीन जोड़ें"
audio = "बैकग्राउंड म्यूज़िक जोड़ें या अपना ऑडियो इम्पोर्ट करें"
captions = "कोई कैप्शन नहीं"
@@ -3117,6 +3179,7 @@ crop = "क्रॉप"
crop_tooltip = "वीडियो क्रॉप करें"
no_room_for_3d_shot = "एक और 3D शॉट के लिए जगह नहीं है"
no_room_for_caption = "यहाँ एक और कैप्शन के लिए जगह नहीं है"
+no_room_for_key = "यहाँ एक और की प्रेस के लिए जगह नहीं है"
redo = "फिर करें"
save_failed = "{path} सेव नहीं हो सका। एडिटर खुला रखें और फिर से कोशिश करें: {error}"
undo = "पहले जैसा करें"
@@ -3231,6 +3294,26 @@ no_segments = "रिकॉर्डिंग में कोई सेगम
not_found = "वीडियो पाथ {path} नहीं मिला!"
not_studio = "Studio के अलावा दूसरी रिकॉर्डिंग एडिट नहीं की जा सकतीं"
+[editor.window.looks]
+launch_day = "लॉन्च डे"
+launch_day_description = "चटक ग्रेडिएंट, तेज़ ज़ूम और बोल्ड कैप्शन।"
+mac_native = "मैक नेटिव"
+mac_native_description = "Tahoe पर macOS विंडो, सफ़ेद Mac कीज़ के साथ।"
+midnight = "मिडनाइट"
+midnight_description = "गहरा, डार्क बैकड्रॉप और साफ़ किनारा।"
+minimal = "मिनिमल"
+minimal_description = "शांत ऑफ़-व्हाइट कैनवस, और कुछ नहीं।"
+retro_desk = "रेट्रो डेस्क"
+retro_desk_description = "गर्म बेज रंग और मोटी मैकेनिकल कीज़।"
+saved = "आपके प्रीसेट"
+smooth_demo = "स्मूद डेमो"
+smooth_demo_description = "मुलायम बादल, हल्के ज़ूम और शांत कर्सर।"
+title = "लुक्स"
+tutorial = "ट्यूटोरियल"
+tutorial_description = "धीमे, स्थिर ज़ूम और ऐसी कीज़ जिन्हें हर कोई समझ सके।"
+web_product = "वेब प्रोडक्ट"
+web_product_description = "साइट और ऐप डेमो के लिए ब्राउज़र विंडो।"
+
[editor.window.presets]
apply = "लागू करें"
create = "बनाएँ"
@@ -3445,4 +3528,4 @@ no_resumable_state = "इस रिकॉर्डिंग का कोई ऐ
verification_failed = "रिकॉर्डिंग की जाँच विफल हुई: {status}"
[message.cli]
-binary_missing = "{path} पर बंडल की गई CLI नहीं मिली"
\ No newline at end of file
+binary_missing = "{path} पर बंडल की गई CLI नहीं मिली"
diff --git a/apps/desktop-gpui/locales/ja.toml b/apps/desktop-gpui/locales/ja.toml
index 22a68894023..93a51688dab 100644
--- a/apps/desktop-gpui/locales/ja.toml
+++ b/apps/desktop-gpui/locales/ja.toml
@@ -30,6 +30,7 @@ website = "ウェブサイト"
commit = "コミット"
[menu.file]
+new_blank_project = "新しい空のプロジェクト"
open_prompt = "録画を開く"
close_window = "ウインドウを閉じる"
title = "ファイル"
@@ -1065,6 +1066,7 @@ copy_screenshot_failed = "スクリーンショットをコピーできません
import_recordings = "読み込む"
import_screenshots = "画像を読み込む"
importing = "読み込み中"
+new_project = "新規"
no_matching_recordings = "一致する録画はありません"
no_matching_screenshots = "一致するスクリーンショットはありません"
no_recordings = "録画はまだありません"
@@ -1165,6 +1167,7 @@ no_displays = "ディスプレイが見つかりません"
no_matching_displays = "一致するディスプレイはありません"
no_matching_windows = "一致するウィンドウはありません"
no_windows = "ウィンドウが見つかりません"
+solo_title = "カメラまたは音声のみ"
window = "ウィンドウ"
[recordings_overlay]
@@ -1539,6 +1542,8 @@ words_per_minute = "{wpm}語/分"
[import]
audio_failed = "音声を読み込めませんでした: {error}"
+blank_failed = "プロジェクトを作成できませんでした: {error}"
+blank_name = "名称未設定"
error_title = "読み込みエラー"
image_failed = "画像を読み込めませんでした:{error}"
unsupported = "サポートされていないメディアファイルです。"
@@ -1854,9 +1859,9 @@ done = "完了"
import = "ファイルを読み込む"
[editor.audio_only]
-add_visuals = "ビジュアルを追加"
body = "この録音には映像がありません。音声をMP3またはWAVで書き出すか、ビジュアルを追加して動画にできます。"
export_audio = "音声を書き出す"
+make_video = "動画にする"
show_visuals = "ビジュアルを表示"
size_large = "大"
size_medium = "中"
@@ -2310,12 +2315,16 @@ save_failed = "このグラデーションを保存できませんでした。
save_tooltip = "現在のグラデーションを保存"
saved = "保存済み"
still = "静止"
+style = "スタイル"
+style_dither = "ディザ"
+style_smooth = "なめらか"
[editor.sidebar.animated_gradient.control]
contrast = "コントラスト"
curvature = "曲率"
detail = "ディテール"
direction = "方向"
+dither_size = "ディザのサイズ"
exposure = "露出"
flow_scale = "流れの大きさ"
flow_strength = "流れの強さ"
@@ -2381,6 +2390,23 @@ to = "終了"
[editor.sidebar.image]
prompt = "クリックして選択するか、画像をドラッグ&ドロップ"
+[editor.sidebar.input_sounds]
+click_sounds = "クリック音"
+deep = "ディープ"
+deep_description = "低く丸みのある打鍵音のリニアスイッチ。"
+key_sounds = "キー音"
+laptop = "ノートパソコン"
+laptop_description = "柔らかく浅いノートパソコンのキー。"
+mechanical = "メカニカル"
+mechanical_description = "明るく歯切れのよいタクタイルスイッチ。"
+mouse = "マウス"
+mouse_description = "マウスボタンを押して離す音。"
+trackpad = "トラックパッド"
+trackpad_description = "ノートパソコンのトラックパッドの柔らかいクリック。"
+typewriter = "タイプライター"
+typewriter_description = "活字が打たれ、Enterでキャリッジが戻ります。"
+volume = "音量"
+
[editor.sidebar.layout]
background_blur = "背景のぼかし"
custom_position = "カスタムの画面位置(キャンバスでドラッグ)"
@@ -2498,6 +2524,7 @@ frames = { other = "{rendered} / {count}フレーム" }
generating_preview = "プレビューを生成中…"
link_unavailable_cursor = "カーソルのみの書き出しは、ファイルかクリップボードにのみ保存できます。"
link_unavailable_transparent = "透過の書き出しは、ファイルかクリップボードにのみ保存できます。"
+more_formats = "その他"
organization = "組織"
preview = "プレビュー"
preview_info = "動画からレンダリングしたフレームです。設定を調整すると、最終的な書き出しの品質を確認できます。"
@@ -2545,7 +2572,9 @@ file = "ファイル"
link = "共有リンク"
[editor.export.done]
+copy_file = "クリップボードにコピー"
copy_link = "リンクをコピー"
+file_copied = "コピーしました"
instant_hint = "停止した瞬間にリンクが欲しい場合は、次の録画でInstantモードを使ってください。"
link_copied = "リンクをコピーしました"
open_file = "ファイルを開く"
@@ -2640,14 +2669,16 @@ format = "トラック"
microphone = "マイク"
open_folder = "フォルダを開く"
screen = "画面"
+separate = "個別のトラック"
+separate_description = "画面、カメラ、音声をそれぞれ別のファイルに"
studio_only = "個別のトラックはStudioモードでのみ録画されます。"
system_audio = "システム音声"
video_detail = "MP4 · {width}×{height}"
[editor.export.turbo]
title = "ターボ書き出し"
-description = "すべてのCPUコアとGPUを使って、はるかに高速に書き出します"
-warning = "書き出しが終わるまで、CPUとGPUをすべて使い、メモリも数倍多く消費します。ほかのアプリの動作が遅くなったり、コンピュータが熱くなってファンの音が大きくなったりすることがあります。"
+description = "コンピュータの性能をより多く使って、書き出しをはるかに速く終えます"
+warning = "書き出しが終わるまで、ほかのアプリが少し遅く感じられることがあります。"
[editor.modal]
cancel_export = "書き出しをキャンセル"
@@ -2714,6 +2745,8 @@ advanced_shadow = "影の詳細設定"
background = "背景"
corner_style = "角のスタイル"
custom_position = "カスタム位置(キャンバス上でドラッグ)"
+empty_description = "録画の前にカメラを選ぶと、ここで形や位置を調整できます。"
+empty_title = "この録画にはカメラがありません"
hide = "カメラを非表示"
keep_size_during_zoom = "ズーム中も元のサイズを保つ"
mirror = "カメラを反転"
@@ -2840,12 +2873,16 @@ minimal = "ミニマル"
minimal_description = "背景なしの控えめな縁取りテキスト。"
pop = "ポップ"
pop_description = "鮮やかなアクセントで飛び出す遊び心のある大文字。"
+soft = "ソフト"
+soft_description = "キーと揃えた、角の丸いチャコールのカード。"
[editor.tabs.corner]
rounded = "角丸"
squircle = "スクワークル"
[editor.tabs.cursor]
+empty_description = "この録画ではカーソルが記録されなかったため、調整できる項目はまだありません。"
+empty_title = "この録画にはカーソルがありません"
follow_hover = "ホバー表示に合わせる"
friction = "摩擦"
hide_when_idle = "操作がないときは非表示"
@@ -2871,6 +2908,7 @@ smooth = "なめらか"
smooth_description = "柔らかく浮遊するような動き"
[editor.tabs.keyboard]
+add_to_timeline = "タイムラインに追加"
animation = "アニメーション"
background_color = "背景色"
background_opacity = "背景の不透明度"
@@ -2887,18 +2925,38 @@ font_weight = "フォントの太さ"
generate = "キーボードセグメントを生成"
generating = "キーボードセグメントを生成中..."
grouping_threshold = "グループ化のしきい値"
+key_style = "キーのスタイル"
+key_theme = "キーのテーマ"
linger_duration = "表示を残す時間"
load_failed = "録画データを読み込めませんでした:{error}"
no_presses = "記録されたキー入力が見つかりませんでした。"
position = "位置"
regenerate = "キーボードセグメントを再生成"
+show_as = "表示方法"
show_modifiers = "修飾キーを表示"
show_special_keys = "特殊キーを表示"
+show_typing = "入力した文字を表示"
size_label = "サイズ"
+split_keys = "キー"
+split_sentence = "文章"
+split_words = "単語"
+style_classic = "クラシック"
+style_linux = "Linux"
+style_macos = "macOS"
+style_mechanical = "メカニカル"
+style_windows = "Windows"
text_color = "テキストの色"
+theme_dark = "ダーク"
+theme_light = "ライト"
+theme_retro = "レトロ"
timeline_unavailable = "プロジェクトのタイムラインを利用できません。"
timeline_unreadable = "プロジェクトのタイムラインを読み込めませんでした。"
title = "キーボードを表示"
+type_keys = "キーを入力"
+type_keys_button = "キーを入力…"
+type_keys_hint = "文章、台本、文字起こし、または cmd+shift+p のようなショートカットを貼り付けます。ここからキー入力として打ち込まれます。"
+type_keys_placeholder = "文章、または cmd+k のようなショートカット"
+type_keys_summary = "入力は約 {seconds} 秒"
uppercase = "大文字"
[editor.tabs.padding]
@@ -2909,7 +2967,10 @@ proportional = "比例"
bottom_center = "下中央"
bottom_left = "左下"
bottom_right = "右下"
+center = "中央"
manual = "手動"
+middle_left = "中央左"
+middle_right = "中央右"
top_center = "上中央"
top_left = "左上"
top_right = "右上"
@@ -2979,6 +3040,7 @@ title = "タイムライン"
[editor.timeline.empty]
add_audio = "音声を追加"
+add_key = "キー入力を追加"
add_scene = "シーンを追加"
audio = "BGMを追加するか、自分の音声を読み込みます"
captions = "字幕なし"
@@ -3117,6 +3179,7 @@ crop = "切り抜き"
crop_tooltip = "動画を切り抜く"
no_room_for_3d_shot = "別の3Dショットを入れる余地がありません"
no_room_for_caption = "ここには字幕を追加する余地がありません"
+no_room_for_key = "ここには別のキー入力を置く場所がありません"
redo = "やり直す"
save_failed = "{path}を保存できませんでした。エディタを開いたまま、もう一度お試しください:{error}"
undo = "取り消す"
@@ -3231,6 +3294,26 @@ no_segments = "録画にセグメントがありません。先に復元が必
not_found = "動画のパス{path}が見つかりません!"
not_studio = "Studio以外の録画は編集できません"
+[editor.window.looks]
+launch_day = "ローンチデー"
+launch_day_description = "鮮やかなグラデーション、きびきびしたズーム、目立つ字幕。"
+mac_native = "Macネイティブ"
+mac_native_description = "Tahoe上のmacOSウインドウと白いMacのキー。"
+midnight = "ミッドナイト"
+midnight_description = "深く暗い背景に、くっきりした縁取り。"
+minimal = "ミニマル"
+minimal_description = "静かなオフホワイトのキャンバスだけ。"
+retro_desk = "レトロデスク"
+retro_desk_description = "温かみのあるベージュと厚みのあるメカニカルキー。"
+saved = "保存したプリセット"
+smooth_demo = "スムーズデモ"
+smooth_demo_description = "やわらかな雲、穏やかなズーム、落ち着いたカーソル。"
+title = "ルック"
+tutorial = "チュートリアル"
+tutorial_description = "ゆっくり安定したズームと、誰でも追えるキー表示。"
+web_product = "Webプロダクト"
+web_product_description = "サイトやアプリのデモ向けのブラウザウインドウ。"
+
[editor.window.presets]
apply = "適用"
create = "作成"
@@ -3445,4 +3528,4 @@ no_resumable_state = "この録画には再開できるアップロード状態
verification_failed = "録画の確認に失敗しました:{status}"
[message.cli]
-binary_missing = "{path}に同梱のCLIが見つかりません"
\ No newline at end of file
+binary_missing = "{path}に同梱のCLIが見つかりません"
diff --git a/apps/desktop-gpui/locales/zh-CN.toml b/apps/desktop-gpui/locales/zh-CN.toml
index 562853b82cb..6e2b74a582f 100644
--- a/apps/desktop-gpui/locales/zh-CN.toml
+++ b/apps/desktop-gpui/locales/zh-CN.toml
@@ -30,6 +30,7 @@ website = "网站"
commit = "提交"
[menu.file]
+new_blank_project = "新建空白项目"
open_prompt = "打开录制"
close_window = "关闭窗口"
title = "文件"
@@ -1065,6 +1066,7 @@ copy_screenshot_failed = "无法复制截图"
import_recordings = "导入"
import_screenshots = "导入图片"
importing = "正在导入"
+new_project = "新建"
no_matching_recordings = "没有匹配的录制"
no_matching_screenshots = "没有匹配的截图"
no_recordings = "还没有录制"
@@ -1165,6 +1167,7 @@ no_displays = "未找到屏幕"
no_matching_displays = "没有匹配的屏幕"
no_matching_windows = "没有匹配的窗口"
no_windows = "未找到窗口"
+solo_title = "仅摄像头或音频"
window = "窗口"
[recordings_overlay]
@@ -1539,6 +1542,8 @@ words_per_minute = "{wpm} 字/分钟"
[import]
audio_failed = "无法导入音频:{error}"
+blank_failed = "无法创建项目:{error}"
+blank_name = "未命名"
error_title = "导入错误"
image_failed = "无法导入图像:{error}"
unsupported = "不支持的媒体文件。"
@@ -1854,9 +1859,9 @@ done = "完成"
import = "导入文件"
[editor.audio_only]
-add_visuals = "添加视觉效果"
body = "此录制没有视频。可将声音导出为 MP3 或 WAV,或添加视觉效果把它变成视频。"
export_audio = "导出音频"
+make_video = "做成视频"
show_visuals = "显示视觉效果"
size_large = "大"
size_medium = "中"
@@ -2310,12 +2315,16 @@ save_failed = "无法保存此渐变。请重试。"
save_tooltip = "保存当前渐变"
saved = "已保存"
still = "静止"
+style = "样式"
+style_dither = "抖动"
+style_smooth = "平滑"
[editor.sidebar.animated_gradient.control]
contrast = "对比度"
curvature = "弯曲度"
detail = "细节"
direction = "方向"
+dither_size = "抖动大小"
exposure = "曝光"
flow_scale = "流动尺度"
flow_strength = "流动强度"
@@ -2381,6 +2390,23 @@ to = "结束"
[editor.sidebar.image]
prompt = "点击选择或拖放图片"
+[editor.sidebar.input_sounds]
+click_sounds = "点击音效"
+deep = "低沉"
+deep_description = "声音低沉圆润的线性轴。"
+key_sounds = "按键音效"
+laptop = "笔记本"
+laptop_description = "柔和、键程短的笔记本键盘。"
+mechanical = "机械"
+mechanical_description = "清脆明亮、段落感强的机械轴。"
+mouse = "鼠标"
+mouse_description = "按下并松开鼠标按键的声音。"
+trackpad = "触控板"
+trackpad_description = "笔记本触控板更柔和的点击声。"
+typewriter = "打字机"
+typewriter_description = "字锤敲击,按回车时托架复位。"
+volume = "音量"
+
[editor.sidebar.layout]
background_blur = "背景模糊"
custom_position = "自定义屏幕位置(在画布上拖动)"
@@ -2498,6 +2524,7 @@ frames = { other = "{rendered} / {count} 帧" }
generating_preview = "正在生成预览…"
link_unavailable_cursor = "仅导出光标时,只能保存到文件或剪贴板。"
link_unavailable_transparent = "透明导出只能保存到文件或剪贴板。"
+more_formats = "更多"
organization = "组织"
preview = "预览"
preview_info = "这是从你的视频渲染出的一帧。调整设置即可查看最终导出的画质。"
@@ -2545,7 +2572,9 @@ file = "文件"
link = "分享链接"
[editor.export.done]
+copy_file = "复制到剪贴板"
copy_link = "复制链接"
+file_copied = "已复制"
instant_hint = "如果想在停止录制时立即获得链接,下次录制请使用 Instant 模式。"
link_copied = "链接已复制"
open_file = "打开文件"
@@ -2640,14 +2669,16 @@ format = "轨道"
microphone = "麦克风"
open_folder = "打开文件夹"
screen = "屏幕"
+separate = "单独的轨道"
+separate_description = "屏幕、摄像头和音频分别保存为单独的文件"
studio_only = "只有 Studio 模式会录制单独的轨道。"
system_audio = "系统音频"
video_detail = "MP4 · {width}×{height}"
[editor.export.turbo]
title = "极速导出"
-description = "使用所有 CPU 核心和 GPU,大幅加快导出"
-warning = "导出完成前会占用全部 CPU、GPU 以及数倍的内存。其他应用可能会变慢,电脑也可能发热、风扇声变大。"
+description = "调用更多电脑性能,大幅加快导出"
+warning = "导出完成前,其他应用可能会稍慢一些。"
[editor.modal]
cancel_export = "取消导出"
@@ -2714,6 +2745,8 @@ advanced_shadow = "高级阴影设置"
background = "背景"
corner_style = "圆角样式"
custom_position = "自定义位置(在画布上拖动)"
+empty_description = "录制前选择摄像头,即可在这里调整它的形状和位置。"
+empty_title = "此录制中没有摄像头"
hide = "隐藏摄像头"
keep_size_during_zoom = "缩放时保持原始大小"
mirror = "镜像摄像头"
@@ -2840,12 +2873,16 @@ minimal = "极简"
minimal_description = "无背景的低调描边文字。"
pop = "跳跃"
pop_description = "活泼的大写文字,以鲜艳的强调色弹出。"
+soft = "柔和"
+soft_description = "与按键相配的圆角炭灰卡片。"
[editor.tabs.corner]
rounded = "圆角"
squircle = "超椭圆"
[editor.tabs.cursor]
+empty_description = "此录制没有捕获光标,所以暂时没有可调整的内容。"
+empty_title = "此录制中没有光标"
follow_hover = "跟随悬停高亮"
friction = "摩擦"
hide_when_idle = "空闲时隐藏"
@@ -2871,6 +2908,7 @@ smooth = "顺滑"
smooth_description = "柔软、轻盈的移动"
[editor.tabs.keyboard]
+add_to_timeline = "添加到时间线"
animation = "动画"
background_color = "背景颜色"
background_opacity = "背景不透明度"
@@ -2887,18 +2925,38 @@ font_weight = "字重"
generate = "生成键盘分段"
generating = "正在生成键盘分段..."
grouping_threshold = "分组阈值"
+key_style = "按键样式"
+key_theme = "按键主题"
linger_duration = "停留时长"
load_failed = "无法加载录制数据:{error}"
no_presses = "未找到录制的按键。"
position = "位置"
regenerate = "重新生成键盘分段"
+show_as = "显示方式"
show_modifiers = "显示修饰键"
show_special_keys = "显示特殊键"
+show_typing = "显示输入内容"
size_label = "大小"
+split_keys = "按键"
+split_sentence = "整句"
+split_words = "单词"
+style_classic = "经典"
+style_linux = "Linux"
+style_macos = "macOS"
+style_mechanical = "机械"
+style_windows = "Windows"
text_color = "文字颜色"
+theme_dark = "深色"
+theme_light = "浅色"
+theme_retro = "复古"
timeline_unavailable = "项目时间线不可用。"
timeline_unreadable = "无法读取项目时间线。"
title = "显示键盘"
+type_keys = "输入按键"
+type_keys_button = "输入按键…"
+type_keys_hint = "粘贴一句话、脚本或文字稿,或 cmd+shift+p 这样的快捷键。将从这里开始以按键形式打出。"
+type_keys_placeholder = "一句话,或 cmd+k 这样的快捷键"
+type_keys_summary = "约 {seconds} 秒的输入"
uppercase = "大写"
[editor.tabs.padding]
@@ -2909,7 +2967,10 @@ proportional = "按比例"
bottom_center = "底部居中"
bottom_left = "左下"
bottom_right = "右下"
+center = "居中"
manual = "手动"
+middle_left = "中左"
+middle_right = "中右"
top_center = "顶部居中"
top_left = "左上"
top_right = "右上"
@@ -2979,6 +3040,7 @@ title = "时间线"
[editor.timeline.empty]
add_audio = "添加音频"
+add_key = "添加按键"
add_scene = "添加场景"
audio = "添加背景音乐或导入你自己的音频"
captions = "没有字幕"
@@ -3117,6 +3179,7 @@ crop = "裁剪"
crop_tooltip = "裁剪视频"
no_room_for_3d_shot = "没有空间再添加 3D 镜头"
no_room_for_caption = "这里没有空间再添加字幕"
+no_room_for_key = "这里放不下另一个按键"
redo = "重做"
save_failed = "无法保存 {path}。请保持编辑器打开并重试:{error}"
undo = "撤销"
@@ -3231,6 +3294,26 @@ no_segments = "录制没有分段。可能需要先恢复。"
not_found = "找不到视频路径 {path}!"
not_studio = "无法编辑非 Studio 录制"
+[editor.window.looks]
+launch_day = "发布日"
+launch_day_description = "鲜明的渐变、利落的缩放和醒目的字幕。"
+mac_native = "原生 Mac"
+mac_native_description = "Tahoe 壁纸上的 macOS 窗口,配白色 Mac 键帽。"
+midnight = "午夜"
+midnight_description = "深邃的暗色背景,边缘清晰。"
+minimal = "极简"
+minimal_description = "安静的米白画布,别无其他。"
+retro_desk = "复古桌面"
+retro_desk_description = "温暖的米色和厚实的机械键帽。"
+saved = "你的预设"
+smooth_demo = "流畅演示"
+smooth_demo_description = "柔和的云朵、轻缓的缩放和平稳的光标。"
+title = "风格"
+tutorial = "教程"
+tutorial_description = "缓慢平稳的缩放,按键一目了然。"
+web_product = "网页产品"
+web_product_description = "适合网站和应用演示的浏览器窗口。"
+
[editor.window.presets]
apply = "应用"
create = "创建"
@@ -3445,4 +3528,4 @@ no_resumable_state = "此录制没有可继续的上传状态"
verification_failed = "录制验证失败:{status}"
[message.cli]
-binary_missing = "未在 {path} 找到内置的 CLI 程序"
\ No newline at end of file
+binary_missing = "未在 {path} 找到内置的 CLI 程序"
diff --git a/apps/desktop-gpui/src/assets.rs b/apps/desktop-gpui/src/assets.rs
index eb091cc85e5..4bc02c91b45 100644
--- a/apps/desktop-gpui/src/assets.rs
+++ b/apps/desktop-gpui/src/assets.rs
@@ -183,7 +183,6 @@ const ICONS: &[(&str, &[u8])] = assets!("icons":
"refresh-cw.svg",
"rotate-ccw.svg",
"volume-x.svg",
- "gem.svg",
"sliders-horizontal.svg",
"zap.svg",
"zoom-in.svg",
diff --git a/apps/desktop-gpui/src/audio_project.rs b/apps/desktop-gpui/src/audio_project.rs
index e939373198a..d1b502ef5ec 100644
--- a/apps/desktop-gpui/src/audio_project.rs
+++ b/apps/desktop-gpui/src/audio_project.rs
@@ -5,7 +5,9 @@ use std::{
use cap_export::{
audio::AudioExportFormat,
- audio_project::{AudioProjectError, AudioProjectSources, create_audio_only_project},
+ audio_project::{
+ AudioProjectError, AudioProjectSources, create_audio_only_project, create_blank_project,
+ },
};
use gpui::{App, Window};
@@ -49,6 +51,43 @@ pub fn open_audio_in_editor(sources: AudioProjectSources, pretty_name: String, c
.detach();
}
+/// Creates an empty Studio project in the recordings folder, with nothing
+/// recorded, and opens it in the editor to build a video from a background,
+/// music, keys, text and images. A failure is reported in a dialog.
+pub fn open_blank_in_editor(cx: &mut App) {
+ let pretty_name = tr::import::blank_name().to_string();
+ let created = cx.background_executor().spawn(async move {
+ let recordings_dir = crate::recording::recordings_dir();
+ std::fs::create_dir_all(&recordings_dir).map_err(|error| error.to_string())?;
+ let folder = sanitize_filename::sanitize(&pretty_name);
+ let mut attempts = 0;
+ loop {
+ let name =
+ cap_utils::ensure_unique_filename(&format!("{folder}.cap"), &recordings_dir)?;
+ let project_path = recordings_dir.join(name);
+ match create_blank_project(&project_path, &pretty_name) {
+ Ok(_) => break Ok(project_path),
+ Err(AudioProjectError::Exists(_)) if attempts < 8 => attempts += 1,
+ Err(error) => break Err(error.to_string()),
+ }
+ }
+ });
+ cx.spawn(async move |cx| match created.await {
+ Ok(project_path) => {
+ tracing::info!(path = %project_path.display(), "created a blank project");
+ cx.update(|cx| {
+ crate::import::refresh_libraries(cx);
+ app_windows::open_editor(project_path, cx);
+ });
+ }
+ Err(error) => {
+ tracing::error!(error, "could not create a blank project");
+ crate::import::show_error_dialog(tr::import::blank_failed(&error));
+ }
+ })
+ .detach();
+}
+
/// Asks where to save, then writes the project's edited sound there as MP3,
/// or WAV when the chosen name ends in `.wav`.
pub fn save_audio_as(project_path: PathBuf, window: &mut Window, cx: &mut App) {
diff --git a/apps/desktop-gpui/src/editor_audio_only.rs b/apps/desktop-gpui/src/editor_audio_only.rs
index e1b9bb84ff8..dfcdb86029f 100644
--- a/apps/desktop-gpui/src/editor_audio_only.rs
+++ b/apps/desktop-gpui/src/editor_audio_only.rs
@@ -1,12 +1,15 @@
use std::sync::Arc;
-use cap_project::{AudioVisualizerStyle, AudioVisualsConfiguration};
+use cap_project::{
+ AnimatedGradientConfig, AudioVisualizerStyle, AudioVisualsConfiguration, BackgroundSource,
+};
use cap_rendering::AudioLevels;
use gpui::{
AnyElement, Context, FontWeight, Hsla, InteractiveElement, IntoElement, ParentElement,
- StatefulInteractiveElement, Styled, Window, div, prelude::FluentBuilder, px, svg,
+ StatefulInteractiveElement, Styled, Window, div, prelude::FluentBuilder, px,
};
+use crate::editor_sidebar::SelectionRing as _;
use crate::editor_window::EditorWindow;
use crate::i18n::tr;
use crate::ui;
@@ -71,7 +74,7 @@ impl EditorWindow {
}
/// `CAP_GPUI_AUTO_AUDIO_VISUALS=bars|wave|circle`: turn visuals on the way
- /// Add Visuals does, for the automated export checks.
+ /// a visualiser tile does, for the automated export checks.
pub(crate) fn enable_audio_visuals_for_automation(
&mut self,
style: &str,
@@ -90,6 +93,105 @@ impl EditorWindow {
});
}
+ /// Turns visuals on in `style` in one step. A project still on the plain
+ /// background a recording starts with gets the animated one, so the
+ /// first look is already a video worth exporting.
+ fn show_visuals(
+ &mut self,
+ style: AudioVisualizerStyle,
+ window: &mut Window,
+ cx: &mut Context,
+ ) {
+ let plain = matches!(
+ self.project.background.source,
+ BackgroundSource::Color {
+ value: [255, 255, 255],
+ alpha: 255
+ }
+ );
+ self.edit_project_without_timeline("audio-visuals-style", window, cx, move |project| {
+ let before = project.audio_visuals.clone();
+ if plain {
+ project.background.source = BackgroundSource::AnimatedGradient {
+ config: AnimatedGradientConfig::default(),
+ };
+ }
+ let background = &project.background.source;
+ let visuals = project.audio_visuals.get_or_insert_with(|| {
+ Box::new(AudioVisualsConfiguration::for_background(background))
+ });
+ visuals.enabled = true;
+ visuals.style = style;
+ plain || project.audio_visuals != before
+ });
+ if plain {
+ self.sidebar.source_tab = crate::editor_sidebar::SourceTab::AnimatedGradient;
+ }
+ }
+
+ /// One tile per visualiser, each drawing its look in small so the choice
+ /// is seen before it is made. `selected` rings the one showing.
+ fn render_visualizer_tiles(
+ &self,
+ selected: Option,
+ tile_height: f32,
+ cx: &mut Context,
+ ) -> AnyElement {
+ let theme = self.theme;
+ let editor = theme.editor;
+ div()
+ .flex()
+ .flex_row()
+ .gap(px(8.))
+ .w_full()
+ .children(AudioVisualizerStyle::ALL.iter().map(|&style| {
+ let chosen = selected == Some(style);
+ div()
+ .id(gpui::SharedString::from(format!(
+ "audio-visualizer-{style:?}"
+ )))
+ .flex_1()
+ .min_w_0()
+ .flex()
+ .flex_col()
+ .gap(px(8.))
+ .p(px(6.))
+ .pb(px(10.))
+ .rounded(px(12.))
+ .map(|this| {
+ if chosen {
+ this.bg(editor.pill_fill())
+ .shadow(editor.choice_selected_shadow())
+ } else {
+ this.bg(Hsla::from(editor.ctl))
+ .shadow(editor.trough_ring())
+ .cursor_pointer()
+ .hover(move |this| this.bg(Hsla::from(editor.ctl_hover)))
+ }
+ })
+ .child(visualizer_preview(style, tile_height))
+ .child(
+ div()
+ .w_full()
+ .text_center()
+ .text_size(px(12.))
+ .text_color(Hsla::from(if chosen {
+ editor.text_1
+ } else {
+ editor.text_2
+ }))
+ .child(style_label(style)),
+ )
+ .on_click(cx.listener(move |this, _, window, cx| {
+ this.show_visuals(style, window, cx);
+ }))
+ }))
+ .into_any_element()
+ }
+
+ /// Shown in place of the preview while an audio-only project has no
+ /// visuals: its sound, a way out as audio, and the visualisers it can
+ /// become, each one click away.
pub(crate) fn render_audio_card(&self, cx: &mut Context) -> AnyElement {
let theme = self.theme;
let editor = theme.editor;
@@ -100,27 +202,26 @@ impl EditorWindow {
0.0
};
let bars = card_bars(self.audio_levels.as_deref(), &self.project, CARD_BARS);
- let played = Hsla::from(editor.accent);
+ let played = Hsla::from(editor.text_1);
let unplayed = Hsla::from(editor.text_3);
- let waveform =
- div()
- .h(px(96.))
- .w_full()
- .flex()
- .flex_row()
- .items_center()
- .justify_between()
- .children(bars.into_iter().enumerate().map(move |(index, level)| {
- let position = (index as f32 + 0.5) / CARD_BARS as f32;
- div().w(px(3.)).h(px(4. + 88. * level)).rounded_full().bg(
- if position <= progress {
- played
- } else {
- unplayed
- },
- )
- }));
+ let waveform = div()
+ .h(px(88.))
+ .w_full()
+ .flex()
+ .flex_row()
+ .items_center()
+ .justify_between()
+ .children(bars.into_iter().enumerate().map(move |(index, level)| {
+ let position = (index as f32 + 0.5) / CARD_BARS as f32;
+ div().w(px(2.5)).h(px(3. + 82. * level)).rounded_full().bg(
+ if position <= progress {
+ played
+ } else {
+ unplayed
+ },
+ )
+ }));
div()
.debug_selector(|| "editor-audio-card".into())
@@ -132,62 +233,43 @@ impl EditorWindow {
.child(
div()
.w_full()
- .max_w(px(640.))
+ .max_w(px(560.))
.flex()
.flex_col()
- .items_center()
- .gap(px(22.))
+ .gap(px(28.))
.child(
div()
.flex()
- .flex_col()
- .items_center()
- .gap(px(6.))
+ .flex_row()
+ .items_end()
+ .justify_between()
+ .gap(px(16.))
.child(
div()
- .size(px(44.))
- .rounded(px(14.))
.flex()
- .items_center()
- .justify_center()
- .bg(Hsla::from(editor.seg_fill(gpui::rgb(
- crate::editor_timeline::track_color::AUDIO,
- ))))
+ .flex_col()
+ .gap(px(4.))
+ .min_w_0()
.child(
- svg()
- .path("icons/microphone.svg")
- .size(px(20.))
- .text_color(Hsla::from(editor.text_1)),
+ div()
+ .text_size(px(17.))
+ .font_weight(FontWeight::MEDIUM)
+ .text_color(Hsla::from(editor.text_1))
+ .child(tr::editor::audio_only::title()),
+ )
+ .child(
+ div()
+ .text_size(px(13.))
+ .text_color(Hsla::from(editor.text_2))
+ .child(tr::editor::audio_only::body()),
),
)
- .child(
- div()
- .text_size(px(17.))
- .font_weight(FontWeight::MEDIUM)
- .text_color(Hsla::from(editor.text_1))
- .child(tr::editor::audio_only::title()),
- )
- .child(
- div()
- .max_w(px(420.))
- .text_center()
- .text_size(px(13.))
- .text_color(Hsla::from(editor.text_2))
- .child(tr::editor::audio_only::body()),
- ),
- )
- .child(waveform)
- .child(
- div()
- .flex()
- .flex_row()
- .gap(px(10.))
.child(
ui::Button::plain(
&theme,
"audio-only-export",
ui::ButtonVariant::Blue,
- ui::ButtonSize::Lg,
+ ui::ButtonSize::Md,
)
.icon("icons/music.svg")
.label(tr::editor::audio_only::export_audio())
@@ -196,32 +278,30 @@ impl EditorWindow {
this.open_export(window, cx);
},
)),
- )
- .child(
- ui::Button::plain(
- &theme,
- "audio-only-add-visuals",
- ui::ButtonVariant::Outline,
- ui::ButtonSize::Lg,
- )
- .icon("icons/image.svg")
- .label(tr::editor::audio_only::add_visuals())
- .on_click(cx.listener(
- |this, _, window, cx| {
- this.edit_audio_visuals(
- "audio-visuals-on",
- window,
- cx,
- |visuals| visuals.enabled = true,
- );
- },
- )),
),
+ )
+ .child(waveform)
+ .child(
+ div()
+ .flex()
+ .flex_col()
+ .gap(px(10.))
+ .child(
+ div()
+ .text_size(px(13.))
+ .font_weight(FontWeight::MEDIUM)
+ .text_color(Hsla::from(editor.text_1))
+ .child(tr::editor::audio_only::make_video()),
+ )
+ .child(self.render_visualizer_tiles(None, 64., cx)),
),
)
.into_any_element()
}
+ /// The visualiser, at the top of the Background tab so the background it
+ /// stands on is right below: a switch in the header, the looks as tiles,
+ /// then its size and colour once it shows.
pub(crate) fn render_audio_visuals_card(&self, cx: &mut Context) -> Option {
if !self.is_audio_only() {
return None;
@@ -230,7 +310,6 @@ impl EditorWindow {
let editor = theme.editor;
let visuals = self.project.audio_visuals.clone().unwrap_or_default();
let enabled = visuals.enabled;
- let styles = AudioVisualizerStyle::ALL;
let size_index = VISUALIZER_SIZES
.iter()
.enumerate()
@@ -249,16 +328,17 @@ impl EditorWindow {
.id(gpui::SharedString::from(format!(
"audio-visualizer-color-{color}"
)))
- .size(px(24.))
.rounded_full()
- .border_2()
- .border_color(if selected {
- Hsla::from(editor.accent)
- } else {
- Hsla::from(editor.line)
- })
- .bg(fill)
+ .selection_ring(Hsla::from(editor.card), editor.accent, selected)
.cursor_pointer()
+ .child(
+ div()
+ .size(px(20.))
+ .rounded_full()
+ .bg(fill)
+ .border_1()
+ .border_color(Hsla::from(editor.line)),
+ )
.on_click(cx.listener({
let color = color.to_string();
move |this, _, window, cx| {
@@ -275,92 +355,143 @@ impl EditorWindow {
}))
.into_any_element()
});
+ let swatches: Vec = swatches.collect();
+ let tiles = self.render_visualizer_tiles(enabled.then_some(visuals.style), 48., cx);
Some(
ui::Field::section(&theme, tr::editor::audio_only::visuals())
- .child(
- ui::Subfield::plain(&theme, tr::editor::audio_only::show_visuals()).child(
- ui::Toggle::plain(&theme, "audio-visuals-enabled", enabled).on_click(
- cx.listener(move |this, _, window, cx| {
+ .value(
+ ui::Toggle::plain(&theme, "audio-visuals-enabled", enabled)
+ .label(tr::editor::audio_only::show_visuals())
+ .on_click(cx.listener(move |this, _, window, cx| {
+ if enabled {
this.edit_audio_visuals(
"audio-visuals-enabled",
window,
cx,
- move |visuals| visuals.enabled = !enabled,
+ |visuals| visuals.enabled = false,
);
- }),
- ),
- ),
+ } else {
+ let style = this
+ .project
+ .audio_visuals
+ .as_ref()
+ .map_or(AudioVisualizerStyle::Bars, |visuals| visuals.style);
+ this.show_visuals(style, window, cx);
+ }
+ }))
+ .into_any_element(),
)
- .when(enabled, |field| {
- field
- .child(
- ui::SegmentedControl::editor(
- &theme,
- "audio-visualizer-style",
- styles
- .iter()
- .map(|style| {
- ui::SegmentOption::new(
- style_label(*style),
- *style == visuals.style,
- )
+ .child(
+ div()
+ .flex()
+ .flex_col()
+ .gap(px(12.))
+ .child(tiles)
+ .when(enabled, |this| {
+ this.child(
+ ui::SegmentedControl::editor(
+ &theme,
+ "audio-visualizer-size",
+ [
+ tr::editor::audio_only::size_small(),
+ tr::editor::audio_only::size_medium(),
+ tr::editor::audio_only::size_large(),
+ ]
+ .into_iter()
+ .enumerate()
+ .map(|(index, label)| {
+ ui::SegmentOption::new(label, index == size_index)
})
.collect(),
+ )
+ .stretch()
+ .on_select(cx.listener(
+ |this, index: &usize, window, cx| {
+ let Some(size) = VISUALIZER_SIZES.get(*index).copied()
+ else {
+ return;
+ };
+ this.edit_audio_visuals(
+ "audio-visuals-size",
+ window,
+ cx,
+ move |visuals| visuals.size = size,
+ );
+ },
+ )),
)
- .stretch()
- .on_select(cx.listener(
- move |this, index: &usize, window, cx| {
- let Some(style) = styles.get(*index).copied() else {
- return;
- };
- this.edit_audio_visuals(
- "audio-visuals-style",
- window,
- cx,
- move |visuals| visuals.style = style,
- );
- },
- )),
- )
- .child(
- ui::SegmentedControl::editor(
- &theme,
- "audio-visualizer-size",
- [
- tr::editor::audio_only::size_small(),
- tr::editor::audio_only::size_medium(),
- tr::editor::audio_only::size_large(),
- ]
- .into_iter()
- .enumerate()
- .map(|(index, label)| {
- ui::SegmentOption::new(label, index == size_index)
- })
- .collect(),
+ .child(
+ div()
+ .flex()
+ .flex_row()
+ .items_center()
+ .gap(px(10.))
+ .px(px(2.))
+ .children(swatches),
)
- .stretch()
- .on_select(cx.listener(
- |this, index: &usize, window, cx| {
- let Some(size) = VISUALIZER_SIZES.get(*index).copied() else {
- return;
- };
- this.edit_audio_visuals(
- "audio-visuals-size",
- window,
- cx,
- move |visuals| visuals.size = size,
- );
- },
- )),
- )
- .child(div().flex().flex_row().gap(px(8.)).children(swatches))
- })
+ }),
+ )
.into_any_element(),
)
}
}
+/// A visualiser's look in small, white over the animated background's own
+/// palette, so a tile reads as the video it makes.
+fn visualizer_preview(style: AudioVisualizerStyle, height: f32) -> gpui::Div {
+ let surface = div()
+ .relative()
+ .w_full()
+ .h(px(height))
+ .rounded(px(8.))
+ .overflow_hidden()
+ .bg(gpui::linear_gradient(
+ 135.,
+ gpui::linear_color_stop(gpui::rgb(0x6f9bf5), 0.),
+ gpui::linear_color_stop(gpui::rgb(0x9a7ff5), 1.),
+ ));
+ let ink = gpui::hsla(0., 0., 1., 0.95);
+ match style {
+ AudioVisualizerStyle::Bars => surface.flex().items_center().justify_center().child(
+ div().flex().flex_row().items_center().gap(px(3.)).children(
+ [0.35, 0.6, 0.9, 0.55, 1.0, 0.7, 0.45, 0.8, 0.5, 0.3]
+ .into_iter()
+ .map(move |level: f32| {
+ div()
+ .w(px(3.))
+ .h(px(4. + (height * 0.55) * level))
+ .rounded_full()
+ .bg(ink)
+ }),
+ ),
+ ),
+ AudioVisualizerStyle::Wave => surface.children((0..22).map(move |index| {
+ let t = index as f32 / 21.;
+ let y = height * 0.5 + (t * std::f32::consts::TAU * 1.5).sin() * height * 0.22;
+ div()
+ .absolute()
+ .left(gpui::relative(0.08 + t * 0.84))
+ .top(px(y - 1.5))
+ .size(px(3.))
+ .rounded_full()
+ .bg(ink)
+ })),
+ AudioVisualizerStyle::Circle => surface.children((0..18).map(move |index| {
+ let angle = index as f32 / 18. * std::f32::consts::TAU;
+ let radius = height * (0.26 + 0.05 * ((index * 5 % 7) as f32 / 6.));
+ div()
+ .absolute()
+ .left(gpui::relative(0.5))
+ .ml(px(angle.cos() * radius - 1.5))
+ .top(px(height * 0.5 + angle.sin() * radius - 1.5))
+ .size(px(3.))
+ .rounded_full()
+ .bg(ink)
+ })),
+ }
+}
+
fn peak_slices(waveforms: &[Arc>]) -> Vec<&[f32]> {
waveforms.iter().map(|peaks| peaks.as_slice()).collect()
}
diff --git a/apps/desktop-gpui/src/editor_canvas.rs b/apps/desktop-gpui/src/editor_canvas.rs
index 5ba52dca8aa..d5a0e5143dc 100644
--- a/apps/desktop-gpui/src/editor_canvas.rs
+++ b/apps/desktop-gpui/src/editor_canvas.rs
@@ -46,7 +46,7 @@ use std::rc::Rc;
use crate::i18n::tr;
use crate::{editor_timeline::TrackKind, editor_window::EditorWindow};
use cap_project::{CameraXPosition, CameraYPosition, OverlayTrackKind, SceneMode, XY};
-use cap_rendering::{CaptionFrameBox, FrameLayout};
+use cap_rendering::FrameLayout;
use gpui::{
AnyElement, Bounds, Context, CursorStyle, FontWeight, Hsla, InteractiveElement, IntoElement,
MouseButton, MouseDownEvent, MouseMoveEvent, ParentElement, Pixels, Point, SharedString,
@@ -481,23 +481,91 @@ pub fn caption_nudge_center(
camera_nudge_center(rect, canvas, direction, shift)
}
+/// The caption font size a corner drag asks for: the box grows about its
+/// centre, so the pointer's travel counts twice, and the size scales with the
+/// average of the two sides' growth. A box pinned to the left or right margin
+/// (`edge_pinned`) grows sideways from that edge only, so there the travel
+/// counts once across. `start_px` is the box in canvas pixels.
+pub fn caption_resize_size(
+ start_size: u32,
+ start_px: (f64, f64),
+ delta: (f64, f64),
+ dir: (i8, i8),
+ edge_pinned: bool,
+) -> u32 {
+ let (w, h) = (start_px.0.max(1.), start_px.1.max(1.));
+ let across = if edge_pinned { 1. } else { 2. };
+ let grow_w = (w + across * f64::from(dir.0) * delta.0) / w;
+ let grow_h = (h + 2. * f64::from(dir.1) * delta.1) / h;
+ let factor = ((grow_w + grow_h) / 2.).max(0.05);
+ (f64::from(start_size) * factor)
+ .round()
+ .clamp(CAPTION_SIZE_RANGE.0, CAPTION_SIZE_RANGE.1) as u32
+}
+
+/// Switches the caption on screen at `time` to Manual placement, centred on
+/// `drawn`: the setting, and the caption's own override when it has a
+/// preset one, since the renderer reads the override first. Returns whether
+/// anything changed.
+pub fn switch_captions_to_manual(
+ project: &mut cap_project::ProjectConfiguration,
+ time: f64,
+ drawn: NormRect,
+) -> bool {
+ let mut changed = false;
+ if let Some(timeline) = project.timeline.as_mut() {
+ for segment in timeline
+ .caption_segments
+ .iter_mut()
+ .filter(|segment| segment.start <= time && time < segment.end)
+ {
+ if segment
+ .position_override
+ .as_deref()
+ .is_some_and(|position| position != "manual")
+ {
+ segment.position_override = Some("manual".into());
+ changed = true;
+ }
+ }
+ }
+ if let Some(captions) = project.captions.as_mut()
+ && (captions.settings.position != "manual" || changed)
+ {
+ captions.settings.position = "manual".into();
+ captions.settings.manual_position = Some(XY::new(
+ (drawn.x + drawn.w / 2.) as f32,
+ (drawn.y + drawn.h / 2.) as f32,
+ ));
+ changed = true;
+ }
+ changed
+}
+
+/// The caption size slider's range, which a canvas resize keeps to.
+pub const CAPTION_SIZE_RANGE: (f64, f64) = (12., 100.);
+
/// Where Manual placement centres the captions when no position is stored:
/// the bottom-centre spot the renderer falls back to.
pub const CAPTION_DEFAULT_CENTER: (f64, f64) = (0.5, 0.85);
-/// The caption box to hit-test on the canvas. Only a caption the renderer
-/// placed manually gets one, so preset captions never take a click from the
-/// elements under them. The size is the renderer's; the position comes from
-/// the stored centre so a drag never waits on a frame.
+/// The caption box to hit-test on the canvas, in every placement, so the
+/// caption can be hovered, moved and resized like a text. The size is the
+/// renderer's. A manual caption's position comes from the stored centre so a
+/// drag never waits on a frame; a preset caption sits where it is drawn until
+/// a drag moves it to Manual.
pub fn caption_canvas_rect(
layout: &FrameLayout,
manual_position: Option>,
) -> Option {
- let caption = layout.caption.filter(CaptionFrameBox::is_manual)?;
+ let caption = layout.caption?;
let drawn = norm_rect(caption.bounds, layout);
if drawn.w <= 0. || drawn.h <= 0. {
return None;
}
+ if !caption.is_manual() {
+ return Some(drawn);
+ }
let center = manual_position.map_or(CAPTION_DEFAULT_CENTER, |position| {
(f64::from(position.x), f64::from(position.y))
});
@@ -580,6 +648,8 @@ pub struct CanvasResize {
/// Set when the display pads evenly, which the proportional
/// `max_width` / `padding_scale` model cannot express.
pub even: Option,
+ /// The caption font size when a caption resize began.
+ pub caption_size: u32,
}
pub struct CanvasDrag {
@@ -841,8 +911,8 @@ impl EditorWindow {
CanvasSelection::Mask(_)
| CanvasSelection::Text(_)
| CanvasSelection::Image(_)
- | CanvasSelection::Shape(_) => true,
- CanvasSelection::Captions => false,
+ | CanvasSelection::Shape(_)
+ | CanvasSelection::Captions => true,
};
if !resizable {
return;
@@ -909,6 +979,11 @@ impl EditorWindow {
max_width,
padding_scale,
even,
+ caption_size: self
+ .project
+ .captions
+ .as_ref()
+ .map_or(0, |captions| captions.settings.size),
}),
});
cx.notify();
@@ -966,6 +1041,7 @@ impl EditorWindow {
resize.max_width,
resize.padding_scale,
resize.even,
+ resize.caption_size,
)
});
let size = (
@@ -983,6 +1059,7 @@ impl EditorWindow {
max_width,
padding_scale,
even,
+ caption_size,
)) = resize
{
match element {
@@ -1073,7 +1150,23 @@ impl EditorWindow {
self.canvas_overlay_rect = Some(rect);
self.write_overlay_rect(element, rect, cx);
}
- CanvasSelection::Captions => {}
+ CanvasSelection::Captions => {
+ // Where the renderer drew this caption, its own
+ // position override included.
+ let edge_pinned = self
+ .frame_layout
+ .as_ref()
+ .and_then(|layout| layout.caption)
+ .is_some_and(|caption| caption.is_side_pinned());
+ let next = caption_resize_size(
+ caption_size,
+ (start.w * size.0, start.h * size.1),
+ delta,
+ (dir_x, dir_y),
+ edge_pinned,
+ );
+ self.write_caption_size(next, cx);
+ }
}
let _ = (window, output_w, output_h);
return;
@@ -1098,7 +1191,10 @@ impl EditorWindow {
};
overlay_drag_center(bounds, size, delta, &targets, shift)
}
- CanvasSelection::Captions => caption_drag_center(start, size, delta, &targets, shift),
+ CanvasSelection::Captions => {
+ self.make_captions_manual(start, cx);
+ caption_drag_center(start, size, delta, &targets, shift)
+ }
};
self.snap_guides = guides;
let optimistic = NormRect {
@@ -1237,7 +1333,10 @@ impl EditorWindow {
| CanvasSelection::Text(_)
| CanvasSelection::Image(_)
| CanvasSelection::Shape(_) => overlay_nudge_center(rect, direction, shift),
- CanvasSelection::Captions => caption_nudge_center(rect, size, direction, shift),
+ CanvasSelection::Captions => {
+ self.make_captions_manual(rect, cx);
+ caption_nudge_center(rect, size, direction, shift)
+ }
};
let optimistic = NormRect {
x: center.x - rect.w / 2.,
@@ -1294,9 +1393,29 @@ impl EditorWindow {
);
}
- /// The manual caption centre. The placement setting itself is left alone:
- /// the box only exists while the caption on screen is already manual,
- /// whether through the setting or its segment's override.
+ /// Moving a caption that sits at a preset spot switches it to Manual,
+ /// centred where it is drawn, so the drag carries on from there. The
+ /// setting changes, and so does the caption's own placement override
+ /// when it has one, since the renderer reads the override first.
+ fn make_captions_manual(&mut self, drawn: NormRect, cx: &mut Context) {
+ let time = self.preview_or_playhead();
+ if switch_captions_to_manual(&mut self.project, time, drawn) {
+ self.project_changed_live(cx);
+ }
+ }
+
+ fn write_caption_size(&mut self, size: u32, cx: &mut Context) {
+ let Some(captions) = self.project.captions.as_mut() else {
+ return;
+ };
+ if captions.settings.size == size {
+ return;
+ }
+ captions.settings.size = size;
+ self.project_changed_live(cx);
+ }
+
+ /// The manual caption centre.
fn write_caption_center(&mut self, center: XY, cx: &mut Context) {
let Some(captions) = self.project.captions.as_mut() else {
return;
@@ -1703,9 +1822,9 @@ impl EditorWindow {
| CanvasSelection::Text(_)
| CanvasSelection::Image(_)
| CanvasSelection::Shape(_) => (true, true, None),
- CanvasSelection::Captions => (true, false, None),
+ CanvasSelection::Captions => (true, true, None),
};
- let has_handles = element != CanvasSelection::Captions;
+ let has_handles = resizable;
let left = rect.x as f32 * canvas.0;
let top = rect.y as f32 * canvas.1;
@@ -2655,7 +2774,7 @@ mod tests {
fn caption_layout(width: u32, height: u32, bounds: [f32; 4], position: &str) -> FrameLayout {
FrameLayout {
- caption: Some(CaptionFrameBox::new(bounds, position)),
+ caption: Some(cap_rendering::CaptionFrameBox::new(bounds, position)),
..layout(width, height, [0., 0., width as f32, height as f32])
}
}
@@ -2664,10 +2783,10 @@ mod tests {
(a - b).abs() < 1e-6
}
- /// A preset caption gets no hit box at all, so a click on it reaches the
- /// text, mask or screen underneath exactly as before.
+ /// A caption at a preset spot takes clicks where it is drawn, whatever
+ /// manual centre is stored, so it can be picked up and moved.
#[test]
- fn only_a_manual_caption_takes_clicks() {
+ fn a_preset_caption_takes_clicks_where_it_is_drawn() {
let bounds = [700., 870., 1220., 930.];
for preset in [
"top-left",
@@ -2678,7 +2797,9 @@ mod tests {
"bottom-right",
] {
let layout = caption_layout(1920, 1080, bounds, preset);
- assert_eq!(caption_canvas_rect(&layout, Some(XY::new(0.5, 0.5))), None);
+ let rect = caption_canvas_rect(&layout, Some(XY::new(0.5, 0.5))).unwrap();
+ assert!(near(rect.x, 700. / 1920.));
+ assert!(near(rect.y, 870. / 1080.));
}
assert_eq!(caption_canvas_rect(&layout(1920, 1080, bounds), None), None);
let manual = caption_layout(1920, 1080, bounds, "manual");
@@ -2713,6 +2834,108 @@ mod tests {
));
}
+ /// Picking up a preset caption makes it Manual where it is drawn, and a
+ /// caption with its own preset override gets that override switched too,
+ /// so the one on screen is the one that moves.
+ #[test]
+ fn picking_up_a_caption_switches_it_and_its_override_to_manual() {
+ let drawn = NormRect {
+ x: 0.4,
+ y: 0.8,
+ w: 0.2,
+ h: 0.1,
+ };
+ let mut project = cap_project::ProjectConfiguration {
+ captions: Some(cap_project::CaptionsData::default()),
+ ..Default::default()
+ };
+ project.captions.as_mut().unwrap().settings.position = "bottom-center".into();
+ assert!(switch_captions_to_manual(&mut project, 1., drawn));
+ let settings = &project.captions.as_ref().unwrap().settings;
+ assert_eq!(settings.position, "manual");
+ let centre = settings.manual_position.unwrap();
+ assert!((centre.x - 0.5).abs() < 1e-6 && (centre.y - 0.85).abs() < 1e-6);
+ // Already manual with nothing overridden: nothing to do.
+ assert!(!switch_captions_to_manual(&mut project, 1., drawn));
+
+ let mut timeline = cap_project::TimelineConfiguration {
+ segments: Vec::new(),
+ transitions: Vec::new(),
+ zoom_segments: Vec::new(),
+ scene_segments: Vec::new(),
+ mask_segments: Vec::new(),
+ text_segments: Vec::new(),
+ caption_segments: Vec::new(),
+ keyboard_segments: Vec::new(),
+ audio_segments: Vec::new(),
+ camera3d_segments: Vec::new(),
+ style_segments: Vec::new(),
+ image_segments: Vec::new(),
+ shape_segments: Vec::new(),
+ };
+ timeline
+ .caption_segments
+ .push(cap_project::CaptionTrackSegment {
+ id: "a".into(),
+ start: 0.,
+ end: 2.,
+ text: "Hi".into(),
+ words: Vec::new(),
+ fade_duration_override: None,
+ linger_duration_override: None,
+ position_override: Some("top".into()),
+ color_override: None,
+ background_color_override: None,
+ font_size_override: None,
+ });
+ project.timeline = Some(timeline);
+ assert!(switch_captions_to_manual(&mut project, 1., drawn));
+ let segment = &project.timeline.as_ref().unwrap().caption_segments[0];
+ assert_eq!(segment.position_override.as_deref(), Some("manual"));
+ // A caption outside the playhead keeps its override.
+ project.timeline.as_mut().unwrap().caption_segments[0].position_override =
+ Some("top".into());
+ assert!(!switch_captions_to_manual(&mut project, 5., drawn));
+ assert_eq!(
+ project.timeline.as_ref().unwrap().caption_segments[0]
+ .position_override
+ .as_deref(),
+ Some("top")
+ );
+ }
+
+ /// A corner drag grows the caption about its centre and keeps to the
+ /// size slider's range.
+ #[test]
+ fn a_caption_corner_drag_scales_its_font_size() {
+ // Dragging the bottom-right corner out by a quarter of each side
+ // grows the box by half, as it grows about its centre: 40 becomes 60.
+ assert_eq!(
+ caption_resize_size(40, (400., 40.), (100., 10.), (1, 1), false),
+ 60
+ );
+ // The top-left corner pulled inward shrinks it.
+ assert_eq!(
+ caption_resize_size(40, (400., 40.), (100., 10.), (-1, -1), false),
+ 20
+ );
+ assert_eq!(
+ caption_resize_size(40, (400., 40.), (-400., -40.), (1, 1), false),
+ 12
+ );
+ assert_eq!(
+ caption_resize_size(90, (400., 40.), (400., 40.), (1, 1), false),
+ 100
+ );
+ // Pinned to the left margin, the box widens from that edge only:
+ // its width grows by a quarter, its height (about its centre) by
+ // half, so 40 becomes 55, where an unpinned box would reach 60.
+ assert_eq!(
+ caption_resize_size(40, (400., 40.), (100., 10.), (1, 1), true),
+ 55
+ );
+ }
+
/// No stored centre is the renderer's bottom-centre fallback, and a
/// centre near an edge is drawn pushed back inside the frame, in every
/// aspect.
diff --git a/apps/desktop-gpui/src/editor_clips.rs b/apps/desktop-gpui/src/editor_clips.rs
index 43210c1566a..6702de86188 100644
--- a/apps/desktop-gpui/src/editor_clips.rs
+++ b/apps/desktop-gpui/src/editor_clips.rs
@@ -2498,6 +2498,7 @@ fn ensure_multiple_segments(meta: &mut RecordingMeta) -> Result<&mut MultipleSeg
status: Some(StudioRecordingStatus::Complete),
cursor_shape_version: 0,
audio_only: false,
+ blank: false,
},
};
}
@@ -3732,6 +3733,7 @@ mod tests {
status: Some(StudioRecordingStatus::Complete),
cursor_shape_version: 0,
audio_only: false,
+ blank: false,
},
},
)),
diff --git a/apps/desktop-gpui/src/editor_edits.rs b/apps/desktop-gpui/src/editor_edits.rs
index a9583b1d671..b79fb527286 100644
--- a/apps/desktop-gpui/src/editor_edits.rs
+++ b/apps/desktop-gpui/src/editor_edits.rs
@@ -821,7 +821,12 @@ impl TrackSegmentOps for KeyboardTrackSegment {
fn split_tail(&self, at: f64) -> Self {
let mut tail = self.clone();
tail.start = self.start + at;
- tail.id = split_id("kb-edit");
+ // Half of a key added by hand is still one added by hand.
+ tail.id = split_id(if cap_project::is_manual_keyboard_segment(self) {
+ "kb-manual"
+ } else {
+ "kb-edit"
+ });
tail
}
}
@@ -1913,7 +1918,12 @@ pub fn split_segment(
let Some((head, mut tail)) = segment.split_at(segment.start + at) else {
return false;
};
- tail.id = split_id("kb-edit");
+ // Half of a key added by hand is still one added by hand.
+ tail.id = split_id(if cap_project::is_manual_keyboard_segment(&head) {
+ "kb-manual"
+ } else {
+ "kb-edit"
+ });
timeline.keyboard_segments[index] = head;
timeline.keyboard_segments.insert(index + 1, tail);
return true;
@@ -3041,11 +3051,7 @@ pub fn set_clip_segment_timescale(
}
pub fn clip_is_muted(segment: &TimelineSegment) -> bool {
- if (segment.timescale - 1.0).abs() < f64::EPSILON {
- segment.speed_audio_mode == Some(ClipSpeedAudioMode::Mute)
- } else {
- segment.speed_audio_mode.unwrap_or(ClipSpeedAudioMode::Mute) == ClipSpeedAudioMode::Mute
- }
+ segment.speed_audio_muted()
}
pub fn set_clip_volume(timeline: &mut TimelineConfiguration, index: usize, volume: f64) -> bool {
@@ -4617,8 +4623,21 @@ mod tests {
);
assert_eq!(left.keys[0].time_offset, 500.0);
assert_eq!(right.keys[0].time_offset, 500.0);
+ assert!(!cap_project::is_manual_keyboard_segment(right));
assert_ne!(left.id, right.id);
assert!(right.id.starts_with("kb-edit-split-"));
+
+ // Half of a key added by hand stays one added by hand, so it keeps
+ // its sounds and survives regenerating from the recording.
+ let manual = &mut timeline.keyboard_segments[1];
+ manual.id = "kb-manual-0".into();
+ manual.display_text = "hi".into();
+ manual.keys = cap_project::manual_key_presses("hi");
+ manual.keys[1].time_offset = 1500.0;
+ assert!(split_segment(timeline, TrackKind::Keyboard, 1, 1.0));
+ assert!(cap_project::is_manual_keyboard_segment(
+ &timeline.keyboard_segments[2]
+ ));
}
#[test]
diff --git a/apps/desktop-gpui/src/editor_export.rs b/apps/desktop-gpui/src/editor_export.rs
index 43b8c6dfddf..c4a9355421f 100644
--- a/apps/desktop-gpui/src/editor_export.rs
+++ b/apps/desktop-gpui/src/editor_export.rs
@@ -34,12 +34,13 @@ use crate::ui;
use crate::{library, platform};
const SIDEBAR_WIDTH: f32 = 400.;
+const EXPORT_PANEL_INSET: f32 = 12.;
const HEADER_HEIGHT: f32 = 52.;
const STAGE_PADDING_X: f32 = 24.;
/// Stage top padding, caption row, preview padding, stats card and bottom
/// padding: everything on the stage that is not the preview itself.
const STAGE_VERTICAL_CHROME: f32 = 16. + 22. + 14. + 18. + STATS_HEIGHT + 20.;
-const STATS_HEIGHT: f32 = 44.;
+const STATS_HEIGHT: f32 = 50.;
const SEGMENT_HEIGHT: f32 = 26.;
const COMPRESSION_PRESETS: [(ExportCompression, fn() -> &'static str); 4] = [
(
@@ -109,8 +110,6 @@ pub enum ExportFormatKind {
}
impl ExportFormatKind {
- const ALL: [Self; 3] = [Self::Mp4, Self::Gif, Self::Tracks];
-
fn label(self) -> &'static str {
match self {
Self::Mp4 => "MP4",
@@ -122,7 +121,7 @@ impl ExportFormatKind {
fn options(audio_only: bool, visuals: bool) -> Vec {
match (audio_only, visuals) {
- (false, _) => Self::ALL.to_vec(),
+ (false, _) => vec![Self::Mp4, Self::Gif, Self::Tracks],
(true, false) => vec![Self::Audio],
(true, true) => vec![Self::Mp4, Self::Gif, Self::Audio],
}
@@ -397,6 +396,8 @@ pub struct ExportUi {
pub custom_bpp: Option,
pub force_ffmpeg: bool,
pub advanced_open: bool,
+ /// Whether Format's More reveal is open; not saved.
+ pub more_formats_open: bool,
pub preview: Option>,
pub preview_stats: Option,
pub preview_error: Option,
@@ -423,6 +424,8 @@ pub struct ExportUi {
pub reuploading: bool,
pub upload_progress: f32,
pub copy_link_pressed: bool,
+ /// The finished file was just copied; the button says so for a moment.
+ pub file_copied: bool,
bpp_track: ui::SliderTrack,
bpp_dragging: bool,
pub track_options: Vec,
@@ -485,7 +488,7 @@ impl ExportUi {
force_ffmpeg_decoder: false,
advanced_open: false,
organization_id: None,
- turbo: false,
+ turbo: true,
gif_quality: None,
excluded_tracks: None,
resolution_from_source: true,
@@ -516,6 +519,7 @@ impl ExportUi {
custom_bpp: prefs.custom_bpp,
force_ffmpeg: prefs.force_ffmpeg_decoder,
advanced_open: prefs.advanced_open,
+ more_formats_open: false,
preview: None,
preview_stats: None,
preview_error: None,
@@ -539,6 +543,7 @@ impl ExportUi {
reuploading: false,
upload_progress: 0.0,
copy_link_pressed: false,
+ file_copied: false,
bpp_track: ui::SliderTrack::default(),
bpp_dragging: false,
track_options: Vec::new(),
@@ -967,6 +972,38 @@ impl EditorWindow {
}
}
+ /// Puts the finished file on the clipboard, the way the Clipboard
+ /// destination does, and confirms it on the button for two seconds.
+ fn copy_exported_file(&mut self, window: &mut Window, cx: &mut Context) {
+ let Some(path) = self.export.as_ref().and_then(|ui| ui.output_path.clone()) else {
+ return;
+ };
+ let result = platform::copy_file_to_clipboard(&path, cx);
+ if let Some(ui) = self.export.as_mut() {
+ match result {
+ Ok(()) => {
+ ui.file_copied = true;
+ ui.error = None;
+ }
+ Err(error) => {
+ tracing::warn!(error, "copying the exported file failed");
+ ui.error = Some(error);
+ }
+ }
+ }
+ cx.notify();
+ cx.spawn_in(window, async move |this, cx| {
+ cx.background_executor().timer(Duration::from_secs(2)).await;
+ let _ = this.update(cx, |this, cx| {
+ if let Some(ui) = this.export.as_mut() {
+ ui.file_copied = false;
+ }
+ cx.notify();
+ });
+ })
+ .detach();
+ }
+
fn copy_share_link(&mut self, window: &mut Window, cx: &mut Context) {
let Some(link) = self.export.as_ref().and_then(|ui| ui.share_link.clone()) else {
return;
@@ -1836,7 +1873,7 @@ impl EditorWindow {
let options = AudioExportFormat::ALL;
let selected = ui.audio_format;
let size = selected.estimated_bytes(self.total_duration()) as f64 / (1024.0 * 1024.0);
- self.export_section(tr::editor::export::audio::file_type(), "icons/music.svg")
+ self.export_section(tr::editor::export::audio::file_type())
.child(
ui::SegmentedControl::editor(
&theme,
@@ -2309,8 +2346,6 @@ impl EditorWindow {
.items_center()
.pl(px(if cfg!(target_os = "macos") { 92. } else { 12. }))
.pr(px(12.))
- .border_b_1()
- .border_color(Hsla::from(editor.line))
.when(cfg!(target_os = "windows"), |header| {
header.window_control_area(gpui::WindowControlArea::Drag)
})
@@ -2338,8 +2373,7 @@ impl EditorWindow {
.pr(px(10.))
.rounded(px(8.))
.cursor_pointer()
- .text_size(px(12.))
- .font_weight(FontWeight::MEDIUM)
+ .text_size(px(13.))
.text_color(Hsla::from(editor.text_2))
.hover(move |style| {
style
@@ -2459,7 +2493,14 @@ impl EditorWindow {
.rounded(px(10.))
.overflow_hidden()
.shadow(crate::theme::preview_shadow())
- .child(img(image).object_fit(gpui::ObjectFit::Contain).size_full())
+ // The image paints its own corners; the box's clip alone
+ // leaves them square.
+ .child(
+ img(image)
+ .object_fit(gpui::ObjectFit::Contain)
+ .size_full()
+ .rounded(px(10.)),
+ )
.into_any_element()
}
None => div()
@@ -2487,7 +2528,7 @@ impl EditorWindow {
.flex_col()
.flex_1()
.min_w_0()
- .bg(Hsla::from(editor.stage))
+ .bg(Hsla::from(editor.window))
.pt(px(16.))
.px(px(STAGE_PADDING_X))
.pb(px(20.))
@@ -2537,11 +2578,14 @@ impl EditorWindow {
div().flex().flex_row().justify_center().child(
div()
.h(px(STATS_HEIGHT))
- .min_w(px(520.))
.flex()
.flex_row()
- .rounded(px(10.))
- .bg(Hsla::from(editor.card))
+ .items_center()
+ .px(px(4.))
+ .rounded(px(12.))
+ .border_1()
+ .border_color(self.card_line())
+ .bg(self.panel_bg())
.shadow(editor.card_shadow())
.child(export_stat(
&theme,
@@ -2733,7 +2777,7 @@ impl EditorWindow {
.flex_col()
.flex_1()
.min_w_0()
- .bg(Hsla::from(editor.stage))
+ .bg(Hsla::from(editor.window))
.pt(px(16.))
.px(px(STAGE_PADDING_X))
.pb(px(20.))
@@ -2845,15 +2889,16 @@ impl EditorWindow {
let resolutions = self.export_resolutions(ui);
let fps_options = self.export_fps_options(ui);
- div()
- .w(px(SIDEBAR_WIDTH))
- .flex_shrink_0()
- .h_full()
+ let panel = div()
+ .size_full()
.flex()
.flex_col()
- .bg(Hsla::from(editor.card))
- .border_l_1()
- .border_color(Hsla::from(editor.line))
+ .rounded(px(crate::theme::EDITOR_CARD_RADIUS))
+ .border_1()
+ .border_color(self.card_line())
+ .bg(self.panel_bg())
+ .shadow(editor.card_shadow())
+ .overflow_hidden()
.child(
div()
.id("export-settings")
@@ -2862,8 +2907,10 @@ impl EditorWindow {
.flex_1()
.min_h_0()
.overflow_y_scroll()
- .p(px(16.))
- .gap(px(20.))
+ .px(px(20.))
+ .pt(px(18.))
+ .pb(px(20.))
+ .gap(px(22.))
.when(!audio_mode, |this| {
this.child(self.export_destination_field(ui, link_disabled, cx))
})
@@ -2895,13 +2942,22 @@ impl EditorWindow {
)
.child(
div()
- .px(px(16.))
- .pt(px(12.))
- .pb(px(16.))
+ .px(px(20.))
+ .pt(px(14.))
+ .pb(px(20.))
.border_t_1()
.border_color(Hsla::from(editor.line))
.child(self.export_cta(ui, cx)),
- )
+ );
+ // The same raised card as the editor's side panel, inset from the
+ // window's right and bottom edges.
+ div()
+ .w(px(SIDEBAR_WIDTH))
+ .flex_shrink_0()
+ .h_full()
+ .pr(px(EXPORT_PANEL_INSET))
+ .pb(px(EXPORT_PANEL_INSET))
+ .child(panel)
}
fn export_cta(&self, ui: &ExportUi, cx: &mut Context) -> impl IntoElement {
@@ -2964,6 +3020,19 @@ impl EditorWindow {
)
};
+ let gradient = |top: gpui::Rgba, bottom: gpui::Rgba| {
+ gpui::linear_gradient(
+ 180.,
+ gpui::linear_color_stop(top, 0.),
+ gpui::linear_color_stop(bottom, 1.),
+ )
+ };
+ let tint = move |amount: f32, toward: u32| {
+ gradient(
+ crate::theme::mix(editor.accent_2, gpui::rgb(toward), amount),
+ crate::theme::mix(editor.accent, gpui::rgb(toward), amount),
+ )
+ };
div()
.id("export-cta")
.tab_index(0)
@@ -2975,34 +3044,72 @@ impl EditorWindow {
.justify_center()
.gap(px(8.))
.rounded(px(10.))
- .bg(bg)
.text_size(px(13.))
.font_weight(FontWeight::MEDIUM)
.text_color(text)
- .when(primary, |this| {
- this.shadow(vec![gpui::BoxShadow {
- color: gpui::hsla(0., 0., 1., 0.18),
- offset: gpui::point(px(0.), px(1.)),
- blur_radius: px(0.),
- spread_radius: px(0.),
- inset: true,
- }])
+ // Primary matches the editor's Export button: an accent gradient
+ // with a lit top edge, lighter on hover and deeper when pressed.
+ .map(|this| {
+ if primary {
+ this.bg(gradient(editor.accent_2, editor.accent))
+ .shadow(vec![gpui::BoxShadow {
+ color: gpui::hsla(0., 0., 1., 0.22),
+ offset: gpui::point(px(0.), px(1.)),
+ blur_radius: px(0.),
+ spread_radius: px(0.),
+ inset: true,
+ }])
+ } else {
+ this.bg(bg)
+ }
})
.when(busy, |this| this.opacity(0.5))
.when(!busy, |this| {
this.cursor_pointer()
- .hover(move |style| style.bg(hover_bg))
+ .map(|this| {
+ if primary {
+ this.hover(move |style| style.bg(tint(0.10, 0xffffff)))
+ .active(move |style| style.bg(tint(0.06, 0x000000)))
+ } else {
+ this.hover(move |style| style.bg(hover_bg))
+ }
+ })
.on_click(cx.listener(|this, _, window, cx| this.start_export(window, cx)))
})
.children(icon.map(|icon| svg().path(icon).size(px(16.)).text_color(text)))
.child(label)
}
- fn export_section(&self, name: &'static str, icon: &'static str) -> ui::Field {
- ui::Field::section(&self.theme, name)
- .icon(icon)
- .icon_size(px(14.))
- .gap(px(8.))
+ fn export_section(&self, name: &'static str) -> ui::Field {
+ ui::Field::section(&self.theme, name).gap(px(10.))
+ }
+
+ fn select_export_destination(
+ &mut self,
+ dest: ExportDestination,
+ window: &mut Window,
+ cx: &mut Context,
+ ) {
+ if let Some(ui) = self.export.as_mut() {
+ if ui.format == ExportFormatKind::Tracks && dest != ExportDestination::File {
+ return;
+ }
+ if dest == ExportDestination::Link
+ && (has_transparent_background(&self.project) || ui.cursor_only)
+ {
+ return;
+ }
+ ui.destination = dest;
+ if dest == ExportDestination::Link && ui.format == ExportFormatKind::Gif {
+ ui.format = ExportFormatKind::Mp4;
+ }
+ }
+ self.normalize_loaded_export_options();
+ if let Some(ui) = self.export.as_mut() {
+ ui.persist();
+ }
+ self.refresh_export_preview(window, cx);
+ cx.notify();
}
fn export_destination_field(
@@ -3013,194 +3120,243 @@ impl EditorWindow {
) -> impl IntoElement {
let theme = self.theme;
let editor = theme.editor;
- self.export_section(
- tr::editor::export::section::destination(),
- "icons/upload-arrow.svg",
- )
- .child(
- ui::SegmentedControl::editor(
- &theme,
- "export-destination",
- ExportDestination::ALL
- .iter()
- .map(|dest| {
- let label = if *dest == ExportDestination::Link && self.sharing.is_some() {
+ self.export_section(tr::editor::export::section::destination())
+ .child(
+ div()
+ .flex()
+ .flex_row()
+ .gap(px(8.))
+ .children(ExportDestination::ALL.iter().map(|dest| {
+ let dest = *dest;
+ let label = if dest == ExportDestination::Link && self.sharing.is_some() {
tr::editor::export::reupload()
} else {
dest.label()
};
- let mut option = ui::SegmentOption::new(label, ui.destination == *dest)
- .disabled(
- (*dest == ExportDestination::Link && link_disabled)
- || (*dest == ExportDestination::Clipboard
- && ui.format == ExportFormatKind::Tracks),
- );
- option.icon = Some(dest.icon().into());
- option
- })
- .collect(),
- )
- .stretch()
- .item_height(px(30.))
- .on_select(cx.listener(|this, index: &usize, window, cx| {
- let Some(dest) = ui::option_at(ExportDestination::ALL, *index) else {
- return;
- };
- if let Some(ui) = this.export.as_mut() {
- if ui.format == ExportFormatKind::Tracks && dest != ExportDestination::File {
- return;
- }
- if dest == ExportDestination::Link
- && (has_transparent_background(&this.project) || ui.cursor_only)
- {
- return;
- }
- ui.destination = dest;
- if dest == ExportDestination::Link && ui.format == ExportFormatKind::Gif {
- ui.format = ExportFormatKind::Mp4;
- }
- }
- this.normalize_loaded_export_options();
- if let Some(ui) = this.export.as_mut() {
- ui.persist();
- }
- this.refresh_export_preview(window, cx);
- cx.notify();
- })),
- )
- .when(link_disabled, |field| {
- field.child(
- div()
- .text_size(px(11.))
- .text_color(Hsla::from(editor.text_3))
- .child(if ui.format == ExportFormatKind::Tracks {
- tr::editor::export::tracks::file_only()
- } else if ui.cursor_only {
- tr::editor::export::link_unavailable_cursor()
- } else {
- tr::editor::export::link_unavailable_transparent()
- }),
+ let selected = ui.destination == dest;
+ let disabled = (dest == ExportDestination::Link && link_disabled)
+ || (dest == ExportDestination::Clipboard
+ && ui.format == ExportFormatKind::Tracks);
+ let ink = Hsla::from(if selected {
+ editor.text_1
+ } else {
+ editor.text_2
+ });
+ // A tile per destination, the cursor panel's language:
+ // room for "Shareable link" on one line under its icon.
+ div()
+ .id(gpui::SharedString::from(format!(
+ "export-destination-{dest:?}"
+ )))
+ .flex_1()
+ .min_w_0()
+ .h(px(64.))
+ .flex()
+ .flex_col()
+ .items_center()
+ .justify_center()
+ .gap(px(7.))
+ .px(px(6.))
+ .rounded(px(12.))
+ .text_size(px(12.5))
+ .line_height(px(15.))
+ .text_color(ink)
+ .map(|this| {
+ if selected {
+ this.bg(editor.pill_fill())
+ .shadow(editor.choice_selected_shadow())
+ } else {
+ this.bg(Hsla::from(editor.ctl)).shadow(editor.trough_ring())
+ }
+ })
+ .when(disabled, |this| this.opacity(0.4))
+ .when(!disabled && !selected, |this| {
+ this.cursor_pointer()
+ .hover(move |style| style.bg(Hsla::from(editor.ctl_hover)))
+ })
+ .when(!disabled, |this| {
+ this.on_click(cx.listener(move |this, _, window, cx| {
+ this.select_export_destination(dest, window, cx);
+ }))
+ })
+ .child(
+ svg()
+ .path(dest.icon())
+ .size(px(18.))
+ .flex_none()
+ .text_color(ink),
+ )
+ .child(div().max_w_full().truncate().child(label))
+ })),
)
- })
- .when(
- ui.destination == ExportDestination::Link && self.sharing.is_some(),
- |field| {
- let link = self
- .sharing
- .as_ref()
- .map(|sharing| sharing.link.clone())
- .unwrap_or_default();
+ .when(link_disabled, |field| {
field.child(
div()
- .p(px(12.))
- .rounded(px(10.))
- .bg(Hsla::from(editor.card_2))
- .flex()
- .flex_col()
- .gap(px(4.))
- .child(
- div()
- .text_size(px(12.5))
- .font_weight(FontWeight::MEDIUM)
- .text_color(Hsla::from(editor.text_1))
- .child(tr::editor::export::existing_link_title()),
- )
- .child(
- div()
- .text_size(px(11.5))
- .line_height(px(15.))
- .text_color(Hsla::from(editor.text_3))
- .child(tr::editor::export::existing_link_description()),
- )
- .child(
- div()
- .id("reupload-existing-link")
- .text_size(px(11.5))
- .text_color(Hsla::from(editor.accent))
- .truncate()
- .cursor_pointer()
- .child(link.clone())
- .on_click(move |_, _, cx| cx.open_url(&link)),
- ),
- )
- },
- )
- .when(
- ui.destination == ExportDestination::Link
- && self.sharing.is_none()
- && store::auth_snapshot().organizations.len() > 1,
- |this| {
- let orgs = store::auth_snapshot().organizations;
- let selected = ui
- .organization_id
- .clone()
- .or_else(|| orgs.first().map(|org| org.id.clone()));
- let label = orgs
- .iter()
- .find(|org| Some(org.id.as_str()) == selected.as_deref())
- .or(orgs.first())
- .map(|org| org.name.clone())
- .unwrap_or_else(|| tr::editor::export::organization().into());
- this.child(
- div()
- .id("export-organization")
- .flex()
- .flex_row()
- .items_center()
- .justify_between()
- .h(px(30.))
- .px(px(10.))
- .rounded(px(7.))
- .bg(Hsla::from(editor.ctl))
- .cursor_pointer()
- .hover(move |style| style.bg(Hsla::from(editor.ctl_hover)))
- .on_click(cx.listener(move |this, _, _, cx| {
- let orgs = store::auth_snapshot().organizations;
- if orgs.is_empty() {
- return;
- }
- if let Some(ui) = this.export.as_mut() {
- let current = ui
- .organization_id
- .as_deref()
- .or(orgs.first().map(|org| org.id.as_str()));
- let index = orgs
- .iter()
- .position(|org| Some(org.id.as_str()) == current)
- .unwrap_or(0);
- let next = orgs[(index + 1) % orgs.len()].id.clone();
- ui.organization_id = Some(next);
- ui.persist();
- }
- cx.notify();
- }))
- .child(
- div()
- .text_size(px(12.))
- .text_color(Hsla::from(editor.text_2))
- .child(tr::editor::export::organization()),
- )
- .child(
- div()
- .flex()
- .flex_row()
- .items_center()
- .gap(px(4.))
- .text_size(px(12.))
- .text_color(Hsla::from(editor.text_1))
- .child(label)
- .child(
- svg()
- .path("icons/caret-down.svg")
- .size(px(14.))
- .text_color(Hsla::from(editor.text_3)),
- ),
- ),
+ .text_size(px(11.))
+ .text_color(Hsla::from(editor.text_3))
+ .child(if ui.format == ExportFormatKind::Tracks {
+ tr::editor::export::tracks::file_only()
+ } else if ui.cursor_only {
+ tr::editor::export::link_unavailable_cursor()
+ } else {
+ tr::editor::export::link_unavailable_transparent()
+ }),
)
- },
- )
+ })
+ .when(
+ ui.destination == ExportDestination::Link && self.sharing.is_some(),
+ |field| {
+ let link = self
+ .sharing
+ .as_ref()
+ .map(|sharing| sharing.link.clone())
+ .unwrap_or_default();
+ field.child(
+ div()
+ .p(px(12.))
+ .rounded(px(10.))
+ .bg(Hsla::from(editor.card_2))
+ .flex()
+ .flex_col()
+ .gap(px(4.))
+ .child(
+ div()
+ .text_size(px(12.5))
+ .font_weight(FontWeight::MEDIUM)
+ .text_color(Hsla::from(editor.text_1))
+ .child(tr::editor::export::existing_link_title()),
+ )
+ .child(
+ div()
+ .text_size(px(11.5))
+ .line_height(px(15.))
+ .text_color(Hsla::from(editor.text_3))
+ .child(tr::editor::export::existing_link_description()),
+ )
+ .child(
+ div()
+ .id("reupload-existing-link")
+ .text_size(px(11.5))
+ .text_color(Hsla::from(editor.accent))
+ .truncate()
+ .cursor_pointer()
+ .child(link.clone())
+ .on_click(move |_, _, cx| cx.open_url(&link)),
+ ),
+ )
+ },
+ )
+ .when(
+ ui.destination == ExportDestination::Link
+ && self.sharing.is_none()
+ && store::auth_snapshot().organizations.len() > 1,
+ |this| {
+ let orgs = store::auth_snapshot().organizations;
+ let selected = ui
+ .organization_id
+ .clone()
+ .or_else(|| orgs.first().map(|org| org.id.clone()));
+ let label = orgs
+ .iter()
+ .find(|org| Some(org.id.as_str()) == selected.as_deref())
+ .or(orgs.first())
+ .map(|org| org.name.clone())
+ .unwrap_or_else(|| tr::editor::export::organization().into());
+ this.child(
+ div()
+ .id("export-organization")
+ .flex()
+ .flex_row()
+ .items_center()
+ .justify_between()
+ .h(px(30.))
+ .px(px(10.))
+ .rounded(px(7.))
+ .bg(Hsla::from(editor.ctl))
+ .cursor_pointer()
+ .hover(move |style| style.bg(Hsla::from(editor.ctl_hover)))
+ .on_click(cx.listener(move |this, _, _, cx| {
+ let orgs = store::auth_snapshot().organizations;
+ if orgs.is_empty() {
+ return;
+ }
+ if let Some(ui) = this.export.as_mut() {
+ let current = ui
+ .organization_id
+ .as_deref()
+ .or(orgs.first().map(|org| org.id.as_str()));
+ let index = orgs
+ .iter()
+ .position(|org| Some(org.id.as_str()) == current)
+ .unwrap_or(0);
+ let next = orgs[(index + 1) % orgs.len()].id.clone();
+ ui.organization_id = Some(next);
+ ui.persist();
+ }
+ cx.notify();
+ }))
+ .child(
+ div()
+ .text_size(px(12.))
+ .text_color(Hsla::from(editor.text_2))
+ .child(tr::editor::export::organization()),
+ )
+ .child(
+ div()
+ .flex()
+ .flex_row()
+ .items_center()
+ .gap(px(4.))
+ .text_size(px(12.))
+ .text_color(Hsla::from(editor.text_1))
+ .child(label)
+ .child(
+ svg()
+ .path("icons/caret-down.svg")
+ .size(px(14.))
+ .text_color(Hsla::from(editor.text_3)),
+ ),
+ ),
+ )
+ },
+ )
+ }
+
+ fn choose_export_format(
+ &mut self,
+ format: ExportFormatKind,
+ window: &mut Window,
+ cx: &mut Context,
+ ) {
+ if let Some(ui) = self.export.as_mut() {
+ ui.format = format;
+ // Tracks and audio are files, and have no cursor-only video.
+ if !format.writes_video() {
+ ui.destination = ExportDestination::File;
+ ui.cursor_only = false;
+ }
+ if format != ExportFormatKind::Tracks {
+ ui.more_formats_open = false;
+ }
+ if format == ExportFormatKind::Gif {
+ if ui.destination == ExportDestination::Link {
+ ui.destination = ExportDestination::File;
+ }
+ if ui.resolution == ExportResolution::P4k {
+ ui.resolution = ExportResolution::P1080;
+ }
+ }
+ }
+ self.normalize_loaded_export_options();
+ if let Some(ui) = self.export.as_mut() {
+ ui.persist();
+ }
+ self.refresh_export_preview(window, cx);
+ cx.notify();
}
+ /// MP4 and GIF, then More: the less common formats (separate tracks)
+ /// open as a card underneath, so the everyday choice stays two options.
fn export_format_field(
&self,
ui: &ExportUi,
@@ -3213,58 +3369,85 @@ impl EditorWindow {
let cursor_only = ui.cursor_only;
let no_tracks = ui.track_options.is_empty();
let offers_tracks = options.contains(&ExportFormatKind::Tracks);
+ let tracks = ui.format == ExportFormatKind::Tracks;
+ let open = offers_tracks && (tracks || ui.more_formats_open);
+ // The everyday formats side by side; separate tracks wait under More.
+ let everyday: Vec = options
+ .iter()
+ .copied()
+ .filter(|format| *format != ExportFormatKind::Tracks)
+ .collect();
let disabled = move |format: ExportFormatKind| match format {
ExportFormatKind::Mp4 => transparent || cursor_only,
ExportFormatKind::Gif => cursor_only,
ExportFormatKind::Tracks => no_tracks,
ExportFormatKind::Audio => false,
};
- self.export_section(tr::editor::export::section::format(), "icons/video.svg")
- .child(
- ui::SegmentedControl::editor(
- &theme,
- "export-format",
- options
+ let mut more = ui::SegmentOption::new(
+ if tracks {
+ ExportFormatKind::Tracks.label()
+ } else {
+ tr::editor::export::more_formats()
+ },
+ tracks,
+ );
+ more.icon = Some(if open {
+ "icons/chevron-up.svg".into()
+ } else {
+ "icons/chevron-down.svg".into()
+ });
+ self.export_section(tr::editor::export::section::format())
+ .child(
+ ui::SegmentedControl::editor(
+ &theme,
+ "export-format",
+ everyday
.iter()
.map(|format| {
ui::SegmentOption::new(format.label(), ui.format == *format)
.disabled(disabled(*format))
})
+ .chain(offers_tracks.then_some(more))
.collect(),
)
.stretch()
.item_height(px(SEGMENT_HEIGHT))
.on_select(cx.listener(move |this, index: &usize, window, cx| {
- let Some(format) = options.get(*index).copied() else {
+ let Some(format) = everyday.get(*index).copied() else {
+ if let Some(ui) = this.export.as_mut()
+ && ui.format != ExportFormatKind::Tracks
+ {
+ ui.more_formats_open = !ui.more_formats_open;
+ cx.notify();
+ }
return;
};
- if disabled(format) {
- return;
- }
- if let Some(ui) = this.export.as_mut() {
- ui.format = format;
- if !format.writes_video() {
- ui.destination = ExportDestination::File;
- ui.cursor_only = false;
- }
- if format == ExportFormatKind::Gif {
- if ui.destination == ExportDestination::Link {
- ui.destination = ExportDestination::File;
- }
- if ui.resolution == ExportResolution::P4k {
- ui.resolution = ExportResolution::P1080;
- }
- }
- }
- this.normalize_loaded_export_options();
- if let Some(ui) = this.export.as_mut() {
- ui.persist();
+ if !disabled(format) {
+ this.choose_export_format(format, window, cx);
}
- this.refresh_export_preview(window, cx);
- cx.notify();
})),
)
- .when(no_tracks && offers_tracks, |field| {
+ .when(open, |field| {
+ field.child(self.export_choice_card(
+ "export-format-tracks",
+ "icons/layers.svg",
+ tr::editor::export::tracks::separate(),
+ tr::editor::export::tracks::separate_description(),
+ tracks,
+ no_tracks,
+ cx.listener(move |this, _, window, cx| {
+ let format = if tracks {
+ ExportFormatKind::Mp4
+ } else {
+ ExportFormatKind::Tracks
+ };
+ if !disabled(format) {
+ this.choose_export_format(format, window, cx);
+ }
+ }),
+ ))
+ })
+ .when(open && no_tracks, |field| {
field.child(
div()
.text_size(px(11.))
@@ -3274,57 +3457,69 @@ impl EditorWindow {
})
}
- fn export_tracks_field(&self, ui: &ExportUi, cx: &mut Context) -> impl IntoElement {
- let editor = self.theme.editor;
- self.export_section(tr::editor::export::section::tracks(), "icons/layers.svg")
- .children(ui.track_options.iter().map(|option| {
- self.export_track_row(option, ui.tracks.contains(&option.kind), cx)
- .into_any_element()
- }))
- .child(
- div()
- .text_size(px(11.))
- .line_height(px(14.))
- .text_color(Hsla::from(editor.text_3))
- .child(if ui.tracks.is_empty() {
- tr::editor::export::tracks::choose_one()
- } else {
- tr::editor::export::tracks::aligned()
- }),
- )
- }
-
- fn export_track_row(
+ /// A row-sized choice: an icon tile, a title and a line under it, and a
+ /// check circle. Selected rows sit on the raised pill with the accent
+ /// ring; the rest are recessed and fill on hover.
+ #[allow(clippy::too_many_arguments)]
+ fn export_choice_card(
&self,
- option: &TrackOption,
- checked: bool,
- cx: &mut Context,
+ id: &'static str,
+ icon: &'static str,
+ title: impl Into,
+ detail: impl Into,
+ selected: bool,
+ disabled: bool,
+ on_click: impl Fn(&gpui::ClickEvent, &mut Window, &mut gpui::App) + 'static,
) -> impl IntoElement {
let editor = self.theme.editor;
- let kind = option.kind;
+ let accent = Hsla::from(editor.accent);
div()
+ .id(id)
.flex()
.flex_row()
.items_center()
- .gap(px(10.))
- .min_h(px(36.))
+ .gap(px(12.))
+ .min_h(px(54.))
+ .px(px(12.))
+ .py(px(9.))
+ .rounded(px(12.))
+ .map(|this| {
+ if selected {
+ this.bg(editor.pill_fill())
+ .shadow(editor.choice_selected_shadow())
+ } else {
+ this.bg(Hsla::from(editor.ctl)).shadow(editor.trough_ring())
+ }
+ })
+ .when(disabled, |this| this.opacity(0.4))
+ .when(!disabled, |this| {
+ this.cursor_pointer()
+ .when(!selected, |this| {
+ this.hover(move |style| style.bg(Hsla::from(editor.ctl_hover)))
+ })
+ .on_click(on_click)
+ })
.child(
div()
.flex_none()
- .size(px(28.))
- .rounded(px(7.))
- .bg(Hsla::from(editor.ctl))
+ .size(px(30.))
+ .rounded(px(8.))
.flex()
.items_center()
.justify_center()
+ .bg(Hsla::from(if selected {
+ editor.ctl_active
+ } else {
+ editor.ctl
+ }))
.child(
svg()
- .path(track_icon(kind))
- .size(px(14.))
- .text_color(Hsla::from(if checked {
+ .path(icon)
+ .size(px(15.))
+ .text_color(Hsla::from(if selected {
editor.text_1
} else {
- editor.text_3
+ editor.text_2
})),
),
)
@@ -3334,36 +3529,90 @@ impl EditorWindow {
.flex_col()
.flex_1()
.min_w_0()
- .gap(px(1.))
+ .gap(px(2.))
.child(
div()
- .text_size(px(12.5))
- .font_weight(FontWeight::MEDIUM)
+ .text_size(px(13.))
+ .line_height(px(16.))
.text_color(Hsla::from(editor.text_1))
- .child(track_label(kind)),
+ .truncate()
+ .child(title.into()),
)
.child(
div()
- .text_size(px(11.))
- .line_height(px(14.))
+ .text_size(px(11.5))
+ .line_height(px(15.))
.text_color(Hsla::from(editor.text_3))
- .truncate()
- .child(track_detail(option)),
+ .child(detail.into()),
),
)
.child(
- ui::Toggle::plain(&self.theme, track_toggle_id(kind), checked).on_click(
- cx.listener(move |this, _, _, cx| {
- if let Some(ui) = this.export.as_mut() {
- ui.toggle_track(kind);
- ui.persist();
+ div()
+ .flex_none()
+ .size(px(20.))
+ .rounded_full()
+ .flex()
+ .items_center()
+ .justify_center()
+ .map(|this| {
+ if selected {
+ this.bg(accent).child(
+ svg()
+ .path("icons/check.svg")
+ .size(px(12.))
+ .text_color(gpui::white()),
+ )
+ } else {
+ this.border_1().border_color(Hsla::from(editor.line_strong))
}
- cx.notify();
}),
- ),
)
}
+ fn export_tracks_field(&self, ui: &ExportUi, cx: &mut Context) -> impl IntoElement {
+ let editor = self.theme.editor;
+ self.export_section(tr::editor::export::section::tracks())
+ .children(ui.track_options.iter().map(|option| {
+ self.export_track_row(option, ui.tracks.contains(&option.kind), cx)
+ .into_any_element()
+ }))
+ .child(
+ div()
+ .text_size(px(11.))
+ .line_height(px(14.))
+ .text_color(Hsla::from(editor.text_3))
+ .child(if ui.tracks.is_empty() {
+ tr::editor::export::tracks::choose_one()
+ } else {
+ tr::editor::export::tracks::aligned()
+ }),
+ )
+ }
+
+ fn export_track_row(
+ &self,
+ option: &TrackOption,
+ checked: bool,
+ cx: &mut Context,
+ ) -> impl IntoElement {
+ let kind = option.kind;
+ self.export_choice_card(
+ track_toggle_id(kind),
+ track_icon(kind),
+ track_label(kind),
+ track_detail(option),
+ checked,
+ false,
+ cx.listener(move |this, _, _, cx| {
+ if let Some(ui) = this.export.as_mut() {
+ ui.toggle_track(kind);
+ ui.persist();
+ }
+ cx.notify();
+ }),
+ )
+ }
+
fn export_resolution_field(
&self,
ui: &ExportUi,
@@ -3372,33 +3621,30 @@ impl EditorWindow {
) -> impl IntoElement {
let theme = self.theme;
let resolutions = resolutions.to_vec();
- self.export_section(
- tr::editor::export::section::resolution(),
- "icons/monitor-outline.svg",
- )
- .child(
- ui::SegmentedControl::editor(
- &theme,
- "export-resolution",
- resolutions
- .iter()
- .map(|res| ui::SegmentOption::new(res.label(), ui.resolution == *res))
- .collect(),
+ self.export_section(tr::editor::export::section::resolution())
+ .child(
+ ui::SegmentedControl::editor(
+ &theme,
+ "export-resolution",
+ resolutions
+ .iter()
+ .map(|res| ui::SegmentOption::new(res.label(), ui.resolution == *res))
+ .collect(),
+ )
+ .stretch()
+ .item_height(px(SEGMENT_HEIGHT))
+ .on_select(cx.listener(move |this, index: &usize, window, cx| {
+ let Some(resolution) = resolutions.get(*index).copied() else {
+ return;
+ };
+ if let Some(ui) = this.export.as_mut() {
+ ui.choose_resolution(resolution);
+ ui.persist();
+ }
+ this.refresh_export_preview(window, cx);
+ cx.notify();
+ })),
)
- .stretch()
- .item_height(px(SEGMENT_HEIGHT))
- .on_select(cx.listener(move |this, index: &usize, window, cx| {
- let Some(resolution) = resolutions.get(*index).copied() else {
- return;
- };
- if let Some(ui) = this.export.as_mut() {
- ui.choose_resolution(resolution);
- ui.persist();
- }
- this.refresh_export_preview(window, cx);
- cx.notify();
- })),
- )
}
fn export_fps_field(
@@ -3409,7 +3655,7 @@ impl EditorWindow {
) -> impl IntoElement {
let theme = self.theme;
let options = options.to_vec();
- self.export_section(tr::editor::export::section::frame_rate(), "icons/gauge.svg")
+ self.export_section(tr::editor::export::section::frame_rate())
.child(
ui::SegmentedControl::editor(
&theme,
@@ -3440,7 +3686,7 @@ impl EditorWindow {
fn export_quality_field(&self, ui: &ExportUi, cx: &mut Context) -> impl IntoElement {
let theme = self.theme;
let editor = theme.editor;
- self.export_section(tr::editor::export::section::quality(), "icons/gem.svg")
+ self.export_section(tr::editor::export::section::quality())
.child(
ui::SegmentedControl::editor(
&theme,
@@ -3491,7 +3737,7 @@ impl EditorWindow {
fn export_gif_quality_field(&self, ui: &ExportUi, cx: &mut Context) -> impl IntoElement {
let theme = self.theme;
let editor = theme.editor;
- self.export_section(tr::editor::export::section::quality(), "icons/gem.svg")
+ self.export_section(tr::editor::export::section::quality())
.child(
ui::SegmentedControl::editor(
&theme,
@@ -3625,33 +3871,14 @@ impl EditorWindow {
cx.notify();
}),
))
+ // A quiet note, not an alert: Turbo is on by default.
.when(ui.turbo, |this| {
this.child(
div()
- .p(px(12.))
- .rounded(px(10.))
- .bg(Hsla::from(editor.card_2))
- .flex()
- .flex_row()
- .items_start()
- .gap(px(8.))
- .child(
- svg()
- .path("icons/triangle-alert.svg")
- .size(px(14.))
- .flex_shrink_0()
- .mt(px(1.))
- .text_color(Hsla::from(editor.text_2)),
- )
- .child(
- div()
- .flex_1()
- .min_w_0()
- .text_size(px(11.5))
- .line_height(px(15.))
- .text_color(Hsla::from(editor.text_2))
- .child(tr::editor::export::turbo::warning()),
- ),
+ .text_size(px(11.5))
+ .line_height(px(15.))
+ .text_color(Hsla::from(editor.text_3))
+ .child(tr::editor::export::turbo::warning()),
)
})
}
@@ -3676,14 +3903,11 @@ impl EditorWindow {
.px(px(6.))
.rounded(px(8.))
.cursor_pointer()
- .text_size(px(12.))
+ // Reads as a section title, like the ones above it.
+ .text_size(px(13.))
.font_weight(FontWeight::MEDIUM)
- .text_color(Hsla::from(editor.text_2))
- .hover(move |style| {
- style
- .bg(Hsla::from(editor.ctl))
- .text_color(Hsla::from(editor.text_1))
- })
+ .text_color(Hsla::from(editor.text_1))
+ .hover(move |style| style.bg(Hsla::from(editor.ctl)))
.on_click(cx.listener(|this, _, _window, cx| {
if let Some(ui) = this.export.as_mut() {
ui.advanced_open = !ui.advanced_open;
@@ -3691,12 +3915,6 @@ impl EditorWindow {
}
cx.notify();
}))
- .child(
- svg()
- .path("icons/sliders-horizontal.svg")
- .size(px(14.))
- .text_color(Hsla::from(editor.text_2)),
- )
.child(tr::editor::export::advanced::title())
.child(
svg()
@@ -3794,14 +4012,7 @@ impl EditorWindow {
)
.flex()
.row_height(px(28.))
- .track(px(3.), Hsla::from(editor.ctl_active))
- .fill(Hsla::from(editor.accent))
- .thumb(
- px(14.),
- Hsla::from(editor.thumb),
- Some(gpui::hsla(0., 0., 0., 0.12)),
- )
- .thumb_shadow()
+ .editor(&self.theme, px(14.), false)
.on_drag_start(
cx.listener(
|this, event: &MouseDownEvent, _window, cx| {
@@ -3953,24 +4164,30 @@ impl EditorWindow {
ExportPhase::Idle | ExportPhase::ChoosingFile => "",
};
- let mut wash: Hsla = editor.window.into();
- wash.a = 0.94;
+ // A dark scrim in both themes, so the card reads as raised over the
+ // page rather than the page fading to white.
+ let wash = gpui::hsla(0., 0., 0., if theme.is_dark() { 0.55 } else { 0.32 });
- div()
- .absolute()
- .inset_0()
- .occlude()
+ // Everything sits on one raised card, the popovers' surface.
+ let card = div()
+ .w(px(380.))
.flex()
.flex_col()
.items_center()
- .justify_center()
- .gap(px(16.))
- .bg(wash)
+ .gap(px(14.))
+ .px(px(28.))
+ .pt(px(28.))
+ .pb(px(24.))
+ .rounded(px(16.))
+ .border_1()
+ .border_color(editor.pop_line())
+ .bg(editor.pop_bg())
+ .shadow(editor.pop_shadow())
.text_color(Hsla::from(editor.text_1))
.child({
let ring = ui::CircularProgress::new(
- px(80.),
- px(6.),
+ px(64.),
+ px(5.),
Hsla::from(editor.ctl_active),
Hsla::from(editor.accent),
)
@@ -3989,8 +4206,9 @@ impl EditorWindow {
.gap(px(4.))
.child(
div()
- .text_size(px(16.))
+ .text_size(px(15.))
.font_weight(FontWeight::MEDIUM)
+ .text_center()
.child(heading),
)
.when(
@@ -4017,6 +4235,7 @@ impl EditorWindow {
this.child(
div()
.text_size(px(12.))
+ .font_features(crate::editor_timeline::tabular_numerals())
.text_color(Hsla::from(editor.text_2))
.child(tr::editor::export::frames(
ui.total_frames as usize,
@@ -4090,9 +4309,11 @@ impl EditorWindow {
.when(ui.format.writes_video(), |this| {
this.child(
div()
- .max_w(px(320.))
+ .max_w(px(300.))
+ .pt(px(2.))
.text_size(px(12.))
- .text_color(Hsla::from(editor.text_2))
+ .line_height(px(17.))
+ .text_color(Hsla::from(editor.text_3))
.text_center()
.child(tr::editor::export::done::instant_hint()),
)
@@ -4101,106 +4322,148 @@ impl EditorWindow {
.when(
ui.phase == ExportPhase::Done || ui.phase == ExportPhase::Failed,
|this| {
- this.when(ui.clipboard_retry_path().is_some(), |this| {
- this.child(
- ui::Button::plain(
- &theme,
- "export-retry-copy",
- ui::ButtonVariant::Gray,
- ui::ButtonSize::Md,
- )
- .icon("icons/copy.svg")
- .label(tr::editor::export::done::retry_copy())
- .on_click(cx.listener(
- |this, _, window, cx| {
- this.retry_clipboard_copy(window, cx);
- },
- )),
+ // One accent action, a quieter second one beside it, and
+ // the way back as a plain link underneath.
+ let button = |id: &'static str, primary: bool| {
+ ui::Button::plain(
+ &theme,
+ id,
+ if primary {
+ ui::ButtonVariant::Blue
+ } else {
+ ui::ButtonVariant::Gray
+ },
+ ui::ButtonSize::Md,
)
- })
- .when(
- (ui.phase == ExportPhase::Done
- && ui.destination == ExportDestination::File)
- || ui.clipboard_retry_path().is_some(),
- |this| {
- let path = ui.output_path.clone();
+ };
+ let retry = ui.clipboard_retry_path().is_some();
+ let file_done =
+ ui.phase == ExportPhase::Done && ui.destination == ExportDestination::File;
+ let tracks = ui.format == ExportFormatKind::Tracks;
+ let link_done = ui.phase == ExportPhase::Done
+ && ui.destination == ExportDestination::Link
+ && ui.share_link.is_some();
+ let path = ui.output_path.clone();
+ let open_file = move |primary: bool| {
+ let path = path.clone();
+ button("export-open-file", primary)
+ .icon("icons/folder-open.svg")
+ .label(if tracks {
+ tr::editor::export::tracks::open_folder()
+ } else {
+ tr::editor::export::done::open_file()
+ })
+ .on_click(move |_, _, cx| {
+ if let Some(path) = &path {
+ library::open_with_system(path, cx);
+ }
+ })
+ };
+ let actions = div()
+ .flex()
+ .flex_row()
+ .flex_wrap()
+ .justify_center()
+ .gap(px(8.))
+ .pt(px(4.))
+ .when(retry, |this| {
this.child(
- ui::Button::plain(
- &theme,
- "export-open-file",
- ui::ButtonVariant::Gray,
- ui::ButtonSize::Md,
- )
- .label(if ui.format == ExportFormatKind::Tracks {
- tr::editor::export::tracks::open_folder()
- } else {
- tr::editor::export::done::open_file()
- })
- .on_click(move |_, _, cx| {
- if let Some(path) = &path {
- library::open_with_system(path, cx);
- }
- }),
+ button("export-retry-copy", true)
+ .icon("icons/copy.svg")
+ .label(tr::editor::export::done::retry_copy())
+ .on_click(cx.listener(|this, _, window, cx| {
+ this.retry_clipboard_copy(window, cx);
+ })),
)
- },
- )
- .when(
- ui.phase == ExportPhase::Done
- && ui.destination == ExportDestination::Link
- && ui.share_link.is_some(),
- |this| {
+ .child(open_file(false))
+ })
+ .when(file_done && !retry, |this| {
+ let copied = ui.file_copied;
+ this.child(open_file(true)).when(!tracks, |this| {
+ this.child(
+ button("export-copy-file", false)
+ .icon(if copied {
+ "icons/check.svg"
+ } else {
+ "icons/copy.svg"
+ })
+ .label(if copied {
+ tr::editor::export::done::file_copied()
+ } else {
+ tr::editor::export::done::copy_file()
+ })
+ .on_click(cx.listener(|this, _, window, cx| {
+ this.copy_exported_file(window, cx);
+ })),
+ )
+ })
+ })
+ .when(link_done, |this| {
let copied = ui.copy_link_pressed;
let open = ui.share_link.clone().unwrap_or_default();
this.child(
- ui::Button::plain(
- &theme,
- "export-copy-link",
- ui::ButtonVariant::Gray,
- ui::ButtonSize::Md,
- )
- .icon(if copied {
- "icons/check.svg"
- } else {
- "icons/copy.svg"
- })
- .label(if copied {
- tr::editor::export::done::link_copied()
- } else {
- tr::editor::export::done::copy_link()
- })
- .on_click(cx.listener(
- |this, _, window, cx| {
+ button("export-copy-link", true)
+ .icon(if copied {
+ "icons/check.svg"
+ } else {
+ "icons/copy.svg"
+ })
+ .label(if copied {
+ tr::editor::export::done::link_copied()
+ } else {
+ tr::editor::export::done::copy_link()
+ })
+ .on_click(cx.listener(|this, _, window, cx| {
this.copy_share_link(window, cx);
- },
- )),
+ })),
)
.child(
- ui::Button::plain(
- &theme,
- "export-open-link",
- ui::ButtonVariant::Primary,
- ui::ButtonSize::Md,
- )
- .icon("icons/link.svg")
- .label(tr::editor::export::done::open_link())
- .on_click(move |_, _, cx| {
- cx.open_url(&open);
- }),
+ button("export-open-link", false)
+ .icon("icons/link.svg")
+ .label(tr::editor::export::done::open_link())
+ .on_click(move |_, _, cx| {
+ cx.open_url(&open);
+ }),
)
- },
- )
- .child(
- ui::Button::plain(
- &theme,
- "export-back-done",
- ui::ButtonVariant::Gray,
- ui::ButtonSize::Md,
+ });
+ let back = div()
+ .id("export-back-done")
+ .flex()
+ .flex_row()
+ .items_center()
+ .gap(px(6.))
+ .h(px(28.))
+ .px(px(10.))
+ .rounded(px(8.))
+ .cursor_pointer()
+ .text_size(px(13.))
+ .text_color(Hsla::from(editor.text_2))
+ .hover(move |style| {
+ style
+ .bg(Hsla::from(editor.ctl))
+ .text_color(Hsla::from(editor.text_1))
+ })
+ .child(
+ svg()
+ .path("icons/move-left.svg")
+ .size(px(14.))
+ .text_color(Hsla::from(editor.text_2)),
)
- .label(tr::editor::export::back())
- .on_click(cx.listener(|this, _, window, cx| this.close_export(window, cx))),
- )
+ .child(tr::editor::export::back())
+ .on_click(cx.listener(|this, _, window, cx| this.close_export(window, cx)));
+ this.child(actions).child(back)
},
- )
+ );
+
+ div()
+ .absolute()
+ .inset_0()
+ .occlude()
+ .flex()
+ .items_center()
+ .justify_center()
+ .bg(wash)
+ .child(card)
}
}
@@ -4364,35 +4627,48 @@ fn export_stat(
) -> impl IntoElement {
let editor = theme.editor;
div()
+ .relative()
.flex()
- .flex_1()
- .min_w_0()
+ .flex_none()
.flex_col()
.justify_center()
- .px(px(16.))
- .gap(px(1.))
+ .h_full()
+ .min_w(px(96.))
+ .px(px(18.))
+ .gap(px(2.))
+ // An inset rule rather than a full-height border, so the card reads
+ // as one surface.
.when(divided, |this| {
- this.border_l_1().border_color(Hsla::from(editor.line))
+ this.child(
+ div()
+ .absolute()
+ .left_0()
+ .top(px(12.))
+ .bottom(px(12.))
+ .w(px(1.))
+ .bg(Hsla::from(editor.line)),
+ )
})
.child(
div()
- .text_size(px(10.5))
- .font_weight(FontWeight::MEDIUM)
+ .text_size(px(11.))
+ .line_height(px(14.))
.text_color(Hsla::from(editor.text_3))
- .truncate()
+ .whitespace_nowrap()
.child(label),
)
.child(match value {
Some(value) => div()
- .text_size(px(12.5))
- .font_weight(FontWeight::MEDIUM)
+ .text_size(px(13.))
+ .line_height(px(17.))
+ .font_features(crate::editor_timeline::tabular_numerals())
.text_color(Hsla::from(editor.text_1))
.whitespace_nowrap()
.child(value)
.into_any_element(),
None => div()
.my(px(3.))
- .h(px(12.))
+ .h(px(11.))
.w(px(56.))
.rounded(px(4.))
.bg(Hsla::from(editor.ctl_active))
@@ -4411,7 +4687,7 @@ fn export_fps_options(format: ExportFormatKind, cursor_only: bool) -> &'static [
if format == ExportFormatKind::Tracks {
&[15, 30, 60]
} else if format == ExportFormatKind::Gif && !cursor_only {
- &[5, 10, 15, 20, 25, 30]
+ &[10, 15, 30]
} else {
&[15, 30, 60]
}
@@ -4463,7 +4739,18 @@ fn normalize_export_options(ui: &mut ExportUi, transparent: bool) {
ui.resolution = source_resolution(ui.source.size, resolutions, largest);
}
if !fps_options.contains(&ui.fps) {
- ui.fps = if ui.format == ExportFormatKind::Gif {
+ // A GIF rate this version no longer offers keeps the nearest one
+ // (a saved 25 stays smooth at 30), ties going to the lower rate. A
+ // rate past what GIFs offer, such as 60 carried over from MP4, takes
+ // the light default.
+ let gif_max = fps_options.iter().copied().max().unwrap_or(15);
+ ui.fps = if ui.format == ExportFormatKind::Gif && ui.fps <= gif_max {
+ fps_options
+ .iter()
+ .copied()
+ .min_by_key(|option| (option.abs_diff(ui.fps), *option))
+ .unwrap_or(15)
+ } else if ui.format == ExportFormatKind::Gif {
15
} else {
30
@@ -4745,7 +5032,7 @@ mod tests {
fn gif_exports_offer_smaller_options_that_other_formats_do_not() {
assert_eq!(
export_fps_options(ExportFormatKind::Gif, false),
- [5, 10, 15, 20, 25, 30]
+ [10, 15, 30]
);
assert_eq!(
export_fps_options(ExportFormatKind::Mp4, false),
@@ -4883,6 +5170,25 @@ mod tests {
assert_eq!(chosen(&ui), (ExportResolution::P1080, 60));
}
+ /// Turbo is on for someone exporting for the first time; whoever saved
+ /// export settings before the toggle existed keeps it off, and a choice
+ /// either way is kept.
+ #[test]
+ fn turbo_starts_on_only_for_new_users() {
+ let saved_before_turbo: ExportPrefs = serde_json::from_str(
+ r#"{"format":"Mp4","fps":30,"export_to":"file","resolution":"720p","compression":"Maximum","custom_bpp":null}"#,
+ )
+ .unwrap();
+ assert!(!saved_before_turbo.turbo);
+ for chosen in [false, true] {
+ let mut prefs = saved_before_turbo.clone();
+ prefs.turbo = chosen;
+ let reread: ExportPrefs =
+ serde_json::from_str(&serde_json::to_string(&prefs).unwrap()).unwrap();
+ assert_eq!(reread.turbo, chosen);
+ }
+ }
+
#[test]
fn a_remembered_choice_wins_over_the_source() {
let saved_before_this_change: ExportPrefs = serde_json::from_str(
@@ -4950,9 +5256,9 @@ mod tests {
let mut ui = clipboard_export();
ui.format = ExportFormatKind::Gif;
ui.resolution = ExportResolution::P480;
- ui.fps = 5;
+ ui.fps = 10;
normalize_export_options(&mut ui, false);
- assert_eq!((ui.resolution, ui.fps), (ExportResolution::P480, 5));
+ assert_eq!((ui.resolution, ui.fps), (ExportResolution::P480, 10));
ui.format = ExportFormatKind::Mp4;
normalize_export_options(&mut ui, false);
@@ -4970,6 +5276,13 @@ mod tests {
ui.fps = 60;
normalize_export_options(&mut ui, false);
assert_eq!((ui.resolution, ui.fps), (ExportResolution::P1080, 15));
+
+ // A GIF rate saved by an older version keeps the nearest one offered.
+ for (saved, kept) in [(25, 30), (20, 15), (5, 10)] {
+ ui.fps = saved;
+ normalize_export_options(&mut ui, false);
+ assert_eq!(ui.fps, kept, "{saved}");
+ }
}
#[test]
diff --git a/apps/desktop-gpui/src/editor_panels.rs b/apps/desktop-gpui/src/editor_panels.rs
index fd9e336ac0f..c14f40f9234 100644
--- a/apps/desktop-gpui/src/editor_panels.rs
+++ b/apps/desktop-gpui/src/editor_panels.rs
@@ -2790,6 +2790,9 @@ pub enum FieldKey {
/// Single-line names and labels.
AudioName(usize),
KeyboardText(usize),
+ /// The Keyboard tab's composer: a draft of keys to add, never written
+ /// from the project.
+ KeyComposer,
/// `` boxes.
CaptionStart(usize),
CaptionEnd(usize),
@@ -2822,7 +2825,10 @@ impl FieldKey {
}
fn multi_line(self) -> bool {
- matches!(self, Self::TextContent(_) | Self::CaptionText(_))
+ matches!(
+ self,
+ Self::TextContent(_) | Self::CaptionText(_) | Self::KeyComposer
+ )
}
}
@@ -2842,11 +2848,15 @@ impl EditorWindow {
return;
}
let input = cx.new(|cx| {
- if key.multi_line() {
+ let mut input = if key.multi_line() {
ui::TextInputState::multi_line(window, cx)
} else {
ui::TextInputState::single_line(window, cx)
+ };
+ if key == FieldKey::KeyComposer {
+ input.set_placeholder(tr::editor::tabs::keyboard::type_keys_placeholder());
}
+ input
});
self.push_text_subscription(cx.subscribe_in(
&input,
@@ -2920,6 +2930,10 @@ impl EditorWindow {
fn write_field_value(&self, key: FieldKey, out: &mut String) -> Option<()> {
use std::fmt::Write as _;
+ if key == FieldKey::KeyComposer {
+ return None;
+ }
+
// The crop boxes read the open cropper, not the project: their value
// is `crop()[props.field]`, i.e. `realBounds` (`Editor.tsx:1182`).
if let FieldKey::Crop(field) = key {
@@ -3029,6 +3043,25 @@ impl EditorWindow {
window: &mut Window,
cx: &mut Context,
) {
+ if key == FieldKey::KeyComposer {
+ // Enter adds what was typed and clears the box for the next
+ // entry, keeping it focused; Escape clears it.
+ let Some(input) = self.field(key).cloned() else {
+ return;
+ };
+ match event {
+ // A script can run over lines, so Enter is a new line and
+ // the panel's Add button adds it; Escape closes the panel.
+ ui::TextInputEvent::Confirmed => {}
+ ui::TextInputEvent::Cancelled => {
+ self.close_key_prompt(cx);
+ }
+ // The Add button follows whether there is anything to add.
+ ui::TextInputEvent::Changed => cx.notify(),
+ ui::TextInputEvent::Blurred => {}
+ }
+ return;
+ }
match event {
ui::TextInputEvent::Changed => {
self.begin_field_edit(key);
@@ -3085,6 +3118,8 @@ impl EditorWindow {
};
let text = input.read(cx).text().to_string();
match key {
+ // The composer adds its keys on Enter only (`on_field_event`).
+ FieldKey::KeyComposer => {}
FieldKey::StyleName(index) | FieldKey::ImageName(index) => {
let style = matches!(key, FieldKey::StyleName(_));
self.edit_project("segment-name", window, cx, move |project| {
@@ -3191,10 +3226,43 @@ impl EditorWindow {
});
}
FieldKey::KeyboardText(index) => {
+ // Typed text a key added by hand now carries may run past its
+ // end; it grows to fit, up to the next key or the end.
+ let room = self.project.timeline.as_ref().map(|timeline| {
+ timeline
+ .keyboard_segments
+ .iter()
+ .enumerate()
+ .filter(|(other, _)| *other != index)
+ .map(|(_, other)| other.start)
+ .filter(|start| {
+ timeline
+ .keyboard_segments
+ .get(index)
+ .is_some_and(|segment| *start >= segment.start)
+ })
+ .fold(timeline.duration(), f64::min)
+ });
self.edit_keyboard_segment("keyboard-text", index, window, cx, move |segment| {
+ // A key added by hand takes a shortcut in words
+ // (`cmd+shift+p`) and strikes whatever its text says.
+ let text = if cap_project::is_manual_keyboard_segment(segment) {
+ cap_project::manual_key_text(&text)
+ } else {
+ text
+ };
if segment.display_text == text {
return false;
}
+ if cap_project::is_manual_keyboard_segment(segment) {
+ segment.keys = cap_project::manual_key_presses(&text);
+ let needed = cap_project::manual_key_length(&segment.keys);
+ if let Some(room) = room
+ && segment.end - segment.start < needed
+ {
+ segment.end = (segment.start + needed).min(room).max(segment.end);
+ }
+ }
segment.display_text = text;
true
});
@@ -4680,15 +4748,23 @@ impl EditorWindow {
.flex_1()
.flex()
.justify_center()
- .py(px(10.))
- .rounded(px(9.6))
+ .py(px(7.))
+ .rounded(px(8.))
+ .font_weight(FontWeight::MEDIUM)
.text_color(if selected {
- Hsla::from(theme.gray_12)
+ Hsla::from(theme.editor.text_1)
} else {
- Hsla::from(theme.gray_11)
+ Hsla::from(theme.editor.text_2)
})
.when(locked, |this| this.opacity(0.5))
- .when(selected, |this| this.bg(Hsla::from(theme.gray_3)))
+ .when(selected, |this| {
+ this.bg(theme.editor.pill_fill())
+ .shadow(theme.editor.pill_shadow())
+ })
+ .when(!selected && !locked, |this| {
+ this.cursor_pointer()
+ .hover(|style| style.bg(Hsla::from(theme.editor.ctl_hover)))
+ })
.child(label)
.when(!locked, |this| {
this.on_click(cx.listener(move |this, _, window, cx| {
@@ -4706,10 +4782,10 @@ impl EditorWindow {
.flex()
.flex_row()
.items_center()
- .rounded(px(8.))
- .border_1()
- .border_color(Hsla::from(theme.gray_12))
- .p(px(1.))
+ .rounded(px(10.))
+ .bg(Hsla::from(theme.editor.ctl))
+ .shadow(theme.editor.trough_ring())
+ .p(px(2.))
.child(tab(
tr::editor::panel::zoom::auto(),
"zoom-mode-auto",
@@ -5181,7 +5257,8 @@ impl EditorWindow {
.text_size(px(11.))
.font_weight(FontWeight::MEDIUM)
.when(selected, |this| {
- this.bg(Hsla::from(theme.editor.ctl_active))
+ this.bg(theme.editor.pill_fill())
+ .shadow(theme.editor.pill_shadow())
.text_color(Hsla::from(theme.editor.text_1))
})
.when(!selected, |this| {
@@ -6013,6 +6090,27 @@ impl EditorWindow {
&theme,
SharedString::from(tr::editor::panel::keyboard::title(index + 1)),
)
+ // How every key looks lives in the Keyboard tab, one click
+ // away from any key.
+ .value(
+ ui::Button::plain(
+ &theme,
+ SharedString::from(format!("keyboard-style-{index}")),
+ ui::ButtonVariant::Gray,
+ ui::ButtonSize::Sm,
+ )
+ .icon("icons/keyboard.svg")
+ .label(tr::editor::tabs::keyboard::key_style())
+ .on_click(cx.listener(|this, _, window, cx| {
+ if let Some(index) = crate::editor_sidebar::SidebarTab::ALL
+ .iter()
+ .position(|tab| *tab == crate::editor_sidebar::SidebarTab::Keyboard)
+ {
+ this.select_sidebar_tab(index, window, cx);
+ }
+ }))
+ .into_any_element(),
+ )
.child(self.render_field_input(FieldKey::KeyboardText(index), None)),
)
.child(self.timing_field(
@@ -8454,7 +8552,8 @@ impl EditorWindow {
}
}
crate::editor_sidebar::SidebarTab::Keyboard => {
- colors.extend([ColorTarget::KeyboardColor, ColorTarget::KeyboardBackground])
+ colors.extend([ColorTarget::KeyboardColor, ColorTarget::KeyboardBackground]);
+ fields.push(FieldKey::KeyComposer);
}
crate::editor_sidebar::SidebarTab::Audio => {
if let Some(summary) = self.summary() {
diff --git a/apps/desktop-gpui/src/editor_shapes.rs b/apps/desktop-gpui/src/editor_shapes.rs
index 032bbef5aab..96ca615b8c9 100644
--- a/apps/desktop-gpui/src/editor_shapes.rs
+++ b/apps/desktop-gpui/src/editor_shapes.rs
@@ -1862,8 +1862,8 @@ impl EditorWindow {
.flex_col()
.rounded(px(12.))
.border_1()
- .border_color(Hsla::from(theme.editor.line))
- .bg(Hsla::from(theme.editor.card))
+ .border_color(theme.editor.pop_line())
+ .bg(theme.editor.pop_bg())
.shadow(theme.editor.pop_shadow())
.on_mouse_down(MouseButton::Left, |_, _, cx| cx.stop_propagation())
.child(div().flex().flex_col().gap(px(2.)).p(px(6.)).children(
diff --git a/apps/desktop-gpui/src/editor_side_panel.rs b/apps/desktop-gpui/src/editor_side_panel.rs
index 0adfd524fd9..9bd34fe1a3d 100644
--- a/apps/desktop-gpui/src/editor_side_panel.rs
+++ b/apps/desktop-gpui/src/editor_side_panel.rs
@@ -11,9 +11,9 @@
//! them and every switch goes through [`EditorWindow::set_panel_tab`].
use gpui::{
- AnyElement, AnyWindowHandle, Context, CursorStyle, Div, FontWeight, Hsla, InteractiveElement,
- IntoElement, MouseButton, MouseDownEvent, ParentElement, SharedString, StyleRefinement, Styled,
- Window, div, prelude::FluentBuilder, px, svg,
+ AnyElement, AnyWindowHandle, App, Context, CursorStyle, Div, FontWeight, Hsla,
+ InteractiveElement, IntoElement, MouseButton, MouseDownEvent, ParentElement, SharedString,
+ StyleRefinement, Styled, Window, div, prelude::FluentBuilder, px, svg,
};
use crate::editor_edits::Selection;
@@ -93,6 +93,9 @@ pub(crate) struct PanelState {
/// The editor's own window, for the tab switch a selection asks for from
/// a path that was handed no window.
window: AnyWindowHandle,
+ /// A tab switch's fade: when it began, and how far down the card the
+ /// new content starts.
+ pub(crate) fade: Option<(std::time::Instant, f32)>,
}
impl PanelState {
@@ -108,6 +111,7 @@ impl PanelState {
Self {
width,
resize: None,
+ fade: None,
window,
}
}
@@ -210,34 +214,89 @@ pub(crate) fn panel_empty_state(
.gap(px(8.))
.px(px(32.))
.pb(px(SIDEBAR_TAB_BAR_HEIGHT))
+ // The icon sits in a small raised tile, the same lit edge and ring
+ // as the panel's pills.
.child(
- svg()
- .path(icon)
- .size(px(22.))
- .mb(px(2.))
- .text_color(Hsla::from(editor.text_3)),
+ div()
+ .size(px(48.))
+ .mb(px(6.))
+ .flex()
+ .items_center()
+ .justify_center()
+ .rounded(px(14.))
+ .bg(gpui::linear_gradient(
+ 180.,
+ gpui::linear_color_stop(Hsla::from(editor.ctl_active), 0.),
+ gpui::linear_color_stop(Hsla::from(editor.ctl), 1.),
+ ))
+ .shadow(editor.pill_shadow())
+ .child(
+ svg()
+ .path(icon)
+ .size(px(20.))
+ .text_color(Hsla::from(editor.text_2)),
+ ),
)
.child(
div()
- .text_size(px(13.))
- .font_weight(FontWeight::MEDIUM)
+ .text_size(px(14.))
+ .line_height(px(18.))
.text_color(Hsla::from(editor.text_1))
+ .text_center()
.child(title.into()),
)
.when(!description.is_empty(), |empty| {
empty.child(
div()
- .max_w(px(280.))
- .text_size(px(12.))
+ .max_w(px(260.))
+ .text_size(px(12.5))
.line_height(px(18.))
.text_center()
- .text_color(Hsla::from(editor.text_2))
+ .text_color(Hsla::from(editor.text_3))
.child(description),
)
})
}
+/// How long a tab switch takes to fade its new content in.
+const PANEL_FADE: std::time::Duration = std::time::Duration::from_millis(180);
+
+/// How opaque the fade's cover is `elapsed` into it: fully at the start,
+/// clear by the end, easing out so the content arrives quickly and settles.
+pub(crate) fn panel_fade_cover(elapsed: std::time::Duration) -> f32 {
+ let t = (elapsed.as_secs_f32() / PANEL_FADE.as_secs_f32()).clamp(0., 1.);
+ (1. - t).powi(3)
+}
+
impl EditorWindow {
+ /// The tab-switch fade: a cover in the card's own colour over the new
+ /// content, clearing over [`PANEL_FADE`]. The content underneath is the
+ /// cached view, painted once; only this rectangle repaints per frame.
+ fn render_panel_fade(&self, window: &Window, cx: &App) -> Option {
+ let (since, top) = self.panel.fade?;
+ if cx.reduce_motion() {
+ return None;
+ }
+ let cover = panel_fade_cover(since.elapsed());
+ if cover <= 0.001 {
+ return None;
+ }
+ window.request_animation_frame();
+ let radius = px(crate::theme::EDITOR_CARD_RADIUS - 1.);
+ Some(
+ div()
+ .absolute()
+ .left_0()
+ .right_0()
+ .bottom_0()
+ .top(px(top))
+ .rounded_bl(radius)
+ .rounded_br(radius)
+ .bg(self.panel_bg().opacity(cover))
+ .into_any_element(),
+ )
+ }
+
pub(crate) fn panel_tab(&self) -> PanelTab {
PanelTab::from_flags(self.transcript.open, self.clips.open)
}
@@ -290,6 +349,7 @@ impl EditorWindow {
PanelTab::Style => {}
}
tracing::debug!(from = ?current, to = ?tab, "editor panel tab");
+ self.panel.fade = Some((std::time::Instant::now(), SWITCHER_HEIGHT));
cx.notify();
}
@@ -474,7 +534,7 @@ impl EditorWindow {
.h_full()
.min_h_0()
.w(px(self.panel_width(viewport_width)))
- .rounded(px(12.))
+ .rounded(px(crate::theme::EDITOR_CARD_RADIUS))
.border_1()
.border_color(if focused {
Hsla::from(theme.editor.line_strong)
@@ -484,11 +544,13 @@ impl EditorWindow {
.bg(self.panel_bg())
.shadow(theme.editor.card_shadow())
.overflow_hidden()
+ .relative()
.child(self.render_panel_switcher(cx))
.child(self.cached_panel_body(
tab == PanelTab::Transcript,
StyleRefinement::default().w_full().flex_1().min_h_0(),
))
+ .children(self.render_panel_fade(window, cx))
.into_any_element()
}
}
@@ -497,6 +559,16 @@ impl EditorWindow {
mod tests {
use super::*;
+ #[test]
+ fn a_tab_switch_fade_clears_quickly_and_settles() {
+ use std::time::Duration;
+ assert_eq!(panel_fade_cover(Duration::ZERO), 1.);
+ let early = panel_fade_cover(PANEL_FADE / 4);
+ assert!(early > 0. && early < 0.5, "{early}");
+ assert_eq!(panel_fade_cover(PANEL_FADE), 0.);
+ assert_eq!(panel_fade_cover(PANEL_FADE * 3), 0.);
+ }
+
#[test]
fn the_tab_follows_the_mode_flags() {
assert_eq!(PanelTab::from_flags(false, false), PanelTab::Style);
diff --git a/apps/desktop-gpui/src/editor_sidebar.rs b/apps/desktop-gpui/src/editor_sidebar.rs
index 86b1a64a12e..fb99d4cca00 100644
--- a/apps/desktop-gpui/src/editor_sidebar.rs
+++ b/apps/desktop-gpui/src/editor_sidebar.rs
@@ -38,7 +38,7 @@ use std::{
collections::{BTreeMap, HashMap},
path::{Path, PathBuf},
sync::Arc,
- time::Instant,
+ time::{Duration, Instant},
};
use cap_project::{
@@ -46,10 +46,10 @@ use cap_project::{
DisplayNotch, NotchConfiguration, PaddingMode, ProjectConfiguration, ShadowConfiguration,
};
use gpui::{
- AnyElement, Bounds, Context, FontWeight, Hsla, InteractiveElement, IntoElement, MouseDownEvent,
- MouseMoveEvent, ParentElement, Pixels, RenderImage, SharedString, StatefulInteractiveElement,
- Styled, StyledImage, Window, canvas, div, img, linear_color_stop, linear_gradient,
- prelude::FluentBuilder, px, svg,
+ AnyElement, Bounds, Context, DispatchPhase, FontWeight, Hsla, InteractiveElement, IntoElement,
+ MouseDownEvent, MouseMoveEvent, ParentElement, Pixels, RenderImage, ScrollWheelEvent,
+ SharedString, StatefulInteractiveElement, Styled, StyledImage, Window, canvas, div, img,
+ linear_color_stop, linear_gradient, prelude::FluentBuilder, px, svg,
};
use crate::{
@@ -65,6 +65,9 @@ use crate::{
mod animated_gradient;
mod cursor;
+mod input_sounds;
+
+pub(crate) use input_sounds::InputSoundSlider;
// ---------------------------------------------------------------------------
// The catalogue: every constant the background section reads
@@ -333,12 +336,12 @@ impl SourceTab {
/// `BACKGROUND_SOURCES_ROW_ONE` / `_TWO` (`:236-246`), now one segmented
/// row. `None` is not in it: it is the section header's own action.
pub const PICKER: [SourceTab; 6] = [
- Self::Desktop,
Self::Wallpaper,
- Self::Image,
- Self::Color,
- Self::Gradient,
Self::AnimatedGradient,
+ Self::Gradient,
+ Self::Color,
+ Self::Image,
+ Self::Desktop,
];
pub fn label(self) -> &'static str {
@@ -730,6 +733,7 @@ pub enum SliderKey {
Keyboard(KeyboardSlider),
Panel(PanelSlider, usize),
VoiceEq(crate::editor_voice_eq::VoiceEqSlider),
+ InputSound(InputSoundSlider),
}
/// Which colour the open `NSColorPanel` is editing.
@@ -813,6 +817,13 @@ pub struct SidebarState {
/// The scroll body's offset, so a tab switch can put it back to the top
/// (`:647-649`).
pub scroll: gpui::ScrollHandle,
+ pub source_scroll: gpui::ScrollHandle,
+ /// The source whose pill the row last scrolled into view, so the
+ /// selection is revealed once and the user's own scroll is kept after.
+ pub source_revealed: std::rc::Rc>>,
+ /// Which surface the current wheel or trackpad gesture over the source
+ /// row moves, and when it last moved, so one gesture never moves both.
+ pub source_wheel: std::rc::Rc>>,
/// `KCollapsible open={...}` for Border and MacBook notch (both driven by
/// their own toggle) and `ShadowSettings`' own `isOpen` signal.
@@ -927,6 +938,9 @@ impl SidebarState {
source_tab: initial_source_tab(config),
wallpaper_theme: 0,
scroll: gpui::ScrollHandle::new(),
+ source_scroll: gpui::ScrollHandle::new(),
+ source_revealed: Default::default(),
+ source_wheel: Default::default(),
border_open: CollapsibleState::new(
config.background.border.as_ref().is_some_and(|b| b.enabled),
),
@@ -1078,6 +1092,13 @@ impl EditorWindow {
// `KSelect` menu, and a field's history bracket.
self.sidebar.menu = None;
self.end_field_edit(cx);
+ if self.sidebar.tab != tab {
+ self.panel.fade = Some((
+ std::time::Instant::now(),
+ crate::editor_side_panel::SWITCHER_HEIGHT
+ + crate::editor_window::SIDEBAR_TAB_BAR_HEIGHT,
+ ));
+ }
self.sidebar.tab = tab;
self.sidebar.scroll.set_offset(gpui::point(px(0.), px(0.)));
cx.notify();
@@ -1306,6 +1327,7 @@ impl EditorWindow {
SliderKey::Keyboard(slider) => slider.limits(),
SliderKey::Panel(slider, index) => self.panel_slider_limits(slider, index),
SliderKey::VoiceEq(slider) => slider.limits(),
+ SliderKey::InputSound(slider) => slider.limits(),
}
}
@@ -1336,6 +1358,7 @@ impl EditorWindow {
SliderKey::Keyboard(slider) => slider.read(&project),
SliderKey::Panel(slider, index) => self.panel_slider_value(slider, index),
SliderKey::VoiceEq(slider) => self.voice_eq_slider_value(slider),
+ SliderKey::InputSound(slider) => slider.read(&self.project),
}
}
@@ -1370,6 +1393,9 @@ impl EditorWindow {
self.apply_panel_slider(slider, index, value, window, cx)
}
SliderKey::VoiceEq(slider) => self.apply_voice_eq_slider(slider, value, window, cx),
+ SliderKey::InputSound(slider) => {
+ self.apply_input_sound_slider(slider, value, window, cx)
+ }
}
}
@@ -2643,11 +2669,71 @@ impl EditorWindow {
/// The sidebar card's inner content width: 416 minus its 1px borders minus the
/// panel's `p-4`. Fixed, because the column is `w-104 min-w-104 flex-none`.
-const CONTENT_WIDTH: f32 = 416. - 2. - 32.;
+const SIDEBAR_INSET: f32 = 20.;
+const CONTENT_WIDTH: f32 = 416. - 2. - SIDEBAR_INSET * 2.;
/// Six 34px-tall tiles across the pane.
-const WALLPAPER_COLUMNS: f32 = 6.;
-const WALLPAPER_GAP: f32 = 6.;
-const WALLPAPER_TILE_HEIGHT: f32 = 34.;
+const SOURCE_FADE_WIDTH: f32 = 28.;
+
+/// The row offset that centres a pill, so the selection sits with its
+/// neighbours on both sides. Item edges are unscrolled positions.
+fn source_reveal_offset(view: (f32, f32), item: (f32, f32), max: f32) -> f32 {
+ let centre = (view.0 + view.1) / 2.;
+ (centre - (item.0 + item.1) / 2.).clamp(-max.max(0.), 0.)
+}
+
+/// A gap this long between wheel events starts a new gesture.
+const WHEEL_GESTURE_GAP: Duration = Duration::from_millis(220);
+
+/// The surface a gesture over the source row scrolls.
+#[derive(Debug, Clone, Copy, PartialEq, Eq)]
+pub enum WheelAxis {
+ Row,
+ Panel,
+}
+
+/// Picks the surface for a new gesture over the source row. A trackpad
+/// (or any smooth input) goes the way it mostly moves; a notched wheel, a
+/// tilt or Shift moves the row while the row can still move that way, and
+/// the panel otherwise. `row_can_move` takes a horizontal delta.
+fn latch_wheel_axis(
+ delta: (f32, f32),
+ smooth: bool,
+ shift: bool,
+ row_can_move: impl Fn(f32) -> bool,
+) -> Option {
+ let (dx, dy) = delta;
+ if dx == 0. && dy == 0. {
+ return None;
+ }
+ if smooth && !shift {
+ return Some(if dx.abs() > dy.abs() {
+ WheelAxis::Row
+ } else {
+ WheelAxis::Panel
+ });
+ }
+ let horizontal = if dx != 0. { dx } else { dy };
+ Some(if row_can_move(horizontal) {
+ WheelAxis::Row
+ } else {
+ WheelAxis::Panel
+ })
+}
+
+/// How far a wheel event moves a surface on `axis`: the row takes the
+/// horizontal part (or the vertical one from a plain wheel or Shift), the
+/// panel only the vertical part.
+fn wheel_step(axis: WheelAxis, delta: (f32, f32)) -> f32 {
+ match axis {
+ WheelAxis::Row if delta.0 != 0. => delta.0,
+ WheelAxis::Row => delta.1,
+ WheelAxis::Panel => delta.1,
+ }
+}
+
+const WALLPAPER_COLUMNS: f32 = 4.;
+const WALLPAPER_GAP: f32 = 8.;
+const WALLPAPER_TILE_HEIGHT: f32 = 50.;
/// The gradient preview: `h-28` over the panel's full content width.
const GRADIENT_PREVIEW_WIDTH: f32 = CONTENT_WIDTH;
const GRADIENT_PREVIEW_HEIGHT: f32 = 112.;
@@ -2655,19 +2741,15 @@ const GRADIENT_PREVIEW_HEIGHT: f32 = 112.;
impl EditorWindow {
pub(crate) fn render_sidebar(&self, cx: &mut Context) -> impl IntoElement {
let theme = self.theme;
- let summary = self.summary();
let selection = self.sidebar_selection().cloned();
let selected_tab = self.sidebar.tab;
- // The two data-driven disabled states (`:602-604`, `:610`).
let items = SidebarTab::ALL
.into_iter()
.map(|tab| {
- let disabled = match tab {
- SidebarTab::Camera => !summary.is_some_and(|summary| summary.has_camera),
- SidebarTab::Cursor => !summary.is_some_and(|summary| summary.has_cursor_data),
- _ => false,
- };
+ // Camera and Cursor stay reachable without their data; the tab
+ // explains what is missing instead of refusing the click.
+ let disabled = false;
// While a selection panel is up the rail shows no selected
// item at all: `KTabs`'s value is forced to `undefined` and
// the indicator is hidden (`:586-592, 667-677`).
@@ -2713,6 +2795,8 @@ impl EditorWindow {
self.render_style_group(index, group, cx)
} else if self.audio_picker.is_some() {
self.render_audio_library(cx)
+ } else if self.key_prompt.is_some() {
+ self.render_key_prompt(cx)
} else {
match selection {
Some(selection) => self.render_selection_panel(&selection, cx),
@@ -2760,9 +2844,9 @@ impl EditorWindow {
.flex()
.flex_col()
.gap(px(14.))
- .pt(px(14.))
- .px(px(16.))
- .pb(px(16.))
+ .pt(px(18.))
+ .px(px(SIDEBAR_INSET))
+ .pb(px(20.))
.child(content),
)
.into_any_element()
@@ -2796,7 +2880,7 @@ impl EditorWindow {
div()
.flex()
.flex_col()
- .gap(px(14.))
+ .gap(px(20.))
.child(self.render_source_field(cx))
.child(dashed_divider(Hsla::from(theme.editor.line)))
.child(
@@ -2893,11 +2977,6 @@ impl EditorWindow {
let theme = self.theme;
let tab = self.sidebar.source_tab;
- let options = SourceTab::PICKER
- .into_iter()
- .map(|item| ui::SegmentOption::new(item.label(), tab == item))
- .collect();
-
ui::Field::section(&theme, tr::editor::sidebar::background::title())
.value(section_action(
&theme,
@@ -2909,18 +2988,7 @@ impl EditorWindow {
this.select_source_tab(SourceTab::None, window, cx);
}),
))
- .child(
- ui::SegmentedControl::editor(&theme, "background-source", options)
- .stretch()
- .item_height(px(26.))
- .item_padding(px(4.), px(0.))
- .text_size(px(11.5))
- .on_select(cx.listener(|this, index: &usize, window, cx| {
- if let Some(item) = ui::option_at(&SourceTab::PICKER, *index) {
- this.select_source_tab(item, window, cx);
- }
- })),
- )
+ .child(self.render_source_tiles(tab, cx))
.child(match tab {
SourceTab::Desktop => self.render_desktop_pane(cx).into_any_element(),
SourceTab::Wallpaper => self.render_wallpaper_pane(cx).into_any_element(),
@@ -2934,6 +3002,220 @@ impl EditorWindow {
})
}
+ fn render_source_tiles(&self, tab: SourceTab, cx: &mut Context) -> impl IntoElement {
+ let theme = self.theme;
+ let editor = theme.editor;
+ let scroll = self.sidebar.source_scroll.clone();
+ let revealed = self.sidebar.source_revealed.clone();
+ let offset = f32::from(scroll.offset().x);
+ let max = f32::from(scroll.max_offset().x);
+ let fade_left = offset < -1.;
+ let fade_right = max > 1. && offset > -(max - 1.);
+ let panel = self.panel_bg();
+ let fade = |angle: f32| {
+ div()
+ .absolute()
+ .top_0()
+ .bottom_0()
+ .w(px(SOURCE_FADE_WIDTH))
+ .bg(gpui::linear_gradient(
+ angle,
+ gpui::linear_color_stop(panel, 0.),
+ gpui::linear_color_stop(panel.opacity(0.), 1.),
+ ))
+ };
+
+ div()
+ .relative()
+ .child(
+ div()
+ .when(revealed.get() != Some(tab), |this| {
+ let scroll = scroll.clone();
+ let revealed = revealed.clone();
+ let index = SourceTab::PICKER.iter().position(|item| *item == tab);
+ let editor = cx.entity().downgrade();
+ this.on_children_prepainted(move |_, _, cx| {
+ revealed.set(Some(tab));
+ // A scrolling row keeps its children's bounds on the handle;
+ // the listener's own list is empty.
+ let Some(item) = index.and_then(|index| scroll.bounds_for_item(index))
+ else {
+ return;
+ };
+ let view = scroll.bounds();
+ let offset = scroll.offset();
+ let next = source_reveal_offset(
+ (f32::from(view.left()), f32::from(view.right())),
+ (f32::from(item.left()), f32::from(item.right())),
+ f32::from(scroll.max_offset().x),
+ );
+ if (next - f32::from(offset.x)).abs() > 0.5 {
+ scroll.set_offset(gpui::point(px(next), offset.y));
+ // The sidebar view is cached, so it repaints
+ // the new offset and edge fades only when told.
+ editor
+ .update(cx, |this, cx| this.invalidate_sidebar(cx))
+ .ok();
+ }
+ })
+ })
+ .id("background-sources")
+ .flex()
+ .flex_row()
+ .gap(px(6.))
+ .overflow_x_scroll()
+ .track_scroll(&scroll)
+ .children(SourceTab::PICKER.into_iter().map(|item| {
+ let selected = tab == item;
+ let ink = Hsla::from(if selected {
+ editor.text_1
+ } else {
+ editor.text_2
+ });
+ let glyph = match item {
+ SourceTab::Gradient => div()
+ .size(px(13.))
+ .rounded(px(3.))
+ .bg(gpui::linear_gradient(
+ 135.,
+ gpui::linear_color_stop(ink, 0.),
+ gpui::linear_color_stop(ink.opacity(0.15), 1.),
+ ))
+ .into_any_element(),
+ _ => svg()
+ .path(match item {
+ SourceTab::Desktop => "icons/monitor-outline.svg",
+ SourceTab::Wallpaper => "icons/image.svg",
+ SourceTab::Image => "icons/folder-open.svg",
+ SourceTab::Color => "icons/palette.svg",
+ _ => "icons/square-play.svg",
+ })
+ .size(px(14.))
+ .text_color(ink)
+ .into_any_element(),
+ };
+ div()
+ .id(SharedString::from(format!("background-source-{item:?}")))
+ .flex()
+ .flex_none()
+ .flex_row()
+ .items_center()
+ .gap(px(7.))
+ .h(px(32.))
+ .px(px(13.))
+ .rounded(px(10.))
+ .text_size(px(13.))
+ .text_color(ink)
+ .map(|this| {
+ if selected {
+ this.bg(editor.pill_fill()).shadow(editor.pill_shadow())
+ } else {
+ this.bg(Hsla::from(editor.ctl))
+ .shadow(editor.trough_ring())
+ .cursor_pointer()
+ .hover(|this| this.bg(Hsla::from(editor.ctl_hover)))
+ }
+ })
+ .child(glyph)
+ .child(item.label())
+ .on_click(cx.listener(move |this, _, window, cx| {
+ this.select_source_tab(item, window, cx);
+ }))
+ })),
+ )
+ .when(fade_left, |this| this.child(fade(90.).left_0()))
+ .when(fade_right, |this| this.child(fade(270.).right_0()))
+ .child(self.source_wheel_owner(cx))
+ }
+
+ /// Owns wheel and trackpad input over the source row before either
+ /// scroll area sees it, so a gesture moves the row or the panel and
+ /// never both. Its hitbox is transparent to clicks and hovers.
+ fn source_wheel_owner(&self, cx: &mut Context) -> impl IntoElement {
+ let row = self.sidebar.source_scroll.clone();
+ let panel = self.sidebar.scroll.clone();
+ let latch = self.sidebar.source_wheel.clone();
+ let editor = cx.entity().downgrade();
+ gpui::canvas(
+ |bounds, window, _| window.insert_hitbox(bounds, gpui::HitboxBehavior::Normal),
+ move |_, hitbox, window, _| {
+ window.on_mouse_event(move |event: &ScrollWheelEvent, phase, window, cx| {
+ if phase != DispatchPhase::Capture || !hitbox.is_hovered(window) {
+ return;
+ }
+ let (delta, smooth) = match event.delta {
+ gpui::ScrollDelta::Pixels(delta) => {
+ ((f32::from(delta.x), f32::from(delta.y)), true)
+ }
+ gpui::ScrollDelta::Lines(lines) => {
+ let line = f32::from(window.line_height());
+ // Precision touchpads on Windows report fractions
+ // of a line; a notched wheel reports whole lines.
+ let smooth = lines.x.fract() != 0. || lines.y.fract() != 0.;
+ ((lines.x * line, lines.y * line), smooth)
+ }
+ };
+ let now = Instant::now();
+ let row_offset = row.offset();
+ let row_max = f32::from(row.max_offset().x);
+ let held = latch.get().filter(|(_, at)| {
+ event.touch_phase != gpui::TouchPhase::Started
+ && now.duration_since(*at) < WHEEL_GESTURE_GAP
+ });
+ // A notched wheel that ran the row to its end hands the
+ // rest of its spin to the panel, rather than stalling
+ // there until the wheel pauses.
+ let x = f32::from(row_offset.x);
+ let row_can_move = |dx: f32| (dx > 0. && x < 0.) || (dx < 0. && x > -row_max);
+ let held = held.filter(|(axis, _)| {
+ smooth
+ || *axis != WheelAxis::Row
+ || row_can_move(wheel_step(WheelAxis::Row, delta))
+ });
+ let axis = match held {
+ Some((axis, _)) => axis,
+ None => {
+ let Some(axis) = latch_wheel_axis(
+ delta,
+ smooth,
+ event.modifiers.shift,
+ row_can_move,
+ ) else {
+ return;
+ };
+ axis
+ }
+ };
+ latch.set(Some((axis, now)));
+ let step = px(wheel_step(axis, delta));
+ let handle = match axis {
+ WheelAxis::Row => &row,
+ WheelAxis::Panel => &panel,
+ };
+ let offset = handle.offset();
+ let max = handle.max_offset();
+ let next = match axis {
+ WheelAxis::Row => {
+ gpui::point((offset.x + step).clamp(-max.x, px(0.)), offset.y)
+ }
+ WheelAxis::Panel => {
+ gpui::point(offset.x, (offset.y + step).clamp(-max.y, px(0.)))
+ }
+ };
+ cx.stop_propagation();
+ if next != offset {
+ handle.set_offset(next);
+ editor
+ .update(cx, |this, cx| this.invalidate_sidebar(cx))
+ .ok();
+ }
+ });
+ },
+ )
+ .absolute()
+ .inset_0()
+ }
+
/// The decoded preview for a path, if it is the one already decoded.
fn tile_image(&self, path: &str) -> Option> {
self.sidebar
@@ -3086,9 +3368,9 @@ impl EditorWindow {
.flex()
.flex_row()
.items_center()
- .gap(px(4.))
- .mb(px(10.))
- .text_size(px(12.))
+ .gap(px(16.))
+ .mb(px(12.))
+ .text_size(px(12.5))
.overflow_x_scroll()
.children(
BACKGROUND_THEMES
@@ -3099,21 +3381,18 @@ impl EditorWindow {
div()
.id(SharedString::from(format!("wallpaper-theme-{index}")))
.flex()
- .flex_1()
- .justify_center()
+ .flex_none()
.items_center()
- .h(px(24.))
- .px(px(8.))
- .rounded(px(6.))
- .font_weight(FontWeight::MEDIUM)
+ .h(px(22.))
.when(selected, |this| {
- this.bg(Hsla::from(theme.editor.ctl_hover))
- .text_color(Hsla::from(theme.editor.text_1))
+ this.text_color(Hsla::from(theme.editor.text_1))
})
.when(!selected, |this| {
- this.text_color(Hsla::from(theme.editor.text_2))
+ this.text_color(Hsla::from(theme.editor.text_3))
.cursor_pointer()
- .hover(|this| this.bg(Hsla::from(theme.editor.ctl)))
+ .hover(|this| {
+ this.text_color(Hsla::from(theme.editor.text_2))
+ })
})
.child(background_theme_label(id))
.on_click(cx.listener(move |this, _, window, cx| {
@@ -3137,13 +3416,19 @@ impl EditorWindow {
.id(SharedString::from(format!("wallpaper-{id}")))
.w(px(cell))
.h(px(WALLPAPER_TILE_HEIGHT + 2. * (RING_WIDTH + RING_GAP)))
- .rounded(px(8.))
+ .rounded(px(12.))
.cursor_pointer()
.selection_ring(self.panel_bg(), theme.editor.accent, selected)
+ .when(!selected, |this| {
+ this.hover(|this| {
+ this.border_color(Hsla::from(theme.editor.line_strong))
+ })
+ })
.child(
div()
+ .relative()
.size_full()
- .rounded(px(6.))
+ .rounded(px(8.))
.overflow_hidden()
.bg(Hsla::from(theme.editor.ctl_hover))
.children(image.map(|image| {
@@ -3153,8 +3438,15 @@ impl EditorWindow {
img(image)
.size_full()
.object_fit(gpui::ObjectFit::Cover)
- .rounded(px(6.))
- })),
+ .rounded(px(8.))
+ }))
+ .child(
+ div()
+ .absolute()
+ .inset_0()
+ .rounded(px(8.))
+ .shadow(theme.editor.trough_ring()),
+ ),
)
.on_click(cx.listener(move |this, _, window, cx| {
let Some(path) = wallpaper_path(id) else {
@@ -3956,11 +4248,19 @@ impl EditorWindow {
disabled: bool,
cx: &mut Context,
) -> ui::Field {
+ let theme = self.theme;
let value = format_slider_value(self.slider_value(slider), unit);
- ui::Field::inline(&self.theme, name)
+ ui::Field::stacked(&theme, name)
.disabled(disabled)
- .value_text(value)
- .child(self.slider_sized_state(slider, unit, true, disabled, cx))
+ .value(
+ div()
+ .text_size(px(12.))
+ .font_features(crate::editor_timeline::tabular_numerals())
+ .text_color(Hsla::from(theme.editor.text_2))
+ .child(value)
+ .into_any_element(),
+ )
+ .child(self.slider_sized_state(slider, unit, false, disabled, cx))
}
fn slider_sized(
@@ -3995,8 +4295,9 @@ impl EditorWindow {
div()
.id(SharedString::from(format!("bg-slider-row-{slider:?}")))
// The Kobalte root is `relative px-1 h-8 flex items-center`.
- .px(px(4.))
- .h(px(32.))
+ .px(px(8.))
+ .h(px(22.))
+ .when(!flex, |this| this.mb(px(10.)))
.flex()
.flex_row()
.items_center()
@@ -4009,19 +4310,8 @@ impl EditorWindow {
track,
)
.flex()
- .row_height(px(28.))
- .track(px(3.), Hsla::from(theme.editor.ctl_active))
- .fill(Hsla::from(if disabled {
- theme.editor.text_3
- } else {
- theme.editor.accent
- }))
- .thumb(
- px(14.),
- Hsla::from(theme.editor.thumb),
- Some(gpui::hsla(0., 0., 0., 0.12)),
- )
- .thumb_shadow()
+ .row_height(px(22.))
+ .editor(&theme, px(18.), disabled)
.when(!disabled, |this| {
this.on_drag_start(cx.listener(
move |this, event: &MouseDownEvent, window, cx| {
@@ -4368,6 +4658,55 @@ mod tests {
assert!(!ColorTarget::AnimatedGradientStop(0).is_hex_string());
}
+ #[test]
+ fn revealing_a_source_pill_centres_it_within_the_row() {
+ let view = (0., 300.);
+ // A pill in the middle of the content scrolls to the row's centre.
+ assert_eq!(source_reveal_offset(view, (250., 330.), 200.), -140.);
+ // The first pill rests against the start.
+ assert_eq!(source_reveal_offset(view, (0., 80.), 200.), 0.);
+ // The last pill can only go as far as the row scrolls.
+ assert_eq!(source_reveal_offset(view, (420., 500.), 200.), -200.);
+ }
+
+ #[test]
+ fn a_trackpad_gesture_moves_the_way_it_mostly_goes() {
+ let free = |_: f32| true;
+ assert_eq!(
+ latch_wheel_axis((-8., 2.), true, false, free),
+ Some(WheelAxis::Row)
+ );
+ assert_eq!(
+ latch_wheel_axis((2., -8.), true, false, free),
+ Some(WheelAxis::Panel)
+ );
+ assert_eq!(latch_wheel_axis((0., 0.), true, false, free), None);
+ }
+
+ #[test]
+ fn a_notched_wheel_moves_the_row_until_it_runs_out() {
+ assert_eq!(
+ latch_wheel_axis((0., -40.), false, false, |_| true),
+ Some(WheelAxis::Row)
+ );
+ assert_eq!(
+ latch_wheel_axis((0., -40.), false, false, |_| false),
+ Some(WheelAxis::Panel)
+ );
+ // Shift turns a smooth vertical scroll sideways too.
+ assert_eq!(
+ latch_wheel_axis((0., -6.), true, true, |_| true),
+ Some(WheelAxis::Row)
+ );
+ }
+
+ #[test]
+ fn each_surface_takes_only_its_own_part_of_a_step() {
+ assert_eq!(wheel_step(WheelAxis::Row, (-12., 3.)), -12.);
+ assert_eq!(wheel_step(WheelAxis::Row, (0., -40.)), -40.);
+ assert_eq!(wheel_step(WheelAxis::Panel, (-12., 3.)), 3.);
+ }
+
#[test]
fn built_in_wallpapers_remain_available_from_the_development_checkout() {
assert!(wallpaper_path("macOS/sequoia-dark").is_some());
diff --git a/apps/desktop-gpui/src/editor_sidebar/animated_gradient.rs b/apps/desktop-gpui/src/editor_sidebar/animated_gradient.rs
index 5f6662ddd9b..d59e7eb61ce 100644
--- a/apps/desktop-gpui/src/editor_sidebar/animated_gradient.rs
+++ b/apps/desktop-gpui/src/editor_sidebar/animated_gradient.rs
@@ -1,6 +1,6 @@
use cap_project::{
AnimatedGradientCatalog, AnimatedGradientConfig, AnimatedGradientControl,
- AnimatedGradientLibrary, AnimatedGradientPreset, AnimatedGradientStop,
+ AnimatedGradientLibrary, AnimatedGradientPreset, AnimatedGradientStop, AnimatedGradientStyle,
animated_gradient_catalog,
};
use gpui::{AppContext as _, MouseButton};
@@ -155,6 +155,9 @@ fn control_label(control: &AnimatedGradientControl) -> SharedString {
AnimatedGradientParameter::MotionSpeed => {
tr::editor::sidebar::animated_gradient::control::motion_speed()
}
+ AnimatedGradientParameter::DitherSize => {
+ tr::editor::sidebar::animated_gradient::control::dither_size()
+ }
})
}
@@ -177,10 +180,25 @@ fn group_label(name: &str) -> SharedString {
}
}
-fn control_groups(catalog: &AnimatedGradientCatalog) -> Vec<(&str, Vec<&AnimatedGradientControl>)> {
+/// The fine-tune groups for a gradient drawn in `style`: a dither draws only
+/// its palette, so it has no lighting or grain to tune, but it has a cell
+/// size; a smooth wash is the other way round.
+fn control_groups(
+ catalog: &AnimatedGradientCatalog,
+ style: AnimatedGradientStyle,
+) -> Vec<(&str, Vec<&AnimatedGradientControl>)> {
let mut groups: Vec<(&str, Vec<&AnimatedGradientControl>)> = Vec::new();
for control in &catalog.controls {
- if control.key == AnimatedGradientParameter::MotionSpeed {
+ let dither = style == AnimatedGradientStyle::Dither;
+ let shown = match control.key {
+ AnimatedGradientParameter::MotionSpeed => false,
+ AnimatedGradientParameter::DitherSize => dither,
+ AnimatedGradientParameter::GrainAmount | AnimatedGradientParameter::GrainSize => {
+ !dither
+ }
+ _ => !(dither && control.group == "Lighting"),
+ };
+ if !shown {
continue;
}
match groups.iter_mut().find(|(name, _)| *name == control.group) {
@@ -814,6 +832,7 @@ impl EditorWindow {
.text_color(Hsla::from(theme.red_11))
.child(error)
}))
+ .child(self.render_animated_gradient_style(config, cx))
.child(self.render_animated_gradient_presets(cx))
.child(dashed_divider(Hsla::from(theme.editor.line)))
.child(self.render_animated_gradient_colours(config, cx))
@@ -824,6 +843,65 @@ impl EditorWindow {
.into_any_element()
}
+ /// Dither or smooth: the first choice, since it changes the whole look.
+ fn render_animated_gradient_style(
+ &self,
+ config: &AnimatedGradientConfig,
+ cx: &mut Context,
+ ) -> AnyElement {
+ let theme = self.theme;
+ let styles = [AnimatedGradientStyle::Dither, AnimatedGradientStyle::Smooth];
+ ui::Field::inline(&theme, tr::editor::sidebar::animated_gradient::style())
+ .value(
+ ui::SegmentedControl::editor(
+ &theme,
+ "animated-gradient-style",
+ styles
+ .iter()
+ .map(|style| {
+ ui::SegmentOption::new(
+ match style {
+ AnimatedGradientStyle::Dither => {
+ tr::editor::sidebar::animated_gradient::style_dither()
+ }
+ AnimatedGradientStyle::Smooth => {
+ tr::editor::sidebar::animated_gradient::style_smooth()
+ }
+ },
+ *style == config.style,
+ )
+ })
+ .collect(),
+ )
+ .on_select(cx.listener(move |this, index: &usize, window, cx| {
+ let Some(&style) = styles.get(*index) else {
+ return;
+ };
+ this.edit_animated_gradient(
+ |config| {
+ let changed = config.style != style;
+ config.style = style;
+ changed
+ },
+ window,
+ cx,
+ );
+ }))
+ .into_any_element(),
+ )
+ .into_any_element()
+ }
+
+ /// A template or a shuffle keeps the style already chosen; only a saved
+ /// gradient brings its own.
+ fn with_current_style(&self, mut config: AnimatedGradientConfig) -> AnimatedGradientConfig {
+ if let Some(current) = self.animated_gradient_config() {
+ config.style = current.style;
+ config.dither_size = current.dither_size;
+ }
+ config
+ }
+
fn render_animated_gradient_presets(&self, cx: &mut Context) -> AnyElement {
let theme = self.theme;
let state = &self.sidebar.animated_gradient;
@@ -855,7 +933,8 @@ impl EditorWindow {
.text_color(Hsla::from(theme.editor.text_3)),
)
.on_click(cx.listener(|this, _, window, cx| {
- this.select_animated_gradient(AnimatedGradientConfig::random(), window, cx);
+ let config = this.with_current_style(AnimatedGradientConfig::random());
+ this.select_animated_gradient(config, window, cx);
}));
let mut swatches = vec![shuffle.into_any_element()];
@@ -979,8 +1058,12 @@ impl EditorWindow {
cx: &mut Context,
) -> gpui::Div {
let theme = self.theme;
- let selected = self.animated_gradient_config() == Some(&preset.config);
- let config = preset.config.clone();
+ let config = if saved {
+ preset.config.clone()
+ } else {
+ self.with_current_style(preset.config.clone())
+ };
+ let selected = self.animated_gradient_config() == Some(&config);
let name = SharedString::from(preset.name.clone());
let id = preset.id.clone();
let swatch = div()
@@ -1222,7 +1305,7 @@ impl EditorWindow {
let theme = self.theme;
let state = &self.sidebar.animated_gradient;
let open = state.fine_tune_open.is_open();
- let groups = control_groups(&state.catalog);
+ let groups = control_groups(&state.catalog, config.style);
let active = state.fine_tune_group.min(groups.len().saturating_sub(1));
let tabs = ui::SegmentedControl::icons(
@@ -1483,8 +1566,23 @@ mod tests {
#[test]
fn fine_tune_groups_exclude_motion() {
let catalog = animated_gradient_catalog();
- let groups = control_groups(&catalog);
+ let groups = control_groups(&catalog, AnimatedGradientStyle::Smooth);
assert_eq!(groups.len(), 4);
+ // A dither has a cell size and no lighting or grain to tune.
+ let dither = control_groups(&catalog, AnimatedGradientStyle::Dither);
+ let keys: Vec<_> = dither
+ .iter()
+ .flat_map(|(_, controls)| controls.iter().map(|control| control.key))
+ .collect();
+ assert!(keys.contains(&AnimatedGradientParameter::DitherSize));
+ assert!(!keys.contains(&AnimatedGradientParameter::GrainAmount));
+ assert!(!keys.contains(&AnimatedGradientParameter::Relief));
+ assert!(
+ !groups
+ .iter()
+ .flat_map(|(_, controls)| controls)
+ .any(|control| control.key == AnimatedGradientParameter::DitherSize)
+ );
assert!(groups.iter().all(|(name, _)| *name != "Animation"));
assert!(
groups
diff --git a/apps/desktop-gpui/src/editor_sidebar/cursor.rs b/apps/desktop-gpui/src/editor_sidebar/cursor.rs
index 910310e9b18..5e9168adb9e 100644
--- a/apps/desktop-gpui/src/editor_sidebar/cursor.rs
+++ b/apps/desktop-gpui/src/editor_sidebar/cursor.rs
@@ -5,10 +5,10 @@ use super::*;
use crate::editor_tabs::CursorSlider;
const CARD_GAP: f32 = 8.;
-const TILE_HEIGHT: f32 = 60.;
+const TILE_HEIGHT: f32 = 52.;
const TILE_RADIUS: f32 = 10.;
-const ARROW_BOX: f32 = 34.;
-const CIRCLE_DISC: f32 = 28.;
+const ARROW_BOX: f32 = 28.;
+const CIRCLE_DISC: f32 = 22.;
const CARD_GROUP: &str = "cursor-style-card";
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
@@ -23,7 +23,7 @@ impl CursorCard {
match self {
Self::Default => tr::editor::sidebar::cursor::default(),
Self::Family(CursorFamily::MacOS) => "macOS",
- Self::Family(CursorFamily::MacOSTahoe) => "macOS Tahoe",
+ Self::Family(CursorFamily::MacOSTahoe) => "Tahoe",
Self::Family(CursorFamily::Windows) => "Windows",
Self::Circle => tr::editor::sidebar::cursor::circle(),
}
@@ -188,37 +188,21 @@ impl EditorWindow {
fn render_cursor_tile(&self, card: CursorCard, selected: bool, recorded: bool) -> AnyElement {
let theme = self.theme;
+ let editor = theme.editor;
let art = match card {
- CursorCard::Default => div()
- .flex()
- .items_center()
- .gap(px(12.))
- .child(
- self.cursor_art(
- self.recorded_cursor_family
- .unwrap_or(host_cursor_family())
- .arrow(),
- ARROW_BOX,
- ),
- )
- .child(
- div()
- .text_size(px(12.))
- .child(tr::editor::sidebar::cursor::default()),
- )
- .child(
- div()
- .text_size(px(11.))
- .text_color(Hsla::from(theme.gray_11))
- .child(tr::editor::sidebar::cursor::recorded()),
- )
- .into_any_element(),
+ CursorCard::Default => self.cursor_art(
+ self.recorded_cursor_family
+ .unwrap_or(host_cursor_family())
+ .arrow(),
+ ARROW_BOX,
+ ),
CursorCard::Family(family) => self.cursor_art(family.arrow(), ARROW_BOX),
CursorCard::Circle => circle_art(),
};
div()
.id(SharedString::from(format!("cursor-tile-{}", card.key())))
+ .relative()
.w_full()
.h(px(TILE_HEIGHT))
.rounded(px(TILE_RADIUS))
@@ -227,23 +211,32 @@ impl EditorWindow {
.justify_center()
.map(|this| {
if selected {
- this.border_2()
- .border_color(Hsla::from(theme.blue_8))
- .bg(with_alpha(theme.blue_3, 0.4))
+ this.bg(editor.pill_fill())
+ .shadow(editor.choice_selected_shadow())
} else {
- this.border_1()
- .border_color(Hsla::from(theme.gray_3))
- .bg(Hsla::from(theme.gray_2))
- .group_hover(CARD_GROUP, |this| {
- this.border_color(Hsla::from(theme.gray_5))
- })
+ this.bg(Hsla::from(editor.ctl))
+ .shadow(editor.trough_ring())
+ .group_hover(CARD_GROUP, |this| this.bg(Hsla::from(editor.ctl_hover)))
}
})
- .when(recorded, |this| {
- this.tooltip(move |_window, cx| {
- ui::Tooltip::new(&theme, tr::editor::sidebar::cursor::recorded_tooltip())
- .view(cx)
- })
+ .when(recorded || card == CursorCard::Default, |this| {
+ let label = if card == CursorCard::Default {
+ tr::editor::sidebar::cursor::recorded()
+ } else {
+ tr::editor::sidebar::cursor::recorded_tooltip()
+ };
+ this.tooltip(move |_window, cx| ui::Tooltip::new(&theme, label).view(cx))
+ })
+ .when(card == CursorCard::Default, |this| {
+ this.child(
+ div()
+ .absolute()
+ .top(px(5.))
+ .right(px(5.))
+ .size(px(6.))
+ .rounded_full()
+ .bg(Hsla::from(editor.accent)),
+ )
})
.child(art)
.into_any_element()
@@ -271,29 +264,27 @@ impl EditorWindow {
.gap(px(6.))
.cursor_pointer()
.child(self.render_cursor_tile(card, selected, is_recorded))
- .when(card != CursorCard::Default, |this| {
- this.child(
- div()
- .max_w_full()
- .whitespace_nowrap()
- .overflow_hidden()
- .text_ellipsis()
- .text_size(px(11.))
- .line_height(px(11.))
- .font_weight(FontWeight::MEDIUM)
- .text_color(Hsla::from(if selected {
- theme.gray_12
- } else {
- theme.gray_11
- }))
- .when(!selected, |this| {
- this.group_hover(CARD_GROUP, |this| {
- this.text_color(Hsla::from(theme.gray_12))
- })
+ .child(
+ div()
+ .max_w_full()
+ .whitespace_nowrap()
+ .overflow_hidden()
+ .text_ellipsis()
+ .text_size(px(11.))
+ .line_height(px(13.))
+ .font_weight(FontWeight::MEDIUM)
+ .text_color(Hsla::from(if selected {
+ theme.editor.text_1
+ } else {
+ theme.editor.text_2
+ }))
+ .when(!selected, |this| {
+ this.group_hover(CARD_GROUP, |this| {
+ this.text_color(Hsla::from(theme.editor.text_1))
})
- .child(card.label()),
- )
- })
+ })
+ .child(card.label()),
+ )
.on_click(cx.listener(move |this, _, window, cx| {
let cursor_type = cursor_type.clone();
this.edit_project("cursor-type", window, cx, move |project| {
@@ -328,24 +319,18 @@ impl EditorWindow {
.flex()
.flex_col()
.gap(px(CARD_GAP))
- .child(self.render_cursor_card(
- CursorCard::Default,
- selected == CursorCard::Default,
- recorded,
- cx,
- ))
.child(
div().flex().flex_row().gap(px(CARD_GAP)).children(
cursor_cards()
.into_iter()
- .filter(|card| *card != CursorCard::Default)
.map(|card| self.render_cursor_card(card, selected == card, recorded, cx)),
),
)
.child(
div()
- .text_size(px(11.))
- .text_color(Hsla::from(self.theme.gray_11))
+ .text_size(px(12.))
+ .line_height(px(16.))
+ .text_color(Hsla::from(self.theme.editor.text_2))
.child(description),
)
.into_any_element()
diff --git a/apps/desktop-gpui/src/editor_sidebar/input_sounds.rs b/apps/desktop-gpui/src/editor_sidebar/input_sounds.rs
new file mode 100644
index 00000000000..f4ab5a5c838
--- /dev/null
+++ b/apps/desktop-gpui/src/editor_sidebar/input_sounds.rs
@@ -0,0 +1,367 @@
+use cap_editor::InputSoundPreview;
+use cap_project::{ClickSoundType, KeySoundType, KeyboardData};
+
+use super::*;
+
+const TILE_GAP: f32 = 8.;
+const TILE_HEIGHT: f32 = 34.;
+const TILE_RADIUS: f32 = 10.;
+const TILE_GROUP: &str = "input-sound-tile";
+
+const KEY_TYPES: [KeySoundType; 4] = [
+ KeySoundType::Mechanical,
+ KeySoundType::Deep,
+ KeySoundType::Laptop,
+ KeySoundType::Typewriter,
+];
+const CLICK_TYPES: [ClickSoundType; 2] = [ClickSoundType::Mouse, ClickSoundType::Trackpad];
+
+#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
+pub enum InputSoundSlider {
+ Keys,
+ Clicks,
+}
+
+impl InputSoundSlider {
+ pub fn limits(self) -> (f32, f32, f32) {
+ (0., 100., 1.)
+ }
+
+ pub fn read(self, project: &ProjectConfiguration) -> f32 {
+ let volume = match self {
+ Self::Keys => project
+ .keyboard
+ .as_ref()
+ .map_or(cap_project::DEFAULT_INPUT_SOUND_VOLUME, |keyboard| {
+ keyboard.settings.key_sound_volume
+ }),
+ Self::Clicks => project.cursor.click_sound_volume,
+ };
+ (volume * 100.).round()
+ }
+}
+
+fn key_label(kind: KeySoundType) -> &'static str {
+ match kind {
+ KeySoundType::Mechanical => tr::editor::sidebar::input_sounds::mechanical(),
+ KeySoundType::Deep => tr::editor::sidebar::input_sounds::deep(),
+ KeySoundType::Laptop => tr::editor::sidebar::input_sounds::laptop(),
+ KeySoundType::Typewriter => tr::editor::sidebar::input_sounds::typewriter(),
+ }
+}
+
+fn key_description(kind: KeySoundType) -> &'static str {
+ match kind {
+ KeySoundType::Mechanical => tr::editor::sidebar::input_sounds::mechanical_description(),
+ KeySoundType::Deep => tr::editor::sidebar::input_sounds::deep_description(),
+ KeySoundType::Laptop => tr::editor::sidebar::input_sounds::laptop_description(),
+ KeySoundType::Typewriter => tr::editor::sidebar::input_sounds::typewriter_description(),
+ }
+}
+
+fn click_label(kind: ClickSoundType) -> &'static str {
+ match kind {
+ ClickSoundType::Mouse => tr::editor::sidebar::input_sounds::mouse(),
+ ClickSoundType::Trackpad => tr::editor::sidebar::input_sounds::trackpad(),
+ }
+}
+
+fn click_description(kind: ClickSoundType) -> &'static str {
+ match kind {
+ ClickSoundType::Mouse => tr::editor::sidebar::input_sounds::mouse_description(),
+ ClickSoundType::Trackpad => tr::editor::sidebar::input_sounds::trackpad_description(),
+ }
+}
+
+/// Plays a short phrase in the chosen sound off the UI thread, through the
+/// default output, so a choice can be heard without starting playback.
+fn audition(preview: InputSoundPreview, volume: f32) {
+ let spawned = std::thread::Builder::new()
+ .name("input-sound-preview".into())
+ .spawn(move || {
+ let Some(samples) = cap_editor::render_input_sound_preview(preview, volume) else {
+ return;
+ };
+ let played = rodio::OutputStream::try_default()
+ .map_err(|error| error.to_string())
+ .and_then(|(_stream, handle)| {
+ let sink = rodio::Sink::try_new(&handle).map_err(|error| error.to_string())?;
+ sink.append(rodio::buffer::SamplesBuffer::new(
+ 2,
+ cap_audio::AudioData::SAMPLE_RATE,
+ samples,
+ ));
+ sink.sleep_until_end();
+ Ok(())
+ });
+ if let Err(error) = played {
+ tracing::warn!(%error, "Could not preview the input sound");
+ }
+ });
+ if let Err(error) = spawned {
+ tracing::warn!(%error, "Could not start the input sound preview");
+ }
+}
+
+impl EditorWindow {
+ pub(crate) fn apply_input_sound_slider(
+ &mut self,
+ slider: InputSoundSlider,
+ value: f32,
+ window: &mut Window,
+ cx: &mut Context,
+ ) {
+ let volume = (value / 100.).clamp(0., 1.);
+ self.edit_project_without_timeline("input-sound-volume", window, cx, move |project| {
+ match slider {
+ InputSoundSlider::Keys => {
+ project
+ .keyboard
+ .get_or_insert_with(KeyboardData::default)
+ .settings
+ .key_sound_volume = volume
+ }
+ InputSoundSlider::Clicks => project.cursor.click_sound_volume = volume,
+ }
+ true
+ });
+ }
+
+ fn render_sound_tile(
+ &self,
+ id: SharedString,
+ label: &'static str,
+ selected: bool,
+ on_click: impl Fn(&mut Self, &mut Window, &mut Context) + 'static,
+ cx: &mut Context,
+ ) -> AnyElement {
+ // Painted like the key style and theme tiles above it.
+ let editor = self.theme.editor;
+ div()
+ .id(id)
+ .group(TILE_GROUP)
+ .flex_1()
+ .min_w_0()
+ .h(px(TILE_HEIGHT))
+ .rounded(px(TILE_RADIUS))
+ .flex()
+ .items_center()
+ .justify_center()
+ .px(px(8.))
+ .map(|this| {
+ if selected {
+ this.bg(editor.pill_fill())
+ .shadow(editor.choice_selected_shadow())
+ } else {
+ this.bg(Hsla::from(editor.ctl))
+ .shadow(editor.trough_ring())
+ .cursor_pointer()
+ .hover(move |style| style.bg(Hsla::from(editor.ctl_hover)))
+ }
+ })
+ .child(
+ div()
+ .max_w_full()
+ .whitespace_nowrap()
+ .overflow_hidden()
+ .text_ellipsis()
+ .text_size(px(12.))
+ .text_color(Hsla::from(if selected {
+ editor.text_1
+ } else {
+ editor.text_2
+ }))
+ .child(label),
+ )
+ .on_click(cx.listener(move |this, _, window, cx| on_click(this, window, cx)))
+ .into_any_element()
+ }
+
+ fn render_sound_options(
+ &self,
+ rows: Vec>,
+ description: &'static str,
+ volume: SliderKey,
+ cx: &mut Context,
+ ) -> AnyElement {
+ div()
+ .flex()
+ .flex_col()
+ .gap(px(TILE_GAP))
+ .pt(px(4.))
+ .pb(px(8.))
+ .children(
+ rows.into_iter()
+ .map(|row| div().flex().flex_row().gap(px(TILE_GAP)).children(row)),
+ )
+ .child(
+ div()
+ .text_size(px(11.))
+ .text_color(Hsla::from(self.theme.gray_11))
+ .child(description),
+ )
+ .child(self.slider_field(tr::editor::sidebar::input_sounds::volume(), volume, "%", cx))
+ .into_any_element()
+ }
+
+ /// Key sounds follow the keyboard track: they play for presses while their
+ /// keys are on screen, so they live with the overlay's own settings.
+ pub(crate) fn render_key_sounds(&self, cx: &mut Context) -> AnyElement {
+ let theme = self.theme;
+ let settings = crate::editor_tabs::keyboard_settings(&self.project);
+ let enabled = settings.key_sounds;
+ let selected = settings.key_sound_type;
+ let mut section = div().flex().flex_col().child(
+ ui::Field::inline(&theme, tr::editor::sidebar::input_sounds::key_sounds()).value(
+ ui::Toggle::plain(&theme, "key-sounds", enabled)
+ .on_click(cx.listener(move |this, _, window, cx| {
+ this.edit_project_without_timeline("key-sounds", window, cx, |project| {
+ let settings = &mut project
+ .keyboard
+ .get_or_insert_with(KeyboardData::default)
+ .settings;
+ settings.key_sounds = !enabled;
+ true
+ });
+ }))
+ .into_any_element(),
+ ),
+ );
+ if enabled {
+ let tiles = KEY_TYPES
+ .iter()
+ .map(|&kind| {
+ self.render_sound_tile(
+ SharedString::from(format!("key-sound-{kind:?}")),
+ key_label(kind),
+ kind == selected,
+ move |this, window, cx| {
+ this.edit_project_without_timeline(
+ "key-sound-type",
+ window,
+ cx,
+ |project| {
+ let settings = &mut project
+ .keyboard
+ .get_or_insert_with(KeyboardData::default)
+ .settings;
+ let changed = settings.key_sound_type != kind;
+ settings.key_sound_type = kind;
+ changed
+ },
+ );
+ let volume = crate::editor_tabs::keyboard_settings(&this.project)
+ .key_sound_volume;
+ audition(InputSoundPreview::Keys(kind), volume);
+ },
+ cx,
+ )
+ })
+ .collect::>();
+ let mut tiles = tiles.into_iter();
+ let rows = vec![tiles.by_ref().take(2).collect(), tiles.collect()];
+ section = section.child(self.render_sound_options(
+ rows,
+ key_description(selected),
+ SliderKey::InputSound(InputSoundSlider::Keys),
+ cx,
+ ));
+ }
+ section.into_any_element()
+ }
+
+ /// Click sounds sit with the cursor, which has to be visible for them to
+ /// play. Inside a style segment the cursor tab edits that segment's look,
+ /// and sounds are not part of it, so the section is left out there.
+ pub(crate) fn render_click_sounds(&self, cx: &mut Context) -> AnyElement {
+ if self.sidebar.style_target.is_some() {
+ return div().into_any_element();
+ }
+ let theme = self.theme;
+ let cursor = &self.project.cursor;
+ let enabled = cursor.click_sounds;
+ let selected = cursor.click_sound_type;
+ let mut section = div().flex().flex_col().child(
+ ui::Field::inline(&theme, tr::editor::sidebar::input_sounds::click_sounds()).value(
+ ui::Toggle::plain(&theme, "click-sounds", enabled)
+ .on_click(cx.listener(move |this, _, window, cx| {
+ this.edit_project_without_timeline("click-sounds", window, cx, |project| {
+ project.cursor.click_sounds = !enabled;
+ true
+ });
+ }))
+ .into_any_element(),
+ ),
+ );
+ if enabled {
+ let tiles = CLICK_TYPES
+ .iter()
+ .map(|&kind| {
+ self.render_sound_tile(
+ SharedString::from(format!("click-sound-{kind:?}")),
+ click_label(kind),
+ kind == selected,
+ move |this, window, cx| {
+ this.edit_project_without_timeline(
+ "click-sound-type",
+ window,
+ cx,
+ |project| {
+ let changed = project.cursor.click_sound_type != kind;
+ project.cursor.click_sound_type = kind;
+ changed
+ },
+ );
+ audition(
+ InputSoundPreview::Clicks(kind),
+ this.project.cursor.click_sound_volume,
+ );
+ },
+ cx,
+ )
+ })
+ .collect();
+ section = section.child(self.render_sound_options(
+ vec![tiles],
+ click_description(selected),
+ SliderKey::InputSound(InputSoundSlider::Clicks),
+ cx,
+ ));
+ }
+ section.into_any_element()
+ }
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ #[test]
+ fn volume_sliders_read_the_saved_fraction_as_a_percent() {
+ let mut project = ProjectConfiguration::default();
+ assert_eq!(InputSoundSlider::Keys.read(&project), 60.);
+ assert_eq!(InputSoundSlider::Clicks.read(&project), 60.);
+ project.keyboard = Some(KeyboardData::default());
+ project.keyboard.as_mut().unwrap().settings.key_sound_volume = 0.25;
+ project.cursor.click_sound_volume = 1.;
+ assert_eq!(InputSoundSlider::Keys.read(&project), 25.);
+ assert_eq!(InputSoundSlider::Clicks.read(&project), 100.);
+ assert_eq!(InputSoundSlider::Keys.limits(), (0., 100., 1.));
+ }
+
+ #[test]
+ fn every_sound_type_has_its_own_label_and_description() {
+ let labels: std::collections::HashSet<&str> = KEY_TYPES
+ .iter()
+ .map(|kind| key_label(*kind))
+ .chain(CLICK_TYPES.iter().map(|kind| click_label(*kind)))
+ .collect();
+ assert_eq!(labels.len(), KEY_TYPES.len() + CLICK_TYPES.len());
+ let descriptions: std::collections::HashSet<&str> = KEY_TYPES
+ .iter()
+ .map(|kind| key_description(*kind))
+ .chain(CLICK_TYPES.iter().map(|kind| click_description(*kind)))
+ .collect();
+ assert_eq!(descriptions.len(), labels.len());
+ }
+}
diff --git a/apps/desktop-gpui/src/editor_tabs.rs b/apps/desktop-gpui/src/editor_tabs.rs
index 282d779d97a..640f57e4124 100644
--- a/apps/desktop-gpui/src/editor_tabs.rs
+++ b/apps/desktop-gpui/src/editor_tabs.rs
@@ -126,7 +126,12 @@ pub const CURSOR_STYLES: [(CursorAnimationStyle, Label, Label); 4] = [
];
/// `FONT_OPTIONS` (`text-style.tsx:12-16`).
-pub const FONT_OPTIONS: [&str; 3] = ["System Sans-Serif", "System Serif", "System Monospace"];
+pub const FONT_OPTIONS: [&str; 4] = [
+ "Inter",
+ "System Sans-Serif",
+ "System Serif",
+ "System Monospace",
+];
/// The project keeps the English `FONT_OPTIONS` value; menus show it translated.
fn font_option_label(font: &str) -> SharedString {
@@ -146,10 +151,14 @@ pub const TEXT_WEIGHTS: [(u32, Label); 3] = [
];
/// `KEYBOARD_POSITION_OPTIONS` (`text-style.tsx:28-35`).
-pub const KEYBOARD_POSITIONS: [(&str, Label); 6] = [
+/// Where the keys can sit, row by row as the position picker lays them out.
+pub const KEYBOARD_POSITIONS: [(&str, Label); 9] = [
("top-left", tr::editor::tabs::position::top_left),
("top-center", tr::editor::tabs::position::top_center),
("top-right", tr::editor::tabs::position::top_right),
+ ("middle-left", tr::editor::tabs::position::middle_left),
+ ("center", tr::editor::tabs::position::center),
+ ("middle-right", tr::editor::tabs::position::middle_right),
("bottom-left", tr::editor::tabs::position::bottom_left),
("bottom-center", tr::editor::tabs::position::bottom_center),
("bottom-right", tr::editor::tabs::position::bottom_right),
@@ -269,6 +278,7 @@ pub struct CaptionPreset {
pub id: &'static str,
pub label: Label,
pub description: Label,
+ pub font: &'static str,
pub font_weight: u32,
pub size: u32,
pub color: &'static str,
@@ -284,11 +294,272 @@ pub struct CaptionPreset {
pub fade_duration: f32,
}
+/// Writes a caption preset's styling into `settings`.
+pub(crate) fn apply_caption_preset_settings(
+ settings: &mut CaptionSettings,
+ preset: &CaptionPreset,
+) {
+ settings.preset = preset.id.to_string();
+ // A font the user picked themselves stays; only a preset's own face is
+ // swapped for the new preset's.
+ if CAPTION_PRESETS
+ .iter()
+ .any(|other| other.font == settings.font)
+ {
+ settings.font = preset.font.to_string();
+ }
+ settings.font_weight = preset.font_weight;
+ settings.size = preset.size;
+ settings.color = preset.color.to_string();
+ settings.background_color = preset.background_color.to_string();
+ settings.background_opacity = preset.background_opacity;
+ settings.outline = preset.outline;
+ settings.outline_color = preset.outline_color.to_string();
+ settings.highlight_color = preset.highlight_color.to_string();
+ settings.active_word_highlight = preset.active_word_highlight;
+ settings.highlight_style = preset.highlight_style.to_string();
+ settings.animation = preset.animation.to_string();
+ settings.uppercase = preset.uppercase;
+ settings.fade_duration = preset.fade_duration;
+}
+
+/// The key styles, each with the keys its tile shows.
+static KEY_STYLES: [(&str, fn() -> &'static str, &[&str]); 5] = [
+ (
+ "classic",
+ tr::editor::tabs::keyboard::style_classic,
+ &["⌘", "K"],
+ ),
+ (
+ "macos",
+ tr::editor::tabs::keyboard::style_macos,
+ &["⌘", "K"],
+ ),
+ (
+ "windows",
+ tr::editor::tabs::keyboard::style_windows,
+ &["Ctrl", "K"],
+ ),
+ (
+ "linux",
+ tr::editor::tabs::keyboard::style_linux,
+ &["Super", "K"],
+ ),
+ (
+ "mechanical",
+ tr::editor::tabs::keyboard::style_mechanical,
+ &["⌘", "K"],
+ ),
+];
+
+/// How the style tiles are set out: the three platform keyboards side by
+/// side, then the desk keyboard and the plain label.
+const KEY_STYLE_ROWS: [&[&str]; 2] = [&["macos", "windows", "linux"], &["mechanical", "classic"]];
+
+static KEY_THEMES: [(&str, fn() -> &'static str); 3] = [
+ ("light", tr::editor::tabs::keyboard::theme_light),
+ ("dark", tr::editor::tabs::keyboard::theme_dark),
+ ("retro", tr::editor::tabs::keyboard::theme_retro),
+];
+
+fn rgba(color: [f32; 4]) -> Hsla {
+ gpui::Rgba {
+ r: color[0],
+ g: color[1],
+ b: color[2],
+ a: color[3],
+ }
+ .into()
+}
+
+/// A small key, painted like the renderer paints it: the gradient top, the
+/// side as a solid lip under it, a fine border and a soft shadow.
+pub(crate) fn key_chip(
+ style: cap_rendering::keycaps::KeycapStyle,
+ theme: cap_rendering::keycaps::KeycapTheme,
+ label: &str,
+ modifier: bool,
+) -> gpui::Div {
+ key_chip_sized(style, theme, label, modifier, 24.)
+}
+
+pub(crate) fn key_chip_sized(
+ style: cap_rendering::keycaps::KeycapStyle,
+ theme: cap_rendering::keycaps::KeycapTheme,
+ label: &str,
+ modifier: bool,
+ height: f32,
+) -> gpui::Div {
+ #[allow(non_snake_case)]
+ let HEIGHT = height;
+ let geometry = style.geometry();
+ let depth = (geometry.depth * HEIGHT).max(2.);
+ if style.is_mechanical() {
+ return mechanical_chip(theme.mechanical_palette(modifier), label, HEIGHT, depth);
+ }
+ let palette = theme.palette(modifier);
+ div()
+ .h(px(HEIGHT - depth))
+ .min_w(px(HEIGHT - depth))
+ .px(px(HEIGHT * 0.25))
+ .mb(px(depth))
+ .flex()
+ .items_center()
+ .justify_center()
+ .rounded(px(geometry.radius * HEIGHT))
+ .bg(gpui::linear_gradient(
+ 180.,
+ gpui::linear_color_stop(rgba(palette.top[0]), 0.),
+ gpui::linear_color_stop(rgba(palette.top[1]), 1.),
+ ))
+ .border_1()
+ .border_color(rgba(palette.border))
+ .shadow(vec![
+ gpui::BoxShadow {
+ color: rgba(palette.side[1]),
+ offset: gpui::point(px(0.), px(depth)),
+ blur_radius: px(0.),
+ spread_radius: px(0.),
+ inset: false,
+ },
+ gpui::BoxShadow {
+ color: gpui::hsla(0., 0., 0., palette.shadow * 0.7),
+ offset: gpui::point(px(0.), px(depth + 1.)),
+ blur_radius: px(3.),
+ spread_radius: px(0.),
+ inset: false,
+ },
+ ])
+ .text_size(px(
+ HEIGHT * if label.chars().count() > 1 { 0.4 } else { 0.46 }
+ ))
+ .text_color(rgba(palette.label))
+ .child(label.to_string())
+}
+
+/// A mechanical key in small: the walls as the body, lit lighter at the back
+/// than the deep front, and the top face set in from them.
+fn mechanical_chip(
+ palette: cap_rendering::keycaps::KeycapPalette,
+ label: &str,
+ height: f32,
+ depth: f32,
+) -> gpui::Div {
+ let inset = (height * 0.1).max(2.);
+ div()
+ .h(px(height))
+ .min_w(px(height))
+ .pt(px((inset * 0.4).max(1.)))
+ .px(px(inset))
+ .pb(px(depth + inset * 0.45))
+ .flex()
+ .rounded(px(height * 0.11))
+ .bg(gpui::linear_gradient(
+ 180.,
+ gpui::linear_color_stop(rgba(palette.side[0]), 0.),
+ gpui::linear_color_stop(rgba(palette.side[1]), 1.),
+ ))
+ .border_1()
+ .border_color(rgba(palette.border))
+ .shadow(vec![gpui::BoxShadow {
+ color: gpui::hsla(0., 0., 0., palette.shadow * 0.7),
+ offset: gpui::point(px(0.), px(1.5)),
+ blur_radius: px(3.),
+ spread_radius: px(0.),
+ inset: false,
+ }])
+ .child(
+ div()
+ .flex_1()
+ .px(px(height * 0.16))
+ .flex()
+ .items_center()
+ .justify_center()
+ .rounded(px(height * 0.08))
+ .bg(gpui::linear_gradient(
+ 180.,
+ gpui::linear_color_stop(rgba(palette.top[0]), 0.),
+ gpui::linear_color_stop(rgba(palette.top[1]), 1.),
+ ))
+ .shadow(vec![gpui::BoxShadow {
+ color: rgba(palette.highlight),
+ offset: gpui::point(px(0.), px(0.5)),
+ blur_radius: px(0.),
+ spread_radius: px(0.),
+ inset: true,
+ }])
+ .text_size(px(
+ height * if label.chars().count() > 1 { 0.34 } else { 0.4 }
+ ))
+ .text_color(rgba(palette.label))
+ .child(label.to_string()),
+ )
+}
+
+/// A tile's preview: its keys as keycaps, or the classic label.
+fn key_preview(
+ style: cap_rendering::keycaps::KeycapStyle,
+ theme: cap_rendering::keycaps::KeycapTheme,
+ keys: &[&str],
+) -> gpui::AnyElement {
+ if style == cap_rendering::keycaps::KeycapStyle::Classic {
+ return div()
+ .h(px(22.))
+ .px(px(9.))
+ .flex()
+ .items_center()
+ .rounded(px(11.))
+ .bg(gpui::hsla(0., 0., 0., 0.9))
+ .text_size(px(11.))
+ .text_color(gpui::white())
+ .child(keys.concat())
+ .into_any_element();
+ }
+ div()
+ .flex()
+ .flex_row()
+ .items_end()
+ .gap(px(4.))
+ .children(
+ keys.iter()
+ .enumerate()
+ .map(|(index, key)| key_chip(style, theme, key, index + 1 < keys.len())),
+ )
+ .into_any_element()
+}
+
+/// What was pasted into Type Keys as one line: a script's line breaks and
+/// runs of spaces become single spaces.
+pub(crate) fn key_prompt_text(input: &str) -> String {
+ input.split_whitespace().collect::>().join(" ")
+}
+
pub static CAPTION_PRESETS: &[CaptionPreset] = &[
+ // New captions start here: see `CaptionSettings::default`.
+ CaptionPreset {
+ id: "soft",
+ label: tr::editor::tabs::captions::preset::soft,
+ description: tr::editor::tabs::captions::preset::soft_description,
+ font: "Inter",
+ font_weight: 600,
+ size: 46,
+ color: "#FFFFFF",
+ background_color: "#1C1C1F",
+ background_opacity: 86,
+ outline: false,
+ outline_color: "#000000",
+ highlight_color: "#FFFFFF",
+ active_word_highlight: true,
+ highlight_style: "color",
+ animation: "pop",
+ uppercase: false,
+ fade_duration: 0.15,
+ },
CaptionPreset {
id: "classic",
label: tr::editor::tabs::captions::preset::classic,
description: tr::editor::tabs::captions::preset::classic_description,
+ font: "System Sans-Serif",
font_weight: 700,
size: 50,
color: "#FFFFFF",
@@ -297,7 +568,7 @@ pub static CAPTION_PRESETS: &[CaptionPreset] = &[
outline: false,
outline_color: "#000000",
highlight_color: "#FFFFFF",
- active_word_highlight: false,
+ active_word_highlight: true,
highlight_style: "color",
animation: "bounce",
uppercase: false,
@@ -307,6 +578,7 @@ pub static CAPTION_PRESETS: &[CaptionPreset] = &[
id: "karaoke",
label: tr::editor::tabs::captions::preset::karaoke,
description: tr::editor::tabs::captions::preset::karaoke_description,
+ font: "System Sans-Serif",
font_weight: 700,
size: 52,
color: "#FFFFFF",
@@ -325,6 +597,7 @@ pub static CAPTION_PRESETS: &[CaptionPreset] = &[
id: "highlight",
label: tr::editor::tabs::captions::preset::highlight,
description: tr::editor::tabs::captions::preset::highlight_description,
+ font: "System Sans-Serif",
font_weight: 700,
size: 54,
color: "#FFFFFF",
@@ -343,6 +616,7 @@ pub static CAPTION_PRESETS: &[CaptionPreset] = &[
id: "pop",
label: tr::editor::tabs::captions::preset::pop,
description: tr::editor::tabs::captions::preset::pop_description,
+ font: "System Sans-Serif",
font_weight: 700,
size: 56,
color: "#FFFFFF",
@@ -361,6 +635,7 @@ pub static CAPTION_PRESETS: &[CaptionPreset] = &[
id: "minimal",
label: tr::editor::tabs::captions::preset::minimal,
description: tr::editor::tabs::captions::preset::minimal_description,
+ font: "System Sans-Serif",
font_weight: 600,
size: 46,
color: "#FFFFFF",
@@ -747,12 +1022,15 @@ pub fn keyboard_settings(project: &ProjectConfiguration) -> KeyboardSettings {
.unwrap_or_default()
}
-fn keyboard_generation_settings_fingerprint(settings: &KeyboardSettings) -> (u64, u32, bool, bool) {
+fn keyboard_generation_settings_fingerprint(
+ settings: &KeyboardSettings,
+) -> (u64, u32, bool, bool, bool) {
(
settings.grouping_threshold_ms.to_bits(),
settings.linger_duration.to_bits(),
settings.show_modifiers,
settings.show_special_keys,
+ settings.show_typing,
)
}
@@ -801,7 +1079,6 @@ pub enum SidebarMenu {
CaptionAnimation,
CaptionWeight,
KeyboardFont,
- KeyboardPosition,
KeyboardWeight,
/// The segment panels' own selects carry their segment index.
///
@@ -916,10 +1193,6 @@ impl EditorWindow {
.iter()
.map(|font| ui::MenuItem::new(font_option_label(font), *font == keyboard.font))
.collect(),
- SidebarMenu::KeyboardPosition => KEYBOARD_POSITIONS
- .iter()
- .map(|(value, label)| ui::MenuItem::new(label(), *value == keyboard.position))
- .collect(),
SidebarMenu::KeyboardWeight => TEXT_WEIGHTS
.iter()
.map(|(weight, label)| ui::MenuItem::new(label(), *weight == keyboard.font_weight))
@@ -1167,15 +1440,6 @@ impl EditorWindow {
settings.font = font
});
}
- SidebarMenu::KeyboardPosition => {
- let Some((value, _)) = KEYBOARD_POSITIONS.get(index) else {
- return;
- };
- let value = value.to_string();
- self.set_keyboard_setting("keyboard-position", window, cx, move |settings| {
- settings.position = value
- });
- }
SidebarMenu::KeyboardWeight => {
let Some((weight, _)) = TEXT_WEIGHTS.get(index) else {
return;
@@ -1245,6 +1509,20 @@ impl EditorWindow {
self.set_keyboard_setting_inner(true, reason, window, cx, change);
}
+ /// The keycap style the renderer draws for `settings`: an older project's
+ /// `auto` resolves for the platform it was recorded on, and stays on its
+ /// label when any key was coloured on its own.
+ pub(crate) fn effective_key_style<'a>(&self, settings: &'a KeyboardSettings) -> &'a str {
+ let platform = self.summary().and_then(|summary| summary.platform.as_ref());
+ let styled_keys = settings.style == "auto"
+ && self.project.timeline.as_ref().is_some_and(|timeline| {
+ timeline.keyboard_segments.iter().any(|segment| {
+ segment.color_override.is_some() || segment.background_color_override.is_some()
+ })
+ });
+ settings.effective_style_for(platform, styled_keys)
+ }
+
fn set_keyboard_setting_inner(
&mut self,
rebuild_timeline: bool,
@@ -1253,7 +1531,20 @@ impl EditorWindow {
cx: &mut Context,
change: impl FnOnce(&mut KeyboardSettings),
) {
- let apply = |project: &mut ProjectConfiguration| with_keyboard_settings(project, change);
+ // The first edit settles an older project's `auto` style on what it
+ // draws now, so editing its label (say, back to the default colours)
+ // can never flip it to keys mid-edit.
+ let settled = keyboard_settings(&self.project);
+ let settled =
+ (settled.style == "auto").then(|| self.effective_key_style(&settled).to_string());
+ let apply = |project: &mut ProjectConfiguration| {
+ with_keyboard_settings(project, |settings| {
+ if let Some(style) = settled {
+ settings.style = style;
+ }
+ change(settings);
+ })
+ };
if rebuild_timeline {
self.edit_project(reason, window, cx, apply);
} else {
@@ -1519,6 +1810,16 @@ impl EditorWindow {
/// `CameraConfig` (`ConfigSidebar.tsx:2978-3330`).
pub(crate) fn render_camera_tab(&self, cx: &mut Context) -> AnyElement {
let theme = self.theme;
+ if !self.summary().is_some_and(|summary| summary.has_camera) {
+ return crate::editor_side_panel::panel_empty_state(
+ &theme,
+ "icons/camera.svg",
+ tr::editor::tabs::camera::empty_title(),
+ tr::editor::tabs::camera::empty_description(),
+ )
+ .pt(px(40.))
+ .into_any_element();
+ }
let camera = &self.project.camera;
let manual = camera.manual_position;
@@ -2148,6 +2449,19 @@ impl EditorWindow {
/// The cursor tab (`:820-1000`).
pub(crate) fn render_cursor_tab(&self, cx: &mut Context) -> AnyElement {
let theme = self.theme;
+ if !self
+ .summary()
+ .is_some_and(|summary| summary.has_cursor_data)
+ {
+ return crate::editor_side_panel::panel_empty_state(
+ &theme,
+ "icons/cursor.svg",
+ tr::editor::tabs::cursor::empty_title(),
+ tr::editor::tabs::cursor::empty_description(),
+ )
+ .pt(px(40.))
+ .into_any_element();
+ }
let cursor = &self.project.cursor;
let hidden = cursor.hide;
@@ -2192,6 +2506,7 @@ impl EditorWindow {
cx,
))
.child(self.render_cursor_ripple(cx))
+ .child(self.render_click_sounds(cx))
.child(
ui::Field::inline(&theme, tr::editor::tabs::cursor::hide_when_idle()).value(
ui::Toggle::plain(&theme, "cursor-idle", idle)
@@ -2238,20 +2553,22 @@ impl EditorWindow {
let smooth = !cursor.raw;
let mut body = body
.child(
- ui::Field::section(&theme, tr::editor::tabs::cursor::movement_style()).child(
- ui::RadioCards::plain(
- &theme,
- "cursor-style",
- CURSOR_STYLES
- .iter()
- .map(|(_, label, description)| {
- ui::RadioCard::new(label(), Some(description()))
- })
- .collect(),
- style_index,
- )
- .on_select(cx.listener(
- |this, index: &usize, window, cx| {
+ ui::Field::section(&theme, tr::editor::tabs::cursor::movement_style())
+ .child(
+ ui::SegmentedControl::editor(
+ &theme,
+ "cursor-style",
+ CURSOR_STYLES
+ .iter()
+ .enumerate()
+ .map(|(index, (_, label, _))| {
+ ui::SegmentOption::new(label(), style_index == Some(index))
+ })
+ .collect(),
+ )
+ .stretch()
+ .item_height(px(28.))
+ .on_select(cx.listener(|this, index: &usize, window, cx| {
let Some((style, _, _)) = CURSOR_STYLES.get(*index) else {
return;
};
@@ -2267,9 +2584,19 @@ impl EditorWindow {
}
true
});
+ }))
+ .into_any_element(),
+ )
+ .children(style_index.and_then(|index| CURSOR_STYLES.get(index)).map(
+ |(_, _, description)| {
+ div()
+ .text_size(px(12.))
+ .line_height(px(16.))
+ .text_color(Hsla::from(theme.editor.text_2))
+ .child(description())
+ .into_any_element()
},
)),
- ),
)
.child(
div()
@@ -2453,6 +2780,16 @@ impl EditorWindow {
let Some(timeline) = project.timeline.as_mut() else {
return false;
};
+ // Keys added by hand are not the recording's to replace.
+ let mut segments = segments;
+ segments.extend(
+ timeline
+ .keyboard_segments
+ .iter()
+ .filter(|segment| cap_project::is_manual_keyboard_segment(segment))
+ .cloned(),
+ );
+ segments.sort_by(|a, b| a.start.total_cmp(&b.start));
timeline.keyboard_segments = segments;
true
});
@@ -2476,8 +2813,135 @@ impl EditorWindow {
}
/// `KeyboardTab` (`KeyboardTab.tsx:128-553`).
+ /// The key style tiles, then, for keycaps, the theme tiles. Each tile
+ /// shows a small key in the renderer's own colours.
+ fn render_key_style_picker(
+ &self,
+ settings: &KeyboardSettings,
+ cx: &mut Context,
+ ) -> impl IntoElement {
+ use cap_rendering::keycaps::{KeycapStyle, KeycapTheme};
+ let theme = self.theme;
+ let effective = self.effective_key_style(settings).to_string();
+ let style = KeycapStyle::from_setting_for(
+ &effective,
+ self.summary().and_then(|summary| summary.platform.as_ref()),
+ );
+ let key_theme = KeycapTheme::from_setting(&settings.theme);
+ let tile_for = |&(value, label, keys): &(&'static str, fn() -> &'static str, &[&str])| {
+ let tile_style = KeycapStyle::from_setting(value);
+ self.key_choice_tile(
+ SharedString::from(format!("keyboard-style-{value}")),
+ label(),
+ effective == value,
+ key_preview(tile_style, key_theme, keys),
+ // The timeline's key labels follow the style, so it rebuilds.
+ cx.listener(move |this, _, window, cx| {
+ this.set_keyboard_setting("keyboard-style", window, cx, move |settings| {
+ settings.style = value.to_string()
+ });
+ }),
+ )
+ };
+ let row = |values: &[&str]| {
+ div().flex().flex_row().gap(px(8.)).children(
+ values
+ .iter()
+ .filter_map(|value| KEY_STYLES.iter().find(|(v, ..)| v == value))
+ .map(&tile_for),
+ )
+ };
+ let keys = KEY_STYLES
+ .iter()
+ .find(|(value, ..)| *value == effective)
+ .map_or(&["⌘", "K"][..], |(_, _, keys)| keys);
+ let themes = KEY_THEMES.iter().map(|(value, label)| {
+ let value = *value;
+ self.key_choice_tile(
+ SharedString::from(format!("keyboard-theme-{value}")),
+ label(),
+ settings.theme == value,
+ key_preview(style, KeycapTheme::from_setting(value), keys),
+ cx.listener(move |this, _, window, cx| {
+ this.set_keyboard_setting_inner(
+ false,
+ "keyboard-theme",
+ window,
+ cx,
+ move |settings| settings.theme = value.to_string(),
+ );
+ }),
+ )
+ });
+ div()
+ .flex()
+ .flex_col()
+ .gap(px(16.))
+ .child(
+ ui::Field::section(&theme, tr::editor::tabs::keyboard::key_style()).child(
+ div()
+ .flex()
+ .flex_col()
+ .gap(px(8.))
+ .children(KEY_STYLE_ROWS.iter().map(|values| row(values))),
+ ),
+ )
+ .when(style != KeycapStyle::Classic, |this| {
+ this.child(
+ ui::Field::section(&theme, tr::editor::tabs::keyboard::key_theme())
+ .child(div().flex().flex_row().gap(px(8.)).children(themes)),
+ )
+ })
+ }
+
+ fn key_choice_tile(
+ &self,
+ id: SharedString,
+ label: &'static str,
+ selected: bool,
+ preview: impl IntoElement,
+ on_click: impl Fn(&gpui::ClickEvent, &mut Window, &mut gpui::App) + 'static,
+ ) -> impl IntoElement {
+ let editor = self.theme.editor;
+ div()
+ .id(id)
+ .flex_1()
+ .min_w_0()
+ .h(px(78.))
+ .flex()
+ .flex_col()
+ .items_center()
+ .justify_center()
+ .gap(px(10.))
+ .rounded(px(12.))
+ .map(|this| {
+ if selected {
+ this.bg(editor.pill_fill())
+ .shadow(editor.choice_selected_shadow())
+ } else {
+ this.bg(Hsla::from(editor.ctl))
+ .shadow(editor.trough_ring())
+ .cursor_pointer()
+ .hover(move |style| style.bg(Hsla::from(editor.ctl_hover)))
+ }
+ })
+ .on_click(on_click)
+ .child(preview)
+ .child(
+ div()
+ .text_size(px(12.))
+ .text_color(Hsla::from(if selected {
+ editor.text_1
+ } else {
+ editor.text_2
+ }))
+ .child(label),
+ )
+ }
+
pub(crate) fn render_keyboard_tab(&self, cx: &mut Context) -> AnyElement {
let theme = self.theme;
+ let blank = self.summary().is_some_and(|summary| summary.blank);
let settings = keyboard_settings(&self.project);
let enabled = settings.enabled;
let has_segments = self
@@ -2497,27 +2961,35 @@ impl EditorWindow {
.find(|(weight, _)| *weight == settings.font_weight)
.map_or(tr::editor::tabs::weight::normal(), |(_, label)| label());
+ let classic = self.effective_key_style(&settings) == "classic";
+
// `class={cx("space-y-4", !enabled && "opacity-50 pointer-events-none")}`
let body = div()
.flex()
.flex_col()
.gap(px(16.))
.when(!enabled, |this| this.opacity(0.5))
+ .child(self.render_key_style_picker(&settings, cx))
+ .child(self.render_key_sounds(cx))
.child(
ui::Field::section(&theme, tr::editor::tabs::keyboard::font_settings()).child(
div()
.flex()
.flex_col()
.gap(px(12.))
- .child(self.labelled_inline(
- tr::editor::tabs::keyboard::font_family(),
- self.menu_select(
- SidebarMenu::KeyboardFont,
- "keyboard-font",
- font_label,
- cx,
- ),
- ))
+ // Keycaps are set in each keyboard's own face, so the
+ // family and weight only apply to the classic label.
+ .when(classic, |this| {
+ this.child(self.labelled_inline(
+ tr::editor::tabs::keyboard::font_family(),
+ self.menu_select(
+ SidebarMenu::KeyboardFont,
+ "keyboard-font",
+ font_label,
+ cx,
+ ),
+ ))
+ })
.child(
self.slider_field(
tr::editor::tabs::keyboard::size_label(),
@@ -2527,61 +2999,67 @@ impl EditorWindow {
)
.into_any_element(),
)
- .child(self.labelled(
- tr::editor::tabs::keyboard::text_color(),
- self.render_hex_field(
- crate::editor_panels::FieldKey::KeyboardColor,
- &settings.color,
- cx,
- ),
- )),
- ),
- )
- .child(
- ui::Field::section(&theme, tr::editor::tabs::keyboard::background_settings())
- .child(
- div()
- .flex()
- .flex_col()
- .gap(px(12.))
- .child(self.labelled(
- tr::editor::tabs::keyboard::background_color(),
+ .when(classic, |this| {
+ this.child(self.labelled(
+ tr::editor::tabs::keyboard::text_color(),
self.render_hex_field(
- crate::editor_panels::FieldKey::KeyboardBackground,
- &settings.background_color,
+ crate::editor_panels::FieldKey::KeyboardColor,
+ &settings.color,
cx,
),
))
- .child(
- self.slider_field(
- tr::editor::tabs::keyboard::background_opacity(),
- SliderKey::Keyboard(KeyboardSlider::BackgroundOpacity),
- "",
- cx,
- )
- .into_any_element(),
- ),
- ),
- )
- .child(
- ui::Field::inline(&theme, tr::editor::tabs::keyboard::position()).child(
- self.menu_select(
- SidebarMenu::KeyboardPosition,
- "keyboard-position",
- position_label,
- cx,
- ),
+ }),
),
)
+ // Keycaps take their colours from the theme; the label's own
+ // background only applies to the classic look.
+ .when(classic, |this| {
+ this.child(
+ ui::Field::section(&theme, tr::editor::tabs::keyboard::background_settings())
+ .child(
+ div()
+ .flex()
+ .flex_col()
+ .gap(px(12.))
+ .child(self.labelled(
+ tr::editor::tabs::keyboard::background_color(),
+ self.render_hex_field(
+ crate::editor_panels::FieldKey::KeyboardBackground,
+ &settings.background_color,
+ cx,
+ ),
+ ))
+ .child(
+ self.slider_field(
+ tr::editor::tabs::keyboard::background_opacity(),
+ SliderKey::Keyboard(KeyboardSlider::BackgroundOpacity),
+ "",
+ cx,
+ )
+ .into_any_element(),
+ ),
+ ),
+ )
+ })
.child(
- ui::Field::inline(&theme, tr::editor::tabs::keyboard::font_weight()).child(
- self.menu_select(
- SidebarMenu::KeyboardWeight,
- "keyboard-weight",
- weight_label,
- cx,
- ),
- ),
+ ui::Field::section(&theme, tr::editor::tabs::keyboard::position())
+ .value_text(position_label)
+ .child(self.render_key_position_picker(&settings.position, cx)),
+ )
+ .when(
+ classic && settings.font != cap_rendering::keycaps::OVERLAY_TEXT_FONT,
+ |this| {
+ this.child(
+ ui::Field::inline(&theme, tr::editor::tabs::keyboard::font_weight()).child(
+ self.menu_select(
+ SidebarMenu::KeyboardWeight,
+ "keyboard-weight",
+ weight_label,
+ cx,
+ ),
+ ),
+ )
+ },
)
.child(
ui::Field::section(&theme, tr::editor::tabs::keyboard::animation()).child(
@@ -2601,12 +3079,15 @@ impl EditorWindow {
format!("{:.1}s", settings.linger_duration),
cx,
))
- .child(self.labelled_readout(
- tr::editor::tabs::keyboard::grouping_threshold(),
- SliderKey::Keyboard(KeyboardSlider::GroupingThreshold),
- format!("{:.0}ms", settings.grouping_threshold_ms),
- cx,
- )),
+ // Grouping only joins typed letters into words.
+ .when(settings.show_typing, |this| {
+ this.child(self.labelled_readout(
+ tr::editor::tabs::keyboard::grouping_threshold(),
+ SliderKey::Keyboard(KeyboardSlider::GroupingThreshold),
+ format!("{:.0}ms", settings.grouping_threshold_ms),
+ cx,
+ ))
+ }),
),
)
.child(
@@ -2616,29 +3097,54 @@ impl EditorWindow {
.flex_col()
.gap(px(12.))
.child(
- ui::Subfield::plain(
- &theme,
- tr::editor::tabs::keyboard::show_modifiers(),
- )
- .child(
- ui::Toggle::plain(
+ ui::Subfield::plain(&theme, tr::editor::tabs::keyboard::show_typing())
+ .child(
+ ui::Toggle::plain(
+ &theme,
+ "keyboard-typing",
+ settings.show_typing,
+ )
+ .on_click(cx.listener(
+ |this, _, window, cx| {
+ let next =
+ !keyboard_settings(&this.project).show_typing;
+ this.set_keyboard_setting(
+ "keyboard-typing",
+ window,
+ cx,
+ move |settings| settings.show_typing = next,
+ );
+ },
+ )),
+ ),
+ )
+ .when(settings.show_typing, |this| {
+ this.child(
+ ui::Subfield::plain(
&theme,
- "keyboard-modifiers",
- settings.show_modifiers,
+ tr::editor::tabs::keyboard::show_modifiers(),
)
- .on_click(cx.listener(
- |this, _, window, cx| {
- let next = !keyboard_settings(&this.project).show_modifiers;
- this.set_keyboard_setting(
- "keyboard-modifiers",
- window,
- cx,
- move |settings| settings.show_modifiers = next,
- );
- },
- )),
- ),
- )
+ .child(
+ ui::Toggle::plain(
+ &theme,
+ "keyboard-modifiers",
+ settings.show_modifiers,
+ )
+ .on_click(cx.listener(
+ |this, _, window, cx| {
+ let next =
+ !keyboard_settings(&this.project).show_modifiers;
+ this.set_keyboard_setting(
+ "keyboard-modifiers",
+ window,
+ cx,
+ move |settings| settings.show_modifiers = next,
+ );
+ },
+ )),
+ ),
+ )
+ })
.child(
ui::Subfield::plain(
&theme,
@@ -2687,28 +3193,32 @@ impl EditorWindow {
),
),
)
- .child(
- div().pt(px(8.)).child(
- ui::Button::plain(
- &theme,
- "keyboard-generate",
- ui::ButtonVariant::Primary,
- ui::ButtonSize::Md,
- )
- .label(if self.generating_keyboard {
- tr::editor::tabs::keyboard::generating()
- } else if has_segments {
- tr::editor::tabs::keyboard::regenerate()
- } else {
- tr::editor::tabs::keyboard::generate()
- })
- .full_width()
- .disabled(self.generating_keyboard || self.project.timeline.is_none())
- .on_click(cx.listener(|this, _, window, cx| {
- this.generate_keyboard_segments_clicked(window, cx);
- })),
- ),
- )
+ // A blank project has no recording to take key presses from;
+ // its keys come from the composer and the track.
+ .when(!blank, |this| {
+ this.child(
+ div().pt(px(8.)).child(
+ ui::Button::plain(
+ &theme,
+ "keyboard-generate",
+ ui::ButtonVariant::Primary,
+ ui::ButtonSize::Md,
+ )
+ .label(if self.generating_keyboard {
+ tr::editor::tabs::keyboard::generating()
+ } else if has_segments {
+ tr::editor::tabs::keyboard::regenerate()
+ } else {
+ tr::editor::tabs::keyboard::generate()
+ })
+ .full_width()
+ .disabled(self.generating_keyboard || self.project.timeline.is_none())
+ .on_click(cx.listener(|this, _, window, cx| {
+ this.generate_keyboard_segments_clicked(window, cx);
+ })),
+ ),
+ )
+ })
.children(self.keyboard_generation_message.as_ref().map(|message| {
div()
.text_size(px(12.))
@@ -2716,7 +3226,7 @@ impl EditorWindow {
.child(message.clone())
.into_any_element()
}))
- .children((!has_segments).then(|| {
+ .children((!has_segments && !blank).then(|| {
div()
.py(px(16.))
.flex()
@@ -2763,10 +3273,271 @@ impl EditorWindow {
}))
.into_any_element(),
)
+ // Typing keys onto the video opens its own panel.
+ .child(
+ ui::EditorButton::plain(&theme, "keyboard-type-keys")
+ .left_icon("icons/keyboard.svg")
+ .label(tr::editor::tabs::keyboard::type_keys_button())
+ .on_click(cx.listener(|this, _, window, cx| {
+ let at = this.playhead;
+ this.open_key_prompt(at, window, cx);
+ })),
+ )
.child(body)
.into_any_element()
}
+ /// Where the keys sit, picked on a little frame: nine spots, the chosen
+ /// one holding a key, so the choice reads as the video will.
+ fn render_key_position_picker(&self, current: &str, cx: &mut Context) -> AnyElement {
+ // The frame, at the video's own shape, as wide as the panel.
+ const FRAME_HEIGHT: f32 = 132.;
+ let theme = self.theme;
+ let editor = theme.editor;
+ // An older project's "above captions" sits where bottom-center does,
+ // and lights that spot; clicking it still writes bottom-center.
+ let stored = current.to_string();
+ let current = match current {
+ "top" => "top-center",
+ "bottom" | "above-captions" => "bottom-center",
+ "middle-center" => "center",
+ other => other,
+ };
+ let rows = KEYBOARD_POSITIONS.chunks(3).map(|row| {
+ div()
+ .flex()
+ .flex_1()
+ .flex_row()
+ .children(row.iter().map(|&(value, label)| {
+ let selected = value == current;
+ let align = |this: gpui::Div| match value.rsplit('-').next() {
+ Some("left") => this.justify_start(),
+ Some("right") => this.justify_end(),
+ _ => this.justify_center(),
+ };
+ let vertical = |this: gpui::Div| match value.split('-').next() {
+ Some("top") => this.items_start(),
+ Some("bottom") => this.items_end(),
+ _ => this.items_center(),
+ };
+ vertical(align(
+ div()
+ .flex()
+ .flex_1()
+ .p(px(7.))
+ .cursor_pointer()
+ .group(value),
+ ))
+ .id(SharedString::from(format!("keyboard-position-{value}")))
+ .tooltip(move |_window, cx| ui::Tooltip::new(&theme, label()).view(cx))
+ .child(if selected {
+ // The chosen spot holds a key, as the frame will.
+ div()
+ .h(px(12.))
+ .w(px(22.))
+ .rounded(px(3.))
+ .bg(Hsla::from(editor.accent))
+ .shadow(vec![gpui::BoxShadow {
+ color: gpui::hsla(0., 0., 0., 0.35),
+ offset: gpui::point(px(0.), px(1.5)),
+ blur_radius: px(0.),
+ spread_radius: px(0.),
+ inset: false,
+ }])
+ .into_any_element()
+ } else {
+ div()
+ .size(px(5.))
+ .rounded_full()
+ .bg(Hsla::from(editor.text_3))
+ .opacity(0.45)
+ .group_hover(value, |style| style.opacity(1.))
+ .into_any_element()
+ })
+ .when(stored != value, |this| {
+ let value = value.to_string();
+ this.on_click(cx.listener(move |this, _, window, cx| {
+ let value = value.clone();
+ this.set_keyboard_setting(
+ "keyboard-position",
+ window,
+ cx,
+ move |settings| settings.position = value,
+ );
+ }))
+ })
+ }))
+ });
+ div()
+ .w_full()
+ .h(px(FRAME_HEIGHT))
+ .p(px(4.))
+ .flex()
+ .flex_col()
+ .rounded(px(10.))
+ .bg(Hsla::from(editor.ctl))
+ .shadow(editor.trough_ring())
+ .children(rows)
+ .into_any_element()
+ }
+
+ /// How a typed sentence shows: a key per word (the default, and the most
+ /// like watching someone type), a key per keystroke, or whole.
+ fn render_typing_split(&self, cx: &mut Context) -> AnyElement {
+ let theme = self.theme;
+ let current = keyboard_settings(&self.project).typing_split;
+ let splits: [(&'static str, Label); 3] = [
+ ("words", tr::editor::tabs::keyboard::split_words),
+ ("keys", tr::editor::tabs::keyboard::split_keys),
+ ("sentence", tr::editor::tabs::keyboard::split_sentence),
+ ];
+ ui::Field::inline(&theme, tr::editor::tabs::keyboard::show_as())
+ .value(
+ ui::SegmentedControl::editor(
+ &theme,
+ "keyboard-typing-split",
+ splits
+ .iter()
+ .map(|(value, label)| ui::SegmentOption::new(label(), *value == current))
+ .collect(),
+ )
+ .on_select(cx.listener(move |this, index: &usize, window, cx| {
+ let Some((value, _)) = splits.get(*index) else {
+ return;
+ };
+ let value = value.to_string();
+ this.set_keyboard_setting_inner(
+ false,
+ "keyboard-typing-split",
+ window,
+ cx,
+ move |settings| settings.typing_split = value,
+ );
+ }))
+ .into_any_element(),
+ )
+ .into_any_element()
+ }
+
+ /// The Type Keys panel, in place of the sidebar while it is open: paste a
+ /// sentence, a script or a transcript, or a shortcut like cmd+shift+p,
+ /// and Add turns it into key presses on the timeline, typed out from
+ /// where the panel was opened.
+ pub(crate) fn render_key_prompt(&self, cx: &mut Context) -> AnyElement {
+ let theme = self.theme;
+ let Some(input) = self
+ .field(crate::editor_panels::FieldKey::KeyComposer)
+ .cloned()
+ else {
+ return div().into_any_element();
+ };
+ let typed = cap_project::manual_key_text(&key_prompt_text(input.read(cx).text()));
+ let has_text = !typed.trim().is_empty();
+ let split = keyboard_settings(&self.project).typing_split;
+ let runs = cap_project::manual_key_runs(&typed, &split);
+ let seconds = runs.last().map_or(0.0, |run| run.offset + run.length);
+ let add_input = input.clone();
+ div()
+ .id("key-prompt")
+ .flex()
+ .flex_col()
+ .flex_1()
+ .min_h_0()
+ .overflow_y_scroll()
+ .p(px(16.))
+ .gap(px(16.))
+ .child(
+ div()
+ .flex()
+ .flex_row()
+ .items_center()
+ .gap(px(8.))
+ .child(
+ ui::EditorButton::plain(&theme, "key-prompt-close")
+ .left_icon("icons/x.svg")
+ .icon_size(px(14.))
+ .label(tr::common::cancel())
+ .on_click(cx.listener(|this, _, _, cx| {
+ this.close_key_prompt(cx);
+ })),
+ )
+ .child(
+ div()
+ .text_size(px(14.))
+ .text_color(Hsla::from(theme.editor.text_1))
+ .child(tr::editor::tabs::keyboard::type_keys()),
+ ),
+ )
+ .child(
+ div()
+ .text_size(px(12.))
+ .line_height(px(17.))
+ .text_color(Hsla::from(theme.gray_10))
+ .child(tr::editor::tabs::keyboard::type_keys_hint()),
+ )
+ .child(
+ ui::TextInput::plain(&theme, "key-prompt-text", &input)
+ .flex(true)
+ .padding_x(px(12.))
+ .padding_y(px(10.))
+ .text_size(px(14.))
+ .height(px(150.))
+ .bg(Hsla::from(theme.gray_2))
+ .border(Hsla::from(theme.editor.line)),
+ )
+ .child(self.render_typing_split(cx))
+ .when(has_text, |this| {
+ this.child(
+ div()
+ .text_size(px(12.))
+ .text_color(Hsla::from(theme.gray_10))
+ .child(tr::editor::tabs::keyboard::type_keys_summary(&format!(
+ "{seconds:.1}"
+ ))),
+ )
+ })
+ .child(
+ ui::Button::plain(
+ &theme,
+ "key-prompt-add",
+ ui::ButtonVariant::Blue,
+ ui::ButtonSize::Md,
+ )
+ .label(tr::editor::tabs::keyboard::add_to_timeline())
+ .full_width()
+ .disabled(!has_text)
+ .on_click(cx.listener(move |this, _, window, cx| {
+ let text = key_prompt_text(add_input.read(cx).text());
+ let at = this.key_prompt.unwrap_or(this.playhead);
+ if this.add_typed_keys(&text, at, window, cx) {
+ add_input.update(cx, |input, cx| input.set_text("", cx));
+ this.close_key_prompt(cx);
+ }
+ })),
+ )
+ .into_any_element()
+ }
+
+ /// Opens Type Keys, to add key presses from `at` on.
+ pub(crate) fn open_key_prompt(&mut self, at: f64, window: &mut Window, cx: &mut Context) {
+ self.set_selection(None, cx);
+ self.audio_picker = None;
+ self.key_prompt = Some(at);
+ self.ensure_field(crate::editor_panels::FieldKey::KeyComposer, window, cx);
+ if let Some(input) = self
+ .field(crate::editor_panels::FieldKey::KeyComposer)
+ .cloned()
+ {
+ input.update(cx, |input, cx| input.focus_and_select_all(window, cx));
+ }
+ cx.notify();
+ }
+
+ pub(crate) fn close_key_prompt(&mut self, cx: &mut Context) {
+ self.key_prompt = None;
+ cx.notify();
+ }
+
/// A slider with a `text-xs text-right` readout underneath -- the shape the
/// keyboard and caption tabs use for every duration.
fn labelled_readout(
@@ -3409,15 +4180,21 @@ impl EditorWindow {
)),
),
)
- .child(
- ui::Field::inline(&theme, tr::editor::tabs::captions::font_weight()).child(
- self.menu_select(
- SidebarMenu::CaptionWeight,
- "caption-weight",
- weight_label,
- cx,
- ),
- ),
+ // Inter ships at one weight, so it has no weight to pick.
+ .when(
+ settings.font != cap_rendering::keycaps::OVERLAY_TEXT_FONT,
+ |this| {
+ this.child(
+ ui::Field::inline(&theme, tr::editor::tabs::captions::font_weight()).child(
+ self.menu_select(
+ SidebarMenu::CaptionWeight,
+ "caption-weight",
+ weight_label,
+ cx,
+ ),
+ ),
+ )
+ },
);
// An extra flex ancestor here repeats intrinsic layout while scrolling.
@@ -3544,6 +4321,19 @@ impl EditorWindow {
.px(px(8.))
.py(px(4.))
.bg(background)
+ // The Soft card's shadow and lit top edge.
+ .when(preset.id == "soft", |this| {
+ this.rounded(px(5.))
+ .border_t_1()
+ .border_color(gpui::hsla(0., 0., 1., 0.12))
+ .shadow(vec![gpui::BoxShadow {
+ color: gpui::hsla(0., 0., 0., 0.45),
+ offset: gpui::point(px(0.), px(2.)),
+ blur_radius: px(6.),
+ spread_radius: px(0.),
+ inset: false,
+ }])
+ })
.children(words.into_iter().enumerate().map(|(index, word)| {
let emphasised = preset.active_word_highlight && index == 2;
let pill = emphasised && preset.highlight_style == "pill";
@@ -3581,21 +4371,7 @@ impl EditorWindow {
let Some(captions) = project.captions.as_mut() else {
return false;
};
- let settings = &mut captions.settings;
- settings.preset = preset.id.to_string();
- settings.font_weight = preset.font_weight;
- settings.size = preset.size;
- settings.color = preset.color.to_string();
- settings.background_color = preset.background_color.to_string();
- settings.background_opacity = preset.background_opacity;
- settings.outline = preset.outline;
- settings.outline_color = preset.outline_color.to_string();
- settings.highlight_color = preset.highlight_color.to_string();
- settings.active_word_highlight = preset.active_word_highlight;
- settings.highlight_style = preset.highlight_style.to_string();
- settings.animation = preset.animation.to_string();
- settings.uppercase = preset.uppercase;
- settings.fade_duration = preset.fade_duration;
+ apply_caption_preset_settings(&mut captions.settings, preset);
true
});
}
@@ -4178,6 +4954,27 @@ mod tests {
/// A left-aligned caption sits a margin in from the edge, its centre a
/// half box width further in. Manual starts at that drawn centre, so
/// switching does not move it.
+ #[test]
+ fn every_key_style_has_one_tile() {
+ let mut laid_out: Vec<&str> = KEY_STYLE_ROWS
+ .iter()
+ .flat_map(|row| row.iter().copied())
+ .collect();
+ laid_out.sort_unstable();
+ let mut styles: Vec<&str> = KEY_STYLES.iter().map(|(value, ..)| *value).collect();
+ styles.sort_unstable();
+ assert_eq!(laid_out, styles);
+ // Every tile names a style the renderer draws as keys or the label.
+ for value in styles {
+ let style = cap_rendering::keycaps::KeycapStyle::from_setting(value);
+ assert_eq!(
+ style == cap_rendering::keycaps::KeycapStyle::Classic,
+ value == "classic",
+ "{value}"
+ );
+ }
+ }
+
#[test]
fn manual_caption_position_starts_at_the_drawn_caption() {
let mut settings = CaptionSettings {
@@ -4384,12 +5181,14 @@ mod tests {
#[test]
fn the_catalogues_match_the_source() {
- assert_eq!(CAPTION_PRESETS.len(), 5);
- assert_eq!(CAPTION_PRESETS[0].id, "classic");
- assert_eq!(CAPTION_PRESETS[2].highlight_style, "pill");
+ assert_eq!(CAPTION_PRESETS.len(), 6);
+ assert_eq!(CAPTION_PRESETS[0].id, "soft");
+ assert_eq!(CAPTION_PRESETS[1].id, "classic");
+ assert_eq!(CAPTION_PRESETS[3].highlight_style, "pill");
assert_eq!(CAPTION_POSITIONS[0].0, "manual");
- assert_eq!(KEYBOARD_POSITIONS.len(), 6);
- assert_eq!(FONT_OPTIONS.len(), 3);
+ assert_eq!(KEYBOARD_POSITIONS.len(), 9);
+ assert_eq!(KEYBOARD_POSITIONS[4].0, "center");
+ assert_eq!(FONT_OPTIONS.len(), 4);
for font in FONT_OPTIONS {
assert_eq!(font_option_label(font).as_ref(), font);
}
@@ -4437,7 +5236,7 @@ mod tests {
}));
assert_eq!(keyboard_settings(&project).size, 72);
// The rest of the defaults come along, not just the written key.
- assert_eq!(keyboard_settings(&project).position, "bottom-center");
+ assert_eq!(keyboard_settings(&project).position, "top-center");
}
fn slider_model_project(timeline_segments: usize) -> ProjectConfiguration {
diff --git a/apps/desktop-gpui/src/editor_timeline.rs b/apps/desktop-gpui/src/editor_timeline.rs
index e83f801185a..19b0865cb95 100644
--- a/apps/desktop-gpui/src/editor_timeline.rs
+++ b/apps/desktop-gpui/src/editor_timeline.rs
@@ -36,6 +36,8 @@ use std::{
sync::{Arc, Mutex},
};
+use cap_rendering::keycaps::{self, KeycapStyle};
+
mod playback_follow;
pub use playback_follow::PlaybackFollow;
@@ -67,7 +69,7 @@ pub const TIMELINE_PADDING: f32 = 11.;
pub const TIMELINE_TOP_PADDING: f32 = 9.;
pub const TIMELINE_BOTTOM_PADDING: f32 = 11.;
pub const TRACK_GUTTER_GAP: f32 = 8.;
-pub const TRACK_GUTTER: f32 = 104.;
+pub const TRACK_GUTTER: f32 = 136.;
pub const TRACK_ICON_WIDTH: f32 = TRACK_GUTTER - TRACK_GUTTER_GAP;
pub const TIMELINE_HEADER_HEIGHT: f32 = 26.;
/// The playhead hangs from the ruler's baseline, which is the header's bottom
@@ -84,8 +86,8 @@ pub const TIMELINE_SLOT_PADDING: f32 = 8.;
/// the timeline is computed over a column four pixels narrower than the ruler's.
pub const SCROLL_BODY_PADDING_RIGHT: f32 = 4.;
-pub const TRACK_HEIGHT: f32 = 44.;
-pub const TRACK_ROW_GAP: f32 = 6.;
+pub const TRACK_HEIGHT: f32 = 48.;
+pub const TRACK_ROW_GAP: f32 = 8.;
/// The radius of the band a row draws across its gutter and lane.
pub const TRACK_BAND_RADIUS: f32 = 8.;
/// The gap between the ruler's baseline and the first track row. It is not the
@@ -116,13 +118,17 @@ pub fn hug_height(rows: usize) -> f32 {
const RULER_MAJOR_TICK: f32 = 8.;
const RULER_MINOR_TICK: f32 = 5.;
/// The gutter cell: a 22px tile at 4px of left padding, then the label.
-const TRACK_TILE_SIZE: f32 = 22.;
+const TRACK_TILE_SIZE: f32 = 26.;
+/// Room kept right of the label for the lane's delete button, which sits
+/// 24px in from the gutter's edge, so a label never runs under it.
+const TRACK_DELETE_CLEARANCE: f32 = 28.;
const TRACK_TILE_INSET: f32 = 4.;
+/// How far a paused hold's well sits in from the clip's edges and its own.
+const HOLD_INSET_X: f32 = 3.;
+const HOLD_INSET_Y: f32 = 6.;
/// The segment's radius, its left accent bar and the content inset that clears
/// it (`0 10px 0 13px`).
-const SEGMENT_RADIUS: f32 = 8.;
-const SEGMENT_ACCENT_BAR: f32 = 3.;
-const SEGMENT_PADDING_LEFT: f32 = 13.;
+const SEGMENT_RADIUS: f32 = 10.;
const SEGMENT_PADDING_RIGHT: f32 = 10.;
/// The selected 3D shot's pose dots: 6px, 5px inside each edge, so the resize
/// handles still own the outer pixels.
@@ -174,40 +180,96 @@ pub const MINIMAP_MAX_WIDTH: f32 = 78.;
// Colours
// ---------------------------------------------------------------------------
-/// The single source of truth for track colour is eleven CSS custom properties
-/// with one definition each -- not per-appearance values -- so they are literal
-/// in both themes exactly as they are there
-/// (`apps/desktop/src/styles/theme.css`).
pub mod track_color {
- pub const CLIP: u32 = 0x3b82f6;
- pub const ZOOM: u32 = 0x64748b;
- pub const CAPTION: u32 = 0x0ea5e9;
- pub const KEYBOARD: u32 = 0xf97316;
- pub const STYLE: u32 = 0xec4899;
- pub const IMAGE: u32 = 0xf59e0b;
- pub const TEXT: u32 = 0x14b8a6;
- pub const MASK: u32 = 0xef4444;
- pub const SHAPE: u32 = 0xd946ef;
- pub const SCENE: u32 = 0x8b5cf6;
- pub const AUDIO: u32 = 0x22c55e;
- pub const THREE_D: u32 = 0x6366f1;
+ pub const CLIP: u32 = 0x3065c8;
+ pub const ZOOM: u32 = 0x6c50de;
+ pub const CAPTION: u32 = 0x0a6ea9;
+ pub const KEYBOARD: u32 = 0xb44b0b;
+ pub const STYLE: u32 = 0xa33fba;
+ pub const IMAGE: u32 = 0x945c07;
+ pub const TEXT: u32 = 0x0e7768;
+ pub const MASK: u32 = 0xc63838;
+ pub const SHAPE: u32 = 0x5a6787;
+ pub const SCENE: u32 = 0x5e6f12;
+ pub const AUDIO: u32 = 0x1b7940;
+ pub const THREE_D: u32 = 0xbe3b69;
+ pub const MUTED: u32 = 0x5f606a;
}
/// A muted clip keeps the clip lane's shape but drops its hue, so it reads as
/// the row's own disabled state rather than as a different track.
-fn muted_clip_color(theme: &Theme) -> Hsla {
- Hsla::from(theme.editor.text_3)
+fn muted_clip_color(_theme: &Theme) -> Hsla {
+ gpui::rgb(track_color::MUTED).into()
}
/// The `EditorPalette` mixers work in `Rgba`, which is what the `--ed-*`
/// tokens are; every track colour in this file is an `Hsla`.
-fn seg_fill(theme: &Theme, color: Hsla, selected: bool) -> Hsla {
- let color = gpui::Rgba::from(color);
- if selected {
- theme.editor.seg_fill_selected(color).into()
- } else {
- theme.editor.seg_fill(color).into()
- }
+fn seg_fill(theme: &Theme, color: Hsla) -> Hsla {
+ theme.editor.seg_fill(gpui::Rgba::from(color)).into()
+}
+
+fn seg_fill_sheen(theme: &Theme, color: Hsla) -> gpui::Background {
+ let (top, bottom) = theme.editor.seg_gradient(gpui::Rgba::from(color));
+ gpui::linear_gradient(
+ 180.,
+ gpui::linear_color_stop(top, 0.),
+ gpui::linear_color_stop(bottom, 1.),
+ )
+}
+
+fn seg_gloss() -> Vec {
+ vec![
+ gpui::BoxShadow {
+ color: gpui::hsla(0., 0., 1., 0.2),
+ offset: gpui::point(px(0.), px(1.)),
+ blur_radius: px(0.),
+ spread_radius: px(0.),
+ inset: true,
+ },
+ gpui::BoxShadow {
+ color: gpui::hsla(0., 0., 1., 0.1),
+ offset: gpui::point(px(0.), px(-10.)),
+ blur_radius: px(14.),
+ spread_radius: px(-6.),
+ inset: true,
+ },
+ gpui::BoxShadow {
+ color: gpui::hsla(0., 0., 1., 0.12),
+ offset: gpui::point(px(0.), px(0.)),
+ blur_radius: px(0.),
+ spread_radius: px(1.),
+ inset: true,
+ },
+ ]
+}
+
+/// The segment's own colour glowing under it: soft on hover, fuller once
+/// selected, so selection reads as lit rather than boxed in.
+fn seg_glow(color: Hsla, dark: bool, selected: bool) -> Vec {
+ let alpha = match (dark, selected) {
+ (true, true) => 0.7,
+ (false, true) => 0.55,
+ (true, false) => 0.6,
+ (false, false) => 0.46,
+ };
+ // A tight glow that hugs the segment, then a wide one that lights the
+ // lane around it.
+ vec![
+ gpui::BoxShadow {
+ color: color.opacity(alpha),
+ offset: gpui::point(px(0.), px(2.)),
+ blur_radius: px(if selected { 16. } else { 14. }),
+ spread_radius: px(if selected { 0. } else { -1. }),
+ inset: false,
+ },
+ gpui::BoxShadow {
+ color: color.opacity(alpha * 0.45),
+ offset: gpui::point(px(0.), px(4.)),
+ blur_radius: px(30.),
+ spread_radius: px(2.),
+ inset: false,
+ },
+ ]
}
fn seg_border(theme: &Theme, color: Hsla, extra_alpha: f32) -> Hsla {
@@ -955,10 +1017,8 @@ pub fn waveform_sample_count(canvas_width: f64) -> usize {
((canvas_width * WAVEFORM_SAMPLES_PER_PIXEL).ceil() as usize).min(MAX_WAVEFORM_SAMPLES)
}
-/// Both waveforms are the lane's own colour at 55 %: over a tinted segment a
-/// white or orange fill (`TL/ClipTrack.tsx:293-302`) has nothing to sit on.
-pub fn waveform_color(color: Hsla) -> Hsla {
- with_alpha(color, 0.55)
+pub fn waveform_color(_color: Hsla) -> Hsla {
+ gpui::hsla(0., 0., 1., 0.42)
}
// ---------------------------------------------------------------------------
@@ -1281,7 +1341,6 @@ pub enum SegmentDetail {
/// `TL/TextTrack.tsx:428-450`.
Text {
content: SharedString,
- color: Hsla,
italic: bool,
bold: bool,
fullscreen: bool,
@@ -1314,9 +1373,36 @@ pub enum SegmentDetail {
/// `TL/KeyboardTrack.tsx:168-266`.
Keyboard {
text: SharedString,
+ /// Typed words, which read as text; a shortcut or a lone special key
+ /// reads as keys.
+ typed: bool,
+ /// The keys the overlay draws: what a shortcut shows as small
+ /// keycaps.
+ keys: Arc<[TimelineKey]>,
},
}
+/// One key a keyboard segment shows on the timeline, and the width its
+/// keycap takes, worked out once when the timeline is built so drawing a
+/// segment only adds widths.
+#[derive(Debug, Clone, PartialEq)]
+pub struct TimelineKey {
+ pub label: SharedString,
+ pub modifier: bool,
+ pub width: f32,
+}
+
+impl TimelineKey {
+ fn new(label: SharedString, modifier: bool) -> Self {
+ let width = key_chip_width(&label);
+ Self {
+ label,
+ modifier,
+ width,
+ }
+ }
+}
+
impl SegmentDetail {
fn shows_waveform(&self) -> bool {
matches!(self, Self::Clip { muted: false, .. })
@@ -1416,6 +1502,17 @@ impl TimelineModel {
/// whether more than one recording clip exists (which decides `"Clip"` vs
/// `"Clip N"`, `TL/ClipTrack.tsx:617-620`).
pub fn build(config: &ProjectConfiguration, has_camera: bool, multiple_clips: bool) -> Self {
+ Self::build_for(config, has_camera, multiple_clips, None)
+ }
+
+ /// [`TimelineModel::build`] for a recording made on `platform`, whose
+ /// keyboard the keys print as the renderer draws them.
+ pub fn build_for(
+ config: &ProjectConfiguration,
+ has_camera: bool,
+ multiple_clips: bool,
+ platform: Option<&cap_project::Platform>,
+ ) -> Self {
let Some(timeline) = config.timeline.as_ref() else {
return Self::default();
};
@@ -1477,7 +1574,6 @@ impl TimelineModel {
} else {
SharedString::from(segment.content.clone())
},
- color: parse_hex_color(&segment.color).unwrap_or_else(gpui::white),
italic: segment.italic,
// `font-weight: segment.fontWeight ?? 700` -- gpui has one
// weight per family here, so anything at or above 600
@@ -1565,6 +1661,27 @@ impl TimelineModel {
})
.collect();
+ // The keys print the way the chosen keyboard prints them; the classic
+ // label reads like a Mac's.
+ let styled_keys = timeline.keyboard_segments.iter().any(|segment| {
+ segment.color_override.is_some() || segment.background_color_override.is_some()
+ });
+ let key_style = config
+ .keyboard
+ .as_ref()
+ .map(|keyboard| {
+ KeycapStyle::from_setting_for(
+ keyboard.settings.effective_style_for(platform, styled_keys),
+ platform,
+ )
+ })
+ .filter(|style| *style != KeycapStyle::Classic)
+ .unwrap_or(KeycapStyle::MacOs);
+ // As the overlay decides: with typing hidden, a lone key is a key.
+ let show_typing = config.keyboard.as_ref().map_or_else(
+ || cap_project::KeyboardSettings::default().show_typing,
+ |keyboard| keyboard.settings.show_typing,
+ );
let keyboard = timeline
.keyboard_segments
.iter()
@@ -1578,6 +1695,21 @@ impl TimelineModel {
} else {
SharedString::from(segment.display_text.clone())
},
+ typed: (show_typing || cap_project::is_manual_keyboard_segment(segment))
+ && is_typed_text(segment),
+ keys: keycaps::keycaps_for(&segment.display_text, key_style)
+ .into_iter()
+ .map(|cap| {
+ // Apple's named keys carry only their word; the
+ // space bar carries nothing and reads as ␣.
+ let label = match (cap.label.is_empty(), cap.legend) {
+ (false, _) => SharedString::from(cap.label),
+ (true, Some(word)) => SharedString::from(word),
+ (true, None) => SharedString::new_static("\u{2423}"),
+ };
+ TimelineKey::new(label, cap.modifier)
+ })
+ .collect(),
},
})
.collect();
@@ -1647,7 +1779,17 @@ impl TimelineModel {
multiple_clips: bool,
lanes: &TrackLanes,
) -> Self {
- let mut model = Self::build(config, has_camera, multiple_clips);
+ Self::build_with_lanes_for(config, has_camera, multiple_clips, lanes, None)
+ }
+
+ pub fn build_with_lanes_for(
+ config: &ProjectConfiguration,
+ has_camera: bool,
+ multiple_clips: bool,
+ lanes: &TrackLanes,
+ platform: Option<&cap_project::Platform>,
+ ) -> Self {
+ let mut model = Self::build_for(config, has_camera, multiple_clips, platform);
model.rows = build_rows(config, &model, has_camera, lanes);
model
}
@@ -1985,31 +2127,48 @@ pub fn track_chip(theme: &Theme, kind: TrackKind) -> impl IntoElement {
.items_center()
.gap(px(8.))
.pl(px(TRACK_TILE_INSET))
- .pr(px(6.))
+ .pr(px(TRACK_DELETE_CLEARANCE))
.child(
div()
.flex_none()
.size(px(TRACK_TILE_SIZE))
- .rounded(px(6.))
+ .rounded(px(7.))
.flex()
.items_center()
.justify_center()
- .bg(tile_bg(theme, color))
+ // A small piece of the track's own segment: the same
+ // gradient, lit edge and ring, with a white glyph.
+ .bg(seg_fill_sheen(theme, color))
+ .shadow(vec![
+ gpui::BoxShadow {
+ color: gpui::hsla(0., 0., 1., 0.22),
+ offset: gpui::point(px(0.), px(1.)),
+ blur_radius: px(0.),
+ spread_radius: px(0.),
+ inset: true,
+ },
+ gpui::BoxShadow {
+ color: gpui::hsla(0., 0., 1., 0.1),
+ offset: gpui::point(px(0.), px(0.)),
+ blur_radius: px(0.),
+ spread_radius: px(1.),
+ inset: true,
+ },
+ ])
.child(
svg()
.path(kind.icon())
- .size(px(12.))
+ .size(px(14.))
.flex_none()
- .text_color(tile_fg(theme, color)),
+ .text_color(gpui::hsla(0., 0., 1., 0.95)),
),
)
.child(
div()
.min_w_0()
.truncate()
- .text_size(px(11.))
- .line_height(px(14.))
- .font_weight(FontWeight::MEDIUM)
+ .text_size(px(13.))
+ .line_height(px(16.))
.child(kind.label()),
)
}
@@ -2281,7 +2440,7 @@ pub fn render_row(
) -> AnyElement {
let height = model.track_height();
let selected = ui.row_selected(model, row);
- let active_bg = Hsla::from(theme.editor.ctl_hover);
+ let active_bg = Hsla::from(theme.editor.ctl);
let active_text = Hsla::from(theme.editor.text_1);
div()
.relative()
@@ -2291,15 +2450,11 @@ pub fn render_row(
.h(px(height))
.flex_none()
.rounded(px(TRACK_BAND_RADIUS))
- .bg(if selected {
- active_bg
- } else {
- Hsla::from(theme.editor.ctl)
- })
+ .when(selected, |this| this.bg(active_bg))
.text_color(if selected {
active_text
} else {
- Hsla::from(theme.editor.text_2)
+ Hsla::from(theme.editor.text_2).blend(Hsla::from(theme.editor.text_1).opacity(0.5))
})
.hover(|style| style.bg(active_bg).text_color(active_text))
.child(
@@ -2357,6 +2512,12 @@ fn render_track_content(
content = content.child(empty);
}
+ let visible_ends = if row.kind == TrackKind::Keyboard {
+ keyboard_visible_ends(segments, secs_per_pixel)
+ } else {
+ Vec::new()
+ };
+
// Enumerated before the lane filter so the index stays the **config**
// index -- what the selection and every mutator address segments by.
for (index, segment) in segments
@@ -2369,6 +2530,18 @@ fn render_track_content(
if !view.transform.segment_visible(segment.start, segment.end) {
continue;
}
+ // Key presses linger after the key goes up, so one often runs past
+ // the next press; the overlay then shows the newer one. Each is drawn
+ // only until the next begins, so the row reads like the video.
+ let clipped = visible_ends
+ .get(index)
+ .copied()
+ .flatten()
+ .map(|end| Segment {
+ end,
+ ..segment.clone()
+ });
+ let segment = clipped.as_ref().unwrap_or(segment);
content = content.child(render_segment(
theme,
model,
@@ -2567,6 +2740,56 @@ pub fn new_gap_segment(
Some((start, start + min_duration))
}
+/// A track's segments as the row draws them: key presses end where the next
+/// begins; every other track as stored. Hit-testing uses this so a handle is
+/// where it is drawn. Indices are unchanged.
+pub fn drawn_segments(
+ kind: TrackKind,
+ segments: &[Segment],
+ secs_per_pixel: f64,
+) -> std::borrow::Cow<'_, [Segment]> {
+ if kind != TrackKind::Keyboard {
+ return std::borrow::Cow::Borrowed(segments);
+ }
+ let ends = keyboard_visible_ends(segments, secs_per_pixel);
+ std::borrow::Cow::Owned(
+ segments
+ .iter()
+ .zip(ends)
+ .map(|(segment, end)| Segment {
+ end: end.unwrap_or(segment.end),
+ ..segment.clone()
+ })
+ .collect(),
+ )
+}
+
+/// Where each key press stops being the one on screen: just before the next
+/// press to start, when that comes before its own end. Never shorter than a
+/// few pixels, so a burst of presses stays clickable. One sort, so hovering
+/// a long track stays cheap.
+pub fn keyboard_visible_ends(segments: &[Segment], secs_per_pixel: f64) -> Vec