2010-04-03 17:05 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com)
* contrib/hbqt/hbqt_hbqplaintextedit.cpp
! Optimization and LineNumbers area refinements.
* contrib/hbide/hbide.hbp
+ contrib/hbide/hbide.ico
+ Added icon for windows builds.
* contrib/hbide/hbide.prg
* contrib/hbide/ideeditor.prg
* contrib/hbide/idehome.prg
* contrib/hbide/idestylesheets.prg
* contrib/hbide/idethemes.prg
! Some dialogs made static instead of locals.
! Line number area of editor instances is now optimized to
not show empty space at the left if no "Book Mark" is employed.
! Few more optimizations.
This commit is contained in:
@@ -17,6 +17,24 @@
|
||||
past entries belonging to author(s): Viktor Szakats.
|
||||
*/
|
||||
|
||||
2010-04-03 17:05 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com)
|
||||
* contrib/hbqt/hbqt_hbqplaintextedit.cpp
|
||||
! Optimization and LineNumbers area refinements.
|
||||
|
||||
* contrib/hbide/hbide.hbp
|
||||
+ contrib/hbide/hbide.ico
|
||||
+ Added icon for windows builds.
|
||||
|
||||
* contrib/hbide/hbide.prg
|
||||
* contrib/hbide/ideeditor.prg
|
||||
* contrib/hbide/idehome.prg
|
||||
* contrib/hbide/idestylesheets.prg
|
||||
* contrib/hbide/idethemes.prg
|
||||
! Some dialogs made static instead of locals.
|
||||
! Line number area of editor instances is now optimized to
|
||||
not show empty space at the left if no "Book Mark" is employed.
|
||||
! Few more optimizations.
|
||||
|
||||
2010-04-03 12:36 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
|
||||
* harbour/src/rdd/wacore.c
|
||||
! fixed GPF when unknown (never used in application code) alias is
|
||||
|
||||
@@ -34,6 +34,7 @@ ideskeletons.prg
|
||||
idewizard.prg
|
||||
idetools.prg
|
||||
|
||||
{allwin}hbide.rc
|
||||
|
||||
|
||||
|
||||
|
||||
BIN
harbour/contrib/hbide/hbide.ico
Normal file
BIN
harbour/contrib/hbide/hbide.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
@@ -492,6 +492,16 @@ hbide_dbg( "HbIde:create( cProjIni )", "#Params=" )
|
||||
::oDocViewDock:hide()
|
||||
::oDocWriteDock:hide()
|
||||
|
||||
#if 0 /* for screen capture */
|
||||
n := seconds()
|
||||
DO WHILE .t.
|
||||
IF seconds() > n + 10
|
||||
EXIT
|
||||
ENDIF
|
||||
QApplication():processEvents()
|
||||
ENDDO
|
||||
#endif
|
||||
|
||||
/* Request Main Window to Appear on the Screen */
|
||||
::oHM:refresh()
|
||||
::oDlg:Show()
|
||||
@@ -665,7 +675,6 @@ METHOD HbIde:execAction( cKey )
|
||||
EXIT
|
||||
CASE "Home"
|
||||
::oDK:setView( "Stats" )
|
||||
//::oHM:refresh()
|
||||
EXIT
|
||||
CASE "Animate"
|
||||
::nAnimantionMode := iif( ::nAnimantionMode == HBIDE_ANIMATION_NONE, HBIDE_ANIMATION_GRADIENT, HBIDE_ANIMATION_NONE )
|
||||
@@ -1089,8 +1098,7 @@ METHOD HbIde:updateProjectTree( aPrj )
|
||||
ENDIF
|
||||
/* Delete Existing Nodes */
|
||||
DO WHILE .t.
|
||||
n := ascan( ::aProjData, {|e_| e_[ TRE_OPARENT ] == oP } )
|
||||
IF n == 0
|
||||
IF ( n := ascan( ::aProjData, {|e_| e_[ TRE_OPARENT ] == oP } ) ) == 0
|
||||
EXIT
|
||||
ENDIF
|
||||
oP:delItem( ::aProjData[ n, TRE_OITEM ] )
|
||||
|
||||
@@ -1540,6 +1540,8 @@ METHOD IdeEdit:destroy()
|
||||
|
||||
Qt_Events_DisConnect( ::pEvents, ::qEdit, QEvent_KeyPress )
|
||||
Qt_Events_DisConnect( ::pEvents, ::qEdit, QEvent_Wheel )
|
||||
Qt_Events_DisConnect( ::pEvents, ::qEdit, QEvent_FocusIn )
|
||||
Qt_Events_DisConnect( ::pEvents, ::qEdit, QEvent_FocusOut )
|
||||
Qt_Events_DisConnect( ::pEvents, ::qEdit, QEvent_MouseButtonDblClick )
|
||||
|
||||
::disconnectEditSignals( Self )
|
||||
@@ -1652,6 +1654,8 @@ METHOD IdeEdit:execEvent( nMode, oEdit, p, p1 )
|
||||
::relayMarkButtons()
|
||||
::toggleLineNumbers()
|
||||
|
||||
::updateTitleBar()
|
||||
|
||||
/* An experimental move but seems a lot is required to achieve column selection */
|
||||
qEdit:hbHighlightSelectedColumns( ::isColumnSelectionEnabled )
|
||||
|
||||
@@ -2194,13 +2198,15 @@ METHOD IdeEdit:handlePreviousWord( lUpdatePrevWord )
|
||||
nL := len( cWord ) + nSpace
|
||||
nB := qCursor:position() - nL
|
||||
|
||||
qCursor:beginEditBlock()
|
||||
qCursor:setPosition( nB )
|
||||
qCursor:movePosition( QTextCursor_NextCharacter, QTextCursor_KeepAnchor, nL )
|
||||
qCursor:removeSelectedText()
|
||||
qCursor:insertText( upper( cWord ) + space( nSpace ) )
|
||||
qCursor:endEditBlock()
|
||||
qEdit:setTextCursor( qCursor )
|
||||
IF ::oEditor:cExt $ ".prg"
|
||||
qCursor:beginEditBlock()
|
||||
qCursor:setPosition( nB )
|
||||
qCursor:movePosition( QTextCursor_NextCharacter, QTextCursor_KeepAnchor, nL )
|
||||
qCursor:removeSelectedText()
|
||||
qCursor:insertText( upper( cWord ) + space( nSpace ) )
|
||||
qCursor:endEditBlock()
|
||||
qEdit:setTextCursor( qCursor )
|
||||
ENDIF
|
||||
|
||||
IF hbide_isStartingKeyword( cWord )
|
||||
IF lPrevOnly
|
||||
|
||||
@@ -104,6 +104,7 @@ CLASS IdeHome INHERIT IdeObject
|
||||
DATA cClickedSource
|
||||
|
||||
DATA qCurBrowser
|
||||
DATA qPrnDlg
|
||||
|
||||
METHOD new( oIde )
|
||||
METHOD create( oIde )
|
||||
@@ -154,6 +155,11 @@ METHOD IdeHome:create( oIde )
|
||||
|
||||
METHOD IdeHome:destroy()
|
||||
|
||||
IF !empty( ::qPrnDlg )
|
||||
Qt_Slots_disConnect( ::pSlots, ::qPrnDlg, "paintRequested(QPrinter)" )
|
||||
::qPrnDlg := NIL
|
||||
ENDIF
|
||||
|
||||
::disconnect( ::qWelcomeBrowser, "anchorClicked(QUrl)" )
|
||||
::disconnect( ::qWelcomeBrowser, "customContextMenuRequested(QPoint)" )
|
||||
::disconnect( ::qFaqBrowser , "customContextMenuRequested(QPoint)" )
|
||||
@@ -228,13 +234,16 @@ METHOD IdeHome:activateTab( mp1, mp2, oTab )
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
METHOD IdeHome:print()
|
||||
LOCAL qDlg
|
||||
|
||||
qDlg := QPrintPreviewDialog():new( ::aViews[ 1 ]:oTabWidget )
|
||||
qDlg:setWindowTitle( "Wecome::Projects" )
|
||||
Qt_Slots_Connect( ::pSlots, qDlg, "paintRequested(QPrinter)", {|p| ::paintRequested( p ) } )
|
||||
qDlg:exec()
|
||||
Qt_Slots_disConnect( ::pSlots, qDlg, "paintRequested(QPrinter)" )
|
||||
::qPrnDlg := NIL
|
||||
IF empty( ::qPrnDlg )
|
||||
::qPrnDlg := QPrintPreviewDialog():new()
|
||||
::qPrnDlg:setWindowTitle( "Welcome::Projects" )
|
||||
::qPrnDlg:setWindowIcon( hbide_image( "hbide" ) )
|
||||
Qt_Slots_Connect( ::pSlots, ::qPrnDlg, "paintRequested(QPrinter)", {|p| ::paintRequested( p ) } )
|
||||
ENDIF
|
||||
|
||||
::qPrnDlg:exec()
|
||||
|
||||
RETURN self
|
||||
|
||||
|
||||
@@ -191,12 +191,12 @@ FUNCTION GetStyleSheet( cWidget, nMode )
|
||||
aadd( txt_, 'QToolBar { ' )
|
||||
aadd( txt_, ' background-color: qlineargradient(x1:1, y1:0, x2:0, y2:0, ' )
|
||||
aadd( txt_, ' stop:0 lightgray, stop:1 darkgray); ' )
|
||||
* aadd( txt_, ' spacing: 1px; color: white; margin-top: 2px; ' )
|
||||
* aadd( txt_, ' spacing: 1px; color: white; margin-top: 2px; ' )
|
||||
aadd( txt_, ' } ' )
|
||||
ELSE
|
||||
aadd( txt_, 'QToolBar { ' )
|
||||
aadd( txt_, hbide_cssColorString( "bg-std" ) )
|
||||
* aadd( txt_, ' spacing: 1px; color: white; margin-top: 2px; ' )
|
||||
* aadd( txt_, ' spacing: 1px; color: white; margin-top: 2px; ' )
|
||||
aadd( txt_, ' } ' )
|
||||
ENDIF
|
||||
|
||||
@@ -238,9 +238,9 @@ FUNCTION GetStyleSheet( cWidget, nMode )
|
||||
aadd( txt_, ' QTreeWidget::item:alternate { ' )
|
||||
aadd( txt_, ' background: #EEEEEE; ' )
|
||||
aadd( txt_, ' } ' )
|
||||
//aadd( txt_, ' QTreeWidget::item:selected { ' )
|
||||
//aadd( txt_, ' border: 1px solid #6a6ea9; ' )
|
||||
//aadd( txt_, ' } ' )
|
||||
* aadd( txt_, ' QTreeWidget::item:selected { ' )
|
||||
* aadd( txt_, ' border: 1px solid #6a6ea9; ' )
|
||||
* aadd( txt_, ' } ' )
|
||||
|
||||
CASE cWidget == "QTreeWidget"
|
||||
|
||||
|
||||
@@ -120,6 +120,9 @@ CLASS IdeThemes INHERIT IdeObject
|
||||
|
||||
VAR lCreating INIT .f.
|
||||
|
||||
VAR oSL
|
||||
VAR cSelTheme
|
||||
|
||||
METHOD new( oIde, cIniFile )
|
||||
METHOD create( oIde, cIniFile )
|
||||
METHOD destroy()
|
||||
@@ -144,7 +147,7 @@ CLASS IdeThemes INHERIT IdeObject
|
||||
METHOD updateColor()
|
||||
METHOD updateAttribute( nAttr, iState )
|
||||
METHOD selectTheme()
|
||||
METHOD selectThemeProc( nMode, p, oSL, cTheme )
|
||||
METHOD selectThemeProc( nMode, p )
|
||||
METHOD buildINI()
|
||||
METHOD parseINI( lAppend )
|
||||
METHOD updateLineNumbersBkColor()
|
||||
@@ -222,6 +225,13 @@ METHOD IdeThemes:create( oIde, cIniFile )
|
||||
|
||||
METHOD IdeThemes:destroy()
|
||||
|
||||
IF !empty( ::oSL )
|
||||
::disConnect( ::oSL:qObj[ "listOptions" ], "doubleClicked(QModelIndex)" )
|
||||
::disConnect( ::oSL:qObj[ "buttonOk" ], "clicked()" )
|
||||
::disConnect( ::oSL:qObj[ "buttonCancel" ], "clicked()" )
|
||||
::oSL:destroy()
|
||||
ENDIF
|
||||
|
||||
IF !empty( ::oUI )
|
||||
::qHiliter := NIL
|
||||
::qEdit := NIL
|
||||
@@ -685,13 +695,16 @@ METHOD IdeThemes:updateAttribute( nAttr, iState )
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
METHOD IdeThemes:selectTheme()
|
||||
LOCAL cTheme := ""
|
||||
LOCAL oSL, oStrList, oStrModel, a_, nDone
|
||||
LOCAL pSlots := Qt_Slots_New()
|
||||
LOCAL oStrList, oStrModel, a_, nDone
|
||||
|
||||
oSL := HbQtUI():new( ::oIde:resPath + "selectionlist.uic", ::oIde:oDlg:oWidget ):build()
|
||||
IF empty( ::oSL )
|
||||
::oSL := HbQtUI():new( hbide_uic( "selectionlist" ), ::oIde:oDlg:oWidget ):build()
|
||||
::oSL:setWindowTitle( "Available Themes" )
|
||||
|
||||
oSL:setWindowTitle( "Available Themes" )
|
||||
::connect( ::oSL:qObj[ "listOptions" ], "doubleClicked(QModelIndex)", {|p| ::selectThemeProc( 1, p ) } )
|
||||
::connect( ::oSL:qObj[ "buttonOk" ], "clicked()" , {|p| ::selectThemeProc( 2, p ) } )
|
||||
::connect( ::oSL:qObj[ "buttonCancel" ], "clicked()" , {|p| ::selectThemeProc( 3, p ) } )
|
||||
ENDIF
|
||||
|
||||
oStrList := QStringList():new()
|
||||
FOR EACH a_ IN ::aThemes
|
||||
@@ -701,40 +714,30 @@ METHOD IdeThemes:selectTheme()
|
||||
oStrModel := QStringListModel():new()
|
||||
oStrModel:setStringList( oStrList )
|
||||
|
||||
oSL:qObj[ "listOptions" ]:setModel( oStrModel )
|
||||
::oSL:qObj[ "listOptions" ]:setModel( oStrModel )
|
||||
|
||||
Qt_Slots_Connect( pSlots, oSL:qObj[ "listOptions" ], "doubleClicked(QModelIndex)", {|p| ::selectThemeProc( 1, p, oSL, @cTheme ) } )
|
||||
Qt_Slots_Connect( pSlots, oSL:qObj[ "buttonOk" ], "clicked()" , {|p| ::selectThemeProc( 2, p, oSL, @cTheme ) } )
|
||||
Qt_Slots_Connect( pSlots, oSL:qObj[ "buttonCancel" ], "clicked()" , {|p| ::selectThemeProc( 3, p, oSL ) } )
|
||||
nDone := ::oSL:exec()
|
||||
|
||||
nDone := oSL:exec()
|
||||
|
||||
Qt_Slots_disConnect( pSlots, oSL:qObj[ "listOptions" ], "doubleClicked(QModelIndex)" )
|
||||
Qt_Slots_disConnect( pSlots, oSL:qObj[ "buttonOk" ], "clicked()" )
|
||||
Qt_Slots_disConnect( pSlots, oSL:qObj[ "buttonCancel" ], "clicked()" )
|
||||
|
||||
oSL:destroy()
|
||||
|
||||
RETURN iif( nDone == 1, cTheme, "" )
|
||||
RETURN iif( nDone == 1, ::cSelTheme, "" )
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
METHOD IdeThemes:selectThemeProc( nMode, p, oSL, cTheme )
|
||||
METHOD IdeThemes:selectThemeProc( nMode, p )
|
||||
LOCAL qModalIndex
|
||||
|
||||
DO CASE
|
||||
CASE nMode == 1
|
||||
qModalIndex := QModelIndex():configure( p )
|
||||
cTheme := ::aThemes[ qModalIndex:row() + 1, 1 ]
|
||||
oSL:done( 1 )
|
||||
::cSelTheme := ::aThemes[ qModalIndex:row() + 1, 1 ]
|
||||
::oSL:done( 1 )
|
||||
|
||||
CASE nMode == 2
|
||||
qModalIndex := QModelIndex():configure( oSL:qObj[ "listOptions" ]:currentIndex() )
|
||||
cTheme := ::aThemes[ qModalIndex:row() + 1, 1 ]
|
||||
oSL:done( 1 )
|
||||
qModalIndex := QModelIndex():configure( ::oSL:qObj[ "listOptions" ]:currentIndex() )
|
||||
::cSelTheme := ::aThemes[ qModalIndex:row() + 1, 1 ]
|
||||
::oSL:done( 1 )
|
||||
|
||||
CASE nMode == 3
|
||||
oSL:done( 0 )
|
||||
::oSL:done( 0 )
|
||||
|
||||
ENDCASE
|
||||
|
||||
|
||||
@@ -100,14 +100,22 @@ HBQPlainTextEdit::HBQPlainTextEdit( QWidget * parent ) : QPlainTextEdit( parent
|
||||
|
||||
HBQPlainTextEdit::~HBQPlainTextEdit()
|
||||
{
|
||||
if( block )
|
||||
hb_itemRelease( block );
|
||||
HB_TRACE( HB_TR_ALWAYS, ( "HBQPlainTextEdit::~HBQPlainTextEdit( 0 )" ) );
|
||||
|
||||
disconnect( this, SIGNAL( blockCountChanged( int ) ) );
|
||||
disconnect( this, SIGNAL( updateRequest( const QRect &, int ) ) );
|
||||
disconnect( this, SIGNAL( cursorPositionChanged() ) );
|
||||
|
||||
HB_TRACE( HB_TR_ALWAYS, ( "HBQPlainTextEdit::~HBQPlainTextEdit( 1 )" ) );
|
||||
|
||||
delete lineNumberArea;
|
||||
|
||||
HB_TRACE( HB_TR_ALWAYS, ( "HBQPlainTextEdit::~HBQPlainTextEdit( 2 )" ) );
|
||||
|
||||
if( block )
|
||||
hb_itemRelease( block );
|
||||
|
||||
HB_TRACE( HB_TR_ALWAYS, ( "HBQPlainTextEdit::~HBQPlainTextEdit( 3 )" ) );
|
||||
}
|
||||
|
||||
void HBQPlainTextEdit::hbSetEventBlock( PHB_ITEM pBlock )
|
||||
@@ -259,6 +267,48 @@ void HBQPlainTextEdit::mouseDoubleClickEvent( QMouseEvent *event )
|
||||
|
||||
void HBQPlainTextEdit::paintEvent( QPaintEvent * event )
|
||||
{
|
||||
QPainter painter( viewport() );
|
||||
|
||||
int curBlock = textCursor().blockNumber();
|
||||
|
||||
QTextBlock tblock = firstVisibleBlock();
|
||||
int blockNumber = tblock.blockNumber();
|
||||
int height = ( int ) blockBoundingRect( tblock ).height();
|
||||
int top = ( int ) blockBoundingGeometry( tblock ).translated( contentOffset() ).top();
|
||||
int bottom = top + height;
|
||||
|
||||
while( tblock.isValid() && top <= event->rect().bottom() )
|
||||
{
|
||||
if( tblock.isVisible() && bottom >= event->rect().top() )
|
||||
{
|
||||
int index = bookMarksGoto.indexOf( blockNumber + 1 );
|
||||
if( index != -1 )
|
||||
{
|
||||
QRect r( 0, top, viewport()->width(), height );
|
||||
painter.fillRect( r, brushForBookmark( index ) );
|
||||
}
|
||||
else if( curBlock == blockNumber && m_currentLineColor.isValid() )
|
||||
{
|
||||
if( highlightCurLine == true )
|
||||
{
|
||||
QRect r = HBQPlainTextEdit::cursorRect();
|
||||
r.setX( 0 );
|
||||
r.setWidth( viewport()->width() );
|
||||
painter.fillRect( r, QBrush( m_currentLineColor ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
tblock = tblock.next();
|
||||
top = bottom;
|
||||
bottom = top + height;
|
||||
++blockNumber;
|
||||
}
|
||||
this->hbPaintColumnSelection( event );
|
||||
|
||||
painter.end();
|
||||
QPlainTextEdit::paintEvent( event );
|
||||
|
||||
#if 0
|
||||
QPainter * painter = new QPainter( viewport() );
|
||||
|
||||
int curBlock = textCursor().blockNumber();
|
||||
@@ -297,7 +347,7 @@ void HBQPlainTextEdit::paintEvent( QPaintEvent * event )
|
||||
}
|
||||
this->hbPaintColumnSelection( event );
|
||||
|
||||
#if 1 /* A day wasted - I could not find how I can execute paiting from within prg code */
|
||||
#if 0 /* A day wasted - I could not find how I can execute paiting from within prg code */
|
||||
if( block )
|
||||
{
|
||||
PHB_ITEM p1 = hb_itemPutNI( NULL, QEvent::Paint );
|
||||
@@ -309,7 +359,9 @@ void HBQPlainTextEdit::paintEvent( QPaintEvent * event )
|
||||
#endif
|
||||
|
||||
painter->end();
|
||||
delete ( ( QPainter * ) painter );
|
||||
QPlainTextEdit::paintEvent( event );
|
||||
#endif
|
||||
}
|
||||
|
||||
QBrush HBQPlainTextEdit::brushForBookmark( int index )
|
||||
@@ -396,6 +448,8 @@ void HBQPlainTextEdit::hbBookmarks( int block )
|
||||
{
|
||||
bookMarksGoto.append( block );
|
||||
}
|
||||
|
||||
hbUpdateLineNumberAreaWidth( 0 );
|
||||
lineNumberArea->repaint();
|
||||
update();
|
||||
}
|
||||
@@ -486,7 +540,11 @@ int HBQPlainTextEdit::hbLineNumberAreaWidth()
|
||||
max /= 10;
|
||||
++digits;
|
||||
}
|
||||
int space = ( 18 + fontMetrics().width( QLatin1Char( '9' ) ) * digits ) + 2;
|
||||
int width = fontMetrics().width( QLatin1Char( '9' ) );
|
||||
int iM = fontMetrics().height() / 2;
|
||||
int iMark = bookMarksGoto.size() > 0 ? ( 5 + iM + 2 ) : 0;
|
||||
int space = iMark + ( width * digits ) + 2;
|
||||
|
||||
return space;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user