Пример #1
0
void VisualModelPanel::SaveData()
{
   // don't do anything if no data has been changed.
   // note that dataChanged will be true if the user modified any combo box or
   // text ctrl, whether or not he/she actually changed the value; we want to only
   // send the values to the object if something was really changed, to avoid
   // the hasBeenModified flag being set to true erroneously
   canClose    = true;

   try
   {
      if (mTextChanged)
      {
        UpdateTextCtrl(ID_ROT_TEXT);
        UpdateTextCtrl(ID_TRAN_TEXT);
        UpdateTextCtrl(ID_SCALE_TEXT);
        UpdateTextCtrl(ID_TEXTCTRL);
        mTextChanged = false;
      }
   }
   catch (BaseException &ex)
   {
      canClose = false;
      dataChanged = true;
      MessageInterface::PopupMessage(Gmat::ERROR_, ex.GetFullMessage());
   }

   if (canClose)
   {
      dataChanged = false;
   }
}
Пример #2
0
//------------------------------------------------------------------------------
void VisualModelPanel::OnTextCtrlEnter(wxCommandEvent& event)
{
	int id = event.GetId();
	UpdateTextCtrl(id);
	dataChanged = true;
	theScPanel->EnableUpdate(true);
}
Пример #3
0
CARCodeAddEdit::CARCodeAddEdit(int _selection, std::vector<ActionReplay::ARCode>* _arCodes, wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& position, const wxSize& size, long style)
    : wxDialog(parent, id, title, position, size, style)
    , arCodes(_arCodes)
    , selection(_selection)
{
    Bind(wxEVT_BUTTON, &CARCodeAddEdit::SaveCheatData, this, wxID_OK);

    ActionReplay::ARCode tempEntries;
    wxString currentName;

    if (selection == wxNOT_FOUND)
    {
        tempEntries.name = "";
    }
    else
    {
        currentName = StrToWxStr(arCodes->at(selection).name);
        tempEntries = arCodes->at(selection);
    }

    wxBoxSizer* sEditCheat = new wxBoxSizer(wxVERTICAL);
    wxStaticBoxSizer* sbEntry = new wxStaticBoxSizer(wxVERTICAL, this, _("Cheat Code"));
    wxGridBagSizer* sgEntry = new wxGridBagSizer(0, 0);

    wxStaticText* EditCheatNameText = new wxStaticText(this, wxID_ANY, _("Name:"));
    wxStaticText* EditCheatCodeText = new wxStaticText(this, wxID_ANY, _("Code:"));

    EditCheatName = new wxTextCtrl(this, wxID_ANY, wxEmptyString);
    EditCheatName->SetValue(currentName);

    EntrySelection = new wxSpinButton(this);
    EntrySelection->SetRange(1, std::max((int)arCodes->size(), 1));
    EntrySelection->SetValue((int)(arCodes->size() - selection));
    EntrySelection->Bind(wxEVT_SPIN, &CARCodeAddEdit::ChangeEntry, this);

    EditCheatCode = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(300, 100), wxTE_MULTILINE);

    UpdateTextCtrl(tempEntries);

    sgEntry->Add(EditCheatNameText, wxGBPosition(0, 0), wxGBSpan(1, 1), wxALIGN_CENTER | wxALL, 5);
    sgEntry->Add(EditCheatCodeText, wxGBPosition(1, 0), wxGBSpan(1, 1), wxALIGN_CENTER | wxALL, 5);
    sgEntry->Add(EditCheatName, wxGBPosition(0, 1), wxGBSpan(1, 1), wxEXPAND | wxALL, 5);
    sgEntry->Add(EntrySelection, wxGBPosition(0, 2), wxGBSpan(2, 1), wxEXPAND | wxALL, 5);
    sgEntry->Add(EditCheatCode, wxGBPosition(1, 1), wxGBSpan(1, 1), wxEXPAND | wxALL, 5);
    sgEntry->AddGrowableCol(1);
    sgEntry->AddGrowableRow(1);
    sbEntry->Add(sgEntry, 1, wxEXPAND | wxALL);

    sEditCheat->Add(sbEntry, 1, wxEXPAND | wxALL, 5);
    sEditCheat->Add(CreateButtonSizer(wxOK | wxCANCEL), 0, wxEXPAND | wxALL, 5);

    SetSizerAndFit(sEditCheat);
    SetFocus();
}
Пример #4
0
CARCodeAddEdit::CARCodeAddEdit(int _selection, wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& position, const wxSize& size, long style)
	: wxDialog(parent, id, title, position, size, style)
	, selection(_selection)
{
	ActionReplay::ARCode tempEntries;
	wxString currentName = _("Insert name here..");

	if (selection == wxNOT_FOUND)
	{
		tempEntries.name = "";
	}
	else
	{
		currentName = StrToWxStr(arCodes.at(selection).name);
		tempEntries = arCodes.at(selection);
	}

	wxBoxSizer* sEditCheat = new wxBoxSizer(wxVERTICAL);
	wxStaticBoxSizer* sbEntry = new wxStaticBoxSizer(wxVERTICAL, this, _("Cheat Code"));
	wxGridBagSizer* sgEntry = new wxGridBagSizer(0, 0);

	wxStaticText* EditCheatNameText = new wxStaticText(this, ID_EDITCHEAT_NAME_TEXT, _("Name:"));
	EditCheatName = new wxTextCtrl(this, ID_EDITCHEAT_NAME, wxEmptyString);
	EditCheatName->SetValue(currentName);
	EntrySelection = new wxSpinButton(this, ID_ENTRY_SELECT);
	EntrySelection->SetRange(1, ((int)arCodes.size()) > 0 ? (int)arCodes.size() : 1);
	EntrySelection->SetValue((int)(arCodes.size() - selection));
	EditCheatCode = new wxTextCtrl(this, ID_EDITCHEAT_CODE, wxEmptyString, wxDefaultPosition, wxSize(300, 100), wxTE_MULTILINE);
	UpdateTextCtrl(tempEntries);

	sgEntry->Add(EditCheatNameText, wxGBPosition(0, 0), wxGBSpan(1, 1), wxALIGN_CENTER|wxALL, 5);
	sgEntry->Add(EditCheatName,     wxGBPosition(0, 1), wxGBSpan(1, 1), wxEXPAND|wxALL, 5);
	sgEntry->Add(EntrySelection,    wxGBPosition(0, 2), wxGBSpan(2, 1), wxEXPAND|wxALL, 5);
	sgEntry->Add(EditCheatCode,     wxGBPosition(1, 0), wxGBSpan(1, 2), wxEXPAND|wxALL, 5);
	sgEntry->AddGrowableCol(1);
	sgEntry->AddGrowableRow(1);
	sbEntry->Add(sgEntry, 1, wxEXPAND|wxALL);

	sEditCheat->Add(sbEntry, 1, wxEXPAND|wxALL, 5);
	sEditCheat->Add(CreateButtonSizer(wxOK | wxCANCEL), 0, wxEXPAND | wxALL, 5);

	SetSizerAndFit(sEditCheat);
	SetFocus();
}
Пример #5
0
void CARCodeAddEdit::ChangeEntry(wxSpinEvent& event)
{
	ActionReplay::ARCode currentCode = arCodes.at((int)arCodes.size() - event.GetPosition());
	EditCheatName->SetValue(StrToWxStr(currentCode.name));
	UpdateTextCtrl(currentCode);
}