예제 #1
0
        internal void SaveDocument(frmDocument doc)
        {
            saveFileDialog1.Filter = "Wszystkie pliki (*.*)|*.*"
                                     + "Pliki LUA (*.lua)|*.lua|"
                                     + "Pliki GameScript (*.gs)|*.gs|"
                                     + "Pliki Questów (*.qst)|*.qst|"
                                     + "Pliki Modów (*.mod)|*.mod|"
                                     + "Pliki Dialogów (*.dlg)|*.dlg|";
            saveFileDialog1.Title = "Zapisz skrypt gry";

            if (doc.FileName == "")
            {
                if (saveFileDialog1.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
                if (saveFileDialog1.FileName == "")
                {
                    return;
                }
                doc.FileName = saveFileDialog1.FileName;

                doc.Text = Path.GetFileName(saveFileDialog1.FileName);
            }
            if (doc.FileName != "")
            {
                doc.SaveFile();
            }
        }
예제 #2
0
        //aktualizacja odwołań Command do Document
        private void BindDocumentCommands()
        {
            frmDocument document = this.ActiveMdiChild as frmDocument;

            if (document == null)
            {
                // Note that when Command is set to null the button will be automatically
                // disabled if it had command associated previously
                cutMenuItem.Command   = null;
                cutMenuItem.Enabled   = false;
                copyMenuItem.Command  = null;
                copyMenuItem.Enabled  = false;
                pasteMenuItem.Command = null;
                pasteMenuItem.Enabled = false;
                undoMenuItem.Command  = null;
                undoMenuItem.Enabled  = false;
                redoMenuItem.Command  = null;
                redoMenuItem.Enabled  = false;

                positionLabel.Text = null;
            }
            else
            {
                cutMenuItem.Command   = document.commandCut;
                cutMenuItem.Enabled   = true;
                copyMenuItem.Command  = document.commandCopy;
                copyMenuItem.Enabled  = true;
                pasteMenuItem.Command = document.commandPaste;
                pasteMenuItem.Enabled = true;
                undoMenuItem.Command  = document.commandUndo;
                undoMenuItem.Enabled  = true;
                redoMenuItem.Command  = document.commandRedo;
                redoMenuItem.Enabled  = true;
            }
        }
예제 #3
0
        private void popModInfoDat_Click(object sender, EventArgs e)
        {
            frmDocument doc = new frmDocument();

            doc.Text        = Path.GetFileName(actualModDir.Name + " info.dat");
            doc.MdiParent   = this;
            doc.WindowState = FormWindowState.Maximized;
            doc.Show();
            doc.OpenFile(actualModDir.FullName + @"\info.dat");
        }
예제 #4
0
        private void commandSave_Executed(object sender, EventArgs e)
        {
            frmDocument doc = this.ActiveMdiChild as frmDocument;

            if (doc == null || !doc.DocumentChanged)
            {
                return;
            }
            SaveDocument(doc);
        }
예제 #5
0
        private void CreateNewDocument()
        {
            frmDocument doc = new frmDocument();

            doc.MdiParent   = this;
            doc.WindowState = FormWindowState.Maximized;
            doc.Show();
            doc.Update();
            doc.Text = "Document " + this.MdiChildren.Length.ToString();
        }
예제 #6
0
        private void buttonItem7_Click(object sender, EventArgs e)
        {
            frmDocument doc = this.ActiveMdiChild as frmDocument;

            if (doc == null)
            {
                return;
            }
            if (doc.FileName == "")
            {
                MessageBoxEx.Show("Before compilation script must be saved", "Information",
                                  MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                Compile(doc.FileName);
            }
        }
예제 #7
0
        private void fileExplorer1_OnBrowserNodeDoubleClick(object sender, EventArgs e)
        {
            if (!(fileExplorer1.ExplorerTree.SelectedNode.Tag is FileInfo))
            {
                return;
            }

            FileInfo dir = fileExplorer1.ExplorerTree.SelectedNode.Tag as FileInfo;

            frmDocument doc = new frmDocument();

            doc.Text        = dir.Name;
            doc.MdiParent   = this;
            doc.WindowState = FormWindowState.Maximized;
            doc.Show();
            doc.Update();
            doc.OpenFile(dir.FullName);
        }
예제 #8
0
        private void commandSaveAs_Executed(object sender, EventArgs e)
        {
            if (this.ActiveMdiChild == null)
            {
                return;
            }

            // Close menu popup if needed since File Dialogs can interfer with it
            if (sender is BaseItem)
            {
                BaseItem.CollapseAll(sender as BaseItem);
            }

            frmDocument doc = this.ActiveMdiChild as frmDocument;

            if (doc == null || !doc.DocumentChanged)
            {
                return;
            }
            if (doc.FileName == "")
            {
                SaveDocument(doc);
                return;
            }

            saveFileDialog1.ShowDialog();
            if (saveFileDialog1.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            if (saveFileDialog1.FileName == "")
            {
                return;
            }
            doc.FileName = saveFileDialog1.FileName;
            doc.SaveFile();
            doc.Text = Path.GetFileName(saveFileDialog1.FileName);
        }
예제 #9
0
        private void OpenDocument()
        {
            openFileDialog1.FileName = "";
            openFileDialog1.Filter   = "Wszystkie skrypty (*.lua, *.gs, *.qst, *.dlg, *.mod)|*.lua;*.gs;*.qst;*.dlg;*.mod|"
                                       + "Pliki LUA (*.lua)|*.lua|"
                                       + "Pliki GameScript (*.gs)|*.gs|"
                                       + "Pliki Questów (*.qst)|*.qst|"
                                       + "Pliki Dialogów (*.dlg)|*.dlg|"
                                       + "Pliki Modów (*.mod)|*.mod|"
                                       + "Wszystkie pliki (*.*)|*.*";
            openFileDialog1.Title = "Otwórz skrypt gry";
            openFileDialog1.ShowDialog();
            if (openFileDialog1.FileName == "")
            {
                return;
            }
            frmDocument doc = new frmDocument();

            doc.Text        = Path.GetFileName(openFileDialog1.FileName);
            doc.MdiParent   = this;
            doc.WindowState = FormWindowState.Maximized;
            doc.Show();
            doc.OpenFile(openFileDialog1.FileName);
        }