Exemple #1
0
static void
on_entry_icon_release (GtkEntry            *entry,
                       GtkEntryIconPosition icon_pos,
                       GdkEvent            *event,
                       gpointer             user_data)
{
  if (icon_pos != GTK_ENTRY_ICON_SECONDARY)
    return;

  pulse_entry_mode++;

  if (pulse_entry_mode % 3 == 0)
    {
      g_object_set_data (G_OBJECT (entry), "pulse_id", NULL);
      gtk_entry_set_progress_fraction (entry, 0);
    }
  else if (pulse_entry_mode % 3 == 1)
    gtk_entry_set_progress_fraction (entry, 0.25);
  else if (pulse_entry_mode % 3 == 2)
    {
      if (pulse_time - 50 < 400)
        {
          gtk_entry_set_progress_pulse_step (entry, 0.1);
          pulse_it (GTK_WIDGET (entry));
        }
    }
}
Exemple #2
0
static void update_prog(PROC_T *p){
    /*Update the progress bar*/
    if(p->status.nseed>0){
	if(p->status.laps>0){
	    p->frac=(double)p->status.laps/(double)(p->status.rest+p->status.laps);
	}
    
	const double tkmean=p->status.scale;
	const long tot=p->status.rest+p->status.laps;/*show total time. */
	const long toth=tot/3600;
	const long totm=(tot-toth*3600)/60;
	const long tots=tot-toth*3600-totm*60;
	const long rest=p->status.rest;
	const long resth=rest/3600;
	const long restm=(rest-resth*3600)/60;
	const long rests=rest-resth*3600-restm*60;
	const double step=p->status.tot*tkmean;
	if(p->iseed_old!=p->status.iseed){
	    char tmp[64];
	    snprintf(tmp,64,"%d/%d",p->status.iseed+1,p->status.nseed);
	    gtk_entry_set_text(GTK_ENTRY(p->entry_iseed), tmp);
	    p->iseed_old=p->status.iseed;
#if GTK_MAJOR_VERSION>=3 || GTK_MINOR_VERSION >= 16
	    gtk_entry_set_progress_fraction
		(GTK_ENTRY(p->entry_iseed),
		 (double)(p->status.iseed+1)/(double)p->status.nseed);
#endif
	}
	char tmp[64];
	/*snprintf(tmp,64, "%5.2fs %d/%d %2ld:%02ld/%ld:%02ld",
	  step,p->status.isim+1,p->status.simend,
	  restm,rests,totm,tots);*/
	if(toth>99){
	    snprintf(tmp,64, "%d/%d %5.2fs %ldh/%ldh",p->status.isim+1,p->status.simend,
		     step, resth,toth);
	}else if(toth>0){
	    snprintf(tmp,64, "%d/%d %5.2fs %ldh%02ld/%ldh%02ld",p->status.isim+1,p->status.simend,
		     step, resth,restm,toth,totm);
	}else{
	    snprintf(tmp,64, "%d/%d %5.2fs %2ld:%02ld/%ld:%02ld",p->status.isim+1,p->status.simend,
		     step, restm,rests,totm,tots);	
	}
	gtk_entry_set_text(GTK_ENTRY(p->entry_timing),tmp);
	snprintf(tmp,64,"%.2f",p->status.clerrlo);
	gtk_label_set_text(GTK_LABEL(p->entry_errlo),tmp);
	snprintf(tmp,64,"%.2f",p->status.clerrhi);
	gtk_label_set_text(GTK_LABEL(p->entry_errhi),tmp);
#if GTK_MAJOR_VERSION>=3 || GTK_MINOR_VERSION >= 16
	gtk_entry_set_progress_fraction(GTK_ENTRY(p->entry_timing),p->frac);
#endif	
    }
}
 //____________________________________________________
 void SliderDemoWidget::Sliders::setValue( const double& value ) const
 {
     gtk_range_set_value( GTK_RANGE( _scale ), value );
     gtk_progress_bar_set_fraction( GTK_PROGRESS_BAR( _progressBar ), value/100 );
     gtk_range_set_value( GTK_RANGE( _scrollBar ), value );
     if( _progressEntry ) gtk_entry_set_progress_fraction( GTK_ENTRY( _progressEntry ), value/100 );
 }
Exemple #4
0
static void webViewLoadProgressChanged(WebKitWebView *webView, GParamSpec *pspec, BrowserWindow *window)
{

    gdouble progress = webkit_web_view_get_estimated_load_progress(webView);
    gtk_entry_set_progress_fraction(GTK_ENTRY(window->uriEntry), progress);
    if (progress == 1.0) {
        window->resetEntryProgressTimeoutId = g_timeout_add(500, (GSourceFunc)resetEntryProgress, window);
        g_source_set_name_by_id(window->resetEntryProgressTimeoutId, "[WebKit] resetEntryProgress");
    }
}
/*
 * Gets called periodically to increase the progress with one step.
 * When progress is complete saves the spinbutton value to file, clears the
 * progress and stops the function to be called periodically.
 */
static gboolean spin_button_progress_step(struct iio_widget *iio_w)
{
	struct progress_data *pdata = iio_w->priv_progress;
	void (*on_complete_cb)(void) = pdata->on_complete;

	if (pdata->progress < 1.0) {
		pdata->progress += 0.095;
		gtk_entry_set_progress_fraction(GTK_ENTRY(iio_w->widget), pdata->progress);

		return TRUE;
	} else {
		pdata->progress = 0.0;
		gtk_entry_set_progress_fraction(GTK_ENTRY(iio_w->widget), pdata->progress);
		iio_widget_save(iio_w);
		if (pdata->on_complete != NULL)
			on_complete_cb();
		pdata->timeoutID = -1;

		return FALSE;
	}
}
Exemple #6
0
static void update_prog(PROC_T *p){
    /*Update the progress bar*/
    if(p->status.nseed>0){
	if(p->status.laps>0){
	    p->frac=(double)p->status.laps/(double)(p->status.rest+p->status.laps);
	}
    
	const double tkmean=p->status.scale;
	const long rest=p->status.rest;
	const long laps=p->status.laps;
	const long resth=rest/3600;
	const long restm=(rest-resth*3600)/60;
	const long lapsh=laps/3600;
	const long lapsm=(laps-lapsh*3600)/60;
	const double tot=p->status.tot*tkmean;
	if(p->iseed_old!=p->status.iseed){
	    char tmp[64];
	    snprintf(tmp,64,"%d of %d",p->status.iseed+1,p->status.nseed);
	    gtk_entry_set_text(GTK_ENTRY(p->entry_iseed), tmp);
	    p->iseed_old=p->status.iseed;
#if GTK_MAJOR_VERSION>=3 || GTK_MINOR_VERSION >= 16
	    gtk_entry_set_progress_fraction
		(GTK_ENTRY(p->entry_iseed),
		 (double)(p->status.iseed+1)/(double)p->status.nseed);
#endif
	}
	char tmp[64];
	snprintf(tmp,64, "%d of %d %ld:%02ld %ld:%02ld %.2fs",
		 p->status.isim+1,p->status.simend,
		 lapsh,lapsm,resth,restm,tot);
	gtk_entry_set_text(GTK_ENTRY(p->entry_timing),tmp);
	snprintf(tmp,64,"%.2f",p->status.clerrlo);
	gtk_label_set_text(GTK_LABEL(p->entry_errlo),tmp);
	snprintf(tmp,64,"%.2f",p->status.clerrhi);
	gtk_label_set_text(GTK_LABEL(p->entry_errhi),tmp);
#if GTK_MAJOR_VERSION>=3 || GTK_MINOR_VERSION >= 16
	gtk_entry_set_progress_fraction(GTK_ENTRY(p->entry_timing),p->frac);
#endif	
    }
}
Exemple #7
0
void finished (WebKitWebView  *web_view, WebKitWebFrame *frame, gpointer*  data){

	gtk_entry_set_progress_fraction (GTK_ENTRY(data),0.0);
}
Exemple #8
0
void progress (WebKitWebView *web, gint progress, gpointer* data){

	gtk_entry_set_progress_fraction (GTK_ENTRY(data),progress);
}
    //____________________________________________________
    SliderDemoWidget::SliderDemoWidget( void )
    {

        // main widget
        GtkWidget* mainWidget( gtk_hbox_new( false, 0 ) );
        gtk_box_set_spacing( GTK_BOX( mainWidget ), 5 );
        setWidget( mainWidget );

        // setup
        setName( "Sliders" );
        setComments( "Shows the appearance of sliders, progress bars and scrollbars" );
        setIconName( "measure" );
        realize();

        // horizontal sliders
        {

            // frame
            GtkWidget* frame( gtk_frame_new( "Horizontal" ) );
            gtk_box_pack_start( GTK_BOX( mainWidget ), frame, true, true, 0 );
            gtk_widget_show( frame );

            // container
            GtkWidget* box( gtk_vbox_new( false, 0 ) );
            gtk_container_set_border_width( GTK_CONTAINER( box ), 5 );
            gtk_box_set_spacing( GTK_BOX( box ), 2 );
            gtk_widget_show( box );
            gtk_container_add( GTK_CONTAINER( frame ), box );

            // scale
            _horizontalSliders._scale = gtk_hscale_new_with_range( 0, 100, 1 );
            gtk_scale_set_draw_value( GTK_SCALE( _horizontalSliders._scale ), false );
            gtk_box_pack_start( GTK_BOX( box ), _horizontalSliders._scale, false, true, 0 );
            gtk_widget_show( _horizontalSliders._scale );


            // progress entry
            _horizontalSliders._progressEntry = gtk_entry_new();
            gtk_entry_set_text( GTK_ENTRY( _horizontalSliders._progressEntry ), "Progress Bar Entry" );
            gtk_entry_set_progress_fraction( GTK_ENTRY( _horizontalSliders._progressEntry ), 0.25 );
            gtk_box_pack_start( GTK_BOX( box ), _horizontalSliders._progressEntry, false, true, 0 );
            gtk_widget_show( _horizontalSliders._progressEntry );

            // progress bar
            _horizontalSliders._progressBar = gtk_progress_bar_new();
            #if GTK_CHECK_VERSION(3, 0, 0)
            gtk_orientable_set_orientation( GTK_ORIENTABLE( _horizontalSliders._progressBar ), GTK_ORIENTATION_HORIZONTAL );
            #else
            gtk_progress_bar_set_orientation( GTK_PROGRESS_BAR( _horizontalSliders._progressBar ), GTK_PROGRESS_LEFT_TO_RIGHT );
            #endif

            gtk_progress_set_show_text( GTK_PROGRESS( _horizontalSliders._progressBar ), true );
            gtk_box_pack_start( GTK_BOX( box ), _horizontalSliders._progressBar, false, true, 0 );
            gtk_widget_show( _horizontalSliders._progressBar );

            // pulse progressBar
            _pulseProgressBar = gtk_progress_bar_new();
            #if GTK_CHECK_VERSION(3, 0, 0)
            gtk_orientable_set_orientation( GTK_ORIENTABLE( _pulseProgressBar ), GTK_ORIENTATION_HORIZONTAL );
            #else
            gtk_progress_bar_set_orientation( GTK_PROGRESS_BAR( _pulseProgressBar ), GTK_PROGRESS_LEFT_TO_RIGHT );
            #endif

            gtk_progress_bar_set_pulse_step( GTK_PROGRESS_BAR( _pulseProgressBar ), 0.01 );
            gtk_box_pack_start( GTK_BOX( box ), _pulseProgressBar, false, true, 0 );
            gtk_widget_show( _pulseProgressBar );

            // scrollbar
            GtkAdjustment* adjustment( GTK_ADJUSTMENT( gtk_adjustment_new( 25, 0, 110, 1, 1, 10 ) ) );
            _horizontalSliders._scrollBar = gtk_hscrollbar_new( adjustment );
            gtk_box_pack_start( GTK_BOX( box ), _horizontalSliders._scrollBar, false, true, 0 );
            gtk_widget_show( _horizontalSliders._scrollBar );

        }

        // vertical sliders
        {

            // frame
            GtkWidget* frame( gtk_frame_new( "Vertical" ) );
            gtk_box_pack_start( GTK_BOX( mainWidget ), frame, false, true, 0 );
            gtk_widget_show( frame );

            // container
            GtkWidget* box( gtk_hbox_new( false, 0 ) );
            gtk_container_set_border_width( GTK_CONTAINER( box ), 5 );
            gtk_box_set_spacing( GTK_BOX( box ), 5 );
            gtk_widget_show( box );
            gtk_container_add( GTK_CONTAINER( frame ), box );

            // scale
            _verticalSliders._scale = gtk_vscale_new_with_range( 0, 100, 1 );
            gtk_scale_set_draw_value( GTK_SCALE( _verticalSliders._scale ), false );
            gtk_box_pack_start( GTK_BOX( box ), _verticalSliders._scale, false, true, 0 );
            gtk_widget_show( _verticalSliders._scale );

            // progress bar
            _verticalSliders._progressBar = gtk_progress_bar_new();
            #if GTK_CHECK_VERSION(3, 0, 0)
            gtk_orientable_set_orientation( GTK_ORIENTABLE( _verticalSliders._progressBar ), GTK_ORIENTATION_VERTICAL );
            #else
            gtk_progress_bar_set_orientation( GTK_PROGRESS_BAR( _verticalSliders._progressBar ), GTK_PROGRESS_BOTTOM_TO_TOP );
            #endif

            gtk_progress_set_show_text( GTK_PROGRESS( _verticalSliders._progressBar ), true );
            gtk_box_pack_start( GTK_BOX( box ), _verticalSliders._progressBar, false, true, 0 );
            gtk_widget_show( _verticalSliders._progressBar );

            // scrollbar
            GtkAdjustment* adjustment( GTK_ADJUSTMENT( gtk_adjustment_new( 25, 0, 110, 1, 1, 10 ) ) );
            _verticalSliders._scrollBar = gtk_vscrollbar_new( adjustment );
            gtk_box_pack_start( GTK_BOX( box ), _verticalSliders._scrollBar, false, true, 0 );
            gtk_widget_show( _verticalSliders._scrollBar );

        }

        // connections
        connect( G_OBJECT( _horizontalSliders._scale ), "value-changed", GCallback( valueChanged ), this );
        connect( G_OBJECT( _horizontalSliders._scrollBar ), "value-changed", GCallback( valueChanged ), this );

        connect( G_OBJECT( _verticalSliders._scale ), "value-changed", GCallback( valueChanged ), this );
        connect( G_OBJECT( _verticalSliders._scrollBar ), "value-changed", GCallback( valueChanged ), this );

        // Initialize all
        gtk_range_set_value( GTK_RANGE( _verticalSliders._scale ), 25 );
    }
Exemple #10
0
static void
search_progress_done(GtkEntry *entry)
{
	gtk_entry_set_progress_fraction(entry, 0.0);
}
Exemple #11
0
void finished (WebKitWebView  *web_view, WebKitWebFrame *frame,gpointer*  data)
{
	GtkWidget* wid = GTK_WIDGET(data);
	gtk_entry_set_progress_fraction (GTK_ENTRY(wid),0.0);
}
Exemple #12
0
void progress (WebKitWebView *web, gint progress,gpointer* data)
{
	GtkWidget* wid = GTK_WIDGET(data);
	gtk_entry_set_progress_fraction (GTK_ENTRY(wid),progress);
}
Exemple #13
0
static gboolean webViewLoadFailed(WebKitWebView *webView, WebKitLoadEvent loadEvent, const char *failingURI, GError *error, BrowserWindow *window)
{
    gtk_entry_set_progress_fraction(GTK_ENTRY(window->uriEntry), 0.);
    return FALSE;
}
Exemple #14
0
static gboolean resetEntryProgress(BrowserWindow *window)
{
    gtk_entry_set_progress_fraction(GTK_ENTRY(window->uriEntry), 0);
    window->resetEntryProgressTimeoutId = 0;
    return FALSE;
}