private MovieMenu menu;
private Gdk.Pixbuf no_poster;
private MoviePoster.Factory poster_factory;
+ private HBox hbox;
private Image image;
+ private VBox details;
+ private PannableArea pannable;
+ private Label plot;
+ private bool portrait_mode;
public MovieWindow.with_movie (Movie movie, MovieListStore store) {
set_title (movie.title);
// Poster
image = new Image ();
- image.set_size_request (268, 424);
if (movie.poster != null && movie.poster.pixbuf != null) {
image.pixbuf = movie.poster.pixbuf;
movie.notify.connect (this.on_movie_changed);
if (movie.poster != null && movie.poster.thumbnail != null) {
// FIXME
- image.pixbuf = movie.poster.thumbnail.scale_simple (244, 400, Gdk.InterpType.BILINEAR);
+ image.pixbuf = movie.poster.thumbnail.scale_simple (268, 424, Gdk.InterpType.BILINEAR);
} else {
// FIXME
if (no_poster == null) try {
}
// Text area
- string genres = movie.genres.to_string ();
string year = movie.year > 0 ? " (%d)".printf (movie.year) : "";
- string text = "<b>%s</b>%s".printf (genres, year);
-
+ string text = "<big><b>%s</b></big>%s\n<small>%s</small>".printf (movie.title, year, movie.secondary);
var label = new Label (text);
label.wrap = true;
label.use_markup = true;
label.set_alignment (0.0f, 0.0f);
- var hbox = new HBox (false, 0);
- hbox.pack_start (image, false, true, 0);
- hbox.pack_start (label, true, true, MARGIN_DOUBLE);
+ var header = new HBox (false, 0);
+ header.pack_start (label, true, true, 0);
+ if (movie.rating > 0) {
+ text = "<big><b>%d.%d</b></big>".printf (movie.rating / 10, movie.rating % 10);
+ var rating = new Label (text);
+ rating.use_markup = true;
+ rating.set_alignment (0.5f, 0.0f);
+ header.pack_start (rating, false, false, MARGIN_DOUBLE);
+ }
+
+ plot = new Label (movie.get_plot ());
+ plot.wrap = true;
+ plot.set_alignment (0.0f, 0.0f);
+
+ details = new VBox (false, MARGIN_DOUBLE);
+ details.pack_start (header, false, false, 0);
+ details.pack_start (plot, false, false, 0);
- var vbox = new VBox (false, 0);
- vbox.pack_start (hbox, true, true, MARGIN_DOUBLE);
+ var pannable = new PannableArea ();
+ var eventbox = new EventBox ();
+ eventbox.add (details);
+ eventbox.above_child = true;
+ pannable.add_with_viewport (eventbox);
- add (vbox);
+ hbox = new HBox (false, 0);
+ hbox.pack_start (pannable, true, true, 0);
+
+ portrait_mode = CinaestProgram.orientation.portrait;
+ if (portrait_mode) {
+ details.pack_start (image, false, false, 0);
+ details.reorder_child (image, 0);
+ plot.set_size_request (480 - 2 * MARGIN_DOUBLE, -1);
+ } else {
+ hbox.pack_start (image, false, false, MARGIN_DOUBLE);
+ hbox.reorder_child (image, 0);
+ plot.set_size_request (800 - 268 /* image */ - 3 * MARGIN_DOUBLE, -1);
+ pannable.set_size_request (-1, 424);
+ }
+
+ hbox.show_all ();
+ add (hbox);
+
+ // Connect signals
+ menu.movie_deleted.connect (() => { destroy (); });
+ Gdk.Screen.get_default ().size_changed.connect (on_orientation_changed);
}
private void receive_poster (Gdk.Pixbuf pixbuf, Movie movie) {
image.pixbuf = movie.poster.pixbuf;
}
}
+
+ private void on_orientation_changed (Gdk.Screen screen) {
+ if (CinaestProgram.orientation.portrait == portrait_mode)
+ return;
+
+ portrait_mode = CinaestProgram.orientation.portrait;
+ if (portrait_mode) {
+ hbox.remove (image);
+ details.pack_start (image, false, false, 0);
+ details.reorder_child (image, 0);
+ plot.set_size_request (480 - 2 * MARGIN_DOUBLE, -1);
+ pannable.set_size_request (-1, -1);
+ } else {
+ details.remove (image);
+ hbox.pack_start (image, false, false, MARGIN_DOUBLE);
+ hbox.reorder_child (image, 0);
+ pannable.set_size_request (-1, 424);
+ plot.set_size_request (800 - 268 /* image */ - 3 * MARGIN_DOUBLE, -1);
+ }
+ }
}