1#
2# This file is part of:
3#
4#  gpsman --- GPS Manager: a manager for GPS receiver data
5#
6# Copyright (c) 1998-2013 Miguel Filgueiras migfilg@t-online.de
7#
8#    This program is free software; you can redistribute it and/or modify
9#      it under the terms of the GNU General Public License as published by
10#      the Free Software Foundation; either version 3 of the License, or
11#      (at your option) any later version.
12#
13#      This program is distributed in the hope that it will be useful,
14#      but WITHOUT ANY WARRANTY; without even the implied warranty of
15#      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16#      GNU General Public License for more details.
17#
18#      You should have received a copy of the GNU General Public License
19#      along with this program.
20#
21#  File: symbols.tcl
22#  Last change:  6 October 2013
23#
24
25## GPSMan symbols and display options
26
27# names for symbols used by GPSMan (mostly taken from Garmin
28#  GPS Interface Specification version 1, revisions 2, A and B; and from
29#  the set used by Lowrance receivers, provided by Brian Baulch)
30
31# user defined symbols:
32#  - shown as $DEFAULTSYMBOL or WP_dot
33#  - represented as   user:REPR  where REPR is the brand-dependent
34#   representation
35#  - are not shown in symbol menus
36
37# icons will have either 15x15 or 30x30 pixels depending on the user
38#  option $ICONSIZE
39#
40# icon images are distributed as 15x15 pixels GIFs, 30x30 ones being
41#  obtained by Tk image zooming
42#
43# a small number of icons is defined also as bitmaps below, in both
44#  sizes, to avoid errors if the GIFs are missing
45
46 # these values are used in forming the GIF files names and are then
47 #  set depending on $ICONSIZE
48set ICONWIDTH 15
49set ICONHEIGHT 15
50
51# GPSMan symbol names and their categories (not mutually exclusive)
52#  user:REPR  is used for user-defined ones
53
54set SYMBOLS {
55    1st_aid
56    MOB
57    RV_park
58    WP_buoy_white
59    WP_dot
60    airport
61    amusement_park
62    anchor
63    anchor_prohib
64    avn_danger
65    avn_faf
66    avn_lom
67    avn_map
68    avn_ndb
69    avn_tacan
70    avn_vor
71    avn_vordme
72    avn_vortac
73    bait_tackle
74    ball
75    beach
76    beacon
77    bell
78    biker
79    boat
80    boat_ramp
81    border
82    bot_cond
83    bowling
84    box_blue
85    box_green
86    box_red
87    bridge
88    building
89    buoy_amber
90    buoy_black
91    buoy_blue
92    buoy_green
93    buoy_green_red
94    buoy_green_white
95    buoy_orange
96    buoy_red
97    buoy_red_green
98    buoy_red_white
99    buoy_violet
100    buoy_white
101    buoy_white_green
102    buoy_white_red
103    camping
104    capitol_city
105    car
106    car_rental
107    car_repair
108    casino
109    castle
110    cemetery
111    chapel
112    church
113    circle_blue
114    circle_green
115    circle_red
116    circle_x
117    civil
118    cntct_afro
119    cntct_alien
120    cntct_ball_cap
121    cntct_big_ears
122    cntct_biker
123    cntct_bug
124    cntct_cat
125    cntct_dog
126    cntct_dreads
127    cntct_female1
128    cntct_female2
129    cntct_female3
130    cntct_goatee
131    cntct_kung_fu
132    cntct_pig
133    cntct_pirate
134    cntct_ranger
135    cntct_smiley
136    cntct_spike
137    cntct_sumo
138    coast_guard
139    controlled
140    cross
141    cross_3p
142    crossing
143    dam
144    danger
145    deer
146    diamond_blue
147    diamond_green
148    diamond_red
149    diver_down_1
150    diver_down_2
151    dock
152    dollar
153    dot
154    drinking_water
155    dropoff
156    duck
157    elevation
158    exit
159    exit_no_serv
160    factory
161    fastfood
162    fhs_facility
163    fish
164    fitness
165    flag
166    flag_pin_blue
167    flag_pin_green
168    flag_pin_red
169    freeway
170    fuel
171    fuel_store
172    geo_name_land
173    geo_name_man
174    geo_name_water
175    geocache
176    geocache_fnd
177    glider
178    golf
179    heliport
180    horn
181    house
182    house_2
183    hydrant
184    ice_skating
185    info
186    intersection
187    is_highway
188    knife_fork
189    ladder
190    landing
191    large_city
192    large_exit_ns
193    large_ramp_int
194    letter_a_blue
195    letter_a_green
196    letter_a_red
197    letter_b_blue
198    letter_b_green
199    letter_b_red
200    letter_c_blue
201    letter_c_green
202    letter_c_red
203    letter_d_blue
204    letter_d_green
205    letter_d_red
206    levee
207    light
208    lodging
209    many_fish
210    many_tracks
211    marina
212    mark_x
213    medium_city
214    mile_marker
215    military
216    mine
217    monument
218    mountains
219    movie
220    mug
221    museum
222    ntl_highway
223    null
224    null_2
225    number_0_blue
226    number_0_green
227    number_0_red
228    number_1_blue
229    number_1_green
230    number_1_red
231    number_2_blue
232    number_2_green
233    number_2_red
234    number_3_blue
235    number_3_green
236    number_3_red
237    number_4_blue
238    number_4_green
239    number_4_red
240    number_5_blue
241    number_5_green
242    number_5_red
243    number_6_blue
244    number_6_green
245    number_6_red
246    number_7_blue
247    number_7_green
248    number_7_red
249    number_8_blue
250    number_8_green
251    number_8_red
252    number_9_blue
253    number_9_green
254    number_9_red
255    oil_field
256    open_24hr
257    oval_blue
258    oval_green
259    oval_red
260    parachute
261    park
262    parking
263    pharmacy
264    phone
265    picnic
266    pin_blue
267    pin_green
268    pin_red
269    pizza
270    police
271    post_office
272    private
273    radio_beacon
274    ramp_int
275    rect_blue
276    rect_green
277    rect_red
278    reef
279    restricted
280    restrooms
281    scenic
282    school
283    seaplane
284    shopping_cart
285    short_tower
286    showers
287    skiing
288    skull
289    small_city
290    snow_skiing
291    soft_field
292    square_blue
293    square_green
294    square_red
295    st_highway
296    stadium
297    store
298    street_int
299    stump
300    summit
301    swimming
302    take_off
303    tall_tower
304    theater
305    tide_pred_stn
306    toll
307    tow_truck
308    traceback
309    tracks
310    trail_head
311    tree
312    triangle_blue
313    triangle_green
314    triangle_red
315    truck_stop
316    tunnel
317    ultralight
318    us_highway
319    weedbed
320    weight_station
321    wreck
322    zoo
323}
324
325set UNKNOWNSYMBOLS ""
326
327    # high-level description of symbol menus: list of lists with symbol
328    #  internal names or elements of the one of the forms ==TEXT or =INDEX,
329    #  giving the title for a sub-menu (as literal text or index in TXT),
330    #  followed by a sub-list describing the sub-menu
331
332    # symbol default menu: assumed in proc SymbolCustomMenu to have a
333    #  sub-menu for each category and nothing else at top-level and titles
334    #  given by =INDEX
335set SYDEFTMENU {=SYCATgeneral
336    {WP_dot  danger skull  bell flag flag_pin_blue
337        flag_pin_green  flag_pin_red traceback dollar
338	null null_2 ball dot  cross cross_3p mark_x circle_x
339	diamond_blue diamond_green diamond_red
340	square_blue  square_green  square_red box_blue  box_green  box_red
341	pin_blue  pin_green  pin_red
342	circle_red circle_green circle_blue
343	oval_red oval_green oval_blue
344	rect_red rect_green rect_blue
345	triangle_blue triangle_green triangle_red
346	letter_a_red letter_b_red letter_c_red letter_d_red
347	letter_a_green letter_c_green letter_b_green letter_d_green
348	letter_a_blue  letter_b_blue   letter_c_blue   letter_d_blue
349	number_0_red    number_1_red    number_2_red    number_3_red
350	number_4_red    number_5_red    number_6_red    number_7_red
351	number_8_red    number_9_red    number_0_green    number_1_green
352	number_2_green    number_3_green    number_4_green    number_5_green
353	number_6_green    number_7_green    number_8_green    number_9_green
354	number_0_blue    number_1_blue    number_2_blue    number_3_blue
355	number_4_blue    number_5_blue    number_6_blue    number_7_blue
356	number_8_blue    number_9_blue
357	cntct_smiley    cntct_ball_cap    cntct_big_ears    cntct_spike
358	cntct_goatee    cntct_afro    cntct_dreads    cntct_female1
359	cntct_female2    cntct_female3    cntct_ranger    cntct_kung_fu
360	cntct_sumo    cntct_pirate    cntct_biker    cntct_alien
361	cntct_bug    cntct_cat    cntct_dog    cntct_pig}
362    =SYCATland
363    {1st_aid    info
364	small_city    medium_city    large_city    capitol_city
365	car     car_rental    car_repair  tow_truck   biker
366	restrooms    pharmacy    phone   post_office   police   hydrant
367	tunnel   bridge    dam  levee    mountains  elevation  summit  ladder
368	trail_head   tracks    many_tracks
369	tree    deer    duck    fish  many_fish
370	parking    house  house_2  building  lodging
371	park   castle    monument    church chapel  cemetery
372	museum    zoo    theater   casino
373	scenic  airport  factory  mine  oil_field
374	knife_fork    fastfood     mug    pizza  movie
375	school    shopping_cart   store   stadium
376	amusement_park    beach         swimming    showers    skiing
377	golf   bowling    fitness  snow_skiing   ice_skating
378	picnic    camping    drinking_water   geocache    geocache_fnd
379	RV_park   fuel    fuel_store  horn     exit    exit_no_serv
380	large_exit_ns     mile_marker   border
381	toll    freeway     ntl_highway  is_highway    st_highway    us_highway
382	street_int    ramp_int    large_ramp_int   crossing
383	truck_stop    weight_station
384	parachute     glider   ultralight tall_tower     short_tower
385	take_off      landing
386	geo_name_land    geo_name_man    geo_name_water
387	civil   military}
388    =SYCATwater
389    {anchor  anchor_prohib   beacon   reef   stump weedbed  dropoff
390	dock    marina  coast_guard  tide_pred_stn boat    boat_ramp
391	fish   many_fish
392	fuel    light    MOB    beach    swimming    wreck dam     mile_marker
393	radio_beacon    WP_buoy_white    buoy_amber
394	buoy_black    buoy_blue    buoy_green    buoy_green_red
395	buoy_green_white    buoy_orange    buoy_red    buoy_red_green
396	buoy_red_white    buoy_violet    buoy_white    buoy_white_green
397	buoy_white_red    diver_down_1    diver_down_2
398	open_24hr  fhs_facility  bot_cond  bait_tackle}
399    =SYCATaviation
400    {airport     heliport    private   seaplane    soft_field
401	landing  take_off    radio_beacon   avn_danger avn_faf  avn_lom
402	avn_map    avn_ndb   avn_tacan    avn_vor    avn_vordme    avn_vortac
403	controlled   restricted    intersection
404	parachute     glider   ultralight tall_tower     short_tower}
405}
406
407# GPSMan display options
408
409set DISPOPTS {symbol s_name s_comment name comment}
410
411# images that must be defined because the symbols are used by GPSMan
412#  must have an internal definitions as 15x15 and 30x30 bitmaps
413# there is a frame image as 17x17 and 34x34 bitmaps
414# this must be changed if initial values of $ICONWIDTH or $ICONHEIGHT change
415
416 # both WP_dot and interr are assumed to be in this list
417set DEFINEIMGS {WP_dot diamond_green diamond_red MOB interr}
418
419array set INTERNALIMG {
420    frame,dims    17x17
421    frame,fg      red
422    frame {
423#define fr_width 17
424#define fr_height 17
425static unsigned char fr_bits[] = {
426   0xff, 0xff, 0x01, 0xff, 0xff, 0x01, 0x03, 0x80, 0x01, 0x03, 0x80, 0x01,
427   0x03, 0x80, 0x01, 0x03, 0x80, 0x01, 0x03, 0x80, 0x01, 0x03, 0x80, 0x01,
428   0x03, 0x80, 0x01, 0x03, 0x80, 0x01, 0x03, 0x80, 0x01, 0x03, 0x80, 0x01,
429   0x03, 0x80, 0x01, 0x03, 0x80, 0x01, 0x03, 0x80, 0x01, 0xff, 0xff, 0x01,
430   0xff, 0xff, 0x01};
431    }
432    frame,2,dims  34x34
433    frame,2 {
434#define fr_width 34
435#define fr_height 34
436static unsigned char fr_bits[] = {
437   0xff, 0xff, 0xff, 0xff, 0x03, 0xff, 0xff, 0xff, 0xff, 0x03, 0xff, 0xff,
438   0xff, 0xff, 0x03, 0xff, 0xff, 0xff, 0xff, 0x03, 0x0f, 0x00, 0x00, 0xc0,
439   0x03, 0x0f, 0x00, 0x00, 0xc0, 0x03, 0x0f, 0x00, 0x00, 0xc0, 0x03, 0x0f,
440   0x00, 0x00, 0xc0, 0x03, 0x0f, 0x00, 0x00, 0xc0, 0x03, 0x0f, 0x00, 0x00,
441   0xc0, 0x03, 0x0f, 0x00, 0x00, 0xc0, 0x03, 0x0f, 0x00, 0x00, 0xc0, 0x03,
442   0x0f, 0x00, 0x00, 0xc0, 0x03, 0x0f, 0x00, 0x00, 0xc0, 0x03, 0x0f, 0x00,
443   0x00, 0xc0, 0x03, 0x0f, 0x00, 0x00, 0xc0, 0x03, 0x0f, 0x00, 0x00, 0xc0,
444   0x03, 0x0f, 0x00, 0x00, 0xc0, 0x03, 0x0f, 0x00, 0x00, 0xc0, 0x03, 0x0f,
445   0x00, 0x00, 0xc0, 0x03, 0x0f, 0x00, 0x00, 0xc0, 0x03, 0x0f, 0x00, 0x00,
446   0xc0, 0x03, 0x0f, 0x00, 0x00, 0xc0, 0x03, 0x0f, 0x00, 0x00, 0xc0, 0x03,
447   0x0f, 0x00, 0x00, 0xc0, 0x03, 0x0f, 0x00, 0x00, 0xc0, 0x03, 0x0f, 0x00,
448   0x00, 0xc0, 0x03, 0x0f, 0x00, 0x00, 0xc0, 0x03, 0x0f, 0x00, 0x00, 0xc0,
449   0x03, 0x0f, 0x00, 0x00, 0xc0, 0x03, 0xff, 0xff, 0xff, 0xff, 0x03, 0xff,
450   0xff, 0xff, 0xff, 0x03, 0xff, 0xff, 0xff, 0xff, 0x03, 0xff, 0xff, 0xff,
451   0xff, 0x03 };
452    }
453    SYMBOL,dims   15x15
454    SYMBOL,2,dims 30x30
455    WP_dot,fg     red
456    WP_dot {
457#define dot_width 15
458#define dot_height 15
459static unsigned char dot_bits[] = {
460   0xc0, 0x01, 0xf0, 0x07, 0xfc, 0x1f, 0xfc, 0x1f, 0xfe, 0x3f, 0xfe, 0x3f,
461   0x7f, 0x7f, 0x3f, 0x7e, 0x7f, 0x7f, 0xfe, 0x3f, 0xfe, 0x3f, 0xfc, 0x1f,
462   0xfc, 0x1f, 0xf0, 0x07, 0xc0, 0x01};
463    }
464    WP_dot,2 {
465#define dot_width 30
466#define dot_height 30
467static unsigned char dot_bits[] = {
468   0x00, 0xf0, 0x03, 0x00, 0x00, 0xf0, 0x03, 0x00, 0x00, 0xff, 0x3f, 0x00,
469   0x00, 0xff, 0x3f, 0x00, 0xf0, 0xff, 0xff, 0x03, 0xf0, 0xff, 0xff, 0x03,
470   0xf0, 0xff, 0xff, 0x03, 0xf0, 0xff, 0xff, 0x03, 0xfc, 0xff, 0xff, 0x0f,
471   0xfc, 0xff, 0xff, 0x0f, 0xfc, 0xff, 0xff, 0x0f, 0xfc, 0xff, 0xff, 0x0f,
472   0xff, 0x3f, 0xff, 0x3f, 0xff, 0x3f, 0xff, 0x3f, 0xff, 0x0f, 0xfc, 0x3f,
473   0xff, 0x0f, 0xfc, 0x3f, 0xff, 0x3f, 0xff, 0x3f, 0xff, 0x3f, 0xff, 0x3f,
474   0xfc, 0xff, 0xff, 0x0f, 0xfc, 0xff, 0xff, 0x0f, 0xfc, 0xff, 0xff, 0x0f,
475   0xfc, 0xff, 0xff, 0x0f, 0xf0, 0xff, 0xff, 0x03, 0xf0, 0xff, 0xff, 0x03,
476   0xf0, 0xff, 0xff, 0x03, 0xf0, 0xff, 0xff, 0x03, 0x00, 0xff, 0x3f, 0x00,
477   0x00, 0xff, 0x3f, 0x00, 0x00, 0xf0, 0x03, 0x00, 0x00, 0xf0, 0x03, 0x00 };
478    }
479    diamond_green,fg green
480    diamond_green {
481#define diamond_green_width 15
482#define diamond_green_height 15
483static unsigned char diamond_green_bits[] = {
484   0x80, 0x00, 0xc0, 0x01, 0xe0, 0x03, 0xf0, 0x07, 0xf8, 0x0f, 0xfc, 0x1f,
485   0xfe, 0x3f, 0xff, 0x7f, 0xfe, 0x3f, 0xfc, 0x1f, 0xf8, 0x0f, 0xf0, 0x07,
486   0xe0, 0x03, 0xc0, 0x01, 0x80, 0x00};
487    }
488    diamond_green,2 {
489#define diamond_green_width 30
490#define diamond_green_height 30
491static unsigned char diamond_green_bits[] = {
492   0x00, 0xc0, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0xf0, 0x03, 0x00,
493   0x00, 0xf0, 0x03, 0x00, 0x00, 0xfc, 0x0f, 0x00, 0x00, 0xfc, 0x0f, 0x00,
494   0x00, 0xff, 0x3f, 0x00, 0x00, 0xff, 0x3f, 0x00, 0xc0, 0xff, 0xff, 0x00,
495   0xc0, 0xff, 0xff, 0x00, 0xf0, 0xff, 0xff, 0x03, 0xf0, 0xff, 0xff, 0x03,
496   0xfc, 0xff, 0xff, 0x0f, 0xfc, 0xff, 0xff, 0x0f, 0xff, 0xff, 0xff, 0x3f,
497   0xff, 0xff, 0xff, 0x3f, 0xfc, 0xff, 0xff, 0x0f, 0xfc, 0xff, 0xff, 0x0f,
498   0xf0, 0xff, 0xff, 0x03, 0xf0, 0xff, 0xff, 0x03, 0xc0, 0xff, 0xff, 0x00,
499   0xc0, 0xff, 0xff, 0x00, 0x00, 0xff, 0x3f, 0x00, 0x00, 0xff, 0x3f, 0x00,
500   0x00, 0xfc, 0x0f, 0x00, 0x00, 0xfc, 0x0f, 0x00, 0x00, 0xf0, 0x03, 0x00,
501   0x00, 0xf0, 0x03, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00 };
502    }
503    diamond_red,fg red
504    diamond_red {
505#define diamond_red_width 15
506#define diamond_red_height 15
507static unsigned char diamond_red_bits[] = {
508   0x80, 0x00, 0xc0, 0x01, 0xe0, 0x03, 0xf0, 0x07, 0xf8, 0x0f, 0xfc, 0x1f,
509   0xfe, 0x3f, 0xff, 0x7f, 0xfe, 0x3f, 0xfc, 0x1f, 0xf8, 0x0f, 0xf0, 0x07,
510   0xe0, 0x03, 0xc0, 0x01, 0x80, 0x00};
511    }
512   diamond_red,2 {
513#define diamond_red_width 30
514#define diamond_red_height 30
515static unsigned char diamond_red_bits[] = {
516   0x00, 0xc0, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0xf0, 0x03, 0x00,
517   0x00, 0xf0, 0x03, 0x00, 0x00, 0xfc, 0x0f, 0x00, 0x00, 0xfc, 0x0f, 0x00,
518   0x00, 0xff, 0x3f, 0x00, 0x00, 0xff, 0x3f, 0x00, 0xc0, 0xff, 0xff, 0x00,
519   0xc0, 0xff, 0xff, 0x00, 0xf0, 0xff, 0xff, 0x03, 0xf0, 0xff, 0xff, 0x03,
520   0xfc, 0xff, 0xff, 0x0f, 0xfc, 0xff, 0xff, 0x0f, 0xff, 0xff, 0xff, 0x3f,
521   0xff, 0xff, 0xff, 0x3f, 0xfc, 0xff, 0xff, 0x0f, 0xfc, 0xff, 0xff, 0x0f,
522   0xf0, 0xff, 0xff, 0x03, 0xf0, 0xff, 0xff, 0x03, 0xc0, 0xff, 0xff, 0x00,
523   0xc0, 0xff, 0xff, 0x00, 0x00, 0xff, 0x3f, 0x00, 0x00, 0xff, 0x3f, 0x00,
524   0x00, 0xfc, 0x0f, 0x00, 0x00, 0xfc, 0x0f, 0x00, 0x00, 0xf0, 0x03, 0x00,
525   0x00, 0xf0, 0x03, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00 };
526    }
527    MOB,fg   red
528    MOB {
529#define MOB_width 15
530#define MOB_height 15
531static unsigned char MOB_bits[] = {
532   0xff, 0x7f, 0xff, 0x7f, 0xfd, 0x7f, 0xf9, 0x7f, 0xf1, 0x7f, 0xe1, 0x7f,
533   0xc1, 0x7f, 0x81, 0x7f, 0x01, 0x7f, 0x01, 0x7e, 0x01, 0x7c, 0x01, 0x78,
534   0x01, 0x70, 0x01, 0x60, 0xff, 0x7f};
535    }
536    MOB,2 {
537#define MOB_width 30
538#define MOB_height 30
539static unsigned char MOB_bits[] = {
540   0xff, 0xff, 0xff, 0x3f, 0xff, 0xff, 0xff, 0x3f, 0xff, 0xff, 0xff, 0x3f,
541   0xff, 0xff, 0xff, 0x3f, 0xf3, 0xff, 0xff, 0x3f, 0xf3, 0xff, 0xff, 0x3f,
542   0xc3, 0xff, 0xff, 0x3f, 0xc3, 0xff, 0xff, 0x3f, 0x03, 0xff, 0xff, 0x3f,
543   0x03, 0xff, 0xff, 0x3f, 0x03, 0xfc, 0xff, 0x3f, 0x03, 0xfc, 0xff, 0x3f,
544   0x03, 0xf0, 0xff, 0x3f, 0x03, 0xf0, 0xff, 0x3f, 0x03, 0xc0, 0xff, 0x3f,
545   0x03, 0xc0, 0xff, 0x3f, 0x03, 0x00, 0xff, 0x3f, 0x03, 0x00, 0xff, 0x3f,
546   0x03, 0x00, 0xfc, 0x3f, 0x03, 0x00, 0xfc, 0x3f, 0x03, 0x00, 0xf0, 0x3f,
547   0x03, 0x00, 0xf0, 0x3f, 0x03, 0x00, 0xc0, 0x3f, 0x03, 0x00, 0xc0, 0x3f,
548   0x03, 0x00, 0x00, 0x3f, 0x03, 0x00, 0x00, 0x3f, 0x03, 0x00, 0x00, 0x3c,
549   0x03, 0x00, 0x00, 0x3c, 0xff, 0xff, 0xff, 0x3f, 0xff, 0xff, 0xff, 0x3f };
550    }
551    interr,fg  blue
552    interr {
553#define interr_width 15
554#define interr_height 15
555static unsigned char interr_bits[] = {
556   0xe0, 0x03, 0xf0, 0x07, 0xf8, 0x0f, 0x7c, 0x1e, 0x3c, 0x3c, 0x3c, 0x3c,
557   0x00, 0x3c, 0x00, 0x1e, 0x80, 0x0f, 0xc0, 0x03, 0xe0, 0x03, 0x00, 0x00,
558   0xc0, 0x01, 0xe0, 0x03, 0xc0, 0x01};
559    }
560    interr,2 {
561#define interr_width 30
562#define interr_height 30
563static unsigned char interr_bits[] = {
564   0x00, 0xfc, 0x0f, 0x00, 0x00, 0xfc, 0x0f, 0x00, 0x00, 0xff, 0x3f, 0x00,
565   0x00, 0xff, 0x3f, 0x00, 0xc0, 0xff, 0xff, 0x00, 0xc0, 0xff, 0xff, 0x00,
566   0xf0, 0x3f, 0xfc, 0x03, 0xf0, 0x3f, 0xfc, 0x03, 0xf0, 0x0f, 0xf0, 0x0f,
567   0xf0, 0x0f, 0xf0, 0x0f, 0xf0, 0x0f, 0xf0, 0x0f, 0xf0, 0x0f, 0xf0, 0x0f,
568   0x00, 0x00, 0xf0, 0x0f, 0x00, 0x00, 0xf0, 0x0f, 0x00, 0x00, 0xfc, 0x03,
569   0x00, 0x00, 0xfc, 0x03, 0x00, 0xc0, 0xff, 0x00, 0x00, 0xc0, 0xff, 0x00,
570   0x00, 0xf0, 0x0f, 0x00, 0x00, 0xf0, 0x0f, 0x00, 0x00, 0xfc, 0x0f, 0x00,
571   0x00, 0xfc, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
572   0x00, 0xf0, 0x03, 0x00, 0x00, 0xf0, 0x03, 0x00, 0x00, 0xfc, 0x0f, 0x00,
573   0x00, 0xfc, 0x0f, 0x00, 0x00, 0xf0, 0x03, 0x00, 0x00, 0xf0, 0x03, 0x00 };
574    }
575}
576
577# general procs
578
579proc InitImages {} {
580    # initialize images including those for logos, symbols and the frame
581    #  image; set up symbol menus low-level description from high-level ones
582    global SRCDIR SYMBOLS SYMBOLIMAGE FRAMEIMAGE DEFINEIMGS INTERNALIMG \
583	ICONSIZE ICONWIDTH ICONHEIGHT Logo SmallLogo
584
585    if { $ICONSIZE == "30x30" } {
586	set ICONWIDTH [set ICONHEIGHT 30]
587	set is ",2"
588    } else { set is "" }
589    # logos
590    foreach v "Logo SmallLogo" f "gpsman-logo.gif gpsman-logo-small.gif" {
591	if { [catch {set $v [image create photo \
592				 -file [file join $SRCDIR gmicons $f]]}] } {
593	    set $v ""
594	} elseif { $is != "" } {
595	    DoubleImageSize "\#0" $v
596	}
597    }
598    # frame and symbols
599    set f gif
600    set fdims $INTERNALIMG(frame,dims)
601    set udims $INTERNALIMG(frame$is,dims)
602    if { [catch {set FRAMEIMAGE [image create photo \
603	    -file [file join $SRCDIR gmicons redframe${fdims}.$f]]}] } {
604        set FRAMEIMAGE [image create bitmap -data $INTERNALIMG(frame$is) \
605		              -foreground $INTERNALIMG(frame,fg)]
606    } elseif { $is != "" } {
607	DoubleImageSize 1 FRAMEIMAGE
608    }
609    set sdims $INTERNALIMG(SYMBOL,dims)
610    # assuming that $DEFINEIMGS contains both WP_dot and interr
611    foreach sy $DEFINEIMGS {
612	if { [catch {set im$sy [image create photo \
613				    -file [file join $SRCDIR gmicons \
614					       ${sy}${sdims}.$f]]}] } {
615	    set im$sy [image create bitmap -data $INTERNALIMG($sy$is) \
616			   -foreground $INTERNALIMG($sy,fg)]
617	} elseif { $is != "" } {
618	    DoubleImageSize 1 im$sy
619	}
620	set SYMBOLIMAGE($sy) [set im$sy]
621    }
622    set SYMBOLIMAGE(interr) $iminterr
623    foreach sy $SYMBOLS {
624	if { [lsearch -exact $DEFINEIMGS $sy] == -1 } {
625	    if { [catch {set im [image create photo \
626				     -file [file join $SRCDIR gmicons \
627						${sy}${sdims}.$f]]}] } {
628		set im $imWP_dot
629	    } elseif { $is != "" } {
630		DoubleImageSize 1 im
631	    }
632	    set SYMBOLIMAGE($sy) $im
633	}
634    }
635    InitSymbolMenuDescr
636    return
637}
638
639proc DoubleImageSize {level iname} {
640    # doubles the size of the photo image given in the variable $iname
641    #  and destroys the original one
642    upvar $level $iname img
643
644    set new [image create photo -width 0 -height 0]
645    $new copy $img -zoom 2
646    image delete $img
647    set img $new
648    return
649}
650
651proc InitSymbolMenuDescr {} {
652    # init low-level description of symbol menus from high-level ones
653    #  which are list of lists with symbol internal names or elements
654    #  of the one of the forms ==TEXT or =INDEX, giving the title for a
655    #  sub-menu (as literal text or index in TXT), followed by a sub-list
656    #  describing the sub-menu
657    # the low-level description has a similar structure but each
658    #  symbol internal name is followed by its text label and
659    #  =INDEX elements are replaced by ==TEXT with TEXT the final
660    #  text to be used as label; this description also reflects the
661    #  partition of long menus according $MAXMENUITEMS
662    global SYDEFTMENU SYUSRMENU SYMENU
663
664    set high $SYDEFTMENU
665    if { $SYUSRMENU != "" } {
666	set high [linsert $high 0 =syusrmenu $SYUSRMENU]
667    }
668    set SYMENU [PartitionSymbolMenu $high]
669    return
670}
671
672proc PartitionSymbolMenu {hdescr} {
673    # create low-level description of symbol menus
674    # this implements recursion on sub-menus
675    global UNKNOWNSYMBOLS TXT MAXMENUITEMS
676
677    set low "" ; set n 0 ; set sub 0
678    foreach e $hdescr {
679	if { $sub } {
680	    lappend low [PartitionSymbolMenu $e]
681	    set sub 0
682	    continue
683	}
684	if { $n > $MAXMENUITEMS } {
685	    # continue in a sub-menu
686	    lappend low [list ==$TXT(more) ...] \
687		[PartitionSymbolMenu [lreplace $hdescr 0 $n]]
688	    break
689	}
690	if { [regexp {^=(.+)$} $e x ti] } {
691	    set sub 1
692	    if { ! [regexp {^=(.+)$} $ti x ti] } { set ti $TXT($ti) }
693	    lappend low ==$ti
694	} else {
695	    set sub 0
696	    if { [lsearch -exact $UNKNOWNSYMBOLS $e] != -1 } {
697		set t "~ $TXT(SY$e)"
698	    } else { set t $TXT(SY$e) }
699	    lappend low $e $t
700	}
701	incr n
702    }
703    return $low
704}
705
706proc InitBitmaps {} {
707    # initialize bitmaps
708    global SRCDIR BITMAP BITMAPS
709
710    set dir [file join [pwd] $SRCDIR gmicons]
711    foreach b $BITMAPS {
712	if { [file readable [set f [file join $dir $b.bmp]]] } {
713	    set BITMAP($b) @$f
714	} else { set BITMAP($b) error }
715    }
716    return
717}
718
719proc FillSymbolsMenu {menu commd} {
720    # fill a symbols menu using the low-level description built by
721    #  proc InitSymbolMenuDescr
722    #  $menu is the parent menu to fill in
723    #  $commd is the callback to associate to each selection
724    #    whose arguments will be the symbol name and $menu (even on sub-menus)
725    global SYMENU
726
727    FillSymbolsMenuRec $SYMENU $menu $menu $commd
728    return
729}
730
731proc FillSymbolsMenuRec {ldescr topmenu menu commd} {
732    # recursively fill a symbols menu using the low-level description $ldescr
733    global SYMBOLIMAGE
734
735    set mc 0
736    foreach "e ei" $ldescr {
737	if { [regexp {^==(.+)$} $e x txt] } {
738	    # sub-menu title
739	    set submenu $menu.m$mc ; incr mc
740	    $menu add cascade -label $txt -menu $submenu
741	    menu $submenu
742	    FillSymbolsMenuRec $ei $topmenu $submenu $commd
743	} else {
744	    $menu add command -image $SYMBOLIMAGE($e) -accelerator $ei \
745		    -command "$commd $e $menu"
746	}
747    }
748    return
749}
750
751## user-defined menu
752
753proc SymbolCustomMenu {} {
754    # dialog for allowing the definition of the user symbol menu
755    global SYDEFTMENU SYUSRMENU TXT MESS DPOSX DPOSY COLOUR MAPFTSIZES \
756	SyCMenu LISTHEIGHT SYMBOLIMAGE ICONSIZE
757
758    # used explicitly elsewhere
759    set w .syumenu
760    if { [winfo exists $w] } { bell ; Raise $w ; return }
761
762    array set SyCMenu {
763	cat ""
764	submenus 0
765	mtit,0 ""
766	mparent,0 ""
767	tmenu ""
768	cmenu ""
769    }
770
771    GMToplevel $w syusrmenu +$DPOSX+$DPOSY {} \
772        [list WM_DELETE_WINDOW "destroy $w"] {}
773
774    label $w.tit -text $TXT(syusrmenu)
775    frame $w.fr -relief flat -borderwidth 5
776    label $w.fr.tit -text $TXT(cfgsymenu)
777
778    # categories and symbols
779    # $SYDEFTMENU assumed to have a sub-menu for each category and nothing
780    #  else, with each sub-menu title given by =INDEX
781    set frcs $w.fr.frcs
782    frame $frcs
783    frame $frcs.frrbs
784    frame $frcs.frbx
785    set n 0
786    if { $ICONSIZE == "15x15" } {
787	set width 150 ; set height 21
788    } else { set width 280 ; set height 35 }
789    foreach "title subm" $SYDEFTMENU {
790	regsub {^=} $title "" ti
791	if { $n == 0 } { set cat $ti }
792	set box $frcs.frbx.bx$ti
793	ImageListbox create $box 10 $width $height extended $frcs.frbx.scr$ti
794	scrollbar $frcs.frbx.scr$ti -command "$box yview"
795	foreach e $subm {
796	    if { [regexp {^=} $e] } {
797		BUG sub-menu in SYDEFTMENU
798	    }
799	    ImageListbox insert $box end $SYMBOLIMAGE($e) $TXT(SY$e) $e
800	}
801	radiobutton $frcs.frrbs.b$n -text $TXT($ti) -variable SyCMenu(cat) \
802	    -value $ti -command "SyCMenuAct chgcat $ti" -anchor w
803	grid $frcs.frrbs.b$n -sticky ew
804	incr n
805    }
806    grid $frcs.frrbs -row 1 -column 0 -sticky ne
807    grid $frcs.frbx -row 0 -column 0
808    SyCMenuAct chgcat $cat
809
810    # inserting
811    frame $w.fr.fradd
812    foreach b "ab aa" ti "insb insa" {
813	button $w.fr.fradd.b$b -text "--$TXT($ti)-->" -command "SyCMenuAct $ti"
814	grid $w.fr.fradd.b$b -sticky ew
815    }
816
817    # menu project
818    frame $w.fr.frmn
819    label $w.fr.frmn.cmenu -textvariable SyCMenu(tmenu) -width 15 \
820	-relief sunken -justify left
821    set frmbx $w.fr.frmn.frbx
822    frame $frmbx
823    SyCMenuFill $frmbx $SYUSRMENU
824
825    # menu project buttons
826    set frmop $w.fr.frmn.frmop
827    frame $frmop
828    foreach op "insmnb insmna opensbmn clssbmn del" {
829	button $frmop.b$op -text $TXT($op) \
830	    -command "SyCMenuAct $op ; $frmop.b$op configure -state normal"
831	grid $frmop.b$op -sticky nesw
832    }
833    grid [BalloonButton $frmop.bhlp syhlpbx]
834
835    grid $w.fr.frmn.cmenu -row 0 -column 0 -sticky w
836    grid $frmbx -row 1 -column 0
837    grid $frmop -row 1 -column 1
838    SyCMenuAct chgmenu 0
839
840    # ok, cancel buttons
841    frame $w.fr.frbs
842    button $w.fr.frbs.ok -text $TXT(ok) -command "SyCMenuAct ok"
843    button $w.fr.frbs.cnc -text $TXT(cancel) -command "SyCMenuAct cancel"
844    grid $w.fr.frbs.ok
845    grid $w.fr.frbs.cnc -row 0 -column 1
846
847    grid $w.fr.tit -row 0 -column 0 -columnspan 3
848    grid $frcs -row 2 -column 0 -sticky n -pady 5
849    grid $w.fr.fradd -row 2 -column 1 -sticky n -pady 5 -padx 3
850    grid $w.fr.frmn -row 2 -column 2 -sticky n -pady 5 -padx 3
851    grid $w.fr.frbs -row 3 -column 0 -columnspan 3 -pady 5
852    grid $w.fr
853    update idletasks
854    return
855}
856
857proc SyCMenuFill {frm hdescr} {
858    # create and fill image listboxes for symbol menu high-level description
859    #  $frm will be taken as parent window of listboxes and scrollbars
860    #     using a scheme similar of that used for displaying the
861    #     available symbols
862    # the following elements of global array SyCMenu are used/set:
863    #      submenus  - counter of sub-menus, used in naming widgets
864    #      mtit,$sm  - title (literal text) of sub-menu $sm
865    #      mparent,$sm  - parent of sub-menu $sm
866    # this is a recursive procedure
867    global SyCMenu SYMBOLIMAGE TXT
868
869    set n $SyCMenu(submenus) ; incr SyCMenu(submenus)
870    set box $frm.bx$n
871    ImageListbox create $box 10 150 21 extended $frm.scr$n
872    set SyCMenu($box,move) ""
873    foreach ev "<Button-3> <ButtonRelease-3>" p "start end" {
874	bind $box $ev "SyCMenuMove $p $box %x %y"
875    }
876    bind $box <B3-Enter> "SyCMenuMove enter-down $box %X %Y; break"
877    foreach ev "<B3-Motion> <Any-Enter> <B3-Leave>" p "go enter leave" {
878	bind $box $ev "SyCMenuMove $p $box %X %Y"
879    }
880    scrollbar $frm.scr$n -command "$box yview"
881    set sub 0
882    foreach e $hdescr {
883	if { $sub } {
884	    SyCMenuFill $frm $e
885	    set sub 0
886	    continue
887	}
888	if { [regexp {^=(.+)$} $e x ti] } {
889	    set sub 1
890	    if { ! [regexp {^=(.+)$} $ti x ti] } { set ti $TXT($ti) }
891	    ImageListbox insert $box end "" ">>> $ti" @@@=$SyCMenu(submenus)
892	    set SyCMenu(mtit,$SyCMenu(submenus)) $ti
893	    set SyCMenu(mparent,$SyCMenu(submenus)) $n
894	} else {
895	    set sub 0
896	    ImageListbox insert $box end $SYMBOLIMAGE($e) $TXT(SY$e) $e
897	}
898    }
899    return
900}
901
902proc SyCBuildDescr {tags} {
903    # build high-level description of symbol menu from tags in image
904    #  listboxes
905    global SyCMenu
906
907    set w .syumenu
908    set frmbx $w.fr.frmn.frbx
909    set hd ""
910    foreach t $tags {
911	if { [regsub {^@@@=} $t "" n] } {
912	    # sub-menu
913	    set ts [ImageListbox gettags $frmbx.bx$n 0 end]
914	    lappend hd "==$SyCMenu(mtit,$n)" [SyCBuildDescr $ts]
915	} else { lappend hd $t }
916    }
917    return $hd
918}
919
920proc SyCMenuAct {act args} {
921    # deal with user action when setting up user symbol menu
922    #  $act in {chgcat, chgmenu, insa, insb, insmnb, insmna, opensbmn,
923    #           clssbmn, del, ok, cancel}
924    #    described in switch below
925    #  $args depends on $act: void except for
926    #    chgcat   text index for symbol category name
927    #    chgmenu  number of sub-menu (0 is top menu)
928    global SyCMenu SyCMenuAux SYUSRMENU SYMBOLIMAGE TXT MESS
929
930    set w .syumenu
931    set frbx $w.fr.frcs.frbx
932    set sybox $frbx.bx$SyCMenu(cat)
933    set frmbx $w.fr.frmn.frbx
934    set mnbox $frmbx.bx$SyCMenu(cmenu)
935    switch -glob $act {
936	chgcat {
937	    # change to listbox for symbol category $args
938	    set SyCMenu(cat) $args
939	    foreach s [grid slaves $frbx] { grid forget $s }
940	    grid $frbx.bx$args -row 0 -column 0
941	    grid $frbx.scr$args -row -0 -column 1 -sticky ns
942	}
943	chgmenu {
944	    # display another sub-menu
945	    set SyCMenu(cmenu) $args
946	    set SyCMenu(tmenu) $SyCMenu(mtit,$args)
947	    foreach s [grid slaves $frmbx] { grid forget $s }
948	    grid $frmbx.bx$args -row 0 -column 0
949	    grid $frmbx.scr$args -row -0 -column 1 -sticky ns
950	}
951	ins? {
952	    # insert selected symbols before/after current selection
953	    #  in menu listbox or if there is no selection at the
954	    #  beggining/end; bell if there are no symbols selected
955	    if { [set selsys [ImageListbox getseltags $sybox]] == "" } {
956		bell ; return
957	    }
958	    set inspt [ImageListbox cursel $mnbox]
959	    if { $act == "insa" } {
960		if { $inspt == "" } {
961		    set inspt end
962		} else {
963		    set inspt [lindex $inspt end]
964		    incr inspt
965		}
966	    } elseif { $inspt == "" } {
967		set inspt 0
968	    } else { set inspt [lindex $inspt 0] }
969	    foreach e $selsys {
970		ImageListbox insert $mnbox $inspt $SYMBOLIMAGE($e) \
971		    $TXT(SY$e) $e
972		if { $inspt != "end" } { incr inspt }
973	    }
974	}
975	insmn? {
976	    # insert a sub-menu before/after current selection
977	    #  in menu listbox or if there is no selection at the
978	    #  beggining/end
979	    if { ! [GMChooseParams $TXT(cfgsymenu) SyCMenuAux \
980			[list "=$TXT(name)"]] } {
981		return
982	    }
983	    set inspt [ImageListbox cursel $mnbox]
984	    if { $act == "insa" } {
985		if { $inspt == "" } {
986		    set inspt end
987		} else {
988		    set inspt [lindex $inspt end]
989		    incr inspt
990		}
991	    } elseif { $inspt == "" } {
992		set inspt 0
993	    } else { set inspt [lindex $inspt 0] }
994	    set n $SyCMenu(submenus)
995	    ImageListbox insert $mnbox $inspt "" ">>> $SyCMenuAux" @@@=$n
996	    set SyCMenu(mtit,$n) $SyCMenuAux
997	    set SyCMenu(mparent,$n) $SyCMenu(cmenu)
998	    SyCMenuFill $frmbx ""
999	    SyCMenuAct chgmenu $n
1000	}
1001	opensbmn {
1002	    # display sub-menu whose entry is the current single selection in
1003	    #  menu listbox
1004	    if { [set tag [ImageListbox getseltags $mnbox]] == "" || \
1005		     [lindex $tag 1] != "" || ! [regsub {^@@@=} $tag "" n] } {
1006		bell ; return
1007	    }
1008	    SyCMenuAct chgmenu $n
1009	}
1010	clssbmn {
1011	    # close sub-menu and go to parent sub-menu
1012	    if { [set p $SyCMenu(mparent,$SyCMenu(cmenu))] == "" } {
1013		bell ; return
1014	    }
1015	    SyCMenuAct chgmenu $p
1016	}
1017	del {
1018	    # delete selected entries
1019	    ImageListbox seldel $mnbox
1020	}
1021	ok -  cancel {
1022	    # exit
1023	    if { $act == "ok" } {
1024		if { [set tags [ImageListbox gettags $frmbx.bx0 0 end]] \
1025			 == "" } {
1026		    if { ! [GMConfirm $MESS(emptymenu)] } { return }
1027		    set SYUSRMENU ""
1028		} else { set SYUSRMENU [SyCBuildDescr $tags] }
1029		SaveSymbolCustomMenu
1030		InitSymbolMenuDescr
1031	    }
1032	    ImageListbox destroyall $w
1033	    destroy $w
1034	}
1035    }
1036    return
1037}
1038
1039proc SyCMenuMove {how box x y} {
1040    # move element in image listbox $box when changing symbol custom menu
1041    #  $how in {start, go, end, enter-down, enter, leave}
1042    #  $x,$y are either the coordinates inside the listbox (for $how==start
1043    #   and $how==end) or the global coordinates
1044    global SyCMenu COLOUR SYMBOLIMAGE TXT
1045
1046    set tb .sycmove$SyCMenu(cmenu)
1047    switch $how {
1048	start {
1049	    set ix [ImageListbox index $box $y]
1050	    set txt [lindex [ImageListbox get $box $ix] 0]
1051	    if { $SyCMenu($box,move) == "" } {
1052		set SyCMenu($box,move) in
1053	    }
1054	    NewBalloon $tb $txt \
1055	     +[expr $x+[winfo rootx $box]+9]+[expr $y+[winfo rooty $box]+9]
1056	    set SyCMenu($box,move,tag) [ImageListbox gettags $box $ix]
1057	    set SyCMenu($box,move,txt) $txt
1058	    set SyCMenu($box,move,ix) $ix
1059	}
1060	enter-down {
1061	    if { $SyCMenu($box,move) == "out" } {
1062		if { [winfo exists $tb] } {
1063		    set SyCMenu($box,move) in
1064		    wm geometry $tb +[expr $x+9]+[expr $y+9]
1065		} else {
1066		    set SyCMenu($box,move) ""
1067		}
1068	    }
1069	}
1070	enter {
1071	    if { $SyCMenu($box,move) != "" } {
1072		destroy $tb ; set SyCMenu($box,move) ""
1073	    }
1074	}
1075	go {
1076	    if { $SyCMenu($box,move) == "in" && [winfo exists $tb] } {
1077		wm geometry $tb +[expr $x+9]+[expr $y+9]
1078	    }
1079	}
1080	end {
1081	    if { $SyCMenu($box,move) == "in" && [winfo exists $tb] } {
1082		destroy $tb ; set SyCMenu($box,move) ""
1083		set fix [ImageListbox index $box $y]
1084		set ix $SyCMenu($box,move,ix)
1085		if { $fix != $ix } {
1086		    if { [regexp {^@@@=} \
1087			      [set tag $SyCMenu($box,move,tag)]] } {
1088			set img ""
1089		    } else { set img $SYMBOLIMAGE($tag) }
1090		    ImageListbox delete $box $ix
1091		    ImageListbox insert $box $fix $img \
1092			$SyCMenu($box,move,txt) $tag
1093		}
1094	    }
1095	}
1096	leave {
1097	    if { $SyCMenu($box,move) == "in" } {
1098		set SyCMenu($box,move) out
1099	    }
1100	}
1101    }
1102    return
1103}
1104
1105proc SaveSymbolCustomMenu {} {
1106    # save user-defined symbol menu
1107    global UFile MESS SYUSRMENU
1108
1109    if { [catch {set f [open $UFile(symenu) w]}] } {
1110	GMMessage $MESS(cantwrtsymenu)
1111	return
1112    }
1113    puts $f ""
1114    puts $f "# $MESS(written) GPSMan [NowTZ]"
1115    puts $f "# $MESS(editrisk)"
1116    puts $f ""
1117    puts $f "set SYUSRMENU \{$SYUSRMENU\}"
1118    puts $f ""
1119    close $f
1120    return
1121}
1122
1123proc LoadSymbolCustomMenu {} {
1124    # load user-defined symbol menu
1125    global UFile SYUSRMENU
1126
1127    # assumed to be in system encoding
1128    source $UFile(symenu)
1129    return
1130}
1131
1132## utilities
1133
1134proc SymbolImageName {symbol} {
1135    # returns list with image and external name of $symbol
1136    # needed when $symbol may be user-defined
1137    #  THIS PROC IS NOT BEING USED when symbols are assumed to be
1138    #  standard ones (e.g., in search.tcl)
1139    global SYMBOLIMAGE TXT
1140
1141    if { [regexp {^user:} $symbol] } {
1142	set symbol WP_dot
1143	set t usrdef
1144    } else { set t SY$symbol }
1145    return [list $SYMBOLIMAGE($symbol) $TXT($t)]
1146}
1147
1148proc BadSymbol {name} {
1149    # check if $name is a valid GPSMan symbol name
1150    global SYMBOLS
1151
1152    if { [regexp {^user:} $name] } { return 0 }
1153    return [expr [lsearch -exact $SYMBOLS $name] == -1]
1154}
1155
1156proc BadDispOpt {name} {
1157    # check if $name is a valid GPSMan display option name
1158    global DISPOPTS
1159
1160    return [expr [lsearch -exact $DISPOPTS $name] == -1]
1161}
1162
1163proc NameForCodeOf {id code} {
1164    # get name for $code of $id
1165    #  $id in {SYMBOL DISPOPT}
1166    global DEFAULT$id UNKNOWN${id}S MESS
1167
1168    if { [set ns [FindArrayIndices ${id}CODE $code -1]] == -1 } {
1169	GMMessage "$MESS(bad${id}code): $code"
1170	return [set DEFAULT$id]
1171    }
1172    foreach n $ns {
1173	if { [lsearch -exact [set UNKNOWN${id}S] $n] == -1 } {
1174	    return $n
1175	}
1176    }
1177    GMMessage "$MESS(bad${id}code): $code"
1178    return [set DEFAULT$id]
1179}
1180
1181
1182