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
impl Editor
Sourcepub fn copy_selected(&mut self)
pub fn copy_selected(&mut self)
Copy selected elements to clipboard.
Sourcepub fn cut_selected(&mut self)
pub fn cut_selected(&mut self)
Cut selected elements to clipboard.
Source§impl Editor
impl Editor
Sourcepub fn save_progress(&mut self, force_path: bool)
pub fn save_progress(&mut self, force_path: bool)
Saves the current progress of a simulation.
Sourcepub fn load_progress(&mut self)
pub fn load_progress(&mut self)
Loads the some progress for the simulation.
Source§impl Editor
impl Editor
Sourcepub fn grab(&mut self, button: ActionButton, clear_old: bool, create: bool)
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.
Sourcepub fn release(
&mut self,
button: ActionButton,
allow_more: bool,
clear_old: bool,
select_new: bool,
)
pub fn release( &mut self, button: ActionButton, allow_more: bool, clear_old: bool, select_new: bool, )
Release something.
Sourcepub fn set_cursor(&mut self, x: f32, y: f32)
pub fn set_cursor(&mut self, x: f32, y: f32)
Set cursor position.
Sourcepub fn fire_node(&mut self, direction: FireDirection)
pub fn fire_node(&mut self, direction: FireDirection)
Fire node.
Source§impl Editor
impl Editor
Sourcepub fn text_input(&mut self, character: char, skip: bool)
pub fn text_input(&mut self, character: char, skip: bool)
Input text.
Sourcepub fn finish(&mut self, clear_old: bool, skip: bool)
pub fn finish(&mut self, clear_old: bool, skip: bool)
Finish the current action. Basically the user presses the enter key.
Sourcepub fn move_text_cursor(&mut self, direction: Direction, skip: bool)
pub fn move_text_cursor(&mut self, direction: Direction, skip: bool)
Move the text cursor in line.
Sourcepub fn move_line(&mut self, direction: LineDirection)
pub fn move_line(&mut self, direction: LineDirection)
Moves the text cursor by one line in the specified direction.
Sourcepub fn move_page(&mut self, direction: LineDirection)
pub fn move_page(&mut self, direction: LineDirection)
Moves the text by one page in the specified direction.
Sourcepub fn move_text_cursor_border(
&mut self,
boundary: CursorBoundary,
scope: LineScope,
)
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
impl Editor
Sourcepub fn switch_mode(&mut self, ignore_save_warning: bool)
pub fn switch_mode(&mut self, ignore_save_warning: bool)
Switches simulation mode.
Sourcepub fn start_nodes(&mut self)
pub fn start_nodes(&mut self)
Adds a token to nodes if they are places.
Sourcepub fn remove_nodes(&mut self)
pub fn remove_nodes(&mut self)
Removes all selected nodes.
Sourcepub fn group_nodes(&mut self, keep: bool)
pub fn group_nodes(&mut self, keep: bool)
Group all selected nodes.
Sourcepub fn ungroup_nodes(&mut self, all: bool)
pub fn ungroup_nodes(&mut self, all: bool)
Remove all selected nodes from group.
Sourcepub fn toggle_snapping(&mut self)
pub fn toggle_snapping(&mut self)
Toggles snapping.
Sourcepub fn toggle_editor(&mut self)
pub fn toggle_editor(&mut self)
Toggles the editor.
Sourcepub fn start_search_mode(&mut self)
pub fn start_search_mode(&mut self)
Enables the search bar.
Sourcepub fn set_view_mode(&mut self, view_mode: ViewMode)
pub fn set_view_mode(&mut self, view_mode: ViewMode)
Changes the view mode.
See ViewMode
for more information about the view modes.
Sourcepub fn zoom(&mut self, factor: f32, zoom_scale: bool, zoom_distance: bool)
pub fn zoom(&mut self, factor: f32, zoom_scale: bool, zoom_distance: bool)
Zoom in or out by a factor.
Sourcepub fn ensure_saved(&self, state_only: bool) -> bool
pub fn ensure_saved(&self, state_only: bool) -> bool
Ensure the net be saved.
Source§impl Editor
impl Editor
Sourcepub fn new(width: f32, height: f32, node_settings: NodeSettings) -> Self
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.
Sourcepub fn text_editor_shown(&self) -> bool
pub fn text_editor_shown(&self) -> bool
Indicates if the text editor can be shown.
Sourcepub fn simulation_mode(&self) -> bool
pub fn simulation_mode(&self) -> bool
Indicates if the simuliton mode is active.
Sourcepub fn search_mode(&self) -> bool
pub fn search_mode(&self) -> bool
Indicates if the search mode is active.
Trait Implementations§
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
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)
fn as_any(&self) -> &(dyn Any + 'static)
&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)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.