2009-04-24 15:41 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com)

* harbour/contrib/gtqtc/gtqtc.cpp
  * harbour/contrib/gtqtc/gtqtc.h
  * harbour/contrib/gtqtc/moc_gtqtc.cpp
  * harbour/contrib/gtqtc/tests/wvtext.prg
    ! Code cleanup.
    ! Adopted KDE's calss variable naming convention. 
      Class variables now begin with "_" (underscore character).
      Please follow this convention strictly. 
    + IMPLEMENTED : hb_gtInfo( HB_GTI_RESIZEMODE, HB_GTI_RESIZEMODE_ROWS ).
    ! Tweaked caret implementation.
    ! Renamed :consoleArea => :drawingArea. More natural for hbqtxbp.lib.
     
    /* Please try like this:

       1.       
       - Execute wvtext.exe
       - Press F10 -> New Window
       - Press <ESC> -> Boooooom GPF (inkey(0))
 
       2.
       - Execute wvtext.exe
       - Press F10 -> New Window
       - Click on Main Window
       - Click on New Window
       - Press <ESC> -> Normal Exit
 
       I am trying to find why to click on Main Window for 
       closing the New Window. I have not been able to reach any 
       logical reasoning. Help is requested.

       Play : Resize New Window - Browser expands by rows and columns.
    */
This commit is contained in:
Pritpal Bedi
2009-04-24 22:56:18 +00:00
parent a237fe6654
commit 1df277f513
5 changed files with 674 additions and 532 deletions

View File

@@ -8,6 +8,40 @@
2009-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org)
*/
2009-04-24 15:41 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com)
* harbour/contrib/gtqtc/gtqtc.cpp
* harbour/contrib/gtqtc/gtqtc.h
* harbour/contrib/gtqtc/moc_gtqtc.cpp
* harbour/contrib/gtqtc/tests/wvtext.prg
! Code cleanup.
! Adopted KDE's calss variable naming convention.
Class variables now begin with "_" (underscore character).
Please follow this convention strictly.
+ IMPLEMENTED : hb_gtInfo( HB_GTI_RESIZEMODE, HB_GTI_RESIZEMODE_ROWS ).
! Tweaked caret implementation.
! Renamed :consoleArea => :drawingArea. More natural for hbqtxbp.lib.
/* Please try like this:
1.
- Execute wvtext.exe
- Press F10 -> New Window
- Press <ESC> -> Boooooom GPF (inkey(0))
2.
- Execute wvtext.exe
- Press F10 -> New Window
- Click on Main Window
- Click on New Window
- Press <ESC> -> Normal Exit
I am trying to find why to click on Main Window for
closing the New Window. I have not been able to reach any
logical reasoning. Help is requested.
Play : Resize New Window - Browser expands by rows and columns.
*/
2009-04-25 01:35 UTC+0300 Mindaugas Kavaliauskas (dbtopas/at/dbtopas.lt)
* harbour/contrib/hbole/olecore.c
! fixed C++ compile errors

File diff suppressed because it is too large Load Diff

View File

@@ -181,16 +181,15 @@ void hb_ToOutDebug( const char * sTraceMsg, ... );
class MainWindow;
class ConsoleArea : public QWidget
class DrawingArea : public QWidget
{
Q_OBJECT
public:
ConsoleArea(QWidget *parent = 0);
DrawingArea(QWidget *parent = 0);
PHB_GT pGT;
QRgb COLORS[ 16 ];
void resetWindowSize(void);
void redrawBuffer(const QRect & rect );
@@ -200,25 +199,29 @@ public:
void setCaretPos(int iRow, int iCol);
void destroyCaret();
void displayCell( int iCol, int iRow );
void displayBlock( int iCol, int iRow );
void displayCell(int iCol, int iRow);
void displayBlock(int iCol, int iRow);
void resizeImage(const QSize &newSize);
int fontHeight;
int fontWidth;
int fontAscent;
QRgb _COLORS[ 16 ];
int ROWS, COLS;
int windowWidth, windowHeight;
int _fontHeight;
int _fontWidth;
int _fontAscent;
int pu_crtHeight;
int pu_crtWidth;
bool pu_bBlinking;
int pu_crtLastRow;
int pu_crtLastCol;
int _iROWS, _iCOLS;
int _wndWidth, _wndHeight;
bool bFirst;
bool bSizing;
int _crtHeight;
int _crtWidth;
bool _bBlinking;
int _crtLastRow;
int _crtLastCol;
bool _bFirst;
bool _bSizing;
QBasicTimer *_basicTimer;
char buf[ 80 ];
@@ -239,9 +242,8 @@ protected:
bool event(QEvent *event);
private:
QFont qFont;
QBasicTimer *pv_timer;
QImage *image;
QFont _qFont;
QImage *_image;
};
/*----------------------------------------------------------------------*/
@@ -253,7 +255,7 @@ class MainWindow : public QMainWindow
public:
MainWindow();
ConsoleArea *consoleArea;
DrawingArea *_drawingArea;
PHB_GT pGT;
void setWindowSize( void );
@@ -314,7 +316,7 @@ typedef struct
int CodePage; /* Code page to use for display characters */
bool AltF4Close; /* Can use Alt+F4 to close application */
bool CentreWindow; /* True if window is to be Reset into centre of window */
bool CenterWindow; /* True if window is to be Reset into centre of window */
bool bMaximized; /* Flag is set when window has been maximized */
bool bBeingMarked; /* Flag to control DOS window like copy operation */
@@ -331,6 +333,30 @@ typedef struct
} HB_GTWVT, * PHB_GTWVT;
/*
* The code below is pulled from KDE distribution.
* Experimental: do not know yet if it will be used in future or not.
*/
static const quint32 LineChars[] = {
0x00007c00, 0x000fffe0, 0x00421084, 0x00e739ce, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00427000, 0x004e7380, 0x00e77800, 0x00ef7bc0,
0x00421c00, 0x00439ce0, 0x00e73c00, 0x00e7bde0, 0x00007084, 0x000e7384, 0x000079ce, 0x000f7bce,
0x00001c84, 0x00039ce4, 0x00003dce, 0x0007bdee, 0x00427084, 0x004e7384, 0x004279ce, 0x00e77884,
0x00e779ce, 0x004f7bce, 0x00ef7bc4, 0x00ef7bce, 0x00421c84, 0x00439ce4, 0x00423dce, 0x00e73c84,
0x00e73dce, 0x0047bdee, 0x00e7bde4, 0x00e7bdee, 0x00427c00, 0x0043fce0, 0x004e7f80, 0x004fffe0,
0x004fffe0, 0x00e7fde0, 0x006f7fc0, 0x00efffe0, 0x00007c84, 0x0003fce4, 0x000e7f84, 0x000fffe4,
0x00007dce, 0x0007fdee, 0x000f7fce, 0x000fffee, 0x00427c84, 0x0043fce4, 0x004e7f84, 0x004fffe4,
0x00427dce, 0x00e77c84, 0x00e77dce, 0x0047fdee, 0x004e7fce, 0x00e7fde4, 0x00ef7f84, 0x004fffee,
0x00efffe4, 0x00e7fdee, 0x00ef7fce, 0x00efffee, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x000f83e0, 0x00a5294a, 0x004e1380, 0x00a57800, 0x00ad0bc0, 0x004390e0, 0x00a53c00, 0x00a5a1e0,
0x000e1384, 0x0000794a, 0x000f0b4a, 0x000390e4, 0x00003d4a, 0x0007a16a, 0x004e1384, 0x00a5694a,
0x00ad2b4a, 0x004390e4, 0x00a52d4a, 0x00a5a16a, 0x004f83e0, 0x00a57c00, 0x00ad83e0, 0x000f83e4,
0x00007d4a, 0x000f836a, 0x004f93e4, 0x00a57d4a, 0x00ad836a, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00001c00, 0x00001084, 0x00007000, 0x00421000,
0x00039ce0, 0x000039ce, 0x000e7380, 0x00e73800, 0x000e7f80, 0x00e73884, 0x0003fce0, 0x004239ce
};
/*----------------------------------------------------------------------*/

View File

@@ -1,7 +1,7 @@
/****************************************************************************
** Meta object code from reading C++ file 'gtqtc.h'
**
** Created: Thu Apr 23 00:08:40 2009
** Created: Fri Apr 24 14:36:06 2009
** by: The Qt Meta Object Compiler version 61 (Qt 4.5.0)
**
** WARNING! All changes made in this file will be lost!
@@ -17,7 +17,7 @@
#endif
QT_BEGIN_MOC_NAMESPACE
static const uint qt_meta_data_ConsoleArea[] = {
static const uint qt_meta_data_DrawingArea[] = {
// content:
2, // revision
@@ -31,29 +31,29 @@ static const uint qt_meta_data_ConsoleArea[] = {
0 // eod
};
static const char qt_meta_stringdata_ConsoleArea[] = {
"ConsoleArea\0"
static const char qt_meta_stringdata_DrawingArea[] = {
"DrawingArea\0"
};
const QMetaObject ConsoleArea::staticMetaObject = {
{ &QWidget::staticMetaObject, qt_meta_stringdata_ConsoleArea,
qt_meta_data_ConsoleArea, 0 }
const QMetaObject DrawingArea::staticMetaObject = {
{ &QWidget::staticMetaObject, qt_meta_stringdata_DrawingArea,
qt_meta_data_DrawingArea, 0 }
};
const QMetaObject *ConsoleArea::metaObject() const
const QMetaObject *DrawingArea::metaObject() const
{
return &staticMetaObject;
}
void *ConsoleArea::qt_metacast(const char *_clname)
void *DrawingArea::qt_metacast(const char *_clname)
{
if (!_clname) return 0;
if (!strcmp(_clname, qt_meta_stringdata_ConsoleArea))
return static_cast<void*>(const_cast< ConsoleArea*>(this));
if (!strcmp(_clname, qt_meta_stringdata_DrawingArea))
return static_cast<void*>(const_cast< DrawingArea*>(this));
return QWidget::qt_metacast(_clname);
}
int ConsoleArea::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
int DrawingArea::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QWidget::qt_metacall(_c, _id, _a);
if (_id < 0)

View File

@@ -2,17 +2,17 @@
* $Id$
*/
//----------------------------------------------------------------------//
//----------------------------------------------------------------------//
//----------------------------------------------------------------------//
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
//
// [x]Harbour Extended Features Deno
// .
// Pritpal Bedi <pritpal@vouchcac.com>
//
//----------------------------------------------------------------------//
//----------------------------------------------------------------------//
//----------------------------------------------------------------------//
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
#include "hbgtinfo.ch"
#include "inkey.ch"
@@ -21,24 +21,19 @@
#define RGB(r,g,b) ( r + ( g * 256 ) + ( b * 256 * 256 ) )
//----------------------------------------------------------------------//
// To be in hbgtinfo.ch
//
#define HB_GTI_SETPARENT 101
#define HB_GTI_WINHANDLE 102
//----------------------------------------------------------------------//
/*----------------------------------------------------------------------*/
STATIC nRows := 20, nCols := 60, nColorIndex := 1
//----------------------------------------------------------------------//
/*----------------------------------------------------------------------*/
FUNCTION Main()
Local nKey, lMark, lResize, lClose
Local nHeight := 20
Local nWidth := Int( nHeight/2 )
Local cFont
SET SCOREBOARD OFF
Hb_GtInfo( HB_GTI_FONTNAME , cFont )
Hb_GtInfo( HB_GTI_FONTWIDTH, nWidth )
Hb_GtInfo( HB_GTI_FONTSIZE , nHeight )
@@ -79,7 +74,7 @@ FUNCTION Main()
SetPalette( 0 )
CASE nKey == K_F7
SetPaletteIndex()
GetAVariable()
CASE nKey == K_F8
Alert( "Menu text changed. Was: " + hb_GtInfo( HB_GTI_SELECTCOPY, DToS(Date()) + " " + Time() ) )
@@ -91,7 +86,7 @@ FUNCTION Main()
ENDDO
RETURN NIL
//----------------------------------------------------------------------//
/*----------------------------------------------------------------------*/
STATIC FUNCTION MyNotifier( nEvent, ... )
DO CASE
@@ -113,7 +108,7 @@ STATIC FUNCTION MyNotifier( nEvent, ... )
ENDCASE
RETURN 0
//----------------------------------------------------------------------//
/*----------------------------------------------------------------------*/
STATIC FUNCTION DispScreen()
Local nRow := 12, nCol := 28
Local cColor := "N/W"
@@ -136,7 +131,7 @@ STATIC FUNCTION DispScreen()
DispOutAt( ++nRow, nCol, "< F4 Closable Toggle >", cColor )
DispOutAt( ++nRow, nCol, "< F5 Palette L Repeat >", cColor )
DispOutAt( ++nRow, nCol, "< F6 Palette D Repeat >", cColor )
DispOutAt( ++nRow, nCol, "< F7 Palette By Index R >", cColor )
DispOutAt( ++nRow, nCol, "< F7 Get a Variable >", cColor )
DispOutAt( ++nRow, nCol, "< F8 MarkCopy menu text >", cColor )
DispOutAt( ++nRow, nCol, "< Click Other Window >", cColor )
DispOutAt( ++nRow, nCol, "< Click X Button >", cColor )
@@ -151,11 +146,11 @@ STATIC FUNCTION DispScreen()
DispEnd()
RETURN NIL
//----------------------------------------------------------------------//
/*----------------------------------------------------------------------*/
PROCEDURE HB_GTSYS()
REQUEST HB_GT_QTC_DEFAULT
RETURN
//----------------------------------------------------------------------//
/*----------------------------------------------------------------------*/
FUNCTION SetPalette( nMode )
Local aPalette := Hb_GtInfo( HB_GTI_PALETTE )
@@ -175,24 +170,22 @@ FUNCTION SetPalette( nMode )
DispScreen()
RETURN NIL
//----------------------------------------------------------------------//
/*----------------------------------------------------------------------*/
FUNCTION SetPaletteIndex()
Hb_GtInfo( HB_GTI_PALETTE, 8, RGB( 120, 200, 240 ) )
DispScreen()
RETURN NIL
//----------------------------------------------------------------------//
/*----------------------------------------------------------------------*/
PROCEDURE thFunc()
Local cTitle, oBrowse, lEnd, nKey, i, aStruct, pGT1, pGT
Local aColor := { 'W+/N', 'W+/B', 'W+/G', 'W+/BG', 'W+/N*', 'W+/RB', 'N/W*', 'N/GR*' }
Local aColor := { 'W+/B', 'W+/G', 'W+/BG', 'W+/N*', 'W+/RB', 'N/W*', 'N/GR*', 'W+/N' }
static nBrowser := 0
static nZx := 0
static nZy := 0
nColorIndex := 1
ErrorBlock( {|oErr| MyErrorSys( oErr ) } )
nBrowser++
@@ -252,6 +245,8 @@ PROCEDURE thFunc()
oBrowse:configure()
HB_GtInfo( HB_GTI_NOTIFIERBLOCK, {|nEvent, ...| MyBrwNotifier( nEvent, oBrowse, ... ) } )
lEnd := .f.
While !lEnd
oBrowse:ForceStable()
@@ -261,29 +256,11 @@ PROCEDURE thFunc()
if BrwHandleKey( oBrowse, nKey, @lEnd )
//
else
if nKey == HB_K_RESIZE
cTitle := 'New Window with '+ltrim( str( MaxRow() ) )+;
' Rows and '+ltrim( str( MaxCol() ) )+' Columns'
DispOutAt( 0, 0, padc( cTitle, maxcol()+1 ), 'N/GR*' )
cTitle := '<F11> Modal Dialog <ReSize> <Maximize> <ESC>'
DispOutAt( MaxRow(), 0, padc( cTitle, maxcol()+1 ), 'W+/R*' )
oBrowse:nBottom := MaxRow()-1
oBrowse:nRight := MaxCol()
oBrowse:Configure()
oBrowse:RefreshAll()
elseif nKey == K_F11
// Initialization Phase . Can be a Dialog Class
// LIKE in Xbase++:
// oWnd := gtDialog():New( oParent, oOwner, aSize, aPos, aPresParam, lVisible )
//
// hWnd := hb_gtInfo( HB_GTI_WINHANDLE )
if nKey == K_F11
pGT1 := hb_gtCreate( 'QTC' )
pGT := hb_gtSelect( pGT1 )
SetMode( 7,40 )
// hb_gtInfo( HB_GTI_SETPARENT , hWnd )
hb_gtInfo( HB_GTI_SETPOS_ROWCOL , 4, 8 )
hb_gtInfo( HB_GTI_WINTITLE , 'Modal Dialog [ Row:4 Col:8 ]' )
hb_gtInfo( HB_GTI_RESIZABLE , .F. )
@@ -307,7 +284,29 @@ PROCEDURE thFunc()
DbCloseArea()
RETURN
//----------------------------------------------------------------------//
/*----------------------------------------------------------------------*/
STATIC FUNCTION MyBrwNotifier( nEvent, oBrowse, ... )
LOCAL cTitle
DO CASE
CASE nEvent == HB_GTE_RESIZED
cTitle := 'New Window with '+ltrim( str( MaxRow() ) )+;
' Rows and '+ltrim( str( MaxCol() ) )+' Columns'
DispOutAt( 0, 0, padc( cTitle, maxcol()+1 ), 'N/GR*' )
cTitle := '<F11> Modal Dialog <ReSize> <Maximize> <ESC>'
DispOutAt( MaxRow(), 0, padc( cTitle, maxcol()+1 ), 'W+/R*' )
oBrowse:nBottom := MaxRow()-1
oBrowse:nRight := MaxCol()
oBrowse:configure()
oBrowse:refreshAll()
oBrowse:forceStable()
ENDCASE
RETURN 0
/*----------------------------------------------------------------------*/
STATIC FUNCTION DbSkipBlock( n, oTbr )
LOCAL nSkipped := 0
@@ -326,7 +325,7 @@ STATIC FUNCTION DbSkipBlock( n, oTbr )
endif
RETURN nSkipped
//-------------------------------------------------------------------//
/*----------------------------------------------------------------------*/
STATIC FUNCTION TBNext( oTbr )
LOCAL nSaveRecNum := recno()
@@ -343,7 +342,7 @@ STATIC FUNCTION TBNext( oTbr )
endif
RETURN lMoved
//-------------------------------------------------------------------//
/*----------------------------------------------------------------------*/
STATIC FUNCTION TBPrev( oTbr )
LOCAL nSaveRecNum := Recno()
LOCAL lMoved := .T.
@@ -356,10 +355,10 @@ STATIC FUNCTION TBPrev( oTbr )
endif
RETURN lMoved
//-------------------------------------------------------------------//
/*----------------------------------------------------------------------*/
STATIC FUNCTION BlockField( i )
RETURN {|| fieldget( i ) }
//-------------------------------------------------------------------//
/*----------------------------------------------------------------------*/
STATIC FUNCTION BrwHandleKey( oBrowse, nKey, lEnd )
LOCAL lRet := .t.
@@ -424,7 +423,7 @@ STATIC FUNCTION BrwHandleKey( oBrowse, nKey, lEnd )
endcase
RETURN lRet
//-------------------------------------------------------------------//
/*----------------------------------------------------------------------*/
PROCEDURE MyErrorSys( oError )
? oError:Description
@@ -440,4 +439,18 @@ PROCEDURE MyErrorSys( oError )
enddo
RETURN
//----------------------------------------------------------------------//
/*----------------------------------------------------------------------*/
STATIC FUNCTION GetAVariable()
LOCAL getlist := {}
LOCAL cVrb := space( 20 )
LOCAL cVrb1 := space( 20 )
LOCAL xScr := SaveScreen( 9,30,10,50 )
@ 9,30 GET cVrb COLOR 'W+/B*'
@10,30 GET cVrb1 COLOR 'W+/B*'
READ
RestScreen( 9,30,10,50, xScr )
RETURN NIL
/*----------------------------------------------------------------------*/