diff --git a/harbour/ChangeLog b/harbour/ChangeLog index d55ede2eed..d4b3adb29f 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,23 @@ past entries belonging to author(s): Viktor Szakats. */ +2010-02-27 19:16 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) + * contrib/hbide/resources/harbour_splash.png + * contrib/hbide/resources/hbidesplash.png + * contrib/hbide/resources/togglelinenumber.png + + * contrib/hbqt/hbqt_hbqplaintextedit.cpp + * contrib/hbqt/hbqt_hbqplaintextedit.h + + * contrib/hbide/hbide.prg + * contrib/hbide/idedocks.prg + * contrib/hbide/ideeditor.prg + + Implemented: toggling the line-numbers visibility in editors. + Slot is provided with left-hand toolbar button. + Toggling is availabler per one editor tab. + + + Entered: copy-right information in hbIDE splash screen. + 2010-02-27 15:59 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) * contrib/hbqt/gtqtc/gtqtc.cpp ! Fix to warning: QFont::setPointSize: Point size <= 0 (0), must be greater than 0 diff --git a/harbour/contrib/hbide/hbide.prg b/harbour/contrib/hbide/hbide.prg index d148b681ca..6cc6328591 100644 --- a/harbour/contrib/hbide/hbide.prg +++ b/harbour/contrib/hbide/hbide.prg @@ -305,7 +305,7 @@ METHOD HbIde:create( cProjIni ) #if 1 LOCAL qPixmap, qSplash, nStart - qPixmap := QPixmap():new( hb_dirBase() + "resources" + hb_osPathSeparator() + "harbour_splash.png" ) + qPixmap := QPixmap():new( hb_dirBase() + "resources" + hb_osPathSeparator() + "hbidesplash.png" ) qSplash := QSplashScreen():new() qSplash:setWindowFlags( hb_bitOr( Qt_WindowStaysOnTopHint, qSplash:windowFlags() ) ) qSplash:setPixmap( qPixmap ) diff --git a/harbour/contrib/hbide/idedocks.prg b/harbour/contrib/hbide/idedocks.prg index c3c3057402..73ea1e306b 100644 --- a/harbour/contrib/hbide/idedocks.prg +++ b/harbour/contrib/hbide/idedocks.prg @@ -304,7 +304,7 @@ METHOD IdeDocks:buildDialog() LOCAL s, aSize ::oIde:oDlg := XbpDialog():new() - ::oDlg:icon := ::resPath + "hbide.png" // "vr.png" + ::oDlg:icon := hbide_image( "hbide" ) ::oDlg:title := "Harbour IDE" ::oDlg:qtObject := HbQtUI():new( ::resPath + "mainwindow.uic" ):build() ::oDlg:create( , , , , , .f. ) @@ -533,19 +533,25 @@ METHOD IdeDocks:buildToolBarPanels() ::oDlg:oWidget:addToolBar( Qt_LeftToolBarArea, ::qTBarLines ) aBtns := {} - aadd( aBtns, { "movelineup" , "Move Current Line Up" , {|| ::oEM:moveLine( -1 ) } } ) - aadd( aBtns, { "movelinedown" , "Move Current Line Down", {|| ::oEM:moveLine( 1 ) } } ) - aadd( aBtns, { "deleteline" , "Delete Current Line" , {|| ::oEM:deleteLine() } } ) - aadd( aBtns, { "duplicateline", "Duplicate Current Line", {|| ::oEM:duplicateLine() } } ) + aadd( aBtns, { "movelineup" , "Move Current Line Up" , {|| ::oEM:moveLine( -1 ) } } ) + aadd( aBtns, { "movelinedown" , "Move Current Line Down" , {|| ::oEM:moveLine( 1 ) } } ) + aadd( aBtns, { "deleteline" , "Delete Current Line" , {|| ::oEM:deleteLine() } } ) + aadd( aBtns, { "duplicateline", "Duplicate Current Line" , {|| ::oEM:duplicateLine() } } ) + aadd( aBtns, {} ) + aadd( aBtns, { "togglelinenumber", "Toggle Line Numbers" , {|| ::oEM:toggleLineNumbers() } } ) FOR EACH a_ IN aBtns - qTBtn := QToolButton():new() - qTBtn:setTooltip( a_[ 2 ] ) - qTBtn:setIcon( ::resPath + a_[ 1 ] + ".png" ) - qTBtn:setMaximumWidth( 20 ) - qTBtn:setMaximumHeight( 20 ) - ::connect( qTBtn, "clicked()", a_[ 3 ] ) - ::qTBarLines:addWidget( qTBtn ) - aadd( ::aBtnLines, qTBtn ) + IF empty( a_ ) + ::qTBarLines:addSeparator() + ELSE + qTBtn := QToolButton():new() + qTBtn:setTooltip( a_[ 2 ] ) + qTBtn:setIcon( ::resPath + a_[ 1 ] + ".png" ) + qTBtn:setMaximumWidth( 20 ) + qTBtn:setMaximumHeight( 20 ) + ::connect( qTBtn, "clicked()", a_[ 3 ] ) + ::qTBarLines:addWidget( qTBtn ) + aadd( ::aBtnLines, qTBtn ) + ENDIF NEXT ::qTBarLines:addSeparator() @@ -562,7 +568,6 @@ METHOD IdeDocks:buildToolBarPanels() aadd( aBtns, {} ) aadd( aBtns, { "sgl2dblquote" , "Single to Double Quotes", {|| ::oEM:convertDQuotes() } } ) aadd( aBtns, { "dbl2sglquote" , "Double to Single Quotes", {|| ::oEM:convertQuotes() } } ) - aadd( aBtns, {} ) FOR EACH a_ IN aBtns IF empty( a_ ) ::qTBarLines:addSeparator() @@ -577,6 +582,7 @@ METHOD IdeDocks:buildToolBarPanels() aadd( ::aBtnLines, qTBtn ) ENDIF NEXT + ::qTBarLines:addSeparator() /* Right-hand docks toolbar */ ::oIde:qTBarDocks := QToolBar():new() diff --git a/harbour/contrib/hbide/ideeditor.prg b/harbour/contrib/hbide/ideeditor.prg index c7a9769835..81660e0588 100644 --- a/harbour/contrib/hbide/ideeditor.prg +++ b/harbour/contrib/hbide/ideeditor.prg @@ -144,6 +144,7 @@ CLASS IdeEditsManager INHERIT IdeObject METHOD convertQuotes() METHOD convertDQuotes() METHOD toggleSelectionMode() + METHOD toggleLineNumbers() ENDCLASS @@ -589,6 +590,17 @@ METHOD IdeEditsManager:switchToReadOnly() /*----------------------------------------------------------------------*/ +METHOD IdeEditsManager:toggleLineNumbers() + LOCAL oEdit + + IF !empty( oEdit := ::getEditObjectCurrent() ) + oEdit:toggleLineNumbers() + ENDIF + + RETURN Self + +/*----------------------------------------------------------------------*/ + METHOD IdeEditsManager:convertSelection( cKey ) LOCAL oEdit @@ -1355,6 +1367,7 @@ CLASS IdeEdit INHERIT IdeObject DATA lUpdatePrevWord INIT .f. DATA lCopyWhenDblClicked INIT .f. DATA cCurLineText INIT "" + DATA lLineNumbersVisible INIT .t. METHOD new( oEditor, nMode ) METHOD create( oEditor, nMode ) @@ -1381,6 +1394,7 @@ CLASS IdeEdit INHERIT IdeObject METHOD handleCurrentIndent() METHOD handlePreviousWord( lUpdatePrevWord ) METHOD loadFuncHelp() + METHOD toggleLineNumbers() ENDCLASS @@ -1729,6 +1743,15 @@ METHOD IdeEdit:presentSkeletons() /*----------------------------------------------------------------------*/ +METHOD IdeEdit:toggleLineNumbers() + + ::lLineNumbersVisible := ! ::lLineNumbersVisible + ::qEdit:numberBlockVisible( ::lLineNumbersVisible ) + + RETURN Self + +/*----------------------------------------------------------------------*/ + METHOD IdeEdit:gotoMark( nIndex ) IF len( ::aBookMarks ) >= nIndex ::qEdit:gotoBookmark( ::aBookMarks[ nIndex ] ) diff --git a/harbour/contrib/hbide/resources/harbour_splash.png b/harbour/contrib/hbide/resources/harbour_splash.png deleted file mode 100644 index 94d92132b0..0000000000 Binary files a/harbour/contrib/hbide/resources/harbour_splash.png and /dev/null differ diff --git a/harbour/contrib/hbide/resources/hbidesplash.png b/harbour/contrib/hbide/resources/hbidesplash.png new file mode 100644 index 0000000000..30ebbd5359 Binary files /dev/null and b/harbour/contrib/hbide/resources/hbidesplash.png differ diff --git a/harbour/contrib/hbide/resources/togglelinenumber.png b/harbour/contrib/hbide/resources/togglelinenumber.png new file mode 100644 index 0000000000..ea93aeca9d Binary files /dev/null and b/harbour/contrib/hbide/resources/togglelinenumber.png differ diff --git a/harbour/contrib/hbqt/hbqt_hbqplaintextedit.cpp b/harbour/contrib/hbqt/hbqt_hbqplaintextedit.cpp index 3883c92348..4b043c4325 100644 --- a/harbour/contrib/hbqt/hbqt_hbqplaintextedit.cpp +++ b/harbour/contrib/hbqt/hbqt_hbqplaintextedit.cpp @@ -333,6 +333,27 @@ void HBQPlainTextEdit::prevBookmark( int block ) } } +void HBQPlainTextEdit::numberBlockVisible( bool b ) +{ + numberBlock = b; + if( b ) + { + lineNumberArea->show(); + updateLineNumberAreaWidth( lineNumberAreaWidth() ); + } + else + { + lineNumberArea->hide(); + updateLineNumberAreaWidth( 0 ); + } + update(); +} + +bool HBQPlainTextEdit::numberBlockVisible() +{ + return numberBlock; +} + int HBQPlainTextEdit::lineNumberAreaWidth() { int digits = 1; @@ -348,7 +369,14 @@ int HBQPlainTextEdit::lineNumberAreaWidth() void HBQPlainTextEdit::updateLineNumberAreaWidth( int ) { - setViewportMargins( lineNumberAreaWidth(), 0, 0, 0 ); + if( numberBlock ) + { + setViewportMargins( lineNumberAreaWidth(), 0, 0, 0 ); + } + else + { + setViewportMargins( 0, 0, 0, 0 ); + } } void HBQPlainTextEdit::updateLineNumberArea( const QRect &rect, int dy ) diff --git a/harbour/contrib/hbqt/hbqt_hbqplaintextedit.h b/harbour/contrib/hbqt/hbqt_hbqplaintextedit.h index e5a497443b..928a07a176 100644 --- a/harbour/contrib/hbqt/hbqt_hbqplaintextedit.h +++ b/harbour/contrib/hbqt/hbqt_hbqplaintextedit.h @@ -100,8 +100,6 @@ public: void nextBookmark( int block ); void prevBookmark( int block ); void gotoBookmark( int block ); - void numberBlockVisible( bool b ) { numberBlock = b; } - bool numberBlockVisible() { return numberBlock; } void highlightCurrentLine( bool b ) { highlightCurLine = b; } bool highlightCurrentLine() { return highlightCurLine; } void hbSetEventBlock( PHB_ITEM pBlock ); @@ -153,6 +151,8 @@ public slots: void insertTab( int mode ); void highlightSelectedColumns( bool yes ); QString getSelectedText(); + void numberBlockVisible( bool b ); + bool numberBlockVisible(); private slots: void slotCursorPositionChanged();