b-editor / beutl

Cross-platform video editing (compositing) software.
https://beutl.beditor.net
MIT License
280 stars 15 forks source link

キーマップをカスタマイズできるようにする #989

Closed yuto-trd closed 1 week ago

yuto-trd commented 4 months ago
yuto-trd commented 3 weeks ago
  1. 拡張機能読み込み
  2. KeyBindingの復元

  3. Controlが作成される
  4. そのControlのKeyDownイベントを購読
  5. DataContextからIEditorContext, CommandDefinitionを取得し、KeyBindingにマッチするか確認
  6. マッチすればICommandExecutorを取得してコマンド実行
public class CommandDefinition
{
    public string Id { get; init; }
    public string DisplayName { get; init; }
    public string Description { get; init; }
    public KeyBinding KeyBinding { get; set; }
}

public class ViewExtension
{
    public virtual IEnumerable<CommandDefinition> Commands { get; }
}

// IEditorContextのGetServiceで返す
public interface ICommandExecutor
{
    public async ValueTask<bool> Execute(CommandDefinition command);
}