mirror of
https://github.com/Ardour/ardour.git
synced 2026-01-17 02:46:15 +01:00
[Summary] Introducing "Save Template" with Tracks Specific dialog.
This commit is contained in:
parent
706bc57b38
commit
ad3b5056a1
6 changed files with 243 additions and 11 deletions
|
|
@ -87,6 +87,7 @@
|
|||
#include "ardour/system_exec.h"
|
||||
#include "ardour/directory_names.h"
|
||||
#include "ardour/filename_extensions.h"
|
||||
#include "waves_prompter.h"
|
||||
#include "dbg_msg.h"
|
||||
|
||||
#ifdef WINDOWS_VST_SUPPORT
|
||||
|
|
@ -2690,23 +2691,17 @@ ARDOUR_UI::transport_rec_enable_blink (bool onoff)
|
|||
void
|
||||
ARDOUR_UI::save_template ()
|
||||
{
|
||||
ArdourPrompter prompter (true);
|
||||
string name;
|
||||
|
||||
if (!check_audioengine()) {
|
||||
return;
|
||||
}
|
||||
|
||||
prompter.set_name (X_("Prompter"));
|
||||
prompter.set_title (_("Save Template"));
|
||||
prompter.set_prompt (_("Name for template:"));
|
||||
prompter.set_initial_text(_session->name() + _("-template"));
|
||||
prompter.add_button ("SAVE", Gtk::RESPONSE_ACCEPT);
|
||||
std::string name;
|
||||
WavesPrompter the_prompter ("waves_save_template_dialog.xml");
|
||||
the_prompter.set_initial_text(_session->name() + _("-template"));
|
||||
|
||||
switch (prompter.run()) {
|
||||
switch (the_prompter.run()) {
|
||||
case RESPONSE_ACCEPT:
|
||||
prompter.get_result (name);
|
||||
|
||||
the_prompter.get_result (name);
|
||||
if (name.length()) {
|
||||
_session->save_template (name);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
<menuitem action='Open'/>
|
||||
<menuitem action='Save'/>
|
||||
<menuitem action='SaveAs'/>
|
||||
<menuitem action='SaveTemplate'/>
|
||||
<menuitem action='Close'/>
|
||||
<menu name='recent-sessions' action='recent-sessions'>
|
||||
<menuitem action='recent-session-0'/>
|
||||
|
|
|
|||
58
gtk2_ardour/ui/waves_save_template_dialog.xml
Normal file
58
gtk2_ardour/ui/waves_save_template_dialog.xml
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Dialog title="Save Template - Tracks Live" resizeable="False" 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"
|
||||
width="80"
|
||||
height="22"/>
|
||||
<style name="generic_entry"
|
||||
style="generic_control"
|
||||
bgnormal="#6C6C6C"
|
||||
basenormal="#6C6C6C"
|
||||
fgnormal="#C1C1C1"
|
||||
textcolornormal="#C1C1C1"
|
||||
height="22"
|
||||
hasframe="false"/>
|
||||
|
||||
<EventBox bgnormal="#EDECE8">
|
||||
<VBox borderwidth="10"
|
||||
spacing="10">
|
||||
<HBox spacing="10">
|
||||
<Label id="entry_label"
|
||||
style="generic_control"
|
||||
text="Name for template"/>
|
||||
<Entry id="entry"
|
||||
style="generic_entry"
|
||||
horzalignment="start"
|
||||
width="200"/>
|
||||
</HBox>
|
||||
<HBox spacing="10">
|
||||
<Button id="accept_button"
|
||||
style="generic_button"
|
||||
box.pack="end"
|
||||
text="Save"/>
|
||||
<Button id="cancel_button"
|
||||
style="generic_button"
|
||||
box.pack="end"
|
||||
text="Cancel"/>
|
||||
</HBox>
|
||||
</VBox>
|
||||
</EventBox>
|
||||
</Dialog>
|
||||
111
gtk2_ardour/waves_prompter.cc
Normal file
111
gtk2_ardour/waves_prompter.cc
Normal file
|
|
@ -0,0 +1,111 @@
|
|||
/*
|
||||
Copyright (C) 1999 Paul Barton-Davis
|
||||
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.
|
||||
|
||||
$Id$
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <pbd/whitespace.h>
|
||||
|
||||
#include <gtkmm/stock.h>
|
||||
#include "waves_prompter.h"
|
||||
|
||||
#include "i18n.h"
|
||||
|
||||
WavesPrompter::WavesPrompter (const std::string &layout_script_file)
|
||||
: WavesDialog (layout_script_file)
|
||||
, _entry (get_entry ("entry"))
|
||||
, _entry_label (get_label ("entry_label"))
|
||||
, _accept_button (get_waves_button ("accept_button"))
|
||||
, _cancel_button (get_waves_button ("cancel_button"))
|
||||
, _first_show (true)
|
||||
, _can_accept_from_entry (false)
|
||||
{
|
||||
_accept_button.signal_clicked.connect (sigc::mem_fun (*this, &WavesPrompter::_on_accept_button_clicked));
|
||||
_cancel_button.signal_clicked.connect (sigc::mem_fun (*this, &WavesPrompter::_on_cancel_button_clicked));
|
||||
set_type_hint (Gdk::WINDOW_TYPE_HINT_DIALOG);
|
||||
set_position (Gtk::WIN_POS_MOUSE);
|
||||
}
|
||||
|
||||
void
|
||||
WavesPrompter::on_show ()
|
||||
{
|
||||
/* don't connect to signals till shown, so that we don't change the
|
||||
response sensitivity etc. when the setup of the dialog sets the text.
|
||||
*/
|
||||
|
||||
if (_first_show) {
|
||||
_entry.signal_changed().connect (mem_fun (*this, &WavesPrompter::on_entry_changed));
|
||||
_entry.signal_activate().connect (mem_fun (*this, &WavesPrompter::_entry_activated));
|
||||
_can_accept_from_entry = !_entry.get_text().empty();
|
||||
_first_show = false;
|
||||
}
|
||||
|
||||
Dialog::on_show ();
|
||||
}
|
||||
|
||||
void
|
||||
WavesPrompter::get_result (std::string &str, bool strip)
|
||||
{
|
||||
str = _entry.get_text ();
|
||||
if (strip) {
|
||||
PBD::strip_whitespace_edges (str);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
WavesPrompter::_entry_activated ()
|
||||
{
|
||||
if (_can_accept_from_entry) {
|
||||
response (Gtk::RESPONSE_ACCEPT);
|
||||
} else {
|
||||
response (Gtk::RESPONSE_CANCEL);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
WavesPrompter::on_entry_changed ()
|
||||
{
|
||||
/*
|
||||
This is set up so that entering text in the _entry
|
||||
field makes the RESPONSE_ACCEPT button active.
|
||||
Of course if you haven't added a RESPONSE_ACCEPT
|
||||
button, nothing will happen at all.
|
||||
*/
|
||||
|
||||
if (!_entry.get_text().empty()) {
|
||||
set_response_sensitive (Gtk::RESPONSE_ACCEPT, true);
|
||||
set_default_response (Gtk::RESPONSE_ACCEPT);
|
||||
_can_accept_from_entry = true;
|
||||
} else {
|
||||
set_response_sensitive (Gtk::RESPONSE_ACCEPT, false);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
WavesPrompter::_on_accept_button_clicked (WavesButton*)
|
||||
{
|
||||
response (Gtk::RESPONSE_ACCEPT);
|
||||
}
|
||||
|
||||
void
|
||||
WavesPrompter::_on_cancel_button_clicked (WavesButton*)
|
||||
{
|
||||
response (Gtk::RESPONSE_CANCEL);
|
||||
}
|
||||
66
gtk2_ardour/waves_prompter.h
Normal file
66
gtk2_ardour/waves_prompter.h
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
/*
|
||||
Copyright (C) 1999 Paul Barton-Davis
|
||||
|
||||
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_prompter_h__
|
||||
#define __waves_prompter_h__
|
||||
|
||||
#include <string>
|
||||
#include <sigc++/sigc++.h>
|
||||
|
||||
#include "waves_dialog.h"
|
||||
|
||||
class WavesPrompter : public WavesDialog
|
||||
|
||||
{
|
||||
public:
|
||||
WavesPrompter (const std::string &layout_script_file);
|
||||
~WavesPrompter () {};
|
||||
|
||||
void set_prompt (std::string prompt) {
|
||||
_entry_label.set_label (prompt);
|
||||
}
|
||||
|
||||
void set_initial_text (std::string txt) {
|
||||
_entry.set_text (txt);
|
||||
_entry.select_region (0, _entry.get_text_length());
|
||||
}
|
||||
|
||||
void get_result (std::string &str, bool strip=true);
|
||||
|
||||
protected:
|
||||
Gtk::Entry& the_entry() { return _entry; }
|
||||
|
||||
void on_entry_changed ();
|
||||
void on_show ();
|
||||
|
||||
private:
|
||||
Gtk::Entry& _entry;
|
||||
Gtk::Label& _entry_label;
|
||||
WavesButton& _accept_button;
|
||||
WavesButton& _cancel_button;
|
||||
bool _first_show;
|
||||
bool _can_accept_from_entry;
|
||||
|
||||
void _init ();
|
||||
void _entry_activated ();
|
||||
void _on_accept_button_clicked (WavesButton*);
|
||||
void _on_cancel_button_clicked (WavesButton*);
|
||||
};
|
||||
|
||||
#endif /* __waves_prompter_h__ */
|
||||
|
|
@ -28,6 +28,7 @@ path_prefix = 'gtk2_ardour/'
|
|||
|
||||
gtk2_ardour_sources = [
|
||||
'mixer_bridge_view.cc',
|
||||
'waves_prompter.cc',
|
||||
'waves_ambiguous_file_dialog.cc',
|
||||
'waves_missing_file_dialog.cc',
|
||||
'waves_import_dialog.cc',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue