refactor: move `Interactor<...>` and friends to new module dir, `interactor`

This commit is contained in:
Mikolaj Wielgus 2024-10-12 17:21:34 +02:00
parent 23d1eaa722
commit c1df3ba8ad
9 changed files with 31 additions and 26 deletions

View File

@ -1,12 +1,9 @@
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release
mod action; mod action;
mod activity;
mod app; mod app;
mod config; mod config;
mod error_dialog; mod error_dialog;
mod interaction;
mod interactor;
mod layers; mod layers;
mod menu_bar; mod menu_bar;
mod overlay; mod overlay;

View File

@ -4,6 +4,10 @@ use topola::{
autorouter::{ autorouter::{
execution::Command, invoker::InvokerError, selection::Selection, AutorouterOptions, execution::Command, invoker::InvokerError, selection::Selection, AutorouterOptions,
}, },
interactor::{
activity::{ActivityContext, ActivityStepperWithStatus},
interaction::InteractionContext,
},
router::RouterOptions, router::RouterOptions,
specctra::design::{LoadingError as SpecctraLoadingError, SpecctraDesign}, specctra::design::{LoadingError as SpecctraLoadingError, SpecctraDesign},
stepper::Abort, stepper::Abort,
@ -11,9 +15,7 @@ use topola::{
use crate::{ use crate::{
action::{Action, Switch, Trigger}, action::{Action, Switch, Trigger},
activity::{ActivityContext, ActivityStepperWithStatus},
app::{execute, handle_file}, app::{execute, handle_file},
interaction::InteractionContext,
translator::Translator, translator::Translator,
viewport::Viewport, viewport::Viewport,
workspace::Workspace, workspace::Workspace,

View File

@ -1,6 +1,8 @@
use std::ops::ControlFlow; use std::ops::ControlFlow;
use crate::{activity::ActivityStepperWithStatus, translator::Translator, viewport::Viewport}; use topola::interactor::activity::ActivityStepperWithStatus;
use crate::{translator::Translator, viewport::Viewport};
pub struct StatusBar {} pub struct StatusBar {}

View File

@ -5,19 +5,16 @@ use std::{
use topola::{ use topola::{
autorouter::{history::History, invoker::Invoker, Autorouter}, autorouter::{history::History, invoker::Invoker, Autorouter},
interactor::{
activity::{ActivityContext, ActivityStepperWithStatus},
interaction::InteractionContext,
Interactor,
},
specctra::{design::SpecctraDesign, mesadata::SpecctraMesadata}, specctra::{design::SpecctraDesign, mesadata::SpecctraMesadata},
stepper::Step, stepper::Step,
}; };
use crate::{ use crate::{error_dialog::ErrorDialog, layers::Layers, overlay::Overlay, translator::Translator};
activity::{ActivityContext, ActivityStepperWithStatus},
error_dialog::ErrorDialog,
interaction::InteractionContext,
interactor::Interactor,
layers::Layers,
overlay::Overlay,
translator::Translator,
};
/// A loaded design and associated structures /// A loaded design and associated structures
pub struct Workspace { pub struct Workspace {

View File

@ -1,7 +1,8 @@
use std::ops::ControlFlow; use std::ops::ControlFlow;
use thiserror::Error; use thiserror::Error;
use topola::{
use crate::{
autorouter::{ autorouter::{
execution::ExecutionStepper, execution::ExecutionStepper,
invoker::{ invoker::{
@ -11,12 +12,11 @@ use topola::{
board::mesadata::AccessMesadata, board::mesadata::AccessMesadata,
drawing::graph::PrimitiveIndex, drawing::graph::PrimitiveIndex,
geometry::primitive::PrimitiveShape, geometry::primitive::PrimitiveShape,
interactor::interaction::{InteractionContext, InteractionError, InteractionStepper},
router::{navcord::NavcordStepper, navmesh::Navmesh}, router::{navcord::NavcordStepper, navmesh::Navmesh},
stepper::{Abort, Step}, stepper::{Abort, Step},
}; };
use crate::interaction::{InteractionContext, InteractionError, InteractionStepper};
pub struct ActivityContext<'a, M: AccessMesadata> { pub struct ActivityContext<'a, M: AccessMesadata> {
pub interaction: InteractionContext, pub interaction: InteractionContext,
pub invoker: &'a mut Invoker<M>, pub invoker: &'a mut Invoker<M>,

View File

@ -1,7 +1,8 @@
use std::ops::ControlFlow; use std::ops::ControlFlow;
use thiserror::Error; use thiserror::Error;
use topola::{
use crate::{
autorouter::invoker::{GetGhosts, GetMaybeNavcord, GetMaybeNavmesh, GetObstacles}, autorouter::invoker::{GetGhosts, GetMaybeNavcord, GetMaybeNavmesh, GetObstacles},
drawing::graph::PrimitiveIndex, drawing::graph::PrimitiveIndex,
geometry::primitive::PrimitiveShape, geometry::primitive::PrimitiveShape,

View File

@ -1,20 +1,20 @@
use std::ops::ControlFlow; use std::ops::ControlFlow;
use spade::InsertionError; use spade::InsertionError;
use topola::{
use crate::{
autorouter::{ autorouter::{
execution::{Command, ExecutionStepper}, execution::Command,
history::History, history::History,
invoker::{Invoker, InvokerError}, invoker::{Invoker, InvokerError},
Autorouter, Autorouter,
}, },
board::{mesadata::AccessMesadata, Board}, board::{mesadata::AccessMesadata, Board},
stepper::{Abort, Step}, interactor::{
};
use crate::{
activity::{ActivityContext, ActivityError, ActivityStepperWithStatus}, activity::{ActivityContext, ActivityError, ActivityStepperWithStatus},
interaction::InteractionContext, interaction::InteractionContext,
},
stepper::{Abort, Step},
}; };
pub struct Interactor<M: AccessMesadata> { pub struct Interactor<M: AccessMesadata> {

5
src/interactor/mod.rs Normal file
View File

@ -0,0 +1,5 @@
pub mod activity;
pub mod interaction;
mod interactor;
pub use interactor::*;

View File

@ -12,6 +12,7 @@ pub mod drawing;
pub mod autorouter; pub mod autorouter;
pub mod board; pub mod board;
pub mod geometry; pub mod geometry;
pub mod interactor;
pub mod layout; pub mod layout;
pub mod math; pub mod math;
pub mod router; pub mod router;