From: Olaf Wintermann Date: Thu, 26 Mar 2026 17:30:31 +0000 (+0100) Subject: prepare build system for macos X-Git-Url: https://uap-core.de/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2Fmain;p=note.git prepare build system for macos --- diff --git a/application/Makefile b/application/Makefile index 1beec5e..a09877c 100644 --- a/application/Makefile +++ b/application/Makefile @@ -45,6 +45,7 @@ SRC += nbconfig.c SRC += $(APP_PLATFORM_SRC) OBJ = $(SRC:%.c=../build/application/%$(OBJ_EXT)) +OBJ += $(APP_PLATFORM_OBJC_SRC:%.m=../build/application/%$(OBJ_EXT)) MAIN_OBJ = ../build/application/main$(OBJ_EXT) TEST_SRC = tests/testmain.c @@ -65,6 +66,9 @@ $(APP_BIN): $(MAIN_OBJ) $(OBJ) $(BUILD_ROOT)/build/lib/libuitk.a $(TEST_BIN): $(OBJ) $(TEST_OBJ) $(BUILD_ROOT)/build/lib/libuitk.a $(CC) -o $(TEST_BIN) $(TEST_OBJ) $(OBJ) -L$(BUILD_ROOT)/build/lib $(BUILD_ROOT)/build/$(BUILD_LIB_DIR)/$(LIB_PREFIX)uitk$(LIB_EXT) $(BUILD_ROOT)/build/$(BUILD_LIB_DIR)/$(LIB_PREFIX)ucx$(LIB_EXT) -lidav -ldbutils -lmd4c -lnoteutils $(LDFLAGS) $(TK_LDFLAGS) $(DAV_LDFLAGS) $(DBU_LDFLAGS) +../build/application/%$(OBJ_EXT): %.m + $(CC) $(CFLAGS) $(TK_CFLAGS) $(DAV_CFLAGS) -o $@ -c $< + ../build/application/%$(OBJ_EXT): %.c $(CC) $(CFLAGS) $(TK_CFLAGS) $(DAV_CFLAGS) -o $@ -c $< diff --git a/application/attachment.c b/application/attachment.c index fc2ce68..604f650 100644 --- a/application/attachment.c +++ b/application/attachment.c @@ -31,6 +31,8 @@ #include "note.h" #include "store.h" +#include +#include #include #include #include diff --git a/application/cocoa-image.h b/application/cocoa-image.h new file mode 100644 index 0000000..e69de29 diff --git a/application/cocoa-image.m b/application/cocoa-image.m new file mode 100644 index 0000000..e69de29 diff --git a/application/cocoa-text.h b/application/cocoa-text.h new file mode 100644 index 0000000..e69de29 diff --git a/application/cocoa-text.m b/application/cocoa-text.m new file mode 100644 index 0000000..b47a2ac --- /dev/null +++ b/application/cocoa-text.m @@ -0,0 +1,75 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright 2025 Olaf Wintermann. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include "cocoa-text.h" +#include "cocoa-image.h" +#include "editor.h" +#include "note.h" +#include "attachment.h" + +#include +#include +#include +#include +#include + +#include + +#include +#include + + + +void editor_global_init() { + +} +void editor_init_textview(UiObject *obj, UIWIDGET textview) { + +} +void editor_init_textbuf(UiText *text) { + +} +void editor_apply_styles(Note *note, UIWIDGET textview, UiText *text, CxList /* MDDocStyleSection */ *styles) { + +} +cxmutstr editor_get_markdown(UiText *text, const CxAllocator *a) { + return CX_NULLSTR; +} +void editor_insert_image_file(UiText *text, const char *filepath) { + +} + +UiBool editor_set_style(UiText *text, const char *style, UiBool enabled) { + return 0; +} +void editor_set_paragraph_style(UiText *text, const char *style) { + +} +void editor_insert_list(UiText *text, UiBool ordered) { + +} \ No newline at end of file diff --git a/application/note.c b/application/note.c index 19fdabd..5c090e5 100644 --- a/application/note.c +++ b/application/note.c @@ -35,6 +35,8 @@ #include "../utils/strreplace.h" +#include +#include #include static TextNoteParagraphStyles paragraph_styles[] = { diff --git a/application/notebook.c b/application/notebook.c index 7946556..3f182db 100644 --- a/application/notebook.c +++ b/application/notebook.c @@ -32,6 +32,9 @@ #include "note.h" #include "editor.h" +#include +#include + #include NotebookModel* notebookmodel_create() { diff --git a/application/window.c b/application/window.c index 4059c6e..0f3e2b5 100644 --- a/application/window.c +++ b/application/window.c @@ -36,6 +36,9 @@ #include "attachment.h" #include "nbconfig.h" +#include +#include + #include #include diff --git a/configure b/configure index bab46c4..edfe3ac 100755 --- a/configure +++ b/configure @@ -1051,7 +1051,8 @@ checkopt_toolkit_cocoa() fi cat >> "$TEMP_DIR/make.mk" << __EOF__ TOOLKIT = cocoa -APP_PLATFORM_SRC = cocoa-text.m +APP_PLATFORM_OBJC_SRC = cocoa-text.m +APP_PLATFORM_OBJC_SRC += cocoa-image.m __EOF__ return 0 } diff --git a/dbutils/dbutils/dbutils.h b/dbutils/dbutils/dbutils.h index 12eb671..161540e 100644 --- a/dbutils/dbutils/dbutils.h +++ b/dbutils/dbutils/dbutils.h @@ -97,7 +97,7 @@ struct DBUClass { * value: DBUField* */ CxMap *fields; - + /* * object fields * @@ -384,33 +384,47 @@ void dbuClassAddField(DBUClass *cls, const char *name, DBUField *field); void dbuClassAddFKField(DBUClass *cls, const char *name, DBUField *field, DBUClass *fkcls); void dbuClassAddObjField(DBUClass *cls, const char *name, DBUField *field, DBUClass *foreign_cls); +#if !defined(__SIZEOF_LONG__) || __SIZEOF_LONG__ == 8 +#define dbuClassAddLong dbuClassAddInt64 +#define dbuClassAddULong dbuClassAddUInt64 +#define dbuClassAddLongFK dbuClassAddInt64FK +#define dbuClassAddULongFK dbuClassAddUInt64FK +#elif __SIZEOF_LONG__ == 4 +#define dbuClassAddLong dbuClassAddInt32 +#define dbuClassAddULong dbuClassAddUInt32 +#endif + #define dbuClassAdd(cls, type, member) \ dbuClassAddWithName(cls, type, member, #member) #define dbuClassAddWithName(cls, type, member, member_name) \ _Generic(((type*)0)->member, \ - int8_t: dbuClassAddInt8, \ - uint8_t: dbuClassAddUInt8, \ - int16_t: dbuClassAddInt16, \ - uint16_t: dbuClassAddUInt16, \ - int32_t: dbuClassAddInt32, \ - uint32_t: dbuClassAddUInt32, \ - int64_t: dbuClassAddInt64, \ - uint64_t: dbuClassAddUInt64, \ - bool: dbuClassAddBool, \ - float: dbuClassAddFloat, \ - double: dbuClassAddDouble, \ - char*: dbuClassAddString, \ - cxmutstr: dbuClassAddCXMutStr) \ + int8_t: dbuClassAddInt8, \ + uint8_t: dbuClassAddUInt8, \ + int16_t: dbuClassAddInt16, \ + uint16_t: dbuClassAddUInt16, \ + int32_t: dbuClassAddInt32, \ + uint32_t: dbuClassAddUInt32, \ + long: dbuClassAddLong, \ + unsigned long: dbuClassAddULong, \ + long long: dbuClassAddInt64, \ + unsigned long long: dbuClassAddUInt64, \ + bool: dbuClassAddBool, \ + float: dbuClassAddFloat, \ + double: dbuClassAddDouble, \ + char*: dbuClassAddString, \ + cxmutstr: dbuClassAddCXMutStr) \ (cls, member_name, offsetof(type, member), 0) #define dbuClassAddForeignKey(cls, type, member, foreigncls) \ _Generic(((type*)0)->member, \ - int32_t: dbuClassAddInt32FK, \ - uint32_t: dbuClassAddUInt32FK, \ - int64_t: dbuClassAddInt64FK, \ - uint64_t: dbuClassAddUInt64FK, \ - char*: dbuClassAddStringFK, \ - cxmutstr: dbuClassAddCXMutStrFK) \ + int32_t: dbuClassAddInt32FK, \ + uint32_t: dbuClassAddUInt32FK, \ + long: dbuClassAddLongFK, \ + unsigned long: dbuClassAddULongFK, \ + long long: dbuClassAddInt64FK, \ + unsigned long long: dbuClassAddUInt64FK, \ + char*: dbuClassAddStringFK, \ + cxmutstr: dbuClassAddCXMutStrFK) \ (cls, #member, offsetof(type, member), foreigncls, 0) void dbuClassAddInt(DBUClass *cls, const char *name, off_t offset, bool nonnull); @@ -423,8 +437,6 @@ void dbuClassAddInt32(DBUClass *cls, const char *name, off_t offset, bool nonnul void dbuClassAddUInt32(DBUClass *cls, const char *name, off_t offset, bool nonnull); void dbuClassAddInt64(DBUClass *cls, const char *name, off_t offset, bool nonnull); void dbuClassAddUInt64(DBUClass *cls, const char *name, off_t offset, bool nonnull); -void dbuClassAddSize(DBUClass *cls, const char *name, off_t offset, bool nonnull); -void dbuClassAddSSize(DBUClass *cls, const char *name, off_t offset, bool nonnull); void dbuClassAddBool(DBUClass *cls, const char *name, off_t offset, bool nonnull); void dbuClassAddFloat(DBUClass *cls, const char *name, off_t offset, bool nonnull); void dbuClassAddDouble(DBUClass *cls, const char *name, off_t offset, bool nonnull); diff --git a/dbutils/json.c b/dbutils/json.c index 55339b3..296f321 100644 --- a/dbutils/json.c +++ b/dbutils/json.c @@ -85,7 +85,7 @@ CxJsonValue* dbuObjectToJson2(DBUClass *type, void *obj, const CxAllocator *a, b } else if(field->toObject) { DBUObject child_obj = field->toObject(field, obj); if(child_obj == NULL) { - child = CX_JSON_NULL; + child = cxJsonCreateLiteral(a, CX_JSON_NULL); } else if(field->objType) { child = dbuObjectToJson2(field->objType, child_obj, a, setNull, forceString); } diff --git a/dbutils/object.c b/dbutils/object.c index 6c3a7ad..e5936ac 100644 --- a/dbutils/object.c +++ b/dbutils/object.c @@ -153,7 +153,7 @@ CxList* dbuObjectBuilderGetValueList(DBUObjectBuilder *builder) { } int dbuObjectBuilderGetArray(DBUObjectBuilder *builder, void **array, size_t *size) { - + return 1; } void dbuObjectBuilderDestroy(DBUObjectBuilder *builder) { diff --git a/make/project.xml b/make/project.xml index 9ba21b6..2e34e93 100644 --- a/make/project.xml +++ b/make/project.xml @@ -183,7 +183,8 @@ cocoa TOOLKIT = cocoa - APP_PLATFORM_SRC = cocoa-text.m + APP_PLATFORM_OBJC_SRC = cocoa-text.m + APP_PLATFORM_OBJC_SRC += cocoa-image.m qt5 diff --git a/ui/ui/icons.h b/ui/ui/icons.h index 9bc86a4..6589cc9 100644 --- a/ui/ui/icons.h +++ b/ui/ui/icons.h @@ -74,6 +74,25 @@ extern "C" { #define UI_ICON_GO_DOWN "" // TODO: implement workaround for missing down symbol #endif /* UI_WINUI */ + +#ifdef UI_COCOA + +#define UI_ICON_HOME "NSImageNameHomeTemplate" +#define UI_ICON_NEW_WINDOW "" +#define UI_ICON_REFRESH "NSImageNameRefreshTemplate" +#define UI_ICON_NEW_FOLDER "" +#define UI_ICON_ADD "NSImageNameAddTemplate" +#define UI_ICON_UPLOAD "" +#define UI_ICON_SAVE_LOCAL "" +#define UI_ICON_DELETE "" +#define UI_ICON_DOCK_LEFT "" +#define UI_ICON_DOCK_RIGHT "" +#define UI_ICON_GO_BACK "NSImageNameGoLeftTemplate" +#define UI_ICON_GO_FORWARD "NSImageNameGoRightTemplate" +#define UI_ICON_GO_UP "" +#define UI_ICON_GO_DOWN "" + +#endif /* UI_COCOA */ UIEXPORT UiIcon* ui_icon(const char* name, size_t size);