Exemple #1
0
/*virtual*/ void CWndModuleSelector::Create(CWnd *pParent, ui16 dwFlags) 
{
	CWnd::Create("CWndModuleSelector", dwFlags, CRect(0, 16, 400, 240), pParent);

	#define _BORDER 20
	#define _SPACING 8
	#define _LEFT(x) m_rcClient.left+_BORDER+(m_rcClient.Width()-_BORDER*2-_SPACING)*(x)/3
	#define _RIGHT(x) _LEFT(x+1)-_SPACING
	#define _TOP(y) m_rcClient.top+_BORDER+(m_rcClient.Height()-_BORDER*2-_SPACING)*(y)/3
	#define _BOTTOM(y) _TOP(y+1)-_SPACING
	#define _ITEM(x,y) CRect(_LEFT(x), _TOP(y), _RIGHT(x), _BOTTOM(y))

	CRect rcItem;

	rcItem = _ITEM(0, 0);          
	m_itmOscilloscope.Create( "Oscillo\nscope", RGB565(ffffff), rcItem, this );
	rcItem = _ITEM(1, 0);
	m_itmSpectrum.Create( "Spectrum\nanalyser", RGB565(ffffff), rcItem, this );
	rcItem = _ITEM(2, 0);
	m_itmResponse.Create( "Frequency\nresponse", RGB565(808080), rcItem, this );
	rcItem = _ITEM(0, 1);
	m_itmLogic.Create( "Logic\nanalyser", RGB565(808080), rcItem, this );
	rcItem = _ITEM(1, 1);
	m_itmGenerator.Create( "Signal\nGenerator", RGB565(ffffff), rcItem, this );
	rcItem = _ITEM(2, 1);
	m_itmSettings.Create( "Settings", RGB565(ffffff), rcItem, this );
	rcItem = _ITEM(0, 2);
	m_itmUser.Create( "User\napplications", RGB565(ffffff), rcItem, this );
	rcItem = _ITEM(1, 2);
	m_itmAbout.Create( "About", RGB565(ffffff), rcItem, this );
}
Exemple #2
0
static e8_runtime_error *
__e8_valuelist_item_get_property(e8_object obj, const e8_uchar *name, e8_property *property)
{
    _ITEM(it);

    e8_uchar *lname = e8_utf_strdup(name);
    e8_utf_lower_case(lname);

    bool found = true;

    #define CHECK_IS_PROPERTY(name) \
    if ( e8_utf_strcmp(lname, u_r_##name) == 0  || e8_utf_strcmp(lname, u_a_##name) == 0 ) { \
        e8_create_variant_property(property, &it-> name); \
    }


    CHECK_IS_PROPERTY(value) else
    CHECK_IS_PROPERTY(presentation) else
    CHECK_IS_PROPERTY(mark) else
    CHECK_IS_PROPERTY(picture) else
        found = false;

    #undef CHECK_IS_PROPERTY

    e8_utf_free(lname);

    if (!found)
        E8_THROW_DETAIL(E8_RT_PROPERTY_NOT_FOUND, e8_utf_strdup(name));

    E8_RETURN_OK;
Exemple #3
0
static
E8_DECLARE_SUB(e8_valuelist_item_get_id)
{
    _ITEM(it);

    e8_var_long(result, it->id);

    E8_RETURN_OK;
}
Exemple #4
0
/* init controls */
byte recovery_usb_init(LIBAROMA_WINDOWP win, USBMENU * var){
  /* create menu list */
  var->menu = libaroma_ctl_list(
    win, ID_MENULIST,
    0, 0, LIBAROMA_SIZE_FULL, LIBAROMA_SIZE_FULL,
    0, 0,
    libaroma_colorget(NULL,win)->control_bg,
    LIBAROMA_CTL_SCROLL_WITH_SHADOW
  );
  
  /* menu flags */
  word menuflags =
    LIBAROMA_LISTITEM_MENU_INDENT_NOICON|
    LIBAROMA_LISTITEM_MENU_SMALL_ICON|
    LIBAROMA_LISTITEM_MENU_FREE_ICON|
    LIBAROMA_LISTITEM_WITH_SEPARATOR|
    LIBAROMA_LISTITEM_SEPARATOR_TEXTALIGN;
  
  /* menu item macro */
  #define _ITEM(id,text,ico,extra) \
    libaroma_listitem_menu(\
      var->menu, id, text, extra, (ico!=NULL)?recovery_load_icon(ico,win):NULL, \
      menuflags,-1)
  #define _TITLE(id,text) \
    libaroma_listitem_caption_color(var->menu, id, text, \
      libaroma_colorget(NULL,win)->accent, -1)
  #define _DIV(id) \
    libaroma_listitem_divider(var->menu, id, \
      LIBAROMA_LISTITEM_DIVIDER_SUBSCREEN,-1)
  
  /* ITEMS */
  _TITLE(200,"SELECT USB MODE");
    _ITEM(ID_MENU_MTP,"MTP","usb",NULL);
    _ITEM(ID_MENU_MASS,"Mass Storage","usb",NULL);
    _ITEM(ID_MENU_NONE,"None","delete",NULL);
  
  /* undef menu item macro */
  #undef _DIV
  #undef _TITLE
  #undef _ITEM
  
  return 1;
}
Exemple #5
0
static void
__e8_valuelist_item_destroy(e8_object obj)
{
    _ITEM(it);

    e8_var_destroy(&it->value);
    e8_var_destroy(&it->presentation);
    e8_var_destroy(&it->mark);
    e8_var_destroy(&it->picture);

    free(it);
}
Exemple #6
0
/**
 * Fill submenu with panel-related items
 *
 * @param __panel - for which panel this method has been called
 * @param __submenu - in which submenu items will be added
 * @return zero on success, non-zero on failure
 */
int
fpd_fill_submenu (file_panel_t *__panel, w_sub_menu_t *__submenu)
{
  w_sub_menu_item_t *item;

  if (!__panel || !__submenu)
    {
      return -1;
    }

  _ITEM (L"_Listing mode...", 0);
  _ITEM (L"_Sort order...", fpd_menu_sortorder_callback);

  if (file_panel_get_count () > 1)
    {
      _SEPARATOR ();
      _ITEM (L"_Close panel", menu_close_callback);
    }

  return 0;
}
Exemple #7
0
/* Init UI */
byte recovery_init_ui(){
  /* create window */
  _recovery.win = libaroma_window(
      NULL, 0, 0, LIBAROMA_SIZE_FULL, LIBAROMA_SIZE_FULL
    );
  
  if (!_recovery.win){
    RLOG("Cannot init main window");
    return 0;
  }
  
  /* appbar */
  _recovery.appbar = libaroma_ctl_bar(
    _recovery.win, ID_APPBAR, 0, 0, LIBAROMA_SIZE_FULL, 56,
    "AROMA Recovery",
    libaroma_colorget(NULL,_recovery.win)->primary,
    libaroma_colorget(NULL,_recovery.win)->primary_text
  );
  
  if (!_recovery.appbar){
    return 0;
  }
  libaroma_ctl_bar_set_icon_mask(_recovery.appbar,1,0);
  libaroma_ctl_bar_set_textgap(_recovery.appbar,1,0);
  
  /* fragment */
  _recovery.fragment = libaroma_ctl_fragment(
    _recovery.win, ID_FRAGMENT,
    0, 56, LIBAROMA_SIZE_FULL, LIBAROMA_SIZE_FULL
  );
  if (!_recovery.fragment){
    return 0;
  }
  
  /* init sidebar */
  _recovery.sidebar = libaroma_window_sidebar(_recovery.win,0);
  if (_recovery.sidebar){
    /* sidebar onslide callback */
    libaroma_window_sidebar_onslide(
      _recovery.sidebar,
      &recovery_sidebar_onslide
    );
    
    word menuflags =
      LIBAROMA_LISTITEM_MENU_INDENT_NOICON|
      LIBAROMA_LISTITEM_MENU_SMALL_ICON|
      LIBAROMA_LISTITEM_MENU_FREE_ICON|
      LIBAROMA_LISTITEM_MENU_SMALL;
    
    /* menu item macro */
    #define _ITEM(id,text,ico,extra) \
      libaroma_listitem_menu(\
        _recovery.sidemenu, id, text, extra, \
        (ico!=NULL)?recovery_load_icon(ico,_recovery.win):NULL, \
        menuflags,-1)
    #define _TITLE(id,text) \
      libaroma_listitem_caption_color(_recovery.sidemenu, id, text, \
        libaroma_colorget(NULL,_recovery.win)->accent, -1)
    #define _DIV(id) \
      libaroma_listitem_divider(_recovery.sidemenu, id, \
        LIBAROMA_LISTITEM_SEPARATOR_TEXTALIGN,-1)
    
    /* create menu list */
    _recovery.sidemenu = libaroma_ctl_list(
      _recovery.sidebar, ID_SIDEMENU,
      0, 0, LIBAROMA_SIZE_FULL, LIBAROMA_SIZE_FULL,
      0, 0,
      libaroma_colorget(NULL,_recovery.win)->control_bg,
      0 /*LIBAROMA_CTL_SCROLL_WITH_SHADOW*/
    );
    
    libaroma_ctl_scroll_set_min_scroll(
       _recovery.sidemenu,
       recovery_statusbar_sidebar_list_cb, 
       libaroma_dp(24)
    );
    
    /* sidebar image */
    libaroma_listitem_image(
      _recovery.sidemenu, ID_SIDEMENU_IMAGE,
      libaroma_image_uri("res:///bg/sidebar.jpg"), 150,
      LIBAROMA_LISTITEM_IMAGE_FREE|LIBAROMA_LISTITEM_IMAGE_FILL|
      LIBAROMA_LISTITEM_IMAGE_PROPORTIONAL|LIBAROMA_CTL_LIST_ITEM_RECEIVE_TOUCH,
    -1);
    
    /* ITEMS */
    _TITLE(210,"POWER MENU");
      _ITEM(ID_SIDEMENU_SHUTDOWN,"Shutdown","power",NULL);
      _ITEM(ID_SIDEMENU_REBOOT_SYS,"Reboot System","android",NULL);
      _ITEM(ID_SIDEMENU_REBOOT_REC,"Reboot Recovery","direction",NULL);
      _ITEM(ID_SIDEMENU_REBOOT_BLD,"Reboot Bootloader","apps",NULL);
    _DIV(310);
    _TITLE(211,"SETTINGS");
      _ITEM(ID_SIDEMENU_SETTINGS,"Settings","settings",NULL);
      _ITEM(ID_SIDEMENU_ABOUT,"About","info",NULL);
      _ITEM(ID_SIDEMENU_HELP,"Help","help",NULL);
    
    /*
    _DIV(311);
    
    int u;
    for (u=0;u<20;u++){
      char extraText[100];
      snprintf(extraText,100,"Dummy Sidebar %i",u);
      _ITEM(501+u,"Dummy Sidebar",NULL,extraText);
    }
  */
  
    /* undef menu item macro */
    #undef _DIV
    #undef _TITLE
    #undef _ITEM
  }
  else{
    return 0;
  }
  return 1;
}
void print_sock_errors() {
	int i;
#define _ITEM(i)  {i, #i}
	struct sock_error {
		int error;
		char str[32];
	} errors[] = {
			_ITEM(EAGAIN),
			_ITEM(EWOULDBLOCK),
			_ITEM(EBADF),
			_ITEM(ECONNREFUSED),
			_ITEM(EFAULT),
			_ITEM(EINTR),
			_ITEM(EINVAL),
			_ITEM(ENOMEM),
			_ITEM(ENOTCONN),
			_ITEM(ENOTSOCK),
			_ITEM(EACCES),
			_ITEM(ECONNRESET),
			_ITEM(EDESTADDRREQ),
			_ITEM(EMSGSIZE),
			_ITEM(ENOBUFS),
			_ITEM(EOPNOTSUPP),
			_ITEM(EPIPE),
			_ITEM(EPERM),
			_ITEM(EADDRINUSE),
			_ITEM(EAFNOSUPPORT),
			_ITEM(EALREADY),
			_ITEM(EINPROGRESS),
			_ITEM(EISCONN),
			_ITEM(ENETUNREACH),
			_ITEM(ETIMEDOUT),
			_ITEM(EMFILE),		//accept
			_ITEM(ENFILE),		//accept
			_ITEM(EPROTO),
			_ITEM(EADDRINUSE),
			_ITEM(EADDRNOTAVAIL),	//bind
			_ITEM(ELOOP),			//bind
			_ITEM(ENAMETOOLONG),	//bind
			_ITEM(ENOENT),			//bind
			_ITEM(ENOTDIR),			//bind
			_ITEM(EROFS),			//bind
			_ITEM(EPROTONOSUPPORT),	//socket
		};

	for(i = 0; i < sizeof(errors) / sizeof(errors[0]); i ++) {
		errno = errors[i].error;
		perror(errors[i].str);
	}

	printf("\n\n");
}