Skip to content

Commit

Permalink
Remaining manual fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
JonasAlaif committed May 30, 2024
1 parent 38dd90c commit 60f0d2d
Show file tree
Hide file tree
Showing 27 changed files with 169 additions and 346 deletions.
12 changes: 10 additions & 2 deletions axiom-profiler-GUI/src/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,11 @@ impl FileDataComponent {
finished.is_timeout(),
cancel,
)));
link.send_message(Msg::LoadedFile(parser.take_parser(), finished, cancel))
link.send_message(Msg::LoadedFile(
Box::new(parser.take_parser()),
finished,
cancel,
))
});
}
Err((_err, _stream)) => {
Expand Down Expand Up @@ -218,7 +222,11 @@ impl FileDataComponent {
finished.is_timeout(),
cancel,
)));
link.send_message(Msg::LoadedFile(parser.take_parser(), finished, cancel))
link.send_message(Msg::LoadedFile(
Box::new(parser.take_parser()),
finished,
cancel,
))
});
});
self.reader = Some(reader);
Expand Down
26 changes: 13 additions & 13 deletions axiom-profiler-GUI/src/filters/manage_filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ impl Component for DraggableList {
.filter(|_| changed)
.and_then(|p| p.lock().ok())
{
*pd = !(drag.start_idx == drag.idx && !drag.delete);
*pd = drag.start_idx != drag.idx || drag.delete;
}
changed
}
Expand Down Expand Up @@ -279,13 +279,13 @@ impl Component for DraggableList {
e.prevent_default();
return;
}
e.data_transfer().map(|dt| {
if let Some(dt) = e.data_transfer() {
let pos = *mouse_position().read().unwrap();
let node = node_ref.cast::<web_sys::Element>().unwrap();
let rect = node.get_bounding_client_rect();
let (x, y) = (pos.x as f64 - rect.left(), pos.y as f64 - rect.top());
dt.set_drag_image(&placeholder_ref.cast::<web_sys::Element>().unwrap(), x as i32, y as i32);
});
}
link.send_message(Msg::OnDragStart(orig_idx, curr_idx))
});
let ondrag = ctx.link().callback(|_| Msg::OnDrag);
Expand Down Expand Up @@ -374,17 +374,17 @@ pub fn ExistingFilter(props: &ExistingFilterProps) -> Html {

impl Filter {
pub fn is_editable(&self) -> bool {
match self {
!matches!(
self,
Filter::IgnoreTheorySolving
| Filter::ShowMatchingLoopSubgraph
| Filter::IgnoreQuantifier(None)
| Filter::IgnoreAllButQuantifier(None)
| Filter::ShowNeighbours(..)
| Filter::VisitSourceTree(..)
| Filter::VisitSubTreeWithRoot(..)
| Filter::ShowLongestPath(..) => false,
_ => true,
}
| Filter::ShowMatchingLoopSubgraph
| Filter::IgnoreQuantifier(None)
| Filter::IgnoreAllButQuantifier(None)
| Filter::ShowNeighbours(..)
| Filter::VisitSourceTree(..)
| Filter::VisitSubTreeWithRoot(..)
| Filter::ShowLongestPath(..)
)
}
pub fn update(&self, new_data: Vec<usize>, new_strings: Vec<String>) -> Filter {
match self {
Expand Down
2 changes: 1 addition & 1 deletion axiom-profiler-GUI/src/filters/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
mod add_filter;
mod manage_filter;

use std::{borrow::Borrow, fmt::Display};
use std::fmt::Display;

use material_yew::icon::MatIcon;
use petgraph::Direction;
Expand Down
40 changes: 20 additions & 20 deletions axiom-profiler-GUI/src/global_callbacks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,15 +144,15 @@ impl CallbackRegisterer<DragEvent> {
impl GlobalCallbacksProvider {
fn get_mouse_mut(&mut self, kind: MouseEventKind) -> &mut CallbackHolder<MouseEvent> {
match kind {
MouseEventKind::MouseMove => &mut self.mouse_move,
MouseEventKind::MouseUp => &mut self.mouse_up,
MouseEventKind::MouseOut => &mut self.mouse_out,
MouseEventKind::Move => &mut self.mouse_move,
MouseEventKind::Up => &mut self.mouse_up,
MouseEventKind::Out => &mut self.mouse_out,
}
}
fn get_keyboard_mut(&mut self, kind: KeyboardEventKind) -> &mut CallbackHolder<KeyboardEvent> {
match kind {
KeyboardEventKind::KeyDown => &mut self.keyboard_down,
KeyboardEventKind::KeyUp => &mut self.keyboard_up,
KeyboardEventKind::Down => &mut self.keyboard_down,
KeyboardEventKind::Up => &mut self.keyboard_up,
}
}
fn get_drag_mut(&mut self, kind: DragEventKind) -> &mut CallbackHolder<DragEvent> {
Expand All @@ -172,15 +172,15 @@ impl GlobalCallbacksProvider {

#[derive(Debug, Copy, Clone)]
pub enum MouseEventKind {
MouseMove,
MouseUp,
MouseOut,
Move,
Up,
Out,
}

#[derive(Debug, Copy, Clone)]
pub enum KeyboardEventKind {
KeyDown,
KeyUp,
Down,
Up,
}

#[derive(Debug, Copy, Clone)]
Expand Down Expand Up @@ -229,23 +229,23 @@ impl Component for GlobalCallbacksProvider {
let registerer = GlobalCallbacks {
register_mouse_move: CallbackRegisterer::new_mouse(
ctx.link().clone(),
MouseEventKind::MouseMove,
MouseEventKind::Move,
),
register_mouse_up: CallbackRegisterer::new_mouse(
ctx.link().clone(),
MouseEventKind::MouseUp,
MouseEventKind::Up,
),
register_mouse_out: CallbackRegisterer::new_mouse(
ctx.link().clone(),
MouseEventKind::MouseOut,
MouseEventKind::Out,
),
register_keyboard_down: CallbackRegisterer::new_keyboard(
ctx.link().clone(),
KeyboardEventKind::KeyDown,
KeyboardEventKind::Down,
),
register_keyboard_up: CallbackRegisterer::new_keyboard(
ctx.link().clone(),
KeyboardEventKind::KeyUp,
KeyboardEventKind::Up,
),
register_drag_over: CallbackRegisterer::new_drag(
ctx.link().clone(),
Expand Down Expand Up @@ -334,13 +334,13 @@ impl Component for GlobalCallbacksProvider {
fn view(&self, ctx: &Context<Self>) -> Html {
let onmousemove = ctx
.link()
.callback(|ev: MouseEvent| Msg::OnMouse(MouseEventKind::MouseMove, ev));
.callback(|ev: MouseEvent| Msg::OnMouse(MouseEventKind::Move, ev));
let onmouseup = ctx
.link()
.callback(|ev: MouseEvent| Msg::OnMouse(MouseEventKind::MouseUp, ev));
.callback(|ev: MouseEvent| Msg::OnMouse(MouseEventKind::Up, ev));
let onmouseout = ctx
.link()
.callback(|ev: MouseEvent| Msg::OnMouse(MouseEventKind::MouseOut, ev));
.callback(|ev: MouseEvent| Msg::OnMouse(MouseEventKind::Out, ev));
let ondragover = ctx
.link()
.callback(|ev: DragEvent| Msg::OnDrag(DragEventKind::DragOver, ev));
Expand Down Expand Up @@ -377,7 +377,7 @@ impl Component for GlobalCallbacksProvider {
let link = ctx.link().clone();
let onkeydown: Closure<dyn Fn(KeyboardEvent)> =
Closure::new(move |ev: KeyboardEvent| {
link.send_message(Msg::OnKeyboard(KeyboardEventKind::KeyDown, ev))
link.send_message(Msg::OnKeyboard(KeyboardEventKind::Down, ev))
});
window
.add_event_listener_with_callback("keydown", onkeydown.as_ref().unchecked_ref())
Expand All @@ -386,7 +386,7 @@ impl Component for GlobalCallbacksProvider {

let link = ctx.link().clone();
let onkeyup: Closure<dyn Fn(KeyboardEvent)> = Closure::new(move |ev: KeyboardEvent| {
link.send_message(Msg::OnKeyboard(KeyboardEventKind::KeyUp, ev))
link.send_message(Msg::OnKeyboard(KeyboardEventKind::Up, ev))
});
window
.add_event_listener_with_callback("keyup", onkeyup.as_ref().unchecked_ref())
Expand Down
Loading

0 comments on commit 60f0d2d

Please sign in to comment.