ui/common/document.c

changeset 140
c03c338a7dcf
parent 52
25e5390cce41
child 163
b70e2a77dea0
--- a/ui/common/document.c	Tue Jan 24 18:46:47 2017 +0100
+++ b/ui/common/document.c	Fri Nov 10 17:17:14 2017 +0100
@@ -1,7 +1,7 @@
 /*
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
  *
- * Copyright 2014 Olaf Wintermann. All rights reserved.
+ * Copyright 2017 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:
@@ -42,8 +42,8 @@
     obj->ctx->set_document(obj->ctx, document);
 }
 
-void ui_detach_document(UiObject *obj, void *document) {
-    obj->ctx->detach_document(obj->ctx, document);
+void ui_detach_document(UiObject *obj) {
+    obj->ctx->detach_document(obj->ctx);
 }
 
 void* ui_get_document(UiObject *obj) {
@@ -63,7 +63,7 @@
     if(!ctx) {
         fprintf(stderr, "UI Error: pointer is not a document\n");
     }
-    uic_context_detach_document(ctx, sub);
+    uic_context_detach_document(ctx);
 }
 
 void* ui_get_subdocument(void *document) {
@@ -98,68 +98,3 @@
         return NULL;
     }
 }
-
-void* ui_document_malloc(void *doc, size_t size) {
-    UiContext *uidoc = ui_document_context(doc);
-    return ucx_mempool_malloc(uidoc->mempool, size);
-}
-
-void* ui_document_calloc(void *doc, size_t nelem, size_t elsize) {
-    UiContext *uidoc = ucx_map_get(documents, ucx_key(&doc, sizeof(void*)));
-    return ucx_mempool_calloc(uidoc->mempool, nelem, elsize);
-}
-
-void  ui_document_free(void *doc, void *ptr) {
-    UiContext *uidoc = ucx_map_get(documents, ucx_key(&doc, sizeof(void*)));
-    ucx_mempool_free(uidoc->mempool, ptr);
-}
-
-void* ui_document_realloc(void *doc, void *ptr, size_t size) {
-    UiContext *uidoc = ucx_map_get(documents, ucx_key(&doc, sizeof(void*)));
-    return ucx_mempool_realloc(uidoc->mempool, ptr, size);
-}
-
-void uic_document_addvar(void *doc, char *name, int type, size_t vs) {
-    // TODO: remove
-    UiContext *ctx = ui_document_context(doc);
-    if(ctx) {
-        UiVar *newvar = ucx_mempool_malloc(ctx->mempool, sizeof(UiVar));
-        newvar->isextern = 0;
-        newvar->type = type;
-        newvar->value = ucx_mempool_calloc(ctx->mempool, 1, vs);
-        newvar->from = NULL;
-
-        uic_add_var(ctx, name, newvar, type, vs);
-    }
-}
-
-void ui_document_addint(void *doc, char *name) {
-    uic_document_addvar(doc, name, UI_VAR_INTEGER, sizeof(UiInteger));
-}
-
-
-
-void ui_document_regint(void *doc, char *name, UiInteger *i) {
-    UiContext *ctx = ui_document_context(doc);
-    if(ctx) {
-        uic_reg_var(ctx, name, UI_VAR_INTEGER, sizeof(UiInteger), i);
-    }
-}
-
-void ui_document_regtext(void *doc, char *name, UiText *text) {
-    UiContext *ctx = ui_document_context(doc);
-    if(ctx) {
-        uic_reg_var(ctx, name, UI_VAR_TEXT, sizeof(UiText), text);
-    }
-}
-
-void ui_document_reglist(void *doc, char *name, UiList *list) {
-    UiContext *ctx = ui_document_context(doc);
-    if(ctx) {
-        UiListVar *lv = ui_document_malloc(doc, sizeof(UiListVar));
-        UiListPtr *lp = ui_document_malloc(doc, sizeof(UiListPtr));
-        lv->listptr = lp;
-        lp->list = list;
-        uic_reg_var(ctx, name, UI_VAR_LIST, sizeof(UiListPtr), lv);
-    }
-}

mercurial