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: <Setup><HbIDE Setup><Intelli-sense><Function Declaration>
       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
This commit is contained in:
Pritpal Bedi
2012-08-13 16:41:42 +00:00
parent f37275a6bd
commit 95c834188a
6 changed files with 235 additions and 68 deletions

View File

@@ -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: <Setup><HbIDE Setup><Intelli-sense><Function Declaration>
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

View File

@@ -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
/*----------------------------------------------------------------------*/

View File

@@ -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,;

View File

@@ -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()

View File

@@ -475,7 +475,7 @@
</rect>
</property>
<property name="title">
<string>Closing Statements</string>
<string>CLOSING STATEMENTS</string>
</property>
<property name="checkable">
<bool>true</bool>
@@ -628,7 +628,7 @@
<rect>
<x>116</x>
<y>100</y>
<width>29</width>
<width>33</width>
<height>21</height>
</rect>
</property>
@@ -652,7 +652,7 @@
<widget class="QCheckBox" name="chkISEmbrace">
<property name="geometry">
<rect>
<x>236</x>
<x>240</x>
<y>24</y>
<width>93</width>
<height>18</height>
@@ -667,13 +667,13 @@
<property name="geometry">
<rect>
<x>8</x>
<y>136</y>
<y>188</y>
<width>333</width>
<height>41</height>
</rect>
</property>
<property name="title">
<string>Function Calls</string>
<string>FUNCTION CALL</string>
</property>
<property name="checkable">
<bool>false</bool>
@@ -709,21 +709,21 @@
<property name="geometry">
<rect>
<x>8</x>
<y>180</y>
<width>329</width>
<height>177</height>
<y>232</y>
<width>333</width>
<height>125</height>
</rect>
</property>
<property name="title">
<string>General</string>
<string>GENERAL</string>
</property>
<widget class="QCheckBox" name="chkISCodeBlock">
<property name="geometry">
<rect>
<x>8</x>
<y>16</y>
<width>185</width>
<height>18</height>
<y>20</y>
<width>205</width>
<height>16</height>
</rect>
</property>
<property name="text">
@@ -734,8 +734,8 @@
<property name="geometry">
<rect>
<x>8</x>
<y>36</y>
<width>177</width>
<y>40</y>
<width>205</width>
<height>18</height>
</rect>
</property>
@@ -747,7 +747,7 @@
<property name="geometry">
<rect>
<x>8</x>
<y>152</y>
<y>100</y>
<width>205</width>
<height>18</height>
</rect>
@@ -760,7 +760,7 @@
<property name="geometry">
<rect>
<x>8</x>
<y>56</y>
<y>60</y>
<width>205</width>
<height>18</height>
</rect>
@@ -770,6 +770,71 @@
</property>
</widget>
</widget>
<widget class="QGroupBox" name="groupBox_28">
<property name="geometry">
<rect>
<x>8</x>
<y>136</y>
<width>333</width>
<height>49</height>
</rect>
</property>
<property name="title">
<string>FUNCTION / PROCEDURE DECLARATION</string>
</property>
<widget class="QCheckBox" name="chkISLocal">
<property name="geometry">
<rect>
<x>8</x>
<y>20</y>
<width>61</width>
<height>17</height>
</rect>
</property>
<property name="text">
<string>LOCAL </string>
</property>
</widget>
<widget class="QCheckBox" name="chkISReturn">
<property name="geometry">
<rect>
<x>80</x>
<y>20</y>
<width>70</width>
<height>17</height>
</rect>
</property>
<property name="text">
<string>RETURN</string>
</property>
</widget>
<widget class="QCheckBox" name="chkISSeparator">
<property name="geometry">
<rect>
<x>156</x>
<y>20</y>
<width>89</width>
<height>17</height>
</rect>
</property>
<property name="text">
<string>SEPERATOR</string>
</property>
</widget>
<widget class="QCheckBox" name="chkISDocs">
<property name="geometry">
<rect>
<x>240</x>
<y>20</y>
<width>89</width>
<height>17</height>
</rect>
</property>
<property name="text">
<string>Documentation</string>
</property>
</widget>
</widget>
</widget>
</widget>
<widget class="QWidget" name="pageSelections">
@@ -1887,6 +1952,10 @@
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="hbide.qrc">
<normaloff>:/resources/projectadd.png</normaloff>:/resources/projectadd.png</iconset>
</property>
</widget>
<widget class="QCheckBox" name="checkDictActive">
<property name="geometry">
@@ -1939,7 +2008,7 @@
<string>To Upper</string>
</property>
</widget>
<widget class="QRadioButton" name="radioButton_7">
<widget class="QRadioButton" name="radioDictAsIn">
<property name="geometry">
<rect>
<x>226</x>
@@ -1957,7 +2026,7 @@
<rect>
<x>8</x>
<y>12</y>
<width>63</width>
<width>45</width>
<height>19</height>
</rect>
</property>
@@ -2183,7 +2252,7 @@
<string>Background</string>
</property>
</widget>
<widget class="QToolButton" name="buttonDictColorText">
<widget class="QToolButton" name="btnDictColorText">
<property name="geometry">
<rect>
<x>88</x>
@@ -2196,7 +2265,7 @@
<string>...</string>
</property>
</widget>
<widget class="QToolButton" name="buttonDictColorBack">
<widget class="QToolButton" name="btnDictColorBack">
<property name="geometry">
<rect>
<x>88</x>
@@ -3581,6 +3650,8 @@
</property>
</widget>
</widget>
<resources/>
<resources>
<include location="hbide.qrc"/>
</resources>
<connections/>
</ui>

View File

@@ -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()