Changeset 463

Show
Ignore:
Timestamp:
01/09/07 01:02:51 (2 years ago)
Author:
radekk
Message:

Redesign time marker handling.
Add register operation of time marker handling - in progress.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • sweep/branches/sweep-info-panel/src/edit.c

    r455 r463  
    405405 
    406406    sounddata_add_selection_1 (s->sounddata, er->start - start, 
    407                                er->end - start); 
     407                               er->end - start, NULL); 
    408408 
    409409#ifdef DEBUG 
     
    617617    if (er->start > sounddata->nr_frames) break; 
    618618 
    619     sounddata_add_selection_1 (sounddata, er->start, MIN(er->end, sounddata->nr_frames)); 
     619    sounddata_add_selection_1 (sounddata, er->start, MIN(er->end, sounddata->nr_frames), NULL); 
    620620  } 
    621621} 
     
    10491049  /* Select the copied in portion of the sounddata */ 
    10501050  sounddata_set_selection_1 (sounddata, paste_offset, 
    1051                              paste_offset + paste_length); 
     1051                             paste_offset + paste_length, NULL); 
    10521052 
    10531053  /* Move offset markers */ 
  • sweep/branches/sweep-info-panel/src/info-panel.c

    r459 r463  
    5151 * - show/edit sample type (ogg, mp3, wav, etc.) 
    5252 * - treeview doesn't catch all keyboards signals, so editing cells is almost useless 
     53 *   - so temporary disabled accels 
    5354 * - implement: 
    5455 *   - changing sampling rate 
     
    6162typedef struct _PopupData PopupData; 
    6263typedef struct _SelectionData SelectionData; 
     64typedef struct _MarkerData MarkerData; 
    6365 
    6466struct _PopupData 
     
    7274        sw_sel sel_data; 
    7375        sw_sel * sel_modify; 
     76}; 
     77 
     78struct _MarkerData 
     79{ 
     80        sw_mark mark_data; 
     81        sw_mark * mark_modify; 
    7482}; 
    7583 
     
    12911299#else 
    12921300 
    1293 void info_panel_add_markers_cb (GtkWidget * menuitem, sw_view * view) 
     1301static sw_sample * info_panel_marker_add (sw_sample * s, sw_param_set unused, sw_view * view) 
    12941302{ 
    12951303        sw_mark * mark; 
    12961304 
    1297         mark = mark_new (0, SWEEP_MARK_TYPE_SIMPLE, NULL); 
     1305        g_mutex_lock (s->sounddata->marks_mutex); 
     1306 
     1307        mark = mark_new ((view->end - view->start) / 2 + view->start, SWEEP_MARK_TYPE_SIMPLE, NULL); 
    12981308 
    12991309        view->sample->sounddata->marks = marks_add_marker (view->sample->sounddata->marks, mark); 
    13001310 
     1311        g_mutex_unlock (s->sounddata->marks_mutex); 
     1312         
    13011313        sample_refresh_views (view->sample); 
     1314 
     1315        return s; 
     1316} 
     1317 
     1318void info_panel_add_markers_cb (GtkWidget *menuitem, sw_view * view) 
     1319{ 
     1320        perform_marker_op (view->sample, _("Add Time marker"), (SweepFilter)info_panel_marker_add, NULL, view); 
    13021321} 
    13031322#endif 
  • sweep/branches/sweep-info-panel/src/interface.c

    r279 r463  
    5151GtkStyle * style_dark_grey; 
    5252GtkStyle * style_red; 
    53  
    54  
    55  
    5653 
    5754 
  • sweep/branches/sweep-info-panel/src/sample-display.c

    r459 r463  
    3535#include <gtk/gtk.h> 
    3636 
     37#include <sweep/sweep_marker.h> 
    3738#include <sweep/sweep_i18n.h> 
    3839 
     
    4546#include "edit.h" 
    4647#include "undo_dialog.h" 
     48#include "info-panel.h" 
    4749 
    4850/*#define DEBUG*/ 
     
    143145  0, 0, 0,       /* tmp_sel_text */ 
    144146  255, 255, 255, /* sel_text */ 
    145   240, 240, 240, /* mark_text */ 
     147  0, 0, 0, /* mark_text */ 
    146148}; 
    147149 
     
    170172  0, 0, 0,       /* tmp_sel_text */ 
    171173  255, 255, 255, /* sel_text */ 
    172   240, 240, 240, /* mark_text */ 
     174  0, 0, 0,      /* mark_text */ 
    173175}; 
    174176#endif 
     
    286288sample_display_get_mouse_offset (SampleDisplay * s) 
    287289{ 
    288   int x, y; 
     290  gint x, y; 
    289291  GdkModifierType state; 
    290292 
     
    421423sample_display_refresh_sels (SampleDisplay * s) 
    422424{ 
    423   int x, x2; 
     425  gint x, x2; 
    424426  sw_sample * sample; 
    425427  GList * gl; 
     
    484486sample_display_refresh_marks (SampleDisplay * s) 
    485487{ 
    486   int x, x2; 
     488  //int x, x2; 
    487489  sw_sample * sample; 
    488490  GList * gl; 
     
    13411343    /* draw the selection */ 
    13421344    sample_display_draw_sel_box (win, s->sel_gc, 
    1343                                                        s, xs, xe - xs - 1, 
    1344                                                        l_end, r_end /* draw_ends */); 
     1345                                s, xs, xe - xs - 1, 
     1346                                l_end, r_end /* draw_ends */); 
    13451347 
    13461348    if ( sel->name != NULL ){ 
     
    14501452 
    14511453            if ( mark->name != NULL ){ 
    1452                         gdk_draw_layout (win, s->fg_gc, 
     1454                        gdk_draw_layout (win, s->mark_text_gc, 
    14531455                                x2 + 2, 0, 
    14541456                                layout); 
    1455 /* 
    1456                         gtk_paint_layout (GTK_WIDGET(s)->style, 
    1457                                         win, GTK_WIDGET_STATE (GTK_WIDGET(s)), 
    1458                                 FALSE, NULL, 
    1459                                 GTK_WIDGET(s), NULL, 
    1460                                 x2 + 2, 0, 
    1461                                 layout); 
    1462 */ 
    14631457            } 
    14641458    } 
     
    21182112} 
    21192113 
     2114#if 0 
     2115typedef struct _MarkerData MarkerData; 
     2116struct _MarkerData 
     2117{ 
     2118        sw_framecount_t offset; 
     2119        sw_mark * mark_modify; 
     2120}; 
     2121 
     2122static void 
     2123sample_display_mod_marker (sw_sample * s, sw_param_set unused, MarkerData * markdata) 
     2124{ 
     2125  /* pointer into moving marker */ 
     2126  s->tmp_mark = markdata->mark_modify; 
     2127 
     2128  /* modify data */ 
     2129  s->tmp_mark->frame = markdata->offset; 
     2130                         
     2131  g_free(markdata); 
     2132} 
     2133#endif 
     2134 
    21202135static void 
    21212136sample_display_handle_marker_motion (SampleDisplay * s, int x, int y) 
     
    21232138  sw_mark * mark; 
    21242139  GList * gl; 
     2140  sw_sample * sample = s->view->sample; 
    21252141  sw_framecount_t offset, off1, off2; 
    21262142  gboolean mod = FALSE; 
     2143  //MarkerData * markdata; 
    21272144 
    21282145  offset = XPOS_TO_OFFSET(x); 
     
    21302147  off2 = XPOS_TO_OFFSET(x + 5); 
    21312148 
    2132   g_mutex_lock (s->view->sample->sounddata->marks_mutex); 
    2133  
    2134   if (s->view->sample->tmp_mark){ 
    2135  
    2136           s->view->sample->tmp_mark->frame = offset; 
     2149  g_mutex_lock (sample->sounddata->marks_mutex); 
     2150 
     2151  if (sample->tmp_mark){ 
     2152 
     2153          sample->tmp_mark->frame = offset; 
    21372154          mod = TRUE; 
    21382155 
    21392156  } else { 
    2140           for ( gl = s->view->sample->sounddata->marks; gl; gl = gl->next){ 
     2157          for ( gl = sample->sounddata->marks; gl; gl = gl->next){ 
    21412158         
    21422159                mark = (sw_mark *)gl->data; 
    21432160 
    21442161                if ( (mark->frame >= off1) && (mark->frame <= off2) ){ 
     2162                        /* pointer into moving marker */ 
     2163                        sample->tmp_mark =  mark; 
     2164 
     2165                        /* modify data */ 
     2166                        mark->frame = offset; 
     2167#if 0 
     2168                        markdata = g_malloc0 ( sizeof (MarkerData) ); 
    21452169                         
    2146                         s->view->sample->tmp_mark = mark; 
    2147                         mark->frame = offset; 
    2148                          
     2170                        markdata->offset = offset; 
     2171                        markdata->mark_modify = mark; 
     2172 
     2173                        /* register modification */ 
     2174                        perform_marker_immediate_op (sample, _("Modify Time marker"), (SweepFilter)sample_display_mod_marker, NULL, markdata); 
     2175#endif 
    21492176                        mod = TRUE; 
    2150                                                  
    21512177                        break; 
    21522178                } 
     
    24552481      case TOOL_MARKER: 
    24562482        s->selecting = SELECTING_MARKER; 
    2457 //      s->view->hand_offset = x; 
    2458 //      SET_CURSOR(widget, HAND_CLOSE); 
    24592483        sample_display_handle_marker_motion (s, x, y); 
    24602484        break; 
     
    25462570} 
    25472571 
     2572static sw_sample * sample_display_marker_mod (sw_sample * s, sw_param_set unused, sw_view * view) 
     2573{ 
     2574 
     2575 
     2576 
     2577} 
     2578 
    25482579static gint 
    25492580sample_display_button_release (GtkWidget      *widget, 
     
    25652596  case TOOL_SELECT: 
    25662597     
    2567     /* If the user has released the button they were selecting with, 
     2598    /*  
     2599     * If the user has released the button they were selecting with, 
    25682600     * sink this sample's temporary selection. 
    25692601     */ 
     
    25792611    } 
    25802612     
    2581     /* If the user has released the button in a sweep window different 
     2613    /*  
     2614     * If the user has released the button in a sweep window different 
    25822615     * to that used for selection, then sink the appropriate temporary 
    25832616     * selection. 
     
    26022635    s->view->hand_offset = -1; 
    26032636    break; 
     2637 
    26042638  case TOOL_MARKER: 
    26052639    s->view->sample->tmp_mark = NULL; 
     2640     
     2641    s->view->sample->sounddata->marks =  
     2642            marks_resort(s->view->sample->sounddata->marks); 
     2643     
     2644    perform_marker_op (s->view->sample, _("Modify Time marker"), (SweepFilter)sample_display_marker_mod, NULL, s->view); 
     2645 
     2646    info_panel_markers_info_update (s->view->sample); 
     2647 
    26062648    break; 
     2649 
    26072650  case TOOL_MOVE: 
    26082651    break; 
  • sweep/branches/sweep-info-panel/src/samplerate.c

    r444 r463  
    132132 
    133133    sounddata_add_selection_1 (new_sounddata, sel->sel_start * src_ratio, 
    134                                sel->sel_end * src_ratio); 
     134                               sel->sel_end * src_ratio, NULL); 
    135135  } 
    136136  g_mutex_unlock (sample->ops_mutex); 
  • sweep/branches/sweep-info-panel/src/sweep_app.h

    r458 r463  
    105105  sw_framecount_t start, end; /* bounds of visible frames */ 
    106106  sw_audio_t vlow, vhigh; /* bounds of vertical zoom */ 
    107   /* gfloat gain;*/ 
    108   /*gfloat rate;*/ 
     107  /* gfloat gain; */ 
     108  /* gfloat rate; */ 
    109109 
    110110  sw_tool_t current_tool; 
     
    154154  GtkObject * gain_adj; 
    155155  GtkObject * rate_adj; 
     156 
     157  GtkAccelGroup * accel_group; 
    156158 
    157159  GtkWidget * db_rulers_vbox; 
     
    246248  gpointer file_info; /* parameters of original file or last save */ 
    247249 
    248   sw_sel * tmp_sel; /* Temporary selection, used while selecting */ 
     250  sw_sel * tmp_sel;   /* Temporary selection, used while selecting */ 
    249251  sw_mark * tmp_mark; /* Temp marker, used while moving */ 
    250252 
  • sweep/branches/sweep-info-panel/src/sweep_marker.c

    r459 r463  
    3939#include "sample-display.h" 
    4040#include "driver.h" 
     41#include "sweep_app.h" 
     42#include "undo_dialog.h" 
    4143 
    4244#define MARKER_IMG_NUMBER       11 
     
    122124    return; 
    123125 
    124   g_free( mark->name ); 
     126  /* free optional marker name */ 
     127  if (!mark->name) 
     128          g_free( mark->name ); 
     129 
    125130  g_free( mark ); 
     131} 
     132 
     133void 
     134marks_destroy (GList * marks) 
     135{ 
     136  GList * gl; 
     137  sw_mark * mark; 
     138 
     139  for (gl = marks; gl; gl = gl->next){ 
     140          mark = (sw_mark*)gl->data; 
     141          mark_free (mark); 
     142  } 
     143 
     144  g_list_free (marks); 
    126145} 
    127146 
     
    150169          return 0; 
    151170} 
    152  
    153 #if 0 
    154 static void 
    155 dump_marks (GList * marks, char * desc) 
    156 { 
    157 #ifdef DEBUG 
    158   GList * gl; 
    159   sw_mark * mark; 
    160  
    161   printf ("<dump %s (%p)>\n", desc, marks); 
    162   for (gl = marks; gl; gl = gl->next) { 
    163     mark = (sw_mark *)gl->data; 
    164     printf ("\t[%ld - %ld]\n", mark->mark_start, mark->mark_end); 
    165   } 
    166   printf ("</dump>\n"); 
    167 #endif 
    168 } 
    169 #endif 
    170171 
    171172/* 
     
    196197 
    197198GList * 
     199marks_resort (GList * marks) 
     200{ 
     201        return g_list_sort (marks, (GCompareFunc)mark_cmp); 
     202} 
     203 
     204GList * 
    198205marks_add_marker_1 (GList * marks, sw_framecount_t frame, sw_mark_type_t type, gchar * name) 
    199206{ 
     
    230237mark_replace_data_destroy (mark_replace_data * s) 
    231238{ 
    232   g_list_free (s->marks); 
    233   g_free (s); 
     239  if (s){ 
     240          if (s->marks) 
     241                  marks_destroy (s->marks); 
     242           
     243          g_free (s); 
     244  } 
    234245} 
    235246 
     
    237248do_by_mark_replace (sw_sample * s, mark_replace_data * sr) 
    238249{ 
    239 //  dump_marks (sr->marks, "at replace action"); 
    240250  sample_set_markers (s, sr->marks); 
    241  
    242   /*  sample_refresh_views (s);*/ 
    243251} 
    244252 
     
    255263  GList * marks; 
    256264 
     265  /* marks, "copied for undo data" */ 
    257266  marks = marks_copy (sample->sounddata->marks); 
    258 //  dump_marks (marks, "copied for undo data"); 
    259267  inst->undo_data = mark_replace_data_new (marks); 
    260268  set_active_op (sample, inst); 
     
    263271 
    264272  if (sample->edit_state == SWEEP_EDIT_STATE_BUSY) { 
     273    /* marks, "copied for redo data" */ 
    265274    marks = marks_copy (sample->sounddata->marks); 
    266 //    dump_marks (marks, "copied for redo data"); 
    267275    inst->redo_data = mark_replace_data_new (marks); 
    268276 
    269277    register_operation (sample, inst); 
    270278  } 
    271  
    272 #if 0 
    273   sample_set_edit_state (sample, SWEEP_EDIT_STATE_DONE); 
    274 #endif 
    275279} 
    276280 
     
    286290 
    287291sw_op_instance * 
    288 perform_marker_op (sw_sample * sample, char * desc, SweepFilter func, 
     292perform_marker_op (sw_sample * sample, gchar * desc, SweepFilter func, 
    289293                      sw_param_set pset, gpointer custom_data) 
    290294{ 
     
    299303  return NULL; 
    300304} 
     305 
     306/* 
     307 * function preform immediate operation, so no threading, no asynchronous 
     308 * operations, clean and easy. 
     309 */ 
     310void 
     311perform_marker_immediate_op (sw_sample * sample, gchar * desc, SweepFilter func, 
     312                                sw_param_set pset, gpointer custom_data) 
     313{ 
     314  sw_op_instance * inst; 
     315  GList * marks; 
     316 
     317  inst = sw_op_instance_new (sample, desc, &marker_op); 
     318  inst->do_data = custom_data; 
     319 
     320  /* marks, "copied for undo data" */ 
     321  marks = marks_copy (sample->sounddata->marks); 
     322  inst->undo_data = mark_replace_data_new (marks); 
     323  set_active_op (sample, inst); 
     324 
     325  func (sample, pset, custom_data); 
     326 
     327  /* marks, "copied for redo data" */ 
     328  marks = marks_copy (sample->sounddata->marks); 
     329  inst->redo_data = mark_replace_data_new (marks); 
     330 
     331  register_operation (sample, inst); 
     332 
     333  undo_dialog_refresh_history (sample); 
     334} 
     335 
  • sweep/branches/sweep-info-panel/src/sweep_sample.c

    r458 r463  
    13781378} 
    13791379 
     1380void 
     1381sample_clear_markers (sw_sample * s) 
     1382{ 
     1383  sounddata_clear_markers (s->sounddata); 
     1384} 
     1385 
    13801386static void 
    13811387sample_normalise_selection (sw_sample * s) 
     
    13941400 
    13951401sw_sel * 
    1396 sample_add_selection_1 (sw_sample * s, sw_framecount_t start, sw_framecount_t end
    1397 { 
    1398   return sounddata_add_selection_1 (s->sounddata, start, end); 
     1402sample_add_selection_1 (sw_sample * s, sw_framecount_t start, sw_framecount_t end, gchar * name
     1403{ 
     1404  return sounddata_add_selection_1 (s->sounddata, start, end, name); 
    13991405} 
    14001406 
     
    14081414 
    14091415sw_sel * 
    1410 sample_set_selection_1 (sw_sample * s, sw_framecount_t start, sw_framecount_t end) 
    1411 
    1412   return sounddata_set_selection_1 (s->sounddata, start, end); 
    1413 
    1414  
    1415 void 
    1416 sample_selection_modify (sw_sample * s, sw_sel * sel, 
    1417                          sw_framecount_t new_start, sw_framecount_t new_end) 
     1416sample_set_selection_1 (sw_sample * s, sw_framecount_t start,  
     1417                        sw_framecount_t end, gchar * name) 
     1418
     1419  return sounddata_set_selection_1 (s->sounddata, start, end, name); 
     1420
     1421 
     1422void 
     1423sample_selection_modify (sw_sample * s, sw_sel * sel, sw_framecount_t new_start,  
     1424                         sw_framecount_t new_end, gchar * name) 
    14181425{ 
    14191426  sel->sel_start = new_start; 
    14201427  sel->sel_end = new_end; 
     1428  if (!name){ 
     1429          if (!sel->name) 
     1430                  g_free(sel->name); 
     1431 
     1432          sel->name = g_strdup(name); 
     1433  } 
    14211434 
    14221435  sample_normalise_selection (s); 
     
    14341447 
    14351448#if 0 
     1449 
    14361450  sounddata->sels = sels_invert (sounddata->sels, sounddata->nr_frames); 
    14371451 
     
    14391453 
    14401454  if (!sounddata->sels) { 
    1441     sounddata_set_selection_1 (sounddata, 0, sounddata->nr_frames); 
     1455    sounddata_set_selection_1 (sounddata, 0, sounddata->nr_frames, NULL); 
    14421456    goto out; 
    14431457  } 
     
    14481462  sel = osel = (sw_sel *)gl->data; 
    14491463  if (osel->sel_start > 0) { 
    1450     sounddata_add_selection_1 (sounddata, 0, osel->sel_start - 1); 
     1464    sounddata_add_selection_1 (sounddata, 0, osel->sel_start - 1, NULL); 
    14511465  } 
    14521466 
     
    14551469  for (; gl; gl = gl->next) { 
    14561470    sel = (sw_sel *)gl->data; 
    1457     sounddata_add_selection_1 (sounddata, osel->sel_end, sel->sel_start - 1); 
     1471    sounddata_add_selection_1 (sounddata, osel->sel_end, sel->sel_start - 1, NULL); 
    14581472    osel = sel; 
    14591473  } 
    14601474 
    14611475  if (sel->sel_end != sounddata->nr_frames) { 
    1462     sounddata_add_selection_1 (sounddata, sel->sel_end, sounddata->nr_frames); 
    1463   } 
    1464  
     1476    sounddata_add_selection_1 (sounddata, sel->sel_end, sounddata->nr_frames, NULL); 
     1477  } 
     1478 
     1479  /* XXX: memory leakage */ 
    14651480  g_list_free (osels); 
    14661481 
     
    14861501  g_mutex_lock (sounddata->sels_mutex); 
    14871502 
    1488   sounddata_set_selection_1 (sounddata, 0, sounddata->nr_frames); 
     1503  sounddata_set_selection_1 (sounddata, 0, sounddata->nr_frames, NULL); 
    14891504 
    14901505  g_mutex_unlock (sounddata->sels_mutex); 
     
    17031718  n += snprintf (buf+n, BUF_LEN-n, "]"); 
    17041719*/ 
    1705         n = snprintf (buf, BUF_LEN, _("Insert selection")); 
    1706  
    1707 // g_mutex_lock (s->sounddata->sels_mutex); 
     1720  n = snprintf (buf, BUF_LEN, _("Insert selection")); 
    17081721 
    17091722  sel = sel_copy (s->tmp_sel); 
     
    17131726//  last_tmp_view = NULL; 
    17141727 
    1715 //  g_mutex_unlock (s->sounddata->sels_mutex); 
    1716    
    17171728  perform_selection_op (s, buf, ssits, NULL, sel); 
    17181729#undef BUF_LEN 
     
    17591770  n += snprintf (buf+n, BUF_LEN-n, "]"); 
    17601771 
    1761 //  g_mutex_lock (s->sounddata->sels_mutex); 
    1762  
    17631772  sel = sel_copy (s->tmp_sel); 
    17641773 
     
    17671776//  last_tmp_view = NULL; 
    17681777 
    1769 //  g_mutex_unlock (s->sounddata->sels_mutex); 
    1770    
    17711778  perform_selection_op (s, buf, sssts, NULL, sel); 
    17721779} 
     
    18061813  n += snprintf (buf+n, BUF_LEN-n, "]"); 
    18071814*/ 
    1808        n = snprintf (buf, BUF_LEN, _("Set selection")); 
     1815  n = snprintf (buf, BUF_LEN, _("Set selection")); 
    18091816 
    18101817  g_mutex_lock (s->sounddata->sels_mutex); 
     
    18181825 
    18191826  perform_selection_op (s, buf, ssrwts, NULL, sel); 
    1820 
    1821  
     1827#undef BUF_LEN 
     1828
    18221829 
    18231830void 
    18241831sample_set_markers (sw_sample * s, GList * gl) 
    18251832{ 
    1826 /*XXX: Implement  
    1827  * 
    18281833  sample_clear_markers(s); 
    1829  */ 
    18301834 
    18311835  s->sounddata->marks = marks_copy (gl); 
    18321836} 
    1833  
    18341837 
    18351838/* Sample info dialog */ 
  • sweep/branches/sweep-info-panel/src/sweep_selection.c

    r457 r463  
    6363    return; 
    6464 
    65   g_free(sel->name); 
     65  /* free optional selection name */ 
     66  if (!sel->name) 
     67          g_free(sel->name); 
     68 
    6669  g_free(sel); 
     70} 
     71 
     72void 
     73sels_destroy (GList * sels) 
     74{ 
     75  GList * gl; 
     76  sw_sel * sel; 
     77 
     78  for (gl = sels; gl; gl = gl->next){ 
     79          sel = (sw_sel*)gl->data; 
     80          sel_free (sel);  
     81  } 
     82 
     83  g_list_free (sels); 
    6784} 
    6885 
  • sweep/branches/sweep-info-panel/src/sweep_sounddata.c

    r456 r463  
    3535#include <sweep/sweep_typeconvert.h> 
    3636#include <sweep/sweep_selection.h> 
     37#include <sweep/sweep_selection.h> 
     38#include <sweep/sweep_marker.h> 
    3739#include <sweep/sweep_undo.h> 
    3840 
     
    102104sounddata_clear_selection (sw_sounddata * sounddata) 
    103105{ 
    104   g_list_free(sounddata->sels); 
     106/* 
     107  GList * gl; 
     108  sw_sel * sel; 
     109 
     110  for (gl = sounddata->sels; gl; gl = gl->next){ 
     111          sel = (sw_sel*)gl->data; 
     112          sel_free (sel); 
     113  } 
     114 
     115  g_list_free (sounddata->sels); 
     116*/ 
     117  sels_destroy (sounddata->sels); 
    105118 
    106119  sounddata->sels = NULL; 
     120}; 
     121 
     122void 
     123sounddata_clear_markers (sw_sounddata * sounddata) 
     124{ 
     125/* 
     126  GList * gl; 
     127  sw_mark * mark; 
     128 
     129  for (gl = sounddata->marks; gl; gl = gl->next){ 
     130          mark = (sw_mark*)gl->data; 
     131          mark_free (mark); 
     132  } 
     133 
     134  g_list_free (sounddata->marks); 
     135*/ 
     136  marks_destroy (sounddata->marks); 
     137 
     138  sounddata->marks = NULL; 
    107139}; 
    108140 
     
    247279 
    248280  /* Clear the old selection */ 
    249   g_list_free (sounddata->sels); 
     281  sounddata_clear_selection (sounddata); 
    250282 
    251283  /* Set the newly created (normalised) selection */ 
     
    257289sounddata_add_selection (sw_sounddata * sounddata, sw_sel * sel) 
    258290{ 
    259   sounddata->sels = 
    260     g_list_insert_sorted(sounddata->sels, sel, (GCompareFunc)sel_cmp); 
     291  sounddata->sels = sels_add_selection (sounddata->sels, sel); 
     292//    g_list_insert_sorted(sounddata->sels, sel, (GCompareFunc)sel_cmp); 
    261293} 
    262294 
    263295sw_sel * 
    264 sounddata_add_selection_1 (sw_sounddata * sounddata, sw_framecount_t start, sw_framecount_t end
    265 { 
    266   sw_sel * sel; 
    267  
    268   sel = sel_new (start, end, NULL); 
     296sounddata_add_selection_1 (sw_sounddata * sounddata, sw_framecount_t start, sw_framecount_t end, gchar * name
     297{ 
     298  sw_sel * sel; 
     299 
     300  sel = sel_new (start, end, name); 
    269301 
    270302  sounddata_add_selection(sounddata, sel); 
     
    274306 
    275307sw_sel * 
    276 sounddata_set_selection_1 (sw_sounddata * sounddata, sw_framecount_t start, sw_framecount_t end
     308sounddata_set_selection_1 (sw_sounddata * sounddata, sw_framecount_t start, sw_framecount_t end, gchar * name
    277309{ 
    278310  sounddata_clear_selection (sounddata); 
    279311 
    280   return sounddata_add_selection_1 (sounddata, start, end); 
     312  return sounddata_add_selection_1 (sounddata, start, end, name); 
    281313} 
    282314 
  • sweep/branches/sweep-info-panel/src/sweep_undo.c

    r245 r463  
    173173 
    174174  if (sample->ops_thread == (pthread_t) -1) { 
     175/* TODO: GLib'ing threading */ 
    175176    pthread_create (&sample->ops_thread, NULL, (void *) (*op_main), sample); 
    176177  } 
  • sweep/branches/sweep-info-panel/src/undo_dialog.c

    r450 r463  
    193193undo_dialog_refresh_history (sw_sample * sample) 
    194194{ 
    195        info_panel_undos_info_update(sample); 
     195  info_panel_undos_info_update(sample); 
    196196 
    197197  if (sample != ud_sample) 
  • sweep/branches/sweep-info-panel/src/view.c

    r458 r463  
    29322932  view->menu = gtk_menu_new (); 
    29332933  accel_group = create_view_menu (view, view->menu); 
    2934 //  gtk_window_add_accel_group (GTK_WINDOW(view->window), accel_group); 
    2935  
     2934/*  
     2935 * XXX: I can remember accel_group and remove it just before start editing 
     2936 * info-panel treeview data, but there is no "before-edit" signal, so i have to 
     2937 * implement my own 
     2938 * 
     2939  gtk_window_add_accel_group (GTK_WINDOW(view->window), accel_group); 
     2940  view->accel_group = accel_group; 
     2941  g_print("gtk_window_add_accel_group(2): %p\n", accel_group); 
     2942*/ 
    29362943  create_view_menu (view, view->menubar); 
    29372944