additional Andrew provided Termux mods +
[goodguy/cinelerra.git] / cinelerra-5.1 / guicast / bcpan.C
index d8bce87265d3cf6622c480adee4e538053dda272..d6da6081d59157ed7facbfcc6bae7ca7f094d07b 100644 (file)
 #include <math.h>
 #include <string.h>
 
-BC_Pan::BC_Pan(int x,
-               int y,
-               int virtual_r,
-               float maxvalue,
-               int total_values,
-               int *value_positions,
-               int stick_x,
-               int stick_y,
-               float *values)
+BC_Pan::BC_Pan(int x, int y, int virtual_r,
+               float maxvalue, int total_values, int *value_positions,
+               int stick_x, int stick_y, float *values)
  : BC_SubWindow(x, y, -1, -1, -1)
 {
        this->virtual_r = virtual_r;
@@ -69,29 +63,24 @@ BC_Pan::BC_Pan(int x,
                        this->stick_x,
                        this->stick_y);
        highlighted = 0;
-       popup = 0;
        active = 0;
+       temp_channel = 0;
+       rotater = 0;
+       popup = 0;
        memset(images, 0, sizeof(BC_Pixmap*) * PAN_IMAGES);
 }
 
 BC_Pan::~BC_Pan()
 {
-//printf("BC_Pan::~BC_Pan 1\n");
        delete [] values;
-//printf("BC_Pan::~BC_Pan 1\n");
        delete [] value_positions;
-//printf("BC_Pan::~BC_Pan 1\n");
        delete [] value_x;
-//printf("BC_Pan::~BC_Pan 1\n");
        delete [] value_y;
-//printf("BC_Pan::~BC_Pan 1\n");
-       if(popup) delete popup;
-//printf("BC_Pan::~BC_Pan 1\n");
+       delete popup;
        delete temp_channel;
-//printf("BC_Pan::~BC_Pan 1\n");
        delete rotater;
-       for(int i = 0; i < PAN_IMAGES; i++)
-               if(images[i]) delete images[i];
+       for( int i=0; i<PAN_IMAGES; ++i )
+               delete images[i];
 //printf("BC_Pan::~BC_Pan 2\n");
 }
 
@@ -102,18 +91,11 @@ int BC_Pan::initialize()
        BC_SubWindow::initialize();
        temp_channel = new VFrame;
        temp_channel->set_use_shm(0);
-       temp_channel->reallocate(0,
-               -1,
-               0,
-               0,
-               0,
+       temp_channel->reallocate(0, -1, 0, 0, 0,
                get_resources()->pan_data[PAN_CHANNEL]->get_w(),
                get_resources()->pan_data[PAN_CHANNEL]->get_h(),
                get_resources()->pan_data[PAN_CHANNEL]->get_color_model(),
                -1);
-       rotater = new RotateFrame(1,
-               get_resources()->pan_data[PAN_CHANNEL]->get_w(),
-               get_resources()->pan_data[PAN_CHANNEL]->get_h());
        draw(1, 0);
        return 0;
 }
@@ -227,8 +209,8 @@ int BC_Pan::cursor_leave_event()
 
 int BC_Pan::deactivate()
 {
-       if(popup) delete popup;
-       popup = 0;
+       delete popup;    popup = 0;
+       delete rotater;  rotater = 0;
        active = 0;
        return 0;
 }
@@ -241,14 +223,8 @@ int BC_Pan::activate(int popup_x, int popup_y)
        active = 0;
        if (popup_x < 0 || popup_y < 0)
        {
-               XTranslateCoordinates(top_level->display,
-                       win,
-                       top_level->rootwin,
-                       0,
-                       0,
-                       &x,
-                       &y,
-                       &tempwin);
+               XTranslateCoordinates(top_level->display, win,
+                       top_level->rootwin, 0, 0, &x, &y, &tempwin);
 
                x -= (images[PAN_POPUP]->get_w() - get_w()) / 2;
                y -= (images[PAN_POPUP]->get_h() - get_h()) / 2;
@@ -263,6 +239,10 @@ int BC_Pan::activate(int popup_x, int popup_y)
                if (x < 0) x = 0;
        }
 
+       rotater = new RotateFrame(1,
+               get_resources()->pan_data[PAN_CHANNEL]->get_w(),
+               get_resources()->pan_data[PAN_CHANNEL]->get_h());
+
        delete popup;
        popup = new BC_Popup(this, x, y,
                                images[PAN_POPUP]->get_w(),
@@ -326,8 +306,8 @@ void BC_Pan::draw_popup()
        popup->flash();
 }
 
-#define PICON_W 6
-#define PICON_H 6
+#define PICON_W xS(6)
+#define PICON_H yS(6)
 
 void BC_Pan::draw(int flash, int flush)
 {