Time Shooting, by Jacobo Tarrio ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This is my first Maemo application and virtually my first GTK one, too. I made it as a small trial application, to learn about programming for a GUI, and for small devices such as the Nokia 770/N800. As it is my first GUI program, there will be very big mistakes and I may have done things the wrong way, so hints and advice and improvements are very welcome. My email address is at the top of the page. Ah, and if you have a spare 770/N800, you can ask me for my snail address ;-) What the program is for ~~~~~~~~~~~~~~~~~~~~~~~~~ It is a target shooting practice timer. In a target shooting competition you have to shoot series of bullets in a given time. For example, in a 25 m. standard pistol contest there are four series of 5 bullets in 150 seconds, four of 5 bullets in 20 seconds and four of 5 bullets in 10 seconds. When you are training you want to shoot the same types of series. The long series are easy to train, as you have plenty of time and you don't usually need it all, so you can easily use your watch to time yourself. However, in the short series you have 20 or 10 seconds to raise your pistol, aim and shoot 5 bullets. If you have to fiddle with a watch or a chronometer your timing will not be accurate, plus you will be distracted and will not shoot well. So, you'd usually need a second person who will call you the orders ("ready", "go", "stop"). However, if you load this program in a handheld device and put it where it's easily visible from your shooting position, you can set it to 20 or 10 seconds and it will call you the orders at the appropriate time. The orders are currently given by setting the full screen a color and drawing a big symbol on the screen. They are: "load" (red screen with big black X), "ready" (yellow screen with big black O), "go" (green screen), "stop" (same as "ready") and "stop and unload" (white screen with big black X). The symbols make it possible for color-blind people to use the program. Using the program ~~~~~~~~~~~~~~~~~~~ In the program's main screen there is a number entry box where you can set the duration of the series, ranging from 1 to 150 seconds. Longer series can be timed very easily and accurately enough using a watch, so I did not include support for them. Below it there is a check box labeled "Wait to load weapon". If it is checked, the program will call a "load" order for 30 seconds before calling "ready". If it isn't, the program will call "ready" immediately. This checkbox gives you plenty of time to load your weapon and settle down before starting the series. Just below there is another check box, labeled "Repeat for 5 rounds". If it is checked, the program will call "go" five times, separated by 7-second "stop" calls. After the fifth "go", the program will call "stop and unload". If it is not checked, the program will call "stop and unload" after the first "go" order. This option allows you to practice the "duel" series of the 25 m. centre-fire pistol event, which consists of five shots, each one of which must be aimed and shot within 3 seconds. After pressing the "Start" button, the screen will be cleared and the first order ("load" or "ready", depending on the "Wait" checkbox) will be called. You can return to the main window at any moment by tapping on the screen. Bugs and to-do ~~~~~~~~~~~~~~~~ Digitized voices or beeps would be useful when giving the orders; in this way, the handheld device would not need to be visible; it could be anywhere on the table. A menu with presets for 25 m. standard pistol, 25 m. centre-fire pistol, etc. You choose the wanted option and the time and repeat are set automatically. There's no gettext support. Ah, the shame. I don't use autoconf/automake, but I'm not sure this is a bug. I haven't actually tried this on a real Nokia 770 or N800. See the third paragraph of this document. Making of ~~~~~~~~~~~ As I said, this is virtually my first GTK application, and actually my first Maemo application. I tried to model my program's structure on MaemoPadPlus. I haven't extracted the callback functions to separate files because they're few and short. I have not used any busy waiting. When the timer screen is visible, the program calculates when the next stage is due and sets a timeout to invalidate the screen to have it redrawn at the right time. I do not try to avoid or destroy unnecessary timeouts, so they may fire at the wrong time (but no new timeouts are created when the screen is not visible). The program is distributed under a BSD-type license, as it appears in the debian/copyright file. Jacobo Tarrio