Home

User Interface - Adobe Partners

image

Contents

1. Copyright 2004 Adobe System Incorporated All rights reserved 41 Sometimes the best way to learn is by imitation By using the debug build of InDesign CS and InCopy CS you can utilize the Panel Edit Mode First opena panel with the widget of interest You then enable Panel Edit Mode from the DevTools gt gt Panel Edit Mode menu in the debug build which will open the Widget Geometry panel Then click on the widget of interest and look at the Widget Geometry panel for detailed information about the widget such as Widget boss class You can look up the widget boss in HTML based reference docs to see what implementations are available what you can reuse and what will be inherited if you inherit a related widget type Widget ID Widget parent etc You can then go back to the DevTools menu for some more options such as saving the widget description to a file You can then copy and paste the saved widget resource into your own fr file You can find out more information about the typedef in fh files in the SDK The catch is you still have to do necessary C coding yourself just like with Freddy generated widget definitions Adobe InDesign CS InCopy CS Plug in Development Training 4 Session 8 User Interface ny Adobe Frequently Asked Questions contd Which database stores the UI states The Session database Root kSessionBoss Filepath Prefs InDesign SavedData
2. BasicPanelus ng Others in SDK f About this plug in st over Supposed hard and fast US decisio Simplest way to generate a mister may even have sanctioned in adv eoem m avna ra mvasion plug in with a panel Use DollyXs References O See User Interface technote DynamicPanellus pp67 70 Palettes pp70 75 Panel widgets DynarricPanelUS DynamicPanel US Copyright 2004 Adobe System Incorporated All rights reserved 28 The canonical example of a panel is the BasicPanel plug in You can create panels dynamically e g the Book and Library Asset panels are dynamically created as shown in the DynamicPanel plug in There are several other SDK samples that show various types of panels and widgets that you can put on them Look for the PalettePanelWidget resource in fr files The simplest way to generate a plug in with a panel is by generating one with DollyXs Please refer to the Porting Guide technote SDK docs guides portingguide pdf for details on how to use DollyXs However if you want to implement a panel from scratch the following slides provide the details For general information on panels please refer to the User Interface technote Adobe InDesign CS InCopy CS Plug in Development Training 28 Session 8 User Interface March 2004 Resource based UI components Panels contd Implementing a panel Define panel title string panel Wid
3. Implement Di al ogCreat or Noneedtoimplement Di al ogController Dialog widget resource should contain NativeTabsWidget with GenericPanelWidget Need IDList resource to list child dialogs Copyright 2004 Adobe System Incorporated All rights reserved 24 Presenter may skip this slide The steps to implement a tab selectable dialog parent which is the dialog that houses the child dialogs that are selectable by clicking a tab is similar to a regular dialog except The boss class should inherit from kTabSelectableDialogBoss eYou need to provide your own implementation of IDialogCreator by inheriting the partial implementation CDialogCreator so that the child dialogs can be created when they are selected The methods you need to implement are CreateDialog This is where you use IDialogMgr CreateNewDialog GetOrderedPanellDs Enables resource access and delegates to CDialogCreator GetOrderedPanellDs GetOrderedPanelsRsrclD called by CDialogCreator GetOrderedPanellDs to get the resource ID of the IDList resource see below You don t need to implement IDialogController since kTabSelectableDialogBoss already has one unless you want to provide customized Initialization Validation Apply behaviors Optionally you can implement IDialogObserver if you add widgets on the parent dialog The Dialog widget resource should contain NativeTabsWidget with GenericPanelWidget to
4. 20 Session 8 User Interface March 2004 Resource based UI components Dialogs contd Steps for implementing a dialog contd 4 Define your dialog resource based on the new type in locale specific fr files e This resource is a container for widgets Implement Di al ogController and Dial ogObserver and aggregate them in your dialog boss class e This boss class should inherit from kDialogBoss Code to open the dialog should go elsewhere Copyright 2004 Adobe System Incorporated All rights reserved 21 Presenter may skip this slide 4 Define your dialog resource based on the new DialogBoss type that you just defined You would do this in your locale specific fr file The DialogBoss resource is a container for other widgets not the DialogBoss resource itself so within this resource you would specify other child resources We will discuss these widgets in a later slide 5 Implement IDialogController using the partial implementation CDialogController and IDialogObserver using the partial implementation CDialogObserver and aggregate them in your dialog boss class when you declare it in the ClassDescriptionTable resource This boss class should inherit from kDialogBoss since your widget resource inherits from DialogBoss Here s what the boss class declaration would look like sample from BasicDialog Class kBscDlgDialogBoss kDialogBoss ID_IDIALOGCONTROLLER kBscDlg
5. 2004 Adobe System Incorporated All rights reserved 26 Presenter may skip this slide 5 Implement IPanelCreator using the partial implementation CPanelCreator and aggregate it in your child dialog boss class when you declare it in the ClassDescriptionTable resource This boss class should inherit from kPrimaryResourcePanelWidgetBoss since your widget resource inherits from PrimaryResourcePanelWidget Here s what the boss class declaration would look like sample from BasicSelectableDialog Class kYangPanelBoss kPrimaryResourcePanelWidgetBoss IID_IPANELCREATOR kYangPanelCreatorlmpl IID_IK2SERVICEPROVIDER kDialogPanelServicelmpl In your IPanelCreator implementation you only need to implement the GetPanelRsrcID method where you declare the resource ID for the IDList that specifies the service and panel ID for this child dialog 6 Define IDList and IDListPair resources to bind a selectable dialog service ID to the panel resource ID and plug in ID This is to help the selectable dialog service find the panel by it s resource ID That concludes the process of implementing a child dialog for a selectable and tab selectable dialog The code to open the child dialog is actually in the selectable dialog service which uses IDs specified in the parent dialog creator implementation As you recall we created an IDList resource when implementing the selectable dialog parent Adobe InDesign CS InCopy CS Plug
6. InCopy CS Plug in Development Training 39 Session 8 User Interface March 2004 ny Adobe Frequently Asked Questions contd How dol find out the type definitions for widgets Widgets SDK source public widgets includes Widgets fh Actions SDK source public includes ActionDef fh Menus SDK source public includes MenuDef fh Strings SDK source public includes StringTable fh Tools SDK source public includes Tool fh Panel list SDK source public widgets includes PanelList fh Look for other fh files under SDK source public Copyright 2004 Adobe System Incorporated All rights reserved 40 Whether or not use decide to use Freddy for UI design you will need to find out the various widget types This slide shows the SDK ODFRC header files that contain the type definitions Most widgets are typedef ed in Widgets fh Adobe InDesign CS InCopy CS Plug in Development Training 40 Session 8 User Interface March 2004 ny Adobe Frequently Asked Questions contd want to implement a widget just like one that exists in a panel in InDesign How can find out more about it DevTools gt gt Panel Edit Mode Debug build only Widget Geometry panel shows widget info After Panel Edit Mode is on DevTools gt gt Save Widget Description to save widget resource Copy paste into your fr file Look up widget typedef in fh files for more info
7. or Prefs InCopy SavedData Strings menu states dialogs panels widgets etc Refer to Session 4 Databases and Commands You can also save the UI states to an XML file Window gt gt Workspace gt gt Save Workspace File is saved in Prefs Workspaces folder Restricted to stash palette tab palette and dockbar Copyright 2004 Adobe System Incorporated All rights reserved You may remember this from Session 4 Databases and Commands The Session database root boss kSessionBoss filepath Product Saved Data where Product is either InDesign or InCopy is the database that stores UI states such as strings menu states dialog panels widgets etc Starting with InDesign CS InCopy CS there is a product feature where you can save some of the UI states to an XML file so you can restore the state later The procedures are as stated in the slide The Uls that are included in the XML file are restricted to panels housed in stash palettes tab palettes and the dock bar Developers may use this to setup a particular set of custom panel configurations for users Adobe InDesign CS InCopy CS Plug in Development Training March 2004 42 Session 8 User Interface March 2004 ny Adobe Frequently Asked Questions contd Can call platform specific APIs in my Ul code Insome cases it becomes necessary e g Event handlers ControlView Draw etc Can l use MFC in a p
8. Copy CS Plug in Development Training 37 Session 8 User Interface Other tidbits you ought to know Model View separation contd SDK samples with model view separation Model plug in TransparencyEffect selection suite model and responder code View plug in TransparencyEffectUl Only has action component and dialog Model plug in XDocBookWorkflow Import export providers commands and preferences View plug in XDocBookWorkflowUIl Only has action component and dialog Copyright 2004 Adobe System Incorporated All rights reserved 38 See the slide for SDK sample plug ins that are to be used in tandem These sets of plug ins are offer model view separation as described on the slide See the HTML based reference documentation for more details of these plug ins Adobe InDesign CS InCopy CS Plug in Development Training March 2004 38 Session 8 User Interface March 2004 Frequently Asked Questions Is there an easier way to place widgets on dialogs and panels InDesign 2 x SDK included Freddy Some widget definitions have changed since InDesign 2 x however you can still use Freddy Refer to InDesign 2 x SDK technote Freddy User Manual for usage details Specify Freddy s markup zone in fr file with lt FREDDYWI DGETDEFLI STUS gt lt FREDDYW DGETDEFLI STUS gt See WFP fr from WriteFishPrice sample plug in Copyrigh
9. DialogControllerlmpl IID_IOBSERVER kBscDlgDialogObserverlmpl In your IDialogController implementation you would add the code to initialize the dialog widgets validate the dialog widgets when the OK button is pressed and apply the data from the dialog widgets after the validation passes after OK is pressed In your IDialogObserver implementation you would add the code to attach the observer for child widgets in the AutoAttach method detach the observer in the AutoDetach method and the actual responses in the Update method NOTE We had a developer case where a developer wondered why he could use an accelerator key a button with an underlined character that is identified by an amp in the string for a button widget on Windows but not on Mac Using accelerator keys for button widgets is a Windows only feature and is generally discouraged for widgets That concludes the process of implementing a dialog The code to open this dialog should go elsewhere Adobe InDesign CS InCopy CS Plug in Development Training 21 Session 8 User Interface March 2004 Resource based UI components Dialogs contd SDK Samples of selectable dialogs Parent and children BasicSelectableDialog Preference dialog CustomPrefs XDocBookWorkflowUIl Yin US vanglus References See User Interface eee eee technote pp63 67 Copyright 2004 Adobe System Incorp
10. Session 8 User Interface March 2004 AN Adobe Adobe InDesign CS InCopy CS Plug in Development Training Session 8 User Interface Adobe Developer Technologies March 2004 Copyright 2004 Adobe System Incorporated All rights reserved 1 Welcome to the eighth installment of the InDesign CS InCopy CS Plug in Development training sessions Copyright 2004 Adobe Systems Incorporated All rights reserved The information in this document is furnished for informational use only is subject to change without notice and should not be construed as a commitment by Adobe Systems Incorporated Adobe Systems Incorporated assumes no responsibility or liability for any errors or inaccuracies that may appear in this document The software described in this document is furnished under license and may only be used or copied in accordance with the terms of such license Adobe Adobe InCopy and Adobe InDesign are trademarks of Adobe Systems Incorporated that may be registered in certain jurisdictions Macintosh and Apple are registered trademarks and Mac OS is a trademark of Apple Computer Inc Microsoft Windows Windows 95 Windows 98 Windows NT and Windows XP are registered trademarks of Microsoft Corporation All other products or name brands are trademarks of their respective holders Adobe InDesign CS InCopy CS Plug in Development Training 1 Session 8 User Interface March 2004 Training Roadm
11. advanced user interfaces Complex widgets tree view widget list box widget Drag and Drop Scripting support Copyright 2004 Adobe System Incorporated All rights reserved 47 This is the last of the beginner series of InDesign CS InCopy CS plug in development training sessions After you have established a firm foundation with these 8 session you are now equipped with sufficient fundamental knowledge to explore other domains in the InDesign InCopy application Namely Intermediate constructs Custom commands How to implement a custom command Selection ASB CSB and extensions How to implement an ASB CSB and Selection extension Persistence How to add persistent interfaces bosses reference conversion and dealing with data format changes from version to version Content specific domains Text how to access and manipulate the text model text attributes text layout etc Tables how to access and manipulate the table model table attributes table layout etc Graphics how to access and manipulate graphic attributes placing images PDFs color gradients swatches transparency color management etc Layout how to access and manipulate page items XML how to access and manipulate the logical structure of a document as opposed to document hierarchy mapping styles to tags managing tags etc InCopy story importing exporting working with InCopy features Advanced user interfac
12. ap Getting Started Foundation Object Model Databases and Commands Document Structure Messaging Selection 1 2 3 4 5 6 7 8 User Interface Copyright 2004 Adobe System Incorporated All rights reserved 2 Today s session is titled User Interface and is the last session in our series In this session we will give an overview of how to create a user interface for your plug ins We have covered quite a few fundamental topics that are necessary to understand when developing plug ins for InDesign and InCopy When you implement a user interface on a plug in you will need to know the basics of the object model and messaging and a little bit about selection which we have already covered Adobe InDesign CS InCopy CS Plug in Development Training 2 Session 8 User Interface March 2004 Outline of this presentation Review of MVC Use cases Types of User Interface components Non resource based UI components Resource based UI components Tidbits FAQ References Copyright 2004 Adobe System Incorporated All rights reserved Specifically in this session we will again review our MVC diagram and see where the user interface fits in Then we will present the use cases for user interfaces UI and describe the types of Ul components you can reuse and or implement Along the way we will discuss implementation roadmaps At the end we will review the ref
13. ch as Panel resource ID Plug in ID of the plug in that owns the panel ZOrder in the palette ActionID of the fly out menu Title string key of panel set Since there is a menu involved you ll need to implement a menu by following steps outlined earlier The menu path string key can be anything since the PanelList resource knows of the ActionID associated with the fly out menu Adobe InDesign CS InCopy CS Plug in Development Training 30 Session 8 User Interface Resource based UI components Panels contd Updating a UI when a selection changes Add an IID_IOBSERVER implementation that inherits from ActiveSelectionObserver into the panel boss References Selection technote Session 6 Messaging SDK samples BasicPersistInterface CandleChart PersistentList SnippetRunner StrokeWeightMutator TableAttributes Copyright 2004 Adobe System Incorporated All rights reserved 31 You can update a UI widget when a selection changes This is done by aggregating an observer implementation based on ActiveSelectionObserver in the panel boss You can refer to the references on the slide for more details Adobe InDesign CS InCopy CS Plug in Development Training March 2004 31 Session 8 User Interface March 2004 Resource based UI components Others Tools Interactive tools in the toolbox See SDK samples Snapshot and WaveTool Kits InCopy CS o
14. ch describe the visual specification of a panel 3 Define anew ODFRC view resource type that inherits from the PrimaryResourcePanelWidget widget resource You would specify this once in your plug in s main fr file This is also where you also specify the actual boss class that provides the implementation behind the panel widget resource This statement looks something like this sample from BasicSelectableDialog type YangPanelWidget kViewRsrcType PrimaryResourcePanelWidget ClassID kYangPanelBoss kYangPanelBoss is the boss class that provides the implementations for the YangPanelWidget resource 4 Define your child dialog resource based on the new panel resource type that you just defined You would do this in your locale specific fr file The panel resource is a container for other widgets so within this resource you would specify other child resources We will discuss these widgets in a later slide Continued on next slide Adobe InDesign CS InCopy CS Plug in Development Training 25 Session 8 User Interface March 2004 Resource based UI components Dialogs contd Implementing a tab selectable dialog child contd 5 Implement Panel Creator and aggregate ina boss that inherits from kPrimaryResourcePanelWidgetBoss Define IDList and IDListPair resources Binds toa selectable dialog service ID Child dialog IDs are specified in the parent dialog creator implementation Copyright
15. display tabs and to house the child dialog And you need an IDList resource that lists the boss classes for the child dialogs The resource ID can be defined as a define statement in your ID h file It is to be specified from your implementation of IDialogCreator Adobe InDesign CS InCopy CS Plug in Development Training 24 Session 8 User Interface March 2004 Resource based UI components Dialogs contd Implementing a tab selectable dialog child 1 Define panel title string amp panel Widget ID 2 Define Localelndex resource in main fr file Specifies which child dialog resource to use for each locale 3 Define anew ODFRC view resource type that inherits from PrimaryResourcePanelWidget widget resource in main fr Also specify your child dialog boss ClassID Define your child dialog resource based on the new type in locale specific fr Copyright 2004 Adobe System Incorporated All rights reserved 25 Presenter may skip this slide The steps to implement a selectable or tab selectable dialog child is as follows 1 Define a panel title string and declare a panel widget ID The string is created in the same way as defining a localizable string since panels are generally specified in a locale specific way The WidgetID is declared in the kWidgetIDSpace using DECLARE_PMID 2 Define a Localelndex resource This resource is a mapping between locales and different panel resources whi
16. e technote SDK docs guides portingguide pdf for details on how to use DollyXs However if you want to implement a dialog from scratch the following slides include detailed steps of how to do just that For further information on dialogs in general refer to the User Interface technote Adobe InDesign CS InCopy CS Plug in Development Training 19 Session 8 User Interface March 2004 Resource based UI components Dialogs contd Steps for implementing a dialog 1 Define dialog title string amp declare dialog Widget ID See Localizable Strings DECLARE PMI D kWidgetl DSpace 2 Define Localelndex resource in main fr file Specifies which DialogBoss resource to use for each locale 3 Define anew ODFRC view resource type that inherits from DialogBoss widget resource in main fr file Also specify your dialog boss ClassID Copyright 2004 Adobe System Incorporated All rights reserved 20 Presenter may skip this slide Here are the steps in implementing a dialog modal or non modal 1 Define a dialog title string and declare a dialog WidgetID The string is created in the same way as defining a localizable string since dialogs are generally specified in a locale specific way The WidgetID is declared in the kWidgetIDSpace using DECLARE_PMID 2 Define a Localelndex resource in your plug in s main fr file This resource is a mapping between locales and di
17. enUS US English k_jaJP Japanese etc and represent the user interface language Localized strings are represented by the PMString class PMString utilizes the application s string table to obtain a locale specific string based on a string key Conversely stated if you want to get some string in a specific locale you create an instance of PMString by specifying a string key in the constructor then call the PMString Translate method You can then obtain a CString representation of the string by calling PMString GrabCString or a Unicode UTF 16 representation of the string by calling PMString GrabUTF 1 6Buffer Any string that is displayed on a user interface component is a PMString Even strings on alerts and progress bars use PMString Implementation steps are as follows 1 Specify a string key in your plug in project s ID h file The string key is used in to identify a unique string in the application s string table hash table The hash function is influenced by the first and last letters of the string key String key collisions are rare however we have seen a few cases in SDK samples in previous versions since most SDK sample string keys start with the 0 zero first number in a hex representation of the plug in prefix ID and end in y last letter in Key 2 Define a Localelndex in your plug in s main fr file This Localelndex resource tells the application which string table to refer to f
18. er these can be referenced by resource IDs from UI resources in fr files Most UI components with the exception of localizable strings require you to write C implementations according to the user interface framework including observers event handlers etc These implementations would be placed in boss classes that correspond to the resource definitions of the UI component The UI components that fall into this category are Localized strings Menus or Actions Dialogs Panels Tools The next few slides will explain them in more detail Adobe InDesign CS InCopy CS Plug in Development Training 12 Session 8 User Interface March 2004 Resource based UI components Localized strings Display different string based on locale List of locales SDK source public includes PMLocalelds h MLocalelds h WLocalelds h UsePMString class Specify string key then callPMString Transl ate Steps for implementing localized strings Specify a string key in ID h file Define Localelndex resource in main fr file Specifies which StringTable resource to use for each locale Can also point to a no translate StringTable Define StringTable resources in locale specific fr files Copyright 2004 Adobe System Incorporated All rights reserved 13 Localized strings are used to display strings on the user interface based on a locale Locales are identified by codes such as k_
19. erences for further exploration of the user interface subsystem Adobe InDesign CS InCopy CS Plug in Development Training Session 8 User Interface Review Model View Controller Recall from Session 2 Foundations Model View Controller Paradigm View observes changes on Model User action in View delegates to Controller Controller modifies Model Model notifies Controller Controller updates View Copyright 2004 Adobe System Incorporated All rights reserved Let s recall a slide from Session 2 Foundations where we described the interaction between Model View and Controller Adobe InDesign CS InCopy CS Plug in Development Training March 2004 Session 8 User Interface March 2004 Recap Let s talk about MVC 3 Notifies 2 User action 2 Modifies 4 Updates View Layout window Panels and widgets 1 Observes Copyright 2004 Adobe System Incorporated All rights reserved This slide is taken from Session 2 Foundation Refer to Session 2 for details on this slide The red lines indicate the responsibilities of the view components namely 1 Observes The view components attach observers so they could be notified of changes whether they be from the model or other widgets As a result of this the view components are updated when a change of interest occurs 2 User action The actions of the users such as mouse clicks a
20. es You want to provide an easy way for a user to perform a task using A menu A dialog A panel A tool You want to provide locale specific views InDesign CS available in 13 locales not including CE ME versions Ideally your plug ins would be too Copyright 2004 Adobe System Incorporated All rights reserved 7 The primary reason that we want to create a user interface is to provide an easy way for a user to perform a task Discussing Ease of use could lead to an entirely different discussion however what we are interested in as a plug in developer is to use the same UI factorizations that are available in other parts of the applications namely Menus Dialogs Panels stash palettes and tabbed palettes are windows that contain panels The dock bar the tool box and kits are types of a panels eTools A secondary reason is to provide these user interfaces in locale specific presentations Adobe provides the InDesign CS application in 13 locales not including the Central European and Middle Eastern versions By providing support for these locales in your plug ins user interfaces not only will you be eliminating language barriers for users around the world you can provide locale specific widget settings to allow for different string lengths An application setting similar to the locale is the feature set which allows you to provide different user experiences be
21. es Complex widgets such as widget list box widget tree view widget etc Drag and Drop support Adding scripting support for your plug ins All of these topics are advanced topics that we didn t cover in these series however you can use the references listed on the next slide to explore more on these topics Adobe InDesign CS InCopy CS Plug in Development Training 47 Session 8 User Interface March 2004 References for further exploration Use what you have been using all along SDK samples SDK source sdksamples SDK Documentation SDK docs HTML based reference documentation references Tech notes guides pdf Programming Guide InDesign CS version coming soon Knowledge Base on http partners adobe com User to user forums English Japanese Mailing list Developer support Copyright 2004 Adobe System Incorporated All rights reserved 48 Just a reminder there are plenty of other resources in the SDK and outside that you can refer to for further exploration of the world of InDesign CS InCopy CS plug in development Adobe InDesign CS InCopy CS Plug in Development Training 48 Session 8 User Interface March 2004 A Adobe Tools for the New Work Copyright 2004 Adobe System Incorporated All rights reserved 49 All of us at Adobe wish you success with your plug in development Thank you very much for attending the beginne
22. fferent DialogBoss resources which describe the visual specification of a dialog NOTE The name DialogBoss doesn t refer to a boss class but the widget name This name is kept for historical reasons Using this Localelndex resource you can have slightly different visual specifications of dialogs per locale For instance German strings tend to be 50 longer than English strings on average so text widgets may require extra space on a dialog In this case you might decide to have a different visual specification on the DialogBoss resource in the k_deDE locale NOTE If you look at the Localelndex kSDKDefDialogResourcelD resource in SDK sample plug ins with dialogs you will notice that they do not use locale specific DialogBoss resources Instead they use the same DialogBoss resource within the plug in 3 Define anew ODFRC view resource type that inherits from the DialogBoss widget resource You would specify this once in your plug in s main fr file This is also where you also specify the actual boss class that provides the implementation behind the DialogBoss widget resource This statement looks sometihng like this sample from BasicDialog type BscDlgDialogBoss kViewRsrcType DialogBoss ClassID kBscDlgDialogBoss kBscDlgDialogBoss is the boss class that provides the implementations for the BscDlgDialogBoss dialog widget resource continued on next slide Adobe InDesign CS InCopy CS Plug in Development Training
23. getID and panel fly out menu ActionID 2 Define Localelndex resource in main fr file Specifies which panel resource to use for each locale 3 Define anew ODFRC view resource type that inherits from PalettePanelWidget widget resource in main fr Add CPanelMenuData resource for fly out menu data Also specify your panel boss ClassID 4 Define your panel resource based on the new type in locale specific fr Copyright 2004 Adobe System Incorporated All rights reserved 29 Presenter may skip this slide The steps to implement a panel is as follows 1 Define a panel title string and declare a panel widget ID The string is created in the same way as defining a localizable string since panels are generally specified in a locale specific way The WidgetID is declared in the kWidgetIDSpace using DECLARE_PMID Define a Localelndex resource This resource is a mapping between locales and different panel resources which describe the visual specification of a panel Define a new ODFRC view resource type that inherits from the PalettePanelWidget widget resource You would specify this once in your plug in s main fr file This is also where you also specify the actual boss class that provides the implementation behind the panel widget resource This statement looks something like this sample from BasicPanel type BscPnIPanelWidget kViewRsrcType PalettePanelWidget ClassID kBscPnIPanelWidgetBoss CPane
24. ghts reserved 45 There are many references you can rely on to learn more about user interface implementation Adobe InDesign CS InCopy CS Plug in Development Training 45 Session 8 User Interface Summary Review of MVC Use cases Types of User Interface components Non resource based UI components Resource based UI components Tidbits FAQ References Copyright 2004 Adobe System Incorporated All rights reserved In this session we reviewed the MVC paradigm and discussed where the UI fit into the picture the view but also part controller We then discussed scenarios use cases in which UI implementation is useful We then discussed the different types of UI elements you can use and implement Some don t require you to define ODFRC resources some do Many design and implementation tips were shared through tidbits you ought to know and FAQs Then we looked at references for further exploration This is a good time for Q amp A time permitting Adobe InDesign CS InCopy CS Plug in Development Training March 2004 46 Session 8 User Interface March 2004 We re done with the beginner seminars Now what You are now equipped with enough tools to dig deeper into the world of InDesign InCopy Intermediate constructs Custom commands Selection ASB CSB Persistence Content specific domains Text tables graphics layout XML InCopy story etc More
25. her from a menu or shortcut key Shortcut Manager AddShortcut You must know which Acti onl D to associate with the shortcut key Shortcut Manager is on kActionManagerBoss Hint Application QueryActi onManager returns Act i onManager which is on the same boss Also usefulis Shortcut Utils ParseShortcutString GetVi rtual Key andmods values Copyright 2004 Adobe System Incorporated All rights reserved 44 Shortcut keys can be added from the Edit gt gt Keyboard shortcuts menu but how do you add them programmatically IShortcutManager has a method to do just that See slide for hints on how to query IShortcutManager Do you remember how to query for lApplication IShortcutUtils kUtilsBoss also has some useful methods Now you can choose an Action Area for the shortcut on the Keyboard Shortcuts dialog This is the action area that you define in the ActionDef resource and it groups actions by name Adobe InDesign CS InCopy CS Plug in Development Training 44 Session 8 User Interface March 2004 References Wide array of Ul sample plug ins in the SDK See previous slides Search fr files in SDK samples for widget resource definitions Use DollyXs to generate dialog and panel plug in code User Interface technote is an excellent reference SDK docs guides userinterface pdf Copyright 2004 Adobe System Incorporated All ri
26. in Development Training 26 Session 8 User Interface March 2004 Resource based UI components Panels Provides quick access to features Unlike menus and dialogs panels stay open Widgets can even respond to active selection Contained in a Palette window Floating palette can be tabbed or tabless Stash palettes get stashed to the sides Copyright 2004 Adobe System Incorporated All rights reserved A panel is another type of widget that can be a parent to other widgets Panels provide quick access to features in a plug in as they stay open as opposed to menus and dialogs and you can set up an ActiveSelectionObserver so that the widgets on a panel respond to the active selection changes either the selection itself or some attribute associated with the selection Panels are contained in a palette window Floating palettes can be either tabbed or tabless although tabbed palettes are more common Non floating palettes or stash palettes are palettes that get stashed to the side of the application window Adobe InDesign CS InCopy CS Plug in Development Training 27 Session 8 User Interface March 2004 Resource based UI components Panels contd SDK Samples of panels Ra Masterjumps tory Canonical BasicPanel Se a men privately admitting to growing exaape Desiran SG Goes nowhere US 5 Advanced DynamicPanel Does nothing UsS
27. lMenuData Define your panel resource based on the new panel resource type that you just defined You would do this in your locale specific fr file The panel resource is a container for other widgets so within this resource you would specify other child resources We will discuss these widgets in a later slide Continued on next slide Adobe InDesign CS InCopy CS Plug in Development Training 29 Session 8 User Interface March 2004 Resource based UI components Panels contd Implementing a panel contd 5 Declare panel boss that inherits from kPalettePanelWidgetBoss Aggregate implementation of IID_IPANELMENUDATA kCPanelMenuDatalmpl 6 Define a PanelList resource Specify the PalettelD of the palette that will contain the panel Specify other panel parameters Must implement action component and define ActionDef MenuDef for fly out menu Copyright 2004 Adobe System Incorporated All rights reserved Presenter may skip this slide 5 Declare a panel boss that inherits from kPalettePanelWidgetBoss At the least you need to aggregate an implementation of IPanelMenuData but you don t need to write any code for this you can just use IID_IPANELMENUDATA kCPanelMenuDatalmpl If you add widgets to your panel you might need to add an observer in this boss 6 Define a PanelList resource that registers a panel as part of a specific palette and specifies other panel parameters su
28. lug in UI Not directly Hint Abstract out MFC resources code in a separate DLL export a function and call it from your plug in Not recommended Interaction between UI and other application subsystems becomes a challenge e g Can t directly use observers Copyright 2004 Adobe System Incorporated All rights reserved 43 Here are some questions related to platform specific implementations Sometimes it becomes necessary to call platform specific APIs whenever you have to interface with the operating system directly to handle an event or draw on a widget The InDesign InCopy C API does have a cross platform drawing API called IGraphicsPort which has methods similar to PostScript however there are cases where this isn t sufficient In those cases you will need to call platform specific APIs When you have to do that you can either use ifdef MACINTOSH or ifdef WINDOWS macros to tell the C preprocessor to compile only code that is relevant to the platform or you can abstract out entire class implementations For instance you might have a MMyControlView cpp Macintosh and a WMyControlView cpp Windows and both implementations the same Implementation ID in the CREATE_PMINTERFACE macro However by compiling the MMyControlView cpp only in your CodeWarrior project and the WMyControlView cpp only in your Visual C project you can provide platform specific implementations of a control view without clutte
29. meters such as the ActionID and the action component boss MenuDef specifies menu parameters such as the menu path menu location index etc Menu strings such as menu names See details on localized strings The C implementation you must write is a class that derives from ActionComponent or the partial implementation CActionComponent This implementation must be aggregated in a boss with an implementation of IPMPersist you can reuse kPMPersistImpl The IPMPersist interface is necessary since action parameters along with other UI states are persisted in the session database We ll bring this up in the FAQ section towards the end of this presentation Adobe InDesign CS InCopy CS Plug in Development Training 15 Session 8 User Interface March 2004 ny Resource based