Skip to content

Commit

Permalink
Added Mixed Case keyword option
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulSquires committed Jul 16, 2017
1 parent dbbb824 commit a0d7452
Show file tree
Hide file tree
Showing 18 changed files with 75 additions and 18 deletions.
Binary file modified Languages/deutsch.lang
Binary file not shown.
Binary file modified Languages/english.lang
Binary file not shown.
Binary file modified Languages/español.lang
Binary file not shown.
Binary file modified Languages/russian.lang
Binary file not shown.
Binary file modified Languages/ukrainian.lang
Binary file not shown.
Binary file modified WinFBE.wfbe
Binary file not shown.
Binary file modified WinFBE32.exe
Binary file not shown.
Binary file modified WinFBE64.exe
Binary file not shown.
8 changes: 8 additions & 0 deletions changes.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
Version 1.3.5 (July 15, 2017)
- Added: Mixed Case keyword option in "Environment Options | Code Editor".

Version 1.3.4 (July 13, 2017)
- Added: User can embed '#CONSOLE ON|OFF compiler directive directly in main file source code.
- Added: Compile log checks for "ERROR" and "COMPILING C FAILED".
- Changed: Comment Blocking no longer comments blank lines.

Version 1.3.3 (May 14, 2017)
- Updated unicode file buffer handling.

Expand Down
2 changes: 1 addition & 1 deletion src/WinFBE.bas
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Using Afx

#Define APPNAME WStr("WinFBE - FreeBASIC Editor")
#Define APPNAMESHORT WStr("WinFBE")
#Define APPVERSION WStr("1.3.3")
#Define APPVERSION WStr("1.3.5")


#Include Once "modScintilla.bi"
Expand Down
39 changes: 30 additions & 9 deletions src/clsDocument.inc
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,9 @@ Function clsDocument.BlockComment( ByVal flagBlock As BOOLEAN ) As Long
strText = Iif(Len(strText) > 1, Mid(strText, 2), " ")
End If
Else
strText = "'" & strText
If Len(strText) Then
strText = "'" & strText
end if
End If
If Len(strText) Then
nPos = SciMsg( m_pSci, SCI_POSITIONFROMLINE, i, 0) ' starting position of the line
Expand Down Expand Up @@ -965,7 +967,8 @@ Function clsDocument.ApplyProperties() As Long
Select Case gConfig.KeywordCase
Case 0: nFontCase = SC_CASE_LOWER
Case 1: nFontCase = SC_CASE_UPPER
Case 2: nFontCase = SC_CASE_MIXED
Case 2: nFontCase = SC_CASE_CAMEL
Case 3: nFontCase = SC_CASE_MIXED ' original case
End Select
If m_pSci = 0 Then Exit Function
Expand Down Expand Up @@ -1315,16 +1318,34 @@ Function clsDocument.LineDuplicate() As Long
End Function
''
''
function clsDocument.CompileDirectives( byval pDirectives as COMPILE_DIRECTIVES ptr) as Long
' Search the source code for any user embedded compiler directives.
Dim i As Long
Dim nLines As Long
dim st as String
nLines = SciMsg( m_pSci, SCI_GETLINECOUNT, 0, 0)
For i = 0 To nLines
st = ltrim(this.GetLine(i))
if left(st, 1) <> "'" THEN continue for
st = ltrim(mid(st, 2))
if len(st) < 11 THEN continue for
st = ucase(st)
' '#CONSOLE ON|OFF
if left(st, 11) = "#CONSOLE ON" THEN
pDirectives->ConsoleFlag = true
elseif left(st, 12) = "#CONSOLE OFF" THEN
pDirectives->ConsoleFlag = false
END IF
Next
function = 0
END FUNCTION
Expand Down
1 change: 1 addition & 0 deletions src/frmMain.inc
Original file line number Diff line number Diff line change
Expand Up @@ -678,6 +678,7 @@ Function frmMain_OpenFileSafely( ByVal HWnd As HWnd, _
idx = gApp.GetActiveProjectIndex()
pDoc = gApp.Projects(idx).GetDocumentPtrByFilename(pwszName)
if pDoc then pDocIn = pDoc
If pDocIn = 0 Then ' Create a new pDoc
Expand Down
5 changes: 1 addition & 4 deletions src/frmOptionsEditor.inc
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,6 @@ Function frmOptionsEditor_Show( ByVal hWndParent As HWnd, _
pWindow->AddControl("CHECKBOX", , IDC_FRMOPTIONSEDITOR_CHKINDENTGUIDES, L(125,"Show Indentation guides"), 0, 210, 400, 20, _
WS_CHILD Or WS_VISIBLE Or WS_TABSTOP Or BS_TEXT Or BS_NOTIFY Or BS_AUTOCHECKBOX Or BS_LEFT Or BS_VCENTER, _
WS_EX_LEFT Or WS_EX_LTRREADING)
'pWindow->AddControl("CHECKBOX", , IDC_FRMOPTIONSEDITOR_CHKUNICODE, L(246,"Enable unicode (UTF-8 encoding)"), 0, 231, 400, 20, _
' WS_CHILD Or WS_VISIBLE Or WS_TABSTOP Or BS_TEXT Or BS_NOTIFY Or BS_AUTOCHECKBOX Or BS_LEFT Or BS_VCENTER, _
' WS_EX_LEFT Or WS_EX_LTRREADING)
pWindow->AddControl("TEXTBOX", , IDC_FRMOPTIONSEDITOR_TXTTABSIZE, "", 0, 320, 30, 20, _
WS_CHILD Or WS_VISIBLE Or WS_TABSTOP Or ES_LEFT Or ES_AUTOHSCROLL Or ES_NUMBER, _
WS_EX_CLIENTEDGE Or WS_EX_LEFT Or WS_EX_LTRREADING Or WS_EX_RIGHTSCROLLBAR)
Expand Down Expand Up @@ -113,10 +110,10 @@ Function frmOptionsEditor_Show( ByVal hWndParent As HWnd, _

ComboBox_AddString( GetDlgItem( HWnd, IDC_FRMOPTIONSEDITOR_COMBOCASE), @L(130,"Lower Case") )
ComboBox_AddString( GetDlgItem( HWnd, IDC_FRMOPTIONSEDITOR_COMBOCASE), @L(131,"Upper Case") )
ComboBox_AddString( GetDlgItem( HWnd, IDC_FRMOPTIONSEDITOR_COMBOCASE), @L(272,"Mixed Case") )
ComboBox_AddString( GetDlgItem( HWnd, IDC_FRMOPTIONSEDITOR_COMBOCASE), @L(132,"Original Case") )
ComboBox_SetCurSel( GetDlgItem( HWnd, IDC_FRMOPTIONSEDITOR_COMBOCASE), gConfig.KeywordCase )


Function = 0

End Function
Expand Down
25 changes: 23 additions & 2 deletions src/modCompile.inc
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ Type COMPILE_TYPE
End Type
Dim Shared gCompile As COMPILE_TYPE


''
'' Set the statusbar text and icon for a good/bad compile
'------------------------------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -199,6 +200,16 @@ Function code_Compile( ByVal wID As Long ) As BOOLEAN
Case "CONSOLE": gCompile.CompileMode = wstr(" -s console ")
End Select
' Search main source code for any user embedded compile directives. These will override
' anything that was set at the default or project level.
dim directives as COMPILE_DIRECTIVES
pDocMain->CompileDirectives(@directives)
if directives.ConsoleFlag THEN
gCompile.CompileMode = wstr(" -s console ")
else
gCompile.CompileMode = wstr(" -s gui ")
END IF
' Need to test if the resulting application to be compiled is actually running
' in memory. This would cause the compile to fail.
Expand Down Expand Up @@ -407,14 +418,24 @@ Function code_Compile( ByVal wID As Long ) As BOOLEAN
' Could Not Open source file (p.RC)
' OBJ file Not made
' compiling resource FAILED: Error Code 1
' Check to see if linking failed
If (Left(**wst_ucase, 6) = WSTR("ERROR!")) Then
FF_ListView_InsertItem( hLV, NumWarnings, 0, WStr("0") )
FF_ListView_InsertItem( hLV, NumWarnings, 1, WStr("") )
FF_ListView_InsertItem( hLV, NumWarnings, 2, WStr("compiling resource FAILED: Error Code 1") )
NumErrors = NumErrors + 1
End If
elseIf (Left(**wst_ucase, 5) = WSTR("ERROR")) Then
FF_ListView_InsertItem( hLV, NumWarnings, 0, WStr("0") )
FF_ListView_InsertItem( hLV, NumWarnings, 1, WStr("") )
FF_ListView_InsertItem( hLV, NumWarnings, 2, WStr("compiling FAILED: Error Code 1") )
NumErrors = NumErrors + 1
elseIf (Left(**wst_ucase, 19) = WSTR("COMPILING C FAILED:")) Then
FF_ListView_InsertItem( hLV, NumWarnings, 0, WStr("0") )
FF_ListView_InsertItem( hLV, NumWarnings, 1, WStr("") )
FF_ListView_InsertItem( hLV, NumWarnings, 2, WStr("compiling C FAILED: Error Code 1") )
NumErrors = NumErrors + 1
end if
If Instr(**wst_ucase, WSTR("LINKING FAILED:")) Then
FF_ListView_InsertItem( hLV, NumWarnings, 0, WStr("0") )
Expand Down
2 changes: 1 addition & 1 deletion src/modDB.inc
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ function clsDBEngine.dbDelete( byref Diskfilename as string ) as long
dim nCount as long
for i as long = lbound(m_arrData) to ubound(m_arrData)
if m_arrData(i).deleted = true then continue for
if _stricmp(m_arrData(i).diskFilename, DiskFilename) = 0 THEN
if ucase(m_arrData(i).diskFilename) = ucase(DiskFilename) THEN
m_arrData(i).deleted = true
nCount = nCount + 1
END IF
Expand Down
9 changes: 9 additions & 0 deletions src/modDeclares.bi
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,14 @@ Dim Shared gFind As FINDREPLACE_TYPE
Dim Shared gFindInFiles As FINDREPLACE_TYPE


' Structure that holds all of the user embedded compiler directives
' in the source code. Currently, only the main source file is searched
' for the '#CONSOLE ON|OFF directive but others can be added as needed.
type COMPILE_DIRECTIVES
ConsoleFlag as Boolean ' True:CONSOLE ON, False:CONSOLE OFF
END TYPE


' Forward reference
Type clsDocument_ As clsDocument

Expand Down Expand Up @@ -375,6 +383,7 @@ Type clsDocument
declare Function HasMarkerHighlight() As BOOLEAN
declare Function FirstMarkerHighlight() As long
declare Function LastMarkerHighlight() As long
declare function CompileDirectives( byval pDirectives as COMPILE_DIRECTIVES ptr) as Long
Declare Constructor
Declare Destructor
End Type
Expand Down
1 change: 0 additions & 1 deletion src/modParser.inc
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ Function ParseDocument( byval idx as long, _ ' project index
' Before starting to parse this document we must remove any previously saved
' data that exists in gdb database for this file.
gdb.dbDelete(sFilename)
gdb.dbAdd(sFilename, idx, DB_FILENAME_PARSE, 0, "", "")
Expand Down
1 change: 1 addition & 0 deletions src/modScintilla.bi
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ Dim Shared SciMsg As Scintilla_DirectFunction
#Define SC_CASE_MIXED 0
#Define SC_CASE_UPPER 1
#Define SC_CASE_LOWER 2
#Define SC_CASE_CAMEL 3
#Define SCI_STYLEGETFORE 2481
#Define SCI_STYLEGETBACK 2482
#Define SCI_STYLEGETBOLD 2483
Expand Down

0 comments on commit a0d7452

Please sign in to comment.