Copy link to clipboard
Copied
I want to observe the Media panel (Window->Interactive->Media) which is an inbuilt panel in indesign. how can do that? How can I get their inbuilt ids (ex: action ids, implementation id....etc)
Action ID is kMediaPanelActionID
Some of the bosses related to media:
kSetMediaAttrCmdBoss
kSetMediaContentCmdBoss
kNewMediaPageItemCmdBoss
kPlaceMediaButtonBoss
kChangeMediaLocationCmdBoss
You can find the IDs in
<SDK>/source/public/interfaces/MediaID.h
<SDK>/source/public/interfaces/interactive/ui/MediaUIID.h
Have a look into these header files for more details.
Details of interface-impl for some bosses:
kSetMediaAttrCmdBoss
IID_ICommand kSetMediaAttrCmdImpl
IID_ISETMEDIAATTRCMDDATA
...Copy link to clipboard
Copied
Action ID is kMediaPanelActionID
Some of the bosses related to media:
kSetMediaAttrCmdBoss
kSetMediaContentCmdBoss
kNewMediaPageItemCmdBoss
kPlaceMediaButtonBoss
kChangeMediaLocationCmdBoss
You can find the IDs in
<SDK>/source/public/interfaces/MediaID.h
<SDK>/source/public/interfaces/interactive/ui/MediaUIID.h
Have a look into these header files for more details.
Details of interface-impl for some bosses:
kSetMediaAttrCmdBoss
IID_ICommand kSetMediaAttrCmdImpl
IID_ISETMEDIAATTRCMDDATA kSetMediaAttrCmdDataImpl
kSetMediaContentCmdBoss
IID_ICOMMAND kSetMediaContentCmdImpl
IID_ISETMEDIACONTENTCMDDATA kSetMediaContentCmdDataImpl
kNewMediaPageItemCmdBoss
IID_ICOMMAND kNewMediaPageItemCmdImpl
IID_INEWMEDIAPAGEITEMCMDDATA kNewMediaPageItemCmdDataImpl
Copy link to clipboard
Copied
To add an observer to any existing panel you should have following approach:
1. Find the panel widget boss from the respective ID file.
In your case it is kMediaPanelWidgetBoss in MediaUIID.h
2. Add your observer on the boss in the boss definition (fr) as follows:
AddIn
{
kMediaPanelWidgetBoss,
kErasablePrimaryResourcePanelWidgetBoss,
{
IID_IMYOBSERVER, IMyObserverImpl,
}
}
3. Provide implementation for IMyObserverImpl by inheriting required partial impl.
For example, if I want to observe on the widgets.
Class MyObserver : public CWidgetObserver
Implement AutoAttach, AutoDetach, and Update methods.
void AutoAttach() {
InterfacePtr<IPanelControlData> panelData ( this, IID_IPANELCONTROLDATA );
AttachToWidget(kPlayLoopCheckBoxWidgetID, IID_ITRISTATECONTROLDATA, IID_IOBSERVER, panelData);
}
Update(const ClassID& theChange, ISubject* theSubject, const PMIID &protocol, void* changedBy) {
InterfacePtr<IControlView> controlView(theSubject, UseDefaultIID());
WidgetID widgetID = controlView->GetWidgetID();
switch( widgetID.Get() )
{
case kPlayLoopCheckBoxWidgetID:
{
// your code
}
}
}
Some of the widget IDs in the media panel are:
kPlaceMediaButtonWidgetID
kPlayLoopCheckBoxWidgetID
kPlaceVideoFromURLPanelWidgetID
kPosterDropDownListWidgetID
kControllerDropDownListWidgetID
kShowPreviewButtonWidgetID
Copy link to clipboard
Copied
Thanks vinothr​
for the detailed description. I did follow the process. But after doing that, MEDIAUI.RPLN plugin conflicts with my plugin.
only change I made from your example is,
IID_IOBSERVER , kMyMediaPanelObserverImpl,
Copy link to clipboard
Copied
The reason it conflicts is you are re-implementing IID_IOBSERVER for kMediaPanelWidgetBoss.
It already has an implementation kMediaPanelObserverImpl.
The object model cannot determine which implementation to use for the IObserver.
kMediaPanelWidgetBoss boss is defined in MEDIAUI.APLN.
You have to have your own observer as I showed in example.
You cannot override implementation for an interface that is already defined by the boss.
Copy link to clipboard
Copied
thanks again lot vinothr
CWidgetObserver is not observing the MediaPanel. AutoAttach never get called there.
in AddIn
IID_IMYMEDIAOBSERVER , kMyMediaPanelObserverImpl,
In Implementation
class MyMediaPanelObserver : public CWidgetObserver
{
public:
MyMediaPanelObserver(IPMUnknown* boss);
~MyMediaPanelObserver(void);
public:
virtual void AutoAttach(void);
virtual void AutoDetach(void);
virtual void Update(const ClassID& theChange,
ISubject* theSubject,
const PMIID &protocol,
void* changedBy);
};
CREATE_PMINTERFACE(MyMediaPanelObserver, kMyMediaPanelObserverImpl)
and I have implatemented auto attach, detach and update.
I have registered the implementation
REGISTER_PMINTERFACE(MyMediaPanelObserver, kMyMediaPanelObserverImpl)
can you please advice what I have done wrong please?
Is CWidgetObserver the correct observer? Isn't there any panelOberver like observer?
Copy link to clipboard
Copied
Since you are using the interface IID_MYOBSERVER, which is different from IID_OBSERVER. You will have to specifically call the AutoAttach and AutoDetach of your implementation. InDesign automatically calls these methods only for implementation that have the interface as IID_OBSERVER.
You could use an Idle task and check if the media panel is visible if it is then you can call your AutoAttach method.