Esempio n. 1
0
        public SledTreeListViewEditor(
            string name,
            string image,
            string[] columns,
            TreeListView.Style style,
            StandardControlGroup controlGroup)
            : base(style)
        {
            TreeListView.Name = name;

            foreach (var column in columns)
            {
                TreeListView.Columns.Add(new TreeListView.Column(column));
            }

            {
                var theImage =
                    (!string.IsNullOrEmpty(image) &&
                     ResourceUtil.GetImageList16().Images.ContainsKey(image))
                        ? ResourceUtil.GetImageList16().Images[image]
                        : null;

                m_controlInfo =
                    new ControlInfo(
                        TreeListView.Name,
                        TreeListView.Name,
                        controlGroup,
                        theImage);
            }
        }
        string GetNodeIcon(SF.Tong.Schema.NodeTypeInfo nodeDef, string nodeIcon = null)
        {
            if (!string.IsNullOrEmpty(nodeDef.Icon))
            {
                var systemIconList = ResourceUtil.GetImageList16();
                // If the path is full path, use it
                if (!systemIconList.Images.ContainsKey(nodeDef.Icon))
                {
                    nodeIcon = typeof(Resources).FullName + "." + nodeDef.Icon;
                }
                else
                {
                    nodeIcon = nodeDef.Icon;
                }
            }

            if (!string.IsNullOrEmpty(nodeIcon))
            {
                return(nodeIcon);
            }

            if (!string.IsNullOrEmpty(nodeDef.Base))
            {
                SF.Tong.Schema.NodeTypeInfo parentNodeDef = nodeDef.Parent;
                if (parentNodeDef != null)
                {
                    nodeIcon = GetNodeIcon(parentNodeDef, nodeIcon);
                }
            }

            return(nodeIcon);
        }
Esempio n. 3
0
        private void Bind(ITypeDescriptorContext context, ISelectionContext selectionContext, object value, Func <object, ItemInfo, bool> getItemInfo)
        {
            splitContainer1.SuspendLayout();

            m_treeControl               = new TreeControl(TreeControl.Style.SimpleTree);
            m_treeControl.Dock          = DockStyle.Fill;
            m_treeControl.SelectionMode = SelectionMode.One;
            m_treeControl.ImageList     = ResourceUtil.GetImageList16();
            m_treeControl.Location      = new Point(comboBox1.Location.X, comboBox1.Location.Y + 2 * FontHeight);
            m_treeControl.Width         = upButton.Location.X - m_treeControl.Location.X - Margin.Right - Margin.Left;
            m_treeControl.Anchor        = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom;
            m_treeControl.Height        = splitContainer1.Panel1.Height - m_treeControl.Location.Y - (Margin.Bottom + Margin.Top);
            splitContainer1.Panel1.Controls.Add(m_treeControl);

            m_propertyGrid = new PropertyGrid();
            m_defaultContext.SelectionContext = selectionContext;
            m_propertyGrid.Bind(m_defaultContext);
            m_propertyGrid.Dock = DockStyle.Fill;
            splitContainer1.Panel2.Controls.Add(m_propertyGrid);

            splitContainer1.ResumeLayout();

            m_rootValue                            = value;
            m_collectionTreeView                   = new TreeView(context, value);
            m_collectionTreeView.GetItemInfo       = getItemInfo;
            m_treeControlAdapter                   = new TreeControlAdapter(m_treeControl);
            m_collectionTreeView.SelectionChanged += collectionTreeView_SelectionChanged;
            m_treeControl.ShowRoot                 = false;
            m_treeControlAdapter.TreeView          = m_collectionTreeView;
            m_context = context;
            UpdateAvailaibleTypes(new Path <object>(context.Instance));
        }
Esempio n. 4
0
        /// <summary>
        /// Finishes initializing component by creating ListView and initializing it, subscribing to drag events,
        /// and registering the control</summary>
        void IInitializable.Initialize()
        {
            m_resourcesListView = new ListView();
            m_resourcesListView.SmallImageList     = ResourceUtil.GetImageList16();
            m_resourcesListView.AllowDrop          = true;
            m_resourcesListView.MultiSelect        = true;
            m_resourcesListView.AllowColumnReorder = true;
            m_resourcesListView.LabelEdit          = true;
            m_resourcesListView.Dock = DockStyle.Fill;

            m_resourcesListView.DragOver           += resourcesListView_DragOver;
            m_resourcesListView.DragDrop           += resourcesListView_DragDrop;
            m_resourcesListView.MouseUp            += resourcesListView_MouseUp;
            m_resourcesListViewAdapter              = new ListViewAdapter(m_resourcesListView);
            m_resourcesListViewAdapter.LabelEdited +=
                resourcesListViewAdapter_LabelEdited;

            m_resourcesControlInfo = new ControlInfo(
                "Resources".Localize(),
                "Resources for selected Event".Localize(),
                StandardControlGroup.Bottom);

            m_controlHostService.RegisterControl(m_resourcesListView, m_resourcesControlInfo, this);

            if (m_settingsService != null)
            {
                m_settingsService.RegisterSettings(this, new BoundPropertyDescriptor(this, () => ListViewSettings, "ListViewSettings", "", ""));
            }
        }
Esempio n. 5
0
        /// <summary>
        /// Configures the editor</summary>
        /// <param name="treeControl">Control to display data</param>
        /// <param name="treeControlAdapter">Adapter to drive control. Its ITreeView should
        /// implement IInstancingContext and/or IHierarchicalInsertionContext.</param>
        /// <remarks>Default is to create a TreeControl and TreeControlAdapter,
        /// using the global image lists.</remarks>
        protected override void Configure(
            out TreeControl treeControl,
            out TreeControlAdapter treeControlAdapter)
        {
            treeControl                = new TreeControl();
            treeControl.ImageList      = ResourceUtil.GetImageList16();
            treeControl.StateImageList = ResourceUtil.GetImageList16();

            treeControlAdapter = new TreeControlAdapter(treeControl);

            treeControl.PreviewKeyDown       += treeControl_PreviewKeyDown;
            treeControl.NodeExpandedChanging += treeControl_NodeExpandedChanging;
            treeControl.NodeExpandedChanged  += treeControl_NodeExpandedChanged;


            m_searchInput          = new StringSearchInputUI();
            m_searchInput.Updated += UpdateFiltering;

            m_control      = new UserControl();
            m_control.Dock = DockStyle.Fill;
            m_control.SuspendLayout();
            m_control.Name = "Tree View".Localize();
            m_control.Text = "Tree View".Localize();
            m_control.Controls.Add(m_searchInput);
            m_control.Controls.Add(TreeControl);
            m_control.Layout += controls_Layout;
            m_control.ResumeLayout();
        }
Esempio n. 6
0
        /// <summary>
        /// Constructor without parameters</summary>
        public DataContainer()
        {
            m_selection.Changing += TheSelectionChanging;
            m_selection.Changed  += TheSelectionChanged;

            if (s_dataImageIndex == -1)
            {
                s_dataImageIndex =
                    ResourceUtil.GetImageList16().Images.IndexOfKey(
                        Resources.DataImage);
            }

            if (s_folderImageIndex == -1)
            {
                s_folderImageIndex =
                    ResourceUtil.GetImageList16().Images.IndexOfKey(
                        Resources.FolderImage);
            }

            // Stop compiler warning
            if (Cancelled == null)
            {
                return;
            }
        }
 protected override TreeControl CreateControl()
 {
     return(new TreeListControl
     {
         ImageList = ResourceUtil.GetImageList16(),
         StateImageList = ResourceUtil.GetImageList16()
     });
 }
Esempio n. 8
0
 protected virtual TreeControl CreateControl()
 {
     return(new TreeControl
     {
         ImageList = ResourceUtil.GetImageList16(),
         StateImageList = ResourceUtil.GetImageList16()
     });
 }
Esempio n. 9
0
        /// <summary>
        /// Configures the editor</summary>
        /// <param name="listView">Control to display data</param>
        /// <param name="listViewAdapter">Adapter to drive control</param>
        /// <remarks>Default is to create a ListView and ListViewAdapter,
        /// using the global image lists.</remarks>
        protected virtual void Configure(
            out ListView listView,
            out ListViewAdapter listViewAdapter)
        {
            listView = new ListView();
            listView.SmallImageList = ResourceUtil.GetImageList16();
            listView.LargeImageList = ResourceUtil.GetImageList32();

            listViewAdapter = new ListViewAdapter(listView);
        }
Esempio n. 10
0
        /// <summary>
        /// Configures the editor</summary>
        /// <param name="treeControl">Tree control to display data</param>
        /// <param name="treeControlAdapter">Tree control adapter to drive control</param>
        protected override void Configure(
            out TreeControl treeControl,
            out TreeControlAdapter treeControlAdapter)
        {
            treeControl               = new TreeControl(TreeControl.Style.CategorizedPalette);
            treeControl.ImageList     = ResourceUtil.GetImageList16();
            treeControl.AllowDrop     = true;
            treeControl.SelectionMode = SelectionMode.MultiExtended;

            treeControlAdapter = new TreeControlAdapter(treeControl);
        }
Esempio n. 11
0
        /// <summary>
        /// Configures the editor</summary>
        /// <param name="treeControl">Control to display data</param>
        /// <param name="treeControlAdapter">Adapter to drive control. Its ITreeView should
        /// implement IInstancingContext and/or IHierarchicalInsertionContext.</param>
        /// <remarks>Default is to create a TreeControl and TreeControlAdapter,
        /// using the global image lists.</remarks>
        protected virtual void Configure(
            out TreeControl treeControl,
            out TreeControlAdapter treeControlAdapter)
        {
            treeControl =
                new TreeControl
            {
                ImageList      = ResourceUtil.GetImageList16(),
                StateImageList = ResourceUtil.GetImageList16()
            };

            treeControlAdapter = new TreeControlAdapter(treeControl);
        }
        /// <summary>
        /// Constructor</summary>
        /// <param name="settingsService">Settings service</param>
        /// <param name="dialogOwner">Dialog owner window HWND</param>
        /// <param name="pathName">Path of settings to display initially, or null</param>
        public SettingsDialog(SettingsService settingsService, IWin32Window dialogOwner, string pathName)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();
            SplitterRatio = 0.33f;

            m_settingsService = settingsService;
            m_dialogOwner     = dialogOwner;

            m_originalState = m_settingsService.UserState; // for cancel

            m_treeControl               = new TreeControl(TreeControl.Style.SimpleTree);
            m_treeControl.Dock          = DockStyle.Fill;
            m_treeControl.SelectionMode = SelectionMode.One;
            m_treeControl.ShowRoot      = false;
            m_treeControl.ImageList     = ResourceUtil.GetImageList16();
            m_treeControl.ExpandAll();

            m_treeControl.NodeSelectedChanged += treeControl_NodeSelectedChanged;

            m_treeControlAdapter          = new TreeControlAdapter(m_treeControl);
            m_treeControlAdapter.TreeView = settingsService.UserSettings;

            treePanel.Controls.Add(m_treeControl);

            m_propertyGrid      = new Sce.Atf.Controls.PropertyEditing.PropertyGrid();
            m_propertyGrid.Dock = DockStyle.Fill;
            propertiesPanel.Controls.Add(m_propertyGrid);

            // select an initial node so something is displayed in the PropertyGrid
            TreeControl.Node firstNode = null;
            if (pathName != null)
            {
                firstNode = m_treeControlAdapter.ExpandPath(m_settingsService.GetSettingsPath(pathName));
            }
            if (firstNode == null) // in case pathName is not null, but ExpandPath returns null
            {
                firstNode = m_treeControl.ExpandToFirstLeaf();
            }



            firstNode.Selected = true;
            ShowProperties(m_settingsService.GetProperties((Tree <object>)firstNode.Tag)); //does auto-setting of column widths

            defaultsButton.Click += DefaultsButton_Click;
        }
        /// <summary>
        /// Constructor</summary>
        public EventSequenceContext()
        {
            m_listView = new ListView();
            m_listView.SmallImageList     = ResourceUtil.GetImageList16();
            m_listView.AllowDrop          = true;
            m_listView.MultiSelect        = true;
            m_listView.AllowColumnReorder = true;
            m_listView.LabelEdit          = true;
            m_listView.Dock = DockStyle.Fill;

            if (Reloaded == null)
            {
                return;                   // suppress compiler warning
            }
        }
Esempio n. 14
0
        public ProjectTreeLister(
            ICommandService commandService,
            IControlHostService controlHostService,
            IContextRegistry contextRegistry,
            ISettingsService settings,
            TextEditing.TextEditor textEditor
            )
            : base(commandService)
        {
            this.commandService  = commandService;
            m_controlHostService = controlHostService;
            m_contextRegistry    = contextRegistry;
            this.settings        = settings;
            this.textEditor      = textEditor;

            this.TreeControl.ImageList = ResourceUtil.GetImageList16();
        }
Esempio n. 15
0
        public UnitTreeLister(
            ICommandService commandService,
            IControlHostService controlHostService,
            IContextRegistry contextRegistry,
            ISettingsService settings,
            TextEditing.TextEditor textEditor
            )
            : base(commandService)
        {
            m_controlHostService = controlHostService;
            m_contextRegistry    = contextRegistry;
            this.settings        = settings;

            this.TreeControl.ImageList = ResourceUtil.GetImageList16();

            TreeView = new UnitView();
        }
Esempio n. 16
0
        /// <summary>
        /// Constructor</summary>
        public WinGuiWpfDataContext()
        {
            m_listView = new System.Windows.Forms.ListView();
            m_listView.SmallImageList     = ResourceUtil.GetImageList16();
            m_listView.AllowDrop          = true;
            m_listView.MultiSelect        = true;
            m_listView.AllowColumnReorder = true;
            m_listView.LabelEdit          = true;
            m_listView.Dock   = System.Windows.Forms.DockStyle.Fill;
            m_listView.Height = 100;
            m_listView.Width  = 100;

            if (Reloaded == null)
            {
                return;                   // suppress compiler warning
            }
        }
Esempio n. 17
0
        public FileViewer(MainForm mainForm)
        {
            m_mainForm = mainForm;

            // create a standard WinForms ListView control
            m_listView                    = new ListView();
            m_listView.Dock               = DockStyle.Fill;
            m_listView.Text               = "File Viewer";
            m_listView.BackColor          = SystemColors.Window;
            m_listView.SmallImageList     = ResourceUtil.GetImageList16();
            m_listView.AllowColumnReorder = true;

            // create an adapter to drive the ListView control
            m_listViewAdapter = new ListViewAdapter(m_listView);

            m_fileListView = new FileListView();
        }
Esempio n. 18
0
        public FolderViewer(MainForm mainForm, FileViewer fileViewer)
        {
            m_mainForm   = mainForm;
            m_fileViewer = fileViewer;

            m_treeControl               = new TreeControl();
            m_treeControl.Text          = "Folder Viewer";
            m_treeControl.ImageList     = ResourceUtil.GetImageList16();
            m_treeControl.SelectionMode = SelectionMode.One;
            m_treeControl.Dock          = DockStyle.Fill;
            m_treeControl.Width         = 256;

            m_treeControlAdapter             = new TreeControlAdapter(m_treeControl);
            m_fileTreeView                   = new FileTreeView();
            m_fileTreeView.SelectionChanged += new EventHandler(fileTreeView_SelectionChanged);
            m_treeControlAdapter.TreeView    = m_fileTreeView;
        }
Esempio n. 19
0
            public DataContainer()
            {
                //m_selection.Changing += TheSelectionChanging;
                //m_selection.Changed += TheSelectionChanged;

                if (s_dataImageIndex == -1)
                {
                    s_dataImageIndex =
                        ResourceUtil.GetImageList16().Images.IndexOfKey(
                            Resources.DataImage);
                }

                if (s_folderImageIndex == -1)
                {
                    s_folderImageIndex =
                        ResourceUtil.GetImageList16().Images.IndexOfKey(
                            Resources.FolderImage);
                }
            }
Esempio n. 20
0
        public DomExplorer(IControlHostService controlHostService)
        {
            m_controlHostService = controlHostService;

            m_treeControl                      = new TreeControl();
            m_treeControl.Dock                 = DockStyle.Fill;
            m_treeControl.AllowDrop            = true;
            m_treeControl.SelectionMode        = SelectionMode.MultiExtended;
            m_treeControl.ImageList            = ResourceUtil.GetImageList16();
            m_treeControl.NodeSelectedChanged += treeControl_NodeSelectedChanged;

            m_treeControlAdapter = new TreeControlAdapter(m_treeControl);
            m_treeView           = new TreeView();

            m_propertyGrid      = new Sce.Atf.Controls.PropertyEditing.PropertyGrid();
            m_propertyGrid.Dock = DockStyle.Fill;

            m_splitContainer      = new SplitContainer();
            m_splitContainer.Text = "Dom Explorer";
            m_splitContainer.Panel1.Controls.Add(m_treeControl);
            m_splitContainer.Panel2.Controls.Add(m_propertyGrid);
        }
Esempio n. 21
0
        public AssetLister(
            IControlHostService controlHostService,
            IContextService contextService,
            ICommandService commandService,
            IFileDialogService fileDialogService)
        {
            m_controlHostService = controlHostService;
            m_contextService     = contextService;
            m_commandService     = commandService;
            m_fileDialogService  = fileDialogService;

            m_treeControl                = new TreeControl();
            m_treeControl.Dock           = DockStyle.Fill;
            m_treeControl.AllowDrop      = true;
            m_treeControl.SelectionMode  = SelectionMode.MultiExtended;
            m_treeControl.ImageList      = ResourceUtil.GetImageList16();
            m_treeControl.StateImageList = ResourceUtil.GetImageList16();

            m_treeControl.DragOver        += new DragEventHandler(treeControl_DragOver);
            m_treeControl.DragDrop        += new DragEventHandler(treeControl_DragDrop);
            m_treeControl.MouseDown       += new MouseEventHandler(treeControl_MouseDown);
            m_treeControl.MouseUp         += new MouseEventHandler(treeControl_MouseUp);
            m_treeControl.NodeLabelEdited += new EventHandler <TreeControl.NodeEventArgs>(treeControl_NodeLabelEdited);

            m_listView           = new ListView();
            m_listView.View      = View.Details;
            m_listView.Dock      = DockStyle.Fill;
            m_listView.AllowDrop = true;
            m_listView.LabelEdit = false;

            m_listView.MouseDown   += new MouseEventHandler(thumbnailControl_MouseDown);
            m_listView.MouseUp     += new MouseEventHandler(thumbnailControl_MouseUp);
            m_listView.MouseMove   += new MouseEventHandler(thumbnailControl_MouseMove);
            m_listView.MouseLeave  += new EventHandler(thumbnailControl_MouseLeave);
            m_listView.DoubleClick += new EventHandler(thumbnailControl_DoubleClick);
            m_listView.DragOver    += new DragEventHandler(thumbnailControl_DragOver);
            m_listView.DragDrop    += new DragEventHandler(thumbnailControl_DragDrop);

            m_thumbnailControl = new ThumbnailControl();
            m_thumbnailControl.IndicatorImageList = ResourceUtil.GetImageList16();
            m_thumbnailControl.Dock              = DockStyle.Fill;
            m_thumbnailControl.AllowDrop         = true;
            m_thumbnailControl.BackColor         = SystemColors.Window;
            m_thumbnailControl.SelectionChanged += new EventHandler(thumbnailControl_SelectionChanged);
            m_thumbnailControl.MouseDown        += new MouseEventHandler(thumbnailControl_MouseDown);
            m_thumbnailControl.MouseMove        += new MouseEventHandler(thumbnailControl_MouseMove);
            m_thumbnailControl.MouseUp          += new MouseEventHandler(thumbnailControl_MouseUp);
            m_thumbnailControl.MouseLeave       += new EventHandler(thumbnailControl_MouseLeave);
            m_thumbnailControl.DoubleClick      += new EventHandler(thumbnailControl_DoubleClick);
            m_thumbnailControl.DragOver         += new DragEventHandler(thumbnailControl_DragOver);
            m_thumbnailControl.DragDrop         += new DragEventHandler(thumbnailControl_DragDrop);

            m_splitContainer             = new SplitContainer();
            m_splitContainer.Name        = "Asset";
            m_splitContainer.Orientation = Orientation.Vertical;
            m_splitContainer.Panel1.Controls.Add(m_treeControl);
            m_splitContainer.Panel2.Controls.Add(m_thumbnailControl);
            m_splitContainer.Panel2.Controls.Add(m_listView);

            m_listView.Hide();

            m_selection.Changed += new EventHandler(selection_Changed);

            m_treeControlAdapter          = new TreeControlAdapter(m_treeControl);
            m_assetFolderTreeView         = new AssetFolderTreeView(this);
            m_treeControlAdapter.TreeView = m_assetFolderTreeView;

            m_listViewAdaptor   = new ListViewAdaptor(m_listView);
            m_assetItemListView = new AssetItemListView(this);
        }
Esempio n. 22
0
        public SledSourceControlService(
            MainForm mainForm,
            ICommandService commandService,
            ISettingsService settingsService,
            IControlHostService controlHostService,
            ISledProjectService projectService,
            ISledDocumentService documentService,
            IContextRegistry contextRegistry)
        {
            m_mainForm        = mainForm;
            m_projectService  = projectService;
            m_documentService = documentService;
            m_contextRegistry = contextRegistry;

            // Associate values for commands the 'public' can use
            m_dictPublicCommands.Add(SledSourceControlCommand.Add, Command.Add);
            m_dictPublicCommands.Add(SledSourceControlCommand.CheckIn, Command.CheckIn);
            m_dictPublicCommands.Add(SledSourceControlCommand.CheckOut, Command.CheckOut);
            m_dictPublicCommands.Add(SledSourceControlCommand.Refresh, Command.Refresh);
            m_dictPublicCommands.Add(SledSourceControlCommand.Revert, Command.Revert);
            m_dictPublicCommands.Add(SledSourceControlCommand.History, Command.History);

            commandService.RegisterMenu(
                Menu.SourceControl,
                SourceControlText,
                "Source Control Menu");

            try
            {
                m_go = ResourceUtil.GetImageList16().Images[SledIcon.Go];
            }
            catch (Exception ex)
            {
                SledOutDevice.OutLine(
                    SledMessageType.Error,
                    "Exception acquiring \"{0}\" image: {1}",
                    SledIcon.Go, ex.Message);

                m_go = null;
            }

            try
            {
                m_stop = ResourceUtil.GetImageList16().Images[SledIcon.Stop];
            }
            catch (Exception ex)
            {
                SledOutDevice.OutLine(
                    SledMessageType.Error,
                    "Exception acquiring \"{0}\" image: {1}",
                    SledIcon.Stop, ex.Message);

                m_stop = null;
            }

            m_status =
                commandService.RegisterCommand(
                    Command.Enabled,
                    Menu.SourceControl,
                    Group.SourceControl,
                    "No source control plugin found!",
                    "Enable or disable using the source control plugin",
                    Keys.None,
                    SledIcon.Stop,
                    CommandVisibility.All,
                    this);

            commandService.RegisterCommand(
                Command.Add,
                Menu.SourceControl,
                Group.SourceControl,
                SourceControlCommandPrefix + "Add",
                "Add to source control",
                Keys.None,
                Atf.Resources.DocumentAddImage,
                CommandVisibility.All,
                this);

            commandService.RegisterCommand(
                Command.Revert,
                Menu.SourceControl,
                Group.SourceControl,
                SourceControlCommandPrefix + "Revert",
                "Revert add or check out from source control",
                Keys.None,
                Atf.Resources.DocumentRevertImage,
                CommandVisibility.All,
                this);

            commandService.RegisterCommand(
                Command.CheckIn,
                Menu.SourceControl,
                Group.SourceControl,
                SourceControlCommandPrefix + "Check In",
                "Check in to source control",
                Keys.None,
                Atf.Resources.DocumentLockImage,
                CommandVisibility.All,
                this);

            commandService.RegisterCommand(
                Command.CheckOut,
                Menu.SourceControl,
                Group.SourceControl,
                SourceControlCommandPrefix + "Check Out",
                "Check out from source control",
                Keys.None,
                Atf.Resources.DocumentCheckOutImage,
                CommandVisibility.All,
                this);

            commandService.RegisterCommand(
                Command.Sync,
                Menu.SourceControl,
                Group.SourceControl,
                SourceControlCommandPrefix + "Get Latest Version",
                "Get latest version from source control",
                Keys.None,
                Atf.Resources.DocumentGetLatestImage,
                CommandVisibility.All,
                this);

            commandService.RegisterCommand(
                Command.Refresh,
                Menu.SourceControl,
                Group.SourceControl,
                SourceControlCommandPrefix + "Refresh Status",
                "Refresh status in source control",
                Keys.None,
                Atf.Resources.DocumentRefreshImage,
                CommandVisibility.All,
                this);

            commandService.RegisterCommand(
                Command.History,
                Menu.SourceControl,
                Group.SourceControl,
                SourceControlCommandPrefix + "History",
                "Obtain history of items in source control",
                Keys.None,
                Atf.Resources.ResourceFolderImage,
                CommandVisibility.All,
                this);

            //if ((RegisterCommands & CommandRegister.Reconcile) == CommandRegister.Reconcile)
            //{
            //    CommandServices.RegisterCommand(m_commandService,
            //        InternalCommand.Reconcile,
            //        StandardMenu.File,
            //        StandardCommandGroup.FileOther,
            //        Localizer.Localize("Source Control/Reconcile Offline Work..."),
            //        Localizer.Localize("Reconcile Offline Work"),
            //        Keys.None,
            //        Resources.DocumentRefreshImage,
            //        CommandVisibility.Menu,
            //        this);
            //}

            commandService.RegisterCommand(
                Command.Connection,
                Menu.SourceControl,
                Group.SourceControl,
                SourceControlCommandPrefix + "Open Connection...",
                "Source control connection",
                Keys.None,
                Atf.Resources.ShowAllImage,
                CommandVisibility.All,
                this);

            // Persist settings
            settingsService.RegisterSettings(
                this,
                new BoundPropertyDescriptor(
                    this,
                    () => PersistedSettings,
                    SettingsDisplayName,
                    SettingsCategory,
                    SettingsDescription));

            documentService.Opened  += DocumentServiceOpened;
            documentService.Closing += DocumentServiceClosing;

            projectService.FileAdded    += ProjectServiceFileAdded;
            projectService.FileRemoving += ProjectServiceFileRemoving;
        }
Esempio n. 23
0
        /// <summary>
        /// Initializes the MEF component</summary>
        public void Initialize()
        {
            m_treeControl                = new TreeControl();
            m_treeControl.Dock           = DockStyle.Fill;
            m_treeControl.AllowDrop      = true;
            m_treeControl.SelectionMode  = SelectionMode.MultiExtended;
            m_treeControl.ImageList      = ResourceUtil.GetImageList16();
            m_treeControl.StateImageList = ResourceUtil.GetImageList16();

            m_treeControl.DragOver += treeControl_DragOver;
            m_treeControl.DragDrop += treeControl_DragDrop;
            m_treeControl.MouseUp  += treeControl_MouseUp;

            m_treeControlAdapter = new TreeControlAdapter(m_treeControl);

            m_listView           = new ListView();
            m_listView.View      = View.Details;
            m_listView.Dock      = DockStyle.Fill;
            m_listView.AllowDrop = true;
            m_listView.LabelEdit = false;

            m_listView.MouseUp    += thumbnailControl_MouseUp;
            m_listView.MouseMove  += thumbnailControl_MouseMove;
            m_listView.MouseLeave += thumbnailControl_MouseLeave;
            m_listView.DragOver   += thumbnailControl_DragOver;

            m_listViewAdapter = new ListViewAdapter(m_listView);

            m_thumbnailControl           = new ThumbnailControl();
            m_thumbnailControl.Dock      = DockStyle.Fill;
            m_thumbnailControl.AllowDrop = true;
            m_thumbnailControl.BackColor = SystemColors.Window;

            m_thumbnailControl.SelectionChanged += thumbnailControl_SelectionChanged;
            m_thumbnailControl.MouseMove        += thumbnailControl_MouseMove;
            m_thumbnailControl.MouseUp          += thumbnailControl_MouseUp;
            m_thumbnailControl.MouseLeave       += thumbnailControl_MouseLeave;
            m_thumbnailControl.DragOver         += thumbnailControl_DragOver;

            m_splitContainer             = new SplitContainer();
            m_splitContainer.Name        = "Resources".Localize();
            m_splitContainer.Orientation = Orientation.Vertical;
            m_splitContainer.Panel1.Controls.Add(m_treeControl);
            m_splitContainer.Panel2.Controls.Add(m_thumbnailControl);
            m_splitContainer.Panel2.Controls.Add(m_listView);
            m_splitContainer.SplitterDistance = 10;

            m_listView.Hide();

            Image resourceImage = ResourceUtil.GetImage16(Resources.ResourceImage);

            // on initialization, register our tree control with the hosting service
            m_controlHostService.RegisterControl(
                m_splitContainer,
                new ControlInfo(
                    "Resources".Localize(),
                    "Lists available resources".Localize(),
                    StandardControlGroup.Left,
                    resourceImage),
                this);

            RegisterCommands(m_commandService);
            RegisterSettings();
        }
Esempio n. 24
0
        public RawTreeListView(
            MainForm mainForm,
            IContextRegistry contextRegistry,
            ISettingsService settingsService,
            IControlHostService controlHostService)
        {
            m_mainForm        = mainForm;
            m_contextRegistry = contextRegistry;

            m_host = new UserControl {
                Dock = DockStyle.Fill
            };

            int x = 2, y = 2;
            var buttonHeight = -1;

            // Create and add button
            {
                var btn = CreateButton(AddFolderText, ref x, ref y, ref buttonHeight);
                btn.Click += BtnAddFolderClick;
                m_host.Controls.Add(btn);
            }

            // Create remove item button
            {
                m_btnRemoveItem         = CreateButton(RemoveItemText, ref x, ref y, ref buttonHeight);
                m_btnRemoveItem.Enabled = false;
                m_btnRemoveItem.Click  += BtnRemoveItemClick;
                m_host.Controls.Add(m_btnRemoveItem);
            }

            {
                var btn = CreateButton(InvertSelectionText, ref x, ref y, ref buttonHeight);
                btn.Click += BtnInvertSelectionClick;
                m_host.Controls.Add(btn);
            }

            {
                m_btnExpandOrCollapseSingle         = CreateButton(ExpandOrCollapseNodeText, ref x, ref y, ref buttonHeight);
                m_btnExpandOrCollapseSingle.Enabled = false;
                m_btnExpandOrCollapseSingle.Click  += BtnExpandOrCollapse;
                m_host.Controls.Add(m_btnExpandOrCollapseSingle);
            }

            // Add TreeListView
            {
                m_control = new TreeListView {
                    Name = NameText, AllowDrop = true
                };
                m_control.NodeSorter = new MySorter(m_control);
                m_control.Columns.Add(new TreeListView.Column("Name"));
                m_control.NodeLazyLoad    += ControlNodeLazyLoad;
                m_control.Control.Location = new Point(0, buttonHeight + 2);
                m_control.Control.Width    = m_host.Width;
                m_control.Control.Height   = m_host.Height - buttonHeight - 2;
                m_control.Control.Anchor   =
                    AnchorStyles.Left | AnchorStyles.Top |
                    AnchorStyles.Right | AnchorStyles.Bottom;

                m_control.NodeExpandedChanged += TreeListViewNodeExpandedChanged;
                m_control.NodeSelected        += TreeListViewNodeSelected;

                m_control.DragEnter += ControlDragEnter;
                m_control.DragDrop  += ControlDragDrop;

                m_host.Controls.Add(m_control);
            }

            // Persist column widths
            {
                var owner =
                    string.Format(
                        "{0}-{1}-TreeListView",
                        this,
                        m_control.Name);

                settingsService.RegisterSettings(
                    owner,
                    new BoundPropertyDescriptor(
                        m_control,
                        () => m_control.PersistedSettings,
                        SettingsDisplayName,
                        SettingsCategory,
                        SettingsDescription));
            }

            // Create GUI
            {
                var info =
                    new ControlInfo(
                        m_control.Name,
                        m_control.Name,
                        StandardControlGroup.CenterPermanent);

                controlHostService.RegisterControl(
                    m_host,
                    info,
                    this);
            }

            if (s_dataImageIndex == -1)
            {
                s_dataImageIndex =
                    ResourceUtil.GetImageList16().Images.IndexOfKey(
                        Resources.DataImage);
            }

            if (s_folderImageIndex == -1)
            {
                s_folderImageIndex =
                    ResourceUtil.GetImageList16().Images.IndexOfKey(
                        Resources.FolderImage);
            }
        }
Esempio n. 25
0
        /// <summary>
        /// Initializes the MEF component</summary>
        public void Initialize()
        {
            // tree control
            m_treeControl = new TreeControl();
            m_treeControl.SelectionMode  = SelectionMode.One;
            m_treeControl.Dock           = DockStyle.Fill;
            m_treeControl.AllowDrop      = true;
            m_treeControl.ImageList      = ResourceUtil.GetImageList16();
            m_treeControl.StateImageList = ResourceUtil.GetImageList16();
            m_treeControl.MouseUp       += treeControl_MouseUp;
            m_treeControlAdapter         = new TreeControlAdapter(m_treeControl);

            // list view
            m_listView             = new CustomListView();
            m_listView.View        = View.Details;
            m_listView.Dock        = DockStyle.Fill;
            m_listView.AllowDrop   = true;
            m_listView.LabelEdit   = false;
            m_listView.MouseDown  += ThumbnailControl_MouseDown;
            m_listView.MouseMove  += ThumbnailControl_MouseMove;
            m_listView.MouseUp    += ThumbnailControl_MouseUp;
            m_listView.MouseLeave += ThumbnailControl_MouseLeave;


            m_listViewAdapter = new ListViewAdapter(m_listView);

            // thumbnail control
            m_thumbnailControl                    = new ThumbnailControl();
            m_thumbnailControl.Dock               = DockStyle.Fill;
            m_thumbnailControl.AllowDrop          = true;
            m_thumbnailControl.BackColor          = SystemColors.Window;
            m_thumbnailControl.Selection.Changed += thumbnailControl_SelectionChanged;
            m_thumbnailControl.MouseDown         += ThumbnailControl_MouseDown;
            m_thumbnailControl.MouseMove         += ThumbnailControl_MouseMove;
            m_thumbnailControl.MouseUp           += ThumbnailControl_MouseUp;
            m_thumbnailControl.MouseLeave        += ThumbnailControl_MouseLeave;


            // split
            m_splitContainer             = new SplitContainer();
            m_splitContainer.Name        = "Resources".Localize();
            m_splitContainer.Orientation = Orientation.Vertical;
            m_splitContainer.Panel1.Controls.Add(m_treeControl);
            m_splitContainer.Panel2.Controls.Add(m_thumbnailControl);
            m_splitContainer.Panel2.Controls.Add(m_listView);
            m_splitContainer.SplitterDistance = 10;
            m_listView.Hide();

            Image resourceImage = ResourceUtil.GetImage16(Sce.Atf.Resources.ResourceImage);

            // on initialization, register our tree control with the hosting service
            m_controlHostService.RegisterControl(
                m_splitContainer,
                new ControlInfo(
                    "Resources".Localize(),
                    "Lists available resources".Localize(),
                    StandardControlGroup.Left,
                    resourceImage),
                this);


            m_thumbnailService.ThumbnailReady += ThumbnailManager_ThumbnailReady;
            Application.ApplicationExit       += delegate
            {
                foreach (var item in m_thumbnailControl.Items)
                {
                    if (item.Image != null)
                    {
                        item.Image.Dispose();
                    }
                }
                m_thumbnailControl.Items.Clear();
            };

            m_mainForm.Loaded += delegate
            {
                m_splitContainer.SplitterDistance = m_splitterDistance;
            };

            RegisterCommands();
            RegisterSettings();
        }