From 6ff8b339d215bb1c2cef589fd7959aa2e1834105 Mon Sep 17 00:00:00 2001 From: Good Guy Date: Wed, 23 Oct 2019 17:13:42 -0600 Subject: [PATCH] add layout_scale preference, scaling cleanup, rework init bc_resources, init tip_info flag, fix suggestions popup segv, boobies --- cinelerra-5.1/cinelerra/appearanceprefs.C | 27 ++++ cinelerra-5.1/cinelerra/appearanceprefs.h | 11 ++ cinelerra-5.1/cinelerra/appearanceprefs.inc | 1 + cinelerra-5.1/cinelerra/awindowgui.C | 1 + cinelerra-5.1/cinelerra/confirmsave.C | 14 +- cinelerra-5.1/cinelerra/fileffmpeg.C | 4 + cinelerra-5.1/cinelerra/main.C | 25 ++- cinelerra-5.1/cinelerra/mainsession.C | 35 ++--- cinelerra-5.1/cinelerra/preferences.C | 4 + cinelerra-5.1/cinelerra/preferences.h | 1 + cinelerra-5.1/cinelerra/preferencesthread.C | 1 + cinelerra-5.1/cinelerra/recordbatches.C | 10 +- cinelerra-5.1/cinelerra/signalstatus.C | 2 +- cinelerra-5.1/cinelerra/timeentry.C | 2 +- cinelerra-5.1/cinelerra/timeentry.inc | 2 +- cinelerra-5.1/guicast/bclistbox.C | 5 +- cinelerra-5.1/guicast/bclistbox.h | 2 + cinelerra-5.1/guicast/bcresources.C | 26 +--- cinelerra-5.1/guicast/bcresources.h | 3 +- cinelerra-5.1/guicast/bcwindowbase.C | 146 ++++++++++-------- cinelerra-5.1/guicast/bcwindowbase.h | 4 +- cinelerra-5.1/guicast/errorbox.h | 6 +- cinelerra-5.1/plugins/blur/blurwindow.C | 4 +- cinelerra-5.1/plugins/decimate/decimate.C | 4 +- cinelerra-5.1/plugins/delayvideo/delayvideo.C | 8 +- .../denoiseseltempavg/seltempavgwindow.C | 58 +++---- cinelerra-5.1/plugins/descratch/descratch.C | 2 +- cinelerra-5.1/plugins/diffkey/diffkey.C | 6 +- cinelerra-5.1/plugins/edge/edgewindow.C | 4 +- cinelerra-5.1/plugins/framefield/framefield.C | 4 +- .../plugins/freezeframe/freezeframe.C | 2 +- cinelerra-5.1/plugins/histeq/histeq.C | 4 +- .../histogram_bezier/bistogramwindow.C | 4 +- .../plugins/interpolate/interpolate.C | 18 +-- cinelerra-5.1/plugins/invertvideo/invert.C | 2 +- cinelerra-5.1/plugins/ivtc/ivtcwindow.C | 4 +- cinelerra-5.1/plugins/loopvideo/loopvideo.C | 8 +- cinelerra-5.1/plugins/overlay/overlay.C | 7 +- .../plugins/perspective/perspective.C | 6 +- cinelerra-5.1/plugins/photoscale/photoscale.C | 4 +- cinelerra-5.1/plugins/radialblur/radialblur.C | 10 +- cinelerra-5.1/plugins/reroute/reroute.C | 4 +- .../plugins/reversevideo/reversevideo.C | 8 +- cinelerra-5.1/plugins/svg/svgwin.C | 9 +- 44 files changed, 289 insertions(+), 223 deletions(-) diff --git a/cinelerra-5.1/cinelerra/appearanceprefs.C b/cinelerra-5.1/cinelerra/appearanceprefs.C index 840dccc6..ddca255e 100644 --- a/cinelerra-5.1/cinelerra/appearanceprefs.C +++ b/cinelerra-5.1/cinelerra/appearanceprefs.C @@ -42,8 +42,10 @@ AppearancePrefs::AppearancePrefs(MWindow *mwindow, PreferencesWindow *pwindow) frames = 0; hex = 0; feet = 0; + layout_scale = 0; thumbnails = 0; thumbnail_size = 0; + vicon_size = 0; } AppearancePrefs::~AppearancePrefs() @@ -54,8 +56,10 @@ AppearancePrefs::~AppearancePrefs() delete frames; delete hex; delete feet; + delete layout_scale; delete thumbnails; delete thumbnail_size; + delete vicon_size; } @@ -92,6 +96,11 @@ void AppearancePrefs::create_objects() int x2 = x1 + xS(160), y2 = y; y = y1; + + add_subwindow(new BC_Title(x1, y, _("Layout Scale:"))); + layout_scale = new ViewLayoutScale(pwindow, this, x2, y); + layout_scale->create_objects(); + y += layout_scale->get_h() + ys5; add_subwindow(new BC_Title(x1, y, _("View thumbnail size:"))); thumbnail_size = new ViewThumbnailSize(pwindow, this, x2, y); thumbnail_size->create_objects(); @@ -422,6 +431,24 @@ int ViewPluginIconItem::handle_event() return 1; } +ViewLayoutScale::ViewLayoutScale(PreferencesWindow *pwindow, + AppearancePrefs *aprefs, int x, int y) + : BC_TumbleTextBox(aprefs, + pwindow->thread->preferences->layout_scale, + 0.f, 10.f, x, y, xS(80), 2) +{ + this->pwindow = pwindow; + this->aprefs = aprefs; + set_increment(0.1); +} + +int ViewLayoutScale::handle_event() +{ + float v = atof(get_text()); + pwindow->thread->preferences->layout_scale = v; + return 1; +} + ViewThumbnails::ViewThumbnails(int x, int y, diff --git a/cinelerra-5.1/cinelerra/appearanceprefs.h b/cinelerra-5.1/cinelerra/appearanceprefs.h index 4b705b2c..2099c054 100644 --- a/cinelerra-5.1/cinelerra/appearanceprefs.h +++ b/cinelerra-5.1/cinelerra/appearanceprefs.h @@ -47,6 +47,7 @@ public: TimeFormatFrames *frames; TimeFormatFeet *feet; TimeFormatSeconds *seconds; + ViewLayoutScale *layout_scale; ViewThumbnails *thumbnails; ViewThumbnailSize *thumbnail_size; ViewViconSize *vicon_size; @@ -170,6 +171,16 @@ public: ViewPluginIcons *popup; }; +class ViewLayoutScale : public BC_TumbleTextBox +{ +public: + ViewLayoutScale(PreferencesWindow *pwindow, + AppearancePrefs *aprefs, int x, int y); + int handle_event(); + AppearancePrefs *aprefs; + PreferencesWindow *pwindow; +}; + class ViewThumbnails : public BC_CheckBox { public: diff --git a/cinelerra-5.1/cinelerra/appearanceprefs.inc b/cinelerra-5.1/cinelerra/appearanceprefs.inc index c5e7daaa..644c2bc1 100644 --- a/cinelerra-5.1/cinelerra/appearanceprefs.inc +++ b/cinelerra-5.1/cinelerra/appearanceprefs.inc @@ -35,6 +35,7 @@ class ViewTheme; class ViewThemeItem; class ViewPluginIcons; class ViewPluginIconItem; +class ViewLayoutScale; class ViewThumbnails; class ViewThumbnailSize; class ViewViconSize; diff --git a/cinelerra-5.1/cinelerra/awindowgui.C b/cinelerra-5.1/cinelerra/awindowgui.C index 03c8f221..d5531ac0 100644 --- a/cinelerra-5.1/cinelerra/awindowgui.C +++ b/cinelerra-5.1/cinelerra/awindowgui.C @@ -1304,6 +1304,7 @@ AWindowGUI::AWindowGUI(MWindow *mwindow, AWindow *awindow) vicon_audio = 0; vicon_drawing = AVICON_FULL_PLAY; play_off = 0; + tip_info = 0; displayed_folder = AW_NO_FOLDER; new_folder_thread = 0; modify_folder_thread = 0; diff --git a/cinelerra-5.1/cinelerra/confirmsave.C b/cinelerra-5.1/cinelerra/confirmsave.C index 7fdc98da..02fa7bbc 100644 --- a/cinelerra-5.1/cinelerra/confirmsave.C +++ b/cinelerra-5.1/cinelerra/confirmsave.C @@ -84,13 +84,8 @@ int ConfirmSave::test_files(MWindow *mwindow, ArrayList *paths) } - - - - -#define CSW_W 320 -#define CSW_H 120 - +#define CSW_W xS(400) +#define CSW_H yS(150) ConfirmSaveWindow::ConfirmSaveWindow(MWindow *mwindow, ArrayList *list) @@ -144,8 +139,3 @@ int ConfirmSaveWindow::resize_event(int w, int h) return 1; } - - - - - diff --git a/cinelerra-5.1/cinelerra/fileffmpeg.C b/cinelerra-5.1/cinelerra/fileffmpeg.C index 2e812301..bfd7ed69 100644 --- a/cinelerra-5.1/cinelerra/fileffmpeg.C +++ b/cinelerra-5.1/cinelerra/fileffmpeg.C @@ -1649,7 +1649,9 @@ FFOptionsAudioDialog::~FFOptionsAudioDialog() void FFOptionsAudioDialog::update_options(const char *options) { + aud_config->lock_window("FFOptionsAudioDialog::update_options"); aud_config->audio_options->update(options); + aud_config->unlock_window(); } FFOptionsVideoDialog::FFOptionsVideoDialog(FFMPEGConfigVideo *vid_config) @@ -1664,7 +1666,9 @@ FFOptionsVideoDialog::~FFOptionsVideoDialog() void FFOptionsVideoDialog::update_options(const char *options) { + vid_config->lock_window("FFOptionsVideoDialog::update_options"); vid_config->video_options->update(options); + vid_config->unlock_window(); } diff --git a/cinelerra-5.1/cinelerra/main.C b/cinelerra-5.1/cinelerra/main.C index 6833425d..6e0b6d5e 100644 --- a/cinelerra-5.1/cinelerra/main.C +++ b/cinelerra-5.1/cinelerra/main.C @@ -121,6 +121,25 @@ public: long cin_timezone; +static float get_layout_scale() +{ + char config_path[BCTEXTLEN]; + sprintf(config_path,"%s/%s", File::get_config_path(), CONFIG_FILE); + FILE *fp = fopen(config_path,"r"); + if( !fp ) return 0; + float scale = 0; + char line[BCTEXTLEN]; + line[BCTEXTLEN-1] = 0; + while( fgets(line, BCTEXTLEN-1, fp) ) { + if( !strncmp(line, "LAYOUT_SCALE ",12+1) ) { + scale = atof(line+12); + break; + } + } + fclose(fp); + return scale; +} + int main(int argc, char *argv[]) { // handle command line arguments first @@ -258,7 +277,10 @@ int main(int argc, char *argv[]) } } - + float scale = operation == DO_GUI ? + get_layout_scale() : 1; + // runs XInitThreads + BC_WindowBase::init_resources(scale); if( operation == DO_GUI || operation == DO_DEAMON || operation == DO_DEAMON_FG || @@ -401,6 +423,7 @@ DISABLE_BUFFER filenames.remove_all_objects(); Units::finit(); + BC_WindowBase::finit_resources(); time_t et; time(&et); long dt = et - st; diff --git a/cinelerra-5.1/cinelerra/mainsession.C b/cinelerra-5.1/cinelerra/mainsession.C index 16a20fe8..e0a8a826 100644 --- a/cinelerra-5.1/cinelerra/mainsession.C +++ b/cinelerra-5.1/cinelerra/mainsession.C @@ -201,7 +201,7 @@ void MainSession::default_window_positions(int window_config) int border_bottom = display_info.get_bottom_border(); int dual_head = screens > 1 ? 1 : 0; - int left_w = 0, right_w = root_w; + int left_w = 0, left_h = 0, right_w = 0; int xin_screens = display_info.get_xinerama_screens(); if( xin_screens > 1 ) { dual_head = 1; @@ -210,7 +210,7 @@ void MainSession::default_window_positions(int window_config) if( display_info.xinerama_geometry(s, x, y, w, h) ) continue; if( !y && !x ) { - left_w = w; + left_w = w; left_h = h; break; } } @@ -229,14 +229,13 @@ void MainSession::default_window_positions(int window_config) root_w = right_w; } else { - // use same aspect ratio to compute left height root_w = left_w; - root_h = (root_w*root_h) / right_w; + root_h = left_h; } } } // Wider than 16:9, narrower than dual head - if( screens < 2 && (float)root_w / root_h > 1.8 ) { + else if( screens < 2 && (float)root_w / root_h > 1.8 ) { dual_head = 1; switch( root_h ) { case 600: right_w = 800; break; @@ -432,7 +431,7 @@ int MainSession::load_defaults(BC_Hash *defaults) //printf("MainSession::load_defaults 1\n"); // Other windows - afolders_w = defaults->get("ABINS_W", 200); + afolders_w = defaults->get("ABINS_W", xS(200)); bwindow_w = defaults->get("BWINDOW_W", bwindow_w); bwindow_h = defaults->get("BWINDOW_H", bwindow_h); @@ -470,19 +469,19 @@ int MainSession::load_defaults(BC_Hash *defaults) cwindow_controls = defaults->get("CWINDOW_CONTROLS", cwindow_controls); - plugindialog_w = defaults->get("PLUGINDIALOG_W", 510); - plugindialog_h = defaults->get("PLUGINDIALOG_H", 415); -// presetdialog_w = defaults->get("PRESETDIALOG_W", 510); -// presetdialog_h = defaults->get("PRESETDIALOG_H", 415); - keyframedialog_w = defaults->get("KEYFRAMEDIALOG_W", 320); - keyframedialog_h = defaults->get("KEYFRAMEDIALOG_H", 415); - keyframedialog_column1 = defaults->get("KEYFRAMEDIALOG_COLUMN1", 150); - keyframedialog_column2 = defaults->get("KEYFRAMEDIALOG_COLUMN2", 100); + plugindialog_w = defaults->get("PLUGINDIALOG_W", xS(510)); + plugindialog_h = defaults->get("PLUGINDIALOG_H", yS(415)); +// presetdialog_w = defaults->get("PRESETDIALOG_W", xS(510)); +// presetdialog_h = defaults->get("PRESETDIALOG_H", yS(415)); + keyframedialog_w = defaults->get("KEYFRAMEDIALOG_W", xS(320)); + keyframedialog_h = defaults->get("KEYFRAMEDIALOG_H", yS(415)); + keyframedialog_column1 = defaults->get("KEYFRAMEDIALOG_COLUMN1", xS(150)); + keyframedialog_column2 = defaults->get("KEYFRAMEDIALOG_COLUMN2", xS(100)); keyframedialog_all = defaults->get("KEYFRAMEDIALOG_ALL", 0); - menueffect_w = defaults->get("MENUEFFECT_W", 580); - menueffect_h = defaults->get("MENUEFFECT_H", 350); - transitiondialog_w = defaults->get("TRANSITIONDIALOG_W", 320); - transitiondialog_h = defaults->get("TRANSITIONDIALOG_H", 512); + menueffect_w = defaults->get("MENUEFFECT_W", xS(580)); + menueffect_h = defaults->get("MENUEFFECT_H", yS(350)); + transitiondialog_w = defaults->get("TRANSITIONDIALOG_W", xS(320)); + transitiondialog_h = defaults->get("TRANSITIONDIALOG_H", yS(512)); current_tip = defaults->get("CURRENT_TIP", current_tip); actual_frame_rate = defaults->get("ACTUAL_FRAME_RATE", (float)-1); diff --git a/cinelerra-5.1/cinelerra/preferences.C b/cinelerra-5.1/cinelerra/preferences.C index a3ebc48f..c9153a95 100644 --- a/cinelerra-5.1/cinelerra/preferences.C +++ b/cinelerra-5.1/cinelerra/preferences.C @@ -69,6 +69,7 @@ Preferences::Preferences() trap_sigsegv = 1; trap_sigintr = 1; awindow_picon_h = 50; + layout_scale = 0; // auto scale vicon_size = 50; vicon_color_mode = VICON_COLOR_MODE_LOW; theme[0] = 0; @@ -180,6 +181,7 @@ void Preferences::copy_from(Preferences *that) keyframe_reticle = that->keyframe_reticle; perpetual_session = that->perpetual_session; awindow_picon_h = that->awindow_picon_h; + layout_scale = that->layout_scale; vicon_size = that->vicon_size; vicon_color_mode = that->vicon_color_mode; strcpy(theme, that->theme); @@ -329,6 +331,7 @@ int Preferences::load_defaults(BC_Hash *defaults) trap_sigintr = defaults->get("TRAP_SIGINTR", trap_sigintr); awindow_picon_h = defaults->get("AWINDOW_PICON_H", awindow_picon_h); + layout_scale = defaults->get("LAYOUT_SCALE",layout_scale); vicon_size = defaults->get("VICON_SIZE",vicon_size); vicon_color_mode = defaults->get("VICON_COLOR_MODE",vicon_color_mode); strcpy(theme, _(DEFAULT_THEME)); @@ -478,6 +481,7 @@ int Preferences::save_defaults(BC_Hash *defaults) defaults->update("TRAP_SIGSEGV", trap_sigsegv); defaults->update("TRAP_SIGINTR", trap_sigintr); defaults->update("AWINDOW_PICON_H", awindow_picon_h); + defaults->update("LAYOUT_SCALE",layout_scale); defaults->update("VICON_SIZE",vicon_size); defaults->update("VICON_COLOR_MODE",vicon_color_mode); defaults->update("THEME", theme); diff --git a/cinelerra-5.1/cinelerra/preferences.h b/cinelerra-5.1/cinelerra/preferences.h index edb28712..bbd41964 100644 --- a/cinelerra-5.1/cinelerra/preferences.h +++ b/cinelerra-5.1/cinelerra/preferences.h @@ -95,6 +95,7 @@ public: // media thumbnail size int awindow_picon_h; int vicon_size, vicon_color_mode; + float layout_scale; // Title of theme char theme[BCTEXTLEN]; // plugin icon set diff --git a/cinelerra-5.1/cinelerra/preferencesthread.C b/cinelerra-5.1/cinelerra/preferencesthread.C index 2e908926..23494e70 100644 --- a/cinelerra-5.1/cinelerra/preferencesthread.C +++ b/cinelerra-5.1/cinelerra/preferencesthread.C @@ -237,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 diff --git a/cinelerra-5.1/cinelerra/recordbatches.C b/cinelerra-5.1/cinelerra/recordbatches.C index a9f5114e..6ed37423 100644 --- a/cinelerra-5.1/cinelerra/recordbatches.C +++ b/cinelerra-5.1/cinelerra/recordbatches.C @@ -39,7 +39,7 @@ load_defaults(ChannelDB * channeldb, Record * record) for(int i = 0; i < BATCH_COLUMNS; i++) { batch_titles[i] = _(default_batch_titles[i]); sprintf(string, "BATCH_COLUMNWIDTH_%d", i); - column_widths[i] = defaults->get(string, default_columnwidth[i]); + column_widths[i] = defaults->get(string, xS(default_columnwidth[i])); } int total_batches = defaults->get("TOTAL_BATCHES", 1); if(total_batches < 1) total_batches = 1; @@ -335,7 +335,7 @@ set_row_color(int row, int color) RecordBatchesGUI::Dir:: Dir(RecordBatches &batches, const char *dir, int x, int y) - : BC_TextBox(x, y, 200, 1, dir), + : BC_TextBox(x, y, xS(200), 1, dir), batches(batches), directory(batches.default_directory) { @@ -380,7 +380,7 @@ load_dirs(const char *dir) RecordBatchesGUI::Path:: Path(RecordBatches &batches, int x, int y) - : BC_TextBox(x, y, 200, 1, batches.get_editing_batch()->asset->path), + : BC_TextBox(x, y, xS(200), 1, batches.get_editing_batch()->asset->path), batches(batches) { } @@ -437,7 +437,7 @@ RecordBatchesGUI::Source:: Source(BC_Window *win, RecordBatches &batches, int x, int y) : BC_PopupTextBox(win, &sources, batches.get_editing_batch()->get_source_text(), - x, y, 200, 200), + x, y, xS(200), yS(200)), batches(batches) { } @@ -452,7 +452,7 @@ handle_event() RecordBatchesGUI::News:: News(RecordBatches &batches, int x, int y) - : BC_TextBox(x, y, 200, 1, batches.get_editing_batch()->news), + : BC_TextBox(x, y, xS(200), 1, batches.get_editing_batch()->news), batches(batches) { } diff --git a/cinelerra-5.1/cinelerra/signalstatus.C b/cinelerra-5.1/cinelerra/signalstatus.C index 8e221618..c002ecc6 100644 --- a/cinelerra-5.1/cinelerra/signalstatus.C +++ b/cinelerra-5.1/cinelerra/signalstatus.C @@ -10,7 +10,7 @@ SignalStatus::SignalStatus(BC_WindowBase *wdw, int x, int y) - : BC_SubWindow(x, y, 100, 35) + : BC_SubWindow(x, y, xS(100), yS(35)) { this->wdw = wdw; dvb_input = 0; diff --git a/cinelerra-5.1/cinelerra/timeentry.C b/cinelerra-5.1/cinelerra/timeentry.C index f8ccf000..1f01f721 100644 --- a/cinelerra-5.1/cinelerra/timeentry.C +++ b/cinelerra-5.1/cinelerra/timeentry.C @@ -88,7 +88,7 @@ void TimeEntry::create_objects() char string[BCTEXTLEN]; if(output_day) { - day_text = new DayText(this, x, y, 50, + day_text = new DayText(this, x, y, xS(50), day_table, TOTAL_DAYS, day_table[*output_day]); gui->add_subwindow(day_text); x += day_text->get_w(); diff --git a/cinelerra-5.1/cinelerra/timeentry.inc b/cinelerra-5.1/cinelerra/timeentry.inc index b20a9e77..6b051572 100644 --- a/cinelerra-5.1/cinelerra/timeentry.inc +++ b/cinelerra-5.1/cinelerra/timeentry.inc @@ -29,6 +29,6 @@ class TimeEntryTumbler; class SecTumbler; class TimeTextBox; -#define DEFAULT_TIMEW 200 +#define DEFAULT_TIMEW xS(200) #endif diff --git a/cinelerra-5.1/guicast/bclistbox.C b/cinelerra-5.1/guicast/bclistbox.C index 8ef0ab0b..18d93c99 100644 --- a/cinelerra-5.1/guicast/bclistbox.C +++ b/cinelerra-5.1/guicast/bclistbox.C @@ -1780,12 +1780,13 @@ int BC_ListBox::get_scrollbars() int BC_ListBox::get_w() { - return is_popup ? button_images[0]->get_w() + xS(1) : popup_w; + return is_popup ? BCPOPUPLISTBOX_W : popup_w; } int BC_ListBox::get_h() { - return is_popup ? button_images[0]->get_h() + yS(1) : popup_h; + return is_popup ? BCPOPUPLISTBOX_H : popup_h; } + int BC_ListBox::gui_tooltip(const char *text) { return is_popup && gui ? gui->show_tooltip(text, gui->get_w(),0, -1,-1) : -1; diff --git a/cinelerra-5.1/guicast/bclistbox.h b/cinelerra-5.1/guicast/bclistbox.h index e1e991a5..ce34ffc4 100644 --- a/cinelerra-5.1/guicast/bclistbox.h +++ b/cinelerra-5.1/guicast/bclistbox.h @@ -29,6 +29,8 @@ #include "bctoggle.h" #include "bccolors.h" +#define BCPOPUPLISTBOX_W xS(25) +#define BCPOPUPLISTBOX_H yS(25) class BC_ListBoxYScroll; class BC_ListBoxXScroll; diff --git a/cinelerra-5.1/guicast/bcresources.C b/cinelerra-5.1/guicast/bcresources.C index 2683bd20..66719292 100644 --- a/cinelerra-5.1/guicast/bcresources.C +++ b/cinelerra-5.1/guicast/bcresources.C @@ -362,27 +362,17 @@ VFrame *BC_Resources::default_vscroll_data[10] = { 0, }; VFrame *BC_Resources::default_hscroll_data[10] = { 0, }; VFrame *BC_Resources::default_icon_img = 0; -BC_Resources::BC_Resources() +BC_Resources::BC_Resources(float x_scale, float y_scale) { + BC_WindowBase::resources = this; synchronous = 0; vframe_shm = 0; - double default_scale = 1; - char *env = getenv("BC_SCALE"); - if( !env ) { - BC_DisplayInfo info; - int wx, wy, ww, wh; - int cins = info.xinerama_big_screen(); - if( !info.xinerama_geometry(cins, wx, wy, ww, wh) ) { - x_scale = ww / 1920.; - y_scale = wh / 1080.; - default_scale = bmin(x_scale, y_scale); - } - } - else { - if( (default_scale = atof(env)) <= 0 ) default_scale = 1; - x_scale = y_scale = default_scale; - } - env = getenv("BC_FONT_DEBUG"); + if( x_scale <= 0 ) x_scale = 1; + if( y_scale <= 0 ) y_scale = x_scale; + this->x_scale = x_scale; + this->y_scale = y_scale; + float default_scale = bmin(x_scale, y_scale); + const char *env = getenv("BC_FONT_DEBUG"); font_debug = env ? atoi(env) : 0; env = getenv("BC_FONT_SCALE"); font_scale = env ? atof(env) : default_scale; diff --git a/cinelerra-5.1/guicast/bcresources.h b/cinelerra-5.1/guicast/bcresources.h index 888ab4ed..ae87652a 100644 --- a/cinelerra-5.1/guicast/bcresources.h +++ b/cinelerra-5.1/guicast/bcresources.h @@ -55,7 +55,8 @@ typedef struct class BC_Resources { public: - BC_Resources(); // The window parameter is used to get the display information initially +// The window parameter is used to get the display information initially + BC_Resources(float x_scale, float y_scale); ~BC_Resources(); friend class BC_WindowBase; diff --git a/cinelerra-5.1/guicast/bcwindowbase.C b/cinelerra-5.1/guicast/bcwindowbase.C index ad25943b..0d9f95d4 100644 --- a/cinelerra-5.1/guicast/bcwindowbase.C +++ b/cinelerra-5.1/guicast/bcwindowbase.C @@ -70,7 +70,7 @@ BC_ResizeCall::BC_ResizeCall(int w, int h) int BC_WindowBase::shm_completion_event = -1; -BC_Resources BC_WindowBase::resources; +BC_Resources *BC_WindowBase::resources = 0; Window XGroupLeader = 0; Mutex BC_KeyboardHandlerLock::keyboard_listener_mutex("keyboard_listener",0); @@ -473,7 +473,7 @@ int BC_WindowBase::create_window(BC_WindowBase *parent_window, const char *title // This must be done before fonts to know if antialiasing is available. init_colors(); // get the resources - if(resources.use_shm < 0) resources.initialize_display(this); + if(resources->use_shm < 0) resources->initialize_display(this); x_correction = BC_DisplayInfo::get_left_border(); y_correction = BC_DisplayInfo::get_top_border(); @@ -486,7 +486,7 @@ int BC_WindowBase::create_window(BC_WindowBase *parent_window, const char *title if(this->y < 0) this->y = 0; if(this->bg_color == -1) - this->bg_color = resources.get_bg_color(); + this->bg_color = resources->get_bg_color(); // printf("bcwindowbase 1 %s\n", title); // if(window_type == MAIN_WINDOW) sleep(1); @@ -576,7 +576,7 @@ int BC_WindowBase::create_window(BC_WindowBase *parent_window, const char *title KeyPressMask | KeyReleaseMask; if(this->bg_color == -1) - this->bg_color = resources.get_bg_color(); + this->bg_color = resources->get_bg_color(); attr.background_pixel = top_level->get_color(bg_color); attr.colormap = top_level->cmap; if(top_level->is_hourglass) @@ -1031,12 +1031,12 @@ if( debug && event->type != ClientMessage ) { drag_y1 = cursor_y - get_resources()->drag_radius; drag_y2 = cursor_y + get_resources()->drag_radius; - if((long)(button_time3 - button_time1) < resources.double_click * 2) + if((long)(button_time3 - button_time1) < resources->double_click * 2) { triple_click = 1; button_time3 = button_time2 = button_time1 = 0; } - if((long)(button_time3 - button_time2) < resources.double_click) + if((long)(button_time3 - button_time2) < resources->double_click) { double_click = 1; // button_time3 = button_time2 = button_time1 = 0; @@ -2295,21 +2295,21 @@ int BC_WindowBase::init_gc() int BC_WindowBase::init_fonts() { - if( !(smallfont = XLoadQueryFont(display, _(resources.small_font))) ) - if( !(smallfont = XLoadQueryFont(display, _(resources.small_font2))) ) + if( !(smallfont = XLoadQueryFont(display, _(resources->small_font))) ) + if( !(smallfont = XLoadQueryFont(display, _(resources->small_font2))) ) smallfont = XLoadQueryFont(display, "fixed"); - if( !(mediumfont = XLoadQueryFont(display, _(resources.medium_font))) ) - if( !(mediumfont = XLoadQueryFont(display, _(resources.medium_font2))) ) + if( !(mediumfont = XLoadQueryFont(display, _(resources->medium_font))) ) + if( !(mediumfont = XLoadQueryFont(display, _(resources->medium_font2))) ) mediumfont = XLoadQueryFont(display, "fixed"); - if( !(largefont = XLoadQueryFont(display, _(resources.large_font))) ) - if( !(largefont = XLoadQueryFont(display, _(resources.large_font2))) ) + if( !(largefont = XLoadQueryFont(display, _(resources->large_font))) ) + if( !(largefont = XLoadQueryFont(display, _(resources->large_font2))) ) largefont = XLoadQueryFont(display, "fixed"); - if( !(bigfont = XLoadQueryFont(display, _(resources.big_font))) ) - if( !(bigfont = XLoadQueryFont(display, _(resources.big_font2))) ) + if( !(bigfont = XLoadQueryFont(display, _(resources->big_font))) ) + if( !(bigfont = XLoadQueryFont(display, _(resources->big_font2))) ) bigfont = XLoadQueryFont(display, "fixed"); - if((clockfont = XLoadQueryFont(display, _(resources.clock_font))) == NULL) - if((clockfont = XLoadQueryFont(display, _(resources.clock_font2))) == NULL) + if((clockfont = XLoadQueryFont(display, _(resources->clock_font))) == NULL) + if((clockfont = XLoadQueryFont(display, _(resources->clock_font2))) == NULL) clockfont = XLoadQueryFont(display, "fixed"); init_xft(); @@ -2319,19 +2319,19 @@ int BC_WindowBase::init_fonts() int n; // FIXME: should check the m,d,n values - smallfontset = XCreateFontSet(display, resources.small_fontset, &m, &n, &d); + smallfontset = XCreateFontSet(display, resources->small_fontset, &m, &n, &d); if( !smallfontset ) smallfontset = XCreateFontSet(display, "fixed,*", &m, &n, &d); - mediumfontset = XCreateFontSet(display, resources.medium_fontset, &m, &n, &d); + mediumfontset = XCreateFontSet(display, resources->medium_fontset, &m, &n, &d); if( !mediumfontset ) mediumfontset = XCreateFontSet(display, "fixed,*", &m, &n, &d); - largefontset = XCreateFontSet(display, resources.large_fontset, &m, &n, &d); + largefontset = XCreateFontSet(display, resources->large_fontset, &m, &n, &d); if( !largefontset ) largefontset = XCreateFontSet(display, "fixed,*", &m, &n, &d); - bigfontset = XCreateFontSet(display, resources.big_fontset, &m, &n, &d); + bigfontset = XCreateFontSet(display, resources->big_fontset, &m, &n, &d); if( !bigfontset ) bigfontset = XCreateFontSet(display, "fixed,*", &m, &n, &d); - clockfontset = XCreateFontSet(display, resources.clock_fontset, &m, &n, &d); + clockfontset = XCreateFontSet(display, resources->clock_fontset, &m, &n, &d); if( !clockfontset ) clockfontset = XCreateFontSet(display, "fixed,*", &m, &n, &d); if(clockfontset && bigfontset && largefontset && mediumfontset && smallfontset) { @@ -2355,54 +2355,54 @@ void BC_WindowBase::init_xft() static Mutex xft_init_lock("BC_WindowBase::xft_init_lock", 0); xft_init_lock.lock("BC_WindowBase::init_xft"); if(!(smallfont_xft = - (resources.small_font_xft[0] == '-' ? - xftFontOpenXlfd(display, screen, resources.small_font_xft) : - xftFontOpenName(display, screen, resources.small_font_xft))) ) + (resources->small_font_xft[0] == '-' ? + xftFontOpenXlfd(display, screen, resources->small_font_xft) : + xftFontOpenName(display, screen, resources->small_font_xft))) ) if(!(smallfont_xft = - xftFontOpenXlfd(display, screen, resources.small_font_xft2))) + xftFontOpenXlfd(display, screen, resources->small_font_xft2))) smallfont_xft = xftFontOpenXlfd(display, screen, "fixed"); if(!(mediumfont_xft = - (resources.medium_font_xft[0] == '-' ? - xftFontOpenXlfd(display, screen, resources.medium_font_xft) : - xftFontOpenName(display, screen, resources.medium_font_xft))) ) + (resources->medium_font_xft[0] == '-' ? + xftFontOpenXlfd(display, screen, resources->medium_font_xft) : + xftFontOpenName(display, screen, resources->medium_font_xft))) ) if(!(mediumfont_xft = - xftFontOpenXlfd(display, screen, resources.medium_font_xft2))) + xftFontOpenXlfd(display, screen, resources->medium_font_xft2))) mediumfont_xft = xftFontOpenXlfd(display, screen, "fixed"); if(!(largefont_xft = - (resources.large_font_xft[0] == '-' ? - xftFontOpenXlfd(display, screen, resources.large_font_xft) : - xftFontOpenName(display, screen, resources.large_font_xft))) ) + (resources->large_font_xft[0] == '-' ? + xftFontOpenXlfd(display, screen, resources->large_font_xft) : + xftFontOpenName(display, screen, resources->large_font_xft))) ) if(!(largefont_xft = - xftFontOpenXlfd(display, screen, resources.large_font_xft2))) + xftFontOpenXlfd(display, screen, resources->large_font_xft2))) largefont_xft = xftFontOpenXlfd(display, screen, "fixed"); if(!(bigfont_xft = - (resources.big_font_xft[0] == '-' ? - xftFontOpenXlfd(display, screen, resources.big_font_xft) : - xftFontOpenName(display, screen, resources.big_font_xft))) ) + (resources->big_font_xft[0] == '-' ? + xftFontOpenXlfd(display, screen, resources->big_font_xft) : + xftFontOpenName(display, screen, resources->big_font_xft))) ) if(!(bigfont_xft = - xftFontOpenXlfd(display, screen, resources.big_font_xft2))) + xftFontOpenXlfd(display, screen, resources->big_font_xft2))) bigfont_xft = xftFontOpenXlfd(display, screen, "fixed"); if(!(clockfont_xft = - (resources.clock_font_xft[0] == '-' ? - xftFontOpenXlfd(display, screen, resources.clock_font_xft) : - xftFontOpenName(display, screen, resources.clock_font_xft))) ) + (resources->clock_font_xft[0] == '-' ? + xftFontOpenXlfd(display, screen, resources->clock_font_xft) : + xftFontOpenName(display, screen, resources->clock_font_xft))) ) clockfont_xft = xftFontOpenXlfd(display, screen, "fixed"); if(!(bold_smallfont_xft = - (resources.small_b_font_xft[0] == '-' ? - xftFontOpenXlfd(display, screen, resources.small_b_font_xft) : - xftFontOpenName(display, screen, resources.small_b_font_xft))) ) + (resources->small_b_font_xft[0] == '-' ? + xftFontOpenXlfd(display, screen, resources->small_b_font_xft) : + xftFontOpenName(display, screen, resources->small_b_font_xft))) ) bold_smallfont_xft = xftFontOpenXlfd(display, screen, "fixed"); if(!(bold_mediumfont_xft = - (resources.medium_b_font_xft[0] == '-' ? - xftFontOpenXlfd(display, screen, resources.medium_b_font_xft) : - xftFontOpenName(display, screen, resources.medium_b_font_xft))) ) + (resources->medium_b_font_xft[0] == '-' ? + xftFontOpenXlfd(display, screen, resources->medium_b_font_xft) : + xftFontOpenName(display, screen, resources->medium_b_font_xft))) ) bold_mediumfont_xft = xftFontOpenXlfd(display, screen, "fixed"); if(!(bold_largefont_xft = - (resources.large_b_font_xft[0] == '-' ? - xftFontOpenXlfd(display, screen, resources.large_b_font_xft) : - xftFontOpenName(display, screen, resources.large_b_font_xft))) ) + (resources->large_b_font_xft[0] == '-' ? + xftFontOpenXlfd(display, screen, resources->large_b_font_xft) : + xftFontOpenName(display, screen, resources->large_b_font_xft))) ) bold_largefont_xft = xftFontOpenXlfd(display, screen, "fixed"); if( !smallfont_xft || !mediumfont_xft || !largefont_xft || !bigfont_xft || @@ -2410,14 +2410,14 @@ xft_init_lock.lock("BC_WindowBase::init_xft"); !clockfont_xft ) { printf("BC_WindowBase::init_fonts: no xft fonts found:" " %s=%p\n %s=%p\n %s=%p\n %s=%p\n %s=%p\n %s=%p\n %s=%p\n %s=%p\n", - resources.small_font_xft, smallfont_xft, - resources.medium_font_xft, mediumfont_xft, - resources.large_font_xft, largefont_xft, - resources.big_font_xft, bigfont_xft, - resources.clock_font_xft, clockfont_xft, - resources.small_b_font_xft, bold_smallfont_xft, - resources.medium_b_font_xft, bold_mediumfont_xft, - resources.large_b_font_xft, bold_largefont_xft); + resources->small_font_xft, smallfont_xft, + resources->medium_font_xft, mediumfont_xft, + resources->large_font_xft, largefont_xft, + resources->big_font_xft, bigfont_xft, + resources->clock_font_xft, clockfont_xft, + resources->small_b_font_xft, bold_smallfont_xft, + resources->medium_b_font_xft, bold_mediumfont_xft, + resources->large_b_font_xft, bold_largefont_xft); get_resources()->use_xft = 0; exit(1); } @@ -3622,12 +3622,12 @@ int BC_WindowBase::get_color_model() BC_Resources* BC_WindowBase::get_resources() { - return &BC_WindowBase::resources; + return BC_WindowBase::resources; } BC_Synchronous* BC_WindowBase::get_synchronous() { - return BC_WindowBase::resources.get_synchronous(); + return BC_WindowBase::resources->get_synchronous(); } int BC_WindowBase::get_bg_color() @@ -4283,6 +4283,32 @@ int BC_WindowBase::set_icon(VFrame *data) return 0; } +void BC_WindowBase::init_resources(float scale) +{ + if( resources ) return; + XInitThreads(); + const char *env = getenv("BC_SCALE"); + if( env ) scale = atof(env); + float x_scale = 1, y_scale = 1; + if( scale <= 0 ) { + BC_DisplayInfo info; + int wx, wy, ww, wh; + int cins = info.xinerama_big_screen(); + if( !info.xinerama_geometry(cins, wx, wy, ww, wh) ) { + if( (x_scale = ww/1920.) < 1 ) x_scale = 1; + if( (y_scale = wh/1080.) < 1 ) y_scale = 1; + } + } + else + x_scale = y_scale = scale; + // constructor sets BC_WindowBase::resources + new BC_Resources(x_scale, y_scale); +} +void BC_WindowBase::finit_resources() +{ + delete resources; resources = 0; +} + int BC_WindowBase::set_w(int w) { this->w = w; @@ -4297,7 +4323,6 @@ int BC_WindowBase::set_h(int h) int BC_WindowBase::load_defaults(BC_Hash *defaults) { - BC_Resources *resources = get_resources(); char string[BCTEXTLEN]; int newest_id = - 1; for(int i = 0; i < FILEBOX_HISTORY_SIZE; i++) @@ -4330,7 +4355,6 @@ int BC_WindowBase::load_defaults(BC_Hash *defaults) int BC_WindowBase::save_defaults(BC_Hash *defaults) { - BC_Resources *resources = get_resources(); char string[BCTEXTLEN]; for(int i = 0; i < FILEBOX_HISTORY_SIZE; i++) { diff --git a/cinelerra-5.1/guicast/bcwindowbase.h b/cinelerra-5.1/guicast/bcwindowbase.h index a3901098..36add9c7 100644 --- a/cinelerra-5.1/guicast/bcwindowbase.h +++ b/cinelerra-5.1/guicast/bcwindowbase.h @@ -203,6 +203,8 @@ public: virtual int grab_event(XEvent *event) { return 0; }; virtual void create_objects() { return; }; + static void init_resources(float scale); + static void finit_resources(); int get_window_type() { return window_type; } // Wait until event loop is running void init_wait(); @@ -729,7 +731,7 @@ private: // Whether the window has the focus int has_focus; - static BC_Resources resources; + static BC_Resources *resources; #ifndef SINGLE_THREAD // Array of repeaters for multiple repeating objects. diff --git a/cinelerra-5.1/guicast/errorbox.h b/cinelerra-5.1/guicast/errorbox.h index 96efa72e..d72225e8 100644 --- a/cinelerra-5.1/guicast/errorbox.h +++ b/cinelerra-5.1/guicast/errorbox.h @@ -28,10 +28,8 @@ class ErrorBox : public BC_Window { public: ErrorBox(const char *title, - int x = (int)BC_INFINITY, - int y = (int)BC_INFINITY, - int w = 400, - int h = 120); + int x = (int)BC_INFINITY, int y = (int)BC_INFINITY, + int w = xS(400), int h = yS(120)); virtual ~ErrorBox(); void create_objects(const char *text); diff --git a/cinelerra-5.1/plugins/blur/blurwindow.C b/cinelerra-5.1/plugins/blur/blurwindow.C index f5a534c9..44ba304e 100644 --- a/cinelerra-5.1/plugins/blur/blurwindow.C +++ b/cinelerra-5.1/plugins/blur/blurwindow.C @@ -31,9 +31,9 @@ BlurWindow::BlurWindow(BlurMain *client) : PluginClientWindow(client, - xS(200), + xS(210), yS(360), - xS(200), + xS(210), yS(360), 0) { diff --git a/cinelerra-5.1/plugins/decimate/decimate.C b/cinelerra-5.1/plugins/decimate/decimate.C index cd2dd7e7..cdf347eb 100644 --- a/cinelerra-5.1/plugins/decimate/decimate.C +++ b/cinelerra-5.1/plugins/decimate/decimate.C @@ -211,9 +211,9 @@ int DecimateConfig::equivalent(DecimateConfig *config) DecimateWindow::DecimateWindow(Decimate *plugin) : PluginClientWindow(plugin, xS(210), - yS(160), + yS(100), xS(200), - yS(160), + yS(100), 0) { this->plugin = plugin; diff --git a/cinelerra-5.1/plugins/delayvideo/delayvideo.C b/cinelerra-5.1/plugins/delayvideo/delayvideo.C index 3aaa8530..644f1e8f 100644 --- a/cinelerra-5.1/plugins/delayvideo/delayvideo.C +++ b/cinelerra-5.1/plugins/delayvideo/delayvideo.C @@ -71,10 +71,10 @@ void DelayVideoConfig::interpolate(DelayVideoConfig &prev, DelayVideoWindow::DelayVideoWindow(DelayVideo *plugin) : PluginClientWindow(plugin, - xS(210), - yS(120), - xS(210), - yS(120), + xS(190), + yS(70), + xS(190), + yS(70), 0) { this->plugin = plugin; diff --git a/cinelerra-5.1/plugins/denoiseseltempavg/seltempavgwindow.C b/cinelerra-5.1/plugins/denoiseseltempavg/seltempavgwindow.C index 42c92d70..d8e51ba9 100644 --- a/cinelerra-5.1/plugins/denoiseseltempavg/seltempavgwindow.C +++ b/cinelerra-5.1/plugins/denoiseseltempavg/seltempavgwindow.C @@ -31,9 +31,9 @@ SelTempAvgWindow::SelTempAvgWindow(SelTempAvgMain *client) : PluginClientWindow(client, xS(310), - yS(540), - xS(300), - yS(540), + yS(480), + xS(310), + yS(480), 0) { this->client = client; @@ -45,70 +45,72 @@ SelTempAvgWindow::~SelTempAvgWindow() void SelTempAvgWindow::create_objects() { - int x1 = 10, x2 = 40, x3 = 80, x4 = 175, x5 = 260, y = 10; + int xs10 = xS(10), xs20 = xS(20), xs40 = xS(40), xs80 = xS(80), xs175=xS(175), xs260=xS(260); + int ys10 = yS(10), ys20 = yS(20), ys25 = yS(25), ys30 = yS(30), ys35 = yS(35); + int x1 = xs10, x2 = xs40, x3 = xs80, x4 = xs175, x5 = xs260, y = ys10; add_tool(new BC_Title(x1, y, _("Frames to average"))); - y += 20; + y += ys20; add_tool(total_frames = new SelTempAvgSlider(client, x1, y)); - y += 20; + y += ys20; add_tool(new BC_Title(x1, y, _("Use Method:"))); - y += 20; + y += ys20; add_tool(method_none = new SelTempAvgMethodRadial(client, this, x1, y, SelTempAvgConfig::METHOD_NONE, _("None "))); - y += 20; + y += ys20; add_tool(method_seltempavg = new SelTempAvgMethodRadial(client, this, x1, y, SelTempAvgConfig::METHOD_SELTEMPAVG, _("Selective Temporal Averaging: "))); - y += 25; + y += ys25; add_tool(new BC_Title(x3, y, _("Av. Thres."))); add_tool(new BC_Title(x4, y, _("S.D. Thres."))); add_tool(new BC_Title(x5, y, _("Mask"))); - y += 25; + y += ys25; add_tool(new BC_Title(x2, y, _("R / Y"))); add_tool(avg_threshold_RY = new SelTempAvgThreshSlider(client, x3, y, AVG_RY,client->config.avg_threshold_RY)); add_tool(std_threshold_RY = new SelTempAvgThreshSlider(client, x4, y, STD_RY,client->config.std_threshold_RY)); add_tool(mask_RY = new SelTempAvgMask(client, x5, y, MASK_RY, client->config.mask_RY)); - y += 25; + y += ys25; add_tool(new BC_Title(x2, y, _("G / U"))); add_tool(avg_threshold_GU = new SelTempAvgThreshSlider(client, x3, y, AVG_GU,client->config.avg_threshold_GU)); add_tool(std_threshold_GU = new SelTempAvgThreshSlider(client, x4, y, STD_GU,client->config.std_threshold_GU)); add_tool(mask_GU = new SelTempAvgMask(client, x5, y, MASK_GU,client->config.mask_GU)); - y += 25; + y += ys25; add_tool(new BC_Title(x2, y, _("B / V"))); add_tool(avg_threshold_BV = new SelTempAvgThreshSlider(client, x3, y, AVG_BV,client->config.avg_threshold_BV)); add_tool(std_threshold_BV = new SelTempAvgThreshSlider(client, x4, y, STD_BV,client->config.std_threshold_BV)); add_tool(mask_BV = new SelTempAvgMask(client, x5, y, MASK_BV,client->config.mask_BV)); - y += 30; + y += ys30; add_tool(method_average = new SelTempAvgMethodRadial(client, this, x1, y, SelTempAvgConfig::METHOD_AVERAGE, _("Average"))); - y += 20; + y += ys20; add_tool(method_stddev = new SelTempAvgMethodRadial(client, this, x1, y, SelTempAvgConfig::METHOD_STDDEV, _("Standard Deviation"))); - y += 35; + y += ys35; add_tool(new BC_Title(x1, y, _("First frame in average:"))); - y += 20; + y += ys20; add_tool(offset_fixed = new SelTempAvgOffsetRadial(client, this, x1, y, SelTempAvgConfig::OFFSETMODE_FIXED, _("Fixed offset: "))); add_tool(offset_fixed_value = new SelTempAvgOffsetValue(client, x4, y)); - y += 25; + y += ys25; add_tool(offset_restartmarker = new SelTempAvgOffsetRadial(client, this, x1, y, SelTempAvgConfig::OFFSETMODE_RESTARTMARKERSYS, _("Restart marker system:"))); - add_tool(offset_restartmarker_pos = new BC_TextBox(x4+20, y, 100, 1, "")); + add_tool(offset_restartmarker_pos = new BC_TextBox(x4+xs20, y, 100, 1, "")); offset_restartmarker_pos->disable(); - y += 20; - add_tool(offset_restartmarker_keyframe = new SelTempAvgStartKeyframe(client, x2 + 10, y)); + y += ys20; + add_tool(offset_restartmarker_keyframe = new SelTempAvgStartKeyframe(client, x2 + xs10, y)); - y += 35; + y += ys35; add_tool(new BC_Title(x1, y, _("Other Options:"))); - y += 20; + y += ys20; add_tool(paranoid = new SelTempAvgParanoid(client, x1, y)); - y += 25; + y += ys25; add_tool(no_subtract = new SelTempAvgNoSubtract(client, x1, y)); - y += 30; + y += ys30; add_tool(new BC_Title(x2, y, _("Gain:"))); add_tool(gain = new SelTempAvgGainValue(client, x3, y)); @@ -121,7 +123,7 @@ void SelTempAvgWindow::create_objects() SelTempAvgThreshSlider::SelTempAvgThreshSlider(SelTempAvgMain *client, int x, int y, int id, float currentval) - : BC_TextBox(x,y, 80, 1, currentval) + : BC_TextBox(x,y, xS(80), 1, currentval) { // float val; // int ival; @@ -164,7 +166,7 @@ int SelTempAvgThreshSlider::handle_event() SelTempAvgOffsetValue::SelTempAvgOffsetValue(SelTempAvgMain *client, int x, int y) - : BC_TextBox(x,y, 80, 1, client->config.offset_fixed_value) + : BC_TextBox(x,y, xS(80), 1, client->config.offset_fixed_value) { this->client = client; } @@ -182,7 +184,7 @@ int SelTempAvgOffsetValue::handle_event() SelTempAvgGainValue::SelTempAvgGainValue(SelTempAvgMain *client, int x, int y) - : BC_TextBox(x,y, 80, 1, client->config.gain) + : BC_TextBox(x,y, xS(80), 1, client->config.gain) { this->client = client; } @@ -204,7 +206,7 @@ int SelTempAvgGainValue::handle_event() SelTempAvgSlider::SelTempAvgSlider(SelTempAvgMain *client, int x, int y) - : BC_ISlider(x, y, 0, 190, 200, 1, MAX_FRAMES, client->config.frames) + : BC_ISlider(x, y, 0, xS(280), yS(200), 1, MAX_FRAMES, client->config.frames) { this->client = client; } diff --git a/cinelerra-5.1/plugins/descratch/descratch.C b/cinelerra-5.1/plugins/descratch/descratch.C index b48c4d0e..027c560d 100644 --- a/cinelerra-5.1/plugins/descratch/descratch.C +++ b/cinelerra-5.1/plugins/descratch/descratch.C @@ -486,7 +486,7 @@ DeScratchWindow::~DeScratchWindow() void DeScratchWindow::create_objects() { int xs10 = xS(10), xs15 = xS(15), xs16 = xS(16); - int ys10 = yS(10), ys15 = yS(15), ys30 = yS(30); + int ys10 = yS(10), ys15 = yS(15); int x = xs10, y = ys10; plugin->load_configuration(); DeScratchConfig &config = plugin->config; diff --git a/cinelerra-5.1/plugins/diffkey/diffkey.C b/cinelerra-5.1/plugins/diffkey/diffkey.C index fb8bc99b..2c0aef77 100644 --- a/cinelerra-5.1/plugins/diffkey/diffkey.C +++ b/cinelerra-5.1/plugins/diffkey/diffkey.C @@ -289,7 +289,7 @@ DiffKeyGUI::~DiffKeyGUI() void DiffKeyGUI::create_objects() { - int xs10 = xS(10); + int xs10 = xS(10), xs38 = xS(38); int ys10 = yS(10); int x = xs10, y = ys10; BC_Title *title; @@ -299,9 +299,9 @@ void DiffKeyGUI::create_objects() x = xs10; y += threshold->get_h() + ys10; add_subwindow(title = new BC_Title(x, y, _("Slope:"))); - x += title->get_w() + xs10; + x += title->get_w() + xs38; add_subwindow(slope = new DiffKeySlope(plugin, x, y)); - x = xs10; + x = xs38; y += slope->get_h() + ys10; add_subwindow(do_value = new DiffKeyDoValue(plugin, x, y)); diff --git a/cinelerra-5.1/plugins/edge/edgewindow.C b/cinelerra-5.1/plugins/edge/edgewindow.C index 0a143a3a..eaae3b98 100644 --- a/cinelerra-5.1/plugins/edge/edgewindow.C +++ b/cinelerra-5.1/plugins/edge/edgewindow.C @@ -28,9 +28,9 @@ EdgeWindow::EdgeWindow(Edge *plugin) : PluginClientWindow(plugin, xS(320), - yS(120), + yS(70), xS(320), - yS(120), + yS(70), 0) { this->plugin = plugin; diff --git a/cinelerra-5.1/plugins/framefield/framefield.C b/cinelerra-5.1/plugins/framefield/framefield.C index da36db3f..b30ab8c5 100644 --- a/cinelerra-5.1/plugins/framefield/framefield.C +++ b/cinelerra-5.1/plugins/framefield/framefield.C @@ -188,9 +188,9 @@ int FrameFieldConfig::equivalent(FrameFieldConfig &src) FrameFieldWindow::FrameFieldWindow(FrameField *plugin) : PluginClientWindow(plugin, xS(210), - yS(160), + yS(100), xS(200), - yS(160), + yS(100), 0) { this->plugin = plugin; diff --git a/cinelerra-5.1/plugins/freezeframe/freezeframe.C b/cinelerra-5.1/plugins/freezeframe/freezeframe.C index 4a364306..5d8bfe83 100644 --- a/cinelerra-5.1/plugins/freezeframe/freezeframe.C +++ b/cinelerra-5.1/plugins/freezeframe/freezeframe.C @@ -75,7 +75,7 @@ void FreezeFrameConfig::interpolate(FreezeFrameConfig &prev, FreezeFrameWindow::FreezeFrameWindow(FreezeFrameMain *client) - : PluginClientWindow(client, xS(260), yS(100), xS(260), yS(100), 0) + : PluginClientWindow(client, xS(160), yS(40), xS(160), yS(40), 0) { this->client = client; } diff --git a/cinelerra-5.1/plugins/histeq/histeq.C b/cinelerra-5.1/plugins/histeq/histeq.C index 8477ed82..8148f116 100644 --- a/cinelerra-5.1/plugins/histeq/histeq.C +++ b/cinelerra-5.1/plugins/histeq/histeq.C @@ -239,7 +239,7 @@ int HistEqPlot::handle_event() } HistEqBlend::HistEqBlend(HistEqWindow *gui, HistEqMain *plugin, int x, int y) - : BC_FSlider(x, y, 0, xS(150), yS(200), 0, xS(1.0), plugin->config.blend, 0) + : BC_FSlider(x, y, 0, xS(150), yS(200), 0, 1.0, plugin->config.blend, 0) { this->gui = gui; this->plugin = plugin; @@ -258,7 +258,7 @@ int HistEqBlend::handle_event() HistEqGain::HistEqGain(HistEqWindow *gui, HistEqMain *plugin, int x, int y) - : BC_FSlider(x, y, 0, xS(150), yS(200), 0, xS(1.0), plugin->config.gain, 0) + : BC_FSlider(x, y, 0, xS(150), yS(200), 0, 1.0, plugin->config.gain, 0) { this->gui = gui; this->plugin = plugin; diff --git a/cinelerra-5.1/plugins/histogram_bezier/bistogramwindow.C b/cinelerra-5.1/plugins/histogram_bezier/bistogramwindow.C index fd5429cd..5fa84032 100644 --- a/cinelerra-5.1/plugins/histogram_bezier/bistogramwindow.C +++ b/cinelerra-5.1/plugins/histogram_bezier/bistogramwindow.C @@ -32,7 +32,7 @@ #include HistogramWindow::HistogramWindow(HistogramMain *plugin) - : PluginClientWindow(plugin, xS(440), yS(480), xS(440), yS(480), 0) + : PluginClientWindow(plugin, xS(480), yS(480), xS(480), yS(480), 0) { this->plugin = plugin; max_picon = 0; @@ -830,7 +830,7 @@ void HistogramInputText::update() HistogramSmoothMode::HistogramSmoothMode(HistogramMain*plugin, HistogramWindow *gui, int x, int y) - : BC_PopupMenu(x, y, xS(120), to_text(plugin->config.smoothMode), 1) + : BC_PopupMenu(x, y, xS(180), to_text(plugin->config.smoothMode), 1) { this->plugin = plugin; this->gui = gui; diff --git a/cinelerra-5.1/plugins/interpolate/interpolate.C b/cinelerra-5.1/plugins/interpolate/interpolate.C index 05c8565c..345f08b6 100644 --- a/cinelerra-5.1/plugins/interpolate/interpolate.C +++ b/cinelerra-5.1/plugins/interpolate/interpolate.C @@ -42,15 +42,7 @@ InterpolatePixelsOffset::InterpolatePixelsOffset(InterpolatePixelsWindow *window int x, int y, int *output) - : BC_ISlider(x, - y, - 0, - xS(50), - yS(50), - 0, - 1, - *output, - 0) + : BC_ISlider(x, y, 0, xS(50), yS(50), 0, 1, *output, 0) { this->window = window; this->output = output; @@ -74,11 +66,7 @@ int InterpolatePixelsOffset::handle_event() InterpolatePixelsWindow::InterpolatePixelsWindow(InterpolatePixelsMain *client) : PluginClientWindow(client, - xS(200), - yS(100), - xS(200), - yS(100), - 0) + xS(200), yS(70), xS(200), yS(70), 0) { this->client = client; } @@ -89,7 +77,7 @@ InterpolatePixelsWindow::~InterpolatePixelsWindow() void InterpolatePixelsWindow::create_objects() { - int xs5 = xS(5), xs10 = xS(10), xs50 = xS(50); + int xs5 = xS(5), xs10 = xS(10); int ys5 = yS(5), ys10 = yS(10); int x = xs10, y = ys10; diff --git a/cinelerra-5.1/plugins/invertvideo/invert.C b/cinelerra-5.1/plugins/invertvideo/invert.C index 13ee8dd8..4eaf830b 100644 --- a/cinelerra-5.1/plugins/invertvideo/invert.C +++ b/cinelerra-5.1/plugins/invertvideo/invert.C @@ -157,7 +157,7 @@ int InvertVideoEnable::handle_event() InvertVideoWindow::InvertVideoWindow(InvertVideoEffect *plugin) - : PluginClientWindow(plugin, xS(200), yS(130), xS(200), yS(130), 0) + : PluginClientWindow(plugin, xS(150), yS(130), xS(150), yS(130), 0) { this->plugin = plugin; } diff --git a/cinelerra-5.1/plugins/ivtc/ivtcwindow.C b/cinelerra-5.1/plugins/ivtc/ivtcwindow.C index d3b99664..f015fd5e 100644 --- a/cinelerra-5.1/plugins/ivtc/ivtcwindow.C +++ b/cinelerra-5.1/plugins/ivtc/ivtcwindow.C @@ -43,9 +43,9 @@ static const char *pattern_text[] = IVTCWindow::IVTCWindow(IVTCMain *client) : PluginClientWindow(client, xS(210), - yS(230), + yS(200), xS(210), - yS(230), + yS(200), 0) { this->client = client; diff --git a/cinelerra-5.1/plugins/loopvideo/loopvideo.C b/cinelerra-5.1/plugins/loopvideo/loopvideo.C index dd20c24a..d6cfdad8 100644 --- a/cinelerra-5.1/plugins/loopvideo/loopvideo.C +++ b/cinelerra-5.1/plugins/loopvideo/loopvideo.C @@ -100,10 +100,10 @@ LoopVideoConfig::LoopVideoConfig() LoopVideoWindow::LoopVideoWindow(LoopVideo *plugin) : PluginClientWindow(plugin, - xS(210), - yS(160), - xS(200), - yS(160), + xS(160), + yS(70), + xS(160), + yS(70), 0) { this->plugin = plugin; diff --git a/cinelerra-5.1/plugins/overlay/overlay.C b/cinelerra-5.1/plugins/overlay/overlay.C index 8bc8db56..ae908781 100644 --- a/cinelerra-5.1/plugins/overlay/overlay.C +++ b/cinelerra-5.1/plugins/overlay/overlay.C @@ -183,12 +183,7 @@ const char* OverlayConfig::output_to_text(int output_layer) OverlayWindow::OverlayWindow(Overlay *plugin) - : PluginClientWindow(plugin, - xS(300), - yS(160), - xS(300), - yS(160), - 0) + : PluginClientWindow(plugin, xS(300), yS(100), xS(300), yS(100), 0) { this->plugin = plugin; } diff --git a/cinelerra-5.1/plugins/perspective/perspective.C b/cinelerra-5.1/plugins/perspective/perspective.C index c98e9b06..6ad79e5f 100644 --- a/cinelerra-5.1/plugins/perspective/perspective.C +++ b/cinelerra-5.1/plugins/perspective/perspective.C @@ -33,9 +33,9 @@ REGISTER_PLUGIN(PerspectiveMain) PerspectiveConfig::PerspectiveConfig() { x1 = 0; y1 = 0; - x2 = xS(100); y2 = 0; - x3 = xS(100); y3 = yS(100); - x4 = 0; y4 = yS(100); + x2 = 100; y2 = 0; + x3 = 100; y3 = 100; + x4 = 0; y4 = 100; mode = AffineEngine::PERSPECTIVE; smoothing = AffineEngine::AF_DEFAULT; window_w = PERSPECTIVE_WIDTH; diff --git a/cinelerra-5.1/plugins/photoscale/photoscale.C b/cinelerra-5.1/plugins/photoscale/photoscale.C index 55f515f2..790539f6 100644 --- a/cinelerra-5.1/plugins/photoscale/photoscale.C +++ b/cinelerra-5.1/plugins/photoscale/photoscale.C @@ -40,9 +40,9 @@ PhotoScaleWindow::PhotoScaleWindow(PhotoScaleMain *plugin) : PluginClientWindow(plugin, xS(250), - yS(200), + yS(140), xS(250), - yS(200), + yS(140), 0) { this->plugin = plugin; diff --git a/cinelerra-5.1/plugins/radialblur/radialblur.C b/cinelerra-5.1/plugins/radialblur/radialblur.C index 8f25f176..7524a9fd 100644 --- a/cinelerra-5.1/plugins/radialblur/radialblur.C +++ b/cinelerra-5.1/plugins/radialblur/radialblur.C @@ -126,10 +126,10 @@ void RadialBlurConfig::interpolate(RadialBlurConfig &prev, RadialBlurWindow::RadialBlurWindow(RadialBlurMain *plugin) : PluginClientWindow(plugin, - xS(280), - yS(370), - xS(280), - yS(370), + xS(250), + yS(380), + xS(250), + yS(380), 0) { this->plugin = plugin; @@ -182,7 +182,7 @@ void RadialBlurWindow::create_objects() y += ys40; add_subwindow(reset = new RadialBlurReset(plugin, this, x, y)); add_subwindow(default_settings = new RadialBlurDefaultSettings(plugin, this, - (280 - 10 - defaultBtn_w), y, defaultBtn_w)); + (xS(250) - xS(10) - defaultBtn_w), y, defaultBtn_w)); show_window(); flush(); diff --git a/cinelerra-5.1/plugins/reroute/reroute.C b/cinelerra-5.1/plugins/reroute/reroute.C index 6b05b592..3f5cabd2 100644 --- a/cinelerra-5.1/plugins/reroute/reroute.C +++ b/cinelerra-5.1/plugins/reroute/reroute.C @@ -176,7 +176,7 @@ const char* RerouteConfig::output_to_text(int output_track) RerouteWindow::RerouteWindow(Reroute *plugin) - : PluginClientWindow(plugin, xS(300), yS(160), 0, 0, 1) + : PluginClientWindow(plugin, xS(300), yS(70), 0, 0, 1) { this->plugin = plugin; } @@ -223,7 +223,7 @@ RerouteOperation::RerouteOperation(Reroute *plugin, int y) : BC_PopupMenu(x, y, - xS(150), + xS(180), RerouteConfig::operation_to_text(plugin->config.operation), 1) { diff --git a/cinelerra-5.1/plugins/reversevideo/reversevideo.C b/cinelerra-5.1/plugins/reversevideo/reversevideo.C index 4fba5312..a8d737cb 100644 --- a/cinelerra-5.1/plugins/reversevideo/reversevideo.C +++ b/cinelerra-5.1/plugins/reversevideo/reversevideo.C @@ -102,10 +102,10 @@ ReverseVideoConfig::ReverseVideoConfig() ReverseVideoWindow::ReverseVideoWindow(ReverseVideo *plugin) : PluginClientWindow(plugin, - xS(210), - yS(160), - xS(200), - yS(160), + xS(160), + yS(40), + xS(160), + yS(40), 0) { this->plugin = plugin; diff --git a/cinelerra-5.1/plugins/svg/svgwin.C b/cinelerra-5.1/plugins/svg/svgwin.C index e5f5b920..09cbca7b 100644 --- a/cinelerra-5.1/plugins/svg/svgwin.C +++ b/cinelerra-5.1/plugins/svg/svgwin.C @@ -1,4 +1,3 @@ - /* * CINELERRA * Copyright (C) 2008 Adam Williams @@ -212,7 +211,9 @@ void NewSvgButton::run() } new_window = new NewSvgWindow(client, window, directory); new_window->create_objects(); + new_window->lock_window("NewSvgButton::run"); new_window->update_filter("*.svg"); + new_window->unlock_window(); result = new_window->run_window(); const char *filepath = new_window->get_path(0); strcpy(filename, filepath ? filepath : "" ); @@ -340,9 +341,9 @@ void EditSvgButton::run() if( ret != sizeof(fifo_buf) ) continue; switch( fifo_buf.action ) { case 1: break; - case 2: printf(_("Inkscape has exited\n")); + case 2: // printf(_("Inkscape has exited\n")); break; - case 3: printf(_("Plugin window has closed\n")); + case 3: // printf(_("Plugin window has closed\n")); done = 1; break; } @@ -432,7 +433,7 @@ NewSvgWindow::~NewSvgWindow() {} DpiValue::DpiValue(SvgWin *win, SvgMain *client, int x, int y, float *value) - : BC_TumbleTextBox(win, *value, (float)10, (float)1000, x, y, 100) + : BC_TumbleTextBox(win, *value, 10.f, 1000.f, x, y, xS(100), 2) { //printf("SvgWidth::SvgWidth %f\n", client->config.w); this->client = client; -- 2.26.2