Compiling TSButton with MinGW gcc

Compiling TSButton with MinGW gcc

Postby concentra » Tue Oct 18, 2011 12:42 pm

I need to compile TSButton version 7 with Harbour 3.1 ( not "X" ) and MinGW gcc 4.5.2-dw2 and I need some help on some errors in C.
To generate the .lib, based on the SBUTTONH.VRC I built this TSButton7.hbp :
Code: Select all  Expand view
-incpath=..\..\..\INCLUDE
-incpath=F:\FWH\INCLUDE
-incpath=g:\hb31\include
-m
-n
-w
-q0
-es2
-gc1
-p
-hblib

..\..\FUNCTION\TSBUTT~1\BPAINT.C 

And when I do the hbmk2 TSButton7.hbp I got this errors:

In file included from F:/FWH/TSButton/source/FUNCTION/TSBUTT~1/BPAINT.C:7:0:
F:/FWH/INCLUDE/ClipApi.h:69:28: error: conflicting declaration 'typedef unsigned int WORD'
c:\hb31\comp\mingw\bin\../lib/gcc/mingw32/4.5.2-dw2/../../../../include/windef.h:241:24: error: 'WORD' has a previous declaration as 'typedef short unsigned int WORD'
F:/FWH/INCLUDE/ClipApi.h:80:21: error: expected identifier before numeric constant
F:/FWH/INCLUDE/ClipApi.h:80:21: error: expected '}' before numeric constant
F:/FWH/INCLUDE/ClipApi.h:80:21: error: expected unqualified-id before numeric constant
F:/FWH/INCLUDE/ClipApi.h:80:33: error: expected declaration before '}' token
hbmk2: Erro: Executando compilador C/C++. 1
g++.exe -c -O3 -march=i586 -mtune=pentiumpro -fomit-frame-pointer  -W -Wall -pipe -IC:/hb31/include -IF:/FWH/TSButton/INCLUDE -I
F:/FWH/INCLUDE -Ig:/hb31/include F:/FWH/TSButton/source/FUNCTION/TSBUTT~1/BPAINT.C


The ClipApi.h is added in the begginning of the .C :

Code: Select all  Expand view
/* TSButton Class, paint routines
   Author: Manuel Mercado
   Last update: Sept 11th, 2009 */


#include <WinTen.h>   /* set your own path if needed */
#include <Windows.h>
#include <ClipApi.h>  /* set your own path if needed */
#include <StdLib.h>
#define NOTSRCAND 0x220326
.
.
.
.

Could anyone help me with this ?

P.S. TSButton 7 can be downloaded from http://fivewin-contributions.googlecode.com/files/TSButton7.rar
User avatar
concentra
 
Posts: 110
Joined: Mon Nov 14, 2005 10:15 am
Location: Brazil

Re: Compiling TSButton with MinGW gcc

Postby concentra » Wed Oct 19, 2011 9:56 am

Antonio, could you review this, please ?
I am not very good with C.
Thanks.
User avatar
concentra
 
Posts: 110
Joined: Mon Nov 14, 2005 10:15 am
Location: Brazil

Re: Compiling TSButton with MinGW gcc

Postby Rimantas » Wed Nov 02, 2011 4:34 pm

I'm joining to this question too . I too get an errors trying to build TsButtons lib with harbour + minGw . Can any to help ? Just idea - maybe Manuel Mercado have a forum , where we can post question to him ?

With best regards !
Rimantas U.
User avatar
Rimantas
 
Posts: 437
Joined: Fri Oct 07, 2005 12:56 pm
Location: Utena , Lithuania

Re: Compiling TSButton with MinGW gcc

Postby nnicanor » Wed Nov 02, 2011 9:27 pm

Change clipapi.ch by hbapi.ch and try againg.

Regards
Nicanor Martinez M.
Auditoria y Sistemas Ltda.
MicroExpress Ltda.
FW + FWH + XHARBOUR + HARBOUR + PELLES C + XDEVSTUDIO + XEDIT + BCC + VC_X86 + VCC_X64 + MINGW + R&R Reports + FastReport + Tdolphin + ADO + MYSQL + MARIADB + ORACLE
nnicanor@yahoo.com
nnicanor
 
Posts: 295
Joined: Fri Apr 23, 2010 4:30 am
Location: Colombia

Re: Compiling TSButton with MinGW gcc

Postby nnicanor » Wed Nov 02, 2011 9:29 pm

use this example change paths for your include paths

c:\mingw\bin\gcc -c -D__FLAT__ -D__HARBOUR__ -Ic:\mingw\include -Ic:\harbourg\include -Ic:\fwhg\include -obpaint.o bpaint.c

Rgds
Nicanor Martinez M.
Auditoria y Sistemas Ltda.
MicroExpress Ltda.
FW + FWH + XHARBOUR + HARBOUR + PELLES C + XDEVSTUDIO + XEDIT + BCC + VC_X86 + VCC_X64 + MINGW + R&R Reports + FastReport + Tdolphin + ADO + MYSQL + MARIADB + ORACLE
nnicanor@yahoo.com
nnicanor
 
Posts: 295
Joined: Fri Apr 23, 2010 4:30 am
Location: Colombia

Re: Compiling TSButton with MinGW gcc

Postby concentra » Thu Nov 03, 2011 9:51 am

Hi Nicanor, thanks for your help.
I discarded TSButton as an option and replaced it with standard buttons, since I got no help with this...
But I still need help with TSBrowse !
You said to change clipapi.ch by hbapi.ch but in this case, the code is was already with hbapi.ch.
And when compiled, I get the following errors:
Code: Select all  Expand view

hbmk2: Compiling C++...
../../TSBrowse/TSBFUNCS.C: In function 'void HB_FUN_REGISTER_CLASS()':
../../TSBrowse/TSBFUNCS.C:76:22: error: 'ISNIL' was not declared in this scope
../../TSBrowse/TSBFUNCS.C: In function 'void HB_FUN__CREATEWINDOWEX()':
../../TSBrowse/TSBFUNCS.C:97:26: error: 'ISNIL' was not declared in this scope
../../TSBrowse/TSBFUNCS.C: In function 'void MaskRegion(HDC__*, RECT*, COLORREF, COLORREF)':
../../TSBrowse/TSBFUNCS.C:133:49: error: invalid conversion from 'void*' to 'HBITMAP__*'
../../TSBrowse/TSBFUNCS.C:134:46: error: invalid conversion from 'void*' to 'HBITMAP__*'
../../TSBrowse/TSBFUNCS.C:135:49: error: invalid conversion from 'void*' to 'HBITMAP__*'
../../TSBrowse/TSBFUNCS.C:136:55: error: invalid conversion from 'void*' to 'HBITMAP__*'
../../TSBrowse/TSBFUNCS.C:138:42: error: invalid conversion from 'void*' to 'HBRUSH__*'
../../TSBrowse/TSBFUNCS.C: In function 'void DrawMasked(HDC__*, HBITMAP__*, WORD, WORD)':
../../TSBrowse/TSBFUNCS.C:192:70: error: invalid conversion from 'void*' to 'HBITMAP__*'
../../TSBrowse/TSBFUNCS.C:201:50: error: invalid conversion from 'void*' to 'HBITMAP__*'
../../TSBrowse/TSBFUNCS.C: In function 'void HB_FUN_TSDRAWCELL()':
../../TSBrowse/TSBFUNCS.C:255:32: error: 'ISNIL' was not declared in this scope
../../TSBrowse/TSBFUNCS.C:297:43: error: invalid conversion from 'void*' to 'HFONT__*'
../../TSBrowse/TSBFUNCS.C: In function 'void WndBoxDraw(HDC__*, RECT*, HPEN__*, HPEN__*, int, BOOL)':
../../TSBrowse/TSBFUNCS.C:565:48: error: invalid conversion from 'void*' to 'HPEN__*'
../../TSBrowse/TSBFUNCS.C: In function 'void HB_FUN_TSBRWSCROLL()':
../../TSBrowse/TSBFUNCS.C:637:43: error: invalid conversion from 'void*' to 'HFONT__*'
../../TSBrowse/TSBFUNCS.C: In function 'void HB_FUN_SBGETHEIGHT()':
../../TSBrowse/TSBFUNCS.C:735:46: error: invalid conversion from 'void*' to 'HFONT__*'
../../TSBrowse/TSBFUNCS.C: In function 'void DrawCheck(HDC__*, tagRECT*, HPEN__*, int, BOOL)':
../../TSBrowse/TSBFUNCS.C:813:46: error: invalid conversion from 'void*' to 'HBRUSH__*'
../../TSBrowse/TSBFUNCS.C:832:43: error: invalid conversion from 'void*' to 'HPEN__*'
../../TSBrowse/TSBFUNCS.C: In function 'void DegradColor(HDC__*, RECT*, COLORREF, COLORREF)':
../../TSBrowse/TSBFUNCS.C:941:42: error: invalid conversion from 'void*' to 'HBRUSH__*'
hbmk2: Erro: Executando compilador C/C++. 1
 


Is it possible to send us a light in this ?
And I think it may also help with TSButton question.
The full TSBFUNCS.C is:

Code: Select all  Expand view

/***************************************************************
This file contains the special painting routines used by TSBrowse Class
Last update: 22/02/2006
***************************************************************/

#define _WIN32_IE 0x0500
#define HB_OS_WIN_USED
#define _WIN32_WINNT 0x0400
#include <shlobj.h>

#include <windows.h>
#include <commctrl.h>

#include "hbapi.h"
#include "hbvm.h"

#ifdef __XHARBOUR__
#define HB_STORNI( n, x, y ) hb_storni( n, x, y )
#else
#define HB_STORNI( n, x, y ) hb_storvni( n, x, y )
#endif

void WndBoxDraw( HDC, LPRECT, HPEN, HPEN, int, BOOL );
void           cDrawCursor( HWND, LPRECT, long, COLORREF );
void           DrawCheck( HDC, LPRECT, HPEN, int, BOOL );
static void    GoToPoint( HDC, int, int );
static void    DegradColor( HDC, RECT *, COLORREF, COLORREF );

LRESULT CALLBACK WndProcBrw( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam )
{
   static PHB_SYMB   pSymbol = NULL;
   long int          r;

   if( !pSymbol )
   {
      pSymbol = hb_dynsymSymbol( hb_dynsymGet("EVENTS") );
   }

   if( pSymbol )
   {
      hb_vmPushSymbol( pSymbol );
      hb_vmPushNil();
      hb_vmPushLong( (LONG) hWnd );
      hb_vmPushLong( message );
      hb_vmPushLong( wParam );
      hb_vmPushLong( lParam );
      hb_vmDo( 4 );
   }

   r = hb_parnl( -1 );

   if( r != 0 )
   {
      return r;
   }
   else
   {
      return( DefWindowProc(hWnd, message, wParam, lParam) );
   }
}

HB_FUNC( REGISTER_CLASS )
{
   WNDCLASS WndClass;

   HBRUSH   hbrush;  //=  (HBRUSH)( COLOR_BTNFACE + 1 ) ;

   //  WndClass.style         = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS  ;

   WndClass.style = CS_DBLCLKS;
   WndClass.lpfnWndProc = WndProcBrw;
   WndClass.cbClsExtra = 0;
   WndClass.cbWndExtra = 0;
   WndClass.hInstance = GetModuleHandle( NULL );
   WndClass.hIcon = 0;
   WndClass.hCursor = LoadCursor( NULL, IDC_ARROW );
   hbrush = ( ISNIL(2) ? 0 : (HBRUSH) hb_parnl(2) );
   WndClass.hbrBackground = hbrush;
   WndClass.lpszMenuName = NULL;
   WndClass.lpszClassName = hb_parc( 1 );

   if( !RegisterClass(&WndClass) )
   {
      MessageBox( 0, "Window Registration Failed!", "Error!", MB_ICONEXCLAMATION | MB_OK | MB_SYSTEMMODAL );
      ExitProcess( 0 );
   }

   hb_retnl( (LONG) hbrush );
}

HB_FUNC( _CREATEWINDOWEX )
{
   HWND     hWnd;
   DWORD    dwExStyle = hb_parnl( 1 );
   LPCSTR   cClass = ( LPCSTR ) hb_parc( 2 );
   LPCSTR   cTitle = ( LPCSTR ) hb_parc( 3 );
   int      nStyle = hb_parni( 4 );
   int      x = ( ISNIL(5) ? CW_USEDEFAULT : hb_parni(5) );
   int      y = ( ISNIL(6) ? CW_USEDEFAULT : hb_parni(6) );
   int      nWidth = ( ISNIL(7) ? CW_USEDEFAULT : hb_parni(7) );
   int      nHeight = ( ISNIL(8) ? CW_USEDEFAULT : hb_parni(8) );
   HWND     hWndParent = ( HWND ) hb_parnl( 9 );
   HMENU    hMenu = ( HMENU ) NULL;
   HANDLE   hInstance = GetModuleHandle( NULL );

   hWnd = CreateWindowEx( dwExStyle, cClass, cTitle, nStyle, x, y, nWidth, nHeight, hWndParent, hMenu, (HINSTANCE) hInstance, NULL );

   hb_retnl( (LONG) hWnd );
}

void MaskRegion( HDC hdc, RECT *rct, COLORREF cTransparentColor, COLORREF cBackgroundColor )
{
   HDC      hdcTemp, hdcObject, hdcBack, hdcMem;
   POINT    ptSize;
   COLORREF cColor;
   HBITMAP  bmAndObject, bmAndBack, bmBackOld, bmObjectOld, bmAndTemp, bmTempOld, bmAndMem, bmMemOld;
   HBRUSH   hBrush, hBrOld;

   ptSize.x = rct->right - rct->left + 1;
   ptSize.y = rct->bottom - rct->top + 1;

   hBrush = CreateSolidBrush( cBackgroundColor );

   hdcTemp = CreateCompatibleDC( hdc );
   hdcObject = CreateCompatibleDC( hdc );
   hdcBack = CreateCompatibleDC( hdc );
   hdcMem = CreateCompatibleDC( hdc );

   bmAndTemp = CreateCompatibleBitmap( hdc, ptSize.x, ptSize.y );
   bmAndMem = CreateCompatibleBitmap( hdc, ptSize.x, ptSize.y );
   bmAndObject = CreateBitmap( ptSize.x, ptSize.y, 1, 1, NULL );
   bmAndBack = CreateBitmap( ptSize.x, ptSize.y, 1, 1, NULL );

   bmTempOld = SelectObject( hdcTemp, bmAndTemp );
   bmMemOld = SelectObject( hdcMem, bmAndMem );
   bmBackOld = SelectObject( hdcBack, bmAndBack );
   bmObjectOld = SelectObject( hdcObject, bmAndObject );

   hBrOld = SelectObject( hdcMem, hBrush );

   BitBlt( hdcTemp, 0, 0, ptSize.x, ptSize.y, hdc, rct->left, rct->top, SRCCOPY );

   SetMapMode( hdcTemp, GetMapMode(hdc) );

   cColor = SetBkColor( hdcTemp, cTransparentColor );

   BitBlt( hdcObject, 0, 0, ptSize.x, ptSize.y, hdcTemp, 0, 0, SRCCOPY );

   SetBkColor( hdcTemp, cColor );

   BitBlt( hdcBack, 0, 0, ptSize.x, ptSize.y, hdcObject, 0, 0, NOTSRCCOPY );
   PatBlt( hdcMem, 0, 0, ptSize.x, ptSize.y, PATCOPY );
   BitBlt( hdcMem, 0, 0, ptSize.x, ptSize.y, hdcObject, 0, 0, SRCAND );
   BitBlt( hdcTemp, 0, 0, ptSize.x, ptSize.y, hdcBack, 0, 0, SRCAND );
   BitBlt( hdcMem, 0, 0, ptSize.x, ptSize.y, hdcTemp, 0, 0, SRCPAINT );
   BitBlt( hdc, rct->left, rct->top, ptSize.x, ptSize.y, hdcMem, 0, 0, SRCCOPY );

   DeleteObject( SelectObject(hdcMem, hBrOld) );
   DeleteObject( SelectObject(hdcTemp, bmTempOld) );
   DeleteObject( SelectObject(hdcMem, bmMemOld) );
   DeleteObject( SelectObject(hdcBack, bmBackOld) );
   DeleteObject( SelectObject(hdcObject, bmObjectOld) );
   DeleteDC( hdcMem );
   DeleteDC( hdcBack );
   DeleteDC( hdcObject );
   DeleteDC( hdcTemp );
}

void DrawBitmap( HDC hDC, HBITMAP hBitmap, WORD wRow, WORD wCol, WORD wWidth, WORD wHeight, DWORD dwRaster )
{
   HDC      hDCmem = CreateCompatibleDC( hDC );
   BITMAP   bitmap;
   dwRaster = SRCCOPY;

   SelectObject( hDCmem, hBitmap );
   GetObject( hBitmap, sizeof(BITMAP), (LPVOID) & bitmap );
   if( wWidth && (wWidth != bitmap.bmWidth || wHeight != bitmap.bmHeight) )
   {
      StretchBlt( hDC, wCol, wRow, wWidth, wHeight, hDCmem, 0, 0, bitmap.bmWidth, bitmap.bmHeight, dwRaster );
   }
   else
   {
      BitBlt( hDC, wCol, wRow, bitmap.bmWidth, bitmap.bmHeight, hDCmem, 0, 0, dwRaster );
   }

   DeleteDC( hDCmem );
}

void DrawMasked( HDC hDC, HBITMAP hbm, WORD wRow, WORD wCol )
{
   HDC      hDcBmp = CreateCompatibleDC( hDC );
   HDC      hDcMask;
   HBITMAP  hBmpMask, hOldBmp2, hOldBmp1 = SelectObject( hDcBmp, hbm );
   BITMAP   bm;
   COLORREF rgbBack;

   if( GetPixel(hDcBmp, 0, 0) != GetSysColor(15) )
   {
      GetObject( hbm, sizeof(BITMAP), (LPSTR) & bm );
      hDcMask = CreateCompatibleDC( hDC );
      hBmpMask = CreateCompatibleBitmap( hDcMask, bm.bmWidth, bm.bmHeight );
      hOldBmp2 = SelectObject( hDcMask, hBmpMask );
      rgbBack = SetBkColor( hDcBmp, GetPixel(hDcBmp, 0, 0) );
      BitBlt( hDcMask, wRow, wCol, bm.bmWidth, bm.bmHeight, hDcBmp, 0, 0, SRCCOPY );
      SetBkColor( hDcBmp, rgbBack );

      BitBlt( hDC, wRow, wCol, bm.bmWidth, bm.bmHeight, hDcBmp, 0, 0, SRCINVERT );
      BitBlt( hDC, wRow, wCol, bm.bmWidth, bm.bmHeight, hDcMask, 0, 0, SRCAND );
      BitBlt( hDC, wRow, wCol, bm.bmWidth, bm.bmHeight, hDcBmp, 0, 0, SRCINVERT );

      //

      BitBlt( hDcBmp, 0, 0, bm.bmWidth, bm.bmHeight, hDC, wRow, wCol, SRCCOPY );

      //

      SelectObject( hDcMask, hOldBmp2 );
      DeleteObject( hBmpMask );
      DeleteDC( hDcMask );
   }

   SelectObject( hDcBmp, hOldBmp1 );
   DeleteDC( hDcBmp );
}

HB_FUNC( TSDRAWCELL )
{
   HWND     hWnd = ( HWND ) hb_parni( 1 );
   HDC      hDC = ( HDC ) hb_parnl( 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 );
   int      nHeightSpec = hb_parni( 20 );
   BOOL     bAdjBmp = hb_parl( 21 );
   BOOL     bMultiLine = hb_parl( 22 );
   int      nVAlign = hb_parni( 23 );
   int      nVertText = hb_parni( 24 );
   COLORREF clrTo = hb_parnl( 25 );
   BOOL     bOpaque = hb_parl( 26 );
   HBRUSH   wBrush = ( HBRUSH ) hb_parnl( 27 );
   BOOL     b3DInv = ( ISNIL(28) ? FALSE : !hb_parl(28) );
   BOOL     b3D = ( ISNIL(28) ? FALSE : TRUE );
   COLORREF nClr3DL = hb_parnl( 29 );
   COLORREF nClr3DS = hb_parnl( 30 );
   long     lCursor = hb_parnl( 31 );

   int      ixLayOut = HIWORD( nAlign );
   int      iAlign = LOWORD( nAlign );

   //   int iTxtW        = 0; //LOWORD( GetTextExtentPoint( hDC, cData, nLen,0 ) ) ;

   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     bSpecHd = ( nHeadFoot  == 4 ? TRUE : FALSE );        //New SH
   BOOL     bChecked = ( nVertText == 3 ? TRUE : FALSE );
   BOOL     bBrush = FALSE;   //( wBrush > 0 ? TRUE : FALSE ) ;
   BOOL     bDegrad = ( clrTo == clrBack ? FALSE : TRUE );
   HFONT    hOldFont = 0;
   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;
   SIZE     size;
   int      iTxtW = 0;
   if( GetTextExtentPoint32(hDC, cData, nLen, &size) )
   {
      iTxtW = size.cx;
   }

   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 )
   {
      if (  bSpecHd )
      {
         rct.top = ( nHeightHead + nHeightSuper - (nHeightSuper ? 1 : 0) );
      }
      else
      {
         rct.top = ( bHeader ? nHeightSuper - (nHeightSuper ? 1 : 0) : 0 );
      }
   }
   else
   {
     rct.top = ( bFooter ? rct.bottom - nHeightFoot + 1 : nHeightHead + nHeightSuper - (nHeightSuper ? 1 : 0) + nHeightSpec + (nHeightCell * (nRow - 1)) );
   }

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

   /* 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 + 2 );
                  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 > 0 )
      {
         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 += 8;
         }

         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 );
               DrawText( hDC, cData, nLen, &rct, iFlags );

               rct.top += 2;
               rct.left += 2;
               rct.bottom += 2;
               rct.right += 2;

               SetTextColor( hDC, b3DInv ? nClr3DL : nClr3DS );
               DrawText( hDC, cData, nLen, &rct, iFlags );

               rct.top -= 1;
               rct.left -= 1;
               rct.bottom -= 1;
               rct.right -= 1;

               SetTextColor( hDC, clrFore );
            }

            DrawText( hDC, cData, nLen, &rct, iFlags );
            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 -= 8;
         }
      }

      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 > 0 )
         {
            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 > 0 )
         {
            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 );
}

HARBOUR HB_FUN_TSBRWSCROLL()
{
   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 );
   int   nHeightSpecHd = hb_parni( 8 );

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

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

   GetClientRect( hWnd, &rct );

   rct.top += ( nHeightHead + nHeightSuper - (nHeightSuper ? 1 : 0)+ nHeightSpecHd - (nHeightSpecHd ? 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 );
}

HARBOUR HB_FUN_TSBRWHSCROLL()
{
   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 );
}

HARBOUR HB_FUN_ROWFROMPIX()
{
   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 );
   int   iSpcH = hb_parni( 7 );

   RECT  rct;
   int   iRow;

   GetClientRect( hWnd, &rct );

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

   hb_retni( iRow );
}

HARBOUR HB_FUN_SBGETHEIGHT()  //SBGetHeigh( hWnd, hFont, nTotal )
{
   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 );
   }
}

HARBOUR HB_FUN_COUNTROWS()    // ( hWnd, nHeightCell, nHeightHead,

//   nHeightFoot, nHeightSuper, nHeightSpec ) -> nRows

{
   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 );
   int   iSpcH = hb_parni( 6 );

   RECT  rct;
   int   iRows, iFree;

   GetClientRect( hWnd, &rct );

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

   hb_retni( iRows );
}

HARBOUR HB_FUN_SBMPHEIGHT()   // ( hBmp )
{
   HBITMAP  hBmp = ( HBITMAP ) hb_parni( 1 );
   BITMAP   bm;

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

   hb_retni( bm.bmHeight );
}

HARBOUR HB_FUN_SBMPWIDTH()
{
   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;

   MoveToEx( hDC, ix, iy, &pt );
}

static void DegradColor( HDC hDC, RECT *rori, COLORREF cFrom, COLORREF cTo )
{
   int         clr1r, clr1g, clr1b, clr2r, clr2g, clr2b;
   signed int  iEle, iRed, iGreen, iBlue;
   int         iTot = ( rori->bottom + 2 - rori->top );
   BOOL        bDir;
   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 );

   clr2r = GetRValue( cTo );
   clr2g = GetGValue( cTo );
   clr2b = GetBValue( cTo );

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

   iRed = ( iRed < 0 ? 0 : (iRed / iTot) );
   iGreen = ( iGreen < 0 ? 0 : (iGreen / iTot) );
   iBlue = ( iBlue < 0 ? 0 : (iBlue / iTot) );

   rct.bottom = rct.top + 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 );

      rct.top++;
      rct.bottom++;
   }

   SelectObject( hDC, hOldBrush );
   DeleteObject( hBrush );
}

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 );
   }
}

HARBOUR HB_FUN_GETSCRLRANGE() // ( hWnd, nFlags )
{
   int   iMin = 0, iMax = 0;

   GetScrollRange( (HWND) hb_parnl(1), // its hWnd
   hb_parni(2), // Scroll bar flags
   &iMin, &iMax );

   hb_reta( 2 );  // { nMin, nMax }
   HB_STORNI( iMin, -1, 1 );
   HB_STORNI( iMax, -1, 2 );
}

HARBOUR HB_FUN_GETSCRLPOS()   // ( hWnd, nFlags )
{
   hb_retni( GetScrollPos((HWND) hb_parnl(1), // its hWnd
   hb_parni(2)) );  // Scroll bar flags
}

HARBOUR HB_FUN_INITEDSPINNER()
{
   HWND                 hwnd;
   HWND                 hedit;
   HWND                 hupdown;
   int                  Style = WS_CHILD | UDS_ARROWKEYS | UDS_ALIGNRIGHT | UDS_SETBUDDYINT | UDS_NOTHOUSANDS |WS_VISIBLE |UDS_HOTTRACK  ;//| UDS_AUTOBUDDY ;

   INITCOMMONCONTROLSEX i;

   i.dwSize = sizeof( INITCOMMONCONTROLSEX );
   InitCommonControlsEx( &i );

   hwnd = ( HWND ) hb_parnl( 1 );
   hedit = ( HWND ) hb_parnl( 2 );

    hupdown = CreateUpDownControl( Style,hb_parni(3),hb_parni(4),15,hb_parni(6),hwnd, 777,GetModuleHandle(NULL),
             hedit,hb_parni(8),hb_parni(7),0);
   SendMessage( hupdown, UDM_SETRANGE32, (WPARAM) hb_parni(7), (LPARAM) hb_parni(8) );

   hb_retnl( (LONG) hupdown );
}

HARBOUR HB_FUN_SETINCREMENTSPINNER()
{

   UDACCEL  inc;
   SendMessage( (HWND) hb_parnl(1), UDM_GETACCEL, (WPARAM) 1, (LPARAM) & inc );
   inc.nInc = hb_parnl( 2 );
   SendMessage( (HWND) hb_parnl(1), UDM_SETACCEL, (WPARAM) 1, (LPARAM) & inc );

}

 


Thanks in advance.
User avatar
concentra
 
Posts: 110
Joined: Mon Nov 14, 2005 10:15 am
Location: Brazil

Re: Compiling TSButton with MinGW gcc

Postby nnicanor » Thu Nov 03, 2011 1:54 pm

Ok,

I going to compile tsbrowse and feedback in asap

Regards,
Nicanor Martinez M.
Auditoria y Sistemas Ltda.
MicroExpress Ltda.
FW + FWH + XHARBOUR + HARBOUR + PELLES C + XDEVSTUDIO + XEDIT + BCC + VC_X86 + VCC_X64 + MINGW + R&R Reports + FastReport + Tdolphin + ADO + MYSQL + MARIADB + ORACLE
nnicanor@yahoo.com
nnicanor
 
Posts: 295
Joined: Fri Apr 23, 2010 4:30 am
Location: Colombia

Re: Compiling TSButton with MinGW gcc

Postby concentra » Fri Nov 04, 2011 9:17 am

Thanks.
User avatar
concentra
 
Posts: 110
Joined: Mon Nov 14, 2005 10:15 am
Location: Brazil

Re: Compiling TSButton with MinGW gcc

Postby Rimantas » Wed Nov 09, 2011 6:37 am

Hi,

Need help with TsButtons & MinGW . Creating of library - succesfull , but trying to build application with tsbutton library I'm getting errors . Sbuh3m.a here Tsbutton lib for MinGw

hbmk2: Linking... Ts.exe
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x9040): multiple definition of `HB_FUN_LIGHTCOLOR'
C:/Fwh/lib/fivehgc.lib(COLORTON.o):COLORTON.C:(.text+0x341): first defined here
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x10bb): undefined reference to `_parni'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x10c9): undefined reference to `_parl'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x10ec): undefined reference to `_parl'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x10fc): undefined reference to `_parnl'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x110a): undefined reference to `_parni'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x1118): undefined reference to `_parni'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x1168): undefined reference to `_parl'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x1178): undefined reference to `_parnl'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x1186): undefined reference to `_parni'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x1194): undefined reference to `_parni'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x11cf): undefined reference to `_parni'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x11df): undefined reference to `_parni'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x11ed): undefined reference to `_parni'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x11fd): more undefined references to `_parni' follow
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x121d): undefined reference to `_parnl'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x2c42): undefined reference to `_parni'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x2c50): undefined reference to `_parni'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x2c5e): undefined reference to `_parni'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x2c6c): undefined reference to `_parc'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x2c7c): undefined reference to `_parni'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x2c8a): undefined reference to `_parl'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x2c9a): undefined reference to `_parnl'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x2caa): undefined reference to `_parnl'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x2cbd): undefined reference to `_parnl'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x2cd0): undefined reference to `_parnl'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x2ce3): undefined reference to `_parl'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x2cf3): undefined reference to `ISLOGICAL'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x2d0d): undefined reference to `ISLOGICAL'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x2d20): undefined reference to `ISLOGICAL'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x2d3a): undefined reference to `_parni'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x2d4a): undefined reference to `_parl'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x2d5d): undefined reference to `_parl'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x2d70): undefined reference to `_parni'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x2d80): undefined reference to `_parni'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x2d93): undefined reference to `_parni'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x30af): undefined reference to `_parclen'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x33f8): undefined reference to `_parl'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x340d): undefined reference to `_parl'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x3e60): undefined reference to `_parni'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x3e6e): undefined reference to `_parnl'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x3f2d): undefined reference to `_parni'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x3f3b): undefined reference to `_parni'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x3f7a): undefined reference to `_retni'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x3fab): undefined reference to `_parni'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x3fb9): undefined reference to `_parni'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x3fc7): undefined reference to `_parni'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x3fd5): undefined reference to `_parni'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x3fe3): undefined reference to `_parni'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x4033): undefined reference to `_parnl'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x4041): undefined reference to `_parnl'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x404f): undefined reference to `_parnl'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x405f): undefined reference to `_parnl'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x406f): undefined reference to `_parni'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x437a): undefined reference to `_parclen'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x4e9f): undefined reference to `_parni'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x4eaf): undefined reference to `_parni'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x4ebf): undefined reference to `_parni'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x4ecf): undefined reference to `_parc'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x4edf): undefined reference to `_parni'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x4eef): undefined reference to `ISNUM'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x4f09): undefined reference to `ISNUM'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x4f1d): undefined reference to `_parnl'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x4f2b): undefined reference to `ISNUM'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x4f3f): undefined reference to `_parnl'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x4f4d): undefined reference to `ISNUM'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x4f61): undefined reference to `_parnl'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x4f73): undefined reference to `ISCHAR'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x4f83): undefined reference to `_parclen'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x5138): undefined reference to `_parni'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x51f2): undefined reference to `_parnl'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x5200): undefined reference to `_parnl'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x5213): undefined reference to `_parl'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x5223): undefined reference to `_parnl'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x5233): undefined reference to `_parc'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x5246): undefined reference to `_parni'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x5256): undefined reference to `_parnl'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x5269): undefined reference to `_parnl'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x5277): undefined reference to `_parl'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x528a): undefined reference to `_parl'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x529a): undefined reference to `_parni'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x52aa): undefined reference to `_parni'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x52b8): undefined reference to `_parni'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x52c8): undefined reference to `_parl'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x52db): undefined reference to `_parl'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x52eb): undefined reference to `_parl'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x52fe): undefined reference to `_parl'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x530e): undefined reference to `_parni'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x531e): undefined reference to `_parni'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x5331): undefined reference to `_parnl'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x5341): undefined reference to `_parni'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x5351): undefined reference to `_parnl'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x5364): undefined reference to `_parl'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x5377): undefined reference to `ISLOGICAL'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x5394): undefined reference to `ISLOGICAL'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x53af): undefined reference to `ISNUM'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x53c3): undefined reference to `_parnl'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x53d6): undefined reference to `ISNUM'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x53ea): undefined reference to `_parnl'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x53fd): undefined reference to `_parni'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x5410): undefined reference to `_parni'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x5423): undefined reference to `_parl'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x5436): undefined reference to `_parni'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x5449): undefined reference to `_parnl'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x545c): undefined reference to `_parl'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x546c): undefined reference to `ISNUM'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x5486): undefined reference to `_parni'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x5499): undefined reference to `ISNUM'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x5798): undefined reference to `_parl'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x57f8): undefined reference to `_parni'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x8dde): undefined reference to `_parni'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x8df0): undefined reference to `_parni'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x8e04): undefined reference to `_parni'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x8e1b): undefined reference to `_parni'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x8e32): more undefined references to `_parni' follow
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x8fa9): undefined reference to `_parnl'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x8fb9): undefined reference to `_parnl'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x8fc7): undefined reference to `ISNUM'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x8fdc): undefined reference to `_parni'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x9060): undefined reference to `_parnl'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x906e): undefined reference to `_parnl'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x913f): undefined reference to `_parnl'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x914d): undefined reference to `_parnl'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x915b): undefined reference to `_parnl'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x916b): more undefined references to `_parnl' follow
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x917b): undefined reference to `_parni'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x918b): undefined reference to `_parni'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x9199): undefined reference to `_parni'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x3eec): undefined reference to `_retnl'
ffmpeg/lib/Sbuh3m.a(bpaint.o):bpaint.c:(.text+0x9128): undefined reference to `_retnl'
collect2: ld returned 1 exit status
hbmk2: Error: Running linker. 1
gcc.exe .hbmk/win/mingw/Koni.o .hbmk/win/mingw/_hbmkaut_Koni.o .hbmk/win/mingw/Koni.reso -mconsole -Wl,--start-group -lcomctl32 -lcomdlg32 -lgdi32 -lhbcplr -lhbct -lhbmzip -lhbpcre -lhbsqlit3 -lhbtip -lhbwin -lhbzlib -lmsimg32 -lodbc32 -lole32 -loleaut32 -luser32 -luuid -lvfw32 -lwinmm -lwinspool -lwsock32 -lgtgui -lkernel32 -lpsapi -lwin32k -loledlg -lstdc++ -lmfcuia32 -lversion -lhbcommon -lhbcpage -lhbhsx -lhblang -lhbmacro -lhbmainstd -lhbpp -lhbrdd -lhbsix -lhbusrrdd -lhbvm -lrddcdx -lrddfpt -lrddntx -lxhb -lfivehg -lfivehgc -lhbextern -lhbdebug -lhbvm -lhbrtl -lhblang -lhbcpage -lgtcgi -lgtpca -lgtstd -lgtwin -lgtwvt -lgtgui -lhbrdd -lhbuddall -lhbusrrdd -lrddntx -lrddcdx -lrddnsx -lrddfpt -lhbrdd -lhbhsx -lhbsix -lhbmacro -lhbcplr -lhbpp -lhbcommon -lhbmainstd -lkernel32 -luser32 -lgdi32 -ladvapi32 -lws2_32 -lwinspool -lcomctl32 -lcomdlg32 -lshell32 -luuid -lole32 -loleaut32 -lmpr -lwinmm -lmapi32 -limm32 -lmsimg32 -lwininet -lhbpcre -lhbzlib ffmpeg/lib/Sbuh3m.a ffmpeg/lib/libavcodec.dll.a ffmpeg/lib/libavformat.dll.a ffmpeg/lib/libavutil.dll.a -Wl,--end-group -oTs.exe -Lc:/hrb/lib/win/mingw -Lc:/hrb/bin -LC:/Fwh/lib


hbp for lib :
-n
-omylib
-hblib
-inc
-incpath=include\
-incpath=..\include\
-l..\lib\fivehg
-l..\lib\fivehgc

classes\TSBAR.PRG
classes\TSBUTTON.PRG
classes\TSGradie.PRG
classes\TSLINES.PRG
classes\TSRADIO.PRG
classes\TSTSAY.PRG
function\RGB2HSL.PRG
function\bpaint.c


What I must to do to avoid errors ?

Many thanks in advance !
Rimantas U.
User avatar
Rimantas
 
Posts: 437
Joined: Fri Oct 07, 2005 12:56 pm
Location: Utena , Lithuania

Re: Compiling TSButton with MinGW gcc

Postby concentra » Wed Nov 09, 2011 10:25 am

Rimantas, seems that nobody else is interested in TsBrowse/TsButton and MinGW...
And Manuel disappears from time to time...

But after studying the C code I managed to compile the TsBrowse C code.
So, lets try to do this.
First in bpaint.c change all references of
_parclen, _parl, _parni, _parnl, etc.
to
hb_parclen, hb_parl, hb_parni, hb_parnl, hb_etc.
And do the same with _retnl.

Seems that this changed in Harbour some time ago.
I will see the other issues and will post here ASAP.

[[]] Mauricio Ventura Faria
User avatar
concentra
 
Posts: 110
Joined: Mon Nov 14, 2005 10:15 am
Location: Brazil

Re: Compiling TSButton with MinGW gcc

Postby concentra » Wed Nov 09, 2011 10:26 am

Rimantas, what version of TsButton are you using ?
User avatar
concentra
 
Posts: 110
Joined: Mon Nov 14, 2005 10:15 am
Location: Brazil

Re: Compiling TSButton with MinGW gcc

Postby concentra » Wed Nov 09, 2011 11:08 am

And for ISLOGICAL, ISNUM and ISCHAR put this defines in top of .C.

#define S_LNUM 0x0002
#define S_DNUM 0x0008
#define S_LOG 0x0080
#define S_CHAR 0x0400
#define S_ANYNUM ( S_LNUM | S_DNUM )

#define ISCHAR( s ) ( hb_param( s, S_CHAR ) != NULL )
#define ISNUM( s ) ( hb_param( s, S_ANYNUM ) != NULL )
#define ISLOGICAL( s ) ( hb_param( s, S_LOG ) != NULL )

[[]]
User avatar
concentra
 
Posts: 110
Joined: Mon Nov 14, 2005 10:15 am
Location: Brazil

Re: Compiling TSButton with MinGW gcc

Postby Rimantas » Wed Nov 09, 2011 1:48 pm

concentra wrote:And for ISLOGICAL, ISNUM and ISCHAR put this defines in top of .C.

#define S_LNUM 0x0002
#define S_DNUM 0x0008
#define S_LOG 0x0080
#define S_CHAR 0x0400
#define S_ANYNUM ( S_LNUM | S_DNUM )

#define ISCHAR( s ) ( hb_param( s, S_CHAR ) != NULL )
#define ISNUM( s ) ( hb_param( s, S_ANYNUM ) != NULL )
#define ISLOGICAL( s ) ( hb_param( s, S_LOG ) != NULL )

[[]]


Wowww ! :-)

Thanks concentra for your support ! It seems that together we will do something good ! :-)) I'm using the latest TsButton 7 version . Sorry , but with TsBrowse I'm not working , with xBrowse only . But buttons are needfulls fronm TsButtons . So if I'll know something usefull I'll let you know here .. :)

With best regards !
Rimantas U.
User avatar
Rimantas
 
Posts: 437
Joined: Fri Oct 07, 2005 12:56 pm
Location: Utena , Lithuania


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 90 guests