user_interface.h 4.08 KB
Newer Older
1
/*
2
 * snappy - 0.3
3
 *
4 5
 * Copyright (C) 2011-2013 Collabora Ltd.
 * Luis de Bethencourt <luis@debethencourt.com>
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
 *
 * 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, 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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301
 * USA
 */

#ifndef __USER_INTERFACE_H__
#define __USER_INTERFACE_H__

26 27
#include <gtk/gtk.h>

28
#include "gst_engine.h"
29
#include "screensaver.h"
30

31
#define CTL_SHOW_SEC 3
32
#define CTL_FADE_DURATION G_TIME_SPAN_MILLISECOND / 4
33

34
#define CTL_BORDER 0
35
#define SHADOW_CORRECT 15
36 37
#define CTL_SPACING 0

38 39
#define CONTROLS_WIDTH_RATIO 0.48f
#define CONTROLS_HEIGHT_RATIO 0.28f
40 41 42 43 44 45 46
#define CONTROLS_ASPECT_RATIO 4.0f

#define BG_W 986.0f
#define BG_H 162.0f
#define SHADOW_RIGHT 18.0f
#define SHADOW_BOTTOM 11.0f

Robert Swain's avatar
Robert Swain committed
47 48
#define MAIN_BOX_W 0.95f
#define MAIN_BOX_H 0.8f
49

50
#define PLAY_TOGGLE_RATIO 0.45f
51
#define TITLE_RATIO 0.04f
52
#define SEEK_WIDTH_RATIO 0.9f
Robert Swain's avatar
Robert Swain committed
53
#define SEEK_HEIGHT_RATIO 0.15f
54 55 56
#define SEEK_BORDER 2.0f
#define POS_RATIO 0.1f
#define VOLUME_ICON_RATIO 0.2f
Robert Swain's avatar
Robert Swain committed
57 58
#define VOLUME_WIDTH_RATIO 0.65f
#define VOLUME_HEIGHT_RATIO 0.05f
59 60 61 62 63

#define TITLE_LENGTH 40

#define SEC_IN_HOUR 3600
#define SEC_IN_MIN 60
64

65
#define PENALTY_TIME G_TIME_SPAN_MILLISECOND / 2
66

67 68 69
#define DEFAULT_WIDTH 640
#define DEFAULT_HEIGHT 480

70 71
G_BEGIN_DECLS

72 73 74 75 76 77 78
enum
{
  STREAM_AUDIO,
  STREAM_TEXT,
  STREAM_VIDEO
};

79
typedef struct _UserInterface UserInterface;
80 81 82

struct _UserInterface
{
83
  gboolean controls_showing, keep_showing_controls;
84
  gboolean blind, fullscreen, hide, penalty_box_active, tags;
85
  gboolean subtitles_available;
86

87
  gint title_length, controls_timeout, progress_id;
88 89
  guint media_width, media_height;
  guint stage_width, stage_height;
90
  gint64 media_duration;
91
  gfloat progress, volume;
92
  gfloat seek_width, seek_height;
93
  gfloat volume_width, volume_height;
94

95 96
  gchar *filename, *fileuri;
  gchar *play_png, *pause_png;
97
  gchar *segment_png;
98
  gchar *volume_low_png, *volume_high_png;
99
  gchar *subtitle_active_png, *subtitle_inactive_png;
100
  gchar *video_stream_toggle_png, *audio_stream_toggle_png;
Andoni Morales's avatar
Andoni Morales committed
101
  gchar *data_dir;
102
  gchar *duration_str;
103

104 105
  GList *uri_list;

106 107
  GtkWidget *window, *box, *clutter_widget;

108
  ClutterColor stage_color, control_color1, control_color2;
109

110
  ClutterActor *stage;
111 112 113
  ClutterActor *texture;
  ClutterActor *control_box;
  ClutterActor *control_bg, *control_title, *control_play_toggle;
114
  ClutterActor *control_seekbar;
115
  ClutterActor *control_pos;
116 117
  ClutterActor *volume_box;
  ClutterActor *volume_low, *volume_high;
118
  ClutterActor *subtitle_toggle;
119
  ClutterActor *video_stream_toggle, *audio_stream_toggle;
120
  ClutterActor *vol_int, *vol_int_bg, *volume_point;
121
  ClutterActor *info_box;
122
  ClutterActor *pos_n_vol_box;
123
  ClutterActor *main_box;
124

125
  ClutterContent *seek_canvas;
126
  ClutterContent *vol_int_canvas;
127

128
  ClutterLayoutManager *main_box_layout;
129
  ClutterLayoutManager *info_box_layout;
130
  ClutterLayoutManager *pos_n_vol_layout;
131

132
  GstEngine *engine;
133
  ScreenSaver *screensaver;
134 135
};

136 137 138 139 140
static const GtkTargetEntry drop_target_table[] = {
  {(gchar *) "text/uri-list", 0, 0}
};


141
// Declaration of non-static functions
142
void interface_init (UserInterface * ui);
143
gboolean interface_is_it_last (UserInterface * ui);
144
gboolean interface_load_uri (UserInterface * ui, gchar * uri);
145 146 147
void interface_on_drop_cb (GtkWidget * widget, GdkDragContext * context, gint x,
    gint y, GtkSelectionData * data, guint info, guint _time,
    UserInterface * ui);
148
void interface_play_next_or_prev (UserInterface * ui, gboolean next);
149
void interface_start (UserInterface * ui, gchar * uri);
150
gboolean interface_update_controls (UserInterface * ui);
151 152 153

G_END_DECLS
#endif /* __USER_INTERFACE_H__ */