add BC_SCALE env var for hi def monitors, cleanup theme data
[goodguy/cinelerra.git] / cinelerra-5.1 / plugins / compressor / compressor.C
index 25eea16e5f6b0e74bc26bfb08d692cc7313db84e..486a498e4f3b13116c5b15e50cbb869950bd2f2d 100644 (file)
@@ -833,10 +833,10 @@ void CompressorConfig::optimize()
 
 CompressorWindow::CompressorWindow(CompressorEffect *plugin)
  : PluginClientWindow(plugin,
-       650,
-       480,
-       650,
-       480,
+       xS(650),
+       yS(480),
+       xS(650),
+       yS(480),
        0)
 {
        this->plugin = plugin;
@@ -844,45 +844,47 @@ CompressorWindow::CompressorWindow(CompressorEffect *plugin)
 
 void CompressorWindow::create_objects()
 {
-       int x = 35, y = 10;
-       int control_margin = 130;
+       int xs10 = xS(10), xs20 = xS(20), xs50 = xS(50), xs110 = xS(110);
+       int ys20 = yS(20), ys30 = yS(30), ys40 = yS(40), ys60 = yS(60), ys70 = yS(70);
+       int x = xS(35), y = yS(10);
+       int control_margin = xS(130);
 
        add_subwindow(canvas = new CompressorCanvas(plugin,
                x,
                y,
-               get_w() - x - control_margin - 10,
-               get_h() - y - 70));
+               get_w() - x - control_margin - xs10,
+               get_h() - y - ys70));
        canvas->set_cursor(CROSS_CURSOR, 0, 0);
        x = get_w() - control_margin;
        add_subwindow(new BC_Title(x, y, _("Reaction secs:")));
-       y += 20;
+       y += ys20;
        add_subwindow(reaction = new CompressorReaction(plugin, x, y));
-       y += 30;
+       y += ys30;
        add_subwindow(new BC_Title(x, y, _("Decay secs:")));
-       y += 20;
+       y += ys20;
        add_subwindow(decay = new CompressorDecay(plugin, x, y));
-       y += 30;
+       y += ys30;
        add_subwindow(new BC_Title(x, y, _("Trigger Type:")));
-       y += 20;
+       y += ys20;
        add_subwindow(input = new CompressorInput(plugin, x, y));
        input->create_objects();
-       y += 30;
+       y += ys30;
        add_subwindow(new BC_Title(x, y, _("Trigger:")));
-       y += 20;
+       y += ys20;
        add_subwindow(trigger = new CompressorTrigger(plugin, x, y));
        if(plugin->config.input != CompressorConfig::TRIGGER) trigger->disable();
-       y += 30;
+       y += ys30;
        add_subwindow(smooth = new CompressorSmooth(plugin, x, y));
-       y += 60;
+       y += ys60;
        add_subwindow(clear = new CompressorClear(plugin, x, y));
-       x = 10;
-       y = get_h() - 40;
+       x = xs10;
+       y = get_h() - ys40;
        add_subwindow(new BC_Title(x, y, _("Point:")));
-       x += 50;
+       x += xs50;
        add_subwindow(x_text = new CompressorX(plugin, x, y));
-       x += 110;
+       x += xs110;
        add_subwindow(new BC_Title(x, y, _("x")));
-       x += 20;
+       x += xs20;
        add_subwindow(y_text = new CompressorY(plugin, x, y));
        draw_scales();
 
@@ -908,8 +910,8 @@ void CompressorWindow::draw_scales()
 #define DIVISIONS 8
        for(int i = 0; i <= DIVISIONS; i++)
        {
-               int y = canvas->get_y() + 10 + canvas->get_h() / DIVISIONS * i;
-               int x = canvas->get_x() - 30;
+               int y = canvas->get_y() + yS(10) + canvas->get_h() / DIVISIONS * i;
+               int x = canvas->get_x() - xS(30);
                char string[BCTEXTLEN];
 
                sprintf(string, "%.0f", (float)i / DIVISIONS * plugin->config.min_db);
@@ -922,12 +924,12 @@ void CompressorWindow::draw_scales()
                        y = y1 + (y2 - y1) * j / 10;
                        if(j == 0)
                        {
-                               draw_line(canvas->get_x() - 10, y, canvas->get_x(), y);
+                               draw_line(canvas->get_x() - xS(10), y, canvas->get_x(), y);
                        }
                        else
                        if(i < DIVISIONS)
                        {
-                               draw_line(canvas->get_x() - 5, y, canvas->get_x(), y);
+                               draw_line(canvas->get_x() - xS(5), y, canvas->get_x(), y);
                        }
                }
        }
@@ -935,8 +937,8 @@ void CompressorWindow::draw_scales()
 
        for(int i = 0; i <= DIVISIONS; i++)
        {
-               int y = canvas->get_h() + 30;
-               int x = canvas->get_x() + (canvas->get_w() - 10) / DIVISIONS * i;
+               int y = canvas->get_h() + yS(30);
+               int x = canvas->get_x() + (canvas->get_w() - xS(10)) / DIVISIONS * i;
                char string[BCTEXTLEN];
 
                sprintf(string, "%.0f", (1.0 - (float)i / DIVISIONS) * plugin->config.min_db);
@@ -949,12 +951,12 @@ void CompressorWindow::draw_scales()
                        x = x1 + (x2 - x1) * j / 10;
                        if(j == 0)
                        {
-                               draw_line(x, canvas->get_y() + canvas->get_h(), x, canvas->get_y() + canvas->get_h() + 10);
+                               draw_line(x, canvas->get_y() + canvas->get_h(), x, canvas->get_y() + canvas->get_h() + yS(10));
                        }
                        else
                        if(i < DIVISIONS)
                        {
-                               draw_line(x, canvas->get_y() + canvas->get_h(), x, canvas->get_y() + canvas->get_h() + 5);
+                               draw_line(x, canvas->get_y() + canvas->get_h(), x, canvas->get_y() + canvas->get_h() + yS(5));
                        }
                }
        }
@@ -995,7 +997,7 @@ void CompressorWindow::update_textboxes()
        }
 }
 
-#define POINT_W 10
+#define POINT_W xS(10)
 void CompressorWindow::update_canvas()
 {
        canvas->clear_box(0, 0, canvas->get_w(), canvas->get_h());
@@ -1192,7 +1194,7 @@ int CompressorCanvas::cursor_motion_event()
 
 
 CompressorReaction::CompressorReaction(CompressorEffect *plugin, int x, int y)
- : BC_TextBox(x, y, 100, 1, (float)plugin->config.reaction_len)
+ : BC_TextBox(x, y, xS(100), 1, (float)plugin->config.reaction_len)
 {
        this->plugin = plugin;
 }
@@ -1226,7 +1228,7 @@ int CompressorReaction::button_press_event()
 }
 
 CompressorDecay::CompressorDecay(CompressorEffect *plugin, int x, int y)
- : BC_TextBox(x, y, 100, 1, (float)plugin->config.decay_len)
+ : BC_TextBox(x, y, xS(100), 1, (float)plugin->config.decay_len)
 {
        this->plugin = plugin;
 }
@@ -1261,7 +1263,7 @@ int CompressorDecay::button_press_event()
 
 
 CompressorX::CompressorX(CompressorEffect *plugin, int x, int y)
- : BC_TextBox(x, y, 100, 1, "")
+ : BC_TextBox(x, y, xS(100), 1, "")
 {
        this->plugin = plugin;
 }
@@ -1280,7 +1282,7 @@ int CompressorX::handle_event()
 
 
 CompressorY::CompressorY(CompressorEffect *plugin, int x, int y)
- : BC_TextBox(x, y, 100, 1, "")
+ : BC_TextBox(x, y, xS(100), 1, "")
 {
        this->plugin = plugin;
 }
@@ -1301,7 +1303,7 @@ int CompressorY::handle_event()
 
 
 CompressorTrigger::CompressorTrigger(CompressorEffect *plugin, int x, int y)
- : BC_TextBox(x, y, (int64_t)100, (int64_t)1, (int64_t)plugin->config.trigger)
+ : BC_TextBox(x, y, xS(100), 1, (int64_t)plugin->config.trigger)
 {
        this->plugin = plugin;
 }
@@ -1340,7 +1342,7 @@ int CompressorTrigger::button_press_event()
 CompressorInput::CompressorInput(CompressorEffect *plugin, int x, int y)
  : BC_PopupMenu(x,
        y,
-       100,
+       xS(100),
        CompressorInput::value_to_text(plugin->config.input),
        1)
 {