Skip to content

Commit

Permalink
Version 1.3.2 release
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulSquires committed May 4, 2017
1 parent de74cda commit b9e31f6
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 49 deletions.
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.
2 changes: 1 addition & 1 deletion changes.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Version 1.3.2 (Not released yet)
Version 1.3.2 (May 4, 2017)
- Fixed: Find dialog was not showing number of matches when word highlighted in code editor and then Find dialog displayed.
- Fixed: Repaint issue with Find/Replace dialog.
- Fixed: Newly added subs/functions not being added to Function List when file was saved.
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.1")
#Define APPVERSION WStr("1.3.2")


#Include Once "modScintilla.bi"
Expand Down
9 changes: 0 additions & 9 deletions src/clsDocument.inc
Original file line number Diff line number Diff line change
Expand Up @@ -245,15 +245,6 @@ Function clsDocument.SaveFile( ByVal bSaveAs As BOOLEAN = False ) As BOOLEAN
put #f, , Utf8ToAscii(*psz)
end if
case FILE_ENCODING_UTF8
if sciCodePage = SC_CP_UTF8 THEN
' no conversion necessary
put #f, , *psz
else
' need to convert
put #f, , AnsiToUtf8(*psz)
end if
case FILE_ENCODING_UTF8_BOM
' Output the BOM first
put #f, , chr(&HEF, &HBB, &HBF)
Expand Down
8 changes: 1 addition & 7 deletions src/frmMain.inc
Original file line number Diff line number Diff line change
Expand Up @@ -1088,10 +1088,6 @@ Function frmMain_OnCommand(ByVal HWnd As HWnd, ByVal id As Long, ByVal hwndCtl A
if pDoc->FileEncoding <> FILE_ENCODING_ANSI THEN pDoc->UserModified = true
pDoc->FileEncoding = FILE_ENCODING_ANSI
frmMain_UpdateLineCol( HWND_FRMMAIN )
case IDM_UTF8
if pDoc->FileEncoding <> FILE_ENCODING_UTF8 THEN pDoc->UserModified = true
pDoc->FileEncoding = FILE_ENCODING_UTF8
frmMain_UpdateLineCol( HWND_FRMMAIN )
case IDM_UTF8BOM
if pDoc->FileEncoding <> FILE_ENCODING_UTF8_BOM THEN pDoc->UserModified = true
pDoc->FileEncoding = FILE_ENCODING_UTF8_BOM
Expand Down Expand Up @@ -1249,7 +1245,7 @@ Function frmMain_OnCommand(ByVal HWnd As HWnd, ByVal id As Long, ByVal hwndCtl A
vbcrlf & vbcrlf & _
"Paul Squires / PlanetSquires Software" & vbcrlf & vbcrlf & _
"Special thanks to:" & vbcrlf & _
"José Roca (Scintilla and CWindow)", _
"José Roca (Scintilla and CWindow)", _
@WStr("About"), _
MB_OK Or MB_ICONINFORMATION Or MB_DEFBUTTON1 Or MB_TASKMODAL )

Expand Down Expand Up @@ -1321,8 +1317,6 @@ Function frmMain_OnNotify(ByVal HWnd As HWnd, ByVal id As Long, ByVal pNMHDR As
dim pDoc as clsDocument ptr = gTTabCtl.GetActiveDocumentPtr
if pDoc = 0 THEN exit function
if pDoc->FileEncoding = FILE_ENCODING_ANSI then
pDoc->FileEncoding = FILE_ENCODING_UTF8
elseif pDoc->FileEncoding = FILE_ENCODING_UTF8 then
pDoc->FileEncoding = FILE_ENCODING_UTF8_BOM
elseif pDoc->FileEncoding = FILE_ENCODING_UTF8_BOM then
pDoc->FileEncoding = FILE_ENCODING_UTF16_BOM
Expand Down
7 changes: 3 additions & 4 deletions src/modDeclares.bi
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,8 @@ Const FILETYPE_RESOURCE = 4

' File encodings
const FILE_ENCODING_ANSI = 0
const FILE_ENCODING_UTF8 = 1
const FILE_ENCODING_UTF8_BOM = 2
const FILE_ENCODING_UTF16_BOM = 3
const FILE_ENCODING_UTF8_BOM = 1
const FILE_ENCODING_UTF16_BOM = 2


'' Menu message identifiers
Expand All @@ -218,7 +217,7 @@ Enum
IDM_MRU, IDM_OPENINCLUDE, IDM_COMMAND, IDM_EXIT
IDM_EDIT
IDM_UNDO, IDM_REDO, IDM_CUT, IDM_COPY, IDM_PASTE, IDM_DELETELINE, IDM_INSERTFILE
IDM_ANSI, IDM_UTF8, IDM_UTF8BOM, IDM_UTF16BOM
IDM_ANSI, IDM_UTF8BOM, IDM_UTF16BOM
IDM_INDENTBLOCK, IDM_UNINDENTBLOCK, IDM_COMMENTBLOCK, IDM_UNCOMMENTBLOCK
IDM_DUPLICATELINE, IDM_MOVELINEUP, IDM_MOVELINEDOWN, IDM_TOUPPERCASE, IDM_TOLOWERCASE
IDM_TOMIXEDCASE, IDM_EOLTOCRLF, IDM_EOLTOCR, IDM_EOLTOLF, IDM_SELECTALL, IDM_SELECTLINE
Expand Down
5 changes: 1 addition & 4 deletions src/modMenus.inc
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ Function frmMain_BuildMenu ( ByVal pWindow As CWindow Ptr ) As HMENU
hPopUpSubMenu = CreatePopupMenu
AppendMenu hPopUpMenu, MF_POPUP Or MF_ENABLED, Cast(UINT_PTR, hPopUpSubMenu), L(271,"File Encoding")
AppendMenu hPopUpSubMenu, MF_ENABLED or MFT_RADIOCHECK, IDM_ANSI, "ANSI"
AppendMenu hPopUpSubMenu, MF_ENABLED or MFT_RADIOCHECK, IDM_UTF8, "UTF-8"
AppendMenu hPopUpSubMenu, MF_ENABLED or MFT_RADIOCHECK, IDM_UTF8BOM, "UTF-8 (BOM)"
AppendMenu hPopUpSubMenu, MF_ENABLED or MFT_RADIOCHECK, IDM_UTF16BOM, "UTF-16 (BOM)"
hPopUpSubMenu = CreatePopupMenu
Expand Down Expand Up @@ -313,7 +312,7 @@ Function frmMain_ChangeTopMenuStates() As Long
If SendMessageW(hEdit, SCI_CANUNDO, 0, 0) = 0 Then
EnableMenuItem hMenu, IDM_UNDO, MF_GRAYED
End If
If SendMessage(hEdit, SCI_CANREDO, 0, 0) = 0 Then
EnableMenuItem hMenu, IDM_REDO, MF_GRAYED
End If
Expand All @@ -325,14 +324,12 @@ Function frmMain_ChangeTopMenuStates() As Long
' Check the File Encoding
select CASE pDoc->FileEncoding
case FILE_ENCODING_ANSI: nSelected = IDM_ANSI
case FILE_ENCODING_UTF8: nSelected = IDM_UTF8
case FILE_ENCODING_UTF8_BOM: nSelected = IDM_UTF8BOM
case FILE_ENCODING_UTF16_BOM: nSelected = IDM_UTF16BOM
CASE ELSE
END SELECT
CheckMenuRadioItem( hMenu, IDM_ANSI, IDM_UTF16BOM, nSelected, MF_BYCOMMAND )
EnableMenuItem hMenu, IDM_ANSI, MF_BYCOMMAND Or MF_ENABLED
EnableMenuItem hMenu, IDM_UTF8, MF_BYCOMMAND Or MF_ENABLED
EnableMenuItem hMenu, IDM_UTF8BOM, MF_BYCOMMAND Or MF_ENABLED
EnableMenuItem hMenu, IDM_UTF16BOM, MF_BYCOMMAND Or MF_ENABLED

Expand Down
35 changes: 12 additions & 23 deletions src/modRoutines.inc
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,6 @@ END FUNCTION
function FileEncodingTextDescription(byval FileEncoding as long) as CWSTR

select case FileEncoding
case FILE_ENCODING_UTF8: RETURN "UTF-8"
case FILE_ENCODING_UTF8_BOM: RETURN "UTF-8 (BOM)"
case FILE_ENCODING_UTF16_BOM: RETURN "UTF-16 (BOM)"
case else
Expand All @@ -259,51 +258,41 @@ end function
function GetFileToString( byref wszFilename as const wstring, byref txtBuffer as string, byval pDoc as clsDocument ptr) as boolean

' Load the entire file into a string
dim as string ansiStr
dim as long f = freefile
If Open( wszFilename for Binary Access Read As #f ) = 0 Then
If LOF(f) > 0 Then
ansiStr = String(LOF(f), 0)
Get #f, , ansiStr
txtBuffer = String(LOF(f), 0)
Get #f, , txtBuffer
End If
else
return true ' error opening file
end if
close #f

' Check for BOM signatures
if left(ansiStr, 3) = chr(&HEF, &HBB, &HBF) THEN
if left(txtBuffer, 3) = chr(&HEF, &HBB, &HBF) THEN
' UTF8 BOM encoded
pDoc->FileEncoding = FILE_ENCODING_UTF8_BOM
ansiStr = mid(ansiStr, 4) ' bypass the BOM
elseif left(ansiStr, 2) = chr(&HFF, &HFE) THEN
txtBuffer = mid(txtBuffer, 4) ' bypass the BOM
elseif left(txtBuffer, 2) = chr(&HFF, &HFE) THEN
' UTF16 BOM (little endian) encoded
pDoc->FileEncoding = FILE_ENCODING_UTF16_BOM
ansiStr = mid(ansiStr, 3) ' bypass the BOM
txtBuffer = mid(txtBuffer, 3) ' bypass the BOM
else
' Could be ANSI or UTF8(no BOM)
' Test the string to be ANSI by checking that BIT7 of each character is unset
dim as Boolean IsAnsi = true ' default that this is an ansi file
for i as long = 0 to len(ansiStr) - 1
if bit(ansiStr[i], 7) THEN
IsAnsi = false: exit for
END IF
NEXT
pDoc->FileEncoding = iif(IsAnsi, FILE_ENCODING_ANSI, FILE_ENCODING_UTF8)
pDoc->FileEncoding = FILE_ENCODING_ANSI
END IF

select case pDoc->FileEncoding
case FILE_ENCODING_ANSI
' No conversion needed. clsDocument ApplyProperties will not
' No conversion needed. clsDocument ApplyProperties will *not*
' set the editor to UTF8 code.
txtBuffer = ansiStr
case FILE_ENCODING_UTF8, FILE_ENCODING_UTF8_BOM
' No conversion needed.
txtBuffer = ansiStr
case FILE_ENCODING_UTF8_BOM
' No conversion needed. clsDocument ApplyProperties will set
' the editor to UTF8 code.
case FILE_ENCODING_UTF16_BOM
' Convert to UTF8 so it can display in the editor
' Need to pass a WSTRING pointer to the conversion function.
txtBuffer = UnicodeToUtf8( cast(WSTRING ptr, strptr(ansiStr)) )
txtBuffer = UnicodeToUtf8( cast(WSTRING ptr, strptr(txtBuffer)) )
END select

function = false
Expand Down

0 comments on commit b9e31f6

Please sign in to comment.