add active tick indication; v9001-a02
window tag/body with keyboard focus will render tick in hilighted text color; doesn't work yet for column/row tags
This commit is contained in:
parent
65086bf370
commit
2908f1ff9b
37 changed files with 249 additions and 92 deletions
17
README.md
17
README.md
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
This is a fork of the `acme` text editor from the `plan9port` distribution. It combines the customizability of [lumar](https://github.com/lumar)/[sminez](https://github.com/sminez/plan9port)'s forks and [acme2k](https://github.com/karahobny/acme2k) with upstream fixes from [9fans](https://github.com/9fans/plan9port) and some custom work.
|
This is a fork of the `acme` text editor from the `plan9port` distribution. It combines the customizability of [lumar](https://github.com/lumar)/[sminez](https://github.com/sminez/plan9port)'s forks and [acme2k](https://github.com/karahobny/acme2k) with upstream fixes from [9fans](https://github.com/9fans/plan9port) and some custom work.
|
||||||
|
|
||||||
|
Namely, when click-to-focus is enabled, the active window body or tag renders the tick (aka the text cursor) with the hilight color (`COLOR_<TAG|BODY>_HI`); otherwise the tick is rendered with the text color (`COLOR_<TAG|BODY>_TX`). This is all done with a fork of `libframe` which is included in the distribution and compiled into the program.
|
||||||
|
|
||||||
See the `config.def.h` for out of the box customizations that can be done.
|
See the `config.def.h` for out of the box customizations that can be done.
|
||||||
|
|
||||||
[![screenshot](./scrot.png)](./scrot.png)
|
[![screenshot](./scrot.png)](./scrot.png)
|
||||||
|
@ -44,13 +46,14 @@ After building, run `./install.sh`; If run as a regular user, it will install to
|
||||||
|
|
||||||
## TODO
|
## TODO
|
||||||
|
|
||||||
* [ ] add an indicator of the active window when click to focus (`bartflag`) is enabled
|
- [ ] allow active tick to be rendered for row/column tags, not just window body and tags
|
||||||
|
- [ ] compile helpers
|
||||||
|
|
||||||
## thanks
|
## thanks
|
||||||
|
|
||||||
* [rob pike](https://github.com/robpike) author of the original acme for plan9
|
- [rob pike](https://github.com/robpike) author of the original acme for plan9
|
||||||
* [russ cox](https://research.swtch.com) and the rest of the [9fans](https://github.com/9fans) for plan9port
|
- [russ cox](https://research.swtch.com) and the rest of the [9fans](https://github.com/9fans) for plan9port
|
||||||
* [lumar](https://github.com/lumar) - looks like they deleted their github repos but I originally pulled my keybinds from there
|
- [lumar](https://github.com/lumar) - looks like they deleted their github repos but I originally pulled my keybinds from there
|
||||||
* [sminez](https://github.com/sminez) - possibly the original source of lumar's keybindings
|
- [sminez](https://github.com/sminez) - possibly the original source of lumar's keybindings
|
||||||
* [karahobny](https://github.com/karahobny) - creator of acme2k, a big inspiration for this project
|
- [karahobny](https://github.com/karahobny) - creator of acme2k, a big inspiration for this project
|
||||||
* [aksr](https://github.com/aksr) - source of the missing tag border pixel fix
|
- [aksr](https://github.com/aksr) - source of the missing tag border pixel fix
|
||||||
|
|
17
acme.c
17
acme.c
|
@ -5,7 +5,7 @@
|
||||||
#include <cursor.h>
|
#include <cursor.h>
|
||||||
#include <mouse.h>
|
#include <mouse.h>
|
||||||
#include <keyboard.h>
|
#include <keyboard.h>
|
||||||
#include <frame.h>
|
#include "libframe/frame.h"
|
||||||
#include <fcall.h>
|
#include <fcall.h>
|
||||||
#include <plumb.h>
|
#include <plumb.h>
|
||||||
#include <libsec.h>
|
#include <libsec.h>
|
||||||
|
@ -43,7 +43,7 @@ Rune snarfrune[NSnarf + 1];
|
||||||
|
|
||||||
char* fontnames[2] = {PRIMARY_FONT, SECONDARY_FONT};
|
char* fontnames[2] = {PRIMARY_FONT, SECONDARY_FONT};
|
||||||
|
|
||||||
char version[] = "acme9k v9001-a01";
|
char version[] = "acme9k v9001-a02";
|
||||||
|
|
||||||
Command* command;
|
Command* command;
|
||||||
|
|
||||||
|
@ -510,7 +510,10 @@ void mousethread(void* v) {
|
||||||
char* act;
|
char* act;
|
||||||
enum { MResize, MMouse, MPlumb, MWarnings, NMALT };
|
enum { MResize, MMouse, MPlumb, MWarnings, NMALT };
|
||||||
static Alt alts[NMALT + 1];
|
static Alt alts[NMALT + 1];
|
||||||
|
|
||||||
|
/* make sure we don't recklessly refresh the ticks */
|
||||||
int click;
|
int click;
|
||||||
|
Text* oldbarttext;
|
||||||
|
|
||||||
USED(v);
|
USED(v);
|
||||||
threadsetname("mousethread");
|
threadsetname("mousethread");
|
||||||
|
@ -598,6 +601,7 @@ void mousethread(void* v) {
|
||||||
but = 2;
|
but = 2;
|
||||||
else if (m.buttons == 4)
|
else if (m.buttons == 4)
|
||||||
but = 3;
|
but = 3;
|
||||||
|
oldbarttext = barttext;
|
||||||
barttext = t;
|
barttext = t;
|
||||||
if (t->what == Body && ptinrect(m.xy, t->scrollr)) {
|
if (t->what == Body && ptinrect(m.xy, t->scrollr)) {
|
||||||
if (but) {
|
if (but) {
|
||||||
|
@ -668,15 +672,16 @@ void mousethread(void* v) {
|
||||||
if (textselect3(t, &q0, &q1))
|
if (textselect3(t, &q0, &q1))
|
||||||
look3(t, q0, q1, FALSE);
|
look3(t, q0, q1, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (w)
|
if (w)
|
||||||
winunlock(w);
|
winunlock(w);
|
||||||
goto Continue;
|
goto Continue;
|
||||||
}
|
}
|
||||||
Continue:
|
Continue:
|
||||||
/*if (click && w) {
|
/* won't refresh ticks if scrolling didn't change the active frame! */
|
||||||
/* draw hilighted border around active window
|
if (oldbarttext != barttext && (m.buttons & (8 | 16) || click) && t) {
|
||||||
windrawideco(w, w->col->row->col, w->col->row->ncol);
|
textsettick(t, t->row);
|
||||||
}*/
|
}
|
||||||
qunlock(&row.lk);
|
qunlock(&row.lk);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
2
addr.c
2
addr.c
|
@ -5,7 +5,7 @@
|
||||||
#include <cursor.h>
|
#include <cursor.h>
|
||||||
#include <mouse.h>
|
#include <mouse.h>
|
||||||
#include <keyboard.h>
|
#include <keyboard.h>
|
||||||
#include <frame.h>
|
#include "libframe/frame.h"
|
||||||
#include <fcall.h>
|
#include <fcall.h>
|
||||||
#include <plumb.h>
|
#include <plumb.h>
|
||||||
#include <libsec.h>
|
#include <libsec.h>
|
||||||
|
|
2
buff.c
2
buff.c
|
@ -5,7 +5,7 @@
|
||||||
#include <cursor.h>
|
#include <cursor.h>
|
||||||
#include <mouse.h>
|
#include <mouse.h>
|
||||||
#include <keyboard.h>
|
#include <keyboard.h>
|
||||||
#include <frame.h>
|
#include "libframe/frame.h"
|
||||||
#include <fcall.h>
|
#include <fcall.h>
|
||||||
#include <plumb.h>
|
#include <plumb.h>
|
||||||
#include <libsec.h>
|
#include <libsec.h>
|
||||||
|
|
5
cols.c
5
cols.c
|
@ -5,7 +5,7 @@
|
||||||
#include <cursor.h>
|
#include <cursor.h>
|
||||||
#include <mouse.h>
|
#include <mouse.h>
|
||||||
#include <keyboard.h>
|
#include <keyboard.h>
|
||||||
#include <frame.h>
|
#include "libframe/frame.h"
|
||||||
#include <fcall.h>
|
#include <fcall.h>
|
||||||
#include <plumb.h>
|
#include <plumb.h>
|
||||||
#include <libsec.h>
|
#include <libsec.h>
|
||||||
|
@ -160,6 +160,7 @@ Window* coladd(Column* c, Window* w, Window* clone, int y) {
|
||||||
/* near the button, but in the body */
|
/* near the button, but in the body */
|
||||||
moveto(mousectl, addpt(w->tag.scrollr.max, Pt(3, 3)));
|
moveto(mousectl, addpt(w->tag.scrollr.max, Pt(3, 3)));
|
||||||
barttext = &w->body;
|
barttext = &w->body;
|
||||||
|
textsettick(&w->body, c->row);
|
||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -494,6 +495,7 @@ Pack:
|
||||||
free(ny);
|
free(ny);
|
||||||
c->safe = TRUE;
|
c->safe = TRUE;
|
||||||
winmousebut(w);
|
winmousebut(w);
|
||||||
|
textsettick(&w->body, c->row);
|
||||||
}
|
}
|
||||||
|
|
||||||
void coldragwin(Column* c, Window* w, int but) {
|
void coldragwin(Column* c, Window* w, int but) {
|
||||||
|
@ -581,6 +583,7 @@ Found:
|
||||||
winresize(w, r, c->safe, TRUE);
|
winresize(w, r, c->safe, TRUE);
|
||||||
c->safe = TRUE;
|
c->safe = TRUE;
|
||||||
winmousebut(w);
|
winmousebut(w);
|
||||||
|
textsettick(&w->body, c->row);
|
||||||
}
|
}
|
||||||
|
|
||||||
Text* colwhich(Column* c, Point p) {
|
Text* colwhich(Column* c, Point p) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/******************
|
/******************
|
||||||
* acme9k1 config *
|
* acme9k config *
|
||||||
******************/
|
******************/
|
||||||
|
|
||||||
/**********
|
/**********
|
||||||
|
|
3
dat.h
3
dat.h
|
@ -228,7 +228,7 @@ void textsetorigin(Text*, uint, int);
|
||||||
void textsetselect(Text*, uint, uint);
|
void textsetselect(Text*, uint, uint);
|
||||||
void textshow(Text*, uint, uint, int);
|
void textshow(Text*, uint, uint, int);
|
||||||
void texttype(Text*, Rune);
|
void texttype(Text*, Rune);
|
||||||
|
void textsettick(Text*, Row*);
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
|
@ -304,7 +304,6 @@ void winmousebut(Window*);
|
||||||
void winaddincl(Window*, Rune*, int);
|
void winaddincl(Window*, Rune*, int);
|
||||||
void wincleartag(Window*);
|
void wincleartag(Window*);
|
||||||
char *winctlprint(Window*, char*, int);
|
char *winctlprint(Window*, char*, int);
|
||||||
void windrawideco(Window*, Column**, int);
|
|
||||||
|
|
||||||
struct Column
|
struct Column
|
||||||
{
|
{
|
||||||
|
|
2
disk.c
2
disk.c
|
@ -5,7 +5,7 @@
|
||||||
#include <cursor.h>
|
#include <cursor.h>
|
||||||
#include <mouse.h>
|
#include <mouse.h>
|
||||||
#include <keyboard.h>
|
#include <keyboard.h>
|
||||||
#include <frame.h>
|
#include "libframe/frame.h"
|
||||||
#include <fcall.h>
|
#include <fcall.h>
|
||||||
#include <plumb.h>
|
#include <plumb.h>
|
||||||
#include <libsec.h>
|
#include <libsec.h>
|
||||||
|
|
2
ecmd.c
2
ecmd.c
|
@ -5,7 +5,7 @@
|
||||||
#include <cursor.h>
|
#include <cursor.h>
|
||||||
#include <mouse.h>
|
#include <mouse.h>
|
||||||
#include <keyboard.h>
|
#include <keyboard.h>
|
||||||
#include <frame.h>
|
#include "libframe/frame.h"
|
||||||
#include <fcall.h>
|
#include <fcall.h>
|
||||||
#include <plumb.h>
|
#include <plumb.h>
|
||||||
#include <libsec.h>
|
#include <libsec.h>
|
||||||
|
|
2
edit.c
2
edit.c
|
@ -5,7 +5,7 @@
|
||||||
#include <cursor.h>
|
#include <cursor.h>
|
||||||
#include <mouse.h>
|
#include <mouse.h>
|
||||||
#include <keyboard.h>
|
#include <keyboard.h>
|
||||||
#include <frame.h>
|
#include "libframe/frame.h"
|
||||||
#include <fcall.h>
|
#include <fcall.h>
|
||||||
#include <plumb.h>
|
#include <plumb.h>
|
||||||
#include <libsec.h>
|
#include <libsec.h>
|
||||||
|
|
2
elog.c
2
elog.c
|
@ -5,7 +5,7 @@
|
||||||
#include <cursor.h>
|
#include <cursor.h>
|
||||||
#include <mouse.h>
|
#include <mouse.h>
|
||||||
#include <keyboard.h>
|
#include <keyboard.h>
|
||||||
#include <frame.h>
|
#include "libframe/frame.h"
|
||||||
#include <fcall.h>
|
#include <fcall.h>
|
||||||
#include <plumb.h>
|
#include <plumb.h>
|
||||||
#include <libsec.h>
|
#include <libsec.h>
|
||||||
|
|
2
exec.c
2
exec.c
|
@ -6,7 +6,7 @@
|
||||||
#include <cursor.h>
|
#include <cursor.h>
|
||||||
#include <mouse.h>
|
#include <mouse.h>
|
||||||
#include <keyboard.h>
|
#include <keyboard.h>
|
||||||
#include <frame.h>
|
#include "libframe/frame.h"
|
||||||
#include <fcall.h>
|
#include <fcall.h>
|
||||||
#include <plumb.h>
|
#include <plumb.h>
|
||||||
#include <libsec.h>
|
#include <libsec.h>
|
||||||
|
|
2
file.c
2
file.c
|
@ -5,7 +5,7 @@
|
||||||
#include <cursor.h>
|
#include <cursor.h>
|
||||||
#include <mouse.h>
|
#include <mouse.h>
|
||||||
#include <keyboard.h>
|
#include <keyboard.h>
|
||||||
#include <frame.h>
|
#include "libframe/frame.h"
|
||||||
#include <fcall.h>
|
#include <fcall.h>
|
||||||
#include <plumb.h>
|
#include <plumb.h>
|
||||||
#include <libsec.h>
|
#include <libsec.h>
|
||||||
|
|
2
fsys.c
2
fsys.c
|
@ -5,7 +5,7 @@
|
||||||
#include <cursor.h>
|
#include <cursor.h>
|
||||||
#include <mouse.h>
|
#include <mouse.h>
|
||||||
#include <keyboard.h>
|
#include <keyboard.h>
|
||||||
#include <frame.h>
|
#include "libframe/frame.h"
|
||||||
#include <fcall.h>
|
#include <fcall.h>
|
||||||
#include <plumb.h>
|
#include <plumb.h>
|
||||||
#include <libsec.h>
|
#include <libsec.h>
|
||||||
|
|
101
libframe/frame.h
Normal file
101
libframe/frame.h
Normal file
|
@ -0,0 +1,101 @@
|
||||||
|
#ifndef _FRAME_H_
|
||||||
|
#define _FRAME_H_ 1
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
AUTOLIB(frame)
|
||||||
|
|
||||||
|
typedef struct Frbox Frbox;
|
||||||
|
typedef struct Frame Frame;
|
||||||
|
|
||||||
|
enum{
|
||||||
|
BACK,
|
||||||
|
HIGH,
|
||||||
|
BORD,
|
||||||
|
TEXT,
|
||||||
|
HTEXT,
|
||||||
|
NCOL
|
||||||
|
};
|
||||||
|
|
||||||
|
#define FRTICKW 3
|
||||||
|
struct Frbox
|
||||||
|
{
|
||||||
|
long wid; /* in pixels */
|
||||||
|
long nrune; /* <0 ==> negate and treat as break char */
|
||||||
|
uchar *ptr;
|
||||||
|
short bc; /* break char */
|
||||||
|
short minwid;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Frame
|
||||||
|
{
|
||||||
|
Font *font; /* of chars in the frame */
|
||||||
|
Display *display; /* on which frame appears */
|
||||||
|
Image *b; /* on which frame appears */
|
||||||
|
Image *cols[NCOL]; /* text and background colors */
|
||||||
|
Rectangle r; /* in which text appears */
|
||||||
|
Rectangle entire; /* of full frame */
|
||||||
|
void (*scroll)(Frame*, int); /* scroll function provided by application */
|
||||||
|
Frbox *box;
|
||||||
|
ulong p0, p1; /* selection */
|
||||||
|
ushort nbox, nalloc;
|
||||||
|
ushort maxtab; /* max size of tab, in pixels */
|
||||||
|
ushort nchars; /* # runes in frame */
|
||||||
|
ushort nlines; /* # lines with text */
|
||||||
|
ushort maxlines; /* total # lines in frame */
|
||||||
|
ushort lastlinefull; /* last line fills frame */
|
||||||
|
ushort modified; /* changed since frselect() */
|
||||||
|
Image *tick; /* typing tick when frame is inactive */
|
||||||
|
Image* activetick; /* typing tick when frame has keyboard focus */
|
||||||
|
Image* currenttick; /* points to the appropriate one of tick or activetick */
|
||||||
|
Image *tickback; /* saved image under tick */
|
||||||
|
int ticked; /* flag: is tick onscreen? */
|
||||||
|
int noredraw; /* don't draw on the screen */
|
||||||
|
int tickscale; /* tick scaling factor */
|
||||||
|
};
|
||||||
|
|
||||||
|
ulong frcharofpt(Frame*, Point);
|
||||||
|
Point frptofchar(Frame*, ulong);
|
||||||
|
int frdelete(Frame*, ulong, ulong);
|
||||||
|
void frinsert(Frame*, Rune*, Rune*, ulong);
|
||||||
|
void frselect(Frame*, Mousectl*);
|
||||||
|
void frselectpaint(Frame*, Point, Point, Image*);
|
||||||
|
void frdrawsel(Frame*, Point, ulong, ulong, int);
|
||||||
|
Point frdrawsel0(Frame*, Point, ulong, ulong, Image*, Image*);
|
||||||
|
void frinit(Frame*, Rectangle, Font*, Image*, Image**);
|
||||||
|
void frsetrects(Frame*, Rectangle, Image*);
|
||||||
|
void frclear(Frame*, int);
|
||||||
|
void frredraw(Frame*);
|
||||||
|
|
||||||
|
uchar *_frallocstr(Frame*, unsigned);
|
||||||
|
void _frinsure(Frame*, int, unsigned);
|
||||||
|
Point _frdraw(Frame*, Point);
|
||||||
|
void _frgrowbox(Frame*, int);
|
||||||
|
void _frfreebox(Frame*, int, int);
|
||||||
|
void _frmergebox(Frame*, int);
|
||||||
|
void _frdelbox(Frame*, int, int);
|
||||||
|
void _frsplitbox(Frame*, int, int);
|
||||||
|
int _frfindbox(Frame*, int, ulong, ulong);
|
||||||
|
void _frclosebox(Frame*, int, int);
|
||||||
|
int _frcanfit(Frame*, Point, Frbox*);
|
||||||
|
void _frcklinewrap(Frame*, Point*, Frbox*);
|
||||||
|
void _frcklinewrap0(Frame*, Point*, Frbox*);
|
||||||
|
void _fradvance(Frame*, Point*, Frbox*);
|
||||||
|
int _frnewwid(Frame*, Point, Frbox*);
|
||||||
|
int _frnewwid0(Frame*, Point, Frbox*);
|
||||||
|
void _frclean(Frame*, Point, int, int);
|
||||||
|
void _frdrawtext(Frame*, Point, Image*, Image*);
|
||||||
|
void _fraddbox(Frame*, int, int);
|
||||||
|
Point _frptofcharptb(Frame*, ulong, Point, int);
|
||||||
|
Point _frptofcharnb(Frame*, ulong, int);
|
||||||
|
int _frstrlen(Frame*, int);
|
||||||
|
void frtick(Frame*, Point, int);
|
||||||
|
void frinittick(Frame*);
|
||||||
|
|
||||||
|
#define NRUNE(b) ((b)->nrune<0? 1 : (b)->nrune)
|
||||||
|
#define NBYTE(b) strlen((char*)(b)->ptr)
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif
|
|
@ -2,7 +2,7 @@
|
||||||
#include <libc.h>
|
#include <libc.h>
|
||||||
#include <draw.h>
|
#include <draw.h>
|
||||||
#include <mouse.h>
|
#include <mouse.h>
|
||||||
#include <frame.h>
|
#include "frame.h"
|
||||||
|
|
||||||
#define SLOP 25
|
#define SLOP 25
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#include <libc.h>
|
#include <libc.h>
|
||||||
#include <draw.h>
|
#include <draw.h>
|
||||||
#include <mouse.h>
|
#include <mouse.h>
|
||||||
#include <frame.h>
|
#include "frame.h"
|
||||||
|
|
||||||
int frdelete(Frame* f, ulong p0, ulong p1) {
|
int frdelete(Frame* f, ulong p0, ulong p1) {
|
||||||
Point pt0, pt1, ppt0;
|
Point pt0, pt1, ppt0;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#include <libc.h>
|
#include <libc.h>
|
||||||
#include <draw.h>
|
#include <draw.h>
|
||||||
#include <mouse.h>
|
#include <mouse.h>
|
||||||
#include <frame.h>
|
#include "frame.h"
|
||||||
|
|
||||||
void _frdrawtext(Frame* f, Point pt, Image* text, Image* back) {
|
void _frdrawtext(Frame* f, Point pt, Image* text, Image* back) {
|
||||||
Frbox* b;
|
Frbox* b;
|
||||||
|
@ -136,7 +136,7 @@ void frredraw(Frame* f) {
|
||||||
static void _frtick(Frame* f, Point pt, int ticked) {
|
static void _frtick(Frame* f, Point pt, int ticked) {
|
||||||
Rectangle r;
|
Rectangle r;
|
||||||
|
|
||||||
if (f->ticked == ticked || f->tick == 0 || !ptinrect(pt, f->r))
|
if (f->ticked == ticked || f->currenttick == 0 || !ptinrect(pt, f->r))
|
||||||
return;
|
return;
|
||||||
pt.x -= f->tickscale; /* looks best just left of where requested */
|
pt.x -= f->tickscale; /* looks best just left of where requested */
|
||||||
r = Rect(pt.x, pt.y, pt.x + FRTICKW * f->tickscale, pt.y + f->font->height);
|
r = Rect(pt.x, pt.y, pt.x + FRTICKW * f->tickscale, pt.y + f->font->height);
|
||||||
|
@ -145,7 +145,7 @@ static void _frtick(Frame* f, Point pt, int ticked) {
|
||||||
r.max.x = f->r.max.x;
|
r.max.x = f->r.max.x;
|
||||||
if (ticked) {
|
if (ticked) {
|
||||||
draw(f->tickback, f->tickback->r, f->b, nil, pt);
|
draw(f->tickback, f->tickback->r, f->b, nil, pt);
|
||||||
draw(f->b, r, f->tick, nil, ZP);
|
draw(f->b, r, f->currenttick, nil, ZP);
|
||||||
} else
|
} else
|
||||||
draw(f->b, r, f->tickback, nil, ZP);
|
draw(f->b, r, f->tickback, nil, ZP);
|
||||||
f->ticked = ticked;
|
f->ticked = ticked;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#include <libc.h>
|
#include <libc.h>
|
||||||
#include <draw.h>
|
#include <draw.h>
|
||||||
#include <mouse.h>
|
#include <mouse.h>
|
||||||
#include <frame.h>
|
#include "frame.h"
|
||||||
|
|
||||||
void frinit(Frame* f, Rectangle r, Font* ft, Image* b, Image* cols[NCOL]) {
|
void frinit(Frame* f, Rectangle r, Font* ft, Image* b, Image* cols[NCOL]) {
|
||||||
f->font = ft;
|
f->font = ft;
|
||||||
|
@ -42,6 +42,16 @@ void frinittick(Frame* f) {
|
||||||
DWhite);
|
DWhite);
|
||||||
if (f->tick == nil)
|
if (f->tick == nil)
|
||||||
return;
|
return;
|
||||||
|
if (f->activetick)
|
||||||
|
freeimage(f->activetick);
|
||||||
|
f->activetick = allocimage(
|
||||||
|
f->display,
|
||||||
|
Rect(0, 0, f->tickscale * FRTICKW, ft->height),
|
||||||
|
b->chan,
|
||||||
|
0,
|
||||||
|
DWhite);
|
||||||
|
if (f->activetick == nil)
|
||||||
|
return;
|
||||||
if (f->tickback)
|
if (f->tickback)
|
||||||
freeimage(f->tickback);
|
freeimage(f->tickback);
|
||||||
f->tickback = allocimage(f->display, f->tick->r, b->chan, 0, DWhite);
|
f->tickback = allocimage(f->display, f->tick->r, b->chan, 0, DWhite);
|
||||||
|
@ -50,9 +60,9 @@ void frinittick(Frame* f) {
|
||||||
f->tick = 0;
|
f->tick = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* background color */
|
/* inactive background color */
|
||||||
draw(f->tick, f->tick->r, f->cols[BACK], nil, ZP);
|
draw(f->tick, f->tick->r, f->cols[BACK], nil, ZP);
|
||||||
/* vertical line */
|
/* inactive vertical line */
|
||||||
draw(
|
draw(
|
||||||
f->tick,
|
f->tick,
|
||||||
Rect(
|
Rect(
|
||||||
|
@ -63,7 +73,7 @@ void frinittick(Frame* f) {
|
||||||
f->cols[TEXT],
|
f->cols[TEXT],
|
||||||
nil,
|
nil,
|
||||||
ZP);
|
ZP);
|
||||||
/* box on each end */
|
/* inactive box on each end */
|
||||||
draw(
|
draw(
|
||||||
f->tick,
|
f->tick,
|
||||||
Rect(0, 0, f->tickscale * FRTICKW, f->tickscale * FRTICKW),
|
Rect(0, 0, f->tickscale * FRTICKW, f->tickscale * FRTICKW),
|
||||||
|
@ -80,6 +90,39 @@ void frinittick(Frame* f) {
|
||||||
f->cols[TEXT],
|
f->cols[TEXT],
|
||||||
nil,
|
nil,
|
||||||
ZP);
|
ZP);
|
||||||
|
|
||||||
|
/* active background color */
|
||||||
|
draw(f->activetick, f->activetick->r, f->cols[BACK], nil, ZP);
|
||||||
|
/* active vertical line */
|
||||||
|
draw(
|
||||||
|
f->activetick,
|
||||||
|
Rect(
|
||||||
|
f->tickscale * (FRTICKW / 2),
|
||||||
|
0,
|
||||||
|
f->tickscale * (FRTICKW / 2 + 1),
|
||||||
|
ft->height),
|
||||||
|
f->cols[HIGH],
|
||||||
|
nil,
|
||||||
|
ZP);
|
||||||
|
/* active box on each end */
|
||||||
|
draw(
|
||||||
|
f->activetick,
|
||||||
|
Rect(0, 0, f->tickscale * FRTICKW, f->tickscale * FRTICKW),
|
||||||
|
f->cols[HIGH],
|
||||||
|
nil,
|
||||||
|
ZP);
|
||||||
|
draw(
|
||||||
|
f->activetick,
|
||||||
|
Rect(
|
||||||
|
0,
|
||||||
|
ft->height - f->tickscale * FRTICKW,
|
||||||
|
f->tickscale * FRTICKW,
|
||||||
|
ft->height),
|
||||||
|
f->cols[HIGH],
|
||||||
|
nil,
|
||||||
|
ZP);
|
||||||
|
|
||||||
|
f->currenttick = f->tick;
|
||||||
}
|
}
|
||||||
|
|
||||||
void frsetrects(Frame* f, Rectangle r, Image* b) {
|
void frsetrects(Frame* f, Rectangle r, Image* b) {
|
||||||
|
@ -96,8 +139,10 @@ void frclear(Frame* f, int freeall) {
|
||||||
if (f->box)
|
if (f->box)
|
||||||
free(f->box);
|
free(f->box);
|
||||||
if (freeall) {
|
if (freeall) {
|
||||||
|
freeimage(f->activetick);
|
||||||
freeimage(f->tick);
|
freeimage(f->tick);
|
||||||
freeimage(f->tickback);
|
freeimage(f->tickback);
|
||||||
|
f->currenttick = nil;
|
||||||
f->tick = 0;
|
f->tick = 0;
|
||||||
f->tickback = 0;
|
f->tickback = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#include <libc.h>
|
#include <libc.h>
|
||||||
#include <draw.h>
|
#include <draw.h>
|
||||||
#include <mouse.h>
|
#include <mouse.h>
|
||||||
#include <frame.h>
|
#include "frame.h"
|
||||||
|
|
||||||
#define DELTA 25
|
#define DELTA 25
|
||||||
#define TMPSIZE 256
|
#define TMPSIZE 256
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#include <libc.h>
|
#include <libc.h>
|
||||||
#include <draw.h>
|
#include <draw.h>
|
||||||
#include <mouse.h>
|
#include <mouse.h>
|
||||||
#include <frame.h>
|
#include "frame.h"
|
||||||
|
|
||||||
Point _frptofcharptb(Frame* f, ulong p, Point pt, int bn) {
|
Point _frptofcharptb(Frame* f, ulong p, Point pt, int bn) {
|
||||||
uchar* s;
|
uchar* s;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#include <libc.h>
|
#include <libc.h>
|
||||||
#include <draw.h>
|
#include <draw.h>
|
||||||
#include <mouse.h>
|
#include <mouse.h>
|
||||||
#include <frame.h>
|
#include "frame.h"
|
||||||
|
|
||||||
static int region(int a, int b) {
|
static int region(int a, int b) {
|
||||||
if (a < b)
|
if (a < b)
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#include <libc.h>
|
#include <libc.h>
|
||||||
#include <draw.h>
|
#include <draw.h>
|
||||||
#include <mouse.h>
|
#include <mouse.h>
|
||||||
#include <frame.h>
|
#include "frame.h"
|
||||||
|
|
||||||
#define CHUNK 16
|
#define CHUNK 16
|
||||||
#define ROUNDUP(n) ((n + CHUNK) & ~(CHUNK - 1))
|
#define ROUNDUP(n) ((n + CHUNK) & ~(CHUNK - 1))
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#include <libc.h>
|
#include <libc.h>
|
||||||
#include <draw.h>
|
#include <draw.h>
|
||||||
#include <mouse.h>
|
#include <mouse.h>
|
||||||
#include <frame.h>
|
#include "frame.h"
|
||||||
|
|
||||||
int _frcanfit(Frame* f, Point pt, Frbox* b) {
|
int _frcanfit(Frame* f, Point pt, Frbox* b) {
|
||||||
int left, w, nr;
|
int left, w, nr;
|
||||||
|
|
Binary file not shown.
2
logf.c
2
logf.c
|
@ -5,7 +5,7 @@
|
||||||
#include <cursor.h>
|
#include <cursor.h>
|
||||||
#include <mouse.h>
|
#include <mouse.h>
|
||||||
#include <keyboard.h>
|
#include <keyboard.h>
|
||||||
#include <frame.h>
|
#include "libframe/frame.h"
|
||||||
#include <fcall.h>
|
#include <fcall.h>
|
||||||
#include <plumb.h>
|
#include <plumb.h>
|
||||||
#include <libsec.h>
|
#include <libsec.h>
|
||||||
|
|
2
look.c
2
look.c
|
@ -5,7 +5,7 @@
|
||||||
#include <cursor.h>
|
#include <cursor.h>
|
||||||
#include <mouse.h>
|
#include <mouse.h>
|
||||||
#include <keyboard.h>
|
#include <keyboard.h>
|
||||||
#include <frame.h>
|
#include "libframe/frame.h"
|
||||||
#include <fcall.h>
|
#include <fcall.h>
|
||||||
#include <regexp.h>
|
#include <regexp.h>
|
||||||
#include <9pclient.h>
|
#include <9pclient.h>
|
||||||
|
|
13
mkfile
13
mkfile
|
@ -4,7 +4,15 @@ TARG=acme
|
||||||
DIRS=mail libframe
|
DIRS=mail libframe
|
||||||
|
|
||||||
OFILES=\
|
OFILES=\
|
||||||
|
libframe/frbox.$O\
|
||||||
|
libframe/frdelete.$O\
|
||||||
|
libframe/frdraw.$O\
|
||||||
libframe/frinit.$O\
|
libframe/frinit.$O\
|
||||||
|
libframe/frinsert.$O\
|
||||||
|
libframe/frptofchar.$O\
|
||||||
|
libframe/frselect.$O\
|
||||||
|
libframe/frstr.$O\
|
||||||
|
libframe/frutil.$O\
|
||||||
acme.$O\
|
acme.$O\
|
||||||
addr.$O\
|
addr.$O\
|
||||||
buff.$O\
|
buff.$O\
|
||||||
|
@ -27,7 +35,8 @@ OFILES=\
|
||||||
wind.$O\
|
wind.$O\
|
||||||
xfid.$O\
|
xfid.$O\
|
||||||
|
|
||||||
HFILES=dat.h\
|
HFILES=libframe/frame.h\
|
||||||
|
dat.h\
|
||||||
edit.h\
|
edit.h\
|
||||||
fns.h\
|
fns.h\
|
||||||
|
|
||||||
|
@ -36,7 +45,7 @@ HFILES=dat.h\
|
||||||
|
|
||||||
edit.$O ecmd.$O elog.$O: edit.h
|
edit.$O ecmd.$O elog.$O: edit.h
|
||||||
|
|
||||||
LDFLAGS=-L./libframe -lframe $LDFLAGS
|
# LDFLAGS=-L./libframe -lframe $LDFLAGS
|
||||||
|
|
||||||
likeplan9:V:
|
likeplan9:V:
|
||||||
mkdir -p likeplan9
|
mkdir -p likeplan9
|
||||||
|
|
2
regx.c
2
regx.c
|
@ -5,7 +5,7 @@
|
||||||
#include <cursor.h>
|
#include <cursor.h>
|
||||||
#include <mouse.h>
|
#include <mouse.h>
|
||||||
#include <keyboard.h>
|
#include <keyboard.h>
|
||||||
#include <frame.h>
|
#include "libframe/frame.h"
|
||||||
#include <fcall.h>
|
#include <fcall.h>
|
||||||
#include <plumb.h>
|
#include <plumb.h>
|
||||||
#include <libsec.h>
|
#include <libsec.h>
|
||||||
|
|
2
rows.c
2
rows.c
|
@ -5,7 +5,7 @@
|
||||||
#include <cursor.h>
|
#include <cursor.h>
|
||||||
#include <mouse.h>
|
#include <mouse.h>
|
||||||
#include <keyboard.h>
|
#include <keyboard.h>
|
||||||
#include <frame.h>
|
#include "libframe/frame.h"
|
||||||
#include <fcall.h>
|
#include <fcall.h>
|
||||||
#include <bio.h>
|
#include <bio.h>
|
||||||
#include <plumb.h>
|
#include <plumb.h>
|
||||||
|
|
2
scrl.c
2
scrl.c
|
@ -5,7 +5,7 @@
|
||||||
#include <cursor.h>
|
#include <cursor.h>
|
||||||
#include <mouse.h>
|
#include <mouse.h>
|
||||||
#include <keyboard.h>
|
#include <keyboard.h>
|
||||||
#include <frame.h>
|
#include "libframe/frame.h"
|
||||||
#include <fcall.h>
|
#include <fcall.h>
|
||||||
#include <plumb.h>
|
#include <plumb.h>
|
||||||
#include <libsec.h>
|
#include <libsec.h>
|
||||||
|
|
BIN
scrot.png
BIN
scrot.png
Binary file not shown.
Before Width: | Height: | Size: 1.3 MiB After Width: | Height: | Size: 978 KiB |
45
text.c
45
text.c
|
@ -5,7 +5,7 @@
|
||||||
#include <cursor.h>
|
#include <cursor.h>
|
||||||
#include <mouse.h>
|
#include <mouse.h>
|
||||||
#include <keyboard.h>
|
#include <keyboard.h>
|
||||||
#include <frame.h>
|
#include "libframe/frame.h"
|
||||||
#include <fcall.h>
|
#include <fcall.h>
|
||||||
#include <plumb.h>
|
#include <plumb.h>
|
||||||
#include <libsec.h>
|
#include <libsec.h>
|
||||||
|
@ -36,17 +36,39 @@ void textinit(Text* t, File* f, Rectangle r, Reffont* rf, Image* cols[NCOL]) {
|
||||||
textredraw(t, r, rf->f, screen, -1, 0);
|
textredraw(t, r, rf->f, screen, -1, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void textdrawactive(Text* t, int active) {
|
void _textsettick(Text* current, Text* self) {
|
||||||
Image* b;
|
self->fr.currenttick =
|
||||||
Rectangle br;
|
(self == current) ? self->fr.activetick : self->fr.tick;
|
||||||
|
}
|
||||||
|
|
||||||
b = t->fr.cols[BACK];
|
void textsettick(Text* t, Row* r) {
|
||||||
if (active)
|
Column** allcolumns;
|
||||||
b = t->fr.cols[HIGH];
|
Column* cptr;
|
||||||
br.min = t->scrollr.max;
|
Window* wptr;
|
||||||
br.max.x = br.min.x + 1;
|
int ncols, ccnt, wcnt;
|
||||||
br.max.y = br.min.y + Dy(t->all);
|
|
||||||
draw(screen, br, b, nil, b->r.min);
|
if (!bartflag)
|
||||||
|
return;
|
||||||
|
|
||||||
|
allcolumns = r->col;
|
||||||
|
ncols = r->ncol;
|
||||||
|
|
||||||
|
_textsettick(t, &r->tag);
|
||||||
|
for (ccnt = 0; ccnt < ncols; ccnt++) {
|
||||||
|
cptr = allcolumns[ccnt];
|
||||||
|
_textsettick(t, &cptr->tag);
|
||||||
|
for (wcnt = 0; wcnt < cptr->nw; wcnt++) {
|
||||||
|
wptr = cptr->w[wcnt];
|
||||||
|
winlock(wptr, 'M');
|
||||||
|
_textsettick(t, &wptr->tag);
|
||||||
|
_textsettick(t, &wptr->body);
|
||||||
|
winunlock(wptr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* force redraw to refresh all ticks;
|
||||||
|
* kind of expensive, but we only do it when the active frame changes
|
||||||
|
*/
|
||||||
|
rowresize(r, r->r);
|
||||||
}
|
}
|
||||||
|
|
||||||
void textredraw(Text* t, Rectangle r, Font* f, Image* b, int odx, int active) {
|
void textredraw(Text* t, Rectangle r, Font* f, Image* b, int odx, int active) {
|
||||||
|
@ -77,7 +99,6 @@ void textredraw(Text* t, Rectangle r, Font* f, Image* b, int odx, int active) {
|
||||||
textfill(t);
|
textfill(t);
|
||||||
textsetselect(t, t->q0, t->q1);
|
textsetselect(t, t->q0, t->q1);
|
||||||
}
|
}
|
||||||
/*textdrawactive(t, active);*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int textresize(Text* t, Rectangle r, int keepextra) {
|
int textresize(Text* t, Rectangle r, int keepextra) {
|
||||||
|
|
2
time.c
2
time.c
|
@ -5,7 +5,7 @@
|
||||||
#include <cursor.h>
|
#include <cursor.h>
|
||||||
#include <mouse.h>
|
#include <mouse.h>
|
||||||
#include <keyboard.h>
|
#include <keyboard.h>
|
||||||
#include <frame.h>
|
#include "libframe/frame.h"
|
||||||
#include <fcall.h>
|
#include <fcall.h>
|
||||||
#include <plumb.h>
|
#include <plumb.h>
|
||||||
#include <libsec.h>
|
#include <libsec.h>
|
||||||
|
|
2
util.c
2
util.c
|
@ -5,7 +5,7 @@
|
||||||
#include <cursor.h>
|
#include <cursor.h>
|
||||||
#include <mouse.h>
|
#include <mouse.h>
|
||||||
#include <keyboard.h>
|
#include <keyboard.h>
|
||||||
#include <frame.h>
|
#include "libframe/frame.h"
|
||||||
#include <fcall.h>
|
#include <fcall.h>
|
||||||
#include <plumb.h>
|
#include <plumb.h>
|
||||||
#include <libsec.h>
|
#include <libsec.h>
|
||||||
|
|
31
wind.c
31
wind.c
|
@ -5,7 +5,7 @@
|
||||||
#include <cursor.h>
|
#include <cursor.h>
|
||||||
#include <mouse.h>
|
#include <mouse.h>
|
||||||
#include <keyboard.h>
|
#include <keyboard.h>
|
||||||
#include <frame.h>
|
#include "libframe/frame.h"
|
||||||
#include <fcall.h>
|
#include <fcall.h>
|
||||||
#include <plumb.h>
|
#include <plumb.h>
|
||||||
#include <libsec.h>
|
#include <libsec.h>
|
||||||
|
@ -89,35 +89,6 @@ void wininit(Window* w, Window* clone, Rectangle r) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void windrawideco(Window* active, Column** allcols, int ncol) {
|
|
||||||
Window* wptr;
|
|
||||||
Column* cptr;
|
|
||||||
int wcnt, ccnt;
|
|
||||||
|
|
||||||
for (ccnt = 0; ccnt < ncol; ccnt++) {
|
|
||||||
cptr = allcols[ccnt];
|
|
||||||
for (wcnt = 0; wcnt < cptr->nw; wcnt++) {
|
|
||||||
wptr = cptr->w[wcnt];
|
|
||||||
winlock(wptr, 'M');
|
|
||||||
textredraw(
|
|
||||||
&wptr->tag,
|
|
||||||
wptr->tag.scrollr,
|
|
||||||
wptr->tag.fr.font,
|
|
||||||
screen,
|
|
||||||
-1,
|
|
||||||
wptr->id == active->id);
|
|
||||||
textredraw(
|
|
||||||
&wptr->body,
|
|
||||||
wptr->body.scrollr,
|
|
||||||
wptr->body.fr.font,
|
|
||||||
screen,
|
|
||||||
-1,
|
|
||||||
wptr->id == active->id);
|
|
||||||
winunlock(wptr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Draw the appropriate button.
|
* Draw the appropriate button.
|
||||||
*/
|
*/
|
||||||
|
|
2
xfid.c
2
xfid.c
|
@ -5,7 +5,7 @@
|
||||||
#include <cursor.h>
|
#include <cursor.h>
|
||||||
#include <mouse.h>
|
#include <mouse.h>
|
||||||
#include <keyboard.h>
|
#include <keyboard.h>
|
||||||
#include <frame.h>
|
#include "libframe/frame.h"
|
||||||
#include <fcall.h>
|
#include <fcall.h>
|
||||||
#include <plumb.h>
|
#include <plumb.h>
|
||||||
#include <libsec.h>
|
#include <libsec.h>
|
||||||
|
|
Loading…
Reference in a new issue