void OpenWithPoseView::CreatePoses(Model **models, PoseInfo *poseInfoArray, int32 count, BPose **resultingPoses, bool insertionSort, int32 *lastPoseIndexPtr, BRect *boundsPtr, bool forceDraw) { // overridden to try to select the preferred handling app _inherited::CreatePoses(models, poseInfoArray, count, resultingPoses, insertionSort, lastPoseIndexPtr, boundsPtr, forceDraw); if (resultingPoses) for (int32 index = 0; index < count; index++) if (resultingPoses[index] && fHaveCommonPreferredApp && *(models[index]->EntryRef()) == fPreferredRef) // this is our preferred app, select it's pose SelectPose(resultingPoses[index], IndexOfPose(resultingPoses[index])); }
bool BPoseView::SetProperty(BMessage *_SCRIPTING_ONLY(message), BMessage *, int32 _SCRIPTING_ONLY(form), const char *_SCRIPTING_ONLY(property), BMessage *_SCRIPTING_ONLY(reply)) { #if _SUPPORTS_FEATURE_SCRIPTING status_t error = B_OK; bool handled = false; if (strcmp(property, kPropertySelection) == 0) { entry_ref ref; switch (form) { case B_DIRECT_SPECIFIER: { int32 selStart; int32 selEnd; if (message->FindInt32("data", 0, &selStart) == B_OK && message->FindInt32("data", 1, &selEnd) == B_OK) { if (selStart < 0 || selStart >= fPoseList->CountItems() || selEnd < 0 || selStart >= fPoseList->CountItems()) { error = B_BAD_INDEX; handled = true; break; } SelectPoses(selStart, selEnd); handled = true; break; } } // fall thru case kPreviousSpecifier: case kNextSpecifier: { // PRINT(("SetProperty direct/previous/next %s\n", property)); // select/unselect poses specified by entries bool clearSelection = true; for (int32 index = 0; message->FindRef("data", index, &ref) == B_OK; index++) { int32 poseIndex; BPose *pose = FindPose(&ref, form, &poseIndex); if (!pose) { error = B_ENTRY_NOT_FOUND; handled = true; break; } if (clearSelection) { // first selected item must call SelectPose so the selection // gets cleared first SelectPose(pose, poseIndex); clearSelection = false; } else AddPoseToSelection(pose, poseIndex); handled = true; } break; } } } if (error != B_OK) reply->AddInt32("error", error); return handled; #else return false; #endif }