Changeset 531

Show
Ignore:
Timestamp:
01/12/08 01:53:20 (8 months ago)
Author:
kickback
Message:

sweep: add Radoslaw's scroll pane patch. slightly edited

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • sweep/trunk/src/Makefile.am

    r521 r531  
    5656        sample-display.c sample-display.h \ 
    5757        samplerate.c \ 
     58        scroll-pane.c scroll-pane.h \ 
    5859        sw_chooser.c sw_chooser.h \ 
    5960        sweep_filter.c \ 
  • sweep/trunk/src/sweep_app.h

    r438 r531  
    102102 
    103103  GtkWidget * follow_toggle; 
    104   GtkWidget * play_pos; 
     104  GtkWidget * play_pos_time; 
     105  GtkWidget * play_pos_frame; 
    105106  GtkWidget * loop_toggle; 
    106107  GtkWidget * playrev_toggle; 
  • sweep/trunk/src/view.c

    r521 r531  
    6161#include "head.h" 
    6262#include "view_pixmaps.h" 
     63#include "scroll-pane.h" 
    6364 
    6465/*#define DEBUG*/ 
     
    22502251                      G_CALLBACK(view_rate_zeroed_cb), view); 
    22512252 
    2252   /* scrollbar */ 
     2253  /* scroll pane */ 
    22532254  step = ((gfloat)(end - start)) / 10.0; 
    22542255  if (step < 1.0) step = 1.0; 
     
    22672268  g_signal_connect (G_OBJECT(view->adj), "changed", 
    22682269                      G_CALLBACK(adj_changed_cb), view); 
    2269  
    2270   scrollbar = gtk_hscrollbar_new(GTK_ADJUSTMENT(view->adj)); 
    2271   gtk_table_attach (GTK_TABLE(table), scrollbar, 
    2272                     1, 2, 2, 3, 
    2273                     GTK_EXPAND|GTK_FILL|GTK_SHRINK, GTK_FILL, 
    2274                     0, 0); 
     2270  GtkWidget *scroll_frame; 
     2271     
     2272  scroll_frame = gtk_frame_new (NULL); 
     2273  gtk_frame_set_shadow_type (GTK_FRAME (scroll_frame), GTK_SHADOW_IN); 
     2274  gtk_table_attach (GTK_TABLE(table), scroll_frame, 
     2275                                1, 2, 2, 3, 
     2276                                GTK_EXPAND|GTK_FILL|GTK_SHRINK, GTK_FILL, 
     2277                                0, 0); 
     2278  gtk_widget_show (scroll_frame); 
     2279  scrollbar = scroll_pane_new(GTK_ADJUSTMENT(view->adj)); 
     2280  view->scrollbar = scrollbar; 
     2281   
     2282  gtk_container_add (GTK_CONTAINER (scroll_frame), scrollbar); 
     2283 
     2284  scroll_pane_set_view(SCROLL_PANE(scrollbar), view); 
    22752285  gtk_widget_show(scrollbar); 
    2276  
    22772286 
    22782287  /* playback toolbar */ 
     
    23392348  gtk_widget_show (pixmap); 
    23402349  gtk_box_pack_end (GTK_BOX(imagebox), pixmap, FALSE, FALSE, 0); 
     2350 
     2351  imagebox = gtk_hbox_new (FALSE, 0); 
     2352  gtk_box_pack_start (GTK_BOX(tool_hbox), imagebox, TRUE, FALSE, 0); 
     2353  gtk_widget_show (imagebox); 
     2354  
     2355  label = gtk_label_new ("TIME:"); 
     2356  gtk_box_pack_start (GTK_BOX(imagebox), label, FALSE, FALSE, 0); 
     2357  gtk_widget_show (label); 
     2358 
     2359  label = gtk_label_new ("00:00:00.000"); 
     2360  gtk_box_pack_start (GTK_BOX(imagebox), label, TRUE, TRUE, 12); 
     2361  gtk_widget_show (label); 
     2362  view->play_pos_time = label; 
    23412363   
    2342   label = gtk_label_new ("00:00:00.000"); 
    2343   gtk_box_pack_start (GTK_BOX(tool_hbox), label, TRUE, TRUE, 0); 
     2364  label = gtk_label_new ("FRAME:"); 
     2365  gtk_box_pack_start (GTK_BOX(imagebox), label, FALSE, FALSE, 0); 
    23442366  gtk_widget_show (label); 
    2345   view->play_pos = label; 
     2367 
     2368  label = gtk_label_new ("00000000"); 
     2369  gtk_box_pack_start (GTK_BOX(imagebox), label, TRUE, TRUE, 12); 
     2370  gtk_widget_show (label); 
     2371  view->play_pos_frame = label; 
    23462372 
    23472373  imagebox = gtk_vbox_new (FALSE, 0); 
     
    23642390  gtk_box_pack_start (GTK_BOX(hbox), entry, TRUE, TRUE, 0); 
    23652391  gtk_widget_show (entry); 
    2366   view->play_pos = entry; 
     2392  view->play_pos_time = entry; 
    23672393#endif 
    23682394 
     
    32633289{ 
    32643290  SampleDisplay * sd = SAMPLE_DISPLAY(view->display); 
     3291  ScrollPane * sc = SCROLL_PANE(view->scrollbar); 
    32653292  sw_sample * sample = view->sample; 
    32663293  sw_framecount_t offset; 
     
    32773304  snprint_time (buf, BUF_LEN, 
    32783305                frames_to_time (sample->sounddata->format, offset)); 
     3306     
     3307/* FIXME: this is bad */     
    32793308/* cheesy rate limiter. ugly in operation. limits pango damage */ 
    32803309if (rate_limit >= 3) { 
    32813310        rate_limit=0; 
    32823311#ifdef PLAYPOS_LABEL 
    3283   gtk_label_set_text (GTK_LABEL(view->play_pos), buf); 
     3312  gtk_label_set_text (GTK_LABEL(view->play_pos_time), buf); 
     3313 
     3314  snprintf (buf, BUF_LEN, "%08d", offset ); 
     3315  gtk_label_set_text (GTK_LABEL(view->play_pos_frame), buf); 
    32843316#else 
    3285   gtk_entry_set_text (GTK_ENTRY(view->play_pos), buf); 
     3317  gtk_entry_set_text (GTK_ENTRY(view->play_pos_time), buf); 
    32863318#endif 
    32873319 
     
    32923324  sample_display_refresh_play_marker (sd); 
    32933325  sample_display_refresh_user_marker (sd); 
     3326//  scroll_pane_refresh(sc); 
    32943327 
    32953328  if (view->following) { 
     
    35513584{ 
    35523585  SampleDisplay * sd = SAMPLE_DISPLAY(v->display); 
     3586  ScrollPane * sc = SCROLL_PANE(v->scrollbar); 
    35533587 
    35543588  sample_display_refresh(sd); 
     3589  scroll_pane_refresh(sc); 
    35553590} 
    35563591