[Submit] Progressing XML-ized export dialogs.

This commit is contained in:
VKamyshniy 2015-01-22 23:43:40 +02:00
parent d915c8e60e
commit 4f817cb84e
11 changed files with 511 additions and 5 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 285 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 262 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 302 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 256 B

View file

@ -0,0 +1,145 @@
<?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"/>
<style name="generic_dropdown"
style="generic_control"
bgnormal="#6C6C6C"
fgnormal="#C1C1C1"/>
<style name="generic_dropdown_menu"
style="generic_dropdown"/>
<VBox>
<HBox spacing="6">
<Label style="generic_control"
text="Folder:"/>
<Entry id="path_entry"
style="generic_button"
activatesdefault="true"
hasframe="false"
horzalignment="start"
height="22"
box.fill="true"
box.expand="true"/>
<Button id="browse_button"
style="generic_button"
text="Browse"
width="60"/>
</HBox>
<VBox height="18"/>
<Label style="generic_control"
text="Build filename(s) from these components:"
horzalignment="start"
winfont="Arial Italic 10"
macfont="Helvetica Italic 10"/>
<VBox height="6"/>
<HBox spacing="6">
<Label style="generic_control"
text="Label:"/>
<Entry id="label_entry"
style="generic_button"
hasframe="false"
activatesdefault="true"
horzalignment="start"
height="22"
box.fill="true"
box.expand="true"/>
<HBox>
<Iconbutton id="session_button"
width="20"
height="20"
normalicon="waves_darker_check_box"
activeicon="waves_darker_check_box_active"
toggleable="true"/>
<Label style="generic_control"
text="Session Name"/>
</HBox>
<Dropdown style="generic_dropdown"
id="date_format_dropdown"
width="90"
height="20"
normalicon="dropdown_90x20"
activeicon="dropdown_90x20_active"
inactiveicon="dropdown_90x20_inactive">
<HBox>
<VBox width="10"/>
<Label style="generic_dropdown"
horzalignment="start"/>
</HBox>
<DropdownMenu style="generic_dropdown_menu"/>
</Dropdown>
<Dropdown style="generic_dropdown"
id="time_format_dropdown"
width="90"
height="20"
normalicon="dropdown_90x20"
activeicon="dropdown_90x20_active"
inactiveicon="dropdown_90x20_inactive">
<HBox>
<VBox width="10"/>
<Label style="generic_dropdown"
horzalignment="start"/>
</HBox>
<DropdownMenu style="generic_dropdown_menu"/>
</Dropdown>
<HBox>
<Iconbutton id="revision_button"
width="20"
height="20"
normalicon="waves_darker_check_box"
activeicon="waves_darker_check_box_active"
toggleable="true"/>
<Label style="generic_control"
text="Revision:"/>
</HBox>
<HBox>
<Entry id="revision_entry"
style="generic_button"
hasframe="false"
horzalignment="start"
width="32"
height="22"
box.fill="true"
box.expand="true"/>
<VBox>
<iconbutton id="revision_inc_button"
width="12"
height="11"
normalicon="spin_up_12x11"
activeicon="spin_up_12x11_inactive"
inactiveicon="spin_up_12x11_inactive"/>
<iconbutton id="revision_dec_button"
width="12"
height="11"
normalicon="spin_down_12x11"
activeicon="spin_down_12x11_inactive"
inactiveicon="spin_down_12x11_inactive"/>
</VBox>
</HBox>
</HBox>
<VBox height="11"/>
<Label id="example_filename_label"
style="generic_control"
horzalignment="start"
winfont="Arial Italic 10"
macfont="Helvetica Italic 10"/>
</VBox>
</VBox>

View file

@ -1,6 +1,6 @@
/*
Copyright (C) 2008 Paul Davis
Copyright (C) 2014 Waves Audio Ltd.
Copyright (C) 2015 Waves Audio Ltd.
Author: Sakari Bergen
This program is free software; you can redistribute it and/or modify

View file

@ -1,6 +1,6 @@
/*
Copyright (C) 2008 Paul Davis
Copyright (C) 2014 Waves Audio Ltd.
Copyright (C) 2015 Waves Audio Ltd.
Author: Sakari Bergen
This program is free software; you can redistribute it and/or modify

View file

@ -1,6 +1,6 @@
/*
Copyright (C) 2008 Paul Davis
Copyright (C) 2014 Waves Audio Ltd.
Copyright (C) 2015 Waves Audio Ltd.
Author: Sakari Bergen
This program is free software; you can redistribute it and/or modify
@ -29,7 +29,7 @@
#include "ardour/session_handle.h"
#include "export_format_selector.h"
#include "export_filename_selector.h"
#include "waves_export_filename_selector.h"
#include "soundcloud_export_selector.h"
class WavesExportFileNotebook : public Gtk::Notebook, public ARDOUR::SessionHandlePtr
@ -109,7 +109,7 @@ class WavesExportFileNotebook : public Gtk::Notebook, public ARDOUR::SessionHand
Gtk::Label filename_label;
Gtk::Alignment filename_align;
ExportFilenameSelector filename_selector;
WavesExportFilenameSelector filename_selector;
Gtk::CheckButton soundcloud_upload_button;
Gtk::HBox tab_widget;

View file

@ -0,0 +1,273 @@
/*
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 <gtkmm/messagedialog.h>
#include "open_file_dialog_proxy.h"
#include "waves_export_filename_selector.h"
#include "waves_message_dialog.h"
#include "i18n.h"
using namespace ARDOUR;
WavesExportFilenameSelector::WavesExportFilenameSelector ()
: Gtk::VBox ()
, WavesUI ("waves_export_filename_selector.xml", *this)
, _date_format_dropdown (get_waves_dropdown ("date_format_dropdown"))
, _time_format_dropdown (get_waves_dropdown ("time_format_dropdown"))
, _session_button (get_waves_button ("session_button"))
, _revision_button (get_waves_button ("revision_button"))
, _label_entry (get_entry ("label_entry"))
, _path_entry (get_entry ("path_entry"))
, _revision_entry (get_entry ("revision_entry"))
, _revision_inc_button (get_waves_button ("revision_inc_button"))
, _revision_dec_button (get_waves_button ("revision_dec_button"))
, _browse_button (get_waves_button ("browse_button"))
, _example_filename_label (get_label("example_filename_label"))
{
/* Date */
_date_format_dropdown.selected_item_changed.connect (sigc::mem_fun (*this, &WavesExportFilenameSelector::change_date_format));
/* Time */
_time_format_dropdown.selected_item_changed.connect (sigc::mem_fun (*this, &WavesExportFilenameSelector::change_time_format));
/* Signals */
_label_entry.signal_changed().connect (sigc::mem_fun (*this, &WavesExportFilenameSelector::update_label));
_path_entry.signal_changed().connect (sigc::mem_fun (*this, &WavesExportFilenameSelector::update_folder));
_revision_entry.signal_changed().connect (sigc::mem_fun (*this, &WavesExportFilenameSelector::update_revision));
_path_entry.signal_activate().connect (sigc::mem_fun (*this, &WavesExportFilenameSelector::check_folder), false);
_session_button.signal_clicked.connect (sigc::mem_fun (*this, &WavesExportFilenameSelector::change_session_selection));
_revision_inc_button.signal_clicked.connect (sigc::mem_fun (*this, &WavesExportFilenameSelector::on_revision_inc_button));
_revision_dec_button.signal_clicked.connect (sigc::mem_fun (*this, &WavesExportFilenameSelector::on_revision_dec_button));
_revision_button.signal_clicked.connect (sigc::mem_fun (*this, &WavesExportFilenameSelector::change_revision_selection));
_browse_button.signal_clicked.connect (sigc::mem_fun (*this, &WavesExportFilenameSelector::open_browse_dialog));
}
WavesExportFilenameSelector::~WavesExportFilenameSelector ()
{
}
void
WavesExportFilenameSelector::load_state ()
{
if (!filename) {
return;
}
_label_entry.set_text (filename->include_label ? filename->get_label() : "");
_session_button.set_active (filename->include_session ? Gtkmm2ext::ExplicitActive : Gtkmm2ext::Off);;
_revision_button.set_active_state (filename->include_revision ? Gtkmm2ext::ExplicitActive : Gtkmm2ext::Off);
_revision_entry.set_text (string_compose ("%1", filename->get_revision()));
_revision_entry.set_sensitive (filename->include_revision);
_revision_inc_button.set_sensitive (filename->include_revision);
_revision_dec_button.set_sensitive (filename->include_revision);
_path_entry.set_text (filename->get_folder());
int size = _date_format_dropdown.get_menu ().items ().size ();
for (int i = 0; i < size; i++) {
if (_date_format_dropdown.get_item_associated_data (i) == (void*)filename->get_date_format()) {
_date_format_dropdown.set_current_item (i);
}
}
size = _time_format_dropdown.get_menu ().items ().size ();
for (int i = 0; i < size; i++) {
if (_time_format_dropdown.get_item_associated_data (i) == (void*)filename->get_time_format()) {
_time_format_dropdown.set_current_item (i);
}
}
}
void
WavesExportFilenameSelector::set_state (ARDOUR::ExportProfileManager::FilenameStatePtr state_, ARDOUR::Session * session_)
{
SessionHandlePtr::set_session (session_);
filename = state_->filename;
/* Fill dropdowns */
/* Dates */
_date_format_dropdown.clear_items ();
_date_format_dropdown.add_menu_item (filename->get_date_format_str (ExportFilename::D_None), (void*)ExportFilename::D_None);
_date_format_dropdown.add_menu_item (filename->get_date_format_str (ExportFilename::D_ISO), (void*)ExportFilename::D_ISO);
_date_format_dropdown.add_menu_item (filename->get_date_format_str (ExportFilename::D_ISOShortY), (void*)ExportFilename::D_ISOShortY);
_date_format_dropdown.add_menu_item (filename->get_date_format_str (ExportFilename::D_BE), (void*)ExportFilename::D_BE);
_date_format_dropdown.add_menu_item (filename->get_date_format_str (ExportFilename::D_BEShortY), (void*)ExportFilename::D_BEShortY);
/* Times */
_time_format_dropdown.clear_items ();
_time_format_dropdown.add_menu_item (filename->get_time_format_str (ExportFilename::T_None), (void*)ExportFilename::T_None);
_time_format_dropdown.add_menu_item (filename->get_time_format_str (ExportFilename::T_NoDelim), (void*)ExportFilename::T_NoDelim);
_time_format_dropdown.add_menu_item (filename->get_time_format_str (ExportFilename::T_Delim), (void*)ExportFilename::T_Delim);
/* Load state */
load_state();
}
void
WavesExportFilenameSelector::set_example_filename (std::string filename)
{
if (filename == "") {
_example_filename_label.set_markup (_("Sorry, no example filename can be shown at the moment"));
} else {
_example_filename_label.set_markup (string_compose(_("Current (approximate) filename: \"%1\""), filename));
}
}
void
WavesExportFilenameSelector::update_label ()
{
if (!filename) {
return;
}
filename->set_label (_label_entry.get_text());
filename->include_label = !_label_entry.get_text().empty();
CriticalSelectionChanged();
}
void
WavesExportFilenameSelector::on_revision_inc_button (WavesButton*)
{
change_revision_value (1);
}
void
WavesExportFilenameSelector::on_revision_dec_button (WavesButton*)
{
change_revision_value (-1);
}
void
WavesExportFilenameSelector::change_revision_value (int change)
{
int revision = (int)filename->get_revision() + change;
filename->set_revision (revision < 1 ? 1 : revision);
_revision_entry.set_text (string_compose ("%1", filename->get_revision()));
CriticalSelectionChanged();
}
void
WavesExportFilenameSelector::update_folder ()
{
if (!filename) {
return;
}
filename->set_folder (_path_entry.get_text());
CriticalSelectionChanged();
}
void
WavesExportFilenameSelector::check_folder ()
{
if (!filename) {
return;
}
if (!Glib::file_test (_path_entry.get_text(), Glib::FILE_TEST_IS_DIR|Glib::FILE_TEST_EXISTS)) {
WavesMessageDialog msg ("", string_compose (_("%1: this is only the directory/folder name, not the filename.\n\
The filename will be chosen from the information just above the folder selector."), _path_entry.get_text()));
msg.run ();
_path_entry.set_text (Glib::path_get_dirname (_path_entry.get_text()));
filename->set_folder (_path_entry.get_text());
CriticalSelectionChanged();
}
}
void
WavesExportFilenameSelector::change_date_format (WavesDropdown*, int item)
{
if (!filename) {
return;
}
filename->set_date_format ((DateFormat)((char*)_date_format_dropdown.get_item_associated_data(item) - (char*)0));
CriticalSelectionChanged();
}
void
WavesExportFilenameSelector::change_time_format (WavesDropdown*, int item)
{
if (!filename) {
return;
}
filename->set_time_format ((TimeFormat)((char*)_time_format_dropdown.get_item_associated_data(item) - (char*)0));
CriticalSelectionChanged();
}
void
WavesExportFilenameSelector::change_session_selection (WavesButton*)
{
if (!filename) {
return;
}
filename->include_session = (_session_button.active_state () == Gtkmm2ext::ExplicitActive);
CriticalSelectionChanged();
}
void
WavesExportFilenameSelector::change_revision_selection (WavesButton*)
{
if (!filename) {
return;
}
bool selected = (_revision_button.active_state () == Gtkmm2ext::ExplicitActive);
filename->include_revision = selected;
_revision_entry.set_sensitive (selected);
_revision_inc_button.set_sensitive (selected);
_revision_dec_button.set_sensitive (selected);
CriticalSelectionChanged();
}
void
WavesExportFilenameSelector::update_revision ()
{
if (!filename) {
return;
}
int revision = (uint32_t)PBD::atoi(_revision_entry.get_text());
filename->set_revision (revision < 1 ? 1 : revision);
CriticalSelectionChanged();
}
void
WavesExportFilenameSelector::open_browse_dialog (WavesButton*)
{
std::string filename = ARDOUR::choose_folder_dialog(_path_entry.get_text(), _("Choose export folder"));
if (!filename.empty ()) {
_path_entry.set_text (filename);
}
CriticalSelectionChanged();
return;
}

View file

@ -0,0 +1,87 @@
/*
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_filename_selector_h__
#define __waves_export_filename_selector_h__
#include <gtkmm.h>
#include "ardour/export_profile_manager.h"
#include "ardour/export_filename.h"
#include "ardour/session_handle.h"
#include "waves_ui.h"
///
class WavesExportFilenameSelector : public Gtk::VBox, public WavesUI, public ARDOUR::SessionHandlePtr
{
public:
typedef boost::shared_ptr<ARDOUR::ExportFilename> FilenamePtr;
WavesExportFilenameSelector ();
~WavesExportFilenameSelector ();
void set_state (ARDOUR::ExportProfileManager::FilenameStatePtr state_, ARDOUR::Session * session_);
void set_example_filename (std::string filename);
/* Compatibility with other elements */
sigc::signal<void> CriticalSelectionChanged;
private:
void load_state ();
void update_label ();
void update_folder ();
void update_revision ();
void check_folder ();
void change_date_format (WavesDropdown*, int);
void change_time_format (WavesDropdown*, int);
void change_session_selection (WavesButton*);
void change_revision_selection (WavesButton*);
void on_revision_inc_button (WavesButton*);
void on_revision_dec_button (WavesButton*);
void change_revision_value (int);
void open_browse_dialog (WavesButton*);
boost::shared_ptr<ARDOUR::ExportFilename> filename;
WavesDropdown& _date_format_dropdown;
WavesDropdown& _time_format_dropdown;
WavesButton& _session_button;
WavesButton& _revision_button;
Gtk::Entry& _label_entry;
Gtk::Entry& _path_entry;
Gtk::Entry& _revision_entry;
WavesButton& _revision_inc_button;
WavesButton& _revision_dec_button;
WavesButton& _browse_button;
Gtk::Label& _example_filename_label;
/* Date combo */
typedef ARDOUR::ExportFilename::DateFormat DateFormat;
typedef ARDOUR::ExportFilename::TimeFormat TimeFormat;
};
#endif // __waves_export_filename_selector_h__

View file

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