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
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
@@ -65,28 +65,11 @@ using namespace ARDOUR;
|
||||
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"));
|
||||
|
||||
16
gtk2_ardour/pixmaps/lr.xpm
Normal file
16
gtk2_ardour/pixmaps/lr.xpm
Normal file
@@ -0,0 +1,16 @@
|
||||
/* XPM */
|
||||
static const gchar * lr_xpm[] = {
|
||||
"11 11 2 1",
|
||||
" c None",
|
||||
". c #cccccc",
|
||||
" ",
|
||||
" ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
"...........",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" ",
|
||||
" "};
|
||||
16
gtk2_ardour/pixmaps/small_x.xpm
Normal file
16
gtk2_ardour/pixmaps/small_x.xpm
Normal file
@@ -0,0 +1,16 @@
|
||||
/* XPM */
|
||||
static const gchar * small_x_xpm[] = {
|
||||
"11 11 2 1",
|
||||
" c None",
|
||||
". c #cccccc",
|
||||
" ",
|
||||
" ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" ",
|
||||
" "};
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user