Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Foreground image + transparency + fixes #112

Merged
merged 19 commits into from
Sep 11, 2023
Merged
Show file tree
Hide file tree
Changes from 16 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
95 changes: 70 additions & 25 deletions NickvisionCavalier.GNOME/Blueprints/preferences_dialog.blp
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,7 @@ Adw.PreferencesWindow _root {

Gtk.Button _addFgColorButton {
icon-name: "list-add-symbolic";
tooltip-text: _("Add foreground color");

styles [ "circular" ]
}
Expand All @@ -549,6 +550,7 @@ Adw.PreferencesWindow _root {

Gtk.Button _addBgColorButton {
icon-name: "list-add-symbolic";
tooltip-text: _("Add background color");

styles [ "circular" ]
}
Expand All @@ -562,62 +564,109 @@ Adw.PreferencesWindow _root {
}

Adw.PreferencesPage {
title: _("Image");
title: _("Images");
icon-name: "image-x-generic-symbolic";

Gtk.Box {
orientation: vertical;
margin-top: 12;
margin-start: 12;
margin-end: 12;
margin-bottom: 12;
spacing: 12;

Gtk.Box {
spacing: 6;
Gtk.Box {
Gtk.ToggleButton _bgImgButton {
label: _("Background");
active: true;
}

Gtk.Button _addImageButton {
halign: start;
margin-top: 12;
margin-start: 12;
margin-end: 12;
margin-bottom: 6;
Gtk.ToggleButton {
label: _("Foreground");
active: bind _bgImgButton.active bidirectional inverted;
}

styles ["linked"]
}

Gtk.Separator {
hexpand: true;

styles ["spacer"]
}

Gtk.Button _addImageButton {
Adw.ButtonContent {
label: _("Add Image");
icon-name: "list-add-symbolic";
}
}
}

Gtk.Separator {
styles [ "spacer" ]
Gtk.Box {
Gtk.Label {
hexpand: true;
halign: start;
margin-start: 12;
label: _("Scale");
}

Gtk.Label {
Gtk.SpinButton _imgScaleSpin {
valign: center;
margin-top: 6;
label: _("Scale");
margin-start: 6;
margin-end: 6;
margin-bottom: 6;
digits: 2;
adjustment: Gtk.Adjustment {
lower: 0.1;
upper: 1.0;
step-increment: 0.05;
};
}

Gtk.Scale _imageScale {
Gtk.Separator {}

Gtk.Label {
hexpand: true;
halign: start;
margin-start: 12;
label: _("Alpha");
}

Gtk.SpinButton _imgAlphaSpin {
valign: center;
margin-top: 6;
margin-start: 6;
margin-end: 6;
margin-bottom: 6;
digits: 2;
adjustment: Gtk.Adjustment {
lower: 0.10;
lower: 0.1;
upper: 1.0;
step-increment: 0.05;
};
}

styles ["card"]
}

Gtk.Label {
label: _("Foreground image is only shown with Box drawing modes.");
visible: bind _bgImgButton.active inverted;

styles ["warning"]
}

Gtk.Stack _imagesStack
{
margin-top: 6;
margin-start: 12;
margin-end: 12;
margin-bottom: 12;

Gtk.StackPage {
name: "empty";
child: Adw.StatusPage {
vexpand: true;
title: "No Images";
description: "Add an image to use it in Cavalier.";
title: _("No Images");
description: _("Add an image to use it in Cavalier.");
icon-name: "image-x-generic-symbolic";
};
}
Expand All @@ -630,10 +679,6 @@ Adw.PreferencesWindow _root {

Gtk.FlowBox _imagesFlowBox {
valign: start;
margin-top: 6;
margin-start: 6;
margin-end: 6;
margin-bottom: 6;
homogeneous: true;
min-children-per-line: 3;

Expand Down
26 changes: 23 additions & 3 deletions NickvisionCavalier.GNOME/Blueprints/shortcuts_dialog.blp
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,32 @@ Gtk.ShortcutsWindow _shortcuts {

Gtk.ShortcutsShortcut {
title: _("Change Background Image");
accelerator: "I <Shift>I";
accelerator: "1 <Shift>1";
}

Gtk.ShortcutsShortcut {
title: _("Change Image Scale");
accelerator: "A <Shift>A";
title: _("Change Background Image Scale");
accelerator: "2 <Shift>2";
}

Gtk.ShortcutsShortcut {
title: _("Change Background Image Alpha");
accelerator: "3 <Shift>3";
}

Gtk.ShortcutsShortcut {
title: _("Change Foreground Image");
accelerator: "4 <Shift>4";
}

Gtk.ShortcutsShortcut {
title: _("Change Foreground Image Scale");
accelerator: "5 <Shift>5";
}

Gtk.ShortcutsShortcut {
title: _("Change Foreground Image Alpha");
accelerator: "6 <Shift>6";
}
}

Expand Down
2 changes: 1 addition & 1 deletion NickvisionCavalier.GNOME/NickvisionCavalier.GNOME.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

<ItemGroup>
<PackageReference Include="GirCore.Adw-1" Version="0.4.0" />
<PackageReference Include="Nickvision.Aura" Version="2023.8.2" />
<PackageReference Include="Nickvision.Aura" Version="2023.9.3" />
<PackageReference Include="Nickvision.GirExt" Version="2023.7.2" />
<PackageReference Include="SkiaSharp.NativeAssets.Linux" Version="2.88.3" />
</ItemGroup>
Expand Down
5 changes: 4 additions & 1 deletion NickvisionCavalier.GNOME/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ public Program(string[] args)
_mainWindow = null;
_mainWindowController = new MainWindowController(args);
_mainWindowController.AppInfo.Changelog =
@"* Updated translations (Thanks everyone on Weblate!)";
@"* Added ability to set foreground image for Box modes
* Transparency can now be set both for background and foreground image
* Cavalier switched back to using PulseAudio by default. You can still switch audio backend to whatever is supported by CAVA using CAVALIER_INPUT_METHOD environment variable
* Updated translations (Thanks everyone on Weblate!)";
_application.OnActivate += OnActivate;
if (File.Exists(Path.GetFullPath(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)) + "/org.nickvision.cavalier.gresource"))
{
Expand Down
Loading