/*----------------------------------------------------------------------------*\ Check if class is an IO-type. \*----------------------------------------------------------------------------*/ int io_CheckClassIoType( io_eType type, pwr_tCid cid ) { pwr_tStatus sts; pwr_sClassDef cdef; pwr_sAttrRef aref; aref = cdh_ObjidToAref( cdh_ClassIdToObjid( cid)); sts = gdh_GetObjectInfoAttrref( &aref, &cdef, sizeof(cdef)); if ( EVEN(sts)) return 0; switch ( type) { case io_eType_Agent: if ( cdef.Flags.b.IOAgent) return 1; break; case io_eType_Rack: if ( cdef.Flags.b.IORack) return 1; break; case io_eType_Card: if ( cdef.Flags.b.IOCard) return 1; break; default: ; } return 0; }
pwr_tStatus xtt_pb_dp_slave_create_ctx( pwr_tAttrRef aref, void *editor_ctx, xtt_slave_sCtx **ctxp) { pwr_tAName name; pwr_tString80 gsdfile; int sts; pwr_tFileName fname; pwr_tCid cid; pwr_tOid oid; int found; int mc_cnt; int module_cnt; pwr_tAttrRef aaref; sts = gdh_ObjidToName( aref.Objid, name, sizeof(name), cdh_mName_volumeStrict); if ( EVEN(sts)) return sts; sts = gdh_ArefANameToAref( &aref, "GSDFile", &aaref); if ( EVEN(sts)) return sts; sts = gdh_GetObjectInfoAttrref( &aaref, gsdfile, sizeof(gsdfile)); if ( EVEN(sts)) return sts; if ( strcmp( gsdfile, "") == 0) { return PB__GSDATTR; } xtt_slave_sCtx *ctx = (xtt_slave_sCtx *) calloc( 1, sizeof(xtt_slave_sCtx)); ctx->aref = aref; // Count modules module_cnt = 0; for ( sts = gdh_GetChild( aref.Objid, &oid); ODD(sts); sts = gdh_GetNextSibling( oid, &oid)) { module_cnt++; } ctx->mc = (gsd_sModuleClass *) calloc( module_cnt + 2, sizeof(gsd_sModuleClass)); mc_cnt = 0; ctx->editor_ctx = editor_ctx; ctx->mc[0].cid = pwr_cClass_Pb_Module; sts = gdh_ObjidToName( cdh_ClassIdToObjid(ctx->mc[0].cid), ctx->mc[0].name, sizeof(ctx->mc[0].name), cdh_mName_object); if ( EVEN(sts)) return sts; mc_cnt++; for ( sts = gdh_GetChild( aref.Objid, &oid); ODD(sts); sts = gdh_GetNextSibling( oid, &oid)) { sts = gdh_GetObjectClass( oid, &cid); if ( EVEN(sts)) return sts; found = 0; for ( int i = 0; i < mc_cnt; i++) { if ( ctx->mc[i].cid == cid) { found = 1; break; } } if ( found) continue; ctx->mc[mc_cnt].cid = cid; sts = gdh_ObjidToName( cdh_ClassIdToObjid(cid), ctx->mc[mc_cnt].name, sizeof(ctx->mc[0].name), cdh_mName_object); if ( EVEN(sts)) return sts; mc_cnt++; } if ( strchr( gsdfile, '/') == 0) { strcpy( fname, "$pwrp_exe/"); strcat( fname, gsdfile); } else strcpy( fname, gsdfile); ctx->gsd = new pb_gsd(); sts = ctx->gsd->read( fname); if ( EVEN(sts)) return sts; ctx->gsd->set_classes( ctx->mc); sts = xtt_pb_dp_slave_load_modules( ctx); if ( EVEN(sts)) return sts; *ctxp = ctx; return 1; }
static void attrvalue_to_string( int type_id, void *value_ptr, char *str, int size, int *len, char *format) { pwr_tObjid objid; pwr_sAttrRef *attrref; int sts; char timstr[64]; if ( value_ptr == 0) { strcpy( str, "UNDEFINED"); return; } switch ( type_id ) { case pwr_eType_Boolean: { if ( !format) *len = sprintf( str, "%d", *(pwr_tBoolean *)value_ptr); else *len = sprintf( str, format, *(pwr_tBoolean *)value_ptr); break; } case pwr_eType_Float32: { if ( !format) *len = sprintf( str, "%f", *(float *)value_ptr); else *len = sprintf( str, format, *(float *)value_ptr); break; } case pwr_eType_Float64: { if ( !format) *len = sprintf( str, "%f", *(double *)value_ptr); else *len = sprintf( str, format, *(double *)value_ptr); break; } case pwr_eType_Char: { if ( !format) *len = sprintf( str, "%c", *(char *)value_ptr); else *len = sprintf( str, format, *(char *)value_ptr); break; } case pwr_eType_Int8: { if ( !format) *len = sprintf( str, "%d", *(char *)value_ptr); else *len = sprintf( str, format, *(char *)value_ptr); break; } case pwr_eType_Int16: { if ( !format) *len = sprintf( str, "%hd", *(short *)value_ptr); else *len = sprintf( str, format, *(short *)value_ptr); break; } case pwr_eType_Int32: { if ( !format) *len = sprintf( str, "%d", *(int *)value_ptr); else *len = sprintf( str, format, *(int *)value_ptr); break; } case pwr_eType_Int64: { if ( !format) *len = sprintf( str, pwr_dFormatInt64, *(pwr_tInt64 *)value_ptr); else *len = sprintf( str, format, *(pwr_tInt64 *)value_ptr); break; } case pwr_eType_UInt8: { if ( !format) *len = sprintf( str, "%d", *(unsigned char *)value_ptr); else *len = sprintf( str, format, *(unsigned char *)value_ptr); break; } case pwr_eType_UInt16: { if ( !format) *len = sprintf( str, "%hd", *(unsigned short *)value_ptr); else *len = sprintf( str, format, *(unsigned short *)value_ptr); break; } case pwr_eType_UInt32: case pwr_eType_Mask: case pwr_eType_Enum: { if ( !format) *len = sprintf( str, "%d", *(unsigned int *)value_ptr); else *len = sprintf( str, format, *(unsigned int *)value_ptr); break; } case pwr_eType_UInt64: { if ( !format) *len = sprintf( str, pwr_dFormatUInt64, *(pwr_tUInt64 *)value_ptr); else *len = sprintf( str, format, *(pwr_tUInt64 *)value_ptr); break; } case pwr_eType_String: { strncpy( str, (char *)value_ptr, size); str[size-1] = 0; *len = strlen(str); break; } case pwr_eType_Objid: { pwr_tOName hiername; objid = *(pwr_tObjid *)value_ptr; if ( !objid.oix) sts = gdh_ObjidToName ( objid, hiername, sizeof(hiername), cdh_mName_volumeStrict); else sts = gdh_ObjidToName ( objid, hiername, sizeof(hiername), cdh_mNName); if (EVEN(sts)) { strcpy( str, ""); *len = 0; break; } *len = sprintf( str, "%s", hiername); break; } case pwr_eType_AttrRef: { pwr_tAName hiername; attrref = (pwr_sAttrRef *) value_ptr; sts = gdh_AttrrefToName ( attrref, hiername, sizeof(hiername), cdh_mNName); if (EVEN(sts)) { strcpy( str, ""); *len = 0; break; } *len = sprintf( str, "%s", hiername); break; } case pwr_eType_Time: { sts = time_AtoAscii( (pwr_tTime *) value_ptr, time_eFormat_DateAndTime, timstr, sizeof(timstr)); if ( EVEN(sts)) strcpy( timstr, "-"); *len = sprintf( str, "%s", timstr); break; } case pwr_eType_DeltaTime: { sts = time_DtoAscii( (pwr_tDeltaTime *) value_ptr, 1, timstr, sizeof(timstr)); if ( EVEN(sts)) strcpy( timstr, "Undefined time"); *len = sprintf( str, "%s", timstr); break; } case pwr_eType_ObjectIx: { *len = sprintf( str, "%s", cdh_ObjectIxToString( NULL, *(pwr_tObjectIx *) value_ptr, 1)); break; } case pwr_eType_ClassId: { pwr_tOName hiername; objid = cdh_ClassIdToObjid( *(pwr_tClassId *) value_ptr); sts = gdh_ObjidToName ( objid, hiername, sizeof(hiername), cdh_mNName); if (EVEN(sts)) { strcpy( str, ""); *len = 0; break; } *len = sprintf( str, "%s", hiername); break; } case pwr_eType_TypeId: { pwr_tOName hiername; objid = cdh_TypeIdToObjid( *(pwr_tTypeId *) value_ptr); sts = gdh_ObjidToName ( objid, hiername, sizeof(hiername), cdh_mNName); if (EVEN(sts)) { strcpy( str, ""); *len = 0; break; } *len = sprintf( str, "%s", hiername); break; } case pwr_eType_VolumeId: { *len = sprintf( str, "%s", cdh_VolumeIdToString( NULL, *(pwr_tVolumeId *) value_ptr, 1, 0)); break; } case pwr_eType_RefId: { *len = sprintf( str, "%s", cdh_SubidToString( NULL, *(pwr_tSubid *) value_ptr, 1)); break; } } }
// // printObject // void wb_print_wbl::printObject(wb_volume& v, wb_object& o, bool recursive) { wb_object to = o; wb_object templ; cdh_uObjid uid; unsigned int idx; wb_cdef cdef = v.cdef(o); if ( !cdef) { m_os << "! %WBDUMP-E-Error Failed to get object class" << endl; m_errCnt++; // return; cdef = v.cdef( pwr_eClass_ClassLost); } const char* cname = cdef.name(); char *block; int size; if ( o.docBlock( &block, &size) && strcmp( block, "") != 0) { indent(0) << "!/**" << endl; indent(0) << "! "; for ( char *s = block; *s; s++) { if ( *s == '\n') { m_os << *s; indent(0) << "! "; continue; } m_os << *s; } m_os << endl; indent(0) << "!*/" << endl; } indent(1) << "Object " << o.name() << " " << cname; if (m_idxFlag) { switch (cdef.cid()) { case pwr_eClass_ClassDef: uid.pwr = o.oid(); idx = uid.c.cix; break; case pwr_eClass_TypeDef: uid.pwr = o.oid(); idx = uid.t.tix; break; case pwr_eClass_ObjBodyDef: uid.pwr = o.oid(); idx = uid.c.bix; break; case pwr_eClass_Param: case pwr_eClass_Input: case pwr_eClass_Output: case pwr_eClass_Intern: case pwr_eClass_Buffer: case pwr_eClass_ObjXRef: uid.pwr = o.oid(); idx = uid.c.aix; break; default: idx = (unsigned long) o.oix(); } m_os << " " << idx; } if ( m_timeFlag) { // Get oh time char timestr[40]; pwr_tTime ohtime = o.ohTime(); time_AtoAscii( &ohtime, time_eFormat_DateAndTime, timestr, sizeof(timestr)); m_os << " " << timestr; } m_os << endl; wb_object co = v.object(cdh_ClassIdToObjid(cdef.cid())); wb_name t("Template"); templ = co.child(t); if (!templ) { m_errCnt++; m_os << "Template not found for class " << cdef.name() << endl; return; } if ( v.cid() == pwr_eClass_ClassVolume && strcmp( o.name(), "Template") == 0) m_isTemplateObject = true; else m_isTemplateObject = false; printBody(v, o, templ, cdef, pwr_eBix_rt); printBody(v, o, templ, cdef, pwr_eBix_dev); if (recursive) { if ( !(m_noFoCodeFlag && isFoCodeObject( v, o))) { for (to = o.first(); to; to = to.after()) printObject(v, to); } } indent(-1) << "EndObject" << endl; }
// // printClass // void wb_print_wbl::printClass(wb_volume& v, wb_attribute& attr, wb_attribute& tattr, wb_adef& adef) { pwr_tCid subClass = attr.subClass(); wb_object templ; wb_object sysbo; wb_attribute tattr2; wb_attribute attr2; wb_adef adef2; // if ( strcmp( attr.name(), "Template") == 0 && v.cid() == pwr_eClass_ClassVolume) // The parser can't handle subclasses in template objects yet... // return; wb_cdef cdef = v.cdef(attr.cid()); if (!cdef) { m_os << "! %WBDUMP-E-Error Unknown sub class: " << subClass << endl; m_errCnt++; return; } wb_bdef bdef = cdef.bdef(pwr_eBix_sys); if (!bdef) { m_os << "! %WBDUMP-E-Error sub class: " << subClass << " not defined" << endl; m_errCnt++; return; } for (int i = 0; i < adef.nElement(); i++) { attr2 = attr.first(i); tattr2 = tattr.first(i); while ( attr2.oddSts()) { adef2 = bdef.adef( attr2.attrName()); printAttribute(v, attr2, tattr2, adef2, 0); attr2 = attr2.after(); if ( tattr2.oddSts()) tattr2 = tattr2.after(); } } #if 0 wb_object co = v.object(cdh_ClassIdToObjid(subClass)); if (!co) { m_os << "! %WBDUMP-E-Error Unknown sub class: " << subClass << endl; m_errCnt++; return; } wb_cdef cdef = v.cdef(subClass); if (!cdef) { m_os << "! %WBDUMP-E-Error Unknown sub class: " << subClass << endl; m_errCnt++; return; } wb_name t("Template"); templ = co.child(t); if (!templ) { m_errCnt++; m_os << "! %WBDUMP-E-Error Template not found for class " << cdef.longName() << endl; return; } wb_bdef bdef = cdef.bdef(pwr_eBix_sys); if (!bdef) { m_os << "! %WBDUMP-E-Error sub class: " << subClass << " not defined" << endl; m_errCnt++; return; } bname = bdef.name(); for (int i = 0; i < adef.nElement(); i++) { if (adef.flags() & PWR_MASK_ARRAY) indent(1) << "Buffer " << adef.name() << "[" << i << "]" << endl; else indent(1) << "Buffer " << adef.name() << endl; adef2 = bdef.adef(); attr2 = attr.first(i); while (1) { tattr2 = templ.attribute(bname, adef2.name()); printAttribute(v, attr2, tattr2, adef2, 0); if (!(adef2 = adef2.next())) break; if (!(attr2 = attr2.after())) break; } indent(-1) << "EndBuffer" << endl; if (adef.flags() & PWR_MASK_ARRAY) indent(1) << "Buffer " << adef.name() << "[" << i << "]" << endl; else indent(1) << "Buffer " << adef.name() << endl; adef2 = bdef.adef(); attr2 = attr.first(i); while (1) { strcpy( aname, adef.subName()); strcat( aname, "."); strcat( aname, attr2.name()); attr2 tattr2 = templ.attribute(bname, adef2.name()); printAttribute(v, attr2, tattr2, adef2, 0); if (!(adef2 = adef2.next())) break; if (!(attr2 = attr2.after())) break; } } #endif }
pwr_tStatus pndevice_create_ctx(ldh_tSession ldhses, pwr_tAttrRef aref, void* editor_ctx, device_sCtx** ctxp) { pwr_tOName name; char* gsdmlfile; int size; int sts; pwr_tFileName fname; ldh_sSessInfo Info; std::vector<pwr_tCid> mcv; sts = ldh_GetSessionInfo(ldhses, &Info); sts = ldh_ObjidToName( ldhses, aref.Objid, ldh_eName_Hierarchy, name, sizeof(name), &size); if (EVEN(sts)) return sts; sts = ldh_GetObjectPar( ldhses, aref.Objid, "RtBody", "GSDMLfile", &gsdmlfile, &size); if (EVEN(sts)) return sts; if (streq(gsdmlfile, "")) { free(gsdmlfile); return PB__GSDATTR; } device_sCtx* ctx = (device_sCtx*)calloc(1, sizeof(device_sCtx)); ctx->ldhses = ldhses; ctx->aref = aref; ctx->editor_ctx = editor_ctx; ctx->edit_mode = (ODD(sts) && Info.Access == ldh_eAccess_ReadWrite) && ldh_LocalObject(ldhses, aref.Objid); get_subcid(ctx->ldhses, pwr_cClass_PnModule, mcv); ctx->mc = (gsdml_sModuleClass*)calloc(mcv.size() + 2, sizeof(gsdml_sModuleClass)); ctx->mc[0].cid = pwr_cClass_PnModule; sts = ldh_ObjidToName(ctx->ldhses, cdh_ClassIdToObjid(ctx->mc[0].cid), cdh_mName_object, ctx->mc[0].name, sizeof(ctx->mc[0].name), &size); if (EVEN(sts)) return sts; for (int i = 1; i <= (int)mcv.size(); i++) { ctx->mc[i].cid = mcv[i - 1]; sts = ldh_ObjidToName(ctx->ldhses, cdh_ClassIdToObjid(ctx->mc[i].cid), cdh_mName_object, ctx->mc[i].name, sizeof(ctx->mc[0].name), &size); if (EVEN(sts)) return sts; } if (strchr(gsdmlfile, '/') == 0) { strcpy(fname, "$pwrp_exe/"); strcat(fname, gsdmlfile); } else strcpy(fname, gsdmlfile); free(gsdmlfile); ctx->gsdml = new pn_gsdml(); sts = ctx->gsdml->read(fname); if (EVEN(sts)) return sts; ctx->gsdml->build(); ctx->gsdml->set_classes(ctx->mc); *ctxp = ctx; return 1; }
int XNav::GetObjectMenu( xmenu_sMenuCall *ip, pwr_tCid classid, xmenu_sMenuItem **Item, pwr_tUInt32 Level, int *nItems, int AddSeparator, pwr_sAttrRef *CurrentObject) { int sts; pwr_tObjid child; pwr_tObjid menu_objid; char menu[80]; pwr_tOName classname; pwr_sAttrRef currentar = pwr_cNAttrRef; pwr_tCid supercid; if ( cdh_ObjidIsNotNull( CurrentObject->Objid)) currentar = *CurrentObject; if ( ip->ItemType == xmenu_eItemType_Object) { // Popup-menu for an object if ( !cdh_tidIsCid( classid)) return XNAV__SUCCESS; // Get the RtXtt common menu-objects strcpy( menu, "pwrs:Class-$Object-RtXtt"); sts = gdh_NameToObjid( menu, &menu_objid); if ( ODD(sts)) { sts = gdh_GetChild( menu_objid, &child); while( ODD(sts)) { sts = getAllMenuItems( ip, Item, child, Level, nItems, 0, ¤tar); if ( EVEN(sts)) return sts; sts = gdh_GetNextSibling( child, &child); } } // Get the RtXtt menu-objects for superclasses // TODO shadow overlayed methods... sts = gdh_GetSuperClass( classid, &supercid, CurrentObject->Objid); while ( ODD(sts)) { sts = gdh_ObjidToName( cdh_ClassIdToObjid( supercid), classname, sizeof(classname), cdh_mName_volumeStrict); if ( EVEN(sts)) return sts; sprintf( menu, "%s-RtXtt", classname); sts = gdh_NameToObjid( menu, &menu_objid); if ( ODD(sts)) { sts = gdh_GetChild( menu_objid, &child); while( ODD(sts)) { sts = getAllMenuItems( ip, Item, child, 0, nItems, 0, ¤tar); if ( EVEN(sts)) return sts; sts = gdh_GetNextSibling( child, &child); } } sts = gdh_GetSuperClass( supercid, &supercid, CurrentObject->Objid); } // Get the RtXtt menu-objects for this class, or for superclasses sts = gdh_ObjidToName( cdh_ClassIdToObjid( classid), classname, sizeof(classname), cdh_mName_volumeStrict); if ( EVEN(sts)) return sts; sprintf( menu, "%s-RtXtt", classname); sts = gdh_NameToObjid( menu, &menu_objid); if ( ODD(sts)) { sts = gdh_GetChild( menu_objid, &child); while( ODD(sts)) { sts = getAllMenuItems( ip, Item, child, 0, nItems, 0, ¤tar); if ( EVEN(sts)) return sts; sts = gdh_GetNextSibling( child, &child); } } } else if ( ip->ItemType == xmenu_eItemType_AttrObject) { // Find attribute object methods... if ( !cdh_tidIsCid( classid)) return XNAV__SUCCESS; // Get the RtXtt common menu-objects strcpy( menu, "pwrs:Class-$Object-RtXttAttrObject"); sts = gdh_NameToObjid( menu, &menu_objid); if ( ODD(sts)) { sts = gdh_GetChild( menu_objid, &child); while( ODD(sts)) { sts = getAllMenuItems( ip, Item, child, 0, nItems, 0, ¤tar); if ( EVEN(sts)) return sts; sts = gdh_GetNextSibling( child, &child); } } // Get the RtXtt menu-objects for this class sts = gdh_ObjidToName( cdh_ClassIdToObjid( classid), classname, sizeof(classname), cdh_mName_volumeStrict); if ( EVEN(sts)) return sts; sprintf( menu, "%s-RtXtt", classname); sts = gdh_NameToObjid( menu, &menu_objid); if ( ODD(sts)) { sts = gdh_GetChild( menu_objid, &child); while( ODD(sts)) { sts = getAllMenuItems( ip, Item, child, 0, nItems, 0, ¤tar); if ( EVEN(sts)) return sts; sts = gdh_GetNextSibling( child, &child); } } } else if ( ip->ItemType == xmenu_eItemType_Attribute) { // Find attribute methods... // Get the RtXttAttribute common menu-objects strcpy( menu, "pwrs:Class-$Object-RtXttAttribute"); sts = gdh_NameToObjid( menu, &menu_objid); if ( ODD(sts)) { sts = gdh_GetChild( menu_objid, &child); while( ODD(sts)) { sts = getAllMenuItems( ip, Item, child, 0, nItems, 0, ¤tar); if ( EVEN(sts)) return sts; sts = gdh_GetNextSibling( child, &child); } } } else if ( ip->ItemType == xmenu_eItemType_Crossref) { // Find attribute methods... // Get the RtXttCrossref common menu-objects strcpy( menu, "pwrs:Class-$Object-RtXttCrossref"); sts = gdh_NameToObjid( menu, &menu_objid); if ( ODD(sts)) { sts = gdh_GetChild( menu_objid, &child); while( ODD(sts)) { sts = getAllMenuItems( ip, Item, child, 0, nItems, 0, ¤tar); if ( EVEN(sts)) return sts; sts = gdh_GetNextSibling( child, &child); } } } return XNAV__SUCCESS; }
/************************************************************************* * * Name: int trace_flow_cb() * * Type int * * Type Parameter IOGF Description * * Description: * Callback from flow. **************************************************************************/ static int trace_flow_cb( FlowCtx *ctx, flow_tEvent event) { WGre *gre; vldh_t_node source, dest; void *vobject; double ll_x, ll_y, ur_x, ur_y, width; int subwindow_nr; int sts; flow_GetCtxUserData( ctx, (void **)&gre); gre->search_rectangle_delete(); if ( event->any.type == flow_eEventType_CreateCon) { if ( flow_GetNodeGroup( event->con_create.source_object) == flow_eNodeGroup_Trace) return 1; flow_GetUserData( event->con_create.source_object, (void **) &source); if ( event->con_create.dest_object) { if ( flow_GetNodeGroup( event->con_create.dest_object) == flow_eNodeGroup_Trace) return 1; flow_GetUserData( event->con_create.dest_object, (void **) &dest); } else dest = 0; (gre->gre_con_created) (gre, event->con_create.x, event->con_create.y, source, event->con_create.source_conpoint, dest, event->con_create.dest_conpoint, 0, &sts); } switch ( event->event) { case flow_eEvent_Init: break; case flow_eEvent_MB2DoubleClick: switch ( event->object.object_type) { case flow_eObjectType_Node: if ( flow_GetNodeGroup( event->object.object) == flow_eNodeGroup_Trace) { flow_DeleteNodeCons( event->object.object); flow_DeleteNode( event->object.object); } break; default: ; } break; case flow_eEvent_MB1PressCtrl: { vldh_t_node vnode; vldh_t_con vcon; double pos_x, pos_y; double *x_arr, *y_arr; int i, num; /* Object moved */ switch ( event->object.object_type) { case flow_eObjectType_Node: if ( flow_GetNodeGroup( event->object.object) == flow_eNodeGroup_Trace) break; flow_GetUserData( event->object.object, (void **) &vnode); flow_GetNodePosition( event->object.object, &pos_x, &pos_y); vnode->ln.x = pos_x; vnode->ln.y = pos_y; vldh_nodemodified( vnode); (gre->gre_node_moved) (gre); break; case flow_eObjectType_Con: if ( flow_GetConGroup( event->object.object) == flow_eConGroup_Trace) break; flow_GetUserData( event->object.object, (void **) &vcon); flow_GetConPosition( event->object.object, &x_arr, &y_arr, &num); for ( i = 0; i < num; i++) { vcon->lc.point[i].x = x_arr[i]; vcon->lc.point[i].y = y_arr[i]; } vcon->lc.point_count = num; vldh_conmodified( vcon); break; default: ; } break; } case flow_eEvent_MB1DoubleClick: /* Open attribute editor */ switch ( event->object.object_type) { case flow_eObjectType_Node: if ( flow_GetNodeGroup( event->object.object) == flow_eNodeGroup_Trace) break; gre->popupmenu_mode = GRE_POPUPMENUMODE_OBJECT; flow_GetUserData( event->object.object, &vobject); (gre->gre_attribute) (gre, (vldh_t_node) vobject); break; default: ; } break; case flow_eEvent_MB1DoubleClickShift: /* Open subwindow */ switch ( event->object.object_type) { case flow_eObjectType_Node: if ( flow_GetNodeGroup( event->object.object) == flow_eNodeGroup_Trace) break; gre->popupmenu_mode = GRE_POPUPMENUMODE_OBJECT; flow_MeasureNode( event->object.object, &ll_x,&ll_y,&ur_x,&ur_y); width = ur_x - ll_x; if ( event->object.x > ( ll_x + width / 2 )) subwindow_nr = 1; else subwindow_nr = 2; flow_GetUserData( event->object.object, &vobject); (gre->gre_subwindow) ( gre, (vldh_t_node)vobject, subwindow_nr); break; default: ; } break; case flow_eEvent_MB3Press: { /* Popup menu */ int x_pix, y_pix; vldh_t_node current_node; flow_tObject *select_list; int select_cnt; if ( event->object.object_type != flow_eObjectType_Node) break; if ( flow_GetNodeGroup( event->object.object) == flow_eNodeGroup_Trace) break; flow_PositionToPixel( gre->flow_ctx, event->object.x, event->object.y, &x_pix, &y_pix); gre->get_popup_position( &x_pix, &y_pix); current_node = 0; /* If there is no selected object, select current object */ if ( gre->popupmenu_mode == GRE_POPUPMENUMODE_OBJECT) { flow_GetSelectList( ctx, &select_list, &select_cnt); if ( !select_cnt) { if ( event->object.object_type == flow_eObjectType_Node) /* Get the current object */ flow_GetUserData( event->object.object, (void **)¤t_node); } } (gre->gre_popupmenu) (gre, x_pix, y_pix, gre->popupmenu_mode, current_node); break; } case flow_eEvent_MB1ClickCtrl: { char help_title[32]; vldh_t_node node; vldh_t_con con; int size, sts; if ( event->object.object_type == flow_eObjectType_Node) { if ( flow_GetNodeGroup( event->object.object) == flow_eNodeGroup_Trace) break; flow_GetUserData( event->object.object, (void **)&node); sts = ldh_ObjidToName( (node->hn.wind)->hw.ldhses, cdh_ClassIdToObjid( node->ln.cid), ldh_eName_Object, help_title, sizeof( help_title), &size); WFoe::error_msg(sts); if ( EVEN(sts)) return 1; (gre->gre_help) ( gre, help_title); } if ( event->object.object_type == flow_eObjectType_Con) { if ( flow_GetConGroup( event->object.object) == flow_eConGroup_Trace) break; flow_GetUserData( event->object.object, (void **)&con); sts = ldh_ObjidToName( (gre->wind)->hw.ldhses, cdh_ClassIdToObjid( con->lc.cid), ldh_eName_Object, help_title, sizeof( help_title), &size); WFoe::error_msg(sts); if ( EVEN(sts)) return 1; (gre->gre_help) ( gre, help_title); } break; } case flow_eEvent_MB1DoubleClickShiftCtrl: { trace_changevalue( gre, event->object.object); break; } default: ; } return 1; }