From c23f38e10b39bf675540fe98df5369651ae22ca2 Mon Sep 17 00:00:00 2001 From: stefan schippers Date: Wed, 30 Aug 2023 00:42:09 +0200 Subject: [PATCH] export ps/pdf, png, svg functions now use custom file chooser widget (as Save As does) to enable creation of new folders --- src/draw.c | 6 ++++-- src/psprint.c | 6 ++++-- src/svgdraw.c | 6 ++++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/draw.c b/src/draw.c index 76a51d87..60b0d789 100644 --- a/src/draw.c +++ b/src/draw.c @@ -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)); diff --git a/src/psprint.c b/src/psprint.c index 21e9ac08..cc4fd167 100644 --- a/src/psprint.c +++ b/src/psprint.c @@ -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)); diff --git a/src/svgdraw.c b/src/svgdraw.c index d8c4c1c4..acbbd6e8 100644 --- a/src/svgdraw.c +++ b/src/svgdraw.c @@ -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));