palm-client: the Map gets its own Map menu: Basemap On/Off (M) leaves the nodes on plain white, Neighbour Lines On/Off (L) hides a repeater's neighbour lines. Both are remembered with the view

This commit is contained in:
rich committed 2026-11-06 11:28:28 -05:00
1 parent dd72f956d4
commit 585ef5a6f8
3 files changed
+57 -5

No files matched your search

+34 -1
View File
@@ -82,6 +82,39 @@ BEGIN
END
END
MENU ID MapMenuBar
BEGIN
PULLDOWN "Go"
BEGIN
MENUITEM "Conversations" ID MainMenuHome "H"
MENUITEM "Contacts" ID MainMenuContacts "T"
MENUITEM "Node" ID MainMenuNode "N"
MENUITEM "Map" ID MainMenuMap "W"
MENUITEM "-" AUTOID
MENUITEM "Heard Packets" ID MainMenuPackets
MENUITEM "Radio Stats" ID MainMenuStats
MENUITEM "Trace Path" ID MainMenuTrace
END
PULLDOWN "Map"
BEGIN
MENUITEM "Basemap On/Off" ID MainMenuBasemap "M"
MENUITEM "Neighbour Lines On/Off" ID MainMenuNeighLines "L"
END
PULLDOWN "Options"
BEGIN
MENUITEM "Connect" ID MainMenuConnect
MENUITEM "Flood Scopes..." ID MainMenuScopes "O"
MENUITEM "Preferences..." ID MainMenuSounds "R"
MENUITEM "-" AUTOID
MENUITEM "Serial Ports..." ID MainMenuPorts "I"
MENUITEM "Font Preview" ID MainMenuFontPreview "F"
MENUITEM "Screenshot" ID MainMenuShot "Z"
MENUITEM "Screenshot in 5 s" ID MainMenuShotLater "D"
MENUITEM "-" AUTOID
MENUITEM "About VisorMesh" ID MainMenuAbout
END
END
MENU ID ConvoMenuBar
BEGIN
PULLDOWN "Go"
@@ -552,7 +585,7 @@ END
FORM ID MapForm AT (0 0 160 160)
NOFRAME
USABLE
MENUID MainMenuBar
MENUID MapMenuBar
BEGIN
TITLE "Map"
GADGET ID MapGadget AT (0 15 160 130)
+20 -4
View File
@@ -31,6 +31,9 @@ static Int32 FloorDiv(Int32 a, Int32 b) VM_SECT4;
#define MAP_DB_NAME "VisorMeshMap"
#define MAP_PREFS_ID 5
#define MAP_PREFS_VER 1
#define HIDE_BASEMAP 0x01 /* plain white under the nodes, to see them better */
#define HIDE_LINES 0x02 /* the repeater neighbour lines */
#define MAX_NODES 150
#define CACHE_TILES 4
#define TAP_SLOP 4 /* pixels a pen can move and still be a tap */
@@ -50,7 +53,7 @@ typedef struct {
typedef struct {
UInt16 version;
UInt8 zi;
UInt8 pad;
UInt8 hide; /* HIDE_*; 0 in prefs saved before there were layers */
Int32 cx, cy;
} MapPrefs;
@@ -68,6 +71,7 @@ static UInt16 gNodeCount;
static Int16 gSel = -1;
static UInt8 gZi;
static UInt8 gHide = 0;
static Int32 gCx, gCy; /* view centre, world pixels at the max zoom */
static Coord gDownX, gDownY;
static Boolean gPenDown;
@@ -116,6 +120,7 @@ static Boolean OpenMap(void)
if (PrefGetAppPreferences(VM_CREATOR, MAP_PREFS_ID, &prefs, &size, true) != noPreferenceFound &&
size == sizeof(prefs) && prefs.version == MAP_PREFS_VER && prefs.zi < gH.zoomCount) {
gZi = prefs.zi;
gHide = prefs.hide;
gCx = prefs.cx;
gCy = prefs.cy;
} else {
@@ -153,7 +158,7 @@ static void SaveView(void)
prefs.version = MAP_PREFS_VER;
prefs.zi = gZi;
prefs.pad = 0;
prefs.hide = gHide;
prefs.cx = gCx;
prefs.cy = gCy;
PrefSetAppPreferences(VM_CREATOR, MAP_PREFS_ID, MAP_PREFS_VER, &prefs, sizeof(prefs), true);
@@ -408,14 +413,15 @@ static void Draw(void)
t.topLeft.y = r.topLeft.y + (Coord)(row * VM_MAP_TILE - vy);
t.extent.x = t.extent.y = VM_MAP_TILE;
rec = VmMapTileRecord(&gH, gZi, col, row);
bmp = rec ? Tile(rec) : NULL;
bmp = rec && !(gHide & HIDE_BASEMAP) ? Tile(rec) : NULL;
if (bmp)
WinDrawBitmap(bmp, t.topLeft.x, t.topLeft.y);
else
WinEraseRectangle(&t, 0);
}
}
DrawNeighbours(&r, vx, vy);
if (!(gHide & HIDE_LINES))
DrawNeighbours(&r, vx, vy);
DrawNodes(&r, vx, vy);
DrawInfo(&r);
WinResetClip();
@@ -542,6 +548,16 @@ Boolean MapFormHandleEvent(EventType *event)
return true;
}
break;
case menuEvent:
if (event->data.menu.itemID == MainMenuBasemap || event->data.menu.itemID == MainMenuNeighLines) {
gHide ^= event->data.menu.itemID == MainMenuBasemap ? HIDE_BASEMAP : HIDE_LINES;
if (gDb) {
SaveView();
Draw();
}
return true;
}
break;
case ctlSelectEvent:
switch (event->data.ctlSelect.controlID) {
case MapInButton: if (gDb) Zoom(1); return true;
+3
View File
@@ -42,6 +42,9 @@
#define MainMenuStale 1029
#define MainMenuBlocked 1030
#define MainMenuBeamSelf 1031
#define MapMenuBar 1032 /* Go, Map (Basemap, Neighbour Lines), Options */
#define MainMenuBasemap 1033
#define MainMenuNeighLines 1034
#define MainStatsButton 1040
#define AboutAlert 1020
#define ConvoChanMenuBar 1014 /* Go, Edit, Channel (Add, Leave, Mute, Scope), Options */