comparison scripts/help/doc.m @ 17029:359c5ca795cd

Display doc info pages using documentation browser when in GUI mode (Bug #39451) * scripts/help/doc.m: call __octave_link_show_doc if in gui mode. * libinterp/corefcn/octave-link.h, libinterp/corefcn/octave-link.cc (octave_link::show_doc): New function. (octave_link::do_show_doc): New virtual function. (__octave_link_show_doc__): New function. * libgui/src/octave-qt-link.h (octave_qt_link::show_doc_signal): New signal. (octave_qt_link::do_show_doc): New function. * libgui/src/documentation-dock-widget.cc, libgui/src/documentation-dock-widget.h (documentation_dock_widget::showDoc): New function. * libgui/src/main-window.cc, libgui/src/main-window.h (main_window::construct_octave_qt_link): connect handle_show_doc. (main_window::handle_show_doc): New function. (main_window::show_doc_signal): New signal. * libgui/src/qtinfo/parser.cc, libgui/src/qtinfo/parser.h (parser::find_ref): New function. * libgui/src/qtinfo/webinfo.cc, libgui/src/qtinfo/webinfo.h (webinfo::load_ref): New function.
author John Donoghue <john.donoghue@ieee.org>
date Sat, 20 Jul 2013 22:13:51 -0400
parents 0272bb60408a
children f4c8c66faf34
comparison
equal deleted inserted replaced
17028:89acf2cd9149 17029:359c5ca795cd
51 endif 51 endif
52 else 52 else
53 fname = ""; 53 fname = "";
54 endif 54 endif
55 55
56 if (ftype == 2 || ftype == 3) 56 # if GUI is running, let it display the function
57 ffile = which (fname); 57 if isguirunning ()
58 __octave_link_show_doc__ (fname);
58 else 59 else
59 ffile = ""; 60
61 if (ftype == 2 || ftype == 3)
62 ffile = which (fname);
63 else
64 ffile = "";
65 endif
66
67 if (isempty (ffile))
68 info_dir = octave_config_info ("infodir");
69 else
70 info_dir = fileparts (ffile);
71 endif
72
73 ## Determine if a file called doc.info exist in the same
74 ## directory as the function.
75
76 info_file_name = fullfile (info_dir, "doc.info");
77
78 [stat_info, err] = stat (info_file_name);
79
80 if (err < 0)
81 info_file_name = info_file ();
82 endif
83
84 ## FIXME -- don't change the order of the arguments below because
85 ## the info-emacs-info script currently expects --directory DIR as
86 ## the third and fourth arguments. Someone should fix that.
87
88 cmd = sprintf ("\"%s\" --file \"%s\" --directory \"%s\"",
89 info_program (), info_file_name, info_dir);
90
91 have_fname = ! isempty (fname);
92
93 if (have_fname)
94 status = system (sprintf ("%s --index-search \"%s\"", cmd, fname));
95 endif
96
97
98 if (! (have_fname && status == 0))
99 status = system (cmd);
100 if (status == 127)
101 warning ("unable to find info program '%s'", info_program ());
102 endif
103 endif
104
105 if (nargout > 0)
106 retval = status;
107 endif
108
60 endif 109 endif
61
62 if (isempty (ffile))
63 info_dir = octave_config_info ("infodir");
64 else
65 info_dir = fileparts (ffile);
66 endif
67
68 ## Determine if a file called doc.info exist in the same
69 ## directory as the function.
70
71 info_file_name = fullfile (info_dir, "doc.info");
72
73 [stat_info, err] = stat (info_file_name);
74
75 if (err < 0)
76 info_file_name = info_file ();
77 endif
78
79 ## FIXME -- don't change the order of the arguments below because
80 ## the info-emacs-info script currently expects --directory DIR as
81 ## the third and fourth arguments. Someone should fix that.
82
83 cmd = sprintf ("\"%s\" --file \"%s\" --directory \"%s\"",
84 info_program (), info_file_name, info_dir);
85
86 have_fname = ! isempty (fname);
87
88 if (have_fname)
89 status = system (sprintf ("%s --index-search \"%s\"", cmd, fname));
90 endif
91
92 if (! (have_fname && status == 0))
93 status = system (cmd);
94 if (status == 127)
95 warning ("unable to find info program '%s'", info_program ());
96 endif
97 endif
98
99 if (nargout > 0)
100 retval = status;
101 endif
102
103 else 110 else
104 print_usage (); 111 print_usage ();
105 endif 112 endif
106 113
107 endfunction 114 endfunction