Changeset 7458 for trunk/MagicSoft
- Timestamp:
- 12/21/05 20:34:05 (19 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r7457 r7458 18 18 19 19 -*-*- END OF LINE -*-*- 20 2005/12/21 Thomas Bretz 21 22 * mbase/MEnv.cc: 23 - enhanced grey levels to eight 24 25 * mbase/MStatusDisplay.[h,cc]: 26 - allow to open a new tab from the file menu 27 28 * mbase/MTime.[h,cc]: 29 - added algorithm to calculate week 30 31 32 20 33 2005/12/20 Daniela Dorner 21 34 -
trunk/MagicSoft/Mars/mbase/MEnv.cc
r7450 r7458 263 263 case (unsigned)-1400748595/*2894218701*/: return kMagenta+offset; 264 264 case 1851881955: return kCyan+offset; 265 case 749623518: return 18; // grey1 266 case 749623517: return 17; // grey2 267 case 749623516: return 16; // grey3 268 case 749623515: return 15; // grey4 269 case 749623514: return 14; // grey5 270 case 741234910: return 18; // gray1 271 case 741234909: return 17; // gray2 272 case 741234908: return 16; // gray3 273 case 741234907: return 15; // gray4 274 case 741234906: return 14; // gray5 265 case 749623518: return 19; // grey1 266 case 749623517: return 18; // grey2 267 case 749623516: return 17; // grey3 268 case 749623515: return 16; // grey4 269 case 749623514: return 15; // grey5 270 case 749623513: return 14; // grey6 271 case 749623512: return 13; // grey7 272 case 749623511: return 12; // grey8 273 case 741234910: return 19; // gray1 274 case 741234909: return 18; // gray2 275 case 741234908: return 17; // gray3 276 case 741234907: return 16; // gray4 277 case 741234906: return 15; // gray5 278 case 741234905: return 14; // gray6 279 case 741234904: return 13; // gray7 280 case 741234903: return 12; // gray8 275 281 } 276 282 return str.Atoi(); … … 307 313 case kMagenta: val += "Magenta"; break; 308 314 case kCyan: val += "Cyan"; break; 309 case 18: val += "White"; break; 310 case 17: val += "White"; break; 311 case 16: val += "White"; break; 312 case 15: val += "White"; break; 313 case 14: val += "White"; break; 315 case 19: val += "Grey1"; break; 316 case 18: val += "Grey2"; break; 317 case 17: val += "Grey3"; break; 318 case 16: val += "Grey4"; break; 319 case 15: val += "Grey5"; break; 320 case 14: val += "Grey6"; break; 321 case 13: val += "Grey7"; break; 322 case 12: val += "Grey8"; break; 314 323 } 315 324 -
trunk/MagicSoft/Mars/mbase/MStatusDisplay.cc
r7438 r7458 18 18 ! Author(s): Thomas Bretz, 4/2003 <mailto:tbretz@astro.uni-wuerzburg.de> 19 19 ! 20 ! Copyright: MAGIC Software Development, 2003-200 520 ! Copyright: MAGIC Software Development, 2003-2006 21 21 ! 22 22 ! … … 250 250 filemenu->AddEntry("New &Canvas", kFileCanvas); 251 251 filemenu->AddEntry("New &Browser", kFileBrowser); 252 filemenu->AddEntry("New &Tab", kFileTab); 252 253 filemenu->AddSeparator(); 253 254 … … 474 475 475 476 // Add copyright notice 476 l = new TGLabel(f, "(c) MAGIC Software Development, 2000-200 5");477 l = new TGLabel(f, "(c) MAGIC Software Development, 2000-2006"); 477 478 fList->Add(l); 478 479 f->AddFrame(l, layb); … … 1457 1458 return kTRUE; 1458 1459 1460 case kFileTab: 1461 AddTab(MString::Form("%d", fTab->GetNumberOfTabs())); 1462 return kTRUE; 1463 1459 1464 case kFileReset: 1460 1465 Reset(); … … 2472 2477 // Print overlaying text (NDC = %) 2473 2478 // 2474 ps->SetTextColor(kBlack); 2475 ps->SetTextSize(0.015); 2476 ps->SetTextFont(22); 2477 ps->SetTextAlign(11); // left top 2479 // align phi col font size (11=left top) 2480 TAttText(11, 0, kBlack, 22, 0.015).Copy(*ps); 2478 2481 PSToolsTextNDC(*ps, 0, 1.015, TString(" ")+n->GetName()); 2479 2482 ps->SetTextAlign(21); // cent top … … 2490 2493 PSToolsTextNDC(*ps, 0, -0.015, TString(" ")+txt); 2491 2494 ps->SetTextAlign(31); // right top 2492 PSToolsTextNDC(*ps, 1, -0.015, "(c) 2000-200 5, Thomas Bretz ");2495 PSToolsTextNDC(*ps, 1, -0.015, "(c) 2000-2006, Thomas Bretz "); 2493 2496 } 2494 2497 -
trunk/MagicSoft/Mars/mbase/MStatusDisplay.h
r7349 r7458 43 43 typedef enum { 44 44 // kFile 45 kFileBrowser, kFileCanvas, kFile Open, kFileSave, kFileSaveAs,45 kFileBrowser, kFileCanvas, kFileTab, kFileOpen, kFileSave, kFileSaveAs, 46 46 kFileSaveAsPS, kFileSaveAsPDF, kFileSaveAsSVG, kFileSaveAsRoot, 47 47 kFileSaveAsPNG, kFileSaveAsGIF, kFileSaveAsJPG, kFileSaveAsXPM, -
trunk/MagicSoft/Mars/mbase/MTime.cc
r7450 r7458 480 480 // -------------------------------------------------------------------------- 481 481 // 482 // Return Mjd of the first day (a monday) which belongs to week 1 of 483 // the year give as argument. The returned Mjd might be a date in the 484 // year before. 485 // 486 // see also MTime::Week() 487 // 488 Int_t MTime::GetMjdWeek1(Short_t year) 489 { 490 MTime t; 491 t.Set(year, 1, 4); 492 493 return (Int_t)t.GetMjd() + t.WeekDay() - 6; 494 } 495 496 // -------------------------------------------------------------------------- 497 // 482 498 // Get the week of the year. Valid week values are between 1 and 53. 483 // 54 is returned if the day belongs to Week=1 of the next year, 484 // 0 if it belongs to the Week=53 and -1 if it belongs to the Week=52 485 // of the last year (In this case there is no week 53!) 486 // 487 Int_t MTime::Week() const 488 { 489 static const Int_t kFrSaSo = BIT(kFriday) | BIT(kSaturday) | BIT(kSunday); 490 static const Int_t kTuWeTh = BIT(kTuesday) | BIT(kWednesday) | BIT(kThursday); 491 492 MTime t; 493 t.Set(Year(), 1, 1); 494 495 // The weekday of Jan 1st. 496 const Int_t day1st = 1<<t.WeekDay(); 497 498 // The number of weeks since the first Monday in the year 499 Int_t week = (DayOfYear()-1 + (t.WeekDay()+6)%7) / 7 + 1; 500 501 // Correct the week number if the year has started with Fr, Sa or So 502 if (day1st & kFrSaSo) 503 week--; 504 505 // If the week number is 53 it might already belong to the next year 506 if (week == 53) 499 // If for a january date a week number above 50 is returned the 500 // week belongs to the previous year. If for a december data 1 is 501 // returned the week already belongs to the next year. 502 // 503 // The year to which the week belongs is returned in year. 504 // 505 // Die Kalenderwochen werden für Jahre ab 1976 berechnet, da mit 506 // Geltung vom 1. Januar 1976 der Wochenbeginn auf Montag festgelegt 507 // wurde. Die erste Woche ist definiert als die Woche, in der 508 // mindestens 4 der ersten 7 Januartage fallen (also die Woche, in der 509 // der 4. Januar liegt). Beides wurde damals festgelegt in der DIN 1355 510 // (1974). Inhaltlich gleich regelt das die Internationale Norm 511 // ISO 8601 (1988), die von der Europäischen Union als EN 28601 (1992) 512 // übernommen und in Deutschland als DIN EN 28601 (1993) umgesetzt 513 // wurde. 514 // 515 Int_t MTime::Week(Short_t &year) const 516 { 517 // Possibilities for Week 1: 518 // 519 // Mo 4.Jan: Mo 4. - So 10. -0 6-6 520 // Di 4.Jan: Mo 3. - So 9. -1 6-5 521 // Mi 4.Jan: Mo 2. - So 8. -2 6-4 522 // Do 4.Jan: Mo 1. - So 7. -3 6-3 523 // Fr 4.Jan: Mo 31. - So 6. -4 6-2 524 // Sa 4.Jan: Mo 30. - So 5. -5 6-1 525 // So 4.Jan: Mo 29. - So 4. -6 6-0 526 // 527 const Int_t mjd2 = GetMjdWeek1(Year()-1); 528 const Int_t mjd0 = GetMjdWeek1(Year()); 529 const Int_t mjd3 = GetMjdWeek1(Year()+1); 530 531 // Today 532 const Int_t mjd = (Int_t)GetMjd(); 533 534 // Week belongs to last year, return week of last year 535 if (mjd<mjd0) 507 536 { 508 t.Set(Year()+1, 1, 1); 509 510 const Int_t daynext = 1<<t.WeekDay(); 511 return daynext&kTuWeTh ? 54 : 53; 537 year = Year()-1; 538 return (mjd-mjd2)/7 + 1; 512 539 } 513 540 514 // If the week number is 53 it might still belong to the last year515 if ( week == 0)541 // Check if Week belongs to next year (can only be week 1) 542 if ((mjd3-mjd)/7==1) 516 543 { 517 t.Set(Year()-1, 1, 1); 518 519 const Int_t dayprev = 1<<t.WeekDay(); 520 return !(dayprev&kFrSaSo) && (day1st&kFrSaSo) ? 0 : -1; 544 year = Year()+1; 545 return 1; 521 546 } 522 547 523 return week; 548 // Return calculated Week 549 year = Year(); 550 return (mjd-mjd0)/7 + 1; 524 551 } 525 552 -
trunk/MagicSoft/Mars/mbase/MTime.h
r7450 r7458 125 125 UInt_t Sec() const { Byte_t h, m, s; GetTime(h,m,s); return s; } 126 126 UInt_t DayOfYear() const; 127 Int_t Week() const; 127 Int_t Week() const { Short_t y; return Week(y); } 128 Int_t Week(Short_t &year) const; 128 129 129 130 Bool_t IsMidnight() const { return (Long_t)fTime==0 && fNanoSec==0; } … … 165 166 166 167 static MTime GetEaster(Short_t year=-1); 168 static Int_t GetMjdWeek1(Short_t year); 167 169 168 170 ClassDef(MTime, 3) //A generalized MARS time stamp
Note:
See TracChangeset
for help on using the changeset viewer.