Print Page | Close Window

GetLineMarksManager should be public?

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Syntax Edit
Forum Description: Topics Related to Codejock Syntax Edit
URL: http://forum.codejock.com/forum_posts.asp?TID=7112
Printed Date: 16 April 2024 at 8:26am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: GetLineMarksManager should be public?
Posted By: znakeeye
Subject: GetLineMarksManager should be public?
Date Posted: 11 May 2007 at 3:43pm
Hi,
 
I was trying to implement a "Remove all breakpoints"-function. This was my first attempt:
 
for (int i = 1; i <= GetEditCtrl().GetRowCount(); i++)
    GetEditCtrl().DeleteBreakpoint(i);
However, that yields a crash in CArray due to an index value of -1. I think this is a bug:
void CXTPSyntaxEditLineMarksManager::CLineMarksList::Remove(const int nKey)
{
    int nIndex = FindIndex(nKey);
    // BUG? if (nKey >= 0)
    if (nIndex >= 0) // This seems more logical :)
    ...
}
 
Wouldn't it be better if GetLineMarksManager() was public or at least protected? In this case, it seems hard to fix the above without recompiling the source code. Calling HasRowMark(...) before the deletion solves it, but then you need to redraw the line marks. You cannot do this with RedrawLineMarks() since it is protected. Anyway, this is how I solved it:
 
for (int i = 1; i <= GetEditCtrl().GetRowCount(); i++)
{
    if (GetEditCtrl().HasRowMark(i, xtpEditLMT_Breakpoint))
        GetEditCtrl().DeleteBreakpoint(i);
}
GetEditCtrl().Invalidate();
   



Replies:
Posted By: znakeeye
Date Posted: 11 May 2007 at 5:06pm

Noticed another problem. The constructor of CXTPSyntaxEditPaintManager is protected. Hence, it is impossible to change the coloring of the syntax edit. For instance, I want to override CXTPSyntaxEditPaintManager::DrawLineMark.

A possible solution is to make the constructor public and then add a CXTPSyntaxEditPaintManager-pointer in the edit control. Then you could add a method such as this:
GetEditCtrl().SetSyntaxEditPaintManager(new CMySyntaxPaintMgr());
 
If the pointer is not set, then you call XTPSyntaxEditPaintManager() to get the default coloring.


Posted By: kstowell
Date Posted: 28 September 2007 at 2:56pm
Thanks for your suggestions, we are looking into the problems and should have them corrected with the next product release.

Cheers,


-------------
Kirk Stowell, President and CEO
CODEJOCK SOFTWARE SOLUTIONS<


Posted By: AndreiM
Date Posted: 12 October 2007 at 7:46am
These changes will be included to 11.2.1 release:
 
1. FIXED
Quote if (nIndex >= 0) // This seems more logical :)
 
2. GetLineMarksManager() will be public.
 
3. The constructor of CXTPSyntaxEditPaintManager will be public, DrawLineMark will be virtual.
Get/SetPaintManaget methods will be added.


-------------
Regards,
Andrei Melnik



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net