Example #1
0
/* MapEntryPanel::MapEntryPanel
 * MapEntryPanel class constructor
 *******************************************************************/
MapEntryPanel::MapEntryPanel(wxWindow* parent) : EntryPanel(parent, "map")
{
	// Setup map canvas
	map_canvas = new MapPreviewCanvas(this);
	sizer_main->Add(map_canvas->toPanel(this), 1, wxEXPAND, 0);

	// Setup map toolbar buttons
	SToolBarGroup* group = new SToolBarGroup(toolbar, "Map");
	group->addActionButton("save_image", "Save Map Image", "export", "Save map overview to an image", true);
	group->addActionButton("pmap_open_text", "", true);
	toolbar->addGroup(group);

	// Remove save/revert buttons
	toolbar->deleteGroup("Entry");

	// Setup bottom panel
	sizer_bottom->Add(label_stats = new wxStaticText(this, -1, ""), 0, wxALIGN_CENTER_VERTICAL);
	sizer_bottom->AddStretchSpacer();
	sizer_bottom->Add(cb_show_things = new wxCheckBox(this, -1, "Show Things"), 0, wxALIGN_CENTER_VERTICAL);
	cb_show_things->SetValue(map_view_things);

	// Bind events
	cb_show_things->Bind(wxEVT_CHECKBOX, &MapEntryPanel::onCBShowThings, this);

	// Layout
	Layout();
}
Example #2
0
void SToolBar::addActionGroup(string name, wxArrayString actions)
{
	// Do nothing if no actions were given
	if (actions.size() == 0)
		return;

	// Create new toolbar group
	SToolBarGroup* group = new SToolBarGroup(this, name);
	groups.push_back(group);

	// Add actions to the group
	for (unsigned a = 0; a < actions.size(); a++)
		group->addActionButton(actions[a]);

	// Update layout
	updateLayout(true);
}
Example #3
0
/* SwitchesEntryPanel::SwitchesEntryPanel
 * SwitchesEntryPanel class constructor
 *******************************************************************/
SwitchesEntryPanel::SwitchesEntryPanel(wxWindow* parent)
	: EntryPanel(parent, "switches")
{
	se_current = NULL;
	se_modified = false;

	// Setup toolbar
	SToolBarGroup* group = new SToolBarGroup(toolbar, "Switches");
	group->addActionButton("new_switch", "New Switch", "switch_new", "Create a new switch definition", true);
	toolbar->addGroup(group);

	// Setup panel sizer
	wxBoxSizer* sizer = new wxBoxSizer(wxHORIZONTAL);
	sizer_main->Add(sizer, 1, wxEXPAND, 0);

	// Add entry list
	wxStaticBox* frame = new wxStaticBox(this, -1, "Switches");
	wxStaticBoxSizer* framesizer = new wxStaticBoxSizer(frame, wxVERTICAL);
	list_entries = new ListView(this, -1);
	list_entries->showIcons(false);
	framesizer->Add(list_entries, 1, wxEXPAND|wxALL, 4);
	sizer->Add(framesizer, 0, wxEXPAND|wxALL, 4);

	// Add editing controls
	frame = new wxStaticBox(this, -1, "Selection");
	framesizer = new wxStaticBoxSizer(frame, wxHORIZONTAL);

	wxStaticBox* textframe;
	wxStaticBoxSizer* textframesizer;

	textframe = new wxStaticBox(this, -1, "Off frame");
	textframesizer = new wxStaticBoxSizer(textframe, wxVERTICAL);
	text_offname = new wxTextCtrl(this, -1, "", wxDefaultPosition, wxSize(80, -1));
	textframesizer->Add(text_offname, 1, wxTILE, 4);
	framesizer->Add(textframesizer, 1, wxTILE, 4);

	textframe = new wxStaticBox(this, -1, "On frame");
	textframesizer = new wxStaticBoxSizer(textframe, wxVERTICAL);
	text_onname = new wxTextCtrl(this, -1, "", wxDefaultPosition, wxSize(80, -1));
	textframesizer->Add(text_onname, 1, wxTILE, 4);
	framesizer->Add(textframesizer, 1, wxTILE, 4);

	textframe = new wxStaticBox(this, -1, "Range");
	textframesizer = new wxStaticBoxSizer(textframe, wxVERTICAL);
	rbtn_shareware = new wxRadioButton(this, 101, "Shareware", wxDefaultPosition, wxDefaultSize, 0);
	textframesizer->Add(rbtn_shareware, 1, wxTILE, 4);
	rbtn_registered = new wxRadioButton(this, 102, "Registered", wxDefaultPosition, wxDefaultSize, 0);
	textframesizer->Add(rbtn_registered, 1, wxTILE, 4);
	rbtn_commercial = new wxRadioButton(this, 103, "Commercial", wxDefaultPosition, wxDefaultSize, 0);
	textframesizer->Add(rbtn_commercial, 1, wxTILE, 4);
	framesizer->Add(textframesizer, 1, wxTILE, 4);

	// Finish layout
	sizer->Add(framesizer, 0, wxEXPAND|wxALL, 4);

	Layout();

	// Bind events
	list_entries->Bind(wxEVT_LIST_ITEM_SELECTED, &SwitchesEntryPanel::onListSelect, this);
	list_entries->Bind(wxEVT_LIST_ITEM_RIGHT_CLICK, &SwitchesEntryPanel::onListRightClick, this);
	rbtn_shareware->Bind(wxEVT_RADIOBUTTON, &SwitchesEntryPanel::onTypeChanged, this);
	rbtn_registered->Bind(wxEVT_RADIOBUTTON, &SwitchesEntryPanel::onTypeChanged, this);
	rbtn_commercial->Bind(wxEVT_RADIOBUTTON, &SwitchesEntryPanel::onTypeChanged, this);
	text_offname->Bind(wxEVT_TEXT, &SwitchesEntryPanel::onOffNameChanged, this);
	text_onname->Bind(wxEVT_TEXT, &SwitchesEntryPanel::onOnNameChanged, this);
}
Example #4
0
/* AnimatedEntryPanel::AnimatedEntryPanel
 * AnimatedEntryPanel class constructor
 *******************************************************************/
AnimatedEntryPanel::AnimatedEntryPanel(wxWindow* parent)
	: EntryPanel(parent, "animated")
{
	ae_current = NULL;
	ae_modified = false;

	// Setup toolbar
	SToolBarGroup* group = new SToolBarGroup(toolbar, "Animated");
	group->addActionButton("new_anim", "New Animation", "animation_new", "Create a new animation definition", true);
	toolbar->addGroup(group);

	// Setup panel sizer
	wxBoxSizer* sizer = new wxBoxSizer(wxHORIZONTAL);
	sizer_main->Add(sizer, 1, wxEXPAND, 0);

	// Add entry list
	wxStaticBox* frame = new wxStaticBox(this, -1, "Animations");
	wxStaticBoxSizer* framesizer = new wxStaticBoxSizer(frame, wxVERTICAL);
	list_entries = new ListView(this, -1);
	list_entries->showIcons(false);
	framesizer->Add(list_entries, 1, wxEXPAND|wxALL, 4);
	sizer->Add(framesizer, 0, wxEXPAND|wxALL, 4);

	// Add editing controls
	frame = new wxStaticBox(this, -1, "Selection");
	framesizer = new wxStaticBoxSizer(frame, wxVERTICAL);
	wxBoxSizer* ctrlsizer = new wxBoxSizer(wxVERTICAL);
	wxBoxSizer* rowsizer = new wxBoxSizer(wxHORIZONTAL);

	wxStaticBox* textframe;
	wxStaticBoxSizer* textframesizer;

	textframe = new wxStaticBox(this, -1, "First frame");
	textframesizer = new wxStaticBoxSizer(textframe, wxHORIZONTAL);
	text_firstname = new wxTextCtrl(this, -1, "", wxDefaultPosition, wxSize(80, -1));
	textframesizer->Add(text_firstname, 1, wxTILE, 4);
	rowsizer->Add(textframesizer, 1, wxTILE, 4);

	textframe = new wxStaticBox(this, -1, "Last frame");
	textframesizer = new wxStaticBoxSizer(textframe, wxHORIZONTAL);
	text_lastname = new wxTextCtrl(this, -1, "", wxDefaultPosition, wxSize(80, -1));
	textframesizer->Add(text_lastname, 1, wxTILE, 4);
	rowsizer->Add(textframesizer, 1, wxTILE, 4);

	textframe = new wxStaticBox(this, -1, "Speed");
	textframesizer = new wxStaticBoxSizer(textframe, wxHORIZONTAL);
	text_speed = new wxTextCtrl(this, -1, "", wxDefaultPosition, wxSize(80, -1));
	textframesizer->Add(text_speed, 1, wxTILE, 4);
	rowsizer->Add(textframesizer, 1, wxTILE, 4);

	ctrlsizer->Add(rowsizer, 1, wxTILE, 4);

	rowsizer = new wxBoxSizer(wxHORIZONTAL);
	textframe = new wxStaticBox(this, -1, "Type");
	textframesizer = new wxStaticBoxSizer(textframe, wxHORIZONTAL);
	rbtn_flat = new wxRadioButton(this, 101, "Flat", wxDefaultPosition, wxDefaultSize, 0);
	rbtn_texture = new wxRadioButton(this, 102, "Texture", wxDefaultPosition, wxDefaultSize, 0);
	cbox_decals = new wxCheckBox(this, -1, "Decals?");
	cbox_swirl = new wxCheckBox(this, -1, "Swirl?");
	textframesizer->Add(rbtn_flat, 0, wxEXPAND|wxALL, 4);
	textframesizer->Add(rbtn_texture, 0, wxEXPAND|wxALL, 4);
	textframesizer->Add(cbox_decals, 0, wxEXPAND|wxALL, 4);
	textframesizer->Add(cbox_swirl, 0, wxEXPAND|wxALL, 4);
	rowsizer->Add(textframesizer, 1, wxTILE, 4);

	ctrlsizer->Add(rowsizer, 1, wxTILE, 4);

	framesizer->Add(ctrlsizer, 1, wxTILE, 4);
	sizer->Add(framesizer, 0, wxEXPAND|wxALL, 4);

	Layout();

	// Bind events
	list_entries->Bind(wxEVT_LIST_ITEM_SELECTED, &AnimatedEntryPanel::onListSelect, this);
	list_entries->Bind(wxEVT_LIST_ITEM_RIGHT_CLICK, &AnimatedEntryPanel::onListRightClick, this);
	rbtn_flat->Bind(wxEVT_RADIOBUTTON, &AnimatedEntryPanel::onTypeChanged, this);
	rbtn_texture->Bind(wxEVT_RADIOBUTTON, &AnimatedEntryPanel::onTypeChanged, this);
	cbox_decals->Bind(wxEVT_CHECKBOX, &AnimatedEntryPanel::onDecalsChanged, this);
	cbox_swirl->Bind(wxEVT_CHECKBOX, &AnimatedEntryPanel::onSwirlChanged, this);
	text_firstname->Bind(wxEVT_TEXT, &AnimatedEntryPanel::onFirstNameChanged, this);
	text_lastname->Bind(wxEVT_TEXT, &AnimatedEntryPanel::onLastNameChanged, this);
	text_speed->Bind(wxEVT_TEXT, &AnimatedEntryPanel::onSpeedChanged, this);
}