source: synfigstudio/trunk/fuentes/src/gui/dialogs/dialog_soundselect.cpp @ 481

Last change on this file since 481 was 481, checked in by jrpelegrina, 4 years ago

First release to xenial

File size: 4.0 KB
Line 
1/* === S Y N F I G ========================================================= */
2/*!     \file dialog_soundselect.cpp
3**      \brief Template File
4**
5**      $Id$
6**
7**      \legal
8**      Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
9**      Copyright (c) 2008 David Roden
10**
11**      This package is free software; you can redistribute it and/or
12**      modify it under the terms of the GNU General Public License as
13**      published by the Free Software Foundation; either version 2 of
14**      the License, or (at your option) any later version.
15**
16**      This package is distributed in the hope that it will be useful,
17**      but WITHOUT ANY WARRANTY; without even the implied warranty of
18**      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19**      General Public License for more details.
20**      \endlegal
21*/
22/* ========================================================================= */
23
24/* === H E A D E R S ======================================================= */
25
26#ifdef USING_PCH
27#       include "pch.h"
28#else
29#ifdef HAVE_CONFIG_H
30#       include <config.h>
31#endif
32
33#include "dialogs/dialog_soundselect.h"
34#include <gtkmm/alignment.h>
35#include <gtkmm/frame.h>
36#include <gtkmm/label.h>
37#include <gtkmm/table.h>
38
39#include "general.h"
40
41#endif
42
43/* === U S I N G =========================================================== */
44
45using namespace std;
46using namespace etl;
47using namespace synfig;
48
49/* === M A C R O S ========================================================= */
50
51/* === G L O B A L S ======================================================= */
52
53/* === P R O C E D U R E S ================================================= */
54
55/* === M E T H O D S ======================================================= */
56
57/* === E N T R Y P O I N T ================================================= */
58
59studio::Dialog_SoundSelect::Dialog_SoundSelect(Gtk::Window &parent, etl::handle<synfigapp::CanvasInterface> ci)
60:Dialog(_("Sound Select"), parent),
61canvas_interface(ci)
62{
63        Gtk::Alignment *dialogPadding = manage(new Gtk::Alignment(0, 0, 1, 1));
64        dialogPadding->set_padding(12, 12, 12, 12);
65        get_vbox()->pack_start(*dialogPadding, false, false, 0);
66
67        Gtk::Frame *soundFrame = manage(new Gtk::Frame(_("Sound Parameters")));
68        ((Gtk::Label *) soundFrame->get_label_widget())->set_markup(_("<b>Sound Parameters</b>"));
69        soundFrame->set_shadow_type(Gtk::SHADOW_NONE);
70        dialogPadding->add(*soundFrame);
71
72        Gtk::Alignment *framePadding = manage(new Gtk::Alignment(0, 0, 1, 1));
73        framePadding->set_padding(6, 0, 24, 0);
74        soundFrame->add(*framePadding);
75
76        Gtk::Label *fileLabel = manage(new Gtk::Label(_("_Sound File"), true));
77        fileLabel->set_alignment(0, 0.5);
78        fileLabel->set_mnemonic_widget(soundfile);
79        Gtk::Label *offsetLabel = manage(new Gtk::Label(_("Time _Offset"), true));
80        offsetLabel->set_alignment(0, 0.5);
81        offsetLabel->set_mnemonic_widget(offset);
82
83        Gtk::Table *table = manage(new Gtk::Table(2, 2, false));
84        table->set_row_spacings(6);
85        table->set_col_spacings(12);
86        framePadding->add(*table);
87
88        table->attach(*fileLabel, 0, 1, 0, 1, Gtk::SHRINK | Gtk::FILL, Gtk::SHRINK | Gtk::FILL, 0, 0);
89        table->attach(soundfile, 1, 2, 0, 1, Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK | Gtk::FILL, 0, 0);
90        table->attach(*offsetLabel, 0, 1, 1, 2, Gtk::SHRINK | Gtk::FILL, Gtk::SHRINK | Gtk::FILL, 0, 0);
91        table->attach(offset, 1, 2, 1, 2, Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK | Gtk::FILL, 0, 0);
92
93        okbutton = manage(new Gtk::Button(Gtk::StockID("gtk-ok")));
94        add_action_widget(*okbutton, 0);
95
96        get_vbox()->show_all();
97
98        offset.set_value(0);
99
100        okbutton->signal_clicked().connect(sigc::mem_fun(*this,&Dialog_SoundSelect::on_ok));
101}
102
103studio::Dialog_SoundSelect::~Dialog_SoundSelect()
104{
105}
106
107void studio::Dialog_SoundSelect::on_file()
108{
109        signal_file_changed_(soundfile.get_value());
110}
111
112void studio::Dialog_SoundSelect::on_offset()
113{
114        signal_offset_changed_(offset.get_value());
115}
116
117void studio::Dialog_SoundSelect::on_ok()
118{
119        hide();
120
121        //signal_finish_(a);
122        signal_file_changed_(soundfile.get_value());
123        signal_offset_changed_(offset.get_value());
124}
125
126void studio::Dialog_SoundSelect::set_global_fps(float f)
127{
128        offset.set_fps(f);
129}
Note: See TracBrowser for help on using the repository browser.