Beispiel #1
0
ModEditWindow::ModEditWindow(MainWindow *parent, Instance *inst)
	: wxFrame(parent, -1, _("Edit Mods"), wxDefaultPosition, wxSize(500, 400))
{
	m_mainWin = parent;
	wxPanel *mainPanel = new wxPanel(this);

	SetTitle(wxString::Format(_("Edit Mods for %s"), inst->GetName().c_str()));
	
	m_inst = inst;
	
	wxBoxSizer *mainBox = new wxBoxSizer(wxVERTICAL);
	mainPanel->SetSizer(mainBox);
	
	wxNotebook *modEditNotebook = new wxNotebook(mainPanel, -1);
	mainBox->Add(modEditNotebook, wxSizerFlags(1).Expand().Border(wxALL, 8));
	
	wxPanel *jarModPanel = new wxPanel(modEditNotebook, -1);
	wxBoxSizer *jarModSizer = new wxBoxSizer(wxHORIZONTAL);
	jarModPanel->SetSizer(jarModSizer);
	modEditNotebook->AddPage(jarModPanel, _("Jar Mods"), true);
	
	jarModList = new JarModListCtrl(jarModPanel, ID_JAR_MOD_LIST, inst);
	jarModList->InsertColumn(0, _("Mod Name"));
	jarModList->InsertColumn(1, _("Mod Version"), wxLIST_FORMAT_RIGHT);
	jarModList->SetDropTarget(new JarModsDropTarget(jarModList, inst));
	jarModSizer->Add(jarModList, wxSizerFlags(1).Expand().Border(wxALL, 8));
	
	wxBoxSizer *jarListBtnBox = new wxBoxSizer(wxVERTICAL);
	jarModSizer->Add(jarListBtnBox, wxSizerFlags(0).Border(wxTOP | wxBOTTOM, 4));
	
	wxButton *addJarModBtn = new wxButton(jarModPanel, ID_ADD_JAR_MOD, _("&Add"));
	jarListBtnBox->Add(addJarModBtn, wxSizerFlags(0).Border(wxTOP | wxBOTTOM | wxRIGHT, 4));
	
	delJarModBtn = new wxButton(jarModPanel, ID_DEL_JAR_MOD, _("&Remove"));
	jarListBtnBox->Add(delJarModBtn, wxSizerFlags(0).Border(wxTOP | wxBOTTOM | wxRIGHT, 4));
	
	jarModUpBtn = new wxButton(jarModPanel, ID_MOVE_JAR_MOD_UP, _("Move &Up"));
	jarListBtnBox->Add(jarModUpBtn, wxSizerFlags(0).Border(wxTOP | wxBOTTOM | wxRIGHT, 4).Align(wxALIGN_BOTTOM));
	
	jarModDownBtn = new wxButton(jarModPanel, ID_MOVE_JAR_MOD_DOWN, _("Move &Down"));
	jarListBtnBox->Add(jarModDownBtn, wxSizerFlags(0).Border(wxTOP | wxBOTTOM | wxRIGHT, 4).Align(wxALIGN_BOTTOM));
	
	
	wxPanel *mlModPanel = new wxPanel(modEditNotebook, -1);
	wxBoxSizer *mlModSizer = new wxBoxSizer(wxHORIZONTAL);
	mlModPanel->SetSizer(mlModSizer);
	modEditNotebook->AddPage(mlModPanel, _("Mods Folder"));
	
	mlModList = new MLModListCtrl(mlModPanel, ID_ML_MOD_LIST, inst);
	mlModList->InsertColumn(0, _("Mod Name"));
	mlModList->InsertColumn(1, _("Mod Version"), wxLIST_FORMAT_RIGHT);
	mlModList->SetDropTarget(new MLModsDropTarget(mlModList, inst));
	mlModSizer->Add(mlModList, wxSizerFlags(1).Expand().Border(wxALL, 8));
	
	wxBoxSizer *mlModListBtnBox = new wxBoxSizer(wxVERTICAL);
	mlModSizer->Add(mlModListBtnBox, wxSizerFlags(0).Border(wxTOP | wxBOTTOM, 4));
	
	wxButton *addMLModBtn = new wxButton(mlModPanel, ID_ADD_ML_MOD, _("&Add"));
	mlModListBtnBox->Add(addMLModBtn, wxSizerFlags(0).Border(wxTOP | wxBOTTOM | wxRIGHT, 4));
	
	wxButton *delMLModBtn = new wxButton(mlModPanel, ID_DEL_ML_MOD, _("&Remove"));
	mlModListBtnBox->Add(delMLModBtn, wxSizerFlags(0).Border(wxTOP | wxBOTTOM | wxRIGHT, 4));
	
	
	wxBoxSizer *btnBox = new wxBoxSizer(wxHORIZONTAL);
	mainBox->Add(btnBox, 0, wxALIGN_RIGHT | wxBOTTOM | wxRIGHT | wxLEFT, 8);

	wxButton *btnExport = new wxButton(mainPanel, ID_EXPORT, _("&Export"));
	btnBox->Add(btnExport, wxSizerFlags(0).Align(wxALIGN_LEFT).Border(wxALL, 4));

	wxButton *btnClose = new wxButton(mainPanel, wxID_CLOSE, _("&Close"));
	btnBox->Add(btnClose, wxSizerFlags(0).Align(wxALIGN_RIGHT).Border(wxALL, 4));
	
	CenterOnParent();
	
	LoadJarMods();
	LoadMLMods();
}
Beispiel #2
0
ModEditWindow::ModEditWindow(MainWindow *parent, Instance *inst)
	: wxFrame(parent, -1, _("Edit Mods"), wxDefaultPosition, wxSize(500, 400))
{
	m_mainWin = parent;
	wxPanel *mainPanel = new wxPanel(this);

	SetTitle(wxString::Format(_("Edit Mods for %s"), inst->GetName().c_str()));
	
	m_inst = inst;
	
	wxBoxSizer *mainBox = new wxBoxSizer(wxVERTICAL);
	mainPanel->SetSizer(mainBox);
	
	wxNotebook *modEditNotebook = new wxNotebook(mainPanel, -1);
	mainBox->Add(modEditNotebook, wxSizerFlags(1).Expand().Border(wxALL, 8));
	
	// .jar mod panel
	{
		wxPanel *jarModPanel = new wxPanel(modEditNotebook, -1);
		wxBoxSizer *jarModSizer = new wxBoxSizer(wxHORIZONTAL);
		jarModPanel->SetSizer(jarModSizer);
		modEditNotebook->AddPage(jarModPanel, _("Minecraft.jar"), true);
		
		jarModList = new JarModListCtrl(jarModPanel, ID_JAR_MOD_LIST, inst);
		jarModList->InsertColumn(0, _("Mod Name"));
		jarModList->InsertColumn(1, _("Mod Version"), wxLIST_FORMAT_RIGHT);
		jarModList->SetDropTarget(new JarModsDropTarget(jarModList, inst));
		jarModSizer->Add(jarModList, wxSizerFlags(1).Expand().Border(wxALL, 8));
		
		wxBoxSizer *jarListBtnBox = new wxBoxSizer(wxVERTICAL);
		jarModSizer->Add(jarListBtnBox, wxSizerFlags(0).Border(wxTOP | wxBOTTOM, 4).Expand());
		
		wxButton *addJarModBtn = new wxButton(jarModPanel, ID_ADD_JAR_MOD, _("&Add"));
		addJarModBtn->SetToolTip(_("Add a jar mod."));
		jarListBtnBox->Add(addJarModBtn, wxSizerFlags(0).Border(wxTOP | wxBOTTOM | wxRIGHT, 4).Expand());
		
		delJarModBtn = new wxButton(jarModPanel, ID_DEL_JAR_MOD, _("&Remove"));
		delJarModBtn->SetToolTip(_("Remove the selected jar mod."));
		jarListBtnBox->Add(delJarModBtn, wxSizerFlags(0).Border(wxTOP | wxBOTTOM | wxRIGHT, 4).Expand());

		wxButton *installMCForgeBtn = new wxButton(jarModPanel, ID_INSTALL_FORGE, _("MCForge"));
		installMCForgeBtn->SetToolTip(_("Download and install Minecraft Forge"));
		jarListBtnBox->Add(installMCForgeBtn, wxSizerFlags(0).Border(wxTOP | wxBOTTOM | wxRIGHT, 4).Expand());

		jarListBtnBox->AddStretchSpacer();
		
		jarModUpBtn = new wxButton(jarModPanel, ID_MOVE_JAR_MOD_UP, _("Move &Up"));
		jarModUpBtn->SetToolTip(_("Move the selected jar mod up."));
		jarListBtnBox->Add(jarModUpBtn, wxSizerFlags(0).Border(wxTOP | wxBOTTOM | wxRIGHT, 4).Align(wxALIGN_BOTTOM).Expand());
		
		jarModDownBtn = new wxButton(jarModPanel, ID_MOVE_JAR_MOD_DOWN, _("Move &Down"));
		jarModDownBtn->SetToolTip(_("Move the selected jar mod down"));
		jarListBtnBox->Add(jarModDownBtn, wxSizerFlags(0).Border(wxTOP | wxBOTTOM | wxRIGHT, 4).Align(wxALIGN_BOTTOM).Expand());
	}
	
	// Core mod folder panel
	{
		auto coreModPanel = new wxPanel(modEditNotebook, -1);
		auto coreModSizer = new wxBoxSizer(wxHORIZONTAL);
		coreModPanel->SetSizer(coreModSizer);
		modEditNotebook->AddPage(coreModPanel, _("Coremods Folder"));
		
		coreModList = new CoreModListCtrl(coreModPanel, ID_CORE_MOD_LIST, inst);
		coreModList->InsertColumn(0, _("Mod Name"));
		coreModList->InsertColumn(1, _("Mod Version"), wxLIST_FORMAT_RIGHT);
		coreModList->SetDropTarget(new CoreModsDropTarget(coreModList, inst));
		coreModSizer->Add(coreModList, wxSizerFlags(1).Expand().Border(wxALL, 8));
		
		auto coreModListBtnBox = new wxBoxSizer(wxVERTICAL);
		coreModSizer->Add(coreModListBtnBox, wxSizerFlags(0).Border(wxTOP | wxBOTTOM, 4).Expand());
		
		wxButton *addCoreModBtn = new wxButton(coreModPanel, ID_ADD_CORE_MOD, _("&Add"));
		addCoreModBtn->SetToolTip(_("Add a new forge core mod."));
		coreModListBtnBox->Add(addCoreModBtn, wxSizerFlags(0).Border(wxTOP | wxBOTTOM | wxRIGHT, 4).Expand());
		
		wxButton *delCoreModBtn = new wxButton(coreModPanel, ID_DEL_CORE_MOD, _("&Remove"));
		delCoreModBtn->SetToolTip(_("Remove the selected core mod"));
		coreModListBtnBox->Add(delCoreModBtn, wxSizerFlags(0).Border(wxTOP | wxBOTTOM | wxRIGHT, 4).Expand());

		coreModListBtnBox->AddStretchSpacer();
		
		auto exploreCoreModBtn = new wxButton(coreModPanel, ID_EXPLORE_CORE, _("&View Folder"));
		exploreCoreModBtn->SetToolTip(_("Open the core mod folder in your file browser."));
		coreModListBtnBox->Add(exploreCoreModBtn, wxSizerFlags(0).Border(wxTOP | wxBOTTOM | wxRIGHT, 4).Align(wxALIGN_BOTTOM).Expand());
	}
	
	// Mod folder panel
	{
		wxPanel *mlModPanel = new wxPanel(modEditNotebook, -1);
		wxBoxSizer *mlModSizer = new wxBoxSizer(wxHORIZONTAL);
		mlModPanel->SetSizer(mlModSizer);
		modEditNotebook->AddPage(mlModPanel, _("Mods Folder"));
		
		mlModList = new MLModListCtrl(mlModPanel, ID_ML_MOD_LIST, inst);
		mlModList->InsertColumn(0, _("Mod Name"));
		mlModList->InsertColumn(1, _("Mod Version"), wxLIST_FORMAT_RIGHT);
		mlModList->SetDropTarget(new MLModsDropTarget(mlModList, inst));
		mlModSizer->Add(mlModList, wxSizerFlags(1).Expand().Border(wxALL, 8));
		
		wxBoxSizer *mlModListBtnBox = new wxBoxSizer(wxVERTICAL);
		mlModSizer->Add(mlModListBtnBox, wxSizerFlags(0).Border(wxTOP | wxBOTTOM, 4).Expand());
		
		wxButton *addMLModBtn = new wxButton(mlModPanel, ID_ADD_ML_MOD, _("&Add"));
		addMLModBtn->SetToolTip(_("Add a new modloader mod."));
		mlModListBtnBox->Add(addMLModBtn, wxSizerFlags(0).Border(wxTOP | wxBOTTOM | wxRIGHT, 4).Expand());
		
		wxButton *delMLModBtn = new wxButton(mlModPanel, ID_DEL_ML_MOD, _("&Remove"));
		delMLModBtn->SetToolTip(_("Remove the selected modloader mod."));
		mlModListBtnBox->Add(delMLModBtn, wxSizerFlags(0).Border(wxTOP | wxBOTTOM | wxRIGHT, 4).Expand());

		mlModListBtnBox->AddStretchSpacer();
		
		auto exploreMLModBtn = new wxButton(mlModPanel, ID_EXPLORE_ML, _("&View Folder"));
		exploreMLModBtn->SetToolTip(_("Open the modloader mods folder in your file browser."));
		mlModListBtnBox->Add(exploreMLModBtn, wxSizerFlags(0).Border(wxTOP | wxBOTTOM | wxRIGHT, 4).Align(wxALIGN_BOTTOM).Expand());
	}

	// Texture pack tab
	{
		wxPanel *tpPanel = new wxPanel(modEditNotebook, -1);
		wxBoxSizer *tpSizer = new wxBoxSizer(wxHORIZONTAL);
		tpPanel->SetSizer(tpSizer);
		modEditNotebook->AddPage(tpPanel, _("Texture Packs"));

		texturePackList = new TexturePackListCtrl(tpPanel, ID_TEXTURE_PACK_LIST, inst);
		texturePackList->InsertColumn(0, _("Name"));
		texturePackList->SetDropTarget(new TexturePackDropTarget(texturePackList, inst));
		tpSizer->Add(texturePackList, wxSizerFlags(1).Expand().Border(wxALL, 8));

		wxBoxSizer *tpackListBtnBox = new wxBoxSizer(wxVERTICAL);
		tpSizer->Add(tpackListBtnBox, wxSizerFlags(0).Border(wxTOP | wxBOTTOM, 4).Expand());

		wxButton *addTPackButton = new wxButton(tpPanel, ID_ADD_TEXTURE_PACK, _("&Add"));
		addTPackButton->SetToolTip(_("Add a new texture pack."));
		tpackListBtnBox->Add(addTPackButton, wxSizerFlags(0).Border(wxTOP | wxBOTTOM | wxRIGHT, 4).Expand());

		wxButton *delTPackButton = new wxButton(tpPanel, ID_DEL_TEXTURE_PACK, _("&Remove"));
		delTPackButton->SetToolTip(_("Remove the selected texture pack."));
		tpackListBtnBox->Add(delTPackButton, wxSizerFlags(0).Border(wxTOP | wxBOTTOM | wxRIGHT, 4).Expand());

		tpackListBtnBox->AddStretchSpacer();

		auto exploreTPackButton = new wxButton(tpPanel, ID_EXPLORE_TEXTURE_PACK, _("&View Folder"));
		exploreTPackButton->SetToolTip(_("Open the texture packs folder in your file browser."));
		tpackListBtnBox->Add(exploreTPackButton, wxSizerFlags(0).Border(wxTOP | wxBOTTOM | wxRIGHT, 4).Align(wxALIGN_BOTTOM).Expand());
	}
	
	// Buttons on the bottom of the dialog
	{
		wxBoxSizer *btnBox = new wxBoxSizer(wxHORIZONTAL);
		mainBox->Add(btnBox, 0, wxEXPAND | wxBOTTOM | wxRIGHT | wxLEFT, 8);

		wxButton *btnReload = new wxButton(mainPanel, ID_RELOAD, _("&Reload"));
		btnReload->SetToolTip(_("Reload the mod lists."));
		btnBox->Add(btnReload, wxSizerFlags(0).Align(wxALIGN_LEFT).Border(wxRIGHT | wxTOP | wxBOTTOM, 4));

		wxButton *btnExport = new wxButton(mainPanel, ID_EXPORT, _("&Export"));
		btnExport->SetToolTip(_("Export the instance to a config pack."));
		btnBox->Add(btnExport, wxSizerFlags(0).Align(wxALIGN_LEFT).Border(wxRIGHT | wxTOP | wxBOTTOM, 4));

		btnBox->AddStretchSpacer();

		wxButton *btnClose = new wxButton(mainPanel, wxID_CLOSE, _("&Close"));
		btnClose->SetToolTip(_("Close this window."));
		btnBox->Add(btnClose, wxSizerFlags(0).Align(wxALIGN_RIGHT).Border(wxTOP | wxBOTTOM, 4));
	}

	// Keyboard accelerators.
	wxAcceleratorEntry entries[1];
	entries[0].Set(wxACCEL_CTRL,	(int) 'W',	wxID_CLOSE);
	wxAcceleratorTable accel(sizeof(entries), entries);
	SetAcceleratorTable(accel);
	
	CenterOnParent();
	
	LoadJarMods();
	LoadMLMods();
	LoadCoreMods();
	texturePackList->UpdateItems();
}