FireFly Visual Designer for FreeBASIC (Updated March 8, 2016)
-
- Posts: 491
- Joined: Sep 28, 2013 15:08
- Location: Germany
Re: FireFly Visual Designer for FreeBASIC (Updated Oct 22, 2
A question to Paul: I was very glad to see your latest contribution in this forum in "Community Discussion" as a "sign of life". I use your FireFly test version published here in May 3013. It works very well. Your official release, however, is from 2011. Would it be possible to publish your "test version" as a new release? For me, FireFly is a very helpfull tool, the only GUI designer for FB which is really usable for Windows users. It would perhaps also for you be a benefit to have a release on your homepage which is not dated from 2011. And I think FireFly should also be offerd on the freebasic.net download site together with FBIde, FBEdit and Geany. It is really a great IDE! - Or is the project dead now?
-
- Posts: 1012
- Joined: Jul 14, 2005 23:41
Re: FireFly Visual Designer for FreeBASIC (Updated Oct 22, 2
Hi Lothar,
Nice to hear that you are using Firefly :) Firefly for FreeBasic has some shortcomings. It needs to be made high dpi aware and Unicode based, etc. The code output is "okay" but could be a lot better. I am spending time going through the new FB 1.00 release hoping that it will reignite my programming passion. Hopefully you'll see me posting here more and more.
Nice to hear that you are using Firefly :) Firefly for FreeBasic has some shortcomings. It needs to be made high dpi aware and Unicode based, etc. The code output is "okay" but could be a lot better. I am spending time going through the new FB 1.00 release hoping that it will reignite my programming passion. Hopefully you'll see me posting here more and more.
-
- Posts: 491
- Joined: Sep 28, 2013 15:08
- Location: Germany
Re: FireFly Visual Designer for FreeBASIC (Updated Oct 22, 2
Thank you and good success! We really need your "Visual FreeBasic".
-
- Posts: 5494
- Joined: Sep 12, 2005 20:06
- Location: California
Re: FireFly Visual Designer for FreeBASIC (Updated Oct 22, 2
Please keep this project active if possible. If is definitely one of the more promising FreeBASIC projects. There are plenty of changes in FB 1.00 to keep FreeBASIC interesting for someone who has the time to play with it.PaulSquires wrote:Hi Lothar,
Nice to hear that you are using Firefly :) Firefly for FreeBasic has some shortcomings. It needs to be made high dpi aware and Unicode based, etc. The code output is "okay" but could be a lot better. I am spending time going through the new FB 1.00 release hoping that it will reignite my programming passion. Hopefully you'll see me posting here more and more.
Re: FireFly Visual Designer for FreeBASIC (Updated Oct 22, 2
Please don't let this project die.PaulSquires wrote:I am spending time going through the new FB 1.00 release hoping that it will reignite my programming passion. Hopefully you'll see me posting here more and more.
Re: FireFly Visual Designer for FreeBASIC (Updated Oct 22, 2
Hi,
Is There any plans to allow FireFly to Compile applications for the Linux FreeBASIC Complier or is this all ready included in the program?
Andy
Is There any plans to allow FireFly to Compile applications for the Linux FreeBASIC Complier or is this all ready included in the program?
Andy
-
- Posts: 1012
- Joined: Jul 14, 2005 23:41
Re: FireFly Visual Designer for FreeBASIC (Updated Oct 22, 2
Sorry Andy, FireFly is Windows only.
Re: FireFly Visual Designer for FreeBASIC (Updated Oct 22, 2
any ideas what one i can use to work in Linux
Re: Visual Designer for FreeBASIC
This tool chain is cross platform (32/64 bit, but no DOS):
- Glade3: grafical interface designer,
- GladeToBac: FreeBASIC code sketcher,
- Gtk+: GUI toolkit
- .../examples/GUI/GTK/GtkBuilder.bas
-
- Posts: 491
- Joined: Sep 28, 2013 15:08
- Location: Germany
Re: FireFly Visual Designer for FreeBASIC (Updated Oct 22, 2
If a GUI designer is not essential for you, you might also use FLTK (see http://www.freebasic.net/forum/viewtopi ... 14&t=21548. It is a very easy to use GUI library, and the FLTK wrapper contains a lot of examples. FLTK is less complex than GTK+, but has also less features.Gablea wrote:any ideas what one i can use to work in Linux
Re: FireFly Visual Designer for FreeBASIC (Updated Oct 22, 2
FF_Control_SetTag works well with FireFly. By the way, I'm using Mac OS.
-
- Posts: 491
- Joined: Sep 28, 2013 15:08
- Location: Germany
Re: FireFly Visual Designer for FreeBASIC (Updated Oct 22, 2
Hallo Paul,PaulSquires wrote:Here is a link to the latest test version. It is very stable at this point.
http://www.planetsquires.com/files/FF3_FB_TEST_007.rar
If you wish to test it then please do so and respond with any problems. Once I know that the current code base is okay then I will do up a final release package.
I found that this link is empty now. Is it not possible any more to have access to this version which is named 3.62 in the Help menu? Or is there an official version 3.62 now for Powerbasic and / or FreeBasic? I have done some work with this version, but when I go back to version 3.50 with my projects, the designer shows only very small letters, I have to select again the right font size for all controls.
-
- Posts: 1012
- Joined: Jul 14, 2005 23:41
Re: FireFly Visual Designer for FreeBASIC (Updated Oct 22, 2
Hi Lothar!
Try this link for the full 3.62 FB package: http://www.planetsquires.com/files/FireFly_FB_362.rar
I am working on a Windows API library that should replace the current FireFly code output. Hope to have that available in the next few weeks.
Try this link for the full 3.62 FB package: http://www.planetsquires.com/files/FireFly_FB_362.rar
I am working on a Windows API library that should replace the current FireFly code output. Hope to have that available in the next few weeks.
-
- Posts: 491
- Joined: Sep 28, 2013 15:08
- Location: Germany
Re: FireFly Visual Designer for FreeBASIC (Updated Oct 22, 2
Thank you very much! I was not at home for some days, but now I have downloaded your full 3.62 FB package. It works very well. But I observe (like in the test version, or is this package identical to the test version?) that the designer does not exactly snap the controls to the selected grid size. I use Windows 8.1 (64 bit). Can that be the reason?
I look forward to your next version, good success!
I look forward to your next version, good success!
-
- Posts: 491
- Joined: Sep 28, 2013 15:08
- Location: Germany
Re: FireFly Visual Designer - Drawing simple charts
I would like to draw simple charts into a picture control. I guess I cannot use the WM_Paint message because a chart shall be drawn after the user has done som actions (e.g. entered some parameters into textboxes etc.) Here is a first draft: The form has four buttons, one to draw a line chart, one to draw a spike chart, one to draw a bar chart and one to draw a pie chart.
Code of the form:
(The arrays y() and z() are declared globally with "Dim Shared" in the function FF_AppStart).
The following module is used (based on the code that has been presented by BasicScience on Jul 03, 2010 on page 5):
(If it is helpful, I can present a screenshot - how can I upload it? When I use the button "Img", I have to enter an url, but my computer has no url).
The result is ok, but when I minimize the window and click it back on the screen, my nice drawings are brushed off. How can I avoid that?
The code is "freeware", of course. If anybody likes it, he may use it and give me some informations what could be done better, I am not an expert for WinAPI. I can also translate the german text into english.
Code of the form:
Code: Select all
'--------------------------------------------------------------------------------
Function FORMMAIN_WM_CREATE ( _
hWndForm As hWnd, _ ' handle of Form
ByVal UserData As Integer _ ' optional user defined value
) As Integer
Dim As Integer i
Dim As Double x, dx
'Arrays für die Charts definieren:
dx = 6 / 20
For i = 0 To 20
x = -3 + i * dx
y(i) = x^2
z(i) = x^3
Next
Return 0
End Function
'--------------------------------------------------------------------------------
Function FORMMAIN_COMMANDCHARTLINE_BN_CLICKED ( _
ControlIndex As Integer, _ ' index in Control Array
hWndForm As hWnd, _ ' handle of Form
hWndControl As hWnd, _ ' handle of Control
idButtonControl As Integer _ ' identifier of button
) As Integer
'Liniendiagramm zeichnen (Funktionsplot):
Draw_Axes(HWND_FORMMAIN_PICTURECHARTLINE, -3, -30, 3, 30, _
"y = x^2 und y = x^3, x = -3 bis +3, y = -30 bis + 30")
Chart_Line(HWND_FORMMAIN_PICTURECHARTLINE, y(), BGR_Blue)
Chart_Line(HWND_FORMMAIN_PICTURECHARTLINE, z(), BGR_Red)
End Function
'--------------------------------------------------------------------------------
Function FORMMAIN_COMMANDCHARTSPIKE_BN_CLICKED ( _
ControlIndex As Integer, _ ' index in Control Array
hWndForm As hWnd, _ ' handle of Form
hWndControl As hWnd, _ ' handle of Control
idButtonControl As Integer _ ' identifier of button
) As Integer
'Spike-Diagramm zeichnen:
Draw_Axes(HWND_FORMMAIN_PICTURECHARTSPIKE, -3, -30, 3, 30, "y = x^3, x = -3 bis 3, y = -30 bis + 30")
Chart_Spike(HWND_FORMMAIN_PICTURECHARTSPIKE, z(), BGR_Red)
End Function
'--------------------------------------------------------------------------------
Function FORMMAIN_COMMANDCHARTBAR_BN_CLICKED ( _
ControlIndex As Integer, _ ' index in Control Array
hWndForm As hWnd, _ ' handle of Form
hWndControl As hWnd, _ ' handle of Control
idButtonControl As Integer _ ' identifier of button
) As Integer
'Balkendiagramm zeichnen
Chart_Bar(HWND_FORMMAIN_PICTURECHARTBAR, z(), -30, 30, "y = x^3, x = -3 bis 3, y = -30 bis + 30", BGR_Red)
End Function
'--------------------------------------------------------------------------------
Function FORMMAIN_COMMANDCHARTPIE_BN_CLICKED ( _
ControlIndex As Integer, _ ' index in Control Array
hWndForm As hWnd, _ ' handle of Form
hWndControl As hWnd, _ ' handle of Control
idButtonControl As Integer _ ' identifier of button
) As Integer
'Tortendiagramm zeichnen:
Chart_Pie(HWND_FORMMAIN_PICTURECHARTPIE, y(), "y = x^2, x = -3 bis 3", BGR_Blue)
End Function
The following module is used (based on the code that has been presented by BasicScience on Jul 03, 2010 on page 5):
Code: Select all
'==============================================================================
' Funktionen zum Zeichnen einfacher Diagramme in ein Picture Control
'==============================================================================
'Farbkonstanten:
Const BGR_Black = &H00000000, BGR_Blue = &H00FF0000, BGR_Green = &H0000FF00, _
BGR_Cyan = &H00FFFF00, BGR_Red = &H000000FF, BGR_Magenta = &H00FF00FF, _
BGR_yellow = &H0000FFFF, BGR_grey = &H00AAAAAA, BGR_White = &H00FFFFFF
'Mathematische Abmessungen der Koordinatenachsen:
Dim Shared As Double xAxis_min, xAxix_max, yAxis_min, yAxis_max
Function Picture_GetSize(ByVal hWndControl As hWnd, ByRef w As Integer, _
ByRef h As Integer) As Integer
'Gibt die Abmessungen des Picture zurück, siehe FireFly FF_Control_GetSize)
Dim rc As Rect
' Do a check to ensure that this is actually a window handle
If IsWindow(hWndControl) Then
'Get the dimensions of the window
Function = GetWindowRect(hWndControl, VarPtr(rc))
'Return the Height and Width values back from the function
w = (rc.Right - rc.Left)
h = (rc.Bottom - rc.Top)
End If
End Function
Function MapX(hWnd As hWnd, xmin As Double, xmax As Double, x As Double) As Integer
'Berechnet aus der mathematischen Koordinate x die Pixelkoorinate.
'Parameter:
'- hwnd = Handle des Picture
'- xmin, xmax = mathematische x-Koordinaten des Darstellbereiches
'- x = mathemtische x-Koordinate
Dim As Integer w, h
Picture_GetSize(hWnd, w, h)
Return w * (x - xmin) / (xmax - xmin)
End Function
Function MapY(hWnd As hWnd, ymin As Double, ymax As Double, y As Double) As Integer
'Berechnet aus der mathematischen Koordinate y die Pixelkoorinate.
'Parameter:
'- hwnd = Handle des Picture
'- ymin, ymax = mathematische y-Koordinaten des Darstellbereiches
'- y = mathemtische y-Koordinate
Dim As Integer w, h
Picture_GetSize(hWnd, w, h)
Return h * (1 - (y - ymin) / (ymax - ymin))
End Function
Sub Draw_Axes(hWnd As hWnd, xmin As Double, ymin As Double, xmax As Double, _
ymax As Double, label As String)
'Zeichnet die Koordintenachsen mit Bildunterschrift in ein Picture und definiert
'dessen Abmessungen in mathematischen Koordinaten.
'Parameter:
'- hwnd = Handle des Pictures
'- xmin, ymin, xmax, ymax = mathematische Koordinaten der Achsen-Enden
'- label = Bildunterschrift
Dim hDC As HDC
Dim As Integer w, h
hDC = GetDC(hWnd)
Picture_GetSize(hWnd, w, h)
'x-Achse zeichnen:
MoveToEx(hDC, 0, MapY(hWnd, ymin, ymax, 0), Null)
LineTo(hDC, w, MapY(hWnd, ymin, ymax, 0))
'y-Achse zeichnen:
MoveToEx(hDC, MapX(hWnd, xmin, xmax, 0), 0, Null)
LineTo(hDC, MapX(hWnd, xmin, xmax, 0), h)
'Bildunterschrift:
TextOut(hDC, 10, h - 20, label, Len(label))
ReleaseDC(hWnd, hDC)
xAxis_min = xmin
xAxix_max = xmax
yAxis_min = ymin
yAxis_max = ymax
End Sub
Sub Chart_Line(hWnd As hWnd, y() As Double, colour As UInteger)
'Zeichnet ein Liniendiagramm (z.B. Funktionskurve) in das mit Draw_Axes
'definierte Koordinatensystem.
'Parameter:
'- hwnd = Handle des Pictures
'- y() = Array mit den darzustellnden Werten
'- colour = Farbe
Dim hDC As HDC
Dim As hPen Pen
Dim As Integer w, h, i
Dim As Double dx
hDC = GetDC(hWnd)
Pen = CreatePen(PS_solid, 1, colour)
SelectObject(hDC, Pen)
Picture_GetSize(hWnd, w, h)
dx = w / UBound(y)
MoveToEx(hDC, 0, MapY(hWnd, yAxis_min, yAxis_max, y(0)), Null)
For i = 1 To UBound(y)
LineTo(hDC, i * dx, MapY(hWnd, yAxis_min, yAxis_max, y(i)))
Next
ReleaseDC(hWnd, hDC)
DeleteObject(Pen)
End Sub
Sub Chart_Spike(hWnd As hWnd, y() As Double, colour As UInteger)
'Zeichnet ein Spike-Diagramm in das mit Draw_Axes definierte Koordinatensystem.
'Parameter:
'- hwnd = Handle des Pictures
'- y() = Array mit den darzustellnden Werten
'- colour = Farbe
Dim hDC As HDC
Dim As hPen Pen
Dim As Integer w, h, i
Dim As Double dx
hDC = GetDC(hWnd)
Pen = CreatePen(PS_solid, 1, colour)
SelectObject(hDC, Pen)
Picture_GetSize(hWnd, w, h)
dx = w / UBound(y)
For i = 0 To UBound(y)
MoveToEx(hDC, i * dx, MapY(hWnd, yAxis_min, yAxis_max, 0), Null)
LineTo(hDC, i * dx, MapY(hWnd, yAxis_min, yAxis_max, y(i)))
Next
ReleaseDC(hWnd, hDC)
DeleteObject(Pen)
End Sub
Sub Chart_Bar(hWnd As hWnd, y() As Double, ymin As Double, ymax As Double, _
label As String, colour As UInteger)
'Zeichnet ein Balkendiagramm.
'Parameter:
'- hwnd = Handle des Pictures
'- y() = Array mit den darzustellnden Werten
'- ymin, ymax = Wertebereich
'- label = Bildunterschrift
'- colour = Farbe
Dim hDC As HDC
Dim As hPen Pen
Dim As Integer w, h, i
Dim As Double dx
hDC = GetDC(hWnd)
Picture_GetSize(hWnd, w, h)
'x-Achse zeichnen:
MoveToEx(hDC, 0, MapY(hWnd, ymin, ymax, 0), Null)
LineTo(hDC, w, MapY(hWnd, ymin, ymax, 0))
'Balken zeichnen:
Pen = CreatePen(PS_solid, 1, colour)
SelectObject(hDC, Pen)
dx = w / (UBound(y) + 1)
MoveToEx(hDC, 0, MapY(hWnd, ymin, ymax, 0), Null)
For i = 0 To UBound(y)
LineTo(hDC, i * dx, MapY(hWnd, ymin, ymax, y(i)))
LineTo(hDC, (i + 1) * dx, MapY(hWnd, ymin, ymax, y(i)))
LineTo(hDC, (i + 1) * dx, MapY(hWnd, ymin, ymax, 0))
Next
'Bildunterschrift:
TextOut(hDC, 10, h - 20, label, Len(label))
ReleaseDC(hWnd, hDC)
DeleteObject(Pen)
End Sub
Sub Chart_Pie(hWnd As hWnd, y() As Double, label As String, colour As UInteger)
'Zeichnet ein Kreisdiagramm.
'- hwnd = Handle des Pictures
'- y() = Array mit den darzustellnden Werten
'- label = Bildunterschrift
'- colour = Farbe
Dim hDC As HDC
Dim As hPen Pen
Dim As Integer w, h, x0, y0, r, i
'Dim As Double Sum, angle0, angle1
Dim As Double Sum, angle(UBound(y)), phi
hDC = GetDC(hWnd)
Picture_GetSize(hWnd, w, h)
If w > h Then r = h/3 Else r = w/3
x0 = w/2
y0 = h/2
Pen = CreatePen(PS_solid, 1, colour)
SelectObject(hDC, Pen)
'Summe alle y-Werte:
Sum = 0
For i = 0 To UBound(y)
Sum = Sum + y(i)
Next
'Alle Winkel (pi = 4 * Atn(1)):
For i = 0 To UBound(y)
angle(i) = 8 * Atn(1) * y(i) / Sum
Next
'Diagramm zeichnen:
MoveToEx(hDC, x0, y0, Null)
LineTo(hDC, x0 + r, y0)
phi = 0
For i = 0 To UBound(y)
phi = phi + angle(i)
MoveToEx(hDC, x0, y0, Null)
LineTo(hDC, x0 + r * Cos(phi), y0 + r * Sin(phi))
Next
MoveToEx(hDC, x0 + r, y0, Null)
AngleArc(hDC, x0, y0, r, 0, 360)
'Bildunterschrift:
TextOut(hDC, 10, h - 20, label, Len(label))
ReleaseDC(hWnd, hDC)
DeleteObject(Pen)
End Sub
The result is ok, but when I minimize the window and click it back on the screen, my nice drawings are brushed off. How can I avoid that?
The code is "freeware", of course. If anybody likes it, he may use it and give me some informations what could be done better, I am not an expert for WinAPI. I can also translate the german text into english.