26 #if ! defined (octave_gh_manager_h)
27 #define octave_gh_manager_h 1
29 #include "octave-config.h"
42 OCTINTERP_API
gh_manager (octave::interpreter& interp);
57 ? m_handle_map.end () : m_handle_map.find (val));
70 return get_object (
lookup (val));
75 const_iterator p = (h.
ok () ? m_handle_map.find (h) : m_handle_map.end ());
81 make_graphics_handle (
const std::string& go_name,
83 bool integer_figure_handle =
false,
84 bool call_createfcn =
true,
85 bool notify_toolkit =
true);
88 make_figure_handle (
double val,
bool notify_toolkit =
true);
98 for (
const auto& hfig : m_figure_list)
100 if (is_handle_visible (hfig))
109 Matrix retval (1, m_handle_map.size ());
112 for (
const auto& h_iter : m_handle_map)
116 if (show_hidden || is_handle_visible (h))
117 retval(i++) = h.
value ();
125 void lock () { m_graphics_lock.lock (); }
127 bool try_lock () {
return m_graphics_lock.try_lock (); }
129 void unlock () { m_graphics_lock.unlock (); }
133 Matrix retval (1, m_figure_list.size ());
136 for (
const auto& hfig : m_figure_list)
138 if (show_hidden || is_handle_visible (hfig))
139 retval(i++) = hfig.value ();
151 const std::string& name,
158 octave::autolock guard (graphics_lock ());
166 execute_callback (h, cb, data);
183 bool redraw_figure =
false);
185 OCTINTERP_API
int process_events (
bool force =
false);
187 OCTINTERP_API
void enable_event_processing (
bool enable =
true);
203 OCTINTERP_API
void restore_gcbo ();
209 return m_graphics_lock;
216 const auto it = m_latex_cache.find (key);
218 if (it != m_latex_cache.end ())
227 if (m_latex_keys.size () >= 500)
229 auto it = m_latex_cache.find (m_latex_keys.front ());
231 if (it != m_latex_cache.end ())
232 m_latex_cache.erase (it);
234 m_latex_keys.pop_front ();
237 m_latex_cache[key] = val;
238 m_latex_keys.push_back (key);
243 typedef std::map<graphics_handle, graphics_object>::iterator iterator;
244 typedef std::map<graphics_handle, graphics_object>::const_iterator
247 typedef std::set<graphics_handle>::iterator free_list_iterator;
248 typedef std::set<graphics_handle>::const_iterator const_free_list_iterator;
250 typedef std::list<graphics_handle>::iterator figure_list_iterator;
251 typedef std::list<graphics_handle>::const_iterator const_figure_list_iterator;
253 octave::interpreter& m_interpreter;
256 std::map<graphics_handle, graphics_object> m_handle_map;
259 std::set<graphics_handle> m_handle_free_list;
262 double m_next_handle;
266 std::list<graphics_handle> m_figure_list;
269 octave::mutex m_graphics_lock;
272 std::list<graphics_event> m_event_queue;
275 std::list<graphics_object> m_callback_objects;
278 int m_event_processing;
282 std::unordered_map<std::string, latex_data> m_latex_cache;
283 std::list<std::string> m_latex_keys;
286 OCTAVE_END_NAMESPACE(
octave)
octave_idx_type lookup(const T *x, octave_idx_type n, T y)
void resize(octave_idx_type nr, octave_idx_type nc, double rfv=0)
graphics_handle current_figure() const
Matrix handle_list(bool show_hidden=false)
octave::mutex graphics_lock()
graphics_object get_object(double val) const
latex_data get_latex_data(const std::string &key) const
bool is_handle_visible(const graphics_handle &h) const
Matrix figure_handle_list(bool show_hidden=false)
graphics_handle lookup(double val) const
std::pair< uint8NDArray, std::string > latex_data
graphics_handle lookup(const octave_value &val) const
graphics_object get_object(const graphics_handle &h) const
void set_latex_data(const std::string &key, latex_data val)
void execute_callback(const graphics_handle &h, const std::string &name, const octave_value &data=Matrix())
void(* event_fcn)(void *)
octave_value get(bool all=false) const
bool is_handle_visible() const
bool valid_object() const
bool is_real_scalar() const
double double_value(bool frc_str_conv=false) const
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn