Commit cee6758e authored by claes's avatar claes

PageUp and PageDown in xtt implemented

parent 7050433d
......@@ -47,6 +47,7 @@ extern "C" {
#include "rt_trace.h"
#include "xtt_xnav.h"
#include "xtt_item.h"
#include "xtt_url.h"
#include "co_lng.h"
#include "co_xhelp.h"
#include "rt_xnav_msg.h"
......@@ -233,6 +234,11 @@ static void xtt_hotkey_ResetDig( Widget w, XKeyEvent* ev, String* av, Cardinal*
printf("rt_xtt hotkey: SetDig. Can't get %s\n", name);
}
static void xtt_open_URL_cb( void *ctx, char *url)
{
xnav_open_URL( url);
}
static void xtt_qcom_events( Xtt *xtt)
{
char mp[2000];
......@@ -1045,7 +1051,8 @@ Xtt::Xtt( int argc, char *argv[], int *return_sts) :
xnav->set_dimension_cb = &xtt_set_dimension;
// Create help window
CoXHelp *xhelp = new CoXHelp( toplevel, 0, xhelp_eUtility_Xtt, &sts);
CoXHelp *xhelp = new CoXHelp( toplevel, this, xhelp_eUtility_Xtt, &sts);
xhelp->open_URL_cb = xtt_open_URL_cb;
CoXHelp::set_default( xhelp);
XtRealizeWidget( toplevel);
......
......@@ -679,6 +679,11 @@ int brow_IsVisible( brow_tCtx ctx, brow_tObject object)
return ctx->is_visible( (FlowArrayElem *)object);
}
int brow_Page( brow_tCtx ctx, double factor)
{
return ctx->page( factor);
}
extern "C" int brow_CreateSecondaryCtx( brow_tCtx ctx, brow_tCtx *secondary_ctx,
int (*init_proc)(brow_tCtx ctx, void *client_data),
void *client_data,
......
......@@ -199,6 +199,7 @@ int brow_GetNextSibling( brow_tCtx ctx, brow_tObject object,
int brow_GetPreviousSibling( brow_tCtx ctx, brow_tObject object,
brow_tObject *sibling);
int brow_IsVisible( brow_tCtx ctx, brow_tObject object);
int brow_Page( brow_tCtx ctx, double factor);
int brow_CreateSecondaryCtx( brow_tCtx ctx, brow_tCtx *secondary_ctx,
int (*init_proc)(brow_tCtx ctx, void *client_data),
void *client_data,
......
......@@ -215,6 +215,36 @@ void BrowCtx::center_object( FlowArrayElem *object, double factor)
change_scrollbar();
}
int BrowCtx::page( double factor)
{
double ll_x, ll_y, ur_x, ur_y;
int new_offset_y;
new_offset_y = offset_y + int( factor * window_height);
if ( factor < 0) {
if ( offset_y <= 0)
return 0;
if ( new_offset_y < 0)
new_offset_y = 0;
}
if ( factor > 0) {
FlowArrayElem *e;
int sts;
sts = a.get_last( &e);
if ( EVEN(sts)) return 0;
((FlowNode *)e)->measure( &ll_x, &ll_y, &ur_x, &ur_y);
if ( new_offset_y > ur_y * zoom_factor)
return 0;
}
scroll( 0, offset_y - new_offset_y);
change_scrollbar();
return 1;
}
void brow_scroll_horizontal( BrowCtx *ctx, int value, int bottom)
{
int x_pix;
......
......@@ -39,6 +39,8 @@ class BrowCtx : public FlowCtx {
{ return a.brow_get_previous_sibling( element, sibling);};
int is_visible( FlowArrayElem *element);
void center_object( FlowArrayElem *object, double factor);
int page( double factor);
~BrowCtx() {};
double indentation;
double frame_x_right;
......
......@@ -575,9 +575,11 @@ int draw_event_handler( FlowCtx *ctx, XEvent event)
sts = ctx->event_handler( flow_eEvent_Key_Left, 0, 0, 0, 0);
break;
case XK_Page_Up:
case 0xFF41:
sts = ctx->event_handler( flow_eEvent_Key_PageUp, 0, 0, 0, 0);
break;
case XK_Page_Down:
case 0xFF42:
sts = ctx->event_handler( flow_eEvent_Key_PageDown, 0, 0, 0, 0);
break;
case XK_BackSpace:
......
......@@ -264,6 +264,10 @@ void CLogNavBrow::brow_setup()
clognav_brow_cb);
brow_EnableEvent( ctx, flow_eEvent_Key_Down, flow_eEventType_CallBack,
clognav_brow_cb);
brow_EnableEvent( ctx, flow_eEvent_Key_PageUp, flow_eEventType_CallBack,
clognav_brow_cb);
brow_EnableEvent( ctx, flow_eEvent_Key_PageDown, flow_eEventType_CallBack,
clognav_brow_cb);
brow_EnableEvent( ctx, flow_eEvent_Key_Right, flow_eEventType_CallBack,
clognav_brow_cb);
brow_EnableEvent( ctx, flow_eEvent_Key_Left, flow_eEventType_CallBack,
......@@ -704,6 +708,14 @@ static int clognav_brow_cb( FlowCtx *ctx, flow_tEvent event)
free( node_list);
break;
}
case flow_eEvent_Key_PageDown: {
brow_Page( clognav->brow->ctx, 0.9);
break;
}
case flow_eEvent_Key_PageUp: {
brow_Page( clognav->brow->ctx, -0.9);
break;
}
case flow_eEvent_SelectClear:
brow_ResetSelectInverse( clognav->brow->ctx);
break;
......
......@@ -39,7 +39,8 @@ int xnav_open_URL( pwr_tURL url)
replace_symbol( url, url, config_p);
}
if ( strcmp( browser, "mozilla") == 0) {
if ( strcmp( browser, "mozilla") == 0 ||
strcmp( browser, "rt_mozilla") == 0) {
// Try remote display first
sprintf( cmd, "%s -remote \"openurl(%s,new-window)\"", browser, url);
sts = system(cmd);
......
......@@ -1662,6 +1662,14 @@ static int xnav_brow_cb( FlowCtx *ctx, flow_tEvent event)
free( node_list);
break;
}
case flow_eEvent_Key_PageDown: {
brow_Page( xnav->brow->ctx, 0.8);
break;
}
case flow_eEvent_Key_PageUp: {
brow_Page( xnav->brow->ctx, -0.8);
break;
}
case flow_eEvent_Key_PF1:
case flow_eEvent_Key_ShiftRight:
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment