descratch again reworked + icons, add agingtv plugin params, add alias chkbox in...
[goodguy/history.git] / cinelerra-5.1 / plugins / titler / titlerwindow.C
index ada5a6a5354060f631a2f3e1f1f91c51d6f8f881..d3f20d2a651e2b46cc77cebc67285ccb61903cba 100644 (file)
@@ -266,6 +266,9 @@ void TitleWindow::create_objects()
                        eprintf("drag enabled, but compositor already grabbed\n");
        }
 
+       add_tool(alias = new TitleAlias(client, this, x, y+110));
+       if( alias->get_w() > w1 ) w1 = drag->get_w();
+
        x += w1 + margin;
        add_tool(justify_title = new BC_Title(x, y, _("Justify:")));
        add_tool(left = new TitleLeft(client, this, x, y + 20));
@@ -337,9 +340,9 @@ void TitleWindow::create_objects()
        if( fade_out->get_w() > w1 ) w1 = fade_out->get_w();
        x += w1 + margin;
 
-       add_tool(speed_title = new BC_Title(x, y1=y, _("Speed:")));
+       add_tool(speed_title = new BC_Title(x, y, _("Speed:")));
        w1 = speed_title->get_w();
-       y += speed_title->get_h() + 5;
+       y += speed_title->get_h() + 5;  y1 = y;
        speed = new TitleSpeed(client, this, x, y);
        speed->create_objects();
        if( speed->get_w() > w1 ) w1 = speed->get_w();
@@ -433,6 +436,7 @@ int TitleWindow::resize_event(int w, int h)
        italic->reposition_window(italic->get_x(), italic->get_y());
        bold->reposition_window(bold->get_x(), bold->get_y());
        drag->reposition_window(drag->get_x(), drag->get_y());
+       alias->reposition_window(alias->get_x(), alias->get_y());
        size_title->reposition_window(size_title->get_x(), size_title->get_y());
        size->reposition_window(size->get_x(), size->get_y());
        size_tumbler->reposition_window(size_tumbler->get_x(), size_tumbler->get_y());
@@ -734,6 +738,7 @@ void TitleWindow::update()
        title_h->update((int64_t)client->config.title_h);
        italic->update(client->config.style & BC_FONT_ITALIC);
        bold->update(client->config.style & BC_FONT_BOLD);
+       alias->update(client->config.style & FONT_ALIAS);
        size->update(client->config.size);
        motion->update(TitleMain::motion_to_text(client->config.motion_strategy));
        loop->update(client->config.loop);
@@ -841,6 +846,22 @@ int TitleSizeTumble::handle_down_event()
        return 1;
 }
 
+TitleAlias::TitleAlias(TitleMain *client, TitleWindow *window, int x, int y)
+ : BC_CheckBox(x, y, client->config.style & FONT_ALIAS, _("Alias"))
+{
+       this->client = client;
+       this->window = window;
+}
+
+int TitleAlias::handle_event()
+{
+       client->config.style =
+               (client->config.style & ~FONT_ALIAS) |
+                       (get_value() ? FONT_ALIAS : 0);
+       window->send_configure_change();
+       return 1;
+}
+
 TitleBold::TitleBold(TitleMain *client, TitleWindow *window, int x, int y)
  : BC_CheckBox(x, y, client->config.style & BC_FONT_BOLD, _("Bold"))
 {
@@ -1158,8 +1179,8 @@ int TitleTextBfrSz::update(int n)
 
 
 TitleDropShadow::TitleDropShadow(TitleMain *client, TitleWindow *window, int x, int y)
- : BC_TumbleTextBox(window, (int64_t)client->config.dropshadow,
-       (int64_t)-1000, (int64_t)1000, x, y, 70)
+ : BC_TumbleTextBox(window, client->config.dropshadow,
+               -1000, 1000, x, y, 70)
 {
        this->client = client;
        this->window = window;
@@ -1173,26 +1194,28 @@ int TitleDropShadow::handle_event()
 
 
 TitleOutline::TitleOutline(TitleMain *client, TitleWindow *window, int x, int y)
- : BC_TumbleTextBox(window, (int64_t)client->config.outline_size,
-       (int64_t)0, (int64_t)1000, x, y, 70)
+ : BC_TumbleTextBox(window, client->config.outline_size,
+               0.f, 1000.f, x, y, 70)
 {
        this->client = client;
        this->window = window;
+       set_precision(1);
 }
 int TitleOutline::handle_event()
 {
-       client->config.outline_size = atol(get_text());
+       client->config.outline_size = atof(get_text());
        window->send_configure_change();
        return 1;
 }
 
 
 TitleStroker::TitleStroker(TitleMain *client, TitleWindow *window, int x, int y)
- : BC_TumbleTextBox(window, (int64_t)client->config.stroke_width,
-       (int64_t)0, (int64_t)1000, x, y, 70)
+ : BC_TumbleTextBox(window, client->config.stroke_width,
+               0.f, 1000.f, x, y, 70)
 {
        this->client = client;
        this->window = window;
+       set_precision(1);
 }
 int TitleStroker::handle_event()
 {
@@ -1207,36 +1230,38 @@ int TitleStroker::handle_event()
 
 
 TitleX::TitleX(TitleMain *client, TitleWindow *window, int x, int y)
- : BC_TumbleTextBox(window, (int64_t)client->config.title_x,
-       (int64_t)-32767, (int64_t)32767, x, y, 50)
+ : BC_TumbleTextBox(window, client->config.title_x,
+               -32767.f, 32767.f, x, y, 50)
 {
        this->client = client;
        this->window = window;
+       set_precision(1);
 }
 int TitleX::handle_event()
 {
-       client->config.title_x = atol(get_text());
+       client->config.title_x = atof(get_text());
        window->send_configure_change();
        return 1;
 }
 
 TitleY::TitleY(TitleMain *client, TitleWindow *window, int x, int y)
- : BC_TumbleTextBox(window, (int64_t)client->config.title_y,
-       (int64_t)-32767, (int64_t)32767, x, y, 50)
+ : BC_TumbleTextBox(window, client->config.title_y,
+               -32767.f, 32767.f, x, y, 50)
 {
        this->client = client;
        this->window = window;
+       set_precision(1);
 }
 int TitleY::handle_event()
 {
-       client->config.title_y = atol(get_text());
+       client->config.title_y = atof(get_text());
        window->send_configure_change();
        return 1;
 }
 
 TitleW::TitleW(TitleMain *client, TitleWindow *window, int x, int y)
- : BC_TumbleTextBox(window, (int64_t)client->config.title_w,
-       (int64_t)0, (int64_t)32767, x, y, 50)
+ : BC_TumbleTextBox(window, client->config.title_w,
+               0, 32767, x, y, 50)
 {
        this->client = client;
        this->window = window;
@@ -1249,8 +1274,8 @@ int TitleW::handle_event()
 }
 
 TitleH::TitleH(TitleMain *client, TitleWindow *window, int x, int y)
- : BC_TumbleTextBox(window, (int64_t)client->config.title_h,
-       (int64_t)0, (int64_t)32767, x, y, 50)
+ : BC_TumbleTextBox(window, client->config.title_h,
+               0, 32767, x, y, 50)
 {
        this->client = client;
        this->window = window;
@@ -1263,8 +1288,8 @@ int TitleH::handle_event()
 }
 
 TitleSpeed::TitleSpeed(TitleMain *client, TitleWindow *window, int x, int y)
- : BC_TumbleTextBox(window, (float)client->config.pixels_per_second,
-       (float)0, (float)1000, x, y, 100)
+ : BC_TumbleTextBox(window, client->config.pixels_per_second,
+               0.f, 1000.f, x, y, 100)
 {
        this->client = client;
        this->window = window;
@@ -1549,6 +1574,11 @@ void TitleCurPopup::create_objects()
        sub_menu->add_subitem("%s 10",item);
        sub_menu->add_subitem("%s 0",item);
        sub_menu->add_subitem("/%s",item);
+       add_item(cur_item = new TitleCurItem(this, item = KW_ALIAS));
+       cur_item->add_submenu(sub_menu = new TitleCurSubMenu(cur_item));
+       sub_menu->add_subitem("%s 1",item);
+       sub_menu->add_subitem("%s 0",item);
+       sub_menu->add_subitem("/%s",item);
        add_item(cur_item = new TitleCurItem(this, item = KW_SUP));
        cur_item->add_submenu(sub_menu = new TitleCurSubMenu(cur_item));
        sub_menu->add_subitem("%s 1",item);