Exemplo n.º 1
0
static void move(int x, int y)
{
	GRECT	r;

	wind_get_grect(akt_handle, WF_CURRXYWH, &r);
	r.g_x = x;
	r.g_y = y;
	wind_set_grect(akt_handle, WF_CURRXYWH, &r);
	wind_get_grect(akt_handle, WF_WORKXYWH, &r);
	aktion[0].ob_x = r.g_x;
	aktion[0].ob_y = r.g_y;
}
Exemplo n.º 2
0
/*
 *  Routine to blt the contents of a window based on a new current row
 */
static void win_blt(WNODE *pw, WORD newcv)
{
    WORD  delcv, pn;
    WORD  sx, sy, dx, dy, wblt, hblt, revblt, tmp;
    GRECT c, t;

    newcv = max(0, newcv);
    newcv = min(pw->w_vnrow - pw->w_pnrow, newcv);
    pn = pw->w_pnrow;
    delcv = newcv - pw->w_cvrow;
    pw->w_cvrow += delcv;
    if (!delcv)
        return;

    wind_get_grect(pw->w_id, WF_WXYWH, &c);
    win_bldview(pw, c.g_x, c.g_y, c.g_w, c.g_h);

    /* see if any part is off the screen */
    wind_get_grect(pw->w_id, WF_FIRSTXYWH, &t);
    if (rc_equal(&c, &t))
    {
        /* blt as much as we can, adjust clip & draw the rest */
        if ((revblt = (delcv < 0)) != 0)
            delcv = -delcv;
        if (pn > delcv)
        {
            /* see how much there is, pretend blt up */
            sx = dx = 0;
            sy = delcv * G.g_ihspc;
            dy = 0;
            wblt = c.g_w;
            hblt = c.g_h - sy;
            if (revblt)
            {
                tmp = sx;
                sx = dx;
                dx = tmp;
                tmp = sy;
                sy = dy;
                dy = tmp;
            }
            gsx_sclip(&c);
            bb_screen(S_ONLY, sx+c.g_x, sy+c.g_y, dx+c.g_x, dy+c.g_y,
                        wblt, hblt);

            if (!revblt)
                c.g_y += hblt;
            c.g_h -= hblt;
        }
    }

    do_wredraw(pw->w_id, c.g_x, c.g_y, c.g_w, c.g_h);
}
Exemplo n.º 3
0
/*
 *  Rebuild window path and pflist
 */
void fun_rebld(WNODE *pwin)
{
    GRECT gr;
    BYTE *ptst;

    graf_mouse(HGLASS, NULL);

    /* set up path to check against all windows*/
    ptst = pwin->w_path->p_spec;

    /* check all wnodes     */
    for (pwin = G.g_wfirst; pwin; pwin = pwin->w_next)
    {
        /* if opened and same path then rebuild */
        if ( (pwin->w_id) && (strcmp(pwin->w_path->p_spec, ptst)==0) )
        {
            pn_active(pwin->w_path);
            desk_verify(pwin->w_id, TRUE);
            win_sinfo(pwin);
            wind_set(pwin->w_id, WF_INFO, pwin->w_info, 0, 0);
            wind_get_grect(pwin->w_id, WF_WXYWH, &gr);
            fun_msg(WM_REDRAW, pwin->w_id, gr.g_x, gr.g_y, gr.g_w, gr.g_h);
        } /* if */
    } /* for */

    graf_mouse(ARROW, NULL);
} /* fun_rebld */
Exemplo n.º 4
0
static void redraw(int start, int depth, int x, int y, int w, int h)
{
	GRECT		r, r1;
	
	r.g_x = x; r.g_y = y; r.g_w = w; r.g_h = h;
	wind_update(BEG_UPDATE);
	hide_mouse_if_needed(&r);
	wind_get_grect(akt_handle, WF_FIRSTXYWH, &r1);
	while (r1.g_w != 0 && r1.g_h != 0)
	{
		if (rc_intersect(&r, &r1))
			objc_draw(aktion, start, depth, r1.g_x, r1.g_y, r1.g_w, r1.g_h);
		wind_get_grect(akt_handle, WF_NEXTXYWH, &r1);
	}
	show_mouse();
	wind_update(END_UPDATE);
}
Exemplo n.º 5
0
static WORD hndl_button(WORD clicks, WORD mx, WORD my, WORD button, WORD keystate)
{
    WORD done, junk;
    GRECT c;
    WORD wh, dobj, dest_wh;
    WORD root;
    WNODE *wn;

    done = FALSE;

    wh = wind_find(mx, my);

    if (wh != G.g_cwin)
        desk_clear(G.g_cwin);

    desk_verify(wh, FALSE);

    wind_get_grect(wh, WF_WXYWH, &c);

    if (clicks == 1)
    {
        act_bsclick(G.g_cwin, G.g_screen, G.g_croot, mx, my,
                    keystate, &c, FALSE);
        graf_mkstate(&junk, &junk, &button, &junk);
        if (button & 0x0001)
        {
            dest_wh = act_bdown(G.g_cwin, G.g_screen, G.g_croot, &mx, &my,
                                &keystate, &c, &dobj);
            if (dest_wh != NIL)
            {
                root = 1;
                if (dest_wh != 0)
                {
                    wn = win_find(dest_wh);
                    if (wn)
                        root = wn->w_root;
                }
                desk1_drag(wh, dest_wh, root, dobj, mx, my, keystate);
                desk_clear(wh);
            }
        }
    }
    else
    {
        act_bsclick(G.g_cwin, G.g_screen, G.g_croot, mx, my, keystate, &c, TRUE);
        done = do_filemenu(OPENITEM);
    }

    men_update(G.a_trees[ADMENU]);

    return done;
}
Exemplo n.º 6
0
/*
 *  Routine to build all existing windows again
 */
void win_bdall(void)
{
    GRECT clip;
    WNODE *pw;

    for (pw = G.g_wfirst; pw; pw = pw->w_next)
    {
        if (pw->w_id != 0)
        {
            wind_get_grect(pw->w_id, WF_WXYWH, &clip);
            win_bldview(pw, clip.g_x, clip.g_y, clip.g_w, clip.g_h);
        }
    }
}
Exemplo n.º 7
0
/*
 *  Routine to draw all existing windows
 */
void win_shwall(void)
{
    GRECT clip;
    WORD  wh;
    WNODE *pw;

    for (pw = G.g_wfirst; pw; pw = pw->w_next)
    {
        if ((wh=pw->w_id) != 0)     /* yes, assignment! */
        {
            wind_get_grect(wh, WF_WXYWH, &clip);
            fun_msg(WM_REDRAW, wh, clip.g_x, clip.g_y, clip.g_w, clip.g_h);
        }
    }
}
Exemplo n.º 8
0
static void __CDECL menu_savewin(short item, short title, void *data)
{
	LOG(("%s", __FUNCTION__));
	if (input_window && input_window->browser) {
		GRECT rect;
		wind_get_grect(gemtk_wm_get_handle(input_window->root->win), WF_CURRXYWH,
                 &rect);
		option_window_width = rect.g_w;
		option_window_height = rect.g_h;
		option_window_x = rect.g_x;
		option_window_y = rect.g_y;
		nsoption_set_int(window_width, rect.g_w);
		nsoption_set_int(window_height, rect.g_h);
		nsoption_set_int(window_x, rect.g_x);
		nsoption_set_int(window_y, rect.g_y);
		nsoption_write((const char*)&options);
	}

}
Exemplo n.º 9
0
/*----------------------------------------------------------------------------------------*/
int16	objc_scroll( OBJECT *tree, int16 vdihandle, int16 obj, int16 whdl, int32 yscroll, int16 xscroll, int16 ydraw )
{
	MFDB		s, d;
	GRECT		r, w, obr;
	int16		xy[8];
	int16		ca[8];
	int16		dy;
	boolean	draw;

	draw = FALSE;
	wind_get_grect( whdl, WF_FIRSTXYWH, &r );
	wind_get_grect( whdl, WF_WORKXYWH, &w );
	objc_rect( tree, obj, &obr );

	if( !rc_intersect( &obr, &r ) || !rc_intersect( &gl_desk, &r ) )
		return 0;

	if( r.g_w != obr.g_w || r.g_h != obr.g_h )
		draw = TRUE;

	if( labs(yscroll) >= (int32)obr.g_h || abs(xscroll) >= obr.g_w )
		draw = TRUE;

	if( !draw )
	{
		grect_to_array( &r, xy );						/* Quelle f�r vro_cpyfm */
		grect_to_array( &w, ca );						/* Array f�r clipping */
		xy[4] = xy[0];										/* Ziel f�r vro_cpyfm */
		xy[5] = xy[1];
		xy[6] = xy[2];
		xy[7] = xy[3];

		if( xscroll )										/* Horizontales Scrolling */
		{
			if( xscroll > 0 )								/* Links Scrolling */
			{
				xy[0] += (int16) xscroll;
				xy[6] -= (int16) xscroll;

				r.g_x += r.g_w - (int16)xscroll;		/* Rechter Bereich nicht gescrollt, */
				r.g_w  = (int16)xscroll;				/* mu� neu gezeichnet werden */
			}
			else												/* Rechts Scrolling */
			{
				xy[2] += (int16)xscroll;
				xy[4] -= (int16)xscroll;

				r.g_w = (int16)(-xscroll);				/* Linken Bereich noch neu zeichnen */
			}
		}
	
		dy = (int16)yscroll;
		dy = -dy;
	
		if( dy )												/* Vertikales Scrolling */
		{
			if( dy > 0 )									/* Aufw�rts Scrolling */
			{
				xy[1] += (int16)dy;						/* Werte f�r vro_cpyfm */
				xy[7] -= (int16)dy;

				r.g_y += r.g_h - (int16)dy - ydraw;	/* Unterer Bereich nicht gescrollt, */
				r.g_h  = (int16)dy + ydraw;			/* mu� neu gezeichnet werden */
			}
			else												/* Abw�rts Scrolling */
			{
				xy[3] += (int16)dy;						/* Werte f�r vro_cpyfm */
				xy[5] -= (int16)dy;

				r.g_h = (int)(-dy) + ydraw;			/* Oberen Bereich noch neu zeichnen */
			}
		}
		s.fd_addr = d.fd_addr = NULL;					/* Erzwinge Bildschirmadresse */
		vs_clip( vdihandle, 1, ca );
		hide_mouse();
		vro_cpyfm(vdihandle, S_ONLY, xy, &s, &d);
		show_mouse();
		objc_draw( tree, 0, MAX_DEPTH, &r );
	}

	return !draw;
}
Exemplo n.º 10
0
static void gui_init(int argc, char** argv)
{
    char buf[PATH_MAX];
    OBJECT * cursors;

    atari_find_resource(buf, "netsurf.rsc", "./res/netsurf.rsc");
    LOG(("%s ", (char*)&buf));
    if (rsrc_load(buf)==0) {
        die("Uable to open GEM Resource file!");
    }

    wind_get_grect(0, WF_WORKXYWH, &desk_area);

    create_cursor(0, POINT_HAND, NULL, &gem_cursors.hand );
    create_cursor(0, TEXT_CRSR,  NULL, &gem_cursors.ibeam );
    create_cursor(0, THIN_CROSS, NULL, &gem_cursors.cross);
    create_cursor(0, BUSY_BEE, NULL, &gem_cursors.wait);
    create_cursor(0, ARROW, NULL, &gem_cursors.arrow);
    create_cursor(0, OUTLN_CROSS, NULL, &gem_cursors.sizeall);
    create_cursor(0, OUTLN_CROSS, NULL, &gem_cursors.sizenesw);
    create_cursor(0, OUTLN_CROSS, NULL, &gem_cursors.sizenwse);
    cursors = gemtk_obj_get_tree(CURSOR);
    create_cursor(MFORM_EX_FLAG_USERFORM, CURSOR_APPSTART,
                  cursors, &gem_cursors.appstarting);
    gem_set_cursor( &gem_cursors.appstarting );
    create_cursor(MFORM_EX_FLAG_USERFORM, CURSOR_SIZEWE,
                  cursors, &gem_cursors.sizewe);
    create_cursor(MFORM_EX_FLAG_USERFORM, CURSOR_SIZENS,
                  cursors, &gem_cursors.sizens);
    create_cursor(MFORM_EX_FLAG_USERFORM, CURSOR_NODROP,
                  cursors, &gem_cursors.nodrop);
    create_cursor(MFORM_EX_FLAG_USERFORM, CURSOR_DENY,
                  cursors, &gem_cursors.deny);
    create_cursor(MFORM_EX_FLAG_USERFORM, CURSOR_MENU,
                  cursors, &gem_cursors.menu);
    create_cursor(MFORM_EX_FLAG_USERFORM, CURSOR_HELP,
                  cursors, &gem_cursors.help);

    LOG(("Enabling core select menu"));
    nsoption_set_bool(core_select_menu, true);

    LOG(("Loading url.db from: %s", nsoption_charp(url_file) ));
    if( strlen(nsoption_charp(url_file)) ) {
        urldb_load(nsoption_charp(url_file));
    }

    LOG(("Loading cookies from: %s", nsoption_charp(cookie_file) ));
    if( strlen(nsoption_charp(cookie_file)) ) {
        urldb_load_cookies(nsoption_charp(cookie_file));
    }

    if (process_cmdline(argc,argv) != true)
        die("unable to process command line.\n");

    LOG(("Initializing NKC..."));
    nkc_init();


    LOG(("Initializing plotters..."));
    plot_init(nsoption_charp(atari_font_driver));

    tree_set_icon_dir(nsoption_charp(tree_icons_path));

    aes_event_in.emi_m1leave = MO_LEAVE;
    aes_event_in.emi_m1.g_w = 1;
    aes_event_in.emi_m1.g_h = 1;
    //next_poll = clock() + (CLOCKS_PER_SEC>>3);
}
Exemplo n.º 11
0
Arquivo: gui.c Projeto: mmuman/NetSurf
/**
 * Initialise atari gui.
 */
static void gui_init(int argc, char** argv)
{
    char buf[PATH_MAX];
    OBJECT * cursors;

    atari_find_resource(buf, "netsurf.rsc", "./res/netsurf.rsc");
    LOG("Using RSC file: %s ", (char *)&buf);
    if (rsrc_load(buf)==0) {

	char msg[1024];

	snprintf(msg, 1024, "Unable to open GEM Resource file (%s)!", buf);
	die(msg);
    }

    wind_get_grect(0, WF_WORKXYWH, &desk_area);

    create_cursor(0, POINT_HAND, NULL, &gem_cursors.hand );
    create_cursor(0, TEXT_CRSR,  NULL, &gem_cursors.ibeam );
    create_cursor(0, THIN_CROSS, NULL, &gem_cursors.cross);
    create_cursor(0, BUSY_BEE, NULL, &gem_cursors.wait);
    create_cursor(0, ARROW, NULL, &gem_cursors.arrow);
    create_cursor(0, OUTLN_CROSS, NULL, &gem_cursors.sizeall);
    create_cursor(0, OUTLN_CROSS, NULL, &gem_cursors.sizenesw);
    create_cursor(0, OUTLN_CROSS, NULL, &gem_cursors.sizenwse);
    cursors = gemtk_obj_get_tree(CURSOR);
    create_cursor(MFORM_EX_FLAG_USERFORM, CURSOR_APPSTART,
		  cursors, &gem_cursors.appstarting);
    gem_set_cursor( &gem_cursors.appstarting );
    create_cursor(MFORM_EX_FLAG_USERFORM, CURSOR_SIZEWE,
		  cursors, &gem_cursors.sizewe);
    create_cursor(MFORM_EX_FLAG_USERFORM, CURSOR_SIZENS,
		  cursors, &gem_cursors.sizens);
    create_cursor(MFORM_EX_FLAG_USERFORM, CURSOR_NODROP,
		  cursors, &gem_cursors.nodrop);
    create_cursor(MFORM_EX_FLAG_USERFORM, CURSOR_DENY,
		  cursors, &gem_cursors.deny);
    create_cursor(MFORM_EX_FLAG_USERFORM, CURSOR_MENU,
		  cursors, &gem_cursors.menu);
    create_cursor(MFORM_EX_FLAG_USERFORM, CURSOR_HELP,
		  cursors, &gem_cursors.help);

    LOG("Enabling core select menu");
    nsoption_set_bool(core_select_menu, true);

    LOG("Loading url.db from: %s", nsoption_charp(url_file));
    if( strlen(nsoption_charp(url_file)) ) {
	urldb_load(nsoption_charp(url_file));
    }

    LOG("Loading cookies from: %s", nsoption_charp(cookie_file));
    if( strlen(nsoption_charp(cookie_file)) ) {
	urldb_load_cookies(nsoption_charp(cookie_file));
    }

    if (process_cmdline(argc,argv) != true)
	die("unable to process command line.\n");

    LOG("Initializing NKC...");
    nkc_init();

    LOG("Initializing plotters...");
    plot_init(nsoption_charp(atari_font_driver));

    aes_event_in.emi_m1leave = MO_LEAVE;
    aes_event_in.emi_m1.g_w = 1;
    aes_event_in.emi_m1.g_h = 1;
    //next_poll = clock() + (CLOCKS_PER_SEC>>3);

    deskmenu_init();
    menu_register( -1, theapp);
    if (sys_type() & (SYS_MAGIC|SYS_NAES|SYS_XAAES)) {
	menu_register( _AESapid, (char*)"  NetSurf ");
    }
    gemtk_wm_init();

    /* Initialize the specific treeview windows: */
    atari_global_history_init();
    atari_hotlist_init();
    atari_cookie_manager_init();

    /* Initialize the toolbar framework: */
    toolbar_init();
}