void GERBVIEW_FRAME::LoadSettings( wxConfigBase* aCfg ) { EDA_DRAW_FRAME::LoadSettings( aCfg ); // was: wxGetApp().ReadCurrentSetupValues( GetConfigurationSettings() ); wxConfigLoadSetups( aCfg, GetConfigurationSettings() ); PAGE_INFO pageInfo( wxT( "GERBER" ) ); aCfg->Read( cfgShowBorderAndTitleBlock, &m_showBorderAndTitleBlock, false ); if( m_showBorderAndTitleBlock ) { wxString pageType; aCfg->Read( cfgShowPageSizeOption, &pageType, wxT( "GERBER" ) ); pageInfo.SetType( pageType ); } SetPageSettings( pageInfo ); GetScreen()->InitDataPoints( pageInfo.GetSizeIU() ); bool tmp; aCfg->Read( cfgShowDCodes, &tmp, true ); SetElementVisibility( DCODES_VISIBLE, tmp ); aCfg->Read( cfgShowNegativeObjects, &tmp, false ); SetElementVisibility( NEGATIVE_OBJECTS_VISIBLE, tmp ); // because we have 2 file histories, we must read this one // using a specific path aCfg->SetPath( wxT( "drl_files" ) ); m_drillFileHistory.Load( *aCfg ); aCfg->SetPath( wxT( ".." ) ); }
bool PANEL_GERBVIEW_SETTINGS::TransferDataFromWindow() { m_Parent->m_DisplayOptions.m_DisplayPolarCood = ( m_PolarDisplay->GetSelection() != 0 ); m_Parent->SetUserUnits( m_BoxUnits->GetSelection() == 0 ? INCHES : MILLIMETRES ); m_Parent->m_DisplayOptions.m_DisplayPageLimits = m_ShowPageLimitsOpt->GetValue(); PAGE_INFO pageInfo( g_GerberPageSizeList[ m_PageSize->GetSelection() ] ); m_Parent->SetPageSettings( pageInfo ); return true; }
bool wxPageContainer::AddPage(const wxString& caption, const bool selected, const int imgindex) { if(selected) { PushPageHistory(m_iActivePage); m_iActivePage = (int)m_pagesInfoVec.GetCount(); } /// Create page info and add it to the vector wxPageInfo pageInfo(caption, imgindex); m_pagesInfoVec.Add(pageInfo); Refresh(); return true; }
void DIALOG_DISPLAY_OPTIONS::OnOKBUttonClick( wxCommandEvent& event ) { m_Parent->m_DisplayOptions.m_DisplayPolarCood = (m_PolarDisplay->GetSelection() == 0) ? false : true; g_UserUnit = (m_BoxUnits->GetSelection() == 0) ? INCHES : MILLIMETRES; #ifndef __APPLE__ m_Parent->SetCursorShape( m_CursorShape->GetSelection() ); #endif // !__APPLE__ if( m_OptDisplayLines->GetSelection() == 1 ) m_Parent->m_DisplayOptions.m_DisplayLinesFill = true; else m_Parent->m_DisplayOptions.m_DisplayLinesFill = false; if( m_OptDisplayFlashedItems->GetSelection() == 1 ) { m_Parent->m_DisplayOptions.m_DisplayFlashedItemsFill = true; } else { m_Parent->m_DisplayOptions.m_DisplayFlashedItemsFill = false; } if( m_OptDisplayPolygons->GetSelection() == 0 ) m_Parent->m_DisplayOptions.m_DisplayPolygonsFill = false; else m_Parent->m_DisplayOptions.m_DisplayPolygonsFill = true; m_Parent->SetElementVisibility( DCODES_VISIBLE, m_OptDisplayDCodes->GetValue() ); int idx = m_ShowPageLimits->GetSelection(); m_Parent->SetShowBorderAndTitleBlock( idx > 0 ? true : false ); PAGE_INFO pageInfo( g_GerberPageSizeList[idx] ); m_Parent->SetPageSettings( pageInfo ); m_Parent->GetCanvas()->SetEnableZoomNoCenter( m_OptZoomNoCenter->GetValue() ); m_Parent->GetCanvas()->SetEnableMousewheelPan( m_OptMousewheelPan->GetValue() ); m_Parent->GetCanvas()->Refresh(); EndModal( 1 ); }
void GERBVIEW_FRAME::LoadSettings() { wxConfig* config = wxGetApp().GetSettings(); if( config == NULL ) return; EDA_DRAW_FRAME::LoadSettings(); wxGetApp().ReadCurrentSetupValues( GetConfigurationSettings() ); PAGE_INFO pageInfo( wxT( "GERBER" ) ); config->Read( cfgShowBorderAndTitleBlock, &m_showBorderAndTitleBlock, false ); if( m_showBorderAndTitleBlock ) { wxString pageType; config->Read( cfgShowPageSizeOption, &pageType, wxT( "GERBER" ) ); pageInfo.SetType( pageType ); } SetPageSettings( pageInfo ); GetScreen()->InitDataPoints( pageInfo.GetSizeIU() ); bool tmp; config->Read( cfgShowDCodes, &tmp, true ); SetElementVisibility( DCODES_VISIBLE, tmp ); config->Read( cfgShowNegativeObjects, &tmp, false ); SetElementVisibility( NEGATIVE_OBJECTS_VISIBLE, tmp ); // because we have 2 file historues, we must read this one // using a specific path config->SetPath( wxT( "drl_files" ) ); m_drillFileHistory.Load( *config ); config->SetPath( wxT( ".." ) ); // WxWidgets 2.9.1 seems call setlocale( LC_NUMERIC, "" ) // when reading doubles in config, // but forget to back to current locale. So we call SetLocaleTo_Default SetLocaleTo_Default(); }
void KeyFile::create(const String &name, const KeyFileDefinition &keydef) { if(keydef.getKeyFieldCount() < 1) { throwSqlError(SQL_INVALID_KEYDEF,_T("Invalid keydefinition on %s. Keyfieldcount=%d. Must be >= 1"), name.cstr(), keydef.getKeyFieldCount()); } /* Check the keysize against pagesize */ KeyPageInfo pageInfo(keydef.getSize()); KeyFileHeader header; header.init(keydef); DbFile::create(name); DbFile file(name,DBFMODE_READWRITE, NULL); try { file.write(0,&header, sizeof(header)); } catch(sqlca) { DbFile::destroy(name); throw; } }
GERBVIEW_FRAME::GERBVIEW_FRAME( KIWAY* aKiway, wxWindow* aParent ): EDA_DRAW_FRAME( aKiway, aParent, FRAME_GERBER, wxT( "GerbView" ), wxDefaultPosition, wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, GERBVIEW_FRAME_NAME ) { m_colorsSettings = &g_ColorsSettings; m_gerberLayout = NULL; m_zoomLevelCoeff = ZOOM_FACTOR( 110 ); // Adjusted to roughly displays zoom level = 1 // when the screen shows a 1:1 image // obviously depends on the monitor, // but this is an acceptable value PAGE_INFO pageInfo( wxT( "GERBER" ) ); SetPageSettings( pageInfo ); m_show_layer_manager_tools = true; m_showAxis = true; // true to show X and Y axis on screen m_showBorderAndTitleBlock = false; // true for reference drawings. m_HotkeysZoomAndGridList = GerbviewHokeysDescr; m_SelLayerBox = NULL; m_DCodeSelector = NULL; m_displayMode = 0; m_drillFileHistory.SetBaseId( ID_GERBVIEW_DRILL_FILE1 ); if( m_canvas ) m_canvas->SetEnableBlockCommands( true ); // Give an icon wxIcon icon; icon.CopyFromBitmap( KiBitmap( icon_gerbview_xpm ) ); SetIcon( icon ); SetLayout( new GBR_LAYOUT() ); SetVisibleLayers( -1 ); // All draw layers visible. SetScreen( new GBR_SCREEN( GetPageSettings().GetSizeIU() ) ); // Create the PCB_LAYER_WIDGET *after* SetLayout(): wxFont font = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT ); int pointSize = font.GetPointSize(); int screenHeight = wxSystemSettings::GetMetric( wxSYS_SCREEN_Y ); if( screenHeight <= 900 ) pointSize = (pointSize * 8) / 10; m_LayersManager = new GERBER_LAYER_WIDGET( this, m_canvas, pointSize ); // LoadSettings() *after* creating m_LayersManager, because LoadSettings() // initialize parameters in m_LayersManager LoadSettings( config() ); SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y ); if( m_LastGridSizeId < 0 ) m_LastGridSizeId = 0; if( m_LastGridSizeId > ID_POPUP_GRID_LEVEL_0_0_1MM-ID_POPUP_GRID_LEVEL_1000 ) m_LastGridSizeId = ID_POPUP_GRID_LEVEL_0_0_1MM-ID_POPUP_GRID_LEVEL_1000; GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId ); ReCreateMenuBar(); ReCreateHToolbar(); ReCreateOptToolbar(); m_auimgr.SetManagedWindow( this ); EDA_PANEINFO horiz; horiz.HorizontalToolbarPane(); EDA_PANEINFO vert; vert.VerticalToolbarPane(); EDA_PANEINFO mesg; mesg.MessageToolbarPane(); // Create a wxAuiPaneInfo for the Layers Manager, not derived from the template. // the Layers Manager is floatable, but initially docked at far right EDA_PANEINFO lyrs; lyrs.LayersToolbarPane(); lyrs.MinSize( m_LayersManager->GetBestSize() ); lyrs.BestSize( m_LayersManager->GetBestSize() ); lyrs.Caption( _( "Visibles" ) ); lyrs.TopDockable( false ).BottomDockable( false ); if( m_mainToolBar ) m_auimgr.AddPane( m_mainToolBar, wxAuiPaneInfo( horiz ).Name( wxT( "m_mainToolBar" ) ).Top().Row( 0 ) ); if( m_drawToolBar ) m_auimgr.AddPane( m_drawToolBar, wxAuiPaneInfo( vert ).Name( wxT( "m_drawToolBar" ) ).Right().Row( 1 ) ); m_auimgr.AddPane( m_LayersManager, lyrs.Name( wxT( "m_LayersManagerToolBar" ) ).Right().Layer( 0 ) ); if( m_optionsToolBar ) m_auimgr.AddPane( m_optionsToolBar, wxAuiPaneInfo( vert ).Name( wxT( "m_optionsToolBar" ) ).Left() ); if( m_canvas ) m_auimgr.AddPane( m_canvas, wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() ); if( m_messagePanel ) m_auimgr.AddPane( m_messagePanel, wxAuiPaneInfo( mesg ).Name( wxT( "MsgPanel" ) ).Bottom().Layer( 10 ) ); ReFillLayerWidget(); // this is near end because contents establish size m_LayersManager->ReFillRender(); // Update colors in Render after the config is read m_auimgr.Update(); setActiveLayer( 0, true ); Zoom_Automatique( false ); // Gives a default zoom value }
PL_EDITOR_LAYOUT::PL_EDITOR_LAYOUT() { PAGE_INFO pageInfo( wxT( "A4" ) ); SetPageSettings( pageInfo ); }
/************************************************ * * ***********************************************/ void PdfMergerIPCReader::mergerOutputReady() { mBuf += QString::fromLocal8Bit(mProcess->readAllStandardOutput()); QString line; int i; for (i=0; i<mBuf.length(); ++i) { QChar c = mBuf.at(i); if (c != '\n') { line += c; continue; } QStringList data = line.split(':', QString::KeepEmptyParts); //*************************************** if (data.at(0) == "S") { emit progress(data.at(1).toInt(), mPageCount); } //*************************************** else if (data.at(0) == "P") { PdfPageInfo info; info.objNum = data.at(3).toInt(); info.cropBox = strToRect(data.at(4)); info.mediaBox = strToRect(data.at(5)); info.rotate = data.at(6).toInt(); emit pageInfo(data.at(1).toInt(), data.at(2).toInt(), info); } //*************************************** else if (data.at(0) == "A") { mPageCount = data.at(1).toInt(); emit allPagesCount(mPageCount); } //*************************************** else if (data.at(0) == "X") { emit xRefInfo(data.at(1).toDouble(), data.at(2).toDouble()); } //*************************************** else if (data.at(0) == "E") { emit error(data.at(1)); } //*************************************** else if (data.at(0) == "W") { qWarning() << data.at(1); } //*************************************** else if (data.at(0) == "D") { qDebug() << data.at(1); } line = ""; } mBuf.remove(0, i); }