void _AddCPF(Encap_Header *request,Eip_Item *adressitem,void *adress, Eip_Item *dataitem,void *data) { _AddINT2Header(request,2); _AddItem(request,adressitem,adress); _AddItem(request,dataitem,data); }
void BrowsingHistory::_LoadSettings() { if (fSettingsLoaded) return; fSettingsLoaded = true; BFile settingsFile; if (_OpenSettingsFile(settingsFile, B_READ_ONLY)) { BMessage settingsArchive; settingsArchive.Unflatten(&settingsFile); if (settingsArchive.FindInt32("max history item age", &fMaxHistoryItemAge) != B_OK) { fMaxHistoryItemAge = 7; } BDateTime oldestAllowedDateTime = BDateTime::CurrentDateTime(B_LOCAL_TIME); oldestAllowedDateTime.Date().AddDays(-fMaxHistoryItemAge); BMessage historyItemArchive; for (int32 i = 0; settingsArchive.FindMessage("history item", i, &historyItemArchive) == B_OK; i++) { BrowsingHistoryItem item(&historyItemArchive); if (oldestAllowedDateTime < item.DateTime()) _AddItem(item, true); historyItemArchive.MakeEmpty(); } } }
bool BrowsingHistory::AddItem(const BrowsingHistoryItem& item) { BAutolock _(this); return _AddItem(item, false); }
ALMGroup& ALMGroup::operator/(const ALMGroup& bottom) { return _AddItem(bottom, B_VERTICAL); }
ALMGroup& ALMGroup::operator|(const ALMGroup& right) { return _AddItem(right, B_HORIZONTAL); }
// SetTo void PropertyListView::SetTo(PropertyObject* object) { // try to do without rebuilding the list // it should in fact be pretty unlikely that this does not // work, but we keep being defensive if (fPropertyObject && object && fPropertyObject->ContainsSameProperties(*object)) { // iterate over view items and update their value views bool error = false; for (int32 i = 0; PropertyItemView* item = _ItemAt(i); i++) { Property* property = object->PropertyAt(i); if (!item->AdoptProperty(property)) { // the reason for this can be that the property is // unkown to the PropertyEditorFactory and therefor // there is no editor view at this item fprintf(stderr, "PropertyListView::_SetTo() - " "property mismatch at %ld\n", i); error = true; break; } if (property) item->SetEnabled(property->IsEditable()); } // we didn't need to make empty, but transfer ownership // of the object if (!error) { // if the "adopt" process went only halfway, // some properties of the original object // are still referenced, so we can only // delete the original object if the process // was successful and leak Properties otherwise, // but this case is only theoretical anyways... delete fPropertyObject; } fPropertyObject = object; } else { // remember scroll pos, selection and focused item BPoint scrollOffset = ScrollOffset(); BList selection(20); int32 focused = -1; for (int32 i = 0; PropertyItemView* item = _ItemAt(i); i++) { if (item->IsSelected()) selection.AddItem((void*)i); if (item->IsFocused()) focused = i; } if (Window()) Window()->BeginViewTransaction(); fSuspendUpdates = true; // rebuild list _MakeEmpty(); fPropertyObject = object; if (fPropertyObject) { // fill with content for (int32 i = 0; Property* property = fPropertyObject->PropertyAt(i); i++) { PropertyItemView* item = new PropertyItemView(property); item->SetEnabled(property->IsEditable()); _AddItem(item); } _LayoutItems(); // restore scroll pos, selection and focus SetScrollOffset(scrollOffset); for (int32 i = 0; PropertyItemView* item = _ItemAt(i); i++) { if (selection.HasItem((void*)i)) item->SetSelected(true); if (i == focused) item->MakeFocus(true); } } if (Window()) Window()->EndViewTransaction(); fSuspendUpdates = false; SetDataRect(_ItemsRect()); } _UpdateSavedProperties(); _CheckMenuStatus(); Invalidate(); }