Standardized on one stipple pattern to reduce code. - sam - An updated version of the sam text editor.
(HTM) git clone git://vernunftzentrum.de/sam.git
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) LICENSE
---
(DIR) commit b27b105be54d4930254975027523ceb9d853eb20
(DIR) parent 4630064b766cae44c24fa5e731439c445bd2c058
(HTM) Author: Rob King <jking@deadpixi.com>
Date: Tue, 4 Oct 2016 00:45:26 -0500
Standardized on one stipple pattern to reduce code.
Diffstat:
include/libg.h | 1 -
libXg/menuhit.c | 18 +++---------------
libXg/xtbinit.c | 13 +++++++++++++
samterm/Makefile | 2 +-
samterm/icons.c | 20 --------------------
samterm/main.c | 1 -
6 files changed, 17 insertions(+), 38 deletions(-)
---
(DIR) diff --git a/include/libg.h b/include/libg.h
@@ -184,7 +184,6 @@ extern Point strsize(XftFont*, char*);
extern int64_t charwidth(XftFont*, wchar_t);
extern void texture(Bitmap*, Rectangle, Bitmap*, Fcode);
extern void wrbitmap(Bitmap*, int, int, unsigned char*);
-extern void wrbitmapfile(int, Bitmap*);
extern int ptinrect(Point, Rectangle);
extern int rectXrect(Rectangle, Rectangle);
extern int eqpt(Point, Point);
(DIR) diff --git a/libXg/menuhit.c b/libXg/menuhit.c
@@ -16,14 +16,7 @@ enum
Gap = 4 /* between text and scroll bar */
};
-static Bitmap *menutxt;
-
-static uint8_t menutxtbits[] = {
- 0x22, 0x22, 0x88, 0x88, 0x22, 0x22, 0x88, 0x88,
- 0x22, 0x22, 0x88, 0x88, 0x22, 0x22, 0x88, 0x88,
- 0x22, 0x22, 0x88, 0x88, 0x22, 0x22, 0x88, 0x88,
- 0x22, 0x22, 0x88, 0x88, 0x22, 0x22, 0x88, 0x88,
-};
+extern Bitmap *darkgrey;
static int
fontheight() {
@@ -118,13 +111,8 @@ menuscrollpaint(Rectangle scrollr, int off, int nitem, int nitemdrawn)
if(r.max.y < r.min.y+2)
r.max.y = r.min.y+2;
border(&screen, r, 1, F, _bgpixel);
- if(menutxt == 0){
- menutxt = balloc(Rect(0, 0, 16, 16), 0);
- if(menutxt)
- wrbitmap(menutxt, 0, 16, menutxtbits);
- }
- if(menutxt)
- texture(&screen, inset(r, 1), menutxt, S);
+ if(darkgrey)
+ texture(&screen, inset(r, 1), darkgrey, S);
}
int
(DIR) diff --git a/libXg/xtbinit.c b/libXg/xtbinit.c
@@ -118,6 +118,15 @@ static XtActionsRec wmpactions[] = {
{"WMProtocolAction", wmproto}
};
+Bitmap *darkgrey;
+
+static uint8_t darkgreybits[] = {
+ 0xDD, 0xDD, 0x77, 0x77, 0xDD, 0xDD, 0x77, 0x77,
+ 0xDD, 0xDD, 0x77, 0x77, 0xDD, 0xDD, 0x77, 0x77,
+ 0xDD, 0xDD, 0x77, 0x77, 0xDD, 0xDD, 0x77, 0x77,
+ 0xDD, 0xDD, 0x77, 0x77, 0xDD, 0xDD, 0x77, 0x77,
+};
+
void
xtbinit(Errfunc f, char *class, int *pargc, char **argv, char **fallbacks)
{
@@ -223,6 +232,10 @@ xtbinit(Errfunc f, char *class, int *pargc, char **argv, char **fallbacks)
XFlush(_dpy);
XtAppProcessEvent(app, XtIMXEvent);
}
+
+ darkgrey = balloc(Rect(0, 0, 16, 16), 0);
+ wrbitmap(darkgrey, 0, 16, darkgreybits);
+
XFlush(_dpy);
focinit(_toplevel);
}
(DIR) diff --git a/samterm/Makefile b/samterm/Makefile
@@ -22,7 +22,7 @@ CFLAGS=$(INCS) $(STANDARDS) $(INCLUDES)
LIBS=../libframe/libframe.a ../libXg/libXg.a
CC?=c99
-OBJ=main.o flayer.o icons.o io.o menu.o mesg.o rasp.o samrc.o scroll.o unix.o
+OBJ=main.o flayer.o io.o menu.o mesg.o rasp.o samrc.o scroll.o unix.o
all: samterm
(DIR) diff --git a/samterm/icons.c b/samterm/icons.c
@@ -1,20 +0,0 @@
-/* Copyright (c) 1998 Lucent Technologies - All rights reserved. */
-#include <u.h>
-#include <libc.h>
-#include <libg.h>
-
-uint8_t darkgreybits[] = {
- 0xDD, 0xDD, 0x77, 0x77, 0xDD, 0xDD, 0x77, 0x77,
- 0xDD, 0xDD, 0x77, 0x77, 0xDD, 0xDD, 0x77, 0x77,
- 0xDD, 0xDD, 0x77, 0x77, 0xDD, 0xDD, 0x77, 0x77,
- 0xDD, 0xDD, 0x77, 0x77, 0xDD, 0xDD, 0x77, 0x77,
-};
-
-Bitmap *darkgrey;
-
-void
-iconinit(void)
-{
- darkgrey = balloc(Rect(0, 0, 16, 16), 0);
- wrbitmap(darkgrey, 0, 16, darkgreybits);
-}
(DIR) diff --git a/samterm/main.c b/samterm/main.c
@@ -75,7 +75,6 @@ main(int argc, char *argv[])
getscreen(argc, argv);
fwdbut = scrollfwdbut();
- iconinit();
initio();
scratch = alloc(100*RUNESIZE);
nscralloc = 100;