summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2006-11-11 00:14:12 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2006-11-11 00:14:12 +0000
commit90263f9a6dcec5de1bf6cd305d194118333a81ef (patch)
treeca717fa0e45e0260746d06e2f1a991528d58dde9
parenta23fccdd3a4cc0b5a8e7452ecc1244a11c23dc1e (diff)
fix visual focus indication in IOSelector; import pays attention to audio file embedded position; peaks now built properly for embedded/imported files
git-svn-id: svn://localhost/ardour2/trunk@1104 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r--gtk2_ardour/ardour2_ui.rc72
-rw-r--r--gtk2_ardour/editor_audio_import.cc12
-rw-r--r--gtk2_ardour/io_selector.cc149
-rw-r--r--gtk2_ardour/io_selector.h1
-rw-r--r--gtk2_ardour/streamview.cc2
-rw-r--r--libs/ardour/audiosource.cc25
6 files changed, 145 insertions, 116 deletions
diff --git a/gtk2_ardour/ardour2_ui.rc b/gtk2_ardour/ardour2_ui.rc
index 8aa6539e6e..cce0c1a5d2 100644
--- a/gtk2_ardour/ardour2_ui.rc
+++ b/gtk2_ardour/ardour2_ui.rc
@@ -796,20 +796,72 @@ style "flashing_alert" = "very_small_text"
bg[ACTIVE] = { 1.0, 0, 0}
}
-style "selected_io_selector_port_list" = "medium_text"
+style "selected_io_selector_port_list" = "medium_bold_text"
{
- fg[NORMAL] = { 0.50, 1.0, 1.0 }
- fg[SELECTED] = { 0.50, 1.0, 1.0 }
- base[NORMAL] = { 0, 0, 0 }
- base[SELECTED] = { 0, 0, 0 }
+ GtkTreeView::even-row-color = { 0.64, 0.68, 0.54 }
+ GtkTreeView::odd-row-color = { 0.64, 0.68, 0.54 }
+
+# fg is used to color the fg (text) of the column header button
+
+ fg[NORMAL] = { 0.80, 0.80, 0.70 }
+ fg[SELECTED] = { 0.80, 0.80, 0.70 }
+ fg[ACTIVE] = { 0.80, 0.80, 0.70 }
+ fg[PRELIGHT] = { 0.80, 0.80, 0.70 }
+ fg[INSENSITIVE] = { 0.80, 0.80, 0.70 }
+
+# bg is used used to color the background of the column header button
+
+ bg[NORMAL] = { 0.30, 0.30, 0.35 }
+ bg[ACTIVE] = { 0.30, 0.30, 0.35 }
+ bg[PRELIGHT] = { 0.30, 0.30, 0.35 }
+ bg[INSENSITIVE] = { 0.30, 0.30, 0.35 }
+ bg[SELECTED] = { 0.30, 0.30, 0.35 }
+
+# text is used to color the treeview row text
+
+ text[NORMAL] = { 0.80, 0.80, 0.70 }
+ text[SELECTED] = { 0.80, 0.80, 0.70 }
+
+# base is used to color a treeview with no rows
+
+ base[NORMAL] = { 0.64, 0.68, 0.54 }
+ base[ACTIVE] = { 0.64, 0.68, 0.54 }
+ base[PRELIGHT] = { 0.64, 0.68, 0.54 }
+ base[INSENSITIVE] = { 0.64, 0.68, 0.54 }
+ base[SELECTED] = { 0.64, 0.68, 0.54 }
}
style "io_selector_port_list" = "medium_text"
{
- fg[NORMAL] = {0.80, 0.80, 0.70 }
- fg[SELECTED] = {0.80, 0.80, 0.70 }
- base[NORMAL] = { 0.26, 0.26, 0.26 }
- base[SELECTED] = { 0.26, 0.26, 0.26 }
+
+# fg is used to color the fg (text) of the column header button
+
+ fg[NORMAL] = { 0.80, 0.80, 0.70 }
+ fg[SELECTED] = { 0.80, 0.80, 0.70 }
+ fg[ACTIVE] = { 0.80, 0.80, 0.70 }
+ fg[PRELIGHT] = { 0.80, 0.80, 0.70 }
+ fg[INSENSITIVE] = { 0.80, 0.80, 0.70 }
+
+# bg is used used to color the background of the column header button
+
+ bg[NORMAL] = { 0.30, 0.30, 0.35 }
+ bg[ACTIVE] = { 0.30, 0.30, 0.35 }
+ bg[PRELIGHT] = { 0.30, 0.30, 0.35 }
+ bg[INSENSITIVE] = { 0.30, 0.30, 0.35 }
+ bg[SELECTED] = { 0.30, 0.30, 0.35 }
+
+# text is used to color the treeview row text
+
+ text[NORMAL] = { 0.80, 0.80, 0.70 }
+ text[SELECTED] = { 0.80, 0.80, 0.70 }
+
+# base is used to color a treeview with no rows
+
+ base[NORMAL] = { 0, 0, 0 }
+ base[ACTIVE] = { 0, 0, 0 }
+ base[PRELIGHT] = { 0, 0, 0 }
+ base[INSENSITIVE] = { 0, 0, 0 }
+ base[SELECTED] = { 0, 0, 0 }
}
style "io_selector_notebook" = "default_base"
@@ -1121,7 +1173,9 @@ widget "*IOSelectorButton" style "default_buttons_menus"
widget "*IOSelectorButton*" style "default_buttons_menus"
widget "*IOSelectorList" style "medium_entry_noselection_fg"
widget "*IOSelectorPortList" style "io_selector_port_list"
+widget "*IOSelectorPortList.*" style "io_selector_port_list"
widget "*IOSelectorPortListSelected" style "selected_io_selector_port_list"
+widget "*IOSelectorPortListSelected.*" style "selected_io_selector_port_list"
widget "*IOSelectorNotebook" style "io_selector_notebook"
widget "*IOSelectorNotebookTab" style "io_selector_notebook"
widget "*IOSelectorFrame" style "base_frame"
diff --git a/gtk2_ardour/editor_audio_import.cc b/gtk2_ardour/editor_audio_import.cc
index 3ba1f062cb..65823efcac 100644
--- a/gtk2_ardour/editor_audio_import.cc
+++ b/gtk2_ardour/editor_audio_import.cc
@@ -270,7 +270,11 @@ Editor::embed_sndfile (Glib::ustring path, bool split, bool multiple_files, bool
idspec += string_compose(":%1", n);
try {
- source = boost::dynamic_pointer_cast<AudioFileSource> (SourceFactory::createReadable (*session, idspec, (mode == ImportAsTrack ? AudioFileSource::Destructive : AudioFileSource::Flag (0))));
+ source = boost::dynamic_pointer_cast<AudioFileSource> (SourceFactory::createReadable
+ (*session, idspec,
+ (mode == ImportAsTapeTrack ?
+ AudioFileSource::Destructive :
+ AudioFileSource::Flag (0))));
sources.push_back(source);
}
@@ -285,7 +289,11 @@ Editor::embed_sndfile (Glib::ustring path, bool split, bool multiple_files, bool
if (sources.empty()) {
goto out;
}
-
+
+ if (sources[0]->natural_position() != 0) {
+ pos = sources[0]->natural_position();
+ }
+
region_name = PBD::basename_nosuffix (path);
region_name += "-0";
diff --git a/gtk2_ardour/io_selector.cc b/gtk2_ardour/io_selector.cc
index fda4a32acb..e800f9311b 100644
--- a/gtk2_ardour/io_selector.cc
+++ b/gtk2_ardour/io_selector.cc
@@ -344,7 +344,6 @@ IOSelector::rescan ()
row[port_display_columns.full_name] = s->second;
}
- //display->get_selection()->signal_changed().connect (bind (mem_fun(*this, &IOSelector::port_selection_changed), display));
display->signal_button_release_event().connect (bind (mem_fun(*this, &IOSelector::port_selection_changed), display));
Label *tab_label = manage (new Label);
@@ -360,7 +359,7 @@ IOSelector::rescan ()
}
notebook.set_current_page (current_page);
- //notebook.signal_show().connect (bind (mem_fun (notebook, &Notebook::set_current_page), current_page));
+ notebook.signal_show().connect (bind (mem_fun (notebook, &Notebook::set_current_page), current_page));
selector_box.show_all ();
}
@@ -369,33 +368,31 @@ IOSelector::display_ports ()
{
TreeView *firsttview = 0;
TreeView *selected_port_tview = 0;
-
{
Glib::Mutex::Lock lm (port_display_lock);
Port *port;
uint32_t limit;
-
+
if (for_input) {
limit = io->n_inputs();
} else {
limit = io->n_outputs();
}
-
- for (slist<TreeView *>::iterator i = port_displays.begin(); i != port_displays.end(); ) {
+ for (slist<TreeView *>::iterator i = port_displays.begin(); i != port_displays.end(); ) {
+
slist<TreeView *>::iterator tmp;
-
+
tmp = i;
++tmp;
-
+
port_box.remove (**i);
delete *i;
port_displays.erase (i);
-
+
i = tmp;
}
-
-
+
for (uint32_t n = 0; n < limit; ++n) {
TreeView* tview;
@@ -409,13 +406,13 @@ IOSelector::display_ports ()
}
/* we know there is '/' because we put it there */
-
+
really_short_name = port->short_name();
really_short_name = really_short_name.substr (really_short_name.find ('/') + 1);
-
+
tview = manage (new TreeView());
RefPtr<ListStore> port_model = ListStore::create (port_display_columns);
-
+
if (!firsttview) {
firsttview = tview;
}
@@ -432,9 +429,9 @@ IOSelector::display_ports ()
/* now fill the clist with the current connections */
-
+
const char **connections = port->get_connections ();
-
+
if (connections) {
for (uint32_t c = 0; connections[c]; ++c) {
TreeModel::Row row = *(port_model->append());
@@ -453,9 +450,9 @@ IOSelector::display_ports ()
selected_port_tview = tview;
}
}
-
+
} else {
-
+
if (io->output_maximum() == 1) {
selected_port = port;
selected_port_tview = tview;
@@ -465,40 +462,26 @@ IOSelector::display_ports ()
}
}
}
-
+
TreeViewColumn* col = tview->get_column (0);
col->set_clickable (true);
-
- /* handle button events on the column header and within the treeview itself */
+
+ /* handle button events on the column header ... */
col->signal_clicked().connect (bind (mem_fun(*this, &IOSelector::select_treeview), tview));
+
+ /* ... and within the treeview itself */
tview->signal_button_release_event().connect (bind (mem_fun(*this, &IOSelector::connection_button_release), tview));
}
-
+
port_box.show_all ();
-
- if (selected_port_tview) {
- // GTK2FIX
- // selected_port_tview->click_column(0);
- selected_port_tview->set_name ("IOSelectorPortListSelected");
- for (slist<TreeView *>::iterator i = port_displays.begin(); i != port_displays.end(); ++i) {
- if (*i != selected_port_tview) {
- (*i)->set_name ("IOSelectorPortList");
- (*i)->queue_draw ();
- }
- }
- } else {
- selected_port = 0;
- selector_box.hide_all ();
- }
}
- if (selected_port_tview) {
- select_treeview (selected_port_tview);
- } else if (firsttview) {
- // select first
- select_treeview (firsttview);
+ if (!selected_port_tview) {
+ selected_port_tview = firsttview;
}
+
+ select_treeview (selected_port_tview);
}
bool
@@ -635,15 +618,10 @@ IOSelector::connection_button_release (GdkEventButton *ev, TreeView *treeview)
return false;
}
- if (!(Keyboard::is_delete_event (ev))) {
- //return false;
- }
-
if (!treeview->get_path_at_pos ((int)ev->x, (int)ev->y, path, column, cellx, celly)) {
return false;
}
- cerr << "path = " << path.to_string() << endl;
-
+
if ((iter = treeview->get_model()->get_iter (path.to_string()))) {
/* path is valid */
@@ -662,41 +640,6 @@ IOSelector::connection_button_release (GdkEventButton *ev, TreeView *treeview)
return true;
}
-gint
-IOSelector::port_column_button_release (GdkEventButton* event, TreeView* treeview)
-{
- /* this handles button release on the button at the top of a single-column
- treeview (representing a port)
- */
- cerr << "IOSelector::port_column_button_release() called" << endl;
-
- if (Keyboard::is_delete_event (event)) {
- Port* port;
- {
- Glib::Mutex::Lock lm (port_display_lock);
-
- port = static_cast<Port *> (treeview->get_data (_("port")));
-
- if (port == selected_port) {
- selected_port = 0;
- treeview->set_name ("IOSelectorPortList");
- treeview->queue_draw();
- }
- }
-
- /* remove the port when idle - if we do it here, we will destroy the widget
- for whom we are handling an event. not good.
- */
-
- signal_idle().connect (bind (mem_fun(*this, &IOSelector::remove_port_when_idle), port));
-
- } else {
- select_treeview (treeview);
- }
-
- return TRUE;
-}
-
void
IOSelector::select_next_treeview ()
{
@@ -729,20 +672,42 @@ IOSelector::select_treeview (TreeView* tview)
Glib::Mutex::Lock lm (port_display_lock);
Port* port = reinterpret_cast<Port *> (tview->get_data (_("port")));
+
+ selected_port = port;
+
+ tview->set_name ("IOSelectorPortListSelected");
+ tview->queue_draw ();
+
+ /* ugly hack to force the column header button to change as well */
+
+ TreeViewColumn* col = tview->get_column (0);
+ GtkTreeViewColumn* ccol = col->gobj();
- if (port != selected_port) {
- selected_port = port;
+ if (ccol->button) {
+ gtk_widget_set_name (ccol->button, "IOSelectorPortListSelected");
+ gtk_widget_queue_draw (ccol->button);
+ }
+
+ for (slist<TreeView*>::iterator i = port_displays.begin(); i != port_displays.end(); ++i) {
+ if (*i == tview) {
+ continue;
+ }
- tview->set_name ("IOSelectorPortListSelected");
+ col = (*i)->get_column (0);
+ ccol = col->gobj();
- for (slist<TreeView*>::iterator i = port_displays.begin(); i != port_displays.end(); ++i) {
- if (*i != tview) {
- (*i)->set_name ("IOSelectorPortList");
- (*i)->queue_draw ();
- }
+ if (ccol->button) {
+ gtk_widget_set_name (ccol->button, "IOSelectorPortList");
+ gtk_widget_queue_draw (ccol->button);
}
- selector_box.show_all ();
+
+ Port* port = reinterpret_cast<Port *> ((*i)->get_data (_("port")));
+
+ (*i)->set_name ("IOSelectorPortList");
+ (*i)->queue_draw ();
}
+
+ selector_box.show_all ();
}
void
diff --git a/gtk2_ardour/io_selector.h b/gtk2_ardour/io_selector.h
index b0175644a4..fcca7abf5c 100644
--- a/gtk2_ardour/io_selector.h
+++ b/gtk2_ardour/io_selector.h
@@ -125,7 +125,6 @@ class IOSelector : public Gtk::VBox {
void remove_port ();
gint remove_port_when_idle (ARDOUR::Port *);
- gint port_column_button_release (GdkEventButton *, Gtk::TreeView*);
gint connection_button_release (GdkEventButton *, Gtk::TreeView*);
void select_treeview(Gtk::TreeView*);
diff --git a/gtk2_ardour/streamview.cc b/gtk2_ardour/streamview.cc
index 75fb003d77..04b5269ab0 100644
--- a/gtk2_ardour/streamview.cc
+++ b/gtk2_ardour/streamview.cc
@@ -62,7 +62,7 @@ StreamView::StreamView (RouteTimeAxisView& tv)
canvas_rect = new ArdourCanvas::SimpleRect (*canvas_group);
canvas_rect->property_x1() = 0.0;
canvas_rect->property_y1() = 0.0;
- canvas_rect->property_x2() = 1000000.0;
+ canvas_rect->property_x2() = _trackview.editor.frame_to_pixel (max_frames);
canvas_rect->property_y2() = (double) tv.height;
canvas_rect->property_outline_what() = (guint32) (0x1|0x2|0x8); // outline ends and bottom
// (Fill/Outline colours set in derived classes)
diff --git a/libs/ardour/audiosource.cc b/libs/ardour/audiosource.cc
index cd8c192d13..a8d8929812 100644
--- a/libs/ardour/audiosource.cc
+++ b/libs/ardour/audiosource.cc
@@ -368,26 +368,29 @@ AudioSource::initialize_peakfile (bool newfile, string audio_path)
error << string_compose(_("AudioSource: cannot stat peakfile \"%1\""), peakpath) << endmsg;
return -1;
}
- } else {
- /* we found it in the peaks dir */
- }
-
- if (statbuf.st_size == 0) {
_peaks_built = false;
+
} else {
- // Check if the audio file has changed since the peakfile was built.
- struct stat stat_file;
- int err = stat (audio_path.c_str(), &stat_file);
- if (!err && stat_file.st_mtime > statbuf.st_mtime){
+ /* we found it in the peaks dir, so check it out */
+
+ if (statbuf.st_size == 0) {
_peaks_built = false;
} else {
- _peaks_built = true;
+ // Check if the audio file has changed since the peakfile was built.
+ struct stat stat_file;
+ int err = stat (audio_path.c_str(), &stat_file);
+
+ if (!err && stat_file.st_mtime > statbuf.st_mtime){
+ _peaks_built = false;
+ } else {
+ _peaks_built = true;
+ }
}
}
}
-
+
if (!newfile && !_peaks_built && _build_missing_peakfiles && _build_peakfiles) {
build_peaks_from_scratch ();
}