コード例 #1
0
/**
  * @brief  Finds full path of selected file.
  * @param  hObj:    object handle
  * @param  hTVItem: window handle
  * @param  str: Pointer to str
  * @retval None
  */
void _FindFullPath(TREEVIEW_Handle hObj, TREEVIEW_ITEM_Handle hTVItem, char *str)
{
  TREEVIEW_ITEM_INFO hInfo;
  char strtmp[FILEMGR_FULL_PATH_SIZE];
  uint8_t Level = FILEMGR_MAX_LEVEL;
  
  /* Find File name */
  TREEVIEW_ITEM_GetText(hTVItem, (uint8_t *)str, FILEMGR_FULL_PATH_SIZE);

  /* Find folders */
  while( Level > 1)
  {
    TREEVIEW_ITEM_GetInfo(hTVItem, &hInfo);
    hTVItem = TREEVIEW_GetItem(hObj, hTVItem,TREEVIEW_GET_PARENT);
    TREEVIEW_ITEM_GetText(hTVItem, (uint8_t *)strtmp, FILEMGR_FULL_PATH_SIZE);
       
    if(strcmp(strtmp, "USB Disk") == 0)
    {
      strcpy(strtmp, "0:"); 
    }
    strcat(strtmp, "/");
    strcat(strtmp, str);
    strcpy(str, strtmp);
    TREEVIEW_ITEM_GetInfo(hTVItem, &hInfo);
    Level = hInfo.Level;
  }         
}
コード例 #2
0
ファイル: freertos.c プロジェクト: Oxbern/CCube_Firmware
void _cbHBKWIN(WM_MESSAGE * pMsg)
{
	int NCode;
	TREEVIEW_ITEM_Handle Sel;
	int Id;
	char pBuffer[128];
	
	switch (pMsg->MsgId)
	{
		case WM_NOTIFY_PARENT:
			NCode = pMsg->Data.v;
			Id = WM_GetId(pMsg->hWinSrc);
			if (Id == GUI_ID_TREEVIEW0)
			{
				switch (NCode)
				{
					case WM_NOTIFICATION_CLICKED:
						//printf("switching focus to treeview\n");
						WM_SetFocus(pMsg->hWinSrc);
						break;
					case WM_NOTIFICATION_RELEASED:
						Sel = TREEVIEW_GetSel(pMsg->hWinSrc);
						TREEVIEW_ITEM_GetText(Sel, (U8*)pBuffer, 128);
						printf("Selecting \"%s\"\n", pBuffer);
						
						myfd_t * selfd = (myfd_t *) TREEVIEW_ITEM_GetUserData(Sel);
						printf("Path to selection : %s\n", selfd->path);
						if (selfd->type == 0)
						{
							printf("is a directory\n");
						} else {
							printf("is a file\n");
							char * file_str = file2string(selfd->path);
							db = string2database(file_str);
							if (db)
							{
								run_db();
							} else {
								printf("Error loading database\n");
							}
						}
						
						break;
					case WM_NOTIFICATION_SEL_CHANGED:
						printf("Selection changed\n");
						break;
				}
			}
			else if (Id == GUI_ID_MULTIEDIT0)
			{
				switch (NCode)
				{
					case WM_NOTIFICATION_CLICKED:
						//printf("switching focus to terminal\n");
						WM_SetFocus(pMsg->hWinSrc);
						break;
					case WM_NOTIFICATION_VALUE_CHANGED:
						//printf("WM_NOTIFICATION_VALUE_CHANGED\n");
						break;
				}
			}
			else if (Id == GUI_ID_USER+0)
			{
				switch (NCode)
				{
					case WM_NOTIFICATION_CLICKED:
						WM_SetFocus(pMsg->hWinSrc);
						break;
				}
			}
			break;
		
		case WM_PAINT:
			GUI_SetColor(GUI_WHITE);
			GUI_Clear();
			break;

		default:
			WM_DefaultProc(pMsg);
	}
}