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 Fri 21 Nov 2014, 12:37
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 Posts_count   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
Sub_title: 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  514 Time(s) 
pFontSelect.png
 Description   pFontSelect
 Filesize   32.12 KB
 Viewed   1639 Time(s)

pFontSelect.png


Edited_times_total
Back to top
View user's profile Send_private_message 
L18L

Joined: 19 Jun 2010
Posts: 2571
Location: Moved from Hosla to www.eussenheim.de

PostPosted: Wed 06 Jul 2011, 15:38    Post_subject: Re: BaCon Bits
Sub_title: 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   1743 Time(s)

pfontselect.png

Back to top
View user's profile Send_private_message 
vovchik


Joined: 23 Oct 2006
Posts: 1287
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: 1287
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  556 Time(s) 
Back to top
View user's profile Send_private_message 
L18L

Joined: 19 Jun 2010
Posts: 2571
Location: Moved from Hosla to www.eussenheim.de

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:
Sub_title: 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   805 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:
Sub_title: 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: 2571
Location: Moved from Hosla to www.eussenheim.de

PostPosted: Tue 12 Jul 2011, 06:13    Post_subject: sample text
Sub_title: 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   1562 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: 2571
Location: Moved from Hosla to www.eussenheim.de

PostPosted: Thu 14 Jul 2011, 12:28    Post_subject: pfontselect
Sub_title: 102
 

Thanks,
PMed back
and here is the penguin
Smile
pfontselect-102.png
 Description   
 Filesize   14.01 KB
 Viewed   1541 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
Sub_title: 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   1722 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  576 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  628 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
Sub_title: 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   765 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  487 Time(s) 
hkp.png
 Description   
 Filesize   1.14 MB
 Viewed   1725 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  622 Time(s) 

Edited_time_total
Back to top
View user's profile Send_private_message 
vovchik


Joined: 23 Oct 2006
Posts: 1287
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: 5042
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:   Sort by:   
Page 1 of 12 Posts_count   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:  

Rules_post_cannot
Rules_reply_cannot
Rules_edit_cannot
Rules_delete_cannot
Rules_vote_cannot
You cannot attach files in this forum
You can download files in this forum


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