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; }
void CLogNav::draw() { ItemMsgBase* item; brow_tNode dest = 0; brow_SetNodraw(brow->ctx); brow_DeleteAll(brow->ctx); for (int i = 0; i < (int)msg_list.size(); i++) { if (str_StartsWith(msg_list[i].text, "Setting log file to:")) { item = new ItemMsgRestart( this, "Restart", msg_list[i].time, dest, flow_eDest_After); dest = item->node; } bool insert = false; switch (msg_list[i].severity) { case errh_eSeverity_Success: if (filter.show_success) insert = true; break; case errh_eSeverity_Info: if (filter.show_info) insert = true; break; case errh_eSeverity_Warning: if (filter.show_warning) insert = true; break; case errh_eSeverity_Error: if (filter.show_error) insert = true; break; case errh_eSeverity_Fatal: if (filter.show_fatal) insert = true; break; case errh_eSeverity_Null: if (filter.show_text) insert = true; break; } if (insert && !streq(filter.str, "")) { if (strstr(msg_list[i].logger, filter.str) == 0 && strstr(msg_list[i].text, filter.str) == 0) insert = false; } if (insert) { item = new ItemMsg(this, "Msg", msg_list[i].severity, msg_list[i].logger, msg_list[i].pid, msg_list[i].time, msg_list[i].text, dest, flow_eDest_After); dest = item->node; } } brow_ResetNodraw(brow->ctx); brow_Redraw(brow->ctx, 0); }
int XNav::help_index( navh_eHelpFile file_type, char *file_name, int pop) { int sts; brow_tObject *object_list; int object_cnt; NavHelp *navhelp = new NavHelp( (void *)this, "$pwr_exe/xtt_help.dat", "$pwrp_exe/xtt_help.dat"); navhelp->insert_cb = xnav_help_insert_cb; if (pop) brow_pop(); brow_SetNodraw( brow->ctx); new ItemHelpHeader( brow, "help_index", "Index", NULL, flow_eDest_IntoLast); new ItemHelp( brow, "help_index", "", "", "", "", "", NULL, navh_eHelpFile_Base, 0, NULL, flow_eDest_IntoLast); sts = navhelp->help_index( file_type, file_name); brow_GetObjectList( brow->ctx, &object_list, &object_cnt); flow_qsort( &object_list[2], object_cnt - 2, sizeof(object_list[0]), help_cmp_items); brow_ResetNodraw( brow->ctx); brow_Redraw( brow->ctx, 0); return sts; }
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 ItemTreeNode::close( TblNav *tblnav, double x, double y) { double node_x, node_y; if ( brow_IsOpen( node) & tblnav_mOpen_Children) { // Children is open, close brow_GetNodePosition( node, &node_x, &node_y); brow_SetNodraw( tblnav->brow->ctx); brow_CloseNode( tblnav->brow->ctx, node); brow_ResetOpen( node, tblnav_mOpen_All); brow_ResetNodraw( tblnav->brow->ctx); brow_Redraw( tblnav->brow->ctx, node_y); } return 1; }
void CoLogWNav::show( char categories[][20], char *item) { brow_SetNodraw( brow->ctx); CoLog::dget( categories, item, item_cb, this); brow_ResetNodraw( brow->ctx); brow_Redraw( brow->ctx, 0); // View last items brow_tObject last; int sts; sts = brow_GetLast( brow->ctx, &last); if ( ODD(sts)) brow_CenterObject( brow->ctx, last, 0.9); }
void ItemDevice::close(PnViewerNav* viewernav) { double node_x, node_y; if (brow_IsOpen(node)) { // Close brow_GetNodePosition(node, &node_x, &node_y); 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); } }
void PnViewerNav::set(std::vector<PnDevice>& dev_vect) { brow_SetNodraw(brow->ctx); brow_DeleteAll(brow->ctx); for (unsigned int i = 0; i < dev_vect.size(); i++) { if (!dev_vect[i].hide) new ItemDevice(this, "", dev_vect[i].ipaddress, dev_vect[i].macaddress, dev_vect[i].devname, dev_vect[i].vendorid, dev_vect[i].deviceid, 0, flow_eDest_IntoLast); } brow_ResetNodraw(brow->ctx); brow_Redraw(brow->ctx, 0); }
int XNav::help( char *help_key, char *help_bookmark, navh_eHelpFile file_type, char *file_name, int pop) { int sts; brow_tNode bookmark_node; brow_tNode prev, first; NavHelp *navhelp = new NavHelp( (void *)this, "$pwr_exe/xtt_help.dat", "$pwrp_exe/xtt_help.dat"); navhelp->insert_cb = xnav_help_insert_cb; if ( pop) init_help = 1; else { init_help = 2; brow_SetNodraw( brow->ctx); } sts = navhelp->help( help_key, help_bookmark, file_type, file_name, &bookmark_node, false); if ( EVEN(sts)) { if ( !pop || (pop && init_help != 1)) { brow_push(); brow_ResetNodraw( brow->ctx); } return sts; } brow_ResetNodraw( brow->ctx); brow_Redraw( brow->ctx, 0); if ( bookmark_node) { brow_CenterObject( brow->ctx, bookmark_node, 0.0); sts = brow_GetPrevious( brow->ctx, bookmark_node, &prev); if ( ODD(sts)) { brow_SelectClear( brow->ctx); brow_SetInverse( prev, 1); brow_SelectInsert( brow->ctx, prev); } } else { sts = brow_GetFirst( brow->ctx, &first); if ( ODD(sts)) brow_CenterObject( brow->ctx, first, 0.0); } delete navhelp; return XNAV__SUCCESS; }
int ItemLocalSubGraphs::close( SubPalette *subpalette, double x, double y) { double node_x, node_y; if ( brow_IsOpen( node)) { // Close brow_GetNodePosition( node, &node_x, &node_y); brow_SetNodraw( subpalette->brow->ctx); brow_CloseNode( subpalette->brow->ctx, node); 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); } return 1; }
int ItemLocal::close( 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); } return 1; }
int SubGraphs::object_attr() { int i, j; grow_tNodeClass *list; grow_tNodeClass *list_p; int list_cnt; char name[80]; grow_GetNodeClassList( (grow_tCtx) grow_ctx, &list, &list_cnt); brow_SetNodraw( brow->ctx); list_p = list; for ( i = 0; i < list_cnt; i++) { grow_sAttrInfo *grow_info, *grow_info_p; int grow_info_cnt; int *extern_p; grow_GetObjectAttrInfo( (grow_tObject)*list_p, NULL, &grow_info, &grow_info_cnt); grow_info_p = grow_info; extern_p = 0; for ( j = 0; j < grow_info_cnt; j++) { if ( strcmp( "Extern", grow_info_p->name) == 0) { extern_p = (int *)grow_info_p->value_p; break; } grow_info_p++; } grow_FreeObjectAttrInfo( grow_info); grow_GetNodeClassName( *list_p, name); new ItemSubGraph( this, name, extern_p, *list_p, NULL, flow_eDest_IntoLast); list_p++; } brow_ResetNodraw( brow->ctx); brow_Redraw( brow->ctx, 0); return SUBGRAPHS__SUCCESS; }
int ItemMenu::close( SubPalette *subpalette, double x, double y) { double node_x, node_y; if ( brow_IsOpen( node)) { // Close brow_GetNodePosition( node, &node_x, &node_y); 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); } return 1; }
int SubPalette::object_attr() { char setup_filename[120]; dcli_translate_filename( setup_filename, "pwr_exe:pwr_ge_setup.dat"); brow_SetNodraw( brow->ctx); menu_tree_build( setup_filename); // Create the root item root_item = new ItemMenu( this, "Root", NULL, flow_eDest_After, &menu_tree, 1); // Open the root item ((ItemMenu *)root_item)->open_children( this, 0, 0); brow_ResetNodraw( brow->ctx); brow_Redraw( brow->ctx, 0); return SUBPALETTE__SUCCESS; }
int TblNav::create_items() { int i; brow_SetNodraw( brow->ctx); if ( list_layout) { for ( i = 0; i < (int)sevhistobjectlist.size(); i++) { new ItemLocal( this, &sevhistobjectlist[i], NULL, flow_eDest_IntoLast); } } else { for ( int idx = 1; idx; idx = tree[idx].fws) { if ( tree[idx].item) new ItemTreeLocal( this, tree[idx].item, idx, NULL, flow_eDest_IntoLast); else new ItemTreeNode( this, tree[idx].sname, idx, NULL, flow_eDest_IntoLast); } } brow_ResetNodraw( brow->ctx); brow_Redraw( brow->ctx, 0); return TBLNAV__SUCCESS; }
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; }
void SubPalette::select_by_name( char *name) { // Refresh brow_SetNodraw( brow->ctx); brow_DeleteAll( brow->ctx); ((ItemMenu *)root_item)->open_children( this, 0, 0); char *s = name; char *t = name; char itemname[200]; int level = 0; brow_tObject *nodelist; brow_tObject current; brow_tObject child; int nodecnt; Item *item; int sts; for (;;) { if ( !t) break; level ++; strcpy( itemname, t); if ( (s = strchr( itemname, '-'))) { *s = 0; t += (s - itemname + 1); } else t = 0; if ( level == 1) { brow_GetObjectList( brow->ctx, &nodelist, &nodecnt); for ( int i = 0; i < nodecnt; i++) { brow_GetUserData( nodelist[i], (void **)&item); if ( strcmp( itemname, item->name) == 0) { current = nodelist[i]; } } } else { current = 0; item->open_children( this, 0, 0); for ( sts = brow_GetChild( brow->ctx, item->node, &child); ODD( sts); sts = brow_GetNextSibling( brow->ctx, child, &child)) { brow_GetUserData( child, (void **)&item); if ( cdh_NoCaseStrcmp( itemname, item->name) == 0) { current = child; break; } } if ( !current) break; } } brow_ResetNodraw( brow->ctx); brow_Redraw( brow->ctx, 0); if ( current) { brow_SetInverse( current, 1); brow_SelectInsert( brow->ctx, current); if ( !brow_IsVisible( brow->ctx, current, flow_eVisible_Full)) brow_CenterObject( brow->ctx, current, 0.25); } }
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; }
void MsgList::reset_nodraw() { brow_ResetNodraw( brow->ctx); brow_Redraw( brow->ctx, 0); }
void CLogNav::reset_nodraw() { brow_ResetNodraw(brow->ctx); brow_Redraw(brow->ctx, 0); }
void XAttNav::redraw() { brow_Redraw( brow->ctx, 0); }