void Notebook::OpenFile(const wxString& fn) { wxFileName w(fn); w.Normalize(); wxString filename = w.GetFullPath(); // set page focus Pages::iterator found = pages.find(filename); if(found != pages.end()) { int page_index = GetPageIndex(found->second); if(page_index != wxNOT_FOUND) { SetSelection(page_index); } } // add new page and set focus else { Edit* edit = new Edit(this); edit->LoadFile(filename); edit->SelectNone(); Freeze(); AddPage(edit, w.GetFullName()); Thaw(); pages[filename] = edit; int page_index = GetPageIndex(edit); if(page_index != wxNOT_FOUND) { SetSelection(page_index); } } }
moExplorerNotebook::moExplorerNotebook( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : wxAuiNotebook(parent, id, wxPoint(0,0), wxSize(100,100), wxBORDER_NONE | wxSP_NOBORDER | wxNO_BORDER | wxAUI_NB_SCROLL_BUTTONS ), m_pVisualsPaletteCtrl(NULL), m_pProjectTreeCtrl(NULL), m_pEffectsPaletteCtrl(NULL), m_pFilesTreeCtrl(NULL) { SetArtProvider( new wxMoAuiTabArt() ); wxColour m_cForeground(255,255,255); wxColour m_cBackground(0,0,0); ///arbol de la configuracion del proyecto m_pProjectTreeCtrl = new moProjectTreeCtrl( this, wxID_ANY, wxPoint(0,0), wxSize(300,377), wxTR_DEFAULT_STYLE | wxNO_BORDER | wxBORDER_NONE); if (m_pProjectTreeCtrl) { m_pProjectTreeCtrl->SetNextActionHandler( this ); m_pProjectTreeCtrl->SetForegroundColour(m_cForeground); m_pProjectTreeCtrl->SetBackgroundColour(m_cBackground); if ( AddPage( m_pProjectTreeCtrl, wxT("Project") ) ) { SetPageBitmap( GetPageIndex( m_pProjectTreeCtrl ), wxBitmap(wxImage(_T("../../art/icons/ontology_16.png"))) ); } } /// paleta de efectos para agregar //m_pEffectsPaletteCtrl = new moEffectsPaletteCtrl( this, wxID_ANY ); if (m_pEffectsPaletteCtrl) { m_pEffectsPaletteCtrl->SetNextActionHandler( this ); m_pEffectsPaletteCtrl->SetForegroundColour(m_cForeground); m_pEffectsPaletteCtrl->SetBackgroundColour(m_cBackground); if (AddPage( m_pEffectsPaletteCtrl, wxT("FX Palette") ) ) { SetPageBitmap( GetPageIndex( m_pEffectsPaletteCtrl ), wxBitmap(wxImage(_T("../../art/icons/rdf_16.png"))) ); } } ///visuales ( texturas, videos, animados, bufferes circulares, etc... ) //m_pVisualsPaletteCtrl = new moVisualsPaletteCtrl(this, wxID_ANY ); if (m_pVisualsPaletteCtrl) { m_pVisualsPaletteCtrl->SetNextActionHandler( this ); m_pVisualsPaletteCtrl->SetForegroundColour(m_cForeground); m_pVisualsPaletteCtrl->SetBackgroundColour(m_cBackground); if (AddPage( m_pVisualsPaletteCtrl, wxT("Visuals") ) ) { SetPageBitmap( GetPageIndex( m_pVisualsPaletteCtrl ), wxBitmap(wxImage(_T("../../art/icons/image_16.png"))) ); } } ///arbol de archivos en el directorio de datos m_pFilesTreeCtrl = new wxVirtualDirTreeCtrl( this, wxID_ANY, wxPoint(0,0), wxSize(300,377),wxTR_DEFAULT_STYLE | wxNO_BORDER | wxBORDER_NONE ); if (m_pFilesTreeCtrl) { m_pFilesTreeCtrl->SetForegroundColour(m_cForeground); m_pFilesTreeCtrl->SetBackgroundColour(m_cBackground); if (AddPage( m_pFilesTreeCtrl, wxT("Files") ) ) { SetPageBitmap( GetPageIndex( m_pFilesTreeCtrl ), wxBitmap(wxImage(_T("../../art/icons/folder_sans_16.png"))) ); } } }
void Notebook::setActivePage(PageType page) { switch (page) { case PAGE_INFO: SetSelection(GetPageIndex(mInfo)); break; case PAGE_EXPLORER: SetSelection(GetPageIndex(mExplorer)); break; case PAGE_LIBRARY: SetSelection(GetPageIndex(mLibrary)); break; case PAGE_PROPERTIES: SetSelection(GetPageIndex(mProperties)); break; case PAGE_TOOLS: SetSelection(GetPageIndex(mTools)); break; } }
void moLogNotebook::LogError( moText p_message ) { if (m_pLogBase) { m_pLogBase->LogError( p_message ); } if (m_pLogError) { m_pLogError->LogError( p_message ); } if (GetSelection()!=GetPageIndex(m_pLogError)) SetSelection(GetPageIndex(m_pLogError)); }
bool InfoPane::DeleteLogger(Logger* l) { if (!l) { return false; } for(int i = 0; i < num_pages; ++i) { if(page[i].logger == l) { int index = Manager::Get()->GetLogManager()->FindIndex(l); if (index != -1) { Manager::Get()->GetLogManager()->DeleteLog(index); } if (page[i].indexInNB != -1) { DeletePage(GetPageIndex(page[i].window)); } page[i] = Page(); return true; } } return false; }
/*-------------------------------------------------------------------- FUNCTION: OnSelChanged(NMHDR* pNotifyStruct, LRESULT* pResult); RETURNS: PURPOSE: --------------------------------------------------------------------*/ void CTreePropertySheet::OnSelChanged( NMHDR* pNotifyStruct, LRESULT* pResult) { NMTREEVIEW *pNotify=(NMTREEVIEW*)pNotifyStruct; (*pResult) =0; int dwPage=m_cTreeCtrl.GetItemData(pNotify->itemNew.hItem); LockWindowUpdate(); if (GetPageIndex(GetActivePage()) != dwPage) // NJG { /* Theming has these nice fades inbetween controls being disabled and enabled. * That is all nice and well, but switching a page for the _first_ time since * the dialog had been opened causes the dialog controls to be updated in plain * sight - a rather visible and eye-catching affair once you are aware of it. * Updating the dialog controls manually before switching to the active page * causes these updates to be done while the user cannot see it. -JW */ GetPage(dwPage)->UpdateDialogControls(this, false); SetActivePage(dwPage); } UnlockWindowUpdate(); // Prevent losing the focus when invoked by keyboard if(pNotify->action==TVC_BYKEYBOARD) m_cTreeCtrl.SetFocus(); InvalidateRect(NULL, FALSE); /* invalidate entire control for redraw -JW */ }
// Advances the selection, generation page selection events void SLNotebook::AdvanceSelection(bool forward) { if (GetPageCount() <= 1) return; int currentSelection = GetSelection(); wxAuiTabCtrl* tabCtrl = 0; int idx = -1; if(!FindTab(GetPage(currentSelection), &tabCtrl, &idx)) return; if(!tabCtrl || idx < 0) return; wxWindow* page = 0; size_t maxPages = tabCtrl->GetPageCount(); forward?idx++:idx--; if(idx < 0) idx = maxPages - 1; if ((size_t)idx < maxPages) page = tabCtrl->GetPage(idx).window; if (!page && maxPages > 0) page = tabCtrl->GetPage(0).window; if(page) { currentSelection = GetPageIndex(page); SetSelection(currentSelection); } }
BOOL CConvertWizardSheet::PreTranslateMessage(MSG* pMsg) { PGPBoolean weProcessed = FALSE; PGPUInt8 vCode; PGPUInt32 activeIndex, randomIndex; switch (pMsg->message) { case WM_KEYDOWN: vCode = pMsg->wParam & 0x7F; activeIndex = GetActiveIndex(); randomIndex = GetPageIndex(&mRandomDataPage); if ((activeIndex == randomIndex) && !mRandomDataPage.mIsDoneCollecting) { // Punt key messages down for random data collection. mRandomDataPage.PostMessage(pMsg->message, pMsg->wParam, pMsg->lParam); weProcessed = TRUE; } break; } return (weProcessed ? TRUE : CPropertySheet::PreTranslateMessage(pMsg)); }
int COptionSheet::GetActiveIndex() const { if(NULL == m_CurrentPage) { return -1; } return GetPageIndex(m_CurrentPage); }
//-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ void Notebook::hidePage(wxWindow* _pWindow) { int pageIndex = GetPageIndex(_pWindow); if (pageIndex != wxNOT_FOUND) { RemovePage(pageIndex); } }
BOOL CRtsSettingsWizDlg::OnCommand(WPARAM wParam, LPARAM lParam) { if ((LOWORD(wParam) == IDOK) || (LOWORD(wParam) == IDCANCEL)) { // Store the last open page to a variable, for later storage g_iCurPropertyPage = GetPageIndex(GetActivePage()); } return CPropertySheet::OnCommand(wParam, lParam); }
//*************************************************************************************** void CBCGPropertySheet::OnActivatePage (CPropertyPage* pPage) { ASSERT_VALID (this); ASSERT_VALID (pPage); if (m_wndOutlookBar.GetSafeHwnd () != NULL) { if (m_nActivePage >= 0) { m_wndOutlookBar.SetButtonStyle (m_nActivePage, 0); } int nPage = GetPageIndex (pPage); ASSERT (nPage >= 0); m_nActivePage = nPage; PostMessage (UM_AFTERACTIVATEPAGE); } if (m_wndTree.GetSafeHwnd () != NULL) { CBCGPropertyPage* pBCGPropPage = DYNAMIC_DOWNCAST (CBCGPropertyPage, pPage); if (pBCGPropPage != NULL) { if (!m_bIsInSelectTree) { m_wndTree.SelectItem (pBCGPropPage->m_hTreeNode); } m_wndTree.EnsureVisible (pBCGPropPage->m_hTreeNode); } } if (m_wndTab.GetSafeHwnd () != NULL) { const int nTab = GetPageIndex (pPage); m_wndTab.SetActiveTab (nTab); m_wndTab.EnsureVisible (nTab); } }
BOOL CMyPropertySheet::OnCommand(WPARAM wParam, LPARAM lParam) { if (LOWORD(wParam) == IDOK) { CMDIFrameWnd* pframe = (CMDIFrameWnd*) AfxGetMainWnd(); CMDIChildWnd* pchild = pframe->MDIGetActive(); CPSheetDoc* doc = (CPSheetDoc*) pchild->GetActiveDocument(); doc->m_LastActivePage = GetPageIndex(GetActivePage()); // or GetActiveIndex() } return CPropertySheet::OnCommand(wParam, lParam); }
void InfoPane::Show(size_t i) { if(page[i].window == 0) return; if(page[i].indexInNB == -1) { Toggle(i); } else { SetSelection(GetPageIndex(page[i].window)); } }
//-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ void Notebook::showPage(wxWindow* _pWindow) { int pageIndex = GetPageIndex(_pWindow); if (pageIndex != wxNOT_FOUND) { SetSelection(pageIndex); } else { const size_t pageCount = GetPageCount(); AddPage(_pWindow, _pWindow->GetLabel()); SetSelection(pageCount); } }
void InfoPane::Toggle(size_t i) { if(page[i].indexInNB == -1) page[i].indexInNB = AddPagePrivate(page[i].window, page[i].title, page[i].icon); else { // Hide the window, otherwise the controls remain partly visible on some windows-versions // if we toggle the active logger if(page[i].window) { page[i].window->Hide(); } RemovePage(GetPageIndex(page[i].window)); page[i].indexInNB = -1; } }
bool Notebook::DoNavigate() { if ( !m_popupWin && GetPageCount() > 1) { m_popupWin = new NotebookNavDialog( this ); m_popupWin->ShowModal(); wxWindow *page = m_popupWin->GetSelection(); m_popupWin->Destroy(); m_popupWin = NULL; SetSelection( GetPageIndex(page), true ); return true; } return false; }
//**************************************************************************************** void CBCGPropertySheet::RemovePage(CPropertyPage* pPage) { int nPage = GetPageIndex (pPage); ASSERT (nPage >= 0); CPropertySheet::RemovePage (pPage); if (m_wndOutlookBar.GetSafeHwnd () != NULL) { m_wndOutlookBar.RemoveButton (nPage); } if (m_wndTree.GetSafeHwnd () != NULL) { ASSERT (FALSE); } }
void InfoPane::ShowNonLogger(wxWindow* p) { for(int i = 0; i < num_pages; ++i) { if(page[i].window == p) { if(page[i].indexInNB == -1) { Toggle(i); } else { SetSelection(GetPageIndex(p)); } return; } } }
void InfoPane::Show(Logger* logger) { for(int i = 0; i < num_pages; ++i) { if(page[i].logger == logger) { if(page[i].indexInNB == -1) { Toggle(i); } else { SetSelection(GetPageIndex(page[i].window)); } return; } } }
//-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ void Notebook::showPage(I_View& _view) { // TODO This should call getWindow() from I_View instead of assuming // _view is a View. View* const pView = dynamic_cast<View*>(&_view); const int pageIndex = GetPageIndex(pView); if (pageIndex != wxNOT_FOUND) { SetSelection(pageIndex); } else { const size_t pageCount = GetPageCount(); AddPage(pView, pView->GetLabel()); SetSelection(pageCount); } }
bool InfoPane::RemoveNonLogger(wxWindow* p) { for(int i = 0; i < num_pages; ++i) { if(page[i].window == p) { if(page[i].islogger) { cbThrow(_T("Bad API usage. Shame on you.")); } RemovePage(GetPageIndex(page[i].window)); page[i] = Page(); return true; } } return false; }
void CFrmPreferences::OnRestoreDefault() { CPropertyPage* pActivePage = GetActivePage(); int indexPage = GetPageIndex(pActivePage); switch(indexPage) { case 0: ((CPreCalPag*)pActivePage)->DoDefaultSetting(); break; case 1: ((CPreDrawPag*)pActivePage)->DoDefaultSetting(); break; case 2: ((CPrePointPag*)pActivePage)->DoDefaultSetting(); break; case 3: ((CPreStylePag*)pActivePage)->DoDefaultSetting(); break; default: break; }; }
SWindow * STabCtrl::GetPage( LPCTSTR pszName,BOOL bTitle/*=TRUE*/ ) { int iPage = GetPageIndex(pszName,bTitle); if(iPage == -1) return NULL; return m_lstPages[iPage]; }
BOOL CPropertyPageHost::EnsurePageCreated(const CPropertyPage* pPage) { return EnsurePageCreated(GetPageIndex(pPage)); }
//--------------------------------------------------------------------------------------- int ContentWindow::get_canvas_index(Canvas* pCanvas) { return GetPageIndex(pCanvas); }
BOOL STabCtrl::SetCurSel( LPCTSTR pszName,BOOL bTitle/*=TRUE */) { int iPage = GetPageIndex(pszName,bTitle); if(iPage == -1) return FALSE; return SetCurSel(iPage); }