[Summary] XML-ized version of the missing file dialog.

This commit is contained in:
VKamyshniy 2015-02-12 13:21:32 +02:00
parent 4eaac75259
commit 4b5392ccf9
8 changed files with 372 additions and 13 deletions

View file

@ -113,7 +113,7 @@ typedef uint64_t microseconds_t;
#include "keyeditor.h"
#include "location_ui.h"
#include "main_clock.h"
#include "missing_file_dialog.h"
#include "waves_missing_file_dialog.h"
#include "missing_plugin_dialog.h"
#include "mixer_ui.h"
#include "mouse_cursors.h"
@ -4642,13 +4642,10 @@ ARDOUR_UI::setup_profile ()
int
ARDOUR_UI::missing_file (Session*s, std::string str, DataType type)
{
MissingFileDialog dialog (s, str, type);
dialog.show ();
dialog.present ();
WavesMissingFileDialog dialog (s, str, type);
ARDOUR_UI::instance()->_progress_dialog.hide (); // HOT FIX. (REWORK IT)
int result = dialog.run ();
dialog.hide ();
ARDOUR_UI::instance()->_progress_dialog.show (); // HOT FIX. (REWORK IT)
switch (result) {
case RESPONSE_OK:

View file

@ -0,0 +1,131 @@
<?xml version="1.0" encoding="UTF-8"?>
<Dialog title="Tracks Live - Missing File"
CACHEIT="false">
<style name="generic_control"
winfont ="Arial Bold 10"
macfont ="Helvetica Bold 10"
fgnormal="#6F6F6F"
bgnormal="#6C6C6C"
fgactive="#BFBFBF"
bgactive="#454545"/>
<style name="generic_label"
style="generic_control"
box.expand="true"
box.fill="true"
horzalignment="end"/>
<style name="generic_button"
style="generic_control"
bgnormal="#CACAC5"
fgactive="#EDECE8"
bgactive="#6D6E72"
width="80"
height="22"/>
<style name="generic_dropdown"
style="generic_button"
fgnormal="#C1C1C1"
textcolornormal="#C1C1C1"
bgnormal="#6C6C6C"
normalicon="dropdown_126x20"
activeicon="dropdown_126x20_active"
inactiveicon="dropdown_126x20_inactive"
width="126"
height="20"
horzalignment="start"/>
<EventBox bgnormal="#EDECE8">
<VBox borderwidth="10">
<HBox>
<Label style="generic_control"
text="Tracks Live cannot find the "
vertalignment="top"/>
<Label id="file_type_label"
style="generic_control"
vertalignment="top"/>
<Label style="generic_control"
text=" file\n"
vertalignment="top"/>
</HBox>
<Label id="file_name_label"
style="generic_control"
text="some_file.some_ext"
horzalignment="start"/>
<Label style="generic_control"
text="\nin any of these folders:\n"
horzalignment="start"/>
<Label id="folder_path_label"
style="generic_control"
text="/some/path/some/location/etc/..."
horzalignment="start"/>
<VBox spacing="10">
<IconButton id="add_folder_button"
text="Add chosen folder to search path, and try again"
height="14"
normalicon="waves_darker_radio_button"
activeicon="waves_darker_radio_button_active"
toggleable="true"
state="active">
<HBox>
<VBox width="20"/>
<Label style="generic_control"/>
</HBox>
</IconButton>
<IconButton id="skip_file_button"
text="Skip this file"
width="24"
height="14"
normalicon="waves_darker_radio_button"
activeicon="waves_darker_radio_button_active"
toggleable="true">
<HBox>
<VBox width="20"/>
<Label style="generic_control"/>
</HBox>
</IconButton>
<IconButton id="skip_all_files_button"
text="Skip all missing files"
width="24"
height="14"
normalicon="waves_darker_radio_button"
activeicon="waves_darker_radio_button_active"
toggleable="true">
<HBox>
<VBox width="20"/>
<Label style="generic_control"/>
</HBox>
</IconButton>
<IconButton id="stop_loading_button"
text="Stop loading this session"
width="24"
height="14"
normalicon="waves_darker_radio_button"
activeicon="waves_darker_radio_button_active"
toggleable="true">
<HBox>
<VBox width="20"/>
<Label style="generic_control"/>
</HBox>
</IconButton>
<VBox spacing="10">
<Label style="generic_control"
text="Additional folder to search:"
horzalignment="start"/>
<HBox spacing="5">
<Label id="additional_folder_path_label"
style="generic_control"
text=""
horzalignment="start"/>
<Button id="browse_button"
style="generic_button"
box.pack="end"
text="Browse"/>
</HBox>
<HBox>
<Button id="done_button"
style="generic_button"
box.pack="end"
text="Done"/>
</HBox>
</VBox>
</VBox>
</VBox>
</EventBox>
</Dialog>

View file

@ -92,7 +92,17 @@ WavesDialog::WavesDialog (const std::string& layout_script_file, bool modal, boo
bool resizeable = xml_property (*root, "resizeable", false);
set_resizable(resizeable);
set_position (Gtk::WIN_POS_MOUSE);
std::string position = (xml_property (*xml_tree ()->root (), "ui.position", "center"));
if (position == "center") {
set_position (Gtk::WIN_POS_CENTER);
} else if (position == "mouse") {
set_position (Gtk::WIN_POS_MOUSE);
} else if (position == "centeronparent") {
set_position (Gtk::WIN_POS_CENTER_ON_PARENT);
}
double opacity = xml_property (*xml_tree ()->root (), "ui.opacity", 1.0);
set_opacity (opacity);
}
WavesDialog::~WavesDialog ()

View file

@ -63,11 +63,8 @@ WavesIconButton::render (cairo_t* cr, cairo_rectangle_t*)
// pixbuf, if any
if (pixbuf) {
double x = (get_width() - pixbuf->get_width())/2.0;
double y = (get_height() - pixbuf->get_height())/2.0;
cairo_rectangle (cr, x, y, pixbuf->get_width(), pixbuf->get_height());
gdk_cairo_set_source_pixbuf (cr, pixbuf->gobj(), x, y);
cairo_rectangle (cr, 0, 0, pixbuf->get_width(), pixbuf->get_height());
gdk_cairo_set_source_pixbuf (cr, pixbuf->gobj(), 0, 0);
cairo_fill (cr);
}
}

View file

@ -0,0 +1,158 @@
/*
Copyright (C) 2005-2006 Paul 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.
*/
#include "pbd/compose.h"
#include "pbd/replace_all.h"
#include "pbd/strsplit.h"
#include "pbd/search_path.h"
#include "ardour/session.h"
#include "ardour/rc_configuration.h"
#include "open_file_dialog_proxy.h"
#include "waves_missing_file_dialog.h"
#include "i18n.h"
WavesMissingFileDialog::WavesMissingFileDialog (ARDOUR::Session* session, const std::string& path, ARDOUR::DataType filetype)
: WavesDialog ("waves_missing_file_dialog.xml", true, false )
, _filetype (filetype)
, _additional_folder_name (Glib::get_home_dir())
, _add_folder_button (get_waves_button ("add_folder_button"))
, _skip_file_button (get_waves_button ("skip_file_button"))
, _skip_all_files_button (get_waves_button ("skip_all_files_button"))
, _stop_loading_button (get_waves_button ("stop_loading_button"))
, _browse_button (get_waves_button ("browse_button"))
, _done_button (get_waves_button ("done_button"))
{
set_session (session);
std::string typestr;
switch (_filetype) {
case ARDOUR::DataType::AUDIO:
typestr = _("audio");
break;
case ARDOUR::DataType::MIDI:
typestr = _("MIDI");
break;
}
std::vector<std::string> source_dirs = _session->source_search_path (_filetype);
std::vector<std::string>::iterator i = source_dirs.begin();
std::ostringstream oss;
oss << *i << std::endl;
while (++i != source_dirs.end()) {
oss << *i << std::endl;
}
get_label ("file_type_label").set_text (typestr);
get_label ("file_name_label").set_text (path);
get_label ("folder_path_label").set_text (oss.str());
get_label ("additional_folder_path_label").set_text (_additional_folder_name);
_add_folder_button.signal_clicked.connect (sigc::mem_fun (*this, &WavesMissingFileDialog::_on_option_button));
_skip_file_button.signal_clicked.connect (sigc::mem_fun (*this, &WavesMissingFileDialog::_on_option_button));
_skip_all_files_button.signal_clicked.connect (sigc::mem_fun (*this, &WavesMissingFileDialog::_on_option_button));
_stop_loading_button.signal_clicked.connect (sigc::mem_fun (*this, &WavesMissingFileDialog::_on_option_button));
_browse_button.signal_clicked.connect (sigc::mem_fun (*this, &WavesMissingFileDialog::_on_browse_button));
_done_button.signal_clicked.connect (sigc::mem_fun (*this, &WavesMissingFileDialog::_on_done_button));
}
int
WavesMissingFileDialog::get_action ()
{
if (_add_folder_button.active_state () == Gtkmm2ext::ExplicitActive) {
_add_chosen ();
return 0;
}
if (_skip_file_button.active_state () == Gtkmm2ext::ExplicitActive) {
return -1;
}
if (_skip_all_files_button.active_state () == Gtkmm2ext::ExplicitActive) {
return 3;
}
return 1;
}
void
WavesMissingFileDialog::_add_chosen ()
{
std::string str;
std::string newdir;
std::vector<std::string> dirs;
switch (_filetype) {
case ARDOUR::DataType::AUDIO:
str = _session->config.get_audio_search_path ();
break;
case ARDOUR::DataType::MIDI:
str = _session->config.get_midi_search_path ();
break;
}
split (str, dirs, G_SEARCHPATH_SEPARATOR);
for (std::vector<std::string>::iterator d = dirs.begin(); d != dirs.end(); d++) {
if (*d == _additional_folder_name) {
return;
}
}
if (!str.empty()) {
str += G_SEARCHPATH_SEPARATOR;
}
str += _additional_folder_name;
switch (_filetype) {
case ARDOUR::DataType::AUDIO:
_session->config.set_audio_search_path (str);
break;
case ARDOUR::DataType::MIDI:
_session->config.set_midi_search_path (str);
break;
}
}
void
WavesMissingFileDialog::_on_option_button (WavesButton* button)
{
_add_folder_button.set_active_state ((button == &_add_folder_button) ? Gtkmm2ext::ExplicitActive : Gtkmm2ext::Off);
_skip_file_button.set_active_state ((button == &_skip_file_button) ? Gtkmm2ext::ExplicitActive : Gtkmm2ext::Off);
_skip_all_files_button.set_active_state ((button == &_skip_all_files_button) ? Gtkmm2ext::ExplicitActive : Gtkmm2ext::Off);
_stop_loading_button.set_active_state ((button == &_stop_loading_button) ? Gtkmm2ext::ExplicitActive : Gtkmm2ext::Off);
}
void
WavesMissingFileDialog::_on_browse_button (WavesButton*)
{
std::string folder = ARDOUR::choose_folder_dialog (ARDOUR::Config->get_default_session_parent_dir(), _("Select a folder to search"));
if (!folder.empty ()) {
_additional_folder_name = folder;
get_label ("additional_folder_path_label").set_text (_additional_folder_name);
}
}
void
WavesMissingFileDialog::_on_done_button (WavesButton*)
{
response (Gtk::RESPONSE_OK);
}

View file

@ -0,0 +1,57 @@
/*
Copyright (C) 2005-2006 Paul 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_missing_file_dialog_h__
#define __waves_missing_file_dialog_h__
#include <string>
#include <vector>
#include <map>
#include <sigc++/signal.h>
#include "ardour/types.h"
#include "waves_dialog.h"
class WavesMissingFileDialog : public WavesDialog
{
public:
WavesMissingFileDialog (ARDOUR::Session*, const std::string&, ARDOUR::DataType);
int get_action();
protected:
private:
ARDOUR::DataType _filetype;
std::string _additional_folder_name;
WavesButton& _add_folder_button;
WavesButton& _skip_file_button;
WavesButton& _skip_all_files_button;
WavesButton& _stop_loading_button;
WavesButton& _browse_button;
WavesButton& _done_button;
void _add_chosen ();
void _on_option_button (WavesButton*);
void _on_browse_button (WavesButton*);
void _on_done_button (WavesButton*);
};
#endif // __waves_missing_file_dialog_h__

View file

@ -28,6 +28,7 @@ path_prefix = 'gtk2_ardour/'
gtk2_ardour_sources = [
'mixer_bridge_view.cc',
'waves_missing_file_dialog.cc',
'waves_import_dialog.cc',
'waves_export_dialog.cc',
'waves_export_channel_selector.cc',

View file

@ -1158,6 +1158,8 @@
<row><td>ISX_DEFAULTCOMPONENT825</td><td>{F16E55C9-FB63-4240-8B9C-29B3899E65F0}</td><td>FONTS</td><td>258</td><td/><td/><td>17</td><td/><td/><td/><td>/LogFile=</td><td>/LogFile=</td><td>/LogFile=</td><td>/LogFile=</td></row>
<row><td>ISX_DEFAULTCOMPONENT826</td><td>{0456382F-57DE-4325-8556-75E599FFA846}</td><td>FONTS</td><td>258</td><td/><td/><td>17</td><td/><td/><td/><td>/LogFile=</td><td>/LogFile=</td><td>/LogFile=</td><td>/LogFile=</td></row>
<row><td>ISX_DEFAULTCOMPONENT827</td><td>{8A55FBC9-9B0B-4D66-818A-CE2044B3C274}</td><td>TRACKS</td><td>258</td><td/><td/><td>17</td><td/><td/><td/><td>/LogFile=</td><td>/LogFile=</td><td>/LogFile=</td><td>/LogFile=</td></row>
<row><td>ISX_DEFAULTCOMPONENT828</td><td>{AA9E08C3-438C-4A0A-B73F-07DC42CD0669}</td><td>UI</td><td>258</td><td/><td/><td>17</td><td/><td/><td/><td>/LogFile=</td><td>/LogFile=</td><td>/LogFile=</td><td>/LogFile=</td></row>
<row><td>ISX_DEFAULTCOMPONENT829</td><td>{D86FD9FB-CF82-4318-99FC-1B4E3720A921}</td><td>UI</td><td>258</td><td/><td/><td>17</td><td/><td/><td/><td>/LogFile=</td><td>/LogFile=</td><td>/LogFile=</td><td>/LogFile=</td></row>
<row><td>ISX_DEFAULTCOMPONENT83</td><td>{3FA696A4-E586-407E-8624-E3AFE9DBCFA6}</td><td>PIXMAPS</td><td>258</td><td/><td/><td>17</td><td/><td/><td/><td>/LogFile=</td><td>/LogFile=</td><td>/LogFile=</td><td>/LogFile=</td></row>
<row><td>ISX_DEFAULTCOMPONENT84</td><td>{171F4C1F-B859-4228-9205-5C38FF3CF5B5}</td><td>PIXMAPS</td><td>258</td><td/><td/><td>17</td><td/><td/><td/><td>/LogFile=</td><td>/LogFile=</td><td>/LogFile=</td><td>/LogFile=</td></row>
<row><td>ISX_DEFAULTCOMPONENT85</td><td>{2CC2416F-B08C-4C57-B1B5-B4F007D9A97D}</td><td>PIXMAPS</td><td>258</td><td/><td/><td>17</td><td/><td/><td/><td>/LogFile=</td><td>/LogFile=</td><td>/LogFile=</td><td>/LogFile=</td></row>
@ -3699,6 +3701,8 @@
<row><td>AlwaysInstall</td><td>ISX_DEFAULTCOMPONENT825</td></row>
<row><td>AlwaysInstall</td><td>ISX_DEFAULTCOMPONENT826</td></row>
<row><td>AlwaysInstall</td><td>ISX_DEFAULTCOMPONENT827</td></row>
<row><td>AlwaysInstall</td><td>ISX_DEFAULTCOMPONENT828</td></row>
<row><td>AlwaysInstall</td><td>ISX_DEFAULTCOMPONENT829</td></row>
<row><td>AlwaysInstall</td><td>ISX_DEFAULTCOMPONENT83</td></row>
<row><td>AlwaysInstall</td><td>ISX_DEFAULTCOMPONENT84</td></row>
<row><td>AlwaysInstall</td><td>ISX_DEFAULTCOMPONENT85</td></row>
@ -4760,6 +4764,8 @@
<row><td>waves_how_to_import_dialog_2</td><td>ISX_DEFAULTCOMPONENT157</td><td>WAVES_~1.XML|waves_how_to_import_dialog_2.xml</td><td>0</td><td/><td/><td/><td>1</td><td>C:\WS\GIT\tracks_daw\tracks\gtk2_ardour\ui\waves_how_to_import_dialog_2.xml</td><td>1</td><td/></row>
<row><td>waves_import_dialog.xml</td><td>ISX_DEFAULTCOMPONENT158</td><td>WAVES_~1.XML|waves_import_dialog.xml</td><td>0</td><td/><td/><td/><td>1</td><td>C:\WS\GIT\tracks_daw\tracks\gtk2_ardour\ui\waves_import_dialog.xml</td><td>1</td><td/></row>
<row><td>waves_message_dialog.xml</td><td>ISX_DEFAULTCOMPONENT159</td><td>WAVES_~1.XML|waves_message_dialog.xml</td><td>0</td><td/><td/><td/><td>1</td><td>C:\WS\GIT\tracks_daw\tracks\gtk2_ardour\ui\waves_message_dialog.xml</td><td>1</td><td/></row>
<row><td>waves_missing_file_dialog.xm</td><td>ISX_DEFAULTCOMPONENT828</td><td>WAVES_~1.XML|waves_missing_file_dialog.xml</td><td>0</td><td/><td/><td/><td>1</td><td>C:\WS\GIT\tracks_daw\tracks\gtk2_ardour\ui\waves_missing_file_dialog.xml</td><td>1</td><td/></row>
<row><td>waves_numeric_edit_dialog.xm</td><td>ISX_DEFAULTCOMPONENT829</td><td>WAVES_~1.XML|waves_numeric_edit_dialog.xml</td><td>0</td><td/><td/><td/><td>1</td><td>C:\WS\GIT\tracks_daw\tracks\gtk2_ardour\ui\waves_numeric_edit_dialog.xml</td><td>1</td><td/></row>
<row><td>waves_port_export_channel_se</td><td>ISX_DEFAULTCOMPONENT409</td><td>WAVES_~1.XML|waves_port_export_channel_selector.xml</td><td>0</td><td/><td/><td/><td>1</td><td>C:\WS\GIT\tracks_daw\tracks\gtk2_ardour\ui\waves_port_export_channel_selector.xml</td><td>1</td><td/></row>
<row><td>waves_region_export_channel_</td><td>ISX_DEFAULTCOMPONENT410</td><td>WAVES_~1.XML|waves_region_export_channel_selector.xml</td><td>0</td><td/><td/><td/><td>1</td><td>C:\WS\GIT\tracks_daw\tracks\gtk2_ardour\ui\waves_region_export_channel_selector.xml</td><td>1</td><td/></row>
<row><td>waves_route_rename_dialog.xm</td><td>ISX_DEFAULTCOMPONENT411</td><td>WAVES_~1.XML|waves_route_rename_dialog.xml</td><td>0</td><td/><td/><td/><td>1</td><td>C:\WS\GIT\tracks_daw\tracks\gtk2_ardour\ui\waves_route_rename_dialog.xml</td><td>1</td><td/></row>
@ -5733,6 +5739,8 @@
<row><td>ISX_DEFAULTCOMPONENT825</td><td/><td/><td>_A90263C3_803D_4726_9D2F_4C0E649737B7_FILTER</td><td/><td/><td/><td/></row>
<row><td>ISX_DEFAULTCOMPONENT826</td><td/><td/><td>_986C59C1_954E_4D0E_A230_FB589A65940D_FILTER</td><td/><td/><td/><td/></row>
<row><td>ISX_DEFAULTCOMPONENT827</td><td/><td/><td>_BF9037D8_6764_40F1_9541_D93546785E87_FILTER</td><td/><td/><td/><td/></row>
<row><td>ISX_DEFAULTCOMPONENT828</td><td/><td/><td>_4DB2198B_D9DD_4192_B7B5_ECE740034B1C_FILTER</td><td/><td/><td/><td/></row>
<row><td>ISX_DEFAULTCOMPONENT829</td><td/><td/><td>_4186D9CB_693E_40C1_A55B_684F57E690EE_FILTER</td><td/><td/><td/><td/></row>
<row><td>ISX_DEFAULTCOMPONENT83</td><td/><td/><td>_15ED6A0E_5FE5_45B8_B3D2_EAFEFFC308A9_FILTER</td><td/><td/><td/><td/></row>
<row><td>ISX_DEFAULTCOMPONENT84</td><td/><td/><td>_7EDC8F54_7F12_4722_A553_D3218A57F9E9_FILTER</td><td/><td/><td/><td/></row>
<row><td>ISX_DEFAULTCOMPONENT85</td><td/><td/><td>_9DE256D6_C9BB_44B1_B3AF_6EE743985360_FILTER</td><td/><td/><td/><td/></row>