[Summary] Bug fix #46320 "Duplicate dialog has old appearance."

[Feature reviewed] MKosharnyy
[Reviewed] VKamyshniy
This commit is contained in:
Nikolay 2015-02-11 19:37:08 +02:00
parent ed3ab5aa8c
commit 7cddcbb3e8
6 changed files with 344 additions and 32 deletions

View file

@ -125,6 +125,7 @@
#include "master_bus_ui.h"
#include "utils.h"
#include "verbose_cursor.h"
#include "waves_numeric_edit_dialog.h"
#include "i18n.h"
@ -3337,43 +3338,16 @@ Editor::duplicate_range (bool with_dialog)
if (with_dialog) {
ArdourDialog win (_("Duplicate"));
Label label (_("Number of duplications:"));
Adjustment adjustment (1.0, 1.0, 1000000.0, 1.0, 5.0);
SpinButton spinner (adjustment, 0.0, 1);
HBox hbox;
win.get_vbox()->set_spacing (12);
win.get_vbox()->pack_start (hbox);
hbox.set_border_width (6);
hbox.pack_start (label, PACK_EXPAND_PADDING, 12);
/* dialogs have ::add_action_widget() but that puts the spinner in the wrong
place, visually. so do this by hand.
*/
hbox.pack_start (spinner, PACK_EXPAND_PADDING, 12);
spinner.signal_activate().connect (sigc::bind (sigc::mem_fun (win, &ArdourDialog::response), RESPONSE_ACCEPT));
spinner.grab_focus();
hbox.show ();
label.show ();
spinner.show ();
win.add_button ("CANCEL", RESPONSE_CANCEL);
win.add_button (_("Duplicate"), RESPONSE_ACCEPT);
win.set_default_response (RESPONSE_ACCEPT);
spinner.grab_focus ();
switch (win.run ()) {
case RESPONSE_ACCEPT:
WavesNumericEditDialog dialog("");
switch (dialog.run ()) {
case WavesDialog::RESPONSE_DEFAULT:
break;
default:
return;
}
times = adjustment.get_value();
times = dialog.get_count ();
}
if ((current_mouse_mode() == Editing::MouseRange)) {

View file

@ -286,6 +286,8 @@
95A134DE1A0239080008E3D6 /* license_dialog.cc in Sources */ = {isa = PBXBuildFile; fileRef = 95A134DD1A0239080008E3D6 /* license_dialog.cc */; };
95D1C51F1A78ED2100BE28DB /* waves_edit_dialog.cc in Sources */ = {isa = PBXBuildFile; fileRef = 95D1C51E1A78ED2100BE28DB /* waves_edit_dialog.cc */; };
95D1C5211A78ED3A00BE28DB /* waves_edit_dialog.xml in Resources */ = {isa = PBXBuildFile; fileRef = 95D1C5201A78ED3A00BE28DB /* waves_edit_dialog.xml */; };
95D5D1371A8A514300407F98 /* waves_numeric_edit_dialog.cc in Sources */ = {isa = PBXBuildFile; fileRef = 95D5D1361A8A514300407F98 /* waves_numeric_edit_dialog.cc */; };
95D5D1391A8A514300407F98 /* waves_numeric_edit_dialog.xml in Resources */ = {isa = PBXBuildFile; fileRef = 95D5D1381A8A514300407F98 /* waves_numeric_edit_dialog.xml */; };
95D71D551A4C66F600DE5B3B /* waves_track_color_dialog.cc in Sources */ = {isa = PBXBuildFile; fileRef = 95D71D541A4C66F600DE5B3B /* waves_track_color_dialog.cc */; };
95D71D581A4C69AE00DE5B3B /* waves_track_color_dialog.logic.cc in Sources */ = {isa = PBXBuildFile; fileRef = 95D71D571A4C69AE00DE5B3B /* waves_track_color_dialog.logic.cc */; };
95D795E81A7BB40C00120A4F /* marker_inspector_dialog.xml in Resources */ = {isa = PBXBuildFile; fileRef = 95D795DB1A7BB40C00120A4F /* marker_inspector_dialog.xml */; };
@ -1182,6 +1184,9 @@
95D1C51A1A78ED1100BE28DB /* waves_edit_dialog.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = waves_edit_dialog.h; path = ../waves_edit_dialog.h; sourceTree = "<group>"; };
95D1C51E1A78ED2100BE28DB /* waves_edit_dialog.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = waves_edit_dialog.cc; path = ../waves_edit_dialog.cc; sourceTree = "<group>"; };
95D1C5201A78ED3A00BE28DB /* waves_edit_dialog.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = waves_edit_dialog.xml; sourceTree = "<group>"; };
95D5D1321A8A514300407F98 /* waves_numeric_edit_dialog.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = waves_numeric_edit_dialog.h; path = ../waves_numeric_edit_dialog.h; sourceTree = "<group>"; };
95D5D1361A8A514300407F98 /* waves_numeric_edit_dialog.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = waves_numeric_edit_dialog.cc; path = ../waves_numeric_edit_dialog.cc; sourceTree = "<group>"; };
95D5D1381A8A514300407F98 /* waves_numeric_edit_dialog.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = waves_numeric_edit_dialog.xml; sourceTree = "<group>"; };
95D71D501A4C66DF00DE5B3B /* waves_track_color_dialog.logic.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = waves_track_color_dialog.logic.h; path = ../waves_track_color_dialog.logic.h; sourceTree = "<group>"; };
95D71D541A4C66F600DE5B3B /* waves_track_color_dialog.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = waves_track_color_dialog.cc; path = ../waves_track_color_dialog.cc; sourceTree = "<group>"; };
95D71D561A4C697700DE5B3B /* waves_track_color_dialog.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = waves_track_color_dialog.h; path = ../waves_track_color_dialog.h; sourceTree = "<group>"; };
@ -1323,6 +1328,7 @@
43279040194EFF38003C9FEA /* source */ = {
isa = PBXGroup;
children = (
95D5D1361A8A514300407F98 /* waves_numeric_edit_dialog.cc */,
95D795FF1A7BB9E000120A4F /* floating_text_entry.cc */,
95D796001A7BB9E000120A4F /* marker_inspector_dialog.cc */,
95D796011A7BB9E000120A4F /* marker_inspector_dialog.logic.cc */,
@ -1941,6 +1947,7 @@
43279429194F0062003C9FEA /* ui */ = {
isa = PBXGroup;
children = (
95D5D1381A8A514300407F98 /* waves_numeric_edit_dialog.xml */,
956D3F891A851805004F328C /* waves_import_dialog.xml */,
95D795DB1A7BB40C00120A4F /* marker_inspector_dialog.xml */,
95D795DC1A7BB40C00120A4F /* progressing_dialog.xml */,
@ -2012,6 +2019,7 @@
43279480194F00CB003C9FEA /* headers */ = {
isa = PBXGroup;
children = (
95D5D1321A8A514300407F98 /* waves_numeric_edit_dialog.h */,
95D7961A1A7BBA4E00120A4F /* floating_text_entry.h */,
95D7961B1A7BBA4E00120A4F /* marker_inspector_dialog.h */,
95D7961C1A7BBA4E00120A4F /* marker_inspector_dialog.logic.h */,
@ -2581,6 +2589,7 @@
432793A8194F003A003C9FEA /* resize_right_cursor.png in Resources */,
432793A9194F003A003C9FEA /* resize_top_cursor.png in Resources */,
432793AA194F003A003C9FEA /* resize_top_left_cursor.png in Resources */,
95D5D1391A8A514300407F98 /* waves_numeric_edit_dialog.xml in Resources */,
432793AB194F003A003C9FEA /* resize_top_right_cursor.png in Resources */,
432793AC194F003A003C9FEA /* sae.png in Resources */,
432793AD194F003A003C9FEA /* sessionlock.png in Resources */,
@ -2786,6 +2795,7 @@
CE1C6DE01987A924006BDB03 /* master_bus_ui.cc in Sources */,
95D796101A7BB9E000120A4F /* waves_export_dialog.cc in Sources */,
954DCFBD1A0239DA00B7160E /* about_dialog.cc in Sources */,
95D5D1371A8A514300407F98 /* waves_numeric_edit_dialog.cc in Sources */,
CE1A907A199A37AE00ECA62B /* add_tracks_dialog.cc in Sources */,
95176F7A1A08E6E800E32046 /* file_sample_rate_mismatch_dialog.cc in Sources */,
95D7960D1A7BB9E000120A4F /* marker_inspector_dialog.logic.cc in Sources */,

View file

@ -0,0 +1,83 @@
<?xml version="1.0" encoding="UTF-8"?>
<Dialog CACHEIT="false"
title="Tracks Live"
mincount="1"
maxcount="200"
errormsg="Incorrect value. Please input value between 1 and 200.">
<style name="generic_control"
winfont ="Arial Bold 12"
macfont ="Helvetica Bold 12"
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"/>
<EventBox bgnormal="#EDECE8">
<VBox borderwidth="10"
spacing="15">
<Label id="top_label"
style="generic_control"
text="Duplicate"
fgnormal="#6D6E72"
horzalignment="center"
justify="center"/>
<HBox>
<Label id="bottom_label"
style="generic_control"
text="Number of duplication: "/>
<Entry id="numeric_entry"
hasframe="false"
bgnormal="#6C6C6C"
basenormal="#6C6C6C"
fgnormal="#C1C1C1"
textcolornormal="#C1C1C1"
text="1"
height="22"
width="40"
horzalignment="start"/>
<VBox>
<iconbutton id="inc_button"
width="12"
height="11"
normalicon="spin_up_12x11"
activeicon="spin_up_12x11_inactive"
inactiveicon="spin_up_12x11_inactive"/>
<iconbutton id="dec_button"
width="12"
height="11"
normalicon="spin_down_12x11"
activeicon="spin_down_12x11_inactive"
inactiveicon="spin_down_12x11_inactive"/>
</VBox>
</HBox>
<HBox spacing="10">
<Button id="ok_button"
style="generic_button"
box.pack="end"
text="Duplicate"
visible="true"/>
<Button id="cancel_button"
style="generic_button"
box.pack="end"
text="Cancel"
visible="true"/>
</HBox>
</VBox>
</EventBox>
</Dialog>

View file

@ -0,0 +1,183 @@
/*
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 "waves_numeric_edit_dialog.h"
#include "waves_message_dialog.h"
#include "i18n.h"
WavesNumericEditDialog::WavesNumericEditDialog(const std::string& layout_script_file,
const std::string& title)
: WavesDialog (layout_script_file, true, false )
, _ok_button (get_waves_button ("ok_button"))
, _cancel_button (get_waves_button ("cancel_button"))
, _inc_button (get_waves_button("inc_button"))
, _dec_button (get_waves_button("dec_button"))
, _top_label (get_label("top_label"))
, _bottom_label (get_label("bottom_label"))
, _numeric_entry (get_entry("numeric_entry"))
, _min_count (xml_property (*xml_tree ()->root (), "mincount", 0))
, _max_count (xml_property (*xml_tree ()->root (), "maxcount", 10000))
{
init (title);
}
WavesNumericEditDialog::WavesNumericEditDialog (const std::string& title)
: WavesDialog ("waves_numeric_edit_dialog.xml", true, false )
, _ok_button (get_waves_button ("ok_button"))
, _cancel_button (get_waves_button ("cancel_button"))
, _inc_button (get_waves_button("inc_button"))
, _dec_button (get_waves_button("dec_button"))
, _top_label (get_label("top_label"))
, _bottom_label (get_label("bottom_label"))
, _numeric_entry (get_entry("numeric_entry"))
, _min_count (xml_property (*xml_tree ()->root (), "mincount", 0))
, _max_count (xml_property (*xml_tree ()->root (), "maxcount", 10000))
{
init (title);
}
void
WavesNumericEditDialog::init(const std::string& title)
{
set_modal (true);
set_resizable (false);
set_keep_above (true);
_ok_button.signal_clicked.connect (sigc::mem_fun (*this, &WavesNumericEditDialog::on_button_clicked));
_cancel_button.signal_clicked.connect (sigc::mem_fun (*this, &WavesNumericEditDialog::on_button_clicked));
set_count (1);
_numeric_entry.select_region (0, -1);
_numeric_entry.grab_focus();
_inc_button.signal_clicked.connect (sigc::mem_fun (*this, &WavesNumericEditDialog::on_inc_button_clicked));
_dec_button.signal_clicked.connect (sigc::mem_fun (*this, &WavesNumericEditDialog::on_dec_button_clicked));
set_title (title);
show_all ();
}
void
WavesNumericEditDialog::on_button_clicked (WavesButton* clicked_button)
{
if (clicked_button == &_ok_button) {
if ( value_accepted() )
response (WavesDialog::RESPONSE_DEFAULT);
else
return;
} else if (clicked_button == &_cancel_button) {
response (Gtk::RESPONSE_CANCEL);
}
hide ();
}
int
WavesNumericEditDialog::get_count ()
{
int entry_value = (int) PBD::atoi(_numeric_entry.get_text());
entry_value = std::max (entry_value, _min_count);
entry_value = std::min (entry_value, _max_count);
return entry_value;
}
void
WavesNumericEditDialog::set_count (int counter)
{
if ( counter < _min_count || counter > _max_count )
return;
_numeric_entry.set_text (string_compose ("%1", counter));
_dec_button.set_sensitive (counter > _min_count);
_inc_button.set_sensitive (counter < _max_count);
}
void
WavesNumericEditDialog::on_inc_button_clicked (WavesButton*)
{
int counter = get_count ();
set_count (counter + 1);
_numeric_entry.select_region (0, -1);
}
void
WavesNumericEditDialog::on_dec_button_clicked (WavesButton*)
{
int counter = get_count ();
set_count (counter - 1);
_numeric_entry.select_region (0, -1);
}
void
WavesNumericEditDialog::set_top_label (std::string message)
{
_top_label.set_text (message);
}
void
WavesNumericEditDialog::set_bottom_label (std::string message)
{
_bottom_label.set_text (message);
}
bool
WavesNumericEditDialog::on_key_press_event (GdkEventKey* ev)
{
switch (ev->keyval)
{
case GDK_Return:
case GDK_KP_Enter:
if ( value_accepted () ) {
hide ();
response (WavesDialog::RESPONSE_DEFAULT);
}
return true;
case GDK_Escape:
hide ();
response (Gtk::RESPONSE_CANCEL);
return true;
}
return Gtk::Dialog::on_key_press_event (ev);
}
bool
WavesNumericEditDialog::value_accepted ()
{
int entered_value = (int) PBD::atoi(_numeric_entry.get_text());
if ( entered_value < _min_count || entered_value > _max_count ) {
std::string error_msg = xml_property (*xml_tree ()->root (), "errormsg", "");
if (error_msg.empty ()) {
error_msg = string_compose("Incorrect value. Please input value between %1 and %2.", _min_count, _max_count);
}
WavesMessageDialog dialog ("Error", error_msg);
dialog.run ();
_numeric_entry.select_region (0, -1);
return false;
}
return true;
}

View file

@ -0,0 +1,61 @@
/*
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 __waves_numeric_edit_dialog_h__
#define __waves_numeric_edit_dialog_h__
#include "waves_dialog.h"
class WavesNumericEditDialog : public WavesDialog
{
public:
WavesNumericEditDialog(const std::string& layout_script_file,
const std::string& title);
WavesNumericEditDialog(const std::string& title);
bool on_key_press_event (GdkEventKey*);
void set_top_label (std::string message);
void set_bottom_label (std::string message);
void set_count (int);
int get_count ();
protected:
void init (const std::string& title);
private:
void on_button_clicked (WavesButton*);
void on_inc_button_clicked (WavesButton*);
void on_dec_button_clicked (WavesButton*);
bool value_accepted ();
WavesButton& _ok_button;
WavesButton& _cancel_button;
WavesButton& _inc_button;
WavesButton& _dec_button;
Gtk::Label& _top_label;
Gtk::Label& _bottom_label;
Gtk::Entry& _numeric_entry;
int _min_count;
int _max_count;
};
#endif /* __waves_numeric_edit_dialog_h__ */

View file

@ -47,6 +47,7 @@ gtk2_ardour_sources = [
'waves_ui.cc',
'waves_grid.cc',
'waves_edit_dialog.cc',
'waves_numeric_edit_dialog.cc',
'about_dialog.cc',
'actions.cc',
'add_route_dialog.cc',