nsresult nsMsgThreadedDBView::InitSort(nsMsgViewSortTypeValue sortType, nsMsgViewSortOrderValue sortOrder) { if (m_viewFlags & nsMsgViewFlagsType::kGroupBySort) return NS_OK; // nothing to do. if (sortType == nsMsgViewSortType::byThread) { nsMsgDBView::Sort(nsMsgViewSortType::byId, sortOrder); // sort top level threads by id. m_sortType = nsMsgViewSortType::byThread; m_viewFlags |= nsMsgViewFlagsType::kThreadedDisplay; m_viewFlags &= ~nsMsgViewFlagsType::kGroupBySort; SetViewFlags(m_viewFlags); // persist the view flags. // m_db->SetSortInfo(m_sortType, sortOrder); } // else // m_viewFlags &= ~nsMsgViewFlagsType::kThreadedDisplay; // by default, the unread only view should have all threads expanded. if ((m_viewFlags & (nsMsgViewFlagsType::kUnreadOnly|nsMsgViewFlagsType::kExpandAll)) && (m_viewFlags & nsMsgViewFlagsType::kThreadedDisplay)) ExpandAll(); if (! (m_viewFlags & nsMsgViewFlagsType::kThreadedDisplay)) ExpandAll(); // for now, expand all and do a flat sort. Sort(sortType, sortOrder); if (sortType != nsMsgViewSortType::byThread) // forget prev view, since it has everything expanded. ClearPrevIdArray(); return NS_OK; }
// This takes a string and uses it to set the expanded or // collapsed state of the tree items. int CStatisticsTree::ApplyExpandedMask(CString theMask, HTREEITEM theItem, int theStringIndex) { HTREEITEM hCurrent; if (theItem == NULL) { hCurrent = GetRootItem(); SetRedraw(false); ExpandAll(true); m_bExpandingAll = true; } else hCurrent = theItem; while (hCurrent != NULL && theStringIndex < theMask.GetLength()) { if (ItemHasChildren(hCurrent) && IsBold(hCurrent)) { if (theMask.GetAt(theStringIndex) == '0') Expand(hCurrent, TVE_COLLAPSE); theStringIndex++; theStringIndex = ApplyExpandedMask(theMask, GetChildItem(hCurrent), theStringIndex); } hCurrent = GetNextItem(hCurrent, TVGN_NEXT); } if (theItem == NULL) { SetRedraw(true); m_bExpandingAll = true; } return theStringIndex; }
void PHPOutlineTree::BuildTree(const wxFileName& filename) { m_filename = filename; PHPSourceFile sourceFile(filename, NULL); sourceFile.SetParseFunctionBody(false); sourceFile.Parse(); wxWindowUpdateLocker locker(this); DeleteAllItems(); wxTreeItemId root = AddRoot(wxT("Root")); wxImageList* images = new wxImageList(clGetScaledSize(16), clGetScaledSize(16), true); images->Add(m_manager->GetStdIcons()->LoadBitmap(wxT("cc/16/globals"))); // 0 images->Add(m_manager->GetStdIcons()->LoadBitmap(wxT("cc/16/function_private"))); // 1 images->Add(m_manager->GetStdIcons()->LoadBitmap(wxT("cc/16/function_protected"))); // 2 images->Add(m_manager->GetStdIcons()->LoadBitmap(wxT("cc/16/function_public"))); // 3 images->Add(m_manager->GetStdIcons()->LoadBitmap(wxT("cc/16/member_private"))); // 4 images->Add(m_manager->GetStdIcons()->LoadBitmap(wxT("cc/16/member_protected"))); // 5 images->Add(m_manager->GetStdIcons()->LoadBitmap(wxT("cc/16/member_public"))); // 6 images->Add(m_manager->GetStdIcons()->LoadBitmap(wxT("cc/16/namespace"))); // 7 images->Add(m_manager->GetStdIcons()->LoadBitmap(wxT("cc/16/class"))); // 8 images->Add(m_manager->GetStdIcons()->LoadBitmap(wxT("cc/16/enumerator"))); // 9 AssignImageList(images); // Build the tree view BuildTree(root, sourceFile.Namespace()); if(HasChildren(GetRootItem())) { ExpandAll(); } }
void MemCheckOutputView::OnExpandAll(wxCommandEvent& event) { // CL_DEBUG1(PLUGIN_PREFIX("MemCheckOutputView::OnExpandAll()")); m_notebookOutputView->ChangeSelection(m_notebookOutputView->FindPage(m_panelErrors)); // not implemented in wxDVC :( // m_dataViewCtrlErrors->ExpandAll(); ExpandAll(wxDataViewItem(0)); }
void MemCheckOutputView::ExpandAll(const wxDataViewItem& item) { // CL_DEBUG1(PLUGIN_PREFIX("MemCheckOutputView::ExpandAll()")); m_dataViewCtrlErrors->Expand(item); wxDataViewItemArray subItems; m_dataViewCtrlErrorsModel->GetChildren(item, subItems); for(wxDataViewItemArray::iterator it = subItems.begin(); it != subItems.end(); ++it) { ExpandAll(*it); } }
/** * Method to expand all of the nodes beneath the input node. * * @param root Base node for the expansion. */ void DecoratedTree::ExpandAll(wxTreeItemId root) { //long cookie; wxTreeItemIdValue cookie; wxTreeItemId current = GetFirstChild(root, cookie); while (current > (wxTreeItemId)0) { Expand(current); ExpandAll(current); current = GetNextChild(root, cookie); } }
void wxSpinTreeCtrl::addToTree(spin::ReferencedNode *n, wxTreeItemId parentID) { Freeze(); std::string strLabel = n->nodeType + " : " + n->id->s_name; wxSpinTreeItemData *treeData = new wxSpinTreeItemData; treeData->m_pNode = n; wxTreeItemId id = AppendItem(parentID, wxString(strLabel.c_str(),wxConvUTF8), -1, -1, treeData); UpdateTreeItemIcon(id); Thaw(); ExpandAll(); }
void wxSpinTreeCtrl::BuildTree(osg::Node* pRoot) { Freeze(); DeleteAllItems(); if (pRoot) { wxTreeItemId rootID = AddRoot(wxT("world")); m_pSceneTreeVisitor->SetParentTreeItem(&rootID); pRoot->accept(*m_pSceneTreeVisitor.get()); } Thaw(); ExpandAll(); }
bool MusikPrefsDialog::ExpandAll(const wxTreeItemId & root) { tcPreferencesTree->Expand(root); if(tcPreferencesTree->ItemHasChildren(root)) { wxTreeItemIdValue cookie; wxTreeItemId child = tcPreferencesTree->GetFirstChild(root,cookie); while(child.IsOk()) { if(ExpandAll(child) == false) return false; child = tcPreferencesTree->GetNextChild(root,cookie); } } return true; }
void PHPOutlineTree::BuildTree(const wxFileName& filename) { m_filename = filename; PHPSourceFile sourceFile(filename, NULL); sourceFile.SetParseFunctionBody(false); sourceFile.Parse(); wxWindowUpdateLocker locker(this); DeleteAllItems(); wxTreeItemId root = AddRoot(wxT("Root")); // Build the tree view BuildTree(root, sourceFile.Namespace()); if(HasChildren(GetRootItem())) { ExpandAll(); } }
void BFBackupTree::Init () { lastItemId_ = wxTreeItemId(); Freeze(); // recreate the treeCtrl with all tasks BFBackup::Instance().InitThat(this); // expand all items in the treeCtlr ExpandAll(); if ( lastItemId_.IsOk() ) SelectItem(lastItemId_); else SelectItem(GetRootItem()); Thaw(); }
void EditTOC::ConnectSignalsToSlots() { connect(this, SIGNAL(accepted()), this, SLOT(Save())); connect(ui.AddEntryAbove, SIGNAL(clicked()), this, SLOT(AddEntryAbove())); connect(ui.AddEntryBelow, SIGNAL(clicked()), this, SLOT(AddEntryBelow())); connect(ui.DeleteEntry, SIGNAL(clicked()), this, SLOT(DeleteEntry())); connect(ui.MoveLeft, SIGNAL(clicked()), this, SLOT(MoveLeft())); connect(ui.MoveRight, SIGNAL(clicked()), this, SLOT(MoveRight())); connect(ui.MoveUp, SIGNAL(clicked()), this, SLOT(MoveUp())); connect(ui.MoveDown, SIGNAL(clicked()), this, SLOT(MoveDown())); connect(m_MoveUp, SIGNAL(triggered()), this, SLOT(MoveUp())); connect(m_MoveDown, SIGNAL(triggered()), this, SLOT(MoveDown())); connect(ui.SelectTarget, SIGNAL(clicked()), this, SLOT(SelectTarget())); connect(ui.TOCTree, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(OpenContextMenu(const QPoint &))); connect(m_Rename, SIGNAL(triggered()), this, SLOT(Rename())); connect(m_Delete, SIGNAL(triggered()), this, SLOT(DeleteEntry())); connect(m_CollapseAll, SIGNAL(triggered()), this, SLOT(CollapseAll())); connect(m_ExpandAll, SIGNAL(triggered()), this, SLOT(ExpandAll())); }
void CGroupList::RestoreVisGroupExpandStates() { ExpandAll(); for ( int i = 0; i < GetGroupPairCount(); i++ ) { GroupListPair thisPair = m_GroupPairs.Element( i ); HTREEITEM thisItem = FindVisGroupItem( thisPair.pVisGroup ); if ( thisItem ) { if ( thisPair.bExpanded ) { Expand(thisItem, TVE_EXPAND); } else { Expand( thisItem, TVE_COLLAPSE ); } } } }
void PHPFileLayoutTree::Construct() { // Sanity if(!m_editor || !m_manager) return; wxString text = m_editor->GetTextRange(0, m_editor->GetLength()); PHPSourceFile source(text); source.SetParseFunctionBody(false); source.SetFilename(m_editor->GetFileName()); source.Parse(); DeleteAllItems(); wxTreeItemId root = AddRoot(wxT("Root")); wxImageList* images = new wxImageList(16, 16, true); images->Add(m_manager->GetStdIcons()->LoadBitmap(wxT("cc/16/globals"))); // 0 images->Add(m_manager->GetStdIcons()->LoadBitmap(wxT("cc/16/function_private"))); // 1 images->Add(m_manager->GetStdIcons()->LoadBitmap(wxT("cc/16/function_protected"))); // 2 images->Add(m_manager->GetStdIcons()->LoadBitmap(wxT("cc/16/function_public"))); // 3 images->Add(m_manager->GetStdIcons()->LoadBitmap(wxT("cc/16/member_private"))); // 4 images->Add(m_manager->GetStdIcons()->LoadBitmap(wxT("cc/16/member_protected"))); // 5 images->Add(m_manager->GetStdIcons()->LoadBitmap(wxT("cc/16/member_public"))); // 6 images->Add(m_manager->GetStdIcons()->LoadBitmap(wxT("cc/16/namespace"))); // 7 images->Add(m_manager->GetStdIcons()->LoadBitmap(wxT("cc/16/class"))); // 8 images->Add(m_manager->GetStdIcons()->LoadBitmap(wxT("cc/16/enumerator"))); // 9 AssignImageList(images); // Build the tree view BuildTree(root, source.Namespace()); if(HasChildren(GetRootItem())) { wxTreeItemIdValue cookie; wxTreeItemId child = GetFirstChild(GetRootItem(), cookie); if(child.IsOk()) { SelectItem(child); ScrollTo(child); } ExpandAll(); } }
void InfoTreeCtrl::SetInfo(TileWay *ways) { if (m_canvas) { m_canvas->SelectWay(NULL); } DeleteAllItems(); wxTreeItemId root = AddRoot(wxT("this node is a member of:")); for (TileWay *w = ways; w ; w = static_cast<TileWay *>(w->m_next)) { wxTreeItemId wayId = AddWay(root, w->m_way); for (OsmRelationList *rl = w->m_way->m_relations; rl; rl = (OsmRelationList *)(rl->m_next)) { AddRelation(wayId, rl->m_relation); } } ExpandAll(); }
// Expand all the tree sections. Recursive. // Can also expand only bold items (Main Sections) void CStatisticsTree::ExpandAll(bool onlyBold, HTREEITEM theItem) { HTREEITEM hCurrent; if (theItem == NULL) { if (onlyBold) CollapseAll(); hCurrent = GetRootItem(); m_bExpandingAll = true; } else hCurrent = theItem; while (hCurrent != NULL) { if (ItemHasChildren(hCurrent) && (!onlyBold || IsBold(hCurrent))) { Expand(hCurrent, TVE_EXPAND); ExpandAll(onlyBold, GetChildItem(hCurrent)); } hCurrent = GetNextItem(hCurrent, TVGN_NEXT); } if (theItem == NULL) m_bExpandingAll = false; }
/** * Method to expand all of the tree nodes */ void DecoratedTree::ExpandAll(void) { wxTreeItemId root = GetRootItem(); ExpandAll(root); }
NS_IMETHODIMP nsMsgThreadedDBView::Sort(nsMsgViewSortTypeValue sortType, nsMsgViewSortOrderValue sortOrder) { nsresult rv; PRInt32 rowCountBeforeSort = GetSize(); if (!rowCountBeforeSort) { // still need to setup our flags even when no articles - bug 98183. m_sortType = sortType; if (sortType == nsMsgViewSortType::byThread && ! (m_viewFlags & nsMsgViewFlagsType::kThreadedDisplay)) SetViewFlags(m_viewFlags | nsMsgViewFlagsType::kThreadedDisplay); SaveSortInfo(sortType, sortOrder); return NS_OK; } // sort threads by sort order bool sortThreads = m_viewFlags & (nsMsgViewFlagsType::kThreadedDisplay | nsMsgViewFlagsType::kGroupBySort); // if sort type is by thread, and we're already threaded, change sort type to byId if (sortType == nsMsgViewSortType::byThread && (m_viewFlags & nsMsgViewFlagsType::kThreadedDisplay) != 0) sortType = nsMsgViewSortType::byId; nsMsgKey preservedKey; nsAutoTArray<nsMsgKey, 1> preservedSelection; SaveAndClearSelection(&preservedKey, preservedSelection); // if the client wants us to forget our cached id arrays, they // should build a new view. If this isn't good enough, we // need a method to do that. if (sortType != m_sortType || !m_sortValid || sortThreads) { SaveSortInfo(sortType, sortOrder); if (sortType == nsMsgViewSortType::byThread) { m_sortType = sortType; m_viewFlags |= nsMsgViewFlagsType::kThreadedDisplay; m_viewFlags &= nsMsgViewFlagsType::kGroupBySort; if ( m_havePrevView) { // restore saved id array and flags array m_keys = m_prevKeys; m_flags = m_prevFlags; m_levels = m_prevLevels; m_sortValid = true; // the sort may have changed the number of rows // before we restore the selection, tell the tree // do this before we call restore selection // this is safe when there is no selection. rv = AdjustRowCount(rowCountBeforeSort, GetSize()); RestoreSelection(preservedKey, preservedSelection); if (mTree) mTree->Invalidate(); return NS_OK; } else { // set sort info in anticipation of what Init will do. InitThreadedView(nsnull); // build up thread list. if (sortOrder != nsMsgViewSortOrder::ascending) Sort(sortType, sortOrder); // the sort may have changed the number of rows // before we update the selection, tell the tree // do this before we call restore selection // this is safe when there is no selection. rv = AdjustRowCount(rowCountBeforeSort, GetSize()); RestoreSelection(preservedKey, preservedSelection); if (mTree) mTree->Invalidate(); return NS_OK; } } else if (sortType != nsMsgViewSortType::byThread && (m_sortType == nsMsgViewSortType::byThread || sortThreads)/* && !m_havePrevView*/) { if (sortThreads) { SortThreads(sortType, sortOrder); sortType = nsMsgViewSortType::byThread; // hack so base class won't do anything } else { // going from SortByThread to non-thread sort - must build new key, level,and flags arrays m_prevKeys = m_keys; m_prevFlags = m_flags; m_prevLevels = m_levels; // do this before we sort, so that we'll use the cheap method // of expanding. m_viewFlags &= ~(nsMsgViewFlagsType::kThreadedDisplay | nsMsgViewFlagsType::kGroupBySort); ExpandAll(); // m_idArray.RemoveAll(); // m_flags.Clear(); m_havePrevView = true; } } } else if (m_sortOrder != sortOrder)// check for toggling the sort { nsMsgDBView::Sort(sortType, sortOrder); } if (!sortThreads) { // call the base class in case we're not sorting by thread rv = nsMsgDBView::Sort(sortType, sortOrder); SaveSortInfo(sortType, sortOrder); } // the sort may have changed the number of rows // before we restore the selection, tell the tree // do this before we call restore selection // this is safe when there is no selection. rv = AdjustRowCount(rowCountBeforeSort, GetSize()); RestoreSelection(preservedKey, preservedSelection); if (mTree) mTree->Invalidate(); NS_ENSURE_SUCCESS(rv,rv); return NS_OK; }
bool wxSTEditorTreeCtrl::HandleMenuEvent(wxCommandEvent &event) { int win_id = event.GetId(); wxTreeItemId id = GetSelection(); wxSTETreeItemData* data = NULL; if (id) data = (wxSTETreeItemData*)GetItemData(id); switch (win_id) { case ID_STT_FILE_OPEN : { if (id) { wxTreeEvent treeEvent(wxEVT_COMMAND_TREE_ITEM_ACTIVATED, this, id); OnTreeCtrl(treeEvent); } return true; } case ID_STT_FILE_CLOSE : { if (id && m_steNotebook && data) { m_steNotebook->ClosePage(data->m_page_num, true); } return true; } case ID_STT_FILE_PROPERTIES : { if (id && m_steNotebook && data && data->m_notePage) { wxSTEditor* editor = wxDynamicCast(data->m_notePage, wxSTEditor); if (!editor && wxDynamicCast(data->m_notePage, wxSTEditorSplitter)) editor = wxDynamicCast(data->m_notePage, wxSTEditorSplitter)->GetEditor(); if (editor) editor->ShowPropertiesDialog(); } return true; } case ID_STT_EXPAND_ALL : { ExpandAll(); return true; } case ID_STT_COLLAPSE_ALL : { // Can't CollapseAll() if root node is hidden. wxTreeItemIdValue cookie; wxTreeItemId rootId = GetRootItem(); wxTreeItemId childId = GetFirstChild(rootId, cookie); for (; childId; childId = GetNextChild(rootId, cookie)) { CollapseAllChildren(childId); } return true; } case ID_STT_SHOW_FILENAME_ONLY : case ID_STT_SHOW_FILEPATH_ONLY : case ID_STT_SHOW_PATH_THEN_FILENAME : case ID_STT_SHOW_ALL_PATHS : { SetDisplayType((FileDisplay_Type)(win_id-ID_STT_SHOW_FILENAME_ONLY)); return true; } } return false; }
MusikPrefsDialog::MusikPrefsDialog( wxWindow *pParent, const wxString &sTitle ) :wxDialog( pParent, -1, sTitle, wxDefaultPosition, wxSize(750,700), wxDEFAULT_FRAME_STYLE|wxRESIZE_BORDER|wxCAPTION | wxTAB_TRAVERSAL | wxFRAME_FLOAT_ON_PARENT | wxFRAME_NO_TASKBAR ) ,m_pCurrentPanel(NULL) { //---------------// //--- colours ---// //---------------// // static wxColour cBtnFace = wxSystemSettings::GetColour( wxSYS_COLOUR_3DFACE ); // this->SetBackgroundColour ( cBtnFace ); //------------// //--- icon ---// //------------// #if defined (__WXMSW__) SetIcon( wxICON( musicbox ) ); #endif //------------------------------// //--- Selection Tree Control ---// //------------------------------// tcPreferencesTree = new wxTreeCtrl( this, MUSIK_PREFERENCES_TREE, wxDefaultPosition, wxSize(-1,-1), wxTR_HAS_BUTTONS | wxSIMPLE_BORDER ); //--- root nodes ---// wxTreeItemId nRootID = tcPreferencesTree->AddRoot ( _( "Preferences" ) ); wxTreeItemId nOptionsRootID = tcPreferencesTree->AppendItem ( nRootID, _( "Options" ) ); wxTreeItemId nTagRootID = tcPreferencesTree->AppendItem ( nRootID, _( "Tagging" ) ); wxTreeItemId nSoundRootID = tcPreferencesTree->AppendItem ( nRootID, _( "Sound" ) ); wxTreeItemId nStreamingRootID = tcPreferencesTree->AppendItem ( nRootID, _( "Streaming" ) ); wxTreeItemId nMiscellaneousRootID = tcPreferencesTree->AppendItem ( nRootID, _( "Miscellaneous " ) ); //--- child nodes ---// //----------------------// //--- System Buttons ---// //----------------------// wxButton* btnCancel = new wxButton_NoFlicker( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize ); wxButton* btnApply = new wxButton_NoFlicker( this, wxID_APPLY, _("Apply"), wxDefaultPosition, wxDefaultSize ); wxButton* btnOK = new wxButton_NoFlicker( this, wxID_OK, _("OK"), wxDefaultPosition, wxDefaultSize ); //----------------------------// //--- System Buttons Sizer ---// //----------------------------// wxBoxSizer *hsSysButtons = new wxBoxSizer( wxHORIZONTAL ); hsSysButtons->Add( btnCancel, 0, wxALIGN_LEFT ); hsSysButtons->Add( -1,-1, 1, wxEXPAND ); hsSysButtons->Add( btnApply, 0, wxALIGN_RIGHT ); hsSysButtons->Add( btnOK, 0, wxALIGN_RIGHT | wxLEFT, 4); //-------------------------// //--- Hide / Show Sizer ---// //-------------------------// wxBoxSizer *hsSplitter = new wxBoxSizer( wxHORIZONTAL ); wxBoxSizer *vsRight = new wxBoxSizer( wxVERTICAL ); m_sizerPanels = new wxBoxSizer( wxVERTICAL ); hsSplitter->Add( tcPreferencesTree, 1, wxEXPAND | wxRIGHT, 8 ); hsSplitter->Add( vsRight, 3 ,wxEXPAND|wxALL,5); wxPanel *HeaderPanel = new wxPanel(this,-1,wxDefaultPosition,wxSize(-1,40),wxBORDER); HeaderPanel->SetBackgroundColour ( wxSystemSettings::GetColour( wxSYS_COLOUR_HIGHLIGHT ) ); m_stPanelHeader = new wxStaticText(HeaderPanel,-1,wxEmptyString); wxBoxSizer *hsHeaderPanel = new wxBoxSizer( wxHORIZONTAL ); hsHeaderPanel->Add( m_stPanelHeader,1,wxALIGN_CENTER_VERTICAL|wxLEFT,10); HeaderPanel->SetSizer(hsHeaderPanel); wxFont f = m_stPanelHeader->GetFont(); f.SetPointSize(f.GetPointSize() * 2); f.SetWeight(wxBOLD); m_stPanelHeader->SetFont(f); vsRight->Add(HeaderPanel,0,wxEXPAND|wxALL,5); vsRight->Add(m_sizerPanels,1,wxEXPAND|wxALL,10); AddPanel(nOptionsRootID,new OptionGeneralPanel(this)); AddPanel(nOptionsRootID,new OptionSelectionsPanel(this)); AddPanel(nOptionsRootID,new OptionPlaylistPanel(this)); AddPanel(nOptionsRootID,new OptionFileAssocPanel(this)); AddPanel(nOptionsRootID,new OptionTunagePanel(this)); AddPanel(nOptionsRootID,new OptionAutoDJPanel(this)); AddPanel(nTagRootID,new TaggingGeneralPanel(this)); AddPanel(nTagRootID,new TaggingAutoRenamePanel(this)); AddPanel(nSoundRootID,new SoundDriverPanel(this)); AddPanel(nSoundRootID,new SoundCrossfaderPanel(this)); AddPanel(nStreamingRootID,new StreamingBufferPanel(this)); AddPanel(nStreamingRootID,new StreamingProxyServerPanel(this)); AddPanel(nMiscellaneousRootID,new WebServerPanel(this)); //--- expand all the root nodes ---// ExpandAll( tcPreferencesTree->GetRootItem() ); //-----------------// //--- Top Sizer ---// //-----------------// wxBoxSizer *vsTopSizer = new wxBoxSizer( wxVERTICAL ); vsTopSizer->Add( hsSplitter, 1, wxEXPAND | wxALL, 2 ); vsTopSizer->Add( hsSysButtons, 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 2 ); SetSizer( vsTopSizer ); //--------------// //--- Layout ---// //--------------// Centre(); //--------------------// //--- Set Defaults ---// //--------------------// SelectFirstPanel(); Layout(); }
// Process context menu items... BOOL CStatisticsTree::OnCommand(WPARAM wParam, LPARAM /*lParam*/) { switch (wParam) { case MP_STATTREE_RESET: { if(AfxMessageBox(GetResString(IDS_STATS_MBRESET_TXT), MB_YESNO | MB_ICONEXCLAMATION) == IDNO) break; thePrefs.ResetCumulativeStatistics(); AddLogLine(false, GetResString(IDS_STATS_NFORESET)); theApp.emuledlg->statisticswnd->ShowStatistics(); CString myBuffer; myBuffer.Format(GetResString(IDS_STATS_LASTRESETSTATIC), thePrefs.GetStatsLastResetStr(false)); GetParent()->GetDlgItem(IDC_STATIC_LASTRESET)->SetWindowText(myBuffer); break; } case MP_STATTREE_RESTORE: { if (AfxMessageBox(GetResString(IDS_STATS_MBRESTORE_TXT), MB_YESNO | MB_ICONQUESTION) == IDNO) break; if(!thePrefs.LoadStats(1)) LogError(LOG_STATUSBAR, GetResString(IDS_ERR_NOSTATBKUP)); else { AddLogLine(false, GetResString(IDS_STATS_NFOLOADEDBKUP)); CString myBuffer; myBuffer.Format(GetResString(IDS_STATS_LASTRESETSTATIC), thePrefs.GetStatsLastResetStr(false)); GetParent()->GetDlgItem(IDC_STATIC_LASTRESET)->SetWindowText(myBuffer); } break; } case MP_STATTREE_EXPANDMAIN: { SetRedraw(false); ExpandAll(true); goto lblSaveExpanded; } case MP_STATTREE_EXPANDALL: { SetRedraw(false); ExpandAll(); goto lblSaveExpanded; } case MP_STATTREE_COLLAPSEALL: { SetRedraw(false); CollapseAll(); lblSaveExpanded: thePrefs.SetExpandedTreeItems(GetExpandedMask()); SetRedraw(true); break; } case MP_STATTREE_COPYSEL: case MP_STATTREE_COPYVIS: case MP_STATTREE_COPYALL: { CopyText(wParam); break; } case MP_STATTREE_HTMLCOPYSEL: case MP_STATTREE_HTMLCOPYVIS: case MP_STATTREE_HTMLCOPYALL: { CopyHTML(wParam); break; } case MP_STATTREE_HTMLEXPORT: { ExportHTML(); break; } } return true; }