Esempio n. 1
0
static int boot_menu(void)
{
    const char* strings[] = {"Boot Rockbox", "Boot OF", "USB mode", "Reset Rockbox configuration"};
    int button, touch, poweroff_repeat = 0;
    unsigned int i;

    verbose = true;
    adc_init();

redraw:
    lcd_clear_display();
    for(i=0; i<ARRAYLEN(strings); i++)
    {
        lcd_drawrect(RECT_X, RECT_Y(i), RECT_WIDTH, RECT_HEIGHT);
        lcd_putsxy(TEXT_X(i), TEXT_Y(i), strings[i]);
    }
    lcd_update();

    while(1)
    {
        button = button_get_w_tmo(HZ/4);
        if(button & BUTTON_TOUCHSCREEN)
        {
            touch = button_get_data();
            unsigned int x = touch & 0xFFFF, y = touch >> 16;
            int found = -1;
            for(i=0; i<ARRAYLEN(strings); i++)
            {
                if(x > RECT_X && x < RECT_X+RECT_WIDTH &&
                   y > RECT_Y(i) && y < RECT_Y(i)+RECT_HEIGHT)
                {
                    found = i;
                    break;
                }
            }

            switch(found)
            {
                case 0:
                    reset_screen();
                    boot_rockbox();
                    break;
                case 1:
                    reset_screen();
                    boot_of();
                    break;
                case 2:
                    usb_mode();
                    break;
                case 3:
                    reset_configuration();
                    break;
            }

            if(found != -1)
                goto redraw;
        }
        else if(button & BUTTON_POWER)
Esempio n. 2
0
void render_line_sel( struct text_rendition *info, struct line_layout *ll )
{
  int base_x = ll->base_x;
  int base_y = ll->base_y;
  UINT_32 line_start = ll->line_start;
  UINT_32 line_end = ll->line_end;
  int sel_start_x = ll->sel_start_x;
  int sel_end_x = ll->sel_end_x;

  if (info->sel_from <= line_end && info->sel_to >= line_start)
    {
      int x, y, w, h;

      if (info->sel_from >= line_start)
	x = sel_start_x;
      else
	x = base_x;

      if (info->sel_to <= line_end)
	w = sel_end_x - x;
      else
	w = (base_x + info->line_width) - x;
      x += info->origin_x;
      h = info->line_height;
      y = base_y - h;

      XFillRectangle( info->ctx_dsp, info->ctx_win, info->ctx_gc,
		      x + RECT_X(info->sel_bleed),
		      y + RECT_Y(info->sel_bleed),
		      w + RECT_W(info->sel_bleed),
		      h + RECT_H(info->sel_bleed) );
    }
}
Esempio n. 3
0
static int
ui_window_get_placement(lua_State* L)
{
	HWND hwnd = NULL;
	RECT rect;
	Crj_ParseArgs(L, "| u", &hwnd);
	hwnd = GetTargetWindow(hwnd);

	GetWindowRect(hwnd, &rect);
	lua_pushinteger(L, RECT_X(rect));
	lua_pushinteger(L, RECT_Y(rect));
	lua_pushinteger(L, RECT_WIDTH(rect));
	lua_pushinteger(L, RECT_HEIGHT(rect));
	return 4;
}