FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour Nueva Clase TGIF para FiveWin
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 PM
Nueva Clase TGIF para FiveWin
Posted: Sun Dec 13, 2009 02:03 PM
Un Cordial saludos a toda la comunidad, sigo trabajando en korea hasta finales de este año, he estado algo ausente pero aqui les dejo un nuevo trabajo, espero terminar esta nueva clase para el "build" de diciembre, les dejo un ejemplo de la misma:

La clase es pequeña pero con bastante fuerza
Heredamos de TControl (->TWindow) asi que podemos hacer uso de todos codeblock para el control de eventos :-)

He usado solo 3 para este ejemplo
LClicked = Cambia el GIF por otro (GetFile)
RClicked = Stop/Play Gif
Mouse Move = Muestra en la barra de titulo de la Window el nombre del GIF donde se genera el evento

solo lo he probado en windows 7 pues aqui no tengo disponibilidad de otro
http://www.sitasoft.com/fivewin/test/giftest.zip
Code (fw): Select all Collapse
#include "fivewin.ch"
        
function Main()

   local oWnd, oGif, n
   
   oGif = Array( 13 )
   DEFINE WINDOW oWnd TITLE "TEST GIF CLASS"
   
      oGif[ 1 ] := TGif():New( ".\gif\006.gif", 0, 22, 345, 240, oWnd )
      oGif[ 2 ] := TGif():New( ".\gif\015.gif", 0, oGif[ 1 ]:nRight + 5, 345, 240, oWnd )
      oGif[ 3 ] := TGif():New( ".\gif\bigled.gif", 0, oGif[ 2 ]:nRight + 5, 90, 532, oWnd )
      oGif[ 4 ] := TGif():New( ".\gif\forGif.gif", oGif[ 3 ]:nBottom + 5, oGif[ 3 ]:nLeft, 120, 120, oWnd )
      oGif[ 5 ] := TGif():New( ".\gif\forGif3.gif", oGif[ 3 ]:nBottom + 5, oGif[ 4 ]:nRight + 5, 120, 120, oWnd )
      oGif[ 6 ] := TGif():New( ".\gif\Funny.gif", oGif[ 1 ]:nBottom + 5, 22, 345, 240, oWnd )
      oGif[ 7 ] := TGif():New( ".\gif\gif01.gif",  oGif[ 3 ]:nBottom + 5, oGif[ 5 ]:nRight + 5, 120, 120, oWnd )
      oGif[ 8 ] := TGif():New( ".\gif\gif02.gif",  oGif[ 3 ]:nBottom + 5, oGif[ 7 ]:nRight + 5, 120, 120, oWnd )
      oGif[ 9 ] := TGif():New( ".\gif\gif03.gif",  oGif[ 3 ]:nBottom + 5, oGif[ 8 ]:nRight + 5, 120, 120, oWnd )
      oGif[ 10 ] := TGif():New( ".\gif\gif04.gif",  oGif[ 6 ]:nTop, oGif[ 6 ]:nRight + 5, 345, 240, oWnd )      
      oGif[ 11 ] := TGif():New( ".\gif\gif05.gif",  oGif[ 6 ]:nTop, oGif[ 10 ]:nRight + 5, 345, 240, oWnd )    
      oGif[ 12 ] := TGif():New( ".\gif\gif08.gif",  oGif[ 6 ]:nTop, oGif[ 11 ]:nRight + 5, 345, 240, oWnd )    
      oGif[ 13 ] := TGif():New( ".\gif\mail056.gif",  oGif[ 4 ]:nBottom + 5, oGif[ 3 ]:nLeft, 345, 240, oWnd )
      
      
      for n = 1 to Len( oGif )
         oGif[ n ]:bLClicked := MakeLClick( oGif[ n ] )
         oGif[ n ]:bMMoved   := MakeMMove( oGif[ n ] ) 
         oGif[ n ]:bRClicked := MakeRClick( oGif[ n ] ) 
      next
      
      

   ACTIVATE WINDOW oWnd MAXIMIZED
   
   
return nil   

function MakeLClick( oGif )
return {| | ReloadGif( oGif ) } 

function MakeMMove( oGif )
return {| | oGif:oWnd:cTitle := oGif:cFileName } 

function MakeRClick( oGif )
return {| | If( oGif:IsRunning(), oGif:Stop(), oGif:Play() ) } 


function ReloadGif( oGif )
   local cFile
   cFile := cGetFile( "*.Gif" )
   if ! Empty( cFile )
   
      oGif:SetFile( cFile ) 

   endif
   
return nil
      


//-----------------------------------------------------------
// Class TGif
// Gif Info ==>  lLopping
//               nCurrentLoop
//               nImages
//               nWidth
//               nHeight
//-----------------------------------------------------------

CLASS TGif FROM TControl

   DATA  hGif
   DATA  lRegGif
   DATA  cFilename
   
   CLASSDATA lRegistered
   
   METHOD New( oWnd, cFileName, nTop, nLeft )
    
   METHOD GetData() INLINE GetGifInfo( ::hGif )
   
   METHOD Play() INLINE FWGifPlay( ::hGif )
   METHOD Stop() INLINE FWGifStop( ::hGif )
   
   METHOD Restart() INLINE FWGifRestart( ::hGif )
   
   METHOD IsRunning() INLINE FWGifIsRunning( ::hGif )
   
   METHOD Destroy() INLINE FWGifEnd()
   
   METHOD SetFile( cFile ) INLINE ::cFileName := cFile, SetWindowText( ::hGif, cFile )
   
ENDCLASS

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

METHOD New( cFileName, nTop, nLeft, nBottom, nRight, oWnd ) CLASS TGif

    local aData

    default oWnd    := GetWndDefault(),;
            nTop    := 0,;
            nLeft   := 0,;
            nBottom := 100,;
            nRight  := 100


           
   ::nTop    = nTop
   ::nLeft   = nLeft
   ::nBottom = nBottom + nTop
   ::nRight  = nRight + nLeft         
   ::oWnd    = oWnd
   ::nStyle  = nOR( WS_VISIBLE, WS_CHILD )
   
   
   ::cFileName = cFileName

   if ! Empty( cFileName ) .And. ! File( cFileName )
      return nil
   endif
   
   ::Register( )

   if ! Empty( oWnd:hWnd )
      ::Create()
      ::lVisible = .t.
      oWnd:AddControl( Self )
   else
      oWnd:DefControl( Self )
      ::lVisible  = .f.
   endif
   
   FWGIFClass( 0, GetInstance() ) 
   
   ::hGif    := FWGifWindow( cFileName, nOR( WS_CHILD, WS_VISIBLE ), 0, 0, ::nWidth, ::nHeight, ::hWnd, 1 )
   
return self
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 PM
Re: Nueva Clase TGIF para FiveWin
Posted: Mon Dec 14, 2009 08:22 AM
Saludos nuevamente...

La nueva clase TGif esta finalizada, ESTARA DISPONIBLE PARA LA 9.12, pueden probar el siguiente ejemplo, dejo el codigo fuente del mismo...

Acepta redimensionar y ajustase a cualquier dimension

usa tres tipo de Redimenciones

1. Ajustable (ADJUST)
2. Al tamaño Asignado
3. Por el tamaño de la imagen

http://www.sitasoft.com/fivewin/test/testgif2.zip

TestGif2.prg
Code (fw): Select all Collapse
#include "fivewin.ch"
#include "gif.ch"

        
function Main()

   local oWnd, oGif
   local oCursor
   
   oGif = Array( 13 )
   
   DEFINE CURSOR oCursor HAND
   
   DEFINE WINDOW oWnd TITLE "TEST GIF CLASS" 
   
     @ 0, 0                                 GIF oGif[ 1 ] FILE "..\gifs\006.gif"     size 100, 100 ADJUST 
     @ oGif[ 1 ]:nTop, oGif[ 1 ]:nRight + 5 GIF oGif[ 2 ] FILE "..\gifs\015.gif"     size 100, 100 ADJUST      
     @ oGif[ 1 ]:nTop, oGif[ 2 ]:nRight + 5 GIF oGif[ 3 ] FILE "..\gifs\bigled.gif"  size 100, 100 ADJUST
     @ oGif[ 1 ]:nTop, oGif[ 3 ]:nRight + 5 GIF oGif[ 4 ] FILE "..\gifs\forGif.gif"  size 100, 100 ADJUST
     @ oGif[ 1 ]:nTop, oGif[ 4 ]:nRight + 5 GIF oGif[ 5 ] FILE "..\gifs\forGif3.gif" size 100, 100 ADJUST
     @ oGif[ 1 ]:nTop, oGif[ 5 ]:nRight + 5 GIF oGif[ 6 ] FILE "..\gifs\Funny.gif"   size 100, 100 ADJUST
     @ oGif[ 1 ]:nTop, oGif[ 6 ]:nRight + 5 GIF oGif[ 7 ] FILE "..\gifs\gif01.gif"   size 100, 100 ADJUST
     @ oGif[ 1 ]:nTop, oGif[ 7 ]:nRight + 5 GIF oGif[ 8 ] FILE "..\gifs\gif02.gif"   size 100, 100 ADJUST
     @ oGif[ 1 ]:nTop, oGif[ 8 ]:nRight + 5 GIF oGif[ 9 ] FILE "..\gifs\gif03.gif"   size 100, 100 ADJUST     
     @ oGif[ 1 ]:nBottom + 5, 0             GIF oGif[ 10 ] FILE "..\gifs\mail056.gif" ADJUST;
       ACTION( oGif[ 10 ]:lAdjust := .F.,;
               oGif[ 10 ]:Refresh(), ;
               oWnd:bResized := NIL ) CURSOR oCursor
     
     oWnd:bResized = {| | oGif[ 10 ]:ReSize( , oWnd:nWidth, oWnd:nHeight - 150 ) } 

   ACTIVATE WINDOW oWnd MAXIMIZED 
   
return nil
Posts: 498
Joined: Thu May 10, 2007 08:30 PM
Re: Nueva Clase TGIF para FiveWin
Posted: Tue Dec 15, 2009 11:32 AM
Me imagino que FWGifWindow() es una function del ultimo FWH, ¿o ya existía en versiones anteriores de FWH?

Un saludo
Peaaaaaso de foro...

FWH 2007 - xHarbour - BCC55
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 PM
Re: Nueva Clase TGIF para FiveWin
Posted: Tue Dec 15, 2009 11:45 AM

Hola Antolin...

FWGifWindow() si, efectivamente, es una funcion nueva, la vieja clase TGIF no soportaba algunos formatos, ahora esta mas completa, esta nueva funcion es la que hace toda la "magia"

Estara disponible para la proxima version de FWH ( 9.12 )

Posts: 498
Joined: Thu May 10, 2007 08:30 PM
Re: Nueva Clase TGIF para FiveWin
Posted: Tue Dec 15, 2009 12:47 PM

OK Daniel. Gracias

Peaaaaaso de foro...

FWH 2007 - xHarbour - BCC55

Continue the discussion