예제 #1
0
        public ProjectManager()
        {
            InitializeComponent();

            gameConfig = new GameConfig();
            newProject = new NewProject();
            newProject.ProjectCreated   += NewProject_ProjectCreated;
            newProject.CreationCanceled += () => { this.Show(); };

            projectActions = new ProjectActions();
            projectActions.NavigateBack += () => { this.Show(); };

            projectSelect = new ProjectSelect();
            projectSelect.ProjectSelected   += ProjectSelect_ProjectSelceted;
            projectSelect.SelectionCanceled += () => { this.Show(); };

            manualSplit = new ManualSplit();
            manualSplit.OnSplitFinished += () => { this.Show(); };
            manualSplit.OnSplitCanceled += () => { this.Show(); };

            // tooltips
            ToolTip newProjectTooltip = new ToolTip();

            newProjectTooltip.SetToolTip(NewProjectButton, "Create a new project. This will create a project folder, and extract data from the game for modification.");

            ToolTip openProjectTooltip = new ToolTip();

            openProjectTooltip.SetToolTip(OpenProjectButton, "Open an existing project. From here you can launch editor tools, build the mod, and launch the game");

            ToolTip configTooltip = new ToolTip();

            configTooltip.SetToolTip(ConfigButton, "Configure Project Manager. This primarily means supplying the paths to SADXPC and SA2");

            ToolTip splitTooltip = new ToolTip();

            splitTooltip.SetToolTip(SplitToolsButton, "Manual split tools. If you're just looking to rip data and not create or modify a mod, this is what you want.");
        }
예제 #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
        }
예제 #3
0
        public void Initialize()
        {
            LoadSettings();
            pluginImage   = MainForm.FindImage("100");
            pluginDesc    = TextHelper.GetString("Info.Description");
            openFileQueue = new Queue <String>();

            Icons.Initialize(MainForm);
            EventManager.AddEventHandler(this, eventMask);

            #region Actions and Event Listeners

            menus = new FDMenus(MainForm);
            menus.ProjectMenu.ProjectItemsEnabled = false;
            menus.View.Click         += delegate { OpenPanel(); };
            menus.DebugProject.Click += delegate { DebugProject(); };

            menus.ProjectMenu.NewProject.Click   += delegate { NewProject(); };
            menus.ProjectMenu.OpenProject.Click  += delegate { OpenProject(); };
            menus.ProjectMenu.CloseProject.Click += delegate { CloseProject(false); };
            menus.ProjectMenu.OpenResource.Click += delegate { OpenResource(); };
            menus.ProjectMenu.DebugProject.Click += delegate { DebugProject(); };
            menus.ProjectMenu.Properties.Click   += delegate { OpenProjectProperties(); };
            menus.RecentProjects.ProjectSelected += delegate(string projectPath) { OpenProjectSilent(projectPath); };

            LuaDevelopActions = new LuaDevelopActions(MainForm);

            fileActions              = new FileActions(MainForm, LuaDevelopActions);
            fileActions.OpenFile    += OpenFile;
            fileActions.FileDeleted += FileDeleted;
            fileActions.FileMoved   += FileMoved;
            fileActions.FileCopied  += FilePasted;

            projectActions = new ProjectActions(pluginUI);

            pluginUI              = new PluginUI(this, menus, fileActions, projectActions);
            pluginUI.NewProject  += delegate { NewProject(); };
            pluginUI.OpenProject += delegate { OpenProject(); };
            pluginUI.Rename      += fileActions.Rename;
            pluginUI.TreeBar.ShowHidden.Click        += delegate { ToggleShowHidden(); };
            pluginUI.TreeBar.Synchronize.Click       += delegate { TreeSyncToCurrentFile(); };
            pluginUI.TreeBar.ProjectProperties.Click += delegate { OpenProjectProperties(); };
            pluginUI.TreeBar.RefreshSelected.Click   += delegate { TreeRefreshSelectedNode(); };

            pluginUI.Menu.Open.Click            += delegate { TreeOpenItems(); };
            pluginUI.Menu.Execute.Click         += delegate { TreeExecuteItems(); };
            pluginUI.Menu.Browse.Click          += delegate { TreeBrowseItem(); };
            pluginUI.Menu.Cut.Click             += delegate { TreeCutItems(); };
            pluginUI.Menu.Copy.Click            += delegate { TreeCopyItems(); };
            pluginUI.Menu.Paste.Click           += delegate { TreePasteItems(); };
            pluginUI.Menu.Delete.Click          += delegate { TreeDeleteItems(); };
            pluginUI.Menu.HideItem.Click        += delegate { TreeHideItems(); };
            pluginUI.Menu.ShowHidden.Click      += delegate { ToggleShowHidden(); };
            pluginUI.Menu.AddFileFromTemplate   += TreeAddFileFromTemplate;
            pluginUI.Menu.AddNewFolder.Click    += delegate { TreeAddFolder(); };
            pluginUI.Menu.AddExistingFile.Click += delegate { TreeAddExistingFile(); };
            pluginUI.Menu.DebugProject.Click    += delegate { DebugProject(); };
            pluginUI.Menu.CloseProject.Click    += delegate { CloseProject(false); };
            pluginUI.Menu.Properties.Click      += delegate { OpenProjectProperties(); };
            pluginUI.Menu.ShellMenu.Click       += delegate { TreeShowShellMenu(); };
            pluginUI.Menu.CommandPrompt.Click   += delegate { TreeShowCommandPrompt(); };
            pluginUI.Menu.FindAndReplace.Click  += delegate { FindAndReplace(); };
            pluginUI.Menu.FindInFiles.Click     += delegate { FindInFiles(); };
            pluginUI.Menu.Opening += new CancelEventHandler(this.MenuOpening);

            Tree.MovePath    += fileActions.Move;
            Tree.CopyPath    += fileActions.Copy;
            Tree.DoubleClick += delegate { TreeDoubleClick(); };

            #endregion

            pluginPanel = MainForm.CreateDockablePanel(pluginUI, Guid, Icons.Project.Img, DockState.DockRight);
        }