316{
317
319
320 RECT r;
322
324 HBITMAP bufbmp = CreateCompatibleBitmap(hdc, r.right - r.left, r.bottom - r.top);
327
328
329
330 HBRUSH brush = NULL;
331
333 {
337 }
338 else
339 {
340
341 HBRUSH brush = CreateSolidBrush(0x000000);
343 DeleteObject(brush);
344
345
348 {
351 }
353
354
355 }
356
357
358
360 {
361
362 char workspacePlacement[20] = "\0";
368 {
370 }
371 else
372 {
374 }
377
378
380
381
384 {
389 }
390 DeleteObject(brush);
391 }
392
393
394
395
397 {
398 HFONT font;
400 {
401 font = CreateFont((
pSettings->
desktopGreetingFontHeight *
pSettings->
scalingFactorHiDPI), 0, 0, 0,
pSettings->
desktopGreetingFontWeight,
false,
false,
false, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE,
pSettings->
desktopGreetingFont);
402 }
403 else
404 {
406 font = CreateFont(fontHeight, 0, 0, 0, FW_NORMAL, false, false, false, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, "Segoe UI");
407 }
410
411 SIZE size;
415
417 {
421 }
422 else
423 {
429 }
430
432 DrawTextWithEffectsUnicode(
cachedBackground,
greetingRect,
CurrentGreeting, DT_CENTER | DT_TOP | DT_NOPREFIX | DT_SINGLELINE, colorHighAlpha,
false, 0,
false, 0, 0, 0);
433
434
436 }
437
438
439
440
442 {
443 HFONT font;
445 {
446 font = CreateFont((
pSettings->
desktopWeekdayFontHeight *
pSettings->
scalingFactorHiDPI), 0, 0, 0,
pSettings->
desktopWeekdayFontWeight,
false,
false,
false, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE,
pSettings->
desktopWeekdayFont);
447 }
448 else
449 {
451 font = CreateFont(fontHeight, 0, 0, 0, FW_BOLD, false, false, false, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, "Segoe UI");
452 }
455
456 SIZE size;
460
462 {
466 }
467 else
468 {
474 }
475
477 DrawTextWithEffectsUnicode(
cachedBackground,
weekdayRect,
CurrentWeekday, DT_CENTER | DT_TOP | DT_NOPREFIX | DT_SINGLELINE, colorHighAlpha,
false, 0,
false, 0, 0, 0);
478
479
481 }
482
483
484
485
487 {
488 HFONT font;
490 {
491 font = CreateFont((
pSettings->
desktopDateFontHeight *
pSettings->
scalingFactorHiDPI), 0, 0, 0,
pSettings->
desktopDateFontWeight,
false,
false,
false, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE,
pSettings->
desktopDateFont);
492 }
493 else
494 {
496 font = CreateFont(fontHeight, 0, 0, 0, FW_NORMAL, false, false, false, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, "Segoe UI");
497 }
500
501 SIZE size;
505
507 {
511 }
512 else
513 {
519 }
520
522
523 DrawTextWithEffectsUnicode(
cachedBackground,
dateRect,
CurrentDate, DT_CENTER | DT_TOP | DT_NOPREFIX | DT_SINGLELINE, colorHighAlpha,
false, 0,
false, 0, 0, 0);
524
525
527 }
528
529
530
531 bool clockAlphaApplied = false;
532
533
535 {
537 {
538 HFONT font;
540 {
541 font = CreateFont((
pSettings->
desktopClockFontHeight *
pSettings->
scalingFactorHiDPI), 0, 0, 0,
pSettings->
desktopClockFontWeight,
false,
false,
false, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE,
pSettings->
desktopClockFont);
542 }
543 else
544 {
546 font = CreateFont(fontHeight, 0, 0, 0, FW_NORMAL, false, false, false, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, "Segoe UI");
547 }
550
551 SIZE size;
555
557 {
561 }
562 else
563 {
569 }
570
572 DrawTextWithEffectsUnicode(
cachedBackground,
clockRect,
CurrentTime, DT_CENTER | DT_TOP | DT_NOPREFIX | DT_SINGLELINE, colorHighAlpha,
false, 0,
false, 0, 0, 0);
573
574
576 }
577
578
579
581 {
582 HFONT font;
584 {
585 font = CreateFont((
pSettings->
desktopClockFontHeight *
pSettings->
scalingFactorHiDPI), 0, 0, 0,
pSettings->
desktopClockFontWeight,
false,
false,
false, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE,
pSettings->
desktopClockFont);
586 }
587 else
588 {
590 font = CreateFont(fontHeight, 0, 0, 0, FW_BOLD, false, false, false, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, "Segoe UI");
591 }
594
595 char textMinutes[32] = "", textInBetween[32] = "", textHours[32] = "", textAfter[32] = "", textClock[128] = "";
596
599
600 if (relativeMinute < 30)
601 {
602 if (relativeMinute >= 20)
603 {
604 strcat(textMinutes, "TWENTY");
605 switch (relativeMinute - 20)
606 {
607 case 9: { strcat(textMinutes, " NINE"); break; }
608 case 8: { strcat(textMinutes, " EIGHT"); break; }
609 case 7: { strcat(textMinutes, " SEVEN"); break; }
610 case 6: { strcat(textMinutes, " SIX"); break; }
611 case 5: { strcat(textMinutes, " FIVE"); break; }
612 case 4: { strcat(textMinutes, " FOUR"); break; }
613 case 3: { strcat(textMinutes, " THREE"); break; }
614 case 2: { strcat(textMinutes, " TWO"); break; }
615 case 1: { strcat(textMinutes, " ONE"); break; }
616 case 0: { break; }
617 }
618 }
619 else if (relativeMinute >= 10)
620 {
621 switch (relativeMinute - 10)
622 {
623 case 9: { strcat(textMinutes, "NINETEEN"); break; }
624 case 8: { strcat(textMinutes, "EIGHTEEN"); break; }
625 case 7: { strcat(textMinutes, "SEVENTEEN"); break; }
626 case 6: { strcat(textMinutes, "SIXTEEN"); break; }
627 case 5: { strcat(textMinutes, "QUARTER "); break; }
628 case 4: { strcat(textMinutes, "FOURTEEN"); break; }
629 case 3: { strcat(textMinutes, "THIRTEEN"); break; }
630 case 2: { strcat(textMinutes, "TWELVE"); break; }
631 case 1: { strcat(textMinutes, "ELEVEN"); break; }
632 case 0: { strcat(textMinutes, "TEN"); break; }
633 }
634 }
635 else if (relativeMinute >= 0)
636 {
637 switch (relativeMinute)
638 {
639 case 9: { strcat(textMinutes, "NINE"); break; }
640 case 8: { strcat(textMinutes, "EIGHT"); break; }
641 case 7: { strcat(textMinutes, "SEVEN"); break; }
642 case 6: { strcat(textMinutes, "SIX"); break; }
643 case 5: { strcat(textMinutes, "FIVE"); break; }
644 case 4: { strcat(textMinutes, "FOUR"); break; }
645 case 3: { strcat(textMinutes, "THREE"); break; }
646 case 2: { strcat(textMinutes, "TWO"); break; }
647 case 1: { strcat(textMinutes, "ONE"); break; }
648 }
649 }
650
651 if (relativeMinute == 1) strcat(textInBetween, " minute ");
652 else if ((relativeMinute > 1) && (relativeMinute != 15)) strcat(textInBetween, " minutes ");
653
655 else if (relativeMinute > 0) strcat(textInBetween, "to ");
656 }
658 {
659 strcat(textMinutes, "HALF");
660 strcat(textInBetween, " past ");
661 }
662
665 if (relativeHour >= 24) relativeHour -= 24;
666 switch (relativeHour)
667 {
668 case 12: { strcat(textHours, "NOON"); break; }
669 case 11: case 23: { strcat(textHours, "ELEVEN"); break; }
670 case 10: case 22: { strcat(textHours, "TEN"); break; }
671 case 9: case 21: { strcat(textHours, "NINE"); break; }
672 case 8: case 20: { strcat(textHours, "EIGHT"); break; }
673 case 7: case 19: { strcat(textHours, "SEVEN"); break; }
674 case 6: case 18: { strcat(textHours, "SIX"); break; }
675 case 5: case 17: { strcat(textHours, "FIVE"); break; }
676 case 4: case 16: { strcat(textHours, "FOUR"); break; }
677 case 3: case 15: { strcat(textHours, "THREE"); break; }
678 case 2: case 14: { strcat(textHours, "TWO"); break; }
679 case 1: case 13: { strcat(textHours, "ONE"); break; }
680 case 0: { strcat(textHours, "MIDNIGHT"); break; }
681 }
682
684
685 sprintf(textClock, "%s%s%s%s", textMinutes, textInBetween, textHours, textAfter);
686
687 SIZE size;
688 GetTextExtentPoint32(
cachedBackground, textClock, strlen(textClock), &size);
691
693 {
697 }
698 else
699 {
702
706
708 }
709
712
713 if (strlen(textMinutes) > 0)
714 {
715 DrawTextWithEffects(
cachedBackground,
clockRect, textMinutes, DT_LEFT | DT_VCENTER | DT_NOPREFIX | DT_SINGLELINE, colorHighAlpha,
false, 0,
false, 0, 0, 0);
716 GetTextExtentPoint32(
cachedBackground, textMinutes, strlen(textMinutes), &size);
718
719 DrawTextWithEffects(
cachedBackground,
clockRect, textInBetween, DT_LEFT | DT_VCENTER | DT_NOPREFIX | DT_SINGLELINE, colorMediumAlpha,
false, 0,
false, 0, 0, 0);
720 GetTextExtentPoint32(
cachedBackground, textInBetween, strlen(textInBetween), &size);
722 }
723
724 DrawTextWithEffects(
cachedBackground,
clockRect, textHours, DT_LEFT | DT_VCENTER | DT_NOPREFIX | DT_SINGLELINE, colorHighAlpha,
false, 0,
false, 0, 0, 0);
725
726 if (strlen(textAfter) > 0)
727 {
728 GetTextExtentPoint32(
cachedBackground, textHours, strlen(textHours), &size);
730 DrawTextWithEffects(
cachedBackground,
clockRect, textAfter, DT_LEFT | DT_VCENTER | DT_NOPREFIX | DT_SINGLELINE, colorMediumAlpha,
false, 0,
false, 0, 0, 0);
731 }
732
734
736 }
737
738
739
741 {
742 wchar_t temp;
743 int currentDigit;
746
747
749
751 {
753 {
759 }
760 else
761 {
767 }
768 }
769 else
770 {
773 }
774
775 for (int x=1; x<=4; x++)
776 {
781 currentDigit = _wtoi(&temp);
782
783 for (int y=1; y<=4; y++)
784 {
786
788 else
789 {
795 }
796
797
799 else OffsetRect(&r, 0, 31);
800 }
801
803 else OffsetRect(&r, 52, -124);
804 }
805
806 clockAlphaApplied = true;
807
808 DeleteObject(brush);
809 }
810 }
811
812
813
814
815
816 RECT tempRect;
818 bool overlapWeekdayDateClock = false;
819 if (overlapWeekdayDate)
820 {
823 }
826
827 if (overlapWeekdayDateClock)
828 {
830 UnionRect(&tempRect, &tempRect, &
clockRect);
832 }
833 else if (overlapWeekdayDate)
834 {
837
839 }
840 else if (overlapDateClock)
841 {
844
846 }
847 else if (overlapWeekdayClock)
848 {
851
853 }
854 else
855 {
856
860 }
861
863
864
865
868
869
870
871 if (bufbmp) DeleteObject(bufbmp);
872
873 POINT pt;
875 POINT ptSrc;
876 ptSrc.x = 0, ptSrc.y = 0;
877
878 BLENDFUNCTION bf;
879 bf.BlendOp = AC_SRC_OVER;
880 bf.BlendFlags = 0;
881 bf.AlphaFormat = AC_SRC_ALPHA;
882 bf.SourceConstantAlpha = (unsigned char)255;
883
886
887
888
889
890
891
892
893
894
895
896
897
898 {
899
900 SetWindowPos(
hDesktopWnd, GetDesktopWindow(), 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE | SWP_NOSENDCHANGING | SWP_NOOWNERZORDER);
901 }
902}
void AlphaFromRGB(HDC hdc, RECT rect, unsigned char minAlpha, unsigned char maxAlpha, bool recolor, COLORREF color)
Definition BBApi.cpp:2439
void AlphaApply(HDC hdc, RECT rect)
Definition BBApi.cpp:2449
void DrawTextWithEffectsUnicode(HDC hdc, RECT r, LPWSTR text, unsigned int format, COLORREF textColor, bool outline, COLORREF outlineColor, bool shadow, COLORREF shadowColor, int shadowX, int shadowY)
Definition BBApi.cpp:3528
void AlphaRect(HDC hdc, RECT rect, unsigned char alpha)
Definition BBApi.cpp:2419
void DrawTextWithEffects(HDC hdc, RECT r, LPSTR text, unsigned int format, COLORREF textColor, bool outline, COLORREF outlineColor, bool shadow, COLORREF shadowColor, int shadowX, int shadowY)
Definition BBApi.cpp:3519
#define PLACEMENT_TOP_CENTER
Definition Settings.h:69
struct Placement Placement
#define PLACEMENT_DEFAULT
Definition Settings.h:77
#define PLACEMENT_TOP_LEFT
Definition Settings.h:68
#define PLACEMENT_TOP_RIGHT
Definition Settings.h:70
void CheckWidgetPlacement(Placement *widget)
Definition Desktop.cpp:986
void DrawWallpaper(HDC hdc)
Definition Desktop.cpp:969
int currentHour
Definition Desktop.h:91
RECT clockRect
Definition Desktop.h:93
RECT dateRect
Definition Desktop.h:93
int currentMinute
Definition Desktop.h:91
RECT weekdayRect
Definition Desktop.h:93
int DesktopCenterX
Definition Desktop.h:85
RECT greetingRect
Definition Desktop.h:93
char desktopDateFont[128]
Definition Settings.h:276
int scalingFactorHiDPI
Definition Settings.h:327
Placement desktopGreetingPlacement
Definition Settings.h:281
Placement desktopClockPlacement
Definition Settings.h:256
int currentWorkspace
Definition Settings.h:372
char desktopClockType[MAX_LINE_LENGTH]
Definition Settings.h:255
int desktopDateFontHeight
Definition Settings.h:277
BYTE desktopDateTransparencyAlpha
Definition Settings.h:274
bool desktopClockHidden
Definition Settings.h:254
bool doubleScaleHiDPI
Definition Settings.h:326
bool desktopWeekdayHidden
Definition Settings.h:263
Placement desktopDatePlacement
Definition Settings.h:273
void PositionFromPlacement(Placement *inputPlacement)
Definition Settings.cpp:3236
int desktopClockFontHeight
Definition Settings.h:260
char desktopGreetingFont[128]
Definition Settings.h:284
bool toolbarHidden
Definition Settings.h:188
int desktopGreetingFontWeight
Definition Settings.h:286
BYTE desktopClockTransparencyAlpha
Definition Settings.h:257
int desktopClockFontWeight
Definition Settings.h:261
bool desktopWeekdayFontDefined
Definition Settings.h:266
bool desktopClockFontDefined
Definition Settings.h:258
int desktopDateFontWeight
Definition Settings.h:278
Placement ToolbarPlacement
Definition Settings.h:189
bool desktopGreetingFontDefined
Definition Settings.h:283
bool desktopBorderHidden
Definition Settings.h:293
char desktopClockFont[128]
Definition Settings.h:259
bool desktopWorkspaceIndicatorHidden
Definition Settings.h:292
COLORREF desktopWidgetColor
Definition Settings.h:295
int desktopWeekdayFontWeight
Definition Settings.h:269
void ParsePlacement(LPSTR inputString, Placement *outputPlacement)
Definition Settings.cpp:3121
bool desktopDateFontDefined
Definition Settings.h:275
bool desktopGreetingHidden
Definition Settings.h:280
bool desktopDateHidden
Definition Settings.h:271
int numberOfWorkspaces
Definition Settings.h:306
Placement desktopWeekdayPlacement
Definition Settings.h:264
int desktopGreetingFontHeight
Definition Settings.h:285
BYTE desktopWeekdayTransparencyAlpha
Definition Settings.h:265
char desktopWeekdayFont[128]
Definition Settings.h:267
int desktopWeekdayFontHeight
Definition Settings.h:268
BYTE desktopGreetingTransparencyAlpha
Definition Settings.h:282
int placement
Definition Settings.h:89
int height
Definition Settings.h:97
int width
Definition Settings.h:96
int x
Definition Settings.h:94
int y
Definition Settings.h:95