Merge branch 'master' of ssh://forgejo.nishi.boats:2222/pyrite-dev/milsko
All checks were successful
pyrite-dev/milsko/pipeline/head This commit looks good
All checks were successful
pyrite-dev/milsko/pipeline/head This commit looks good
This commit is contained in:
commit
efc6002bdb
10 changed files with 202 additions and 201 deletions
|
|
@ -145,11 +145,12 @@ static void MWAPI menu_handler(MwWidget handle, void* user, void* call) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
int i, j;
|
int i, j;
|
||||||
MwWidget f, w, b;
|
MwWidget f, w, b;
|
||||||
int index;
|
MwLLPixmap px;
|
||||||
MwMenu m, m2;
|
int index;
|
||||||
void* v;
|
MwMenu m, m2;
|
||||||
|
void* v;
|
||||||
|
|
||||||
MwLibraryInit();
|
MwLibraryInit();
|
||||||
|
|
||||||
|
|
@ -157,6 +158,8 @@ int main() {
|
||||||
MwNtitle, "Milsko Periodic Table",
|
MwNtitle, "Milsko Periodic Table",
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
|
px = MwLoadIcon(window, MwIconError);
|
||||||
|
|
||||||
menu = MwCreateWidget(MwMenuClass, "menu", window, 0, 0, 0, 0);
|
menu = MwCreateWidget(MwMenuClass, "menu", window, 0, 0, 0, 0);
|
||||||
|
|
||||||
m = MwMenuAdd(menu, NULL, "File");
|
m = MwMenuAdd(menu, NULL, "File");
|
||||||
|
|
@ -256,6 +259,12 @@ int main() {
|
||||||
f = frame("Entry", -PaddingContent, 24, MwEntryClass, NULL);
|
f = frame("Entry", -PaddingContent, 24, MwEntryClass, NULL);
|
||||||
add(f);
|
add(f);
|
||||||
|
|
||||||
|
f = frame("Image", -PaddingContent, -PaddingContent, MwImageClass,
|
||||||
|
MwNpixmap, px,
|
||||||
|
NULL);
|
||||||
|
w = child(f);
|
||||||
|
add(f);
|
||||||
|
|
||||||
f = frame("Label", -PaddingContent, -PaddingContent, MwLabelClass,
|
f = frame("Label", -PaddingContent, -PaddingContent, MwLabelClass,
|
||||||
MwNtext, "Epic text",
|
MwNtext, "Epic text",
|
||||||
NULL);
|
NULL);
|
||||||
|
|
@ -292,6 +301,14 @@ int main() {
|
||||||
v = MwTreeViewAdd(w, v, NULL, "ghi");
|
v = MwTreeViewAdd(w, v, NULL, "ghi");
|
||||||
add(f);
|
add(f);
|
||||||
|
|
||||||
|
f = frame("Viewport", -PaddingContent, -PaddingContent, MwViewportClass, NULL);
|
||||||
|
w = child(f);
|
||||||
|
MwViewportSetSize(w, 256, 256);
|
||||||
|
MwVaCreateWidget(MwButtonClass, "btn", MwViewportGetViewport(w), 64, 64, 128, 128,
|
||||||
|
MwNtext, "Thing",
|
||||||
|
NULL);
|
||||||
|
add(f);
|
||||||
|
|
||||||
if(n != 0) newrow();
|
if(n != 0) newrow();
|
||||||
if(n == 0) MwDestroyWidget(boxes[row]);
|
if(n == 0) MwDestroyWidget(boxes[row]);
|
||||||
|
|
||||||
|
|
@ -300,4 +317,6 @@ int main() {
|
||||||
resize(window, NULL, NULL);
|
resize(window, NULL, NULL);
|
||||||
|
|
||||||
MwLoop(window);
|
MwLoop(window);
|
||||||
|
|
||||||
|
MwLLDestroyPixmap(px);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,12 +31,12 @@ int main() {
|
||||||
|
|
||||||
if(px == NULL) px = MwLoadImage(vp, "picture.png");
|
if(px == NULL) px = MwLoadImage(vp, "picture.png");
|
||||||
|
|
||||||
// MwVaCreateWidget(MwImageClass, "image", MwViewportGetViewport(vp), 0, 0, 1024, 1024,
|
// MwVaCreateWidget(MwImageClass, "image", MwViewportGetViewport(vp), 0, 0, 1024, 1024,
|
||||||
// MwNpixmap, px,
|
// MwNpixmap, px,
|
||||||
// NULL);
|
// NULL);
|
||||||
MwViewportSetSize(vp, 1024, 1024);
|
MwViewportSetSize(vp, 1024, 1024);
|
||||||
MwWidget f = MwCreateWidget(MwFrameClass, "fr", MwViewportGetViewport(vp), 256, 256, 128, 128);
|
MwWidget f = MwCreateWidget(MwFrameClass, "fr", MwViewportGetViewport(vp), 256, 256, 128, 128);
|
||||||
f = MwCreateWidget(MwFrameClass, "fr", f, 0, 0, 128, 128);
|
f = MwCreateWidget(MwFrameClass, "fr", f, 0, 0, 128, 128);
|
||||||
MwCreateWidget(MwButtonClass, "btn", f, 64, 64, 128, 128);
|
MwCreateWidget(MwButtonClass, "btn", f, 64, 64, 128, 128);
|
||||||
|
|
||||||
MwAddUserHandler(w, MwNresizeHandler, resize, NULL);
|
MwAddUserHandler(w, MwNresizeHandler, resize, NULL);
|
||||||
|
|
|
||||||
|
|
@ -4,36 +4,36 @@
|
||||||
#define CP_UTF8 65001
|
#define CP_UTF8 65001
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
char* MwACPToUTF8(const char* input){
|
char* MwACPToUTF8(const char* input) {
|
||||||
#if defined(_WIN32) && defined(MW_HAS_WCHAR)
|
#if defined(_WIN32) && defined(MW_HAS_WCHAR)
|
||||||
int mbbytes = (strlen(input) + 1) * 4;
|
int mbbytes = (strlen(input) + 1) * 4;
|
||||||
int wbytes = 0;
|
int wbytes = 0;
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
wchar_t* wout;
|
wchar_t* wout;
|
||||||
char* mbout = malloc(mbbytes);
|
char* mbout = malloc(mbbytes);
|
||||||
|
|
||||||
wbytes = MultiByteToWideChar(CP_ACP, 0, input, strlen(input), NULL, 0) * sizeof(wchar_t);
|
wbytes = MultiByteToWideChar(CP_ACP, 0, input, strlen(input), NULL, 0) * sizeof(wchar_t);
|
||||||
if(wbytes == 0){
|
if(wbytes == 0) {
|
||||||
free(mbout);
|
free(mbout);
|
||||||
return MwStringDuplicate(input);
|
return MwStringDuplicate(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
wout = malloc(wbytes);
|
wout = malloc(wbytes);
|
||||||
len = wbytes / sizeof(wchar_t);
|
len = wbytes / sizeof(wchar_t);
|
||||||
|
|
||||||
memset(wout, 0, wbytes);
|
memset(wout, 0, wbytes);
|
||||||
memset(mbout, 0, mbbytes);
|
memset(mbout, 0, mbbytes);
|
||||||
|
|
||||||
len = MultiByteToWideChar(CP_ACP, 0, input, strlen(input), wout, len);
|
len = MultiByteToWideChar(CP_ACP, 0, input, strlen(input), wout, len);
|
||||||
if(len == 0){
|
if(len == 0) {
|
||||||
free(mbout);
|
free(mbout);
|
||||||
free(wout);
|
free(wout);
|
||||||
return MwStringDuplicate(input);
|
return MwStringDuplicate(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
len = WideCharToMultiByte(CP_UTF8, 0, wout, len, mbout, mbbytes, 0, 0);
|
len = WideCharToMultiByte(CP_UTF8, 0, wout, len, mbout, mbbytes, 0, 0);
|
||||||
if(len == 0){
|
if(len == 0) {
|
||||||
free(mbout);
|
free(mbout);
|
||||||
free(wout);
|
free(wout);
|
||||||
return MwStringDuplicate(input);
|
return MwStringDuplicate(input);
|
||||||
|
|
@ -49,36 +49,36 @@ char* MwACPToUTF8(const char* input){
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
char* MwUTF8ToACP(const char* input){
|
char* MwUTF8ToACP(const char* input) {
|
||||||
#if defined(_WIN32) && defined(MW_HAS_WCHAR)
|
#if defined(_WIN32) && defined(MW_HAS_WCHAR)
|
||||||
int mbbytes = (strlen(input) + 1) * 4;
|
int mbbytes = (strlen(input) + 1) * 4;
|
||||||
int wbytes = 0;
|
int wbytes = 0;
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
wchar_t* wout;
|
wchar_t* wout;
|
||||||
char* mbout = malloc(mbbytes);
|
char* mbout = malloc(mbbytes);
|
||||||
|
|
||||||
wbytes = MultiByteToWideChar(CP_UTF8, 0, input, strlen(input), NULL, 0) * sizeof(wchar_t);
|
wbytes = MultiByteToWideChar(CP_UTF8, 0, input, strlen(input), NULL, 0) * sizeof(wchar_t);
|
||||||
if(wbytes == 0){
|
if(wbytes == 0) {
|
||||||
free(mbout);
|
free(mbout);
|
||||||
return MwStringDuplicate(input);
|
return MwStringDuplicate(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
wout = malloc(wbytes);
|
wout = malloc(wbytes);
|
||||||
len = wbytes / sizeof(wchar_t);
|
len = wbytes / sizeof(wchar_t);
|
||||||
|
|
||||||
memset(wout, 0, wbytes);
|
memset(wout, 0, wbytes);
|
||||||
memset(mbout, 0, mbbytes);
|
memset(mbout, 0, mbbytes);
|
||||||
|
|
||||||
len = MultiByteToWideChar(CP_UTF8, 0, input, strlen(input), wout, len);
|
len = MultiByteToWideChar(CP_UTF8, 0, input, strlen(input), wout, len);
|
||||||
if(len == 0){
|
if(len == 0) {
|
||||||
free(mbout);
|
free(mbout);
|
||||||
free(wout);
|
free(wout);
|
||||||
return MwStringDuplicate(input);
|
return MwStringDuplicate(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
len = WideCharToMultiByte(CP_ACP, 0, wout, len, mbout, mbbytes, 0, 0);
|
len = WideCharToMultiByte(CP_ACP, 0, wout, len, mbout, mbbytes, 0, 0);
|
||||||
if(len == 0){
|
if(len == 0) {
|
||||||
free(mbout);
|
free(mbout);
|
||||||
free(wout);
|
free(wout);
|
||||||
return MwStringDuplicate(input);
|
return MwStringDuplicate(input);
|
||||||
|
|
|
||||||
|
|
@ -1763,6 +1763,7 @@ static void clip(MwLL handle) {
|
||||||
if(toplevel) {
|
if(toplevel) {
|
||||||
#define MIN(a, b) ((a) < (b) ? (a) : (b))
|
#define MIN(a, b) ((a) < (b) ? (a) : (b))
|
||||||
#define MAX(a, b) ((a) > (b) ? (a) : (b))
|
#define MAX(a, b) ((a) > (b) ? (a) : (b))
|
||||||
|
/* i seriously have no fucking idea how this works, do not ask me how this really works (nishi) */
|
||||||
x = 0;
|
x = 0;
|
||||||
y = 0;
|
y = 0;
|
||||||
cx = 0;
|
cx = 0;
|
||||||
|
|
@ -1772,11 +1773,22 @@ static void clip(MwLL handle) {
|
||||||
// ws is traversed result
|
// ws is traversed result
|
||||||
// ws[ws.length - 1] is ignored bc it's toplevel
|
// ws[ws.length - 1] is ignored bc it's toplevel
|
||||||
for(i = arrlen(ws) - 2; i >= 0; i--) {
|
for(i = arrlen(ws) - 2; i >= 0; i--) {
|
||||||
|
int j;
|
||||||
|
int l = 0;
|
||||||
|
|
||||||
x += ws[i]->wayland.x;
|
x += ws[i]->wayland.x;
|
||||||
y += ws[i]->wayland.y;
|
y += ws[i]->wayland.y;
|
||||||
|
|
||||||
cx = MAX(cx, ws[i]->wayland.x);
|
for(j = i - 1; j >= 0; j--) {
|
||||||
cy = MAX(cy, ws[i]->wayland.y);
|
if(ws[j]->wayland.x > cx) l = 1;
|
||||||
|
if(ws[j]->wayland.y > cy) l = 1;
|
||||||
|
if(l) break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!l) {
|
||||||
|
cx = MAX(cx, ws[i]->wayland.x);
|
||||||
|
cy = MAX(cy, ws[i]->wayland.y);
|
||||||
|
}
|
||||||
|
|
||||||
mx = MIN(mx, x + ws[i]->wayland.ww);
|
mx = MIN(mx, x + ws[i]->wayland.ww);
|
||||||
my = MIN(my, y + ws[i]->wayland.wh);
|
my = MIN(my, y + ws[i]->wayland.wh);
|
||||||
|
|
|
||||||
|
|
@ -962,38 +962,43 @@ static void MwLLDestroyPixmapImpl(MwLLPixmap pixmap) {
|
||||||
free(pixmap);
|
free(pixmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define DO_XRENDER(dest_px, src, format, bpp) \
|
||||||
|
{ \
|
||||||
|
Picture src_pic, dest_pic; \
|
||||||
|
XRenderPictFormat* fmt = XRenderFindStandardFormat(handle->x11.display, format); \
|
||||||
|
Pixmap src_px = XCreatePixmap(handle->x11.display, handle->x11.window, pixmap->common.width, pixmap->common.height, bpp); \
|
||||||
|
GC gc = XCreateGC(handle->x11.display, src_px, 0, NULL); \
|
||||||
|
\
|
||||||
|
dest_px = XCreatePixmap(handle->x11.display, handle->x11.window, rect->width, rect->height, bpp); \
|
||||||
|
\
|
||||||
|
XPutImage(handle->x11.display, src_px, gc, src, 0, 0, 0, 0, pixmap->common.width, pixmap->common.height); \
|
||||||
|
\
|
||||||
|
src_pic = XRenderCreatePicture(handle->x11.display, src_px, fmt, 0, &attr); \
|
||||||
|
dest_pic = XRenderCreatePicture(handle->x11.display, dest_px, fmt, 0, &attr); \
|
||||||
|
\
|
||||||
|
XRenderSetPictureTransform(handle->x11.display, src_pic, &m); \
|
||||||
|
XRenderComposite(handle->x11.display, PictOpSrc, src_pic, 0, dest_pic, 0, 0, 0, 0, 0, 0, rect->width, rect->height); \
|
||||||
|
\
|
||||||
|
XRenderFreePicture(handle->x11.display, src_pic); \
|
||||||
|
XRenderFreePicture(handle->x11.display, dest_pic); \
|
||||||
|
XFreePixmap(handle->x11.display, src_px); \
|
||||||
|
}
|
||||||
|
|
||||||
static void MwLLDrawPixmapImpl(MwLL handle, MwRect* rect, MwLLPixmap pixmap) {
|
static void MwLLDrawPixmapImpl(MwLL handle, MwRect* rect, MwLLPixmap pixmap) {
|
||||||
if(rect->width <= 0 || rect->height <= 0 || pixmap->common.width <= 0 || pixmap->common.height <= 0) return;
|
if(rect->width <= 0 || rect->height <= 0 || pixmap->common.width <= 0 || pixmap->common.height <= 0) return;
|
||||||
#ifdef USE_XRENDER
|
#ifdef USE_XRENDER
|
||||||
if(pixmap->x11.image != NULL && pixmap->x11.use_xrender) {
|
if(pixmap->x11.image != NULL && pixmap->x11.use_xrender) {
|
||||||
Pixmap px = XCreatePixmap(handle->x11.display, handle->x11.window, pixmap->common.width, pixmap->common.height, pixmap->x11.depth);
|
Pixmap px;
|
||||||
Pixmap mask = XCreatePixmap(handle->x11.display, handle->x11.window, rect->width, rect->height, 1);
|
Pixmap mask;
|
||||||
Pixmap pxsrc = XCreatePixmap(handle->x11.display, handle->x11.window, rect->width, rect->height, pixmap->x11.depth);
|
|
||||||
GC maskgc = XCreateGC(handle->x11.display, mask, 0, NULL);
|
|
||||||
XRenderPictFormat* format = XRenderFindStandardFormat(handle->x11.display, PictStandardRGB24);
|
|
||||||
XRenderPictureAttributes attr;
|
XRenderPictureAttributes attr;
|
||||||
Picture src, dest;
|
|
||||||
XTransform m;
|
XTransform m;
|
||||||
double xsc = (double)pixmap->common.width / rect->width;
|
double xsc;
|
||||||
double ysc = (double)pixmap->common.height / rect->height;
|
double ysc;
|
||||||
char* dm = malloc(rect->width * rect->height * 4);
|
|
||||||
XImage* destmask;
|
|
||||||
int y, x;
|
|
||||||
|
|
||||||
destmask = XCreateImage(handle->x11.display, DefaultVisual(handle->x11.display, DefaultScreen(handle->x11.display)), 1, ZPixmap, 0, dm, rect->width, rect->height, 32, rect->width * 4);
|
memset(&attr, 0, sizeof(attr));
|
||||||
|
|
||||||
for(y = 0; y < (int)rect->height; y++) {
|
xsc = (double)pixmap->common.width / rect->width;
|
||||||
for(x = 0; x < (int)rect->width; x++) {
|
ysc = (double)pixmap->common.height / rect->height;
|
||||||
int sy = y * pixmap->common.height / rect->height;
|
|
||||||
int sx = x * pixmap->common.width / rect->width;
|
|
||||||
sy = (int)sy;
|
|
||||||
sx = (int)sx;
|
|
||||||
|
|
||||||
XPutPixel(destmask, x, y, XGetPixel(pixmap->x11.mask, sx, sy));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
XPutImage(handle->x11.display, mask, maskgc, destmask, 0, 0, 0, 0, rect->width, rect->height);
|
|
||||||
|
|
||||||
m.matrix[0][0] = XDoubleToFixed(xsc);
|
m.matrix[0][0] = XDoubleToFixed(xsc);
|
||||||
m.matrix[0][1] = XDoubleToFixed(0);
|
m.matrix[0][1] = XDoubleToFixed(0);
|
||||||
|
|
@ -1007,30 +1012,16 @@ static void MwLLDrawPixmapImpl(MwLL handle, MwRect* rect, MwLLPixmap pixmap) {
|
||||||
m.matrix[2][1] = XDoubleToFixed(0);
|
m.matrix[2][1] = XDoubleToFixed(0);
|
||||||
m.matrix[2][2] = XDoubleToFixed(1.0);
|
m.matrix[2][2] = XDoubleToFixed(1.0);
|
||||||
|
|
||||||
memset(&attr, 0, sizeof(attr));
|
DO_XRENDER(px, pixmap->x11.image, PictStandardRGB24, pixmap->x11.depth);
|
||||||
|
DO_XRENDER(mask, pixmap->x11.mask, PictStandardA1, 1);
|
||||||
XPutImage(handle->x11.display, px, handle->x11.gc, pixmap->x11.image, 0, 0, 0, 0, pixmap->common.width, pixmap->common.height);
|
|
||||||
|
|
||||||
src = XRenderCreatePicture(handle->x11.display, px, format, 0, &attr);
|
|
||||||
dest = XRenderCreatePicture(handle->x11.display, pxsrc, format, 0, &attr);
|
|
||||||
|
|
||||||
XRenderSetPictureTransform(handle->x11.display, src, &m);
|
|
||||||
XRenderComposite(handle->x11.display, PictOpSrc, src, 0, dest, 0, 0, 0, 0, 0, 0, rect->width, rect->height);
|
|
||||||
|
|
||||||
XRenderFreePicture(handle->x11.display, src);
|
|
||||||
XRenderFreePicture(handle->x11.display, dest);
|
|
||||||
|
|
||||||
XSetClipMask(handle->x11.display, handle->x11.gc, mask);
|
XSetClipMask(handle->x11.display, handle->x11.gc, mask);
|
||||||
XSetClipOrigin(handle->x11.display, handle->x11.gc, rect->x, rect->y);
|
XSetClipOrigin(handle->x11.display, handle->x11.gc, rect->x, rect->y);
|
||||||
XCopyArea(handle->x11.display, pxsrc, handle->x11.pixmap, handle->x11.gc, 0, 0, rect->width, rect->height, rect->x, rect->y);
|
XCopyArea(handle->x11.display, px, handle->x11.pixmap, handle->x11.gc, 0, 0, rect->width, rect->height, rect->x, rect->y);
|
||||||
XSetClipMask(handle->x11.display, handle->x11.gc, None);
|
XSetClipMask(handle->x11.display, handle->x11.gc, None);
|
||||||
|
|
||||||
XDestroyImage(destmask);
|
|
||||||
|
|
||||||
XFreeGC(handle->x11.display, maskgc);
|
|
||||||
XFreePixmap(handle->x11.display, mask);
|
XFreePixmap(handle->x11.display, mask);
|
||||||
XFreePixmap(handle->x11.display, px);
|
XFreePixmap(handle->x11.display, px);
|
||||||
XFreePixmap(handle->x11.display, pxsrc);
|
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
if(pixmap->x11.image != NULL) {
|
if(pixmap->x11.image != NULL) {
|
||||||
|
|
|
||||||
|
|
@ -7,44 +7,37 @@
|
||||||
* These ""glyphs"" are unencumbered
|
* These ""glyphs"" are unencumbered
|
||||||
*/
|
*/
|
||||||
MwCursor MwCursorArrow = {
|
MwCursor MwCursorArrow = {
|
||||||
14, 14, -13, -14,
|
14, 14, -13, -14, {3, /* ............## */
|
||||||
{
|
15, /* ..........#### */
|
||||||
3, /* ............## */
|
62, /* ........#####. */
|
||||||
15, /* ..........#### */
|
254, /* ......#######. */
|
||||||
62, /* ........#####. */
|
1020, /* ....########.. */
|
||||||
254, /* ......#######. */
|
4092, /* ..##########.. */
|
||||||
1020, /* ....########.. */
|
248, /* ......#####... */
|
||||||
4092, /* ..##########.. */
|
504, /* .....######... */
|
||||||
248, /* ......#####... */
|
944, /* ....###.##.... */
|
||||||
504, /* .....######... */
|
1840, /* ...###..##.... */
|
||||||
944, /* ....###.##.... */
|
3616, /* ..###...#..... */
|
||||||
1840, /* ...###..##.... */
|
7200, /* .###....#..... */
|
||||||
3616, /* ..###...#..... */
|
14336, /* ###........... */
|
||||||
7200, /* .###....#..... */
|
4096, /* .#............ */
|
||||||
14336, /* ###........... */
|
0, 0}};
|
||||||
4096, /* .#............ */
|
|
||||||
0,
|
|
||||||
0
|
|
||||||
}
|
|
||||||
};
|
|
||||||
MwCursor MwCursorArrowMask = {
|
MwCursor MwCursorArrowMask = {
|
||||||
16, 16, -14, -15,
|
16, 16, -14, -15, {
|
||||||
{
|
7, /* .............### */
|
||||||
7, /* .............### */
|
31, /* ...........##### */
|
||||||
31, /* ...........##### */
|
127, /* .........####### */
|
||||||
127, /* .........####### */
|
510, /* .......########. */
|
||||||
510, /* .......########. */
|
2046, /* .....##########. */
|
||||||
2046, /* .....##########. */
|
8188, /* ...###########.. */
|
||||||
8188, /* ...###########.. */
|
16380, /* ..############.. */
|
||||||
16380, /* ..############.. */
|
16376, /* ..###########... */
|
||||||
16376, /* ..###########... */
|
2040, /* .....########... */
|
||||||
2040, /* .....########... */
|
4080, /* ....########.... */
|
||||||
4080, /* ....########.... */
|
8176, /* ...#########.... */
|
||||||
8176, /* ...#########.... */
|
16096, /* ..#####.###..... */
|
||||||
16096, /* ..#####.###..... */
|
31968, /* .#####..###..... */
|
||||||
31968, /* .#####..###..... */
|
63552, /* #####....#...... */
|
||||||
63552, /* #####....#...... */
|
28672, /* .###............ */
|
||||||
28672, /* .###............ */
|
8192 /* ..#............. */
|
||||||
8192 /* ..#............. */
|
}};
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
|
||||||
|
|
@ -7,44 +7,37 @@
|
||||||
* These ""glyphs"" are unencumbered
|
* These ""glyphs"" are unencumbered
|
||||||
*/
|
*/
|
||||||
MwCursor MwCursorDefault = {
|
MwCursor MwCursorDefault = {
|
||||||
8, 14, 0, -14,
|
8, 14, 0, -14, {128, /* #....... */
|
||||||
{
|
192, /* ##...... */
|
||||||
128, /* #....... */
|
224, /* ###..... */
|
||||||
192, /* ##...... */
|
240, /* ####.... */
|
||||||
224, /* ###..... */
|
248, /* #####... */
|
||||||
240, /* ####.... */
|
252, /* ######.. */
|
||||||
248, /* #####... */
|
254, /* #######. */
|
||||||
252, /* ######.. */
|
255, /* ######## */
|
||||||
254, /* #######. */
|
248, /* #####... */
|
||||||
255, /* ######## */
|
216, /* ##.##... */
|
||||||
248, /* #####... */
|
140, /* #...##.. */
|
||||||
216, /* ##.##... */
|
12, /* ....##.. */
|
||||||
140, /* #...##.. */
|
6, /* .....##. */
|
||||||
12, /* ....##.. */
|
6, /* .....##. */
|
||||||
6, /* .....##. */
|
0, 0}};
|
||||||
6, /* .....##. */
|
|
||||||
0,
|
|
||||||
0
|
|
||||||
}
|
|
||||||
};
|
|
||||||
MwCursor MwCursorDefaultMask = {
|
MwCursor MwCursorDefaultMask = {
|
||||||
10, 16, -1, -15,
|
10, 16, -1, -15, {
|
||||||
{
|
768, /* ##........ */
|
||||||
768, /* ##........ */
|
896, /* ###....... */
|
||||||
896, /* ###....... */
|
960, /* ####...... */
|
||||||
960, /* ####...... */
|
992, /* #####..... */
|
||||||
992, /* #####..... */
|
1008, /* ######.... */
|
||||||
1008, /* ######.... */
|
1016, /* #######... */
|
||||||
1016, /* #######... */
|
1020, /* ########.. */
|
||||||
1020, /* ########.. */
|
1022, /* #########. */
|
||||||
1022, /* #########. */
|
1023, /* ########## */
|
||||||
1023, /* ########## */
|
1023, /* ########## */
|
||||||
1023, /* ########## */
|
1016, /* #######... */
|
||||||
1016, /* #######... */
|
956, /* ###.####.. */
|
||||||
956, /* ###.####.. */
|
828, /* ##..####.. */
|
||||||
828, /* ##..####.. */
|
30, /* .....####. */
|
||||||
30, /* .....####. */
|
30, /* .....####. */
|
||||||
30, /* .....####. */
|
12 /* ......##.. */
|
||||||
12 /* ......##.. */
|
}};
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
|
||||||
|
|
@ -7,44 +7,37 @@
|
||||||
* These ""glyphs"" are unencumbered
|
* These ""glyphs"" are unencumbered
|
||||||
*/
|
*/
|
||||||
MwCursor MwCursorText = {
|
MwCursor MwCursorText = {
|
||||||
7, 14, -3, -7,
|
7, 14, -3, -7, {119, /* ###.### */
|
||||||
{
|
28, /* ..###.. */
|
||||||
119, /* ###.### */
|
8, /* ...#... */
|
||||||
28, /* ..###.. */
|
8, /* ...#... */
|
||||||
8, /* ...#... */
|
8, /* ...#... */
|
||||||
8, /* ...#... */
|
8, /* ...#... */
|
||||||
8, /* ...#... */
|
8, /* ...#... */
|
||||||
8, /* ...#... */
|
8, /* ...#... */
|
||||||
8, /* ...#... */
|
8, /* ...#... */
|
||||||
8, /* ...#... */
|
8, /* ...#... */
|
||||||
8, /* ...#... */
|
8, /* ...#... */
|
||||||
8, /* ...#... */
|
8, /* ...#... */
|
||||||
8, /* ...#... */
|
28, /* ..###.. */
|
||||||
8, /* ...#... */
|
119, /* ###.### */
|
||||||
28, /* ..###.. */
|
0, 0}};
|
||||||
119, /* ###.### */
|
|
||||||
0,
|
|
||||||
0
|
|
||||||
}
|
|
||||||
};
|
|
||||||
MwCursor MwCursorTextMask = {
|
MwCursor MwCursorTextMask = {
|
||||||
9, 16, -4, -8,
|
9, 16, -4, -8, {
|
||||||
{
|
495, /* ####.#### */
|
||||||
495, /* ####.#### */
|
511, /* ######### */
|
||||||
511, /* ######### */
|
511, /* ######### */
|
||||||
511, /* ######### */
|
124, /* ..#####.. */
|
||||||
124, /* ..#####.. */
|
56, /* ...###... */
|
||||||
56, /* ...###... */
|
56, /* ...###... */
|
||||||
56, /* ...###... */
|
56, /* ...###... */
|
||||||
56, /* ...###... */
|
56, /* ...###... */
|
||||||
56, /* ...###... */
|
56, /* ...###... */
|
||||||
56, /* ...###... */
|
56, /* ...###... */
|
||||||
56, /* ...###... */
|
56, /* ...###... */
|
||||||
56, /* ...###... */
|
56, /* ...###... */
|
||||||
56, /* ...###... */
|
124, /* ..#####.. */
|
||||||
124, /* ..#####.. */
|
511, /* ######### */
|
||||||
511, /* ######### */
|
511, /* ######### */
|
||||||
511, /* ######### */
|
495 /* ####.#### */
|
||||||
495 /* ####.#### */
|
}};
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
|
||||||
|
|
@ -468,7 +468,7 @@ static void scan(MwWidget handle, const char* path, int record) {
|
||||||
for(i = 0; i < arrlen(fc->entries); i++) {
|
for(i = 0; i < arrlen(fc->entries); i++) {
|
||||||
if(strcmp(fc->entries[i]->name, ".") == 0 || strcmp(fc->entries[i]->name, "..") == 0) continue;
|
if(strcmp(fc->entries[i]->name, ".") == 0 || strcmp(fc->entries[i]->name, "..") == 0) continue;
|
||||||
if(fc->entries[i]->type == MwDIRECTORY_DIRECTORY) {
|
if(fc->entries[i]->type == MwDIRECTORY_DIRECTORY) {
|
||||||
char date[128];
|
char date[128];
|
||||||
char* n = MwACPToUTF8(fc->entries[i]->name);
|
char* n = MwACPToUTF8(fc->entries[i]->name);
|
||||||
|
|
||||||
MwStringTime(date, fc->entries[i]->mtime);
|
MwStringTime(date, fc->entries[i]->mtime);
|
||||||
|
|
@ -485,8 +485,8 @@ static void scan(MwWidget handle, const char* path, int record) {
|
||||||
}
|
}
|
||||||
for(i = 0; i < arrlen(fc->entries); i++) {
|
for(i = 0; i < arrlen(fc->entries); i++) {
|
||||||
if(fc->entries[i]->type == MwDIRECTORY_FILE && !fc->dir_only) {
|
if(fc->entries[i]->type == MwDIRECTORY_FILE && !fc->dir_only) {
|
||||||
char date[128];
|
char date[128];
|
||||||
char size[128];
|
char size[128];
|
||||||
char* n = MwACPToUTF8(fc->entries[i]->name);
|
char* n = MwACPToUTF8(fc->entries[i]->name);
|
||||||
|
|
||||||
MwStringTime(date, fc->entries[i]->mtime);
|
MwStringTime(date, fc->entries[i]->mtime);
|
||||||
|
|
|
||||||
|
|
@ -189,9 +189,9 @@ static void frame_draw(MwWidget handle) {
|
||||||
}
|
}
|
||||||
p.x = MwDefaultBorderWidth(handle) + MwGetInteger(handle->parent, MwNleftPadding);
|
p.x = MwDefaultBorderWidth(handle) + MwGetInteger(handle->parent, MwNleftPadding);
|
||||||
for(j = 0; j < arrlen(lb->list[i].name); j++) {
|
for(j = 0; j < arrlen(lb->list[i].name); j++) {
|
||||||
char* t = lb->list[i].name[j];
|
char* t = lb->list[i].name[j];
|
||||||
char* str;
|
char* str;
|
||||||
int l = (j == 0 ? MwGetInteger(handle->parent, MwNleftPadding) : 0);
|
int l = (j == 0 ? MwGetInteger(handle->parent, MwNleftPadding) : 0);
|
||||||
MwPoint p2 = p;
|
MwPoint p2 = p;
|
||||||
|
|
||||||
p2.y += (MwTextHeight(handle, Font, "M") + Padding) / 2;
|
p2.y += (MwTextHeight(handle, Font, "M") + Padding) / 2;
|
||||||
|
|
@ -200,11 +200,11 @@ static void frame_draw(MwWidget handle) {
|
||||||
|
|
||||||
str = MwStringDuplicate(t);
|
str = MwStringDuplicate(t);
|
||||||
if(MwUTF8Length(str) > (get_col_width(lb, j) - l) / MwTextWidth(handle, Font, "M")) {
|
if(MwUTF8Length(str) > (get_col_width(lb, j) - l) / MwTextWidth(handle, Font, "M")) {
|
||||||
int ind = (get_col_width(lb, j) - l) / MwTextWidth(handle, Font, "M");
|
int ind = (get_col_width(lb, j) - l) / MwTextWidth(handle, Font, "M");
|
||||||
int seek = 0;
|
int seek = 0;
|
||||||
int l = 0;
|
int l = 0;
|
||||||
|
|
||||||
while(str[seek] != 0){
|
while(str[seek] != 0) {
|
||||||
int cp;
|
int cp;
|
||||||
seek += MwUTF8ToUTF32(str + seek, &cp);
|
seek += MwUTF8ToUTF32(str + seek, &cp);
|
||||||
|
|
||||||
|
|
@ -411,7 +411,7 @@ static int mwListBoxSetImpl(MwWidget handle, int row, int col, const char* text)
|
||||||
MwListBox lb = handle->internal;
|
MwListBox lb = handle->internal;
|
||||||
MwListBoxEntry entry;
|
MwListBoxEntry entry;
|
||||||
char* t = text == NULL ? NULL : MwStringDuplicate(text);
|
char* t = text == NULL ? NULL : MwStringDuplicate(text);
|
||||||
int new = 0;
|
int new = 0;
|
||||||
if(row == -1) row = arrlen(lb->list);
|
if(row == -1) row = arrlen(lb->list);
|
||||||
|
|
||||||
entry.name = NULL;
|
entry.name = NULL;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue