int use_cache,
int use_asynchronous)
{
+ File *file = 0;
+ int result = 0;
int64_t source_position = 0;
const int debug = 0;
Asset *asset = get_nested_asset(&source_position,
input_position,
direction);
+ if( !asset ) result = 1;
if(debug) printf("VEdit::read_frame %d source_position=%jd input_position=%jd\n",
__LINE__, source_position, input_position);
- File *file = cache->check_out(asset,
- edl);
- int result = 0;
-
+ if( !result ) {
+ file = cache->check_out(asset, edl);
+ if( !file ) result = 1;
+ }
if(debug) printf("VEdit::read_frame %d path=%s source_position=%jd\n",
__LINE__, asset->path, source_position);
- if(file)
- {
-
+ if( !result ) {
if(debug) printf("VEdit::read_frame %d\n", __LINE__);
source_position = (direction == PLAY_FORWARD) ?
source_position :
cache->check_in(asset);
if(debug) printf("VEdit::read_frame %d\n", __LINE__);
}
- else
- result = 1;
//for(int i = 0; i < video_out->get_w() * 3 * 20; i++) video_out->get_rows()[0][i] = 128;
return result;
#endif
// Store in local buffer
- if(this->data[clipboard_num] && length[clipboard_num] != len + 1)
+ if(this->data[clipboard_num] && length[clipboard_num] != len)
{
delete [] this->data[clipboard_num];
this->data[clipboard_num] = 0;
{
length[clipboard_num] = len;
this->data[clipboard_num] = new char[len + 1];
- memcpy(this->data[clipboard_num], data, len);
- this->data[clipboard_num][len] = 0;
}
+ memcpy(this->data[clipboard_num], data, len);
+ this->data[clipboard_num][len] = 0;
+
if(clipboard_num == PRIMARY_SELECTION)
{
XSetSelectionOwner(out_display,
#else
XUnlockDisplay(in_display);
#endif
-
+//int len = strlen(data);
+//printf("BC_Clipboard::from_clipboard %d: %d '%*.*s'\n",clipboard_num,len,len,len,data);
return 0;
}
void BC_TextBox::select_word(int &letter1, int &letter2, int ibeam_letter)
{
int wtext_len = wtext_update();
- if(!wtext_len) return;
-
letter1 = letter2 = ibeam_letter;
- do {
- if(iswalnum(wtext[letter1])) letter1--;
- } while(letter1 > 0 && iswalnum(wtext[letter1]));
-
- if( !iswalnum(wtext[letter1]) ) letter1++;
-
- do {
- if( iswalnum(wtext[letter2]) ) letter2++;
- } while( letter2 < wtext_len && isalnum(wtext[letter2]) );
+ if( letter1 < 0 ) letter1 = 0;
+ if( letter2 < 0 ) letter2 = 0;
+ if( letter1 > wtext_len ) letter1 = wtext_len;
+ if( letter2 > wtext_len ) letter2 = wtext_len;
+ if( !wtext_len ) return;
- if( letter2 < wtext_len && wtext[letter2] == ' ') letter2++;
+ while( letter1 > 0 && iswalnum(wtext[letter1]) ) --letter1;
+ if( letter1 < wtext_len && iswspace(wtext[letter1]) ) ++letter1;
- if(letter1 < 0) letter1 = 0;
- if(letter2 < 0) letter2 = 0;
- if(letter1 > wtext_len) letter1 = wtext_len;
- if(letter2 > wtext_len) letter2 = wtext_len;
+ while( letter2 < wtext_len && iswalnum(wtext[letter2]) ) ++letter2;
+ if( letter2 < wtext_len && wtext[letter2] == ' ' ) ++letter2;
}
+
void BC_TextBox::select_line(int &letter1, int &letter2, int ibeam_letter)
{
int wtext_len = wtext_update();
highlight_letter1 < 0 || highlight_letter2 < 0 ||
highlight_letter2 - highlight_letter1 <= 0) return;
int clip_len = highlight_letter2 - highlight_letter1;
- char ctext[clip_len+1];
//printf(" BC_TextBox::copy_selection %d %d %d\n",highlight_letter1, highlight_letter2, clip_len);
- text_update(&wtext[highlight_letter1],clip_len, ctext,clip_len+1);
+ char ctext[4*clip_len+4];
+ clip_len = text_update(&wtext[highlight_letter1],clip_len, ctext,4*clip_len+4);
get_clipboard()->to_clipboard(ctext, clip_len, clipboard_num);
}
int len = get_clipboard()->clipboard_len(clipboard_num);
if( len > 0 )
{
- char cstring[len]; wchar_t wstring[len]; --len;
- get_clipboard()->from_clipboard(cstring, len, clipboard_num);
+ char cstring[len]; wchar_t wstring[len];
+ get_clipboard()->from_clipboard(cstring, len, clipboard_num); --len;
//printf("BC_TextBox::paste_selection %d '%*.*s'\n",len,len,len,cstring);
- BC_Resources::encode(BC_Resources::encoding, BC_Resources::wide_encoding,
- cstring,(len+1), (char *)wstring,(len+1)*sizeof(wchar_t));
+ len = BC_Resources::encode(BC_Resources::encoding, BC_Resources::wide_encoding,
+ cstring,len, (char *)wstring,(len+1)*sizeof(wchar_t)) / sizeof(wchar_t);
insert_text(wstring, len);
}
}