ref: 18639defa53f4f513d8452cf4e9aaaee092f5ce7
parent: 2df196b6a9a65395abd252935f9f8b927baab833
author: phil9 <telephil9@gmail.com>
date: Fri Nov 26 01:59:23 EST 2021
change menu to use categories change the separator from a line to category names. It helps with clarity, and i still don't care what people think :]
--- a/sepmenuhit.c
+++ b/sepmenuhit.c
@@ -80,7 +80,7 @@
char *item;
item = menu->item ? menu->item[i+off] : (*menu->gen)(i+off);
- return (item[0] == '-' && item[1] == 0);
+ return (item[0] == '_' && item[1] != 0);
}
static
@@ -90,7 +90,6 @@
char *item;
Rectangle r;
Point pt;
- int y;
if(i < 0)
return;
@@ -105,12 +104,11 @@
pt.x = (textr.min.x+textr.max.x-stringwidth(font, item))/2;
pt.y = textr.min.y+i*(font->height+Vspacing);
if(issep(menu, off, i)){
- y = pt.y + (font->height + Vspacing) / 2;
draw(screen, r, back, nil, pt);
- line(screen, Pt(textr.min.x - Margin, y), Pt(textr.max.x + Margin, y), 0, 0, 0, bord, ZP);
+ string(m, Pt(textr.min.x, pt.y), high, pt, font, item+1);
}else{
draw(m, r, highlight? high : back, nil, pt);
- string(m, pt, highlight? htext : text, pt, font, item);
+ string(m, Pt(textr.min.x + 2*Margin, pt.y), highlight? htext : text, pt, font, item);
}
}
@@ -186,7 +184,7 @@
for(nitem = 0;
item = menu->item? menu->item[nitem] : (*menu->gen)(nitem);
nitem++){
- i = stringwidth(font, item);
+ i = stringwidth(font, item)+4*Margin;
if(i > maxwid)
maxwid = i;
}
--- a/view.c
+++ b/view.c
@@ -40,31 +40,31 @@
enum
{
+ Mzcat,
Mzoomin,
Mzoomout,
Morigsize,
- Mzsep,
- Mflip,
- Mflop,
- Mfsep,
+ Mrcat,
Mrotcw,
Mrotccw,
- Mrsep,
+ Mflip,
+ Mflop,
+ Mmcat,
Mpipeto,
};
char *menu2str[] =
{
- "zoom in",
- "zoom out",
- "orig. size",
- "-",
+ "_Zoom",
+ "in",
+ "out",
+ "reinit.",
+ "_Rotate",
+ "cw",
+ "ccw",
"flip",
"flop",
- "-",
- "rotate cw",
- "rotate ccw",
- "-",
- "pipe to...",
+ "_Misc",
+ "pipe...",
nil,
};
Menu menu2 = { menu2str };