|
Post by bigbass on Feb 27, 2019 23:20:31 GMT 1
Hello Alex
fixed the compile error problem when I pasted sorry
1.)The idea was to show the BaCon's beta CLASS ENDCLASS command
2.)then to show how we could rewrite code to remove the custom class from the original source demo that the link points to and simplify it
Joe
|
|
|
Post by bigbass on May 25, 2020 0:21:29 GMT 1
I was very inspired by the bacon radio Peter did and in three Languages! I felt the need to see if It could also be done in fltk this doesn't have all the nice features Peter built in to his apps this is a simplified demo and app at the same time FLTK-RADIO-1.01.tar.gz (4.14 KB) the radio2.cfg goes in home and its not a hidden file the formatting is not the same so you can't mix them Joe make any list www.internet-radio.com/more than 25,500 radio stations to choose from easy to add format any name you want|url
|
|
|
Post by vovchik on May 25, 2020 9:41:57 GMT 1
Dear Joe,
Thanks. It works fine. I wonder whether I should do it using my fltk-hug include. It would be very easy to include a popup and play/pause buttons and an edit feature. I will review my old code to see what we could do there...
With kind regards, vovchik
PS. I included my playlist in your format in the other radio thread.
|
|
|
Post by bigbass on May 25, 2020 15:33:34 GMT 1
vovchik Thanks for testing and the improved list I added it ! I fixed a bug and also added a quit call back version 1.01 now FLTK-RADIO-1.01.tar.gz (4.14 KB) I can add more features later but wanted to keep it simple as possible even the formatting of the input file is simple for a demo ( I had originally a nice image but it added in the code about 2000 extra lines!) not fun while trying to debug code may add another one later to improve the looks Joe I think all of this comes down to coding style and what stage of the code design and what ever feels most comfortable and at the same time reflects what code in HUG looks like shows that even if we use a tool kit in C++ in the end we can make it more bacon friendly for everyone my thoughts why I do things the way I do is 1.) I usually try to code in the native language first in this case just fluid and fltk to test ideas and debug when I see it works as planned then 2.) I move to porting to bacon and get it to compile and run and make a simple demo and document 3.) baconize all that I can do and add features and improve the looks so we are in stage three now or I would get lost in the process I am more like the song Lynyrd Skynyrd - Simple Man Joe
|
|
|
Post by bigbass on May 26, 2020 22:39:50 GMT 1
|
|
|
Post by vovchik on May 26, 2020 23:17:06 GMT 1
Dear Joe,
Thanks - looks very nice. I am wondering how an icon can be set for the task bar. I will have to go and look at some of my earlier fltk code - I think we might have to use an X11/Xcb function, but I have to check.
With kind regards, vochik
|
|
|
Post by bigbass on May 27, 2020 4:11:01 GMT 1
hello vovchik I found a demo you can port I tested it and it works as is
I'll port these later but you should have the source too
hope it helps Joe
#include <FL/Fl.H> #include <FL/Fl_Window.H> #include <FL/Fl_Pixmap.H> #include <FL/Fl_RGB_Image.H> /* XPM */ static const char *flComment_xpm[] = { /* width height ncolors chars_per_pixel */ "16 16 4 1", /* colors */ ". c none", "a c #000000", "b c #c0e0c0", "c c #000000", /* pixels */ "................", "................", ".aaaaaaaaaaaaaa.", ".abbbbbbbbbbbbc.", ".abbbbbccbbccbc.", ".abbbbccbbccbbc.", ".abbbbccbbccbbc.", ".abbbccbbccbbbc.", ".abbbccbbccbbbc.", ".abbccbbccbbbbc.", ".abbccbbccbbbbc.", ".abccbbccbbbbbc.", ".abbbbbbbbbbbbc.", ".accccccccccccc.", "................", "................", }; int main() { Fl_Window *win = new Fl_Window(500,200,"foo"); Fl_Pixmap foo_16x16_icon(flComment_xpm); Fl_RGB_Image foo_icon(&foo_16x16_icon, Fl_Color(0)); win->icon(&foo_icon); win->xclass("foo"); win->show(); return(Fl::run()); }
I found one more with a png I took the png out of the bacon trunk BaCon24.png
I simplified and shortened the code
#include <FL/Fl.H> #include <FL/Fl_Window.H> #include <FL/Fl_Box.H> #include <FL/Fl_PNG_Image.H>
int main(int argc, char **argv) {
Fl_Window *window = new Fl_Window(340,180); const char *name = "BaCon24.png"; Fl_PNG_Image *img = new Fl_PNG_Image(name); window->icon(img);
Fl_Box *box = new Fl_Box(20,40,300,100,"Hello, BaCon!"); box->box(FL_UP_BOX); box->labelfont(FL_BOLD+FL_ITALIC); box->labelsize(36); box->labeltype(FL_SHADOW_LABEL); window->end(); window->show(argc, argv); return Fl::run(); }
|
|
|
Post by bigbass on May 27, 2020 5:03:26 GMT 1
A quick bacon port
PRAGMA INCLUDE <FL/Fl.H> PRAGMA INCLUDE <FL/Fl_Double_Window.H> PRAGMA INCLUDE <FL/Fl_Box.H> PRAGMA INCLUDE <FL/Fl_PNG_Image.H>
PRAGMA LDFLAGS -lfltk -lfltk_images PRAGMA COMPILER g++ PRAGMA OPTIONS -Wno-write-strings -Wno-pointer-arith -Wno-permissive OPTION PARSE FALSE
DECLARE window TYPE Fl_Double_Window* DECLARE name TYPE const char * DECLARE img TYPE Fl_PNG_Image* DECLARE box TYPE Fl_Box*
window = new Fl_Double_Window(340,180) name = "BaCon24.png" img = new Fl_PNG_Image(name) window->icon(img)
box = new Fl_Box(20,40,300,100,"Hello, BaCon!") box->box(FL_UP_BOX) box->labelfont(FL_BOLD+FL_ITALIC) box->labelsize(36) box->labeltype(FL_SHADOW_LABEL) window->end() window->show(argc, argv) Fl::run()
|
|
|
Post by vovchik on May 27, 2020 9:38:36 GMT 1
Dear Joe,
Thanks! Works perfectly.
With kind regards, vovchik
|
|
|
Post by bigbass on May 27, 2020 19:29:57 GMT 1
hello vovchik here is HUG looking syntax with some new and fixed macros this does the same but now I linked the icon and improved the looks a little updated
PRAGMA INCLUDE <FL/Fl.H> PRAGMA INCLUDE <FL/Fl_Double_Window.H> PRAGMA INCLUDE <FL/Fl_Box.H> PRAGMA INCLUDE <FL/Fl_PNG_Image.H>
PRAGMA LDFLAGS -lfltk -lfltk_images PRAGMA COMPILER g++ PRAGMA OPTIONS -Wno-write-strings -Wno-pointer-arith -Wno-deprecated OPTION PARSE FALSE
DECLARE window TYPE Fl_Double_Window* DECLARE name TYPE const char * DECLARE img TYPE Fl_PNG_Image* DECLARE box TYPE Fl_Box*
'####################################
DEF FN WINDOW(t, x, y) = new Fl_Double_Window(x, y, t) DEF FN BOX(t,xp,yp, x, y) = new Fl_Box(xp, yp, x, y, t) DEF FN SETPROPERTY(arg1,arg2,arg3) = arg1->arg2(arg3) DEF FN GET(arg1,arg2) = arg1->arg2() DEF FN SET(w,x) = w->value(x)
DEF FN ALIGN(w,x) = w->align(x) DEF FN SETEVENT(w,x) = w->when(x) DEF FN SHOW(w) = w->show() ALIAS Fl::run TO DISPLAY
DEF FN PNG_IMAGE(x) = new Fl_PNG_Image(x) DEF FN ICON(w,x) = w->icon(x) DEF FN END(w) = w->end() 'ICON(window,img) '#################################### name = "/usr/share/icons/Adwaita/32x32/mimetypes/audio-x-generic.png" img = PNG_IMAGE(name)
window = WINDOW( "BaCon ICON FLTK " ,340, 180) SETPROPERTY(window, labelcolor, FL_BLUE) SETPROPERTY(window, color, FL_RED) SETPROPERTY(window, icon, img)
box = BOX("Hello, BaCon!", 20,40,300,100) SETPROPERTY(box,box ,FL_GLEAM_DOWN_FRAME) SETPROPERTY(box,labelfont ,FL_BOLD+FL_ITALIC) SETPROPERTY(box, labelcolor, FL_WHITE) SETPROPERTY(box,labelsize ,36) SETPROPERTY(box,labeltype ,FL_SHADOW_LABEL) END(window) SHOW(window) DISPLAY
|
|
|
Post by vovchik on May 27, 2020 20:02:43 GMT 1
Dear Joe,
Thanks. This also works nicely:
SETPROPERTY(window, icon, img)
So that construction can be used interchageably with ICON(window,img).
With kind regards, vovchik
|
|
|
Post by bigbass on May 27, 2020 22:41:37 GMT 1
your way is actually better
when I step back and look at it again
the image code should be above then the window and the properties after
thanks
Joe
|
|
|
Post by bigbass on May 27, 2020 22:56:39 GMT 1
Hello vovchik it's more work to rewrite already working code but I took it as a test of the macros I replaced all the code with HUG styled macros and it complies and runs as it should FLTK-HUG-RADIO-1.1.tar.gz (67.88 KB) I only want to do that step after testing the code to be working correctly Joe
|
|
|
Post by bigbass on Jun 2, 2020 5:19:27 GMT 1
|
|
|
Post by Pjot on Jun 2, 2020 17:11:10 GMT 1
Hi Joe, Well done, and nice graphics! BR Peter
|
|