Index: /trunk/MagicSoft/Cosy/Changelog
===================================================================
--- /trunk/MagicSoft/Cosy/Changelog	(revision 1815)
+++ /trunk/MagicSoft/Cosy/Changelog	(revision 1816)
@@ -1,3 +1,11 @@
                                                                   -*-*- END -*-*-
+ 2003/03/12 - Daniela Dorner, Thomas Bretz:
+
+   * gui/MGPngReader.cc, gui/MGStarguider.cc, videodev/Writer.[h,cc]:
+     - changed output file names to contain mjd
+     - fixed a cast warning
+
+
+
  2003/03/11 - Daniela Dorner, Thomas Bretz:
 
Index: /trunk/MagicSoft/Cosy/gui/MGPngReader.cc
===================================================================
--- /trunk/MagicSoft/Cosy/gui/MGPngReader.cc	(revision 1815)
+++ /trunk/MagicSoft/Cosy/gui/MGPngReader.cc	(revision 1816)
@@ -553,5 +553,5 @@
     }
 
-    fFile = new TFile("leds.root", "RECREATE");
+    fFile = new TFile(name, "RECREATE");
 
     if (!fFile->IsOpen())
@@ -999,18 +999,8 @@
     {
         if (fFileType->IsEntryChecked(IDM_kPNG))
-        {
-            static int num = 0;
-            char name[80];
-            sprintf(name, "pix/file%04d.png", num++);
-            Writer::Png(name, c, tm);
-        }
+            Writer::Png("pix/file", c, tm);
 
         if (fFileType->IsEntryChecked(IDM_kPPM))
-        {
-            static int num = 0;
-            char name[80];
-            sprintf(name, "pix/file%04d.ppm", num++);
-            Writer::Ppm(name, c);
-        }
+            Writer::Ppm("pix/file", c, tm);
 
         if (fWriteType->IsEntryChecked(IDM_kOnce))
@@ -1149,8 +1139,8 @@
 void MGPngReader::DrawCircle(byte *img, double r)
 {
-    const double rpix = (int)(r*60*60/fSao->GetPixSize()+1);
+    const double rpix = r*60*60/fSao->GetPixSize()+1;
     const int cx = 768/2;
     const int cy = 576/2;
-    for (int dx=-rpix*0.7; dx<rpix*0.7; dx++)
+    for (int dx=-(int)(rpix*0.7); dx<(int)(rpix*0.7); dx++)
     {
         const int dy = (int)sqrt(rpix*rpix-dx*dx);
Index: /trunk/MagicSoft/Cosy/gui/MGStarguider.cc
===================================================================
--- /trunk/MagicSoft/Cosy/gui/MGStarguider.cc	(revision 1815)
+++ /trunk/MagicSoft/Cosy/gui/MGStarguider.cc	(revision 1816)
@@ -572,18 +572,8 @@
     {
         if (fFileType->IsEntryChecked(IDM_kPNG))
-        {
-            static int num = 0;
-            char name[80];
-            sprintf(name, "pix/file%04d.png", num++);
-            Writer::Png(name, c, tm);
-        }
+            Writer::Png("pix/file", c, tm);
 
         if (fFileType->IsEntryChecked(IDM_kPPM))
-        {
-            static int num = 0;
-            char name[80];
-            sprintf(name, "pix/file%04d.ppm", num++);
-            Writer::Ppm(name, c);
-        }
+            Writer::Ppm("pix/file", c, tm);
 
         if (fWriteType->IsEntryChecked(IDM_kOnce))
Index: /trunk/MagicSoft/Cosy/videodev/Writer.cc
===================================================================
--- /trunk/MagicSoft/Cosy/videodev/Writer.cc	(revision 1815)
+++ /trunk/MagicSoft/Cosy/videodev/Writer.cc	(revision 1816)
@@ -14,10 +14,18 @@
                  struct timeval *date)
 {
-    cout << "Writing PNG '" << fname << "'" << endl;
+    TString name = fname;
+
+    Timer t(date);
+
+    name += "_";
+    name += t.GetMjd()-52000;
+    name += ".png";
+
+    cout << "Writing PNG '" << name << "'" << endl;
 
     //
     // open file
     //
-    FILE *fd = fopen(fname, "w");
+    FILE *fd = fopen(name, "w");
     if (!fd)
     {
@@ -113,12 +121,20 @@
 }
 
-void Writer::Ppm(const char *fname, const byte *img)
+void Writer::Ppm(const char *fname, const byte *img, struct timeval *date)
 {
-    cout << "Writing PPM '" << fname << "'" << endl;
+    TString name = fname;
+
+    Timer t(date);
+
+    name += "_";
+    name += t.GetMjd()-52000;
+    name += ".ppm";
+
+    cout << "Writing PPM '" << name << "'" << endl;
 
     //
     // open file for writing
     //
-    ofstream fout(fname);
+    ofstream fout(name);
     if (!fout)
     {
Index: /trunk/MagicSoft/Cosy/videodev/Writer.h
===================================================================
--- /trunk/MagicSoft/Cosy/videodev/Writer.h	(revision 1815)
+++ /trunk/MagicSoft/Cosy/videodev/Writer.h	(revision 1816)
@@ -17,5 +17,5 @@
 public:
 
-    static void Ppm(const char *fname, const byte *img);
+    static void Ppm(const char *fname, const byte *img, struct timeval *date);
     static void Png(const char *fname, const byte *buf, struct timeval *date);
 
