1508 lines
53 KiB
C#
1508 lines
53 KiB
C#
// Copyright (c) Ivan Bondarev, Stanislav Mihalkovich (for details please see \doc\copyright.txt)
|
||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||
using System;
|
||
using System.Collections;
|
||
using System.Collections.Generic;
|
||
using System.ComponentModel;
|
||
using System.Data;
|
||
using System.Drawing;
|
||
using System.Text;
|
||
using System.Windows.Forms;
|
||
using System.IO;
|
||
using VisualPascalABCPlugins;
|
||
using VisualPascalABC.Utils;
|
||
using System.Threading;
|
||
using System.Runtime.InteropServices;
|
||
using WeifenLuo.WinFormsUI.Docking;
|
||
using VisualPascalABC.OptionsContent;
|
||
using System.Security.Permissions;
|
||
using System.ComponentModel.Design;
|
||
|
||
using ICSharpCode.FormsDesigner;
|
||
using ICSharpCode.SharpDevelop.Gui;
|
||
using ICSharpCode.Core;
|
||
using ICSharpCode.SharpDevelop;
|
||
|
||
namespace VisualPascalABC
|
||
{
|
||
delegate void SetTextDelegate(string Text);
|
||
delegate void SetFileNameAndTextDelegate(string ExeFileName, string Text);
|
||
|
||
[SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)]
|
||
|
||
public partial class Form1 : Form, VisualPascalABCPlugins.IWorkbench, VisualPascalABCPlugins.IWorkbenchDocumentService
|
||
{
|
||
private const string MainFormTitle = "PascalABC.NET";
|
||
private static bool DesignerUseable = true;
|
||
private static bool ProjectsUseable = true;
|
||
#if (DEBUG)
|
||
private static bool UseImmediate = true;
|
||
#else
|
||
private static bool UseImmediate = false;
|
||
#endif
|
||
|
||
#if (DEBUG)
|
||
private const bool DebugModus = true;
|
||
#else
|
||
private const bool DebugModus = false;
|
||
#endif
|
||
private string MainFormText = MainFormTitle;
|
||
private string FTSFormat = "{0} [{1}]";
|
||
|
||
internal BottomDockContentForm BottomActiveContent = null;
|
||
|
||
|
||
private ICSharpCode.TextEditor.Document.FileSyntaxModeProvider FileSyntaxProvider;
|
||
|
||
public PascalABCCompiler.Errors.ErrorsStrategyManager ErrorsManager = new PascalABCCompiler.Errors.ErrorsStrategyManager(PascalABCCompiler.Errors.ErrorsStrategy.FirstSemanticAndSyntax);
|
||
|
||
internal bool DebuggerVisible = true;
|
||
|
||
private int FormLeft, FormTop, FormWidth, FormHeight;
|
||
|
||
public ToolBoxForm ToolBoxWindow = null;
|
||
public PropertiesForm PropertiesWindow = null;
|
||
internal OutputWindowForm OutputWindow;
|
||
internal ErrorsListWindowForm ErrorsListWindow;
|
||
internal FindSymbolsResultWindowForm FindSymbolsResultWindow;
|
||
internal ImmediateWindow ImmediateWindow;
|
||
internal CompilerConsoleWindowForm CompilerConsoleWindow;
|
||
internal DebugVariablesListWindowForm DebugVariablesListWindow;
|
||
internal DebugWatchListWindowForm DebugWatchListWindow;
|
||
internal ProjectExplorerForm ProjectExplorerWindow = null;
|
||
WeifenLuo.WinFormsUI.Docking.DockPane BottomPane;
|
||
WeifenLuo.WinFormsUI.Docking.DockPane ProjectPane;
|
||
FSWatcherService WatcherService = new FSWatcherService();
|
||
|
||
private bool LoadComplete = false;
|
||
internal SourceLocationAction ErrorCursorPosStrategy = SourceLocationAction.GotoBeg;
|
||
|
||
private CodeFileDocumentControl activeTabPage = null;
|
||
|
||
PascalABCCompiler.Errors.ErrorsStrategyManager VisualPascalABCPlugins.IWorkbench.ErrorsManager
|
||
{
|
||
get
|
||
{
|
||
return ErrorsManager;
|
||
}
|
||
}
|
||
|
||
VisualPascalABCPlugins.IOutputWindow VisualPascalABCPlugins.IWorkbench.OutputWindow
|
||
{
|
||
get
|
||
{
|
||
return OutputWindow;
|
||
}
|
||
}
|
||
|
||
VisualPascalABCPlugins.ICompilerConsoleWindow VisualPascalABCPlugins.IWorkbench.CompilerConsoleWindow
|
||
{
|
||
get
|
||
{
|
||
return CompilerConsoleWindow;
|
||
}
|
||
}
|
||
|
||
VisualPascalABCPlugins.IErrorListWindow VisualPascalABCPlugins.IWorkbench.ErrorsListWindow
|
||
{
|
||
get
|
||
{
|
||
return ErrorsListWindow;
|
||
}
|
||
}
|
||
|
||
ICodeFileDocument VisualPascalABCPlugins.IWorkbenchDocumentService.ActiveCodeFileDocument
|
||
{
|
||
get
|
||
{
|
||
return ActiveCodeFileDocument;
|
||
}
|
||
set
|
||
{
|
||
ActiveCodeFileDocument = value as CodeFileDocumentControl;
|
||
}
|
||
}
|
||
|
||
ICodeFileDocument VisualPascalABCPlugins.IWorkbenchDocumentService.LastSelectedTab
|
||
{
|
||
get
|
||
{
|
||
return LastSelectedTab;
|
||
}
|
||
|
||
}
|
||
|
||
void VisualPascalABCPlugins.IWorkbench.BeginInvoke(Delegate del, params object[] args)
|
||
{
|
||
this.BeginInvoke(del, args);
|
||
}
|
||
|
||
internal System.Drawing.Image BuildImage
|
||
{
|
||
get
|
||
{
|
||
return miBuild.Image;
|
||
}
|
||
}
|
||
|
||
internal System.Drawing.Image RebuildImage
|
||
{
|
||
get
|
||
{
|
||
return miRebuild.Image;
|
||
}
|
||
}
|
||
|
||
internal System.Drawing.Image RunImage
|
||
{
|
||
get
|
||
{
|
||
return miRun.Image;
|
||
}
|
||
}
|
||
|
||
internal System.Drawing.Image NewFileImage
|
||
{
|
||
get
|
||
{
|
||
return miNew.Image;
|
||
}
|
||
}
|
||
|
||
internal System.Drawing.Image OpenFileImage
|
||
{
|
||
get
|
||
{
|
||
return miOpen.Image;
|
||
}
|
||
}
|
||
|
||
internal System.Drawing.Image NewFormImage
|
||
{
|
||
get
|
||
{
|
||
return mADDFORMToolStripMenuItem.Image;
|
||
}
|
||
}
|
||
|
||
public VisualEnvironmentCompiler VisualEnvironmentCompiler = null;
|
||
|
||
public CompilerForm CompilerForm1;
|
||
|
||
public VisualStates visualStates;
|
||
public AboutBox AboutBox1;
|
||
public FindReplaceForm FindForm;
|
||
public GotoLineForm GotoLineForm;
|
||
public FindReplaceForm ReplaceForm;
|
||
|
||
internal NavigationManager NavigationManager;
|
||
public bool SaveCanceled = false;
|
||
private WorkbenchServiceContainer serviceContainer;
|
||
|
||
//private System.Windows.Forms.DataGridViewImageColumn PictColumn;
|
||
|
||
OptionsContentEngine optionsContentEngine;
|
||
|
||
public Form1()
|
||
{
|
||
if (Tools.IsUnix())
|
||
{
|
||
ProjectsUseable = false;
|
||
DesignerUseable = false;
|
||
//DebuggerVisible = false;
|
||
}
|
||
PascalABCCompiler.StringResourcesLanguage.LoadDefaultConfig();
|
||
//if (PascalABCCompiler.StringResourcesLanguage.AccessibleLanguages.Count > 0)
|
||
// PascalABCCompiler.StringResourcesLanguage.CurrentLanguageName = PascalABCCompiler.StringResourcesLanguage.AccessibleLanguages[0];
|
||
|
||
InitializeComponent();
|
||
|
||
VisualPABCSingleton.MainForm = this;
|
||
WorkbenchStorage.MainProgramThread = System.Threading.Thread.CurrentThread;
|
||
//images init
|
||
this.miNewProject.Image = new System.Drawing.Bitmap(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("VisualPascalABC.Resources.Icons.16x16.NewProjectIcon.png"));
|
||
this.mADDFILEToolStripMenuItem.Image = miNew.Image;
|
||
this.mADDEXISTFILEToolStripMenuItem.Image = miOpen.Image;
|
||
this.mADDFORMToolStripMenuItem.Image = new System.Drawing.Bitmap(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("VisualPascalABC.Resources.Icons.16x16.Form.png"));
|
||
toolStripPanel.Size = new Size(toolStripPanel.Size.Width, toolStrip1.Height);
|
||
var gr = Graphics.FromHwnd(Handle);
|
||
if (gr.DpiX >= 96*2)
|
||
{
|
||
toolStrip1.ImageScalingSize = new Size(32, 32);
|
||
menuStrip1.ImageScalingSize = new Size(32, 32);
|
||
toolStripPanel.Size = new Size(toolStripPanel.Size.Width, 38);
|
||
}
|
||
serviceContainer = new WorkbenchServiceContainer();
|
||
|
||
if (DebuggerVisible)
|
||
{
|
||
InitForm();
|
||
this.StepOutButton.Visible = false;
|
||
PlayPauseButtonsVisibleInPanel = PlayPauseButtonsVisibleInPanel;
|
||
SetDebugButtonsEnabled(false);
|
||
}
|
||
|
||
AddOwnedForm(CompilerForm1 = new CompilerForm());
|
||
AddOwnedForm(AboutBox1 = new AboutBox());
|
||
AddOwnedForm(FindForm = new FindReplaceForm(FindReplaceForm.FormType.Find));
|
||
AddOwnedForm(ReplaceForm = new FindReplaceForm(FindReplaceForm.FormType.Replace));
|
||
AddOwnedForm(GotoLineForm = new GotoLineForm());
|
||
|
||
LastOpenFiles = new List<string>();
|
||
LastOpenProjects = new List<string>();
|
||
|
||
WorkbenchServiceFactory.BuildService.CompilerOptions.Debug = true;
|
||
WorkbenchServiceFactory.BuildService.CompilerOptions.OutputFileType = PascalABCCompiler.CompilerOptions.OutputType.ConsoleApplicaton;
|
||
|
||
LocalizeControls();
|
||
|
||
tsatConsoleApplication.Tag = PascalABCCompiler.CompilerOptions.OutputType.ConsoleApplicaton;
|
||
tsatWindowsApplication.Tag = PascalABCCompiler.CompilerOptions.OutputType.WindowsApplication;
|
||
tsatDll.Tag = PascalABCCompiler.CompilerOptions.OutputType.ClassLibrary;
|
||
|
||
SelectAppType(WorkbenchServiceFactory.BuildService.CompilerOptions.OutputFileType);
|
||
|
||
//this.Width = 800;
|
||
//this.Height = 600;
|
||
UserOptions = new UserOptions();
|
||
|
||
visualStates = new VisualStates();
|
||
|
||
SetFiltersAndHighlighting();
|
||
|
||
FormLeft = this.Left; FormTop = this.Top; FormWidth = this.Width; FormHeight = this.Height;
|
||
MainDockPanel.DockRightPortion = 0.22;
|
||
MainDockPanel.DockLeftPortion = 0.22;
|
||
|
||
//UserOptions.OutputDirectory = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.FullyQualifiedName)+"\\Output";
|
||
UserOptions.OutputDirectory = Constants.DefaultOutputDirectory;
|
||
|
||
PlayPauseButtonsVisibleInPanel = false;
|
||
|
||
WorkbenchStorage.StandartDirectories = new Hashtable(StringComparer.InvariantCultureIgnoreCase);
|
||
WorkbenchStorage.StandartDirectories.Add(Constants.SystemDirectoryIdent, System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.FullyQualifiedName));
|
||
|
||
RestoreDesktop();
|
||
|
||
LoadOptions();
|
||
|
||
HelpExamplesDirectory = PascalABCCompiler.Tools.ReplaceAllKeys(Constants.HelpExamplesDirectory, WorkbenchStorage.StandartDirectories);
|
||
HelpTutorialExamplesDirectory = PascalABCCompiler.Tools.ReplaceAllKeys(Constants.HelpTutorialExamplesDirectory, WorkbenchStorage.StandartDirectories);
|
||
|
||
UpdateUserOptions();
|
||
ErrorsListWindow.Resized();
|
||
FindSymbolsResultWindow.Resized();
|
||
|
||
UpdateOutputWindowVisibleButtons();
|
||
|
||
if (WorkbenchStorage.WorkingDirectory == null || true)
|
||
{
|
||
WorkbenchStorage.WorkingDirectoryInOptionsFile = Constants.DefaultWorkingDirectory;
|
||
WorkbenchStorage.WorkingDirectory = PascalABCCompiler.Tools.ReplaceAllKeys(Constants.DefaultWorkingDirectory, WorkbenchStorage.StandartDirectories);
|
||
}
|
||
if (Path.GetDirectoryName(Application.ExecutablePath).ToLower() != Environment.CurrentDirectory.ToLower())
|
||
WorkbenchStorage.WorkingDirectory = Environment.CurrentDirectory;
|
||
WorkbenchStorage.StandartDirectories.Add(Constants.WorkingDirectoryIdent, WorkbenchStorage.WorkingDirectory);
|
||
openFileDialog1.InitialDirectory = WorkbenchStorage.WorkingDirectory;
|
||
|
||
if (WorkbenchStorage.LibSourceDirectory == null)
|
||
WorkbenchStorage.LibSourceDirectory = PascalABCCompiler.Tools.ReplaceAllKeys(Constants.DefaultLibSourceDirectory, WorkbenchStorage.StandartDirectories);
|
||
WorkbenchStorage.StandartDirectories.Add(Constants.LibSourceDirectoryIdent, WorkbenchStorage.LibSourceDirectory);
|
||
AddSearchDebugPath(WorkbenchStorage.LibSourceDirectory);
|
||
|
||
if (UserOptions.UseOutputDirectory)
|
||
WorkbenchStorage.StandartDirectories.Add(Constants.OutputDirectoryIdent, UserOptions.OutputDirectory);
|
||
else
|
||
WorkbenchStorage.StandartDirectories.Add(Constants.OutputDirectoryIdent, null);
|
||
|
||
RunManager RunnerManager = (WorkbenchServiceFactory.RunService as WorkbenchRunService).RunnerManager;
|
||
VisualEnvironmentCompiler = new VisualEnvironmentCompiler(
|
||
this.BeginInvoke, SetCompilingButtonsEnabled, SetDedugButtonsEnabled, SetStateText,
|
||
AddTextToCompilerMessagesSync, miPlugins, toolStrip1,
|
||
ExecuteSourceLocationAction, ExecuteVisualEnvironmentCompilerAction, ErrorsManager, RunnerManager,
|
||
WorkbenchServiceFactory.DebuggerManager, UserOptions, WorkbenchStorage.StandartDirectories, OpenDocuments, this);
|
||
if (OnEnvorimentEvent != null)
|
||
OnEnvorimentEvent(EnvorimentEvent.VisualEnvironmentCompilerCreated);
|
||
|
||
NavigationManager = new NavigationManager(ExecuteSourceLocationAction);
|
||
NavigationManager.StateChanged += new NavigationManager.NavigationManagerStateChanged(NavigationManager_StateChanged);
|
||
|
||
AddNewProgramToTab(MainDockPanel, InstNameNewProgramm(MainDockPanel));
|
||
|
||
AddOptionsContent();
|
||
Application.AddMessageFilter(this);
|
||
|
||
if (DesignerUseable)
|
||
{
|
||
//miProperties.Visible = true;
|
||
//miToolBox.Visible = true;
|
||
//miNewAdv.Visible = true;
|
||
miUndo.Visible = true;
|
||
}
|
||
this.mRPROJECTToolStripMenuItem.Visible = false;
|
||
if (ProjectsUseable)
|
||
{
|
||
miNewProject.Visible = true;
|
||
miRecentProjects.Visible = true;
|
||
//miCloseProject.Visible = true;
|
||
miOpenProject.Visible = true;
|
||
}
|
||
if (!UseImmediate)
|
||
{
|
||
tsImmediateWindow.Visible = false;
|
||
}
|
||
this.mNEWASPToolStripMenuItem.Visible = DebugModus;
|
||
if (!Tools.IsUnix())
|
||
AddDesignerSidebars();
|
||
|
||
}
|
||
|
||
private void Form1_Load(object sender, EventArgs e)
|
||
{
|
||
init = true;
|
||
foreach (string FileName in VisualPascalABCProgram.CommandLineArgs)
|
||
{
|
||
if (Path.GetExtension(FileName) == ".pabcproj")
|
||
WorkbenchServiceFactory.ProjectService.OpenProject(FileName);
|
||
else
|
||
WorkbenchServiceFactory.FileService.OpenFile(FileName, null);
|
||
}
|
||
if (FileNameToWait != null)
|
||
{
|
||
if (Path.GetExtension(FileNameToWait) == ".pabcproj")
|
||
WorkbenchServiceFactory.ProjectService.OpenProject(FileNameToWait);
|
||
else
|
||
WorkbenchServiceFactory.FileService.OpenFile(FileNameToWait, null);
|
||
}
|
||
SetStopEnabled(false);
|
||
CompilingButtonsEnabled = CloseButtonsEnabled = SaveAllButtonsEnabled = SaveButtonsEnabled = false;
|
||
SetDedugButtonsEnabled(false);
|
||
SetCompilingButtonsEnabled(false);
|
||
|
||
HelpFileName = PascalABCCompiler.Tools.ReplaceAllKeys(Constants.HelpFileName, WorkbenchStorage.StandartDirectories);
|
||
DotNetHelpFileName = PascalABCCompiler.Tools.ReplaceAllKeys(Constants.DotNetHelpFileName, WorkbenchStorage.StandartDirectories);
|
||
if (!File.Exists(HelpFileName))
|
||
tsHelp.Visible = false;
|
||
|
||
HelpExamplesFileName = PascalABCCompiler.Tools.ReplaceAllKeys(Constants.HelpExamplesFileName, WorkbenchStorage.StandartDirectories);
|
||
HelpExamplesMapFileName = PascalABCCompiler.Tools.ReplaceAllKeys(Constants.HelpExamplesMapFileName, WorkbenchStorage.StandartDirectories);
|
||
|
||
InitHelpProgramsDictionary(); // SSM
|
||
|
||
NavigBackButtonsEnabled = NavigForwButtonsEnabled = false;
|
||
|
||
try
|
||
{
|
||
if (!Directory.Exists(WorkbenchStorage.WorkingDirectory))
|
||
Directory.CreateDirectory(WorkbenchStorage.WorkingDirectory);
|
||
}
|
||
catch (Exception exc)
|
||
{
|
||
AddTextToCompilerMessages(Form1StringResources.Get("MSGTYPE") + String.Format(Form1StringResources.Get("ERROR_CREATING_WORKDIR_{0}_{1}"), WorkbenchStorage.WorkingDirectory, exc.Message) + Environment.NewLine);
|
||
}
|
||
try
|
||
{
|
||
if (!Directory.Exists(UserOptions.OutputDirectory))
|
||
Directory.CreateDirectory(UserOptions.OutputDirectory);
|
||
}
|
||
catch (Exception exc)
|
||
{
|
||
AddTextToCompilerMessages(Form1StringResources.Get("MSGTYPE") + String.Format(Form1StringResources.Get("ERROR_CREATING_WORKDIR_{0}_{1}"), UserOptions.OutputDirectory, exc.Message) + Environment.NewLine);
|
||
}
|
||
CodeCompletionActionsManager.templateManager = new CodeTemplateManager();
|
||
}
|
||
|
||
private void LocalizeControls()
|
||
{
|
||
Form1StringResources.SetTextForAllControls(this);
|
||
Form1StringResources.SetTextForAllControls(this.contextMenuStrip1);
|
||
Form1StringResources.SetTextForAllControls(this.cm_Designer);
|
||
Form1StringResources.SetTextForAllControls(this.cmEditor);
|
||
Form1StringResources.SetTextForAllControls(this.cmBreakpointCondition);
|
||
Form1StringResources.SetTextForAllControls(this.RunArgumentsForm);
|
||
PascalABCCompiler.StringResources.SetTextForAllObjects(AboutBox1, "VP_ABOUTBOXFORM_");
|
||
PascalABCCompiler.StringResources.SetTextForAllObjects(FindForm, "VP_FINDFORM_");
|
||
PascalABCCompiler.StringResources.SetTextForAllObjects(ReplaceForm, "VP_REPLACEFORM_");
|
||
PascalABCCompiler.StringResources.SetTextForAllObjects(GotoLineForm, "VP_GOTOLINEFORM_");
|
||
}
|
||
|
||
private void SetFiltersAndHighlighting()
|
||
{
|
||
string hdir = Path.Combine(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.FullyQualifiedName), "Highlighting");
|
||
if (Directory.Exists(hdir))
|
||
{
|
||
FileSyntaxProvider = new ICSharpCode.TextEditor.Document.FileSyntaxModeProvider(hdir+Path.DirectorySeparatorChar);
|
||
ICSharpCode.TextEditor.Document.HighlightingManager.Manager.AddSyntaxModeFileProvider(FileSyntaxProvider);
|
||
string Filter = "", AllFilter = "";
|
||
foreach (ICSharpCode.TextEditor.Document.SyntaxMode sm in FileSyntaxProvider.SyntaxModes)
|
||
{
|
||
Filter = Tools.MakeFilter(Filter, sm.Name, sm.Extensions);
|
||
AllFilter = Tools.MakeAllFilter(AllFilter, sm.Name, sm.Extensions);
|
||
}
|
||
saveFileDialog1.Filter = openFileDialog1.Filter = Tools.FinishMakeFilter(Filter, AllFilter);
|
||
}
|
||
}
|
||
|
||
private void Form1_FormClosed(object sender, FormClosedEventArgs e)
|
||
{
|
||
WorkbenchServiceFactory.CodeCompletionParserController.StopParseThread();
|
||
}
|
||
|
||
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
|
||
{
|
||
string text = Text;
|
||
//<2F><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
if (WorkbenchServiceFactory.RunService.IsRun())
|
||
{
|
||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
this.Text = string.Format(FTSFormat, MainFormText, Form1StringResources.Get("FTS_KILLPROCESS"));
|
||
WorkbenchServiceFactory.RunService.KillAll();
|
||
this.Text = text;
|
||
}
|
||
|
||
WorkbenchServiceFactory.CodeCompletionParserController.StopParsing();
|
||
|
||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
|
||
if (ProjectFactory.Instance.ProjectLoaded)
|
||
{
|
||
if (!WorkbenchServiceFactory.ProjectService.CloseProject())
|
||
{
|
||
e.Cancel = true;
|
||
return;
|
||
}
|
||
}
|
||
else if (!SaveAll(true))
|
||
{
|
||
e.Cancel = true;
|
||
return;
|
||
}
|
||
|
||
|
||
//<2F><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
try
|
||
{
|
||
if (VisualEnvironmentCompiler.Starting())
|
||
{
|
||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
this.Text = string.Format(FTSFormat, MainFormText, Form1StringResources.Get("FTS_CANCELLOADING"));
|
||
VisualEnvironmentCompiler.AbortStaring();
|
||
}
|
||
else
|
||
SaveOptions();
|
||
}
|
||
catch
|
||
{
|
||
|
||
}
|
||
e.Cancel = false;
|
||
}
|
||
|
||
|
||
|
||
private void miClearOutputWindow_Click(object sender, EventArgs e)
|
||
{
|
||
var zoomf = OutputWindow.outputTextBox.ZoomFactor;
|
||
OutputWindow.outputTextBox.Clear();
|
||
OutputWindow.outputTextBox.ZoomFactor = zoomf;
|
||
}
|
||
|
||
public enum EnvorimentEvent {VisualEnvironmentCompilerCreated}
|
||
public delegate void EnvorimentEventDelegate(EnvorimentEvent EnvorimentEvent);
|
||
public event EnvorimentEventDelegate OnEnvorimentEvent;
|
||
bool init = false;
|
||
string FileNameToWait=null;
|
||
|
||
void NavigationManager_StateChanged(NavigationManager sender)
|
||
{
|
||
NavigBackButtonsEnabled = NavigationManager.CanNavigateBackward;
|
||
NavigForwButtonsEnabled = NavigationManager.CanNavigateForward;
|
||
}
|
||
|
||
private void OpenToolStripMenuItem1_Click_1(object sender, EventArgs e)
|
||
{
|
||
OpenFileDialog(Path.GetDirectoryName(CurrentSourceFileName));
|
||
}
|
||
|
||
VisualPascalABCPlugins.IVisualEnvironmentCompiler VisualPascalABCPlugins.IWorkbench.VisualEnvironmentCompiler
|
||
{
|
||
get
|
||
{
|
||
return VisualEnvironmentCompiler;
|
||
}
|
||
}
|
||
|
||
private void UndoToolStripMenuItem_Click(object sender, EventArgs e) //roman//
|
||
{
|
||
ExecUndo();
|
||
}
|
||
|
||
private void RedoToolStripMenuItem_Click(object sender, EventArgs e) //roman//
|
||
{
|
||
ExecRedo();
|
||
}
|
||
|
||
private void ExitToolStripMenuItem_Click(object sender, EventArgs e)
|
||
{
|
||
Close();
|
||
}
|
||
|
||
public void SetStateText(string text)
|
||
{
|
||
toolStripStatusLabel5.Text = text;
|
||
statusStrip1.Refresh();
|
||
}
|
||
|
||
public void Reset()
|
||
{
|
||
}
|
||
|
||
private void Form1_Shown(object sender, EventArgs e)
|
||
{
|
||
|
||
if(_mainFormWindowStateMaximized)
|
||
this.WindowState = FormWindowState.Maximized;
|
||
//PascalABCCompiler.StringResourcesLanguage.CurrentLanguageName = "Russi
|
||
|
||
ChangedSelectedTab();
|
||
VisualEnvironmentCompiler.ChangeVisualEnvironmentState += new ChangeVisualEnvironmentStateDelegate(VisualEnvironmentCompiler_ChangeVisualEnvironmentState);
|
||
VisualEnvironmentCompiler.RunStartingThread();
|
||
|
||
LoadComplete = true;
|
||
}
|
||
|
||
private object ExecuteVisualEnvironmentCompilerAction(VisualEnvironmentCompilerAction Action,object obj)
|
||
{
|
||
switch (Action)
|
||
{
|
||
case VisualEnvironmentCompilerAction.Run:
|
||
return WorkbenchServiceFactory.RunService.Run(true);
|
||
case VisualEnvironmentCompilerAction.Stop:
|
||
return WorkbenchServiceFactory.RunService.Stop();
|
||
case VisualEnvironmentCompilerAction.Build:
|
||
return WorkbenchServiceFactory.BuildService.Build();
|
||
case VisualEnvironmentCompilerAction.BuildUnit:
|
||
return WorkbenchServiceFactory.BuildService.Build(obj as string);
|
||
case VisualEnvironmentCompilerAction.Rebuild:
|
||
return WorkbenchServiceFactory.BuildService.Rebuild();
|
||
case VisualEnvironmentCompilerAction.OpenFile:
|
||
return WorkbenchServiceFactory.FileService.OpenFile((string)obj, null);
|
||
case VisualEnvironmentCompilerAction.GetDirectory:
|
||
string s=VisualEnvironmentCompiler.Compiler.CompilerOptions.StandartDirectories[(string)obj] as string;
|
||
if (s != null)
|
||
return s;
|
||
return WorkbenchStorage.StandartDirectories[(string)obj] as string;
|
||
case VisualEnvironmentCompilerAction.GetCurrentSourceFileName:
|
||
return CurrentSourceFileName;
|
||
case VisualEnvironmentCompilerAction.SetCurrentSourceFileTextFormatting:
|
||
case VisualEnvironmentCompilerAction.SetCurrentSourceFileText:
|
||
{
|
||
string text = (string)obj;
|
||
string clipboard_text = Tools.GetTextFromClipboard();
|
||
CurrentSyntaxEditor.SelectAll();
|
||
Tools.CopyTextToClipboard(text);
|
||
CurrentSyntaxEditor.Paste(true);
|
||
Tools.CopyTextToClipboard(clipboard_text);
|
||
//CurrentSyntaxEditor.SetText(text);
|
||
}
|
||
return true;
|
||
/*case VisualEnvironmentCompilerAction.SetCurrentSourceFileTextFormatting:
|
||
string text2 = (string)obj;
|
||
CurrentSyntaxEditor.SelectAll();
|
||
Tools.CopyTextToClipboard(text2);
|
||
CurrentSyntaxEditor.Paste(false);
|
||
//CurrentSyntaxEditor.SetText(text2);
|
||
return true;*/
|
||
case VisualEnvironmentCompilerAction.AddTextToCompilerMessages:
|
||
AddTextToCompilerMessagesSync((string)obj);
|
||
return true;
|
||
case VisualEnvironmentCompilerAction.AddMessageToErrorListWindow:
|
||
ErrorsListWindow.ShowErrorsSync((List<PascalABCCompiler.Errors.Error>)obj,true);
|
||
return true;
|
||
case VisualEnvironmentCompilerAction.SaveFile:
|
||
string FileName = Tools.FileNameToLower((string)obj);
|
||
if (!OpenDocuments.ContainsKey(FileName))
|
||
return false;
|
||
SaveFileAs(OpenDocuments[FileName], (string)obj);
|
||
return true;
|
||
}
|
||
return false;
|
||
}
|
||
|
||
void VisualEnvironmentCompiler_ChangeVisualEnvironmentState(VisualEnvironmentState State, object obj)
|
||
{
|
||
switch (State)
|
||
{
|
||
case VisualEnvironmentState.StartCompilerLoading:
|
||
this.Text = String.Format(FTSFormat,MainFormText,Form1StringResources.Get("FTS_LOADING"));
|
||
break;
|
||
case VisualEnvironmentState.FinishCompilerLoading:
|
||
//this.Text = String.Format("{0} v{1}",MainFormText,PascalABCCompiler.Compiler.ShortVersion);
|
||
this.Text = MainFormText;
|
||
openFileDialog1.Filter = saveFileDialog1.Filter = VisualEnvironmentCompiler.GetFilterForDialogs();
|
||
openProjectDialog.Filter = VisualEnvironmentCompiler.GetProjectFilterForDialogs();
|
||
VisualEnvironmentCompiler.Compiler.CompilerOptions = WorkbenchServiceFactory.BuildService.CompilerOptions;
|
||
break;
|
||
}
|
||
}
|
||
|
||
public string CurrentSourceFileName
|
||
{
|
||
get { return CurrentCodeFileDocument.FileName; }
|
||
}
|
||
|
||
public string CurrentEXEFileName
|
||
{
|
||
get
|
||
{
|
||
if (UserOptions.UseOutputDirectory)
|
||
return Path.Combine(UserOptions.OutputDirectory , Path.GetFileNameWithoutExtension(CurrentSourceFileName)) + ".exe";
|
||
else
|
||
return Path.ChangeExtension(CurrentSourceFileName, ".exe");
|
||
}
|
||
}
|
||
|
||
private void OpenLastFile_ToolStripMenuItem_Click(object sender, EventArgs e)
|
||
{
|
||
WorkbenchServiceFactory.FileService.OpenFile((sender as ToolStripMenuItem).Tag as string, null);
|
||
}
|
||
|
||
private void OpenLastProject_ToolStripMenuItem_Click(object sender, EventArgs e)
|
||
{
|
||
WorkbenchServiceFactory.ProjectService.OpenProject((sender as ToolStripMenuItem).Tag as string);
|
||
}
|
||
|
||
private void toolStripButton19_Click(object sender, EventArgs e)
|
||
{
|
||
OutputWindow.outputTextBox.Text = "";
|
||
}
|
||
|
||
private void fontDialog1_Apply(object sender, EventArgs e)
|
||
{
|
||
CurrentCodeFileDocument.Font = fontDialog1.Font;
|
||
}
|
||
|
||
private void toolStripButton12_Click(object sender, EventArgs e)
|
||
{
|
||
WorkbenchServiceFactory.BuildService.StartCompile(true);
|
||
}
|
||
|
||
private void toolStripButton10_Click(object sender, EventArgs e)
|
||
{
|
||
WorkbenchServiceFactory.BuildService.StartCompile(false);
|
||
}
|
||
|
||
private void miAboutToolStripMenuItem_Click(object sender, EventArgs e)
|
||
{
|
||
AboutBox1.ShowDialog();
|
||
}
|
||
|
||
private void CompileButton_EnabledChanged(object sender, EventArgs e)
|
||
{
|
||
//CompileMenuItem.Enabled = CompileButton.Enabled;
|
||
}
|
||
|
||
private void StartButton_EnabledChanged(object sender, EventArgs e)
|
||
{
|
||
//StartMenuItem.Enabled = StartButton.Enabled;
|
||
}
|
||
|
||
private void ReCompileButton_EnabledChanged(object sender, EventArgs e)
|
||
{
|
||
miRebuild.Enabled = ReCompileButton.Enabled;
|
||
}
|
||
|
||
private void miCurt_Click(object sender, EventArgs e)
|
||
{
|
||
ExecCut();
|
||
}
|
||
|
||
private void miCopy_Click(object sender, EventArgs e)
|
||
{
|
||
ExecCopy();
|
||
}
|
||
|
||
private void miPaste_Click(object sender, EventArgs e)
|
||
{
|
||
ExecPaste();
|
||
}
|
||
|
||
private void miStop_Click(object sender, EventArgs e)
|
||
{
|
||
WorkbenchServiceFactory.RunService.Stop();
|
||
}
|
||
|
||
private void miSave_Click(object sender, EventArgs e)
|
||
{
|
||
SaveSelFile(CurrentCodeFileDocument);
|
||
}
|
||
|
||
private void miSaveAll_Click_1(object sender, EventArgs e)
|
||
{
|
||
SaveAll(false);
|
||
}
|
||
|
||
private void miClose_Click(object sender, EventArgs e)
|
||
{
|
||
if (CurrentWebBrowserControl != null)
|
||
CurrentWebBrowserControl.Close();
|
||
else
|
||
CurrentCodeFileDocument.Close();
|
||
}
|
||
|
||
private void miCloseNonActive_Click(object sender, EventArgs e)
|
||
{
|
||
CloseAllButThis(CurrentCodeFileDocument);
|
||
}
|
||
|
||
private void miNew_Click(object sender, EventArgs e)
|
||
{
|
||
WorkbenchServiceFactory.FileService.OpenFile(null, null);
|
||
}
|
||
|
||
private void miSaveAs_Click(object sender, EventArgs e)
|
||
{
|
||
ExecuteSaveAs(CurrentCodeFileDocument);
|
||
}
|
||
|
||
|
||
|
||
private void tsat_Click(object sender, EventArgs e)
|
||
{
|
||
SelectAppType((PascalABCCompiler.CompilerOptions.OutputType)((sender as ToolStripMenuItem).Tag));
|
||
}
|
||
|
||
public void SelectAppType(PascalABCCompiler.CompilerOptions.OutputType outputType)
|
||
{
|
||
Image img = null;
|
||
foreach (ToolStripMenuItem mi in tstaSelect.DropDownItems)
|
||
if (outputType == (PascalABCCompiler.CompilerOptions.OutputType)mi.Tag)
|
||
img = mi.Image;
|
||
tstaSelect.Image = img;
|
||
WorkbenchServiceFactory.BuildService.CompilerOptions.OutputFileType = outputType;
|
||
}
|
||
|
||
private void StartMenuItem_Click(object sender, EventArgs e)
|
||
{
|
||
WorkbenchServiceFactory.RunService.Run(true);
|
||
}
|
||
|
||
private void Form1_KeyUp(object sender, KeyEventArgs e)
|
||
{
|
||
if (e.KeyData == Keys.F1)
|
||
{
|
||
ExecShowHelpF1();
|
||
}
|
||
}
|
||
|
||
private void Form1_SizeChanged(object sender, EventArgs e)
|
||
{
|
||
if (WindowState == FormWindowState.Normal)
|
||
{
|
||
FormWidth = Width;
|
||
FormHeight = Height;
|
||
}
|
||
}
|
||
|
||
private void Form1_LocationChanged(object sender, EventArgs e)
|
||
{
|
||
if (WindowState == FormWindowState.Normal)
|
||
{
|
||
FormLeft = Left;
|
||
FormTop = Top;
|
||
}
|
||
}
|
||
|
||
private void miFind_Click(object sender, EventArgs e)
|
||
{
|
||
ExecFind();
|
||
}
|
||
|
||
private void miReplace_Click(object sender, EventArgs e)
|
||
{
|
||
ExecReplace();
|
||
}
|
||
|
||
private void miFindNext_Click(object sender, EventArgs e)
|
||
{
|
||
ExecFindNext();
|
||
}
|
||
|
||
internal WebBrowserControl _currentWebBrowserControl = null;
|
||
|
||
internal CodeFileDocumentControl _currentCodeFileDocument = null;
|
||
|
||
public WebBrowserControl CurrentWebBrowserControl
|
||
{
|
||
get { return _currentWebBrowserControl; }
|
||
set
|
||
{
|
||
_currentWebBrowserControl = value;
|
||
if (value != null)
|
||
value.Activate();
|
||
}
|
||
}
|
||
|
||
public CodeFileDocumentControl CurrentCodeFileDocument
|
||
{
|
||
get { return _currentCodeFileDocument; }
|
||
set {
|
||
_currentCodeFileDocument = value;
|
||
value.Activate();
|
||
}
|
||
}
|
||
|
||
VisualPascalABCPlugins.ICodeFileDocument VisualPascalABCPlugins.IWorkbenchDocumentService.CurrentCodeFileDocument
|
||
{
|
||
get
|
||
{
|
||
return CurrentCodeFileDocument;
|
||
}
|
||
set
|
||
{
|
||
CurrentCodeFileDocument = value as CodeFileDocumentControl;
|
||
}
|
||
}
|
||
|
||
public CodeFileDocumentControl ActiveCodeFileDocument
|
||
{
|
||
get { return activeTabPage; }
|
||
set
|
||
{
|
||
if (activeTabPage != value)
|
||
{
|
||
CodeFileDocumentControl tp = ActiveCodeFileDocument;
|
||
activeTabPage = value;
|
||
if (tp != null)
|
||
SetTabPageText(tp);
|
||
if (activeTabPage != null)
|
||
SetTabPageText(activeTabPage);
|
||
}
|
||
}
|
||
|
||
}
|
||
|
||
Form VisualPascalABCPlugins.IWorkbench.MainForm
|
||
{
|
||
get
|
||
{
|
||
return this;
|
||
}
|
||
}
|
||
|
||
private void cmSetActive_Click(object sender, EventArgs e)
|
||
{
|
||
ActiveCodeFileDocument = CurrentCodeFileDocument;
|
||
}
|
||
|
||
private void miOutputWindow_Click(object sender, EventArgs e)
|
||
{
|
||
BottomTabsVisible = !BottomTabsVisible;
|
||
}
|
||
|
||
private void toolStripMenuItem8_Click(object sender, EventArgs e)
|
||
{
|
||
CurrentSyntaxEditor.ToggleBookmark();
|
||
}
|
||
|
||
private void mGOTONEXTBOOKMARKToolStripMenuItem_Click(object sender, EventArgs e)
|
||
{
|
||
CurrentSyntaxEditor.NextBookmark();
|
||
}
|
||
|
||
private void mGOTOPREVBOOKMARKToolStripMenuItem_Click(object sender, EventArgs e)
|
||
{
|
||
CurrentSyntaxEditor.PrevBookmark();
|
||
}
|
||
|
||
private void mCLEARBOOKMARKSToolStripMenuItem_Click(object sender, EventArgs e)
|
||
{
|
||
CurrentSyntaxEditor.ClearAllBookmarks();
|
||
}
|
||
|
||
private void miRunNoDebug_Click(object sender, EventArgs e)
|
||
{
|
||
WorkbenchServiceFactory.RunService.Run(false);
|
||
}
|
||
|
||
Dictionary<CodeFileDocumentControl, string> lastInputTexts = new Dictionary<CodeFileDocumentControl, string>();
|
||
internal string lastInputText
|
||
{
|
||
get
|
||
{
|
||
if (lastInputTexts.ContainsKey(CurrentCodeFileDocument))
|
||
return lastInputTexts[CurrentCodeFileDocument];
|
||
else
|
||
return "";
|
||
}
|
||
set
|
||
{
|
||
if (value == "")
|
||
if (lastInputTexts.ContainsKey(CurrentCodeFileDocument))
|
||
{
|
||
lastInputTexts.Remove(CurrentCodeFileDocument);
|
||
return;
|
||
}
|
||
if (lastInputTexts.ContainsKey(CurrentCodeFileDocument))
|
||
lastInputTexts[CurrentCodeFileDocument] = value;
|
||
else
|
||
lastInputTexts.Add(CurrentCodeFileDocument, value);
|
||
}
|
||
}
|
||
|
||
private void cmFindAllReferences_Click(object sender, EventArgs e)
|
||
{
|
||
ExecFindReferences();
|
||
}
|
||
|
||
private void tsNavigBack_Click(object sender, EventArgs e)
|
||
{
|
||
ExecNavigateBackward();
|
||
}
|
||
|
||
private void tsNavigForw_Click(object sender, EventArgs e)
|
||
{
|
||
ExecNavigateForward();
|
||
}
|
||
|
||
private void Form1_KeyDown(object sender, KeyEventArgs e)
|
||
{
|
||
if (e.KeyData == Keys.Escape && BottomTabsVisibleChekerEnabled)
|
||
{
|
||
BottomTabsVisible = false;
|
||
e.Handled = true;
|
||
}
|
||
if (e.KeyData == Keys.Delete)
|
||
{
|
||
if (_designer_is_active && MainDockPanel.ActiveContent is CodeFileDocumentControl)
|
||
{
|
||
ExecDelete();
|
||
}
|
||
}
|
||
}
|
||
|
||
private void mGENERATEREALIZATIONToolStripMenuItem_Click(object sender, EventArgs e)
|
||
{
|
||
(new ClassOrMethodRealizationAction()).Execute(CurrentSyntaxEditor.TextEditor.ActiveTextAreaControl.TextArea);
|
||
}
|
||
|
||
private void tsSelectAll_Click(object sender, EventArgs e)
|
||
{
|
||
ExecSelectAll();
|
||
}
|
||
|
||
private void tsGotoLine_Click(object sender, EventArgs e)
|
||
{
|
||
ExecGotoLine();
|
||
}
|
||
|
||
public SymbolsViwer FindSymbolResults
|
||
{
|
||
get
|
||
{
|
||
return FindSymbolsResultWindow.FindSymbolResults;
|
||
}
|
||
}
|
||
|
||
public void ShowFindResults(List<SymbolsViewerSymbol> syms)
|
||
{
|
||
FindSymbolsResultWindow.ShowFindResults(syms);
|
||
}
|
||
|
||
private void tsShowOutputWindow_Click(object sender, EventArgs e)
|
||
{
|
||
ShowContent(OutputWindow, true);
|
||
}
|
||
|
||
private void tsShowErrorsListWindow_Click(object sender, EventArgs e)
|
||
{
|
||
ShowContent(ErrorsListWindow, true);
|
||
}
|
||
|
||
private void tsShowCompilerConsoleWindow_Click(object sender, EventArgs e)
|
||
{
|
||
ShowContent(CompilerConsoleWindow, true);
|
||
}
|
||
|
||
private void tsShowFindSymbolsResultWindow_Click(object sender, EventArgs e)
|
||
{
|
||
if (!BottomTabsVisible)
|
||
BottomTabsVisible = true;
|
||
ShowContent(FindSymbolsResultWindow, true);
|
||
}
|
||
|
||
private void tsShowDebugVariablesListWindow_Click(object sender, EventArgs e)
|
||
{
|
||
if (!BottomTabsVisible)
|
||
BottomTabsVisible = true;
|
||
ShowContent(DebugVariablesListWindow, true);
|
||
}
|
||
|
||
private void tsShowDebugWatchListWindow_Click(object sender, EventArgs e)
|
||
{
|
||
if (!BottomTabsVisible)
|
||
BottomTabsVisible = true;
|
||
ShowContent(DebugWatchListWindow, true);
|
||
}
|
||
|
||
private void contextMenuStrip1_Opening(object sender, CancelEventArgs e)
|
||
{
|
||
if (!(MainDockPanel.ActiveContent is CodeFileDocumentControl))
|
||
{
|
||
this.cmSave.Visible = false;
|
||
this.cmSetActive.Visible = false;
|
||
this.cmCloseAllButThis.Visible = false;
|
||
CloseButtonsEnabled = true;
|
||
}
|
||
else
|
||
{
|
||
this.cmSave.Visible = true;
|
||
this.cmSetActive.Visible = true;
|
||
this.cmCloseAllButThis.Visible = true;
|
||
CloseButtonsEnabled = OpenDocuments.Count > 1;
|
||
}
|
||
}
|
||
|
||
private void mOPTIONSToolStripMenuItem_Click(object sender, EventArgs e)
|
||
{
|
||
optionsContentEngine.ShowDialog();
|
||
}
|
||
|
||
private void tsViewIntellisensePanel_CheckedChanged(object sender, EventArgs e)
|
||
{
|
||
if (tsViewIntellisensePanel.Checked != UserOptions.ShowQuickClassBrowserPanel)
|
||
{
|
||
UserOptions.ShowQuickClassBrowserPanel = tsViewIntellisensePanel.Checked;
|
||
UpdateUserOptions();
|
||
}
|
||
}
|
||
|
||
private void mEXAMPLESToolStripMenuItem_Click(object sender, EventArgs e)
|
||
{
|
||
Help.ShowHelp(null, HelpExamplesFileName);
|
||
}
|
||
|
||
private void toolStripMenuItem1_Click_1(object sender, EventArgs e)
|
||
{
|
||
OpenFileDialog(HelpExamplesDirectory);
|
||
}
|
||
|
||
private void toolStripMenuItem5_Click(object sender, EventArgs e)
|
||
{
|
||
OpenFileDialog(HelpTutorialExamplesDirectory);
|
||
}
|
||
|
||
private void miAddExpr_Click(object sender, EventArgs e)
|
||
{
|
||
AddToWatchAction wact = new AddToWatchAction();
|
||
wact.Execute(this.CurrentCodeFileDocument.TextEditor.ActiveTextAreaControl.TextArea);
|
||
}
|
||
|
||
public ContextMenuStrip BreakpointMenuStrip
|
||
{
|
||
get
|
||
{
|
||
return cmBreakpointCondition;
|
||
}
|
||
}
|
||
|
||
private void mDELETEBREAKPOINTToolStripMenuItem_Click(object sender, EventArgs e)
|
||
{
|
||
this.CurrentCodeFileDocument.TextEditor.ContextMenuStrip = this.cmEditor;
|
||
BreakPointFactory.DeleteCurrentBreakpoint();
|
||
}
|
||
|
||
private void mBREAKPOINTCONDITIONToolStripMenuItem1_Click(object sender, EventArgs e)
|
||
{
|
||
this.CurrentCodeFileDocument.TextEditor.ContextMenuStrip = this.cmEditor;
|
||
BreakPointFactory.InvokeAddCondition();
|
||
}
|
||
|
||
private void miToolBox_Click(object sender, EventArgs e)
|
||
{
|
||
ToolBoxVisible = true;
|
||
}
|
||
|
||
private void miProperties_Click(object sender, EventArgs e)
|
||
{
|
||
PropertiesWindowVisible = true;
|
||
}
|
||
|
||
private void miUnitWithForm_Click(object sender, EventArgs e)
|
||
{
|
||
OpenFileWithForm();
|
||
}
|
||
|
||
private void mMAINFEATURESToolStripMenuItem_Click(object sender, EventArgs e)
|
||
{
|
||
if (!ThreadPool.QueueUserWorkItem(__showgettingstarted))
|
||
__showgettingstarted(null);
|
||
}
|
||
|
||
[System.ComponentModel.EditorBrowsableAttribute()]
|
||
protected override void WndProc(ref Message m)
|
||
{
|
||
if (m.Msg == 74)//WM_COPYDATA
|
||
{
|
||
try
|
||
{
|
||
COPYDATASTRUCT cds = (COPYDATASTRUCT)Marshal.PtrToStructure(m.LParam,typeof(COPYDATASTRUCT));
|
||
if (cds.dwData.ToInt32() == 32)//open file
|
||
{
|
||
string file_name = cds.lpData;//Marshal.PtrToStringUni(cds.lpData,(int)cds.cbData);
|
||
//MessageBox.Show(cds.cbData.ToString());
|
||
if (init)
|
||
{
|
||
if (System.IO.Path.GetExtension(file_name) != ".pabcproj")
|
||
WorkbenchServiceFactory.FileService.OpenFile(file_name, null);
|
||
else
|
||
WorkbenchServiceFactory.ProjectService.OpenProject(file_name);
|
||
}
|
||
else
|
||
{
|
||
FileNameToWait = file_name;
|
||
}
|
||
}
|
||
}
|
||
catch
|
||
{
|
||
|
||
}
|
||
}
|
||
base.WndProc(ref m);
|
||
}
|
||
|
||
|
||
|
||
private void miNewProject_Click(object sender, EventArgs e)
|
||
{
|
||
WorkbenchServiceFactory.ProjectService.NewProject();
|
||
}
|
||
|
||
private void miOpenProject_Click(object sender, EventArgs e)
|
||
{
|
||
OpenProjectDialog(Constants.DefaultWorkingDirectory);
|
||
}
|
||
|
||
List<string> watches = new List<string>();
|
||
|
||
private void miCloseProject_Click(object sender, EventArgs e)
|
||
{
|
||
//CloseProjectFiles();
|
||
WorkbenchServiceFactory.ProjectService.CloseProject();
|
||
}
|
||
|
||
private void mADDFILEToolStripMenuItem_Click(object sender, EventArgs e)
|
||
{
|
||
ProjectTask.NewFile(ProjectExplorerWindow);
|
||
}
|
||
|
||
private void mADDEXISTFILEToolStripMenuItem_Click(object sender, EventArgs e)
|
||
{
|
||
ProjectTask.AddFile(ProjectExplorerWindow);
|
||
}
|
||
|
||
private void mADDFORMToolStripMenuItem_Click(object sender, EventArgs e)
|
||
{
|
||
ProjectTask.NewForm(ProjectExplorerWindow, true);//roman//
|
||
}
|
||
|
||
private void mADDREFERENCEToolStripMenuItem_Click(object sender, EventArgs e)
|
||
{
|
||
ProjectTask.AddReferencesToProject(ProjectExplorerWindow);
|
||
}
|
||
|
||
private void mPROPERTIESToolStripMenuItem_Click(object sender, EventArgs e)
|
||
{
|
||
ProjectTask.ProjectProperties();
|
||
}
|
||
|
||
void TsImmediateWindowClick(object sender, EventArgs e)
|
||
{
|
||
if (!BottomTabsVisible)
|
||
BottomTabsVisible = true;
|
||
ShowContent(ImmediateWindow,true);
|
||
}
|
||
|
||
private RunArguments RunArgumentsForm = new RunArguments();
|
||
|
||
private void mRUNPARAMETERSToolStripMenuItem1_Click(object sender, EventArgs e)
|
||
{
|
||
ExecRunParameters();
|
||
}
|
||
|
||
private void cmiCopy_Click(object sender, EventArgs e)
|
||
{
|
||
ExecDesignerCopy();
|
||
}
|
||
|
||
private void cmiPaste_Click(object sender, EventArgs e)
|
||
{
|
||
ExecDesignerPaste();
|
||
}
|
||
|
||
private void miDelete_Click(object sender, EventArgs e)
|
||
{
|
||
ExecDelete();
|
||
}
|
||
|
||
private void cmiDelete_Click(object sender, EventArgs e)
|
||
{
|
||
ExecDelete();
|
||
}
|
||
|
||
private void cmiCut_Click(object sender, EventArgs e)
|
||
{
|
||
ExecDesignerCut();
|
||
}
|
||
|
||
private void miTabOrder_Click(object sender, EventArgs e)
|
||
{
|
||
ExecTabOrder();
|
||
}
|
||
|
||
private void miShowGrid_Click(object sender, EventArgs e)
|
||
{
|
||
ExecShowGrid();
|
||
}
|
||
|
||
private void miSnapToGrid_Click(object sender, EventArgs e)
|
||
{
|
||
ExecSnapToGrid();
|
||
}
|
||
|
||
private void cmiAlignLefts_Click(object sender, EventArgs e)
|
||
{
|
||
ExecAlignLefts();
|
||
}
|
||
|
||
private void cmiAlignRights_Click(object sender, EventArgs e)
|
||
{
|
||
ExecAlignRights();
|
||
}
|
||
|
||
private void cmiAlignTops_Click(object sender, EventArgs e)
|
||
{
|
||
ExecAlignTops();
|
||
}
|
||
|
||
private void cmiAlignBottoms_Click(object sender, EventArgs e)
|
||
{
|
||
ExecAlignBottoms();
|
||
}
|
||
|
||
private void cmiAlignMiddles_Click(object sender, EventArgs e)
|
||
{
|
||
ExecAlignMiddles();
|
||
}
|
||
|
||
private void cmiAlignCenters_Click(object sender, EventArgs e)
|
||
{
|
||
ExecAlignCenters();
|
||
}
|
||
|
||
private void cmiAlignToGrid_Click(object sender, EventArgs e)
|
||
{
|
||
ExecAlignToGrid();
|
||
}
|
||
|
||
private void cmiCenterHorizontally_Click(object sender, EventArgs e)
|
||
{
|
||
ExecCenterHorizontally();
|
||
}
|
||
|
||
private void cmiCenterVertically_Click(object sender, EventArgs e)
|
||
{
|
||
ExecCenterVertically();
|
||
}
|
||
|
||
private void cmiSizeToControl_Click(object sender, EventArgs e)
|
||
{
|
||
ExecSizeToControl();
|
||
}
|
||
|
||
private void cmiSizeToControlWidth_Click(object sender, EventArgs e)
|
||
{
|
||
ExecSizeToControlWidth();
|
||
}
|
||
|
||
private void cmiSizeToControlHeight_Click(object sender, EventArgs e)
|
||
{
|
||
ExecSizeToControlHeight();
|
||
}
|
||
|
||
private void cmiSizeToGrid_Click(object sender, EventArgs e)
|
||
{
|
||
ExecSizeToGrid();
|
||
}
|
||
|
||
private void cmiBringToFront_Click(object sender, EventArgs e)
|
||
{
|
||
ExecBringToFront();
|
||
}
|
||
|
||
private void cmiSendToBack_Click(object sender, EventArgs e)
|
||
{
|
||
ExecSendToBack();
|
||
}
|
||
|
||
private void cmiTabOrder_Click(object sender, EventArgs e)
|
||
{
|
||
cmiTabOrder.Checked = !cmiTabOrder.Checked;
|
||
ExecTabOrder();
|
||
}
|
||
|
||
private void mFORMATToolStripMenuItem_Click(object sender, EventArgs e)
|
||
{
|
||
(new CodeFormattingAction()).Execute(CurrentSyntaxEditor.TextEditor.ActiveTextAreaControl.TextArea);
|
||
}
|
||
|
||
private void cmFormat_Click(object sender, EventArgs e)
|
||
{
|
||
(new CodeFormattingAction()).Execute(CurrentSyntaxEditor.TextEditor.ActiveTextAreaControl.TextArea);
|
||
}
|
||
|
||
private void tsFormat_Click(object sender, EventArgs e)
|
||
{
|
||
(new CodeFormattingAction()).Execute(CurrentSyntaxEditor.TextEditor.ActiveTextAreaControl.TextArea);
|
||
}
|
||
|
||
|
||
//ZM
|
||
private void mNEWASPToolStripMenuItem_Click(object sender, EventArgs e)
|
||
{
|
||
string text = "{$asp newaspect}\n {$aspdata newaspect author 1.0}\n{$endasp newaspect}";
|
||
ICSharpCode.TextEditor.TextArea ta = CurrentCodeFileDocument.TextEditor.ActiveTextAreaControl.TextArea;
|
||
ta.InsertString(text);
|
||
|
||
}
|
||
|
||
public void MakeTemplate()
|
||
{
|
||
string text = "{$asp declarations}\n {$aspdata declarations author 1.0}\n{$endasp declarations}\n \n{$asp classes}\n{$endasp classes}\n \n{$asp main}\nbegin\nend.\n{$endasp main}\n";
|
||
ICSharpCode.TextEditor.TextArea ta = CurrentCodeFileDocument.TextEditor.ActiveTextAreaControl.TextArea;
|
||
ta.InsertString(text);
|
||
}
|
||
|
||
public void SaveAspPlugin(CodeFileDocumentControl dc)
|
||
{
|
||
SaveSelFile(dc);
|
||
}
|
||
|
||
public void CloseAspPlugin(CodeFileDocumentControl dc)
|
||
{
|
||
CloseFile(dc);
|
||
}
|
||
|
||
private void mDOTNETHELPToolStripMenuItem_Click(object sender, EventArgs e)
|
||
{
|
||
OpenMSDN();
|
||
}
|
||
|
||
void ExecViewCode()
|
||
{
|
||
ExecuteDesignerCommand(StandardCommands.ViewCode);//roman//
|
||
}
|
||
private void cmViewCode_Click(object sender, EventArgs e)
|
||
{
|
||
ExecViewCode();
|
||
}
|
||
|
||
void ExecShowProperties()
|
||
{
|
||
ExecuteDesignerCommand(StandardCommands.PropertiesWindow);//roman//
|
||
}
|
||
private void cmiProperties_Click(object sender, EventArgs e)
|
||
{
|
||
ExecShowProperties();
|
||
}
|
||
|
||
private void miPrint_Click(object sender, EventArgs e)
|
||
{
|
||
ExecPrint();
|
||
}
|
||
|
||
private void tsFindAllReferences_Click(object sender, EventArgs e)
|
||
{
|
||
ExecFindReferences();
|
||
}
|
||
//end ZM
|
||
|
||
void ExecRunParameters()
|
||
{
|
||
RunArgumentsForm.CommandLineArguments = WorkbenchServiceFactory.RunService.GetRunArgument(this.CurrentCodeFileDocument.FileName.ToLower());
|
||
if (RunArgumentsForm.ShowDialog() == DialogResult.OK)
|
||
{
|
||
WorkbenchServiceFactory.RunService.AddRunArgument(this.CurrentCodeFileDocument.FileName.ToLower(), RunArgumentsForm.CommandLineArguments);
|
||
}
|
||
}
|
||
|
||
private void miProjectExplorer_Click(object sender, EventArgs e)
|
||
{
|
||
ProjectExplorerWindowVisible = true;
|
||
}
|
||
|
||
private void cmSamples_Click(object sender, EventArgs e)
|
||
{
|
||
|
||
}
|
||
|
||
private void cmHelp_Click(object sender, EventArgs e)
|
||
{
|
||
__showhelpinqueue();
|
||
}
|
||
|
||
private void tsHelp_Click(object sender, EventArgs e)
|
||
{
|
||
__showhelpinqueue();
|
||
}
|
||
|
||
private void cmEditor_Opening(object sender, CancelEventArgs e)
|
||
{
|
||
ICSharpCode.TextEditor.TextLocation cp = CurrentSyntaxEditor.TextEditor.ActiveTextAreaControl.Caret.Position;
|
||
ICSharpCode.TextEditor.Document.TextWord tw = CurrentSyntaxEditor.TextEditor.ActiveTextAreaControl.TextArea.Document.GetLineSegment(cp.Line).GetWord(cp.Column);
|
||
this.cmSamples.DropDownItems.Clear();
|
||
try
|
||
{
|
||
if (tw != null)
|
||
{
|
||
var header = sampleManager.GetSampleHeader(tw.Word);
|
||
if (header != null)
|
||
{
|
||
var samples = sampleManager.GetSamples(header);
|
||
foreach (string pattern in samples)
|
||
{
|
||
var files = Directory.GetFiles(HelpExamplesDirectory, pattern);
|
||
foreach (string file in files)
|
||
{
|
||
if (File.Exists(file))
|
||
{
|
||
var sample_mi = new ToolStripMenuItem();
|
||
sample_mi.Text = file.Replace(HelpExamplesDirectory + Path.DirectorySeparatorChar, "");
|
||
sample_mi.Click += delegate(object _sender, EventArgs _e)
|
||
{
|
||
VisualPascalABC.VisualPascalABCProgram.MainForm.Activate();
|
||
ExecuteVisualEnvironmentCompilerAction(VisualEnvironmentCompilerAction.OpenFile, file);
|
||
};
|
||
this.cmSamples.DropDownItems.Add(sample_mi);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
catch
|
||
{
|
||
|
||
}
|
||
this.cmSamples.Enabled = this.cmSamples.DropDownItems.Count > 0;
|
||
}
|
||
|
||
IWorkbenchServiceContainer VisualPascalABCPlugins.IWorkbench.ServiceContainer
|
||
{
|
||
get { return serviceContainer; }
|
||
}
|
||
|
||
}
|
||
|
||
}
|