diff options
author | Taybin Rutkin <taybin@taybin.com> | 2006-04-25 20:23:50 +0000 |
---|---|---|
committer | Taybin Rutkin <taybin@taybin.com> | 2006-04-25 20:23:50 +0000 |
commit | 49ab3aa0b3e78b635c22512b30f44b951c1401f7 (patch) | |
tree | a1380f163eb95d1e62698a919a451cc0892c1a80 /gtk2_ardour | |
parent | bc46c6e5d44de56a8ef290484766a0f3bcfbed65 (diff) |
All included libraries now link dynamically instead of statically.
Moved items from gtk2_ardour/utils to pbd3/convert.
Various cleanups.
git-svn-id: svn://localhost/trunk/ardour2@475 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour')
-rw-r--r-- | gtk2_ardour/add_route_dialog.cc | 13 | ||||
-rwxr-xr-x | gtk2_ardour/ardev_common.sh | 5 | ||||
-rw-r--r-- | gtk2_ardour/ardour_ui_options.cc | 6 | ||||
-rw-r--r-- | gtk2_ardour/audio_clock.cc | 5 | ||||
-rw-r--r-- | gtk2_ardour/editor.cc | 3 | ||||
-rw-r--r-- | gtk2_ardour/export_dialog.cc | 8 | ||||
-rw-r--r-- | gtk2_ardour/i18n.h | 2 | ||||
-rw-r--r-- | gtk2_ardour/mixer_strip.cc | 5 | ||||
-rw-r--r-- | gtk2_ardour/mixer_ui.cc | 4 | ||||
-rw-r--r-- | gtk2_ardour/plugin_selector.cc | 1 | ||||
-rw-r--r-- | gtk2_ardour/redirect_box.cc | 7 | ||||
-rw-r--r-- | gtk2_ardour/sfdb_ui.cc | 7 | ||||
-rw-r--r-- | gtk2_ardour/utils.cc | 179 | ||||
-rw-r--r-- | gtk2_ardour/utils.h | 5 |
14 files changed, 42 insertions, 208 deletions
diff --git a/gtk2_ardour/add_route_dialog.cc b/gtk2_ardour/add_route_dialog.cc index f04ec7b707..ef8e601344 100644 --- a/gtk2_ardour/add_route_dialog.cc +++ b/gtk2_ardour/add_route_dialog.cc @@ -24,6 +24,7 @@ #include <sigc++/bind.h> #include <gtkmm/stock.h> #include <pbd/error.h> +#include <pbd/convert.h> #include <gtkmm2ext/utils.h> #include "utils.h" @@ -64,11 +65,11 @@ AddRouteDialog::AddRouteDialog () routes_spinner (routes_adjustment) { if (channel_combo_strings.empty()) { - channel_combo_strings = internationalize (channel_setup_names); + channel_combo_strings = PBD::internationalize (channel_setup_names); } if (track_mode_strings.empty()) { - track_mode_strings = internationalize (track_mode_names); + track_mode_strings = PBD::internationalize (track_mode_names); } set_name ("AddRouteDialog"); @@ -195,10 +196,10 @@ AddRouteDialog::channels () return 1; } else if (str == _("Stereo")) { return 2; - } else if ((chns = atoi (str)) != 0) { + } else if ((chns = PBD::atoi (str)) != 0) { return chns; - } else { - return 0; - } + } + + return 0; } diff --git a/gtk2_ardour/ardev_common.sh b/gtk2_ardour/ardev_common.sh index 9f932e9bbf..7e1da03ba0 100755 --- a/gtk2_ardour/ardev_common.sh +++ b/gtk2_ardour/ardev_common.sh @@ -2,4 +2,7 @@ export ARDOUR_PATH=./glade:./pixmaps:.:.. -export LD_LIBRARY_PATH=../libs/ardour:../libs/midi++2:../libs/pbd3:../libs/soundtouch:../libs/gtkmm2ext:$LD_LIBRARY_PATH +export LD_LIBRARY_PATH=../libs/ardour:../libs/midi++2:../libs/pbd3:../libs/soundtouch:../libs/gtkmm2ext:../libs/sigc++2:../libs/glibmm2:../libs/gtkmm2/atk:../libs/gtkmm2/pango:../libs/gtkmm2/gdk:../libs/gtkmm2/gtk:../libs/libgnomecanvasmm:../libs/libglademm:$LD_LIBRARY_PATH + +# DYLD_LIBRARY_PATH is for darwin. +export DYLD_LIBRARY_PATH=$LD_LIBRARY_PATH diff --git a/gtk2_ardour/ardour_ui_options.cc b/gtk2_ardour/ardour_ui_options.cc index b959cc7300..826823885c 100644 --- a/gtk2_ardour/ardour_ui_options.cc +++ b/gtk2_ardour/ardour_ui_options.cc @@ -18,6 +18,8 @@ $Id$ */ +#include <pbd/convert.h> + #include <gtkmm2ext/utils.h> #include <ardour/configuration.h> @@ -380,7 +382,7 @@ ARDOUR_UI::mtc_port_changed () 0 }; - positional_sync_strings = internationalize (psync_strings); + positional_sync_strings = PBD::internationalize (psync_strings); } else { const gchar *psync_strings[] = { @@ -388,7 +390,7 @@ ARDOUR_UI::mtc_port_changed () N_("JACK"), 0 }; - positional_sync_strings = internationalize (psync_strings); + positional_sync_strings = PBD::internationalize (psync_strings); } set_popdown_strings (sync_option_combo, positional_sync_strings); diff --git a/gtk2_ardour/audio_clock.cc b/gtk2_ardour/audio_clock.cc index fc9b510753..d7eb1e5936 100644 --- a/gtk2_ardour/audio_clock.cc +++ b/gtk2_ardour/audio_clock.cc @@ -20,6 +20,9 @@ #include <cstdio> // for sprintf #include <cmath> + +#include <pbd/convert.h> + #include <gtkmm2ext/utils.h> #include <ardour/ardour.h> @@ -37,6 +40,8 @@ using namespace ARDOUR; using namespace sigc; using namespace Gtk; +using PBD::atoi; + const uint32_t AudioClock::field_length[(int) AudioClock::AudioFrames+1] = { 2, /* SMPTE_Hours */ 2, /* SMPTE_Minutes */ diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index 1a44041f73..a3a73bc936 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -26,6 +26,7 @@ #include <sigc++/bind.h> +#include <pbd/convert.h> #include <pbd/error.h> #include <gtkmm/image.h> @@ -87,6 +88,8 @@ using namespace Glib; using namespace Gtkmm2ext; using namespace Editing; +using PBD::internationalize; + const double Editor::timebar_height = 15.0; #include "editor_xpms" diff --git a/gtk2_ardour/export_dialog.cc b/gtk2_ardour/export_dialog.cc index 248eca3f29..1293fca34b 100644 --- a/gtk2_ardour/export_dialog.cc +++ b/gtk2_ardour/export_dialog.cc @@ -22,12 +22,13 @@ #include <unistd.h> #include <utility> #include <sys/stat.h> - #include <fstream> #include <samplerate.h> -#include <pbd/xml++.h> + +#include <pbd/convert.h> #include <pbd/dirname.h> +#include <pbd/xml++.h> #include <gtkmm2ext/utils.h> #include <ardour/export.h> @@ -48,11 +49,12 @@ #define FRAME_NAME "BaseFrame" using namespace std; - using namespace ARDOUR; using namespace sigc; using namespace Gtk; +using PBD::internationalize; + static const gchar *sample_rates[] = { N_("22.05kHz"), N_("44.1kHz"), diff --git a/gtk2_ardour/i18n.h b/gtk2_ardour/i18n.h index 3ace250419..71a3dccab8 100644 --- a/gtk2_ardour/i18n.h +++ b/gtk2_ardour/i18n.h @@ -7,8 +7,6 @@ #include <vector> #include <string> -std::vector<std::string> internationalize (const char **); - #define _(Text) dgettext (PACKAGE,Text) #define N_(Text) gettext_noop (Text) #define X_(Text) Text diff --git a/gtk2_ardour/mixer_strip.cc b/gtk2_ardour/mixer_strip.cc index ef04579c2d..37b8af29f9 100644 --- a/gtk2_ardour/mixer_strip.cc +++ b/gtk2_ardour/mixer_strip.cc @@ -19,10 +19,11 @@ */ #include <cmath> -#include <glib.h> #include <sigc++/bind.h> +#include <pbd/convert.h> + #include <gtkmm2ext/gtk_ui.h> #include <gtkmm2ext/utils.h> #include <gtkmm2ext/choice.h> @@ -1318,7 +1319,7 @@ MixerStrip::name_changed (void *src) RouteUI::name_changed (src); break; case Narrow: - name_label.set_text (short_version (_route.name(), 5)); + name_label.set_text (PBD::short_version (_route.name(), 5)); break; } } diff --git a/gtk2_ardour/mixer_ui.cc b/gtk2_ardour/mixer_ui.cc index 195da09332..dd0eb6e693 100644 --- a/gtk2_ardour/mixer_ui.cc +++ b/gtk2_ardour/mixer_ui.cc @@ -23,7 +23,9 @@ #include <gtkmm/accelmap.h> +#include <pbd/convert.h> #include <pbd/lockmonitor.h> + #include <gtkmm2ext/gtk_ui.h> #include <gtkmm2ext/utils.h> #include <gtkmm2ext/stop_signal.h> @@ -53,6 +55,8 @@ using namespace Gtkmm2ext; using namespace sigc; using namespace std; +using PBD::atoi; + Mixer_UI::Mixer_UI (AudioEngine& eng) : Window (Gtk::WINDOW_TOPLEVEL), engine (eng) diff --git a/gtk2_ardour/plugin_selector.cc b/gtk2_ardour/plugin_selector.cc index 1f28d6a9f4..9171815bcd 100644 --- a/gtk2_ardour/plugin_selector.cc +++ b/gtk2_ardour/plugin_selector.cc @@ -168,7 +168,6 @@ PluginSelector::set_session (Session* s) void PluginSelector::_input_refiller (void *arg) { - ((PluginSelector *) arg)->input_refiller (); } diff --git a/gtk2_ardour/redirect_box.cc b/gtk2_ardour/redirect_box.cc index 87b31d8c03..1b08b46ccd 100644 --- a/gtk2_ardour/redirect_box.cc +++ b/gtk2_ardour/redirect_box.cc @@ -19,10 +19,11 @@ */ #include <cmath> -#include <glib.h> #include <sigc++/bind.h> +#include <pbd/convert.h> + #include <gtkmm/messagedialog.h> #include <gtkmm2ext/gtk_ui.h> @@ -539,7 +540,7 @@ RedirectBox::redirect_name (Redirect& redirect) name_display += send->name().substr (lbracket+1, lbracket-rbracket-1); break; case Narrow: - name_display += short_version (send->name().substr (lbracket+1, lbracket-rbracket-1), 4); + name_display += PBD::short_version (send->name().substr (lbracket+1, lbracket-rbracket-1), 4); break; } @@ -550,7 +551,7 @@ RedirectBox::redirect_name (Redirect& redirect) name_display += redirect.name(); break; case Narrow: - name_display += short_version (redirect.name(), 5); + name_display += PBD::short_version (redirect.name(), 5); break; } diff --git a/gtk2_ardour/sfdb_ui.cc b/gtk2_ardour/sfdb_ui.cc index 149b7f66ca..839f78598f 100644 --- a/gtk2_ardour/sfdb_ui.cc +++ b/gtk2_ardour/sfdb_ui.cc @@ -26,6 +26,7 @@ #include <gtkmm/stock.h> #include <pbd/basename.h> +#include <pbd/convert.h> #include <gtkmm2ext/utils.h> @@ -44,8 +45,6 @@ using namespace ARDOUR; using namespace std; -string length2string (const int32_t frames, const float sample_rate); - SoundFileBox::SoundFileBox () : _session(0), @@ -129,7 +128,7 @@ SoundFileBox::setup_labels (string filename) } length.set_alignment (0.0f, 0.0f); - length.set_text (string_compose("Length: %1", length2string(sf_info.length, sf_info.samplerate))); + length.set_text (string_compose("Length: %1", PBD::length2string(sf_info.length, sf_info.samplerate))); format.set_alignment (0.0f, 0.0f); format.set_text (sf_info.format_name); @@ -334,7 +333,7 @@ SoundFileOmega::SoundFileOmega (string title) split_check (_("Split Channels")) { if (mode_strings.empty()) { - mode_strings = internationalize (import_mode_strings); + mode_strings = PBD::internationalize (import_mode_strings); } ARDOUR_UI::instance()->tooltips().set_tip(split_check, diff --git a/gtk2_ardour/utils.cc b/gtk2_ardour/utils.cc index c3afcb7919..fde9d545bb 100644 --- a/gtk2_ardour/utils.cc +++ b/gtk2_ardour/utils.cc @@ -44,70 +44,6 @@ using namespace Gtk; using namespace sigc; using namespace Glib; -string -short_version (string orig, string::size_type target_length) -{ - /* this tries to create a recognizable abbreviation - of "orig" by removing characters until we meet - a certain target length. - - note that we deliberately leave digits in the result - without modification. - */ - - - string::size_type pos; - - /* remove white-space and punctuation, starting at end */ - - while (orig.length() > target_length) { - if ((pos = orig.find_last_of (_("\"\n\t ,<.>/?:;'[{}]~`!@#$%^&*()_-+="))) == string::npos) { - break; - } - orig.replace (pos, 1, ""); - } - - /* remove lower-case vowels, starting at end */ - - while (orig.length() > target_length) { - if ((pos = orig.find_last_of (_("aeiou"))) == string::npos) { - break; - } - orig.replace (pos, 1, ""); - } - - /* remove upper-case vowels, starting at end */ - - while (orig.length() > target_length) { - if ((pos = orig.find_last_of (_("AEIOU"))) == string::npos) { - break; - } - orig.replace (pos, 1, ""); - } - - /* remove lower-case consonants, starting at end */ - - while (orig.length() > target_length) { - if ((pos = orig.find_last_of (_("bcdfghjklmnpqrtvwxyz"))) == string::npos) { - break; - } - orig.replace (pos, 1, ""); - } - - /* remove upper-case consonants, starting at end */ - - while (orig.length() > target_length) { - if ((pos = orig.find_last_of (_("BCDFGHJKLMNPQRTVWXYZ"))) == string::npos) { - break; - } - orig.replace (pos, 1, ""); - } - - /* whatever the length is now, use it */ - - return orig; -} - ustring fit_to_pixels (const ustring& str, int pixel_width, Pango::FontDescription& font, int& actual_width) { @@ -141,30 +77,6 @@ fit_to_pixels (const ustring& str, int pixel_width, Pango::FontDescription& font return ustr; } -int -atoi (const string& s) -{ - return atoi (s.c_str()); -} - -double -atof (const string& s) -{ - return atof (s.c_str()); -} - -vector<string> -internationalize (const char **array) -{ - vector<string> v; - - for (uint32_t i = 0; array[i]; ++i) { - v.push_back (_(array[i])); - } - - return v; -} - gint just_hide_it (GdkEventAny *ev, Gtk::Window *win) { @@ -297,79 +209,6 @@ get_canvas_points (string who, uint32_t npoints) return new ArdourCanvas::Points (npoints); } -static int32_t -int_from_hex (char hic, char loc) -{ - int hi; /* hi byte */ - int lo; /* low byte */ - - hi = (int) hic; - - if( ('0'<=hi) && (hi<='9') ) { - hi -= '0'; - } else if( ('a'<= hi) && (hi<= 'f') ) { - hi -= ('a'-10); - } else if( ('A'<=hi) && (hi<='F') ) { - hi -= ('A'-10); - } - - lo = (int) loc; - - if( ('0'<=lo) && (lo<='9') ) { - lo -= '0'; - } else if( ('a'<=lo) && (lo<='f') ) { - lo -= ('a'-10); - } else if( ('A'<=lo) && (lo<='F') ) { - lo -= ('A'-10); - } - - return lo + (16 * hi); -} - -void -url_decode (string& url) -{ - string::iterator last; - string::iterator next; - - for (string::iterator i = url.begin(); i != url.end(); ++i) { - if ((*i) == '+') { - *i = ' '; - } - } - - if (url.length() <= 3) { - return; - } - - last = url.end(); - - --last; /* points at last char */ - --last; /* points at last char - 1 */ - - for (string::iterator i = url.begin(); i != last; ) { - - if (*i == '%') { - - next = i; - - url.erase (i); - - i = next; - ++next; - - if (isxdigit (*i) && isxdigit (*next)) { - /* replace first digit with char */ - *i = int_from_hex (*i,*next); - ++i; /* points at 2nd of 2 digits */ - url.erase (i); - } - } else { - ++i; - } - } -} - Pango::FontDescription get_font_for_style (string widgetname) { @@ -595,21 +434,3 @@ get_xpm (std::string name) return (xpm_map[name]); } -string -length2string (const int32_t frames, const float sample_rate) -{ - int secs = (int) (frames / sample_rate); - int hrs = secs / 3600; - secs -= (hrs * 3600); - int mins = secs / 60; - secs -= (mins * 60); - - int total_secs = (hrs * 3600) + (mins * 60) + secs; - int frames_remaining = (int) floor (frames - (total_secs * sample_rate)); - float fractional_secs = (float) frames_remaining / sample_rate; - - char duration_str[32]; - sprintf (duration_str, "%02d:%02d:%05.2f", hrs, mins, (float) secs + fractional_secs); - - return duration_str; -} diff --git a/gtk2_ardour/utils.h b/gtk2_ardour/utils.h index 1f1d702261..c0b7aac524 100644 --- a/gtk2_ardour/utils.h +++ b/gtk2_ardour/utils.h @@ -52,12 +52,8 @@ slider_position_to_gain (double pos) return pow (2.0,(sqrt(sqrt(sqrt(pos)))*198.0-192.0)/6.0); } -std::string short_version (std::string, std::string::size_type target_length); Glib::ustring fit_to_pixels (const Glib::ustring&, int pixel_width, Pango::FontDescription& font, int& actual_width); -int atoi (const std::string&); -double atof (const std::string&); -void url_decode (std::string&); gint just_hide_it (GdkEventAny*, Gtk::Window*); void allow_keyboard_focus (bool); @@ -82,6 +78,5 @@ bool key_press_focus_accelerator_handler (Gtk::Window& window, GdkEventKey* ev); Glib::RefPtr<Gdk::Pixbuf> get_xpm(std::string); static std::map<std::string, Glib::RefPtr<Gdk::Pixbuf> > xpm_map; const char* const *get_xpm_data (std::string path); -std::string length2string (const int32_t frames, const float sample_rate); #endif /* __ardour_gtk_utils_h__ */ |