Skip to main content
Known Participant
November 12, 2008
Question

Adornment Not Showing

  • November 12, 2008
  • 3 replies
  • 843 views
Hi,

I have a plugin that adds a text adornment via a wax run. However, the adornment does not show/draws immediately in the UI, the adornment appears only after a change in the current view, a change in zoom settings. I tried running a recompose using IFrameListComposer using the RecomposeThruNthFrame method, right after waxRun->addAdornment(), but still the UI does not automatically update the view.

How can I resolve this? Thanks in advance!

-- Jeff
This topic has been closed for replies.

3 replies

Inspiring
July 20, 2011

I am using

IID_IATTRREPORT

and

Utils<ILayoutUIUtils>()->InvalidateViews(document);

rafx79
Known Participant
July 19, 2011

I've been having the same issue, and have tried the following:

1) Recomposition on all frames of the stories in the document:

IDocument* frontDoc = Utils<ILayoutUIUtils>()->GetFrontDocument ();

if (frontDoc)

{

     //recompose all frames of all stories in the frame

     InterfacePtr<IStoryList> storyList (frontDoc, IID_ISTORYLIST); //iDoc

     int32 storiesCount=storyList->GetUserAccessibleStoryCount ();


     for(int x=0; x <storiesCount;x++)

     {

     //textmodel ID

     UIDRef storyRef=storyList->GetNthUserAccessibleStoryUID(x);

     InterfacePtr<ITextModel> iTextModel (storyRef, IID_ITEXTMODEL);

        //frameList

          InterfacePtr<IFrameList> iFrameList ( iTextModel->QueryFrameList () );

     if (!iFrameList) continue;

     InterfacePtr<IFrameListComposer> iFrameListComposer (iFrameList, IID_IFRAMELISTCOMPOSER);

     if(!iFrameListComposer) continue;

         //recompose all frames                         

     iFrameListComposer -> RecomposeThruNthFrame(-1);

     }

}

         This is the one suggested in forums and in the training sessions slides, though I haven't been able to make it work for showing the text adornment.

     2) Force global recomposition,

IDocument* frontDoc = Utils<ILayoutUIUtils>()->GetFrontDocument ();

if (frontDoc)

{

     Utils<ILayoutUIUtils>()->InvalidateViews (frontDoc);

     InterfacePtr<IGlobalRecompose> globalRecompose(frontDoc, UseDefaultIID());

     if (globalRecompose != nil) {

          globalRecompose->RecomposeAllStories();

          //globalRecompose->ForceRecompositionToComplete();

     }

     InterfacePtr<ICommand> RecomposeCmd (CmdUtils::CreateCommand (kRecomposeWrapCmdBoss) );

     if (!RecomposeCmd) break;

     InterfacePtr<IUIDData> RecomposeCmdData (RecomposeCmd, IID_IUIDDATA);

     if (!RecomposeCmdData) break;

   

     RecomposeCmdData->Set(GetUIDRef(frontDoc));

     error = CmdUtils::ExecuteCommand (RecomposeCmd);

}

         This works in CS2 but not CS3, and sometimes and with older documents it makes indesign crash

Anyone know of the right way to show/hide text attributes like the one Jeff asks? Just a simple shading behind the texto to denote changes in it's properties?

Jeff SeseAuthor
Known Participant
November 13, 2008
More details on the problem:

The plugin aims to put a text adornment (background shade) on a text range that has a certain group of settings. Currently the plugin can do a search of this text range but I'm not able to add the shade, so I implemented an ITextAdornment to handle the shading. To generate the shade when the text range is found, I get the wax run of the said text range and then add the adornment on the wax run via the AddAdornment method of the wax run. However, this does not draw the adornment immediately.

In reading the programming guide, it tells that there are two kinds of adornment, local and global adornment. Local adornment is applied via a TextAttribute while global adornments is applied by triggering a setting. And the drawing of the adornment is triggered automatically in a series of events as described in the programming guide.

Therefore, kindly correct me if I'm wrong, I cannot activate the drawing process of the adornment by just calling the AddAdornment method, its either I do this by activating a TextAttribute if its a local adornment or selecting a setting to show this adornment if it is a global adornment.

Kindly correct me if my assumptions are correct.

Thanks!

-- Jeff