$(OBJDIR)/pluginvclient.o \
$(OBJDIR)/preferences.o \
$(OBJDIR)/preferencesthread.o \
- $(OBJDIR)/presetsgui.o \
- $(OBJDIR)/presets.o \
$(OBJDIR)/question.o \
$(OBJDIR)/quit.o \
$(OBJDIR)/recconfirmdelete.o \
#include "audiodevice.h"
#include "audioalsa.h"
#include "bcsignals.h"
+#include "language.h"
#include "mutex.h"
#include "playbackconfig.h"
#include "preferences.h"
err = snd_pcm_hw_params_any(dsp, params);
if (err < 0) {
- fprintf(stderr, "AudioALSA::set_params: no PCM configurations available\n");
+ fprintf(stderr, "AudioALSA::set_params: ");
+ fprintf(stderr, _("no PCM configurations available\n"));
return 1;
}
params,
SND_PCM_ACCESS_RW_INTERLEAVED);
if(err) {
- fprintf(stderr, "AudioALSA::set_params: failed to set up "
- "interleaved device access.\n");
+ fprintf(stderr, "AudioALSA::set_params: ");
+ fprintf(stderr, _("failed to set up interleaved device access.\n"));
return 1;
}
params,
translate_format(bits));
if(err) {
- fprintf(stderr, "AudioALSA::set_params: failed to set output format.\n");
+ fprintf(stderr, "AudioALSA::set_params: ");
+ fprintf(stderr, _("failed to set output format.\n"));
return 1;
}
params,
channels);
if(err) {
- fprintf(stderr, "AudioALSA::set_params: Configured ALSA device "
- "does not support %d channel operation.\n",
+ fprintf(stderr, "AudioALSA::set_params: ");
+ fprintf(stderr, _("Configured ALSA device does not support %d channel operation.\n"),
channels);
return 1;
}
(unsigned int*)&samplerate,
(int*)0);
if(err) {
- fprintf(stderr, "AudioALSA::set_params: Configured ALSA device "
- "does not support %u Hz playback.\n",
+ fprintf(stderr, "AudioALSA::set_params: ");
+ fprintf(stderr, _(" Configured ALSA device does not support %u Hz playback.\n"),
(unsigned int)samplerate);
return 1;
}
#include "clip.h"
#include "condition.h"
#include "errno.h"
+#include "language.h"
#include "playbackconfig.h"
#include "preferences.h"
#include "recordconfig.h"
buffer_info = 0x7fff000f;
int ret = 1;
if(ioctl(dsp_in[i], SNDCTL_DSP_SETFRAGMENT, &buffer_info))
- fprintf(stderr, "SNDCTL_DSP_SETFRAGMENT failed.\n");
+ fprintf(stderr, _("%s failed\n"), "SNDCTL_DSP_SETFRAGMENT");
else if(ioctl(dsp_in[i], SNDCTL_DSP_SETFMT, &format) < 0)
- fprintf(stderr, "SNDCTL_DSP_SETFMT failed\n");
+ fprintf(stderr, _("%s failed\n"), "SNDCTL_DSP_SETFMT");
else {
int channels = device->get_ichannels();
if(ioctl(dsp_in[i], SNDCTL_DSP_CHANNELS, &channels) < 0)
- fprintf(stderr, "SNDCTL_DSP_CHANNELS failed\n");
+ fprintf(stderr, _("%s failed\n"), "SNDCTL_DSP_CHANNELS");
else if(ioctl(dsp_in[i], SNDCTL_DSP_SPEED, &device->in_samplerate) < 0)
- fprintf(stderr, "SNDCTL_DSP_SPEED failed\n");
+ fprintf(stderr, _("%s failed\n"), "SNDCTL_DSP_SPEED");
else
ret = 0;
}
AWindowGUI::AWindowGUI(MWindow *mwindow, AWindow *awindow)
- : BC_Window(PROGRAM_NAME ": Resources",
- mwindow->session->awindow_x,
- mwindow->session->awindow_y,
- mwindow->session->awindow_w,
- mwindow->session->awindow_h,
- 100,
- 100,
- 1,
- 1,
- 1)
+ : BC_Window(_(PROGRAM_NAME ": Resources"),
+ mwindow->session->awindow_x, mwindow->session->awindow_y,
+ mwindow->session->awindow_w, mwindow->session->awindow_h,
+ 100, 100, 1, 1, 1)
{
// printf("AWindowGUI::AWindowGUI %d %d %d %d\n",
// mwindow->session->awindow_x,
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));
- add_subwindow(add_tools = new AddTools(mwindow, this, fx, fy, "Visibility"));
+ 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();
SET_TRACE
AWindowRemovePluginGUI::
AWindowRemovePluginGUI(AWindow *awindow, AWindowRemovePlugin *thread,
int x, int y, PluginServer *plugin)
- : BC_Window(PROGRAM_NAME ": Remove plugin", x,y, 500,200, 50, 50, 1, 0, 1, -1, "", 1)
+ : BC_Window(_(PROGRAM_NAME ": Remove plugin"), x,y, 500,200, 50, 50, 1, 0, 1, -1, "", 1)
{
this->awindow = awindow;
this->thread = thread;
void AWindowRemovePlugin::handle_close_event(int result)
{
if( !result ) {
- printf("remove %s\n", plugin->path);
+ printf(_("remove %s\n"), plugin->path);
ArrayList<BC_ListBoxItem*> *folder =
plugin->audio ? plugin->transition ?
&awindow->gui->atransitions :
ChannelEditWindow::ChannelEditWindow(ChannelEditThread *thread,
ChannelPicker *channel_picker)
- : BC_Window(PROGRAM_NAME ": Channels",
+ : BC_Window(_(PROGRAM_NAME ": Channels"),
channel_picker->mwindow->session->channels_x,
channel_picker->mwindow->session->channels_y,
350, 400, 350, 400, 0, 0, 1)
ConfirmScan::ConfirmScan(ChannelEditWindow *gui, int x, int y)
- : BC_Window(PROGRAM_NAME ": Scan confirm",
+ : BC_Window(_(PROGRAM_NAME ": Scan confirm"),
x,
y,
350,
progress = new BC_ProgressBox(
edit->channel_picker->parent_window->get_abs_cursor_x(1),
edit->channel_picker->parent_window->get_abs_cursor_y(1),
- "Scanning",
+ _("Scanning"),
chanlists[edit->scan_params.freqtable].count);
progress->start();
char string[BCTEXTLEN];
sprintf(edit->scan_params.title, "%s",
chanlists[edit->scan_params.freqtable].list[i].name);
- sprintf(string, "Scanning %s", edit->scan_params.title);
+ sprintf(string, _("Scanning %s"), edit->scan_params.title);
progress->update_title(string, 1);
progress->update(i, 1);
edit->channel_picker->set_channel(&edit->scan_params);
ChannelEditEditWindow::ChannelEditEditWindow(ChannelEditEditThread *thread,
ChannelEditWindow *window,
ChannelPicker *channel_picker)
- : BC_Window(PROGRAM_NAME ": Edit Channel",
+ : BC_Window(_(PROGRAM_NAME ": Edit Channel"),
channel_picker->parent_window->get_abs_cursor_x(1),
channel_picker->parent_window->get_abs_cursor_y(1),
390,
ChannelEditPictureWindow::ChannelEditPictureWindow(ChannelEditPictureThread *thread,
ChannelPicker *channel_picker)
- : BC_Window(PROGRAM_NAME ": Picture",
+ : BC_Window(_(PROGRAM_NAME ": Picture"),
channel_picker->mwindow->session->picture_x,
channel_picker->mwindow->session->picture_y,
calculate_w(channel_picker),
!channel_picker->get_controls()))
{
result = BC_Title::calculate_w(channel_picker->parent_window,
- "Device has no picture controls." +
- 2 * widget_border);
+ _("Device has no picture controls.")) +
+ 2 * widget_border;
}
// Only used for Video4Linux 1
{
if(picture_usage->use_brightness)
{
- int new_w = BC_Title::calculate_w(channel_picker->parent_window, "Brightness:") + pad;
+ int new_w = BC_Title::calculate_w(channel_picker->parent_window, _("Brightness:")) + pad;
result = MAX(result, new_w);
}
if(picture_usage->use_contrast)
{
- int new_w = BC_Title::calculate_w(channel_picker->parent_window, "Contrast:") + pad;
+ int new_w = BC_Title::calculate_w(channel_picker->parent_window, _("Contrast:")) + pad;
result = MAX(result, new_w);
}
if(picture_usage->use_color)
{
- int new_w = BC_Title::calculate_w(channel_picker->parent_window, "Color:") + pad;
+ int new_w = BC_Title::calculate_w(channel_picker->parent_window, _("Color:")) + pad;
result = MAX(result, new_w);
}
if(picture_usage->use_hue)
{
- int new_w = BC_Title::calculate_w(channel_picker->parent_window, "Hue:") + pad;
+ int new_w = BC_Title::calculate_w(channel_picker->parent_window, _("Hue:")) + pad;
result = MAX(result, new_w);
}
if(picture_usage->use_whiteness)
{
- int new_w = BC_Title::calculate_w(channel_picker->parent_window, "Whiteness:") + pad;
+ int new_w = BC_Title::calculate_w(channel_picker->parent_window, _("Whiteness:")) + pad;
result = MAX(result, new_w);
}
}
struct tm xtm; localtime_r(&xt,&xtm);
cp += sprintf(cp,"%02d:%02d",xtm.tm_hour, xtm.tm_min);
if( !xtm.tm_hour && !xtm.tm_min ) {
- sprintf(cp,_("(%3.3s) "),&_("sunmontuewedthufrisat")[xtm.tm_wday*3]);
+ sprintf(cp,"(%3.3s) ",&_("sunmontuewedthufrisat")[xtm.tm_wday*3]);
}
}
{ FloatAuto::SMOOTH,
true,
"tan_smooth",
- _("\"smooth\" Curve on current Camera Keyframes")
+ N_("\"smooth\" Curve on current Camera Keyframes")
};
const _CVD Camera_Crv_Linear =
{ FloatAuto::LINEAR,
true,
"tan_linear",
- _("\"linear\" Curve on current Camera Keyframes")
+ N_("\"linear\" Curve on current Camera Keyframes")
};
const _CVD Projector_Crv_Smooth =
{ FloatAuto::SMOOTH,
false,
"tan_smooth",
- _("\"smooth\" Curve on current Projector Keyframes")
+ N_("\"smooth\" Curve on current Projector Keyframes")
};
const _CVD Projector_Crv_Linear =
{ FloatAuto::LINEAR,
false,
"tan_linear",
- _("\"linear\" Curve on current Projector Keyframes")
+ N_("\"linear\" Curve on current Projector Keyframes")
};
-
// Implementation Class für Keyframe Curve Mode buttons
//
// This button reflects the state of the "current" keyframe
{
this->gui = gui;
this->mwindow = mwindow;
- set_tooltip(cfg.tooltip);
+ set_tooltip(_(cfg.tooltip));
}
void CWindowCurveToggle::check_toggle_state(FloatAuto *x, FloatAuto *y, FloatAuto *z)
best_format = cmodel_to_device(color_model);
break;
}
- printf(_("DeviceV4L2Base::v4l2_open "
- " attempting format %4.4s\n"), (char *)&best_format);
+ printf("DeviceV4L2Base::v4l2_open ");
+ printf(_(" attempting format %4.4s\n"),
+ (char *)&best_format);
}
if(driver == VIDEO4LINUX2JPEG && best_format != V4L2_PIX_FMT_MJPEG)
{
- printf(_("DeviceV4L2Base::v4l2_open jpeg driver"
- " and best_format not mjpeg (%4.4s)\n"), (char *)&best_format);
+ printf("DeviceV4L2Base::v4l2_open ");
+ printf(_("jpeg driver and best_format not mjpeg (%4.4s)\n"),
+ (char *)&best_format);
return 1;
}
if(driver == VIDEO4LINUX2MPEG && best_format != V4L2_PIX_FMT_MPEG)
{
- printf(_("DeviceV4L2Base::v4l2_open mpeg driver"
- " and best_format not mpeg (%4.4s)\n"),(char *)&best_format);
+ printf("DeviceV4L2Base::v4l2_open ");
+ printf(_("mpeg driver and best_format not mpeg (%4.4s)\n"),
+ (char *)&best_format);
return 1;
}
if(config_width != best_width || config_height != best_height)
{
- printf(_("DeviceV4L2Base::v4l2_open config geom %dx%d != %dx%d best_geom\n"),
+ printf("DeviceV4L2Base::v4l2_open ");
+ printf(_("config geom %dx%d != %dx%d best_geom\n"),
config_width, config_height, best_width, best_height);
}
cwindow_xscroll = defaults->get("CWINDOW_XSCROLL", 0);
cwindow_yscroll = defaults->get("CWINDOW_YSCROLL", 0);
cwindow_zoom = defaults->get("CWINDOW_ZOOM", (float)1);
- sprintf(default_atransition, "Crossfade");
+ sprintf(default_atransition, _("Crossfade"));
defaults->get("DEFAULT_ATRANSITION", default_atransition);
- sprintf(default_vtransition, "Dissolve");
+ sprintf(default_vtransition, _("Dissolve"));
defaults->get("DEFAULT_VTRANSITION", default_vtransition);
default_transition_length = defaults->get("DEFAULT_TRANSITION_LENGTH", (double)1);
edit_handle_mode[0] = defaults->get("EDIT_HANDLE_MODE0", MOVE_ALL_EDITS);
};
ExportEDLWindow::ExportEDLWindow(MWindow *mwindow, ExportEDL *exportedl, ExportEDLAsset *exportasset)
- : BC_Window(PROGRAM_NAME ": Export EDL",
+ : BC_Window(_(PROGRAM_NAME ": Export EDL"),
mwindow->gui->get_screen_w(1, 0) / 2 - WIDTH / 2,
mwindow->gui->get_root_h(1) / 2 - HEIGHT / 2,
WIDTH,
if( ret >= 0 )
reading = 1;
else
- eprintf("FFStream::decode_activate: open decoder failed\n");
+ eprintf(_("open decoder failed\n"));
}
else
- eprintf("FFStream::decode_activate: can't clone input file\n");
+ eprintf(_("can't clone input file\n"));
av_dict_free(&copts);
ff_unlock();
}
frame, AV_BUFFERSRC_FLAG_KEEP_REF);
if( ret < 0 ) {
av_frame_unref(frame);
- eprintf("FFStream::load_filter: av_buffersrc_add_frame_flags failed\n");
+ eprintf(_("av_buffersrc_add_frame_flags failed\n"));
}
return ret;
}
{
FILE *fp = fopen(options,"r");
if( !fp ) {
- eprintf("FFMPEG::get_encoder: options open failed %s\n",options);
+ eprintf(_("options open failed %s\n"),options);
return 1;
}
if( get_encoder(fp, format, codec, bsfilter, bsargs) )
- eprintf(_("FFMPEG::get_encoder:"
- " err: format/codec not found %s\n"), options);
+ eprintf(_("format/codec not found %s\n"), options);
fclose(fp);
return 0;
}
if( line[0] == '\n' ) continue;
char key[BCSTRLEN], val[BCTEXTLEN];
if( scan_option_line(line, key, val) ) {
- eprintf(_("FFMPEG::read_options:"
- " err reading %s: line %d\n"), options, no);
+ eprintf(_("err reading %s: line %d\n"), options, no);
ret = 1;
}
if( !ret ) {
{
struct stat st;
if( stat(fmt_ctx->filename, &st) < 0 ) {
- eprintf("FFMPEG::open_decoder: can't stat file: %s\n",
- fmt_ctx->filename);
+ eprintf(_("can't stat file: %s\n"), fmt_ctx->filename);
return 1;
}
int fd = ::open(filename,O_WRONLY);
if( fd < 0 ) fd = open(filename,O_WRONLY+O_CREAT,0666);
if( fd < 0 ) {
- eprintf("FFMPEG::init_encoder: bad file path: %s\n", filename);
+ eprintf(_("bad file path: %s\n"), filename);
return 1;
}
::close(fd);
int ret = get_file_format();
if( ret > 0 ) {
- eprintf("FFMPEG::init_encoder: bad file format: %s\n", filename);
+ eprintf(_("bad file format: %s\n"), filename);
return 1;
}
if( ret < 0 ) {
- eprintf("FFMPEG::init_encoder: mismatch audio/video file format: %s\n", filename);
+ eprintf(_("mismatch audio/video file format: %s\n"), filename);
return 1;
}
ff_lock("FFMPEG::init_encoder");
av_register_all();
avformat_alloc_output_context2(&fmt_ctx, 0, file_format, filename);
if( !fmt_ctx ) {
- eprintf("FFMPEG::init_encoder: failed: %s\n", filename);
+ eprintf(_("failed: %s\n"), filename);
ret = 1;
}
if( !ret ) {
char format_name[BCSTRLEN], codec_name[BCTEXTLEN];
char bsfilter[BCSTRLEN], bsargs[BCTEXTLEN];
if( get_encoder(option_path, format_name, codec_name, bsfilter, bsargs) ) {
- eprintf("FFMPEG::open_encoder: get_encoder failed %s:%s\n",
- option_path, filename);
+ eprintf(_("get_encoder failed %s:%s\n"), option_path, filename);
return 1;
}
const AVCodecDescriptor *codec_desc = 0;
AVCodec *codec = avcodec_find_encoder_by_name(codec_name);
if( !codec ) {
- eprintf("FFMPEG::open_encoder: cant find codec %s:%s\n",
- codec_name, filename);
+ eprintf(_("cant find codec %s:%s\n"), codec_name, filename);
ret = 1;
}
if( !ret ) {
codec_desc = avcodec_descriptor_get(codec->id);
if( !codec_desc ) {
- eprintf("FFMPEG::open_encoder: unknown codec %s:%s\n",
- codec_name, filename);
+ eprintf(_("unknown codec %s:%s\n"), codec_name, filename);
ret = 1;
}
}
if( !ret ) {
st = avformat_new_stream(fmt_ctx, 0);
if( !st ) {
- eprintf("FFMPEG::open_encoder: cant create stream %s:%s\n",
- codec_name, filename);
+ eprintf(_("cant create stream %s:%s\n"), codec_name, filename);
ret = 1;
}
}
switch( codec_desc->type ) {
case AVMEDIA_TYPE_AUDIO: {
if( has_audio ) {
- eprintf("FFMPEG::open_encoder: duplicate audio %s:%s\n",
- codec_name, filename);
+ eprintf(_("duplicate audio %s:%s\n"), codec_name, filename);
ret = 1;
break;
}
has_audio = 1;
if( scan_options(asset->ff_audio_options, sopts, st) ) {
- eprintf("FFMPEG::open_encoder: bad audio options %s:%s\n",
- codec_name, filename);
+ eprintf(_("bad audio options %s:%s\n"), codec_name, filename);
ret = 1;
break;
}
ctx->channel_layout = av_get_default_channel_layout(ctx->channels);
ctx->sample_rate = check_sample_rate(codec, asset->sample_rate);
if( !ctx->sample_rate ) {
- eprintf("FFMPEG::open_encoder:"
- " check_sample_rate failed %s\n", filename);
+ eprintf(_("check_sample_rate failed %s\n"), filename);
ret = 1;
break;
}
break; }
case AVMEDIA_TYPE_VIDEO: {
if( has_video ) {
- eprintf("FFMPEG::open_encoder: duplicate video %s:%s\n",
- codec_name, filename);
+ eprintf(_("duplicate video %s:%s\n"), codec_name, filename);
ret = 1;
break;
}
has_video = 1;
if( scan_options(asset->ff_video_options, sopts, st) ) {
- eprintf("FFMPEG::open_encoder: bad video options %s:%s\n",
- codec_name, filename);
+ eprintf(_("bad video options %s:%s\n"), codec_name, filename);
ret = 1;
break;
}
ctx->pix_fmt = codec->pix_fmts ? codec->pix_fmts[0] : AV_PIX_FMT_YUV420P;
AVRational frame_rate = check_frame_rate(codec, vid->frame_rate);
if( !frame_rate.num || !frame_rate.den ) {
- eprintf("FFMPEG::open_encoder:"
- " check_frame_rate failed %s\n", filename);
+ eprintf(_("check_frame_rate failed %s\n"), filename);
ret = 1;
break;
}
vid->writing = -1;
break; }
default:
- eprintf("FFMPEG::open_encoder: not audio/video, %s:%s\n",
- codec_name, filename);
+ eprintf(_("not audio/video, %s:%s\n"), codec_name, filename);
ret = 1;
}
}
ret = avcodec_open2(st->codec, codec, &sopts);
if( ret < 0 ) {
ff_err(ret,"FFMPEG::open_encoder");
- eprintf("FFMPEG::open_encoder: open failed %s:%s\n",
- codec_name, filename);
+ eprintf(_("open failed %s:%s\n"), codec_name, filename);
ret = 1;
}
else
AVStream *st = ffaudio[stream]->st;
AVCodecID id = st->codec->codec_id;
const AVCodecDescriptor *desc = avcodec_descriptor_get(id);
- return desc ? desc->name : "Unknown";
+ return desc ? desc->name : _("Unknown");
}
int FFMPEG::ff_audio_pid(int stream)
AVStream *st = ffvideo[stream]->st;
AVCodecID id = st->codec->codec_id;
const AVCodecDescriptor *desc = avcodec_descriptor_get(id);
- return desc ? desc->name : "Unknown";
+ return desc ? desc->name : _("Unknown");
}
double FFMPEG::ff_frame_rate(int stream)
av_init_packet(&pkt);
AVFrame *frame = av_frame_alloc();
if( !frame ) {
- fprintf(stderr, "FFMPEG::scan: av_frame_alloc failed\n");
+ fprintf(stderr,"FFMPEG::scan: ");
+ fprintf(stderr,_("av_frame_alloc failed\n"));
return -1;
}
AVStream *st = fmt_ctx->streams[i];
AVCodecID codec_id = st->codec->codec_id;
AVCodec *decoder = avcodec_find_decoder(codec_id);
- if( avcodec_open2(st->codec, decoder, &copts) < 0 )
- fprintf(stderr, "FFMPEG::scan: codec open failed\n");
+ if( avcodec_open2(st->codec, decoder, &copts) < 0 ) {
+ fprintf(stderr,"FFMPEG::scan: ");
+ fprintf(stderr,_("codec open failed\n"));
+ }
av_dict_free(&copts);
}
int errs = 0;
if( ret < 0 ) {
if( ret == AVERROR_EOF ) break;
if( ++errs > 100 ) {
- ff_err(ret, "over 100 read_frame errs\n");
+ ff_err(ret,_("over 100 read_frame errs\n"));
break;
}
continue;
mpg_file = new FileMPEG(file->asset, file);
result = mpg_file->open_file(1, 0);
if( result ) {
- eprintf("Error while opening \"%s\" for reading. \n%m\n", asset->path);
+ eprintf(_("Error while opening \"%s\" for reading. \n%m\n"), asset->path);
}
}
codec = avcodec_find_encoder(AV_CODEC_ID_AC3);
if(!codec)
{
- eprintf("FileAC3::open_file codec not found.\n");
+ eprintf(_("FileAC3::open_file codec not found.\n"));
result = 1;
}
if( !result && !(fd = fopen(asset->path, "w")))
{
- eprintf("Error while opening \"%s\" for writing. \n%m\n", asset->path);
+ eprintf(_("Error while opening \"%s\" for writing. \n%m\n"), asset->path);
result = 1;
}
if( !result ) {
swr_init(resample_context);
if(avcodec_open2(codec_context, codec, 0))
{
- eprintf("FileAC3::open_file failed to open codec.\n");
+ eprintf(_("FileAC3::open_file failed to open codec.\n"));
result = 1;
}
}
int bytes_written = fwrite(temp_compressed, 1, output_size, fd);
if(bytes_written < output_size)
{
- eprintf("Error while writing samples. \n%m\n");
+ eprintf(_("Error while writing samples. \n%m\n"));
return 1;
}
return 0;
AC3ConfigAudio::AC3ConfigAudio(BC_WindowBase *parent_window,
Asset *asset)
- : BC_Window(PROGRAM_NAME ": Audio Compression",
+ : BC_Window(_(PROGRAM_NAME ": Audio Compression"),
parent_window->get_abs_cursor_x(1),
parent_window->get_abs_cursor_y(1),
500,
int x = 10, y = 10;
int x1 = 150;
lock_window("AC3ConfigAudio::create_objects");
- add_tool(new BC_Title(x, y, "Bitrate (kbps):"));
+ add_tool(new BC_Title(x, y, _("Bitrate (kbps):")));
AC3ConfigAudioBitrate *bitrate;
add_tool(bitrate =
new AC3ConfigAudioBitrate(this,
FFOptionsWindow::FFOptionsWindow(FFOptionsDialog *dialog)
- : BC_Window(PROGRAM_NAME ": Options", 60, 30, 640, 400)
+ : BC_Window(_(PROGRAM_NAME ": Options"), 60, 30, 640, 400)
{
this->dialog = dialog;
this->selected = 0;
JPEGConfigVideo::JPEGConfigVideo(BC_WindowBase *parent_window, Asset *asset)
- : BC_Window(PROGRAM_NAME ": Video Compression",
+ : BC_Window(_(PROGRAM_NAME ": Video Compression"),
parent_window->get_abs_cursor_x(1),
parent_window->get_abs_cursor_y(1),
400,
cp += snprintf(cp,ep-cp, _("cell times:"));
for( int i=0; i<cell_times.size(); ++i ) {
if( (i%4) == 0 ) *cp++ = '\n';
- cp += snprintf(cp,ep-cp,_(" %3d. %8.3f"),i,cell_times.get(i));
+ cp += snprintf(cp,ep-cp," %3d. %8.3f",i,cell_times.get(i));
}
cp += snprintf(cp,ep-cp, "\n");
}
}
else if (ret < 0)
{
- eprintf("FileOGG: Taking page out on nonsynced stream!\n");
+ eprintf(_("FileOGG: Taking page out on nonsynced stream!\n"));
return ret;
} else
if((stream = fopen(asset->path, "w+b")) == 0)
{
- eprintf("Error while opening \"%s\" for writing. %m\n", asset->path);
+ eprintf(_("Error while opening \"%s\" for writing. %m\n"), asset->path);
return 1;
}
tf->ti.height = ((asset->height + 15) >>4)<<4; // round up to the nearest multiple of 16
if (tf->ti.width != tf->ti.frame_width || tf->ti.height != tf->ti.frame_height)
{
- eprintf("WARNING: Encoding theora when width or height are not dividable by 16 is suboptimal\n");
+ eprintf(_("WARNING: Encoding theora when width or height are not dividable by 16 is suboptimal\n"));
}
tf->ti.offset_x = 0;
if (theora_encode_init (&tf->td, &tf->ti))
{
- eprintf("(FileOGG:file_open) initialization of theora codec failed\n");
+ eprintf(_("(FileOGG:file_open) initialization of theora codec failed\n"));
}
}
/* init theora done */
if((stream = fopen(asset->path, "rb")) == 0)
{
- eprintf("Error while opening %s for reading. %m\n", asset->path);
+ eprintf(_("Error while opening %s for reading. %m\n"), asset->path);
return 1;
}
if(tf->ti.width!=tf->ti.frame_width || tf->ti.height!=tf->ti.frame_height)
{
- eprintf("Frame content is %dx%d with offset (%d,%d), We do not support this yet. You will get black border.\n",
+ eprintf(_("Frame content is %dx%d with offset (%d,%d), We do not support this yet. You will get black border.\n"),
tf->ti.frame_width, tf->ti.frame_height, tf->ti.offset_x, tf->ti.offset_y);
}
tf->videosync = new sync_window_t;
{
vorbis_synthesis_init(&tf->vd, &tf->vi);
vorbis_block_init(&tf->vd, &tf->vb);
-/* eprintf("FileOGG: Ogg logical stream %x is Vorbis %d channel %d Hz audio.\n",
+/* eprintf(_("FileOGG: Ogg logical stream %x is Vorbis %d channel %d Hz audio.\n"),
(unsigned int)tf->vo.serialno, tf->vi.channels, (int)tf->vi.rate);
*/
/* init audio_sync structure */
{
if (previous_comming_sample > sample)
{
- eprintf("Ogg decoding error while seeking sample\n");
+ eprintf(_("Ogg decoding error while seeking sample\n"));
}
vorbis_synthesis_read(&tf->vd, (sample - previous_comming_sample));
// printf("WE GOT IT, samples already decoded: %jd\n", vorbis_synthesis_pcmout(&tf->vd,NULL));
if(len > HISTORY_MAX)
{
- eprintf("max samples=%d\n", HISTORY_MAX);
+ eprintf(_("max samples=%d\n"), HISTORY_MAX);
return 1;
}
ogg_sample_position = hole_absstart;
if (!ogg_seek_to_sample(tf->audiosync, tf->vo.serialno, ogg_sample_position))
{
- eprintf("Error while seeking to sample\n");
+ eprintf(_("Error while seeking to sample\n"));
return 1;
}
}
ret = fwrite(tf->apage, 1, tf->apage_len, stream);
if(ret < tf->apage_len)
{
- eprintf("error writing audio page\n");
+ eprintf(_("error writing audio page\n"));
}
tf->apage_valid = 0;
tf->a_pkg -= ogg_page_packets((ogg_page *)&tf->apage);
ret = fwrite(tf->vpage, 1, tf->vpage_len, stream);
if(ret < tf->vpage_len)
{
- eprintf("error writing video page\n");
+ eprintf(_("error writing video page\n"));
}
tf->vpage_valid = 0;
tf->v_pkg -= ogg_page_packets((ogg_page *)&tf->vpage);
PNGConfigVideo::PNGConfigVideo(BC_WindowBase *parent_window, Asset *asset)
- : BC_Window(PROGRAM_NAME ": Video Compression",
+ : BC_Window(_(PROGRAM_NAME ": Video Compression"),
parent_window->get_abs_cursor_x(1),
parent_window->get_abs_cursor_y(1),
200,
TIFFConfigVideo::TIFFConfigVideo(BC_WindowBase *parent_window, Asset *asset)
- : BC_Window(PROGRAM_NAME ": Video Compression",
+ : BC_Window(_(PROGRAM_NAME ": Video Compression"),
parent_window->get_abs_cursor_x(1),
parent_window->get_abs_cursor_y(1),
400,
lock_window("TIFFConfigVideo::create_objects()");
int x = 10, y = 10;
- add_subwindow(new BC_Title(x, y, "Colorspace:"));
+ add_subwindow(new BC_Title(x, y, _("Colorspace:")));
TIFFColorspace *menu1;
add_subwindow(menu1 = new TIFFColorspace(this, x + 150, y, 200));
menu1->create_objects();
y += 40;
- add_subwindow(new BC_Title(x, y, "Compression:"));
+ add_subwindow(new BC_Title(x, y, _("Compression:")));
TIFFCompression *menu2;
add_subwindow(menu2 = new TIFFCompression(this, x + 150, y, 200));
menu2->create_objects();
{
if(!(fd = fopen(asset->path, "wb")))
{
- eprintf("Error while opening \"%s\" for writing. \n%m\n", asset->path);
+ eprintf(_("Error while opening \"%s\" for writing. \n%m\n"), asset->path);
result = 1;
}
else
const char* FormatPresets::get_preset_text(EDL *edl)
{
FormatPresetItem *item = edl ? find_preset(edl) : 0;
- return item ? item->get_text() : "User Defined";
+ return item ? item->get_text() : _("User Defined");
}
case FloatAuto::TFREE: return _("tangent edit");
case FloatAuto::FREE: return _("disjoint edit");
}
- return "misconfigured";
+ return _("misconfigured");
}
LabelEditWindow::LabelEditWindow(MWindow *mwindow, LabelEdit *thread)
- : BC_Window(PROGRAM_NAME ": Label Info",
+ : BC_Window(_(PROGRAM_NAME ": Label Info"),
mwindow->gui->get_abs_cursor_x(1) - 400 / 2,
mwindow->gui->get_abs_cursor_y(1) - 350 / 2,
400,
ManualGotoWindow::ManualGotoWindow(ManualGoto *mango, int x, int y)
- : BC_Window(PROGRAM_NAME ": Goto position", x, y,
+ : BC_Window(_(PROGRAM_NAME ": Goto position"), x, y,
250, 80, 250, 80, 0, 0, 1)
{
this->mango = mango;
-#if 0
-N_("Cinelerra: New Project");
-#endif
-
NewWindow::NewWindow(MWindow *mwindow, NewThread *new_thread, int x, int y)
: BC_Window(_(_(PROGRAM_NAME ": New Project")),
x,
MainProgressBar *progress;
char string[BCTEXTLEN], string2[BCTEXTLEN];
- sprintf(string, _("%s..."), plugin_server->title);
+ sprintf(string, "%s...", plugin_server->title);
progress = mwindow->mainprogress->start_progress(string, end - start);
for(int64_t current_position = start;
#include "plugin.h"
#include "plugindialog.h"
#include "pluginpopup.h"
-#include "presets.h"
-#include "presetsgui.h"
+//#include "presets.h"
+//#include "presetsgui.h"
#include "track.h"
#include "mwindowgui.inc"
#include "plugin.inc"
#include "plugindialog.inc"
-#include "presets.inc"
-#include "presetsgui.inc"
+//#include "presets.inc"
+//#include "presetsgui.inc"
PluginPopup *popup;
};
-
#endif
+++ /dev/null
-
-/*
- * CINELERRA
- * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-
-#include "bcsignals.h"
-#include "bcwindowbase.inc"
-#include "cstrdup.h"
-#include "file.h"
-#include "filesystem.h"
-#include "filexml.h"
-#include "keyframe.h"
-#include "messages.inc"
-#include "mwindow.h"
-#include "pluginserver.h"
-#include "preferences.inc"
-#include "presets.h"
-
-#include <errno.h>
-#include <string.h>
-
-PresetsDB::PresetsDB()
-{
-}
-
-
-void PresetsDB::clear()
-{
- plugins.remove_all_objects();
-}
-
-void PresetsDB::load()
-{
- clear();
-
- FileXML file;
- char path[BCTEXTLEN];
- char string[BCTEXTLEN];
- sprintf(path, "%s/%s", File::get_config_path(), PRESETS_FILE);
- FileSystem fs;
- fs.complete_path(path);
- file.read_from_file(path);
- int result = 0;
-
- do
- {
- result = file.read_tag();
- if(!result)
- {
- if(file.tag.title_is("PLUGIN"))
- {
- PresetsDBPlugin *plugin = 0;
- sprintf(string, "Unknown");
- const char *title = file.tag.get_property("TITLE", string);
-
-// Search for existing plugin
- for(int i = 0; i < plugins.size(); i++)
- {
- if(!strcasecmp(plugins.get(i)->title, title))
- {
- plugin = plugins.get(i);
- break;
- }
- }
-
-// Create new plugin
- if(!plugin)
- {
- plugin = new PresetsDBPlugin(title);
- plugins.append(plugin);
- }
-
- plugin->load(&file);
- }
- }
- }while(!result);
-}
-
-void PresetsDB::save()
-{
- FileXML file;
- for(int i = 0; i < plugins.size(); i++)
- {
- PresetsDBPlugin *plugin = plugins.get(i);
- plugin->save(&file);
- }
- file.terminate_string();
-
- char path[BCTEXTLEN];
- sprintf(path, "%s/%s", File::get_config_path(), PRESETS_FILE);
- FileSystem fs;
- fs.complete_path(path);
- file.write_to_file(path);
-}
-
-
-int PresetsDB::get_total_presets(char *plugin_title)
-{
- for(int i = 0; i < plugins.size(); i++)
- {
- PresetsDBPlugin *plugin = plugins.get(i);
- if(!strcasecmp(plugin->title, plugin_title))
- {
- return plugin->keyframes.size();
- }
- }
-
- return 0;
-}
-
-char* PresetsDB::get_preset_title(char *plugin_title, int number)
-{
- for(int i = 0; i < plugins.size(); i++)
- {
- PresetsDBPlugin *plugin = plugins.get(i);
- if(!strcasecmp(plugin->title, plugin_title))
- {
- if(number < plugin->keyframes.size())
- {
- return plugin->keyframes.get(number)->title;
- }
- else
- {
- printf("PresetsDB::get_preset_title %d buffer overrun\n", __LINE__);
- }
- break;
- }
- }
- return 0;
-}
-
-char* PresetsDB::get_preset_data(char *plugin_title, int number)
-{
- for(int i = 0; i < plugins.size(); i++)
- {
- PresetsDBPlugin *plugin = plugins.get(i);
- if(!strcasecmp(plugin->title, plugin_title))
- {
- if(number < plugin->keyframes.size())
- {
- return plugin->keyframes.get(number)->data;
- }
- else
- {
- printf("PresetsDB::get_preset_data %d buffer overrun\n", __LINE__);
- }
- break;
- }
- }
- return 0;
-}
-
-PresetsDBPlugin* PresetsDB::get_plugin(const char *plugin_title)
-{
- for(int i = 0; i < plugins.size(); i++)
- {
- PresetsDBPlugin *plugin = plugins.get(i);
- if(!strcasecmp(plugin->title, plugin_title))
- {
- return plugin;
- }
- }
- return 0;
-}
-
-PresetsDBPlugin* PresetsDB::new_plugin(const char *plugin_title)
-{
- PresetsDBPlugin *result = new PresetsDBPlugin(plugin_title);
- plugins.append(result);
- return result;
-}
-
-
-void PresetsDB::save_preset(const char *plugin_title, const char *preset_title, char *data)
-{
- PresetsDBPlugin *plugin = get_plugin(plugin_title);
- if(!plugin) plugin = new_plugin(plugin_title);
- PresetsDBKeyframe *keyframe = plugin->get_keyframe(preset_title);
- if(!keyframe) keyframe = plugin->new_keyframe(preset_title);
- keyframe->set_data(data);
- save();
-
-}
-
-
-void PresetsDB::delete_preset(const char *plugin_title, const char *preset_title)
-{
- PresetsDBPlugin *plugin = get_plugin(plugin_title);
- if(plugin)
- {
- plugin->delete_keyframe(preset_title);
- }
- save();
-}
-
-void PresetsDB::load_preset(const char *plugin_title, const char *preset_title, KeyFrame *keyframe)
-{
- PresetsDBPlugin *plugin = get_plugin(plugin_title);
- if(plugin)
- {
- plugin->load_preset(preset_title, keyframe);
- }
-}
-
-int PresetsDB::preset_exists(const char *plugin_title, const char *preset_title)
-{
- PresetsDBPlugin *plugin = get_plugin(plugin_title);
- if(plugin)
- {
- return plugin->preset_exists(preset_title);
- }
- return 0;
-}
-
-
-
-
-PresetsDBKeyframe::PresetsDBKeyframe(const char *title)
-{
- this->title = cstrdup(title);
- data = 0;
-}
-
-PresetsDBKeyframe::~PresetsDBKeyframe()
-{
- delete [] title;
- delete [] data;
-}
-
-void PresetsDBKeyframe::set_data(char *data)
-{
- delete [] this->data;
- this->data = cstrdup(data);
-}
-
-
-
-PresetsDBPlugin::PresetsDBPlugin(const char *title)
-{
- this->title = cstrdup(title);
-}
-
-PresetsDBPlugin::~PresetsDBPlugin()
-{
- keyframes.remove_all_objects();
- delete [] title;
-}
-
-void PresetsDBPlugin::load(FileXML *file)
-{
- int result = 0;
- char string[BCTEXTLEN];
-
- do
- {
- result = file->read_tag();
- if(!result)
- {
- if(file->tag.title_is("/PLUGIN")) break;
- else
- if(file->tag.title_is("KEYFRAME"))
- {
- sprintf(string, "Unknown");
- const char *keyframe_title = file->tag.get_property("TITLE", string);
- PresetsDBKeyframe *keyframe = new PresetsDBKeyframe(keyframe_title);
-
- char data[MESSAGESIZE];
- int len = file->read_data_until("/KEYFRAME", data, MESSAGESIZE-1);
- data[len] = 0;
- keyframe->set_data(data);
- keyframes.append(keyframe);
-
- }
- }
- }while(!result);
-
-
-}
-
-void PresetsDBPlugin::save(FileXML *file)
-{
- file->tag.set_title("PLUGIN");
- file->tag.set_property("TITLE", title);
- file->append_tag();
- file->append_newline();
-
- for(int j = 0; j < keyframes.size(); j++)
- {
- PresetsDBKeyframe *keyframe = keyframes.get(j);
- file->tag.set_title("KEYFRAME");
- file->tag.set_property("TITLE", keyframe->title);
- file->append_tag();
- file->append_text(keyframe->data);
- file->tag.set_title("/KEYFRAME");
- file->append_tag();
- file->append_newline();
- }
-
- file->tag.set_title("/PLUGIN");
- file->append_tag();
- file->append_newline();
-}
-
-PresetsDBKeyframe* PresetsDBPlugin::get_keyframe(const char *title)
-{
- for(int i = 0; i < keyframes.size(); i++)
- {
- PresetsDBKeyframe *keyframe = keyframes.get(i);
- if(!strcasecmp(keyframe->title, title)) return keyframe;
- }
- return 0;
-}
-
-void PresetsDBPlugin::delete_keyframe(const char *title)
-{
- for(int i = 0; i < keyframes.size(); i++)
- {
- PresetsDBKeyframe *keyframe = keyframes.get(i);
- if(!strcasecmp(keyframe->title, title))
- {
- keyframes.remove_object_number(i);
- return;
- }
- }
-}
-
-
-PresetsDBKeyframe* PresetsDBPlugin::new_keyframe(const char *title)
-{
- PresetsDBKeyframe *keyframe = new PresetsDBKeyframe(title);
- keyframes.append(keyframe);
- return keyframe;
-}
-
-void PresetsDBPlugin::load_preset(const char *preset_title, KeyFrame *keyframe)
-{
- PresetsDBKeyframe *src = get_keyframe(preset_title);
- if(src)
- {
- keyframe->set_data(src->data);
-// Save as the plugin's default
-// Need the path
-//printf("PresetsDBPlugin::load_preset %d %s\n", __LINE__, title);
- PluginServer *server = MWindow::scan_plugindb(title, -1);
- if(!server)
- {
- }
- else
- {
- char path[BCTEXTLEN];
- server->get_defaults_path(path);
- FileSystem fs;
- fs.complete_path(path);
-
- FILE *fd = fopen(path, "w");
- if(fd)
- {
- if(!fwrite(src->data, strlen(src->data), 1, fd))
- {
- fprintf(stderr, "PresetsDBPlugin::load_preset %d \"%s\": %s\n",
- __LINE__,
- path,
- strerror(errno));
- }
-
- fclose(fd);
- }
- else
- {
- fprintf(stderr, "PresetsDBPlugin::load_preset %d \"%s\": %s\n",
- __LINE__,
- path,
- strerror(errno));
- }
- }
- }
-}
-
-int PresetsDBPlugin::preset_exists(const char *preset_title)
-{
- PresetsDBKeyframe *src = get_keyframe(preset_title);
- if(src)
- {
- return 1;
- }
- return 0;
-}
-
-
-
-
-
-
-
--- /dev/null
+
+/*
+ * CINELERRA
+ * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include "bcsignals.h"
+#include "bcwindowbase.inc"
+#include "cstrdup.h"
+#include "file.h"
+#include "filesystem.h"
+#include "filexml.h"
+#include "keyframe.h"
+#include "messages.inc"
+#include "mwindow.h"
+#include "pluginserver.h"
+#include "preferences.inc"
+#include "presets.h"
+
+#include <errno.h>
+#include <string.h>
+
+PresetsDB::PresetsDB()
+{
+}
+
+
+void PresetsDB::clear()
+{
+ plugins.remove_all_objects();
+}
+
+void PresetsDB::load()
+{
+ clear();
+
+ FileXML file;
+ char path[BCTEXTLEN];
+ char string[BCTEXTLEN];
+ sprintf(path, "%s/%s", File::get_config_path(), PRESETS_FILE);
+ FileSystem fs;
+ fs.complete_path(path);
+ file.read_from_file(path);
+ int result = 0;
+
+ do
+ {
+ result = file.read_tag();
+ if(!result)
+ {
+ if(file.tag.title_is("PLUGIN"))
+ {
+ PresetsDBPlugin *plugin = 0;
+ sprintf(string, "Unknown");
+ const char *title = file.tag.get_property("TITLE", string);
+
+// Search for existing plugin
+ for(int i = 0; i < plugins.size(); i++)
+ {
+ if(!strcasecmp(plugins.get(i)->title, title))
+ {
+ plugin = plugins.get(i);
+ break;
+ }
+ }
+
+// Create new plugin
+ if(!plugin)
+ {
+ plugin = new PresetsDBPlugin(title);
+ plugins.append(plugin);
+ }
+
+ plugin->load(&file);
+ }
+ }
+ }while(!result);
+}
+
+void PresetsDB::save()
+{
+ FileXML file;
+ for(int i = 0; i < plugins.size(); i++)
+ {
+ PresetsDBPlugin *plugin = plugins.get(i);
+ plugin->save(&file);
+ }
+ file.terminate_string();
+
+ char path[BCTEXTLEN];
+ sprintf(path, "%s/%s", File::get_config_path(), PRESETS_FILE);
+ FileSystem fs;
+ fs.complete_path(path);
+ file.write_to_file(path);
+}
+
+
+int PresetsDB::get_total_presets(char *plugin_title)
+{
+ for(int i = 0; i < plugins.size(); i++)
+ {
+ PresetsDBPlugin *plugin = plugins.get(i);
+ if(!strcasecmp(plugin->title, plugin_title))
+ {
+ return plugin->keyframes.size();
+ }
+ }
+
+ return 0;
+}
+
+char* PresetsDB::get_preset_title(char *plugin_title, int number)
+{
+ for(int i = 0; i < plugins.size(); i++)
+ {
+ PresetsDBPlugin *plugin = plugins.get(i);
+ if(!strcasecmp(plugin->title, plugin_title))
+ {
+ if(number < plugin->keyframes.size())
+ {
+ return plugin->keyframes.get(number)->title;
+ }
+ else
+ {
+ printf("PresetsDB::get_preset_title %d buffer overrun\n", __LINE__);
+ }
+ break;
+ }
+ }
+ return 0;
+}
+
+char* PresetsDB::get_preset_data(char *plugin_title, int number)
+{
+ for(int i = 0; i < plugins.size(); i++)
+ {
+ PresetsDBPlugin *plugin = plugins.get(i);
+ if(!strcasecmp(plugin->title, plugin_title))
+ {
+ if(number < plugin->keyframes.size())
+ {
+ return plugin->keyframes.get(number)->data;
+ }
+ else
+ {
+ printf("PresetsDB::get_preset_data %d buffer overrun\n", __LINE__);
+ }
+ break;
+ }
+ }
+ return 0;
+}
+
+PresetsDBPlugin* PresetsDB::get_plugin(const char *plugin_title)
+{
+ for(int i = 0; i < plugins.size(); i++)
+ {
+ PresetsDBPlugin *plugin = plugins.get(i);
+ if(!strcasecmp(plugin->title, plugin_title))
+ {
+ return plugin;
+ }
+ }
+ return 0;
+}
+
+PresetsDBPlugin* PresetsDB::new_plugin(const char *plugin_title)
+{
+ PresetsDBPlugin *result = new PresetsDBPlugin(plugin_title);
+ plugins.append(result);
+ return result;
+}
+
+
+void PresetsDB::save_preset(const char *plugin_title, const char *preset_title, char *data)
+{
+ PresetsDBPlugin *plugin = get_plugin(plugin_title);
+ if(!plugin) plugin = new_plugin(plugin_title);
+ PresetsDBKeyframe *keyframe = plugin->get_keyframe(preset_title);
+ if(!keyframe) keyframe = plugin->new_keyframe(preset_title);
+ keyframe->set_data(data);
+ save();
+
+}
+
+
+void PresetsDB::delete_preset(const char *plugin_title, const char *preset_title)
+{
+ PresetsDBPlugin *plugin = get_plugin(plugin_title);
+ if(plugin)
+ {
+ plugin->delete_keyframe(preset_title);
+ }
+ save();
+}
+
+void PresetsDB::load_preset(const char *plugin_title, const char *preset_title, KeyFrame *keyframe)
+{
+ PresetsDBPlugin *plugin = get_plugin(plugin_title);
+ if(plugin)
+ {
+ plugin->load_preset(preset_title, keyframe);
+ }
+}
+
+int PresetsDB::preset_exists(const char *plugin_title, const char *preset_title)
+{
+ PresetsDBPlugin *plugin = get_plugin(plugin_title);
+ if(plugin)
+ {
+ return plugin->preset_exists(preset_title);
+ }
+ return 0;
+}
+
+
+
+
+PresetsDBKeyframe::PresetsDBKeyframe(const char *title)
+{
+ this->title = cstrdup(title);
+ data = 0;
+}
+
+PresetsDBKeyframe::~PresetsDBKeyframe()
+{
+ delete [] title;
+ delete [] data;
+}
+
+void PresetsDBKeyframe::set_data(char *data)
+{
+ delete [] this->data;
+ this->data = cstrdup(data);
+}
+
+
+
+PresetsDBPlugin::PresetsDBPlugin(const char *title)
+{
+ this->title = cstrdup(title);
+}
+
+PresetsDBPlugin::~PresetsDBPlugin()
+{
+ keyframes.remove_all_objects();
+ delete [] title;
+}
+
+void PresetsDBPlugin::load(FileXML *file)
+{
+ int result = 0;
+ char string[BCTEXTLEN];
+
+ do
+ {
+ result = file->read_tag();
+ if(!result)
+ {
+ if(file->tag.title_is("/PLUGIN")) break;
+ else
+ if(file->tag.title_is("KEYFRAME"))
+ {
+ sprintf(string, "Unknown");
+ const char *keyframe_title = file->tag.get_property("TITLE", string);
+ PresetsDBKeyframe *keyframe = new PresetsDBKeyframe(keyframe_title);
+
+ char data[MESSAGESIZE];
+ int len = file->read_data_until("/KEYFRAME", data, MESSAGESIZE-1);
+ data[len] = 0;
+ keyframe->set_data(data);
+ keyframes.append(keyframe);
+
+ }
+ }
+ }while(!result);
+
+
+}
+
+void PresetsDBPlugin::save(FileXML *file)
+{
+ file->tag.set_title("PLUGIN");
+ file->tag.set_property("TITLE", title);
+ file->append_tag();
+ file->append_newline();
+
+ for(int j = 0; j < keyframes.size(); j++)
+ {
+ PresetsDBKeyframe *keyframe = keyframes.get(j);
+ file->tag.set_title("KEYFRAME");
+ file->tag.set_property("TITLE", keyframe->title);
+ file->append_tag();
+ file->append_text(keyframe->data);
+ file->tag.set_title("/KEYFRAME");
+ file->append_tag();
+ file->append_newline();
+ }
+
+ file->tag.set_title("/PLUGIN");
+ file->append_tag();
+ file->append_newline();
+}
+
+PresetsDBKeyframe* PresetsDBPlugin::get_keyframe(const char *title)
+{
+ for(int i = 0; i < keyframes.size(); i++)
+ {
+ PresetsDBKeyframe *keyframe = keyframes.get(i);
+ if(!strcasecmp(keyframe->title, title)) return keyframe;
+ }
+ return 0;
+}
+
+void PresetsDBPlugin::delete_keyframe(const char *title)
+{
+ for(int i = 0; i < keyframes.size(); i++)
+ {
+ PresetsDBKeyframe *keyframe = keyframes.get(i);
+ if(!strcasecmp(keyframe->title, title))
+ {
+ keyframes.remove_object_number(i);
+ return;
+ }
+ }
+}
+
+
+PresetsDBKeyframe* PresetsDBPlugin::new_keyframe(const char *title)
+{
+ PresetsDBKeyframe *keyframe = new PresetsDBKeyframe(title);
+ keyframes.append(keyframe);
+ return keyframe;
+}
+
+void PresetsDBPlugin::load_preset(const char *preset_title, KeyFrame *keyframe)
+{
+ PresetsDBKeyframe *src = get_keyframe(preset_title);
+ if(src)
+ {
+ keyframe->set_data(src->data);
+// Save as the plugin's default
+// Need the path
+//printf("PresetsDBPlugin::load_preset %d %s\n", __LINE__, title);
+ PluginServer *server = MWindow::scan_plugindb(title, -1);
+ if(!server)
+ {
+ }
+ else
+ {
+ char path[BCTEXTLEN];
+ server->get_defaults_path(path);
+ FileSystem fs;
+ fs.complete_path(path);
+
+ FILE *fd = fopen(path, "w");
+ if(fd)
+ {
+ if(!fwrite(src->data, strlen(src->data), 1, fd))
+ {
+ fprintf(stderr, "PresetsDBPlugin::load_preset %d \"%s\": %s\n",
+ __LINE__,
+ path,
+ strerror(errno));
+ }
+
+ fclose(fd);
+ }
+ else
+ {
+ fprintf(stderr, "PresetsDBPlugin::load_preset %d \"%s\": %s\n",
+ __LINE__,
+ path,
+ strerror(errno));
+ }
+ }
+ }
+}
+
+int PresetsDBPlugin::preset_exists(const char *preset_title)
+{
+ PresetsDBKeyframe *src = get_keyframe(preset_title);
+ if(src)
+ {
+ return 1;
+ }
+ return 0;
+}
+
+
+
+
+
+
+
+++ /dev/null
-
-/*
- * CINELERRA
- * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-
-#ifndef PRESETS_H
-#define PRESETS_H
-
-
-#include "arraylist.h"
-#include "filexml.inc"
-#include "keyframe.inc"
-
-
-// Front end for a DB of presets for all plugins
-
-// A single preset
-class PresetsDBKeyframe
-{
-public:
- PresetsDBKeyframe(const char *title);
- ~PresetsDBKeyframe();
-
- void set_data(char *data);
-
- char *title;
- char *data;
-};
-
-// Presets for a single plugin
-class PresetsDBPlugin
-{
-public:
- PresetsDBPlugin(const char *title);
- ~PresetsDBPlugin();
-
-
- void load(FileXML *file);
- void save(FileXML *file);
-
-// Get a preset by name
- PresetsDBKeyframe* get_keyframe(const char *title);
-// Create a new keyframe
- PresetsDBKeyframe* new_keyframe(const char *title);
- void delete_keyframe(const char *title);
-// Load a preset into the keyframe
- void load_preset(const char *preset_title, KeyFrame *keyframe);
- int preset_exists(const char *preset_title);
-
- ArrayList<PresetsDBKeyframe*> keyframes;
- char *title;
-};
-
-class PresetsDB
-{
-public:
- PresetsDB();
-
-// Load the database from the file.
- void load();
-// Save the database to the file.
- void save();
-
-// Get the total number of presets for a plugin
- int get_total_presets(char *plugin_title);
-// Get the title of a preset
- char* get_preset_title(char *plugin_title, int number);
-// Get the data for a preset
- char* get_preset_data(char *plugin_title, int number);
-// Get a pluginDB by name
- PresetsDBPlugin* get_plugin(const char *plugin_title);
-// Create a pluginDB
- PresetsDBPlugin* new_plugin(const char *plugin_title);
- void save_preset(const char *plugin_title, const char *preset_title, char *data);
- void delete_preset(const char *plugin_title, const char *preset_title);
-// Load a preset into the keyframe
- void load_preset(const char *plugin_title, const char *preset_title, KeyFrame *keyframe);
- int preset_exists(const char *plugin_title, const char *preset_title);
-
-private:
-// Remove all plugin data
- void clear();
-
- ArrayList<PresetsDBPlugin*> plugins;
-};
-
-
-
-#endif
-
-
-
--- /dev/null
+
+/*
+ * CINELERRA
+ * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifndef PRESETS_H
+#define PRESETS_H
+
+
+#include "arraylist.h"
+#include "filexml.inc"
+#include "keyframe.inc"
+
+
+// Front end for a DB of presets for all plugins
+
+// A single preset
+class PresetsDBKeyframe
+{
+public:
+ PresetsDBKeyframe(const char *title);
+ ~PresetsDBKeyframe();
+
+ void set_data(char *data);
+
+ char *title;
+ char *data;
+};
+
+// Presets for a single plugin
+class PresetsDBPlugin
+{
+public:
+ PresetsDBPlugin(const char *title);
+ ~PresetsDBPlugin();
+
+
+ void load(FileXML *file);
+ void save(FileXML *file);
+
+// Get a preset by name
+ PresetsDBKeyframe* get_keyframe(const char *title);
+// Create a new keyframe
+ PresetsDBKeyframe* new_keyframe(const char *title);
+ void delete_keyframe(const char *title);
+// Load a preset into the keyframe
+ void load_preset(const char *preset_title, KeyFrame *keyframe);
+ int preset_exists(const char *preset_title);
+
+ ArrayList<PresetsDBKeyframe*> keyframes;
+ char *title;
+};
+
+class PresetsDB
+{
+public:
+ PresetsDB();
+
+// Load the database from the file.
+ void load();
+// Save the database to the file.
+ void save();
+
+// Get the total number of presets for a plugin
+ int get_total_presets(char *plugin_title);
+// Get the title of a preset
+ char* get_preset_title(char *plugin_title, int number);
+// Get the data for a preset
+ char* get_preset_data(char *plugin_title, int number);
+// Get a pluginDB by name
+ PresetsDBPlugin* get_plugin(const char *plugin_title);
+// Create a pluginDB
+ PresetsDBPlugin* new_plugin(const char *plugin_title);
+ void save_preset(const char *plugin_title, const char *preset_title, char *data);
+ void delete_preset(const char *plugin_title, const char *preset_title);
+// Load a preset into the keyframe
+ void load_preset(const char *plugin_title, const char *preset_title, KeyFrame *keyframe);
+ int preset_exists(const char *plugin_title, const char *preset_title);
+
+private:
+// Remove all plugin data
+ void clear();
+
+ ArrayList<PresetsDBPlugin*> plugins;
+};
+
+
+
+#endif
+
+
+
+++ /dev/null
-
-/*
- * CINELERRA
- * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-
-#ifndef PRESETS_INC
-#define PRESETS_INC
-
-
-class PresetsDB;
-
-#endif
-
-
-
-
--- /dev/null
+
+/*
+ * CINELERRA
+ * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifndef PRESETS_INC
+#define PRESETS_INC
+
+
+class PresetsDB;
+
+#endif
+
+
+
+
+++ /dev/null
-
-/*
- * CINELERRA
- * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-
-#if 0
-
-
-
-
-#include "edl.h"
-#include "keyframe.h"
-#include "keys.h"
-#include "language.h"
-#include "localsession.h"
-#include "mainsession.h"
-#include "mainundo.h"
-#include "mwindow.h"
-#include "mwindowgui.h"
-#include "plugin.h"
-#include "presets.h"
-#include "presetsgui.h"
-#include "theme.h"
-#include "trackcanvas.h"
-#include "tracks.h"
-
-
-
-
-
-
-
-
-
-
-
-PresetsThread::PresetsThread(MWindow *mwindow)
- : BC_DialogThread()
-{
- this->mwindow = mwindow;
- plugin = 0;
- data = new ArrayList<BC_ListBoxItem*>;
- presets_db = new PresetsDB;
- plugin_title[0] = 0;
- window_title[0] = 0;
-}
-
-PresetsThread::~PresetsThread()
-{
- close_window();
- delete data;
-}
-
-void PresetsThread::calculate_list()
-{
- data->remove_all_objects();
- int total_presets = presets_db->get_total_presets(plugin_title);
- for(int i = 0; i < total_presets; i++)
- {
- data->append(new BC_ListBoxItem(presets_db->get_preset_title(
- plugin_title,
- i)));
- }
-}
-
-
-void PresetsThread::start_window(Plugin *plugin)
-{
- if(!BC_DialogThread::is_running())
- {
- this->plugin = plugin;
- plugin->calculate_title(plugin_title, 0);
- sprintf(window_title, _(PROGRAM_NAME ": %s Presets"), plugin_title);
-
-
-// Calculate database
- presets_db->load();
- calculate_list();
-
-
- mwindow->gui->unlock_window();
- BC_DialogThread::start();
- mwindow->gui->lock_window("PresetsThread::start_window");
- }
-}
-
-BC_Window* PresetsThread::new_gui()
-{
- mwindow->gui->lock_window("PresetsThread::new_gui");
- int x = mwindow->gui->get_abs_cursor_x(0) -
- mwindow->session->plugindialog_w / 2;
- int y = mwindow->gui->get_abs_cursor_y(0) -
- mwindow->session->plugindialog_h / 2;
-
- PresetsWindow *window = new PresetsWindow(mwindow,
- this,
- x,
- y,
- window_title);
-
- window->create_objects();
- mwindow->gui->unlock_window();
- return window;
-}
-
-void PresetsThread::handle_done_event(int result)
-{
-// Apply the preset
- if(!result)
- {
- char *title = ((PresetsWindow*)get_gui())->title_text->get_text();
- apply_preset(title);
- }
-}
-
-void PresetsThread::handle_close_event(int result)
-{
-}
-
-void PresetsThread::save_preset(char *title)
-{
- get_gui()->unlock_window();
- mwindow->gui->lock_window("PresetsThread::save_preset");
-
-// Test EDL for plugin existence
- if(!mwindow->edl->tracks->plugin_exists(plugin))
- {
- mwindow->gui->unlock_window();
- get_gui()->lock_window("PresetsThread::save_preset 2");
- return;
- }
-
-
-// Get current plugin keyframe
- EDL *edl = mwindow->edl;
- Track *track = plugin->track;
- KeyFrame *keyframe = plugin->get_prev_keyframe(
- track->to_units(edl->local_session->get_selectionstart(1), 0),
- PLAY_FORWARD);
-
-// Send to database
- presets_db->save_preset(plugin_title, title, keyframe->get_data());
-
- mwindow->gui->unlock_window();
- get_gui()->lock_window("PresetsThread::save_preset 2");
-
-
-// Update list
- calculate_list();
- ((PresetsWindow*)get_gui())->list->update(data,
- 0,
- 0,
- 1);
-}
-
-void PresetsThread::delete_preset(char *title)
-{
- get_gui()->unlock_window();
- mwindow->gui->lock_window("PresetsThread::save_preset");
-
-// Test EDL for plugin existence
- if(!mwindow->edl->tracks->plugin_exists(plugin))
- {
- mwindow->gui->unlock_window();
- get_gui()->lock_window("PresetsThread::delete_preset 1");
- return;
- }
-
- presets_db->delete_preset(plugin_title, title);
-
- mwindow->gui->unlock_window();
- get_gui()->lock_window("PresetsThread::delete_preset 2");
-
-
-// Update list
- calculate_list();
- ((PresetsWindow*)get_gui())->list->update(data,
- 0,
- 0,
- 1);
-}
-
-
-void PresetsThread::apply_preset(char *title)
-{
- if(presets_db->preset_exists(plugin_title, title))
- {
- get_gui()->unlock_window();
- mwindow->gui->lock_window("PresetsThread::apply_preset");
-
-// Test EDL for plugin existence
- if(!mwindow->edl->tracks->plugin_exists(plugin))
- {
- mwindow->gui->unlock_window();
- get_gui()->lock_window("PresetsThread::delete_preset 1");
- return;
- }
-
- mwindow->undo->update_undo_before();
- KeyFrame *keyframe = plugin->get_keyframe();
- presets_db->load_preset(plugin_title, title, keyframe);
- mwindow->save_backup();
- mwindow->undo->update_undo_after(_("apply preset"), LOAD_AUTOMATION);
-
- mwindow->update_plugin_guis();
- mwindow->gui->canvas->draw_overlays();
- mwindow->gui->canvas->flash();
- mwindow->sync_parameters(CHANGE_PARAMS);
-
- mwindow->gui->unlock_window();
- get_gui()->lock_window("PresetsThread::apply_preset");
- }
-}
-
-
-
-
-
-PresetsList::PresetsList(PresetsThread *thread,
- PresetsWindow *window,
- int x,
- int y,
- int w,
- int h)
- : BC_ListBox(x,
- y,
- w,
- h,
- LISTBOX_TEXT,
- thread->data)
-{
- this->thread = thread;
- this->window = window;
-}
-
-int PresetsList::selection_changed()
-{
- window->title_text->update(
- thread->data->get(get_selection_number(0, 0))->get_text());
- return 0;
-}
-
-int PresetsList::handle_event()
-{
- window->set_done(0);
- return 0;
-}
-
-
-
-
-
-
-
-
-
-
-PresetsText::PresetsText(PresetsThread *thread,
- PresetsWindow *window,
- int x,
- int y,
- int w)
- : BC_TextBox(x,
- y,
- w,
- 1,
- "")
-{
- this->thread = thread;
- this->window = window;
-}
-
-int PresetsText::handle_event()
-{
- return 0;
-}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-PresetsDelete::PresetsDelete(PresetsThread *thread,
- PresetsWindow *window,
- int x,
- int y)
- : BC_GenericButton(x, y, _("Delete"))
-{
- this->thread = thread;
- this->window = window;
-}
-
-int PresetsDelete::handle_event()
-{
- thread->delete_preset(window->title_text->get_text());
- return 1;
-}
-
-
-
-
-
-
-
-PresetsSave::PresetsSave(PresetsThread *thread,
- PresetsWindow *window,
- int x,
- int y)
-: BC_GenericButton(x, y, _("Save"))
-{
- this->thread = thread;
- this->window = window;
-}
-
-int PresetsSave::handle_event()
-{
- thread->save_preset(window->title_text->get_text());
- return 1;
-}
-
-
-
-
-
-
-
-
-PresetsApply::PresetsApply(PresetsThread *thread,
- PresetsWindow *window,
- int x,
- int y)
- : BC_GenericButton(x, y, _("Apply"))
-{
- this->thread = thread;
- this->window = window;
-}
-
-int PresetsApply::handle_event()
-{
- thread->apply_preset(window->title_text->get_text());
- return 1;
-}
-
-
-
-PresetsOK::PresetsOK(PresetsThread *thread,
- PresetsWindow *window)
- : BC_OKButton(window)
-{
- this->thread = thread;
- this->window = window;
-}
-
-int PresetsOK::keypress_event()
-{
- if(get_keypress() == RETURN)
- {
-printf("PresetsOK::keypress_event %d\n", __LINE__);
- if(thread->presets_db->preset_exists(thread->plugin_title,
- window->title_text->get_text()))
- {
-printf("PresetsOK::keypress_event %d\n", __LINE__);
- window->set_done(0);
- return 1;
- }
- else
- {
-printf("PresetsOK::keypress_event %d\n", __LINE__);
- thread->save_preset(window->title_text->get_text());
- return 1;
- }
- }
- return 0;
-}
-
-
-
-
-
-
-
-
-
-
-PresetsWindow::PresetsWindow(MWindow *mwindow,
- PresetsThread *thread,
- int x,
- int y,
- char *title_string)
- : BC_Window(title_string,
- x,
- y,
- mwindow->session->presetdialog_w,
- mwindow->session->presetdialog_h,
- 320,
- 240,
- 1,
- 0,
- 1)
-{
- this->mwindow = mwindow;
- this->thread = thread;
-}
-
-void PresetsWindow::create_objects()
-{
- Theme *theme = mwindow->theme;
-
- lock_window("PresetsWindow::create_objects");
- theme->get_presetdialog_sizes(this);
-
- add_subwindow(title1 = new BC_Title(theme->presets_list_x,
- theme->presets_list_y - BC_Title::calculate_h(this, "P") - theme->widget_border,
- _("Saved presets:")));
- add_subwindow(list = new PresetsList(thread,
- this,
- theme->presets_list_x,
- theme->presets_list_y,
- theme->presets_list_w,
- theme->presets_list_h));
- add_subwindow(title2 = new BC_Title(theme->presets_text_x,
- theme->presets_text_y - BC_Title::calculate_h(this, "P") - theme->widget_border,
- _("Preset title:")));
- add_subwindow(title_text = new PresetsText(thread,
- this,
- theme->presets_text_x,
- theme->presets_text_y,
- theme->presets_text_w));
- add_subwindow(delete_button = new PresetsDelete(thread,
- this,
- theme->presets_delete_x,
- theme->presets_delete_y));
- add_subwindow(save_button = new PresetsSave(thread,
- this,
- theme->presets_save_x,
- theme->presets_save_y));
- add_subwindow(apply_button = new PresetsApply(thread,
- this,
- theme->presets_apply_x,
- theme->presets_apply_y));
-
- add_subwindow(new PresetsOK(thread, this));
- add_subwindow(new BC_CancelButton(this));
-
- show_window();
- unlock_window();
-}
-
-int PresetsWindow::resize_event(int w, int h)
-{
- Theme *theme = mwindow->theme;
- mwindow->session->presetdialog_w = w;
- mwindow->session->presetdialog_h = h;
- theme->get_presetdialog_sizes(this);
-
- title1->reposition_window(theme->presets_list_x,
- theme->presets_list_y - BC_Title::calculate_h(this, "P") - theme->widget_border);
- title2->reposition_window(theme->presets_text_x,
- theme->presets_text_y - BC_Title::calculate_h(this, "P") - theme->widget_border);
- list->reposition_window(theme->presets_list_x,
- theme->presets_list_y,
- theme->presets_list_w,
- theme->presets_list_h);
- title_text->reposition_window(theme->presets_text_x,
- theme->presets_text_y,
- theme->presets_text_w);
- delete_button->reposition_window(theme->presets_delete_x,
- theme->presets_delete_y);
- save_button->reposition_window(theme->presets_save_x,
- theme->presets_save_y);
- apply_button->reposition_window(theme->presets_apply_x,
- theme->presets_apply_y);
- return 0;
-}
-
-
-
-
-
-
-#endif
-
--- /dev/null
+
+/*
+ * CINELERRA
+ * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#if 0
+
+
+
+
+#include "edl.h"
+#include "keyframe.h"
+#include "keys.h"
+#include "language.h"
+#include "localsession.h"
+#include "mainsession.h"
+#include "mainundo.h"
+#include "mwindow.h"
+#include "mwindowgui.h"
+#include "plugin.h"
+#include "presets.h"
+#include "presetsgui.h"
+#include "theme.h"
+#include "trackcanvas.h"
+#include "tracks.h"
+
+
+
+
+
+
+
+
+
+
+
+PresetsThread::PresetsThread(MWindow *mwindow)
+ : BC_DialogThread()
+{
+ this->mwindow = mwindow;
+ plugin = 0;
+ data = new ArrayList<BC_ListBoxItem*>;
+ presets_db = new PresetsDB;
+ plugin_title[0] = 0;
+ window_title[0] = 0;
+}
+
+PresetsThread::~PresetsThread()
+{
+ close_window();
+ delete data;
+}
+
+void PresetsThread::calculate_list()
+{
+ data->remove_all_objects();
+ int total_presets = presets_db->get_total_presets(plugin_title);
+ for(int i = 0; i < total_presets; i++)
+ {
+ data->append(new BC_ListBoxItem(presets_db->get_preset_title(
+ plugin_title,
+ i)));
+ }
+}
+
+
+void PresetsThread::start_window(Plugin *plugin)
+{
+ if(!BC_DialogThread::is_running())
+ {
+ this->plugin = plugin;
+ plugin->calculate_title(plugin_title, 0);
+ sprintf(window_title, _(PROGRAM_NAME ": %s Presets"), plugin_title);
+
+
+// Calculate database
+ presets_db->load();
+ calculate_list();
+
+
+ mwindow->gui->unlock_window();
+ BC_DialogThread::start();
+ mwindow->gui->lock_window("PresetsThread::start_window");
+ }
+}
+
+BC_Window* PresetsThread::new_gui()
+{
+ mwindow->gui->lock_window("PresetsThread::new_gui");
+ int x = mwindow->gui->get_abs_cursor_x(0) -
+ mwindow->session->plugindialog_w / 2;
+ int y = mwindow->gui->get_abs_cursor_y(0) -
+ mwindow->session->plugindialog_h / 2;
+
+ PresetsWindow *window = new PresetsWindow(mwindow,
+ this,
+ x,
+ y,
+ window_title);
+
+ window->create_objects();
+ mwindow->gui->unlock_window();
+ return window;
+}
+
+void PresetsThread::handle_done_event(int result)
+{
+// Apply the preset
+ if(!result)
+ {
+ char *title = ((PresetsWindow*)get_gui())->title_text->get_text();
+ apply_preset(title);
+ }
+}
+
+void PresetsThread::handle_close_event(int result)
+{
+}
+
+void PresetsThread::save_preset(char *title)
+{
+ get_gui()->unlock_window();
+ mwindow->gui->lock_window("PresetsThread::save_preset");
+
+// Test EDL for plugin existence
+ if(!mwindow->edl->tracks->plugin_exists(plugin))
+ {
+ mwindow->gui->unlock_window();
+ get_gui()->lock_window("PresetsThread::save_preset 2");
+ return;
+ }
+
+
+// Get current plugin keyframe
+ EDL *edl = mwindow->edl;
+ Track *track = plugin->track;
+ KeyFrame *keyframe = plugin->get_prev_keyframe(
+ track->to_units(edl->local_session->get_selectionstart(1), 0),
+ PLAY_FORWARD);
+
+// Send to database
+ presets_db->save_preset(plugin_title, title, keyframe->get_data());
+
+ mwindow->gui->unlock_window();
+ get_gui()->lock_window("PresetsThread::save_preset 2");
+
+
+// Update list
+ calculate_list();
+ ((PresetsWindow*)get_gui())->list->update(data,
+ 0,
+ 0,
+ 1);
+}
+
+void PresetsThread::delete_preset(char *title)
+{
+ get_gui()->unlock_window();
+ mwindow->gui->lock_window("PresetsThread::save_preset");
+
+// Test EDL for plugin existence
+ if(!mwindow->edl->tracks->plugin_exists(plugin))
+ {
+ mwindow->gui->unlock_window();
+ get_gui()->lock_window("PresetsThread::delete_preset 1");
+ return;
+ }
+
+ presets_db->delete_preset(plugin_title, title);
+
+ mwindow->gui->unlock_window();
+ get_gui()->lock_window("PresetsThread::delete_preset 2");
+
+
+// Update list
+ calculate_list();
+ ((PresetsWindow*)get_gui())->list->update(data,
+ 0,
+ 0,
+ 1);
+}
+
+
+void PresetsThread::apply_preset(char *title)
+{
+ if(presets_db->preset_exists(plugin_title, title))
+ {
+ get_gui()->unlock_window();
+ mwindow->gui->lock_window("PresetsThread::apply_preset");
+
+// Test EDL for plugin existence
+ if(!mwindow->edl->tracks->plugin_exists(plugin))
+ {
+ mwindow->gui->unlock_window();
+ get_gui()->lock_window("PresetsThread::delete_preset 1");
+ return;
+ }
+
+ mwindow->undo->update_undo_before();
+ KeyFrame *keyframe = plugin->get_keyframe();
+ presets_db->load_preset(plugin_title, title, keyframe);
+ mwindow->save_backup();
+ mwindow->undo->update_undo_after(_("apply preset"), LOAD_AUTOMATION);
+
+ mwindow->update_plugin_guis();
+ mwindow->gui->canvas->draw_overlays();
+ mwindow->gui->canvas->flash();
+ mwindow->sync_parameters(CHANGE_PARAMS);
+
+ mwindow->gui->unlock_window();
+ get_gui()->lock_window("PresetsThread::apply_preset");
+ }
+}
+
+
+
+
+
+PresetsList::PresetsList(PresetsThread *thread,
+ PresetsWindow *window,
+ int x,
+ int y,
+ int w,
+ int h)
+ : BC_ListBox(x,
+ y,
+ w,
+ h,
+ LISTBOX_TEXT,
+ thread->data)
+{
+ this->thread = thread;
+ this->window = window;
+}
+
+int PresetsList::selection_changed()
+{
+ window->title_text->update(
+ thread->data->get(get_selection_number(0, 0))->get_text());
+ return 0;
+}
+
+int PresetsList::handle_event()
+{
+ window->set_done(0);
+ return 0;
+}
+
+
+
+
+
+
+
+
+
+
+PresetsText::PresetsText(PresetsThread *thread,
+ PresetsWindow *window,
+ int x,
+ int y,
+ int w)
+ : BC_TextBox(x,
+ y,
+ w,
+ 1,
+ "")
+{
+ this->thread = thread;
+ this->window = window;
+}
+
+int PresetsText::handle_event()
+{
+ return 0;
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+PresetsDelete::PresetsDelete(PresetsThread *thread,
+ PresetsWindow *window,
+ int x,
+ int y)
+ : BC_GenericButton(x, y, _("Delete"))
+{
+ this->thread = thread;
+ this->window = window;
+}
+
+int PresetsDelete::handle_event()
+{
+ thread->delete_preset(window->title_text->get_text());
+ return 1;
+}
+
+
+
+
+
+
+
+PresetsSave::PresetsSave(PresetsThread *thread,
+ PresetsWindow *window,
+ int x,
+ int y)
+: BC_GenericButton(x, y, _("Save"))
+{
+ this->thread = thread;
+ this->window = window;
+}
+
+int PresetsSave::handle_event()
+{
+ thread->save_preset(window->title_text->get_text());
+ return 1;
+}
+
+
+
+
+
+
+
+
+PresetsApply::PresetsApply(PresetsThread *thread,
+ PresetsWindow *window,
+ int x,
+ int y)
+ : BC_GenericButton(x, y, _("Apply"))
+{
+ this->thread = thread;
+ this->window = window;
+}
+
+int PresetsApply::handle_event()
+{
+ thread->apply_preset(window->title_text->get_text());
+ return 1;
+}
+
+
+
+PresetsOK::PresetsOK(PresetsThread *thread,
+ PresetsWindow *window)
+ : BC_OKButton(window)
+{
+ this->thread = thread;
+ this->window = window;
+}
+
+int PresetsOK::keypress_event()
+{
+ if(get_keypress() == RETURN)
+ {
+printf("PresetsOK::keypress_event %d\n", __LINE__);
+ if(thread->presets_db->preset_exists(thread->plugin_title,
+ window->title_text->get_text()))
+ {
+printf("PresetsOK::keypress_event %d\n", __LINE__);
+ window->set_done(0);
+ return 1;
+ }
+ else
+ {
+printf("PresetsOK::keypress_event %d\n", __LINE__);
+ thread->save_preset(window->title_text->get_text());
+ return 1;
+ }
+ }
+ return 0;
+}
+
+
+
+
+
+
+
+
+
+
+PresetsWindow::PresetsWindow(MWindow *mwindow,
+ PresetsThread *thread,
+ int x,
+ int y,
+ char *title_string)
+ : BC_Window(title_string,
+ x,
+ y,
+ mwindow->session->presetdialog_w,
+ mwindow->session->presetdialog_h,
+ 320,
+ 240,
+ 1,
+ 0,
+ 1)
+{
+ this->mwindow = mwindow;
+ this->thread = thread;
+}
+
+void PresetsWindow::create_objects()
+{
+ Theme *theme = mwindow->theme;
+
+ lock_window("PresetsWindow::create_objects");
+ theme->get_presetdialog_sizes(this);
+
+ add_subwindow(title1 = new BC_Title(theme->presets_list_x,
+ theme->presets_list_y - BC_Title::calculate_h(this, "P") - theme->widget_border,
+ _("Saved presets:")));
+ add_subwindow(list = new PresetsList(thread,
+ this,
+ theme->presets_list_x,
+ theme->presets_list_y,
+ theme->presets_list_w,
+ theme->presets_list_h));
+ add_subwindow(title2 = new BC_Title(theme->presets_text_x,
+ theme->presets_text_y - BC_Title::calculate_h(this, "P") - theme->widget_border,
+ _("Preset title:")));
+ add_subwindow(title_text = new PresetsText(thread,
+ this,
+ theme->presets_text_x,
+ theme->presets_text_y,
+ theme->presets_text_w));
+ add_subwindow(delete_button = new PresetsDelete(thread,
+ this,
+ theme->presets_delete_x,
+ theme->presets_delete_y));
+ add_subwindow(save_button = new PresetsSave(thread,
+ this,
+ theme->presets_save_x,
+ theme->presets_save_y));
+ add_subwindow(apply_button = new PresetsApply(thread,
+ this,
+ theme->presets_apply_x,
+ theme->presets_apply_y));
+
+ add_subwindow(new PresetsOK(thread, this));
+ add_subwindow(new BC_CancelButton(this));
+
+ show_window();
+ unlock_window();
+}
+
+int PresetsWindow::resize_event(int w, int h)
+{
+ Theme *theme = mwindow->theme;
+ mwindow->session->presetdialog_w = w;
+ mwindow->session->presetdialog_h = h;
+ theme->get_presetdialog_sizes(this);
+
+ title1->reposition_window(theme->presets_list_x,
+ theme->presets_list_y - BC_Title::calculate_h(this, "P") - theme->widget_border);
+ title2->reposition_window(theme->presets_text_x,
+ theme->presets_text_y - BC_Title::calculate_h(this, "P") - theme->widget_border);
+ list->reposition_window(theme->presets_list_x,
+ theme->presets_list_y,
+ theme->presets_list_w,
+ theme->presets_list_h);
+ title_text->reposition_window(theme->presets_text_x,
+ theme->presets_text_y,
+ theme->presets_text_w);
+ delete_button->reposition_window(theme->presets_delete_x,
+ theme->presets_delete_y);
+ save_button->reposition_window(theme->presets_save_x,
+ theme->presets_save_y);
+ apply_button->reposition_window(theme->presets_apply_x,
+ theme->presets_apply_y);
+ return 0;
+}
+
+
+
+
+
+
+#endif
+
+++ /dev/null
-
-/*
- * CINELERRA
- * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-
-#ifndef PRESETSGUI_H
-#define PRESETSGUI_H
-
-
-// Presets for effects & transitions
-#if 0
-
-#include "bcdialog.h"
-#include "guicast.h"
-#include "mwindow.inc"
-#include "plugin.inc"
-#include "presets.inc"
-
-class PresetsWindow;
-
-
-
-
-
-class PresetsThread : public BC_DialogThread
-{
-public:
- PresetsThread(MWindow *mwindow);
- ~PresetsThread();
-
- void calculate_list();
- void start_window(Plugin *plugin);
- BC_Window* new_gui();
- void handle_done_event(int result);
- void handle_close_event(int result);
- void save_preset(char *title);
- void delete_preset(char *title);
- void apply_preset(char *title);
-
- char window_title[BCTEXTLEN];
- char plugin_title[BCTEXTLEN];
- MWindow *mwindow;
- Plugin *plugin;
- ArrayList<BC_ListBoxItem*> *data;
- PresetsDB *presets_db;
-};
-
-class PresetsList : public BC_ListBox
-{
-public:
- PresetsList(PresetsThread *thread,
- PresetsWindow *window,
- int x,
- int y,
- int w,
- int h);
- int selection_changed();
- int handle_event();
- PresetsThread *thread;
- PresetsWindow *window;
-};
-
-class PresetsText : public BC_TextBox
-{
-public:
- PresetsText(PresetsThread *thread,
- PresetsWindow *window,
- int x,
- int y,
- int w);
- int handle_event();
- PresetsThread *thread;
- PresetsWindow *window;
-};
-
-
-class PresetsDelete : public BC_GenericButton
-{
-public:
- PresetsDelete(PresetsThread *thread,
- PresetsWindow *window,
- int x,
- int y);
- int handle_event();
- PresetsThread *thread;
- PresetsWindow *window;
-};
-
-class PresetsSave : public BC_GenericButton
-{
-public:
- PresetsSave(PresetsThread *thread,
- PresetsWindow *window,
- int x,
- int y);
- int handle_event();
- PresetsThread *thread;
- PresetsWindow *window;
-};
-
-class PresetsApply : public BC_GenericButton
-{
-public:
- PresetsApply(PresetsThread *thread,
- PresetsWindow *window,
- int x,
- int y);
- int handle_event();
- PresetsThread *thread;
- PresetsWindow *window;
-};
-
-class PresetsOK : public BC_OKButton
-{
-public:
- PresetsOK(PresetsThread *thread,
- PresetsWindow *window);
- int keypress_event();
- PresetsThread *thread;
- PresetsWindow *window;
-};
-
-
-class PresetsWindow : public BC_Window
-{
-public:
- PresetsWindow(MWindow *mwindow,
- PresetsThread *thread,
- int x,
- int y,
- char *title_string);
-
- void create_objects();
- int resize_event(int w, int h);
-
- PresetsList *list;
- PresetsText *title_text;
- PresetsDelete *delete_button;
- PresetsSave *save_button;
- PresetsApply *apply_button;
- BC_Title *title1;
- BC_Title *title2;
- MWindow *mwindow;
- PresetsThread *thread;
-};
-
-
-
-#endif
-
-#endif
-
-
-
--- /dev/null
+
+/*
+ * CINELERRA
+ * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifndef PRESETSGUI_H
+#define PRESETSGUI_H
+
+
+// Presets for effects & transitions
+#if 0
+
+#include "bcdialog.h"
+#include "guicast.h"
+#include "mwindow.inc"
+#include "plugin.inc"
+#include "presets.inc"
+
+class PresetsWindow;
+
+
+
+
+
+class PresetsThread : public BC_DialogThread
+{
+public:
+ PresetsThread(MWindow *mwindow);
+ ~PresetsThread();
+
+ void calculate_list();
+ void start_window(Plugin *plugin);
+ BC_Window* new_gui();
+ void handle_done_event(int result);
+ void handle_close_event(int result);
+ void save_preset(char *title);
+ void delete_preset(char *title);
+ void apply_preset(char *title);
+
+ char window_title[BCTEXTLEN];
+ char plugin_title[BCTEXTLEN];
+ MWindow *mwindow;
+ Plugin *plugin;
+ ArrayList<BC_ListBoxItem*> *data;
+ PresetsDB *presets_db;
+};
+
+class PresetsList : public BC_ListBox
+{
+public:
+ PresetsList(PresetsThread *thread,
+ PresetsWindow *window,
+ int x,
+ int y,
+ int w,
+ int h);
+ int selection_changed();
+ int handle_event();
+ PresetsThread *thread;
+ PresetsWindow *window;
+};
+
+class PresetsText : public BC_TextBox
+{
+public:
+ PresetsText(PresetsThread *thread,
+ PresetsWindow *window,
+ int x,
+ int y,
+ int w);
+ int handle_event();
+ PresetsThread *thread;
+ PresetsWindow *window;
+};
+
+
+class PresetsDelete : public BC_GenericButton
+{
+public:
+ PresetsDelete(PresetsThread *thread,
+ PresetsWindow *window,
+ int x,
+ int y);
+ int handle_event();
+ PresetsThread *thread;
+ PresetsWindow *window;
+};
+
+class PresetsSave : public BC_GenericButton
+{
+public:
+ PresetsSave(PresetsThread *thread,
+ PresetsWindow *window,
+ int x,
+ int y);
+ int handle_event();
+ PresetsThread *thread;
+ PresetsWindow *window;
+};
+
+class PresetsApply : public BC_GenericButton
+{
+public:
+ PresetsApply(PresetsThread *thread,
+ PresetsWindow *window,
+ int x,
+ int y);
+ int handle_event();
+ PresetsThread *thread;
+ PresetsWindow *window;
+};
+
+class PresetsOK : public BC_OKButton
+{
+public:
+ PresetsOK(PresetsThread *thread,
+ PresetsWindow *window);
+ int keypress_event();
+ PresetsThread *thread;
+ PresetsWindow *window;
+};
+
+
+class PresetsWindow : public BC_Window
+{
+public:
+ PresetsWindow(MWindow *mwindow,
+ PresetsThread *thread,
+ int x,
+ int y,
+ char *title_string);
+
+ void create_objects();
+ int resize_event(int w, int h);
+
+ PresetsList *list;
+ PresetsText *title_text;
+ PresetsDelete *delete_button;
+ PresetsSave *save_button;
+ PresetsApply *apply_button;
+ BC_Title *title1;
+ BC_Title *title2;
+ MWindow *mwindow;
+ PresetsThread *thread;
+};
+
+
+
+#endif
+
+#endif
+
+
+
+++ /dev/null
-
-/*
- * CINELERRA
- * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-
-#ifndef PRESETSGUI_INC
-#define PRESETSGUI_INC
-
-
-class PresetsThread;
-class PresetsWindow;
-
-#endif
-
-
-
-
--- /dev/null
+
+/*
+ * CINELERRA
+ * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifndef PRESETSGUI_INC
+#define PRESETSGUI_INC
+
+
+class PresetsThread;
+class PresetsWindow;
+
+#endif
+
+
+
+
add_subwindow(avc1394transport_timecode =
new BC_Title(avc1394_transport->x_end,
mwindow->theme->rmonitor_tx_y + 10,
- _("00:00:00:00"),
+ "00:00:00:00",
MEDIUM_7SEGMENT,
BLACK));
start_render();
}
else if( in_progress ) {
- ErrorBox error_box(PROGRAM_NAME ": Error",
+ ErrorBox error_box(_(PROGRAM_NAME ": Error"),
mwindow->gui->get_abs_cursor_x(1),
mwindow->gui->get_abs_cursor_y(1));
error_box.create_objects("Already rendering");
slot = profile->get_new_profile_slot();
if (slot < 0)
{
- ErrorBox error_box(PROGRAM_NAME ": Error",
+ ErrorBox error_box(_(PROGRAM_NAME ": Error"),
profile->mwindow->gui->get_abs_cursor_x(1),
profile->mwindow->gui->get_abs_cursor_y(1));
- error_box.create_objects("Maximum number of render profiles reached");
+ error_box.create_objects(_("Maximum number of render profiles reached"));
error_box.raise_window();
error_box.run_window();
return 1;
#include "rescale.h"
#include "indexable.h"
+#include "language.h"
#include "mwindow.h"
const char *Rescale::scale_types[] = {
- "None", "Scaled", "Cropped", "Filled", "Horiz Edge", "Vert Edge",
+ N_("None"), N_("Scaled"), N_("Cropped"), N_("Filled"), N_("Horiz Edge"), N_("Vert Edge"),
};
Rescale::Rescale(int w, int h, double aspect)
sprintf(string, "%.0f", thread->aspect_w);
add_subwindow(aspect_w = new ScaleAspectW(x, y, thread, &(thread->aspect_w), string));
x += 55;
- add_subwindow(new BC_Title(x, y, _(":")));
+ add_subwindow(new BC_Title(x, y, ":"));
x += 10;
sprintf(string, "%.0f", thread->aspect_h);
add_subwindow(aspect_h = new ScaleAspectH(x, y, thread, &(thread->aspect_h), string));
int w,
int h,
int cpus)
- : PluginClientWindow(PROGRAM_NAME ": Scopes",
+ : PluginClientWindow(_(PROGRAM_NAME ": Scopes"),
x,
y,
w,
this->value = value;
if(value == &gui->use_hist_parade)
{
- set_tooltip("Histogram Parade");
+ set_tooltip(_("Histogram Parade"));
}
else
if(value == &gui->use_hist)
{
- set_tooltip("Histogram");
+ set_tooltip(_("Histogram"));
}
else
if(value == &gui->use_wave_parade)
{
- set_tooltip("Waveform Parade");
+ set_tooltip(_("Waveform Parade"));
}
else
if(value == &gui->use_wave)
{
- set_tooltip("Waveform");
+ set_tooltip(_("Waveform"));
}
else
{
- set_tooltip("Vectorscope");
+ set_tooltip(_("Vectorscope"));
}
}
thread,
&(thread->new_settings->session->aspect_w)));
x += aspect_w->get_w() + 5;
- add_subwindow(new BC_Title(x, y, _(":")));
+ add_subwindow(new BC_Title(x, y, ":"));
x += 10;
add_subwindow(aspect_h = new ScaleAspectText(x,
y,
}
ShBtnErrWarn::ShBtnErrWarn(ShBtnTextWindow *st_window, int x, int y)
- : BC_CheckBox(x, y, &st_window->warn, "Warn on err exit")
+ : BC_CheckBox(x, y, &st_window->warn, _("Warn on err exit"))
{
this->st_window = st_window;
}
*cp = 0;
snprintf(ext,len,"-%s.udvd",track_title);
FILE *fp = fopen(filename, "w");
+ if( !fp ) {
+ eprintf(_("Unable to open %s:\n%m"), filename);
+ continue;
+ }
int64_t start = 0;
for( Edit *edit=track->edits->first; edit; edit=edit->next ) {
SEdit *sedit = (SEdit *)edit;
#include "overlayframe.h"
#include "patchbay.h"
#include "playtransport.h"
-#include "presetsgui.h"
+//#include "presetsgui.h"
#include "recordgui.h"
#include "recordmonitor.h"
#include "resourcepixmap.h"
#include "overlayframe.inc"
#include "patchbay.inc"
#include "preferencesthread.inc"
-#include "presetsgui.inc"
+//#include "presetsgui.inc"
#include "recordgui.inc"
#include "recordmonitor.inc"
#include "resourcepixmap.inc"
*/
#include "timeentry.h"
+#include "language.h"
#include <string.h>
TimeEntry::TimeEntry(BC_WindowBase *gui, int x, int y,
}
const char* TimeEntry::day_table[] =
{
- "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "*"
+ N_("Sun"), N_("Mon"), N_("Tue"), N_("Wed"), N_("Thu"), N_("Fri"), N_("Sat"), "*"
};
int TimeEntry::day_to_int(const char *day)
{
for(int i = 0; i < TOTAL_DAYS; i++)
- if(!strcasecmp(day, day_table[i])) return i;
+ if(!strcasecmp(day, _(day_table[i]))) return i;
return 0;
}
int x, int y, int w,
const char **table, int table_items,
const char *text)
- : BC_TextBox(x, y, w, 1, text)
+ : BC_TextBox(x, y, w, 1, _(text))
{
this->timeentry = timeentry;
this->table = table;
*timeentry->output_day += 1;
if(*timeentry->output_day >= text->table_items)
*timeentry->output_day = 0;
- text->update(text->table[*timeentry->output_day]);
+ text->update(_(text->table[*timeentry->output_day]));
return timeentry->handle_event();
}
*timeentry->output_day -= 1;
if(*timeentry->output_day < 0)
*timeentry->output_day = text->table_items - 1;
- text->update(text->table[*timeentry->output_day]);
+ text->update(_(text->table[*timeentry->output_day]));
return timeentry->handle_event();
}
#include "bclistbox.h"
#include "bclistboxitem.h"
#include "bcrecentlist.h"
+#include "language.h"
// NOTE: textbox can be NULL if no textbox is associated
BC_RecentList::BC_RecentList(const char *type, BC_Hash *defaults,
this->type = type;
this->defaults = defaults;
this->textbox = textbox;
- set_tooltip("Choose from recently used");
+ set_tooltip(_("Choose from recently used"));
}
BC_RecentList::BC_RecentList(const char *type, BC_Hash *defaults,
this->type = type;
this->defaults = defaults;
this->textbox = textbox;
- set_tooltip("Choose from recently used");
+ set_tooltip(_("Choose from recently used"));
}
BC_RecentList::BC_RecentList(const char *type, BC_Hash *defaults)
x = x1;
add_subwindow(normalize = new EchoCancelNormalize(plugin, x, y));
x += normalize->get_w() + 3*pad;
- y += normalize->get_h() - BC_Title::calculate_h(this,"Gain: ");
+ y += normalize->get_h() - BC_Title::calculate_h(this,_("Gain: "));
add_subwindow(gain_title = new EchoCancelTitle(x, y, _("Gain: "), 0.));
x += gain_title->get_w() + 2*pad;
add_subwindow(offset_title = new EchoCancelTitle(x, y, _("Offset: "), 0));
y = y1;
add_subwindow(freq_title = new BC_Title(x, y, _("0 Hz")));
y += freq_title->get_h() + pad;
- add_subwindow(amplitude_title = new BC_Title(x, y, "Amplitude: 0 dB"));
+ add_subwindow(amplitude_title = new BC_Title(x, y, _("Amplitude: 0 dB")));
show_window();
}
int freq = plugin->header.sample_rate / offset;
int msecs = 1000. / freq;
char string[BCTEXTLEN];
- sprintf(string, "%d Hz, %d ms (%d))", freq, msecs, (int)offset);
+ sprintf(string, _("%d Hz, %d ms (%d))"), freq, msecs, (int)offset);
freq_title->update(string);
int frm_sz1 = frm->size()-1;
if( freq_pixel > frm_sz1 ) freq_pixel = frm_sz1;
float *frame_data = frm->samples();
double level = frame_data[freq_pixel];
double scale = frm->scale();
- sprintf(string, "Amplitude: %.3f (%.6g)", level, scale);
+ sprintf(string, _("Amplitude: %.3f (%.6g)"), level, scale);
amplitude_title->update(string);
}
if( y >= 0 ) {
TimeFrontWindow *gui,
int x,
int y)
- : BC_PopupMenu(x, y, 190, to_text(plugin->config.shape), 1)
+ : BC_PopupMenu(x, y, 230, to_text(plugin->config.shape), 1)
{
this->plugin = plugin;
this->gui = gui;
TimeFrontRate::TimeFrontRate(TimeFrontMain *plugin, int x, int y)
: BC_PopupMenu(x,
y,
- 100,
+ 155,
to_text(plugin->config.rate),
1)
{
if( !fp ) return 0;
fputs((const char*)bp, fp);
fputc('\n',fp);
- return 1;
+ int n = 1;
+ while( *bp ) if( *bp++ == '\n' ) ++n;
+ return n;
}
static inline int bput(uint8_t *bp, FILE *fp)
{
while( bgets(ibfr, sizeof(ibfr), ifp) ) {
if( !prefix_is(ibfr, "msgid ") ) {
if( nocmts && ibfr[0] == '#' ) continue;
- bputs(ibfr, ofp); ++no;
+ no += bputs(ibfr, ofp);
continue;
}
uint8_t str[MX_STR]; xlat2(&ibfr[6], str);
fprintf(stderr, "file truncated line %d: %s", no, ibfr);
exit(1);
}
- bputs(ibfr, ofp); ++no;
+ no += bputs(ibfr, ofp);
while( tbfr[0] == '"' ) {
- bputs(tbfr, ofp); ++no;
+ no += bputs(tbfr, ofp);
xlat2(&tbfr[0], str); key.append((const char*)str);
if( !bgets(tbfr, sizeof(tbfr), ifp) ) {
fprintf(stderr, "file truncated line %d: %s", no, ibfr);
if( it == trans.end() || it->first.compare(key) ) {
fprintf(stderr, "no trans line %d: %s\n", no, ibfr);
xlat3(key.c_str(), &tbfr[7]);
- bputs(tbfr, ofp); ++no;
- bputs((uint8_t*)"#msgstr \"\"", ofp); ++no;
+ no += bputs(tbfr, ofp);
+ no += bputs((uint8_t*)"#msgstr \"\"", ofp);
}
else if( !it->second.ok ) {
fprintf(stderr, "bad fmt line %d: %s\n", no, ibfr);
xlat3(it->first.c_str(), &tbfr[7]);
- bputs(tbfr, ofp); ++no;
+ no += bputs(tbfr, ofp);
xlat3(it->second.c_str(), str);
bput((uint8_t*)"#msgstr ", ofp);
- bputs(str, ofp); ++no;
+ no += bputs(str, ofp);
}
else {
xlat3(it->second.c_str(), &tbfr[7]);
- bputs(tbfr, ofp); ++no;
+ no += bputs(tbfr, ofp);
}
}
if( ifp != stdin ) fclose(ifp);