Skip to content

Commit

Permalink
Removed obsolete code
Browse files Browse the repository at this point in the history
  • Loading branch information
sourcebox committed Jan 25, 2022
1 parent 07aaedf commit dc3f6af
Showing 1 changed file with 4 additions and 18 deletions.
22 changes: 4 additions & 18 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,6 @@ pub struct App {
/// MPSC sender to cancel the transmit thread
#[serde(skip)]
transmit_thread_sender: Option<std::sync::mpsc::Sender<bool>>,

/// Frame count, incremented on each update() call
#[serde(skip)]
frame_count: u64,
}

////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -181,7 +177,6 @@ impl Default for App {
error_message: None,
message_channel: std::sync::mpsc::channel(),
transmit_thread_sender: None,
frame_count: 0,
}
}
}
Expand All @@ -201,7 +196,7 @@ impl epi::App for App {
fn setup(
&mut self,
_ctx: &egui::CtxRef,
_frame: &epi::Frame,
frame: &epi::Frame,
storage: Option<&dyn epi::Storage>,
) {
if let Some(storage) = storage {
Expand All @@ -214,26 +209,19 @@ impl epi::App for App {
message_sender.send(Message::RescanDevices).ok();
std::thread::sleep(std::time::Duration::from_millis(250));
});

frame.set_window_size(WINDOW_SIZE);
}

/// Called each time the UI needs repainting, which may be many times per second.
fn update(&mut self, ctx: &egui::CtxRef, frame: &epi::Frame) {
fn update(&mut self, ctx: &egui::CtxRef, _frame: &epi::Frame) {
// Continuous run mode is required for message processing
ctx.request_repaint();

while let Ok(message) = self.message_channel.1.try_recv() {
self.process_message(&message);
}

if self.frame_count == 0 {
// Set window size on first frame
frame.set_window_size(WINDOW_SIZE);
} else if self.frame_count == 1 {
// Scan MIDI devices on second frame instead of first
// This makes the GUI show up faster
self.message_channel.0.send(Message::RescanDevices).ok();
}

egui::CentralPanel::default().show(ctx, |ui| {
ui.add_space(10.0);

Expand Down Expand Up @@ -408,8 +396,6 @@ impl epi::App for App {
});
});
});

self.frame_count += 1;
}
}

Expand Down

0 comments on commit dc3f6af

Please sign in to comment.