30#include "atari/gemtk/gemtk.h"
32#include "atari/res/netsurf.rsh"
69 int newx1 = area->g_x+area->g_w;
70 int newy1 = area->g_y+area->g_h;
76 if ( oldx1 > newx1 ) {
82 if ( oldy1 > newy1 ) {
93#ifdef ATARI_TREEVIEW_DUMP
97 printf(
"Treeview Dump (%s)\n", title);
98 printf(
"=================================\n");
100 GEMTK_DBG_GRECT(
"Redraw Area: \n", &tv->
rdw_area)
102 printf("Extent: x: %d, y: %d\n", tv->
extent.x, tv->
extent.y);
111 return((gemtk_wm_get_state(tv->
window)&GEMTK_WM_STATUS_ICONIFIED) != 0);
119 OBJECT * tree = gemtk_obj_get_tree(ICONIFY);
120 short aesh = gemtk_wm_get_handle(tv->
window);
122 gemtk_wm_get_grect(tv->
window, GEMTK_WM_AREA_WORK, &work);
124 tree->ob_x = work.g_x;
125 tree->ob_y = work.g_y;
126 tree->ob_width = work.g_w;
127 tree->ob_height = work.g_h;
129 wind_get_grect(aesh, WF_FIRSTXYWH, &visible);
130 while (visible.g_h > 0 && visible.g_w > 0) {
132 if (rc_intersect(&work, &visible)) {
133 objc_draw(tree, 0, 8, visible.g_x, visible.g_y, visible.g_w,
139 wind_get_grect(aesh, WF_NEXTXYWH, &visible);
153 gemtk_wm_get_grect(tv->
window, GEMTK_WM_AREA_CONTENT, &work);
158 gemtk_wm_get_scroll_info(tv->
window);
163 if ( !rc_intersect( (GRECT*)&msg[4], &
clip)) {
173 clip.g_x -= work.g_x;
174 clip.g_y -= work.g_y;
187 if(
clip.g_h > 0 &&
clip.g_w > 0 ) {
191 rdrw_area.g_x =
clip.g_x;
192 rdrw_area.g_y =
clip.g_y;
193 rdrw_area.g_w =
clip.g_w;
194 rdrw_area.g_h =
clip.g_h;
207 struct gemtk_wm_scroll_info_s *slid;
210 short cur_rel_x, cur_rel_y, dummy, mbut;
214 gemtk_wm_get_grect(tv->
window, GEMTK_WM_AREA_CONTENT, &work);
215 slid = gemtk_wm_get_scroll_info(tv->
window);
216 mx = ev_out->emo_mouse.p_x;
217 my = ev_out->emo_mouse.p_y;
221 short origin_rel_x = (mx-work.g_x) + (slid->x_pos*slid->x_unit_px);
222 short origin_rel_y = (my-work.g_y) + (slid->y_pos*slid->y_unit_px);
225 if ((origin_rel_x >= 0) &&
226 (origin_rel_y >= 0) &&
227 (mx < work.g_x + work.g_w) &&
228 (my < work.g_y + work.g_h)) {
229 if (ev_out->emo_mclicks == 2) {
238 graf_mkstate(&cur_rel_x, &cur_rel_y, &mbut, &dummy);
240 if ((mbut & 1) == 0 ) {
243 if(ev_out->emo_mclicks == 2 ) {
249 short prev_x = origin_rel_x;
250 short prev_y = origin_rel_y;
252 cur_rel_x = origin_rel_x;
253 cur_rel_y = origin_rel_y;
272 if (abs(prev_x-cur_rel_x) > 5 ||
273 abs(prev_y-cur_rel_y) > 5) {
290 graf_mkstate(&cur_rel_x,
294 cur_rel_x = (cur_rel_x-work.g_x) +
295 (slid->x_pos*slid->x_unit_px);
296 cur_rel_y = (cur_rel_y-work.g_y) +
297 (slid->y_pos*slid->y_unit_px);
318 unsigned short nkc = 0;
322 kstate = ev_out->emo_kmeta;
323 kcode = ev_out->emo_kreturn;
324 nkc= gem_to_norm( (
short)kstate, (
short)kcode );
325 ascii = (nkc & 0xFF);
342static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out,
short msg[8])
346 gemtk_wm_get_user_data(win);
347 struct core_window *cw = (
struct core_window *)tv;
349 if( (ev_out->emo_events & MU_MESAG) != 0 ) {
361 if ((ev_out->emo_events & MU_KEYBD) != 0 ) {
364 if ((ev_out->emo_events & MU_BUTTON) != 0 ) {
365 NSLOG(netsurf, INFO,
"Treeview click at: %d,%d\n",
366 ev_out->emo_mouse.p_x, ev_out->emo_mouse.p_y);
392 const struct rect *r)
395 struct gemtk_wm_scroll_info_s * slid;
403 slid = gemtk_wm_get_scroll_info(tv->
window);
411 area.g_y = r->
y0 - (slid->y_pos*slid->y_unit_px);
412 area.g_h = r->
y1 - r->
y0;
433 struct gemtk_wm_scroll_info_s *slid;
442 slid = gemtk_wm_get_scroll_info(tv->
window);
447 slid->x_units = (
width/slid->x_unit_px);
453 slid->y_units = (
height/slid->y_unit_px);
466 gemtk_wm_update_slider(tv->
window, GEMTK_WM_VH_SLIDER);
548 void * user_data, uint32_t flags)
553 struct gemtk_wm_scroll_info_s *slid;
557 NSLOG(netsurf, INFO,
"calloc failed");
571 gemtk_wm_set_user_data(win, (
void*)tv);
574 slid = gemtk_wm_get_scroll_info(tv->
window);
578 slid->y_unit_px = 16;
579 slid->x_unit_px = 16;
596 return((
struct core_window *)tv);
610 gemtk_wm_get_grect(tv->
window, GEMTK_WM_AREA_CONTENT, dest);
613 gemtk_wm_get_grect(tv->
window, GEMTK_WM_AREA_TOOLBAR, dest);
632 if (tv != NULL && tv->
is_open) {
637 short handle = gemtk_wm_get_handle(tv->
window);
638 struct gemtk_wm_scroll_info_s *slid;
640 gemtk_wm_get_grect(tv->
window, GEMTK_WM_AREA_CONTENT, &work);
641 slid = gemtk_wm_get_scroll_info(tv->
window);
656 .background_images =
true,
667 if( wind_get(handle, WF_FIRSTXYWH,
668 &todo[0], &todo[1], &todo[2], &todo[3] )!=0 ) {
669 while (todo[2] && todo[3]) {
671 if(!rc_intersect(&work, (GRECT*)&todo)){
672 if (wind_get(handle, WF_NEXTXYWH,
673 &todo[0], &todo[1], &todo[2], &todo[3])==0) {
680 pxy[2] = todo[0] + todo[2]-1;
681 pxy[3] = todo[1] + todo[3]-1;
693 todo[0] = todo[0] - work.g_x ;
694 todo[1] = todo[1] - work.g_y ;
696 todo[2] = todo[2] + todo[0];
700 todo[3] = todo[3] + todo[1];
704 if (rc_intersect((GRECT *)&tv->
rdw_area,(GRECT *)&todo)) {
707 clip.x0 = todo[0]+(slid->x_pos*slid->x_unit_px);
708 clip.y0 = todo[1]+(slid->y_pos*slid->y_unit_px);
709 clip.x1 =
clip.x0 + todo[2]+(slid->x_pos*slid->x_unit_px);
710 clip.y1 =
clip.y0 + todo[3]+(slid->y_pos*slid->y_unit_px);
712 tv->
io->
draw(cw, -(slid->x_pos*slid->x_unit_px),
713 -(slid->y_pos*slid->y_unit_px),
717 if (wind_get(handle, WF_NEXTXYWH,
718 &todo[0], &todo[1], &todo[2], &todo[3])==0) {
759 wind_open_grect(gemtk_wm_get_handle(tv->
window), pos);
760 gemtk_wm_link(tv->
window);
809 wind_close(gemtk_wm_get_handle(tv->
window));
810 gemtk_wm_unlink(tv->
window);
831 while (tmp != NULL) {
841 tmp = tmp->next_open;
struct s_gem_cursors gem_cursors
void dbg_grect(const char *str, GRECT *r)
void gem_set_cursor(MFORM_EX *cursor)
nserror atari_warn_user(const char *warning, const char *detail)
Warn the user of an event.
long nkc_to_input_key(short nkc, long *ucs4_out)
Convert NKC to netsurf input key code and/or to ucs4 (depends on keycode).
const struct plotter_table atari_plotters
atari plottr operation table
long plot_get_flags(void)
VdiHdl plot_get_vdi_handle(void)
bool plot_set_dimensions(const struct redraw_context *ctx, int x, int y, int w, int h)
Set plot origin and canvas size.
#define PLOT_FLAG_OFFSCREEN
offscreen plotter should set this flag
static os_mode mode
The current sprite mode.
Interface to core window handling.
core_window_drag_status
drag status passed to drag_status callback
nserror
Enumeration of error codes.
@ NSERROR_NOT_IMPLEMENTED
Functionality is not implemented.
@ NSERROR_INVALID
Invalid data.
@ NSERROR_NOMEM
Memory exhaustion.
#define RECT_TO_GRECT(r, g)
static nserror atari_treeview_get_window_dimensions(const struct core_window *cw, int *width, int *height)
Get window viewport dimensions.
static nserror atari_treeview_invalidate_area(struct core_window *cw, const struct rect *r)
callback from core to request an invalidation of a window area.
static void __CDECL on_redraw_event(struct core_window *cw, EVMULT_OUT *ev_out, short msg[8])
static struct atari_treeview_window * treeviews_open
void atari_treeview_flush_redraws(void)
Process all redraw request of all open Treeview windows.
void * atari_treeview_get_user_data(struct core_window *cw)
Return the arbitary user data set by atari_treeview_set_user_data()
void atari_treeview_delete(struct core_window *cw)
Free the Treeview, but not the gemtk window used for the treeview.
void atari_treeview_get_grect(struct core_window *cw, enum treeview_area_e mode, GRECT *dest)
Get an specific area inside the window.
static struct core_window_table cw_t
Declare Core Window Callbacks:
bool atari_treeview_is_open(struct core_window *cw)
Returns the window "open" state.
void atari_treeview_redraw(struct core_window *cw)
Process all pending redraw requests for a single treeview.
void atari_treeview_close(struct core_window *cw)
Closes (hides) the treeview window.
static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
GEMTK (netsurf's GEM toolkit) event sink.
static nserror atari_treeview_drag_status(struct core_window *cw, core_window_drag_status ds)
Inform corewindow owner of drag status.
static void __CDECL on_mbutton_event(struct core_window *cw, EVMULT_OUT *ev_out, short msg[8])
void atari_treeview_set_user_data(struct core_window *cw, void *user_data_ptr)
Attach arbitary user data to the treeview.
static void atari_treeview_redraw_grect_request(struct core_window *cw, GRECT *area)
Schedule a redraw of the treeview content.
static nserror atari_treeview_get_scroll(const struct core_window *cw, int *x, int *y)
static nserror atari_treeview_set_scroll(struct core_window *cw, int x, int y)
Scroll the window to make area visible.
GUIWIN * atari_treeview_get_gemtk_window(struct core_window *cw)
Get the window manager window handle.
static void __CDECL on_keybd_event(struct core_window *cw, EVMULT_OUT *ev_out, short msg[8])
struct core_window * atari_treeview_create(GUIWIN *win, struct atari_treeview_callbacks *callbacks, void *user_data, uint32_t flags)
Initalize an window to be an treeview window.
void atari_treeview_open(struct core_window *cw, GRECT *pos)
Open the treeview window.
static bool atari_treeview_is_iconified(struct core_window *cw)
static void atari_treeview_redraw_icon(struct core_window *cw, GRECT *clip)
struct core_window_table * atari_core_window_table
static nserror atari_treeview_update_size(struct core_window *cw, int width, int height)
Update the limits of the window.
@ BROWSER_MOUSE_PRESS_1
primary button pressed
@ BROWSER_MOUSE_HOVER
No mouse buttons pressed, May be used to indicate hover or end of drag.
@ BROWSER_MOUSE_CLICK_1
button 1 clicked.
@ BROWSER_MOUSE_DOUBLE_CLICK
button double clicked
@ BROWSER_MOUSE_DRAG_1
start of button 1 drag
@ BROWSER_MOUSE_HOLDING_1
during button 1 drag
@ BROWSER_MOUSE_DRAG_ON
a drag operation was started and a mouse button is still pressed
Target independent plotting interface.
Netsurf additional integer type formatting macros.
#define NSLOG(catname, level, logmsg, args...)
const char * messages_get_errorcode(nserror code)
lookup of a message by errorcode from the standard Messages hash.
Localised message support (interface).
static BList * callbacks
List of all callbacks.
atari_treeview_mouse_action_callback mouse_action
gemtk_wm_event_handler_f gemtk_user_func
atari_treeview_init2_callback init_phase2
atari_treeview_keypress_callback keypress
atari_treeview_finish_callback finish
atari_treeview_draw_callback draw
struct atari_treeview_window * prev_open
struct atari_treeview_callbacks * io
struct atari_treeview_window * next_open
Core user interface window function table.
nserror(* invalidate)(struct core_window *cw, const struct rect *rect)
Invalidate an area of a window.
bool interactive
Redraw to show interactive features.
static nserror clip(const struct redraw_context *ctx, const struct rect *clip)
Sets a clip rectangle for subsequent plot operations.