mp3splt-gtk
tree_tab.c File Reference
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <gtk/gtk.h>
#include <glib/gi18n.h>
#include <libmp3splt/mp3splt.h>
#include "freedb_tab.h"
#include "util.h"
#include "player.h"
#include "tree_tab.h"
#include "main_win.h"
#include "utilities.h"
#include "player_tab.h"
#include "mp3splt-gtk.h"
#include "split_files.h"
#include "preferences_tab.h"
#include "preferences_manager.h"
Include dependency graph for tree_tab.c:

Go to the source code of this file.

Functions

void add_row (gboolean checked)
 
void add_row_clicked (GtkWidget *button, gpointer data)
 
void add_splitpoint (Split_point my_split_point, gint old_index)
 
void add_splitpoint_from_player (GtkWidget *widget, gpointer data)
 
void cell_edited_event (GtkCellRendererText *cell, gchar *path_string, gchar *new_text, gpointer data)
 
gboolean check_if_description_exists (gchar *descr, gint number)
 
gboolean check_if_splitpoint_does_not_exists (GtkTreeView *tree_view, gint minutes, gint seconds, gint hundr_secs, gint current_split)
 
void clear_current_description (void)
 
void close_popup_window_event (GtkWidget *window, gpointer data)
 
void copy_filename_to_current_description (const gchar *fname)
 
GtkWidget * create_choose_splitpoints_frame (GtkTreeView *tree_view)
 
void create_columns (GtkTreeView *tree_view)
 
void create_detect_silence_and_add_splitpoints_window (GtkWidget *button, gpointer *data)
 
GtkWidget * create_init_special_buttons (GtkTreeView *tree_view)
 
GtkWidget * create_init_spinner (GtkWidget *bottomhbox1, gint min, gint max, gchar *label_text, gint type)
 
GtkWidget * create_init_spinners_buttons (GtkTreeView *tree_view)
 
GtkTreeModel * create_model ()
 
GtkTreeView * create_tree_view ()
 
void create_trim_silence_window (GtkWidget *button, gpointer *data)
 
void detect_silence_and_add_splitpoints_start_thread ()
 
void detect_silence_and_add_trim_splitpoints_start_thread ()
 
gpointer detect_silence_and_set_splitpoints (gpointer data)
 
gint get_first_splitpoint_selected ()
 
void get_hundr_secs_mins_time (gint time_pos, gint *time_hundr, gint *time_secs, gint *time_mins)
 
gchar * get_splitpoint_name (gint index)
 
gint get_splitpoint_time (gint this_splitpoint)
 
void handle_detached_event (GtkHandleBox *handlebox, GtkWidget *widget, gpointer data)
 
void order_length_column (GtkTreeView *tree_view)
 
void preview_song (GtkTreeView *tree_view, GtkTreePath *path, GtkTreeViewColumn *col, gpointer user_data)
 
void put_split_filename (const char *filename, int progress_data)
 
void put_splitpoints_in_the_state (splt_state *state)
 
void remove_all_rows (GtkWidget *widget, gpointer data)
 
void remove_row (GtkWidget *widget, gpointer data)
 
void remove_splitpoint (gint index, gint stop_preview)
 
void row_selection_event ()
 
void select_splitpoint (gint index)
 
void silence_remove_silence_checked (GtkToggleButton *button, gpointer data)
 
gpointer split_preview (gpointer data)
 
gint splitpoint_to_hundreths (Split_point point)
 
void update_add_button ()
 
void update_current_description (gchar *descr, gint number)
 
void update_hundr_secs_from_spinner (GtkWidget *widget, gpointer data)
 
void update_minutes_from_spinner (GtkWidget *widget, gpointer data)
 
void update_seconds_from_spinner (GtkWidget *widget, gpointer data)
 
void update_silence_parameters (GtkWidget *widget, gpointer data)
 
void update_splitpoint (gint index, Split_point new_point)
 
void update_splitpoint_check (gint index)
 
void update_splitpoint_from_time (gint index, gdouble time)
 

Variables

GtkWidget * add_button = NULL
 
GtkWidget * cancel_button
 
gchar current_description [255] = "description here"
 
gfloat current_time
 
gint debug_is_active
 
gchar * filename_path_of_split
 
gchar * filename_to_split
 
gint first_splitpoint_selected = -1
 
GtkWidget * handle_box
 
GtkWidget * names_from_filename
 
gboolean new_left_splitpoint_added = FALSE
 
GtkWidget * output_entry
 
GtkWidget * percent_progress_bar
 
gint player_hundr_secs
 
gint player_minutes
 
gint player_seconds
 
gint preview_start_position
 
gint preview_start_splitpoint = -1
 
gboolean quick_preview = FALSE
 
gint quick_preview_end_splitpoint = -1
 
GtkWidget * remove_all_button = NULL
 
GtkWidget * remove_row_button = NULL
 
GtkWidget * scan_silence_button = NULL
 
GtkWidget * scan_trim_silence_button = NULL
 
int selected_player
 
gfloat silence_minimum_length = SPLT_DEFAULT_PARAM_MINIMUM_LENGTH
 
gfloat silence_minimum_track_length = SPLT_DEFAULT_PARAM_MINIMUM_TRACK_LENGTH
 
gint silence_number_of_tracks = SPLT_DEFAULT_PARAM_TRACKS
 
gfloat silence_offset_value = SPLT_DEFAULT_PARAM_OFFSET
 
GtkWidget * silence_remove_silence = NULL
 
gboolean silence_remove_silence_between_tracks = FALSE
 
gfloat silence_threshold_value = SPLT_DEFAULT_PARAM_THRESHOLD
 
gint spin_hundr_secs = 0
 
gint spin_mins = 0
 
gint spin_secs = 0
 
GtkWidget * spinner_hundr_secs
 
GtkWidget * spinner_minutes
 
GtkWidget * spinner_seconds
 
GtkWidget * spinner_silence_minimum = NULL
 
GtkWidget * spinner_silence_minimum_track = NULL
 
GtkWidget * spinner_silence_number_tracks = NULL
 
GtkWidget * spinner_silence_offset = NULL
 
GtkWidget * spinner_silence_threshold
 
gint splitnumber = 0
 
gint splitpoint_checked = TRUE
 
GArray * splitpoints = NULL
 
splt_statethe_state
 
gint this_row = 0
 
gint timer_active
 
GtkTreeView * tree_view
 
gint we_are_splitting
 
GtkWidget * window
 

Detailed Description


The splitpoints tab

this file is used for the Splitpoints tab (which in turn contains the splitpoints table)

Definition in file tree_tab.c.

Function Documentation

void add_row ( gboolean  checked)

adds a row to the table

Definition at line 1133 of file tree_tab.c.

References add_splitpoint().

Referenced by update_splitpoints_from_the_state().

Here is the call graph for this function:

Here is the caller graph for this function:

void add_splitpoint ( Split_point  my_split_point,
gint  old_index 
)

adds a splitpoint

Parameters
my_split_pointThe data for our new split point
old_indexused when we update a splitpoint to see where we had the play_preview point

Definition at line 905 of file tree_tab.c.

References cancel_quick_preview(), cancel_quick_preview_all(), check_if_splitpoint_does_not_exists(), check_update_down_progress_bar(), COL_CHECK, COL_DESCRIPTION, COL_HUNDR_SECS, COL_MINUTES, COL_SECONDS, first_splitpoint_selected, get_splitpoint_time(), inputfilename_get(), order_length_column(), preview_start_splitpoint, put_status_message(), quick_preview, quick_preview_end_splitpoint, remove_status_message(), splitnumber, splitpoints, tree_view, update_add_button(), and update_current_description().

Referenced by add_row(), and update_splitpoint().

Here is the call graph for this function:

Here is the caller graph for this function:

void cell_edited_event ( GtkCellRendererText *  cell,
gchar *  path_string,
gchar *  new_text,
gpointer  data 
)

event for editing a cell

Definition at line 744 of file tree_tab.c.

References COL_DESCRIPTION, COL_HUNDR_SECS, COL_MINUTES, COL_SECONDS, inputfilename_get(), splitpoints, tree_view, update_current_description(), and update_splitpoint().

Referenced by create_columns().

Here is the call graph for this function:

Here is the caller graph for this function:

gboolean check_if_description_exists ( gchar *  descr,
gint  number 
)

checks if the name of the current track is already in use

Parameters
descrThe name of the current track
numberThe number of the track we don't want to compare our track name with
Returns
TRUE if the new track name for track (number) is unique

Definition at line 430 of file tree_tab.c.

References COL_DESCRIPTION, and tree_view.

Referenced by update_current_description().

Here is the caller graph for this function:

gboolean check_if_splitpoint_does_not_exists ( GtkTreeView *  tree_view,
gint  minutes,
gint  seconds,
gint  hundr_secs,
gint  current_split 
)

checks if splitpoints exists in the table and is different from current_split

Definition at line 356 of file tree_tab.c.

References COL_HUNDR_SECS, COL_MINUTES, and COL_SECONDS.

Referenced by add_splitpoint(), update_add_button(), and update_splitpoint().

Here is the caller graph for this function:

void close_popup_window_event ( GtkWidget *  window,
gpointer  data 
)

Issued when closing the new window after detaching.

Definition at line 2103 of file tree_tab.c.

Referenced by handle_detached_event().

Here is the caller graph for this function:

GtkWidget* create_choose_splitpoints_frame ( GtkTreeView *  tree_view)

creates the choose splitpoints frame

This frame contains the spinners, arrows, the tree, add, remove buttons

Definition at line 2140 of file tree_tab.c.

References create_columns(), create_init_special_buttons(), create_init_spinners_buttons(), and handle_detached_event().

Referenced by create_main_vbox().

Here is the call graph for this function:

Here is the caller graph for this function:

void create_columns ( GtkTreeView *  tree_view)

creates columns for the tree

Definition at line 1923 of file tree_tab.c.

References cell_edited_event(), COL_CHECK, COL_DESCRIPTION, COL_HUNDR_SECS, COL_MINUTES, COL_NUMBER, COL_PREVIEW, COL_SECONDS, and COL_SPLIT_PREVIEW.

Referenced by create_choose_splitpoints_frame().

Here is the call graph for this function:

Here is the caller graph for this function:

void create_detect_silence_and_add_splitpoints_window ( GtkWidget *  button,
gpointer *  data 
)
GtkWidget* create_init_special_buttons ( GtkTreeView *  tree_view)

special buttons like 'set silence from silence detection'

Definition at line 1682 of file tree_tab.c.

References create_cool_button(), and create_detect_silence_and_add_splitpoints_window().

Referenced by create_choose_splitpoints_frame().

Here is the call graph for this function:

Here is the caller graph for this function:

GtkWidget* create_init_spinner ( GtkWidget *  bottomhbox1,
gint  min,
gint  max,
gchar *  label_text,
gint  type 
)

creates and and initialise a spinner

Definition at line 1589 of file tree_tab.c.

References update_hundr_secs_from_spinner(), update_minutes_from_spinner(), and update_seconds_from_spinner().

Referenced by create_init_spinners_buttons().

Here is the call graph for this function:

Here is the caller graph for this function:

GtkWidget* create_init_spinners_buttons ( GtkTreeView *  tree_view)

minutes ,seconds spinners ; add, delete buttons

Definition at line 1625 of file tree_tab.c.

References create_cool_button(), create_init_spinner(), remove_all_rows(), remove_row(), spinner_hundr_secs, spinner_minutes, and spinner_seconds.

Referenced by create_choose_splitpoints_frame().

Here is the call graph for this function:

Here is the caller graph for this function:

GtkTreeModel* create_model ( )

creates the model for the tree, gtkliststore

Definition at line 245 of file tree_tab.c.

Referenced by create_tree_view().

Here is the caller graph for this function:

GtkTreeView* create_tree_view ( )

creates the tree view

Definition at line 2249 of file tree_tab.c.

References create_model(), preview_song(), row_selection_event(), and tree_view.

Referenced by create_main_vbox().

Here is the call graph for this function:

Here is the caller graph for this function:

void detect_silence_and_add_splitpoints_start_thread ( )

start thread with 'set splitpints from silence detection'

Definition at line 1222 of file tree_tab.c.

References detect_silence_and_set_splitpoints(), and SPLT_FALSE.

Referenced by create_detect_silence_and_add_splitpoints_window().

Here is the call graph for this function:

Here is the caller graph for this function:

gpointer detect_silence_and_set_splitpoints ( gpointer  data)
gint get_first_splitpoint_selected ( )

Gets the number of the first splitpoint with selected "Keep" checkbox.

Definition at line 486 of file tree_tab.c.

References tree_view.

Referenced by draw_motif_splitpoints(), remove_splitpoint(), and update_splitpoint().

Here is the caller graph for this function:

void get_hundr_secs_mins_time ( gint  time_pos,
gint *  time_hundr,
gint *  time_secs,
gint *  time_mins 
)

returns secs, mins, hundr of secs from a time

not used for now

Definition at line 575 of file tree_tab.c.

Referenced by update_splitpoint_from_time().

Here is the caller graph for this function:

gchar* get_splitpoint_name ( gint  index)

returns the name of the splitpoint

result must be g_free'd after use

Definition at line 1721 of file tree_tab.c.

References COL_DESCRIPTION, and tree_view.

Referenced by check_update_down_progress_bar(), and update_splitpoint().

Here is the caller graph for this function:

gint get_splitpoint_time ( gint  this_splitpoint)

returns a splitpoint from the table

Definition at line 1752 of file tree_tab.c.

References splitpoint_to_hundreths(), and splitpoints.

Referenced by add_splitpoint(), change_progress_bar(), da_notify_event(), da_press_event(), da_unpress_event(), mytimer(), player_quick_preview(), and preview_song().

Here is the call graph for this function:

Here is the caller graph for this function:

void handle_detached_event ( GtkHandleBox *  handlebox,
GtkWidget *  widget,
gpointer  data 
)

Issued when we detach the handle.

Definition at line 2116 of file tree_tab.c.

References close_popup_window_event().

Referenced by create_choose_splitpoints_frame().

Here is the call graph for this function:

Here is the caller graph for this function:

void order_length_column ( GtkTreeView *  tree_view)

order the number column

Definition at line 261 of file tree_tab.c.

References COL_HUNDR_SECS, COL_MINUTES, COL_NUMBER, COL_SECONDS, and splitnumber.

Referenced by add_splitpoint(), and remove_splitpoint().

Here is the caller graph for this function:

void preview_song ( GtkTreeView *  tree_view,
GtkTreePath *  path,
GtkTreeViewColumn *  col,
gpointer  user_data 
)

the row clicked event, preview the song

Definition at line 1851 of file tree_tab.c.

References COL_PREVIEW, COL_SPLIT_PREVIEW, get_splitpoint_time(), player_quick_preview(), preview_start_position, put_status_message(), quick_preview_end_splitpoint, and this_row.

Referenced by create_tree_view().

Here is the call graph for this function:

Here is the caller graph for this function:

void put_split_filename ( const char *  filename,
int  progress_data 
)

Add another file to the split_file tab.

Definition at line 147 of file mp3splt-gtk.c.

References add_split_row(), put_status_message(), queue_files_button, and remove_all_files_button.

Referenced by detect_silence_and_set_splitpoints(), and main().

Here is the call graph for this function:

Here is the caller graph for this function:

void put_splitpoints_in_the_state ( splt_state state)

puts the splitpoints into the state

Definition at line 2206 of file tree_tab.c.

References COL_DESCRIPTION, mp3splt_append_splitpoint(), splitnumber, splitpoints, and tree_view.

Referenced by split_it().

Here is the call graph for this function:

Here is the caller graph for this function:

void remove_all_rows ( GtkWidget *  widget,
gpointer  data 
)

removes all rows from the table

Definition at line 1555 of file tree_tab.c.

References cancel_quick_preview_all(), check_update_down_progress_bar(), remove_status_message(), splitnumber, splitpoints, tree_view, and update_add_button().

Referenced by create_init_spinners_buttons(), and update_splitpoints_from_the_state().

Here is the call graph for this function:

Here is the caller graph for this function:

void remove_row ( GtkWidget *  widget,
gpointer  data 
)

remove a row from the table

Definition at line 1510 of file tree_tab.c.

References remove_splitpoint(), splitnumber, and tree_view.

Referenced by create_init_spinners_buttons().

Here is the call graph for this function:

Here is the caller graph for this function:

void remove_splitpoint ( gint  index,
gint  stop_preview 
)

removes a splitpoint

Parameters
indexNumber of the split point
stop_previewmeans we stop preview if necessary

Definition at line 612 of file tree_tab.c.

References cancel_quick_preview_all(), check_update_down_progress_bar(), get_first_splitpoint_selected(), order_length_column(), preview_start_splitpoint, quick_preview_end_splitpoint, remove_status_message(), splitnumber, splitpoints, tree_view, and update_add_button().

Referenced by da_press_event(), remove_row(), and update_splitpoint().

Here is the call graph for this function:

Here is the caller graph for this function:

void row_selection_event ( )

row selection event

Definition at line 522 of file tree_tab.c.

Referenced by create_tree_view().

Here is the caller graph for this function:

void select_splitpoint ( gint  index)

selects a splitpoint

Definition at line 586 of file tree_tab.c.

References remove_status_message(), and tree_view.

Referenced by da_press_event().

Here is the call graph for this function:

Here is the caller graph for this function:

void silence_remove_silence_checked ( GtkToggleButton *  button,
gpointer  data 
)

action when checking the 'remove silence' button

Definition at line 1265 of file tree_tab.c.

References update_silence_parameters().

Referenced by create_detect_silence_and_add_splitpoints_window().

Here is the call graph for this function:

Here is the caller graph for this function:

gint splitpoint_to_hundreths ( Split_point  point)

returns the hundreths of seconds from a Split_point

Definition at line 1711 of file tree_tab.c.

Referenced by get_splitpoint_time().

Here is the caller graph for this function:

void update_add_button ( )

updates add button

Makes the add button show whether the spinners splitpoint is already in the table or not

Definition at line 203 of file tree_tab.c.

References check_if_splitpoint_does_not_exists(), and tree_view.

Referenced by add_splitpoint(), remove_all_rows(), remove_splitpoint(), update_hundr_secs_from_spinner(), update_minutes_from_spinner(), update_seconds_from_spinner(), and update_splitpoints_from_the_state().

Here is the call graph for this function:

Here is the caller graph for this function:

void update_current_description ( gchar *  descr,
gint  number 
)

Set the name of the splitpoint (number) to (descr)

Parameters
descrthe new name of the split point
numberThe number of the split point

If any split point with a different number already uses the name we want we chose for this split point this function adds a number as a postfix (or updates the already-existing postfix) to force the new splitpoint's name. do be unique.

Definition at line 538 of file tree_tab.c.

References check_if_description_exists(), and splitnumber.

Referenced by add_splitpoint(), and cell_edited_event().

Here is the call graph for this function:

Here is the caller graph for this function:

void update_hundr_secs_from_spinner ( GtkWidget *  widget,
gpointer  data 
)

updates the hundredth of seconds for the spinner

Definition at line 236 of file tree_tab.c.

References spinner_hundr_secs, and update_add_button().

Referenced by create_init_spinner(), and update_splitpoints_from_the_state().

Here is the call graph for this function:

Here is the caller graph for this function:

void update_minutes_from_spinner ( GtkWidget *  widget,
gpointer  data 
)

updates the minutes from the spinner

Definition at line 219 of file tree_tab.c.

References spinner_minutes, and update_add_button().

Referenced by create_init_spinner(), and update_splitpoints_from_the_state().

Here is the call graph for this function:

Here is the caller graph for this function:

void update_seconds_from_spinner ( GtkWidget *  widget,
gpointer  data 
)

updates the seconds from the spinner

Definition at line 227 of file tree_tab.c.

References spinner_seconds, and update_add_button().

Referenced by create_init_spinner(), and update_splitpoints_from_the_state().

Here is the call graph for this function:

Here is the caller graph for this function:

void update_silence_parameters ( GtkWidget *  widget,
gpointer  data 
)

update silence parameters when 'widget' changes

Definition at line 1233 of file tree_tab.c.

References silence_remove_silence, spinner_silence_number_tracks, spinner_silence_offset, and spinner_silence_threshold.

Referenced by create_detect_silence_and_add_splitpoints_window(), and silence_remove_silence_checked().

Here is the caller graph for this function:

void update_splitpoint ( gint  index,
Split_point  new_point 
)

Set all values of a split point.

Parameters
new_pointAll values for this split point
indexThe number of this split point

Will display an error in the message bar if a splitpoint with a different index number with exactly the same time value exists and otherwise update the split point.

Definition at line 676 of file tree_tab.c.

References add_splitpoint(), check_if_splitpoint_does_not_exists(), first_splitpoint_selected, get_first_splitpoint_selected(), get_splitpoint_name(), put_status_message(), remove_splitpoint(), splitpoints, and tree_view.

Referenced by cell_edited_event(), update_splitpoint_check(), and update_splitpoint_from_time().

Here is the call graph for this function:

Here is the caller graph for this function:

void update_splitpoint_check ( gint  index)

Toggles a splitpoint's "Keep" flag.

Parameters
indexis the position in the GArray with splitpoints aka the split point's number

Definition at line 736 of file tree_tab.c.

References splitpoints, and update_splitpoint().

Referenced by da_press_event().

Here is the call graph for this function:

Here is the caller graph for this function:

void update_splitpoint_from_time ( gint  index,
gdouble  time 
)

Set a splitpoint's time value.

Parameters
indexThe split point's number
timethe new time value

Definition at line 717 of file tree_tab.c.

References get_hundr_secs_mins_time(), splitpoints, and update_splitpoint().

Referenced by da_unpress_event().

Here is the call graph for this function:

Here is the caller graph for this function:

Variable Documentation