示例#1
0
static void regen_display(void)
{
GLOBALS->signalwindow_width_dirty=1;
MaxSignalLength();
signalarea_configure_event(GLOBALS->signalarea, NULL);
wavearea_configure_event(GLOBALS->wavearea, NULL);
}
示例#2
0
static void ok_callback(GtkWidget *widget, GtkWidget *nothing)
{
(void)widget;
(void)nothing;

if(GLOBALS->dirty_markerbox_c_1)
	{
	int i;
	for(i=0;i<WAVE_NUM_NAMED_MARKERS;i++)
		{
		GLOBALS->named_markers[i]=GLOBALS->shadow_markers_markerbox_c_1[i];
		if(GLOBALS->marker_names[i]) free_2(GLOBALS->marker_names[i]);
		GLOBALS->marker_names[i] = GLOBALS->shadow_marker_names[i];
		GLOBALS->shadow_marker_names[i] = NULL;
		}
        MaxSignalLength();
        signalarea_configure_event(GLOBALS->signalarea, NULL);
        wavearea_configure_event(GLOBALS->wavearea, NULL);
	}

  wave_gtk_grab_remove(GLOBALS->window_markerbox_c_4);
  gtk_widget_destroy(GLOBALS->window_markerbox_c_4);
  GLOBALS->window_markerbox_c_4 = NULL;

  GLOBALS->cleanup_markerbox_c_4();
}
示例#3
0
static void
bundle_cleanup(GtkWidget *widget, gpointer data)
{   
if(entrybox_text_local)
	{
	char *efix;

        efix=entrybox_text_local;
        while(*efix)
                {
                if(*efix==' ')
                        {
                        *efix='_';
                        }
                efix++;
                }

	DEBUG(printf("Bundle name is: %s\n",entrybox_text_local));
	add_vector_selected(entrybox_text_local, selected_rows, bundle_direction);
	free_2(entrybox_text_local);
	}

MaxSignalLength();
signalarea_configure_event(signalarea, NULL);
wavearea_configure_event(wavearea, NULL);
}
示例#4
0
static void ok_callback(GtkWidget *widget, GtkWidget *nothing)
{
int i;

if(!selectedtree) return;

for(i=fetchlow(selectedtree)->which;i<=fetchhigh(selectedtree)->which;i++)
        {
        struct symbol *s;  
        s=facs[i];
	if(s->vec_root)
		{
		s->vec_root->selected=autocoalesce;
		}
        }

for(i=fetchlow(selectedtree)->which;i<=fetchhigh(selectedtree)->which;i++)
        {
	int len;
        struct symbol *s, *t;  
        s=facs[i];
	t=s->vec_root;
	if((t)&&(autocoalesce))
		{
		if(t->selected)
			{
			t->selected=0;
			len=0;
			while(t)
				{
				len++;
				t=t->vec_chain;
				}
			if(len) add_vector_chain(s->vec_root, len);
			}
		}
		else
		{
	        AddNode(s->n, NULL);  
		}
        }

MaxSignalLength();
signalarea_configure_event(signalarea, NULL);
wavearea_configure_event(wavearea, NULL);
}
示例#5
0
static gint button_release_event(GtkWidget *widget, GdkEventButton *event)
{
int which;

if(event->button==1)
	{
	if(dnd_state==0) cachedwhich=-1;
	gdk_pointer_ungrab(event->time);
	DEBUG(printf("Button 1 released\n"));
	}

/********************* button 3 *********************/

if((event->button==3)&&(signalpixmap))
	{
	cachedwhich=-1;
	gdk_pointer_ungrab(event->time);
	DEBUG(printf("Button 3 released\n"));

	if(dnd_state==1)
		{
		if(cachedtrace)
			{
			cachedtrace->flags|=TR_HIGHLIGHT;
			}

		which=(int)(event->y);
		which=(which/fontheight)-1;
	
		if( ((which<0) && (topmost_trace==traces.first) && PrependBuffer()) || (PasteBuffer()) ) /* short circuit on special which<0 case */
	       		{
			status_text("Drop completed.\n");

        		MaxSignalLength();
        		signalarea_configure_event(signalarea, NULL);
        		wavearea_configure_event(wavearea, NULL);
        		}
		dnd_state=0;
		}
	}

/********************* button 3 *********************/

return(TRUE);
}
示例#6
0
static void
bundle_cleanup(GtkWidget *widget, gpointer data)
{ 
if(entrybox_text_local) 
        {
        char *efix;
 
	if(!strlen(entrybox_text_local))
		{
	        DEBUG(printf("Bundle name is not specified--recursing into hierarchy.\n"));
		fetchvex(selectedtree, bundle_direction);
		}
		else
		{
	        efix=entrybox_text_local;
	        while(*efix)
	                {
	                if(*efix==' ')
	                        {
	                        *efix='_';
	                        }
	                efix++;
	                }
	 
	        DEBUG(printf("Bundle name is: %s\n",entrybox_text_local));
	        add_vector_range(entrybox_text_local, 
				fetchlow(selectedtree)->which,
				fetchhigh(selectedtree)->which, 
				bundle_direction);
		}
        free_2(entrybox_text_local);
        }
	else
	{
        DEBUG(printf("Bundle name is not specified--recursing into hierarchy.\n"));
	fetchvex(selectedtree, bundle_direction);
	}

MaxSignalLength();
signalarea_configure_event(signalarea, NULL);
wavearea_configure_event(wavearea, NULL);
}
示例#7
0
static void replace_callback(GtkWidget *widget, GtkWidget *nothing)
{
Traces tcache;
int i;
Trptr tfirst=NULL, tlast=NULL;

if(!selectedtree) return;

memcpy(&tcache,&traces,sizeof(Traces));
traces.total=0;
traces.first=traces.last=NULL;

for(i=fetchlow(selectedtree)->which;i<=fetchhigh(selectedtree)->which;i++)
        {
        struct symbol *s;  
        s=facs[i];
	if(s->vec_root)
		{
		s->vec_root->selected=autocoalesce;
		}
        }

for(i=fetchlow(selectedtree)->which;i<=fetchhigh(selectedtree)->which;i++)
        {
	int len;
        struct symbol *s, *t;  
        s=facs[i];
	t=s->vec_root;
	if((t)&&(autocoalesce))
		{
		if(t->selected)
			{
			t->selected=0;
			len=0;
			while(t)
				{
				len++;
				t=t->vec_chain;
				}
			if(len) add_vector_chain(s->vec_root, len);
			}
		}
		else
		{
	        AddNode(s->n, NULL);  
		}
        }

tfirst=traces.first; tlast=traces.last;	/* cache for highlighting */

traces.buffercount=traces.total;
traces.buffer=traces.first;
traces.bufferlast=traces.last;
traces.first=tcache.first;
traces.last=tcache.last;
traces.total=tcache.total;

PasteBuffer();

traces.buffercount=tcache.buffercount;
traces.buffer=tcache.buffer;
traces.bufferlast=tcache.bufferlast;

CutBuffer();

while(tfirst)
	{
	tfirst->flags |= TR_HIGHLIGHT;
	if(tfirst==tlast) break;
	tfirst=tfirst->next;
	}

MaxSignalLength();
signalarea_configure_event(signalarea, NULL);
wavearea_configure_event(wavearea, NULL);
}
示例#8
0
/*
 * strace backward or forward..this was cut and
 * pasted from strace.c and special cased to handle
 * just a single trace.  this might be relaxed later.
 */
static void edge_search_2(int direction, int is_last_iteration)
{
struct strace s_tmp;
struct strace *s_head, *s;
TimeType basetime, maxbase, sttim, fintim;
Trptr t = find_first_highlighted_trace();
int totaltraces;
#ifdef DEBUG_PRINTF
int passcount;
#endif
int whichpass;
TimeType middle=0, width;

if(!t) return;
memset(s_head = &s_tmp, 0, sizeof(struct strace));
s_head->trace = t;
s_head->value = ST_ANY;
s = s_head;

while(t)
	{
	t = find_next_highlighted_trace(t);
	if(t)
		{
		s->next = wave_alloca(sizeof(struct strace));
		memset(s = s->next, 0, sizeof(struct strace));
		s->trace = t;
		s->value = ST_ANY;
		}
	}

if(direction==STRACE_BACKWARD) /* backwards */
{
if(GLOBALS->tims.marker<0)
	{
	basetime=MAX_HISTENT_TIME;
	}
	else
	{
	basetime=GLOBALS->tims.marker;
	}
}
else /* go forwards */
{
if(GLOBALS->tims.marker<0)
	{
	basetime=GLOBALS->tims.first;
	}
	else
	{
	basetime=GLOBALS->tims.marker;
	}
}

sttim=GLOBALS->tims.first;
fintim=GLOBALS->tims.last;

for(whichpass=0;;whichpass++)
{

if(direction==STRACE_BACKWARD) /* backwards */
{
maxbase=-1;
s=s_head;
while(s)
	{
	t=s->trace;
	GLOBALS->shift_timebase=t->shift;
	if(!(t->vector))
		{
		hptr h;
		hptr *hp;
		UTimeType utt;
		TimeType  tt;

		/* h= */ bsearch_node(t->n.nd, basetime - t->shift); /* scan-build */
		hp=GLOBALS->max_compare_index;
		if((hp==&(t->n.nd->harray[1]))||(hp==&(t->n.nd->harray[0]))) return;
		if(basetime == ((*hp)->time+GLOBALS->shift_timebase)) hp--;
		h=*hp;
		s->his.h=h;
		utt=strace_adjust(h->time,GLOBALS->shift_timebase); tt=utt;
		if(tt > maxbase) maxbase=tt;
		}
		else
		{
		vptr v;
		vptr *vp;
		UTimeType utt;
		TimeType  tt;

		/* v= */ bsearch_vector(t->n.vec, basetime - t->shift); /* scan-build */
		vp=GLOBALS->vmax_compare_index;
		if((vp==&(t->n.vec->vectors[1]))||(vp==&(t->n.vec->vectors[0]))) return;
		if(basetime == ((*vp)->time+GLOBALS->shift_timebase)) vp--;
		v=*vp;
		s->his.v=v;
		utt=strace_adjust(v->time,GLOBALS->shift_timebase); tt=utt;
		if(tt > maxbase) maxbase=tt;
		}

	s=s->next;
	}
}
else /* go forward */
{
maxbase=MAX_HISTENT_TIME;
s=s_head;
while(s)
	{
	t=s->trace;
	GLOBALS->shift_timebase=t->shift;
	if(!(t->vector))
		{
		hptr h;
		UTimeType utt;
		TimeType  tt;

		h=bsearch_node(t->n.nd, basetime - t->shift);
		while(h->next && h->time==h->next->time) h=h->next;
		if((whichpass)||(GLOBALS->tims.marker>=0)) h=h->next;
		if(!h) return;
		s->his.h=h;
		utt=strace_adjust(h->time,GLOBALS->shift_timebase); tt=utt;
		if(tt < maxbase) maxbase=tt;
		}
		else
		{
		vptr v;
		UTimeType utt;
		TimeType  tt;

		v=bsearch_vector(t->n.vec, basetime - t->shift);
		while(v->next && v->time==v->next->time) v=v->next;
		if((whichpass)||(GLOBALS->tims.marker>=0)) v=v->next;
		if(!v) return;
		s->his.v=v;
		utt=strace_adjust(v->time,GLOBALS->shift_timebase); tt=utt;
		if(tt < maxbase) maxbase=tt;
		}

	s=s->next;
	}
}

s=s_head;
totaltraces=0;	/* increment when not don't care */
while(s)
	{
/* commented out, maybe will have possible future expansion later,
 * this was cut and pasted from strace.c */
#if 0
	char str[2];
#endif
	t=s->trace;
	s->search_result=0;	/* explicitly must set this */
	GLOBALS->shift_timebase=t->shift;

	if((!t->vector)&&(!(t->n.nd->extvals)))
		{
		if(strace_adjust(s->his.h->time,GLOBALS->shift_timebase)!=maxbase)
			{
			s->his.h=bsearch_node(t->n.nd, maxbase - t->shift);
			while(s->his.h->next && s->his.h->time==s->his.h->next->time) s->his.h=s->his.h->next;
			}
/* commented out, maybe will have possible future expansion later,
 * this was cut and pasted from strace.c */
#if 0
		if(t->flags&TR_INVERT)
                	{
                        str[0]=AN_STR_INV[s->his.h->v.h_val];
                        }
                        else
                        {
                        str[0]=AN_STR[s->his.h->v.h_val];
                        }
		str[1]=0x00;
#endif

		switch(s->value)
			{
			case ST_ANY:
				totaltraces++;
				s->search_result=1;
				break;

/* commented out, maybe will have possible future expansion later,
 * this was cut and pasted from strace.c */
#if 0
			case ST_DC:
				break;

			case ST_HIGH:
				totaltraces++;
				if((str[0]=='1')||(str[0]=='H')) s->search_result=1;
				break;

			case ST_RISE:
				if((str[0]=='1')||(str[0]=='H')) s->search_result=1;
				totaltraces++;
				break;

			case ST_LOW:
				totaltraces++;
				if((str[0]=='0')||(str[0]=='L')) s->search_result=1;
				break;

			case ST_FALL:
				totaltraces++;
				if((str[0]=='0')||(str[0]=='L')) s->search_result=1;
				break;

			case ST_MID:
				totaltraces++;
				if(str[0]=='Z')
 					s->search_result=1;
				break;

			case ST_X:
				totaltraces++;
				if(str[0]=='X') s->search_result=1;
				break;

			case ST_STRING:
				totaltraces++;
				if(s->string)
				if(strstr_i(s->string,str)) s->search_result=1;
				break;
#endif

			default:
				fprintf(stderr, "Internal error: st_type of %d\n",s->value);
				exit(255);
			}


		}
		else
		{
		char *chval, *chval2;
		char ch;

		if(t->vector)
			{
			if(strace_adjust(s->his.v->time,GLOBALS->shift_timebase)!=maxbase)
				{
				s->his.v=bsearch_vector(t->n.vec, maxbase - t->shift);
				while(s->his.v->next && s->his.v->time==s->his.v->next->time) s->his.v=s->his.v->next;
				}
			chval=convert_ascii(t,s->his.v);
			}
			else
			{
			if(strace_adjust(s->his.h->time,GLOBALS->shift_timebase)!=maxbase)
				{
				s->his.h=bsearch_node(t->n.nd, maxbase - t->shift);
				while(s->his.h->next && s->his.h->time==s->his.h->next->time) s->his.h=s->his.h->next;
				}
			if(s->his.h->flags&HIST_REAL)
				{
				if(!(s->his.h->flags&HIST_STRING))
					{
#ifdef WAVE_HAS_H_DOUBLE
					chval=convert_ascii_real(t, &s->his.h->v.h_double);
#else
					chval=convert_ascii_real(t, (double *)s->his.h->v.h_vector);
#endif
					}
					else
					{
					chval=convert_ascii_string((char *)s->his.h->v.h_vector);
					chval2=chval;
					while((ch=*chval2))	/* toupper() the string */
						{
						if((ch>='a')&&(ch<='z')) { *chval2= ch-('a'-'A'); }
						chval2++;
						}
					}
				}
				else
				{
				chval=convert_ascii_vec(t,s->his.h->v.h_vector);
				}
			}

		switch(s->value)
			{
			case ST_ANY:
				totaltraces++;
				s->search_result=1;
				break;

/* commented out, maybe will have possible future expansion later,
 * this was cut and pasted from strace.c */
#if 0
			case ST_DC:
				break;

			case ST_RISE:
			case ST_FALL:
				totaltraces++;
				break;

			case ST_HIGH:
				totaltraces++;
				if((chval2=chval))
				while((ch=*(chval2++)))
					{
					if(((ch>='1')&&(ch<='9'))||(ch=='h')||(ch=='H')||((ch>='A')&&(ch<='F')))
						{
						s->search_result=1;
						break;
						}
					}
				break;

			case ST_LOW:
				totaltraces++;
				if((chval2=chval))
				{
				s->search_result=1;
				while((ch=*(chval2++)))
					{
					if((ch!='0')&&(ch!='l')&&(ch!='L'))
						{
						s->search_result=0;
						break;
						}
					}
				}
				break;

			case ST_MID:
				totaltraces++;
				if((chval2=chval))
				{
				s->search_result=1;
				while((ch=*(chval2++)))
					{
					if((ch!='z')&&(ch!='Z'))
						{
						s->search_result=0;
						break;
						}
					}
				}
				break;

			case ST_X:
				totaltraces++;
				if((chval2=chval))
				{
				s->search_result=1;
				while((ch=*(chval2++)))
					{
					if((ch!='X')&&(ch!='W')&&(ch!='x')&&(ch!='w'))
						{
						s->search_result=0;
						break;
						}
					}
				}
				break;

			case ST_STRING:
				totaltraces++;
				if(s->string)
				if(strstr_i(chval, s->string)) s->search_result=1;
				break;
#endif

			default:
				fprintf(stderr, "Internal error: st_type of %d\n",s->value);
				exit(255);
			}

		free_2(chval);
		}
	s=s->next;
	}

if((maxbase<sttim)||(maxbase>fintim)) return;

#ifdef DEBUG_PRINTF
DEBUG(printf("Maxbase: "TTFormat", total traces: %d\n",maxbase, totaltraces));
s=s_head;
passcount=0;
while(s)
	{
	DEBUG(printf("\tPass: %d, Name: %s\n",s->search_result, s->trace->name));
	if(s->search_result) passcount++;
	s=s->next;
	}
#endif

if(totaltraces)
	{
	break;
	}

basetime=maxbase;
}


GLOBALS->tims.marker=maxbase;
if(is_last_iteration)
	{
	update_markertime(GLOBALS->tims.marker);

	width=(TimeType)(((gdouble)GLOBALS->wavewidth)*GLOBALS->nspx);
	if((GLOBALS->tims.marker<GLOBALS->tims.start)||(GLOBALS->tims.marker>=GLOBALS->tims.start+width))
		{
		if((GLOBALS->tims.marker<0)||(GLOBALS->tims.marker<GLOBALS->tims.first)||(GLOBALS->tims.marker>GLOBALS->tims.last))
		                {
		                if(GLOBALS->tims.end>GLOBALS->tims.last) GLOBALS->tims.end=GLOBALS->tims.last;
		                middle=(GLOBALS->tims.start/2)+(GLOBALS->tims.end/2);
		                if((GLOBALS->tims.start&1)&&(GLOBALS->tims.end&1)) middle++;
		                }
		                else
		                {
		                middle=GLOBALS->tims.marker;
		                }

		GLOBALS->tims.start=time_trunc(middle-(width/2));
		if(GLOBALS->tims.start+width>GLOBALS->tims.last) GLOBALS->tims.start=GLOBALS->tims.last-width;
		if(GLOBALS->tims.start<GLOBALS->tims.first) GLOBALS->tims.start=GLOBALS->tims.first;
		GTK_ADJUSTMENT(GLOBALS->wave_hslider)->value=GLOBALS->tims.timecache=GLOBALS->tims.start;
		}

	MaxSignalLength();
	signalarea_configure_event(GLOBALS->signalarea, NULL);
	wavearea_configure_event(GLOBALS->wavearea, NULL);
	}
}
示例#9
0
static gint button_press_event(GtkWidget *widget, GdkEventButton *event)
{
int num_traces_displayable;
int which;
int trwhich, trtarget;
GtkAdjustment *wadj;
Trptr t;

if((traces.total)&&(signalpixmap))
	{
	gdk_pointer_grab(widget->window, FALSE,
		GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON1_MOTION_MASK | GDK_BUTTON3_MOTION_MASK | 
		GDK_BUTTON_RELEASE_MASK, NULL, NULL, event->time);

	num_traces_displayable=widget->allocation.height/(fontheight);
	num_traces_displayable--;   /* for the time trace that is always there */

	which=(int)(event->y);
	which=(which/fontheight)-1;

	if((which>=traces.total)||(which>=num_traces_displayable)||(which<0))
		{
		if(dnd_state==0)cachedwhich=-1;
		goto check_button_3;	/* off in no man's land, but check 3rd anyways.. */
		}

	cachedwhich=which;	/* cache for later fill in */
	wadj=GTK_ADJUSTMENT(wave_vslider);
	trtarget=((int)wadj->value)+which;

	t=traces.first;
	trwhich=0;
	while(t)
	        {
	        if((trwhich<trtarget)&&(t->next))
	                {
	                trwhich++;
	                t=t->next;
	                }
	                else
	                {
	                break;
	                }
	        }

	cachedtrace=t;
	if((dnd_state==0)&&(event->button==1))
	if(t)
		{
		int yval;
		GtkAdjustment *hadj;
		gint xsrc;

		if((shift_click_trace)&&(event->state&GDK_SHIFT_MASK))
			{
			Trptr t2;
			unsigned int f;

			t2=shift_click_trace;
			while(t2)
				{
				if(t2==t)
					{
					t2=shift_click_trace;
					f=t2->flags&TR_HIGHLIGHT;
					while(t2)
						{
						t2->flags = (t2->flags & (~TR_HIGHLIGHT)) | f;
						if(t2==t) break;
						t2=t2->prev;
						}					
					goto resync_signalarea;
					}
				t2=t2->prev;
				}

			t2=shift_click_trace;
			while(t2)
				{
				if(t2==t)
					{
					t2=shift_click_trace;
					f=t2->flags&TR_HIGHLIGHT;
					while(t2)
						{
						t2->flags = (t2->flags & (~TR_HIGHLIGHT)) | f;
						if(t2==t) break;
						t2=t2->next;
						}					
					goto resync_signalarea;
					}
				t2=t2->next;
				}

			goto normal_button1_press;	/* couldn't find original so make this original... */
			
			resync_signalarea:
        		MaxSignalLength();
        		signalarea_configure_event(signalarea, NULL);
			DEBUG(printf("Shift-Click in signalarea!\n"));
			return(TRUE);
			}
			else
			{
			normal_button1_press:
			hadj=GTK_ADJUSTMENT(signal_hslider);
			xsrc=(gint)hadj->value;

			shift_click_trace=t;
			t->flags ^= TR_HIGHLIGHT;
			cachedhiflag = t->flags & TR_HIGHLIGHT;

			DEBUG(printf("Button pressed in signalarea at x: %d, y: %d row: %d\n",
				(int)event->x, (int)event->y, which));

			yval=RenderSig(t, which, 1);
	        	gdk_draw_pixmap(signalarea->window, signalarea->style->fg_gc[GTK_WIDGET_STATE(signalarea)],
	                	signalpixmap,
	                	xsrc, yval,
	                	0, yval,
	                	signalarea->allocation.width, fontheight-1);
			}
		}

check_button_3:
	if(event->button==3)
		{
		if(dnd_state==0)
			{
			if(CutBuffer())
	        		{
				char buf[32];

				sprintf(buf,"Dragging %d trace%s.\n",traces.buffercount,traces.buffercount!=1?"s":"");
				status_text(buf);
	        		MaxSignalLength();
	        		signalarea_configure_event(signalarea, NULL);
	        		wavearea_configure_event(wavearea, NULL);
				dnd_state=1;
				}
			}
		}
	}

return(TRUE);
}
示例#10
0
static void ok_callback(GtkWidget *widget, GtkWidget *nothing)
{
int i;
struct symchain *symc, *symc_current;

gfloat interval;

if(is_append_running) return;
is_append_running = ~0;
gtk_grab_add(widget);

symc=NULL;

GTK_ADJUSTMENT(pdata->adj)->upper = (gfloat)((num_rows>1)?num_rows-1:1);
interval = (gfloat)(num_rows/100.0);
pdata->oldvalue = -1.0;

for(i=0;i<num_rows;i++)
	{
	int len;
	struct symbol *s, *t;
	s=(struct symbol *)gtk_clist_get_row_data(GTK_CLIST(clist), i);
	if(s->selected)
		{
                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((!s->vec_root)||(!autocoalesce))
			{
			AddNode(s->n, NULL);
			}
			else
			{
			len=0;
			t=s->vec_root;
			while(t)
				{
				if(t->selected)
					{
					if(len) t->selected=0;
					symc_current=(struct symchain *)calloc_2(1,sizeof(struct symchain));	
					symc_current->next=symc;
					symc_current->symbol=t;
					symc=symc_current;
					}
				len++;
				t=t->vec_chain;
				}
			if(len)add_vector_chain(s->vec_root, len);			
			}
		}
	}


while(symc)
	{
	symc->symbol->selected=1;
	symc_current=symc;
	symc=symc->next;
	free_2(symc_current);
	}

MaxSignalLength();
signalarea_configure_event(signalarea, NULL);
wavearea_configure_event(wavearea, NULL);

gtk_progress_set_value (GTK_PROGRESS (pdata->pbar), 0.0);
pdata->oldvalue = -1.0; 
gtk_grab_remove(widget);   
is_append_running=0;
}
示例#11
0
static void replace_callback(GtkWidget *widget, GtkWidget *nothing)
{
Traces tcache;
int i;
Trptr tfirst, tlast;
struct symchain *symc, *symc_current;

gfloat interval;

if(is_replace_running) return;
is_replace_running = ~0;
gtk_grab_add(widget);


tfirst=NULL; tlast=NULL;
symc=NULL;
memcpy(&tcache,&traces,sizeof(Traces));
traces.total=0;
traces.first=traces.last=NULL;

GTK_ADJUSTMENT(pdata->adj)->upper = (gfloat)((num_rows>1)?num_rows-1:1);
interval = (gfloat)(num_rows/100.0);
pdata->oldvalue = -1.0;

for(i=0;i<num_rows;i++)
	{
	int len;
	struct symbol *s, *t;
	s=(struct symbol *)gtk_clist_get_row_data(GTK_CLIST(clist), i);
	if(s->selected)
		{
                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((!s->vec_root)||(!autocoalesce))
			{
			AddNode(s->n, NULL);
			}
			else
			{
			len=0;
			t=s->vec_root;
			while(t)
				{
				if(t->selected)
					{
					if(len) t->selected=0;
					symc_current=(struct symchain *)calloc_2(1,sizeof(struct symchain));	
					symc_current->next=symc;
					symc_current->symbol=t;
					symc=symc_current;
					}
				len++;
				t=t->vec_chain;
				}
			if(len)add_vector_chain(s->vec_root, len);			
			}
		}
	}

while(symc)
	{
	symc->symbol->selected=1;
	symc_current=symc;
	symc=symc->next;
	free_2(symc_current);
	}

tfirst=traces.first; tlast=traces.last;	/* cache for highlighting */

traces.buffercount=traces.total;
traces.buffer=traces.first;
traces.bufferlast=traces.last;
traces.first=tcache.first;
traces.last=tcache.last;
traces.total=tcache.total;

PasteBuffer();

traces.buffercount=tcache.buffercount;
traces.buffer=tcache.buffer;
traces.bufferlast=tcache.bufferlast;

CutBuffer();

while(tfirst)
	{
	tfirst->flags |= TR_HIGHLIGHT;
	if(tfirst==tlast) break;
	tfirst=tfirst->next;
	}

MaxSignalLength();
signalarea_configure_event(signalarea, NULL);
wavearea_configure_event(wavearea, NULL);

gtk_progress_set_value (GTK_PROGRESS (pdata->pbar), 0.0);
pdata->oldvalue = -1.0;  
gtk_grab_remove(widget);
is_replace_running=0;
}
示例#12
0
文件: logfile.c 项目: Pidbip/egtkwave
static gboolean
button_release_event (GtkWidget *text, GdkEventButton *event)
{
gchar *sel;

#if defined(WAVE_USE_GTK2) && !defined(GTK_ENABLE_BROKEN)
GtkTextIter start;
GtkTextIter end;
                        
if (gtk_text_buffer_get_selection_bounds (GTK_TEXT_VIEW(text)->buffer,
                                         &start, &end))
       {
       if(gtk_text_iter_compare (&start, &end) < 0)
               {
               sel = gtk_text_buffer_get_text(GTK_TEXT_VIEW(text)->buffer,   
                                              &start, &end, FALSE);

               if(sel)
                       {
			int slen = strlen(sel);
			char *sel2 = NULL;

                       	if((slen)&&(sel[0]>='0')&&(sel[0]<='9'))
                               {
			       TimeType tm;
			       gunichar gch = gtk_text_iter_get_char(&end);
			       int do_si_append = 0;

			        if(gch==' ') /* in case time is of format "100 ps" with a space */
					{
					gtk_text_iter_forward_char(&end);
					gch = gtk_text_iter_get_char(&end);
					}

				if((sel[slen-1]>='0')&&(sel[slen-1]<='9')) /* need to append units? */
					{
					int silen = strlen(WAVE_SI_UNITS);
					int silp;

					gch = tolower(gch);
					if(gch == 's')
						{
						do_si_append = 1;
						}
					else
						{
						for(silp=0;silp<silen;silp++)
							{
							if(gch == WAVE_SI_UNITS[silp])
								{
								do_si_append = 1;
								break;
								}
							}
						}
					}

				if(do_si_append)
					{
					sel2 = malloc_2(slen + 2);
					sprintf(sel2, "%s%c", sel, (unsigned char)gch);
					}

                               tm = unformat_time(sel2 ? sel2 : sel, GLOBALS->time_dimension);
                               if((tm >= GLOBALS->tims.first) && (tm <= GLOBALS->tims.last))
                                       {
                                       GLOBALS->tims.lmbcache = -1;
                                       update_markertime(GLOBALS->tims.marker = tm);
                                       center_op();
                                       signalarea_configure_event(GLOBALS->signalarea, NULL);
                                       wavearea_configure_event(GLOBALS->wavearea, NULL);
                                       update_markertime(GLOBALS->tims.marker = tm); /* centering problem in GTK2 */
                                       }
                               }

		       if(sel2) { free_2(sel2); }
                       g_free(sel);
                       }
               }
       }
#else

#ifndef WAVE_USE_GTK2
GtkEditable *oe = GTK_EDITABLE(&GTK_TEXT(text)->editable);
GtkTextClass *tc = (GtkTextClass *) ((GtkObject*) (GTK_OBJECT(text)))->klass;
GtkEditableClass *oec = &tc->parent_class;
#else
GtkOldEditable *oe = GTK_OLD_EDITABLE(&GTK_TEXT(text)->old_editable);
GtkOldEditableClass *oec = GTK_OLD_EDITABLE_GET_CLASS(oe);
#endif

if(oe->has_selection)
	{
	if(oec->get_chars)
		{
	 	sel = oec->get_chars(oe, oe->selection_start_pos, oe->selection_end_pos);
	
		if(sel)
			{
			int slen = strlen(sel);
			char *sel2 = NULL;

			if((slen)&&(sel[0]>='0')&&(sel[0]<='9'))
				{
				TimeType tm;
				gint gchpos = oe->selection_end_pos;
				gchar *extra = oec->get_chars(oe, gchpos, gchpos+2);
				gchar gch = extra ? extra[0] : 0;
			        int do_si_append = 0;

			        if(gch==' ') /* in case time is of format "100 ps" with a space */
					{
					gch = gch ? extra[1] : 0;
					}

				if(extra) g_free(extra);

				if((sel[slen-1]>='0')&&(sel[slen-1]<='9')) /* need to append units? */
					{
					int silen = strlen(WAVE_SI_UNITS);
					int silp;

					gch = tolower(gch);
					if(gch == 's')
						{
						do_si_append = 1;
						}
					else
						{
						for(silp=0;silp<silen;silp++)
							{
							if(gch == WAVE_SI_UNITS[silp])
								{
								do_si_append = 1;
								break;
								}
							}
						}
					}

				if(do_si_append)
					{
					sel2 = malloc_2(slen + 2);
					sprintf(sel2, "%s%c", sel, (unsigned char)gch);
					}

				tm = unformat_time(sel2 ? sel2 : sel, GLOBALS->time_dimension);
				if((tm >= GLOBALS->tims.first) && (tm <= GLOBALS->tims.last))
					{
					GLOBALS->tims.lmbcache = -1;
				        update_markertime(GLOBALS->tims.marker = tm);
					center_op();
					signalarea_configure_event(GLOBALS->signalarea, NULL);
        				wavearea_configure_event(GLOBALS->wavearea, NULL);
				        update_markertime(GLOBALS->tims.marker = tm); /* centering problem in GTK2 */
					}
				}

		        if(sel2) { free_2(sel2); }
			g_free(sel);
			}
		}
	}

#endif

return(FALSE); /* call remaining handlers... */
}