void LIB_VIEW_FRAME::LoadSettings( wxConfigBase* aCfg ) { EDA_DRAW_FRAME::LoadSettings( aCfg ); // Fetch grid settings from Symbol Editor wxString symbolEditor = LIB_EDIT_FRAME_NAME; bool btmp; COLOR4D wtmp; if( aCfg->Read( symbolEditor + ShowGridEntryKeyword, &btmp ) ) SetGridVisibility( btmp ); if( wtmp.SetFromWxString( aCfg->Read( symbolEditor + GridColorEntryKeyword, wxT( "NONE" ) ) ) ) SetGridColor( wtmp ); // Grid shape, etc. GetGalDisplayOptions().ReadAppConfig( *aCfg, symbolEditor ); aCfg->Read( LIBLIST_WIDTH_KEY, &m_libListWidth, 150 ); aCfg->Read( CMPLIST_WIDTH_KEY, &m_cmpListWidth, 150 ); m_showPinElectricalTypeName = aCfg->Read( CMPVIEW_SHOW_PINELECTRICALTYPE_KEY, true ); // Set parameters to a reasonable value. if( m_libListWidth > m_FrameSize.x/2 ) m_libListWidth = m_FrameSize.x/2; if( m_cmpListWidth > m_FrameSize.x/2 ) m_cmpListWidth = m_FrameSize.x/2; }
void EDA_DRAW_FRAME::LoadSettings( wxConfigBase* aCfg ) { EDA_BASE_FRAME::LoadSettings( aCfg ); wxString baseCfgName = ConfigBaseName(); bool btmp; if( aCfg->Read( baseCfgName + ShowGridEntryKeyword, &btmp ) ) SetGridVisibility( btmp ); // Read grid color: COLOR4D wtmp = COLOR4D::UNSPECIFIED; if( wtmp.SetFromWxString( aCfg->Read( baseCfgName + GridColorEntryKeyword, wxT( "NONE" ) ) ) ) SetGridColor( wtmp ); aCfg->Read( baseCfgName + LastGridSizeIdKeyword, &m_LastGridSizeId, 0L ); // m_LastGridSizeId is an offset, expected to be >= 0 if( m_LastGridSizeId < 0 ) m_LastGridSizeId = 0; m_UndoRedoCountMax = aCfg->Read( baseCfgName + MaxUndoItemsEntry, long( DEFAULT_MAX_UNDO_ITEMS ) ); aCfg->Read( baseCfgName + FirstRunShownKeyword, &m_firstRunDialogSetting, 0L ); m_galDisplayOptions->ReadConfig( aCfg, baseCfgName + GalDisplayOptionsKeyword ); }
void CLogSpreadSheet::InitSheet() { SetMaxCols(colMax); SetMaxRows(rowMax); SetBackColorStyle(SS_BACKCOLORSTYLE_UNDERGRID); SetTypeEditMultiLine(true); m_nDefaultRowHeight = GetRowHeight(0); InitColumnName(); InitColumnWidth(); SetBlockMode(true); SetGridColor(m_cGridNotComplete); SetBlockMode(false); m_nCurLastLogID = m_daoLogContent.GetLastLogID(); }
void LIB_VIEW_FRAME::LoadSettings( wxConfigBase* aCfg ) { EDA_DRAW_FRAME::LoadSettings( aCfg ); SetGridColor( GetLayerColor( LAYER_GRID ) ); SetDrawBgColor( GetLayerColor( LAYER_BACKGROUND ) ); aCfg->Read( LIBLIST_WIDTH_KEY, &m_libListWidth, 150 ); aCfg->Read( CMPLIST_WIDTH_KEY, &m_cmpListWidth, 150 ); // Set parameters to a reasonable value. if( m_libListWidth > m_FrameSize.x/2 ) m_libListWidth = m_FrameSize.x/2; if( m_cmpListWidth > m_FrameSize.x/2 ) m_cmpListWidth = m_FrameSize.x/2; }
BOOL CGraphShowDlg::OnInitDialog() { CDialog::OnInitDialog(); if (m_uiADCFileLength > 0) { m_pSampleData = new double[m_uiADCFileLength]; } // 创建绘图控件并设置相关参数 CreateGraph(IDC_STATIC_GRAPHSHOW, &m_OScopeCtrl); // customize the control SetRange(DrawGraphYAxisLower, DrawGraphYAxisUpper, DecimalPlaces, &m_OScopeCtrl) ; SetYUnits(DrawGraphYAxisLabel, &m_OScopeCtrl) ; SetXUnits(DrawGraphXAxisLabel, &m_OScopeCtrl) ; SetBackgroundColor(DrawGraphSetBackgroundColor, &m_OScopeCtrl) ; SetGridColor(DrawGraphSetGridColor, &m_OScopeCtrl) ; SetPlotColor(DrawGraphSetPlotColor, &m_OScopeCtrl) ; m_Sec_GraphADCShow.Lock(); m_uiADCGraphDrowFromNb = (m_pADCDataRecThread->m_uiADCDataFrameCount[m_uiADCGraphNb - 1]) * ReceiveDataSize; m_Sec_GraphADCShow.Unlock(); if (m_uiADCGraphDrowFromNb > m_OScopeCtrl.m_uiXAxisPointNum) { m_OScopeCtrl.m_uiXAxisLabelMax = m_uiADCGraphDrowFromNb; } else { m_OScopeCtrl.m_uiXAxisLabelMax = m_OScopeCtrl.m_uiXAxisPointNum; } m_OScopeCtrl.m_uiXAxisLabelMin = m_OScopeCtrl.m_uiXAxisLabelMax - m_OScopeCtrl.m_uiXAxisPointNum; m_OScopeCtrl.Reset(false); m_OScopeCtrl.m_dPreviousPosition = 0.0; m_OScopeCtrl.m_uiPointNum = m_uiADCGraphDrowFromNb; // 绘制了的点的个数 // OnSetHScrollBarRange(); m_OScopeCtrl.m_bStopSample = m_bStopSample; m_Sec_GraphADCShow.Lock(); m_pADCDataRecThread->m_pOScopeCtrl[m_uiADCGraphNb - 1] = &m_OScopeCtrl; m_pADCDataRecThread->m_uiADCGraphIP[m_uiADCGraphNb - 1] = IPSetAddrStart + IPSetAddrInterval * m_uiADCGraphNb; m_Sec_GraphADCShow.Unlock(); return TRUE; // return TRUE unless you set the focus to a control }
void GERBVIEW_FRAME::SetVisibleElementColor( GERBER_VISIBLE_ID aItemIdVisible, EDA_COLOR_T aColor ) { switch( aItemIdVisible ) { case NEGATIVE_OBJECTS_VISIBLE: case DCODES_VISIBLE: m_colorsSettings->SetItemColor( aItemIdVisible, aColor ); break; case GERBER_GRID_VISIBLE: SetGridColor( aColor ); m_colorsSettings->SetItemColor( aItemIdVisible, aColor ); break; default: wxLogDebug( wxT( "GERBVIEW_FRAME::SetVisibleElementColor(): bad arg %d" ), (int) aItemIdVisible ); } }
void EDA_DRAW_FRAME::LoadSettings( wxConfigBase* aCfg ) { EDA_BASE_FRAME::LoadSettings( aCfg ); aCfg->Read( m_FrameName + CursorShapeEntryKeyword, &m_cursorShape, ( long )0 ); bool btmp; if( aCfg->Read( m_FrameName + ShowGridEntryKeyword, &btmp ) ) SetGridVisibility( btmp ); int itmp; if( aCfg->Read( m_FrameName + GridColorEntryKeyword, &itmp ) ) SetGridColor( ColorFromInt( itmp ) ); aCfg->Read( m_FrameName + LastGridSizeIdKeyword, &m_LastGridSizeId, 0L ); // m_LastGridSizeId is an offset, expected to be >= 0 if( m_LastGridSizeId < 0 ) m_LastGridSizeId = 0; }
BOOL CGraphShowDlg::OnInitDialog() { CDialog::OnInitDialog(); // 创建绘图控件并设置相关参数 CreateGraph(IDC_STATIC_GRAPHSHOW, &m_OScopeCtrl); // customize the control SetRange(-2.5, 2.5, DecimalPlaces, &m_OScopeCtrl) ; SetYUnits("Y", &m_OScopeCtrl) ; SetXUnits("X", &m_OScopeCtrl) ; SetBackgroundColor(RGB(0, 0, 64), &m_OScopeCtrl) ; SetGridColor(RGB(192, 192, 255), &m_OScopeCtrl) ; SetPlotColor(RGB(255, 255, 255), &m_OScopeCtrl) ; unsigned int uiLength = 0; m_Sec.Lock(); uiLength = m_ADCDataRecThread->m_uiADCDataFrameCount[m_uiADCGraphNb - 1] * ReceiveDataSize; m_Sec.Unlock(); if (uiLength > m_OScopeCtrl.m_uiXAxisPointNum) { m_OScopeCtrl.m_uiXAxisLabelMax = uiLength; } else { m_OScopeCtrl.m_uiXAxisLabelMax = m_OScopeCtrl.m_uiXAxisPointNum; } m_OScopeCtrl.m_uiXAxisLabelMin = m_OScopeCtrl.m_uiXAxisLabelMax - m_OScopeCtrl.m_uiXAxisPointNum; m_OScopeCtrl.Reset(false); m_OScopeCtrl.m_dPreviousPosition = 0.0; m_OScopeCtrl.m_uiPointNum = uiLength; // 绘制了的点的个数 m_dSampleData.reserve(1024); OnSetHScrollBarRange(); m_Sec.Lock(); m_ADCDataRecThread->m_uiADCGraphIP = 71 + 10 * m_uiADCGraphNb; m_Sec.Unlock(); m_OScopeCtrl.m_bStopSample = m_bStopSample; return TRUE; // return TRUE unless you set the focus to a control }
void EDA_DRAW_FRAME::LoadSettings( wxConfigBase* aCfg ) { EDA_BASE_FRAME::LoadSettings( aCfg ); wxString baseCfgName = ConfigBaseName(); wxConfigBase* cmnCfg = Pgm().CommonSettings(); // Read units used in dialogs and toolbars EDA_UNITS_T unitsTmp; if( aCfg->Read( baseCfgName + UserUnitsEntryKeyword, (int*) &unitsTmp ) ) SetUserUnits( unitsTmp ); else SetUserUnits( MILLIMETRES ); // Read show/hide grid entry bool btmp; if( aCfg->Read( baseCfgName + ShowGridEntryKeyword, &btmp ) ) SetGridVisibility( btmp ); // Read grid color: COLOR4D wtmp = COLOR4D::UNSPECIFIED; if( wtmp.SetFromWxString( aCfg->Read( baseCfgName + GridColorEntryKeyword, wxT( "NONE" ) ) ) ) SetGridColor( wtmp ); aCfg->Read( baseCfgName + LastGridSizeIdKeyword, &m_LastGridSizeId, 0L ); // m_LastGridSizeId is an offset, expected to be >= 0 if( m_LastGridSizeId < 0 ) m_LastGridSizeId = 0; m_UndoRedoCountMax = aCfg->Read( baseCfgName + MaxUndoItemsEntry, long( DEFAULT_MAX_UNDO_ITEMS ) ); aCfg->Read( baseCfgName + FirstRunShownKeyword, &m_firstRunDialogSetting, 0L ); m_galDisplayOptions.ReadConfig( *cmnCfg, *aCfg, baseCfgName, this ); }
void SCH_EDIT_FRAME::LoadSettings( wxConfigBase* aCfg ) { EDA_DRAW_FRAME::LoadSettings( aCfg ); long tmp; ReadHotkeyConfig( SCH_EDIT_FRAME_NAME, g_Schematic_Hokeys_Descr ); wxConfigLoadSetups( aCfg, GetConfigurationSettings() ); SetGridColor( GetLayerColor( LAYER_SCHEMATIC_GRID ) ); SetDrawBgColor( GetLayerColor( LAYER_SCHEMATIC_BACKGROUND ) ); SetDefaultBusThickness( aCfg->Read( DefaultBusWidthEntry, DEFAULTBUSTHICKNESS ) ); SetDefaultLineThickness( aCfg->Read( DefaultDrawLineWidthEntry, DEFAULTDRAWLINETHICKNESS ) ); aCfg->Read( ShowHiddenPinsEntry, &m_showAllPins, false ); aCfg->Read( HorzVertLinesOnlyEntry, &m_forceHVLines, true ); aCfg->Read( AutoplaceFieldsEntry, &m_autoplaceFields, true ); aCfg->Read( AutoplaceJustifyEntry, &m_autoplaceJustify, true ); aCfg->Read( AutoplaceAlignEntry, &m_autoplaceAlign, false ); aCfg->Read( FootprintPreviewEntry, &m_footprintPreview, false ); // Load print preview window session settings. aCfg->Read( PreviewFramePositionXEntry, &tmp, -1 ); m_previewPosition.x = (int) tmp; aCfg->Read( PreviewFramePositionYEntry, &tmp, -1 ); m_previewPosition.y = (int) tmp; aCfg->Read( PreviewFrameWidthEntry, &tmp, -1 ); m_previewSize.SetWidth( (int) tmp ); aCfg->Read( PreviewFrameHeightEntry, &tmp, -1 ); m_previewSize.SetHeight( (int) tmp ); // Load print dialog session settings. aCfg->Read( PrintDialogPositionXEntry, &tmp, -1 ); m_printDialogPosition.x = (int) tmp; aCfg->Read( PrintDialogPositionYEntry, &tmp, -1 ); m_printDialogPosition.y = (int) tmp; aCfg->Read( PrintDialogWidthEntry, &tmp, -1 ); m_printDialogSize.SetWidth( (int) tmp ); aCfg->Read( PrintDialogHeightEntry, &tmp, -1 ); m_printDialogSize.SetHeight( (int) tmp ); // Load netlists options: aCfg->Read( SimulatorCommandEntry, &m_simulatorCommand ); // Load find dialog session setting. aCfg->Read( FindDialogPositionXEntry, &tmp, -1 ); m_findDialogPosition.x = (int) tmp; aCfg->Read( FindDialogPositionYEntry, &tmp, -1 ); m_findDialogPosition.y = (int) tmp; aCfg->Read( FindDialogWidthEntry, &tmp, -1 ); m_findDialogSize.SetWidth( (int) tmp ); aCfg->Read( FindDialogHeightEntry, &tmp, -1 ); m_findDialogSize.SetHeight( (int) tmp ); wxASSERT_MSG( m_findReplaceData, wxT( "Find dialog data settings object not created. Bad programmer!" ) ); aCfg->Read( FindReplaceFlagsEntry, &tmp, (long) wxFR_DOWN ); m_findReplaceData->SetFlags( (wxUint32) tmp & ~FR_REPLACE_ITEM_FOUND ); m_findReplaceData->SetFindString( aCfg->Read( FindStringEntry, wxEmptyString ) ); m_findReplaceData->SetReplaceString( aCfg->Read( ReplaceStringEntry, wxEmptyString ) ); // Load the find and replace string history list. for( int i = 0; i < FR_HISTORY_LIST_CNT; ++i ) { wxString tmpHistory; wxString entry; entry.Printf( FindStringHistoryEntry, i ); tmpHistory = aCfg->Read( entry, wxEmptyString ); if( !tmpHistory.IsEmpty() ) m_findStringHistoryList.Add( tmpHistory ); entry.Printf( ReplaceStringHistoryEntry, i ); tmpHistory = aCfg->Read( entry, wxEmptyString ); if( !tmpHistory.IsEmpty() ) m_replaceStringHistoryList.Add( tmpHistory ); } wxString templateFieldNames = aCfg->Read( FieldNamesEntry, wxEmptyString ); if( !templateFieldNames.IsEmpty() ) { TEMPLATE_FIELDNAMES_LEXER lexer( TO_UTF8( templateFieldNames ) ); try { m_TemplateFieldNames.Parse( &lexer ); } catch( const IO_ERROR& DBG( e ) ) { // @todo show error msg DBG( printf( "templatefieldnames parsing error: '%s'\n", TO_UTF8( e.What() ) ); ) } }
void CTabSample::OnInit(void) { m_iGraphViewId[0] = IDC_GRAPHSHOW1; m_iGraphViewId[1] = IDC_GRAPHSHOW2; m_iGraphViewId[2] = IDC_GRAPHSHOW3; m_iGraphViewId[3] = IDC_GRAPHSHOW4; for (int i=0; i<GraphViewNum;i++) { m_dSampleData[i].reserve(10240); } // 输入控件ID m_iMathId[0][0] = IDC_STATIC_AVERAGE1; m_iMathId[0][1] = IDC_STATIC_RMS1; m_iMathId[0][2] = IDC_STATIC_MAX1; m_iMathId[0][3] = IDC_STATIC_MIN1; m_iMathId[1][0] = IDC_STATIC_AVERAGE2; m_iMathId[1][1] = IDC_STATIC_RMS2; m_iMathId[1][2] = IDC_STATIC_MAX2; m_iMathId[1][3] = IDC_STATIC_MIN2; m_iMathId[2][0] = IDC_STATIC_AVERAGE3; m_iMathId[2][1] = IDC_STATIC_RMS3; m_iMathId[2][2] = IDC_STATIC_MAX3; m_iMathId[2][3] = IDC_STATIC_MIN3; m_iMathId[3][0] = IDC_STATIC_AVERAGE4; m_iMathId[3][1] = IDC_STATIC_RMS4; m_iMathId[3][2] = IDC_STATIC_MAX4; m_iMathId[3][3] = IDC_STATIC_MIN4; // 控件选择 for (int k=0; k<GraphViewNum; k++) { m_iSelectObject[k] = 0; m_iSelectObjectNoise[k] = 0; } m_cSelectObjectName[0] = _T("仪器一"); m_cSelectObjectName[1] = _T("仪器二"); m_cSelectObjectName[2] = _T("仪器三"); m_cSelectObjectName[3] = _T("仪器四"); // 得到当前路径 char cSaveToFilePath[MAX_PATH]; GetCurrentDirectory(MAX_PATH, cSaveToFilePath); m_csSaveFilePath = cSaveToFilePath; CScrollBar*pSB =(CScrollBar*)GetDlgItem(IDC_SCROLLBAR_GRAPHVIEW); pSB->SetScrollRange(m_uiScrollBarMin,m_uiScrollBarMax); // 创建绘图控件并设置相关参数 CreateGraph(GraphViewNum, m_iGraphViewId, m_OScopeCtrl); // customize the control SetRange(-2.5, 2.5, 1, GraphViewNum, m_OScopeCtrl) ; SetYUnits("Y", GraphViewNum, m_OScopeCtrl) ; SetXUnits("X", GraphViewNum, m_OScopeCtrl) ; SetBackgroundColor(RGB(0, 0, 64), GraphViewNum, m_OScopeCtrl) ; SetGridColor(RGB(192, 192, 255), GraphViewNum, m_OScopeCtrl) ; SetPlotColor(RGB(255, 255, 255), GraphViewNum, m_OScopeCtrl) ; // 得到本机IP地址 char name[255]; CString ip; PHOSTENT hostinfo; if( gethostname (name, sizeof(name)) == 0) { if((hostinfo = gethostbyname(name)) != NULL) { ip = inet_ntoa(*(struct in_addr*)*hostinfo-> h_addr_list); } } m_oThreadManage.m_HeadFrameSocket.m_csIPSource = ip; m_oThreadManage.m_TailFrameSocket.m_csIPSource = ip; m_oThreadManage.m_TailTimeFrameSocket.m_csIPSource = ip; m_oThreadManage.m_oSysTimeSocket.m_csIPSource = ip; m_oThreadManage.m_ADCDataSocket.m_csIPSource = ip; m_oThreadManage.m_oSysTimeSocket.m_pADCSet = &m_oADCSet; CString str; str.Format("0x%04x", 0x8202); GetDlgItem(IDC_EDIT_SENDPORT)->SetWindowText(str); str.Format("%d", 406); GetDlgItem(IDC_EDIT_ADCSAVEFRAMENB)->SetWindowText(str); m_iconDisconnected = AfxGetApp()->LoadIcon(IDI_ICON1); m_iconConnected = AfxGetApp()->LoadIcon(IDI_ICON2); m_oThreadManage.m_oInstrumentList.m_iconDisconnected = m_iconDisconnected; m_oThreadManage.m_oInstrumentList.m_pwnd = this; m_oThreadManage.m_IPSetSocket.m_iconConnected = m_iconConnected; m_oThreadManage.m_IPSetSocket.m_pwnd = this; // m_oThreadManage.m_ADCDataSocket.m_pwnd = this; m_oThreadManage.m_ADCDataSocket.m_pSelectObject = m_iSelectObject; m_oThreadManage.m_ADCDataSocket.m_pSelectObjectNoise = m_iSelectObjectNoise; for(int i=0; i<GraphViewNum; i++) { m_oThreadManage.m_ADCDataSocket.m_pSampleData[i] = &m_dSampleData[i]; m_oThreadManage.m_ADCDataSocket.m_pOScopeCtrl[i] = &m_OScopeCtrl[i]; m_oThreadManage.m_ADCDataSocket.m_cSelectObjectName[i] = m_cSelectObjectName[i]; } CStatic* icon; icon =(CStatic*)this->GetDlgItem(IDC_STATIC_INSTRUMENT1); icon->SetIcon(m_iconDisconnected); icon =(CStatic*)this->GetDlgItem(IDC_STATIC_INSTRUMENT2); icon->SetIcon(m_iconDisconnected); icon =(CStatic*)this->GetDlgItem(IDC_STATIC_INSTRUMENT3); icon->SetIcon(m_iconDisconnected); icon =(CStatic*)this->GetDlgItem(IDC_STATIC_INSTRUMENT4); icon->SetIcon(m_iconDisconnected); m_oThreadManage.OnInit(); OnOpen(); // 监测尾包定时器 SetTimer(4, 1000, NULL); }