Mercurial > hg > octave-nkf
comparison scripts/plot/uigetdir.m @ 13697:0f8ff98929b2
Allow a toolkit to provide its own version of UI dialogs.
* plot/modules.mk (plot_PRIVATE_FCN_FILES): Add __file_filter__.m,
__is_function__.m, __uigetdir_fltk__.m, __uigetfile_fltk__.m,
__uiputfile_fltk__.m.
* plot/uigetdir.m: Rework to remove FLTK-specific stuffs and allow use of
toolkit-provided dialogs. Fallback to FLTK dialogs.
* plot/uigetfile.m: Likewise.
* plot/uiputfile.m: Likewise.
* plot/private/__fltk_file_filter__.m: Assumes input is now always a cell
array of strings.
* plot/private/__file_filter__.m: New file.
* plot/private/__is_function__.m: Likewise.
* plot/private/uigetdir_fltk__.m: Likewise.
* plot/private/uigetfile_fltk__.m: Likewise.
* plot/private/uiputfile_fltk__.m: Likewise.
author | Michael Goffioul <michael.goffioul@gmail.com> |
---|---|
date | Thu, 13 Oct 2011 16:46:28 +0100 |
parents | cb8fd692b600 |
children | 72c96de7a403 |
comparison
equal
deleted
inserted
replaced
13696:d6118a2c0644 | 13697:0f8ff98929b2 |
---|---|
26 ## @seealso{uigetfile} | 26 ## @seealso{uigetfile} |
27 ## @end deftypefn | 27 ## @end deftypefn |
28 | 28 |
29 ## Author: Kai Habel | 29 ## Author: Kai Habel |
30 | 30 |
31 function dirname = uigetdir (init_path = pwd, dialog_name = "Choose directory?") | 31 function dirname = uigetdir (init_path = pwd, dialog_name = "Select Directory to Open") |
32 | 32 |
33 if (exist("__fltk_uigetfile__") != 3) | 33 defaulttoolkit = get (0, "defaultfigure__graphics_toolkit__"); |
34 error ("uigetfile: fltk graphics toolkit required"); | 34 funcname = ["__uigetdir_", defaulttoolkit, "__"]; |
35 functype = exist (funcname); | |
36 if (! __is_function__ (funcname)) | |
37 funcname = "__uigetdir_fltk__"; | |
38 if (! __is_function__ (funcname)) | |
39 error ("uigetdir: fltk graphics toolkit required"); | |
40 elseif (! strcmp (defaulttoolkit, "gnuplot")) | |
41 warning ("uigetdir: no implementation for toolkit `%s', using `fltk' instead", | |
42 defaulttoolkit); | |
43 endif | |
35 endif | 44 endif |
36 | 45 |
37 if (nargin > 2) | 46 if (nargin > 2) |
38 print_usage (); | 47 print_usage (); |
39 endif | 48 endif |
43 endif | 52 endif |
44 | 53 |
45 if (!isdir (init_path)) | 54 if (!isdir (init_path)) |
46 init_path = fileparts (init_path); | 55 init_path = fileparts (init_path); |
47 endif | 56 endif |
48 dirname = __fltk_uigetfile__ ("", dialog_name, init_path, [240, 120], "dir"); | 57 dirname = feval (funcname, init_path, dialog_name); |
49 | 58 |
50 endfunction | 59 endfunction |
51 | 60 |
52 %!demo | 61 %!demo |
53 %! uigetdir(pwd, "Select Directory") | 62 %! uigetdir(pwd, "Select Directory") |