From 6c7fa97a9625b99c38e67796d70795f48a1c24f2 Mon Sep 17 00:00:00 2001 From: Jeff Moe Date: Sat, 6 Aug 2022 11:18:46 -0600 Subject: [PATCH] Feature: resize window width/height option --- skymap.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/skymap.c b/skymap.c index 8618be2..373ffd8 100644 --- a/skymap.c +++ b/skymap.c @@ -42,7 +42,7 @@ struct map int level, grid, site_id, plotstars, plotapex; int leoflag, iodflag, iodpoint, visflag, planar, pssatno, psnr, xyzflag, pflag, graves; - float psrmin, psrmax, rvis; + float psrmin, psrmax, rvis, width, height; } m; struct sat { @@ -146,6 +146,8 @@ usage () printf ("-D, --decl Decl. [+dd:mm:ss.ss]\n"); printf ("-A, --azimuth Azimuth (deg)\n"); printf ("-E, --elevation Elevation (deg)\n"); + printf ("-w, --width Screen width\n"); + printf ("-g, --height Screen height\n"); printf ("-S, --all-night All night\n"); printf ("-Q, --no-stars No stars\n"); printf @@ -255,6 +257,8 @@ init_skymap (void) m.graves = 0; m.plotstars = 1; m.plotapex = 1; + m.width=800; + m.height=600; // Default settings strcpy (m.observer, "Unknown"); @@ -692,6 +696,8 @@ main (int argc, char *argv[]) {"azimuth", required_argument, 0, 'A'}, {"elevation", required_argument, 0, 'E'}, {"site", required_argument, 0, 's'}, + {"width", required_argument, 0, 'w'}, + {"height", required_argument, 0, 'g'}, {"length", required_argument, 0, 'l'}, {"planar-id", required_argument, 0, 'P'}, {"planar-alt", required_argument, 0, 'r'}, @@ -709,7 +715,7 @@ main (int argc, char *argv[]) }; int option_index = 0; - c = getopt_long (argc, argv, "t:c:i:R:D:A:E:s:l:P:r:V:p:L:B:H:d:SQah", + c = getopt_long (argc, argv, "t:c:i:R:D:A:E:s:w:g:l:P:r:V:p:L:B:H:d:SQah", long_options, &option_index); if (c == -1) @@ -828,6 +834,14 @@ main (int argc, char *argv[]) m.level = 3; break; + case 'w': + m.width = atof (optarg); + break; + + case 'g': + m.height = atof (optarg); + break; + case 'Q': m.plotstars = 0; break; @@ -867,7 +881,7 @@ main (int argc, char *argv[]) strcpy (m.observer, "Manual observer"); } - init_plot ("/xs", 0, 0.75); + init_plot ("/xs", m.width, m.height); plot_skymap (); @@ -1123,12 +1137,12 @@ plot_visibility (float h) // Initialize plot void -init_plot (char *psfile, float width, float aspect) +init_plot (char *psfile, float width, float height) { int i; // Initialize plot - giza_open_device_size_float ("/xs", "skymap", 1920, 1020, 3); + giza_open_device_size_float ("/xs", "skymap", width, height, 3); cpgslw (1); skymap_plot_renew ();