diff --git a/Settings/VisualFBEditorX64.ini b/Settings/VisualFBEditorX64.ini index 120644f1..92501417 100644 --- a/Settings/VisualFBEditorX64.ini +++ b/Settings/VisualFBEditorX64.ini @@ -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 @@ -33,6 +33,8 @@ 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] @@ -40,7 +42,8 @@ DefaultDebugger=gdb Version_0=gdb Path_0=gdb DefaultDebugger32=gdb -DefaultDebugger64= +DefaultDebugger64=gdb +Command_0= [Terminals] DefaultTerminal=gnome-terminal Version_0=gnome-terminal @@ -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 diff --git a/src/Debug.bas b/src/Debug.bas index 92b838c8..d44d4a6f 100644 --- a/src/Debug.bas +++ b/src/Debug.bas @@ -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 diff --git a/src/Designer.bas b/src/Designer.bas index 3cbab5ef..1a680864 100644 --- a/src/Designer.bas +++ b/src/Designer.bas @@ -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 @@ -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 @@ -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 _ @@ -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)) @@ -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])) @@ -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(Des, widget, Event, False)) + .ChangeFirstMenuItem + .mnuDesigner.Popup(Event->button.x, Event->button.y, @Type(Des, widget, Event, False)) End If If gtk_is_notebook(widget) AndAlso Event->button.y < 20 Then Return False @@ -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 @@ -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(Des, widget, Event, False)) + .ChangeFirstMenuItem + .mnuDesigner.Popup(Event->button.x, Event->button.y, @Type(Des, widget, Event, False)) End If Return True #else @@ -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 @@ -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 @@ -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 @@ -2417,7 +2429,7 @@ Namespace My.Sys.Forms FShowGrid = True FActive = True FSnapToGrid = 1 - FDotSize = 10 + FDotSize = 7 FDotColor = clBlack FSelDotColor = clBlue Parent = ParentControl diff --git a/src/Designer.bi b/src/Designer.bi index 79926d9d..446ff657 100644 --- a/src/Designer.bi +++ b/src/Designer.bi @@ -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 @@ -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 diff --git a/src/Main.bas b/src/Main.bas index 0e4b5563..ac80748a 100644 --- a/src/Main.bas +++ b/src/Main.bas @@ -3110,7 +3110,7 @@ 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), "") @@ -3118,7 +3118,7 @@ Sub LoadSettings 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), "") @@ -3126,7 +3126,7 @@ Sub LoadSettings 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), "") @@ -3134,7 +3134,7 @@ Sub LoadSettings 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), "") @@ -3142,7 +3142,7 @@ Sub LoadSettings 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), "") @@ -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) diff --git a/src/TabWindow.bas b/src/TabWindow.bas index 60b49be7..0075dfc8 100644 --- a/src/TabWindow.bas +++ b/src/TabWindow.bas @@ -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 diff --git a/src/frmMenuEditor.bi b/src/frmMenuEditor.bi index 03627d35..d3d949d2 100644 --- a/src/frmMenuEditor.bi +++ b/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 diff --git a/src/frmMenuEditor.frm b/src/frmMenuEditor.frm index 6f0f8559..b9de2215 100644 --- a/src/frmMenuEditor.frm +++ b/src/frmMenuEditor.frm @@ -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