2012-08-26 16:32 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)
* contrib/hbide/docks.prg
* contrib/hbide/edit.prg
* contrib/hbide/editor.prg
* contrib/hbide/hbide.qrc
+ contrib/hbide/resources/align_at.png
* contrib/hbqt/qtgui/hbqt_hbqplaintextedit.cpp
+ Implemented: aligning a selected-text fragment (column-selection mode)
to a contained string. The activation is selected-text toolbar icon
<Align At...>. This activation presents a input dialog to provide
string to align-at. The following illustration will make it clear:
abc := 212
bcdefg := 323
a := 413
xyzab := 33
=>
Select above lines with column-selection mode
Clock on <Align At...> icon
Type ":=" in the input dialog
=>
abc := 212
bcdefg := 323
a := 413
xyzab := 33
This commit is contained in:
@@ -16,6 +16,32 @@
|
||||
The license applies to all entries newer than 2009-04-28.
|
||||
*/
|
||||
|
||||
2012-08-26 16:32 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)
|
||||
* contrib/hbide/docks.prg
|
||||
* contrib/hbide/edit.prg
|
||||
* contrib/hbide/editor.prg
|
||||
* contrib/hbide/hbide.qrc
|
||||
+ contrib/hbide/resources/align_at.png
|
||||
* contrib/hbqt/qtgui/hbqt_hbqplaintextedit.cpp
|
||||
+ Implemented: aligning a selected-text fragment (column-selection mode)
|
||||
to a contained string. The activation is selected-text toolbar icon
|
||||
<Align At...>. This activation presents a input dialog to provide
|
||||
string to align-at. The following illustration will make it clear:
|
||||
|
||||
abc := 212
|
||||
bcdefg := 323
|
||||
a := 413
|
||||
xyzab := 33
|
||||
=>
|
||||
Select above lines with column-selection mode
|
||||
Clock on <Align At...> icon
|
||||
Type ":=" in the input dialog
|
||||
=>
|
||||
abc := 212
|
||||
bcdefg := 323
|
||||
a := 413
|
||||
xyzab := 33
|
||||
|
||||
2012-08-25 23:02 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)
|
||||
* contrib/hbqt/qtgui/hbqt_hbqplaintextedit.cpp
|
||||
+ Pair-matching of DO CASE/ENDCASE and DO WHILE/ENDDO.
|
||||
|
||||
@@ -1276,6 +1276,8 @@ METHOD IdeDocks:buildMdiToolbar()
|
||||
qTBar:addSeparator()
|
||||
qTBar:addToolButton( "Sgl2Dbl" , "Single to Double Quotes" , hbide_image( "sgl2dblquote" ), {|| ::oEM:convertDQuotes() }, .f. )
|
||||
qTBar:addToolButton( "Dbl2Sgl" , "Double to Single Quotes" , hbide_image( "dbl2sglquote" ), {|| ::oEM:convertQuotes() }, .f. )
|
||||
qTBar:addSeparator()
|
||||
qTBar:addToolButton( "AlignAt" , "Align At..." , hbide_image( "align_at" ), {|| ::oEM:alignAt() }, .f. )
|
||||
|
||||
IF ! ::oINI:lShowEditsTopToolbar
|
||||
::qMdiToolbar:hide()
|
||||
@@ -1820,8 +1822,8 @@ METHOD IdeDocks:getMarkWidget( nIndex )
|
||||
::oIde:aMarkTBtns[ nIndex ]:setMaximumWidth( 12 )
|
||||
::oIde:aMarkTBtns[ nIndex ]:setStyleSheet( "background-color: " + aColors[ nIndex ] + ";" )
|
||||
::oIde:aMarkTBtns[ nIndex ]:hide()
|
||||
::oIde:aMarkTBtns[ nIndex ]:connect( "clicked()" , {|| ::oEM:gotoMark( nIndex ) } )
|
||||
::oIde:aMarkTBtns[ nIndex ]:connect( QEvent_Enter, {|| ::oEM:setTooltipMark( nIndex ) } )
|
||||
::oIde:aMarkTBtns[ nIndex ]:connect( "clicked()" , {|| ::oEM:gotoMark( nIndex ) } )
|
||||
::oIde:aMarkTBtns[ nIndex ]:connect( QEvent_Enter, {|| ::oEM:setTooltipMark( nIndex ) } )
|
||||
|
||||
RETURN ::oIde:aMarkTBtns[ nIndex ]
|
||||
|
||||
@@ -2118,6 +2120,7 @@ METHOD IdeDocks:buildSelectedTextToolbar()
|
||||
qTBar:addToolButton( "Redo" , "Redo" , hbide_image( "redo" ), {|| ::oEM:redo() }, .f. )
|
||||
qTBar:addToolButton( "Cut" , "Cut" , hbide_image( "cut" ), {|| ::oEM:cut() }, .f. )
|
||||
qTBar:addToolButton( "Copy" , "Copy" , hbide_image( "copy" ), {|| ::oEM:copy() }, .f. )
|
||||
qTBar:addToolButton( "SelMode" , "Selection Mode" , hbide_image( "stream" ), {|| ::oEM:toggleSelectionMode(), ::oIDE:manageFocusInEditor() }, .t. )
|
||||
qTBar:addToolButton( "ToUpper" , "To Upper" , hbide_image( "toupper" ), {|| ::oEM:convertSelection( "ToUpper" ) }, .f. )
|
||||
qTBar:addToolButton( "ToLower" , "To Lower" , hbide_image( "tolower" ), {|| ::oEM:convertSelection( "ToLower" ) }, .f. )
|
||||
qTBar:addToolButton( "InvertCase", "Invert Case" , hbide_image( "invertcase" ), {|| ::oEM:convertSelection( "Invert" ) }, .f. )
|
||||
@@ -2127,6 +2130,7 @@ METHOD IdeDocks:buildSelectedTextToolbar()
|
||||
qTBar:addToolButton( "IndentL" , "Indent Left" , hbide_image( "blockindentl" ), {|| ::oEM:indent( -1 ) }, .f. )
|
||||
qTBar:addToolButton( "Sgl2Dbl" , "Single to Double Quotes" , hbide_image( "sgl2dblquote" ), {|| ::oEM:convertDQuotes() }, .f. )
|
||||
qTBar:addToolButton( "Dbl2Sgl" , "Double to Single Quotes" , hbide_image( "dbl2sglquote" ), {|| ::oEM:convertQuotes() }, .f. )
|
||||
qTBar:addToolButton( "AlignAt" , "Align At..." , hbide_image( "align_at" ), {|| ::oEM:alignAt() }, .f. )
|
||||
|
||||
RETURN Self
|
||||
|
||||
|
||||
@@ -255,6 +255,7 @@ CLASS IdeEdit INHERIT IdeObject
|
||||
METHOD handleTab( key )
|
||||
METHOD matchPair( x, y )
|
||||
METHOD unmatchPair()
|
||||
METHOD alignAt( cAt )
|
||||
|
||||
ENDCLASS
|
||||
|
||||
@@ -1287,6 +1288,44 @@ METHOD IdeEdit:blockIndent( nDirctn )
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
METHOD IdeEdit:alignAt( cAt )
|
||||
LOCAL nT, nL, nB, nR, nW, i, cLine, qCursor, aCord, a_, nMax, n, c1st, c2nd
|
||||
|
||||
IF ::lReadOnly
|
||||
RETURN Self
|
||||
ENDIF
|
||||
|
||||
nMax := 0
|
||||
aCord := ::aSelectionInfo
|
||||
hbide_normalizeRect( aCord, @nT, @nL, @nB, @nR )
|
||||
nW := nR - nL
|
||||
a_:= hbide_setQCursor( ::qEdit ) ; qCursor := a_[ 1 ]
|
||||
IF nW >= 0
|
||||
FOR i := nT TO nB
|
||||
cLine := ::getLine( i + 1 )
|
||||
IF ( n := At( cAt, SubStr( cLine, nL, nR - nL + 1 ) ) ) > 0
|
||||
nMax := Max( nMax, n )
|
||||
ENDIF
|
||||
NEXT
|
||||
ENDIF
|
||||
IF nMax > 0
|
||||
nMax += nL - 2
|
||||
FOR i := nT TO nB
|
||||
cLine := ::getLine( i + 1 )
|
||||
IF ( n := At( cAt, cLine ) ) > 0
|
||||
c1st := SubStr( cLine, 1, n - 1 )
|
||||
c2nd := SubStr( cLine, n )
|
||||
cLine := PadR( c1st, nMax ) + c2nd
|
||||
ENDIF
|
||||
hbide_qReplaceLine( qCursor, i, cLine )
|
||||
NEXT
|
||||
ENDIF
|
||||
hbide_setQCursor( ::qEdit, a_ )
|
||||
|
||||
RETURN Self
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
METHOD IdeEdit:blockConvert( cMode )
|
||||
LOCAL nT, nL, nB, nR, nW, i, cLine, qCursor, aCord, a_, nMode
|
||||
|
||||
|
||||
@@ -82,6 +82,11 @@
|
||||
#define __qTimeSave_timeout__ 2005
|
||||
#define __qTab_contextMenu__ 2006
|
||||
|
||||
|
||||
#define __selectionMode_stream__ 1
|
||||
#define __selectionMode_column__ 2
|
||||
#define __selectionMode_line__ 3
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
CLASS IdeEditsManager INHERIT IdeObject
|
||||
@@ -189,6 +194,7 @@ CLASS IdeEditsManager INHERIT IdeObject
|
||||
METHOD updateCompleter()
|
||||
METHOD updateFieldsList( cAlias )
|
||||
METHOD getProto( cWord )
|
||||
METHOD alignAt()
|
||||
|
||||
ENDCLASS
|
||||
|
||||
@@ -882,6 +888,19 @@ METHOD IdeEditsManager:convertDQuotes()
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
METHOD IdeEditsManager:alignAt()
|
||||
LOCAL oEdit, cWord
|
||||
IF !empty( oEdit := ::getEditObjectCurrent() )
|
||||
IF oEdit:aSelectionInfo[ 5 ] == __selectionMode_column__
|
||||
IF ! Empty( cWord := hbide_fetchAString( ::oDlg:oWidget, "", "Align At ?", "Selected-Text Alignment Proto" ) )
|
||||
oEdit:alignAt( cWord )
|
||||
ENDIF
|
||||
ENDIF
|
||||
ENDIF
|
||||
RETURN Self
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
METHOD IdeEditsManager:switchToReadOnly()
|
||||
LOCAL oEdit
|
||||
IF !empty( oEdit := ::getEditObjectCurrent() )
|
||||
|
||||
@@ -320,6 +320,7 @@
|
||||
<file>resources/split_close.png</file>
|
||||
<file>resources/split_h.png</file>
|
||||
<file>resources/split_v.png</file>
|
||||
<file>resources/align_at.png</file>
|
||||
<file>docs/faq.htm</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
BIN
harbour/contrib/hbide/resources/align_at.png
Normal file
BIN
harbour/contrib/hbide/resources/align_at.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.0 KiB |
@@ -808,7 +808,7 @@ void HBQPlainTextEdit::mouseDoubleClickEvent( QMouseEvent *event )
|
||||
iClicks = 2;
|
||||
repaint();
|
||||
}
|
||||
|
||||
/* Required because few actions are bound by it */
|
||||
if( block )
|
||||
{
|
||||
PHB_ITEM p1 = hb_itemPutNI( NULL, QEvent::MouseButtonDblClick );
|
||||
@@ -1011,6 +1011,9 @@ void HBQPlainTextEdit::mouseMoveEvent( QMouseEvent *event )
|
||||
}
|
||||
else if( mouseMode == mouseMode_select )
|
||||
{
|
||||
extraSelections.clear();
|
||||
setExtraSelections( extraSelections );
|
||||
|
||||
if( selectionMode == selectionMode_column )
|
||||
{
|
||||
QTextCursor c( cursorForPosition( QPoint( 1,1 ) ) );
|
||||
@@ -1029,6 +1032,7 @@ void HBQPlainTextEdit::mouseMoveEvent( QMouseEvent *event )
|
||||
}
|
||||
hbPostSelectionInfo();
|
||||
}
|
||||
#if 0
|
||||
if( block )
|
||||
{
|
||||
PHB_ITEM p1 = hb_itemPutNI( NULL, QEvent::MouseMove );
|
||||
@@ -1039,6 +1043,7 @@ void HBQPlainTextEdit::mouseMoveEvent( QMouseEvent *event )
|
||||
hb_itemRelease( p2 );
|
||||
hb_itemRelease( p3 );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
@@ -1299,6 +1304,9 @@ bool HBQPlainTextEdit::hbKeyPressSelection( QKeyEvent * event )
|
||||
|
||||
void HBQPlainTextEdit::keyPressEvent( QKeyEvent * event )
|
||||
{
|
||||
extraSelections.clear();
|
||||
setExtraSelections( extraSelections );
|
||||
|
||||
if( hbHandlePopup( event ) )
|
||||
{
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user