diff --git a/harbour/ChangeLog b/harbour/ChangeLog index f6beeb1dae..5c7775b02e 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,30 @@ past entries belonging to author(s): Viktor Szakats. */ +2010-05-03 18:44 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) + * contrib/hbxbp/xbptabpage.prg + + Started work to make context menu alive. + + * contrib/hbide/hbide.prg + * contrib/hbide/ideactions.prg + * contrib/hbide/idedocks.prg + * contrib/hbide/ideeditor.prg + * contrib/hbide/ideshortcuts.prg + * contrib/hbide/idethemes.prg + + Implemented: almost all menu/toolbar actions to public API. + Probably this will allow the user to configure hbIDE to + the behavior he is used to. + + + Implemented: close button on the right-hand corner of editing tabs. + Clicking it closes the current editing instance in focus. + + + Added: more Harbour keywords to color engine, OR, AND, SELF. + + ! Included: some more options in the main menu which were + available on toolbars only. + + ! Cleaned some redundant code. + 2010-05-03 23:52 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * contrib/hbide/ideeditor.prg % Replaced code with __PLATFORM__* checks with hb_osNewLine() call. diff --git a/harbour/contrib/hbide/hbide.prg b/harbour/contrib/hbide/hbide.prg index 93c5b26c19..85b7d5477c 100644 --- a/harbour/contrib/hbide/hbide.prg +++ b/harbour/contrib/hbide/hbide.prg @@ -502,9 +502,7 @@ METHOD HbIde:create( aParams ) IF ::nEvent == xbeP_Close HB_TRACE( HB_TR_ALWAYS, "================ xbeP_Close" ) hbide_saveINI( Self ) - HB_TRACE( HB_TR_ALWAYS, "================ xbeP_Close", "after: hbide_saveINI( Self )" ) ::oSM:closeAllSources() - HB_TRACE( HB_TR_ALWAYS, "================ xbeP_Close", "after: ::oSM:closeAllSources()" ) EXIT ELSEIF ::nEvent == xbeP_Keyboard @@ -516,11 +514,7 @@ METHOD HbIde:create( aParams ) ::oCurEditor:dispEditInfo( ::qCurEdit ) ENDIF - CASE ::mp1 == xbeK_ESC - ::oSM:closeSource() - ENDCASE - ENDIF ::oXbp:handleEvent( ::nEvent, ::mp1, ::mp2 ) diff --git a/harbour/contrib/hbide/ideactions.prg b/harbour/contrib/hbide/ideactions.prg index 5c6bed6376..5e54dc35ae 100644 --- a/harbour/contrib/hbide/ideactions.prg +++ b/harbour/contrib/hbide/ideactions.prg @@ -239,9 +239,6 @@ METHOD IdeActions:loadActions() aadd( aAct, { "SetMark" , "Set Mark" , "placeremovemark", "" , "No", "Yes" } ) aadd( aAct, { "GotoMark" , "Goto Mark" , "gotomark" , "" , "No", "Yes" } ) aadd( aAct, { "Goto" , "~Goto Line..." , "gotoline" , "^G" , "No", "Yes" } ) - aadd( aAct, { "ToUpper" , "To Upper" , "toupper" , "" , "No", "Yes" } ) - aadd( aAct, { "ToLower" , "To Lower" , "tolower" , "" , "No", "Yes" } ) - aadd( aAct, { "Invert" , "Invert" , "invertcase" , "" , "No", "Yes" } ) aadd( aAct, { "MatchPairs" , "Match Pairs" , "matchobj" , "" , "No", "Yes" } ) aadd( aAct, { "ZoomIn" , "ZoomIn" , "zoomin" , "" , "No", "Yes" } ) aadd( aAct, { "ZoomOut" , "ZoomOut" , "zoomout" , "" , "No", "Yes" } ) @@ -296,18 +293,17 @@ METHOD IdeActions:loadActions() aadd( aAct, { "BlockIndentL" , "Indent Left" , "blockindentl" , "" , "No", "Yes" } ) aadd( aAct, { "BlockDbl2Sgl" , "Double Quotes to Single" , "dbl2sglquote" , "" , "No", "Yes" } ) aadd( aAct, { "BlockSgl2Dbl" , "Single Quotes to Double" , "sgl2dblquote" , "" , "No", "Yes" } ) -#if 0 - aadd( aAct, { "DuplicateLine" , "Duplicate Current Line" , "duplicateline" , "^D" , "No", "Yes" } ) - aadd( aAct, { "DeleteLine" , "Delete Line" , "deleteline" , "^Delete", "No", "Yes" } ) - aadd( aAct, { "MoveLineUp" , "Move Line Up" , "movelineup" , "Sh+^Up", "No", "Yes" } ) - aadd( aAct, { "MoveLineDown" , "Move Line Down" , "movelinedown" , "Sh+^Down", "No", "Yes" } ) -#endif + aadd( aAct, { "DuplicateLine" , "Duplicate Current Line" , "duplicateline" , "" , "No", "Yes" } ) aadd( aAct, { "DeleteLine" , "Delete Line" , "deleteline" , "" , "No", "Yes" } ) aadd( aAct, { "MoveLineUp" , "Move Line Up" , "movelineup" , "" , "No", "Yes" } ) aadd( aAct, { "MoveLineDown" , "Move Line Down" , "movelinedown" , "" , "No", "Yes" } ) aadd( aAct, { "Environments" , "Environments..." , "envconfig" , "" , "No", "Yes" } ) + aadd( aAct, { "ToUpper" , "To Upper" , "toupper" , "" , "No", "Yes" } ) + aadd( aAct, { "ToLower" , "To Lower" , "tolower" , "" , "No", "Yes" } ) + aadd( aAct, { "Invert" , "Invert" , "invertcase" , "" , "No", "Yes" } ) + aadd( aAct, { "GotoFunc" , "Goto Function" , "dc_function" , "" , "No", "Yes" } ) aadd( aAct, { "Shortcuts" , "Keyboard Mappings" , "keyboardmappings","" , "No", "Yes" } ) * aadd( aAct, { "Tools" , "Tools & Utilities" , "tools" , "" , "No", "Yes" } ) @@ -483,6 +479,10 @@ METHOD IdeActions:buildMainMenu() oMenuBar:addItem( { oSubMenu2, _T( "~Line" ) } ) // oSubMenu2 := XbpMenu():new( oSubMenu ):create() + oSubMenu2:addItem( { ::getAction( "ToUpper" ), {|| oIde:execAction( "ToUpper" ) } } ) + oSubMenu2:addItem( { ::getAction( "ToLower" ), {|| oIde:execAction( "ToLower" ) } } ) + oSubMenu2:addItem( { ::getAction( "Invert" ), {|| oIde:execAction( "Invert" ) } } ) + hbide_menuAddSep( oSubMenu2 ) oSubMenu2:addItem( { ::getAction( "StreamComment" ), {|| oIde:execAction( "StreamComment" ) } } ) oSubMenu2:addItem( { ::getAction( "BlockComment" ), {|| oIde:execAction( "BlockComment" ) } } ) hbide_menuAddSep( oSubMenu2 ) diff --git a/harbour/contrib/hbide/idedocks.prg b/harbour/contrib/hbide/idedocks.prg index 950c1665bb..aa3c807e55 100644 --- a/harbour/contrib/hbide/idedocks.prg +++ b/harbour/contrib/hbide/idedocks.prg @@ -94,6 +94,8 @@ CLASS IdeDocks INHERIT IdeObject DATA aBtnDocks INIT {} DATA oBtnTabClose + DATA qTBtnClose + METHOD new( oIde ) METHOD create( oIde ) METHOD destroy() @@ -427,7 +429,7 @@ METHOD IdeDocks:buildStackedWidget() /*----------------------------------------------------------------------*/ METHOD IdeDocks:buildViewWidget( cObjectName ) - LOCAL oFrame + LOCAL oFrame, qTBtnClose oFrame := XbpWindow():new( ::oStackedWidget ) oFrame:oWidget := QWidget():new( ::oStackedWidget:oWidget ) @@ -438,16 +440,17 @@ METHOD IdeDocks:buildViewWidget( cObjectName ) oFrame:qLayout:setContentsMargins( 2, 2, 2, 2 ) oFrame:oTabWidget := XbpTabWidget():new():create( oFrame, , {0,0}, {200,200}, , .t. ) - #if 0 - IF empty( qTBtn ) - qTBtn := QWidget():new() //QToolButton():new( oFrame:oTabWidget:oWidget ) - qTBtn:setTooltip( "Close Tab" ) - qTBtn:setIcon( hbide_image( "closetab" ) ) - qTBtn:setMaximumWidth( 16 ) - qTBtn:setMaximumHeight( 16 ) + + IF empty( qTBtnClose ) + qTBtnClose := QToolButton():new() + qTBtnClose:setTooltip( "Close Tab" ) + qTBtnClose:setAutoRaise( .t. ) + qTBtnClose:setIcon( hbide_image( "closetab" ) ) + ::connect( qTBtnClose, "clicked()", {|| ::oSM:closeSource() } ) ENDIF - oFrame:oTabWidget:oWidget:setCornerWidget( qTBtn, Qt_TopLeftCorner ) - #endif + oFrame:oTabWidget:qCornerWidget := qTBtnClose + oFrame:oTabWidget:oWidget:setCornerWidget( qTBtnClose, Qt_TopRightCorner ) + oFrame:oTabWidget:oWidget:setUsesScrollButtons( .f. ) oFrame:oTabWidget:oWidget:setMovable( .t. ) diff --git a/harbour/contrib/hbide/ideeditor.prg b/harbour/contrib/hbide/ideeditor.prg index f389ef04f5..c0a8d32409 100644 --- a/harbour/contrib/hbide/ideeditor.prg +++ b/harbour/contrib/hbide/ideeditor.prg @@ -87,6 +87,7 @@ #define timerTimeout 23 #define qcompleter_activated 101 +#define qTab_contextMenu 111 #define EDT_LINNO_WIDTH 50 @@ -830,29 +831,6 @@ METHOD IdeEditsManager:RemoveTrailingSpaces() /*----------------------------------------------------------------------*/ METHOD IdeEditsManager:zoom( nKey ) - #if 0 - LOCAL nPointSize, qFont, oEdit, oEditor - - IF ! empty( oEditor := ::getEditorCurrent() ) - oEdit := oEditor:oEdit - - qFont := QFont():configure( oEdit:qEdit:font() ) - qFont:setFamily( "Courier New" ) - qFont:setFixedPitch( .t. ) - nPointSize := qFont:pointSize() - nPointSize += iif( nKey == 1, 1, -1 ) - - IF nPointSize > 4 .AND. nPointSize < 37 - qFont:setPointSize( nPointSize ) - - oEdit:qEdit:setFont( qFont ) - - FOR EACH oEdit IN oEditor:aEdits - oEdit:qEdit:setFont( qFont ) - NEXT - ENDIF - ENDIF - #endif LOCAL oEdit IF !empty( oEdit := ::getEditObjectCurrent() ) @@ -1214,7 +1192,7 @@ METHOD IdeEditor:setDocumentProperties() /*----------------------------------------------------------------------*/ METHOD IdeEditor:execEvent( nMode, p ) - LOCAL cFileTemp + LOCAL cFileTemp, aPops := {} p := p @@ -1225,6 +1203,12 @@ METHOD IdeEditor:execEvent( nMode, p ) hb_memowrit( cFileTemp, ::qEdit:toPlainText() ) ENDIF EXIT + + CASE qTab_contextMenu +HB_TRACE( HB_TR_ALWAYS, "IdeEditor:execEvent( nMode, p )" ) + aadd( aPops, { "Close", {|| MsgBox( "closing" ) } } ) + hbide_ExecPopup( aPops, p, ::oTab:oWidget ) + ENDSWITCH RETURN Self @@ -1313,7 +1297,8 @@ METHOD IdeEditor:buildTabPage( cSource ) ::qTabWidget:setCurrentIndex( ::qTabWidget:indexOf( ::oTab:oWidget ) ) ::qTabWidget:setTabTooltip( ::qTabWidget:indexOf( ::oTab:oWidget ), cSource ) - + //::connect( ::oTab:oWidget, "customContextMenuRequested(QPoint)", {|p| ::execEvent( qTab_contextMenu, p ) } ) + //::oTab:hbContextMenu := {|| ::execEvent( qTab_contextMenu, p ) } ::oTab:tabActivate := {|mp1,mp2,oXbp| ::activateTab( mp1, mp2, oXbp ) } RETURN Self @@ -2845,8 +2830,9 @@ FUNCTION hbide_isHarbourKeyword( cWord ) 'hb_symbol_unused' => NIL,; 'error' => NIL,; 'handler' => NIL,; - '.or.' => NIL,; - '.and.' => NIL } + 'nil' => NIL,; + 'or' => NIL,; + 'and' => NIL } RETURN Lower( cWord ) $ s_b_ diff --git a/harbour/contrib/hbide/ideshortcuts.prg b/harbour/contrib/hbide/ideshortcuts.prg index 85f9b171be..211375ab34 100644 --- a/harbour/contrib/hbide/ideshortcuts.prg +++ b/harbour/contrib/hbide/ideshortcuts.prg @@ -149,6 +149,7 @@ CLASS IdeShortcuts INHERIT IdeObject METHOD newSource( cType ) METHOD open() METHOD save() + METHOD saveAs() METHOD saveAll() METHOD close() METHOD print() @@ -166,6 +167,8 @@ CLASS IdeShortcuts INHERIT IdeObject METHOD streamComment() METHOD build( cProj ) METHOD buildLaunch( cProj ) + METHOD reBuild( cProj ) + METHOD reBuildLaunch( cProj ) METHOD launch( cProj ) METHOD insert( cText ) METHOD separator( cSep ) @@ -175,6 +178,26 @@ CLASS IdeShortcuts INHERIT IdeObject METHOD toLower() METHOD invertCase() METHOD zoom( nKey ) + METHOD cut() + METHOD copy() + METHOD paste() + METHOD undo() + METHOD redo() + METHOD selectAll() + METHOD setBookMark() + METHOD gotoMark() + METHOD switchToReadOnly() + METHOD dlgKeyboardMappings() + METHOD dlgToolsAndUtils() + METHOD setView( cView ) + METHOD compilePPO() + METHOD single2doubleQuotes() + METHOD double2singleQuotes() + METHOD tabs2spaces() + METHOD removeTrailingSpaces() + METHOD toggleLineNumbersDisplay() + METHOD toggleSelectionMode() + METHOD toggleStatusBar() ENDCLASS @@ -860,57 +883,37 @@ METHOD IdeShortcuts:loadKeys() FOR EACH a_ IN ::aKeys a_[ 2 ] := trim( a_[ 2 ] ) NEXT - RETURN Self /*----------------------------------------------------------------------*/ - METHOD IdeShortcuts:execTool( ... ) RETURN ::oTM:execTool( ... ) - /*----------------------------------------------------------------------*/ - METHOD IdeShortcuts:getWord( lSelect ) RETURN ::oEM:getWord( lSelect ) - /*----------------------------------------------------------------------*/ - METHOD IdeShortcuts:getLine( lSelect ) RETURN ::oEM:getLine( , lSelect ) - /*----------------------------------------------------------------------*/ - METHOD IdeShortcuts:getText() RETURN ::oEM:getText() - /*----------------------------------------------------------------------*/ - METHOD IdeShortcuts:duplicateLine() RETURN ::oEM:duplicateLine() - /*----------------------------------------------------------------------*/ - METHOD IdeShortcuts:deleteLine() RETURN ::oEM:deleteLine() - /*----------------------------------------------------------------------*/ - METHOD IdeShortcuts:moveLineUp() RETURN ::oEM:moveLine( -1 ) - /*----------------------------------------------------------------------*/ - METHOD IdeShortcuts:moveLineDown() RETURN ::oEM:moveLine( 1 ) - /*----------------------------------------------------------------------*/ - METHOD IdeShortcuts:help( cTopic ) HB_SYMBOL_UNUSED( cTopic ) RETURN ::oHelpDock:show() - /*----------------------------------------------------------------------*/ - METHOD IdeShortcuts:exit( lWarn ) IF hb_isLogical( lWarn ) .AND. lWarn IF hbide_getYesNo( "Exit hbIDE ?", , "Macro Executed" ) @@ -920,110 +923,89 @@ METHOD IdeShortcuts:exit( lWarn ) PostAppEvent( xbeP_Close, NIL, NIL, ::oDlg ) ENDIF RETURN Self - /*----------------------------------------------------------------------*/ - METHOD IdeShortcuts:newSource( cType ) HB_SYMBOL_UNUSED( cType ) RETURN ::oSM:editSource( '' ) - /*----------------------------------------------------------------------*/ - METHOD IdeShortcuts:open() RETURN ::oSM:openSource() - /*----------------------------------------------------------------------*/ - METHOD IdeShortcuts:save() RETURN ::oSM:saveSource( ::oEM:getTabCurrent(), .f., .f. ) - /*----------------------------------------------------------------------*/ - +METHOD IdeShortcuts:saveAs() + RETURN ::oSM:saveSource( ::oEM:getTabCurrent(), .t., .t. ) +/*----------------------------------------------------------------------*/ METHOD IdeShortcuts:saveAll() RETURN ::oSM:saveAllSources() - /*----------------------------------------------------------------------*/ - METHOD IdeShortcuts:close() RETURN ::oSM:closeSource() - /*----------------------------------------------------------------------*/ - METHOD IdeShortcuts:print() RETURN ::oEM:printPreview() - /*----------------------------------------------------------------------*/ - METHOD IdeShortcuts:revertToSaved() RETURN Self - /*----------------------------------------------------------------------*/ - METHOD IdeShortcuts:findDlg() IF !Empty( ::qCurEdit ) ::oFR:show() ENDIF RETURN Self - /*----------------------------------------------------------------------*/ - METHOD IdeShortcuts:findDlgEx() IF !Empty( ::qCurEdit ) ::oSearchReplace:beginFind() ENDIF RETURN Self - /*----------------------------------------------------------------------*/ - METHOD IdeShortcuts:gotoLine( nLine ) RETURN ::oEM:goTo( nLine ) - /*----------------------------------------------------------------------*/ - METHOD IdeShortcuts:indentRight() RETURN ::oEM:indent( 1 ) - /*----------------------------------------------------------------------*/ - METHOD IdeShortcuts:indentLeft() RETURN ::oEM:indent( -1 ) - /*----------------------------------------------------------------------*/ - METHOD IdeShortcuts:blockComment() RETURN ::oEM:blockComment() - /*----------------------------------------------------------------------*/ - METHOD IdeShortcuts:streamComment() RETURN ::oEM:streamComment() - /*----------------------------------------------------------------------*/ - METHOD IdeShortcuts:build( cProj ) IF ! hb_isChar( cProj ) cProj := "" ENDIF RETURN ::oPM:buildProject( cProj, .F., .F. ) - /*----------------------------------------------------------------------*/ - METHOD IdeShortcuts:buildLaunch( cProj ) IF ! hb_isChar( cProj ) cProj := "" ENDIF RETURN ::oPM:buildProject( cProj, .T., .F. ) - /*----------------------------------------------------------------------*/ - +METHOD IdeShortcuts:reBuild( cProj ) + IF ! hb_isChar( cProj ) + cProj := "" + ENDIF + RETURN ::oPM:buildProject( cProj, .F., .T. ) +/*----------------------------------------------------------------------*/ +METHOD IdeShortcuts:reBuildLaunch( cProj ) + IF ! hb_isChar( cProj ) + cProj := "" + ENDIF + RETURN ::oPM:buildProject( cProj, .T., .T. ) +/*----------------------------------------------------------------------*/ METHOD IdeShortcuts:launch( cProj ) IF ! hb_isChar( cProj ) cProj := "" ENDIF RETURN ::oPM:launchProject( cProj ) - /*----------------------------------------------------------------------*/ - METHOD IdeShortcuts:insert( cText ) LOCAL oEdit IF ! empty( oEdit := ::getEditObjectCurrent() ) @@ -1032,56 +1014,107 @@ METHOD IdeShortcuts:insert( cText ) ENDIF ENDIF RETURN Self - /*----------------------------------------------------------------------*/ - METHOD IdeShortcuts:separator( cSep ) RETURN ::oEM:insertSeparator( cSep ) - /*----------------------------------------------------------------------*/ - METHOD IdeShortcuts:findAgain() IF !empty( ::qCurEdit ) ::oFR:find() ENDIF RETURN Self - /*----------------------------------------------------------------------*/ - METHOD IdeShortcuts:replace() IF !empty( ::qCurEdit ) ::oFR:replace() ENDIF RETURN Self - /*----------------------------------------------------------------------*/ - METHOD IdeShortcuts:toUpper() RETURN ::oEM:convertSelection( "ToUpper" ) - /*----------------------------------------------------------------------*/ - METHOD IdeShortcuts:toLower() RETURN ::oEM:convertSelection( "ToLower" ) - /*----------------------------------------------------------------------*/ - METHOD IdeShortcuts:invertCase() RETURN ::oEM:convertSelection( "Invert" ) - /*----------------------------------------------------------------------*/ - METHOD IdeShortcuts:zoom( nKey ) RETURN ::oEM:zoom( nKey ) - +/*----------------------------------------------------------------------*/ +METHOD IdeShortcuts:cut() + RETURN ::oEM:cut() +/*----------------------------------------------------------------------*/ +METHOD IdeShortcuts:copy() + RETURN ::oEM:copy() +/*----------------------------------------------------------------------*/ +METHOD IdeShortcuts:paste() + RETURN ::oEM:paste() +/*----------------------------------------------------------------------*/ +METHOD IdeShortcuts:selectAll() + RETURN ::oEM:selectAll() +/*----------------------------------------------------------------------*/ +METHOD IdeShortcuts:redo() + RETURN ::oEM:redo() +/*----------------------------------------------------------------------*/ +METHOD IdeShortcuts:undo() + RETURN ::oEM:undo() +/*----------------------------------------------------------------------*/ +METHOD IdeShortcuts:setBookMark() + RETURN ::oEM:setMark() +/*----------------------------------------------------------------------*/ +METHOD IdeShortcuts:gotoMark() + RETURN ::oEM:gotoMark() +/*----------------------------------------------------------------------*/ +METHOD IdeShortcuts:switchToReadOnly() + RETURN ::oEM:switchToReadOnly() +/*----------------------------------------------------------------------*/ +METHOD IdeShortcuts:dlgKeyboardMappings() + RETURN ::oTM:show() +/*----------------------------------------------------------------------*/ +METHOD IdeShortcuts:dlgToolsAndUtils() + RETURN ::oSC:show() +/*----------------------------------------------------------------------*/ +METHOD IdeShortcuts:setView( cView ) + IF empty( cView ) + cView := "Stats" + ENDIF + RETURN ::oDK:setView( cView ) +/*----------------------------------------------------------------------*/ +METHOD IdeShortcuts:compilePPO() + RETURN ::oPM:buildProject( '', .F., .F., .T., .T. ) +/*----------------------------------------------------------------------*/ +METHOD IdeShortcuts:single2doubleQuotes() + RETURN ::oEM:convertDQuotes() +/*----------------------------------------------------------------------*/ +METHOD IdeShortcuts:double2singleQuotes() + RETURN ::oEM:convertQuotes() +/*----------------------------------------------------------------------*/ +METHOD IdeShortcuts:tabs2spaces() + RETURN ::oEM:removeTabs() +/*----------------------------------------------------------------------*/ +METHOD IdeShortcuts:removeTrailingSpaces() + RETURN ::oEM:removeTrailingSpaces() +/*----------------------------------------------------------------------*/ +METHOD IdeShortcuts:toggleLineNumbersDisplay() + RETURN ::oEM:toggleLineNumbers() +/*----------------------------------------------------------------------*/ +METHOD IdeShortcuts:toggleSelectionMode() + ::isColumnSelectionEnabled := ! ::isColumnSelectionEnabled + RETURN ::oEM:toggleSelectionMode() +/*----------------------------------------------------------------------*/ +METHOD IdeShortcuts:toggleStatusBar() + IF ::lStatusBarVisible + ::oSBar:oWidget:hide() + ELSE + ::oSBar:oWidget:show() + ENDIF + ::lStatusBarVisible := ! ::lStatusBarVisible + RETURN Self /*----------------------------------------------------------------------*/ METHOD IdeShortcuts:loadMethods() - #if 0 - aadd( ::aMethods, { '', ; - '', ; - '' } ) - #endif + aadd( ::aMethods, { 'help( cTopic )', ; 'help( "" )', ; 'Invokes "Help" docking widget in the right docking area. is not active yet.' } ) @@ -1097,6 +1130,9 @@ METHOD IdeShortcuts:loadMethods() aadd( ::aMethods, { 'save()', ; 'save()', ; 'Saves the current editing instance if in modified state. Visual artifacts are updated accordingly.' } ) + aadd( ::aMethods, { 'saveAs()', ; + 'saveAs()', ; + 'Opens "File Save Dialog" to fetch a file name and saves the current editing instance into new file. Visual artifacts are updated accordingly.' } ) aadd( ::aMethods, { 'saveAll()', ; 'saveAll()', ; 'Saves all opened editing instances on the visible panel, if in modified state. Visual artifacts are updated accordingly.' } ) @@ -1148,13 +1184,19 @@ METHOD IdeShortcuts:loadMethods() aadd( ::aMethods, { 'buildLaunch( cProj )', ; 'buildLaunch( "" )', ; 'Builds and launches if it is already loaded. All sources are saved if found in modified state before "build" is initiated.' } ) - aadd( ::aMethods, { 'launch( cProj )', ; - 'launch( "" )', ; + aadd( ::aMethods, { 'reBuild( cProj )', ; + 'reBuild( "" )', ; + 'Re-builds if it is already loaded. All sources are saved if found in modified state before "build" is initiated.' } ) + aadd( ::aMethods, { 'reBuildLaunch( cProj )', ; + 'reBuildLaunch( "" )', ; + 'Re-builds and launches if it is already loaded. All sources are saved if found in modified state before "build" is initiated.' } ) + aadd( ::aMethods, { 'launch( cProj )' , ; + 'launch( "" )' , ; 'Launches if it is already loaded.' } ) - aadd( ::aMethods, { 'insert( cText )', ; - 'insert( "" )', ; + aadd( ::aMethods, { 'insert( cText )' , ; + 'insert( "" )' , ; 'Insert at current cursor position.' } ) - aadd( ::aMethods, { 'separator( cSep )', ; + aadd( ::aMethods, { 'separator( cSep )' , ; 'separator( ' + '/*' + replicate( "-", 68 ) + '*/' + ' )', ; 'Inserts separator line immediately before current line. defaults to "/*---*/"' } ) aadd( ::aMethods, { 'getWord( lSelect )', ; @@ -1176,6 +1218,69 @@ METHOD IdeShortcuts:loadMethods() aadd( ::aMethods, { 'zoom( nVal )' , ; 'zoom( +1 )' , ; 'Zooms in/out the current editing instance. nVal: 1-one size up; -1-one size less; NIL-original size; 5~30-to size.' } ) + aadd( ::aMethods, { 'cut()' , ; + 'cut()' , ; + 'Cuts the selected text and copies onto clipboard.' } ) + aadd( ::aMethods, { 'copy()' , ; + 'copy()' , ; + 'Copies the selected text onto clipboard.' } ) + aadd( ::aMethods, { 'paste()' , ; + 'paste()' , ; + 'Pastes the text available onto clipboard at the current cursor position.' } ) + aadd( ::aMethods, { 'undo()' , ; + 'undo()' , ; + 'Attempts to undo the last operation if one still hangs in the buffer.' } ) + aadd( ::aMethods, { 'redo()' , ; + 'redo()' , ; + 'Attempts to re-do the last undone action.' } ) + aadd( ::aMethods, { 'selectAll()' , ; + 'selectAll()' , ; + 'Selects the whole text and places the cursor at the end of source.' } ) + aadd( ::aMethods, { 'print()' , ; + 'print()' , ; + 'Opens Print Preview dialog which will contain the source line broken by pages.' } ) + aadd( ::aMethods, { 'setBookMark()' , ; + 'setBookMark()' , ; + 'Attempts to install a bookmark onto current cursor position. If successful, mark appears as a colored tool-button on the statusbar and marked line is highlighted with the same color.' } ) + aadd( ::aMethods, { 'gotoMark( nMark )' , ; + 'gotoMark( 1 )' , ; + 'Attempts to reach mark represented by . Please note maximum 6 bookmarks are avialable per edit instance.' } ) + aadd( ::aMethods, { 'switchToReadOnly()', ; + 'switchToReadOnly()', ; + 'Flags current editing instance read-only.' } ) + aadd( ::aMethods, { 'dlgKeyboardMappings()', ; + 'dlgKeyboardMappings()', ; + 'Opens "Keyboard Mappings" dialog.' } ) + aadd( ::aMethods, { 'dlgToolsAndUtils()', ; + 'dlgToolsAndUtils()', ; + 'Opens "Toola & Utilities" dialog.' } ) + aadd( ::aMethods, { 'setView( cView )' , ; + 'setView( "" )' , ; + 'Brings panel to front. Defaults to "Stats", i.e., tab.' } ) + aadd( ::aMethods, { 'compilePPO()' , ; + 'compilePPO()' , ; + 'Attemps to compile current source to .ppo formats, and if successful, presents the compiled source in a new edit instance.' } ) + aadd( ::aMethods, { 'single2doubleQuotes()', ; + 'single2doubleQuotes()', ; + 'Converts single quotes to double in the currently selected text.' } ) + aadd( ::aMethods, { 'double2singleQuotes()', ; + 'double2singleQuotes()', ; + 'Converts double quotes to single in the currently selected text.' } ) + aadd( ::aMethods, { 'tabs2spaces()', ; + 'tabs2spaces()', ; + 'Converts tabs to spaces, currently 3, the entire source. However, source is not saved.' } ) + aadd( ::aMethods, { 'removeTrailingSpaces()', ; + 'removeTrailingSpaces()', ; + 'Removes trailing spaces per line, the entire source. However, source is not saved.' } ) + aadd( ::aMethods, { 'toggleLineNumbersDisplay()', ; + 'toggleLineNumbersDisplay()', ; + 'Toggles line numbers display inside editing instances. This action has global scope and is saved for next run.' } ) + aadd( ::aMethods, { 'toggleSelectionMode()', ; + 'toggleSelectionMode()', ; + 'Toggles selection mode from "stream" to "column" or vice-versa.' } ) + aadd( ::aMethods, { 'toggleStatusBar()', ; + 'toggleStatusBar()', ; + 'Toggles display of statusbar. The action is not saved for next run.' } ) RETURN Self @@ -1239,7 +1344,7 @@ METHOD IdeShortcuts:mergeMacros( a_ ) FOR EACH c_ IN a_ IF ( n := ascan( ::aDftSCuts, {|e_| e_[ 2 ] == c_[ 2 ] .AND. e_[ 3 ] == c_[ 3 ] .AND. ; - e_[ 4 ] == c_[ 4 ] .AND. e_[ 5 ] == c_[ 5 ] } ) ) == 0 + e_[ 4 ] == c_[ 4 ] .AND. e_[ 5 ] == c_[ 5 ] } ) ) == 0 aadd( ::aDftSCuts, c_ ) ELSE ::aDftSCuts[ n ] := c_ @@ -1249,5 +1354,47 @@ METHOD IdeShortcuts:mergeMacros( a_ ) RETURN Self /*----------------------------------------------------------------------*/ - - + #if 0 + CASE "Environments" + ::oEV:fetchNew() + EXIT + CASE "Animate" + ::nAnimantionMode := iif( ::nAnimantionMode == HBIDE_ANIMATION_NONE, HBIDE_ANIMATION_GRADIENT, HBIDE_ANIMATION_NONE ) + ::oDK:animateComponents( ::nAnimantionMode ) + EXIT + CASE "Help" + ::oHelpDock:show() + EXIT + CASE "Goto" + ::oEM:goTo() + EXIT + CASE "FormatBraces" + ::oEM:formatBraces() + EXIT + CASE "SaveExit" + ::oSM:saveAndExit() + EXIT + CASE "Revert" + ::oSM:RevertSource() + EXIT + CASE "CloseAll" + ::oSM:closeAllSources() + EXIT + CASE "CloseOther" + ::oSM:closeAllOthers() + EXIT + CASE "NewProject" + ::oPM:loadProperties( , .t., .t., .t. ) + EXIT + CASE "Properties" + ::oPM:getProperties() + EXIT + CASE "SelectProject" + ::oPM:selectCurrentProject() + EXIT + CASE "CloseProject" + ::oPM:closeProject() + EXIT + ENDSWITCH + #endif +/*----------------------------------------------------------------------*/ diff --git a/harbour/contrib/hbide/idethemes.prg b/harbour/contrib/hbide/idethemes.prg index f912f0eb00..ee2264c583 100644 --- a/harbour/contrib/hbide/idethemes.prg +++ b/harbour/contrib/hbide/idethemes.prg @@ -194,7 +194,7 @@ METHOD IdeThemes:create( oIde, cIniFile ) 'if','else','elseif','endif','end', 'endswitch', ; 'docase','case','endcase','otherwise', 'switch', ; 'do','while','exit',; - 'for','each','next','step','to',; + 'for','each','next','step','to','nil','and','or','self',; 'class','endclass','method','data','var','destructor','inline','assign','access',; 'inherit','init','create','virtual','message',; 'begin','sequence','try','catch','always','recover','hb_symbol_unused', ; diff --git a/harbour/contrib/hbxbp/xbptabpage.prg b/harbour/contrib/hbxbp/xbptabpage.prg index 1c252a4f13..d750f526a0 100644 --- a/harbour/contrib/hbxbp/xbptabpage.prg +++ b/harbour/contrib/hbxbp/xbptabpage.prg @@ -136,6 +136,7 @@ METHOD XbpTabPage:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) oPar := ::oParent:oTabWidget ::oWidget := QWidget():new() + ::oWidget:setContextMenuPolicy( Qt_CustomContextMenu ) oPar:oWidget:addTab( ::pWidget, ::caption ) @@ -189,7 +190,7 @@ METHOD XbpTabPage:execSlot( cSlot, p ) LOCAL iIndex := p HB_SYMBOL_UNUSED( cSlot ) - + IF iIndex >= 0 .and. len( ::oParent:aTabs ) > 0 IF hb_isBlock( ::oParent:aTabs[ iIndex+1 ]:sl_tabActivate ) eval( ::oParent:aTabs[ iIndex+1 ]:sl_tabActivate, NIL, NIL, ::oParent:aTabs[ iIndex+1 ] ) @@ -215,7 +216,7 @@ METHOD XbpTabPage:tabActivate( ... ) ::sl_tabActivate := a_[ 1 ] ELSEIF len( a_ ) >= 0 .AND. hb_isBlock( ::sl_tabActivate ) eval( ::sl_tabActivate, NIL, NIL, Self ) - ENDIF + ENDIF RETURN self /*----------------------------------------------------------------------*/ @@ -226,7 +227,7 @@ METHOD XbpTabPage:closeRequested( ... ) ::sl_closeRequested := a_[ 1 ] ELSEIF len( a_ ) >= 0 .AND. hb_isBlock( ::sl_closeRequested ) eval( ::sl_closeRequested, NIL, NIL, Self ) - ENDIF + ENDIF RETURN self /*----------------------------------------------------------------------*/ @@ -254,6 +255,7 @@ METHOD XbpTabPage:maximize() CLASS XbpTabWidget INHERIT XbpWindow DATA aTabs INIT {} + DATA qCornerWidget METHOD new( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) @@ -279,9 +281,11 @@ METHOD XbpTabWidget:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ::xbpWindow:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) ::oWidget := QTabWidget():new( ::pParent ) + ::oWidget:setContextMenuPolicy( Qt_CustomContextMenu ) - ::Connect( ::pWidget, "currentChanged(int)" , {|i| ::execSlot( "currentChanged(int)" , i ) } ) - ::Connect( ::pWidget, "tabCloseRequested(int)" , {|i| ::execSlot( "tabCloseRequested(int)", i ) } ) + ::Connect( ::oWidget, "currentChanged(int)" , {|i| ::execSlot( "currentChanged(int)" , i ) } ) + ::Connect( ::oWidget, "tabCloseRequested(int)" , {|i| ::execSlot( "tabCloseRequested(int)", i ) } ) + ::connect( ::oWidget, "customContextMenuRequested(QPoint)", {|p| ::execSlot( "customContextMenuRequested(QPoint)", p ) } ) ::setPosAndSize() IF ::visible @@ -310,8 +314,14 @@ METHOD XbpTabWidget:destroy() /*----------------------------------------------------------------------*/ METHOD XbpTabWidget:execSlot( cSlot, p ) - LOCAL qTab, nIndex, oTab - LOCAL iIndex := p + LOCAL qTab, nIndex, oTab, qPoint + LOCAL iIndex + + IF hb_isPointer( p ) + qPoint := QPoint():from( ::oWidget:mapToGlobal( p ) ) + ELSE + iIndex := p + ENDIF IF !empty( ::aChildren ) .and. iIndex >= 0 .and. iIndex < len( ::aChildren ) qTab := ::oWidget:widget( iIndex ) @@ -320,7 +330,11 @@ METHOD XbpTabWidget:execSlot( cSlot, p ) oTab := ::aChildren[ nIndex ] DO CASE - CASE cSlot == "currentChanged(int)" + CASE cSlot == "customContextMenuRequested(QPoint)" + qPoint := QPoint():from( ::oWidget:mapToGlobal( p ) ) + oTab:hbContextMenu( { qPoint:x(), qPoint:y() } ) + + CASE cSlot == "currentChanged(int)" oTab:tabActivate() CASE cSlot == "tabCloseRequested(int)" @@ -330,6 +344,6 @@ METHOD XbpTabWidget:execSlot( cSlot, p ) ENDIF ENDIF - RETURN nil + RETURN qPoint /*----------------------------------------------------------------------*/