Skip to content

Commit

Permalink
set tips size via query string in app
Browse files Browse the repository at this point in the history
This moves the "small" font size from CSS into the URL the
application uses for the tips. This way, the tips appear at a more
reasonable size when viewed in a web browser (where they are useful
since they have nice section and "topic" links).

I tested this with 100% and 125% scaling and it seems to work fine.

The code change also leads the way for a possible future feature
where the tips size is configurable. (I don't know if I'll implement
that though.)
  • Loading branch information
EliahKagan committed May 15, 2021
1 parent bef89ad commit 02cc82e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
1 change: 0 additions & 1 deletion doc/tips.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
body {
cursor: default;
font-family: 'Segoe UI', 'Nimbus Sans L', 'DM Sans', 'Selawik', '-apple-system', system-ui, 'BlinkMacSystemFont', 'Helvetica Neue', 'Helvetica', 'Arial', sans-serif;
font-size: small;
font-variant-numeric: tabular-nums;
margin: 0;
}
Expand Down
11 changes: 9 additions & 2 deletions flood.linq
Original file line number Diff line number Diff line change
Expand Up @@ -2366,7 +2366,8 @@ internal sealed class TipsViewer : MyWebBrowser {
if (e.Url.SchemeIs(Uri.UriSchemeFile)) HelpRequest?.Invoke(this, e);
}

private readonly Uri _home = Files.GetDocUrl("tips.html");
private readonly Uri _home =
Files.GetDocUrl(filename: "tips.html", query: "size=small");
}

/// <summary>
Expand Down Expand Up @@ -2546,7 +2547,10 @@ internal delegate Task<HelpViewer> HelpViewerSupplier();
/// </summary>
internal static class Files {
internal static Uri GetDocUrl(string filename)
=> new(Path.Combine(QueryDirectory, "doc", filename));
=> new(GetDocPath(filename));

internal static Uri GetDocUrl(string filename, string query)
=> new UriBuilder(GetDocPath(filename)) { Query = query }.Uri;

internal static string GetSystem32ExePath(string basename)
=> Path.Combine(WindowsDirectory, "system32", $"{basename}.exe");
Expand Down Expand Up @@ -2639,6 +2643,9 @@ internal static class Files {
return bitmap;
}

private static string GetDocPath(string filename)
=> Path.Combine(QueryDirectory, "doc", filename);

private static string GetImagePath(string filename)
=> Path.Combine(QueryDirectory, "images", filename);

Expand Down

0 comments on commit 02cc82e

Please sign in to comment.