News : The level of daily SPAM has reached insane proportions, all registrations are now manual. I ask you to send me an e-mail (john (at) murga (dot) org), to confirm that you want me to create an account for you.


Post Reply  Post Thread 
ascii art viewer
Author Message
mikshaw
Senior Member
****


Posts: 522
Group: Registered
Joined: Apr 2007
Status: Offline
Reputation: 5
Post: #1
ascii art viewer

While working on another project I got an idea for this, so figured I'd try it out. My regular text editor (vim) isn't suited for viewing high-res ascii art as it is presently configured...I use a light foreground on a dark background, and changing font and font sizes on-the-fly isn't something I know how to do (or want to bother with). So this script loads all *.txt file names from a directory and allows you to navigate through them like a simple image browser. Fullscreen can be toggled with "f" key, forward and back are done with period and comma, and scaling the text is done with less-than and greater-than.

Due to limitations of my window manager, the fullscreen function doesn't use Fl_Window:fullscreen(), but resizes and repositions the window according to screen size. I also disable win:resizable(art) on my machine because my tiling window manager doesn't allow a non-fixed-width window to scale itself.

Other notes:
*Change asciidir to point to a directory of text files (trailing slash required).
*Set your Fl_SCREEN font to your favorite monospace font if desired (or delete that line if your system already uses an appropriate monospaced font for FL_SCREEN).
*Set mts to the font size you want for the file list (or delete that line if you like the 14px default font).
*Up and Down arrows don't work for the file list as they would normally do with Fl_Browser. This is because the behavior changed when the text display received focus. I ended up giving the display focus after every action and setting hotkeys for navigation, so the behavior should be consistent. It's another kludge, but i didn't want to spend too much time tweaking this.

I appreciate any bug testing, as well as criticism and suggestions.

The license for this script is do-whatever-you-want-with-it-just-don't-blame-me-if-it-breaks-something.

Code:
buggy code removed

This post was last modified: 12-05-2010 02:31 PM by mikshaw.

12-05-2010 06:02 AM
Find all posts by this user Quote this message in a reply
Post Reply  Post Thread 

Messages In This Thread
ascii art viewer - mikshaw - 12-05-2010 06:02 AM
RE: ascii art viewer - jpjacobs - 12-05-2010, 06:42 AM
RE: ascii art viewer - mikshaw - 12-05-2010, 08:20 AM
RE: ascii art viewer - mikshaw - 12-05-2010, 09:43 AM
RE: ascii art viewer - mikshaw - 12-05-2010, 02:30 PM
RE: ascii art viewer - jpjacobs - 12-05-2010, 11:30 PM
RE: ascii art viewer - mikshaw - 12-06-2010, 01:25 AM
RE: ascii art viewer - mikshaw - 12-06-2010, 01:44 AM
RE: ascii art viewer - mikshaw - 12-08-2010, 03:53 AM

View a Printable Version
Send this Thread to a Friend
Subscribe to this Thread | Add Thread to Favorites

Forum Jump: