add layout_scale preference, scaling cleanup, rework init bc_resources, init tip_info...
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / preferencesthread.C
index 28b5ecc37c4975ec1b0c7972f097c92b006d58bb..23494e709b54e2c5bf5fba93c734bf5962e789ea 100644 (file)
@@ -64,8 +64,8 @@
 
 
 
-#define WIDTH 860
-#define HEIGHT 700
+#define WIDTH xS(860)
+#define HEIGHT yS(700)
 
 
 PreferencesMenuitem::PreferencesMenuitem(MWindow *mwindow)
@@ -125,7 +125,7 @@ BC_Window* PreferencesThread::new_gui()
        //int need_new_indexes = 0;
        rerender = 0;
 
-       mwindow->gui->lock_window("NewThread::new_gui");
+       mwindow->gui->lock_window("NewThread::new_gui");
        int scr_x = mwindow->gui->get_screen_x(0, -1);
        int scr_w = mwindow->gui->get_screen_w(0, -1);
        int scr_h = mwindow->gui->get_screen_h(0, -1);
@@ -174,10 +174,10 @@ int PreferencesThread::update_framerate()
 {
        if(thread_running)
        {
-               lock_gui("PreferencesThread::update_framerate");
+               lock_dialog("PreferencesThread::update_framerate");
                PreferencesWindow *window = (PreferencesWindow*)get_gui();
                if(window) window->update_framerate();
-               unlock_gui();
+               unlock_dialog();
        }
        return 0;
 }
@@ -187,10 +187,10 @@ void PreferencesThread::update_rates()
 {
        if(thread_running)
        {
-               lock_gui("PreferencesThread::update_framerate");
+               lock_dialog("PreferencesThread::update_framerate");
                PreferencesWindow *window = (PreferencesWindow*)get_gui();
                if(window) window->update_rates();
-               unlock_gui();
+               unlock_dialog();
        }
 }
 
@@ -212,6 +212,9 @@ int PreferencesThread::apply_settings()
                (*this_aconfig != *aconfig) || (*this_vconfig != *vconfig) ||
                !preferences->brender_asset->equivalent(*mwindow->preferences->brender_asset, 0, 1, edl);
 
+       if( preferences->autocolor_assets != mwindow->preferences->autocolor_assets )
+               redraw_indexes = 1;
+
        if( preferences->yuv_color_space != mwindow->preferences->yuv_color_space ||
            preferences->yuv_color_range != mwindow->preferences->yuv_color_range ) {
                YUV::yuv.yuv_set_colors(
@@ -234,6 +237,7 @@ int PreferencesThread::apply_settings()
        if( strcmp(preferences->theme, mwindow->preferences->theme) ||
            strcmp(preferences->plugin_icons, mwindow->preferences->plugin_icons) ||
            preferences->awindow_picon_h != mwindow->preferences->awindow_picon_h ||
+           preferences->layout_scale != mwindow->preferences->layout_scale ||
            preferences->vicon_size != mwindow->preferences->vicon_size ||
            preferences->vicon_color_mode != mwindow->preferences->vicon_color_mode )
                mwindow->restart_status = -1;  // reconstruct/restart program
@@ -270,7 +274,7 @@ int PreferencesThread::apply_settings()
 
 //edl->session->recording_format->dump();
 //mwindow->edl->session->recording_format->dump();
-
+#ifdef GLx4
        if(((mwindow->edl->session->output_w % 4) ||
                (mwindow->edl->session->output_h % 4)) &&
                mwindow->edl->session->playback_config->vconfig->driver == PLAYBACK_X11_GL)
@@ -279,7 +283,7 @@ int PreferencesThread::apply_settings()
                        _("This project's dimensions are not multiples of 4 so\n"
                        "it can't be rendered by OpenGL."));
        }
-
+#endif
 
        if(redraw_meters)
        {
@@ -343,9 +347,16 @@ int PreferencesThread::apply_settings()
 //printf("PreferencesThread::apply_settings 10\n");
        }
 
-       if(redraw_times || redraw_overlays)
+       if(redraw_indexes)
        {
                mwindow->gui->lock_window("PreferencesThread::apply_settings 4");
+               mwindow->gui->draw_trackmovement();
+               mwindow->gui->unlock_window();
+       }
+
+       if(redraw_times || redraw_overlays || redraw_indexes)
+       {
+               mwindow->gui->lock_window("PreferencesThread::apply_settings 5");
                mwindow->gui->flush();
                mwindow->gui->unlock_window();
        }
@@ -396,12 +407,6 @@ SET_TRACE
 }
 
 
-
-
-
-
-
-
 PreferencesWindow::PreferencesWindow(MWindow *mwindow,
        PreferencesThread *thread, int x, int y, int w, int h)
  : BC_Window(_(PROGRAM_NAME ": Preferences"), x,y, w,h,w,h, 1)
@@ -576,15 +581,6 @@ int PreferencesWindow::set_current_dialog(int number)
 }
 
 
-
-
-
-
-
-
-
-
-
 PreferencesButton::PreferencesButton(MWindow *mwindow,
        PreferencesThread *thread,
        int x,
@@ -606,19 +602,11 @@ int PreferencesButton::handle_event()
 }
 
 
-
-
-
-
-
-
-
 PreferencesDialog::PreferencesDialog(MWindow *mwindow,
        PreferencesWindow *pwindow)
- : BC_SubWindow(10,
-       40,
-       pwindow->get_w() - 20,
-       pwindow->get_h() - BC_GenericButton::calculate_h() - 10 - 40)
+ : BC_SubWindow(xS(10), yS(40),
+       pwindow->get_w() - xS(20),
+       pwindow->get_h() - BC_GenericButton::calculate_h() - yS(10 + 40))
 {
        this->pwindow = pwindow;
        this->mwindow = mwindow;
@@ -629,14 +617,12 @@ PreferencesDialog::~PreferencesDialog()
 {
 }
 
-// ============================== category window
-
-
 
+// ============================== category window
 
 PreferencesApply::PreferencesApply(MWindow *mwindow, PreferencesThread *thread)
  : BC_GenericButton(thread->window->get_w() / 2 - BC_GenericButton::calculate_w(thread->window, _("Apply")) / 2,
-       thread->window->get_h() - BC_GenericButton::calculate_h() - 10,
+       thread->window->get_h() - BC_GenericButton::calculate_h() - yS(10),
        _("Apply"))
 {
        this->mwindow = mwindow;
@@ -650,16 +636,14 @@ int PreferencesApply::handle_event()
 }
 int PreferencesApply::resize_event(int w, int h)
 {
-       reposition_window(w/2 - get_w()/2, h-get_h()-10);
+       reposition_window(w/2 - get_w()/2, h-get_h()-yS(10));
        return 1;
 }
 
 
-
-
 PreferencesOK::PreferencesOK(MWindow *mwindow, PreferencesThread *thread)
- : BC_GenericButton(10,
-       thread->window->get_h() - BC_GenericButton::calculate_h() - 10,
+ : BC_GenericButton(xS(10),
+       thread->window->get_h() - BC_GenericButton::calculate_h() - yS(10),
        _("OK"))
 {
        this->mwindow = mwindow;
@@ -681,16 +665,15 @@ int PreferencesOK::handle_event()
 }
 int PreferencesOK::resize_event(int w, int h)
 {
-       reposition_window(10, h-get_h()-10);
+       reposition_window(xS(10), h-get_h()-yS(10));
        return 1;
 }
 
 
-
 PreferencesCancel::PreferencesCancel(MWindow *mwindow, PreferencesThread *thread)
- : BC_GenericButton(thread->window->get_w() - BC_GenericButton::calculate_w(thread->window, _("Cancel")) - 10,
-       thread->window->get_h() - BC_GenericButton::calculate_h() - 10,
-       _("Cancel"))
+ : BC_GenericButton(thread->window->get_w() - BC_GenericButton::calculate_w(thread->window, _("Cancel")) - xS(10),
+       thread->window->get_h() - BC_GenericButton::calculate_h() - yS(10),
+       _("Cancel"))
 {
        this->mwindow = mwindow;
        this->thread = thread;
@@ -711,27 +694,16 @@ int PreferencesCancel::handle_event()
 }
 int PreferencesCancel::resize_event(int w, int h)
 {
-       reposition_window(w-get_w()-10, h-get_h()-10);
+       reposition_window(w-get_w()-xS(10), h-get_h()-yS(10));
        return 1;
 }
 
 
-
-
-
-
-
-
-
-
 PreferencesCategory::PreferencesCategory(MWindow *mwindow, PreferencesThread *thread, int x, int y)
  : BC_PopupTextBox(thread->window,
                &thread->window->categories,
                thread->category_to_text(thread->current_dialog),
-               x,
-               y,
-               200,
-               150)
+               x, y, xS(200), yS(150))
 {
        this->mwindow = mwindow;
        this->thread = thread;