示例#1
0
        /// <summary>
        /// Закрыть все окна за исключением одного
        /// </summary>
        /// <param name="window"></param>
        public void CloseAllWindowsExcept(Schematix.Windows.SchematixBaseWindow window)
        {
            List <Schematix.Windows.SchematixBaseWindow> windows = new List <Windows.SchematixBaseWindow>(OpenedWindows());

            foreach (Schematix.Windows.SchematixBaseWindow v in windows)
            {
                if (v != window)
                {
                    v.Close();
                }
            }
        }
示例#2
0
 private void SaveAll_CanExecute(object sender, CanExecuteRoutedEventArgs e)
 {
     if (IsLoaded)
     {
         foreach (Schematix.Windows.SchematixBaseWindow el in core.OpenedWindows())
         {
             Schematix.Windows.SchematixBaseWindow window = el;
             if (window.IsModified == true)
             {
                 e.CanExecute = true;
             }
         }
     }
 }
示例#3
0
        /// <summary>
        /// Открыть новое окно
        /// </summary>
        /// <param name="projectElement"></param>
        public Schematix.Windows.SchematixBaseWindow OpenNewWindow(ProjectElementBase projectElement)
        {
            try
            {
                if (projectElement == null)
                {
                    return(null);
                }

                if ((System.IO.File.Exists(projectElement.Path) == false) && ((System.IO.Directory.Exists(projectElement.Path) == false)))
                {
                    var DialogResult = System.Windows.MessageBox.Show(string.Format("Could not find file {0}. Remove it from prject?", projectElement.Path), "File not found", System.Windows.MessageBoxButton.YesNo);
                    if (DialogResult == System.Windows.MessageBoxResult.Yes)
                    {
                        (projectElement.Parent as ProjectFolder).RemoveElement(projectElement);
                        SaveSolution();
                        UpdateExplorerPanel();
                    }
                    return(null);
                }

                Schematix.Windows.SchematixBaseWindow window = null;

                mainWindow.Dispatcher.Invoke(
                    System.Windows.Threading.DispatcherPriority.Background, new System.Windows.Threading.DispatcherOperationCallback(delegate
                {
                    foreach (Schematix.Windows.SchematixBaseWindow v in OpenedWindows())
                    {
                        if ((v.ProjectElement == projectElement) || (v.ProjectElement.Path == projectElement.Path))
                        {
                            window     = v;
                            v.IsActive = true;
                            return(null);
                        }
                    }
                    window = projectElement.CreateNewWindow();
                    return(null);
                }
                                                                                                                                     ), null);
                if (window != null)
                {
                    OpenNewWindow(window);
                }
                return(window);
            }
            catch (Exception ex)
            {
                return(null);
            }
        }
示例#4
0
 /// <summary>
 /// Функция, которая открывает новое окно
 /// </summary>
 /// <param name="window"></param>
 public void OpenNewWindow(Schematix.Windows.SchematixBaseWindow window)
 {
     mainWindow.Dispatcher.Invoke(
         System.Windows.Threading.DispatcherPriority.Background, new System.Windows.Threading.DispatcherOperationCallback(delegate
     {
         var firstDocumentPane = mainWindow.dockManager.Layout.Descendents().OfType <LayoutDocumentPane>().FirstOrDefault();
         if (firstDocumentPane != null)
         {
             if (firstDocumentPane.Children.Contains(window) == false)
             {
                 firstDocumentPane.Children.Add(window);
             }
             window.IsActive = true;
         }
         return(null);
     }
                                                                                                                          ), null);
 }
示例#5
0
        private void dockManager_ActiveContentChanged(object sender, EventArgs e)
        {
            LayoutContent activeContent = dockManager.Layout.ActiveContent;

            if ((((activeContent == null) || (activeContent is Schematix.Panels.SchematixPanelBase))) && (activeContent is Schematix.Panels.StartPagePanel == false))
            {
                return;
            }

            currentActiveWindow = (activeContent is Schematix.Windows.SchematixBaseWindow) ? activeContent as Schematix.Windows.SchematixBaseWindow : null;

            if (core.ToolBoxPanel != null)
            {
                core.ToolBoxPanel.OnActivateChild(currentActiveWindow);
            }

            UpdateToolBox();
            UpdateStatusBar();

            return;
        }
示例#6
0
 /// <summary>
 /// Вызывается при закрытии приложения
 /// </summary>
 public void OnCloseApplication(System.ComponentModel.CancelEventArgs e)
 {
     SaveLayout();
     if ((solution != null) && (solution.CurrentSelectedProject != null) && (solution.CurrentSelectedProject.Compiler.CurrentCompiler.IsBusy))
     {
         System.Windows.MessageBoxResult res = System.Windows.MessageBox.Show(string.Format("Compiler of project {0} is active now. Terminate it anyway?", Solution.CurrentSelectedProject.Caption), "Compiler is active now", System.Windows.MessageBoxButton.YesNo, System.Windows.MessageBoxImage.Question);
         if (res == System.Windows.MessageBoxResult.No)
         {
             e.Cancel = true;
             return;
         }
         if (res == System.Windows.MessageBoxResult.Yes)
         {
             solution.CurrentSelectedProject.Compiler.Dispose();
         }
     }
     //Проверяем есть ли несохраненные файлы
     foreach (Schematix.Windows.SchematixBaseWindow v in OpenedWindows())
     {
         System.ComponentModel.CancelEventArgs arg    = new System.ComponentModel.CancelEventArgs();
         Schematix.Windows.SchematixBaseWindow window = v as Schematix.Windows.SchematixBaseWindow;
         window.SchematixBaseWindow_Closing(this, arg);
         if (arg.Cancel == true)
         {
             e.Cancel = true;
             return;
         }
     }
     //вызываем необходимые методы для панелей
     foreach (Schematix.Panels.SchematixPanelBase panel in OpenedPanels())
     {
         panel.OnClosePanel();
     }
     if (Solution != null)
     {
         //Сохраняем окна
         string filePath = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(Solution.Path), "WindowsState.dat");
         SaveOpenedWindows(filePath);
     }
 }
示例#7
0
        /// <summary>
        /// Открыть файл с исходным кодом и поставить курсор в нужную позицию
        /// </summary>
        /// <param name="filePath"></param>
        /// <param name="searchItemInSolution"></param>
        /// <param name="projFolder"></param>
        /// <param name="LineNumber"></param>
        public Schematix.Windows.Code.Code OpenSource(string filePath, bool searchItemInSolution = true, ProjectFolder projFolder = null, int LineNumber = 0, int position = 0)
        {
            ProjectElementBase elem = null;

            //Ищем в решении файл (если необходимо)
            if (searchItemInSolution == true)
            {
                elem = SearchItemInSolution(filePath);
            }
            //Если файл не нашелся, создаем объект ProjectElementBase вручную
            if (elem == null)
            {
                elem = ProjectElementBase.CreateProjectElementByPath(filePath, projFolder);
            }

            Schematix.Windows.SchematixBaseWindow window     = null;
            Schematix.Windows.Code.Code           codeWindow = null;

            mainWindow.Dispatcher.Invoke(
                System.Windows.Threading.DispatcherPriority.Background, new System.Windows.Threading.DispatcherOperationCallback(delegate
            {
                window     = OpenNewWindow(elem);
                codeWindow = window as Schematix.Windows.Code.Code;
                if (LineNumber >= 0)
                {
                    codeWindow.textEditor.Loaded += new System.Windows.RoutedEventHandler(delegate { codeWindow.SetPosition(LineNumber, position); });
                }
                if (codeWindow.ProjectElement.Parent == null)
                {
                    codeWindow.textEditor.IsReadOnly = true;
                }
                return(null);
            }
                                                                                                                                 ), null);



            return(codeWindow);
        }
        public override void OnActivateChild(Schematix.Windows.SchematixBaseWindow form)
        {
            //if (form == ActiveForm)
            //    return;

            ActiveForm = form;
            if (form == null)
            {
                toolBox.SelectContent("null");
                return;
            }

            if (form is Schematix.Windows.Code.Code)
            {
                Schematix.Windows.Code.Code c = form as Schematix.Windows.Code.Code;
                if ((c.textEditor.SyntaxHighlighting != null) && (c.textEditor.SyntaxHighlighting.Name.Equals("VHDL")))
                {
                    toolBox.SelectContent("VHDLTextTemplates");
                }
                if ((c.textEditor.SyntaxHighlighting != null) && (c.textEditor.SyntaxHighlighting.Name.Equals("Verilog")))
                {
                    toolBox.SelectContent("VerilogTextTemplates");
                }
                return;
            }

            if (form is Schematix.Windows.EntityDrawning.EntityDrawning)
            {
                toolBox.SelectContent("EntityDrawning");
                return;
            }

            if (form is Schematix.Windows.FSM.FSM)
            {
                toolBox.SelectContent("FSM");
                return;
            }

            if (form is Schematix.Windows.Schema.Schema)
            {
                if ((SchematixCore.Core == null) || (SchematixCore.Core.CurrentSelectedProject == null))
                {
                    toolBox.SelectContent("none");
                    return;
                }

                List <Schematix.ProjectExplorer.EDR_File> Files = SchematixCore.Core.CurrentSelectedProject.GetProjectElements <Schematix.ProjectExplorer.EDR_File>();
                List <string> SchemaFiles = new List <string>();
                foreach (Schematix.ProjectExplorer.EDR_File f in Files)
                {
                    SchemaFiles.Add(f.Path);
                }

                toolBox.SelectedType = "Schema";
                ToolBoxWindow.ExpanderData exp = new ToolBoxWindow.ExpanderData();
                exp.IconPath       = "EntityDrawning.jpg";
                exp.TypeOfElements = "EntityDrawning";
                exp.Description    = "Entity Drawning elements avaliable in this project";
                exp.Caption        = "EntityDrawning Items";
                foreach (string file in SchemaFiles)
                {
                    ToolBoxWindow.ToolBoxItem item = new ToolBoxWindow.ToolBoxItem(exp);
                    item.Caption     = System.IO.Path.GetFileName(file);
                    item.Command     = file;
                    item.Description = "Insert " + file + " entity drawning file";
                    item.IconPath    = "EntityDrawning.jpg";
                    exp.Items.Add(item);
                }
                exp.CreateExpander();
                List <ToolBoxWindow.ExpanderData> expanders = new List <ToolBoxWindow.ExpanderData>();
                expanders.Add(exp);
                toolBox.LoadExpanders(expanders);
                return;
            }
            toolBox.SelectContent("none");
        }
示例#9
0
 public virtual void OnActivateChild(Schematix.Windows.SchematixBaseWindow form)
 {
 }