Example #1
0
        internal static ImageViewer OpenImage(FilePath fileName)
        {
            IDockingService dockingService = DependencyFactory.Resolve <IDockingService>();
            var             child          = dockingService.Documents.OfType <ImageViewer>()
                                             .SingleOrDefault(e => e.FileName == fileName);

            if (child != null)
            {
                child.Show();
                return(child);
            }

            ImageViewer doc = new ImageViewer
            {
                Text        = Path.GetFileName(fileName),
                TabText     = Path.GetFileName(fileName),
                ToolTipText = fileName
            };

            doc.OpenFile(fileName);

            if (!Settings.Default.RecentFiles.Contains(fileName))
            {
                Settings.Default.RecentFiles.Add(fileName);
            }

            dockingService.ShowDockPanel(doc);
            return(doc);
        }
Example #2
0
        protected override void Execute()
        {
            if (_activeTextEditor == null)
            {
                return;
            }

            string word = _activeTextEditor.GetWordAtCaret();

            if (string.IsNullOrEmpty(word))
            {
                return;
            }

            _findResults.NewFindResults(word, _projectService.Project.ProjectName);
            var refs = _projectService.FindAllReferences(word);

            foreach (var fileRef in refs.SelectMany(reference => reference))
            {
                _findResults.AddFindResult(fileRef);
            }

            _findResults.DoneSearching();
            _dockingService.ShowDockPanel(_findResults);
        }
Example #3
0
        private void panelMenuItem_Click(object sender, EventArgs e)
        {
            ToolStripMenuItem menuItem = sender as ToolStripMenuItem;

            if (menuItem == null)
            {
                return;
            }

            Type panelType = menuItem.Tag as Type;

            if (panelType == null)
            {
                throw new InvalidOperationException("Panel item tag does not contain panel type");
            }

            if (menuItem.Checked)
            {
                _dockingService.ShowDockPanel(panelType);
            }
            else
            {
                _dockingService.HideDockPanel(panelType);
            }
        }
Example #4
0
        internal static TextEditor OpenDocument(FilePath filename)
        {
            IDockingService dockingService = DependencyFactory.Resolve <IDockingService>();
            var             child          = dockingService.Documents.OfType <TextEditor>()
                                             .SingleOrDefault(e => e.FileName == filename);

            if (child != null)
            {
                child.Show();
                child.Activate();
                return(child);
            }

            TextEditor doc = new TextEditor
            {
                Text        = Path.GetFileName(filename),
                TabText     = Path.GetFileName(filename),
                ToolTipText = filename
            };

            doc.OpenFile(filename);

            dockingService.ShowDockPanel(doc);
            return(doc);
        }
Example #5
0
        private void ShowDebugPanels()
        {
            _showToolbar = Settings.Default.DebugToolbar;
            Settings.Default.DebugToolbar = true;
            if (!_showToolbar)
            {
                _toolBarService.ShowToolBar(DebugToolBarName);
            }

            _dockingService.ShowDockPanel <DebugPanel>();
            _dockingService.ShowDockPanel <StackViewer>();
            _dockingService.ShowDockPanel <ExpressionWindow, StackViewer>(DockAlignment.Left);
            _dockingService.ShowDockPanel <CallStack, StackViewer>();
            _dockingService.ShowDockPanel <TrackingWindow, ExpressionWindow>();
            UpdateTitle(true);
        }
 protected override void Execute()
 {
     GUI.DocumentWindows.TextEditor doc = new GUI.DocumentWindows.TextEditor
     {
         Text    = "New Document",
         TabText = "New Document"
     };
     doc.TabText = "New Document";
     _dockingService.ShowDockPanel(doc);
 }
Example #7
0
        private void DockingService_ActiveDocumentChanged(object sender, EventArgs eventArgs)
        {
            var document = _dockingService.ActiveDocument as MapFileEditor;

            if (document == null)
            {
                _dockingService.HideDockPanel <TilesPanel>();
                _dockingService.HideDockPanel <ObjectsPanel>();
                _toolbarService.HideToolBar(MapLayerToolStrip.StripName);
            }
            else
            {
                _dockingService.ShowDockPanel <TilesPanel>();
                _dockingService.ShowDockPanel <ObjectsPanel>();
                _toolbarService.ShowToolBar(MapLayerToolStrip.StripName);

                document.AppModel.PropertyChanged += AppModel_PropertyChanged;
                _toolStrip.UpdateChecks(document.AppModel.CurrentLayer);
            }
        }
Example #8
0
        protected override void Execute()
        {
            IList <IParserData> parserData;

            if (_text.StartsWith("+") || _text.StartsWith("-") || _text == "_")
            {
                int steps = _text.Count(c => c == '+') - _text.Count(c => c == '-');
                if (steps > 0)
                {
                    steps--;
                }
                var           parserInfo     = _parserService.GetParserInfo(_fileName);
                List <ILabel> reusableLabels = parserInfo.LabelsList.Where(l => l.IsReusable).ToList();
                ILabel        currentLabel   = reusableLabels.FirstOrDefault(l => l.Location.Line >= _currentLine);
                if (currentLabel == null)
                {
                    return;
                }

                int index = reusableLabels.IndexOf(currentLabel) + steps;
                parserData = new List <IParserData> {
                    reusableLabels[index]
                };
            }
            else
            {
                parserData = _parserService.GetParserData(_text, Settings.Default.CaseSensitive).ToList();
            }

            if (parserData.Count == 1)
            {
                RunCommand(new GotoLabelAction(parserData.Single()));
            }
            else
            {
                _findResults.NewFindResults(_text, _projectService.Project.ProjectName);
                foreach (IParserData data in parserData)
                {
                    string line = _fileService.GetLine(data.Parent.SourceFile, data.Location.Line + 1);
                    _findResults.AddFindResult(data.Parent.SourceFile, data.Location.Line, line);
                }
                _findResults.DoneSearching();
                _dockingService.ShowDockPanel(_findResults);
            }
        }
 public Editor OpenDocument(string filename)
 {
     try
     {
         var doc = new Editor();
         OpenDocuments.Add(doc);
         //DockingService.StatusBar.ShowProgress();
         //DockingService.StatusBar.SetProgress(.1, "Open", OperationStatus.Error);
         OpenDocument(doc, filename);
         //DockingService.StatusBar.SetProgress(.9, "Open", OperationStatus.Error);
         //DockingService.StatusBar.HideProgress();
         dockingService.ShowDockPanel(doc);
         doc.Activate();
         return(doc);
     }
     catch (Exception ex)
     {
         DockingService.ShowError("Error opening file " + filename, ex);
         return(null);
     }
 }
        private void FindInFiles(string textToFind, bool matchCase, bool matchWholeWord)
        {
            IProject project = _projectService.Project;

            if (!project.IsInternal)
            {
                IEnumerable <ProjectFile> files = project.GetProjectFiles();
                _results.NewFindResults(findFilesBox.Text, project.ProjectName);
                foreach (ProjectFile file in files)
                {
                    if (!File.Exists(file.FileFullPath))
                    {
                        continue;
                    }

                    string fileText = GetTextForFile(project, file);
                    FindTextInFile(file.FileFullPath, fileText, textToFind, matchWholeWord, matchCase);
                }
            }

            _results.DoneSearching();
            _dockingService.ShowDockPanel(_results);
        }