mirror of
https://gitlab.freedesktop.org/pipewire/helvum
synced 2026-03-15 19:46:10 +08:00
Compare commits
22 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c1ec56e115 | ||
|
|
110e9ef67f | ||
|
|
3c507683b7 | ||
|
|
1d1f8bd3d7 | ||
|
|
b25f6f9abb | ||
|
|
2d51ea677e | ||
|
|
beb03d8b09 | ||
|
|
502cf4476b | ||
|
|
eac973da15 | ||
|
|
82a3e4f900 | ||
|
|
2cfc8e2e6f | ||
|
|
e5e02b1387 | ||
|
|
396363cef1 | ||
|
|
c887d77f64 | ||
|
|
54d7ca83ae | ||
|
|
7b1b5ea336 | ||
|
|
729d4e1555 | ||
|
|
ce6cab8134 | ||
|
|
8a552d0712 | ||
|
|
f76235674c | ||
|
|
92dcfd61a1 | ||
|
|
02e58e9bfa |
@@ -1,6 +1,6 @@
|
|||||||
include:
|
include:
|
||||||
- project: 'freedesktop/ci-templates' # the project to include from
|
- project: 'freedesktop/ci-templates' # the project to include from
|
||||||
ref: '98f557799157ebb0395cf11d40f01f61fbbace20' # git ref of that project
|
ref: '34f4ade99434043f88e164933f570301fd18b125' # git ref of that project
|
||||||
file: '/templates/fedora.yml' # the actual file to include
|
file: '/templates/fedora.yml' # the actual file to include
|
||||||
|
|
||||||
stages:
|
stages:
|
||||||
@@ -15,9 +15,9 @@ variables:
|
|||||||
# Version and tag for our current container
|
# Version and tag for our current container
|
||||||
.fedora:
|
.fedora:
|
||||||
variables:
|
variables:
|
||||||
FDO_DISTRIBUTION_VERSION: '34'
|
FDO_DISTRIBUTION_VERSION: '35'
|
||||||
# Update this to trigger a container rebuild
|
# Update this to trigger a container rebuild
|
||||||
FDO_DISTRIBUTION_TAG: '2021-05-06.0'
|
FDO_DISTRIBUTION_TAG: '2021-11-23.0'
|
||||||
|
|
||||||
build-fedora-container:
|
build-fedora-container:
|
||||||
extends:
|
extends:
|
||||||
|
|||||||
2
Cargo.lock
generated
2
Cargo.lock
generated
@@ -585,7 +585,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "helvum"
|
name = "helvum"
|
||||||
version = "0.3.1"
|
version = "0.3.2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"env_logger 0.9.0",
|
"env_logger 0.9.0",
|
||||||
"gtk4",
|
"gtk4",
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "helvum"
|
name = "helvum"
|
||||||
version = "0.3.1"
|
version = "0.3.2"
|
||||||
authors = ["Tom A. Wagner <tom.a.wagner@protonmail.com>"]
|
authors = ["Tom A. Wagner <tom.a.wagner@protonmail.com>"]
|
||||||
edition = "2018"
|
edition = "2021"
|
||||||
|
rust-version = "1.56"
|
||||||
license = "GPL-3.0-only"
|
license = "GPL-3.0-only"
|
||||||
description = "A GTK patchbay for pipewire"
|
description = "A GTK patchbay for pipewire"
|
||||||
repository = "https://gitlab.freedesktop.org/ryuukyu/helvum"
|
repository = "https://gitlab.freedesktop.org/ryuukyu/helvum"
|
||||||
|
|||||||
14
LICENSE
14
LICENSE
@@ -1,7 +1,7 @@
|
|||||||
GNU GENERAL PUBLIC LICENSE
|
GNU GENERAL PUBLIC LICENSE
|
||||||
Version 3, 29 June 2007
|
Version 3, 29 June 2007
|
||||||
|
|
||||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||||
Everyone is permitted to copy and distribute verbatim copies
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
of this license document, but changing it is not allowed.
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
@@ -631,8 +631,8 @@ to attach them to the start of each source file to most effectively
|
|||||||
state the exclusion of warranty; and each file should have at least
|
state the exclusion of warranty; and each file should have at least
|
||||||
the "copyright" line and a pointer to where the full notice is found.
|
the "copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
Helvum
|
<one line to give the program's name and a brief idea of what it does.>
|
||||||
Copyright (C) 2020 Ryuukyu
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
@@ -645,14 +645,14 @@ the "copyright" line and a pointer to where the full notice is found.
|
|||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Also add information on how to contact you by electronic and paper mail.
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
If the program does terminal interaction, make it output a short
|
If the program does terminal interaction, make it output a short
|
||||||
notice like this when it starts in an interactive mode:
|
notice like this when it starts in an interactive mode:
|
||||||
|
|
||||||
Helvum Copyright (C) 2020 Ryuukyu
|
<program> Copyright (C) <year> <name of author>
|
||||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||||
This is free software, and you are welcome to redistribute it
|
This is free software, and you are welcome to redistribute it
|
||||||
under certain conditions; type `show c' for details.
|
under certain conditions; type `show c' for details.
|
||||||
@@ -664,11 +664,11 @@ might be different; for a GUI interface, you would use an "about box".
|
|||||||
You should also get your employer (if you work as a programmer) or school,
|
You should also get your employer (if you work as a programmer) or school,
|
||||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||||
For more information on this, and how to apply and follow the GNU GPL, see
|
For more information on this, and how to apply and follow the GNU GPL, see
|
||||||
<http://www.gnu.org/licenses/>.
|
<https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
The GNU General Public License does not permit incorporating your program
|
The GNU General Public License does not permit incorporating your program
|
||||||
into proprietary programs. If your program is a subroutine library, you
|
into proprietary programs. If your program is a subroutine library, you
|
||||||
may consider it more useful to permit linking proprietary applications with
|
may consider it more useful to permit linking proprietary applications with
|
||||||
the library. If this is what you want to do, use the GNU Lesser General
|
the library. If this is what you want to do, use the GNU Lesser General
|
||||||
Public License instead of this License. But first, please read
|
Public License instead of this License. But first, please read
|
||||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||||
|
|||||||
@@ -17,9 +17,14 @@ More suggestions are welcome!
|
|||||||
## Via flatpak (recommended)
|
## Via flatpak (recommended)
|
||||||
The recommended way to build is using flatpak, which will take care of all dependencies and avoid any problems that may come from different system configurations.
|
The recommended way to build is using flatpak, which will take care of all dependencies and avoid any problems that may come from different system configurations.
|
||||||
|
|
||||||
First, install the required flatpak platform and SDK, if you dont have them already:
|
If you don't have the flathub repo in your remote-list for flatpak you will need to add that first:
|
||||||
```shell
|
```shell
|
||||||
$ flatpak install org.gnome.{Platform,Sdk}//40 org.freedesktop.Sdk.Extension.rust-stable//20.08
|
$ flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
|
||||||
|
```
|
||||||
|
|
||||||
|
Then install the required flatpak platform and SDK, if you dont have them already:
|
||||||
|
```shell
|
||||||
|
$ flatpak install org.gnome.{Platform,Sdk}//41 org.freedesktop.Sdk.Extension.rust-stable//21.08 org.freedesktop.Sdk.Extension.llvm12//21.08
|
||||||
```
|
```
|
||||||
|
|
||||||
To compile and install as a flatpak, run
|
To compile and install as a flatpak, run
|
||||||
|
|||||||
13
build-aux/cargo.sh
Normal file → Executable file
13
build-aux/cargo.sh
Normal file → Executable file
@@ -1,4 +1,6 @@
|
|||||||
#!/bin/sh
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
export MESON_BUILD_ROOT="$1"
|
export MESON_BUILD_ROOT="$1"
|
||||||
export MESON_SOURCE_ROOT="$2"
|
export MESON_SOURCE_ROOT="$2"
|
||||||
@@ -9,12 +11,11 @@ if [[ $4 = "development" ]]
|
|||||||
then
|
then
|
||||||
echo "DEBUG MODE"
|
echo "DEBUG MODE"
|
||||||
cargo build --manifest-path \
|
cargo build --manifest-path \
|
||||||
"$MESON_SOURCE_ROOT"/Cargo.toml && \
|
"$MESON_SOURCE_ROOT/Cargo.toml" && \
|
||||||
cp "$CARGO_TARGET_DIR"/debug/$5 $3
|
cp "$CARGO_TARGET_DIR/debug/$5" "$3"
|
||||||
else
|
else
|
||||||
echo "RELEASE MODE"
|
echo "RELEASE MODE"
|
||||||
cargo build --manifest-path \
|
cargo build --manifest-path \
|
||||||
"$MESON_SOURCE_ROOT"/Cargo.toml --release && \
|
"$MESON_SOURCE_ROOT/Cargo.toml" --release && \
|
||||||
cp "$CARGO_TARGET_DIR"/release/$5 $3
|
cp "$CARGO_TARGET_DIR/release/$5" "$3"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
12
build-aux/dist-vendor.sh
Normal file
12
build-aux/dist-vendor.sh
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
export DIST="$1"
|
||||||
|
export SOURCE_ROOT="$2"
|
||||||
|
|
||||||
|
cd "$SOURCE_ROOT"
|
||||||
|
mkdir "$DIST"/.cargo
|
||||||
|
cargo vendor > $DIST/.cargo/config
|
||||||
|
# Move vendor into dist tarball directory
|
||||||
|
mv vendor "$DIST"
|
||||||
@@ -1,10 +1,11 @@
|
|||||||
{
|
{
|
||||||
"app-id": "org.freedesktop.ryuukyu.Helvum",
|
"app-id": "org.freedesktop.ryuukyu.Helvum",
|
||||||
"runtime": "org.gnome.Platform",
|
"runtime": "org.gnome.Platform",
|
||||||
"runtime-version": "40",
|
"runtime-version": "41",
|
||||||
"sdk": "org.gnome.Sdk",
|
"sdk": "org.gnome.Sdk",
|
||||||
"sdk-extensions": [
|
"sdk-extensions": [
|
||||||
"org.freedesktop.Sdk.Extension.rust-stable"
|
"org.freedesktop.Sdk.Extension.rust-stable",
|
||||||
|
"org.freedesktop.Sdk.Extension.llvm12"
|
||||||
],
|
],
|
||||||
"command": "helvum",
|
"command": "helvum",
|
||||||
"finish-args": [
|
"finish-args": [
|
||||||
@@ -15,7 +16,8 @@
|
|||||||
"--filesystem=xdg-run/pipewire-0"
|
"--filesystem=xdg-run/pipewire-0"
|
||||||
],
|
],
|
||||||
"build-options": {
|
"build-options": {
|
||||||
"append-path": "/usr/lib/sdk/rust-stable/bin",
|
"append-path": "/usr/lib/sdk/rust-stable/bin:/usr/lib/sdk/llvm12/bin",
|
||||||
|
"prepend-ld-library-path": "/usr/lib/sdk/llvm12/lib",
|
||||||
"build-args": [
|
"build-args": [
|
||||||
"--share=network"
|
"--share=network"
|
||||||
]
|
]
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 53 KiB After Width: | Height: | Size: 65 KiB |
16
meson.build
16
meson.build
@@ -1,7 +1,7 @@
|
|||||||
project(
|
project(
|
||||||
'helvum',
|
'helvum',
|
||||||
'rust',
|
'rust',
|
||||||
version: '0.3.1',
|
version: '0.3.2',
|
||||||
license: 'GPL-3.0',
|
license: 'GPL-3.0',
|
||||||
meson_version: '>=0.50.0'
|
meson_version: '>=0.50.0'
|
||||||
)
|
)
|
||||||
@@ -9,15 +9,9 @@ project(
|
|||||||
base_id = 'org.freedesktop.ryuukyu.Helvum'
|
base_id = 'org.freedesktop.ryuukyu.Helvum'
|
||||||
|
|
||||||
dependency('glib-2.0', version: '>= 2.48')
|
dependency('glib-2.0', version: '>= 2.48')
|
||||||
dependency('gtk4', version: '>= 4.0.0')
|
dependency('gtk4', version: '>= 4.4.0')
|
||||||
dependency('libpipewire-0.3')
|
dependency('libpipewire-0.3')
|
||||||
|
|
||||||
rust_version = meson.get_compiler('rust').version()
|
|
||||||
min_rust_version = '1.54.0'
|
|
||||||
if rust_version < min_rust_version
|
|
||||||
error('Rust version too old: Required version is ' + min_rust_version + ' but actual version is ' + rust_version)
|
|
||||||
endif
|
|
||||||
|
|
||||||
desktop_file_validate = find_program('desktop-file-validate', required: false)
|
desktop_file_validate = find_program('desktop-file-validate', required: false)
|
||||||
cargo = find_program('cargo', required: true)
|
cargo = find_program('cargo', required: true)
|
||||||
cargo_script = find_program('build-aux/cargo.sh')
|
cargo_script = find_program('build-aux/cargo.sh')
|
||||||
@@ -27,6 +21,12 @@ bindir = prefix / get_option('bindir')
|
|||||||
datadir = prefix / get_option('datadir')
|
datadir = prefix / get_option('datadir')
|
||||||
iconsdir = datadir / 'icons'
|
iconsdir = datadir / 'icons'
|
||||||
|
|
||||||
|
meson.add_dist_script(
|
||||||
|
'build-aux/dist-vendor.sh',
|
||||||
|
meson.build_root() / 'meson-dist' / meson.project_name() + '-' + meson.project_version(),
|
||||||
|
meson.source_root()
|
||||||
|
)
|
||||||
|
|
||||||
cargo_sources = files(
|
cargo_sources = files(
|
||||||
'Cargo.toml',
|
'Cargo.toml',
|
||||||
'Cargo.lock',
|
'Cargo.lock',
|
||||||
|
|||||||
@@ -1,3 +1,22 @@
|
|||||||
|
// application.rs
|
||||||
|
//
|
||||||
|
// Copyright 2021 Tom A. Wagner <tom.a.wagner@protonmail.com>
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// 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 <http://www.gnu.org/licenses/>.
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-only
|
||||||
|
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
|
|
||||||
use gtk::{
|
use gtk::{
|
||||||
|
|||||||
19
src/main.rs
19
src/main.rs
@@ -1,3 +1,22 @@
|
|||||||
|
// main.rs
|
||||||
|
//
|
||||||
|
// Copyright 2021 Tom A. Wagner <tom.a.wagner@protonmail.com>
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// 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 <http://www.gnu.org/licenses/>.
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-only
|
||||||
|
|
||||||
mod application;
|
mod application;
|
||||||
mod pipewire_connection;
|
mod pipewire_connection;
|
||||||
mod view;
|
mod view;
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ rust_sources = files(
|
|||||||
'main.rs',
|
'main.rs',
|
||||||
'pipewire_connection.rs',
|
'pipewire_connection.rs',
|
||||||
'pipewire_connection/state.rs',
|
'pipewire_connection/state.rs',
|
||||||
|
'style.css',
|
||||||
'view/graph_view.rs',
|
'view/graph_view.rs',
|
||||||
'view/mod.rs',
|
'view/mod.rs',
|
||||||
'view/node.rs',
|
'view/node.rs',
|
||||||
|
|||||||
@@ -1,3 +1,22 @@
|
|||||||
|
// pipewire_connection.rs
|
||||||
|
//
|
||||||
|
// Copyright 2021 Tom A. Wagner <tom.a.wagner@protonmail.com>
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// 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 <http://www.gnu.org/licenses/>.
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-only
|
||||||
|
|
||||||
mod state;
|
mod state;
|
||||||
|
|
||||||
use std::{cell::RefCell, collections::HashMap, rc::Rc};
|
use std::{cell::RefCell, collections::HashMap, rc::Rc};
|
||||||
|
|||||||
@@ -1,3 +1,22 @@
|
|||||||
|
// state.rs
|
||||||
|
//
|
||||||
|
// Copyright 2021 Tom A. Wagner <tom.a.wagner@protonmail.com>
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// 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 <http://www.gnu.org/licenses/>.
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-only
|
||||||
|
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
use crate::MediaType;
|
use crate::MediaType;
|
||||||
|
|||||||
@@ -1,14 +1,23 @@
|
|||||||
|
@define-color audio rgb(50,100,240);
|
||||||
|
@define-color video rgb(200,200,0);
|
||||||
|
@define-color midi rgb(200,0,50);
|
||||||
|
@define-color graphview-link #808080;
|
||||||
|
|
||||||
.audio {
|
.audio {
|
||||||
background: rgb(50,100,240);
|
background: @audio;
|
||||||
color: black;
|
color: black;
|
||||||
}
|
}
|
||||||
|
|
||||||
.video {
|
.video {
|
||||||
background: rgb(200,200,0);
|
background: @video;
|
||||||
color: black;
|
color: black;
|
||||||
}
|
}
|
||||||
|
|
||||||
.midi {
|
.midi {
|
||||||
background: rgb(200,0,50);
|
background: @midi;
|
||||||
color: black;
|
color: black;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
graphview {
|
||||||
|
background: @text_view_bg;
|
||||||
|
}
|
||||||
@@ -1,3 +1,22 @@
|
|||||||
|
// graph_view.rs
|
||||||
|
//
|
||||||
|
// Copyright 2021 Tom A. Wagner <tom.a.wagner@protonmail.com>
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// 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 <http://www.gnu.org/licenses/>.
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-only
|
||||||
|
|
||||||
use super::{Node, Port};
|
use super::{Node, Port};
|
||||||
|
|
||||||
use gtk::{
|
use gtk::{
|
||||||
@@ -35,6 +54,7 @@ mod imp {
|
|||||||
fn class_init(klass: &mut Self::Class) {
|
fn class_init(klass: &mut Self::Class) {
|
||||||
// The layout manager determines how child widgets are laid out.
|
// The layout manager determines how child widgets are laid out.
|
||||||
klass.set_layout_manager_type::<gtk::FixedLayout>();
|
klass.set_layout_manager_type::<gtk::FixedLayout>();
|
||||||
|
klass.set_css_name("graphview");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -104,24 +124,13 @@ mod imp {
|
|||||||
Try to use relative units (em) and colours from the theme as much as possible. */
|
Try to use relative units (em) and colours from the theme as much as possible. */
|
||||||
|
|
||||||
let alloc = widget.allocation();
|
let alloc = widget.allocation();
|
||||||
|
let widget_bounds =
|
||||||
|
graphene::Rect::new(0.0, 0.0, alloc.width as f32, alloc.height as f32);
|
||||||
|
|
||||||
let background_cr = snapshot
|
let background_cr = snapshot
|
||||||
.append_cairo(&graphene::Rect::new(
|
.append_cairo(&widget_bounds)
|
||||||
0.0,
|
|
||||||
0.0,
|
|
||||||
alloc.width as f32,
|
|
||||||
alloc.height as f32,
|
|
||||||
))
|
|
||||||
.expect("Failed to get cairo context");
|
.expect("Failed to get cairo context");
|
||||||
|
|
||||||
// Try to replace the background color with a darker one from the theme.
|
|
||||||
if let Some(rgba) = widget.style_context().lookup_color("text_view_bg") {
|
|
||||||
background_cr.set_source_rgb(rgba.red.into(), rgba.green.into(), rgba.blue.into());
|
|
||||||
if let Err(e) = background_cr.paint() {
|
|
||||||
warn!("Failed to paint graphview background: {}", e);
|
|
||||||
};
|
|
||||||
} // TODO: else log colour not found
|
|
||||||
|
|
||||||
// Draw a nice grid on the background.
|
// Draw a nice grid on the background.
|
||||||
background_cr.set_source_rgb(0.18, 0.18, 0.18);
|
background_cr.set_source_rgb(0.18, 0.18, 0.18);
|
||||||
background_cr.set_line_width(0.2); // TODO: Set to 1px
|
background_cr.set_line_width(0.2); // TODO: Set to 1px
|
||||||
@@ -156,8 +165,25 @@ mod imp {
|
|||||||
alloc.height as f32,
|
alloc.height as f32,
|
||||||
))
|
))
|
||||||
.expect("Failed to get cairo context");
|
.expect("Failed to get cairo context");
|
||||||
|
|
||||||
link_cr.set_line_width(2.0);
|
link_cr.set_line_width(2.0);
|
||||||
link_cr.set_source_rgb(0.0, 0.0, 0.0);
|
|
||||||
|
let gtk::gdk::RGBA {
|
||||||
|
red,
|
||||||
|
green,
|
||||||
|
blue,
|
||||||
|
alpha,
|
||||||
|
} = widget
|
||||||
|
.style_context()
|
||||||
|
.lookup_color("graphview-link")
|
||||||
|
.unwrap_or(gtk::gdk::RGBA {
|
||||||
|
red: 0.0,
|
||||||
|
green: 0.0,
|
||||||
|
blue: 0.0,
|
||||||
|
alpha: 0.0,
|
||||||
|
});
|
||||||
|
link_cr.set_source_rgba(red.into(), green.into(), blue.into(), alpha.into());
|
||||||
|
|
||||||
for (link, active) in self.links.borrow().values() {
|
for (link, active) in self.links.borrow().values() {
|
||||||
if let Some((from_x, from_y, to_x, to_y)) = self.get_link_coordinates(link) {
|
if let Some((from_x, from_y, to_x, to_y)) = self.get_link_coordinates(link) {
|
||||||
link_cr.move_to(from_x, from_y);
|
link_cr.move_to(from_x, from_y);
|
||||||
@@ -169,15 +195,24 @@ mod imp {
|
|||||||
link_cr.set_dash(&[10.0, 5.0], 0.0);
|
link_cr.set_dash(&[10.0, 5.0], 0.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If the output port is farther right than the input port and they have
|
||||||
|
// a similar y coordinate, apply a y offset to the control points
|
||||||
|
// so that the curve sticks out a bit.
|
||||||
|
let y_control_offset = if from_x > to_x {
|
||||||
|
f64::max(0.0, 25.0 - (from_y - to_y).abs())
|
||||||
|
} else {
|
||||||
|
0.0
|
||||||
|
};
|
||||||
|
|
||||||
// Place curve control offset by half the x distance between the two points.
|
// Place curve control offset by half the x distance between the two points.
|
||||||
// This makes the curve scale well for varying distances between the two ports,
|
// This makes the curve scale well for varying distances between the two ports,
|
||||||
// especially when the output port is farther right than the input port.
|
// especially when the output port is farther right than the input port.
|
||||||
let half_x_dist = f64::abs(from_x - to_x) / 2.0;
|
let half_x_dist = f64::abs(from_x - to_x) / 2.0;
|
||||||
link_cr.curve_to(
|
link_cr.curve_to(
|
||||||
from_x + half_x_dist,
|
from_x + half_x_dist,
|
||||||
from_y,
|
from_y - y_control_offset,
|
||||||
to_x - half_x_dist,
|
to_x - half_x_dist,
|
||||||
to_y,
|
to_y - y_control_offset,
|
||||||
to_x,
|
to_x,
|
||||||
to_y,
|
to_y,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,3 +1,22 @@
|
|||||||
|
// mod.rs
|
||||||
|
//
|
||||||
|
// Copyright 2021 Tom A. Wagner <tom.a.wagner@protonmail.com>
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// 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 <http://www.gnu.org/licenses/>.
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-only
|
||||||
|
|
||||||
//! The view presented to the user.
|
//! The view presented to the user.
|
||||||
//!
|
//!
|
||||||
//! This module contains gtk widgets needed to present the graphical user interface.
|
//! This module contains gtk widgets needed to present the graphical user interface.
|
||||||
|
|||||||
@@ -1,3 +1,22 @@
|
|||||||
|
// node.rs
|
||||||
|
//
|
||||||
|
// Copyright 2021 Tom A. Wagner <tom.a.wagner@protonmail.com>
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// 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 <http://www.gnu.org/licenses/>.
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-only
|
||||||
|
|
||||||
use gtk::{glib, prelude::*, subclass::prelude::*};
|
use gtk::{glib, prelude::*, subclass::prelude::*};
|
||||||
use pipewire::spa::Direction;
|
use pipewire::spa::Direction;
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,22 @@
|
|||||||
|
// port.rs
|
||||||
|
//
|
||||||
|
// Copyright 2021 Tom A. Wagner <tom.a.wagner@protonmail.com>
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// 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 <http://www.gnu.org/licenses/>.
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-only
|
||||||
|
|
||||||
use gtk::{
|
use gtk::{
|
||||||
gdk,
|
gdk,
|
||||||
glib::{self, clone, subclass::Signal},
|
glib::{self, clone, subclass::Signal},
|
||||||
|
|||||||
Reference in New Issue
Block a user