Beispiel #1
0
};

class Foo {
    Bar bar_value;
  public:
    Foo(int i_val=0):bar_value(i_val)       { }
    Bar get_bar_value() const               { return bar_value;  } 
    void set_bar_value(const Bar b_val)     { bar_value = b_val; } 
};


BOOST_FUSION_ADAPT_ADT(Bar, 
        (int,  int,  obj.get_integer_value(), obj.set_integer_value(val)))

BOOST_FUSION_ADAPT_ADT(Foo, 
        (Bar,  Bar,  obj.get_bar_value(), obj.set_bar_value(val)))
        

#define MY_ADT_MEMBER_NAME(CLASSNAME, IDX, MEMBERNAME)                                                                                   \
        namespace boost { namespace fusion { namespace extension {                                                                       \
            template <> struct struct_member_name<CLASSNAME, IDX> { typedef char const *type; static type call() { return #MEMBERNAME; } \
        }; } } }

MY_ADT_MEMBER_NAME(Bar, 0, integer_value)

MY_ADT_MEMBER_NAME(Foo, 0, bar_value)


namespace visitor {

    template <typename Flavour, typename T> struct VisitorApplication;
Beispiel #2
0
/*
  Used for the hyperref and forward search markers: scroll the page
  to make the marker visible.
*/
void
scroll_page_if_needed(int x_min, int x_max, int y_min, int y_max)
{
    Position drawing_x, drawing_y, drawing_h, clip_x, clip_y, clip_h, clip_w;
    int test_scroll, need_v_scroll = 0, need_h_scroll = 0;

    if (!do_autoscroll)
	return;
    
    XtVaGetValues(globals.widgets.clip_widget,
		  XtNx, &clip_x, XtNy, &clip_y,
		  XtNheight, &clip_h, XtNwidth, &clip_w,
		  NULL);
    XtVaGetValues(globals.widgets.draw_widget,
		  XtNx, &drawing_x, XtNy, &drawing_y,
		  XtNheight, &drawing_h,
		  NULL);

#if DEBUG_SCROLL_IF_NEEDED
    fprintf(stderr, "y: %d, drawing_y: %d, clip_h: %d\n", y, drawing_y, clip_h);
#endif
    /* check if we need to scroll vertically; first, down for y_min */
    test_scroll = y_min + drawing_y - clip_h;
    if ((resource.expert_mode & XPRT_SHOW_STATUSLINE) != 0)
	test_scroll += get_statusline_height();

    TRACE_SRC((stderr, "test_scroll vertically: %d", test_scroll));
#if DEBUG_SCROLL_IF_NEEDED
    fprintf(stderr, "%d + %d > %d?\n", drawing_y, y_min, clip_h);
#endif
    if (test_scroll > 0) { /* need to scroll down? */
	need_v_scroll = test_scroll;
	TRACE_SRC((stderr, "need_v_scroll down: %d", need_v_scroll));
    }
    else if (abs(drawing_y) + 2 > y_max) { /* need to scroll up? */
	need_v_scroll = -((abs(drawing_y) - y_max) + 1);
	TRACE_SRC((stderr, "need_v_scroll up: %d (%d > %d; %d)", need_v_scroll, abs(drawing_y), y_max, clip_y));
    }

    /* check if we need to scroll horizontally; x_min < 0 blocks this
       (e.g. for hyperref, where we don't want it) */
    if (x_min >= 0) {
	test_scroll = x_min + drawing_x - clip_w + 1;
	TRACE_SRC((stderr, "test_scroll horizontally: %d", test_scroll));
	
	if (test_scroll > 0) {
	    /* need to scroll to right (i.e. make stuff on right-hand side visible)? */
	    need_h_scroll = test_scroll;
	    TRACE_SRC((stderr, "need_h_scroll right: %d", need_h_scroll));
	}
	else if (abs(drawing_x) > x_max) {
	    /* need to scroll to left (i.e. make stuff on left-hand side visible)? */
	    need_h_scroll =  -(abs(drawing_x) - x_max);
	    TRACE_SRC((stderr, "need_h_scroll left: %d", need_h_scroll));
	}
    }

    /* FIXME: should we not scroll if keep_flag is active? */
    if (need_v_scroll != 0 && globals.widgets.y_bar != NULL) {
#ifdef MOTIF
	/* need to add new value to current one */
	XtVaGetValues(globals.widgets.y_bar, XmNvalue, &test_scroll, NULL);
	(void)set_bar_value(globals.widgets.y_bar, test_scroll + need_v_scroll, (int)(globals.page.h - mane.height));
#else
	XtCallCallbacks(globals.widgets.y_bar, XtNscrollProc, cast_int_to_XtPointer(need_v_scroll));
#endif
    }

    if (need_h_scroll != 0 && globals.widgets.x_bar != NULL) {
#ifdef MOTIF
	/* need to add new value to current one */
	XtVaGetValues(globals.widgets.x_bar, XmNvalue, &test_scroll, NULL);
	(void)set_bar_value(globals.widgets.x_bar, test_scroll + need_h_scroll, (int)(globals.page.w - mane.width));
#else
	XtCallCallbacks(globals.widgets.x_bar, XtNscrollProc, cast_int_to_XtPointer(need_h_scroll));
#endif
    }

    do_autoscroll = False;
}