MCPcopy Create free account
hub / github.com/ProgerXP/Notepad2e / Style_SelectColor

Function Style_SelectColor

src/Styles.c:2690–2807  ·  view source on GitHub ↗

============================================================================= Style_SelectColor()

Source from the content-addressed store, hash-verified

2688// Style_SelectColor()
2689//
2690BOOL Style_SelectColor ( HWND hwnd, BOOL bFore, LPWSTR lpszStyle, int cchStyle )
2691{
2692 CHOOSECOLOR cc;
2693 WCHAR szNewStyle[512];
2694 int iRGBResult;
2695 int iValue;
2696 WCHAR tch[32];
2697 ZeroMemory ( &cc, sizeof ( CHOOSECOLOR ) );
2698 iRGBResult = ( bFore ) ? GetSysColor ( COLOR_WINDOWTEXT ) : GetSysColor ( COLOR_WINDOW );
2699 Style_StrGetColor ( bFore, lpszStyle, &iRGBResult );
2700 cc.lStructSize = sizeof ( CHOOSECOLOR );
2701 cc.hwndOwner = hwnd;
2702 cc.rgbResult = iRGBResult;
2703 cc.lpCustColors = crCustom;
2704 cc.Flags = CC_FULLOPEN | CC_RGBINIT | CC_SOLIDCOLOR;
2705 if ( !ChooseColor ( &cc ) ) {
2706 return FALSE;
2707 }
2708 iRGBResult = cc.rgbResult;
2709 // Rebuild style string
2710 lstrcpy ( szNewStyle, L"" );
2711 if ( Style_StrGetFont ( lpszStyle, tch, COUNTOF ( tch ) ) ) {
2712 lstrcat ( szNewStyle, L"font:" );
2713 lstrcat ( szNewStyle, tch );
2714 }
2715 if ( Style_StrGetFontQuality ( lpszStyle, tch, COUNTOF ( tch ) ) ) {
2716 if ( lstrlen ( szNewStyle ) ) {
2717 lstrcat ( szNewStyle, L"; " );
2718 }
2719 lstrcat ( szNewStyle, L"smoothing:" );
2720 lstrcat ( szNewStyle, tch );
2721 }
2722 if ( Style_StrGetCharSet ( lpszStyle, &iValue ) ) {
2723 if ( lstrlen ( szNewStyle ) ) {
2724 lstrcat ( szNewStyle, L"; " );
2725 }
2726 wsprintf ( tch, L"charset:%i", iValue );
2727 lstrcat ( szNewStyle, tch );
2728 }
2729 if ( Style_StrGetSizeStr ( lpszStyle, tch, COUNTOF ( tch ) ) ) {
2730 if ( lstrlen ( szNewStyle ) ) {
2731 lstrcat ( szNewStyle, L"; " );
2732 }
2733 lstrcat ( szNewStyle, L"size:" );
2734 lstrcat ( szNewStyle, tch );
2735 }
2736 if ( StrStrI ( lpszStyle, L"bold" ) ) {
2737 if ( lstrlen ( szNewStyle ) ) {
2738 lstrcat ( szNewStyle, L"; " );
2739 }
2740 lstrcat ( szNewStyle, L"bold" );
2741 }
2742 if ( StrStrI ( lpszStyle, L"italic" ) ) {
2743 if ( lstrlen ( szNewStyle ) ) {
2744 lstrcat ( szNewStyle, L"; " );
2745 }
2746 lstrcat ( szNewStyle, L"italic" );
2747 }

Callers 1

Style_ConfigDlgProcFunction · 0.85

Calls 7

Style_StrGetColorFunction · 0.85
Style_StrGetFontFunction · 0.85
Style_StrGetFontQualityFunction · 0.85
Style_StrGetCharSetFunction · 0.85
Style_StrGetSizeStrFunction · 0.85
Style_StrGetCaseFunction · 0.85
Style_StrGetAlphaFunction · 0.85

Tested by

no test coverage detected