DIALOG_BOM_EDITOR::DIALOG_BOM_EDITOR( SCH_EDIT_FRAME* parent ) :
        DIALOG_BOM_EDITOR_BASE( parent ),
        m_parent( parent )
{
    m_bom = BOM_TABLE_MODEL::Create();

    m_columnListCtrl->DeleteAllItems();
    m_columnListCtrl->ClearColumns();

    auto nameColumn = m_columnListCtrl->AppendTextColumn( _( "Field" ) );

    auto showColumn = m_columnListCtrl->AppendToggleColumn(
                                        _( "Show" ),
                                        wxDATAVIEW_CELL_ACTIVATABLE,
                                        100 );

    // Resize the columns appropriately
    m_columnListCtrl->Update();

    showColumn->SetWidth( wxCOL_WIDTH_AUTOSIZE );
    showColumn->SetMinWidth( showColumn->GetWidth() );
    showColumn->SetResizeable( false );

    m_columnListCtrl->Update();

    nameColumn->SetWidth( wxCOL_WIDTH_AUTOSIZE );
    nameColumn->SetResizeable( true );

    // Read all components
    LoadComponents();

    LoadColumnNames();
    ReloadColumns();

    m_bom->ReloadTable();

    Update();

    m_bomView->Update();

    // Set default column widths
    for( unsigned int ii = 0; ii < m_bomView->GetColumnCount(); ii++ )
    {
        auto col = m_bomView->GetColumn( ii );

        if( !col )
            continue;

        col->SetWidth( wxCOL_WIDTH_AUTOSIZE );
        col->SetResizeable( true );
    }

    Layout();
    GetSizer()->SetSizeHints( this );
    Centre();
}
Ejemplo n.º 2
0
/// This function is called to load the initial Theme images.
/// There are many possible choices for what this function
/// should do, as we have (potentially) four sources of images.
///   - (deprecated) programmed in XPMs.
///   - Programmed in in-built theme.
///   - External image Cache file.
///   - External component files.
///
/// We currently still have the deprecated XPMs, so we have
/// those being used if the user decides not to load themes.
///
/// @param bLookForExternalFiles uses file iff true.
void ThemeBase::LoadThemeAtStartUp( bool bLookForExternalFiles )
{
   EnsureInitialised();

   const bool cbBinaryRead =true;
   const bool cbOkIfNotFound = true;

   // IF not interested in external files, 
   // THEN just use the internal default set.
   if( !bLookForExternalFiles )
   {
      // IF the XPMs have been retired, THEN we'd better use the built-in cache
      // at start up.  
      // ELSE do nothing, we already have XPM based images.
#ifdef XPMS_RETIRED
      ReadThemeInternal();
#endif
      return;
   }
   // ELSE IF can't read the external image cache.
   else if( !ReadImageCache( cbBinaryRead, cbOkIfNotFound ) )
   {
      // THEN get the default set.
      ReadThemeInternal();

      // JKC: Now we could go on and load the individual images
      // on top of the default images using the commented out 
      // code that follows...
      //
      // However, I think it is better to get the user to 
      // build a new image cache, which they can do easily
      // from the Theme preferences tab.
#if 0
      // and now add any available component images.
      LoadComponents( cbOkIfNotFound );

      // JKC: I'm usure about doing this next step automatically.
      // Suppose the disk is write protected?
      // Is having the image cache created automatically 
      // going to confuse users?  Do we need version specific names?
      // and now save the combined image as a cache for later use.
      // We should load the images a little faster in future as a result.
      CreateImageCache();
#endif
   }

   // Next line is not required as we haven't yet built the GUI 
   // when this function is (or should be) called.
   // ApplyUpdatedImages();
}
Ejemplo n.º 3
0
/*!
 * \brief Read the Configurator's repository.
 *
 * \param repositoryname Pathname of the repository file.
 * \param configname     Pathname of the configuration file.
 *
 * \return true on success, otherwise false is returned.
 */
bool CNutConfDoc::ReadRepository(const wxString & repositoryname, const wxString & configname)
{
    wxBusyCursor wait;
    wxString str;

    str = wxT("Loading ") + repositoryname;
    wxGetApp().SetStatusText(str);
    wxLogMessage(wxT("%s"), str.c_str());

    m_repository = OpenRepository(repositoryname.mb_str());
    if(m_repository) {
        m_root = LoadComponents(m_repository);
        if(m_root) {
            str = wxT("Loading ") + configname;
            wxGetApp().SetStatusText(str);
            wxLogMessage(wxT("%s"), str.c_str());
            if(ConfigureComponents(m_repository, m_root, configname.mb_str())) {
                wxLogMessage(wxT("%s"), GetScriptErrorString());
            }
            else {
                CSettings *cfg = wxGetApp().GetSettings();
                /* Store settings in the Lua registry. */
                RegisterSourcePath(m_repository, cfg->m_source_dir.mb_str());
                RegisterBuildPath(m_repository, cfg->m_buildpath.mb_str());
                RegisterLibPath(m_repository, cfg->m_lib_dir.mb_str());
                RegisterSamplePath(m_repository, cfg->m_app_dir.mb_str());
                RegisterCompilerPlatform(m_repository, cfg->m_platform.mb_str());
                if (RefreshComponents(m_repository, m_root)) {
                    wxLogError(wxT("Conflicting configuration"));
                } else {
                    wxLogMessage(wxT("OK"));
                }
            }
        }
        else {
            wxLogMessage(wxT("%s"), GetScriptErrorString());
        }
//        CloseRepository(m_repository);
    }
    else {
        wxLogError(wxT("Failed to open repository"));
    }

    wxDocument::OnNewDocument();
    AddAllItems();
    wxGetApp().SetStatusText(wxEmptyString);

    return true;
}
Ejemplo n.º 4
0
void InstallerWindow::OnShow()
{
	htmlayout::dom::element r = GetRoot();
	components = r.get_element_by_id("components");

	// os label
	htmlayout::dom::element os = r.get_element_by_id("os");
	if (os.is_valid())
	{
		os.set_text((DVLib::GetOperatingSystemVersionString() + L" (" + 
			DVLib::pa2wstring(DVLib::GetProcessorArchitecture()) + L")").c_str());
	}

	// status
	status = r.get_element_by_id("status");

	// error
	error = r.get_element_by_id("error");
	ClearError();

	// progress
	progress = r.get_element_by_id("progress");
	ClearProgress();

	// load components
	LoadComponents();

	InstallConfiguration * p_configuration = reinterpret_cast<InstallConfiguration *>(get(m_configuration));
	CHECK_BOOL(p_configuration != NULL, L"Invalid configuration");

	// labels and info
	htmlayout::dom::element dialog_message = r.get_element_by_id("dialog_message");
	if (dialog_message.is_valid()) 
	{
		dialog_message.set_text(InstallerSession::Instance->sequence == SequenceInstall 
			? p_configuration->dialog_message.GetValue().c_str()
			: p_configuration->dialog_message_uninstall.GetValue().c_str());
	}

	button_install = r.get_element_by_id("button_install");
	if (button_install.is_valid()) 
	{
		button_install.set_text(p_configuration->install_caption.GetValue().c_str());
		if (InstallerSession::Instance->sequence != SequenceInstall) button_install.destroy();
	}

	button_uninstall = r.get_element_by_id("button_uninstall");
	if (button_uninstall.is_valid()) 
	{
		button_uninstall.set_text(p_configuration->uninstall_caption.GetValue().c_str());
		if (InstallerSession::Instance->sequence != SequenceUninstall) button_uninstall.destroy();
	}

	button_skip = r.get_element_by_id("button_skip");
	if (button_skip.is_valid()) 
	{
		button_skip.set_text(p_configuration->skip_caption.GetValue().c_str());
		if (! m_additional_config)
		{
			button_skip.destroy();
		}
	}

	button_cancel = r.get_element_by_id("button_cancel");
	if (button_cancel.is_valid()) 
	{
		button_cancel.set_text(p_configuration->cancel_caption.GetValue().c_str());
	}

	AddUserControls();
	AddElevatedControls();

	Start();	
}
Ejemplo n.º 5
0
PeakFit::PeakFit(const char* filename) :
	maxNumStates_(0)
{
	LoadComponents(filename);
}
void BattlenetMgr::Load()
{
    LoadComponents();
    LoadModules();
}