titler fixes, auto paste bug, resize popup hang, focus policy fix, chk lang
authorGood Guy <good1.2guy@gmail.com>
Sat, 18 Mar 2017 22:00:56 +0000 (16:00 -0600)
committerGood Guy <good1.2guy@gmail.com>
Sat, 18 Mar 2017 22:00:56 +0000 (16:00 -0600)
26 files changed:
cinelerra-5.1/cinelerra/channelinfo.C
cinelerra-5.1/cinelerra/channelinfo.h
cinelerra-5.1/cinelerra/colorpicker.C
cinelerra-5.1/cinelerra/colorpicker.h
cinelerra-5.1/cinelerra/floatauto.C
cinelerra-5.1/cinelerra/mwindow.C
cinelerra-5.1/cinelerra/mwindow.h
cinelerra-5.1/cinelerra/resizetrackthread.C
cinelerra-5.1/guicast/bcbutton.C
cinelerra-5.1/guicast/bclistbox.C
cinelerra-5.1/guicast/bclistbox.h
cinelerra-5.1/guicast/bcpan.C
cinelerra-5.1/guicast/bcpopupmenu.C
cinelerra-5.1/guicast/bcpot.C
cinelerra-5.1/guicast/bcresources.C
cinelerra-5.1/guicast/bcslider.C
cinelerra-5.1/guicast/bctextbox.C
cinelerra-5.1/guicast/bctextbox.h
cinelerra-5.1/guicast/bctoggle.C
cinelerra-5.1/guicast/bctumble.C
cinelerra-5.1/guicast/bcwindowbase.C
cinelerra-5.1/guicast/bcwindowbase.h
cinelerra-5.1/guicast/bcwindowdraw.C
cinelerra-5.1/plugins/titler/titler.C
cinelerra-5.1/plugins/titler/titlerwindow.C
cinelerra-5.1/plugins/titler/titlerwindow.h

index 42a3d883eebcb10820992096029bd6e159a228fd..b96be4f354bd539577d375e2044c1f715ded1863 100644 (file)
@@ -628,7 +628,6 @@ ChannelDataItem::ChannelDataItem(ChannelPanel *panel, int x, int y, int w,
 {
        this->panel = panel;
        x0 = x;  y0 = y;
-       in_window = tooltip_done = 0;
        tip_info = 0;
        set_force_tooltip(1);
 }
@@ -638,25 +637,11 @@ ChannelDataItem::~ChannelDataItem()
        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;
index 5e01b06c8fe8d32ea89293474af025e6d9bc60c7..d436ebb8c8f0761a862c3776b13167423239df99 100644 (file)
@@ -267,10 +267,7 @@ public:
        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);
 
index 969e8c98ce6d870f643e32d1d5d0e4dacbd905fc..60fcfad9fd779c6bc37aff2fb2ca5d3614d026f8 100644 (file)
@@ -24,6 +24,7 @@
 #include "bcdisplayinfo.h"
 #include "colorpicker.h"
 #include "condition.h"
+#include "keys.h"
 #include "language.h"
 #include "mutex.h"
 #include "mwindow.h"
@@ -134,6 +135,10 @@ ColorWindow::~ColorWindow()
        delete yuv_y;  delete yuv_u;  delete yuv_v;
        delete aph_a;
 
+       if( button_grabbed ) {
+               ungrab_buttons();
+               ungrab_cursor();
+       }
        update_history(rgb888());
        save_history();
 }
@@ -206,9 +211,9 @@ void ColorWindow::create_objects()
        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"));
@@ -335,6 +340,21 @@ int ColorWindow::button_release_event()
        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)
@@ -602,9 +622,9 @@ int PaletteWheelValue::draw(float hue, float saturation, float value)
                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;
                }
        }
 
@@ -880,7 +900,7 @@ void ColorWindow::load_history()
        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;
@@ -999,17 +1019,7 @@ PaletteHexButton::~PaletteHexButton()
 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;
 }
 
@@ -1027,8 +1037,11 @@ void PaletteHex::update()
        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;
 }
 
@@ -1047,8 +1060,8 @@ PaletteGrabButton::PaletteGrabButton(ColorWindow *window, int x, int y)
 }
 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()
 {
@@ -1117,15 +1130,9 @@ int PaletteHistory::cursor_motion_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)
@@ -1135,7 +1142,6 @@ 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;
index a63069324050b12ecac6d3b6f6488f2edb86a09f..94386e8ef7cabc20020e25b5eb37a49573b57257 100644 (file)
@@ -98,6 +98,7 @@ public:
        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;
@@ -335,7 +336,7 @@ class PaletteHex : public BC_TextBox
 public:
        PaletteHex(ColorWindow *window, int x, int y, const char *hex);
        ~PaletteHex();
-       int handle_event();
+       int keypress_event();
        void update();
        ColorWindow *window;
 };
@@ -360,7 +361,6 @@ public:
        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);
 
index 1f22aeaa1c851661d30f9af759d13ed38d50d8a0..bab8160f28675345819dacd269665e5de85fc78e 100644 (file)
@@ -142,9 +142,11 @@ int FloatAuto::interpolate_from(Auto *a1, Auto *a2, int64_t pos, Auto *templ)
                // 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...
index 1060bb8896f02aeef1cbce7691ae6f804964fc17..d02fe0bbc1ae53894840d4e566af3e3eb22c81a2 100644 (file)
@@ -461,6 +461,32 @@ void MWindow::init_defaults(BC_Hash* &defaults, char *config_path)
        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;
@@ -796,6 +822,7 @@ void MWindow::init_preferences()
                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()
@@ -1891,6 +1918,7 @@ void MWindow::create_objects(int want_gui,
        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"));
index abe72590dba9a3d98f786657a0cfd1f611110879..a0ec37f3a4d0e8aa9a5f495381db9cca8f2782c7 100644 (file)
@@ -632,6 +632,7 @@ public:
        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);
index 1c2eadc841c0ecd02f089a7b40f81e7469037301..4af7eb75bab7c47f698d4c65c2f228adac02be0f 100644 (file)
@@ -60,6 +60,12 @@ ResizeVTrackThread::~ResizeVTrackThread()
 
 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;
@@ -69,24 +75,18 @@ void ResizeVTrackThread::start_window(int w, int h, int w1, int h1)
 
 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(
index 90a4681db0ddd6d28750315449cdafeb3dc7cce8..de76b69c62498ffc2ffdfe314f5ecc9193c39011 100644 (file)
@@ -154,12 +154,10 @@ int BC_Button::draw_face(int flush)
 
 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;
@@ -169,9 +167,7 @@ int BC_Button::cursor_enter_event()
 {
        if(is_event_win() && enabled)
        {
-               tooltip_done = 0;
-               if(top_level->button_down)
-               {
+               if(top_level->button_down) {
                        status = BUTTON_DOWNHI;
                }
                else
index 3b1332923fcc9953e21374d060afe169960a0254..7a521a310d2244edfcd69bf17975ff57c7909ed8 100644 (file)
@@ -432,6 +432,7 @@ BC_ListBox::BC_ListBox(int x,
 
 // reset the search engine
 //printf("BC_ListBox::BC_ListBox 4\n");
+       show_query = 0;
        reset_query();
 //printf("BC_ListBox::BC_ListBox 5\n");
 }
@@ -2479,12 +2480,11 @@ int BC_ListBox::repeat_event(int64_t duration)
 
                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;
@@ -3942,6 +3942,7 @@ int BC_ListBox::reposition_window(int x, int y, int w, int h, int flush)
 
 int BC_ListBox::deactivate()
 {
+       hide_tooltip();
 // printf("BC_ListBox::deactivate %d this=%p gui=%p active=%d\n",
 // __LINE__,
 // this,
@@ -4030,7 +4031,6 @@ int BC_ListBox::keypress_event()
        {
                case ESC:
                case RETURN:
-               case BACKSPACE:
                        top_level->deactivate();
 
 // If user is manipulating popup with keyboard, don't pass on event.
@@ -4131,7 +4131,12 @@ int BC_ListBox::keypress_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;
                        }
index e815a7f7edd1935616c4f4d5efb5096116f480b0..66d13255f86bb2b59bd7782586923dcd127104de 100644 (file)
@@ -253,6 +253,9 @@ public:
        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; }
@@ -275,6 +278,9 @@ public:
 
 
        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,
@@ -503,7 +509,7 @@ private:
        BC_ListBoxYScroll *yscrollbar;
        ArrayList<BC_ListBoxToggle*> expanders;
        char query[BCTEXTLEN];
-
+       int show_query;
 
 // Window containing the listbox
        BC_WindowBase *gui;
@@ -534,7 +540,6 @@ private:
        int list_background;
 
 
-
 // Popup button
        BC_Pixmap *button_images[4];
 // Expander
index 7af2d1eb3591ce18080de6a74cdbb4376e38ba70..e35925f43c38ac6017a39494d5d5863730accb67 100644 (file)
@@ -192,12 +192,11 @@ int BC_Pan::button_release_event()
 
 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;
@@ -207,7 +206,6 @@ int BC_Pan::cursor_enter_event()
 {
        if(is_event_win() && !highlighted)
        {
-               tooltip_done = 0;
                highlighted = 1;
                draw(1, 1);
        }
index 4c424ae563a2b9aa6666435fd2e5e73f592b2fb5..6a8c63e2f9daaafa61089100eaf36798d685e89c 100644 (file)
@@ -355,12 +355,11 @@ int BC_PopupMenu::focus_out_event()
 
 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;
@@ -485,7 +484,6 @@ int BC_PopupMenu::cursor_enter_event()
 {
        if(is_event_win() && use_title)
        {
-               tooltip_done = 0;
                if(top_level->button_down)
                {
                        status = BUTTON_DN;
index d9cb1594db9559cc9d49800630945d7ca7d6d123..7417e79ed6a780a221aedc28058022eed0e7d15e 100644 (file)
@@ -247,7 +247,6 @@ int BC_Pot::repeat_event(int64_t duration)
                                }
                                else
                                        show_tooltip();
-                               tooltip_done = 1;
                        }
                        return 1;
                }
@@ -291,7 +290,6 @@ int BC_Pot::cursor_enter_event()
 {
        if(top_level->event_win == win && enabled)
        {
-               tooltip_done = 0;
                if(!top_level->button_down && status == POT_UP)
                {
                        status = POT_HIGH;
index 7f803ec03e4c4b15beddafc7e4419ca97c2bc4b2..6e8e1ca7aaf70fa1f8ae419c8fbcf72316d0335c 100644 (file)
@@ -968,25 +968,25 @@ int BC_Resources::init_fontconfig(const char *search_path)
                }
 
                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);
index fdb0c0307a04e573ba27a7b7a43bda5526d707a3..79283d291467c51120377e5b1b11b1ed9d521076 100644 (file)
@@ -208,7 +208,6 @@ int BC_Slider::repeat_event(int64_t duration)
                                set_tooltip(get_caption());
                                show_tooltip();
                        }
-                       tooltip_done = 1;
                        return 1;
                }
        }
@@ -256,7 +255,6 @@ int BC_Slider::cursor_enter_event()
 //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);
        }
index 78c51e00c6b16a60ba39e1a3605082348a9d3cc2..6916f2e1777d0943ec09c910a954bf1a06237b8b 100644 (file)
@@ -753,7 +753,6 @@ int BC_TextBox::cursor_enter_event()
        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();
@@ -1014,7 +1013,6 @@ int BC_TextBox::repeat_event(int64_t duration)
                tooltip_text && tooltip_text[0] != 0 && highlighted)
        {
                show_tooltip();
-               tooltip_done = 1;
                result = 1;
        }
 
@@ -2455,6 +2453,16 @@ int BC_PopupTextBox::get_h()
        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;
index c8e2a71a4d747b29647608d70f2c7d5694012bf2..a46661cdc5f3d6dec33ccd9baca409341ed2ee8a 100644 (file)
@@ -322,6 +322,9 @@ public:
        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);
index 3d82b78cd73cacf1a1c93f2c212e430f4e554a3a..1155467374b09dd3b8cfcf8cebca7f39e81c115f 100644 (file)
@@ -273,12 +273,11 @@ void BC_Toggle::set_status(int value)
 
 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;
@@ -288,7 +287,6 @@ int BC_Toggle::cursor_enter_event()
 {
        if(top_level->event_win == win && enabled)
        {
-               tooltip_done = 0;
                if(top_level->button_down)
                        status = BC_Toggle::TOGGLE_DOWN;
                else
index 7dd78161597ce4fb947adb042fc6f26e4283c8c9..e95f8abbdc5fedff1c2d6503118b9ad703f03b5a 100644 (file)
@@ -130,10 +130,9 @@ int BC_Tumbler::repeat_event(int64_t duration)
        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;
                }
        }
@@ -163,7 +162,6 @@ int BC_Tumbler::cursor_enter_event()
 {
        if(top_level->event_win == win)
        {
-               tooltip_done = 0;
                if(! top_level->button_down && status == TUMBLE_UP)
                {
                        status = TUMBLE_UPHI;
index 823d81aa609b18099724ca341cd2d24d2e876dfd..e4a0ef6b785708aacda45b2fe23d2684e17bb2e1 100644 (file)
@@ -302,7 +302,6 @@ int BC_WindowBase::initialize()
        force_tooltip = 0;
 //     next_repeat_id = 0;
        tooltip_popup = 0;
-       tooltip_done = 0;
        current_font = MEDIUMFONT;
        current_color = BLACK;
        current_cursor = ARROW_CURSOR;
@@ -1771,69 +1770,54 @@ int BC_WindowBase::dispatch_drag_motion()
 }
 
 
-
-
-
-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;
 }
 
@@ -1871,11 +1855,6 @@ int BC_WindowBase::set_tooltip(const char *text)
        }
        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)
 {
@@ -3398,26 +3377,6 @@ void BC_WindowBase::ungrab_cursor()
        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
index 767427dc2a7a63c45d6eaeec75b0092f083d3071..891daf06d33babb6b862ea545d925ba13ca4d50f 100644 (file)
@@ -269,10 +269,10 @@ public:
        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);
@@ -514,8 +514,8 @@ public:
        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);
@@ -583,7 +583,7 @@ private:
 
        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();
@@ -730,7 +730,6 @@ private:
 // 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;
 
index e95b040260e2b7bb1e7927021697bd070e9e6dfe..52b7f83727a4cbfce049250ba9c91a43aafd1c9a 100644 (file)
@@ -1117,9 +1117,11 @@ void BC_WindowBase::draw_vframe(VFrame *frame,
                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);
@@ -1129,7 +1131,7 @@ void BC_WindowBase::draw_tooltip()
                tooltip_popup->set_font(MEDIUMFONT);
                tooltip_popup->draw_text(TOOLTIP_MARGIN,
                        get_text_ascent(MEDIUMFONT) + TOOLTIP_MARGIN,
-                       tooltip_text);
+                       text);
        }
 }
 
index b7d8e7275ac374018140353560d102eca867db5b..ad9e772fa9bb325487a1bd8af9035d4c86ed9a55 100644 (file)
@@ -1486,13 +1486,15 @@ BC_FontEntry* TitleMain::get_font(const char *font_name, int style)
        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;
 }
 
index 721bc6a10c0da64fbffaf070cd8fbcc37b0a16a5..3b0894ce17cd48bfe57d54f305c0cb09c0c7d872 100644 (file)
@@ -30,6 +30,7 @@
 #include "cwindowgui.h"
 #include "edl.h"
 #include "edlsession.h"
+#include "keys.h"
 #include "language.h"
 #include "mwindow.h"
 #include "plugin.h"
@@ -117,6 +118,10 @@ TitleWindow::TitleWindow(TitleMain *client)
 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()
@@ -224,6 +229,7 @@ void TitleWindow::create_objects()
        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;
@@ -853,7 +859,7 @@ int TitlePitch::handle_event()
 }
 
 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;
@@ -970,11 +976,27 @@ int TitleFade::handle_event()
 
 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)
@@ -1236,7 +1258,7 @@ int TitleBottom::handle_event()
 
 
 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;
@@ -1469,10 +1491,23 @@ TitleFontsPopup::TitleFontsPopup(TitleMain *client, TitleWindow *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()
 {
@@ -1485,7 +1520,7 @@ int TitleFontsPopup::handle_event()
 }
 
 TitleColorPopup::TitleColorPopup(TitleMain *client, TitleWindow *window)
- : ColorThread(0, _("Text Color"))
+ : ColorThread(0, _("Color"))
 {
        this->client = client;
        this->window = window;
index 5af1c7aad67ff8626f8021671d00b49572e371f8..331b42b0f9553759e36987f0e5608df312e796d3 100644 (file)
@@ -550,7 +550,11 @@ class TitleFontsPopup : public BC_ListBox
 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;