[Summary] Bug fix #46319 "Session name has cutted letters in save dialog if name is very long"

[Feature reviewed] MKosharnyy
[Reviewed] YPozdnyakov
This commit is contained in:
Nikolay 2015-02-10 13:56:46 +02:00
parent cada6ed65a
commit 29fc52a095
4 changed files with 104 additions and 105 deletions

View file

@ -1078,12 +1078,8 @@ 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");
session_close_dialog._top_label.set_text(prompt);
session_close_dialog._bottom_label.set_text(bottom_prompt);
session_close_dialog._bottom_label.set_alignment(ALIGN_CENTER);
session_close_dialog.set_top_label (prompt);
session_close_dialog.set_bottom_label (bottom_prompt);
} else {
prompt = string_compose(_("The snapshot \"%1\"\nhas not been saved.\n\nAny changes made this time\nwill be lost unless you save it.\n\nWhat do you want to do?"),
_session->snap_name());

View file

@ -1,10 +1,20 @@
//
// session_close_dialog.cpp
// Tracks
//
// Created by User on 6/12/14.
//
//
/*
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.
*/
#include "session_close_dialog.h"
@ -20,6 +30,7 @@
#include <gtkmm/filechooser.h>
#include "dbg_msg.h"
#include "utils.h"
#include "i18n.h"
@ -68,3 +79,16 @@ SessionCloseDialog::on_save (WavesButton*)
response (Gtk::RESPONSE_YES);
}
void
SessionCloseDialog::set_top_label (std::string message)
{
const size_t n_characters_in_line = 400 / 7; // 400 - size of the label, see session_close_dialog.xml, 7 - average width of the one character
_top_label.set_text ( ARDOUR_UI_UTILS::split_on_lines (message, n_characters_in_line) );
}
void
SessionCloseDialog::set_bottom_label (std::string message)
{
const size_t n_characters_in_line = 400 / 6; // 400 - size of the label, see session_close_dialog.xml, 6 - average width of the one character
_bottom_label.set_text ( ARDOUR_UI_UTILS::split_on_lines (message, n_characters_in_line) );
}

View file

@ -1,10 +1,20 @@
//
// session_close_dialog.h
// Tracks
//
// Created by User on 6/12/14.
//
//
/*
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.
*/
#ifndef __Tracks__session_close_dialog__
#define __Tracks__session_close_dialog__
@ -18,6 +28,8 @@ class SessionCloseDialog : public WavesDialog {
public:
SessionCloseDialog ();
void set_top_label (std::string message);
void set_bottom_label (std::string message);
private:
WavesButton& _cancel_button;
@ -28,7 +40,6 @@ private:
void on_dont_save(WavesButton*);
void on_save(WavesButton*);
public:
Gtk::Label& _top_label;
Gtk::Label& _bottom_label;
};

View file

@ -1,5 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Dialog title="Session Close" resizeable="False">
<Dialog title="Session Close"
resizeable="false"
CACHEIT="false">
<style name="generic_control"
winfont ="Arial Bold 12"
macfont ="Helvetica Bold 12"
@ -11,90 +13,56 @@
bghover="#898989"/>
<style name="generic_button"
style="generic_control"
fgnormal="#BFBFBF"
bgnormal="#6C6C6C"
fgactive="#BFBFBF"
bgactive="#454545"
winfont ="Arial Bold 10"
macfont ="Helvetica Bold 10"
fgnormal="#6D6E72"
bgnormal="#CACAC5"
fgactive="#EDECE8"
bgactive="#6D6E72"
fghover="#CCCCCC"
bghover="#898989"
fgdisabled ="#959595"
bordercolor="#7E7E7E"
borderwidth="1 1 0 0" />
<Layout width="400"
height="120"
bgnormal="#EDECE8">
<Label style ="generic_control"
id="top_label"
justify="center"
winfont ="Arial Bold 14"
macfont ="Helvetica Bold 14"
fgnormal="#6D6E72"
text="??\n??\n??\n??\n??"
x="20"
y="20"
width="360"
height="30"/>
<Label style ="generic_control"
id="bottom_label"
justify="center"
text="??\n??\n??\n??\n??"
winfont ="Arial Bold 12"
macfont ="Helvetica Bold 12"
fgnormal="#6D6E72"
x="20"
y="40"
width="360"
height="30"/>
<Button style="generic_button"
id="cancel_button"
text="Cancel"
x="10"
y="90"
width="80"
height="22"
winfont ="Arial Bold 10"
macfont ="Helvetica Bold 10"
fgnormal="#6D6E72"
bgnormal="#CACAC5"
fgactive="#EDECE8"
bgactive="#6D6E72"
borderwidth="0 0 0 0"
bordercolor="#6D6E72"/>
<Button style="generic_button"
id="dont_save_button"
text="Don't Save"
x="220"
y="90"
width="80"
height="22"
winfont ="Arial Bold 10"
macfont ="Helvetica Bold 10"
fgnormal="#6D6E72"
bgnormal="#CACAC5"
fgactive="#EDECE8"
bgactive="#6D6E72"
borderwidth="0 0 0 0"
bordercolor="#6D6E72"/>
<Button style="generic_button"
id="save_button"
text="Save"
x="310"
y="90"
width="80"
height="22"
winfont ="Arial Bold 10"
macfont ="Helvetica Bold 10"
fgnormal="#6D6E72"
bgnormal="#CACAC5"
fgactive="#EDECE8"
bgactive="#6D6E72"
borderwidth="0 0 0 0"
bordercolor="#6D6E72"/>
</Layout>
bordercolor="#6D6E72"
borderwidth="0 0 0 0"
width="80"
height="22"/>
<EventBox bgnormal="#EDECE8">
<VBox width="400">
<HBox height="20"/>
<Label style ="generic_control"
id="top_label"
justify="center"
winfont ="Arial Bold 14"
macfont ="Helvetica Bold 14"
fgnormal="#6D6E72"
text="info-1"/>
<Label style ="generic_control"
id="bottom_label"
justify="center"
text="info-2"
winfont ="Arial Bold 12"
macfont ="Helvetica Bold 12"
fgnormal="#6D6E72"/>
<HBox height="30"/>
<HBox box.expand="true">
<VBox width="10"/>
<HBox spacing="8"
width="380">
<Button style="generic_button"
id="cancel_button"
text="Cancel"
box.pack="start"/>
<Button style="generic_button"
id="save_button"
text="Save"
box.pack="end"/>
<Button style="generic_button"
id="dont_save_button"
text="Don't Save"
box.pack="end"/>
</HBox>
</HBox>
<HBox height="10"/>
</VBox>
</EventBox>
</Dialog>