Skip to main content
Inspiring
June 9, 2016
Answered

How to obeserver a built in panel

  • June 9, 2016
  • 2 replies
  • 941 views

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)

This topic has been closed for replies.
Correct answer vinothr

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

2 replies

vinothr
Inspiring
June 10, 2016

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

Participant
June 10, 2016

Thanks

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,

vinothr
Inspiring
June 10, 2016

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.

vinothr
vinothrCorrect answer
Inspiring
June 9, 2016

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