Skip to content

Commit 3ce8e64

Browse files
authored
Merge branch 'master' into fix/sp-2291-zip-file-size
2 parents 6026f0d + e715027 commit 3ce8e64

File tree

3 files changed

+34
-7
lines changed

3 files changed

+34
-7
lines changed

SIL.Windows.Forms.Scripture/VerseControl.Designer.cs

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

SIL.Windows.Forms.Scripture/VerseControl.cs

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -562,17 +562,32 @@ void CalcFieldWidths(Graphics g)
562562
void DrawBookParts(string[] parts, Graphics gr, Rectangle bounds, Color theColor, Font font1, Font font2)
563563
{
564564
Font theFont = font1;
565+
int right = bounds.Right;
566+
bool rtl = RightToLeft == RightToLeft.Yes;
567+
if (!rtl)
568+
bounds.X += 2;
569+
bounds.Width -= 2;
565570
for (int i = 0; i < parts.Length; i++)
566571
{
567572
string theText = parts[i];
568573
if (i == 2)
569-
bounds.X = (int)abbreviationWidth; // tab over to name column
574+
{
575+
if (rtl)
576+
bounds.Width = right - (int)abbreviationWidth;
577+
else
578+
bounds.X = (int)abbreviationWidth; // tab over to name column
579+
}
580+
570581
if (theText != "")
571582
{
572583
// UserControl does not have UseCompatibleTextRendering.
573-
var size = TextRenderer.MeasureText(gr, theText, theFont, bounds.Size, TextFormatFlags.NoPadding|TextFormatFlags.WordBreak);
574-
TextRenderer.DrawText(gr, theText, theFont, bounds, theColor, TextFormatFlags.NoPadding|TextFormatFlags.WordBreak);
575-
bounds.X += size.Width;
584+
TextFormatFlags flags = TextFormatFlags.NoPadding | TextFormatFlags.SingleLine;
585+
if (rtl)
586+
flags |= TextFormatFlags.Right;
587+
var size = TextRenderer.MeasureText(gr, theText, theFont, bounds.Size, flags);
588+
TextRenderer.DrawText(gr, theText, theFont, bounds, theColor, flags);
589+
if (!rtl)
590+
bounds.X += size.Width;
576591
bounds.Width -= size.Width;
577592
}
578593
theFont = Equals(theFont, font1) ? font2 : font1; // flip-flop font

SIL.Windows.Forms/Widgets/HorizontalSpinner.cs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using System.Drawing;
33
using System.Drawing.Drawing2D;
44
using System.Windows.Forms;
@@ -144,9 +144,19 @@ protected override void OnMouseDown(MouseEventArgs e)
144144
RightState = SpinnerState.Pushed;
145145

146146
if (leftBounds.Contains(e.Location))
147-
OnDecrement();
147+
{
148+
if (RightToLeft == RightToLeft.No)
149+
OnDecrement();
150+
else
151+
OnIncrement();
152+
}
148153
else if (rightBounds.Contains(e.Location))
149-
OnIncrement();
154+
{
155+
if (RightToLeft == RightToLeft.No)
156+
OnIncrement();
157+
else
158+
OnDecrement();
159+
}
150160
}
151161

152162
protected override void OnMouseUp(MouseEventArgs e)

0 commit comments

Comments
 (0)