//---------------------------------------------------------------------------// CLIPPER WBRWSET() // ( lAdjLastCol, lAdjBrowse, lDrawHeaders, lDrawFooters ) { // CeSoTech bAdjLastCol = _parl( 1 ) ; // Ajuste o no de ultima columna al control. bAdjBrowse = _parl( 2 ) ; // Ajuste del Browse a la derecha // cuando no existe ajuste de ultima columna. bDrawHeaders = _parl( 3 ) ; // Si quiere visualizar Headers !!! bDrawFooters = _parl( 4 ) ; // Si se quiere visualizar Footers !!! wHeaderHeight= _parni( 5 ) ; wFooterHeight= _parni( 6 ) ; wLineHeight = _parni( 7 ) ; }
CLIPPER FILEOPEN() { BYTEP fpFileName; FHANDLE hFile = FS_ERROR; USHORT uiFlags = FO_READWRITE; ERRORP pError; if ( ISCHAR( 1 ) ) { fpFileName = _parc( 1 ); uiFlags |= ( ISLOG( 2 ) && _parl( 2 ) ) ? FO_SHARED : FO_EXCLUSIVE; pError = _errNew(); _errPutSubCode( pError, 1111 ); // subCode determined by caller hFile = FileOpener( fpFileName, uiFlags, pError ); if ( ISBYREF( 1 ) ) _storc( fpFileName, 1 ); } _retni( hFile ); }
CLIPPER _SetGEof() { if ( ISLOG( 1 ) ) { (*_WorkAreas)->fEof = _parl( 1 ); (*_WorkAreas)->fFound = FALSE; } _retl( (*_WorkAreas)->fEof ); }
CLIPPER WBRWSELBOX( PARAMS ) // ( hWnd, hDC, nRow, nFirstCol, nCurCol,; // lFocus, aSizes, hFont) #endif { HWND hWnd = (HWND) _parnl( 1 ); HDC hDC = (HDC) _parnl( 2 ); WORD wRow = _parni( 3 ); WORD wIndex = _parni( 4 ); WORD wCol = _parni( 5 ); BOOL bFocused = _parl( 6 ); PCLIPVAR pAsizes = _param( 7, -1 ); HFONT hFont = (HFONT) _parnl( 8 ); BOOL bDestroyDC = FALSE; TEXTMETRIC tm; RECT rct; HFONT hOldFont; if( ! hDC ) { bDestroyDC = TRUE; hDC = GetDC( hWnd ); } if( hFont ) hOldFont = SelectObject( hDC, hFont ); GetClientRect( hWnd, &rct ); GetTextMetrics( hDC, &tm ); if( hFont ) SelectObject( hDC, hOldFont ); tm.tmHeight += 1; if ( ! bDrawHeaders ) // By CeSoTech wRow-- ; rct.top = tm.tmHeight * wRow ; rct.bottom = tm.tmHeight * ( wRow + 1) - 1; rct.left = 0; while( wIndex < wCol ) rct.left += GetInt( pAsizes, wIndex++ ); rct.right = rct.left+GetInt( pAsizes, wCol ) - 1; MaskRegion( hDC, &rct, GetBkColor( hDC ), GetSysColor(COLOR_ACTIVECAPTION) ); if( bFocused ) DrawFocusRect( hDC, &rct ); if( bDestroyDC ) ReleaseDC( hWnd, hDC ); }
CLIPPER MInit() { MouseInit( _parl( 1 ) ); }
//---------------------------------------------------------------------------// CLIPPER WBRWPANE( void ) // ( hWnd, hDC, Self, bLine, aSizes, nFirstItem, // nClrFore, nClrBack, hFont, aJustify, nStyle // lCellStyle, lFocused ) -> nRowsSkipped // bTextColor, bBkColor, nClrLine, nColorFondo, bFont ) // New's by CesoTech { HWND hWnd = ( HWND ) _parnl( 1 ); HDC hDC = ( HDC ) _parnl( 2 ); WORD wRows; WORD wLastBottom = 0; WORD wRow = 1; WORD wSkipped = 1; void * Self = _param( 3, -1 ); void * bLine = _param( 4, -1 ); void * pASizes = _param( 5, -1 ); HFONT hFont = ( HFONT ) _parnl( 9 ); HFONT hOldFont; BOOL bDestroyDC = FALSE; WORD wHeight ; RECT rct, box, client; WORD wIndex = _parni( 6 ); void * bClrFore = 0; void * bClrBack = 0; COLORREF clrFore = 0; COLORREF clrBack = 0; HPEN hGrayPen = CreatePen( PS_SOLID, 1, GetSysColor( COLOR_BTNSHADOW ) ) ; // RGB( 128, 128, 128 ) ); HPEN hWhitePen = CreatePen( PS_SOLID, 1, GetSysColor( COLOR_BTNHIGHLIGHT ) ); // GetStockObject( WHITE_PEN ); BOOL bColBlock = ( _itemType( pASizes ) & BLOCK ); void * pAJustify = ISARRAY( 10 ) ? _param( 10, -1 ): 0; WORD nHeightCtrl ; // by CeSoTech WORD nStyle = _parni( 11 ); if( PCOUNT() > 6 ) { if( ISBLOCK( 7 ) ) bClrFore = _param( 7, -1 ); else clrFore = _parnl( 7 ); } if( PCOUNT() > 7 ) { if( ISBLOCK( 8 ) ) { bClrBack = _param( 8, -1 ); _cEval0( bClrBack ); clrBack = _parnl( -1 ); } else clrBack = _parnl( 8 ); } if( ! hDC ) { bDestroyDC = TRUE; hDC = GetDC( hWnd ); } if( ! pSkip ) pSkip = _get_sym( "SKIP" ); if( hFont ) hOldFont = SelectObject( hDC, hFont ); ///////////////////////// // Borremos el Area de la derecha no coubierta if ( !bAdjBrowse && !bAdjLastCol ) { GetClientRect( hWnd, &rct ); SetBkColor( hDC, _parnl( 17 ) ) ; for( wIndex=wIndex ; wIndex <= (WORD) _parinfa( 5, NULL); wIndex++ ) { rct.left += _parni( 5, wIndex ) ; } if ( !(nStyle == 0 || nStyle == 7 || nStyle == 8 || nStyle == 3) ) rct.left++; ExtTextOut( hDC, rct.left, rct.top, ETO_OPAQUE | ETO_CLIPPED, &rct, "", 0, 0 ); wIndex = _parni( 6 ); GetClientRect( hWnd, &rct ); } ///////////////////////// GetClientRect( hWnd, &client ); nHeightCtrl = client.bottom-client.top ; // by CeSoTech wHeight = wLineHeight + 1 ; wRows = WBrwRowsC( hWnd, hDC, hFont ); if( ! bClrFore ) SetTextColor( hDC, clrFore ); SetBkColor( hDC, clrBack ); while( wRow <= wRows && wSkipped == 1 ) { rct.top = client.top + ( bDrawHeaders ? wHeaderHeight+1 : 0 ) + (wHeight * (wRow-1) ) ; rct.bottom = rct.top + wHeight; rct.left = 0; rct.right = client.right; _cEval0( bLine ); _xpushm( _eval ); if( bClrFore ) { _cEval0( bClrFore ); SetTextColor( hDC, _parnl( -1 ) ); } if( bClrBack ) { _cEval0( bClrBack ); SetBkColor( hDC, _parnl( -1 ) ); } if( bColBlock ) _cEval0( pASizes ); PaintTheLine( hDC, &rct, wIndex, _tos, ( bColBlock ? _eval : pASizes ), hWhitePen, hGrayPen, bColBlock, pAJustify, 0, FALSE, _parni( 11 ), _parni ( 12 ), _parl( 13 ), ISBLOCK( 14 ) ? _param( 14, -1 ) : 0, // CeSoTech ISBLOCK( 15 ) ? _param( 15, -1 ) : 0, // CeSoTech wRow, nHeightCtrl, // CeSoTech ISNUM( 16 ) ? _parnl( 16 ) : -1, // CeSoTech FALSE, FALSE, // CeSoTech ISBLOCK( 18 ) ? _param( 18, -1 ) : 0, // CeSoTech FALSE ) ; _0POP(); _putsym( pSkip ); _xpushm( Self ); _putq( 1 ); _xsend( 1 ); wLastBottom = rct.bottom ; wSkipped = _parni( -1 ); if( wSkipped == 1 ) wRow++; } //////////////////////// // Borremos el Area de Abajo no cubierta GetClientRect( hWnd, &rct ); SetBkColor( hDC, _parnl( 17 ) ) ; rct.top = wLastBottom + 1 ; if ( wLastBottom == 0 ) // No Mostro Registros rct.top = ( bDrawHeaders ? wHeaderHeight+1 : 0 ) ; rct.bottom-= 1 + ( bDrawFooters ? wFooterHeight+1 : 0 ) ; if (nStyle == 0 || nStyle == 5 || nStyle == 6 || nStyle == 9 || nStyle == 10 || nStyle == 3 ) rct.top--; if ( !bDrawFooters ) rct.bottom++; if ( rct.top < rct.bottom ) { ExtTextOut( hDC, rct.left, rct.top, ETO_OPAQUE | ETO_CLIPPED, &rct, "", 0, 0 ); } //////////////////////// DeleteObject( hGrayPen ); DeleteObject( hWhitePen ); if( hFont ) SelectObject( hDC, hOldFont ); if( bDestroyDC ) ReleaseDC( hWnd, hDC ); _retni( wRow ); }
//---------------------------------------------------------------------------// CLIPPER WBRWLINE( void ) // ( hWnd, hDC, nRow, aText, aSizes, nFirstItem, ; // nClrFore, nClrBack, hFont, lTree, aJustify, nPressed, // nStyle, nColAct, lFocused ) // bTextColor, bBkColor, nClrLine, lFooter, lSelect, // bFont, lDrawFocusRect ) // New's by CesoTech { HWND hWnd = (HWND) _parnl( 1 ); HDC hDC = (HDC) _parnl( 2 ); WORD wRow = _parni( 3 ); BOOL bDestroyDC = FALSE; WORD wHeight; RECT rct, box; void * bClrFore; void * bClrBack; COLORREF clrFore = 0; COLORREF clrBack = 0; HPEN hGrayPen ; HPEN hWhitePen ; HFONT hFont = (HFONT) _parnl( 9 ); HFONT hOldFont; BOOL bTree = _parl( 10 ); BOOL bFooter = ISLOGICAL( 19 ) ? _parl( 19 ) : FALSE ; // CeSoTech WORD nHeightCtrl ; // by CeSoTech hGrayPen = CreatePen( PS_SOLID, 1, GetSysColor( COLOR_BTNSHADOW ) ) ; // RGB( 128, 128, 128 ) ); hWhitePen = CreatePen( PS_SOLID, 1, GetSysColor( COLOR_BTNHIGHLIGHT ) ); // GetStockObject( WHITE_PEN ); if( PCOUNT() > 6 ) { if( ISBLOCK( 7 ) ) { bClrFore = _param( 7, -1 ); _cEval0( bClrFore ); clrFore = _parnl( -1 ); } else { clrFore = _parnl( 7 ); } } if( PCOUNT() > 7 ) { if( ISBLOCK( 8 ) ) { bClrBack = _param( 8, -1 ); _cEval0( bClrBack ); clrBack = _parnl( -1 ); } else { clrBack = _parnl( 8 ); } } if( ! hDC ) { bDestroyDC = TRUE; hDC = GetDC( hWnd ); } if( hFont ) hOldFont = SelectObject( hDC, hFont ); GetClientRect( hWnd, &rct ); nHeightCtrl = rct.bottom-rct.top ; // by CeSoTech SetTextColor( hDC, clrFore ); SetBkColor( hDC, clrBack ); wHeight = wLineHeight + 1 ; if ( ( wRow == 0 ) && bDrawHeaders ) // Es una Cabecera wHeight = wHeaderHeight + 1 ; if ( ! bFooter ) { if ( ( wRow == 0 ) && bDrawHeaders ) // Es una Cabecera { rct.top = 0 ; rct.bottom = wHeaderHeight + 1 ; } else { rct.top = ( bDrawHeaders ? wHeaderHeight+1 : 0 ) + (wHeight * (wRow-1) ) ; rct.bottom = ( bDrawHeaders ? wHeaderHeight+1 : 0 ) + (wHeight * wRow) ; } } else { rct.top = rct.bottom - (wFooterHeight+1) ; } rct.left = 0; PaintTheLine( hDC, &rct, _parni( 6 ), _param( 4, -1 ), _param( 5, -1 ), hWhitePen, hGrayPen, bTree, ISARRAY(11) ? _param( 11, -1 ) : 0, _parni( 12 ), (wRow == 0), _parni( 13 ), _parni( 14 ), _parl( 15 ), ISBLOCK( 16 ) ? _param( 16, -1 ) : 0, // CeSoTech ISBLOCK( 17 ) ? _param( 17, -1 ) : 0, // CeSoTech wRow, nHeightCtrl, // CeSoTech ISNUM( 18 ) ? _parnl( 18 ) : -1, // CeSoTech bFooter, // CeSoTech ISLOGICAL( 20 ) ? _parl( 20 ) : FALSE, // CeSoTech ISBLOCK( 21 ) ? _param( 21, -1 ) : 0, // CeSoTech ISLOGICAL( 22 ) ? _parl( 22 ) : FALSE );// CeSoTech DeleteObject( hGrayPen ); DeleteObject( hWhitePen ); if( hFont ) SelectObject( hDC, hOldFont ); if( bDestroyDC ) ReleaseDC( hWnd, hDC ); _reta( 2 ); _storni( rct.top, -1, 1 ); _storni( rct.bottom, -1, 2 ); }
CLIPPER HB_LOGICAL4() { _storl( _parl( 2 ), 1, 1 ); }
CLIPPER HB_LOGICAL2() { _retl( _parl( 1, 1 ) ); }
CLIPPER HB_LOGICAL1() { _retl( _parl( 1 ) ); }
CLIPPER HB_UNDOC14() { _retl( _parl( 1 ) ); _storl( 0, -1 ); }
CLIPPER HB_UNDOC5() { _retl( _parl( 1 ) ); _retl( _parl( -1 ) - 1 ); }
CLIPPER read_scan(void) { int barcode_sts; /* scanner input status */ int barcode_len; /* holds the no. of bytes actually read */ int check_flag = 0; int label_chkdigit,chkdigit; if ((PCOUNT >= 2) && ISBYREF(BYTES_READ) && ISNUM(BYTES_READ) && ISBYREF(STR_BUFF) && ISCHAR(STR_BUFF)) { /* verify initial status */ if (chk_init_flag(POS_SCAN) == 0) { _retni(DEV_NOT_EXIST); return; } /* device not yet initialized */ /* not in asynchronous scanning mode */ if (!async_scan) { _retni(INVP); return; } /* read scanner input */ if ((barcode_sts = pfl_get_label(label_buff)) == -1) barcode_sts = READ_ERR; /* no available data to be fetched */ else { barcode_len = barcode_sts & 0x00ff; /* get label length */ barcode_sts >>= 8; /* label status */ barcode_sts = (barcode_sts == 0)? NORMAL: SCAN_ERR; /* status */ if ( PCOUNT == 3 ) { int check_flag = _parl(CHECK_FLAG); if (check_flag) { barcode_len--; label_chkdigit = (int) label_buff[barcode_len] - 48 ; chkdigit = checkdgt(label_buff,barcode_len); if ( label_chkdigit != chkdigit ) barcode_sts = SCAN_ERR; } } _storni(barcode_len, BYTES_READ); /* length */ *(label_buff+barcode_len+1) = '\0'; /* insert a NULL character */ _storclen(label_buff, barcode_len+2, STR_BUFF); /* bar code data */ } _retni(barcode_sts); } else
CLIPPER WBRWPANE( PARAMS ) // ( hWnd, hDC, Self, bLine, aSizes, nFirstItem, // nClrFore, nClrBack, hFont, aJustify, nStyle // lCellStyle, lFocused ) -> nRowsSkipped // bTextColor, bBkColor, nClrLine, nColorFondo, bFont ) // New's by CesoTech #endif { HWND hWnd = ( HWND ) _parnl( 1 ); HDC hDC = ( HDC ) _parnl( 2 ); WORD wRows; WORD wLastBottom = 0; WORD wRow = 1; WORD wSkipped = 1; PCLIPVAR Self = _param( 3, -1 ); PCLIPVAR bLine = _param( 4, -1 ); PCLIPVAR pASizes = _param( 5, -1 ); HFONT hFont = ( HFONT ) _parnl( 9 ); HFONT hOldFont; BOOL bDestroyDC = FALSE; WORD wHeight ; RECT rct, box, client; WORD wIndex = _parni( 6 ); PCLIPVAR bClrFore = 0, bClrBack = 0; COLORREF clrFore = 0; COLORREF clrBack = 0; HPEN hGrayPen = CreatePen( PS_SOLID, 1, GetSysColor( COLOR_BTNSHADOW ) ) ; // RGB( 128, 128, 128 ) ); HPEN hWhitePen = CreatePen( PS_SOLID, 1, GetSysColor( COLOR_BTNHIGHLIGHT ) ); // GetStockObject( WHITE_PEN ); #ifndef __HARBOUR__ BOOL bColBlock = pASizes->wType & BLOCK; #else BOOL bColBlock = hb_itemType( pASizes ) & BLOCK; PHB_ITEM aLine = hb_itemNew( NULL ); #endif PCLIPVAR pAJustify = ISARRAY( 10 ) ? _param( 10, -1 ): 0; WORD nHeightCtrl ; // by CeSoTech WORD nStyle = _parni( 11 ); if( PCOUNT() > 6 ) { if( ISBLOCK( 7 ) ) bClrFore = _param( 7, -1 ); else clrFore = _parnl( 7 ); } if( PCOUNT() > 7 ) { if( ISBLOCK( 8 ) ) { bClrBack = _param( 8, -1 ); _cEval0( bClrBack ); clrBack = _parnl( -1 ); } else clrBack = _parnl( 8 ); } if( ! hDC ) { bDestroyDC = TRUE; hDC = GetDC( hWnd ); } if( ! pSkip ) pSkip = _Get_Sym( "SKIP" ); if( hFont ) hOldFont = SelectObject( hDC, hFont ); ///////////////////////// // Borremos el Area de la derecha no coubierta if ( !bAdjBrowse && !bAdjLastCol ) { GetClientRect( hWnd, &rct ); SetBkColor( hDC, _parnl( 17 ) ) ; for( wIndex=wIndex ; wIndex <= (WORD) _parinfa( 5, NULL); wIndex++ ) { rct.left += _parni( 5, wIndex ) ; } if ( !(nStyle == 0 || nStyle == 7 || nStyle == 8 || nStyle == 3) ) rct.left++; ExtTextOut( hDC, rct.left, rct.top, ETO_OPAQUE | ETO_CLIPPED, &rct, "", 0, 0 ); wIndex = _parni( 6 ); GetClientRect( hWnd, &rct ); } ///////////////////////// GetClientRect( hWnd, &client ); nHeightCtrl = client.bottom-client.top ; // by CeSoTech wHeight = wLineHeight + 1 ; wRows = WBrwRowsC( hWnd, hDC, hFont ); if( ! bClrFore ) SetTextColor( hDC, clrFore ); SetBkColor( hDC, clrBack ); while( wRow <= wRows && wSkipped == 1 ) { rct.top = client.top + ( bDrawHeaders ? wHeaderHeight+1 : 0 ) + (wHeight * (wRow-1) ) ; rct.bottom = rct.top + wHeight; rct.left = 0; rct.right = client.right; #ifndef __HARBOUR__ _cEval0( bLine ); _xPushM( _eval ); if( bClrFore ) { _cEval0( bClrFore ); SetTextColor( hDC, _parnl( -1 ) ); } if( bClrBack ) { _cEval0( bClrBack ); SetBkColor( hDC, _parnl( -1 ) ); } if( bColBlock ) _cEval0( pASizes ); PaintTheLine( hDC, &rct, wIndex, _tos, ( bColBlock ? _eval : pASizes ), hWhitePen, hGrayPen, bColBlock, pAJustify, 0, FALSE, _parni( 11 ), _parni ( 12 ), _parl( 13 ), ISBLOCK( 14 ) ? _param( 14, -1 ) : 0, // CeSoTech ISBLOCK( 15 ) ? _param( 15, -1 ) : 0, // CeSoTech wRow, nHeightCtrl, // CeSoTech ISNUM( 16 ) ? _parnl( 16 ) : -1, // CeSoTech FALSE, FALSE, // CeSoTech ISBLOCK( 18 ) ? _param( 18, -1 ) : 0, // CeSoTech FALSE ) ; _tos--; _PutSym( pSkip ); _xPushM( Self ); _PutQ( 1 ); _xSend( 1 ); #else { // aLine.type = HB_IT_NIL; // Esta extension de xHarbour no se puede aplicar en Harbour // hb_itemForwardValue( aLine, hb_vmEvalBlock( bLine ) ); hb_itemCopy( aLine, hb_vmEvalBlock( bLine ) ); if( bClrFore ) { _cEval0( bClrFore ); SetTextColor( hDC, _parnl( -1 ) ); } if( bClrBack ) { _cEval0( bClrBack ); SetBkColor( hDC, _parnl( -1 ) ); } PaintTheLine( hDC, &rct, wIndex, aLine, ( bColBlock ? hb_vmEvalBlock( pASizes ) : pASizes ), hWhitePen, hGrayPen, bColBlock, pAJustify, 0, FALSE, _parnl( 11 ), _parnl ( 12 ), _parl( 13 ), ISBLOCK( 14 ) ? _param( 14, -1 ) : 0, // CeSoTech ISBLOCK( 15 ) ? _param( 15, -1 ) : 0, // CeSoTech wRow, nHeightCtrl, // CeSoTech ISNUM( 16 ) ? _parnl( 16 ) : -1, // CeSoTech FALSE, FALSE, // CeSoTech ISBLOCK( 18 ) ? _param( 18, -1 ) : 0, // CeSoTech FALSE ) ; if ( pSkip ) { hb_vmPushSymbol( hb_dynsymSymbol( pSkip ) ); hb_vmPush( Self ); hb_vmPushLong( 1 ); hb_vmDo( 1 ); } } #endif wLastBottom = rct.bottom ; wSkipped = _parni( -1 ); if( wSkipped == 1 ) wRow++; } //////////////////////// // Borremos el Area de Abajo no cubierta GetClientRect( hWnd, &rct ); SetBkColor( hDC, _parnl( 17 ) ) ; rct.top = wLastBottom + 1 ; if ( wLastBottom == 0 ) // No Mostro Registros rct.top = ( bDrawHeaders ? wHeaderHeight+1 : 0 ) ; rct.bottom-= 1 + ( bDrawFooters ? wFooterHeight+1 : 0 ) ; if (nStyle == 0 || nStyle == 5 || nStyle == 6 || nStyle == 9 || nStyle == 10 || nStyle == 3 ) rct.top--; if ( !bDrawFooters ) rct.bottom++; if ( rct.top < rct.bottom ) { ExtTextOut( hDC, rct.left, rct.top, ETO_OPAQUE | ETO_CLIPPED, &rct, "", 0, 0 ); } //////////////////////// DeleteObject( hGrayPen ); DeleteObject( hWhitePen ); if( hFont ) SelectObject( hDC, hOldFont ); if( bDestroyDC ) ReleaseDC( hWnd, hDC ); _retni( wRow ); }