mp3splt-gtk
player_tab.h
00001 /**********************************************************
00002  *
00003  * mp3splt-gtk -- utility based on mp3splt,
00004  *                for mp3/ogg splitting without decoding
00005  *
00006  * Copyright (c) 2005-2012 Alexandru Munteanu - io_fx@yahoo.fr
00007  *
00008  * http://mp3splt.sourceforge.net/
00009  *
00010  *********************************************************/
00011 
00012 /**********************************************************
00013  *
00014  * This program is free software; you can redistribute it and/or
00015  * modify it under the terms of the GNU General Public License
00016  * as published by the Free Software Foundation; either version 2
00017  * of the License, or (at your option) any later version.
00018  *
00019  * This program is distributed in the hope that it will be useful,
00020  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00021  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00022  * GNU General Public License for more details.
00023  *
00024  * You should have received a copy of the GNU General Public License
00025  * along with this program; if not, write to the Free Software
00026  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,
00027  * USA.
00028  *
00029  *********************************************************/
00030 
00031 /**********************************************************
00032  * Filename: player_tab.h
00033  *
00034  * header of player_tab.c
00035  *
00036  *********************************************************/
00037 
00038 #ifndef _PLAYER_TAB_H
00039 #define _PLAYER_TAB_H
00040 
00041 #define ICON_EXT ".svg"
00042 
00043 #define DEFAULT_TIMEOUT_VALUE 200
00044 
00046 typedef struct
00047 {
00048   long time;
00049   float level;
00050 } silence_wave;
00051 
00052 //float comparison
00053 #define DELTA 5
00054 
00055 //for the browse dir
00056 #define BROWSE_SONG 1
00057 #define BROWSE_CDDB_FILE 2
00058 #define BROWSE_CUE_FILE 3
00059 
00060 void player_quick_preview(gint splitpoint_to_preview);
00061 void check_update_down_progress_bar();
00062 void set_preview_active_if_needed();
00063 void cancel_quick_preview_all();
00064 void cancel_quick_preview();
00065 void check_cancel_quick_preview(gint i);
00066 void get_splitpoint_time_left_right(gint *time_left,
00067                                     gint *time_right,
00068                                     gint *splitpoint_left);
00069 gint mytimer(gpointer data);
00070 void reset_inactive_progress_bar();
00071 void reset_inactive_volume_button();
00072 void reset_label_time();
00073 void reset_song_infos();
00074 void reset_song_name_label();
00075 void clear_data_player();
00076 void enable_player_buttons();
00077 void disable_player_buttons();
00078 void connect_change_buttons();
00079 void disconnect_change_buttons();
00080 void connect_with_song(const gchar *fname, gint i);
00081 void connect_to_player_with_song(gint i);
00082 void connect_button_event (GtkWidget *widget,
00083                            gpointer data);
00084 void check_stream();
00085 void disconnect_button_event (GtkWidget *widget, 
00086                               gpointer data);
00087 void play_event (GtkWidget *widget, gpointer data);
00088 void stop_event (GtkWidget *widget, gpointer data);
00089 void pause_event (GtkWidget *widget, gpointer data);
00090 void prev_button_event (GtkWidget *widget, gpointer data);
00091 void next_button_event (GtkWidget *widget, gpointer data);
00092 void change_song_position();
00093 GtkWidget *create_player_buttons_hbox(GtkTreeView *tree_view);
00094 GtkWidget *create_song_informations_hbox();
00095 gboolean progress_bar_unclick_event (GtkWidget *widget,
00096                                    GdkEventCrossing *event,
00097                                      gpointer user_data);
00098 gboolean progress_bar_click_event (GtkWidget *widget,
00099                                    GdkEventCrossing *event,
00100                                    gpointer user_data);
00101 gfloat get_total_time();
00102 gfloat get_elapsed_time();
00103 void refresh_drawing_area();
00104 void progress_bar_value_changed_event (GtkRange *range,
00105                                        gpointer user_data);
00106 gboolean progress_bar_scroll_event (GtkWidget *widget,
00107                                     GdkEventScroll *event,
00108                                     gpointer user_data);
00109 gboolean progress_bar_enter_event (GtkWidget *widget,
00110                                    GdkEventCrossing *event,
00111                                    gpointer user_data);
00112 gboolean progress_bar_leave_event (GtkWidget *widget,
00113                                    GdkEventCrossing *event,
00114                                    gpointer user_data);
00115 GtkWidget *create_song_bar_hbox();
00116 void print_about_the_song();
00117 void print_player_filename();
00118 void print_all_song_infos();
00119 void print_song_time_elapsed();
00120 void change_volume_button();
00121 void change_progress_bar();
00122 GtkWidget *create_filename_player_hbox();
00123 void change_volume_event(GtkScaleButton *volume_button, gdouble value, gpointer data);
00124 
00125 gboolean volume_button_unclick_event (GtkWidget *widget,
00126                                    GdkEventCrossing *event,
00127                                    gpointer user_data);
00128 gboolean volume_button_click_event (GtkWidget *widget,
00129                                  GdkEventCrossing *event,
00130                                  gpointer user_data);
00131 gboolean volume_button_enter_event (GtkWidget *widget,
00132                                  GdkEventCrossing *event,
00133                                  gpointer user_data);
00134 gboolean volume_button_leave_event (GtkWidget *widget,
00135                                  GdkEventCrossing *event,
00136                                  gpointer user_data);
00137 gboolean volume_button_scroll_event (GtkWidget *widget,
00138                                   GdkEventScroll *event,
00139                                   gpointer user_data);
00140 GtkWidget *create_volume_control_box();
00141 void close_player_popup_window_event( GtkWidget *window,
00142                                       gpointer data );
00143 void handle_player_detached_event (GtkHandleBox *handlebox,
00144                                    GtkWidget *widget,
00145                                    gpointer data);
00146 gfloat get_right_drawing_time();
00147 gfloat get_left_drawing_time();
00148 gint get_time_hundrsecs(gint time);
00149 gint get_time_secs(gint time);
00150 gint get_time_mins(gint time);
00151 gchar *get_time_for_drawing(gchar *str,
00152                             gint time,
00153                             gboolean hundr_or_not,
00154                             gint *number_of_chars);
00155 gint time_to_pixels(gint width,
00156                     gfloat time);
00157 gfloat pixels_to_time(gfloat width,
00158                       gint pixels);
00159 gint get_draw_line_position(gint width,
00160                             gfloat time);
00161 void draw_motif(GtkWidget *da,cairo_t *gc,
00162                 gint ylimit,gint x,gint model);
00163 void draw_marks(gint time_interval,
00164                 gint left_mark,gint right_mark,
00165                 gint ylimit, GtkWidget *da, cairo_t *gc);
00166 //motif for splitpoints
00167 //draw is false if we draw the splitpoint we move
00168 void draw_motif_splitpoints(GtkWidget *da, cairo_t *gc,
00169                             gint x,gint draw,
00170                             gint current_point_hundr_secs,
00171                             gboolean move,
00172                             gint number_splitpoint);
00173 void draw_splitpoints(gint left_mark,
00174                       gint right_mark,
00175                       GtkWidget *da,
00176                       cairo_t *gc);
00177 gboolean da_expose_event (GtkWidget      *da,
00178                           GdkEventExpose *event,
00179                           gpointer       data);
00180 gboolean da_press_event (GtkWidget    *da,
00181                          GdkEventButton *event,
00182                          gpointer     data);
00183 gboolean da_unpress_event (GtkWidget    *da,
00184                            GdkEventButton *event,
00185                            gpointer     data);
00186 gboolean da_notify_event (GtkWidget     *da,
00187                           GdkEventMotion *event,
00188                           gpointer      data);
00189 GtkWidget *create_drawing_area();
00190 GtkWidget *create_player_control_frame(GtkTreeView *tree_view);
00191 
00192 //moved from the file_tab
00193 void file_chooser_cancel_event();
00194 void file_chooser_ok_event(gchar *fname);
00195 void browse_button_event( GtkWidget *widget,
00196                           gpointer   data );
00197 void close_file_popup_window_event( GtkWidget *window,
00198                                     gpointer data );
00199 void handle_file_detached_event (GtkHandleBox *handlebox,
00200                                  GtkWidget *widget,
00201                                  gpointer data);
00202 GtkWidget *create_choose_file_frame();
00203 
00204 void change_current_filename(const gchar *fname);
00205 GtkWidget *create_player_playlist_frame();
00206 
00207 void hide_connect_button();
00208 void show_connect_button();
00209 void hide_disconnect_button();
00210 void show_disconnect_button();
00211 
00212 void inputfilename_set(const gchar *filename);
00213 gchar *inputfilename_get();
00214 
00215 void build_path(GString *path, const gchar *dir, const gchar *filename);
00216 
00217 void close_playlist_popup_window_event(GtkWidget *window, gpointer data);
00218 void restart_player_timer();
00219 
00220 #endif
00221