Compare commits

...

39 Commits

Author SHA1 Message Date
NishiOwO
e9fd2705d4 fix 2025-12-21 23:05:42 +09:00
NishiOwO
a824b4fc44 oops 2025-12-21 23:04:53 +09:00
NishiOwO
c7c8f236b0 yes 2025-12-21 23:03:33 +09:00
NishiOwO
bdc67d6369 text shadow 2025-12-21 23:02:02 +09:00
NishiOwO
873c75b882 fix 2025-12-21 22:21:10 +09:00
NishiOwO
e44eaa2c16 fix 2025-12-21 22:02:33 +09:00
NishiOwO
0d281c09ce i will work on vms port at some point 2025-12-21 20:25:57 +09:00
NishiOwO
2b30a06ecf wip VMS port 2025-12-21 19:29:05 +09:00
NishiOwO
188da6803e adjust some stuff 2025-12-21 15:33:48 +09:00
NishiOwO
2304b493d1 add MwNlength 2025-12-21 15:17:00 +09:00
NishiOwO
91d9677bf7 add seven segment 2025-12-21 14:38:07 +09:00
NishiOwO
f09960195f submenu 2025-12-21 12:08:08 +09:00
NishiOwO
ab9d0ffc5f improve submenu 2025-12-21 11:53:47 +09:00
NishiOwO
a67a0c11f8 fix 2025-12-19 23:31:05 +09:00
NishiOwO
dc8168df12 fix 2025-12-19 22:36:49 +09:00
NishiOwO
604ff72d6e add MwNbitmapFont 2025-12-19 22:35:35 +09:00
IoIxD
a384add9e9 wayland: properly do MwLLPending and MwLLNextEvent 2025-12-18 23:50:03 -07:00
IoIxD
6123fd1304 wayland: implement tool windows. add destructors for protocols 2025-12-18 23:32:51 -07:00
IoIxD
b7488b9440 wayland: seperate MwLLPending and MwLLNextEvent 2025-12-18 19:59:40 -07:00
IoIxD
18511dec2f wayland: remove a few unused fields 2025-12-18 18:27:44 -07:00
IoIxD
59ff6f1008 wayland: add icon support 2025-12-18 18:21:57 -07:00
IoIxD
a27a01ce41 wayland: MwLLGetClipboardImpl. 2025-12-18 17:46:23 -07:00
IoIxD
b0f4713ff1 wayland: remove unused cursor_shape 2025-12-18 13:46:22 -07:00
IoIxD
8d4e845e7c wayland: MwLLGetScreenSize 2025-12-18 13:43:45 -07:00
IoIxD
aeaf0a4547 wayland: MwLLGetCursorCoordImpl 2025-12-18 13:16:16 -07:00
IoIxD
b366fc12a7 Merge branch 'master' of ssh://gitea.nishi.boats:2222/pyrite-dev/milsko 2025-12-18 13:15:20 -07:00
IoIxD
d8c08f80d6 wayland: cursor support 2025-12-18 13:15:03 -07:00
NishiOwO
bfa0a5811e fix 2025-12-19 04:38:29 +09:00
NishiOwO
19f52488b8 fancy things 2025-12-19 03:57:45 +09:00
IoIxD
c6e7421b31 wayland: key modifiers 2025-12-18 11:36:04 -07:00
IoIxD
e3b3363e42 Merge branch 'master' of ssh://gitea.nishi.boats:2222/pyrite-dev/milsko 2025-12-18 11:29:12 -07:00
IoIxD
a815998ace wayland: fix pointer 2025-12-18 11:26:51 -07:00
NishiOwO
75749697ba netbsd wants pthread. idk why 2025-12-19 03:01:12 +09:00
NishiOwO
c9c3a00ed3 unrelated changes 2025-12-19 02:55:30 +09:00
NishiOwO
012650f06f tiny change 2025-12-19 01:37:02 +09:00
NishiOwO
72fbba1a74 force aliasing 2025-12-18 12:24:06 +09:00
IoIxD
b8a92f4ae0 wayland: buffer destroy/recreate in SetWHImpl too 2025-12-17 19:44:15 -07:00
IoIxD
724b008220 impl resizing in wayland 2025-12-17 19:41:05 -07:00
IoIxD
320de34ce8 remove opengl from wayland in favor of cairo 2025-12-17 19:14:54 -07:00
33 changed files with 2087 additions and 566 deletions

1
.gitignore vendored
View File

@@ -11,4 +11,5 @@ examples/*/*.exe
*.lib
*.a
/Makefile
/build
compile_flags.txt

View File

@@ -56,14 +56,16 @@ my %features = (
"vulkan" => "build Vulkan widget",
"vulkan-string-helper" => "use Vulkan string helper",
"shared" => "build shared library",
"static" => "build static library"
"static" => "build static library",
"experimental-wayland" => "enable WIP wayland backend",
);
my @features_keys = (
"1classic-theme", "1stb-image",
"1stb-truetype", "1freetype2",
"1opengl", "2xrender",
"1vulkan", "2vulkan-string-helper",
"1shared", "1static"
"1shared", "1static",
"1experimental-wayland"
);
foreach my $l (@ARGV) {

View File

@@ -0,0 +1,65 @@
#define _MILSKO
#include <Mw/Milsko.h>
MwWidget window, button, text;
void resize(MwWidget handle, void* user_data, void* call_data) {
unsigned int w, h, mh;
(void)user_data;
(void)call_data;
w = MwGetInteger(handle, MwNwidth);
h = MwGetInteger(handle, MwNheight);
MwVaApply(button,
MwNy, 50 + mh,
MwNwidth, w - 50 * 2,
MwNheight, h - 125 - 50 * 3,
NULL);
MwVaApply(text,
MwNy, 200 + mh,
MwNwidth, w - 50 * 2,
MwNheight, h - 125 - 50 * 3,
NULL);
}
void handler(MwWidget handle, void* user_data, void* call_data) {
(void)handle;
(void)user_data;
(void)call_data;
char* clipboard;
clipboard = MwLLGetClipboard(handle->lowlevel);
if(clipboard != NULL) {
MwVaApply(text, MwNtext, clipboard);
MwForceRender(text);
}
resize(window, NULL, NULL);
}
int main() {
MwMenu m, m2;
MwLibraryInit();
window = MwVaCreateWidget(MwWindowClass, "main", NULL, MwDEFAULT, MwDEFAULT, 400, 400,
MwNtitle, "clipboard",
NULL);
button = MwVaCreateWidget(MwButtonClass, "button", window, 50, 50, 300, 125,
MwNtext, "get clipboard contents",
NULL);
text = MwVaCreateWidget(MwLabelClass, "label", window, 50, 200, 300, 125,
MwNtext, "",
NULL);
MwAddUserHandler(window, MwNresizeHandler, resize, NULL);
MwAddUserHandler(button, MwNactivateHandler, handler, NULL);
resize(window, NULL, NULL);
MwLoop(window);
}

View File

@@ -0,0 +1,23 @@
#include <Mw/Milsko.h>
int main() {
MwWidget wnd, label;
int W = 480, H = 40;
MwLibraryInit();
wnd = MwVaCreateWidget(MwWindowClass, "main", NULL, MwDEFAULT, MwDEFAULT, W, H,
MwNtitle, "seven segment",
NULL);
label = MwVaCreateWidget(MwLabelClass, "label", wnd, 0, 0, W, H,
MwNtext, " 123456:78.90 abcdef",
MwNsevenSegment, 1,
MwNalignment, MwALIGNMENT_BEGINNING,
MwNlength, 8,
NULL);
MwLabelSetSevenSegment(label, 0, (1 << 0) | (1 << 3) | (1 << 6));
MwLoop(wnd);
}

View File

@@ -52,6 +52,11 @@ MWDECL const char* MwDefaultDarkSubBackground;
*/
MWDECL const char* MwDefaultDarkSubForeground;
/*!
* @brief Default shadow difference
*/
MWDECL const int MwDefaultShadow;
/*!
* @brief Gets default border width
* @param handle Widget

View File

@@ -12,13 +12,10 @@
#include <Mw/LowLevel.h>
#include <wayland-client-protocol.h>
#include <wayland-egl.h>
#include <EGL/egl.h>
#include <GL/gl.h>
#include <GL/glext.h>
#include <wayland-client.h>
#include <xkbcommon/xkbcommon.h>
#include <cairo/cairo.h>
MWDECL int MwLLWaylandCallInit(void);
@@ -27,6 +24,8 @@ MWDECL int MwLLWaylandCallInit(void);
#include "Wayland/xdg-shell-client-protocol.h"
#include "Wayland/xdg-decoration-client-protocol.h"
#include "Wayland/cursor-shape-client-protocol.h"
#include "Wayland/primary-selection-client-protocol.h"
#include "Wayland/xdg-toplevel-icon-client-protocol.h"
#endif
struct _MwLLWayland;
@@ -37,6 +36,12 @@ typedef struct wayland_protocol {
} wayland_protocol_t;
typedef wayland_protocol_t*(wl_setup_func)(MwU32, struct _MwLLWayland*);
typedef void(wl_destroy_func)(struct _MwLLWayland* wayland, wayland_protocol_t* data);
typedef struct wayland_protocol_callback_table {
wl_setup_func* setup;
wl_destroy_func* destroy;
} wayland_protocol_callback_table_t;
struct _MwLLWaylandTopLevel {
struct xdg_surface* xdg_surface;
@@ -53,21 +58,64 @@ struct _MwLLWaylandTopLevel {
MwBool xdg_surface_created;
};
struct _MwLLWaylandSublevel {
struct wl_subsurface* subsurface;
struct wl_subcompositor* subcompositor;
MwLL parent;
struct xdg_surface* parent_xdg_surface;
};
struct _MwLLWaylandPopup {
struct xdg_surface* xdg_surface;
struct xdg_popup* xdg_popup;
struct xdg_positioner* xdg_positioner;
struct xdg_surface_listener xdg_surface_listener;
struct xdg_wm_base* xdg_wm_base;
MwLL parent;
};
/* Shared set of anything needed for a shm buffer. */
struct _MwLLWaylandShmBuffer {
struct wl_shm* shm;
struct wl_shm_pool* shm_pool;
struct wl_buffer* shm_buffer;
struct wl_surface* surface;
struct wl_output* output;
MwU8* buf;
MwU64 buf_size;
int fd;
MwBool setup;
};
enum _MwLLWaylandType {
MWLL_WAYLAND_UNKNOWN = 0,
MWLL_WAYLAND_TOPLEVEL,
MWLL_WAYLAND_SUBLEVEL,
MWLL_WAYLAND_POPUP,
};
struct _MwLLWayland {
struct _MwLLCommon common;
/* Pointer for data that's only loaded if the widget is a toplevel */
struct _MwLLWaylandTopLevel* toplevel;
union {
/* Pointer for data that's only loaded if the widget is a toplevel */
struct _MwLLWaylandTopLevel* toplevel;
/* Pointer for data that's only loaded if the widget is a sublevel */
struct _MwLLWaylandSublevel* sublevel;
/* Pointer for data that's only loaded if the widget is a popup */
struct _MwLLWaylandPopup* popup;
};
enum {
MWLL_WAYLAND_TOPLEVEL = 0,
MWLL_WAYLAND_SUBLEVEL = 1, /* Sublevels are surfaces that have the toplevel as a parent. They could be implemented as subsurfaces if we ever switch away from OpenGL. Some parts of the code also call them subwidgets. */
} type;
enum _MwLLWaylandType type;
enum _MwLLWaylandType type_to_be;
/* Map of Wayland interfaces to their relevant setup functions. */
struct {
const char* key;
wl_setup_func* value;
const char* key;
wayland_protocol_callback_table_t* value;
}* wl_protocol_setup_map;
/* Map of Wayland interfaces to any information we keep about them once we've registered them. */
@@ -79,33 +127,34 @@ struct _MwLLWayland {
struct wl_display* display;
struct wl_registry* registry;
struct wl_compositor* compositor;
struct wl_subcompositor* subcompositor;
struct wl_surface* surface;
struct wl_registry_listener registry_listener;
struct wl_event_queue* event_queue;
struct wl_region* region;
struct wl_output* output;
EGLNativeWindowType egl_window_native;
EGLDisplay egl_display;
EGLContext egl_context;
EGLSurface egl_surface;
EGLConfig egl_config;
struct wl_pointer* pointer;
struct wl_keyboard* keyboard;
MwU32 pointer_serial;
MwBool events_pending;
MwBool test;
MwU32 mod_state;
MwLL* sublevels; /* stb_ds managed array of any sublevels */
MwBool configured; /* Whether or not xdg_toplevel_configure has run once */
MwBool egl_setup; /* Whether or not EGL has been set up */
MwBool has_set_xy /* Whether or not MwSetXY has been called */;
int resize_counter; /* Counter that's for a hack in event_loop */
MwU32 x, y, ww, wh; /* Window position */
MwU32 lw, lh; /* Last known window position */
MwPoint cur_mouse_pos; /* Currently known mouse position */
MwU32 x, y, ww, wh; /* Window position */
MwPoint cur_mouse_pos; /* Currently known mouse position */
struct timeval timer;
MwU64 cooldown_timer;
MwU64 cooldown_timer_epoch;
MwU32 mw, mh; /* Monitor width and height as advertised by wl_output.mode */
MwLL parent;
MwLL topmost_parent; /* The parent at the top of all the other parents. Usually a toplevel. */
struct _MwLLWaylandShmBuffer framebuffer;
struct _MwLLWaylandShmBuffer cursor;
struct _MwLLWaylandShmBuffer* icon;
cairo_surface_t* cs;
cairo_t* cairo;
};
struct _MwLLWaylandColor {
@@ -114,8 +163,8 @@ struct _MwLLWaylandColor {
struct _MwLLWaylandPixmap {
struct _MwLLCommonPixmap common;
GLuint texture;
MwBool texture_deleted;
cairo_surface_t* cs;
};
#endif

View File

@@ -35,6 +35,10 @@
#define MwNratio "Iratio"
#define MwNfixedSize "IfixedSize"
#define MwNmargin "Imargin"
#define MwNbitmapFont "IbitmapFont"
#define MwNsevenSegment "IsevenSegment"
#define MwNlength "Ilength"
#define MwNforceInverted "IforceInverted"
#define MwNtitle "Stitle"
#define MwNtext "Stext"

View File

@@ -20,6 +20,9 @@ typedef struct _MwViewport* MwViewport;
typedef struct _MwListBox* MwListBox;
typedef struct _MwComboBox* MwComboBox;
typedef struct _MwTreeView* MwTreeView;
typedef struct _MwScrollBar* MwScrollBar;
typedef struct _MwLabel* MwLabel;
typedef struct _MwLabelSegment MwLabelSegment;
typedef struct _MwListBoxEntry MwListBoxEntry;
typedef struct _MwTreeViewEntry MwTreeViewEntry;
typedef struct _MwDirectoryEntry MwDirectoryEntry;
@@ -164,6 +167,21 @@ struct _MwTreeView {
MwPoint pressed;
};
struct _MwScrollBar {
MwPoint point;
int drag;
int pos;
};
struct _MwLabel {
MwLabelSegment* segment;
};
struct _MwLabelSegment {
int key;
unsigned char value;
};
struct _MwDirectoryEntry {
char* name;
int type;

View File

@@ -17,6 +17,17 @@ extern "C" {
*/
MWDECL MwClass MwLabelClass;
/*!
* @brief Sets the custom data for seven segment
* @param handle Widget
* @param index Index
* @param data Data, `GFEDCBA` as 7-bit value
* @note See https://en.wikipedia.org/wiki/File:7_Segment_Display_with_Labeled_Segments.svg for what alphabets mean here
* */
MwInline void MwLabelSetSevenSegment(MwWidget handle, int index, int data) {
MwVaWidgetExecute(handle, "mwLabelSetSevenSegment", NULL, index, data);
}
#ifdef __cplusplus
}
#endif

View File

@@ -9,6 +9,7 @@
#include <Mw/TypeDefs.h>
#include <Mw/Core.h>
#ifndef __gl_h_
#ifdef _WIN32
#include <windows.h>
#else
@@ -19,6 +20,7 @@
#ifndef GLAPIENTRY
#define GLAPIENTRY APIENTRY
#endif
#endif
#ifdef __cplusplus
extern "C" {

View File

@@ -18,8 +18,15 @@ extern "C" {
*/
MWDECL MwClass MwSubMenuClass;
MwInline void MwSubMenuAppear(MwWidget handle, MwMenu menu, MwPoint* point) {
MwVaWidgetExecute(handle, "mwSubMenuAppear", NULL, menu, point);
/*!
* @brief Makes submenu appear
* @param handle Handle
* @param menu Menu
* @param point Point
* @param diff_calc Toggles different way to calculate positiion
*/
MwInline void MwSubMenuAppear(MwWidget handle, MwMenu menu, MwPoint* point, int diff_calc) {
MwVaWidgetExecute(handle, "mwSubMenuAppear", NULL, menu, point, diff_calc);
}
#ifdef __cplusplus

View File

@@ -51,6 +51,8 @@
- MwNbackgroundPixmap
- MwNratio
- MwNfixedSize
- MwNbitmapFont
- MwNforceInverted
Integer properties must be prefixed with I.
String properties must be prefixed with S.
@@ -87,6 +89,10 @@
<integer name="ratio" />
<integer name="fixedSize" />
<integer name="margin" />
<integer name="bitmapFont" />
<integer name="sevenSegment" />
<integer name="length" />
<integer name="forceInverted" />
<string name="title" />
<string name="text" />
@@ -493,6 +499,8 @@
<property name="orientation" />
<property name="margin" />
<property name="padding" />
<property name="hasBorder" />
<property name="inverted" />
</properties>
</widget>
<widget name="Button">
@@ -526,6 +534,7 @@
<property name="pixmap" />
<property name="hasBorder" />
<property name="inverted" />
<property name="fillArea" />
</properties>
</widget>
<widget name="Label">
@@ -533,7 +542,17 @@
<property name="text" />
<property name="alignment" />
<property name="bold" />
<property name="sevenSegment" />
<property name="length" />
</properties>
<functions>
<function name="SetSevenSegment">
<arguments>
<integer name="index" />
<integer name="data" />
</arguments>
</function>
</functions>
</widget>
<widget name="ListBox">
<properties>

View File

@@ -1,3 +1,8 @@
use_backend("x11");
if (param_get("experimental-wayland")) {
use_backend("wayland", "x11");
}
else {
use_backend("x11");
}
1;

View File

@@ -2,5 +2,6 @@ add_incdir("-I/usr/X11R7/include -I/usr/pkg/include");
add_libdir(
"-L/usr/X11R7/lib -Wl,-R/usr/X11R7/lib -L/usr/pkg/lib -Wl,-R/usr/pkg/lib");
use_backend("x11");
add_libs("-lpthread");
1;

View File

@@ -29,21 +29,17 @@ if (grep(/^gdi$/, @backends)) {
if (grep(/^wayland$/, @backends)) {
add_cflags("-DUSE_WAYLAND");
new_object("src/backend/wayland.c");
if ($cross) {
add_libs("-lGL -lEGL -lwayland-egl -lwayland-client -lxkbcommon");
}
else {
add_libs("-lGL -lEGL");
add_cflags(`pkg-config --cflags wayland-egl wayland-client xkbcommon`);
add_libs(`pkg-config --libs wayland-egl wayland-client xkbcommon`);
}
add_cflags(`pkg-config --cflags cairo wayland-client xkbcommon`);
add_libs(`pkg-config --libs cairo wayland-client xkbcommon`);
scan_wayland_protocol("stable", "xdg-shell", "");
scan_wayland_protocol("stable", "tablet", "-v2");
scan_wayland_protocol("staging", "cursor-shape", "-v1");
scan_wayland_protocol("unstable", "xdg-decoration", "-unstable-v1");
scan_wayland_protocol("stable", "xdg-shell", "");
scan_wayland_protocol("stable", "tablet", "-v2");
scan_wayland_protocol("staging", "xdg-toplevel-icon", "-v1");
scan_wayland_protocol("staging", "cursor-shape", "-v1");
scan_wayland_protocol("unstable", "xdg-decoration", "-unstable-v1");
scan_wayland_protocol("unstable", "primary-selection", "-unstable-v1");
$gl_libs = "-lGL -lGLU";
$gl_libs = "-lEGL -lwayland-egl lGL -lGLU";
}
if (param_get("stb-image")) {
@@ -118,6 +114,8 @@ new_example("examples/basic/colorpicker");
new_example("examples/basic/combobox");
new_example("examples/basic/treeview");
new_example("examples/basic/box");
new_example("examples/basic/clipboard");
new_example("examples/basic/sevensegment");
if (param_get("opengl")) {
new_example("examples/gldemos/boing", $gl_libs);

File diff suppressed because it is too large Load Diff

View File

@@ -428,6 +428,15 @@ void MwSetVoid(MwWidget handle, const char* key, void* value) {
}
}
static int inherit_integer(MwWidget handle, const char* key, int default_v) {
int v;
if(handle->parent != NULL && (v = MwGetInteger(handle->parent, key)) != MwDEFAULT) {
return v;
}
return default_v;
}
int MwGetInteger(MwWidget handle, const char* key) {
if(strcmp(key, MwNx) == 0 || strcmp(key, MwNy) == 0 || strcmp(key, MwNwidth) == 0 || strcmp(key, MwNheight) == 0) {
int x, y;
@@ -441,6 +450,18 @@ int MwGetInteger(MwWidget handle, const char* key) {
if(strcmp(key, MwNheight) == 0) return h;
return MwDEFAULT;
} else {
if(shgeti(handle->integer, key) == -1) {
#if defined(USE_STB_TRUETYPE) || defined(USE_FREETYPE2)
if(strcmp(key, MwNbitmapFont) == 0) return inherit_integer(handle, key, 0);
#else
if(strcmp(key, MwNbitmapFont) == 0) return inherit_integer(handle, key, 1);
#endif
#ifdef USE_CLASSIC_THEME
if(strcmp(key, MwNmodernLook) == 0) return inherit_integer(handle, key, 0);
#else
if(strcmp(key, MwNmodernLook) == 0) return inherit_integer(handle, key, 1);
#endif
}
return shget(handle->integer, key);
}
}
@@ -541,19 +562,6 @@ void MwVaListApply(MwWidget handle, va_list va) {
}
}
static void inherit_integer(MwWidget handle, const char* key, int default_value) {
int n;
MwWidget h = handle;
while(h != NULL) {
if((n = MwGetInteger(h, key)) != MwDEFAULT) {
MwSetInteger(handle, key, n);
return;
}
h = h->parent;
}
MwSetInteger(handle, key, default_value);
}
#if defined(USE_STB_TRUETYPE) || defined(USE_FREETYPE2)
static void set_font(MwWidget handle) {
void* f;
@@ -587,11 +595,6 @@ static void set_boldfont(MwWidget handle) {
void MwSetDefault(MwWidget handle) {
if(handle->lowlevel != NULL) MwLLSetCursor(handle->lowlevel, &MwCursorDefault, &MwCursorDefaultMask);
#ifdef USE_CLASSIC_THEME
inherit_integer(handle, MwNmodernLook, 0);
#else
inherit_integer(handle, MwNmodernLook, 1);
#endif
#if defined(USE_STB_TRUETYPE) || defined(USE_FREETYPE2)
set_font(handle);
set_boldfont(handle);
@@ -693,7 +696,7 @@ static void force_render_all(MwWidget handle) {
for(i = 0; i < arrlen(handle->children); i++) {
force_render_all(handle->children[i]);
}
MwForceRender(handle);
if(handle->lowlevel != NULL) MwForceRender(handle);
}
void MwToggleDarkTheme(MwWidget handle, int toggle) {

View File

@@ -10,6 +10,8 @@ const char* MwDefaultDarkForeground = "#ddd";
const char* MwDefaultDarkSubBackground = "#333";
const char* MwDefaultDarkSubForeground = "#ddd";
const int MwDefaultShadow = -32;
int MwDefaultBorderWidth(MwWidget handle) {
int bw = MwGetInteger(handle, MwNborderWidth);

View File

@@ -1,6 +1,7 @@
#include <Mw/Milsko.h>
#ifdef USE_STB_IMAGE
#ifdef NO_IMAGE
#elif defined(USE_STB_IMAGE)
#include "../external/stb_image.h"
#else
#include <png.h>
@@ -130,6 +131,9 @@ void MwDrawRectFading(MwWidget handle, MwRect* rect, MwLLColor color) {
}
void MwDrawFrame(MwWidget handle, MwRect* rect, MwLLColor color, int invert) {
int inv;
if((inv = MwGetInteger(handle, MwNforceInverted)) != MwDEFAULT && inv) invert = 1;
if(MwGetInteger(handle, MwNmodernLook)) {
MwDrawFrameEx(handle, rect, color, invert, MwDefaultBorderWidth(handle), 0, 0);
} else {
@@ -502,7 +506,8 @@ void MwDrawTriangle(MwWidget handle, MwRect* rect, MwLLColor color, int invert,
MwLLFreeColor(darker);
}
#ifndef USE_STB_IMAGE
#if defined(NO_IMAGE)
#elif !defined(USE_STB_IMAGE)
static void PNGCAPI user_error(png_structp png, const char* str) {
(void)str;
@@ -617,7 +622,9 @@ static unsigned char* load_jpeg(FILE* f, int* w, int* h) {
#endif
static unsigned char* load_image(const char* path, int* w, int* h) {
#ifdef USE_STB_IMAGE
#if defined(NO_IMAGE)
return NULL;
#elif defined(USE_STB_IMAGE)
int ch;
return stbi_load(path, w, h, &ch, 4);

View File

@@ -294,7 +294,7 @@ static int ttf_MwTextHeight(MwWidget handle, int count) {
void MwDrawText(MwWidget handle, MwPoint* point, const char* text, int bold, int align, MwLLColor color) {
if(strlen(text) == 0) return;
#ifdef TTF
if(ttf_MwDrawText(handle, point, text, bold, align, color))
if(MwGetInteger(handle, MwNbitmapFont) || ttf_MwDrawText(handle, point, text, bold, align, color))
#endif
bitmap_MwDrawText(handle, point, text, bold, align, color);
}
@@ -304,7 +304,7 @@ int MwTextWidth(MwWidget handle, const char* text) {
#ifdef TTF
int st;
if((st = ttf_MwTextWidth(handle, text)) != -1) return st;
if(!MwGetInteger(handle, MwNbitmapFont) && (st = ttf_MwTextWidth(handle, text)) != -1) return st;
#else
(void)handle;
@@ -331,7 +331,7 @@ int MwTextHeight(MwWidget handle, const char* text) {
if(out == '\n') c++;
}
#ifdef TTF
if((st = ttf_MwTextHeight(handle, c)) != -1) return st;
if(!MwGetInteger(handle, MwNbitmapFont) && (st = ttf_MwTextHeight(handle, c)) != -1) return st;
#endif
return FontHeight * c;
}

View File

@@ -8,6 +8,8 @@ static int create(MwWidget handle) {
MwSetInteger(handle, MwNorientation, MwHORIZONTAL);
MwSetInteger(handle, MwNmargin, 0);
MwSetInteger(handle, MwNpadding, 0);
MwSetInteger(handle, MwNhasBorder, 0);
MwSetInteger(handle, MwNinverted, 1);
return 0;
}
@@ -20,6 +22,11 @@ static void draw(MwWidget handle) {
r.y = 0;
r.width = MwGetInteger(handle, MwNwidth);
r.height = MwGetInteger(handle, MwNheight);
if(MwGetInteger(handle, MwNhasBorder)) {
MwDrawFrame(handle, &r, base, MwGetInteger(handle, MwNinverted));
}
MwDrawRect(handle, &r, base);
MwLLFreeColor(base);
@@ -31,9 +38,9 @@ static void layout(MwWidget handle) {
int i;
int sum = 0;
int horiz = MwGetInteger(handle, MwNorientation) == MwHORIZONTAL ? 1 : 0;
int sz = MwGetInteger(handle, horiz ? MwNwidth : MwNheight) - MwGetInteger(handle, MwNpadding) * 2;
int fsz = MwGetInteger(handle, horiz ? MwNheight : MwNwidth) - MwGetInteger(handle, MwNpadding) * 2;
int sk = MwGetInteger(handle, MwNpadding);
int sz = MwGetInteger(handle, horiz ? MwNwidth : MwNheight) - (MwGetInteger(handle, MwNpadding) + (MwGetInteger(handle, MwNhasBorder) ? MwDefaultBorderWidth(handle) : 0)) * 2;
int fsz = MwGetInteger(handle, horiz ? MwNheight : MwNwidth) - (MwGetInteger(handle, MwNpadding) + (MwGetInteger(handle, MwNhasBorder) ? MwDefaultBorderWidth(handle) : 0)) * 2;
int sk = MwGetInteger(handle, MwNpadding) + (MwGetInteger(handle, MwNhasBorder) ? MwDefaultBorderWidth(handle) : 0);
for(i = 0; i < arrlen(handle->children); i++) {
int n = MwGetInteger(handle->children[i], MwNratio);
@@ -58,13 +65,12 @@ static void layout(MwWidget handle) {
} else {
wsz = sz * n / sum;
}
wsz -= Margin;
MwVaApply(handle->children[i],
horiz ? MwNx : MwNy, sk, /* this is what gets changed */
horiz ? MwNy : MwNx, MwGetInteger(handle, MwNpadding), /* fixed between widgets */
horiz ? MwNwidth : MwNheight, wsz, /* this is what gets changed */
horiz ? MwNheight : MwNwidth, fsz, /* fixed between widgets */
horiz ? MwNx : MwNy, sk, /* this is what gets changed */
horiz ? MwNy : MwNx, MwGetInteger(handle, MwNpadding) + (MwGetInteger(handle, MwNhasBorder) ? MwDefaultBorderWidth(handle) : 0), /* fixed between widgets */
horiz ? MwNwidth : MwNheight, wsz, /* this is what gets changed */
horiz ? MwNheight : MwNwidth, fsz, /* fixed between widgets */
NULL);
sk += wsz + Margin;
}

View File

@@ -1,5 +1,7 @@
#include <Mw/Milsko.h>
#include "../../external/stb_ds.h"
static int create(MwWidget handle) {
MwSetDefault(handle);
@@ -18,6 +20,7 @@ static void draw(MwWidget handle) {
const char* str = MwGetText(handle, MwNtext);
MwLLPixmap px = MwGetVoid(handle, MwNpixmap);
MwLLPixmap bgpx = MwGetVoid(handle, MwNbackgroundPixmap);
int inv;
if(str == NULL) str = "";
@@ -27,7 +30,7 @@ static void draw(MwWidget handle) {
r.height = MwGetInteger(handle, MwNheight);
if(MwGetInteger(handle, MwNflat)) {
if(handle->pressed) {
if(handle->pressed || ((inv = MwGetInteger(handle, MwNforceInverted)) != MwDEFAULT && inv)) {
MwDrawWidgetBack(handle, &r, base, handle->pressed, 1);
} else {
MwDrawRect(handle, &r, base);
@@ -36,7 +39,7 @@ static void draw(MwWidget handle) {
MwDrawWidgetBack(handle, &r, base, handle->pressed, 1);
}
if(bgpx != NULL) MwLLDrawPixmap(handle->lowlevel, &r, bgpx);
if(MwGetInteger(handle, MwNflat) && !handle->pressed) {
if(MwGetInteger(handle, MwNflat) && !(handle->pressed || ((inv = MwGetInteger(handle, MwNforceInverted)) != MwDEFAULT && inv))) {
r.x += MwDefaultBorderWidth(handle);
r.y += MwDefaultBorderWidth(handle);
r.width -= MwDefaultBorderWidth(handle) * 2;

View File

@@ -29,7 +29,6 @@ static void draw(MwWidget handle) {
rr.width = MwGetInteger(handle, MwNwidth) - (MwDefaultBorderWidth(handle) * 2);
rr.height = MwGetInteger(handle, MwNheight) - (MwDefaultBorderWidth(handle) * 2);
} else {
rr.x = 0;
rr.y = 0;
rr.width = MwGetInteger(handle, MwNwidth);

View File

@@ -5,6 +5,7 @@ static int create(MwWidget handle) {
MwSetInteger(handle, MwNhasBorder, 0);
MwSetInteger(handle, MwNinverted, 1);
MwSetInteger(handle, MwNfillArea, 1);
return 0;
}
@@ -23,6 +24,13 @@ static void draw(MwWidget handle) {
MwDrawRect(handle, &r, base);
if(px != NULL) {
if(!MwGetInteger(handle, MwNfillArea)) {
r.x = (r.width - px->common.width) / 2;
r.y = (r.height - px->common.height) / 2;
r.width = px->common.width;
r.height = px->common.height;
}
MwLLDrawPixmap(handle->lowlevel, &r, px);
}

View File

@@ -1,21 +1,138 @@
#include <Mw/Milsko.h>
#include "../../external/stb_ds.h"
#define Spacing 1
static int create(MwWidget handle) {
MwLabel lab = malloc(sizeof(*lab));
lab->segment = NULL;
handle->internal = lab;
MwSetDefault(handle);
MwSetInteger(handle, MwNalignment, MwALIGNMENT_CENTER);
MwSetInteger(handle, MwNbold, 0);
MwSetInteger(handle, MwNsevenSegment, 0);
MwSetInteger(handle, MwNlength, 4);
return 0;
}
static void destroy(MwWidget handle) {
MwLabel lab = handle->internal;
hmfree(lab->segment);
free(handle->internal);
}
static void draw_v(MwWidget handle, unsigned char* raw, int x, int y, int stride, MwLLColor text) {
int cy, cx, b;
int l_one = MwGetInteger(handle, MwNlength) - (MwGetInteger(handle, MwNlength) % 2);
int s_one = (l_one * 3 / 4) - ((l_one * 3 / 4) % 2) + 1;
for(cy = y; cy < y + l_one; cy++) {
for(cx = x; cx < x + s_one; cx++) {
unsigned char* px = &raw[(cy * stride + cx) * 4];
px[0] = text->common.red;
px[1] = text->common.green;
px[2] = text->common.blue;
px[3] = 255;
}
}
b = y - (s_one - 1) / 2;
for(cy = b; cy < b + (s_one - 1) / 2; cy++) {
int w = (cy - b) * 2 + 1;
int b2 = x + (s_one - w) / 2;
for(cx = b2; cx < b2 + w; cx++) {
unsigned char* px;
px = &raw[(cy * stride + cx) * 4];
px[0] = text->common.red;
px[1] = text->common.green;
px[2] = text->common.blue;
px[3] = 255;
}
}
b = y + l_one;
for(cy = b; cy < b + (s_one - 1) / 2; cy++) {
int w = ((s_one - 1) / 2 - 1 - (cy - b)) * 2 + 1;
int b2 = x + (s_one - w) / 2;
for(cx = b2; cx < b2 + w; cx++) {
unsigned char* px;
px = &raw[(cy * stride + cx) * 4];
px[0] = text->common.red;
px[1] = text->common.green;
px[2] = text->common.blue;
px[3] = 255;
}
}
}
static void draw_h(MwWidget handle, unsigned char* raw, int x, int y, int stride, MwLLColor text) {
int cy, cx, b;
int l_one = MwGetInteger(handle, MwNlength) - (MwGetInteger(handle, MwNlength) % 2);
int s_one = (l_one * 3 / 4) - ((l_one * 3 / 4) % 2) + 1;
for(cx = x; cx < x + l_one; cx++) {
for(cy = y; cy < y + s_one; cy++) {
unsigned char* px = &raw[(cy * stride + cx) * 4];
px[0] = text->common.red;
px[1] = text->common.green;
px[2] = text->common.blue;
px[3] = 255;
}
}
b = x - (s_one - 1) / 2;
for(cx = b; cx < b + (s_one - 1) / 2; cx++) {
int w = (cx - b) * 2 + 1;
int b2 = y + (s_one - w) / 2;
for(cy = b2; cy < b2 + w; cy++) {
unsigned char* px;
px = &raw[(cy * stride + cx) * 4];
px[0] = text->common.red;
px[1] = text->common.green;
px[2] = text->common.blue;
px[3] = 255;
}
}
b = x + l_one;
for(cx = b; cx < b + (s_one - 1) / 2; cx++) {
int w = ((s_one - 1) / 2 - 1 - (cx - b)) * 2 + 1;
int b2 = y + (s_one - w) / 2;
for(cy = b2; cy < b2 + w; cy++) {
unsigned char* px;
px = &raw[(cy * stride + cx) * 4];
px[0] = text->common.red;
px[1] = text->common.green;
px[2] = text->common.blue;
px[3] = 255;
}
}
}
static void draw(MwWidget handle) {
MwRect r;
MwPoint p;
MwLLColor base = MwParseColor(handle, MwGetText(handle, MwNbackground));
MwLLColor text = MwParseColor(handle, MwGetText(handle, MwNforeground));
MwLLColor base = MwParseColor(handle, MwGetText(handle, MwNbackground));
MwLLColor text = MwParseColor(handle, MwGetText(handle, MwNforeground));
MwLLColor shadow = MwLightenColor(handle, base, MwDefaultShadow, MwDefaultShadow, MwDefaultShadow);
int align;
const char* str = MwGetText(handle, MwNtext);
MwLLPixmap bgpx = MwGetVoid(handle, MwNbackgroundPixmap);
const char* str = MwGetText(handle, MwNtext);
MwLLPixmap bgpx = MwGetVoid(handle, MwNbackgroundPixmap);
MwLabel lab = handle->internal;
int l_one = MwGetInteger(handle, MwNlength) - (MwGetInteger(handle, MwNlength) % 2);
int s_one = (l_one * 3 / 4) - ((l_one * 3 / 4) % 2) + 1;
if(str == NULL) str = "";
@@ -28,40 +145,230 @@ static void draw(MwWidget handle) {
if(bgpx != NULL) MwLLDrawPixmap(handle->lowlevel, &r, bgpx);
align = MwGetInteger(handle, MwNalignment);
if(align == MwALIGNMENT_CENTER) {
p.x = r.width / 2;
} else if(align == MwALIGNMENT_BEGINNING) {
p.x = MwTextWidth(handle, str) / 2;
} else if(align == MwALIGNMENT_END) {
p.x = r.width - MwTextWidth(handle, str) / 2;
}
p.y = r.height / 2;
MwDrawText(handle, &p, str, MwGetInteger(handle, MwNbold), MwALIGNMENT_CENTER, text);
if(MwGetInteger(handle, MwNsevenSegment)) {
MwLLPixmap px;
unsigned char* raw;
int w = 0, h = s_one * 3 + l_one * 2, i;
int x = 0;
/* so - this mode cannot do unicode.
* but you wouldn't show unicode on 7 segment anyways
*/
/* L
* S <--->
*
* S
* ^
* |
* L |
* |
* v
*/
for(i = 0; (hmgeti(lab->segment, i) != -1) || str[i] != 0; i++) {
if(i > 0 && ((hmgeti(lab->segment, i) != -1) || str[i] != '.')) w += Spacing;
if(hmgeti(lab->segment, i) != -1 || ('0' <= str[i] && str[i] <= '9') || ('A' <= str[i] && str[i] <= 'F') || ('a' <= str[i] && str[i] <= 'f')) {
w += l_one + s_one * 2;
} else if(str[i] == ':' || str[i] == ' ') {
w += s_one;
}
}
w++;
h++;
raw = malloc(w * h * 4);
memset(raw, 0, w * h * 4);
for(i = 0; (hmgeti(lab->segment, i) != -1) || str[i] != 0; i++) {
if((hmgeti(lab->segment, i) != -1) || ('0' <= str[i] && str[i] <= '9') || ('A' <= str[i] && str[i] <= 'F') || ('a' <= str[i] && str[i] <= 'f')) {
int la = 0, lb = 0, lc = 0, ld = 0, le = 0, lf = 0, lg = 0;
int j;
/* https://en.wikipedia.org/wiki/File:7_Segment_Display_with_Labeled_Segments.svg */
if(hmgeti(lab->segment, i) != -1) {
unsigned char c = hmget(lab->segment, i);
if(c & (1 << 0)) la = 1;
if(c & (1 << 1)) lb = 1;
if(c & (1 << 2)) lc = 1;
if(c & (1 << 3)) ld = 1;
if(c & (1 << 4)) le = 1;
if(c & (1 << 5)) lf = 1;
if(c & (1 << 6)) lg = 1;
} else {
if(str[i] == '0') {
la = lb = lc = ld = le = lf = 1;
} else if(str[i] == '1') {
lb = lc = 1;
} else if(str[i] == '2') {
la = lb = ld = le = lg = 1;
} else if(str[i] == '3') {
la = lb = lc = ld = lg = 1;
} else if(str[i] == '4') {
lb = lc = lf = lg = 1;
} else if(str[i] == '5') {
la = lc = ld = lf = lg = 1;
} else if(str[i] == '6') {
la = lc = ld = le = lf = lg = 1;
} else if(str[i] == '7') {
la = lb = lc = 1;
} else if(str[i] == '8') {
la = lb = lc = ld = le = lf = lg = 1;
} else if(str[i] == '9') {
la = lb = lc = ld = lf = lg = 1;
} else if(str[i] == 'A' || str[i] == 'a') {
la = lb = lc = le = lf = lg = 1;
} else if(str[i] == 'B' || str[i] == 'b') {
lc = ld = le = lf = lg = 1;
} else if(str[i] == 'C' || str[i] == 'c') {
ld = le = lg = 1;
} else if(str[i] == 'D' || str[i] == 'd') {
lb = lc = ld = le = lg = 1;
} else if(str[i] == 'E' || str[i] == 'e') {
la = ld = le = lf = lg = 1;
} else if(str[i] == 'F' || str[i] == 'f') {
la = le = lf = lg = 1;
}
}
for(j = 1; j >= 0; j--) {
MwLLColor cl = j == 1 ? shadow : text;
if(la) draw_h(handle, raw, x + s_one + j, j, w, cl);
if(lb) draw_v(handle, raw, x + s_one + l_one + j, s_one + j, w, cl);
if(lc) draw_v(handle, raw, x + s_one + l_one + j, s_one * 2 + l_one + j, w, cl);
if(ld) draw_h(handle, raw, x + s_one + j, s_one * 2 + l_one * 2 + j, w, cl);
if(le) draw_v(handle, raw, x + j, s_one * 2 + l_one + j, w, cl);
if(lf) draw_v(handle, raw, x + j, s_one + j, w, cl);
if(lg) draw_h(handle, raw, x + s_one + j, s_one + l_one + j, w, cl);
}
x += l_one + s_one * 2;
} else if(str[i] == ':') {
int cy, cx;
int j;
for(j = 1; j >= 0; j--) {
MwLLColor cl = j == 1 ? shadow : text;
for(cy = 1; cy < h - 1; cy++) {
int c = (l_one - s_one) / 2 + s_one;
int c1 = (c <= cy && cy <= (c + s_one)) ? 1 : 0;
int c2 = ((s_one + l_one + c) <= cy && cy <= (s_one + l_one + c + s_one)) ? 1 : 0;
if(c1 || c2) {
for(cx = x; cx < x + s_one; cx++) {
unsigned char* px = &raw[((cy + j) * w + (cx + j)) * 4];
px[0] = cl->common.red;
px[1] = cl->common.green;
px[2] = cl->common.blue;
px[3] = 255;
}
}
}
}
x += s_one;
} else if(str[i] == ' ') {
x += s_one;
} else if(str[i] == '.') {
int cy, cx;
int j;
for(j = 1; j >= 0; j--) {
MwLLColor cl = j == 1 ? shadow : text;
for(cy = h - (s_one - 1) / 2 - 1; cy < h; cy++) {
for(cx = x - Spacing - (s_one - 1) / 2 - 1; cx < (x - Spacing); cx++) {
unsigned char* px = &raw[((cy + j) * w + (cx + j)) * 4];
px[0] = cl->common.red;
px[1] = cl->common.green;
px[2] = cl->common.blue;
px[3] = 255;
}
}
}
continue;
}
x += Spacing;
}
px = MwLoadRaw(handle, raw, w, h);
r.y = (r.height - h) / 2;
r.height = h;
if(align == MwALIGNMENT_CENTER) {
r.x = (r.width - w) / 2;
} else if(align == MwALIGNMENT_BEGINNING) {
r.x = 0;
} else if(align == MwALIGNMENT_END) {
r.x = r.width - w;
}
r.width = w;
MwLLDrawPixmap(handle->lowlevel, &r, px);
MwLLDestroyPixmap(px);
} else {
if(align == MwALIGNMENT_CENTER) {
p.x = r.width / 2;
} else if(align == MwALIGNMENT_BEGINNING) {
p.x = MwTextWidth(handle, str) / 2;
} else if(align == MwALIGNMENT_END) {
p.x = r.width - MwTextWidth(handle, str) / 2;
}
p.y = r.height / 2;
p.x += 1;
p.y += 1;
MwDrawText(handle, &p, str, MwGetInteger(handle, MwNbold), MwALIGNMENT_CENTER, shadow);
p.x -= 1;
p.y -= 1;
MwDrawText(handle, &p, str, MwGetInteger(handle, MwNbold), MwALIGNMENT_CENTER, text);
}
MwLLFreeColor(shadow);
MwLLFreeColor(text);
MwLLFreeColor(base);
}
static void prop_change(MwWidget handle, const char* key) {
if(strcmp(key, MwNtext) == 0 || strcmp(key, MwNalignment) == 0) MwForceRender(handle);
if(strcmp(key, MwNtext) == 0 || strcmp(key, MwNalignment) == 0 || strcmp(key, MwNsevenSegment) == 0) MwForceRender(handle);
}
static void mwLabelSetSevenSegmentImpl(MwWidget handle, int index, unsigned char data) {
MwLabel lab = handle->internal;
hmput(lab->segment, index, data);
}
static void func_handler(MwWidget handle, const char* name, void* out, va_list va) {
(void)out;
if(strcmp(name, "mwLabelSetSevenSegment") == 0) {
int index = va_arg(va, int);
int data = va_arg(va, int);
mwLabelSetSevenSegmentImpl(handle, index, data);
}
}
MwClassRec MwLabelClassRec = {
create, /* create */
NULL, /* destroy */
draw, /* draw */
NULL, /* click */
NULL, /* parent_resize */
prop_change, /* prop_change */
NULL, /* mouse_move */
NULL, /* mouse_up */
NULL, /* mouse_down */
NULL, /* key */
NULL, /* execute */
NULL, /* tick */
NULL, /* resize */
NULL, /* children_update */
NULL, /* children_prop_change */
create, /* create */
destroy, /* destroy */
draw, /* draw */
NULL, /* click */
NULL, /* parent_resize */
prop_change, /* prop_change */
NULL, /* mouse_move */
NULL, /* mouse_up */
NULL, /* mouse_down */
NULL, /* key */
func_handler, /* execute */
NULL, /* tick */
NULL, /* resize */
NULL, /* children_update */
NULL, /* children_prop_change */
NULL,
NULL,
NULL,

View File

@@ -258,7 +258,6 @@ static void frame_draw(MwWidget handle) {
if(j == (arrlen(lb->list[i].name) - 1)) p.x -= MwDefaultBorderWidth(handle);
if(arrlen(lb->alignment) <= j || lb->alignment[j] == MwALIGNMENT_BEGINNING) {
p.x += 4;
MwDrawText(handle, &p, str, 0, MwALIGNMENT_BEGINNING, selected ? base2 : text2);
p.x -= 4;

View File

@@ -129,7 +129,7 @@ static void mouse_down(MwWidget handle, void* ptr) {
p2.y = p.y + th / 2 + 5;
m->sub[i]->wsub = MwCreateWidget(MwSubMenuClass, "submenu", handle, 0, 0, 0, 0);
MwSubMenuAppear(m->sub[i]->wsub, m->sub[i], &p2);
MwSubMenuAppear(m->sub[i]->wsub, m->sub[i], &p2, 0);
} else if(m->sub[i]->wsub != NULL && m->sub[i]->keep) {
MwDestroyWidget(m->sub[i]->wsub);
m->sub[i]->wsub = NULL;

View File

@@ -1,12 +1,6 @@
#include <Mw/Milsko.h>
#include <Mw/Widget/OpenGL.h>
#ifdef USE_WAYLAND
#include <stb_ds.h>
#include <pthread.h>
#include <sys/time.h>
#endif
#ifdef USE_GDI
typedef HGLRC(WINAPI* MWwglCreateContext)(HDC);
typedef BOOL(WINAPI* MWwglMakeCurrent)(HDC, HGLRC);
@@ -110,8 +104,8 @@ static int create(MwWidget handle) {
}
#endif
#ifdef USE_WAYLAND
/* Wayland uses OpenGL as its backend so its already initialized */
if(handle->lowlevel->common.type == MwLLBackendWayland) {
/* todo */
}
#endif
@@ -146,7 +140,9 @@ static void destroy(MwWidget handle) {
}
#endif
#ifdef USE_WAYLAND
/* Wayland uses OpenGL as its backend so its destroyed accordingly */
if(handle->lowlevel->common.type == MwLLBackendWayland) {
/* todo */
}
#endif
free(handle->internal);
@@ -169,6 +165,7 @@ static void mwOpenGLMakeCurrentImpl(MwWidget handle) {
#endif
#ifdef USE_WAYLAND
if(handle->lowlevel->common.type == MwLLBackendWayland) {
/* todo */
}
#endif
}
@@ -189,14 +186,9 @@ static void mwOpenGLSwapBufferImpl(MwWidget handle) {
}
#endif
#ifdef USE_WAYLAND
#define tp handle->lowlevel->wayland.topmost_parent->wayland
if(handle->lowlevel->common.type == MwLLBackendWayland) {
if(!eglSwapBuffers(
tp.egl_display, tp.egl_surface)) {
printf("Userland error: eglSwapBuffers, %0X\n", eglGetError());
}
/* todo */
}
#undef topmost_parent
#endif
}
@@ -217,7 +209,7 @@ static void* mwOpenGLGetProcAddressImpl(MwWidget handle, const char* name) {
#endif
#ifdef USE_WAYLAND
if(handle->lowlevel->common.type == MwLLBackendWayland) {
return eglGetProcAddress(name);
/* todo */
}
#endif
return NULL;

View File

@@ -1,13 +1,7 @@
#include <Mw/Milsko.h>
typedef struct scrollbar {
MwPoint point;
int drag;
int pos;
} scrollbar_t;
static int create(MwWidget handle) {
scrollbar_t* scr = malloc(sizeof(*scr));
MwScrollBar scr = malloc(sizeof(*scr));
handle->internal = scr;
@@ -60,10 +54,10 @@ static void add_value(MwWidget handle, int mul) {
}
static void draw(MwWidget handle) {
MwRect r, rt, rbar;
MwLLColor base = MwParseColor(handle, MwGetText(handle, MwNbackground));
MwLLColor dark = MwLightenColor(handle, base, -64, -64, -64);
scrollbar_t* scr = handle->internal;
MwRect r, rt, rbar;
MwLLColor base = MwParseColor(handle, MwGetText(handle, MwNbackground));
MwLLColor dark = MwLightenColor(handle, base, -64, -64, -64);
MwScrollBar scr = handle->internal;
int or ;
int uy, dy, ux, dx;
MwLLPixmap bgpx = MwGetVoid(handle, MwNbackgroundPixmap);
@@ -144,8 +138,8 @@ static void draw(MwWidget handle) {
}
static void mouse_move(MwWidget handle) {
int or = MwGetInteger(handle, MwNorientation);
scrollbar_t* scr = handle->internal;
int or = MwGetInteger(handle, MwNorientation);
MwScrollBar scr = handle->internal;
if(!handle->pressed) return;
@@ -172,11 +166,11 @@ static void mouse_move(MwWidget handle) {
}
static void mouse_down(MwWidget handle, void* ptr) {
int ww = MwGetInteger(handle, MwNwidth);
int wh = MwGetInteger(handle, MwNheight);
int or = MwGetInteger(handle, MwNorientation);
scrollbar_t* scr = handle->internal;
MwLLMouse* m = ptr;
int ww = MwGetInteger(handle, MwNwidth);
int wh = MwGetInteger(handle, MwNheight);
int or = MwGetInteger(handle, MwNorientation);
MwScrollBar scr = handle->internal;
MwLLMouse* m = ptr;
if(m->button == MwLLMouseWheelUp) {
int min = MwGetInteger(handle, MwNminValue);

View File

@@ -130,10 +130,10 @@ static void click(MwWidget handle) {
p.y = rc.y - 3;
menu->sub[i]->wsub = MwCreateWidget(MwSubMenuClass, "submenu", handle, 0, 0, 0, 0);
MwSubMenuAppear(menu->sub[i]->wsub, menu->sub[i], &p);
MwSubMenuAppear(menu->sub[i]->wsub, menu->sub[i], &p, 0);
i = -1;
} else if(menu->sub[i]->wsub != NULL && arrlen(menu->sub[i]->sub) > 0) {
while(w->parent->widget_class != MwMenuClass) w = w->parent;
while(w->parent->widget_class == MwSubMenuClass) w = w->parent;
MwDestroyWidget(menu->sub[i]->wsub);
menu->sub[i]->wsub = NULL;
@@ -142,7 +142,7 @@ static void click(MwWidget handle) {
MwForceRender(handle);
} else if(strcmp(menu->sub[i]->name, "----") != 0 && arrlen(menu->sub[i]->sub) == 0) {
while(w->parent->widget_class != MwMenuClass) w = w->parent;
while(w->parent->widget_class == MwSubMenuClass) w = w->parent;
MwGetBeforeStep(w, &jmp);
MwDestroyWidget(w);
@@ -159,15 +159,15 @@ static void click(MwWidget handle) {
}
}
static void mwSubMenuAppearImpl(MwWidget handle, MwMenu menu, MwPoint* point) {
int i, w = 0, h = 0;
static void mwSubMenuAppearImpl(MwWidget handle, MwMenu menu, MwPoint* point, int diff_calc) {
int i, w = 0, h = 0;
MwRect rc;
MwPoint p = *point;
MwGetScreenSize(handle, &rc);
handle->internal = menu;
MwLLMakeToolWindow(handle->lowlevel);
MwLLDetach(handle->lowlevel, point);
MwLLEndStateChange(handle->lowlevel);
for(i = 0; i < arrlen(menu->sub); i++) {
if(strcmp(menu->sub[i]->name, "----") == 0) {
h += MwDefaultBorderWidth(handle) * 2 + 2;
@@ -183,6 +183,20 @@ static void mwSubMenuAppearImpl(MwWidget handle, MwMenu menu, MwPoint* point) {
w += 10 + 15;
h += 3;
if(diff_calc) {
p.y = p.y - h;
}
MwLLMakeToolWindow(handle->lowlevel);
MwLLDetach(handle->lowlevel, &p);
if(MwGetInteger(handle, MwNy) + h > rc.height) {
MwVaApply(handle,
MwNy, rc.height - h,
NULL);
}
MwLLEndStateChange(handle->lowlevel);
MwVaApply(handle,
MwNwidth, w,
MwNheight, h,
@@ -193,9 +207,10 @@ static void func_handler(MwWidget handle, const char* name, void* out, va_list v
(void)out;
if(strcmp(name, "mwSubMenuAppear") == 0) {
MwMenu menu = va_arg(va, MwMenu);
MwPoint* point = va_arg(va, MwPoint*);
mwSubMenuAppearImpl(handle, menu, point);
MwMenu menu = va_arg(va, MwMenu);
MwPoint* point = va_arg(va, MwPoint*);
int diff_calc = va_arg(va, int);
mwSubMenuAppearImpl(handle, menu, point, diff_calc);
}
}

105
tools/gendcl.pl Executable file
View File

@@ -0,0 +1,105 @@
#!/usr/bin/env perl
our $clean = 0;
my @objs = ();
sub compile {
my ($source) = @_;
my $object = "";
my $dir = "";
$dir = $source;
$dir =~ s/\/([^\/]+)$//;
$source =~ s/^(.+)\/([^\/]+)$/[\/\1]\2/;
$source =~ s/\//\./g;
$object = $source;
$object =~ s/\.c$/.obj/;
print(OUT "\$ if f\$search(\"$object;*\") .eqs. \"\"\n");
print(OUT "\$ then\n");
print(OUT "\$ write sys\$output \"CC $object\"\n");
print(OUT
"\$ cc /include_directory=(\"./include\",\"./$dir\") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=$object $source\n"
);
print(OUT "\$ endif\n");
push(@objs, $object);
}
sub clean {
my ($source) = @_;
my $object = "";
my $dir = "";
$source =~ s/^(.+)\/([^\/]+)$/[\/\1]\2/;
$source =~ s/\//\./g;
$object = $source;
$object =~ s/\.c$/.obj/;
print(OUT
"\$ if f\$search(\"$object\") .nes. \"\" then delete $object;*\n");
}
sub thing {
if ($clean) {
clean($_[0]);
}
else {
compile($_[0]);
}
}
sub scan {
my ($dir) = @_;
opendir(my $dh, $dir);
while (my $file = readdir($dh)) {
if ( !(($dir . "/" . $file) eq "src/widget/opengl.c")
&& !(($dir . "/" . $file) eq "src/widget/vulkan.c")
&& !(($dir . "/" . $file) eq "external/stb_truetype.c")
&& !(($dir . "/" . $file) eq "external/stb_image.c")
&& ($file =~ /\.c$/))
{
thing($dir . "/" . $file);
}
}
closedir($dh);
}
for (my $i = 0 ; $i < 2 ; $i++) {
$clean = $i;
open(OUT, ">", $i == 0 ? "vms/build.com" : "vms/clean.com");
scan("src");
scan("src/cursor");
scan("src/widget");
scan("src/dialog");
scan("src/font");
scan("src/icon");
scan("src/abstract");
scan("external");
thing("src/backend/x11.c");
if ($i == 0) {
print(OUT "\$ if f\$search(\"[.src]MwSHR.exe;*\") .eqs. \"\"\n");
print(OUT "\$ then\n");
print(OUT "\$ write sys\$output \"LINK [.src]MwSHR.exe\"\n");
print(OUT "\$ OPEN /WRITE LINK_OPT LINK.OPT\n");
foreach my $obj (@objs) {
print(OUT "\$ WRITE LINK_OPT \"$obj\"\n");
}
print(OUT "\$ WRITE LINK_OPT \"SYS\$LIBRARY:DECW\$XLIBSHR/SHARE\"\n");
print(OUT "\$ WRITE LINK_OPT \"SYS\$LIBRARY:DPML\$SHR/SHARE\"\n");
print(OUT "\$ CLOSE LINK_OPT\n");
print(OUT "\$ link /SHAREABLE=[.src]MwSHR.exe LINK.OPT/options\n");
print(OUT "\$ DELETE LINK.OPT;*\n");
print(OUT "\$ endif\n");
}
else {
clean("src/MwSHR.exe");
}
close(OUT);
}

382
vms/build.com Normal file
View File

@@ -0,0 +1,382 @@
$ if f$search("[.src]color.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src]color.obj"
$ cc /include_directory=("./include","./src") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src]color.obj [.src]color.c
$ endif
$ if f$search("[.src]core.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src]core.obj"
$ cc /include_directory=("./include","./src") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src]core.obj [.src]core.c
$ endif
$ if f$search("[.src]default.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src]default.obj"
$ cc /include_directory=("./include","./src") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src]default.obj [.src]default.c
$ endif
$ if f$search("[.src]draw.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src]draw.obj"
$ cc /include_directory=("./include","./src") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src]draw.obj [.src]draw.c
$ endif
$ if f$search("[.src]error.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src]error.obj"
$ cc /include_directory=("./include","./src") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src]error.obj [.src]error.c
$ endif
$ if f$search("[.src]lowlevel.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src]lowlevel.obj"
$ cc /include_directory=("./include","./src") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src]lowlevel.obj [.src]lowlevel.c
$ endif
$ if f$search("[.src]string.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src]string.obj"
$ cc /include_directory=("./include","./src") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src]string.obj [.src]string.c
$ endif
$ if f$search("[.src]text.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src]text.obj"
$ cc /include_directory=("./include","./src") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src]text.obj [.src]text.c
$ endif
$ if f$search("[.src]unicode.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src]unicode.obj"
$ cc /include_directory=("./include","./src") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src]unicode.obj [.src]unicode.c
$ endif
$ if f$search("[.src.cursor]arrow.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.cursor]arrow.obj"
$ cc /include_directory=("./include","./src/cursor") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.cursor]arrow.obj [.src.cursor]arrow.c
$ endif
$ if f$search("[.src.cursor]cross.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.cursor]cross.obj"
$ cc /include_directory=("./include","./src/cursor") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.cursor]cross.obj [.src.cursor]cross.c
$ endif
$ if f$search("[.src.cursor]default.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.cursor]default.obj"
$ cc /include_directory=("./include","./src/cursor") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.cursor]default.obj [.src.cursor]default.c
$ endif
$ if f$search("[.src.cursor]hidden.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.cursor]hidden.obj"
$ cc /include_directory=("./include","./src/cursor") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.cursor]hidden.obj [.src.cursor]hidden.c
$ endif
$ if f$search("[.src.cursor]text.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.cursor]text.obj"
$ cc /include_directory=("./include","./src/cursor") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.cursor]text.obj [.src.cursor]text.c
$ endif
$ if f$search("[.src.widget]button.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.widget]button.obj"
$ cc /include_directory=("./include","./src/widget") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.widget]button.obj [.src.widget]button.c
$ endif
$ if f$search("[.src.widget]checkbox.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.widget]checkbox.obj"
$ cc /include_directory=("./include","./src/widget") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.widget]checkbox.obj [.src.widget]checkbox.c
$ endif
$ if f$search("[.src.widget]combobox.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.widget]combobox.obj"
$ cc /include_directory=("./include","./src/widget") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.widget]combobox.obj [.src.widget]combobox.c
$ endif
$ if f$search("[.src.widget]entry.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.widget]entry.obj"
$ cc /include_directory=("./include","./src/widget") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.widget]entry.obj [.src.widget]entry.c
$ endif
$ if f$search("[.src.widget]frame.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.widget]frame.obj"
$ cc /include_directory=("./include","./src/widget") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.widget]frame.obj [.src.widget]frame.c
$ endif
$ if f$search("[.src.widget]image.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.widget]image.obj"
$ cc /include_directory=("./include","./src/widget") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.widget]image.obj [.src.widget]image.c
$ endif
$ if f$search("[.src.widget]label.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.widget]label.obj"
$ cc /include_directory=("./include","./src/widget") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.widget]label.obj [.src.widget]label.c
$ endif
$ if f$search("[.src.widget]listbox.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.widget]listbox.obj"
$ cc /include_directory=("./include","./src/widget") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.widget]listbox.obj [.src.widget]listbox.c
$ endif
$ if f$search("[.src.widget]menu.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.widget]menu.obj"
$ cc /include_directory=("./include","./src/widget") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.widget]menu.obj [.src.widget]menu.c
$ endif
$ if f$search("[.src.widget]numberentry.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.widget]numberentry.obj"
$ cc /include_directory=("./include","./src/widget") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.widget]numberentry.obj [.src.widget]numberentry.c
$ endif
$ if f$search("[.src.widget]progressbar.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.widget]progressbar.obj"
$ cc /include_directory=("./include","./src/widget") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.widget]progressbar.obj [.src.widget]progressbar.c
$ endif
$ if f$search("[.src.widget]radiobox.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.widget]radiobox.obj"
$ cc /include_directory=("./include","./src/widget") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.widget]radiobox.obj [.src.widget]radiobox.c
$ endif
$ if f$search("[.src.widget]scrollbar.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.widget]scrollbar.obj"
$ cc /include_directory=("./include","./src/widget") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.widget]scrollbar.obj [.src.widget]scrollbar.c
$ endif
$ if f$search("[.src.widget]separator.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.widget]separator.obj"
$ cc /include_directory=("./include","./src/widget") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.widget]separator.obj [.src.widget]separator.c
$ endif
$ if f$search("[.src.widget]submenu.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.widget]submenu.obj"
$ cc /include_directory=("./include","./src/widget") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.widget]submenu.obj [.src.widget]submenu.c
$ endif
$ if f$search("[.src.widget]treeview.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.widget]treeview.obj"
$ cc /include_directory=("./include","./src/widget") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.widget]treeview.obj [.src.widget]treeview.c
$ endif
$ if f$search("[.src.widget]viewport.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.widget]viewport.obj"
$ cc /include_directory=("./include","./src/widget") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.widget]viewport.obj [.src.widget]viewport.c
$ endif
$ if f$search("[.src.widget]window.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.widget]window.obj"
$ cc /include_directory=("./include","./src/widget") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.widget]window.obj [.src.widget]window.c
$ endif
$ if f$search("[.src.widget]box.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.widget]box.obj"
$ cc /include_directory=("./include","./src/widget") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.widget]box.obj [.src.widget]box.c
$ endif
$ if f$search("[.src.dialog]colorpicker.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.dialog]colorpicker.obj"
$ cc /include_directory=("./include","./src/dialog") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.dialog]colorpicker.obj [.src.dialog]colorpicker.c
$ endif
$ if f$search("[.src.dialog]directorychooser.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.dialog]directorychooser.obj"
$ cc /include_directory=("./include","./src/dialog") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.dialog]directorychooser.obj [.src.dialog]directorychooser.c
$ endif
$ if f$search("[.src.dialog]filechooser.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.dialog]filechooser.obj"
$ cc /include_directory=("./include","./src/dialog") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.dialog]filechooser.obj [.src.dialog]filechooser.c
$ endif
$ if f$search("[.src.dialog]messagebox.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.dialog]messagebox.obj"
$ cc /include_directory=("./include","./src/dialog") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.dialog]messagebox.obj [.src.dialog]messagebox.c
$ endif
$ if f$search("[.src.font]boldfont.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.font]boldfont.obj"
$ cc /include_directory=("./include","./src/font") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.font]boldfont.obj [.src.font]boldfont.c
$ endif
$ if f$search("[.src.font]boldttf.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.font]boldttf.obj"
$ cc /include_directory=("./include","./src/font") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.font]boldttf.obj [.src.font]boldttf.c
$ endif
$ if f$search("[.src.font]font.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.font]font.obj"
$ cc /include_directory=("./include","./src/font") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.font]font.obj [.src.font]font.c
$ endif
$ if f$search("[.src.font]ttf.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.font]ttf.obj"
$ cc /include_directory=("./include","./src/font") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.font]ttf.obj [.src.font]ttf.c
$ endif
$ if f$search("[.src.icon]back.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.icon]back.obj"
$ cc /include_directory=("./include","./src/icon") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.icon]back.obj [.src.icon]back.c
$ endif
$ if f$search("[.src.icon]clock.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.icon]clock.obj"
$ cc /include_directory=("./include","./src/icon") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.icon]clock.obj [.src.icon]clock.c
$ endif
$ if f$search("[.src.icon]computer.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.icon]computer.obj"
$ cc /include_directory=("./include","./src/icon") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.icon]computer.obj [.src.icon]computer.c
$ endif
$ if f$search("[.src.icon]directory.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.icon]directory.obj"
$ cc /include_directory=("./include","./src/icon") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.icon]directory.obj [.src.icon]directory.c
$ endif
$ if f$search("[.src.icon]down.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.icon]down.obj"
$ cc /include_directory=("./include","./src/icon") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.icon]down.obj [.src.icon]down.c
$ endif
$ if f$search("[.src.icon]error.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.icon]error.obj"
$ cc /include_directory=("./include","./src/icon") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.icon]error.obj [.src.icon]error.c
$ endif
$ if f$search("[.src.icon]file.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.icon]file.obj"
$ cc /include_directory=("./include","./src/icon") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.icon]file.obj [.src.icon]file.c
$ endif
$ if f$search("[.src.icon]forward.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.icon]forward.obj"
$ cc /include_directory=("./include","./src/icon") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.icon]forward.obj [.src.icon]forward.c
$ endif
$ if f$search("[.src.icon]info.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.icon]info.obj"
$ cc /include_directory=("./include","./src/icon") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.icon]info.obj [.src.icon]info.c
$ endif
$ if f$search("[.src.icon]left.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.icon]left.obj"
$ cc /include_directory=("./include","./src/icon") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.icon]left.obj [.src.icon]left.c
$ endif
$ if f$search("[.src.icon]news.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.icon]news.obj"
$ cc /include_directory=("./include","./src/icon") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.icon]news.obj [.src.icon]news.c
$ endif
$ if f$search("[.src.icon]note.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.icon]note.obj"
$ cc /include_directory=("./include","./src/icon") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.icon]note.obj [.src.icon]note.c
$ endif
$ if f$search("[.src.icon]right.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.icon]right.obj"
$ cc /include_directory=("./include","./src/icon") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.icon]right.obj [.src.icon]right.c
$ endif
$ if f$search("[.src.icon]search.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.icon]search.obj"
$ cc /include_directory=("./include","./src/icon") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.icon]search.obj [.src.icon]search.c
$ endif
$ if f$search("[.src.icon]up.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.icon]up.obj"
$ cc /include_directory=("./include","./src/icon") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.icon]up.obj [.src.icon]up.c
$ endif
$ if f$search("[.src.icon]warning.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.icon]warning.obj"
$ cc /include_directory=("./include","./src/icon") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.icon]warning.obj [.src.icon]warning.c
$ endif
$ if f$search("[.src.abstract]directory.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.abstract]directory.obj"
$ cc /include_directory=("./include","./src/abstract") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.abstract]directory.obj [.src.abstract]directory.c
$ endif
$ if f$search("[.src.abstract]dynamic.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.abstract]dynamic.obj"
$ cc /include_directory=("./include","./src/abstract") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.abstract]dynamic.obj [.src.abstract]dynamic.c
$ endif
$ if f$search("[.src.abstract]time.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.abstract]time.obj"
$ cc /include_directory=("./include","./src/abstract") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.abstract]time.obj [.src.abstract]time.c
$ endif
$ if f$search("[.external]stb_ds.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.external]stb_ds.obj"
$ cc /include_directory=("./include","./external") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.external]stb_ds.obj [.external]stb_ds.c
$ endif
$ if f$search("[.src.backend]x11.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.backend]x11.obj"
$ cc /include_directory=("./include","./src/backend") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.backend]x11.obj [.src.backend]x11.c
$ endif
$ if f$search("[.src]MwSHR.exe;*") .eqs. ""
$ then
$ write sys$output "LINK [.src]MwSHR.exe"
$ OPEN /WRITE LINK_OPT LINK.OPT
$ WRITE LINK_OPT "[.src]color.obj"
$ WRITE LINK_OPT "[.src]core.obj"
$ WRITE LINK_OPT "[.src]default.obj"
$ WRITE LINK_OPT "[.src]draw.obj"
$ WRITE LINK_OPT "[.src]error.obj"
$ WRITE LINK_OPT "[.src]lowlevel.obj"
$ WRITE LINK_OPT "[.src]string.obj"
$ WRITE LINK_OPT "[.src]text.obj"
$ WRITE LINK_OPT "[.src]unicode.obj"
$ WRITE LINK_OPT "[.src.cursor]arrow.obj"
$ WRITE LINK_OPT "[.src.cursor]cross.obj"
$ WRITE LINK_OPT "[.src.cursor]default.obj"
$ WRITE LINK_OPT "[.src.cursor]hidden.obj"
$ WRITE LINK_OPT "[.src.cursor]text.obj"
$ WRITE LINK_OPT "[.src.widget]button.obj"
$ WRITE LINK_OPT "[.src.widget]checkbox.obj"
$ WRITE LINK_OPT "[.src.widget]combobox.obj"
$ WRITE LINK_OPT "[.src.widget]entry.obj"
$ WRITE LINK_OPT "[.src.widget]frame.obj"
$ WRITE LINK_OPT "[.src.widget]image.obj"
$ WRITE LINK_OPT "[.src.widget]label.obj"
$ WRITE LINK_OPT "[.src.widget]listbox.obj"
$ WRITE LINK_OPT "[.src.widget]menu.obj"
$ WRITE LINK_OPT "[.src.widget]numberentry.obj"
$ WRITE LINK_OPT "[.src.widget]progressbar.obj"
$ WRITE LINK_OPT "[.src.widget]radiobox.obj"
$ WRITE LINK_OPT "[.src.widget]scrollbar.obj"
$ WRITE LINK_OPT "[.src.widget]separator.obj"
$ WRITE LINK_OPT "[.src.widget]submenu.obj"
$ WRITE LINK_OPT "[.src.widget]treeview.obj"
$ WRITE LINK_OPT "[.src.widget]viewport.obj"
$ WRITE LINK_OPT "[.src.widget]window.obj"
$ WRITE LINK_OPT "[.src.widget]box.obj"
$ WRITE LINK_OPT "[.src.dialog]colorpicker.obj"
$ WRITE LINK_OPT "[.src.dialog]directorychooser.obj"
$ WRITE LINK_OPT "[.src.dialog]filechooser.obj"
$ WRITE LINK_OPT "[.src.dialog]messagebox.obj"
$ WRITE LINK_OPT "[.src.font]boldfont.obj"
$ WRITE LINK_OPT "[.src.font]boldttf.obj"
$ WRITE LINK_OPT "[.src.font]font.obj"
$ WRITE LINK_OPT "[.src.font]ttf.obj"
$ WRITE LINK_OPT "[.src.icon]back.obj"
$ WRITE LINK_OPT "[.src.icon]clock.obj"
$ WRITE LINK_OPT "[.src.icon]computer.obj"
$ WRITE LINK_OPT "[.src.icon]directory.obj"
$ WRITE LINK_OPT "[.src.icon]down.obj"
$ WRITE LINK_OPT "[.src.icon]error.obj"
$ WRITE LINK_OPT "[.src.icon]file.obj"
$ WRITE LINK_OPT "[.src.icon]forward.obj"
$ WRITE LINK_OPT "[.src.icon]info.obj"
$ WRITE LINK_OPT "[.src.icon]left.obj"
$ WRITE LINK_OPT "[.src.icon]news.obj"
$ WRITE LINK_OPT "[.src.icon]note.obj"
$ WRITE LINK_OPT "[.src.icon]right.obj"
$ WRITE LINK_OPT "[.src.icon]search.obj"
$ WRITE LINK_OPT "[.src.icon]up.obj"
$ WRITE LINK_OPT "[.src.icon]warning.obj"
$ WRITE LINK_OPT "[.src.abstract]directory.obj"
$ WRITE LINK_OPT "[.src.abstract]dynamic.obj"
$ WRITE LINK_OPT "[.src.abstract]time.obj"
$ WRITE LINK_OPT "[.external]stb_ds.obj"
$ WRITE LINK_OPT "[.src.backend]x11.obj"
$ WRITE LINK_OPT "SYS$LIBRARY:DECW$XLIBSHR/SHARE/SHARE"
$ WRITE LINK_OPT "SYS$LIBRARY:DPML$SHR/SHARE/SHARE"
$ CLOSE LINK_OPT
$ link /SHAREABLE=[.src]MwSHR.exe LINK.OPT/options
$ DELETE LINK.OPT;*
$ endif

63
vms/clean.com Normal file
View File

@@ -0,0 +1,63 @@
$ if f$search("[.src]color.obj") .nes. "" then delete [.src]color.obj;*
$ if f$search("[.src]core.obj") .nes. "" then delete [.src]core.obj;*
$ if f$search("[.src]default.obj") .nes. "" then delete [.src]default.obj;*
$ if f$search("[.src]draw.obj") .nes. "" then delete [.src]draw.obj;*
$ if f$search("[.src]error.obj") .nes. "" then delete [.src]error.obj;*
$ if f$search("[.src]lowlevel.obj") .nes. "" then delete [.src]lowlevel.obj;*
$ if f$search("[.src]string.obj") .nes. "" then delete [.src]string.obj;*
$ if f$search("[.src]text.obj") .nes. "" then delete [.src]text.obj;*
$ if f$search("[.src]unicode.obj") .nes. "" then delete [.src]unicode.obj;*
$ if f$search("[.src.cursor]arrow.obj") .nes. "" then delete [.src.cursor]arrow.obj;*
$ if f$search("[.src.cursor]cross.obj") .nes. "" then delete [.src.cursor]cross.obj;*
$ if f$search("[.src.cursor]default.obj") .nes. "" then delete [.src.cursor]default.obj;*
$ if f$search("[.src.cursor]hidden.obj") .nes. "" then delete [.src.cursor]hidden.obj;*
$ if f$search("[.src.cursor]text.obj") .nes. "" then delete [.src.cursor]text.obj;*
$ if f$search("[.src.widget]button.obj") .nes. "" then delete [.src.widget]button.obj;*
$ if f$search("[.src.widget]checkbox.obj") .nes. "" then delete [.src.widget]checkbox.obj;*
$ if f$search("[.src.widget]combobox.obj") .nes. "" then delete [.src.widget]combobox.obj;*
$ if f$search("[.src.widget]entry.obj") .nes. "" then delete [.src.widget]entry.obj;*
$ if f$search("[.src.widget]frame.obj") .nes. "" then delete [.src.widget]frame.obj;*
$ if f$search("[.src.widget]image.obj") .nes. "" then delete [.src.widget]image.obj;*
$ if f$search("[.src.widget]label.obj") .nes. "" then delete [.src.widget]label.obj;*
$ if f$search("[.src.widget]listbox.obj") .nes. "" then delete [.src.widget]listbox.obj;*
$ if f$search("[.src.widget]menu.obj") .nes. "" then delete [.src.widget]menu.obj;*
$ if f$search("[.src.widget]numberentry.obj") .nes. "" then delete [.src.widget]numberentry.obj;*
$ if f$search("[.src.widget]progressbar.obj") .nes. "" then delete [.src.widget]progressbar.obj;*
$ if f$search("[.src.widget]radiobox.obj") .nes. "" then delete [.src.widget]radiobox.obj;*
$ if f$search("[.src.widget]scrollbar.obj") .nes. "" then delete [.src.widget]scrollbar.obj;*
$ if f$search("[.src.widget]separator.obj") .nes. "" then delete [.src.widget]separator.obj;*
$ if f$search("[.src.widget]submenu.obj") .nes. "" then delete [.src.widget]submenu.obj;*
$ if f$search("[.src.widget]treeview.obj") .nes. "" then delete [.src.widget]treeview.obj;*
$ if f$search("[.src.widget]viewport.obj") .nes. "" then delete [.src.widget]viewport.obj;*
$ if f$search("[.src.widget]window.obj") .nes. "" then delete [.src.widget]window.obj;*
$ if f$search("[.src.widget]box.obj") .nes. "" then delete [.src.widget]box.obj;*
$ if f$search("[.src.dialog]colorpicker.obj") .nes. "" then delete [.src.dialog]colorpicker.obj;*
$ if f$search("[.src.dialog]directorychooser.obj") .nes. "" then delete [.src.dialog]directorychooser.obj;*
$ if f$search("[.src.dialog]filechooser.obj") .nes. "" then delete [.src.dialog]filechooser.obj;*
$ if f$search("[.src.dialog]messagebox.obj") .nes. "" then delete [.src.dialog]messagebox.obj;*
$ if f$search("[.src.font]boldfont.obj") .nes. "" then delete [.src.font]boldfont.obj;*
$ if f$search("[.src.font]boldttf.obj") .nes. "" then delete [.src.font]boldttf.obj;*
$ if f$search("[.src.font]font.obj") .nes. "" then delete [.src.font]font.obj;*
$ if f$search("[.src.font]ttf.obj") .nes. "" then delete [.src.font]ttf.obj;*
$ if f$search("[.src.icon]back.obj") .nes. "" then delete [.src.icon]back.obj;*
$ if f$search("[.src.icon]clock.obj") .nes. "" then delete [.src.icon]clock.obj;*
$ if f$search("[.src.icon]computer.obj") .nes. "" then delete [.src.icon]computer.obj;*
$ if f$search("[.src.icon]directory.obj") .nes. "" then delete [.src.icon]directory.obj;*
$ if f$search("[.src.icon]down.obj") .nes. "" then delete [.src.icon]down.obj;*
$ if f$search("[.src.icon]error.obj") .nes. "" then delete [.src.icon]error.obj;*
$ if f$search("[.src.icon]file.obj") .nes. "" then delete [.src.icon]file.obj;*
$ if f$search("[.src.icon]forward.obj") .nes. "" then delete [.src.icon]forward.obj;*
$ if f$search("[.src.icon]info.obj") .nes. "" then delete [.src.icon]info.obj;*
$ if f$search("[.src.icon]left.obj") .nes. "" then delete [.src.icon]left.obj;*
$ if f$search("[.src.icon]news.obj") .nes. "" then delete [.src.icon]news.obj;*
$ if f$search("[.src.icon]note.obj") .nes. "" then delete [.src.icon]note.obj;*
$ if f$search("[.src.icon]right.obj") .nes. "" then delete [.src.icon]right.obj;*
$ if f$search("[.src.icon]search.obj") .nes. "" then delete [.src.icon]search.obj;*
$ if f$search("[.src.icon]up.obj") .nes. "" then delete [.src.icon]up.obj;*
$ if f$search("[.src.icon]warning.obj") .nes. "" then delete [.src.icon]warning.obj;*
$ if f$search("[.src.abstract]directory.obj") .nes. "" then delete [.src.abstract]directory.obj;*
$ if f$search("[.src.abstract]dynamic.obj") .nes. "" then delete [.src.abstract]dynamic.obj;*
$ if f$search("[.src.abstract]time.obj") .nes. "" then delete [.src.abstract]time.obj;*
$ if f$search("[.external]stb_ds.obj") .nes. "" then delete [.external]stb_ds.obj;*
$ if f$search("[.src.backend]x11.obj") .nes. "" then delete [.src.backend]x11.obj;*
$ if f$search("[.src]MwSHR.exe") .nes. "" then delete [.src]MwSHR.exe;*