summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDoug McLain <doug@nostar.net>2006-03-10 07:16:45 +0000
committerDoug McLain <doug@nostar.net>2006-03-10 07:16:45 +0000
commit276d290a422f3c13a3e72d907eb4882e9db53105 (patch)
tree87298f5b550eb45f32c4eb1d5355380750ba649c
parent58bd9bff8db593dab69188199632aeabbcf8be8d (diff)
Example code to load the x and <-> xpms for the mixer strip from files instead of from hard coded xpm data.
git-svn-id: svn://localhost/trunk/ardour2@370 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r--gtk2_ardour/about.cc2
-rw-r--r--gtk2_ardour/mixer_strip.cc25
-rw-r--r--gtk2_ardour/pixmaps/lr.xpm16
-rw-r--r--gtk2_ardour/pixmaps/small_x.xpm16
-rw-r--r--libs/ardour/ardour/ardour.h2
-rw-r--r--libs/ardour/globals.cc17
6 files changed, 52 insertions, 26 deletions
diff --git a/gtk2_ardour/about.cc b/gtk2_ardour/about.cc
index 94284f58d4..4c4b79041c 100644
--- a/gtk2_ardour/about.cc
+++ b/gtk2_ardour/about.cc
@@ -164,7 +164,7 @@ About::About ()
string path;
string t;
- path = find_data_file ("splash.ppm");
+ path = find_data_file ("splash.ppm", "pixmaps");
Glib::RefPtr<Pixbuf> pixbuf = Gdk::Pixbuf::create_from_file (path);
diff --git a/gtk2_ardour/mixer_strip.cc b/gtk2_ardour/mixer_strip.cc
index 391ff0a820..d168c421cd 100644
--- a/gtk2_ardour/mixer_strip.cc
+++ b/gtk2_ardour/mixer_strip.cc
@@ -66,27 +66,10 @@ using namespace Gtk;
using namespace Gtkmm2ext;
/* XPM */
-static const gchar * small_x_xpm[] = {
-"11 11 2 1",
-" c None",
-". c #cccc99",
-" ",
-" ",
-" . . ",
-" . . ",
-" . . ",
-" . ",
-" . . ",
-" . . ",
-" . . ",
-" ",
-" "};
-
-/* XPM */
static const gchar * lr_xpm[] = {
"11 11 2 1",
" c None",
-". c #cccc99",
+". c #cccccc",
" ",
" ",
" . . ",
@@ -145,8 +128,10 @@ MixerStrip::MixerStrip (Mixer_UI& mx, Session& sess, Route& rt, bool in_mixer)
comment_window = 0;
comment_area = 0;
- width_button.add (*(manage (new Gtk::Image (Gdk::Pixbuf::create_from_xpm_data(lr_xpm)))));
- hide_button.add (*(manage (new Gtk::Image (Gdk::Pixbuf::create_from_xpm_data(small_x_xpm)))));
+ std::string small_x_xpm_file = find_data_file("small_x.xpm", "pixmaps");
+ std::string lr_xpm_file = find_data_file("lr.xpm", "pixmaps");
+ width_button.add (*(manage (new Gtk::Image (Gdk::Pixbuf::create_from_file(lr_xpm_file)))));
+ hide_button.add (*(manage (new Gtk::Image (Gdk::Pixbuf::create_from_file(small_x_xpm_file)))));
input_label.set_text (_("INPUT"));
diff --git a/gtk2_ardour/pixmaps/lr.xpm b/gtk2_ardour/pixmaps/lr.xpm
new file mode 100644
index 0000000000..b045c94883
--- /dev/null
+++ b/gtk2_ardour/pixmaps/lr.xpm
@@ -0,0 +1,16 @@
+/* XPM */
+static const gchar * lr_xpm[] = {
+"11 11 2 1",
+" c None",
+". c #cccccc",
+" ",
+" ",
+" . . ",
+" . . ",
+" . . ",
+"...........",
+" . . ",
+" . . ",
+" . . ",
+" ",
+" "};
diff --git a/gtk2_ardour/pixmaps/small_x.xpm b/gtk2_ardour/pixmaps/small_x.xpm
new file mode 100644
index 0000000000..ee8e930761
--- /dev/null
+++ b/gtk2_ardour/pixmaps/small_x.xpm
@@ -0,0 +1,16 @@
+/* XPM */
+static const gchar * small_x_xpm[] = {
+"11 11 2 1",
+" c None",
+". c #cccccc",
+" ",
+" ",
+" . . ",
+" . . ",
+" . . ",
+" . ",
+" . . ",
+" . . ",
+" . . ",
+" ",
+" "};
diff --git a/libs/ardour/ardour/ardour.h b/libs/ardour/ardour/ardour.h
index 31bd22590e..293d346823 100644
--- a/libs/ardour/ardour/ardour.h
+++ b/libs/ardour/ardour/ardour.h
@@ -48,7 +48,7 @@ namespace ARDOUR {
int init (AudioEngine&, bool with_vst, bool try_optimization, void (*sighandler)(int,siginfo_t*,void*) = 0);
int cleanup ();
std::string find_config_file (std::string name);
- std::string find_data_file (std::string name);
+ std::string find_data_file (std::string name, std::string subdir = "" );
const layer_t max_layer = UCHAR_MAX;
diff --git a/libs/ardour/globals.cc b/libs/ardour/globals.cc
index 2d64c02c40..99cf9f9890 100644
--- a/libs/ardour/globals.cc
+++ b/libs/ardour/globals.cc
@@ -299,7 +299,7 @@ ARDOUR::new_change ()
}
static string
-find_file (string name, string dir)
+find_file (string name, string dir, string subdir = "")
{
string path;
@@ -317,8 +317,12 @@ find_file (string name, string dir)
mkdir (path.c_str(), 0755);
+ if (subdir.length()) {
+ path += subdir + "/";
+ }
+
path += name;
-
+ cerr << path << endl;
if (access (path.c_str(), R_OK) == 0) {
return path;
}
@@ -328,6 +332,11 @@ find_file (string name, string dir)
path = dir;
path += "/ardour/";
+
+ if (subdir.length()) {
+ path += subdir + "/";
+ }
+
path += name;
if (access (path.c_str(), R_OK) == 0) {
@@ -349,14 +358,14 @@ ARDOUR::find_config_file (string name)
}
string
-ARDOUR::find_data_file (string name)
+ARDOUR::find_data_file (string name, string subdir)
{
char* envvar;
if ((envvar = getenv("ARDOUR_DATA_PATH")) == 0) {
envvar = DATA_DIR;
}
- return find_file (name, envvar);
+ return find_file (name, envvar, subdir);
}
ARDOUR::LocaleGuard::LocaleGuard (const char* str)