src/Tagging.vala \
src/Track.vala \
src/TrackBin.vala \
+src/TrackDetailsDialog.vala \
src/TrackEffectsPopUp.vala \
src/TrackPipeline.vala \
src/TrackTransport.vala \
RecordPipeline recordpipeline;
PlayerTransport player;
MixerBin mixer;
- uint track_counter;
+ uint track_counter { get { return (null != tracks) ? tracks.get_children().length() : 0; }}
bool recording;
bool playing;
bool encoding;
project = SettingsStructures.ProjectSettings();
recording = false;
playing = false;
- track_counter = 0;
window = new Hildon.StackableWindow();
window.destroy.connect(Gtk.main_quit);
window.delete_event.connect(on_delete_event);
private void remove_track(TrackTransport tt) {
project.tracks.remove(tt.track);
tracks.remove(tt);
+ // rebuild project.tracks
+ for (int idx = (int)project.tracks.length(); idx >= 0; --idx) {
+ project.tracks.remove_link(project.tracks.nth(idx));
+ }
+ foreach (var child in tracks.get_children()) {
+ project.tracks.append(((TrackTransport)child).track);
+ }
+ project_dirty = true;
tt = null;
}
private void save_project() {
+ // rebuild track settings
+ for (int idx = (int)project.tracks.length(); idx >= 0; --idx) {
+ project.tracks.remove_link(project.tracks.nth(idx));
+ }
+ foreach (var child in tracks.get_children()) {
+ project.tracks.append(((TrackTransport)child).track);
+ }
if (0 < project.location.length) {
save_project_settings(project.location);
}
--- /dev/null
+/* Demo Recorder for MAEMO 5
+* Copyright (C) 2010 Dru Moore <usr@dru-id.co.uk>
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License version 2,
+* or (at your option) any later version, as published by the Free
+* Software Foundation
+*
+* 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.
+*/
+namespace IdWorks {
+
+ public class TrackDetailsDialog : Hildon.Dialog {
+
+ Hildon.Entry name_entry;
+
+ public string get_name() {
+ return name_entry.get_text();
+ }
+ public void set_name(string name) {
+ name_entry.set_text(name);
+ validate();
+ }
+
+ public TrackDetailsDialog(Gtk.Widget parent, string title) {
+ this.set_parent(parent);
+ this.set_title(title);
+ this.set_default_response(Gtk.ResponseType.CANCEL);
+ construct_interface("");
+ }
+
+ public TrackDetailsDialog.with_values(Gtk.Widget parent, string title, string name) {
+ this.set_parent(parent);
+ this.set_title(title);
+ this.set_default_response(Gtk.ResponseType.CANCEL);
+ construct_interface(name);
+ }
+
+ private void construct_interface(string name) {
+ this.add_button(Gtk.STOCK_OK, Gtk.ResponseType.OK);
+
+ Gtk.VBox control_area = (Gtk.VBox)this.get_content_area();
+
+ Gtk.HBox name_bar = new Gtk.HBox(false, 4);
+
+ Gtk.Label name_label = new Gtk.Label("Name");
+ name_bar.pack_start(name_label, false, false, 2);
+ name_entry = new Hildon.Entry(Hildon.SizeType.HALFSCREEN_WIDTH);
+ name_entry.set_text(name);
+ name_entry.set_placeholder("Project name");
+ name_entry.changed.connect(name_entry_changed);
+ name_bar.pack_start(name_entry, true, true, 2);
+
+ control_area.pack_start(name_bar, true, true, 4);
+
+ validate();
+
+ this.show_all();
+ }
+
+ private void name_entry_changed() {
+ validate();
+ }
+
+ private void validate() {
+ bool good = true;
+ good &= (0 < get_name().length);
+ this.set_response_sensitive(Gtk.ResponseType.OK, good);
+ }
+
+ }
+
+}
\ No newline at end of file
public class TrackTransport : Gtk.HBox {
- public TrackBin track_bin;
+ public TrackBin track_bin {
+ get { return this.track.bin; }
+ set { this.track.bin = value; }
+ }
public Track track;
public Gtk.Window window;
Gtk.Button btn_delete;
Gtk.Label lbl_title;
- string _title;
+ //string _title;
public string title {
- get { return _title; /*lbl_title.get_text();*/ }
- set { _title = value; lbl_title.set_markup("<b>" + _title + "</b>"); }
+ get { return this.track.label; /*lbl_title.get_text();*/ }
+ set { this.track.label = value; lbl_title.set_markup("<b>" + value + "</b>"); }
}
Gtk.ToggleButton btn_active;
lbl_title = new Gtk.Label("<b>New Track</b>");
lbl_title.use_markup = true;
lbl_title.set_alignment(0.1f, 0.4f);
- lbl_title.set_ellipsize(Pango.EllipsizeMode.START);
- this.pack_start(lbl_title, true, true, 2);
+ lbl_title.set_ellipsize(Pango.EllipsizeMode.END);
+ lbl_title.set_line_wrap(true);
+ Gtk.EventBox click_title = new Gtk.EventBox();
+ click_title.set_above_child(true);
+ click_title.set_visible_window(true);
+ click_title.add(lbl_title);
+ click_title.button_release_event.connect((e) => {edit_title(lbl_title.get_text());});
+ this.pack_start(click_title, true, true, 2);
Gtk.HButtonBox buttons = new Gtk.HButtonBox();
btn_active = new Gtk.ToggleButton(); //.with_label("Active");
btn_mute.set_image(new Gtk.Image.from_icon_name("general_presence_online", Gtk.IconSize.SMALL_TOOLBAR));
btn_delete.clicked.connect((b) => { delete_clicked(); });
buttons.add(btn_delete);
this.pack_start(buttons, false, false, 0);
- }
+ }
+
+ private bool edit_title(string text) {
+ TrackDetailsDialog dlg = new TrackDetailsDialog.with_values(window, "Track details", text);
+ dlg.set_transient_for(this.window);
+ int ret = dlg.run();
+ if (Gtk.ResponseType.OK == ret) {
+ this.title = dlg.get_name();
+ }
+ dlg.destroy();
+ dlg = null;
+ return false;
+ }
/* Overrides */
private override void add(Gtk.Widget w) {