"This program is free software; you can redistribute it and/or modify it under the terms\n"
"of the GNU General Public License as published by the Free Software Foundation; either version\n"
"2 of the License, or (at your option) any later version.\n"
-"\n"
+" This software uses libraries from the FFmpeg project under the LGPLv2.1.\n"
"This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;\n"
"without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n"
"PURPOSE. See the GNU General Public License for more details.\n"));
#include "edl.h"
#include "edlsession.h"
#include "file.h"
+#include "filesystem.h"
#include "filexml.h"
#include "language.h"
#include "loadfile.h"
preferences->snapshot_path, _("snap"),
1900+tm.tm_year,1+tm.tm_mon,tm.tm_mday,
tm.tm_hour,tm.tm_min,tm.tm_sec, exts[mode]);
+ char *asset_path = FileSystem::basepath(filename);
+ Asset *asset = new Asset(asset_path);
+ delete [] asset_path;
+
int fw = edl->get_w(), fh = edl->get_h();
int fcolor_model = edl->session->color_model;
- Asset *asset = new Asset(filename);
switch( mode ) {
case SNAPSHOT_PNG:
asset->format = FILE_PNG;
preferences->snapshot_path, _("grab"),
1900+tm.tm_year,1+tm.tm_mon,tm.tm_mday,
tm.tm_hour,tm.tm_min,tm.tm_sec, exts[mode]);
-
- Asset *asset = new Asset(filename);
+ char *asset_path = FileSystem::basepath(filename);
+ Asset *asset = new Asset(asset_path);
+ delete [] asset_path;
switch( mode ) {
case GRABSHOT_PNG:
asset->format = FILE_PNG;
else
create_defaults_path(path, CONFIG_FILE);
+ delete defaults;
defaults = new BC_Hash(path);
defaults->load();
}
void MWindow::init_plugin_tips(ArrayList<PluginServer*> &plugins, const char *lang)
{
- const char *cfg_path = File::get_cindat_path();
+ const char *dat_path = File::get_cindat_path();
char msg_path[BCTEXTLEN];
FILE *fp = 0;
if( BC_Resources::language[0] ) {
snprintf(msg_path, sizeof(msg_path), "%s/info/plugins.%s",
- cfg_path, lang);
+ dat_path, lang);
fp = fopen(msg_path, "r");
}
if( !fp ) {
snprintf(msg_path, sizeof(msg_path), "%s/info/plugins.txt",
- cfg_path);
+ dat_path);
fp = fopen(msg_path, "r");
}
if( !fp ) return;
*
*/
+#include "browsebutton.h"
#include "clip.h"
#include "cplayback.h"
#include "cwindow.h"
#include "bchash.h"
#include "edl.h"
#include "edlsession.h"
+#include "filesystem.h"
#include "filexml.h"
#include "interlacemodes.h"
#include "language.h"
#include "levelwindow.h"
+#include "mainerror.h"
#include "mainundo.h"
#include "mainmenu.h"
#include "mutex.h"
#define WIDTH 640
-#define HEIGHT 425
+// full height
+#define HEIGHT0 585
+// add tracks dialog
+#define HEIGHT1 240
+// offset for folder panel
+#define HEIGHT2 440
New::New(MWindow *mwindow)
{
this->mwindow = mwindow;
- script = 0;
new_edl = 0;
thread = 0;
}
}
}
mwindow->undo->update_undo_before();
- mwindow->set_filename("");
+ mwindow->set_filename(new_edl->path);
ArrayList<EDL *>new_edls;
new_edls.append(new_edl);
mwindow->paste_edls(&new_edls, load_mode, 0,0,0,0,0,0);
return nwindow;
}
+void NewThread::handle_done_event(int result)
+{
+ if( !result ) {
+ const char *project_folder = nwindow->folder->get_text();
+ const char *project_name = nwindow->name->get_text();
+ if( project_folder[0] && project_name[0] ) {
+ nwindow->recent_folder->add_item("PROJECT", project_folder);
+ char project_path[BCTEXTLEN], *ep = project_path + sizeof(project_path);
+ FileSystem fs; fs.join_names(project_path, project_folder, project_name);
+ char *bp = strrchr(project_path, '/');
+ if( !bp ) bp = project_path;
+ bp = strrchr(bp, '.');
+ if( !bp ) bp = project_path + strlen(project_path);
+ if( strcasecmp(bp,".xml") ) snprintf(bp, ep-bp, ".xml");
+ fs.complete_path(project_path);
+ EDL *new_edl = new_project->new_edl;
+ bp = FileSystem::basepath(project_path);
+ strcpy(new_edl->path, bp); delete [] bp;
+ }
+ }
+}
+
void NewThread::handle_close_event(int result)
{
if( !new_project->new_edl ) return;
- new_project->new_edl->save_defaults(mwindow->defaults);
- mwindow->defaults->save();
- if( result ) {
-// Aborted
- if( !new_project->new_edl->Garbage::remove_user() )
- new_project->new_edl = 0;
+ FileSystem fs;
+ char *path = new_project->new_edl->path;
+ char *bp = path;
+ while( !result ) {
+ while( *bp == '/' ) ++bp;
+ if( !(bp = strchr(bp, '/')) ) break;
+ char dir_path[BCTEXTLEN];
+ int len = bp - path;
+ strncpy(dir_path, path, len);
+ dir_path[len] = 0;
+ if( fs.is_dir(dir_path) ) continue;
+ if( fs.create_dir(dir_path) ) {
+ eprintf(_("Cannot create and access project path:\n%s"),
+ dir_path);
+ result = 1;
+ }
}
- else {
+
+ if( !result ) {
+ new_project->new_edl->save_defaults(mwindow->defaults);
+ mwindow->defaults->save();
new_project->create_new_project(load_mode);
}
+ else { // Aborted
+ new_project->new_edl->Garbage::remove_user();
+ new_project->new_edl = 0;
+ }
}
int NewThread::load_defaults()
NewWindow::NewWindow(MWindow *mwindow, NewThread *new_thread, int x, int y)
: BC_Window(new_thread->title, x, y,
- WIDTH, new_thread->load_mode == LOADMODE_REPLACE ? HEIGHT : HEIGHT-180,
+ WIDTH, new_thread->load_mode == LOADMODE_REPLACE ? HEIGHT0 : HEIGHT1,
-1, -1, 0, 0, 1)
{
this->mwindow = mwindow;
aspect_h_text = 0;
interlace_pulldown = 0;
color_model = 0;
+ folder = 0;
+ name = 0;
+ recent_folder = 0;
}
NewWindow::~NewWindow()
{
int x = 10, y = 10, x1, y1;
BC_TextBox *textbox;
+ BC_Title *title;
lock_window("NewWindow::create_objects");
mwindow->theme->draw_new_bg(this);
y += aspect_w_text->get_h() + 5;
add_subwindow(new NewAspectAuto(this, x1, y));
y += 40;
- BC_Title *title;
add_subwindow(title = new BC_Title(x, y, _("Color model:")));
x1 = x + title->get_w();
y1 = y; y += title->get_h() + 10;
textbox, &new_edl->session->interlace_mode,
(ArrayList<BC_ListBoxItem*>*)&mwindow->interlace_project_modes,
x1+textbox->get_w(), y2));
+
+ x = 20; y = HEIGHT2;
+ add_subwindow(title = new BC_Title(x, y, _("Create project folder in:")));
+ x1 = x; y += title->get_h() + 5;
+ add_subwindow(folder = new BC_TextBox(x1, y, get_w()-x1-64, 1, ""));
+ x1 += folder->get_w() + 10;
+ add_subwindow(recent_folder = new BC_RecentList("FOLDER", mwindow->defaults, folder));
+ recent_folder->load_items("PROJECT");
+ x1 = recent_folder->get_x() + recent_folder->get_w();
+ add_subwindow(new BrowseButton(mwindow->theme, this, folder, x1, y, "",
+ _("Project Directory"), _("Project Directory Path:"), 1));
+ y += folder->get_h() + 10; x1 = x;
+ add_subwindow(title = new BC_Title(x1, y, _("Project Name:")));
+ x1 += title->get_w() + 10;
+ add_subwindow(name = new BC_TextBox(x1, y, get_w()-x1-64, 1, ""));
}
add_subwindow(new BC_OKButton(this,
virtual void create_objects() = 0;
int handle_event();
- int run_script(FileXML *script);
int create_new_project(int load_mode);
void create_new_edl();
MWindow *mwindow;
NewThread *thread;
EDL *new_edl;
-
-private:
- FileXML *script;
};
class NewProject : public BC_MenuItem, public New
~NewThread();
BC_Window* new_gui();
+ void handle_done_event(int result);
void handle_close_event(int result);
int load_defaults();
BC_TextBox *frame_rate;
BC_TextBox *aspect_w_text, *aspect_h_text;
BC_TextBox *output_w_text, *output_h_text;
+ BC_TextBox *folder, *name;
+ BC_RecentList *recent_folder;
InterlacemodePulldown *interlace_pulldown;
ColormodelPulldown *color_model;
NewPresets *format_presets;
mwindow->restart_brender();
mwindow->gui->lock_window("ProxyDialog::to_proxy");
- mwindow->update_project(LOAD_ALL);
+ mwindow->update_project(LOADMODE_REPLACE);
mwindow->gui->unlock_window();
}
//printf("RenderEngine::run 4.1 %d\n", playback_engine->tracking_position);
if(!interrupted)
{
- if(do_audio)
- playback_engine->tracking_position =
- (double)arender->current_position /
- command->get_edl()->session->sample_rate;
- else
- if(do_video)
- {
- playback_engine->tracking_position =
- (double)vrender->current_position /
- command->get_edl()->session->frame_rate;
- }
+ playback_engine->tracking_position =
+ command->get_direction() == PLAY_FORWARD ?
+ command->end_position : command->start_position;
}
if( playback_engine->is_playing_back && command->displacement ) {
items.remove_all_objects();
}
-int BC_RecentList::handle_event() {
+int BC_RecentList::handle_event()
+{
BC_ListBoxItem *item = get_selection(0, 0);
if( !item ) return 0;
char *text = item->get_text();
}
-int BC_RecentList::load_items(const char *prefix) {
+int BC_RecentList::load_items(const char *prefix)
+{
if (! prefix) prefix = "ANY";
}
-int BC_RecentList::add_item(const char *prefix, char *text) {
+int BC_RecentList::add_item(const char *prefix, const char *text)
+{
if (! prefix) prefix = "ANY";
return count;
}
+
int handle_event();
int load_items(const char *prefix = NULL);
- int add_item(const char *prefix, char *text);
+ int add_item(const char *prefix, const char *text);
ArrayList<BC_ListBoxItem*> items;
private:
#endif
}
-void write_ppm(uint8_t *tp, int w, int h, const char *fmt, ...);
+#ifdef HAVE_GL
+static void write_ppm(uint8_t *tp, int w, int h, const char *fmt, ...)
+{
+ va_list ap; va_start(ap, fmt);
+ char fn[256]; vsnprintf(fn, sizeof(fn), fmt, ap);
+ va_end(ap);
+ FILE *fp = !strcmp(fn,"-") ? stdout : fopen(fn,"w");
+ if( fp ) {
+ fprintf(fp,"P6\n%d %d\n255\n",w,h);
+ fwrite(tp,3*w,h,fp);
+ if( fp != stdout ) fclose(fp);
+ }
+}
+#endif
void BC_Texture::write_tex(const char *fn)
{
char new_dir[BCTEXTLEN];
strcpy(new_dir, new_dir_);
complete_path(new_dir);
-
- mkdir(new_dir, S_IREAD | S_IWRITE | S_IEXEC);
- return 0;
+ return mkdir(new_dir, S_IRWXU | S_IRWXG | S_IRWXO);
}
int FileSystem::parse_tildas(char *new_dir)
if( fp ) {
fprintf(fp,"P6\n%d %d\n255\n",w,h);
fwrite(tp,3*w,h,fp);
- if( fp != sdtout ) fclose(fp);
+ if( fp != stdout ) fclose(fp);
}
}
Cinfinity icons selected in Preferences (Creative Common
By https://creativecommons.org/licenses/by/3.0/)
.
+April 2018 New Features of note:
+ FFmpeg has been updated to V 4.0. Libx265 to 2.7.
+ OpenCV FindObj updated and StyleObj, PuzzleObj added.
+ Shortcuts F11-F12 in compositor / b for load backup.
+ Drag widget designed/added for future versatility.
+.
March 2018 New Features of note:
Audio now is associated when in the Proxy folder.
Perpetual Session preference and 1 extra backup.
double v = atan2(vy, vx);
double h = atan2(hy, hx);
r = (h + v - pi/2) / 2;
+ if( config.mode != MODE_QUADRILATERAL ) r = -r;
}
// diagonal length
double a = dist(x1,y1, x3,y3) / 2;