void AutoStartPage::PopulateList() { m_taps.clear(); // Get a list of TAPs in the current Auto Start TAP_Hdd_ChangeDir( autoStartPath ); TYPE_File file; int index = 0; for ( dword totalEntry = TAP_Hdd_FindFirst( &file ); totalEntry > 0; ) { if ( file.attr == ATTR_NORMAL ) { char* ext = strrchr(file.name, '.'); if ( ext ) { // ensure we're only looking at .tap files ++ext; bool enabled = stricmp( ext, "tap" ) == 0; if ( enabled || stricmp( ext, "nap" ) == 0 ) { // that we can open TYPE_File* f = TAP_Hdd_Fopen( file.name ); if ( f ) { // read the TAP header tTAPHeader header; memset( &header, 0, sizeof(header) ); TAP_Hdd_Fread( &header, sizeof(header), 1, f ); TAP_Hdd_Fclose( f ); // ensure that it's actually a TAP format file if ( strncmp( header.Signature, "TFAPMIPS", 8 ) == 0 ) { m_taps.push_back(AutoStartTAP()); AutoStartTAP& t = m_taps.back(); // store the filename with the extension .tap in the order array *ext = 't'; t.index = index; t.filename = file.name; t.enabled = enabled; t.id = header.TAPID; t.name = header.Name; // and generate the text that will be shown in the footer t.footer.format( "%s\n%s\n%s\n", header.Description, header.AuthorName, header.EtcStr ); ++index; } } } } } dword currentEntry = TAP_Hdd_FindNext( &file ); if ( totalEntry == currentEntry || currentEntry == 0 ) break; } // Remove the Loading message and redraw the window contents DiscardItems(); for (unsigned int i=0; i < m_taps.size(); ++i) AddItem(new TAPListItem(this, i)); AddItem(new FooterActionListItem(this, &Commit, "Press OK to save the new TAP order\nTAPs will be loaded in this order next time the unit wakes from standby", 0, "", "Save Changes")); AddItem(new FooterActionListItem(this, &Backup, "Press OK to backup the TAP order and enabled state as listed above", 0, "", "Backup")); AddItem(new FooterActionListItem(this, &Restore, "Press OK to restore the previous backup to the list above\nThis does not save changes to disk", 0, "", "Restore")); Draw(); }
void VSCSearch::SetupConnections() { connect( this->ui.pushButtonStart, SIGNAL( clicked() ), this, SLOT(StartSearch())); connect( this->ui.pushButtonStop, SIGNAL( clicked() ), this, SLOT(StopSearch())); connect( this->ui.pushButtonAdd, SIGNAL( clicked() ), this, SLOT(AddAll())); connect( this->ui.pushButtonSelect, SIGNAL( clicked() ), this, SLOT(SelectAll())); connect( this, SIGNAL(NewSearchedItem(astring, astring, astring, astring, astring, astring) ), this, SLOT(AddItem(astring, astring, astring, astring, astring, astring)), Qt::QueuedConnection); //Qt::QueuedConnection }
void TExpandoMenuBar::AttachedToWindow() { BMessenger self(this); BList teamList; TBarApp::Subscribe(self, &teamList); float width = fVertical ? Frame().Width() : kMinimumWindowWidth; float height = -1.0f; // top or bottom mode, add be menu and sep for menubar tracking consistency if (!fVertical) { TBeMenu *beMenu = new TBeMenu(fBarView); TBarWindow::SetBeMenu(beMenu); fBeMenuItem = new TBarMenuTitle(kBeMenuWidth, Frame().Height(), AppResSet()->FindBitmap(B_MESSAGE_TYPE, R_BeLogoIcon), beMenu, true); AddItem(fBeMenuItem); fSeparatorItem = new TTeamMenuItem(kSepItemWidth, height, fVertical); AddItem(fSeparatorItem); fSeparatorItem->SetEnabled(false); fFirstApp = 2; } else { fBeMenuItem = NULL; fSeparatorItem = NULL; } desk_settings *settings = ((TBarApp *)be_app)->Settings(); if (settings->sortRunningApps) teamList.SortItems(CompareByName); int32 count = teamList.CountItems(); for (int32 i = 0; i < count; i++) { BarTeamInfo *barInfo = (BarTeamInfo *)teamList.ItemAt(i); if ((barInfo->flags & B_BACKGROUND_APP) == 0 && strcasecmp(barInfo->sig, TASK_BAR_MIME_SIG) != 0) { if ((settings->trackerAlwaysFirst) && (strcmp(barInfo->sig, kTrackerSignature)) == 0) { AddItem(new TTeamMenuItem(barInfo->teams, barInfo->icon, barInfo->name, barInfo->sig, width, height, fDrawLabel, fVertical), fFirstApp); } else { AddItem(new TTeamMenuItem(barInfo->teams, barInfo->icon, barInfo->name, barInfo->sig, width, height, fDrawLabel, fVertical)); } barInfo->teams = NULL; barInfo->icon = NULL; barInfo->name = NULL; barInfo->sig = NULL; } delete barInfo; } BMenuBar::AttachedToWindow(); if (fVertical) { sDoMonitor = true; sMonThread = spawn_thread(monitor_team_windows, "Expando Window Watcher", B_LOW_PRIORITY, this); resume_thread(sMonThread); } }
void CServerListView::Add(IRCQuery *pQuery) { AddItem(STI_QUERY,(void *)pQuery); }
void CSitesWnd::AddSiteToList(fsSiteInfo *pSite) { int iItem = AddItem ("", GetSysColor (COLOR_WINDOW), GetSysColor (COLOR_WINDOWTEXT)); SetItemData (iItem, (DWORD)pSite); UpdateSite (pSite); }
//增加一个内容为{keyword, font}的配置(QRichConfigureItem)到配置列表中(QRichConfigureList), //缺少的字体颜色(color)项根据默认配置(defaultItem)的对应项(color)补全 bool QRichConfigureList::AddItem(const QString keyword, const QFont font) { return AddItem(keyword, font, defaultItem.color); }
void PixelInfoListCtrl::AddSurfaceItem( LayerSurface* surf, double* pos, bool bUpdateCount ) { if ( m_bShowSurfaceCoordinates ) { double sf_pos[3]; surf->GetSurfaceRASAtTarget( pos, sf_pos ); wxString strg; strg.Printf( _("[%.2f, %.2f, %.2f]"), sf_pos[0], sf_pos[1], sf_pos[2] ); wxString text = ( AppendSpaceString( _("Coordinate") ) << strg ); AddItem( wxString::FromAscii( surf->GetName() ), text, (long)surf ); } int nVertex = surf->GetVertexIndexAtTarget( pos, NULL ); if ( nVertex < 0 ) { if ( !m_bShowSurfaceCoordinates ) AddItem( wxString::FromAscii( surf->GetName() ), _(""), (long)surf, bUpdateCount ); } else { wxString text = AppendSpaceString( _("Vertex") ); text << nVertex; double ras[3]; surf->GetSurfaceRASAtVertex( nVertex, ras ); wxString strg; strg.Printf( _("[%.2f, %.2f, %.2f]"), ras[0], ras[1], ras[2] ); text = ( AppendSpaceString(text) << strg ); AddItem( ( m_bShowSurfaceCoordinates ? wxString("") : wxString::FromAscii( surf->GetName() ) ), text, (long)surf ); double vec[3]; surf->GetNormalAtVertex( nVertex, vec ); strg.Printf( _("[%.2f, %.2f, %.2f]"), vec[0], vec[1], vec[2] ); text = ( AppendSpaceString( _("Normal") ) << strg ); AddItem( _(""), text ); if ( surf->GetActiveVector() >= 0 ) { surf->GetVectorAtVertex( nVertex, vec ); wxString strg; strg.Printf( _("[%.2f, %.2f, %.2f]"), vec[0], vec[1], vec[2] ); text = ( AppendSpaceString( _("Vector") ) << strg ); AddItem( _(""), text ); } if ( surf->HasCurvature() && m_bShowSurfaceCurvature ) AddItem( _(""), ( AppendSpaceString( _("Curvature") ) << surf->GetCurvatureValue( nVertex ) ), 0, bUpdateCount ); int nOverlays = surf->GetNumberOfOverlays(); for ( int i = 0; i < nOverlays; i++ ) { SurfaceOverlay* overlay = surf->GetOverlay( i ); wxString strg = overlay->GetName(); AddItem( _(""), ( AppendSpaceString( strg ) << overlay->GetDataAtVertex( nVertex ) ), 0, bUpdateCount ); } int nAnnotations = surf->GetNumberOfAnnotations(); for ( int i = 0; i < nAnnotations; i++ ) { SurfaceAnnotation* annot = surf->GetAnnotation( i ); wxString strg = annot->GetName(); AddItem( _(""), ( AppendSpaceString( strg ) << annot->GetAnnotationNameAtVertex( nVertex ).c_str() ), 0, bUpdateCount ); } } }
void TWindowMenu::AttachedToWindow() { SetFont(be_plain_font); RemoveItems(0, CountItems(), true); int32 miniCount = 0; bool dragging = false; TBarView* barview =(static_cast<TBarApp*>(be_app))->BarView(); if (barview && barview->LockLooper()) { // 'dragging' mode set in BarView::CacheDragData // invoke in MouseEnter in ExpandoMenuBar dragging = barview->Dragging(); if (dragging) { // We don't want to show the menu when dragging, but it's not // possible to remove a submenu once it exists, so we simply hide it // Don't call BMenu::Hide(), it causes the menu to pop up every now // and then. Window()->Hide(); // if in expando (horizontal or vertical) if (barview->Expando()) { SetTrackingHook(barview->MenuTrackingHook, barview->GetTrackingHookData()); } barview->DragStart(); } barview->UnlockLooper(); } int32 parentMenuItems = 0; int32 numTeams = fTeam->CountItems(); for (int32 i = 0; i < numTeams; i++) { team_id theTeam = (team_id)fTeam->ItemAt(i); int32 count = 0; int32* tokens = get_token_list(theTeam, &count); for (int32 j = 0; j < count; j++) { client_window_info* wInfo = get_window_info(tokens[j]); if (wInfo == NULL) continue; if (WindowShouldBeListed(wInfo->feel) && (wInfo->show_hide_level <= 0 || wInfo->is_mini)) { // Don't add new items if we're expanded. We've already done // this, they've just been moved. int32 numItems = CountItems(); int32 addIndex = 0; for (; addIndex < numItems; addIndex++) if (strcasecmp(ItemAt(addIndex)->Label(), wInfo->name) > 0) break; if (!fExpanded) { TWindowMenuItem* item = new TWindowMenuItem(wInfo->name, wInfo->server_token, wInfo->is_mini, ((1 << current_workspace()) & wInfo->workspaces) != 0, dragging); // disable app's window dropping for now if (dragging) item->SetEnabled(false); AddItem(item, TWindowMenuItem::InsertIndexFor(this, 0, item)); } else { TTeamMenuItem* parentItem = static_cast<TTeamMenuItem*>(Superitem()); if (parentItem->ExpandedWindowItem(wInfo->server_token)) { TWindowMenuItem* item = parentItem->ExpandedWindowItem( wInfo->server_token); if (item == NULL) continue; item->SetTo(wInfo->name, wInfo->server_token, wInfo->is_mini, ((1 << current_workspace()) & wInfo->workspaces) != 0, dragging); parentMenuItems++; } } if (wInfo->is_mini) miniCount++; } free(wInfo); } free(tokens); } int32 itemCount = CountItems() + parentMenuItems; if (itemCount < 1) { TWindowMenuItem* noWindowsItem = new TWindowMenuItem("No windows", -1, false, false); noWindowsItem->SetEnabled(false); AddItem(noWindowsItem); // if an application has no windows, this feature makes it easy to quit // it. (but we only add this option if the application is not Tracker.) if (fApplicationSignature.ICompare(kTrackerSignature) != 0) { AddSeparatorItem(); AddItem(new TShowHideMenuItem("Quit application", fTeam, B_QUIT_REQUESTED)); } } else { // if we are in drag mode, then don't add the window controls // to the menu if (!dragging) { TShowHideMenuItem* hide = new TShowHideMenuItem("Hide all", fTeam, B_MINIMIZE_WINDOW); TShowHideMenuItem* show = new TShowHideMenuItem("Show all", fTeam, B_BRING_TO_FRONT); TShowHideMenuItem* close = new TShowHideMenuItem("Close all", fTeam, B_QUIT_REQUESTED); if (miniCount == itemCount) hide->SetEnabled(false); else if (miniCount == 0) show->SetEnabled(false); if (!parentMenuItems) AddSeparatorItem(); AddItem(hide); AddItem(show); AddItem(close); } } BMenu::AttachedToWindow(); }
//--------------------------------------------------------------------------- //Add Items void AddItems() { for (int i = 0; i < iItemNum; i++) itmRoot = AddItem(itmRoot, rand() % iWeightRange + 1, rand() % iProfitRange + 1); }
JsonBuilder& AddStrings(const StringList& strings) { for (int i = 0; i < strings.CountItems(); i++) AddItem(strings.ItemAtFast(i)); return *this; }
/* ** Called when tab is displayed. ** */ void CDialogAbout::CTabLog::Initialize() { m_Initialized = true; // Add columns to the list view HWND item = GetDlgItem(m_Window, IDC_ABOUTLOG_ITEMS_LISTVIEW); ListView_SetExtendedListViewStyleEx(item, 0, LVS_EX_LABELTIP | LVS_EX_FULLROWSELECT | LVS_EX_DOUBLEBUFFER); // Set folder/.ini icons for tree list HIMAGELIST hImageList = ImageList_Create(16, 16, ILC_COLOR32, 2, 10); HMODULE hDLL = GetModuleHandle(L"user32"); HICON hIcon = (HICON)LoadImage(hDLL, MAKEINTRESOURCE(103), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); ImageList_AddIcon(hImageList, hIcon); DeleteObject(hIcon); hIcon = (HICON)LoadImage(hDLL, MAKEINTRESOURCE(101), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); ImageList_AddIcon(hImageList, hIcon); DeleteObject(hIcon); hIcon = (HICON)LoadImage(hDLL, MAKEINTRESOURCE(104), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); ImageList_AddIcon(hImageList, hIcon); DeleteObject(hIcon); ListView_SetImageList(item, (WPARAM)hImageList, LVSIL_SMALL); LVCOLUMN lvc; lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM; lvc.fmt = LVCFMT_LEFT; // left-aligned column lvc.iSubItem = 0; lvc.cx = 75; lvc.pszText = GetString(ID_STR_TYPE); ListView_InsertColumn(item, 0, &lvc); lvc.iSubItem = 1; lvc.cx = 85; lvc.pszText = GetString(ID_STR_TIME); ListView_InsertColumn(item, 1, &lvc); lvc.iSubItem = 2; lvc.cx = 370; lvc.pszText = GetString(ID_STR_MESSAGE); ListView_InsertColumn(item, 2, &lvc); // Add stored entires std::list<CRainmeter::LOG_INFO>::const_iterator iter = Rainmeter->GetAboutLogData().begin(); for ( ; iter != Rainmeter->GetAboutLogData().end(); ++iter) { AddItem((*iter).level, (*iter).timestamp.c_str(), (*iter).message.c_str()); } item = GetDlgItem(m_Window, IDC_ABOUTLOG_ERROR_CHECKBOX); Button_SetCheck(item, BST_CHECKED); item = GetDlgItem(m_Window, IDC_ABOUTLOG_WARNING_CHECKBOX); Button_SetCheck(item, BST_CHECKED); item = GetDlgItem(m_Window, IDC_ABOUTLOG_NOTICE_CHECKBOX); Button_SetCheck(item, BST_CHECKED); item = GetDlgItem(m_Window, IDC_ABOUTLOG_DEBUG_CHECKBOX); Button_SetCheck(item, BST_CHECKED); }
int MD5Calc::do_check(FILE *chkf) { int rc, ex = 0, failed = 0, checked = 0; unsigned char chk_digest[16], file_digest[16]; char filename[256]; FILE *fp; unsigned int flen = 14; while ((rc = get_md5_line(chkf, chk_digest, filename)) >= 0) { if (rc == 0) /* not an md5 line */ continue; if(filename[strlen(filename)-1] == '\r' || filename[strlen(filename)-1] == '\n') filename[strlen(filename)-1] = 0; if (verbose) { if (strlen(filename) > flen) flen = strlen(filename); fprintf(stderr, "%-*s ", flen, filename); } if (bin_mode || rc == 2) fp = fopen(filename, FOPRBIN); else fp = fopen(filename, FOPRTXT); if (fp == NULL) { AddItem(filename,chk_digest,file_digest,2); fprintf(stderr, "%s: can't open %s\n", progname, filename); ex = 2; continue; } if (mdfile(fp, file_digest)) { AddItem(filename,chk_digest,file_digest,2); fprintf(stderr, "%s: error reading %s\n", progname, filename); ex = 2; fclose(fp); continue; } fclose(fp); if (memcmp(chk_digest, file_digest, 16) != 0) { AddItem(filename,chk_digest,file_digest, 0); if (verbose) fprintf(stderr, "FAILED\n"); else fprintf(stderr, "%s: MD5 check failed for '%s'\n", progname, filename); ++failed; } else { if (verbose) fprintf(stderr, "OK\n"); AddItem(filename,chk_digest,file_digest,1); } ++checked; } if (verbose && failed) fprintf(stderr, "%s: %d of %d file(s) failed MD5 check\n", progname, failed, checked); if (!checked) { fprintf(stderr, "%s: no files checked\n", progname); return 3; } if (!ex && failed) ex = 1; return ex; }
void Game_Party::RemoveItem(int item_id, int amount) { AddItem(item_id, -amount); }
dword AutoStartPage::OnKey( dword key, dword extKey ) { switch ( key ) { case RKEY_Exit: if ( CanExit() ) Close(); return 0; case RKEY_Mute: // pass Mute to the firmware return key; case RKEY_Menu: { if (menuActivates) { Close(); return key; } Replace(new ConfigPage()); return 0; } case RKEY_PlayList: if ( CanExit() ) Replace(new LoadedTAPPage()); return 0; case RKEY_VolUp: { int index = GetSelectedIndex(); if ( index < (int)m_taps.size()-1 ) { // swap the filenames AutoStartTAP t = m_taps[index]; m_taps[index] = m_taps[index+1]; m_taps[index+1] = t; // move the selection MoveSelection( 1, false ); m_dirty = true; } return 0; } case RKEY_VolDown: { int index = GetSelectedIndex(); if ( index > 0 && index < (int)m_taps.size() ) { // swap the filenames AutoStartTAP t = m_taps[index]; m_taps[index] = m_taps[index-1]; m_taps[index-1] = t; // move the selection MoveSelection( -1, false ); m_dirty = true; } return 0; } case RKEY_NewF1: { // enable/disable TAP int index = GetSelectedIndex(); EnableTAP( index, !m_taps[index].enabled ); return 0; } case RKEY_F2: { int index = GetSelectedIndex(); if ( index < (int)m_taps.size() ) { bool enable = !m_taps[index].enabled; for ( unsigned int i = 0; i < m_taps.size(); ++i ) EnableTAP( i, enable ); } return 0; } // Discard changes case RKEY_Recall: // get rid of the list items, then the DiscardItems(); AddItem(new SimpleTextListItem(this, 0, "", "Loading...")); Draw(); PopulateList(); m_dirty = false; return 0; // Save Changes case RKEY_Record: Save(); Close(); return 0; } ListPage::OnKey( key, extKey ); return 0; }
void FillListView ( void ) { AddItem(IDS_TOOLS_CMD_NAME, IDS_TOOLS_CMD_DESCR, IDS_TOOLS_CMD_CMD, IDS_TOOLS_CMD_PARAM, CSIDL_SYSTEM); AddItem(IDS_TOOLS_REGEDIT_NAME, IDS_TOOLS_REGEDIT_DESCR, IDS_TOOLS_REGEDIT_CMD,IDS_TOOLS_REGEDIT_PARAM, CSIDL_WINDOWS); AddItem(IDS_TOOLS_SYSDM_NAME, IDS_TOOLS_SYSDM_DESCR, IDS_TOOLS_SYSDM_CMD, IDS_TOOLS_SYSDM_PARAM, CSIDL_SYSTEM); AddItem(IDS_TOOLS_INFO_NAME, IDS_TOOLS_INFO_DESCR, IDS_TOOLS_INFO_CMD, IDS_TOOLS_INFO_PARAM, CSIDL_SYSTEM); }
void CPlayerPlaylistBar::AddItem(CString fn, CAtlList<CString>* subs) { CAtlList<CString> sl; sl.AddTail(fn); AddItem(sl, subs); }
//增加一个内容为{keyword, color}的配置(QRichConfigureItem)到配置列表中(QRichConfigureList), //缺少的字体(font)项根据默认配置(defaultItem)的对应项(font)补全 bool QRichConfigureList::AddItem(const QString keyword, const QColor color) { return AddItem(keyword, defaultItem.font, color); }
void CSearchView::OnInitialUpdate() { CFormView::OnInitialUpdate(); // TODO: Add your specialized code here and/or call the base class m_listSearch.m_nType = SEARCHVIEW; // 리스트가 지신의 기능만을 처리할수 있는 타입값 // 접속되어있는 클라이언트의 목록을 추가 m_comboFilter.AddString("전체"); int count = ((CMainFrame *)AfxGetMainWnd())->m_myIOCPSocket.m_nClntCount; char szClntName[256]; char szClntIP[20]; for(int i=0; i<count; i++){ strcpy(szClntName, ((CMainFrame *)AfxGetMainWnd())->m_myIOCPSocket.m_clntSock[i].clntName); strcpy(szClntIP, inet_ntoa(((CMainFrame *)AfxGetMainWnd())->m_myIOCPSocket.m_clntSock[i].pClntData->clntAddr.sin_addr)); sprintf(szClntName, "%s [%s]", szClntName, szClntIP); m_comboFilter.AddString(szClntName); } m_comboFilter.SetCurSel(0); InsertColumn(); // 컬럼 추가 // 처음에 탭내용이 하나도 없으면 탭컨트롤이 안보이게(처음부터 보이면 모양이 이상해짐) if(m_nTabCnt == 0){ m_tabSearch.ShowWindow(FALSE); } CMainFrame *pMain = ((CMainFrame *)AfxGetMainWnd()); pMain->GetSysImgList(m_listSearch, m_imgSmallList); // 시스템아이콘얻기 // 다른메뉴를 선택했다가 다시 이뷰를 선택하면 다시 초기화가 되므로 생성되었던 탭을 생성 if(m_nTabCnt != 0){ UINT cnt = 0; CString strName; // 검색된 파일이름 UINT nFileCnt; // 검색된 파일수 UINT nImage; // 아이콘 이미지 while(cnt != m_nTabCnt){ strName = pMain->m_searchListData[cnt].strSearchListFileName; nFileCnt = pMain->m_searchListData[cnt].nSearchListSize; nImage = 0; if(nFileCnt > 5){ // 검색된게 많으면 아이콘을 바꿈 nImage = 1; } CreateTab(strName, nFileCnt, nImage); // 동적으로 탭추가, 두번째 파라미터로 마지막 생성되는것만 리스트에 데이타를 넣는다 cnt ++; } CString strFileName; // 파일명 UINT nSize; // 파일사이즈 CString strServerName; // 서버이름 CString strServerIP; // 서버아이피 CString strServerInfo; // 서버정보 for(UINT i=0; i<nFileCnt; i++){ // 리스트 내용 strFileName = pMain->m_searchListData[m_nTabCnt - 1].searchListData[i].strFileName; nSize = pMain->m_searchListData[m_nTabCnt - 1].searchListData[i].nByte; strServerName.Format("%s", pMain->m_searchListData[m_nTabCnt - 1].strServerName[i]); // 서버이름 strServerIP.Format("%s", pMain->m_searchListData[m_nTabCnt - 1].strServerIP[i]); // 서버아이피 strServerInfo.Format("%s [%s]", strServerName, strServerIP); AddItem(strFileName, nSize, strServerInfo, FALSE); } } GetDlgItem(IDC_EDIT_SEARCHKEY)->SetFocus(); }
void PixelInfoListCtrl::DoUpdateList() { Reset(); LayerCollection* lc_mri = MainWindow::GetMainWindowPointer()->GetLayerCollection( "MRI" ); LayerCollection* lc_surf = MainWindow::GetMainWindowPointer()->GetLayerCollection( "Surface" ); if ( !lc_mri || !lc_surf ) { // collection does not exist. program must be in exiting process. return; } if ( lc_mri->IsEmpty() && lc_surf->IsEmpty() ) { SetItemCount( 0 ); return; } else AddItem( _("RAS"), _(""), 1, false ); if ( !lc_mri->IsEmpty() ) { LayerMRI* mri = ( LayerMRI* )lc_mri->GetLayer( 0 ); double ras[3]; mri->RemapPositionToRealRAS( m_dRASPosition, ras ); m_listValue[0].Printf( _("%.2f, %.2f, %.2f"), ras[0], ras[1], ras[2] ); int nIndex[3]; std::vector<Layer*> layers = lc_mri->GetLayers(); for ( size_t i = 0; i < layers.size(); i++ ) { if ( layers[i]->GetProperties()->GetShowInfo() ) { ((LayerMRI*)layers[i])->RASToOriginalIndex( ras, nIndex ); // double dvalue = ( (LayerMRI*)layers[i] )->GetVoxelValueByOriginalIndex( nIndex[0], nIndex[1], nIndex[2] ); double dvalue = ( (LayerMRI*)layers[i] )->GetVoxelValue( m_dRASPosition ); wxString coordStrg; if ( m_bShowVoxelCoordinates ) coordStrg.Printf( _("[%d, %d, %d] "), nIndex[0], nIndex[1], nIndex[2] ); wxString labelStrg; if (layers[i]->IsTypeOf("PLabel")) { labelStrg = wxString::FromAscii( ( (LayerPLabel*)layers[i] )->GetLabelName( m_dRASPosition ).c_str() ); } else { labelStrg = wxString::FromAscii( ( (LayerMRI*)layers[i] )->GetLabelName( dvalue ).c_str() ); if ( m_bShowShortName ) labelStrg = GetShortName( labelStrg ); } AddItem( wxString::FromAscii( layers[i]->GetName() ), AppendSpaceString( ( wxString() << dvalue ) ) + coordStrg + _(" ") + labelStrg, (long)layers[i], false ); } } } if ( !lc_surf->IsEmpty() ) { if ( lc_mri->IsEmpty() ) { double ras[3] = { m_dRASPosition[0], m_dRASPosition[1], m_dRASPosition[2] }; // mri->RemapPositionToRealRAS( m_dRASPosition, ras ); m_listValue[0].Printf( _("%.2f, %.2f, %.2f"), ras[0], ras[1], ras[2] ); } std::vector<Layer*> layers = lc_surf->GetLayers(); for ( size_t i = 0; i < layers.size(); i++ ) { if ( layers[i]->GetProperties()->GetShowInfo() ) { LayerSurface* surf = ( LayerSurface* )layers[i]; AddSurfaceItem( surf, m_dRASPosition, false ); } } } SetItemCount( m_listName.Count() ); }
void CSearchView::AddItemSearchFile(char *szOut, UINT clntCnt) { CMainFrame *pMain = ((CMainFrame *)AfxGetMainWnd()); char szClntName[256]; char szClntIP[20]; char szClntInfo[256]; strcpy(szClntName, ((CMainFrame *)AfxGetMainWnd())->m_myIOCPSocket.m_clntSock[clntCnt].clntName); strcpy(szClntIP, inet_ntoa(((CMainFrame *)AfxGetMainWnd())->m_myIOCPSocket.m_clntSock[clntCnt].pClntData->clntAddr.sin_addr)); sprintf(szClntInfo, "%s [%s]", szClntName, szClntIP); ////// 문자열을 쪼개서 처리 UINT cnt; CString strMessage; strMessage.Format("%s", szOut); cnt = strMessage.Find('?', 0); // 여러개의 정보를 쪼갠다 char comCnt[4]; if(cnt == 1){ // 파일가 한자리일때 comCnt[0] = szOut[0]; comCnt[1] = '\0'; }else if(cnt == 2){ // 파일가 두자리일때 comCnt[0] = szOut[0]; comCnt[1] = szOut[1]; comCnt[2] = '\0'; }else if(cnt == 3){ comCnt[0] = szOut[0]; comCnt[1] = szOut[1]; comCnt[2] = szOut[2]; comCnt[3] = '\0'; } MY_SEARCH_FILE searchFile; int oldCnt = 0; for(int i=0; i<atoi(comCnt); i++){ if(m_nSearchFileCnt + 1 > MAX_SEARCH_FILE_COUNT){ CString out; out.Format("%d개 이상의 파일은 검색할수 없습니다!", MAX_SEARCH_FILE_COUNT); AfxMessageBox(out); break; } // 파일명 oldCnt = cnt; cnt = strMessage.Find('?', oldCnt + 1); searchFile.strFileName = strMessage.Mid(oldCnt + 1, cnt - oldCnt - 1); // 파일경로 oldCnt = cnt; cnt = strMessage.Find('?', oldCnt + 1); searchFile.strFilePath = strMessage.Mid(oldCnt + 1, cnt - oldCnt - 1); // 용량 oldCnt = cnt; cnt = strMessage.Find('?', oldCnt + 1); searchFile.nByte = atoi(strMessage.Mid(oldCnt + 1, cnt - oldCnt - 1)); // 검색된파일내용 저장, 검색된 파일명은 OnButtonSearch()서 처리, 검색된수는 AddItem() 에서 처리 pMain->m_searchListData[m_nTabCnt - 1].searchListData[m_nSearchFileCnt] = searchFile; pMain->m_searchListData[m_nTabCnt - 1].strServerName[m_nSearchFileCnt].Format("%s", szClntName); // 서버이름 pMain->m_searchListData[m_nTabCnt - 1].strServerIP[m_nSearchFileCnt].Format("%s", szClntIP); // 서버아이피 AddItem(searchFile.strFileName, searchFile.nByte, szClntInfo, TRUE); } delete szOut; // 보내는 쪽에서 동적으로 생성하므로 delete // 모든컴에서 검색된 파일이 없을때 나와야하는데 하나의 컴이라도 검색된게 없으면 나옴 //if(atoi(comCnt) == 0){ // AfxMessageBox("검색된 파일이 없습니다!"); //} }
void CServerListView::Add(IRCChannel *pChannel) { AddItem(STI_CHANNEL,(void *)pChannel); }
void BDirMenu::Populate(const BEntry* startEntry, BWindow* originatingWindow, bool includeStartEntry, bool select, bool reverse, bool addShortcuts, bool navMenuEntries) { try { if (!startEntry) throw (status_t)B_ERROR; Model model(startEntry); ThrowOnInitCheckError(&model); ModelMenuItem* menu = new ModelMenuItem(&model, this, true, true); if (fMenuBar) fMenuBar->AddItem(menu); BEntry entry(*startEntry); bool showDesktop, showDisksIcon; { TrackerSettings settings; showDesktop = settings.DesktopFilePanelRoot(); showDisksIcon = settings.ShowDisksIcon(); } // might start one level above startEntry if (!includeStartEntry) { BDirectory parent; BDirectory dir(&entry); if (!showDesktop && dir.InitCheck() == B_OK && dir.IsRootDirectory()) { // if we're at the root directory skip "mnt" and // go straight to "/" parent.SetTo("/"); } else entry.GetParent(&parent); parent.GetEntry(&entry); } BDirectory desktopDir; FSGetDeskDir(&desktopDir); BEntry desktopEntry; desktopDir.GetEntry(&desktopEntry); for (;;) { BNode node(&entry); ThrowOnInitCheckError(&node); PoseInfo info; ReadAttrResult result = ReadAttr(&node, kAttrPoseInfo, kAttrPoseInfoForeign, B_RAW_TYPE, 0, &info, sizeof(PoseInfo), &PoseInfo::EndianSwap); BDirectory parent; entry.GetParent(&parent); bool hitRoot = false; BDirectory dir(&entry); if (!showDesktop && dir.InitCheck() == B_OK && dir.IsRootDirectory()) { // if we're at the root directory skip "mnt" and // go straight to "/" hitRoot = true; parent.SetTo("/"); } if (showDesktop) { BEntry root("/"); // warp from "/" to Desktop properly if (entry == root) { if (showDisksIcon) AddDisksIconToMenu(reverse); entry = desktopEntry; } if (entry == desktopEntry) hitRoot = true; } if (result == kReadAttrFailed || !info.fInvisible || (showDesktop && desktopEntry == entry)) { AddItemToDirMenu(&entry, originatingWindow, reverse, addShortcuts, navMenuEntries); } if (hitRoot) { if (!showDesktop && showDisksIcon && *startEntry != "/") AddDisksIconToMenu(reverse); break; } parent.GetEntry(&entry); } // select last item in menu if (!select) return; ModelMenuItem* item = dynamic_cast<ModelMenuItem*>(ItemAt(CountItems() - 1)); if (item) { item->SetMarked(true); if (menu) { entry.SetTo(item->TargetModel()->EntryRef()); ThrowOnError(menu->SetEntry(&entry)); } } } catch (status_t err) { PRINT(("BDirMenu::Populate: caught error %s\n", strerror(err))); if (!CountItems()) { BString error; error << "Error [" << strerror(err) << "] populating menu"; AddItem(new BMenuItem(error.String(), 0)); } } }
void TradeTable_CTP::AddTrade( Trade_Ptr apOrder ) { AddItem(apOrder); }
IPopupMenuItem* IPopupMenu::AddItem(const char* text, int index, int itemFlags) { IPopupMenuItem* item = new IPopupMenuItem (text, itemFlags); return AddItem(item, index); }
STDMETHODIMP cGenericStack::Push(VARIANT vObject) { // TODO: Add your implementation code here AddItem(vObject); return S_OK; }
IPopupMenuItem* IPopupMenu::AddSeparator (int index) { IPopupMenuItem* item = new IPopupMenuItem ("", IPopupMenuItem::kSeparator); return AddItem(item, index); }
std::shared_ptr<Landmark> LandmarkGenerator::GeneratePlayerFarm(int &playerX, int &playerY) { std::uniform_int_distribution<int> grassTuftDistrobution(0, 10000); auto farmName = TextGenerator::GenerateFarmName(); auto result = Landmark::Construct(farmName, MAP_SIZE_WIDTH, MAP_SIZE_HEIGHT); // Generate some random stuff on the ground for (auto y = 0; y < MAP_SIZE_WIDTH; y++) { for (auto x = 0; x < MAP_SIZE_HEIGHT; x++) { if ((x < 2) || (x >= (MAP_SIZE_WIDTH - 2)) || (y < 2) || (y >= (MAP_SIZE_HEIGHT - 2))) { result->SetTile(x, y, TileType::Water); continue; } int n = grassTuftDistrobution(randomGenerator); int permille_chance; if (n <= (permille_chance = 2500)) { result->SetTile(x, y, TileType::GrassTuft); //} else if (n <= (permille_chance += 100)) { // result->SetTile(x, y, TileType::Weed); } else if (n <= (permille_chance += 10)) { result->SetTile(x, y, TileType::Grass); result->AddItem(x, y, GameState::Get().GetItemFromItemDatabase("Birch Log")); //} else if (n <= (permille_chance += 10)) { // result->SetTile(x, y, TileStone); //} else if (n <= (permille_chance += 10)) { // result->SetTile(x, y, TileType::Boulder); //} else if (n <= (permille_chance += 5)) { // result->SetTile(x, y, TileType::Stump); } else if (n <= (permille_chance += 45)) { result->SetTile(x, y, TileType::Grass); result->AddItem(x, y, GameState::Get().GetItemFromItemDatabase("Birch Tree")); } else { result->SetTile(x, y, TileType::Grass); } } } // Generate cottage std::uniform_int_distribution<int> farmPositionDistrobution(10, MAP_SIZE_HEIGHT - 20); auto cottageX = farmPositionDistrobution(randomGenerator); auto cottageY = farmPositionDistrobution(randomGenerator); // Generate the walls and floors for (auto y = 0; y < LANDMARKGENERATOR_DEFAULT_COTTAGE_HEIGHT; y++) { for (auto x = 0; x < LANDMARKGENERATOR_DEFAULT_COTTAGE_WIDTH; x++) { if ((x == 0) || (x == LANDMARKGENERATOR_DEFAULT_COTTAGE_WIDTH - 1) || (y == 0) || (y == LANDMARKGENERATOR_DEFAULT_COTTAGE_HEIGHT - 1)) { result->SetTile(cottageX + x, cottageY + y, TileType::BrickWall); } else { result->SetTile(cottageX + x, cottageY + y, TileType::Stone); } auto prop = result->GetItem(cottageX + x, cottageY + y); if (prop != nullptr) { result->RemoveItem(cottageX + x, cottageY + y); } } } // Place a door result->SetTile(cottageX + (LANDMARKGENERATOR_DEFAULT_COTTAGE_WIDTH / 2), cottageY + LANDMARKGENERATOR_DEFAULT_COTTAGE_HEIGHT - 1, TileType::Stone); // Set the player starting position variables playerX = cottageX + (LANDMARKGENERATOR_DEFAULT_COTTAGE_WIDTH / 2); playerY = cottageY + (LANDMARKGENERATOR_DEFAULT_COTTAGE_HEIGHT / 2); // Add the bed result->AddItem(cottageX + 1, cottageY + 1, GameState::Get().GetItemFromItemDatabase("Simple Bed")); //// Add tools to the ground... result->AddItem(playerX - 3, playerY - 1, GameState::Get().GetItemFromItemDatabase("Simple Hoe")); result->AddItem(playerX - 2, playerY - 1, GameState::Get().GetItemFromItemDatabase("Simple Axe")); //// And some seeds auto cabbageSeeds = GameState::Get().GetItemFromItemDatabase("Cabbage Seed"); cabbageSeeds->SetCount(10); result->AddItem(playerX - 2, playerY + 1, cabbageSeeds); return result; }
bool CDictionary::Merge(CDictionary dict2, int nRatio) //Merge dict2 into current dictionary and the frequency ratio from dict2 and current dict is nRatio { int i,j,k,nCmpValue; char sWord[WORD_MAXLENGTH]; if(m_pModifyTable||dict2.m_pModifyTable) {//Modification made, not to output when modify table exists. return false; } for(i=0;i<CC_NUM;i++) { j=0; k=0; while(j<m_IndexTable[i].nCount&&k<dict2.m_IndexTable[i].nCount) { nCmpValue=strcmp(m_IndexTable[i].pWordItemHead[j].sWord,dict2.m_IndexTable[i].pWordItemHead[k].sWord); if(nCmpValue==0)//Same Words and determine the different handle { if(m_IndexTable[i].pWordItemHead[j].nHandle<dict2.m_IndexTable[i].pWordItemHead[k].nHandle) nCmpValue=-1; else if(m_IndexTable[i].pWordItemHead[j].nHandle>dict2.m_IndexTable[i].pWordItemHead[k].nHandle) nCmpValue=1; } if(nCmpValue==0) { m_IndexTable[i].pWordItemHead[j].nFrequency=(nRatio*m_IndexTable[i].pWordItemHead[j].nFrequency+dict2.m_IndexTable[i].pWordItemHead[k].nFrequency)/(nRatio+1); j+=1; k+=1; } else if(nCmpValue<0)//Get next word in the current dictionary { m_IndexTable[i].pWordItemHead[j].nFrequency=(nRatio*m_IndexTable[i].pWordItemHead[j].nFrequency)/(nRatio+1); j+=1; } else//Get next word in the second dictionary { if(dict2.m_IndexTable[i].pWordItemHead[k].nFrequency>(nRatio+1)/10) { sprintf(sWord,"%c%c%s",CC_CHAR1(i),CC_CHAR2(i),dict2.m_IndexTable[i].pWordItemHead[k].sWord); AddItem(sWord,dict2.m_IndexTable[i].pWordItemHead[k].nHandle,dict2.m_IndexTable[i].pWordItemHead[k].nFrequency/(nRatio+1)); } k+=1; } } while(j<m_IndexTable[i].nCount)//words in current dictionary are left { m_IndexTable[i].pWordItemHead[j].nFrequency=(nRatio*m_IndexTable[i].pWordItemHead[j].nFrequency)/(nRatio+1); j+=1; } while(k<dict2.m_IndexTable[i].nCount)//words in Dict2 are left { if(dict2.m_IndexTable[i].pWordItemHead[k].nFrequency>(nRatio+1)/10) { sprintf(sWord,"%c%c%s",CC_CHAR1(i),CC_CHAR2(i),dict2.m_IndexTable[i].pWordItemHead[k].sWord); AddItem(sWord,dict2.m_IndexTable[i].pWordItemHead[k].nHandle,dict2.m_IndexTable[i].pWordItemHead[k].nFrequency/(nRatio+1)); } k+=1; } } return true; }
void TreeListCtrlTestCase::Create(long style) { m_treelist = new wxTreeListCtrl(wxTheApp->GetTopWindow(), wxID_ANY, wxDefaultPosition, wxSize(400, 200), style); m_treelist->AppendColumn("Component"); m_treelist->AppendColumn("# Files"); m_treelist->AppendColumn("Size"); // Fill the control with the same data as used in the treelist sample: m_code = AddItem("Code"); AddItem("wxMSW", m_code, "313", "3.94 MiB"); AddItem("wxGTK", m_code, "180", "1.66 MiB"); m_code_osx = AddItem("wxOSX", m_code, "265", "2.36 MiB"); AddItem("Core", m_code_osx, "31", "347 KiB"); AddItem("Carbon", m_code_osx, "91", "1.34 MiB"); m_code_osx_cocoa = AddItem("Cocoa", m_code_osx, "46", "512 KiB"); wxTreeListItem Documentation = AddItem("Documentation"); AddItem("HTML", Documentation, "many"); AddItem("CHM", Documentation, "1"); wxTreeListItem Samples = AddItem("Samples"); AddItem("minimal", Samples, "1", "7 KiB"); AddItem("widgets", Samples, "28", "419 KiB"); m_treelist->Refresh(); m_treelist->Update(); }
void CCheatMenu::Render(void) { gInts.Engine->GetScreenSize(ScreenW, ScreenH); int i = 0; i = AddItem(i, "Aimbot", &gCvars.aimbot_switch, 0, 1, 1, true); if (gCvars.aimbot_switch) { i = AddItem(i, " - Enabled", &gCvars.aimbot_active, 0, 1, 1, false); i = AddItem(i, " - Key", &gCvars.aimbot_key, 0, 8, 1, false); i = AddItem(i, " - Hitscan", &gCvars.aimbot_hitscan, 0, 1, 1, false); i = AddItem(i, " - Hitbox", &gCvars.aimbot_hitbox, 0, 18, 1, false); i = AddItem(i, " - Autoshoot", &gCvars.aimbot_autoshoot, 0, 1, 1, false); } i = AddItem(i, "Triggerbot", &gCvars.triggerbot_switch, 0, 1, 1, true); if (gCvars.triggerbot_switch) { i = AddItem(i, " - Enabled", &gCvars.triggerbot_active, 0, 1, 1, false); i = AddItem(i, " - Key", &gCvars.triggerbot_key, 0, 8, 1, false); i = AddItem(i, " - Head Only", &gCvars.triggerbot_headonly, 0, 1, 1, false); } i = AddItem(i, "Player List", &gCvars.playerlist_switch, 0, 1, 1, true); for (int p = 1; p <= gInts.Engine->GetMaxClients(); p++) { if (p == me) continue; CBaseEntity *pPlayer = GetBaseEntity(p); if (pPlayer == NULL) continue; player_info_t pInfo; gInts.Engine->GetPlayerInfo(p, &pInfo); char szString[256]; sprintf(szString, " - %s", pInfo.name); if (gCvars.playerlist_switch) i = AddItem(i, szString, &gCvars.PlayerMode[pPlayer->GetIndex()], 0, 2, 1, false); } i = AddItem(i, "ESP", &gCvars.esp_switch, 0, 1, 1, true); if (gCvars.esp_switch) { i = AddItem(i, " - Enabled", &gCvars.esp_active, 0, 1, 1, false); i = AddItem(i, " - Enemies Only", &gCvars.esp_enemyonly, 0, 1, 1, false); i = AddItem(i, " - Box", &gCvars.esp_box, 0, 1, 1, false); i = AddItem(i, " - Name", &gCvars.esp_name, 0, 1, 1, false); i = AddItem(i, " - Class", &gCvars.esp_class, 0, 1, 1, false); i = AddItem(i, " - Health", &gCvars.esp_health, 0, 3, 1, false); i = AddItem(i, " - Bones", &gCvars.esp_bones, 0, 3, 1, false); } i = AddItem(i, "Settings", &gCvars.settings_switch, 0, 1, 1, true); if (gCvars.settings_switch) { i = AddItem(i, " - Menu Postion X", &gCvars.iMenu_Pos_X, 0, ScreenW, 25, false); i = AddItem(i, " - Menu Postion Y", &gCvars.iMenu_Pos_Y, 0, ScreenH, 25, false); } i = AddItem(i, "Misc", &gCvars.misc_switch, 0, 1, 1, true); if (gCvars.misc_switch) { i = AddItem(i, " - Bunnyhop", &gCvars.misc_bunnyhop, 0, 1, 1, false); i = AddItem(i, " - Autostrafe", &gCvars.misc_autostrafe, 0, 1, 1, false); i = AddItem(i, " - Noisemaker Spam", &gCvars.misc_noisemaker_spam, 0, 1, 1, false); } iMenuItems = i; }