void SdDurationCanvas::merge(Q3PtrList<SdDurationCanvas> & l) { l.removeRef(this); QRect r = rect(); int vmin = r.top(); int vmax = r.bottom(); SdDurationCanvas * d; for (d = l.first(); d != 0; d = l.next()) { QRect dr = d->rect(); if (dr.top() < vmin) vmin = dr.top(); if (dr.bottom() > vmax) vmax = dr.bottom(); collapse(d); } if (vmin < r.top()) Q3CanvasItem::moveBy(0, vmin - r.top()); resize(r.width(), vmax - vmin + 1); update_self(); }
void SdDurationCanvas::change_scale() { DiagramCanvas::change_scale(); update_self(); hide(); update_hpos(); show(); }
// called by the duration's messages to increase if // needed the duration to contain its messages void SdDurationCanvas::update_v_to_contain(const QRect re) { const QRect r = rect(); if (re.top() < r.top()) { int dy = re.top() - r.top(); Q3CanvasItem::moveBy(0, dy); resize(r.width(), r.height() - dy); update_self(); } else if (re.bottom() > r.bottom()) { resize(r.width(), re.bottom() - r.top() + 1); update_self(); } // done in all cases support->update_v_to_contain(this, TRUE); }
void SdDurationCanvas::update_v_to_contain(SdDurationCanvas * d, bool force) { if (force || !selected()) { int min_b = (int) d->y() + d->height() + width()/2; int b = (int) y() + height(); if (d->y() < y()){ Q3CanvasItem::moveBy(0, d->y() - y()); resize(width(), ((min_b > b) ? min_b : b) - (int) y()); update_self(); } else if (min_b > b) { resize(width(), min_b - (int) y() + 1); update_self(); } // done in all cases support->update_v_to_contain(this, force); } }
/*----------------------------------------------------------- * Mise à jour de toutes les cellules de la grille *----------------------------------------------------------*/ int update_cells (struct ctx_s *ctx) { int x, y; int top, bottom, left, right; int update = 0; for (x=1; x < ctx->X+1; ++x) { for (y=1; y < ctx->Y+1; ++y) { int nb_burning = 0; left = x - 1; right = x + 1; top = y - 1; bottom = y + 1; update_neighbor(ctx, left, y, &nb_burning); update_neighbor(ctx, right, y, &nb_burning); update_neighbor(ctx, x, top, &nb_burning); update_neighbor(ctx, x, bottom, &nb_burning); update += update_self(ctx, x, y, nb_burning); } } return update; }