2009-12-08 01:09 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
+ contrib/hbqt/hbqt_hbqtsyntaxhighlighter.cpp
+ contrib/hbqt/hbqt_hbqtdbfmodel.cpp
+ contrib/hbqt/hbqt_hbqttableview.cpp
+ contrib/hbqt/hbqt_hbqtmydrawingarea.cpp
* contrib/hbqt/hbqt_destruct.cpp
* contrib/hbqt/hbqt_slots.cpp
* contrib/hbqt/hbqt_slots.h
* contrib/hbqt/Makefile
* Formatting (some of these generated long lines, but for now I had to see what's
happening in code)
* Moved out some classes from hbqt_slots.cpp. (TODO/TOFIX: renaming, moving declarations)
! Fixed missing hb_vmRequestRestore() calls. (lots)
+ Added TOFIX hbqt_gcpointer();
% Certain functions marked static.
% Optimized out listActv vars.
- Deleted commented code.
* contrib/rddads/adsx.c
* contrib/rddads/ads1.c
* Minor formatting.
This commit is contained in:
@@ -17,6 +17,28 @@
|
||||
past entries belonging to author(s): Viktor Szakats.
|
||||
*/
|
||||
|
||||
2009-12-08 01:09 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
|
||||
+ contrib/hbqt/hbqt_hbqtsyntaxhighlighter.cpp
|
||||
+ contrib/hbqt/hbqt_hbqtdbfmodel.cpp
|
||||
+ contrib/hbqt/hbqt_hbqttableview.cpp
|
||||
+ contrib/hbqt/hbqt_hbqtmydrawingarea.cpp
|
||||
* contrib/hbqt/hbqt_destruct.cpp
|
||||
* contrib/hbqt/hbqt_slots.cpp
|
||||
* contrib/hbqt/hbqt_slots.h
|
||||
* contrib/hbqt/Makefile
|
||||
* Formatting (some of these generated long lines, but for now I had to see what's
|
||||
happening in code)
|
||||
* Moved out some classes from hbqt_slots.cpp. (TODO/TOFIX: renaming, moving declarations)
|
||||
! Fixed missing hb_vmRequestRestore() calls. (lots)
|
||||
+ Added TOFIX hbqt_gcpointer();
|
||||
% Certain functions marked static.
|
||||
% Optimized out listActv vars.
|
||||
- Deleted commented code.
|
||||
|
||||
* contrib/rddads/adsx.c
|
||||
* contrib/rddads/ads1.c
|
||||
* Minor formatting.
|
||||
|
||||
2009-12-07 19:29 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
|
||||
* harbour/config/global.mk
|
||||
! fixed variable name in output message
|
||||
@@ -66,7 +88,7 @@
|
||||
2009-12-07 11:40 UTC+0200 Mindaugas Kavaliauskas (dbtopas/at/dbtopas.lt)
|
||||
* harbour/contrib/rddads/ads1.c
|
||||
* renamed RDD from ADT to ADSADT
|
||||
+ added public functions ADSADT, ADSNTX, ADSCDX, ADSVFP to be able
|
||||
+ added public functions ADSADT, ADSNTX, ADSCDX, ADSVFP to be able
|
||||
do a REQUEST RDD using RDD name from .prg code
|
||||
* harbour/contrib/rddads/adsx.c
|
||||
+ added ADSNTXX, ADSCDXX, ADSADTX RDDs
|
||||
|
||||
@@ -12,7 +12,7 @@ PRG_HEADERS := \
|
||||
hbqt.ch \
|
||||
|
||||
PRG_SOURCES := \
|
||||
hbqt_misc.prg
|
||||
hbqt_misc.prg \
|
||||
|
||||
include $(TOP)$(ROOT)contrib/hbqt/detect.mk
|
||||
|
||||
@@ -23,6 +23,12 @@ moc_slots.cpp : $(TOP)$(ROOT)contrib/hbqt/hbqt_slots.h
|
||||
|
||||
include $(TOP)$(ROOT)contrib/hbqt/filelist.mk
|
||||
|
||||
CPP_SOURCES += \
|
||||
hbqt_hbqtdbfmodel.cpp \
|
||||
hbqt_hbqtmydrawingarea.cpp \
|
||||
hbqt_hbqtsyntaxhighlighter.cpp \
|
||||
hbqt_hbqttableview.cpp \
|
||||
|
||||
include $(TOP)$(ROOT)config/header.mk
|
||||
include $(TOP)$(ROOT)config/lib.mk
|
||||
|
||||
@@ -35,7 +41,7 @@ moc_slots.cpp : $(TOP)$(ROOT)contrib/hbqt/hbqt_slots.h
|
||||
DIRS += \
|
||||
qtcore \
|
||||
qtgui \
|
||||
qtnetwork
|
||||
qtnetwork
|
||||
|
||||
include $(TOP)$(ROOT)config/dir.mk
|
||||
endif
|
||||
|
||||
@@ -56,7 +56,6 @@
|
||||
#endif
|
||||
|
||||
#include "hbapi.h"
|
||||
#include "hbapiitm.h"
|
||||
|
||||
#include "hbqt.h"
|
||||
|
||||
@@ -98,6 +97,7 @@ void * hbqt_gcpointer( int iParam )
|
||||
}
|
||||
else
|
||||
{
|
||||
/* TOFIX: This is dangerous. */
|
||||
return hb_parptr( iParam );
|
||||
}
|
||||
}
|
||||
@@ -109,14 +109,10 @@ int hbqt_get_object_release_method()
|
||||
|
||||
HB_FUNC( HBQT_SET_RELEASE_METHOD )
|
||||
{
|
||||
if( (hb_pcount() == 1) && HB_ISNUM( 1 ) )
|
||||
{
|
||||
if ( ( hb_parni( 1 ) >= 0) && ( hb_parni( 1 ) <= HBQT_RELEASE_WITH_DELETE_LATER ) )
|
||||
{
|
||||
s_iObjectReleaseMethod = hb_parni( 1 );
|
||||
}
|
||||
}
|
||||
hb_retni( s_iObjectReleaseMethod );
|
||||
|
||||
if( HB_ISNUM( 1 ) && hb_parni( 1 ) >= 0 && hb_parni( 1 ) <= HBQT_RELEASE_WITH_DELETE_LATER )
|
||||
s_iObjectReleaseMethod = hb_parni( 1 );
|
||||
}
|
||||
|
||||
HB_FUNC( HBQT_QTPTR_FROM_GCPOINTER )
|
||||
|
||||
316
harbour/contrib/hbqt/hbqt_hbqtdbfmodel.cpp
Normal file
316
harbour/contrib/hbqt/hbqt_hbqtdbfmodel.cpp
Normal file
@@ -0,0 +1,316 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/*
|
||||
* Harbour Project source code:
|
||||
* QT wrapper main header
|
||||
*
|
||||
* Copyright 2009 Marcos Antonio Gambeta <marcosgambeta at gmail dot com>
|
||||
*
|
||||
* Copyright 2009 Pritpal Bedi <pritpal@vouchcac.com>
|
||||
* www - http://www.harbour-project.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this software; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
||||
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
|
||||
*
|
||||
* As a special exception, the Harbour Project gives permission for
|
||||
* additional uses of the text contained in its release of Harbour.
|
||||
*
|
||||
* The exception is that, if you link the Harbour libraries with other
|
||||
* files to produce an executable, this does not by itself cause the
|
||||
* resulting executable to be covered by the GNU General Public License.
|
||||
* Your use of that executable is in no way restricted on account of
|
||||
* linking the Harbour library code into it.
|
||||
*
|
||||
* This exception does not however invalidate any other reasons why
|
||||
* the executable file might be covered by the GNU General Public License.
|
||||
*
|
||||
* This exception applies only to the code released by the Harbour
|
||||
* Project under the name Harbour. If you copy code from other
|
||||
* Harbour Project or Free Software Foundation releases into a copy of
|
||||
* Harbour, as the General Public License permits, the exception does
|
||||
* not apply to the code that you add in this way. To avoid misleading
|
||||
* anyone as to the status of such modified files, you must delete
|
||||
* this exception notice from them.
|
||||
*
|
||||
* If you write modifications of your own for Harbour, it is your choice
|
||||
* whether to permit this exception to apply to your modifications.
|
||||
* If you do not wish that, delete this exception notice.
|
||||
*
|
||||
*/
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
#include "hbapi.h"
|
||||
#include "hbvm.h"
|
||||
|
||||
#include "hbqt.h"
|
||||
|
||||
#if QT_VERSION >= 0x040500
|
||||
|
||||
#include "hbqt_slots.h"
|
||||
|
||||
#define HBQT_BRW_CELLVALUE 1001
|
||||
|
||||
#define HBQT_BRW_COLCOUNT 1002
|
||||
#define HBQT_BRW_ROWCOUNT 1003
|
||||
|
||||
#define HBQT_BRW_COLHEADER 1004
|
||||
#define HBQT_BRW_COLALIGN 1006
|
||||
#define HBQT_BRW_COLFGCOLOR 1007
|
||||
#define HBQT_BRW_COLBGCOLOR 1008
|
||||
#define HBQT_BRW_COLHEIGHT 1011
|
||||
|
||||
#define HBQT_BRW_ROWHEADER 1005
|
||||
#define HBQT_BRW_DATFGCOLOR 1009
|
||||
#define HBQT_BRW_DATBGCOLOR 1010
|
||||
#define HBQT_BRW_DATHEIGHT 1012
|
||||
#define HBQT_BRW_DATALIGN 1013
|
||||
#define HBQT_BRW_CELLDECORATION 1014
|
||||
|
||||
static QVariant hbqt_fetchRole( PHB_ITEM block, int what, int par1, int par2 )
|
||||
{
|
||||
QVariant vv;
|
||||
|
||||
if( hb_vmRequestReenter() )
|
||||
{
|
||||
PHB_ITEM p0 = hb_itemPutNI( NULL, what );
|
||||
PHB_ITEM p1 = hb_itemPutNI( NULL, par1 );
|
||||
PHB_ITEM p2 = hb_itemPutNI( NULL, par2 );
|
||||
|
||||
PHB_ITEM ret = hb_vmEvalBlockV( block, 3, p0, p1, p2 );
|
||||
|
||||
hb_itemRelease( p0 );
|
||||
hb_itemRelease( p1 );
|
||||
hb_itemRelease( p2 );
|
||||
|
||||
hb_vmRequestRestore();
|
||||
|
||||
if( hb_itemType( ret ) & HB_IT_STRING )
|
||||
{
|
||||
vv = hb_itemGetCPtr( ret );
|
||||
#if defined( __HB_DEBUG__ )
|
||||
hbqt_debug( " fetchRole[ s = %s ]", hb_itemGetCPtr( ret ) );
|
||||
#endif
|
||||
}
|
||||
else if( hb_itemType( ret ) & HB_IT_LOGICAL )
|
||||
{
|
||||
vv = hb_itemGetL( ret );
|
||||
#if defined( __HB_DEBUG__ )
|
||||
hbqt_debug( " fetchRole[ l = %i ]", hb_itemGetL( ret ) );
|
||||
#endif
|
||||
}
|
||||
else if( hb_itemType( ret ) & HB_IT_DOUBLE )
|
||||
{
|
||||
vv = hb_itemGetND( ret );
|
||||
#if defined( __HB_DEBUG__ )
|
||||
hbqt_debug( " fetchRole[ d = %i ]", hb_itemGetND( ret ) );
|
||||
#endif
|
||||
}
|
||||
else if( hb_itemType( ret ) & HB_IT_NUMERIC )
|
||||
{
|
||||
vv = hb_itemGetNI( ret );
|
||||
#if defined( __HB_DEBUG__ )
|
||||
hbqt_debug( " fetchRole[ n = %i ]", hb_itemGetNI( ret ) );
|
||||
#endif
|
||||
}
|
||||
}
|
||||
return vv;
|
||||
}
|
||||
|
||||
HbDbfModel::HbDbfModel( PHB_ITEM pBlock ) : QAbstractItemModel()
|
||||
{
|
||||
block = hb_itemNew( pBlock );
|
||||
iRows = 0;
|
||||
iCols = 0;
|
||||
}
|
||||
|
||||
HbDbfModel::~HbDbfModel( void )
|
||||
{
|
||||
if( block )
|
||||
{
|
||||
hb_itemRelease( block );
|
||||
block = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
Qt::ItemFlags HbDbfModel::flags( const QModelIndex & index ) const
|
||||
{
|
||||
if( ! index.isValid() )
|
||||
return 0;
|
||||
|
||||
return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
|
||||
}
|
||||
|
||||
QVariant HbDbfModel::data( const QModelIndex & index, int role ) const
|
||||
{
|
||||
#if defined( __HB_DEBUG__ )
|
||||
hbqt_debug( "data - row=%i col=%i role=%i", index.row(), index.column(), role );
|
||||
#endif
|
||||
if( !index.isValid() )
|
||||
return QVariant();
|
||||
|
||||
switch( role )
|
||||
{
|
||||
case Qt::SizeHintRole:
|
||||
{
|
||||
int iHeight = hbqt_fetchRole( block, HBQT_BRW_DATHEIGHT, index.row()+1, index.column()+1 ).toInt();
|
||||
return QSize( 20, iHeight );
|
||||
}
|
||||
case Qt::TextAlignmentRole:
|
||||
{
|
||||
return hbqt_fetchRole( block, HBQT_BRW_DATALIGN, index.row()+1, index.column()+1 );
|
||||
}
|
||||
case Qt::BackgroundRole:
|
||||
{
|
||||
int iClr = hbqt_fetchRole( block, HBQT_BRW_DATBGCOLOR, index.row()+1, index.column()+1 ).toInt();
|
||||
if( iClr < 25 )
|
||||
return QColor( ( Qt::GlobalColor ) iClr );
|
||||
else
|
||||
return QColor( ( QRgb ) iClr );
|
||||
}
|
||||
case Qt::ForegroundRole:
|
||||
{
|
||||
int iClr = hbqt_fetchRole( block, HBQT_BRW_DATFGCOLOR, index.row()+1, index.column()+1 ).toInt();
|
||||
if( iClr < 25 )
|
||||
return QColor( ( Qt::GlobalColor ) iClr );
|
||||
else
|
||||
return QColor( ( QRgb ) iClr );
|
||||
}
|
||||
case Qt::DecorationRole:
|
||||
{
|
||||
QVariant image = hbqt_fetchRole( block, HBQT_BRW_CELLDECORATION, index.row()+1, index.column()+1 );
|
||||
if( image.toString() == ( QString ) "" )
|
||||
return QVariant();
|
||||
return QIcon( image.toString() );
|
||||
//return QPixmap( image.toString() );
|
||||
}
|
||||
case Qt::DisplayRole:
|
||||
{
|
||||
return hbqt_fetchRole( block, HBQT_BRW_CELLVALUE, index.row()+1, index.column()+1 );
|
||||
}
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
QVariant HbDbfModel::headerData( int section, Qt::Orientation orientation, int role ) const
|
||||
{
|
||||
#if defined( __HB_DEBUG__ )
|
||||
hbqt_debug( "headerData - section=%i orient=%i role=%i name=%s", section, orientation, role, objectName() );
|
||||
#endif
|
||||
if( orientation == Qt::Horizontal )
|
||||
{
|
||||
switch( role )
|
||||
{
|
||||
case Qt::TextAlignmentRole:
|
||||
{
|
||||
return hbqt_fetchRole( block, HBQT_BRW_COLALIGN, 0, section+1 ).toInt();
|
||||
}
|
||||
case Qt::SizeHintRole:
|
||||
{
|
||||
int iHeight = hbqt_fetchRole( block, HBQT_BRW_COLHEIGHT, 0, section+1 ).toInt();
|
||||
return QSize( 20, iHeight );
|
||||
}
|
||||
case Qt::BackgroundRole:
|
||||
{
|
||||
int iClr = hbqt_fetchRole( block, HBQT_BRW_COLBGCOLOR, 0, section+1 ).toInt();
|
||||
if( iClr < 25 )
|
||||
return QColor( ( Qt::GlobalColor ) iClr );
|
||||
else
|
||||
return QColor( ( QRgb ) iClr );
|
||||
}
|
||||
case Qt::ForegroundRole:
|
||||
{
|
||||
int iClr = hbqt_fetchRole( block, HBQT_BRW_COLFGCOLOR, 0, section+1 ).toInt();
|
||||
if( iClr < 25 )
|
||||
return QColor( ( Qt::GlobalColor ) iClr );
|
||||
else
|
||||
return QColor( ( QRgb ) iClr );
|
||||
}
|
||||
case Qt::DisplayRole:
|
||||
{
|
||||
return hbqt_fetchRole( block, HBQT_BRW_COLHEADER, 0, section+1 );
|
||||
}
|
||||
case Qt::FontRole:
|
||||
case Qt::DecorationRole:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( orientation == Qt::Vertical && role == Qt::DisplayRole )
|
||||
{
|
||||
return section + 1;
|
||||
}
|
||||
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
int HbDbfModel::rowCount( const QModelIndex & /*parent = QModelIndex()*/ ) const
|
||||
{
|
||||
if( hb_vmRequestReenter() )
|
||||
{
|
||||
PHB_ITEM p0 = hb_itemPutNI( NULL, HBQT_BRW_ROWCOUNT );
|
||||
|
||||
int result = hb_itemGetNI( hb_vmEvalBlockV( block, 1, p0 ) );
|
||||
|
||||
hb_itemRelease( p0 );
|
||||
|
||||
hb_vmRequestRestore();
|
||||
return result;
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
int HbDbfModel::columnCount( const QModelIndex & /*parent = QModelIndex()*/ ) const
|
||||
{
|
||||
if( hb_vmRequestReenter() )
|
||||
{
|
||||
PHB_ITEM p0 = hb_itemPutNI( NULL, HBQT_BRW_COLCOUNT );
|
||||
|
||||
int result = hb_itemGetNI( hb_vmEvalBlockV( block, 1, p0 ) );
|
||||
|
||||
hb_itemRelease( p0 );
|
||||
|
||||
hb_vmRequestRestore();
|
||||
return result;
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
QModelIndex HbDbfModel::index( int row, int column, const QModelIndex & parent ) const
|
||||
{
|
||||
HB_SYMBOL_UNUSED( parent );
|
||||
return createIndex( row, column, row * column );
|
||||
}
|
||||
|
||||
QModelIndex HbDbfModel::parent( const QModelIndex & /* child */ ) const
|
||||
{
|
||||
return QModelIndex();
|
||||
}
|
||||
|
||||
void HbDbfModel::reset()
|
||||
{
|
||||
QAbstractItemModel::reset();
|
||||
}
|
||||
|
||||
void HbDbfModel::hbSetRowColumns( int rows, int cols )
|
||||
{
|
||||
iRows = rows;
|
||||
iCols = cols;
|
||||
}
|
||||
|
||||
#endif
|
||||
96
harbour/contrib/hbqt/hbqt_hbqtmydrawingarea.cpp
Normal file
96
harbour/contrib/hbqt/hbqt_hbqtmydrawingarea.cpp
Normal file
@@ -0,0 +1,96 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/*
|
||||
* Harbour Project source code:
|
||||
* QT wrapper main header
|
||||
*
|
||||
* Copyright 2009 Marcos Antonio Gambeta <marcosgambeta at gmail dot com>
|
||||
*
|
||||
* Copyright 2009 Pritpal Bedi <pritpal@vouchcac.com>
|
||||
* www - http://www.harbour-project.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this software; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
||||
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
|
||||
*
|
||||
* As a special exception, the Harbour Project gives permission for
|
||||
* additional uses of the text contained in its release of Harbour.
|
||||
*
|
||||
* The exception is that, if you link the Harbour libraries with other
|
||||
* files to produce an executable, this does not by itself cause the
|
||||
* resulting executable to be covered by the GNU General Public License.
|
||||
* Your use of that executable is in no way restricted on account of
|
||||
* linking the Harbour library code into it.
|
||||
*
|
||||
* This exception does not however invalidate any other reasons why
|
||||
* the executable file might be covered by the GNU General Public License.
|
||||
*
|
||||
* This exception applies only to the code released by the Harbour
|
||||
* Project under the name Harbour. If you copy code from other
|
||||
* Harbour Project or Free Software Foundation releases into a copy of
|
||||
* Harbour, as the General Public License permits, the exception does
|
||||
* not apply to the code that you add in this way. To avoid misleading
|
||||
* anyone as to the status of such modified files, you must delete
|
||||
* this exception notice from them.
|
||||
*
|
||||
* If you write modifications of your own for Harbour, it is your choice
|
||||
* whether to permit this exception to apply to your modifications.
|
||||
* If you do not wish that, delete this exception notice.
|
||||
*
|
||||
*/
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
#include "hbapi.h"
|
||||
|
||||
#include "hbqt.h"
|
||||
|
||||
#if QT_VERSION >= 0x040500
|
||||
|
||||
#include "hbqt_slots.h"
|
||||
|
||||
MyDrawingArea::MyDrawingArea(QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
setAttribute( Qt::WA_StaticContents );
|
||||
setAttribute( Qt::WA_PaintOnScreen );
|
||||
setAttribute( Qt::WA_DeleteOnClose );
|
||||
setAttribute( Qt::WA_WindowPropagation );
|
||||
|
||||
setFocusPolicy( Qt::StrongFocus );
|
||||
setMouseTracking( true );
|
||||
|
||||
setAttribute( Qt::WA_InputMethodEnabled, true );
|
||||
}
|
||||
|
||||
MyDrawingArea::~MyDrawingArea( void )
|
||||
{
|
||||
}
|
||||
|
||||
void MyDrawingArea::mouseMoveEvent( QMouseEvent * event )
|
||||
{
|
||||
emit sg_mouseMoveEvent( event );
|
||||
}
|
||||
|
||||
void MyDrawingArea::keyPressEvent( QKeyEvent * event )
|
||||
{
|
||||
emit sg_keyPressEvent( event );
|
||||
}
|
||||
|
||||
HB_FUNC( QT_MYDRAWINGAREA )
|
||||
{
|
||||
hb_retptr( ( MyDrawingArea * ) new MyDrawingArea() );
|
||||
}
|
||||
|
||||
#endif
|
||||
148
harbour/contrib/hbqt/hbqt_hbqtsyntaxhighlighter.cpp
Normal file
148
harbour/contrib/hbqt/hbqt_hbqtsyntaxhighlighter.cpp
Normal file
@@ -0,0 +1,148 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/*
|
||||
* Harbour Project source code:
|
||||
* QT wrapper main header
|
||||
*
|
||||
* Copyright 2009 Marcos Antonio Gambeta <marcosgambeta at gmail dot com>
|
||||
*
|
||||
* Copyright 2009 Pritpal Bedi <pritpal@vouchcac.com>
|
||||
* www - http://www.harbour-project.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this software; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
||||
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
|
||||
*
|
||||
* As a special exception, the Harbour Project gives permission for
|
||||
* additional uses of the text contained in its release of Harbour.
|
||||
*
|
||||
* The exception is that, if you link the Harbour libraries with other
|
||||
* files to produce an executable, this does not by itself cause the
|
||||
* resulting executable to be covered by the GNU General Public License.
|
||||
* Your use of that executable is in no way restricted on account of
|
||||
* linking the Harbour library code into it.
|
||||
*
|
||||
* This exception does not however invalidate any other reasons why
|
||||
* the executable file might be covered by the GNU General Public License.
|
||||
*
|
||||
* This exception applies only to the code released by the Harbour
|
||||
* Project under the name Harbour. If you copy code from other
|
||||
* Harbour Project or Free Software Foundation releases into a copy of
|
||||
* Harbour, as the General Public License permits, the exception does
|
||||
* not apply to the code that you add in this way. To avoid misleading
|
||||
* anyone as to the status of such modified files, you must delete
|
||||
* this exception notice from them.
|
||||
*
|
||||
* If you write modifications of your own for Harbour, it is your choice
|
||||
* whether to permit this exception to apply to your modifications.
|
||||
* If you do not wish that, delete this exception notice.
|
||||
*
|
||||
*/
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
#include "hbapi.h"
|
||||
|
||||
#include "hbqt.h"
|
||||
|
||||
#if QT_VERSION >= 0x040500
|
||||
|
||||
#include "hbqt_slots.h"
|
||||
|
||||
HbSyntaxHighlighter::HbSyntaxHighlighter( QTextDocument *parent )
|
||||
: QSyntaxHighlighter( parent )
|
||||
{
|
||||
HighlightingRule rule;
|
||||
|
||||
keywordFormat.setForeground( Qt::darkBlue );
|
||||
keywordFormat.setFontWeight( QFont::Bold );
|
||||
QStringList keywordPatterns;
|
||||
keywordPatterns << "\\bchar\\b" << "\\bclass\\b" << "\\bconst\\b"
|
||||
<< "\\bdouble\\b" << "\\benum\\b" << "\\bexplicit\\b"
|
||||
<< "\\bfriend\\b" << "\\binline\\b" << "\\bint\\b"
|
||||
<< "\\blong\\b" << "\\bnamespace\\b" << "\\boperator\\b"
|
||||
<< "\\bprivate\\b" << "\\bprotected\\b" << "\\bpublic\\b"
|
||||
<< "\\bshort\\b" << "\\bsignals\\b" << "\\bsigned\\b"
|
||||
<< "\\bslots\\b" << "\\bstatic\\b" << "\\bstruct\\b"
|
||||
<< "\\btemplate\\b" << "\\btypedef\\b" << "\\btypename\\b"
|
||||
<< "\\bunion\\b" << "\\bunsigned\\b" << "\\bvirtual\\b"
|
||||
<< "\\bvoid\\b" << "\\bvolatile\\b";
|
||||
foreach ( const QString &pattern, keywordPatterns ) {
|
||||
rule.pattern = QRegExp( pattern );
|
||||
rule.format = keywordFormat;
|
||||
highlightingRules.append( rule );
|
||||
}
|
||||
|
||||
classFormat.setFontWeight( QFont::Bold );
|
||||
classFormat.setForeground( Qt::darkMagenta );
|
||||
rule.pattern = QRegExp( "\\bQ[A-Za-z]+\\b" );
|
||||
rule.format = classFormat;
|
||||
highlightingRules.append( rule );
|
||||
|
||||
singleLineCommentFormat.setForeground( Qt::red );
|
||||
rule.pattern = QRegExp( "//[^\n]*" );
|
||||
rule.format = singleLineCommentFormat;
|
||||
highlightingRules.append( rule );
|
||||
|
||||
multiLineCommentFormat.setForeground( Qt::red );
|
||||
|
||||
quotationFormat.setForeground( Qt::darkGreen );
|
||||
rule.pattern = QRegExp( "\".*\"" );
|
||||
rule.format = quotationFormat;
|
||||
highlightingRules.append( rule );
|
||||
|
||||
functionFormat.setFontItalic( true );
|
||||
functionFormat.setForeground( Qt::blue );
|
||||
rule.pattern = QRegExp( "\\b[A-Za-z0-9_]+(?=\\()" );
|
||||
rule.format = functionFormat;
|
||||
highlightingRules.append( rule );
|
||||
|
||||
commentStartExpression = QRegExp("/\\*");
|
||||
commentEndExpression = QRegExp("\\*/");
|
||||
}
|
||||
|
||||
void HbSyntaxHighlighter::highlightBlock( const QString &text )
|
||||
{
|
||||
foreach ( const HighlightingRule &rule, highlightingRules ) {
|
||||
QRegExp expression( rule.pattern );
|
||||
int index = expression.indexIn( text );
|
||||
while ( index >= 0 ) {
|
||||
int length = expression.matchedLength();
|
||||
setFormat( index, length, rule.format );
|
||||
index = expression.indexIn( text, index + length );
|
||||
}
|
||||
}
|
||||
setCurrentBlockState( 0 );
|
||||
|
||||
int startIndex = 0;
|
||||
if ( previousBlockState() != 1 )
|
||||
startIndex = commentStartExpression.indexIn( text );
|
||||
|
||||
while ( startIndex >= 0 ) {
|
||||
int endIndex = commentEndExpression.indexIn( text, startIndex );
|
||||
int commentLength;
|
||||
if ( endIndex == -1 ) {
|
||||
setCurrentBlockState( 1 );
|
||||
commentLength = text.length() - startIndex;
|
||||
} else {
|
||||
commentLength = endIndex - startIndex
|
||||
+ commentEndExpression.matchedLength();
|
||||
}
|
||||
setFormat( startIndex, commentLength, multiLineCommentFormat );
|
||||
startIndex = commentStartExpression.indexIn( text, startIndex + commentLength );
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
138
harbour/contrib/hbqt/hbqt_hbqttableview.cpp
Normal file
138
harbour/contrib/hbqt/hbqt_hbqttableview.cpp
Normal file
@@ -0,0 +1,138 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/*
|
||||
* Harbour Project source code:
|
||||
* QT wrapper main header
|
||||
*
|
||||
* Copyright 2009 Marcos Antonio Gambeta <marcosgambeta at gmail dot com>
|
||||
*
|
||||
* Copyright 2009 Pritpal Bedi <pritpal@vouchcac.com>
|
||||
* www - http://www.harbour-project.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this software; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
||||
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
|
||||
*
|
||||
* As a special exception, the Harbour Project gives permission for
|
||||
* additional uses of the text contained in its release of Harbour.
|
||||
*
|
||||
* The exception is that, if you link the Harbour libraries with other
|
||||
* files to produce an executable, this does not by itself cause the
|
||||
* resulting executable to be covered by the GNU General Public License.
|
||||
* Your use of that executable is in no way restricted on account of
|
||||
* linking the Harbour library code into it.
|
||||
*
|
||||
* This exception does not however invalidate any other reasons why
|
||||
* the executable file might be covered by the GNU General Public License.
|
||||
*
|
||||
* This exception applies only to the code released by the Harbour
|
||||
* Project under the name Harbour. If you copy code from other
|
||||
* Harbour Project or Free Software Foundation releases into a copy of
|
||||
* Harbour, as the General Public License permits, the exception does
|
||||
* not apply to the code that you add in this way. To avoid misleading
|
||||
* anyone as to the status of such modified files, you must delete
|
||||
* this exception notice from them.
|
||||
*
|
||||
* If you write modifications of your own for Harbour, it is your choice
|
||||
* whether to permit this exception to apply to your modifications.
|
||||
* If you do not wish that, delete this exception notice.
|
||||
*
|
||||
*/
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
#include "hbapi.h"
|
||||
|
||||
#include "hbqt.h"
|
||||
|
||||
#if QT_VERSION >= 0x040500
|
||||
|
||||
#include "hbqt_slots.h"
|
||||
|
||||
HbTableView::HbTableView( QWidget * parent ) : QTableView( parent )
|
||||
{
|
||||
}
|
||||
|
||||
HbTableView::~HbTableView()
|
||||
{
|
||||
#if defined( __HB_DEBUG__ )
|
||||
hbqt_debug( "HbTableView::~HbTableView() 0 %i %i", ( int ) hb_xquery( 1001 ), hbqt_getmemused() );
|
||||
#endif
|
||||
destroy();
|
||||
#if defined( __HB_DEBUG__ )
|
||||
hbqt_debug( "HbTableView::~HbTableView() 1 %i %i", ( int ) hb_xquery( 1001 ), hbqt_getmemused() );
|
||||
#endif
|
||||
}
|
||||
|
||||
void HbTableView::keyPressEvent( QKeyEvent * event )
|
||||
{
|
||||
emit sg_keyPressEvent( event );
|
||||
}
|
||||
|
||||
void HbTableView::mouseDoubleClickEvent( QMouseEvent * event )
|
||||
{
|
||||
emit sg_mouseDoubleClickEvent( event );
|
||||
}
|
||||
|
||||
void HbTableView::mouseMoveEvent( QMouseEvent * event )
|
||||
{
|
||||
emit sg_mouseMoveEvent( event );
|
||||
}
|
||||
|
||||
void HbTableView::mousePressEvent( QMouseEvent * event )
|
||||
{
|
||||
emit sg_mousePressEvent( event );
|
||||
}
|
||||
|
||||
void HbTableView::mouseReleaseEvent( QMouseEvent * event )
|
||||
{
|
||||
emit sg_mouseReleaseEvent( event );
|
||||
}
|
||||
|
||||
void HbTableView::wheelEvent( QWheelEvent * event )
|
||||
{
|
||||
emit sg_wheelEvent( event );
|
||||
}
|
||||
|
||||
void HbTableView::resizeEvent( QResizeEvent * event )
|
||||
{
|
||||
emit sg_resizeEvent( event );
|
||||
}
|
||||
|
||||
QModelIndex HbTableView::moveCursor( HbTableView::CursorAction cursorAction, Qt::KeyboardModifiers modifiers )
|
||||
{
|
||||
//hbqt_debug( "HbTableView: action=%i %i", cursorAction, QAbstractItemView::MoveDown );
|
||||
|
||||
//emit sg_moveCursor( cursorAction, modifiers );
|
||||
return QTableView::moveCursor( cursorAction, modifiers );
|
||||
}
|
||||
|
||||
QModelIndex HbTableView::navigate( int cursorAction )
|
||||
{
|
||||
return moveCursor( ( HbTableView::CursorAction ) cursorAction, ( Qt::KeyboardModifiers ) 0 );
|
||||
}
|
||||
|
||||
void HbTableView::scrollContentsBy( int x, int y )
|
||||
{
|
||||
emit sg_scrollContentsBy( x, y );
|
||||
}
|
||||
|
||||
void HbTableView::scrollTo( const QModelIndex & index, QAbstractItemView::ScrollHint hint )
|
||||
{
|
||||
//hbqt_debug( "HbTableView:scrollTo row = %i col = %i", index.row(),index.column() );
|
||||
QTableView::scrollTo( index, hint );
|
||||
}
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -196,7 +196,6 @@ public:
|
||||
Slots( QObject *parent = 0 );
|
||||
~Slots();
|
||||
QList<PHB_ITEM> listBlock;
|
||||
QList<bool> listActv;
|
||||
|
||||
public slots:
|
||||
void clicked();
|
||||
@@ -335,7 +334,6 @@ public:
|
||||
Events( QObject *parent = 0 );
|
||||
~Events();
|
||||
QList<PHB_ITEM> listBlock;
|
||||
QList<bool> listActv;
|
||||
QList<QObject*> listObj;
|
||||
|
||||
protected:
|
||||
|
||||
@@ -876,10 +876,10 @@ static HB_ERRCODE adsGoTo( ADSAREAP pArea, ULONG ulRecNo )
|
||||
u32RetVal = AdsGotoRecord( pArea->hTable, 0 );
|
||||
}
|
||||
|
||||
/* Usually AdsGotoRecord( *, 0 ) is valid call and returns no error,
|
||||
* but if previous error was AE_INVALID_RECORD_NUMBER, the following
|
||||
/* Usually AdsGotoRecord( *, 0 ) is valid call and returns no error,
|
||||
* but if previous error was AE_INVALID_RECORD_NUMBER, the following
|
||||
* AdsGotoRecord( *, 0 ) returns the same error. I'm not sure if this
|
||||
* AdsGotoRecord( *, 0 ) will position to phantom record and return
|
||||
* AdsGotoRecord( *, 0 ) will position to phantom record and return
|
||||
* empty fields. I hope I have not made any regressions in code, since
|
||||
* it replicates previous behaviour. [Mindaugas]
|
||||
*/
|
||||
@@ -1530,7 +1530,7 @@ static HB_ERRCODE adsCreateFields( ADSAREAP pArea, PHB_ITEM pStruct )
|
||||
dbFieldInfo.uiTypeExtended = ADS_STRING;
|
||||
dbFieldInfo.uiLen = uiLen;
|
||||
}
|
||||
else if( pArea->iFileType == ADS_ADT &&
|
||||
else if( pArea->iFileType == ADS_ADT &&
|
||||
( ! hb_strnicmp( szFieldType, "curdouble", 2 ) || ( iNameLen == 1 && iData == 'Z' ) ) )
|
||||
{
|
||||
dbFieldInfo.uiType = HB_FT_CURDOUBLE;
|
||||
@@ -1616,7 +1616,7 @@ static HB_ERRCODE adsCreateFields( ADSAREAP pArea, PHB_ITEM pStruct )
|
||||
}
|
||||
#endif
|
||||
#ifdef ADS_MODTIME
|
||||
else if( pArea->iFileType == ADS_ADT &&
|
||||
else if( pArea->iFileType == ADS_ADT &&
|
||||
( ! hb_strnicmp( szFieldType, "modtime", 3 ) || ( iNameLen == 1 && iData == '=' ) ) )
|
||||
{
|
||||
dbFieldInfo.uiType = HB_FT_MODTIME;
|
||||
@@ -1635,7 +1635,7 @@ static HB_ERRCODE adsCreateFields( ADSAREAP pArea, PHB_ITEM pStruct )
|
||||
dbFieldInfo.uiType = HB_FT_INTEGER;
|
||||
#ifdef ADS_LONGLONG
|
||||
dbFieldInfo.uiLen = ( pArea->iFileType == ADS_ADT && uiLen == 2 ) ? 2 : ( uiLen == 8 ? 8 : 4 );
|
||||
dbFieldInfo.uiTypeExtended = dbFieldInfo.uiLen == 4 ? ADS_INTEGER :
|
||||
dbFieldInfo.uiTypeExtended = dbFieldInfo.uiLen == 4 ? ADS_INTEGER :
|
||||
( dbFieldInfo.uiLen == 2 ? ADS_SHORTINT : ADS_LONGLONG);
|
||||
#else
|
||||
dbFieldInfo.uiLen = ( pArea->iFileType == ADS_ADT && uiLen == 2 ) ? 2 : 4;
|
||||
@@ -1692,7 +1692,7 @@ static HB_ERRCODE adsCreateFields( ADSAREAP pArea, PHB_ITEM pStruct )
|
||||
else if( pArea->iFileType == ADS_VFP )
|
||||
dbFieldInfo.uiLen = 4;
|
||||
#endif
|
||||
else
|
||||
else
|
||||
dbFieldInfo.uiLen = 10;
|
||||
}
|
||||
else
|
||||
@@ -1768,7 +1768,7 @@ static HB_ERRCODE adsCreateFields( ADSAREAP pArea, PHB_ITEM pStruct )
|
||||
dbFieldInfo.uiFlags = HB_FF_BINARY;
|
||||
}
|
||||
#if ADS_ROWVERSION
|
||||
else if( pArea->iFileType == ADS_ADT &&
|
||||
else if( pArea->iFileType == ADS_ADT &&
|
||||
( ! hb_strnicmp( szFieldType, "rowversion", 2 ) || ( iNameLen == 1 && iData == '^' ) ) )
|
||||
{
|
||||
dbFieldInfo.uiType = HB_FT_ROWVER;
|
||||
@@ -5215,13 +5215,9 @@ HB_FUNC_STATIC( ADSVFP_GETFUNCTABLE )
|
||||
#endif
|
||||
|
||||
HB_FUNC( ADS ) { ; }
|
||||
|
||||
HB_FUNC( ADSADT ) { ; }
|
||||
|
||||
HB_FUNC( ADSNTX ) { ; }
|
||||
|
||||
HB_FUNC( ADSCDX ) { ; }
|
||||
|
||||
#if ADS_LIB_VERSION >= 900
|
||||
HB_FUNC( ADSVFP ) { ; }
|
||||
#endif
|
||||
|
||||
@@ -1461,11 +1461,8 @@ HB_FUNC( ADSADTX_GETFUNCTABLE )
|
||||
|
||||
|
||||
HB_FUNC( ADSX ) { ; }
|
||||
|
||||
HB_FUNC( ADSNTXX ) { ; }
|
||||
|
||||
HB_FUNC( ADSCDXX ) { ; }
|
||||
|
||||
HB_FUNC( ADSADTX ) { ; }
|
||||
|
||||
HB_FUNC_EXTERN( ADSCDX );
|
||||
@@ -1474,20 +1471,20 @@ static void hb_adsxRddInit( void * cargo )
|
||||
{
|
||||
HB_SYMBOL_UNUSED( cargo );
|
||||
|
||||
if( hb_rddRegister( "ADSX", RDT_FULL ) > 1 ||
|
||||
hb_rddRegister( "ADSNTXX", RDT_FULL ) > 1 ||
|
||||
hb_rddRegister( "ADSCDXX", RDT_FULL ) > 1 ||
|
||||
if( hb_rddRegister( "ADSX", RDT_FULL ) > 1 ||
|
||||
hb_rddRegister( "ADSNTXX", RDT_FULL ) > 1 ||
|
||||
hb_rddRegister( "ADSCDXX", RDT_FULL ) > 1 ||
|
||||
hb_rddRegister( "ADSADTX", RDT_FULL ) > 1 )
|
||||
{
|
||||
/* try different RDD registrer order */
|
||||
hb_rddRegister( "ADS", RDT_FULL );
|
||||
/* try different RDD register order */
|
||||
hb_rddRegister( "ADS", RDT_FULL );
|
||||
hb_rddRegister( "ADSNTX", RDT_FULL );
|
||||
hb_rddRegister( "ADSCDX", RDT_FULL );
|
||||
hb_rddRegister( "ADSADT", RDT_FULL );
|
||||
|
||||
if( hb_rddRegister( "ADSX", RDT_FULL ) > 1 ||
|
||||
hb_rddRegister( "ADSNTXX", RDT_FULL ) > 1 ||
|
||||
hb_rddRegister( "ADSCDXX", RDT_FULL ) > 1 ||
|
||||
if( hb_rddRegister( "ADSX", RDT_FULL ) > 1 ||
|
||||
hb_rddRegister( "ADSNTXX", RDT_FULL ) > 1 ||
|
||||
hb_rddRegister( "ADSCDXX", RDT_FULL ) > 1 ||
|
||||
hb_rddRegister( "ADSADTX", RDT_FULL ) > 1 )
|
||||
{
|
||||
hb_errInternal( HB_EI_RDDINVALID, NULL, NULL, NULL );
|
||||
|
||||
Reference in New Issue
Block a user