From a0c5b80e821d19f2bc7cffbf13ba58bf5881f8a0 Mon Sep 17 00:00:00 2001 From: "Michael D. Lowis" Date: Wed, 16 Mar 2022 22:39:34 -0400 Subject: [PATCH] add margin and change color scheme --- Rsconscript | 6 ++--- config.h | 65 +++++++++++++++++++++++++------------------------- src/lib/draw.c | 4 ++-- src/tide.c | 2 +- 4 files changed, 39 insertions(+), 38 deletions(-) diff --git a/Rsconscript b/Rsconscript index c3afa50..024959a 100644 --- a/Rsconscript +++ b/Rsconscript @@ -2,7 +2,7 @@ configure do check_c_compiler "clang", "gcc" check_c_header "X11/Xlib.h", check_cpppath: ["/usr/X11/include"] check_lib "X11", check_libpath: ["/usr/X11/lib"] - check_cfg program: "freetype-config" +# check_cfg program: "freetype-config" end build do @@ -11,7 +11,7 @@ build do env["CC"] = "cc" env["LD"] = "tools/alcc" env["CFLAGS"] += %w[-g] - env["CPPPATH"] += %w[. inc] + env["CPPPATH"] += %w[. inc /usr/include/freetype2] env["LIBPATH"] += %w[.] env["LIBS"] += ["util"] @@ -38,4 +38,4 @@ build do Dir.glob("bin/*").each{|bin| env.Install("${prefix}/bin", bin) } end -# CC=./alcc ./atf -Iinc -I. -I/usr/include/freetype2/ src/lib/buf.c src/lib/dbc.c src/lib/telem.c src/lib/gapbuf.c src/lib/utf8.c src/lib/editlog.c src/lib/range.c src/lib/argv0.c src/lib/writefd.c src/lib/readfd.c \ No newline at end of file +# CC=./alcc ./atf -Iinc -I. -I/usr/include/freetype2/ src/lib/buf.c src/lib/dbc.c src/lib/telem.c src/lib/gapbuf.c src/lib/utf8.c src/lib/editlog.c src/lib/range.c src/lib/argv0.c src/lib/writefd.c src/lib/readfd.c diff --git a/config.h b/config.h index df4309b..e1ab943 100644 --- a/config.h +++ b/config.h @@ -36,34 +36,31 @@ static char* TagString = "Del Put Get | Font Tabs Eol | x+ w+ !st !term | Find " /* List of font patterns available to the editor */ static char* Fonts[2] = { - "Verdana:size=11", -#ifdef __MACH__ - "Monaco:size=11" -#else - "Liberation Mono:size=11" -#endif + "Verdana:size=12", + "Liberation Mono:size=12" }; #ifdef INCLUDE_DEFS /* Integer config options */ -int WinWidth = 640; /* default window width */ -int WinHeight = 480; /* default window height */ -int ScrollWidth = 5; /* width in pixels of the scrollbar */ -int Timeout = 100; /* number of milliseconds to wait before poll() times out */ -int TabWidth = 4; /* number of spaces tab characters will be expanded to */ -int ScrollBy = 1; /* number of lines to scroll by on mouse wheel events */ -int ClickTime = 500; /* number of milliseconds after a click wehre multi-clicks will be recognized */ -int CopyIndent = On; /* whether indentation should be copied from previous line or not */ -int TrimOnSave = On; /* whether trailing whitespace should be removed on save or not */ -int ExpandTabs = On; /* whether tab characters should be expanded to spaces or not */ +int WinWidth = 640; /* default window width */ +int WinHeight = 480; /* default window height */ +int ScrollWidth = 8; /* width in pixels of the scrollbar */ +int Timeout = 100; /* number of milliseconds to wait before poll() times out */ +int TabWidth = 4; /* number of spaces tab characters will be expanded to */ +int ScrollBy = 1; /* number of lines to scroll by on mouse wheel events */ +int ClickTime = 500; /* number of milliseconds after a click wehre multi-clicks will be recognized */ +int CopyIndent = On; /* whether indentation should be copied from previous line or not */ +int TrimOnSave = On; /* whether trailing whitespace should be removed on save or not */ +int ExpandTabs = On; /* whether tab characters should be expanded to spaces or not */ int DosLineFeed = Off; /* use \r\n line endings by default */ +int Margin = 50; #else extern int WinWidth, WinHeight, ScrollWidth, Timeout, TabWidth, ScrollBy, - ClickTime, CopyIndent, TrimOnSave, ExpandTabs, DosLineFeed; + ClickTime, CopyIndent, TrimOnSave, ExpandTabs, DosLineFeed, Margin; #endif static int Palette[ClrCount] = { -#if 1 /* Original Acme Colors */ +#if 0 /* Original Acme Colors */ [EditBg] = 0xFFFFEA, /* Edit region background */ [EditFg] = 0x000000, /* Edit region text */ [EditSel] = 0xEEEE9E, /* Edit region selection */ @@ -79,20 +76,24 @@ static int Palette[ClrCount] = { [Red] = 0xCC0000, /* Red */ [Orange] = 0xFF7700, /* Orange */ #else - [Red] = 0xD1160B, /* Red */ - [Purple] = 0x7878BA, /* Purple */ - [Orange] = 0xF39812, /* Orange */ - [EditBg] = 0xF0F0E5, /* Edit region background */ - [EditFg] = 0x000000, /* Edit region text */ - [EditSel] = 0xDFDF99, /* Edit region selection */ - [TagsBg] = 0xE5F0F0, /* Tags region background */ - [TagsFg] = 0x000000, /* Tags region text */ - [TagsSel] = 0x99DFDF, /* Tags region selection */ - [ScrollBg] = 0x909047, /* Scroll region background */ - [ScrollFg] = 0xF0F0E5, /* Scroll region foreground */ - [VerBdr] = 0x909047, /* Vertical border */ - [HorBdr] = 0x000000, /* Horizontal border */ - [Point] = 0x98BE8F, /* Window border */ + [EditBg] = 0xF5F5F0, /* Edit region background */ + [EditFg] = 0x222222, /* Edit region text */ + [EditSel] = 0xAACCEE, /* Edit region selection */ + + [TagsBg] = 0xF5F5F0, /* Tags region background */ + [TagsFg] = 0x222222, /* Tags region text */ + [TagsSel] = 0xAACCEE, /* Tags region selection */ + + [ScrollBg] = 0x959590, /* Scroll region background */ + [ScrollFg] = 0xF5F5F0, /* Scroll region foreground */ + + [VerBdr] = 0x959590, /* Vertical border */ + [HorBdr] = 0x222222, /* Horizontal border */ + + [Point] = 0xD5D5D0, /* Point background */ + [Purple] = 0x6666CC, /* Purple */ + [Red] = 0xCC0000, /* Red */ + [Orange] = 0xFF7700, /* Orange */ #endif }; diff --git a/src/lib/draw.c b/src/lib/draw.c index 493cdb1..abe9c24 100644 --- a/src/lib/draw.c +++ b/src/lib/draw.c @@ -35,13 +35,13 @@ void draw_view(XConf* x, View* view, XftFont* font, size_t nrows, drawcsr* csr, size_t fheight = font->height; bool csr_drawn = false; /* draw the view to the window */ - view_resize(view, (csr->w - csr->x), nrows); + view_resize(view, (csr->w - csr->x - 2) - (2* Margin), nrows); view_update(view); draw_rect(x, bg, csr->x, csr->y, csr->w, ((nrows + 1) * fheight) + 9); for (size_t i = 0; i < nrows; i++) { Row* row = view_getrow(view, i + view->index); - size_t posx = (csr->x + 2), y = (csr->y + 2 + (i * fheight)); + size_t posx = (csr->x + 2 + Margin), y = (csr->y + 2 + (i * fheight)); if (row->off == buf_end(&(view->buffer))) { if (buf_end(&(view->buffer)) == buf_selend(&(view->buffer))) diff --git a/src/tide.c b/src/tide.c index cea4d2f..f385ccc 100644 --- a/src/tide.c +++ b/src/tide.c @@ -92,7 +92,7 @@ static void font_load(char* name) static void get_position(WinRegion id, int x, int y, size_t* row, size_t* col) { int starty = (id == EDIT ? Divider+3 : 0); - int startx = ScrollWidth+3; + int startx = ScrollWidth + 3 + Margin; int maxy = (id == EDIT ? (Divider + (int)(win_view(EDIT)->nrows * X.font->height)) : Divider - 4 -- 2.49.0