diff --git a/01_git/astime_x.c b/01_git/astime_x.c index 030ab8495a9a48f895051799d998a0925cb06f3a..ce19984beac3f25edbd52a054643f3776c7697b5 100644 --- a/01_git/astime_x.c +++ b/01_git/astime_x.c @@ -170,6 +170,10 @@ void draw_sunriset(Window win, &mainGCV); XSetForeground(mainDisplay, mainGC, color); XSetForeground(mainDisplay, neonGC, neoncolor); + XSetLineAttributes(mainDisplay, neonGC, + rint(2 * (((watch_size.x + watch_size.y) / 2.0) + * (state.othick / 1000.0))), + LineSolid, CapNotLast, JoinMiter); x = center.x; y = center.y; width = watch_size.x * size; @@ -179,10 +183,14 @@ void draw_sunriset(Window win, ret = civil_twilight(local_time->tm_year, local_time->tm_mon, local_time->tm_mday, lat, lon, &start, &end); if (1 == ret) { - FillCenteredArc(mainDisplay, win, mainGC, - x, y, width, height, 0 * 64, 359 * 64); - DrawCenteredArc(mainDisplay, win, neonGC, - x, y, width, height, 0 * 64, 359 * 64); + if (state.hprop[PHOUR][HFILL]) { + FillCenteredArc(mainDisplay, win, mainGC, + x, y, width, height, 0 * 64, 359 * 64); + } + if (state.hprop[PHOUR][HOLINE]) { + DrawCenteredArc(mainDisplay, win, neonGC, + x, y, width, height, 0 * 64, 359 * 64); + } return; } else if (-1 == ret) { return; @@ -192,10 +200,14 @@ void draw_sunriset(Window win, ret = nautical_twilight(local_time->tm_year, local_time->tm_mon, local_time->tm_mday, lat, lon, &start, &end); if (1 == ret) { - FillCenteredArc(mainDisplay, win, mainGC, - x, y, width, height, 0 * 64, 359 * 64); - DrawCenteredArc(mainDisplay, win, neonGC, - x, y, width, height, 0 * 64, 359 * 64); + if (state.hprop[PHOUR][HFILL]) { + FillCenteredArc(mainDisplay, win, mainGC, + x, y, width, height, 0 * 64, 359 * 64); + } + if (state.hprop[PHOUR][HOLINE]) { + DrawCenteredArc(mainDisplay, win, neonGC, + x, y, width, height, 0 * 64, 359 * 64); + } return; } else if (-1 == ret) { return; @@ -205,10 +217,14 @@ void draw_sunriset(Window win, ret = astronomical_twilight(local_time->tm_year, local_time->tm_mon, local_time->tm_mday, lat, lon, &start, &end); if (1 == ret) { - FillCenteredArc(mainDisplay, win, mainGC, - x, y, width, height, 0 * 64, 359 * 64); - DrawCenteredArc(mainDisplay, win, neonGC, - x, y, width, height, 0 * 64, 359 * 64); + if (state.hprop[PHOUR][HFILL]) { + FillCenteredArc(mainDisplay, win, mainGC, + x, y, width, height, 0 * 64, 359 * 64); + } + if (state.hprop[PHOUR][HOLINE]) { + DrawCenteredArc(mainDisplay, win, neonGC, + x, y, width, height, 0 * 64, 359 * 64); + } return; } else if (-1 == ret) { return; @@ -218,19 +234,27 @@ void draw_sunriset(Window win, ret = sun_rise_set(local_time->tm_year, local_time->tm_mon, local_time->tm_mday, lat, lon, &start, &end); if (1 == ret) { - FillCenteredArc(mainDisplay, win, mainGC, - x, y, width, height, 0 * 64, 359 * 64); - DrawCenteredArc(mainDisplay, win, neonGC, - x, y, width, height, 0 * 64, 359 * 64); + if (state.hprop[PHOUR][HFILL]) { + FillCenteredArc(mainDisplay, win, mainGC, + x, y, width, height, 0 * 64, 359 * 64); + } + if (state.hprop[PHOUR][HOLINE]) { + DrawCenteredArc(mainDisplay, win, neonGC, + x, y, width, height, 0 * 64, 359 * 64); + } return; } else if (-1 == ret) { return; } } else if (DARKNESS == type) { - FillCenteredArc(mainDisplay, win, mainGC, - x, y, width, height, 0 * 64, 359 * 64); - DrawCenteredArc(mainDisplay, win, neonGC, - x, y, width, height, 0 * 64, 359 * 64); + if (state.hprop[PHOUR][HFILL]) { + FillCenteredArc(mainDisplay, win, mainGC, + x, y, width, height, 0 * 64, 359 * 64); + } + if (state.hprop[PHOUR][HOLINE]) { + DrawCenteredArc(mainDisplay, win, neonGC, + x, y, width, height, 0 * 64, 359 * 64); + } return; } angle1 = (int) rint(start * 15.0); @@ -241,10 +265,14 @@ void draw_sunriset(Window win, angle1 = (360 - angle1) % 360; angle2 *= -1; } - FillCenteredArc(mainDisplay, win, mainGC, x, y, width, height, - (360 - angle1 - 90) * 64, -angle2 * 64); - DrawCenteredArc(mainDisplay, win, neonGC, x, y, width, height, - (360 - angle1 - 90) * 64, -angle2 * 64); + if (state.hprop[PHOUR][HFILL]) { + FillCenteredArc(mainDisplay, win, mainGC, x, y, width, height, + (360 - angle1 - 90) * 64, -angle2 * 64); + } + if (state.hprop[PHOUR][HOLINE]) { + DrawCenteredArc(mainDisplay, win, neonGC, x, y, width, height, + (360 - angle1 - 90) * 64, -angle2 * 64); + } } void draw_window(Window win) @@ -782,8 +810,12 @@ void draw_dial(void) GCForeground | GCLineWidth, &mainGCV); - base_size = 5 * fmin(watch_size.x, watch_size.y) / 400; + base_size = fmin(watch_size.x, watch_size.y) / 80; + XSetLineAttributes(mainDisplay, neonGC, + rint(2 * (((watch_size.x + watch_size.y) / 2.0) + * (state.othick / 1000.0))), + LineSolid, CapNotLast, JoinMiter); for (i = 0; i < 120; i++) { int size; @@ -794,12 +826,16 @@ void draw_dial(void) size = rint(fmax(base_size * 5, 6)); coord.x = center.x + rint((watch_size.x + 1) * convert2x(i / 2.0)); coord.y = center.y + rint((watch_size.y + 1) * convert2y(i / 2.0)); - FillTriangle(mainDisplay, backgroundWindow, mainGC, - coord.x, coord.y, size, rint(.5 * size), - sec_to_deg64(60 - i / 2.0)); - DrawTriangle(mainDisplay, backgroundWindow, neonGC, - coord.x, coord.y, size, rint(.5 * size), - sec_to_deg64(60 - i / 2.0)); + if (state.hprop[PHOUR][HFILL]) { + FillTriangle(mainDisplay, backgroundWindow, mainGC, + coord.x, coord.y, size, rint(.5 * size), + sec_to_deg64(60 - i / 2.0)); + } + if (state.hprop[PHOUR][HOLINE]) { + DrawTriangle(mainDisplay, backgroundWindow, neonGC, + coord.x, coord.y, size, rint(.5 * size), + sec_to_deg64(60 - i / 2.0)); + } /* hours */ } else if (state.twentyfour ? i % 5 == 0 : i % 10 == 0) { XSetForeground(mainDisplay, mainGC, pix[7]); @@ -811,10 +847,14 @@ void draw_dial(void) XDrawPoint(mainDisplay, backgroundWindow, neonGC, coord.x, coord.y); } else { - FillTopCircle(mainDisplay, backgroundWindow, mainGC, - coord.x, coord.y, size / 2, sec_to_deg64(i / 2.0)); - DrawTopCircle(mainDisplay, backgroundWindow, neonGC, - coord.x, coord.y, size / 2, sec_to_deg64(i / 2.0)); + if (state.hprop[PHOUR][HFILL]) { + FillTopCircle(mainDisplay, backgroundWindow, mainGC, + coord.x, coord.y, size / 2, sec_to_deg64(i / 2.0)); + } + if (state.hprop[PHOUR][HOLINE]) { + DrawTopCircle(mainDisplay, backgroundWindow, neonGC, + coord.x, coord.y, size / 2, sec_to_deg64(i / 2.0)); + } } /* seconds */ } else if (i % 2 == 0) { @@ -894,7 +934,21 @@ void initialize(int argc, char **argv, civil_pix = GetColor(MixCharColors(tmp_day, tmp_night, .75, mainDisplay, Root), mainDisplay, Root); + oday_pix = GetColor(state.sunrisetday, mainDisplay, Root); + onight_pix = GetColor(state.sunrisetnight, mainDisplay, Root); + oastro_pix = MixColors(state.sunrisetday, + state.sunrisetnight, .25, mainDisplay, Root); + onaut_pix = MixColors(state.sunrisetday, + state.sunrisetnight, .5, mainDisplay, Root); + ocivil_pix = MixColors(state.sunrisetday, + state.sunrisetnight, .75, mainDisplay, Root); + } else { + char tmp_day[50]; + char tmp_night[50]; + + safecopy(tmp_day, LightenCharColor(state.sunrisetday, 1.5, mainDisplay, Root), 50); + safecopy(tmp_night, LightenCharColor(state.sunrisetnight, 1.5, mainDisplay, Root), 50); day_pix = GetColor(state.sunrisetday, mainDisplay, Root); night_pix = GetColor(state.sunrisetnight, mainDisplay, Root); astro_pix = MixColors(state.sunrisetday, @@ -903,16 +957,18 @@ void initialize(int argc, char **argv, state.sunrisetnight, .5, mainDisplay, Root); civil_pix = MixColors(state.sunrisetday, state.sunrisetnight, .75, mainDisplay, Root); + oday_pix = GetColor(tmp_day, mainDisplay, Root); + onight_pix = GetColor(tmp_night, mainDisplay, Root); + oastro_pix = GetColor(MixCharColors(tmp_day, tmp_night, .25, + mainDisplay, Root), + mainDisplay, Root); + onaut_pix = GetColor(MixCharColors(tmp_day, tmp_night, .5, + mainDisplay, Root), + mainDisplay, Root); + ocivil_pix = GetColor(MixCharColors(tmp_day, tmp_night, .75, + mainDisplay, Root), + mainDisplay, Root); } - oday_pix = GetColor(state.sunrisetday, mainDisplay, Root); - onight_pix = GetColor(state.sunrisetnight, mainDisplay, Root); - oastro_pix = MixColors(state.sunrisetday, - state.sunrisetnight, .25, mainDisplay, Root); - onaut_pix = MixColors(state.sunrisetday, - state.sunrisetnight, .5, mainDisplay, Root); - ocivil_pix = MixColors(state.sunrisetday, - state.sunrisetnight, .75, mainDisplay, Root); - color_depth = DefaultDepth(mainDisplay, screen); #ifdef DEBUG printf("astime : detected color depth %d bpp, using %d bpp\n",