2015-01-14 13:00 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)

* contrib/hbwin/olecore.c
    + added new PRG function to control empty date conversion to OLE variant:
         __oleVariantNullDate( [<lNewNullFlag>] ) -> <lPrevNullFlag>
      This is per thread switch and by default initialized to .F. for each
      new thread. When set to .T. Harbour empty dates are translated to
      VT_NULL.
      Warning: it's possible that this function will be removed or replaced
               by other solution in the future.

  * contrib/gtqtc/gtqtc1.cpp
    * emulate CTRL by setting SHIFT + ALT in Android builds
      (It's temporary solution - my patch with support for CTRL in
      Android QT builds has been accepted so it should be included
      in next Qt releases)
    % set Qt::WA_NoSystemBackground
    * do not change number of rows and cols in maximized and fullscreen mode
      when font is changed and resize mode set to HB_GTI_RESIZEMODE_FONT.
      It was creating problems when user switched to fullscreen/maximized
      mode and application was not ready to dynamically update screen
      dimensions.
    * activate virtual keyboard on double click instead of click.
      It allows to hide virtual keyboard and control program using mouse
      and touch events.

  * src/rtl/gtwvt/gtwvt.c
    + added support for HB_K_MENU

  * src/rtl/gtxwc/gtxwc.c
    * use macros instead of constant values
    + added support for HB_K_MENU
    * reload font after HB_GTI_FONTSIZE (compatible with other graphic GTs)
    * eliminated recursive mutex XLIB locks in HB_GTI_FONTSEL
    * discard existing graphics characters and redraw console window contents
      after HB_GTI_FONTATTRIBUTE

  * tests/gtkeys.prg
    + added support for HB_K_MENU and HB_K_TERMINATE
This commit is contained in:
Przemysław Czerpak
2015-01-14 13:00:13 +01:00
parent 6f3cc11e48
commit 603063cd0d
6 changed files with 144 additions and 26 deletions

View File

@@ -10,6 +10,45 @@
* Change, ! Fix, % Optimization, + Addition, - Removal, ; Comment
*/
2015-01-14 13:00 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
* contrib/hbwin/olecore.c
+ added new PRG function to control empty date conversion to OLE variant:
__oleVariantNullDate( [<lNewNullFlag>] ) -> <lPrevNullFlag>
This is per thread switch and by default initialized to .F. for each
new thread. When set to .T. Harbour empty dates are translated to
VT_NULL.
Warning: it's possible that this function will be removed or replaced
by other solution in the future.
* contrib/gtqtc/gtqtc1.cpp
* emulate CTRL by setting SHIFT + ALT in Android builds
(It's temporary solution - my patch with support for CTRL in
Android QT builds has been accepted so it should be included
in next Qt releases)
% set Qt::WA_NoSystemBackground
* do not change number of rows and cols in maximized and fullscreen mode
when font is changed and resize mode set to HB_GTI_RESIZEMODE_FONT.
It was creating problems when user switched to fullscreen/maximized
mode and application was not ready to dynamically update screen
dimensions.
* activate virtual keyboard on double click instead of click.
It allows to hide virtual keyboard and control program using mouse
and touch events.
* src/rtl/gtwvt/gtwvt.c
+ added support for HB_K_MENU
* src/rtl/gtxwc/gtxwc.c
* use macros instead of constant values
+ added support for HB_K_MENU
* reload font after HB_GTI_FONTSIZE (compatible with other graphic GTs)
* eliminated recursive mutex XLIB locks in HB_GTI_FONTSEL
* discard existing graphics characters and redraw console window contents
after HB_GTI_FONTATTRIBUTE
* tests/gtkeys.prg
+ added support for HB_K_MENU and HB_K_TERMINATE
2015-01-09 19:19 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
* src/rdd/dbf1.c
* minor foramtting

View File

@@ -1505,6 +1505,11 @@ static int hb_gt_qtc_getKeyFlags( Qt::KeyboardModifiers keyFlags )
if( keyFlags & Qt::KeypadModifier ) iFlags |= HB_KF_KEYPAD;
#ifdef HB_OS_DARWIN
if( keyFlags & Qt::MetaModifier ) iFlags |= HB_KF_CTRL;
#elif defined( HB_OS_ANDROID )
if( ( keyFlags & Qt::AltModifier ) != 0 &&
( keyFlags & Qt::ShiftModifier ) != 0 &&
( keyFlags & Qt::ControlModifier ) == 0 )
iFlags = ( iFlags & ~( HB_KF_ALT | HB_KF_SHIFT ) ) | HB_KF_CTRL;
#endif
return iFlags;
@@ -2552,6 +2557,7 @@ QTConsole::QTConsole( PHB_GTQTC pStructQTC, QWidget *parent ) : QWidget( parent
setAttribute( Qt::WA_StaticContents );
setAttribute( Qt::WA_OpaquePaintEvent );
setAttribute( Qt::WA_NoSystemBackground );
/* Warning! Qt::WA_KeyCompression attribute creates problems when
* barcode readers are used - some characters are eaten [druzus]
*/
@@ -2688,9 +2694,7 @@ void QTConsole::setFontSize( int iFH, int iFW )
if( pQTC->fRepaint )
{
hb_gt_qtc_resetBoxCharBitmaps( pQTC );
if( ! image->isNull() &&
( pQTC->iResizeMode == HB_GTI_RESIZEMODE_ROWS ||
( pQTC->qWnd->windowState() & ( Qt::WindowMaximized | Qt::WindowFullScreen ) ) != 0 ) )
if( ! image->isNull() && pQTC->iResizeMode == HB_GTI_RESIZEMODE_ROWS )
hb_gt_qtc_setWindowSize( pQTC, pQTC->qWnd->height() / pQTC->cellY,
pQTC->qWnd->width() / pQTC->cellX );
}
@@ -3058,6 +3062,12 @@ void QTConsole::mouseDoubleClickEvent( QMouseEvent * event )
switch( event->button() )
{
case Qt::LeftButton:
#if defined( HB_OS_ANDROID ) || defined( HB_OS_WIN_CE )
{
QEvent reqSIPevent( QEvent::RequestSoftwareInputPanel );
QApplication::sendEvent( pQTC->qWnd, &reqSIPevent );
}
#endif
iKey = K_LDBLCLK;
break;
@@ -3084,12 +3094,6 @@ void QTConsole::mousePressEvent( QMouseEvent * event )
switch( event->button() )
{
case Qt::LeftButton:
#if defined( HB_OS_ANDROID ) || defined( HB_OS_WIN_CE )
{
QEvent reqSIPevent( QEvent::RequestSoftwareInputPanel );
QApplication::sendEvent( pQTC->qWnd, &reqSIPevent );
}
#endif
iKey = K_LBUTTONDOWN;
break;

View File

@@ -87,6 +87,7 @@ typedef struct
typedef struct
{
HRESULT lOleError;
HB_BOOL fNullDate;
int iInit;
} HB_OLEDATA, * PHB_OLEDATA;
@@ -132,13 +133,23 @@ void hb_oleSetError( HRESULT lOleError )
hb_getOleData()->lOleError = lOleError;
}
HRESULT hb_oleGetError( void )
{
return hb_getOleData()->lOleError;
}
static void hb_oleSetNullDateFlag( HB_BOOL fNullDate )
{
hb_getOleData()->fNullDate = fNullDate;
}
static HB_BOOL hb_oleGetNullDateFlag( void )
{
return hb_getOleData()->fNullDate;
}
static void hb_olecore_init( void * cargo )
{
HB_SYMBOL_UNUSED( cargo );
@@ -605,25 +616,54 @@ static void hb_oleItemToVariantRef( VARIANT * pVariant, PHB_ITEM pItem,
break;
case HB_IT_DATE:
V_VT( pVariant ) = VT_DATE;
V_R8( pVariant ) = ( double ) ( hb_itemGetDL( pItem ) - HB_OLE_DATE_BASE );
if( pVarRef )
{
long lDate = hb_itemGetDL( pItem );
if( lDate == 0 && hb_oleGetNullDateFlag() )
{
V_VT( pVarRef ) = VT_DATE | VT_BYREF;
V_R8REF( pVarRef ) = &V_R8( pVariant );
V_VT( pVariant ) = VT_NULL;
if( pVarRef )
{
V_VT( pVarRef ) = VT_VARIANT | VT_BYREF;
V_VARIANTREF( pVarRef ) = pVariant;
}
}
else
{
V_VT( pVariant ) = VT_DATE;
V_R8( pVariant ) = ( double ) ( lDate - HB_OLE_DATE_BASE );
if( pVarRef )
{
V_VT( pVarRef ) = VT_DATE | VT_BYREF;
V_R8REF( pVarRef ) = &V_R8( pVariant );
}
}
break;
}
case HB_IT_TIMESTAMP:
V_VT( pVariant ) = VT_DATE;
V_R8( pVariant ) = hb_itemGetTD( pItem ) - HB_OLE_DATE_BASE;
if( pVarRef )
{
double dDate = hb_itemGetTD( pItem );
if( dDate == 0 && hb_oleGetNullDateFlag() )
{
V_VT( pVarRef ) = VT_DATE | VT_BYREF;
V_R8REF( pVarRef ) = &V_R8( pVariant );
V_VT( pVariant ) = VT_NULL;
if( pVarRef )
{
V_VT( pVarRef ) = VT_VARIANT | VT_BYREF;
V_VARIANTREF( pVarRef ) = pVariant;
}
}
else
{
V_VT( pVariant ) = VT_DATE;
V_R8( pVariant ) = dDate - HB_OLE_DATE_BASE;
if( pVarRef )
{
V_VT( pVarRef ) = VT_DATE | VT_BYREF;
V_R8REF( pVarRef ) = &V_R8( pVariant );
}
}
break;
}
case HB_IT_POINTER:
{
IDispatch * pDisp;
@@ -2330,6 +2370,13 @@ HB_FUNC( __OLEVARIANTNEW )
hb_errRT_OLE( EG_ARG, 1018, 0, NULL, HB_ERR_FUNCNAME, NULL );
}
/* __oleVariantNullDate( [<lNewNullFlag>] ) -> <lPrevNullFlag> */
HB_FUNC( __OLEVARIANTNULLDATE )
{
hb_retl( hb_oleGetNullDateFlag() );
if( HB_ISLOG( 1 ) )
hb_oleSetNullDateFlag( hb_parl( 1 ) );
}
HB_CALL_ON_STARTUP_BEGIN( _hb_olecore_init_ )
hb_vmAtInit( hb_olecore_init, NULL );

View File

@@ -2567,6 +2567,11 @@ static HB_BOOL hb_gt_wvt_KeyEvent( PHB_GTWVT pWVT, UINT message, WPARAM wParam,
if( ( iFlags & HB_KF_CTRL ) != 0 && ( iFlags & HB_KF_SHIFT ) != 0 )
iKey = '?';
break;
#endif
#ifdef VK_APPS
case VK_APPS:
iKey = HB_K_MENU;
break;
#endif
}
if( iKeyPad != 0 )

View File

@@ -81,7 +81,7 @@ static HB_GT_FUNCS SuperTable;
static const int s_mousePressKeys [ XWC_MAX_BUTTONS ] = { K_LBUTTONDOWN, K_MBUTTONDOWN, K_RBUTTONDOWN, K_MWFORWARD, K_MWBACKWARD };
static const int s_mouseReleaseKeys [ XWC_MAX_BUTTONS ] = { K_LBUTTONUP, K_MBUTTONUP, K_RBUTTONUP };
static const int s_mouseDblPressKeys[ XWC_MAX_BUTTONS ] = { K_LDBLCLK, K_MDBLCLK, K_RDBLCLK , K_MWFORWARD, K_MWBACKWARD };
static const int s_mouseButtonBits [ XWC_MAX_BUTTONS ] = { 1, 4, 2 };
static const int s_mouseButtonBits [ XWC_MAX_BUTTONS ] = { 1 << HB_MBUTTON_LEFT, 1 << HB_MBUTTON_MIDDLE, 1 << HB_MBUTTON_RIGHT };
/* these are standard PC console colors in RGB */
static const int s_rgb_values[] = {
@@ -2853,6 +2853,10 @@ static void hb_gt_xwc_ProcessKey( PXWND_DEF wnd, XKeyEvent * evt )
case XK_Print:
ikey = HB_KX_PRTSCR;
break;
case XK_Menu:
ikey = HB_K_MENU;
break;
}
if( ikey )
{
@@ -5240,7 +5244,15 @@ static HB_BOOL hb_gt_xwc_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo )
pInfo->pResult = hb_itemPutNI( pInfo->pResult, wnd->fontHeight );
iVal = hb_itemGetNI( pInfo->pNewVal );
if( iVal > 0 ) /* TODO */
{
wnd->fontHeight = iVal;
if( wnd->fInit )
{
hb_gt_xwc_SetFont( wnd, wnd->szFontName, wnd->fontWeight,
wnd->fontHeight, wnd->szFontEncoding );
hb_gt_xwc_CreateWindow( wnd );
}
}
break;
case HB_GTI_FONTWIDTH:
@@ -5279,11 +5291,13 @@ static HB_BOOL hb_gt_xwc_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo )
pInfo->pResult = hb_itemPutC( pInfo->pResult, wnd->szFontSel );
if( hb_itemType( pInfo->pNewVal ) & HB_IT_STRING )
{
HB_BOOL fInit;
HB_XWC_XLIB_LOCK();
if( hb_gt_xwc_SetFont( wnd, hb_itemGetCPtr( pInfo->pNewVal ), 0, 0, NULL ) &&
wnd->fInit )
hb_gt_xwc_CreateWindow( wnd );
fInit = hb_gt_xwc_SetFont( wnd, hb_itemGetCPtr( pInfo->pNewVal ), 0, 0, NULL ) &&
wnd->fInit;
HB_XWC_XLIB_UNLOCK();
if( fInit )
hb_gt_xwc_CreateWindow( wnd );
}
break;
@@ -5298,6 +5312,13 @@ static HB_BOOL hb_gt_xwc_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo )
wnd->fFixMetric = ( iVal & HB_GTI_FONTA_FIXMETRIC ) != 0;
wnd->fClearBkg = ( iVal & HB_GTI_FONTA_CLRBKG ) != 0;
wnd->fDrawBox = ( iVal & HB_GTI_FONTA_DRAWBOX ) != 0;
if( wnd->fInit )
{
HB_XWC_XLIB_LOCK();
hb_gt_xwc_ResetCharTrans( wnd );
hb_gt_xwc_InvalidateFull( wnd, 0, 0, wnd->cols - 1, wnd->rows );
HB_XWC_XLIB_UNLOCK();
}
}
break;

View File

@@ -241,6 +241,8 @@ PROCEDURE Main( cTermCP, cHostCP, lBoxChar )
AAdd( aKeys, { "HB_K_LOSTFOCUS", 1104, "focus lost" } )
AAdd( aKeys, { "HB_K_CONNECT", 1105, "remote terminal connected" } )
AAdd( aKeys, { "HB_K_DISCONNECT", 1106, "remote terminal disconnected" } )
AAdd( aKeys, { "HB_K_TERMINATE", 1107, "terminate signal from system" } )
AAdd( aKeys, { "HB_K_MENU", 1108, "MENU key pressed" } )
#ifdef __HARBOUR__