Skip to content

Commit

Permalink
#21 option to remove ellipses
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonyCorbett committed Jan 10, 2019
1 parent 49be979 commit acb9f5c
Show file tree
Hide file tree
Showing 9 changed files with 61 additions and 5 deletions.
15 changes: 12 additions & 3 deletions OnlyV.ImageCreation/BibleTextImage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ public BibleTextImage()
FlowDirection = FlowDirection.LeftToRight;
AllowAutoFit = true;
ShowBreakInVerses = true;

UseContinuationEllipses = true;

TitleDropShadow = true;
TitleDropShadowColor = Colors.Black;
TitleDropShadowOpacity = 0.5;
Expand Down Expand Up @@ -151,6 +152,8 @@ public Color BackgroundColor
public bool AllowAutoFit { get; set; }

public bool ShowBreakInVerses { get; set; }

public bool UseContinuationEllipses { get; set; }

public bool UseTildeParaSeparator { get; set; }

Expand Down Expand Up @@ -491,13 +494,19 @@ private DrawingVisual DrawBody(
{
var lineStr = linesForBmp[lineNum];

if (lineNum == 0 && lineStr.Length > 0 && !IsEndOfSentenceOrPhrase(linesForPreviousBmp?.LastOrDefault()))
if (UseContinuationEllipses &&
lineNum == 0 &&
lineStr.Length > 0 &&
!IsEndOfSentenceOrPhrase(linesForPreviousBmp?.LastOrDefault()))
{
// ellipsis at start of this line...
lineStr = string.Concat(Ellipsis, lineStr);
}

if (lineNum == linesForBmp.Length - 1 && moreImagesAfterThis && !IsEndOfSentenceOrPhrase(lineStr))
if (UseContinuationEllipses &&
lineNum == linesForBmp.Length - 1 &&
moreImagesAfterThis &&
!IsEndOfSentenceOrPhrase(lineStr))
{
// ellipsis at the end of the last line (if appropriate)...
lineStr = string.Concat(lineStr, Ellipsis);
Expand Down
4 changes: 3 additions & 1 deletion OnlyV/AppOptions/Options.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ public Options()
AutoFit = true;
ShowVerseBreaks = true;
UseTildeMarker = true;
ShowVerseBreaks = true;
TextScalingPercentage = 100;
UseContinuationEllipses = true;

Sanitize();
}
Expand Down Expand Up @@ -56,6 +56,8 @@ public Options()

public bool SpaceBetweenTitleVerseNumbers { get; set; }

public bool UseContinuationEllipses { get; set; }

/// <summary>
/// Validates the data, correcting automatically as required
/// </summary>
Expand Down
4 changes: 4 additions & 0 deletions OnlyV/Pages/SettingsPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,10 @@
<CheckBox IsChecked="{Binding SpaceBetweenTitleVerseNumbers, Mode=TwoWay}"
Content="{x:Static resx:Resources.TITLE_VERSE_NOS}"
Style="{StaticResource SettingsCheckBoxStyle}"/>

<CheckBox IsChecked="{Binding ShowEllipsesForContinuation, Mode=TwoWay}"
Content="{x:Static resx:Resources.ELLIPSIS_CONTINUATION}"
Style="{StaticResource SettingsCheckBoxStyle}"/>
</StackPanel>
</GroupBox>

Expand Down
9 changes: 9 additions & 0 deletions OnlyV/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions OnlyV/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -375,4 +375,7 @@
<data name="TITLE_VERSE_NOS" xml:space="preserve">
<value>Space between title verse numbers</value>
</data>
<data name="ELLIPSIS_CONTINUATION" xml:space="preserve">
<value>Show ellipses for continuation</value>
</data>
</root>
3 changes: 2 additions & 1 deletion OnlyV/Services/Images/ImagesService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,11 @@ private void ApplyFormatting(
// formatting...
bibleTextImage.AllowAutoFit = _optionsService.AutoFit;
bibleTextImage.ShowBreakInVerses = _optionsService.ShowVerseBreaks;
bibleTextImage.UseContinuationEllipses = _optionsService.UseContinuationEllipses;
bibleTextImage.UseTildeParaSeparator = _optionsService.UseTildeMarker;
bibleTextImage.TrimPunctuation = _optionsService.TrimPunctuation;
bibleTextImage.TrimQuotes = _optionsService.TrimQuotes;

// body text...
bibleTextImage.MainFont.FontFamily = new FontFamily(theme.BodyText.Font.Family);
bibleTextImage.MainFont.FontSize = AdaptToScaling(theme.BodyText.Font.Size);
Expand Down
2 changes: 2 additions & 0 deletions OnlyV/Services/Options/IOptionsService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ internal interface IOptionsService

bool ShowVerseBreaks { get; set; }

bool UseContinuationEllipses { get; set; }

bool UseTildeMarker { get; set; }

bool TrimPunctuation { get; set; }
Expand Down
13 changes: 13 additions & 0 deletions OnlyV/Services/Options/OptionsService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,19 @@ public bool ShowVerseBreaks
}
}
}

public bool UseContinuationEllipses
{
get => _options.UseContinuationEllipses;
set
{
if (_options.UseContinuationEllipses != value)
{
_options.UseContinuationEllipses = value;
StyleChangedEvent?.Invoke(this, EventArgs.Empty);
}
}
}

public bool UseTildeMarker
{
Expand Down
13 changes: 13 additions & 0 deletions OnlyV/ViewModel/SettingsViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,19 @@ public bool SpaceBetweenTitleVerseNumbers
}
}
}

public bool ShowEllipsesForContinuation
{
get => _optionsService.UseContinuationEllipses;
set
{
if (_optionsService.UseContinuationEllipses != value)
{
_optionsService.UseContinuationEllipses = value;
RaisePropertyChanged();
}
}
}

public IEnumerable<LoggingLevel> LoggingLevels => _loggingLevels;

Expand Down

0 comments on commit acb9f5c

Please sign in to comment.