{
this->panel = panel;
x0 = x; y0 = y;
- in_window = tooltip_done = 0;
tip_info = 0;
set_force_tooltip(1);
}
delete [] tip_info;
}
-int ChannelDataItem::cursor_enter_event()
-{
- if( is_event_win() ) { in_window = 1; tooltip_done = 0; }
- else in_window = 0;
- return 0;
-}
-
-int ChannelDataItem::cursor_leave_event()
-{
- if( tooltip_done ) { hide_tooltip(); in_window = 0; }
- return 0;
-}
-
int ChannelDataItem::repeat_event(int64_t duration)
{
- if( !tooltip_done && tip_info && in_window &&
+ if( tip_info && cursor_above() &&
duration == get_resources()->tooltip_delay ) {
show_tooltip();
- tooltip_done = 1;
return 1;
}
return 0;
ChannelPanel *panel;
int x0, y0;
const char *tip_info;
- int in_window, tooltip_done;
- int cursor_enter_event();
- int cursor_leave_event();
int repeat_event(int64_t duration);
void set_tooltip(const char *tip);
#include "bcdisplayinfo.h"
#include "colorpicker.h"
#include "condition.h"
+#include "keys.h"
#include "language.h"
#include "mutex.h"
#include "mwindow.h"
delete yuv_y; delete yuv_u; delete yuv_v;
delete aph_a;
+ if( button_grabbed ) {
+ ungrab_buttons();
+ ungrab_cursor();
+ }
update_history(rgb888());
save_history();
}
yuv_y = new PaletteYUV(this, x,y+=40, yuv.y, 0, 1);
yuv_y->create_objects(); yuv_y->set_tooltip(_("Luminance"));
yuv_u = new PaletteYUV(this, x,y+=25, yuv.u, 0, 1);
- yuv_u->create_objects(); yuv_u->set_tooltip(_("Compliment Red"));
+ yuv_u->create_objects(); yuv_u->set_tooltip(_("Complement Blue"));
yuv_v = new PaletteYUV(this, x,y+=25, yuv.v, 0, 1);
- yuv_v->create_objects(); yuv_v->set_tooltip(_("Compliment Blue"));
+ yuv_v->create_objects(); yuv_v->set_tooltip(_("Complement Red"));
if( thread->do_alpha ) {
aph_a = new PaletteAPH(this, x,y+=40, aph, 0, 1);
aph_a->create_objects(); aph_a->set_tooltip(_("Alpha"));
return 0;
}
+void ColorWindow::update_rgb_hex(const char *hex)
+{
+ int color;
+ if( sscanf(hex,"%x",&color) == 1 ) {
+ float r = ((color>>16) & 0xff) / 255.;
+ float g = ((color>>8) & 0xff) / 255.;
+ float b = ((color>>0) & 0xff) / 255.;
+ rgb.r = r; rgb.g = g; rgb.b = b;
+ update_rgb();
+ update_display();
+ update_history();
+ handle_event();
+ }
+}
+
PaletteWheel::PaletteWheel(ColorWindow *window, int x, int y)
: BC_SubWindow(x, y, 170, 170)
g = (int)(g_f * 255);
b = (int)(b_f * 255);
for( j = 0; j < get_w(); j++ ) {
- row[j * 3] = r;
- row[j * 3 + 1] = g;
- row[j * 3 + 2] = b;
+ row[j * 3] = r;
+ row[j * 3 + 1] = g;
+ row[j * 3 + 2] = b;
}
}
FILE *fp = fopen(history_path,"r");
int i=0;
if( fp ) {
- while( i < PALLETTE_HISTORY_SIZE ) {
+ while( i < PALLETTE_HISTORY_SIZE ) {
char line[BCSTRLEN];
if( !fgets(line,sizeof(line)-1,fp) ) break;
line[sizeof(line)-1] = 0;
int PaletteHexButton::handle_event()
{
const char *hex = window->hex_box->get_text();
- int color;
- if( sscanf(hex,"%x",&color) == 1 ) {
- float r = ((color>>16) & 0xff) / 255.;
- float g = ((color>>8) & 0xff) / 255.;
- float b = ((color>>0) & 0xff) / 255.;
- window->rgb.r = r; window->rgb.g = g; window->rgb.b = b;
- window->update_rgb();
- window->update_display();
- window->update_history();
- window->handle_event();
- }
+ window->update_rgb_hex(hex);
return 1;
}
BC_TextBox::update(hex);
}
-int PaletteHex::handle_event()
+int PaletteHex::keypress_event()
{
+ if( get_keypress() != RETURN )
+ return BC_TextBox::keypress_event();
+ window->update_rgb_hex(get_text());
return 1;
}
}
PaletteGrabButton::~PaletteGrabButton()
{
- for( int i=0; i<3; ++i )
- delete vframes[i];
+ for( int i=0; i<3; ++i )
+ delete vframes[i];
}
int PaletteGrabButton::handle_event()
{
return 1;
}
-int PaletteHistory::cursor_enter_event()
-{
- set_tooltip_done(0);
- return 0;
-}
int PaletteHistory::cursor_leave_event()
{
hide_tooltip();
- set_tooltip_done(0);
return 0;
}
int PaletteHistory::repeat_event(int64_t duration)
if( duration == get_resources()->tooltip_delay &&
get_tooltip() && *get_tooltip() && cursor_above() ) {
show_tooltip();
- set_tooltip_done(1);
result = 1;
}
return result;
void update_rgb(float r, float g, float b);
void update_hsv(float h, float s, float v);
void update_yuv(float y, float u, float v);
+ void update_rgb_hex(const char *hex);
int rgb888();
ColorThread *thread;
public:
PaletteHex(ColorWindow *window, int x, int y, const char *hex);
~PaletteHex();
- int handle_event();
+ int keypress_event();
void update();
ColorWindow *window;
};
int button_press_event();
int button_release_event();
int cursor_motion_event();
- int cursor_enter_event();
int cursor_leave_event();
int repeat_event(int64_t duration);
// set this->value using bézier interpolation if possible
FloatAuto *left = (FloatAuto*)a1;
FloatAuto *right = (FloatAuto*)a2;
- float new_value = FloatAutos::calculate_bezier(left, right, pos);
+ if( pos != position ) { // this may trigger smoothing
+ this->adjust_to_new_coordinates(pos,
+ FloatAutos::calculate_bezier(left, right, pos));
+ }
float new_slope = FloatAutos::calculate_bezier_derivation(left, right, pos);
- this->adjust_to_new_coordinates(pos, new_value); // this may trigger smoothing
this->set_control_in_value(new_slope * control_in_position);
this->set_control_out_value(new_slope * control_out_position);
return 1; //return true: interpolated indeed...
defaults->load();
}
+
+void MWindow::check_language()
+{
+ char curr_lang[BCTEXTLEN]; curr_lang[0] = 0;
+ const char *env_lang = getenv("LANGUAGE");
+ if( !env_lang ) env_lang = getenv("LANG");
+ if( !env_lang ) {
+ snprintf(curr_lang, sizeof(curr_lang), "%s-%s.%s",
+ BC_Resources::language, BC_Resources::region, BC_Resources::encoding);
+ env_lang = curr_lang;
+ }
+ char last_lang[BCTEXTLEN]; last_lang[0] = 0;
+ defaults->get("LAST_LANG",last_lang);
+ if( strcmp(env_lang,last_lang)) {
+ printf("lang changed from '%s' to '%s'\n", last_lang, env_lang);
+ defaults->update("LAST_LANG",env_lang);
+ char plugin_path[BCTEXTLEN];
+ create_defaults_path(plugin_path, PLUGIN_FILE);
+ ::remove(plugin_path);
+ char ladspa_path[BCTEXTLEN];
+ create_defaults_path(ladspa_path, LADSPA_FILE);
+ ::remove(ladspa_path);
+ defaults->save();
+ }
+}
+
void MWindow::get_plugin_path(char *path, const char *plug_dir, const char *fs_path)
{
char *base_path = FileSystem::basepath(fs_path), *bp = base_path;
BC_Trace::disable_locks();
}
BC_WindowBase::get_resources()->popupmenu_btnup = preferences->popupmenu_btnup;
+ BC_WindowBase::get_resources()->textbox_focus_policy = preferences->textbox_focus_policy;
}
void MWindow::clean_indexes()
if(debug) PRINT_TRACE
default_standard = default_std();
init_defaults(defaults, config_path);
+ check_language();
init_preferences();
if(splash_window)
splash_window->operation->update(_("Initializing Plugins"));
void init_error();
void finit_error();
static void init_defaults(BC_Hash* &defaults, char *config_path);
+ void check_language();
const char *default_std();
void fill_preset_defaults(const char *preset, EDLSession *session);
const char *get_preset_name(int index);
void ResizeVTrackThread::start_window(int w, int h, int w1, int h1)
{
+ if( window && running() ) {
+ window->lock_window();
+ window->raise_window();
+ window->unlock_window();
+ return;
+ }
this->w = w; this->h = h;
this->w1 = w1; this->h1 = h1;
w_scale = h_scale = 1;
void ResizeVTrackThread::run()
{
- ResizeVTrackWindow *window = this->window =
- new ResizeVTrackWindow(mwindow,
- this,
+ window = new ResizeVTrackWindow(mwindow, this,
mwindow->gui->get_abs_cursor_x(1),
mwindow->gui->get_abs_cursor_y(1));
window->create_objects();
int result = window->run_window();
- this->window = 0;
- delete window;
-
- if(!result)
- {
+ delete window; window = 0;
+ if(!result) {
update();
}
- if(((w % 4) ||
- (h % 4)) &&
+ if(((w % 4) || (h % 4)) &&
mwindow->edl->session->playback_config->vconfig->driver == PLAYBACK_X11_GL)
{
MainError::show_error(
int BC_Button::repeat_event(int64_t duration)
{
- if( status == BUTTON_UPHI && !tooltip_done &&
- tooltip_text && tooltip_text[0] != 0 &&
+ if( status == BUTTON_UPHI && tooltip_text && tooltip_text[0] != 0 &&
duration == top_level->get_resources()->tooltip_delay )
{
show_tooltip();
- tooltip_done = 1;
return 1;
}
return 0;
{
if(is_event_win() && enabled)
{
- tooltip_done = 0;
- if(top_level->button_down)
- {
+ if(top_level->button_down) {
status = BUTTON_DOWNHI;
}
else
// reset the search engine
//printf("BC_ListBox::BC_ListBox 4\n");
+ show_query = 0;
reset_query();
//printf("BC_ListBox::BC_ListBox 5\n");
}
case NO_OPERATION:
// Show tooltip
- if(button_highlighted && is_popup && !tooltip_done &&
+ if(button_highlighted && is_popup &&
tooltip_text && tooltip_text[0] != 0 &&
duration == get_resources()->tooltip_delay)
{
show_tooltip();
- tooltip_done = 1;
return 1;
}
break;
int BC_ListBox::deactivate()
{
+ hide_tooltip();
// printf("BC_ListBox::deactivate %d this=%p gui=%p active=%d\n",
// __LINE__,
// this,
{
case ESC:
case RETURN:
- case BACKSPACE:
top_level->deactivate();
// If user is manipulating popup with keyboard, don't pass on event.
if(query_len > 0) query[--query_len] = 0;
new_selection = query_list();
}
-
+ if( show_query ) {
+ if( query_len > 0 )
+ show_tooltip(query);
+ else
+ hide_tooltip();
+ }
redraw = 1;
result = 1;
}
void set_justify(int value);
int get_w() { return is_popup ? BCPOPUPLISTBOX_W : popup_w; }
int get_h() { return is_popup ? BCPOPUPLISTBOX_H : popup_h; }
+ int gui_tooltip(const char *text) {
+ return is_popup && gui ? gui->show_tooltip(text, gui->get_w(),0, -1,-1) : -1;
+ }
int get_view_w() { return view_w; }
int get_view_h() { return view_h; }
int get_row_height() { return row_height; }
void reset_query();
+ int get_show_query() { return show_query; }
+ void set_show_query(int v) { show_query = v; }
+
int reposition_window(int x,
int y,
int w = -1,
BC_ListBoxYScroll *yscrollbar;
ArrayList<BC_ListBoxToggle*> expanders;
char query[BCTEXTLEN];
-
+ int show_query;
// Window containing the listbox
BC_WindowBase *gui;
int list_background;
-
// Popup button
BC_Pixmap *button_images[4];
// Expander
int BC_Pan::repeat_event(int64_t duration)
{
- if( highlighted && !active && !tooltip_done &&
+ if( highlighted && !active &&
tooltip_text && tooltip_text[0] != 0 &&
duration == top_level->get_resources()->tooltip_delay )
{
show_tooltip();
- tooltip_done = 1;
return 1;
}
return 0;
{
if(is_event_win() && !highlighted)
{
- tooltip_done = 0;
highlighted = 1;
draw(1, 1);
}
int BC_PopupMenu::repeat_event(int64_t duration)
{
- if( status == BUTTON_HI && !tooltip_done &&
+ if( status == BUTTON_HI &&
tooltip_text && tooltip_text[0] != 0 &&
duration == top_level->get_resources()->tooltip_delay )
{
show_tooltip();
- tooltip_done = 1;
return 1;
}
return 0;
{
if(is_event_win() && use_title)
{
- tooltip_done = 0;
if(top_level->button_down)
{
status = BUTTON_DN;
}
else
show_tooltip();
- tooltip_done = 1;
}
return 1;
}
{
if(top_level->event_win == win && enabled)
{
- tooltip_done = 0;
if(!top_level->button_down && status == POT_UP)
{
status = POT_HIGH;
}
if(!strcasecmp(entry->swidth, "normal"))
- entry->style = FL_WIDTH_NORMAL;
+ entry->style |= FL_WIDTH_NORMAL;
else if(!strcasecmp(entry->swidth, "ultracondensed"))
- entry->style = FL_WIDTH_ULTRACONDENSED;
+ entry->style |= FL_WIDTH_ULTRACONDENSED;
else if(!strcasecmp(entry->swidth, "extracondensed"))
- entry->style = FL_WIDTH_EXTRACONDENSED;
+ entry->style |= FL_WIDTH_EXTRACONDENSED;
else if(!strcasecmp(entry->swidth, "condensed"))
- entry->style = FL_WIDTH_CONDENSED;
+ entry->style |= FL_WIDTH_CONDENSED;
else if(!strcasecmp(entry->swidth, "semicondensed"))
- entry->style = FL_WIDTH_SEMICONDENSED;
+ entry->style |= FL_WIDTH_SEMICONDENSED;
else if(!strcasecmp(entry->swidth, "semiexpanded"))
- entry->style = FL_WIDTH_SEMIEXPANDED;
+ entry->style |= FL_WIDTH_SEMIEXPANDED;
else if(!strcasecmp(entry->swidth, "expanded"))
- entry->style = FL_WIDTH_EXPANDED;
+ entry->style |= FL_WIDTH_EXPANDED;
else if(!strcasecmp(entry->swidth, "extraexpanded"))
- entry->style = FL_WIDTH_EXTRAEXPANDED;
+ entry->style |= FL_WIDTH_EXTRAEXPANDED;
else if(!strcasecmp(entry->swidth, "ultraexpanded"))
- entry->style = FL_WIDTH_ULTRAEXPANDED;
+ entry->style |= FL_WIDTH_ULTRAEXPANDED;
else
- entry->style = FL_WIDTH_NORMAL;
+ entry->style |= FL_WIDTH_NORMAL;
fontlist->append(entry);
// printf("TitleMain::build_fonts %s: success\n", entry->path);
set_tooltip(get_caption());
show_tooltip();
}
- tooltip_done = 1;
return 1;
}
}
//printf("BC_Slider::cursor_enter_event 1\n");
if(top_level->event_win == win && status == SLIDER_UP)
{
- tooltip_done = 0;
status = SLIDER_HI;
draw_face(1);
}
if( top_level->event_win == win && enabled &&
!(top_level->get_resources()->textbox_focus_policy & CLICK_ACTIVATE) )
{
- tooltip_done = 0;
if( !active ) {
top_level->deactivate();
activate();
tooltip_text && tooltip_text[0] != 0 && highlighted)
{
show_tooltip();
- tooltip_done = 1;
result = 1;
}
return textbox->get_h();
}
+int BC_PopupTextBox::get_show_query()
+{
+ return listbox->get_show_query();
+}
+
+void BC_PopupTextBox::set_show_query(int v)
+{
+ listbox->set_show_query(v);
+}
+
int BC_PopupTextBox::handle_event()
{
return 1;
int get_y();
int get_w();
int get_h();
+ int get_show_query();
+ void set_show_query(int v);
+
void update(const char *text);
void update_list(ArrayList<BC_ListBoxItem*> *data);
void reposition_window(int x, int y);
int BC_Toggle::repeat_event(int64_t duration)
{
- if(tooltip_text && tooltip_text[0] != 0 && !tooltip_done &&
+ if(tooltip_text && tooltip_text[0] != 0 &&
duration == top_level->get_resources()->tooltip_delay &&
(status == BC_Toggle::TOGGLE_UPHI || status == BC_Toggle::TOGGLE_CHECKEDHI))
{
show_tooltip();
- tooltip_done = 1;
return 1;
}
return 0;
{
if(top_level->event_win == win && enabled)
{
- tooltip_done = 0;
if(top_level->button_down)
status = BC_Toggle::TOGGLE_DOWN;
else
if(duration == top_level->get_resources()->tooltip_delay)
{
if(tooltip_text && tooltip_text[0] != 0 &&
- status == TUMBLE_UPHI && !tooltip_done)
+ status == TUMBLE_UPHI)
{
show_tooltip();
- tooltip_done = 1;
return 1;
}
}
{
if(top_level->event_win == win)
{
- tooltip_done = 0;
if(! top_level->button_down && status == TUMBLE_UP)
{
status = TUMBLE_UPHI;
force_tooltip = 0;
// next_repeat_id = 0;
tooltip_popup = 0;
- tooltip_done = 0;
current_font = MEDIUMFONT;
current_color = BLACK;
current_cursor = ARROW_CURSOR;
}
-
-
-
-int BC_WindowBase::show_tooltip(int w, int h)
+int BC_WindowBase::show_tooltip(const char *text, int x, int y, int w, int h)
{
- Window tempwin;
-
- if(tooltip_text && !tooltip_on &&
- (force_tooltip || get_resources()->tooltips_enabled))
- {
- int x, y;
+// default text
+ int forced = !text ? force_tooltip : 1;
+ if( !text ) text = tooltip_text;
+ if( !text || (!forced && !get_resources()->tooltips_enabled) ) {
top_level->hide_tooltip();
-
+ return 1;
+ }
+// default w,h
+ if(w < 0) w = get_text_width(MEDIUMFONT, text) + TOOLTIP_MARGIN * 2;
+ if(h < 0) h = get_text_height(MEDIUMFONT, text) + TOOLTIP_MARGIN * 2;
+// default x,y (win relative)
+ if( x < 0 ) x = get_w();
+ if( y < 0 ) y = get_h();
+ int wx, wy;
+ get_root_coordinates(x, y, &wx, &wy);
+// keep the tip inside the window/display
+ int x0 = top_level->get_x(), x1 = x0 + top_level->get_w();
+ int x2 = top_level->get_screen_x(0, -1) + top_level->get_screen_w(0, -1);
+ if( x1 > x2 ) x1 = x2;
+ if( wx < x0 ) wx = x0;
+ if( wx >= (x1-=w) ) wx = x1;
+ int y0 = top_level->get_y(), y1 = y0 + top_level->get_h();
+ int y2 = top_level->get_root_h(0);
+ if( y1 > y2 ) y1 = y2;
+ if( wy < y0 ) wy = y0;
+ if( wy >= (y1-=h) ) wy = y1;
+// avoid tip under cursor (flickers)
+ int abs_x, abs_y;
+ get_abs_cursor_xy(abs_x,abs_y, 0);
+ if( wx < abs_x && abs_x < wx+w && wy < abs_y && abs_y < wy+h ) {
+ if( wx-abs_x < wy-abs_y )
+ wx = abs_x+1;
+ else
+ wy = abs_y+1;
+ }
+ if( !tooltip_on ) {
tooltip_on = 1;
- if(w < 0)
- w = get_text_width(MEDIUMFONT, tooltip_text);
-
- if(h < 0)
- h = get_text_height(MEDIUMFONT, tooltip_text);
-
- w += TOOLTIP_MARGIN * 2;
- h += TOOLTIP_MARGIN * 2;
-
- XTranslateCoordinates(top_level->display, win,
- top_level->rootwin, get_w(), get_h(),
- &x, &y, &tempwin);
- // keep the tip inside the window/display
- int top_x = top_level->get_x();
- if( x < top_x ) x = top_x;
- int top_w = top_x + top_level->get_w();
- int lmt_w = top_level->get_screen_x(0, -1) + top_level->get_screen_w(0, -1);
- if( top_w < lmt_w ) lmt_w = top_w;
- if( x+w > lmt_w ) x = lmt_w-w;
- if( x < 0 ) x = 0;
- int top_y = top_level->get_y();
- if( y < top_y ) y = top_y;
- int top_h = top_y + top_level->get_h();
- int lmt_h = top_level->get_root_h(0);
- if( top_h < lmt_h ) lmt_h = top_h;
- if( y+h > lmt_h ) y = lmt_h-h;
- if( y < 0 ) y = 0;
- int abs_x, abs_y, win_x, win_y;
- unsigned int temp_mask;
- Window temp_win;
- XQueryPointer(top_level->display, top_level->win,
- &temp_win, &temp_win, &abs_x, &abs_y,
- &win_x, &win_y, &temp_mask);
- // check for cursor inside popup
- if( x < abs_x && abs_x < x+w && y < abs_y && abs_y < y+h )
- {
- if( x-abs_x < y-abs_y )
- x = abs_x+1;
- else
- y = abs_y+1;
- }
- tooltip_popup = new BC_Popup(top_level, x, y, w, h,
- get_resources()->tooltip_bg_color);
-
- draw_tooltip();
- tooltip_popup->set_font(MEDIUMFONT);
- tooltip_popup->flash();
- tooltip_popup->flush();
+ tooltip_popup = new BC_Popup(top_level, wx, wy, w, h,
+ get_resources()->tooltip_bg_color);
}
+ else
+ tooltip_popup->reposition_window(wx, wy, w, h);
+
+ draw_tooltip(text);
+ tooltip_popup->flash();
+ tooltip_popup->flush();
return 0;
}
}
return 0;
}
-void BC_WindowBase::set_tooltip_done(int v)
-{
- tooltip_done = v;
-}
-
// signal the event handler to repeat
int BC_WindowBase::set_repeat(int64_t duration)
{
XUndefineCursor(top_level->display, top_level->rootwin);
}
-int BC_WindowBase::get_w()
-{
- return w;
-}
-
-int BC_WindowBase::get_h()
-{
- return h;
-}
-
-int BC_WindowBase::get_x()
-{
- return x;
-}
-
-int BC_WindowBase::get_y()
-{
- return y;
-}
-
// for get_root_w/h
// WidthOfScreen/HeightOfScreen of XDefaultScreenOfDisplay
// this is the bounding box of all the screens
void add_keyboard_listener(int(BC_WindowBase::*handler)(BC_WindowBase *));
void del_keyboard_listener(int(BC_WindowBase::*handler)(BC_WindowBase *));
// Dimensions
- virtual int get_w();
- virtual int get_h();
- virtual int get_x();
- virtual int get_y();
+ virtual int get_w() { return w; }
+ virtual int get_h() { return h; }
+ virtual int get_x() { return x; }
+ virtual int get_y() { return y; }
int get_root_w(int lock_display);
int get_root_h(int lock_display);
XineramaScreenInfo *get_xinerama_info(int screen);
int unset_repeat(int64_t duration);
const char *get_tooltip();
int set_tooltip(const char *text);
- void set_tooltip_done(int v);
- int show_tooltip(int w = -1, int h = -1);
+ virtual int show_tooltip(const char *text, int x=-1, int y=-1, int w = -1, int h = -1);
+ int show_tooltip(int w=-1, int h=-1) { return show_tooltip(0, -1, -1, w, h); }
int hide_tooltip();
int set_icon(VFrame *data);
int load_defaults(BC_Hash *defaults);
int trigger_tooltip();
int untrigger_tooltip();
- void draw_tooltip();
+ void draw_tooltip(const char *text=0);
static XEvent *new_xevent();
// delete all repeater opjects for a close
int unset_all_repeaters();
// Popup window for tooltip
BC_Popup *tooltip_popup;
// If this subwindow has already shown a tooltip since the last EnterNotify
- int tooltip_done;
int options;
int flash_enabled;
pixmap);
}
-void BC_WindowBase::draw_tooltip()
+void BC_WindowBase::draw_tooltip(const char *text)
{
- if(tooltip_popup && tooltip_text)
+ if( !text )
+ text = tooltip_text;
+ if(tooltip_popup && text)
{
int w = tooltip_popup->get_w(), h = tooltip_popup->get_h();
tooltip_popup->set_color(get_resources()->tooltip_bg_color);
tooltip_popup->set_font(MEDIUMFONT);
tooltip_popup->draw_text(TOOLTIP_MARGIN,
get_text_ascent(MEDIUMFONT) + TOOLTIP_MARGIN,
- tooltip_text);
+ text);
}
}
int mask = FL_WEIGHT_MASK | FL_SLANT_MASK;
BC_Resources *resources = BC_WindowBase::get_resources();
- return resources->find_fontentry(font_name, flavor, mask, style);
+ BC_FontEntry *font = resources->find_fontentry(font_name, flavor, mask, style);
+ if( font && strcmp(font_name, font->displayname) ) font = 0;
+ return font;
}
BC_FontEntry* TitleMain::config_font()
{
BC_FontEntry *font = get_font(config.font, config.style);
- if( font && load_font(font) )
- font = get_font(FIXED_FONT,0);
+ if( !font || load_font(font) )
+ load_font(font = get_font(FIXED_FONT,0));
return font;
}
#include "cwindowgui.h"
#include "edl.h"
#include "edlsession.h"
+#include "keys.h"
#include "language.h"
#include "mwindow.h"
#include "plugin.h"
void TitleWindow::done_event(int result)
{
ungrab(client->server->mwindow->cwindow->gui);
+ color_thread->close_window();
+ outline_color_thread->close_window();
+ color_popup->close_window();
+ png_popup->close_window();
}
TitleWindow::~TitleWindow()
add_tool(font_title = new BC_Title(x, y, _("Font:")));
font = new TitleFont(client, this, x, y + font_title->get_h());
font->create_objects();
+ font->set_show_query(1);
x += font->get_w();
add_subwindow(font_tumbler = new TitleFontTumble(client, this, x, y+margin));
x += font_tumbler->get_w() + margin;
}
TitleColorButton::TitleColorButton(TitleMain *client, TitleWindow *window, int x, int y)
- : BC_GenericButton(x, y, _("Color..."))
+ : BC_GenericButton(x, y, _("Text Color..."))
{
this->client = client;
this->window = window;
void TitleWindow::check_style(const char *font_name)
{
- BC_FontEntry *font;
- font = TitleMain::get_font(font_name, BC_FONT_ITALIC);
- strcmp(font_name, font->displayname) ? italic->disable() : italic->enable();
- font = TitleMain::get_font(font_name, BC_FONT_BOLD);
- strcmp(font_name, font->displayname) ? bold->disable() : bold->enable();
+ BC_FontEntry *font_nrm = TitleMain::get_font(font_name, 0);
+ BC_FontEntry *font_itl = TitleMain::get_font(font_name, BC_FONT_ITALIC);
+ BC_FontEntry *font_bld = TitleMain::get_font(font_name, BC_FONT_BOLD);
+ BC_FontEntry *font_bit = TitleMain::get_font(font_name, BC_FONT_ITALIC | BC_FONT_BOLD);
+ int has_norm = font_nrm != 0 ? 1 : 0;
+ int has_ital = font_itl != 0 || font_bit != 0 ? 1 : 0;
+ int has_bold = font_bld != 0 || font_bit != 0 ? 1 : 0;
+ if( bold->get_value() ) {
+ if( !has_bold ) bold->update(0);
+ }
+ else {
+ if( !has_norm && has_bold ) bold->update(1);
+ }
+ if( italic->get_value() ) {
+ if( !has_ital ) italic->update(0);
+ }
+ else {
+ if( !has_norm && has_ital ) italic->update(1);
+ }
+ if( has_norm && has_bold ) bold->enable(); else bold->disable();
+ if( has_norm && has_ital ) italic->enable(); else italic->disable();
}
TitleFont::TitleFont(TitleMain *client, TitleWindow *window, int x, int y)
TitleColorThread::TitleColorThread(TitleMain *client, TitleWindow *window, int is_outline)
- : ColorThread(1, _("Text Color"))
+ : ColorThread(1, is_outline? _("Outline Color") : _("Text Color"))
{
this->client = client;
this->window = window;
this->client = client;
this->window = window;
set_use_button(0);
+ set_show_query(1);
}
TitleFontsPopup::~TitleFontsPopup()
{
}
+int TitleFontsPopup::keypress_event()
+{
+ switch( get_keypress() ) {
+ case ESC:
+ case DELETE:
+ deactivate();
+ return 1;
+ default:
+ break;
+ }
+ return BC_ListBox::keypress_event();
+}
int TitleFontsPopup::handle_event()
{
}
TitleColorPopup::TitleColorPopup(TitleMain *client, TitleWindow *window)
- : ColorThread(0, _("Text Color"))
+ : ColorThread(0, _("Color"))
{
this->client = client;
this->window = window;
public:
TitleFontsPopup(TitleMain *client, TitleWindow *window);
~TitleFontsPopup();
+ int keypress_event();
int handle_event();
+ int show_tooltip(const char *text, int x,int y, int w,int h) {
+ return gui_tooltip(text);
+ }
TitleMain *client;
TitleWindow *window;