group selection rework, rm inv title clr, add titlebar alpha textbox, default proxy...
authorGood Guy <good1.2guy@gmail.com>
Sat, 22 Dec 2018 02:38:05 +0000 (19:38 -0700)
committerGood Guy <good1.2guy@gmail.com>
Sat, 22 Dec 2018 02:38:05 +0000 (19:38 -0700)
19 files changed:
cinelerra-5.1/cinelerra/edit.C
cinelerra-5.1/cinelerra/editpopup.C
cinelerra-5.1/cinelerra/edl.C
cinelerra-5.1/cinelerra/edl.h
cinelerra-5.1/cinelerra/interfaceprefs.C
cinelerra-5.1/cinelerra/mainsession.C
cinelerra-5.1/cinelerra/mainsession.inc
cinelerra-5.1/cinelerra/mwindow.h
cinelerra-5.1/cinelerra/mwindowedit.C
cinelerra-5.1/cinelerra/proxy.C
cinelerra-5.1/cinelerra/resourcepixmap.C
cinelerra-5.1/cinelerra/trackcanvas.C
cinelerra-5.1/cinelerra/trackcanvas.h
cinelerra-5.1/cinelerra/tracks.C
cinelerra-5.1/cinelerra/tracks.h
cinelerra-5.1/cinelerra/tracksedit.C
cinelerra-5.1/cinelerra/zoombar.C
cinelerra-5.1/cinelerra/zoombar.h
cinelerra-5.1/cinelerra/zoombar.inc

index fc36b18..8ef1735 100644 (file)
@@ -389,7 +389,8 @@ int Edit::dump(FILE *fp)
                asset,
                asset ? asset->path : "");
        fflush(fp);
-       fprintf(fp,"      channel %d, color %08x, group_id %d\n", channel, color, group_id);
+       fprintf(fp,"      channel %d, color %08x, group_id %d, is_selected %d\n",
+               channel, color, group_id, is_selected);
        if(transition)
        {
                fprintf(fp,"      TRANSITION %p\n", transition);
index 34aadc4..9d943d8 100644 (file)
@@ -441,7 +441,7 @@ EditTitleColorDefault::EditTitleColorDefault(
 
 int EditTitleColorDefault::handle_event()
 {
-       const int color = 0, alpha = 0xff;
+       const unsigned color = 0, alpha = 0xff;
        color_picker->color = color | (~alpha << 24);
        color_picker->update_gui(color, alpha);
        return 1;
index 7966276..1c0c77b 100644 (file)
@@ -1656,6 +1656,11 @@ double EDL::get_cursor_position(int cursor_x, int pane_no)
                (double)local_session->view_start[pane_no] *
                        local_session->zoom_sample / session->sample_rate;
 }
+int64_t EDL::get_position_cursorx(double position, int pane_no)
+{
+       return (int64_t)(position * session->sample_rate / local_session->zoom_sample)
+                       - local_session->view_start[pane_no];
+}
 
 int EDL::in_use(Indexable *indexable)
 {
index ad7e8cf..2cd5de8 100644 (file)
@@ -97,8 +97,9 @@ public:
        double frame_align(double position, int round);
 // frame align if cursor alignment is enabled
        double align_to_frame(double position, int round);
-// get position under cursor in pane
+// get position under cursor in pane, and inverse
        double get_cursor_position(int cursor_x, int pane_no);
+       int64_t get_position_cursorx(double position, int pane_no);
 
 // increase track w/h to at least session w/h
        void retrack();
index 60241a7..76bde5e 100644 (file)
@@ -180,7 +180,7 @@ void InterfacePrefs::create_objects()
        sprintf(string, "%d", pwindow->thread->edl->session->min_meter_db);
        add_subwindow(min_db = new MeterMinDB(pwindow, string, x1, y));
        x1 += min_db->get_w() + 10;
-       add_subwindow(title = new BC_Title(x1, y + 5, _("Max DB:")));
+       add_subwindow(title = new BC_Title(x1, y + 5, _("Max:")));
        x1 += title->get_w() + 10;
        sprintf(string, "%d", pwindow->thread->edl->session->max_meter_db);
        add_subwindow(max_db = new MeterMaxDB(pwindow, string, x1, y));
index acc5e4d..bd19562 100644 (file)
@@ -66,7 +66,6 @@ MainSession::MainSession(MWindow *mwindow)
        cwindow_controls = 1;
        trim_edits = 0;
        current_tip = -1;
-       drag_handle = 0;
        cwindow_fullscreen = 0;
        rwindow_fullscreen = 0;
        vwindow_fullscreen = 0;
index d9506c5..33b7580 100644 (file)
@@ -63,6 +63,7 @@ enum
        DRAG_PLUGINHANDLE2,         // Dragging outside drag threshold
        DRAG_SPEED,
        DRAG_GROUP,
+       DRAG_BUTTON_DOWN,
        DROP_TARGETING,
 };
 
index a69a9dc..bb02ba7 100644 (file)
@@ -403,7 +403,7 @@ public:
        void move_edits(ArrayList<Edit*> *edits, Track *track, double position,
 // 0 - old style (cut and insert elswhere), 1- new style - (clear and overwrite elsewere)
                int behaviour);
-       void move_group(EDL *group, Track *first_track, double position);
+       void move_group(EDL *group, Track *first_track, double position, int overwrite);
 // Move effect to position
        void move_effect(Plugin *plugin, Track *track, int64_t position);
        void move_effect(Plugin *plugin, PluginSet *plugin_set, int64_t position);
index d458a78..b38a563 100644 (file)
@@ -1063,10 +1063,10 @@ void MWindow::move_edits(ArrayList<Edit*> *edits,
        gui->update(1, NORMAL_DRAW, 1, 0, 0, 0, 0);
 }
 
-void MWindow::move_group(EDL *group, Track *first_track, double position)
+void MWindow::move_group(EDL *group, Track *first_track, double position, int overwrite)
 {
        undo->update_undo_before();
-       edl->tracks->move_group(group, first_track, position);
+       edl->tracks->move_group(group, first_track, position, overwrite);
        save_backup();
        undo->update_undo_after(_("move group"), LOAD_ALL);
        restart_brender();
index e368c17..a53dcf6 100644 (file)
@@ -50,7 +50,6 @@
 #define WIDTH 400
 #define HEIGHT 330
 #define MAX_SCALE 16
-#define PROXY_DEFAULT_VCODEC "h265.mp4"
 
 ProxyMenuItem::ProxyMenuItem(MWindow *mwindow)
  : BC_MenuItem(_("Proxy settings..."),  _("Alt-r"), 'r')
@@ -83,7 +82,13 @@ ProxyDialog::ProxyDialog(MWindow *mwindow)
        this->mwindow = mwindow;
        gui = 0;
        asset = new Asset;
-       strcpy(asset->vcodec, PROXY_DEFAULT_VCODEC);
+
+// quicker than some, not as good as others
+       asset->format = FILE_FFMPEG;
+       strcpy(asset->fformat, "mpeg");
+       strcpy(asset->vcodec, "mpeg.mpeg");
+       asset->ff_video_bitrate = 2000000;
+
        bzero(size_text, sizeof(char*) * MAX_SIZES);
        bzero(size_factors, sizeof(int) * MAX_SIZES);
        size_text[0] = cstrdup(_("Original size"));
@@ -632,6 +637,11 @@ void ProxyClient::process_package(LoadPackage *ptr)
        int jobs = proxy_render->needed_proxies.size();
        int processors = preferences->project_smp / jobs + 1, result = 0;
 
+// each cpu should process at least about 1 MB, or it thrashes
+       int size = edl->session->output_w * edl->session->output_h * 4;
+       int cpus = size / 0x100000 + 1;
+       if( processors > cpus ) processors = cpus;
+
        if( orig->is_asset ) {
                src_file = new File;
                src_file->set_processors(processors);
index 4915a02..79a4e94 100644 (file)
@@ -306,8 +306,7 @@ void ResourcePixmap::draw_title(TrackCanvas *canvas,
 
        char title[BCTEXTLEN];
        edit->get_title(title);
-       color = color ? ~color & 0xffffff : mwindow->theme->title_color;
-       canvas->set_color(color);
+       canvas->set_color(mwindow->theme->title_color);
        canvas->set_font(mwindow->theme->title_font);
 
 // Justify the text on the left boundary of the edit if it is visible.
index dbcab88..ca9c100 100644 (file)
@@ -512,14 +512,22 @@ int TrackCanvas::drag_stop(int *redraw)
                                        edit_track = edit_track->previous;
                                        drop_track = drop_track->previous;
                                }
-                               if( drop_track && test_track_group(drag_group, drop_track) ) {
-                                       double position = mwindow->edl->get_cursor_position(cursor_x, pane->number);
-                                       position = mwindow->edl->align_to_frame(position, 0);
-                                       position -= mwindow->session->drag_group_position;
-                                       mwindow->move_group(drag_group, drop_track, position);
+                               if( drop_track ) {
+                                       double cur_pos = mwindow->session->drag_group_position;
+                                       double new_pos = mwindow->edl->get_cursor_position(cursor_x, pane->number);
+                                       new_pos -= mwindow->session->drag_position - cur_pos;
+                                       new_pos = mwindow->edl->align_to_frame(new_pos, 0);
+                                       double drop_position = new_pos;
+                                       int ret = test_track_group(drag_group, drop_track, new_pos);
+                                       if( !ret && new_pos != drop_position ) {
+                                               ret = test_track_group(drag_group, drop_track, new_pos);
+                                       }
+                                       if( ret )
+                                               mwindow->move_group(drag_group, drop_track, new_pos, 1);
+                                       drag_group->remove_user();
+                                       mwindow->session->drag_group = 0;
+                                       mwindow->edl->tracks->clear_selected_edits();
                                }
-                               drag_group->remove_user();
-                               mwindow->session->drag_group = 0;
                        }
                        result = 1;
                        break;
@@ -536,7 +544,10 @@ int TrackCanvas::drag_start_event()
        int rerender = 0;
        int new_cursor, update_cursor;
 
-       if(mwindow->session->current_operation != NO_OPERATION) return 0;
+       if( mwindow->session->current_operation == DRAG_BUTTON_DOWN )
+               mwindow->session->current_operation = NO_OPERATION;
+       else if( mwindow->session->current_operation != NO_OPERATION )
+               return 0;
 
        if(is_event_win()) {
                if(do_plugins(get_drag_x(), get_drag_y(),
@@ -1572,9 +1583,25 @@ void TrackCanvas::draw_highlighting()
                                        edit_track = edit_track->previous;
                                        track = track->previous;
                                }
-                               int color = track && test_track_group(drag_group, track) ? GREEN : RED;
+                               int cx = get_cursor_x();
+                               double cur_pos = mwindow->session->drag_group_position;
+                               double new_pos = mwindow->edl->get_cursor_position(cx, pane->number);
+                               new_pos -= mwindow->session->drag_position - cur_pos;
+                               new_pos = mwindow->edl->align_to_frame(new_pos, 0);
+                               double drop_position = new_pos;
+                               int color = GREEN;
+                               int ret = test_track_group(drag_group, track, new_pos);
+                               if( !ret && new_pos != drop_position ) {
+                                       double pos = new_pos;
+                                       pos += mwindow->session->drag_position - cur_pos;
+                                       cx = mwindow->edl->get_position_cursorx(pos, pane->number);
+                                       ret = test_track_group(drag_group, track, new_pos);
+                                       color = ret ? YELLOW : RED;
+                               }
+                               else if( !ret )
+                                       color = RED;
                                track_dimensions(mwindow->session->track_highlighted, x, y, w, h);
-                               int dx = get_cursor_x() - mwindow->session->drag_origin_x;
+                               int dx = cx - mwindow->session->drag_origin_x;
                                int dy = y - mwindow->session->drag_origin_y;
                                draw_selected_edits(mwindow->edl, dx, dy, color, -1);
                        }
@@ -1663,6 +1690,7 @@ void TrackCanvas::draw_selected_edits(EDL *edl, int dx, int dy, int color0, int
                        int outer = color1 < 0 ? color0 : !edit->group_id ? color1 : inner;
                        set_color(outer);
                        draw_rectangle(x-1, y-1, w+2, h+2);
+                       draw_rectangle(x-2, y-2, w+1, h+1);
                }
        }
 }
@@ -4526,16 +4554,43 @@ int TrackCanvas::button_release_event()
                        result = 1;
                        break; }
 
+               case DRAG_BUTTON_DOWN: {
+                       Edit *edit = mwindow->session->drag_edit;
+                       if( edit ) {
+                               if( shift_down() && edit->is_selected ) {
+                                       if( edit->group_id > 0 ) {
+                                               mwindow->edl->tracks->clear_selected_edits();
+                                               mwindow->edl->tracks->del_group(edit->group_id);
+                                       }
+                                       else {
+                                               int id = mwindow->session->group_number++;
+                                               mwindow->edl->tracks->new_group(id);
+                                       }
+                                       redraw = 0;
+                               }
+                               else {
+                                       if( edit->group_id )
+                                               mwindow->edl->tracks->set_group_selected(edit->group_id, -1);
+                                       else
+                                               edit->is_selected = !edit->is_selected ? 1 : 0;
+                               }
+                       }
+                       mwindow->session->current_operation = NO_OPERATION;
+                       update_overlay = 1;
+                       result = 1;
+                       drag_scroll = 0;
+                       break; }
+
                default:
-                       if(mwindow->session->current_operation) {
+                       if( mwindow->session->current_operation ) {
 //                             if(mwindow->session->current_operation == SELECT_REGION) {
 //                                     mwindow->undo->update_undo_after(_("select"), LOAD_SESSION, 0, 0);
 //                             }
 
                                mwindow->session->current_operation = NO_OPERATION;
                                drag_scroll = 0;
-// Traps button release events
-//                             result = 1;
+                               //result = 0;
+                               break;
                        }
                        break;
                }
@@ -4786,42 +4841,27 @@ int TrackCanvas::do_edits(int cursor_x, int cursor_y, int button_press, int drag
 // Cursor inside an edit
                        if(cursor_x >= edit_x && cursor_x < edit_x + edit_w &&
                                cursor_y >= edit_y && cursor_y < edit_y + edit_h) {
+                               if( button_press ) {
+                                       if( mwindow->edl->session->editing_mode == EDITING_IBEAM &&
+                                           get_double_click() ) {
 // Select duration of edit
-                               if(button_press) {
-                                       if( get_double_click() ) {
-                                               if( shift_down() ) {
-                                                       if( edit->group_id > 0 ) {
-                                                               mwindow->edl->tracks->clear_selected_edits();
-                                                               mwindow->edl->tracks->del_group(edit->group_id);
-                                                       }
-                                                       else {
-                                                               int id = mwindow->session->group_number++;
-                                                               mwindow->edl->tracks->new_group(id);
-                                                       }
-                                                       mwindow->session->current_operation = NO_OPERATION;
-                                                       result = 1;
-                                               }
-                                               else if( !drag_start ) {
-                                                       double start = edit->track->from_units(edit->startproject);
-                                                       start = mwindow->edl->align_to_frame(start, 0);
-                                                       mwindow->edl->local_session->set_selectionstart(start);
-                                                       double end = edit->track->from_units(edit->startproject+edit->length);
-                                                       end = mwindow->edl->align_to_frame(end, 0);
-                                                       mwindow->edl->local_session->set_selectionend(end);
-                                                       result = 1;
-                                               }
-                                       }
-                                       else if( ctrl_down() && get_buttonpress() == 1 &&
-                                           mwindow->edl->session->editing_mode == EDITING_ARROW ) {
-                                               int v = !edit->is_selected ? 1 : 0;
-                                               if( !edit->group_id )
-                                                       edit->is_selected = v;
-                                               else
-                                                       mwindow->edl->tracks->set_group_selected(edit->group_id, v);
+                                               double start = edit->track->from_units(edit->startproject);
+                                               start = mwindow->edl->align_to_frame(start, 0);
+                                               mwindow->edl->local_session->set_selectionstart(start);
+                                               double end = edit->track->from_units(edit->startproject+edit->length);
+                                               end = mwindow->edl->align_to_frame(end, 0);
+                                               mwindow->edl->local_session->set_selectionend(end);
+                                               mwindow->edl->tracks->clear_selected_edits();
+                                               mwindow->edl->tracks->select_affected_edits(
+                                                       edit->track->from_units(edit->startproject),
+                                                       edit->track, 1);
                                                result = 1;
                                        }
+                                       else if( mwindow->edl->session->editing_mode == EDITING_ARROW ) {
+                                               mwindow->session->drag_edit = edit;
+                                               mwindow->session->current_operation = DRAG_BUTTON_DOWN;
+                                       }
                                        if( result ) {
-                                               redraw = 1;
                                                rerender = 1;
                                                update_cursor = -1;
                                        }
@@ -4836,16 +4876,8 @@ int TrackCanvas::do_edits(int cursor_x, int cursor_y, int button_press, int drag
                                                mwindow->session->drag_position =
                                                        mwindow->edl->get_cursor_position(cursor_x, pane->number);
 // Construct list of all affected edits
-                                               if( !shift_down() ) {
+                                               if( ctrl_down() ) {
                                                        mwindow->session->current_operation = DRAG_EDIT;
-                                                       mwindow->edl->tracks->clear_selected_edits();
-                                                       if( !ctrl_down() ) {
-                                                               mwindow->edl->tracks->select_affected_edits(
-                                                                       edit->track->from_units(edit->startproject),
-                                                                       edit->track);
-                                                       }
-                                                       else
-                                                               edit->is_selected = 1;
                                                        mwindow->edl->tracks->get_selected_edits(mwindow->session->drag_edits);
                                                        int cx, cy;  get_abs_cursor(cx, cy);
                                                        gui->drag_popup = new BC_DragWindow(gui,
@@ -4861,8 +4893,7 @@ int TrackCanvas::do_edits(int cursor_x, int cursor_y, int button_press, int drag
                                                                        &mwindow->session->drag_group_first_track);
                                                        if( mwindow->session->drag_group ) {
                                                                mwindow->session->current_operation = DRAG_GROUP;
-                                                               mwindow->session->drag_group_position =
-                                                                       mwindow->session->drag_position - start_position;
+                                                               mwindow->session->drag_group_position = start_position;
                                                                mwindow->session->drag_group_edit = edit;
                                                                mwindow->session->drag_origin_y = edit_y;
                                                        }
@@ -4877,17 +4908,49 @@ int TrackCanvas::do_edits(int cursor_x, int cursor_y, int button_press, int drag
 }
 
 
-int TrackCanvas::test_track_group(EDL *group, Track *first_track)
+int TrackCanvas::test_track_group(EDL *group, Track *first_track, double &pos)
 {
        Track *src = group->tracks->first;
        for( Track *track=first_track; track && src; track=track->next ) {
                if( !track->record ) continue;
                if( src->data_type != track->data_type ) return 0;
+               for( Edit *src_edit=src->edits->first; src_edit; src_edit=src_edit->next ) {
+                       if( src_edit->silence() ) continue;
+                       if( edit_intersects(track, src_edit, pos) ) return 0;
+               }
                src = src->next;
        }
        return !src ? 1 : 0;
 }
 
+int TrackCanvas::edit_intersects(Track *track, Edit *src_edit, double &pos)
+{
+       int64_t src_start = src_edit->startproject;
+       int64_t src_end = src_start + src_edit->length;
+       double new_start = src_edit->track->from_units(src_start) + pos;
+       double new_end = src_edit->track->from_units(src_end) + pos;
+       int64_t trk_start = track->to_units(new_start, 0);
+       int64_t trk_end = track->to_units(new_end, 0);
+       for( Edit *edit=track->edits->first; edit; edit=edit->next ) {
+               if( edit->is_selected || edit->silence() ) continue;
+               int64_t edit_start = edit->startproject;
+               if( edit_start >= trk_end ) continue;
+               int64_t edit_end = edit_start + edit->length;
+               if( trk_start >= edit_end ) continue;
+               int lt_dist = abs(trk_end - edit_start);
+               int rt_dist = abs(edit_end - trk_start);
+               if( lt_dist < rt_dist ) {
+                       pos = edit->track->from_units(edit_start) -
+                               src_edit->track->from_units(src_end);
+               }
+               else {
+                       pos = edit->track->from_units(edit_end);
+               }
+               return 1;
+       }
+       return 0;
+}
+
 int TrackCanvas::test_resources(int cursor_x, int cursor_y)
 {
        return 0;
index 88d7641..8a123c9 100644 (file)
@@ -305,7 +305,8 @@ public:
        int do_tracks(int cursor_x,
                int cursor_y,
                int button_press);
-       int test_track_group(EDL *group, Track *first_track);
+       int test_track_group(EDL *group, Track *first_track, double &pos);
+       int edit_intersects(Track *track, Edit *src_edit, double &pos);
        int test_resources(int cursor_x, int cursor_y);
        int do_plugins(int cursor_x,
                int cursor_y,
index 0f53df7..b70b2b8 100644 (file)
@@ -113,14 +113,15 @@ void Tracks::clear_selected_edits()
        }
 }
 
-void Tracks::select_affected_edits(double position, Track *start_track)
+void Tracks::select_affected_edits(double position, Track *start_track, int sense)
 {
        for( Track *track=start_track; track; track=track->next ) {
                if( !track->record ) continue;
                for( Edit *edit=track->edits->first; edit; edit=edit->next ) {
                        double startproject = track->from_units(edit->startproject);
                        if( edl->equivalent(startproject, position) ) {
-                               edit->is_selected = 1;
+                               edit->is_selected = sense >= 0 ? sense :
+                                       edit->is_selected ? 0 : 1;
                                break;
                        }
                }
@@ -672,7 +673,7 @@ int Tracks::set_group_selected(int id, int v)
        for( Track *track=first; track; track=track->next ) {
                for( Edit *edit=track->edits->first; edit; edit=edit->next ) {
                        if( edit->group_id != id ) continue;
-                       edit->is_selected = v;
+                       edit->is_selected = v >= 0 ? v : !edit->is_selected ? 1 : 0;
                        ++count;
                }
        }
index 4d3bef9..0cc248d 100644 (file)
@@ -51,13 +51,13 @@ public:
                uint32_t load_flags);
        void move_edits(ArrayList<Edit*> *edits, Track *track, double position,
                int edit_labels, int edit_plugins, int edit_autos, int behaviour);
-       void move_group(EDL *group, Track *first_track, double position);
+       void move_group(EDL *group, Track *first_track, double position, int overwrite);
        void move_effect(Plugin *plugin, Track *track, int64_t position);
        void move_effect(Plugin *plugin, PluginSet *plugin_set, int64_t position);
 
 // Construct a list of all the recordable edits which start on position
        void clear_selected_edits();
-       void select_affected_edits(double position, Track *start_track);
+       void select_affected_edits(double position, Track *start_track, int sense);
        void get_selected_edits(ArrayList<Edit*> *drag_edits);
        int next_group_id();
        int new_group(int id);
index 0aa3634..d97800c 100644 (file)
@@ -208,7 +208,8 @@ void Tracks::set_edit_length(double start, double end, double length)
                                        int64_t length_units = current_track->to_units(end_time, 0) -
                                                total_units;
                                        if(length_units < 1) length_units = 1;
-printf("Tracks::set_edit_length %d %f %f\n", __LINE__, end_time, current_track->from_units(total_units));
+//printf("Tracks::set_edit_length %d %f %f\n", __LINE__,
+// end_time, current_track->from_units(total_units));
                                        total_units += length_units;
 
 // Go in using the edit handle interface
@@ -740,7 +741,7 @@ void Tracks::move_edits(ArrayList<Edit*> *edits,
        }
 }
 
-void Tracks::move_group(EDL *group, Track *first_track, double position)
+void Tracks::move_group(EDL *group, Track *first_track, double position, int overwrite)
 {
        for( Track *track=first; track; track=track->next ) {
                if( !track->record ) continue;
@@ -759,7 +760,8 @@ void Tracks::move_group(EDL *group, Track *first_track, double position)
                        if( edit->silence() ) continue;
                        int64_t start = pos + edit->startproject;
                        int64_t end = start + edit->length;
-                       track->edits->clear(start, end);
+                       if( overwrite )
+                               track->edits->clear(start, end);
                        Edit *dst = track->edits->insert_new_edit(start);
                        dst->copy_from(edit);
                        dst->startproject = start;
index 9f1c95b..274961c 100644 (file)
@@ -104,7 +104,9 @@ 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));
+       add_subwindow(title_alpha_bar = new TitleAlphaBar(mwindow, this, x, y));
+       x += title_alpha_bar->get_w() + 5;
+       add_subwindow(title_alpha_text = new TitleAlphaText(mwindow, this, x, y));
 
        update_formatting(from_value);
        update_formatting(length_value);
@@ -193,18 +195,38 @@ int ZoomBar::update_clocks()
        return 0;
 }
 
-TitleBarAlpha::TitleBarAlpha(MWindow *mwindow, ZoomBar *zoombar, int x, int y)
+TitleAlphaBar::TitleAlphaBar(MWindow *mwindow, ZoomBar *zoombar, int x, int y)
  : BC_FSlider(x, y, 0, 150, 200, 0, 1.0, mwindow->session->title_bar_alpha, 0)
 {
        this->mwindow = mwindow;
        this->zoombar = zoombar;
        set_precision(0.01);
-       set_tooltip(_("TitleBar Alpha"));
+       set_tooltip(_("Title Alpha"));
 }
 
-int TitleBarAlpha::handle_event()
+int TitleAlphaBar::handle_event()
 {
-       mwindow->session->title_bar_alpha = get_value();
+       float v = get_value();
+       mwindow->session->title_bar_alpha = v;
+       zoombar->title_alpha_text->update(v);
+       mwindow->gui->draw_trackmovement();
+       mwindow->gui->flush();
+       return 1;
+}
+
+TitleAlphaText::TitleAlphaText(MWindow *mwindow, ZoomBar *zoombar, int x, int y)
+ : BC_TextBox(x, y, 48, 1, mwindow->session->title_bar_alpha, 0, MEDIUMFONT, 2)
+{
+       this->mwindow = mwindow;
+       this->zoombar = zoombar;
+       set_tooltip(_("Title Alpha"));
+}
+
+int TitleAlphaText::handle_event()
+{
+       float v = atof(get_text())*100;
+       mwindow->session->title_bar_alpha = v;
+       zoombar->title_alpha_bar->update(v);
        mwindow->gui->draw_trackmovement();
        mwindow->gui->flush();
        return 1;
index c013b01..9026e31 100644 (file)
@@ -59,7 +59,8 @@ public:
        LengthTextBox *length_value;
        FromTextBox *from_value;
        ToTextBox *to_value;
-       TitleBarAlpha *title_alpha;
+       TitleAlphaBar *title_alpha_bar;
+       TitleAlphaText *title_alpha_text;
        char string[256], string2[256];
 };
 
@@ -161,10 +162,19 @@ public:
        ZoomBar *zoombar;
 };
 
-class TitleBarAlpha : public BC_FSlider
+class TitleAlphaBar : public BC_FSlider
 {
 public:
-       TitleBarAlpha(MWindow *mwindow, ZoomBar *zoombar, int x, int y);
+       TitleAlphaBar(MWindow *mwindow, ZoomBar *zoombar, int x, int y);
+       int handle_event();
+       MWindow *mwindow;
+       ZoomBar *zoombar;
+};
+
+class TitleAlphaText : public BC_TextBox
+{
+public:
+       TitleAlphaText(MWindow *mwindow, ZoomBar *zoombar, int x, int y);
        int handle_event();
        MWindow *mwindow;
        ZoomBar *zoombar;
index ceb7c66..29c89aa 100644 (file)
@@ -32,7 +32,8 @@ class ZoomTextBox;
 class FromTextBox;
 class LengthTextBox;
 class ToTextBox;
-class TitleBarAlpha;
+class TitleAlphaBar;
+class TitleAlphaText;
 
 #define ZOOMBAR_PIXELS 24