Skip to content

Commit

Permalink
v4.2.0 - Preview-4.5
Browse files Browse the repository at this point in the history
issue : #109
  • Loading branch information
FRACerqueira authored Oct 26, 2023
2 parents bf62152 + eeef11a commit 440ed4a
Show file tree
Hide file tree
Showing 22 changed files with 1,498 additions and 988 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@
- Edit[F2] Immutable item in AddTolist/AddtoMaskEditList control
- Fixed bug :
- CTRL-V (paste data) does not show input in some controls
- Fixed bug :
- Refinement of Unicode symbol rendering in all controls (Corret render)

## Features
[**Top**](#table-of-contents)
Expand Down
13 changes: 12 additions & 1 deletion Samples/CalendarSamples/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,17 @@
PromptPlus.WriteLine($"You input is {cld.Value}");
}

var typelayout = Enum.GetValues(typeof(CalendarLayout));
foreach (var type in typelayout)
{
PromptPlus.DoubleDash($"Control:Calendar ({cult.Name}) - layout {type}");
PromptPlus
.Calendar("Date", "Select date")
.Layout((CalendarLayout)Enum.Parse(typeof(CalendarLayout), type.ToString()!))
.Run();
}


PromptPlus.DoubleDash($"Control:Calendar DateTime - with overwrite culture:pt-br.");

cld = PromptPlus
Expand All @@ -44,7 +55,7 @@

PromptPlus
.Calendar("Date", "Select date")
.Layout(CalendarLayout.HeavyGrid)
.Layout(CalendarLayout.SingleGrid)
.DisabledWeekends()
.Run();

Expand Down
5 changes: 5 additions & 0 deletions Src/Controls/BaseOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,11 @@ internal string Symbol(SymbolType schema)
{
return _optSymbols[schema].unicode;
}
return SymbolUnSupported(schema);
}

internal string SymbolUnSupported(SymbolType schema)
{
return _optSymbols[schema].value;
}

Expand Down
492 changes: 55 additions & 437 deletions Src/Controls/Calendar/CalendarControl.cs

Large diffs are not rendered by default.

6 changes: 1 addition & 5 deletions Src/Controls/Calendar/CalendarLayout.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@ public enum CalendarLayout
/// <summary>
/// Acsii double grid
/// </summary>
AsciiDoubleGrid,
/// <summary>
/// Heavy line grid
/// </summary>
HeavyGrid
AsciiDoubleGrid
}
}
72 changes: 12 additions & 60 deletions Src/Controls/Chart/ChartBarControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -564,43 +564,19 @@ private void WriteStandBar(ScreenBuffer screenBuffer,ChartBarType barType,int in
}
}
var maxlengthlabel = _options.Labels.Max(x => x.Label.Length);
char charbarOn = ' ';
char barOn = ' ';
switch (barType)
{
case ChartBarType.Fill:
{
if (!ConsolePlus.IsUnicodeSupported)
{
charbarOn = _options.CharBar;
}
}
break;
case ChartBarType.Light:
{
charbarOn = '─';
if (!ConsolePlus.IsUnicodeSupported)
{
charbarOn = '-';
}
}
barOn = _options.Symbol(SymbolType.ChartLight)[0];
break;
case ChartBarType.Heavy:
{
charbarOn = '━';
if (!ConsolePlus.IsUnicodeSupported)
{
charbarOn = '=';
}
}
barOn = _options.Symbol(SymbolType.ChartHeavy)[0];
break;
case ChartBarType.Square:
{
charbarOn = '■';
if (!ConsolePlus.IsUnicodeSupported)
{
charbarOn = _options.CharBar;
}
}
barOn = _options.Symbol(SymbolType.ChartSquare)[0];
break;
default:
throw new PromptPlusException($"Not implemented {barType}");
Expand Down Expand Up @@ -638,13 +614,13 @@ private void WriteStandBar(ScreenBuffer screenBuffer,ChartBarType barType,int in
}
if (_options.CurrentShowLegend)
{
screenBuffer.AddBuffer(new string(charbarOn, tkt), OnStyle, false, true);
screenBuffer.AddBuffer(new string(barOn, tkt), OnStyle, false, true);
}
else
{
screenBuffer.AddBuffer(item.Label.PadRight(maxlengthlabel) , _options.StyleContent(ChartStyles.ChartLabel));
screenBuffer.AddBuffer(": ",Style.Default, false, false);
screenBuffer.AddBuffer(new string(charbarOn, tkt), OnStyle, false, true);
screenBuffer.AddBuffer(new string(barOn, tkt), OnStyle, false, true);
}
if (!_options.HideValueBar)
{
Expand All @@ -668,7 +644,7 @@ private void WriteStandBar(ScreenBuffer screenBuffer,ChartBarType barType,int in

private void WriteStackBar(ScreenBuffer screenBuffer, ChartBarType barType, double ticketStep)
{
char charbarOn = ' ';
char barOn = ' ';
if (!_options.OptMinimalRender)
{
if (!(string.IsNullOrEmpty(_options.OptPrompt) && string.IsNullOrEmpty(_options.OptDescription)))
Expand All @@ -683,39 +659,15 @@ private void WriteStackBar(ScreenBuffer screenBuffer, ChartBarType barType, doub
switch (barType)
{
case ChartBarType.Fill:
{
if (!ConsolePlus.IsUnicodeSupported)
{
charbarOn = _options.CharBar;
}
}
break;
case ChartBarType.Light:
{
charbarOn = '─';
if (!ConsolePlus.IsUnicodeSupported)
{
charbarOn = '-';
}
}
barOn = _options.Symbol(SymbolType.ChartLight)[0];
break;
case ChartBarType.Heavy:
{
charbarOn = '━';
if (!ConsolePlus.IsUnicodeSupported)
{
charbarOn = '=';
}
}
barOn = _options.Symbol(SymbolType.ChartHeavy)[0];
break;
case ChartBarType.Square:
{
charbarOn = '■';
if (!ConsolePlus.IsUnicodeSupported)
{
charbarOn = _options.CharBar;
}
}
barOn = _options.Symbol(SymbolType.ChartSquare)[0];
break;
default:
throw new PromptPlusException($"Not implemented {barType}");
Expand All @@ -741,7 +693,7 @@ private void WriteStackBar(ScreenBuffer screenBuffer, ChartBarType barType, doub
tkt = 1;
}
}
screenBuffer.AddBuffer(new string(charbarOn, tkt), OnStyle, false, true);
screenBuffer.AddBuffer(new string(barOn, tkt), OnStyle, false, true);
}
}

Expand All @@ -766,7 +718,7 @@ private void WriteLegends(ScreenBuffer screenBuffer,int inipos)
foreach (var item in _options.Labels.Skip(inipos).Take(pagesize))
{
screenBuffer.NewLine();
screenBuffer.AddBuffer("", _options.StyleContent(StyleControls.ChartLabel).Foreground(item.ColorBar.Value), false, false);
screenBuffer.AddBuffer(_options.Symbol(SymbolType.ChartLabel), _options.StyleContent(StyleControls.ChartLabel).Foreground(item.ColorBar.Value), false, false);
screenBuffer.AddBuffer(" ", _options.StyleContent(StyleControls.ChartLabel), false, false);
screenBuffer.AddBuffer($"{item.Label.PadRight(maxlengthlabel)}", _options.StyleContent(StyleControls.ChartLabel));
if (_options.ShowLegendValue || _options.ShowLegendPercent)
Expand Down
Loading

0 comments on commit 440ed4a

Please sign in to comment.