int ItemTreeNode::open_children( TblNav *tblnav, double x, double y) { double node_x, node_y; brow_GetNodePosition( node, &node_x, &node_y); if ( brow_IsOpen( node) & tblnav_mOpen_Children) { // Attributes is open, close brow_SetNodraw( tblnav->brow->ctx); brow_CloseNode( tblnav->brow->ctx, node); brow_ResetOpen( node, tblnav_mOpen_Children); brow_RemoveAnnotPixmap( node, 1); brow_ResetNodraw( tblnav->brow->ctx); brow_Redraw( tblnav->brow->ctx, node_y); } else { brow_SetNodraw( tblnav->brow->ctx); for ( int i = tblnav->tree[idx].fch; i; i = tblnav->tree[i].fws) { if ( tblnav->tree[i].deleted) continue; if ( tblnav->tree[i].item) new ItemTreeLocal( tblnav, tblnav->tree[i].item, i, node, flow_eDest_IntoLast); else new ItemTreeNode( tblnav, tblnav->tree[i].sname, i, node, flow_eDest_IntoLast); } brow_SetOpen( node, tblnav_mOpen_Children); brow_SetAnnotPixmap( node, 1, tblnav->brow->pixmap_openmap); brow_ResetNodraw( tblnav->brow->ctx); brow_Redraw( tblnav->brow->ctx, node_y); } return 1; }
int ItemMenu::open_children( SubPalette *subpalette, double x, double y) { int action_open; if ( !is_root) { if ( !brow_IsOpen( node)) action_open = 1; else action_open = 0; } if ( action_open || is_root) { // Display childlist double node_x, node_y; Item *item; subpalette_sMenu *menu; if ( !is_root) brow_GetNodePosition( node, &node_x, &node_y); else node_y = 0; brow_SetNodraw( subpalette->brow->ctx); menu = *child_list; while ( menu) { switch ( menu->item_type) { case subpalette_eItemType_Menu: item = (Item *) new ItemMenu( subpalette, menu->title, node, flow_eDest_IntoLast, &menu->child_list, 0); break; case subpalette_eItemType_File: item = (Item *) new ItemFile( subpalette, menu->title, menu->file, menu->pixmap, node, flow_eDest_IntoLast); break; case subpalette_eItemType_LocalSubGraphs: item = (Item *) new ItemLocalSubGraphs( subpalette, menu->title, menu->file, node, flow_eDest_IntoLast); break; default: ; } menu = menu->next; if ( !is_root) { brow_SetOpen( node, subpalette_mOpen_Children); brow_SetAnnotPixmap( node, 0, subpalette->brow->pixmap_openmap); } } brow_ResetNodraw( subpalette->brow->ctx); brow_Redraw( subpalette->brow->ctx, node_y); } else close( subpalette, x, y); return 1; }
int ItemDevice::open_children(PnViewerNav* viewernav) { double node_x, node_y; brow_GetNodePosition(node, &node_x, &node_y); if (brow_IsOpen(node)) { // Close brow_SetNodraw(viewernav->brow->ctx); brow_CloseNode(viewernav->brow->ctx, node); brow_SetAnnotPixmap(node, 0, viewernav->brow->pixmap_map); brow_ResetOpen(node, 1); brow_ResetNodraw(viewernav->brow->ctx); brow_Redraw(viewernav->brow->ctx, node_y); } else { // Create some children brow_SetNodraw(viewernav->brow->ctx); new ItemDeviceAttr(viewernav, "DeviceName", pwr_eType_String, devname, node, flow_eDest_IntoLast); new ItemDeviceAttr(viewernav, "IP Address", pwr_eType_String, ipaddress_str, node, flow_eDest_IntoLast); new ItemDeviceAttr(viewernav, "MAC Address", pwr_eType_String, macaddress_str, node, flow_eDest_IntoLast); new ItemDeviceAttr(viewernav, "Vendor Id", pwr_eType_String, vendorid_str, node, flow_eDest_IntoLast); new ItemDeviceAttr(viewernav, "Device Id", pwr_eType_String, deviceid_str, node, flow_eDest_IntoLast); new ItemDeviceAttr(viewernav, "Family", pwr_eType_String, family, node, flow_eDest_IntoLast); new ItemDeviceAttr(viewernav, "InfoText", pwr_eType_String, infotext, node, flow_eDest_IntoLast); brow_SetOpen(node, 1); brow_SetAnnotPixmap(node, 0, viewernav->brow->pixmap_openmap); brow_ResetNodraw(viewernav->brow->ctx); brow_Redraw(viewernav->brow->ctx, node_y); } return 1; }
int ItemLocal::open_attributes( TblNav *tblnav, double x, double y) { double node_x, node_y; brow_GetNodePosition( node, &node_x, &node_y); if ( brow_IsOpen( node)) { // Close brow_SetNodraw( tblnav->brow->ctx); brow_CloseNode( tblnav->brow->ctx, node); brow_SetAnnotPixmap( node, 0, tblnav->brow->pixmap_leaf); brow_ResetOpen( node, tblnav_mOpen_All); brow_ResetNodraw( tblnav->brow->ctx); brow_Redraw( tblnav->brow->ctx, node_y); } else { char value[256]; char txt[80]; brow_SetNodraw( tblnav->brow->ctx); new ItemLocalAttr( tblnav, "Description", item.description, node, flow_eDest_IntoLast); strcpy( value, ""); cdh_ObjidToString( value, item.oid, 1); new ItemLocalAttr( tblnav, "Oid", value, node, flow_eDest_IntoLast); new ItemLocalAttr( tblnav, "Object", item.oname, node, flow_eDest_IntoLast); time_DtoAscii( &item.storagetime, 0, value, sizeof(value)); new ItemLocalAttr( tblnav, "StorageTime", value, node, flow_eDest_IntoLast); time_AtoAscii( &item.creatime, time_eFormat_DateAndTime, value, sizeof(value)); new ItemLocalAttr( tblnav, "CreationTime", value, node, flow_eDest_IntoLast); time_AtoAscii( &item.modtime, time_eFormat_DateAndTime, value, sizeof(value)); new ItemLocalAttr( tblnav, "ModificationTime", value, node, flow_eDest_IntoLast); sprintf( value, "%f", item.scantime); new ItemLocalAttr( tblnav, "ScanTime", value, node, flow_eDest_IntoLast); strcpy( value, ""); if ( item.options & pwr_mSevOptionsMask_PosixTime) strcat( value, " PosixTime"); if ( item.options & pwr_mSevOptionsMask_HighTimeResolution) strcat( value, " HighTimeResolution"); if ( item.options & pwr_mSevOptionsMask_ReadOptimized) strcat( value, " ReadOptimized"); if ( item.options & pwr_mSevOptionsMask_UseDeadBand) strcat( value, " UseDeadBand"); new ItemLocalAttr( tblnav, "Options", value, node, flow_eDest_IntoLast); sprintf( value, "%f", item.deadband); new ItemLocalAttr( tblnav, "Deadband", value, node, flow_eDest_IntoLast); for ( int i = 0; i < (int)item.objectattrlist.size(); i++) { sprintf( txt, "Attr[%d].Name", i); new ItemLocalAttr( tblnav, txt, item.objectattrlist[i].aname, node, flow_eDest_IntoLast); switch ( item.objectattrlist[i].type) { case pwr_eType_Int64: strcpy( value, "Int64"); break; case pwr_eType_Int32: strcpy( value, "Int32"); break; case pwr_eType_Int16: strcpy( value, "Int16"); break; case pwr_eType_Int8: strcpy( value, "Int8"); break; case pwr_eType_UInt64: strcpy( value, "UInt64"); break; case pwr_eType_UInt32: strcpy( value, "UInt32"); break; case pwr_eType_UInt16: strcpy( value, "UInt16"); break; case pwr_eType_UInt8: strcpy( value, "UInt8"); break; case pwr_eType_Boolean: strcpy( value, "Boolean"); break; case pwr_eType_Char: strcpy( value, "Char"); break; case pwr_eType_Float32: strcpy( value, "Float32"); break; case pwr_eType_Float64: strcpy( value, "Float64"); break; case pwr_eType_String: strcpy( value, "String"); break; case pwr_eType_Time: strcpy( value, "Time"); break; case pwr_eType_DeltaTime: strcpy( value, "DeltaTime"); break; default: strcpy( value, "Unknown"); } sprintf( txt, "Attr[%d].DataType", i); new ItemLocalAttr( tblnav, txt, value, node, flow_eDest_IntoLast); sprintf( txt, "Attr[%d].DataSize", i); sprintf( value, "%d", item.objectattrlist[i].size); new ItemLocalAttr( tblnav, txt, value, node, flow_eDest_IntoLast); sprintf( txt, "Attr[%d].Unit", i); new ItemLocalAttr( tblnav, txt, item.objectattrlist[i].unit, node, flow_eDest_IntoLast); } brow_SetOpen( node, tblnav_mOpen_Attributes); brow_ResetNodraw( tblnav->brow->ctx); brow_Redraw( tblnav->brow->ctx, node_y); } return 1; }
int ItemLocalSubGraphs::open_children( SubPalette *subpalette, double x, double y) { double node_x, node_y; int child_exist; brow_GetNodePosition( node, &node_x, &node_y); if ( brow_IsOpen( node)) { // Close brow_SetNodraw( subpalette->brow->ctx); brow_CloseNode( subpalette->brow->ctx, node); if ( brow_IsOpen( node) & subpalette_mOpen_Attributes) brow_RemoveAnnotPixmap( node, 1); if ( brow_IsOpen( node) & subpalette_mOpen_Children) brow_SetAnnotPixmap( node, 0, subpalette->brow->pixmap_map); brow_ResetOpen( node, subpalette_mOpen_All); brow_ResetNodraw( subpalette->brow->ctx); brow_Redraw( subpalette->brow->ctx, node_y); } else { int sts; char found_file[120]; char fname[120]; char dev[80], dir[80], file[80], type[80]; int version; char text[80]; char *s; int idx; char file_str[5][80]; int nr; int i; vector<LocalFile> fvect; // Create some children brow_SetNodraw( subpalette->brow->ctx); child_exist = 0; nr = dcli_parse( filename, ",", "", (char *)file_str, sizeof( file_str) / sizeof( file_str[0]), sizeof( file_str[0]), 0); for ( i = 0; i < nr; i++) { dcli_translate_filename( fname, file_str[i]); sts = dcli_search_file( fname, found_file, DCLI_DIR_SEARCH_INIT); if ( ODD(sts)) { LocalFile f; strcpy( f.name, found_file); fvect.push_back( f); } while ( ODD(sts)) { sts = dcli_search_file( fname, found_file, DCLI_DIR_SEARCH_NEXT); if ( ODD(sts)) { LocalFile f; strcpy( f.name, found_file); fvect.push_back( f); } } dcli_search_file( fname, found_file, DCLI_DIR_SEARCH_END); } subpalette_sort( fvect); for ( i = 0; i < (int) fvect.size(); i++) { dcli_parse_filename( fvect[i].name, dev, dir, file, type, &version); cdh_ToLower( text, file); text[0] = toupper( text[0]); // Skip next pages in animations if ( !((s = strstr( text, "__p")) && sscanf( s+3, "%d", &idx))) { new ItemFile( subpalette, text, fvect[i].name, 0, node, flow_eDest_IntoLast); child_exist = 1; } } if ( child_exist) { brow_SetOpen( node, subpalette_mOpen_Children); brow_SetAnnotPixmap( node, 0, subpalette->brow->pixmap_openmap); } brow_ResetNodraw( subpalette->brow->ctx); if ( child_exist) brow_Redraw( subpalette->brow->ctx, node_y); } return 1; }