void ECThread::Stop() { ECThreadStatus oldStatus = m_nStatus; m_nStatus = ECThreadStatus_Stop; if(ECThreadStatus_Stop == oldStatus) return; else if(ECThreadStatus_Init == oldStatus) m_sigInit.Send(); else if (ECThreadStatus_Pause == oldStatus) m_sigPause.Send(); else if(ECThreadStatus_Run == oldStatus) m_semMsgSignal.SendSIGNAL(); m_semStoped.WaitSIGNAL(); ClearMsg(); }
void KICAD_MANAGER_FRAME::LoadProject( const wxFileName& aProjectFileName ) { // The project file should be valid by the time we get here or something has gone wrong. if( !aProjectFileName.Exists() ) return; // Any open KIFACE's must be closed if they are not part of the new project. // (We never want a KIWAY_PLAYER open on a KIWAY that isn't in the same project.) // User is prompted here to close those KIWAY_PLAYERs: if( !Kiway().PlayersClose( false ) ) return; SetTitle( wxString( "KiCad " ) + GetBuildVersion() ); // Save the project file for the currently loaded project. if( m_active_project ) Prj().ConfigLoad( PgmTop().SysSearch(), GeneralGroupName, s_KicadManagerParams ); m_active_project = true; ClearMsg(); SetProjectFileName( aProjectFileName.GetFullPath() ); Prj().ConfigLoad( PgmTop().SysSearch(), GeneralGroupName, s_KicadManagerParams ); wxString title = GetTitle() + " " + aProjectFileName.GetFullPath(); if( !aProjectFileName.IsDirWritable() ) title += _( " [Read Only]" ); else SetMruPath( Prj().GetProjectPath() ); // Only set MRU path if we have write access. Why? SetTitle( title ); UpdateFileHistory( aProjectFileName.GetFullPath(), &PgmTop().GetFileHistory() ); m_LeftWin->ReCreateTreePrj(); // Rebuild the list of watched paths. // however this is possible only when the main loop event handler is running, // so we use it to run the rebuild function. wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED, ID_INIT_WATCHED_PATHS ); wxPostEvent( this, cmd ); PrintPrjInfo(); }
/* -------------------------------------------------------------------------------- Function name : void WiFiInit(void) Author : Description : Input : Return : History: <author> <time> <version> desc: ORG -------------------------------------------------------------------------------- */ void WiFiInit(void *pArg) { //系统初始化 WifiLDOBak = ScuLDOSet(SCU_LDO_30); PMU_EnterModule(PMU_MAX); //SDIO初始化 ModuleOverlay(MODULE_ID_WIFI_SCAN, MODULE_OVERLAY_ALL); __user_initial_stackheap(); if (SDIO_Module_Init()) { SendMsg(MSG_WIFI_SCAN_ERR); SendMsg(MSG_WIFI_SDIO_ERR); return; } //WIFI驱动初始化 ClearMsg(MSG_WIFI_SCAN); bss_descriptor_info_init(); SetScanEventOpen(TRUE);//set dirver enable receive the scan result event. SendMsg(MSG_WIFI_SCAN_START); pbuf_init(); }
void KICAD_MANAGER_FRAME::CreateNewProject( const wxString& aPrjFullFileName, bool aTemplateSelector = false ) { wxFileName newProjectName = aPrjFullFileName; wxChar sep[2] = { SEP(), 0 }; // nul terminated separator wxChar string. ClearMsg(); // If we are creating a project from a template, make sure the template directory is sane if( aTemplateSelector ) { DIALOG_TEMPLATE_SELECTOR* ps = new DIALOG_TEMPLATE_SELECTOR( this ); wxFileName templatePath; wxString envStr; #ifndef __WXMAC__ wxGetEnv( wxT( "KICAD" ), &envStr ); // Add a new tab for system templates if( !envStr.empty() ) { // user may or may not have including terminating separator. if( !envStr.EndsWith( sep ) ) envStr += sep; templatePath = envStr + wxT( "template" ) + sep; } else { // The standard path should be in the share directory for kicad. As // it is normal on Windows to only have the share directory and not // the kicad sub-directory we fall back to that if the directory // doesn't exist templatePath = wxPathOnly( wxStandardPaths::Get().GetExecutablePath() ) + sep + wxT( ".." ) + sep + wxT( "share" ) + sep + wxT( "kicad" ) + sep + wxT( "template" ) + sep; if( !wxDirExists( templatePath.GetFullPath() ) ) { templatePath = wxPathOnly( wxStandardPaths::Get().GetExecutablePath() ) + sep + wxT( ".." ) + sep + wxT( "share" ) + sep + wxT( "template" ) + sep; } } #else // Use what is provided in the bundle data dir templatePath = GetOSXKicadDataDir() + sep + wxT( "template" ); #endif ps->AddTemplatesPage( _( "System Templates" ), templatePath ); // Add a new tab for user templates wxFileName userPath = wxStandardPaths::Get().GetDocumentsDir() + sep + wxT( "kicad" ) + sep + wxT( "template" ) + sep; ps->AddTemplatesPage( _( "User Templates" ), userPath ); // Check to see if a custom template location is available and setup a // new selection tab if there is. envStr.clear(); wxGetEnv( wxT( "KICAD_PTEMPLATES" ), &envStr ); if( !envStr.empty() ) { if( !envStr.EndsWith( sep ) ) envStr += sep; wxFileName envPath = envStr; ps->AddTemplatesPage( _( "Portable Templates" ), envPath ); } // Show the project template selector dialog int result = ps->ShowModal(); if( ( result != wxID_OK ) || ( ps->GetSelectedTemplate() == NULL ) ) { if( ps->GetSelectedTemplate() == NULL ) { wxMessageBox( _( "No project template was selected. Cannot generate new " "project." ), _( "Error" ), wxOK | wxICON_ERROR, this ); } } else { // The selected template widget contains the template we're attempting to use to // create a project if( !ps->GetSelectedTemplate()->CreateProject( newProjectName ) ) { wxMessageBox( _( "Problem whilst creating new project from template!" ), _( "Template Error" ), wxOK | wxICON_ERROR, this ); } } } // Init project filename SetProjectFileName( newProjectName.GetFullPath() ); // Write settings to project file // was: wxGetApp().WriteProjectConfig( aPrjFullFileName, GeneralGroupName, s_KicadManagerParams ); Prj().ConfigSave( Pgm().SysSearch(), GeneralGroupName, s_KicadManagerParams ); // Ensure a "stub" for a schematic root sheet and a board exist. // It will avoid messages from the schematic editor or the board editor to create a new file // And forces the user to create main files under the right name for the project manager wxFileName fn( newProjectName.GetFullPath() ); fn.SetExt( SchematicFileExtension ); // If a <project>.sch file does not exist, create a "stub" file if( !fn.FileExists() ) { wxFile file( fn.GetFullPath(), wxFile::write ); if( file.IsOpened() ) file.Write( wxT( "EESchema Schematic File Version 2\n" ) ); // wxFile dtor will close the file } // If a <project>.kicad_pcb or <project>.brd file does not exist, // create a .kicad_pcb "stub" file fn.SetExt( KiCadPcbFileExtension ); wxFileName leg_fn( fn ); leg_fn.SetExt( LegacyPcbFileExtension ); if( !fn.FileExists() && !leg_fn.FileExists() ) { wxFile file( fn.GetFullPath(), wxFile::write ); if( file.IsOpened() ) file.Write( wxT( "(kicad_pcb (version 4) (host kicad \"dummy file\") )\n" ) ); // wxFile dtor will close the file } // Enable the toolbar and menubar buttons and clear the help text. m_active_project = true; m_MessagesBox->Clear(); }
void KICAD_MANAGER_FRAME::OnLoadProject( wxCommandEvent& event ) { // Any open KIFACE's must be closed if they are not part of the new project. // (We never want a KIWAY_PLAYER open on a KIWAY that isn't in the same project.) // User is prompted here to close those KIWAY_PLAYERs: if( !Kiway.PlayersClose( false ) ) return; // evt_id can be one of: // ID_NEW_PROJECT, ID_NEW_PROJECT_FROM_TEMPLATE, ID_LOAD_PROJECT, and // wxID_ANY from 3 different places. int evt_id = event.GetId(); wxString title; ClearMsg(); bool newProject = ( evt_id == ID_NEW_PROJECT ) || ( evt_id == ID_NEW_PROJECT_FROM_TEMPLATE ); if( evt_id != wxID_ANY ) { int style; if( newProject ) { title = _( "Create New Project" ); style = wxFD_SAVE | wxFD_OVERWRITE_PROMPT; } else { title = _( "Open Existing Project" ); style = wxFD_OPEN | wxFD_FILE_MUST_EXIST; } wxString default_dir = GetMruPath(); wxFileDialog dlg( this, title, default_dir, wxEmptyString, ProjectFileWildcard, style ); if( dlg.ShowModal() == wxID_CANCEL ) return; //DBG( printf( "%s: wxFileDialog::GetPath=%s\n", __func__, TO_UTF8( dlg.GetPath() ) );) wxFileName pro( dlg.GetPath() ); pro.SetExt( ProjectFileExtension ); // enforce extension if( !pro.IsAbsolute() ) pro.MakeAbsolute(); if( newProject ) { // Check if the project directory is empty wxDir directory( pro.GetPath() ); if( directory.HasFiles() ) { wxString msg = _( "The selected directory is not empty. We recommend you " "create projects in their own clean directory.\n\nDo you " "want to create a new empty directory for the project?" ); if( IsOK( this, msg ) ) { // Append a new directory with the same name of the project file // and try to create it pro.AppendDir( pro.GetName() ); if( !wxMkdir( pro.GetPath() ) ) // There was a problem, undo pro.RemoveLastDir(); } } if( evt_id == ID_NEW_PROJECT ) { CreateNewProject( pro.GetFullPath() ); } else if( evt_id == ID_NEW_PROJECT_FROM_TEMPLATE ) { // Launch the template selector dialog CreateNewProject( pro.GetFullPath(), true ); } } SetProjectFileName( pro.GetFullPath() ); } wxString prj_filename = GetProjectFileName(); wxString nameless_prj = NAMELESS_PROJECT wxT( ".pro" ); wxLogDebug( wxT( "%s: %s" ), GetChars( wxFileName( prj_filename ).GetFullName() ), GetChars( nameless_prj ) ); // Check if project file exists and if it is not noname.pro if( !wxFileExists( prj_filename ) && !wxFileName( prj_filename ).GetFullName().IsSameAs( nameless_prj ) ) { wxString msg = wxString::Format( _( "KiCad project file '%s' not found" ), GetChars( prj_filename ) ); DisplayError( this, msg ); return; } // Either this is the first time kicad has been run or one of the projects in the // history list is no longer valid. This prevents kicad from automatically creating // a noname.pro file in the same folder as the kicad binary. if( wxFileName( prj_filename ).GetFullName().IsSameAs( nameless_prj ) && !newProject ) { m_active_project = false; m_MessagesBox->SetValue( _( "To proceed, you can use the File menu to start a new project." ) ); return; } else { m_active_project = true; m_MessagesBox->Clear(); } Prj().ConfigLoad( Pgm().SysSearch(), GeneralGroupName, s_KicadManagerParams ); title = wxT( "KiCad " ) + GetBuildVersion() + wxT( ' ' ) + prj_filename; if( !wxFileName( prj_filename ).IsDirWritable() ) title += _( " [Read Only]" ); else SetMruPath( Prj().GetProjectPath() ); // Only set MRU path if we have write access. SetTitle( title ); if( !prj_filename.IsSameAs( nameless_prj ) ) UpdateFileHistory( prj_filename, &Pgm().GetFileHistory() ); m_LeftWin->ReCreateTreePrj(); // Rebuild the list of watched paths. // however this is possible only when the main loop event handler is running, // so we use it to run the rebuild function. wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED, ID_INIT_WATCHED_PATHS ); wxPostEvent( this, cmd ); PrintPrjInfo(); }
void ChatItem::init() { Num =0; //所有成员变量进行初始化 Send_UdpSocket = new QUdpSocket(this); Chat_Widget = new QWidget; Chat_Layout = new QVBoxLayout; Chat_Widget->setLayout(Chat_Layout); Status = new QLabel(this); Name= new QLabel(this); PS= new QLabel(this); Chat_ScrollArea = new QScrollArea(this); Chat_TextEdit = new QTextEdit(this); Send_PushButton =new QPushButton(this); Expression_PushButton =new QPushButton(this); File_PushButton = new QPushButton(this); Camera_PushButton = new QPushButton(this); Clear_PushButton = new QPushButton(this); Close_PushButton = new QPushButton(this); ScrollBar=Chat_ScrollArea->verticalScrollBar(); Chat_ScrollArea->setWidget(Chat_Widget); //设置控件位置 Chat_Widget->setGeometry(0,0,600,60); Name->setGeometry(20,10,80,30); Status->setGeometry(110,15,50,20); PS->setGeometry(30,40,200,20); Chat_ScrollArea->setGeometry(10,60,600,270); Chat_ScrollArea->setMinimumSize(600,270); Chat_TextEdit->setGeometry(10,380,450,90); Expression_PushButton->setGeometry(10,340,30,30); File_PushButton->setGeometry(60,340,30,30); Camera_PushButton->setGeometry(110,340,30,30); Clear_PushButton->setGeometry(160,340,30,30); Close_PushButton->setGeometry(560,10,20,20); Send_PushButton->setGeometry(480,420,100,50); //设置控件样式表 Name->setStyleSheet("font-size:18pt;color:white;"); Status->setStyleSheet("font-size:12pt;color:red;"); PS->setStyleSheet("font-size:15pt;color:white;"); Chat_ScrollArea->setStyleSheet("QWidget{background-color: rgba(255, 255, 255, 0);}QScrollArea{background-color: rgba(255, 255, 255, 59);}"); Chat_TextEdit->setStyleSheet("background-color: rgba(255, 255, 255, 59);"); Send_PushButton->setStyleSheet( "QPushButton{color: white;font: bold 13pt;border:none;min-height: 24px;min-width: 60px;border-image: url(:/images/images/button-login.svg);}QPushButton:hover{color: lightgray; border-image: url(:/images/images/button-login-hover.svg);}QPushButton:pressed {color: lightgray;border-image: url(:/images/images/button-login-press.svg);padding-top: -15px;padding-bottom: -17px;}" ); Expression_PushButton->setStyleSheet("QPushButton{border:none;}"); File_PushButton->setStyleSheet("QPushButton{border:none;}"); Camera_PushButton->setStyleSheet("QPushButton{border:none;}"); Clear_PushButton->setStyleSheet("QPushButton{border:none;}"); Close_PushButton->setStyleSheet("QPushButton{border-image: url(:/images/images/button-quit.svg); border:none; } QPushButton:hover{border:none;border-image: url(:/images/images/button-quit.svg);} QPushButton:pressed{border:none;border-image: url(:/images/images/button-quit.svg);}"); Close_PushButton->setFocusPolicy(Qt::NoFocus); Expression_PushButton->setFocusPolicy(Qt::NoFocus); File_PushButton->setFocusPolicy(Qt::NoFocus); Camera_PushButton->setFocusPolicy(Qt::NoFocus); Clear_PushButton->setFocusPolicy(Qt::NoFocus); Send_PushButton->setFocusPolicy(Qt::NoFocus); Send_PushButton->setText("发送"); Expression_PushButton->setIcon(QIcon("face.ico")); Expression_PushButton->setIconSize(QSize(30,30)); File_PushButton->setIcon(QIcon("file.ico")); File_PushButton->setIconSize(QSize(30,30)); Camera_PushButton->setIcon(QIcon("camera.ico")); Camera_PushButton->setIconSize(QSize(30,30)); Clear_PushButton->setIcon(QIcon("clear.ico")); Clear_PushButton->setIconSize(QSize(30,30)); //滚动条初始化 Chat_ScrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); Chat_ScrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); //槽链接 connect(Send_PushButton,SIGNAL(clicked()),this, SLOT(SendMessage())); connect(Close_PushButton,SIGNAL(clicked()),this,SLOT(Close())); connect(File_PushButton,SIGNAL(clicked()),this,SLOT(FileTransferWindow())); connect(Clear_PushButton,SIGNAL(clicked()),this,SLOT(ClearMsg())); }
void KICAD_MANAGER_FRAME::OnImportEagleFiles( wxCommandEvent& event ) { // Close other windows. if( !Kiway().PlayersClose( false ) ) return; wxString title = _( "Import Eagle Project Files" ); int style = wxFD_OPEN | wxFD_FILE_MUST_EXIST; wxString default_dir = GetMruPath(); ClearMsg(); wxFileDialog schdlg( this, title, default_dir, wxEmptyString, EagleFilesWildcard(), style ); if( schdlg.ShowModal() == wxID_CANCEL ) return; wxFileName sch( schdlg.GetPath() ); sch.SetExt( SchematicFileExtension ); wxFileName pro = sch; pro.SetExt( ProjectFileExtension ); wxString protitle = _( "KiCad Project Destination" ); // Don't use wxFileDialog here. On GTK builds, the default path is returned unless a // file is actually selected. wxDirDialog prodlg( this, protitle, pro.GetPath(), wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST ); if( prodlg.ShowModal() == wxID_CANCEL ) return; pro.SetPath( prodlg.GetPath() ); // Check if the project directory is empty wxDir directory( pro.GetPath() ); if( directory.HasFiles() ) { wxString msg = _( "The selected directory is not empty. We recommend you " "create projects in their own clean directory.\n\nDo you " "want to create a new empty directory for the project?" ); KIDIALOG dlg( this, msg, _( "Confirmation" ), wxYES_NO | wxICON_WARNING ); dlg.DoNotShowCheckbox( __FILE__, __LINE__ ); if( dlg.ShowModal() == wxID_YES ) { // Append a new directory with the same name of the project file // and try to create it pro.AppendDir( pro.GetName() ); if( !wxMkdir( pro.GetPath() ) ) // There was a problem, undo pro.RemoveLastDir(); } } wxFileName pcb( sch ); pro.SetExt( ProjectFileExtension ); // enforce extension pcb.SetExt( LegacyPcbFileExtension ); // enforce extension if( !pro.IsAbsolute() ) pro.MakeAbsolute(); SetProjectFileName( pro.GetFullPath() ); wxString prj_filename = GetProjectFileName(); if( sch.FileExists() ) { KIWAY_PLAYER* schframe = Kiway().Player( FRAME_SCH, false ); if( !schframe ) { try // SCH frame was not available, try to start it { schframe = Kiway().Player( FRAME_SCH, true ); } catch( const IO_ERROR& err ) { wxMessageBox( _( "Eeschema failed to load:\n" ) + err.What(), _( "KiCad Error" ), wxOK | wxICON_ERROR, this ); return; } } std::string packet = StrPrintf( "%d\n%s", SCH_IO_MGR::SCH_EAGLE, TO_UTF8( sch.GetFullPath() ) ); schframe->Kiway().ExpressMail( FRAME_SCH, MAIL_IMPORT_FILE, packet, this ); if( !schframe->IsShown() ) // the frame exists, (created by the dialog field editor) // but no project loaded. { schframe->Show( true ); } if( schframe->IsIconized() ) schframe->Iconize( false ); schframe->Raise(); } if( pcb.FileExists() ) { KIWAY_PLAYER* pcbframe = Kiway().Player( FRAME_PCB, false ); if( !pcbframe ) { try // PCB frame was not available, try to start it { pcbframe = Kiway().Player( FRAME_PCB, true ); } catch( const IO_ERROR& err ) { wxMessageBox( _( "Pcbnew failed to load:\n" ) + err.What(), _( "KiCad Error" ), wxOK | wxICON_ERROR, this ); return; } } // a pcb frame can be already existing, but not yet used. // this is the case when running the footprint editor, or the footprint viewer first // if the frame is not visible, the board is not yet loaded if( !pcbframe->IsVisible() ) { pcbframe->Show( true ); } std::string packet = StrPrintf( "%d\n%s", IO_MGR::EAGLE, TO_UTF8( pcb.GetFullPath() ) ); pcbframe->Kiway().ExpressMail( FRAME_PCB, MAIL_IMPORT_FILE, packet, this ); // On Windows, Raise() does not bring the window on screen, when iconized if( pcbframe->IsIconized() ) pcbframe->Iconize( false ); pcbframe->Raise(); } ReCreateTreePrj(); m_active_project = true; }
void KICAD_MANAGER_FRAME::OnCreateProjectFromTemplate( wxCommandEvent& event ) { DIALOG_TEMPLATE_SELECTOR* ps = new DIALOG_TEMPLATE_SELECTOR( this ); wxFileName templatePath; wxString envStr; // KiCad system template path. ENV_VAR_MAP_CITER it = Pgm().GetLocalEnvVariables().find( "KICAD_TEMPLATE_DIR" ); if( it != Pgm().GetLocalEnvVariables().end() && it->second.GetValue() != wxEmptyString ) { templatePath.AssignDir( it->second.GetValue() ); ps->AddTemplatesPage( _( "System Templates" ), templatePath ); } // User template path. it = Pgm().GetLocalEnvVariables().find( "KICAD_USER_TEMPLATE_DIR" ); if( it != Pgm().GetLocalEnvVariables().end() && it->second.GetValue() != wxEmptyString ) { templatePath.AssignDir( it->second.GetValue() ); ps->AddTemplatesPage( _( "User Templates" ), templatePath ); } // Show the project template selector dialog if( ps->ShowModal() != wxID_OK ) return; if( ps->GetSelectedTemplate() == NULL ) { wxMessageBox( _( "No project template was selected. Cannot generate new project." ), _( "Error" ), wxOK | wxICON_ERROR, this ); return; } // Get project destination folder and project file name. wxString default_dir = wxFileName( Prj().GetProjectFullName() ).GetPathWithSep(); wxString title = _( "New Project Folder" ); wxFileDialog dlg( this, title, default_dir, wxEmptyString, ProjectFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); // Add a "Create a new directory" checkbox dlg.SetExtraControlCreator( &DIR_CHECKBOX::Create ); if( dlg.ShowModal() == wxID_CANCEL ) return; wxFileName fn( dlg.GetPath() ); // wxFileName automatically extracts an extension. But if it isn't // a .pro extension, we should keep it as part of the filename if( !fn.GetExt().IsEmpty() && fn.GetExt().ToStdString() != ProjectFileExtension ) fn.SetName( fn.GetName() + wxT( "." ) + fn.GetExt() ); fn.SetExt( ProjectFileExtension ); // enforce extension if( !fn.IsAbsolute() ) fn.MakeAbsolute(); // Append a new directory with the same name of the project file. if( static_cast<DIR_CHECKBOX*>( dlg.GetExtraControl() )->CreateNewDir() ) fn.AppendDir( fn.GetName() ); // Check if the project directory is empty if it already exists. wxDir directory( fn.GetPath() ); if( !fn.DirExists() ) { if( !fn.Mkdir() ) { wxString msg; msg.Printf( _( "Directory \"%s\" could not be created.\n\n" "Please make sure you have write permissions and try again." ), fn.GetPath() ); DisplayErrorMessage( this, msg ); return; } } if( !fn.IsDirWritable() ) { wxString msg; msg.Printf( _( "Cannot write to folder \"%s\"." ), fn.GetPath() ); wxMessageDialog msgDlg( this, msg, _( "Error!" ), wxICON_ERROR | wxOK | wxCENTER ); msgDlg.SetExtendedMessage( _( "Please check your access permissions to this folder " "and try again." ) ); msgDlg.ShowModal(); return; } ClearMsg(); // Make sure we are not overwriting anything in the destination folder. std::vector< wxFileName > destFiles; if( ps->GetSelectedTemplate()->GetDestinationFiles( fn, destFiles ) ) { std::vector< wxFileName > overwrittenFiles; for( const auto& file : destFiles ) { if( file.FileExists() ) overwrittenFiles.push_back( file ); } if( !overwrittenFiles.empty() ) { wxString extendedMsg = _( "Overwriting files:" ) + "\n"; for( const auto& file : overwrittenFiles ) extendedMsg += "\n" + file.GetFullName(); KIDIALOG msgDlg( this, _( "Similar files already exist in the destination folder." ), _( "Confirmation" ), wxOK | wxCANCEL | wxICON_WARNING ); msgDlg.SetExtendedMessage( extendedMsg ); msgDlg.SetOKLabel( _( "Overwrite" ) ); msgDlg.DoNotShowCheckbox( __FILE__, __LINE__ ); if( msgDlg.ShowModal() == wxID_CANCEL ) return; } } wxString errorMsg; // The selected template widget contains the template we're attempting to use to // create a project if( !ps->GetSelectedTemplate()->CreateProject( fn, &errorMsg ) ) { wxMessageDialog createDlg( this, _( "A problem occurred creating new project from template!" ), _( "Template Error" ), wxOK | wxICON_ERROR ); if( !errorMsg.empty() ) createDlg.SetExtendedMessage( errorMsg ); createDlg.ShowModal(); return; } CreateNewProject( fn.GetFullPath() ); LoadProject( fn ); }
void Display(FunctionQueue *FQ,PathList *PL) { while (!FunctionEmpty(FQ)) { FuncItem *F; F = FunctionFirst(FQ); switch (F->command) { // Kill command case 0: Kill(F->unit,F->flag,PL); break; // Spawn command case 1: Spawn(F->unit,PL); break; // DrawMap command case 2: DrawMap(F->towerList,PL); break; // DrawMenu command case 3: DrawMenu(); break; // DrawAvailableUnits command case 4: DrawAvailableUnits(F->level,F->unitList); break; // RedrawQueue command case 5: RedrawQueue(F->unitList); break; // RedrawResources command case 6: RedrawResources(F->level); break; // RedrawHP command case 7: RedrawHP(F->level); break; // ClearMap command case 8: ClearMap(); break; // ClearPrompts command case 9: ClearPrompts(); break; // ClearMsg command case 10: ClearMsg(); break; // PrintMsg command case 11: PrintMsg(F->flag); break; // StageLose command case 12: StageLose(); break; // StageWin command case 13: StageWin(); break; default: break; } FunctionDequeue(FQ); } }
UINT32 WiFiService(void) { static uint APScanStartTime; uint32 ret = -1; int temp; //////////////////////////////////////////////////////////////////////////////////////////////// //WIFI Scan if (GetMsg(MSG_WIFI_SCAN_START)) { if (wl_do_escan()) { SendMsg(MSG_WIFI_SCAN_ERR); } else { SendMsg(MSG_WIFI_SCAN); APScanStartTime = SysTickCounter;//SysTickCounter unit is 0.5ms printf("APScanStartTime:%d\n", APScanStartTime); } } if (CheckMsg(MSG_WIFI_SCAN)) { if (GetScanEventOpen()) { if (SDC_GetSdioEvent(0) == SDC_SUCCESS) { process_sdio_pending_irqs(); } /* check the scan process..*/ temp = rk_scan_work(); if ((temp > 0) || /* check the scan timeout.*/ (SysTickCounter > APScanStartTime + AP_SCAN_TIMEOUT)) { printf("scan tout\n"); ClearMsg(MSG_WIFI_SCAN); SendMsg(MSG_WIFI_SCAN_OK); } } else { ClearMsg(MSG_WIFI_SCAN); } } //WIFI Scan end //////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////// if (GetMsg(MSG_WIFI_CONNECT)) { int APScanclrTail; ClearMsg(MSG_WIFI_APPW_JUMP); ClearMsg(MSG_WIFI_SCAN); ModuleOverlay(MODULE_ID_WIFI_WPA, MODULE_OVERLAY_DATA | MODULE_OVERLAY_BSS); //goto scan code rk_printf_save_ap(); if (0 != rk_wifi_connect_pro(gSysConfig.WiFiConfig.ssid, gSysConfig.WiFiConfig.password, strlen(gSysConfig.WiFiConfig.password))) { SendMsg(MSG_WIFI_CONN_FAILURE); } else { NETIF *netif; uint32 timeout; IP_ADDR3 * pIp; int i; if (GetMsg(MSG_WIFI_NO_ENCODE)) { MSG_SET_WPA_SH(); } ModuleOverlay(MODULE_ID_WIFI_LWIP, MODULE_OVERLAY_ALL); ModuleOverlay(MODULE_ID_WIFI_DHCP, MODULE_OVERLAY_ALL); for (i=0; i<3; i++) { tcp_pcb_init(); udp_pcb_init(); arp_list_init(); netif = netif_add(NULL, NULL, NULL); eth_tickinit(); dhcp_start(netif); udp_user_use(); dns_init(); timeout = SysTickCounter; while(1) { if (netif_is_up()) { netif->dhcp = NULL; SendMsg(MSG_WIFI_CONN_SUCCESS); return TRUE; } if(SysTickCounter > (timeout + 2000)) { break; } /* Ethernet data packet received procession....*/ //printf("fle-->eth service\n"); eth_service(FALSE); } } SendMsg(MSG_WIFI_CONN_FAILURE); } } if (CheckMsg(MSG_WIFI_TCP_CONNECTING)) { UserIsrDisable(); eth_service(0); UserIsrEnable(1); } if(CheckMsg(MSG_QPW_ENABLE)) { QpwNumber++; if(QpwNumber > 0x780000) { // 1 min QpwNumber = 0; upload_connect(C_QPW); } } return ret; }