示例#1
0
        public TreeBar(FDMenus menus, ProjectContextMenu treeMenu)
        {
            this.treeMenu = treeMenu;
            this.ImageScalingSize = ScaleHelper.Scale(new Size(16, 16));
            this.Size = new Size(200, 26);
            this.Renderer = new DockPanelStripRenderer();
            this.GripStyle = ToolStripGripStyle.Hidden;
            this.Padding = new Padding(2, 1, 2, 1);
            this.CanOverflow = false;

            RefreshSelected = new ToolStripButton(Icons.Refresh.Img);
            RefreshSelected.ToolTipText = TextHelper.GetString("ToolTip.Refresh");
            RefreshSelected.Padding = new Padding(0);

            ShowHidden = new ToolStripButton(Icons.HiddenItems.Img);
            ShowHidden.ToolTipText = TextHelper.GetString("ToolTip.ShowHiddenItems");
            ShowHidden.Padding = new Padding(0);

            ProjectProperties = new ToolStripButton(Icons.Options.Img);
            ProjectProperties.ToolTipText = TextHelper.GetString("ToolTip.ProjectProperties");
            ProjectProperties.Padding = new Padding(0);
            PluginBase.MainForm.RegisterSecondaryItem("ProjectMenu.Properties", ProjectProperties);

            Synchronize = new ToolStripButton(Icons.SyncToFile.Img);
            Synchronize.ToolTipText = TextHelper.GetString("ToolTip.Synchronize");
            Synchronize.Padding = new Padding(0);
            Synchronize.Checked = PluginMain.Settings.TrackActiveDocument;
            PluginBase.MainForm.RegisterShortcutItem("ProjectTree.LocateActiveFile", Keys.Shift | Keys.Alt | Keys.L);
            PluginBase.MainForm.RegisterSecondaryItem("ProjectTree.LocateActiveFile", Synchronize);

            SynchronizeMain = new ToolStripButton(Icons.ActionScriptCompile.Img);
            SynchronizeMain.ToolTipText = TextHelper.GetString("ToolTip.SynchronizeMain");
            SynchronizeMain.Padding = new Padding(0);

            CollapseAll = new ToolStripButton(Icons.CollapseAll.Img);
            CollapseAll.ToolTipText = TextHelper.GetString("FlashDevelop.Label.CollapseAll");
            CollapseAll.Padding = new Padding(0);

            ProjectTypes = new ToolStripButton(Icons.AllClasses.Img);
            ProjectTypes.ToolTipText = TextHelper.GetString("ToolTip.ProjectTypes");
            ProjectTypes.Alignment = ToolStripItemAlignment.Right;
            ProjectTypes.Padding = new Padding(0);
            PluginBase.MainForm.RegisterSecondaryItem("FlashToolsMenu.TypeExplorer", ProjectTypes);
            
            Separator = new ToolStripSeparator();
            Separator.Margin = new Padding(0, 0, 1, 0);

            Items.Add(ShowHidden);
            Items.Add(Synchronize);
            Items.Add(SynchronizeMain);
            Items.Add(RefreshSelected);
            Items.Add(CollapseAll);
            Items.Add(Separator);
            Items.Add(ProjectProperties);
            Items.Add(ProjectTypes);
        }
示例#2
0
        public TreeBar(FDMenus menus, ProjectContextMenu treeMenu)
        {
            this.treeMenu = treeMenu;
            this.ImageScalingSize = ScaleHelper.Scale(new Size(16, 16));
            this.Size = new Size(200, 26);
            this.Renderer = new DockPanelStripRenderer();
            this.GripStyle = ToolStripGripStyle.Hidden;
            this.Padding = new Padding(2, 1, 2, 1);
            this.CanOverflow = false;

            RefreshSelected = new ToolStripButton(Icons.Refresh.Img);
            RefreshSelected.ToolTipText = TextHelper.GetString("ToolTip.Refresh");
            RefreshSelected.Padding = new Padding(0);

            ShowHidden = new ToolStripButton(Icons.HiddenItems.Img);
            ShowHidden.ToolTipText = TextHelper.GetString("ToolTip.ShowHiddenItems");
            ShowHidden.Padding = new Padding(0);

            ProjectProperties = new ToolStripButton(Icons.Options.Img);
            ProjectProperties.ToolTipText = TextHelper.GetString("ToolTip.ProjectProperties");
            ProjectProperties.Padding = new Padding(0);

            Synchronize = new ToolStripButton(Icons.SyncToFile.Img);
            Synchronize.ToolTipText = TextHelper.GetString("ToolTip.Synchronize");
            Synchronize.Padding = new Padding(0);

            SynchronizeMain = new ToolStripButton(Icons.ActionScriptCompile.Img);
            SynchronizeMain.ToolTipText = TextHelper.GetString("ToolTip.Synchronize");
            SynchronizeMain.Padding = new Padding(0);

            ProjectTypes = new ToolStripButton(Icons.AllClasses.Img);
            ProjectTypes.ToolTipText = TextHelper.GetString("ToolTip.ProjectTypes");
            ProjectTypes.Alignment = ToolStripItemAlignment.Right;
            ProjectTypes.Padding = new Padding(0);
            
            Separator = new ToolStripSeparator();
            Separator.Margin = new Padding(0, 0, 1, 0);

            Items.Add(ShowHidden);
            Items.Add(Synchronize);
            Items.Add(SynchronizeMain);
            Items.Add(RefreshSelected);
            Items.Add(Separator);
            Items.Add(ProjectProperties);
            Items.Add(ProjectTypes);
        }
示例#3
0
        public PluginUI(PluginMain plugin, FDMenus menus, FileActions fileActions, ProjectActions projectActions)
        {
            this.menus = menus;
            this.plugin = plugin;
            this.Text = TextHelper.GetString("Title.PluginPanel");

            #region Build TreeView and Toolbar

            menu = new ProjectContextMenu();
            menu.Rename.Click += RenameNode;

            treeBar = new TreeBar(menus, menu);

            tree = new ProjectTreeView();
            tree.BorderStyle = BorderStyle.None;
            tree.Dock = DockStyle.Fill;
            tree.ImageIndex = 0;
            tree.ImageList = Icons.ImageList;
            tree.LabelEdit = true;
            tree.SelectedImageIndex = 0;
            tree.ShowRootLines = false;
            tree.HideSelection = false;
            tree.ContextMenuStrip = menu;
            tree.AfterLabelEdit += tree_AfterLabelEdit;
            tree.BeforeLabelEdit += tree_BeforeLabelEdit;
            tree.BeforeSelect += tree_BeforeSelect;
            tree.AfterSelect += tree_AfterSelect;

            Panel panel = new Panel();
            panel.Dock = DockStyle.Fill;
            panel.Controls.Add(tree);
            panel.Controls.Add(treeBar);

            menu.ProjectTree = tree;

            #endregion

            #region Instructions

            help = new LinkLabel();
            string[] helpParts = String.Format(TextHelper.GetString("Info.NoProjectsOpenLink"), "\n").Split('|');
            string[] helpActions = { "create", "open", "import" };
            string helpText = "";
            int[] linkStart = { 0, 0, 0 };
            int[] linkLength = { 0, 0, 0 };
            for (int i = 0; i < 3; i++)
            {
                if (helpParts.Length > i * 2)
                {
                    helpText += helpParts[i * 2];
                    linkStart[i] = helpText.Length;
                    helpText += helpParts[i * 2 + 1];
                    linkLength[i] = helpParts[i * 2 + 1].Length;
                }
            }
            help.Text = helpText + helpParts[helpParts.Length - 1];
            for (int i = 0; i < 3; i++)
            {
                help.Links.Add(linkStart[i], linkLength[i], helpActions[i]);
            }
            help.LinkClicked += link_LinkClicked;
            help.Dock = DockStyle.Fill;
            help.TextAlign = ContentAlignment.MiddleCenter;
            help.ContextMenu = new ContextMenu();

            #endregion

            this.Controls.Add(help);
            this.Controls.Add(panel);

            #region Events

            fileActions.FileCreated += NewFileCreated;
            fileActions.ProjectModified += ProjectModified;
            projectActions.ProjectModified += ProjectModified;

            #endregion
        }