void FMessageLogListingModel::CreateNewPageIfRequired() { if(!PendingPageName.IsEmpty()) { // dont create a new page if the current is empty, just change its name if(CurrentPage().Messages.Num() != 0) { // remove any pages that exceed the max page count while(Pages.Num() >= (int32)MaxPages) { Pages.RemoveNode(Pages.GetTail()); } Pages.AddHead(FPage(PendingPageName)); // invalidate cache as all indices will change CachedPage = NULL; } else { CurrentPage().Title = PendingPageName; } PendingPageName = FText::GetEmpty(); } }
void MainWindow::readValue(int index) { //QWidget *pwidget = stackedWidget->widget(0); if(CurrentPage() == 0) { if((size_t)index >= vecPage1Stamp.size()) index = vecPage1Stamp.size(); //page1index = index; } else { if((size_t)index >= vecPage2Stamp.size()) index = vecPage2Stamp.size(); //page2index = index; }; PVandValue *pPVValue; QHash<QString,CAColorTileButton *>::iterator tileiter; char timebuf[30]; if(CurrentPage() == 0) { epicsTimeToStrftime(timebuf,28,"%m/%d/%Y %H:%M:%S", &(vecPage1Stamp.at(index))); } else { epicsTimeToStrftime(timebuf,28,"%m/%d/%Y %H:%M:%S", &(vecPage2Stamp.at(index))); } qDebug("Index(%d)-SliderValue(%d) --> %s", index,timeSlider->value(), timebuf); currentTimeLabel->setText(timebuf); for(int i = 0; i <= mloop; i++) { if (CurrentPage() == 0) { pPVValue = &(vecPage1Value.at((marraycount*i)+timeSlider->value())); //qDebug("PVName[%d]:%s(%f),%s",i, pPVValue->pvname.c_str(), pPVValue->dvalue, mpage1names.at(i).c_str()); CAColorTileButton *pTileButton = hash_tilepage1[pPVValue->pvname.c_str()]; //qDebug("PVName:%s, Tile(%p)", pTileButton->getPvname().toStdString().c_str(), pTileButton); pTileButton->changeValue(ECA_CONN,pPVValue->dvalue); } else { pPVValue = &(vecPage2Value.at((marraycount*i)+timeSlider->value())); //qDebug("PVName[%d]:%s(%f),%s",i, pPVValue->pvname.c_str(), pPVValue->dvalue, mpage2names.at(i).c_str()); CAColorTileButton *pTileButton = hash_tilepage2[pPVValue->pvname.c_str()]; //qDebug("PVName:%s, Tile(%p)", pTileButton->getPvname().toStdString().c_str(), pTileButton); pTileButton->changeValue(ECA_CONN,pPVValue->dvalue); }; }; };
bool CWizardWindow::GoNext() { bool ok; CPropPage * page = CurrentPage(); if ( abs( (long)page->m_Next ) < 1024 ) ok = GotoPage( m_CurrentPage + (long)page->m_Next, true ); else ok = GotoPage( page->m_Next, true ); return ok; }
void FMessageLogListingModel::AddMessageInternal( const TSharedRef<FTokenizedMessage>& NewMessage ) { CurrentPage().Messages.Add( NewMessage ); const TCHAR* const LogColor = FMessageLog::GetLogColor(NewMessage->GetSeverity()); if(LogColor) { SET_WARN_COLOR(LogColor); } FMsg::Logf(__FILE__, __LINE__, *LogName.ToString(), FMessageLog::GetLogVerbosity(NewMessage->GetSeverity()), TEXT("%s"), *NewMessage->ToText().ToString()); CLEAR_WARN_COLOR(); }
bool CWizardWindow::GoBack() { bool ok; CPropPage * page = CurrentPage(); if ( page->m_Back == NULL ) ok = GotoPage( page->m_Previous, false ); else if ( abs( (long)page->m_Back ) < 1024 ) ok = GotoPage( m_CurrentPage + (long)page->m_Back, false ); else ok = GotoPage( page->m_Back, false ); return ok; }
void MvcController::ConditionallyEnable() { typedef std::vector<wxWindow*>::const_iterator wvci; std::vector<wxWindow*> page_lineage = Lineage(&CurrentPage()); for(wvci i = page_lineage.begin(); i != page_lineage.end(); ++i) { wxWindow* pw = *i; LMI_ASSERT(nullptr != pw); Transferor* t = dynamic_cast<Transferor*>(pw->GetValidator()); if(t) { // INELEGANT !! If this is too slow in practice (because // refreshing item lists is expensive), then perhaps the // enablement state could be cached. ConditionallyEnableControl(t->name(), *pw); ConditionallyEnableItems (t->name(), *pw); // TODO ?? This seems not to belong here, but only because // the calling function needs a different name. // ...and it needs to be done for all controls--see below. // UpdateCircumscription (*pw, t->name()); } else { // Do nothing. Some windows don't have validators--for // example, most static controls. } } // TODO ?? This is ugly. The real problem, as was speculated // above, is that ConditionallyEnableItems() is too slow. It is // necessary to enforce range limits on all tabs--otherwise, // date ranges fail to work, and the observable symptom is quite // spectacular. for(wvci i = lineage_.begin(); i != lineage_.end(); ++i) { wxWindow* pw = *i; LMI_ASSERT(nullptr != pw); Transferor* t = dynamic_cast<Transferor*>(pw->GetValidator()); if(t) { UpdateCircumscription (*pw, t->name()); } else { // Do nothing. Some windows don't have validators--for // example, most static controls. } } }
void FMessageLogListingModel::NewPage( const FText& InTitle, uint32 InMaxPages ) { FMsg::Logf(__FILE__, __LINE__, *LogName.ToString(), ELogVerbosity::Log, TEXT("New page: %s"), *InTitle.ToString()); // store the name of the page we will add if a new message is pushed PendingPageName = InTitle; MaxPages = InMaxPages; // if the current output page has messages, we create a new page now if( CurrentPage().Messages.Num() > 0 ) { CreateNewPageIfRequired(); } }
void MvcController::EnsureOptimalFocus() { wxWindow* f = FindFocus(); if(f && f->IsEnabled() && f->AcceptsFocus()) { return; } SetFocus(); typedef std::vector<wxWindow*>::const_iterator wvci; std::vector<wxWindow*> page_lineage = Lineage(&CurrentPage()); for(wvci i = page_lineage.begin(); i != page_lineage.end(); ++i) { wxWindow* w = *i; if(w && w->IsEnabled() && w->AcceptsFocus()) { w->SetFocus(); break; } } f = FindFocus(); if(!(f && f->IsEnabled())) { #if defined __WXGTK__ // SOMEDAY !! Probably this condition should be used for all // platforms, after adequate testing. if(IsModal()) #endif // defined __WXGTK__ { EndModal(wxID_CANCEL); } fatal_error() << "Dialog cancelled because a disabled or null window (" << NameLabelId(f) << ") improperly had focus." << LMI_FLUSH ; } }
void FMessageLogListingModel::ClearMessages() { CurrentPage().Messages.Empty(); Notify(); }
//---------------------------------------------------------------------- // // GotoPage // // Switch to a specified wizard page // //---------------------------------------------------------------------- bool CWizardWindow::GotoPage( int nPage, bool forward ) { RECT rc; POINT ul, lr; bool isInterior = false; // Make sure page is in range if ( nPage < 0 || nPage >= m_PageCnt ) return false; // Get pointers to current page and new page CPropPage * oldPage = CurrentPage(); CPropPage * newPage = GetPage( nPage ); // Update shared buttons if ( newPage->m_Type == CPropPage::ENTRY ) { // Entry page EnableBack( false ); EnableNext( true ); EnableCancel( true ); } else if ( newPage->m_Type == CPropPage::FINISH ) { // Exit page EnableFinish( true ); EnableCancel( false ); EnableBack( true ); } else { // Interior page isInterior = true; EnableNext( true ); EnableCancel( true ); EnableBack( true ); } // Set forward/backward status on pages newPage->m_Forward = forward; if ( oldPage ) oldPage->m_Forward = forward; // If new window hasn't been created, create it now if ( newPage->GetHwnd() == NULL ) { // Get window position if ( isInterior ) GetWindowRect( GetDlgItem( m_hWnd, IDC_PAGEFRAME ), &rc ); else GetWindowRect( GetDlgItem( m_hWnd, IDC_EXTPAGEFRAME ), &rc ); ul.y = rc.top; ul.x = rc.left; lr.y = rc.bottom; lr.x = rc.right; MapWindowPoints( HWND_DESKTOP, m_hWnd, &ul, 1 ); MapWindowPoints( HWND_DESKTOP, m_hWnd, &lr, 1 ); // create window newPage->m_hWnd = CreateDialogParam( m_hInstance, newPage->m_Template, m_hWnd, CPropPage::DialogProc, (LPARAM)newPage ); // Move window to correct location MoveWindow( newPage->m_hWnd, ul.x, ul.y, lr.x - ul.x, lr.y - ul.y, TRUE ); } // Set window text SetDlgItemText( m_hWnd, IDC_TITLE, newPage->m_HeaderTitle ); SetDlgItemText( m_hWnd, IDC_EXTTITLE, newPage->m_HeaderTitle ); SetDlgItemText( m_hWnd, IDC_SUBTITLE, newPage->m_HeaderSubTitle ); // Show/Hide graphical elements ShowWindow( GetDlgItem( m_hWnd, IDC_UPPERLINE ), isInterior ? SW_SHOW : SW_HIDE ); ShowWindow( GetDlgItem( m_hWnd, IDC_SUBTITLE ), isInterior ? SW_SHOW : SW_HIDE ); ShowWindow( GetDlgItem( m_hWnd, IDC_BANNER ), isInterior ? SW_SHOW : SW_HIDE ); ShowWindow( GetDlgItem( m_hWnd, IDC_TITLE ), isInterior ? SW_SHOW : SW_HIDE ); ShowWindow( GetDlgItem( m_hWnd, IDC_WATERMARK ), isInterior ? SW_HIDE : SW_SHOW ); ShowWindow( GetDlgItem( m_hWnd, IDC_EXTTITLE ), isInterior ? SW_HIDE : SW_SHOW ); // Place white background appropriately if ( isInterior ) { // Header GetWindowRect( GetDlgItem( m_hWnd, IDC_UPPERLINE ), &rc ); lr.x = rc.right; lr.y = rc.bottom - 2; MapWindowPoints( HWND_DESKTOP, m_hWnd, &lr, 1 ); ul.x = 0; ul.y = 0; } else { // Right size GetWindowRect( GetDlgItem( m_hWnd, IDC_EXTPAGEFRAME ), &rc ); ul.x = rc.left; ul.y = rc.top; lr.x = rc.right; lr.y = rc.bottom + 4; MapWindowPoints( HWND_DESKTOP, m_hWnd, &ul, 1 ); MapWindowPoints( HWND_DESKTOP, m_hWnd, &lr, 1 ); ul.y = 0; } SetWindowPos( GetDlgItem(m_hWnd,IDC_WHITEBACKGROUND), HWND_TOP, ul.x, ul.y, lr.x, lr.y, 0 ); // Make new window current. This ensures that if the new window calls us recursively we act relative to it. if ( forward ) newPage->m_Previous = m_CurrentPage; m_CurrentPage = nPage; // Hide old window if ( oldPage != NULL && oldPage->GetHwnd() ) ShowWindow( oldPage->GetHwnd(), SW_HIDE ); // Dispay new window ShowWindow( newPage->GetHwnd(), SW_SHOWNORMAL ); // Set focus to NEXT button, or first control of property page if ( IsWindowEnabled( GetDlgItem( m_hWnd, IDOK ) ) ) SetFocus( GetDlgItem( m_hWnd, IDOK ) ); else SetFocus( GetNextDlgTabItem( m_hWnd, GetDlgItem( m_hWnd, IDCANCEL ), false ) ); return true; }
void MainWindow::getChannelValues() { QDateTime starttime = Start_dateTime->dateTime(); QDateTime endtime = End_dateTime->dateTime(); QString strStartTime = starttime.toString("MM/dd/yyyy hh:mm:ss"); QString strEndTime = endtime.toString("MM/dd/yyyy hh:mm:ss"); #if 1 epicsTime start, end; string2epicsTime(strStartTime.toStdString().c_str(), start); string2epicsTime(strEndTime.toStdString().c_str(), end); struct epicsTimeStamp epicstart_ts = (epicsTimeStamp)start; struct epicsTimeStamp epicend_ts = (epicsTimeStamp)end; qDebug("epicsTimeStamp-Start:sec(%d), nasec(%d)", epicstart_ts.secPastEpoch, epicstart_ts.nsec); qDebug("epicsTimeStamp-End:sec(%d), nasec(%d)", epicend_ts.secPastEpoch, epicend_ts.nsec); double totaltime = epicsTimeDiffInSeconds( &epicend_ts, &epicstart_ts ); int timecount = (int)totaltime; for (size_t i = 0; i < mpage1names.size(); i++) { qDebug("PVName[%d]:%s, time:%f", i, mpage1names.at(i).c_str(), totaltime); } qDebug("KEY(%d),Start(%s), End(%s), Max(%d)", keyindex.at(archiveList->currentIndex()), strStartTime.toStdString().c_str(), strEndTime.toStdString().c_str(), MAX_COUNT); #endif mloop = 0; outstream.open("./data.txt", ios::out); // According timecount, automatically setup interval #if 1 if(CurrentPage() == 0) { vecPage1Value.clear(); vecPage1Stamp.clear(); m_arclient.getValues(keyindex.at(archiveList->currentIndex()), mpage1names, start, end, MAX_COUNT*10, SHEET_TYPE, viewer, this, 1, mloop, marraycount); } else { vecPage2Value.clear(); vecPage2Stamp.clear(); m_arclient.getValues(keyindex.at(archiveList->currentIndex()), mpage2names, start, end, MAX_COUNT*10, SHEET_TYPE, viewer, this, 1, mloop, marraycount); } #endif //Careful Array Index - Count. timeSlider->setMaximum(marraycount-1); //PVcount, Value Array Count #if 1 PVandValue *pPVValue; qDebug("LoopCount:%d, ArrayCount:%d",mloop, marraycount); for(int i = 0; i <= mloop; i++) { if(CurrentPage() == 0) { pPVValue = &(vecPage1Value.at((marraycount*i)+timeSlider->value())); qDebug("PVName[%d]:%s(%f), %s",i, pPVValue->pvname.c_str(), pPVValue->dvalue, mpage1names.at(i).c_str()); outstream << "PVName:" << pPVValue->pvname.c_str()<<"," << mpage1names.at(i).c_str() <<",PVValue: " <<pPVValue->dvalue << endl; } else { pPVValue = &(vecPage2Value.at((marraycount*i)+timeSlider->value())); qDebug("PVName[%d]:%s(%f), %s",i, pPVValue->pvname.c_str(), pPVValue->dvalue, mpage2names.at(i).c_str()); outstream << "PVName:" << pPVValue->pvname.c_str()<<"," << mpage2names.at(i).c_str() <<",PVValue: " <<pPVValue->dvalue << endl; }; }; outstream.close(); #endif timeSlider->setValue(1); }