<KEYFRAME TITLE="640x480 to d-1"><SCALE WIDTH=1.100000e+00 HEIGHT=1></KEYFRAME>
<KEYFRAME TITLE="fix D-1 on gootube"><SCALE WIDTH=1 HEIGHT=1.125100e+00></KEYFRAME>
</PLUGIN>
-<PLUGIN TITLE=Motion>
+<PLUGIN TITLE=MotionHV>
<KEYFRAME TITLE=coptercam><MOTION BLOCK_COUNT=1 GLOBAL_POSITIONS=256 ROTATE_POSITIONS=4 GLOBAL_BLOCK_W=45 GLOBAL_BLOCK_H=52 ROTATION_BLOCK_W=33 ROTATION_BLOCK_H=32 BLOCK_X=50 BLOCK_Y=50 GLOBAL_RANGE_W=39 GLOBAL_RANGE_H=47 ROTATION_RANGE=10 ROTATION_CENTER=0 MAGNITUDE=50 RETURN_SPEED=3 MODE1=1 GLOBAL=1 ROTATE=1 MODE2=5 DRAW_VECTORS=0 MODE3=11 TRACK_FRAME=0 BOTTOM_IS_MASTER=1 HORIZONTAL_ONLY=0 VERTICAL_ONLY=0></KEYFRAME>
<KEYFRAME TITLE=running><MOTION BLOCK_COUNT=1 GLOBAL_POSITIONS=1024 ROTATE_POSITIONS=4 GLOBAL_BLOCK_W=34 GLOBAL_BLOCK_H=46 BLOCK_X=50 BLOCK_Y=50 GLOBAL_RANGE_W=100 GLOBAL_RANGE_H=100 ROTATION_RANGE=5 ROTATION_CENTER=0 MAGNITUDE=50 RETURN_SPEED=10 ROTATE_MAGNITUDE=15 ROTATE_RETURN_SPEED=10 ACTION_TYPE=3 GLOBAL=1 ROTATE=1 TRACKING_TYPE=1 DRAW_VECTORS=1 TRACKING_OBJECT=2 TRACK_FRAME=0 BOTTOM_IS_MASTER=1 HORIZONTAL_ONLY=0 VERTICAL_ONLY=0></KEYFRAME>
</PLUGIN>
0, // If this listbox is a popup window
LISTBOX_MULTIPLE, // Select one item or multiple items
ICON_TOP, // Position of icon relative to text of each item
- 1) // Allow drag
+ -1) // Allow drags, require shift for scrolling
{
this->mwindow = mwindow;
this->gui = gui;
int CPanelZoom::set_shown(int shown)
{
if( shown ) {
- show_window();
+ show();
update(gui->subwindow->canvas->get_zoom());
}
else
- hide_window();
+ hide();
return 1;
}
char *get_caption();
int handle_event();
int set_shown(int shown);
+ int show_window(int flush=1) { return 0; }
+ int hide_window(int flush=1) { return 0; }
+ int show(int flush=1) { return BC_SubWindow::show_window(flush); }
+ int hide(int flush=1) { return BC_SubWindow::hide_window(flush); }
void update(float zoom);
MWindow *mwindow;
CPanel *gui;
is_factory = 0;
preset_text[0] = 0;
window_title[0] = 0;
- column_titles[0] = (char*)"Parameter";
- column_titles[1] = (char*)"Value";
+ column_titles[0] = (char*)_("Parameter");
+ column_titles[1] = (char*)_("Value");
column_width[0] = 0;
column_width[1] = 0;
presets_data = new ArrayList<BC_ListBoxItem*>;
this->keyframe = keyframe;
this->plugin = plugin;
plugin->calculate_title(plugin_title, 0);
- sprintf(window_title, PROGRAM_NAME ": %s Keyframe", plugin_title);
+ sprintf(window_title, _("%s: %s Keyframe"), _(PROGRAM_NAME), plugin_title);
// Load all the presets from disk
char path[BCTEXTLEN];
add_subwindow(title1 = new BC_Title(theme->keyframe_list_x,
- theme->keyframe_list_y -
- BC_Title::calculate_h(this, (char*)"Py", LARGEFONT) -
- theme->widget_border,
- _("Keyframe parameters:"),
- LARGEFONT));
+ theme->keyframe_list_y - BC_Title::calculate_h(this, (char*)_("Py"), LARGEFONT) -
+ theme->widget_border, _("Keyframe parameters:"), LARGEFONT));
add_subwindow(keyframe_list = new KeyFrameList(thread,
this,
theme->keyframe_list_x,
// theme->keyframe_text_y,
// theme->keyframe_text_w));
add_subwindow(title3 = new BC_Title(theme->keyframe_value_x,
- theme->keyframe_value_y - BC_Title::calculate_h(this, (char*)"P") - theme->widget_border,
- _("Edit value:")));
- add_subwindow(value_text = new KeyFrameValue(thread,
- this,
- theme->keyframe_value_x,
- theme->keyframe_value_y,
- theme->keyframe_value_w));
- add_subwindow(all_toggle = new KeyFrameAll(thread,
- this,
- theme->keyframe_all_x,
- theme->keyframe_all_y));
+ theme->keyframe_value_y - BC_Title::calculate_h(this, (char*)"P") -
+ theme->widget_border, _("Edit value:")));
+ add_subwindow(value_text = new KeyFrameValue(thread, this,
+ theme->keyframe_value_x, theme->keyframe_value_y, theme->keyframe_value_w));
+ add_subwindow(all_toggle = new KeyFrameAll(thread, this,
+ theme->keyframe_all_x, theme->keyframe_all_y));
#endif
-
-
-
- add_subwindow(title4 = new BC_Title(theme->presets_list_x,
- theme->presets_list_y -
- BC_Title::calculate_h(this, (char*)"Py", LARGEFONT) -
- theme->widget_border,
- _("Presets:"),
- LARGEFONT));
- add_subwindow(preset_list = new KeyFramePresetsList(thread,
- this,
- theme->presets_list_x,
- theme->presets_list_y,
- theme->presets_list_w,
- theme->presets_list_h));
+ add_subwindow(title4 = new BC_Title(theme->presets_list_x, theme->presets_list_y -
+ BC_Title::calculate_h(this, (char*)_("Py"), LARGEFONT) -
+ theme->widget_border, _("Presets:"), LARGEFONT));
+ add_subwindow(preset_list = new KeyFramePresetsList(thread, this,
+ theme->presets_list_x, theme->presets_list_y,
+ theme->presets_list_w, theme->presets_list_h));
add_subwindow(title5 = new BC_Title(theme->presets_text_x,
theme->presets_text_y - BC_Title::calculate_h(this, (char*)"P") - theme->widget_border,
_("Preset title:")));
- add_subwindow(preset_text = new KeyFramePresetsText(thread,
- this,
- theme->presets_text_x,
- theme->presets_text_y,
- theme->presets_text_w));
- add_subwindow(delete_preset = new KeyFramePresetsDelete(thread,
- this,
- theme->presets_delete_x,
- theme->presets_delete_y));
- add_subwindow(save_preset = new KeyFramePresetsSave(thread,
- this,
- theme->presets_save_x,
- theme->presets_save_y));
- add_subwindow(apply_preset = new KeyFramePresetsApply(thread,
- this,
- theme->presets_apply_x,
- theme->presets_apply_y));
-
-
-
+ add_subwindow(preset_text = new KeyFramePresetsText(thread, this,
+ theme->presets_text_x, theme->presets_text_y, theme->presets_text_w));
+ add_subwindow(delete_preset = new KeyFramePresetsDelete(thread, this,
+ theme->presets_delete_x, theme->presets_delete_y));
+ add_subwindow(save_preset = new KeyFramePresetsSave(thread, this,
+ theme->presets_save_x, theme->presets_save_y));
+ add_subwindow(apply_preset = new KeyFramePresetsApply(thread, this,
+ theme->presets_apply_x, theme->presets_apply_y));
add_subwindow(new KeyFramePresetsOK(thread, this));
add_subwindow(new BC_CancelButton(this));
KeyFrameList::KeyFrameList(KeyFrameThread *thread,
- KeyFrameWindow *window,
- int x,
- int y,
- int w,
- int h)
- : BC_ListBox(x,
- y,
- w,
- h,
- LISTBOX_TEXT,
- thread->keyframe_data,
- thread->column_titles,
- thread->column_width,
- KEYFRAME_COLUMNS)
+ KeyFrameWindow *window, int x, int y, int w, int h)
+ : BC_ListBox(x, y, w, h, LISTBOX_TEXT, thread->keyframe_data,
+ thread->column_titles, thread->column_width, KEYFRAME_COLUMNS)
{
this->thread = thread;
this->window = window;
+ set_master_column(1, 0);
}
int KeyFrameList::selection_changed()
PluginOn::PluginOn(MWindow *mwindow, int x, int y, Plugin *plugin)
- : BC_Toggle(x,
- y,
- mwindow->theme->get_image_set("plugin_on"),
- plugin->on)
+ : BC_Toggle(x, y, mwindow->theme->get_image_set("plugin_on"), plugin->on)
{
this->mwindow = mwindow;
this->plugin = plugin;
in_use = 1;
- set_tooltip(_("On"));
+ set_tooltip(plugin->on ? _("Turn Off") : _("Turn On"));
}
int PluginOn::calculate_w(MWindow *mwindow)
void PluginOn::update(int x, int y, Plugin *plugin)
{
BC_Toggle::set_value(plugin->on, 0);
+ set_tooltip(plugin->on ? _("Turn Off") : _("Turn On"));
reposition_window(x, y);
this->plugin = plugin;
in_use = 1;
int PluginOn::handle_event()
{
plugin->on = get_value();
+ set_tooltip(plugin->on ? _("Turn Off") : _("Turn On"));
unlock_window();
mwindow->restart_brender();
mwindow->sync_parameters(CHANGE_EDL);
mwindow->edl->local_session->zoom_sample /
mwindow->edl->session->sample_rate;
+ int cx, cy;
+ get_abs_cursor_xy(cx, cy);
+ cx -= mwindow->theme->get_image("clip_icon")->get_w() / 2,
+ cy -= mwindow->theme->get_image("clip_icon")->get_h() / 2;
gui->drag_popup = new BC_DragWindow(gui,
- mwindow->theme->get_image("clip_icon") /*,
- get_abs_cursor_x(0) - mwindow->theme->get_image("clip_icon")->get_w() / 2,
- get_abs_cursor_y(0) - mwindow->theme->get_image("clip_icon")->get_h() / 2 */);
+ mwindow->theme->get_image("clip_icon"), cx, cy);
result = 1;
}
frame = mwindow->theme->get_image("veffect_icon");
}
}
-
- gui->drag_popup = new BC_DragWindow(gui, frame /*,
- get_abs_cursor_x(0) - frame->get_w() / 2,
- get_abs_cursor_y(0) - frame->get_h() / 2 */);
+ int cx, cy;
+ get_abs_cursor_xy(cx, cy);
+ cx -= frame->get_w() / 2;
+ cy -= frame->get_h() / 2;
+ gui->drag_popup = new BC_DragWindow(gui, frame, cx, cy);
break; }
case PLUGIN_SHAREDPLUGIN:
- case PLUGIN_SHAREDMODULE:
- gui->drag_popup = new BC_DragWindow(gui,
- mwindow->theme->get_image("clip_icon") /*,
- get_abs_cursor_x(0) - mwindow->theme->get_image("clip_icon")->get_w() / 2,
- get_abs_cursor_y(0) - mwindow->theme->get_image("clip_icon")->get_h() / 2 */);
- break;
+ case PLUGIN_SHAREDMODULE: {
+ VFrame *frame = mwindow->theme->get_image("clip_icon");
+ int cx, cy;
+ get_abs_cursor_xy(cx, cy);
+ cx -= frame->get_w() / 2;
+ cy -= frame->get_h() / 2;
+ gui->drag_popup = new BC_DragWindow(gui, frame, cx, cy);
+ break; }
}
result = 1;
// create overlay
device->mwindow->gui->lock_window("VDeviceX11::close_all");
- screencap_border[0] = new BC_Popup(device->mwindow->gui,
+ screencap_border[0] = new BC_Popup(device->mwindow->gui,
device->input_x - SCREENCAP_PIXELS, device->input_y - SCREENCAP_PIXELS,
device->in_config->w + SCREENCAP_PIXELS * 2, SCREENCAP_PIXELS,
SCREENCAP_COLOR, 1);
- screencap_border[1] = new BC_Popup(device->mwindow->gui,
+ screencap_border[1] = new BC_Popup(device->mwindow->gui,
device->input_x - SCREENCAP_PIXELS, device->input_y,
SCREENCAP_PIXELS, device->in_config->h,
SCREENCAP_COLOR, 1);
- screencap_border[2] = new BC_Popup(device->mwindow->gui,
+ screencap_border[2] = new BC_Popup(device->mwindow->gui,
device->input_x - SCREENCAP_PIXELS, device->input_y + device->in_config->h,
device->in_config->w + SCREENCAP_PIXELS * 2, SCREENCAP_PIXELS,
SCREENCAP_COLOR, 1);
- screencap_border[3] = new BC_Popup(device->mwindow->gui,
+ screencap_border[3] = new BC_Popup(device->mwindow->gui,
device->input_x + device->in_config->w, device->input_y,
SCREENCAP_PIXELS, device->in_config->h,
SCREENCAP_COLOR, 1);
+usleep(500000); // avoids a bug in gnome-shell 2017/10/19
- for( int i=0; i<SCREENCAP_BORDERS; ++i ) {
- BC_Popup *box = screencap_border[i];
- box->set_bg_color(SCREENCAP_COLOR);
- box->clear_box(0, 0, box->get_w(), box->get_h());
- box->flash(0);
- box->show_window();
- }
+ for( int i=0; i<SCREENCAP_BORDERS; ++i )
+ screencap_border[i]->show_window(0);
+ device->mwindow->gui->flush();
device->mwindow->gui->unlock_window();
return 0;
#amix
#amovie
#anequalizer
-anoisesrc
+#anoisesrc
#anull
#anullsink
#anullsrc
#include "vframe.h"
#include <unistd.h>
-// Icon has to be offset so the cursor isn't directly over it.
-// The cursor has to be over the target window for X to detect the right window.
-#define DRAG_OFFSET_X 16
-#define DRAG_OFFSET_Y 16
-
BC_DragWindow::BC_DragWindow(BC_WindowBase *parent_window,
- BC_Pixmap *pixmap /*,
- int icon_x,
- int icon_y */)
- : BC_Popup(parent_window,
-// icon_x,
-// icon_y,
- parent_window->get_abs_cursor_x(0) + DRAG_OFFSET_X,
- parent_window->get_abs_cursor_y(0) + DRAG_OFFSET_Y,
- pixmap->get_w(),
- pixmap->get_h(),
- -1,
- 0,
- pixmap)
+ BC_Pixmap *pixmap, int icon_x, int icon_y)
+ : BC_Popup(parent_window, icon_x, icon_y, pixmap->get_w(), pixmap->get_h(),
+ -1, 0, pixmap)
{
- temp_frame = 0;
drag_pixmap = 0;
-// init_x = icon_x;
-// init_y = icon_y;
- init_x = parent_window->get_abs_cursor_x(0) + DRAG_OFFSET_X;
- init_y = parent_window->get_abs_cursor_y(0) + DRAG_OFFSET_Y;
+ init_x = icon_x;
+ init_y = icon_y;
end_x = BC_INFINITY;
end_y = BC_INFINITY;
icon_offset_x = init_x - parent_window->get_abs_cursor_x(0);
BC_DragWindow::BC_DragWindow(BC_WindowBase *parent_window,
- VFrame *frame /*,
- int icon_x,
- int icon_y */)
- : BC_Popup(parent_window,
-// icon_x,
-// icon_y,
- parent_window->get_abs_cursor_x(0) + DRAG_OFFSET_X,
- parent_window->get_abs_cursor_y(0) + DRAG_OFFSET_Y,
- frame->get_w(),
- frame->get_h(),
- -1,
- 0,
- prepare_frame(frame, parent_window))
+ VFrame *frame, int icon_x, int icon_y)
+ : BC_Popup(parent_window, icon_x, icon_y, frame->get_w(), frame->get_h(),
+ -1, 0, prepare_frame(frame, parent_window))
{
- delete temp_frame; // created in prepare_frame inside constructor
- temp_frame = 0;
-// init_x = icon_x;
-// init_y = icon_y;
- init_x = parent_window->get_abs_cursor_x(0) + DRAG_OFFSET_X;
- init_y = parent_window->get_abs_cursor_y(0) + DRAG_OFFSET_Y;
+ init_x = icon_x;
+ init_y = icon_y;
end_x = BC_INFINITY;
end_y = BC_INFINITY;
icon_offset_x = init_x - parent_window->get_abs_cursor_x(0);
int output_x, temp = 0;
Window tempwin;
XTranslateCoordinates(parent_window->top_level->display,
- parent_window->win,
- parent_window->top_level->rootwin,
- icon_x,
- temp,
- &output_x,
- &temp,
- &tempwin);
+ parent_window->win, parent_window->top_level->rootwin,
+ icon_x, temp, &output_x, &temp, &tempwin);
return output_x;
}
int output_y, temp = 0;
Window tempwin;
XTranslateCoordinates(parent_window->top_level->display,
- parent_window->win,
- parent_window->top_level->rootwin,
- temp,
- icon_y,
- &temp,
- &output_y,
- &tempwin);
+ parent_window->win, parent_window->top_level->rootwin,
+ temp, icon_y, &temp, &output_y, &tempwin);
return output_y;
}
int BC_DragWindow::cursor_motion_event()
{
- reposition_window(get_abs_cursor_x(0) + icon_offset_x,
- get_abs_cursor_y(0) + icon_offset_y,
- get_w(),
- get_h());
+ int cx, cy;
+ get_abs_cursor_xy(cx, cy);
+ reposition_window(cx + icon_offset_x, cy + icon_offset_y, get_w(), get_h());
flush();
return 1;
}
{
if(!do_animation) return 0;
- if(end_x == BC_INFINITY)
- {
+ if(end_x == BC_INFINITY) {
end_x = get_x();
end_y = get_y();
}
- for(int i = 0; i < 10; i++)
- {
+ for(int i = 0; i < 10; i++) {
int new_x = end_x + (init_x - end_x) * i / 10;
int new_y = end_y + (init_y - end_y) * i / 10;
- reposition_window(new_x,
- new_y,
- get_w(),
- get_h());
+ reposition_window(new_x, new_y, get_w(), get_h());
flush();
usleep(1000);
}
BC_Pixmap *BC_DragWindow::prepare_frame(VFrame *frame, BC_WindowBase *parent_window)
{
- temp_frame = 0;
+ VFrame *temp_frame = 0;
+ int tw = frame->get_w(), th = frame->get_h();
- if(frame->get_color_model() == BC_RGBA8888)
- {
- temp_frame = new VFrame(*frame);
+ if( frame->get_color_model() != BC_RGBA8888 ) {
+ temp_frame = new VFrame(tw, th, BC_RGBA8888);
+ temp_frame->transfer_from(frame);
}
else
- {
- temp_frame = new VFrame;
- temp_frame->set_use_shm(0);
- temp_frame->reallocate(0,
- -1,
- 0,
- 0,
- 0,
- frame->get_w(),
- frame->get_h(),
- BC_RGBA8888,
- -1);
-
- BC_CModels::transfer(temp_frame->get_rows(), frame->get_rows(),
- 0, 0, 0, 0, 0, 0,
- 0, 0, frame->get_w(), frame->get_h(),
- 0, 0, temp_frame->get_w(), temp_frame->get_h(),
- frame->get_color_model(), temp_frame->get_color_model(),
- 0, frame->get_w(), temp_frame->get_w());
+ temp_frame = new VFrame(*frame);
+
+ int tx = tw/2, ty = th/2, tx1 = tx-1, ty1 = ty-1, tx2 = tx+2, ty2 = ty+2;
+ int bpp = BC_CModels::calculate_pixelsize(temp_frame->get_color_model());
+ unsigned char **rows = temp_frame->get_rows();
+ for( int y=ty1; y<ty2; ++y ) {
+ for( int x=tx1; x<tx2; ++x ) {
+ unsigned char *rp = rows[y] + x*bpp;
+ rp[3] = 0; // alpha of center pixels = 0
+ }
}
- temp_frame->get_rows()[(temp_frame->get_h() / 2)][(temp_frame->get_w() / 2) * 4 + 3] = 0;
- drag_pixmap = new BC_Pixmap(parent_window,
- temp_frame,
- PIXMAP_ALPHA);
+ drag_pixmap = new BC_Pixmap(parent_window, temp_frame, PIXMAP_ALPHA);
+ delete temp_frame;
return drag_pixmap;
}
class BC_DragWindow : public BC_Popup
{
public:
- BC_DragWindow(BC_WindowBase *parent_window, BC_Pixmap *pixmap /*, int icon_x, int icon_y */);
- BC_DragWindow(BC_WindowBase *parent_window, VFrame *frame /*, int icon_x, int icon_y */);
+ BC_DragWindow(BC_WindowBase *parent_window, BC_Pixmap *pixmap, int icon_x, int icon_y);
+ BC_DragWindow(BC_WindowBase *parent_window, VFrame *frame, int icon_x, int icon_y);
~BC_DragWindow();
int cursor_motion_event();
int end_x, end_y;
int icon_offset_x, icon_offset_y;
int do_animation;
- VFrame *temp_frame;
BC_Pixmap *drag_pixmap;
};
switch(current_operation)
{
case SELECT:
- if(gui &&
- gui->is_event_win() &&
- allow_drag)
+ if( gui && gui->is_event_win() && allow_drag )
{
BC_ListBoxItem *item_return = 0;
selection_number = get_cursor_item(data,
if(selection_number >= 0)
{
-
- if (item_return->icon_vframe)
- {
+ int cx, cy;
+ get_abs_cursor_xy(cx, cy);
+ cx -= item_return->icon_vframe->get_w() / 2,
+ cy -= item_return->icon_vframe->get_h() / 2;
+ if( item_return->icon_vframe )
drag_popup = new BC_DragWindow(this,
- item_return->icon_vframe /*,
- get_abs_cursor_x(0) - item_return->icon_vframe->get_w() / 2,
- get_abs_cursor_y(0) - item_return->icon_vframe->get_h() / 2 */);
- }
+ item_return->icon_vframe, cx, cy);
else
// this probably works not!
- if (item_return->icon)
- {
+ if( item_return->icon )
drag_popup = new BC_DragWindow(this,
- item_return->icon /*,
- get_abs_cursor_x(0) - item_return->icon->get_w() / 2,
- get_abs_cursor_y(0) - item_return->icon->get_h() / 2 */);
- }
+ item_return->icon, cx, cy);
else
- {
drag_popup = new BC_DragWindow(this,
- drag_icon_vframe /*,
- get_abs_cursor_x(0) - drag_icon_vframe->get_w() / 2,
- get_abs_cursor_y(0) - drag_icon_vframe->get_h() / 2 */);
- }
-
+ drag_icon_vframe, cx, cy);
current_operation = DRAG_ITEM;
- set_repeat(get_resources()->scroll_repeat);
+// require shift down for scrolling
+ if( allow_drag < 0 && shift_down() )
+ set_repeat(get_resources()->scroll_repeat);
return 1;
}
}
case COLUMN_DN:
if(gui && gui->is_event_win() && allow_drag_column)
{
+ int cx, cy;
+ get_abs_cursor_xy(cx, cy);
+ cx -= drag_column_icon_vframe->get_w() / 2,
+ cy -= drag_column_icon_vframe->get_h() / 2;
drag_popup = new BC_DragWindow(this,
- drag_column_icon_vframe /*,
- get_abs_cursor_x(0) - drag_column_icon_vframe->get_w() / 2,
- get_abs_cursor_y(0) - drag_column_icon_vframe->get_h() / 2 */);
+ drag_column_icon_vframe, cx, cy);
dragged_title = highlighted_title;
current_operation = COLUMN_DRAG;
draw_titles(1);
}
return drag_popup->cursor_motion_event();
- break;
}
case COLUMN_DRAG:
draw_titles(1);
}
return drag_popup->cursor_motion_event();
- break;
}
}
return 0;
{
reposition_item(data,
selection_number,
- top_level->cursor_x +
- drag_popup->get_offset_x() -
- LISTBOX_MARGIN -
- 2 +
- xposition,
- top_level->cursor_y +
- drag_popup->get_offset_y() -
- LISTBOX_MARGIN -
- 2 +
- yposition);
+ top_level->cursor_x + drag_popup->get_offset_x() -
+ LISTBOX_MARGIN - 2 + xposition,
+ top_level->cursor_y + drag_popup->get_offset_y() -
+ LISTBOX_MARGIN - 2 + yposition);
}
else
// Move rows
gui->set_color(BLACK);
int xx = x + column_width-1;
gui->draw_line(x, y, xx, y);
- int hh = row_height;
+ int hh = h;
if( display_format == LISTBOX_ICON_LIST ) {
int ih = get_icon_h(item);
if( ih > hh ) hh = ih;
BC_FullScreen::BC_FullScreen(BC_WindowBase *parent_window, int w, int h,
- int bg_color,
- int vm_scale,
- int hide,
- BC_Pixmap *bg_pixmap)
+ int bg_color, int vm_scale, int hide, BC_Pixmap *bg_pixmap)
: BC_WindowBase()
{
#ifdef HAVE_LIBXXF86VM
if (vm_scale)
- create_window(parent_window,
- _("Fullscreen"),
- parent_window->get_screen_x(0, -1),
- parent_window->get_screen_y(0, -1),
- w,
- h,
- w,
- h,
- 0,
- parent_window->top_level->private_color,
- hide,
- bg_color,
- NULL,
- VIDMODE_SCALED_WINDOW,
- bg_pixmap,
- 0);
+ create_window(parent_window, _("Fullscreen"),
+ parent_window->get_screen_x(0, -1), parent_window->get_screen_y(0, -1),
+ w, h, w, h, 0, parent_window->top_level->private_color, hide,
+ bg_color, NULL, VIDMODE_SCALED_WINDOW, bg_pixmap, 0);
else
#endif
- create_window(parent_window,
- _("Fullscreen"),
- parent_window->get_screen_x(0, -1),
- parent_window->get_screen_y(0, -1),
- w,
- h,
- w,
- h,
- 0,
- parent_window->top_level->private_color,
- hide,
- bg_color,
- NULL,
- POPUP_WINDOW,
- bg_pixmap,
- 0);
+ create_window(parent_window, _("Fullscreen"),
+ parent_window->get_screen_x(0, -1), parent_window->get_screen_y(0, -1),
+ w, h, w, h, 0, parent_window->top_level->private_color, hide,
+ bg_color, NULL, POPUP_WINDOW, bg_pixmap, 0);
}
BC_Popup::BC_Popup(BC_WindowBase *parent_window,
- int x,
- int y,
- int w,
- int h,
- int bg_color,
- int hide,
- BC_Pixmap *bg_pixmap)
+ int x, int y, int w, int h, int bg_color, int hide, BC_Pixmap *bg_pixmap)
: BC_WindowBase()
{
create_window(parent_window,
- _("Popup"),
- x,
- y,
- w,
- h,
- w,
- h,
- 0,
- parent_window->top_level->private_color,
- hide,
- bg_color,
- NULL,
- POPUP_WINDOW,
- bg_pixmap,
- 0);
+ _("Popup"), x, y, w, h, w, h, 0, parent_window->top_level->private_color,
+ hide, bg_color, NULL, POPUP_WINDOW, bg_pixmap, 0);
grabbed = 0;
}
char BC_Resources::encoding[LEN_ENCOD] = {0};
const char *BC_Resources::wide_encoding = 0;
ArrayList<BC_FontEntry*> *BC_Resources::fontlist = 0;
+int BC_Resources::font_debug = 0;
const char *BC_Resources::fc_properties[] = { FC_SLANT, FC_WEIGHT, FC_WIDTH };
#define LEN_FCPROP (sizeof(BC_Resources::fc_properties) / sizeof(const char*))
static const char *def_large_b_font_xft = "Sans:bold:pixelsize=%.4f"; // 21.3333
static const char *def_big_font_xft = "Sans:pixelsize=37.3333"; // 37.3333
static const char *def_big_b_font_xft = "Sans:bold:pixelsize=37.33333"; // 37.3333
-static const char *def_clock_font_xft = "Sans:pixelsize=16"; // 16
+static const char *def_clock_font_xft = "Sans:pixelsize=%.4f"; // 16
#define default_font_xft2 "-microsoft-verdana-*-*-*-*-*-*-*-*-*-*-*-*"
def_font(large_font2, iround(scale*20));
def_font(big_font, iround(scale*160), iround(scale*160));
def_font(big_font2, iround(scale*16), iround(scale*16));
- def_font(clock_font, iround(scale*16), iround(scale*16));
- def_font(clock_font2, iround(scale*16), iround(scale*16));
+ def_font(clock_font, iround(scale*16));
+ def_font(clock_font2, iround(scale*18));
def_font(small_fontset, iround(scale*10));
def_font(medium_fontset, iround(scale*14));
def_font(large_fontset, iround(scale*18));
def_font(large_b_font_xft, (scale*21.3333));
def_font(big_font_xft, (scale*37.3333));
def_font(big_b_font_xft, (scale*37.3333));
- def_font(clock_font_xft, (scale*16));
+ def_font(clock_font_xft, (scale*16.));
set_font(small_font_xft2, default_font_xft2);
set_font(medium_font_xft2, default_font_xft2);
synchronous = 0;
vframe_shm = 0;
double default_scale = 1.0; // display_size/1000.;
- char *env = getenv("BC_FONT_SCALE");
+ char *env = getenv("BC_FONT_DEBUG");
+ font_debug = env ? atoi(env) : 0;
+ env = getenv("BC_FONT_SCALE");
font_scale = env ? atof(env) : default_scale;
if( font_scale <= 0 ) font_scale = 1;
init_font_defs(font_scale);
char find_command[BCTEXTLEN];
char *fp = find_command, *ep = fp+sizeof(find_command)-1;
- fp += snprintf(fp, ep-fp, "find '%s'", search_path);
+ fp += snprintf(fp, ep-fp, "%s", "find");
const char *bc_font_path = getenv("BC_FONT_PATH");
+// if BC_FONT_PATH starts with ':', omit default path
+ if( !(bc_font_path && bc_font_path[0] == ':') )
+ fp += snprintf(fp, ep-fp, " '%s'", search_path);
if( bc_font_path ) {
const char *path = bc_font_path;
- for( int len=0; *path; path+=len ) {
- const char *cp = strchr(path,':');
- len = !cp ? strlen(path) : cp-path;
+ while( *path ) {
char font_path[BCTEXTLEN];
- memcpy(font_path, path, len); font_path[len] = 0;
- if( cp ) ++len;
- fp += snprintf(fp, ep-fp, " '%s'", font_path);
+ const char *cp = strchr(path,':');
+ int len = !cp ? strlen(path) : cp-path;
+ if( len > 0 ) {
+ memcpy(font_path, path, len);
+ font_path[len] = 0; path += len;
+ fp += snprintf(fp, ep-fp, " '%s'", font_path);
+ }
+ if( cp ) ++path;
}
}
fp += snprintf(fp, ep-fp, " -name 'fonts.scale' -print -exec cat {} \\;");
entry->style |= FL_WIDTH_NORMAL;
fontlist->append(entry);
+ if( font_debug )
+ dump_font_entry(stdout, "font 0: ", entry);
+
// printf("TitleMain::build_fonts %s: success\n", entry->path);
//printf("TitleMain::build_fonts 2\n");
}
pclose(in);
+ if( bc_font_path && bc_font_path[0] == ':' )
+ return 0;
// Load all the fonts from fontconfig
FcPattern *pat;
}
fontlist->append(entry);
+ if( font_debug )
+ dump_font_entry(stdout, "font 1: ", entry);
}
FcFontSetDestroy(fs);
strcpy(entry->displayname, entry->family);
}
fontlist->append(entry);
+ if( font_debug )
+ dump_font_entry(stdout, "font 2: ", entry);
}
FcFontSetDestroy(fs);
return 0;
void BC_Resources::dump_fonts(FILE *fp)
{
- for( int i=0; i<fontlist->total; ++i ) {
- BC_FontEntry *ep = fontlist->values[i];
- fprintf(fp,"%s = %s\n",ep->displayname,ep->path);
- fprintf(fp," %s:%s:%s:%s:%s:%s:%d:%d:%d:%d:%d:%s:%d:%s:%s:%d\n",
- ep->foundry, ep->family, ep->weight, ep->slant, ep->swidth, ep->adstyle,
- ep->pixelsize, ep->pointsize, ep->xres, ep->yres, ep->style, ep->spacing,
- ep->avg_width, ep->registry, ep->encoding, ep->fixed_style);
- }
+ for( int i=0; i<fontlist->total; ++i )
+ dump_font_entry(fp, "", fontlist->values[i]);
+}
+
+void BC_Resources::dump_font_entry(FILE *fp, const char *cp, BC_FontEntry *ep)
+{
+ fprintf(fp,"%s%s = %s\n",cp,ep->displayname,ep->path);
+ fprintf(fp," %s:%s:%s:%s:%s:%s:%d:%d:%d:%d:%d:%s:%d:%s:%s:%d\n",
+ ep->foundry, ep->family, ep->weight, ep->slant, ep->swidth, ep->adstyle,
+ ep->pixelsize, ep->pointsize, ep->xres, ep->yres, ep->style, ep->spacing,
+ ep->avg_width, ep->registry, ep->encoding, ep->fixed_style);
}
int directory_color;
int file_color;
double font_scale, icon_scale;
-
// fonts
static const char *small_font, *small_font2;
static const char *medium_font, *medium_font2;
static size_t encode(const char *from_enc, const char *to_enc,
char *input, int input_length, char *output, int output_length);
static int find_font_by_char(FT_ULong char_code, char *path_new, const FT_Face oldface);
+ static int font_debug;
static void dump_fonts(FILE *fp = stdout);
+ static void dump_font_entry(FILE *fp, const char *cp, BC_FontEntry *ep);
static void new_vframes(int n, VFrame *vframes[], ...);
static void del_vframes(VFrame *vframes[], int n);
char BC_Window::default_x11_host[BCTEXTLEN] = "";
BC_Window::BC_Window(const char *title,
- int x,
- int y,
- int w,
- int h,
- int minw,
- int minh,
- int allow_resize,
- int private_color,
- int hide,
- int bg_color,
- const char *display_name,
- int group_it,
- int options)
+ int x, int y, int w, int h, int minw, int minh, int allow_resize,
+ int private_color, int hide, int bg_color, const char *display_name,
+ int group_it, int options)
: BC_WindowBase(options)
{
- create_window(0,
- title,
- x,
- y,
- w,
- h,
- (minw < 0) ? w : minw,
- (minh < 0) ? h : minh,
- allow_resize,
- private_color,
- hide,
- bg_color,
- display_name ? display_name :
- default_x11_host[0] ? default_x11_host :
- 0,
- MAIN_WINDOW,
- 0,
- group_it);
+ create_window(0, title, x, y, w, h,
+ (minw < 0) ? w : minw, (minh < 0) ? h : minh,
+ allow_resize, private_color, hide, bg_color,
+ display_name ? display_name :
+ default_x11_host[0] ? default_x11_host : 0,
+ MAIN_WINDOW, 0, group_it);
}
FocusChangeMask
-int BC_WindowBase::create_window(BC_WindowBase *parent_window,
- const char *title,
- int x,
- int y,
- int w,
- int h,
- int minw,
- int minh,
- int allow_resize,
- int private_color,
- int hide,
- int bg_color,
- const char *display_name,
- int window_type,
- BC_Pixmap *bg_pixmap,
- int group_it)
+int BC_WindowBase::create_window(BC_WindowBase *parent_window, const char *title,
+ int x, int y, int w, int h, int minw, int minh, int allow_resize,
+ int private_color, int hide, int bg_color, const char *display_name,
+ int window_type, BC_Pixmap *bg_pixmap, int group_it)
{
XSetWindowAttributes attr;
unsigned long mask;
{
GlyphPackage *pkg = (GlyphPackage*)package;
TitleGlyph *glyph = pkg->glyph;
+ BC_Resources *resources = BC_WindowBase::get_resources();
+ if( resources->font_debug )
+ printf("GlyphUnit load glyph (%s) %04x, '%c'\n", glyph->font->displayname,
+ (unsigned)glyph->char_code, (unsigned)glyph->char_code);
int result = 0;
char new_path[BCTEXTLEN];
if( plugin->load_freetype_face(freetype_library, freetype_face, glyph->font->path) ) {
if( gindex == 0 ) {
printf("GlyphUnit::process_package 1 glyph not found (%s) %04x, '%c'\n",
glyph->font->displayname, (unsigned)glyph->char_code, (unsigned)glyph->char_code);
- BC_Resources *resources = BC_WindowBase::get_resources();
// Search replacement font
if( resources->find_font_by_char(glyph->char_code, new_path, freetype_face) ) {
plugin->load_freetype_face(freetype_library,
void TitleMain::build_previews(TitleWindow *gui)
{
- ArrayList<BC_FontEntry*>&fonts = *gui->get_resources()->fontlist;
+ BC_Resources *resources = BC_WindowBase::get_resources();
+ ArrayList<BC_FontEntry*>&fonts = *resources->fontlist;
for( int font_number=0; font_number<fonts.size(); ++font_number ) {
BC_FontEntry *font = fonts.get(font_number);
char new_path[BCTEXTLEN];
int text_height = gui->get_text_height(LARGEFONT);
int max_height = 3*text_height/2, max_width = 2 * max_height;
- int text_color = BC_WindowBase::get_resources()->default_text_color;
+ int text_color = resources->default_text_color;
int r = (text_color >> 16) & 0xff;
int g = (text_color >> 8) & 0xff;
int b = text_color & 0xff;
int total_w = 0;
int total_h = 0;
for( int pass=0; pass<2; ++pass ) {
+ if( resources->font_debug )
+ printf("Titler: build previews pass %d\n",pass);
//printf("TitleMain::build_previews %d %d %d\n",
//__LINE__, text_height, total_h);
for( int font_number=0; font_number<fonts.size(); ++font_number ) {
}
if( skip ) continue;
+ if( resources->font_debug )
+ printf("Titler: preview %s = %s\n",font->displayname, font->path);
if( pass > 0 ) {
font->image = new VFrame;
font->image->set_use_shm(0);
int TitleMain::load_font(BC_FontEntry *font)
{
- if( load_freetype_face(freetype_library,freetype_face, font->path) ) return 1;
+ if( !font || load_freetype_face(freetype_library,freetype_face, font->path) ) return 1;
strcpy(text_font, font->displayname);
return 0;
}