Changeset 427
- Timestamp:
- 08/28/06 18:27:35 (4 years ago)
- Files:
-
- sweep/branches/sweep-info-panel/pixmaps/done.png (added)
- sweep/branches/sweep-info-panel/pixmaps/info.png (added)
- sweep/branches/sweep-info-panel/pixmaps/marker.png (added)
- sweep/branches/sweep-info-panel/pixmaps/sample.png (added)
- sweep/branches/sweep-info-panel/pixmaps/select.png (added)
- sweep/branches/sweep-info-panel/pixmaps/undo.png (added)
- sweep/branches/sweep-info-panel/src/Makefile.am (modified) (1 diff)
- sweep/branches/sweep-info-panel/src/callbacks.c (modified) (1 diff)
- sweep/branches/sweep-info-panel/src/cursors.c (modified) (1 diff)
- sweep/branches/sweep-info-panel/src/info-panel.c (added)
- sweep/branches/sweep-info-panel/src/info-panel.h (added)
- sweep/branches/sweep-info-panel/src/main.c (modified) (1 diff)
- sweep/branches/sweep-info-panel/src/print.c (modified) (5 diffs)
- sweep/branches/sweep-info-panel/src/print.h (modified) (1 diff)
- sweep/branches/sweep-info-panel/src/sample.h (modified) (1 diff)
- sweep/branches/sweep-info-panel/src/sweep_app.h (modified) (1 diff)
- sweep/branches/sweep-info-panel/src/sweep_sample.c (modified) (8 diffs)
- sweep/branches/sweep-info-panel/src/sweep_selection.c (modified) (5 diffs)
- sweep/branches/sweep-info-panel/src/undo_dialog.c (modified) (2 diffs)
- sweep/branches/sweep-info-panel/src/view.c (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
sweep/branches/sweep-info-panel/src/Makefile.am
r392 r427 41 41 format.c format.h \ 42 42 head.c head.h \ 43 info-panel.c info-panel.h \ 43 44 interface.c interface.h \ 44 45 levelmeter.c levelmeter.h \ sweep/branches/sweep-info-panel/src/callbacks.c
r285 r427 48 48 #include "print.h" 49 49 #include "record.h" 50 #include "info-panel.h" 50 51 51 52 /* sweep/branches/sweep-info-panel/src/cursors.c
r387 r427 161 161 hand_x_hot, hand_y_hot); 162 162 163 164 163 } sweep/branches/sweep-info-panel/src/main.c
r230 r427 144 144 display_env = g_strconcat ("DISPLAY=", gdk_get_display (), NULL); 145 145 putenv (display_env); 146 g_free(display_env); 146 147 #endif 147 148 sweep/branches/sweep-info-panel/src/print.c
r124 r427 28 28 29 29 #include <sweep/sweep_types.h> 30 #include <sweep/sweep_i18n.h> 30 31 31 32 /* … … 37 38 { 38 39 if (nr_bytes > (1L<<30)) { 39 return snprintf (s, n, "%0.3f GB",40 return g_snprintf (s, n, "%0.3f GB", 40 41 (gfloat)nr_bytes / (1024.0 * 1024.0 * 1024.0)); 41 42 } else if (nr_bytes > (1L<<20)) { 42 return snprintf (s, n, "%0.3f MB",43 return g_snprintf (s, n, "%0.3f MB", 43 44 (gfloat)nr_bytes / (1024.0 * 1024.0)); 44 45 } else if (nr_bytes > (1L<<10)) { 45 return snprintf (s, n, "%0.3f kB",46 return g_snprintf (s, n, "%0.3f kB", 46 47 (gfloat)nr_bytes / (1024.0)); 47 48 } else if (nr_bytes == 1) { 48 return snprintf (s, n, "1 byte");49 return g_snprintf (s, n, "1 byte"); 49 50 } else { 50 return snprintf (s, n, "%ld bytes", nr_bytes);51 return g_snprintf (s, n, "%ld bytes", nr_bytes); 51 52 } 52 53 } … … 72 73 /* XXX: %02.3f workaround */ 73 74 if (sec < 10.0) { 74 return snprintf (s, n, "%s%02d:%02d:0%2.3f", sign, hrs, min, sec);75 return g_snprintf (s, n, "%s%02d:%02d:0%2.3f", sign, hrs, min, sec); 75 76 } else { 76 return snprintf (s, n, "%s%02d:%02d:%02.3f", sign, hrs, min, sec);77 return g_snprintf (s, n, "%s%02d:%02d:%02.3f", sign, hrs, min, sec); 77 78 } 78 79 } … … 95 96 96 97 if (hrs > 0.0) 97 return snprintf (s, n, "PT%.0fH%.0fM%.0fS%.0fN%dF", hrs, min, sec, N, F);98 return g_snprintf (s, n, "PT%.0fH%.0fM%.0fS%.0fN%dF", hrs, min, sec, N, F); 98 99 else if (min > 0.0) 99 return snprintf (s, n, "PT%.0fM%.0fS%.0fN%dF", min, sec, N, F);100 return g_snprintf (s, n, "PT%.0fM%.0fS%.0fN%dF", min, sec, N, F); 100 101 else if (sec > 0.0) 101 return snprintf (s, n, "PT%.0fS%.0fN%dF", sec, N, F);102 return g_snprintf (s, n, "PT%.0fS%.0fN%dF", sec, N, F); 102 103 else if (N > 0.0) 103 return snprintf (s, n, "PT%.0fN%dF", N, F);104 return g_snprintf (s, n, "PT%.0fN%dF", N, F); 104 105 else 105 return snprintf (s, n, "P0S");106 return g_snprintf (s, n, "P0S"); 106 107 } 107 108 … … 138 139 return result; 139 140 } 141 142 void 143 snprint_channels (gchar * s, gint n, gint channels) 144 { 145 switch (channels){ 146 case 1: 147 g_strlcpy(s, _("Mono"), n); 148 return; 149 case 2: 150 g_strlcpy(s, _("Stereo (2.0)"), n); 151 return; 152 case 3: 153 g_strlcpy(s, _("2.1"), n); 154 return; 155 case 4: 156 g_strlcpy(s, _("Quadro/3.1"), n); 157 return; 158 case 6: 159 g_strlcpy(s, _("5.1"), n); 160 return; 161 case 7: 162 g_strlcpy(s, _("6.1"), n); 163 return; 164 default: 165 //TODO: i18n 166 g_snprintf (s, n, "%d channels", channels); 167 } 168 } sweep/branches/sweep-info-panel/src/print.h
r124 r427 49 49 strtime_to_seconds (char * str); 50 50 51 /* 52 * Prints a string corresponding to number of channels 53 */ 54 void 55 snprint_channels (gchar * s, gint n, gint channels); 56 51 57 #endif /* __PRINT_H__ */ sweep/branches/sweep-info-panel/src/sample.h
r124 r427 81 81 sample_selection_replace_with_tmp_sel (sw_sample * s); 82 82 83 void 84 sample_clear_selection (sw_sample * s); 85 83 86 #endif /* __SAMPLE_H__ */ sweep/branches/sweep-info-panel/src/sweep_app.h
r124 r427 249 249 GtkWidget * info_clist; 250 250 251 GtkTreeModel * info_panel; /* for info_panel tree model */ 252 251 253 gint progress_percent; /* completion percentage of current op */ 252 254 sweep/branches/sweep-info-panel/src/sweep_sample.c
r279 r427 50 50 #include "preferences.h" 51 51 #include "record.h" 52 #include "info-panel.h" 52 53 #include "question_dialogs.h" 53 54 #include "sw_chooser.h" … … 186 187 187 188 s->info_clist = NULL; 189 190 s->info_panel = info_panel_create_model(); 188 191 189 192 /* s->recording = FALSE;*/ … … 1676 1679 sw_sel * sel; 1677 1680 1681 /* 1678 1682 n = snprintf (buf, BUF_LEN, _("Insert selection [")); 1679 1683 n += snprint_time (buf+n, BUF_LEN-n, … … 1683 1687 frames_to_time (format, s->tmp_sel->sel_end)); 1684 1688 n += snprintf (buf+n, BUF_LEN-n, "]"); 1689 */ 1690 n = snprintf (buf, BUF_LEN, _("Insert selection")); 1685 1691 1686 1692 g_mutex_lock (s->sounddata->sels_mutex); … … 1774 1780 sw_sel * sel; 1775 1781 1782 /* 1776 1783 n = snprintf (buf, BUF_LEN, _("Set selection [")); 1777 1784 n += snprint_time (buf+n, BUF_LEN-n, … … 1781 1788 frames_to_time (format, s->tmp_sel->sel_end)); 1782 1789 n += snprintf (buf+n, BUF_LEN-n, "]"); 1790 */ 1791 n = snprintf (buf, BUF_LEN, _("Set selection")); 1783 1792 1784 1793 g_mutex_lock (s->sounddata->sels_mutex); … … 1802 1811 sw_sounddata * sounddata = sample->sounddata; 1803 1812 GtkWidget * clist = sample->info_clist; 1804 1813 1805 1814 #define RATE_BUF_LEN 16 1806 1815 char rate_buf[RATE_BUF_LEN]; … … 1815 1824 char time_buf[TIME_BUF_LEN]; 1816 1825 1817 if (clist == NULL) return;1818 1819 snprintf (rate_buf, RATE_BUF_LEN, "%d Hz", sounddata->format->rate);1820 1821 snprintf (chan_buf, CHAN_BUF_LEN, "%d", sounddata->format->channels);1822 1823 snprint_bytes (byte_buf, BYTE_BUF_LEN,1824 frames_to_bytes (sounddata->format, sounddata->nr_frames));1826 if (clist) 1827 { 1828 snprintf (rate_buf, RATE_BUF_LEN, "%d Hz", sounddata->format->rate); 1829 1830 snprintf (chan_buf, CHAN_BUF_LEN, "%d", sounddata->format->channels); 1831 1832 snprint_bytes (byte_buf, BYTE_BUF_LEN, 1833 frames_to_bytes (sounddata->format, sounddata->nr_frames)); 1825 1834 1826 snprint_time (time_buf, TIME_BUF_LEN, 1827 frames_to_time (sounddata->format, sounddata->nr_frames)); 1828 1829 1830 gtk_clist_set_text (GTK_CLIST(clist), 0, 1, g_basename(sample->pathname)); 1831 gtk_clist_set_text (GTK_CLIST(clist), 1, 1, rate_buf); 1832 gtk_clist_set_text (GTK_CLIST(clist), 2, 1, chan_buf); 1833 gtk_clist_set_text (GTK_CLIST(clist), 3, 1, byte_buf); 1834 gtk_clist_set_text (GTK_CLIST(clist), 4, 1, time_buf); 1835 1835 snprint_time (time_buf, TIME_BUF_LEN, 1836 frames_to_time (sounddata->format, sounddata->nr_frames)); 1837 1838 gtk_clist_set_text (GTK_CLIST(clist), 0, 1, g_basename(sample->pathname)); 1839 gtk_clist_set_text (GTK_CLIST(clist), 1, 1, rate_buf); 1840 gtk_clist_set_text (GTK_CLIST(clist), 2, 1, chan_buf); 1841 gtk_clist_set_text (GTK_CLIST(clist), 3, 1, byte_buf); 1842 gtk_clist_set_text (GTK_CLIST(clist), 4, 1, time_buf); 1843 } 1844 1845 info_panel_sample_info_update(sample); 1846 info_panel_selections_info_update(sample); 1836 1847 } 1837 1848 sweep/branches/sweep-info-panel/src/sweep_selection.c
r124 r427 37 37 38 38 sw_sel * 39 sel_new (sw_framecount_t start, sw_framecount_t end )39 sel_new (sw_framecount_t start, sw_framecount_t end, gchar * name) 40 40 { 41 41 sw_framecount_t s, e; … … 48 48 sel->sel_start = s; 49 49 sel->sel_end = e; 50 sel->name = g_strdup(name); 50 51 51 52 return sel; 53 } 54 55 void 56 sel_free (sw_sel * sel) 57 { 58 if (!sel) 59 return; 60 61 g_free(sel->name); 62 g_free(sel); 63 52 64 } 53 65 … … 57 69 sw_sel * nsel; 58 70 59 nsel = sel_new (sel->sel_start, sel->sel_end );71 nsel = sel_new (sel->sel_start, sel->sel_end, sel->name); 60 72 61 73 return nsel; … … 123 135 sw_sel * sel; 124 136 125 sel = sel_new (start, end );137 sel = sel_new (start, end, NULL); 126 138 127 139 return sels_add_selection (sels, sel); … … 142 154 if (!sels) { 143 155 g_list_free (sels); 144 sel = sel_new (0, nr_frames );156 sel = sel_new (0, nr_frames, NULL); 145 157 sels = NULL; 146 158 sels = g_list_append (sels, sel); sweep/branches/sweep-info-panel/src/undo_dialog.c
r279 r427 39 39 #include "interface.h" 40 40 #include "callbacks.h" 41 #include "info-panel.h" 41 42 42 43 #include "../pixmaps/undo.xpm" … … 192 193 undo_dialog_refresh_history (sw_sample * sample) 193 194 { 195 info_panel_undo_info_update(sample); 196 194 197 if (sample != ud_sample) 195 198 return; sweep/branches/sweep-info-panel/src/view.c
r370 r427 60 60 #include "cursors.h" 61 61 #include "head.h" 62 #include "info-panel.h" 62 63 #include "view_pixmaps.h" 63 64 … … 1789 1790 GtkWidget * main_vbox; 1790 1791 GtkWidget * table; 1792 GtkWidget * table1; 1791 1793 GtkWidget * hbox; 1792 1794 GtkWidget * vbox; … … 1811 1813 GtkWidget * frame; 1812 1814 GtkWidget * label; 1815 GtkWidget * hpaned; 1816 GtkWidget * scrolled_window; 1817 GtkWidget * treeview; 1813 1818 #if 0 1814 1819 GtkWidget * entry; … … 2259 2264 gtk_widget_show (table); 2260 2265 2261 /* menu button */ 2266 // menu button | time_ruller 2267 // db_ruller | display 2268 // scrollbar 2269 2270 /* hpaned */ 2271 2272 hpaned = gtk_hpaned_new(); 2273 gtk_table_attach (GTK_TABLE(table), hpaned, 2274 0, 2, 0, 3, 2275 GTK_EXPAND|GTK_FILL|GTK_SHRINK, GTK_FILL, 2276 0, 0); 2277 gtk_widget_show(hpaned); 2278 gtk_paned_set_position(GTK_PANED(hpaned), win_width / 4); 2279 2280 treeview = info_panel_new(view); 2281 2282 scrolled_window = gtk_scrolled_window_new (NULL, NULL); 2283 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), 2284 GTK_POLICY_AUTOMATIC, 2285 GTK_POLICY_AUTOMATIC); 2286 gtk_container_add(GTK_CONTAINER(scrolled_window), treeview); 2287 2288 gtk_widget_show(treeview); 2289 2290 gtk_paned_pack1(GTK_PANED(hpaned), scrolled_window, TRUE, TRUE); 2291 gtk_widget_show(scrolled_window); 2292 2293 /* display table */ 2294 table1 = gtk_table_new (3, 2, FALSE); 2295 gtk_table_set_col_spacing (GTK_TABLE(table1), 0, 1); 2296 gtk_table_set_col_spacing (GTK_TABLE(table1), 1, 2); 2297 gtk_table_set_row_spacing (GTK_TABLE(table1), 0, 1); 2298 gtk_table_set_row_spacing (GTK_TABLE(table1), 1, 2); 2299 gtk_container_set_border_width (GTK_CONTAINER(table1), 2); 2300 2301 gtk_paned_pack2(GTK_PANED(hpaned), table1, TRUE, TRUE); 2302 2303 gtk_widget_show(table1); 2304 2305 /* menu button */ 2262 2306 menu_button = gtk_button_new (); 2263 gtk_table_attach (GTK_TABLE(table ), menu_button,2307 gtk_table_attach (GTK_TABLE(table1), menu_button, 2264 2308 0, 1, 0, 1, 2265 2309 GTK_FILL, GTK_FILL, … … 2275 2319 2276 2320 ebox = gtk_event_box_new (); 2277 gtk_table_attach (GTK_TABLE(table ), ebox,2321 gtk_table_attach (GTK_TABLE(table1), ebox, 2278 2322 1, 2, 0, 1, 2279 2323 GTK_EXPAND|GTK_FILL|GTK_SHRINK, GTK_FILL, … … 2303 2347 2304 2348 ebox = gtk_event_box_new (); 2305 gtk_table_attach (GTK_TABLE(table ), ebox,2349 gtk_table_attach (GTK_TABLE(table1), ebox, 2306 2350 0, 1, 1, 2, 2307 2351 GTK_FILL, GTK_EXPAND|GTK_SHRINK|GTK_FILL, … … 2329 2373 /* display */ 2330 2374 view->display = sample_display_new(); 2331 gtk_table_attach (GTK_TABLE(table ), view->display,2375 gtk_table_attach (GTK_TABLE(table1), view->display, 2332 2376 1, 2, 1, 2, 2333 2377 GTK_EXPAND|GTK_FILL|GTK_SHRINK, … … 2417 2461 2418 2462 scrollbar = gtk_hscrollbar_new(GTK_ADJUSTMENT(view->adj)); 2419 gtk_table_attach (GTK_TABLE(table ), scrollbar,2463 gtk_table_attach (GTK_TABLE(table1), scrollbar, 2420 2464 1, 2, 2, 3, 2421 2465 GTK_EXPAND|GTK_FILL|GTK_SHRINK, GTK_FILL, … … 3833 3877 view_refresh_channelops_menu (v); 3834 3878 view_refresh_db_rulers (v); 3879 // g_print("VIEW REFRESH\n"); 3835 3880 } 3836 3881
