예제 #1
0
void LabelDialog::OnImport(wxCommandEvent & WXUNUSED(event))
{
   wxString path = gPrefs->Read(wxT("/DefaultOpenPath"),::wxGetCwd());

   // Ask user for a filename
   wxString fileName =
       FileSelector(_("Select a text file containing labels..."),
                    path,     // Path
                    wxT(""),       // Name
                    wxT(".txt"),   // Extension
                    _("Text files (*.txt)|*.txt|All files|*"),
                    wxRESIZE_BORDER, // Flags
                    this);    // Parent

   // They gave us one...
   if (fileName != wxT("")) {
      path =::wxPathOnly(fileName);
      gPrefs->Write(wxT("/DefaultOpenPath"), path);
      gPrefs->Flush();

      wxTextFile f;

      // Get at the data
      f.Open(fileName);
      if (!f.IsOpened()) {
         wxMessageBox(_("Could not open file: ") + fileName);
      }
      else {
         // Create a temporary label track and load the labels
         // into it
         LabelTrack *lt = new LabelTrack(mDirManager);
         lt->Import(f);

         // Add the labesls to our collection
         AddLabels(lt);

         // Done with the temporary track
         delete lt;
     }

      // Repopulate the grid
      TransferDataToWindow();
   }
}
예제 #2
0
void LabelDialog::FindAllLabels()
{
   TrackListIterator iter(mTracks);
   Track *t;

   mInitialRow = -1;

   // Add labels from all label tracks
   for (t = iter.First(); t; t = iter.Next()) {
      if (t->GetKind() == Track::Label) {
         AddLabels((LabelTrack *) t);
      }
   }

   if (mData.GetCount() == 0) {
      wxCommandEvent e;
      OnInsert(e);
   }
}
예제 #3
0
void LabelDialog::FindAllLabels()
{
   TrackListIterator iter(mTracks);
   Track *t;


   // Add labels from all label tracks
   for (t = iter.First(); t; t = iter.Next()) {
      if (t->GetKind() == Track::Label)
         AddLabels(static_cast<LabelTrack *>(t));
   }

   FindInitialRow();

   if (mData.size() == 0) {
      wxCommandEvent e;
      OnInsert(e);
   }
}
bool GameOverScene::init()
{
	auto backgroundStartColor = m_type == EndType::SUCCESS ? BACKGROUND_GRADIENT_FROM_SUCCESS : BACKGROUND_GRADIENT_FROM_FAIL;
	if (!LayerGradient::initWithColor(backgroundStartColor, BACKGROUND_GRADIENT_TO))
	{
		return false;
	}

	m_visibleSize = Director::getInstance()->getVisibleSize();
	m_origin = Director::getInstance()->getVisibleOrigin();

	AddLabels();
	AddMenu();
	if (m_type == EndType::SUCCESS)
	{
		AddParticles();
	}

	return true;
}