p->data = safe_cast NULL;
p->damaged = 0;
p->attrs = NULL;
- if (par)
- pane_damaged(p, DAMAGED_SIZE);
}
static void __pane_check(struct pane *p safe)
return;
}
p->damaged |= type;
- if (type == DAMAGED_SIZE)
- pane_notify("Notify:resize", p);
z = p->z;
if (z < 0)
while ((p->damaged | type) != p->damaged) {
if (z > 0 && (type & DAMAGED_SIZE_CHILD))
/* overlay changed size, so we must refresh */
+ /* FIXME should this be a notification? */
p->damaged |= DAMAGED_CONTENT;
p->damaged |= type;
z = p->z;
if (p->damaged & DAMAGED_CLOSED)
/* ChildRegistered objected */
p = NULL;
+ else
+ /* Need to set size of child */
+ pane_damaged(parent, DAMAGED_SIZE);
}
return p;
}
p->abs_zhi = abs_z;
return;
}
- if ((damage & DAMAGED_SIZE) && p->z == 0)
+ if ((damage & DAMAGED_SIZE) && p->z == 0 &&
+ (p->parent->w || p->parent->h))
/* Parent was resized and didn't propagate, so we need to */
pane_resize(p, 0, 0, p->parent->w, p->parent->h);
if (x >= 0 &&
(p->x != x || p->y != y)) {
- damage |= DAMAGED_CONTENT | DAMAGED_SIZE;
+ damage |= DAMAGED_SIZE;
p->x = x;
p->y = y;
}
p->w = 1;
if (p->h <= 0)
p->h = 1;
+ /* tell the pane to resize its children later */
pane_damaged(p, damage);
+ if (damage)
+ pane_notify("Notify:resize", p);
}
void pane_reparent(struct pane *p safe, struct pane *newparent safe)
p->data = data;
parent->damaged |= p->damaged;
+ pane_damaged(p, DAMAGED_SIZE);
pane_close(p);
}
SCREEN *scr;
struct pane *p;
struct display_data *dd;
+ int rows, cols;
FILE *f;
set_screen(NULL);
dd->scr = scr;
dd->scr_file = f;
dd->cursor.x = dd->cursor.y = -1;
- dd->is_xterm = (term && strncmp(term, "xterm", 5) == 0);
+ dd->is_xterm = (term && strncmp(term, "xterm", 5) == 0);
p = pane_register(ed, 0, &ncurses_handle.c, dd);
+ if (!p) {
+ unalloc(dd, pane);
+ return NULL;
+ }
set_screen(p);
start_color();
REPORT_MOUSE_POSITION, NULL);
mouseinterval(10);
- getmaxyx(stdscr, p->h, p->w);
+ getmaxyx(stdscr, rows, cols);
+ pane_resize(p, 0, 0, cols, rows);
call("editor:request:all-displays", p);
if (!prepare_recrep(p)) {
if (!tty)
call_comm("event:signal", p, &handle_winch, SIGWINCH);
}
- pane_damaged(p, DAMAGED_SIZE);
return p;
}
resize_term(size.ws_row, size.ws_col);
clear();
- pane_damaged(p, DAMAGED_SIZE);
+ pane_resize(p, 0, 0, size.ws_row, size.ws_col);
return 1;
}
mli->hidden = 0;
else
mli->hidden = 1;
+ /* trigger a resize of children */
pane_damaged(ci->home, DAMAGED_SIZE);
return 0; /* Allow other panes to remove other borders */
}
{
struct mlinfo *mli = ci->home->data;
mli->child = ci->focus;
- pane_damaged(ci->home, DAMAGED_SIZE);
pane_focus(ci->focus);
return 1;
}
return 1;
}
+DEF_CMD(popup_notify_refresh_size)
+{
+ pane_damaged(ci->home, DAMAGED_SIZE);
+ return 1;
+}
+
DEF_CMD(popup_refresh_size)
{
struct popup_info *ppi = ci->home->data;
key_add(popup_map, "Abort", &popup_abort);
key_add(popup_map, "popup:style", &popup_style);
key_add(popup_map, "Refresh:size", &popup_refresh_size);
- key_add(popup_map, "Notify:resize", &popup_refresh_size);
+ key_add(popup_map, "Notify:resize", &popup_notify_refresh_size);
key_add(popup_map, "popup:get-target", &popup_get_target);
key_add(popup_map, "popup:close", &popup_do_close);
key_add(popup_map, "popup:set-callback", &popup_set_callback);
ti->direction = tmp;
ti2->p = remain;
pane_subsume(remain, p);
- pane_damaged(p, DAMAGED_SIZE);
}
return 1;
}
continue;
ti = t->data;
if (ti->direction == Horiz) {
- t->y = 0;
- t->h = p->h;
+ pane_resize(t, t->x, 0, t->w, p->h);
used += t->w;
size = p->w;
} else {
- t->x = 0;
- t->w = p->w;
+ pane_resize(t, 0, t->y, p->w, t->h);
used += t->h;
size = p->h;
}
- pane_damaged(t, DAMAGED_SIZE);
if (ti->avail_inline)
avail_cnt++;
cnt++;
remain -= mysize;
if (diff)
change = 1;
- if (ti2->direction == Horiz) {
- t->w += diff;
- used += diff;
- cnt--;
- } else {
- t->h += diff;
- used += diff;
- cnt--;
- }
- pane_damaged(t, DAMAGED_SIZE);
+ if (ti2->direction == Horiz)
+ pane_resize(t, t->x, t->y, t->w + diff, t->h);
+ else
+ pane_resize(t, t->x, t->y, t->w, t->h + diff);
+
+ used += diff;
+ cnt--;
}
if (!change)
break;
if (t->z)
continue;
if (ti2->direction == Horiz) {
- t->x = pos;
+ pane_resize(t, pos, t->y, t->w, t->h);
pos += t->w;
} else {
- t->y = pos;
+ pane_resize(t, t->x, pos, t->w, t->h);
pos += t->h;
}
- pane_damaged(t, DAMAGED_SIZE);
tile_adjust(t);
}
}
/* Strange - there should have been two elements in list */
return 1;
if (ti->direction == Horiz) {
- p->w += size;
- other->w -= size;
- } else{
- p->h += size;
- other->h -= size;
+ pane_resize(p, p->x, p->y, p->w + size, p->h);
+ pane_resize(other, other->x, other->y,
+ other->w - size, other->h);
+ } else {
+ pane_resize(p, p->x, p->y, p->w, p->h + size);
+ pane_resize(other, other->x, other->y,
+ other->w, other->h - size);
}
- pane_damaged(p, DAMAGED_SIZE);
- pane_damaged(other, DAMAGED_SIZE);
tile_adjust(p->parent);
return 1;
}
if (avail < size)
return 0;
if (ti->direction == Horiz)
- p->w += size;
+ pane_resize(p, p->x, p->y, p->w + size, p->h);
else
- p->h += size;
- pane_damaged(p, DAMAGED_SIZE);
+ pane_resize(p, p->x, p->y, p->w, p->h + size);
+
ti->avail_inline = 0; /* make sure this one doesn't suffer */
tile_adjust(p->parent);
return 1;
if (wrong_pane(ci))
return 0;
tile_grow(p, 1, RPT_NUM(ci));
- pane_damaged(p, DAMAGED_SIZE);
return 1;
}
if (wrong_pane(ci))
return 0;
tile_grow(p, 1, -RPT_NUM(ci));
- pane_damaged(p, DAMAGED_SIZE);
return 1;
}
DEF_CMD(tile_window_yplus)
if (wrong_pane(ci))
return 0;
tile_grow(p, 0, RPT_NUM(ci));
- pane_damaged(p, DAMAGED_SIZE);
return 1;
}
DEF_CMD(tile_window_yminus)
if (wrong_pane(ci))
return 0;
tile_grow(p, 0, -RPT_NUM(ci));
- pane_damaged(p, DAMAGED_SIZE);
return 1;
}
}
attr_set_int(&p->attrs, "scale", scale);
- pane_damaged(p, DAMAGED_SIZE);
+ call("view:changed", ci->focus);
return 1;
}
struct pane *p = ci->home;
struct view_data *vd = p->data;
vd->child = ci->focus;
- pane_damaged(p, DAMAGED_SIZE|DAMAGED_CONTENT);
return 1;
}
vd->border = calc_border(ci->focus);
b = vd->border < 0 ? 0 : vd->border;
if (vd->line_height < 0) {
+ /* FIXME should use scale */
struct call_return cr = call_ret(all, "text-size", ci->home,
-1, NULL, "M",
0, NULL, "bold");
/* Capture status-changed notification so we can update 'changed' flag in
* status line */
call("doc:request:doc:status-changed", p);
- pane_damaged(p, DAMAGED_SIZE);
return p;
}