Skip to content

The truly free, open-source, local-first, cross-platform CapCut replacement. Scriptable through a JSON-RPC API & MCP.

feat: add flip/reverse keyboard shortcuts and Settings context menu toggle

Domica61ff4ab89a18
diff --git a/src/crates/concat/src/lib.rs b/src/crates/concat/src/lib.rs
index f6e56ed6..19db11c1 100644
--- a/src/crates/concat/src/lib.rs
+++ b/src/crates/concat/src/lib.rs
@@ -1036,6 +1036,15 @@ pub fn run() -> Result<(), slint::PlatformError> {
let at = state.playhead;
state.seek(at);
}));
+ app.on_settings_custom_context_actions_changed(on_window!(|state, on: bool| {
+ state.settings.custom_context_actions = on;
+ state.prefs.custom_context_actions = on;
+ state.prefs.save(&state.host.dirs);
+ }));
+ app.on_editor_shortcut(on_window!(|state, action: SharedString| {
+ state.context_menu_action(action.as_str());
+ }));
+
app.on_settings_download_source_changed(on_window!(|state, index: i32| {
use concat_host::models::SourcePreference;
let index = (index.max(0) as usize).min(SourcePreference::ALL.len() - 1);
diff --git a/src/crates/concat/src/prefs.rs b/src/crates/concat/src/prefs.rs
index 5a033ecd..950bd311 100644
--- a/src/crates/concat/src/prefs.rs
+++ b/src/crates/concat/src/prefs.rs
@@ -34,6 +34,9 @@ pub struct Preferences {
/// it is put. Off by default: a click past the last clip lands there, so
/// a clip can be dropped at the playhead beyond everything else.
pub playhead_stops_at_end: bool,
+ /// Show flip horizontal, flip vertical, and reverse in the clip context
+ /// menu. Keyboard shortcuts (H, J, R) are always available.
+ pub custom_context_actions: bool,
/// Where model downloads look first: a `SourcePreference` by name.
/// Absent is automatic.
pub download_source: Option<String>,
diff --git a/src/crates/concat/src/studio.rs b/src/crates/concat/src/studio.rs
index 71873cb7..226bc45c 100644
--- a/src/crates/concat/src/studio.rs
+++ b/src/crates/concat/src/studio.rs
@@ -274,6 +274,8 @@ pub struct SettingsState {
pub language: usize,
/// The switch that keeps the playhead inside the content.
pub playhead_stops: bool,
+ /// Show flip/reverse in clip context menu.
+ pub custom_context_actions: bool,
/// Index into `SourcePreference::ALL`: where model downloads look first.
pub download_source: usize,
/// The base URL of a custom download source.
@@ -6831,6 +6833,7 @@ impl Studio {
tab: self.settings.tab,
language: self.settings.language as i32,
playhead_stops: self.settings.playhead_stops,
+ custom_context_actions: self.prefs.custom_context_actions,
download_source: self.settings.download_source as i32,
download_base: self.settings.download_base.as_str().into(),
server_enabled: self.prefs.server.enabled,
@@ -7092,6 +7095,23 @@ impl Studio {
clip.volume <= 0.0,
!locked && audible,
));
+ if self.prefs.custom_context_actions {
+ rows.push(check(
+ "flip-h",
+ &t("Flip horizontal"),
+ "H",
+ clip.flip_h,
+ !locked,
+ ));
+ rows.push(check(
+ "flip-v",
+ &t("Flip vertical"),
+ "J",
+ clip.flip_v,
+ !locked,
+ ));
+ rows.push(check("reverse", &t("Reverse"), "R", clip.reverse, !locked));
+ }
rows.push(check("lock", &t("Lock track"), "", locked, true));
rows.push(rule());
rows.push(MenuItemData {
@@ -7320,6 +7340,72 @@ impl Studio {
}
}
+ pub fn toggle_flip_h(&mut self) {
+ if self.selection.is_empty() {
+ return;
+ }
+ let commands: Vec<Command> = self
+ .selection
+ .iter()
+ .filter_map(|id| {
+ self.clip(id).map(|clip| Command::UpdateClip {
+ clip_id: id.clone(),
+ patch: ClipPatch {
+ flip_h: Some(!clip.flip_h),
+ ..Default::default()
+ },
+ })
+ })
+ .collect();
+ if !commands.is_empty() {
+ self.apply(Command::Batch { commands });
+ }
+ }
+
+ pub fn toggle_flip_v(&mut self) {
+ if self.selection.is_empty() {
+ return;
+ }
+ let commands: Vec<Command> = self
+ .selection
+ .iter()
+ .filter_map(|id| {
+ self.clip(id).map(|clip| Command::UpdateClip {
+ clip_id: id.clone(),
+ patch: ClipPatch {
+ flip_v: Some(!clip.flip_v),
+ ..Default::default()
+ },
+ })
+ })
+ .collect();
+ if !commands.is_empty() {
+ self.apply(Command::Batch { commands });
+ }
+ }
+
+ pub fn toggle_reverse(&mut self) {
+ if self.selection.is_empty() {
+ return;
+ }
+ let commands: Vec<Command> = self
+ .selection
+ .iter()
+ .filter_map(|id| {
+ self.clip(id).map(|clip| Command::UpdateClip {
+ clip_id: id.clone(),
+ patch: ClipPatch {
+ reverse: Some(!clip.reverse),
+ ..Default::default()
+ },
+ })
+ })
+ .collect();
+ if !commands.is_empty() {
+ self.apply(Command::Batch { commands });
+ }
+ }
+
pub fn toggle_lock(&mut self, track_id: &str) {
let view = self.lane_view.entry(track_id.to_owned()).or_default();
view.locked = !view.locked;
@@ -7427,6 +7513,9 @@ impl Studio {
self.clip_action(&id, action);
}
}
+ "flip-h" => self.toggle_flip_h(),
+ "flip-v" => self.toggle_flip_v(),
+ "reverse" => self.toggle_reverse(),
"paste" => {
let Some(held) = self.clipboard.clone() else {
return;
diff --git a/src/crates/concat/ui/app.slint b/src/crates/concat/ui/app.slint
index 520bd646..05627425 100644
--- a/src/crates/concat/ui/app.slint
+++ b/src/crates/concat/ui/app.slint
@@ -189,6 +189,7 @@ export component App inherits Window {
callback settings-language-changed(index: int);
callback settings-theme-changed(dark: bool);
callback settings-playhead-stops-changed(on: bool);
+ callback settings-custom-context-actions-changed(on: bool);
callback settings-download-source-changed(index: int);
callback settings-download-base-edited(text: string);
callback settings-server-enabled-changed(on: bool);
@@ -372,6 +373,9 @@ export component App inherits Window {
if (event.text == "s") { Editor.shortcut("split-selected"); return accept; }
if (event.text == "n") { Editor.shortcut("snap"); return accept; }
if (event.text == "m") { Editor.shortcut("mute"); return accept; }
+ if (event.text == "h") { Editor.shortcut("flip-h"); return accept; }
+ if (event.text == "j") { Editor.shortcut("flip-v"); return accept; }
+ if (event.text == "r") { Editor.shortcut("reverse"); return accept; }
return reject;
}
@@ -485,6 +489,7 @@ export component App inherits Window {
language-changed(index) => { root.settings-language-changed(index); }
theme-changed(dark) => { root.settings-theme-changed(dark); }
playhead-stops-changed(on) => { root.settings-playhead-stops-changed(on); }
+ custom-context-actions-changed(on) => { root.settings-custom-context-actions-changed(on); }
download-source-changed(index) => { root.settings-download-source-changed(index); }
download-base-edited(text) => { root.settings-download-base-edited(text); }
server-enabled-changed(on) => { root.settings-server-enabled-changed(on); }
diff --git a/src/crates/concat/ui/dialogs/settings.slint b/src/crates/concat/ui/dialogs/settings.slint
index c96e2e48..3b8a3d8e 100644
--- a/src/crates/concat/ui/dialogs/settings.slint
+++ b/src/crates/concat/ui/dialogs/settings.slint
@@ -50,6 +50,8 @@ export struct SettingsData {
language: int,
/// the playhead stops at the end of the content
playhead-stops: bool,
+ /// show flip/reverse in clip context menu
+ custom-context-actions: bool,
/// where model downloads look first: automatic, Concat's mirror,
/// hf-mirror.com, the original source, a custom URL
download-source: int,
@@ -358,6 +360,7 @@ export component SettingsDialog inherits Modal {
/// on, which is the whole reason it moved in here.
callback theme-changed(dark: bool);
callback playhead-stops-changed(on: bool);
+ callback custom-context-actions-changed(on: bool);
callback download-source-changed(index: int);
callback download-base-edited(text: string);
callback server-enabled-changed(on: bool);