diff --git a/harbour/ChangeLog b/harbour/ChangeLog index b521995249..664a40ef9a 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,30 @@ past entries belonging to author(s): Viktor Szakats. */ +2010-03-09 18:24 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) + * contrib/hbide/resources/funclist.ui + * contrib/hbide/resources/funclist.uic + ! Shifted "Projects Selection" list downwards. + + * contrib/hbide/hbide.prg + * contrib/hbide/idedocks.prg + * contrib/hbide/ideeditor.prg + * contrib/hbide/ideobject.prg + ! Reworked behavior of function's prototype display as tooltip. + Now it stays there until you press ")", i.e., a function call is + made complete. If you move the cursor anywhere in the editor, + the tooltip will disappear, and will reappear when cursor + will be past the "(" opening brace. The same holds true + if you play with another widget. Tooltip has a suspended + and active behavior. + + ! Changed the behavior of "line numbers" display in the editor tabs. + Now it is active for all the tabs on all the panels. The icon + at the left will visualize as active or passive accordingly. + + ! Corrected behavior of navigation in "Editor tabs" also as + par with behavior in "Projects Tree". + 2010-03-09 23:36 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/include/hbcomp.h * harbour/include/hbcompdf.h diff --git a/harbour/contrib/hbide/hbide.prg b/harbour/contrib/hbide/hbide.prg index 6af022cd83..53f012a6ba 100644 --- a/harbour/contrib/hbide/hbide.prg +++ b/harbour/contrib/hbide/hbide.prg @@ -176,6 +176,7 @@ CLASS HbIde DATA qTBarLines DATA qTBarPanels DATA qTBarDocks + DATA qCompleter ACCESS oCurEditor INLINE ::oEM:getEditorCurrent() ACCESS qCurEdit INLINE ::oEM:getEditCurrent() @@ -225,6 +226,7 @@ CLASS HbIde DATA lDockBVisible INIT .f. DATA lTabCloseRequested INIT .f. DATA isColumnSelectionEnabled INIT .f. + DATA lLineNumbersVisible INIT .t. DATA cWrkProject INIT "" DATA cWrkTheme INIT "" @@ -1045,7 +1047,7 @@ METHOD HbIde:manageItemSelected( oXbpTreeItem ) ENDCASE - ::manageFocusInEditor() + // ::manageFocusInEditor() RETURN Self /*----------------------------------------------------------------------*/ diff --git a/harbour/contrib/hbide/idedocks.prg b/harbour/contrib/hbide/idedocks.prg index 77742b30b2..fb7b3cc19b 100644 --- a/harbour/contrib/hbide/idedocks.prg +++ b/harbour/contrib/hbide/idedocks.prg @@ -494,7 +494,8 @@ METHOD IdeDocks:buildToolBarPanels() 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() } } ) + aadd( aBtns, { "togglelinenumber", "Toggle Line Numbers" , {|| ::oIde:lLineNumbersVisible := ! ::lLineNumbersVisible, ; + ::oEM:toggleLineNumbers() } } ) FOR EACH a_ IN aBtns IF empty( a_ ) ::qTBarLines:addSeparator() @@ -504,6 +505,9 @@ METHOD IdeDocks:buildToolBarPanels() qTBtn:setIcon( ::resPath + a_[ 1 ] + ".png" ) qTBtn:setMaximumWidth( 20 ) qTBtn:setMaximumHeight( 20 ) + IF a_[ 1 ] == "togglelinenumber" + qTBtn:setCheckable( .t. ) + ENDIF ::connect( qTBtn, "clicked()", a_[ 3 ] ) ::qTBarLines:addWidget( qTBtn ) aadd( ::aBtnLines, qTBtn ) @@ -677,7 +681,7 @@ METHOD IdeDocks:buildEditorTree() ::oEditTree:oWidget:setMinimumWidth( 100 ) //::oEditTree:itemMarked := {|oItem| ::manageItemSelected( 0, oItem ), ::oCurProjItem := oItem } - ::oEditTree:itemMarked := {|oItem| ::oIde:oCurProjItem := oItem, ::oIde:manageFocusInEditor() } + ::oEditTree:itemMarked := {|oItem| ::oIde:oCurProjItem := oItem } ::oEditTree:itemSelected := {|oItem| ::oIde:manageItemSelected( oItem ) } ::oEditTree:hbContextMenu := {|mp1, mp2, oXbp| ::oIde:manageProjectContext( mp1, mp2, oXbp ) } diff --git a/harbour/contrib/hbide/ideeditor.prg b/harbour/contrib/hbide/ideeditor.prg index 661d56343c..fcb04b1f4b 100644 --- a/harbour/contrib/hbide/ideeditor.prg +++ b/harbour/contrib/hbide/ideeditor.prg @@ -84,6 +84,7 @@ #define blockCountChanged 21 #define contentsChange 22 +#define timerTimeout 23 #define EDT_LINNO_WIDTH 50 @@ -195,6 +196,10 @@ METHOD IdeEditsManager:create( oIde ) aadd( ::aActions, { "" , oSub:addSeparator() } ) aadd( ::aActions, { "Close Split" , oSub:addAction( "Close Split Window" ) } ) + ::oIde:qCompleter := QCompleter():new() + ::qCompleter:setCaseSensitivity( Qt_CaseInsensitive ) + + RETURN Self /*----------------------------------------------------------------------*/ @@ -1209,6 +1214,7 @@ METHOD IdeEditor:activateTab( mp1, mp2, oXbp ) IF !empty( oEdit := ::oEM:getEditorByTabObject( oXbp ) ) oEdit:setDocumentProperties() oEdit:qCoEdit:relayMarkButtons() + oEdit:qCoEdit:toggleLineNumbers() ENDIF RETURN Self @@ -1340,7 +1346,12 @@ CLASS IdeEdit INHERIT IdeObject DATA lUpdatePrevWord INIT .f. DATA lCopyWhenDblClicked INIT .f. DATA cCurLineText INIT "" - DATA lLineNumbersVisible INIT .t. + + DATA cProto INIT "" + DATA qTimer + DATA nProtoLine INIT -1 + DATA nProtoCol INIT -1 + DATA isSuspended INIT .f. METHOD new( oEditor, nMode ) METHOD create( oEditor, nMode ) @@ -1377,9 +1388,16 @@ CLASS IdeEdit INHERIT IdeObject METHOD getLine( lSelect ) METHOD getText() METHOD getSelectedText() + METHOD getColumnNo() + METHOD getLineNo() METHOD insertSeparator() METHOD insertText( cText ) + METHOD suspendPrototype() + METHOD resumePrototype() + METHOD showPrototype( cProto ) + METHOD hidePrototype() + ENDCLASS /*----------------------------------------------------------------------*/ @@ -1413,6 +1431,8 @@ METHOD IdeEdit:create( oEditor, nMode ) ::qEdit:hbHighlightCurrentLine( .t. ) /* Via user-setup */ ::qEdit:hbSetSpaces( ::nTabSpaces ) + ::toggleLineNumbers() + ::qHLayout := QHBoxLayout():new() ::qHLayout:setSpacing( 0 ) @@ -1422,18 +1442,31 @@ METHOD IdeEdit:create( oEditor, nMode ) Qt_Events_Connect( ::pEvents, ::qEdit, QEvent_KeyPress , {|p| ::execKeyEvent( 101, QEvent_KeyPress, p ) } ) Qt_Events_Connect( ::pEvents, ::qEdit, QEvent_Wheel , {|p| ::execKeyEvent( 102, QEvent_Wheel , p ) } ) + Qt_Events_Connect( ::pEvents, ::qEdit, QEvent_FocusIn , {| | ::execKeyEvent( 104, QEvent_FocusIn ) } ) + Qt_Events_Connect( ::pEvents, ::qEdit, QEvent_FocusOut , {| | ::execKeyEvent( 105, QEvent_FocusOut ) } ) Qt_Events_Connect( ::pEvents, ::qEdit, QEvent_MouseButtonDblClick, {|p| ::execKeyEvent( 103, QEvent_MouseButtonDblClick, p ) } ) ::qEdit:hbSetEventBlock( {|p| ::execKeyEvent( 115, 1001, p ) } ) + ::qTimer := QTimer():new() + ::qTimer:setInterval( 2000 ) + ::connect( ::qTimer, "timeout()", {|| ::execEvent( timerTimeout, Self ) } ) + RETURN Self /*----------------------------------------------------------------------*/ METHOD IdeEdit:destroy() - Qt_Events_DisConnect( ::pEvents, ::qEdit, QEvent_KeyPress ) - Qt_Events_DisConnect( ::pEvents, ::qEdit, QEvent_Wheel ) + ::disconnect( ::qTimer, "timeout()" ) + IF ::qTimer:isActive() + ::qTimer:stop() + ENDIF + ::qTimer := NIL + + Qt_Events_DisConnect( ::pEvents, ::qEdit, QEvent_KeyPress ) + Qt_Events_DisConnect( ::pEvents, ::qEdit, QEvent_Wheel ) + Qt_Events_DisConnect( ::pEvents, ::qEdit, QEvent_MouseButtonDblClick ) ::disconnectEditSignals( Self ) @@ -1488,7 +1521,7 @@ METHOD IdeEdit:connectEditSignals( oEdit ) /*----------------------------------------------------------------------*/ METHOD IdeEdit:execEvent( nMode, oEdit, p, p1 ) - LOCAL pAct, qAct, n, qCursor, qEdit, oo + LOCAL pAct, qAct, n, qCursor, qEdit, oo, nLine HB_SYMBOL_UNUSED( p1 ) @@ -1539,6 +1572,7 @@ METHOD IdeEdit:execEvent( nMode, oEdit, p, p1 ) /* Book Marks reach-out buttons */ ::relayMarkButtons() + ::toggleLineNumbers() /* An experimental move but seems a lot is required to achieve column selection */ qEdit:hbHighlightSelectedColumns( ::isColumnSelectionEnabled ) @@ -1547,10 +1581,24 @@ METHOD IdeEdit:execEvent( nMode, oEdit, p, p1 ) EXIT CASE cursorPositionChanged - //hbide_dbg( "cursorPositionChanged()" ) + // hbide_dbg( "cursorPositionChanged()", ::nProtoLine, ::nProtoCol, ::isSuspended, ::getLineNo(), ::getColumnNo(), ::cProto ) ::oEditor:dispEditInfo( qEdit ) ::handlePreviousWord( ::lUpdatePrevWord ) ::handleCurrentIndent() + + IF ::nProtoLine != -1 + nLine := ::getLineNo() + IF ! ::isSuspended + IF nLine != ::nProtoLine .OR. ::getColumnNo() <= ::nProtoCol + ::suspendPrototype() + ENDIF + ELSE + IF nLine == ::nProtoLine .AND. ::getColumnNo() >= ::nProtoCol + ::resumePrototype() + ENDIF + ENDIF + ENDIF + EXIT CASE copyAvailable @@ -1560,6 +1608,14 @@ METHOD IdeEdit:execEvent( nMode, oEdit, p, p1 ) ::lCopyWhenDblClicked := .f. EXIT + CASE timerTimeout + IF empty( ::cProto ) + ::hidePrototype() + ELSE + ::showPrototype() + ENDIF + EXIT + #if 0 CASE modificationChanged //hbide_dbg( "modificationChanged(bool)", p ) @@ -1668,13 +1724,31 @@ METHOD IdeEdit:execKeyEvent( nMode, nEvent, p ) ENDIF CASE Qt_Key_ParenLeft IF ! lCtrl .AND. ! lAlt - ::loadFuncHelp() + ::loadFuncHelp() // Also invokes prototype display + ENDIF + EXIT + CASE Qt_Key_ParenRight + IF ! lCtrl .AND. ! lAlt + ::hidePrototype() + ENDIF + EXIT + CASE Qt_Key_T + IF lCtrl + ::gotoFunction() ENDIF EXIT ENDSWITCH EXIT + CASE QEvent_FocusIn + ::resumePrototype() + EXIT + + CASE QEvent_FocusOut + ::suspendPrototype() + EXIT + CASE QEvent_Wheel EXIT @@ -1682,6 +1756,7 @@ METHOD IdeEdit:execKeyEvent( nMode, nEvent, p ) ::lCopyWhenDblClicked := .t. EXIT + CASE 1001 IF p == QEvent_MouseButtonDblClick ::lCopyWhenDblClicked := .f. /* not intuitive */ @@ -1733,7 +1808,6 @@ METHOD IdeEdit:presentSkeletons() METHOD IdeEdit:toggleLineNumbers() - ::lLineNumbersVisible := ! ::lLineNumbersVisible ::qEdit:hbNumberBlockVisible( ::lLineNumbersVisible ) RETURN Self @@ -1906,6 +1980,16 @@ METHOD IdeEdit:getLine( lSelect ) /*----------------------------------------------------------------------*/ +METHOD IdeEdit:getColumnNo() + RETURN QTextCursor():from( ::qEdit:textCursor() ):columnNumber() + 1 + +/*----------------------------------------------------------------------*/ + +METHOD IdeEdit:getLineNo() + RETURN QTextCursor():from( ::qEdit:textCursor() ):blockNumber() + 1 + +/*----------------------------------------------------------------------*/ + METHOD IdeEdit:insertSeparator() LOCAL qCursor := QTextCursor():configure( ::qEdit:textCursor() ) @@ -1941,47 +2025,6 @@ METHOD IdeEdit:insertText( cText ) /*----------------------------------------------------------------------*/ -METHOD IdeEdit:gotoFunction() - LOCAL cWord - IF !empty( cWord := ::getWord( .f. ) ) - ::oFN:jumpToFunction( cWord, .t. ) - ENDIF - RETURN Self - -/*----------------------------------------------------------------------*/ - -METHOD IdeEdit:clickFuncHelp() - LOCAL cWord - IF !empty( cWord := ::getWord( .f. ) ) - IF ! empty( ::oHL ) - ::oHL:jumpToFunction( cWord ) - ENDIF - ENDIF - RETURN Self - -/*----------------------------------------------------------------------*/ - -METHOD IdeEdit:loadFuncHelp() - LOCAL qEdit, qCursor, qTextBlock, cText, cWord, nCol, cProto - - qEdit := ::qEdit - - qCursor := QTextCursor():configure( qEdit:textCursor() ) - qTextBlock := QTextBlock():configure( qCursor:block() ) - cText := qTextBlock:text() - nCol := qCursor:columnNumber() - cWord := hbide_getPreviousWord( cText, nCol ) - IF !empty( cWord ) - IF ! empty( ::oHL ) - ::oHL:jumpToFunction( cWord ) - ENDIF - cProto := ::oFN:positionToFunction( cWord, .t. ) - qEdit:hbShowPrototype( hbide_formatProto( cProto ) ) - ENDIF - RETURN Self - -/*----------------------------------------------------------------------*/ - METHOD IdeEdit:handlePreviousWord( lUpdatePrevWord ) LOCAL qCursor, qTextBlock, cText, cWord, nB, nL, qEdit, lPrevOnly, nCol, nSpace, nSpaces, nOff @@ -2108,6 +2151,100 @@ METHOD IdeEdit:handleCurrentIndent() /*----------------------------------------------------------------------*/ +METHOD IdeEdit:gotoFunction() + LOCAL cWord + IF !empty( cWord := ::getWord( .f. ) ) + ::oFN:jumpToFunction( cWord, .t. ) + ENDIF + RETURN Self + +/*----------------------------------------------------------------------*/ + +METHOD IdeEdit:clickFuncHelp() + LOCAL cWord + IF !empty( cWord := ::getWord( .f. ) ) + IF ! empty( ::oHL ) + ::oHL:jumpToFunction( cWord ) + ENDIF + ENDIF + RETURN Self + +/*----------------------------------------------------------------------*/ + +METHOD IdeEdit:resumePrototype() + + ::isSuspended := .f. + IF !empty( ::qEdit ) + ::qEdit:hbShowPrototype( ::cProto ) + ENDIF + + RETURN Self + +/*----------------------------------------------------------------------*/ + +METHOD IdeEdit:suspendPrototype() + + ::isSuspended := .t. + IF !empty( ::qEdit ) + ::qEdit:hbShowPrototype( "" ) + ENDIF + + RETURN Self + +/*----------------------------------------------------------------------*/ + +METHOD IdeEdit:showPrototype( cProto ) + + IF ! ::isSuspended .AND. !empty( ::qEdit ) + IF !empty( cProto ) + ::cProto := cProto + ::nProtoLine := ::getLineNo() + ::nProtoCol := ::getColumnNo() + ::qTimer:start() + ENDIF + ::qEdit:hbShowPrototype( ::cProto ) + ENDIF + RETURN Self + +/*----------------------------------------------------------------------*/ + +METHOD IdeEdit:hidePrototype() + + IF !empty( ::qedit ) + ::nProtoLine := -1 + ::nProtoCol := -1 + ::cProto := "" + ::qTimer:stop() + ::qEdit:hbShowPrototype( "" ) + ENDIF + RETURN Self + +/*----------------------------------------------------------------------*/ + +METHOD IdeEdit:loadFuncHelp() + LOCAL qEdit, qCursor, qTextBlock, cText, cWord, nCol, cPro + + qEdit := ::qEdit + + qCursor := QTextCursor():configure( qEdit:textCursor() ) + qTextBlock := QTextBlock():configure( qCursor:block() ) + cText := qTextBlock:text() + nCol := qCursor:columnNumber() + cWord := hbide_getPreviousWord( cText, nCol ) + IF !empty( cWord ) + IF ! empty( ::oHL ) + ::oHL:jumpToFunction( cWord ) + ENDIF + IF !empty( cPro := ::oFN:positionToFunction( cWord, .t. ) ) + IF empty( ::cProto ) + ::showPrototype( ::cProto := hbide_formatProto( cPro ) ) + ENDIF + ENDIF + ENDIF + RETURN Self + +/*----------------------------------------------------------------------*/ + FUNCTION hbide_getPreviousWord( cText, nPos ) LOCAL cWord, n diff --git a/harbour/contrib/hbide/ideobject.prg b/harbour/contrib/hbide/ideobject.prg index 1d44e330d9..0ea8539580 100644 --- a/harbour/contrib/hbide/ideobject.prg +++ b/harbour/contrib/hbide/ideobject.prg @@ -119,6 +119,7 @@ CLASS IdeObject ACCESS qTBarLines INLINE ::oIde:qTBarLines ACCESS qTBarPanels INLINE ::oIde:qTBarPanels ACCESS qTBarDocks INLINE ::oIde:qTBarDocks + ACCESS qCompleter INLINE ::oIde:qCompleter ACCESS cWrkProject INLINE ::oIde:cWrkProject ACCESS cWrkTheme INLINE ::oIde:cWrkTheme @@ -183,6 +184,7 @@ CLASS IdeObject ACCESS lDockBVisible INLINE ::oIde:lDockBVisible ACCESS lTabCloseRequested INLINE ::oIde:lTabCloseRequested ACCESS isColumnSelectionEnabled INLINE ::oIde:isColumnSelectionEnabled + ACCESS lLineNumbersVisible INLINE ::oIde:lLineNumbersVisible ACCESS aMarkTBtns INLINE ::oIde:aMarkTBtns diff --git a/harbour/contrib/hbide/resources/funclist.ui b/harbour/contrib/hbide/resources/funclist.ui index ade125f4a6..e101261cdb 100644 --- a/harbour/contrib/hbide/resources/funclist.ui +++ b/harbour/contrib/hbide/resources/funclist.ui @@ -14,16 +14,6 @@ Form - - - - - 16777215 - 100 - - - - @@ -62,41 +52,51 @@ - + Qt::Horizontal - + Mark Projects - + Load Tags - + Re-Tag - + Close + + + + + 16777215 + 100 + + + + diff --git a/harbour/contrib/hbide/resources/funclist.uic b/harbour/contrib/hbide/resources/funclist.uic index ba4c5e77af..d3cb069f64 100644 --- a/harbour/contrib/hbide/resources/funclist.uic +++ b/harbour/contrib/hbide/resources/funclist.uic @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading ui file 'funclist.ui' ** -** Created: Tue Mar 9 12:14:29 2010 +** Created: Tue Mar 9 18:20:01 2010 ** by: Qt User Interface Compiler version 4.5.3 ** ** WARNING! All changes made in this file will be lost when recompiling ui file! @@ -30,7 +30,6 @@ class Ui_Form { public: QGridLayout *gridLayout; - QListWidget *listProjects; QLineEdit *editFunction; QTableWidget *tableFuncList; QLabel *label; @@ -41,6 +40,7 @@ public: QPushButton *buttonLoad; QPushButton *buttonTag; QPushButton *buttonClose; + QListWidget *listProjects; void setupUi(QWidget *Form) { @@ -49,12 +49,6 @@ public: Form->resize(400, 486); gridLayout = new QGridLayout(Form); gridLayout->setObjectName(QString::fromUtf8("gridLayout")); - listProjects = new QListWidget(Form); - listProjects->setObjectName(QString::fromUtf8("listProjects")); - listProjects->setMaximumSize(QSize(16777215, 100)); - - gridLayout->addWidget(listProjects, 0, 0, 1, 5); - editFunction = new QLineEdit(Form); editFunction->setObjectName(QString::fromUtf8("editFunction")); @@ -79,6 +73,7 @@ public: labelEntries = new QLabel(Form); labelEntries->setObjectName(QString::fromUtf8("labelEntries")); labelEntries->setMaximumSize(QSize(70, 16777215)); + labelEntries->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); gridLayout->addWidget(labelEntries, 3, 4, 1, 1); @@ -87,27 +82,33 @@ public: line->setFrameShape(QFrame::HLine); line->setFrameShadow(QFrame::Sunken); - gridLayout->addWidget(line, 4, 0, 1, 5); + gridLayout->addWidget(line, 5, 0, 1, 5); buttonMark = new QPushButton(Form); buttonMark->setObjectName(QString::fromUtf8("buttonMark")); - gridLayout->addWidget(buttonMark, 5, 0, 1, 2); + gridLayout->addWidget(buttonMark, 6, 0, 1, 2); buttonLoad = new QPushButton(Form); buttonLoad->setObjectName(QString::fromUtf8("buttonLoad")); - gridLayout->addWidget(buttonLoad, 5, 2, 1, 1); + gridLayout->addWidget(buttonLoad, 6, 2, 1, 1); buttonTag = new QPushButton(Form); buttonTag->setObjectName(QString::fromUtf8("buttonTag")); - gridLayout->addWidget(buttonTag, 5, 3, 1, 1); + gridLayout->addWidget(buttonTag, 6, 3, 1, 1); buttonClose = new QPushButton(Form); buttonClose->setObjectName(QString::fromUtf8("buttonClose")); - gridLayout->addWidget(buttonClose, 5, 4, 1, 1); + gridLayout->addWidget(buttonClose, 6, 4, 1, 1); + + listProjects = new QListWidget(Form); + listProjects->setObjectName(QString::fromUtf8("listProjects")); + listProjects->setMaximumSize(QSize(16777215, 100)); + + gridLayout->addWidget(listProjects, 4, 0, 1, 5); retranslateUi(Form); @@ -120,7 +121,7 @@ public: Form->setWindowTitle(QApplication::translate("Form", "Form", 0, QApplication::UnicodeUTF8)); label->setText(QApplication::translate("Form", "Syntax:", 0, QApplication::UnicodeUTF8)); labelEntries->setText(QString()); - buttonMark->setText(QApplication::translate("Form", "Mark Projs", 0, QApplication::UnicodeUTF8)); + buttonMark->setText(QApplication::translate("Form", "Mark Projects", 0, QApplication::UnicodeUTF8)); buttonLoad->setText(QApplication::translate("Form", "Load Tags", 0, QApplication::UnicodeUTF8)); buttonTag->setText(QApplication::translate("Form", "Re-Tag", 0, QApplication::UnicodeUTF8)); buttonClose->setText(QApplication::translate("Form", "Close", 0, QApplication::UnicodeUTF8));