本文整理汇总了C++中DisplayError函数的典型用法代码示例。如果您正苦于以下问题:C++ DisplayError函数的具体用法?C++ DisplayError怎么用?C++ DisplayError使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了DisplayError函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
//.........这里部分代码省略.........
示例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");
//.........这里部分代码省略.........
示例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" ) );
}
}
示例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;
}
}
示例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;
}
示例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:
//.........这里部分代码省略.........
示例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();
//.........这里部分代码省略.........
示例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:
//.........这里部分代码省略.........
示例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();
}
示例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;
}
示例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;
}
}
示例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;
}
示例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)
//.........这里部分代码省略.........
示例14: EditTagsDialog
LRESULT CALLBACK
EditTagsDialog(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
//.........这里部分代码省略.........
示例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;
}