예제 #1
0
        private void mainFrm_Load(object sender, EventArgs e)
        {
            DataManager.initDataManager();
            AutoCompleteItemManager.load();

            if (DataManager.settings.openedPersonas.Count > 0)
            {
                foreach (string personaPath in DataManager.settings.openedPersonas)
                {
                    OpenPersonaIgnoreChecks(personaPath);
                }
            }

            foreach (string filePath in DataManager.settings.openedTabs)
            {
                OpenableFile file = findFileInTree(this.projectView.Nodes, filePath);
                if (file == null)
                {
                    file = PersonaFile.CreateInstance(filePath);
                }
                openFileIgnoreChecks(file);
            }

            this.recentlyOpenedScriptsToolStripMenuItem.Entries       = DataManager.settings.last10OpenedScripts;
            this.recentlyOpenedPersonalitiesToolStripMenuItem.Entries = DataManager.settings.last10OpenedPersonas;

            this.toolStripMakroBtnRecord.Enabled  = false;
            this.toolStripMakroBtnExecute.Enabled = false; //TODO: enable in later version after implementation
        }
예제 #2
0
        public bool Equals(OpenableFile file)
        {
            // If parameter is null return false:
            if ((object)file == null)
            {
                return(false);
            }

            // Return true if the fields match:
            return(File != null && file.File != null && File.FullName == file.File.FullName);
        }
예제 #3
0
        private void openFileIgnoreChecks(OpenableFile file)
        {
            FATabStripItem newTab = file.CreateTab();

            file.ContentChanged       += new ChangedEventHandler(processTabChanges);
            file.FileReferenceClicked += File_FileReferenceClicked;

            this.tbStrip.AddTab(newTab);

            this.tbStrip.SelectedItem = newTab;

            file.Redraw();
        }
예제 #4
0
        private void ResultsView_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            if (e.Node.Tag.GetType() == typeof(SearchResult))
            {
                SearchResult result         = (SearchResult)e.Node.Tag;
                OpenableFile fileWithResult = (OpenableFile)result.Searchable;

                openFile(fileWithResult);
                if (fileWithResult.tab.Controls?[0].GetType() == typeof(FastColoredTextBox))
                {
                    FastColoredEditorUtils.Select(new Place(result.Index, result.Line - 1), new Place(result.Index + result.Length, result.Line - 1), ((FastColoredTextBox)fileWithResult.tab.Controls?[0]));
                }
            }
        }
예제 #5
0
        public frmMain()
        {
            InitializeComponent();
            this.projectView.ImageList = DataManager.iconList;
            //this.renameToolStripMenuItem.Enabled = false;

            this.recentlyOpenedScriptsToolStripMenuItem.EntryClicked += (object sender, EventArgs e) => {
                ToolStripMenuItem menuItem = (ToolStripMenuItem)sender;
                OpenableFile      file     = PersonaFile.CreateInstance(menuItem.Text);
                openFile(file);
            };

            this.recentlyOpenedPersonalitiesToolStripMenuItem.EntryClicked += (object sender, EventArgs e) => {
                ToolStripMenuItem menuItem = (ToolStripMenuItem)sender;
                OpenPersona(menuItem.Text);
            };
        }
예제 #6
0
        public override bool Equals(System.Object obj)
        {
            // If parameter is null return false.
            if (obj == null)
            {
                return(false);
            }

            // If parameter cannot be cast to Point return false.
            OpenableFile p = obj as OpenableFile;

            if ((System.Object)p == null)
            {
                return(false);
            }

            // Return true if the fields match:
            return(this.Equals(p));
        }
예제 #7
0
 private void openFile(OpenableFile file)
 {
     if (!DataManager.settings.openedTabs.Contains(file.File.FullName))
     {
         openFileIgnoreChecks(file);
         DataManager.settings.openedTabs.Add(file.File.FullName);
     }
     else
     {
         foreach (FATabStripItem tab in this.tbStrip.Items)
         {
             if (tab.Tag != null && tab.Tag.Equals(file))
             {
                 this.tbStrip.SelectedItem = tab;
                 tab.Focus();
             }
         }
     }
     this.recentlyOpenedScriptsToolStripMenuItem.addEntry(file.File.FullName);
 }
예제 #8
0
        private OpenableFile findFileInTree(TreeNodeCollection nodes, string filePath)
        {
            OpenableFile foundFile = null;

            foreach (TreeNode node in nodes)
            {
                if (node.Tag is OpenableFile && ((OpenableFile)node.Tag).File.FullName == filePath)
                {
                    foundFile = (OpenableFile)node.Tag;
                }
                else
                {
                    foundFile = findFileInTree(node.Nodes, filePath);
                }
                if (foundFile != null)
                {
                    return(foundFile);
                }
            }
            return(foundFile);
        }
예제 #9
0
        public bool Equals(OpenableFile file)
        {
            // If parameter is null return false:
            if ((object)file == null)
            {
                return false;
            }

            // Return true if the fields match:
            return File != null && file.File != null && File.FullName == file.File.FullName;
        }
예제 #10
0
 private void File_FileReferenceClicked(object sender, OpenableFile.FileReferenceClickedEventArgs e)
 {
     try
     {
         openFile((OpenableFile)this.projectView.Nodes[((OpenableFile)this.CurrentTab.Tag).Persona.Name].Nodes["Vocabulary"].Nodes[$"{e.VocabFileName}.txt"].Tag);
     }
     catch(NullReferenceException ex)
     {
         MessageBox.Show($"Either {e.VocabFileName}.txt vocabulary does not exist or it is default vocabulary of teaseAI and therefore has no openable file: \n {ex.Message}");
     }
 }
예제 #11
0
        private void openFileIgnoreChecks(OpenableFile file)
        {
            FATabStripItem newTab = file.CreateTab();

            file.ContentChanged += new ChangedEventHandler(processTabChanges);
            file.FileReferenceClicked += File_FileReferenceClicked;

            this.tbStrip.AddTab(newTab);

            this.tbStrip.SelectedItem = newTab;

            file.Redraw();
        }
예제 #12
0
 private void openFile(OpenableFile file)
 {
     if (!DataManager.settings.openedTabs.Contains(file.File.FullName))
     {
         openFileIgnoreChecks(file);
         DataManager.settings.openedTabs.Add(file.File.FullName);
     } else
     {
         foreach(FATabStripItem tab in this.tbStrip.Items)
         {
             if(tab.Tag != null && tab.Tag.Equals(file))
             {
                 this.tbStrip.SelectedItem = tab;
                 tab.Focus();
             }
         }
     }
     this.recentlyOpenedScriptsToolStripMenuItem.addEntry(file.File.FullName);
 }