Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Sat 02 Aug 2014, 02:35
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
BaCon Bits
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 12 [168 Posts]   Goto page: 1, 2, 3, ..., 10, 11, 12 Next
Author Message
GatorDog


Joined: 12 Sep 2006
Posts: 136

PostPosted: Wed 06 Jul 2011, 14:24    Post subject:  BaCon Bits
Subject description: Reference programs for using BaCon and HUG widgets
 

.
I started out to learn BaCon programming and the HUG widgets.
Somehow one of the sample programs I started evolved into
this program, pFontSelect. Puppy already has Gfontsel,
which will return the Font and Size. pFontSelect returns
those parameters and also the Style ie. Regular, Italic, etc.
pFontSelect also reports how many fonts are registered
on your system.

Anyway I thought this might be helpful as a reference to
using some of the HUG widgets.

rod

Please download the attachment to view the source and a compiled standalone version of program.

Edits:
Incorporated L19L and volchik suggestions.
Attached zip file of compiled pFontSelect.
--------------
Bumped version to 1.0.1
volchik massaged code into a structured form.
" added code for colored text.

Added routine to save preview text as new default text.
Changed Close button to Apply button.
Attached zip file of both source and binary.
Updated screenshot.
--------------
Updated attachment files, v1.0.3
There are a few cosmetic changes in GUI.
--------------
Changed "medium" to "light" in a gtk font statement.
Bumped to v1.0.4


______________________________________________________________________________

EDIT - More example programs in this thread:
Video-Play

HKP - Hug Keyword Parser

Start of "Hello Bacon (World)"

More Hello Bacon

Even More Hello Bacon

Still more Hello Bacon

Hello Bacon - a complete app

Bacon File I/O

Bacon port of resizepfile "Resize pup save file"
pFontselect-1.0.4.tar.gz
Description  pFontselect 1.0.4 source and Standalone compiled program
gz

 Download 
Filename  pFontselect-1.0.4.tar.gz 
Filesize  58.7 KB 
Downloaded  477 Time(s) 
pFontSelect.png
 Description   pFontSelect
 Filesize   32.12 KB
 Viewed   1490 Time(s)

pFontSelect.png


Last edited by GatorDog on Thu 03 Nov 2011, 09:27; edited 8 times in total
Back to top
View user's profile Send private message 
L18L

Joined: 19 Jun 2010
Posts: 2505
Location: Burghaslach, Germany somewhere also known as "Hosla"

PostPosted: Wed 06 Jul 2011, 15:38    Post subject: Re: BaCon Bits
Subject description: pFontSelect - reference program for using BaCon and HUG widgets
 

GatorDog wrote:
I tried attaching the source ".bac" and the compiled prg but the Post editor said "extension not allowed" for both of them.

gzip program
unzipped by clicking Smile

Very nice, compiled in 6 seconds
Just 1 comment for now: the buttons need more width (I used to give them 120px)
Thank you
pfontselect.png
 Description   
 Filesize   4.99 KB
 Viewed   1576 Time(s)

pfontselect.png

Back to top
View user's profile Send private message 
vovchik


Joined: 23 Oct 2006
Posts: 1285
Location: Ukraine

PostPosted: Wed 06 Jul 2011, 16:23    Post subject: Very nice  

Dear Rod,

Nice work. My suggestion is to change your font_list$ = EXEC$ line to:

Code:
font_list$ = REPLACE$(EXEC$("fc-list | cut -d':' -f1 | sort | cut -d',' -f1 | uniq"),"\\-","-")


The reason is that "fc-list" will give you an escaped hyphen if the internal ttf name contains a hyphen. The font name will show in the list but the real font won't display (i.e. no real glyphs).

With kind regards,
vovchik
Back to top
View user's profile Send private message 
GatorDog


Joined: 12 Sep 2006
Posts: 136

PostPosted: Wed 06 Jul 2011, 22:31    Post subject:  

I've incorporated your suggestions in the first post's
code. I used a button width of 100. 120 seemed
a little excessive for those two buttons. Try
that size and see if it is addequate for you.

I don't currently have a font with a hyphen. If you do
you might check that out.

Other than being a tad bit wider to accommodate the
buttons, the app looks the same.

Thanks Wink L18L and volchik

rod
Back to top
View user's profile Send private message 
vovchik


Joined: 23 Oct 2006
Posts: 1285
Location: Ukraine

PostPosted: Thu 07 Jul 2011, 02:31    Post subject: Weird font names  

Dear Rod,

You will see why the REPLACE$ mod is needed if you install the attached font (just unpack and copy into HOME$/.fonts). There might be other "escaped chars" generated by fc-list, too, but this is the first one I came upon.

With kind regards,
vovchik
N_E_B.TTF.tar.gz
Description 
gz

 Download 
Filename  N_E_B.TTF.tar.gz 
Filesize  8.42 KB 
Downloaded  522 Time(s) 
Back to top
View user's profile Send private message 
L18L

Joined: 19 Jun 2010
Posts: 2505
Location: Burghaslach, Germany somewhere also known as "Hosla"

PostPosted: Thu 07 Jul 2011, 11:54    Post subject:  

GatorDog wrote:
Try that size and see if it is addequate for you.

Yes, it is Exclamation

The red and green squares animating the buttons are very nice.

BTW, I have compared pFontSelect to yad --font, gfontselect,...
pFontSelect has the advantage of changing sizes "step 1" Smile
Back to top
View user's profile Send private message 
GatorDog


Joined: 12 Sep 2006
Posts: 136

PostPosted: Thu 07 Jul 2011, 22:17    Post subject:
Subject description: Anomoly
 

I tested pFontSelect on another Linux OS. The app title
in the top frame (not the window title) did not appear.
I checked and that system did not have the "cursor" font
that puppy 525 has. So I changed the title font to a
common one, DejaVu Sans.

The title was still blank, and if I selected the same
combination for font description, the pre-view text
would disappear.

After several hours of hacking I chanced upon this fix.
Code:
junk_label = MARK("", 10, 10)
FONT(junk_label, "DejaVu Sans:Regular 6")
ATTACH(mainwin, junk_label, 0,0)

The construction "Font name COLON Style SPACE size"
ie "Font name:Style N" seems to be the only syntax
that works.

I put it in a SUB called "SUB_sync_font_description"
and call it before printing with any HUG widgets.

The sub addition is incorporated in the program listing
in the first post. And a new binary attached.

To try it, comment out the "SUB_sync_font_description" call.
Compile and run. Select DejaVu Sans Italic 18 and see if
the preview text and the app title both disappear.

rod
pFS.png
 Description   With and without "font sync" fix
 Filesize   52.93 KB
 Viewed   634 Time(s)

pFS.png

Back to top
View user's profile Send private message 
GatorDog


Joined: 12 Sep 2006
Posts: 136

PostPosted: Tue 12 Jul 2011, 00:51    Post subject:
Subject description: pFontSelect updated
 

A few mods, mostly behind the curtain things.

Bumped version to 1.0.1
volchik massaged code into a structured form.
" added code for colored text.

Added routine to save preview text as new default text.
Changed Close button to Apply button.
Attached zip file of both source and binary.
Updated screenshot.

New pFontSelect.bac in 1st post

rod
Back to top
View user's profile Send private message 
L18L

Joined: 19 Jun 2010
Posts: 2505
Location: Burghaslach, Germany somewhere also known as "Hosla"

PostPosted: Tue 12 Jul 2011, 06:13    Post subject: sample text
Subject description: pFontSelect updated
 

GatorDog wrote:
...
Added routine to save preview text as new default text...

Hi, this looks very very nice!
I am glad that you are thinking about greek, cyrillic ....

There are sample text phrases for some languages and I have played with Spanish, see screenshot.
I suggest you make the text display in more than just 1 line.

The samples are taken from quickbrown.txt see

Markus Kuhn wrote:
Sentences that contain all letters commonly used in a language
--------------------------------------------------------------

Markus Kuhn <http://www.cl.cam.ac.uk/~mgk25/> -- 2007-02-08

This file is UTF-8 encoded.


Danish (da)
---------

Quizdeltagerne spiste jordbær med fløde, mens cirkusklovnen
Wolther spillede på xylofon.
(= Quiz contestants were eating strawbery with cream while Wolther
the circus clown played on xylophone.)

German (de)
-----------

Falsches Üben von Xylophonmusik quält jeden größeren Zwerg
(= Wrongful practicing of xylophone music tortures every larger dwarf)

Zwölf Boxkämpfer jagten Eva quer über den Sylter Deich
(= Twelve boxing fighters hunted Eva across the dike of Sylt)

Heizölrückstoßabdämpfung
(= fuel oil recoil absorber)
(jqvwxy missing, but all non-ASCII letters in one word)

Greek (el)
----------

Γαζέες καὶ μυρτιὲς δὲν θὰ βρῶ πιὰ στὸ χρυσαφὶ ξέφωτο
(= No more shall I see acacias or myrtles in the golden clearing)
{cut off}
this file is also included in my ucs-fonts-target3.pet see http://murga-linux.com/puppy/viewtopic.php?t=68501

You could let these preview texts let automatically appear dependent of user´s language and this can be built in the internationalization of your program. I could do it for you or help if you like. Smile

Thanks for the update
pfontselect-101.png
 Description   
 Filesize   31.78 KB
 Viewed   1440 Time(s)

pfontselect-101.png

Back to top
View user's profile Send private message 
GatorDog


Joined: 12 Sep 2006
Posts: 136

PostPosted: Wed 13 Jul 2011, 12:49    Post subject:  

L18L,

I'll pm you with current .bac file that has a few tweaks I'm working on.

rod
Back to top
View user's profile Send private message 
L18L

Joined: 19 Jun 2010
Posts: 2505
Location: Burghaslach, Germany somewhere also known as "Hosla"

PostPosted: Thu 14 Jul 2011, 12:28    Post subject: pfontselect
Subject description: 102
 

Thanks,
PMed back
and here is the penguin
Smile
pfontselect-102.png
 Description   
 Filesize   14.01 KB
 Viewed   1375 Time(s)

pfontselect-102.png

Back to top
View user's profile Send private message 
GatorDog


Joined: 12 Sep 2006
Posts: 136

PostPosted: Tue 19 Jul 2011, 01:41    Post subject: Video-Play
Subject description: BaCon example of using FILEDIALOG
 

Video-Play - A BaCon example program.
This program is mainly an example of using the FILEDIALOG file browser.

Features:
Quote:

- Use the filebrowser to pick the video file to play.
- Edit the Mplayer command line and click "Play" to try it out.
- Clicking "Close" or "Play" saves the edited command line and
filename. They will be reloaded the next time Video-Play is run.
- "Restore Default" restores the original Mplayer command line.
- "Cancel" exit/quit.


These are the filtered filetypes:
Quote:

avi, AVI, aaf, AAF, amv, AMV, amx, arf, asf, , ASF, asx, avs, AVS
bsf, cpi, d2v, dat, divx DIVX, dmb, dpg, dv-avi, dvdmedia, dvr, dvr-ms
dvx, DVX, f4v, flv, FLV, gvi, gvp, h264, hdmov, ifo, k3g, m2t, m2ts
m2v, m4v, mgv, mjp, mkv, mnv, mod, moov, mov, MOV, mp4, MP4, mpeg
MPEG, mpg, MPT, mpv, msdvd, mts, ogv, pgi, pmf, pva, qt, qtm, rm, rv
swf, SWF, tivo, vid, vob, VOB, vro, webm, wmv, WMV, wtv, xvid, yuv
264, 3gp, 3g2


video-play-sa.tar.gz is compiled standalone app. It should not require devx.sfs
video-play.bac.tar.gz is the BaCon source file.

rod
video-play.png
 Description   screen shot
 Filesize   354.71 KB
 Viewed   1582 Time(s)

video-play.png

video-play-sa.tar.gz
Description  Compiled app video-play
gz

 Download 
Filename  video-play-sa.tar.gz 
Filesize  42.24 KB 
Downloaded  542 Time(s) 
video-play.bac.tar.gz
Description  BaCon source for video-play
gz

 Download 
Filename  video-play.bac.tar.gz 
Filesize  2.77 KB 
Downloaded  583 Time(s) 
Back to top
View user's profile Send private message 
GatorDog


Joined: 12 Sep 2006
Posts: 136

PostPosted: Mon 25 Jul 2011, 14:23    Post subject: HKP - Hug Keyword Parser
Subject description: BaCon example of using FILEDIALOG EDITDIALOG MSGDIALOG
 

This program is an example of using EDITDIALOG, MSGDIALOG & FILEDIALOG.

If you use hug_imports.bac while developing and want the final app
to use hug.bac, keyword_list...

Hug Keyword Parser - Parses a Bacon source.bak file for HUG keywords.
Displays a new INCLUDE "/path/hug.bac", list_of_keywords In an Edit window.
Then you can copy/paste the Include line into your program.

rod

Edit: I'm using BaCon GUI v 1.0.24 / hug.bac v.61+

- Latest Version 2.1 source attached. Added Direct Import statements from hug_imports.bac
hkp-2.1.png
 Description   
 Filesize   48.61 KB
 Viewed   629 Time(s)

hkp-2.1.png

HKP-HugKeywordParser-2.1.tar.gz
Description  HKP 2.1 Bacon source
gz

 Download 
Filename  HKP-HugKeywordParser-2.1.tar.gz 
Filesize  6.57 KB 
Downloaded  450 Time(s) 
hkp.png
 Description   
 Filesize   1.14 MB
 Viewed   1622 Time(s)

hkp.png

hkp.tar.gz
Description  Hug Keyword Parser source 1.0r1
gz

 Download 
Filename  hkp.tar.gz 
Filesize  4.52 KB 
Downloaded  585 Time(s) 

Last edited by GatorDog on Thu 03 Nov 2011, 08:34; edited 1 time in total
Back to top
View user's profile Send private message 
vovchik


Joined: 23 Oct 2006
Posts: 1285
Location: Ukraine

PostPosted: Tue 26 Jul 2011, 11:51    Post subject: hug keyword parser  

Dear Rod,

Nice job. It is immediately useful. Thanks.

With kind regards,
vovchik
Back to top
View user's profile Send private message 
sunburnt


Joined: 08 Jun 2005
Posts: 5010
Location: Arizona, U.S.A.

PostPosted: Fri 29 Jul 2011, 13:13    Post subject:  

I read in the forum that Barry has included BaCon in Puppy.
I`m running 5.11, which version has it?

I noticed at the BaCon web site a lot of addons, some for GTK+.
BaCon could turn out to be a good replacement for gtkDialog.
# Addendum: Looking at the GTK+ examples, it`s very code intensive.
# A converter needs to be written in BaCon to reduce the required code.
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 12 [168 Posts]   Goto page: 1, 2, 3, ..., 10, 11, 12 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0984s ][ Queries: 13 (0.0096s) ][ GZIP on ]