gamma yuva hist fix, theme change without exit
authorGood Guy <[email protected]>
Thu, 18 Feb 2016 23:14:17 +0000 (16:14 -0700)
committerGood Guy <[email protected]>
Thu, 18 Feb 2016 23:14:17 +0000 (16:14 -0700)
 bld_scripts faster dnld, wide text fixups

cinelerra-5.0/bld_scripts/bld_dynamic.sh
cinelerra-5.0/bld_scripts/bld_static.sh
cinelerra-5.0/cinelerra/file.C
cinelerra-5.0/cinelerra/main.C
cinelerra-5.0/cinelerra/preferencesthread.C
cinelerra-5.0/cinelerra/splashgui.C
cinelerra-5.0/cinelerra/splashgui.h
cinelerra-5.0/guicast/bcwindowbase.C
cinelerra-5.0/guicast/bcwindowdraw.C
cinelerra-5.0/plugins/gamma/gamma.C

index 87f927ea126c46125ff5d9370f7d8b6a42f2fa52..32d10dd18f4fd7a3811158898c4ecbde6fe47f84 100755 (executable)
@@ -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
index ab3e9e58ab33e4fabea6832688e52676d9b3be5f..53895d0b34c61f4c304327133f243e37846668f3 100755 (executable)
@@ -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
index 03315c01b8c2b9082af357b660e1a32938481a37..5742cf86ae3b08e9e87cf01042e6eb867b5faaa8 100644 (file)
@@ -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;
 }
 
-
index bba65b7651c30b0a21a78af301b8f279775e6645..69895ec4c996df5fb1f065986896e8e9cc5821b7 100644 (file)
@@ -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
index 7a74edc9aebf9a38136dfe4ea2e136eafcbb94d2..8f95e11967ab8f3e33c893c3d71e3f49d741472f 100644 (file)
@@ -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();
index eeb3f32e2ddbb5200ab0c268884fd014f96c8e6d..7441e3dec4b1ca71791229dbe57619e3684d3ec9 100644 (file)
@@ -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...")));
 }
 
index 5dd205c2f5f44e932b33c11a94f934b2c87a2fe2..c8ed95c0b94a536d421b9a3d48f1147aad4cbb62 100644 (file)
@@ -33,7 +33,6 @@ public:
        void create_objects();
        BC_Title *operation;
        VFrame *bg;
-       BC_ProgressBar *progress;
 };
 
 
index 5f0eb5fd329446375da521cdaa4af70f05de09cf..87403ec8f770159eebf06bd024b3f848a41ed1c8 100644 (file)
@@ -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; i<ret; ++i ) wkey_string[i] = keys_return[i];
+       return ret;
 }
 
 pthread_t locking_task = -1;
@@ -2247,6 +2252,7 @@ int BC_WindowBase::init_fonts()
 void BC_WindowBase::init_xft()
 {
 #ifdef HAVE_XFT
+       if( !get_resources()->use_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; i<length; ++i,++xp ) {
+               xp->byte1 = (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)
index 30e7b09f2f042d9dc50f5d06455480599cf2b68f..0b1f488ce29bfccdc46efd08b516750fbef794e5 100644 (file)
@@ -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; i<length; ++i,++xp ) {
+                       xp->byte1 = (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;
index 7e029f7ff8aceaa1042ba4eaa42914c39be7180b..4c66a8ff26c23b1977fe05a258ba3e1ce6258eaa 100644 (file)
@@ -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;