[Summary] file sample rate mismatch dialog rework

[Reviewed] GZharun
This commit is contained in:
Nikolay 2014-11-04 14:56:07 +02:00
parent 810f6b0a72
commit 561a43b051
6 changed files with 212 additions and 21 deletions

View file

@ -45,6 +45,7 @@
#include "ardour/utils.h"
#include "pbd/memento_command.h"
#include "file_sample_rate_mismatch_dialog.h"
#include "ardour_ui.h"
#include "editor.h"
#include "sfdb_ui.h"
@ -576,27 +577,19 @@ Editor::embed_sndfiles (vector<string> paths, bool multifile,
goto out;
}
} else {
choices.push_back (_("Cancel"));
choices.push_back (_("Embed it anyway"));
Gtkmm2ext::Choice rate_choice (
_("Sample rate"),
string_compose (_("%1\nThis audiofile's sample rate doesn't match the session sample rate!"), path),
choices, false
);
FileSampleRateMismatchDialog fsrm_dialog(path);
switch ( fsrm_dialog.run () ) {
case Gtk::RESPONSE_CANCEL: /* don't import */
ret = -1;
goto out;
int resx = rate_choice.run ();
switch (resx) {
case 0: /* don't import */
ret = -1;
goto out;
case 1: /* do it */
break;
default:
ret = -2;
goto out;
}
case Gtk::RESPONSE_ACCEPT: /* do it */
break;
default:
ret = -2;
goto out;
}
}
}

View file

@ -0,0 +1,80 @@
/*
Copyright (C) 2014 Waves Audio Ltd.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "file_sample_rate_mismatch_dialog.h"
#include "utils.h"
#include <string.h>
#include "i18n.h"
using namespace Gtk;
using namespace Gdk;
using namespace std;
using namespace ARDOUR;
using namespace PBD;
FileSampleRateMismatchDialog::FileSampleRateMismatchDialog ( std::string file_name )
: WavesDialog (_("file_sample_rate_mismatch_dialog.xml"), true, false)
, _cancel_button ( get_waves_button ("cancel_button") )
, _ignore_button ( get_waves_button ("ignore_button") )
, _info_label_1 ( get_label("info_label_1") )
, _info_label_2 ( get_label("info_label_2") )
{
set_modal (true);
set_resizable (false);
_cancel_button.signal_clicked.connect (sigc::mem_fun (*this, &FileSampleRateMismatchDialog::cancel_button_pressed));
_ignore_button.signal_clicked.connect (sigc::mem_fun (*this, &FileSampleRateMismatchDialog::ignore_button_pressed));
_info_label_1.set_text ( file_name );
_info_label_2.set_text ( _("This audiofile's sample rate doesn't match the session sample rate!") );
show_all ();
}
void
FileSampleRateMismatchDialog::on_esc_pressed ()
{
hide ();
response (Gtk::RESPONSE_CANCEL);
}
void
FileSampleRateMismatchDialog::on_enter_pressed ()
{
hide ();
response (Gtk::RESPONSE_ACCEPT);
}
void
FileSampleRateMismatchDialog::cancel_button_pressed (WavesButton*)
{
hide ();
response (Gtk::RESPONSE_CANCEL);
}
void
FileSampleRateMismatchDialog::ignore_button_pressed (WavesButton*)
{
hide ();
response (Gtk::RESPONSE_ACCEPT);
}
FileSampleRateMismatchDialog::~FileSampleRateMismatchDialog ()
{
}

View file

@ -0,0 +1,48 @@
/*
Copyright (C) 2014 Waves Audio Ltd.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __sample_rate_mismatch_dialog_h__
#define __sample_rate_mismatch_dialog_h__
#include "waves_dialog.h"
#include "ardour_button.h"
#include <string.h>
#include "utils.h"
class FileSampleRateMismatchDialog : public WavesDialog
{
public:
FileSampleRateMismatchDialog(std::string file_name);
~FileSampleRateMismatchDialog();
protected:
void on_esc_pressed ();
void on_enter_pressed ();
private:
void cancel_button_pressed (WavesButton*);
void ignore_button_pressed (WavesButton*);
WavesButton& _cancel_button;
WavesButton& _ignore_button;
Gtk::Label& _info_label_1;
Gtk::Label& _info_label_2;
};
#endif /* __sample_rate_mismatch_dialog_h__ */

View file

@ -269,6 +269,8 @@
43279460194F0062003C9FEA /* tracks_preferences.xml in Resources */ = {isa = PBXBuildFile; fileRef = 43279430194F0062003C9FEA /* tracks_preferences.xml */; };
4327947F194F009E003C9FEA /* tracks.menus.in in Resources */ = {isa = PBXBuildFile; fileRef = 43279475194F009E003C9FEA /* tracks.menus.in */; };
43B351ED194F04E00038C140 /* step_editing.bindings in Resources */ = {isa = PBXBuildFile; fileRef = 43B351C0194F04E00038C140 /* step_editing.bindings */; };
95176F7A1A08E6E800E32046 /* file_sample_rate_mismatch_dialog.cc in Sources */ = {isa = PBXBuildFile; fileRef = 95176F791A08E6E800E32046 /* file_sample_rate_mismatch_dialog.cc */; };
95176F7E1A08E76F00E32046 /* file_sample_rate_mismatch_dialog.xml in Resources */ = {isa = PBXBuildFile; fileRef = 95176F7D1A08E76F00E32046 /* file_sample_rate_mismatch_dialog.xml */; };
954DCFBD1A0239DA00B7160E /* about_dialog.cc in Sources */ = {isa = PBXBuildFile; fileRef = 954DCFBC1A0239DA00B7160E /* about_dialog.cc */; };
954DCFC11A023AAB00B7160E /* about_dialog.xml in Resources */ = {isa = PBXBuildFile; fileRef = 954DCFBF1A023AAB00B7160E /* about_dialog.xml */; };
954DCFC21A023AAB00B7160E /* license_dialog.xml in Resources */ = {isa = PBXBuildFile; fileRef = 954DCFC01A023AAB00B7160E /* license_dialog.xml */; };
@ -1119,6 +1121,9 @@
43B351EE194F12FB0038C140 /* waves_audiobackend.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = waves_audiobackend.xcodeproj; path = ../../libs/backends/wavesaudio/macosx/waves_audiobackend.xcodeproj; sourceTree = "<group>"; };
43B351F4194F130C0038C140 /* libardour.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = libardour.xcodeproj; path = ../../libs/ardour/macosx/libardour.xcodeproj; sourceTree = "<group>"; };
43B351FA194F131D0038C140 /* pbd.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = pbd.xcodeproj; path = ../../libs/pbd/macosx/pbd.xcodeproj; sourceTree = "<group>"; };
95176F781A08E6D800E32046 /* file_sample_rate_mismatch_dialog.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = file_sample_rate_mismatch_dialog.h; path = ../file_sample_rate_mismatch_dialog.h; sourceTree = "<group>"; };
95176F791A08E6E800E32046 /* file_sample_rate_mismatch_dialog.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = file_sample_rate_mismatch_dialog.cc; path = ../file_sample_rate_mismatch_dialog.cc; sourceTree = "<group>"; };
95176F7D1A08E76F00E32046 /* file_sample_rate_mismatch_dialog.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = file_sample_rate_mismatch_dialog.xml; sourceTree = "<group>"; };
954DCFBC1A0239DA00B7160E /* about_dialog.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = about_dialog.cc; path = ../about_dialog.cc; sourceTree = "<group>"; };
954DCFBE1A0239EC00B7160E /* about_dialog.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = about_dialog.h; path = ../about_dialog.h; sourceTree = "<group>"; };
954DCFBF1A023AAB00B7160E /* about_dialog.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = about_dialog.xml; sourceTree = "<group>"; };
@ -1217,6 +1222,7 @@
43279040194EFF38003C9FEA /* source */ = {
isa = PBXGroup;
children = (
95176F791A08E6E800E32046 /* file_sample_rate_mismatch_dialog.cc */,
954DCFE01A07C70400B7160E /* sample_rate_mismatch_dialog.cc */,
954DCFDB1A07A07600B7160E /* read_only_session_dialog.cc */,
954DCFBC1A0239DA00B7160E /* about_dialog.cc */,
@ -1822,6 +1828,7 @@
43279429194F0062003C9FEA /* ui */ = {
isa = PBXGroup;
children = (
95176F7D1A08E76F00E32046 /* file_sample_rate_mismatch_dialog.xml */,
954DCFE41A07D1C800B7160E /* sample_rate_mismatch_dialog.xml */,
954DCFDD1A07A14E00B7160E /* read_only_session_dialog.xml */,
954DCFBF1A023AAB00B7160E /* about_dialog.xml */,
@ -1868,6 +1875,7 @@
43279480194F00CB003C9FEA /* headers */ = {
isa = PBXGroup;
children = (
95176F781A08E6D800E32046 /* file_sample_rate_mismatch_dialog.h */,
954DCFDF1A07C6F200B7160E /* sample_rate_mismatch_dialog.h */,
954DCFD71A07A06300B7160E /* read_only_session_dialog.h */,
954DCFBE1A0239EC00B7160E /* about_dialog.h */,
@ -2445,6 +2453,7 @@
432793D2194F003A003C9FEA /* tool_waveform_zoom_active.png in Resources */,
432793D3194F003A003C9FEA /* tool_waveform_zoom_prelight.png in Resources */,
432793D4194F003A003C9FEA /* tool_zoom.png in Resources */,
95176F7E1A08E76F00E32046 /* file_sample_rate_mismatch_dialog.xml in Resources */,
432793D5194F003A003C9FEA /* tool_zoom_active.png in Resources */,
432793D6194F003A003C9FEA /* tool_zoom_ardour.png in Resources */,
432793D7194F003A003C9FEA /* tool_zoom_prelight.png in Resources */,
@ -2578,6 +2587,7 @@
CE1C6DE01987A924006BDB03 /* master_bus_ui.cc in Sources */,
954DCFBD1A0239DA00B7160E /* about_dialog.cc in Sources */,
CE1A907A199A37AE00ECA62B /* add_tracks_dialog.cc in Sources */,
95176F7A1A08E6E800E32046 /* file_sample_rate_mismatch_dialog.cc in Sources */,
CE294C7519CAD54500D12768 /* marker_io_dialog.cc in Sources */,
CE294C7619CAD54500D12768 /* mixer_bridge_view.cc in Sources */,
CE294C7719CAD54500D12768 /* open_file_dialog_nix.cc in Sources */,

View file

@ -0,0 +1,59 @@
<?xml version="1.0" encoding="UTF-8"?>
<Dialog title="File sample rate mismatch" resizeable="False">
<style name="generic_control"
winfont ="Arial Bold 12"
macfont ="Helvetica Bold 12"
fgnormal="#BFBFBF"
bgnormal="#6C6C6C"
fgactive="#BFBFBF"
bgactive="#454545"
fghover="#CCCCCC"
bghover="#898989"/>
<Layout width="420"
height="90"
bgnormal="#EDECE8">
<VBox width="420"
x="0"
y="20">
<Label id="info_label_1"
style="generic_control"
fgnormal="#6D6E72"
horzalignment="center"/>
<Label id="info_label_2"
style="generic_control"
fgnormal="#6D6E72"
horzalignment="center"/>
</VBox>
<Button id="cancel_button"
style="generic_control"
text="Cancel"
fgnormal="#6D6E72"
bgnormal="#CACAC5"
fgactive="#EDECE8"
bgactive="#6D6E72"
borderwidth="0 0 0 0"
bordercolor="#6D6E72"
width="80"
height="22"
x="240"
y="58"/>
<Button id="ignore_button"
style="generic_control"
text="Ignore"
fgnormal="#6D6E72"
bgnormal="#CACAC5"
fgactive="#EDECE8"
bgactive="#6D6E72"
borderwidth="0 0 0 0"
bordercolor="#6D6E72"
width="80"
height="22"
x="330"
y="58"/>
</Layout>
</Dialog>

View file

@ -112,6 +112,7 @@ gtk2_ardour_sources = [
'export_format_selector.cc',
'export_preset_selector.cc',
'export_timespan_selector.cc',
'file_sample_rate_mismatch_dialog.cc',
'fft.cc',
'fft_graph.cc',
'fft_result.cc',