summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTaybin Rutkin <taybin@taybin.com>2006-01-13 19:48:55 +0000
committerTaybin Rutkin <taybin@taybin.com>2006-01-13 19:48:55 +0000
commit6817b59169b2c334245f8018d7e3f2235e195aa0 (patch)
tree030f9138e15dbae4d033083c3e5b89a41367345c
parentf5aef674d3c7a6541932be6e835d4e35f4be7920 (diff)
Moved strip_whitespace_edges() to pbd/whitespace.h
Gtkmm2ext::Prompter::get_result() calls strip_whitespace_edges(), so you don't have to. Removed unused/unecessary/forgotten headers from libpbd. git-svn-id: svn://localhost/trunk/ardour2@270 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r--gtk2_ardour/audio_time_axis.cc55
-rw-r--r--gtk2_ardour/connection_editor.cc2
-rw-r--r--gtk2_ardour/editor_edit_groups.cc2
-rw-r--r--gtk2_ardour/editor_mouse.cc2
-rw-r--r--gtk2_ardour/editor_selection_list.cc2
-rw-r--r--gtk2_ardour/main.cc2
-rw-r--r--gtk2_ardour/mixer_ui.cc2
-rw-r--r--gtk2_ardour/option_editor.cc2
-rw-r--r--gtk2_ardour/prompter.cc3
-rw-r--r--gtk2_ardour/route_ui.cc7
-rw-r--r--gtk2_ardour/sfdb_ui.cc24
-rw-r--r--gtk2_ardour/utils.cc26
-rw-r--r--gtk2_ardour/utils.h1
-rw-r--r--gtk2_ardour/visual_time_axis.cc3
-rw-r--r--libs/gtkmm2ext/gtkmm2ext/bindable_button.h6
-rw-r--r--libs/gtkmm2ext/gtkmm2ext/prompter.h2
-rw-r--r--libs/gtkmm2ext/prompter.cc8
-rw-r--r--libs/pbd3/SConscript4
-rw-r--r--libs/pbd3/ftw.cc220
-rw-r--r--libs/pbd3/pbd/ftw.h106
-rw-r--r--libs/pbd3/pbd/irix_platform.h20
-rw-r--r--libs/pbd3/pbd/linux_platform.h41
-rw-r--r--libs/pbd3/pbd/platform.h45
-rw-r--r--libs/pbd3/pbd/platform_factory.h12
-rw-r--r--libs/pbd3/pbd/solaris_platform.h41
-rw-r--r--libs/pbd3/pbd/strsub.h25
-rw-r--r--libs/pbd3/pbd/whitespace.h8
-rw-r--r--libs/pbd3/whitespace.cc30
28 files changed, 111 insertions, 590 deletions
diff --git a/gtk2_ardour/audio_time_axis.cc b/gtk2_ardour/audio_time_axis.cc
index 5c05c951b6..2adc56e43f 100644
--- a/gtk2_ardour/audio_time_axis.cc
+++ b/gtk2_ardour/audio_time_axis.cc
@@ -29,50 +29,51 @@
#include <pbd/error.h>
#include <pbd/stl_delete.h>
+#include <pbd/whitespace.h>
-#include <gtkmm2ext/utils.h>
-#include <gtkmm2ext/selector.h>
+#include <gtkmm2ext/bindable_button.h>
#include <gtkmm2ext/gtk_ui.h>
+#include <gtkmm2ext/selector.h>
#include <gtkmm2ext/stop_signal.h>
-#include <gtkmm2ext/bindable_button.h>
+#include <gtkmm2ext/utils.h>
-#include <ardour/session.h>
-#include <ardour/session_playlist.h>
#include <ardour/audioplaylist.h>
#include <ardour/diskstream.h>
-#include <ardour/utils.h>
-#include <ardour/playlist.h>
-#include <ardour/ladspa_plugin.h>
#include <ardour/insert.h>
+#include <ardour/ladspa_plugin.h>
#include <ardour/location.h>
#include <ardour/panner.h>
+#include <ardour/playlist.h>
+#include <ardour/session.h>
+#include <ardour/session_playlist.h>
+#include <ardour/utils.h>
#include "ardour_ui.h"
-#include "public_editor.h"
#include "audio_time_axis.h"
-#include "streamview.h"
-#include "simplerect.h"
-#include "playlist_selector.h"
-#include "plugin_selector.h"
-#include "plugin_ui.h"
-#include "regionview.h"
#include "automation_gain_line.h"
#include "automation_pan_line.h"
#include "automation_time_axis.h"
-#include "redirect_automation_time_axis.h"
+#include "canvas_impl.h"
+#include "crossfade_view.h"
+#include "enums.h"
#include "gain_automation_time_axis.h"
+#include "gui_thread.h"
+#include "keyboard.h"
#include "pan_automation_time_axis.h"
+#include "playlist_selector.h"
+#include "plugin_selector.h"
+#include "plugin_ui.h"
+#include "point_selection.h"
+#include "prompter.h"
+#include "public_editor.h"
#include "redirect_automation_line.h"
+#include "redirect_automation_time_axis.h"
+#include "regionview.h"
+#include "rgb_macros.h"
#include "selection.h"
-#include "point_selection.h"
-#include "enums.h"
+#include "simplerect.h"
+#include "streamview.h"
#include "utils.h"
-#include "keyboard.h"
-#include "rgb_macros.h"
-#include "prompter.h"
-#include "crossfade_view.h"
-#include "gui_thread.h"
-#include "canvas_impl.h"
#include <ardour/audio_track.h>
@@ -834,7 +835,7 @@ AudioTimeAxisView::rename_current_playlist ()
prompter.set_initial_text (pl->name());
switch (prompter.run ()) {
- case GTK_RESPONSE_ACCEPT:
+ case Gtk::RESPONSE_ACCEPT:
prompter.get_result (name);
pl->set_name (name);
break;
@@ -873,7 +874,7 @@ AudioTimeAxisView::use_copy_playlist ()
prompter.show_all ();
switch (prompter.run ()) {
- case GTK_RESPONSE_ACCEPT:
+ case Gtk::RESPONSE_ACCEPT:
prompter.get_result (name);
ds->use_copy_playlist ();
pl = ds->playlist();
@@ -903,7 +904,7 @@ AudioTimeAxisView::use_new_playlist ()
prompter.set_initial_text (new_name);
switch (prompter.run ()) {
- case GTK_RESPONSE_ACCEPT:
+ case Gtk::RESPONSE_ACCEPT:
prompter.get_result (name);
ds->use_new_playlist ();
pl = ds->playlist();
diff --git a/gtk2_ardour/connection_editor.cc b/gtk2_ardour/connection_editor.cc
index 938be6763e..596029eeb3 100644
--- a/gtk2_ardour/connection_editor.cc
+++ b/gtk2_ardour/connection_editor.cc
@@ -658,7 +658,7 @@ ConnectionEditor::new_connection (bool for_input)
prompter.done.connect (Gtk::Main::quit.slot());
switch (prompter.run()) {
- case GTK_RESPONSE_ACCEPT:
+ case Gtk::RESPONSE_ACCEPT:
prompter.get_result (name);
push_at_front = true;
if (name.length()) {
diff --git a/gtk2_ardour/editor_edit_groups.cc b/gtk2_ardour/editor_edit_groups.cc
index d66b313ac0..d9728345c8 100644
--- a/gtk2_ardour/editor_edit_groups.cc
+++ b/gtk2_ardour/editor_edit_groups.cc
@@ -88,7 +88,7 @@ Editor::new_edit_group ()
prompter.show_all ();
switch (prompter.run ()) {
- case GTK_RESPONSE_ACCEPT:
+ case Gtk::RESPONSE_ACCEPT:
prompter.get_result (result);
if (result.length()) {
session->add_edit_group (result);
diff --git a/gtk2_ardour/editor_mouse.cc b/gtk2_ardour/editor_mouse.cc
index 64d00f56ab..c92eadc284 100644
--- a/gtk2_ardour/editor_mouse.cc
+++ b/gtk2_ardour/editor_mouse.cc
@@ -4464,7 +4464,7 @@ Editor::mouse_rename_region (ArdourCanvas::Item* item, GdkEvent* event)
prompter.set_initial_text (clicked_regionview->region.name());
prompter.show_all ();
switch (prompter.run ()) {
- case GTK_RESPONSE_ACCEPT:
+ case Gtk::RESPONSE_ACCEPT:
string str;
prompter.get_result(str);
if (str.length()) {
diff --git a/gtk2_ardour/editor_selection_list.cc b/gtk2_ardour/editor_selection_list.cc
index 64e184151e..90ff2027b7 100644
--- a/gtk2_ardour/editor_selection_list.cc
+++ b/gtk2_ardour/editor_selection_list.cc
@@ -112,7 +112,7 @@ Editor::name_selection ()
p.show_all ();
switch (p.run ()) {
- case GTK_RESPONSE_ACCEPT:
+ case Gtk::RESPONSE_ACCEPT:
string name;
p.get_result (name);
if (name.length()) {
diff --git a/gtk2_ardour/main.cc b/gtk2_ardour/main.cc
index 3dc751de88..183729d960 100644
--- a/gtk2_ardour/main.cc
+++ b/gtk2_ardour/main.cc
@@ -31,8 +31,6 @@
#include <pbd/error.h>
#include <pbd/textreceiver.h>
-#include <pbd/platform.h>
-#include <pbd/platform_factory.h>
#include <pbd/failed_constructor.h>
#include <pbd/pthread_utils.h>
diff --git a/gtk2_ardour/mixer_ui.cc b/gtk2_ardour/mixer_ui.cc
index cdd20e55cf..317f383170 100644
--- a/gtk2_ardour/mixer_ui.cc
+++ b/gtk2_ardour/mixer_ui.cc
@@ -690,7 +690,7 @@ Mixer_UI::new_mix_group ()
prompter.show_all ();
switch (prompter.run ()) {
- case GTK_RESPONSE_ACCEPT:
+ case Gtk::RESPONSE_ACCEPT:
prompter.get_result (result);
if (result.length()) {
session->add_mix_group (result);
diff --git a/gtk2_ardour/option_editor.cc b/gtk2_ardour/option_editor.cc
index c31fdb98f5..491579b286 100644
--- a/gtk2_ardour/option_editor.cc
+++ b/gtk2_ardour/option_editor.cc
@@ -18,6 +18,8 @@
$Id$
*/
+#include <pbd/whitespace.h>
+
#include <ardour/session.h>
#include <ardour/audioengine.h>
#include <ardour/configuration.h>
diff --git a/gtk2_ardour/prompter.cc b/gtk2_ardour/prompter.cc
index 08f089f404..a10bd92f72 100644
--- a/gtk2_ardour/prompter.cc
+++ b/gtk2_ardour/prompter.cc
@@ -19,9 +19,6 @@
*/
#include "prompter.h"
-#include "ardour_ui.h"
-
-using namespace sigc;
ArdourPrompter::ArdourPrompter (bool modal)
: Gtkmm2ext::Prompter (modal)
diff --git a/gtk2_ardour/route_ui.cc b/gtk2_ardour/route_ui.cc
index 82b6cac3bd..ed93c55811 100644
--- a/gtk2_ardour/route_ui.cc
+++ b/gtk2_ardour/route_ui.cc
@@ -740,10 +740,9 @@ RouteUI::route_rename ()
switch (name_prompter.run ()) {
- case GTK_RESPONSE_ACCEPT:
- name_prompter.get_result (result);
- if (result.length()) {
- strip_whitespace_edges (result);
+ case Gtk::RESPONSE_ACCEPT:
+ name_prompter.get_result (result);
+ if (result.length()) {
_route.set_name (result, this);
}
break;
diff --git a/gtk2_ardour/sfdb_ui.cc b/gtk2_ardour/sfdb_ui.cc
index c79ad5c128..891a8dad19 100644
--- a/gtk2_ardour/sfdb_ui.cc
+++ b/gtk2_ardour/sfdb_ui.cc
@@ -20,7 +20,7 @@
*/
#include <map>
-#include <errno.h>
+#include <cerrno>
#include <sndfile.h>
@@ -34,8 +34,9 @@
#include <ardour/sndfile_helpers.h>
#include <ardour/sndfilesource.h>
-#include "sfdb_ui.h"
#include "gui_thread.h"
+#include "prompter.h"
+#include "sfdb_ui.h"
#include "i18n.h"
@@ -235,7 +236,24 @@ SoundFileBox::stop_btn_clicked ()
void
SoundFileBox::add_field_clicked ()
-{}
+{
+ ArdourPrompter prompter (true);
+ string name;
+
+ prompter.set_prompt (_("Name for field"));
+
+ switch (prompter.run ()) {
+ case Gtk::RESPONSE_ACCEPT:
+ cout << name << endl;
+ prompter.get_result (name);
+ Library->add_field (name);
+ Library->save_changes ();
+ break;
+
+ default:
+ break;
+ }
+}
void
SoundFileBox::remove_field_clicked ()
diff --git a/gtk2_ardour/utils.cc b/gtk2_ardour/utils.cc
index 1c4fc2a452..acc9574a18 100644
--- a/gtk2_ardour/utils.cc
+++ b/gtk2_ardour/utils.cc
@@ -147,32 +147,6 @@ atof (const string& s)
return atof (s.c_str());
}
-void
-strip_whitespace_edges (string& str)
-{
- string::size_type i;
- string::size_type len;
- string::size_type s;
-
- len = str.length();
-
- for (i = 0; i < len; ++i) {
- if (isgraph (str[i])) {
- break;
- }
- }
-
- s = i;
-
- for (i = len - 1; i >= 0; --i) {
- if (isgraph (str[i])) {
- break;
- }
- }
-
- str = str.substr (s, (i - s) + 1);
-}
-
vector<string>
internationalize (const char **array)
{
diff --git a/gtk2_ardour/utils.h b/gtk2_ardour/utils.h
index 221329727e..b6f3e0563a 100644
--- a/gtk2_ardour/utils.h
+++ b/gtk2_ardour/utils.h
@@ -55,7 +55,6 @@ std::string fit_to_pixels (const std::string &, int pixel_width, const std::stri
int atoi (const std::string&);
double atof (const std::string&);
-void strip_whitespace_edges (std::string& str);
void url_decode (std::string&);
gint just_hide_it (GdkEventAny*, Gtk::Window*);
void allow_keyboard_focus (bool);
diff --git a/gtk2_ardour/visual_time_axis.cc b/gtk2_ardour/visual_time_axis.cc
index 9782a8c9f6..b282b239e9 100644
--- a/gtk2_ardour/visual_time_axis.cc
+++ b/gtk2_ardour/visual_time_axis.cc
@@ -26,6 +26,7 @@
#include <pbd/error.h>
#include <pbd/stl_delete.h>
+#include <pbd/whitespace.h>
#include <gtkmm2ext/utils.h>
#include <gtkmm2ext/selector.h>
@@ -361,7 +362,7 @@ VisualTimeAxis::start_time_axis_rename()
name_prompter->show_all() ;
switch (name_prompter->run ()) {
- case GTK_RESPONSE_ACCEPT:
+ case Gtk::RESPONSE_ACCEPT:
string result;
name_prompter->get_result (result);
if (editor.get_named_time_axis(result) != 0) {
diff --git a/libs/gtkmm2ext/gtkmm2ext/bindable_button.h b/libs/gtkmm2ext/gtkmm2ext/bindable_button.h
index 4b97403eee..7400cf15d0 100644
--- a/libs/gtkmm2ext/gtkmm2ext/bindable_button.h
+++ b/libs/gtkmm2ext/gtkmm2ext/bindable_button.h
@@ -21,15 +21,15 @@
#ifndef __pbd_gtkmm_bindable_button_h__
#define __pbd_gtkmm_bindable_button_h__
+#include <string>
+
#include <gtkmm2ext/stateful_button.h>
#include <gtkmm2ext/popup.h>
-
namespace MIDI {
class Controllable;
}
-
namespace Gtkmm2ext {
class BindableToggleButton : public Gtk::ToggleButton
@@ -41,7 +41,7 @@ class BindableToggleButton : public Gtk::ToggleButton
//- You won't be able
//- to add a widget in this button since it already has a {\class Gtk_Label}
//- in it.
- explicit BindableToggleButton(MIDI::Controllable *, const string &label);
+ explicit BindableToggleButton(MIDI::Controllable *, const std::string &label);
virtual ~BindableToggleButton() {}
diff --git a/libs/gtkmm2ext/gtkmm2ext/prompter.h b/libs/gtkmm2ext/gtkmm2ext/prompter.h
index 8d092f6992..795d982295 100644
--- a/libs/gtkmm2ext/gtkmm2ext/prompter.h
+++ b/libs/gtkmm2ext/gtkmm2ext/prompter.h
@@ -53,7 +53,7 @@ class Prompter : public Gtk::Dialog
void change_labels (std::string ok, std::string cancel);
- void get_result (std::string &str);
+ void get_result (std::string &str, bool strip=true);
protected:
Gtk::Entry& the_entry() { return entry; }
diff --git a/libs/gtkmm2ext/prompter.cc b/libs/gtkmm2ext/prompter.cc
index 5dd3367380..f61d093083 100644
--- a/libs/gtkmm2ext/prompter.cc
+++ b/libs/gtkmm2ext/prompter.cc
@@ -20,6 +20,8 @@
#include <string>
+#include <pbd/whitespace.h>
+
#include <gtkmm/stock.h>
#include <gtkmm2ext/prompter.h>
@@ -74,8 +76,10 @@ Prompter::change_labels (string okstr, string cancelstr)
}
void
-Prompter::get_result (string &str)
-
+Prompter::get_result (string &str, bool strip)
{
str = entry.get_text ();
+ if (strip) {
+ strip_whitespace_edges (str);
+ }
}
diff --git a/libs/pbd3/SConscript b/libs/pbd3/SConscript
index 47aff4c008..f4b7bf24a8 100644
--- a/libs/pbd3/SConscript
+++ b/libs/pbd3/SConscript
@@ -7,13 +7,12 @@ Import('env libraries')
pbd3 = env.Copy()
domain = 'libpbd'
-pbd3.Append(DOMAIN=domain,MAJOR=3,MINOR=1,MICRO=0)
+pbd3.Append(DOMAIN=domain,MAJOR=3,MINOR=2,MICRO=0)
pbd3_files = Split("""
basename.cc
dirname.cc
dmalloc.cc
-ftw.cc
mountpoint.cc
pathscanner.cc
pool.cc
@@ -25,6 +24,7 @@ transmitter.cc
undo.cc
unescape.cc
version.cc
+whitespace.cc
xml++.cc
""")
diff --git a/libs/pbd3/ftw.cc b/libs/pbd3/ftw.cc
deleted file mode 100644
index ea7162c22e..0000000000
--- a/libs/pbd3/ftw.cc
+++ /dev/null
@@ -1,220 +0,0 @@
-/*
- Copyright (c) 2003 by Joel Baker.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- 3. Neither the name of the Author nor the names of any contributors
- may be used to endorse or promote products derived from this software
- without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- SUCH DAMAGE.
-*/
-
-#include <string>
-#include <sys/types.h> /* Because fts(3) says so */
-#include <sys/stat.h>
-#include <fts.h>
-#include <alloca.h>
-
-#include <unistd.h> /* We want strcpy */
-
-#include <cerrno> /* Because errno is our friend */
-
-#ifndef __USE_XOPEN_EXTENDED /* We need nftw values, since we implement it */
-#define __USE_XOPEN_EXTENDED
-#endif
-
-#include <pbd/ftw.h>
-
-/* I like symbolic values - this is only used in this file. */
-
-enum __ftw_modes {
- MODE_FTW,
- MODE_NFTW
-};
-
-/* Prototype this so that we can have it later */
-
-static int __ftw_core(const char *, void*, int, int, enum __ftw_modes);
-
-/*
- * The external function calls are really just wrappers around __ftw_core,
- * since the work they do is 90% the same.
- */
-
-int ftw (const char *dir, __ftw_func_t func, int descr) {
- return __ftw_core(dir, (void*)func, descr, 0, MODE_FTW);
-}
-
-int nftw (const char *dir, __nftw_func_t func, int descr, int flags) {
- return __ftw_core(dir, (void*)func, descr, flags, MODE_NFTW);
-}
-
-/*
-typedef int (*__ftw_func_t) \
- (const char *file, const struct stat status, int flag);
-typedef int (*__nftw_func_t) \
- (const char *file, const struct stat status, int flag, struct FTW detail);
-*/
-
-static int __ftw_core(const char *dir, void* func, int descr, int flags,
- enum __ftw_modes mode) {
- FTS *hierarchy = 0;
- FTSENT *entry = 0;
- int fts_options;
- char *paths[2];
- int ftw_flag = 0, func_ret = 0;
- struct FTW ftw_st;
- int skip_entry;
- __ftw_func_t ftw_func;
- __nftw_func_t nftw_func;
-
- /* We need at least one descriptor to call fts */
-
- if (descr < 1) {
- errno = EINVAL;
- return -1;
- }
-
- /* Decide which mode we're running in, and set the FTS options suitably. */
-
- if (MODE_NFTW == mode) { /* NFTW mode, with all the bells and whistles. */
- fts_options = (flags & FTW_PHYS) ? FTS_PHYSICAL : FTS_LOGICAL;
- fts_options |= (flags & FTW_CHDIR) ? FTS_NOCHDIR : 0;
- fts_options |= (flags & FTW_MOUNT) ? FTS_XDEV : 0;
- } else { /* We must be in FTW mode. Nothing else makes sense. */
- fts_options = FTS_LOGICAL;
- }
-
- /* FTW gets a const char *, but FTS expects a null-term array of them. */
-
- if (!(paths[0] = (char*) alloca(strlen(dir) + 1))) {
- errno = ENOMEM; /* This is stack... we probably just died anyway. */
- return -1;
- }
-
- strcpy(paths[0], dir);
- paths[1] = 0; /* null */
-
- /* Open the file hierarchy. */
-
- if (!(hierarchy = fts_open(paths, fts_options, 0))) {
- if (EACCES == errno) {
- return 0;
- } else {
- return -1;
- }
- }
-
- /* The main loop. Is it not nifty? Worship the loop. */
-
- bool first = true;
- while ((entry = fts_read(hierarchy))) {
- skip_entry = 0;
- std::string path_name = entry->fts_path;
-
- switch (entry->fts_info) {
-
- case FTS_D:
- if ((MODE_NFTW != mode) || !(flags & FTW_DEPTH)) {
- if (first) {
- path_name = path_name.substr(0, path_name.size() - 1);
- first = false;
- }
- ftw_flag = FTW_D;
- } else {
- skip_entry = 1;
- }
- break;
-
- case FTS_DNR:
- ftw_flag = FTW_DNR;
- break;
-
- case FTS_F:
- ftw_flag = FTW_F;
- break;
-
- case FTS_SL:
- ftw_flag = FTW_SL;
- break;
-
- case FTS_NS:
- ftw_flag = FTW_NS;
- break;
-
- /* Values that should only occur in nftw mode */
-
- case FTS_SLNONE:
- if (MODE_NFTW == mode) {
- ftw_flag = FTW_SLN;
- } else {
- ftw_flag = FTW_SL;
- }
- break;
-
- case FTS_DP:
- if ((MODE_NFTW == mode) && (flags & FTW_DEPTH)) {
- ftw_flag = FTW_D;
- } else {
- skip_entry = 1;
- }
- break;
-
- default:
- /* I'm not sure this is right, but we don't have a valid FTW
- * type to call with, so cowardice seems the better part of
- * guessing.
- */
-
- skip_entry = 1;
- }
-
- if (MODE_FTW == mode) {
- ftw_func = (__ftw_func_t) func;
- func_ret = (*ftw_func)
- (path_name.c_str(), entry->fts_statp, ftw_flag);
- } else if (MODE_NFTW == mode) {
- ftw_st.base = (entry->fts_pathlen - entry->fts_namelen);
- ftw_st.level = entry->fts_level;
-
- nftw_func = (__nftw_func_t) func;
- func_ret = (*nftw_func)
- (path_name.c_str(), entry->fts_statp, ftw_flag, &ftw_st);
- }
-
- if (0 != func_ret) {
- return func_ret;
- }
- }
-
- if (0 != errno) { /* fts_read returned NULL, and set errno - bail */
- return -1;
- }
-
- /* The janitors will be upset if we don't clean up after ourselves. */
-
- if (0 != fts_close(hierarchy)) {
- return -1;
- }
-
- return 0;
-}
diff --git a/libs/pbd3/pbd/ftw.h b/libs/pbd3/pbd/ftw.h
deleted file mode 100644
index 9acf8a6967..0000000000
--- a/libs/pbd3/pbd/ftw.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- Copyright (c) 2003 by Joel Baker.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- 3. Neither the name of the Author nor the names of any contributors
- may be used to endorse or promote products derived from this software
- without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- SUCH DAMAGE.
-*/
-
-#ifndef _FTW_H
-#define _FTW_H
-
-#include <sys/stat.h>
-
-/* Enumerated values for 'flag' when calling [n]ftw */
-
-enum {
- FTW_D, /* Directories */
- FTW_DNR, /* Unreadable directory */
- FTW_F, /* Regular files */
- FTW_SL, /* Symbolic link */
- FTW_NS, /* stat(2) failed */
-
-#ifdef __USE_XOPEN_EXTENDED /* X/Open */
-
-/* Flags for nftw only */
-
- FTW_DP, /* Directory, subdirs visited */
- FTW_SLN, /* Dangling symlink */
-
-#endif /* __USE_XOPEN_EXTENDED */
-};
-
-#ifdef __USE_XOPEN_EXTENDED /* X/Open */
-
-/* Enumerated values for 'flags' when calling nftw */
-
-enum {
- FTW_CHDIR = 1, /* Do a chdir(2) when entering a directory */
- FTW_DEPTH = 2, /* Report files first (before directory) */
- FTW_MOUNT = 4, /* Single filesystem */
- FTW_PHYS = 8 /* Physical walk; ignore symlinks */
-};
-
-#define FTW_PHYS FTW_PHYS
-#define FTW_MOUNT FTW_MOUNT
-#define FTW_CHDIR FTW_CHDIR
-#define FTW_DEPTH FTW_DEPTH
-
-/* FTW struct for callbacks from nftw */
-
-struct FTW {
- int base;
- int level;
-};
-
-#endif /* __USE_XOPEN_EXTENDED */
-
-/* Typecasts for callback functions */
-
-typedef int (*__ftw_func_t) \
- (const char *file, const struct stat *status, int flag);
-
-#ifdef __USE_XOPEN_EXTENDED /* X/Open */
-
-typedef int (*__nftw_func_t) \
- (const char *file, const struct stat *status, int flag, struct FTW *detail);
-
-#endif /* __USE_XOPEN_EXTENDED */
-
-/* ftw: walk a directory tree, calling a function for each element */
-
-extern int ftw (const char *dir, __ftw_func_t func, int descr);
-
-#ifdef __USE_XOPEN_EXTENDED /* X/Open */
-
-/* nftw: walk a directory tree, calling a function for each element; much
- * like ftw, but with behavior flags and minty freshness.
- */
-
-extern int nftw (const char *dir, __nftw_func_t func, int descr, int flags);
-
-#endif /* __USE_XOPEN_EXTENDED */
-
-#endif /* _FTW_H */
diff --git a/libs/pbd3/pbd/irix_platform.h b/libs/pbd3/pbd/irix_platform.h
deleted file mode 100644
index f948554f26..0000000000
--- a/libs/pbd3/pbd/irix_platform.h
+++ /dev/null
@@ -1,20 +0,0 @@
-#ifndef __irix_platform__
-#define __irix_platform__
-
-#include <pbd/platform.h>
-
-class IrixPlatform : public Platform {
- public:
- IrixPlatform () : Platform () {};
- virtual ~IrixPlatform ();
-
- virtual int pre_config ();
- virtual int post_config ();
- virtual int pre_ui ();
- virtual int post_ui ();
-
- virtual int dsp_startup();
-};
-
-
-#endif // __irix_platform__
diff --git a/libs/pbd3/pbd/linux_platform.h b/libs/pbd3/pbd/linux_platform.h
deleted file mode 100644
index 74822a9d89..0000000000
--- a/libs/pbd3/pbd/linux_platform.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- Copyright (C) 1999 Paul Barton-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.
-
- $Id$
-*/
-
-#ifndef __linux_platform_h__
-#define __linux_platform_h__
-
-#include <pbd/platform.h>
-
-class LinuxPlatform : public Platform
-
-{
- public:
- LinuxPlatform ();
- ~LinuxPlatform () {};
-
- int pre_config ();
- int post_config ();
- int pre_ui ();
- int post_ui ();
-
- int dsp_startup() { return 0; }
-};
-
-#endif // __linux_platform_h__
diff --git a/libs/pbd3/pbd/platform.h b/libs/pbd3/pbd/platform.h
deleted file mode 100644
index 761195a31b..0000000000
--- a/libs/pbd3/pbd/platform.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- Copyright (C) 1999 Paul Barton-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.
-
- $Id$
-*/
-
-#ifndef __qm_platform_h__
-#define __qm_platform_h__
-
-class Platform
-
-{
- public:
- Platform () {
- thePlatform = this;
- }
- virtual ~Platform () {}
-
- virtual int pre_config () { return 0;}
- virtual int post_config () { return 0;}
- virtual int pre_ui () { return 0; }
- virtual int post_ui () { return 0; }
- virtual int dsp_startup() { return 0; }
-
- static Platform *instance() { return thePlatform; }
-
- private:
- static Platform *thePlatform;
-};
-
-#endif // __qm_platform_h__
diff --git a/libs/pbd3/pbd/platform_factory.h b/libs/pbd3/pbd/platform_factory.h
deleted file mode 100644
index d5255ea212..0000000000
--- a/libs/pbd3/pbd/platform_factory.h
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifndef __platform_factory__
-#define __platform_factory__
-
-#include <pbd/platform.h>
-
-class PlatformFactory {
-public:
- static Platform* create_platform ();
-};
-
-
-#endif // __platform_factory__
diff --git a/libs/pbd3/pbd/solaris_platform.h b/libs/pbd3/pbd/solaris_platform.h
deleted file mode 100644
index 6f39a77f73..0000000000
--- a/libs/pbd3/pbd/solaris_platform.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- Copyright (C) 1999 Paul Barton-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.
-
- $Id$
-*/
-
-#ifndef __solaris_platform_h__
-#define __solaris_platform_h__
-
-#include <pbd/platform.h>
-
-class SolarisPlatform : public Platform
-{
- public:
- SolarisPlatform () : Platform () {};
- ~SolarisPlatform () {};
-
- int pre_config ();
- int post_config ();
- int pre_ui ();
- int post_ui ();
-
- int dsp_startup() { return 0; }
-
-};
-
-#endif // __solaris_platform_h__
diff --git a/libs/pbd3/pbd/strsub.h b/libs/pbd3/pbd/strsub.h
deleted file mode 100644
index c5bfb1ade4..0000000000
--- a/libs/pbd3/pbd/strsub.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- Copyright (C) 1998-99 Paul Barton-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.
-
- $Id$
-*/
-
-#ifndef __libmisc_strsub_h__
-#define __libmisc_strsub_h__
-
-extern char *strsub (char *str, const char *target, const char *replacement);
-
-#endif // __libmisc_strsub_h__
diff --git a/libs/pbd3/pbd/whitespace.h b/libs/pbd3/pbd/whitespace.h
new file mode 100644
index 0000000000..6620a8fb50
--- /dev/null
+++ b/libs/pbd3/pbd/whitespace.h
@@ -0,0 +1,8 @@
+#ifndef __pbd_whitespace_h__
+#define __pbd_whitespace_h__
+
+#include <string>
+
+extern void strip_whitespace_edges (std::string& str);
+
+#endif // __pbd_whitespace_h__
diff --git a/libs/pbd3/whitespace.cc b/libs/pbd3/whitespace.cc
new file mode 100644
index 0000000000..7f74940457
--- /dev/null
+++ b/libs/pbd3/whitespace.cc
@@ -0,0 +1,30 @@
+#include <pbd/whitespace.h>
+
+using namespace std;
+
+void
+strip_whitespace_edges (string& str)
+{
+ string::size_type i;
+ string::size_type len;
+ string::size_type s;
+
+ len = str.length();
+
+ for (i = 0; i < len; ++i) {
+ if (isgraph (str[i])) {
+ break;
+ }
+ }
+
+ s = i;
+
+ for (i = len - 1; i >= 0; --i) {
+ if (isgraph (str[i])) {
+ break;
+ }
+ }
+
+ str = str.substr (s, (i - s) + 1);
+}
+