Completet scroll preprocessing, Hotlist fully works.

This commit is contained in:
Ole Loots 2012-11-22 00:10:55 +01:00
parent 0672d5e2c9
commit ccdab30c9a
4 changed files with 83 additions and 65 deletions

View File

@ -50,14 +50,17 @@ struct atari_hotlist hl;
static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8]) 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){ if(ev_out->emo_events & MU_MESAG){
switch (msg[0]) { switch (msg[0]) {
case WM_TOOLBAR:
printf("toolbar event...%d\n", msg[4]);
switch (msg[4]) {
case WM_TOOLBAR:
tv = (NSTREEVIEW) guiwin_get_user_data(win);
switch (msg[4]) {
case TOOLBAR_HOTLIST_CREATE_FOLDER: case TOOLBAR_HOTLIST_CREATE_FOLDER:
hotlist_add_folder(true); hotlist_add_folder(true);
break; break;
@ -68,12 +71,18 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
case TOOLBAR_HOTLIST_DELETE: case TOOLBAR_HOTLIST_DELETE:
hotlist_delete_selected(); hotlist_delete_selected();
guiwin_send_redraw(tv->window, NULL);
break; break;
case TOOLBAR_HOTLIST_EDIT: case TOOLBAR_HOTLIST_EDIT:
hotlist_edit_selected(); hotlist_edit_selected();
break; 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; break;
case WM_CLOSED: case WM_CLOSED:

View File

@ -1816,10 +1816,18 @@ bool plot_line(int x0, int y0, int x1, int y1,
uint32_t lt; uint32_t lt;
int sw = pstyle->stroke_width; int sw = pstyle->stroke_width;
pxy[0] = view.x + x0; if((x0 < 0 && x1 < 0) || (y0 < 0 && y1 < 0)){
pxy[1] = view.y + y0; return(true);
pxy[2] = view.x + x1; }
pxy[3] = view.y + y1;
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); plot_vdi_clip(true);
if( sw == 0) 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); vsl_rgbcolor(atari_plot_vdi_handle, pstyle->stroke_colour);
v_pline(atari_plot_vdi_handle, 2, (short *)&pxy ); v_pline(atari_plot_vdi_handle, 2, (short *)&pxy );
plot_vdi_clip(false); plot_vdi_clip(false);
return ( true ); return (true);
} }
static bool plot_polygon(const int *p, unsigned int n, static bool plot_polygon(const int *p, unsigned int n,

View File

@ -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_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; 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; tv->extent.y = height;
struct guiwin_scroll_info_s *slid = guiwin_get_scroll_info(tv->window); struct guiwin_scroll_info_s *slid = guiwin_get_scroll_info(tv->window);
guiwin_get_grect(tv->window, GUIWIN_AREA_CONTENT, &area); 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->x_units = (width/slid->x_unit_px);
slid->y_pos_max = (height/slid->y_unit_px);//-(area.g_h/slid->y_unit_px)+1; slid->y_units = (height/slid->y_unit_px);
printf("units content: %d, units viewport: %d\n", (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)); (area.g_h/slid->y_unit_px));*/
guiwin_update_slider(tv->window, GUIWIN_VH_SLIDER); guiwin_update_slider(tv->window, GUIWIN_VH_SLIDER);
} }
} }

View File

@ -1,55 +1,56 @@
/* /*
* Copyright 2010 Ole Loots <ole@monochrom.net> * Copyright 2010 Ole Loots <ole@monochrom.net>
* *
* This file is part of NetSurf, http://www.netsurf-browser.org/ * This file is part of NetSurf, http://www.netsurf-browser.org/
* *
* NetSurf is free software; you can redistribute it and/or modify * NetSurf is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License. * the Free Software Foundation; version 2 of the License.
* *
* NetSurf is distributed in the hope that it will be useful, * NetSurf is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef NS_ATARI_TREEVIEW_H #ifndef NS_ATARI_TREEVIEW_H
#define NS_ATARI_TREEVIEW_H #define NS_ATARI_TREEVIEW_H
#include <stdbool.h> #include <stdbool.h>
#include <windom.h> #include <windom.h>
#include "desktop/tree.h" #include "desktop/tree.h"
#include "atari/gui.h" #include "atari/gui.h"
#include "atari/gemtk/gemtk.h" #include "atari/gemtk/gemtk.h"
#define ATARI_TREEVIEW_WIDGETS (CLOSER | MOVER | SIZER| NAME | FULLER | SMALLER | VSLIDE | HSLIDE | UPARROW | DNARROW | LFARROW | RTARROW) #define ATARI_TREEVIEW_WIDGETS (CLOSER | MOVER | SIZER| NAME | FULLER | SMALLER | VSLIDE | HSLIDE | UPARROW | DNARROW | LFARROW | RTARROW)
struct atari_treeview struct atari_treeview
{ {
struct tree * tree; struct tree * tree;
GUIWIN * window; GUIWIN * window;
bool disposing; bool disposing;
bool redraw; bool redraw;
GRECT rdw_area; GRECT rdw_area;
POINT click; POINT extent;
POINT click;
POINT startdrag; POINT startdrag;
guiwin_event_handler_f user_func; guiwin_event_handler_f user_func;
}; };
typedef struct atari_treeview * NSTREEVIEW; typedef struct atari_treeview * NSTREEVIEW;
NSTREEVIEW atari_treeview_create( uint32_t flags, GUIWIN *win, NSTREEVIEW atari_treeview_create( uint32_t flags, GUIWIN *win,
guiwin_event_handler_f user_func); guiwin_event_handler_f user_func);
void atari_treeview_destroy( NSTREEVIEW tv ); void atari_treeview_destroy( NSTREEVIEW tv );
void atari_treeview_open( NSTREEVIEW tv ); void atari_treeview_open( NSTREEVIEW tv );
void atari_treeview_close( 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_request_redraw(int x, int y, int w, int h, void *pw);
void atari_treeview_redraw( NSTREEVIEW tv ); void atari_treeview_redraw( NSTREEVIEW tv );
bool atari_treeview_mevent( NSTREEVIEW tv, browser_mouse_state bms, int x, int y); bool atari_treeview_mevent( NSTREEVIEW tv, browser_mouse_state bms, int x, int y);
#endif #endif