From: Good Guy Date: Thu, 18 Feb 2016 23:14:17 +0000 (-0700) Subject: gamma yuva hist fix, theme change without exit X-Git-Url: https://cinelerra-gg.org/git/?a=commitdiff_plain;h=1784ebd93b6c278a5205f040b5b40d8bdd79ed8a;p=goodguy%2Fhistory.git gamma yuva hist fix, theme change without exit bld_scripts faster dnld, wide text fixups --- diff --git a/cinelerra-5.0/bld_scripts/bld_dynamic.sh b/cinelerra-5.0/bld_scripts/bld_dynamic.sh index 87f927ea..32d10dd1 100755 --- a/cinelerra-5.0/bld_scripts/bld_dynamic.sh +++ b/cinelerra-5.0/bld_scripts/bld_dynamic.sh @@ -14,7 +14,7 @@ fi cd "$path/$dir/$bld" rm -rf "$proj" -git clone "git://git.cinelerra-cv.org/goodguy/cinelerra.git" "$proj" +git clone --depth 1 "git://git.cinelerra-cv.org/goodguy/cinelerra.git" "$proj" #rsh host tar -C /mnt0/cinelerra5 -cf - cinelerra | tar -xf - #mv cinelerra cinelerra5 if [ $? -ne 0 ]; then diff --git a/cinelerra-5.0/bld_scripts/bld_static.sh b/cinelerra-5.0/bld_scripts/bld_static.sh index ab3e9e58..53895d0b 100755 --- a/cinelerra-5.0/bld_scripts/bld_static.sh +++ b/cinelerra-5.0/bld_scripts/bld_static.sh @@ -14,7 +14,7 @@ fi cd "$path/$dir/$bld" rm -rf "$proj" -git clone "git://git.cinelerra-cv.org/goodguy/cinelerra.git" "$proj" +git clone --depth 1 "git://git.cinelerra-cv.org/goodguy/cinelerra.git" "$proj" #rsh host tar -C /mnt0/cinelerra5 -cf - cinelerra | tar -xf - #mv cinelerra cinelerra5 if [ $? -ne 0 ]; then diff --git a/cinelerra-5.0/cinelerra/file.C b/cinelerra-5.0/cinelerra/file.C index 03315c01..5742cf86 100644 --- a/cinelerra-5.0/cinelerra/file.C +++ b/cinelerra-5.0/cinelerra/file.C @@ -1652,19 +1652,13 @@ int File::record_fd() void get_exe_path(char *result) { // Get executable path - pid_t pid = getpid(); - char proc_path[BCTEXTLEN]; - int len = 0; - result[0] = 0; - sprintf(proc_path, "/proc/%d/exe", pid); - if((len = readlink(proc_path, result, BCTEXTLEN)) >= 0) - { + int len = readlink("/proc/self/exe", result, BCTEXTLEN); + if( len >= 0 ) { result[len] = 0; -//printf("Preferences::Preferences %d %s\n", __LINE__, result); char *ptr = strrchr(result, '/'); - if(ptr) *ptr = 0; + if( ptr ) *ptr = 0; } - + else + result[0] = 0; } - diff --git a/cinelerra-5.0/cinelerra/main.C b/cinelerra-5.0/cinelerra/main.C index bba65b76..69895ec4 100644 --- a/cinelerra-5.0/cinelerra/main.C +++ b/cinelerra-5.0/cinelerra/main.C @@ -186,6 +186,7 @@ int main(int argc, char *argv[]) + int load_backup = 0; for(int i = 1; i < argc; i++) { @@ -263,6 +264,11 @@ int main(int argc, char *argv[]) } } else + if(!strcmp(argv[i], "-x")) + { + load_backup = 1; + } + else { char *new_filename; new_filename = new char[BCTEXTLEN]; @@ -354,7 +360,6 @@ int main(int argc, char *argv[]) case DO_GUI: { int done = 0; - int load_backup = 0; while( !done ) { BC_WindowBase::get_resources()->vframe_shm = 0; MWindow mwindow; @@ -399,6 +404,15 @@ int main(int argc, char *argv[]) mwindow.save_defaults(); //PRINT_TRACE filenames.remove_all_objects(); +#if 1 + if( !mwindow.reload() ) break; +// due to leaks and munges in x fonts, this loop has to be +// executed via a total program restart 2/18/2016 + char exe_path[BCTEXTLEN]; + if( readlink("/proc/self/exe", exe_path, sizeof(exe_path)) < 0 ) break; + char *const av[3] = { exe_path, (char*)(load_backup? "-x" : 0), 0 }; + execv(exe_path, av); +#endif } //SET_TRACE DISABLE_BUFFER diff --git a/cinelerra-5.0/cinelerra/preferencesthread.C b/cinelerra-5.0/cinelerra/preferencesthread.C index 7a74edc9..8f95e119 100644 --- a/cinelerra-5.0/cinelerra/preferencesthread.C +++ b/cinelerra-5.0/cinelerra/preferencesthread.C @@ -153,6 +153,8 @@ void PreferencesThread::handle_close_event(int result) edl = 0; mwindow->defaults->update("DEFAULTPREF", current_dialog); + if( mwindow->reload_status ) + mwindow->gui->set_done(0); } @@ -199,6 +201,9 @@ int PreferencesThread::apply_settings() (*this_aconfig != *aconfig) || (*this_vconfig != *vconfig) || !preferences->brender_asset->equivalent(*mwindow->preferences->brender_asset, 0, 1); + if( strcmp(preferences->theme, mwindow->preferences->theme) != 0 ) + mwindow->reload_status = 1; + mwindow->edl->copy_session(edl, 1); mwindow->preferences->copy_from(preferences); mwindow->init_brender(); diff --git a/cinelerra-5.0/cinelerra/splashgui.C b/cinelerra-5.0/cinelerra/splashgui.C index eeb3f32e..7441e3de 100644 --- a/cinelerra-5.0/cinelerra/splashgui.C +++ b/cinelerra-5.0/cinelerra/splashgui.C @@ -57,15 +57,9 @@ void SplashGUI::create_objects() draw_vframe(bg, 0, 0); flash(); show_window(); - - add_subwindow(progress = new BC_ProgressBar(5, - get_h() - get_resources()->progress_images[0]->get_h() - 5, - get_w() - 10, - 0, - 0)); add_subwindow(operation = new BC_Title(5, - progress->get_y() - get_text_height(MEDIUMFONT) - 5, + get_h() - get_text_height(MEDIUMFONT) - 5, _("Loading..."))); } diff --git a/cinelerra-5.0/cinelerra/splashgui.h b/cinelerra-5.0/cinelerra/splashgui.h index 5dd205c2..c8ed95c0 100644 --- a/cinelerra-5.0/cinelerra/splashgui.h +++ b/cinelerra-5.0/cinelerra/splashgui.h @@ -33,7 +33,6 @@ public: void create_objects(); BC_Title *operation; VFrame *bg; - BC_ProgressBar *progress; }; diff --git a/cinelerra-5.0/guicast/bcwindowbase.C b/cinelerra-5.0/guicast/bcwindowbase.C index 5f0eb5fd..87403ec8 100644 --- a/cinelerra-5.0/guicast/bcwindowbase.C +++ b/cinelerra-5.0/guicast/bcwindowbase.C @@ -853,20 +853,25 @@ int BC_WindowBase::keysym_lookup(XEvent *event) keys_return[0] = keysym; return 0; } + wkey_string_length = 0; - wkey_string_length = XwcLookupString(input_context, - (XKeyEvent*)event, wkey_string, 4, &keysym, 0); + if( input_context ) { + wkey_string_length = XwcLookupString(input_context, + (XKeyEvent*)event, wkey_string, 4, &keysym, 0); //printf("keysym_lookup 1 %d %d %lx %x %x %x %x\n", wkey_string_length, keysym, // wkey_string[0], wkey_string[1], wkey_string[2], wkey_string[3]); - Status stat; - int ret = Xutf8LookupString(input_context, (XKeyEvent*)event, - keys_return, KEYPRESSLEN, &keysym, &stat); + Status stat; + int ret = Xutf8LookupString(input_context, (XKeyEvent*)event, + keys_return, KEYPRESSLEN, &keysym, &stat); //printf("keysym_lookup 2 %d %d %lx %x %x\n", ret, stat, keysym, keys_return[0], keys_return[1]); - if( stat == XLookupBoth ) return ret; - if( stat == XLookupKeySym ) return 0; - - return XLookupString((XKeyEvent*)event, keys_return, KEYPRESSLEN, &keysym, 0); + if( stat == XLookupBoth ) return ret; + if( stat == XLookupKeySym ) return 0; + } + int ret = XLookupString((XKeyEvent*)event, keys_return, KEYPRESSLEN, &keysym, 0); + wkey_string_length = ret; + for( int i=0; iuse_xft ) return; if(!(smallfont_xft = (resources.small_font_xft[0] == '-' ? XftFontOpenXlfd(display, screen, resources.small_font_xft) : @@ -2781,16 +2787,22 @@ int BC_WindowBase::get_single_text_width(int font, const char *text, int length) int BC_WindowBase::get_single_text_width(int font, const wchar_t *text, int length) { -//#ifdef HAVE_XFT - XGlyphInfo extents; +#ifdef HAVE_XFT + if(get_resources()->use_xft && get_xft_struct(font)) { + XGlyphInfo extents; - XftTextExtents32(top_level->display, - get_xft_struct(font), - (const FcChar32*)text, - length, - &extents); - return extents.xOff; -//#endif + XftTextExtents32(top_level->display, get_xft_struct(font), + (const FcChar32*)text, length, &extents); + return extents.xOff; + } +#endif + if(!get_font_struct(font)) return 0; + XChar2b xtext[length], *xp = xtext; + for( int i=0; ibyte1 = (unsigned char) (text[i] >> 8); + xp->byte2 = (unsigned char) (text[i] & 0xff); + } + return XTextWidth16(get_font_struct(font), xtext, length); } int BC_WindowBase::get_text_width(int font, const char *text, int length) diff --git a/cinelerra-5.0/guicast/bcwindowdraw.C b/cinelerra-5.0/guicast/bcwindowdraw.C index 30e7b09f..0b1f488c 100644 --- a/cinelerra-5.0/guicast/bcwindowdraw.C +++ b/cinelerra-5.0/guicast/bcwindowdraw.C @@ -281,6 +281,18 @@ int BC_WindowBase::wcharpos(const wchar_t *text, XftFont *font, int length, void BC_WindowBase::draw_wtext(int x, int y, const wchar_t *text, int length, BC_Pixmap *pixmap, int *charpos) { + if( !get_resources()->use_xft ) { + if( !get_font_struct(current_font) ) return; + XChar2b xtext[length], *xp = xtext; + for( int i=0; ibyte1 = (unsigned char) (text[i] >> 8); + xp->byte2 = (unsigned char) (text[i] & 0xff); + } + XDrawString16(top_level->display, + pixmap ? pixmap->opaque_pixmap : this->pixmap->opaque_pixmap, + top_level->gc, x, y, xtext, length); + return; + } XRenderColor color; XftColor xft_color; const wchar_t *up, *ubp; diff --git a/cinelerra-5.0/plugins/gamma/gamma.C b/cinelerra-5.0/plugins/gamma/gamma.C index 7e029f7f..4c66a8ff 100644 --- a/cinelerra-5.0/plugins/gamma/gamma.C +++ b/cinelerra-5.0/plugins/gamma/gamma.C @@ -182,9 +182,12 @@ void GammaUnit::process_package(LoadPackage *package) break; case BC_YUVA8888: HISTOGRAM_HEAD(unsigned char) - y = (float)row[0] / 0xff; - u = (float)row[1] / 0xff; - v = (float)row[2] / 0xff; + y = row[0]; + u = row[1]; + v = row[2]; + y /= 0xff; + u = (float)((u - 0x80) / 0xff); + v = (float)((v - 0x80) / 0xff); YUV::yuv_to_rgb_f(r, g, b, y, u, v); HISTOGRAM_TAIL(4) break;