2009-11-17 17:26 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com)

* contrib/hbide/hbide.prg
  + contrib/hbide/resources/builderror.png
  * contrib/hbide/resources/gotomark.png
  + contrib/hbide/resources/modulelist.png

  * contrib/hbqt/hbqt_slots.cpp
  * contrib/hbqt/hbqt_slots.h
  * contrib/hbqt/moc_slots.cpp

  * contrib/hbxbp/xbpgeneric.prg
  * contrib/hbxbp/xbptabpage.prg
    + Implemented first 4 icons operational. 
      Now, at least you can open/edit/save .prg .c .ch .h files.
      I am interested in any bugs you may encounter in the process.
      Few HBXBP calasses have also been updated in the process.

    QUESTION: How good it will be to extend Xbase++ class framework ?
              Is this the ripe time or we need more inputs ?
This commit is contained in:
Pritpal Bedi
2009-11-18 01:31:26 +00:00
parent ee46919af2
commit 10af8e0884
10 changed files with 241 additions and 24 deletions

View File

@@ -17,6 +17,26 @@
past entries belonging to author(s): Viktor Szakats.
*/
2009-11-17 17:26 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com)
* contrib/hbide/hbide.prg
+ contrib/hbide/resources/builderror.png
* contrib/hbide/resources/gotomark.png
+ contrib/hbide/resources/modulelist.png
* contrib/hbqt/hbqt_slots.cpp
* contrib/hbqt/hbqt_slots.h
* contrib/hbqt/moc_slots.cpp
* contrib/hbxbp/xbpgeneric.prg
* contrib/hbxbp/xbptabpage.prg
+ Implemented first 4 icons operational.
Now, at least you can open/edit/save .prg .c .ch .h files.
I am interested in any bugs you may encounter in the process.
Few HBXBP calasses have also been updated in the process.
QUESTION: How good it will be to extend Xbase++ class framework ?
Is this the ripe time or we need more inputs ?
2009-11-17 19:37 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/include/Makefile
+ harbour/include/hbapistr.h

View File

@@ -49,6 +49,20 @@
*
*/
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/*
* EkOnkar
* ( The LORD is ONE )
*
* Harbour-Qt IDE
*
* Pritpal Bedi <pritpal@vouchcac.com>
* 17Nov2009
*/
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
#include "common.ch"
#include "xbp.ch"
@@ -99,6 +113,11 @@ PROCEDURE AppSys()
/*----------------------------------------------------------------------*/
PROCEDURE JustACall()
RETURN
/*----------------------------------------------------------------------*/
CLASS HbIde
DATA oDlg
@@ -110,6 +129,7 @@ CLASS HbIde
DATA aTabs INIT {}
DATA cProjFile
DATA oCurTab INIT NIL
DATA nCurTab INIT 0
DATA nPrevTab INIT 0
@@ -126,13 +146,14 @@ CLASS HbIde
METHOD buildToolbar()
METHOD manageToolBar()
METHOD manageMenu()
METHOD editSource()
METHOD buildTabPage()
#if 0
METHOD ()
METHOD ()
METHOD ()
#endif
METHOD editSource()
METHOD selectSource()
METHOD closeSource()
METHOD closeAllSources()
METHOD saveSource()
ENDCLASS
/*----------------------------------------------------------------------*/
@@ -154,7 +175,7 @@ METHOD HbIde:new( cProjectOrSource )
/*----------------------------------------------------------------------*/
METHOD HbIde:create( cProjectOrSource )
LOCAL aSize
//LOCAL aSize
IF hb_isChar( cProjectOrSource )
::cProjFile := cProjectOrSource
@@ -182,11 +203,14 @@ METHOD HbIde:create( cProjectOrSource )
::oDa:oWidget:setLayout( QT_PTROF( ::qLayout ) )
#if 0
/* Obtain desktop dimensions */
aSize := AppDesktop():currentSize()
/* Place on the center of desktop */
::oDlg:setPos( { ( aSize[ 1 ] - ::oDlg:currentSize()[ 1 ] ) / 2, ;
( aSize[ 2 ] - ::oDlg:currentSize()[ 2 ] ) / 2 } )
#endif
::oDlg:setPos( { 100, 60 } )
/* Editor's Font */
::oFont := XbpFont():new()
@@ -209,9 +233,22 @@ METHOD HbIde:create( cProjectOrSource )
/* Enter Xbase++ Event Loop - working */
DO WHILE .t.
::nEvent := AppEvent( @::mp1, @::mp2, @::oXbp )
IF ( ::nEvent == xbeP_Close ) .OR. ( ::nEvent == xbeP_Keyboard .and. ::mp1 == xbeK_ESC )
IF ::nEvent == xbeP_Quit
EXIT
ENDIF
IF ( ::nEvent == xbeP_Close ) .OR. ( ::nEvent == xbeP_Keyboard .and. ::mp1 == xbeK_ESC )
IF ::nEvent == xbeP_Close
::closeAllSources()
EXIT
ELSE
::closeSource( ::nCurTab, .t. )
IF empty( ::aTabs )
EXIT
ENDIF
ENDIF
ENDIF
::oXbp:handleEvent( ::nEvent, ::mp1, ::mp2 )
ENDDO
@@ -238,7 +275,7 @@ METHOD HbIde:buildDialog()
METHOD HbIde:buildTabPage( oWnd, cSource )
LOCAL aPos := { 5,5 }
LOCAL aSize := { 890, 420 }
LOCAL oTab
LOCAL oTab, o
LOCAL cPath, cFile, cExt//, qIcon
LOCAL nIndex := len( ::aTabs )
@@ -259,6 +296,10 @@ METHOD HbIde:buildTabPage( oWnd, cSource )
ENDIF
::oDa:oTabWidget:oWidget:setTabTooltip( nIndex, cSource )
oTab:tabActivate := {|mp1,mp2,oXbp| HB_SYMBOL_UNUSED( mp1 ), o := oXbp, ;
mp2 := ascan( ::aTabs, {|e_| e_[ 1 ] == o } ), ::nCurTab := mp2 }
oTab:closeRequested := {|mp1,mp2,oXbp| HB_SYMBOL_UNUSED( mp1 ), o := oXbp, ;
mp2 := ascan( ::aTabs, {|e_| e_[ 1 ] == o } ), ::nCurTab := mp2, ::closeSource( ::nCurTab, .t. ) }
RETURN oTab
/*----------------------------------------------------------------------*/
@@ -272,7 +313,7 @@ METHOD HbIde:editSource( cSourceFile )
qEdit := QTextEdit():new( QT_PTROFXBP( oTab ) )
qEdit:setLineWrapMode( QTextEdit_NoWrap )
qEdit:setPlainText( memoread( ::cProjFile ) )
qEdit:setPlainText( memoread( cSourceFile ) )
qEdit:setFont( QT_PTROFXBP( ::oFont ) )
qEdit:setTextBackgroundColor( QT_PTROF( QColor():new( 255,255,255 ) ) )
@@ -291,11 +332,96 @@ METHOD HbIde:editSource( cSourceFile )
::nPrevTab := ::nCurTab
::nCurTab := len( ::aTabs )
::oDa:oTabWidget:oWidget:setCurrentIndex( ::nCurTab - 1 )
RETURN Self
/*----------------------------------------------------------------------*/
METHOD HbIde:saveSource( nTab )
LOCAL cBuffer
LOCAL qDocument := QTextDocument():configure( ::aTabs[ nTab, 2 ]:document() )
IF qDocument:isModified()
HBXBP_DEBUG( "Document be Saved", "YES", ::aTabs[ nTab, 5 ] )
cBuffer := ::aTabs[ nTab, 2 ]:toPlainText()
memowrit( ::aTabs[ nTab, 5 ], cBuffer )
ELSE
HBXBP_DEBUG( "Document Modified", "NO ", ::aTabs[ nTab, 5 ] )
ENDIF
RETURN self
/*----------------------------------------------------------------------*/
METHOD HbIde:closeSource( nTab, lDel )
DEFAULT lDel TO .T.
HBXBP_DEBUG( " . " )
HBXBP_DEBUG( "HbIde:closeSource( nTab, lDel )", nTab, lDel )
IF !empty( ::aTabs ) .and. !empty( nTab )
::saveSource( nTab )
/* Destroy at Qt level */
::oDa:oTabWidget:oWidget:removeTab( nTab - 1 )
/* Destroy at XBP level */
::aTabs[ nTab,1 ]:destroy()
/* Destroy at this object level */
IF lDel
adel( ::aTabs, nTab )
asize( ::aTabs, len( ::aTabs ) - 1 )
ENDIF
IF empty( ::aTabs )
PostAppEvent( xbeP_Quit )
ENDIF
ENDIF
RETURN Self
/*----------------------------------------------------------------------*/
METHOD HbIde:closeAllSources()
LOCAL nTab
FOR nTab := len( ::aTabs ) TO 1 STEP -1
::closeSource( nTab, .f. )
NEXT
::aTabs := {}
RETURN Self
/*----------------------------------------------------------------------*/
METHOD HbIde:selectSource( cMode )
LOCAL oDlg, cFile//, aFiles
oDlg := XbpFileDialog():new():create( ::oDa, , { 10,10 } )
IF cMode == "open"
oDlg:title := "Select a Source File"
oDlg:center := .t.
oDlg:fileFilters := { { "PRG Sources", "*.prg" }, { "C Sources", "*.c" }, { "CPP Sources", "*.cpp" }, ;
{ "H Headers", "*.h" }, { "CH Headers", "*.ch" } }
cFile := oDlg:open( CurDrive() +":\"+ CurDir(), , .f. )
ELSE
oDlg:title := "Save this Database"
oDlg:fileFilters := { { "Database Files", "*.dbf" } }
oDlg:quit := {|| MsgBox( "Quitting the Dialog" ), 1 }
cFile := oDlg:saveAs( "c:\temp\myfile.dbf" )
IF !empty( cFile )
HBXBP_DEBUG( cFile )
ENDIF
ENDIF
RETURN cFile
/*----------------------------------------------------------------------*/
METHOD HbIde:buildMenu()
LOCAL oMenuBar, oSubMenu
@@ -346,9 +472,10 @@ METHOD HbIde:buildToolBar()
::oTBar:addItem( "Build and Launch Project" , s_resPath + "buildlaunch.png" , , , , , "8" )
::oTBar:addItem( "Rebuild Project" , s_resPath + "rebuild.png" , , , , , "9" )
::oTBar:addItem( "Rebuild and Launch Project" , s_resPath + "rebuildlaunch.png" , , , , , "10" )
::oTBar:addItem( "Show/Hide Build Error Info" , s_resPath + "builderror.png" , , , , , "12" )
::oTBar:addItem( "Module Function List" , s_resPath + "modulelist.png" , , , , , "11" )
//
::oTBar:addItem( , , , , , XBPTOOLBAR_BUTTON_SEPARATOR )
//
//
::oTBar:addItem( "Undo" , s_resPath + "undo.png" , , , , , "13" )
::oTBar:addItem( "Redo" , s_resPath + "redo.png" , , , , , "14" )
::oTBar:addItem( , , , , , XBPTOOLBAR_BUTTON_SEPARATOR )
@@ -379,10 +506,20 @@ METHOD HbIde:buildToolBar()
/*----------------------------------------------------------------------*/
METHOD HbIde:manageToolbar( oButton )
LOCAL cFile
DO CASE
CASE oButton:caption == "Save"
CASE oButton:caption == "Open"
CASE oButton:key == "3"
IF !empty( cFile := ::selectSource( "open" ) )
::editSource( cFile )
ENDIF
CASE oButton:key == "4"
::saveSource( ::nCurTab )
CASE oButton:key == "5"
::closeSource( ::nCurTab, .t. )
ENDCASE
RETURN nil
@@ -403,3 +540,4 @@ METHOD HbIde:buildStatusBar()
/*----------------------------------------------------------------------*/


Binary file not shown.

After

Width:  |  Height:  |  Size: 193 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 208 B

After

Width:  |  Height:  |  Size: 203 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 194 B

View File

@@ -1103,6 +1103,11 @@ void Slots::currentCellChanged( int currentRow, int currentColumn, int previousR
QObject *object = qobject_cast<QObject *>( sender() );
SlotsExecIntIntIntInt( object, ( char* ) "currentCellChanged(int,int,int,int)", currentRow, currentColumn, previousRow, previousColumn );
}
void Slots::tabCloseRequested( int index )
{
QObject *object = qobject_cast<QObject *>( sender() );
SlotsExecInt( object, ( char* ) "tabCloseRequested(int)", index );
}
/*
@@ -1687,6 +1692,11 @@ HB_FUNC( QT_CONNECT_SIGNAL )
ret = object->connect( object, SIGNAL( currentCellChanged( int, int, int, int ) ),
s_s, SLOT( currentCellChanged( int, int, int, int ) ), Qt::AutoConnection );
}
if( signal == ( QString ) "tabCloseRequested(int)" )
{
ret = object->connect( object, SIGNAL( tabCloseRequested( int ) ),
s_s, SLOT( tabCloseRequested( int ) ), Qt::AutoConnection );
}
hb_retl( ret );
@@ -1932,6 +1942,8 @@ bool disconnect_signal( QObject * object, const char * signal )
ret = object->disconnect( SIGNAL( cellPressed( int, int ) ) );
if( signal == ( QString ) "currentCellChanged(int,int,int,int)" )
ret = object->disconnect( SIGNAL( currentCellChanged( int, int, int, int ) ) );
if( signal == ( QString ) "tabCloseRequested(int)" )
ret = object->disconnect( SIGNAL( tabCloseRequested( int ) ) );
return ret;
}

View File

@@ -321,6 +321,7 @@ public slots:
void cellEntered( int row, int column );
void cellPressed( int row, int column );
void currentCellChanged( int currentRow, int currentColumn, int previousRow, int previousColumn );
void tabCloseRequested( int index );
};
class Events: public QObject

View File

@@ -1,8 +1,8 @@
/****************************************************************************
** Meta object code from reading C++ file 'hbqt_slots.h'
**
** Created: Sun Nov 15 13:20:23 2009
** by: The Qt Meta Object Compiler version 61 (Qt 4.5.2)
** Created: Tue Nov 17 13:17:44 2009
** by: The Qt Meta Object Compiler version 61 (Qt 4.5.0)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/
@@ -11,7 +11,7 @@
#if !defined(Q_MOC_OUTPUT_REVISION)
#error "The header file 'hbqt_slots.h' doesn't include <QObject>."
#elif Q_MOC_OUTPUT_REVISION != 61
#error "This file was generated using the moc from 4.5.2. It"
#error "This file was generated using the moc from 4.5.0. It"
#error "cannot be used with the include files from this version of Qt."
#error "(The moc has changed too much.)"
#endif
@@ -321,7 +321,7 @@ static const uint qt_meta_data_Slots[] = {
2, // revision
0, // classname
0, 0, // classinfo
113, 12, // methods
114, 12, // methods
0, 0, // properties
0, 0, // enums/sets
0, 0, // constructors
@@ -440,6 +440,7 @@ static const uint qt_meta_data_Slots[] = {
3175, 3072, 6, 6, 0x0a,
3196, 3072, 6, 6, 0x0a,
3269, 3217, 6, 6, 0x0a,
3305, 108, 6, 6, 0x0a,
0 // eod
};
@@ -536,6 +537,7 @@ static const char qt_meta_stringdata_Slots[] = {
"cellEntered(int,int)\0cellPressed(int,int)\0"
"currentRow,currentColumn,previousRow,previousColumn\0"
"currentCellChanged(int,int,int,int)\0"
"tabCloseRequested(int)\0"
};
const QMetaObject Slots::staticMetaObject = {
@@ -676,9 +678,10 @@ int Slots::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
case 110: cellEntered((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break;
case 111: cellPressed((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break;
case 112: currentCellChanged((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2])),(*reinterpret_cast< int(*)>(_a[3])),(*reinterpret_cast< int(*)>(_a[4]))); break;
case 113: tabCloseRequested((*reinterpret_cast< int(*)>(_a[1]))); break;
default: ;
}
_id -= 113;
_id -= 114;
}
return _id;
}

View File

@@ -163,6 +163,16 @@ FUNCTION SetEventLoop( oELoop )
RETURN nil
/*----------------------------------------------------------------------*/
FUNCTION PostAppEvent( nEvent, mp1, mp2, oXbp )
LOCAL lSuccess := .T.
SetAppEvent( nEvent, mp1, mp2, oXbp )
RETURN lSuccess
/*----------------------------------------------------------------------*/
/*
* Internal to the XbpParts , Must NOT be called from Application Code
*/

View File

@@ -94,6 +94,9 @@ CLASS XbpTabPage INHERIT XbpWindow
DATA sl_tabActivate
METHOD tabActivate() SETGET
/* Harbour extension */
DATA sl_closeRequested
METHOD closeRequested() SETGET
METHOD handleEvent()
METHOD exeBlock()
@@ -154,6 +157,12 @@ METHOD XbpTabPage:configure( oParent, oOwner, aPos, aSize, aPresParams, lVisible
/*----------------------------------------------------------------------*/
METHOD XbpTabPage:destroy()
LOCAL nIndex
IF ( nIndex := ascan( ::oParent:aChildren, self ) ) > 0
adel( ::aChildren, nIndex )
asize( ::aChildren, len( ::aChildren ) - 1 )
ENDIF
::sl_tabActivate := NIL
::xbpWindow:destroy()
@@ -193,6 +202,16 @@ METHOD XbpTabPage:tabActivate( xParam )
/*----------------------------------------------------------------------*/
METHOD XbpTabPage:closeRequested( xParam )
IF hb_isBlock( xParam )
::sl_closeRequested := xParam
ENDIF
RETURN self
/*----------------------------------------------------------------------*/
METHOD XbpTabPage:minimize()
//::hide()
RETURN .f.
@@ -241,7 +260,8 @@ METHOD XbpTabWidget:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible
::oWidget := QTabWidget():new( ::pParent )
// ::Connect( ::pWidget, "currentChanged(int)" , {|o,i| ::exeBlock( i,o ) } )
::Connect( ::pWidget, "currentChanged(int)" , {|o,i| ::exeBlock( 1,i,o ) } )
::Connect( ::pWidget, "tabCloseRequested(int)" , {|o,i| ::exeBlock( 2,i,o ) } )
::setPosAndSize()
IF ::visible
@@ -272,12 +292,25 @@ METHOD XbpTabWidget:destroy()
/*----------------------------------------------------------------------*/
METHOD XbpTabWidget:exeBlock( iIndex )
METHOD XbpTabWidget:exeBlock( nMode, iIndex )
IF !empty( ::aChildren ) .and. iIndex >= 0 .and. iIndex < len( ::aChildren )
IF hb_isBlock( ::aChildren[ iIndex+1 ]:sl_tabActivate )
eval( ::aChildren[ iIndex+1 ]:sl_tabActivate, NIL, NIL, ::aChildren[ iIndex+1 ] )
ENDIF
DO CASE
CASE nMode == 1
HBXBP_DEBUG( "Tab Clicked", iIndex )
IF hb_isBlock( ::aChildren[ iIndex+1 ]:sl_tabActivate )
eval( ::aChildren[ iIndex+1 ]:sl_tabActivate, NIL, NIL, ::aChildren[ iIndex+1 ] )
ENDIF
CASE nMode == 2
HBXBP_DEBUG( "Tab Close Requested", iIndex )
IF hb_isBlock( ::aChildren[ iIndex+1 ]:sl_closeRequested )
eval( ::aChildren[ iIndex+1 ]:sl_closeRequested, NIL, NIL, ::aChildren[ iIndex+1 ] )
ENDIF
ENDCASE
ENDIF
RETURN nil
/*----------------------------------------------------------------------*/