Skip to main content
Known Participant
September 11, 2007
Question

CS2->CS3 Observer questions.

  • September 11, 2007
  • 11 replies
  • 962 views
Hello.

Im porting a plugin from CS2 to CS3 on MAC and have run into a problem with the observer structure.

In the CS2 plugin we simply used the default values available, IID_IUNKOWN & IID_IOBSERVER...

i IsAttached (IObserver *observer, const PMIID &interestedIn=IID_IUNKNOWN, const PMIID &asObserver=IID_IOBSERVER)=0

Called simply like this... mySubject->AttachObserver(this);

As of CS3 however this no longer possible for the "intrestedin" parameter to be left undeffined, instead the specific IID you want to monitor is required. If I understand things correctly.

i AttachObserver (IObserver *observer, const PMIID &interestedIn, const PMIID &asObserver=IID_IOBSERVER)=0

Where can I find information on what IID is connected to what action? My main interest is in guide movements and switching documents both of which my plugin have to react to.

What IID should be used to notify the plugin of movement of a guide?
What IID should be used to notify the plugin of switching of the current document?
Is there any documentation anywhere on what IIDs should be used to monitor what actions?

Grateful for any help.

Carl Johan Rydberg.
This topic has been closed for replies.

11 replies

Known Participant
September 19, 2007
Ah. (Embarassed silence)

Sorry Dirk I was to caught up in the DynamicUpdate to notice that it was a CommandState you were writing about.

Will try it immediately, thanks for all your help and patience.

Carl Johan Rydberg
Inspiring
September 19, 2007
I already told you in #6
Use cmd->GetCommandState()
tracking=>kDoneDynamic
finished=>kDone

Dirk
Known Participant
September 19, 2007
Thanks again Dirk it worked.

I still have a serious problem with the observer though.

I get 6 calls to the Update function. We used to filter on the IDynamicUpdate state so that the function only called userMovedGuides once but that does not work any more. IDynamicUpdate::DynamicState state = update->GetDynamicState(); only returns IDynamicUpdate::kNotStarted.

Is it no longer possible to access the IDynamicUpdate on the cmd or has IDynamicUpdate changed so that it no longer hold the relevant information?

If so how can I filter out the last signal?

Carl Johan Rydberg
Inspiring
September 18, 2007
You find it here:
file:///Adobe/ID5SDK/docs/references/sdkdocs/html/group__bosses__M.html

From the name of the command boss I'd assume it won't deal with anything but guides.

Therefor in your code, just add
if( ::GetClass(cmd)==kMoveGuideAbsoluteCmdBoss )

As I said, alternatively you could also check the UIDList of cmd for a guide, e.g using
db->GetClass(item[0])== kGuideItemBoss.

Note there is also a kMoveGuideRelativeCmdBoss but I don't know with what UI gesture to cause that - maybe "transform again" or scripting.

Dirk
Known Participant
September 18, 2007
Thanks Dirk, the observer finally observed.<br /><br />But how can I make sure it is a guide that is being moved? In the old code theChange was sent by kMoveGuideAbsoluteCmdBoss so it was available immediately. Also since it was the IID_IDYNAMICUPDATE that was the protocol used it was possible to check what state it was in before executing our function.<br /><br />if (theChange == kMoveGuideAbsoluteCmdBoss )<br /> ICommand* cmd = (ICommand*)changedBy;<br /> InterfacePtr<IDynamicUpdate> update(cmd, IID_IDYNAMICUPDATE);<br /> IDynamicUpdate::DynamicState state = update->GetDynamicState();<br /> if (state == IDynamicUpdate::kEndDynamic)<br /> {<br /> mystuff->UserMovedGuides(kTrue);<br /> }<br />}<br /><br />Where do I find the kMoveGuideAbsoluteCmdBoss you mentioned and how do I access it to check if it was a guide movement that was signaled?<br /><br />Carl Johan Rydberg
Inspiring
September 17, 2007
Apparently gone. Guide movements, you say?

Use kDocBoss
class: kLocationChangedMessage
protocol: IID_ITRANSFORM_DOCUMENT
You'll see a kMoveGuideAbsoluteCmdBoss whose UIDList is your kGuideItemBoss
Btw, watch the command state, kDoneDynamic means it is intermediate, still tracking.

Hth,
Dirk
Known Participant
September 17, 2007
I did check what protocol was used in the call to the Update. It was the IID_IDYNAMICUPDATE 0x100C - 4108. I used it to specify the PMIID in the CS2 observer functions and it worked ok.

However in CS3 it doesnt work. Have the notification been altered for IID_IDYNAMICUPDATE in the CS3 SDK?
Known Participant
September 13, 2007
Can you simply do a type casting PMIID(number)?
Inspiring
September 12, 2007
Some people use DebugClassUtils (recently mentioned), I prefer IObjectModel on gSession combined with some own code.
Known Participant
September 12, 2007
Thanks that helped alot.

I have some of the protocols now, but as numerical values.

Is there a list anywhere over what IID have what value?