Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Syntax Edit
  New Posts New Posts RSS Feed - GetLineMarksManager should be public?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

GetLineMarksManager should be public?

 Post Reply Post Reply
Author
Message
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post Topic: GetLineMarksManager should be public?
    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();
   
Back to Top
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
kstowell View Drop Down
Admin Group
Admin Group


Joined: 25 January 2003
Location: MIchigan, USA
Status: Offline
Points: 496
Post Options Post Options   Thanks (0) Thanks(0)   Quote kstowell Quote  Post ReplyReply Direct Link To This Post 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<
Back to Top
AndreiM View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 18 August 2007
Status: Offline
Points: 132
Post Options Post Options   Thanks (0) Thanks(0)   Quote AndreiM Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.188 seconds.