| |||
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
On Jul 15, 2005, at 9:03 AM, Elliotte Harold wrote:
I love questions that are things I haven't tried before and yet don't take very long to code. The key is to set an ActionFilter on the MovieController. Here's a hack of the book's MovieController example, set to allow editing and with an ActionFilter that just catches the time-related callbacks (see the javadocs - they actually don't suck for this class). import java.awt.*; import quicktime.*; import quicktime.io.*; import quicktime.std.*; import quicktime.std.movies.*; import quicktime.app.view.*; import quicktime.std.clocks.*; public class TestActionFilter extends Frame { public TestActionFilter (Movie m) throws QTException { super ("Basic QT Controller"); MovieController mc = new MovieController(m); mc.enableEditing(true); // ew, API should be setEditingEnabled() mc.setActionFilter (new HiElliotte()); QTComponent qc = QTFactory.makeQTComponent (mc); Component c = qc.asComponent(); add (c); pack(); } public static void main (String[] args) { try { QTSession.open(); QTFile file = QTFile.standardGetFilePreview (QTFile.kStandardQTFileTypes); OpenMovieFile omFile = OpenMovieFile.asRead (file); Movie m = Movie.fromFile (omFile); Frame f = new TestActionFilter (m); f.pack(); f.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } public class HiElliotte extends ActionFilter { public boolean execute(MovieController mc, int action, TimeRecord tr) { if (action == StdQTConstants.mcActionSetSelectionBegin) { System.out.println ("mcActionSetSelectionBegin"); } else if (action == StdQTConstants.mcActionSetSelectionDuration) { System.out.println ("mcActionSetSelectionDuration"); } return super.execute (mc, action, tr); } } } [chrisg5:~/dev/experiments/actionfilter] cadamson% java TestActionFilter 2005-07-15 10:13:19.984 java[1950] [Java CocoaComponent compatibility mode]: Enabled mcActionSetSelectionBegin mcActionSetSelectionDuration mcActionSetSelectionBegin mcActionSetSelectionDuration ... Note that I got a flurry of these when I dragged across the scrubber to select, and even when I did a shift-click. When I cleared the selection by just clicking elsewhere in the movie, all I got was mcActionSetSelectionDuration. Maybe what you should do is to check the MC's selection when you get this callback and enable/disable appropriately. Looks like you'll get more callbacks than you want, but hopefully it won't be too expensive to handle. --Chris |
_______________________________________________ Do not post admin requests to the list. They will be ignored. QuickTime-java mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/quicktime-java/email@hidden This email sent to email@hidden
| References: | |
| >Selection Listener (From: Elliotte Harold <email@hidden>) |
| Home | Archives | FAQ | Terms/Conditions | Contact | RSS | Lists | About |
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE
Contact Apple | Terms of Use | Privacy Policy
Copyright © 2007 Apple Inc. All rights reserved.