bool EDA_3D_VIEWER::Set3DBoardBodyColorFromUser() { wxColourData definedColors; unsigned int i = 0; definedColors.SetCustomColour( i++, wxColour( 51, 43, 22 ) ); // FR4 natural, dark definedColors.SetCustomColour( i++, wxColour( 109, 116, 75 ) ); // FR4 natural definedColors.SetCustomColour( i++, wxColour( 78, 14, 5 ) ); // brown/red definedColors.SetCustomColour( i++, wxColour( 146, 99, 47 ) ); // brown 1 definedColors.SetCustomColour( i++, wxColour( 160, 123, 54 ) ); // brown 2 definedColors.SetCustomColour( i++, wxColour( 146, 99, 47 ) ); // brown 3 definedColors.SetCustomColour( i++, wxColour( 63, 126, 71 ) ); // green 1 definedColors.SetCustomColour( i++, wxColour( 117, 122, 90 ) ); // green 2 for(; i < wxColourData::NUM_CUSTOM;) { definedColors.SetCustomColour( i++, wxColour( 0, 0, 0 ) ); } bool change = Set3DColorFromUser( m_settings.m_BoardBodyColor, _( "Board Body Color" ), &definedColors ); if( change ) NewDisplay(); return change; }
bool EDA_3D_VIEWER::Set3DSolderMaskColorFromUser() { wxColourData definedColors; unsigned int i = 0; definedColors.SetCustomColour( i++, wxColour( 20, 51, 36 ) ); // Green definedColors.SetCustomColour( i++, wxColour( 91, 168, 12 ) ); // Light Green definedColors.SetCustomColour( i++, wxColour( 13, 104, 11 ) ); // Saturated Green definedColors.SetCustomColour( i++, wxColour(181, 19, 21 ) ); // Red definedColors.SetCustomColour( i++, wxColour(239, 53, 41 ) ); // Red Light Orange definedColors.SetCustomColour( i++, wxColour(210, 40, 14 ) ); // Red 2 definedColors.SetCustomColour( i++, wxColour( 2, 59, 162 ) ); // Blue definedColors.SetCustomColour( i++, wxColour( 54, 79, 116 ) ); // Light blue 1 definedColors.SetCustomColour( i++, wxColour( 61, 85, 130 ) ); // Light blue 2 definedColors.SetCustomColour( i++, wxColour( 21, 70, 80 ) ); // Green blue (dark) definedColors.SetCustomColour( i++, wxColour( 11, 11, 11 ) ); // Black definedColors.SetCustomColour( i++, wxColour( 245, 245,245 ) ); // White definedColors.SetCustomColour( i++, wxColour(119, 31, 91 ) ); // Purple definedColors.SetCustomColour( i++, wxColour( 32, 2, 53 ) ); // Purple Dark for(; i < wxColourData::NUM_CUSTOM;) { definedColors.SetCustomColour( i++, wxColour( 0, 0, 0 ) ); } bool change = Set3DColorFromUser( m_settings.m_SolderMaskColor, _( "Solder Mask Color" ), &definedColors ); if( change ) NewDisplay(); return change; }
void EDA_3D_FRAME::OnActivate( wxActivateEvent& event ) { // Reload data if 3D frame shows a footprint, // because it can be changed since last frame activation if( m_reloadRequest ) NewDisplay(); event.Skip(); // required under wxMAC }
static void addServers( char **srv, int bType ) { char *name, *class2; const char *dtx, *cls; struct display *d; for (; *srv; srv++) { if ((cls = strchr( *srv, '_' ))) { if (!StrNDup( &name, *srv, cls - *srv )) return; if (!StrDup( &class2, cls )) { free( name ); return; } } else { if (!StrDup( &name, *srv )) return; class2 = 0; } if ((d = FindDisplayByName( name ))) { if (d->class2) free( d->class2 ); dtx = "existing"; } else { if (!(d = NewDisplay( name ))) { free( name ); if (class2) free( class2 ); return; } dtx = "new"; } d->stillThere = 1; d->class2 = class2; d->displayType = (*name == ':' ? dLocal : dForeign) | bType; if ((bType & d_lifetime) == dReserve) { if (d->status == notRunning) d->status = reserve; } else { if (d->status == reserve) d->status = notRunning; } Debug( "found %s %s%s display: %s %s\n", dtx, ((d->displayType & d_location) == dLocal) ? "local" : "foreign", ((d->displayType & d_lifetime) == dReserve) ? " reserve" : "", d->name, d->class2 ); free( name ); } }
void EDA_3D_FRAME::On3DGridSelection( wxCommandEvent& event ) { int id = event.GetId(); for( int ii = ID_MENU3D_GRID; ii < ID_MENU3D_GRID_END; ii++ ) { if( event.GetId() == ii ) continue; GetMenuBar()->Check( ii, false ); } switch( id ) { case ID_MENU3D_GRID_NOGRID: g_Parm_3D_Visu.SetFlag( FL_GRID, false ); break; case ID_MENU3D_GRID_10_MM: g_Parm_3D_Visu.SetFlag( FL_GRID, true ); g_Parm_3D_Visu.m_3D_Grid = 10.0; break; case ID_MENU3D_GRID_5_MM: g_Parm_3D_Visu.SetFlag( FL_GRID, true ); g_Parm_3D_Visu.m_3D_Grid = 5.0; break; case ID_MENU3D_GRID_2P5_MM: g_Parm_3D_Visu.SetFlag( FL_GRID, true ); g_Parm_3D_Visu.m_3D_Grid = 2.5; break; case ID_MENU3D_GRID_1_MM: g_Parm_3D_Visu.SetFlag( FL_GRID, true ); g_Parm_3D_Visu.m_3D_Grid = 1.0; break; default: wxLogMessage( wxT( "EDA_3D_FRAME::On3DGridSelection() error: unknown command" ) ); return; } NewDisplay(); }
/* called to set the background color of the 3D scene */ void EDA_3D_FRAME::Set3DBgColor() { S3D_COLOR color; wxColour newcolor, oldcolor; oldcolor.Set( KiROUND( g_Parm_3D_Visu.m_BgColor.m_Red * 255 ), KiROUND( g_Parm_3D_Visu.m_BgColor.m_Green * 255 ), KiROUND( g_Parm_3D_Visu.m_BgColor.m_Blue * 255 ) ); newcolor = wxGetColourFromUser( this, oldcolor ); if( newcolor != oldcolor ) { g_Parm_3D_Visu.m_BgColor.m_Red = (double) newcolor.Red() / 255.0; g_Parm_3D_Visu.m_BgColor.m_Green = (double) newcolor.Green() / 255.0; g_Parm_3D_Visu.m_BgColor.m_Blue = (double) newcolor.Blue() / 255.0; NewDisplay(); } }
bool EDA_3D_VIEWER::Set3DSilkScreenColorFromUser() { wxColourData definedColors; unsigned int i = 0; definedColors.SetCustomColour( i++, wxColour( 241, 241, 241 ) ); // White definedColors.SetCustomColour( i++, wxColour( 4, 18, 21 ) ); // Dark for(; i < wxColourData::NUM_CUSTOM;) { definedColors.SetCustomColour( i++, wxColour( 0, 0, 0 ) ); } bool change = Set3DColorFromUser( m_settings.m_SilkScreenColor, _( "Silk Screen Color" ), &definedColors ); if( change ) NewDisplay(); return change; }
bool EDA_3D_VIEWER::Set3DSolderPasteColorFromUser() { wxColourData definedColors; unsigned int i = 0; definedColors.SetCustomColour( i++, wxColour( 128, 128, 128 ) ); // grey definedColors.SetCustomColour( i++, wxColour( 213, 213, 213 ) ); // Silver definedColors.SetCustomColour( i++, wxColour( 90, 90, 90 ) ); // grey 2 for(; i < wxColourData::NUM_CUSTOM;) { definedColors.SetCustomColour( i++, wxColour( 0, 0, 0 ) ); } bool change = Set3DColorFromUser( m_settings.m_SolderPasteColor, _( "Solder Paste Color" ), &definedColors ); if( change ) NewDisplay(); return change; }
bool EDA_3D_VIEWER::Set3DCopperColorFromUser() { wxColourData definedColors; unsigned int i = 0; definedColors.SetCustomColour( i++, wxColour( 184, 115, 50) ); // Copper definedColors.SetCustomColour( i++, wxColour( 191, 155, 58) ); // Gold definedColors.SetCustomColour( i++, wxColour( 213, 213, 213) ); // Silver definedColors.SetCustomColour( i++, wxColour( 160, 160, 160) ); // tin for(; i < wxColourData::NUM_CUSTOM;) { definedColors.SetCustomColour( i++, wxColour( 0, 0, 0 ) ); } bool change = Set3DColorFromUser( m_settings.m_CopperColor, _( "Copper Color" ), &definedColors ); if( change ) NewDisplay(); return change; }
void EDA_3D_FRAME::Process_Special_Functions( wxCommandEvent& event ) { #define ROT_ANGLE 10.0 int id = event.GetId(); bool isChecked = event.IsChecked(); switch( id ) { case ID_TOOL_SET_VISIBLE_ITEMS: Install_3D_ViewOptionDialog( event ); break; case ID_RELOAD3D_BOARD: NewDisplay(); return; break; case ID_ROTATE3D_X_POS: g_Parm_3D_Visu.m_ROTX += ROT_ANGLE; break; case ID_ROTATE3D_X_NEG: g_Parm_3D_Visu.m_ROTX -= ROT_ANGLE; break; case ID_ROTATE3D_Y_POS: g_Parm_3D_Visu.m_ROTY += ROT_ANGLE; break; case ID_ROTATE3D_Y_NEG: g_Parm_3D_Visu.m_ROTY -= ROT_ANGLE; break; case ID_ROTATE3D_Z_POS: g_Parm_3D_Visu.m_ROTZ += ROT_ANGLE; break; case ID_ROTATE3D_Z_NEG: g_Parm_3D_Visu.m_ROTZ -= ROT_ANGLE; break; case ID_MOVE3D_LEFT: m_canvas->SetView3D( WXK_LEFT ); return; case ID_MOVE3D_RIGHT: m_canvas->SetView3D( WXK_RIGHT ); return; case ID_MOVE3D_UP: m_canvas->SetView3D( WXK_UP ); return; case ID_MOVE3D_DOWN: m_canvas->SetView3D( WXK_DOWN ); return; case ID_ORTHO: ToggleOrtho(); return; case ID_TOOL_SCREENCOPY_TOCLIBBOARD: case ID_MENU_SCREENCOPY_PNG: case ID_MENU_SCREENCOPY_JPEG: m_canvas->TakeScreenshot( event ); break; case ID_MENU3D_BGCOLOR_SELECTION: Set3DBgColor(); return; case ID_MENU3D_REALISTIC_MODE: g_Parm_3D_Visu.SetFlag( FL_USE_REALISTIC_MODE, isChecked ); NewDisplay(); return; case ID_MENU3D_SHOW_BOARD_BODY: g_Parm_3D_Visu.SetFlag( FL_SHOW_BOARD_BODY, isChecked ); NewDisplay(); return; case ID_MENU3D_AXIS_ONOFF: g_Parm_3D_Visu.SetFlag( FL_AXIS, isChecked ); NewDisplay(); return; case ID_MENU3D_MODULE_ONOFF: g_Parm_3D_Visu.SetFlag( FL_MODULE, isChecked ); NewDisplay(); return; case ID_MENU3D_USE_COPPER_THICKNESS: g_Parm_3D_Visu.SetFlag( FL_USE_COPPER_THICKNESS, isChecked ); NewDisplay(); return; case ID_MENU3D_ZONE_ONOFF: g_Parm_3D_Visu.SetFlag( FL_ZONE, isChecked ); NewDisplay(); return; case ID_MENU3D_ADHESIVE_ONOFF: g_Parm_3D_Visu.SetFlag( FL_ADHESIVE, isChecked ); NewDisplay(); return; case ID_MENU3D_SILKSCREEN_ONOFF: g_Parm_3D_Visu.SetFlag( FL_SILKSCREEN, isChecked ); NewDisplay(); return; case ID_MENU3D_SOLDER_MASK_ONOFF: g_Parm_3D_Visu.SetFlag( FL_SOLDERMASK, isChecked ); NewDisplay(); return; case ID_MENU3D_SOLDER_PASTE_ONOFF: g_Parm_3D_Visu.SetFlag( FL_SOLDERPASTE, isChecked ); NewDisplay(); return; case ID_MENU3D_COMMENTS_ONOFF: g_Parm_3D_Visu.SetFlag( FL_COMMENTS, isChecked ); NewDisplay(); return; case ID_MENU3D_ECO_ONOFF: g_Parm_3D_Visu.SetFlag( FL_ECO, isChecked ); NewDisplay(); return; default: wxLogMessage( wxT( "EDA_3D_FRAME::Process_Special_Functions() error: unknown command" ) ); return; } m_canvas->Refresh( true ); m_canvas->DisplayStatus(); }
static void manage(struct sockaddr *from, int fromlen, int length, int fd) { CARD32 sessionID; CARD16 displayNumber; ARRAY8 displayClass; int expectlen; struct protoDisplay *pdpy; struct display *d; char *name = NULL; char *class2 = NULL; XdmcpNetaddr from_save; ARRAY8 clientAddress, clientPort; CARD16 connectionType; Debug("<manage> %d\n", length); displayClass.data = 0; displayClass.length = 0; if(XdmcpReadCARD32(&buffer, &sessionID) && XdmcpReadCARD16(&buffer, &displayNumber) && XdmcpReadARRAY8(&buffer, &displayClass)) { expectlen = 4 + /* session ID */ 2 + /* displayNumber */ 2 + displayClass.length; /* displayClass */ if(expectlen != length) { Debug("<manage> length error got %d expect %d\n", length, expectlen); goto abort; } pdpy = FindProtoDisplay((XdmcpNetaddr)from, fromlen, displayNumber); Debug("<manage> session ID %ld, pdpy %p\n", (long)sessionID, pdpy); if(!pdpy || pdpy->sessionID != sessionID) { /* * We may have already started a session for this display * but it hasn't seen the response in the form of an * XOpenDisplay() yet. So check if it is in the list of active * displays, and if so check that the session id's match. * If all this is true, then we have a duplicate request that * can be ignored. */ if(!pdpy && (d = FindDisplayByAddress((XdmcpNetaddr)from, fromlen, displayNumber)) && d->sessionID == sessionID) { Debug("manage: got duplicate pkt, ignoring\n"); goto abort; } Debug("session ID %ld refused\n", (long)sessionID); if(pdpy) Debug("existing session ID %ld\n", (long)pdpy->sessionID); send_refuse(from, fromlen, sessionID, fd); } else { name = NetworkAddressToName(pdpy->connectionType, &pdpy->connectionAddress, from, pdpy->displayNumber); if(!name) { Debug("could not compute display name\n"); send_failed(from, fromlen, "(no name)", sessionID, "out of memory", fd); goto abort; } Debug("computed display name: %s\n", name); if((d = FindDisplayByName(name))) { Debug("terminating active session for %s\n", d->name); StopDisplay(d); } if(displayClass.length) { if(!StrNDup(&class2, (char *)displayClass.data, displayClass.length)) { send_failed(from, fromlen, name, sessionID, "out of memory", fd); goto abort; } } if(!(from_save = (XdmcpNetaddr)Malloc(fromlen))) { send_failed(from, fromlen, name, sessionID, "out of memory", fd); goto abort; } memmove(from_save, from, fromlen); if(!(d = NewDisplay(name))) { free((char *)from_save); send_failed(from, fromlen, name, sessionID, "out of memory", fd); goto abort; } d->class2 = class2; class2 = 0; d->displayType = dForeign | dTransient | dFromXDMCP; d->sessionID = pdpy->sessionID; d->from.data = (unsigned char *)from_save; d->from.length = fromlen; d->displayNumber = pdpy->displayNumber; ClientAddress(from, &clientAddress, &clientPort, &connectionType); d->useChooser = 0; d->xdmcpFd = fd; if(IsIndirectClient(&clientAddress, connectionType)) { Debug("IsIndirectClient\n"); ForgetIndirectClient(&clientAddress, connectionType); if(UseChooser(&clientAddress, connectionType)) { d->useChooser = 1; Debug("use chooser for %s\n", d->name); } } d->clientAddr = clientAddress; d->connectionType = connectionType; d->remoteHost = NetworkAddressToHostname(pdpy->connectionType, &pdpy->connectionAddress); XdmcpDisposeARRAY8(&clientPort); if(pdpy->fileAuthorization) { d->authorizations = (Xauth **)Malloc(sizeof(Xauth *)); if(!d->authorizations) { free((char *)from_save); free((char *)d); send_failed(from, fromlen, name, sessionID, "out of memory", fd); goto abort; } d->authorizations[0] = pdpy->fileAuthorization; d->authNum = 1; pdpy->fileAuthorization = 0; } DisposeProtoDisplay(pdpy); Debug("starting display %s,%s\n", d->name, d->class2); if(LoadDisplayResources(d) < 0) { LogError( "Unable to read configuration for display %s; " "stopping it.\n", d->name); StopDisplay(d); } else StartDisplay(d); CloseGetter(); } } abort: XdmcpDisposeARRAY8(&displayClass); if(name) free((char *)name); if(class2) free((char *)class2); }