26 #if ! defined (octave_event_manager_h)
27 #define octave_event_manager_h 1
29 #include "octave-config.h"
90 typedef std::list<std::pair<std::string, std::string>>
filter_list;
92 virtual std::list<std::string>
99 return std::list<std::string> ();
102 virtual std::list<std::string>
105 const std::list<float>& ,
106 const std::list<float>& ,
107 const std::list<std::string>& )
109 return std::list<std::string> ();
112 virtual std::pair<std::list<int>,
int>
114 const std::string& ,
int ,
int ,
115 const std::list<int>& ,
117 const std::list<std::string>& ,
121 return std::pair<std::list<int>,
int> ();
126 const std::string& ,
const std::string& ,
127 const std::string& ,
const std::string& )
140 virtual bool edit_file (
const std::string& ) {
return false; }
240 int ,
const std::string& )
268 void connect_link (
const std::shared_ptr<interpreter_events>& obj);
317 typedef std::list<std::pair<std::string, std::string>>
filter_list;
319 std::list<std::string>
321 const std::string& filename,
const std::string&
dirname,
322 const std::string& multimode)
327 : std::list<std::string> ());
330 std::list<std::string>
332 const std::string& title,
333 const std::list<float>& nr,
334 const std::list<float>& nc,
335 const std::list<std::string>& defaults)
338 ?
instance->input_dialog (prompt, title, nr, nc, defaults)
339 : std::list<std::string> ());
342 std::pair<std::list<int>,
int>
344 const std::string& mode,
345 int width,
int height,
346 const std::list<int>& initial_value,
347 const std::string&
name,
348 const std::list<std::string>& prompt,
349 const std::string& ok_string,
350 const std::string& cancel_string)
353 ?
instance->list_dialog (list, mode, width, height,
354 initial_value,
name, prompt,
355 ok_string, cancel_string)
356 : std::pair<std::list<int>,
int> ());
361 const std::string& btn1,
const std::string& btn2,
362 const std::string& btn3,
const std::string& btndef)
365 ?
instance->question_dialog (msg, title, btn1,
441 const std::string& dir,
bool addpath_option)
444 ?
instance->debug_cd_or_addpath_error (file, dir, addpath_option)
455 const std::string& value)
475 instance->execute_command_in_terminal (command);
508 void file_remove (
const std::string& old_name,
const std::string& new_name)
511 instance->file_remove (old_name, new_name);
523 bool update_variable_editor =
true)
527 update_variable_editor);
545 instance->append_history (hist_entry);
567 const std::string& fcn_file_name,
int line)
573 instance->enter_debugger_event (fcn_name, fcn_file_name,
line);
594 int line,
const std::string& cond =
"")
void add(F &&fcn, Args &&... args)
static bool is_gui_running(void)
Provides threadsafe access to octave.
void file_renamed(bool load_new)
std::string gui_preference(const std::string &key, const std::string &value)
std::list< std::pair< std::string, std::string > > filter_list
octave::event_queue gui_event_queue
void set_workspace(bool top_level, const octave::symbol_info_list &syminfo, bool update_variable_editor=true)
bool copy_image_to_clipboard(const std::string &file)
bool show_doc(const std::string &file)
std::list< std::string > file_dialog(const filter_list &filter, const std::string &title, const std::string &filename, const std::string &dirname, const std::string &multimode)
bool unregister_doc(const std::string &file)
void post_event(const fcn_callback &fcn)
int debug_cd_or_addpath_error(const std::string &file, const std::string &dir, bool addpath_option)
uint8NDArray get_named_icon(const std::string &icon_name)
event_manager(interpreter &interp)
event_manager & operator=(const event_manager &)=delete
void discard_events(void)
virtual void focus_window(const std::string win_name)
bool edit_variable(const std::string &name, const octave_value &val)
void directory_changed(const std::string &dir)
bool show_preferences(void)
bool register_doc(const std::string &file)
void post_event(const meth_callback &meth)
bool prompt_new_edit_file(const std::string &file)
bool confirm_shutdown(void)
void post_input_event(void)
event_manager(const event_manager &)=delete
bool apply_preferences(void)
void exit_debugger_event(void)
void file_remove(const std::string &old_name, const std::string &new_name)
void enter_debugger_event(const std::string &fcn_name, const std::string &fcn_file_name, int line)
void set_history(const string_vector &hist)
std::pair< std::list< int >, int > list_dialog(const std::list< std::string > &list, const std::string &mode, int width, int height, const std::list< int > &initial_value, const std::string &name, const std::list< std::string > &prompt, const std::string &ok_string, const std::string &cancel_string)
void clear_workspace(void)
void update_path_dialog(void)
virtual ~event_manager(void)
void pre_input_event(void)
void execute_in_debugger_event(const std::string &file, int line)
std::string question_dialog(const std::string &msg, const std::string &title, const std::string &btn1, const std::string &btn2, const std::string &btn3, const std::string &btndef)
interpreter & m_interpreter
void execute_command_in_terminal(const std::string &command)
void connect_link(const std::shared_ptr< interpreter_events > &obj)
void update_breakpoint(bool insert, const std::string &file, int line, const std::string &cond="")
octave::mutex * event_queue_mutex
std::list< std::string > input_dialog(const std::list< std::string > &prompt, const std::string &title, const std::list< float > &nr, const std::list< float > &nc, const std::list< std::string > &defaults)
bool edit_file(const std::string &file)
void append_history(const std::string &hist_entry)
std::shared_ptr< interpreter_events > instance
void process_events(bool disable=false)
virtual void clear_history(void)
virtual std::string gui_preference(const std::string &, const std::string &)
virtual void enter_debugger_event(const std::string &, const std::string &, int)
virtual void register_doc(const std::string &)
virtual void directory_changed(const std::string &)
virtual void exit_debugger_event(void)
virtual std::string question_dialog(const std::string &, const std::string &, const std::string &, const std::string &, const std::string &, const std::string &)
virtual void focus_window(const std::string)
std::list< std::pair< std::string, std::string > > filter_list
virtual bool prompt_new_edit_file(const std::string &)
virtual void update_breakpoint(bool, const std::string &, int, const std::string &)
interpreter_events(const interpreter_events &)=default
virtual void execute_command_in_terminal(const std::string &)
virtual bool copy_image_to_clipboard(const std::string &)
virtual void set_workspace(bool, bool, const octave::symbol_info_list &, bool)
virtual void file_remove(const std::string &, const std::string &)
virtual void edit_variable(const std::string &, const octave_value &)
virtual std::pair< std::list< int >, int > list_dialog(const std::list< std::string > &, const std::string &, int, int, const std::list< int > &, const std::string &, const std::list< std::string > &, const std::string &, const std::string &)
virtual void unregister_doc(const std::string &)
virtual std::list< std::string > input_dialog(const std::list< std::string > &, const std::string &, const std::list< float > &, const std::list< float > &, const std::list< std::string > &)
virtual ~interpreter_events(void)=default
virtual bool edit_file(const std::string &)
interpreter_events(void)=default
virtual void post_input_event(void)
virtual void set_history(const string_vector &)
virtual void update_path_dialog(void)
virtual void execute_in_debugger_event(const std::string &, int)
virtual void file_renamed(bool)
virtual uint8NDArray get_named_icon(const std::string &)
virtual void append_history(const std::string &)
virtual bool confirm_shutdown(void)
interpreter_events & operator=(const interpreter_events &)=default
virtual int debug_cd_or_addpath_error(const std::string &, const std::string &, bool)
virtual void clear_workspace(void)
virtual void apply_preferences(void)
virtual void pre_input_event(void)
virtual std::list< std::string > file_dialog(const filter_list &, const std::string &, const std::string &, const std::string &, const std::string &)
virtual void show_doc(const std::string &)
virtual void show_preferences(void)
MArray< T > filter(MArray< T > &b, MArray< T > &a, MArray< T > &x, MArray< T > &si, int dim=0)
std::string dirname(const std::string &path)
std::function< void(octave::interpreter &)> meth_callback
std::function< void(void)> fcn_callback
octave_value::octave_value(const Array< char > &chm, char type) return retval
intNDArray< octave_uint8 > uint8NDArray