コード例 #1
0
ファイル: RunManager_Combined.CS プロジェクト: HumMod/editor
    public static void Run()
    {
        if (Running)
        {
            if (!Task.HasExited)
            {
                AlreadyRunning();
                return;
            }
        }

        String Executable = RunRegistry.GetCombined();

        if (!System.IO.File.Exists(Executable))
        {
            CantFind("executable", Executable);
            return;
        }

        String Model = RunRegistry.GetModel();

        String Msg = "";

        Msg += "<model> " + Model + " </model>";

        Task = new Process();

        Task.StartInfo.FileName  = Executable;
        Task.StartInfo.Arguments = AddQuotes(Msg);

        if (GeneralRegistry.GetWaitForExit())
        {
            State.WaitForExit();
        }

        bool OK = Task.Start();

        /* Task.Start() starts the named task, but also associates
         * the task with the process object. You can invoke
         * WaitForExit() only after this association has been made.
         * If invoked to early, an exception is thrown.             */

        if (GeneralRegistry.GetWaitForExit())
        {
            Task.WaitForExit();
            State.HaveExit();
        }

        if (!OK)
        {
            FailedToStart(Executable);
            Running = false;
        }
        else
        {
            Running = true;
        }
    }
コード例 #2
0
ファイル: FileTree.CS プロジェクト: HumMod/editor
    /* The FullPath property gives us something like
    *
    *    C:\\Model Library\Windkessel.DES
    *
    *  when the Windkessel model was the last file
    *  selected. Note the double backslash after the
    *  drive. We do a Replace (Old, New) to get rid
    *  of \\ before splitting.                       */

    private void Restore()
    {
        if (!GeneralRegistry.GetRestoreFileTree())
        {
            return;
        }

        if (!FileRegistry.HasFileTreePath())
        {
            return;
        }

        TreeNode CurrentNode = null;

        String Path = FileRegistry.GetFileTreePath();

        Path = Path.Replace("\\\\", "\\");

        String [] Tokens = Path.Split(new char [] { '\\' });

        try
        { foreach (TreeNode Node in Nodes)
          {
              if (Node.Text == Tokens [0] + "\\")
              {
                  CurrentNode = Node;
                  MakeNodes(CurrentNode);
                  CurrentNode.Expand();
              }
          }

          for (int i = 1; i <= Tokens.Length - 2; i++)
          {
              ArrayList List = new ArrayList(CurrentNode.Nodes);

              foreach (TreeNode Node in List)
              {
                  if (Node.Text == Tokens [i])
                  {
                      CurrentNode = Node;
                      MakeNodes(CurrentNode);
                      CurrentNode.Expand();
                  }
              }
          }
        }

        catch
        { MsgBox.Show("Can't restore this path : " + Path); }
    }
コード例 #3
0
ファイル: FileTree.CS プロジェクト: HumMod/editor
    /* FullPath works if the CurrentPick is a
    *  selection, but it throws when current
    *  pick is a folder. Catch.               */

    public void Save()
    {
        if (GeneralRegistry.GetRestoreFileTree())
        {
            if (CurrentPick != null)
            {
                try
                { String Path = CurrentPick.FullPath;
                  FileRegistry.SetFileTreePath(Path); }

                catch {}
            }
        }
    }
コード例 #4
0
ファイル: IO_New.CS プロジェクト: HumMod/editor
    public static void Call()
    {
        Index++;

        String Filename = "No Name " + Index.ToString();
        String Content  = "";

        if (GeneralRegistry.GetUseTemplateFile())
        {
            Content = IO_Reader.Read(GeneralRegistry.GetTemplateFile());
        }

        TabManager.Add(Filename, Content);
        State.FilesOpen();
    }
コード例 #5
0
ファイル: RunManager.CS プロジェクト: HumMod/editor
  { public static void Run()
    {
        if (GeneralRegistry.GetSaveFiles())
        {
            IO_SaveAll.SaveAll();
        }

        if (RunRegistry.GetIsModular())
        {
            RunManager_Modular.Run();
        }
        else
        {
            RunManager_Combined.Run();
        }
    }
コード例 #6
0
    public void OnBrowse(object Obj, EventArgs EA)
    {
        OpenFileDialog Dlg = new OpenFileDialog();

        Dlg.Title  = AppMain.AppName + " - Model Root File";
        Dlg.Filter = "DESolver Files (*.DES) |*.DES| All Files (*.*) |*.*";

        DialogResult Result = Dlg.ShowDialog();

        if (Result != DialogResult.OK)
        {
            return;
        }

        GeneralRegistry.SetTemplateFile(Dlg.FileName);
        RefreshFilename();
        TemplateFile.Text = Dlg.FileName;
    }
コード例 #7
0
ファイル: Insert_Manager.CS プロジェクト: HumMod/editor
 public static void Select(String NameArg)
 {
     foreach (Insert_Data Insert in Inserts)
     {
         if (Insert.Name == NameArg)
         {
             if (!GeneralRegistry.GetInsertWideFormat())
             {
                 EditManager.Insert(Insert.Content);
             }
             else if (Insert.WideContent == "")
             {
                 EditManager.Insert(Insert.Content);
             }
             else
             {
                 EditManager.Insert(Insert.WideContent);
             }
         }
     }
 }
コード例 #8
0
ファイル: TabManager.CS プロジェクト: HumMod/editor
    public static void Add(String FilenameArg, String ContentArg)
    {
        TabData Data = new TabData();

        Data.Filename = FilenameArg;

        TabPage Tab = new TabPage();

        Tab.AutoScroll      = true;
        Tab.ContextMenu     = new TabContextMenu(FilenameArg);
        Tab.Text            = Path.GetFileNameWithoutExtension(FilenameArg);
        Tab.Tag             = Data;
        Tab.VisibleChanged += new EventHandler(OnVisibleChanged);

        Tabs.Controls.Add(Tab);
        Tabs.SelectTab(Tab);

        RichTextBox Box = new RichTextBox();

        Box.Parent            = Tab;
        Box.Dock              = DockStyle.Fill;
        Box.Multiline         = true;
        Box.WordWrap          = false;
        Box.ReadOnly          = false;
        Box.Text              = ContentArg;
        Box.ContextMenu       = new TabContextMenu(FilenameArg);
        Box.TextChanged      += new EventHandler(OnTextChange);
        Box.SelectionChanged += new EventHandler(OnSelectionChange);
        Box.AcceptsTab        = true;

        // Default is Box.ScrollBars = RichTextBoxScrollBars.Both

        Data.Box = Box;

        if (GeneralRegistry.GetUseColor())
        {
            ColorHighlighter.Parse(Box);
        }
    }
コード例 #9
0
ファイル: GeneralManager.CS プロジェクト: HumMod/editor
 { public static void SetSaveFiles(bool Bool)
   {
       GeneralRegistry.SetSaveFiles(Bool);
   }
コード例 #10
0
 private void OnApply(object Obj, EventArgs EA)
 {
     GeneralRegistry.SetTemplateFile(TemplateFile.Text);
     RefreshFilename();
 }
コード例 #11
0
 public void OnUseTemplateFile(object Obj, EventArgs EA)
 {
     GeneralRegistry.SetUseTemplateFile(UseTemplateFile.Checked);
 }
コード例 #12
0
 public void OnWaitForExit(object Obj, EventArgs EA)
 {
     GeneralRegistry.SetWaitForExit(WaitForExit.Checked);
 }
コード例 #13
0
ファイル: GeneralManager.CS プロジェクト: HumMod/editor
 public static bool GetUseColor()
 {
     return(GeneralRegistry.GetUseColor());
 }
コード例 #14
0
 public void OnInsertWideFormat(object Obj, EventArgs EA)
 {
     GeneralRegistry.SetInsertWideFormat(InsertWideFormat.Checked);
 }
コード例 #15
0
ファイル: GeneralManager.CS プロジェクト: HumMod/editor
 public static bool GetSaveFiles()
 {
     return(GeneralRegistry.GetSaveFiles());
 }
コード例 #16
0
ファイル: GeneralManager.CS プロジェクト: HumMod/editor
 public static void SetInsertWideFormat(bool Bool)
 {
     GeneralRegistry.SetInsertWideFormat(Bool);
 }
コード例 #17
0
ファイル: GeneralManager.CS プロジェクト: HumMod/editor
 public static bool GetUseTemplateFile()
 {
     return(GeneralRegistry.GetUseTemplateFile());
 }
コード例 #18
0
ファイル: GeneralManager.CS プロジェクト: HumMod/editor
 public static void SetTemplateFile(String Filename)
 {
     GeneralRegistry.SetTemplateFile(Filename);
 }
コード例 #19
0
ファイル: GeneralManager.CS プロジェクト: HumMod/editor
 public static void SetUseTemplateFile(bool Bool)
 {
     GeneralRegistry.SetUseTemplateFile(Bool);
 }
コード例 #20
0
ファイル: GeneralManager.CS プロジェクト: HumMod/editor
 public static bool GetWaitForExit()
 {
     return(GeneralRegistry.GetWaitForExit());
 }
コード例 #21
0
ファイル: GeneralManager.CS プロジェクト: HumMod/editor
 public static void SetWaitForExit(bool Bool)
 {
     GeneralRegistry.SetWaitForExit(Bool);
 }
コード例 #22
0
 public void RefreshFilename()
 {
     Filename.Text = "File : " + GeneralRegistry.GetTemplateFile();
 }
コード例 #23
0
ファイル: GeneralManager.CS プロジェクト: HumMod/editor
 public static bool GetInsertWideFormat()
 {
     return(GeneralRegistry.GetInsertWideFormat());
 }
コード例 #24
0
 public void OnRestoreFileTree(object Obj, EventArgs EA)
 {
     GeneralRegistry.SetRestoreFileTree(RestoreFileTree.Checked);
 }
コード例 #25
0
 public void OnUseColor(object Obj, EventArgs EA)
 {
     GeneralRegistry.SetUseColor(UseColor.Checked);
 }
コード例 #26
0
    public Options_General()
    {
        This = this;
        Text = " General ";

        UseColor = new CheckBox();

        UseColor.Parent          = this;
        UseColor.Text            = "Use Color Highlighter On XML";
        UseColor.AutoSize        = true;
        UseColor.Location        = new Point(10, 10);
        UseColor.Checked         = GeneralRegistry.GetUseColor();
        UseColor.CheckedChanged += new EventHandler(OnUseColor);

        SaveFiles = new CheckBox();

        SaveFiles.Parent          = this;
        SaveFiles.Text            = "Automatically Save All Open Files On Run";
        SaveFiles.AutoSize        = true;
        SaveFiles.Location        = new Point(10, 30);
        SaveFiles.Checked         = GeneralRegistry.GetSaveFiles();
        SaveFiles.CheckedChanged += new EventHandler(OnSaveFiles);

        WaitForExit = new CheckBox();

        WaitForExit.Parent          = this;
        WaitForExit.Text            = "Editor Waits For Solver Modules To Exit";
        WaitForExit.AutoSize        = true;
        WaitForExit.Location        = new Point(10, 50);
        WaitForExit.Checked         = GeneralRegistry.GetWaitForExit();
        WaitForExit.CheckedChanged += new EventHandler(OnWaitForExit);

        UseTemplateFile = new CheckBox();

        UseTemplateFile.Parent          = this;
        UseTemplateFile.Text            = "Use A Template File On New";
        UseTemplateFile.AutoSize        = true;
        UseTemplateFile.Location        = new Point(10, 70);
        UseTemplateFile.Checked         = GeneralRegistry.GetUseTemplateFile();
        UseTemplateFile.CheckedChanged += new EventHandler(OnUseTemplateFile);

        Filename = new Label();

        Filename.Parent   = this;
        Filename.Location = new Point(30, 90);
        Filename.AutoSize = true;

        RefreshFilename();

        new Note(this, 30, 110, "Edit");

        TemplateFile = new TextBox();

        TemplateFile.Parent   = this;
        TemplateFile.Location = new Point(60, 108);
        TemplateFile.Size     = new Size(230, 20);
        TemplateFile.Text     = GeneralRegistry.GetTemplateFile();

        Button Apply = new Button();

        Apply.Parent   = this;
        Apply.Location = new Point(300, 108);
        Apply.Size     = new Size(60, 20);
        Apply.Text     = "Apply";
        Apply.Click   += new EventHandler(OnApply);

        Button Browse = new Button();

        Browse.Parent   = this;
        Browse.Location = new Point(370, 108);
        Browse.Size     = new Size(60, 20);
        Browse.Text     = "Browse";
        Browse.Click   += new EventHandler(OnBrowse);

        RestoreFileTree = new CheckBox();

        RestoreFileTree.Parent          = this;
        RestoreFileTree.Text            = "Restore File Tree On Launch";
        RestoreFileTree.AutoSize        = true;
        RestoreFileTree.Location        = new Point(10, 130);
        RestoreFileTree.Checked         = GeneralRegistry.GetRestoreFileTree();
        RestoreFileTree.CheckedChanged += new EventHandler(OnRestoreFileTree);

        InsertWideFormat = new CheckBox();

        InsertWideFormat.Parent          = this;
        InsertWideFormat.Text            = "Inserts Use Wide Format";
        InsertWideFormat.AutoSize        = true;
        InsertWideFormat.Location        = new Point(10, 150);
        InsertWideFormat.Checked         = GeneralRegistry.GetInsertWideFormat();
        InsertWideFormat.CheckedChanged += new EventHandler(OnInsertWideFormat);
    }
コード例 #27
0
 public void OnSaveFiles(object Obj, EventArgs EA)
 {
     GeneralRegistry.SetSaveFiles(SaveFiles.Checked);
 }
コード例 #28
0
ファイル: GeneralManager.CS プロジェクト: HumMod/editor
 public static String GetTemplateFile()
 {
     return(GeneralRegistry.GetTemplateFile());
 }
コード例 #29
0
ファイル: GeneralManager.CS プロジェクト: HumMod/editor
 public static void SetUseColor(bool Bool)
 {
     GeneralRegistry.SetUseColor(Bool);
 }