tsBrowse y Harbour

tsBrowse y Harbour

Postby fgondi » Fri Jun 28, 2013 5:28 pm

Alguien tiene la librería tsbrowse compilada para las últimas versiones de Harbour?

O Alguien sabe como compilarla?
Un saludo
Fernando González Diez
ALSIS Sistemas Informáticos
User avatar
fgondi
 
Posts: 694
Joined: Fri Oct 07, 2005 6:58 am
Location: Palencia, España

Re: tsBrowse y Harbour

Postby horacio » Fri Jun 28, 2013 5:38 pm

Si tenés las fuentes lo compilarias como cualquier prg. Yo antes lo utilizaba y lo compilaba con el resto de mis fuentes.

Saludos
horacio
 
Posts: 1358
Joined: Wed Jun 21, 2006 12:39 am
Location: Capital Federal Argentina

Re: tsBrowse y Harbour

Postby fgondi » Fri Jun 28, 2013 6:29 pm

Eso ya lo he intentado y al compilar los .c aparecen muchiiiisimos errores.

Buscando en el foro he visto que mas gente le ha pasado.
Alguno ha conseguido solucionarlo?
Un saludo
Fernando González Diez
ALSIS Sistemas Informáticos
User avatar
fgondi
 
Posts: 694
Joined: Fri Oct 07, 2005 6:58 am
Location: Palencia, España

Re: tsBrowse y Harbour

Postby Enrrique Vertiz » Fri Jun 28, 2013 8:50 pm

Fernando, Yo tengo la TsBrowse 8 original con los proyectos verce listos para que cambies las rutas y la compiles con la version de Harbour o xHarbour que gustes, Yo tengo xHarbour por eso no te ofrezco la LIB pero los fuentes te sirven y los compilas con cada version nueva que tengas de Harbour - FWH, dame un mail donde enviartela
Enrrique Vertiz Pitta
Lima-Peru
xHb 1.23.1026X, Fwh 24.02, MySQL 8.0.X, SQLLIB 1.9m
Enrrique Vertiz
 
Posts: 519
Joined: Fri Oct 07, 2005 2:17 pm
Location: Lima - Peru

Re: tsBrowse y Harbour

Postby fgondi » Fri Jun 28, 2013 9:05 pm

Los fuentes también los tengo.
El problemas es que no puedo compilarlos con las últimas versiones de Harbour.
Un saludo
Fernando González Diez
ALSIS Sistemas Informáticos
User avatar
fgondi
 
Posts: 694
Joined: Fri Oct 07, 2005 6:58 am
Location: Palencia, España

Re: tsBrowse y Harbour

Postby horacio » Sat Jun 29, 2013 1:01 pm

horacio
 
Posts: 1358
Joined: Wed Jun 21, 2006 12:39 am
Location: Capital Federal Argentina

Re: tsBrowse y Harbour

Postby acuellar » Sat Jun 29, 2013 1:24 pm

Saludos,

Adhemar C.
User avatar
acuellar
 
Posts: 1594
Joined: Tue Oct 28, 2008 6:26 pm
Location: Santa Cruz-Bolivia

Re: tsBrowse y Harbour

Postby fgondi » Sat Jun 29, 2013 5:42 pm

Adhemar, gracias por la ayuda.
La librería que hay ahí esta en compilada con xharbour y por lo tanto no me vale.

Horacio, gracias por contestar.
Gracias a ese hilo y una serie de cambios/ajustes que he realizado en TsbFuncs.c he conseguio compilarla con la versión "harbour_bcc582_20130228" de Fivewin.

Por si a alguien le vuelve a pasar o le esta pasando, incluyo TsbFuncs.c tal y como la tengo
Code: Select all  Expand view
/***************************************************************

This file contains the special painting routines used by TSBrowse Class
Last update: November 30th, 2009

***************************************************************/


#include <hbApi.h>    /* set your own path if needed */
//#include <WinTen.h>   /* set your own path if needed */
#include <Windows.h>
//#include <ClipApi.h>  /* set your own path if needed */
//#include <shellapi.h>
//#include <StdLib.h>

#define _HB_API_INTERNAL_

void WndBoxDraw( HDC, LPRECT, HPEN, HPEN, int, BOOL ) ;
void cDrawCursor( HWND, LPRECT, long, COLORREF ) ;
void DrawCheck( HDC, LPRECT, HPEN, int, BOOL ) ;
DWORD GetTextExtent( HDC, LPCSTR, int ) ;
extern void DrawBitmap( HDC, HBITMAP, WORD wCol, WORD wRow, WORD wWidth, WORD wHeight, DWORD dwRaster ) ;
extern void DrawMasked( HDC hdc, HBITMAP hbm, WORD y, WORD x ) ;
extern void MaskRegion( HDC hDC, RECT * rct, COLORREF cTransparent, COLORREF cBackground ) ;
static void GoToPoint( HDC, int, int ) ;
static void DegradColor( HDC, RECT *, COLORREF, signed long ) ;

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

#ifndef __HARBOUR__
CLIPPER TSDrawCell(  ) // ( hWnd, hDC, nRow, nColumn , nWidth ,
                             //   uData, nAlign , nClrFore, nClrBack ,
                             //   hFont, nBitmap, nHeightCell,
                             //   b3DLook, nLineStyle, nClrLine, nHeadFoot,
                             //   nHeightHead, nHeightFoot, hHeightSuper,
                             //   lAdjBmpl, lMultiLine, nVAlign, nVertText,
                             //   nClrTo, lDegrad, hBrush )
#else
HARBOUR HB_FUN_TSDRAWCELL(  )
#endif
{
   HWND hWnd        = (HWND) hb_parni( 1 ) ;
   HDC  hDC         = (HDC) hb_parni( 2 ) ;
   int  nRow        = hb_parni( 3 ) ;
   int  nColumn     = hb_parni( 4 ) ;
   int  nWidth      = hb_parni( 5 ) ;
   LPSTR cData      = (LPSTR) hb_parc( 6 )  ;
   int  nLen        = hb_parclen( 6 ) ;
   DWORD nAlign     = hb_parnl( 7 ) ;
   COLORREF clrFore = hb_parnl( 8 ) ;
   COLORREF clrBack = hb_parnl( 9 ) ;
   HFONT hFont      = (HFONT) hb_parni( 10 ) ;
   HBITMAP hBitMap  = (HBITMAP) hb_parni( 11 ) ;
   int nHeightCell  = hb_parni( 12 ) ;
   BOOL b3DLook     = hb_parl( 13 ) ;
   int nLineStyle   = hb_parni( 14 ) ;
   COLORREF clrLine = hb_parnl( 15 ) ;
   int nHeadFoot    = hb_parni( 16 ) ;
   int nHeightHead  = hb_parni( 17 ) ;
   int nHeightFoot  = hb_parni( 18 ) ;
   int nHeightSuper = hb_parni( 19 ) ;
   BOOL bAdjBmp     = hb_parl( 20 ) ;
   BOOL bMultiLine  = hb_parl( 21 ) ;
   int nVAlign      = hb_parni( 22 ) ;
   int nVertText    = hb_parni( 23 ) ;
   COLORREF clrTo   = hb_parnl( 24 ) ;
   BOOL bOpaque     = hb_parl( 25 ) ;
   HBRUSH wBrush    = (HBRUSH) hb_parnl( 26 ) ;
   BOOL b3DInv      = ( HB_ISLOG( 27 ) ? ! hb_parl( 27 ) : FALSE ) ;
   BOOL b3D         = ( HB_ISLOG( 27 ) ? TRUE : FALSE ) ;
   COLORREF nClr3DL = hb_parnl( 28 ) ;
   COLORREF nClr3DS = hb_parnl( 29 ) ;
   long lCursor     = hb_parnl( 30 ) ;

   int ixLayOut     = HIWORD( nAlign ) ;
   int iAlign       = LOWORD( nAlign ) ;
   int iTxtW        = LOWORD( GetTextExtent( hDC, cData, nLen ) ) ;
   BOOL bGrid       = ( nLineStyle > 0 ? TRUE : FALSE ) ;
   BOOL bHeader     = ( nHeadFoot == 1 ? TRUE : FALSE ) ;
   BOOL bFooter     = ( nHeadFoot == 2 ? TRUE : FALSE ) ;
   BOOL bSuper      = ( nHeadFoot == 3 ? TRUE : FALSE ) ;
   BOOL bChecked    = ( nVertText == 3 ? TRUE : FALSE ) ;
   BOOL bBrush      = ( wBrush ? TRUE : FALSE ) ;
   BOOL bDegrad     = ( bBrush || clrTo == clrBack ? FALSE : TRUE ) ;
   HFONT hOldFont ;
   BOOL bDestroyDC  = FALSE ;
   HPEN hGrayPen    = CreatePen( PS_SOLID, 1, clrLine );
   HPEN hWhitePen   = CreatePen( PS_SOLID, 1, GetSysColor( COLOR_BTNHIGHLIGHT ) ) ;

   RECT rct ;
   BITMAP bm ;
   int nTop, nLeft, nBkOld, iFlags ;

   if( ! hDC )
   {
      bDestroyDC = TRUE ;
      hDC = GetDC( hWnd ) ;
   }

   if( hFont )
      hOldFont = SelectObject( hDC, hFont ) ;

   GetClientRect( hWnd, &rct ) ;
   SetTextColor( hDC, clrFore ) ;
   SetBkColor( hDC, clrBack ) ;

   if( nRow == 0 )
      rct.top = ( bHeader ? nHeightSuper - ( nHeightSuper ? 1 : 0 ) : 0 ) ;
   else
      rct.top = ( bFooter ? rct.bottom - nHeightFoot + 1 : nHeightHead + nHeightSuper - ( nHeightSuper ? 1 : 0 ) +
                  ( nHeightCell * ( nRow - 1 ) ) ) ;

   rct.bottom = rct.top + ( bHeader ? nHeightHead :( bSuper ? nHeightSuper : nHeightCell ) - 1 ) ;

   /* Don't let left side go beyond rct.right of Client Rect. */
   if( nColumn - ( rct.right - rct.left ) <= 0 )
   {
      rct.left = nColumn ;

        /* if nWidth == -1 or -2, it indicates the last column so go to limit,
         Don't let right side go beyond rct.right of Client Rect. */

      if( ( nWidth >= 0 ) && ((rct.left + nWidth - rct.right) <= 0) )  // negative values have different meanings
         rct.right = rct.left + nWidth ;

      if( ! bDegrad )
      {
         rct.bottom += ( bHeader ? 0 : 1 ) ;
         rct.right += 1 ;

         if( ! bBrush )
            ExtTextOut( hDC, rct.left, rct.top, ETO_OPAQUE | ETO_CLIPPED, &rct, "", 0, 0  ) ;
         else
            FillRect( hDC, &rct, wBrush ) ;

         rct.bottom -= ( bHeader ? 0 : 1 ) ;
         rct.right -= 1 ;
      }
      else
         DegradColor( hDC, &rct, clrBack, clrTo  ) ;

      if( hBitMap )
      {

         if( ! bAdjBmp )
         {
             GetObject( hBitMap, sizeof( BITMAP ), ( LPSTR ) &bm ) ;
             nTop = rct.top + ( ( rct.bottom - rct.top + 1 ) / 2 ) - ( bm.bmHeight / 2 ) ;

             switch( ixLayOut ) // bitmap layout x coordinate
             {
               case 0: // column left
                  nLeft = rct.left ;
                  break ;
               case 1: // column center (text -if any- may overwrite the bitmap)
                  nLeft = rct.left + ( ( rct.right - rct.left + 1 ) / 2 ) -
                          ( bm.bmWidth / 2 ) - 1 ;
                  break ;
               case 2: // column right
                  nLeft = rct.right - ( bm.bmWidth + 1 ) ;
                  break ;
               case 3: // left of centered text
                  nLeft = max( rct.left, rct.left + ( ( rct.right - rct.left + 1 ) / 2 ) -
                          ( iTxtW / 2 ) - bm.bmWidth - 2 ) ;
                  break ;
               case 4: // right of centered text
                  nLeft = rct.left + ( ( rct.right - rct.left + 1 ) / 2 ) + ( iTxtW / 2 ) + 2 ;
                  break ;
               default: // a value > 4 means specific pixel location from column left
                  nLeft = rct.left + ixLayOut ;
                  break ;
             }
         }
         else
         {
            nTop  = rct.top ;
            nLeft = rct.left ;
         }

         if( b3DLook )
         {
            if( bAdjBmp )
            {
               nTop  = rct.top + 1 ;
               DrawBitmap( hDC, hBitMap,  nTop, rct.left - 1, rct.right - rct.left + 1,
                           rct.bottom - rct.top - 1, 0 ) ;
               hBitMap = 0 ;

               if( ! bOpaque )
                  MaskRegion( hDC, &rct, GetPixel( hDC, nLeft, nTop ), GetBkColor( hDC ) ) ;
            }
            else
               if( bOpaque )
                  DrawBitmap( hDC, hBitMap, nTop, nLeft, 0, 0, 0 ) ;
               else
                  DrawMasked( hDC, hBitMap, nTop, nLeft ) ;
         }
         else
         {
            if( bAdjBmp)
            {
               DrawBitmap( hDC, hBitMap,  rct.top, rct.left - 2, rct.right - rct.left + 3,
                           rct.bottom - rct.top - 1, 0 ) ;
               hBitMap = 0 ;

               if( ! bOpaque )
                  MaskRegion( hDC, &rct, GetPixel( hDC, nLeft, nTop ), GetBkColor( hDC ) ) ;
            }
            else
               if( bOpaque )
                  DrawBitmap( hDC, hBitMap, nTop, nLeft, 0, 0, 0 ) ;
               else
                  DrawMasked( hDC, hBitMap, nTop, nLeft ) ;
         }
      }

      if( nLen )
      {
         if( iAlign == DT_LEFT )
            rct.left += ( 2 + ( hBitMap && ixLayOut == 0 ? bm.bmWidth + 1 : 0 ) ) ;

         if( iAlign == DT_RIGHT )
            rct.right -= ( 2 + ( hBitMap && ixLayOut == 2 ? bm.bmWidth + 1 : 0 ) ) ;

         if( nVertText == 1 )
         {
            rct.right  += ( 4 * nLen ) ;
            rct.bottom += 10 ;
         }

         iFlags = iAlign | DT_NOPREFIX | nVAlign * 4 | ( bMultiLine && nVAlign < 2 ? 0 : DT_SINGLELINE ) ;

         if( ( nVertText == 3 || nVertText == 4 ) )
            DrawCheck( hDC, &rct, hWhitePen, iAlign, bChecked ) ;
         else
         {
            nBkOld = SetBkMode( hDC, TRANSPARENT ) ;

            if( b3D )
            {
               rct.top    -= 1 ;
               rct.left   -= 1 ;
               rct.bottom -= 1 ;
               rct.right  -= 1 ;
               SetTextColor( hDC, b3DInv ? nClr3DS : nClr3DL ) ;
               DrawTextEx( hDC, cData, nLen, &rct, iFlags, NULL ) ;

               rct.top    += 2 ;
               rct.left   += 2 ;
               rct.bottom += 2 ;
               rct.right  += 2 ;
               SetTextColor( hDC, b3DInv ? nClr3DL : nClr3DS ) ;
               DrawTextEx( hDC, cData, nLen, &rct, iFlags, NULL ) ;

               rct.top    -= 1 ;
               rct.left   -= 1 ;
               rct.bottom -= 1 ;
               rct.right  -= 1 ;
               SetTextColor( hDC, clrFore ) ;
            }

            DrawTextEx( hDC, cData, nLen, &rct, iFlags, NULL ) ;
            SetBkMode( hDC, nBkOld ) ;
         }

         if( iAlign == DT_LEFT )
            rct.left -= ( 2 + ( hBitMap && ixLayOut == 0 ? bm.bmWidth + 1 : 0 ) ) ;

         if( iAlign == DT_RIGHT )
            rct.right += ( 2 + ( hBitMap && ixLayOut == 2 ? bm.bmWidth + 1 : 0 ) ) ;

         if( nVertText == 1 )
         {
            rct.right -= ( 4 * nLen ) ;
            rct.bottom -= 10 ;
         }
      }

      if( b3DLook )
      {
         bHeader = ( bSuper ? bSuper : bHeader ) ;

         if( ( nWidth != -2 ) && bGrid )   // -1 draw gridline in phantom column; -2 don't draw gridline in phantom column
            WndBoxDraw( hDC, &rct, hWhitePen, hGrayPen, b3DLook ? 4 : nLineStyle, bHeader ) ;

         if( lCursor )
            cDrawCursor( hWnd, &rct, lCursor, clrFore ) ;

      }
      else
      {
         bHeader = ( bFooter ? bFooter : ( bHeader || bSuper ) ) ;

         if( ( nWidth != -2 ) && bGrid )   // -1 draw gridline in phantom column; -2 don't draw gridline in phantom column
               WndBoxDraw( hDC, &rct, hGrayPen, hGrayPen, nLineStyle, bHeader ) ;

         if( lCursor )
            cDrawCursor( hWnd, &rct, lCursor, clrFore ) ;
      }

   }

   DeleteObject( hGrayPen ) ;
   DeleteObject( hWhitePen ) ;
   if( hFont )
      SelectObject( hDC, hOldFont ) ;

   if( bDestroyDC )
      ReleaseDC( hWnd, hDC ) ;
}

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

void WndBoxDraw( HDC hDC, RECT * rct, HPEN hPUpLeft, HPEN hPBotRit, int nLineStyle, \
                 BOOL bHeader )

{
   HPEN hOldPen = SelectObject( hDC, hPUpLeft ) ;
   HPEN hBlack   = CreatePen( PS_SOLID, 1, 0 ) ;

   switch( nLineStyle )
   {
      case 0 :
         break ;
      case 1 :
         SelectObject( hDC, hPBotRit ) ;
         GoToPoint( hDC, rct->left, rct->bottom - ( bHeader ? 1 : 0 ) ) ;
         LineTo( hDC, rct->right - 1, rct->bottom - ( bHeader ? 1 : 0 ) ) ;
         LineTo( hDC, rct->right - 1, rct->top - 1 ) ;
         if( bHeader )
            LineTo( hDC, rct->left - 1, rct->top - 1 ) ;
         break ;
      case 2 :
         SelectObject( hDC, hPBotRit ) ;
         GoToPoint( hDC, rct->right - 1, rct->bottom ) ;
         LineTo( hDC, rct->right - 1, rct->top - 1 ) ;
         break ;
      case 3 :
         SelectObject( hDC, hPBotRit ) ;
         GoToPoint( hDC, rct->left, rct->bottom ) ;
         LineTo( hDC, rct->right, rct->bottom ) ;
         break ;
      case 4 :
         SelectObject( hDC, hPUpLeft ) ;
         GoToPoint( hDC, rct->left, rct->bottom ) ;
         LineTo( hDC, rct->left, rct->top ) ;
         LineTo( hDC, rct->right , rct->top ) ;
         SelectObject( hDC, hPBotRit ) ;
         GoToPoint( hDC, rct->left, rct->bottom - ( bHeader ? 1 : 0 ) ) ;
         LineTo( hDC, rct->right - 1, rct->bottom - ( bHeader ? 1 : 0 ) ) ;
         LineTo( hDC, rct->right - 1, rct->top - 1 ) ;
         break ;
      case 5 :
         rct->top += 1 ;
         rct->left += 1 ;
         rct->bottom -= 1 ;
         rct->right -= 1 ;
         DrawFocusRect( hDC, rct );
         break ;
   }

   SelectObject( hDC, hOldPen );
   DeleteObject( hBlack );
}

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

#ifndef __HARBOUR__
   CLIPPER TSBrwScrol(  )  // l( hWnd, nDir, hFont, nHeightCell, nHeightHead,
                                 //    nHeightFoot, nHeightSuper )
#else
   HARBOUR HB_FUN_TSBRWSCROLL(  )
#endif
{
   HWND hWnd        = (HWND) hb_parni( 1 ) ;
   int iRows        = hb_parni( 2 ) ;
   HFONT hFont      = (HFONT) hb_parni( 3 ) ;
   int nHeightCell  = hb_parni( 4 ) ;
   int nHeightHead  = hb_parni( 5 ) ;
   int nHeightFoot  = hb_parni( 6 ) ;
   int nHeightSuper = hb_parni( 7 ) ;

   HFONT hOldFont ;
   HDC hDC = GetDC( hWnd ) ;
   RECT rct;

   if( hFont )
      hOldFont = SelectObject( hDC, hFont ) ;

   GetClientRect( hWnd, &rct ) ;

   rct.top    += ( nHeightHead + nHeightSuper - ( nHeightSuper ? 1 : 0 ) ) ;  // exclude heading from scrolling
   rct.bottom -= nHeightFoot ;                     // exclude footing from scrolling
   rct.bottom -= ( ( rct.bottom - rct.top + 1 ) % nHeightCell );  // exclude unused portion at bottom
   ScrollWindowEx( hWnd, 0, (int) -( nHeightCell * iRows ), 0, &rct, 0, 0, 0 );

   if( hFont )
      SelectObject( hDC, hOldFont );

   ReleaseDC( hWnd, hDC );
}

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

#ifndef __HARBOUR__
   CLIPPER TSBrwHScro(  )  // ll( hWnd, nCols, nLeft, nRight )
#else
   HARBOUR HB_FUN_TSBRWHSCROLL(  )
#endif
{
   HWND hWnd  = (HWND) hb_parni( 1 ) ;
   WORD wCols = hb_parni( 2 ) ;
   int nLeft  = hb_parni( 3 ) ;
   int nRight = hb_parni( 4 ) ;

   HDC hDC    = GetDC( hWnd ) ;
   RECT rct;

   GetClientRect( hWnd, &rct ) ;

   if ( nLeft )
      rct.left = nLeft ;

   if ( nRight )
      rct.right = nRight ;

   ScrollWindowEx( hWnd, wCols, 0, 0, &rct, 0, 0, 0 ) ;

   ReleaseDC( hWnd, hDC ) ;
}


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

#ifndef __HARBOUR__
   CLIPPER RowFromPix(  ) // ( hWnd, nRowPix, nHeightCell, nHeightHead,
                                //   nHeightFoot, nHeightSuper ) -> nTextRow
#else
   HARBOUR HB_FUN_ROWFROMPIX(  )
#endif
{
   HWND hWnd = ( HWND ) hb_parni( 1 ) ;
   int iPixR = hb_parni( 2 ) ;
   int iCell = hb_parni( 3 ) ;
   int iHead = hb_parni( 4 ) ;
   int iFoot = hb_parni( 5 ) ;
   int iSupH = hb_parni( 6 ) ;

   RECT rct ;
   int iRow ;

   GetClientRect( hWnd, &rct ) ;

   if( iPixR <= ( rct.top + iHead + iSupH ) )
      iRow = 0 ;
   else
      if( iPixR >= ( rct.bottom - iFoot ) )
         iRow = -1 ;
      else
      {
         rct.top += ( iHead + iSupH ) ;
         iRow = ( ( iPixR - rct.top ) / iCell ) + 1 ;
      }

   hb_retni( iRow ) ;
}

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

#ifndef __HARBOUR__
   CLIPPER SBGetHeigh(  ) // t( hWnd, hFont, nTotal )
#else
   HARBOUR HB_FUN_SBGETHEIGHT(  )
#endif
{
   HWND  hWnd  = (HWND) hb_parni( 1 ) ;
   HFONT hFont = (HFONT) hb_parni( 2 ) ;
   int  iTotal = hb_parni( 3 )  ;

   TEXTMETRIC tm ;

   RECT  rct ;
   HDC   hDC = GetDC( hWnd ) ;
   HFONT hOldFont ;
   LONG  lTotHeight, lReturn ;

   if( iTotal < 2 )
   {
      if( hFont )
         hOldFont = SelectObject( hDC, hFont ) ;
      GetTextMetrics( hDC, &tm ) ;
      if( hFont )
         SelectObject( hDC, hOldFont ) ;
      ReleaseDC( hWnd, hDC ) ;
      lReturn = ( iTotal == 1 ? tm.tmAveCharWidth : tm.tmHeight ) ;
      hb_retnl( lReturn ) ;
   }
   else
   {
      GetWindowRect( hWnd, &rct ) ;
      lTotHeight = rct.bottom - rct.top + 1 ;
      ReleaseDC( hWnd, hDC ) ;
      hb_retnl( lTotHeight ) ;
   }
}

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

#ifndef __HARBOUR__
   CLIPPER CountRows(  )  // ( hWnd, nHeightCell, nHeightHead,
                                //   nHeightFoot, nHeightSuper ) -> nRows
#else
   HARBOUR HB_FUN_COUNTROWS(  )
#endif
{
   HWND hWnd = ( HWND ) hb_parni( 1 ) ;
   int iCell = hb_parni( 2 ) ;
   int iHead = hb_parni( 3 ) ;
   int iFoot = hb_parni( 4 ) ;
   int iSupH = hb_parni( 5 ) ;

   RECT rct ;
   int iRows, iFree ;

   GetClientRect( hWnd, &rct ) ;

   iFree = rct.bottom - rct.top + 1 - iSupH - iHead - iFoot ;
   iRows = iFree / iCell ;

   hb_retni( iRows ) ;
}

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

#ifndef __HARBOUR__
   CLIPPER SBmpHeight(  ) // ( hBmp )
#else
   HARBOUR HB_FUN_SBMPHEIGHT(  ) // ( hBmp )
#endif
{
   HBITMAP hBmp  = (HBITMAP) hb_parni( 1 ) ;
   BITMAP bm ;

   GetObject( hBmp, sizeof( BITMAP ), ( LPSTR ) &bm ) ;

   hb_retni( bm.bmHeight ) ;
}

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

#ifndef __HARBOUR__
   CLIPPER SBmpWidth(  ) // ( hBmp )
#else
   HARBOUR HB_FUN_SBMPWIDTH(  )
#endif
{
   HBITMAP hBmp  = (HBITMAP) hb_parni( 1 ) ;
   BITMAP bm ;

   GetObject( hBmp, sizeof( BITMAP ), ( LPSTR ) &bm ) ;

   hb_retni( bm.bmWidth ) ;
}

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

void DrawCheck( HDC hDC, LPRECT rct, HPEN hWhitePen, int nAlign, BOOL bChecked )
{
   RECT lrct ;
   HPEN hOldPen ;
   HBRUSH hOldBrush ;

   HBRUSH hGrayBrush  = CreateSolidBrush( RGB( 192, 192, 192 ) ) ;
   HBRUSH hWhiteBrush = CreateSolidBrush( RGB( 255, 255, 255 ) ) ;
   HPEN hBlackPen     = CreatePen( PS_SOLID, 1, RGB( 0, 0, 0 ) ) ;
   HPEN hLGrayPen     = CreatePen( PS_SOLID, 1, RGB( 192, 192, 192 ) ) ;
   HPEN hGrayPen      = CreatePen( PS_SOLID, 1, RGB( 128, 128, 128 ) ) ;

   hOldBrush = SelectObject( hDC, hGrayBrush ) ;

   lrct.top = rct->top + ( ( ( rct->bottom - rct->top + 1 ) / 2 ) - 8 );

   switch( nAlign )
   {
      case 0:
         lrct.left = rct->left ;
         break ;
      case 1:
         lrct.left = rct->left + ( ( rct->right - rct->left + 1 ) / 2 ) - 8 ;
         break ;
      case 2:
         lrct.left = rct->right - 16 ;
         break ;
   }

   lrct.bottom = lrct.top + 16 ;
   lrct.right  = lrct.left + 16 ;

   lrct.left   -= 1 ;
   lrct.top    -= 1 ;
   lrct.right  += 1 ;
   lrct.bottom += 1 ;

   hOldPen = SelectObject( hDC, hBlackPen ) ;
   Rectangle( hDC, lrct.left, lrct.top, lrct.right, lrct.bottom ) ;

   lrct.left   += 1 ;
   lrct.top    += 1 ;
   lrct.right  -= 1 ;
   lrct.bottom -= 1 ;

   FillRect( hDC, &lrct, hGrayBrush ) ;

   lrct.top    += 2 ;
   lrct.left   += 2 ;
   lrct.right  -= 1 ;
   lrct.bottom -= 1 ;

   FillRect( hDC, &lrct, hWhiteBrush ) ;

   SelectObject( hDC, hOldBrush ) ;
   DeleteObject( hGrayBrush ) ;
   DeleteObject( hWhiteBrush ) ;

   lrct.right  -= 1 ;
   lrct.bottom -= 1 ;

   SelectObject( hDC, hGrayPen ) ;
   Rectangle( hDC, lrct.left, lrct.top, lrct.right, lrct.bottom ) ;

   lrct.top    += 1 ;
   lrct.left   += 1 ;
   lrct.right  -= 1 ;
   lrct.bottom -= 1 ;

   SelectObject( hDC, hBlackPen ) ;
   Rectangle( hDC, lrct.left, lrct.top, lrct.right, lrct.bottom ) ;

   lrct.top  += 1 ;
   lrct.left += 1 ;

   SelectObject( hDC, hWhitePen ) ;
   Rectangle( hDC, lrct.left, lrct.top, lrct.right, lrct.bottom ) ;

   lrct.top    += 1 ;
   lrct.right  -= 2 ;
   lrct.bottom -= 1 ;

   if( bChecked )
   {
      GoToPoint( hDC, lrct.right, lrct.top ) ;

      SelectObject( hDC, hBlackPen ) ;

      LineTo( hDC, lrct.right - 4 , lrct.bottom - 3 ) ;
      LineTo( hDC, lrct.right - 6, lrct.bottom - 5 ) ;

      GoToPoint( hDC, lrct.right, lrct.top + 1) ;
      LineTo( hDC, lrct.right - 4 , lrct.bottom - 2 ) ;
      LineTo( hDC, lrct.right - 6, lrct.bottom - 4 ) ;

      GoToPoint( hDC, lrct.right, lrct.top + 2) ;
      LineTo( hDC, lrct.right - 4 , lrct.bottom - 1 ) ;
      LineTo( hDC, lrct.right - 6, lrct.bottom - 3 ) ;
   }

   SelectObject( hDC, hOldPen ) ;
   DeleteObject( hGrayPen ) ;
   DeleteObject( hLGrayPen ) ;
   DeleteObject( hBlackPen ) ;
}

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

static void GoToPoint( HDC hDC, int ix, int iy )
{
   POINT pt;

   #ifdef __FLAT__
      MoveToEx( hDC, ix, iy, &pt ) ;
   #else
      MoveTo( hDC, ix, iy );
   #endif
}

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

static void DegradColor( HDC hDC, RECT * rori, COLORREF cFrom, signed long cTo )
{
   float clr1r, clr1g, clr1b, clr2r, clr2g, clr2b ;
   float iEle, iRed, iGreen, iBlue ;
   BOOL bDir, bHoriz = cTo < 0 ;
   float iTot = ( ! bHoriz ? ( rori->bottom + 2 - rori->top ) : ( rori->right + 2 - rori->left ) ) ;
   RECT rct ;
   HBRUSH hOldBrush, hBrush ;

   rct.top = rori->top ;
   rct.left = rori->left ;
   rct.bottom = rori->bottom ;
   rct.right = rori->right ;

   clr1r = GetRValue( cFrom ) ;
   clr1g = GetGValue( cFrom ) ;
   clr1b = GetBValue( cFrom ) ;

   cTo   = ( cTo < 0 ? -cTo : cTo ) ;
   clr2r = GetRValue( cTo ) ;
   clr2g = GetGValue( cTo ) ;
   clr2b = GetBValue( cTo ) ;

   iRed   =  clr2r - clr1r ;
   iGreen =  clr2g - clr1g ;
   iBlue  =  clr2b - clr1b ;

   iRed   = ( iRed / iTot ) ;
   iGreen = ( iGreen / iTot ) ;
   iBlue  = ( iBlue / iTot ) ;

   iRed   = ( iRed < 0 ? -iRed : iRed ) ;
   iGreen = ( iGreen < 0 ? -iGreen : iGreen ) ;
   iBlue  = ( iBlue < 0 ? -iBlue : iBlue ) ;

   if( ! bHoriz )
      rct.bottom = rct.top + 1 ;
   else
      rct.right = rct.left + 1 ;

   hBrush = CreateSolidBrush( RGB( clr1r, clr1g, clr1b ) ) ;
   hOldBrush = SelectObject( hDC, hBrush ) ;
   FillRect( hDC, &rct, hBrush ) ;

   for( iEle = 1; iEle < iTot; iEle++ )
   {
         bDir = ( clr2r >= clr1r ? TRUE : FALSE ) ;
         if( bDir )
            clr1r += iRed ;
         else
            clr1r -= iRed ;

         clr1r = ( clr1r < 0 ? 0 : clr1r > 255 ? 255 : clr1r ) ;

         bDir = ( clr2g >= clr1g ? TRUE : FALSE  ) ;
         if( bDir )
            clr1g += iGreen ;
         else
            clr1g -= iGreen ;
         clr1g = ( clr1g < 0 ? 0 : clr1g > 255 ? 255 : clr1g ) ;

         bDir = ( clr2b >= clr1b ? TRUE : FALSE  ) ;
         if( bDir )
            clr1b += iBlue ;
         else
            clr1b -= iBlue ;
         clr1b = ( clr1b < 0 ? 0 : clr1b > 255 ? 255 : clr1b ) ;

      SelectObject( hDC, hOldBrush ) ;
      DeleteObject( hBrush ) ;
      hBrush = CreateSolidBrush( RGB( clr1r, clr1g, clr1b ) ) ;
      SelectObject( hDC, hBrush ) ;
      FillRect( hDC, &rct, hBrush ) ;

      if( ! bHoriz )
      {
         rct.top++ ;
         rct.bottom++ ;
      }
      else
      {
         rct.left++ ;
         rct.right++ ;
      }
   }
   SelectObject( hDC, hOldBrush ) ;
   DeleteObject( hBrush ) ;
}

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

#ifndef __HARBOUR__
   CLIPPER CHANGESYSC(  ) // OLORS( nItems, aItems, aColors )
#else
   HARBOUR HB_FUN_CHANGESYSCOLORS(  )
#endif
{
   int iEle, iItems = hb_parni( 1 ) ;
   int aiElemen[ 28 ] ;
   COLORREF alColors[ 28 ] ;

   for( iEle = 0 ; iEle <= ( iItems - 1 ) ; iEle++ )
   {
      aiElemen[ iEle ] = hb_parinfa( 2, ( iEle + 1 ) ) ;
      alColors[ iEle ] = hb_parinfa( 3, ( iEle + 1 ) ) ;
   }

   SetSysColors( iItems, aiElemen, alColors ) ;
}

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

void cDrawCursor( HWND hWnd, RECT * rctc, long lCursor, COLORREF nClr )
{
   HDC hDC;
   HRGN hReg;
   COLORREF lclr = ( lCursor == 1 ? RGB( 5, 5, 5 ) : lCursor == 2 ? nClr : lCursor );
   HBRUSH hBr ;
   RECT rct ;

   if( lCursor != 3 )
   {
      hBr = CreateSolidBrush( lclr ) ;
      hReg = CreateRectRgn( rctc->left, rctc->top, rctc->right - 1, rctc->bottom );
      hDC  = GetDCEx( hWnd, hReg, DCX_CACHE );

      FrameRgn( hDC, hReg, hBr, 2, 2 );

      ReleaseDC( hWnd, hDC );
      DeleteObject( hReg ) ;
      DeleteObject( hBr ) ;
   }
   else
   {
      rct.top    = rctc->top + 1 ;
      rct.left   = rctc->left + 1 ;
      rct.bottom = rctc->bottom - 1 ;
      rct.right  = rctc->right - 1 ;

      hDC  = GetDC( hWnd ) ;
      DrawFocusRect( hDC, &rct ) ;
      ReleaseDC( hWnd, hDC ) ;
   }
}
 
Un saludo
Fernando González Diez
ALSIS Sistemas Informáticos
User avatar
fgondi
 
Posts: 694
Joined: Fri Oct 07, 2005 6:58 am
Location: Palencia, España

Re: tsBrowse y Harbour

Postby fgondi » Thu Jul 04, 2013 9:07 pm

Ahora con Microsoft Visual Studio 2012 me aparecen los siguiente errores al crear el ejecutable:

Code: Select all  Expand view
vTsBrowse.LIB(TSCOLUMN.obj) : error LNK2001: símbolo externo _HB_FUN_SBGETHEIGHT sin resolver
vTsBrowse.LIB(TSBROWSE.obj) : error LNK2001: símbolo externo _HB_FUN_SBGETHEIGHT sin resolver
vTsBrowse.LIB(TSBROWSE.obj) : error LNK2001: símbolo externo _HB_FUN_ROWFROMPIX sin resolver
vTsBrowse.LIB(TSBROWSE.obj) : error LNK2001: símbolo externo _HB_FUN_COUNTROWS sin resolver
vTsBrowse.LIB(TSBROWSE.obj) : error LNK2001: símbolo externo _HB_FUN_TSBRWSCROLL sin resolver
vTsBrowse.LIB(TSBROWSE.obj) : error LNK2001: símbolo externo _HB_FUN_SBMPHEIGHT sin resolver
vTsBrowse.LIB(TSBROWSE.obj) : error LNK2001: símbolo externo _HB_FUN_TSDRAWCELL sin resolver
vTsBrowse.LIB(TSBTNGET.obj) : error LNK2001: símbolo externo _HB_FUN_GETBTN sin resolver
 


Cuando genero la lib, no aparece ninguú error/mensaje.
Un saludo
Fernando González Diez
ALSIS Sistemas Informáticos
User avatar
fgondi
 
Posts: 694
Joined: Fri Oct 07, 2005 6:58 am
Location: Palencia, España

Re: tsBrowse y Harbour

Postby Antonio Linares » Fri Jul 05, 2013 3:57 am

Fernando,

Fíjate si estas compilando en modo C++.

Indícale que compile en modo C.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41404
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: tsBrowse y Harbour

Postby fgondi » Fri Jul 05, 2013 8:26 am

Antonio, Muchas gracias

Tienes razón, estaba compilando en modo C++. Una vez que lo he pasado a modo C funciona sin problemas.

Sólo he pasado la compilación de ese archivo C.
¿Debería pasar toda la librería?
¿Debería compilarse todo el código en modo C?, en el archivo buildh32.bat esta en modo C++
Un saludo
Fernando González Diez
ALSIS Sistemas Informáticos
User avatar
fgondi
 
Posts: 694
Joined: Fri Oct 07, 2005 6:58 am
Location: Palencia, España


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 96 guests