From 95c834188aa57fadd4b8d7c50dbd8a72e51f813f Mon Sep 17 00:00:00 2001 From: Pritpal Bedi Date: Mon, 13 Aug 2012 16:41:42 +0000 Subject: [PATCH] 2012-08-13 09:30 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) * contrib/hbide/dict.prg % Added: some more data members, q work-in-progress. * contrib/hbide/themes.prg * Minor. * contrib/hbide/setup.ui * contrib/hbide/edit.prg * contrib/hbide/saveload.prg + Added: To Toggle [LOCAL] [YES], [RETURN] [YES], [SEPERATOR] [YES], [DOCUMENTATION] [NO] [TOBE] FUNCTION|function|Function|fUnCtioN . => FUNCTION . LOCAL RETURN /*....................*/ // User defined separator line // and a blank line after the separator --- harbour/ChangeLog | 23 ++++++ harbour/contrib/hbide/dict.prg | 45 ++++++++---- harbour/contrib/hbide/edit.prg | 88 +++++++++++++++++----- harbour/contrib/hbide/saveload.prg | 31 +++++--- harbour/contrib/hbide/setup.ui | 113 +++++++++++++++++++++++------ harbour/contrib/hbide/themes.prg | 3 +- 6 files changed, 235 insertions(+), 68 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 3441d8561d..5ea2bc9c71 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,29 @@ The license applies to all entries newer than 2009-04-28. */ +2012-08-13 09:30 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) + * contrib/hbide/dict.prg + % Added: some more data members, q work-in-progress. + + * contrib/hbide/themes.prg + * Minor. + + * contrib/hbide/setup.ui + * contrib/hbide/edit.prg + * contrib/hbide/saveload.prg + + Added: + To Toggle [LOCAL] [YES], [RETURN] [YES], [SEPERATOR] [YES], [DOCUMENTATION] [NO] [TOBE] + FUNCTION|function|Function|fUnCtioN . + => + FUNCTION . + LOCAL + + RETURN + + /*....................*/ // User defined separator line + // and a blank line after the separator + + 2012-08-11 22:52 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) * contrib/hbide/edit.prg ! Fixed: undo stack was behaving weired once statement structures diff --git a/harbour/contrib/hbide/dict.prg b/harbour/contrib/hbide/dict.prg index 2cd404bb6c..eea2a3f7e9 100644 --- a/harbour/contrib/hbide/dict.prg +++ b/harbour/contrib/hbide/dict.prg @@ -106,42 +106,48 @@ CLASS IdeDictionary INHERIT IdeObject DATA cDictInfo INIT "" DATA cFilename INIT "" - DATA lCaseSensitive INIT .f. + DATA lActive INIT .T. + DATA lToPrg INIT .T. + DATA lToC INIT .F. + DATA lToCPP INIT .F. + DATA lToCH INIT .F. + DATA lToH INIT .F. + DATA lToIni INIT .F. + DATA lToTxt INIT .F. + DATA lToHbp INIT .F. DATA cConvMode INIT "ASIS" - DATA lAutoComplete INIT .t. - DATA cBgColor INIT "NONE" - DATA qBgColor + DATA lCaseSensitive INIT .F. + DATA lBold INIT .F. + DATA lItalic INIT .F. + DATA lULine INIT .F. + DATA lTxtColor INIT .F. + DATA lBgBColor INIT .F. + DATA cTxtColor INIT "" + DATA cBgColor INIT "" + + DATA qBGColor + DATA lAutoComplete INIT .T. DATA aItems INIT {} METHOD new( oIde ) METHOD create( oIde ) - METHOD destroy() + METHOD destroy() VIRTUAL METHOD load( cDict ) + METHOD toString() ENDCLASS /*----------------------------------------------------------------------*/ METHOD IdeDictionary:new( oIde ) - ::oIde := oIde - RETURN Self /*----------------------------------------------------------------------*/ METHOD IdeDictionary:create( oIde ) - DEFAULT oIde TO ::oIde - ::oIde := oIde - - RETURN Self - -/*----------------------------------------------------------------------*/ - -METHOD IdeDictionary:destroy() - RETURN Self /*----------------------------------------------------------------------*/ @@ -205,3 +211,10 @@ METHOD IdeDictionary:load( cDict ) RETURN Self /*----------------------------------------------------------------------*/ + +METHOD IdeDictionary:toString() + LOCAL cDict := "" + + RETURN cDict + +/*----------------------------------------------------------------------*/ diff --git a/harbour/contrib/hbide/edit.prg b/harbour/contrib/hbide/edit.prg index 1993fff555..1d6e24042d 100644 --- a/harbour/contrib/hbide/edit.prg +++ b/harbour/contrib/hbide/edit.prg @@ -2266,9 +2266,7 @@ METHOD IdeEdit:reformatLine( nPos, nDeleted, nAdded ) qCursor:clearSelection() qCursor:setPosition( nPostn ) - //HB_TRACE( HB_TR_ALWAYS, "PP<", cPPWord, "> P<", cPWord, "> C<", cCWord, "> R<", cRest, ">" ) - - // Group I operations + /* Group I operations */ IF cPWord == "." .AND. cPPWord $ ::hLogicals /* ALWAYS */ IF ! ::oINI:lSupressHbKWordsToUpper qCursor:movePosition( QTextCursor_PreviousWord, QTextCursor_MoveAnchor, 2 ) @@ -2313,7 +2311,7 @@ METHOD IdeEdit:reformatLine( nPos, nDeleted, nAdded ) ENDIF - // Group II operations + /* Group II operations */ IF empty( cPPWord ) .AND. cCWord == " " IF hbide_isStartingKeyword( cPWord, ::oIde ) /* FUNCTION PROCEDURE CLASS */ qCursor:movePosition( QTextCursor_StartOfBlock ) @@ -2345,10 +2343,11 @@ METHOD IdeEdit:reformatLine( nPos, nDeleted, nAdded ) ENDIF ENDIF - // Group III operations + /* Group III operations */ IF cCWord == " " .AND. nAdded == 1 .AND. Empty( cRest ) /* Only first time having only word on a line */ + cWord := Lower( cPWord ) + IF ::oINI:lISClosing - cWord := Lower( cPWord ) IF ::oINI:lISIf .AND. cWord == "if" hbide_appendIf( qCursor, hbide_getFrontSpacesAndWord( qCursor:block():text() ), qCursor:position(), ::nTabSpaces, ::oINI:lISElse, ::oINI:lISEmbrace ) @@ -2371,6 +2370,19 @@ METHOD IdeEdit:reformatLine( nPos, nDeleted, nAdded ) ELSEIF cWord == "next" hbide_alignToPrevWord( qCursor, "for", "next", Len( cWord ), nPostn ) + + ENDIF + + IF Lower( cPPWord ) == "static" .AND. ( cPWord == "function" .OR. cPWord == "procedure" ) + hbide_removeStartingSpaces( qCursor, nCPrevPrev ) + hbide_appendFunction( qCursor, ::nTabSpaces, ::oINI:lISLocal, ::oINI:lISReturn, ::oINI:lISSeparator, ::oINI:lReturnAsBeginKeyword, ::cSeparator ) + + ELSEIF Empty( cPPWord ) .AND. ( cPWord == "function" .OR. cPWord == "procedure" ) + hbide_appendFunction( qCursor, ::nTabSpaces, ::oINI:lISLocal, ::oINI:lISReturn, ::oINI:lISSeparator, ::oINI:lReturnAsBeginKeyword, ::cSeparator ) + + ELSEIF Lower( cPPWord ) == "create" .AND. cPWord == "class" + hbide_removeStartingSpaces( qCursor, nCPrevPrev ) + ENDIF ENDIF @@ -2378,7 +2390,6 @@ METHOD IdeEdit:reformatLine( nPos, nDeleted, nAdded ) ENDIF qCursor:endEditBlock() - HB_SYMBOL_UNUSED( nCPrevPrev ) ENDIF ::handleCurrentIndent() @@ -2401,6 +2412,18 @@ METHOD IdeEdit:reformatLine( nPos, nDeleted, nAdded ) /*----------------------------------------------------------------------*/ +STATIC FUNCTION hbide_removeStartingSpaces( qCursor, nCPrevPrev ) + LOCAL nPostn := qCursor:position() + + qCursor:movePosition( QTextCursor_StartOfBlock ) + qCursor:movePosition( QTextCursor_NextWord, QTextCursor_KeepAnchor ) + qCursor:removeSelectedText() + qCursor:setPosition( nPostn - nCPrevPrev ) + + RETURN NIL + +/*----------------------------------------------------------------------*/ + STATIC FUNCTION hbide_alignToPrevWord( qCursor, cWord, cEWord, nLenCWord, nPostn ) LOCAL cFWord, nCol, nInner := 0 LOCAL lFound := .F. @@ -2445,6 +2468,32 @@ STATIC FUNCTION hbide_replaceWord( qCursor, nWord, cWord, nPostn ) /*----------------------------------------------------------------------*/ +STATIC FUNCTION hbide_appendFunction( qCursor, nTabSpaces, lLocal, lReturn, lSeparator, lReturnAsBeginKeyword, cSeparator ) + LOCAL nPostn := qCursor:position() + + qCursor:movePosition( QTextCursor_EndOfBlock ) + IF lLocal + qCursor:insertBlock() + qCursor:insertText( Space( nTabSpaces ) + "LOCAL " ) + qCursor:insertBlock() + ENDIF + IF lReturn + qCursor:insertBlock() + qCursor:insertText( Space( iif( lReturnAsBeginKeyword, 0, nTabSpaces ) ) + "RETURN " ) + qCursor:insertBlock() + IF lSeparator + qCursor:insertBlock() + qCursor:insertText( cSeparator ) + qCursor:insertBlock() + ENDIF + ENDIF + qCursor:insertBlock() + qCursor:setPosition( nPostn ) + + RETURN NIL + +/*----------------------------------------------------------------------*/ + STATIC FUNCTION hbide_appendCase( qCursor, nIndent, nCurPos, nCases, lOWise ) LOCAL i @@ -3039,19 +3088,21 @@ FUNCTION hbide_isMinimumIndentableKeyword( cWord, oIde ) IF empty( s_b_ ) IF ! oIde:oINI:lReturnAsBeginKeyword s_b_ := { ; - 'local' => NIL,; - 'private' => NIL,; - 'public' => NIL,; - 'static' => NIL,; - 'default' => NIL,; - 'return' => NIL } + 'local' => NIL,; + 'private' => NIL,; + 'public' => NIL,; + 'static' => NIL,; + 'endclass' => NIL,; + 'default' => NIL,; + 'return' => NIL } ELSE s_b_ := { ; - 'local' => NIL,; - 'private' => NIL,; - 'public' => NIL,; - 'static' => NIL,; - 'default' => NIL } + 'local' => NIL,; + 'private' => NIL,; + 'public' => NIL,; + 'static' => NIL,; + 'endclass' => NIL,; + 'default' => NIL } ENDIF ENDIF @@ -3071,7 +3122,6 @@ FUNCTION hbide_isIndentableKeyword( cWord, oIde ) 'while' => NIL,; 'switch' => NIL,; 'for' => NIL,; - 'next' => NIL,; 'begin' => NIL,; 'sequence' => NIL,; 'try' => NIL,; diff --git a/harbour/contrib/hbide/saveload.prg b/harbour/contrib/hbide/saveload.prg index 66216dc811..56e5dfa513 100644 --- a/harbour/contrib/hbide/saveload.prg +++ b/harbour/contrib/hbide/saveload.prg @@ -259,6 +259,10 @@ CLASS IdeINI INHERIT IdeObject DATA lISAlignAssign INIT .F. DATA lISFmtLine INIT .F. DATA lISEmbrace INIT .F. + DATA lISLocal INIT .T. + DATA lISReturn INIT .T. + DATA lISSeparator INIT .T. + DATA lISDocs INIT .F. METHOD new( oIde ) METHOD create( oIde ) @@ -515,6 +519,10 @@ METHOD IdeINI:save( cHbideIni ) aadd( txt_, "ISAlignAssign" + "=" + iif( ::lISAlignAssign , "YES", "NO" ) ) AAdd( txt_, "ISFmtLine" + "=" + iif( ::lISFmtLine , "YES", "NO" ) ) AAdd( txt_, "ISEmbrace" + "=" + iif( ::lISEmbrace , "YES", "NO" ) ) + AAdd( txt_, "ISLocal" + "=" + iif( ::lISLocal , "YES", "NO" ) ) + AAdd( txt_, "ISReturn" + "=" + iif( ::lISReturn , "YES", "NO" ) ) + AAdd( txt_, "ISSeparator" + "=" + iif( ::lISSeparator , "YES", "NO" ) ) + AAdd( txt_, "ISDocs" + "=" + iif( ::lISDocs , "YES", "NO" ) ) aadd( txt_, "" ) aadd( txt_, "[PROJECTS]" ) @@ -868,6 +876,10 @@ METHOD IdeINI:load( cHbideIni ) CASE "ISAlignAssign" ; ::lISAlignAssign := !( cVal == "NO" ) ; EXIT CASE "ISFmtLine" ; ::lISFmtLine := !( cVal == "NO" ) ; EXIT CASE "ISEmbrace" ; ::lISEmbrace := !( cVal == "NO" ) ; EXIT + CASE "ISLocal" ; ::lISLocal := !( cVal == "NO" ) ; EXIT + CASE "ISReturn" ; ::lISReturn := !( cVal == "NO" ) ; EXIT + CASE "ISSeparator" ; ::lISSeparator := !( cVal == "NO" ) ; EXIT + CASE "ISDocs" ; ::lISDocs := !( cVal == "NO" ) ; EXIT ENDSWITCH ENDIF @@ -1197,7 +1209,6 @@ CLASS IdeSetup INHERIT IdeObject DATA aStyles INIT { "cleanlooks", "windows", "windowsxp", ; "windowsvista", "cde", "motif", "plastique", "macintosh" } DATA aKeyItems INIT {} - DATA aDictionaries INIT {} DATA nCurThemeSlot INIT 0 DATA aHilighters INIT {} @@ -1252,16 +1263,6 @@ METHOD IdeSetup:destroy() ::oUI:destroy() ENDIF - ::oINI := NIL - ::qOrgPalette := NIL - ::aItems := NIL - ::aTree := NIL - ::aStyles := NIL - ::aKeyItems := NIL - ::aDictionaries := NIL - ::nCurThemeSlot := NIL - ::aHilighters := NIL - RETURN Self /*----------------------------------------------------------------------*/ @@ -1533,6 +1534,10 @@ METHOD IdeSetup:retrieve() ::oINI:lISAlignAssign := ::oUI:chkISAlignAssign : isChecked() ::oINI:lISFmtLine := ::oUI:chkISFmtLine : isChecked() ::oINI:lISEmbrace := ::oUI:ChkISEmbrace : isChecked() + ::oINI:lISLocal := ::oUI:ChkISLocal : isChecked() + ::oINI:lISReturn := ::oUI:ChkISReturn : isChecked() + ::oINI:lISSeparator := ::oUI:ChkISSeparator : isChecked() + ::oINI:lISDocs := ::oUI:ChkISDocs : isChecked() RETURN Self @@ -1653,6 +1658,10 @@ METHOD IdeSetup:populate() ::oUI:chkISAlignAssign : setChecked( ::oINI:lISAlignAssign ) ::oUI:chkISFmtLine : setChecked( ::oINI:lISFmtLine ) ::oUI:chkISEmbrace : setChecked( ::oINI:lISEmbrace ) + ::oUI:chkISLocal : setChecked( ::oINI:lISLocal ) + ::oUI:chkISReturn : setChecked( ::oINI:lISReturn ) + ::oUI:chkISSeparator : setChecked( ::oINI:lISSeparator ) + ::oUI:chkISDocs : setChecked( ::oINI:lISDocs ) ::connectSlots() diff --git a/harbour/contrib/hbide/setup.ui b/harbour/contrib/hbide/setup.ui index f08858d8aa..8f790bbb0d 100644 --- a/harbour/contrib/hbide/setup.ui +++ b/harbour/contrib/hbide/setup.ui @@ -475,7 +475,7 @@ - Closing Statements + CLOSING STATEMENTS true @@ -628,7 +628,7 @@ 116 100 - 29 + 33 21 @@ -652,7 +652,7 @@ - 236 + 240 24 93 18 @@ -667,13 +667,13 @@ 8 - 136 + 188 333 41 - Function Calls + FUNCTION CALL false @@ -709,21 +709,21 @@ 8 - 180 - 329 - 177 + 232 + 333 + 125 - General + GENERAL 8 - 16 - 185 - 18 + 20 + 205 + 16 @@ -734,8 +734,8 @@ 8 - 36 - 177 + 40 + 205 18 @@ -747,7 +747,7 @@ 8 - 152 + 100 205 18 @@ -760,7 +760,7 @@ 8 - 56 + 60 205 18 @@ -770,6 +770,71 @@ + + + + 8 + 136 + 333 + 49 + + + + FUNCTION / PROCEDURE DECLARATION + + + + + 8 + 20 + 61 + 17 + + + + LOCAL + + + + + + 80 + 20 + 70 + 17 + + + + RETURN + + + + + + 156 + 20 + 89 + 17 + + + + SEPERATOR + + + + + + 240 + 20 + 89 + 17 + + + + Documentation + + + @@ -1887,6 +1952,10 @@ ... + + + :/resources/projectadd.png:/resources/projectadd.png + @@ -1939,7 +2008,7 @@ To Upper - + 226 @@ -1957,7 +2026,7 @@ 8 12 - 63 + 45 19 @@ -2183,7 +2252,7 @@ Background - + 88 @@ -2196,7 +2265,7 @@ ... - + 88 @@ -3581,6 +3650,8 @@ - + + + diff --git a/harbour/contrib/hbide/themes.prg b/harbour/contrib/hbide/themes.prg index 498e37f4d4..06760792c6 100644 --- a/harbour/contrib/hbide/themes.prg +++ b/harbour/contrib/hbide/themes.prg @@ -93,7 +93,7 @@ CLASS IdeThemes INHERIT IdeObject VAR lDefault INIT .t. - VAR cThemesFile INIT "" + VAR cThemesFile INIT "" VAR aIni INIT {} VAR aThemes INIT {} @@ -527,6 +527,7 @@ METHOD IdeThemes:mergeUserDictionaries( qHiliter, cTheme ) //qRegExp:setCaseSensitivity( oDict:lCaseSensitive ) qRegExp:setPattern( s ) + /* Must be blended WITH dictionary definition attributes */ aAttr := ::getThemeAttribute( "UserDictionary", cTheme ) // cName after slots are implemented qFormat := QTextCharFormat()