Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 22 additions & 13 deletions src/Capture/ScrollCapture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -871,7 +871,7 @@ public ScrollCaptureBar(ScrollSession session, Rectangle area)
Screen scr = Screen.FromRectangle(area);
s = ShotStack.ScaleFor(scr);
Pad = P(22);
Size sz = new Size(P(480), P(48));
Size sz = new Size(P(BarWidth), P(48));
Rectangle wa = scr.WorkingArea;
int x = area.X + (area.Width - sz.Width) / 2;
int y = area.Bottom + P(14);
Expand Down Expand Up @@ -903,28 +903,37 @@ public void Poll()
Redraw();
}

string State()
string State() { return StateText(saving, session.EscArmed, session.DoneArmed, session.Full, session.WentUp, session.Losing, hot, session.Auto, session.Stuck); }

// The status line, in the order that decides which of them is shown. It has StatusRoom pixels (before scaling) in
// one line: a text any longer is cut with an ellipsis.
internal static string StateText(bool saving, bool escArmed, bool doneArmed, bool full, bool wentUp, bool losing, int hot, bool auto, bool stuck)
{
if (saving) return I18n.T("Componiendo\u2026", "Composing\u2026");
if (session.EscArmed) return I18n.T("Esc otra vez para descartar", "Esc again to discard");
if (session.DoneArmed) return I18n.T("No has bajado \u00B7 Listo otra vez la guarda", "You haven't scrolled \u00B7 Done again saves it");
if (session.Full) return I18n.T("Altura m\u00E1xima", "Maximum height");
if (session.WentUp) return I18n.T("Solo hacia abajo", "Downward only");
if (session.Losing) return I18n.T("M\u00E1s despacio", "Slow down");
if (escArmed) return I18n.T("Esc otra vez para descartar", "Esc again to discard");
if (doneArmed) return I18n.T("No has bajado \u00B7 Listo otra vez la guarda", "You haven't scrolled \u00B7 Done again saves it");
if (full) return I18n.T("Altura m\u00E1xima", "Maximum height");
if (wentUp) return I18n.T("Solo hacia abajo", "Downward only");
if (losing) return I18n.T("M\u00E1s despacio", "Slow down");
// What the button under the mouse does.
if (hot == 0) return session.Auto ? I18n.T("Pausa: paro y sigues t\u00FA con la rueda", "Pause: stop and continue scrolling with wheel") : I18n.T("Auto: bajo yo solo, poco a poco", "Auto: scroll automatically");
if (hot == 0) return auto ? I18n.T("Pausa: paro y sigues t\u00FA con la rueda", "Pause: stop and scroll with the wheel") : I18n.T("Auto: bajo yo solo, poco a poco", "Auto: scroll automatically");
if (hot == 1) return I18n.T("Listo: guarda la captura (Enter)", "Done: save capture (Enter)");
if (hot == 2) return I18n.T("Cancela sin guardar (Esc)", "Cancel without saving (Esc)");
if (session.Auto) return I18n.T("Bajando solo\u2026", "Scrolling down\u2026");
if (session.Stuck) return I18n.T("\u00BFNo baja? Pulsa Auto", "Not scrolling? Click Auto");
if (auto) return I18n.T("Bajando solo\u2026", "Scrolling down\u2026");
if (stuck) return I18n.T("\u00BFNo baja? Pulsa Auto", "Not scrolling? Click Auto");
return I18n.T("Baja con la rueda \u00B7 Enter termina", "Scroll with wheel \u00B7 Enter to finish");
}

// The room of the text beside the badge and before the buttons, at 100 % (the bar is BarWidth wide).
internal const int BarWidth = 480, StatusRoom = BarWidth - 50 - 8 - 6 - 64 - 78 - 40;

// "2,5 pantallas · 2.140 px": how far it has gone, in screens of the area.
string HeightText(int h)
string HeightText(int h) { return HeightText(h, session.AreaHeight); }

internal static string HeightText(int h, int areaHeight)
{
if (h <= 0) return I18n.T("Preparando\u2026", "Preparing\u2026");
double screens = (double)h / Math.Max(1, session.AreaHeight);
double screens = (double)h / Math.Max(1, areaHeight);
string sc = screens < 1.05 ? I18n.T("1 pantalla", "1 screen") : screens.ToString("0.#", I18n.Culture) + I18n.T(" pantallas", " screens");
return sc + " \u00B7 " + h.ToString("N0", I18n.Culture) + " px";
}
Expand Down Expand Up @@ -966,7 +975,7 @@ protected override void PaintSurface(System.Windows.Media.DrawingContext dc, int
double gs = P(16);
Glyph.Draw(dc, "down", ic.X + (ic.Width - gs) / 2, cy - gs / 2 + P(1), gs, Palette.OnHudFill(white), Math.Max(1.6, 2 * s));

int tx = P(50), tw = AutoRect().X - tx - P(8);
int tx = P(50), tw = AutoRect().X - tx - P(8); // StatusRoom at 100 %
string hs = HeightText(shownHeight);
System.Windows.Media.FormattedText ht = Line(hs, Ds.Semibold, P(14), white, tw);
dc.DrawText(ht, new System.Windows.Point(tx, Math.Round(cy - ht.Height + P(2))));
Expand Down
5 changes: 4 additions & 1 deletion src/Design/Controls.cs
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,9 @@ public class MacSegmented : Drawn, IStrip
int selected, hover = -1;
public event Action<int> Changed;

// Room left around a segment's text before it is cut with an ellipsis.
internal const double TextPad = 4;

public MacSegmented(string[] options, int selected)
{
this.options = options;
Expand Down Expand Up @@ -613,7 +616,7 @@ protected override void Paint(DrawingContext dc)
{
bool on = i == selected;
FormattedText t = Text(options[i], on ? Ds.Semibold : Ds.Regular, 12.5, on ? pal.Label : Mix(pal.Label2, pal.Label, i == hov ? 0.6 : 0));
t.MaxTextWidth = Math.Max(1, seg - 8);
t.MaxTextWidth = Math.Max(1, seg - TextPad);
t.MaxLineCount = 1;
t.Trimming = TextTrimming.CharacterEllipsis;
Ink.Center(dc, t, new Rect(2 + seg * i, 0, seg, h));
Expand Down
2 changes: 1 addition & 1 deletion src/Design/HighContrastPaint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public static void Segmented(DrawingContext dc, Size size, string[] options, dou
bool on = i == selected;
if (i == hover && !on && enabled) dc.DrawRoundedRectangle(null, Line(s.Highlight, px), new Rect(2 + seg * i + px / 2, 2 + px / 2, seg - px, h - 4 - px), 5.5, 5.5);
FormattedText t = Ink.Text(options[i], on ? Ds.Semibold : Ds.Regular, 12.5, on ? (enabled ? s.HighlightText : s.Window) : ink);
t.MaxTextWidth = Math.Max(1, seg - 8);
t.MaxTextWidth = Math.Max(1, seg - MacSegmented.TextPad);
t.MaxLineCount = 1;
t.Trimming = TextTrimming.CharacterEllipsis;
Ink.Center(dc, t, new Rect(2 + seg * i, 0, seg, h));
Expand Down
5 changes: 4 additions & 1 deletion src/Editor/BgPanel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,10 @@ void Arrange(int width)
// Gradients, five to a row.
int gap = P(8), sw = (w - 4 * gap) / 5;
Add(Kind.Header, 0, I18n.T("Degradados", "Gradients"), new Rectangle(m, y, w, P(16)));
Add(Kind.More, 0, allGradients ? I18n.T("Ver menos", "Show less") : I18n.T("Ver m\u00E1s", "Show more"), new Rectangle(m + w - P(84), y - P(3), P(84), P(22)));
// Wide enough for its own label (it is longer in some languages) so the whole word can be clicked.
string more = allGradients ? I18n.T("Ver menos", "Show less") : I18n.T("Ver m\u00E1s", "Show more");
int moreW = Math.Max(P(84), TextKit.Measure(more, Small(), Size.Empty, TextFormatFlags.NoPadding).Width + P(18));
Add(Kind.More, 0, more, new Rectangle(m + w - moreW, y - P(3), moreW, P(22)));
y += P(26);
int col = 0, shown = 0;
for (int i = 0; i < Backdrop.Count; i++)
Expand Down
4 changes: 3 additions & 1 deletion src/Home/FocusClock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,11 @@ public static string Clock(TimeSpan t)
return s >= 3600 ? (s / 3600) + ":" + (s / 60 % 60).ToString("00") + ":" + (s % 60).ToString("00") : (s / 60) + ":" + (s % 60).ToString("00");
}

// "25 min", "1 h 15 min".
// "25 min", "1 h 15 min" ("25분", "1시간 15분" in Korean, which has its own units).
public static string Minutes(int m)
{
if (I18n.IsKorean)
return m < 60 ? I18n.Fmt("", "{0} min", m) : I18n.Fmt("", "{0} h", m / 60) + (m % 60 > 0 ? " " + I18n.Fmt("", "{0} min", m % 60) : "");
return m < 60 ? m + " min" : (m / 60) + " h" + (m % 60 > 0 ? " " + (m % 60) + " min" : "");
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/Home/HomeHistoryPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -561,12 +561,12 @@ void HistoryShow(List<HistoryItem> shown, string[] words, bool fromTop)
if (historyAll == null || historyAll.Count == 0 || n == 0) historyCount.Text = "";
else if (words.Length > 0)
{
historyCount.Text = I18n.IsKorean ? string.Format(I18n.Localize("{0:N0} results"), n)
historyCount.Text = I18n.IsKorean ? string.Format(HistoryEs, I18n.Localize("{0:N0} results"), n)
: n == 1 ? I18n.T("1 resultado", "1 result") : I18n.Fmt("{0} resultados", "{0} results", n.ToString("N0", HistoryEs));
}
else
{
historyCount.Text = I18n.IsKorean ? string.Format(I18n.Localize("{0:N0} items"), n)
historyCount.Text = I18n.IsKorean ? string.Format(HistoryEs, I18n.Localize("{0:N0} items"), n)
: n == 1 ? I18n.T("1 elemento", "1 item") : I18n.Fmt("{0} elementos", "{0} items", n.ToString("N0", HistoryEs));
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Home/Recents.cs
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ public static string Size(long bytes)
if (kb < 1024) return kb + " KB";
double mb = Math.Max(1, bytes / 1048576.0);
if (mb < 1024 && Math.Round(mb) >= 1024) mb = 1024;
return mb >= 1024 ? (mb / 1024).ToString("0.0") + " GB" : mb.ToString(mb < 10 ? "0.0" : "0") + " MB";
return mb >= 1024 ? (mb / 1024).ToString("0.0", I18n.Culture) + " GB" : mb.ToString(mb < 10 ? "0.0" : "0", I18n.Culture) + " MB";
}

// Thumbnail of a capture at px (device pixels) on its long side; ready is called on the UI thread.
Expand Down
4 changes: 2 additions & 2 deletions src/I18n.German.Capture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,11 @@ static void RegisterGermanCapture(Action<string, string, string> reg)
reg("The area did not scroll, so it was saved as a normal capture. Choose only the part that scrolls (the list or text), without the fixed header.", null, "Der Bereich wurde als normale Aufnahme gespeichert, weil er sich nicht bewegt hat. Wähle nur die scrollbare Liste oder den Textbereich ohne festen Kopfbereich.");
reg("Composing…", null, "Bild wird zusammengesetzt…");
reg("Esc again to discard", null, "Zum Verwerfen erneut Esc drücken");
reg("You haven't scrolled · Done again saves it", null, "Es wurde noch nicht gescrollt · Erneut „Fertig“ wählen, um zu speichern");
reg("You haven't scrolled · Done again saves it", null, "Nichts gescrollt · Erneut „Fertig“ speichert");
reg("Maximum height", null, "Maximale Höhe");
reg("Downward only", null, "Nur nach unten");
reg("Slow down", null, "Langsamer scrollen");
reg("Pause: stop and continue scrolling with wheel", null, "Pausieren und mit dem Mausrad weiterscrollen");
reg("Pause: stop and scroll with the wheel", null, "Pausieren, per Mausrad weiterscrollen");
reg("Auto: scroll automatically", null, "Auto: automatisch scrollen");
reg("Done: save capture (Enter)", null, "Fertig: Aufnahme speichern (Eingabe)");
reg("Cancel without saving (Esc)", null, "Ohne Speichern abbrechen (Esc)");
Expand Down
2 changes: 1 addition & 1 deletion src/I18n.German.Editor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ static void RegisterGermanEditor(Action<string, string, string> reg)
reg("Blur", null, "Unschärfe");
reg("Solid color", null, "Volltonfarbe");
reg("Other color\u2026", null, "Andere Farbe\u2026");
reg("Auto-balance", null, "Automatisch ausbalancieren");
reg("Auto-balance", null, "Auto-Ausgleich");
reg("Alignment", null, "Ausrichtung");
reg("Aspect ratio", "Proporción", "Seitenverhältnis");
reg("Saved styles\u2026", null, "Gespeicherte Stile\u2026");
Expand Down
6 changes: 3 additions & 3 deletions src/I18n.Korean.Capture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -309,11 +309,11 @@ static void RegisterKoreanCapture(Dictionary<string, string> map)
map["The area did not scroll, so it was saved as a normal capture. Choose only the part that scrolls (the list or text), without the fixed header."] = "\uC601\uC5ED\uC774 \uC6C0\uC9C1\uC774\uC9C0 \uC54A\uC544 \uC77C\uBC18 \uCEA1\uCC98\uB85C \uC800\uC7A5\uD588\uC2B5\uB2C8\uB2E4. \uACE0\uC815\uB41C \uBA38\uB9AC\uAE00\uC744 \uBE7C\uACE0 \uC2A4\uD06C\uB864\uB418\uB294 \uBAA9\uB85D\uC774\uB098 \uBCF8\uBB38\uB9CC \uC120\uD0DD\uD558\uC138\uC694.";
map["Composing\u2026"] = "\uC774\uBBF8\uC9C0 \uD569\uCE58\uB294 \uC911\u2026";
map["Esc again to discard"] = "Esc\uB97C \uB2E4\uC2DC \uB20C\uB7EC \uBC84\uB9AC\uAE30";
map["You haven't scrolled \u00B7 Done again saves it"] = "\uC2A4\uD06C\uB864\uD558\uC9C0 \uC54A\uC558\uC2B5\uB2C8\uB2E4 \u00B7 \uC644\uB8CC\uB97C \uB2E4\uC2DC \uB20C\uB7EC \uC800\uC7A5";
map["You haven't scrolled \u00B7 Done again saves it"] = "\uC2A4\uD06C\uB864 \uC548 \uD568 \u00B7 \uC644\uB8CC\uB97C \uB2E4\uC2DC \uB20C\uB7EC \uC800\uC7A5";
map["Maximum height"] = "\uCD5C\uB300 \uB192\uC774 \uB3C4\uB2EC";
map["Downward only"] = "\uC544\uB798\uB85C\uB9CC \uC2A4\uD06C\uB864";
map["Slow down"] = "\uB354 \uCC9C\uCC9C\uD788 \uC2A4\uD06C\uB864\uD558\uC138\uC694";
map["Pause: stop and continue scrolling with wheel"] = "\uC77C\uC2DC \uC815\uC9C0: \uC790\uB3D9 \uC2A4\uD06C\uB864\uC744 \uBA48\uCD94\uACE0 \uD720\uB85C \uACC4\uC18D";
map["Pause: stop and scroll with the wheel"] = "\uC77C\uC2DC \uC815\uC9C0: \uC790\uB3D9 \uC2A4\uD06C\uB864\uC744 \uBA48\uCD94\uACE0 \uD720\uB85C \uACC4\uC18D";
map["Auto: scroll automatically"] = "\uC790\uB3D9: \uC790\uB3D9\uC73C\uB85C \uC2A4\uD06C\uB864";
map["Done: save capture (Enter)"] = "\uC644\uB8CC: \uCEA1\uCC98 \uC800\uC7A5(Enter)";
map["Cancel without saving (Esc)"] = "\uC800\uC7A5\uD558\uC9C0 \uC54A\uACE0 \uCDE8\uC18C(Esc)";
Expand Down Expand Up @@ -406,7 +406,7 @@ static void RegisterKoreanCapture(Dictionary<string, string> map)
map["No sensitive data found."] = "\uBBFC\uAC10 \uC815\uBCF4\uB97C \uCC3E\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4.";
map["Sensitive data is already redacted."] = "\uBBFC\uAC10 \uC815\uBCF4\uAC00 \uC774\uBBF8 \uAC00\uB824\uC838 \uC788\uC2B5\uB2C8\uB2E4.";
map["Redacted {0} more items; {1} were already covered."] = "{0}\uAC1C\uB97C \uCD94\uAC00\uB85C \uAC00\uB838\uC2B5\uB2C8\uB2E4. \uB098\uBA38\uC9C0 {1}\uAC1C\uB294 \uC774\uBBF8 \uAC00\uB824\uC838 \uC788\uC5C8\uC2B5\uB2C8\uB2E4.";
map["{0} items redacted: {1}. You can remove the marks."] = "\uBBFC\uAC10 \uC815\uBCF4 {0}\uAC1C\uB97C \uAC00\uB838\uC2B5\uB2C8\uB2E4({1}). \uAC00\uB9AC\uAE30 \uD45C\uC2DC\uB294 \uC81C\uAC70\uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4.";
map["{0} items redacted: {1}. You can remove the marks."] = "\uBBFC\uAC10 \uC815\uBCF4 {0}\uAC1C \uAC00\uB9BC({1}). \uD45C\uC2DC\uB294 \uC81C\uAC70 \uAC00\uB2A5\uD569\uB2C8\uB2E4.";
map["Original"] = "\uC6D0\uBCF8";
map["Sunset"] = "\uB178\uC744";
map["Mint"] = "\uBBFC\uD2B8";
Expand Down
2 changes: 1 addition & 1 deletion src/I18n.Korean.Core.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ static void RegisterKoreanCore(Dictionary<string, string> map)
map["Start a line with \u201C- [ ] \u201D for a task list."] = "\uD560 \uC77C \uBAA9\uB85D\uC740 \uAC01 \uC904\uC744 \u2018- [ ] \u2019\uB85C \uC2DC\uC791\uD558\uC138\uC694.";
map["When?"] = "\uC5B8\uC81C \uC54C\uB824\uB4DC\uB9B4\uAE4C\uC694?";
map["Tomorrow"] = "\uB0B4\uC77C";
map["At\u2026"] = "\uC2DC\uAC04 \uC9C0\uC815\u2026";
map["At\u2026"] = "\uC2DC\uAC01\u2026";
map["I'll remind you {0}."] = "{0}\uC5D0 \uC54C\uB824\uB4DC\uB9B4\uAC8C\uC694.";
map["Time"] = "\uC2DC\uAC04";
map["(for example 16:30)"] = "(\uC608: 16:30)";
Expand Down
2 changes: 1 addition & 1 deletion src/I18n.Korean.Editor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ static void RegisterKoreanEditor(Dictionary<string, string> map)
map["Padding"] = "\uC5EC\uBC31";
map["Corners"] = "\uBAA8\uC11C\uB9AC";
map["Shadow"] = "\uADF8\uB9BC\uC790";
map["Border inset"] = "\uD14C\uB450\uB9AC \uC548\uCABD \uC5EC\uBC31";
map["Border inset"] = "\uC548\uCABD \uC5EC\uBC31";

// BgPanel.Styles
map[" \u00B7 padding "] = " \u00B7 \uC5EC\uBC31 ";
Expand Down
21 changes: 17 additions & 4 deletions src/Markdown/DocControls.cs
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,6 @@ void UseIcon(string icon, Color c1, Color c2)
Grid row = new Grid { Margin = new Thickness(0, 20, 0, 0) };
Grid.SetRow(row, 2);
Grid.SetColumnSpan(row, 2);
StackPanel right = new StackPanel { Orientation = Orientation.Horizontal, HorizontalAlignment = HorizontalAlignment.Right };
MacButton main = null;
MacButton[] all = new MacButton[buttons.Length];
for (int i = 0; i < buttons.Length; i++)
Expand All @@ -338,12 +337,26 @@ void UseIcon(string icon, Color c1, Color c2)
if (primary >= 0 && primary < all.Length) order.Add(primary);
for (int i = 0; i < all.Length; i++) if (i != primary && i != cancel) order.Add(i);
if (cancel >= 0 && cancel < all.Length && cancel != primary) order.Add(cancel);
// One row; when a language makes the buttons longer than the room they have, the rest go on a second row
// (still on the right, in the same order) instead of running off the edge.
double room = Width - g.Margin.Left - g.Margin.Right, used = 0;
StackPanel rows = new StackPanel();
StackPanel right = null;
for (int n = 0; n < order.Count; n++)
{
all[order[n]].Margin = new Thickness(n == 0 ? 0 : 8, 0, 0, 0);
right.Children.Add(all[order[n]]);
MacButton b = all[order[n]];
double w = Math.Max(b.Width, b.MinWidth);
if (right == null || used + 8 + w > room)
{
right = new StackPanel { Orientation = Orientation.Horizontal, HorizontalAlignment = HorizontalAlignment.Right, Margin = new Thickness(0, right == null ? 0 : 8, 0, 0) };
rows.Children.Add(right);
used = 0;
}
b.Margin = new Thickness(used == 0 ? 0 : 8, 0, 0, 0);
used += (used == 0 ? 0 : 8) + w;
right.Children.Add(b);
}
row.Children.Add(right);
row.Children.Add(rows);
g.Children.Add(row);
Root.Children.Add(g);
KeepCaptionsOnTop();
Expand Down
2 changes: 1 addition & 1 deletion src/Markdown/FindBar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ public void Show(int index, int total, string error, bool partial)
if (error != null) count.Text = error;
else if (Query.Text.Length == 0) count.Text = "";
else if (total == 0) count.Text = partial ? I18n.T("Sin resultados (b\u00FAsqueda cortada)", "No results (search cut short)") : I18n.T("Sin resultados", "No results");
else count.Text = (index >= 0 ? (index + 1).ToString("N0") + I18n.T(" de ", " of ") : "") + total.ToString("N0") + (total >= TextSearch.MaxHits || partial ? "+" : "") + (index >= 0 ? "" : total == 1 ? I18n.T(" resultado", " result") : I18n.T(" resultados", " results"));
else count.Text = (index >= 0 ? (index + 1).ToString("N0", I18n.Culture) + I18n.T(" de ", " of ") : "") + total.ToString("N0", I18n.Culture) + (total >= TextSearch.MaxHits || partial ? "+" : "") + (index >= 0 ? "" : total == 1 ? I18n.T(" resultado", " result") : I18n.T(" resultados", " results"));
}

public void FocusQuery()
Expand Down
Loading
Loading