2010-07-29 18:47 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)

* contrib/hbqt/doc/en/class_hbqplaintextedit.txt
  * contrib/hbqt/hbqt_hbqplaintextedit.cpp
  * contrib/hbqt/hbqt_hbqplaintextedit.h
  * contrib/hbqt/qtgui/HBQPlainTextEdit.cpp
  * contrib/hbqt/qtgui/THBQPlainTextEdit.prg
  * contrib/hbqt/qth/HBQPlainTextEdit.qth
    + Added: methods to control code completions and completion tips.

  + contrib/hbide/resources/help1.png
  + contrib/hbide/resources/infotips.png

  * contrib/hbide/hbide.qrc
    + Added: two more images foe code completions and completion tips.

  * contrib/hbide/idedocks.prg
  * contrib/hbide/ideedit.prg
  * contrib/hbide/ideeditor.prg
    + Added: controls to toggle code completions and completion tips.
      The settings are not saved for the next run and are applicable 
      per editing instance.
This commit is contained in:
Pritpal Bedi
2010-07-30 01:50:14 +00:00
parent f694e217ee
commit ff53c0f49b
13 changed files with 149 additions and 27 deletions

View File

@@ -16,6 +16,28 @@
The license applies to all entries newer than 2009-04-28.
*/
2010-07-29 18:47 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)
* contrib/hbqt/doc/en/class_hbqplaintextedit.txt
* contrib/hbqt/hbqt_hbqplaintextedit.cpp
* contrib/hbqt/hbqt_hbqplaintextedit.h
* contrib/hbqt/qtgui/HBQPlainTextEdit.cpp
* contrib/hbqt/qtgui/THBQPlainTextEdit.prg
* contrib/hbqt/qth/HBQPlainTextEdit.qth
+ Added: methods to control code completions and completion tips.
+ contrib/hbide/resources/help1.png
+ contrib/hbide/resources/infotips.png
* contrib/hbide/hbide.qrc
+ Added: two more images foe code completions and completion tips.
* contrib/hbide/idedocks.prg
* contrib/hbide/ideedit.prg
* contrib/hbide/ideeditor.prg
+ Added: controls to toggle code completions and completion tips.
The settings are not saved for the next run and are applicable
per editing instance.
2010-07-29 15:49 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)
* contrib/hbide/hbide.prg
! Minor.

View File

@@ -102,12 +102,14 @@
<file>resources/hbidesplash.png</file>
<file>resources/hbidesplashwatermark.png</file>
<file>resources/help.png</file>
<file>resources/help1.png</file>
<file>resources/helpdoc.png</file>
<file>resources/hilight-all.png</file>
<file>resources/horzruler.png</file>
<file>resources/idepreferences.png</file>
<file>resources/increaseindent.png</file>
<file>resources/info.png</file>
<file>resources/infotips.png</file>
<file>resources/insert-datetime.png</file>
<file>resources/insert-external-file.png</file>
<file>resources/insert-procname.png</file>

View File

@@ -743,13 +743,12 @@ METHOD IdeDocks:buildToolBarPanels()
aadd( aBtns, { "deleteline" , "Delete Current Line" , {|| ::oEM:deleteLine() } } )
aadd( aBtns, { "duplicateline" , "Duplicate Current Line" , {|| ::oEM:duplicateLine() } } )
aadd( aBtns, {} )
#if 0
aadd( aBtns, { "togglelinenumber", "Toggle Line Numbers" , {|| ::oEM:toggleLineNumbers() } } )
aadd( aBtns, { "curlinehilight" , "Toggle Current Line Hilight", {|| ::oEM:toggleCurrentLineHighlightMode() } } )
#endif
aadd( aBtns, { "togglelinenumber", "Toggle Line Numbers" , {|| ::oEM:toggleLineNumbers() } } )
aadd( aBtns, { "horzruler" , "Toggle Horizontal Ruler" , {|| ::oEM:toggleHorzRuler() } } )
aadd( aBtns, { "curlinehilight" , "Toggle Current Line Hilight", {|| ::oEM:toggleCurrentLineHighlightMode() } } )
aadd( aBtns, {} )
aadd( aBtns, { "help1" , "Toggle Code Completion" , {|| ::oEM:toggleCodeCompetion() } } )
aadd( aBtns, { "infotips" , "Toggle Completion Tips" , {|| ::oEM:toggleCompetionTips() } } )
FOR EACH a_ IN aBtns
IF empty( a_ )
::qTBarLines:addSeparator()

View File

@@ -184,6 +184,8 @@ CLASS IdeEdit INHERIT IdeObject
METHOD toggleLineSelectionMode()
METHOD clearSelection()
METHOD togglePersistentSelection()
METHOD toggleCodeCompetion()
METHOD toggleCompetionTips()
METHOD getWord( lSelect )
METHOD getLine( nLine, lSelect )
@@ -1387,6 +1389,18 @@ METHOD IdeEdit:togglePersistentSelection()
/*----------------------------------------------------------------------*/
METHOD IdeEdit:toggleCodeCompetion()
::qEdit:hbToggleCodeCompetion()
RETURN Self
/*----------------------------------------------------------------------*/
METHOD IdeEdit:toggleCompetionTips()
::qEdit:hbToggleCompetionTips()
RETURN Self
/*----------------------------------------------------------------------*/
METHOD IdeEdit:redo()
::qEdit:redo()
RETURN Self
@@ -1529,7 +1543,7 @@ METHOD IdeEdit:find( cText, nPosFrom )
/* nFlags will decide the position, case sensitivity and direction
*/
METHOD IdeEdit:findEx( cText, nFlags, nStart )
LOCAL qCursor, lFound, cT, nPos
LOCAL qCursor, lFound, nPos
DEFAULT nStart TO 0
@@ -1546,12 +1560,11 @@ METHOD IdeEdit:findEx( cText, nFlags, nStart )
IF ( lFound := ::qEdit:find( cText, nFlags ) )
::qEdit:centerCursor()
qCursor := ::getCursor()
cT := qCursor:selectedText()
//qCursor:clearSelection()
::qEdit:hbSetSelectionInfo( { qCursor:blockNumber(), qCursor:columnNumber() - len( cT ), ;
qCursor:blockNumber(), qCursor:columnNumber(), 1 } )
//::qEdit:setTextCursor( qCursor )
qCursor := QTextCursor():from( ::qEdit:textCursor() ) //::getCursor()
::qEdit:hbSetSelectionInfo( { qCursor:blockNumber(), qCursor:columnNumber() - len( cText ), ;
qCursor:blockNumber(), qCursor:columnNumber(), 1, .t., .f. } )
qCursor:clearSelection()
ELSE
qCursor:setPosition( nPos )
::qEdit:setTextCursor( qCursor )

View File

@@ -145,6 +145,8 @@ CLASS IdeEditsManager INHERIT IdeObject
METHOD toggleLineNumbers()
METHOD toggleHorzRuler()
METHOD toggleCurrentLineHighlightMode()
METHOD toggleCodeCompetion()
METHOD toggleCompetionTips()
METHOD getText()
METHOD getWord( lSelect )
@@ -747,6 +749,26 @@ METHOD IdeEditsManager:toggleHorzRuler()
/*----------------------------------------------------------------------*/
METHOD IdeEditsManager:toggleCodeCompetion()
LOCAL oEdit
::oIde:lHorzRulerVisible := ! ::lHorzRulerVisible
IF !empty( oEdit := ::getEditObjectCurrent() )
oEdit:toggleCodeCompetion()
ENDIF
RETURN Self
/*----------------------------------------------------------------------*/
METHOD IdeEditsManager:toggleCompetionTips()
LOCAL oEdit
::oIde:lHorzRulerVisible := ! ::lHorzRulerVisible
IF !empty( oEdit := ::getEditObjectCurrent() )
oEdit:toggleCompetionTips()
ENDIF
RETURN Self
/*----------------------------------------------------------------------*/
METHOD IdeEditsManager:duplicateLine()
LOCAL oEdit
IF !empty( oEdit := ::getEditObjectCurrent() )

Binary file not shown.

After

Width:  |  Height:  |  Size: 910 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 899 B

View File

@@ -82,6 +82,8 @@
:hbSetProtoStyle( cCss ) -> NIL
:hbSelectAll() -> NIL
:hbSetFieldsListActive( lActive ) -> NIL
:hbToggleCodeCompetion() -> NIL
:hbToggleCompetionTips() -> NIL
$DESCRIPTION$

View File

@@ -122,6 +122,8 @@ HBQPlainTextEdit::HBQPlainTextEdit( QWidget * parent ) : QPlainTextEdit( parent
isSelectionPersistent = false;
isShiftPressed = false;
isAliasCompleter = false;
isCodeCompletionActive = true;
isCompletionTipsActive = true;
#if 0
QTextFrameFormat format( this->document()->rootFrame()->frameFormat() );
@@ -178,6 +180,12 @@ HBQPlainTextEdit::HBQPlainTextEdit( QWidget * parent ) : QPlainTextEdit( parent
void HBQPlainTextEdit::hbShowPrototype( const QString & tip, int rows, int cols )
{
if( ! isCompletionTipsActive ){
ttTextEdit->hide();
ttLabel->hide();
return;
}
if( rows <= 1 )
{
ttLabel->setText( tip );
@@ -464,9 +472,23 @@ void HBQPlainTextEdit::hbSetSelectionInfo( PHB_ITEM selectionInfo )
columnEnds = hb_arrayGetNI( selectionInfo, 4 );
selectionMode = hb_arrayGetNI( selectionInfo, 5 );
emit selectionChanged();
update();
PHB_ITEM pSome = hb_arrayGetItemPtr( selectionInfo, 6 );
if( hb_itemType( pSome ) & HB_IT_LOGICAL ){
if( hb_itemGetL( pSome ) ){
QTextCursor c( textCursor() );
c.clearSelection();
}
}
pSome = hb_arrayGetItemPtr( selectionInfo, 7 );
if( hb_itemType( pSome ) & HB_IT_LOGICAL ){
if( hb_itemGetL( pSome ) ){
emit selectionChanged();
}
}
else {
emit selectionChanged();
}
repaint();
}
/*----------------------------------------------------------------------*/
@@ -771,6 +793,8 @@ void HBQPlainTextEdit::mouseDoubleClickEvent( QMouseEvent *event )
columnEnds = c.columnNumber();
columnBegins = columnEnds - ( c.selectionEnd() - c.selectionStart() );
selectionMode = selectionMode_stream;
c.clearSelection();
setTextCursor( c );
emit selectionChanged();
repaint();
}
@@ -1371,6 +1395,13 @@ void HBQPlainTextEdit::keyPressEvent( QKeyEvent * event )
}
QPlainTextEdit::keyPressEvent( event );
if( ! isCodeCompletionActive ){
if( c ){
c->popup()->hide();
}
return;
}
if( ! c ){
return;
}
@@ -1402,10 +1433,6 @@ void HBQPlainTextEdit::keyPressEvent( QKeyEvent * event )
eow.contains( event->text().right( 1 ) ) )
{
c->popup()->hide();
#if 0
if( isAliasCompleter )
hbRefreshCompleter( "" );
#endif
return;
}
@@ -1421,15 +1448,6 @@ void HBQPlainTextEdit::keyPressEvent( QKeyEvent * event )
cr.setBottom( cr.bottom() + horzRulerHeight + 5 );
c->complete( cr ); // pop it up!
if( c->popup()->isHidden() && isAliasCompleter ){
#if 0
if( block ){
PHB_ITEM p1 = hb_itemPutNI( NULL, 21041 );
hb_vmEvalBlockV( block, 1, p1 );
hb_itemRelease( p1 );
}
#endif
}
}
/*----------------------------------------------------------------------*/

View File

@@ -161,6 +161,8 @@ private:
bool isSelectionPersistent;
bool isShiftPressed;
bool isAliasCompleter;
bool isCodeCompletionActive;
bool isCompletionTipsActive;
protected:
bool event( QEvent * event );
@@ -220,6 +222,8 @@ public slots:
void hbSelectAll();
void hbSetFieldsListActive( bool active ) { isAliasCompleter = active; };
void hbRefreshCompleter( const QString & alias = "" );
void hbToggleCodeCompetion() { isCodeCompletionActive = ! isCodeCompletionActive; };
void hbToggleCompetionTips() { isCompletionTipsActive = ! isCompletionTipsActive; };
private slots:
void hbSlotCursorPositionChanged();

View File

@@ -918,6 +918,34 @@ HB_FUNC( QT_HBQPLAINTEXTEDIT_HBSETFIELDSLISTACTIVE )
}
}
/*
* void hbToggleCodeCompetion()
*/
HB_FUNC( QT_HBQPLAINTEXTEDIT_HBTOGGLECODECOMPETION )
{
HBQPlainTextEdit * p = hbqt_par_HBQPlainTextEdit( 1 );
if( p )
( p )->hbToggleCodeCompetion();
else
{
HB_TRACE( HB_TR_DEBUG, ( "............................... F=QT_HBQPLAINTEXTEDIT_HBTOGGLECODECOMPETION FP=( p )->hbToggleCodeCompetion(); p is NULL" ) );
}
}
/*
* void hbToggleCompetionTips()
*/
HB_FUNC( QT_HBQPLAINTEXTEDIT_HBTOGGLECOMPETIONTIPS )
{
HBQPlainTextEdit * p = hbqt_par_HBQPlainTextEdit( 1 );
if( p )
( p )->hbToggleCompetionTips();
else
{
HB_TRACE( HB_TR_DEBUG, ( "............................... F=QT_HBQPLAINTEXTEDIT_HBTOGGLECOMPETIONTIPS FP=( p )->hbToggleCompetionTips(); p is NULL" ) );
}
}
/*----------------------------------------------------------------------*/
#endif /* #if QT_VERSION >= 0x040500 */

View File

@@ -121,6 +121,8 @@ CREATE CLASS HBQPlainTextEdit INHERIT HbQtObjectHandler, QPlainTextEdit
METHOD hbSetProtoStyle( cCss )
METHOD hbSelectAll()
METHOD hbSetFieldsListActive( lActive )
METHOD hbToggleCodeCompetion()
METHOD hbToggleCompetionTips()
ENDCLASS
@@ -349,3 +351,11 @@ METHOD HBQPlainTextEdit:hbSelectAll()
METHOD HBQPlainTextEdit:hbSetFieldsListActive( lActive )
RETURN Qt_HBQPlainTextEdit_hbSetFieldsListActive( ::pPtr, lActive )
METHOD HBQPlainTextEdit:hbToggleCodeCompetion()
RETURN Qt_HBQPlainTextEdit_hbToggleCodeCompetion( ::pPtr )
METHOD HBQPlainTextEdit:hbToggleCompetionTips()
RETURN Qt_HBQPlainTextEdit_hbToggleCompetionTips( ::pPtr )

View File

@@ -152,6 +152,8 @@ HB_FUNC( QT_HBQPLAINTEXTEDIT )
void hbSetProtoStyle( const QString & css )
void hbSelectAll()
void hbSetFieldsListActive( bool active )
void hbToggleCodeCompetion()
void hbToggleCompetionTips()
</SLOTS>