Struct Editor

Source
pub struct Editor { /* private fields */ }
Expand description

This represents the editor you want to use to edit and display petri nets.

Implementations§

Source§

impl Editor

Source

pub fn copy_selected(&mut self)

Copy selected elements to clipboard.

Source

pub fn cut_selected(&mut self)

Cut selected elements to clipboard.

Source

pub fn paste(&mut self, clear_old: bool)

Pastes contents from clipboard.

Source§

impl Editor

Source

pub fn load_net(&mut self, folder_path: PathBuf) -> Result<(), Error>

Loads the net from a specified path.

Source

pub fn load(&mut self, force_path: bool, ignore_save_warning: bool)

Loads a new net.

Source§

impl Editor

Source

pub fn save(&mut self, force_path: bool)

Saves the current net.

Source§

impl Editor

Source

pub fn save_progress(&mut self, force_path: bool)

Saves the current progress of a simulation.

Source

pub fn load_progress(&mut self)

Loads the some progress for the simulation.

Source§

impl Editor

Source

pub fn grab(&mut self, button: ActionButton, clear_old: bool, create: bool)

Grab something.

  • button: specifies which action button is used.
  • clear_old: specifies if old selections should be deselected.
  • create: creates new nodes.
Source

pub fn release( &mut self, button: ActionButton, allow_more: bool, clear_old: bool, select_new: bool, )

Release something.

Source

pub fn set_cursor(&mut self, x: f32, y: f32)

Set cursor position.

Source

pub fn fire_node(&mut self, direction: FireDirection)

Fire node.

Source§

impl Editor

Source

pub fn text_input(&mut self, character: char, skip: bool)

Input text.

Source

pub fn finish(&mut self, clear_old: bool, skip: bool)

Finish the current action. Basically the user presses the enter key.

Source

pub fn escape(&mut self)

Escapes from submenus.

Source

pub fn move_text_cursor(&mut self, direction: Direction, skip: bool)

Move the text cursor in line.

Source

pub fn move_line(&mut self, direction: LineDirection)

Moves the text cursor by one line in the specified direction.

Source

pub fn move_page(&mut self, direction: LineDirection)

Moves the text by one page in the specified direction.

Source

pub fn move_text_cursor_border( &mut self, boundary: CursorBoundary, scope: LineScope, )

Moves the text cursor to the start or end of a line or file.

Source§

impl Editor

Source

pub fn switch_mode(&mut self, ignore_save_warning: bool)

Switches simulation mode.

Source

pub fn start_nodes(&mut self)

Adds a token to nodes if they are places.

Source

pub fn remove_nodes(&mut self)

Removes all selected nodes.

Source

pub fn group_nodes(&mut self, keep: bool)

Group all selected nodes.

Source

pub fn ungroup_nodes(&mut self, all: bool)

Remove all selected nodes from group.

Source

pub fn resize(&mut self, width: u32, height: u32)

Should be called when the window is resized.

Source

pub fn cycle(&mut self, skip: bool)

Cycle through states.

Source

pub fn add_state(&mut self)

Adds a new simulation state.

Source

pub fn toggle_snapping(&mut self)

Toggles snapping.

Source

pub fn toggle_editor(&mut self)

Toggles the editor.

Source

pub fn start_search_mode(&mut self)

Enables the search bar.

Source

pub fn load_new(&mut self, ignore_save_warning: bool)

Loads in an empty net.

Source

pub fn set_view_mode(&mut self, view_mode: ViewMode)

Changes the view mode. See ViewMode for more information about the view modes.

Source

pub fn zoom(&mut self, factor: f32, zoom_scale: bool, zoom_distance: bool)

Zoom in or out by a factor.

Source

pub fn ensure_saved(&self, state_only: bool) -> bool

Ensure the net be saved.

Source§

impl Editor

Source

pub fn new(width: f32, height: f32, node_settings: NodeSettings) -> Self

Creates a new editor, which contains a renderer and knows about the window size.

Source

pub fn snapping(&self) -> bool

Indicates if snapping is enabled.

Source

pub fn text_editor_shown(&self) -> bool

Indicates if the text editor can be shown.

Source

pub fn simulation_mode(&self) -> bool

Indicates if the simuliton mode is active.

Source

pub fn search_mode(&self) -> bool

Indicates if the search mode is active.

Source

pub fn view_mode(&self) -> ViewMode

Access the current view mode.

Trait Implementations§

Source§

impl<R: Renderer> Render<R> for Editor

Source§

fn render(&self, renderer: &mut R)

Source§

impl Update for Editor

Source§

fn update(&mut self, _timestep: f32)

Auto Trait Implementations§

§

impl !Freeze for Editor

§

impl RefUnwindSafe for Editor

§

impl !Send for Editor

§

impl !Sync for Editor

§

impl Unpin for Editor

§

impl UnwindSafe for Editor

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,