|
Post by bigbass on May 5, 2020 14:24:24 GMT 1
Hello Peter All is well I tested with the latest fossil and all works correctly! -------------------------------------- I think that having an automatic way of of adding the libs is fine (auto pilot is flying the plane) enjoy the flight have a cup of coffee as long as we can still do a manual override going though some bad weather and requested to follow ground control's special instructions deactivate auto pilot PRAGMA LDFLAGS -Wl,--no-as-needed TRUE thanks for the comfort that I can safely add all the libs like in c without the -l prefix that's nice to know and feels and looks better to me also I will do this from now on Joe everything is moving along nicely I know you're very busy but when you have free time any way to port just this line to BaCon it works like this as is hello5-uil.tar.gz (1.96 KB) '--- this strange it is not a second leave callback it is a way to define the string '--- inside the uid for the callback to be registered with the main code USEH void leave(); MrmRegisterArg callback_list[] = {{ "leave", (XtPointer) leave },}; ENDUSEH
|
|
|
Post by Pjot on May 5, 2020 18:37:39 GMT 1
Thanks bigbass,
Good to hear it works out. Regarding that last line, the 'void leave();' should be there, as it announces the prototype to C.
BaCon does the same thing with all the defined SUBS and FUNCTIONS, just to let the compiler know what kind of functions to expect in the program.
BR Peter
|
|
|
Post by vovchik on May 5, 2020 19:36:27 GMT 1
Dear Joe (and Peter), To avoid a warning I am getting in Joe's hello_world5 example (on Mint), why not do this: '================================================ SUB leave(w, client_data, call_data) '================================================ LOCAL s$ TYPE STRING s$ = (char*)client_data 'PRINT s$ FORMAT "%s\n" PRINT s$ END SUB It works fine now. Thanks! With kind regards, vovchik
|
|
|
Post by bigbass on May 11, 2020 6:59:54 GMT 1
here is another port and a command line image viewer in motif command line code comes in handy too
It was made for bitmap and xpm but it also loads .png
./show-img your.xpm ./show-img your.png
just showing the simple widgets as we go Peter made a complete viewer based off this type of widget
'---show-img.bac PRAGMA INCLUDE <Xm/MainW.h> PRAGMA INCLUDE <Xm/Label.h> PRAGMA LDFLAGS Xm PRAGMA LDFLAGS Xt PRAGMA LDFLAGS X11 OPTION PARSE FALSE DECLARE toplevel TYPE Widget
DECLARE app TYPE XtAppContext DECLARE label TYPE Widget DECLARE main_w TYPE Widget DECLARE pixmap TYPE Pixmap
XtSetLanguageProc(NULL, NULL, NULL)
toplevel = XtVaAppInitialize (&app, "Demos",NULL, 0, &argc, argv, NULL, NULL)
IF argv[1] == NULL THEN printf ("usage: %s bitmap-file or .xpm or .png\n", *argv) END END IF
main_w = XtVaCreateManagedWidget ("main_window", xmMainWindowWidgetClass, \ toplevel, XmNscrollBarDisplayPolicy, XmAS_NEEDED, XmNscrollingPolicy, XmAUTOMATIC, NULL)
'---Load bitmap given in argv[1] pixmap = XmGetPixmap (XtScreen (toplevel), argv[1], BlackPixelOfScreen \ (XtScreen (toplevel)),WhitePixelOfScreen (XtScreen (toplevel)))
IF pixmap == XmUNSPECIFIED_PIXMAP THEN printf ("can't create pixmap from %s\n", argv[1]) END END IF
'--- Now create label using pixmap label = XtVaCreateManagedWidget ("label", xmLabelWidgetClass, \ main_w, XmNlabelType, XmPIXMAP, XmNlabelPixmap, pixmap, NULL)
' set the label as the "work area" of the main window XtVaSetValues (main_w, XmNworkWindow, label, NULL)
XtRealizeWidget (toplevel) XtAppMainLoop (app)
|
|
|
Post by vovchik on May 11, 2020 9:18:15 GMT 1
Dear Joe,
Thanks. Works like a charm with xpm but has some problem with bit depth in respect of some pngs - I am looking into that. And, I discovered that it also displays jpg files just fine, too.
With kind regards, vovchik
|
|
|
Post by bigbass on May 11, 2020 17:29:16 GMT 1
vovchik thanks for testing and the feed back here is another within a window this time (we both may be pushing what the original code can do using png and nice jpg can work!) I would have to see the limits that were set to figure out why some work and others no and where it breaks Objective: Any widget is greatly improved by color and image if we can get this worked out all the widgets can be beautified (this is still ugly because its suppose to be the simple demo) just showing the minimum at this stage with the focus of porting to BaCon and connecting all the dots so that it can see the low level code values '--- ported using the Draw Button to BaCon by bigbass PRAGMA INCLUDE <Xm/DrawnB.h> PRAGMA INCLUDE <Xm/BulletinB.h> PRAGMA INCLUDE <Xm/Label.h> PRAGMA INCLUDE <stdio.h>
PRAGMA LDFLAGS Xm Xt X11
OPTION PARSE FALSE DECLARE toplevel TYPE Widget
DECLARE app TYPE XtAppContext DECLARE label ,bb ,button TYPE Widget DECLARE pixmap TYPE Pixmap DECLARE fg, bg TYPE Pixel DECLARE ht, st TYPE Dimension
'---a prototype declare workaround DECLARE my_callback(Widget, XtPointer, XtPointer) TYPE void
XtSetLanguageProc (NULL, NULL, NULL)
toplevel = XtVaOpenApplication (&app, "Demos", NULL, 0, \ &argc, argv, NULL, sessionShellWidgetClass, NULL)
bb = XmCreateBulletinBoard (toplevel, "bb", NULL, 0) XtVaGetValues (bb, XmNforeground, &fg, XmNbackground, &bg, NULL) pixmap = XmGetPixmap (XtScreen (bb), "xlogo64", fg, bg) button = XmCreateDrawnButton (bb, "button", NULL, 0) XtManageChild (button)
XtVaGetValues (button, XmNhighlightThickness, \ &ht, XmNshadowThickness, &st, NULL) XtVaSetValues (button, XmNwidth, 2 * ht + 2 * st + 64, \ XmNheight, 2 * ht + 2 * st + 64, NULL)
XtAddCallback (button, XmNactivateCallback, my_callback, NULL) XtAddCallback (button, XmNexposeCallback, my_callback, NULL) XtAddCallback (button, XmNresizeCallback, my_callback, NULL)
XtManageChild (bb) XtRealizeWidget (toplevel) XtAppMainLoop (app)
'================================================= SUB my_callback (Widget w, XtPointer client_data, XtPointer call_data) '================================================= LOCAL cbs TYPE XmDrawnButtonCallbackStruct* cbs = call_data
IF cbs->reason == XmCR_ACTIVATE THEN printf("%s: pushed %d times\n", XtName (w), cbs->click_count) ELIF cbs->reason == XmCR_EXPOSE THEN Dimension ht, st
XtVaGetValues(w, XmNhighlightThickness, &ht,XmNshadowThickness, &st, NULL) XtVaSetValues(w, XmNwidth, 2 * ht + 2 * st + 64,XmNheight, \ 2 * ht + 2 * st + 64, NULL)
XCopyArea(XtDisplay (w), pixmap, XtWindow (w), \ XDefaultGCOfScreen (XtScreen (w)), 0, 0, 64, 64, ht + st, ht + st) END IF END SUB
|
|
|
Post by bigbass on May 12, 2020 2:52:01 GMT 1
Hello vovchik I am looking here www.ist.co.uk/motif/books/vol6A/ch-3.fm.html#4240I am looking for solutions too and if you have the data we will sort it out quicker search that for Pixmaps and XmGetPixmapByDepth()the third hit in the search there is a lot of info to sort though but I think we can improve on the image loading if we put some effort into it Joe
|
|
|
Post by bigbass on May 13, 2020 16:47:43 GMT 1
Hello vovchik Update www.libpng.org/pub/png/apps/pngcheck.htmlto validate png format I compiled using geany for this because the make file didn't work for me gcc -Wall -c "%f" -lz -lX11 gcc -Wall -o "%e" "%f" -lz -lX11 I avoid binary blobs so that is the source code I used from sourceforge and the compile lines it does compile on the RPI3 this will give us a better Idea why some will work and others are not supported pi@raspberrypi:~/Desktop/MOTIF/clean $ ./pngcheck bacon-wave2.png OK: bacon-wave2.png (448x256, 32-bit RGB+alpha, non-interlaced, 79.9%).
more info with ./pngcheck -vt bacon-wave2.png
|
|
|
Post by vovchik on May 13, 2020 18:22:18 GMT 1
Dear Joe, Thanks - I have a few problems getting that to compile on my Mint 19.2, but we might have another homebrew solution. A while back I wrote imgsz, which uses stb to get back the image size (lots of formats). Since stb knows about bit depth, I think we can coax out the other info from of stb, too. Here is the old original, along with the single stb file, in the archive. It compiles and runs fine on Mint and Pi. With kind regards, vovchikl Attachments:imgsz.bac.tar.gz (61.33 KB)
|
|
|
Post by bigbass on May 14, 2020 2:29:18 GMT 1
thanks for the imgsz app and header I was reading though the header it covers many image formats and seems more hackable to display what you need
what I posted is to set some limits on which pings(pngs) we could use in motif before it crashes and it already does an integrity test
also now that of today we can also use gtk your approach would be better to use many image types
Thanks
Joe
|
|