예제 #1
0
// 给表格项添加子控件
BOOL CDuiGridCtrl::AddSubItemControl(int nRow, int nItem, CControlBase* pControl)
{
	if((nRow < 0) || (nRow >= (int)m_vecRowInfo.size()))
	{
		return FALSE;
	}
	if((nItem < 0) || (nItem >= (int)m_vecColumnInfo.size()))
	{
		return FALSE;
	}

	GridItemInfo* pItemInfo = GetItemInfo(nRow, nItem);
	if(pItemInfo == NULL)
	{
		SetSubItem(nRow, nItem, _T(""));
		pItemInfo = GetItemInfo(nRow, nItem);
	}
	if(pItemInfo == NULL)
	{
		return FALSE;
	}

	if(pControl)
	{
		pControl->SetParent(this);
		pControl->SetVisible(FALSE);
		// 将控件指针添加到gridctrl控件的子控件列表中
		m_vecControl.push_back(pControl);
		// 将控件指针添加到单元格的控件列表中(仅用于按照单元格查找子控件)
		pItemInfo->vecControl.push_back(pControl);
		UpdateControl(true);
	}

	return TRUE;
}
예제 #2
0
파일: prjwnd.c 프로젝트: bencz/OrangeC
void DragTo(HTREEITEM dstItem, HTREEITEM srcItem)
{
    PROJECTITEM *srcData = GetItemInfo(srcItem);
    PROJECTITEM *dstData = GetItemInfo(dstItem);
    if (srcData && dstData && srcData->parent != dstData)
    {
        PROJECTITEM *p = dstData->parent;
        while(p)
            if (p == srcData)
                return;
            else
                p = p->parent;
        if (srcData->type == PJ_FOLDER || srcData->type == PJ_FILE)
        {
            if (dstData->type == PJ_FOLDER || dstData->type == PJ_PROJ)
            {
                PROJECTITEM **rmv = &srcData->parent->children;
                MarkChanged(srcData,FALSE);
                while (*rmv && *rmv != srcData)
                    rmv = &(*rmv)->next;
                if (*rmv)
                {
                    PROJECTITEM **ins = &dstData->children;
                    HTREEITEM pos = TVI_FIRST;
                    (*rmv) = (*rmv)->next;

                    TreeView_DeleteItem(prjTreeWindow, srcData->hTreeItem);
                    ResDeleteItem(srcData);
                    if (srcData->type == PJ_FILE)
                    {
                        while (*ins && (*ins)->type == PJ_FOLDER)
                        {
                            pos = (*ins)->hTreeItem;
                            ins = &(*ins)->next;
                        }
                    }
                    while (*ins && (*ins)->type == srcData->type && stricmp((*ins)->displayName, srcData->displayName) < 0)
                    {
                        pos = (*ins)->hTreeItem;
                        ins = &(*ins)->next;
                    }
                    srcData->parent = dstData;
                    srcData->next = NULL;
                    RecursiveCreateTree(dstData->hTreeItem, pos, srcData);
                    srcData->next = *ins;
                    *ins = srcData;
                    MarkChanged(srcData,FALSE);
                }
            }
        }
    }
}
예제 #3
0
TMemberIndex CItemsInfo::FindEmpty(void) const
{
    for (CIterator item(*this); item.Valid(); ++item) {
        const CItemInfo* info = GetItemInfo(item);
        if (info->GetId().IsAttlist()) {
            continue;
        }
        const CTypeInfo* type;
        for (type = info->GetTypeInfo();;) {
            if (type->GetTypeFamily() == eTypeFamilyContainer) {
                // container may be empty
                return *item;
            } else if (type->GetTypeFamily() == eTypeFamilyPointer) {
                const CPointerTypeInfo* ptr =
                    dynamic_cast<const CPointerTypeInfo*>(type);
                if (ptr) {
                    type = ptr->GetPointedType();
                }
            } else {
                break;
            }
        }
    }
    return kInvalidMember;
}
wxString PartitioningTreeCtrl::processdata(wxTreeItemId itemid)
{
	char a='"';
	wxString tab="	";
	wxString tabtab="		";
	wxString value;

	ItemTyp ityp=GetItemInfo(itemid);
	value.Append(tabtab);
	
	value.Append("<processcollocation>\n");
	value.Append(tabtab);
	value.Append("<usagename>");
	value.Append(ityp.usagename);
	value.Append("</usagename>\n");

	wxTreeItemIdValue cookie;
	wxTreeItemId childid = GetFirstChild(itemid,cookie);

	while (!(GetItemText(childid).IsEmpty())) {
		
		if (GetType(childid)==home) {
			value.Append(homedata(childid));
		}

		childid=GetNextChild(itemid,cookie);
		if (!childid.IsOk())
		{
			break;
		};
	}
	value.Append(tabtab);
	value.Append("</processcollocation>\n");
	return value;
}
예제 #5
0
// 消息响应
LRESULT CDuiListCtrl::OnMessage(UINT uID, UINT Msg, WPARAM wParam, LPARAM lParam)
{
	if((uID == SCROLL_V) && (Msg == MSG_SCROLL_CHANGE))
	{
		// 如果是滚动条的位置变更事件,则刷新显示
		UpdateControl(true);
	}else
	if((uID == GetID()) && (Msg == MSG_BUTTON_DOWN) && (lParam != -1))
	{
		// 点击了行的某个链接
		ListRowInfo* pRowInfo = GetItemInfo(wParam);
		if(pRowInfo)
		{
			// 转换为MSG_BUTTON_UP消息,因为DuiSystem任务处理时候只处理MSG_BUTTON_UP消息
			if((lParam == 0) && (!pRowInfo->strLinkAction1.IsEmpty()))
			{
				DuiSystem::AddDuiActionTask(uID, MSG_BUTTON_UP, wParam, lParam, GetName(), pRowInfo->strLinkAction1, GetParent());
			}else
			if((lParam == 1) && (!pRowInfo->strLinkAction2.IsEmpty()))
			{
				DuiSystem::AddDuiActionTask(uID, MSG_BUTTON_UP, wParam, lParam, GetName(), pRowInfo->strLinkAction2, GetParent());
			}
		}
	}

	return __super::OnMessage(uID, Msg, wParam, lParam); 
}
예제 #6
0
int ReadNew (int sd, c_tree * ct)
{
  GIV new_data;
  int counter = 0;
  int total_counter = 0;
  Node *curNode;
  int MustSend;
  time_t new_time;
  curNode = first_node (ct);
  
  fprintf(stderr,"ReadNew(%d) nodes=%d\n",sd,ct->numNodes);
  
  while (curNode)
  {
    MustSend = 0;
    new_time = time (NULL);
    new_data.Ident = curNode->data.Ident;
    new_data.Reliability =
      GetItemInfo (new_data.Ident, &new_data.Value, &new_data.ELRange,
		   &new_data.EHRange);
		   
//fprintf(stderr,"In ask new-Ident: %d  Rel: %d\n", new_data.Ident, 
//						    new_data.Reliability );

    if (fabsf (new_data.Value - curNode->data.Value) > curNode->si.DeadZone)
    {
      if (labs (new_time - curNode->access_time) > curNode->si.DeadTime)
      {
	MustSend = 1;
      }
    }
    else
    {
      if (new_data.Reliability != curNode->data.Reliability ||
	  fabsf (new_data.ELRange - curNode->data.ELRange) > PRECISION ||
	  fabsf (new_data.EHRange - curNode->data.EHRange) > PRECISION)
      {
	MustSend = 1;
      }
    }
    if (MustSend)
    {
      curNode->access_time = new_time;
      memcpy (&(curNode->data), &new_data, sizeof (GIV));
      send (sd, &(curNode->data), sizeof (GIV), MSG_DONTWAIT);
// fprintf(stderr,"SEND!!! Rel=%d Ident=%d\n",curNode->data.Reliability,curNode->data.Ident);
      counter++;
    }
    curNode = next_node (curNode);
    total_counter++;
  }
  if (counter == 0 || counter != total_counter)	// not new data or send some of data
  {
    new_data.Ident = -1;
    new_data.Value = 3.1415926;
    send (sd, &new_data, sizeof (GIV), MSG_DONTWAIT);
  }

  return 1;
}
예제 #7
0
int
ReadAll (int sd, c_tree * ct)
{
  int s,i=0;
  Node *curNode;
  curNode = first_node (ct);
fprintf(stderr,"1: ReadAll(%d) nodes=%d\n",sd,ct->numNodes);
  while (curNode)
  {

//fprintf(stderr, "--------------Ident: %d\n", curNode->data.Ident );
//fflush(stderr);

    curNode->data.Reliability =
      GetItemInfo (curNode->data.Ident, &curNode->data.Value,
		   &curNode->data.ELRange, &curNode->data.EHRange);
    curNode->access_time = time (NULL);
    s = send (sd, &(curNode->data), sizeof (GIV), MSG_DONTWAIT);
if(s<1) fprintf(stderr,"-----------------------------s[%d]=%d\n",i,s);
//else	fprintf(stderr,"ident=%d rel=%d\n",curNode->data.Ident,curNode->data.Reliability);
    curNode = next_node (curNode);
    i++;
  }
fprintf(stderr,"2: ReadAll() send %d Items\n",i);  
  return 1;
}
예제 #8
0
파일: prjfile.c 프로젝트: jossk/OrangeC
void ProjectExistingFile(void)
{
    PROJECTITEM *data = GetItemInfo(prjSelectedItem);
    if (data && (data->type == PJ_PROJ || data->type == PJ_FOLDER))
    {
        OPENFILENAME ofn;
        if (OpenFileDialog(&ofn, data->realName, hwndProject, FALSE, TRUE, szNewFileFilter,
                               "Open existing file"))
        {
            char *path = ofn.lpstrFile;
            if (path[strlen(path)+1]) // multiselect
            {
                char buf[MAX_PATH];
                char *q = path + strlen(path) + 1;
                while (*q)
                {
                    sprintf(buf, "%s\\%s", path, q);
                    AddFile(data, buf, TRUE);
                    q += strlen(q) + 1;
                }
            }
            else
            {
                AddFile(data, path, TRUE);
            }			
        }
    }
}
예제 #9
0
void CItemsInfo::AddItem(CItemInfo* item)
{
    // clear cached maps (byname and bytag)
    m_ItemsByName.reset(0);
    m_ZeroTagIndex = kInvalidMember;
    m_ItemsByTag.reset(0);
    m_ItemsByOffset.reset(0);

    // update item's tag
    if ( !item->GetId().HaveExplicitTag() ) {
        TTag tag = CMemberId::eFirstTag;
        if ( !Empty() ) {
            TMemberIndex lastIndex = LastIndex();
            const CItemInfo* lastItem = GetItemInfo(lastIndex);
            if ( lastIndex != FirstIndex() ||
                 !lastItem->GetId().HaveParentTag() )
                tag = lastItem->GetId().GetTag() + 1;
        }
        item->GetId().SetTag(tag, false);
    }

    // add item
    m_Items.push_back(AutoPtr<CItemInfo>(item));
    item->m_Index = LastIndex();
}
예제 #10
0
TMemberIndex CItemsInfo::Find(const CTempString& name, TMemberIndex pos) const
{
    for ( CIterator i(*this, pos); i.Valid(); ++i ) {
        if ( name == GetItemInfo(i)->GetId().GetName() )
            return *i;
    }
    return kInvalidMember;
}
예제 #11
0
void GStateScene::UpgradeUnit(gtuint uiUnitIndex, GnINumberLabel* pTotalMoneyLabel, GnINumberLabel* pUnitMoneyLabel)
{
	if( uiUnitIndex == -1 )
		return;
	
	GUserHaveItem* haveItem = GetCurrentHaveItem();
	GPlayingDataManager* dataMng = GPlayingDataManager::GetSingleton();	
	GPlayingData* playingData = dataMng->GetPlayingPlayerData();
	
	// check upgrade money
	guint32 itemLevel = haveItem->GetItemLevel( uiUnitIndex );
	
	if( MAX_UNIT_LEVEL <= itemLevel )
	{
		haveItem->Close();
		return;
	}
	
	guint32 buyMoney = GetItemInfo()->GetBuyPrice( uiUnitIndex, itemLevel );
	if( playingData->GetMoneyCount() < buyMoney )
	{
		haveItem->Close();
		return;	
	}

	itemLevel += 1;
	
	// update level
	haveItem->UpdateLevel( uiUnitIndex, itemLevel );
	
	// set money data
	guint32 money = playingData->GetMoneyCount() - buyMoney;
	playingData->SetMoneyCount( money );
	pTotalMoneyLabel->SetNumber( money );
	dataMng->SaveData();
	
	// set unit money label
	buyMoney = GetItemInfo()->GetBuyPrice( uiUnitIndex, itemLevel );
	pUnitMoneyLabel->SetNumber( buyMoney );
	
	
	haveItem->Close();
	
	
}
예제 #12
0
파일: fpdf_page.cpp 프로젝트: andoma/pdfium
void CPDF_TextObject::GetCharInfo(int index, CPDF_TextObjectItem* pInfo) const {
  if (m_nChars == 1) {
    GetItemInfo(0, pInfo);
    return;
  }
  int count = 0;
  for (int i = 0; i < m_nChars; ++i) {
    FX_DWORD charcode = m_pCharCodes[i];
    if (charcode == (FX_DWORD)-1) {
      continue;
    }
    if (count == index) {
      GetItemInfo(i, pInfo);
      break;
    }
    ++count;
  }
}
void PartitioningTreeCtrl::onregister_at_name_service(wxCommandEvent& event)
{

	// opens dialog
	// request full scoped Naming Context name to register at
	wxString ns_name = wxGetTextFromUser("Enter a name for registering at Name Service","Register at NameService",
	"", this,-1,-1,TRUE);
	wxString text="NameService: ";
	text.Append(ns_name);

	// add name to tree
	wxTreeItemId itemid = AppendItem(GetSelection(),text,
		TreeCtrlIcon_Folder,TreeCtrlIcon_FolderSelected,NULL);
	Expand(GetRootItem());
	Refresh();
	ItemTyp itype;
	itype.itemid=itemid;
	itype.type=registration;
	itype.usagename=ns_name;

	itemtypes.push_back(itype);

	// add information to instance or port

	ElementType etype=GetType(GetSelection());
	
	if (etype==inst) {
		// get instance
		Instantiation curr_instance = get_Instantiation(GetSelection());

		// add register Info to instance
		curr_instance.component_registration = ns_name;
		replace_Instantiation(curr_instance);				

	}

	if (etype==facet) {
		// get instance
		Instantiation curr_instance = get_Instantiation(GetItemParent(GetSelection()));


		// create new facet-registration
		PartitioningTreeCtrl::ItemTyp  facet_item = GetItemInfo(GetSelection());
		FacetRegistration fr;
		fr.facet_name = facet_item.usagename;
		fr.ns_name = ns_name;
		// add register Info to instance
		
		curr_instance.facet_registrations.push_back(fr);

		replace_Instantiation(curr_instance);				

	}


}
예제 #14
0
파일: Menu.cpp 프로젝트: bks/qz7
bool CMenu::GetItem(UINT itemIndex, bool byPosition, CMenuItem &item)
{
  const UINT kMaxSize = 512;
  #ifndef _UNICODE
  if (!g_IsNT)
  {
    CHAR s[kMaxSize + 1];
    MENUITEMINFOA si;
    ConvertItemToSysForm(item, si);
    if (item.IsString())
    {
      si.cch = kMaxSize;
      si.dwTypeData = s;
    }
    if (GetItemInfo(itemIndex, byPosition, &si))
    {
      ConvertItemToMyForm(si, item);
      if (item.IsString())
        item.StringValue = GetUnicodeString(s);
      return true;
    }
  }
  else
  #endif
  {
    wchar_t s[kMaxSize + 1];
    MENUITEMINFOW si;
    ConvertItemToSysForm(item, si);
    if (item.IsString())
    {
      si.cch = kMaxSize;
      si.dwTypeData = s;
    }
    if (GetItemInfo(itemIndex, byPosition, &si))
    {
      ConvertItemToMyForm(si, item);
      if (item.IsString())
        item.StringValue = s;
      return true;
    }
  }
  return false;
}
예제 #15
0
int
ReadByIdent (int sd, ident_t ident)
{
  int res;
  GIV ans;
  ans.Ident = ident;
  ans.Reliability =
    GetItemInfo (ident, &ans.Value, &ans.ELRange, &ans.EHRange);
  res = send (sd, &ans, sizeof (GIV), MSG_DONTWAIT);
  return res;
}
예제 #16
0
pair<TMemberIndex, const CItemsInfo::TItemsByTag*>
CItemsInfo::GetItemsByTagInfo(void) const
{
    typedef pair<TMemberIndex, const TItemsByTag*> TReturn;
    TReturn ret(m_ZeroTagIndex, m_ItemsByTag.get());
    if ( ret.first == kInvalidMember && ret.second == 0 ) {
        CFastMutexGuard GUARD(s_ItemsMapMutex);
        ret = TReturn(m_ZeroTagIndex, m_ItemsByTag.get());
        if ( ret.first == kInvalidMember && ret.second == 0 ) {
            {
                CIterator i(*this);
                if ( i.Valid() ) {
                    ret.first = *i-GetItemInfo(i)->GetId().GetTag();
                    for ( ++i; i.Valid(); ++i ) {
                        if ( ret.first != *i-GetItemInfo(i)->GetId().GetTag() ) {
                            ret.first = kInvalidMember;
                            break;
                        }
                    }
                }
            }
            if ( ret.first != kInvalidMember ) {
                m_ZeroTagIndex = ret.first;
            }
            else {
                auto_ptr<TItemsByTag> items(new TItemsByTag);
                for ( CIterator i(*this); i.Valid(); ++i ) {
                    const CItemInfo* itemInfo = GetItemInfo(i);
                    TTag tag = itemInfo->GetId().GetTag();
                    if ( !items->insert(TItemsByTag::value_type(tag, *i)).second ) {
                        NCBI_THROW(CSerialException,eInvalidData, "duplicate member tag");
                    }
                }
                ret.second = items.get();
                m_ItemsByTag = items;
            }
        }
    }
    return ret;
}
예제 #17
0
int ConnectorAccept (ident_t ident, s_info * sub, c_tree * ct)
{
  Node newNode;
  GIV ans;

  ans.Ident = ident;
  ans.Reliability =
    GetItemInfo (ident, &ans.Value, &ans.ELRange, &ans.EHRange);
  SetGIV (&newNode, &ans);
  SetInfo (&newNode, sub);
  lst_append (ct, &newNode);
  return 1;
}
예제 #18
0
파일: prjfile.c 프로젝트: jossk/OrangeC
void ProjectNewFile(void)
{
    PROJECTITEM *data = GetItemInfo(prjSelectedItem);
    if (data && (data->type == PJ_PROJ || data->type == PJ_FOLDER))
    {
        if (DialogBox(hInstance, "IDD_NEWFILE", hwndFrame, (DLGPROC)NewFileProc) == IDOK)
        {
            char *p;
            char buf[MAX_PATH];
            PROJECTITEM *pj = data;
            BOOL writeFile = FALSE;
            FILE *fil;
            while (pj->type == PJ_FOLDER)
                pj = pj->parent;
            strcpy(buf, pj->realName);
            p = strrchr(buf, '\\');
            if (!p)
                p = buf;
            else
                p++;
            strcpy(p, newTitle);
            
            strcat(p, extensionMap[newMode][0]);
            fil = fopen(buf, "rb");
            if (fil)
            {
                if (ExtendedMessageBox("Add New File", MB_YESNO, "File exists.  Overwrite?") == IDYES)
                    writeFile = TRUE;
            }
            else
            {
                writeFile = VerifyPath(buf);
            }
            if(writeFile)
            {
                if (!stricmp(p + strlen(p)-3,".rc"))
                {
                    CreateNewResourceFile(data, buf, TRUE);
                }
                else
                {
                    fil = fopen(buf,"wb");
                    if (fil)
                        fclose(fil);
                    AddFile(data, buf, TRUE);
                }
            }
        }
    }
}
예제 #19
0
파일: Remotely.c 프로젝트: jufei/BtsShell
int CVICALLBACK SearchFile (int panel, int control, int event,
		void *callbackData, int eventData1, int eventData2)
{
	switch (event)
	{
		case EVENT_COMMIT:
			 int status; char cmd[100]; char *info = "";   char *buffer = "";   char *folder = "";   
			
			 info = GetItemInfo(3);
			 buffer=(char*)malloc(1000);
	 		 memset(buffer,0,1000);
			 sprintf(buffer,"Do you want to search files: (%s) now?",info);
			 if (ConfirmPopup ("Search File",buffer)) 
			 {
				 memset(cmd,0,100);
				 strcpy(cmd,"RemoteAction.exe -c:search");
				 DimAction(1); 
				 status = ExecutableProcess(cmd,"@action done@");
				 if (status)
				 {
					SetLed("Search files is finished!",1);
					memset(cmd,0,100);
					strcpy(cmd,"filter.exe -a:search");
					DimAction(1); 
					status = ExecutableProcess(cmd,"@action done@");
					if (status)
					{
						 SetLed("Analyze searched files information finished!",1);
					}
					else
					{
						SetLed("Analyze searched files information failed,please check detail info",0);  
					}
					DimAction(0);
			
				}
				else
				{
 				    memset(buffer,0,1000); 
				    sprintf(buffer,"Search files: (%s) failed,pls check detail info!",info); 	
				    SetLed(buffer,0); 
				}
				DimAction(0);
			 }
			 free(buffer);
			break;
	}
	return 0;
}
예제 #20
0
void GStateScene::BuyItem(GnIListCtrl* pInvenList, GnIListCtrl* pEquipList, GnINumberLabel* pMoneyLabel
	, GStateListCtrlItem* pItem)
{
	if( pItem == NULL )
		return;	
	
	gtuint itemIndex = pItem->GetItemIndex();
	GPlayingDataManager* dataMng = GPlayingDataManager::GetSingleton();	
	GPlayingData* playingData = dataMng->GetPlayingPlayerData();
	
	guint32 buyMoney = GetItemInfo()->GetBuyPrice( itemIndex, 0 );
	if( playingData->GetMoneyCount() < buyMoney )
		return;

	GUserHaveItem* haveItem = dataMng->GetPlayingHaveItem();
	haveItem->OpenPlayerItem( playingData->GetPlayerName() );

	GItemListCtrlItem* equipItem = NULL;
	guint32 itemCount = haveItem->GetItemCount( pItem->GetItemIndex() ) + 1;
	
	if( itemCount == 1 )
	{
		// add item to haveitem
		haveItem->AddItem( itemIndex, eItem );
		
		// add item to list
		GStateUILayer* interfaceLayer = (GStateUILayer*)mpInterfaceLayer;
		equipItem = interfaceLayer->CreateItemCtrlItem( itemIndex );
		pInvenList->AddItem( equipItem );
		equipItem->SetTegID( GInterfaceLayer::LISTITEM_INVEN );
		equipItem->SetItemIndex( itemIndex );
		equipItem->SetItemCount( itemCount );
	}
	else
	{
		UpdateItemCount( haveItem, pInvenList, pEquipList, itemIndex, itemCount );
	}
	
	haveItem->Close();
	
	// set money
	guint32 money = playingData->GetMoneyCount() - buyMoney;
	playingData->SetMoneyCount( money );
	pMoneyLabel->SetNumber( money );	
	
	dataMng->SaveData();
}
예제 #21
0
guint32 GStateScene::SellItem(GnIListCtrl* pInvenList, GnIListCtrl* pEquipList, GnINumberLabel* pMoneyLabel
	, GStateListCtrlItem* pItem)
{
	if( pItem == NULL )
		return 0;
	
	GPlayingDataManager* dataMng = GPlayingDataManager::GetSingleton();
	GUserHaveItem* haveItem = dataMng->GetPlayingHaveItem();
	GPlayingData* playingData = dataMng->GetPlayingPlayerData();
	haveItem->OpenPlayerItem( playingData->GetPlayerName() );
	
	guint32 itemIndex = pItem->GetItemIndex();
	// delete item
	guint32 itemCount = haveItem->GetItemCount( itemIndex ) - 1;
	if( itemCount < 1 )
	{
		GItemListCtrlItem* existItem = GetListCtrlItemFromIndex( pInvenList, itemIndex );
		if( existItem )
		{
			haveItem->DeleteItem( itemIndex, eItem );
			pInvenList->RemoveItem( pItem );
		}
		
		existItem = GetListCtrlItemFromIndex( pEquipList, itemIndex );
		if( existItem )
		{
			haveItem->DeleteItem( itemIndex, eEquip );
			pEquipList->RemoveItem( pItem );
		}		
	}
	else
	{
		UpdateItemCount( haveItem, pInvenList, pEquipList, itemIndex, itemCount );
	}

	// set money
	guint32 sellMoney = GetItemInfo()->GetSellPrice( itemIndex, 0 );
	guint32 money = sellMoney + playingData->GetMoneyCount();
	playingData->SetMoneyCount( money );
	pMoneyLabel->SetNumber( money );
	
	haveItem->Close();
	
	dataMng->SaveData();
	return itemCount;
}
예제 #22
0
파일: prjwnd.c 프로젝트: bencz/OrangeC
void CreateProjectMenu(void)
{
    PROJECTITEM *cur = GetItemInfo(prjSelectedItem);
    HMENU menu = NULL;
    if (cur)
    {
        switch(cur->type)
        {
            case PJ_WS:
                menu = LoadMenuGeneric(hInstance, "WORKAREAMENU");
                break;
            case PJ_PROJ:
                if (cur->loaded)
                    menu = LoadMenuGeneric(hInstance, "PROJECTMENU");
                else
                    menu = LoadMenuGeneric(hInstance, "PROJECTREMOVEMENU");
                break;
            case PJ_FOLDER:

                menu = LoadMenuGeneric(hInstance, "FOLDERMENU");
                break;
            case PJ_FILE:
                menu = LoadMenuGeneric(hInstance, "FILEMENU");
                break;
            default:
                menu = NULL;
                break;
        }
    }
    else
    {
        menu = LoadMenuGeneric(hInstance, "WORKAREAMENU");
    }
    if (menu)
    {
        HMENU popup = GetSubMenu(menu, 0);
        POINT pos;
        GetCursorPos(&pos);
        InsertBitmapsInMenu(popup);
        TrackPopupMenuEx(popup, TPM_TOPALIGN | TPM_LEFTBUTTON, pos.x,
            pos.y, hwndFrame, NULL);
        DestroyMenu(menu);
    }
}
예제 #23
0
파일: prjwnd.c 프로젝트: bencz/OrangeC
void ProjectSetActive()
{
    PROJECTITEM *data = GetItemInfo(prjSelectedItem);
    if (data && data->type == PJ_PROJ)
    {
        TV_ITEM t;
        memset(&t, 0, sizeof(t));
        activeProject = data;
        MarkChanged(data, TRUE);
        t.mask = TVIF_TEXT;
        t.hItem = data->hTreeItem;
        t.pszText = data->displayName;
        t.cchTextMax = strlen(data->displayName);
        TreeView_SetItem(prjTreeWindow, &t);
        InvalidateRect(prjTreeWindow, 0, 1);
        FreeJumpSymbols();
        LoadJumpSymbols();
    }
}
예제 #24
0
// 设置Tab页签的Tooltip
void CDuiTabCtrl::SetTabTooltip(int nItem, CString strTooltip)
{
	CDlgBase* pDlg = GetParentDialog();
	if(pDlg && (m_nTipItem != nItem))
	{
		TabItemInfo* pTabInfo = GetItemInfo(nItem);
		BOOL bHaveDivTip = ((pTabInfo->pControl != NULL) && !pTabInfo->pControl->GetTooltip().IsEmpty());
		if(pTabInfo && (pTabInfo->bNeedTextTip || bHaveDivTip))
		{
			CRect rc = pTabInfo->rc;
			pDlg->SetTooltip(this, strTooltip, rc, TRUE);
		}else
		{
			pDlg->ClearTooltip();
		}

		m_nTipItem = nItem;
	}
}
예제 #25
0
// Calculates CRC32 of encoded buffer of
// given uniform.
DWORD GetUniSig(char* afsFileName, char* uniFileName)
{
	DWORD base = 0;
	AFSITEMINFO itemInfo;
	ZeroMemory(&itemInfo, sizeof(AFSITEMINFO));

	// locate the file in AFS, using filename
	DWORD result = GetItemInfo(afsFileName, uniFileName, &itemInfo, &base);
	if (result != AFS_OK)
		return result;

	// Allocate buffer for the item
	BYTE* buffer = (BYTE*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, itemInfo.dwSize);
	if (buffer == NULL)
		return AFS_HEAPALLOC_FAILED;

	TRACE2("GetUniSig: base offset = %08x", base);
	TRACE2("GetUniSig: itemInfo.dwOffset = %08x", itemInfo.dwOffset);
	TRACE2("GetUniSig: itemInfo.dwSize   = %08x", itemInfo.dwSize);

	FILE* f = fopen(afsFileName, "rb");
	if (f == NULL)
	{
		// release the buffer memory
		HeapFree(GetProcessHeap(), 0, buffer);
		return AFS_FOPEN_FAILED;
	}

	// Now, read the item into a buffer
	fseek(f, base + itemInfo.dwOffset, SEEK_SET);
	fread(buffer, itemInfo.dwSize, 1, f);

	// close the file
	fclose(f);

	// Calculate the signature
	DWORD sig = Sign(buffer);

	// release the buffer memory
	HeapFree(GetProcessHeap(), 0, buffer);
	return sig;
}
예제 #26
0
TMemberIndex CItemsInfo::Find(TTag tag, TMemberIndex pos) const
{
    TMemberIndex zero_index = m_ZeroTagIndex;
    if ( zero_index == kInvalidMember && !m_ItemsByTag.get() ) {
        zero_index = GetItemsByTagInfo().first;
    }
    if ( zero_index != kInvalidMember ) {
        TMemberIndex index = tag + zero_index;
        if ( index < pos || index > LastIndex() )
            return kInvalidMember;
        return index;
    }
    else {
        for ( CIterator i(*this, pos); i.Valid(); ++i ) {
            if ( GetItemInfo(i)->GetId().GetTag() == tag )
                return *i;
        }
        return kInvalidMember;
    }
}
예제 #27
0
std::string FCBondage::SBTracker::GetItemName(unsigned __int16 itemID)
{
	// This routine uses a shared buffer, and needs to be thread safe.
	std::lock_guard<std::mutex> lock(ItemInfoSyncObject);

	std::string result;
	try
	{
		auto itemInfo = GetItemInfo(itemID);
		if (itemInfo == NULL)
			return result;
		// The returned structure stores the name with a dynamic offset. The bellow reads the offset and determines where the string starts.
		result = std::string(&reinterpret_cast<const char*>(itemInfo)[itemInfo->OffsetOfName + offsetof(BasicItemInfo,OffsetOfName)]);
	}
	catch (...)
	{
		result = std::string("");
	}
	return result;
}
wxString PartitioningTreeCtrl::homedata(wxTreeItemId itemid)
{
	char a='"';
	wxString tab="	";
	wxString tabtab="		";
	wxString value;
	ItemTyp ityp=GetItemInfo(itemid);
	value.Append(tabtab);
	
	value.Append("<homeplacement id=");
	value.Append(a);
	value.Append(ityp.usagename);
	value.Append(a);
	value.Append(">\n");
	value.Append(tabtab);
	value.Append("<usagename>");
	value.Append(ityp.usagename);
	value.Append("</usagename>\n");

	wxTreeItemIdValue cookie;
	wxTreeItemId childid = GetFirstChild(itemid,cookie);

	while (!(GetItemText(childid).IsEmpty())) {
		
		if (GetType(childid)==comp) {
			value.Append(compdata(childid));
		}

		childid=GetNextChild(itemid,cookie);
		if (!childid.IsOk())
		{
			break;
		};
	}
	value.Append(tabtab);
	
	value.Append("</homeplacement>\n");
	return value;

}
예제 #29
0
const CItemsInfo::TItemsByName& CItemsInfo::GetItemsByName(void) const
{
    TItemsByName* items = m_ItemsByName.get();
    if ( !items ) {
        CFastMutexGuard GUARD(s_ItemsMapMutex);
        items = m_ItemsByName.get();
        if ( !items ) {
            auto_ptr<TItemsByName> keep(items = new TItemsByName);
            for ( CIterator i(*this); i.Valid(); ++i ) {
                const CItemInfo* itemInfo = GetItemInfo(i);
                const string& name = itemInfo->GetId().GetName();
                if ( !items->insert(TItemsByName::value_type(name, *i)).second ) {
                    if ( !name.empty() )
                        NCBI_THROW(CSerialException,eInvalidData,
                            string("duplicate member name: ")+name);
                }
            }
            m_ItemsByName = keep;
        }
    }
    return *items;
}
예제 #30
0
파일: Remotely.c 프로젝트: jufei/BtsShell
int CVICALLBACK FetchLogs (int panel, int control, int event,
		void *callbackData, int eventData1, int eventData2)
{
	switch (event)
	{
		case EVENT_COMMIT:
			 int status; char cmd[100];  char *buffer=""; char *info = ""; char *folder="";
	 
			 info = GetItemInfo(2); 
			 buffer=(char*)malloc(100);
			 memset(buffer,0,100);
			 sprintf(buffer,"Do you want to fetch filter logs: (%s) now?",info);
			 
			 if (ConfirmPopup ("Fetch Filter Logs",buffer)) 
			 {
				memset(cmd,0,100);
				strcpy(cmd,"RemoteAction.exe -d:filter");
				DimAction(1); 
				status = ExecutableProcess(cmd,"@action done@");
				if (status)
				{   
					memset(buffer,0,100);
					folder= readfoldername();
					sprintf(buffer,"Fetch filter logs: (%s) finished! folder is:%s",info,folder);  
				    SetLed(buffer,1);
				}
				else
				{
				   memset(buffer,0,100); 
				   sprintf(buffer,"Fetch filter logs: (%s) failed,pls check detail info!",info); 	
				   SetLed(buffer,0);
				}
				DimAction(0);
			 }
			 free(buffer);
			break;
	}
	return 0;
}