if(z_auto) {
float value = z_auto->get_value();
z->update(value);
+ thread->gui->lock_window("CWindowCameraGUI::update");
thread->gui->composite_panel->cpanel_zoom->update(value);
+ thread->gui->unlock_window();
}
if( x_auto && y_auto && z_auto )
if(z_auto) {
float value = z_auto->get_value();
z->update(value);
+ thread->gui->lock_window("CWindowProjectorGUI::update");
thread->gui->composite_panel->cpanel_zoom->update(value);
+ thread->gui->unlock_window();
}
if( x_auto && y_auto && z_auto )
#include "edl.h"
#include "edlsession.h"
#include "file.h"
+#include "keys.h"
#include "language.h"
#include "localsession.h"
#include "mainerror.h"
add_item(new EditMoveTrackDown(mwindow, this));
add_item(new EditPopupDeleteTrack(mwindow, this));
add_item(new EditPopupAddTrack(mwindow, this));
-// add_item(new EditPopupTitle(mwindow, this));
+ add_item(new EditPopupFindAsset(mwindow, this));
+ add_item(new EditPopupTitle(mwindow, this));
resize_option = 0;
matchsize_option = 0;
}
}
-
-
-
-
-
-
-
EditAttachEffect::EditAttachEffect(MWindow *mwindow, EditPopup *popup)
: BC_MenuItem(_("Attach effect..."))
{
return 1;
}
+EditPopupFindAsset::EditPopupFindAsset(MWindow *mwindow, EditPopup *popup)
+ : BC_MenuItem(_("Find in Resources"))
+{
+ this->mwindow = mwindow;
+ this->popup = popup;
+}
+
+int EditPopupFindAsset::handle_event()
+{
+ Edit *edit = popup->edit;
+ if( edit ) {
+ Indexable *idxbl = (Indexable *)edit->asset;
+ if( !idxbl ) idxbl = (Indexable *)edit->nested_edl;
+ if( idxbl ) {
+ AWindowGUI *agui = mwindow->awindow->gui;
+ agui->lock_window("EditPopupFindAsset::handle_event");
+ AssetPicon *picon = 0;
+ for( int i=0, n=agui->assets.size(); i<n; ++i ) {
+ AssetPicon *ap = (AssetPicon *)agui->assets[i];
+ int found = ap->indexable && ( idxbl == ap->indexable ||
+ !strcmp(idxbl->path, ap->indexable->path) );
+ if( found && !picon ) picon = ap;
+ ap->set_selected(found);
+ }
+ if( picon ) {
+ int selected_folder = picon->indexable->awindow_folder;
+ mwindow->edl->session->awindow_folder = selected_folder;
+ for( int i=0,n=agui->folders.size(); i<n; ++i ) {
+ AssetPicon *folder_item = (AssetPicon *)agui->folders[i];
+ int selected = folder_item->foldernum == selected_folder ? 1 : 0;
+ folder_item->set_selected(selected);
+ }
+ }
+ agui->unlock_window();
+ agui->async_update_assets();
+ }
+ }
+ return 1;
+}
+
EditPopupTitle::EditPopupTitle(MWindow *mwindow, EditPopup *popup)
: BC_MenuItem(_("User title..."))
EditPopupTitle::~EditPopupTitle()
{
- delete popup;
}
int EditPopupTitle::handle_event()
{
int result;
-
- Track *trc = mwindow->session->track_highlighted;
-
- if (trc && trc->record)
- {
- Edit *edt = mwindow->session->edit_highlighted;
- if(!edt) return 1;
-
+ if( popup->edit ) {
window = new EditPopupTitleWindow (mwindow, popup);
window->create_objects();
result = window->run_window();
-
-
- if(!result && edt)
- {
- strcpy(edt->user_title, window->title_text->get_text());
+ if( !result && popup->edit ) {
+ strcpy(popup->edit->user_title, window->title_text->get_text());
+ mwindow->gui->draw_canvas(1, 0);
+ mwindow->gui->flash_canvas(1);
}
-
- delete window;
- window = 0;
+ delete window; window = 0;
}
return 1;
: BC_Window (_(PROGRAM_NAME ": Set edit title"),
mwindow->gui->get_abs_cursor_x(0) - 400 / 2,
mwindow->gui->get_abs_cursor_y(0) - 500 / 2,
- 300,
- 100,
- 300,
- 100,
- 0,
- 0,
- 1)
+ 300, 130, 300, 130, 0, 0, 1)
{
this->mwindow = mwindow;
this->popup = popup;
- this->edt = this->mwindow->session->edit_highlighted;
- if(this->edt)
- {
- strcpy(new_text, this->edt->user_title);
+ if( popup->edit ) {
+ strcpy(new_text, popup->edit->user_title);
}
}
void EditPopupTitleWindow::create_objects()
{
lock_window("EditPopupTitleWindow::create_objects");
- int x = 5;
+ int x = 10;
int y = 10;
-
- add_subwindow (new BC_Title (x, y, _("User title")));
- add_subwindow (title_text = new EditPopupTitleText (this,
- mwindow, x, y + 20));
+ add_subwindow (new BC_Title (x, y, _("User title:")));
+ title_text = new EditPopupTitleText (this, mwindow, x+15, y+20,
+ popup->edit ? popup->edit->user_title : "");
+ add_subwindow(title_text);
add_tool(new BC_OKButton(this));
add_tool(new BC_CancelButton(this));
EditPopupTitleText::EditPopupTitleText (EditPopupTitleWindow *window,
- MWindow *mwindow, int x, int y)
- : BC_TextBox(x, y, 250, 1, (char*)(window->edt ? window->edt->user_title : ""))
+ MWindow *mwindow, int x, int y, const char *text)
+ : BC_TextBox(x, y, 250, 1, text)
{
this->window = window;
this->mwindow = mwindow;
int EditPopupTitleText::handle_event()
{
+ if( get_keypress() == RETURN )
+ window->set_done(0);
return 1;
}
EditPopup *popup;
};
+class EditPopupFindAsset : public BC_MenuItem
+{
+public:
+ EditPopupFindAsset(MWindow *mwindow, EditPopup *popup);
+ int handle_event();
+ MWindow *mwindow;
+ EditPopup *popup;
+};
+
class EditAttachEffect : public BC_MenuItem
{
{
public:
EditPopupTitleText (EditPopupTitleWindow *window,
- MWindow *mwindow, int x, int y);
+ MWindow *mwindow, int x, int y, const char *text);
~EditPopupTitleText();
int handle_event();
int close_event();
EditPopupTitleText *title_text;
- Edit *edt;
MWindow *mwindow;
EditPopup *popup;
char new_text[BCTEXTLEN];
}
}
+double EDL::get_cursor_position(int cursor_x, int pane_no)
+{
+ return (double)cursor_x * local_session->zoom_sample / session->sample_rate +
+ (double)local_session->view_start[pane_no] *
+ local_session->zoom_sample / session->sample_rate;
+}
+
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
+ double get_cursor_position(int cursor_x, int pane_no);
// increase track w/h to at least session w/h
void retrack();
{
unlock_window();
delete color_thread;
- color_thread = new GWindowColorThread(color_button);
+ color_thread = new GWindowColorThread(this, color_button);
int color = auto_colors[color_button->auto_toggle->info->ref];
color_thread->start(color);
lock_window("GWindowGUI::start_color_thread");
draw_face();
}
-GWindowColorThread::GWindowColorThread(GWindowColorButton *color_button)
+GWindowColorThread::GWindowColorThread(GWindowGUI *gui, GWindowColorButton *color_button)
: ColorPicker(0, color_button->auto_toggle->caption)
{
- this->color = 0;
+ this->gui = gui;
this->color_button = color_button;
+ this->color = 0;
color_update = new GWindowColorUpdate(this);
}
void GWindowColorThread::handle_done_event(int result)
{
color_update->stop();
- GWindowGUI *gui = color_button->auto_toggle->gui;
int ref = color_button->auto_toggle->info->ref;
gui->lock_window("GWindowColorThread::handle_done_event");
if( !result ) {
color_button->update_gui(color);
}
gui->unlock_window();
- MWindowGUI *mwindow_gui = color_button->auto_toggle->gui->mwindow->gui;
+ MWindowGUI *mwindow_gui = gui->mwindow->gui;
mwindow_gui->lock_window("GWindowColorUpdate::run");
mwindow_gui->draw_overlays(1);
mwindow_gui->unlock_window();
void GWindowColorThread::update_gui()
{
+ gui->lock_window("GWindowColorThread::update_gui");
color_button->update_gui(color);
+ gui->unlock_window();
}
GWindowColorUpdate::GWindowColorUpdate(GWindowColorThread *color_thread)
}
const char *label = _(tp->isauto ? auto_text[tp->ref] : other_text[tp->ref]);
int color = !tp->isauto ? -1 : auto_colors[tp->ref];
- GWindowToggle *toggle = new GWindowToggle(mwindow, this, x, y, label, color, tp);
+ GWindowToggle *toggle = new GWindowToggle(this, x, y, label, color, tp);
add_tool(toggles[i] = toggle);
if( vframe )
draw_vframe(vframe, get_w()-vframe->get_w()-10, y);
}
-GWindowToggle::GWindowToggle(MWindow *mwindow, GWindowGUI *gui, int x, int y,
+GWindowToggle::GWindowToggle(GWindowGUI *gui, int x, int y,
const char *text, int color, toggleinfo *info)
- : BC_CheckBox(x, y, *get_main_value(mwindow, info), text, MEDIUMFONT, color)
+ : BC_CheckBox(x, y, *get_main_value(gui->mwindow, info), text, MEDIUMFONT, color)
{
- this->mwindow = mwindow;
this->gui = gui;
this->info = info;
this->color = color;
int GWindowToggle::handle_event()
{
int value = get_value();
- *get_main_value(mwindow, info) = value;
+ *get_main_value(gui->mwindow, info) = value;
gui->update_mwindow();
// Update stuff in MWindow
unlock_window();
+ MWindow *mwindow = gui->mwindow;
mwindow->gui->lock_window("GWindowToggle::handle_event");
if( info->isauto ) {
int autogroup_type = -1;
void GWindowToggle::update()
{
- int *vp = get_main_value(mwindow, info);
+ int *vp = get_main_value(gui->mwindow, info);
if( !vp ) return;
set_value(*vp);
}
class GWindowToggle : public BC_CheckBox
{
public:
- GWindowToggle(MWindow *mwindow, GWindowGUI *gui, int x, int y,
+ GWindowToggle(GWindowGUI *gui, int x, int y,
const char *text, int color, toggleinfo *info);
~GWindowToggle();
static int* get_main_value(MWindow *mwindow, toggleinfo *info);
int color;
- MWindow *mwindow;
- GWindowGUI *gui;
toggleinfo *info;
+ GWindowGUI *gui;
GWindowColorButton *color_button;
};
class GWindowColorThread : public ColorPicker
{
public:
- GWindowColorThread(GWindowColorButton *color_button);
+ GWindowColorThread(GWindowGUI *gui, GWindowColorButton *color_button);
~GWindowColorThread();
void start(int color);
int handle_new_color(int color, int alpha);
void update_gui();
void handle_done_event(int result);
+ GWindowGUI *gui;
int color;
GWindowColorButton *color_button;
GWindowColorUpdate *color_update;
void ShBtnTextDialog::handle_close_event(int result)
{
if( !result ) {
+ sb_window->lock_window("ShBtnTextDialog::handle_close_event");
sb_window->list_update();
+ sb_window->unlock_window();
}
st_window = 0;
}
return -1;
}
-
void TrackCanvas::draw(int mode, int hide_cursor)
{
const int debug = 0;
int64_t track_x, track_y, track_w, track_h;
track_dimensions(track, track_x, track_y, track_w, track_h);
- if(button_press && get_buttonpress() == RIGHT_BUTTON &&
- cursor_y >= track_y && cursor_y < track_y + track_h) {
- gui->edit_menu->update(track, 0);
+ if( button_press && get_buttonpress() == RIGHT_BUTTON &&
+ cursor_y >= track_y && cursor_y < track_y + track_h) {
+ double pos = (double)cursor_x * mwindow->edl->local_session->zoom_sample /
+ mwindow->edl->session->sample_rate +
+ (double)mwindow->edl->local_session->view_start[pane->number] *
+ mwindow->edl->local_session->zoom_sample /
+ mwindow->edl->session->sample_rate;
+ int64_t position = track->to_units(pos, 0);
+ gui->edit_menu->update(track, track->edits->editof(position, PLAY_FORWARD, 0));
gui->edit_menu->activate_menu();
result = 1;
}
mwindow->session->trim_edits = 0;
if(is_event_win() && cursor_inside()) {
-// double position = (double)cursor_x *
-// mwindow->edl->local_session->zoom_sample /
-// mwindow->edl->session->sample_rate +
-// (double)mwindow->edl->local_session->view_start[pane->number] *
-// mwindow->edl->local_session->zoom_sample /
-// mwindow->edl->session->sample_rate;
+// double position = mwindow->edl->get_cursor_position(cursor_x, pane->number);
result = 1;
if(!active) {
// Test handles only and select a region
case EDITING_IBEAM: {
- double position = (double)cursor_x *
- mwindow->edl->local_session->zoom_sample /
- mwindow->edl->session->sample_rate +
- (double)mwindow->edl->local_session->view_start[pane->number] *
- mwindow->edl->local_session->zoom_sample /
- mwindow->edl->session->sample_rate;
+ double position = mwindow->edl->get_cursor_position(cursor_x, pane->number);
//printf("TrackCanvas::button_press_event %d\n", position);
if( do_transitions(cursor_x, cursor_y,
int BC_FileBox::create_tables(int select_all)
{
+ int preload_textbox = select_all;
delete_tables();
char string[BCTEXTLEN];
BC_ListBoxItem *new_item;
// {
if(!is_dir)
{
+ if( preload_textbox ) {
+ preload_textbox = 0;
+ textbox->update(new_item->get_text());
+ }
int64_t size = file_item->size;
if( (size_format == FILEBOX_SIZE_1000 && size >= 1000) ||
(size_format == FILEBOX_SIZE_1024 && size >= 1024) ) {
filebox_history[i].path[0] = 0;
#ifdef HAVE_XFT
+ xftInit(0);
xftInitFtLibrary();
#endif
for( int i=sizeof(xfont)/sizeof(xfont[0]); --i>=0; )
XFreeFont(display, this->*xfont[i]);
-// past bug in X caused XRenderExtensionInfo to be damaged
-// if this is done here. left to be done in XCloseDisplay by Xlib.
-// works in more modern systems, and needed for leak testing.
-#if defined(HAVE_XFT) && defined(VALGRIND)
+#ifdef HAVE_XFT
+// prevents a bug when Xft closes with unrefd fonts
+ FcPattern *defaults = FcPatternCreate();
+ FcPatternAddInteger(defaults, "maxunreffonts", 0);
+ XftDefaultSet(display, defaults);
+
static void *BC_WindowBase::*xft_font[] = {
&BC_WindowBase::smallfont_xft,
&BC_WindowBase::mediumfont_xft,
// not thread safe
static Mutex xft_lock("xft_lock");
+Bool xftInit(const char *config)
+{
+ xft_lock.lock("XftInit");
+ Bool ret = XftInit(config);
+ xft_lock.unlock();
+ return ret;
+}
+
FcBool xftInitFtLibrary(void)
{
xft_lock.lock("xftInitFtLibrary");
return ret;
}
+Bool xftDefaultSet(Display *dpy, FcPattern *defaults)
+{
+ xft_lock.lock("xftDefaultHasRender");
+ Bool ret = XftDefaultSet(dpy, defaults);
+ xft_lock.unlock();
+ return ret;
+}
+
FcBool xftCharExists(Display *dpy, XftFont *pub, FcChar32 ucs4)
{
xft_lock.lock("xftCharExists");
#include <fontconfig/fontconfig.h>
#include <fontconfig/fcfreetype.h>
+Bool xftInit(const char *config);
FcBool xftInitFtLibrary(void);
Bool xftDefaultHasRender(Display *dpy);
+Bool xftDefaultSet(Display *dpy, FcPattern *defaults);
FcBool xftCharExists(Display *dpy, XftFont *pub, FcChar32 ucs4);
void xftTextExtents8(Display *dpy, XftFont *pub,
_Xconst FcChar8 *string, int len, XGlyphInfo *extents);