<?xml version='1.0' encoding='UTF-8'?>

<?xml-stylesheet href="./_c74_tut.xsl" type="text/xsl"?>

<chapter name="Max Basic Tutorial 20: Presentation Mode">

<setdocpatch name="20mPresentationMode" patch="20mPresentationMode.maxpat"/>
<previous name="basicchapter19">Timing</previous>
<next name="basicchapter21">Controlling Data Flow</next>
<parent name="00_maxindex">Max Tutorials</parent>

<indexinfo category="Basics" title="Presentation Mode">Creating a presentation interface for a patcher</indexinfo>

<h1>Tutorial 20: Presentation Mode</h1>

<h2>Introduction</h2>

<p>This tutorial is about the <i>Presentation Mode</i> feature of Max. Using Presentation Mode, you can create a UI specific to performance that is completely different from your programming model.</p>

<p>One of the difficulties of creating a good performance patch has always been “hiding” your programming so you would only be presented with useful performance controls.  This is especially true when it was desirable to have large controls and clear signal routing. As we will see, many issues regarding performance layout are solved by including objects in the Presentation Mode and arranging them separately from their role in the program.</p>

<p>To open the tutorial patch, click on the <b>Open Tutorial</b> button in the upper right-hand corner of the documentation window.</p>

<h2>Overview of the patch</h2>

<p>This is a patch similar to some of the drawing patches we’ve recently used; it scales your mouse movements to perform drawing in an <o>lcd</o> object.  In this case, the "paintbrush" is a box (a <m>framerect</m>, in <o>lcd</o> terms).  Rather than simply drawing boxes in the <o>lcd</o>, the size, shape and color of the boxes are constantly being changed based on the settings of the one horizontal <o>rslider</o> and two vertical <o>slider</o> objects at the top of the patch.  These boxes and the state of the <o>metro</o> object polling the mouse are all initialized when the patcher is opened with <o>loadbang</o> and <o>loadmess</o> objects (<o>loadmess</o> objects simply transmit an argument as a message, rather than a <m>bang</m>, when the patcher opens).  With the <o>metro</o> running, move your mouse around to see that the drawing is constantly shifting in response to your mouse movements.  If you squint your eyes, it might even seem Mondrian to you…</p>

<p>This patch, however, also shows one of the limitations of typical Max programming.  The logic for the patch covers most of the working space, and somewhat overwhelms the result that is drawn in the <o>lcd</o> workspace. One option to make this more useable would be to hide all of the logic with encapsulation and resize the user interface elements.  However, this may change the logical layout of the patch, and may make it more difficult to easily expand later.  What we need is a way to create a performance interface that doesn’t interfere with our patch’s logical layout.</p>

<h2>Using Presentation Mode</h2>

<p>Max solves this problem by providing a special user-interface view of the patch: <i>Presentation Mode</i>. We enter presentation mode by clicking on the small icon at the bottom of the patcher that looks like a whiteboard on an easel. When we do this, we will see the patcher logic disappear, and the user interface elements in the patcher move into a more convenient layout for performance. Clicking on the icon again returns you to "patching" mode (the normal way of looking at patchers), where we can edit the logic of the patch. Presentation Mode simplifies the process of making a user-focused view of the patch.</p>

<p>When we are in the normal (patching) mode of our patch, we can define the items that will appear in Presentation Mode.  Unlock the tutorial patch; you will see that the user interface elements have a pink halo.  This is the indicator that an object will be included in the Presentation Mode. Let’s add a few objects to the Presentation Mode.</p>

<p>Two objects that would be interesting in our performance patch are the two <o>number</o> boxes that display the current box sizing. These <o>number</o> boxes are just below the two <o>scale</o> objects in the middle of the patch.  Select one of the <o>number</o> boxes, then choose <b>Add to Presentation</b> from the <b>Object</b> menu.  If you switch to Presentation Mode, you will see this <o>number</o> box, but the size and location remains unchanged from where it is in the normal mode.  It would probably make sense to move this box under the <o>rslider</o> that controls its range.  You can click and drag the <o>number</o> box in Presentation Mode just like you can in "patching" mode – you can even resize it if you like.  Changes in size and location will not affect the layout in the normal patcher.  You can check this by switching back and forth between the two modes.</p>

<p>Return to the normal mode and select the other <o>number</o> box.  Again, select Add to Presentation Mode, then switch modes. You can move and resize this <o>number</o> box as well, probably moving it underneath the <o>rslider </o>as well. When you are in Presentation Mode, you can <i>lock</i> the patch (just like you can in patching mode) by clicking on the lock icon at the bottom of the patcher.  This way, you can move the controls without altering the screen layout.</p>

<p>When in Presentation Mode, you can add objects to your patcher that are then automatically added to Presentation Mode. Unlock the Presentation Mode view, then double-click to bring up the object palette.  Add a <o>comment</o> object, and edit it to create a “Current Size” label.  Move this to the area of the patch with the new <o>number</o> boxes are so that their use is more obvious. If you return to Patching mode, you will see that the object exists in this layer as well, in the position that it was originally created.  It also has the reddish halo, showing that it is included in the Presentation Layer.</p>

<h2>View changes</h2>

<p>What do you do if you want to work on both the "patching" and Presentation view at the same time?  Max has a little trick up its sleeve – it allows you to have <i>multiple views</i> of the same patcher open simultaneously.  With the patch window selected for focus, choose the <b>New View</b> option in the <b>View</b> menu; it will open a new window with all the same patch contents.  In fact, it is the same patcher, as you can see by the contents of the <o>lcd</o> object and the state of the various <o>number</o> boxes. If you change the patcher on one window, they are reflected in the other. You can have one of the windows in Presentation Mode (to tweak the performance layout) while working on the patcher's logic in the other.  The use of multiple views is also useful for working on large patches that might overwhelm your screen; instead, you can open two views and scroll to different regions of the patch; be assured that all of your changes are occurring on a single version of the patch.</p>

<h2>Summary</h2>

<p>Presentation Mode provides the means to create easy-to-operate performance interfaces without destroying the logical layout of your patch. Objects in Presentation Mode operate the same as outside of it, but can have different sizes, geometries and locations – whatever is necessary for making the best interface layout.  Additionally, the ability to have multiple views of a patch gives you options for more efficient programming and access to large patches even on small screens.</p>

<seealsolist/>

</chapter>
