MCPcopy Create free account
hub / github.com/ColorCop/ColorCop / OnChangeHexcolor

Method OnChangeHexcolor

ColorCop/ColorCopDlg.cpp:2081–2130  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2079}
2080
2081void CColorCopDlg::OnChangeHexcolor() {
2082 // the user is typing in the hex edit control
2083 // or they pasted a hex code.
2084 // OK - parse out the RGB values and convert
2085
2086 int hexrange, offset;
2087
2088 UpdateData(1); // save from control to m_Hexcolor
2089 int hexsize = 0;
2090 hexsize = m_Hexcolor.GetLength();
2091
2092 if (m_Appflags & ModeHTML) {
2093 if (m_Hexcolor.Left(1) == _T("#")) {
2094 hexrange = 5;
2095 offset = 1;
2096 } else {
2097 hexrange = 6;
2098 offset = 0;
2099 }
2100 while (hexsize > hexrange) {
2101 m_Hexcolor.Delete(6 + offset);
2102 hexsize--;
2103 }
2104 m_Reddec = m_Greendec = m_Bluedec = 0;
2105 ParseHTML(m_Hexcolor);
2106
2107 } else if (m_Appflags & ModeClarion) {
2108 // Clarion Starts with 0s
2109 if (m_Hexcolor.Left(1) == _T("0")) {
2110 hexrange = 7;
2111 offset = 1;
2112 ParseClarion(m_Hexcolor);
2113 }
2114 } else { // Delphi hex change
2115 if (m_Hexcolor.Left(1) == _T("$")) {
2116 hexrange = 7;
2117 offset = 1;
2118 } else {
2119 hexrange = 8;
2120 offset = 0;
2121 }
2122
2123 while (hexsize > hexrange) {
2124 m_Hexcolor.Delete(8 + offset);
2125 hexsize--;
2126 }
2127 m_Reddec = m_Greendec = m_Bluedec = 0;
2128 ParseDelphi(m_Hexcolor);
2129 }
2130}
2131
2132void CColorCopDlg::ParseDelphi(CString inst) {
2133 // they are typing in delphi hex codes

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected