Пример #1
0
void cceMaterialShaderEditorDialog::UpdateGUIFromShader()
{
  assert (_shader);
  _gui.lineEditName->setText (GetEditorName(_shader->GetName ()));
  _gui.comboBoxType->setCurrentIndex(_shader->GetType());
  _textEditor->setPlainText(_shader->GetCode());
}
Пример #2
0
bool cceMaterialShaderEditorDialog::ShaderChanged ()
{
  if (!_shader)
    {
      return false;
    }
	return _gui.lineEditName->text() != GetEditorName(_shader->GetName())
      || _gui.comboBoxType->currentIndex() != (int)_shader->GetType()
      || _textEditor->toPlainText() != _shader->GetCode();
}
Пример #3
0
void WinEDA_GerberFrame::Process_Special_Functions(wxCommandEvent& event)
/********************************************************************************/
/* Traite les selections d'outils et les commandes appelees du menu POPUP
*/
{
int id = event.GetId();
int layer = GetScreen()->m_Active_Layer;
GERBER_Descr * gerber_layer	= g_GERBER_Descr_List[layer];
wxPoint pos;
wxClientDC dc(DrawPanel);

	DrawPanel->PrepareGraphicContext(&dc);

	wxGetMousePosition(&pos.x, &pos.y);

	pos.y += 20;

	switch ( id )	// Arret eventuel de la commande de déplacement en cours
	{
		case wxID_CUT:
		case wxID_COPY:
		case ID_POPUP_DELETE_BLOCK:
		case ID_POPUP_PLACE_BLOCK:
		case ID_POPUP_ZOOM_BLOCK:
		case ID_POPUP_INVERT_BLOCK:
		case ID_POPUP_ROTATE_BLOCK:
		case ID_POPUP_COPY_BLOCK:
			break;

		case ID_POPUP_CANCEL_CURRENT_COMMAND:
			if( GetScreen()->ManageCurseur &&
				GetScreen()->ForceCloseManageCurseur )
				{
				GetScreen()->ForceCloseManageCurseur(this, &dc);
				}
			/* ne devrait pas etre execute, sauf bug */
			if (m_CurrentScreen->BlockLocate.m_Command != BLOCK_IDLE)
			{
				m_CurrentScreen->BlockLocate.m_Command = BLOCK_IDLE;
				m_CurrentScreen->BlockLocate.m_State = STATE_NO_BLOCK;
				m_CurrentScreen->BlockLocate.m_BlockDrawStruct = NULL;
			}
			if (m_ID_current_state == 0 )
				SetToolID(0, wxCURSOR_ARROW, wxEmptyString);
			else SetCursor(DrawPanel->m_PanelCursor = DrawPanel->m_PanelDefaultCursor);
			break;

		default:	// Arret dea commande de déplacement en cours
			if( GetScreen()->ManageCurseur &&
				GetScreen()->ForceCloseManageCurseur )
			{
				GetScreen()->ForceCloseManageCurseur(this, &dc);
			}
			SetToolID(0, wxCURSOR_ARROW, wxEmptyString);
			break;
	}

	switch ( id )	// Traitement des commandes
	{
		case ID_EXIT :
			Close(TRUE);
			break;

		case ID_NEW_PROJECT:
		case ID_LOAD_PROJECT:
			Files_io(event);
			break;

		case ID_PCB_GLOBAL_DELETE:
			Erase_Current_Layer(&dc, TRUE);
			break;

		case wxID_CUT:
			break;

		case wxID_COPY:
			break;

		case wxID_PASTE:
//			HandleBlockBegin(&dc, BLOCK_PASTE);
			break;

		case ID_UNDO_BUTT:
			UnDeleteItem(&dc);
			break;

		case ID_GET_TOOLS:
//			InstallToolsFrame(this, wxPoint(-1,-1) );
			break;

		case ID_FIND_ITEMS:
//			InstallFindFrame(this, pos);
			break;


		case ID_BUS_BUTT:
			SetToolID( id, wxCURSOR_PENCIL, wxT("Add Tracks"));
			break;

		case ID_LINE_COMMENT_BUTT:
			SetToolID( id, wxCURSOR_PENCIL, wxT("Add Drawing"));
			break;

		case ID_TEXT_COMMENT_BUTT:
			SetToolID( id, wxCURSOR_PENCIL, wxT("Add Text"));
			break;

		case ID_NO_SELECT_BUTT:
			SetToolID( 0, 0, wxEmptyString);
			break;

		case ID_POPUP_CLOSE_CURRENT_TOOL:
			SetToolID( 0, wxCURSOR_ARROW, wxEmptyString);
			break;

		case ID_POPUP_CANCEL_CURRENT_COMMAND:
			break;

		case ID_POPUP_END_LINE:
			DrawPanel->MouseToCursorSchema();
//			EndSegment(&dc);
			break;

		case ID_POPUP_PCB_DELETE_TRACKSEG:
			DrawPanel->MouseToCursorSchema();
			if ( GetScreen()->m_CurrentItem == NULL) break;
			Delete_Segment(&dc, (TRACK*)GetScreen()->m_CurrentItem);
			GetScreen()->m_CurrentItem = NULL;
			GetScreen()->SetModify();
			break;

		case ID_PCB_DELETE_ITEM_BUTT:
			SetToolID( id, wxCURSOR_PENCIL, wxT("Delete item"));
			break;

		case ID_POPUP_SCH_MOVE_ITEM_REQUEST:
			DrawPanel->MouseToCursorSchema();
			Process_Move_Item(this, GetScreen()->m_CurrentItem, &dc);
			break;

		case ID_TOOLBARH_PCB_SELECT_LAYER:
			{
			GetScreen()->m_Active_Layer = m_SelLayerBox->GetSelection();
			DrawPanel->Refresh(TRUE);
			break;
			}

		case ID_TOOLBARH_GERBER_SELECT_TOOL:
			if ( gerber_layer )
			{
				int tool = m_SelLayerTool->GetSelection();
				if ( tool > 0 ) tool = tool - 1 + FIRST_DCODE;
				else tool = 0;
				gerber_layer->m_Selected_Tool = tool;
				DrawPanel->Refresh(TRUE);
			}
			else DisplayError(this, _("No layer selected") );
			break;

		case ID_GERBVIEW_SHOW_LIST_DCODES:
			Liste_D_Codes(&dc);
			break;

		case ID_GERBVIEW_SHOW_SOURCE:
			if ( gerber_layer )
			{
			wxString editorname = GetEditorName();
			if ( ! editorname.IsEmpty() )
				ExecuteFile(this, editorname, gerber_layer->m_FileName);
			}
			break;

		case ID_POPUP_PLACE_BLOCK:
			GetScreen()->BlockLocate.m_Command = BLOCK_MOVE;
			DrawPanel->m_AutoPAN_Request = FALSE;
			HandleBlockPlace(&dc);
			break;

		case ID_POPUP_COPY_BLOCK:
			GetScreen()->BlockLocate.m_Command = BLOCK_COPY;
			m_CurrentScreen->BlockLocate.SetMessageBlock(this);
			DrawPanel->m_AutoPAN_Request = FALSE;
			HandleBlockEnd(&dc);
			break;

		case ID_POPUP_ZOOM_BLOCK:
			GetScreen()->BlockLocate.m_Command = BLOCK_ZOOM;
			m_CurrentScreen->BlockLocate.SetMessageBlock(this);
			m_CurrentScreen->BlockLocate.SetMessageBlock(this);
			HandleBlockEnd(&dc);
			break;

		case ID_POPUP_DELETE_BLOCK:
			GetScreen()->BlockLocate.m_Command = BLOCK_DELETE;
			m_CurrentScreen->BlockLocate.SetMessageBlock(this);
			HandleBlockEnd(&dc);
			break;

		default:
			wxMessageBox( wxT("WinEDA_GerberFrame::Process_Special_Functions error"));
			break;
	}

	SetToolbars();
}
Пример #4
0
void WinEDA_MainFrame::Process_Fct(wxCommandEvent& event)
/*********************************************************/
{
int id = event.GetId();
wxString FullFileName = m_PrjFileName;


	switch (id)
		{
		case ID_TO_PCB:
			ChangeFileNameExt(FullFileName, g_BoardExtBuffer);
			AddDelimiterString(FullFileName);
			ExecuteFile(this, PCBNEW_EXE, FullFileName);
			break;

		case ID_TO_CVPCB:
			ChangeFileNameExt(FullFileName, g_NetlistExtBuffer);
			AddDelimiterString(FullFileName);
			ExecuteFile(this, CVPCB_EXE, FullFileName);
			break;

		case ID_TO_EESCHEMA:
			ChangeFileNameExt(FullFileName, g_SchExtBuffer);
			AddDelimiterString(FullFileName);
			ExecuteFile(this, EESCHEMA_EXE, FullFileName);
			break;

		case ID_TO_GERBVIEW:
			FullFileName = wxGetCwd() + STRING_DIR_SEP;
			AddDelimiterString(FullFileName);
			ExecuteFile(this, GERBVIEW_EXE, FullFileName);
			break;

		case ID_TO_EDITOR:
		{
			wxString editorname = GetEditorName();
			if ( !editorname.IsEmpty() )
				ExecuteFile(this, editorname, wxEmptyString);
		}
			break;

		case ID_BROWSE_AN_SELECT_FILE:
			{
			wxString mask(wxT("*")), extension;
#ifdef __WINDOWS__
			mask += wxT(".*");
			extension = wxT(".*");
#endif
			FullFileName = EDA_FileSelector( _("Load file:"),
					wxGetCwd(),		  	/* Defualt path */
					wxEmptyString,		/* default filename */
					extension,			/* default ext. */
					mask,				/* mask for filename filter */
					this,
					wxOPEN,
					TRUE
					);
			if ( ! FullFileName.IsEmpty() )
				{
				wxString fullnamewithquotes;
				fullnamewithquotes = wxT("\"") + FullFileName;
				fullnamewithquotes += wxT("\"");
				wxString editorname = GetEditorName();
				if ( ! editorname.IsEmpty() )
					ExecuteFile(this, editorname, fullnamewithquotes);
				}
			}
			break;

			break;
		default: DisplayError(this, wxT("WinEDA_MainFrame::Process_Fct Internal Error"));
			break;
		}

}
Пример #5
0
void WinEDA_ErcFrame::TestErc(wxCommandEvent& event)
/**************************************************/
{
    ObjetNetListStruct * NetItemRef, * OldItem, * StartNet, * Lim;
    int NetNbItems, MinConn;

    if ( ! DiagErcTableInit )
    {
        memcpy(DiagErc, DefaultDiagErc, sizeof (DefaultDiagErc));
        DiagErcTableInit = TRUE;
    }

    WriteFichierERC = m_WriteResultOpt->GetValue();

    if( CheckAnnotate(m_Parent, 0) )
    {
        DisplayError(this, _("Annotation Required!") );
        return;
    }

    /* Effacement des anciens marqueurs DRC */
    DelERCMarkers(event);

    wxClientDC dc(m_Parent->DrawPanel);

    m_Parent->DrawPanel->PrepareGraphicContext(&dc);

    g_EESchemaVar.NbErrorErc = 0;
    g_EESchemaVar.NbWarningErc = 0;

    SchematicCleanUp(&dc);

    BuildNetList(m_Parent, ScreenSch);

    /* Analyse de la table des connexions : */
    Lim = g_TabObjNet + g_NbrObjNet;

    /* Reset du flag m_FlagOfConnection, utilise par la suite */
    for (NetItemRef = g_TabObjNet; NetItemRef < Lim; NetItemRef ++ )
        NetItemRef->m_FlagOfConnection = (IsConnectType) 0;

    NetNbItems = 0;
    MinConn = NOC;
    StartNet = OldItem = NetItemRef = g_TabObjNet;
    for ( ; NetItemRef < Lim; NetItemRef ++ )
    {
        /* Tst changement de net */
        if( OldItem->m_NetCode != NetItemRef->m_NetCode)
        {
            MinConn = NOC;
            NetNbItems = 0;
            StartNet = NetItemRef;
        }

        switch ( NetItemRef->m_Type )
        {
        case NET_SEGMENT:
        case NET_BUS:
        case NET_JONCTION:
        case NET_LABEL:
        case NET_BUSLABELMEMBER:
        case NET_PINLABEL:
            break;

        case NET_GLOBLABEL:
        case NET_GLOBBUSLABELMEMBER:
        case NET_SHEETLABEL:
        case NET_SHEETBUSLABELMEMBER:
            TestLabel(m_Parent->DrawPanel, &dc, NetItemRef, StartNet);
            break;

        case NET_NOCONNECT:
            MinConn = NET_NC;
            if( NetNbItems != 0 )
                Diagnose(m_Parent->DrawPanel, &dc, NetItemRef, NULL, MinConn, UNC);
            break;

        case NET_PIN:
            TestOthersItems(m_Parent->DrawPanel, &dc,
                            NetItemRef, StartNet, &NetNbItems , &MinConn);
            break;
        }
        OldItem = NetItemRef;
    }

    FreeTabNetList(g_TabObjNet, g_NbrObjNet );

    wxString num;
    num.Printf(wxT("%d"), g_EESchemaVar.NbErrorErc);
    m_TotalErrCount->SetLabel(num);

    num.Printf(wxT("%d"), g_EESchemaVar.NbErrorErc-g_EESchemaVar.NbWarningErc);
    m_LastErrCount->SetLabel(num);

    num.Printf(wxT("%d"), g_EESchemaVar.NbWarningErc);
    m_LastWarningCount->SetLabel(num);

    /* Generation ouverture fichier diag */
    if( WriteFichierERC == TRUE )
    {
        wxString ErcFullFileName;
        ErcFullFileName = ScreenSch->m_FileName;
        ChangeFileNameExt(ErcFullFileName, wxT(".erc"));
        ErcFullFileName = EDA_FileSelector(_("ERC file:"),
                                           wxEmptyString,					/* Chemin par defaut */
                                           ErcFullFileName,	/* nom fichier par defaut */
                                           wxT(".erc"),				/* extension par defaut */
                                           wxT("*.erc"),			/* Masque d'affichage */
                                           this,
                                           wxSAVE,
                                           TRUE
                                          );
        if ( ErcFullFileName.IsEmpty()) return;

        if ( WriteDiagnosticERC(ErcFullFileName) )
        {
            Close(TRUE);
            wxString editorname = GetEditorName();
            AddDelimiterString(ErcFullFileName);
            ExecuteFile(this, editorname, ErcFullFileName);
        }
    }
}