Exemplo n.º 1
0
        public PluginUI(PluginMain plugin, FDMenus menus,
                        FileActions fileActions, ProjectActions projectActions)
        {
            this.plugin = plugin;
            this.menus  = menus;
            this.Tag    = "Project";
            this.Text   = "Project Explorer";

            #region Build TreeView

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

            treeBar         = new TreeBar(menus, menu);
            treeBar.Dock    = DockStyle.Top;
            treeBar.Visible = false;

            tree                    = new ProjectTreeView();
            tree.Visible            = false;
            tree.Dock               = DockStyle.Fill;
            tree.ImageIndex         = 0;
            tree.ImageList          = Icons.ImageList;
            tree.LabelEdit          = true;
            tree.SelectedImageIndex = 0;
            tree.ShowRootLines      = false;
            tree.HideSelection      = false;
            tree.ContextMenu        = menu;
            tree.DoubleClick       += new EventHandler(tree_DoubleClick);
            tree.AfterLabelEdit    += new NodeLabelEditEventHandler(tree_AfterLabelEdit);
            tree.BeforeLabelEdit   += new NodeLabelEditEventHandler(tree_BeforeLabelEdit);
            tree.AfterSelect       += new TreeViewEventHandler(tree_AfterSelect);

            this.Controls.Add(tree);
            this.Controls.Add(treeBar);

            #endregion

            #region Instructions

            LinkLabel link = new LinkLabel();
            link.Text = "Create a new project\nor\nOpen an existing project";
            link.Links.Add(0, 20, "create");
            link.Links.Add(24, 24, "open");
            link.LinkClicked += new LinkLabelLinkClickedEventHandler(link_LinkClicked);
            link.TextAlign    = ContentAlignment.MiddleCenter;
            link.Dock         = DockStyle.Fill;
            link.ContextMenu  = new ContextMenu();
            this.Controls.Add(link);

            #endregion

            // we care about some of these events
            fileActions.FileCreated        += new FileNameHandler(NewFileCreated);
            fileActions.ProjectModified    += new ProjectModifiedHandler(ProjectModified);
            projectActions.ProjectModified += new ProjectModifiedHandler(ProjectModified);
        }
Exemplo n.º 2
0
        public PluginUI(PluginMain plugin, FDMenus menus, FileActions fileActions, ProjectActions projectActions)
        {
            this.menus           = menus;
            this.AutoKeyHandling = true;
            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;
            ScrollBarEx.Attach(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
        }