X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?p=CreaPhase.git;a=blobdiff_plain;f=octave_packages%2Fzenity-0.5.7%2Fzenity_text_info.m;fp=octave_packages%2Fzenity-0.5.7%2Fzenity_text_info.m;h=833dbf74f9816a629c454b3c33d5ebef2e8ca8c9;hp=0000000000000000000000000000000000000000;hb=c880e8788dfc484bf23ce13fa2787f2c6bca4863;hpb=1705066eceaaea976f010f669ce8e972f3734b05 diff --git a/octave_packages/zenity-0.5.7/zenity_text_info.m b/octave_packages/zenity-0.5.7/zenity_text_info.m new file mode 100644 index 0000000..833dbf7 --- /dev/null +++ b/octave_packages/zenity-0.5.7/zenity_text_info.m @@ -0,0 +1,54 @@ +## Copyright (C) 2006 Søren Hauberg +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2 of the License, or +## (at your option) any later version. +## +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with this program; If not, see . + +## -*- texinfo -*- +## @deftypefn {Function File} @var{s} = zenity_text_info(@var{title}, @var{text}, @var{editable}) +## Display a large amount of text in a graphical display. +## The title of the display window is set with the variable @var{title}, +## and the actual text ti display is set with the variable @var{text}. +## If the optional argument @var{editable} is given the displayed text +## is editable. In this case the altered text is returned from the function. +## +## @seealso{zenity_calendar, zenity_list, zenity_progress, zenity_entry, zenity_message, +## zenity_file_selection, zenity_notification} +## @end deftypefn + +function s = zenity_text_info(title, text, editable) + if (nargin < 2 || !ischar(title) || !ischar(text)) + print_usage(); + endif + + if (nargin < 3) + editable = "--editable"; + else + editable = ""; + endif + + filename = tmpnam(); + fid = fopen(filename, "w"); + fprintf(fid, "%s", text); + fclose(fid); + + cmd = sprintf('zenity --text-info --title="%s" --filename="%s" %s', title, filename, editable); + [status, output] = system(cmd); + unlink(filename); + if (status == 0) + s = output; + elseif (status == 1) + s = ""; + else + error("zenity_text_info: %s", output); + endif +endfunction