Commit 016fddbc authored by René Rössler's avatar René Rössler 😍
Browse files

add button to take preview live

parent d03d65fd
Pipeline #103242314 passed with stage
in 10 minutes and 55 seconds
......@@ -11,6 +11,7 @@ mod master_dimmer;
mod palettes;
mod preferences;
mod presets;
mod preview_to_live;
mod render_groups;
mod rgba_conversion;
mod sidepanels;
......@@ -84,6 +85,7 @@ fn create_window(renderer: Arc<RwLock<Renderer>>, application: &Application) {
ignore_signals.clone(),
dirty.clone(),
);
preview_to_live::init(&builder, renderer.clone(), update_ui.clone(), dirty.clone());
render_groups::init(
&builder,
renderer.clone(),
......
......@@ -1369,8 +1369,9 @@ Markus Schwald &lt;maize@freakmail.de&gt;
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property>
<child>
<object class="GtkFrame">
<object class="GtkFrame" id="live">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label_xalign">0</property>
......@@ -1407,6 +1408,20 @@ Markus Schwald &lt;maize@freakmail.de&gt;
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="preview_to_live">
<property name="label" translatable="yes">Preview 🡆 Live</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<accelerator key="space" signal="activate"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkFrame" id="preview">
<property name="visible">True</property>
......@@ -1442,7 +1457,7 @@ Markus Schwald &lt;maize@freakmail.de&gt;
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
<property name="position">2</property>
</packing>
</child>
</object>
......
use super::{update_ui::UpdateUiConfig, Dirty};
use gled::Renderer;
use glib::Sender;
use gtk::{prelude::*, Builder, Button};
use std::sync::{atomic::Ordering, Arc, RwLock};
pub fn init(
builder: &Builder,
renderer: Arc<RwLock<Renderer>>,
update_ui: Sender<UpdateUiConfig>,
dirty: Arc<Dirty>,
) {
let preview_to_live: Button = builder.get_object("preview_to_live").unwrap();
preview_to_live.connect_clicked(move |_| {
let renderer = renderer.read().unwrap();
let mut config = renderer.config.write().unwrap();
config.live_preset = config.preview_preset;
config.live_palette = config.preview_palette;
dirty.presets.store(true, Ordering::Relaxed);
dirty.palettes.store(true, Ordering::Relaxed);
let _ = update_ui.send(UpdateUiConfig::default());
});
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment