Peliculas desde fivemac

Post Reply
User avatar
mastintin
Posts: 1502
Joined: Thu May 27, 2010 2:06 pm

Peliculas desde fivemac

Post by mastintin »

pues una primera aproximacion al control QTview :
posible sintaxis :

@ 2,2 MOVIE oMv VAR cMovie SIZE 1600 ,900 OF oWnd

Image
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Peliculas desde fivemac

Post by Antonio Linares »

Manuel,

Formidable! :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
mastintin
Posts: 1502
Joined: Thu May 27, 2010 2:06 pm

Re: Peliculas desde fivemac

Post 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

//----------------------------------------------------------------------------//

 
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Peliculas desde fivemac

Post by Antonio Linares »

Manuel,

Cada vez estas mejor y mejor. Enhorabuena!!! :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Massimo Linossi
Posts: 474
Joined: Mon Oct 17, 2005 10:38 am
Location: Italy

Re: Peliculas desde fivemac

Post 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.
User avatar
Dino Alessandri
Posts: 13
Joined: Wed Feb 08, 2006 1:25 pm
Location: Italy

Re: Peliculas desde fivemac

Post by Dino Alessandri »

tú eres grande!

Dino
User avatar
mastintin
Posts: 1502
Joined: Thu May 27, 2010 2:06 pm

Re: Peliculas desde fivemac

Post 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 ];
}

 
Post Reply