Provides threadsafe access to octave. More...
#include "event-manager.h"
Public Types | |
typedef std::list< std::pair< std::string, std::string > > | filter_list |
Public Member Functions | |
event_manager (const event_manager &)=delete | |
OCTINTERP_API | event_manager (interpreter &interp) |
virtual | ~event_manager (void) |
void | append_history (const std::string &hist_entry) |
bool | apply_preferences (void) |
void | clear_history (void) |
void | clear_workspace (void) |
void | close_gui (void) |
bool | confirm_shutdown (void) |
OCTINTERP_API void | connect_link (const std::shared_ptr< interpreter_events > &obj) |
bool | copy_image_to_clipboard (const std::string &file) |
int | debug_cd_or_addpath_error (const std::string &file, const std::string &dir, bool addpath_option) |
void | directory_changed (const std::string &dir) |
bool | disable (void) |
OCTINTERP_API void | discard_events (void) |
bool | display_exception (const execution_exception &ee, bool beep=false) |
bool | edit_file (const std::string &file) |
bool | edit_variable (const std::string &name, const octave_value &val) |
OCTINTERP_API bool | enable (void) |
bool | enabled (void) const |
void | enter_debugger_event (const std::string &fcn_name, const std::string &fcn_file_name, int line) |
void | execute_command_in_terminal (const std::string &command) |
void | execute_in_debugger_event (const std::string &file, int line) |
void | exit_debugger_event (void) |
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) |
void | file_remove (const std::string &old_name, const std::string &new_name) |
void | file_renamed (bool load_new) |
virtual void | focus_window (const std::string win_name) |
uint8NDArray | get_named_icon (const std::string &icon_name) |
std::string | gui_preference (const std::string &key, const std::string &value) |
bool | gui_status_update (const std::string &feature, const std::string &status) |
bool | have_dialogs (void) const |
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) |
void | install_qt_event_handlers (const std::shared_ptr< interpreter_events > &obj) |
void | interpreter_interrupted (void) |
bool | interpreter_output (const std::string &msg) |
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) |
event_manager & | operator= (const event_manager &)=delete |
void | pop_event_queue (void) |
OCTINTERP_API void | post_event (const fcn_callback &fcn) |
OCTINTERP_API void | post_event (const meth_callback &meth) |
void | post_input_event (void) |
void | pre_input_event (void) |
OCTINTERP_API void | process_events (bool disable=false) |
bool | prompt_new_edit_file (const std::string &file) |
void | push_event_queue (void) |
std::shared_ptr< interpreter_events > | qt_event_handlers (void) const |
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) |
bool | register_documentation (const std::string &file) |
void | set_history (const string_vector &hist) |
OCTINTERP_API void | set_history (void) |
void | set_workspace (bool top_level, const symbol_info_list &syminfo, bool update_variable_editor=true) |
OCTINTERP_API void | set_workspace (void) |
void | show_command_history (void) |
void | show_community_news (int serial=-1) |
bool | show_documentation (const std::string &file) |
void | show_file_browser (void) |
bool | show_preferences (void) |
void | show_release_notes (void) |
void | show_terminal_window (void) |
void | show_workspace (void) |
void | start_gui (bool gui_app=false) |
bool | unregister_documentation (const std::string &file) |
void | update_breakpoint (bool insert, const std::string &file, int line, const std::string &cond="") |
bool | update_gui_lexer (void) |
void | update_path_dialog (void) |
void | update_prompt (const std::string &prompt) |
Protected Attributes | |
bool | m_debugging |
mutex * | m_event_queue_mutex |
std::stack< std::shared_ptr< event_queue > > | m_gui_event_queue |
bool | m_link_enabled |
Private Attributes | |
std::shared_ptr< interpreter_events > | m_instance |
interpreter & | m_interpreter |
std::shared_ptr< interpreter_events > | m_qt_event_handlers |
Provides threadsafe access to octave.
This class provides thread-safe communication between the interpreter and a GUI.
Definition at line 291 of file event-manager.h.
typedef std::list<std::pair<std::string, std::string> > event_manager::filter_list |
Definition at line 390 of file event-manager.h.
event_manager::event_manager | ( | interpreter & | interp | ) |
Definition at line 67 of file event-manager.cc.
References push_event_queue(), and readline_event_hook().
|
delete |
|
virtual |
Definition at line 77 of file event-manager.cc.
References m_event_queue_mutex.
|
inline |
Definition at line 697 of file event-manager.h.
References enabled(), and m_instance.
Referenced by edit_history_add_hist(), tree_evaluator::parse_and_execute(), and history_system::write_timestamp().
|
inline |
Definition at line 460 of file event-manager.h.
References enabled(), and m_instance.
Referenced by F__event_manager_apply_preferences__().
|
inline |
Definition at line 703 of file event-manager.h.
References enabled(), and m_instance.
Referenced by history_system::do_history().
|
inline |
Definition at line 677 of file event-manager.h.
References enabled(), and m_instance.
Referenced by Fclear(), and interpreter::shutdown().
|
inline |
Definition at line 377 of file event-manager.h.
References enabled(), and m_instance.
Referenced by interpreter::shutdown().
|
inline |
Definition at line 528 of file event-manager.h.
References enabled(), and m_instance.
Referenced by interpreter::quit().
void event_manager::connect_link | ( | const std::shared_ptr< interpreter_events > & | obj | ) |
Definition at line 89 of file event-manager.cc.
References disable(), and m_instance.
Referenced by octave::interpreter_qobject::execute().
|
inline |
Definition at line 564 of file event-manager.h.
References enabled(), and m_instance.
Referenced by F__event_manager_copy_image_to_clipboard__().
|
inline |
Definition at line 543 of file event-manager.h.
References enabled(), and m_instance.
Referenced by load_path::contains_file_in_dir().
|
inline |
Definition at line 648 of file event-manager.h.
References enabled(), and m_instance.
Referenced by interpreter::chdir().
|
inline |
Definition at line 315 of file event-manager.h.
References m_link_enabled.
Referenced by connect_link(), process_events(), and interpreter::shutdown().
void event_manager::discard_events | ( | void | ) |
Definition at line 124 of file event-manager.cc.
References enabled(), m_event_queue_mutex, and m_gui_event_queue.
|
inline |
Definition at line 615 of file event-manager.h.
References enabled(), and m_instance.
Referenced by error_system::display_exception().
|
inline |
Definition at line 512 of file event-manager.h.
References enabled(), and m_instance.
Referenced by F__event_manager_edit_file__().
|
inline |
Definition at line 517 of file event-manager.h.
References enabled(), m_instance, and name.
Referenced by Fopenvar(), and octave::base_qobject::workspace_widget().
bool event_manager::enable | ( | void | ) |
Definition at line 97 of file event-manager.cc.
References m_instance, m_link_enabled, and warning().
Referenced by octave::interpreter_qobject::execute().
|
inline |
Definition at line 322 of file event-manager.h.
References m_link_enabled.
Referenced by append_history(), apply_preferences(), clear_history(), clear_workspace(), close_gui(), confirm_shutdown(), copy_image_to_clipboard(), debug_cd_or_addpath_error(), directory_changed(), discard_events(), display_exception(), edit_file(), edit_variable(), enter_debugger_event(), execute_command_in_terminal(), execute_in_debugger_event(), exit_debugger_event(), F__event_manager_enabled__(), file_dialog(), file_remove(), file_renamed(), focus_window(), get_named_icon(), gui_preference(), gui_status_update(), input_dialog(), interpreter_interrupted(), interpreter_output(), list_dialog(), post_event(), post_input_event(), pre_input_event(), process_events(), prompt_new_edit_file(), question_dialog(), register_documentation(), set_history(), set_workspace(), show_command_history(), show_community_news(), show_documentation(), show_file_browser(), show_preferences(), show_release_notes(), show_terminal_window(), show_workspace(), start_gui(), unregister_documentation(), update_breakpoint(), update_gui_lexer(), update_path_dialog(), and update_prompt().
|
inline |
Definition at line 721 of file event-manager.h.
References enabled(), m_debugging, and m_instance.
Referenced by debugger::repl().
|
inline |
Definition at line 576 of file event-manager.h.
References enabled(), and m_instance.
|
inline |
Definition at line 732 of file event-manager.h.
References enabled(), and m_instance.
Referenced by debugger::repl().
|
inline |
Definition at line 738 of file event-manager.h.
References enabled(), m_debugging, and m_instance.
|
inline |
Definition at line 393 of file event-manager.h.
References octave::sys::file_ops::dirname(), enabled(), filter(), have_dialogs(), and m_instance.
Referenced by F__event_manager_file_dialog__().
|
inline |
Definition at line 655 of file event-manager.h.
References enabled(), application::is_gui_running(), and m_instance.
Referenced by F__event_manager_file_remove__(), Frename(), Frmdir(), and Funlink().
|
inline |
Definition at line 661 of file event-manager.h.
References enabled(), application::is_gui_running(), and m_instance.
Referenced by F__event_manager_file_renamed__(), Frename(), Frmdir(), and Funlink().
|
inlinevirtual |
Definition at line 569 of file event-manager.h.
References enabled(), and m_instance.
Referenced by Fcommandhistory(), Fcommandwindow(), Ffilebrowser(), and Fworkspace().
|
inline |
Definition at line 552 of file event-manager.h.
References enabled(), and m_instance.
Referenced by F__event_manager_named_icon__().
|
inline |
Definition at line 558 of file event-manager.h.
References enabled(), and m_instance.
Referenced by F__event_manager_gui_preference__().
|
inline |
Definition at line 626 of file event-manager.h.
References enabled(), and m_instance.
Referenced by F__event_manager_gui_status_update__(), and F__profiler_enable__().
|
inline |
Definition at line 385 of file event-manager.h.
References m_qt_event_handlers.
Referenced by F__event_manager_have_dialogs__(), file_dialog(), input_dialog(), list_dialog(), and question_dialog().
|
inline |
Definition at line 404 of file event-manager.h.
References enabled(), have_dialogs(), and m_instance.
Referenced by F__event_manager_input_dialog__().
|
inline |
Definition at line 332 of file event-manager.h.
References m_qt_event_handlers.
Referenced by octave::interpreter_qobject::execute().
|
inline |
Definition at line 755 of file event-manager.h.
References enabled(), and m_instance.
Referenced by interpreter::recover_from_exception().
|
inline |
Definition at line 604 of file event-manager.h.
References enabled(), and m_instance.
Referenced by output_system::do_sync().
|
inline |
Definition at line 416 of file event-manager.h.
References enabled(), have_dialogs(), m_instance, and name.
Referenced by F__event_manager_list_dialog__().
|
delete |
void event_manager::pop_event_queue | ( | void | ) |
Definition at line 142 of file event-manager.cc.
References m_gui_event_queue.
Referenced by debugger::repl().
void event_manager::post_event | ( | const fcn_callback & | fcn | ) |
Definition at line 157 of file event-manager.cc.
References enabled(), and m_gui_event_queue.
Referenced by tree_evaluator::get_line_and_eval(), and octave::interpreter_qobject::interpreter_event().
void event_manager::post_event | ( | const meth_callback & | meth | ) |
Definition at line 166 of file event-manager.cc.
References enabled(), m_gui_event_queue, and m_interpreter.
|
inline |
Definition at line 715 of file event-manager.h.
References enabled(), and m_instance.
|
inline |
Definition at line 709 of file event-manager.h.
References enabled(), and m_instance.
Referenced by tree_evaluator::parse_and_execute().
void event_manager::process_events | ( | bool | disable = false | ) |
Definition at line 109 of file event-manager.cc.
References disable(), enabled(), m_event_queue_mutex, and m_gui_event_queue.
Referenced by readline_event_hook(), and interpreter::shutdown().
|
inline |
Definition at line 538 of file event-manager.h.
References enabled(), and m_instance.
Referenced by F__event_manager_edit_file__().
void event_manager::push_event_queue | ( | void | ) |
Definition at line 136 of file event-manager.cc.
References m_gui_event_queue.
Referenced by event_manager(), and debugger::repl().
|
inline |
Definition at line 338 of file event-manager.h.
References m_qt_event_handlers.
|
inline |
Definition at line 433 of file event-manager.h.
References enabled(), have_dialogs(), and m_instance.
Referenced by F__event_manager_question_dialog__().
|
inline |
Definition at line 582 of file event-manager.h.
References enabled(), and m_instance.
Referenced by F__event_manager_register_documentation__().
|
inline |
Definition at line 691 of file event-manager.h.
References enabled(), and m_instance.
void event_manager::set_history | ( | void | ) |
Definition at line 186 of file event-manager.cc.
References enabled(), and m_instance.
Referenced by history_system::do_history(), octave::base_qobject::history_widget(), and history_system::initialize().
|
inline |
Definition at line 669 of file event-manager.h.
References enabled(), m_debugging, and m_instance.
void event_manager::set_workspace | ( | void | ) |
Definition at line 175 of file event-manager.cc.
References tree_evaluator::at_top_level(), enabled(), interpreter::get_evaluator(), tree_evaluator::get_symbol_info(), m_debugging, m_instance, and m_interpreter.
Referenced by octave::main_window::handle_load_workspace_request(), octave::main_window::handle_open_any_request(), octave::base_qobject::handle_variable_editor_update(), tree_evaluator::parse_and_execute(), debugger::repl(), and octave::base_qobject::workspace_widget().
|
inline |
Definition at line 488 of file event-manager.h.
References enabled(), and m_instance.
Referenced by F__event_manager_show_command_history__().
|
inline |
Definition at line 500 of file event-manager.h.
References enabled(), and m_instance.
Referenced by F__event_manager_show_community_news__().
|
inline |
Definition at line 477 of file event-manager.h.
References enabled(), and m_instance.
Referenced by F__event_manager_show_documentation__().
|
inline |
Definition at line 482 of file event-manager.h.
References enabled(), and m_instance.
Referenced by F__event_manager_show_file_browser__().
|
inline |
Definition at line 449 of file event-manager.h.
References enabled(), and m_instance.
Referenced by F__event_manager_show_preferences__().
|
inline |
Definition at line 506 of file event-manager.h.
References enabled(), and m_instance.
Referenced by F__event_manager_show_release_notes__().
|
inline |
Definition at line 471 of file event-manager.h.
References enabled(), and m_instance.
Referenced by F__event_manager_show_terminal_window__().
|
inline |
Definition at line 494 of file event-manager.h.
References enabled(), and m_instance.
Referenced by F__event_manager_show_workspace__().
|
inline |
Definition at line 371 of file event-manager.h.
References enabled(), and m_instance.
Referenced by interpreter::execute(), and Fdesktop().
|
inline |
Definition at line 593 of file event-manager.h.
References enabled(), and m_instance.
Referenced by F__event_manager_unregister_documentation__().
|
inline |
Definition at line 748 of file event-manager.h.
References enabled(), and m_instance.
Referenced by octave::tree_statement_list::add_breakpoint(), octave::tree_statement_list::remove_all_breakpoints(), and octave::bp_table::remove_breakpoint_1().
|
inline |
Definition at line 637 of file event-manager.h.
References enabled(), and m_instance.
Referenced by F__event_manager_update_gui_lexer__().
|
inline |
Definition at line 443 of file event-manager.h.
References enabled(), application::is_gui_running(), and m_instance.
Referenced by rehash_internal().
|
inline |
Definition at line 683 of file event-manager.h.
References enabled(), and m_instance.
Referenced by octave::main_window::handle_octave_ready().
|
protected |
Definition at line 778 of file event-manager.h.
Referenced by enter_debugger_event(), exit_debugger_event(), and set_workspace().
|
protected |
Definition at line 764 of file event-manager.h.
Referenced by ~event_manager(), discard_events(), and process_events().
|
protected |
Definition at line 776 of file event-manager.h.
Referenced by discard_events(), pop_event_queue(), post_event(), process_events(), and push_event_queue().
|
private |
Definition at line 788 of file event-manager.h.
Referenced by append_history(), apply_preferences(), clear_history(), clear_workspace(), close_gui(), confirm_shutdown(), connect_link(), copy_image_to_clipboard(), debug_cd_or_addpath_error(), directory_changed(), display_exception(), edit_file(), edit_variable(), enable(), enter_debugger_event(), execute_command_in_terminal(), execute_in_debugger_event(), exit_debugger_event(), file_dialog(), file_remove(), file_renamed(), focus_window(), get_named_icon(), gui_preference(), gui_status_update(), input_dialog(), interpreter_interrupted(), interpreter_output(), list_dialog(), post_input_event(), pre_input_event(), prompt_new_edit_file(), question_dialog(), register_documentation(), set_history(), set_workspace(), show_command_history(), show_community_news(), show_documentation(), show_file_browser(), show_preferences(), show_release_notes(), show_terminal_window(), show_workspace(), start_gui(), unregister_documentation(), update_breakpoint(), update_gui_lexer(), update_path_dialog(), and update_prompt().
|
private |
Definition at line 783 of file event-manager.h.
Referenced by post_event(), and set_workspace().
|
protected |
Definition at line 779 of file event-manager.h.
|
private |
Definition at line 790 of file event-manager.h.
Referenced by have_dialogs(), install_qt_event_handlers(), and qt_event_handlers().