summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--callbacks.c39
-rw-r--r--cmp3.c1
-rw-r--r--deadbeef.glade17
-rw-r--r--gtkplaylist.c34
-rw-r--r--gtkplaylist.h6
-rw-r--r--images/pause_16.pngbin0 -> 314 bytes
-rw-r--r--images/play_16.pngbin0 -> 539 bytes
-rw-r--r--interface.c14
-rw-r--r--main.c13
-rw-r--r--palsa.c5
-rw-r--r--palsa.h3
-rw-r--r--playback.h1
12 files changed, 68 insertions, 65 deletions
diff --git a/callbacks.c b/callbacks.c
index 830ef250..0e8520c9 100644
--- a/callbacks.c
+++ b/callbacks.c
@@ -724,19 +724,10 @@ on_playlist_load_activate (GtkMenuItem *menuitem,
}
}
+char last_playlist_save_name[1024] = "";
void
-on_playlist_save_activate (GtkMenuItem *menuitem,
- gpointer user_data)
-{
-
-}
-
-
-void
-on_playlist_save_as_activate (GtkMenuItem *menuitem,
- gpointer user_data)
-{
+save_playlist_as (void) {
GtkWidget *dlg = gtk_file_chooser_dialog_new ("Save Playlist As", GTK_WINDOW (mainwin), GTK_FILE_CHOOSER_ACTION_SAVE, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_SAVE, GTK_RESPONSE_OK, NULL);
GtkFileFilter* flt;
@@ -752,7 +743,10 @@ on_playlist_save_as_activate (GtkMenuItem *menuitem,
if (fname) {
int res = pl_save (fname);
- printf ("save res: %d\n", res);
+ printf ("save as res: %d\n", res);
+ if (res >= 0 && strlen (fname) < 1024) {
+ strcpy (last_playlist_save_name, fname);
+ }
g_free (fname);
}
}
@@ -761,3 +755,24 @@ on_playlist_save_as_activate (GtkMenuItem *menuitem,
}
}
+void
+on_playlist_save_activate (GtkMenuItem *menuitem,
+ gpointer user_data)
+{
+ if (!last_playlist_save_name[0]) {
+ save_playlist_as ();
+ }
+ else {
+ int res = pl_save (last_playlist_save_name);
+ printf ("save res: %d\n", res);
+ }
+}
+
+
+void
+on_playlist_save_as_activate (GtkMenuItem *menuitem,
+ gpointer user_data)
+{
+ save_playlist_as ();
+}
+
diff --git a/cmp3.c b/cmp3.c
index 01d3910b..228b9525 100644
--- a/cmp3.c
+++ b/cmp3.c
@@ -62,7 +62,6 @@ cmp3_scan_stream2 (float position);
int
cmp3_init (struct playItem_s *it) {
- printf ("opening file %s\n", it->fname);
buffer.file = fopen (it->fname, "rb");
if (!buffer.file) {
return -1;
diff --git a/deadbeef.glade b/deadbeef.glade
index d307a394..b8ec1d63 100644
--- a/deadbeef.glade
+++ b/deadbeef.glade
@@ -237,22 +237,11 @@
</child>
<child>
- <widget class="GtkRadioMenuItem" id="order_shuffle">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Shuffle</property>
- <property name="use_underline">True</property>
- <property name="active">True</property>
- <property name="group">order_linear</property>
- <signal name="activate" handler="on_order_shuffle_activate" last_modification_time="Sat, 08 Aug 2009 12:26:33 GMT"/>
- </widget>
- </child>
-
- <child>
<widget class="GtkRadioMenuItem" id="order_random">
<property name="visible">True</property>
<property name="label" translatable="yes">Random</property>
<property name="use_underline">True</property>
- <property name="active">True</property>
+ <property name="active">False</property>
<property name="group">order_linear</property>
<signal name="activate" handler="on_order_random_activate" last_modification_time="Sat, 08 Aug 2009 12:26:33 GMT"/>
</widget>
@@ -286,7 +275,7 @@
<property name="visible">True</property>
<property name="label" translatable="yes">Loop Single Song</property>
<property name="use_underline">True</property>
- <property name="active">True</property>
+ <property name="active">False</property>
<property name="group">loop_all</property>
<signal name="activate" handler="on_loop_single_activate" last_modification_time="Sat, 08 Aug 2009 12:26:33 GMT"/>
</widget>
@@ -297,7 +286,7 @@
<property name="visible">True</property>
<property name="label" translatable="yes">Don't Loop</property>
<property name="use_underline">True</property>
- <property name="active">True</property>
+ <property name="active">False</property>
<property name="group">loop_all</property>
<signal name="activate" handler="on_loop_disable_activate" last_modification_time="Sat, 08 Aug 2009 12:26:33 GMT"/>
</widget>
diff --git a/gtkplaylist.c b/gtkplaylist.c
index cc8e56b8..41624580 100644
--- a/gtkplaylist.c
+++ b/gtkplaylist.c
@@ -49,22 +49,9 @@ const char *colnames[pl_ncolumns] = {
"Duration"
};
+static cairo_surface_t *play16_pixmap;
+static cairo_surface_t *pause16_pixmap;
-//extern GtkWidget *mainwin;
-//static GdkPixmap *ps->backbuf;
-//static int rowheight = 17;
-//static int ps->scrollpos = 0;
-//static int ps->row = -1;
-//static double ps->clicktime = 0;
-//static double ps->lastpos[2];
-//static int ps->nvisiblerows = 0;
-
-//// array of lengths and widths
-//// N = number of columns
-//// M = number of visible rows,
-//// cache[(ROW*ncolumns+COLUMN)*3+0] --- position to insert "...", or -1 if the whole line fits
-//// cache[(ROW*ncolumns+COLUMN)*3+1] --- width extent in pixels
-//// cache[(ROW*ncolumns+COLUMN)*3+2] --- 0 if needs recalc
//static int16_t *ps->fmtcache = NULL;
//
//int ps->header_fitted[pl_ncolumns] = {
@@ -228,10 +215,13 @@ gtkpl_draw_pl_row (gtkplaylist_t *ps, cairo_t *cr, int row, playItem_t *it) {
}
int width, height;
gdk_drawable_get_size (ps->backbuf, &width, &height);
- if (it == playlist_current_ptr && ps->colwidths[0] > 0) {
- cairo_set_source_rgb (cr, 1, 1, 1);
- cairo_rectangle (cr, 3, row * rowheight - ps->scrollpos * rowheight + 3, rowheight-6, rowheight-6);
- cairo_fill (cr);
+ if (it == playlist_current_ptr && ps->colwidths[0] > 0 && !p_isstopped ()) {
+ cairo_surface_t *surf = p_ispaused () ? pause16_pixmap : play16_pixmap;
+ cairo_set_source_surface (cr, surf, ps->colwidths[0]/2-8, row * rowheight - ps->scrollpos * rowheight);
+ cairo_rectangle (cr, ps->colwidths[0]/2-8, row * rowheight - ps->scrollpos * rowheight, 16, 16);
+ cairo_clip (cr);
+ cairo_paint (cr);
+ cairo_reset_clip (cr);
}
if (it && ((it->selected && ps->multisel) || (row == ps->row && !ps->multisel))) {
cairo_set_source_rgb (cr, 0, 0, 0);
@@ -359,6 +349,12 @@ gtkpl_configure (gtkplaylist_t *ps) {
}
ps->nvisiblerows = ceil (widget->allocation.height / (float)rowheight);
ps->backbuf = gdk_pixmap_new (widget->window, widget->allocation.width, widget->allocation.height, -1);
+
+ if (!play16_pixmap) {
+ play16_pixmap = cairo_image_surface_create_from_png ("/usr/share/deadbeef/images/play_16.png");
+ pause16_pixmap = cairo_image_surface_create_from_png ("/usr/share/deadbeef/images/pause_16.png");
+ }
+
gtkpl_draw_playlist (ps, 0, 0, widget->allocation.width, widget->allocation.height);
}
diff --git a/gtkplaylist.h b/gtkplaylist.h
index d913f01a..8cd6aa46 100644
--- a/gtkplaylist.h
+++ b/gtkplaylist.h
@@ -51,6 +51,12 @@ typedef struct {
int row;
double clicktime; // for doubleclick detection
int nvisiblerows;
+// array of lengths and widths
+// N = number of columns
+// M = number of visible rows,
+// cache[(ROW*ncolumns+COLUMN)*3+0] --- position to insert "...", or -1 if the whole line fits
+// cache[(ROW*ncolumns+COLUMN)*3+1] --- width extent in pixels
+// cache[(ROW*ncolumns+COLUMN)*3+2] --- 0 if needs recalc
int16_t *fmtcache; // cached text formatting
int header_fitted[pl_ncolumns];
char colnames_fitted[pl_ncolumns][pl_colname_max]; // cached formatted names of columns
diff --git a/images/pause_16.png b/images/pause_16.png
new file mode 100644
index 00000000..b6569019
--- /dev/null
+++ b/images/pause_16.png
Binary files differ
diff --git a/images/play_16.png b/images/play_16.png
new file mode 100644
index 00000000..07bb0b5c
--- /dev/null
+++ b/images/play_16.png
Binary files differ
diff --git a/interface.c b/interface.c
index fbd52830..8acf9333 100644
--- a/interface.c
+++ b/interface.c
@@ -61,7 +61,6 @@ create_mainwin (void)
GtkWidget *order1_menu;
GSList *order_linear_group = NULL;
GtkWidget *order_linear;
- GtkWidget *order_shuffle;
GtkWidget *order_random;
GtkWidget *looping1;
GtkWidget *looping1_menu;
@@ -231,17 +230,10 @@ create_mainwin (void)
gtk_container_add (GTK_CONTAINER (order1_menu), order_linear);
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (order_linear), TRUE);
- order_shuffle = gtk_radio_menu_item_new_with_mnemonic (order_linear_group, "Shuffle");
- order_linear_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (order_shuffle));
- gtk_widget_show (order_shuffle);
- gtk_container_add (GTK_CONTAINER (order1_menu), order_shuffle);
- gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (order_shuffle), TRUE);
-
order_random = gtk_radio_menu_item_new_with_mnemonic (order_linear_group, "Random");
order_linear_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (order_random));
gtk_widget_show (order_random);
gtk_container_add (GTK_CONTAINER (order1_menu), order_random);
- gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (order_random), TRUE);
looping1 = gtk_menu_item_new_with_mnemonic ("Looping");
gtk_widget_show (looping1);
@@ -260,13 +252,11 @@ create_mainwin (void)
loop_all_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (loop_single));
gtk_widget_show (loop_single);
gtk_container_add (GTK_CONTAINER (looping1_menu), loop_single);
- gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (loop_single), TRUE);
loop_disable = gtk_radio_menu_item_new_with_mnemonic (loop_all_group, "Don't Loop");
loop_all_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (loop_disable));
gtk_widget_show (loop_disable);
gtk_container_add (GTK_CONTAINER (looping1_menu), loop_disable);
- gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (loop_disable), TRUE);
menuitem4 = gtk_menu_item_new_with_mnemonic ("_Help");
gtk_widget_show (menuitem4);
@@ -469,9 +459,6 @@ create_mainwin (void)
g_signal_connect ((gpointer) order_linear, "activate",
G_CALLBACK (on_order_linear_activate),
NULL);
- g_signal_connect ((gpointer) order_shuffle, "activate",
- G_CALLBACK (on_order_shuffle_activate),
- NULL);
g_signal_connect ((gpointer) order_random, "activate",
G_CALLBACK (on_order_random_activate),
NULL);
@@ -627,7 +614,6 @@ create_mainwin (void)
GLADE_HOOKUP_OBJECT (mainwin, order1, "order1");
GLADE_HOOKUP_OBJECT (mainwin, order1_menu, "order1_menu");
GLADE_HOOKUP_OBJECT (mainwin, order_linear, "order_linear");
- GLADE_HOOKUP_OBJECT (mainwin, order_shuffle, "order_shuffle");
GLADE_HOOKUP_OBJECT (mainwin, order_random, "order_random");
GLADE_HOOKUP_OBJECT (mainwin, looping1, "looping1");
GLADE_HOOKUP_OBJECT (mainwin, looping1_menu, "looping1_menu");
diff --git a/main.c b/main.c
index c762fc7b..f4320ea8 100644
--- a/main.c
+++ b/main.c
@@ -56,6 +56,9 @@ update_songinfo (void) {
strcpy (sbtext_new, "Paused");
songpos = 0;
}
+ else if (p_isstopped ()) {
+ strcpy (sbtext_new, "Stopped");
+ }
else if (playlist_current.codec) {
codec_lock ();
codec_t *c = playlist_current.codec;
@@ -73,9 +76,6 @@ update_songinfo (void) {
snprintf (sbtext_new, 512, "[%s] %dHz | %d bit | %s | %d:%02d / %d:%02d | %d songs total", playlist_current.filetype ? playlist_current.filetype:"-", samplerate, bitspersample, mode, minpos, secpos, mindur, secdur, pl_getcount ());
}
- else {
- strcpy (sbtext_new, "Stopped");
- }
if (strcmp (sbtext_new, sb_text)) {
strcpy (sb_text, sbtext_new);
@@ -147,8 +147,9 @@ psdl_thread (uintptr_t ctx) {
GDK_THREADS_LEAVE();
break;
case M_STOPSONG:
- GDK_THREADS_ENTER();
p_stop ();
+ GDK_THREADS_ENTER();
+ gtkpl_redraw_pl_row (&main_playlist, main_playlist.row);
GDK_THREADS_LEAVE();
break;
case M_NEXTSONG:
@@ -164,13 +165,15 @@ psdl_thread (uintptr_t ctx) {
GDK_THREADS_LEAVE();
break;
case M_PAUSESONG:
- GDK_THREADS_ENTER();
if (p_ispaused ()) {
p_unpause ();
}
else {
p_pause ();
}
+
+ GDK_THREADS_ENTER();
+ gtkpl_redraw_pl_row (&main_playlist, main_playlist.row);
GDK_THREADS_LEAVE();
break;
case M_PLAYRANDOM:
diff --git a/palsa.c b/palsa.c
index 294263c1..5026d9ec 100644
--- a/palsa.c
+++ b/palsa.c
@@ -220,6 +220,11 @@ palsa_stop (void) {
}
int
+palsa_isstopped (void) {
+ return (state == 0);
+}
+
+int
palsa_ispaused (void) {
// return pause state
return (state == 2);
diff --git a/palsa.h b/palsa.h
index 0419a4ed..009d01af 100644
--- a/palsa.h
+++ b/palsa.h
@@ -31,6 +31,9 @@ int
palsa_stop (void);
int
+palsa_isstopped (void);
+
+int
palsa_ispaused (void);
int
diff --git a/playback.h b/playback.h
index 13a5bce9..dc4dd960 100644
--- a/playback.h
+++ b/playback.h
@@ -40,6 +40,7 @@
#define p_unpause palsa_unpause
#define p_set_volume palsa_set_volume
#define p_get_rate palsa_get_rate
+#define p_isstopped palsa_isstopped
#endif
#endif // __PLAYBACK_H