pues una primera aproximacion al control QTview :
posible sintaxis :
@ 2,2 MOVIE oMv VAR cMovie SIZE 1600 ,900 OF oWnd
Peliculas desde fivemac
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: Peliculas desde fivemac
Manuel,
Formidable!
Formidable!
Re: Peliculas desde fivemac
Ya tengo lo mas básico :
Se tiene que enlazar el framework QTkit
el archivo qtview.m:
la clase Tmovie
el ejemplo :
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 ]);
}
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
//----------------------------------------------------------------------------//
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: Peliculas desde fivemac
Manuel,
Cada vez estas mejor y mejor. Enhorabuena!!!
Cada vez estas mejor y mejor. Enhorabuena!!!
- Massimo Linossi
- Posts: 474
- Joined: Mon Oct 17, 2005 10:38 am
- Location: Italy
Re: Peliculas desde fivemac
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.
I understand only a little of Spanish, but I want to say to both
that you are making an incredible work.
Many compliments !!!!
Massimo.
- Dino Alessandri
- Posts: 13
- Joined: Wed Feb 08, 2006 1:25 pm
- Location: Italy
Re: Peliculas desde fivemac
tú eres grande!
Dino
Dino
Re: Peliculas desde fivemac
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 :
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 ];
}