lemon/graph_to_eps.h
changeset 538 ba659d676331
parent 485 c5919679af17
parent 491 879c55700cd4
child 550 c5fd2d996909
equal deleted inserted replaced
22:c0df1af3919f 24:1cd488171511
    27 
    27 
    28 #ifndef WIN32
    28 #ifndef WIN32
    29 #include<sys/time.h>
    29 #include<sys/time.h>
    30 #include<ctime>
    30 #include<ctime>
    31 #else
    31 #else
    32 #ifndef WIN32_LEAN_AND_MEAN
    32 #include<lemon/bits/windows.h>
    33 #define WIN32_LEAN_AND_MEAN
       
    34 #endif
       
    35 #ifndef NOMINMAX
       
    36 #define NOMINMAX
       
    37 #endif
       
    38 #include<windows.h>
       
    39 #endif
    33 #endif
    40 
    34 
    41 #include<lemon/math.h>
    35 #include<lemon/math.h>
    42 #include<lemon/core.h>
    36 #include<lemon/core.h>
    43 #include<lemon/dim2.h>
    37 #include<lemon/dim2.h>
   681     if(_title.size()>0) os << "%%Title: " << _title << '\n';
   675     if(_title.size()>0) os << "%%Title: " << _title << '\n';
   682      if(_copyright.size()>0) os << "%%Copyright: " << _copyright << '\n';
   676      if(_copyright.size()>0) os << "%%Copyright: " << _copyright << '\n';
   683     os << "%%Creator: LEMON, graphToEps()\n";
   677     os << "%%Creator: LEMON, graphToEps()\n";
   684 
   678 
   685     {
   679     {
       
   680       os << "%%CreationDate: ";
   686 #ifndef WIN32
   681 #ifndef WIN32
   687       timeval tv;
   682       timeval tv;
   688       gettimeofday(&tv, 0);
   683       gettimeofday(&tv, 0);
   689 
   684 
   690       char cbuf[26];
   685       char cbuf[26];
   691       ctime_r(&tv.tv_sec,cbuf);
   686       ctime_r(&tv.tv_sec,cbuf);
   692       os << "%%CreationDate: " << cbuf;
   687       os << cbuf;
   693 #else
   688 #else
   694       SYSTEMTIME time;
   689       os << bits::getWinFormattedDate();
   695       GetSystemTime(&time);
       
   696 #if defined(_MSC_VER) && (_MSC_VER < 1500)
       
   697       LPWSTR buf1, buf2, buf3;
       
   698       if (GetDateFormat(LOCALE_USER_DEFAULT, 0, &time,
       
   699                         L"ddd MMM dd", buf1, 11) &&
       
   700           GetTimeFormat(LOCALE_USER_DEFAULT, 0, &time,
       
   701                         L"HH':'mm':'ss", buf2, 9) &&
       
   702           GetDateFormat(LOCALE_USER_DEFAULT, 0, &time,
       
   703                         L"yyyy", buf3, 5)) {
       
   704         os << "%%CreationDate: " << buf1 << ' '
       
   705            << buf2 << ' ' << buf3 << std::endl;
       
   706       }
       
   707 #else
       
   708         char buf1[11], buf2[9], buf3[5];
       
   709         if (GetDateFormat(LOCALE_USER_DEFAULT, 0, &time,
       
   710                           "ddd MMM dd", buf1, 11) &&
       
   711             GetTimeFormat(LOCALE_USER_DEFAULT, 0, &time,
       
   712                           "HH':'mm':'ss", buf2, 9) &&
       
   713             GetDateFormat(LOCALE_USER_DEFAULT, 0, &time,
       
   714                           "yyyy", buf3, 5)) {
       
   715           os << "%%CreationDate: " << buf1 << ' '
       
   716              << buf2 << ' ' << buf3 << std::endl;
       
   717         }
       
   718 #endif
   690 #endif
   719 #endif
   691     }
   720     }
   692     os << std::endl;
   721 
   693 
   722     if (_autoArcWidthScale) {
   694     if (_autoArcWidthScale) {
   723       double max_w=0;
   695       double max_w=0;
   724       for(ArcIt e(g);e!=INVALID;++e)
   696       for(ArcIt e(g);e!=INVALID;++e)
   725         max_w=std::max(double(_arcWidths[e]),max_w);
   697         max_w=std::max(double(_arcWidths[e]),max_w);