Struct pn_editor_core::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, primary: bool, clear_old: bool, create: bool)

Grab something.

  • primary: specifies if the primary button is pressed.
  • clear_old: specifies if old selections should be deselected.
  • create: creates new nodes.
source

pub fn release( &mut self, primary: bool, 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, forward: bool)

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, forward: bool, skip: bool)

Move the text cursor in line.

source

pub fn move_line(&mut self, down: bool)

Move the text cursor by a line.

source

pub fn move_page(&mut self, down: bool)

Move the text by a page.

source

pub fn move_text_cursor_border(&mut self, end: bool, all_lines: bool)

Move the text to the start or end of 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 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