MCPcopy Create free account
hub / github.com/WheretIB/nullc / CreateShared

Function CreateShared

GUI/RichTextarea.cpp:611–653  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

609 }
610
611 void CreateShared(HWND wnd)
612 {
613 if(sharedCreated)
614 return;
615
616 if(!AreaLine::pool)
617 AreaLine::pool = new ObjectBlockPool<AreaLine, 32>();
618
619 HDC hdc = BeginPaint(wnd, &areaPS);
620
621 int found = 0;
622 EnumFontFamilies(hdc, "Consolas", InitFont, (LPARAM)&found);
623 const char *fontFam = "Courier New";
624 bool italic = false;
625 if(found)
626 {
627 fontFam = "Consolas";
628 italic = true;
629 }
630
631 // Create font for every FONT_STYLE
632 areaFont[FONT_REGULAR] = CreateFont(-10 * GetDeviceCaps(hdc, LOGPIXELSY) / 72, 0, 0, 0, FW_REGULAR, false, false, false,
633 RUSSIAN_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH, fontFam);
634 areaFont[FONT_BOLD] = CreateFont(-10 * GetDeviceCaps(hdc, LOGPIXELSY) / 72, 0, 0, 0, FW_BOLD, false, false, false,
635 RUSSIAN_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH, fontFam);
636 areaFont[FONT_ITALIC] = CreateFont(-10 * GetDeviceCaps(hdc, LOGPIXELSY) / 72, 0, 0, 0, FW_REGULAR, italic, false, false,
637 RUSSIAN_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH, fontFam);
638 areaFont[FONT_UNDERLINED] = CreateFont(-10 * GetDeviceCaps(hdc, LOGPIXELSY) / 72, 0, 0, 0, FW_REGULAR, false, true, false,
639 RUSSIAN_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH, fontFam);
640
641 // Create pens and brushes
642 areaPenWhite1px = CreatePen(PS_SOLID, 1, RGB(255, 255, 255));
643 areaPenBlack1px = CreatePen(PS_SOLID, 1, RGB(0, 0, 0));
644
645 areaBrushWhite = CreateSolidBrush(RGB(255, 255, 255));
646 areaBrushBlack = CreateSolidBrush(RGB(0, 0, 0));
647 areaBrushSelected = CreateSolidBrush(RGB(51, 153, 255));
648 areaBrushTool = CreateSolidBrush(RGB(232, 232, 232));
649
650 EndPaint(wnd, &areaPS);
651
652 sharedCreated = true;
653 }
654
655 static const unsigned int CONTEXT_CUT = 2000;
656 static const unsigned int CONTEXT_COPY = 2001;

Callers 1

OnCreateFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected