您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ DisplayError函数代码示例

51自学网 2021-06-01 20:28:18
  C++
这篇教程C++ DisplayError函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中DisplayError函数的典型用法代码示例。如果您正苦于以下问题:C++ DisplayError函数的具体用法?C++ DisplayError怎么用?C++ DisplayError使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了DisplayError函数的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: GetBoard

void PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC*  DC ){    TRACK* TrackToStartPoint = NULL;    TRACK* TrackToEndPoint   = NULL;    bool   error = false;    if( !track )        return;    // TODO: Use cleanup functions to merge collinear segments if track    // is connected to a collinear segment.    s_StartSegmentPresent = s_EndSegmentPresent = true;    if( ( track->start == NULL ) || ( track->start->Type() == PCB_TRACE_T ) )        TrackToStartPoint = track->GetTrack( GetBoard()->m_Track, NULL, ENDPOINT_START, true, false );    //  Test if more than one segment is connected to this point    if( TrackToStartPoint )    {        TrackToStartPoint->SetState( BUSY, true );        if( ( TrackToStartPoint->Type() == PCB_VIA_T )           || track->GetTrack( GetBoard()->m_Track, NULL, ENDPOINT_START, true, false ) )            error = true;        TrackToStartPoint->SetState( BUSY, false );    }    if( ( track->end == NULL ) || ( track->end->Type() == PCB_TRACE_T ) )        TrackToEndPoint = track->GetTrack( GetBoard()->m_Track, NULL, ENDPOINT_END, true, false );    //  Test if more than one segment is connected to this point    if( TrackToEndPoint )    {        TrackToEndPoint->SetState( BUSY, true );        if( (TrackToEndPoint->Type() == PCB_VIA_T)           || track->GetTrack( GetBoard()->m_Track, NULL, ENDPOINT_END, true, false ) )            error = true;        TrackToEndPoint->SetState( BUSY, false );    }    if( error )    {        DisplayError( this,                      _( "Unable to drag this segment: too many segments connected" ) );        return;    }    if( !TrackToStartPoint || ( TrackToStartPoint->Type() != PCB_TRACE_T ) )        s_StartSegmentPresent = false;    if( !TrackToEndPoint || ( TrackToEndPoint->Type() != PCB_TRACE_T ) )        s_EndSegmentPresent = false;    // Change high light net: the new one will be highlighted    GetBoard()->PushHighLight();    if( GetBoard()->IsHighLightNetON() )        HighLight( DC );    EraseDragList();    track->SetFlags( IS_DRAGGED );    if( TrackToStartPoint )    {        STATUS_FLAGS flag = STARTPOINT;        if( track->GetStart() != TrackToStartPoint->GetStart() )            flag = ENDPOINT;        AddSegmentToDragList( flag, TrackToStartPoint );        track->SetFlags( STARTPOINT );    }    if( TrackToEndPoint )    {        STATUS_FLAGS flag = STARTPOINT;        if( track->GetEnd() != TrackToEndPoint->GetStart() )            flag = ENDPOINT;        AddSegmentToDragList( flag, TrackToEndPoint );        track->SetFlags( ENDPOINT );    }    AddSegmentToDragList( track->GetFlags(), track );    UndrawAndMarkSegmentsToDrag( m_canvas, DC );    PosInit   = GetCrossHairPosition();    s_LastPos = GetCrossHairPosition();    m_canvas->SetMouseCapture( Show_Drag_Track_Segment_With_Cte_Slope, Abort_MoveTrack );    GetBoard()->SetHighLightNet( track->GetNetCode() );    GetBoard()->HighLightON();//.........这里部分代码省略.........
开发者ID:johnbeard,项目名称:kicad,代码行数:101,


示例2: main

void main (){	HANDLE hOutputReadTmp,hOutputRead,hOutputWrite;	HANDLE hInputWriteTmp,hInputRead,hInputWrite;	HANDLE hErrorWrite;	HANDLE hThread;	DWORD ThreadId;	SECURITY_ATTRIBUTES sa;	// Set up the security attributes struct.	sa.nLength= sizeof(SECURITY_ATTRIBUTES);	sa.lpSecurityDescriptor = NULL;	sa.bInheritHandle = TRUE;	// Create the child output pipe.	if (!CreatePipe(&hOutputReadTmp,&hOutputWrite,&sa,0))		DisplayError("CreatePipe");	// Create a duplicate of the output write handle for the std error	// write handle. This is necessary in case the child application	// closes one of its std output handles.	if (!DuplicateHandle(GetCurrentProcess(),hOutputWrite,		GetCurrentProcess(),&hErrorWrite,0,		TRUE,DUPLICATE_SAME_ACCESS))		DisplayError("DuplicateHandle");	// Create the child input pipe.	if (!CreatePipe(&hInputRead,&hInputWriteTmp,&sa,0))		DisplayError("CreatePipe");	// Create new output read handle and the input write handles. Set	// the Properties to FALSE. Otherwise, the child inherits the	// properties and, as a result, non-closeable handles to the pipes	// are created.	if (!DuplicateHandle(GetCurrentProcess(),hOutputReadTmp,		GetCurrentProcess(),		&hOutputRead, // Address of new handle.		0,FALSE, // Make it uninheritable.		DUPLICATE_SAME_ACCESS))		DisplayError("DupliateHandle");	if (!DuplicateHandle(GetCurrentProcess(),hInputWriteTmp,		GetCurrentProcess(),		&hInputWrite, // Address of new handle.		0,FALSE, // Make it uninheritable.		DUPLICATE_SAME_ACCESS))		DisplayError("DupliateHandle");	// Close inheritable copies of the handles you do not want to be	// inherited.	if (!CloseHandle(hOutputReadTmp)) DisplayError("CloseHandle");	if (!CloseHandle(hInputWriteTmp)) DisplayError("CloseHandle");	// Get std input handle so you can close it and force the ReadFile to	// fail when you want the input thread to exit.	if ( (hStdIn = GetStdHandle(STD_INPUT_HANDLE)) ==		INVALID_HANDLE_VALUE )		DisplayError("GetStdHandle");	PrepAndLaunchRedirectedChild(hOutputWrite,hInputRead,hErrorWrite);	// Close pipe handles (do not continue to modify the parent).	// You need to make sure that no handles to the write end of the	// output pipe are maintained in this process or else the pipe will	// not close when the child process exits and the ReadFile will hang.	if (!CloseHandle(hOutputWrite)) DisplayError("CloseHandle");	if (!CloseHandle(hInputRead )) DisplayError("CloseHandle");	if (!CloseHandle(hErrorWrite)) DisplayError("CloseHandle");	// Launch the thread that gets the input and sends it to the child.	hThread = CreateThread(NULL,0,GetAndSendInputThread,		(LPVOID)hInputWrite,0,&ThreadId);	if (hThread == NULL) DisplayError("CreateThread");	// Read the child's output.	ReadAndHandleOutput(hOutputRead);	// Redirection is complete	// Force the read on the input to return by closing the stdin handle.	Sleep(5000);	if (!CloseHandle(hStdIn)) DisplayError("CloseHandle");	printf("closed hStdIn/n");	// Tell the thread to exit and wait for thread to die.	bRunThread = FALSE;	if (WaitForSingleObject(hThread,INFINITE) == WAIT_FAILED)		DisplayError("WaitForSingleObject");//.........这里部分代码省略.........
开发者ID:CodingWithKyle,项目名称:ConsoleRedir,代码行数:101,


示例3: switch

//.........这里部分代码省略.........            {                viewer->ReCreateLibraryList();            }        }        break;    case ID_PCB_3DSHAPELIB_WIZARD:#ifdef BUILD_GITHUB_PLUGIN        Invoke3DShapeLibsDownloaderWizard( this );#endif        break;    case ID_PCB_MASK_CLEARANCE:        {            DIALOG_PADS_MASK_CLEARANCE dlg( this );            if( dlg.ShowModal() == 1 && IsGalCanvasActive() )            {                for( MODULE* module = GetBoard()->m_Modules; module; module = module->Next() )                    module->ViewUpdate();                GetGalCanvas()->Refresh();            }        }        break;    case wxID_PREFERENCES:        {            DIALOG_GENERALOPTIONS dlg( this );            dlg.ShowModal();        }        break;    case ID_PCB_PAD_SETUP:        InstallPadOptionsFrame( NULL );        break;    case ID_CONFIG_SAVE:        SaveProjectSettings( true );        break;    case ID_CONFIG_READ:        {            fn = GetBoard()->GetFileName();            fn.SetExt( ProjectFileExtension );            wxFileDialog dlg( this, _( "Read Project File" ), fn.GetPath(),                              fn.GetFullName(), ProjectFileWildcard,                              wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_CHANGE_DIR );            if( dlg.ShowModal() == wxID_CANCEL )                break;            if( !wxFileExists( dlg.GetPath() ) )            {                wxString msg = wxString::Format( _(                        "File %s not found" ),                        GetChars( dlg.GetPath() )                        );                DisplayError( this, msg );                break;            }            wxString pro_file = dlg.GetPath();            Prj().ConfigLoad( Kiface().KifaceSearch(), GROUP_PCB, GetProjectFileParameters(), pro_file );        }        break;    // Hotkey IDs    case ID_PREFERENCES_HOTKEY_EXPORT_CONFIG:        ExportHotkeyConfigToFile( g_Board_Editor_Hokeys_Descr, wxT( "pcbnew" ) );        break;    case ID_PREFERENCES_HOTKEY_IMPORT_CONFIG:        ImportHotkeyConfigFromFile( g_Board_Editor_Hokeys_Descr, wxT( "pcbnew" ) );        break;    case ID_PREFERENCES_HOTKEY_SHOW_EDITOR:        InstallHotkeyFrame( this, g_Board_Editor_Hokeys_Descr );        break;    case ID_PREFERENCES_HOTKEY_SHOW_CURRENT_LIST:        // Display current hotkey list for Pcbnew.        DisplayHotkeyList( this, g_Board_Editor_Hokeys_Descr );        break;    // Macros IDs    case ID_PREFRENCES_MACROS_SAVE:        SaveMacros();        break;    case ID_PREFRENCES_MACROS_READ:        ReadMacros();        break;    default:        DisplayError( this, wxT( "PCB_EDIT_FRAME::Process_Config error" ) );    }}
开发者ID:chgans,项目名称:kicad,代码行数:101,


示例4: switch

//.........这里部分代码省略.........            wxFileName currfn = Prj().AbsolutePath( GetBoard()->GetFileName() );            wxFileName fn = currfn;            if( id == ID_MENU_RECOVER_BOARD_AUTOSAVE )            {                wxString rec_name = wxString( autosavePrefix ) + fn.GetName();                fn.SetName( rec_name );            }            else            {                wxString backup_ext = fn.GetExt()+ backupSuffix;                fn.SetExt( backup_ext );            }            if( !fn.FileExists() )            {                msg.Printf( _( "Recovery file '%s' not found." ),                            GetChars( fn.GetFullPath() ) );                DisplayInfoMessage( this, msg );                break;            }            msg.Printf( _( "OK to load recovery or backup file '%s'" ),                            GetChars(fn.GetFullPath() ) );            if( !IsOK( this, msg ) )                break;            GetScreen()->ClrModify();    // do not prompt the user for changes            // LoadOnePcbFile( fn.GetFullPath(), aAppend=false, aForceFileDialog=false );            OpenProjectFiles( std::vector<wxString>( 1, fn.GetFullPath() ) );            // Re-set the name since name or extension was changed            GetBoard()->SetFileName( currfn.GetFullPath() );            UpdateTitle();        }        break;    case ID_APPEND_FILE:        {            int         open_ctl;            wxString    fileName;            if( !AskLoadBoardFileName( this, &open_ctl, &fileName, true ) )                break;            AppendBoardFile( fileName, open_ctl );            m_canvas->Refresh();        }        break;    case ID_NEW_BOARD:    {        if( !Clear_Pcb( true ) )            break;        wxFileName fn( wxStandardPaths::Get().GetDocumentsDir(), wxT( "noname" ),                       ProjectFileExtension );        Prj().SetProjectFullName( fn.GetFullPath() );        fn.SetExt( PcbFileExtension );        GetBoard()->SetFileName( fn.GetFullPath() );        UpdateTitle();        ReCreateLayerBox();        break;    }    case ID_SAVE_BOARD:        if( ! GetBoard()->GetFileName().IsEmpty() )        {            SavePcbFile( Prj().AbsolutePath( GetBoard()->GetFileName() ) );            break;        }    // Fall through    case ID_COPY_BOARD_AS:    case ID_SAVE_BOARD_AS:        {            wxString    pro_dir = wxPathOnly( Prj().GetProjectFullName() );            wxFileName  fn( pro_dir, _( "noname" ), KiCadPcbFileExtension );            wxString    filename = fn.GetFullPath();            if( AskSaveBoardFileName( this, &filename ) )            {                if( id == ID_COPY_BOARD_AS )                    SavePcbCopy( filename );                else                    SavePcbFile( filename, NO_BACKUP_FILE );            }        }        break;    default:        DisplayError( this, wxT( "File_io Internal Error" ) );        break;    }}
开发者ID:chgans,项目名称:kicad,代码行数:101,


示例5: _

bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool aCreateBackupFile ){    // please, keep it simple.  prompting goes elsewhere.    wxFileName  pcbFileName = aFileName;    if( pcbFileName.GetExt() == LegacyPcbFileExtension )        pcbFileName.SetExt( KiCadPcbFileExtension );    if( !IsWritable( pcbFileName ) )    {        wxString msg = wxString::Format( _(            "No access rights to write to file '%s'" ),            GetChars( pcbFileName.GetFullPath() )            );        DisplayError( this, msg );        return false;    }    wxString backupFileName;    // aCreateBackupFile == false is mainly used to write autosave files    // or new files in save as... command    if( aCreateBackupFile )    {        backupFileName = create_backup_file( aFileName );    }    GetBoard()->m_Status_Pcb &= ~CONNEXION_OK;    GetBoard()->SynchronizeNetsAndNetClasses();    // Select default Netclass before writing file.    // Useful to save default values in headers    SetCurrentNetClass( NETCLASS::Default );    ClearMsgPanel();    wxString    upperTxt;    wxString    lowerTxt;    try    {        PLUGIN::RELEASER    pi( IO_MGR::PluginFind( IO_MGR::KICAD ) );        wxASSERT( pcbFileName.IsAbsolute() );        pi->Save( pcbFileName.GetFullPath(), GetBoard(), NULL );    }    catch( const IO_ERROR& ioe )    {        wxString msg = wxString::Format( _(                "Error saving board file '%s'./n%s" ),                GetChars( pcbFileName.GetFullPath() ),                GetChars( ioe.errorText )                );        DisplayError( this, msg );        lowerTxt.Printf( _( "Failed to create '%s'" ), GetChars( pcbFileName.GetFullPath() ) );        AppendMsgPanel( upperTxt, lowerTxt, CYAN );        return false;    }    GetBoard()->SetFileName( pcbFileName.GetFullPath() );    UpdateTitle();    // Put the saved file in File History, unless aCreateBackupFile    // is false.    // aCreateBackupFile == false is mainly used to write autosave files    // and not need to have an autosave file in file history    if( aCreateBackupFile )        UpdateFileHistory( GetBoard()->GetFileName() );    // Delete auto save file on successful save.    wxFileName autoSaveFileName = pcbFileName;    autoSaveFileName.SetName( wxString( autosavePrefix ) + pcbFileName.GetName() );    if( autoSaveFileName.FileExists() )        wxRemoveFile( autoSaveFileName.GetFullPath() );    if( !!backupFileName )        upperTxt.Printf( _( "Backup file: '%s'" ), GetChars( backupFileName ) );    lowerTxt.Printf( _( "Wrote board file: '%s'" ), GetChars( pcbFileName.GetFullPath() ) );    AppendMsgPanel( upperTxt, lowerTxt, CYAN );    GetScreen()->ClrModify();    GetScreen()->ClrSave();    return true;}
开发者ID:chgans,项目名称:kicad,代码行数:95,


示例6: INSTALL_UNBUFFERED_DC

/* Called on events (popup menus) relative to automove and autoplace footprints */void PCB_EDIT_FRAME::OnPlaceOrRouteFootprints( wxCommandEvent& event ){    int        id = event.GetId();    if( m_mainToolBar == NULL )        return;    INSTALL_UNBUFFERED_DC( dc, m_canvas );    switch( id )    {    case ID_POPUP_PCB_AUTOROUTE_SELECT_LAYERS:        return;    case ID_POPUP_PCB_AUTOPLACE_FIXE_MODULE:        LockModule( (MODULE*) GetScreen()->GetCurItem(), true );        return;    case ID_POPUP_PCB_AUTOPLACE_FREE_MODULE:        LockModule( (MODULE*) GetScreen()->GetCurItem(), false );        return;    case ID_POPUP_PCB_AUTOPLACE_FREE_ALL_MODULES:        LockModule( NULL, false );        return;    case ID_POPUP_PCB_AUTOPLACE_FIXE_ALL_MODULES:        LockModule( NULL, true );        return;    case ID_POPUP_CANCEL_CURRENT_COMMAND:        if( m_canvas->IsMouseCaptured() )        {            m_canvas->CallEndMouseCapture( &dc );        }        break;    default:   // Abort a current command (if any)        m_canvas->EndMouseCapture( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor() );        break;    }    // Erase ratsnest if needed    if( GetBoard()->IsElementVisible(RATSNEST_VISIBLE) )        DrawGeneralRatsnest( &dc );    GetBoard()->m_Status_Pcb |= DO_NOT_SHOW_GENERAL_RASTNEST;    switch( id )    {    case ID_POPUP_PCB_AUTOPLACE_CURRENT_MODULE:        AutoPlaceModule( (MODULE*) GetScreen()->GetCurItem(), PLACE_1_MODULE, &dc );        break;    case ID_POPUP_PCB_AUTOPLACE_ALL_MODULES:        AutoPlaceModule( NULL, PLACE_ALL, &dc );        break;    case ID_POPUP_PCB_AUTOPLACE_NEW_MODULES:        AutoPlaceModule( NULL, PLACE_OUT_OF_BOARD, &dc );        break;    case ID_POPUP_PCB_AUTOPLACE_NEXT_MODULE:        AutoPlaceModule( NULL, PLACE_INCREMENTAL, &dc );        break;    case ID_POPUP_PCB_SPREAD_ALL_MODULES:        if( !IsOK( this,                   _("Not locked footprints inside the board will be moved. OK?") ) )            break;        // Fall through    case ID_POPUP_PCB_SPREAD_NEW_MODULES:        if( GetBoard()->m_Modules == NULL )        {            DisplayError( this, _( "No footprint found!" ) );            return;        }        else        {            MODULE* footprint = GetBoard()->m_Modules;            std::vector<MODULE*> footprintList;            for( ; footprint != NULL; footprint = footprint->Next() )                footprintList.push_back( footprint );            SpreadFootprints( &footprintList, id == ID_POPUP_PCB_SPREAD_NEW_MODULES, true );        }        break;    case ID_POPUP_PCB_AUTOROUTE_ALL_MODULES:        Autoroute( &dc, ROUTE_ALL );        break;    case ID_POPUP_PCB_AUTOROUTE_MODULE:        Autoroute( &dc, ROUTE_MODULE );        break;    case ID_POPUP_PCB_AUTOROUTE_PAD://.........这里部分代码省略.........
开发者ID:PatMart,项目名称:kicad-source-mirror,代码行数:101,


示例7: GetZoneSettings

int PCB_EDIT_FRAME::Begin_Zone( wxDC* DC ){    ZONE_SETTINGS zoneInfo = GetZoneSettings();    // verify if s_CurrentZone exists (could be deleted since last selection) :    int ii;    for( ii = 0; ii < GetBoard()->GetAreaCount(); ii++ )    {        if( s_CurrentZone == GetBoard()->GetArea( ii ) )            break;    }    if( ii >= GetBoard()->GetAreaCount() ) // Not found: could be deleted since last selection    {        s_AddCutoutToCurrentZone = false;        s_CurrentZone = NULL;    }    // If no zone contour in progress, a new zone is being created:    if( !GetBoard()->m_CurrentZoneContour )    {        if( GetToolId() == ID_PCB_KEEPOUT_AREA_BUTT &&            getActiveLayer() >= FIRST_NON_COPPER_LAYER )        {            DisplayError( this,                          _( "Error: a keepout area is allowed only on copper layers" ) );            return 0;        }        else            GetBoard()->m_CurrentZoneContour = new ZONE_CONTAINER( GetBoard() );    }    ZONE_CONTAINER* zone = GetBoard()->m_CurrentZoneContour;    if( zone->GetNumCorners() == 0 )    // Start a new contour: init zone params (net, layer ...)    {        if( !s_CurrentZone )            // A new outline is created, from scratch        {            ZONE_EDIT_T edited;            // Init zone params to reasonable values            zone->SetLayer( getActiveLayer() );            // Prompt user for parameters:            m_canvas->SetIgnoreMouseEvents( true );            if( zone->IsOnCopperLayer() )            {                // Put a zone on a copper layer                if( GetBoard()->GetHighLightNetCode() > 0 )                {                    zoneInfo.m_NetcodeSelection = GetBoard()->GetHighLightNetCode();                    zone->SetNet( zoneInfo.m_NetcodeSelection );                    zone->SetNetNameFromNetCode( );                }                double tmp = ZONE_THERMAL_RELIEF_GAP_MIL;                wxGetApp().GetSettings()->Read( ZONE_THERMAL_RELIEF_GAP_STRING_KEY, &tmp );                zoneInfo.m_ThermalReliefGap = KiROUND( tmp * IU_PER_MILS);                tmp = ZONE_THERMAL_RELIEF_COPPER_WIDTH_MIL;                wxGetApp().GetSettings()->Read( ZONE_THERMAL_RELIEF_COPPER_WIDTH_STRING_KEY,                                                &tmp );                zoneInfo.m_ThermalReliefCopperBridge = KiROUND( tmp * IU_PER_MILS );                tmp = ZONE_CLEARANCE_MIL;                wxGetApp().GetSettings()->Read( ZONE_CLEARANCE_WIDTH_STRING_KEY,                                                &tmp );                zoneInfo.m_ZoneClearance = KiROUND( tmp * IU_PER_MILS );                tmp = ZONE_THICKNESS_MIL;                wxGetApp().GetSettings()->Read( ZONE_MIN_THICKNESS_WIDTH_STRING_KEY,                                                &tmp );                zoneInfo.m_ZoneMinThickness = KiROUND( tmp * IU_PER_MILS );                zoneInfo.m_CurrentZone_Layer = zone->GetLayer();                if( GetToolId() == ID_PCB_KEEPOUT_AREA_BUTT )                {                    zoneInfo.SetIsKeepout( true );                    // Netcode and netname are irrelevant,                    // so ensure they are cleared                    zone->SetNet( 0 );                    zone->SetNetName( wxEmptyString );                    edited = InvokeKeepoutAreaEditor( this, &zoneInfo );                }                else                {                    zoneInfo.SetIsKeepout( false );                    edited = InvokeCopperZonesEditor( this, &zoneInfo );                }            }            else   // Put a zone on a non copper layer (technical layer)            {                zoneInfo.SetIsKeepout( false );                zoneInfo.m_NetcodeSelection = 0;     // No net for non copper zones                edited = InvokeNonCopperZonesEditor( this, zone, &zoneInfo );            }            m_canvas->MoveCursorToCrossHair();//.........这里部分代码省略.........
开发者ID:jerkey,项目名称:kicad,代码行数:101,


示例8: switch

void WinEDA_PcbFrame::OnLeftClick(wxDC * DC, const wxPoint& MousePos)/********************************************************************//* Traite les commandes declenchée par le bouton gauche de la souris,	quand un outil est deja selectionné*/{    EDA_BaseStruct * DrawStruct = CURRENT_ITEM;    if ( (m_ID_current_state == 0) || ( DrawStruct && DrawStruct->m_Flags ))    {        DrawPanel->m_AutoPAN_Request = FALSE;        if ( DrawStruct && DrawStruct->m_Flags ) // Commande "POPUP" en cours        {            switch (DrawStruct->m_StructType )            {            case TYPETRACK:            case TYPEVIA:                if ( CURRENT_ITEM->m_Flags & IS_DRAGGED )                {                    PlaceDraggedTrackSegment((TRACK *)DrawStruct, DC);                    return;                }                break;            case TYPETEXTE:                Place_Texte_Pcb((TEXTE_PCB *)DrawStruct, DC);                return;                break;            case TYPETEXTEMODULE:                PlaceTexteModule( (TEXTE_MODULE *) DrawStruct, DC);                return;                break;            case TYPEPAD:                PlacePad((D_PAD *)DrawStruct, DC);                return;                break;            case TYPEMODULE:                Place_Module((MODULE *)DrawStruct, DC);                return;                break;            case TYPEMIRE:                Place_Mire((MIREPCB *)DrawStruct, DC);                return;                break;            case TYPEDRAWSEGMENT:                if (m_ID_current_state == 0)                {                    Place_DrawItem( (DRAWSEGMENT * )DrawStruct, DC);                    return;                }                break;            default:                if (m_ID_current_state == 0)                {                    DisplayError(this,                                 wxT("WinEDA_PcbFrame::OnLeftClick() err: m_Flags != 0") );                    return;                }            }        }        else        {            DrawStruct = PcbGeneralLocateAndDisplay();        }    }    switch ( m_ID_current_state )    {    case ID_MAIN_MENUBAR:    case 0:        break;    case ID_NO_SELECT_BUTT:        break;    case ID_PCB_MUWAVE_TOOL_SELF_CMD:    case ID_PCB_MUWAVE_TOOL_GAP_CMD:    case ID_PCB_MUWAVE_TOOL_STUB_CMD:    case ID_PCB_MUWAVE_TOOL_STUB_ARC_CMD:    case ID_PCB_MUWAVE_TOOL_FUNCTION_SHAPE_CMD:        MuWaveCommand(DC, MousePos);        break;    case ID_PCB_HIGHLIGHT_BUTT:    {        int netcode = Select_High_Light(DC);        if ( netcode < 0 ) Affiche_Infos_Status_Pcb(this);        else Affiche_Infos_Equipot(netcode, this);    }    break;    case ID_PCB_SHOW_1_RATSNEST_BUTT://.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:kicad-svn,代码行数:101,


示例9: dc

//.........这里部分代码省略.........            g_DesignSettings.m_CurrentTrackWidth = g_DesignSettings.m_TrackWidhtHistory[ii];            DisplayTrackSettings();        }        break;    case ID_POPUP_PCB_SELECT_VIASIZE:        break;    case ID_AUX_TOOLBAR_PCB_VIA_SIZE:    {        int ii = m_SelViaSizeBox->GetChoice();        g_DesignSettings.m_CurrentViaSize = g_DesignSettings.m_ViaSizeHistory[ii];        DisplayTrackSettings();        m_SelTrackWidthBox_Changed = FALSE;        m_SelViaSizeBox_Changed = FALSE;    }    break;    case ID_POPUP_PCB_SELECT_VIASIZE1:    case ID_POPUP_PCB_SELECT_VIASIZE2:    case ID_POPUP_PCB_SELECT_VIASIZE3:    case ID_POPUP_PCB_SELECT_VIASIZE4:    case ID_POPUP_PCB_SELECT_VIASIZE5:    case ID_POPUP_PCB_SELECT_VIASIZE6:    case ID_POPUP_PCB_SELECT_VIASIZE7:    case ID_POPUP_PCB_SELECT_VIASIZE8:    case ID_POPUP_PCB_VIA_EDITING:    case ID_POPUP_PCB_VIA_HOLE_TO_DEFAULT:    case ID_POPUP_PCB_VIA_HOLE_TO_VALUE:    case ID_POPUP_PCB_VIA_HOLE_ENTER_VALUE:    case ID_POPUP_PCB_VIA_HOLE_EXPORT:    case ID_POPUP_PCB_VIA_HOLE_RESET_TO_DEFAULT:    case ID_POPUP_PCB_VIA_HOLE_EXPORT_TO_OTHERS:        Via_Edit_Control(&dc, id, (SEGVIA *) GetScreen()->m_CurrentItem);        break;    case ID_POPUP_PCB_MOVE_TRACK_NODE:        DrawPanel->MouseToCursorSchema();        Start_MoveOneTrackSegment((TRACK *) GetScreen()->m_CurrentItem,                                  &dc, TRUE);        break;    case ID_POPUP_PCB_BREAK_TRACK:        DrawPanel->MouseToCursorSchema();        {            TRACK * track = (TRACK *) GetScreen()->m_CurrentItem;            wxPoint pos = GetScreen()->m_Curseur;            track->Draw(DrawPanel, &dc, GR_XOR);            TRACK * newtrack = CreateLockPoint(&pos.x, &pos.y, track, NULL);            track->Draw(DrawPanel, &dc, GR_XOR);            newtrack->Draw(DrawPanel, &dc, GR_XOR);        }        break;    case ID_MENU_PCB_CLEAN:        Clean_Pcb(&dc);        break;    case ID_MENU_PCB_SWAP_LAYERS:        Swap_Layers(event);        break;    case ID_POPUP_PCB_AUTOROUTE_GET_AUTOROUTER:        GlobalRoute(&dc);        break;    case ID_POPUP_PCB_AUTOROUTE_GET_AUTOROUTER_DATA:        ReadAutoroutedTracks(&dc);        break;    case ID_PCB_USER_GRID_SETUP:        InstallGridFrame(pos);        break;    case ID_POPUP_PCB_DISPLAY_FOOTPRINT_DOC:    {        wxString msg = FindKicadHelpPath();        msg += EDA_Appl->m_EDA_CommonConfig->Read(wxT("module_doc_file"),                wxT("pcbnew/footprints.pdf"));        GetAssociatedDocument(this, wxEmptyString, msg);    }    break;    case ID_MENU_ARCHIVE_NEW_MODULES:        Archive_Modules(wxEmptyString, TRUE);        break;    case ID_MENU_ARCHIVE_ALL_MODULES:        Archive_Modules(wxEmptyString, FALSE);        break;    default:    {        DisplayError(this, wxT("WinEDA_PcbFrame::Process_Special_Functions() id error"));        break;    }    }    SetToolbars();}
开发者ID:BackupTheBerlios,项目名称:kicad-svn,代码行数:101,


示例10: RegisterUnregisterVPinMAME

int RegisterUnregisterVPinMAME(HWND hWnd, int fRegister){	HRESULT hr;	HMODULE hModule;	// so now let's see if we can load vpinmame.dll	hModule = LoadLibrary("vpinmame.dll");	if ( !hModule ) {		DisplayError(hWnd, GetLastError(), "The 'vpinmame.dll' file can't be loaded.", "Be sure to have this file in the current directory!");		return 0;	}	char szModuleFilename[MAX_PATH];	GetModuleFileName(hModule, szModuleFilename, sizeof szModuleFilename);	char szVersion[256];	GetVersionResourceEntry(szModuleFilename, TEXT("ProductVersion"), szVersion, sizeof szVersion);	char szMsg[256];	if ( fRegister )		wsprintf(szMsg, "You have selected to install version %s of Visual PinMAME! /nAre you ready to proceed?", szVersion);	else		wsprintf(szMsg, "You have selected to uninstall version %s of Visual PinMAME! /nAre you ready to proceed?", szVersion);		if ( MessageBox(hWnd, szMsg, g_szCaption, MB_ICONQUESTION|MB_YESNO)==IDNO ) {		if ( fRegister )			MessageBox(hWnd, "Installation aborted!", g_szCaption, MB_ICONEXCLAMATION|MB_OK);		else			MessageBox(hWnd, "UnInstallation aborted!/nVisual PinMAME is still installed on your system", g_szCaption, MB_ICONEXCLAMATION|MB_OK);		FreeLibrary(hModule);		return 0;	}	if ( fRegister ) {		typedef HRESULT DLLREGISTERSERVER(void);		DLLREGISTERSERVER* DllRegisterServer = (DLLREGISTERSERVER*) GetProcAddress(hModule, "DllRegisterServer");		if ( !DllRegisterServer ) {			DisplayError(hWnd, GetLastError(), "Can't find the registering function (DllRegisterServer) in the vpinmame.dll.", "Please check if you have a valid vpinmame.dll!");			FreeLibrary(hModule);			return 0;		}		hr = (*DllRegisterServer)();		if ( FAILED(hr) ) {			DisplayError(hWnd, hr, "Unable to register the class object!", "Please check if you have a valid vpinmame.dll!");			FreeLibrary(hModule);			return 0;		}		FreeLibrary(hModule);		// load the class one time to check if it's working		IUnknown *pUnknown;		CLSID ClsID;		hr = CLSIDFromProgID(OLESTR("VPinMAME.Controller"), &ClsID);		if ( FAILED(hr) ) {			DisplayError(hWnd, hr, "Class couldn't be found. Registering failed");			return 0;		}		hr = CoCreateInstance(ClsID, NULL, CLSCTX_INPROC_SERVER, IID_IUnknown, (void**) &pUnknown);		if ( FAILED(hr) ) {			DisplayError(hWnd, hr, "Can't create the Controller class");			return 0;		}				pUnknown->Release();	}	else {		typedef HRESULT DLLUNREGISTERSERVER(void);		DLLUNREGISTERSERVER* DllUnregisterServer = (DLLUNREGISTERSERVER*) GetProcAddress(hModule, "DllUnregisterServer");		if ( !DllUnregisterServer ) {			DisplayError(hWnd, GetLastError(), "Can't find the unregistering function (DllUnegisterServer) in the vpinmame.dll.", "Please check if you have a valid vpinmame.dll!");			FreeLibrary(hModule);			return 0;		}		hr = (*DllUnregisterServer)();		if ( FAILED(hr) ) {			DisplayError(hWnd, hr, "Unable to unregister the class object!", "Please check if you have a valid vpinmame.dll!");			FreeLibrary(hModule);			return 0;		}				FreeLibrary(hModule);	}	if ( !fRegister ) {		if ( MessageBox(hWnd, "Do you want also delete all registry entrys Visual PinMAME has made?", g_szCaption, MB_ICONQUESTION|MB_YESNO)==IDYES ) 			RegDeleteKeyEx(HKEY_CURRENT_USER, "Software//Freeware//Visual PinMame");	}	return 1;}
开发者ID:chrisjubb,项目名称:pinmame,代码行数:96,


示例11: editable

//.........这里部分代码省略.........    switch ( m_ID_current_state )    {    case 0:        if ( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )        {            DrawStruct = PcbGeneralLocateAndDisplay();        }        if ( (DrawStruct == NULL) || (DrawStruct->m_Flags != 0) )            break;        // Element localisé        GetScreen()->m_CurrentItem = DrawStruct;        switch ( DrawStruct->m_StructType )        {        case TYPETRACK:        case TYPEVIA:            if (DrawStruct->m_Flags & IS_NEW)            {                End_Route( (TRACK *) DrawStruct, DC);                DrawPanel->m_AutoPAN_Request = FALSE;            }            else if (DrawStruct->m_Flags == 0)            {                Edit_TrackSegm_Width(DC,                                     (TRACK *) DrawStruct);            }            break;        case TYPETEXTE:            InstallTextPCBOptionsFrame((TEXTE_PCB *)DrawStruct,                                       DC, ((TEXTE_PCB *)DrawStruct)->m_Pos);            DrawPanel->MouseToCursorSchema();            break;        case TYPEPAD:            InstallPadOptionsFrame(                (D_PAD *)DrawStruct, &dc, pos);            DrawPanel->MouseToCursorSchema();            break;        case TYPEMODULE:            InstallModuleOptionsFrame((MODULE *)DrawStruct,                                      &dc, pos);            DrawPanel->MouseToCursorSchema();            break;        case TYPEMIRE:            InstallMireOptionsFrame( (MIREPCB *)DrawStruct, &dc, pos);            DrawPanel->MouseToCursorSchema();            break;        case TYPETEXTEMODULE:            InstallTextModOptionsFrame((TEXTE_MODULE *)DrawStruct,                                       &dc, pos);            DrawPanel->MouseToCursorSchema();            break;        case TYPEDRAWSEGMENT:            break;        default:            break;        }        break;	// end case 0    case ID_TRACK_BUTT:        if ( DrawStruct && (DrawStruct->m_Flags & IS_NEW) )        {            End_Route( (TRACK *) DrawStruct, DC);            DrawPanel->m_AutoPAN_Request = FALSE;        }        break;    case ID_PCB_ZONES_BUTT:        End_Zone(DC);        DrawPanel->m_AutoPAN_Request = FALSE;        GetScreen()->m_CurrentItem = NULL;        break;    case ID_LINE_COMMENT_BUTT:    case ID_PCB_ARC_BUTT:    case ID_PCB_CIRCLE_BUTT:        if ( DrawStruct == NULL ) break;        if ( DrawStruct->m_StructType != TYPEDRAWSEGMENT )        {            DisplayError(this, wxT("DrawStruct Type error"));            DrawPanel->m_AutoPAN_Request = FALSE;            break;        }        if ( (DrawStruct->m_Flags & IS_NEW) )        {            End_Edge( (DRAWSEGMENT *) DrawStruct, &dc);            DrawPanel->m_AutoPAN_Request = FALSE;            GetScreen()->m_CurrentItem = NULL;        }        break;    }}
开发者ID:BackupTheBerlios,项目名称:kicad-svn,代码行数:101,


示例12: DisplayDialogs

int DisplayDialogs(HWND hWnd, int nDialog){	// Let's make a little bit COM	HRESULT hr;	IUnknown *pUnknown;	CLSID ClsID;	hr = CLSIDFromProgID(OLESTR("VPinMAME.Controller"), &ClsID);	if ( FAILED(hr) ) {		DisplayError(hWnd, hr, "Class couldn't be found. Maybe it isn't registered");		return 0;	}	hr = CoCreateInstance(ClsID, NULL, CLSCTX_INPROC_SERVER, IID_IUnknown, (void**) &pUnknown);	if ( FAILED(hr) ) {		DisplayError(hWnd, hr, "Can't create the Controller class! /nPlease check that you have installed Visual PinMAME properly!");		return 0;	}	// Don't want to include the header files for the class, so let's using IDispatch	IDispatch *pDispatch;		hr = pUnknown->QueryInterface(IID_IDispatch, (void**) &pDispatch);	if ( FAILED(hr) ) {		DisplayError(hWnd, hr, "Can't get the dispatch interface");		pUnknown->Release();		return 0;	}	OLECHAR *pszName[3] = {L"ShowPathesDialog", L"ShowOptsDialog", L"ShowAboutDialog"};	DISPID dispid;	hr = pDispatch->GetIDsOfNames(IID_NULL, &pszName[nDialog], 1, LOCALE_SYSTEM_DEFAULT, &dispid);	if ( FAILED(hr) ) {		DisplayError(hWnd, hr, "Can't get the dispatch interface");		pDispatch->Release();		pUnknown->Release();		return 0;	}		VARIANT varParam;	varParam.vt   = VT_I4;	varParam.lVal = (long) hWnd;	DISPPARAMS DispParams = {&varParam,NULL,1,0};	EXCEPINFO ExcepInfo;	hr = pDispatch->Invoke(dispid, IID_NULL, LOCALE_SYSTEM_DEFAULT, DISPATCH_METHOD, &DispParams, NULL, &ExcepInfo, NULL);	if ( FAILED(hr) ) {		if ( hr==DISP_E_EXCEPTION )			// actually we call the ONLY UNICODE function in Windows 9x			MessageBoxW(0, ExcepInfo.bstrDescription, L"Error from the VPinMAME.Controller interface", MB_ICONERROR|MB_OK);		else 			DisplayError(hWnd, hr, "Can't get the dispatch interface");		pDispatch->Release();		pUnknown->Release();		return 0;	}	pDispatch->Release();	pUnknown->Release();	return 1;}
开发者ID:chrisjubb,项目名称:pinmame,代码行数:65,


示例13: DeleteStructure

void DeleteStructure( EDA_BaseStruct * PtStruct )/**************************************************//* Supprime de la liste chainee la stucture pointee par GenericStructure	et libere la memoire correspondante*/{EDA_BaseStruct *PtNext, *PtBack;int IsDeleted;int typestruct;char Line[256];	if( PtStruct == NULL) return ;	typestruct = (int)PtStruct->m_StructType;	IsDeleted = PtStruct->GetState(DELETED);	PtNext = PtStruct->Pnext;	PtBack = PtStruct->Pback;	switch( typestruct )		{		case TYPE_NOT_INIT:			DisplayError(NULL, "DeleteStruct: Type Structure Non Initialise");			break;		 case PCB_EQUIPOT_STRUCT_TYPE:			#undef Struct			#define Struct ((EQUIPOT*)PtStruct)			Struct->UnLink();			delete Struct;			break;		 case TYPEMODULE:			#undef Struct			#define Struct ((MODULE*)PtStruct)			Struct->UnLink();			delete Struct;			break;		 case TYPEPAD:			#undef Struct			#define Struct ((D_PAD*)PtStruct)			Struct->UnLink();			delete Struct;			break;		case TYPECOTATION:			#undef Struct			#define Struct ((COTATION*)PtStruct)			Struct->UnLink();			delete Struct;			break;		case TYPEMIRE:			#undef Struct			#define Struct ((MIREPCB*)PtStruct)			Struct->UnLink();			delete Struct;			break;		case TYPEDRAWSEGMENT:			#undef Struct			#define Struct ((DRAWSEGMENT*)PtStruct)			Struct->UnLink();			delete Struct;			break;		 case TYPETEXTE:			#undef Struct			#define Struct ((TEXTE_PCB*)PtStruct)			Struct->UnLink();			delete Struct;			break;		 case TYPETEXTEMODULE:			#undef Struct			#define Struct ((TEXTE_MODULE*)PtStruct)			Struct->UnLink();			delete Struct;			break;		 case TYPEEDGEMODULE:			#undef Struct			#define Struct ((EDGE_MODULE*)PtStruct)			Struct->UnLink();			delete Struct;			break;		case TYPETRACK:			#undef Struct			#define Struct ((TRACK*)PtStruct)			Struct->UnLink();			delete Struct;			break;		case TYPEVIA:			#undef Struct			#define Struct ((SEGVIA*)PtStruct)//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:kicad-svn,代码行数:101,


示例14: EditTagsDialog

LRESULT CALLBACKEditTagsDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam){  static HANDLE hwndText;  static int sizeX, sizeY;  int len, newSizeX, newSizeY;  char *str;  RECT rect;  MINMAXINFO *mmi;  int err;    switch (message) {  case WM_INITDIALOG: /* message: initialize dialog box */    /* Initialize the dialog items */    Translate(hDlg, DLG_EditTags);   hwndText = memo = GetDlgItem(hDlg, OPT_TagsText);    SendMessage(hwndText, WM_SETFONT,       (WPARAM)font[boardSize][EDITTAGS_FONT]->hf, MAKELPARAM(FALSE, 0));    SetDlgItemText(hDlg, OPT_TagsText, editTagsText);    EnableWindow(GetDlgItem(hDlg, OPT_TagsCancel), canEditTags);    EnableWindow(GetDlgItem(hDlg, OPT_EditTags), !canEditTags || bookUp);    SendMessage(hwndText, EM_SETREADONLY, !canEditTags, 0);    if (bookUp) {      SetDlgItemText(hDlg, OPT_EditTags, _("&Play Move"));      SetWindowText(hDlg, _("Edit Book"));      SetFocus(hwndText);    } else    if (canEditTags) {      SetWindowText(hDlg, _("Edit Tags"));      SetFocus(hwndText);    } else {      SetWindowText(hDlg, _("Tags"));      SetFocus(GetDlgItem(hDlg, IDOK));    }    if (!editTagsDialog) {      editTagsDialog = hDlg;      GetClientRect(hDlg, &rect);      sizeX = rect.right;      sizeY = rect.bottom;      SendDlgItemMessage( hDlg, OPT_TagsText, EM_SETEVENTMASK, 0, ENM_MOUSEEVENTS );      if (wpTags.x != CW_USEDEFAULT && wpTags.y != CW_USEDEFAULT &&	  wpTags.width != CW_USEDEFAULT && wpTags.height != CW_USEDEFAULT) {	WINDOWPLACEMENT wp;	EnsureOnScreen(&wpTags.x, &wpTags.y, 0, 0);	wp.length = sizeof(WINDOWPLACEMENT);	wp.flags = 0;	wp.showCmd = SW_SHOW;	wp.ptMaxPosition.x = wp.ptMaxPosition.y = 0;	wp.rcNormalPosition.left = wpTags.x;	wp.rcNormalPosition.right = wpTags.x + wpTags.width;	wp.rcNormalPosition.top = wpTags.y;	wp.rcNormalPosition.bottom = wpTags.y + wpTags.height;	SetWindowPlacement(hDlg, &wp);	GetClientRect(hDlg, &rect);	newSizeX = rect.right;	newSizeY = rect.bottom;        ResizeEditPlusButtons(hDlg, hwndText, sizeX, sizeY,			      newSizeX, newSizeY);	sizeX = newSizeX;	sizeY = newSizeY;      }    }    return FALSE;      case WM_COMMAND:    switch (LOWORD(wParam)) {    case IDOK:    case OPT_TagsSave:      if (canEditTags) {	char *p, *q;	/* Read changed options from the dialog box */	len = GetWindowTextLength(hwndText);	str = (char *) malloc(len + 1);	GetWindowText(hwndText, str, len + 1);	p = q = str;	while (*q) {	  if (*q == '/r')	    q++;	  else	    *p++ = *q++;	}	*p = NULLCHAR; err = 0;        if(resPtr) *resPtr = strdup(str); else	if(bookUp) SaveToBook(str), DisplayBook(currentMove); else	err = ReplaceTags(str, &gameInfo);	if (err) DisplayError(_("Error replacing tags."), err);	free(str);      }      if(LOWORD(wParam) == IDOK) TagsPopDown();      return TRUE;          case IDCANCEL:    case OPT_TagsCancel:      TagsPopDown();      return TRUE;          case OPT_EditTags:      if(bookUp) addToBookFlag = !addToBookFlag; else//.........这里部分代码省略.........
开发者ID:arunpersaud,项目名称:xboard,代码行数:101,


示例15: sheet

//.........这里部分代码省略.........				case DRAW_TEXT_STRUCT_TYPE :					#undef STRUCT					#define STRUCT ((DrawTextStruct*)DrawList)					if( WildCompareString( WildText, STRUCT->m_Text, FALSE ) )					{						NotFound = 0;						pos = STRUCT->m_Pos;					}					break;				default:					break;			}			if(NotFound == 0)	/* Element trouve */			{				if ( FirstScreen == NULL )	/* 1er element trouve */				{					FirstScreen = Screen; firstpos = pos;					FirstStruct = DrawList;				}				StartCount++;				if( ItemsCount >= StartCount )				{					NotFound = 1;	/* Continue recherche de l'element suivant */				}				else				{					Struct = DrawList; ItemsCount++; break ;				}			}			if( NotFound == 0 ) break;			DrawList = DrawList->Pnext;		}		if( NotFound == 0 ) break;		if( FindAll == FALSE ) break;	}	if( NotFound && FirstScreen )	{		NotFound = 0; Screen = FirstScreen; Struct = FirstStruct;		pos = firstpos; ItemsCount = 1;	}	if( NotFound == 0)	{		if ( Screen != GetScreen() )		{			Screen->SetZoom(GetScreen()->GetZoom() );			m_CurrentScreen = ActiveScreen = Screen;			force_recadre = TRUE;		}		/* Si la struct localisee est du type DRAW_LIB_ITEM_STRUCT_TYPE,			Les coordonnes sont a recalculer en fonction de la matrice			d'orientation */		if( Struct->m_StructType == DRAW_LIB_ITEM_STRUCT_TYPE )		{			#undef STRUCT			#define STRUCT ((EDA_SchComponentStruct*)Struct)			pos.x -= STRUCT->m_Pos.x; pos.y -= STRUCT->m_Pos.y;			ii = STRUCT->m_Transform[0][0] * pos.x + STRUCT->m_Transform[0][1] * pos.y;			jj = STRUCT->m_Transform[1][0] * pos.x + STRUCT->m_Transform[1][1] * pos.y;			pos.x = ii + STRUCT->m_Pos.x; pos.y = jj + STRUCT->m_Pos.y;		}		Screen->m_Curseur = pos;		curpos = DrawPanel->CursorScreenPosition();		DrawPanel->GetViewStart(&m_CurrentScreen->m_StartVisu.x,								&m_CurrentScreen->m_StartVisu.y);		// calcul des coord curseur avec origine = screen		curpos.x -= m_CurrentScreen->m_StartVisu.x;		curpos.y -= m_CurrentScreen->m_StartVisu.y;		/* Il y a peut-etre necessite de recadrer le dessin: */		if( (curpos.x <= 0) || (curpos.x >= size.x-1) ||			(curpos.y <= 0) || (curpos.y >= size.y) || force_recadre )		{			Recadre_Trace(TRUE);		}		else		{			GRMouseWarp(DrawPanel, curpos );		}		msg = WildText + _(" Found in ") + Screen->m_FileName;		Affiche_Message(msg);	}	else	{		Affiche_Message(wxEmptyString);		msg = WildText + _(" Not Found");		DisplayError(this,msg, 10);	}		return DrawList;}
开发者ID:BackupTheBerlios,项目名称:kicad-svn,代码行数:101,


示例16: switch

void EDIT_TOOL::remove( BOARD_ITEM* aItem ){    BOARD* board = getModel<BOARD>();    switch( aItem->Type() )    {    case PCB_MODULE_T:    {        MODULE* module = static_cast<MODULE*>( aItem );        module->ClearFlags();        module->RunOnChildren( boost::bind( &KIGFX::VIEW::Remove, getView(), _1 ) );        // Module itself is deleted after the switch scope is finished        // list of pads is rebuild by BOARD::BuildListOfNets()        // Clear flags to indicate, that the ratsnest, list of nets & pads are not valid anymore        board->m_Status_Pcb = 0;    }    break;    // Default removal procedure    case PCB_MODULE_TEXT_T:    {        TEXTE_MODULE* text = static_cast<TEXTE_MODULE*>( aItem );        switch( text->GetType() )        {            case TEXTE_MODULE::TEXT_is_REFERENCE:                DisplayError( getEditFrame<PCB_BASE_FRAME>(), _( "Cannot delete component reference." ) );                return;            case TEXTE_MODULE::TEXT_is_VALUE:                DisplayError( getEditFrame<PCB_BASE_FRAME>(), _( "Cannot delete component value." ) );                return;            case TEXTE_MODULE::TEXT_is_DIVERS:    // suppress warnings                break;        }        if( m_editModules )        {            MODULE* module = static_cast<MODULE*>( aItem->GetParent() );            module->SetLastEditTime();            board->m_Status_Pcb = 0; // it is done in the legacy view            aItem->DeleteStructure();        }        return;    }    case PCB_PAD_T:    case PCB_MODULE_EDGE_T:    {        MODULE* module = static_cast<MODULE*>( aItem->GetParent() );        module->SetLastEditTime();        board->m_Status_Pcb = 0; // it is done in the legacy view        if( !m_editModules )        {            getView()->Remove( aItem );            board->Remove( aItem );        }        aItem->DeleteStructure();        return;    }    case PCB_LINE_T:                // a segment not on copper layers    case PCB_TEXT_T:                // a text on a layer    case PCB_TRACE_T:               // a track segment (segment on a copper layer)    case PCB_VIA_T:                 // a via (like track segment on a copper layer)    case PCB_DIMENSION_T:           // a dimension (graphic item)    case PCB_TARGET_T:              // a target (graphic item)    case PCB_MARKER_T:              // a marker used to show something    case PCB_ZONE_T:                // SEG_ZONE items are now deprecated    case PCB_ZONE_AREA_T:        break;    default:                        // other types do not need to (or should not) be handled        assert( false );        return;    }    getView()->Remove( aItem );    board->Remove( aItem );}
开发者ID:morio,项目名称:kicad,代码行数:89,


示例17: Close

void WinEDA_FindFrame::LocatePartInLibs(wxCommandEvent& event)/*************************************************************//* Recherche exhaustive d'un composant en librairies, meme non chargees*/{wxString Text, FindList;const wxChar ** ListNames;LibraryStruct *Lib = NULL;EDA_LibComponentStruct * LibEntry;bool FoundInLib = FALSE;	// True si reference trouvee ailleurs qu'en cache		Text = m_NewTextCtrl->GetData();	if ( Text.IsEmpty() )	{		Close(); return;	}	s_OldStringFound = Text;	int ii, nbitems, NumOfLibs = NumOfLibraries();	if (NumOfLibs == 0)		{		DisplayError(this, _("No libraries are loaded"));		Close(); return;		}	ListNames = GetLibNames();			nbitems = 0;	for (ii = 0; ii < NumOfLibs; ii++ )	/* Recherche de la librairie */	{	bool IsLibCache;		Lib = FindLibrary(ListNames[ii]);		if ( Lib == NULL ) break;		if ( Lib->m_Name.Contains( wxT(".cache")) ) IsLibCache = TRUE;		else IsLibCache = FALSE;		LibEntry = (EDA_LibComponentStruct *) PQFirst(&Lib->m_Entries, FALSE);		while( LibEntry )		{			if( WildCompareString(Text, LibEntry->m_Name.m_Text, FALSE) )			{				nbitems ++;				if ( ! IsLibCache ) FoundInLib = TRUE;				if ( ! FindList.IsEmpty() ) FindList += wxT("/n");				FindList << _("Found ")						+ LibEntry->m_Name.m_Text						+ _(" in lib ") + Lib->m_Name;			}		LibEntry = (EDA_LibComponentStruct *) PQNext(Lib->m_Entries, LibEntry, NULL);		}	}	free (ListNames);		if ( ! FoundInLib )	{		if ( nbitems ) FindList = wxT("/n") + Text + _(" found only in cache");		else FindList = Text + _(" not found");		FindList += _("/nExplore All Libraries?");		if ( IsOK(this, FindList) )		{			FindList.Empty();			ExploreAllLibraries(Text, FindList);			if ( FindList.IsEmpty() ) DisplayInfo(this, _("Nothing found") );			else DisplayInfo(this, FindList);		}	}	else DisplayInfo(this, FindList);		Close();}
开发者ID:BackupTheBerlios,项目名称:kicad-svn,代码行数:70,


示例18: DisplayError

BOOL GL11Window::Create(CONST WindowSettings& settings /*= {}*/){	m_settings = settings;	CONST auto hInstance{GetModuleHandle(NULL)};	if (!hInstance)	{		DisplayError(TEXT("Failed to retrieve the application handle."), GetLastError());		return FALSE;	}	WNDCLASSEX wndClassEx{};	ZeroMemory(&wndClassEx, sizeof(WNDCLASSEX));	wndClassEx.cbSize        = sizeof(WNDCLASSEX);	wndClassEx.style         = CS_OWNDC | CS_HREDRAW | CS_VREDRAW;	wndClassEx.lpfnWndProc   = WndProc;	wndClassEx.cbClsExtra    = 0;	wndClassEx.cbWndExtra    = sizeof(VOID*) + sizeof(INT);	wndClassEx.hInstance     = hInstance;	wndClassEx.hIcon         = LoadIcon(NULL, IDI_APPLICATION);	wndClassEx.hCursor       = LoadCursor(NULL, IDC_ARROW);	wndClassEx.hbrBackground = NULL;	wndClassEx.lpszMenuName  = NULL;	wndClassEx.lpszClassName = TEXT("GL11WindowClass");	wndClassEx.hIconSm       = NULL;	if (FAILED(RegisterClassEx(&wndClassEx)))	{		DisplayError(TEXT("Failed to register the window class."), GetLastError());		return FALSE;	}	DWORD windowStyle{WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS};	DWORD windowStyleEx{WS_EX_ACCEPTFILES};	RECT windowRect{0, 0, m_settings.width, m_settings.height};	if (FAILED(AdjustWindowRectEx(&windowRect, windowStyle, FALSE, windowStyleEx)))	{		DisplayError(TEXT("Failed to adjust the window rect."), GetLastError());		return FALSE;	}	m_settings.x = (GetSystemMetrics(SM_CXSCREEN) / 2) - (m_settings.width / 2);	m_settings.y = (GetSystemMetrics(SM_CYSCREEN) / 2) - (m_settings.height / 2);	CONST auto FULL_TITLE{m_settings.title + m_settings.titleEx};	m_handle = CreateWindowEx(windowStyleEx,	                          wndClassEx.lpszClassName,	                          FULL_TITLE.c_str(),	                          windowStyle,	                          m_settings.x,	                          m_settings.y,	                          windowRect.right - windowRect.left,	                          windowRect.bottom - windowRect.top,	                          NULL,	                          NULL,	                          hInstance,	                          this);	if (!m_handle)	{		DisplayError(TEXT("Failed to create the window handle."), GetLastError());		return FALSE;	}	m_deviceContext = GetDC(m_handle);	// Query a pixel format:	PIXELFORMATDESCRIPTOR desiredPixelFormat{};	ZeroMemory(&desiredPixelFormat, sizeof(PIXELFORMATDESCRIPTOR));	desiredPixelFormat.nSize        = sizeof(PIXELFORMATDESCRIPTOR);	desiredPixelFormat.nVersion     = 1;	desiredPixelFormat.dwFlags      = PFD_DRAW_TO_WINDOW | PFD_DOUBLEBUFFER | PFD_SUPPORT_OPENGL;	desiredPixelFormat.iPixelType   = PFD_TYPE_RGBA;	desiredPixelFormat.cColorBits   = 32;	desiredPixelFormat.cDepthBits   = 24;	desiredPixelFormat.cStencilBits = 8;	desiredPixelFormat.iLayerType   = PFD_MAIN_PLANE;	auto chosenPixelFormat{ChoosePixelFormat(m_deviceContext, &desiredPixelFormat)};	if (!chosenPixelFormat)	{		DisplayError(TEXT("Failed to choose a dummy pixel format."), GetLastError());		return FALSE;	}	if (FAILED(DescribePixelFormat(m_deviceContext,	                               chosenPixelFormat,	                               sizeof(PIXELFORMATDESCRIPTOR),	                               &desiredPixelFormat)))	{		DisplayError(TEXT("Failed to fill the pixel format."), GetLastError());		return FALSE;	}	if (FAILED(SetPixelFormat(m_deviceContext, chosenPixelFormat, &desiredPixelFormat)))	{		DisplayError(TEXT("Failed to set the pixel format."), GetLastError());		return FALSE;	}//.........这里部分代码省略.........
开发者ID:Skurdt,项目名称:Win32-API-Code-Snippets,代码行数:101,


示例19: GetBoard

bool PCB_EDIT_FRAME::End_Zone( wxDC* DC ){    ZONE_CONTAINER* zone = GetBoard()->m_CurrentZoneContour;    if( !zone )        return true;    // Validate the current outline:    if( zone->GetNumCorners() <= 2 )   // An outline must have 3 corners or more    {        Abort_Zone_Create_Outline( m_canvas, DC );        return true;    }    // Remove the last corner if is is at the same location as the prevoius corner    zone->Outline()->RemoveNullSegments();    // Validate the current edge:    int icorner = zone->GetNumCorners() - 1;    if( zone->IsOnCopperLayer() )    {        if( g_Drc_On && m_drc->Drc( zone, icorner - 1 ) == BAD_DRC )  // we can't validate last edge            return false;        if( g_Drc_On && m_drc->Drc( zone, icorner ) == BAD_DRC )      // we can't validate the closing edge        {            DisplayError( this,                          _( "DRC error: closing this area creates a drc error with an other area" ) );            m_canvas->MoveCursorToCrossHair();            return false;        }    }    zone->ClearFlags();    zone->DrawWhileCreateOutline( m_canvas, DC, GR_XOR );    m_canvas->SetMouseCapture( NULL, NULL );    // Undraw old drawings, because they can have important changes    LAYER_NUM layer = zone->GetLayer();    GetBoard()->RedrawAreasOutlines( m_canvas, DC, GR_XOR, layer );    GetBoard()->RedrawFilledAreas( m_canvas, DC, GR_XOR, layer );    // Save initial zones configuration, for undo/redo, before adding new zone    s_AuxiliaryList.ClearListAndDeleteItems();    s_PickedList.ClearListAndDeleteItems();    SaveCopyOfZones(s_PickedList, GetBoard(), zone->GetNet(), zone->GetLayer() );    // Put new zone in list    if( !s_CurrentZone )    {        zone->Outline()->CloseLastContour(); // Close the current corner list        GetBoard()->Add( zone );        GetBoard()->m_CurrentZoneContour = NULL;        // Add this zone in picked list, as new item        ITEM_PICKER picker( zone, UR_NEW );        s_PickedList.PushItem( picker );    }    else    // Append this outline as a cutout to an existing zone    {        for( int ii = 0; ii < zone->GetNumCorners(); ii++ )        {            s_CurrentZone->AppendCorner( zone->GetCornerPosition( ii ) );        }        s_CurrentZone->Outline()->CloseLastContour(); // Close the current corner list        zone->RemoveAllContours();      // All corners are copied in s_CurrentZone. Free corner list.        zone = s_CurrentZone;    }    s_AddCutoutToCurrentZone = false;    s_CurrentZone = NULL;    GetScreen()->SetCurItem( NULL );       // This outline can be deleted when merging outlines    // Combine zones if possible :    GetBoard()->OnAreaPolygonModified( &s_AuxiliaryList, zone );    // Redraw the real edge zone :    GetBoard()->RedrawAreasOutlines( m_canvas, DC, GR_OR, layer );    GetBoard()->RedrawFilledAreas( m_canvas, DC, GR_OR, layer );    int ii = GetBoard()->GetAreaIndex( zone );   // test if zone exists    if( ii < 0 )        zone = NULL;                        // was removed by combining zones    int error_count = GetBoard()->Test_Drc_Areas_Outlines_To_Areas_Outlines( zone, true );    if( error_count )    {        DisplayError( this, _( "Area: DRC outline error" ) );    }    UpdateCopyOfZonesList( s_PickedList, s_AuxiliaryList, GetBoard() );    SaveCopyInUndoList(s_PickedList, UR_UNSPECIFIED);    s_PickedList.ClearItemsList(); // s_ItemsListPicker is no more owner of picked items//.........这里部分代码省略.........
开发者ID:jerkey,项目名称:kicad,代码行数:101,


示例20: GetBoard

bool FOOTPRINT_EDIT_FRAME::HandleBlockEnd( wxDC* DC ){    int  itemsCount    = 0;    bool nextcmd = false;    MODULE* currentModule = GetBoard()->m_Modules;    if( GetScreen()->m_BlockLocate.GetCount() )    {        BLOCK_STATE_T   state   = GetScreen()->m_BlockLocate.GetState();        BLOCK_COMMAND_T command = GetScreen()->m_BlockLocate.GetCommand();        m_canvas->CallEndMouseCapture( DC );        GetScreen()->m_BlockLocate.SetState( state );        GetScreen()->m_BlockLocate.SetCommand( command );        m_canvas->SetMouseCapture( DrawAndSizingBlockOutlines, AbortBlockCurrentCommand );        SetCrossHairPosition( wxPoint(  GetScreen()->m_BlockLocate.GetRight(),                                        GetScreen()->m_BlockLocate.GetBottom() ) );        m_canvas->MoveCursorToCrossHair();    }    switch( GetScreen()->m_BlockLocate.GetCommand() )    {    case  BLOCK_IDLE:        DisplayError( this, wxT( "Error in HandleBlockPLace" ) );        break;    case BLOCK_DRAG:        // Drag    case BLOCK_MOVE:        // Move    case BLOCK_COPY:        // Copy        itemsCount = MarkItemsInBloc( currentModule, GetScreen()->m_BlockLocate );        if( itemsCount )        {            nextcmd = true;            if( m_canvas->IsMouseCaptured() )            {                m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );                m_canvas->SetMouseCaptureCallback( DrawMovingBlockOutlines );                m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );            }            GetScreen()->m_BlockLocate.SetState( STATE_BLOCK_MOVE );            m_canvas->Refresh( true );        }        break;    case BLOCK_PRESELECT_MOVE:     // Move with preselection list        nextcmd = true;        m_canvas->SetMouseCaptureCallback( DrawMovingBlockOutlines );        GetScreen()->m_BlockLocate.SetState( STATE_BLOCK_MOVE );        break;    case BLOCK_DELETE:     // Delete        itemsCount = MarkItemsInBloc( currentModule, GetScreen()->m_BlockLocate );        if( itemsCount )            SaveCopyInUndoList( currentModule, UR_MODEDIT );        DeleteMarkedItems( currentModule );        break;    case BLOCK_SAVE:     // Save    case BLOCK_PASTE:        break;    case BLOCK_ROTATE:        itemsCount = MarkItemsInBloc( currentModule, GetScreen()->m_BlockLocate );        if( itemsCount )            SaveCopyInUndoList( currentModule, UR_MODEDIT );        RotateMarkedItems( currentModule, GetScreen()->m_BlockLocate.Centre() );        break;    case BLOCK_MIRROR_X:    case BLOCK_MIRROR_Y:    case BLOCK_FLIP:     // mirror        itemsCount = MarkItemsInBloc( currentModule, GetScreen()->m_BlockLocate );        if( itemsCount )            SaveCopyInUndoList( currentModule, UR_MODEDIT );        MirrorMarkedItems( currentModule, GetScreen()->m_BlockLocate.Centre() );        break;    case BLOCK_ZOOM:     // Window Zoom        Window_Zoom( GetScreen()->m_BlockLocate );        break;    case BLOCK_ABORT:        break;    case BLOCK_SELECT_ITEMS_ONLY:        break;    }//.........这里部分代码省略.........
开发者ID:ianohara,项目名称:kicad-source-mirror,代码行数:101,


示例21: StrPrintf

bool PCB_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, int aCtl ){    // This is for python:    if( aFileSet.size() != 1 )    {        UTF8 msg = StrPrintf( "Pcbnew:%s() takes only a single filename", __func__ );        DisplayError( this, msg );        return false;    }    wxString fullFileName( aFileSet[0] );    // We insist on caller sending us an absolute path, if it does not, we say it's a bug.    wxASSERT_MSG( wxFileName( fullFileName ).IsAbsolute(),        wxT( "bug in single_top.cpp or project manager." ) );    if( !LockFile( fullFileName ) )    {        wxString msg = wxString::Format( _(                "PCB file '%s' is already open." ),                GetChars( fullFileName )                );        DisplayError( this, msg );        return false;    }    if( GetScreen()->IsModify() )    {        int response = YesNoCancelDialog( this, _(            "The current board has been modified.  Do you wish to save the changes?" ),            wxEmptyString,            _( "Save and Load" ),            _( "Load Without Saving" )            );        if( response == wxID_CANCEL )            return false;        else if( response == wxID_YES )            SavePcbFile( GetBoard()->GetFileName(), CREATE_BACKUP_FILE );        else        {            // response == wxID_NO, fall thru        }    }    wxFileName pro = fullFileName;    pro.SetExt( ProjectFileExtension );    bool is_new = !wxFileName::IsFileReadable( fullFileName );    // If its a non-existent schematic and caller thinks it exists    if( is_new && !( aCtl & KICTL_CREATE ) )    {        // notify user that fullFileName does not exist, ask if user wants to create it.        wxString ask = wxString::Format( _(                "Board '%s' does not exist.  Do you wish to create it?" ),                GetChars( fullFileName )                );        if( !IsOK( this, ask ) )            return false;    }    Clear_Pcb( false );     // pass false since we prompted above for a modified board    IO_MGR::PCB_FILE_T  pluginType = plugin_type( fullFileName, aCtl );    bool converted =  pluginType != IO_MGR::LEGACY && pluginType != IO_MGR::KICAD;    if( !converted )    {        // PROJECT::SetProjectFullName() is an impactful function.  It should only be        // called under carefully considered circumstances.        // The calling code should know not to ask me here to change projects unless        // it knows what consequences that will have on other KIFACEs running and using        // this same PROJECT.  It can be very harmful if that calling code is stupid.        Prj().SetProjectFullName( pro.GetFullPath() );        // load project settings before BOARD        LoadProjectSettings();    }    if( is_new )    {        OnModify();    }    else    {        BOARD* loadedBoard = 0;   // it will be set to non-NULL if loaded OK        PLUGIN::RELEASER pi( IO_MGR::PluginFind( pluginType ) );        try        {            PROPERTIES  props;            char        xbuf[30];            char        ybuf[30];            // EAGLE_PLUGIN can use this info to center the BOARD, but it does not yet.            sprintf( xbuf, "%d", GetPageSizeIU().x );//.........这里部分代码省略.........
开发者ID:chgans,项目名称:kicad,代码行数:101,


示例22: Retrace

//.........这里部分代码省略.........                p_dir = HOLE_NORTH;                break;            case FROM_EAST:                p_dir = HOLE_EAST;                break;            case FROM_SOUTH:                p_dir = HOLE_SOUTH;                break;            case FROM_WEST:                p_dir = HOLE_WEST;                break;            case FROM_NORTHEAST:                p_dir = HOLE_NORTHEAST;                break;            case FROM_SOUTHEAST:                p_dir = HOLE_SOUTHEAST;                break;            case FROM_SOUTHWEST:                p_dir = HOLE_SOUTHWEST;                break;            case FROM_NORTHWEST:                p_dir = HOLE_NORTHWEST;                break;            case FROM_OTHERSIDE:            default:                DisplayError( pcbframe, wxT( "Retrace: error 1" ) );                return 0;            }            OrCell_Trace( pcbframe->GetBoard(), r1, c1, s1, p_dir, current_net_code );        }        else        {            if( ( y == FROM_NORTH || y == FROM_NORTHEAST                  || y == FROM_EAST || y == FROM_SOUTHEAST                  || y == FROM_SOUTH || y == FROM_SOUTHWEST                  || y == FROM_WEST || y == FROM_NORTHWEST )               && ( x == FROM_NORTH || x == FROM_NORTHEAST                    || x == FROM_EAST || x == FROM_SOUTHEAST                    || x == FROM_SOUTH || x == FROM_SOUTHWEST                    || x == FROM_WEST || x == FROM_NORTHWEST                    || x == FROM_OTHERSIDE )               && ( ( b = bit[y - 1][x - 1] ) != 0 ) )            {                OrCell_Trace( pcbframe->GetBoard(), r1, c1, s1, b, current_net_code );                if( b & HOLE )                    OrCell_Trace( pcbframe->GetBoard(), r2, c2, s2, HOLE, current_net_code );            }            else            {                wxMessageBox( wxT( "Retrace: error 2" ) );                return 0;            }        }        if( ( r2 == row_source ) && ( c2 == col_source ) ) /* see if source */        {
开发者ID:johnbeard,项目名称:kicad-source-mirror,代码行数:67,


示例23: r4300i_SB

void _fastcall r4300i_SB (void) {	DWORD Address =  GPR[Opcode.base].UW[0] + (short)Opcode.offset;		if (!r4300i_SB_VAddr(Address,GPR[Opcode.rt].UB[0])) {		DisplayError("SB TLB: %X",Address);	}}
开发者ID:TwitchPlaysPokemon,项目名称:project64,代码行数:6,


示例24: GetBoard

void PCB_EDIT_FRAME::ReadMacros(){    wxFileName fn;    fn = GetBoard()->GetFileName();    fn.SetExt( MacrosFileExtension );    wxFileDialog dlg( this, _( "Read Macros File" ), fn.GetPath(),                      fn.GetFullName(), MacrosFileWildcard,                      wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_CHANGE_DIR );    if( dlg.ShowModal() == wxID_CANCEL )        return;    if( !wxFileExists( dlg.GetPath() ) )    {        wxString msg;        msg.Printf( _( "File %s not found" ), GetChars( dlg.GetPath() ) );        DisplayError( this, msg );        return;    }    wxXmlDocument xml;    xml.SetFileEncoding( wxT( "UTF-8" ) );    if( !xml.Load( dlg.GetFilename() ) )            return;    XNODE *macrosNode = (XNODE*) xml.GetRoot()->GetChildren();    while( macrosNode )    {        int number = -1;        if( macrosNode->GetName() == wxT( "macros" ) )        {            number = wxAtoi( macrosNode->GetAttribute( wxT( "number" ), wxT( "-1" ) ) );            if( number >= 0  && number < 10 )            {                m_Macros[number].m_Record.clear();                XNODE *hotkeyNode = macrosNode->GetChildren();                while( hotkeyNode )                {                    if( hotkeyNode->GetName() == wxT( "hotkey" ) )                    {                        int x = wxAtoi( hotkeyNode->GetAttribute( wxT( "x" ), wxT( "0" ) ) );                        int y = wxAtoi( hotkeyNode->GetAttribute( wxT( "y" ), wxT( "0" ) ) );                        int hk = wxAtoi( hotkeyNode->GetAttribute( wxT( "hkcode" ), wxT( "0" ) ) );                        MACROS_RECORD macros_record;                        macros_record.m_HotkeyCode = hk;                        macros_record.m_Position.x = x;                        macros_record.m_Position.y = y;                        m_Macros[number].m_Record.push_back( macros_record );                    }                    hotkeyNode = hotkeyNode->GetNext();                }            }        }        macrosNode = macrosNode->GetNext();    }}
开发者ID:chgans,项目名称:kicad,代码行数:68,


示例25: while

EDA_BaseStruct * WinEDA_SchematicFrame::FindMarker(int SearchType)/*****************************************************************//* Search de markers in whole the hierarchy.	Mouse cursor is put on the marker	SearchType = 0: searche th first marker, else search next marker*/{SCH_SCREEN * Screen, * FirstScreen = NULL;EDA_BaseStruct *DrawList, *FirstStruct = NULL, *Struct = NULL;DrawMarkerStruct * Marker = NULL;int NotFound, StartCount;wxPoint firstpos, pos;wxSize size = DrawPanel->GetClientSize();wxPoint curpos;bool force_recadre = FALSE;wxString msg, WildText;		g_LastSearchIsMarker = TRUE;	Screen = ScreenSch;	if( SearchType == 0 ) MarkerCount = 0;	NotFound = TRUE; StartCount = 0;	for ( ; Screen != NULL; Screen = Screen->Next() )	{		DrawList = Screen->EEDrawList;		while ( DrawList && NotFound )		{			if(DrawList->m_StructType == DRAW_MARKER_STRUCT_TYPE )			{			Marker = (DrawMarkerStruct *) DrawList;				NotFound = FALSE;				pos = Marker->m_Pos;				if ( FirstScreen == NULL )	/* First item found */				{					FirstScreen = Screen; firstpos = pos;					FirstStruct = DrawList;				}					StartCount++;				if( MarkerCount >= StartCount )				{					NotFound = TRUE;	/* Search for the next item */				}				else				{					Struct = DrawList; MarkerCount++; break ;				}			}			DrawList = DrawList->Pnext;		}		if( NotFound == FALSE ) break;	}	if( NotFound && FirstScreen )	{		NotFound = 0; Screen = FirstScreen; Struct = FirstStruct;		pos = firstpos; MarkerCount = 1;	}	if( NotFound == 0)	{		if ( Screen != GetScreen() )		{			Screen->SetZoom(GetScreen()->GetZoom() );			m_CurrentScreen = ActiveScreen = Screen;			force_recadre = TRUE;		}		Screen->m_Curseur = pos;		curpos = DrawPanel->CursorScreenPosition();		DrawPanel->GetViewStart(&m_CurrentScreen->m_StartVisu.x,								&m_CurrentScreen->m_StartVisu.y);		// calcul des coord curseur avec origine = screen		curpos.x -= m_CurrentScreen->m_StartVisu.x;		curpos.y -= m_CurrentScreen->m_StartVisu.y;		/* Il y a peut-etre necessite de recadrer le dessin: */		if( (curpos.x <= 0) || (curpos.x >= size.x-1) ||			(curpos.y <= 0) || (curpos.y >= size.y) || force_recadre )		{			Recadre_Trace(TRUE);		}		else		{			GRMouseWarp(DrawPanel, curpos );		}		msg = _("Marker found in ") + Screen->m_FileName;		Affiche_Message(msg);	}	else	{		Affiche_Message(wxEmptyString);		msg = _("Marker Not Found");		DisplayError(NULL,msg, 10);	}		return Marker;//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:kicad-svn,代码行数:101,


示例26: system_

char* system_(char* cmd) {  HANDLE hOutputReadTmp,hOutputRead,hOutputWrite;  HANDLE hInputWriteTmp,hInputRead,hInputWrite;  HANDLE hErrorWrite;  SECURITY_ATTRIBUTES sa;  CHAR lpBuffer[256];  DWORD nBytesRead;  DWORD ExitCode;  PROCESS_INFORMATION pi;  STARTUPINFO si;  char* ret=q("");  sa.nLength= sizeof(SECURITY_ATTRIBUTES);  sa.lpSecurityDescriptor = NULL;  sa.bInheritHandle = TRUE;  if (!CreatePipe(&hOutputReadTmp,&hOutputWrite,&sa,0))    DisplayError("CreatePipe");  if (!DuplicateHandle(GetCurrentProcess(),hOutputWrite,                       GetCurrentProcess(),&hErrorWrite,0,                       TRUE,DUPLICATE_SAME_ACCESS))    DisplayError("DuplicateHandle");  if (!CreatePipe(&hInputRead,&hInputWriteTmp,&sa,0))    DisplayError("CreatePipe");  if (!DuplicateHandle(GetCurrentProcess(),hOutputReadTmp,                       GetCurrentProcess(),                       &hOutputRead,0,FALSE,                       DUPLICATE_SAME_ACCESS))    DisplayError("DupliateHandle");  if (!DuplicateHandle(GetCurrentProcess(),hInputWriteTmp,                       GetCurrentProcess(),                       &hInputWrite,0,FALSE,                       DUPLICATE_SAME_ACCESS))    DisplayError("DupliateHandle");  if (!CloseHandle(hOutputReadTmp)) DisplayError("CloseHandle");  if (!CloseHandle(hInputWriteTmp)) DisplayError("CloseHandle");  ZeroMemory(&si,sizeof(STARTUPINFO));  si.cb = sizeof(STARTUPINFO);  si.dwFlags = STARTF_USESTDHANDLES;  si.hStdOutput = hOutputWrite;  si.hStdInput  = hInputRead;  si.hStdError  = hErrorWrite;  if (!CreateProcess(NULL,cmd,NULL,NULL,TRUE,0,NULL,NULL,&si,&pi))    DisplayError("CreateProcess");  if (!CloseHandle(pi.hThread)) DisplayError("CloseHandle");  if (!CloseHandle(hOutputWrite)) DisplayError("CloseHandle");  if (!CloseHandle(hInputRead )) DisplayError("CloseHandle");  if (!CloseHandle(hErrorWrite)) DisplayError("CloseHandle");  while(1) {    if (!ReadFile(hOutputRead,lpBuffer,sizeof(lpBuffer),                  &nBytesRead,NULL) || !nBytesRead) {      if (GetLastError() == ERROR_BROKEN_PIPE)        break;      else        DisplayError("ReadFile");    }    lpBuffer[nBytesRead]='/0';    ret=s_cat(ret,q(lpBuffer),NULL);  }  if (!CloseHandle(hOutputRead)) DisplayError("CloseHandle");  if (!CloseHandle(hInputWrite)) DisplayError("CloseHandle");  if (!GetExitCodeProcess(pi.hProcess,&ExitCode) || ExitCode) {    s(ret);    ret=NULL;  }  return ret;}
开发者ID:JamesTFarrington,项目名称:roswell,代码行数:70,


示例27: SetupDSoundBuffers

void SetupDSoundBuffers(void) {	LPDIRECTSOUNDBUFFER lpdsb;    DSBUFFERDESC        dsPrimaryBuff, dsbdesc;    WAVEFORMATEX        wfm;    HRESULT             hr;	int count;    if (lpdsbuf) { CloseDLL(); InitiateAudio(AudioInfo);}    if ( FAILED( hr = DirectSoundCreate( NULL, &lpds, NULL ) ) ) {        return FALSE;	}    if ( FAILED( hr = IDirectSound8_SetCooperativeLevel(lpds, AudioInfo.hwnd, DSSCL_PRIORITY   ))) {        return FALSE;	}    for ( count = 0; count < NUMCAPTUREEVENTS; count++ ) {        rghEvent[count] = CreateEvent( NULL, FALSE, FALSE, NULL );        if (rghEvent[count] == NULL ) { return FALSE; }    }	memset( &dsPrimaryBuff, 0, sizeof( DSBUFFERDESC ) );     	dsPrimaryBuff.dwSize        = sizeof( DSBUFFERDESC );     dsPrimaryBuff.dwFlags       = DSBCAPS_PRIMARYBUFFER;     dsPrimaryBuff.dwBufferBytes = 0;      dsPrimaryBuff.lpwfxFormat   = NULL;     memset( &wfm, 0, sizeof( WAVEFORMATEX ) ); 	wfm.wFormatTag = WAVE_FORMAT_PCM;	wfm.nChannels = 2;	wfm.nSamplesPerSec = 44100;	wfm.wBitsPerSample = 16;	wfm.nBlockAlign = wfm.wBitsPerSample / 8 * wfm.nChannels;	wfm.nAvgBytesPerSec = wfm.nSamplesPerSec * wfm.nBlockAlign;	hr = IDirectSound8_CreateSoundBuffer(lpds,&dsPrimaryBuff, &lpdsb, NULL);		if (SUCCEEDED ( hr ) ) {		IDirectSoundBuffer8_SetFormat(lpdsb, &wfm );	    IDirectSoundBuffer8_Play(lpdsb, 0, 0, DSBPLAY_LOOPING );	}	wfm.nSamplesPerSec = Frequency;	wfm.wBitsPerSample = 16;	wfm.nBlockAlign = wfm.wBitsPerSample / 8 * wfm.nChannels;	wfm.nAvgBytesPerSec = wfm.nSamplesPerSec * wfm.nBlockAlign;    memset( &dsbdesc, 0, sizeof( DSBUFFERDESC ) );     dsbdesc.dwSize = sizeof( DSBUFFERDESC );     dsbdesc.dwFlags = DSBCAPS_GLOBALFOCUS | DSBCAPS_CTRLPOSITIONNOTIFY;    dsbdesc.dwBufferBytes = BufferSize * 3;      dsbdesc.lpwfxFormat = &wfm; 	if ( FAILED( hr = IDirectSound8_CreateSoundBuffer(lpds, &dsbdesc, &lpdsbuf, NULL ) ) ) {		DisplayError("Failed in creation of Play buffer 1");		}	FillBufferWithSilence( lpdsbuf );    rgdscbpn[0].dwOffset = ( BufferSize ) - 1;    rgdscbpn[0].hEventNotify = rghEvent[0];    rgdscbpn[1].dwOffset = ( BufferSize * 2) - 1;    rgdscbpn[1].hEventNotify = rghEvent[1];    rgdscbpn[2].dwOffset = ( BufferSize * 3) - 1;    rgdscbpn[2].hEventNotify = rghEvent[2];    rgdscbpn[3].dwOffset = DSBPN_OFFSETSTOP;    rgdscbpn[3].hEventNotify = rghEvent[3];    if ( FAILED( hr = IDirectSound8_QueryInterface(lpdsbuf, &IID_IDirectSoundNotify, ( VOID ** )&lpdsNotify ) ) ) {		DisplayError("IDirectSound8_QueryInterface: Failed/n");		return;	}    // Set capture buffer notifications.    if ( FAILED( hr = IDirectSoundNotify_SetNotificationPositions(lpdsNotify, NUMCAPTUREEVENTS, rgdscbpn ) ) ) {		DisplayError("IDirectSoundNotify_SetNotificationPositions: Failed");		return;    }	//AddEffect();}
开发者ID:J301GH,项目名称:emu-1964,代码行数:81,



注:本文中的DisplayError函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ DisplayHeightMM函数代码示例
C++ Display函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。