mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-28 09:27:39 +01:00
[Summary] Merge with changes from Nikolay
This commit is contained in:
parent
8ded3997fe
commit
31bef697a7
4 changed files with 49 additions and 39 deletions
|
|
@ -38,13 +38,15 @@ using namespace PBD;
|
|||
using namespace Gtkmm2ext;
|
||||
|
||||
AddTracksDialog::AddTracksDialog ()
|
||||
: WavesDialog (_("add_tracks_dialog.xml"), true, false)
|
||||
, _decrement_button (get_waves_button ("decrement_button"))
|
||||
, _increment_button (get_waves_button ("increment_button"))
|
||||
, _cancel_button (get_waves_button ("cancel_button"))
|
||||
, _ok_button (get_waves_button ("ok_button"))
|
||||
, _tracks_format_dropdown (get_waves_dropdown ("tracks_format_dropdown"))
|
||||
, _tracks_counter_entry (get_entry("tracks_counter_entry"))
|
||||
: WavesDialog (_("add_tracks_dialog.xml"), true, false)
|
||||
, _decrement_button (get_waves_button ("decrement_button"))
|
||||
, _increment_button (get_waves_button ("increment_button"))
|
||||
, _cancel_button (get_waves_button ("cancel_button"))
|
||||
, _ok_button (get_waves_button ("ok_button"))
|
||||
, _tracks_format_dropdown (get_waves_dropdown ("tracks_format_dropdown"))
|
||||
, _tracks_counter_entry (get_entry("tracks_counter_entry"))
|
||||
, _max_tracks_count (xml_property (*xml_tree ()->root (), "maxtrackscount", 256))
|
||||
|
||||
{
|
||||
populate_tracks_format_dropdown();
|
||||
_tracks_counter_entry.set_text("1");
|
||||
|
|
@ -85,55 +87,44 @@ AddTracksDialog::on_ok_button (WavesButton*)
|
|||
void
|
||||
AddTracksDialog::on_decrement_button (WavesButton*)
|
||||
{
|
||||
int track_count = count();
|
||||
unsigned int track_count = count();
|
||||
|
||||
if( track_count > 1 )
|
||||
{
|
||||
--track_count;
|
||||
set_track_count(track_count);
|
||||
} else
|
||||
{
|
||||
set_track_count(1);
|
||||
set_track_count ( track_count-1 );
|
||||
_tracks_counter_entry.set_position (-1); // set cursor at the last position
|
||||
}
|
||||
_tracks_counter_entry.set_position (-1); // set cursor at the last position
|
||||
}
|
||||
|
||||
void
|
||||
AddTracksDialog::on_increment_button (WavesButton*)
|
||||
{
|
||||
int track_count = count();
|
||||
unsigned int track_count = count();
|
||||
|
||||
if( 1<=track_count && track_count <= 256 )
|
||||
{
|
||||
++track_count;
|
||||
set_track_count(track_count);
|
||||
} else
|
||||
{
|
||||
set_track_count(1);
|
||||
if( track_count < _max_tracks_to_add ) {
|
||||
set_track_count (track_count + 1);
|
||||
_tracks_counter_entry.set_position (-1); // set cursor at the last position
|
||||
}
|
||||
|
||||
input_channels ();
|
||||
_tracks_counter_entry.set_position (-1); // set cursor at the last position
|
||||
}
|
||||
|
||||
int
|
||||
unsigned int
|
||||
AddTracksDialog::count ()
|
||||
{
|
||||
string str_track_count = _tracks_counter_entry.get_text();
|
||||
char * pEnd;
|
||||
int number = strtol( str_track_count.c_str(), &pEnd, 10 );
|
||||
number = number >= 0 ? number : 0;
|
||||
return number;
|
||||
return std::min (_max_tracks_to_add, (unsigned int)number);
|
||||
}
|
||||
|
||||
void
|
||||
AddTracksDialog::set_track_count (int track_count)
|
||||
AddTracksDialog::set_track_count (unsigned int track_count)
|
||||
{
|
||||
stringstream ss;
|
||||
ss << track_count;
|
||||
ss << std::min (track_count, _max_tracks_to_add);
|
||||
string str_track_count = ss.str();
|
||||
|
||||
_tracks_counter_entry.set_text(str_track_count);
|
||||
_tracks_counter_entry.set_text( str_track_count);
|
||||
}
|
||||
|
||||
ChanCount
|
||||
|
|
@ -154,8 +145,10 @@ AddTracksDialog::input_channels ()
|
|||
}
|
||||
|
||||
void
|
||||
AddTracksDialog::setup ()
|
||||
AddTracksDialog::setup (unsigned int max_tracks_to_add)
|
||||
{
|
||||
_max_tracks_to_add = max_tracks_to_add;
|
||||
|
||||
set_track_count(1);
|
||||
_tracks_format_dropdown.set_text(TrackFormat::FormatMono);
|
||||
}
|
||||
|
|
@ -33,10 +33,11 @@ class AddTracksDialog : public WavesDialog {
|
|||
public:
|
||||
|
||||
AddTracksDialog ();
|
||||
void setup();
|
||||
int count();
|
||||
void setup (unsigned int);
|
||||
unsigned int count();
|
||||
ARDOUR::ChanCount input_channels ();
|
||||
void on_show ();
|
||||
unsigned int max_tracks_count () const { return _max_tracks_count; }
|
||||
|
||||
private:
|
||||
WavesButton& _decrement_button;
|
||||
|
|
@ -47,6 +48,9 @@ private:
|
|||
WavesDropdown& _tracks_format_dropdown;
|
||||
Gtk::Entry& _tracks_counter_entry;
|
||||
|
||||
unsigned int _max_tracks_to_add;
|
||||
unsigned int _max_tracks_count; // Just a storage for usecase's limit
|
||||
|
||||
void populate_tracks_format_dropdown();
|
||||
|
||||
void on_cancel_button (WavesButton*);
|
||||
|
|
@ -54,7 +58,7 @@ private:
|
|||
void on_decrement_button (WavesButton*);
|
||||
void on_increment_button (WavesButton*);
|
||||
|
||||
void set_track_count(int track_count);
|
||||
void set_track_count(unsigned int track_count);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1077,7 +1077,7 @@ ARDOUR_UI::ask_about_saving_session (const vector<string>& actions)
|
|||
|
||||
if (_session->snap_name() == _session->name()) {
|
||||
prompt = string_compose(_("Do you want to save changes to \"%1\"?\n"), _session->snap_name());
|
||||
bottom_prompt = _("Changes will be lost if you choose \"don't save\"\n");
|
||||
bottom_prompt = _("Changes will be lost if you choose \"Don't Save\"\n");
|
||||
session_close_dialog.set_top_label (prompt);
|
||||
session_close_dialog.set_bottom_label (bottom_prompt);
|
||||
} else {
|
||||
|
|
@ -3701,9 +3701,15 @@ ARDOUR_UI::add_route (Gtk::Window* float_window)
|
|||
return;
|
||||
}
|
||||
|
||||
_add_tracks_dialog->setup();
|
||||
_add_tracks_dialog->set_position (WIN_POS_CENTER);
|
||||
int r = _add_tracks_dialog->run();
|
||||
unsigned int existing_tracks_count = _session->get_tracks ()->size ();
|
||||
if (existing_tracks_count >= _add_tracks_dialog->max_tracks_count ()) {
|
||||
WavesMessageDialog("", "Impossible to add more tracks!").run ();
|
||||
return;
|
||||
}
|
||||
|
||||
_add_tracks_dialog->setup(_add_tracks_dialog->max_tracks_count () - existing_tracks_count);
|
||||
_add_tracks_dialog->set_position (WIN_POS_CENTER);
|
||||
int r = _add_tracks_dialog->run();
|
||||
|
||||
switch (r) {
|
||||
case WavesDialog::RESPONSE_DEFAULT:
|
||||
|
|
@ -3789,6 +3795,11 @@ ARDOUR_UI::add_audio_track_instantly ()
|
|||
/* we're already doing this */
|
||||
return;
|
||||
}
|
||||
|
||||
if (_session->get_tracks ()->size () >= _add_tracks_dialog->max_tracks_count ()) {
|
||||
WavesMessageDialog("", "Impossible to add more tracks!").run ();
|
||||
return;
|
||||
}
|
||||
|
||||
_session->new_audio_track (1, 1, Normal, 0, 1, string() );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Dialog title="Add Track" resizeable="False">
|
||||
<Dialog title="Add Track"
|
||||
resizeable="false"
|
||||
maxtrackscount="256">
|
||||
<style name="generic_control"
|
||||
winfont ="Arial Bold 10"
|
||||
macfont ="Helvetica Bold 10"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue