Use custom markers in annotations

I am trying to use custom markers as tags to create figures such as the one attached to this post. Currently, I load the custom marker with this procedure
Function TagCursorA1(traceName)
//tag trace at specified point
    String traceName
    Variable xValue = xcsr(A)
    Tag/F=0/L=0/B=1/X=0.0/Y=0.0 $traceName, xValue, "\\$PICT$name=half_emf$/PICT$"
End



How can I use the markers that I defined using the WMMarkerHookStruct procedure to obtain the same result?

Here's the code I created for the hook function using the example provided in the help
Function CirclesMarkerProc(s)
    STRUCT WMMarkerHookStruct &s
    if( s.marker > 3 )
            return 0
    endif

    Variable size= s.size-s.penThick/2
   
    if( s.opaque )
        SetDrawEnv linethick=0,fillpat=-1
        DrawRect s.x-size,s.y-size,s.x+size,s.y+size
        SetDrawEnv linethick=s.penThick
    endif

    switch(s.marker)
    case 0:             // Up
        SetDrawEnv linethick=s.penThick, fillpat=1,fillfgc= (s.mrkRGB.red,s.mrkRGB.green,s.mrkRGB.blue), linefgc=(s.penRGB.red,s.penRGB.green,s.penRGB.blue)
        DrawOval s.x-size,s.y-size,s.x+size,s.y+size
        SetDrawEnv fillfgc= (65535,65535,65535),linefgc=(s.mrkRGB.red,s.mrkRGB.green,s.mrkRGB.blue)
        DrawArc s.x,s.y,size-s.penThick,0,180
        Break
    case 1:         //Right
        SetDrawEnv linethick=s.penThick, fillpat=1,fillfgc= (s.mrkRGB.red,s.mrkRGB.green,s.mrkRGB.blue), linefgc=(s.penRGB.red,s.penRGB.green,s.penRGB.blue)
        DrawOval s.x-size,s.y-size,s.x+size,s.y+size
        SetDrawEnv fillfgc= (65535,65535,65535),linefgc=(s.mrkRGB.red,s.mrkRGB.green,s.mrkRGB.blue)
        DrawArc s.x,s.y,size-s.penThick,-90,90
        Break
    case 2:             // Bottom
        SetDrawEnv linethick=s.penThick, fillpat=1,fillfgc= (s.mrkRGB.red,s.mrkRGB.green,s.mrkRGB.blue), linefgc=(s.penRGB.red,s.penRGB.green,s.penRGB.blue)
        DrawOval s.x-size,s.y-size,s.x+size,s.y+size
        SetDrawEnv fillfgc= (65535,65535,65535),linefgc=(s.mrkRGB.red,s.mrkRGB.green,s.mrkRGB.blue)
        DrawArc s.x,s.y,size-s.penThick,180,0
        Break
    case 3:         //left
        SetDrawEnv linethick=s.penThick, fillpat=1,fillfgc= (s.mrkRGB.red,s.mrkRGB.green,s.mrkRGB.blue), linefgc=(s.penRGB.red,s.penRGB.green,s.penRGB.blue)
        DrawOval s.x-size,s.y-size,s.x+size,s.y+size
        SetDrawEnv fillfgc= (65535,65535,65535),linefgc=(s.mrkRGB.red,s.mrkRGB.green,s.mrkRGB.blue)
        DrawArc s.x,s.y,size-s.penThick,90,-90
        Break
    endswitch
    return 1
End


I'll place the previous code place it in the code snippets section

Thanks

The marker draw proc is only part of the solution. You need to tell Igor the name of the hook and also define the start and ending marker range.

From the example in the "Custom Marker Hook Functions" topic:

ModifyGraph mode=3,marker(testw)=100,marker(testw#1)=101,marker(testw#2)=102,marker(testw#3)=103
SetWindow kwTopWin,markerHook={AudiologyMarkerProc,100,103}


That last command identifies the draw proc as AudiologyMarkerProc, and states that it should be called to draw markers with values between 100 and 103.

The start value of 100 is subtracted before being passed as s.marker, so the s.marker values are 0 to 3, not 100 to 103.

And that's why the marker(testw)=100 command is used to demonstrate AudiologyMarkerProc.

You can define your own range, say 555 to 558, but make sure you use marker(traceName)=555 for the s.marker=0:

SetWindow kwTopWin,markerHook={CirclesMarkerProc,555,558}




--Jim Prouty
Software Engineer, WaveMetrics, Inc.
JimProuty wrote:

The start value of 100 is subtracted before being passed as s.marker, so the s.marker values are 0 to 3, not 100 to 103.


Thanks for the clarification about the start and ending marker range Jim!


I would still like to know if a custom marker could be used as part of the  Tag command. For example, a filled circle on top of the point selected can be drawn with

Tag/F=0/L=0/B=1/X=0.0/Y=0.0 $traceName, xValue, "\\W519"


Is there an equivalent command for a custom marker?

Any help would be appreciated


IH
At present, we have no way to directly specify a custom marker in a Tag command. But you can use the method used for legends.

To see this run the marker hook example and then execute
Tag/C/N=text1/X=7.38/Y=12.99 testw, 0, "m= \\s(testw#1)"


Depending on your circumstances, you might have to add some dummy traces just to get the symbols.

For those not familiar with custom markers, execute the following:
DisplayHelpTopic "Custom Marker Hook Functions"


I'll investigate the possibility of adding code to draw specific custom markers in textboxes.
Larry Hutchinson wrote:


Depending on your circumstances, you might have to add some dummy traces just to get the symbols.



Thanks for the reply Larry. I'll resort to this option and create a dummy trace with the x,y coordinates of the points that I want to tag.

IH
I have added the following feature for 6.3:


The escape code used in TextBox and Tag commands to display a specific marker, \Wtdd, can now also be \Wtddd and supports custom markers. Custom marker numbers start at 100 and can go up to 999. For more on custom markers, see Custom Marker Hook Functions.


This will be available in the next overnight build, Monday Aug 6 or later. You can get the nightly build here:
http://www.wavemetrics.net/Downloads/latest/
[quote=Larry Hutchinson]I have added the following feature for 6.3:
http://www.wavemetrics.net/Downloads/latest/[/quote]

It works great Larry. Many thanks!

For those interested, here's is the code I use to tag the figure with the latest build

Window Graph1() : Graph
    PauseUpdate; Silent 1       // building window...
    Display /W=(398.25,132.5,915,502.25) testw,testw,testw,testw
    ModifyGraph mode=3
    ModifyGraph marker(testw)=200,marker(testw#1)=201,marker(testw#2)=202,marker(testw#3)=203
    ModifyGraph offset(testw#1)={0,-0.2},offset(testw#2)={0,-0.4},offset(testw#3)={0,-0.6}
    Tag/C/N=text0/F=0/B=1/X=10/Y=-10 testw#3, 1, "\\Z12\\W5203" //The updated \Wtddd escape code
    SetWindow kwTopWin,markerHook={CirclesMarkerProc,200,203}
EndMacro


IH