{ "1920x1080 24p", 1920,1080, 24., 1, ILACE_MODE_NOTINTERLACED },
{ "1920x1080 25i", 1920,1080, 25., 1, ILACE_MODE_TOP_FIRST },
{ "1920x1080 23.976p", 1920,1080, 23.976, 1, ILACE_MODE_NOTINTERLACED },
- { "1440x1080 29.97i", 1440,1080, 29.97, 0, ILACE_MODE_TOP_FIRST },
- { "1440x1080 25i", 1440,1080, 25., 0, ILACE_MODE_TOP_FIRST },
- { "1440x1080 24p", 1440,1080, 24., 0, ILACE_MODE_NOTINTERLACED },
- { "1440x1080 23.976p", 1440,1080, 23.976, 0, ILACE_MODE_NOTINTERLACED },
+ { "1440x1080 29.97i", 1440,1080, 29.97, 1, ILACE_MODE_TOP_FIRST },
+ { "1440x1080 25i", 1440,1080, 25., 1, ILACE_MODE_TOP_FIRST },
+ { "1440x1080 24p", 1440,1080, 24., 1, ILACE_MODE_NOTINTERLACED },
+ { "1440x1080 23.976p", 1440,1080, 23.976, 1, ILACE_MODE_NOTINTERLACED },
{ "1280x720 59.94p", 1280,720, 59.94, 1, ILACE_MODE_NOTINTERLACED },
{ "1280x720 50p", 1280,720, 50., 1, ILACE_MODE_NOTINTERLACED },
- { "1280x720 23.976p", 1280,720, 23.976, 1, ILACE_MODE_NOTINTERLACED },
{ "1280x720 24p", 1280,720, 24., 1, ILACE_MODE_NOTINTERLACED },
+ { "1280x720 23.976p", 1280,720, 23.976, 1, ILACE_MODE_NOTINTERLACED },
{ "720x576 25p*", 720,576, 25., 0, ILACE_MODE_NOTINTERLACED },
{ "720x576 25i", 720,576, 25., 0, ILACE_MODE_BOTTOM_FIRST },
{ "720x480 29.97p*", 720,480, 29.97, 0, ILACE_MODE_NOTINTERLACED },
const double CreateBD_Thread::BD_ASPECT_WIDTH = 4.;
const double CreateBD_Thread::BD_ASPECT_HEIGHT = 3.;
const double CreateBD_Thread::BD_FRAMERATE = 24000. / 1001.;
-//const int CreateBD_Thread::BD_MAX_BITRATE = 40000000;
-const int CreateBD_Thread::BD_MAX_BITRATE = 8000000;
+const int CreateBD_Thread::BD_MAX_BITRATE = 40000000;
+//const int CreateBD_Thread::BD_MAX_BITRATE = 8000000;
const int CreateBD_Thread::BD_CHANNELS = 2;
const int CreateBD_Thread::BD_WIDE_CHANNELS = 6;
const double CreateBD_Thread::BD_SAMPLERATE = 48000;
-const double CreateBD_Thread::BD_KAUDIO_RATE = 224;
+const double CreateBD_Thread::BD_KAUDIO_RATE = 192;
const int CreateBD_Thread::BD_INTERLACE_MODE = ILACE_MODE_NOTINTERLACED;
CreateBD_MenuItem::CreateBD_MenuItem(MWindow *mwindow)
BC_TumbleTextBox::create_objects();
}
+int FFMpegConfigNum::update_text(const char *text)
+{
+ BC_TumbleTextBox::update(text);
+ return handle_event();
+}
+
int FFMpegConfigNum::handle_event()
{
*output = atol(get_text());
return BC_RGB888;
}
+
+int FileFFMPEG::get_ff_option(const char *nm, const char *options, char *value)
+{
+ for( const char *cp=options; *cp!=0; ) {
+ char line[BCTEXTLEN], *bp = line, *ep = bp+sizeof(line)-1;
+ while( bp < ep && *cp && *cp!='\n' ) *bp++ = *cp++;
+ if( *cp ) ++cp;
+ *bp = 0;
+ if( !line[0] || line[0] == '#' || line[0] == ';' ) continue;
+ char key[BCSTRLEN], val[BCTEXTLEN];
+ if( FFMPEG::scan_option_line(line, key, val) ) continue;
+ if( !strcmp(key, nm) ) {
+ strcpy(value, val);
+ return 0;
+ }
+ }
+ return 1;
+}
+
//======
FFMPEGConfigAudio::FFMPEGConfigAudio(BC_WindowBase *parent_window, Asset *asset)
add_subwindow(new BC_OKButton(this));
add_subwindow(new BC_CancelButton(this));
+ char value[BCTEXTLEN];
+ if( !FileFFMPEG::get_ff_option("cin_bitrate", asset->ff_audio_options, value) )
+ bitrate->update_text(value);
+
show_window(1);
bitrate->handle_event();
unlock_window();
FFMPEG::load_options(option_path, asset->ff_audio_options,
sizeof(asset->ff_audio_options));
popup->audio_options->update(asset->ff_audio_options);
+
+ char value[BCTEXTLEN];
+ if( !FileFFMPEG::get_ff_option("cin_bitrate", asset->ff_audio_options, value) )
+ popup->bitrate->update_text(value);
return 1;
}
add_subwindow(new BC_OKButton(this));
add_subwindow(new BC_CancelButton(this));
+ char value[BCTEXTLEN];
+ if( !FileFFMPEG::get_ff_option("cin_quality", asset->ff_video_options, value) )
+ quality->update_text(value);
+ if( !FileFFMPEG::get_ff_option("cin_bitrate", asset->ff_video_options, value) )
+ bitrate->update_text(value);
+
show_window(1);
if( asset->ff_video_bitrate )
quality->disable();
FFMPEG::load_options(option_path, asset->ff_video_options,
sizeof(asset->ff_video_options));
popup->video_options->update(asset->ff_video_options);
+
+ char value[BCTEXTLEN];
+ if( !FileFFMPEG::get_ff_option("cin_quality", asset->ff_video_options, value) ) {
+ popup->quality->update_text(value);
+ }
+ if( !FileFFMPEG::get_ff_option("cin_bitrate", asset->ff_video_options, value) )
+ popup->bitrate->update_text(value);
return 1;
}
int &width, int &height, char *title=0);
int get_audio_for_video(int vstream, int astream, int64_t &channel_mask);
static void get_info(char *path,char *text,int len);
+ static int get_ff_option(const char *nm, const char *options, char *value);
int open_file(int rd,int wr);
int get_index(IndexFile *index_file, MainProgressBar *progress_bar);
int close_file(void);
~FFMpegConfigNum();
void create_objects();
+ int update_text(const char *text);
int handle_event();
int *output;
BC_Window *window;
text_selected = 0;
word_selected = 0;
line_selected = 0;
+ unicode_active = -1;
text_x = 0;
enabled = 1;
highlighted = 0;
if(k > top_margin-text_height && k < get_h()-bottom_margin) {
// Draw highlighted region of row
- if(highlight_letter2 > highlight_letter1 &&
- highlight_letter2 > row_begin &&
- highlight_letter1 <= row_end) {
- if(active && enabled && get_has_focus())
- set_color(resources->text_highlight);
- else
- set_color(resources->text_inactive_highlight);
-
+ if( highlight_letter2 > highlight_letter1 &&
+ highlight_letter2 > row_begin &&
+ highlight_letter1 <= row_end ) {
+ int color = active && enabled && get_has_focus() ?
+ resources->text_highlight :
+ resources->text_inactive_highlight;
+ if( unicode_active >= 0 )
+ color ^= LTBLUE;
+ set_color(color);
if(highlight_letter1 >= row_begin &&
highlight_letter1 <= row_end)
highlight_x1 = positions[highlight_letter1];
void BC_TextBox::default_keypress(int &dispatch_event, int &result)
{
- if((top_level->get_keypress() == RETURN) ||
- (top_level->get_keypress() > 30 && top_level->get_keypress() <= 255))
- {
+ if( (top_level->get_keypress() == RETURN) ||
+ (top_level->get_keypress() > 30 && top_level->get_keypress() <= 255)) {
int len;
wchar_t *temp_string = top_level->get_wkeystring(&len);
if(top_level->get_keypress() == RETURN) {
int wtext_len = wtext_update();
last_keypress = get_keypress();
+
+ if( unicode_active >= 0 ) {
+ wchar_t wch = 0;
+ int wlen = -1;
+ switch( last_keypress ) {
+//unicode active acitons
+ case ESC: {
+ unicode_active = -1;
+ result = 1;
+ wlen = 0;
+ break; }
+ case RETURN: {
+ for( int i=highlight_letter1+1; i<highlight_letter2; ++i ) {
+ int ch = nib(wtext[i]);
+ if( ch < 0 ) return 1;
+ wch = (wch<<4) + ch;
+ }
+ unicode_active = -1;
+ dispatch_event = 1;
+ result = 1;
+ wlen = 1;
+ break; }
+ case BACKSPACE: {
+ if(ibeam_letter > 0) {
+ delete_selection(ibeam_letter - 1, ibeam_letter, wtext_len);
+ highlight_letter2 = --ibeam_letter;
+ if( highlight_letter1 >= highlight_letter2 )
+ unicode_active = -1;
+ }
+ result = 1;
+ wlen = 0;
+ break; }
+ case '0': case '1': case '2': case '3': case '4':
+ case '5': case '6': case '7': case '8': case '9':
+ case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
+ case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': {
+ int n = nib(last_keypress);
+ wch = n < 10 ? '0'+n : 'A'+n-10;
+ result = 1;
+ wlen = 1;
+ break; }
+//normal actions
+ case TAB:
+ case LEFTTAB:
+ break;
+//ignored actions
+ default:
+ result = 1;
+ break;
+ }
+ if( wlen >= 0 ) {
+ insert_text(&wch, wlen);
+ find_ibeam(1);
+ if( unicode_active >= 0 )
+ highlight_letter2 = ibeam_letter;
+ else
+ highlight_letter1 = highlight_letter2 = 0;
+ draw(1);
+ }
+ }
+
+ if( !result ) {
//printf("BC_TextBox::keypress_event %d %x\n", __LINE__, last_keypress)
- switch(last_keypress)
- {
- case ESC:
+ switch(last_keypress) {
+ case ESC: {
// Deactivate the suggestions
- if(suggestions && suggestions_popup)
- {
+ if(suggestions && suggestions_popup) {
delete suggestions_popup;
suggestions_popup = 0;
result = 1;
}
- else
- {
+ else {
top_level->deactivate();
result = 0;
}
- break;
-
-
-
-
+ break; }
- case RETURN:
- if(rows == 1)
- {
+ case RETURN: {
+ if( rows == 1 ) {
top_level->deactivate();
dispatch_event = 1;
result = 0;
}
- else
- {
+ else {
default_keypress(dispatch_event, result);
}
- break;
-
-
+ break; }
// Handle like a default keypress
- case TAB:
+ case TAB: {
top_level->cycle_textboxes(1);
result = 1;
- break;
-
-
+ break; }
- case LEFTTAB:
+ case LEFTTAB: {
top_level->cycle_textboxes(-1);
result = 1;
- break;
+ break; }
- case LEFT:
- if(ibeam_letter > 0)
- {
+ case LEFT: {
+ if(ibeam_letter > 0) {
int old_ibeam_letter = ibeam_letter;
// Single character
- if(!ctrl_down())
- {
+ if(!ctrl_down()) {
ibeam_letter--;
}
- else
+ else {
// Word
- {
ibeam_letter--;
while(ibeam_letter > 0 && isalnum(wtext[ibeam_letter - 1]))
ibeam_letter--;
}
-
// Extend selection
- if(top_level->shift_down())
- {
+ if(top_level->shift_down()) {
// Initialize highlighting
- if(highlight_letter1 == highlight_letter2)
- {
+ if(highlight_letter1 == highlight_letter2) {
highlight_letter1 = ibeam_letter;
highlight_letter2 = old_ibeam_letter;
}
- else
+ else if(highlight_letter1 == old_ibeam_letter) {
// Extend left highlight
- if(highlight_letter1 == old_ibeam_letter)
- {
highlight_letter1 = ibeam_letter;
}
- else
+ else if(highlight_letter2 == old_ibeam_letter) {
// Shrink right highlight
- if(highlight_letter2 == old_ibeam_letter)
- {
highlight_letter2 = ibeam_letter;
}
}
- else
- {
+ else {
highlight_letter1 = highlight_letter2 = ibeam_letter;
}
if(keypress_draw) draw(1);
}
result = 1;
- break;
+ break; }
- case RIGHT:
- if(ibeam_letter < wtext_len)
- {
+ case RIGHT: {
+ if(ibeam_letter < wtext_len) {
int old_ibeam_letter = ibeam_letter;
// Single character
- if(!ctrl_down())
- {
+ if(!ctrl_down()) {
ibeam_letter++;
}
- else
+ else {
// Word
- {
- while(ibeam_letter < wtext_len && isalnum(wtext[ibeam_letter++]))
- ;
+ while(ibeam_letter < wtext_len && isalnum(wtext[ibeam_letter++]));
}
// Extend selection
- if(top_level->shift_down())
- {
+ if(top_level->shift_down()) {
// Initialize highlighting
- if(highlight_letter1 == highlight_letter2)
- {
+ if(highlight_letter1 == highlight_letter2) {
highlight_letter1 = old_ibeam_letter;
highlight_letter2 = ibeam_letter;
}
- else
+ else if(highlight_letter1 == old_ibeam_letter) {
// Shrink left highlight
- if(highlight_letter1 == old_ibeam_letter)
- {
highlight_letter1 = ibeam_letter;
}
- else
+ else if(highlight_letter2 == old_ibeam_letter) {
// Expand right highlight
- if(highlight_letter2 == old_ibeam_letter)
- {
highlight_letter2 = ibeam_letter;
}
}
- else
- {
+ else {
highlight_letter1 = highlight_letter2 = ibeam_letter;
}
if(keypress_draw) draw(1);
}
result = 1;
- break;
+ break; }
- case UP:
- if(suggestions && suggestions_popup)
- {
+ case UP: {
+ if(suggestions && suggestions_popup) {
// Pass to suggestions popup
//printf("BC_TextBox::keypress_event %d\n", __LINE__);
suggestions_popup->activate(1);
suggestions_popup->keypress_event();
result = 1;
}
- else
- if(ibeam_letter > 0)
- {
+ else if(ibeam_letter > 0) {
//printf("BC_TextBox::keypress_event 1 %d %d %d\n", ibeam_x, ibeam_y, ibeam_letter);
int new_letter = get_cursor_letter2(ibeam_x + text_x,
ibeam_y + text_y - text_height);
//printf("BC_TextBox::keypress_event 2 %d %d %d\n", ibeam_x, ibeam_y, new_letter);
// Extend selection
- if(top_level->shift_down())
- {
+ if(top_level->shift_down()) {
// Initialize highlighting
- if(highlight_letter1 == highlight_letter2)
- {
+ if(highlight_letter1 == highlight_letter2) {
highlight_letter1 = new_letter;
highlight_letter2 = ibeam_letter;
}
- else
+ else if(highlight_letter1 == ibeam_letter) {
// Expand left highlight
- if(highlight_letter1 == ibeam_letter)
- {
highlight_letter1 = new_letter;
}
- else
+ else if(highlight_letter2 == ibeam_letter) {
// Shrink right highlight
- if(highlight_letter2 == ibeam_letter)
- {
highlight_letter2 = new_letter;
}
}
else
highlight_letter1 = highlight_letter2 = new_letter;
- if(highlight_letter1 > highlight_letter2)
- {
+ if(highlight_letter1 > highlight_letter2) {
int temp = highlight_letter1;
highlight_letter1 = highlight_letter2;
highlight_letter2 = temp;
if(keypress_draw) draw(1);
}
result = 1;
- break;
+ break; }
- case PGUP:
- if(ibeam_letter > 0)
- {
+ case PGUP: {
+ if(ibeam_letter > 0) {
int new_letter = get_cursor_letter2(ibeam_x + text_x,
ibeam_y + text_y - get_h());
// Extend selection
- if(top_level->shift_down())
- {
+ if(top_level->shift_down()) {
// Initialize highlighting
- if(highlight_letter1 == highlight_letter2)
- {
+ if(highlight_letter1 == highlight_letter2) {
highlight_letter1 = new_letter;
highlight_letter2 = ibeam_letter;
}
- else
+ else if(highlight_letter1 == ibeam_letter) {
// Expand left highlight
- if(highlight_letter1 == ibeam_letter)
- {
highlight_letter1 = new_letter;
}
- else
+ else if(highlight_letter2 == ibeam_letter) {
// Shrink right highlight
- if(highlight_letter2 == ibeam_letter)
- {
highlight_letter2 = new_letter;
}
}
else
highlight_letter1 = highlight_letter2 = new_letter;
- if(highlight_letter1 > highlight_letter2)
- {
+ if(highlight_letter1 > highlight_letter2) {
int temp = highlight_letter1;
highlight_letter1 = highlight_letter2;
highlight_letter2 = temp;
if(keypress_draw) draw(1);
}
result = 1;
- break;
+ break; }
- case DOWN:
+ case DOWN: {
// printf("BC_TextBox::keypress_event %d %p %p\n",
// __LINE__,
// suggestions,
// suggestions_popup);
- if(suggestions && suggestions_popup)
- {
+ if(suggestions && suggestions_popup) {
// Pass to suggestions popup
suggestions_popup->activate(1);
suggestions_popup->keypress_event();
ibeam_y + text_y + text_height);
//printf("BC_TextBox::keypress_event 10 %d\n", new_letter);
- if(top_level->shift_down())
- {
+ if(top_level->shift_down()) {
// Initialize highlighting
- if(highlight_letter1 == highlight_letter2)
- {
+ if(highlight_letter1 == highlight_letter2) {
highlight_letter1 = new_letter;
highlight_letter2 = ibeam_letter;
}
- else
+ else if(highlight_letter1 == ibeam_letter) {
// Shrink left highlight
- if(highlight_letter1 == ibeam_letter)
- {
highlight_letter1 = new_letter;
}
- else
+ else if(highlight_letter2 == ibeam_letter) {
// Expand right highlight
- if(highlight_letter2 == ibeam_letter)
- {
highlight_letter2 = new_letter;
}
}
else
highlight_letter1 = highlight_letter2 = new_letter;
- if(highlight_letter1 > highlight_letter2)
- {
+ if(highlight_letter1 > highlight_letter2) {
int temp = highlight_letter1;
highlight_letter1 = highlight_letter2;
highlight_letter2 = temp;
//printf("BC_TextBox::keypress_event 20 %d\n", ibeam_letter);
}
result = 1;
- break;
+ break; }
- case PGDN:
- {
+ case PGDN: {
// Extend selection
- int new_letter = get_cursor_letter2(ibeam_x + text_x,
- ibeam_y + text_y + get_h());
+ int new_letter = get_cursor_letter2(ibeam_x + text_x,
+ ibeam_y + text_y + get_h());
//printf("BC_TextBox::keypress_event 10 %d\n", new_letter);
- if(top_level->shift_down())
- {
+ if(top_level->shift_down()) {
// Initialize highlighting
- if(highlight_letter1 == highlight_letter2)
- {
- highlight_letter1 = new_letter;
- highlight_letter2 = ibeam_letter;
- }
- else
+ if(highlight_letter1 == highlight_letter2) {
+ highlight_letter1 = new_letter;
+ highlight_letter2 = ibeam_letter;
+ }
+ else if(highlight_letter1 == ibeam_letter) {
// Shrink left highlight
- if(highlight_letter1 == ibeam_letter)
- {
- highlight_letter1 = new_letter;
- }
- else
+ highlight_letter1 = new_letter;
+ }
+ else if(highlight_letter2 == ibeam_letter) {
// Expand right highlight
- if(highlight_letter2 == ibeam_letter)
- {
- highlight_letter2 = new_letter;
- }
+ highlight_letter2 = new_letter;
}
- else
- highlight_letter1 = highlight_letter2 = new_letter;
+ }
+ else
+ highlight_letter1 = highlight_letter2 = new_letter;
- if(highlight_letter1 > highlight_letter2)
- {
- int temp = highlight_letter1;
- highlight_letter1 = highlight_letter2;
- highlight_letter2 = temp;
- }
- ibeam_letter = new_letter;
+ if(highlight_letter1 > highlight_letter2) {
+ int temp = highlight_letter1;
+ highlight_letter1 = highlight_letter2;
+ highlight_letter2 = temp;
+ }
+ ibeam_letter = new_letter;
- find_ibeam(1);
- if(keypress_draw) draw(1);
+ find_ibeam(1);
+ if(keypress_draw) draw(1);
//printf("BC_TextBox::keypress_event 20 %d\n", ibeam_letter);
- }
result = 1;
- break;
+ break; }
- case END:
- {
+ case END: {
delete suggestions_popup;
suggestions_popup = 0;
while(ibeam_letter < wtext_len && wtext[ibeam_letter] != '\n')
ibeam_letter++;
- if(top_level->shift_down())
- {
+ if(top_level->shift_down()) {
// Begin selection
- if(highlight_letter1 == highlight_letter2)
- {
+ if(highlight_letter1 == highlight_letter2) {
highlight_letter2 = ibeam_letter;
highlight_letter1 = old_ibeam_letter;
}
- else
+ else if(highlight_letter1 == old_ibeam_letter) {
// Shrink selection
- if(highlight_letter1 == old_ibeam_letter)
- {
highlight_letter1 = highlight_letter2;
highlight_letter2 = ibeam_letter;
}
- else
+ else if(highlight_letter2 == old_ibeam_letter) {
// Extend selection
- if(highlight_letter2 == old_ibeam_letter)
- {
highlight_letter2 = ibeam_letter;
}
}
find_ibeam(1);
if(keypress_draw) draw(1);
result = 1;
- break;
- }
+ break; }
- case HOME:
- {
+ case HOME: {
delete suggestions_popup;
suggestions_popup = 0;
find_ibeam(1);
if(keypress_draw) draw(1);
result = 1;
- break;
- }
+ break; }
- case BACKSPACE:
- if(suggestions_popup)
- {
+ case BACKSPACE: {
+ if(suggestions_popup) {
delete suggestions_popup;
suggestions_popup = 0;
}
- if(highlight_letter1 == highlight_letter2)
- {
- if(ibeam_letter > 0)
- {
+ if(highlight_letter1 == highlight_letter2) {
+ if(ibeam_letter > 0) {
delete_selection(ibeam_letter - 1, ibeam_letter, wtext_len);
ibeam_letter--;
}
}
- else
- {
+ else {
delete_selection(highlight_letter1, highlight_letter2, wtext_len);
highlight_letter2 = ibeam_letter = highlight_letter1;
}
if(keypress_draw) draw(1);
dispatch_event = 1;
result = 1;
- break;
+ break; }
- case DELETE:
+ case DELETE: {
//printf("BC_TextBox::keypress_event %d\n", __LINE__);
- if(highlight_letter1 == highlight_letter2)
- {
- if(ibeam_letter < wtext_len)
- {
+ if(highlight_letter1 == highlight_letter2) {
+ if(ibeam_letter < wtext_len) {
delete_selection(ibeam_letter, ibeam_letter + 1, wtext_len);
}
}
- else
- {
+ else {
delete_selection(highlight_letter1, highlight_letter2, wtext_len);
highlight_letter2 = ibeam_letter = highlight_letter1;
}
if(keypress_draw) draw(1);
dispatch_event = 1;
result = 1;
- break;
-
+ break; }
-
- default:
- if(ctrl_down())
- {
- if(get_keypress() == 'c' || get_keypress() == 'C')
- {
- if(highlight_letter1 != highlight_letter2)
- {
+ default: {
+ if( ctrl_down() ) {
+ switch( get_keypress() ) {
+ case 'c': case 'C': {
+ if(highlight_letter1 != highlight_letter2) {
copy_selection(SECONDARY_SELECTION);
result = 1;
}
- }
- else
- if(get_keypress() == 'v' || get_keypress() == 'V')
- {
+ break; }
+ case 'v': case 'V': {
paste_selection(SECONDARY_SELECTION);
find_ibeam(1);
if(keypress_draw) draw(1);
dispatch_event = 1;
result = 1;
- }
- else
- if(get_keypress() == 'x' || get_keypress() == 'X')
- {
- if(highlight_letter1 != highlight_letter2)
- {
+ break; }
+ case 'x': case 'X': {
+ if(highlight_letter1 != highlight_letter2) {
copy_selection(SECONDARY_SELECTION);
delete_selection(highlight_letter1, highlight_letter2, wtext_len);
highlight_letter2 = ibeam_letter = highlight_letter1;
if(keypress_draw) draw(1);
dispatch_event = 1;
result = 1;
+ break; }
+ case 'u': case 'U': {
+ if( shift_down() ) {
+ unicode_active = ibeam_letter;
+ wchar_t wkey = 'U';
+ insert_text(&wkey, 1);
+ find_ibeam(1);
+ highlight_letter1 = unicode_active;
+ highlight_letter2 = ibeam_letter;
+ draw(1);
+ result = 1;
+ }
+ break; }
}
-
break;
}
default_keypress(dispatch_event, result);
- break;
+ break; }
+ }
}
if(result) skip_cursor->update();
if(dispatch_event && handle_event())
result = 1;
+
return result;
}
-
int BC_TextBox::uses_text()
{
return 1;
{
if( len < 0 ) len = wcslen(wcp);
int wtext_len = wtext_update();
- if(highlight_letter1 < highlight_letter2)
- {
+ if( unicode_active < 0 && highlight_letter1 < highlight_letter2 ) {
delete_selection(highlight_letter1, highlight_letter2, wtext_len);
highlight_letter2 = ibeam_letter = highlight_letter1;
wtext_len = wtext_update();
}
-
int i, j;
for(i=wtext_len-1, j=wtext_len+len-1; i>=ibeam_letter; i--, j--) {
if( j >= wsize ) continue;
class BC_TextBox : public BC_SubWindow
{
+ static inline int nib(int ch) {
+ if( ch >= '0' && ch <= '9' ) ch -= '0';
+ else if( ch >= 'A' && ch <= 'F' ) ch -= 'A'-10;
+ else if( ch >= 'a' && ch <= 'f' ) ch -= 'a'-10;
+ else ch = -1;
+ return ch;
+ }
+
char *text;
wchar_t *wtext;
public:
// Top left of cursor relative to text
int ibeam_x, ibeam_y;
- int ibeam_letter;
+ int ibeam_letter, unicode_active;
int highlight_letter1, highlight_letter2;
int highlight_letter3, highlight_letter4;
int text_x1, text_start, text_end;
$(OBJDIR)/bluebanana.o: bluebanana.C
$(OBJDIR)/bluebananaconfig.o: bluebananaconfig.C
$(OBJDIR)/bluebananaslider.o: bluebananaslider.C
-$(OBJDIR)/bluebananawindow.o: bluebananawindow.C
+$(OBJDIR)/bluebananawindow.o: bluebananawindow.C bluebananacolor.c
$(OBJDIR)/bluebananalookups.o: bluebananalookups.C
-$(OBJDIR)/bluebananaengine.o: bluebananaengine.C
+$(OBJDIR)/bluebananaengine.o: bluebananaengine.C bluebananacolor.c
output.tag.set_property("OPACITY_ADJUST_ACTIVE", config.Oadj_active);
output.tag.set_property("OPACITY_ADJUST", config.Oadj_val);
+ output.tag.set_property("ALPHA_ADJUST_ACTIVE", config.Aadj_active);
+ output.tag.set_property("ALPHA_ADJUST", config.Aadj_val);
output.append_tag();
output.append_newline();
config.Oadj_active = input.tag.get_property("OPACITY_ADJUST_ACTIVE", config.Oadj_active);
config.Oadj_val = input.tag.get_property("OPACITY_ADJUST", config.Oadj_val);
+ config.Aadj_active = input.tag.get_property("ALPHA_ADJUST_ACTIVE", config.Aadj_active);
+ config.Aadj_val = input.tag.get_property("ALPHA_ADJUST", config.Aadj_val);
}
}
}
}
+static inline void Aal_to_alp8(float *S, float F, unsigned char *row, int w, int bpp){
+ F = 1.f - F;
+ while(w--){
+ float a = (1 - *S*F)*255.f +.5f;
+ row[3] = CLAMP(a,0,255);
+ row+=bpp; ++S;
+ }
+}
+
+
static inline void RGB_to_rgbF(float *R, float *G, float *B, float *S, float F, float *row, int w, int bpp){
if(F>SELECT_THRESH){
if(S){
}
}
+static inline void Aal_to_alpF(float *S, float F, float *row, int w, int bpp){
+ F = 1.f - F;
+ while(w--){
+ float a = 1.f - *S*F;
+ row[3] = a;
+ row+=bpp;
+ }
+}
+
+
static inline void unmask_rgba8(unsigned char *row,int w){
while(w--){
row[3] = 255;
Oadj_active=0;
Oadj_val=100;
+ Aadj_active=0;
+ Aadj_val=100;
}
if(Oadj_active != that.Oadj_active) return 0;
if(Oadj_val != that.Oadj_val) return 0;
+ if(Aadj_active != that.Aadj_active) return 0;
+ if(Aadj_val != that.Aadj_val) return 0;
if(Sadj_active != that.Sadj_active) return 0;
if(Sadj_gamma != that.Sadj_gamma) return 0;
int Oadj_active;
float Oadj_val;
+ int Aadj_active;
+ float Aadj_val;
};
float Gas = plugin->green_adj_toe_slope;
float Bas = plugin->blue_adj_toe_slope;
- float Aal = plugin->config.Oadj_active ? plugin->config.Oadj_val*.01 : 1.f;
+ float Oal = plugin->config.Oadj_active ? plugin->config.Oadj_val*.01 : 1.f;
+ float Aal = plugin->config.Aadj_active ? plugin->config.Aadj_val*.01 : 1.f;
float Vscale = (plugin->config.Vadj_hi-plugin->config.Vadj_lo) / 100.f;
float Vshift = plugin->config.Vadj_lo / 100.f;
/* layer back into pipeline color format; master fader applies here */
switch(frame->get_color_model()) {
case BC_RGB888:
- RGB_to_rgb8(Rvec,Gvec,Bvec,have_selection?selection:0,Aal,row_fragment,todo,3);
+ RGB_to_rgb8(Rvec,Gvec,Bvec,have_selection?selection:0,Oal,row_fragment,todo,3);
break;
case BC_RGBA8888:
- RGB_to_rgb8(Rvec,Gvec,Bvec,have_selection?selection:0,Aal,row_fragment,todo,4);
+ RGB_to_rgb8(Rvec,Gvec,Bvec,have_selection?selection:0,Oal,row_fragment,todo,4);
break;
case BC_RGB_FLOAT:
- RGB_to_rgbF(Rvec,Gvec,Bvec,have_selection?selection:0,Aal,(float *)row_fragment,todo,3);
+ RGB_to_rgbF(Rvec,Gvec,Bvec,have_selection?selection:0,Oal,(float *)row_fragment,todo,3);
break;
case BC_RGBA_FLOAT:
- RGB_to_rgbF(Rvec,Gvec,Bvec,have_selection?selection:0,Aal,(float *)row_fragment,todo,4);
+ RGB_to_rgbF(Rvec,Gvec,Bvec,have_selection?selection:0,Oal,(float *)row_fragment,todo,4);
break;
case BC_YUV888:
- RGB_to_yuv8(Rvec,Gvec,Bvec,have_selection?selection:0,Aal,row_fragment,todo,3);
+ RGB_to_yuv8(Rvec,Gvec,Bvec,have_selection?selection:0,Oal,row_fragment,todo,3);
break;
case BC_YUVA8888:
- RGB_to_yuv8(Rvec,Gvec,Bvec,have_selection?selection:0,Aal,row_fragment,todo,4);
+ RGB_to_yuv8(Rvec,Gvec,Bvec,have_selection?selection:0,Oal,row_fragment,todo,4);
break;
}
}
if(use_mask && capture_mask){
switch(frame->get_color_model()) {
case BC_RGBA8888:
- unmask_rgba8(row_fragment,todo);
+ if( have_selection && Aal < 1.f )
+ Aal_to_alp8(selection,Aal,row_fragment,todo,4);
+ else
+ unmask_rgba8(row_fragment,todo);
break;
case BC_RGBA_FLOAT:
- unmask_rgbaF((float *)row_fragment,todo);
+ if( have_selection && Aal < 1.f )
+ Aal_to_alpF(selection,Aal,(float *)row_fragment,todo,4);
+ else
+ unmask_rgbaF((float *)row_fragment,todo);
break;
case BC_YUVA8888:
- unmask_yuva8(row_fragment,todo);
+ if( have_selection && Aal < 1.f )
+ Aal_to_alp8(selection,Aal,row_fragment,todo,4);
+ else
+ unmask_yuva8(row_fragment,todo);
break;
}
}
return 1;
}
+// ---------------------------------- alpha slider ---------------------------------
+class BluebananaAAReadout : public BB_Tumble {
+ public:
+ BluebananaAAReadout(BluebananaMain *plugin, BluebananaWindow *gui, int w)
+ : BB_Tumble(plugin,gui,0.,0,100., 0,1,w){}
+ int value_event();
+};
+
+class BluebananaAASlider : public BluebananaSliderSingle {
+public:
+ int hidden;
+ BluebananaAASlider(BluebananaMain *plugin, BluebananaWindow *gui,
+ int x, int y, int w, int h)
+ : BluebananaSliderSingle(plugin,gui,x,y,w,h,0,100) { hidden = 0; }
+ virtual int handle_event() {
+ plugin->config.Aadj_val = val;
+ return 1;
+ }
+ void reset(){
+ plugin->config.Aadj_val=100;
+ update();
+ }
+ void update(){
+ val = plugin->config.Aadj_val;
+ if( BC_CModels::has_alpha(plugin->colormodel) ) {
+ if( hidden ) { show_window(); hidden = 0; }
+ }else{
+ if( !hidden ) { hide_window(); hidden = 1; }
+ }
+ if( hidden ) return;
+ highlight = plugin->config.active && plugin->config.Aadj_active;
+ gui->Aadj_readout->update(plugin->config.Aadj_val);
+ gui->slider_labels[11]->set_color(highlight && plugin->config.Aadj_val != 100 ?
+ get_resources()->default_text_color : dimtextcolor);
+ gui->enter_config_change();
+ gui->commit_config_change();
+ }
+ void trough_color(float hdel, float vdel, float &r, float &g, float &b, float &a){
+ r=g=b=.8;
+ a=1-cos(hdel*M_PI*.5);
+ }
+};
+
+int BluebananaAAReadout::value_event(){
+ float val = get_value();
+ plugin->config.Aadj_val = val;
+ gui->Aadj_slider->update();
+ return 1;
+}
+
// ------------------------------------- picker buttons -----------------------------------------
class BluebananaHPicker : public BC_GenericButton{
public:
int handle_event() { gui->Oadj_slider->reset(); return 1;}
BluebananaWindow *gui;
};
+class BluebananaAAReset : public BC_GenericButton{
+ public:
+ BluebananaAAReset(BluebananaWindow *gui, int w) : BC_GenericButton(-1, -1, w, _("Reset")){
+ this->gui = gui;
+ }
+ int handle_event() { gui->Aadj_slider->reset(); return 1;}
+ BluebananaWindow *gui;
+};
// ----------------------------------- slider active buttons ------------------------------------
BluebananaWindow *gui;
};
+class BluebananaAAActive : public BC_CheckBox {
+public:
+ int hidden;
+
+ BluebananaAAActive(BluebananaMain *plugin, BluebananaWindow *gui)
+ : BC_CheckBox(-1, -1, &plugin->config.Aadj_active, ""){
+ this->plugin = plugin;
+ this->gui = gui;
+ hidden = 0;
+ }
+ virtual int handle_event(){
+ plugin->config.Aadj_active =
+ !BC_CModels::has_alpha(plugin->colormodel) ? 0 : get_value();
+ update();
+ return 1;
+ }
+ void update(){
+ this->BC_CheckBox::update(plugin->config.Aadj_active,1);
+ if( BC_CModels::has_alpha(plugin->colormodel) ) {
+ if( hidden ) { show_window(); hidden = 0; }
+ }else{
+ if( !hidden ) { hide_window(); hidden = 1; }
+ }
+ if( hidden ) return;
+ gui->Aadj_slider->update();
+ }
+ BluebananaMain *plugin;
+ BluebananaWindow *gui;
+};
+
// -------------------------------------------- Erode --------------------------------------------
class BluebananaErode : public BC_CheckBox {
public:
gui->Gadj_slider->update();
gui->Badj_slider->update();
gui->Oadj_slider->update();
+ gui->Aadj_slider->update();
gui->commit_config_change();
}
}
Gadj_slider=NULL;
Badj_slider=NULL;
Oadj_slider=NULL;
+ Aadj_slider=NULL;
use_mask=0;
capture_mask=0;
y += l->get_h()*(row_padding+1.);
}
- const char *labels[11]={_("hue"),_("saturation"),_("value"),_("fill"),_("red"),_("green"),_("blue"),_("hue"),_("saturation"),_("value"),_("fade")};
- for(i=0;i<11;i++){
+ const char *labels[12]={_("hue"),_("saturation"),_("value"),_("fill"),_("red"),_("green"),_("blue"),_("hue"),_("saturation"),_("value"),_("fade"),_("alpha")};
+ for(i=0;i<12;i++){
add_subwindow(slider_labels[i] = new BC_Title(-1,-1,labels[i]));
if(slider_labels[i]->get_w()>label_w)label_w=slider_labels[i]->get_w();
}
add_subwindow(erode_label);
add_subwindow(erode);
- for(i=0;i<11;i++){
+ for(i=0;i<12;i++){
BC_GenericButton *p=NULL;
BluebananaSlider *s=NULL;
BB_Tumble *t0 = NULL, *t1=NULL, *t2=NULL;
s = Oadj_slider = new BluebananaOASlider(plugin,this,slider_x,y,slider_w,row_h);
break;
+ case 11:
+
+ add_subwindow(t0 = Aadj_readout = new BluebananaAAReadout(plugin,this,tumbler_text_ww));
+ add_subwindow(a = Aadj_active = new BluebananaAAActive(plugin,this));
+ add_subwindow(p = new BluebananaAAReset(this,tumbler_col2_w));
+ s = Aadj_slider = new BluebananaAASlider(plugin,this,slider_x,y,slider_w,row_h);
+ break;
+
}
add_subwindow(s);
Gadj_slider->update();
Badj_slider->update();
Oadj_slider->update();
+ Aadj_slider->update();
active->update();
mark->update();
Gadj_active->update();
Badj_active->update();
Oadj_active->update();
+ Aadj_active->update();
// called to release configuration without pushing
leave_config_change();
Gadj_slider->render();
Badj_slider->render();
Oadj_slider->render();
+ Aadj_slider->render();
}
}
class BluebananaGAActive;
class BluebananaBAActive;
class BluebananaOAActive;
+class BluebananaAAActive;
class BluebananaHSSlider;
class BluebananaSSSlider;
class BluebananaGASlider;
class BluebananaBASlider;
class BluebananaOASlider;
+class BluebananaAASlider;
class BluebananaHSReadout0;
class BluebananaHSReadout1;
class BluebananaBAReadout1;
class BluebananaBAReadout2;
class BluebananaOAReadout;
+class BluebananaAAReadout;
class BluebananaPreserve;
BluebananaGAActive *Gadj_active;
BluebananaBAActive *Badj_active;
BluebananaOAActive *Oadj_active;
+ BluebananaAAActive *Aadj_active;
BluebananaHSSlider *Hsel_slider;
BluebananaHSReadout0 *Hsel_readout0;
BluebananaOASlider *Oadj_slider;
BluebananaOAReadout *Oadj_readout;
+ BluebananaAASlider *Aadj_slider;
+ BluebananaAAReadout *Aadj_readout;
//BluebananaPreserve *preserve_luma;
- BC_Title *slider_labels[11];
+ BC_Title *slider_labels[12];
BC_Title *erode_label;
int do_render;
};