/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#+
#+     Internet Radio Automation & Encoding Toolkit
#+
#+     Copyright (C) 2018 -2025 by Kevin C. O'Kane
#+
#+     Kevin C. O'Kane
#+     kc.okane@gmail.com
#+     https://www.cs.uni.edu/~okane
#+     https://threadsafebooks.com/
#+
#+ This program is free software; you can redistribute it and/or modify
#+ it under the terms of the GNU General Public License as published by
#+ the Free Software Foundation; either version 2 of the License, or
#+ (at your option) any later version.
#+
#+ This program is distributed in the hope that it will be useful,
#+ but WITHOUT ANY WARRANTY; without even the implied warranty of
#+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#+ GNU General Public License for more details.
#+
#+ You should have received a copy of the GNU General Public License
#+ along with this program; if not, write to the Free Software
#+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#+
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/

// Dec 5, 2025

#ifndef COMMON_FCN_HEADERS
#define COMMON_FCN_HEADERS

gboolean        on_albumScroll_scroll_event(GtkEntry *b, GdkEventScroll *e);
void    on_albumScroll_value_changed(GtkRange *r);
void on_albumForward_clicked(GtkWidget *b);
void    on_albumBack_clicked(GtkWidget *b);
void    SetVlcEqualizerPreAmp();
int     bigFilename(GtkEntry *user_data, char *file);
void    on_maxGain_value_changed(GtkSpinButton *s);
void    gtkSetCursor(GdkCursorType cursorType);
void cli_args(int argc, char *argv[]);
void memory_alloc();
void panel_control();
void build_tower(cairo_t *cr, double hx, double vx,
                 double gx, double tall, double base, int panel);
void tower_back(cairo_t *cr, int panel);
int filetype(char *);
void    level_bars(cairo_t *cr, double Xx, double rms, int bar);
void timer_section1();
void sprinkles(cairo_t *cr, double z, double len, int i, double hor, double ver) ;
void spots(cairo_t *cr, double hor, double ver, double len, double z) ;
void spots2(cairo_t *cr, int i, double len, double max, int lower, int panel);
void spots3(cairo_t *cr, int i, double len, double max, int lower, int panel);
void graph_manager(cairo_t *cr, GtkDrawingArea *widget, int noLine, int panel) ;
void drawS (GtkDrawingArea *widget, cairo_t *cr, int panel);
void bar_graph(int lower, double[], int, cairo_t *, int, int, int, int, int);
void color_bars(cairo_t *cr, int, int, int);
void frequency_marks(cairo_t *);
void draw_bars_only(cairo_t *cr, int lower, int i, double chan[], int, int, int);
void connecting_lines(cairo_t *, int, int, double []);
void leftFlgSubText(cairo_t *cr);
void tower_show(cairo_t *cr, int i, int panel, double slchan[], double srchan[],
                double D1_DIVISOR, double gx1, double hx, double vx, int LeftFlg);
void updateTimes();
char * ProgramName(char *, int nbr);
char * mediaProbe(int i) ;
gboolean picture_handler(struct APW *widgets);
char * ProgramName(char *, int nbr);
char * ShortName(char *tmp);
gboolean scroll_event1a(GtkScrollbar *b, GdkEventScroll *e);
int albumImage(GtkWidget *image, char *file, int width, int height);
int DisplayCover(char *file);
int filetype(char *);
int findNext();
int findNext1();
int GetTime (int ref, char *file, char *Time);
int hexcleaner(char *t);
int lastWord(char * tmp, int off);
int nextSelection();
int playable(char *text);
int showImage(GtkWidget *image, char *file, int width, int height);
int vlc_start();
int vlc_stop();
void addToTop (char * file);
void AlbumBtnLoad();
void circular_handler(GtkWidget *b);
void ClearPlayers();
void color_bars(cairo_t *cr, int i, int noLine, int color);
void createPresets();
void entry_changed1 (GtkEntry *entry, gchar *preedit, gpointer  user_data, int Row);
void entry_changed (GtkEntry *entry, gchar *preedit, gpointer  user_data, int Row);
void entry_insert(GtkEditable  *entry, gchar *edit);
void FileChooser (GtkFileChooserButton *b, int Row, GtkWidget *g_btn, GtkEntry *user_data);
void get_meta(libvlc_media_t *media);
void LoadAlbums(char *);
void LoadProgram(char *);
void meters_handler(GtkButton *b);
void moveOneToBottom (int row);
void moveOneToTop (int row);
void orgPgm();
void outVolume(double);
void paste1(int *Row);
void PauseOff ();
void playTime(time_t Now, char *start, char* end, char *length, int lngth);
void programButtonLoad(GtkWidget *, int);
void randomSlide();
void spikes1_handler(GtkWidget *b);
void spikes_handler(GtkWidget *b);
void strip(char* str);
void SwapProgramElement (int row);
void vlc_no_pause();
void vlc_pause();
void WindowsCallBacks();
char *		mediaProbe(int i);
char* 		shuffle(int, char *);
gboolean       	on_draw1_draw (GtkDrawingArea *widget, cairo_t *cr) ;
gboolean        on_draw2_draw (GtkDrawingArea *widget, cairo_t *cr) ;
gboolean	scroll_event(GdkEventScroll *e);
gboolean	talkPush (GtkWidget *widget, GdkEventKey *event, gpointer data);
gboolean	talkRelease (GtkWidget *widget, GdkEventKey *event, gpointer data);
int		delDialog();
int		mainx (char * srch, int);
int		smbParse(char * vlcRef, char *playThis);
void		AdvanceSounderPage();
int		vlc_playing();
void		entry_insert1(GtkEntry  *entry, gchar *edit);
void		getEqSettings(libvlc_equalizer_t* eq, int);
void		delRow(int Row);
void		DisplayProgramButtons(void);
void		Message(char *);
void		moveToBottom (int row);
void		moveToTop (int row);
void		no_showAudioStuff();
void		on_haltProgram_clicked (GtkButton *button);
void		on_pauseAtEnd_toggled (GtkButton *button);
void		on_Playerx_clicked (GtkButton *);
void		on_randomize_clicked (GtkButton *button);
void		on_tooltips_toggled(GtkWidget *); // turn on/off tooltips
void		on_window_main_destroy();
gboolean	on_window_main_configure(GtkWindow *window, GdkEvent *event);
void		paste(int *Row);
void		PlayClip (GtkButton *, GtkEntry *, int);
void		setVlcRate(float rate);
void		showAudioStuff();
void		updateTimes();
void	show_error_sink(const char *txt );
void	show_error_source(const char *txt );
void	stream_read_callback_sink(pa_stream *s, size_t l, void *dmy);
void	stream_read_callback_source(pa_stream *s, size_t len, void *user);
void	stream_state_callback_source(pa_stream *s, void *dmy);
void	sink_create_stream(const char *name, const char *description,
                           const pa_sample_spec sampSpec, const pa_channel_map cmap);
void	source_create_stream(const char *name, const char *description,
                             const pa_sample_spec sampSpec, const pa_channel_map cmap);
void	source_info_callback(pa_context *p, const pa_source_info *si, int is_last, void *dmy);
void	sink_info_callback(pa_context *p, const pa_sink_info *si, int is_last, void *dmy);
void	sink_server_info_callback(pa_context *c, const pa_server_info *si, void *dmy);
void	source_server_info_callback(pa_context *c, const pa_server_info *si, void *dmy);
void    source_connection_state_callback(pa_context *c, void *dmy);
void	sink_connection_state_callback(pa_context *c, void *dmy);
void	on_destroy();
void spectrum();
gboolean                on_draw4_draw (GtkDrawingArea *, cairo_t *) ;
gboolean                on_draw1_draw (GtkDrawingArea *, cairo_t *) ;
gboolean                on_draw2_draw (GtkDrawingArea *widget, cairo_t *cr);
char *  sink_name();
char *  source_name();
gboolean        timer_handler(struct APW *widgets);
gboolean        pulse_timer_handler();
void    source_connection_state_callback(pa_context *c, void *dmy);
void    sink_connection_state_callback(pa_context *c, void *dmy);
void    make_sprinkles(double D1_DIVISOR);

gboolean digital_draw2_draw (GtkDrawingArea *widget, cairo_t *cr);
gboolean vu_draw2_draw (GtkDrawingArea *widget, cairo_t *cr);
void color_generator(cairo_t *cr, int i, double*, double*, double*);
void rand_color_generator(cairo_t *cr, int i, double*, double*, double*);


#endif

