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.

  * contrib/hbide/docks.prg
  * contrib/hbide/hbqtoolbar.prg
  * contrib/hbide/saveload.prg
  * contrib/hbide/setup.ui
    + Implemented: <Setup><HbIDE Setup><General><Show Selection Toolbar>.
       This toggle the selected-text toolbar to appear as soon as 
       selection process starts.

    + Enhanced: Selected-text toolbar orientation for column-selection mode.
       It is now verutical and is positioned 30 pixels to the right of 
       selected rectangle. Also toolbar never leaves the top and bottom 
       edges of editing-instance's viewport.
This commit is contained in:
Pritpal Bedi
2012-08-26 06:10:51 +00:00
parent ab5180dcf1
commit fdcd2b3fad
6 changed files with 106 additions and 20 deletions

View File

@@ -16,6 +16,23 @@
The license applies to all entries newer than 2009-04-28.
*/
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.
* contrib/hbide/docks.prg
* contrib/hbide/hbqtoolbar.prg
* contrib/hbide/saveload.prg
* contrib/hbide/setup.ui
+ Implemented: <Setup><HbIDE Setup><General><Show Selection Toolbar>.
This toggle the selected-text toolbar to appear as soon as
selection process starts.
+ Enhanced: Selected-text toolbar orientation for column-selection mode.
It is now verutical and is positioned 30 pixels to the right of
selected rectangle. Also toolbar never leaves the top and bottom
edges of editing-instance's viewport.
2012-08-24 22:31 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)
* contrib/hbide/docks.prg
* contrib/hbide/edit.prg

View File

@@ -2051,18 +2051,41 @@ METHOD IdeDocks:buildUISrcDock()
/*----------------------------------------------------------------------*/
#define __selectionMode_stream__ 1
#define __selectionMode_column__ 2
#define __selectionMode_line__ 3
METHOD IdeDocks:showSelectedTextToolbar( oEdit )
LOCAL qRect
LOCAL qRect, nVPH, nTBH, nY, nX
DEFAULT oEdit TO ::oEM:getEditObjectCurrent()
IF ! empty( oEdit )
IF ! ::oINI:lSelToolbar
::qSelToolbar:hide()
RETURN Self
ENDIF
IF oEdit:aSelectionInfo[ 1 ] > -1
::qSelToolbar:adjustSize()
qRect := oEdit:qEdit:cursorRect()
::qSelToolbar:move( oEdit:qEdit:viewport():mapToGlobal( QPoint( ( oEdit:qEdit:viewport():width() / 2 ) - ;
( ::qSelToolbar:width() / 2 ), qRect:y() + ( qRect:height() * 2 ) ) ) )
//::oDK:qSelToolbar:setOrientation( Qt_Vertical )
IF oEdit:aSelectionInfo[ 5 ] == __selectionMode_column__
::oDK:qSelToolbar:setOrientation( Qt_Vertical )
::qSelToolbar:adjustSize()
nTBH := ::qSelToolbar:height()
nVPH := oEdit:qEdit:viewport():height()
nY := qRect:y() - ( nTBH / 2 )
IF nY < 0
nY := 0
ELSEIF nY + nTBH > nVPH
nY := nVPH - nTBH
ENDIF
nX := Max( oEdit:aSelectionInfo[ 2 ], oEdit:aSelectionInfo[ 4 ] )* oEdit:qEdit:fontMetrics():averageCharWidth() + 30
::qSelToolbar:move( oEdit:qEdit:viewport():mapToGlobal( QPoint( nX, nY ) ) )
ELSE
::oDK:qSelToolbar:setOrientation( Qt_Horizontal )
::qSelToolbar:adjustSize()
::qSelToolbar:move( oEdit:qEdit:viewport():mapToGlobal( QPoint( ( oEdit:qEdit:viewport():width() / 2 ) - ;
( ::qSelToolbar:width() / 2 ), qRect:y() + ( qRect:height() * 2 ) ) ) )
ENDIF
::qSelToolbar:show()
::qSelToolbar:raise()
ELSE
@@ -2079,11 +2102,12 @@ METHOD IdeDocks:buildSelectedTextToolbar()
::qSelToolbar := HbqToolbar():new( "ToolbarSelectedText", ::oDlg:oWidget )
::qSelToolbar:orientation := Qt_Horizontal
//::qSelToolbar:size := QSize( val( ::oINI:cToolbarSize ), val( ::oINI:cToolbarSize ) )
::qSelToolbar:size := QSize( val( ::oINI:cToolbarSize ), val( ::oINI:cToolbarSize ) )
::qSelToolbar:create( "SelectedText_Toolbar" )
::qSelToolbar:setObjectName( "ToolbarSelectedText" )
::qSelToolbar:setWindowTitle( "Actions on Selected Text" )
::qSelToolbar:setWindowFlags( hb_bitOr( Qt_Tool, Qt_CustomizeWindowHint, Qt_WindowTitleHint, Qt_WindowCloseButtonHint ) )
//::qSelToolbar:setWindowFlags( hb_bitOr( Qt_Tool, Qt_CustomizeWindowHint, Qt_WindowTitleHint, Qt_WindowCloseButtonHint ) )
::qSelToolbar:setWindowFlags( hb_bitOr( Qt_Tool, Qt_CustomizeWindowHint ) )
::qSelToolbar:setMovable( .T. )
::qSelToolbar:setFloatable( .T. )
::qSelToolbar:hide()
@@ -2092,20 +2116,15 @@ METHOD IdeDocks:buildSelectedTextToolbar()
qTBar:addToolButton( "Undo" , "Undo" , hbide_image( "undo" ), {|| ::oEM:undo() }, .f. )
qTBar:addToolButton( "Redo" , "Redo" , hbide_image( "redo" ), {|| ::oEM:redo() }, .f. )
//qTBar:addSeparator()
qTBar:addToolButton( "Cut" , "Cut" , hbide_image( "cut" ), {|| ::oEM:cut() }, .f. )
qTBar:addToolButton( "Copy" , "Copy" , hbide_image( "copy" ), {|| ::oEM:copy() }, .f. )
//qTBar:addSeparator()
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. )
//qTBar:addSeparator()
qTBar:addToolButton( "BlockCmnt" , "Block Comment" , hbide_image( "blockcomment" ), {|| ::oEM:blockComment() }, .f. )
qTBar:addToolButton( "StreamCmnt", "Stream Comment" , hbide_image( "streamcomment" ), {|| ::oEM:streamComment() }, .f. )
//qTBar:addSeparator()
qTBar:addToolButton( "IndentR" , "Indent Right" , hbide_image( "blockindentr" ), {|| ::oEM:indent( 1 ) }, .f. )
qTBar:addToolButton( "IndentL" , "Indent Left" , hbide_image( "blockindentl" ), {|| ::oEM:indent( -1 ) }, .f. )
//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. )

View File

@@ -134,7 +134,7 @@ METHOD HbqToolbar:create( cName, oParent )
DEFAULT ::size TO QSize( 16,16 )
::oWidget := QToolbar()
::oWidget := QToolbar( ::oParent )
::oWidget:setObjectName( ::cName )
::oWidget:setAllowedAreas( ::allowedAreas )
::oWidget:setOrientation( ::orientation )

View File

@@ -152,6 +152,7 @@
#define __radioDictAsIn_clicked__ 2074
#define __buttonDictAdd_clicked__ 2075
#define __buttonDictDelete_clicked__ 2076
#define __checkShowSelToolbar_stateChanged__ 2077
/*----------------------------------------------------------------------*/
//
@@ -234,6 +235,7 @@ CLASS IdeINI INHERIT IdeObject
DATA lTabToSpcInEdits INIT .t.
//DATA nTabSpaces INIT ::oIde:nTabSpaces
DATA nIndentSpaces INIT 3
DATA lSelToolbar INIT .T.
DATA nTmpBkpPrd INIT 60
DATA cBkpPath INIT ""
@@ -557,6 +559,8 @@ METHOD IdeINI:save( cHbideIni )
AAdd( txt_, "ISData" + "=" + ::cISData )
AAdd( txt_, "ISMethods" + "=" + ::cISMethods )
AAdd( txt_, "ISFormat" + "=" + ::cISFormat )
//
AAdd( txt_, "SelToolbar" + "=" + iif( ::lSelToolbar , "YES", "NO" ) )
aadd( txt_, "" )
aadd( txt_, "[PROJECTS]" )
@@ -919,6 +923,8 @@ METHOD IdeINI:load( cHbideIni )
CASE "ISData" ; ::cISData := cVal ; EXIT
CASE "ISMethods" ; ::cISMethods := cVal ; EXIT
CASE "ISFormat" ; ::cISFormat := cVal ; EXIT
//
CASE "SelToolbar" ; ::lSelToolbar := !( cVal == "NO" ) ; EXIT
ENDSWITCH
ENDIF
@@ -1448,6 +1454,7 @@ METHOD IdeSetup:connectSlots()
::oUI:checkLineNumbers :connect( "stateChanged(int)" , {|i| ::execEvent( __checkLineNumbers_stateChanged__ , i ) } )
::oUI:checkShowLeftToolbar:connect( "stateChanged(int)" , {|i| ::execEvent( __checkShowLeftToolbar_stateChanged__ , i ) } )
::oUI:checkShowTopToolbar :connect( "stateChanged(int)" , {|i| ::execEvent( __checkShowTopToolbar_stateChanged__ , i ) } )
::oUI:checkShowSelToolbar :connect( "stateChanged(int)" , {|i| ::execEvent( __checkShowSelToolbar_stateChanged__ , i ) } )
::oUI:sliderRed :connect( "valueChanged(int)" , {|i| ::execEvent( __sliderValue_changed__ , i, "R" ) } )
::oUI:sliderGreen :connect( "valueChanged(int)" , {|i| ::execEvent( __sliderValue_changed__ , i, "G" ) } )
@@ -1545,6 +1552,7 @@ METHOD IdeSetup:retrieve()
::oIde:nTabSpaces := val( ::oUI:editTabSpaces : text() )
::oINI:nIndentSpaces := val( ::oUI:editIndentSpaces : text() )
::oINI:lEditsMdi := ::oUI:checkEditsMdi : isChecked()
::oINI:lSelToolbar := ::oUI:checkShowSelToolbar : isChecked()
::oINI:aKeywords := {}
FOR EACH a_ IN ::aKeyItems
@@ -1642,6 +1650,7 @@ METHOD IdeSetup:populate()
::oUI:editTabSpaces : setText( hb_ntos( ::oIde:nTabSpaces ) )
::oUI:editIndentSpaces : setText( hb_ntos( ::oINI:nIndentSpaces ) )
::oUI:checkEditsMdi : setChecked( ::oINI:lEditsMdi )
::oUI:checkShowSelToolbar : setChecked( ::oINI:lSelToolbar )
/* Paths */
::oUI:editPathIni : setText( ::oIde:cProjIni )
@@ -1866,6 +1875,10 @@ METHOD IdeSetup:execEvent( nEvent, p, p1 )
::oEM:toggleLineNumbers()
EXIT
CASE __checkShowSelToolbar_stateChanged__
::oINI:lSelToolbar := ( p != 0 )
EXIT
CASE __checkShowTopToolbar_stateChanged__
IF ::oDK:qMdiToolbar:oWidget:isVisible()
::oDK:qMdiToolbar:hide()

View File

@@ -44,7 +44,7 @@
</rect>
</property>
<property name="currentIndex">
<number>6</number>
<number>0</number>
</property>
<widget class="QWidget" name="pageGeneral">
<widget class="QGroupBox" name="groupBox">
@@ -381,7 +381,7 @@
<property name="geometry">
<rect>
<x>182</x>
<y>28</y>
<y>48</y>
<width>135</width>
<height>22</height>
</rect>
@@ -391,7 +391,7 @@
<property name="geometry">
<rect>
<x>184</x>
<y>12</y>
<y>32</y>
<width>46</width>
<height>14</height>
</rect>
@@ -449,6 +449,19 @@
</rect>
</property>
</widget>
<widget class="QCheckBox" name="checkShowSelToolbar">
<property name="geometry">
<rect>
<x>180</x>
<y>12</y>
<width>133</width>
<height>17</height>
</rect>
</property>
<property name="text">
<string>Show Selection Toolbar</string>
</property>
</widget>
</widget>
</widget>
</widget>

View File

@@ -2764,7 +2764,7 @@ void HBQPlainTextEdit::hbBraceHighlight()
if( brace == "IF" || brace == "ENDIF" ||
brace == "FOR" || brace == "NEXT" ||
brace == "SWITCH" || brace == "ENDSWITCH" ||
brace == "DO" || brace == "ENDCASE" ||
brace == "DO" || brace == "ENDCASE" || brace == "ENDDO" ||
brace == "CLASS" || brace == "ENDCLASS" ||
brace == "FUNCTION" || brace == "RETURN" )
{
@@ -2786,10 +2786,34 @@ void HBQPlainTextEdit::hbBraceHighlight()
openBrace = "SWITCH";
closeBrace = "ENDSWITCH";
}
else if( ( brace == "DO" ) || ( brace == "ENDCASE" ) )
else if( ( brace == "DO" ) || ( brace == "ENDCASE" ) || ( brace == "ENDDO" ) )
{
openBrace = "DO";
closeBrace = "ENDCASE";
if( brace == "DO" )
{
cursor.movePosition( QTextCursor::NextWord, QTextCursor::KeepAnchor );
cursor.movePosition( QTextCursor::EndOfWord, QTextCursor::KeepAnchor );
brace = cursor.selectedText();
if( brace == "DO CASE" )
{
openBrace = "DO CASE";
closeBrace = "ENDCASE";
}
else if( brace == "DO WHILE" )
{
openBrace = "DO WHILE";
closeBrace = "ENDDO";
}
}
else if( brace == "ENDCASE" )
{
openBrace = "DO CASE";
closeBrace = "ENDCASE";
}
else
{
openBrace = "DO WHILE";
closeBrace = "ENDDO";
}
}
else if( ( brace == "FUNCTION" ) || ( brace == "RETURN" ) )
{