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
20 changes: 20 additions & 0 deletions crates/cr-win/package/MaterialDesignIcons-LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Pictogrammers Free License
--------------------------

This icon collection is released as free, open source, and GPL friendly by
the [Pictogrammers](http://pictogrammers.com/) icon group. You may use it
for commercial projects, open source projects, or anything really.

# Icons: Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0)
Some of the icons are redistributed under the Apache 2.0 license. All other
icons are either redistributed under their respective licenses or are
distributed under the Apache 2.0 license.

# Fonts: Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0)
All web and desktop fonts are distributed under the Apache 2.0 license. Web
and desktop fonts contain some icons that are redistributed under the Apache
2.0 license. All other icons are either redistributed under their respective
licenses or are distributed under the Apache 2.0 license.

# Code: MIT (https://opensource.org/licenses/MIT)
The MIT license applies to all non-font and non-icon files.
2 changes: 2 additions & 0 deletions crates/cr-win/package/make-msix.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ Copy-Item "$root\target\release\CoreRules.exe" $layout
# WinUI's WebView2 loads it; the build put it next to the exe.
Copy-Item "$root\target\release\Microsoft.Web.WebView2.Core.dll" $layout
Copy-Item "$PSScriptRoot\Assets\*" "$layout\Assets"
# The licence of the Material Design Icons the navigation draws.
Copy-Item "$PSScriptRoot\MaterialDesignIcons-LICENSE.txt" $layout
$manifest = Get-Content "$PSScriptRoot\AppxManifest.xml" -Raw
$manifest.Replace('Version="0.0.0.0"', "Version=""$Version.0""") |
Set-Content -NoNewline -Encoding utf8 "$layout\AppxManifest.xml"
Expand Down
1 change: 1 addition & 0 deletions crates/cr-win/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ mod packages;
mod parties;
mod portrait;
mod record;
mod section_icons;
mod settings;
mod sheet;
mod tables;
Expand Down
41 changes: 4 additions & 37 deletions crates/cr-win/src/app/library.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use cr_store::userdb::{self, Filter as Origins, Origin};
use cr_win::text::plain;
use windows_reactor::*;

use super::{Message, Shell, available};
use super::{Message, Shell, available, section_icons};
use crate::ui;

/// The pictures of the entry on the details, made once when it is
Expand Down Expand Up @@ -74,45 +74,12 @@ impl Pictures {
}
}

/// The GNOME app's sword, which Segoe Fluent Icons has no glyph for:
/// its 16-pixel drawing turned 45 degrees, as path data.
const SWORD: &str = "F1 M14.93,1.07 L14.43,3.69 L7.79,10.33 L5.67,8.21 L12.31,1.57 Z \
M4.04,6.59 L9.41,11.96 A1,1 0 0 1 8,13.37 L2.63,8 A1,1 0 0 1 4.04,6.59 Z \
M4.61,9.98 L6.02,11.39 L4.04,13.37 L2.63,11.96 Z \
M1.64,12.38 A1.4,1.4 0 1 1 3.62,14.36 A1.4,1.4 0 1 1 1.64,12.38 Z";

/// The section's icon in the navigation, as the GNOME app gives each its
/// own.
pub fn icon(section: &str) -> View {
if section == "weapons" {
return PathIcon::new().data(SWORD).into();
}
SymbolIcon::new().symbol(symbol(section)).into()
}

fn symbol(section: &str) -> Symbol {
match section {
library::CHARACTERS => Symbol::People,
"races" => Symbol::Contact,
"classes" => Symbol::Manage,
"kits" => Symbol::ContactInfo,
"armor" => Symbol::Permissions,
"equipment" => Symbol::Shop,
"magic-items" => Symbol::SolidStar,
"nonweapon" => Symbol::List,
OTHER_SECTION => Symbol::AllApps,
"wizard-spells" | "priest-spells" => Symbol::Highlight,
"psionics" => Symbol::Emoji2,
"monsters" => Symbol::Emoji,
"monster-types" => Symbol::ViewAll,
"traps" => Symbol::Important,
"encounters" => Symbol::MapPin,
"templates" => Symbol::Bullets,
"tables" => Symbol::ShowResults,
"treasure" => Symbol::Bookmarks,
"treasure-tables" => Symbol::Calculator,
"books" => Symbol::Library,
_ => Symbol::Document,
match section_icons::path(section) {
Some(data) => PathIcon::new().data(data).into(),
None => SymbolIcon::new().symbol(Symbol::Document).into(),
}
}

Expand Down
Loading
Loading