Changeset 459
- Timestamp:
- 01/08/07 06:18:35 (2 years ago)
- Files:
-
- sweep/branches/sweep-info-panel/Makefile.am (modified) (1 diff)
- sweep/branches/sweep-info-panel/pixmaps/done.png (modified) (previous)
- sweep/branches/sweep-info-panel/pixmaps/marker-img0.png (added)
- sweep/branches/sweep-info-panel/pixmaps/marker-img1.png (added)
- sweep/branches/sweep-info-panel/pixmaps/marker-img10.png (added)
- sweep/branches/sweep-info-panel/pixmaps/marker-img2.png (added)
- sweep/branches/sweep-info-panel/pixmaps/marker-img3.png (added)
- sweep/branches/sweep-info-panel/pixmaps/marker-img4.png (added)
- sweep/branches/sweep-info-panel/pixmaps/marker-img5.png (added)
- sweep/branches/sweep-info-panel/pixmaps/marker-img6.png (added)
- sweep/branches/sweep-info-panel/pixmaps/marker-img7.png (added)
- sweep/branches/sweep-info-panel/pixmaps/marker-img8.png (added)
- sweep/branches/sweep-info-panel/pixmaps/marker-img9.png (added)
- sweep/branches/sweep-info-panel/pixmaps/undo-rev-ico.png (added)
- sweep/branches/sweep-info-panel/pixmaps/undo-revall-ico.png (added)
- sweep/branches/sweep-info-panel/pixmaps/undo.png (modified) (previous)
- sweep/branches/sweep-info-panel/src/info-panel.c (modified) (19 diffs)
- sweep/branches/sweep-info-panel/src/info-panel.h (modified) (1 diff)
- sweep/branches/sweep-info-panel/src/sample-display.c (modified) (23 diffs)
- sweep/branches/sweep-info-panel/src/sample-display.h (modified) (2 diffs)
- sweep/branches/sweep-info-panel/src/sweep_marker.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
sweep/branches/sweep-info-panel/Makefile.am
r450 r459 5 5 SUBDIRS = m4 intl po include src plugins doc 6 6 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 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/select-del-ico.png \ 14 pixmaps/select-add-ico.png \ 15 pixmaps/marker-del-ico.png \ 16 pixmaps/marker-add-ico.png 17 14 18 15 19 desktop_DATA = sweep.desktop sweep/branches/sweep-info-panel/src/info-panel.c
r458 r459 80 80 static GdkPixbuf * select_del_icon = NULL; 81 81 static GdkPixbuf * undo_icon = NULL; 82 static GdkPixbuf * undo_rev_icon = NULL; 83 static GdkPixbuf * undo_revall_icon = NULL; 82 84 static GdkPixbuf * done_icon = NULL; 83 85 static GdkPixbuf * marker_icon = NULL; … … 289 291 if (undo_icon == NULL) 290 292 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 291 300 gtk_tree_store_append(treestore, &toplevel, NULL); 292 301 gtk_tree_store_set(treestore, &toplevel, … … 299 308 gtk_tree_store_set(treestore, &child, 300 309 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, 302 311 INFO_PANEL_UNDOS_COL_ICON, done_icon, 303 312 -1); … … 535 544 536 545 gtk_tree_store_set(GTK_TREE_STORE(info_panel), &child, 537 INFO_PANEL_SELECTIONS_COL_NAME, _(" temp"),546 INFO_PANEL_SELECTIONS_COL_NAME, _("TempSel"), 538 547 -1); 539 548 … … 554 563 sel = (sw_sel *)gl->data; 555 564 556 g_snprintf (buf, BUF_LEN, "#%d", nn++);565 g_snprintf (buf, BUF_LEN, _("Selection#%d"), nn++); 557 566 558 567 snprint_time(start, BUF_LEN, frames_to_time (sample->sounddata->format, sel->sel_start)); … … 717 726 gtk_tree_store_set(GTK_TREE_STORE(info_panel), &child_data, 718 727 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"), 720 736 -1); 721 737 … … 724 740 gtk_tree_store_set(GTK_TREE_STORE(info_panel), &child_data, 725 741 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"), 734 743 -1); 735 744 } … … 767 776 mark = (sw_mark *)gl->data; 768 777 769 g_snprintf (buf, BUF_LEN, "#%d", nn++);778 g_snprintf (buf, BUF_LEN, _("Marker#%d"), nn++); 770 779 771 780 snprint_time(mtime, BUF_LEN, frames_to_time (sample->sounddata->format, mark->frame)); … … 773 782 gtk_tree_store_set(GTK_TREE_STORE(info_panel), &child, 774 783 INFO_PANEL_MARKERS_COL_NAME, mark->name ? mark->name : buf, 775 //INFO_PANEL_MARKERS_COL_VALUE, mtime,784 INFO_PANEL_MARKERS_COL_VALUE, mtime, 776 785 INFO_PANEL_MARKERS_COL_POINTER, gl, 777 786 INFO_PANEL_MARKERS_COL_EDITABLE_NAME, TRUE, … … 780 789 gtk_tree_model_iter_children (info_panel, &child_data, &child); 781 790 791 g_snprintf (buf, BUF_LEN, "%d", mark->frame); 782 792 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, 784 794 INFO_PANEL_MARKERS_COL_EDITABLE_VALUE, TRUE, 785 795 -1); 786 796 787 797 gtk_tree_model_iter_next(info_panel, &child_data); 798 799 g_snprintf (buf, BUF_LEN, "%d", mark->color); 788 800 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, 790 802 INFO_PANEL_MARKERS_COL_EDITABLE_VALUE, TRUE, 791 803 -1); 792 804 793 805 gtk_tree_model_iter_next(info_panel, &child_data); 806 g_snprintf (buf, BUF_LEN, "%d", mark->type); 794 807 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, 796 809 INFO_PANEL_MARKERS_COL_EDITABLE_VALUE, TRUE, 797 810 -1); … … 1153 1166 menu = gtk_menu_new(); 1154 1167 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); 1156 1169 1157 1170 g_signal_connect(menuitem, "activate", … … 1178 1191 menu = gtk_menu_new(); 1179 1192 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); 1181 1194 1182 1195 data = g_malloc(sizeof(PopupData)); … … 1296 1309 menu = gtk_menu_new(); 1297 1310 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); 1299 1312 1300 1313 g_signal_connect(menuitem, "activate", … … 1325 1338 void info_panel_markers_item_popup_menu (GtkWidget *treeview, GdkEventButton *event, sw_view * view) 1326 1339 { 1327 #if 01328 1340 GtkWidget *menu, *menuitem; 1329 1341 PopupData * data; … … 1331 1343 menu = gtk_menu_new(); 1332 1344 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); 1334 1346 1335 1347 data = g_malloc(sizeof(PopupData)); … … 1337 1349 data->view = view; 1338 1350 data->treeview = GTK_TREE_VIEW(treeview); 1339 1351 /* 1340 1352 g_signal_connect(menuitem, "activate", 1341 (GCallback) info_panel_delete_ selection_cb, data);1342 1353 (GCallback) info_panel_delete_marker_cb, data); 1354 */ 1343 1355 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); 1344 1356 … … 1351 1363 (event != NULL) ? event->button : 0, 1352 1364 gdk_event_get_time((GdkEvent*)event)); 1353 #endif1354 1365 } 1355 1366 … … 1410 1421 GtkTreeModel * model; 1411 1422 GtkTreePath * path; 1412 GtkTreeIter iter ;1423 GtkTreeIter iter, parent; 1413 1424 gint type; 1414 1425 … … 1440 1451 1441 1452 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); 1442 1461 1443 1462 break; sweep/branches/sweep-info-panel/src/info-panel.h
r458 r459 95 95 { 96 96 INFO_PANEL_UNDOS = 1, 97 INFO_PANEL_UNDO_ITEM 97 INFO_PANEL_UNDO_ITEM, 98 INFO_PANEL_UNDO_ITEM_ORIG 98 99 } info_panel_undos_type_t; 99 100 sweep/branches/sweep-info-panel/src/sample-display.c
r458 r459 62 62 63 63 64 /* Whether or not to compile in support for 64 /* 65 * Whether or not to compile in support for 65 66 * drawing the crossing vectors 66 67 */ … … 123 124 124 125 static 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) */ 128 129 220, 230, 255, /* user */ 129 130 100, 100, 100, /* zero */ … … 131 132 110, 110, 100, /* tmp_sel XOR mask */ 132 133 #if 1 133 108, 115, 134, /* sel bg */134 108, 115, 134, /* sel bg */ 134 135 #else 135 62, 68, 118, /* sel bg */136 62, 68, 118, /* sel bg */ 136 137 #endif 137 138 166, 166, 154, /* minmax */ … … 139 140 81, 101, 81, /* lowlight */ 140 141 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 */ 142 146 }; 143 147 … … 150 154 220, 220, 210, /* bg */ 151 155 #else 152 200, 200, 193, /* bg */156 200, 200, 193, /* bg */ 153 157 #endif 154 158 199, 203, 158, /* fg */ … … 163 167 81, 101, 81, /* lowlight */ 164 168 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 */ 166 173 }; 167 174 #endif … … 203 210 }; 204 211 212 //extern const int mark_colors[]; 213 extern GdkPixbuf * mark_icons[]; 214 205 215 /* Values for s->selecting */ 206 216 enum { … … 468 478 gtk_widget_queue_draw_area (GTK_WIDGET(s), x, s->height - 1, x2 - x, 1); 469 479 } 480 } 481 } 482 483 static void 484 sample_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 */ 470 518 } 471 519 } … … 792 840 s->marks_relief_gc = gdk_gc_new (widget->window); 793 841 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]); 794 853 795 854 sample_display_init_display(s, attributes.width, attributes.height); … … 834 893 835 894 x1 = OFFSET_TO_XPOS(sel->sel_start); 836 x1 = CLAMP(x1, x, x +width);895 x1 = CLAMP(x1, x, x + width); 837 896 838 897 x2 = OFFSET_TO_XPOS(sel->sel_end); 839 x2 = CLAMP(x2, x, x +width);898 x2 = CLAMP(x2, x, x + width); 840 899 841 900 if (x2 - x1 > 1){ … … 851 910 if (sel->sel_start != sel->sel_end) { 852 911 x1 = OFFSET_TO_XPOS(sel->sel_start); 853 x1 = CLAMP(x1, x, x +width);912 x1 = CLAMP(x1, x, x + width); 854 913 855 914 x2 = OFFSET_TO_XPOS(sel->sel_end); 856 x2 = CLAMP(x2, x, x +width);915 x2 = CLAMP(x2, x, x + width); 857 916 858 917 if (x2 - x1 > 1) { 859 gdk_draw_rectangle (win, s->tmp_sel_gc, TRUE,918 gdk_draw_rectangle (win, s->tmp_sel_gc, TRUE, 860 919 x1, y, x2 - x1, y + height -1); 861 920 } … … 1200 1259 1201 1260 static void 1202 sample_display_draw_sel_box (GdkDrawable * win,1261 sample_display_draw_sel_box (GdkDrawable * win, 1203 1262 GdkGC * gc, 1204 1263 const SampleDisplay * s, 1205 int x,1206 int width,1207 int draw_left, intdraw_right)1264 gint x, 1265 gint width, 1266 gboolean draw_left, gboolean draw_right) 1208 1267 { 1209 1268 if (width <= 0) { … … 1212 1271 } 1213 1272 1214 /* Must draw individual lines for these: if you optimise by 1273 /* 1274 * Must draw individual lines for these: if you optimise by 1215 1275 * drawing a rectangle where possible, the marching ants go 1216 1276 * crazy. We don't want that to happen, they are cute. … … 1219 1279 gdk_draw_line(win, gc, 1220 1280 x, 0, 1221 x+width, 0); 1281 x + width, 0); 1282 1222 1283 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 1225 1287 if (draw_left) { 1226 gdk_draw_line(win, gc,1288 gdk_draw_line(win, gc, 1227 1289 x, 0, 1228 1290 x, s->height - 1); … … 1233 1295 #endif 1234 1296 } 1297 1235 1298 if (draw_right) { 1236 1299 gdk_draw_line(win, gc, … … 1240 1303 #ifdef DRAW_CROSSING_VECTORS 1241 1304 /* crossing vector */ 1242 sample_display_draw_crossing_vector (win, gc, s, x +width);1305 sample_display_draw_crossing_vector (win, gc, s, x + width); 1243 1306 #endif 1244 1307 } … … 1253 1316 GList * gl; 1254 1317 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); 1257 1324 1258 1325 /* Draw real selection */ … … 1260 1327 sel = (sw_sel *)gl->data; 1261 1328 1262 x = OFFSET_TO_XPOS(sel->sel_start);1263 x 2= OFFSET_TO_XPOS(sel->sel_end);1264 1265 if (x > x_max) break;1266 if (x 2< 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 = (x 2 >= x_min) && (x2<= x_max);1272 x 2 = 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); 1273 1340 1274 1341 /* 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 } 1280 1354 } 1281 1355 … … 1284 1358 1285 1359 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 x 2= OFFSET_TO_XPOS(sel->sel_end);1291 r_end = (x 2 >= x_min) && (x2<= x_max);1292 x 2 = 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); 1293 1367 1294 1368 /* draw the selection */ 1295 1369 sample_display_draw_sel_box(win, s->tmp_sel_gc, 1296 s, x , x2 - x- 1,1370 s, xs, xe - xs - 1, 1297 1371 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 1299 1382 } 1300 1383 … … 1312 1395 int x, x1, x2; 1313 1396 PangoLayout *layout; 1314 //PangoRectangle logical_rect, ink_rect;1397 PangoRectangle logical_rect, ink_rect; 1315 1398 1316 1399 layout = gtk_widget_create_pango_layout (GTK_WIDGET(s), NULL); 1317 1400 1318 1401 for (gl = sample->sounddata->marks; gl; gl = gl->next) { 1402 1319 1403 mark = (sw_mark *)gl->data; 1320 1404 1321 1322 1405 x = OFFSET_TO_XPOS(mark->frame); 1323 1406 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); 1327 1424 x2 = CLAMP (x + 3, x_min, x_max); 1425 */ 1426 x2 = x + 3; 1328 1427 1329 1428 gdk_draw_line(win, s->marks_gcs[mark->color], … … 1350 1449 gdk_draw_polygon (win, s->marks_relief_gc, FALSE, poly, 5); 1351 1450 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 */ 1361 1463 } 1362 1464 } … … 1644 1746 1645 1747 /* 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); 1647 1749 1648 1750 /* draw the selection bounds */ … … 2037 2139 } else { 2038 2140 for ( gl = s->view->sample->sounddata->marks; gl; gl = gl->next){ 2039 g_print ("Mark found: %p\n", gl->data);2040 2141 2041 2142 mark = (sw_mark *)gl->data; 2042 2143 2043 2144 if ( (mark->frame >= off1) && (mark->frame <= off2) ){ 2044 g_print ("mamy ciÄ!\n");2045 2145 2046 2146 s->view->sample->tmp_mark = mark; sweep/branches/sweep-info-panel/src/sample-display.h
r458 r459 50 50 SAMPLE_DISPLAYCOL_REC, 51 51 SAMPLE_DISPLAYCOL_MARKS_RELIEF, 52 SAMPLE_DISPLAYCOL_TMPSEL_TEXT, 53 SAMPLE_DISPLAYCOL_SEL_TEXT, 54 SAMPLE_DISPLAYCOL_MARK_TEXT, 52 55 SAMPLE_DISPLAYCOL_LAST 53 56 }; … … 57 60 GtkWidget widget; 58 61 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; 61 64 GdkGC *minmax_gc, *zeroline_gc, *highlight_gc, *lowlight_gc; 62 65 sweep/branches/sweep-info-panel/src/sweep_marker.c
r458 r459 33 33 #include <sweep/sweep_marker.h> 34 34 35 #include <sweep/sweep_i18n.h> 36 35 37 #include "format.h" 36 38 #include "view.h" 37 39 #include "sample-display.h" 38 40 #include "driver.h" 41 42 #define MARKER_IMG_NUMBER 11 43 44 static 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 58 static 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 72 void 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 }; 39 99 40 100 sw_mark *
