/** * @file XTPSyntaxEditStruct.cpp * * @copyright * (c) 1998-2025 Codejock Software, All Rights Reserved. * * This source file is the property of Codejock Software and must not be * redistributed by any means without the explicit written permission of * Codejock Software. * * The use of this source code is governed by the terms and conditions specified * in the Toolkit Pro license agreement. Codejock Software grants you, as a * single software developer, the limited right to use this software on one * computer only. * * Contact Information: * support@codejock.com * http://www.codejock.com * */ #include "stdafx.h" // common includes #include "Common/XTPTypeId.h" #include "Common/XTPFramework.h" #include "Common/XTPSystemHelpers.h" #include "Common/XTPSynchro.h" #include "Common/XTPApplication.h" #include "Common/XTPSingleton.h" #include "Common/XTPColorManager.h" // syntax editor includes #include "SyntaxEdit/XTPSyntaxEditDefines.h" #include "SyntaxEdit/XTPSyntaxEditStruct.h" #include "SyntaxEdit/XTPSyntaxEditCtrl.h" #include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" #ifdef _DEBUG # undef THIS_FILE static char THIS_FILE[] = __FILE__; # define new DEBUG_NEW #endif //=========================================================================== // XTP_EDIT_LINECOL //=========================================================================== const XTP_EDIT_LINECOL XTP_EDIT_LINECOL::MAXPOS = { INT_MAX, INT_MAX }; const XTP_EDIT_LINECOL XTP_EDIT_LINECOL::MINPOS = { 0, 0 }; const XTP_EDIT_LINECOL XTP_EDIT_LINECOL::Pos1 = { 1, 0 }; const XTP_EDIT_LINECOL AFX_CDECL XTP_EDIT_LINECOL::MakeLineCol(int nParamLine, int nParamCol) { XTP_EDIT_LINECOL ret; ret.nLine = nParamLine; ret.nCol = nParamCol; return ret; } const XTP_EDIT_LINECOL AFX_CDECL XTP_EDIT_LINECOL::min2(const XTP_EDIT_LINECOL& pos1, const XTP_EDIT_LINECOL& pos2) { XTP_EDIT_LINECOL lcPos; lcPos.nLine = min(pos1.nLine, pos2.nLine); lcPos.nCol = min(pos1.nCol, pos2.nCol); return lcPos; } const XTP_EDIT_LINECOL AFX_CDECL XTP_EDIT_LINECOL::max2(const XTP_EDIT_LINECOL& pos1, const XTP_EDIT_LINECOL& pos2) { XTP_EDIT_LINECOL lcPos; lcPos.nLine = max(pos1.nLine, pos2.nLine); lcPos.nCol = max(pos1.nCol, pos2.nCol); return lcPos; } DWORD XTP_EDIT_LINECOL::GetXLC() const { return XTP_EDIT_XLC(nLine, nCol); } BOOL XTP_EDIT_LINECOL::IsValidData() const { return nLine > 0; } void XTP_EDIT_LINECOL::Clear() { nLine = 0; nCol = 0; } BOOL XTP_EDIT_LINECOL::operator<(const XTP_EDIT_LINECOL& pos2) const { return nLine < pos2.nLine || nLine == pos2.nLine && nCol < pos2.nCol; } BOOL XTP_EDIT_LINECOL::operator<=(const XTP_EDIT_LINECOL& pos2) const { return nLine < pos2.nLine || nLine == pos2.nLine && nCol <= pos2.nCol; } BOOL XTP_EDIT_LINECOL::operator>(const XTP_EDIT_LINECOL& pos2) const { return nLine > pos2.nLine || nLine == pos2.nLine && nCol > pos2.nCol; } BOOL XTP_EDIT_LINECOL::operator>=(const XTP_EDIT_LINECOL& pos2) const { return nLine > pos2.nLine || nLine == pos2.nLine && nCol >= pos2.nCol; } BOOL XTP_EDIT_LINECOL::operator==(const XTP_EDIT_LINECOL& pos2) const { return nLine == pos2.nLine && nCol == pos2.nCol; } //----------------------------------------------------------------------- // Summary: // This member function is used to Get Back Color Ex // Parameters: // pEditCtrl - pointer to CXTPSyntaxEditCtrl object //----------------------------------------------------------------------- COLORREF XTP_EDIT_COLORVALUES::GetBackColorEx(CXTPSyntaxEditCtrl* pEditCtrl) { if (pEditCtrl && pEditCtrl->IsReadOnly() && !pEditCtrl->IsViewOnly()) return (COLORREF)crReadOnlyBack; return (COLORREF)crBack; } //=========================================================================== // XTP_EDIT_FONTOPTIONS //=========================================================================== XTP_EDIT_FONTOPTIONS::XTP_EDIT_FONTOPTIONS() { lfHeight = XTP_EDIT_FONTOPTIONS_UNSPEC_OPTION; lfWidth = XTP_EDIT_FONTOPTIONS_UNSPEC_OPTION; lfEscapement = XTP_EDIT_FONTOPTIONS_UNSPEC_OPTION; lfOrientation = XTP_EDIT_FONTOPTIONS_UNSPEC_OPTION; lfWeight = XTP_EDIT_FONTOPTIONS_UNSPEC_OPTION; lfItalic = XTP_EDIT_FONTOPTIONS_UNSPEC_OPTION; lfUnderline = XTP_EDIT_FONTOPTIONS_UNSPEC_OPTION; lfStrikeOut = XTP_EDIT_FONTOPTIONS_UNSPEC_OPTION; lfCharSet = XTP_EDIT_FONTOPTIONS_UNSPEC_OPTION; lfOutPrecision = XTP_EDIT_FONTOPTIONS_UNSPEC_OPTION; lfClipPrecision = XTP_EDIT_FONTOPTIONS_UNSPEC_OPTION; lfQuality = XTP_EDIT_FONTOPTIONS_UNSPEC_OPTION; lfPitchAndFamily = XTP_EDIT_FONTOPTIONS_UNSPEC_OPTION; lfFaceName[0] = '\0'; } //=========================================================================== // XTP_EDIT_TEXTBLOCK //=========================================================================== // Default constructor XTP_EDIT_TEXTBLOCK::XTP_EDIT_TEXTBLOCK() { nPos = 0; nNextBlockPos = 0; }