2010-01-14 18:21 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com)
* contrib/hbide/hbide.ch
* contrib/hbide/hbide.prg
* contrib/hbide/idedocks.prg
* contrib/hbide/ideeditor.prg
* contrib/hbide/ideobject.prg
* contrib/hbide/idesaveload.prg
+ Implemented current line highliting.
Currently it is ON by default. Later when all components
will be in place then it will fall under generic category
in thought of "Setup" dialog.
+ Implemented to show number of selection characters in status-bar.
Requested by: Rodrigo Machado.
+ Implemented to retain last selected codec from the main menu
to be populated at next run. It is also displayed
in the status-bar.
; Please comment.
This commit is contained in:
@@ -17,6 +17,24 @@
|
||||
past entries belonging to author(s): Viktor Szakats.
|
||||
*/
|
||||
|
||||
2010-01-14 18:21 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com)
|
||||
* contrib/hbide/hbide.ch
|
||||
* contrib/hbide/hbide.prg
|
||||
* contrib/hbide/idedocks.prg
|
||||
* contrib/hbide/ideeditor.prg
|
||||
* contrib/hbide/ideobject.prg
|
||||
* contrib/hbide/idesaveload.prg
|
||||
+ Implemented current line highliting.
|
||||
Currently it is ON by default. Later when all components
|
||||
will be in place then it will fall under generic category
|
||||
in thought of "Setup" dialog.
|
||||
+ Implemented to show number of selection characters in status-bar.
|
||||
Requested by: Rodrigo Machado.
|
||||
+ Implemented to retain last selected codec from the main menu
|
||||
to be populated at next run. It is also displayed
|
||||
in the status-bar.
|
||||
; Please comment.
|
||||
|
||||
2010-01-15 01:45 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
|
||||
* src/compiler/cmdcheck.c
|
||||
* src/compiler/compi18n.c
|
||||
|
||||
@@ -81,8 +81,9 @@
|
||||
#define FindDialogGeometry 10
|
||||
#define ThemesDialogGeometry 11
|
||||
#define CurrentTheme 12
|
||||
#define CurrentCodec 13
|
||||
|
||||
#define INI_HBIDE_VRBLS 12
|
||||
#define INI_HBIDE_VRBLS 13
|
||||
|
||||
/* .hbi structure constants */
|
||||
#define PRJ_PRP_PROPERTIES 1
|
||||
@@ -123,7 +124,7 @@
|
||||
#define SB_PNL_LINE 3
|
||||
#define SB_PNL_COLUMN 4
|
||||
#define SB_PNL_INS 5
|
||||
#define SB_PNL_M_1 6
|
||||
#define SB_PNL_SELECTEDCHARS 6
|
||||
#define SB_PNL_MODIFIED 7
|
||||
#define SB_PNL_M_2 8
|
||||
#define SB_PNL_STREAM 9
|
||||
|
||||
@@ -185,10 +185,11 @@ CLASS HbIde
|
||||
DATA oOpenedSources
|
||||
DATA resPath INIT hb_DirBase() + "resources" + hb_OsPathSeparator()
|
||||
DATA pathSep INIT hb_OsPathSeparator()
|
||||
DATA cWrkProject INIT ''
|
||||
DATA cWrkTheme INIT ''
|
||||
DATA cWrkProject INIT ""
|
||||
DATA cWrkTheme INIT ""
|
||||
DATA cProcessInfo
|
||||
DATA cIniThemes
|
||||
DATA cWrkCodec INIT ""
|
||||
|
||||
DATA aTags INIT {}
|
||||
DATA aText INIT {}
|
||||
@@ -213,7 +214,6 @@ CLASS HbIde
|
||||
METHOD gotoFunction( mp1, mp2, oListBox )
|
||||
METHOD manageFuncContext( mp1 )
|
||||
METHOD createTags()
|
||||
METHOD loadUI( cUi )
|
||||
METHOD updateProjectMenu()
|
||||
METHOD updateTitleBar()
|
||||
METHOD setCodec( cCodec )
|
||||
@@ -249,6 +249,11 @@ METHOD HbIde:create( cProjIni )
|
||||
|
||||
/* Load IDE Settings */
|
||||
hbide_loadINI( Self, cProjIni )
|
||||
/* Set variables from last session */
|
||||
::cWrkTheme := ::aINI[ INI_HBIDE, CurrentTheme ]
|
||||
::cWrkCodec := ::aINI[ INI_HBIDE, CurrentCodec ]
|
||||
/* Set Codec at the Begining */
|
||||
HbXbp_SetCodec( ::cWrkCodec )
|
||||
|
||||
/* DOCKing windows and ancilliary windows */
|
||||
::oDK := IdeDocks():new():create( Self )
|
||||
@@ -307,7 +312,6 @@ METHOD HbIde:create( cProjIni )
|
||||
::updateTitleBar()
|
||||
/* Set some last settings */
|
||||
::oPM:setCurrentProject( ::cWrkProject, .f. )
|
||||
::cWrkTheme := ::aINI[ INI_HBIDE, CurrentTheme ]
|
||||
|
||||
/* Set components Sizes */
|
||||
::setSizeByIni( ::oProjTree:oWidget, ProjectTreeGeometry )
|
||||
@@ -315,6 +319,7 @@ METHOD HbIde:create( cProjIni )
|
||||
|
||||
/* Restore Settings */
|
||||
hbide_restSettings( Self )
|
||||
::setCodec()
|
||||
|
||||
/* Request Main Window to Appear on the Screen */
|
||||
::oDlg:Show()
|
||||
@@ -900,23 +905,6 @@ METHOD HbIde:CreateTags()
|
||||
RETURN ( NIL )
|
||||
|
||||
//----------------------------------------------------------------------//
|
||||
|
||||
METHOD HbIde:loadUI( cUi )
|
||||
LOCAL cUiFull := s_resPath + cUi + ".ui"
|
||||
LOCAL qDialog, qUiLoader, qFile
|
||||
|
||||
IF hb_FileExists( cUiFull )
|
||||
qFile := QFile():new( cUiFull )
|
||||
IF qFile:open( 1 )
|
||||
qUiLoader := QUiLoader():new()
|
||||
qDialog := QDialog():configure( qUiLoader:load( qFile, ::oDlg:oWidget ) )
|
||||
qFile:close()
|
||||
ENDIF
|
||||
ENDIF
|
||||
|
||||
RETURN qDialog
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
/*
|
||||
* Update the project menu to show current info.
|
||||
* 03/01/2010 - 12:48:18 - vailtom
|
||||
@@ -971,8 +959,13 @@ METHOD HbIde:updateTitleBar()
|
||||
|
||||
METHOD HbIde:setCodec( cCodec )
|
||||
|
||||
HbXbp_SetCodec( cCodec )
|
||||
::oSBar:getItem( SB_PNL_CODEC ):caption := cCodec
|
||||
DEFAULT cCodec TO ::cWrkCodec
|
||||
|
||||
::cWrkCodec := cCodec
|
||||
|
||||
HbXbp_SetCodec( ::cWrkCodec )
|
||||
|
||||
::oSBar:getItem( SB_PNL_CODEC ):caption := ::cWrkCodec
|
||||
|
||||
RETURN Self
|
||||
|
||||
|
||||
@@ -92,6 +92,7 @@ CLASS IdeDockS INHERIT IdeObject
|
||||
METHOD toggleLeftDocks()
|
||||
METHOD toggleRightDocks()
|
||||
METHOD toggleBottomDocks()
|
||||
METHOD setStatusText( nPart, xValue )
|
||||
|
||||
ENDCLASS
|
||||
|
||||
@@ -465,3 +466,41 @@ METHOD IdeDocks:toggleBottomDocks()
|
||||
RETURN Self
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
METHOD IdeDocks:setStatusText( nPart, xValue )
|
||||
LOCAL oPanel := ::oSBar:getItem( nPart )
|
||||
|
||||
SWITCH nPart
|
||||
CASE SB_PNL_MAIN
|
||||
EXIT
|
||||
CASE SB_PNL_READY
|
||||
EXIT
|
||||
CASE SB_PNL_LINE
|
||||
EXIT
|
||||
CASE SB_PNL_COLUMN
|
||||
EXIT
|
||||
CASE SB_PNL_INS
|
||||
EXIT
|
||||
CASE SB_PNL_SELECTEDCHARS
|
||||
oPanel:caption := iif( xValue == 0, "", "Sel: " + hb_ntos( xValue ) )
|
||||
EXIT
|
||||
CASE SB_PNL_MODIFIED
|
||||
oPanel:caption := iif( xValue, "Modified", "" )
|
||||
EXIT
|
||||
CASE SB_PNL_M_2
|
||||
EXIT
|
||||
CASE SB_PNL_STREAM
|
||||
EXIT
|
||||
CASE SB_PNL_EDIT
|
||||
EXIT
|
||||
CASE SB_PNL_SEARCH
|
||||
EXIT
|
||||
CASE SB_PNL_CODEC
|
||||
EXIT
|
||||
CASE SB_PNL_PROJECT
|
||||
EXIT
|
||||
ENDSWITCH
|
||||
|
||||
RETURN Self
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
@@ -850,13 +850,14 @@ METHOD IdeEditor:setDocumentProperties()
|
||||
qCursor := QTextCursor():configure( ::qEdit:textCursor() )
|
||||
|
||||
IF !( ::lLoaded ) /* First Time */
|
||||
::lLoaded := .T.
|
||||
hbide_dbg( "......................" )
|
||||
::qEdit:setPlainText( hb_memoRead( ::sourceFile ) )
|
||||
qCursor:setPosition( ::nPos )
|
||||
::qEdit:setTextCursor( qCursor )
|
||||
QScrollBar():configure( ::qEdit:horizontalScrollBar() ):setValue( ::nHPos )
|
||||
QScrollBar():configure( ::qEdit:verticalScrollBar() ):setValue( ::nVPos )
|
||||
::qTabWidget:setTabIcon( ::qTabWidget:indexOf( ::oTab:oWidget ), ::resPath + "tabunmodified.png" )
|
||||
::lLoaded := .T.
|
||||
ENDIF
|
||||
|
||||
::nBlock := qCursor:blockNumber()
|
||||
@@ -986,13 +987,20 @@ CLASS IdeEdit INHERIT IdeObject
|
||||
DATA qEdit
|
||||
DATA qHLayout
|
||||
DATA qLineNos
|
||||
DATA qDocument
|
||||
|
||||
DATA nMode INIT 0
|
||||
DATA nLineNo INIT -99
|
||||
DATA nMaxDigits INIT 5 // Tobe
|
||||
DATA nMaxRows INIT 100
|
||||
DATA nLastLine INIT -99
|
||||
DATA qBlockFormat INIT QTextBlockFormat():new()
|
||||
|
||||
DATA qPoint INIT QPoint():new( 0,0 )
|
||||
DATA qBrushCL INIT QBrush():new( "QColor", QColor():new( 240,240,240 ) )
|
||||
DATA qBrushNR INIT QBrush():new( "QColor", QColor():new( 255,255,255 ) )
|
||||
DATA qActionTab
|
||||
DATA qLastCursor
|
||||
|
||||
METHOD new( oEditor, nMode )
|
||||
METHOD create( oEditor, nMode )
|
||||
@@ -1000,6 +1008,7 @@ CLASS IdeEdit INHERIT IdeObject
|
||||
METHOD exeBlock( nMode, oEdit, o, p, p1 )
|
||||
METHOD connectEditSlots( oEdit )
|
||||
METHOD disConnectEditSlots( oEdit )
|
||||
METHOD highlightCurrentLine( qEdit )
|
||||
|
||||
ENDCLASS
|
||||
|
||||
@@ -1051,10 +1060,14 @@ METHOD IdeEdit:create( oEditor, nMode )
|
||||
::qHLayout:addWidget( ::qLineNos )
|
||||
::qHLayout:addWidget( ::qEdit )
|
||||
|
||||
::qActionTab := QAction():new( ::qEdit )
|
||||
::qActionTab:setText( "Editor Tab" )
|
||||
::qActionTab:setShortcut( QKeySequence():new( "Ctrl+F2" ) )
|
||||
::connect( ::qActionTab, "triggered(bool)", {|| ::exeBlock( 71, Self ) } )
|
||||
|
||||
::connectEditSlots( Self )
|
||||
|
||||
//::qLineNos:show()
|
||||
//::qEdit:show()
|
||||
::qDocument := QTextDocument():configure( ::qEdit:document() )
|
||||
|
||||
RETURN Self
|
||||
|
||||
@@ -1143,6 +1156,7 @@ METHOD IdeEdit:exeBlock( nMode, oEdit, o, p, p1 )
|
||||
ENDIF
|
||||
EXIT
|
||||
CASE textChanged
|
||||
hbide_dbg( "textChanged" )
|
||||
::oEditor:setTabImage( qEdit )
|
||||
EXIT
|
||||
CASE copyAvailable
|
||||
@@ -1152,34 +1166,77 @@ METHOD IdeEdit:exeBlock( nMode, oEdit, o, p, p1 )
|
||||
hbide_dbg( "modificationChanged(bool)" )
|
||||
EXIT
|
||||
CASE redoAvailable
|
||||
hbide_dbg( "redoAvailable(bool)" )
|
||||
hbide_dbg( "redoAvailable(bool)", p )
|
||||
EXIT
|
||||
CASE selectionChanged
|
||||
::oEditor:qCurEditSplit := qEdit
|
||||
hbide_dbg( "selectionChanged()" )
|
||||
qCursor := QTextCursor():configure( qEdit:TextCursor() )
|
||||
::oDK:setStatusText( SB_PNL_SELECTEDCHARS, len( qCursor:selectedText() ) )
|
||||
EXIT
|
||||
CASE undoAvailable
|
||||
hbide_dbg( "undoAvailable(bool)" )
|
||||
EXIT
|
||||
CASE updateRequest
|
||||
* hbide_dbg( "updateRequest" )
|
||||
pCursor := qEdit:cursorForPosition( ::qPoint )
|
||||
IF hb_isPointer( pCursor )
|
||||
qCursor := QTextCursor():configure( pCursor )
|
||||
nLineNo := qCursor:blockNumber()
|
||||
IF oEdit:nLineNo != nLineNo
|
||||
IF oEdit:nLineNo != nLineNo .OR. !( ::oEditor:lLoaded )
|
||||
oEdit:nLineNo := nLineNo
|
||||
oEdit:qLineNos:setHTML( hbide_buildLinesLabel( ::nLineNo + 1, ::oEditor:qDocument:blockCount(), ::nMaxDigits, ::nMaxRows ) )
|
||||
ENDIF
|
||||
ENDIF
|
||||
EXIT
|
||||
|
||||
CASE cursorPositionChanged
|
||||
::oEditor:dispEditInfo( qEdit )
|
||||
::highlightCurrentLine( qEdit )
|
||||
EXIT
|
||||
CASE 71
|
||||
hbide_dbg( "CTRL+F2 Pressed" )
|
||||
EXIT
|
||||
|
||||
ENDSWITCH
|
||||
|
||||
RETURN Nil
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
METHOD IdeEdit:highlightCurrentLine( qEdit )
|
||||
LOCAL nCurLine, qCursor, lModified, qBlock
|
||||
|
||||
qCursor := QTextCursor():configure( qEdit:TextCursor() )
|
||||
nCurLine := qCursor:blockNumber()
|
||||
|
||||
IF !( nCurLine == ::nLastLine )
|
||||
lModified := ::qDocument:isModified()
|
||||
|
||||
IF ( qBlock := QTextBlock():configure( qCursor:block() ) ):isValid()
|
||||
IF QTextBlock():configure( ::qDocument:findBlockByNumber( ::nLastLine ) ):isValid()
|
||||
::qBlockFormat:setBackground( ::qBrushNR )
|
||||
::qLastCursor:setBlockFormat( ::qBlockFormat )
|
||||
ENDIF
|
||||
|
||||
::qBlockFormat:setBackground( ::qBrushNR )
|
||||
::qBlockFormat := QTextBlockFormat():configure( qBlock:blockFormat() )
|
||||
::qBlockFormat:setBackground( ::qBrushCL )
|
||||
qCursor:setBlockFormat( ::qBlockFormat )
|
||||
|
||||
ENDIF
|
||||
|
||||
::nLastLine := nCurLine
|
||||
::qLastCursor := qCursor
|
||||
|
||||
::qDocument:setModified( lModified )
|
||||
|
||||
/* Infact these must not be called from here but because changing the format */
|
||||
/* Qt consider that document has been modified, hence I need to put them here */
|
||||
|
||||
::qTabWidget:setTabIcon( ::qTabWidget:indexOf( ::oEditor:oTab:oWidget ), ;
|
||||
::resPath + iif( lModified, "tabmodified.png", "tabunmodified.png" ) )
|
||||
::oDK:setStatusText( SB_PNL_MODIFIED, lModified )
|
||||
ENDIF
|
||||
|
||||
RETURN Self
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
@@ -107,6 +107,7 @@ CLASS IdeObject
|
||||
|
||||
ACCESS cWrkProject INLINE ::oIde:cWrkProject
|
||||
ACCESS cWrkTheme INLINE ::oIde:cWrkTheme
|
||||
ACCESS cWrkCodec INLINE ::oIde:cWrkCodec
|
||||
ACCESS resPath INLINE ::oIde:resPath
|
||||
ACCESS pathSep INLINE ::oIde:pathSep
|
||||
|
||||
@@ -156,7 +157,6 @@ CLASS IdeObject
|
||||
METHOD updateProjectTree( ... ) INLINE ::oIde:updateProjectTree( ... )
|
||||
METHOD manageItemSelected( ... ) INLINE ::oIde:manageItemSelected( ... )
|
||||
METHOD manageFocusInEditor( ... ) INLINE ::oIde:manageFocusInEditor( ... )
|
||||
METHOD loadUI( ... ) INLINE ::oIde:loadUI( ... )
|
||||
METHOD setCodec( ... ) INLINE ::oIde:setCodec( ... )
|
||||
METHOD updateTitleBar( ... ) INLINE ::oIde:updateTitleBar( ... )
|
||||
|
||||
|
||||
@@ -90,6 +90,7 @@ FUNCTION hbide_saveINI( oIde )
|
||||
aadd( txt_, "FindDialogGeometry = " + oIde:aIni[ INI_HBIDE, FindDialogGeometry ] )
|
||||
aadd( txt_, "ThemesDialogGeometry = " + oIde:aIni[ INI_HBIDE, ThemesDialogGeometry ] )
|
||||
aadd( txt_, "CurrentTheme = " + oIde:cWrkTheme )
|
||||
aadd( txt_, "CurrentCodec = " + oIde:cWrkCodec )
|
||||
aadd( txt_, " " )
|
||||
|
||||
aadd( txt_, "[PROJECTS]" )
|
||||
@@ -160,7 +161,8 @@ FUNCTION hbide_loadINI( oIde, cHbideIni )
|
||||
LOCAL aIdeEle := { "mainwindowgeometry" , "projecttreevisible" , "projecttreegeometry", ;
|
||||
"functionlistvisible", "functionlistgeometry", "recenttabindex" , ;
|
||||
"currentproject" , "gotodialoggeometry" , "propsdialoggeometry", ;
|
||||
"finddialoggeometry" , "themesdialoggeometry", "currenttheme" }
|
||||
"finddialoggeometry" , "themesdialoggeometry", "currenttheme", ;
|
||||
"currentcodec" }
|
||||
|
||||
DEFAULT cHbideIni TO "hbide.ini"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user