98 UiContext *var_ctx = ctx; |
98 UiContext *var_ctx = ctx; |
99 while(var_ctx) { |
99 while(var_ctx) { |
100 if(var_ctx->vars_unbound && cxMapSize(var_ctx->vars_unbound) > 0) { |
100 if(var_ctx->vars_unbound && cxMapSize(var_ctx->vars_unbound) > 0) { |
101 CxIterator i = cxMapIterator(var_ctx->vars_unbound); |
101 CxIterator i = cxMapIterator(var_ctx->vars_unbound); |
102 cx_foreach(CxMapEntry*, entry, i) { |
102 cx_foreach(CxMapEntry*, entry, i) { |
|
103 printf("attach %s\n", entry->key->data); |
103 UiVar *var = entry->value; |
104 UiVar *var = entry->value; |
104 UiVar *docvar = cxMapGet(doc_ctx->vars, *entry->key); |
105 UiVar *docvar = cxMapGet(doc_ctx->vars, *entry->key); |
105 if(docvar) { |
106 if(docvar) { |
106 // bind var to document var |
107 // bind var to document var |
107 uic_copy_binding(var, docvar, TRUE); |
108 uic_copy_binding(var, docvar, TRUE); |
161 i = cxListIterator(ls); |
162 i = cxListIterator(ls); |
162 cx_foreach(void *, doc, i) { |
163 cx_foreach(void *, doc, i) { |
163 ctx->detach_document2(ctx, doc); |
164 ctx->detach_document2(ctx, doc); |
164 } |
165 } |
165 |
166 |
166 cxListDestroy(ls); |
167 cxListFree(ls); |
167 } |
168 } |
168 |
169 |
169 static UiVar* ctx_getvar(UiContext *ctx, CxHashKey key) { |
170 static UiVar* ctx_getvar(UiContext *ctx, CxHashKey key) { |
170 UiVar *var = cxMapGet(ctx->vars, key); |
171 UiVar *var = cxMapGet(ctx->vars, key); |
171 if(!var && ctx->documents) { |
172 if(!var && ctx->documents) { |
463 ctx->close_callback = fnc; |
464 ctx->close_callback = fnc; |
464 ctx->close_data = udata; |
465 ctx->close_data = udata; |
465 } |
466 } |
466 |
467 |
467 UIEXPORT void ui_context_destroy(UiContext *ctx) { |
468 UIEXPORT void ui_context_destroy(UiContext *ctx) { |
468 cxMempoolDestroy(ctx->mp); |
469 cxMempoolFree(ctx->mp); |
469 } |
470 } |
470 |
471 |
471 |
472 |
472 void ui_set_group(UiContext *ctx, int group) { |
473 void ui_set_group(UiContext *ctx, int group) { |
473 if(cxListFind(ctx->groups, &group) == -1) { |
474 if(cxListFind(ctx->groups, &group) == -1) { |