File: display.h

package info (click to toggle)
gtkpod 0.99.14-3
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 7,716 kB
  • ctags: 3,266
  • sloc: ansic: 43,120; sh: 4,837; xml: 1,316; lex: 637; perl: 264; makefile: 236; awk: 73; python: 35
file content (365 lines) | stat: -rw-r--r-- 11,479 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
/*
|  Copyright (C) 2002-2007 Jorg Schuler <jcsjcs at users sourceforge net>
|  Part of the gtkpod project.
| 
|  URL: http://www.gtkpod.org/
|  URL: http://gtkpod.sourceforge.net/
| 
|  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
| 
|  iTunes and iPod are trademarks of Apple
| 
|  This product is not supported/written/published by Apple!
|
|  $Id: display.h 2148 2008-11-08 08:02:15Z jcsjcs $
*/

#ifndef __DISPLAY_H__
#define __DISPLAY_H__

#ifdef HAVE_CONFIG_H
#  include <config.h>
#endif

#include <gtk/gtk.h>
#include <glade/glade.h>
#include "itdb.h"
#include "display_itdb.h"
#include "display_coverart.h"

/* Main XML glade file */
GladeXML *main_window_xml;

/* pointer to main window */
extern GtkWidget *gtkpod_window;

/* types for sort */
enum
{
    SORT_ASCENDING = GTK_SORT_ASCENDING,
    SORT_DESCENDING = GTK_SORT_DESCENDING,
    SORT_NONE = 10*(GTK_SORT_ASCENDING+GTK_SORT_DESCENDING),
};

/* Categories in each sort tab (page numbers) */
typedef enum {
  ST_CAT_ARTIST = 0,
  ST_CAT_ALBUM,
  ST_CAT_GENRE,
  ST_CAT_COMPOSER,
  ST_CAT_TITLE,
  ST_CAT_YEAR,
  ST_CAT_SPECIAL,
  ST_CAT_NUM
} ST_CAT_item;

/* Number of search tabs to be supported. */
#define SORT_TAB_MAX (ST_CAT_NUM-1)

/* Number of GtkPaned elements in the main window. The positions of
 * these elements will be stored in the prefs file and be set to the
 * last value when starting gtkpod again */
/* Number defined with glade ("paned%d") */
enum {
    PANED_PLAYLIST = 0,
    PANED_TRACKLIST,
    PANED_STATUS1,
    PANED_STATUS2,
    PANED_NUM_GLADE
};
/* Number created in display.c (for sort tabs, stored in st_paned[]) */
#define PANED_NUM_ST (SORT_TAB_MAX-1)
/* Total number */
#define PANED_NUM (PANED_NUM_GLADE+PANED_NUM_ST)

/* max. number of stars */
#define RATING_MAX 5

/* struct for each entry in sort tab */
typedef struct {
  gchar *name;
  gboolean master; /* set if this is the "All" entry */
  gboolean compilation; /* set if this is the "Compilation" entry */
  GList *members;  /* GList with member tracks (pointer to "Track") */
} TabEntry;

/* struct for time info (added, played, modified) */
typedef struct {
    gchar *int_str;   /* copy of string specified in the sort tab */
    gboolean valid;   /* is current string valid? */
    time_t lower;     /* timestamp for lower limit */
    time_t upper;     /* timestamp for upper limit ("-1": no limit) */
    GtkWidget *entry; /* pointer to GtkEntry in sort tab */
    GtkWidget *active;/* pointer to toggle button */
} TimeInfo;

/* struct with data corresponding to each sort tab */
typedef struct {
  guint current_category;            /* current page (category) selected) */
  gboolean final;                    /* have all tracks been added? */
  GtkWidget *window[ST_CAT_NUM];     /* pointer to scrolled window */
  /* The following are used for "normal" categories (not ST_CAT_SPECIAL) */
  GtkTreeModel *model;               /* pointer to model used */
  GtkNotebook *notebook;             /* pointer to notebook used */
  GtkTreeView *treeview[ST_CAT_NUM]; /* pointer to treeviews used */
  GList *entries;                    /* list with entries */
  TabEntry *current_entry;           /* pointer to currently selected entry */
  gchar *lastselection[ST_CAT_NUM];  /* name of entry last selected */
  GHashTable *entry_hash;            /* table for quick find of tab entries */
  gboolean unselected;               /* unselected item since last st_init? */
  /* The following are used for "special" categories (ST_CAT_SPECIAL) */
  GList *sp_members;                 /* list of tracks in sorttab */
  GList *sp_selected;                /* list of tracks selected */
  gboolean is_go;                    /* pass new members on automatically */
  TimeInfo ti_added;                 /* TimeInfo "added" (sp)         */
  TimeInfo ti_modified;              /* TimeInfo "modified" (sp)      */
  TimeInfo ti_played;                /* TimeInfo "played" (sp)        */
  GtkTooltipsData *sp_tooltips_data; /* ptr to tooltips in special st */
  /* function used for string comparisons, set in on_st_switch_page   */
  gint (*string_compare_func) (const gchar *str1, const gchar *str2);
} SortTab;

/* "Column numbers" in sort tab model */
typedef enum  {
  ST_COLUMN_ENTRY = 0,
  ST_NUM_COLUMNS
} ST_item;

/* Column numbers in track model */
/* Note: add corresponding entries to T_item and TM_to_T() as well 
 * (below and in misc_conversion.c). 
 * IMPORTANT: Do not change the order -- always add new entries at the
 * end */
typedef enum  {
  TM_COLUMN_TITLE = 0,
  TM_COLUMN_ARTIST,
  TM_COLUMN_ALBUM,
  TM_COLUMN_GENRE,
  TM_COLUMN_COMPOSER,
  TM_COLUMN_TRACK_NR,         /*  5 */
  TM_COLUMN_IPOD_ID,
  TM_COLUMN_PC_PATH,
  TM_COLUMN_TRANSFERRED,
  TM_COLUMN_SIZE,
  TM_COLUMN_TRACKLEN,         /* 10 */
  TM_COLUMN_BITRATE,
  TM_COLUMN_PLAYCOUNT,
  TM_COLUMN_RATING,
  TM_COLUMN_TIME_PLAYED,
  TM_COLUMN_TIME_MODIFIED,    /* 15 */
  TM_COLUMN_VOLUME,
  TM_COLUMN_YEAR,
  TM_COLUMN_CD_NR,
  TM_COLUMN_TIME_ADDED,
  TM_COLUMN_IPOD_PATH,        /* 20 */
  TM_COLUMN_SOUNDCHECK,
  TM_COLUMN_SAMPLERATE,
  TM_COLUMN_BPM,
  TM_COLUMN_FILETYPE,
  TM_COLUMN_GROUPING,         /* 25 */
  TM_COLUMN_COMPILATION,
  TM_COLUMN_COMMENT,
  TM_COLUMN_CATEGORY,
  TM_COLUMN_DESCRIPTION,
  TM_COLUMN_PODCASTURL,       /* 30 */
  TM_COLUMN_PODCASTRSS,
  TM_COLUMN_SUBTITLE,
  TM_COLUMN_TIME_RELEASED,
  TM_COLUMN_THUMB_PATH,
  TM_COLUMN_MEDIA_TYPE,       /* 35 */
  TM_COLUMN_TV_SHOW,
  TM_COLUMN_TV_EPISODE,
  TM_COLUMN_TV_NETWORK,
  TM_COLUMN_SEASON_NR,
  TM_COLUMN_EPISODE_NR,       /* 40 */
  TM_COLUMN_ALBUMARTIST,
  TM_COLUMN_SORT_ARTIST,
  TM_COLUMN_SORT_TITLE,
  TM_COLUMN_SORT_ALBUM,
  TM_COLUMN_SORT_ALBUMARTIST, /* 45 */
  TM_COLUMN_SORT_COMPOSER,
  TM_COLUMN_SORT_TVSHOW,
  TM_COLUMN_LYRICS,
  TM_NUM_COLUMNS
} TM_item;

/* A means to address the fields by uniform IDs. May be extended as
 * needed. You should extend "track_get_item_pointer()" defined in
 * track.c as well for string fields. */
/* Add corresponding entries to t_strings[] and t_tooltips[] in
   misc_conversion.c! */
/* Used in prefs_window.c to label the sort_ign_field<num> buttons */
/* Used in details.c to label the detail_label_<num> labels */
typedef enum {
    T_ALL = 0,      /* all fields */
    T_ALBUM,
    T_ARTIST,
    T_TITLE,
    T_GENRE,
    T_COMMENT,      /*  5 */
    T_COMPOSER,
    T_FILETYPE,
    T_PC_PATH,
    T_IPOD_PATH,
    T_IPOD_ID,      /* 10 */
    T_TRACK_NR,
    T_TRANSFERRED,
    T_SIZE,
    T_TRACKLEN,
    T_BITRATE,      /* 15 */
    T_SAMPLERATE,
    T_BPM,
    T_PLAYCOUNT,
    T_RATING,
    T_TIME_ADDED,   /* 20 */
    T_TIME_PLAYED,
    T_TIME_MODIFIED,
    T_VOLUME,
    T_SOUNDCHECK,
    T_YEAR,         /* 25 */
    T_CD_NR,
    T_GROUPING,
    T_COMPILATION,
    T_CATEGORY,
    T_DESCRIPTION,  /* 30 */
    T_PODCASTURL,
    T_PODCASTRSS,
    T_SUBTITLE,
    T_TIME_RELEASED,
    T_CHECKED,      /* 35 */
    T_STARTTIME,
    T_STOPTIME,
    T_REMEMBER_PLAYBACK_POSITION,
    T_SKIP_WHEN_SHUFFLING,
    T_THUMB_PATH,   /* 40 */
    T_MEDIA_TYPE,
    T_TV_SHOW,
    T_TV_EPISODE,
    T_TV_NETWORK,
    T_SEASON_NR,    /* 45 */
    T_EPISODE_NR,
    T_ALBUMARTIST,
    T_SORT_ARTIST,
    T_SORT_TITLE,
    T_SORT_ALBUM,   /* 50 */
    T_SORT_ALBUMARTIST,
    T_SORT_COMPOSER,
    T_SORT_TVSHOW,
    T_GAPLESS_TRACK_FLAG,
    T_LYRICS,
    T_ITEM_NUM,
} T_item;


/* number of entries with "autoset empty tag to filename " feature */
#define TM_NUM_TAGS_PREFS (5)

/* "Column numbers" in playlist model */
typedef enum  {
  PM_COLUMN_ITDB = 0,
  PM_COLUMN_TYPE,
  PM_COLUMN_PLAYLIST,
  PM_COLUMN_PHOTOS,
  PM_NUM_COLUMNS
} PM_column_type;

/* Drag and drop types */
enum {
    DND_GTKPOD_TRACKLIST = 1000,
    DND_GTKPOD_TM_PATHLIST,
    DND_GTKPOD_PLAYLISTLIST,
    DND_TEXT_URI_LIST,
    DND_TEXT_PLAIN,
    DND_IMAGE_JPEG
};

/* used for the ST_CAT_SPECIAL user_data (see st_create_special and
 * the corresponding signal functions) */
#define SP_SHIFT 9
#define SP_MASK ((1<<SP_SHIFT)-1)

void display_create (void);
void display_cleanup (void);
void display_adjust_menus (void);
void display_show_hide_toolbar (void);
void display_show_hide_searchbar (void);
void display_reset (gint inst);
GList *display_get_selection (guint32 inst);
GList *display_get_selected_members (gint inst);
void display_remove_autoscroll_row_timeout (GtkWidget *widget);
void display_install_autoscroll_row_timeout (GtkWidget *widget);
void display_image_dialog (GdkPixbuf *image);

Playlist* pm_get_selected_playlist (void);
iTunesDB* pm_get_selected_itdb (void);
gint pm_get_position_for_itdb (iTunesDB *itdb);
void pm_remove_playlist (Playlist *playlist, gboolean select);
void pm_add_child (iTunesDB *itdb, PM_column_type type, gpointer item, gint position);
void pm_add_itdb (iTunesDB *itdb, gint pos);
void pm_select_playlist (Playlist *playlist);
void pm_unselect_playlist (Playlist *playlist);
void pm_remove_track (Playlist *playlist, Track *track);
void pm_add_track (Playlist *playlist, Track *track, gboolean display);
void pm_itdb_name_changed (iTunesDB *itdb);
void pm_track_changed (Track *track);
void pm_sort (GtkSortType order);
void pm_stop_editing (gboolean cancel);
void pm_set_playlist_renderer_pix (GtkCellRenderer *renderer,
			  Playlist *playlist);
void pm_set_playlist_renderer_text (GtkCellRenderer *renderer,
			   Playlist *playlist);
void pm_show_all_playlists ();

void st_stop_editing (gint inst, gboolean cancel);
gboolean st_set_selection (Itdb_Track *track);
void st_redisplay (guint32 inst);
void st_sort (GtkSortType order);
void st_remove_entry (TabEntry *entry, guint32 inst);
gint st_get_instance_from_treeview (GtkTreeView *tv);
void st_show_visible (void);
void st_arrange_visible_sort_tabs (void);
void st_adopt_order_in_playlist (void);
TabEntry *st_get_selected_entry (gint inst);
void st_update_paned_position ();

void cal_open_calendar (gint inst, T_item item);
void sp_go (guint32 inst);
void sp_conditions_changed (guint32 inst);

void tm_add_track_to_track_model (Track *track, GtkTreeIter *into_iter);
gint tm_get_nr_of_tracks(void);
void tm_rows_reordered(void);
gboolean tm_add_filelist (gchar *data, GtkTreePath *path,
			  GtkTreeViewDropPosition pos);
void tm_stop_editing (gboolean cancel);
void tm_show_preferred_columns(void);
void tm_store_col_order (void);
void tm_adopt_order_in_sorttab (void);

void tm_sort (TM_item col, GtkSortType order);
gint tm_sort_counter (gint inc);
GList* tm_get_selected_trackids(void);
GList* tm_get_selected_tracks(void);
GList* tm_get_all_trackids(void);
GList* tm_get_all_tracks(void);

void display_update_default_sizes (void);
void display_set_default_sizes (void);
void display_show_hide_tooltips (void);
void display_set_info_window_menu (void);

void spl_edit (Playlist *spl);
void spl_edit_new (iTunesDB *itdb, gchar *name, gint32 pos);
#endif