From ccdab30c9a93989df986def422c1ff68d0b80a18 Mon Sep 17 00:00:00 2001 From: Ole Loots Date: Thu, 22 Nov 2012 00:10:55 +0100 Subject: Completet scroll preprocessing, Hotlist fully works. --- atari/hotlist.c | 15 ++++++-- atari/plot/plot.c | 18 +++++++--- atari/treeview.c | 10 +++--- atari/treeview.h | 103 +++++++++++++++++++++++++++--------------------------- 4 files changed, 82 insertions(+), 64 deletions(-) (limited to 'atari') diff --git a/atari/hotlist.c b/atari/hotlist.c index 7fbac3e7f..6685ba5ed 100755 --- a/atari/hotlist.c +++ b/atari/hotlist.c @@ -50,14 +50,17 @@ struct atari_hotlist hl; static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8]) { + NSTREEVIEW tv=NULL; + GRECT tb_area; - printf("hotlist handle event...\n"); if(ev_out->emo_events & MU_MESAG){ switch (msg[0]) { + case WM_TOOLBAR: - printf("toolbar event...%d\n", msg[4]); - switch (msg[4]) { + tv = (NSTREEVIEW) guiwin_get_user_data(win); + + switch (msg[4]) { case TOOLBAR_HOTLIST_CREATE_FOLDER: hotlist_add_folder(true); break; @@ -68,12 +71,18 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8]) case TOOLBAR_HOTLIST_DELETE: hotlist_delete_selected(); + guiwin_send_redraw(tv->window, NULL); break; case TOOLBAR_HOTLIST_EDIT: hotlist_edit_selected(); break; } + + get_tree(TOOLBAR_HOTLIST)[msg[4]].ob_state &= ~OS_SELECTED; + guiwin_get_grect(tv->window, GUIWIN_AREA_TOOLBAR, &tb_area); + evnt_timer(150); + guiwin_send_redraw(tv->window, &tb_area); break; case WM_CLOSED: diff --git a/atari/plot/plot.c b/atari/plot/plot.c index ca3f2b726..9937c0bad 100755 --- a/atari/plot/plot.c +++ b/atari/plot/plot.c @@ -1816,10 +1816,18 @@ bool plot_line(int x0, int y0, int x1, int y1, uint32_t lt; int sw = pstyle->stroke_width; - pxy[0] = view.x + x0; - pxy[1] = view.y + y0; - pxy[2] = view.x + x1; - pxy[3] = view.y + y1; + if((x0 < 0 && x1 < 0) || (y0 < 0 && y1 < 0)){ + return(true); + } + + pxy[0] = view.x + MAX(0,x0); + pxy[1] = view.y + MAX(0,y0); + pxy[2] = view.x + MAX(0,x1); + pxy[3] = view.y + MAX(0,y1); + + + //printf("view: %d,%d,%d,%d\n", view.x, view.y, view.w, view.h); + //printf("line: %d,%d,%d,%d\n", x0, y0, x1, y1); plot_vdi_clip(true); if( sw == 0) @@ -1834,7 +1842,7 @@ bool plot_line(int x0, int y0, int x1, int y1, vsl_rgbcolor(atari_plot_vdi_handle, pstyle->stroke_colour); v_pline(atari_plot_vdi_handle, 2, (short *)&pxy ); plot_vdi_clip(false); - return ( true ); + return (true); } static bool plot_polygon(const int *p, unsigned int n, diff --git a/atari/treeview.c b/atari/treeview.c index 44a863096..6b45fb0f3 100755 --- a/atari/treeview.c +++ b/atari/treeview.c @@ -453,7 +453,7 @@ void atari_treeview_request_redraw(int x, int y, int w, int h, void *pw) tv->rdw_area.g_w = ( oldx1 > newx1 ) ? oldx1 - tv->rdw_area.g_x : newx1 - tv->rdw_area.g_x; tv->rdw_area.g_h = ( oldy1 > newy1 ) ? oldy1 - tv->rdw_area.g_y : newy1 - tv->rdw_area.g_y; } - dbg_grect("atari_treeview_request_redraw", &tv->rdw_area); + //dbg_grect("atari_treeview_request_redraw", &tv->rdw_area); } } @@ -478,10 +478,10 @@ void atari_treeview_resized(struct tree *tree, int width, int height, void *pw) tv->extent.y = height; struct guiwin_scroll_info_s *slid = guiwin_get_scroll_info(tv->window); guiwin_get_grect(tv->window, GUIWIN_AREA_CONTENT, &area); - slid->x_pos_max = (width/slid->x_unit_px);//-(area.g_w/slid->x_unit_px)+1; - slid->y_pos_max = (height/slid->y_unit_px);//-(area.g_h/slid->y_unit_px)+1; - printf("units content: %d, units viewport: %d\n", (height/slid->y_unit_px), - (area.g_h/slid->y_unit_px)); + slid->x_units = (width/slid->x_unit_px); + slid->y_units = (height/slid->y_unit_px); + /*printf("units content: %d, units viewport: %d\n", (height/slid->y_unit_px), + (area.g_h/slid->y_unit_px));*/ guiwin_update_slider(tv->window, GUIWIN_VH_SLIDER); } } diff --git a/atari/treeview.h b/atari/treeview.h index 41d1cf519..8683bc349 100755 --- a/atari/treeview.h +++ b/atari/treeview.h @@ -1,55 +1,56 @@ -/* - * Copyright 2010 Ole Loots - * - * This file is part of NetSurf, http://www.netsurf-browser.org/ - * - * NetSurf is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. - * - * NetSurf is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef NS_ATARI_TREEVIEW_H -#define NS_ATARI_TREEVIEW_H - -#include -#include -#include "desktop/tree.h" +/* + * Copyright 2010 Ole Loots + * + * This file is part of NetSurf, http://www.netsurf-browser.org/ + * + * NetSurf is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * NetSurf is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef NS_ATARI_TREEVIEW_H +#define NS_ATARI_TREEVIEW_H + +#include +#include +#include "desktop/tree.h" #include "atari/gui.h" -#include "atari/gemtk/gemtk.h" - -#define ATARI_TREEVIEW_WIDGETS (CLOSER | MOVER | SIZER| NAME | FULLER | SMALLER | VSLIDE | HSLIDE | UPARROW | DNARROW | LFARROW | RTARROW) - -struct atari_treeview -{ - struct tree * tree; - GUIWIN * window; - bool disposing; - bool redraw; - GRECT rdw_area; - POINT click; +#include "atari/gemtk/gemtk.h" + +#define ATARI_TREEVIEW_WIDGETS (CLOSER | MOVER | SIZER| NAME | FULLER | SMALLER | VSLIDE | HSLIDE | UPARROW | DNARROW | LFARROW | RTARROW) + +struct atari_treeview +{ + struct tree * tree; + GUIWIN * window; + bool disposing; + bool redraw; + GRECT rdw_area; + POINT extent; + POINT click; POINT startdrag; - guiwin_event_handler_f user_func; -}; - -typedef struct atari_treeview * NSTREEVIEW; - + guiwin_event_handler_f user_func; +}; + +typedef struct atari_treeview * NSTREEVIEW; + NSTREEVIEW atari_treeview_create( uint32_t flags, GUIWIN *win, - guiwin_event_handler_f user_func); -void atari_treeview_destroy( NSTREEVIEW tv ); -void atari_treeview_open( NSTREEVIEW tv ); -void atari_treeview_close( NSTREEVIEW tv ); -void atari_treeview_request_redraw(int x, int y, int w, int h, void *pw); -void atari_treeview_redraw( NSTREEVIEW tv ); -bool atari_treeview_mevent( NSTREEVIEW tv, browser_mouse_state bms, int x, int y); - - - + guiwin_event_handler_f user_func); +void atari_treeview_destroy( NSTREEVIEW tv ); +void atari_treeview_open( NSTREEVIEW tv ); +void atari_treeview_close( NSTREEVIEW tv ); +void atari_treeview_request_redraw(int x, int y, int w, int h, void *pw); +void atari_treeview_redraw( NSTREEVIEW tv ); +bool atari_treeview_mevent( NSTREEVIEW tv, browser_mouse_state bms, int x, int y); + + + #endif -- cgit v1.2.3