Skip to content

Commit

Permalink
Simplify Audio Preferences by adopting Flex Groups and Update Prefere…
Browse files Browse the repository at this point in the history
…nces Diagram based on these changes.
  • Loading branch information
divark committed May 8, 2024
1 parent 4ae7ec7 commit 1bed0fa
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 52 deletions.
58 changes: 29 additions & 29 deletions docs/drawio_diagrams/preferences_mock.drawio
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<mxfile host="Electron" modified="2024-05-07T22:33:07.586Z" agent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/24.2.5 Chrome/120.0.6099.109 Electron/28.1.0 Safari/537.36" etag="jEma7kI4krBBr6WqzmpG" version="24.2.5" type="device" pages="4">
<mxfile host="Electron" modified="2024-05-08T17:59:34.905Z" agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/24.2.5 Chrome/120.0.6099.109 Electron/28.1.0 Safari/537.36" etag="qbc5yaJS1oVgut69F-Sj" version="24.2.5" type="device" pages="4">
<diagram id="t6W-nHp2AaDdZkX4JSfC" name="General">
<mxGraphModel dx="984" dy="683" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" math="0" shadow="0">
<mxGraphModel dx="548" dy="827" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
Expand Down Expand Up @@ -109,7 +109,7 @@
</mxGraphModel>
</diagram>
<diagram id="EILjyNlQ_RmkPIFJ16MW" name="Audio">
<mxGraphModel dx="984" dy="683" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" math="0" shadow="0">
<mxGraphModel dx="794" dy="1199" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
Expand Down Expand Up @@ -215,7 +215,7 @@
</mxGraphModel>
</diagram>
<diagram id="WzMNUKS4J1rxnj-n8jQC" name="Video">
<mxGraphModel dx="984" dy="683" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" math="0" shadow="0">
<mxGraphModel dx="794" dy="1199" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
Expand Down Expand Up @@ -305,7 +305,7 @@
</mxGraphModel>
</diagram>
<diagram id="hqq63PKYIQXvvrozvZpL" name="Text">
<mxGraphModel dx="984" dy="683" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" math="0" shadow="0">
<mxGraphModel dx="548" dy="827" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
Expand Down Expand Up @@ -395,50 +395,50 @@
<mxCell id="xXy2l-rx2j43WZQwSsjW-21" value="Apply" style="strokeWidth=1;shadow=0;dashed=0;align=center;html=1;shape=mxgraph.mockup.buttons.button;strokeColor=#666666;fontColor=#ffffff;mainText=;buttonStyle=round;fontSize=17;fontStyle=1;fillColor=#008cff;whiteSpace=wrap;" parent="1" vertex="1">
<mxGeometry x="540" y="520" width="150" height="50" as="geometry" />
</mxCell>
<mxCell id="-v_UsrcQn-14C4ZhW0k0-1" value="" style="rounded=0;whiteSpace=wrap;html=1;fontSize=16;fillColor=none;" vertex="1" parent="1">
<mxCell id="-v_UsrcQn-14C4ZhW0k0-1" value="" style="rounded=0;whiteSpace=wrap;html=1;fontSize=16;fillColor=none;" parent="1" vertex="1">
<mxGeometry x="220" y="680" width="400" height="340" as="geometry" />
</mxCell>
<mxCell id="-v_UsrcQn-14C4ZhW0k0-2" value="" style="rounded=0;whiteSpace=wrap;html=1;fontSize=16;fillColor=none;" vertex="1" parent="1">
<mxCell id="-v_UsrcQn-14C4ZhW0k0-2" value="" style="rounded=0;whiteSpace=wrap;html=1;fontSize=16;fillColor=none;" parent="1" vertex="1">
<mxGeometry x="230" y="690" width="380" height="280" as="geometry" />
</mxCell>
<mxCell id="-v_UsrcQn-14C4ZhW0k0-3" value="" style="rounded=0;whiteSpace=wrap;html=1;fontSize=16;fillColor=none;" vertex="1" parent="1">
<mxCell id="-v_UsrcQn-14C4ZhW0k0-3" value="" style="rounded=0;whiteSpace=wrap;html=1;fontSize=16;fillColor=none;" parent="1" vertex="1">
<mxGeometry x="240" y="710" width="360" height="250" as="geometry" />
</mxCell>
<mxCell id="-v_UsrcQn-14C4ZhW0k0-7" value="&lt;b&gt;Window Wireframe to Scale&lt;/b&gt;" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
<mxCell id="-v_UsrcQn-14C4ZhW0k0-7" value="&lt;b&gt;Window Wireframe to Scale&lt;/b&gt;" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="342.5" y="650" width="165" height="30" as="geometry" />
</mxCell>
<mxCell id="-v_UsrcQn-14C4ZhW0k0-8" value="" style="rounded=0;whiteSpace=wrap;html=1;fillColor=none;" vertex="1" parent="1">
<mxCell id="-v_UsrcQn-14C4ZhW0k0-8" value="" style="rounded=0;whiteSpace=wrap;html=1;fillColor=none;" parent="1" vertex="1">
<mxGeometry x="550" y="980" width="60" height="30" as="geometry" />
</mxCell>
<mxCell id="-v_UsrcQn-14C4ZhW0k0-9" value="" style="rounded=0;whiteSpace=wrap;html=1;fillColor=none;" vertex="1" parent="1">
<mxCell id="-v_UsrcQn-14C4ZhW0k0-9" value="" style="rounded=0;whiteSpace=wrap;html=1;fillColor=none;" parent="1" vertex="1">
<mxGeometry x="480" y="980" width="60" height="30" as="geometry" />
</mxCell>
<mxCell id="v-v-7zWjZiEL_dCHlDGz-1" value="" style="rounded=0;whiteSpace=wrap;html=1;fillColor=none;" vertex="1" parent="1">
<mxGeometry x="250" y="730" width="340" height="220" as="geometry" />
<mxCell id="v-v-7zWjZiEL_dCHlDGz-3" value="" style="rounded=0;whiteSpace=wrap;html=1;fillColor=none;" parent="1" vertex="1">
<mxGeometry x="240" y="720" width="360" height="130" as="geometry" />
</mxCell>
<mxCell id="v-v-7zWjZiEL_dCHlDGz-3" value="" style="rounded=0;whiteSpace=wrap;html=1;fillColor=none;" vertex="1" parent="1">
<mxGeometry x="260" y="740" width="320" height="130" as="geometry" />
<mxCell id="v-v-7zWjZiEL_dCHlDGz-4" value="" style="rounded=0;whiteSpace=wrap;html=1;fillColor=none;" parent="1" vertex="1">
<mxGeometry x="370" y="730" width="140" height="30" as="geometry" />
</mxCell>
<mxCell id="v-v-7zWjZiEL_dCHlDGz-4" value="" style="rounded=0;whiteSpace=wrap;html=1;fillColor=none;" vertex="1" parent="1">
<mxGeometry x="350" y="750" width="140" height="30" as="geometry" />
<mxCell id="LQvFGXu00pqhQCmczCRT-1" value="" style="rounded=0;whiteSpace=wrap;html=1;fillColor=none;" parent="1" vertex="1">
<mxGeometry x="560" y="730" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="LQvFGXu00pqhQCmczCRT-1" value="" style="rounded=0;whiteSpace=wrap;html=1;fillColor=none;" vertex="1" parent="1">
<mxGeometry x="540" y="750" width="30" height="30" as="geometry" />
<mxCell id="LQvFGXu00pqhQCmczCRT-2" value="" style="rounded=0;whiteSpace=wrap;html=1;fillColor=none;" parent="1" vertex="1">
<mxGeometry x="520" y="730" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="LQvFGXu00pqhQCmczCRT-2" value="" style="rounded=0;whiteSpace=wrap;html=1;fillColor=none;" vertex="1" parent="1">
<mxGeometry x="500" y="750" width="30" height="30" as="geometry" />
<mxCell id="LQvFGXu00pqhQCmczCRT-3" value="" style="rounded=0;whiteSpace=wrap;html=1;fillColor=none;" parent="1" vertex="1">
<mxGeometry x="370" y="770" width="140" height="30" as="geometry" />
</mxCell>
<mxCell id="LQvFGXu00pqhQCmczCRT-3" value="" style="rounded=0;whiteSpace=wrap;html=1;fillColor=none;" vertex="1" parent="1">
<mxGeometry x="350" y="790" width="140" height="30" as="geometry" />
<mxCell id="LQvFGXu00pqhQCmczCRT-4" value="" style="rounded=0;whiteSpace=wrap;html=1;fillColor=none;" parent="1" vertex="1">
<mxGeometry x="370" y="810" width="140" height="30" as="geometry" />
</mxCell>
<mxCell id="LQvFGXu00pqhQCmczCRT-4" value="" style="rounded=0;whiteSpace=wrap;html=1;fillColor=none;" vertex="1" parent="1">
<mxGeometry x="350" y="830" width="140" height="30" as="geometry" />
<mxCell id="LQvFGXu00pqhQCmczCRT-5" value="" style="rounded=0;whiteSpace=wrap;html=1;fillColor=none;" parent="1" vertex="1">
<mxGeometry x="520" y="770" width="70" height="30" as="geometry" />
</mxCell>
<mxCell id="LQvFGXu00pqhQCmczCRT-5" value="" style="rounded=0;whiteSpace=wrap;html=1;fillColor=none;" vertex="1" parent="1">
<mxGeometry x="500" y="790" width="70" height="30" as="geometry" />
<mxCell id="LQvFGXu00pqhQCmczCRT-6" value="" style="rounded=0;whiteSpace=wrap;html=1;fillColor=none;" parent="1" vertex="1">
<mxGeometry x="520" y="810" width="70" height="30" as="geometry" />
</mxCell>
<mxCell id="LQvFGXu00pqhQCmczCRT-6" value="" style="rounded=0;whiteSpace=wrap;html=1;fillColor=none;" vertex="1" parent="1">
<mxGeometry x="500" y="830" width="70" height="30" as="geometry" />
<mxCell id="gVWfTgkkwnY-IVpjYeiK-1" value="" style="rounded=0;whiteSpace=wrap;html=1;fillColor=none;" vertex="1" parent="1">
<mxGeometry x="240" y="730" width="360" height="30" as="geometry" />
</mxCell>
</root>
</mxGraphModel>
Expand Down
62 changes: 39 additions & 23 deletions src/ui/dialogs/preferences.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use fltk::{
button::{Button, CheckButton},
dialog,
enums::{Align, Font, FrameType},
group::{Group, Tabs},
group::{Flex, FlexType, Group, Tabs},
input::Input,
misc::{InputChoice, Spinner},
prelude::{DisplayExt, GroupExt, WidgetBase, WidgetExt, WindowExt},
Expand Down Expand Up @@ -122,9 +122,16 @@ struct TextTabWidgets {
}

fn create_text_tab() -> TextTabWidgets {

Check warning on line 124 in src/ui/dialogs/preferences.rs

View workflow job for this annotation

GitHub Actions / clippy

function `create_text_tab` is never used

warning: function `create_text_tab` is never used --> src/ui/dialogs/preferences.rs:124:4 | 124 | fn create_text_tab() -> TextTabWidgets { | ^^^^^^^^^^^^^^^
let text_tab = Group::new(20, 30, 360, 250, "Text\t\t");
let mut text_tab = Flex::new(20, 30, 360, 250, "Text\t\t");
text_tab.set_type(FlexType::Column);
text_tab.set_spacing(10);

todo!("create_text_tab: This needs to be implemented with flex boxes in mind.")
let mut extraction_group = Flex::new(20, 40, 360, 150, "Extraction:");
extraction_group.set_type(FlexType::Column);
extraction_group.set_label_font(Font::HelveticaBold);
extraction_group.set_frame(FrameType::ThinDownFrame);

todo!("create_text_tab: This needs to be implemented with flex boxes in mind.");
}

struct AudioTabWidgets {
Expand All @@ -138,7 +145,8 @@ struct AudioTabWidgets {
fn create_audio_tab() -> AudioTabWidgets {
let audio_tab = Group::new(20, 30, 360, 250, "Audio\t\t");

let mut output_widget_group = Group::new(20, 40, 360, 50, "Output");
let mut output_widget_group = Flex::new(20, 40, 360, 50, "Output");
output_widget_group.set_type(FlexType::Column);
let output_label_offset = output_widget_group.label_size();
output_widget_group.set_align(Align::TopLeft);
output_widget_group.set_pos(
Expand All @@ -147,36 +155,44 @@ fn create_audio_tab() -> AudioTabWidgets {
);
output_widget_group.set_label_font(Font::HelveticaBold);
output_widget_group.set_frame(FrameType::ThinDownFrame);
let audio_output_name =
InputChoice::new(40 + 90, 50 + output_label_offset, 320 - 80, 30, "Device:");

let audio_output_name = InputChoice::default()
.with_size(0, 30)
.with_label("Device:");

output_widget_group.set_margins(100, 10, 10, 0);
output_widget_group.set_pad(10);
output_widget_group.fixed(&audio_output_name, 30);
output_widget_group.end();

let mut input_widget_group = Group::new(
let mut input_widget_group = Flex::new(
20,
110 + output_label_offset,
360,
170 - output_label_offset,
"Input",
);
input_widget_group.set_type(FlexType::Column);
input_widget_group.set_align(Align::TopLeft);
input_widget_group.set_label_font(Font::HelveticaBold);
input_widget_group.set_frame(FrameType::ThinDownFrame);
let audio_input_name =
InputChoice::new(40 + 90, 120 + output_label_offset, 320 - 80, 30, "Device:");
let audio_input_sample_rate = InputChoice::new(
40 + 90,
160 + output_label_offset,
320 - 80,
30,
"Sample Rate:",
);
let audio_input_channels = InputChoice::new(
40 + 90,
200 + output_label_offset,
320 - 80,
30,
"Channels:",
);

let audio_input_name = InputChoice::default()
.with_size(0, 30)
.with_label("Device:");
let audio_input_sample_rate = InputChoice::default()
.with_size(0, 30)
.with_label("Sample Rate:");
let audio_input_channels = InputChoice::default()
.with_size(0, 30)
.with_label("Channels");

input_widget_group.fixed(&audio_input_name, 30);
input_widget_group.fixed(&audio_input_sample_rate, 30);
input_widget_group.fixed(&audio_input_channels, 30);

input_widget_group.set_margins(100, 10, 10, 0);
input_widget_group.set_pad(10);
input_widget_group.end();

audio_tab.end();
Expand Down

0 comments on commit 1bed0fa

Please sign in to comment.