Debian Codegraph @

Source/Widgets/SoundTypeAndPath.cpp

raw
1 /*
2 * SoundTypeAndPath.cpp
3 *
4 * Created on: 6 Dec 2016
5 * Author: jeremy
6 */
7
8 #include "SoundTypeAndPath.h"
9
10 namespace Widgets
11 {
12
13 SoundTypeAndPath::SoundTypeAndPath(const std::vector<std::string>& types, const std::string& dataFolder, Gtk::FileChooserDialog* soundChooser)
14 {
15
16 this->set_hexpand(true);
17
18 // Configure and add sound type label
19 soundTypeLabel.set_halign(Gtk::Align::ALIGN_CENTER);
20 this->attach(soundTypeLabel, 0, 0, 1, 1);
21 soundTypeLabel.show();
22
23 this->set_halign(Gtk::Align::ALIGN_FILL);
24 this->set_column_spacing(4);
25
26 // Populate types combobox
27 for(const auto& type : types)
28 {
29 typesList.append(type);
30 }
31 typesList.set_active(0);
32
33 // Configure and add types to widget
34 typesList.set_halign(Gtk::Align::ALIGN_CENTER);
35 typesList.get_entry()->set_width_chars(12);
36 this->attach_next_to(typesList, soundTypeLabel, Gtk::PositionType::POS_RIGHT, 1, 1);
37 typesList.show();
38
39
40 // Configure and add sound label
41 soundLabel.set_halign(Gtk::Align::ALIGN_CENTER);
42 this->attach_next_to(soundLabel, typesList, Gtk::PositionType::POS_RIGHT, 1, 1);
43 soundLabel.show();
44
45 // Populate sounds combobox
46
47 this->attach_next_to(soundName, soundLabel, Gtk::PositionType::POS_RIGHT, 1, 1);
48 soundName.show();
49
50 this->attach_next_to(soundChange, soundName, Gtk::PositionType::POS_RIGHT, 1, 1);
51 soundChange.set_halign(Gtk::Align::ALIGN_END);
52 soundChange.set_hexpand(true);
53 soundChange.show();
54
55 soundChange.signal_clicked().connect([=, this] { ShowSoundChooser(soundChooser, dataFolder); });
56
57 this->attach_next_to(midiLabel, soundChange, Gtk::PositionType::POS_RIGHT, 1, 1);
58 midiLabel.set_halign(Gtk::Align::ALIGN_END);
59 midiLabel.set_hexpand(true);
60 midiLabel.show();
61
62 this->attach_next_to(midiNote, midiLabel, Gtk::PositionType::POS_RIGHT, 1, 1);
63 midiNote.set_halign(Gtk::Align::ALIGN_END);
64 midiNote.set_hexpand(false);
65 midiNote.show();
66
67 this->show();
68
69 return;
70 }
71
72
73 void SoundTypeAndPath::ShowSoundChooser(Gtk::FileChooserDialog* soundChooser, const std::string& dataFolder)
74 {
75 this->changingSound = true;
76 soundChooser->set_current_folder(dataFolder + "SoundBank/");
77 soundChooser->show();
78 }
79
80 } /* namespace Widgets */