#include "awindow.h"
#include "awindowgui.h"
#include "bccmodels.h"
-#include "bcsignals.h"
#include "bchash.h"
+#include "bcsignals.h"
+#include "bctimer.h"
#include "binfolder.h"
#include "cache.h"
#include "cstrdup.h"
if( !temp )
temp = new VFrame(0, -1, asset->width, asset->height, BC_RGB888, -1);
File *file = mwindow->video_cache->check_out(asset, mwindow->edl, 1);
+ if( !file ) { broken = 1; return 0; }
+ Timer timer;
while( file && seq_no >= images.size() && !avt->interrupted ) {
int64_t pos = images.size() / picon->gui->vicon_thread->refresh_rate * frame_rate;
file->set_video_position(pos,0);
if( file->read_frame(temp) ) temp->clear_frame();
add_image(temp, vw, vh, vicon_cmodel);
mwindow->video_cache->check_in(asset);
+ if( timer.get_difference() > 500 ) return 0;
Thread::yield();
- file = 0;
- for( int retries=1000; !file && --retries>=0; usleep(10000) ) {
+ file = mwindow->video_cache->check_out(asset, mwindow->edl, 0);
+ for( int retries=10; !file && --retries>=0; usleep(1000) ) {
if( avt->interrupted ) return 0;
file = mwindow->video_cache->check_out(asset, mwindow->edl, 0);
}
+ if( !file ) return 0;
}
- if( !file ) { broken = 1; return 0; }
mwindow->video_cache->check_in(asset);
}
if( seq_no >= images.size() ) return 0;
return av_popup;
}
-void AssetVIconThread::close_view_popup()
+void AssetVIconThread::stop_vicon_drawing(int wait)
{
stop_drawing();
- drawing_started(); // waits for draw lock
- drawing_stopped();
+ if( wait ) {
+ drawing_started(); // waits for draw lock
+ drawing_stopped();
+ }
}
return 1;
}
-int AWindowGUI::stop_vicon_drawing()
+int AWindowGUI::stop_vicon_drawing(int wait)
{
- if( !vicon_thread->interrupted )
- vicon_thread->stop_drawing();
+ vicon_thread->stop_vicon_drawing(wait);
return 0;
}
-void AWindowGUI::close_view_popup()
-{
- vicon_thread->close_view_popup();
-}
VFrame *AssetPicon::get_vicon_frame()
{
void set_view_popup(AssetVIcon *v, int draw_mode);
void set_view_popup(AssetVIcon *v);
ViewPopup *new_view_window(ViewPopup *popup);
+ void stop_vicon_drawing(int wait=0);
void drawing_started();
void drawing_stopped();
- void close_view_popup();
AWindowGUI *gui;
int draw_mode;
int save_defaults(BC_Hash *defaults);
int load_defaults(BC_Hash *defaults);
int start_vicon_drawing();
- int stop_vicon_drawing();
- void close_view_popup();
+ int stop_vicon_drawing(int wait=0);
void update_picon(Indexable *indexable);
int cycle_assetlist_format();
void hide_tip_info();
return 1;
}
+const char *EditPanelGangTracks::gang_tips[TOTAL_GANGS] = {
+ N_("Currently: Gang None\n Click to: Gang Channels"),
+ N_("Currently: Gang Channels\n Click to: Gang Media"),
+ N_("Currently: Gang Media\n Click to: Gang None"),
+};
+
EditPanelGangTracks::EditPanelGangTracks(MWindow *mwindow, EditPanel *panel,
int x, int y)
: BC_Button(x, y, get_images(mwindow))
{
this->mwindow = mwindow;
this->panel = panel;
- set_tooltip(_("Gang Tracks"));
+ int gang = mwindow->edl->session->gang_tracks;
+ set_tooltip(_(gang_tips[gang]));
}
EditPanelGangTracks::~EditPanelGangTracks()
{
set_images(gang_images[gang]);
draw_face();
+ set_tooltip(_(gang_tips[gang]));
}
int EditPanelGangTracks::handle_event()
class EditPanelGangTracks : public BC_Button
{
static VFrame **gang_images[TOTAL_GANGS];
+ static const char *gang_tips[TOTAL_GANGS];
public:
EditPanelGangTracks(MWindow *mwindow, EditPanel *panel, int x, int y);
~EditPanelGangTracks();
#define MIN_ZOOM_TIME 1
#define MAX_ZOOM_TIME 0x100000
#define DEFAULT_ZOOM_TIME 1024
+#define DEFAULT_ZOOM_TRACK 64
#define MIN_AMP_ZOOM 8
#define MAX_AMP_ZOOM 8192
#define MIN_TRACK_ZOOM 8
// track_start = defaults->get("TRACK_START", 0);
// view_start = defaults->get("VIEW_START", 0);
zoom_sample = defaults->get("ZOOM_SAMPLE", DEFAULT_ZOOM_TIME);
- zoom_y = defaults->get("ZOOMY", 64);
+ zoom_y = defaults->get("ZOOMY", DEFAULT_ZOOM_TRACK);
int64_t zoom_track = defaults->get("ZOOM_TRACK", 0);
- if( zoom_track == 0 ) zoom_track = 64;
+ if( zoom_track == 0 ) zoom_track = DEFAULT_ZOOM_TRACK;
zoom_atrack = defaults->get("ZOOM_ATRACK", zoom_track);
zoom_vtrack = defaults->get("ZOOM_VTRACK", zoom_track);
red = defaults->get("RED", 0.0);
void MWindow::reset_caches()
{
- awindow->gui->stop_vicon_drawing();
+ int locked = gui->get_window_lock();
+ if( locked ) gui->unlock_window();
+ awindow->gui->stop_vicon_drawing(1);
frame_cache->remove_all();
wave_cache->remove_all();
audio_cache->remove_all();
if( vwindow->playback_engine->video_cache )
vwindow->playback_engine->video_cache->remove_all();
}
+ if( locked ) gui->lock_window("MWindow::reset_caches");
}
void MWindow::remove_from_caches(Indexable *idxbl)
{
- awindow->gui->stop_vicon_drawing();
+ awindow->gui->stop_vicon_drawing(1);
frame_cache->remove_item(idxbl);
wave_cache->remove_item(idxbl);
if( gui->render_engine &&
void MWindow::remove_assets_from_project(int push_undo, int redraw, int delete_indexes,
ArrayList<Indexable*> *drag_assets, ArrayList<EDL*> *drag_clips)
{
- awindow->gui->stop_vicon_drawing();
+ awindow->gui->stop_vicon_drawing(1);
// Remove from VWindow.
if( drag_clips ) {
//printf("MWindowGUI::resize_event %d\n", __LINE__);
mwindow->session->mwindow_w = w;
mwindow->session->mwindow_h = h;
- int x1 = get_w() - MainShBtns::calculate_w(-1, 0, -1) - xS(5);
+ int x1 = w - MainShBtns::calculate_w(-1, 0, -1) - xS(5);
mainshbtns->reposition_window(x1, -1);
int x2 = x1 - mwindow->theme->stack_button_w - xS(5);
stack_button->reposition_window(x2, stack_button->get_y());
void MWindow::zoom_atrack(int64_t zoom)
{
int64_t old_zoom = edl->local_session->zoom_atrack;
-// scale waveforms
- edl->local_session->zoom_y = (int64_t)((float)edl->local_session->zoom_y *
- zoom / old_zoom);
- CLAMP(edl->local_session->zoom_y, MIN_AMP_ZOOM, MAX_AMP_ZOOM);
+ CLAMP(zoom, MIN_TRACK_ZOOM, MAX_TRACK_ZOOM);
+ edl->local_session->zoom_atrack = zoom;
-// scale tracks
edl->local_session->zoom_atrack = zoom;
for( Track *track= edl->tracks->first; track; track=track->next ) {
if( track->data_type != TRACK_AUDIO ) continue;
- track->data_h = track->data_h * zoom / old_zoom;
- bclamp(track->data_h, MIN_TRACK_ZOOM, MAX_TRACK_ZOOM);
+ track->data_h = zoom;
}
// shift row position
for( int i=0; i<TOTAL_PANES; ++i ) edl->local_session->track_start[i] =
void MWindow::zoom_vtrack(int64_t zoom)
{
int64_t old_zoom = edl->local_session->zoom_vtrack;
-// scale tracks
+ CLAMP(zoom, MIN_TRACK_ZOOM, MAX_TRACK_ZOOM);
edl->local_session->zoom_vtrack = zoom;
+
for( Track *track= edl->tracks->first; track; track=track->next ) {
if( track->data_type != TRACK_VIDEO ) continue;
- track->data_h = track->data_h * zoom / old_zoom;
- bclamp(track->data_h, MIN_TRACK_ZOOM, MAX_TRACK_ZOOM);
+ track->data_h = zoom;
}
// shift row position
for( int i=0; i<TOTAL_PANES; ++i ) edl->local_session->track_start[i] =
{
int ver = -1, ifds[16];
int nfds = open_usb_inputs(0x0bc7, 0x0004, ver, ifds, 16);
- if( !nfds ) return 0;
+ if( nfds <= 0 ) return 0;
printf("detected ATI X10 remote, ver=0x%04x\n", ver);
return new X10TV(mwindow, ifds, nfds);
}
}
int AmpZoomPanel::handle_event()
{
+ if( zoombar->shift_down() )
+ update(DEFAULT_ZOOM_TRACK);
mwindow->zoom_amp((int64_t)get_value());
return 1;
}
}
int ATrackZoomPanel::handle_event()
{
+ if( zoombar->shift_down() )
+ update(DEFAULT_ZOOM_TRACK);
mwindow->zoom_atrack((int64_t)get_value());
zoombar->amp_zoom->update(mwindow->edl->local_session->zoom_y);
return 1;
}
int VTrackZoomPanel::handle_event()
{
+ if( zoombar->shift_down() )
+ update(DEFAULT_ZOOM_TRACK);
mwindow->zoom_vtrack((int64_t)get_value());
return 1;
}
}
+int dump_xerror = -1;
+
int BC_Signals::x_error_handler(Display *display, XErrorEvent *event)
{
char string[1024];
fprintf(stderr, "BC_Signals::x_error_handler: error_code=%d opcode=%d,%d id=0x%jx %s\n",
event->error_code, event->request_code, event->minor_code,
(int64_t)event->resourceid, string);
+ if( dump_xerror < 0 ) {
+ char *env = getenv("BC_TRACE_XERROR");
+ dump_xerror = !env || !atoi(env) ? 0 : 1;
+ }
+ if( dump_xerror )
+ dump_stack();
return 0;
}