diff --git a/TODO.md b/TODO.md index 3e201f7e..629972ed 100644 --- a/TODO.md +++ b/TODO.md @@ -28,9 +28,9 @@ notes to self - explicitly document label position at top-left corner - mark that uiControlShow() on a uiWindow() will bring to front and give keyboard focus because of OS X - make sure ShowWindow() is sufficient for zorder on Windows -- document that you CAN use InsertBefore functions to insert at the first invalid index, even if the array is empty +- document that you CAN use InsertAt functions to insert at the first invalid index, even if the array is empty - add tests for this -- note that uiTabInsertPageBefore() does NOT change the current tab page (it may change its index if inserting before the current page) +- note that uiTabInsertAt() does NOT change the current tab page (it may change its index if inserting before the current page) - note that the default action for uiWindowOnClosing() is to return 0 (keep the window open) - note that uiInitOptions should be initialized to zero - explicitly document that uiCheckboxSetChecked() and uiEntrySetText() do not fire uiCheckboxOnToggled() and uiEntryOnChanged(), respectively diff --git a/redo/ptrarray.c b/redo/ptrarray.c index b8abc8dd..06acdec9 100644 --- a/redo/ptrarray.c +++ b/redo/ptrarray.c @@ -21,13 +21,13 @@ void ptrArrayDestroy(struct ptrArray *p) void ptrArrayAppend(struct ptrArray *p, void *d) { - ptrArrayInsertBefore(p, p->len, d); + ptrArrayInsertAt(p, p->len, d); } -void ptrArrayInsertBefore(struct ptrArray *p, uintmax_t i, void *d) +void ptrArrayInsertAt(struct ptrArray *p, uintmax_t i, void *d) { if (i > p->len) - complain("index out of range in ptrArrayInsertBefore()"); + complain("index out of range in ptrArrayInsertAt()"); if (p->len >= p->cap) { p->cap += grow; p->ptrs = (void **) uiRealloc(p->ptrs, p->cap * sizeof (void *), "void *[]"); diff --git a/redo/test/page2.c b/redo/test/page2.c index e64dfde6..23b77cac 100644 --- a/redo/test/page2.c +++ b/redo/test/page2.c @@ -26,7 +26,7 @@ static void movePage1(uiButton *b, void *data) { if (moveBack) { uiBoxDelete(mainBox, 1); - uiTabInsertBefore(mainTab, "Page 1", 0, uiControl(page1)); + uiTabInsertAt(mainTab, "Page 1", 0, uiControl(page1)); uiButtonSetText(b, moveOutText); moveBack = 0; return; diff --git a/redo/ui.idl b/redo/ui.idl index e589c35c..16075415 100644 --- a/redo/ui.idl +++ b/redo/ui.idl @@ -124,7 +124,7 @@ func NewLabel(text *const char) *Label; interface Tab from Control { func Append(name *const char, c *Control); - func InsertBefore(name *const char, before uintmax_t, c *Control); + func InsertAt(name *const char, before uintmax_t, c *Control); func Delete(index uintmax_t); func NumPages(void) uintmax_t; func Margined(page uintmax_t) int; diff --git a/redo/uipriv.h b/redo/uipriv.h index 93cbb086..66462db4 100644 --- a/redo/uipriv.h +++ b/redo/uipriv.h @@ -19,7 +19,7 @@ struct ptrArray { struct ptrArray *newPtrArray(void); void ptrArrayDestroy(struct ptrArray *); void ptrArrayAppend(struct ptrArray *, void *); -void ptrArrayInsertBefore(struct ptrArray *, uintmax_t, void *); +void ptrArrayInsertAt(struct ptrArray *, uintmax_t, void *); void ptrArrayDelete(struct ptrArray *, uintmax_t); #define ptrArrayIndex(p, T, i) ((T) ((p)->ptrs[(i)])) diff --git a/redo/windows/OLDtab.c b/redo/windows/OLDtab.c index 15dc6424..9768fd4a 100644 --- a/redo/windows/OLDtab.c +++ b/redo/windows/OLDtab.c @@ -252,7 +252,7 @@ static void tabAppend(uiTab *tt, const char *name, uiControl *child) uiControlQueueResize(page->control); } -static void tabInsertBefore(uiTab *tt, const char *name, uintmax_t n, uiControl *child) +static void tabInsertAt(uiTab *tt, const char *name, uintmax_t n, uiControl *child) { struct tab *t = (struct tab *) tt; TCITEMW item; @@ -266,14 +266,14 @@ static void tabInsertBefore(uiTab *tt, const char *name, uintmax_t n, uiControl // always hide; the current tab doesn't change uiControlHide(page->control); - ptrArrayInsertBefore(t->pages, n, page); + ptrArrayInsertAt(t->pages, n, page); ZeroMemory(&item, sizeof (TCITEMW)); item.mask = TCIF_TEXT; wname = toUTF16(name); item.pszText = wname; if (SendMessageW(t->hwnd, TCM_INSERTITEM, (WPARAM) n, (LPARAM) (&item)) == (LRESULT) -1) - logLastError("error adding tab to Tab in uiTabInsertBefore()"); + logLastError("error adding tab to Tab in uiTabInsertAt()"); uiFree(wname); } @@ -363,7 +363,7 @@ uiTab *uiNewTab(void) uiControl(t)->SysFunc = tabSysFunc; uiTab(t)->Append = tabAppend; - uiTab(t)->InsertBefore = tabInsertBefore; + uiTab(t)->InsertAt = tabInsertAt; uiTab(t)->Delete = tabDelete; uiTab(t)->NumPages = tabNumPages; uiTab(t)->Margined = tabMargined; diff --git a/redo/windows/tab.c b/redo/windows/tab.c index 1523cc69..b47e2d2a 100644 --- a/redo/windows/tab.c +++ b/redo/windows/tab.c @@ -30,7 +30,7 @@ static void tabAppend(uiTab *tt, const char *name, uiControl *child) { } -static void tabInsertBefore(uiTab *tt, const char *name, uintmax_t n, uiControl *child) +static void tabInsertAt(uiTab *tt, const char *name, uintmax_t n, uiControl *child) { } @@ -78,7 +78,7 @@ uiTab *uiNewTab(void) uiControl(t)->PreferredSize = tabPreferredSize; uiTab(t)->Append = tabAppend; - uiTab(t)->InsertBefore = tabInsertBefore; + uiTab(t)->InsertAt = tabInsertAt; uiTab(t)->Delete = tabDelete; uiTab(t)->NumPages = tabNumPages; uiTab(t)->Margined = tabMargined;