Clamp стандартный метод расширения для чисел

Позиционировнаие курсора после Task в PT4
This commit is contained in:
Mikhalkovich Stanislav 2019-11-09 11:38:30 +03:00
parent 6ac37be569
commit e5770f6f64
15 changed files with 144 additions and 6 deletions

View file

@ -15,7 +15,7 @@ internal static class RevisionClass
public const string Major = "3";
public const string Minor = "5";
public const string Build = "1";
public const string Revision = "2260";
public const string Revision = "2265";
public const string MainVersion = Major + "." + Minor;
public const string FullVersion = Major + "." + Minor + "." + Build + "." + Revision;

View file

@ -1,4 +1,4 @@
%COREVERSION%=1
%REVISION%=2260
%MINOR%=5
%REVISION%=2265
%COREVERSION%=1
%MAJOR%=3

View file

@ -88,7 +88,8 @@ namespace VisualPascalABCPlugins
SaveFile,
BuildUnit,
AddMessageToErrorListWindow,
SetCurrentSourceFileTextFormatting
SetCurrentSourceFileTextFormatting,
PT4PositionCursorAfterTask
}
public delegate IAsyncResult InvokeDegegate(Delegate method, params object[] args);

View file

@ -1 +1 @@
3.5.1.2260
3.5.1.2265

View file

@ -1 +1 @@
!define VERSION '3.5.1.2260'
!define VERSION '3.5.1.2265'

View file

@ -41,6 +41,8 @@ type
GWindow = System.Windows.Window;
GPen = System.Windows.Media.Pen;
/// Тип точки
Point = System.Windows.Point;
/// Тип точки
GPoint = System.Windows.Point;
GBrush = System.Windows.Media.Brush;
/// Тип стиля шрифта

View file

@ -10556,6 +10556,32 @@ begin
Result := Range(0, Self - 1);
end;
/// Возвращает число, ограниченное диапазоном от bottom до top включительно
function Clamp(Self: integer; bottom,top: integer): integer; extensionmethod;
begin
if Self < bottom then
Result := bottom
else if Self > top then
Result := top
else Result := Self;
end;
/// Возвращает число, ограниченное величиной top сверху
function ClampTop(Self: integer; top: integer): integer; extensionmethod;
begin
if Self > top then
Result := top
else Result := Self;
end;
/// Возвращает число, ограниченное величиной bottom снизу
function Clamp(Self: integer; bottom: integer): integer; extensionmethod;
begin
if Self < bottom then
Result := bottom
else Result := Self;
end;
// -----------------------------------------------------
//>> Методы расширения типа BigInteger # Extension methods for BigInteger
// -----------------------------------------------------
@ -10632,6 +10658,32 @@ begin
Result := Format('{0:f' + frac + '}', Self)
end;
/// Возвращает число, ограниченное диапазоном от bottom до top включительно
function Clamp(Self: real; bottom,top: real): real; extensionmethod;
begin
if Self < bottom then
Result := bottom
else if Self > top then
Result := top
else Result := Self;
end;
/// Возвращает число, ограниченное величиной top сверху
function ClampTop(Self: real; top: real): real; extensionmethod;
begin
if Self > top then
Result := top
else Result := Self;
end;
/// Возвращает число, ограниченное величиной bottom снизу
function Clamp(Self: real; bottom: real): real; extensionmethod;
begin
if Self < bottom then
Result := bottom
else Result := Self;
end;
//------------------------------------------------------------------------------
//>> Методы расширения типа char # Extension methods for char

View file

@ -43,6 +43,8 @@ type
/// Тип размера
GSize = System.Windows.Size;
/// Тип точки
Point = System.Windows.Point;
/// Тип точки
GPoint = System.Windows.Point;
/// Тип окна
GWindow = System.Windows.Window;

View file

@ -608,6 +608,23 @@ namespace VisualPascalABC
if (s != null)
return s;
return WorkbenchStorage.StandartDirectories[(string)obj] as string;
case VisualEnvironmentCompilerAction.PT4PositionCursorAfterTask: // SSM 09.11.19
{
var ta = CurrentCodeFileDocument.TextEditor.ActiveTextAreaControl.TextArea;
var d = ta.Document;
for (var i = 0; i<d.TotalNumberOfLines; i++)
{
var line = ICSharpCode.TextEditor.Document.TextUtilities.GetLineAsString(d, i);
if (line.Equals(" "))
{
var p = 1;
ta.Caret.Line = i;
ta.Caret.Column = 2;
return true;
}
}
return true;
}
case VisualEnvironmentCompilerAction.GetCurrentSourceFileName:
return CurrentSourceFileName;
case VisualEnvironmentCompilerAction.SetCurrentSourceFileTextFormatting:

View file

@ -346,6 +346,12 @@ namespace VisualPascalABC
if (si.TextEditor.quickClassBrowserPanel.Visible != UserOptions.ShowQuickClassBrowserPanel)
si.TextEditor.quickClassBrowserPanel.Visible = UserOptions.ShowQuickClassBrowserPanel;
}
foreach (var rtb in this.OutputTextBoxs.Values)
{
rtb.Font = OpenDocuments.Values.First().TextEditor.Font;
}
tsViewIntellisensePanel.Checked = UserOptions.ShowQuickClassBrowserPanel;
tsViewIntellisensePanel.Visible = tssmIntellisence.Visible = tsGotoDefinition.Visible = tsGotoRealization.Visible =
tsFindAllReferences.Visible = miGenerateRealization.Visible =

View file

@ -193,6 +193,7 @@ namespace VisualPascalABC
if (OpenDocuments.Count > 0)
tb = CopyTextBox(OutputWindow.outputTextBox);
AddWindowToDockPanel(tp, tabControl, tp.Dock != dockStyle?dockStyle:tp.Dock, DockState.Document, tp.IsFloat, null, 0);
tb.Font = tp.TextEditor.Font;
OutputTextBoxs.Add(tp, tb);
WorkbenchServiceFactory.CodeCompletionParserController.ParseInformationUpdated += tp.TextEditor.UpdateFolding;

View file

@ -125,6 +125,7 @@ namespace VisualPascalABCPlugins
if (i < 1 || filename.ToString() == "")
return;*/
VisualEnvironmentCompiler.ExecuteAction(VisualEnvironmentCompilerAction.OpenFile, filename.ToString());
VisualEnvironmentCompiler.ExecuteAction(VisualEnvironmentCompilerAction.PT4PositionCursorAfterTask, null);
}
public void ExecuteB_R()
{

View file

@ -41,6 +41,8 @@ type
GWindow = System.Windows.Window;
GPen = System.Windows.Media.Pen;
/// Тип точки
Point = System.Windows.Point;
/// Тип точки
GPoint = System.Windows.Point;
GBrush = System.Windows.Media.Brush;
/// Тип стиля шрифта

View file

@ -10556,6 +10556,32 @@ begin
Result := Range(0, Self - 1);
end;
/// Возвращает число, ограниченное диапазоном от bottom до top включительно
function Clamp(Self: integer; bottom,top: integer): integer; extensionmethod;
begin
if Self < bottom then
Result := bottom
else if Self > top then
Result := top
else Result := Self;
end;
/// Возвращает число, ограниченное величиной top сверху
function ClampTop(Self: integer; top: integer): integer; extensionmethod;
begin
if Self > top then
Result := top
else Result := Self;
end;
/// Возвращает число, ограниченное величиной bottom снизу
function Clamp(Self: integer; bottom: integer): integer; extensionmethod;
begin
if Self < bottom then
Result := bottom
else Result := Self;
end;
// -----------------------------------------------------
//>> Методы расширения типа BigInteger # Extension methods for BigInteger
// -----------------------------------------------------
@ -10632,6 +10658,32 @@ begin
Result := Format('{0:f' + frac + '}', Self)
end;
/// Возвращает число, ограниченное диапазоном от bottom до top включительно
function Clamp(Self: real; bottom,top: real): real; extensionmethod;
begin
if Self < bottom then
Result := bottom
else if Self > top then
Result := top
else Result := Self;
end;
/// Возвращает число, ограниченное величиной top сверху
function ClampTop(Self: real; top: real): real; extensionmethod;
begin
if Self > top then
Result := top
else Result := Self;
end;
/// Возвращает число, ограниченное величиной bottom снизу
function Clamp(Self: real; bottom: real): real; extensionmethod;
begin
if Self < bottom then
Result := bottom
else Result := Self;
end;
//------------------------------------------------------------------------------
//>> Методы расширения типа char # Extension methods for char

View file

@ -43,6 +43,8 @@ type
/// Тип размера
GSize = System.Windows.Size;
/// Тип точки
Point = System.Windows.Point;
/// Тип точки
GPoint = System.Windows.Point;
/// Тип окна
GWindow = System.Windows.Window;