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 i, j;
|
||||
MwWidget f, w, b;
|
||||
int index;
|
||||
MwMenu m, m2;
|
||||
void* v;
|
||||
int i, j;
|
||||
MwWidget f, w, b;
|
||||
MwLLPixmap px;
|
||||
int index;
|
||||
MwMenu m, m2;
|
||||
void* v;
|
||||
|
||||
MwLibraryInit();
|
||||
|
||||
|
|
@ -157,6 +158,8 @@ int main() {
|
|||
MwNtitle, "Milsko Periodic Table",
|
||||
NULL);
|
||||
|
||||
px = MwLoadIcon(window, MwIconError);
|
||||
|
||||
menu = MwCreateWidget(MwMenuClass, "menu", window, 0, 0, 0, 0);
|
||||
|
||||
m = MwMenuAdd(menu, NULL, "File");
|
||||
|
|
@ -256,6 +259,12 @@ int main() {
|
|||
f = frame("Entry", -PaddingContent, 24, MwEntryClass, NULL);
|
||||
add(f);
|
||||
|
||||
f = frame("Image", -PaddingContent, -PaddingContent, MwImageClass,
|
||||
MwNpixmap, px,
|
||||
NULL);
|
||||
w = child(f);
|
||||
add(f);
|
||||
|
||||
f = frame("Label", -PaddingContent, -PaddingContent, MwLabelClass,
|
||||
MwNtext, "Epic text",
|
||||
NULL);
|
||||
|
|
@ -292,6 +301,14 @@ int main() {
|
|||
v = MwTreeViewAdd(w, v, NULL, "ghi");
|
||||
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) MwDestroyWidget(boxes[row]);
|
||||
|
||||
|
|
@ -300,4 +317,6 @@ int main() {
|
|||
resize(window, NULL, NULL);
|
||||
|
||||
MwLoop(window);
|
||||
|
||||
MwLLDestroyPixmap(px);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,12 +31,12 @@ int main() {
|
|||
|
||||
if(px == NULL) px = MwLoadImage(vp, "picture.png");
|
||||
|
||||
// MwVaCreateWidget(MwImageClass, "image", MwViewportGetViewport(vp), 0, 0, 1024, 1024,
|
||||
// MwNpixmap, px,
|
||||
// NULL);
|
||||
// MwVaCreateWidget(MwImageClass, "image", MwViewportGetViewport(vp), 0, 0, 1024, 1024,
|
||||
// MwNpixmap, px,
|
||||
// NULL);
|
||||
MwViewportSetSize(vp, 1024, 1024);
|
||||
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);
|
||||
|
||||
MwAddUserHandler(w, MwNresizeHandler, resize, NULL);
|
||||
|
|
|
|||
|
|
@ -4,36 +4,36 @@
|
|||
#define CP_UTF8 65001
|
||||
#endif
|
||||
|
||||
char* MwACPToUTF8(const char* input){
|
||||
char* MwACPToUTF8(const char* input) {
|
||||
#if defined(_WIN32) && defined(MW_HAS_WCHAR)
|
||||
int mbbytes = (strlen(input) + 1) * 4;
|
||||
int wbytes = 0;
|
||||
int wbytes = 0;
|
||||
int len;
|
||||
|
||||
wchar_t* wout;
|
||||
char* mbout = malloc(mbbytes);
|
||||
char* mbout = malloc(mbbytes);
|
||||
|
||||
wbytes = MultiByteToWideChar(CP_ACP, 0, input, strlen(input), NULL, 0) * sizeof(wchar_t);
|
||||
if(wbytes == 0){
|
||||
if(wbytes == 0) {
|
||||
free(mbout);
|
||||
return MwStringDuplicate(input);
|
||||
}
|
||||
|
||||
wout = malloc(wbytes);
|
||||
len = wbytes / sizeof(wchar_t);
|
||||
len = wbytes / sizeof(wchar_t);
|
||||
|
||||
memset(wout, 0, wbytes);
|
||||
memset(mbout, 0, mbbytes);
|
||||
|
||||
len = MultiByteToWideChar(CP_ACP, 0, input, strlen(input), wout, len);
|
||||
if(len == 0){
|
||||
if(len == 0) {
|
||||
free(mbout);
|
||||
free(wout);
|
||||
return MwStringDuplicate(input);
|
||||
}
|
||||
|
||||
|
||||
len = WideCharToMultiByte(CP_UTF8, 0, wout, len, mbout, mbbytes, 0, 0);
|
||||
if(len == 0){
|
||||
if(len == 0) {
|
||||
free(mbout);
|
||||
free(wout);
|
||||
return MwStringDuplicate(input);
|
||||
|
|
@ -46,39 +46,39 @@ char* MwACPToUTF8(const char* input){
|
|||
return mbout;
|
||||
#else
|
||||
return MwStringDuplicate(input);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
char* MwUTF8ToACP(const char* input){
|
||||
char* MwUTF8ToACP(const char* input) {
|
||||
#if defined(_WIN32) && defined(MW_HAS_WCHAR)
|
||||
int mbbytes = (strlen(input) + 1) * 4;
|
||||
int wbytes = 0;
|
||||
int wbytes = 0;
|
||||
int len;
|
||||
|
||||
wchar_t* wout;
|
||||
char* mbout = malloc(mbbytes);
|
||||
char* mbout = malloc(mbbytes);
|
||||
|
||||
wbytes = MultiByteToWideChar(CP_UTF8, 0, input, strlen(input), NULL, 0) * sizeof(wchar_t);
|
||||
if(wbytes == 0){
|
||||
if(wbytes == 0) {
|
||||
free(mbout);
|
||||
return MwStringDuplicate(input);
|
||||
}
|
||||
|
||||
wout = malloc(wbytes);
|
||||
len = wbytes / sizeof(wchar_t);
|
||||
len = wbytes / sizeof(wchar_t);
|
||||
|
||||
memset(wout, 0, wbytes);
|
||||
memset(mbout, 0, mbbytes);
|
||||
|
||||
len = MultiByteToWideChar(CP_UTF8, 0, input, strlen(input), wout, len);
|
||||
if(len == 0){
|
||||
if(len == 0) {
|
||||
free(mbout);
|
||||
free(wout);
|
||||
return MwStringDuplicate(input);
|
||||
}
|
||||
|
||||
|
||||
len = WideCharToMultiByte(CP_ACP, 0, wout, len, mbout, mbbytes, 0, 0);
|
||||
if(len == 0){
|
||||
if(len == 0) {
|
||||
free(mbout);
|
||||
free(wout);
|
||||
return MwStringDuplicate(input);
|
||||
|
|
@ -91,5 +91,5 @@ char* MwUTF8ToACP(const char* input){
|
|||
return mbout;
|
||||
#else
|
||||
return MwStringDuplicate(input);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1763,6 +1763,7 @@ static void clip(MwLL handle) {
|
|||
if(toplevel) {
|
||||
#define MIN(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;
|
||||
y = 0;
|
||||
cx = 0;
|
||||
|
|
@ -1772,11 +1773,22 @@ static void clip(MwLL handle) {
|
|||
// ws is traversed result
|
||||
// ws[ws.length - 1] is ignored bc it's toplevel
|
||||
for(i = arrlen(ws) - 2; i >= 0; i--) {
|
||||
int j;
|
||||
int l = 0;
|
||||
|
||||
x += ws[i]->wayland.x;
|
||||
y += ws[i]->wayland.y;
|
||||
|
||||
cx = MAX(cx, ws[i]->wayland.x);
|
||||
cy = MAX(cy, ws[i]->wayland.y);
|
||||
for(j = i - 1; j >= 0; j--) {
|
||||
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);
|
||||
my = MIN(my, y + ws[i]->wayland.wh);
|
||||
|
|
|
|||
|
|
@ -962,38 +962,43 @@ static void MwLLDestroyPixmapImpl(MwLLPixmap 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) {
|
||||
if(rect->width <= 0 || rect->height <= 0 || pixmap->common.width <= 0 || pixmap->common.height <= 0) return;
|
||||
#ifdef 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 mask = XCreatePixmap(handle->x11.display, handle->x11.window, rect->width, rect->height, 1);
|
||||
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);
|
||||
Pixmap px;
|
||||
Pixmap mask;
|
||||
XRenderPictureAttributes attr;
|
||||
Picture src, dest;
|
||||
XTransform m;
|
||||
double xsc = (double)pixmap->common.width / rect->width;
|
||||
double ysc = (double)pixmap->common.height / rect->height;
|
||||
char* dm = malloc(rect->width * rect->height * 4);
|
||||
XImage* destmask;
|
||||
int y, x;
|
||||
double xsc;
|
||||
double ysc;
|
||||
|
||||
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++) {
|
||||
for(x = 0; x < (int)rect->width; x++) {
|
||||
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);
|
||||
xsc = (double)pixmap->common.width / rect->width;
|
||||
ysc = (double)pixmap->common.height / rect->height;
|
||||
|
||||
m.matrix[0][0] = XDoubleToFixed(xsc);
|
||||
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][2] = XDoubleToFixed(1.0);
|
||||
|
||||
memset(&attr, 0, sizeof(attr));
|
||||
|
||||
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);
|
||||
DO_XRENDER(px, pixmap->x11.image, PictStandardRGB24, pixmap->x11.depth);
|
||||
DO_XRENDER(mask, pixmap->x11.mask, PictStandardA1, 1);
|
||||
|
||||
XSetClipMask(handle->x11.display, handle->x11.gc, mask);
|
||||
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);
|
||||
|
||||
XDestroyImage(destmask);
|
||||
|
||||
XFreeGC(handle->x11.display, maskgc);
|
||||
XFreePixmap(handle->x11.display, mask);
|
||||
XFreePixmap(handle->x11.display, px);
|
||||
XFreePixmap(handle->x11.display, pxsrc);
|
||||
} else
|
||||
#endif
|
||||
if(pixmap->x11.image != NULL) {
|
||||
|
|
|
|||
|
|
@ -7,44 +7,37 @@
|
|||
* These ""glyphs"" are unencumbered
|
||||
*/
|
||||
MwCursor MwCursorArrow = {
|
||||
14, 14, -13, -14,
|
||||
{
|
||||
3, /* ............## */
|
||||
15, /* ..........#### */
|
||||
62, /* ........#####. */
|
||||
254, /* ......#######. */
|
||||
1020, /* ....########.. */
|
||||
4092, /* ..##########.. */
|
||||
248, /* ......#####... */
|
||||
504, /* .....######... */
|
||||
944, /* ....###.##.... */
|
||||
1840, /* ...###..##.... */
|
||||
3616, /* ..###...#..... */
|
||||
7200, /* .###....#..... */
|
||||
14336, /* ###........... */
|
||||
4096, /* .#............ */
|
||||
0,
|
||||
0
|
||||
}
|
||||
};
|
||||
14, 14, -13, -14, {3, /* ............## */
|
||||
15, /* ..........#### */
|
||||
62, /* ........#####. */
|
||||
254, /* ......#######. */
|
||||
1020, /* ....########.. */
|
||||
4092, /* ..##########.. */
|
||||
248, /* ......#####... */
|
||||
504, /* .....######... */
|
||||
944, /* ....###.##.... */
|
||||
1840, /* ...###..##.... */
|
||||
3616, /* ..###...#..... */
|
||||
7200, /* .###....#..... */
|
||||
14336, /* ###........... */
|
||||
4096, /* .#............ */
|
||||
0, 0}};
|
||||
MwCursor MwCursorArrowMask = {
|
||||
16, 16, -14, -15,
|
||||
{
|
||||
7, /* .............### */
|
||||
31, /* ...........##### */
|
||||
127, /* .........####### */
|
||||
510, /* .......########. */
|
||||
2046, /* .....##########. */
|
||||
8188, /* ...###########.. */
|
||||
16380, /* ..############.. */
|
||||
16376, /* ..###########... */
|
||||
2040, /* .....########... */
|
||||
4080, /* ....########.... */
|
||||
8176, /* ...#########.... */
|
||||
16096, /* ..#####.###..... */
|
||||
31968, /* .#####..###..... */
|
||||
63552, /* #####....#...... */
|
||||
28672, /* .###............ */
|
||||
8192 /* ..#............. */
|
||||
}
|
||||
};
|
||||
16, 16, -14, -15, {
|
||||
7, /* .............### */
|
||||
31, /* ...........##### */
|
||||
127, /* .........####### */
|
||||
510, /* .......########. */
|
||||
2046, /* .....##########. */
|
||||
8188, /* ...###########.. */
|
||||
16380, /* ..############.. */
|
||||
16376, /* ..###########... */
|
||||
2040, /* .....########... */
|
||||
4080, /* ....########.... */
|
||||
8176, /* ...#########.... */
|
||||
16096, /* ..#####.###..... */
|
||||
31968, /* .#####..###..... */
|
||||
63552, /* #####....#...... */
|
||||
28672, /* .###............ */
|
||||
8192 /* ..#............. */
|
||||
}};
|
||||
|
|
|
|||
|
|
@ -7,44 +7,37 @@
|
|||
* These ""glyphs"" are unencumbered
|
||||
*/
|
||||
MwCursor MwCursorDefault = {
|
||||
8, 14, 0, -14,
|
||||
{
|
||||
128, /* #....... */
|
||||
192, /* ##...... */
|
||||
224, /* ###..... */
|
||||
240, /* ####.... */
|
||||
248, /* #####... */
|
||||
252, /* ######.. */
|
||||
254, /* #######. */
|
||||
255, /* ######## */
|
||||
248, /* #####... */
|
||||
216, /* ##.##... */
|
||||
140, /* #...##.. */
|
||||
12, /* ....##.. */
|
||||
6, /* .....##. */
|
||||
6, /* .....##. */
|
||||
0,
|
||||
0
|
||||
}
|
||||
};
|
||||
8, 14, 0, -14, {128, /* #....... */
|
||||
192, /* ##...... */
|
||||
224, /* ###..... */
|
||||
240, /* ####.... */
|
||||
248, /* #####... */
|
||||
252, /* ######.. */
|
||||
254, /* #######. */
|
||||
255, /* ######## */
|
||||
248, /* #####... */
|
||||
216, /* ##.##... */
|
||||
140, /* #...##.. */
|
||||
12, /* ....##.. */
|
||||
6, /* .....##. */
|
||||
6, /* .....##. */
|
||||
0, 0}};
|
||||
MwCursor MwCursorDefaultMask = {
|
||||
10, 16, -1, -15,
|
||||
{
|
||||
768, /* ##........ */
|
||||
896, /* ###....... */
|
||||
960, /* ####...... */
|
||||
992, /* #####..... */
|
||||
1008, /* ######.... */
|
||||
1016, /* #######... */
|
||||
1020, /* ########.. */
|
||||
1022, /* #########. */
|
||||
1023, /* ########## */
|
||||
1023, /* ########## */
|
||||
1016, /* #######... */
|
||||
956, /* ###.####.. */
|
||||
828, /* ##..####.. */
|
||||
30, /* .....####. */
|
||||
30, /* .....####. */
|
||||
12 /* ......##.. */
|
||||
}
|
||||
};
|
||||
10, 16, -1, -15, {
|
||||
768, /* ##........ */
|
||||
896, /* ###....... */
|
||||
960, /* ####...... */
|
||||
992, /* #####..... */
|
||||
1008, /* ######.... */
|
||||
1016, /* #######... */
|
||||
1020, /* ########.. */
|
||||
1022, /* #########. */
|
||||
1023, /* ########## */
|
||||
1023, /* ########## */
|
||||
1016, /* #######... */
|
||||
956, /* ###.####.. */
|
||||
828, /* ##..####.. */
|
||||
30, /* .....####. */
|
||||
30, /* .....####. */
|
||||
12 /* ......##.. */
|
||||
}};
|
||||
|
|
|
|||
|
|
@ -7,44 +7,37 @@
|
|||
* These ""glyphs"" are unencumbered
|
||||
*/
|
||||
MwCursor MwCursorText = {
|
||||
7, 14, -3, -7,
|
||||
{
|
||||
119, /* ###.### */
|
||||
28, /* ..###.. */
|
||||
8, /* ...#... */
|
||||
8, /* ...#... */
|
||||
8, /* ...#... */
|
||||
8, /* ...#... */
|
||||
8, /* ...#... */
|
||||
8, /* ...#... */
|
||||
8, /* ...#... */
|
||||
8, /* ...#... */
|
||||
8, /* ...#... */
|
||||
8, /* ...#... */
|
||||
28, /* ..###.. */
|
||||
119, /* ###.### */
|
||||
0,
|
||||
0
|
||||
}
|
||||
};
|
||||
7, 14, -3, -7, {119, /* ###.### */
|
||||
28, /* ..###.. */
|
||||
8, /* ...#... */
|
||||
8, /* ...#... */
|
||||
8, /* ...#... */
|
||||
8, /* ...#... */
|
||||
8, /* ...#... */
|
||||
8, /* ...#... */
|
||||
8, /* ...#... */
|
||||
8, /* ...#... */
|
||||
8, /* ...#... */
|
||||
8, /* ...#... */
|
||||
28, /* ..###.. */
|
||||
119, /* ###.### */
|
||||
0, 0}};
|
||||
MwCursor MwCursorTextMask = {
|
||||
9, 16, -4, -8,
|
||||
{
|
||||
495, /* ####.#### */
|
||||
511, /* ######### */
|
||||
511, /* ######### */
|
||||
124, /* ..#####.. */
|
||||
56, /* ...###... */
|
||||
56, /* ...###... */
|
||||
56, /* ...###... */
|
||||
56, /* ...###... */
|
||||
56, /* ...###... */
|
||||
56, /* ...###... */
|
||||
56, /* ...###... */
|
||||
56, /* ...###... */
|
||||
124, /* ..#####.. */
|
||||
511, /* ######### */
|
||||
511, /* ######### */
|
||||
495 /* ####.#### */
|
||||
}
|
||||
};
|
||||
9, 16, -4, -8, {
|
||||
495, /* ####.#### */
|
||||
511, /* ######### */
|
||||
511, /* ######### */
|
||||
124, /* ..#####.. */
|
||||
56, /* ...###... */
|
||||
56, /* ...###... */
|
||||
56, /* ...###... */
|
||||
56, /* ...###... */
|
||||
56, /* ...###... */
|
||||
56, /* ...###... */
|
||||
56, /* ...###... */
|
||||
56, /* ...###... */
|
||||
124, /* ..#####.. */
|
||||
511, /* ######### */
|
||||
511, /* ######### */
|
||||
495 /* ####.#### */
|
||||
}};
|
||||
|
|
|
|||
|
|
@ -468,7 +468,7 @@ static void scan(MwWidget handle, const char* path, int record) {
|
|||
for(i = 0; i < arrlen(fc->entries); i++) {
|
||||
if(strcmp(fc->entries[i]->name, ".") == 0 || strcmp(fc->entries[i]->name, "..") == 0) continue;
|
||||
if(fc->entries[i]->type == MwDIRECTORY_DIRECTORY) {
|
||||
char date[128];
|
||||
char date[128];
|
||||
char* n = MwACPToUTF8(fc->entries[i]->name);
|
||||
|
||||
MwStringTime(date, fc->entries[i]->mtime);
|
||||
|
|
@ -477,7 +477,7 @@ static void scan(MwWidget handle, const char* path, int record) {
|
|||
MwListBoxSet(fc->files, index, -1, date);
|
||||
MwListBoxSet(fc->files, index, -1, NULL);
|
||||
MwListBoxSetIcon(fc->files, index, fc->dir);
|
||||
|
||||
|
||||
free(n);
|
||||
|
||||
arrput(fc->sorted_entries, fc->entries[i]);
|
||||
|
|
@ -485,8 +485,8 @@ static void scan(MwWidget handle, const char* path, int record) {
|
|||
}
|
||||
for(i = 0; i < arrlen(fc->entries); i++) {
|
||||
if(fc->entries[i]->type == MwDIRECTORY_FILE && !fc->dir_only) {
|
||||
char date[128];
|
||||
char size[128];
|
||||
char date[128];
|
||||
char size[128];
|
||||
char* n = MwACPToUTF8(fc->entries[i]->name);
|
||||
|
||||
MwStringTime(date, fc->entries[i]->mtime);
|
||||
|
|
|
|||
|
|
@ -189,9 +189,9 @@ static void frame_draw(MwWidget handle) {
|
|||
}
|
||||
p.x = MwDefaultBorderWidth(handle) + MwGetInteger(handle->parent, MwNleftPadding);
|
||||
for(j = 0; j < arrlen(lb->list[i].name); j++) {
|
||||
char* t = lb->list[i].name[j];
|
||||
char* str;
|
||||
int l = (j == 0 ? MwGetInteger(handle->parent, MwNleftPadding) : 0);
|
||||
char* t = lb->list[i].name[j];
|
||||
char* str;
|
||||
int l = (j == 0 ? MwGetInteger(handle->parent, MwNleftPadding) : 0);
|
||||
MwPoint p2 = p;
|
||||
|
||||
p2.y += (MwTextHeight(handle, Font, "M") + Padding) / 2;
|
||||
|
|
@ -200,11 +200,11 @@ static void frame_draw(MwWidget handle) {
|
|||
|
||||
str = MwStringDuplicate(t);
|
||||
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 l = 0;
|
||||
int l = 0;
|
||||
|
||||
while(str[seek] != 0){
|
||||
while(str[seek] != 0) {
|
||||
int 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;
|
||||
MwListBoxEntry entry;
|
||||
char* t = text == NULL ? NULL : MwStringDuplicate(text);
|
||||
int new = 0;
|
||||
int new = 0;
|
||||
if(row == -1) row = arrlen(lb->list);
|
||||
|
||||
entry.name = NULL;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue