2009-12-01 18:09 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com)

* contrib/hbide/hbide.prg
  * contrib/hbxbp/xbpstatusbar.prg
    + Started <Status Bar> information. Now XbpStatusBar() honors multiple panels.
This commit is contained in:
Pritpal Bedi
2009-12-02 02:11:32 +00:00
parent b69e1a68c2
commit c2b84ecbe4
3 changed files with 76 additions and 13 deletions

View File

@@ -17,6 +17,11 @@
past entries belonging to author(s): Viktor Szakats.
*/
2009-12-01 18:09 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com)
* contrib/hbide/hbide.prg
* contrib/hbxbp/xbpstatusbar.prg
+ Started <Status Bar> information. Now XbpStatusBar() honors multiple panels.
2009-12-02 01:55 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* src/vm/itemapi.c
* src/vm/hvm.c

View File

@@ -124,8 +124,11 @@ CLASS HbIde
DATA qSplitterR
DATA qTabWidget
DATA qFindDlg
DATA qSBLine
DATA qSBCol
ACCESS qCurEdit INLINE iif( ::getCurrentTab() > 0, ::aTabs[ ::getCurrentTab(), 2 ], NIL )
ACCESS qCurDocument INLINE iif( ::getCurrentTab() > 0, ::aTabs[ ::getCurrentTab(), 6 ], NIL )
/* XBP Objects */
DATA oDlg
@@ -197,6 +200,7 @@ CLASS HbIde
METHOD activateTab()
METHOD getCurrentTab()
METHOD getYesNo()
METHOD dispEditInfo()
DATA aTags INIT {}
DATA aText INIT {}
@@ -311,12 +315,12 @@ METHOD HbIde:create( cProjIni )
::oTBar := buildToolBar( ::oDlg, Self )
::buildStatusBar()
::loadSources()
::setPosAndSizeByIni( ::oProjTree:oWidget, ProjectTreeGeometry )
::oDlg:Show()
::loadSources()
/* Enter Xbase++ Event Loop - working */
DO WHILE .t.
::nEvent := AppEvent( @::mp1, @::mp2, @::oXbp )
@@ -652,11 +656,14 @@ METHOD HbIde:editSource( cSourceFile, nPos, nHPos, nVPos )
::createTags()
::updateFuncList()
::manageFocusInEditor()
::dispEditInfo()
lFirst := .t.
Qt_Connect_Signal( QT_PTROF( qEdit ), "textChanged()", ;
{|| ::setTabImage( IF( qDocument:isModified(),"modified","unmodified" ), oTab, qEdit, nPos, @lFirst ) } )
Qt_Connect_Signal( QT_PTROF( qEdit ), "cursorPositionChanged()", {|| ::dispEditInfo() } )
RETURN Self
/*----------------------------------------------------------------------*/
@@ -696,6 +703,7 @@ METHOD HbIde:activateTab( mp1, mp2, oXbp )
::aSources := { ::aTabs[ ::nCurTab, 5 ] }
::createTags()
::updateFuncList()
::dispEditInfo()
ENDIF
RETURN Self
@@ -893,16 +901,44 @@ METHOD HbIde:buildProjectTree()
/*----------------------------------------------------------------------*/
METHOD HbIde:dispEditInfo()
LOCAL qCursor, s
IF !empty( ::qCurEdit )
::oSBar:getItem( 2 ):caption := "Ready"
qCursor := QTextCursor():configure( ::qCurEdit:textCursor() )
s := "<b>Line "+ hb_ntos( qCursor:blockNumber()+1 ) + " of " + ;
hb_ntos( ::qCurDocument:blockCount() ) + "</b>"
::oSBar:getItem( 3 ):caption := s
::oSBar:getItem( 4 ):caption := "Col " + hb_ntos( qCursor:columnNumber()+1 )
ENDIF
RETURN Self
/*----------------------------------------------------------------------*/
METHOD HbIde:buildStatusBar()
LOCAL oPanel
::oSBar := XbpStatusBar():new()
::oSBar:create( ::oDlg, , { 0,0 }, { ::oDlg:currentSize()[1],30 } )
::oSBar:oWidget:showMessage( "" )
oPanel := ::oSBar:getItem( 1 )
oPanel:caption := "Ready"
oPanel:autosize := XBPSTATUSBAR_AUTOSIZE_SPRING
::oSBar:addItem( "", , , , "Ready" ):oWidget:setMinimumWidth( 80 )
::oSBar:addItem( "", , , , "Line" ):oWidget:setMinimumWidth( 110 )
::oSBar:addItem( "", , , , "Col" ):oWidget:setMinimumWidth( 40 )
::oSBar:addItem( "", , , , "Caps" ):oWidget:setMinimumWidth( 30 )
::oSBar:addItem( "", , , , "Misc" ):oWidget:setMinimumWidth( 30 )
::oSBar:addItem( "", , , , "State" ):oWidget:setMinimumWidth( 50 )
::oSBar:addItem( "", , , , "Misc_2" ):oWidget:setMinimumWidth( 30 )
::oSBar:addItem( "", , , , "Misc_3" ):oWidget:setMinimumWidth( 20 )
RETURN Self
/*----------------------------------------------------------------------*/

View File

@@ -162,8 +162,6 @@ METHOD XbpStatusBar:destroy()
NEXT
ENDIF
::oParent := NIL
::xbpWindow:destroy()
RETURN NIL
@@ -186,15 +184,16 @@ METHOD XbpStatusBar:addItem( cCaption, xImage, cDLL, nStyle, cKey, nMode )
HB_SYMBOL_UNUSED( xImage )
HB_SYMBOL_UNUSED( cDLL )
oPanel := XbpStatusBarPanel():new( cCaption, nStyle, cKey )
oPanel:oParent := self
oPanel:index := ::numItems + 1
IF nMode <> -1
//lSuccess := Wvg_StatusBarCreatePanel( ::hWnd, nMode )
IF nMode == -1
oPanel := XbpStatusBarPanel():new( cCaption, nStyle, cKey ):create()
::oWidget:addPermanentWidget( QT_PTROFXBP( oPanel ), 1 )
ELSE
oPanel := XbpStatusBarPanel():new( cCaption, nStyle, cKey ):create()
::oWidget:addWidget( QT_PTROFXBP( oPanel ) )
ENDIF
oPanel:oParent := self
oPanel:index := ::numItems + 1
IF lSuccess
aadd( ::aItems, oPanel )
ELSE
@@ -287,6 +286,7 @@ METHOD XbpStatusBar:panelDblClick( xParam )
CLASS XbpStatusBarPanel
DATA oWidget
DATA alignment INIT XBPALIGN_LEFT
DATA autosize INIT XBPSTATUSBAR_AUTOSIZE_NONE
DATA bevel INIT XBPSTATUSBAR_BEVEL_INSET
@@ -303,6 +303,7 @@ CLASS XbpStatusBarPanel
DATA minWidth INIT 0
METHOD new()
METHOD create()
METHOD caption() SETGET
DATA oParent
@@ -324,6 +325,23 @@ METHOD XbpStatusBarPanel:new( cCaption, nStyle, cKey )
/*----------------------------------------------------------------------*/
METHOD XbpStatusBarPanel:create( cCaption, nStyle, cKey )
DEFAULT cCaption TO ::sl_caption
DEFAULT nStyle TO ::style
DEFAULT cKey TO ::key
::sl_caption := cCaption
::style := nStyle
::key := cKey
// take care of nStyle - later - label right now
::oWidget := QLabel():new()
RETURN Self
/*----------------------------------------------------------------------*/
METHOD XbpStatusBarPanel:caption( cCaption )
IF cCaption == NIL
@@ -334,7 +352,11 @@ METHOD XbpStatusBarPanel:caption( cCaption )
::sl_caption := cCaption
::oParent:oWidget:showMessage( cCaption )
IF ::oWidget <> NIL
::oWidget:setText( cCaption )
ELSE
::oParent:oWidget:showMessage( cCaption )
ENDIF
ENDIF
RETURN Self