Skip to content

Aldwych-Controls/Aldwych.TimelineEditor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Contributors Forks Stargazers Issues MIT License


🎞️ Aldwych.TimelineEditor

A multitrack timeline control, inspired by Logic Pro X.
Explore the docs »

Report Bug · Request Feature


Table of Contents
  1. About
  2. Getting Started
  3. Usage
  4. Roadmap
  5. Contributing
  6. License
  7. Contact
  8. Acknowledgements

About

Sample Screen Shot

This is a work in progress and is not anywhere close to finished. Consider it a experimental sample rather than a ready to use control.

I've lots of work to do before I commit to an API and thus things are a little disjointed at the moment. As it stands, this is the result of just a single afternoon of hacking.

I will continue to work on this as and when I find time as I need this control for an app, but I have no timeline (pun unintended) for when this might be.

Built With

This control wouldn't have been possible without the following:

Getting Started

Models

TrackItem

var clip1 = new TrackItem() 
{ 
    Title = "Test 1", 
    Start = TimeSpan.FromSeconds(10), 
    End = TimeSpan.FromSeconds(20), 
    IsSelected = true 
};

ViewModel

public ObservableCollection<TrackItem> Clips { get; private set; }

public MyViewModel()
{
    Clips = new ObservableCollection<TrackItem>();

    //Create clip(s)

    Clips.Add(clip1);
}

Almost all the controls are lookless and thus require some styling in order to render.

Styles

<Window.Styles>

<!-- Track Item (clip) Container -->
<Style Selector="te|TimelinePanel">
      <Setter Property="VerticalAlignment" Value="Top"/>
      <Setter Property="SelectionMode" Value="Multiple"/>
      <Setter Property="Template">
        <ControlTemplate>
          <Border Name="border" BorderBrush="{TemplateBinding BorderBrush}"
                  BorderThickness="{TemplateBinding BorderThickness}">
            <ScrollViewer Name="PART_ScrollViewer"
                          Background="{TemplateBinding Background}"
                          HorizontalScrollBarVisibility="{TemplateBinding (ScrollViewer.HorizontalScrollBarVisibility)}"
                          VerticalScrollBarVisibility="{TemplateBinding (ScrollViewer.VerticalScrollBarVisibility)}">
              <ItemsPresenter Name="PART_ItemsPresenter"
                              Items="{TemplateBinding Items}"
                              ItemsPanel="{TemplateBinding ItemsPanel}"
                              ItemTemplate="{TemplateBinding ItemTemplate}"
                              Margin="{TemplateBinding Padding}"
                              VirtualizationMode="{TemplateBinding VirtualizationMode}"/>
            </ScrollViewer>
          </Border>
        </ControlTemplate>
      </Setter>
    </Style>

    <!-- Track Row -->
    <Style Selector="te|Track">
      <Setter Property="VerticalAlignment" Value="Top"/>
      <Setter Property="SelectionMode" Value="Multiple"/>
      <Setter Property="Template">
        <ControlTemplate>
          <Border Name="border" BorderBrush="{TemplateBinding BorderBrush}"
                  BorderThickness="{TemplateBinding BorderThickness}">
            <ScrollViewer Name="PART_ScrollViewer"
                          Background="{TemplateBinding Background}"
                          HorizontalScrollBarVisibility="{TemplateBinding (ScrollViewer.HorizontalScrollBarVisibility)}"
                          VerticalScrollBarVisibility="{TemplateBinding (ScrollViewer.VerticalScrollBarVisibility)}">
              <ItemsPresenter Name="PART_ItemsPresenter"
                              Items="{TemplateBinding Items}"
                              ItemsPanel="{TemplateBinding ItemsPanel}"
                              ItemTemplate="{TemplateBinding ItemTemplate}"
                              Margin="{TemplateBinding Padding}"                              
                              VirtualizationMode="{TemplateBinding VirtualizationMode}"/>
            </ScrollViewer>
          </Border>
        </ControlTemplate>
      </Setter>
    </Style>

    <!-- Track Item / Clip style -->
    <Style Selector="te|TrackItem">
      <Setter Property="Background" Value="#428418"/>
      <Setter Property="MinWidth" Value="20"/>
      <Setter Property="MinHeight" Value="60"/>
      <Setter Property="Margin" Value="0,0.5"/>
      <Setter Property="Template">
        <ControlTemplate>
        <Border Name="PART_Border"
                CornerRadius="5"
                BorderThickness="2"
                ClipToBounds="True">
          <Panel>
            <ContentPresenter Name="PART_ContentPresenter"
                  Background="{TemplateBinding Background}"
                  BorderBrush="{TemplateBinding BorderBrush}"
                  CornerRadius="4"
                  BorderThickness="{TemplateBinding BorderThickness}"
                  ContentTemplate="{TemplateBinding ContentTemplate}"
                  Content="{TemplateBinding Content}"
                  Padding="{TemplateBinding Padding}"
                  VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
                  HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" />
            
            <TextBlock Text="{TemplateBinding Title}" 
                       FontWeight="Medium" 
                       Margin="5,3" 
                       FontSize="12"
                       Foreground="White"
                       ToolTip.Tip="{TemplateBinding Title}"/>
            
          </Panel>
        </Border>
        </ControlTemplate>
      </Setter>
    </Style>

    <!-- Track Item default border -->
    <Style Selector="te|TrackItem /template/ Border#PART_Border">
      <Setter Property="BorderBrush" Value="Black" />
    </Style>

    <!-- Track Item selected border -->
    <Style Selector="te|TrackItem:selected /template/ Border#PART_Border">
      <Setter Property="BorderBrush" Value="Blue" />
    </Style>
    
  </Window.Styles>

Usage

For more examples, please refer to the Documentation

    <ScrollViewer HorizontalScrollBarVisibility="Visible" Background="Transparent" AllowAutoHide="False" >
      <Grid RowDefinitions="Auto, *">

        <Border Grid.Row="0" Height="45" BorderBrush="Black" BorderThickness="0,0,0,2">
          
          <te:TimeRuler  Foreground="#ACACAC"
                         SplitBrush="#1A1A1A"
                         VerticalLineBrush="#3A3A3A"
                         VerticalLineThickness="1"
                         Background="Transparent"
                         TicksPerInterval="60"
                         Width="{Binding #PART_TimelinePanel.Width}"
                         MarkerCount="60"
                         MarkerSpacing="120"/>
          
        </Border>
      <Panel Grid.Row="1">
        <te:TimelineGrid VerticalLineBrush="#3A3A3A"
                         HorizontalLineBrush="#1D1D1D"
                         VerticalLineThickness="1"
                         HorizontalLineThickness="2"
                         Background="#232323"
                         TicksPerInterval="60"
                         Width="{Binding #PART_TimelinePanel.Width}"
                         MarkerCount="60"
                         MarkerSpacing="20"
                         TrackHeight="60"/>

        <te:TimelinePanel Name="PART_TimelinePanel"
                          ZoomLevel="{Binding ZoomLevel, Mode=OneWay}" 
                          Duration="{Binding Duration}">
          <te:Track Items="{Binding Clips}" SelectedItems="{Binding SelectedItems}">
            <te:Track.ItemTemplate>
              <DataTemplate>
                <te:TrackItem Title="{Binding}"
                              Start="{Binding}"
                              End="{Binding}"/>
              </DataTemplate>
            </te:Track.ItemTemplate>
          </te:Track>


        </te:TimelinePanel>
      </Panel>
      </Grid>
    </ScrollViewer>

Roadmap

See the open issues for a list of proposed features (and known issues).

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE for more information.

Contact

Mike James - @MikeCodesDotNET

Project Link: https://github.com/Aldwych-Controls/

About

An Avalonia multitrack timeline control

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages