diff --git a/harbour/ChangeLog b/harbour/ChangeLog index e34de028d5..f6ee5f7967 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,42 @@ past entries belonging to author(s): Viktor Szakats. */ +2010-06-06 02:43 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) + + contrib/hbide/resources/go-bottom.png + + contrib/hbide/resources/go-down.png + + contrib/hbide/resources/go-first.png + + contrib/hbide/resources/go-jump.png + + contrib/hbide/resources/go-last.png + + contrib/hbide/resources/go-next.png + + contrib/hbide/resources/go-prev.png + + contrib/hbide/resources/go-top.png + + contrib/hbide/resources/go-up.png + + contrib/hbide/resources/hilight-all.png + + contrib/hbide/resources/updown.ui + + contrib/hbide/resources/updown.uic + + * contrib/hbqt/hbqt_hbqplaintextedit.cpp + ! An important fix. + + * contrib/hbide/ideedit.prg + * contrib/hbide/idefindreplace.prg + * contrib/hbide/idetools.prg + + Extended: in addition to next/previous buttons to naviagte + occurances of selected text, three more buttons are added: + "first", "last", occurance and "highlight all" occurances. + + + Implemented: macros parsing in "Parameters" list of + "Tools and Utilities" protocol. Currently following macros + are parsed: + {source_fullname} => full sourcename of current edit instance + {source_name} => mere name of current edit instance + {source_path} => only path of source in current edit instance + {%MY_ENV_VAR%} => result of hb_GetEnv( "MY_ENV_VAR" ) + C:\temp\mycopy.bat {source_fullname} {source_path}\mysource.bkp + => + C:\temp\mycopy.bat C:\harbour\contrib\hbide\hbide.prg C:\harbour\contrib\hbide\mysource.bkp + ( assuming that current editor is containe hbide.prg ) + 2010-06-06 00:50 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * INSTALL * external/sqlite3/Makefile diff --git a/harbour/contrib/hbide/ideedit.prg b/harbour/contrib/hbide/ideedit.prg index 7061655d39..b61eba5de6 100644 --- a/harbour/contrib/hbide/ideedit.prg +++ b/harbour/contrib/hbide/ideedit.prg @@ -132,6 +132,7 @@ CLASS IdeEdit INHERIT IdeObject DATA isColumnSelectionON INIT .F. DATA lReadOnly INIT .F. + DATA isHighLighted INIT .f. METHOD new( oEditor, nMode ) METHOD create( oEditor, nMode ) @@ -230,7 +231,9 @@ CLASS IdeEdit INHERIT IdeObject METHOD spaces2tabs() METHOD removeTrailingSpaces() METHOD formatBraces() - METHOD findEx( cText, nFlags ) + METHOD findEx( cText, nFlags, nStart ) + METHOD highlightAll( cText ) + METHOD unHighlight() ENDCLASS @@ -286,6 +289,7 @@ 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_Resize , {| | ::execKeyEvent( 106, QEvent_Resize ) } ) Qt_Events_Connect( ::pEvents, ::qEdit, QEvent_FocusOut , {| | ::execKeyEvent( 105, QEvent_FocusOut ) } ) Qt_Events_Connect( ::pEvents, ::qEdit, QEvent_MouseButtonDblClick, {|p| ::execKeyEvent( 103, QEvent_MouseButtonDblClick, p ) } ) @@ -473,6 +477,8 @@ METHOD IdeEdit:execEvent( nMode, oEdit, p, p1 ) ::oDK:setStatusText( SB_PNL_SELECTEDCHARS, len( ::getSelectedText() ) ) ::oUpDn:show() + ::unHighlight() + EXIT CASE cursorPositionChanged @@ -602,6 +608,10 @@ METHOD IdeEdit:execKeyEvent( nMode, nEvent, p, p1 ) ENDIF EXIT + CASE QEvent_Resize + ::oUpDn:show() + EXIT + CASE QEvent_Leave CASE QEvent_FocusOut ::suspendPrototype() @@ -1475,8 +1485,21 @@ METHOD IdeEdit:find( cText, nPosFrom ) /*----------------------------------------------------------------------*/ /* nFlags will decide the position, case sensitivity and direction */ -METHOD IdeEdit:findEx( cText, nFlags ) - LOCAL qCursor, lFound, cT +METHOD IdeEdit:findEx( cText, nFlags, nStart ) + LOCAL qCursor, lFound, cT, nPos + + DEFAULT nStart TO 0 + + qCursor := ::getCursor() + nPos := qCursor:position() + + IF nStart == 0 + // No need to move cursor + ELSEIF nStart == 1 + ::qEdit:moveCursor( QTextCursor_Start ) + ELSEIF nStart == 2 + ::qEdit:moveCursor( QTextCursor_End ) + ENDIF IF ( lFound := ::qEdit:find( cText, nFlags ) ) ::qEdit:centerCursor() @@ -1485,12 +1508,75 @@ METHOD IdeEdit:findEx( cText, nFlags ) ::qEdit:hbSetSelectionInfo( { qCursor:blockNumber(), qCursor:columnNumber() - len( cT ), ; qCursor:blockNumber(), qCursor:columnNumber(), 1 } ) ::qEdit:setTextCursor( qCursor ) + ELSE + qCursor:setPosition( nPos ) + ::qEdit:setTextCursor( qCursor ) ENDIF RETURN lFound /*----------------------------------------------------------------------*/ +METHOD IdeEdit:unHighlight() + LOCAL qCursor, nPos, lModified + + IF ::isHighLighted + ::isHighLighted := .f. + qCursor := ::getCursor() + nPos := qCursor:position() + lModified := QTextDocument():configure( ::qEdit:document() ):isModified() + ::qEdit:undo() + IF ! lModified + QTextDocument():configure( ::qEdit:document() ):setModified( .f. ) + ::oEditor:setTabImage( ::qEdit ) + ENDIF + qCursor:setPosition( nPos ) + ::qEdit:setTextCursor( qCursor ) + RETURN .t. + ENDIF + + RETURN .f. + +/*----------------------------------------------------------------------*/ + +METHOD IdeEdit:highlightAll( cText ) + LOCAL qDoc, qFormat, qCursor, qFormatHL, qCur, lModified + + IF ::unHighLight() + RETURN Self + ENDIF + + ::isHighLighted := .t. + + qDoc := ::oEditor:qDocument + lModified := QTextDocument():configure( ::qEdit:document() ):isModified() + + qCur := ::getCursor() + qCur:beginEditBlock() + + qCursor := QTextCursor():new( "QTextDocument", qDoc ) + qFormat := QTextCharFormat():from( qCursor:charFormat() ) + qFormatHL := qFormat + qFormatHL:setBackground( QBrush():new( "QColor", QColor():new( Qt_yellow ) ) ) + + DO WHILE .t. + qCursor := QTextCursor():from( qDoc:find( cText, qCursor, 0 ) ) + IF qCursor:isNull() + EXIT + ENDIF + qCursor:mergeCharFormat( qFormatHL ) + ENDDO + qCur:endEditBlock() + + IF ! lModified + QTextDocument():configure( ::qEdit:document() ):setModified( .f. ) + ::oEditor:setTabImage( ::qEdit ) + ENDIF + + RETURN Self + +/*----------------------------------------------------------------------*/ + METHOD IdeEdit:refresh() ::qEdit:hbRefresh() RETURN Self diff --git a/harbour/contrib/hbide/idefindreplace.prg b/harbour/contrib/hbide/idefindreplace.prg index b284b69a12..d5aeeeee49 100644 --- a/harbour/contrib/hbide/idefindreplace.prg +++ b/harbour/contrib/hbide/idefindreplace.prg @@ -138,14 +138,28 @@ METHOD IdeUpDown:create( oIde ) ::oUI:setWindowFlags( hb_bitOr( Qt_Tool, Qt_FramelessWindowHint ) ) ::oUI:setFocusPolicy( Qt_NoFocus ) - ::oUI:setMaximumWidth( 55 ) + //::oUI:setMaximumWidth( 75 ) + //::oUI:setMaximumHeight( 25 ) - ::oUI:q_buttonUp:setIcon( hbide_image( "previous" ) ) - ::oUI:q_buttonUp:setToolTip( "Find Previous" ) - ::oUI:signal( "buttonUp", "clicked()", {|| ::execEvent( "buttonUp_clicked" ) } ) - ::oUI:q_buttonDown:setIcon( hbide_image( "next" ) ) - ::oUI:q_buttonDown:setToolTip( "Find Next" ) - ::oUI:signal( "buttonDown", "clicked()", {|| ::execEvent( "buttonDown_clicked" ) } ) + ::oUI:q_buttonPrev:setIcon( hbide_image( "go-prev" ) ) + ::oUI:q_buttonPrev:setToolTip( "Find Previous" ) + ::oUI:signal( "buttonPrev", "clicked()", {|| ::execEvent( "buttonPrev_clicked" ) } ) + // + ::oUI:q_buttonNext:setIcon( hbide_image( "go-next" ) ) + ::oUI:q_buttonNext:setToolTip( "Find Next" ) + ::oUI:signal( "buttonNext", "clicked()", {|| ::execEvent( "buttonNext_clicked" ) } ) + // + ::oUI:q_buttonFirst:setIcon( hbide_image( "go-first" ) ) + ::oUI:q_buttonFirst:setToolTip( "Find First" ) + ::oUI:signal( "buttonFirst", "clicked()", {|| ::execEvent( "buttonFirst_clicked" ) } ) + // + ::oUI:q_buttonLast:setIcon( hbide_image( "go-last" ) ) + ::oUI:q_buttonLast:setToolTip( "Find Last" ) + ::oUI:signal( "buttonLast", "clicked()", {|| ::execEvent( "buttonLast_clicked" ) } ) + // + ::oUI:q_buttonAll:setIcon( hbide_image( "hilight-all" ) ) + ::oUI:q_buttonAll:setToolTip( "Highlight All" ) + ::oUI:signal( "buttonAll", "clicked()", {|| ::execEvent( "buttonAll_clicked" ) } ) RETURN Self @@ -162,11 +176,20 @@ METHOD IdeUpDown:execEvent( cEvent, p ) IF !empty( cText ) SWITCH cEvent - CASE "buttonUp_clicked" - oEdit:findEx( cText, QTextDocument_FindBackward ) + CASE "buttonPrev_clicked" + oEdit:findEx( cText, QTextDocument_FindBackward, 0 ) EXIT - CASE "buttonDown_clicked" - oEdit:findEx( cText, 0 ) + CASE "buttonNext_clicked" + oEdit:findEx( cText, 0, 0 ) + EXIT + CASE "buttonFirst_clicked" + oEdit:findEx( cText, 0, 1 ) + EXIT + CASE "buttonLast_clicked" + oEdit:findEx( cText, QTextDocument_FindBackward, 2 ) + EXIT + CASE "buttonAll_clicked" + oEdit:highlightAll( cText ) EXIT ENDSWITCH ENDIF diff --git a/harbour/contrib/hbide/idetools.prg b/harbour/contrib/hbide/idetools.prg index a655bca8ca..f785405e4e 100644 --- a/harbour/contrib/hbide/idetools.prg +++ b/harbour/contrib/hbide/idetools.prg @@ -112,6 +112,8 @@ CLASS IdeToolsManager INHERIT IdeObject METHOD addPanelsMenu( cPrompt ) METHOD showOutput( cOut, mp2, oHbp ) METHOD finished( nEC, nES, oHbp ) + METHOD parseParams( cP ) + METHOD macro2value( cMacro ) ENDCLASS @@ -405,7 +407,7 @@ METHOD IdeToolsManager:execToolByParams( cCmd, cParams, cStartIn, lCapture, lOpe ELSE cArg := "" ENDIF - cArg += cParams + cArg += ::parseParams( cParams ) IF lCapture IF lOpen @@ -448,6 +450,7 @@ METHOD IdeToolsManager:execTool( ... ) cCmd := hbide_pathToOSPath( aParam[ 1 ] ) cParams := aParam[ 2 ] cParams := iif( "http://" $ lower( cParams ), cParams, hbide_pathToOSPath( cParams ) ) + cParams := ::parseParams( cParams ) cStayIn := hbide_pathToOSPath( aParam[ 3 ] ) lCapture := iif( hb_isLogical( aParam[ 4 ] ), aParam[ 4 ], aParam[ 4 ] == "YES" ) lOpen := iif( hb_isLogical( aParam[ 5 ] ), aParam[ 5 ], aParam[ 5 ] == "YES" ) @@ -483,3 +486,60 @@ METHOD IdeToolsManager:finished( nEC, nES, oHbp ) /*----------------------------------------------------------------------*/ +METHOD IdeToolsManager:parseParams( cP ) + LOCAL lHas, n, n1, cMacro + + IF !empty( cP ) + DO WHILE .t. + lHas := .f. + IF ( n := at( "{" , cP ) ) > 0 + IF ( n1 := at( "}" , cP ) ) > 0 + lHas := .t. + cMacro := substr( cP, n + 1, n1 - n - 1 ) + cP := substr( cP, 1, n - 1 ) + ::macro2value( cMacro ) + substr( cP, n1 + 1 ) + ENDIF + ENDIF + IF ! lHas + EXIT + ENDIF + ENDDO + ENDIF + + RETURN cP + +/*----------------------------------------------------------------------*/ + +METHOD IdeToolsManager:macro2value( cMacro ) + LOCAL cVal, cMacroL, oEdit, cFile, cPath, cExt + + cMacro := alltrim( cMacro ) + cMacroL := lower( cMacro ) + + oEdit := ::oEM:getEditorCurrent() + IF !empty( oEdit ) + hb_fNameSplit( oEdit:sourceFile, @cPath, @cFile, @cExt ) + ELSE + cPath := ""; cFile := ""; cExt := "" + ENDIF + + DO CASE + CASE cMacroL == "source_fullname" + cVal := hbide_pathToOSPath( cPath + cFile + cExt ) + + CASE cMacroL == "source_name" + cVal := cFile + cExt + + CASE cMacroL == "source_path" + cVal := hbide_pathToOSPath( cPath ) + + CASE "%" $ cMacro + cVal := hb_GetEnv( strtran( cMacro, "%", "" ) ) + + OTHERWISE + cVal := cMacro + + ENDCASE + + RETURN cVal + +/*----------------------------------------------------------------------*/ diff --git a/harbour/contrib/hbide/resources/go-bottom.png b/harbour/contrib/hbide/resources/go-bottom.png new file mode 100644 index 0000000000..2c5a80385c Binary files /dev/null and b/harbour/contrib/hbide/resources/go-bottom.png differ diff --git a/harbour/contrib/hbide/resources/go-down.png b/harbour/contrib/hbide/resources/go-down.png new file mode 100644 index 0000000000..3dd7fccdf0 Binary files /dev/null and b/harbour/contrib/hbide/resources/go-down.png differ diff --git a/harbour/contrib/hbide/resources/go-first.png b/harbour/contrib/hbide/resources/go-first.png new file mode 100644 index 0000000000..9c15c09e95 Binary files /dev/null and b/harbour/contrib/hbide/resources/go-first.png differ diff --git a/harbour/contrib/hbide/resources/go-jump.png b/harbour/contrib/hbide/resources/go-jump.png new file mode 100644 index 0000000000..1d218c388b Binary files /dev/null and b/harbour/contrib/hbide/resources/go-jump.png differ diff --git a/harbour/contrib/hbide/resources/go-last.png b/harbour/contrib/hbide/resources/go-last.png new file mode 100644 index 0000000000..6e904efd06 Binary files /dev/null and b/harbour/contrib/hbide/resources/go-last.png differ diff --git a/harbour/contrib/hbide/resources/go-next.png b/harbour/contrib/hbide/resources/go-next.png new file mode 100644 index 0000000000..6ef8de76e0 Binary files /dev/null and b/harbour/contrib/hbide/resources/go-next.png differ diff --git a/harbour/contrib/hbide/resources/go-prev.png b/harbour/contrib/hbide/resources/go-prev.png new file mode 100644 index 0000000000..659cd90d7f Binary files /dev/null and b/harbour/contrib/hbide/resources/go-prev.png differ diff --git a/harbour/contrib/hbide/resources/go-top.png b/harbour/contrib/hbide/resources/go-top.png new file mode 100644 index 0000000000..70f2c996cd Binary files /dev/null and b/harbour/contrib/hbide/resources/go-top.png differ diff --git a/harbour/contrib/hbide/resources/go-up.png b/harbour/contrib/hbide/resources/go-up.png new file mode 100644 index 0000000000..fa9a7d71b5 Binary files /dev/null and b/harbour/contrib/hbide/resources/go-up.png differ diff --git a/harbour/contrib/hbide/resources/hilight-all.png b/harbour/contrib/hbide/resources/hilight-all.png new file mode 100644 index 0000000000..93dcee57e7 Binary files /dev/null and b/harbour/contrib/hbide/resources/hilight-all.png differ diff --git a/harbour/contrib/hbide/resources/updown.ui b/harbour/contrib/hbide/resources/updown.ui new file mode 100644 index 0000000000..9e471b6d6b --- /dev/null +++ b/harbour/contrib/hbide/resources/updown.ui @@ -0,0 +1,71 @@ + + + Form + + + + 0 + 0 + 135 + 24 + + + + Form + + + + 1 + + + 0 + + + 2 + + + 0 + + + 2 + + + + + ... + + + + + + + ... + + + + + + + ... + + + + + + + ... + + + + + + + ... + + + + + + + + diff --git a/harbour/contrib/hbide/resources/updown.uic b/harbour/contrib/hbide/resources/updown.uic new file mode 100644 index 0000000000..c397e1defa --- /dev/null +++ b/harbour/contrib/hbide/resources/updown.uic @@ -0,0 +1,92 @@ +/******************************************************************************** +** Form generated from reading UI file 'updown.ui' +** +** Created: Sun Jun 6 00:57:17 2010 +** by: Qt User Interface Compiler version 4.6.2 +** +** WARNING! All changes made in this file will be lost when recompiling UI file! +********************************************************************************/ + +#ifndef UPDOWN_H +#define UPDOWN_H + +#include +#include +#include +#include +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +class Ui_Form +{ +public: + QHBoxLayout *horizontalLayout; + QToolButton *buttonNext; + QToolButton *buttonPrev; + QToolButton *buttonLast; + QToolButton *buttonFirst; + QToolButton *buttonAll; + + void setupUi(QWidget *Form) + { + if (Form->objectName().isEmpty()) + Form->setObjectName(QString::fromUtf8("Form")); + Form->resize(135, 24); + horizontalLayout = new QHBoxLayout(Form); + horizontalLayout->setSpacing(1); + horizontalLayout->setObjectName(QString::fromUtf8("horizontalLayout")); + horizontalLayout->setContentsMargins(0, 2, 0, 2); + buttonNext = new QToolButton(Form); + buttonNext->setObjectName(QString::fromUtf8("buttonNext")); + + horizontalLayout->addWidget(buttonNext); + + buttonPrev = new QToolButton(Form); + buttonPrev->setObjectName(QString::fromUtf8("buttonPrev")); + + horizontalLayout->addWidget(buttonPrev); + + buttonLast = new QToolButton(Form); + buttonLast->setObjectName(QString::fromUtf8("buttonLast")); + + horizontalLayout->addWidget(buttonLast); + + buttonFirst = new QToolButton(Form); + buttonFirst->setObjectName(QString::fromUtf8("buttonFirst")); + + horizontalLayout->addWidget(buttonFirst); + + buttonAll = new QToolButton(Form); + buttonAll->setObjectName(QString::fromUtf8("buttonAll")); + + horizontalLayout->addWidget(buttonAll); + + + retranslateUi(Form); + + QMetaObject::connectSlotsByName(Form); + } // setupUi + + void retranslateUi(QWidget *Form) + { + Form->setWindowTitle(QApplication::translate("Form", "Form", 0, QApplication::UnicodeUTF8)); + buttonNext->setText(QApplication::translate("Form", "...", 0, QApplication::UnicodeUTF8)); + buttonPrev->setText(QApplication::translate("Form", "...", 0, QApplication::UnicodeUTF8)); + buttonLast->setText(QApplication::translate("Form", "...", 0, QApplication::UnicodeUTF8)); + buttonFirst->setText(QApplication::translate("Form", "...", 0, QApplication::UnicodeUTF8)); + buttonAll->setText(QApplication::translate("Form", "...", 0, QApplication::UnicodeUTF8)); + } // retranslateUi + +}; + +namespace Ui { + class Form: public Ui_Form {}; +} // namespace Ui + +QT_END_NAMESPACE + +#endif // UPDOWN_H diff --git a/harbour/contrib/hbqt/hbqt_hbqplaintextedit.cpp b/harbour/contrib/hbqt/hbqt_hbqplaintextedit.cpp index ec3136cd15..4c9a7bfb81 100644 --- a/harbour/contrib/hbqt/hbqt_hbqplaintextedit.cpp +++ b/harbour/contrib/hbqt/hbqt_hbqplaintextedit.cpp @@ -987,8 +987,11 @@ bool HBQPlainTextEdit::hbKeyPressSelection( QKeyEvent * event ) if( ctrl && event->text().isEmpty() ) { + #if 0 event->ignore(); return true; + #endif + return false; } if( ctrl && ( k == Qt::Key_C || k == Qt::Key_V || k == Qt::Key_X || @@ -1248,12 +1251,13 @@ bool HBQPlainTextEdit::hbKeyPressSelection( QKeyEvent * event ) void HBQPlainTextEdit::keyPressEvent( QKeyEvent * event ) { +HB_TRACE( HB_TR_ALWAYS, ( "keyPressEvent %i 000", event->key() ) ); if( hbKeyPressSelection( event ) ) { QApplication::processEvents(); return; } - +HB_TRACE( HB_TR_ALWAYS, ( "keyPressEvent %i", event->key() ) ); if( c && c->popup()->isVisible() ) { // The following keys are forwarded by the completer to the widget