title color fader/tweaks, bg_color bcbitmap fix, inst.sh fix, lang fr pref tweaks
authorGood Guy <good1.2guy@gmail.com>
Tue, 18 Dec 2018 01:46:15 +0000 (18:46 -0700)
committerGood Guy <good1.2guy@gmail.com>
Tue, 18 Dec 2018 01:46:15 +0000 (18:46 -0700)
24 files changed:
cinelerra-5.1/cinelerra/colorpicker.C
cinelerra-5.1/cinelerra/colorpicker.h
cinelerra-5.1/cinelerra/edit.C
cinelerra-5.1/cinelerra/edit.h
cinelerra-5.1/cinelerra/editpopup.C
cinelerra-5.1/cinelerra/editpopup.h
cinelerra-5.1/cinelerra/mainsession.C
cinelerra-5.1/cinelerra/mainsession.h
cinelerra-5.1/cinelerra/mwindow.C
cinelerra-5.1/cinelerra/mwindow.h
cinelerra-5.1/cinelerra/playbackprefs.C
cinelerra-5.1/cinelerra/recordprefs.C
cinelerra-5.1/cinelerra/resourcepixmap.C
cinelerra-5.1/cinelerra/resourcepixmap.h
cinelerra-5.1/cinelerra/theme.C
cinelerra-5.1/cinelerra/theme.h
cinelerra-5.1/cinelerra/zoombar.C
cinelerra-5.1/cinelerra/zoombar.h
cinelerra-5.1/cinelerra/zoombar.inc
cinelerra-5.1/guicast/bcbitmap.C
cinelerra-5.1/guicast/bcbitmap.h
cinelerra-5.1/guicast/bcpixmap.C
cinelerra-5.1/guicast/bcwindowdraw.C
cinelerra-5.1/inst.sh

index 76692f0d99dcb9630c40aa77085384f5b5c53817..f40a95f8250616ffd43568ffc3df531171a95090 100644 (file)
@@ -311,7 +311,7 @@ void ColorWindow::update_display()
 
 int ColorWindow::handle_event()
 {
-       thread->handle_new_color(rgb888(), (int)(255*aph + 0.5));
+       thread->handle_new_color(rgb888(), alpha8());
        return 1;
 }
 
@@ -360,8 +360,12 @@ int ColorWindow::button_release_event()
 
 void ColorWindow::update_rgb_hex(const char *hex)
 {
-       int color;
+       unsigned color;
        if( sscanf(hex,"%x",&color) == 1 ) {
+               if( thread->do_alpha ) {
+                       aph = ((color>>24) & 0xff) / 255.;
+                       aph_a->update(aph);
+               }
                float r = ((color>>16) & 0xff) / 255.;
                float g = ((color>>8)  & 0xff) / 255.;
                float b = ((color>>0)  & 0xff) / 255.;
@@ -807,6 +811,7 @@ int PaletteAlpha::handle_event()
 {
        window->aph = get_value();
        window->aph_a->update(window->aph);
+       window->hex_box->update();
        window->handle_event();
        return 1;
 }
@@ -973,6 +978,12 @@ int ColorWindow::rgb888()
        bclamp(r, 0, 255);  bclamp(g, 0, 255);  bclamp(b, 0, 255);
        return (r<<16) | (g<<8) | (b<<0);
 }
+int ColorWindow::alpha8()
+{
+       int a = 255*aph + 0.5;
+       bclamp(a, 0, 255);
+       return a;
+}
 
 PaletteNum::PaletteNum(ColorWindow *window, int x, int y,
        float &output, float min, float max)
@@ -1047,7 +1058,10 @@ PaletteHex::~PaletteHex()
 }
 void PaletteHex::update()
 {
-       char hex[BCSTRLEN];  sprintf(hex,"%06x",window->rgb888());
+       char hex[BCSTRLEN], *cp = hex;
+       if( window->thread->do_alpha )
+               cp += sprintf(cp,"%02x", window->alpha8());
+       sprintf(cp,"%06x",window->rgb888());
        BC_TextBox::update(hex);
 }
 
index a5d203d29fc47fa31506cb9030e30a6c9eb0b1c4..5f8b1337c5f500fc9727483592065e4322302cf3 100644 (file)
@@ -83,6 +83,7 @@ public:
        void update_yuv(float y, float u, float v);
        void update_rgb_hex(const char *hex);
        int rgb888();
+       int alpha8();
 
        ColorPicker *thread;
        PaletteWheel *wheel;
index 347e94086daa8a7a3bae779873c7b5ecbdf065a4..79e95f36ee6202c67ed2e702de69bceb685190ae 100644 (file)
@@ -86,7 +86,7 @@ void Edit::reset()
        is_selected = 0;
        hard_left = 0;
        hard_right = 0;
-       color = -1;
+       color = 0;
 }
 
 Indexable* Edit::get_source()
@@ -817,21 +817,3 @@ void Edit::get_title(char *title)
        }
 }
 
-int Edit::get_hash_color()
-{
-       Indexable *idxbl = asset ? (Indexable*)asset : (Indexable*)nested_edl;
-       if( !idxbl ) return -1;
-       int v = 0;
-       for( uint8_t *bp=(uint8_t*)idxbl->path; *bp; ++bp ) v += *bp;
-       int color = 0x303030;
-       if( v & 0x01 ) color ^= 0x000040;
-       if( v & 0x02 ) color ^= 0x004000;
-       if( v & 0x04 ) color ^= 0x400000;
-       if( v & 0x08 ) color ^= 0x080000;
-       if( v & 0x10 ) color ^= 0x000800;
-       if( v & 0x20 ) color ^= 0x000008;
-       if( v & 0x40 ) color ^= 0x202020;
-       if( v & 0x80 ) color ^= 0x101010;
-       return color;
-}
-
index a23f92e1019dc73034e104b44a530b5c0f87cdec..67b091593e797cfe108686bfc5481ce27b5a8e31 100644 (file)
@@ -169,10 +169,6 @@ public:
                float zoom_units) { return 0; }
        virtual int64_t get_source_end(int64_t default_);
        void get_title(char *title);
-// edit title bar color
-       int get_title_color();
-// default edit title bar color
-       int get_hash_color();
 
        int dump(FILE *fp=stdout);
        virtual int dump_derived() { return 0; }
index 7ba0e6a12d0d428da417fe75b085ebbbeccb6b7f..cbc57606b3fac5139769e18178882e55b6ac51e8 100644 (file)
@@ -423,10 +423,11 @@ int EditPopupTitleColor::handle_event()
 {
        if( popup->edit ) {
                int color = popup->mwindow->get_title_color(popup->edit);
-               if( color < 0 ) color = popup->mwindow->theme->get_color_title_bg();
+               if( !color ) color = popup->mwindow->theme->get_color_title_bg();
                delete color_picker;
-               color_picker = new EditTitleColorPicker(popup);
-               color_picker->start_window(color, -1, 1);
+               color_picker = new EditTitleColorPicker(popup, color);
+               int alpha = (~color>>24) & 0xff;
+               color_picker->start_window(color & 0xffffff, alpha, 1);
        }
        return 1;
 }
@@ -440,30 +441,31 @@ EditTitleColorDefault::EditTitleColorDefault(
 
 int EditTitleColorDefault::handle_event()
 {
-       int color = color_picker->popup->mwindow->theme->get_color_title_bg();
-       color_picker->update_gui(color, -1);
+       color_picker->color = 0;
+       color_picker->update_gui(0, 0);
        return 1;
 }
 
-EditTitleColorPicker::EditTitleColorPicker(EditPopup *popup)
- : ColorPicker(0, _("Bar Color"))
+EditTitleColorPicker::EditTitleColorPicker(EditPopup *popup, int color)
+ : ColorPicker(1, _("Bar Color"))
 {
        this->popup = popup;
-       color = -1;
+       this->color = color;
 }
 EditTitleColorPicker::~EditTitleColorPicker()
 {
 }
 void EditTitleColorPicker::create_objects(ColorWindow *gui)
 {
-       int y = gui->get_h() - BC_CancelButton::calculate_h() - 50;
-       int x = gui->get_w() - BC_GenericButton::calculate_w(gui, _("default")) - 15;
+       int y = gui->get_h() - BC_CancelButton::calculate_h() + 10;
+       int x = gui->get_w() - BC_CancelButton::calculate_w() - 10;
+       x -= BC_GenericButton::calculate_w(gui, _("default")) + 15;
        gui->add_subwindow(new EditTitleColorDefault(this, x, y));
 }
 
 int EditTitleColorPicker::handle_new_color(int color, int alpha)
 {
-       this->color = color;
+       this->color = color | (~alpha << 24);
        return 1;
 }
 
index f0ef10d6488aa53e7bc05ded5329fed02496ccc0..90fd9ace60da540d1a2f74f31d2dbe3a463f2145 100644 (file)
@@ -234,7 +234,7 @@ public:
 class EditTitleColorPicker : public ColorPicker
 {
 public:
-       EditTitleColorPicker(EditPopup *popup);
+       EditTitleColorPicker(EditPopup *popup, int color);
        ~EditTitleColorPicker();
        void create_objects(ColorWindow *gui);
        int handle_new_color(int color, int alpha);
index d8e563d6b3a9411c7d3ceb2c32a9b0ecfbf40275..ef81185acdc62f814d9929c37e6c6a4c6460c8a9 100644 (file)
@@ -68,6 +68,7 @@ MainSession::MainSession(MWindow *mwindow)
        zwindow_fullscreen = 0;
        selected_zwindow = -1;
        actual_frame_rate = 0;
+       title_bar_alpha = 0;
        window_config = 0;
        a_x11_host[0] = 0;
        b_x11_host[0] = 0;
@@ -450,6 +451,7 @@ int MainSession::load_defaults(BC_Hash *defaults)
 
        current_tip = defaults->get("CURRENT_TIP", current_tip);
        actual_frame_rate = defaults->get("ACTUAL_FRAME_RATE", (float)-1);
+       title_bar_alpha = defaults->get("TITLE_BAR_ALPHA", (float)0);
 
        boundaries();
        return 0;
@@ -569,6 +571,7 @@ int MainSession::save_defaults(BC_Hash *defaults)
        defaults->update("TRANSITIONDIALOG_H", transitiondialog_h);
 
        defaults->update("ACTUAL_FRAME_RATE", actual_frame_rate);
+       defaults->update("TITLE_BAR_ALPHA", title_bar_alpha);
        defaults->update("CURRENT_TIP", current_tip);
 
 
index 92e40a59f11fcd3c5da8ef4379431141ecb6cbcd..8cbc35c35b743a61efa72e39b2b401d132c312dc 100644 (file)
@@ -114,6 +114,9 @@ public:
 // filename of the current project for window titling and saving
        char filename[BCTEXTLEN];
 
+// title bar background blend
+       float title_bar_alpha;
+
        int batchrender_x, batchrender_y, batchrender_w, batchrender_h;
 
 // Window positions
index 77c1eba14aa08c97aa73e8467273b4dc017c4333..263bbd989621bdfa7e3195084801d4e36939f515 100644 (file)
@@ -3292,12 +3292,44 @@ void MWindow::hide_keyframe_gui(Plugin *plugin)
        keyframe_gui_lock->unlock();
 }
 
+int MWindow::get_hash_color(Edit *edit)
+{
+       Indexable *idxbl = edit->asset ?
+               (Indexable*)edit->asset : (Indexable*)edit->nested_edl;
+       if( !idxbl ) return 0;
+       char path[BCTEXTLEN];
+       if( !edit->asset || edit->track->data_type != TRACK_VIDEO ||
+           edl->session->proxy_scale == 1 ||
+           ProxyRender::from_proxy_path(path, idxbl, edl->session->proxy_scale) )
+               strcpy(path, idxbl->path);
+       char *cp = strrchr(path, '/');
+       cp = !cp ? path : cp+1;
+       uint8_t *bp = (uint8_t*)cp;
+       int v = 0;
+       while( *bp ) v += *bp++;
+       int hash = 0x303030;
+       if( v & 0x01 ) hash ^= 0x000040;
+       if( v & 0x02 ) hash ^= 0x004000;
+       if( v & 0x04 ) hash ^= 0x400000;
+       if( v & 0x08 ) hash ^= 0x080000;
+       if( v & 0x10 ) hash ^= 0x000800;
+       if( v & 0x20 ) hash ^= 0x000008;
+       if( v & 0x40 ) hash ^= 0x404040;
+       if( v & 0x80 ) hash ^= 0x080808;
+       return hash;
+}
+
 int MWindow::get_title_color(Edit *edit)
 {
-        int color = edit->color;
-       if( color < 0 && preferences->autocolor_assets )
-               color = edit->get_hash_color();
-       return color;
+        unsigned color = edit->color;
+       if( !color ) {
+               if( !preferences->autocolor_assets ) return 0;
+               color = get_hash_color(edit);
+       }
+       unsigned alpha = (~edit->color>>24) & 0xff;
+       if( alpha == 0xff )
+               alpha = session->title_bar_alpha*255;
+       return color | (~alpha<<24);
 }
 
 void MWindow::update_keyframe_guis()
index ab2d8d58edf70e6d2ec10d44aa16ceb91abe4b3c..4371099e03953e0b38b4637834369505dd702870 100644 (file)
@@ -310,6 +310,7 @@ public:
        void hide_keyframe_guis();
        void hide_keyframe_gui(Plugin *plugin);
        void update_keyframe_guis();
+       int get_hash_color(Edit *edit);
        int get_title_color(Edit *edit);
 
 // ============================= editing commands ========================
index d84913135a954c3c7305e6da3d962b3fbf88c015..264566f10502281c737bb5b7495bedb813e7f7a6 100644 (file)
@@ -157,7 +157,7 @@ SET_TRACE
 SET_TRACE
        add_subwindow(title1 = new BC_Title(x, y, _("Scaling equation: Enlarge / Reduce ")));
        VScalingEquation *vscaling_equation =
-               new VScalingEquation(x + title1->get_w() + 10, y,
+               new VScalingEquation(x + title1->get_w() + 65, y,
                        &pwindow->thread->edl->session->interpolation_type);
        add_subwindow(vscaling_equation);
        vscaling_equation->create_objects();
@@ -170,7 +170,7 @@ SET_TRACE
        subtitle_number = new PlaybackSubtitleNumber(x1, y, pwindow, this);
        subtitle_number->create_objects();
 
-       x2 = x + title1->get_w() + 10 + subtitle_number->get_w() + 30;
+       x2 = x + title1->get_w() + 10 + subtitle_number->get_w() + 85;
        PlaybackSubtitle *subtitle_toggle;
        x1 += subtitle_number->get_w() + margin;
        add_subwindow(subtitle_toggle = new PlaybackSubtitle(x2, y, pwindow, this));
index 5a023a228a485b9fedf15540d95c4aea8a0b885d..318cbfb401cecdd5b947a8f11c457ee43d6e82c4 100644 (file)
@@ -205,7 +205,7 @@ void RecordPrefs::create_objects()
 
        x1 = x;
        add_subwindow(new BC_Title(x1, y, _("Positioning:")));
-       x1 += 100;
+       x1 += 120;
        add_subwindow(textbox = new BC_TextBox(x1, y, 200, 1, ""));
        RecordPositioning *positioning = new RecordPositioning(pwindow,textbox);
        add_subwindow(positioning);
index eb27656179f97795e7bc18d79c5cc9b533d29f0b..0da77299438ab769f192132e0ac216392d5ed37f 100644 (file)
@@ -194,16 +194,13 @@ void ResourcePixmap::draw_data(TrackCanvas *canvas,
        refresh_w = pixmap_w;
 
 // Draw background image
-       if( refresh_w > 0 )
-               mwindow->theme->draw_resource_bg(canvas,
-                       this,
-                       edit_x,
-                       edit_w,
-                       pixmap_x,
-                       refresh_x,
-                       y,
-                       refresh_x + refresh_w,
-                       mwindow->edl->local_session->zoom_track + y);
+       if( refresh_w > 0 ) {
+               int x1 = refresh_x, x2 = x1 + refresh_w;
+               int y1 = y, y2 = y1 + mwindow->edl->local_session->zoom_track;
+               int color = mwindow->get_title_color(edit);
+               mwindow->theme->draw_resource_bg(canvas, this, color,
+                       edit_x, edit_w, pixmap_x, x1,y1, x2,y2);
+       }
 //printf("ResourcePixmap::draw_data 70\n");
 
 
@@ -214,28 +211,18 @@ void ResourcePixmap::draw_data(TrackCanvas *canvas,
                {
                        case TRACK_AUDIO:
                                draw_audio_resource(canvas,
-                                       edit,
-                                       refresh_x,
-                                       refresh_w);
+                                       edit, refresh_x, refresh_w);
                                break;
 
                        case TRACK_VIDEO:
-                               draw_video_resource(canvas,
-                                       edit,
-                                       edit_x,
-                                       edit_w,
-                                       pixmap_x,
-                                       pixmap_w,
-                                       refresh_x,
-                                       refresh_w,
+                               draw_video_resource(canvas, edit, edit_x, edit_w,
+                                       pixmap_x, pixmap_w, refresh_x, refresh_w,
                                        mode);
                                break;
 
                        case TRACK_SUBTITLE:
-                               draw_subttl_resource(canvas,
-                                       edit,
-                                       refresh_x,
-                                       refresh_w);
+                               draw_subttl_resource(canvas, edit,
+                                       refresh_x, refresh_w);
                                break;
                }
        }
@@ -245,24 +232,57 @@ SET_TRACE
 
 VFrame *ResourcePixmap::change_title_color(VFrame *title_bg, int color)
 {
-       if( color < 0 ) return title_bg;
        int colormodel = title_bg->get_color_model();
        int bpp = BC_CModels::calculate_pixelsize(colormodel);
-       int tw = title_bg->get_w(), th = title_bg->get_h();
+       int tw = title_bg->get_w(), tw1 = tw-1, th = title_bg->get_h();
        VFrame *title_bar = new VFrame(tw, th, colormodel);
        uint8_t cr = (color>>16), cg = (color>>8), cb = (color>>0);
        uint8_t **bar_rows = title_bar->get_rows();
-       for( int y=0; y<th; ++y ) {
-               uint8_t *cp = bar_rows[y];
+       if( th > 0 ) {
+               uint8_t *cp = bar_rows[0];
                for( int x=0; x<tw; ++x ) {
+                       cp[0] = cp[1] = cp[2] = 0;
+                       if( bpp > 3 ) cp[3] = 0xff;
+                       cp += bpp;
+               }
+       }
+       for( int y=1; y<th; ++y ) {
+               uint8_t *cp = bar_rows[y];
+               if( tw > 0 ) {
+                       cp[0] = cp[1] = cp[2] = 0;
+                       if( bpp > 3 ) cp[3] = 0xff;
+                       cp += bpp;
+               }
+               for( int x=1; x<tw1; ++x ) {
                        cp[0] = cr; cp[1] = cg; cp[2] = cb;
                        if( bpp > 3 ) cp[3] = 0xff;
                        cp += bpp;
                }
+               if( tw > 1 ) {
+                       cp[0] = cp[1] = cp[2] = 0;
+                       if( bpp > 3 ) cp[3] = 0xff;
+               }
        }
        return title_bar;
 }
 
+VFrame *ResourcePixmap::change_picon_alpha(VFrame *picon_frame, int alpha)
+{
+       uint8_t **picon_rows = picon_frame->get_rows();
+       int w = picon_frame->get_w(), h = picon_frame->get_h();
+       VFrame *frame = new VFrame(w, h, BC_RGBA8888);
+       uint8_t **rows = frame->get_rows();
+       for( int y=0; y<h; ++y ) {
+               uint8_t *bp = picon_rows[y], *rp = rows[y];
+               for( int x=0; x<w; ++x ) {
+                       rp[0] = bp[0];  rp[1] = bp[1];
+                       rp[2] = bp[2];  bp += 3;
+                       rp[3] = alpha;  rp += 4;
+               }
+       }
+       return frame;
+}
+
 void ResourcePixmap::draw_title(TrackCanvas *canvas,
        Edit *edit, int64_t edit_x, int64_t edit_w,
        int64_t pixmap_x, int64_t pixmap_w)
@@ -277,7 +297,7 @@ void ResourcePixmap::draw_title(TrackCanvas *canvas,
 
        VFrame *title_bg = mwindow->theme->get_image("title_bg_data");
        int color = mwindow->get_title_color(edit);
-       VFrame *title_bar = color < 0 ? title_bg :
+       VFrame *title_bar = !color ? title_bg :
                change_title_color(title_bg, color);
        canvas->draw_3segmenth(x, 0, w, total_x, total_w, title_bar, this);
        if( title_bar != title_bg ) delete title_bar;
@@ -592,8 +612,20 @@ void ResourcePixmap::draw_video_resource(TrackCanvas *canvas,
                        mwindow->frame_cache->get_frame_ptr(speed_position, edit->channel,
                                mwindow->edl->session->frame_rate, BC_RGB888,
                                picon_w, picon_h, indexable->id);
+               int bg_color = gui->get_bg_color();
                if( picon_frame ) {
-                       draw_vframe(picon_frame, x, y, picon_w, picon_h, 0, 0);
+                       VFrame *frame = picon_frame;
+                       int color = mwindow->get_title_color(edit);
+                       if( color ) {
+                               int alpha = (~color >> 24) & 0xff;
+                               frame = change_picon_alpha(picon_frame, alpha);
+                               gui->set_bg_color(color & 0xffffff);
+                       }
+                       draw_vframe(frame, x, y, picon_w, picon_h, 0, 0);
+                       if( frame != picon_frame ) {
+                               delete frame;
+                               gui->set_bg_color(bg_color);
+                       }
                        mwindow->frame_cache->unlock();
                }
                else if( mode != IGNORE_THREAD ) {
index 931877fea7cfa2f31ae2418697a3fc89372ba002..7f5fba2c780a61a486a260a82ccacd7ce9fbf67c 100644 (file)
@@ -61,6 +61,7 @@ public:
        void draw_wave(TrackCanvas *canvas,
                int x, double high, double low);
        VFrame *change_title_color(VFrame *title_bg, int color);
+       VFrame *change_picon_alpha(VFrame *picon_frame, int alpha);
        void draw_title(TrackCanvas *canvas,
                Edit *edit, int64_t edit_x, int64_t edit_w,
                int64_t pixmap_x, int64_t pixmap_w);
index 5a1d95d6d5a83f72eca472f10f1e7ddc16a7b6ca..55e2cbc051c65cf5120bf79561e7bf920ac38d14 100644 (file)
@@ -896,36 +896,34 @@ void Theme::draw_rwindow_bg(RecordGUI *gui)
 }
 
 
-void Theme::draw_resource_bg(TrackCanvas *canvas,
-       ResourcePixmap *pixmap,
-       int edit_x,
-       int edit_w,
-       int pixmap_x,
-       int x1,
-       int y1,
-       int x2,
-       int y2)
+void Theme::draw_resource_bg(TrackCanvas *canvas, ResourcePixmap *pixmap, int color,
+       int edit_x, int edit_w, int pixmap_x, int x1, int y1, int x2, int y2)
 {
-       VFrame *image;
+       VFrame *image = 0;
 
-       switch(mwindow->edl->local_session->zoom_track)
-       {
+       switch(mwindow->edl->local_session->zoom_track) {
                case 1024: image = get_image("resource1024");  break;
                case 512: image = get_image("resource512");  break;
                case 256: image = get_image("resource256");  break;
                case 128: image = get_image("resource128");  break;
                case 64:  image = get_image("resource64");   break;
-               default:
-               case 32:  image = get_image("resource32");   break;
        }
-
-       canvas->draw_3segmenth(x1,
-               y1,
-               x2 - x1,
-               edit_x - pixmap_x,
-               edit_w,
-               image,
-               pixmap);
+       if( !image )
+               image = get_image("resource32");
+
+       VFrame *frame = image;
+       int bg_color = canvas->get_bg_color();
+       if( color ) {
+               int alpha = (~color >> 24) & 0xff;
+               frame = pixmap->change_picon_alpha(image, alpha);
+               canvas->set_bg_color(color & 0xffffff);
+       }
+       canvas->draw_3segmenth(x1, y1, x2 - x1,
+               edit_x - pixmap_x, edit_w, frame, pixmap);
+       if( frame != image ) {
+               delete frame;
+               canvas->set_bg_color(bg_color);
+       }
 }
 
 
index 028957cffd76567f318b55aaa7eaf99313b41f8a..5873fcd865e9d4ff7a397282930a597faaac14b7 100644 (file)
@@ -104,15 +104,8 @@ public:
        virtual void draw_lwindow_bg(LevelWindowGUI *gui);
        virtual void draw_mwindow_bg(MWindowGUI *gui);
        virtual void draw_vwindow_bg(VWindowGUI *gui);
-       virtual void draw_resource_bg(TrackCanvas *canvas,
-               ResourcePixmap *pixmap,
-               int edit_x,
-               int edit_w,
-               int pixmap_x,
-               int x1,
-               int y1,
-               int x2,
-               int y2);
+       virtual void draw_resource_bg(TrackCanvas *canvas, ResourcePixmap *pixmap, int color,
+               int edit_x, int edit_w, int pixmap_x, int x1, int y1, int x2, int y2);
 
        virtual void get_preferences_sizes();
        virtual void draw_preferences_bg(PreferencesWindow *gui);
index 408473d6ec0167c6ca7d1a722ffbc245e5bc1fd3..9f1c95bcb0e9d596f7562176179350e226ec2fe9 100644 (file)
@@ -39,8 +39,6 @@
 #include "zoombar.h"
 
 
-
-
 ZoomBar::ZoomBar(MWindow *mwindow, MWindowGUI *gui)
  : BC_SubWindow(mwindow->theme->mzoom_x,
        mwindow->theme->mzoom_y,
@@ -49,7 +47,6 @@ ZoomBar::ZoomBar(MWindow *mwindow, MWindowGUI *gui)
 {
        this->gui = gui;
        this->mwindow = mwindow;
-       old_position = 0;
 }
 
 ZoomBar::~ZoomBar()
@@ -107,14 +104,12 @@ void ZoomBar::create_objects()
        x += length_value->get_w() + 5;
        add_subwindow(to_value = new ToTextBox(mwindow, this, x, y));
        x += to_value->get_w() + 5;
+       add_subwindow(title_alpha = new TitleBarAlpha(mwindow, this, x, y));
 
        update_formatting(from_value);
        update_formatting(length_value);
        update_formatting(to_value);
 
-       add_subwindow(playback_value = new BC_Title(x, 100, "--", MEDIUMFONT, RED));
-
-       add_subwindow(zoom_value = new BC_Title(x, 100, "--", MEDIUMFONT, BLACK));
        update();
 }
 
@@ -198,19 +193,21 @@ int ZoomBar::update_clocks()
        return 0;
 }
 
-int ZoomBar::update_playback(int64_t new_position)
+TitleBarAlpha::TitleBarAlpha(MWindow *mwindow, ZoomBar *zoombar, int x, int y)
+ : BC_FSlider(x, y, 0, 150, 200, 0, 1.0, mwindow->session->title_bar_alpha, 0)
 {
-       if(new_position != old_position)
-       {
-               Units::totext(string, new_position,
-                               mwindow->edl->session->sample_rate,
-                               mwindow->edl->session->time_format,
-                               mwindow->edl->session->frame_rate,
-                               mwindow->edl->session->frames_per_foot);
-               playback_value->update(string);
-               old_position = new_position;
-       }
-       return 0;
+       this->mwindow = mwindow;
+       this->zoombar = zoombar;
+       set_precision(0.01);
+       set_tooltip(_("TitleBar Alpha"));
+}
+
+int TitleBarAlpha::handle_event()
+{
+       mwindow->session->title_bar_alpha = get_value();
+       mwindow->gui->draw_trackmovement();
+       mwindow->gui->flush();
+       return 1;
 }
 
 int ZoomBar::resize_event(int w, int h)
index 729a2266c848fb00f21b8d6f4d6e34eb002b0ace..c013b019cc33ed240d7745a80f736fd6f3c8ab1c 100644 (file)
 #ifndef ZOOMBAR_H
 #define ZOOMBAR_H
 
-class FromTextBox;
-class LengthTextBox;
-class ToTextBox;
-
-
-class SampleZoomPanel;
-class AmpZoomPanel;
-class TrackZoomPanel;
-class AutoZoom;
-class AutoTypeMenu;
-class ZoomTextBox;
-
 #include "guicast.h"
 #include "mwindow.inc"
 #include "mwindowgui.inc"
+#include "zoombar.inc"
 #include "zoompanel.h"
 
+
 class ZoomBar : public BC_SubWindow
 {
 public:
@@ -66,12 +56,11 @@ public:
        AutoTypeMenu *auto_type;
        ZoomTextBox *auto_zoom_text;
 
-       BC_Title *zoom_value, *playback_value;
        LengthTextBox *length_value;
        FromTextBox *from_value;
        ToTextBox *to_value;
+       TitleBarAlpha *title_alpha;
        char string[256], string2[256];
-       int64_t old_position;
 };
 
 class SampleZoomPanel : public ZoomPanel
@@ -138,12 +127,6 @@ public:
 };
 
 
-
-
-
-
-
-
 class FromTextBox : public BC_TextBox
 {
 public:
@@ -178,7 +161,13 @@ public:
        ZoomBar *zoombar;
 };
 
-
-
+class TitleBarAlpha : public BC_FSlider
+{
+public:
+       TitleBarAlpha(MWindow *mwindow, ZoomBar *zoombar, int x, int y);
+       int handle_event();
+       MWindow *mwindow;
+       ZoomBar *zoombar;
+};
 
 #endif
index 3ba46a558b578b3baf13586c1c7f7e3607dfbfff..ceb7c66bfa030731d772336ddbed1fb7ccc5fb27 100644 (file)
 #define ZOOMBAR_INC
 
 class ZoomBar;
+class SampleZoomPanel;
+class AmpZoomPanel;
+class TrackZoomPanel;
+class AutoZoom;
+class AutoTypeMenu;
+class ZoomTextBox;
+class FromTextBox;
+class LengthTextBox;
+class ToTextBox;
+class TitleBarAlpha;
+
 #define ZOOMBAR_PIXELS 24
 
 #endif
index e430c071058df5b1789f2b9de103631ae8b1754f..2d8b621fd2aee04fa71406e418a9b08649506aef 100644 (file)
@@ -329,7 +329,6 @@ int BC_Bitmap::initialize(BC_WindowBase *parent_window,
        this->use_shm = !use_shm ? 0 : need_shm();
         this->shm_reply = this->use_shm && resources->shm_reply ? 1 : 0;
        // dont use shm for less than one page
-       this->bg_color = parent_window->bg_color;
        if( !this->avail_lock )
                this->avail_lock = new Mutex("BC_Bitmap::avail_lock");
        else
@@ -483,12 +482,6 @@ int BC_Bitmap::need_shm()
                parent_window->get_resources()->use_shm > 0 ? 1 : 0;
 }
 
-int BC_Bitmap::set_bg_color(int color)
-{
-       this->bg_color = color;
-       return 0;
-}
-
 int BC_Bitmap::invert()
 {
        for( int j=0; j<buffer_count; ++j ) {
@@ -620,16 +613,21 @@ int BC_Bitmap::read_drawable(Drawable &pixmap, int source_x, int source_y, VFram
 // ============================ Decoding VFrames
 
 int BC_Bitmap::read_frame(VFrame *frame, int x1, int y1, int x2, int y2)
+{
+       return read_frame(frame, x1, y1, x2, y2, parent_window->get_bg_color());
+}
+
+int BC_Bitmap::read_frame(VFrame *frame, int x1, int y1, int x2, int y2, int bg_color)
 {
        return read_frame(frame,
                0, 0, frame->get_w(), frame->get_h(),
-               x1, y1, x2 - x1, y2 - y1);
+               x1, y1, x2 - x1, y2 - y1, bg_color);
 }
 
 
 int BC_Bitmap::read_frame(VFrame *frame,
        int in_x, int in_y, int in_w, int in_h,
-       int out_x, int out_y, int out_w, int out_h)
+       int out_x, int out_y, int out_w, int out_h, int bg_color)
 {
        BC_BitmapImage *bfr = cur_bfr();
        if( hardware_scaling() && frame->get_color_model() == color_model ) {
index 221248b9107046a65fe73adef1f857c7ad97c9d4..f065000ac77c39222019f58363ded3abfb56e12d 100644 (file)
@@ -178,8 +178,6 @@ class BC_Bitmap
        long best_buffer_size();
        int need_shm();
 
-// Background color for using pngs
-       int bg_color;
 // Override top_level for small bitmaps
        int use_shm;
        BC_WindowBase *top_level;
@@ -203,10 +201,13 @@ public:
 // transfer VFrame
        int read_frame(VFrame *frame,
                int in_x, int in_y, int in_w, int in_h,
-               int out_x, int out_y, int out_w, int out_h);
+               int out_x, int out_y, int out_w, int out_h,
+               int bg_color);
 // x1, y1, x2, y2 dimensions of output area
        int read_frame(VFrame *frame,
                int x1, int y1, int x2, int y2);
+       int read_frame(VFrame *frame,
+               int x1, int y1, int x2, int y2, int bg_color);
 // Reset bitmap to match the new parameters
        int match_params(int w, int h, int color_model, int use_shm);
 // Test if bitmap already matches parameters
@@ -258,7 +259,6 @@ public:
        int is_unshared() { return type==bmXvImage  || type==bmXImage; }
        int is_zombie() { return cur_bfr()->is_zombie(); }
 
-       int set_bg_color(int color);
        int invert();
 };
 
index 1489f5bed9543f72270f4fa0ff21dca1780215a0..08491aee2e5e73f44d66d600bde66074053538f7 100644 (file)
@@ -46,16 +46,10 @@ BC_Pixmap::BC_Pixmap(BC_WindowBase *parent_window,
        if(use_opaque())
        {
                opaque_bitmap = new BC_Bitmap(parent_window,
-                                       frame->get_w(),
-                                       frame->get_h(),
-                                       parent_window->get_color_model(),
-                                       0);
-               opaque_bitmap->set_bg_color(parent_window->get_bg_color());
+                       frame->get_w(), frame->get_h(),
+                       parent_window->get_color_model(), 0);
                opaque_bitmap->read_frame(frame,
-                       0,
-                       0,
-                       frame->get_w(),
-                       frame->get_h());
+                       0, 0, frame->get_w(), frame->get_h());
 
        }
 
index c81c36963223fa2b91e6ef3faeaaeff3ba71386e..dd0aee2fb3f10f0cd1657dac5acde42f13a72cbd 100644 (file)
@@ -396,21 +396,18 @@ void BC_WindowBase::truncate_text(char *result, const char *text, int w)
 {
        int new_w = get_text_width(current_font, text);
 
-       if(new_w > w)
-       {
+       if( new_w > w ) {
                const char* separator = "...";
                int separator_w = get_text_width(current_font, separator);
 // can't fit
-               if(separator_w >= w)
-               {
+               if( separator_w >= w ) {
                        strcpy(result, separator);
                        return;
                }
 
                int text_len = strlen(text);
 // widen middle gap until it fits
-               for(int i = text_len / 2; i > 0; i--)
-               {
+               for( int i=text_len/2; i>0; --i ) {
                        strncpy(result, text, i);
                        result[i] = 0;
                        strcat(result, separator);
@@ -425,10 +422,8 @@ void BC_WindowBase::truncate_text(char *result, const char *text, int w)
                strcpy(result, separator);
                return;
        }
-       else
-       {
-               strcpy(result, text);
-       }
+
+       strcpy(result, text);
 }
 
 void BC_WindowBase::draw_center_text(int x, int y, const char *text, int length)
@@ -442,19 +437,13 @@ void BC_WindowBase::draw_center_text(int x, int y, const char *text, int length)
 void BC_WindowBase::draw_line(int x1, int y1, int x2, int y2, BC_Pixmap *pixmap)
 { BT
 // Some X drivers can't draw 0 length lines
-       if(x1 == x2 && y1 == y2)
-       {
+       if( x1 == x2 && y1 == y2 ) {
                draw_pixel(x1, y1, pixmap);
        }
-       else
-       {
+       else {
                XDrawLine(top_level->display,
                        pixmap ? pixmap->opaque_pixmap : this->pixmap->opaque_pixmap,
-                       top_level->gc,
-                       x1,
-                       y1,
-                       x2,
-                       y2);
+                       top_level->gc, x1, y1, x2, y2);
        }
 }
 
@@ -463,18 +452,14 @@ void BC_WindowBase::draw_polygon(ArrayList<int> *x, ArrayList<int> *y, BC_Pixmap
        int npoints = MIN(x->total, y->total);
        XPoint *points = new XPoint[npoints];
 
-       for(int i = 0; i < npoints; i++)
-       {
+       for( int i=0; i<npoints; ++i ) {
                points[i].x = x->values[i];
                points[i].y = y->values[i];
        }
 
        XDrawLines(top_level->display,
-       pixmap ? pixmap->opaque_pixmap : this->pixmap->opaque_pixmap,
-       top_level->gc,
-       points,
-       npoints,
-       CoordModeOrigin);
+               pixmap ? pixmap->opaque_pixmap : this->pixmap->opaque_pixmap,
+               top_level->gc, points, npoints, CoordModeOrigin);
 
        delete [] points;
 }
@@ -484,19 +469,14 @@ void BC_WindowBase::fill_polygon(ArrayList<int> *x, ArrayList<int> *y, BC_Pixmap
        int npoints = MIN(x->total, y->total);
        XPoint *points = new XPoint[npoints];
 
-       for(int i = 0; i < npoints; i++)
-       {
+       for( int i=0; i<npoints; ++i ) {
                points[i].x = x->values[i];
                points[i].y = y->values[i];
        }
 
        XFillPolygon(top_level->display,
-       pixmap ? pixmap->opaque_pixmap : this->pixmap->opaque_pixmap,
-       top_level->gc,
-       points,
-       npoints,
-               Nonconvex,
-       CoordModeOrigin);
+               pixmap ? pixmap->opaque_pixmap : this->pixmap->opaque_pixmap,
+               top_level->gc, points, npoints, Nonconvex, CoordModeOrigin);
 
        delete [] points;
 }
@@ -505,24 +485,13 @@ void BC_WindowBase::fill_polygon(ArrayList<int> *x, ArrayList<int> *y, BC_Pixmap
 void BC_WindowBase::draw_rectangle(int x, int y, int w, int h)
 { BT
        XDrawRectangle(top_level->display,
-               pixmap->opaque_pixmap,
-               top_level->gc,
-               x,
-               y,
-               w - 1,
-               h - 1);
+               pixmap->opaque_pixmap, top_level->gc,
+               x, y, w - 1, h - 1);
 }
 
-void BC_WindowBase::draw_3d_border(int x,
-       int y,
-       int w,
-       int h,
-       int is_down)
+void BC_WindowBase::draw_3d_border(int x, int y, int w, int h, int is_down)
 {
-       draw_3d_border(x,
-               y,
-               w,
-               h,
+       draw_3d_border(x, y, w, h,
                top_level->get_resources()->border_shadow2,
                top_level->get_resources()->border_shadow1,
                top_level->get_resources()->border_light1,
@@ -530,14 +499,8 @@ void BC_WindowBase::draw_3d_border(int x,
 }
 
 
-void BC_WindowBase::draw_3d_border(int x,
-       int y,
-       int w,
-       int h,
-       int light1,
-       int light2,
-       int shadow1,
-       int shadow2)
+void BC_WindowBase::draw_3d_border(int x, int y, int w, int h,
+       int light1, int light2, int shadow1, int shadow2)
 {
        int lx, ly, ux, uy;
 
@@ -561,15 +524,8 @@ void BC_WindowBase::draw_3d_border(int x,
        draw_line(x, y + h, x + w, y + h);
 }
 
-void BC_WindowBase::draw_3d_box(int x,
-       int y,
-       int w,
-       int h,
-       int light1,
-       int light2,
-       int middle,
-       int shadow1,
-       int shadow2,
+void BC_WindowBase::draw_3d_box(int x, int y, int w, int h,
+       int light1, int light2, int middle, int shadow1, int shadow2,
        BC_Pixmap *pixmap)
 {
        int lx, ly, ux, uy;
@@ -851,13 +807,11 @@ void BC_WindowBase::draw_check(int x, int y)
 
 void BC_WindowBase::draw_tiles(BC_Pixmap *tile, int origin_x, int origin_y, int x, int y, int w, int h)
 { BT
-       if(!tile)
-       {
+       if( !tile ) {
                set_color(bg_color);
                draw_box(x, y, w, h);
        }
-       else
-       {
+       else {
                XSetFillStyle(top_level->display, top_level->gc, FillTiled);
 // Don't know how slow this is
                XSetTile(top_level->display, top_level->gc, tile->get_pixmap());
@@ -872,132 +826,77 @@ void BC_WindowBase::draw_top_tiles(BC_WindowBase *parent_window, int x, int y, i
        Window tempwin;
        int origin_x, origin_y;
        XTranslateCoordinates(top_level->display,
-                       parent_window->win,
-                       win,
-                       0,
-                       0,
-                       &origin_x,
-                       &origin_y,
-                       &tempwin);
-
+               parent_window->win, win,
+               0, 0, &origin_x, &origin_y, &tempwin);
        draw_tiles(parent_window->bg_pixmap,
-               origin_x,
-               origin_y,
-               x,
-               y,
-               w,
-               h);
+               origin_x, origin_y,
+               x, y, w, h);
 }
 
 void BC_WindowBase::draw_top_background(BC_WindowBase *parent_window,
-       int x,
-       int y,
-       int w,
-       int h,
-       BC_Pixmap *pixmap)
+       int x, int y, int w, int h, BC_Pixmap *pixmap)
 { BT
        Window tempwin;
        int top_x, top_y;
        XLockDisplay(top_level->display);
 
        XTranslateCoordinates(top_level->display,
-                       win,
-                       parent_window->win,
-                       x,
-                       y,
-                       &top_x,
-                       &top_y,
-                       &tempwin);
+               win, parent_window->win,
+               x, y, &top_x, &top_y, &tempwin);
 
        XCopyArea(top_level->display,
                parent_window->pixmap->opaque_pixmap,
                pixmap ? pixmap->opaque_pixmap : this->pixmap->opaque_pixmap,
-               top_level->gc,
-               top_x,
-               top_y,
-               w,
-               h,
-               x,
-               y);
+               top_level->gc, top_x, top_y, w, h, x, y);
 
        XUnlockDisplay(top_level->display);
 }
 
 void BC_WindowBase::draw_background(int x, int y, int w, int h)
 {
-       if(bg_pixmap)
-       {
+       if( bg_pixmap ) {
                draw_tiles(bg_pixmap, 0, 0, x, y, w, h);
        }
-       else
-       {
+       else {
                clear_box(x, y, w, h);
        }
 }
 
-void BC_WindowBase::draw_bitmap(BC_Bitmap *bitmap,
-       int dont_wait,
-       int dest_x,
-       int dest_y,
-       int dest_w,
-       int dest_h,
-       int src_x,
-       int src_y,
-       int src_w,
-       int src_h,
+void BC_WindowBase::draw_bitmap(BC_Bitmap *bitmap, int dont_wait,
+       int dest_x, int dest_y, int dest_w, int dest_h,
+       int src_x, int src_y, int src_w, int src_h,
        BC_Pixmap *pixmap)
 { BT
 // Hide cursor if video enabled
        update_video_cursor();
 
 //printf("BC_WindowBase::draw_bitmap %d dest_y=%d\n", __LINE__, dest_y);
-       if(dest_w <= 0 || dest_h <= 0)
-       {
+       if( dest_w <= 0 || dest_h <= 0 ) {
 // Use hardware scaling to canvas dimensions if proper color model.
-               if(bitmap->get_color_model() == BC_YUV420P)
-               {
+               if( bitmap->get_color_model() == BC_YUV420P ) {
                        dest_w = w;
                        dest_h = h;
                }
-               else
-               {
+               else {
                        dest_w = bitmap->get_w();
                        dest_h = bitmap->get_h();
                }
        }
 
-       if(src_w <= 0 || src_h <= 0)
-       {
+       if( src_w <= 0 || src_h <= 0 ) {
                src_w = bitmap->get_w();
                src_h = bitmap->get_h();
        }
 
-       if(video_on)
-       {
+       if( video_on ) {
                bitmap->write_drawable(win,
-                       top_level->gc,
-                       src_x,
-                       src_y,
-                       src_w,
-                       src_h,
-                       dest_x,
-                       dest_y,
-                       dest_w,
-                       dest_h,
-                       dont_wait);
+                       top_level->gc, src_x, src_y, src_w, src_h,
+                       dest_x, dest_y, dest_w, dest_h, dont_wait);
                top_level->flush();
        }
-       else
-       {
+       else {
                bitmap->write_drawable(pixmap ? pixmap->opaque_pixmap : this->pixmap->opaque_pixmap,
-                       top_level->gc,
-                       dest_x,
-                       dest_y,
-                       src_x,
-                       src_y,
-                       dest_w,
-                       dest_h,
-                       dont_wait);
+                       top_level->gc, dest_x, dest_y, src_x, src_y, dest_w, dest_h, dont_wait);
        }
 //printf("BC_WindowBase::draw_bitmap 2\n");
 }
@@ -1007,40 +906,22 @@ void BC_WindowBase::draw_pixel(int x, int y, BC_Pixmap *pixmap)
 { BT
        XDrawPoint(top_level->display,
                pixmap ? pixmap->opaque_pixmap : this->pixmap->opaque_pixmap,
-               top_level->gc,
-               x,
-               y);
+               top_level->gc, x, y);
 }
 
 
 void BC_WindowBase::draw_pixmap(BC_Pixmap *pixmap,
-       int dest_x,
-       int dest_y,
-       int dest_w,
-       int dest_h,
-       int src_x,
-       int src_y,
-       BC_Pixmap *dst)
+       int dest_x, int dest_y, int dest_w, int dest_h,
+       int src_x, int src_y, BC_Pixmap *dst)
 { BT
        pixmap->write_drawable(dst ? dst->opaque_pixmap : this->pixmap->opaque_pixmap,
-                       dest_x,
-                       dest_y,
-                       dest_w,
-                       dest_h,
-                       src_x,
-                       src_y);
+                       dest_x, dest_y, dest_w, dest_h, src_x, src_y);
 }
 
 void BC_WindowBase::draw_vframe(VFrame *frame,
-               int dest_x,
-               int dest_y,
-               int dest_w,
-               int dest_h,
-               int src_x,
-               int src_y,
-               int src_w,
-               int src_h,
-               BC_Pixmap *pixmap)
+       int dest_x, int dest_y, int dest_w, int dest_h,
+       int src_x, int src_y, int src_w, int src_h,
+       BC_Pixmap *pixmap)
 {
        if(dest_w <= 0) dest_w = frame->get_w() - src_x;
        if(dest_h <= 0) dest_h = frame->get_h() - src_y;
@@ -1051,38 +932,17 @@ void BC_WindowBase::draw_vframe(VFrame *frame,
        if(src_x + src_w > frame->get_w()) src_w = frame->get_w() - src_x;
        if(src_y + src_h > frame->get_h()) src_h = frame->get_h() - src_y;
 
-       if(!temp_bitmap) temp_bitmap = new BC_Bitmap(this,
-               dest_w,
-               dest_h,
-               get_color_model(),
-               0);
-
-       temp_bitmap->match_params(dest_w,
-               dest_h,
-               get_color_model(),
-               0);
+       if( !temp_bitmap )
+               temp_bitmap = new BC_Bitmap(this, dest_w, dest_h, get_color_model(), 0);
+       temp_bitmap->match_params(dest_w, dest_h, get_color_model(), 0);
 
        temp_bitmap->read_frame(frame,
-               src_x,
-               src_y,
-               src_w,
-               src_h,
-               0,
-               0,
-               dest_w,
-               dest_h);
-
-       draw_bitmap(temp_bitmap,
-               0,
-               dest_x,
-               dest_y,
-               dest_w,
-               dest_h,
-               0,
-               0,
-               -1,
-               -1,
-               pixmap);
+               src_x, src_y, src_w, src_h,
+               0, 0, dest_w, dest_h, bg_color);
+
+       draw_bitmap(temp_bitmap, 0,
+               dest_x, dest_y, dest_w, dest_h,
+               0, 0, -1, -1, pixmap);
 }
 
 void BC_WindowBase::draw_tooltip(const char *text)
@@ -1324,12 +1184,8 @@ void BC_WindowBase::draw_3segmenth(int x,
                pixmap);
 }
 
-void BC_WindowBase::draw_3segmenth(int x,
-               int y,
-               int w,
-               int total_x,
-               int total_w,
-               VFrame *image,
+void BC_WindowBase::draw_3segmenth(int x, int y, int w,
+               int total_x, int total_w, VFrame *image,
                BC_Pixmap *pixmap)
 {
        if(total_w <= 0 || w <= 0 || h <= 0) return;
@@ -1392,90 +1248,44 @@ void BC_WindowBase::draw_3segmenth(int x,
        }
 
        if(!temp_bitmap) temp_bitmap = new BC_Bitmap(top_level,
-               image->get_w(),
-               image->get_h(),
-               get_color_model(),
-               0);
-       temp_bitmap->match_params(image->get_w(),
-               image->get_h(),
-               get_color_model(),
-               0);
+               image->get_w(), image->get_h(),
+               get_color_model(), 0);
+       temp_bitmap->match_params(image->get_w(), image->get_h(),
+               get_color_model(), 0);
        temp_bitmap->read_frame(image,
-               0,
-               0,
-               image->get_w(),
-               image->get_h());
-
-
+               0, 0, image->get_w(), image->get_h(), bg_color);
+// src width and height are meaningless in video_off mode
 //printf("BC_WindowBase::draw_3segment 2 left_out_x=%d left_out_w=%d center_out_x=%d center_out_w=%d right_out_x=%d right_out_w=%d\n",
 //     left_out_x, left_out_w, center_out_x, center_out_w, right_out_x, right_out_w);
-       if(left_out_w > 0)
-       {
-               draw_bitmap(temp_bitmap,
-                       0,
-                       left_out_x,
-                       y,
-                       left_out_w,
-                       image->get_h(),
-                       left_in_x,
-                       0,
-                       -1,   // src width and height are meaningless in video_off mode
-                       -1,
-                       pixmap);
+       if(left_out_w > 0) {
+               draw_bitmap(temp_bitmap, 0,
+                       left_out_x, y, left_out_w, image->get_h(),
+                       left_in_x, 0, -1, -1, pixmap);
        }
 
-       if(right_out_w > 0)
-       {
-               draw_bitmap(temp_bitmap,
-                       0,
-                       right_out_x,
-                       y,
-                       right_out_w,
-                       image->get_h(),
-                       right_in_x,
-                       0,
-                       -1,   // src width and height are meaningless in video_off mode
-                       -1,
-                       pixmap);
+       if(right_out_w > 0) {
+               draw_bitmap(temp_bitmap, 0,
+                       right_out_x, y, right_out_w, image->get_h(),
+                       right_in_x, 0, -1, -1, pixmap);
        }
 
-       for(int pixel = center_out_x;
-               pixel < center_out_x + center_out_w;
-               pixel += half_image)
-       {
+       for( int pixel = center_out_x;
+                pixel < center_out_x + center_out_w;
+                pixel += half_image ) {
                int fragment_w = half_image;
                if(fragment_w + pixel > center_out_x + center_out_w)
                        fragment_w = (center_out_x + center_out_w) - pixel;
 
 //printf("BC_WindowBase::draw_3segment 2 pixel=%d fragment_w=%d\n", pixel, fragment_w);
-               draw_bitmap(temp_bitmap,
-                       0,
-                       pixel,
-                       y,
-                       fragment_w,
-                       image->get_h(),
-                       third_image,
-                       0,
-                       -1,   // src width and height are meaningless in video_off mode
-                       -1,
-                       pixmap);
+               draw_bitmap(temp_bitmap, 0,
+                       pixel, y, fragment_w, image->get_h(),
+                       third_image, 0, -1, -1, pixmap);
        }
 
 }
 
-
-
-
-
-
-
-void BC_WindowBase::draw_3segmenth(int x,
-               int y,
-               int w,
-               int total_x,
-               int total_w,
-               BC_Pixmap *src,
-               BC_Pixmap *dst)
+void BC_WindowBase::draw_3segmenth(int x, int y, int w, int total_x, int total_w,
+               BC_Pixmap *src, BC_Pixmap *dst)
 {
        if(w <= 0 || total_w <= 0) return;
        if(!src) printf("BC_WindowBase::draw_3segmenth src=0\n");
@@ -1724,10 +1534,7 @@ void BC_WindowBase::draw_3segmentv(int x,
                get_color_model(),
                0);
        temp_bitmap->read_frame(src,
-               0,
-               0,
-               src->get_w(),
-               src->get_h());
+               0, 0, src->get_w(), src->get_h(), bg_color);
 
 
        if(left_out_h > 0)
@@ -2045,12 +1852,8 @@ void BC_WindowBase::draw_9segment(int x,
 }
 
 
-void BC_WindowBase::draw_9segment(int x,
-               int y,
-               int w,
-               int h,
-               VFrame *src,
-               BC_Pixmap *dst)
+void BC_WindowBase::draw_9segment(int x, int y, int w, int h,
+               VFrame *src, BC_Pixmap *dst)
 {
        if(w <= 0 || h <= 0) return;
 
@@ -2092,190 +1895,90 @@ void BC_WindowBase::draw_9segment(int x,
                get_color_model(),
                0);
        temp_bitmap->read_frame(src,
-               0,
-               0,
-               src->get_w(),
-               src->get_h());
+               0, 0, src->get_w(), src->get_h(), bg_color);
 
 // Segment 1
-       draw_bitmap(temp_bitmap,
-               0,
-               x + out_x1,
-               y + out_y1,
-               out_x2 - out_x1,
-               out_y2 - out_y1,
-               in_x1,
-               in_y1,
-               in_x2 - in_x1,
-               in_y2 - in_y1,
+       draw_bitmap(temp_bitmap, 0,
+               x + out_x1, y + out_y1, out_x2 - out_x1, out_y2 - out_y1,
+               in_x1, in_y1, in_x2 - in_x1, in_y2 - in_y1,
                dst);
 
-
 // Segment 2 * n
-       for(int i = out_x2; i < out_x3; i += in_x3 - in_x2)
-       {
-               if(out_x3 - i > 0)
-               {
+       for( int i = out_x2; i < out_x3; i += in_x3 - in_x2 ) {
+               if( out_x3 - i > 0 ) {
                        int w = MIN(in_x3 - in_x2, out_x3 - i);
-                       draw_bitmap(temp_bitmap,
-                               0,
-                               x + i,
-                               y + out_y1,
-                               w,
-                               out_y2 - out_y1,
-                               in_x2,
-                               in_y1,
-                               w,
-                               in_y2 - in_y1,
+                       draw_bitmap(temp_bitmap, 0,
+                               x + i, y + out_y1, w, out_y2 - out_y1,
+                               in_x2, in_y1, w, in_y2 - in_y1,
                                dst);
                }
        }
 
-
-
-
-
 // Segment 3
-       draw_bitmap(temp_bitmap,
-               0,
-               x + out_x3,
-               y + out_y1,
-               out_x4 - out_x3,
-               out_y2 - out_y1,
-               in_x3,
-               in_y1,
-               in_x4 - in_x3,
-               in_y2 - in_y1,
+       draw_bitmap(temp_bitmap, 0,
+               x + out_x3, y + out_y1, out_x4 - out_x3, out_y2 - out_y1,
+               in_x3, in_y1, in_x4 - in_x3, in_y2 - in_y1,
                dst);
 
-
-
 // Segment 4 * n
-       for(int i = out_y2; i < out_y3; i += in_y3 - in_y2)
-       {
-               if(out_y3 - i > 0)
-               {
+       for( int i = out_y2; i < out_y3; i += in_y3 - in_y2 ) {
+               if( out_y3 - i > 0 ) {
                        int h = MIN(in_y3 - in_y2, out_y3 - i);
-                       draw_bitmap(temp_bitmap,
-                               0,
-                               x + out_x1,
-                               y + i,
-                               out_x2 - out_x1,
-                               h,
-                               in_x1,
-                               in_y2,
-                               in_x2 - in_x1,
-                               h,
+                       draw_bitmap(temp_bitmap, 0,
+                               x + out_x1, y + i, out_x2 - out_x1, h,
+                               in_x1, in_y2, in_x2 - in_x1, h,
                                dst);
                }
        }
 
-
 // Segment 5 * n * n
-       for(int i = out_y2; i < out_y3; i += in_y3 - in_y2)
-       {
-               if(out_y3 - i > 0)
-               {
+       for( int i = out_y2; i < out_y3; i += in_y3 - in_y2 ) {
+               if( out_y3 - i > 0 ) {
                        int h = MIN(in_y3 - in_y2, out_y3 - i);
 
-
-                       for(int j = out_x2; j < out_x3; j += in_x3 - in_x2)
-                       {
+                       for( int j = out_x2; j < out_x3; j += in_x3 - in_x2 ) {
                                int w = MIN(in_x3 - in_x2, out_x3 - j);
                                if(out_x3 - j > 0)
-                                       draw_bitmap(temp_bitmap,
-                                               0,
-                                               x + j,
-                                               y + i,
-                                               w,
-                                               h,
-                                               in_x2,
-                                               in_y2,
-                                               w,
-                                               h,
+                                       draw_bitmap(temp_bitmap, 0,
+                                               x + j, y + i, w, h,
+                                               in_x2, in_y2, w, h,
                                                dst);
                        }
                }
        }
 
 // Segment 6 * n
-       for(int i = out_y2; i < out_y3; i += in_y_third)
-       {
-               if(out_y3 - i > 0)
-               {
+       for( int i = out_y2; i < out_y3; i += in_y_third ) {
+               if( out_y3 - i > 0 ) {
                        int h = MIN(in_y_third, out_y3 - i);
-                       draw_bitmap(temp_bitmap,
-                               0,
-                               x + out_x3,
-                               y + i,
-                               out_x4 - out_x3,
-                               h,
-                               in_x3,
-                               in_y2,
-                               in_x4 - in_x3,
-                               h,
+                       draw_bitmap(temp_bitmap, 0,
+                               x + out_x3, y + i, out_x4 - out_x3, h,
+                               in_x3, in_y2, in_x4 - in_x3, h,
                                dst);
                }
        }
 
-
-
-
 // Segment 7
-       draw_bitmap(temp_bitmap,
-               0,
-               x + out_x1,
-               y + out_y3,
-               out_x2 - out_x1,
-               out_y4 - out_y3,
-               in_x1,
-               in_y3,
-               in_x2 - in_x1,
-               in_y4 - in_y3,
+       draw_bitmap(temp_bitmap, 0,
+               x + out_x1, y + out_y3, out_x2 - out_x1, out_y4 - out_y3,
+               in_x1, in_y3, in_x2 - in_x1, in_y4 - in_y3,
                dst);
 
-
 // Segment 8 * n
-       for(int i = out_x2; i < out_x3; i += in_x_third)
-       {
-               if(out_x3 - i > 0)
-               {
+       for( int i = out_x2; i < out_x3; i += in_x_third ) {
+               if( out_x3 - i > 0 ) {
                        int w = MIN(in_x_third, out_x3 - i);
-                       draw_bitmap(temp_bitmap,
-                               0,
-                               x + i,
-                               y + out_y3,
-                               w,
-                               out_y4 - out_y3,
-                               in_x2,
-                               in_y3,
-                               w,
-                               in_y4 - in_y3,
+                       draw_bitmap(temp_bitmap, 0,
+                               x + i, y + out_y3, w, out_y4 - out_y3,
+                               in_x2, in_y3, w, in_y4 - in_y3,
                                dst);
                }
        }
 
-
-
 // Segment 9
-       draw_bitmap(temp_bitmap,
-               0,
-               x + out_x3,
-               y + out_y3,
-               out_x4 - out_x3,
-               out_y4 - out_y3,
-               in_x3,
-               in_y3,
-               in_x4 - in_x3,
-               in_y4 - in_y3,
+       draw_bitmap(temp_bitmap, 0,
+               x + out_x3, y + out_y3, out_x4 - out_x3, out_y4 - out_y3,
+               in_x3, in_y3, in_x4 - in_x3, in_y4 - in_y3,
                dst);
 }
 
-
-
-
-
-
-
-
-
index e7a20c4c17f978ea6cf6d3c7a3bd296a30b3d341..27f7a706366f5e57e9779aca5b7089867d955f24 100755 (executable)
@@ -1,13 +1,11 @@
 #!/bin/bash -e
 # inst.sh <dir> <objs...>
-cr='
-'
 dir="$1"; shift 1
 mkdir -p "$dir"
 if [ "$*" = "*" ]; then exit; fi
 
 for f in "$@"; do
-  if [ -f "$f" ]; then ( umask 755; cp "$f" "$dir" ); continue; fi
+  if [ -f "$f" ]; then cp "$f" "$dir"; continue; fi
   if [ -d "$f" ]; then ( cd $f; $inst_sh "$dir/$f" * )
   else echo "*** Error - inst.sh $f in $dir failed." 1>&2; exit 1; fi
 done