dynamic keyframes, textbox rework, andrea ffmpeg.opts, perpetual chkpt undo, lv2...
[goodguy/history.git] / cinelerra-5.1 / plugins / titler / titlerwindow.C
index 175101185fa8e8301fe99a84264caa158bcd0361..bddb7993bdb845162de47d773e6454d01b847865 100644 (file)
@@ -105,7 +105,6 @@ TitleWindow::TitleWindow(TitleMain *client)
        text_title = 0;
        text = 0;
        text_chars = 0;
-       text_bfrsz = 0;
        justify_title = 0;
        left = 0;  center = 0;  right = 0;
        top = 0;   mid = 0;     bottom = 0;
@@ -399,8 +398,6 @@ void TitleWindow::create_objects()
        x += text_title->get_w() + 20;
        int wid = BC_Title::calculate_w(this,"0")*10;
        add_tool(text_chars = new TitleTextChars(x,y,wid));
-       x += text_chars->get_w() + 20;
-       add_tool(text_bfrsz = new TitleTextBfrSz(x,y,wid));
 
        y += text_title->get_h() + margin;
        x = margin;
@@ -569,9 +566,6 @@ void TitleWindow::update_justification()
 void TitleWindow::update_stats()
 {
        text_chars->update(client->config.wlen);
-       int len = MESSAGESIZE - BCTEXTLEN - strlen(text->get_text()) - 1;
-       if( len < 0 ) len = 0;
-       text_bfrsz->update(len);
 }
 
 void TitleWindow::update()
@@ -591,7 +585,7 @@ void TitleWindow::update()
        fade_out->update((float)client->config.fade_out);
        font->update(client->config.font);
        check_style(client->config.font,0);
-       text->update(&client->config.wtext[0]);
+       text->update(client->config.wtext ? &client->config.wtext[0] : L"");
        speed->update(client->config.pixels_per_second);
        outline->update((int64_t)client->config.outline_size);
 #ifdef USE_STROKER
@@ -952,7 +946,7 @@ TitleText::TitleText(TitleMain *client, TitleWindow *window,
        int x, int y, int w, int h)
  : BC_ScrollTextBox(window, x, y, w,
                BC_TextBox::pixels_to_rows(window, MEDIUMFONT, h),
-               client->config.wtext, 8192)
+               client->config.wtext, 0)
 {
        this->client = client;
        this->window = window;
@@ -972,22 +966,11 @@ int TitleText::button_press_event()
 int TitleText::handle_event()
 {
        window->fonts_popup->deactivate();
-       int text_len = strlen(get_text());
-       int avail = MESSAGESIZE - BCTEXTLEN;
-       if( text_len >= avail ) { // back off last utf8 char
-               char text[2*sizeof(client->config.wtext)];
-               strcpy(text, get_text());
-               text_len = avail;
-               while( text_len > 0 && (text[text_len-1] & 0xc0) == 0x80 )
-                       text[--text_len] = 0;
-               if( text_len > 0 )
-                       text[--text_len] = 0;
-               update(text);
-       }
-       int len =  sizeof(client->config.wtext) / sizeof(wchar_t);
-       wcsncpy(client->config.wtext, get_wtext(), len);
-       client->config.wtext[len-1] = 0;
-       client->config.wlen = wcslen(client->config.wtext);
+       const wchar_t *wtext = get_wtext();
+       long wlen = wcslen(wtext);
+       client->config.demand(wlen);
+       wcsncpy(client->config.wtext, wtext, client->config.wsize);
+       client->config.wlen = wlen;
        window->update_stats();
        window->send_configure_change();
        return 1;
@@ -1006,20 +989,6 @@ int TitleTextChars::update(int n)
        return BC_Title::update(text, 0);
 }
 
-TitleTextBfrSz::TitleTextBfrSz(int x, int y, int w)
- : BC_Title(x, y, "", MEDIUMFONT, -1, 0, w)
-{
-}
-TitleTextBfrSz::~TitleTextBfrSz()
-{
-}
-int TitleTextBfrSz::update(int n)
-{
-       char text[BCSTRLEN];
-       sprintf(text, _("bfrsz: %d  "),n);
-       return BC_Title::update(text, 0);
-}
-
 
 TitleDropShadow::TitleDropShadow(TitleMain *client, TitleWindow *window, int x, int y)
  : BC_TumbleTextBox(window, client->config.dropshadow,