1 /* This file is part of LED Pattern Editor.
3 * Copyright (C) 2010 Philipp Zabel
5 * LED Pattern Editor is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * LED Pattern Editor is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with LED Pattern Editor. If not, see <http://www.gnu.org/licenses/>.
19 class LedProgramDialog : Gtk.Dialog {
21 LedPatternRX51 pattern;
23 public LedProgramDialog (LedPatternRX51 _pattern) {
25 set_title ("LED pattern editor - " +
26 (pattern.name.has_prefix ("Pattern") ?
27 pattern.name.offset (7) : pattern.name) + " pattern");
29 var content = (Gtk.VBox) get_content_area ();
30 content.set_size_request (-1, 5*70);
32 lpv = new LedPatternView (pattern.copy ());
33 lpv.set_size_request (-1, 70);
34 content.pack_start (lpv, false, false, 0);
36 var pannable = new Hildon.PannableArea ();
37 var vbox = new Gtk.VBox (false, 0);
39 foreach (LedCommandRX51 command in lpv.pattern.engine1) {
40 var label = new Gtk.Label ("0x%04x".printf (command.code));
42 vbox.pack_start (label, false, false, 0);
45 pannable.add_with_viewport (vbox);
46 content.pack_start (pannable, true, true, 0);
50 add_button ("Test", 1);
51 add_button ("Done", Gtk.ResponseType.ACCEPT);
53 response.connect (on_response);
56 void on_response (int response) {
60 if (response == Gtk.ResponseType.ACCEPT) {
61 if (pattern.dump () != lpv.pattern.dump ()) {
62 pattern.replace_with (lpv.pattern);