Home | History | Annotate | Download | only in dist

Lines Matching refs:mti

150 	struct mode_tree_item	*mti, *child;
152 TAILQ_FOREACH(mti, mtl, entry) {
153 if (mti->tag == tag)
154 return (mti);
155 child = mode_tree_find_item(&mti->children, tag);
163 mode_tree_free_item(struct mode_tree_item *mti)
165 mode_tree_free_items(&mti->children);
167 free(__UNCONST(mti->name));
168 free(__UNCONST(mti->text));
169 free(__UNCONST(mti->keystr));
171 free(mti);
177 struct mode_tree_item *mti, *mti1;
179 TAILQ_FOREACH_SAFE(mti, mtl, entry, mti1) {
180 TAILQ_REMOVE(mtl, mti, entry);
181 mode_tree_free_item(mti);
208 struct mode_tree_item *mti;
216 TAILQ_FOREACH(mti, mtl, entry) {
221 line->item = mti;
223 line->last = (mti == TAILQ_LAST(mtl, mode_tree_list));
225 mti->line = (mtd->line_size - 1);
226 if (!TAILQ_EMPTY(&mti->children))
228 if (mti->expanded)
229 mode_tree_build_lines(mtd, &mti->children, depth + 1);
232 mti->key = mtd->keycb(mtd->modedata, mti->itemdata,
233 mti->line);
234 if (mti->key == KEYC_UNKNOWN)
235 mti->key = KEYC_NONE;
236 } else if (mti->line < 10)
237 mti->key = '0' + mti->line;
238 else if (mti->line < 36)
239 mti->key = KEYC_META|('a' + mti->line - 10);
241 mti->key = KEYC_NONE;
242 if (mti->key != KEYC_NONE) {
243 mti->keystr = xstrdup(key_string_lookup_key(mti->key,
245 mti->keylen = strlen(mti->keystr);
247 mti->keystr = NULL;
248 mti->keylen = 0;
251 TAILQ_FOREACH(mti, mtl, entry) {
254 if (line->item == mti)
263 struct mode_tree_item *mti;
265 TAILQ_FOREACH(mti, mtl, entry) {
266 mti->tagged = 0;
267 mode_tree_clear_tagged(&mti->children);
418 struct mode_tree_item *mti;
423 mti = mtd->line_list[i].item;
424 if (mti->tagged)
434 struct mode_tree_item *mti;
440 mti = mtd->line_list[i].item;
441 if (mti->tagged) {
443 cb(mtd->modedata, mti->itemdata, c, key);
447 mti = mtd->line_list[mtd->current].item;
448 cb(mtd->modedata, mti->itemdata, c, key);
637 struct mode_tree_item *mti, *saved;
642 mti = xcalloc(1, sizeof *mti);
643 mti->parent = parent;
644 mti->itemdata = itemdata;
646 mti->tag = tag;
647 mti->name = xstrdup(name);
649 mti->text = xstrdup(text);
654 mti->tagged = saved->tagged;
655 mti->expanded = saved->expanded;
657 mti->expanded = 1;
659 mti->expanded = expanded;
661 TAILQ_INIT(&mti->children);
664 TAILQ_INSERT_TAIL(&parent->children, mti, entry);
666 TAILQ_INSERT_TAIL(&mtd->children, mti, entry);
668 return (mti);
672 mode_tree_draw_as_parent(struct mode_tree_item *mti)
674 mti->draw_as_parent = 1;
678 mode_tree_no_tag(struct mode_tree_item *mti)
680 mti->no_tag = 1;
684 * Set the alignment of mti->name: -1 to align left, 0 (default) to not align,
688 mode_tree_align(struct mode_tree_item *mti, int align)
690 mti->align = align;
694 mode_tree_remove(struct mode_tree_data *mtd, struct mode_tree_item *mti)
696 struct mode_tree_item *parent = mti->parent;
699 TAILQ_REMOVE(&parent->children, mti, entry);
701 TAILQ_REMOVE(&mtd->children, mti, entry);
702 mode_tree_free_item(mti);
711 struct mode_tree_item *mti;
736 mti = mtd->line_list[i].item;
737 if (mti->key == KEYC_NONE)
739 if ((int)mti->keylen + 3 > keylen)
740 mti->keylen + 3;
747 mti = line->item;
748 if (mti->align &&
749 (int)strlen(mti->name) > alignlen[line->depth])
750 alignlen[line->depth] = strlen(mti->name);
759 mti = line->item;
763 pad = keylen - 2 - mti->keylen;
764 if (mti->key != KEYC_NONE)
765 xasprintf(&key, "(%s)%*s", mti->keystr, pad, "");
771 else if (TAILQ_EMPTY(&mti->children))
773 else if (mti->expanded)
785 if (mti->parent != NULL &&
786 mtd->line_list[mti->parent->line].last)
798 if (mti->tagged)
803 mti->align * alignlen[line->depth], mti->name, tag,
804 (mti->text != NULL) ? ": " : "" );
810 if (mti->tagged) {
818 if (mti->text != NULL) {
819 format_draw(&ctx, &gc0, w - width, mti->text,
825 if (mti->text != NULL) {
826 format_draw(&ctx, &gc, w - width, mti->text,
833 if (mti->tagged) {
847 mti = line->item;
848 if (mti->draw_as_parent)
849 mti = mti->parent;
855 xasprintf(&text, " %s (sort: %s%s)", mti->name,
859 xasprintf(&text, " %s", mti->name);
885 mtd->drawcb(mtd->modedata, mti->itemdata, &ctx, box_x, box_y);
896 struct mode_tree_item *mti, *last, *prev;
902 mti = last = mtd->line_list[mtd->current].item;
904 if ((prev = TAILQ_PREV(mti, mode_tree_list, entry)) != NULL) {
910 mti = prev;
913 mti = mti->parent;
916 if (mti == NULL) {
923 mti = prev;
925 if (mti == last)
929 if (!icase && strstr(mti->name, mtd->search) != NULL)
930 return (mti);
931 if (icase && strcasestr(mti->name, mtd->search) != NULL)
932 return (mti);
935 if (mtd->searchcb(mtd->modedata, mti->itemdata, mtd->search,
937 return (mti);
945 struct mode_tree_item *mti, *last, *next;
951 mti = last = mtd->line_list[mtd->current].item;
953 if (!TAILQ_EMPTY(&mti->children))
954 mti = TAILQ_FIRST(&mti->children);
955 else if ((next = TAILQ_NEXT(mti, entry)) != NULL)
956 mti = next;
959 mti = mti->parent;
960 if (mti == NULL)
962 if ((next = TAILQ_NEXT(mti, entry)) != NULL) {
963 mti = next;
968 if (mti == NULL)
969 mti = TAILQ_FIRST(&mtd->children);
970 if (mti == last)
974 if (!icase && strstr(mti->name, mtd->search) != NULL)
975 return (mti);
976 if (icase && strcasestr(mti->name, mtd->search) != NULL)
977 return (mti);
980 if (mtd->searchcb(mtd->modedata, mti->itemdata, mtd->search,
982 return (mti);
990 struct mode_tree_item *mti, *loop;
994 mti = mode_tree_search_forward(mtd);
996 mti = mode_tree_search_backward(mtd);
997 if (mti == NULL)
999 tag = mti->tag;
1001 loop = mti->parent;
1093 struct mode_tree_item *mti;
1104 mti = mtd->line_list[line].item;
1108 xasprintf(&title, "#[align=centre]%s", mti->name);
1140 struct mode_tree_item *current, *parent, *mti;
1323 TAILQ_FOREACH(mti, &mtd->children, entry)
1324 mti->expanded = 0;
1328 TAILQ_FOREACH(mti, &mtd->children, entry)
1329 mti->expanded = 1;