Mercurial > octave-nkf
comparison scripts/plot/util/private/__add_default_menu__.m @ 19776:55a4173f1624
Use "filename" property of figure to store filename for Save dialog under FLTK.
* __add_default_menu__.m: Store filename on figure "filename" property rather
than "userdata" property of uimenu object.
author | Rik <rik@octave.org> |
---|---|
date | Tue, 17 Feb 2015 16:24:30 -0800 |
parents | ca6fc882177d |
children | 781adfc2958c 65e6207f7ae4 |
comparison
equal
deleted
inserted
replaced
19775:b8e4104a8f55 | 19776:55a4173f1624 |
---|---|
57 endif | 57 endif |
58 | 58 |
59 endfunction | 59 endfunction |
60 | 60 |
61 function save_cb (h, e) | 61 function save_cb (h, e) |
62 lbl = get (gcbo, "label"); | 62 [hcbo, hfig] = gcbo (); |
63 lbl = get (hcbo, "label"); | |
63 if (strcmp (lbl, "&Save")) | 64 if (strcmp (lbl, "&Save")) |
64 fname = get (gcbo, "userdata"); | 65 fname = get (hfig, "filename"); |
65 if (isempty (fname)) | 66 if (isempty (fname)) |
66 __save_as__ (gcbo); | 67 __save_as__ (hcbo); |
67 else | 68 else |
68 saveas (gcbo, fname); | 69 saveas (hcbo, fname); |
69 endif | 70 endif |
70 elseif (strcmp (lbl, "Save &As")) | 71 elseif (strcmp (lbl, "Save &As")) |
71 __save_as__ (gcbo); | 72 __save_as__ (hcbo); |
72 endif | 73 endif |
73 endfunction | 74 endfunction |
74 | 75 |
75 function __save_as__ (caller) | 76 function __save_as__ (caller) |
76 [filename, filedir] = uiputfile ({"*.pdf;*.ps;*.gif;*.png;*.jpg", | 77 [filename, filedir] = uiputfile ({"*.pdf;*.ps;*.gif;*.png;*.jpg", |
77 "Supported Graphic Formats"}, | 78 "Supported Graphic Formats"}, |
78 "Save Figure", | 79 "Save Figure", |
79 [pwd, filesep, "untitled.pdf"]); | 80 [pwd, filesep, "untitled.pdf"]); |
80 if (filename != 0) | 81 if (filename != 0) |
81 fname = [filedir filesep() filename]; | 82 fname = [filedir filesep() filename]; |
82 obj = findall (gcbf, "label", "&Save"); | 83 set (gcbf, "filename", fname) |
83 if (! isempty (obj)) | |
84 set (obj(1), "userdata", fname); | |
85 endif | |
86 saveas (caller, fname); | 84 saveas (caller, fname); |
87 endif | 85 endif |
88 endfunction | 86 endfunction |
89 | 87 |
90 | 88 |