X-Git-Url: https://git.cinelerra-gg.org/git/?p=goodguy%2Fcinelerra.git;a=blobdiff_plain;f=cinelerra-5.1%2Fguicast%2Fbcwindowbase.h;h=2feaf66cebcb1e798ed807697473723a90d37803;hp=f231c6d20a68da704ed3b8acf103ff5362137673;hb=b104b77f5296719bd5e6de8472eb71542ddaedec;hpb=7ead9f7382846e81c2f8efb25780014e5f8834c3 diff --git a/cinelerra-5.1/guicast/bcwindowbase.h b/cinelerra-5.1/guicast/bcwindowbase.h index f231c6d2..2feaf66c 100644 --- a/cinelerra-5.1/guicast/bcwindowbase.h +++ b/cinelerra-5.1/guicast/bcwindowbase.h @@ -97,12 +97,30 @@ #include #endif - +// scaled x,y unit +#define xS(v) (BC_WindowBase::get_resources()->x_scale*(v)) +#define yS(v) (BC_WindowBase::get_resources()->y_scale*(v)) #ifdef HAVE_GL //typedef void* GLXContext; #endif +typedef uint32_t wchr_t; + +static inline size_t wstrlen(const wchr_t *s) +{ + size_t len = 0; + while( s[len] ) ++len; + return len; +} + +static inline wchr_t *wstrncpy(wchr_t *dest, const wchr_t *src, size_t n) +{ + for( wchr_t *dp=dest; n>0 && (*dp++=*src++); --n ); + return dest; +} + + class BC_ResizeCall { public: @@ -188,7 +206,7 @@ public: virtual int cursor_motion_event() { return 0; }; virtual int cursor_leave_event(); virtual int cursor_enter_event(); - virtual int keypress_event() { return 0; }; + virtual int keypress_event(); virtual int keyrelease_event() { return 0; }; virtual int translation_event() { return 0; }; virtual int drag_start_event() { return 0; }; @@ -198,9 +216,13 @@ public: virtual int selection_clear_event() { return 0; } // Only if opengl is enabled virtual int expose_event() { return 0; }; + virtual int handle_ungrab() { return 0; }; virtual int grab_event(XEvent *event) { return 0; }; + virtual void create_objects() { return; }; + static void init_resources(float scale); + static void finit_resources(); int get_window_type() { return window_type; } // Wait until event loop is running void init_wait(); @@ -309,7 +331,7 @@ public: int get_buttonpress(); int get_has_focus(); int get_dragging(); - wchar_t* get_wkeystring(int *length = 0); + wchr_t* get_wkeystring(int *length = 0); int get_keypress(); int get_keysym() { return keysym; } #ifdef X_HAVE_UTF8_STRING @@ -337,7 +359,9 @@ public: int get_text_descent(int font); int get_text_height(int font, const char *text = 0); int get_text_width(int font, const char *text, int length = -1); - int get_text_width(int font, const wchar_t *text, int length = -1); + int get_text_width(int font, const wchr_t *text, int length = -1); +// truncate the text with ... & return a new string + char *get_truncated_text(int font, const char *text, int max_w); BC_Clipboard* get_clipboard(); void set_dragging(int value); int set_w(int w); @@ -346,6 +370,8 @@ public: BC_WindowBase* get_parent(); // Event happened in this window int is_event_win(); +// Event happened either in this window or in the associated tooltip + int is_tooltip_event_win(); int cursor_inside(); // Deactivate everything and activate this subwindow virtual int activate(); @@ -399,14 +425,14 @@ public: void draw_text_line(int x, int y, const char *text, int len, BC_Pixmap *pixmap = 0); void draw_xft_text(int x, int y, const char *text, int len, BC_Pixmap *pixmap = 0, int is_utf8 = 0); - void draw_xft_text(int x, int y, const wchar_t *text, + void draw_xft_text(int x, int y, const wchr_t *text, int length, BC_Pixmap *pixmap); int draw_single_text(int draw, int font, - int x, int y, const wchar_t *text, int length = -1, BC_Pixmap *pixmap = 0); -// truncate the text to a ... version that fits in the width, using the current_font - void truncate_text(char *result, const char *text, int w); + int x, int y, const wchr_t *text, int length = -1, BC_Pixmap *pixmap = 0); void draw_center_text(int x, int y, const char *text, int length = -1); + void draw_pix(int x, int y, BC_Pixmap *pixmap = 0); void draw_line(int x1, int y1, int x2, int y2, BC_Pixmap *pixmap = 0); + void draw_bline(int x1, int y1, int x2, int y2, BC_Pixmap *pixmap = 0); void draw_polygon(ArrayList *x, ArrayList *y, BC_Pixmap *pixmap = 0); void fill_polygon(ArrayList *x, ArrayList *y, BC_Pixmap *pixmap = 0); void draw_rectangle(int x, int y, int w, int h); @@ -500,6 +526,7 @@ public: void slide_down(int distance); void flicker(int n=3, int ms=66); void focus(); + int wait_viewable(int ms); int cycle_textboxes(int amount); @@ -523,6 +550,7 @@ public: 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); + void set_net_icon(VFrame *data); int load_defaults(BC_Hash *defaults); int save_defaults(BC_Hash *defaults); @@ -537,6 +565,14 @@ public: long from_clipboard(char *data, long maxlen, int clipboard_num); long clipboard_len(int clipboard_num); +// *** CONTEXT_HELP *** + void context_help_set_keyword(const char *keyword); + const char *context_help_get_keyword(); + void context_help_show(const char *keyword); + void context_help_show(); + int context_help_check_and_show(const char *keyword); + int context_help_check_and_show(); + int test_keypress; char keys_return[KEYPRESSLEN]; @@ -568,10 +604,11 @@ private: Cursor create_grab_cursor(); // Get width of a single line. Used by get_text_width int get_single_text_width(int font, const char *text, int length); - int get_single_text_width(int font, const wchar_t *text, int length); + int get_single_text_width(int font, const wchr_t *text, int length); int allocate_color_table(); int init_gc(); int init_fonts(); + void init_glyphs(); void init_xft(); void init_im(); void finit_im(); @@ -717,7 +754,7 @@ private: // Last key pressed int key_pressed; int wkey_string_length; - wchar_t wkey_string[4]; + wchr_t wkey_string[4]; #ifdef X_HAVE_UTF8_STRING char* key_pressed_utf8; #endif @@ -727,7 +764,7 @@ private: // Whether the window has the focus int has_focus; - static BC_Resources resources; + static BC_Resources *resources; #ifndef SINGLE_THREAD // Array of repeaters for multiple repeating objects. @@ -771,6 +808,9 @@ private: int shared_bg_pixmap; char title[BCTEXTLEN]; +// *** CONTEXT_HELP *** + char context_help_keyword[BCTEXTLEN]; + // X Window parameters int screen; Window rootwin; @@ -890,11 +930,9 @@ private: #else Condition *completion_lock; #endif - - + Mutex *grab_lock; int dump_windows(); - BC_WindowEvents *event_thread; int is_deleting; // Hide cursor when video is enabled