Mercurial > hg > octave-lyh
view examples/structdemo.cc @ 16389:f5204f486a29
gui: add shortcut for goto line action in the editor and center the target line
* file-editor.cc(construct): add shortcut Ctrl-G for goto line action
* file-editor-tab.cc(center_current_line): new function, centering current line
* file-editor-tab.cc(set_debugger_position): use center_current_line
* file-editor-tab.cc(goto_line): call center_current_line only if goto_line was
called from goto line action
* file-editor-tab.h: new function center_current_line
author | Torsten <ttl@justmail.de> |
---|---|
date | Thu, 28 Mar 2013 17:01:43 +0100 |
parents | db1f49eaba6b |
children | be41c30bcb44 |
line wrap: on
line source
#include <octave/oct.h> #include <octave/ov-struct.h> DEFUN_DLD (structdemo, args, , "Struct demo.") { int nargin = args.length (); octave_value retval; if (args.length () == 2) { octave_scalar_map arg0 = args(0).scalar_map_value (); if (! error_state) { std::string arg1 = args(1).string_value (); if (! error_state) { octave_value tmp = arg0.contents (arg1); if (tmp.is_defined ()) { octave_scalar_map st; st.assign ("selected", tmp); retval = octave_value (st); } else error ("sruct does not contain field named '%s'\n", arg1.c_str ()); } else error ("expecting character string as second argument"); } else error ("expecting struct as first argument"); } else print_usage (); return retval; }