[CS3] Whats the best way to track model changes? Document Observer? Selection Observer?

Hello,<br /><br />Usecase I am working on needs to track following events:<br />1. A page item was created/deleted/resized/moved/etc..<br />2. A text was inserted/deleted<br />3. A page was created/deleted<br /><br />Since the list is quite broad I am wondering if there are known best practices to follow. <br /><br />I have tried attaching to Command manager via Document Observer:<br /><br />  InterfacePtr<IDocument> iDocument(this, UseDefaultIID());<br />  InterfacePtr<ISubject> iSubject(iDocument, UseDefaultIID());<br />  iSubject->AttachObserver(ISubject::kRegularAttachment,this, IID_ICOMMANDMGR, IID_IMYDOCOBSERVER);<br /><br />Then during "update" call:<br /><br />  if (protocol != IID_IHIERARCHY_DOCUMENT) break;<br /><br />  ICommand* iCommand = (ICommand*)changedBy;<br />  if (iCommand->GetCommandState() != ICommand::kDone) break;<br /><br />  const UIDList itemList = iCommand->GetItemListReference();<br />  if (itemList == nil || itemList.IsEmpty()) break;<br /><br />  ClassID commandClassID = ::GetClass(iCommand);<br />  if(commandClassID.Get() == kAddToHierarchyCmdBoss || kPlacePICmdBoss) {<br />      // do something at new item creation<br />  }<br /><br />Problem is "kAddToHierarchyCmdBoss" is not just the one command that is sent while creating a new item. There are dozen others and hence I am not sure if I am watching the right one.<br /><br />Second I tried implementing a selection observer and hope to use HandleSelectionAttibuteChanged. A quick search didnt resulted in any suite that lets me implement my use cases.<br /><br />I was inclined towards command observer because thats at low enough level (and right above database layer) allowing me to trap all model changes.<br /><br />I am not looking for a specific answer/code but more of a guideline how to approach the problem.<br /><br />Suggestions? Comments? Thanks in advance

There is no silver bullet, and while the command mgr can be useful to find out what's going on in general, it is definitely not the place for own dispatching. You'll have to revisit every command before and after execution, and plenty obscure sub-commands nested within larger sequences. If you handle them all this will seriously degrade performance. One good use of command manager notifications is to yield and inspect the matching commands for UI activities, from within your debug build.
In your quoted update(), when you check the protocol you're anyway already discarding the command mgr notifications, because the protocol then would be IID_ICOMMANDMGR. Probably you already have attached a bunch of other protocols?
Comparing to previous versions, the changes listed in 1) are pretty simple, you just subscribe at the document boss, and listen for the protocols IID_IHIERARCHY_DOCUMENT, IID_ITRANSFORM_DOCUMENT, eventually IID_IGEOMETRY_DOCUMENT, IID_IPATHGEOMETRY_DOCUMENT, IID_IINVALSHAPE. These also have an advantage that you get a meaningful theChange (rather than the command mgr's kBeforeDoMessageBoss and alike) and can dispatch on those.
If you have a previous version of InDesign, there used to be a wildcard protocol IID_IPMUNKNOWN that would yield any notifications on the subject so you could dump them out and search for details. Apparently for performance reasons this was removed with CS3 after some plugins used it for release code, IMO Adobe should just have limited the feature to the debug build.
Besides to observers, the service registry is full of other notifications, have a look the the cross reference in sdkdocs/html/classISignalMgr.html for the most prominent ones. One exception here, 2) For text edits, you won't even use observers or signals but kEditCmdPreProcessService / IID_ITEXTEDITPREPROCESS service instead, or its sister IID_ITEXTEDITPOSTPROCESS.
3) Probably you'll again observe the kDocBoss for IID_ISPREADLIST and IID_IMASTERSPREADLIST.
Regarding selection observers and suites, we're talking model changes here so please just forget about them in this place. Selection observers are used to follow the selection from within UI widgets, such as a palette or control strip.
Regards,
Dirk

Similar Messages

  • What is the best way to track a stolen ipod touch 4th generation if the locations services are off

    What is the best way to tracker a stolen ipod touch 4th generation it the locations services are off

    you will have to use the old fashioned way, like if you lost a wallet or purse.

  • I want to connect a Mac mini to a Samsung 40", Whats the best way to do this?

    I want to connect a Mac mini to a Samsung 40" LED tv to use as the monitor, whats the best way of doing this?

    Understand that there is one HDMI port on your TV that is specifically designated for PC connectivity. The order that the TV or Mini are powered on may determine your results. For your specific TV model, check buyer reviews on Amazon or elsewhere that can include optimum TV/Computer settings adjustment for improved viewing results.

  • What is the best way to work with Word documents in The InDesign CS4???

    I work in Microsoft Word 2007 and all my documents have *.doc format.
    What is the best way to work with Word documents in InDesign CS4???
    David Blatner says to avoid copying and pasting text from Word instead of placing it (Ctrl+D).
    How about pasting RTF or Text Document???
    I want to make book's layout in ID CS4 and its main feature is that there is the left page with text and the right - with graphics.
    So, as I understand to place the text on each page I must create for example 70 Word documents and place each item on 70 left pages???
    It loks like wasting time. I sthere another way of making such layout???  What kind????

    It's best to place any text.
    You can have all of your text in one file and use auto-flow to add threaded text frames and pages as required (Hold down the Shift key when you click the loaded text cursor), but it's a little non-standard to have the thread only on one side of the spread from the auto-flow perspective, so you'll have to set up properly.
    This is one case where a master text frame will work to your advantage. On your master page spread, add a text frame to the left page, but not to the right (or at least not threaded to one on the right -- for some other project you might actually want two independent text threads). Hold the loaded cursor over a frame on the left side of a document page and auto-flow. ID will add new spreads as necessary, but only put the text on the left side.
    Peter

  • HT3819 I have 2 Ipod touch's, one a 64gb and one an 8gb.  Whats the best way to use them both on the same itunes account?

    I have 2 Ipod touch's, one a 64gb and one an 8gb.  Whats the best way to use them both on the same itunes account?

    Click here for options.
    (64410)

  • Whats the best way to transfer everything from my old macbook pro to a new mac mini, i have a external hard drive which i backup to regularly via time capsule

    whats the best way to transfer everything from my old macbook pro to a new mac mini, i have a external hard drive which i backup to regularly via time capsule

    Check out > OS X Lion: How to use Migration Assistant to transfer files from another Mac

  • Wipe my hard drive clean except for the OS whats the best way?

    I need to wipe my hard drive clean except for the OS whats the best way?

    From Kappy (note: with this method, you will need to update to the present OS version using the appropriate Combo Update from Apple Downloads.)
    Boot from the OS X Installer Disc One that came with the computer. After the installer loads select your language and click on the Continue button. When the menu bar appears select Disk Utility from the Utilities (Installer menu if using Panther or Jaguar) menu. After DU loads select the startup volume from the left side list then click on the Erase tab. Set the format type to Mac OS Extended (Journaled) then click on the Options button. Select the one pass Zero Data option and click on the OK button. Then click on the Erase button.
    Note: You can skip the Zero Data option if you are not concerned about removing sensitive personal data from the hard drive. If you choose to skip this part of the process then it is possible for others to recover data from the hard drive. The Zero Data procedure will prevent others from getting access to your personal information.
    This process will take 30 minutes to several hours depending upon the size of the hard drive. After formatting has completed quit DU and return to the installer. Now complete the OS X installation. At the completion of the installation do not restart the computer. Instead just shut it off. The next user will be presented with the Setup Assistant when they turn on the computer just as it would if new out of the box.
    https://discussions.apple.com/message/12364050?messageID=12364050#12364050

  • When I'm done with my fcp sequence, whats the best way to get it to dvd?

    When I'm done with my fcp sequence, whats the best way to get it to dvd?

    The advice to go to Compressor left out the part that you may want to convert your audio to AC3 becaus ethe MPEG2 bitrate is probably too high for DVD specs.
    This method is in the DVDSP manual and it's in the Compressor manual, both difficult to locate, but easily searchable.
    Here's what I'd do: Export the timeline form FCP in the native sequence settings, self-contained. Bring that self-contained movie into DVDSP and let DVDSP handle the transcode.
    The advice to go to iDVD is even easier.
    bogiesan

  • Whats the best way to get dvd onto 5800

    Peoples,
    I'm strugglin to get DVD onto my noka 5800. It's not obvious in the user manual and looking around the web i need to 'convert' it to the fim on.
    Please does anybody have an easy, fool proof way of doing this??????
    Message Edited by blueleaches on 21-Aug-2009 06:02 PM

    If its possible there should be some walkthrough's on google. 
    http://www.lmgtfy.com/?q=whats+the+best+way+to+get+dvd+onto+5800 

  • Whats the best way to get a big text file in a CLOB variable?

    Hi,
    I have a very premitive type of question.
    I have a big text file, say 30 MB, in a Unix directory (Solaris). I want to get the whole text of that file in a CLOB variable.
    I saw the procedure dbms_lob.loadfromfile/loadclobfromfile. In both these cases, according to the documentation, the target where is collect the data will be a BLOB and not a CLOB. So, I have to convert that blob into a clob.
    If I want to avoid all this conversion process, whats the best way to get a text from a file into a CLOB variable?
    Please suggest.
    Regards

    In addition, LoadFromFile is overloaded to handle both BLOB and CLOB:
    PROCEDURE LOADFROMFILE
    Argument Name                  Type                    In/Out Default?
    DEST_LOB                       BLOB                    IN/OUT
    SRC_LOB                        BINARY FILE LOB         IN
    AMOUNT                         NUMBER(38)              IN
    DEST_OFFSET                    NUMBER(38)              IN     DEFAULT
    SRC_OFFSET                     NUMBER(38)              IN     DEFAULT
    <BR>
    PROCEDURE LOADFROMFILE
    Argument Name                  Type                    In/Out Default?
    DEST_LOB                       CLOB                    IN/OUT
    SRC_LOB                        BINARY FILE LOB         IN
    AMOUNT                         NUMBER(38)              IN
    DEST_OFFSET                    NUMBER(38)              IN     DEFAULT
    SRC_OFFSET                     NUMBER(38)              IN     DEFAULT

  • Im having trouble with my ipad mini in regards with the icloud back up notification; if i press "ok" it doesnt dis appear, i couldn open my ipad/turn off because of this notification; whats the best way to get rid of this? please help

    im having trouble with my ipad mini in regards with the icloud back up notification; if i press "ok" it doesnt dis appear, i couldn open my ipad/turn off because of this notification; whats the best way to get rid of this? please help

    Have you tried a soft-reset ? Press and hold both the sleep and home buttons for about 10 to 15 seconds (ignore the red slider if it appears), after which the Apple logo should appear - you won't lose any content, it's the iPad equivalent of a reboot.

  • Whats the best way to move files from a hard drive that wont boot?

    I made a bootable USB disk and it appears to work fine. I can still read and open files on the old disk (admin account only) from the new USB drive the old one doesn't boot. I don't have a backup but would like to move files to the USB and then reformat the old drive. 
    Whats the best way to capture the data?
    There are four user accounts on the old drive. Only one on the new drive so far. Do I need to set up four accounts on the new drive in order to copy data from each?

    Time Machine is for making backups and restoring ones it previously created. It doesn't restore data backed up or copied in other ways. In your case, it's better to use a cloning utility or manually drag the files than it is to use Time Machine.
    (124317)

  • Whats the best way to create USER variable in BI Apps?

    I have just installled BI Apps and am trying to integrate EBS R12 with OBIEE 11g
    We have USER variable already defined in the BI Apps rpd.
    In EBS Security context init block i need to define USER variable, but when i define it... it says *'USER' has already been defined in the variable "Authentication"."USER"*
    Whats the best way to create USER variable for EBS Security Context init block?
    1) Delete the existing USER variable and then define a new one ( in this case all the places where USER variable is getting used in the rpd would become <missing>)
    And i was told that it should not be done.
    Let me know how can it be done.
    Thanks
    Ashish

    Disable existing Init block and then double click on USER variable and hit on NEW... button to create new Init block
    Thanks
    Edited by: Srini VEERAVALLI on May 1, 2013 4:18 PM

  • Using final cut studio what the best way of getting a mini disc in to FCP?

    I do some weddings and record some audio on to a mini disc recorder ( the small ones . On my avid liquid edit suite I just used to run it in live or ingest it on a 2 hour timer, and just record audio.
    What the best way to do it with final cut studio and final cut pro?

    Is there a reason you can't do the same on your mac system? What outputs does the audio recorder have?
    Jerry

  • HT5503 Whats the best way to free up space on the iphone 3gs

    I can't update my iphone with the 6.0 because I don't have enough memory. Whats the best way to free up space? I have already deleted some pictures and music..

    Delete whatever files you don't need anymore and transfer data to an external hard drive. You can download and run OmniDiskSweeper. This application shows you all the files on your harddrive and what files are taking up the most space, just open the application and run it on your hardrive.

Maybe you are looking for

  • Dreamweaver on external drive

    I need advice on running DW installed on an external drive connected by usb to a desktop PC.  I have massive amounts of site data, image files etc. and need to travel. Is this practical or even possible?

  • Tween Class Unreliable?

    1 out of 4 function calls from a MouseEvent results in the MovieClip getting 'stuck' somewhere in the tween. As if it's not finishing. Has anyone else experienced this? Or am I using the Tween class wrong? addEventListener(MouseEvent.CLICK, tweenStyl

  • How can i retrieve old text messages

    How can i access my old deleted text messages without using backup? Are there any good and free apps that  can help??

  • Error Message When Using A.pack

    I have a sequence that I exported out of FCP4.5 using compressor. It is about a two hour long movie and won't fit onto a dvd unless I use A.pack. I launch A.pack and make the settings and drop my AIFF files onto the two speakers and export. It gets a

  • My speedlite 600 ex-rt will turn on but it won't fire. Any suggestions?

    My speedlite 600 ex-rt flash will turn on but it won't fire. The batteries work and were fully charged so that was not the problem. It also reads that it is ready to fire but no flash. It's about 1 year old, Is the flash worn out already or can it be