Saturday, 14 September 2019

Multipaint 2019: ULAplus, QL, pull-down menus and more


Multipaint 2019 has been long in the making, but there are quite a lot of tiny and bit bigger new things.

Get it at http://multipaint.kameli.net/

In this blog post I'll discuss some of the new features and add background detail that wouldn't fit the webpage and the manual.


Application behaviour

The application window is no longer scaled according to the chosen target platform.

The uniform sized application window helped me get rid of the java-based dialogue box when running the application, and you will see an in-application menu for choosing the platforms.


Because of this it's also possible to change the platform (FILE / NEW MODE) on the fly, so you don't have to re-run the application just to try a different platform. Don't expect it to convert your images on the fly as yet.

In the future Multipaint will likely suggest a mode change when loading a file for different platform, it's no longer hard to do but I didn't want to do the testing now.

I have removed the application window zoom size 1 (mini) from the prefs, as supporting it became a bit problematic. Tell me if you really, really need it.

There are now more tricks to access the "prefs.txt", this may help Macintosh users who have had problems with the preferences. If Multipaint is run from terminal, it outputs file-related messages to the console, hopefully helping solve these problems in the future.

Overall the program might not be as fast as before. I changed some convoluted code to something that is easier to handle, but likely a bit slower. I was also reluctant to optimize the all-new window and menu drawing routines.


File safety

Multipaint 2019 imposes some (conventional) rules for increased safety:
  • File overwrites and mode changes will have to be confirmed.
  • Multipaint reminds you of unsaved work when loading a new file.
  • Unsaved pages are pointed out when quitting (However, see note below).
  • Using “clear all” will reset the filename.
  • You cannot UNDO past a point that would require a filename change.
A page is  “unsaved” if a tool has been used on the page, it's currently no more clever than that.


The UNDO limit may sound like an overkill but it's been the only real source of lost work for me personally. Some have reported lost work due to clicking wrong icons or window close button accidentally.

NOTE: As much as I tried, I could not get Processing/Java to reliably bypass the window close button on the exported application. The work on this continues.

In the meantime, Multipaint tries to save pages automatically on exit, the files are called multipaint_auto_page1.bin and multipaint_auto_page2.bin, saved in the Multipaint application folder.


Drawing tools and magnify mode


There are more magnify levels (5 including the full view), making the mouse wheel magnify much more fluid. It should work a bit more like you would expect in this type of program (e.g. Krita) and to me it has quickly become the standard way of zooming in and out. The old magnify tool icon and magnify keys work like they did before.

I'd go so far as to say a two-button mouse with a wheel (doubling as a middle mousebutton) is the optimal tool for using Multipaint. Well, at least that's what I'm using all the time. However, the new style interface means the program should be more useable with a drawing tablet (wacom).

I cautiously added an auto-scroll for the second phase of two-phased tools such as rectangle and line. So, if you drag these tools outside the entire Multipaint window the mag window ought to scroll a bit. I'll probably improve the panning options in the future.

You can now reset your tool options by pressing SPACE. This means if you have a cluster of switches on (mirror, recolor, dither etc), and you are not quite sure why you can't draw properly, just hit SPACE and you will get back your one-point, one-color brush with all the switches off.


Pull-down menus and interface changes

Multipaint 2019 introduces drop-down menus, much like in Amiga Deluxe Paint. (Or nearly every other application for that matter!)

With the new menus I can add options and dialogues for functions that have been a bit too well hidden. In the future, the dialogues also help in adding features that would not fit well within the icon/keypress logic. It's also a way to divide the immediate drawing tools/switches and the other functions.


Currently the menus don't do that much as I am a bit wary of crowding them with options. Also, a bit more planning may be needed for the new dialogues. As a sort of demo what will happen in the future, the Text export now opens a dialogue for export options (that also have been improved a bit).

The main toolbar can be flipped, it can be on the left or right hand side of the screen, using OTHER/SWAP SIDE. DeluxePaint had the menus at the right but most applications these days seem to favor the left side. To me the left-side felt quite natural. You choose.

As file options no longer have icons, I got more room for the remaining icons. I gave some padding around them and their groupings, which could again be helpful for drawing tablet users. I might consider reducing the amount of icons further, or making even more clear division between drawing tools and the switches.

Some functions are now in a more standard location, for example the Load/Save/Export/Import icons can be found from the top left FILE menu. Keyboard shortcuts work as usual.

Although redundant, Undo/Redo and clear-all can also be found from the menus for added comfort.  Also, select border/background etc. are added to the menus as they were not very visible. Clear background comes in two varieties, using 1st or 2nd color.

Quick flip is accessible from menu, so the image can be viewed as mirrored.

Two Commodore 64 alternate palettes (Pepto and Colodore) can be quick-accessed from the menu. Custom .ACT-format palette files can still be loaded using the Load menu option.

I added the Pipette tool as an icon, as people tended to think it does not exist at all. It does help drawing tablet users I think.


New Target Platforms: Sinclair Spectrum ULAplus and Sinclair QL

The biggest addition is the ZX Spectrum ULAplus colour enhanced mode, based on the ULAplus specification by Andrew Owen. The current ULAplus support is limited for the ZX Spectrum 32 x 24 colour resolution, and not every idea in gestation could be included. In the future, I might support the "timex" 8x1 mode.

An original ULAplus image made with Multipaint
I hesitated to add ULAplus as I've previously avoided any 'special' modes. ULAplus was interesting and compatible enough to do and has some actual support. I'll possibly discuss this in more detail in near future. Let's just say it's not an easy mode to work with!

Sinclair QL mode 8 has been promoted from a semi-supported platform into a "fully" supported platform. The mode has an approximated flat aspect ratio that cannot be turned off. I added this mode mainly because I have grown so fond of the QL.

More importantly, the QL mode represents a small step towards supporting some low resolution 16-bit modes (Atari ST 320 x 200). I've resisted this in the past as Multipaint does not really have the type of tools and interface for handling them in the best way, but the day is getting closer.

Multipaint at http://multipaint.kameli.net/



Wednesday, 4 September 2019

Atari Falcon serial transfer pt.2: Shells from hell


A continuation of the Atari Falcon/ST file transfer topic.

I've found Atari terminals to be clunky and none would do exactly what I'd want them to. Ansiterm fared the best so far, the terminal is good enough for using the command line remotely, and a Zmodem transfer will be automatically recognized when using sz from Linux end.

However, on the minus side it's one more program to launch, necessitating video mode adjustment to ST-LOW and setting up the xyz.ttp. This also distances you from the Falcon end of things.

Although this was an ok solution for one longer session, I didn't exactly like to access my Linux command line through a terminal.

As long as I can use a command line shell on the Atari end, I should also be able to call up a file via that command line. Previously, this meant launching xyz.ttp at Atari end and then typing the sz at the Linux end.

Now I tried a fun way to improve this a bit.


Mupfel shell

At Falcon end I have used the Mupfel shell, which is bourne-like enough for doing relatively complex scripts and redirecting of input/output.

I could make a small script that sends commands to the Linux by serial port, activating the sz Zmodem transfer and running the xyz.ttp Zmodem receive program at the Atari end.

But it took a while to get the Mupfel shell up and running properly, as I couldn't find that much information about how to use the shell.

Then it struck me that as the shell is a Bourne clone, people must have assumed it's nearly general knowledge anyway. So, after reading some sh guidance...

If the program file mupfel.ttp is at D:\comms\mupfel then the shell expects to find a file called 'profile' from there.

echo Mupfel
echo xyz,zip,lzh,edit,emacs
echo
PS1='%p> '
alias xyz=c:\xyz202b\xyz.ttp
alias zip=c:\stzip\zipjr.ttp
alias lzh=c:\packers\lharc\lharceng.ttp
alias edit=d:\comms\memacs\me311ata.tos
export TERM='VT52'
PATH='c:\;d:\comms\mupfel\bin\;e:\;f:\;.'
HOME='d:\comms\mupfel\'
SUFFIX='prg;app;acc;tos;ttp;mup;sh;'
LINES=30
ROWS=30

The above is an example of my 'profile' which connects various programs with aliases. The line with PS1='%p> ' makes the prompt a bit friendlier, showing the current path.

I use MicroEMACS for editing text files inside Atari, there are not many options for editors that would work well within the Atari shells. If only I'd find the way to bind those arrow-keys...

MicroEMACS requires that the environment parameter TERM is not empty, so I have 'VT52' there. Suffix should tell which files are executable but frankly it doesn't seem to do much. Not sure if LINES/ROWS are meaningful to any programs.

Well, off to the file-transfer-mobile.


The 'get' script at Atari

D:\comms\mupfel\bin\ is a good place to put a script. Mupfel scripts end with .mup extension.

From the command line, doing

echo Hello>>AUX: 

sends characters to the serial.

Saving the following as get.mup

echo get $1 >>AUX:;xyz

is enough to send over a 'command'. The characters 'get ' are sent, followed with the argument passed from the command line, and after that the shell runs xyz.

Here in my case xyz is an alias for xyz=c:\xyz202b\xyz.ttp as defined in the profile above. I guess the 'get' could be an alias too.

I spent some time making a Processing sketch that reads the serial input, sniffed for that 'get' statement and used a system call to send the required file using sz. Clunky but it worked.

However, after a bit of a think I felt this could just as well be done as a Linux bash shell script.


The 'server' script at Linux

At my Linux end, I can use a script somewhat like this:

#!/bin/bash

DEV=/dev/ttyUSB0
stty -F $DEV 57600

echo "Serial is on"
echo "use get at Atari"

while :
do
 echo -n "WAITING>";
 IFS=' ' read COMM ARG < $DEV
 if [ "$COMM" == "get" ]; then
  echo "GET:" $ARG 
  sz $ARG > $DEV < $DEV
 fi
done

The script sets the serial port to 57600 and waits for a line of characters to arrive via the serial.

After such a thing arrives, the string is split using spaces between words. The first part will be the 'command' and the latter part a 'filename' for that command.

If the command is seen to be equal to 'get' then zmodem send (sz) is launched to send the file, with a filename based on the second part of the line received from the serial port.

In the meantime the tiny get.mup script at Atari end ensures that xyz202b.ttp is launched, waiting for the Zmodem transfer.

After the file has been transfered, the Mupfel shell resumes normal operation while the script at Linux end is looping another cycle, waiting for further instructions.

So, typing get /home/user/Downloads/atarifile.zip on the Atari end the file will be received to the current folder.

I added a 'put' command for uploading files from Atari and a 'say' command for simply sending a bunch of characters to be displayed, for testing purposes.

echo put>>AUX:;xyz -u $1

and

echo say $1>>AUX:

and the respective portions to be added to the Linux bash script:

    if [ "$COMM" == "put" ]; then
        echo "PUT:"
        rz > $DEV < $DEV
    fi
    if [ "$COMM" == "say" ]; then
        echo "SAY:" $ARG
    fi



Vice Versa

Now, it might be handy for the Atari to be waiting for the files whereas the typing stuff is done on Linux? How to do the opposite of the above?

Again, in Mupfel:

while :
do
IFS=' ' read COMM ARG <AUX:
if [ $COMM = 'put' ]
then
echo 'RECEIVING'
xyz
fi
if [ $COMM = 'end' ]
then
echo 'QUIT'
exit
fi
done

I had to take a bit different approach (it's not bash) but in the end I got it working on the Mupfel shell.

(I preserved the command/arguments split although I don't do anything with the arguments really.)

Running this, it becomes possible to use the send commands exclusively from the Linux end and the files will arrive at the folder the script is run from.

I had some trouble breaking out of the loop so I added the 'end' command just to be able to stop the shell from outside.

Also, at least in this form the 'read' tended to take in the Zmodem control characters etc. and got into a mixed state having received bunch of codes but no newline. Sending a bunch of lines after the serial send sort of clears the situation, but also produces glitchy-looking messages.

Although a nice exercise, having the 'server' script at linux end might be the better solution after all. Running that script is no problem for that box, whereas the Atari would be tied with running that one loop.


Afterword

By the way, another Bourne-esque shell I dabbled with for a while is called Okami, which was good enough for launching that xyz.ttp, moving and exctracting files around. A bonus is that it's able to launch GEM programs, something Mupfel won't do.

The earlier version of Okami may be recommended, although it is a bit lacking. The later versions appear more comprehensive but they were buggy at least on my Falcon so it was virtually useless.