Credit Andrew - fix vorbis audio which was scratchy and ensure aging plugin does...
[goodguy/cinelerra.git] / cinelerra-5.1 / guicast / bcbutton.C
index 6d0c4349da01c57e8e03f8884865e35c7ea0307e..00eb8cb716015c84c6f73e13b468b184ab44aafe 100644 (file)
@@ -254,22 +254,22 @@ int BC_Button::get_status()
 
 BC_OKButton::BC_OKButton(int x, int y)
  : BC_Button(x, y,
-       BC_WindowBase::get_resources()->ok_images)
+       BC_WindowBase::get_resources()->ok_images)
 {
 }
 
 BC_OKButton::BC_OKButton(BC_WindowBase *parent_window, VFrame **images)
- : BC_Button(10,
-       parent_window->get_h() - images[0]->get_h() - 10,
-       images)
+ : BC_Button(xS(10),
+       parent_window->get_h() - images[0]->get_h() - yS(10),
+       images)
 {
        set_tooltip(_("OK"));
 }
 
 BC_OKButton::BC_OKButton(BC_WindowBase *parent_window)
- : BC_Button(10,
-       parent_window->get_h() - BC_WindowBase::get_resources()->ok_images[0]->get_h() - 10,
-       BC_WindowBase::get_resources()->ok_images)
+ : BC_Button(xS(10),
+       parent_window->get_h() - BC_WindowBase::get_resources()->ok_images[0]->get_h() - yS(10),
+       BC_WindowBase::get_resources()->ok_images)
 {
        set_tooltip(_("OK"));
 }
@@ -282,15 +282,15 @@ int BC_OKButton::handle_event()
 
 int BC_OKButton::resize_event(int w, int h)
 {
-       reposition_window(10,
-               h - BC_WindowBase::get_resources()->cancel_images[0]->get_h() - 10);
+       reposition_window(xS(10),
+               h - BC_WindowBase::get_resources()->cancel_images[0]->get_h() - yS(10));
        return 1;
 }
 
 int BC_OKButton::keypress_event()
 {
        if(get_keypress() == RETURN) return handle_event();
-       return 0;
+       return context_help_check_and_show();
 }
 
 int BC_OKButton::calculate_h()
@@ -317,23 +317,23 @@ int BC_OKButton::calculate_w()
 
 BC_CancelButton::BC_CancelButton(int x, int y)
  : BC_Button(x, y,
-       BC_WindowBase::get_resources()->cancel_images)
+       BC_WindowBase::get_resources()->cancel_images)
 {
        set_tooltip(_("Cancel"));
 }
 
 BC_CancelButton::BC_CancelButton(BC_WindowBase *parent_window)
- : BC_Button(parent_window->get_w() - BC_WindowBase::get_resources()->cancel_images[0]->get_w() - 10,
-       parent_window->get_h() - BC_WindowBase::get_resources()->cancel_images[0]->get_h() - 10,
-       BC_WindowBase::get_resources()->cancel_images)
+ : BC_Button(parent_window->get_w() - BC_WindowBase::get_resources()->cancel_images[0]->get_w() - xS(10),
+       parent_window->get_h() - BC_WindowBase::get_resources()->cancel_images[0]->get_h() - yS(10),
+       BC_WindowBase::get_resources()->cancel_images)
 {
        set_tooltip(_("Cancel"));
 }
 
 BC_CancelButton::BC_CancelButton(BC_WindowBase *parent_window, VFrame **images)
- : BC_Button(parent_window->get_w() - images[0]->get_w() - 10,
-       parent_window->get_h() - images[0]->get_h() - 10,
-       images)
+ : BC_Button(parent_window->get_w() - images[0]->get_w() - xS(10),
+       parent_window->get_h() - images[0]->get_h() - yS(10),
+       images)
 {
        set_tooltip(_("Cancel"));
 }
@@ -346,15 +346,15 @@ int BC_CancelButton::handle_event()
 
 int BC_CancelButton::resize_event(int w,int h)
 {
-       reposition_window(w - BC_WindowBase::get_resources()->cancel_images[0]->get_w() - 10,
-               h - BC_WindowBase::get_resources()->cancel_images[0]->get_h() - 10);
+       reposition_window(w - BC_WindowBase::get_resources()->cancel_images[0]->get_w() - xS(10),
+               h - BC_WindowBase::get_resources()->cancel_images[0]->get_h() - yS(10));
        return 1;
 }
 
 int BC_CancelButton::keypress_event()
 {
        if(get_keypress() == ESC) return handle_event();
-       return 0;
+       return context_help_check_and_show();
 }
 
 int BC_CancelButton::calculate_h()
@@ -480,13 +480,17 @@ int BC_GenericButton::draw_face(int flush)
        return 0;
 }
 
-
+void BC_GenericButton::set_text(const char *cp)
+{
+       strncpy(text, cp, sizeof(text));
+       draw_face();
+}
 
 
 
 BC_OKTextButton::BC_OKTextButton(BC_WindowBase *parent_window)
- : BC_GenericButton(10,
-       parent_window->get_h() - BC_GenericButton::calculate_h() - 10,
+ : BC_GenericButton(xS(10),
+       parent_window->get_h() - BC_GenericButton::calculate_h() - yS(10),
        _("OK"))
 {
        this->parent_window = parent_window;
@@ -494,8 +498,8 @@ BC_OKTextButton::BC_OKTextButton(BC_WindowBase *parent_window)
 
 int BC_OKTextButton::resize_event(int w, int h)
 {
-       reposition_window(10,
-               parent_window->get_h() - BC_GenericButton::calculate_h() - 10);
+       reposition_window(xS(10),
+               parent_window->get_h() - BC_GenericButton::calculate_h() - yS(10));
        return 1;
 }
 
@@ -508,14 +512,14 @@ int BC_OKTextButton::handle_event()
 int BC_OKTextButton::keypress_event()
 {
        if(get_keypress() == RETURN) return handle_event();
-       return 0;
+       return context_help_check_and_show();
 }
 
 
 
 BC_CancelTextButton::BC_CancelTextButton(BC_WindowBase *parent_window)
- : BC_GenericButton(parent_window->get_w() - BC_GenericButton::calculate_w(parent_window, _("Cancel")) - 10,
-       parent_window->get_h() - BC_GenericButton::calculate_h() - 10,
+ : BC_GenericButton(parent_window->get_w() - BC_GenericButton::calculate_w(parent_window, _("Cancel")) - xS(10),
+       parent_window->get_h() - BC_GenericButton::calculate_h() - yS(10),
        _("Cancel"))
 {
        this->parent_window = parent_window;
@@ -523,8 +527,8 @@ BC_CancelTextButton::BC_CancelTextButton(BC_WindowBase *parent_window)
 
 int BC_CancelTextButton::resize_event(int w, int h)
 {
-       reposition_window(parent_window->get_w() - BC_GenericButton::calculate_w(parent_window, _("Cancel")) - 10,
-               parent_window->get_h() - BC_GenericButton::calculate_h() - 10);
+       reposition_window(parent_window->get_w() - BC_GenericButton::calculate_w(parent_window, _("Cancel")) - xS(10),
+               parent_window->get_h() - BC_GenericButton::calculate_h() - yS(10));
        return 1;
 }
 
@@ -537,7 +541,7 @@ int BC_CancelTextButton::handle_event()
 int BC_CancelTextButton::keypress_event()
 {
        if(get_keypress() == ESC) return handle_event();
-       return 0;
+       return context_help_check_and_show();
 }