+ProxyToggle::ProxyToggle(MWindow *mwindow, MButtons *mbuttons, int x, int y)
+ : BC_Toggle(x, y, mwindow->theme->proxy_toggle,
+ mwindow->edl->session->proxy_disabled_scale != 1)
+{
+ this->mwindow = mwindow;
+ this->mbuttons = mbuttons;
+ set_tooltip(mwindow->edl->session->proxy_disabled_scale==1 ?
+ _("Disable proxy") : _("Enable proxy"));
+}
+
+ProxyToggle::~ProxyToggle()
+{
+}
+
+int ProxyToggle::handle_event()
+{
+ int disabled = get_value();
+ if( disabled )
+ mwindow->disable_proxy();
+ else
+ mwindow->enable_proxy();
+ set_tooltip(!disabled ? _("Disable proxy") : _("Enable proxy"));
+ return 1;
+}
+
+int ProxyToggle::keypress_event()
+{
+ if( ctrl_down() && !shift_down() && !alt_down() ) {
+ int key = get_keypress();
+ if( key == 'r' ) {
+ int value = get_value() ? 0 : 1;
+ set_value(value);
+ return handle_event();
+ }
+ }
+ return 0;
+}
+