export ps/pdf, png, svg functions now use custom file chooser widget (as Save As does) to enable creation of new folders

This commit is contained in:
stefan schippers 2023-08-30 00:42:09 +02:00
parent 8dfaedf9ea
commit c23f38e10b
3 changed files with 12 additions and 6 deletions

View File

@ -90,8 +90,10 @@ void print_image()
if(!has_x) return;
if(!lastdir[0]) my_strncpy(lastdir, pwd_dir, S(lastdir));
if(!xctx->plotfile[0]) {
tclvareval("tk_getSaveFile -title {Select destination file} -initialfile {",
get_cell(xctx->sch[xctx->currsch], 0) , ".png} -initialdir {", lastdir, "}", NULL);
/* tclvareval("tk_getSaveFile -title {Select destination file} -initialfile {",
* get_cell(xctx->sch[xctx->currsch], 0), ".png} -initialdir {", lastdir, "}", NULL); */
tclvareval("save_file_dialog {Select destination file} *.png INITIALLOADDIR {", pwd_dir, "/",
get_cell(xctx->sch[xctx->currsch], 0), ".png}", NULL);
r = tclresult();
if(r[0]) {
my_strncpy(xctx->plotfile, r, S(xctx->plotfile));

View File

@ -1351,8 +1351,10 @@ int ps_draw(int what, int fullzoom)
if(what & 1) { /* prolog */
if(!lastdir[0]) my_strncpy(lastdir, pwd_dir, S(lastdir));
if(has_x && !xctx->plotfile[0]) {
tclvareval("tk_getSaveFile -title {Select destination file} -initialfile {",
get_cell(xctx->sch[xctx->currsch], 0) , ".pdf} -initialdir {", lastdir, "}", NULL);
/* tclvareval("tk_getSaveFile -title {Select destination file} -initialfile {",
* get_cell(xctx->sch[xctx->currsch], 0) , ".pdf} -initialdir {", lastdir, "}", NULL); */
tclvareval("save_file_dialog {Select destination file} *.{ps,pdf} INITIALLOADDIR {", pwd_dir, "/",
get_cell(xctx->sch[xctx->currsch], 0), ".pdf}", NULL);
r = tclresult();
if(r[0]) {
my_strncpy(xctx->plotfile, r, S(xctx->plotfile));

View File

@ -643,8 +643,10 @@ void svg_draw(void)
if(!lastdir[0]) my_strncpy(lastdir, pwd_dir, S(lastdir));
if(has_x && !xctx->plotfile[0]) {
tclvareval("tk_getSaveFile -title {Select destination file} -initialfile {",
get_cell(xctx->sch[xctx->currsch], 0) , ".svg} -initialdir {", lastdir, "}", NULL);
/* tclvareval("tk_getSaveFile -title {Select destination file} -initialfile {",
* get_cell(xctx->sch[xctx->currsch], 0) , ".svg} -initialdir {", lastdir, "}", NULL); */
tclvareval("save_file_dialog {Select destination file} *.svg INITIALLOADDIR {", pwd_dir, "/",
get_cell(xctx->sch[xctx->currsch], 0), ".svg}", NULL);
r = tclresult();
if(r[0]) {
my_strncpy(xctx->plotfile, r, S(xctx->plotfile));