Пример #1
0
void CNesicideProject::initializeProject()
{
   QString cc65home = qgetenv("CC65_HOME");
   QDir dir = m_projectOutputBasePath;
   
   // Initialize this node's attributes
   m_projectPaletteEntries.clear();
   m_sourceSearchPaths.clear();

   // Palette is target-dependent!
   if ( !m_projectTarget.compare("nes",Qt::CaseInsensitive) )
   {
      for (int col=0; col < nesGetNumColors(); col++)
      {
         m_projectPaletteEntries.append(QColor(nesGetPaletteRedComponent(col),
                                               nesGetPaletteGreenComponent(col),
                                               nesGetPaletteBlueComponent(col)));
      }
      
      // Add default expected source search paths that are target-dependent.
      // Doing it here to prevent users with pre-existing projects from having
      // to add the paths manually.
      addSourceSearchPath(QDir::fromNativeSeparators(cc65home+"/libsrc/nes"));
   }
   else if ( !m_projectTarget.compare("c64",Qt::CaseInsensitive) )
   {
      for (int col=0; col < c64GetNumColors(); col++)
      {
         m_projectPaletteEntries.append(QColor(c64GetPaletteRedComponent(col),
                                               c64GetPaletteGreenComponent(col),
                                               c64GetPaletteBlueComponent(col)));
      }
      
      // Add default expected source search paths that are target-dependent.
      // Doing it here to prevent users with pre-existing projects from having
      // to add the paths manually.
      addSourceSearchPath(QDir::fromNativeSeparators(cc65home+"/libsrc/c64"));
   }
   
   // Add default expected source search paths that are target-independent.
   // Doing it here to prevent users with pre-existing projects from having
   // to add the paths manually.
   addSourceSearchPath(QDir::fromNativeSeparators(cc65home+"/libsrc"));

   // Notify the fact that the project data has been initialized properly
   m_projectFileName = "(unset)";
   m_projectTitle = "(No project loaded)";
   setProjectOutputBasePath(".");
   setProjectOutputName("");
   m_projectHeaderFileName = PROJECT_HEADER_FILE;
   m_projectSourceFileName = PROJECT_SOURCE_FILE;
   m_compilerDefinedSymbols = "";
   m_compilerIncludePaths = "";
   m_compilerAdditionalOptions = "";
   m_assemblerDefinedSymbols = "";
   m_assemblerIncludePaths = "";
   m_assemblerAdditionalOptions = "";
   m_linkerConfigFile = "";
   m_makefileCustomRulesFile = "";
   m_linkerAdditionalOptions = "";
   m_linkerAdditionalDependencies = "";

   m_saveStateDoc.clear();

   m_tileProperties.clear();

   m_isInitialized = true;
   m_isDirty = false;

   // Initialize child nodes
   m_pProject->initializeProject();
   m_pCartridge->initializeProject();

   // Add child nodes to tree
   appendChild(m_pProject);
   appendChild(m_pCartridge);
}
AttributeTableEditorForm::AttributeTableEditorForm(QList<uint8_t> palette,IProjectTreeViewItem* link,QWidget* parent) :
   CDesignerEditorBase(link,parent),
   ui(new Ui::AttributeTableEditorForm)
{
   int idx;

   ui->setupUi(this);

   m_palette = palette;

   m_colors.append(ui->bkgndcol);
   m_colors.append(ui->pal0col1);
   m_colors.append(ui->pal0col2);
   m_colors.append(ui->pal0col3);
   m_colors.append(ui->bkgndcol);
   m_colors.append(ui->pal1col1);
   m_colors.append(ui->pal1col2);
   m_colors.append(ui->pal1col3);
   m_colors.append(ui->bkgndcol);
   m_colors.append(ui->pal2col1);
   m_colors.append(ui->pal2col2);
   m_colors.append(ui->pal2col3);
   m_colors.append(ui->bkgndcol);
   m_colors.append(ui->pal3col1);
   m_colors.append(ui->pal3col2);
   m_colors.append(ui->pal3col3);

   for ( idx = 0; idx < m_colors.count(); idx++ )
   {
      m_colors.at(idx)->setCurrentColor(QColor(nesGetPaletteRedComponent(m_palette.at(idx)),nesGetPaletteGreenComponent(m_palette.at(idx)),nesGetPaletteBlueComponent(m_palette.at(idx))));
      QObject::connect(m_colors.at(idx),SIGNAL(colorChanged(QColor)),this,SLOT(colorChanged(QColor)));
   }
}