本文整理汇总了C++中NodeRef::id方法的典型用法代码示例。如果您正苦于以下问题:C++ NodeRef::id方法的具体用法?C++ NodeRef::id怎么用?C++ NodeRef::id使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NodeRef
的用法示例。
在下文中一共展示了NodeRef::id方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _initContent
void MediaRoutingView::_initContent()
{
D_METHOD(("MediaRoutingView::_initContent()\n"));
Autolock lock(manager);
void *cookie = 0;
NodeRef *ref;
while (manager->getNextRef(&ref, &cookie) == B_OK)
{
// add self as observer
add_observer(this, ref);
// create & place node view (+++++ defer until observer status confirmed!)
_addPanelFor(ref->id(), BPoint(M_CLEANUP_H_MARGIN, M_CLEANUP_V_MARGIN));
}
cookie = 0;
Connection connection;
while (manager->getNextConnection(&connection, &cookie) == B_OK)
{
_addWireFor(connection);
}
// create default groups
NodeGroup* group;
NodeRef* videoIn = manager->videoInputNode();
if (videoIn)
{
group = manager->createGroup("Video Input");
group->setRunMode(BMediaNode::B_RECORDING);
group->addNode(videoIn);
}
NodeRef* audioIn = manager->audioInputNode();
if (audioIn)
{
group = manager->createGroup("Audio Input");
group->setRunMode(BMediaNode::B_RECORDING);
group->addNode(audioIn);
}
NodeRef* videoOut = manager->videoOutputNode();
if (videoOut)
{
group = manager->createGroup("Video Output");
group->addNode(videoOut);
}
}
示例2: MessageReceived
void MediaRoutingView::MessageReceived(
BMessage* message)
{
D_METHOD(("MediaRoutingView::MessageReceived()\n"));
switch (message->what)
{
case B_MEDIA_NODE_CREATED:
{
D_MESSAGE(("MediaRoutingView::MessageReceived(B_MEDIA_NODE_CREATED)\n"));
type_code type;
int32 count;
if (message->GetInfo("media_node_id", &type, &count) == B_OK)
{
for(int32 n = 0; n < count; n++)
{
int32 id;
if (message->FindInt32("media_node_id", n, &id) == B_OK)
{
// [e.moon 8dec99] allow for existing panel
MediaNodePanel* panel;
if(_findPanelFor(id, &panel) < B_OK)
_addPanelFor(id, BPoint(5.0, 5.0));
}
}
}
break;
}
case B_MEDIA_NODE_DELETED:
{
D_MESSAGE(("MediaRoutingView::MessageReceived(B_MEDIA_NODE_DELETED)\n"));
type_code type;
int32 count;
if (message->GetInfo("media_node_id", &type, &count) == B_OK)
{
for (int32 n = 0; n < count; n++)
{
int32 id;
if (message->FindInt32("media_node_id", n, &id) == B_OK)
{
_removePanelFor(id);
}
}
}
break;
}
case B_MEDIA_CONNECTION_MADE:
{
D_MESSAGE(("MediaRoutingView::MessageReceived(B_MEDIA_CONNECTION_MADE)\n"));
type_code type;
int32 count;
if (message->GetInfo("output", &type, &count) == B_OK)
{
for (int32 n = 0; n < count; n++)
{
media_output output;
const void *data;
ssize_t dataSize;
if (message->FindData("output", B_RAW_TYPE, n, &data, &dataSize) == B_OK)
{
output = *reinterpret_cast<const media_output *>(data);
Connection connection;
if (manager->findConnection(output.node.node, output.source, &connection) == B_OK)
{
_addWireFor(connection);
}
}
}
}
break;
}
case B_MEDIA_CONNECTION_BROKEN:
{
D_MESSAGE(("MediaRoutingView::MessageReceived(B_MEDIA_CONNECTION_BROKEN)\n"));
type_code type;
int32 count;
if (message->GetInfo("__connection_id", &type, &count) == B_OK)
{
for (int32 n = 0; n < count; n++)
{
int32 id;
if (message->FindInt32("__connection_id", n, &id) == B_OK)
{
_removeWireFor(id);
}
}
}
break;
}
case B_MEDIA_FORMAT_CHANGED:
{
D_MESSAGE(("MediaRoutingView::MessageReceived(B_MEDIA_FORMAT_CHANGED)\n"));
media_node_id nodeID;
if(message->FindInt32("__source_node_id", &nodeID) < B_OK)
break;
uint32 connectionID;
if(message->FindInt32("__connection_id", (int32*)&connectionID) < B_OK)
break;
//.........这里部分代码省略.........
示例3: messageDropped
void MediaRoutingView::messageDropped(
BPoint point,
BMessage *message)
{
D_METHOD(("MediaRoutingView::messageDropped()\n"));
switch (message->what)
{
case DormantNodeView::M_INSTANTIATE_NODE:
{
D_MESSAGE(("MediaRoutingView::messageDropped(DormantNodeView::M_INSTANTIATE_NODE)\n"));
type_code type;
int32 count;
if (message->GetInfo("which", &type, &count) == B_OK)
{
for (int32 n = 0; n < count; n++)
{
dormant_node_info info;
const void *data;
ssize_t dataSize;
if (message->FindData("which", B_RAW_TYPE, &data, &dataSize) == B_OK)
{
memcpy(reinterpret_cast<void *>(&info), data, dataSize);
NodeRef* droppedNode;
status_t error;
error = manager->instantiate(info, &droppedNode);
if (!error)
{
m_lastDroppedNode = droppedNode->id();
BPoint dropPoint, dropOffset;
dropPoint = message->DropPoint(&dropOffset);
m_lastDropPoint = align(ConvertFromScreen(dropPoint - dropOffset));
}
else
{
BString s;
s << "Could not instantiate '" << info.name << "'";
showErrorMessage(s, error);
}
}
}
}
break;
}
case B_SIMPLE_DATA:
{
D_MESSAGE(("MediaRoutingView::messageDropped(B_SIMPLE_DATA)\n"));
entry_ref fileRef;
if (message->FindRef("refs", &fileRef) == B_OK)
{
_checkDroppedFile(&fileRef, ConvertFromScreen(message->DropPoint()));
}
break;
}
case B_PASTE:
{
D_MESSAGE(("MediaRoutingView::messageDropped(B_PASTE)\n"));
ssize_t size;
const rgb_color *color; // [e.moon 21nov99] fixed const error
if (message->FindData("RGBColor", B_RGB_COLOR_TYPE, reinterpret_cast<const void **>(&color), &size) == B_OK)
{
_changeBackground(*color);
}
break;
}
default:
{
DiagramView::messageDropped(point, message);
}
}
}
示例4: _checkDroppedFile
void MediaRoutingView::_checkDroppedFile(
entry_ref *ref,
BPoint dropPoint)
{
D_METHOD(("MediaRoutingView::_checkDroppedFile()\n"));
// [cell 26apr00] traverse links
BEntry entry(ref, true);
entry.GetRef(ref);
BNode node(ref);
if (node.InitCheck() == B_OK)
{
BNodeInfo nodeInfo(&node);
if (nodeInfo.InitCheck() == B_OK)
{
char mimeString[B_MIME_TYPE_LENGTH];
if (nodeInfo.GetType(mimeString) == B_OK)
{
BMimeType mimeType(mimeString);
BMimeType superType;
// [e.moon 22dec99] handle dropped node-set files
if(mimeType == RouteApp::s_nodeSetType) {
BMessage m(B_REFS_RECEIVED);
m.AddRef("refs", ref);
be_app_messenger.SendMessage(&m);
}
else if (mimeType.GetSupertype(&superType) == B_OK)
{
if (superType == "image")
{
_changeBackground(ref);
}
else if ((superType == "audio") || (superType == "video"))
{
NodeRef* droppedNode;
status_t error;
error = manager->instantiate(*ref, B_BUFFER_PRODUCER, &droppedNode);
if (!error)
{
media_output encVideoOutput;
if (droppedNode->findFreeOutput(&encVideoOutput, B_MEDIA_ENCODED_VIDEO) == B_OK)
{
droppedNode->setFlags(droppedNode->flags() | NodeRef::NO_POSITION_REPORTING);
}
m_lastDroppedNode = droppedNode->id();
m_lastDropPoint = align(dropPoint);
}
else
{
char fileName[B_FILE_NAME_LENGTH];
BEntry entry(ref);
entry.GetName(fileName);
BString s;
s << "Could not load '" << fileName << "'";
showErrorMessage(s, error);
}
}
}
}
}
}
}
示例5: xmlImportChild
void RouteAppNodeManager::xmlImportChild(
IPersistent* child,
ImportContext& context) {
status_t err;
if(!strcmp(context.element(), _DORMANT_NODE_ELEMENT)) {
DormantNodeIO* io = dynamic_cast<DormantNodeIO*>(child);
ASSERT(io);
NodeRef* newRef;
err = io->instantiate(this, &newRef);
if(err == B_OK) {
// created node; add an entry to the set stored in the
// ImportContext for later reference
try {
NodeSetIOContext& set = dynamic_cast<NodeSetIOContext&>(context);
set.addNode(newRef->id(), io->nodeKey());
}
catch(bad_cast& e) {
context.reportError("RouteAppNodeManager: expected a NodeSetIOContext\n");
}
}
else {
D_SETTINGS((
"!!! RouteAppNodeManager::xmlImportChild():\n"
" DormantNodeIO::instantiate() failed:\n"
" '%s'\n",
strerror(err)));
}
}
else if(!strcmp(context.element(), _CONNECTION_ELEMENT)) {
ConnectionIO* io = dynamic_cast<ConnectionIO*>(child);
ASSERT(io);
// instantiate the connection
Connection con;
err = io->instantiate(
this,
dynamic_cast<NodeSetIOContext*>(&context),
&con);
if(err < B_OK) {
D_SETTINGS((
"!!! ConnectionIO::instantiate() failed:\n"
" '%s'\n", strerror(err)));
}
// +++++ group magic?
}
else if(!strcmp(context.element(), _NODE_GROUP_ELEMENT)) {
// +++++
}
else if(
context.parentElement() &&
!strcmp(context.parentElement(), _UI_STATE_ELEMENT)) {
// expect a nested message
MessageIO* io = dynamic_cast<MessageIO*>(child);
if(!io) {
BString err;
err <<
"RouteAppNodeManager: unexpected child '" <<
context.element() << "'\n";
context.reportError(err.String());
}
// hand it off via the extended context object
try {
NodeSetIOContext& set = dynamic_cast<NodeSetIOContext&>(context);
set.importUIState(io->message());
}
catch(bad_cast& e) {
context.reportError("RouteAppNodeManager: expected a NodeSetIOContext\n");
}
}
}