• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How to obeserver a built in panel

Explorer ,
Jun 09, 2016 Jun 09, 2016

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)

TOPICS
SDK

Views

674

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Engaged , Jun 09, 2016 Jun 09, 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

...

Votes

Translate

Translate
Engaged ,
Jun 09, 2016 Jun 09, 2016

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jun 10, 2016 Jun 10, 2016

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 10, 2016 Jun 10, 2016

Copy link to clipboard

Copied

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,

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jun 10, 2016 Jun 10, 2016

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 13, 2016 Jun 13, 2016

Copy link to clipboard

Copied

thanks again lot

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(, 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?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 13, 2016 Jun 13, 2016

Copy link to clipboard

Copied

LATEST

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines