Exemple #1
0
 public Timeline(Panel panel)
 {
     RootWidget  = new Widget();
     Panel       = panel;
     PanelWidget = panel.ContentWidget;
     Toolbar     = new Toolbar();
     Ruler       = new Rulerbar();
     Overview    = new OverviewPane();
     Grid        = new GridPane(this);
     CurveEditor = new CurveEditorPane(this);
     Roll        = new RollPane();
     CreateProcessors();
     InitializeWidgets();
     WaveformCache = new WaveformCache(Project.Current.FileSystemWatcher);
     RootWidget.AddChangeWatcher(() => Document.Current.Container, container => {
         Offset = container.Components.GetOrAdd <TimelineOffset>().Offset;
     });
     RootWidget.AddChangeWatcher(() => Offset, (value) => {
         var offset = Document.Current.Container.Components.Get <TimelineOffset>();
         if (offset != null)
         {
             offset.Offset = value;
         }
     });
     RootWidget.Gestures.Add(DropFilesGesture = new DropFilesGesture());
     CreateFilesDropHandlers();
     OnCreate?.Invoke(this);
 }
Exemple #2
0
        public Inspector(Widget panelWidget)
        {
            PanelWidget = panelWidget;
            RootWidget  = new Widget {
                Layout = new VBoxLayout()
            };
            var toolbarArea = new Widget {
                Layout = new StackLayout(), Padding = new Thickness(4, 0)
            };

            contentWidget = new ThemedScrollView();
            RootWidget.AddNode(toolbarArea);
            RootWidget.AddNode(contentWidget);
            RootWidget.Gestures.Add(DropFilesGesture = new DropFilesGesture());
            contentWidget.Content.Layout             = new VBoxLayout();
            Toolbar = new ToolbarView(toolbarArea, GetToolbarLayout());
            Objects = new List <object>();
            content = new InspectorContent(contentWidget.Content)
            {
                Footer = new Widget {
                    MinHeight = 300.0f
                },
                History = Document.Current.History
            };
            DropFilesGesture.Recognized += content.DropFiles;
            CreateWatchersToRebuild();
            OnCreate?.Invoke(this);
        }
Exemple #3
0
 public GridPane(Timeline timeline)
 {
     this.timeline           = timeline;
     timeline.OffsetChanged += value => ContentWidget.Position = -value;
     RootWidget              = new Frame {
         Id     = nameof(GridPane),
         Layout = new StackLayout {
             HorizontallySizeable = true, VerticallySizeable = true
         },
         ClipChildren  = ClipMethod.ScissorTest,
         HitTestTarget = true,
     };
     ContentWidget = new Widget {
         Id      = nameof(GridPane) + "Content",
         Padding = new Thickness {
             Top = 1, Bottom = 1
         },
         Layout = new VBoxLayout {
             Spacing = TimelineMetrics.RowSpacing
         },
         Presenter     = new SyncDelegatePresenter <Node>(RenderBackgroundAndGrid),
         PostPresenter = new SyncDelegatePresenter <Widget>(w => OnPostRender(w))
     };
     RootWidget.AddNode(ContentWidget);
     RootWidget.AddChangeWatcher(() => RootWidget.Size,
                                 // Some document operation processors (e.g. ColumnCountUpdater) require up-to-date timeline dimensions.
                                 _ => Core.Operations.Dummy.Perform(Document.Current.History));
     OnPostRender                += RenderSelection;
     OnPostRender                += RenderCursor;
     DropFilesGesture             = new DropFilesGesture();
     DropFilesGesture.Recognized += new GridPaneFilesDropHandler().Handle;
     RootWidget.Gestures.Add(DropFilesGesture);
     OnCreate?.Invoke(this);
 }
Exemple #4
0
        private DockManager(Vector2 windowSize)
        {
            var window = new Window(new WindowOptions {
                ClientSize           = windowSize,
                FixedSize            = false,
                Title                = "Tangerine",
                MacWindowTabbingMode = MacWindowTabbingMode.Disallowed,
#if WIN
                Icon = new System.Drawing.Icon(new EmbeddedResource(AppIconPath, "Tangerine").GetResourceStream()),
#endif // WIN
            });

            window.UnhandledExceptionOnUpdate += e => UnhandledExceptionOccurred?.Invoke(e);
            SetDropHandler(window);
            MainWindowWidget = new ThemedInvalidableWindowWidget(window)
            {
                Id                = "MainWindow",
                Layout            = new VBoxLayout(),
                Size              = windowSize,
                RedrawMarkVisible = true
            };
            MainWindowWidget.WidgetContext.GestureManager = new HelpModeGestureManager(MainWindowWidget.WidgetContext);
            ToolbarArea = new Frame {
                Id           = "Toolbar",
                ClipChildren = ClipMethod.ScissorTest,
                Layout       = new VBoxLayout {
                    Spacing = 4
                },
                LayoutCell = new LayoutCell {
                    StretchY = 0
                },
            };
            DocumentArea = new Frame {
                ClipChildren = ClipMethod.ScissorTest,
            };
            DocumentAreaDropFilesGesture = new DropFilesGesture();
            DocumentArea.Gestures.Add(DocumentAreaDropFilesGesture);
            DocumentArea.CompoundPresenter.Add(new WidgetFlatFillPresenter(Color4.Gray));
            var windowPlacement = new WindowPlacement {
                Size         = windowSize,
                Position     = window.ClientPosition,
                WindowWidget = MainWindowWidget
            };

            DockHierarchy.Instance.Initialize(windowPlacement);
            window.Moved   += () => Model.WindowPlacements.First().Position = window.ClientPosition;
            window.Resized += (deviceRotated) => Model.WindowPlacements.First().Size = window.ClientSize;
            MainWindowWidget.AddChangeWatcher(
                () => MainWindowWidget.Window.State,
                value => Model.WindowPlacements[0].State = value);
            MainWindowWidget.Components.Add(new RequestedDockingComponent());
            MainWindowWidget.CompoundPostPresenter.Add(new DockingPresenter());
        }
Exemple #5
0
            public DocumentTabsProcessor(TabBar tabBar)
            {
                this.tabBar = tabBar;
                var g = new DropFilesGesture();

                g.Recognized += new ScenesDropHandler {
                    ShouldCreateContextMenu = false
                }.Handle;
                tabBar.Gestures.Add(g);
                tabBar.AllowReordering = true;
                RebuildTabs();
                tabBar.OnReordered += args => Project.Current.ReorderDocument(Document.Current, args.IndexTo);
                tabBar.AddChangeWatcher(() => Project.Current.Documents.Version, _ => RebuildTabs());
                tabBar.AddChangeWatcher(() => Project.Current, _ => RebuildTabs());
            }
Exemple #6
0
 public SceneView(Widget panelWidget)
 {
     this.Panel = panelWidget;
     InputArea  = new Widget {
         HitTestTarget = true, Anchors = Anchors.LeftRightTopBottom
     };
     InputArea.FocusScope = new KeyboardFocusScope(InputArea);
     InputArea.Gestures.Add(DropFilesGesture = new DropFilesGesture());
     Scene = new Widget();
     Scene.Components.Add(new SceneBehavior());
     Scene.PostPresenter = new ScenePresenter(Document.Current.RootNode);
     Frame = new Widget {
         Id    = "SceneView",
         Nodes = { InputArea, Scene }
     };
     CreateComponents();
     CreateProcessors();
     CreatePresenters();
     CreateFilesDropHandlers();
     Frame.Awoke += CenterDocumentRoot;
     OnCreate?.Invoke(this);
 }