Question

AdornmentManagerBase

Posted 3 years ago by Avatar CodyVanZant
I'm creating my own Adornment Manager from AdornmentManagerBase and I can't find any documentation on how to come up with the location to place the adornment.

Can I get the inherited classes to look at and learn from? (Like your DecoratorAdornmentManager)

I cannot figure out where to get the right values from. All the places determining placement are hidden from me. The bounds field passed into AddAdornment from the inherited class DecoratorAdornmentManager... how do you compute those bounds? I'd like to know how to do that myself, but it is no where to be found.

Comments (8)

Posted 3 years ago by Actipro Software Support - Cleveland, OH, USA
Cody,

The IAdornment.Location property lets you set where to put the adornment, which is also an argument to the adornment layer's AddAdornment method.

Take a look at the AdornmentsSmokeText QuickStart as it shows you how to render adornments anywhere, basically what you are trying to do.

Actipro Software Support
Posted 3 years ago by CodyVanZant
I know how to add an Adornment by specifying a location.

What i was asking was how to compute the correct coordinates from the objects I get back from the various events like TextAreaLayout, OnDocumentTextChanged, etc....

I'm also using a tagAggregator to get specific tags.

I want to place the Adornment where the tag was found afterall. I know there's a way, I just can't find any documentation on any of this magic which typically happens behind the scenes unless you want to make your own Adornment like I am.
Posted 3 years ago by Actipro Software Support - Cleveland, OH, USA
If you are driving these adornments by tags then you'd want to use DecorationAdornmentManagerBase since it makes things super easy in that case. And some QuickStarts show use of that.

What we do is get ITextViewLine instances (such as from view.VisibleViewLines) and then we call viewLine.GetTextBounds(textRange) to get the bounds in the line for a desired textRange (such as from a tag). Then we add the adornments using those bounds.

Actipro Software Support
Posted 3 years ago by CodyVanZant
Thanks. I need to be in a little bit more control over the manager so I need to handle the guts myself.
Posted 3 years ago by CodyVanZant
I'm attempting to do an IntraText mixed with Decorator. I am placing Tags based on the text, not manually, but I also want space to be taken for the control I'll be placing there.

I've got it to place the tags and I can place the control into the text at the right location, but now I don't quite know where to make it take the space as I want it to.

I looked at the code in the IntraText sample and nothing in the Tag or Tagger seems to handle this.

Is this done in the IntraTextAdornmentManager class? If so can you explain what happens there so I can have my custom AdornmentManager do it?

THanks,

Cody
Posted 3 years ago by Actipro Software Support - Cleveland, OH, USA
Hi Cody,

In the AdornmentsIntraTextNotes QuickStart, our IntraTextNoteTag implements the IIntraTextSpacerTag interface. That IIntraTextSpacerTag interface is what helps drive the intra-text spaces. It has properties for the Size of the space, etc. So if your tag implements that interface then it should be "reserving" the spaces.

Now that you have space reserved, the IntraTextNoteAdornmentManager is what adds an adornment over that space. Note that it inherits IntraTextAdornmentManagerBase<IEditorView, IntraTextNoteTag>. That class has some built in functionality such that its AddAdornment callback passes the bounds of the space. So you just put your adornments in those bounds.

For more low-level info, the bounds it passes comes from the viewLine.GetIntraTextSpacerBounds method.

Actipro Software Support
Posted 3 years ago by CodyVanZant
My Tag is already of type IIntraTextSpacerTag. I set a Size when I make it. I have a custom AdornmentManager that is based only on AdornmentManagerBase. This is a requirement.

I cannot get any space to be created within the text area.

My Tagger is of type TaggerBase. When I switch the base to being CollectionTagger and ITagger like in the example IIntraTextNotes, no tags are found by my Tag Aggregator. I know I'm creating the tags but none return when TextAreaLayout asks for them.
Posted 3 years ago by Actipro Software Support - Cleveland, OH, USA
If your tagger is ITagger<IIntraTextSpacerTag> and it's been properly placed on the document or view via a tagger provider, it should able to be found. Then the spaces should appear.

If you can't figure it out, please make a new simple sample project that shows the issue, and email it over. Rename the .zip file extension so it doesn't get spam blocked.

Actipro Software Support
Information The latest build of this product (2014.2 build 0610) was released 2 months ago, which was after the last post in this thread.

Add a Comment

Please log in to a validated account to post comments.