* Refactor keywords managing to avoid repeating them twice * Fix build error * Fix string comparisons and null reference exception * Manage references in PascalABCLanguageInfo project * Fix inaccuracy in BaseKeywords.cs * Move ValidDirectives field to ILanguageInformation * Basic refactoring of GetPopupHintText + delete ampersend inserting * Delete other cases of ampersend inserting * Add check that we parsing PascalABC.NET in GetPopupHintText Временное решение, нужно будет вынести вторую попытку в интерфейс парсера. * Refactor CodeCompletionProvider (first iteration) * Extract shift space actions in separate class * Replace dollar service character in CodeCompletion by separate boolean (ctrlSpaceAfterDot)) * Refactor GetCompletionDataByFirst method * Fix GetCompletionDataByFirst behaviour when getting symInfos after uses keyword * Another iteration of refactoring in CodeCompletionProvider + comments * Update intellisense documentation * Fix build error * Fix encoding * Squashed commit of the following: commit7751fe7e75Author: samuraiGH <87191377+samuraiGH@users.noreply.github.com> Date: Sun Mar 16 13:28:03 2025 +0300 generating language res file at build time (#3252) commitd1fce63d69Author: Mikhalkovich Stanislav <miks@math.sfedu.ru> Date: Tue Mar 4 08:38:09 2025 +0300 Сборка после pr SDK commitd491e88aa7Author: samuraiGH <87191377+samuraiGH@users.noreply.github.com> Date: Mon Mar 3 20:34:51 2025 +0300 migration to new build system (#3241) * converting project files into sdk style * new build commands * adding new dll into nsis * removing unused .cs files commit1fd348ec3cAuthor: Mikhalkovich Stanislav <miks@math.sfedu.ru> Date: Sun Feb 23 20:49:26 2025 +0300 NSIS New 3.10 Ярлык в меню Пуск у всех пользователей commit80b7182dc1Author: Mikhalkovich Stanislav <miks@math.sfedu.ru> Date: Wed Feb 19 11:50:00 2025 +0300 _ in names commita2b078960bAuthor: Mikhalkovich Stanislav <miks@math.sfedu.ru> Date: Wed Feb 19 10:52:25 2025 +0300 cnfc2 commit58f26d469dAuthor: Mikhalkovich Stanislav <miks@math.sfedu.ru> Date: Tue Feb 18 22:28:13 2025 +0300 перекомпиляция 3.10.3.3611 commitb78a72977fAuthor: nevermind322 <81963698+nevermind322@users.noreply.github.com> Date: Tue Feb 18 22:02:19 2025 +0300 fix build on mono (#3249) * fix build on mono * remove local func * fix again commitc3557e388cAuthor: Nikolay Kuznetsov <adasoft@gmail.com> Date: Sat Feb 15 20:32:46 2025 +0300 Update GraphABC.pas (#3244) 1. Быстрая реализация функции FloodFill Для этого добавлена процедура BitmapFloodFill, которая вызывается из метода Picture.FloodFill и процедуры FloodFill 2.Добавлена поддержка LockDrawing/UnlockDrawing в процедуру FloodFill commit9dbac389e1Author: AlexanderZemlyak <92867056+AlexanderZemlyak@users.noreply.github.com> Date: Wed Feb 12 13:57:14 2025 +0300 Add missing projects to pabcnetc.sln (#3247) commit41dfb6f187Author: Mikhalkovich Stanislav <miks@math.sfedu.ru> Date: Fri Feb 7 21:41:01 2025 +0300 [] - преобразование во все контейнеры GraphABCHelper - теперь ABCObjects работает под Линукс School исправлен согласно последним веяниям [] commit79bbbd10ffAuthor: samuraiGH <87191377+samuraiGH@users.noreply.github.com> Date: Wed Jan 29 20:18:37 2025 +0300 removing files for support fx4.0 (#3240) commit88d5c409ebAuthor: samuraiGH <87191377+samuraiGH@users.noreply.github.com> Date: Tue Jan 28 20:41:55 2025 +0300 Рефакторинг PascalABCNET.xshd (#3237) * refactoring PascalABCNET.xshd * removing extra characters commit8fbd7fdfc3Author: Mikhalkovich Stanislav <miks@math.sfedu.ru> Date: Sun Jan 26 23:42:48 2025 +0300 3.10.3 faststrings EmptyCollection и преобразование ее в List, Dictionary t: (real,real) := (1,2) commitbba132bd5dAuthor: Mikhalkovich Stanislav <miks@math.sfedu.ru> Date: Wed Jan 22 09:14:44 2025 +0300 Поправил справку по функции commit1bd21857ccAuthor: Mikhalkovich Stanislav <miks@math.sfedu.ru> Date: Wed Jan 8 18:46:51 2025 +0300 Teacher Control Plugin - возможность задать server.dat commit0848a1b796Author: Mikhalkovich Stanislav <miks@math.sfedu.ru> Date: Sat Jan 4 22:54:38 2025 +0300 Исправление автоформатирования [] commitd45b782a7bAuthor: Mikhalkovich Stanislav <miks@math.sfedu.ru> Date: Sat Jan 4 18:45:07 2025 +0300 Rename PABCSistem in test suite commitc2347e604bAuthor: Mikhalkovich Stanislav <miks@math.sfedu.ru> Date: Sat Jan 4 14:44:51 2025 +0300 Примеры - устранил неточности LightPT - имя сервера вынес в публичную секцию commitb68b8da970Author: Mikhalkovich Stanislav <miks@math.sfedu.ru> Date: Tue Dec 17 15:52:18 2024 +0300 Примеры Coords1.pas Coords2.pas.pas commit8a9788e6f9Author: Mikhalkovich Stanislav <miks@math.sfedu.ru> Date: Tue Dec 17 15:06:57 2024 +0300 Перенес проверку set array на уровень парсера Немного поправил Intellisense по наведению для NewSet По точке там что то другое работает commit874ddebad3Author: Mikhalkovich Stanislav <miks@math.sfedu.ru> Date: Sat Dec 14 21:00:38 2024 +0300 Поправил грамматику [] Теперь нельзя в режиме ## использовать атрибуты Зато можно [1,2,3].Print commit080fb487e1Merge:a53dcd9eda484b0e82Author: Mikhalkovich Stanislav <miks@math.sfedu.ru> Date: Sat Dec 14 15:25:24 2024 +0300 Merge branch 'master' of https://github.com/pascalabcnet/pascalabcnet commita53dcd9ed2Author: Mikhalkovich Stanislav <miks@math.sfedu.ru> Date: Sat Dec 14 15:25:16 2024 +0300 SF Prm Cmb для строк commita484b0e82dAuthor: Sun Serega <sunserega2@gmail.com> Date: Thu Dec 12 13:49:17 2024 +0200 fix (#3231) commit6ef11f249cAuthor: Mikhalkovich Stanislav <miks@math.sfedu.ru> Date: Tue Dec 10 11:05:45 2024 +0300 3.10.2 commitdb9679d89fAuthor: Mikhalkovich Stanislav <miks@math.sfedu.ru> Date: Tue Dec 10 10:59:20 2024 +0300 Закончил превращение синтаксиса [] по умолчанию в массивы commit45fdde24b4Author: Ivan Bondarev <ibond84@googlemail.com> Date: Sun Dec 8 18:08:00 2024 +0100 #3229 commit494b47624dMerge:5875b99297906d73daAuthor: Ivan Bondarev <ibond84@googlemail.com> Date: Sun Dec 8 10:42:07 2024 +0100 Merge branch 'master' of https://github.com/pascalabcnet/pascalabcnet commit5875b99296Author: Ivan Bondarev <ibond84@googlemail.com> Date: Sun Dec 8 10:41:53 2024 +0100 platformtarget native - .NET 9.0 commit7906d73da3Author: Mikhalkovich Stanislav <miks@math.sfedu.ru> Date: Tue Dec 3 14:25:37 2024 +0300 Небольшие изменения в реализации операций с множествами commit087591c7b6Author: Mikhalkovich Stanislav <miks@math.sfedu.ru> Date: Wed Nov 27 11:37:07 2024 +0300 3.10.1 Coords - доработки Distance, Middle, DrawText с фоном и рамкой. Глобальные переменные настройки commitd268d4f83bAuthor: Mikhalkovich Stanislav <miks@math.sfedu.ru> Date: Thu Nov 21 22:24:07 2024 +0300 NSToBytes переделал с исключением commit2bacdc8c28Author: Mikhalkovich Stanislav <miks@math.sfedu.ru> Date: Wed Nov 20 13:20:33 2024 +0300 Комментарии к NewSet commite917ac8ecaAuthor: Mikhalkovich Stanislav <miks@math.sfedu.ru> Date: Wed Nov 20 12:42:15 2024 +0300 TypeName для set commit206289c6a7Author: Mikhalkovich Stanislav <miks@math.sfedu.ru> Date: Tue Nov 19 20:23:03 2024 +0300 Везде заменил _hs на hs в NewSet Убрал вызовы методов расширений NewSet в PABCSystem.pas Убрал var в operator + commitd8262078f6Author: Mikhalkovich Stanislav <miks@math.sfedu.ru> Date: Tue Nov 19 13:56:47 2024 +0300 Исправление мелких ошибок NewSet Все тесты проходят. Проблема, которая остаётся - в режиме ускорения такие программы падают: begin var s: set of byte; Print(s = [1]); end. Причина - из dll не вызывается конструктор записи без параметров, хотя он определён. В C# вообще у записей не может быть конструктора по умолчанию - наверное потому. Но для NewSet надо бы сделать исключение commitf8819665baAuthor: Mikhalkovich Stanislav <miks@math.sfedu.ru> Date: Sat Nov 16 10:56:11 2024 +0300 NS2 commit591d9ebe60Author: Ivan Bondarev <ibond84@googlemail.com> Date: Wed Nov 13 21:34:10 2024 +0100 fix commitc6505634f4Author: Ivan Bondarev <ibond84@googlemail.com> Date: Wed Nov 13 21:12:33 2024 +0100 fix commita6564df23cAuthor: Ivan Bondarev <ibond84@googlemail.com> Date: Wed Nov 13 20:52:29 2024 +0100 fix in new sets commit03be5bd931Author: Mikhalkovich Stanislav <miks@math.sfedu.ru> Date: Wed Nov 13 22:13:41 2024 +0300 Переставил operator:= в NewSet commit96c68f1666Author: Ivan Bondarev <ibond84@googlemail.com> Date: Tue Nov 12 21:38:07 2024 +0100 #3223 commit82776f3c77Author: Mikhalkovich Stanislav <miks@math.sfedu.ru> Date: Sat Nov 9 12:18:19 2024 +0300 NewSet - много мелких исправлений. Все тесты проходят кроме Tests 5 - видимо с pabcrtl.dll * Update comments in PascalABCLanguageInformation
250 lines
9.6 KiB
C#
250 lines
9.6 KiB
C#
// Copyright (c) Ivan Bondarev, Stanislav Mikhalkovich (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.Generic;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
using System.Drawing;
|
|
using ICSharpCode.TextEditor.Document;
|
|
|
|
namespace VisualPascalABC
|
|
{
|
|
public class CodeFileDocumentTextEditorControl : ICSharpCode.TextEditor.TextEditorControl, VisualPascalABCPlugins.ITextEditorControl
|
|
{
|
|
internal Form1 MainForm;
|
|
internal QuickClassBrowserPanel quickClassBrowserPanel;
|
|
internal Panel TextAreaPanel
|
|
{
|
|
get { return textAreaPanel; }
|
|
}
|
|
private Panel intellisensePanel;
|
|
public CodeFileDocumentTextEditorControl()
|
|
{
|
|
editactions[Keys.Space | Keys.Control] = new CodeCompletionAllNamesAction();
|
|
editactions[Keys.Space | Keys.Shift] = new CodeCompletionShiftSpaceActions();
|
|
editactions[Keys.Enter | Keys.Control] = new GotoAction();
|
|
editactions[Keys.LButton | Keys.Control] = new GotoAction();
|
|
editactions[Keys.C | Keys.Shift | Keys.Control] = new ClassOrMethodRealizationAction();
|
|
editactions[Keys.Space | Keys.Shift | Keys.Control] = new VirtualMethodsAction();
|
|
editactions[Keys.I | Keys.Shift | Keys.Control] = new GenerateMethodImplementationHeadersAction();
|
|
editactions[Keys.F5 | Keys.Control] = new AddToWatchAction();
|
|
editactions[Keys.F | Keys.Shift | Keys.Control] = new CodeFormattingAction();
|
|
editactions[Keys.Control | Keys.Y] = new ICSharpCode.TextEditor.Actions.DeleteLine();
|
|
editactions[Keys.Escape] = new HideBottomTabs();
|
|
quickClassBrowserPanel = new QuickClassBrowserPanel(this);
|
|
quickClassBrowserPanel.VisibleChanged += new EventHandler(quickClassBrowserPanel_VisibleChanged);
|
|
if (VisualPABCSingleton.MainForm != null)
|
|
{
|
|
quickClassBrowserPanel.Visible = VisualPABCSingleton.MainForm.UserOptions.ShowQuickClassBrowserPanel;
|
|
}
|
|
intellisensePanel = new Panel();
|
|
quickClassBrowserPanel_VisibleChanged(null, null);
|
|
intellisensePanel.Dock = DockStyle.Top;
|
|
intellisensePanel.Controls.Add(quickClassBrowserPanel);
|
|
intellisensePanel.Paint += new PaintEventHandler(separatorPanel_Paint);
|
|
Document.FoldingManager.FoldingStrategy = new ParserFoldingStrategy();
|
|
Controls.Add(intellisensePanel);
|
|
ActiveTextAreaControl.TextArea.Caret.PositionChanged += docPositionChanged;
|
|
this.ActiveTextAreaControl.TextArea.AllowDrop = true;
|
|
this.ActiveTextAreaControl.TextArea.DragEnter += textEditorDragEnter;
|
|
this.ActiveTextAreaControl.TextArea.DragDrop += textEditorDragDrop;
|
|
this.ActiveTextAreaControl.Document.LineDeleted += Document_LineDeleted;
|
|
}
|
|
|
|
private void Document_LineDeleted(object sender, LineEventArgs e)
|
|
{
|
|
/*for (int i = 0; i < e.LineSegment.Words.Count; i++)
|
|
{
|
|
if (e.LineSegment.Words[i].SyntaxColor != null && e.LineSegment.Words[i].SyntaxColor.Color.Name == "Green")
|
|
{
|
|
e.Document.HighlightingStrategy.MarkTokens(e.Document);
|
|
e.Document.RequestUpdate(new ICSharpCode.TextEditor.TextAreaUpdate(ICSharpCode.TextEditor.TextAreaUpdateType.WholeTextArea));
|
|
e.Document.CommitUpdate();
|
|
return;
|
|
}
|
|
}*/
|
|
}
|
|
|
|
public void MarkForImmediateWindow()
|
|
{
|
|
editactions[Keys.Space | Keys.Control] = null;
|
|
editactions[Keys.Space | Keys.Shift] = null;
|
|
editactions[Keys.Enter | Keys.Control] = null;
|
|
editactions[Keys.LButton | Keys.ControlKey] = null;
|
|
editactions[Keys.C | Keys.Shift | Keys.Control] = null;
|
|
editactions[Keys.Space | Keys.Shift | Keys.Control] = null;
|
|
editactions[Keys.I | Keys.Shift | Keys.Control] = null;
|
|
editactions[Keys.F5 | Keys.Control] = null;
|
|
editactions[Keys.Control | Keys.Y] = null;
|
|
editactions[Keys.Escape] = null;
|
|
quickClassBrowserPanel = null;
|
|
ActiveTextAreaControl.TextArea.Caret.PositionChanged -= docPositionChanged;
|
|
this.ActiveTextAreaControl.TextArea.DragEnter -= textEditorDragEnter;
|
|
this.ActiveTextAreaControl.TextArea.DragDrop -= textEditorDragDrop;
|
|
//this.Font = new Font(new FontFamily(Constants.CompletionWindowCodeCompletionListViewFontName),8.5f);
|
|
editactions[Keys.Enter] = new ImmediateEvaluateAction();
|
|
}
|
|
|
|
//internal int DownSeparatorHeight = 3;
|
|
internal int DownSeparatorHeight = 2;
|
|
|
|
delegate void invoke_delegate();
|
|
|
|
private void textEditorDragEnter(object sender, System.Windows.Forms.DragEventArgs e)
|
|
{
|
|
if (e.Data.GetDataPresent(DataFormats.FileDrop))
|
|
e.Effect = DragDropEffects.Copy;
|
|
else
|
|
e.Effect = DragDropEffects.None;
|
|
}
|
|
|
|
private void textEditorDragDrop(object sender, System.Windows.Forms.DragEventArgs e)
|
|
{
|
|
string[] file_name = e.Data.GetData(DataFormats.FileDrop) as string[];
|
|
if (file_name != null && file_name.Length>0)
|
|
{
|
|
if (string.Compare(System.IO.Path.GetExtension(file_name[0]),Constants.ProjectExtension,true)==0)
|
|
WorkbenchServiceFactory.ProjectService.OpenProject(file_name[0]);
|
|
else
|
|
WorkbenchServiceFactory.FileService.OpenFile(file_name[0], null);
|
|
}
|
|
}
|
|
|
|
private void refresh_Folding()
|
|
{
|
|
ActiveTextAreaControl.TextArea.Refresh(ActiveTextAreaControl.TextArea.FoldMargin);
|
|
}
|
|
|
|
public void UpdateFolding()
|
|
{
|
|
CodeCompletionParserController.open_files[this.FileName] = true;
|
|
}
|
|
|
|
public void CollapseRegions()
|
|
{
|
|
foreach (FoldMarker marker in Document.FoldingManager.FoldMarker)
|
|
{
|
|
if (marker is RegionFoldMarker && !marker.IsFolded)
|
|
marker.IsFolded = true;
|
|
}
|
|
refresh_Folding();
|
|
ActiveTextAreaControl.TextArea.Refresh();
|
|
refresh_Folding();
|
|
}
|
|
|
|
public void UpdateFolding(object parseInfo, string fileName)
|
|
{
|
|
try
|
|
{
|
|
if (EnableFolding && fileName == this.FileName)
|
|
{
|
|
Document.FoldingManager.UpdateFoldings(fileName, parseInfo);
|
|
ActiveTextAreaControl.TextArea.Invoke(new invoke_delegate(refresh_Folding));
|
|
}
|
|
}
|
|
catch
|
|
{
|
|
|
|
}
|
|
}
|
|
|
|
void quickClassBrowserPanel_VisibleChanged(object sender, EventArgs e)
|
|
{
|
|
if(quickClassBrowserPanel.Visible)
|
|
intellisensePanel.Size = new Size(1, quickClassBrowserPanel.Height + DownSeparatorHeight);
|
|
else
|
|
intellisensePanel.Size = new Size(1, DownSeparatorHeight);
|
|
}
|
|
|
|
void separatorPanel_Paint(object sender, PaintEventArgs e)
|
|
{
|
|
//e.Graphics.DrawLine(new Pen(SystemColors.ControlDark, 0.1F), 0, intellisensePanel.Height - 3, intellisensePanel.Width, intellisensePanel.Height - 3);
|
|
e.Graphics.DrawLine(new Pen(SystemColors.ControlDark, 0.1F), 0, intellisensePanel.Height - 1, intellisensePanel.Width, intellisensePanel.Height - 1);
|
|
}
|
|
void docPositionChanged(object sender, EventArgs e)
|
|
{
|
|
ErrorLineBookmark.Remove();
|
|
RuntimeErrorBookmark.Remove();
|
|
}
|
|
|
|
public void SetFocus()
|
|
{
|
|
this.ActiveTextAreaControl.TextArea.Focus();
|
|
}
|
|
|
|
public int CaretLine
|
|
{
|
|
get
|
|
{
|
|
return this.ActiveTextAreaControl.Caret.Line;
|
|
}
|
|
set
|
|
{
|
|
this.ActiveTextAreaControl.Caret.Line = value;
|
|
}
|
|
}
|
|
|
|
public int CaretColumn
|
|
{
|
|
get
|
|
{
|
|
return this.ActiveTextAreaControl.Caret.Column;
|
|
}
|
|
set
|
|
{
|
|
this.ActiveTextAreaControl.Caret.Column = value;
|
|
}
|
|
}
|
|
|
|
public void AddToolTipRequestHandler(ICSharpCode.TextEditor.ToolTipRequestEventHandler handler)
|
|
{
|
|
this.ActiveTextAreaControl.TextArea.ToolTipRequest += handler;
|
|
}
|
|
|
|
public void AddMouseMoveHandler(MouseEventHandler handler)
|
|
{
|
|
this.ActiveTextAreaControl.TextArea.MouseMove += handler;
|
|
}
|
|
|
|
public void AddKeyDownHandler(KeyEventHandler handler)
|
|
{
|
|
this.ActiveTextAreaControl.TextArea.KeyDown += handler;
|
|
}
|
|
|
|
public void AddMouseWheelHandler(MouseEventHandler handler)
|
|
{
|
|
this.ActiveTextAreaControl.TextArea.MouseWheel += handler;
|
|
}
|
|
|
|
public void AddMouseDownHandler(MouseEventHandler handler)
|
|
{
|
|
this.ActiveTextAreaControl.TextArea.MouseDown += handler;
|
|
}
|
|
|
|
public void RemoveToolTipRequestHandler(ICSharpCode.TextEditor.ToolTipRequestEventHandler handler)
|
|
{
|
|
this.ActiveTextAreaControl.TextArea.ToolTipRequest -= handler;
|
|
}
|
|
|
|
public void RemoveMouseMoveHandler(MouseEventHandler handler)
|
|
{
|
|
this.ActiveTextAreaControl.TextArea.MouseMove -= handler;
|
|
}
|
|
|
|
public void RemoveKeyDownHandler(KeyEventHandler handler)
|
|
{
|
|
this.ActiveTextAreaControl.TextArea.KeyDown -= handler;
|
|
}
|
|
|
|
public void RemoveMouseWheelHandler(MouseEventHandler handler)
|
|
{
|
|
this.ActiveTextAreaControl.TextArea.MouseWheel -= handler;
|
|
}
|
|
|
|
public void RemoveMouseDownHandler(MouseEventHandler handler)
|
|
{
|
|
this.ActiveTextAreaControl.TextArea.MouseDown -= handler;
|
|
}
|
|
}
|
|
}
|