Comments button now indicates when comments are present, more dialog work (ask about saving, comments box etc.), code cleanups in mixer_strip.cc.

git-svn-id: svn://localhost/trunk/ardour2@461 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Nick Mainsbridge 2006-04-20 20:41:05 +00:00
parent 17b18acda3
commit 2ce07f34e2
4 changed files with 107 additions and 58 deletions

View file

@ -436,15 +436,22 @@ int
ARDOUR_UI::ask_about_saving_session (const string & what)
{
ArdourDialog window (_("ardour: save session?"));
Gtk::HBox dhbox; // the hbox for the image and text
Gtk::Label prompt_label;
Gtk::Image* dimage = manage (new Gtk::Image(Stock::DIALOG_WARNING, Gtk::ICON_SIZE_DIALOG));
dimage->set_alignment(ALIGN_LEFT, ALIGN_TOP);
string msg;
msg = string_compose(_("Save and %1"), what);
window.add_button (msg, RESPONSE_ACCEPT);
msg = string_compose(_("Just %1"), what);
window.add_button (msg, RESPONSE_APPLY);
msg = string_compose(_("Don't %1"), what);
window.add_button (msg, RESPONSE_REJECT);
msg = string_compose(_("Just %1"), what);
window.add_button (msg, RESPONSE_APPLY);
msg = string_compose(_("Save and %1"), what);
window.add_button (msg, RESPONSE_ACCEPT);
window.set_default_response (RESPONSE_ACCEPT);
Gtk::Button noquit_button (msg);
noquit_button.set_name ("EditorGTKButton");
@ -461,14 +468,16 @@ ARDOUR_UI::ask_about_saving_session (const string & what)
type, session->snap_name());
prompt_label.set_text (prompt);
prompt_label.set_alignment (0.5, 0.5);
prompt_label.set_name (X_("PrompterLabel"));
window.get_vbox()->pack_start (prompt_label);
prompt_label.set_alignment(ALIGN_LEFT, ALIGN_TOP);
dhbox.pack_start (*dimage, true, false, 5);
dhbox.pack_start (prompt_label, true, false, 5);
window.get_vbox()->pack_start (dhbox);
window.set_name (_("Prompter"));
window.set_position (Gtk::WIN_POS_MOUSE);
window.set_modal (true);
window.set_resizable (false);
window.show_all ();
save_the_session = 0;
@ -1912,7 +1921,7 @@ ARDOUR_UI::display_cleanup_results (Session::cleanup_report& rep, const gchar* l
if (removed == 0) {
MessageDialog msgd (*editor,
_("No audio files were ready for cleanup"),
false,
true,
Gtk::MESSAGE_INFO,
(Gtk::ButtonsType)(Gtk::BUTTONS_CLOSE) );
msgd.set_secondary_text (_("If this seems suprising, \n\
@ -1924,7 +1933,7 @@ require some unused files to continue to exist."));
return;
}
ArdourDialog results (_("ardour: cleanup"), true, true);
ArdourDialog results (_("ardour: cleanup"), true, false);
struct CleanupResultsModelColumns : public Gtk::TreeModel::ColumnRecord {
CleanupResultsModelColumns() {
@ -1947,11 +1956,16 @@ require some unused files to continue to exist."));
results_display.set_name ("CleanupResultsList");
results_display.set_headers_visible (true);
results_display.set_headers_clickable (false);
results_display.set_reorderable (false);
Gtk::ScrolledWindow list_scroller;
Gtk::Label txt;
Gtk::VBox dvbox;
Gtk::HBox dhbox;
Gtk::HBox dhbox; // the hbox for the image and text
Gtk::HBox ddhbox; // the hbox we eventually pack into the dialog's vbox
Gtk::Image* dimage = manage (new Gtk::Image(Stock::DIALOG_INFO, Gtk::ICON_SIZE_DIALOG));
dimage->set_alignment(ALIGN_LEFT, ALIGN_TOP);
if (rep.space < 1048576.0f) {
if (removed > 1) {
@ -1967,7 +1981,8 @@ require some unused files to continue to exist."));
}
}
dvbox.pack_start (txt, true, false, 5);
dhbox.pack_start (*dimage, true, false, 5);
dhbox.pack_start (txt, true, false, 5);
for (vector<string>::iterator i = rep.paths.begin(); i != rep.paths.end(); ++i) {
TreeModel::Row row = *(results_model->append());
@ -1979,13 +1994,16 @@ require some unused files to continue to exist."));
list_scroller.set_size_request (-1, 150);
list_scroller.set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC);
dvbox.pack_start (list_scroller, true, false);
dhbox.pack_start (dvbox, true, false, 5);
results.get_vbox()->pack_start (dhbox, true, false);
dvbox.pack_start (dhbox, true, false, 5);
dvbox.pack_start (list_scroller, true, false, 5);
ddhbox.pack_start (dvbox, true, false, 5);
results.get_vbox()->pack_start (ddhbox, true, false, 5);
results.add_button (Stock::CLOSE, RESPONSE_CLOSE);
results.set_default_response (RESPONSE_CLOSE);
results.set_position (Gtk::WIN_POS_CENTER);
results.set_position (Gtk::WIN_POS_MOUSE);
results.show_all_children ();
results.set_resizable (false);
results.run ();
@ -2001,7 +2019,7 @@ ARDOUR_UI::cleanup ()
MessageDialog checker (_("Are you sure you want to cleanup?"),
false,
true,
Gtk::MESSAGE_QUESTION,
(Gtk::ButtonsType)(Gtk::BUTTONS_NONE));
@ -2016,7 +2034,7 @@ After cleanup, unused audio files will be moved to a \
checker.set_name (_("CleanupDialog"));
checker.set_wmclass (_("ardour_cleanup"), "Ardour");
checker.set_position (Gtk::WIN_POS_CENTER);
checker.set_position (Gtk::WIN_POS_MOUSE);
switch (checker.run()) {
case RESPONSE_ACCEPT:
@ -2037,8 +2055,10 @@ After cleanup, unused audio files will be moved to a \
_("cleaned files"),
_("\
The following %1 %2 not in use and \n\
have been moved to %3. \n\n\
Flushing the wastebasket will release an additional\n\
have been moved to:\n\
%3. \n\n\
Flushing the wastebasket will \n\
release an additional\n\
%4 %5bytes of disk space.\n"
));
}
@ -2060,8 +2080,8 @@ ARDOUR_UI::flush_trash ()
display_cleanup_results (rep,
_("deleted file"),
_("The following %1 %2 deleted from\n\
%3,releasing \n\
%4 %5bytes of disk space"));
%3,\n\
releasing %4 %5bytes of disk space"));
}
void

View file

@ -149,7 +149,7 @@ int
ARDOUR_UI::unload_session ()
{
if (session && session->dirty()) {
switch (ask_about_saving_session (_("close session"))) {
switch (ask_about_saving_session (_("close"))) {
case -1:
return 1;

View file

@ -92,7 +92,7 @@ MixerStrip::MixerStrip (Mixer_UI& mx, Session& sess, Route& rt, bool in_mixer)
gain_automation_state_button (""),
pan_automation_style_button (""),
pan_automation_state_button (""),
comment_button (_("comments")),
comment_button (_("Comments")),
speed_adjustment (1.0, 0.001, 4.0, 0.001, 0.1),
speed_spinner (&speed_adjustment, "MixerStripSpeedBase", true)
@ -239,9 +239,11 @@ MixerStrip::MixerStrip (Mixer_UI& mx, Session& sess, Route& rt, bool in_mixer)
group_label.set_name ("MixerGroupButtonLabel");
comment_button.set_name ("MixerCommentButton");
ARDOUR_UI::instance()->tooltips().set_tip (comment_button, _route.comment()=="" ?
_("click to add/edit comments"):
_("Click to Add/Edit Comments"):
_route.comment());
comment_button.signal_clicked().connect (mem_fun(*this, &MixerStrip::comment_button_clicked));
global_vpacker.set_border_width (0);
@ -430,14 +432,20 @@ MixerStrip::set_width (Width w)
set_size_request (-1, -1);
xml_node->add_property ("strip_width", "wide");
static_cast<Gtk::Label*> (rec_enable_button->get_child())->set_text (_("RECORD"));
static_cast<Gtk::Label*> (mute_button->get_child())->set_text (_("mute"));
static_cast<Gtk::Label*> (solo_button->get_child())->set_text (_("solo"));
static_cast<Gtk::Label*> (comment_button.get_child())->set_text (_("comments"));
static_cast<Gtk::Label*> (gain_automation_style_button.get_child())->set_text (astyle_string(_route.gain_automation_curve().automation_style()));
static_cast<Gtk::Label*> (gain_automation_state_button.get_child())->set_text (astate_string(_route.gain_automation_curve().automation_state()));
static_cast<Gtk::Label*> (pan_automation_style_button.get_child())->set_text (astyle_string(_route.panner().automation_style()));
static_cast<Gtk::Label*> (pan_automation_state_button.get_child())->set_text (astate_string(_route.panner().automation_state()));
rec_enable_button->set_label (_("RECORD"));
mute_button->set_label (_("mute"));
solo_button->set_label (_("solo"));
if (_route.comment() == "") {
comment_button.set_label (_("Comments"));
} else {
comment_button.set_label (_("*Comments*"));
}
gain_automation_style_button.set_label (astyle_string(_route.gain_automation_curve().automation_style()));
gain_automation_state_button.set_label (astate_string(_route.gain_automation_curve().automation_state()));
pan_automation_style_button.set_label (astyle_string(_route.panner().automation_style()));
pan_automation_state_button.set_label (astate_string(_route.panner().automation_state()));
Gtkmm2ext::set_size_request_to_display_given_text (name_button, "long", 2, 2);
break;
@ -445,14 +453,20 @@ MixerStrip::set_width (Width w)
set_size_request (50, -1);
xml_node->add_property ("strip_width", "narrow");
static_cast<Gtk::Label*> (rec_enable_button->get_child())->set_text (_("REC"));
static_cast<Gtk::Label*> (mute_button->get_child())->set_text (_("m"));
static_cast<Gtk::Label*> (solo_button->get_child())->set_text (_("s"));
static_cast<Gtk::Label*> (comment_button.get_child())->set_text (_("cmt"));
static_cast<Gtk::Label*> (gain_automation_style_button.get_child())->set_text (short_astyle_string(_route.gain_automation_curve().automation_style()));
static_cast<Gtk::Label*> (gain_automation_state_button.get_child())->set_text (short_astate_string(_route.gain_automation_curve().automation_state()));
static_cast<Gtk::Label*> (pan_automation_style_button.get_child())->set_text (short_astyle_string(_route.panner().automation_style()));
static_cast<Gtk::Label*> (pan_automation_state_button.get_child())->set_text (short_astate_string(_route.panner().automation_state()));
rec_enable_button->set_label (_("REC"));
mute_button->set_label (_("m"));
solo_button->set_label (_("s"));
if (_route.comment() == "") {
comment_button.set_label (_("Cmt"));
} else {
comment_button.set_label (_("*Cmt*"));
}
gain_automation_style_button.set_label (short_astyle_string(_route.gain_automation_curve().automation_style()));
gain_automation_state_button.set_label (short_astate_string(_route.gain_automation_curve().automation_state()));
pan_automation_style_button.set_label (short_astyle_string(_route.panner().automation_style()));
pan_automation_state_button.set_label (short_astate_string(_route.panner().automation_state()));
Gtkmm2ext::set_size_request_to_display_given_text (name_button, "longest label", 2, 2);
break;
}
@ -461,6 +475,7 @@ MixerStrip::set_width (Width w)
update_output_display ();
mix_group_changed (0);
name_changed (0);
}
void
@ -1040,23 +1055,37 @@ MixerStrip::comment_button_clicked ()
}
comment_window->set_position (Gtk::WIN_POS_MOUSE);
comment_window->show_all ();
comment_window->show();
comment_window->present();
ResponseType response = (ResponseType) comment_window->run();
comment_window->hide ();
switch (response) {
case RESPONSE_ACCEPT:
break;
default:
return;
}
comment_window->run(); // we don't care what the response is
comment_window->hide();
string str = comment_area->get_buffer()->get_text();
_route.set_comment (str, this);
ARDOUR_UI::instance()->tooltips().set_tip (comment_button,
str.empty() ? _("click to add/edit comments") : str);
if (_route.comment() != str) {
_route.set_comment (str, this);
switch (_width) {
case Wide:
if (! str.empty()) {
comment_button.set_label (_("*Comments*"));
} else {
comment_button.set_label (_("Comments"));
}
break;
case Narrow:
if (! str.empty()) {
comment_button.set_label (_("*Cmt*"));
} else {
comment_button.set_label (_("Cmt"));
}
break;
}
ARDOUR_UI::instance()->tooltips().set_tip (comment_button,
str.empty() ? _("Click to Add/Edit Comments") : str);
}
}
void
@ -1072,12 +1101,11 @@ MixerStrip::setup_comment_editor ()
comment_area->set_name ("MixerTrackCommentArea");
comment_area->set_editable (true);
comment_area->get_buffer()->set_text (_route.comment());
comment_area->set_size_request (200,100);
comment_area->set_size_request (200,124);
comment_area->show ();
comment_window->get_vbox()->pack_start (*comment_area);
comment_window->add_button (Stock::CANCEL, RESPONSE_CANCEL);
comment_window->add_button (Stock::OK, RESPONSE_ACCEPT);
comment_window->get_action_area()->hide();
}
void

View file

@ -40,7 +40,7 @@ Choice::Choice (string prompt, vector<string> choices, bool center)
set_name ("ChoiceWindow");
HBox* dhbox = manage (new HBox());
Image* dimage = manage (new Gtk::Image(Stock::DIALOG_QUESTION, Gtk::ICON_SIZE_DIALOG));
Image* dimage = manage (new Gtk::Image(Stock::DIALOG_QUESTION, Gtk::ICON_SIZE_DIALOG));
Label* label = manage (new Label (prompt));
dhbox->pack_start (*dimage, true, false, 10);
@ -50,6 +50,7 @@ Choice::Choice (string prompt, vector<string> choices, bool center)
get_vbox()->pack_start (*dhbox, true, false);
set_has_separator (false);
set_resizable (false);
show_all_children ();
for (n = 0, i = choices.begin(); i != choices.end(); ++i, ++n) {