public override void CreateUI()
        {
            var root = rootVisualElement;

            // Create selection.
            m_Selection = new BuilderSelection(root, this);

            // Create viewport first.
            m_Viewport = new BuilderViewport(this, selection, null);
            selection.documentElement = m_Viewport.documentElement;

            // Create the rest of the panes.
            m_Toolbar = new BuilderToolbar(this, selection, m_Viewport, null, null, null, null);
            root.Add(m_Viewport);
            m_Viewport.toolbar.Add(m_Toolbar);

            // Init selection.
            selection.AssignNotifiers(new IBuilderSelectionNotifier[]
            {
                document,
                m_Viewport,
                m_Viewport.parentTracker,
                m_Viewport.resizer,
                m_Viewport.mover,
                m_Viewport.anchorer
            });

            // Command Handler
            commandHandler.RegisterPane(m_Viewport);
            commandHandler.RegisterToolbar(m_Toolbar);

            OnEnableAfterAllSerialization();
        }
Пример #2
0
 public BuilderCommandHandler(
     BuilderPaneWindow paneWindow,
     BuilderSelection selection)
 {
     m_PaneWindow = paneWindow;
     m_Toolbar    = null;
     m_Selection  = selection;
 }
 public ThemeStyleSheetManager(BuilderToolbar toolbar)
 {
     m_ToolBar      = toolbar;
     m_SearchFilter = new SearchFilter
     {
         searchArea = SearchFilter.SearchArea.AllAssets,
         classNames = new[] { "ThemeStyleSheet" }
     };
 }
        public override void CreateUI()
        {
            var root = rootVisualElement;

            // Load assets.
            var saveDialogTemplate = AssetDatabase.LoadAssetAtPath <VisualTreeAsset>(BuilderConstants.UIBuilderPackagePath + "/BuilderSaveDialog.uxml");

            // Load template.
            saveDialogTemplate.CloneTree(root);

            // Fetch the save dialog.
            var dialog = root.Q <ModalPopup>("save-dialog");

            // Create selection.
            m_Selection = new BuilderSelection(root, this);

            // Create viewport first.
            m_Viewport = new BuilderViewport(this, selection, null);
            selection.documentElement = m_Viewport.documentElement;

            // Create the rest of the panes.
            m_Toolbar = new BuilderToolbar(this, selection, dialog, m_Viewport, null, null, null, null);
            root.Add(m_Viewport);
            m_Viewport.toolbar.Add(m_Toolbar);

            // Init selection.
            selection.AssignNotifiers(new IBuilderSelectionNotifier[]
            {
                document,
                m_Viewport,
                m_Viewport.parentTracker,
                m_Viewport.resizer,
                m_Viewport.mover,
                m_Viewport.anchorer
            });

            // Command Handler
            commandHandler.RegisterPane(m_Viewport);
            commandHandler.RegisterToolbar(m_Toolbar);

            dialog.BringToFront();

            OnEnableAfterAllSerialization();
        }
Пример #5
0
        public override void CreateUI()
        {
            var root = rootVisualElement;

            titleContent       = GetLocalizedTitleContent();
            saveChangesMessage = BuilderConstants.SaveDialogSaveChangesPromptMessage;

            // Load assets.
            var builderTemplate = BuilderPackageUtilities.LoadAssetAtPath <VisualTreeAsset>(BuilderConstants.UIBuilderPackagePath + "/Builder.uxml");

            // Load templates.
            builderTemplate.CloneTree(root);

            // Create overlay painter.
            m_HighlightOverlayPainter = new HighlightOverlayPainter();

            // Fetch the tooltip previews.
            var styleSheetsPaneTooltipPreview = root.Q <BuilderTooltipPreview>("stylesheets-pane-tooltip-preview");
            var libraryTooltipPreview         = root.Q <BuilderTooltipPreview>("library-tooltip-preview");

            // Create selection.
            m_Selection = new BuilderSelection(root, this);

            // Create Element Context Menu Manipulator
            var contextMenuManipulator = new BuilderElementContextMenu(this, selection);

            // Create viewport first.
            m_Viewport = new BuilderViewport(this, selection, contextMenuManipulator);
            selection.documentRootElement = m_Viewport.documentRootElement;
            var overlayHelper = viewport.Q <OverlayPainterHelperElement>();

            overlayHelper.painter = m_HighlightOverlayPainter;

            // Create the rest of the panes.
            var classDragger       = new BuilderClassDragger(this, root, selection, m_Viewport, m_Viewport.parentTracker);
            var styleSheetsDragger = new BuilderStyleSheetsDragger(this, root, selection);
            var styleSheetsPane    = new BuilderStyleSheets(this, m_Viewport, selection, classDragger, styleSheetsDragger, m_HighlightOverlayPainter, styleSheetsPaneTooltipPreview);
            var hierarchyDragger   = new BuilderHierarchyDragger(this, root, selection, m_Viewport, m_Viewport.parentTracker)
            {
                builderStylesheetRoot = styleSheetsPane.container
            };

            m_Hierarchy = new BuilderHierarchy(this, m_Viewport, selection, classDragger, hierarchyDragger, contextMenuManipulator, m_HighlightOverlayPainter);

            var libraryDragger = new BuilderLibraryDragger(this, root, selection, m_Viewport, m_Viewport.parentTracker, hierarchy.container, libraryTooltipPreview)
            {
                builderStylesheetRoot = styleSheetsPane.container
            };

            m_Viewport.viewportDragger.builderHierarchyRoot = hierarchy.container;
            m_Library     = new BuilderLibrary(this, m_Viewport, selection, libraryDragger, libraryTooltipPreview);
            m_Inspector   = new BuilderInspector(this, selection, m_HighlightOverlayPainter);
            m_Toolbar     = new BuilderToolbar(this, selection, m_Viewport, hierarchy, m_Library, m_Inspector, libraryTooltipPreview);
            m_UxmlPreview = new BuilderUxmlPreview(this);
            m_UssPreview  = new BuilderUssPreview(this, selection);
            root.Q("viewport").Add(m_Viewport);
            m_Viewport.toolbar.Add(m_Toolbar);
            root.Q("library").Add(m_Library);
            root.Q("style-sheets").Add(styleSheetsPane);
            root.Q("hierarchy").Add(hierarchy);
            root.Q("uxml-preview").Add(m_UxmlPreview);
            root.Q("uss-preview").Add(m_UssPreview);
            root.Q("inspector").Add(m_Inspector);

            // Init selection.
            selection.AssignNotifiers(new IBuilderSelectionNotifier[]
            {
                document,
                m_Viewport,
                styleSheetsPane,
                hierarchy,
                m_Inspector,
                m_Library,
                m_UxmlPreview,
                m_UssPreview,
                m_Toolbar,
                m_Viewport.parentTracker,
                m_Viewport.resizer,
                m_Viewport.mover,
                m_Viewport.anchorer,
                m_Viewport.selectionIndicator
            });

            // Command Handler
            commandHandler.RegisterPane(styleSheetsPane);
            commandHandler.RegisterPane(hierarchy);
            commandHandler.RegisterPane(m_Viewport);
            commandHandler.RegisterToolbar(m_Toolbar);

            m_MiddleSplitView = rootVisualElement.Q <TwoPaneSplitView>("middle-column");
            m_MiddleSplitView.RegisterCallback <GeometryChangedEvent>(OnFirstDisplay);

            OnEnableAfterAllSerialization();
        }
Пример #6
0
 public void RegisterToolbar(BuilderToolbar toolbar)
 {
     m_Toolbar = toolbar;
 }
Пример #7
0
        public override void CreateUI()
        {
            var root = rootVisualElement;

            // Load assets.
            var builderTemplate    = AssetDatabase.LoadAssetAtPath <VisualTreeAsset>(BuilderConstants.UIBuilderPackagePath + "/Builder.uxml");
            var saveDialogTemplate = AssetDatabase.LoadAssetAtPath <VisualTreeAsset>(BuilderConstants.UIBuilderPackagePath + "/BuilderSaveDialog.uxml");

            // Load templates.
            builderTemplate.CloneTree(root);
            saveDialogTemplate.CloneTree(root);

            // Create overlay painter.
            m_HighlightOverlayPainter = new HighlightOverlayPainter();

            // Fetch the save dialog.
            var dialog = root.Q <ModalPopup>("save-dialog");

            // Fetch the tooltip previews.
            var styleSheetsPaneTooltipPreview = root.Q <BuilderTooltipPreview>("stylesheets-pane-tooltip-preview");
            var libraryTooltipPreview         = root.Q <BuilderTooltipPreview>("library-tooltip-preview");

            // Create selection.
            m_Selection = new BuilderSelection(root, this);

            // Create Element Context Menu Manipulator
            var contextMenuManipulator = new BuilderElementContextMenu(this, selection);

            // Create viewport first.
            m_Viewport = new BuilderViewport(this, selection, contextMenuManipulator);
            selection.documentElement = m_Viewport.documentElement;
            var overlayHelper = viewport.Q <OverlayPainterHelperElement>();

            overlayHelper.painter = m_HighlightOverlayPainter;

            // Create the rest of the panes.
            var classDragger     = new BuilderClassDragger(this, root, selection, m_Viewport, m_Viewport.parentTracker);
            var hierarchyDragger = new BuilderHierarchyDragger(this, root, selection, m_Viewport, m_Viewport.parentTracker);
            var styleSheetsPane  = new BuilderStyleSheets(m_Viewport, selection, classDragger, hierarchyDragger, contextMenuManipulator, m_HighlightOverlayPainter, styleSheetsPaneTooltipPreview);
            var hierarchy        = new BuilderHierarchy(m_Viewport, selection, classDragger, hierarchyDragger, contextMenuManipulator, m_HighlightOverlayPainter);
            var libraryDragger   = new BuilderLibraryDragger(this, root, selection, m_Viewport, m_Viewport.parentTracker, hierarchy.container, libraryTooltipPreview);

            m_Library     = new BuilderLibrary(this, m_Viewport, selection, libraryDragger, libraryTooltipPreview);
            m_Inspector   = new BuilderInspector(this, selection);
            m_Toolbar     = new BuilderToolbar(this, selection, dialog, m_Viewport, hierarchy, m_Library, m_Inspector, libraryTooltipPreview);
            m_UxmlPreview = new BuilderUxmlPreview(this);
            m_UssPreview  = new BuilderUssPreview(this);
            root.Q("viewport").Add(m_Viewport);
            m_Viewport.toolbar.Add(m_Toolbar);
            root.Q("library").Add(m_Library);
            root.Q("style-sheets").Add(styleSheetsPane);
            root.Q("hierarchy").Add(hierarchy);
            root.Q("uxml-preview").Add(m_UxmlPreview);
            root.Q("uss-preview").Add(m_UssPreview);
            root.Q("inspector").Add(m_Inspector);

            // Init selection.
            selection.AssignNotifiers(new IBuilderSelectionNotifier[]
            {
                document,
                m_Viewport,
                styleSheetsPane,
                hierarchy,
                m_Inspector,
                m_UxmlPreview,
                m_UssPreview,
                m_Viewport.parentTracker,
                m_Viewport.resizer,
                m_Viewport.mover,
                m_Viewport.anchorer
            });

            // Command Handler
            commandHandler.RegisterPane(styleSheetsPane);
            commandHandler.RegisterPane(hierarchy);
            commandHandler.RegisterPane(m_Viewport);
            commandHandler.RegisterToolbar(m_Toolbar);

            OnEnableAfterAllSerialization();
        }