Page 1 of 1
Peliculas desde fivemac
Posted: Wed Jul 21, 2010 4:33 pm
by mastintin
pues una primera aproximacion al control QTview :
posible sintaxis :
@ 2,2 MOVIE oMv VAR cMovie SIZE 1600 ,900 OF oWnd
Re: Peliculas desde fivemac
Posted: Wed Jul 21, 2010 5:30 pm
by Antonio Linares
Manuel,
Formidable!
Re: Peliculas desde fivemac
Posted: Wed Jul 21, 2010 7:44 pm
by mastintin
Ya tengo lo mas básico :
Se tiene que enlazar el framework QTkit
el archivo qtview.m:
Code: Select all
#import <Cocoa/Cocoa.h>
#import "QTKit/QTKit.h"
#define HB_DONT_DEFINE_BOOL
#include <hbapi.h>
NSView * GetView( NSWindow * window );
HB_FUNC( QTVCREATE )
{
QTMovieView * vista = [ [ QTMovieView alloc ] initWithFrame : NSMakeRect( hb_parnl( 2 ), hb_parnl( 1 ),
hb_parnl( 3 ), hb_parnl( 4 ) ) ];
NSWindow * window = ( NSWindow * ) hb_parnl( 5 );
[ GetView( window ) addSubview : vista ];
[vista setPreservesAspectRatio :YES];
[ vista setBackButtonVisible :YES ];
//[ vista setAutoresizesSubviews : YES];
hb_retnl( ( LONG ) vista );
}
HB_FUNC( QTVOPEN )
{
QTMovieView * vista = ( QTMovieView *) hb_parnl( 1 );
NSString * string = [ [ [ NSString alloc ] initWithCString: ISCHAR( 2 ) ? hb_parc( 2 ) : "" ] autorelease ];
[ vista setFillColor: [NSColor clearColor]];
[ vista setMovie : [QTMovie movieWithFile:string error:NULL] ];
}
HB_FUNC( QTVOPENPANEL )
{
QTMovieView * vista = ( QTMovieView *) hb_parnl( 1 );
NSOpenPanel *openPanel = [NSOpenPanel openPanel];
[openPanel setCanChooseDirectories:NO];
if ([openPanel runModal] == NSOKButton) {
[ vista setFillColor: [NSColor clearColor]];
[ vista setMovie : [QTMovie movieWithFile:[openPanel filename] error:NULL] ];
}
else
NSRunAlertPanel( @"Stop",@"Formato de pelicula no valido", @"OK", NULL, NULL );
}
HB_FUNC( QTVSETCONTROLVISIBLE )
{
QTMovieView * vista = ( QTMovieView *) hb_parnl( 1 );
[ vista setControllerVisible: hb_parl( 2 ) ];
}
HB_FUNC( QTVGETCONTROLVISIBLE )
{
QTMovieView * vista = ( QTMovieView *) hb_parnl( 1 );
hb_retl( ( BOOL ) [ vista isControllerVisible ]);
}
la clase Tmovie
Code: Select all
#include "FiveMac.ch"
//----------------------------------------------------------------------------//
CLASS TMovie FROM TControl
METHOD New( nTop, nLeft, nWidth, nHeight, oWnd, cPrompt, nStyle )
METHOD Open(cMovie) INLINE QTVopen( ::hWnd,cMovie )
METHOD DlgOpen () INLINE QTVopenPanel(::hWnd)
METHOD SetcontrolVisible(lvisible) INLINE QTVSetControlVisible(::hWnd,lvisible)
METHOD GetcontrolVisible() INLINE QTVGetControlVisible(::hWnd)
ENDCLASS
//----------------------------------------------------------------------------//
METHOD New( nTop, nLeft, nWidth, nHeight, oWnd, cMovie ) CLASS TMovie
DEFAULT nWidth := 100, nHeight := 200, oWnd := GetWndDefault()
::hWnd = QTVCreate( nTop, nLeft, nWidth, nHeight, oWnd:hWnd )
if !Empty(cMovie)
QTVopen(::hWnd,cMovie)
endif
::oWnd = oWnd
oWnd:AddControl( Self )
return Self
//----------------------------------------------------------------------------//
el ejemplo :
Code: Select all
// Building our first window
#include "FiveMac.ch"
#xcommand @ <nRow>, <nCol> MOVIE [ <oMovie> ] ;
[ FILENAME <cFileName> ] ;
[ OF <oWnd> ] ;
[ SIZE <nWidth>, <nHeight> ] ;
=> ;
[ <oMovie> := ] TMovie():New( <nRow>, <nCol>, <nWidth>, <nHeight>, <oWnd>,[<(cFileName)>] )
//----------------------------------------------------------------------------//
function Main()
local oWnd, oSay
local oMovie
DEFINE WINDOW oWnd TITLE "Tutor02" ;
FROM 200, 250 TO 750, 1100
DEFINE MSGBAR OF oWnd
@ 70,20 MOVIE oMovie SIZE 800, 450 OF oWnd
@ 30,20 BUTTON "Select movie" SIZE 100, 40 OF oWnd ACTION oMovie:DLgOpen()
@ 30,120 BUTTON "Cambio vista control " SIZE 200, 40 OF oWnd ACTION oMovie:SetcontrolVisible((!oMovie:GetControlvisible()) )
// otree:=QTVcreate(30,20,800,450,oWnd:hwnd)
// QTVopen(otree,"/Users/manuel/Movies/villacorto720.mov")
@ 0, 10 SAY "A FiveMac MsgBar" OF oWnd SIZE 150, 20 RAISED
ACTIVATE WINDOW oWnd ;
VALID MsgYesNo( "Want to end ?" )
return nil
//----------------------------------------------------------------------------//
Re: Peliculas desde fivemac
Posted: Wed Jul 21, 2010 9:32 pm
by Antonio Linares
Manuel,
Cada vez estas mejor y mejor. Enhorabuena!!!
Re: Peliculas desde fivemac
Posted: Thu Jul 22, 2010 6:23 am
by Massimo Linossi
Hi.
I understand only a little of Spanish, but I want to say to both
that you are making an incredible work.
Many compliments !!!!
Massimo.
Re: Peliculas desde fivemac
Posted: Thu Jul 22, 2010 12:00 pm
by Dino Alessandri
tú eres grande!
Dino
Re: Peliculas desde fivemac
Posted: Mon Jul 26, 2010 7:07 pm
by mastintin
Recordar que esta clase tambien puede reproducir sonido .Con 4 lineas se puede reralizar un reproductor de mp3 cojonudo ....
Añado un par de metodos a la clase :
Code: Select all
--------------- los metodos -------------------------
METHOD play() INLINE QTVPLAY (::hWnd)
METHOD pause() INLINE QTVPause (::hWnd)
METHOD AutoAjust() INLINE QTVAUTOAJUST(::HWnd)
------------------ las funciones ----------------------------
HB_FUNC( QTVPLAY )
{
QTMovieView * vista = ( QTMovieView *) hb_parnl( 1 );
[ vista play : vista ];
}
HB_FUNC( QTVPAUSE )
{
QTMovieView * vista = ( QTMovieView *) hb_parnl( 1 );
[ vista play : vista ];
}
HB_FUNC( QTVAUTOAJUST )
{
QTMovieView * vista = ( QTMovieView *) hb_parnl( 1 );
[ vista setAutoresizingMask : NSViewWidthSizable | NSViewHeightSizable ];
}