Unit Name : QTControl Comment : QuickTime player control for QT4Delphi Copyright : (C)1998-2002 George Birbilis / Agrinio Club History : 18Sep1998 - first creation 19Sep1998 - now displays in control's window (SetGWorld call was missing) 21Sep1998 - changed filename property to StrFileName type (to use property editor) 22Sep1998 - changed MoviesTask to MCIdle - added code to disable the controller - added property to show/hide the controller - added property to activate/deactivate the controller - added component editor to active/deactivate the controller 23Sep1998 - added CM_DESIGNHITTEST message interception to avoid moving the control when panning/tilting - disabled the activate/deactivate from the component editor, now done at DESIGNHITTEST - added property for CursorSetting (if moviecontroller tracks mouse to change the cursor) - changed published boolean prop's to System.boolean (QT's Boolean= ByteBool(or WordBool???) which Object Inspector can't handle) 20Oct1998 - added {$R *.DCR} to link an icon for design-time 15Nov1998 - adding URL property 17Dec1998 - now the movie fits the control OK (added a call to MCSetControllerBoundsRect after the NewMovieController call) 19Jan1999 - changed Timer interval to 3000 from 1000 ms to avoid affecting the system's response to the user 6Feb1999 - moved movie&controller disposal code from destroy() to a separate method called CloseMovie - setFilename closes the disposes the previous movie&controller when loading a new one - CloseMovie set to nil theMC & theMovie (class members) after disposing their data - doMoviesTask checks for theMC<>nil before calling MCIdle(theMC) - setFilename now does close the current movie when a '' param is passed as a filename - CloseMovie does a repaint - setControllerVisible does a repaint when hiding the controller (when showing it, the controller pains itself at the next timer event) 20Feb1999 - changed {$R *.DCR} to {$R *.RES} to link component's icon into the compiled code - when having *.DCR files and removing a component from the package, when placing it back we get a {$R xxxComponent.DCR} in the package's source (.DPK) file... this results in a duplicate resource error message when linking the package, cause we import the resource for our unit and Delphi imports it again for the package (if we let the package to import it, the resource would be available only at the design package and not at runtime) 23Feb1999 - using "{$DEFINE USETIMER}" to control if we'll use a timer to task a movie. It's supposed not to be needed, since QT does movie tasking by itself when we pass it window events, but this seems to work only for simple QTVR, other movies need the tasker - made CloseMovie virtual, so that descendents get to know when a movie gets closed - added setMovie and showFileDialog methods - made methods safer by checking for theMC<>nil instead of qtInited=true (since we may have no movie loaded, so no movie controller) - now CloseMovie stops the timer first (moved that code from Destroy to CloseMovie, since Destroy calls CloseMovie first) ??Feb1999 - pubished the Align property of TWinControl 3Mar1999 - having the timer disabled all the time seems to work OK will all movies now - calling "setActionFilterWithRefCon" just before closing a movie controller - calling "MacSetPort" just after "CreatePortAssociation" when creating the window - calling SetMovieGWorld just after creating our movie - changed CM_DesignHitTest message's handler to pass the key event to Delphi only when our movie controller is not active - added getTheMovie & renamed setMovie to setTheMovie, to make TheMovie a public property (not published cause the Object Inspector can't show it) - setFilename now calls setTheMovie (removed duplicate code) - added a call to MCIdle(theMC) at the end of setTheMovie to paint the controller when it's created (needed for controllers of plain sound/music) 7Mar1999 - not using the QuickTime unit, now using qt_Events&qt_MacTypes 17Mar1999 - moved SetBounds to public from protected, cause TWinControl's (our ancestor's) setBounds is public 4Apr2000 - renamed "Filename" property to "FileName" (to be more consistent with Borland dialog controls' property naming) 25Jun2000 - now using JQTFilenameEditor unit from "JEDI Quicktime components" package 27Jun2000 - added "Registered" property - using conditional defines to comment out the "Interval" property and renamed it to "TaskInterval" 13Oct2001 - moved setting of nil GWorld to "CloseMovie" from "setFilename" - removed any not needed units from the "uses" clauses - made "getRegistered" function private (so that it can't be overriden by descendent classes) 29Oct2001 - exposed "AutoSize" property of WinControl ancestor - overriding "AdjustSize" method to set the control's size to the movie size when the movie changes 30Oct2001 - added "changeSize" protected method so that size can be changed in one step without having to change width and height separately 1Nov2001 - exposing "QT_initialized" boolean property and assigning it with true instead of calling the "initQT" method - at the window proc now trying to initialize quicktime if it's not initialized 1Dec2001 - added public read-only properties "QTMovie" (of Movie type) and "QTMovieController" (of MovieController type) - added published read-only properties "MovieHandle" and "MovieControllerHandle" (both of cardinal type), to use from the ActiveX controls to get the Movie and MovieController objects - now at the WndProc, first calling the inherited WndProc, then passing the message to QuickTime: much better repaint and no garbage left on the movie display anymore! - now calling RegisterClass too at the register procedure - moved {$R *.res} to implementation section of the unit - now filename='' (and theMovie=nil), you can click the movie at runtime to show a file dialog for opening a movie 3Dec2001 - now when ControllerVisible=true a gray bar isn't anymore shown at the bottom of the control 5Dec2001 - renamed method "setTheMovie" to "setMovie" - renamed method "getTheMovie" to "getMovie" - "QTMovie" property now has "setMovie" as its write method - "theMovie" field renamed to "FMovie" - "theMC" field renamed to "FMovieController" - now "setMovie" first calls "closeMovie" to dispose of the old movie and its movie controller - now "setFilename" method uses a local variable for setting the new movie - now "setMovie" exits if the value passed to it is nil (after it calls CloseMovie first and sets FMovie field to the new value) - "setMovie" method is now protected, assignment to QTMovie property is suggested to be used instead of calling "setMovie" - now exposing property "Anchors" of TControl ancestor 6Dec2001 - renamed "showFileDialog" method to "ShowFileDialog" - fields "FMovie" and "FMovieController" made private, "QTMovie" and "QTMovieController" properties is required to be used by ancestors instead - not calling MCIsPlayerEvent with a nil movie controller any more - at WndProc not passing the windows events to the movie controller if the window is iconic (so that when the window is hidden, no mouse changing etc. happens when moving the mouse over the area that the window had before it was hidden) - now passing on windows events to the quicktime controller only if we have a valid window handle and not the desktop's (0) 21Jan2002 - using "qt_QDOffscreen" unit instead of "qt_ODOffscreen" (renamed) - added "StartMovie", "StopMovie", "GoToBeginningOfMovie", "GoToEndOfMovie" and "ShowMoviePoster" public methods 9Feb2002 - added "DoMovieControllerAction" public method and using it instead of calling QT API's "MCDoAction" directly - added "Looping" and "LoopIsPalindrome" published properties 10Feb2002 - added new properties to allow usage of a movie's default values: "ControllerActiveUseDefault" (=true), "ControllerVisibleUseDefault" (=false), "CursorSettingUseDefault" (=false), "LoopingUseDefault" (=true), "LoopIsPalindromeUseDefault" (=true) 14Feb2002 - fixed bug with "getLooping" method, wasn't doing "mcActionGetLooping" but "mcActionSetLooping" instead, failing to get the Looping setting of the movie controller - when the control is right clicked in the Delphi designer and the movie controller is not active, selecting "Load file..." from the component's popup menu loads a movie and now does update the "filename" property to that movie's path (plus updates all other properties on the object inspector window) - added "SaveMovie" public method 23Feb2002 - moved "GetPortFromWindowReference" and "WinMessageToNativeEvent" to the JEDI QuickTime utilities package - now using "GetPortFromWindowReference" instead of "GetNativeWindowPort" (it provides extra checking for when passed a nil window handle as a parameter and returns nil in that case) - at "WndProc" now calling "inherited WndProc" after having first passed the windows messages to QTML, not before (this is the way suggested by Apple!) - at "WndProc" now always calling "NativeEventToMacEvent" always if the window has been related to a QT Graphics Port (checking that using "GetPortFromWindowReference"). Not calling it only if we have a movie controller as was doing before - removed "SetMovieGWorld" call from "setMovie" method 25Feb2002 - added "Editor" property to provide access to the "QTControlEditor" assigned by the Delphi IDE form designer to the control instance 13Apr2002 - removed {$R *.RES}, now using a .DCR file, linked into the delphi package, not into this unit - the editor property is now non-storable - now the "filename" property supports relative pathnames