diff --git a/.gitignore b/.gitignore
index 5ab8d18..79758b1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,3 +4,5 @@
/_build
/target
/*.Dockerfile
+src/ui/*.ui
+src/ui/graph/*.ui
diff --git a/build.rs b/build.rs
index 23f9ca3..1a8a02b 100644
--- a/build.rs
+++ b/build.rs
@@ -6,6 +6,8 @@ fn main() {
"src/ui/graph/zoomentry.blp",
];
+ println!("cargo:warning=Helvum build script starting...");
+
for blp in blp_files {
let ui = blp.replace(".blp", ".ui");
println!("cargo:rerun-if-changed={}", blp);
diff --git a/src/style.css b/src/style.css
index 397fedb..7f1fde9 100644
--- a/src/style.css
+++ b/src/style.css
@@ -20,6 +20,11 @@
@define-color media-type-midi rgb(200, 0, 50);
@define-color media-type-unknown rgb(128, 128, 128);
+.port-handle {
+ border-radius: 50%;
+ background-color: @media-type-unknown;
+}
+
.audio {
background: @media-type-audio;
color: black;
@@ -36,8 +41,6 @@
}
node {
- /* Compared to the default card color, this is not transparent in dark-mode
- and provides a better contrast to the background in light mode */
background-color: @headerbar_bg_color;
}
@@ -49,10 +52,6 @@ port label {
padding: 4px 6px;
}
-port-handle {
- border-radius: 50%;
- background-color: @media-type-unknown;
-}
button.rounded {
padding: 6px;
diff --git a/src/ui/graph/mod.rs b/src/ui/graph/mod.rs
index 36f36e2..691b9ff 100644
--- a/src/ui/graph/mod.rs
+++ b/src/ui/graph/mod.rs
@@ -20,8 +20,6 @@ mod node;
pub use node::*;
mod port;
pub use port::*;
-mod port_handle;
-pub use port_handle::*;
mod link;
pub use link::*;
mod zoomentry;
diff --git a/src/ui/graph/node.ui b/src/ui/graph/node.ui
deleted file mode 100644
index 7ccbcf5..0000000
--- a/src/ui/graph/node.ui
+++ /dev/null
@@ -1,60 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/ui/graph/port.blp b/src/ui/graph/port.blp
index ec14aff..c57c79f 100644
--- a/src/ui/graph/port.blp
+++ b/src/ui/graph/port.blp
@@ -10,7 +10,7 @@ template HelvumPort : Widget {
max-width-chars: 20;
}
- Gtk.Box handle_container {
+ Gtk.Box handle {
halign: center;
valign: center;
}
diff --git a/src/ui/graph/port.rs b/src/ui/graph/port.rs
index 3a19c7a..dc2eb76 100644
--- a/src/ui/graph/port.rs
+++ b/src/ui/graph/port.rs
@@ -25,7 +25,6 @@ pub use imp::{PortDirection, PortMediaType};
use crate::PortId;
use libspa::{param::format::MediaType, utils::Direction};
-use super::PortHandle;
mod imp {
use super::*;
@@ -107,8 +106,7 @@ mod imp {
#[template_child]
pub(super) label: TemplateChild,
#[template_child]
- pub(super) handle_container: TemplateChild,
- pub(super) handle: PortHandle,
+ pub(super) handle: TemplateChild,
}
impl Default for Port {
@@ -118,8 +116,7 @@ mod imp {
media_type: Cell::new(PortMediaType::Unknown),
direction: Cell::new(PortDirection::Output),
label: TemplateChild::default(),
- handle_container: TemplateChild::default(),
- handle: PortHandle::new(),
+ handle: TemplateChild::default(),
}
}
}
@@ -145,7 +142,8 @@ mod imp {
fn constructed(&self) {
self.parent_constructed();
- self.handle_container.append(&self.handle);
+ self.handle.add_css_class("port-handle");
+ self.handle.set_size_request(14, 14);
// Force left-to-right direction for the ports grid to avoid messed up UI when defaulting to right-to-left
gtk::prelude::WidgetExt::set_direction(&*self.obj(), gtk::TextDirection::Ltr);
diff --git a/src/ui/graph/port.ui b/src/ui/graph/port.ui
deleted file mode 100644
index 6bb414f..0000000
--- a/src/ui/graph/port.ui
+++ /dev/null
@@ -1,26 +0,0 @@
-
-
-
-
-
- true
-
-
- true
- 3
- 2
- 20
-
-
-
-
- 3
- 3
-
-
-
-
\ No newline at end of file
diff --git a/src/ui/graph/port_handle.rs b/src/ui/graph/port_handle.rs
deleted file mode 100644
index 7eb3a9a..0000000
--- a/src/ui/graph/port_handle.rs
+++ /dev/null
@@ -1,84 +0,0 @@
-// Copyright 2021 Tom A. Wagner
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License version 3 as published by
-// the Free Software Foundation.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program. If not, see .
-//
-// SPDX-License-Identifier: GPL-3.0-only
-
-use adw::{glib, gtk, prelude::*, subclass::prelude::*};
-
-mod imp {
- use super::*;
-
- #[derive(Default)]
- pub struct PortHandle {}
-
- #[glib::object_subclass]
- impl ObjectSubclass for PortHandle {
- const NAME: &'static str = "HelvumPortHandle";
- type Type = super::PortHandle;
- type ParentType = gtk::Widget;
-
- fn class_init(klass: &mut Self::Class) {
- klass.set_css_name("port-handle");
- }
- }
-
- impl ObjectImpl for PortHandle {
- fn constructed(&self) {
- self.parent_constructed();
-
- let obj = &*self.obj();
-
- obj.set_halign(gtk::Align::Center);
- obj.set_valign(gtk::Align::Center);
- }
- }
-
- impl WidgetImpl for PortHandle {
- fn request_mode(&self) -> gtk::SizeRequestMode {
- gtk::SizeRequestMode::ConstantSize
- }
-
- fn measure(&self, _orientation: gtk::Orientation, _for_size: i32) -> (i32, i32, i32, i32) {
- (Self::HANDLE_SIZE, Self::HANDLE_SIZE, -1, -1)
- }
- }
-
- impl PortHandle {
- pub const HANDLE_SIZE: i32 = 14;
- }
-}
-
-glib::wrapper! {
- pub struct PortHandle(ObjectSubclass)
- @extends gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget;
-}
-
-impl PortHandle {
- pub fn new() -> Self {
- glib::Object::new()
- }
-
- pub fn get_link_anchor(&self) -> gtk::graphene::Point {
- gtk::graphene::Point::new(
- imp::PortHandle::HANDLE_SIZE as f32 / 2.0,
- imp::PortHandle::HANDLE_SIZE as f32 / 2.0,
- )
- }
-}
-
-impl Default for PortHandle {
- fn default() -> Self {
- Self::new()
- }
-}
diff --git a/src/ui/graph/zoomentry.ui b/src/ui/graph/zoomentry.ui
deleted file mode 100644
index 3f3cdae..0000000
--- a/src/ui/graph/zoomentry.ui
+++ /dev/null
@@ -1,43 +0,0 @@
-
-
-
-
-
- 12
-
-
- go-down-symbolic
- 2
- 5
-
-
-
-
-
- zoom-out-symbolic
- Zoom out
-
-
-
-
-
- zoom-in-symbolic
- Zoom in
-
-
-
-
-
\ No newline at end of file
diff --git a/src/ui/window.ui b/src/ui/window.ui
deleted file mode 100644
index 744ccd6..0000000
--- a/src/ui/window.ui
+++ /dev/null
@@ -1,55 +0,0 @@
-
-
-
-
-
-
- 1280
- 720
- Helvum - Pipewire Patchbay
-
-
-
-
-
-
-
- 1
-
-
- Disconnected
- false
-
-
-
-
-
-
- true
- true
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file