Skip to content

Commit

Permalink
Code changes 20200426
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulSquires committed Apr 26, 2020
1 parent 8ca960b commit 62968d1
Show file tree
Hide file tree
Showing 20 changed files with 150 additions and 51 deletions.
4 changes: 4 additions & 0 deletions Help/WinFBE/Visual Designer/Controls/Form.html
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,10 @@ <h3 id="during-form-creation">During form creation</h3>
<td>Shown</td>
<td>This event is only raised the first time a form is displayed; subsequently minimizing, maximizing, restoring, hiding, showing, or invalidating and repainting will not raise this event.</td>
</tr>
<tr class="odd">
<td>FormReady</td>
<td>This event is raised after all form and control creation is complete. It ensures that the form is a state that allows for user interaction.</td>
</tr>
</tbody>
</table>
<h3 id="during-form-destruction">During form destruction</h3>
Expand Down
1 change: 1 addition & 0 deletions Help/WinFBE/Visual Designer/Controls/Form.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ Form events in a specific order every time a form is created and shown.
| Load | The form handle and all child controls exist however the form and controls are not yet visible. Respond to this event to reposition controls or to add data to controls. For example, add rows to a Listbox or Combobox. |
| Activated | The form has gained input focus (similar to the GotFocus event of a control).|
| Shown | This event is only raised the first time a form is displayed; subsequently minimizing, maximizing, restoring, hiding, showing, or invalidating and repainting will not raise this event. |
| FormReady | This event is raised after all form and control creation is complete. It ensures that the form is a state that allows for user interaction. |

### During form destruction
| Name | Description |
Expand Down
12 changes: 12 additions & 0 deletions Help/WinFBE/Visual Designer/Controls/ListView.html
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,15 @@
<meta http-equiv='X-UA-Compatible' content='IE=edge' />
<meta http-equiv='MSThemeCompatible' content='Yes'>

<meta http-equiv='X-UA-Compatible' content='IE=edge' />
<meta http-equiv='MSThemeCompatible' content='Yes'>

<meta http-equiv='X-UA-Compatible' content='IE=edge' />
<meta http-equiv='MSThemeCompatible' content='Yes'>

<meta http-equiv='X-UA-Compatible' content='IE=edge' />
<meta http-equiv='MSThemeCompatible' content='Yes'>

<meta charset="utf-8" />
<meta name="generator" content="pandoc" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
Expand Down Expand Up @@ -782,6 +791,9 @@ <h5 id="wfxpoint">wfxPoint</h5>









Expand Down
Binary file modified Languages/deutsch.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.
15 changes: 15 additions & 0 deletions changes.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
Version 2.1.4 (April 26, 2020)
Editor:
- Changed: Updated David Robert's User Tools for SetCompilerPathsII, SetCompilerSwitchsII, and ArchSettings to the latest version.
- Fixed: WinFBE would not correctly save its startup size/position if the editor had been "Aero snapped" via a Windows docking action such as docking it to the left hand side of the screen via a Winkey+LeftArrow keypress.
- Fixed: Duplicate controls would result if reloading a Form file modified by an external program.

Visual Designer:
- Added: Keyboard shortcuts for cut/copy/paste now works for visual designer controls.
- Added: FormReady event for Forms that fires when the Form is ready for user interaction.
- Changed: Control ID identifiers for all controls on a Form now start at 9000 and increment +1 for each added control.
- Fixed: Controls with Image properties would not correctly show the actual image when the form is loaded into the editor.
- Fixed: Corrected regression whereby duplicate definition errors for Form file if it is also the MAIN code file.
- Fixed: Statusbar control identifier was hardcoded as 100 potentially causing conflict with CreateWindowEX controls that may be added by the user.
- Fixed: Stausbar Editor initially set colors needed a mouseover in order for the correct colors to display.

Version 2.1.3 (April 18, 2020)
Editor:
- Added: Character Autocompletion option (enabled by default) adapted from code located at: https://github.com/jacobslusser/ScintillaNET/wiki/Character-Autocompletion
Expand Down
2 changes: 1 addition & 1 deletion src/WinFBE.bas
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Using Afx

#Define APPNAME WStr("WinFBE - FreeBASIC Editor")
#Define APPNAMESHORT WStr("WinFBE")
#Define APPVERSION WStr("2.1.3")
#Define APPVERSION WStr("2.1.4")
#Define APPCOPYRIGHT WStr("Paul Squires, PlanetSquires Software, Copyright (C) 2016-2020")


Expand Down
2 changes: 1 addition & 1 deletion src/clsConfig.bi
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ enum
CLR_TEXT
CLR_WINDOW
CLR_BRACEGOOD
CLR_BRACEBAD
CLR_BRACEBAD '17
end enum

' Control types
Expand Down
34 changes: 32 additions & 2 deletions src/clsConfig.inc
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include once "frmMain.bi"
#include once "modVDColors.bi"
#include once "modVDDesignForm.bi"
#include once "modVDApplyProperties.bi"
#include once "modParser.bi"
Expand Down Expand Up @@ -1006,14 +1007,21 @@ Function clsConfig.SaveConfigFile() as Long
' Determine the current editor positioning
Dim WinPla As WINDOWPLACEMENT
WinPla.Length = Sizeof(WinPla)
GetWindowPlacement(HWND_FRMMAIN, @WinPla)
GetWindowPlacement( HWND_FRMMAIN, @WinPla )
With this
.StartupLeft = WinPla.rcNormalPosition.Left
.StartupTop = WinPla.rcNormalPosition.Top
.StartupRight = WinPla.rcNormalPosition.Right
.StartupBottom = WinPla.rcNormalPosition.Bottom
.StartupMaximized = Iif( WinPla.showCmd = SW_MAXIMIZE, True, False )
End With

dim as RECT rc
GetWindowRect( HWND_FRMMAIN, @rc )
if this.StartupLeft <> rc.Left then this.StartupLeft = rc.Left
if this.StartupTop <> rc.Top then this.StartupTop = rc.Top
if this.StartupRight <> rc.Right then this.StartupRight = rc.Right
if this.StartupBottom <> rc.Bottom then this.StartupBottom = rc.Bottom

dim pStream AS CTextStream '(utf16)
if pStream.Create(_ConfigFilename, true, true) <> S_OK then return true ' error
Expand Down Expand Up @@ -1275,7 +1283,7 @@ Function clsConfig.ImportTheme( byref st as wstring, _
theme.colors(CLR_BRACEGOOD).nFg = BGR(000,128,000) ' green
theme.colors(CLR_BRACEGOOD).nBg = -1
end if

if bImportExternal THEN
theme.id = AfxGuidText(AfxGuid())
i = ubound(this.ThemesTemp) + 1
Expand Down Expand Up @@ -2080,6 +2088,7 @@ Function clsConfig.ProjectLoadFromFile( byval wszFile as CWSTR ) As BOOLEAN
TreeView_SelectItem( hTree, pDoc->hNodeExplorer )
end if
SetWindowRedraw( hTree, true )
AfxRedrawWindow( hTree )
Expand Down Expand Up @@ -2111,6 +2120,27 @@ Function clsConfig.ProjectLoadFromFile( byval wszFile as CWSTR ) As BOOLEAN
frmOutput_ShowNotes
frmOutput_UpdateToDoListview

' Need to iterate the loaded forms that are currently visually active and
' re-apply properties because loadign of Image properties will fail until
' all the forms are loaded in the editor.
Dim As Long nCount = TabCtrl_GetItemCount(gTTabCtl.hWindow)
for i as long = 0 to nCount - 1
' Get the document pointer and then save file to disk
dim TB as TC_ITEM
TB.Mask = TCIF_PARAM
TabCtrl_GetItem( gTTabCtl.hWindow, i, @TB )
pDoc = Cast(clsDocument Ptr, TB.lParam)
if pDoc then
if pDoc->IsDesigner then
' Apply all control properties
for ii as long = pDoc->Controls.ItemFirst to pDoc->Controls.ItemLast
dim pCtrl as clsControl ptr = pDoc->Controls.ItemAt(ii)
if pCtrl then ApplyControlProperties(pDoc, pCtrl)
next
end if
end if
next
frmMain_PositionWindows
frmMain_SetFocusToCurrentCodeWindow
Expand Down
4 changes: 3 additions & 1 deletion src/frmExplorer.inc
Original file line number Diff line number Diff line change
Expand Up @@ -601,12 +601,14 @@ private Function frmExplorer_OnNotify( ByVal HWnd As HWnd, _
end if
end if


End Select

Function = 0
End Function



' ========================================================================================
' Process WM_PAINT message for window/dialog: frmExplorer
' ========================================================================================
Expand All @@ -625,7 +627,7 @@ private Function frmExplorer_OnPaint( ByVal HWnd As HWnd ) As LRESULT

SaveDC hDC

FillRect( hDC, @rc, GetSysColorBrush( COLOR_BTNFACE) )
FillRect( hDC, @rc, GetSysColorBrush(COLOR_BTNFACE) )

' Outline the right edge of dialog with a dull gray pen
hPen = CreatePen( PS_SOLID, 1, GetSysColor(COLOR_ACTIVEBORDER) )
Expand Down
66 changes: 48 additions & 18 deletions src/frmMain.inc
Original file line number Diff line number Diff line change
Expand Up @@ -1639,20 +1639,22 @@ private Function frmMain_OnCommand( ByVal HWnd As HWnd, _
if IsDesignerView(pDoc) then
dim pCtrl as clsControl ptr
dim rc as RECT
dim as long nLeft, nTop, nLeftActive, nTopActive
dim as long nLeft, nTop, nLeftActive = 99999, nTopActive = 99999
dim as long nCurLeft, nCurTop

' Need to get the Left/Top properties for the active control in the copy group
' Need to get the Left/Top properties for least top/left in the copy group
for i as long = lbound(gCopyControls) to ubound(gCopyControls)
if gCopyControls(i).IsActive THEN
nLeftActive = val(GetControlProperty(@gCopyControls(i), "LEFT"))
nTopActive = val(GetControlProperty(@gCopyControls(i), "TOP"))
exit for
END IF
nCurLeft = val(GetControlProperty(@gCopyControls(i), "LEFT"))
nCurTop = val(GetControlProperty(@gCopyControls(i), "TOP"))
if nCurLeft < nLeftActive then nLeftActive = nCurLeft
if nCurTop < nTopActive then nTopActive = nCurTop
exit for
next

' Create the control and copy the properties to it
for i as long = lbound(gCopyControls) to ubound(gCopyControls)
pCtrl = CreateToolboxControl(pDoc, gCopyControls(i).ControlType, rc)
gCopyControls(i).hWindow = pCtrl->hWindow

for ii as long = lbound(gCopyControls(i).Properties) to ubound(gCopyControls(i).Properties)
select case ucase(gCopyControls(i).Properties(ii).wszPropName)
Expand All @@ -1673,23 +1675,35 @@ private Function frmMain_OnCommand( ByVal HWnd As HWnd, _
' Set the left/top properties relative to the current insert position
dim pt as point
GetCursorPos(@pt)
' Map the point to the client area coordinates
MapWindowPoints(0, pDoc->hWndForm, cast(point ptr, @pt), 1)

' Ensure that the point is within the client area
dim rc as RECT
GetWindowRect(pDoc->hWndForm, @rc)
MapWindowPoints(0, pDoc->hWndForm, cast(point ptr, @rc), 2)
if PtInRect(@rc, pt) = 0 then
pt.x = 10: pt.y = 10
end if

Dim pWindow As CWindow Ptr = AfxCWindowPtr(HWND)
if pWindow then
pt.x = pWindow->UnScaleX(pt.x)
pt.y = pWindow->UnScaleY(pt.y)
end if
end if
SetControlProperty(pCtrl, "LEFT", str(pt.x + (nLeft-nLeftActive)))
SetControlProperty(pCtrl, "TOP", str(pt.y + (nTop-nTopActive)))
pCtrl->IsActive = false
pCtrl->IsSelected = false

pCtrl->SuspendLayout = true
ApplyControlProperties( pDoc, pCtrl )
pCtrl->SuspendLayout = false
NEXT
' Ensure the grab handles of form and controls are redrawn or hidden
pDoc->Controls.SetActiveControl(pDoc->hWndForm)

' Select all of the newly created controls
for i as long = lbound(gCopyControls) to ubound(gCopyControls)
pDoc->Controls.SelectControl( gCopyControls(i).hWindow )
next

pDoc->bRegenerateCode = true
pDoc->UserModified = true
AfxRedrawWindow(pDoc->hWndFrame)
Expand Down Expand Up @@ -2490,12 +2504,28 @@ private Function frmMain_OnActivateApp( ByVal HWnd As HWnd, _
pDoc->DiskFilename & vbCrLf & _
L(266, "File was changed by another application. Reload it?"), _
L(267, "File Changed"), MB_ICONQUESTION Or MB_YESNO) = IDYES Then
dim sText as string
if GetFileToString(pDoc->DiskFilename, sText, pDoc) = false then
pDoc->SetText( sText )
else
print "Error opening: "; pDoc->DiskFilename
End If

dim as CWSTR wszFilename = pDoc->DiskFilename
dim as long nFileType = pDoc->ProjectFileType

' Remove the current file and open the changed file.
frmMain_OnCommand(HWND_FRMMAIN, IDM_REMOVEFILEFROMPROJECT, 0, 0)

' Ensure that the file is open and displayed
dim as clsDocument ptr pDocLoad = _
frmMain_OpenFileSafely( HWND_FRMMAIN, _
False, _ ' bIsNewFile
False, _ ' bIsTemplate
True, _ ' bShowInTab
false, _ ' bIsInclude
wszFilename, _ ' wszName
0 ) ' pDocIn

pDocLoad->ProjectFileType = nFileType
pDocLoad->hNodeExplorer = frmExplorer_AddParentNode( pDocLoad )
frmExplorer_AddChildNodes( pDocLoad )
TreeView_SelectItem( GetDlgItem(HWND_FRMEXPLORER, IDC_FRMEXPLORER_TREE), pDocLoad->hNodeExplorer )

End If
End If
pDoc->DateFileTime = AfxGetFileLastWriteTime( pDoc->DiskFilename )
Expand Down
1 change: 1 addition & 0 deletions src/frmMenuEditor.inc
Original file line number Diff line number Diff line change
Expand Up @@ -658,6 +658,7 @@ public Function frmMenuEditor_Show( ByVal hWndParent As HWnd ) as LRESULT
ComboBox_AddString(hCtrl, @wstr("Space"))
ComboBox_AddString(hCtrl, @wstr("Plus"))
ComboBox_AddString(hCtrl, @wstr("Minus"))
ComboBox_AddString(hCtrl, @wstr("Enter"))
ComboBox_SetCurSel(hCtrl, 0)
Expand Down
12 changes: 4 additions & 8 deletions src/frmStatusBarEditor.inc
Original file line number Diff line number Diff line change
Expand Up @@ -234,31 +234,27 @@ private function frmStatusBarEditor_SetTextboxes() as long

hCtrl = GetDlgItem(HWND_FRMSTATUSBAREDITOR, IDC_FRMSTATUSBAREDITOR_COMBOBACKCOLOR)
if nCurSel <> -1 then wszText = gPanelItems(nCurSel).wszBackColor else wszText = ""
'nIndex = ComboBox_FindStringExact( hCtrl, -1, @wszText )
'ComboBox_SetCurSel( hCtrl, nIndex)
AfxSetWindowText( hCtrl, wszText )
EnableWindow( hCtrl, fEnabled)
AfxRedrawWindow(hCtrl)

hCtrl = GetDlgItem(HWND_FRMSTATUSBAREDITOR, IDC_FRMSTATUSBAREDITOR_COMBOFORECOLOR)
if nCurSel <> -1 then wszText = gPanelItems(nCurSel).wszForeColor else wszText = ""
'nIndex = ComboBox_FindStringExact( hCtrl, -1, @wszText )
'ComboBox_SetCurSel( hCtrl, nIndex)
AfxSetWindowText( hCtrl, wszText )
EnableWindow( hCtrl, fEnabled)
AfxRedrawWindow(hCtrl)

hCtrl = GetDlgItem(HWND_FRMSTATUSBAREDITOR, IDC_FRMSTATUSBAREDITOR_COMBOBACKCOLORHOT)
if nCurSel <> -1 then wszText = gPanelItems(nCurSel).wszBackColorHot else wszText = ""
'nIndex = ComboBox_FindStringExact( hCtrl, -1, @wszText )
'ComboBox_SetCurSel( hCtrl, nIndex)
AfxSetWindowText( hCtrl, wszText )
EnableWindow( hCtrl, fEnabled)
AfxRedrawWindow(hCtrl)

hCtrl = GetDlgItem(HWND_FRMSTATUSBAREDITOR, IDC_FRMSTATUSBAREDITOR_COMBOFORECOLORHOT)
if nCurSel <> -1 then wszText = gPanelItems(nCurSel).wszForeColorHot else wszText = ""
'nIndex = ComboBox_FindStringExact( hCtrl, -1, @wszText )
'ComboBox_SetCurSel( hCtrl, nIndex)
AfxSetWindowText( hCtrl, wszText )
EnableWindow( hCtrl, fEnabled)
AfxRedrawWindow(hCtrl)

function = 0
end function
Expand Down
10 changes: 6 additions & 4 deletions src/modCompile.inc
Original file line number Diff line number Diff line change
Expand Up @@ -1277,7 +1277,7 @@ public Function code_Compile( ByVal wID As Long ) As BOOLEAN
dim as CWSTR wszLookFor, wszAllTYPEs, wszAllEvents
pDoc = gApp.pDocList
do until pDoc = 0
if pDoc <> pDocMain then
'if pDoc <> pDocMain then
if pDoc->IsDesigner then
' REM out any user entered #include file
wszLookFor = "#include once " & chr(34) & AfxStrPathName( "NAMEX", pDoc->DiskFilename ) & chr(34) & vbcrlf
Expand All @@ -1294,10 +1294,12 @@ public Function code_Compile( ByVal wID As Long ) As BOOLEAN
wszTYPE = AfxStrReplaceI( wszTYPE, "#if 0", "" )
wszTYPE = AfxStrReplaceI( wszTYPE, "#endif", "" )
wszAllTYPEs = wszAllTYPEs & wszTYPE
wszAllEvents = wszAllEvents & _
"#include once " & chr(34) & pDoc->DiskFilename & chr(34) & vbcrlf
if pDoc <> pDocMain then
wszAllEvents = wszAllEvents & _
"#include once " & chr(34) & pDoc->DiskFilename & chr(34) & vbcrlf
end if
end if
end if
'end if
pDoc = pDoc->pDocNext
loop
Expand Down
3 changes: 3 additions & 0 deletions src/modMenus.inc
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ public Function frmMain_BuildMenu( ByVal pWindow As CWindow Ptr ) As HMENU

pWindow->AddAccelerator( FVIRTKEY Or FCONTROL, VK_A, IDM_SELECTALL )
pWindow->AddAccelerator( FVIRTKEY Or FCONTROL, VK_B, IDM_COMMENTBLOCK )
pWindow->AddAccelerator( FVIRTKEY Or FCONTROL, VK_C, IDM_COPY )
pWindow->AddAccelerator( FVIRTKEY Or FCONTROL, VK_D, IDM_DUPLICATELINE )
pWindow->AddAccelerator( FVIRTKEY Or FCONTROL, VK_E, IDM_REDO )
pWindow->AddAccelerator( FVIRTKEY Or FCONTROL, VK_F, IDM_FIND )
Expand All @@ -279,7 +280,9 @@ public Function frmMain_BuildMenu( ByVal pWindow As CWindow Ptr ) As HMENU
pWindow->AddAccelerator( FVIRTKEY Or FCONTROL, VK_R, IDM_REPLACE )
pWindow->AddAccelerator( FVIRTKEY Or FCONTROL, VK_S, IDM_FILESAVE )
pWindow->AddAccelerator( FVIRTKEY Or FCONTROL, VK_T, IDM_FILEOPENTEMPLATES )
pWindow->AddAccelerator( FVIRTKEY Or FCONTROL, VK_V, IDM_PASTE )
pWindow->AddAccelerator( FVIRTKEY Or FCONTROL, VK_W, IDM_CLOSETAB )
pWindow->AddAccelerator( FVIRTKEY Or FCONTROL, VK_X, IDM_CUT )
pWindow->AddAccelerator( FVIRTKEY Or FCONTROL, VK_Y, IDM_DELETELINE )
pWindow->AddAccelerator( FVIRTKEY Or FCONTROL, VK_F2, IDM_BOOKMARKTOGGLE )
pWindow->AddAccelerator( FVIRTKEY Or FCONTROL, VK_F5, IDM_COMPILE )
Expand Down
Loading

0 comments on commit 62968d1

Please sign in to comment.