static GtkCTreeNode *maketree_nodes(GtkCTreeNode *subtree, struct tree *t2, GtkCTreeNode *sibling, int mode) { char *tmp, *tmp2, *tmp3; gchar *text [1]; GdkDrawable *pxm, *msk; if(t2->t_which >= 0) { if(GLOBALS->facs[t2->t_which]->vec_root) { if(GLOBALS->autocoalesce) { if(GLOBALS->facs[t2->t_which]->vec_root!=GLOBALS->facs[t2->t_which]) { return(NULL); } tmp2=makename_chain(GLOBALS->facs[t2->t_which]); tmp3=leastsig_hiername(tmp2); tmp=wave_alloca(strlen(tmp3)+4); strcpy(tmp, "[] "); strcpy(tmp+3, tmp3); free_2(tmp2); } else { tmp=wave_alloca(strlen(t2->name)+4); strcpy(tmp, "[] "); strcpy(tmp+3, t2->name); } } else { tmp=t2->name; } } else { if(t2->t_which == WAVE_T_WHICH_UNDEFINED_COMPNAME) { tmp=t2->name; } else { int thidx = -t2->t_which + WAVE_T_WHICH_COMPNAME_START; if((thidx >= 0) && (thidx < GLOBALS->comp_name_serial)) { char *sc = GLOBALS->comp_name_idx[thidx]; int tlen = strlen(t2->name) + 2 + 1 + strlen(sc) + 1 + 1; tmp = wave_alloca(tlen); if(!GLOBALS->is_vhdl_component_format) { sprintf(tmp, "%s (%s)", t2->name, sc); } else { sprintf(tmp, "%s : %s", t2->name, sc); } } else { tmp=t2->name; /* should never get a value out of range here! */ } } } text[0]=tmp; switch(mode) { case MAKETREE_FLATTEN: if(t2->child) { sibling = gtk_ctree_insert_node (GLOBALS->ctree_main, subtree, sibling, text, 3, NULL, NULL, NULL, NULL, FALSE, FALSE); gtk_ctree_node_set_row_data(GLOBALS->ctree_main, sibling, t2); maketree(sibling, t2->child); } else { sibling = gtk_ctree_insert_node (GLOBALS->ctree_main, subtree, sibling, text, 3, NULL, NULL, NULL, NULL, TRUE, FALSE); gtk_ctree_node_set_row_data(GLOBALS->ctree_main, sibling, t2); } break; default: switch(t2->kind) { case TREE_VCD_ST_MODULE: pxm = GLOBALS->hiericon_module_pixmap; msk = GLOBALS->hiericon_module_mask; break; case TREE_VCD_ST_TASK: pxm = GLOBALS->hiericon_task_pixmap; msk = GLOBALS->hiericon_task_mask; break; case TREE_VCD_ST_FUNCTION: pxm = GLOBALS->hiericon_function_pixmap; msk = GLOBALS->hiericon_function_mask; break; case TREE_VCD_ST_BEGIN: pxm = GLOBALS->hiericon_begin_pixmap; msk = GLOBALS->hiericon_begin_mask; break; case TREE_VCD_ST_FORK: pxm = GLOBALS->hiericon_fork_pixmap; msk = GLOBALS->hiericon_fork_mask; break; case TREE_VCD_ST_GENERATE: pxm = GLOBALS->hiericon_generatefor_pixmap; msk = GLOBALS->hiericon_generatefor_mask; break; /* same as TREE_VHDL_ST_GENFOR */ case TREE_VCD_ST_STRUCT: pxm = GLOBALS->hiericon_block_pixmap; msk = GLOBALS->hiericon_block_mask; break; /* same as TREE_VHDL_ST_BLOCK */ case TREE_VCD_ST_UNION: pxm = GLOBALS->hiericon_instance_pixmap; msk = GLOBALS->hiericon_instance_mask; break; /* same as TREE_VHDL_ST_INSTANCE */ case TREE_VCD_ST_CLASS: pxm = GLOBALS->hiericon_class_pixmap; msk = GLOBALS->hiericon_class_mask; break; case TREE_VCD_ST_INTERFACE: pxm = GLOBALS->hiericon_interface_pixmap; msk = GLOBALS->hiericon_interface_mask; break; case TREE_VCD_ST_PACKAGE: pxm = GLOBALS->hiericon_svpackage_pixmap; msk = GLOBALS->hiericon_svpackage_mask; break; case TREE_VCD_ST_PROGRAM: pxm = GLOBALS->hiericon_program_pixmap; msk = GLOBALS->hiericon_program_mask; break; case TREE_VHDL_ST_DESIGN: pxm = GLOBALS->hiericon_design_pixmap; msk = GLOBALS->hiericon_design_mask; break; case TREE_VHDL_ST_BLOCK: pxm = GLOBALS->hiericon_block_pixmap; msk = GLOBALS->hiericon_block_mask; break; case TREE_VHDL_ST_GENIF: pxm = GLOBALS->hiericon_generateif_pixmap; msk = GLOBALS->hiericon_generateif_mask; break; case TREE_VHDL_ST_GENFOR: pxm = GLOBALS->hiericon_generatefor_pixmap; msk = GLOBALS->hiericon_generatefor_mask; break; case TREE_VHDL_ST_INSTANCE: pxm = GLOBALS->hiericon_instance_pixmap; msk = GLOBALS->hiericon_instance_mask; break; case TREE_VHDL_ST_PACKAGE: pxm = GLOBALS->hiericon_package_pixmap; msk = GLOBALS->hiericon_package_mask; break; case TREE_VHDL_ST_SIGNAL: pxm = GLOBALS->hiericon_signal_pixmap; msk = GLOBALS->hiericon_signal_mask; break; case TREE_VHDL_ST_PORTIN: pxm = GLOBALS->hiericon_portin_pixmap; msk = GLOBALS->hiericon_portin_mask; break; case TREE_VHDL_ST_PORTOUT: pxm = GLOBALS->hiericon_portout_pixmap; msk = GLOBALS->hiericon_portout_mask; break; case TREE_VHDL_ST_PORTINOUT: pxm = GLOBALS->hiericon_portinout_pixmap; msk = GLOBALS->hiericon_portinout_mask; break; case TREE_VHDL_ST_BUFFER: pxm = GLOBALS->hiericon_buffer_pixmap; msk = GLOBALS->hiericon_buffer_mask; break; case TREE_VHDL_ST_LINKAGE: pxm = GLOBALS->hiericon_linkage_pixmap; msk = GLOBALS->hiericon_linkage_mask; break; case TREE_VHDL_ST_ARCHITECTURE: pxm = GLOBALS->hiericon_module_pixmap; msk = GLOBALS->hiericon_module_mask; break; /* same as TREE_VCD_ST_MODULE */ case TREE_VHDL_ST_FUNCTION: pxm = GLOBALS->hiericon_function_pixmap; msk = GLOBALS->hiericon_function_mask; break; /* same as TREE_VCD_ST_FUNCTION */ case TREE_VHDL_ST_PROCESS: pxm = GLOBALS->hiericon_task_pixmap; msk = GLOBALS->hiericon_task_mask; break; /* same as TREE_VCD_ST_TASK */ case TREE_VHDL_ST_PROCEDURE: pxm = GLOBALS->hiericon_class_pixmap; msk = GLOBALS->hiericon_class_mask; break; /* same as TREE_VCD_ST_CLASS */ case TREE_VHDL_ST_RECORD: pxm = GLOBALS->hiericon_record_pixmap; msk = GLOBALS->hiericon_record_mask; break; case TREE_VHDL_ST_GENERATE: pxm = GLOBALS->hiericon_generate_pixmap; msk = GLOBALS->hiericon_generate_mask; break; default: pxm = msk = NULL; break; } sibling = gtk_ctree_insert_node (GLOBALS->ctree_main, subtree, sibling, text, 3, pxm, msk, pxm, msk, (mode==MAKETREE_LEAF), FALSE); gtk_ctree_node_set_row_data(GLOBALS->ctree_main, sibling, t2); break; } return(sibling); }
static void enter_callback(GtkWidget *widget, GtkWidget *do_warning) { GtkCList *cl; gchar *entry_text; char *entry_suffixed; int len; int i, j, k, row; int pixlen, maxpixlen; char *s, *tmp2; gfloat interval; if(is_searching_running) return; is_searching_running = ~0; gtk_grab_add(widget); pixlen=0; maxpixlen=0; entry_text = gtk_entry_get_text(GTK_ENTRY(entry)); DEBUG(printf("Entry contents: %s\n", entry_text)); /* if(!(len=strlen(entry_text))) searchbox_text=NULL; */ if(!(len=strlen(entry_text))) searchbox_text=&default_null_searchbox_text; else strcpy((searchbox_text=(char *)malloc_2(len+1)),entry_text); num_rows=0; gtk_clist_freeze(cl=GTK_CLIST(clist)); gtk_clist_clear(cl); entry_suffixed=wave_alloca(strlen(entry_text)+strlen(regex_type[regex_which])+1+((regex_which<2)?2:0)); *entry_suffixed=0x00; if(regex_which<2) strcpy(entry_suffixed, "\\<"); /* match on word boundary */ strcat(entry_suffixed,entry_text); strcat(entry_suffixed,regex_type[regex_which]); wave_regex_compile(entry_suffixed); for(i=0;i<numfacs;i++) { facs[i]->selected=0; } GTK_ADJUSTMENT(pdata->adj)->upper = (gfloat)((numfacs>1)?numfacs-1:1); pdata->oldvalue = -1.0; interval = (gfloat)(numfacs/100.0); for(i=0;i<numfacs;i++) { pdata->value = i; if(((int)(pdata->value/interval))!=((int)(pdata->oldvalue/interval))) { gtk_progress_set_value (GTK_PROGRESS (pdata->pbar), i); while (gtk_events_pending()) gtk_main_iteration(); } pdata->oldvalue = i; if(wave_regex_match(facs[i]->name)) { if(!facs[i]->vec_root) { row=gtk_clist_append(cl,(gchar **)&(facs[i]->name)); pixlen=gdk_string_measure(signalfont,(gchar *)(facs[i]->name)); } else { if(autocoalesce) { if(facs[i]->vec_root!=facs[i]) continue; tmp2=makename_chain(facs[i]); s=(char *)malloc_2(strlen(tmp2)+4); strcpy(s,"[] "); strcpy(s+3, tmp2); free_2(tmp2); } else { s=(char *)malloc_2(strlen(facs[i]->name)+4); strcpy(s,"[] "); strcpy(s+3, facs[i]->name); } row=gtk_clist_append(cl,(gchar **)&s); pixlen=gdk_string_measure(signalfont,(gchar *)s); free_2(s); } maxpixlen=(pixlen>maxpixlen)?pixlen:maxpixlen; gtk_clist_set_row_data(cl, row,facs[i]); num_rows++; if(num_rows==WAVE_MAX_CLIST_LENGTH) break; } } gtk_clist_set_column_width(GTK_CLIST(clist),0,maxpixlen?maxpixlen:1); gtk_clist_thaw(cl); gtk_progress_set_value (GTK_PROGRESS (pdata->pbar), 0.0); pdata->oldvalue = -1.0; gtk_grab_remove(widget); is_searching_running=0; if(do_warning) if(num_rows>=WAVE_MAX_CLIST_LENGTH) { char buf[256]; sprintf(buf, "Limiting results to first %d entries.", num_rows); simplereqbox("Regex Search Warning",300,buf,"OK", NULL, NULL); } }