Exemplo n.º 1
0
AllocationInfo* AllocationTable::find_same_size(
    Canvas* c, const Allocation& a, Coord& dx, Coord& dy
) const {
    const Allotment& x = a.x_allotment();
    const Allotment& y = a.y_allotment();
    AllocationInfoList& list = impl_->allocations_;
    for (ListUpdater(AllocationInfoList) i(list); i.more(); i.next()) {
	AllocationInfo* info = i.cur();
	if (info->canvas_ == c &&
	    (c == nil || *info->transformer_ == c->transformer())
	) {
	    Allotment& oldx = info->allocation_.x_allotment();
	    Allotment& oldy = info->allocation_.y_allotment();
	    if (AllocationTableImpl::same_size(x, oldx) &&
		AllocationTableImpl::same_size(y, oldy)
	    ) {
		dx = x.origin() - oldx.origin();
		dy = y.origin() - oldy.origin();
		oldx.origin(x.origin());
		oldy.origin(y.origin());
		if (list.count() > 1) {
		    i.remove_cur();
		    list.append(info);
		}
		return info;
	    }
        }
    }
    return nil;
}
Exemplo n.º 2
0
void Observable::detach(Observer* o) {
    ObserverList* list = observers_;
    if (list != nil) {
	for (ListUpdater(ObserverList) i(*list); i.more(); i.next()) {
	    if (i.cur() == o) {
		i.remove_cur();
		break;
	    }
	}
    }
}
Exemplo n.º 3
0
FontRep::~FontRep() {
    XFreeFont(display_->rep()->display_, font_);
    for (ListUpdater(FontRepList) i(entry_->fontreps); i.more(); i.next()) {
	if (i.cur() == this) {
	    i.remove_cur();
	    break;
	}
    }
    delete name_;
    delete encoding_;
}
Exemplo n.º 4
0
void Editor::RemoveDialog (Glyph* g) {
    for (ListUpdater(EditorImpl) i(*_impl); i.more(); i.next()) {
	TransientWindow* t = i.cur();
	if (t->glyph() == g) {
	    t->unmap();
	    i.remove_cur();
	    delete t;
	    break;
	}
    }
}
Exemplo n.º 5
0
void FontImpl::remove(const Font* f) {
    if (entry_ != nil) {
	for (ListUpdater(FontList) i(entry_->fonts); i.more(); i.next()) {
	    if (i.cur() == f) {
		i.remove_cur();
		break;
	    }
	}
	if (entry_->fonts.count() == 0 && entry_->fontreps.count() == 0) {
	    fonts_->remove(*name_);
	    delete entry_;
	}
    }
    entry_ = nil;
}
Exemplo n.º 6
0
AllocationInfo* AllocationTable::find(Canvas* c, const Allocation& a) const {
    AllocationInfoList& list = impl_->allocations_;
    for (ListUpdater(AllocationInfoList) i(list); i.more(); i.next()) {
	AllocationInfo* info = i.cur();
	if (info->canvas_ == c &&
	    (c == nil || *info->transformer_ == c->transformer()) &&
	    AllocationTableImpl::equal(info->allocation_, a)
	) {
	    if (list.count() > 1) {
		i.remove_cur();
		list.append(info);
	    }
	    return info;
	}
    }
    return nil;
}