Changeset 459

Show
Ignore:
Timestamp:
01/08/07 06:18:35 (2 years ago)
Author:
radekk
Message:

Extending Time markers support, Selections, new icons, drawing name of selections, markers.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • sweep/branches/sweep-info-panel/Makefile.am

    r450 r459  
    55SUBDIRS = m4 intl po include src plugins doc 
    66 
    7 pkgdata_DATA =   sweep_splash.png \ 
    8                  pixmaps/done.png \ 
    9                  pixmaps/sample.png \ 
    10                  pixmaps/select.png \ 
    11                  pixmaps/undo.png \ 
    12                  pixmaps/marker.png \ 
    13                  pixmaps/revert.png 
     7pkgdata_DATA =  sweep_splash.png \ 
     8                pixmaps/done.png \ 
     9                pixmaps/sample.png \ 
     10                pixmaps/select.png \ 
     11                pixmaps/undo.png \ 
     12                pixmaps/marker.png \ 
     13                pixmaps/select-del-ico.png \ 
     14                pixmaps/select-add-ico.png \ 
     15                pixmaps/marker-del-ico.png \ 
     16                pixmaps/marker-add-ico.png 
     17                 
    1418 
    1519desktop_DATA = sweep.desktop 
  • sweep/branches/sweep-info-panel/src/info-panel.c

    r458 r459  
    8080static GdkPixbuf * select_del_icon = NULL; 
    8181static GdkPixbuf * undo_icon = NULL; 
     82static GdkPixbuf * undo_rev_icon = NULL; 
     83static GdkPixbuf * undo_revall_icon = NULL; 
    8284static GdkPixbuf * done_icon = NULL; 
    8385static GdkPixbuf * marker_icon = NULL; 
     
    289291        if (undo_icon == NULL) 
    290292                undo_icon = info_panel_load_icon("undo.png"); 
     293 
     294        if (undo_rev_icon == NULL) 
     295                undo_rev_icon = info_panel_load_icon("undo-rev-ico.png"); 
     296         
     297        if (undo_revall_icon == NULL) 
     298                undo_revall_icon = info_panel_load_icon("undo-revall-ico.png"); 
     299 
    291300        gtk_tree_store_append(treestore, &toplevel, NULL); 
    292301        gtk_tree_store_set(treestore, &toplevel, 
     
    299308        gtk_tree_store_set(treestore, &child, 
    300309                INFO_PANEL_UNDOS_COL_NAME, _("Original data"), 
    301                 INFO_PANEL_UNDOS_COL_TYPE, INFO_PANEL_UNDO_ITEM
     310                INFO_PANEL_UNDOS_COL_TYPE, INFO_PANEL_UNDO_ITEM_ORIG
    302311                INFO_PANEL_UNDOS_COL_ICON, done_icon, 
    303312                -1); 
     
    535544 
    536545                        gtk_tree_store_set(GTK_TREE_STORE(info_panel), &child, 
    537                                                 INFO_PANEL_SELECTIONS_COL_NAME, _("temp"), 
     546                                                INFO_PANEL_SELECTIONS_COL_NAME, _("TempSel"), 
    538547                                                -1); 
    539548 
     
    554563                        sel = (sw_sel *)gl->data; 
    555564                         
    556                         g_snprintf (buf, BUF_LEN, "#%d", nn++);  
     565                        g_snprintf (buf, BUF_LEN, _("Selection#%d"), nn++);  
    557566                         
    558567                        snprint_time(start, BUF_LEN, frames_to_time (sample->sounddata->format, sel->sel_start)); 
     
    717726                        gtk_tree_store_set(GTK_TREE_STORE(info_panel), &child_data, 
    718727                                                INFO_PANEL_MARKERS_COL_TYPE, INFO_PANEL_MARKERS_FRAME, 
    719                                                 INFO_PANEL_MARKERS_COL_NAME, "Time", 
     728                                                INFO_PANEL_MARKERS_COL_NAME, _("Frame"), 
     729                                                -1); 
     730                         
     731                        gtk_tree_model_iter_next(info_panel, &child_data); 
     732                        gtk_tree_store_append(GTK_TREE_STORE(info_panel), &child_data, &child); 
     733                        gtk_tree_store_set(GTK_TREE_STORE(info_panel), &child_data, 
     734                                                INFO_PANEL_MARKERS_COL_TYPE, INFO_PANEL_MARKERS_TYPE, 
     735                                                INFO_PANEL_MARKERS_COL_NAME, _("Type"), 
    720736                                                -1); 
    721737                         
     
    724740                        gtk_tree_store_set(GTK_TREE_STORE(info_panel), &child_data, 
    725741                                                INFO_PANEL_MARKERS_COL_TYPE, INFO_PANEL_MARKERS_COLOR, 
    726                                                 INFO_PANEL_MARKERS_COL_NAME, "Color", 
    727                                                 -1); 
    728                          
    729                         gtk_tree_model_iter_next(info_panel, &child_data); 
    730                         gtk_tree_store_append(GTK_TREE_STORE(info_panel), &child_data, &child); 
    731                         gtk_tree_store_set(GTK_TREE_STORE(info_panel), &child_data, 
    732                                                 INFO_PANEL_MARKERS_COL_TYPE, INFO_PANEL_MARKERS_TYPE, 
    733                                                 INFO_PANEL_MARKERS_COL_NAME, "Type", 
     742                                                INFO_PANEL_MARKERS_COL_NAME, _("Color"), 
    734743                                                -1); 
    735744                } 
     
    767776                        mark = (sw_mark *)gl->data; 
    768777                         
    769                         g_snprintf (buf, BUF_LEN, "#%d", nn++);  
     778                        g_snprintf (buf, BUF_LEN, _("Marker#%d"), nn++);  
    770779                         
    771780                        snprint_time(mtime, BUF_LEN, frames_to_time (sample->sounddata->format, mark->frame)); 
     
    773782                        gtk_tree_store_set(GTK_TREE_STORE(info_panel), &child, 
    774783                                        INFO_PANEL_MARKERS_COL_NAME, mark->name ? mark->name : buf, 
    775 //                                    INFO_PANEL_MARKERS_COL_VALUE, mtime, 
     784                                      INFO_PANEL_MARKERS_COL_VALUE, mtime, 
    776785                                        INFO_PANEL_MARKERS_COL_POINTER, gl, 
    777786                                        INFO_PANEL_MARKERS_COL_EDITABLE_NAME, TRUE, 
     
    780789                        gtk_tree_model_iter_children (info_panel, &child_data, &child); 
    781790 
     791                        g_snprintf (buf, BUF_LEN, "%d", mark->frame); 
    782792                        gtk_tree_store_set(GTK_TREE_STORE(info_panel), &child_data, 
    783                                         INFO_PANEL_MARKERS_COL_VALUE, mtime
     793                                        INFO_PANEL_MARKERS_COL_VALUE, buf
    784794                                        INFO_PANEL_MARKERS_COL_EDITABLE_VALUE, TRUE, 
    785795                                        -1); 
    786796                         
    787797                        gtk_tree_model_iter_next(info_panel, &child_data); 
     798 
     799                        g_snprintf (buf, BUF_LEN, "%d", mark->color); 
    788800                        gtk_tree_store_set(GTK_TREE_STORE(info_panel), &child_data, 
    789                                         INFO_PANEL_MARKERS_COL_VALUE, mtime
     801                                        INFO_PANEL_MARKERS_COL_VALUE, buf
    790802                                        INFO_PANEL_MARKERS_COL_EDITABLE_VALUE, TRUE, 
    791803                                        -1); 
    792804                         
    793805                        gtk_tree_model_iter_next(info_panel, &child_data); 
     806                        g_snprintf (buf, BUF_LEN, "%d", mark->type); 
    794807                        gtk_tree_store_set(GTK_TREE_STORE(info_panel), &child_data, 
    795                                         INFO_PANEL_MARKERS_COL_VALUE, mtime
     808                                        INFO_PANEL_MARKERS_COL_VALUE, buf
    796809                                        INFO_PANEL_MARKERS_COL_EDITABLE_VALUE, TRUE, 
    797810                                        -1); 
     
    11531166        menu = gtk_menu_new(); 
    11541167 
    1155         menuitem = gtk_menu_item_new_with_label(_("Revert to Original data")); 
     1168        menuitem = info_panel_menu_item_new_with_ico_label (_("Revert to Original data"), undo_revall_icon); 
    11561169 
    11571170        g_signal_connect(menuitem, "activate", 
     
    11781191        menu = gtk_menu_new(); 
    11791192 
    1180         menuitem = gtk_menu_item_new_with_label(_("Revert to selected state")); 
     1193        menuitem = info_panel_menu_item_new_with_ico_label (_("Revert to selected state"), undo_rev_icon); 
    11811194 
    11821195        data = g_malloc(sizeof(PopupData)); 
     
    12961309        menu = gtk_menu_new(); 
    12971310 
    1298         menuitem = info_panel_menu_item_new_with_ico_label(_("Add Time Marker..."), marker_add_icon); 
     1311        menuitem = info_panel_menu_item_new_with_ico_label(_("Add Time Marker"), marker_add_icon); 
    12991312 
    13001313        g_signal_connect(menuitem, "activate", 
     
    13251338void info_panel_markers_item_popup_menu (GtkWidget *treeview, GdkEventButton *event, sw_view * view) 
    13261339{ 
    1327 #if 0 
    13281340        GtkWidget *menu, *menuitem; 
    13291341        PopupData * data; 
     
    13311343        menu = gtk_menu_new(); 
    13321344 
    1333         menuitem = gtk_menu_item_new_with_label(_("Delete Selection")); 
     1345        menuitem = info_panel_menu_item_new_with_ico_label(_("Delete Time Marker"), marker_del_icon); 
    13341346 
    13351347        data = g_malloc(sizeof(PopupData)); 
     
    13371349        data->view = view; 
    13381350        data->treeview = GTK_TREE_VIEW(treeview); 
    1339        
     1351/*     
    13401352        g_signal_connect(menuitem, "activate", 
    1341                                  (GCallback) info_panel_delete_selection_cb, data); 
    1342  
     1353                                 (GCallback) info_panel_delete_marker_cb, data); 
     1354*/ 
    13431355        gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); 
    13441356 
     
    13511363                               (event != NULL) ? event->button : 0, 
    13521364                                gdk_event_get_time((GdkEvent*)event)); 
    1353 #endif 
    13541365} 
    13551366 
     
    14101421        GtkTreeModel * model; 
    14111422        GtkTreePath * path; 
    1412         GtkTreeIter iter
     1423        GtkTreeIter iter, parent
    14131424        gint type; 
    14141425 
     
    14401451                 
    14411452                                info_panel_undo_item_popup_menu(treeview, event, view); 
     1453 
     1454                                break; 
     1455                        case INFO_PANEL_UNDO_ITEM_ORIG: 
     1456                                 
     1457                                gtk_tree_model_iter_parent (model, &parent, &iter); 
     1458                                 
     1459                                if ((gtk_tree_model_iter_n_children(model, &parent) > 1) && (view->sample->current_undo)) 
     1460                                        info_panel_undo_item_popup_menu(treeview, event, view); 
    14421461 
    14431462                                break; 
  • sweep/branches/sweep-info-panel/src/info-panel.h

    r458 r459  
    9595{ 
    9696        INFO_PANEL_UNDOS = 1, 
    97         INFO_PANEL_UNDO_ITEM 
     97        INFO_PANEL_UNDO_ITEM, 
     98        INFO_PANEL_UNDO_ITEM_ORIG 
    9899} info_panel_undos_type_t; 
    99100 
  • sweep/branches/sweep-info-panel/src/sample-display.c

    r458 r459  
    6262 
    6363 
    64 /* Whether or not to compile in support for 
     64/*  
     65 * Whether or not to compile in support for 
    6566 * drawing the crossing vectors 
    6667 */ 
     
    123124 
    124125static const int default_colors[] = { 
    125   200, 200, 193, /* bg */ 
    126   199, 203, 158, /* fg */ 
    127   0, 0xaa, 0, /* play (mask) */ 
     126  200, 200, 193, /* bg */ 
     127  199, 203, 158, /* fg */ 
     128  0, 0xaa, 0,    /* play (mask) */ 
    128129  220, 230, 255, /* user */ 
    129130  100, 100, 100, /* zero */ 
     
    131132  110, 110, 100, /* tmp_sel XOR mask */ 
    132133#if 1 
    133   108, 115, 134,    /* sel bg */ 
     134  108, 115, 134, /* sel bg */ 
    134135#else 
    135   62, 68, 118,  /* sel bg */ 
     136  62, 68, 118,  /* sel bg */ 
    136137#endif 
    137138  166, 166, 154, /* minmax */ 
     
    139140  81, 101, 81,   /* lowlight */ 
    140141  230, 0, 0,     /* rec */ 
    141   0, 0, 0,     /* relief */ 
     142  0, 0, 0,       /* relief */ 
     143  0, 0, 0,       /* tmp_sel_text */ 
     144  255, 255, 255, /* sel_text */ 
     145  240, 240, 240, /* mark_text */ 
    142146}; 
    143147 
     
    150154  220, 220, 210, /* bg */ 
    151155#else 
    152   200, 200, 193,    /* bg */ 
     156  200, 200, 193, /* bg */ 
    153157#endif 
    154158  199, 203, 158, /* fg */ 
     
    163167  81, 101, 81,   /* lowlight */ 
    164168  240, 0, 0,     /* rec */ 
    165   0, 0, 0,     /* relief */ 
     169  0, 0, 0,       /* relief */ 
     170  0, 0, 0,       /* tmp_sel_text */ 
     171  255, 255, 255, /* sel_text */ 
     172  240, 240, 240, /* mark_text */ 
    166173}; 
    167174#endif 
     
    203210}; 
    204211 
     212//extern const int mark_colors[]; 
     213extern GdkPixbuf * mark_icons[]; 
     214 
    205215/* Values for s->selecting */ 
    206216enum { 
     
    468478      gtk_widget_queue_draw_area (GTK_WIDGET(s), x, s->height - 1, x2 - x, 1); 
    469479    } 
     480  } 
     481} 
     482 
     483static void 
     484sample_display_refresh_marks (SampleDisplay * s) 
     485{ 
     486  int x, x2; 
     487  sw_sample * sample; 
     488  GList * gl; 
     489  sw_mark * mark; 
     490 
     491  g_return_if_fail(s != NULL); 
     492  g_return_if_fail(IS_SAMPLE_DISPLAY(s)); 
     493 
     494  if(!IS_INITIALIZED(s)) 
     495    return; 
     496 
     497  sample = s->view->sample; 
     498 
     499  for (gl = sample->sounddata->marks; gl; gl = gl->next) { 
     500    mark = (sw_mark *)gl->data; 
     501/* 
     502    x = OFFSET_TO_XPOS(mark->frame); 
     503 
     504    if ((x >= 0) && (x <= s->width)) { 
     505      gtk_widget_queue_draw_area (GTK_WIDGET(s), x, 0, 1, s->height); 
     506    } 
     507    if ((x2 >= 0) && (x2 <= s->width)) { 
     508      gtk_widget_queue_draw_area (GTK_WIDGET(s), x2, 0, 1, s->height); 
     509    } 
     510 
     511    if ((x <= s->width) && (x2 >= 0)) { 
     512      x = CLAMP (x, 0, s->width); 
     513      x2 = CLAMP (x2, 0, s->width); 
     514      gtk_widget_queue_draw_area (GTK_WIDGET(s), x, 0, x2 - x, 1); 
     515      gtk_widget_queue_draw_area (GTK_WIDGET(s), x, s->height - 1, x2 - x, 1); 
     516    } 
     517*/ 
    470518  } 
    471519} 
     
    792840  s->marks_relief_gc = gdk_gc_new (widget->window); 
    793841  gdk_gc_set_foreground(s->marks_relief_gc, &SAMPLE_DISPLAY_CLASS(GTK_WIDGET_GET_CLASS(widget))->colors[SAMPLE_DISPLAYCOL_MARKS_RELIEF]); 
     842   
     843  s->tmp_sel_text_gc = gdk_gc_new(widget->window); 
     844  gdk_gc_set_foreground(s->tmp_sel_text_gc, &SAMPLE_DISPLAY_CLASS(GTK_WIDGET_GET_CLASS(widget))->colors[SAMPLE_DISPLAYCOL_TMPSEL_TEXT]); 
     845  gdk_gc_set_function (s->tmp_sel_text_gc, GDK_XOR); 
     846 
     847  s->sel_text_gc = gdk_gc_new(widget->window); 
     848  gdk_gc_set_foreground(s->sel_text_gc, &SAMPLE_DISPLAY_CLASS(GTK_WIDGET_GET_CLASS(widget))->colors[SAMPLE_DISPLAYCOL_SEL_TEXT]); 
     849  gdk_gc_set_function (s->sel_text_gc, GDK_XOR); 
     850 
     851  s->mark_text_gc = gdk_gc_new(widget->window); 
     852  gdk_gc_set_foreground(s->mark_text_gc, &SAMPLE_DISPLAY_CLASS(GTK_WIDGET_GET_CLASS(widget))->colors[SAMPLE_DISPLAYCOL_MARK_TEXT]); 
    794853 
    795854  sample_display_init_display(s, attributes.width, attributes.height); 
     
    834893 
    835894    x1 = OFFSET_TO_XPOS(sel->sel_start); 
    836     x1 = CLAMP(x1, x, x+width); 
     895    x1 = CLAMP(x1, x, x + width); 
    837896 
    838897    x2 = OFFSET_TO_XPOS(sel->sel_end); 
    839     x2 = CLAMP(x2, x, x+width); 
     898    x2 = CLAMP(x2, x, x + width); 
    840899 
    841900    if (x2 - x1 > 1){  
     
    851910    if (sel->sel_start != sel->sel_end) { 
    852911      x1 = OFFSET_TO_XPOS(sel->sel_start); 
    853       x1 = CLAMP(x1, x, x+width); 
     912      x1 = CLAMP(x1, x, x + width); 
    854913       
    855914      x2 = OFFSET_TO_XPOS(sel->sel_end); 
    856       x2 = CLAMP(x2, x, x+width); 
     915      x2 = CLAMP(x2, x, x + width); 
    857916       
    858917      if (x2 - x1 > 1) { 
    859         gdk_draw_rectangle (win, s->tmp_sel_gc, TRUE, 
     918               gdk_draw_rectangle (win, s->tmp_sel_gc, TRUE, 
    860919                            x1, y, x2 - x1, y + height -1); 
    861920      } 
     
    12001259 
    12011260static void 
    1202 sample_display_draw_sel_box(GdkDrawable * win, 
     1261sample_display_draw_sel_box (GdkDrawable * win, 
    12031262                            GdkGC * gc, 
    12041263                            const SampleDisplay * s, 
    1205                             int x, 
    1206                             int width, 
    1207                             int draw_left, int draw_right) 
     1264                            gint x, 
     1265                            gint width, 
     1266                            gboolean draw_left, gboolean draw_right) 
    12081267{ 
    12091268  if (width <= 0) { 
     
    12121271  } 
    12131272 
    1214   /* Must draw individual lines for these: if you optimise by 
     1273  /*  
     1274   * Must draw individual lines for these: if you optimise by 
    12151275   * drawing a rectangle where possible, the marching ants go 
    12161276   * crazy. We don't want that to happen, they are cute. 
     
    12191279  gdk_draw_line(win, gc, 
    12201280                x, 0, 
    1221                 x+width, 0); 
     1281                x + width, 0); 
     1282   
    12221283  gdk_draw_line(win, gc, 
    1223                   x, s->height - 1, 
    1224                 x+width, s->height - 1); 
     1284                x, s->height - 1, 
     1285                x + width, s->height - 1); 
     1286   
    12251287  if (draw_left) { 
    1226     gdk_draw_line(win, gc, 
     1288       gdk_draw_line(win, gc, 
    12271289                  x, 0, 
    12281290                  x, s->height - 1); 
     
    12331295#endif 
    12341296  } 
     1297   
    12351298  if (draw_right) { 
    12361299    gdk_draw_line(win, gc, 
     
    12401303#ifdef DRAW_CROSSING_VECTORS 
    12411304    /* crossing vector */ 
    1242     sample_display_draw_crossing_vector (win, gc, s, x+width); 
     1305    sample_display_draw_crossing_vector (win, gc, s, x + width); 
    12431306#endif 
    12441307  } 
     
    12531316  GList * gl; 
    12541317  sw_sel * sel; 
    1255   int x, x2; 
    1256   int l_end, r_end; /* draw left + right ends of sel */ 
     1318  int xs, xe; 
     1319  gboolean l_end, r_end; /* draw left + right ends of sel */ 
     1320  PangoLayout *layout; 
     1321  PangoRectangle logical_rect, ink_rect; 
     1322 
     1323  layout = gtk_widget_create_pango_layout (GTK_WIDGET(s), NULL); 
    12571324 
    12581325  /* Draw real selection */ 
     
    12601327    sel = (sw_sel *)gl->data; 
    12611328 
    1262     x = OFFSET_TO_XPOS(sel->sel_start); 
    1263     x2 = OFFSET_TO_XPOS(sel->sel_end); 
    1264  
    1265     if (x > x_max) break; 
    1266     if (x2 < x_min) continue; 
    1267  
    1268     l_end = (x >= x_min) && (x <= x_max); 
    1269     x = CLAMP (x, x_min, x_max); 
    1270      
    1271     r_end = (x2 >= x_min) && (x2 <= x_max); 
    1272     x2 = CLAMP (x2, x_min, x_max); 
     1329    xs = OFFSET_TO_XPOS(sel->sel_start); 
     1330    xe = OFFSET_TO_XPOS(sel->sel_end); 
     1331 
     1332    if (xs > x_max) break; 
     1333    if (xe < x_min) continue; 
     1334 
     1335    l_end = (xs >= x_min) && (xs <= x_max); 
     1336    xs = CLAMP (xs, x_min, x_max); 
     1337 
     1338    r_end = (xe >= x_min) && (xe <= x_max); 
     1339    xe = CLAMP (xe, x_min, x_max); 
    12731340     
    12741341    /* draw the selection */ 
    1275     sample_display_draw_sel_box(win, s->sel_gc, 
    1276                                 s, x, x2 - x - 1, 
    1277                                 l_end, r_end /* draw_ends */); 
    1278  
    1279  
     1342    sample_display_draw_sel_box (win, s->sel_gc, 
     1343                                                        s, xs, xe - xs - 1, 
     1344                                                        l_end, r_end /* draw_ends */); 
     1345 
     1346    if ( sel->name != NULL ){ 
     1347                pango_layout_set_text (layout, sel->name, -1); 
     1348                pango_layout_get_extents (layout, &ink_rect, &logical_rect); 
     1349 
     1350                gdk_draw_layout (win, s->sel_text_gc, 
     1351                                xs + 1, 0, 
     1352                                layout); 
     1353        } 
    12801354  } 
    12811355 
     
    12841358 
    12851359  if (sel) { 
    1286     x = OFFSET_TO_XPOS(sel->sel_start); 
    1287     l_end = (x >= x_min) && (x <= x_max); 
    1288     x = CLAMP (x, x_min, x_max); 
    1289  
    1290     x2 = OFFSET_TO_XPOS(sel->sel_end); 
    1291     r_end = (x2 >= x_min) && (x2 <= x_max); 
    1292     x2 = CLAMP (x2, x_min, x_max); 
     1360    xs = OFFSET_TO_XPOS(sel->sel_start); 
     1361    l_end = (xs >= x_min) && (xs <= x_max); 
     1362    xs = CLAMP (xs, x_min, x_max); 
     1363 
     1364    xe = OFFSET_TO_XPOS(sel->sel_end); 
     1365    r_end = (xe >= x_min) && (xe <= x_max); 
     1366    xe = CLAMP (xe, x_min, x_max); 
    12931367 
    12941368    /* draw the selection */ 
    12951369    sample_display_draw_sel_box(win, s->tmp_sel_gc, 
    1296                                 s, x, x2 - x - 1, 
     1370                                s, xs, xe - xs - 1, 
    12971371                                l_end, r_end /* draw_ends */); 
    1298   } 
     1372 
     1373        pango_layout_set_text (layout, _("TempSel"), -1); 
     1374 
     1375        gdk_draw_layout (win, s->tmp_sel_text_gc, 
     1376                                xs + 1, 0, 
     1377                                layout); 
     1378  } 
     1379 
     1380  g_object_unref (layout); 
     1381 
    12991382} 
    13001383 
     
    13121395  int x, x1, x2; 
    13131396  PangoLayout *layout; 
    1314 //  PangoRectangle logical_rect, ink_rect; 
     1397  PangoRectangle logical_rect, ink_rect; 
    13151398 
    13161399  layout = gtk_widget_create_pango_layout (GTK_WIDGET(s), NULL); 
    13171400 
    13181401  for (gl = sample->sounddata->marks; gl; gl = gl->next) { 
     1402 
    13191403    mark = (sw_mark *)gl->data; 
    13201404 
    1321  
    13221405    x = OFFSET_TO_XPOS(mark->frame); 
    13231406 
    1324     if ((x <= x_max) || (x >= x_min)){ 
    1325  
    1326             x1 = CLAMP (x - 3, x_min, x_max); 
     1407    x1 = x - 3; 
     1408 
     1409    if ( mark->name != NULL ){ 
     1410           pango_layout_set_text (layout, mark->name, -1); 
     1411           pango_layout_get_extents (layout, &ink_rect, &logical_rect); 
     1412           x2 = x + 3 + PANGO_PIXELS (ink_rect.width); 
     1413    } else { 
     1414           x2 = x + 3; 
     1415    } 
     1416 
     1417//    g_print("xmin: %d xmax:%d x1:%d x2:%d\n", x_min, x_max, x1, x2); 
     1418 
     1419    if ( ((x1 >= x_min) && (x1 <= x_max)) || 
     1420                 ((x2 >= x_min) && (x2 <= x_max)) || 
     1421                 ((x1 <= x_min) && (x2 >= x_max)) ){ 
     1422/* 
     1423            x1 = CLAMP (x1, x_min, x_max); 
    13271424            x2 = CLAMP (x + 3, x_min, x_max); 
     1425*/ 
     1426            x2 = x + 3; 
    13281427 
    13291428            gdk_draw_line(win, s->marks_gcs[mark->color], 
     
    13501449            gdk_draw_polygon (win, s->marks_relief_gc, FALSE, poly, 5); 
    13511450 
    1352             if ( mark->name != NULL ){ 
    1353                     pango_layout_set_text (layout, mark->name, -1); 
    1354  
    1355                     gtk_paint_layout (GTK_WIDGET(s)->style, 
    1356                                     win, GTK_WIDGET_STATE (GTK_WIDGET(s)), 
    1357                                     FALSE, NULL, 
    1358                                     GTK_WIDGET(s), NULL, 
    1359                                     x2 + 2, -3, 
    1360                                     layout); 
     1451            if ( mark->name != NULL ){ 
     1452                        gdk_draw_layout (win, s->fg_gc, 
     1453                                x2 + 2, 0, 
     1454                                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*/ 
    13611463            } 
    13621464    } 
     
    16441746 
    16451747    /* draw the sample graph */ 
    1646     sample_display_draw_data(drawable, s, x_min, x_max - x_min); 
     1748    sample_display_draw_data (drawable, s, x_min, x_max - x_min); 
    16471749 
    16481750    /* draw the selection bounds */ 
     
    20372139  } else { 
    20382140          for ( gl = s->view->sample->sounddata->marks; gl; gl = gl->next){ 
    2039                 g_print ("Mark found: %p\n", gl->data); 
    20402141         
    20412142                mark = (sw_mark *)gl->data; 
    20422143 
    20432144                if ( (mark->frame >= off1) && (mark->frame <= off2) ){ 
    2044                         g_print ("mamy cię!\n"); 
    20452145                         
    20462146                        s->view->sample->tmp_mark = mark; 
  • sweep/branches/sweep-info-panel/src/sample-display.h

    r458 r459  
    5050  SAMPLE_DISPLAYCOL_REC, 
    5151  SAMPLE_DISPLAYCOL_MARKS_RELIEF, 
     52  SAMPLE_DISPLAYCOL_TMPSEL_TEXT, 
     53  SAMPLE_DISPLAYCOL_SEL_TEXT, 
     54  SAMPLE_DISPLAYCOL_MARK_TEXT, 
    5255  SAMPLE_DISPLAYCOL_LAST 
    5356}; 
     
    5760  GtkWidget widget; 
    5861 
    59   GdkGC *bg_gc, *fg_gc, *play_gc, *user_gc, *rec_gc, *sel_gc, *tmp_sel_gc, 
    60     *crossing_gc; 
     62  GdkGC *bg_gc, *fg_gc, *play_gc, *user_gc, *rec_gc, *sel_gc, *tmp_sel_gc; 
     63  GdkGC *crossing_gc, *tmp_sel_text_gc, *sel_text_gc, *mark_text_gc; 
    6164  GdkGC *minmax_gc, *zeroline_gc, *highlight_gc, *lowlight_gc; 
    6265 
  • sweep/branches/sweep-info-panel/src/sweep_marker.c

    r458 r459  
    3333#include <sweep/sweep_marker.h> 
    3434 
     35#include <sweep/sweep_i18n.h> 
     36 
    3537#include "format.h" 
    3638#include "view.h" 
    3739#include "sample-display.h" 
    3840#include "driver.h" 
     41 
     42#define MARKER_IMG_NUMBER       11 
     43 
     44static const int mark_colors[] = { 
     45  255,     0,   0, 
     46    0,   255,   0, 
     47    0,     0, 255, 
     48  255,     0, 255, 
     49  255,   127,   0, 
     50    0,   255, 255, 
     51  127,     0, 255, 
     52  255,   255,   0, 
     53  127,   127, 127, 
     54  255,     0, 127, 
     55    0,   127, 255, 
     56}; 
     57 
     58static GdkPixbuf * mark_icons[] = {  
     59  NULL, 
     60  NULL, 
     61  NULL, 
     62  NULL, 
     63  NULL, 
     64  NULL, 
     65  NULL, 
     66  NULL, 
     67  NULL, 
     68  NULL, 
     69  NULL, 
     70}; 
     71 
     72void sweep_load_marker_icons ( void ) 
     73{ 
     74#define BUF_LEN 256 
     75  gint a; 
     76  GdkPixbuf * icon; 
     77  GError *error = NULL; 
     78  gchar buf[BUF_LEN]; 
     79 
     80  if (mark_icons[0] == NULL){ 
     81 
     82        for (a = 0; a < MARKER_IMG_NUMBER; a++){ 
     83 
     84                g_snprintf(buf, BUF_LEN, "%s/marker-img%d.png", PACKAGE_DATA_DIR, a); 
     85 
     86                icon = gdk_pixbuf_new_from_file(buf, &error); 
     87 
     88                if (error) { 
     89                        g_warning("%s: %s: %s\n", G_STRLOC, _("Could not load icon"), error->message); 
     90                        g_error_free(error); 
     91                        error = NULL; 
     92                } 
     93 
     94                mark_icons[a] = icon; 
     95        } 
     96 } 
     97#undef BUF_LEN 
     98}; 
    3999 
    40100sw_mark *