port 7.2 mods: align_edits foreground plugin refresh_frame tweak, rework soundlevel...
[goodguy/cinelerra.git] / cinelerra-5.1 / plugins / titler / titler.C
index 4bd0b69b3f5c63ce454e5cd8355f91316b644208..88d65015adf738f85329fcf7ebb1aaedfb243380 100644 (file)
@@ -105,8 +105,8 @@ TitleConfig::TitleConfig()
        wtext = 0;  wsize = 0;  wlen = 0;
        title_x = title_y = 0.0;
        title_w = title_h = 0;
-       window_w = 860;
-       window_h = 460;
+       window_w = xS(860);
+       window_h = yS(460);
        next_keyframe_position = 0;
        prev_keyframe_position = 0;
        timecode = 0;
@@ -146,7 +146,7 @@ int TitleConfig::equivalent(TitleConfig &that)
 //             EQUIV(pixels_per_second, that.pixels_per_second) &&
                wlen == that.wlen &&
                !memcmp(wtext, that.wtext, wlen * sizeof(wchar_t)) &&
-//             title_x == that.title_x && title_y == that.title_y &&
+               title_x == that.title_x && title_y == that.title_y &&
                title_w == that.title_w && title_h == that.title_h &&
 //             window_w == that.window_w && window_h == that.window_h &&
                timecode == that.timecode &&
@@ -362,14 +362,14 @@ printf("GlyphUnit::process_package 1 glyph not found (%s) %04x, '%c'\n",
                        glyph->right = 0;  glyph->bottom = 0;
                        glyph->freetype_index = 0;
                        glyph->data = new VFrame(glyph->width, glyph->height, BC_A8, glyph->pitch);
-                       glyph->data->clear_frame();
+                       glyph->data->black_frame();
                        glyph->data_stroke = 0;
 
 // create outline glyph
                        if( plugin->config.stroke_width >= SMALL &&
                                (plugin->config.style & BC_FONT_OUTLINE) ) {
                                glyph->data_stroke = new VFrame(glyph->width, glyph->height, BC_A8, glyph->pitch);
-                               glyph->data_stroke->clear_frame();
+                               glyph->data_stroke->black_frame();
                        }
                }
 // char found and no outline desired
@@ -399,7 +399,7 @@ printf("GlyphUnit::process_package 1 glyph not found (%s) %04x, '%c'\n",
 //glyph->width, glyph->height, glyph->pitch, glyph->left, glyph->top, glyph->advance_x, glyph->freetype_index);
 
                        glyph->data = new VFrame(glyph->width, glyph->height, BC_A8, glyph->pitch);
-                       glyph->data->clear_frame();
+                       glyph->data->black_frame();
                        bm.buffer = glyph->data->get_data();
                        ft_Outline_Translate(&((FT_OutlineGlyph) glyph_image)->outline,
                                - bbox.xMin, - bbox.yMin);
@@ -500,9 +500,9 @@ printf("GlyphUnit::process_package 1 glyph not found (%s) %04x, '%c'\n",
 
 //printf("GlyphUnit::process_package 1\n");
                        glyph->data = new VFrame(glyph->width, glyph->height, BC_A8, glyph->pitch);
-                       glyph->data->clear_frame();
+                       glyph->data->black_frame();
                        glyph->data_stroke = new VFrame(glyph->width, glyph->height, BC_A8, glyph->pitch);
-                       glyph->data_stroke->clear_frame();
+                       glyph->data_stroke->black_frame();
 // for debugging       memset( glyph->data_stroke->get_data(), 60, glyph->pitch * glyph->height);
                        bm.buffer=glyph->data->get_data();
                        ft_Outline_Get_Bitmap( freetype_library,
@@ -2148,7 +2148,7 @@ void TitleMain::draw_overlay()
 //printf("TitleMain::draw_overlay 1\n");
         fade = 1;
         if( !EQUIV(config.fade_in, 0) ) {
-               int64_t plugin_start = server->plugin->startproject;
+               int64_t plugin_start = get_startproject();
                int64_t fade_len = lroundf(config.fade_in * PluginVClient::project_frame_rate);
                int64_t fade_position = get_source_position() - plugin_start;
 
@@ -2157,7 +2157,7 @@ void TitleMain::draw_overlay()
                }
        }
         if( !EQUIV(config.fade_out, 0) ) {
-               int64_t plugin_end = server->plugin->startproject + server->plugin->length;
+               int64_t plugin_end = get_endproject();
                int64_t fade_len = lroundf(config.fade_out * PluginVClient::project_frame_rate);
                int64_t fade_position = plugin_end - get_source_position();
 
@@ -2459,15 +2459,14 @@ int TitleMain::process_realtime(VFrame *input_ptr, VFrame *output_ptr)
 
 void TitleMain::update_gui()
 {
-       if( thread ) {
-               int reconfigure = load_configuration();
-               if( reconfigure ) {
-                       TitleWindow *window = (TitleWindow*)thread->window;
-                       window->lock_window("TitleMain::update_gui");
-                       window->update();
-                       window->unlock_window();
-               }
+       if( !thread ) return;
+       thread->window->lock_window("TitleMain::update_gui");
+       TitleWindow *window = (TitleWindow*)thread->window;
+       if( load_configuration() ) {
+               window->update_gui();
+               window->flush();
        }
+       window->unlock_window();
 }
 
 int TitleMain::load_configuration()