Skip to content

Commit

Permalink
Fixed: Compile on Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
XusinboyBekchanov committed Mar 28, 2021
1 parent 85e63c0 commit ca2f92a
Show file tree
Hide file tree
Showing 8 changed files with 103 additions and 52 deletions.
16 changes: 10 additions & 6 deletions Settings/VisualFBEditorX64.ini
Expand Up @@ -19,7 +19,7 @@ ProjectFolders=true
ToolLabels=true
UseDebugger=true
CompileGUI=true
RecentFiles=/media/GitHub/VisualFBEditor/Examples/Chart/Chart Example.bas
RecentFiles=/media/GitHub/VisualFBEditor/Projects/Untitled.bas
[MRUProjects]
MRUProject_00=/media/GitHub/VisualFBEditor/MyFbFramework/MyFbFramework.vfp
MRUProject_01=/media/GitHub/VisualFBEditor/VisualFBEditor.vfp
Expand All @@ -33,14 +33,17 @@ Version_0=FreeBASIC-1.07.1-linux-x86_64
Path_0=/media/FreeBasic/FreeBASIC-1.07.1-linux-x86_64/bin/fbc
Version_1= fbc
Path_1=fbc
Command_0=
Command_1=
[MakeTools]
DefaultMakeTool=
[Debuggers]
DefaultDebugger=gdb
Version_0=gdb
Path_0=gdb
DefaultDebugger32=gdb
DefaultDebugger64=
DefaultDebugger64=gdb
Command_0=
[Terminals]
DefaultTerminal=gnome-terminal
Version_0=gnome-terminal
Expand Down Expand Up @@ -90,7 +93,8 @@ CreateNonStaticEventHandlers=true
[MRUSessions]
MRUSession_00=/media/GitHub/VisualFBEditor/VisualFBEditor.vfs
[MRUFiles]
MRUFile_00=/media/GitHub/VisualFBEditor/Projects/1.bas
MRUFile_01=/media/GitHub/VisualFBEditor/Examples/Chart/Chart Example.bas
MRUFile_02=/media/GitHub/VisualFBEditor/Projects/Form1.frm
MRUFile_03=/media/GitHub/VisualFBEditor/Projects/Form1.bas
MRUFile_00=/media/GitHub/VisualFBEditor/Projects/Untitled.bas
MRUFile_01=/media/GitHub/VisualFBEditor/Projects/1.bas
MRUFile_02=/media/GitHub/VisualFBEditor/Examples/Chart/Chart Example.bas
MRUFile_03=/media/GitHub/VisualFBEditor/Projects/Form1.frm
MRUFile_04=/media/GitHub/VisualFBEditor/Projects/Form1.bas
5 changes: 3 additions & 2 deletions src/Debug.bas
Expand Up @@ -6135,12 +6135,13 @@ Sub RunWithDebug(Param As Any Ptr)
Else
ChDir(GetFolderName(exename))
Dim As UString CommandLine
Dim As ToolType Tool
Dim As ToolType Ptr Tool
Dim As Integer Idx = pTerminals->IndexOfKey(*CurrentTerminal)
If Idx <> - 1 Then
Tool = pTerminals->Item(Idx)->Object
CommandLine = Tool->GetCommand(*CmdL)
CommandLine = Tool->GetCommand()
If Tool->Parameters = "" Then CommandLine &= " --wait -- "
CommandLine &= " " & *CmdL
Else
CommandLine &= *CmdL
End If
Expand Down
88 changes: 50 additions & 38 deletions src/Designer.bas
Expand Up @@ -63,6 +63,15 @@ Namespace My.Sys.Forms
End Function
#endif

Sub Designer.ChangeFirstMenuItem()
Select Case QWString(ReadPropertyFunc(SelectedControl, "ClassName"))
Case "MainMenu", "PopupMenu"
mnuDesigner.Item(0)->Caption = ML("Menu Editor")
Case Else
mnuDesigner.Item(0)->Caption = ML("Default event")
End Select
End Sub

#ifndef __USE_GTK__
Sub Designer.GetChilds(Parent As HWND = 0)
FChilds.Count = 0
Expand Down Expand Up @@ -185,16 +194,16 @@ Namespace My.Sys.Forms
Function Dot_Draw(widget As GtkWidget Ptr, cr As cairo_t Ptr, data1 As Any Ptr) As Boolean
Dim As Designer Ptr Des = data1
If Des->SelectedControl AndAlso Des->SelectedControl = g_object_get_data(G_OBJECT(widget), "@@@Control2") Then
cairo_set_source_rgb(cr, 255.0, 255.0, 255.0)
cairo_set_source_rgb(cr, 0.0, 0.0, 1.0)
Else
cairo_set_source_rgb(cr, 0.0, 0.0, 0.0)
cairo_set_source_rgb(cr, 1.0, 1.0, 1.0)
End If
cairo_rectangle(cr, 0, 0, 6, 6)
cairo_rectangle(cr, 0, 0, Des->DotSize, Des->DotSize)
cairo_fill_preserve(cr)
If Des->SelectedControl AndAlso Des->SelectedControl = g_object_get_data(G_OBJECT(widget), "@@@Control2") Then
cairo_set_source_rgb(cr, 0.0, 0.0, 0.0)
cairo_set_source_rgb(cr, 1.0, 1.0, 1.0)
Else
cairo_set_source_rgb(cr, 255.0, 255.0, 255.0)
cairo_set_source_rgb(cr, 0.0, 0.0, 1.0)
End If
cairo_stroke(cr)
Return False
Expand Down Expand Up @@ -354,7 +363,7 @@ Namespace My.Sys.Forms
For i As Integer = 0 To 7
If gtk_is_widget(FDots(j, i)) Then gtk_container_remove(gtk_container(FDialogParent), FDots(j, i))
FDots(j, i) = gtk_layout_new(NULL, NULL)
gtk_widget_set_size_request(FDots(j, i), 6, 6)
gtk_widget_set_size_request(FDots(j, i), FDotSize, FDotSize)
gtk_widget_set_events(FDots(j, i), _
GDK_EXPOSURE_MASK Or _
GDK_SCROLL_MASK Or _
Expand All @@ -374,14 +383,14 @@ Namespace My.Sys.Forms
g_signal_connect(FDots(j, i), "expose-event", G_CALLBACK(@Dot_ExposeEvent), @This)
#endif
Select Case i
Case 0: If gtk_is_widget(FDots(j, 0)) Then gtk_layout_put(gtk_layout(FDialogParent), FDots(j, 0), P.X-6, P.Y-6)
Case 1: If gtk_is_widget(FDots(j, 1)) Then gtk_layout_put(gtk_layout(FDialogParent), FDots(j, 1), P.X+iWidth/2-3, P.Y-6)
Case 2: If gtk_is_widget(FDots(j, 2)) Then gtk_layout_put(gtk_layout(FDialogParent), FDots(j, 2), P.X+iWidth, P.Y-6)
Case 0: If gtk_is_widget(FDots(j, 0)) Then gtk_layout_put(gtk_layout(FDialogParent), FDots(j, 0), P.X-FDotSize, P.Y-FDotSize)
Case 1: If gtk_is_widget(FDots(j, 1)) Then gtk_layout_put(gtk_layout(FDialogParent), FDots(j, 1), P.X+iWidth/2-3, P.Y-FDotSize)
Case 2: If gtk_is_widget(FDots(j, 2)) Then gtk_layout_put(gtk_layout(FDialogParent), FDots(j, 2), P.X+iWidth, P.Y-FDotSize)
Case 3: If gtk_is_widget(FDots(j, 3)) Then gtk_layout_put(gtk_layout(FDialogParent), FDots(j, 3), P.X+iWidth, P.Y + iHeight/2-3)
Case 4: If gtk_is_widget(FDots(j, 4)) Then gtk_layout_put(gtk_layout(FDialogParent), FDots(j, 4), P.X+iWidth, P.Y + iHeight)
Case 5: If gtk_is_widget(FDots(j, 5)) Then gtk_layout_put(gtk_layout(FDialogParent), FDots(j, 5), P.X+iWidth/2-3, P.Y + iHeight)
Case 6: If gtk_is_widget(FDots(j, 6)) Then gtk_layout_put(gtk_layout(FDialogParent), FDots(j, 6), P.X-6, P.Y + iHeight)
Case 7: If gtk_is_widget(FDots(j, 7)) Then gtk_layout_put(gtk_layout(FDialogParent), FDots(j, 7), P.X-6, P.Y + iHeight/2-3)
Case 6: If gtk_is_widget(FDots(j, 6)) Then gtk_layout_put(gtk_layout(FDialogParent), FDots(j, 6), P.X-FDotSize, P.Y + iHeight)
Case 7: If gtk_is_widget(FDots(j, 7)) Then gtk_layout_put(gtk_layout(FDialogParent), FDots(j, 7), P.X-FDotSize, P.Y + iHeight/2-3)
End Select
gtk_widget_realize(FDots(j, i))
pdisplay = gtk_widget_get_display(FDots(j, i))
Expand Down Expand Up @@ -415,14 +424,14 @@ Namespace My.Sys.Forms
P.x = R.Left
P.y = R.Top
ScreenToClient(GetParent(FDialog), @P)
MoveWindow FDots(j, 0), P.X-6, P.Y-6, 6, 6, True
MoveWindow FDots(j, 1), P.X+iWidth/2-3, P.Y-6, 6, 6, True
MoveWindow FDots(j, 2), P.X+iWidth, P.Y-6, 6, 6, True
MoveWindow FDots(j, 3), P.X+iWidth, P.Y + iHeight/2-3, 6, 6, True
MoveWindow FDots(j, 4), P.X+iWidth, P.Y + iHeight, 6, 6, True
MoveWindow FDots(j, 5), P.X+iWidth/2-3, P.Y + iHeight, 6, 6, True
MoveWindow FDots(j, 6), P.X-6, P.Y + iHeight, 6, 6, True
MoveWindow FDots(j, 7), P.X-6, P.Y + iHeight/2-3, 6, 6, True
MoveWindow FDots(j, 0), P.X-FDotSize, P.Y-FDotSize, FDotSize, FDotSize, True
MoveWindow FDots(j, 1), P.X+iWidth/2-3, P.Y-FDotSize, FDotSize, FDotSize, True
MoveWindow FDots(j, 2), P.X+iWidth, P.Y-FDotSize, FDotSize, FDotSize, True
MoveWindow FDots(j, 3), P.X+iWidth, P.Y + iHeight/2-3, FDotSize, FDotSize, True
MoveWindow FDots(j, 4), P.X+iWidth, P.Y + iHeight, FDotSize, FDotSize, True
MoveWindow FDots(j, 5), P.X+iWidth/2-3, P.Y + iHeight, FDotSize, FDotSize, True
MoveWindow FDots(j, 6), P.X-FDotSize, P.Y + iHeight, FDotSize, FDotSize, True
MoveWindow FDots(j, 7), P.X-FDotSize, P.Y + iHeight/2-3, FDotSize, FDotSize, True
For i As Integer = 0 To 7
'SetParent(FDots(i), GetParent(Control))
SetProp(FDots(j, i),"@@@Control", GetControlHandle(SelectedControls.Items[j]))
Expand Down Expand Up @@ -1496,7 +1505,8 @@ Namespace My.Sys.Forms
GetPosToClient widget, .layoutwidget, @x, @y
.MouseUp(Event->button.x + x, Event->button.y + y, Event->button.state)
If Event->button.button = 3 Then
mnuDesigner.Popup(Event->button.x, Event->button.y, @Type<Message>(Des, widget, Event, False))
.ChangeFirstMenuItem
.mnuDesigner.Popup(Event->button.x, Event->button.y, @Type<Message>(Des, widget, Event, False))
End If
If gtk_is_notebook(widget) AndAlso Event->button.y < 20 Then
Return False
Expand Down Expand Up @@ -1536,12 +1546,7 @@ Namespace My.Sys.Forms
P.y = HiWord(lParam)
ClientToScreen(hDlg, @P)
'mnuDesigner.Popup(P.x, P.y)
Select Case QWString(.ReadPropertyFunc(.SelectedControl, "ClassName"))
Case "MainMenu", "PopupMenu"
.mnuDesigner.Item(0)->Caption = ML("Menu Editor")
Case Else
.mnuDesigner.Item(0)->Caption = ML("Default event")
End Select
.ChangeFirstMenuItem
TrackPopupMenu(.mnuDesigner.Handle, 0, P.x, P.y, 0, hDlg, 0)
'end if
Return 0
Expand Down Expand Up @@ -1705,7 +1710,8 @@ Namespace My.Sys.Forms
Case GDK_BUTTON_RELEASE
.MouseUp(Event->button.x, Event->button.y, Event->button.state)
If Event->button.button = 3 Then
mnuDesigner.Popup(Event->button.x, Event->button.y, @Type<Message>(Des, widget, Event, False))
.ChangeFirstMenuItem
.mnuDesigner.Popup(Event->button.x, Event->button.y, @Type<Message>(Des, widget, Event, False))
End If
Return True
#else
Expand All @@ -1730,12 +1736,7 @@ Namespace My.Sys.Forms
P.x = LoWord(lParam)
P.y = HiWord(lParam)
ClientToScreen(hDlg, @P)
Select Case QWString(.ReadPropertyFunc(.SelectedControl, "ClassName"))
Case "MainMenu", "PopupMenu"
.mnuDesigner.Item(0)->Caption = ML("Menu Editor")
Case Else
.mnuDesigner.Item(0)->Caption = ML("Default event")
End Select
.ChangeFirstMenuItem
TrackPopupMenu(.mnuDesigner.Handle, 0, P.x, P.y, 0, hDlg, 0)
'end if
Return 0
Expand Down Expand Up @@ -2117,13 +2118,16 @@ Namespace My.Sys.Forms
Case WM_PAINT
Dim As PAINTSTRUCT Ps
Dim As HDC FHDc = BeginPaint(hDlg, @Ps)
FillRect(FHDc, @Ps.rcPaint, IIf(GetProp(hDlg, "@@@Control2") = .SelectedControl, Cast(HBRUSH, GetStockObject(BLACK_BRUSH)), Cast(HBRUSH, GetStockObject(WHITE_BRUSH))))
Dim As HBrush Brush = IIf(GetProp(hDlg, "@@@Control2") = .SelectedControl, GetStockObject(BLACK_BRUSH), GetStockObject(BLACK_BRUSH))
Dim As HPen Pen = CreatePen(PS_SOLID, 0, IIf(GetProp(hDlg, "@@@Control2") = .SelectedControl, GetSysColor(COLOR_HIGHLIGHTTEXT), GetSysColor(COLOR_HIGHLIGHT)))
Dim As HPen PrevPen = SelectObject(FHDc, Pen)
Dim As HBrush Brush = CreateSolidBrush(IIf(GetProp(hDlg, "@@@Control2") = .SelectedControl, GetSysColor(COLOR_HIGHLIGHT), GetSysColor(COLOR_HIGHLIGHTTEXT)))
Dim As HBrush PrevBrush = SelectObject(FHDc, Brush)
SetROP2(FHDc, R2_NOT)
Rectangle(FHDc, Ps.rcPaint.Left + 1, Ps.rcPaint.Top + 1, Ps.rcPaint.Right - 1, Ps.rcPaint.Bottom - 1)
Rectangle(FHDc, Ps.rcPaint.Left, Ps.rcPaint.Top, Ps.rcPaint.Right, Ps.rcPaint.Bottom)
SelectObject(FHDc, PrevBrush)
SelectObject(FHDc, PrevPen)
EndPaint(hDlg, @Ps)
DeleteObject(Pen)
DeleteObject(Brush)
Return 0
'or use WM_ERASEBKGND message
#endif
Expand Down Expand Up @@ -2380,6 +2384,14 @@ Namespace My.Sys.Forms
End If
End Property

Property Designer.DotSize As Integer
Return FDotSize
End Property

Property Designer.DotSize(value As Integer)
FDotSize = Value
End Property

Property Designer.SnapToGrid As Boolean
Return FSnapToGrid
End Property
Expand Down Expand Up @@ -2417,7 +2429,7 @@ Namespace My.Sys.Forms
FShowGrid = True
FActive = True
FSnapToGrid = 1
FDotSize = 10
FDotSize = 7
FDotColor = clBlack
FSelDotColor = clBlue
Parent = ParentControl
Expand Down
3 changes: 3 additions & 0 deletions src/Designer.bi
Expand Up @@ -191,6 +191,7 @@ Namespace My.Sys.Forms
#else
FOverControl As HWND
#endif
Declare Sub ChangeFirstMenuItem()
Declare Sub Hook
Declare Sub UnHook
Declare Sub HideDots
Expand Down Expand Up @@ -261,6 +262,8 @@ Namespace My.Sys.Forms
Declare Property StepY(value As Integer)
Declare Property DotColor As Integer
Declare Property DotColor(value As Integer)
Declare Property DotSize As Integer
Declare Property DotSize(value As Integer)
Declare Property SnapToGrid As Boolean
Declare Property SnapToGrid(value As Boolean)
Declare Property ShowGrid As Boolean
Expand Down
31 changes: 26 additions & 5 deletions src/Main.bas
Expand Up @@ -3110,39 +3110,39 @@ Sub LoadSettings
iniSettings.KeyExists("IncludePaths", "Path_" & WStr(i)) + iniSettings.KeyExists("LibraryPaths", "Path_" & WStr(i)) = -8
Temp = iniSettings.ReadString("Compilers", "Version_" & WStr(i), "")
If Temp <> "" Then
Tool = New ToolType
Tool = New_(ToolType)
Tool->Name = Temp
Tool->Path = iniSettings.ReadString("Compilers", "Path_" & WStr(i), "")
Tool->Parameters = iniSettings.ReadString("Compilers", "Command_" & WStr(i), "")
Compilers.Add Temp, Tool->Path, Tool
End If
Temp = iniSettings.ReadString("MakeTools", "Version_" & WStr(i), "")
If Temp <> "" Then
Tool = New ToolType
Tool = New_(ToolType)
Tool->Name = Temp
Tool->Path = iniSettings.ReadString("MakeTools", "Path_" & WStr(i), "")
Tool->Parameters = iniSettings.ReadString("MakeTools", "Command_" & WStr(i), "")
MakeTools.Add Temp, Tool->Path, Tool
End If
Temp = iniSettings.ReadString("Debuggers", "Version_" & WStr(i), "")
If Temp <> "" Then
Tool = New ToolType
Tool = New_(ToolType)
Tool->Name = Temp
Tool->Path = iniSettings.ReadString("Debuggers", "Path_" & WStr(i), "")
Tool->Parameters = iniSettings.ReadString("Debuggers", "Command_" & WStr(i), "")
Debuggers.Add Temp, Tool->Path, Tool
End If
Temp = iniSettings.ReadString("Terminals", "Version_" & WStr(i), "")
If Temp <> "" Then
Tool = New ToolType
Tool = New_(ToolType)
Tool->Name = Temp
Tool->Path = iniSettings.ReadString("Terminals", "Path_" & WStr(i), "")
Tool->Parameters = iniSettings.ReadString("Terminals", "Command_" & WStr(i), "")
Terminals.Add Temp, Tool->Path, Tool
End If
Temp = iniSettings.ReadString("OtherEditors", "Version_" & WStr(i), "")
If Temp <> "" Then
Tool = New ToolType
Tool = New_(ToolType)
Tool->Name = Temp
Tool->Path = iniSettings.ReadString("OtherEditors", "Path_" & WStr(i), "")
Tool->Parameters = iniSettings.ReadString("OtherEditors", "Command_" & WStr(i), "")
Expand Down Expand Up @@ -5781,6 +5781,27 @@ Sub OnProgramQuit() Destructor
Delete_(Cast(UserToolType Ptr, Tools.Item(i)))
Next
#endif
Dim As ToolType Ptr Tool
For i As Integer = 0 To pCompilers->Count - 1
Tool = pCompilers->Item(i)->Object
Delete_(Tool)
Next i
For i As Integer = 0 To pMakeTools->Count - 1
Tool = pMakeTools->Item(i)->Object
Delete_(Tool)
Next i
For i As Integer = 0 To pDebuggers->Count - 1
Tool = pDebuggers->Item(i)->Object
Delete_(Tool)
Next i
For i As Integer = 0 To pTerminals->Count - 1
Tool = pTerminals->Item(i)->Object
Delete_(Tool)
Next i
For i As Integer = 0 To pOtherEditors->Count - 1
Tool = pOtherEditors->Item(i)->Object
Delete_(Tool)
Next i
Dim As TypeElement Ptr te, te1
For i As Integer = pGlobalNamespaces->Count - 1 To 0 Step -1
te = pGlobalNamespaces->Object(i)
Expand Down
2 changes: 1 addition & 1 deletion src/TabWindow.bas
Expand Up @@ -5228,7 +5228,7 @@ Sub RunPr(Debugger As String = "")
Else
ChDir(GetFolderName(*ExeFileName))
Dim As UString CommandLine
Dim As ToolType Tool
Dim As ToolType Ptr Tool
Dim As Integer Idx = pTerminals->IndexOfKey(*CurrentTerminal)
If Idx <> - 1 Then
Tool = pTerminals->Item(Idx)->Object
Expand Down
2 changes: 2 additions & 0 deletions src/frmMenuEditor.bi
@@ -1,11 +1,13 @@
'#Region "Form"
#include once "mff/Form.bi"
#include once "mff/TextBox.bi"

Using My.Sys.Forms

Type frmMenuEditor Extends Form
Declare Constructor

Dim As TextBox TextBox1
End Type

Common Shared pfMenuEditor As frmMenuEditor Ptr
Expand Down
8 changes: 8 additions & 0 deletions src/frmMenuEditor.frm
Expand Up @@ -10,6 +10,14 @@
.Caption = ML("Menu Editor")
.SetBounds 0, 0, 850, 460
End With
' TextBox1
With TextBox1
.Name = "TextBox1"
.Text = "TextBox1"
.TabIndex = 0
.SetBounds 2, 2, 70, 24
.Parent = @This
End With
End Constructor

Dim Shared fMenuEditor As frmMenuEditor
Expand Down

0 comments on commit ca2f92a

Please sign in to comment.