Changeset 473

Show
Ignore:
Timestamp:
01/22/07 22:57:42 (2 years ago)
Author:
radekk
Message:

Add marker colors icons.

Files:

Legend:

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

    r465 r473  
    1616                pixmaps/marker-add-ico.png \ 
    1717                pixmaps/undo-revall-ico.png \ 
    18                 pixmaps/undo-rev-ico.png 
     18                pixmaps/undo-rev-ico.png \ 
     19                pixmaps/marker-img0.png \ 
     20                pixmaps/marker-img1.png \ 
     21                pixmaps/marker-img2.png \ 
     22                pixmaps/marker-img3.png \ 
     23                pixmaps/marker-img4.png \ 
     24                pixmaps/marker-img5.png \ 
     25                pixmaps/marker-img6.png \ 
     26                pixmaps/marker-img7.png \ 
     27                pixmaps/marker-img8.png \ 
     28                pixmaps/marker-img9.png \ 
     29                pixmaps/marker-img10.png 
    1930                 
    2031 
  • sweep/branches/sweep-info-panel/include/sweep/sweep_marker.h

    r465 r473  
    7272perform_marker_finish_op (sw_sample * sample, sw_op_instance * inst); 
    7373 
     74/* 
     75 * Max number of predefined marker colors 
     76 */ 
     77#define MARKER_IMG_NUMBER       11 
     78 
     79 
     80void 
     81sweep_load_marker_icons (void); 
     82 
    7483#endif /* __SWEEP_MARKER_H__ */ 
  • sweep/branches/sweep-info-panel/src/info-panel.c

    r470 r473  
    9393#endif 
    9494 
     95extern gint mark_colors[]; 
     96extern GdkPixbuf *mark_icons[]; 
    9597 
    9698GdkPixbuf * 
     
    347349    marker_del_icon = info_panel_load_icon ("marker-del-ico.png"); 
    348350 
     351  sweep_load_marker_icons (); 
     352 
    349353  return GTK_TREE_MODEL (treestore); 
    350354} 
     
    878882                              INFO_PANEL_MARKERS_COL_NAME, 
    879883                              mark->name ? mark->name : buf, 
     884                              INFO_PANEL_MARKERS_COL_ICON, mark_icons[mark->color], 
    880885                              INFO_PANEL_MARKERS_COL_VALUE, mtime, 
    881886                              INFO_PANEL_MARKERS_COL_POINTER, gl, 
     
    24542459            { 
    24552460              info_panel_error_dialog (view->window, 
    2456                                        _ 
    2457                                        ("Invalid parameter specification...")); 
     2461                                       _("Invalid parameter specification...")); 
    24582462              return; 
    24592463            } 
     
    24612465          // INFO_PANEL_MARKERS_COL_VALUE, new_text); 
    24622466 
    2463           mark = (sw_mark *) gl->data; 
    2464  
    2465           markdata = g_malloc0 (sizeof (MarkerData)); 
    2466  
    2467           markdata->mark_data.frame = mark->frame; 
    2468           markdata->mark_data.color = color; 
    2469           markdata->mark_data.type = mark->type; 
    2470           markdata->mark_data.name = mark->name; 
    2471  
    2472           markdata->mark_modify = mark; 
    2473  
    2474           perform_marker_op (view->sample, _("Modify marker"), 
    2475                              (SweepFilter) info_panel_marker_modify, NULL, 
    2476                              markdata); 
    2477  
     2467          if (color < MARKER_IMG_NUMBER){ 
     2468 
     2469            mark = (sw_mark *) gl->data; 
     2470 
     2471            markdata = g_malloc0 (sizeof (MarkerData)); 
     2472 
     2473            markdata->mark_data.frame = mark->frame; 
     2474            markdata->mark_data.color = color; 
     2475            markdata->mark_data.type = mark->type; 
     2476            markdata->mark_data.name = mark->name; 
     2477 
     2478            markdata->mark_modify = mark; 
     2479 
     2480            perform_marker_op (view->sample, _("Modify marker"), 
     2481                              (SweepFilter) info_panel_marker_modify, NULL, 
     2482                              markdata); 
     2483          } 
    24782484        } 
    24792485      break; 
  • sweep/branches/sweep-info-panel/src/sample-display.c

    r470 r473  
    6868extern GdkCursor *sweep_cursors[]; 
    6969 
     70extern gint mark_colors[]; 
     71extern GdkPixbuf *mark_icons[]; 
     72 
     73 
    7074/* 
    7175 * Maximum number of samples to consider per pixel  
     
    131135extern sw_view *last_tmp_view; 
    132136 
    133 static int last_button;               /* button index which started the last 
     137static gint last_button;              /* button index which started the last 
    134138                                 * selection; This is global to allow 
    135139                                 * comparison for last_tmp_view */ 
     
    137141#if 1 
    138142 
    139 static const int default_colors[] = { 
     143static const gint default_colors[] = { 
    140144  200, 200, 193,                /* bg */ 
    141145  199, 203, 158,                /* fg */ 
     
    162166#else 
    163167 
    164 static const int default_colors[] = { 
     168static const gint default_colors[] = { 
    165169#if 0 
    166170  86, 86, 80,                   /* bg */ 
     
    188192#endif 
    189193 
    190 static const int bg_colors[] = { 
     194static const gint bg_colors[] = { 
    191195  250, 250, 237,                /* black bg */ 
    192196  200, 200, 193,                /* red bg */ 
     
    203207}; 
    204208 
    205 static const int fg_colors[] = { 
     209static const gint fg_colors[] = { 
    206210  80, 80, 60,                   /* black fg */ 
    207211  220, 80, 40,                  /* red fg */ 
     
    214218}; 
    215219 
    216 static const int mark_colors[] = { 
    217   0, 255, 255, 
    218   0, 255, 0, 
    219   0, 0, 255, 
    220   255, 0, 255, 
    221   0, 0, 255, 
    222   0, 0, 255, 
    223   0, 0, 255, 
    224 }; 
    225  
    226 // extern const int mark_colors[]; 
    227 extern GdkPixbuf *mark_icons[]; 
    228220 
    229221/* 
     
    700692 
    701693static void 
    702 sample_display_init_display (SampleDisplay * s, int w, int h) 
     694sample_display_init_display (SampleDisplay * s, gint w, gint h) 
    703695{ 
    704696  GdkWindow *window; 
     
    992984sample_display_draw_data_channel (GdkDrawable * win, 
    993985                                  const SampleDisplay * s, 
    994                                   int x, 
    995                                   int y, int width, int height, int channel) 
     986                                  gint x, gint y,  
     987                                  gint width, gint height,  
     988                                  gint channel) 
    996989{ 
    997990  GList *gl; 
    998991  GdkGC *gc, *fg_gc; 
    999992  sw_sel *sel; 
    1000   int x1, x2, y1; 
     993  gint x1, x2, y1; 
    1001994  sw_audio_t vhigh, vlow; 
    1002995  sw_audio_intermediate_t totpos, totneg; 
     
    1005998  sw_framecount_t i, step, nr_frames, nr_pos, nr_neg; 
    1006999  sw_sample *sample; 
    1007   const int channels = s->view->sample->sounddata->format->channels; 
     1000  const gint channels = s->view->sample->sounddata->format->channels; 
    10081001 
    10091002  sample = s->view->sample; 
     
    10881081#ifdef LEGACY_DRAW_MODE 
    10891082  { 
    1090     int py, ty; 
     1083    gint py, ty; 
    10911084    sw_audio_t peak; 
    10921085 
     
    12101203static void 
    12111204sample_display_draw_data (GdkDrawable * win, const SampleDisplay * s, 
    1212                           int x, int width) 
    1213 { 
    1214   const int sh = s->height; 
     1205                          gint x, gint width) 
     1206{ 
     1207  const gint sh = s->height; 
    12151208  int start_x, end_x, i, cy, cheight, cerr; 
    1216   const int channels = s->view->sample->sounddata->format->channels; 
     1209  const gint channels = s->view->sample->sounddata->format->channels; 
    12171210 
    12181211  if (width == 0) 
     
    13281321sample_display_draw_crossing_vector (GdkDrawable * win, 
    13291322                                     GdkGC * gc, 
    1330                                      const SampleDisplay * s, int x) 
     1323                                     const SampleDisplay * s, 
     1324                                     gint x) 
    13311325{ 
    13321326  sw_sample *sample = s->view->sample; 
    1333   const int sh = s->height; 
    1334   int cx1, cx2, cy1, cy2; 
     1327  const gint sh = s->height; 
     1328  gint cx1, cx2, cy1, cy2; 
    13351329 
    13361330#define VRAD 8 
     
    13681362  SampleDisplay *s = (SampleDisplay *) data; 
    13691363  GdkGC *gc = s->sel_gc; 
    1370   static int dash_offset = 0; 
     1364  static gint dash_offset = 0; 
    13711365 
    13721366  gdk_gc_set_dashes (gc, dash_offset, sel_dash_list, 2); 
     
    15501544static void 
    15511545sample_display_draw_marks (GdkDrawable * win, 
    1552                            const SampleDisplay * s, int x_min, int x_max) 
     1546                           const SampleDisplay * s, gint x_min, gint x_max) 
    15531547{ 
    15541548  sw_sample *sample = s->view->sample; 
    15551549  GList *gl; 
    15561550  sw_mark *mark; 
    1557   GdkPoint poly[5]; 
    1558   int x, x1, x2; 
     1551  gint x, x1, x2; 
    15591552  PangoLayout *layout; 
    15601553  PangoRectangle logical_rect, ink_rect; 
    15611554 
     1555/* XXX: Hardcoded marker ico width !!!! */ 
     1556#define MARKER_ICO_WIDTH 8 
     1557 
    15621558  layout = gtk_widget_create_pango_layout (GTK_WIDGET (s), NULL); 
    15631559 
     
    15691565      x = OFFSET_TO_XPOS (mark->frame); 
    15701566 
    1571       x1 = x - 3
     1567      x1 = x - MARKER_ICO_WIDTH / 2
    15721568 
    15731569      if (mark->name != NULL) 
     
    15751571          pango_layout_set_text (layout, mark->name, -1); 
    15761572          pango_layout_get_extents (layout, &ink_rect, &logical_rect); 
    1577           x2 = x + 3 + PANGO_PIXELS (ink_rect.width); 
     1573          x2 = x + MARKER_ICO_WIDTH / 2 + PANGO_PIXELS (ink_rect.width); 
    15781574        } 
    15791575      else 
    15801576        { 
    1581           x2 = x + 3; 
    1582         } 
    1583  
    1584       // g_print("xmin: %d xmax:%d x1:%d x2:%d\n", x_min, x_max, x1, 
    1585       // x2); 
     1577          x2 = x + MARKER_ICO_WIDTH / 2; 
     1578        } 
    15861579 
    15871580      if (((x1 >= x_min) && (x1 <= x_max)) || 
     
    15901583        { 
    15911584          /* 
    1592            * x1 = CLAMP (x1, x_min, x_max); x2 = CLAMP (x + 3, x_min, 
    1593           * x_max);  
     1585           * x1 = CLAMP (x1, x_min, x_max);  
     1586           * x2 = CLAMP (x + 3, x_min, x_max);  
    15941587           */ 
    1595           x2 = x + 3; 
    1596  
    1597           gdk_draw_line (win, s->marks_gcs[mark->color], x, 8, x, s->height); 
    1598  
    1599           poly[0].x = x1; 
    1600           poly[1].x = x2 + 1; 
    1601           poly[2].x = x2 + 1; 
    1602           poly[3].x = x; 
    1603           poly[4].x = x1; 
    1604  
    1605           poly[0].y = 0; 
    1606           poly[1].y = 0; 
    1607           poly[2].y = 7; 
    1608           poly[3].y = 10; 
    1609           poly[4].y = 7; 
    1610  
    1611           gdk_draw_polygon (win, s->marks_gcs[mark->color], TRUE, poly, 5); 
    1612  
    1613           poly[1].x = x2; 
    1614           poly[2].x = x2; 
    1615  
    1616           gdk_draw_polygon (win, s->marks_relief_gc, FALSE, poly, 5); 
    1617  
    1618           if (mark->name != NULL) 
     1588 
     1589          gdk_draw_line (win, s->marks_gcs[mark->color], x, 0, x, s->height); 
     1590 
     1591          gdk_draw_pixbuf (win, s->marks_gcs[mark->color], mark_icons[mark->color],  
     1592              0, 0,  
     1593              x - MARKER_ICO_WIDTH / 2, 0,  
     1594              -1, -1, GDK_RGB_DITHER_NONE, 0, 0); 
     1595 
     1596          if (mark->name != NULL) 
    16191597            { 
    1620               gdk_draw_layout (win, s->mark_text_gc, x2 + 2, 0, layout); 
     1598              gdk_draw_layout (win, s->mark_text_gc, x +  MARKER_ICO_WIDTH / 2 + 2, 0, layout); 
    16211599            } 
    16221600        } 
  • sweep/branches/sweep-info-panel/src/sweep_marker.c

    r470 r473  
    4242#include "undo_dialog.h" 
    4343 
    44 #define MARKER_IMG_NUMBER       11 
    45  
    46 static const int mark_colors[] = { 
     44/* 
     45 * As long as we have prepared colors markers icons 
     46 * as long we have to has predefined colors 
     47 */ 
     48gint mark_colors[] = { 
    4749  255, 0, 0, 
    4850  0, 255, 0, 
     
    5860}; 
    5961 
    60 static GdkPixbuf *mark_icons[] = { 
     62GdkPixbuf *mark_icons[] = { 
    6163  NULL, 
    6264  NULL,