Exemple #1
0
        // call from main script editor
        public static MessageEditor MessageEditorInit(TabInfo tab, Form frm)
        {
            string msgPath = null;

            if (tab != null)
            {
                if (!MessageFile.GetAssociatePath(tab, true, out msgPath))
                {
                    return(null);
                }

                tab.msgFilePath = msgPath;
            }

            // Show form
            MessageEditor msgEdit = new MessageEditor(msgPath, tab);

            msgEdit.scriptForm = frm;
            if (tab != null)
            {
                msgEdit.alwaysOnTopToolStripMenuItem.Checked = true;
            }
            msgEdit.Show();
            //if (Settings.autoOpenMsgs && msgEdit.scrptEditor.msgAutoOpenEditorStripMenuItem.Checked)
            //    msgEdit.WindowState = FormWindowState.Minimized;

            return(msgEdit);
        }
Exemple #2
0
 private void dgvMessages_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.ColumnIndex == 3)
     {
         int nLine = (int)dgvMessages.CurrentRow.Cells[3].Value;
         if (nLine != -1)
         {
             string path = (string)dgvMessages.CurrentRow.Cells[3].Tag ?? sourceTab.msgFilePath;
             MessageEditor.MessageEditorInit(path, nLine).ShowDialog();
         }
     }
 }
        static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            // reset working folder to EXE directory (to resolve possible issues in parse_main)
            Directory.SetCurrentDirectory(Application.StartupPath);

            if (args.Length > 0 && mutex.WaitOne(TimeSpan.Zero, true) &&
                Path.GetExtension(args[0]).ToLowerInvariant() == ".msg")
            {
                mutex.Close();
                // run only Messages editor
                printLog("Run only message editor...");
                Settings.Load();
                MessageEditor me = new MessageEditor(args[0].ToString());
                Application.Run(me);
            }
            else
            {
                // check if another instance is already running
                if (mutex.WaitOne(TimeSpan.Zero, true))
                {
                    File.Delete("sse.log");
                    printLog("Run main editor...");
                    Settings.Load();
                    // pass arguments of command line to opening
                    TextEditor te = new TextEditor(args);
                    Application.Run(te);
                    mutex.ReleaseMutex();
                    SingleInstanceManager.DeleteCommandLine();
                    printLog("Exit main editor.");
                }
                else
                {
                    // only show message if opened normally without command line arguments
                    if (args.Length == 0)
                    {
                        MessageBox.Show("Another instance is already running!", "Sfall Script Editor");
                    }
                    else
                    {
                        printLog("   Passed command argument to main editor.");
                        // pass command line arguments via file
                        SingleInstanceManager.SaveCommandLine(args);
                        // send message to other instance
                        SingleInstanceManager.SendEditorOpenMessage();
                    }
                }
            }
        }
Exemple #4
0
        // for open custom message file
        public static MessageEditor MessageEditorOpen(string msgPath, Form frm)
        {
            if (msgPath == null)
            {
                MessageBox.Show("No output path selected.", "Error");
            }

            // Show form
            MessageEditor msgEdit = new MessageEditor(msgPath, null);

            msgEdit.scriptForm  = frm;
            msgEdit.WindowState = FormWindowState.Maximized;
            frm.TopMost         = false;
            msgEdit.Show();

            return(msgEdit);
        }
Exemple #5
0
        // call from testing dialog tools and node code editor
        public static MessageEditor MessageEditorInit(string msgPath, int line, TabInfo tab = null, bool sendState = false)
        {
            MessageEditor msgEdit = new MessageEditor(msgPath, tab);

            for (int i = 0; i < msgEdit.dgvMessage.RowCount; i++)
            {
                int number;
                if (int.TryParse(msgEdit.dgvMessage.Rows[i].Cells[0].Value.ToString(), out number))
                {
                    if (number == line)
                    {
                        msgEdit.dgvMessage.Rows[i].Cells[1].Selected       = true;
                        msgEdit.dgvMessage.FirstDisplayedScrollingRowIndex = (i <= 5) ? i : i - 5;
                        break;
                    }
                }
            }
            msgEdit.SendStripButton.Enabled = sendState;

            return(msgEdit);
        }