Skip to content

Commit

Permalink
Code changes 20191121
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulSquires committed Nov 21, 2019
1 parent 69518d5 commit bd027a2
Show file tree
Hide file tree
Showing 17 changed files with 387 additions and 53 deletions.
4 changes: 4 additions & 0 deletions Help/WinFBE/Visual Designer/Controls/ListView.html
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,10 @@ <h3 id="items-collection-(wfxlistviewitemscollection)">Items Collection (wfxList
<td>SelectedCount</td>
<td>Returns the total number of selected items in the listview.</td>
</tr>
<tr class="even">
<td>SortByColumn</td>
<td>Sort by the specified SubItem column index. ListView.Items.SortByColumn( nSortColumn, bSortAscend )</td>
</tr>
</tbody>
</table>
<h3 id="item-(wfxlistviewitem)">Item (wfxListViewItem)</h3>
Expand Down
1 change: 1 addition & 0 deletions Help/WinFBE/Visual Designer/Controls/ListView.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
| Insert | Add a new item (and optional 32bit value) to the listview at a specific position. ListView.Items.Insert( Index, Text, 32bitValue)|
| Remove | Remove/delete the item identified by the index value.|
| SelectedCount | Returns the total number of selected items in the listview.|
| SortByColumn | Sort by the specified SubItem column index. ListView.Items.SortByColumn( nSortColumn, bSortAscend ) |

### Item (wfxListViewItem)
| Name | Description |
Expand Down
Binary file modified Languages/english.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 2.0.0 (November 21, 2019)
- Added: New Project template options: None; Blank Document; Visual Designer; Console; Windows DLL; Static Library.
- Added: ListView sort (ascending or descending) by a specified SubItem column index. ListView.Items.SortByColumn( nSortColumn, bSortAscend ).
- Added: ListView Click event now sets e.KeyChar = 13, e.KeyCode = VK_RETURN, whenever ENTER is pressed on a selected row.
- Fixed: ListView would "automatically" select the row under the cursor even if you don't click on it. Fix required removing the ListView MouseHover event.
- Fixed: "Open Templates" menu option was disabled if no file/project was already opened.
- Fixed: Removed extra separator bar between the "Replace" and "Goto Line" top menu items.

Version 1.9.9 (November 17, 2019)
- Added: New method Form.ShowChild allows displaying a Form as a child (WS_CHILD). This allows forms to act like child panel controls.
- Added: ListView DoubleClick, RightClick events.
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("1.9.9")
#Define APPVERSION WStr("2.0.0")
#Define APPCOPYRIGHT WStr("Paul Squires, PlanetSquires Software, Copyright (C) 2016-2019")


Expand Down
4 changes: 2 additions & 2 deletions src/WinFBE.rc
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ IMAGE_RICHEDIT BITMAP "IMAGES\\TOOLBOX\\N_RICHEDIT.BMP"
IMAGE_PROGRESSBAR BITMAP "IMAGES\\TOOLBOX\\N_PROGRESS.BMP"
IMAGE_LISTVIEW BITMAP "IMAGES\\TOOLBOX\\N_LISTVIEW.BMP"
IMAGE_TREEVIEW BITMAP "IMAGES\\TOOLBOX\\N_TREEVIEW.BMP"
IMAGE_MONTHCALENDAR BITMAP "IMAGES\\TOOLBOX\\N_MONTHCALENDAR.BMP"
//IMAGE_IMGBUTTON BITMAP "IMAGES\\TOOLBOX\\N_BUTTON_PICTURE.BMP"
//IMAGE_HSCROLL BITMAP "IMAGES\\TOOLBOX\\N_SCROLL_H.BMP"
//IMAGE_VSCROLL BITMAP "IMAGES\\TOOLBOX\\N_SCROLL_V.BMP"
Expand All @@ -77,7 +78,6 @@ IMAGE_TREEVIEW BITMAP "IMAGES\\TOOLBOX\\N_TREEVIEW.BMP"
//IMAGE_UPDOWN BITMAP "IMAGES\\TOOLBOX\\N_UP_DOWN.BMP"
//IMAGE_SLIDER BITMAP "IMAGES\\TOOLBOX\\N_SLIDER.BMP"
//IMAGE_DATETIMEPICKER BITMAP "IMAGES\\TOOLBOX\\N_TIMEPICKER.BMP"
//IMAGE_MONTHCALENDAR BITMAP "IMAGES\\TOOLBOX\\N_MONTH_CALENDAR.BMP"
//IMAGE_WEBBROWSER BITMAP "IMAGES\\TOOLBOX\\N_BROWSER.BMP"
//IMAGE_CUSTOM BITMAP "IMAGES\\TOOLBOX\\N_CUSTOM.BMP"
//IMAGE_OCX BITMAP "IMAGES\\TOOLBOX\\N_ACTIVE_X.BMP"
Expand All @@ -97,6 +97,7 @@ IMAGE_CURSOR_RICHEDIT CURSOR "IMAGES\\TOOLBOX\\C_RICHEDIT.CUR"
IMAGE_CURSOR_PROGRESSBAR CURSOR "IMAGES\\TOOLBOX\\C_PROGRESS.CUR"
IMAGE_CURSOR_LISTVIEW CURSOR "IMAGES\\TOOLBOX\\C_LISTVIEW.CUR"
IMAGE_CURSOR_TREEVIEW CURSOR "IMAGES\\TOOLBOX\\C_TREEVIEW.CUR"
IMAGE_CURSOR_MONTHCALENDAR CURSOR "IMAGES\\TOOLBOX\\C_MONTHCALENDAR.CUR"
//IMAGE_CURSOR_IMGBUTTON CURSOR "IMAGES\\TOOLBOX\\C_BUTTON_PICTURE.CUR"
//IMAGE_CURSOR_HSCROLL CURSOR "IMAGES\\TOOLBOX\\C_HORIZONTAL_SCROLL.CUR"
//IMAGE_CURSOR_VSCROLL CURSOR "IMAGES\\TOOLBOX\\C_VERTICAL_SCROLL.CUR"
Expand All @@ -105,7 +106,6 @@ IMAGE_CURSOR_TREEVIEW CURSOR "IMAGES\\TOOLBOX\\C_TREEVIEW.CUR"
//IMAGE_CURSOR_UPDOWN CURSOR "IMAGES\\TOOLBOX\\C_UP_DOWN.CUR"
//IMAGE_CURSOR_SLIDER CURSOR "IMAGES\\TOOLBOX\\C_SLIDER.CUR"
//IMAGE_CURSOR_DATETIMEPICKER CURSOR "IMAGES\\TOOLBOX\\C_DATE_PICKER.CUR"
//IMAGE_CURSOR_MONTHCALENDAR CURSOR "IMAGES\\TOOLBOX\\C_MONTH_CALENDAR.CUR"
//IMAGE_CURSOR_WEBBROWSER CURSOR "IMAGES\\TOOLBOX\\C_BROWSER.CUR"
//IMAGE_CURSOR_CUSTOM CURSOR "IMAGES\\TOOLBOX\\C_CUSTOM_CONTROL.CUR"
//IMAGE_CURSOR_OCX CURSOR "IMAGES\\TOOLBOX\\C_ACTIVEX.CUR"
Expand Down
1 change: 1 addition & 0 deletions src/clsApp.bi
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ Type clsApp
wszPanelText as CWSTR ' Current file loading or being compiled (for statusbar updating)
hIconPanel as HANDLE ' Success/failure of most previous compile (for Statusbar updating)
FileLoadingCount as long ' Track count of files loading for statusbar display
NewProjectTemplateType as long ' IDC of the new project type to create.
IsNewProjectFlag As BOOLEAN
IsProjectLoading as Boolean ' Project loading. Disable some screen updating.
IsFileLoading as Boolean ' File loading. Disable some screen updating.
Expand Down
14 changes: 8 additions & 6 deletions src/clsConfig.inc
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,14 @@ Function clsConfig.InitializeToolBox() as Long
gToolBox(n).wszCursor = "IMAGE_CURSOR_TEXTBOX"
gToolBox(n).wszClassName = "TEXTBOX"
' n = n + 1
' gToolBox(n).nToolType = CTRL_MONTHCALENDAR
' gToolBox(n).wszToolBoxName = "TextBox"
' gToolBox(n).wszControlName = "MonthCalendar"
' gToolBox(n).wszImage = "IMAGE_MONTHCALENDAR"
' gToolBox(n).wszCursor = "IMAGE_CURSOR_MONTHCALENDAR"
' gToolBox(n).wszClassName = "MONTHCALENDAR"
' n = n + 1
' gToolBox(n).nToolType = CTRL_TREEVIEW
' gToolBox(n).wszToolBoxName = "TreeView"
Expand Down Expand Up @@ -485,12 +493,6 @@ Function clsConfig.InitializeToolBox() as Long
' gToolBox(21).wszCursor = "IMAGE_CURSOR_DATETIMEPICKER"
' gToolBox(21).wszClassName = "DATETIMEPICKER"
' gToolBox(22).nToolType = CTRL_MONTHCALENDAR
' gToolBox(22).wszName = "MonthCalendar"
' gToolBox(22).wszImage = "IMAGE_MONTHCALENDAR"
' gToolBox(22).wszCursor = "IMAGE_CURSOR_MONTHCALENDAR"
' gToolBox(22).wszClassName = "MONTHCALENDAR"
' gToolBox(23).nToolType = CTRL_WEBBROWSER
' gToolBox(23).wszName = "WebBrowser"
' gToolBox(23).wszImage = "IMAGE_WEBBROWSER"
Expand Down
261 changes: 261 additions & 0 deletions src/frmMainOnCommand.inc
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,270 @@ End Function
' ========================================================================================
private Function OnCommand_ProjectNew( ByVal HWnd As HWnd ) As LRESULT


' Ensure that the Project Manager window has been created (show it now as well)
frmProjectOptions_Show( HWnd, true )

if gApp.IsNewProjectFlag then
' Need to remove resource file (if created) from the document list otherwise it
' will be loaded again and it will display twice in the Explorer.
gApp.RemoveAllDocuments()

' Open the new project so it displays in the Explorer treeview. Pass the
' variable wText because passing gApp.ProjectFilename will cause that variable
' to get reset because the parameter is byref and eventually that variable
' gets assigned a null.
dim as CWSTR wszText = gApp.ProjectFilename
frmMain_OpenProjectSafely(HWND_FRMMAIN, wszText)


dim pDoc as clsDocument ptr
dim pCtrl as clsControl ptr
dim as string szText
dim as string DQ = chr(34)


select case gApp.NewProjectTemplateType

case IDC_FRMPROJECTOPTIONS_OPTNONE
' Do nothing

case IDC_FRMPROJECTOPTIONS_OPTBLANK
' Add a new blank file to the project and set it as the Main by default
pDoc = OnCommand_FileNew(HWND_FRMMAIN)
if pDoc then
SendMessage( HWND_FRMMAIN, WM_COMMAND, MAKELONG(IDM_SETFILEMAIN, 0), 0)
end if


case IDC_FRMPROJECTOPTIONS_OPTVD
pDoc = OnCommand_FileNew(HWND_FRMMAIN)
if pDoc then
szText = _
"#Define UNICODE" & vbcrlf & _
"#Define _WIN32_WINNT &h0602" & vbcrlf & _
vbcrlf & _
vbcrlf & _
"#Include Once " & DQ & "windows.bi" & DQ & vbcrlf & _
"#Include Once " & DQ & "Afx\CWindow.inc" & DQ & vbcrlf & _
vbcrlf & _
"Using Afx" & vbcrlf & _
vbcrlf & _
"#Include Once " & DQ & "frmMain.inc" & DQ & vbcrlf & _
vbcrlf & _
vbcrlf & _
"Application.Run(frmMain)" & vbcrlf
pDoc->SetText( szText )
dim as any ptr pSci = pDoc->GetActiveScintillaPtr()
SciMsg( pSci, SCI_GOTOLINE, 12, 0)
' Make this the Main file
SendMessage( HWND_FRMMAIN, WM_COMMAND, MAKELONG(IDM_SETFILEMAIN, 0), 0)
' Save the main file using the Project name and path
pDoc->IsNewFlag = false
pDoc->Diskfilename = AfxStrPathname( "PATH", gApp.ProjectFilename ) & _
AfxStrPathname( "NAME", gApp.ProjectFilename ) & _
".bas"
pDoc->SaveFile
end if
' Give a breather for the tab control and explorer node to update
AfxDoEvents()
' Create the frmMain
OnCommand_DesignerNewForm(HWND_FRMMAIN)
pDoc = gTTabCtl.GetActiveDocumentPtr
if pDoc then
' Set the Name property of the new form to frmMain
pCtrl = GetFormCtrlPtr(pDoc)
if pCtrl then SetControlProperty( pCtrl, "NAME", "frmMain" )
' Add something to the code editor so that it does not automatically
' generate the Application.Run code for the form.
szText = "' Auto generated frmMain form file" & vbcrlf
pDoc->SetText( szText )
' Save the form file using the Project name and path
pDoc->IsNewFlag = false
pDoc->Diskfilename = AfxStrPathname( "PATH", gApp.ProjectFilename ) & _
"frmMain.inc"
pDoc->SaveFile
end if


' Change the Build Configuration to match the first "GUI" (non-debug) type of entry.
for i as long = lbound(gConfig.Builds) to ubound(gConfig.Builds)
if instr( " " & ucase(gConfig.Builds(i).wszOptions), " -S GUI") then
gApp.ProjectBuild = gConfig.Builds(i).id
exit for
end if
NEXT
case IDC_FRMPROJECTOPTIONS_OPTCONSOLE
pDoc = OnCommand_FileNew(HWND_FRMMAIN)
if pDoc then
szText = _
"'#CONSOLE ON" & vbcrlf & _
"#Define UNICODE" & vbcrlf & _
"#Include Once " & DQ & "windows.bi" & DQ & vbcrlf & _
vbcrlf & _
vbcrlf & _
"Print" & vbcrlf & _
"Print " & DQ & "Press any key..." & DQ & vbcrlf & _
"Sleep" & vbcrlf
pDoc->SetText( szText )
dim as any ptr pSci = pDoc->GetActiveScintillaPtr()
SciMsg( pSci, SCI_GOTOLINE, 4, 0)
' Make this the Main file
SendMessage( HWND_FRMMAIN, WM_COMMAND, MAKELONG(IDM_SETFILEMAIN, 0), 0)
' Save the main file using the Project name and path
pDoc->IsNewFlag = false
pDoc->Diskfilename = AfxStrPathname( "PATH", gApp.ProjectFilename ) & _
AfxStrPathname( "NAME", gApp.ProjectFilename ) & _
".bas"
pDoc->SaveFile
end if
' Change the Build Configuration to match the first "Console" (non-debug) type of entry.
for i as long = lbound(gConfig.Builds) to ubound(gConfig.Builds)
if instr( " " & ucase(gConfig.Builds(i).wszOptions), " -S CONSOLE") then
gApp.ProjectBuild = gConfig.Builds(i).id
exit for
end if
NEXT
case IDC_FRMPROJECTOPTIONS_OPTDLL
' Change the Build Configuration to match the first "DLL" type of entry.
pDoc = OnCommand_FileNew(HWND_FRMMAIN)
if pDoc then
szText = _
vbcrlf & _
"Extern " & DQ & "windows" & DQ & vbcrlf & _
vbcrlf & _
"'' Windows DLL template code" & vbcrlf & _
vbcrlf & _
"'' Add two numbers together and return the result" & vbcrlf & _
"Public Function Add2 alias " & DQ & "Add2" & DQ & "( ByVal x As Integer, ByVal y As Integer ) As Integer Export" & vbcrlf & _
" Return( x + y )" & vbcrlf & _
"End Function" & vbcrlf & _
vbcrlf & _
"End Extern" & vbcrlf
pDoc->SetText( szText )
dim as any ptr pSci = pDoc->GetActiveScintillaPtr()
SciMsg( pSci, SCI_GOTOLINE, 9, 0)
' Make this the Main file
SendMessage( HWND_FRMMAIN, WM_COMMAND, MAKELONG(IDM_SETFILEMAIN, 0), 0)
' Save the main file using the Project name and path
pDoc->IsNewFlag = false
pDoc->Diskfilename = AfxStrPathname( "PATH", gApp.ProjectFilename ) & _
AfxStrPathname( "NAME", gApp.ProjectFilename ) & _
".bas"
pDoc->SaveFile
end if
' Change the Build Configuration to match the first "DLL" type of entry.
for i as long = lbound(gConfig.Builds) to ubound(gConfig.Builds)
if instr( " " & ucase(gConfig.Builds(i).wszOptions), " -DLL") then
gApp.ProjectBuild = gConfig.Builds(i).id
exit for
end if
NEXT
case IDC_FRMPROJECTOPTIONS_OPTSTATIC
pDoc = OnCommand_FileNew(HWND_FRMMAIN)
if pDoc then
szText = _
vbcrlf & _
"Extern " & DQ & "windows" & DQ & vbcrlf & _
vbcrlf & _
"'' Static Library template code" & vbcrlf & _
vbcrlf & _
"'' Add two numbers together and return the result" & vbcrlf & _
"Public Function Add2( ByVal x As Integer, ByVal y As Integer ) As Integer" & vbcrlf & _
" Return( x + y )" & vbcrlf & _
"End Function" & vbcrlf & _
vbcrlf & _
"End Extern" & vbcrlf

pDoc->SetText( szText )
dim as any ptr pSci = pDoc->GetActiveScintillaPtr()
SciMsg( pSci, SCI_GOTOLINE, 6, 0)

' Make this the Main file
SendMessage( HWND_FRMMAIN, WM_COMMAND, MAKELONG(IDM_SETFILEMAIN, 0), 0)

' Save the main file using the Project name and path
pDoc->IsNewFlag = false
pDoc->Diskfilename = AfxStrPathname( "PATH", gApp.ProjectFilename ) & _
AfxStrPathname( "NAME", gApp.ProjectFilename ) & _
".bas"
pDoc->SaveFile
end if

' Change the Build Configuration to match the first "LIB" type of entry.
for i as long = lbound(gConfig.Builds) to ubound(gConfig.Builds)
if instr( " " & ucase(gConfig.Builds(i).wszOptions), " -LIB") then
gApp.ProjectBuild = gConfig.Builds(i).id
exit for
end if
NEXT

end select


select case gApp.NewProjectTemplateType
case IDC_FRMPROJECTOPTIONS_OPTDLL, IDC_FRMPROJECTOPTIONS_OPTSTATIC
' Give a breather for the tab control and explorer node to update
AfxDoEvents()
pDoc = OnCommand_FileNew(HWND_FRMMAIN)
if pDoc then
szText = _
"#inclib " & DQ & AfxStrPathname( "NAME", gApp.ProjectFilename ) & DQ & vbcrlf & _
"Declare Function Add2( ByVal x As Integer, ByVal y As Integer ) As Integer" & vbcrlf

pDoc->SetText( szText )
dim as any ptr pSci = pDoc->GetActiveScintillaPtr()
SciMsg( pSci, SCI_GOTOLINE, 3, 0)

' Make this the Main file
SendMessage( HWND_FRMMAIN, WM_COMMAND, MAKELONG(IDM_SETFILEHEADER, 0), 0)

' Save the main file using the Project name and path
pDoc->IsNewFlag = false
pDoc->Diskfilename = AfxStrPathname( "PATH", gApp.ProjectFilename ) & _
AfxStrPathname( "NAME", gApp.ProjectFilename ) & _
".bi"
pDoc->SaveFile
end if
end select


' Ensure that the main form files combo shows the correct list of files
frmMain_LoadComboFiles

' Make sure that the Explorer root node is expanded
dim as HWND hTree = GetDlgItem(HWND_FRMEXPLORER, IDC_FRMEXPLORER_TREE)
TreeView_Expand( hTree, gApp.hExplorerRootNode, TVE_EXPAND)

end if

gApp.IsNewProjectFlag = false
gApp.IsProjectLoading = FALSE

frmBuildConfig_LoadBuildComboBox
frmExplorer_PositionWindows
frmMain_PositionWindows

Expand Down
Loading

0 comments on commit bd027a2

Please sign in to comment.