[PATCH] make the filename of PS output in viewport to "image.ps"

5 views
Skip to first unread message

Qian Yun

unread,
Apr 21, 2024, 8:55:39 AM4/21/24
to fricas-devel
Currently, when using "write" to write out a viewport, we have
"image.bm", "image.xpm", but also "fricas2D.ps", "fricas3D.ps".

This patch makes PS output to have unified name "image.ps".
This is more consistent and easier for follow up Makefile treatment.

Note that in the view2D/view3D control panel, you can also click
buttons to save image (instead of viewport directory) under
current directory, you can only save "fricas2D.ps" for 2D images,
and "fricas3D.xpm" "fricas3D.ps" for 3D images. Here the name
distinction makes sense to avoid file overwrite.

- Qian

diff --git a/src/graph/view2D/write2d.c b/src/graph/view2D/write2d.c
index 05bbf62e..7968dd3a 100644
--- a/src/graph/view2D/write2d.c
+++ b/src/graph/view2D/write2d.c
@@ -184,15 +184,15 @@ writeViewport(int thingsToWrite)
break;

case Postscript:
- /*** Create postscript output for viewport (in fricas2D.ps)
***/
+ /*** Create postscript output for viewport (in image.ps) ***/
fricas_sprintf_to_buf2(PSfilename, "%s%s", viewDirName,
- "/fricas2D.ps");
+ "/image.ps");
if (PSInit(viewport->viewWindow,viewport->titleWindow) ==
psError)
return (-1);
drawViewport(PSoption); /* write new script file in /tmp */
if (PSCreateFile(viewBorderWidth,viewport->viewWindow,
viewport->titleWindow, viewport->title) ==
psError)
- return(-1); /* concat script & proc into fricas2D.ps */
+ return(-1); /* concat script & proc into image.ps */
break;

} /* switch on ii */
diff --git a/src/graph/view3D/write3d.c b/src/graph/view3D/write3d.c
index ac5a1210..344fb49e 100644
--- a/src/graph/view3D/write3d.c
+++ b/src/graph/view3D/write3d.c
@@ -194,15 +194,15 @@ writeViewport (int thingsToWrite)
break;

case Postscript:
- /*** Create postscript output for viewport (in fricas3D.ps)
***/
+ /*** Create postscript output for viewport (in image.ps) ***/
fricas_sprintf_to_buf2(PSfilename, "%s%s", viewDirName,
- "/fricas3D.ps");
+ "/image.ps");
if (PSInit(viewport->viewWindow,viewport->titleWindow) ==
psError)
return(-1);
drawViewport(PSoption); /* write new script file in /tmp */
if (PSCreateFile(viewBorderWidth,viewport->viewWindow,
viewport->titleWindow, viewport->title) ==
psError)
- return(-1); /* concat script & proc into fricas3D.ps */
+ return(-1); /* concat script & proc into image.ps */
break;
} /* switch on ii */
} /* if thingsToWrite >> ii */

Waldek Hebisch

unread,
Apr 21, 2024, 1:03:07 PM4/21/24
to fricas...@googlegroups.com
On Sun, Apr 21, 2024 at 08:55:34PM +0800, Qian Yun wrote:
> Currently, when using "write" to write out a viewport, we have
> "image.bm", "image.xpm", but also "fricas2D.ps", "fricas3D.ps".
>
> This patch makes PS output to have unified name "image.ps".
> This is more consistent and easier for follow up Makefile treatment.

Yes, OK.
> --
> You received this message because you are subscribed to the Google Groups "FriCAS - computer algebra system" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to fricas-devel...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/fricas-devel/e0635355-fedb-47cc-928c-5dbc105c7701%40gmail.com.

--
Waldek Hebisch

Ralf Hemmecke

unread,
Apr 21, 2024, 6:25:56 PM4/21/24
to fricas...@googlegroups.com
Hi Qian,

I've found some additional "fricas?D.*" places with a grep.
See attached patch. Would they also make sense to merge with yours?

On 4/21/24 14:55, Qian Yun wrote:
> Currently, when using "write" to write out a viewport, we have
> "image.bm", "image.xpm", but also "fricas2D.ps", "fricas3D.ps".
>
> This patch makes PS output to have unified name "image.ps".
> This is more consistent and easier for follow up Makefile treatment.
>
> Note that in the view2D/view3D control panel, you can also click
> buttons to save image (instead of viewport directory) under
> current directory, you can only save "fricas2D.ps" for 2D images,
> and "fricas3D.xpm" "fricas3D.ps" for 3D images.  Here the name
> distinction makes sense to avoid file overwrite.

I guess, my patch contains also renaming those cases to "image.*".
Perhaps it would be better to create a dialog for choosing/entering a
filename while saving a file from an interactive viewport control panel.

Otherwise, there remains stil the problem of overriding a previous image
by saving from another viewport control panel.

--
Ralf
0001-additional-renaming-to-image.patch
Reply all
Reply to author
Forward
0 new messages