[Submit] Progressing XML-ized export dialogs.

This commit is contained in:
VKamyshniy 2015-01-24 20:38:28 +02:00
parent 7df38b63d4
commit ed71928517
13 changed files with 894 additions and 185 deletions

View file

@ -64,9 +64,16 @@ using namespace Gtk;
void
Editor::export_audio ()
{
{
WavesExportDialog dialog (*this, _("Export"), ExportProfileManager::RegularExport);
dialog.set_session (_session);
dialog.run();
}
{
ExportDialog dialog (*this, _("Export"), ExportProfileManager::RegularExport);
dialog.set_session (_session);
dialog.run();
}
}
void

View file

@ -30,6 +30,7 @@
#include "waves_message_dialog.h"
#include "export_dialog.h"
#include "gui_thread.h"
#include "ardour/export_format_specification.h"
#include "i18n.h"
@ -87,6 +88,25 @@ ExportDialog::set_session (ARDOUR::Session* s)
/* Load states */
profile_manager->load_profile ();
ExportProfileManager::FormatStateList const & formats = profile_manager->get_formats ();
ExportProfileManager::FormatStateList::const_iterator format_it = formats.begin();
ExportProfileManager::FilenameStateList const & filenames = profile_manager->get_filenames ();
ExportProfileManager::FilenameStateList::const_iterator filename_it = filenames.begin ();
std::cout << "****************************************************" << std::endl;
std::cout << "****************************************************" << std::endl;
std::cout << "****************************************************" << std::endl;
std::cout << "****************************************************" << std::endl;
for (format_it = formats.begin(), filename_it = filenames.begin();
format_it != formats.end() && filename_it != filenames.end();
++format_it, ++filename_it) {
std::cout << "Format:" << (*format_it)->format->name() << std::endl;
}
std::cout << "****************************************************" << std::endl;
std::cout << "****************************************************" << std::endl;
std::cout << "****************************************************" << std::endl;
std::cout << "****************************************************" << std::endl;
sync_with_manager ();
/* Warnings */
@ -191,6 +211,23 @@ ExportDialog::close_dialog ()
if (status->running) {
status->abort();
}
ExportProfileManager::FormatStateList const & formats = profile_manager->get_formats ();
ExportProfileManager::FormatStateList::const_iterator format_it = formats.begin();
ExportProfileManager::FilenameStateList const & filenames = profile_manager->get_filenames ();
ExportProfileManager::FilenameStateList::const_iterator filename_it = filenames.begin ();
std::cout << "----------------------------------------------------" << std::endl;
std::cout << "----------------------------------------------------" << std::endl;
std::cout << "----------------------------------------------------" << std::endl;
for (format_it = formats.begin(), filename_it = filenames.begin();
format_it != formats.end() && filename_it != filenames.end();
++format_it, ++filename_it) {
std::cout << "Format:" << (*format_it)->format->name() << std::endl;
}
std::cout << "----------------------------------------------------" << std::endl;
std::cout << "----------------------------------------------------" << std::endl;
std::cout << "----------------------------------------------------" << std::endl;
hide_all ();
set_modal (false);

View file

@ -37,8 +37,8 @@
</HBox>
<EventBox id="selectors_home"
bgnormal="#EDECE8"
width="652"
height="232">
width="642"
height="273">
<VBox id="file_format_selector">
<HBox id="preset_selector_home" ui.orphan="true"/>
<HBox id="file_notebook_home"/>

View file

@ -0,0 +1,58 @@
<?xml version="1.0" encoding="UTF-8"?>
<VBox CACHEIT="false">
<style name="generic_control"
winfont ="Arial Bold 10"
macfont ="Helvetica Bold 10"
fgnormal="#6D6E72"
bgnormal="#6C6C6C"
fgactive="#BFBFBF"
bgactive="#454545"
fghover="#CCCCCC"
bghover="#898989"/>
<style name="generic_button"
winfont ="Arial Bold 12"
macfont ="Helvetica Bold 12"
fgnormal="#EDECE8"
fgactive="#6D6E72"
textcolornormal="#6D6E72"
bgnormal="#6D6E72"
bgactive="#CACAC5"
borderwidth="0 0 0 0"
bordercolor="#6D6E72"/>
<style name="generic_dropdown"
style="generic_control"
bgnormal="#6C6C6C"
fgnormal="#C1C1C1"/>
<style name="generic_dropdown_menu"
style="generic_dropdown"/>
<EventBox bgnormal="#00ff00" height="1"/>
<EventBox bgnormal="#6C6C6C">
<HBox>
<Iconbutton id="lossless_check_button"
width="20"
height="20"
normalicon="waves_check_box"
activeicon="waves_check_box_active"
toggleable="true"/>
<Button id="lossless_button"
style="generic_button"
text="Lossless"
height="30"
width="100"/>
<Iconbutton id="lossy_check_button"
width="20"
height="20"
normalicon="waves_check_box"
activeicon="waves_check_box_active"
toggleable="true"/>
<Button id="lossy_button"
style="generic_button"
text="Lossy"
height="30"
width="100"/>
</HBox>
</EventBox>
<EventBox id="file_page_home"
bgnormal="#CBDBF5"/>
<EventBox bgnormal="#ffff00" height="1" box.pack="end"/>
</VBox>

View file

@ -0,0 +1,193 @@
<?xml version="1.0" encoding="UTF-8"?>
<VBox CACHEIT="false">
<style name="generic_control"
winfont ="Arial Bold 10"
macfont ="Helvetica Bold 10"
fgnormal="#6D6E72"
bgnormal="#6C6C6C"
fgactive="#BFBFBF"
bgactive="#454545"
fghover="#CCCCCC"
bghover="#898989"/>
<style name="generic_button"
winfont ="Arial Bold 10"
macfont ="Helvetica Bold 10"
fgnormal="#6D6E72"
textcolornormal="#6D6E72"
bgnormal="#CACAC5"
basenormal="#CACAC5"
fgactive="#EDECE8"
bgactive="#6D6E72"
borderwidth="0 0 0 0"
bordercolor="#6D6E72"/>
<style name="generic_dropdown"
style="generic_button"
fgnormal="#EDECE8"
normalicon="dropdown_90x20"
activeicon="dropdown_90x20_active"
inactiveicon="dropdown_90x20_inactive"
width="90"
height="20"
horzalignment="start"/>
<style name="generic_dropdown_menu"
style="generic_dropdown"/>
<EventBox bgnormal="#ff0000" height="3"/>
<Label style="generic_control"
winfont ="Arial Bold 11"
macfont ="Helvetica Bold 11"
text="Format"
horzalignment="start"/>
<HBox>
<VBox width="18"/>
<VBox>
<HBox id="format_selector_home"/>
<VBox spacing="10">
<HBox spacing="10">
<VBox>
<Label style="generic_control"
text="Format"
horzalignment="start"/>
<Dropdown id="lossless_format_dropdown"
style="generic_dropdown">
<HBox>
<VBox width="10"/>
<Label style="generic_dropdown"/>
</HBox>
<DropdownMenu bgnormal="#454545">
<DropdownItem style="generic_dropdown" title="None"/>
<DropdownItem style="generic_dropdown" title="Wave"/>
<DropdownItem style="generic_dropdown" title="AIFF"/>
<DropdownItem style="generic_dropdown" title="AAC"/>
<DropdownItem style="generic_dropdown" title="CAF"/>
<DropdownItem style="generic_dropdown" title="FLAC"/>
</DropdownMenu>
</Dropdown>
</VBox>
<VBox>
<Label style="generic_control"
text="Depth"
horzalignment="start"/>
<Dropdown id="lossless_depth_dropdown"
style="generic_dropdown">
<HBox>
<VBox width="10"/>
<Label style="generic_dropdown"/>
</HBox>
<DropdownMenu bgnormal="#454545">
<DropdownItem style="generic_dropdown" title="None"/>
<DropdownItem style="generic_dropdown" title="16 bit"/>
<DropdownItem style="generic_dropdown" title="24 bit"/>
</DropdownMenu>
</Dropdown>
</VBox>
<VBox>
<Label style="generic_control"
text="Sample Rate"
horzalignment="start"/>
<Dropdown id="lossless_sample_rate_dropdown"
style="generic_dropdown">
<HBox>
<VBox width="10"/>
<Label style="generic_dropdown"/>
</HBox>
<DropdownMenu bgnormal="#454545">
<DropdownItem style="generic_dropdown" title="None"/>
<DropdownItem style="generic_dropdown" title="44.1 kHz"/>
<DropdownItem style="generic_dropdown" title="48 kHz"/>
<DropdownItem style="generic_dropdown" title="88.2 kHz"/>
<DropdownItem style="generic_dropdown" title="96 kHz"/>
<DropdownItem style="generic_dropdown" title="176.4 kHz"/>
<DropdownItem style="generic_dropdown" title="192 kHz"/>
</DropdownMenu>
</Dropdown>
</VBox>
<VBox>
<Label style="generic_control"
text="Dither"
horzalignment="start"/>
<Dropdown id="lossless_dither_dropdown"
style="generic_dropdown"
width="126"
normalicon="dropdown_126x20"
activeicon="dropdown_126x20_active"
inactiveicon="dropdown_126x20_inactive">
<HBox>
<VBox width="10"/>
<Label style="generic_dropdown"/>
</HBox>
<DropdownMenu style="generic_dropdown"
bgnormal="#454545">
<DropdownItem style="generic_dropdown" title="None"/>
<DropdownItem style="generic_dropdown" title="Type1"/>
<DropdownItem style="generic_dropdown" title="Type2"/>
<DropdownItem style="generic_dropdown" title="Type3+Shaping"/>
</DropdownMenu>
</Dropdown>
</VBox>
<VBox>
<Label style="generic_control"
text="Normalize"
horzalignment="start"/>
<Iconbutton id="lossless_normalize_button"
width="20"
height="20"
normalicon="waves_darker_check_box"
activeicon="waves_darker_check_box_active"
toggleable="true"/>
</VBox>
</HBox>
<HBox spacing="10">
<VBox>
<Label style="generic_control"
text="Format"
horzalignment="start"/>
<Dropdown id="lossy_format_dropdown"
style="generic_dropdown">
<HBox>
<VBox width="10"/>
<Label style="generic_dropdown"/>
</HBox>
<DropdownMenu bgnormal="#454545">
<DropdownItem style="generic_dropdown" title="None"/>
<DropdownItem style="generic_dropdown" title="MP3"/>
<DropdownItem style="generic_dropdown" title="AAC"/>
<DropdownItem style="generic_dropdown" title="OGG Forbis"/>
</DropdownMenu>
</Dropdown>
</VBox>
<VBox>
<Label style="generic_control"
text="Bit Rate"
horzalignment="start"/>
<Dropdown id="lossy_bit_rate_dropdown"
style="generic_dropdown">
<HBox>
<VBox width="10"/>
<Label style="generic_dropdown"/>
</HBox>
<DropdownMenu bgnormal="#454545">
<DropdownItem style="generic_dropdown" title="None"/>
<DropdownItem style="generic_dropdown" title="96 kbps"/>
<DropdownItem style="generic_dropdown" title="128 kbps"/>
<DropdownItem style="generic_dropdown" title="160 kbps"/>
<DropdownItem style="generic_dropdown" title="192 kbps"/>
<DropdownItem style="generic_dropdown" title="256 kbps"/>
<DropdownItem style="generic_dropdown" title="320 kbps"/>
</DropdownMenu>
</Dropdown>
</VBox>
</HBox>
</VBox>
</VBox>
</HBox>
<Label style="generic_control"
winfont ="Arial Bold 11"
macfont ="Helvetica Bold 11"
text="Location"
horzalignment="start"/>
<HBox>
<VBox width="18"/>
<VBox id="filename_selector_home"/>
</HBox>
<EventBox bgnormal="#ffff00" height="3" box.pack="end"/>
</VBox>

View file

@ -0,0 +1,59 @@
<?xml version="1.0" encoding="UTF-8"?>
<VBox CACHEIT="false">
<style name="generic_control"
winfont ="Arial Bold 10"
macfont ="Helvetica Bold 10"
fgnormal="#6D6E72"
bgnormal="#6C6C6C"
fgactive="#BFBFBF"
bgactive="#454545"
fghover="#CCCCCC"
bghover="#898989"/>
<style name="generic_button"
winfont ="Arial Bold 12"
macfont ="Helvetica Bold 12"
fgnormal="#6D6E72"
textcolornormal="#6D6E72"
bgnormal="#CACAC5"
basenormal="#CACAC5"
fgactive="#EDECE8"
bgactive="#6D6E72"
borderwidth="0 0 0 0"
bordercolor="#6D6E72"
height="20"/>
<style name="generic_dropdown"
style="generic_control"
bgnormal="#6C6C6C"
fgnormal="#C1C1C1"/>
<style name="generic_dropdown_menu"
style="generic_dropdown"/>
<Dropdown id="format_dropdown"
style="generic_dropdown"
width="418"
height="20"
normalicon="dropdown_418x20"
activeicon="dropdown_418x20_active" ui.norphan="true">
<HBox>
<VBox width="10"/>
<Label style="generic_dropdown"
horzalignment="start"/>
</HBox>
<DropdownMenu style="generic_dropdown_menu"/>
</Dropdown>
<HBox spacing="2"
box.pack="end">
<Button id="edit_button"
style="generic_button"
text="Edit"
width="60"/>
<Button id="remove_button"
style="generic_button"
text="Remove"
width="60"/>
<Button id="new_button"
style="generic_button"
text="New"
width="60"/>
</HBox>
</VBox>

View file

@ -61,9 +61,11 @@ style "default" = "medium_text"
GtkTreeView::vertical-padding = 0
GtkTreeView::horizontal-padding = 0
GtkTreeView::even-row-color = shade(0.25,@@COLPREFIX@_base)
GtkTreeView::odd-row-color = lighter(lighter(@@COLPREFIX@_base))
GtkTreeView::even-row-color = { 0.42, 0.42, 0.42 }
GtkTreeView::odd-row-color = { 0.42, 0.42, 0.42 }
#GtkTreeView::even-row-color = shade(0.25,@bases)
#GtkTreeView::odd-row-color = lighter(lighter(@bases))
GtkWidget :: focus-line-pattern = "\000\000" # Dash pattern used to draw the focus indicator.
GtkWidget :: focus-line-width = 1 # [ 1 ] ( >= 0 ) Width, in pixels, of the focus indicator line.
GtkWidget :: focus-padding = 1 # [ 1 ] ( >= 0 ) Width, in pixels, between focus indicator and the widget box.

View file

@ -26,6 +26,7 @@
#include "ardour/audioregion.h"
#include "ardour/export_status.h"
#include "ardour/export_handler.h"
#include "ardour/export_format_specification.h"
#include "waves_message_dialog.h"
#include "waves_export_dialog.h"
@ -101,6 +102,28 @@ WavesExportDialog::set_session (ARDOUR::Session* s)
/* Load states */
profile_manager->load_profile ();
/* Tracks does not need anything but Lossless and Lossy */
ExportProfileManager::FormatStateList const & formats = profile_manager->get_formats ();
ExportProfileManager::FormatStateList::const_iterator format_it = formats.begin();
ExportProfileManager::FilenameStateList const & filenames = profile_manager->get_filenames ();
ExportProfileManager::FilenameStateList::const_iterator filename_it = filenames.begin ();
std::cout << "****************************************************" << std::endl;
std::cout << "****************************************************" << std::endl;
std::cout << "****************************************************" << std::endl;
std::cout << "****************************************************" << std::endl;
for (format_it = formats.begin(), filename_it = filenames.begin();
format_it != formats.end() && filename_it != filenames.end();
++format_it, ++filename_it) {
std::cout << "Format:" << (*format_it)->format->name() << std::endl;
}
std::cout << "****************************************************" << std::endl;
std::cout << "****************************************************" << std::endl;
std::cout << "****************************************************" << std::endl;
std::cout << "****************************************************" << std::endl;
sync_with_manager ();
/* Warnings */
@ -177,6 +200,23 @@ WavesExportDialog::close_dialog (WavesButton*)
status->abort();
}
ExportProfileManager::FormatStateList const & formats = profile_manager->get_formats ();
ExportProfileManager::FormatStateList::const_iterator format_it = formats.begin();
ExportProfileManager::FilenameStateList const & filenames = profile_manager->get_filenames ();
ExportProfileManager::FilenameStateList::const_iterator filename_it = filenames.begin ();
std::cout << "----------------------------------------------------" << std::endl;
std::cout << "----------------------------------------------------" << std::endl;
std::cout << "----------------------------------------------------" << std::endl;
for (format_it = formats.begin(), filename_it = filenames.begin();
format_it != formats.end() && filename_it != filenames.end();
++format_it, ++filename_it) {
std::cout << "Format:" << (*format_it)->format->name() << std::endl;
}
std::cout << "----------------------------------------------------" << std::endl;
std::cout << "----------------------------------------------------" << std::endl;
std::cout << "----------------------------------------------------" << std::endl;
response (Gtk::RESPONSE_CANCEL);
}
@ -196,9 +236,6 @@ WavesExportDialog::show_selector (Gtk::Widget& widget)
if (!widget.get_parent ()) {
_selectors_home.add (widget);
widget.show_all ();
std::cout << "WavesExportDialog::show_selector (Gtk::Widget& widget) -- ADDED" << std::endl;
} else {
std::cout << "WavesExportDialog::show_selector (Gtk::Widget& widget) -- DID NOT ADD" << std::endl;
}
}
@ -207,9 +244,6 @@ WavesExportDialog::hide_selector (Gtk::Widget& widget)
{
if (widget.get_parent () == &_selectors_home) {
_selectors_home.remove (widget);
std::cout << "WavesExportDialog::hide_selector (Gtk::Widget& widget) -- REMOVED" << std::endl;
} else {
std::cout << "WavesExportDialog::hide_selector (Gtk::Widget& widget) -- DID NOT REMOVE" << std::endl;
}
}

View file

@ -31,27 +31,24 @@ using namespace ARDOUR;
using namespace ARDOUR_UI_UTILS;
using namespace PBD;
WavesExportFileNotebook::WavesExportFileNotebook () :
page_counter (1)
WavesExportFileNotebook::WavesExportFileNotebook ()
: Gtk::VBox ()
, WavesUI ("waves_export_file_notebook.xml", *this)
, page_counter (1)
, _lossless_button (get_waves_button ("lossless_button"))
, _lossless_check_button (get_waves_button ("lossless_check_button"))
, _lossless_format_file_page (0)
, _lossy_button (get_waves_button ("lossy_button"))
, _lossy_check_button (get_waves_button ("lossy_check_button"))
, _lossy_format_file_page (0)
, _file_page_home (get_container("file_page_home"))
{
/* Last page */
new_file_button.set_image (*Gtk::manage (new Gtk::Image (::get_icon("add"))));
new_file_button.set_label (_("Add another format"));
new_file_button.set_alignment (0, 0.5);
new_file_button.set_relief (Gtk::RELIEF_NONE);
new_file_hbox.pack_start (new_file_button, true, true);
append_page (new_file_dummy, new_file_hbox);
set_tab_label_packing (new_file_dummy, true, true, Gtk::PACK_START);
new_file_hbox.show_all_children ();
page_change_connection = signal_switch_page().connect (sigc::mem_fun (*this, &WavesExportFileNotebook::handle_page_change));
new_file_button.signal_clicked().connect (sigc::mem_fun (*this, &WavesExportFileNotebook::add_new_file_page));
_lossless_button.signal_clicked.connect (sigc::mem_fun (*this, &WavesExportFileNotebook::on_lossless_button));
_lossy_button.signal_clicked.connect (sigc::mem_fun (*this, &WavesExportFileNotebook::on_lossy_button));
}
void
WavesExportFileNotebook::set_session_and_manager (ARDOUR::Session * s, boost::shared_ptr<ARDOUR::ExportProfileManager> manager)
WavesExportFileNotebook::set_session_and_manager (ARDOUR::Session* s, boost::shared_ptr<ARDOUR::ExportProfileManager> manager)
{
SessionHandlePtr::set_session (s);
profile_manager = manager;
@ -62,100 +59,97 @@ WavesExportFileNotebook::set_session_and_manager (ARDOUR::Session * s, boost::sh
void
WavesExportFileNotebook::sync_with_manager ()
{
/* Clear pages from notebook
The page switch handling has to be disabled during removing all pages due to a gtk bug
*/
/* File notebook */
ExportProfileManager::FormatStateList const & formats = profile_manager->get_formats ();
ExportProfileManager::FormatStateList::const_iterator format_it = formats.begin();
page_change_connection.block();
while (get_n_pages() > 1) {
remove_page (0);
ExportProfileManager::FilenameStateList const & filenames = profile_manager->get_filenames ();
ExportProfileManager::FilenameStateList::const_iterator filename_it = filenames.begin ();
if (_lossless_format_file_page) {
remove_file_page (_lossless_format_file_page);
}
if (_lossy_format_file_page) {
remove_file_page (_lossy_format_file_page);
}
page_change_connection.block(false);
page_counter = 1;
last_visible_page = 0;
/* File notebook */
ExportProfileManager::FormatStateList const & formats = profile_manager->get_formats ();
ExportProfileManager::FormatStateList::const_iterator format_it;
ExportProfileManager::FilenameStateList const & filenames = profile_manager->get_filenames ();
ExportProfileManager::FilenameStateList::const_iterator filename_it;
for (format_it = formats.begin(), filename_it = filenames.begin();
format_it != formats.end() && filename_it != filenames.end();
++format_it, ++filename_it) {
add_file_page (*format_it, *filename_it);
// Lossless formats page:
if ((format_it != formats.end ()) && (filename_it != filenames.end ())) {
_lossless_format_file_page = add_file_page (*format_it, *filename_it);
show_lossless_page ();
++format_it, ++filename_it;
}
// Lossy formats
if ((format_it != formats.end()) && (filename_it != filenames.end())) {
_lossy_format_file_page = add_file_page (*format_it, *filename_it);
}
set_current_page (0);
update_soundcloud_upload ();
CriticalSelectionChanged ();
}
void
WavesExportFileNotebook::update_soundcloud_upload ()
{
int i;
bool show_credentials_entry = false;
ExportProfileManager::FormatStateList const & formats = profile_manager->get_formats ();
ExportProfileManager::FormatStateList::const_iterator format_it;
ExportProfileManager::FormatStateList::const_iterator format_it = formats.begin();
for (i = 0, format_it = formats.begin(); format_it != formats.end(); ++i, ++format_it) {
FilePage * page;
if ((page = dynamic_cast<FilePage *> (get_nth_page (i)))) {
bool this_soundcloud_upload = page->get_soundcloud_upload ();
(*format_it)->format->set_soundcloud_upload (this_soundcloud_upload);
if (this_soundcloud_upload) {
show_credentials_entry = true;
}
if ((format_it != formats.end ()) && _lossless_format_file_page) {
bool this_soundcloud_upload = _lossless_format_file_page->get_soundcloud_upload ();
(*format_it)->format->set_soundcloud_upload (this_soundcloud_upload);
if (this_soundcloud_upload) {
show_credentials_entry = true;
}
++format_it;
}
if ((format_it != formats.end ()) && _lossy_format_file_page) {
bool this_soundcloud_upload = _lossy_format_file_page->get_soundcloud_upload ();
(*format_it)->format->set_soundcloud_upload (this_soundcloud_upload);
if (this_soundcloud_upload) {
show_credentials_entry = true;
}
}
soundcloud_export_selector->set_visible (show_credentials_entry);
}
void
WavesExportFileNotebook::update_example_filenames ()
{
int i = 0;
FilePage * page;
while ((page = dynamic_cast<FilePage *> (get_nth_page (i++)))) {
page->update_example_filename();
if (_lossless_format_file_page) {
_lossless_format_file_page->update_example_filename();
}
if (_lossy_format_file_page) {
_lossy_format_file_page->update_example_filename();
}
}
void
WavesExportFileNotebook::add_new_file_page ()
{
FilePage * page;
if ((page = dynamic_cast<FilePage *> (get_nth_page (get_current_page())))) {
add_file_page (profile_manager->duplicate_format_state (page->get_format_state()),
profile_manager->duplicate_filename_state (page->get_filename_state()));
}
}
void
WavesExportFileNotebook::FilePage*
WavesExportFileNotebook::add_file_page (ARDOUR::ExportProfileManager::FormatStatePtr format_state, ARDOUR::ExportProfileManager::FilenameStatePtr filename_state)
{
FilePage * page = Gtk::manage (new FilePage (_session, profile_manager, this, page_counter, format_state, filename_state));
FilePage* page = Gtk::manage (new FilePage (_session, profile_manager, this, page_counter, format_state, filename_state));
page->CriticalSelectionChanged.connect (CriticalSelectionChanged.make_slot());
insert_page (*page, page->get_tab_widget(), get_n_pages() - 1);
update_remove_file_page_sensitivity ();
show_all_children();
++page_counter;
CriticalSelectionChanged ();
return page;
}
void
WavesExportFileNotebook::remove_file_page (FilePage * page)
WavesExportFileNotebook::remove_file_page (FilePage* page)
{
profile_manager->remove_format_state (page->get_format_state());
profile_manager->remove_filename_state (page->get_filename_state());
remove_page (*page);
delete page;
update_remove_file_page_sensitivity ();
CriticalSelectionChanged ();
@ -164,90 +158,49 @@ WavesExportFileNotebook::remove_file_page (FilePage * page)
void
WavesExportFileNotebook::update_remove_file_page_sensitivity ()
{
FilePage * page;
if ((page = dynamic_cast<FilePage *> (get_nth_page (0)))) {
if (get_n_pages() > 2) {
page->set_remove_sensitive (true);
} else {
page->set_remove_sensitive (false);
}
}
//FilePage* page;
//if ((page = dynamic_cast<FilePage*> (get_nth_page (0)))) {
// if (get_n_pages() > 2) {
// page->set_remove_sensitive (true);
// } else {
// page->set_remove_sensitive (false);
// }
//}
}
void
WavesExportFileNotebook::handle_page_change (GtkNotebookPage*, uint32_t page)
WavesExportFileNotebook::FilePage::FilePage (Session* s,
ManagerPtr profile_manager,
WavesExportFileNotebook* parent,
uint32_t number,
ExportProfileManager::FormatStatePtr format_state,
ExportProfileManager::FilenameStatePtr filename_state)
: Gtk::VBox()
, WavesUI ("waves_export_file_notebook_page.xml", *this)
, format_state (format_state)
, filename_state (filename_state)
, profile_manager (profile_manager)
, tab_number (number)
, _format_selector_home (get_container ("format_selector_home"))
, _filename_selector_home (get_container ("filename_selector_home"))
{
if (page + 1 == (uint32_t) get_n_pages()) {
set_current_page (last_visible_page);
} else {
last_visible_page = page;
}
}
WavesExportFileNotebook::FilePage::FilePage (Session * s, ManagerPtr profile_manager, WavesExportFileNotebook * parent, uint32_t number,
ExportProfileManager::FormatStatePtr format_state,
ExportProfileManager::FilenameStatePtr filename_state) :
format_state (format_state),
filename_state (filename_state),
profile_manager (profile_manager),
format_label (_("Format"), Gtk::ALIGN_LEFT),
filename_label (_("Location"), Gtk::ALIGN_LEFT),
soundcloud_upload_button (_("Upload to Soundcloud")),
tab_number (number)
{
set_border_width (12);
pack_start (format_label, false, false, 0);
pack_start (format_align, false, false, 0);
pack_start (filename_label, false, false, 0);
pack_start (filename_align, false, false, 0);
// pack_start (soundcloud_upload_button, false, false, 0);
format_align.add (format_selector);
format_align.set_padding (6, 12, 18, 0);
filename_align.add (filename_selector);
filename_align.set_padding (0, 12, 18, 0);
Pango::AttrList bold;
Pango::Attribute b = Pango::Attribute::create_attr_weight (Pango::WEIGHT_BOLD);
bold.insert (b);
format_label.set_attributes (bold);
filename_label.set_attributes (bold);
tab_label.set_attributes (bold);
/* Set states */
format_selector.set_state (format_state, s);
filename_selector.set_state (filename_state, s);
_format_selector.set_state (format_state, s);
_filename_selector.set_state (filename_state, s);
/* Signals */
profile_manager->FormatListChanged.connect (format_connection, invalidator (*this), boost::bind (&WavesExportFormatSelector::update_format_list, &_format_selector), gui_context());
tab_close_button.signal_clicked().connect (sigc::bind (sigc::mem_fun (*parent, &WavesExportFileNotebook::remove_file_page), this));
_format_selector.FormatEdited.connect (sigc::mem_fun (*this, &WavesExportFileNotebook::FilePage::save_format_to_manager));
_format_selector.FormatRemoved.connect (sigc::mem_fun (*profile_manager, &ExportProfileManager::remove_format_profile));
_format_selector.NewFormat.connect (sigc::mem_fun (*profile_manager, &ExportProfileManager::get_new_format));
profile_manager->FormatListChanged.connect (format_connection, invalidator (*this), boost::bind (&ExportFormatSelector::update_format_list, &format_selector), gui_context());
format_selector.FormatEdited.connect (sigc::mem_fun (*this, &WavesExportFileNotebook::FilePage::save_format_to_manager));
format_selector.FormatRemoved.connect (sigc::mem_fun (*profile_manager, &ExportProfileManager::remove_format_profile));
format_selector.NewFormat.connect (sigc::mem_fun (*profile_manager, &ExportProfileManager::get_new_format));
format_selector.CriticalSelectionChanged.connect (
_format_selector.CriticalSelectionChanged.connect (
sigc::mem_fun (*this, &WavesExportFileNotebook::FilePage::critical_selection_changed));
filename_selector.CriticalSelectionChanged.connect (
_filename_selector.CriticalSelectionChanged.connect (
sigc::mem_fun (*this, &WavesExportFileNotebook::FilePage::critical_selection_changed));
// soundcloud_upload_button.signal_toggled().connect (sigc::mem_fun (*parent, &WavesExportFileNotebook::update_soundcloud_upload));
/* Tab widget */
tab_close_button.add (*Gtk::manage (new Gtk::Image (::get_icon("close"))));
tab_close_alignment.add (tab_close_button);
tab_close_alignment.set (0.5, 0.5, 0, 0);
tab_widget.pack_start (tab_label, false, false, 3);
tab_widget.pack_end (tab_close_alignment, false, false, 0);
tab_widget.show_all_children ();
update_tab_label ();
_format_selector_home.add (_format_selector);
_filename_selector_home.add (_filename_selector);
update_example_filename();
/* Done */
@ -259,10 +212,52 @@ WavesExportFileNotebook::FilePage::~FilePage ()
{
}
void
WavesExportFileNotebook::FilePage::set_remove_sensitive (bool value)
void
WavesExportFileNotebook::on_lossless_button (WavesButton*)
{
tab_close_button.set_sensitive (value);
show_lossless_page ();
}
void
WavesExportFileNotebook::show_lossless_page ()
{
if (_lossless_format_file_page) {
_lossy_button.set_active_state(Gtkmm2ext::Off);
_lossless_button.set_active_state(Gtkmm2ext::ExplicitActive);
if (_lossy_format_file_page && (_lossy_format_file_page->get_parent () == &_file_page_home)) {
_file_page_home.remove (*_lossy_format_file_page);
}
if (_lossless_format_file_page && !_lossless_format_file_page->get_parent ()) {
_file_page_home.add (*_lossless_format_file_page);
_lossless_format_file_page->show_all ();
}
}
}
void
WavesExportFileNotebook::on_lossy_button (WavesButton*)
{
show_lossy_page ();
}
void
WavesExportFileNotebook::show_lossy_page ()
{
if (_lossy_format_file_page) {
_lossless_button.set_active_state(Gtkmm2ext::Off);
_lossy_button.set_active_state(Gtkmm2ext::ExplicitActive);
if (_lossless_format_file_page && (_lossless_format_file_page->get_parent () == &_file_page_home)) {
_file_page_home.remove (*_lossless_format_file_page);
}
if (_lossy_format_file_page && !_lossy_format_file_page->get_parent ()) {
_file_page_home.add (*_lossy_format_file_page);
_lossy_format_file_page->show_all ();
}
}
}
std::string
@ -278,19 +273,20 @@ bool
WavesExportFileNotebook::FilePage::get_soundcloud_upload () const
{
return 0;
return soundcloud_upload_button.get_active ();
// return soundcloud_upload_button.get_active ();
}
void
WavesExportFileNotebook::FilePage::save_format_to_manager (FormatPtr format)
{
std::cout << "WavesExportFileNotebook::FilePage::save_format_to_manager (FormatPtr format)" << std::endl;
profile_manager->save_format_to_disk (format);
}
void
WavesExportFileNotebook::FilePage::update_tab_label ()
{
tab_label.set_text (string_compose (_("Format %1: %2"), tab_number, get_format_name()));
// tab_label.set_text (string_compose (_("Format %1: %2"), tab_number, get_format_name()));
}
void
@ -305,9 +301,9 @@ WavesExportFileNotebook::FilePage::update_example_filename()
}
if (example != "") {
filename_selector.set_example_filename(Glib::path_get_basename (example));
_filename_selector.set_example_filename(Glib::path_get_basename (example));
} else {
filename_selector.set_example_filename("");
_filename_selector.set_example_filename("");
}
}
}

View file

@ -28,11 +28,12 @@
#include "ardour/export_profile_manager.h"
#include "ardour/session_handle.h"
#include "export_format_selector.h"
#include "waves_export_format_selector.h"
#include "waves_export_filename_selector.h"
#include "soundcloud_export_selector.h"
#include "waves_ui.h"
class WavesExportFileNotebook : public Gtk::Notebook, public ARDOUR::SessionHandlePtr
class WavesExportFileNotebook : public Gtk::VBox, public WavesUI, public ARDOUR::SessionHandlePtr
{
public:
@ -55,23 +56,32 @@ class WavesExportFileNotebook : public Gtk::Notebook, public ARDOUR::SessionHand
ManagerPtr profile_manager;
void add_new_file_page ();
void add_file_page (ARDOUR::ExportProfileManager::FormatStatePtr format_state, ARDOUR::ExportProfileManager::FilenameStatePtr filename_state);
FilePage* add_file_page (ARDOUR::ExportProfileManager::FormatStatePtr format_state,
ARDOUR::ExportProfileManager::FilenameStatePtr filename_state);
void remove_file_page (FilePage * page);
void update_remove_file_page_sensitivity ();
void update_soundcloud_upload ();
void show_lossless_page ();
void show_lossy_page ();
void on_lossless_button (WavesButton*);
void on_lossy_button (WavesButton*);
sigc::connection page_change_connection;
void handle_page_change (GtkNotebookPage*, uint32_t page);
Gtk::HBox new_file_hbox;
Gtk::Button new_file_button;
Gtk::VBox new_file_dummy;
uint32_t last_visible_page;
uint32_t page_counter;
class FilePage : public Gtk::VBox {
WavesButton& _lossless_button;
WavesButton& _lossless_check_button;
FilePage* _lossless_format_file_page;
WavesButton& _lossy_button;
WavesButton& _lossy_check_button;
FilePage* _lossy_format_file_page;
Gtk::Container& _file_page_home;
class FilePage : public Gtk::VBox, public WavesUI {
public:
FilePage (ARDOUR::Session * s, ManagerPtr profile_manager, WavesExportFileNotebook * parent, uint32_t number,
ARDOUR::ExportProfileManager::FormatStatePtr format_state,
@ -79,8 +89,6 @@ class WavesExportFileNotebook : public Gtk::Notebook, public ARDOUR::SessionHand
virtual ~FilePage ();
Gtk::Widget & get_tab_widget () { return tab_widget; }
void set_remove_sensitive (bool value);
std::string get_format_name () const;
bool get_soundcloud_upload () const;
@ -101,21 +109,21 @@ class WavesExportFileNotebook : public Gtk::Notebook, public ARDOUR::SessionHand
ManagerPtr profile_manager;
/* GUI components */
Gtk::Label format_label;
Gtk::Alignment format_align;
ExportFormatSelector format_selector;
Gtk::Container& _format_selector_home;
Gtk::Container& _filename_selector_home;
//Gtk::Label format_label;
//Gtk::Alignment format_align;
WavesExportFormatSelector _format_selector;
PBD::ScopedConnection format_connection;
Gtk::Label filename_label;
Gtk::Alignment filename_align;
WavesExportFilenameSelector filename_selector;
//Gtk::Alignment filename_align;
WavesExportFilenameSelector _filename_selector;
Gtk::CheckButton soundcloud_upload_button;
Gtk::HBox tab_widget;
Gtk::Label tab_label;
Gtk::Alignment tab_close_alignment;
Gtk::Button tab_close_button;
//Gtk::CheckButton soundcloud_upload_button;
//Gtk::HBox tab_widget;
//Gtk::Label tab_label;
//Gtk::Alignment tab_close_alignment;
//Gtk::Button tab_close_button;
uint32_t tab_number;
};
};

View file

@ -0,0 +1,218 @@
/*
Copyright (C) 2008 Paul Davis
Copyright (C) 2015 Waves Audio Ltd.
Author: Sakari Bergen
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 "waves_export_format_selector.h"
#include "export_format_dialog.h"
#include "ardour/export_format_specification.h"
#include "ardour/export_profile_manager.h"
#include "i18n.h"
WavesExportFormatSelector::WavesExportFormatSelector ()
: Gtk::HBox ()
, WavesUI ("waves_export_format_selector.xml", *this)
, _edit_button (get_waves_button ("edit_button"))
, _remove_button (get_waves_button ("remove_button"))
, _new_button (get_waves_button ("new_button"))
, _format_dropdown (get_waves_dropdown ("format_dropdown"))
{
_edit_button.signal_clicked.connect (sigc::mem_fun (*this, &WavesExportFormatSelector::on_edit_button));
_remove_button.signal_clicked.connect (sigc::mem_fun (*this, &WavesExportFormatSelector::on_remove_button));
_new_button.signal_clicked.connect (sigc::mem_fun (*this, &WavesExportFormatSelector::add_new_format));
/* Sorted contents for dropdown */
format_list = Gtk::ListStore::create (format_cols);
format_list->set_sort_column (format_cols.label, Gtk::SORT_ASCENDING);
_format_dropdown.selected_item_changed.connect (sigc::mem_fun (*this, &WavesExportFormatSelector::update_format_dropdown));
}
WavesExportFormatSelector::~WavesExportFormatSelector ()
{
}
void
WavesExportFormatSelector::set_state (ARDOUR::ExportProfileManager::FormatStatePtr const state_, ARDOUR::Session * session_)
{
SessionHandlePtr::set_session (session_);
state = state_;
update_format_list ();
}
void
WavesExportFormatSelector::update_format_list ()
{
FormatPtr format_to_select = state->format;
format_list->clear();
if (state->list->empty()) {
_edit_button.set_sensitive (false);
_remove_button.set_sensitive (false);
return;
} else {
_edit_button.set_sensitive (true);
_remove_button.set_sensitive (true);
}
Gtk::ListStore::iterator tree_it;
for (FormatList::const_iterator it = state->list->begin(); it != state->list->end(); ++it) {
tree_it = format_list->append();
tree_it->set_value (format_cols.format, *it);
tree_it->set_value (format_cols.label, (*it)->description());
}
{
_format_dropdown.clear_items ();
Gtk::TreeModel::Children::iterator it;
for (it = format_list->children().begin(); it != format_list->children().end(); ++it) {
_format_dropdown.add_menu_item (it->get_value (format_cols.label), (void*)it->get_value (format_cols.format).get ());
}
}
if ((_format_dropdown.get_current_item () < 0) &&
(_format_dropdown.get_menu ().items ().size () > 0)) {
_format_dropdown.set_current_item (0);
}
select_format (format_to_select);
}
void
WavesExportFormatSelector::select_format (FormatPtr f)
{
int size = _format_dropdown.get_menu ().items ().size ();
for (int i = 0; i < size; i++) {
if (_format_dropdown.get_item_associated_data (i) == (void*)f.get()) {
_format_dropdown.set_current_item (i);
break;
}
}
CriticalSelectionChanged();
}
void
WavesExportFormatSelector::on_edit_button (WavesButton*)
{
open_edit_dialog (false);
}
void
WavesExportFormatSelector::on_remove_button (WavesButton*)
{
remove_format (true);
}
void
WavesExportFormatSelector::add_new_format (WavesButton*)
{
FormatPtr new_format = state->format = NewFormat (state->format);
if (open_edit_dialog (true) != Gtk::RESPONSE_APPLY) {
remove_format(false);
if (state->list->empty()) {
state->format.reset ();
}
}
}
void
WavesExportFormatSelector::remove_format (bool called_from_button)
{
if (called_from_button) {
Gtk::MessageDialog dialog (_("Do you really want to remove the format?"),
false,
Gtk::MESSAGE_QUESTION,
Gtk::BUTTONS_YES_NO);
if (Gtk::RESPONSE_YES != dialog.run ()) {
/* User has selected "no" or closed the dialog, better
* abort
*/
return;
}
}
int current_item = _format_dropdown.get_current_item();
if (current_item >= 0) {
void* item_data = _format_dropdown.get_item_associated_data (current_item);
Gtk::TreeModel::Children::iterator it;
for (it = format_list->children().begin(); it != format_list->children().end(); ++it) {
FormatPtr remove = it->get_value (format_cols.format);
if (item_data == (void*)remove.get ()) {
FormatRemoved (remove);
}
}
}
}
int
WavesExportFormatSelector::open_edit_dialog (bool new_dialog)
{
ExportFormatDialog dialog (state->format, new_dialog);
dialog.set_session (_session);
Gtk::ResponseType response = (Gtk::ResponseType) dialog.run();
if (response == Gtk::RESPONSE_APPLY) {
update_format_description ();
FormatEdited (state->format);
CriticalSelectionChanged();
}
return response;
}
void
WavesExportFormatSelector::update_format_dropdown (WavesDropdown*, int item)
{
std::cout << "WavesExportFormatSelector::update_format_dropdown ()" << std::endl;
Gtk::TreeModel::Children::iterator it;
bool done = false;
for (it = format_list->children().begin(); it != format_list->children().end(); ++it) {
FormatPtr format = it->get_value (format_cols.format);
if ((void*)format.get () == _format_dropdown.get_item_associated_data(item)) {
state->format = format;
std::cout << " Changed format to " << format->name () << std::endl;
done = true;
break;
}
}
if (!done) {
if (!format_list->children().empty()) {
_format_dropdown.set_current_item (0);
} else {
_edit_button.set_sensitive (false);
_remove_button.set_sensitive (false);
}
}
CriticalSelectionChanged();
}
void
WavesExportFormatSelector::update_format_description ()
{
std::cout << "WavesExportFormatSelector::update_format_description () : " << state->format->description() << std::endl;
// format_combo.get_active()->set_value(format_cols.label, state->format->description());
}

View file

@ -0,0 +1,96 @@
/*
Copyright (C) 2008 Paul Davis
Copyright (C) 2015 Waves Audio Ltd.
Author: Sakari Bergen
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 __waves_export_format_selector_h__
#define __waves_export_format_selector_h__
#include <string>
#include <gtkmm.h>
#include <sigc++/signal.h>
#include <boost/shared_ptr.hpp>
#include "ardour/export_profile_manager.h"
#include "ardour/session_handle.h"
#include "waves_ui.h"
namespace ARDOUR {
class ExportFormatSpecification;
class ExportProfileManager;
}
///
class WavesExportFormatSelector : public Gtk::HBox, public WavesUI, public ARDOUR::SessionHandlePtr
{
private:
typedef boost::shared_ptr<ARDOUR::ExportFormatSpecification> FormatPtr;
typedef std::list<FormatPtr> FormatList;
public:
WavesExportFormatSelector ();
~WavesExportFormatSelector ();
void set_state (ARDOUR::ExportProfileManager::FormatStatePtr state_, ARDOUR::Session * session_);
void update_format_list ();
sigc::signal<void, FormatPtr> FormatEdited;
sigc::signal<void, FormatPtr> FormatRemoved;
sigc::signal<FormatPtr, FormatPtr> NewFormat;
/* Compatibility with other elements */
sigc::signal<void> CriticalSelectionChanged;
private:
void select_format (FormatPtr f);
void add_new_format (WavesButton*);
void remove_format (bool called_from_button = false);
int open_edit_dialog (bool new_dialog = false);
void update_format_dropdown (WavesDropdown*, int);
void update_format_description ();
void on_edit_button (WavesButton*);
void on_remove_button (WavesButton*);
ARDOUR::ExportProfileManager::FormatStatePtr state;
/*** GUI componenets ***/
struct FormatCols : public Gtk::TreeModelColumnRecord
{
public:
Gtk::TreeModelColumn<FormatPtr> format;
Gtk::TreeModelColumn<std::string> label;
FormatCols () { add (format); add (label); }
};
FormatCols format_cols;
Glib::RefPtr<Gtk::ListStore> format_list;
WavesDropdown& _format_dropdown;
WavesButton& _edit_button;
WavesButton& _remove_button;
WavesButton& _new_button;
};
#endif // __waves_export_format_selector_h__

View file

@ -35,6 +35,7 @@ gtk2_ardour_sources = [
'waves_export_preset_selector.cc',
'waves_export_timespan_selector.cc',
'waves_export_filename_selector.cc',
'waves_export_format_selector.cc',
'marker_inspector_dialog.cc',
'marker_inspector_dialog.logic.cc',
'route_inspector.cc',