[PATCH] fade_value parameter

Carl Karsten carl at personnelware.com
Tue May 17 04:34:38 UTC 2011


---
 src/dvswitch.cpp     |   11 +++++++++--
 src/mixer_window.cpp |    5 +++--
 src/mixer_window.hpp |    2 +-
 3 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/src/dvswitch.cpp b/src/dvswitch.cpp
index ebe1c75..44dec6a 100644
--- a/src/dvswitch.cpp
+++ b/src/dvswitch.cpp
@@ -31,12 +31,14 @@ namespace
     struct option options[] =3D {
 	{"host",             1, NULL, 'h'},
 	{"port",             1, NULL, 'p'},
+	{"fade",             1, NULL, 'f'},
 	{"help",             0, NULL, 'H'},
 	{NULL,               0, NULL, 0}
     };

     std::string mixer_host;
     std::string mixer_port;
+    int fade_value =3D 300;

     extern "C"
     {
@@ -46,6 +48,8 @@ namespace
 		mixer_host =3D value;
 	    else if (strcmp(name, "MIXER_PORT") =3D=3D 0)
 		mixer_port =3D value;
+	    else if (strcmp(name, "FADE_VALUE") =3D=3D 0)
+		fade_value =3D atoi(value);
 	}
     }

@@ -72,7 +76,7 @@ int main(int argc, char **argv)
 	// Complete option parsing with Gtk's options out of the way.

 	int opt;
-	while ((opt =3D getopt_long(argc, argv, "h:p:", options, NULL)) !=3D -1)
+	while ((opt =3D getopt_long(argc, argv, "h:p:f:", options, NULL)) !=3D -1=
)
 	{
 	    switch (opt)
 	    {
@@ -82,6 +86,9 @@ int main(int argc, char **argv)
 	    case 'p':
 		mixer_port =3D optarg;
 		break;
+	    case 'f':
+		fade_value =3D atoi(optarg);
+		break;
 	    case 'H': /* --help */
 		usage(argv[0]);
 		return 0;
@@ -109,7 +116,7 @@ int main(int argc, char **argv)
 	mixer the_mixer;
 	server the_server(mixer_host, mixer_port, the_mixer);
 	connector the_connector(the_mixer);
-	the_window.reset(new mixer_window(the_mixer, the_connector));
+	the_window.reset(new mixer_window(the_mixer, the_connector, fade_value));
 	the_mixer.set_monitor(the_window.get());
 	the_window->show();
 	the_window->signal_hide().connect(sigc::ptr_fun(&Gtk::Main::quit));
diff --git a/src/mixer_window.cpp b/src/mixer_window.cpp
index 961f57a..e09dbac 100644
--- a/src/mixer_window.cpp
+++ b/src/mixer_window.cpp
@@ -59,7 +59,8 @@
 // | =E2=95=9A=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=
=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=
=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=
=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=
=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=
=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=
=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=
=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=9D |
 // +-------------------------------------------------------------------+

-mixer_window::mixer_window(mixer & mixer, connector & connector)
+mixer_window::mixer_window(mixer & mixer, connector & connector,
+    int & fade_value )
     : mixer_(mixer),
       connector_(connector),
       file_menu_item_(gettext("_File"), true),
@@ -149,7 +150,7 @@ mixer_window::mixer_window(mixer & mixer,
connector & connector)
         sigc::mem_fun(this, &mixer_window::begin_fade));
     fade_button_.show();

-    fade_value_.set_value(2000.0);
+    fade_value_.set_value(fade_value);
     fade_value_.set_sensitive(false);
     fade_value_.show();

diff --git a/src/mixer_window.hpp b/src/mixer_window.hpp
index 8d70f41..d14855b 100644
--- a/src/mixer_window.hpp
+++ b/src/mixer_window.hpp
@@ -38,7 +38,7 @@ class connector;
 class mixer_window : public Gtk::Window, public mixer::monitor
 {
 public:
-    mixer_window(mixer & mixer, connector & connector);
+    mixer_window(mixer & mixer, connector & connector, int & fade_value);
     ~mixer_window();

 private:
--=20
1.7.1


--=20
Carl K



More information about the dvswitch-devel mailing list