fullscreen segv fix, popup for 4opts preview, renderfarm print fix, pan widget upgrad...
authorGood Guy <good1.2guy@gmail.com>
Fri, 8 Mar 2019 22:01:16 +0000 (15:01 -0700)
committerGood Guy <good1.2guy@gmail.com>
Fri, 8 Mar 2019 22:01:16 +0000 (15:01 -0700)
25 files changed:
cinelerra-5.1/cinelerra/awindowgui.C
cinelerra-5.1/cinelerra/awindowgui.h
cinelerra-5.1/cinelerra/awindowgui.inc
cinelerra-5.1/cinelerra/bdcreate.C
cinelerra-5.1/cinelerra/canvas.C
cinelerra-5.1/cinelerra/canvas.h
cinelerra-5.1/cinelerra/cwindowgui.C
cinelerra-5.1/cinelerra/cwindowgui.h
cinelerra-5.1/cinelerra/dvdcreate.C
cinelerra-5.1/cinelerra/mainsession.C
cinelerra-5.1/cinelerra/mainsession.h
cinelerra-5.1/cinelerra/recordmonitor.C
cinelerra-5.1/cinelerra/recordmonitor.h
cinelerra-5.1/cinelerra/render.C
cinelerra-5.1/cinelerra/vwindowgui.C
cinelerra-5.1/cinelerra/vwindowgui.h
cinelerra-5.1/cinelerra/zwindowgui.C
cinelerra-5.1/cinelerra/zwindowgui.h
cinelerra-5.1/ffmpeg/video/raw.dvd [new file with mode: 0644]
cinelerra-5.1/guicast/bcpan.C
cinelerra-5.1/guicast/bcpopupmenu.C
cinelerra-5.1/guicast/bcpopupmenu.h
cinelerra-5.1/guicast/bcwindowbase.C
cinelerra-5.1/guicast/vicon.C
cinelerra-5.1/guicast/vicon.h

index 8b53f7ad594b1cb7a61d0e3f7390307e23570624..bd7ec0f198b932205651c3d58a2f7021f4d7e62f 100644 (file)
@@ -95,6 +95,13 @@ const char *AWindowGUI::folder_names[] =
        N_("Proxy"),
 };
 
+const char *AVIconDrawing::avicon_names[] =
+{
+       N_("Full Play"),
+       N_("Mouse Over"),
+       N_("Src Target"),
+       N_("No Play"),
+};
 
 AssetVIcon::AssetVIcon(AssetPicon *picon, int w, int h, double framerate, int64_t length)
  : VIcon(w, h, framerate), Garbage("AssetVIcon")
@@ -277,7 +284,9 @@ void AssetVIconAudio::start(AssetVIcon *vicon)
 {
        if( running() ) return;
        interrupted = 0;
-       audio_pos = 0;
+       double pos = vicon->length > 0 ? (double)vicon->seq_no/vicon->length : 0;
+       int audio_len = vicon->audio_size/sizeof(vicon_audio_t);
+       audio_pos = pos * audio_len;
        this->vicon = vicon;
        Thread::start();
 }
@@ -305,9 +314,10 @@ void AssetVIcon::start_audio()
 
 void AssetVIcon::stop_audio()
 {
-       if( playing_audio > 0 )
+       if( playing_audio > 0 ) {
                picon->gui->vicon_audio->stop(0);
-       playing_audio = 0;
+               playing_audio = 0;
+       }
 }
 
 AssetViewPopup::AssetViewPopup(VIconThread *vt, int draw_mode,
@@ -328,25 +338,19 @@ int AssetViewPopup::button_press_event()
        AssetVIconThread *avt = (AssetVIconThread *)vt;
        if( !avt->vicon ) return 0;
 
-       switch( draw_mode ) {
-       case ASSET_VIEW_MEDIA_MAP:
-       case ASSET_VIEW_FULL:
-               break;
-       default:
-               return 0;
-       }
-
        int dir = 1;
        switch( get_buttonpress() ) {
        case LEFT_BUTTON:
                break;
        case WHEEL_DOWN:
-               dir = -1;
-               // fall thru
+               dir = -1; // fall thru
        case WHEEL_UP:
-               if( draw_mode != ASSET_VIEW_FULL )
-                       return avt->zoom_scale(dir);
-               // fall thru
+               switch( draw_mode ) {
+               case ASSET_VIEW_MEDIA:
+               case ASSET_VIEW_MEDIA_MAP:
+                       avt->zoom_scale(dir);
+                       return 1;
+               } // fall thru
        default:
                return 0;
        }
@@ -435,7 +439,7 @@ int AssetViewPopup::button_press_event()
                        }
                }
                mwindow->gui->lock_window("AssetVIcon::popup_button_press");
-               mwindow->select_point(!ctrl_down() && !shift_down() ? pos : start);
+               mwindow->select_point(start);
                edl->local_session->set_selectionstart(start);
                edl->local_session->set_selectionend(!shift_down() ? start : end);
                mwindow->zoom_sample(edl->local_session->zoom_sample);
@@ -454,26 +458,25 @@ int AssetViewPopup::button_release_event()
 
 int AssetViewPopup::cursor_motion_event()
 {
-       if( !is_event_win() ) return 0;
        AssetVIconThread *avt = (AssetVIconThread *)vt;
-       if( !avt->vicon ||
-           ( draw_mode != ASSET_VIEW_FULL &&
-             draw_mode != ASSET_VIEW_MEDIA_MAP ) ) return 0;
-       if( !get_button_down() || get_buttonpress() != LEFT_BUTTON ||
-           ctrl_down() || alt_down() || shift_down() )
-               return 0;
        AssetVIcon *vicon = (AssetVIcon *)avt->vicon;
-       MWindow *mwindow = vicon->picon->mwindow;
-       EDL *edl = mwindow->edl;
-       if( dragging ) {
-               int x = get_cursor_x();
-               double total_length = edl->tracks->total_length();
-               double pos = x * total_length / get_w();
-               mwindow->gui->lock_window("AssetVIcon::popup_cursor_motion");
-               mwindow->select_point(pos);
-               mwindow->zoom_sample(edl->local_session->zoom_sample);
-               mwindow->gui->unlock_window();
-               return 1;
+       if( vicon && dragging && is_event_win() &&
+           get_button_down() && get_buttonpress() == LEFT_BUTTON &&
+           !ctrl_down() && !alt_down() && !shift_down() ) {
+               switch( draw_mode ) {
+               case ASSET_VIEW_MEDIA_MAP:
+               case ASSET_VIEW_FULL:
+                       MWindow *mwindow = vicon->picon->mwindow;
+                       EDL *edl = mwindow->edl;
+                       int x = get_cursor_x();
+                       double total_length = edl->tracks->total_length();
+                       double pos = x * total_length / get_w();
+                       mwindow->gui->lock_window("AssetVIcon::popup_cursor_motion");
+                       mwindow->select_point(pos);
+                       mwindow->zoom_sample(edl->local_session->zoom_sample);
+                       mwindow->gui->unlock_window();
+                       return 1;
+               }
        }
        return 0;
 }
@@ -607,14 +610,17 @@ void AssetVIconThread::drawing_stopped()
 void AssetVIconThread::set_view_popup(AssetVIcon *v, int draw_mode)
 {
        gui->stop_vicon_drawing();
-       int mode = !v ? ASSET_VIEW_NONE :
-               draw_mode >= 0 ? draw_mode :
-               this->draw_mode;
-       this->vicon = v;
-       this->draw_mode = mode;
+       this->draw_mode = draw_mode;
+       VIconThread::set_view_popup(v);
        gui->start_vicon_drawing();
 }
 
+void AssetVIconThread::set_view_popup(AssetVIcon *v)
+{
+       if( !v ) draw_mode = ASSET_VIEW_NONE;
+       VIconThread::set_view_popup(v);
+}
+
 ViewPopup *AssetVIconThread::new_view_window()
 {
        BC_WindowBase *parent = wdw->get_parent();
@@ -632,8 +638,19 @@ ViewPopup *AssetVIconThread::new_view_window()
        else
                parent->get_fullscreen_geometry(rx, ry, rw, rh);
        AssetViewPopup *popup = new AssetViewPopup(this, draw_mode, rx, ry, rw, rh);
-       if( draw_mode == ASSET_VIEW_MEDIA_MAP || draw_mode == ASSET_VIEW_FULL )
+       switch( draw_mode ) {
+       case ASSET_VIEW_NONE:
+       case ASSET_VIEW_ICON:
+       case ASSET_VIEW_MEDIA_MAP:
+       case ASSET_VIEW_FULL:
+               vicon->stop_audio();
                vicon->playing_audio = -1;
+               break;
+       case ASSET_VIEW_MEDIA:
+               vicon->playing_audio = 1;
+               vicon->start_audio();
+               break;
+       }
        wdw->set_active_subwindow(popup);
        return popup;
 }
@@ -1248,7 +1265,7 @@ AWindowGUI::AWindowGUI(MWindow *mwindow, AWindow *awindow)
        remove_plugin = 0;
        vicon_thread = 0;
        vicon_audio = 0;
-       vicon_drawing = 1;
+       vicon_drawing = AVICON_FULL_PLAY;
        displayed_folder = AW_NO_FOLDER;
        new_folder_thread = 0;
        modify_folder_thread = 0;
@@ -1446,9 +1463,11 @@ void AWindowGUI::create_objects()
 
        int fx = mwindow->theme->afolders_x, fy = mwindow->theme->afolders_y;
        int fw = mwindow->theme->afolders_w, fh = mwindow->theme->afolders_h;
-       VFrame **images = mwindow->theme->get_image_set("playpatch_data");
-       AVIconDrawing::calculate_geometry(this, images, &avicon_w, &avicon_h);
-       add_subwindow(avicon_drawing = new AVIconDrawing(this, fw-avicon_w, fy, images));
+       const char *text = _("Preview");
+       int tw = get_text_width(MEDIUMFONT, text);
+       int pw = BC_PopupMenu::calculate_w(4, tw, -1);
+       add_subwindow(avicon_drawing = new AVIconDrawing(this, fw, fy, pw, text));
+       avicon_drawing->create_objects();
        add_subwindow(add_tools = new AddTools(mwindow, this, fx, fy, _("Visibility")));
        add_tools->create_objects();
        fy += add_tools->get_h();  fh -= add_tools->get_h();
@@ -1546,7 +1565,7 @@ void AWindowGUI::reposition_objects()
        int fx = mwindow->theme->afolders_x, fy = mwindow->theme->afolders_y;
        int fw = mwindow->theme->afolders_w, fh = mwindow->theme->afolders_h;
        add_tools->resize_event(fw-avicon_w, add_tools->get_h());
-       avicon_drawing->reposition_window(fw-avicon_w, fy);
+       avicon_drawing->reposition_window(fw-avicon_drawing->get_w(), fy);
        fy += add_tools->get_h();  fh -= add_tools->get_h();
        folder_list->reposition_window(fx, fy, fw, fh);
 }
@@ -1583,7 +1602,15 @@ int AWindowGUI::close_event()
 
 void AWindowGUI::start_vicon_drawing()
 {
-       if( !vicon_drawing || !vicon_thread->interrupted ) return;
+       if( !vicon_thread->interrupted ) return;
+       switch( vicon_drawing ) {
+       case AVICON_FULL_PLAY:  // all vicons, viewing, target
+       case AVICON_MOUSE_OVER: // one vicon, viewing, target
+               break;
+       case AVICON_SRC_TARGET: // no vicons, no view, target
+       case AVICON_NO_PLAY:    // no vicons, no view, no target
+               return;
+       }
        if( mwindow->edl->session->awindow_folder == AW_MEDIA_FOLDER ||
            mwindow->edl->session->awindow_folder == AW_PROXY_FOLDER ||
            mwindow->edl->session->awindow_folder == AW_CLIP_FOLDER ||
@@ -1601,10 +1628,11 @@ void AWindowGUI::start_vicon_drawing()
        }
 }
 
-void AWindowGUI::stop_vicon_drawing()
+int AWindowGUI::stop_vicon_drawing()
 {
-       if( vicon_thread->interrupted ) return;
+       if( vicon_thread->interrupted ) return 0;
        vicon_thread->stop_drawing();
+       return 1;
 }
 
 void AWindowGUI::close_view_popup()
@@ -2629,7 +2657,7 @@ int AWindowAssets::button_press_event()
                case WHEEL_UP: {
                        int x = get_cursor_x(), y = get_cursor_y();
                        if( avt->cursor_inside(x, y) && avt->view_win )
-                               return avt->zoom_scale(dir);
+                               avt->zoom_scale(dir);
                        return 1; }
                }
        }
@@ -2743,30 +2771,39 @@ int AWindowAssets::selection_changed()
 
                deactivate_selection();
        }
-       else if( gui->vicon_drawing && get_button_down() &&
-               (item = (AssetPicon*)get_selection(0, 0)) != 0 ) {
-               switch( folder ) {
-               case AW_MEDIA_FOLDER:
-               case AW_PROXY_FOLDER:
-               case AWINDOW_USER_FOLDERS:
-                       if( get_buttonpress() == LEFT_BUTTON ||
-                           get_buttonpress() == MIDDLE_BUTTON ) {
-                               AssetVIcon *vicon = 0;
-                               if( !gui->vicon_thread->vicon )
-                                       vicon = item->vicon;
-                               int draw_mode = vicon && get_buttonpress() == MIDDLE_BUTTON ?
-                                       ASSET_VIEW_MEDIA_MAP : ASSET_VIEW_MEDIA;
-                               gui->vicon_thread->set_view_popup(vicon, draw_mode);
-                       }
-                       break;
-               case AW_CLIP_FOLDER:
-                       if( get_buttonpress() == LEFT_BUTTON ) {
-                               AssetVIcon *vicon = 0;
-                               if( !gui->vicon_thread->vicon )
-                                       vicon = item->vicon;
-                               gui->vicon_thread->set_view_popup(vicon, ASSET_VIEW_ICON);
+       else if( get_button_down() ) {
+               if( (item = (AssetPicon*)get_selection(0, 0)) != 0 ) {
+                       switch( folder ) {
+                       case AW_MEDIA_FOLDER:
+                       case AW_PROXY_FOLDER:
+                       case AWINDOW_USER_FOLDERS:
+                               if( get_buttonpress() == LEFT_BUTTON ||
+                                   get_buttonpress() == MIDDLE_BUTTON ) {
+                                       AssetVIcon *vicon = 0;
+                                       AssetVIconThread *avt = gui->vicon_thread;
+                                       if( !avt->vicon && gui->vicon_drawing != AVICON_NO_PLAY )
+                                               vicon = item->vicon;
+                                       int draw_mode = !vicon ?
+                                                       ASSET_VIEW_NONE :
+                                               get_buttonpress() == MIDDLE_BUTTON ?
+                                                       ASSET_VIEW_MEDIA_MAP : ASSET_VIEW_MEDIA;
+                                       avt->set_view_popup(vicon, draw_mode);
+                               }
+                               break;
+                       case AW_CLIP_FOLDER:
+                               if( get_buttonpress() == LEFT_BUTTON ) {
+                                       AssetVIcon *vicon = 0;
+                                       if( !gui->vicon_thread->vicon )
+                                               vicon = item->vicon;
+                                       gui->vicon_thread->set_view_popup(vicon, ASSET_VIEW_ICON);
+                               }
+                               break;
                        }
-                       break;
+               }
+               else {
+                       gui->vicon_thread->set_view_popup(0);
+                       if( gui->vicon_drawing != AVICON_FULL_PLAY )
+                               gui->stop_vicon_drawing();
                }
        }
        return 1;
@@ -2940,13 +2977,23 @@ int AWindowAssets::column_resize_event()
 int AWindowAssets::focus_in_event()
 {
        int ret = BC_ListBox::focus_in_event();
-       gui->start_vicon_drawing();
+       switch( gui->vicon_drawing ) {
+       case AVICON_FULL_PLAY:
+               gui->start_vicon_drawing();
+               break;
+       case AVICON_MOUSE_OVER:
+       case AVICON_SRC_TARGET:
+       case AVICON_NO_PLAY:
+       default:
+               break;
+       }
        return ret;
 }
 
 int AWindowAssets::focus_out_event()
 {
        gui->stop_vicon_drawing();
+       gui->vicon_thread->set_view_popup(0);
        return BC_ListBox::focus_out_event();
 }
 
@@ -2964,10 +3011,25 @@ void AWindowAssets::update_vicon_area()
 
 int AWindowAssets::mouse_over_event(int no)
 {
-       if( gui->vicon_thread->viewing &&
-           no >= 0 && no < gui->displayed_assets[0].size() ) {
-               AssetPicon *picon = (AssetPicon *)gui->displayed_assets[0][no];
-               gui->vicon_thread->set_view_popup(picon->vicon);
+       AssetPicon *picon = no >= 0 && no < gui->displayed_assets[0].size() ?
+               (AssetPicon *)gui->displayed_assets[0][no] : 0;
+       AssetVIcon *vicon = !picon ? 0 : picon->vicon;
+       switch( gui->vicon_drawing ) {
+       case AVICON_FULL_PLAY:
+               gui->vicon_thread->solo = 0;
+               if( vicon && gui->vicon_thread->viewing )
+                       gui->vicon_thread->set_view_popup(vicon);
+               break;
+       case AVICON_MOUSE_OVER:
+               if( !vicon ) break;
+               gui->vicon_thread->solo = vicon;
+               if( gui->vicon_thread->viewing )
+                       gui->vicon_thread->set_view_popup(vicon);
+               break;
+       case AVICON_SRC_TARGET:
+       case AVICON_NO_PLAY:
+       default:
+               break;
        }
        return 0;
 }
@@ -3131,7 +3193,7 @@ int AWindowView::handle_event()
 }
 
 AddTools::AddTools(MWindow *mwindow, AWindowGUI *gui, int x, int y, const char *title)
- : BC_PopupMenu(x, y, BC_Title::calculate_w(gui, title, MEDIUMFONT)+8, title, -1, 0, 4)
+ : BC_PopupMenu(x, y, gui->get_text_width(MEDIUMFONT, title)+8, title, -1, 0, 4)
 {
        this->mwindow = mwindow;
        this->gui = gui;
@@ -3202,37 +3264,46 @@ int AddPluginItem::handle_event()
        return 1;
 }
 
-AVIconDrawing::AVIconDrawing(AWindowGUI *agui, int x, int y, VFrame **images)
- : BC_Toggle(x, y, images, agui->vicon_drawing)
+AVIconDrawingItem::AVIconDrawingItem(AVIconDrawing *avicon, const char *text, int id)
+ : BC_MenuItem(text)
 {
-       this->agui = agui;
-       set_tooltip(_("Preview"));
+       this->avicon = avicon;
+       this->id = id;
+}
+
+int AVIconDrawingItem::handle_event()
+{
+       for( int i=0; i<AVICON_PLAY_MODES; ++i ) {
+               AVIconDrawingItem *item = (AVIconDrawingItem *) avicon->get_item(i);
+               item->set_checked(id == i);
+       }
+       AWindowGUI *agui = avicon->agui;
+       agui->stop_vicon_drawing();
+       agui->vicon_thread->set_view_popup(0);
+       agui->vicon_drawing = id;
+       agui->start_vicon_drawing();
+       return 1;
 }
 
-void AVIconDrawing::calculate_geometry(AWindowGUI *agui, VFrame **images, int *ww, int *hh)
+AVIconDrawing::AVIconDrawing(AWindowGUI *agui, int x, int y, int w, const char *text)
+ : BC_PopupMenu(x-w, y, w, text, -1, 0, 4)
 {
-       int text_line = -1, toggle_x = -1, toggle_y = -1;
-       int text_x = -1, text_y = -1, text_w = -1, text_h = -1;
-       BC_Toggle::calculate_extents(agui, images, 1,
-               &text_line, ww, hh, &toggle_x, &toggle_y,
-               &text_x, &text_y, &text_w, &text_h, "", MEDIUMFONT);
+       this->agui = agui;
 }
 
 AVIconDrawing::~AVIconDrawing()
 {
 }
 
-int AVIconDrawing::handle_event()
+void AVIconDrawing::create_objects()
 {
-       agui->vicon_drawing = get_value();
-       if( agui->vicon_drawing )
-               agui->start_vicon_drawing();
-       else
-               agui->stop_vicon_drawing();
-       return 1;
+       AVIconDrawingItem *item;
+       for( int i=0; i<AVICON_PLAY_MODES; ++i ) {
+               add_item(item = new AVIconDrawingItem(this, avicon_names[i], i));
+               item->set_checked(agui->vicon_drawing == i);
+       }
 }
 
-
 AWindowListFormat::AWindowListFormat(MWindow *mwindow, AWindowGUI *gui)
  : BC_MenuItem("","v",'v')
 {
index dadc44bc440576d4ec0ab54931968149c02015fb..35fdb9231c796a80ea5b5fd9e0e62d3fd41dc21f 100644 (file)
 #define ASSET_VIEW_MEDIA_MAP 3
 #define ASSET_VIEW_FULL 4
 
+#define AVICON_FULL_PLAY   0
+#define AVICON_MOUSE_OVER  1
+#define AVICON_SRC_TARGET  2
+#define AVICON_NO_PLAY     3
+#define AVICON_PLAY_MODES  4
+
 class AWindowFolderItem : public BC_ListBoxItem
 {
 public:
@@ -194,7 +200,8 @@ public:
        AssetVIconThread(AWindowGUI *gui, Preferences *preferences);
        ~AssetVIconThread();
 
-       void set_view_popup(AssetVIcon *v, int draw_mode=-1);
+       void set_view_popup(AssetVIcon *v, int draw_mode);
+       void set_view_popup(AssetVIcon *v);
        ViewPopup *new_view_window();
        void drawing_started();
        void drawing_stopped();
@@ -276,7 +283,7 @@ public:
        int save_defaults(BC_Hash *defaults);
        int load_defaults(BC_Hash *defaults);
        void start_vicon_drawing();
-       void stop_vicon_drawing();
+       int stop_vicon_drawing();
        void close_view_popup();
        void update_picon(Indexable *indexable);
        int cycle_assetlist_format();
@@ -570,16 +577,26 @@ public:
        int idx;
 };
 
-class AVIconDrawing : public BC_Toggle
+class AVIconDrawingItem : public BC_MenuItem
 {
 public:
-       AWindowGUI *agui;
-
+       AVIconDrawingItem(AVIconDrawing *avicon, const char *text, int id);
        int handle_event();
-       static void calculate_geometry(AWindowGUI *agui, VFrame **images, int *ww, int *hh);
 
-       AVIconDrawing(AWindowGUI *agui, int x, int y, VFrame **images);
+       AVIconDrawing *avicon;
+       int id;
+};
+
+class AVIconDrawing : public BC_PopupMenu
+{
+public:
+       AVIconDrawing(AWindowGUI *agui, int x, int y, int w, const char *text);
        ~AVIconDrawing();
+
+       void create_objects();
+       static const char *avicon_names[];
+
+       AWindowGUI *agui;
 };
 
 
index b67da703a15976a8a7ebee01ae7dc56d35692436..7758c696880a584eb0ade7a19c00880ef086d984 100644 (file)
@@ -46,6 +46,7 @@ class AWindowAppend;
 class AWindowView;
 class AddTools;
 class AddPluginItem;
+class AVIconDrawingItem;
 class AVIconDrawing;
 class AWindowListFormat;
 class AWindowListSort;
index dcae332dfd7be715481b1cc2023ebfe485e6f9d9..6ebaa967041e7078aef0d2f2ac1f9a8589cf56b2 100644 (file)
@@ -164,7 +164,8 @@ char *BD_BatchRenderJob::create_script(EDL *edl, ArrayList<Indexable *> *idxbls)
        int is_usr_mnt = get_udfs_mount(udfs, mopts, mntpt);
        const char *exec_path = File::get_cinlib_path();
        fprintf(fp,"#!/bin/bash -ex\n");
-       fprintf(fp,"dir=`dirname $0`\n");
+       fprintf(fp,"sdir=`dirname $0`\n");
+       fprintf(fp,"dir=`cd \"$sdir\"; pwd`\n");
        fprintf(fp,"PATH=$PATH:%s\n",exec_path);
        fprintf(fp,"mkdir -p $dir/udfs\n");
        fprintf(fp,"sz=`du -cb $dir/bd.m2ts* | tail -1 | sed -e 's/[ \t].*//'`\n");
index 6b3f65085c920ea3994a224e8007287b4eb59b7a..14e4351db0e84d2fc13f97ed8cc749b0c2d33cf6 100644 (file)
@@ -88,6 +88,7 @@ void Canvas::reset()
        canvas_subwindow = 0;
        canvas_fullscreen = 0;
        is_processing = 0;
+       is_fullscreen = 0;
        cursor_inside = 0;
 }
 
@@ -135,6 +136,16 @@ void Canvas::use_vwindow()
        canvas_menu->use_vwindow();
 }
 
+int Canvas::get_fullscreen()
+{
+       return is_fullscreen;
+}
+
+void Canvas::set_fullscreen(int value)
+{
+       is_fullscreen = value;
+}
+
 // Get dimensions given a zoom
 void Canvas::calculate_sizes(float aspect_ratio,
        int output_w,
index 1a65426064bbecc2da026e18dedaf72f97538bd2..1b1adb1d61f1a763d472b69438a440451e3d83a5 100644 (file)
@@ -87,8 +87,8 @@ public:
        virtual void draw_overlays() {}
        virtual void toggle_controls() {}
        virtual int get_cwindow_controls() { return 0; }
-       virtual int get_fullscreen() { return 0; }
-       virtual void set_fullscreen(int value) {}
+       virtual int get_fullscreen();
+       virtual void set_fullscreen(int value);
 
        int cursor_leave_event_base(BC_WindowBase *caller);
        int cursor_enter_event_base(BC_WindowBase *caller);
@@ -200,6 +200,7 @@ public:
 // For cases where video is not enabled on the canvas but processing is
 // occurring for a single frame, this causes the status to update.
        int is_processing;
+       int is_fullscreen;
 // Cursor is inside video surface
        int cursor_inside;
        int view_x;
index 0d8b755a6cc18c9703ffd1c5423db97e92fdb835..a93964c4c54074764712679504bd529517fa8ab3 100644 (file)
@@ -480,7 +480,7 @@ int CWindowGUI::keypress_event()
                break;
        case 'f':
                unlock_window();
-               if(mwindow->session->cwindow_fullscreen)
+               if( canvas->get_fullscreen() )
                        canvas->stop_fullscreen();
                else
                        canvas->start_fullscreen();
@@ -506,7 +506,7 @@ int CWindowGUI::keypress_event()
                break;
        case ESC:
                unlock_window();
-               if(mwindow->session->cwindow_fullscreen)
+               if( canvas->get_fullscreen() )
                        canvas->stop_fullscreen();
                lock_window("CWindowGUI::keypress_event 4");
                result = 1;
@@ -1093,17 +1093,6 @@ void CWindowCanvas::status_event()
        gui->draw_status(1);
 }
 
-int CWindowCanvas::get_fullscreen()
-{
-       return mwindow->session->cwindow_fullscreen;
-}
-
-void CWindowCanvas::set_fullscreen(int value)
-{
-       mwindow->session->cwindow_fullscreen = value;
-}
-
-
 void CWindowCanvas::update_zoom(int x, int y, float zoom)
 {
        use_scrollbars = mwindow->edl->session->cwindow_scrollbars;
index 67859a2967a04835db67812e64f0148529f55cfe..c23db9bdbba6220080f28fa0f00561ec53a49cb6 100644 (file)
@@ -294,8 +294,6 @@ public:
        int cursor_motion_event();
        int button_press_event();
        int button_release_event();
-       int get_fullscreen();
-       void set_fullscreen(int value);
        int test_crop(int button_press, int &redraw);
        int test_bezier(int button_press,
                int &redraw,
index 3e69b52dde3073b02d1c4cd54feda4acca22a38f..157f17ee23db4f99c115a432b97d03e08ffa12f1 100644 (file)
@@ -168,7 +168,8 @@ char *DVD_BatchRenderJob::create_script(EDL *edl, ArrayList<Indexable *> *idxbls
        }
 
        fprintf(fp,"#!/bin/bash\n");
-       fprintf(fp,"dir=`dirname $0`\n");
+       fprintf(fp,"sdir=`dirname $0`\n");
+       fprintf(fp,"dir=`cd \"$sdir\"; pwd`\n");
        fprintf(fp,"echo \"running %s\"\n", script);
        fprintf(fp,"\n");
        const char *exec_path = File::get_cinlib_path();
@@ -221,7 +222,7 @@ char *DVD_BatchRenderJob::create_script(EDL *edl, ArrayList<Indexable *> *idxbls
                                bmin(video_length, audio_length) :
                        idxbl->have_video() ? video_length :
                        idxbl->have_audio() ? audio_length : 0;
-               fprintf(fp,"      <vob file=\"%s", !file_seq ? "dvd.mpg" : idxbl->path);
+               fprintf(fp,"      <vob file=\"%s", !file_seq ? "$dir/dvd.mpg" : idxbl->path);
                chapter = 0;
                double vob_end = i+1>=total_idxbls ? total_length : vob_pos + length;
                if( labeled ) {
@@ -361,7 +362,7 @@ int CreateDVD_Thread::create_dvd_jobs(ArrayList<BatchRenderJob*> *jobs, const ch
        }
 
        BatchRenderJob *job = new DVD_BatchRenderJob(mwindow->preferences,
-               use_labeled, use_farmed, use_standard, use_ffmpeg);
+               use_labeled, use_farmed, use_standard, 0);// use_ffmpeg);
        jobs->append(job);
        strcpy(&job->edl_path[0], xml_filename);
        Asset *asset = job->asset;
@@ -377,7 +378,12 @@ int CreateDVD_Thread::create_dvd_jobs(ArrayList<BatchRenderJob*> *jobs, const ch
                sprintf(&asset->path[0],"%s/dvd.mpg", asset_dir);
                asset->format = FILE_FFMPEG;
                strcpy(asset->fformat, "dvd");
-
+// if there are many renderfarm jobs, then there are small audio fragments of
+// silence that are used at the end of a render to fill the last audio "block".
+// this extra data gradually skews the audio/video sync.  Therefore, the audio
+// is not rendered muxed for ffmpeg, and is remuxed as with mjpeg rendering.
+// since this audio is in one file, the only fragment is at the end and is ok.
+#if 0
                asset->audio_data = 1;
                asset->channels = session->audio_channels;
                asset->sample_rate = session->sample_rate;
@@ -395,6 +401,28 @@ int CreateDVD_Thread::create_dvd_jobs(ArrayList<BatchRenderJob*> *jobs, const ch
                asset->ff_video_bitrate = vid_bitrate;
                asset->ff_video_quality = -1;
                use_farmed = job->farmed;
+#else
+               asset->video_data = 1;
+               strcpy(asset->vcodec, "raw.dvd");
+               sprintf(&asset->path[0],"%s/dvd.m2v", asset_dir);
+               FFMPEG::set_option_path(option_path, "video/%s", asset->vcodec);
+               FFMPEG::load_options(option_path, asset->ff_video_options,
+                        sizeof(asset->ff_video_options));
+               asset->ff_video_bitrate = vid_bitrate;
+               asset->ff_video_quality = -1;
+               use_farmed = job->farmed;
+
+               job = new BatchRenderJob(mwindow->preferences, 0, 0);
+               jobs->append(job);
+               strcpy(&job->edl_path[0], xml_filename);
+               asset = job->asset;
+               sprintf(&asset->path[0],"%s/dvd.ac3", asset_dir);
+               asset->format = FILE_AC3;
+               asset->audio_data = 1;
+               asset->channels = session->audio_channels;
+               asset->sample_rate = session->sample_rate;
+               asset->ac3_bitrate = dvd_kaudio_rate;
+#endif
        }
        else {
                sprintf(&asset->path[0],"%s/dvd.m2v", asset_dir);
index bd19562d367b16fd9882322fdedfa8b6c5cade39..f1b1974e05f2537fb3bc00d7799e0c29b3df968b 100644 (file)
@@ -66,10 +66,6 @@ MainSession::MainSession(MWindow *mwindow)
        cwindow_controls = 1;
        trim_edits = 0;
        current_tip = -1;
-       cwindow_fullscreen = 0;
-       rwindow_fullscreen = 0;
-       vwindow_fullscreen = 0;
-       zwindow_fullscreen = 0;
        selected_zwindow = -1;
        actual_frame_rate = 0;
        title_bar_alpha = 0;
index a3ad511c8bcfc507f876229267c49f915d29cd83..6395b809cc3b00e0feb0b579b9bdad386265d260 100644 (file)
@@ -184,10 +184,6 @@ public:
        int menueffect_w, menueffect_h;
        int transitiondialog_w, transitiondialog_h;
 
-       int cwindow_fullscreen;
-       int rwindow_fullscreen;
-       int vwindow_fullscreen;
-       int zwindow_fullscreen;
        int selected_zwindow;
 
        double actual_frame_rate;
index aa10ec0d26e045b69f3e9af8b5dfc2b5062054d0..2fb3a09872eeeb0f207c98cff1e684f6626f75c7 100644 (file)
@@ -78,7 +78,6 @@ RecordMonitor::~RecordMonitor()
 void RecordMonitor::create_objects()
 {
        int min_w = 150;
-       mwindow->session->rwindow_fullscreen = 0;
 
        if( !record->default_asset->video_data )
                min_w = MeterPanel::get_meters_width(mwindow->theme,
@@ -424,7 +423,7 @@ void RecordMonitorGUI::create_objects()
 
 int RecordMonitorGUI::button_press_event()
 {
-       if(mwindow->session->rwindow_fullscreen && canvas && canvas->get_canvas())
+       if( canvas && canvas->get_fullscreen() && canvas->get_canvas())
                return canvas->button_press_event_base(canvas->get_canvas());
 
        if( get_buttonpress() == 2 ) {
@@ -819,16 +818,6 @@ void RecordMonitorCanvas::zoom_resize_window(float percentage)
        window->resize_event(new_w, new_h);
 }
 
-int RecordMonitorCanvas::get_fullscreen()
-{
-       return mwindow->session->rwindow_fullscreen;
-}
-
-void RecordMonitorCanvas::set_fullscreen(int value)
-{
-       mwindow->session->rwindow_fullscreen = value;
-}
-
 
 int RecordMonitorCanvas::button_release_event()
 {
index d109aff5097d5649df5628d9131575a11d3646c4..956cd2143f5ea4f4b74553aba917698baef4e3b4 100644 (file)
@@ -230,9 +230,6 @@ public:
        int keypress_event();
        int get_output_w();
        int get_output_h();
-       int get_fullscreen();
-       void set_fullscreen(int value);
-
 
        RecordMonitorGUI *window;
        MWindow *mwindow;
index ff21962f6063776b5524dc0b9518c2a9de23c812..faa62ddba9e878ae0b55c9667dbc8c2bdf456aad 100644 (file)
@@ -736,7 +736,8 @@ void RenderThread::render_single(int test_overwrite, Asset *asset, EDL *edl,
 
        render->total_rendered = 0;
 
-       if( !render->result ) {
+       if( !render->result &&
+           ( strategy == SINGLE_PASS_FARM || strategy == FILE_PER_LABEL_FARM ) ) {
 // Start dispatching external jobs
                if( mwindow ) {
                        mwindow->gui->lock_window("Render::render 1");
@@ -748,24 +749,22 @@ void RenderThread::render_single(int test_overwrite, Asset *asset, EDL *edl,
                        printf("Render::render: starting render farm\n");
                }
 
-               if( strategy == SINGLE_PASS_FARM || strategy == FILE_PER_LABEL_FARM ) {
-                       farm_server = new RenderFarmServer(mwindow, render->packages,
-                               render->preferences, 1, &render->result,
-                               &render->total_rendered, render->counter_lock,
-                               render->default_asset, command->get_edl(), 0);
-                       render->result = farm_server->start_clients();
-
-                       if( render->result ) {
-                               if( mwindow ) {
-                                       mwindow->gui->lock_window("Render::render 2");
-                                       mwindow->gui->show_message(_("Failed to start render farm"),
-                                               mwindow->theme->message_error);
-                                       mwindow->gui->stop_hourglass();
-                                       mwindow->gui->unlock_window();
-                               }
-                               else {
-                                       printf("Render::render: Failed to start render farm\n");
-                               }
+               farm_server = new RenderFarmServer(mwindow, render->packages,
+                       render->preferences, 1, &render->result,
+                       &render->total_rendered, render->counter_lock,
+                       render->default_asset, command->get_edl(), 0);
+               render->result = farm_server->start_clients();
+
+               if( render->result ) {
+                       if( mwindow ) {
+                               mwindow->gui->lock_window("Render::render 2");
+                               mwindow->gui->show_message(_("Failed to start render farm"),
+                                       mwindow->theme->message_error);
+                               mwindow->gui->stop_hourglass();
+                               mwindow->gui->unlock_window();
+                       }
+                       else {
+                               printf("Render::render: Failed to start render farm\n");
                        }
                }
        }
index 814161b67854d1286a0d72aafa4612228c6697fd..44a9948c28c755c1c3a74b93a0495a0c02f5c57b 100644 (file)
@@ -358,7 +358,7 @@ int VWindowGUI::keypress_event()
                break;
        case 'f':
                unlock_window();
-               if(mwindow->session->vwindow_fullscreen)
+               if( canvas->get_fullscreen() )
                        canvas->stop_fullscreen();
                else
                        canvas->start_fullscreen();
@@ -366,7 +366,7 @@ int VWindowGUI::keypress_event()
                break;
        case ESC:
                unlock_window();
-               if(mwindow->session->vwindow_fullscreen)
+               if( canvas->get_fullscreen() )
                        canvas->stop_fullscreen();
                lock_window("VWindowGUI::keypress_event 2");
                break;
@@ -877,13 +877,3 @@ void VWindowCanvas::draw_overlays()
        }
 }
 
-int VWindowCanvas::get_fullscreen()
-{
-       return mwindow->session->vwindow_fullscreen;
-}
-
-void VWindowCanvas::set_fullscreen(int value)
-{
-       mwindow->session->vwindow_fullscreen = value;
-}
-
index 60dcfeff1a56a7d0020032275c4f5933ac44485d..a6c206e5be98644485be126b5e2a9476688a85a6 100644 (file)
@@ -122,8 +122,6 @@ public:
        int need_overlays();
        void draw_overlays();
        void close_source();
-       int get_fullscreen();
-       void set_fullscreen(int value);
 
        MWindow *mwindow;
        VWindowGUI *gui;
index bada1625e68e7fff709ccd62edaa0ead71857325..9657b5731380f31eeb1daeb7503646e7b3946bfb 100644 (file)
@@ -98,13 +98,13 @@ int ZWindowGUI::keypress_event()
        int result = 1;
        switch( key ) {
        case 'f':
-               if( mwindow->session->zwindow_fullscreen )
+               if( canvas->get_fullscreen() )
                        canvas->stop_fullscreen();
                else
                        canvas->start_fullscreen();
                break;
        case ESC:
-               if( mwindow->session->zwindow_fullscreen )
+               if( canvas->get_fullscreen() )
                        canvas->stop_fullscreen();
                break;
        default:
@@ -246,13 +246,3 @@ void ZWindowCanvas::draw_refresh(int flush)
                cvs->flash(flush);
 }
 
-int ZWindowCanvas::get_fullscreen()
-{
-       return mwindow->session->zwindow_fullscreen;
-}
-
-void ZWindowCanvas::set_fullscreen(int value)
-{
-       mwindow->session->zwindow_fullscreen = value;
-}
-
index 9c1fed75cdc55d2427669b78d73b7cd09aa35b31..7604c4beeb213540c2c52ae3a64f2531090b04d8 100644 (file)
@@ -67,8 +67,6 @@ public:
 
        void draw_refresh(int flush = 1);
        void close_source();
-       int get_fullscreen();
-       void set_fullscreen(int value);
 
        MWindow *mwindow;
        ZWindowGUI *gui;
diff --git a/cinelerra-5.1/ffmpeg/video/raw.dvd b/cinelerra-5.1/ffmpeg/video/raw.dvd
new file mode 100644 (file)
index 0000000..a86f076
--- /dev/null
@@ -0,0 +1,9 @@
+rawvideo mpeg2video
+s 720x480
+r 30000/1001
+pix_fmt yuv420p
+g 18
+maxrate 9000000
+minrate 0
+bufsize 1835008
+packetsize 2048
index d8bce87265d3cf6622c480adee4e538053dda272..e40910c315f8cad0c684b4098d4dd640bf6d62c6 100644 (file)
 #include <math.h>
 #include <string.h>
 
-BC_Pan::BC_Pan(int x,
-               int y,
-               int virtual_r,
-               float maxvalue,
-               int total_values,
-               int *value_positions,
-               int stick_x,
-               int stick_y,
-               float *values)
+BC_Pan::BC_Pan(int x, int y, int virtual_r,
+               float maxvalue, int total_values, int *value_positions,
+               int stick_x, int stick_y, float *values)
  : BC_SubWindow(x, y, -1, -1, -1)
 {
        this->virtual_r = virtual_r;
@@ -69,29 +63,24 @@ BC_Pan::BC_Pan(int x,
                        this->stick_x,
                        this->stick_y);
        highlighted = 0;
-       popup = 0;
        active = 0;
+       temp_channel = 0;
+       rotater = 0;
+       popup = 0;
        memset(images, 0, sizeof(BC_Pixmap*) * PAN_IMAGES);
 }
 
 BC_Pan::~BC_Pan()
 {
-//printf("BC_Pan::~BC_Pan 1\n");
        delete [] values;
-//printf("BC_Pan::~BC_Pan 1\n");
        delete [] value_positions;
-//printf("BC_Pan::~BC_Pan 1\n");
        delete [] value_x;
-//printf("BC_Pan::~BC_Pan 1\n");
        delete [] value_y;
-//printf("BC_Pan::~BC_Pan 1\n");
-       if(popup) delete popup;
-//printf("BC_Pan::~BC_Pan 1\n");
+       delete popup;
        delete temp_channel;
-//printf("BC_Pan::~BC_Pan 1\n");
        delete rotater;
-       for(int i = 0; i < PAN_IMAGES; i++)
-               if(images[i]) delete images[i];
+       for( int i=0; i<PAN_IMAGES; ++i )
+               delete images[i];
 //printf("BC_Pan::~BC_Pan 2\n");
 }
 
@@ -111,9 +100,6 @@ int BC_Pan::initialize()
                get_resources()->pan_data[PAN_CHANNEL]->get_h(),
                get_resources()->pan_data[PAN_CHANNEL]->get_color_model(),
                -1);
-       rotater = new RotateFrame(1,
-               get_resources()->pan_data[PAN_CHANNEL]->get_w(),
-               get_resources()->pan_data[PAN_CHANNEL]->get_h());
        draw(1, 0);
        return 0;
 }
@@ -227,8 +213,8 @@ int BC_Pan::cursor_leave_event()
 
 int BC_Pan::deactivate()
 {
-       if(popup) delete popup;
-       popup = 0;
+       delete popup;    popup = 0;
+       delete rotater;  rotater = 0;
        active = 0;
        return 0;
 }
@@ -263,6 +249,10 @@ int BC_Pan::activate(int popup_x, int popup_y)
                if (x < 0) x = 0;
        }
 
+       rotater = new RotateFrame(1,
+               get_resources()->pan_data[PAN_CHANNEL]->get_w(),
+               get_resources()->pan_data[PAN_CHANNEL]->get_h());
+
        delete popup;
        popup = new BC_Popup(this, x, y,
                                images[PAN_POPUP]->get_w(),
index 80a02f6adc3b92790919763d1d06470efbbdfa07..5a792af0aaa8803791d81548be33722f06820b69 100644 (file)
@@ -134,28 +134,28 @@ int BC_PopupMenu::initialize()
 
 int BC_PopupMenu::set_images(VFrame **data)
 {
-       BC_Resources *resources = get_resources();
        for( int i=0; i<3; ++i ) {
                delete images[i];
                images[i] = new BC_Pixmap(parent_window, data[i], PIXMAP_ALPHA);
        }
 
-       if( w_argument >= 0 )
-               w = w_argument + margin +
-                       resources->popupmenu_triangle_margin;
-       else
-               w = get_text_width(MEDIUMFONT, text) + margin +
-                       resources->popupmenu_triangle_margin;
-
+       w = w_argument > 0 ? w_argument :
+               calculate_w(margin, get_text_width(MEDIUMFONT, text), use_title);
        h = images[BUTTON_UP]->get_h();
        return 0;
 }
 
-int BC_PopupMenu::calculate_w(int w_argument)
+int BC_PopupMenu::calculate_w(int margin, int text_width, int use_title)
+{
+       BC_Resources *resources = get_resources();
+       int l = margin >= 0 ? margin : resources->popupmenu_margin;
+       int r = use_title < 0 ? l : resources->popupmenu_triangle_margin;
+       return l + text_width + r;
+}
+
+int BC_PopupMenu::calculate_w(int text_width)
 {
-       return w_argument +
-               BC_WindowBase::get_resources()->popupmenu_margin +
-               BC_WindowBase::get_resources()->popupmenu_triangle_margin;
+       return calculate_w(-1, text_width, 0);
 }
 
 int BC_PopupMenu::calculate_h(VFrame **data)
@@ -203,7 +203,6 @@ int BC_PopupMenu::get_margin()
 int BC_PopupMenu::draw_face(int dx)
 {
        if( !use_title ) return 0;
-       BC_Resources *resources = get_resources();
 
 // Background
        draw_top_background(parent_window, 0, 0, w, h);
@@ -212,12 +211,12 @@ int BC_PopupMenu::draw_face(int dx)
 // Overlay text
        set_color(get_resources()->popup_title_text);
        int offset = status == BUTTON_DN ? 1 : 0;
-       int available_w = get_w() - margin*2 - resources->popupmenu_triangle_margin;
+       int available_w = get_w() - calculate_w(margin, 0, use_title);
+
        if( !icon ) {
-               set_font(MEDIUMFONT);
                char truncated[BCTEXTLEN];
                truncate_text(truncated, text, available_w);
-
+               set_font(MEDIUMFONT);
                BC_WindowBase::draw_center_text(
                        dx + available_w/2 + margin + offset,
                        (int)((float)get_h()/2 + get_text_ascent(MEDIUMFONT)/2 - 2) + offset,
index fbf44e747ebd275ee2b7a482329c643679d85b61..9ebef28a9acb58fd94b191e3acdad9f57695f786 100644 (file)
@@ -53,7 +53,8 @@ public:
        virtual ~BC_PopupMenu();
 
 // Adds popupmenu_margin to width
-       static int calculate_w(int w_argument);
+       static int calculate_w(int margin, int text_width, int use_title);
+       static int calculate_w(int text_width);
        static int calculate_h(VFrame **data = 0);
        virtual int handle_event() { return 0; };
        virtual int draw_face(int dx);
index 099f82494eb8a637977f2cc03cafef61fd4721bd..1810abc3f6fd943076cbdb6ab20edc1a16a5ba83 100644 (file)
@@ -893,7 +893,7 @@ int BC_WindowBase::dispatch_event(XEvent *event)
        int result;
        XClientMessageEvent *ptr;
        int cancel_resize, cancel_translation;
-       const int debug = 0;
+       volatile static int debug = 0;
 
        key_pressed = 0;
 
@@ -930,23 +930,22 @@ locking_message = event->xclient.message_type;
 
 
 
-//static const char *event_names[] = {
-//  "Reply", "Error", "KeyPress", "KeyRelease", "ButtonPress", "ButtonRelease", "MotionNotify",
-//  "EnterNotify", "LeaveNotify", "FocusIn", "FocusOut", "KeymapNotify", "Expose", "GraphicsExpose",
-//  "NoExpose", "VisibilityNotify", "CreateNotify", "DestroyNotify", "UnmapNotify", "MapNotify",
-//  "MapRequest", "ReparentNotify", "ConfigureNotify", "ConfigureRequest", "GravityNotify",
-//  "ResizeRequest", "CirculateNotify", "CirculateRequest", "PropertyNotify", "SelectionClear",
-//  "SelectionRequest", "SelectionNotify", "ColormapNotify", "ClientMessage", "MappingNotify",
-//  "GenericEvent", "LASTEvent",
-//};
-//
-//if(debug)
-//if(event->type != ClientMessage) {
-// printf("BC_WindowBase::dispatch_event %d %s %p %d (%s)\n",
-//__LINE__, title, event, event->type,
-//  event->type>=0 && event->type<sizeof(event_names)/sizeof(event_names[0]) ?
-//   event_names[event->type] : "Unknown");
-//}
+if( debug && event->type != ClientMessage ) {
+ static const char *event_names[] = {
+  "Reply", "Error", "KeyPress", "KeyRelease", "ButtonPress", "ButtonRelease", "MotionNotify",
+  "EnterNotify", "LeaveNotify", "FocusIn", "FocusOut", "KeymapNotify", "Expose", "GraphicsExpose",
+  "NoExpose", "VisibilityNotify", "CreateNotify", "DestroyNotify", "UnmapNotify", "MapNotify",
+  "MapRequest", "ReparentNotify", "ConfigureNotify", "ConfigureRequest", "GravityNotify",
+  "ResizeRequest", "CirculateNotify", "CirculateRequest", "PropertyNotify", "SelectionClear",
+  "SelectionRequest", "SelectionNotify", "ColormapNotify", "ClientMessage", "MappingNotify",
+  "GenericEvent", "LASTEvent",
+ };
+ const int nevents = sizeof(event_names)/sizeof(event_names[0]);
+
+ printf("BC_WindowBase::dispatch_event %d %s %p %d (%s)\n", __LINE__,
+  title, event, event->type, event->type>=0 && event->type<nevents ?
+   event_names[event->type] : "Unknown");
+}
 
        if( active_grab ) {
                unlock_window();
index f27791f94c06767bd12f0fc318093e2842319685..b1535546778f7a7d73e06259e2f5e91cc968c19d 100644 (file)
@@ -108,12 +108,16 @@ VIconThread(BC_WindowBase *wdw, int vw, int vh, int view_w, int view_h)
        this->wdw = wdw;
        this->vw = vw;         this->vh = vh;
        this->view_w = view_w; this->view_h = view_h;
-       this->view_win = 0;    this->vicon = 0;    this->viewing = 0;
+       this->view_win = 0;    this->vicon = 0;
+       this->viewing = 0;     this->solo = 0;
        this->draw_x0 = 0;     this->draw_x1 = wdw->get_w();
        this->draw_y0 = 0;     this->draw_y1 = wdw->get_h();
        draw_lock = new Condition(0, "VIconThread::draw_lock", 1);
        timer = new Timer();
        this->refresh_rate = VICON_RATE;
+       this->draw_flash = 0;
+       this->seq_no = 0;
+       this->now = 0;
        done = 0;
        interrupted = -1;
        stop_age = 0;
@@ -255,7 +259,11 @@ void ViewPopup::draw_vframe(VFrame *frame)
 
 void VIconThread::set_view_popup(VIcon *vicon)
 {
+       if( viewing == vicon && !this->vicon ) return;
        this->vicon = vicon;
+       if( interrupted )
+               update_view(0);
+
 }
 
 void VIconThread::close_view_popup()
@@ -264,7 +272,7 @@ void VIconThread::close_view_popup()
 }
 
 int VIconThread::
-update_view()
+update_view(int do_audio)
 {
        if( viewing ) viewing->stop_audio();
        delete view_win;  view_win = 0;
@@ -273,7 +281,7 @@ update_view()
                view_win->draw_vframe(viewing->frame());
                view_win->flash(0);
                view_win->show_window();
-               vicon->start_audio();
+               if( do_audio ) vicon->start_audio();
        }
        wdw->set_active_subwindow(view_win);
        return 1;
@@ -334,6 +342,26 @@ void VIconThread::hide_vicons(int v)
        }
 }
 
+int VIconThread::show_vicon(VIcon *next)
+{
+       now = timer->get_difference();
+       if( now >= draw_flash ) return 1;
+       draw(next);
+       if( !next->seq_no ) {
+               next->cycle_start = now;
+               if( next->playing_audio > 0 )
+                       next->start_audio();
+       }
+       int64_t ref_no = (now - next->cycle_start) / 1000. * refresh_rate;
+       int count = ref_no - next->seq_no;
+       if( count < 1 ) count = 1;
+       ref_no = next->seq_no + count;
+       next->age =  next->cycle_start + 1000. * ref_no / refresh_rate;
+       if( !next->set_seq_no(ref_no) )
+               next->age = now + 1000.;
+       return 0;
+}
+
 void VIconThread::
 run()
 {
@@ -343,35 +371,25 @@ run()
                wdw->lock_window("BC_WindowBase::run 1");
                drawing_started();
                reset_images();
-               int64_t seq_no = 0, now = 0;
-               int64_t draw_flash = 1000 / refresh_rate;
+               draw_flash = 1000 / refresh_rate;
+               seq_no = 0;  now = 0;
                while( !interrupted ) {
                        if( viewing != vicon )
                                update_view();
-                       VIcon *next = low_vicon();
-                       while( next && next->age < draw_flash ) {
-                               now = timer->get_difference();
-                               if( now >= draw_flash ) break;
-                               draw(next);
-                               if( !next->seq_no ) {
-                                       next->cycle_start = now;
-                                       if( next->playing_audio > 0 )
-                                               next->start_audio();
+                       if( !solo ) {
+                               VIcon *next = low_vicon();
+                               while( next && next->age < draw_flash ) {
+                                       if( show_vicon(next) ) break;
+                                       add_vicon(next);
+                                       next = low_vicon();
                                }
-                               int64_t ref_no = (now - next->cycle_start) / 1000. * refresh_rate;
-                               int count = ref_no - next->seq_no;
-                               if( count < 1 ) count = 1;
-                               ref_no = next->seq_no + count;
-                               next->age =  next->cycle_start + 1000. * ref_no / refresh_rate;
-                               if( !next->set_seq_no(ref_no) )
-                                       next->age = now + 1000.;
+                               if( !next ) break;
                                add_vicon(next);
-                               next = low_vicon();
+                               if( draw_flash < now+1 )
+                                       draw_flash = now+1;
                        }
-                       if( !next ) break;
-                       add_vicon(next);
-                       if( draw_flash < now+1 )
-                               draw_flash = now+1;
+                       else
+                               show_vicon(solo);
                        wdw->unlock_window();
                        while( !interrupted ) {
                                now = timer->get_difference();
index 544e1f963031db6e20b85a0a105547821e82569c..69cdb3629034927ba269a3c366c6e839874fa16e 100644 (file)
@@ -76,13 +76,16 @@ public:
        Timer *timer;
        Condition *draw_lock;
        ViewPopup *view_win;
-       VIcon *viewing, *vicon;
+       VIcon *viewing, *vicon, *solo;
        int vw, vh, view_w, view_h;
        int draw_x0, draw_y0;
        int draw_x1, draw_y1;
        int img_dirty, win_dirty;
        double refresh_rate;
+       int64_t now;
+       int64_t draw_flash;
        int64_t stop_age;
+       int64_t seq_no;
 
        ArrayList<VIcon *>t_heap;
        VIcon *low_vicon();
@@ -91,7 +94,7 @@ public:
        void run();
        void flash();
        int draw(VIcon *vicon);
-       int update_view();
+       int update_view(int do_audio=1);
        void draw_images();
        void start_drawing();
        void stop_drawing();
@@ -105,6 +108,7 @@ public:
        int zoom_scale(int dir);
        void close_view_popup();
        void hide_vicons(int v=1);
+       int show_vicon(VIcon *next);
        virtual ViewPopup *new_view_window();
 
        virtual bool visible(VIcon *vicon, int x, int y);