MCPcopy Create free account
hub / github.com/CruiserOne/Astrolog / XChartCalendar

Function XChartCalendar

xcharts1.cpp:3574–3609  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3572// as done when the -K or -Ky is combined with the -X switch.
3573
3574void XChartCalendar()
3575{
3576 int xs, ys, xunit, yunit, x1, y1, x, y;
3577 flag fTransit = gs.fLabelAsp && us.nRel < rcNone;
3578
3579 if (!us.fCalendarYear) {
3580 DrawCalendar(!fTransit ? Mon : MonT, !fTransit ? Yea : YeaT,
3581 0, 0, gs.xWin, gs.yWin);
3582 return;
3583 }
3584
3585 // Determine the best sized rectangle of months to draw the year in based on
3586 // the chart dimensions: Either do 6x2 months, or 4x3, 3x4, or 2x6.
3587
3588 if (gs.xWin > gs.yWin) {
3589 if (gs.xWin > gs.yWin * 3) {
3590 xs = 6; ys = 2;
3591 } else {
3592 xs = 4; ys = 3;
3593 }
3594 } else {
3595 if (gs.yWin > gs.xWin * 2) {
3596 xs = 2; ys = 6;
3597 } else {
3598 xs = 3; ys = 4;
3599 }
3600 }
3601 xunit = gs.xWin / xs; yunit = gs.yWin / ys;
3602 x1 = (gs.xWin - xunit*xs) / 2;
3603 y1 = (gs.yWin - yunit*ys) / 2;
3604 for (y = 0; y < ys; y++)
3605 for (x = 0; x < xs; x++) {
3606 DrawCalendar(y * xs + x + 1, !fTransit ? Yea : YeaT, x1 + x*xunit,
3607 y1 + y*yunit, x1 + (x+1)*xunit, y1 + (y+1)*yunit);
3608 }
3609}
3610
3611
3612// Draw a chart showing the locations of planetary moons, showing geocentric

Callers 1

DrawChartXFunction · 0.85

Calls 1

DrawCalendarFunction · 0.85

Tested by

no test coverage detected