2011-05-01 18:17:04 +00:00
using System ;
using System.Collections.Generic ;
using System.ComponentModel ;
using System.Data ;
using System.Drawing ;
using System.Linq ;
using System.Text ;
using System.Windows.Forms ;
2011-05-03 02:32:21 +00:00
using System.IO ;
using System.Reflection ;
2011-05-01 18:17:04 +00:00
namespace BizHawk.MultiClient
{
public partial class PathConfig : Form
{
2011-05-01 18:58:19 +00:00
//TODO:
2011-05-03 15:53:12 +00:00
// `exe` should be valid notation to mean path that the .exe is in ex: `exe`/NES
2011-05-01 18:58:19 +00:00
// ./ and ../ are always always relative to base path
2011-05-03 15:53:12 +00:00
// ./ and ../ in the base path are always relative to EXE path
2011-05-01 18:58:19 +00:00
// `recent` notation for most recently used path
//If "always use recent path for roms" is checked then base path of each platorm should be disabled
//Path text boxes shoudl be anchored L + R and the remaining widgets anchored R
2011-05-03 15:53:12 +00:00
//Find a way for base to always be absolute
2011-05-03 20:48:51 +00:00
//Make all base path text boxes not allow %recent%
//All path text boxes should do some kind of error checking
2011-05-04 20:31:36 +00:00
//Paths should default to their platform specific base before the main base! This will have to be done by specifically calling methods for each platform type
2011-05-01 18:58:19 +00:00
2011-05-01 18:17:04 +00:00
public PathConfig ( )
{
InitializeComponent ( ) ;
}
private void PathConfig_Load ( object sender , EventArgs e )
{
2011-05-04 20:31:36 +00:00
BasePathBox . Text = Global . Config . BasePath ;
NESBaseBox . Text = Global . Config . BaseNES ;
NESROMsBox . Text = Global . Config . PathNESROMs ;
NESSavestatesBox . Text = Global . Config . PathNESSavestates ;
NESSaveRAMBox . Text = Global . Config . PathNESSaveRAM ;
NESScreenshotsBox . Text = Global . Config . PathNESScreenshots ;
NESCheatsBox . Text = Global . Config . PathNESCheats ;
Sega8BaseBox . Text = Global . Config . BaseSMS ;
Sega8ROMsBox . Text = Global . Config . PathSMSROMs ;
Sega8SavestatesBox . Text = Global . Config . PathSMSSavestates ;
Sega8SaveRAM . Text = Global . Config . PathSMSSaveRAM ;
Sega8ScreenshotsBox . Text = Global . Config . PathSMSScreenshots ;
Sega8CheatsBox . Text = Global . Config . PathSMSCheats ;
PCEBaseBox . Text = Global . Config . BasePCE ;
PCEROMsBox . Text = Global . Config . PathPCEROMs ;
PCESavestatesBox . Text = Global . Config . PathPCESavestates ;
PCESaveRAMBox . Text = Global . Config . PathPCESaveRAM ;
PCEScreenshotsBox . Text = Global . Config . PathPCEScreenshots ;
PCECheatsBox . Text = Global . Config . PathPCECheats ;
GenesisBaseBox . Text = Global . Config . BaseGenesis ;
GenesisROMsBox . Text = Global . Config . PathGenesisROMs ;
GenesisSavestatesBox . Text = Global . Config . PathGenesisScreenshots ;
GenesisSaveRAMBox . Text = Global . Config . PathGenesisSaveRAM ;
GenesisScreenshotsBox . Text = Global . Config . PathGenesisScreenshots ;
GenesisCheatsBox . Text = Global . Config . PathGenesisCheats ;
GBBaseBox . Text = Global . Config . BaseGameboy ;
GBROMsBox . Text = Global . Config . PathGBROMs ;
GBSavestatesBox . Text = Global . Config . PathGBSavestates ;
GBSaveRAMBox . Text = Global . Config . PathGBSaveRAM ;
GBScreenshotsBox . Text = Global . Config . PathGBScreenshots ;
GBCheatsBox . Text = Global . Config . PathGBCheats ;
TI83BaseBox . Text = Global . Config . BaseTI83 ;
TI83ROMsBox . Text = Global . Config . PathTI83ROMs ;
TI83SavestatesBox . Text = Global . Config . PathTI83Savestates ;
TI83SaveRAMBox . Text = Global . Config . PathTI83SaveRAM ;
TI83ScreenshotsBox . Text = Global . Config . PathTI83Screenshots ;
TI83CheatsBox . Text = Global . Config . PathTI83Cheats ;
MoviesBox . Text = Global . Config . MoviesPath ;
LuaBox . Text = Global . Config . LuaPath ;
2011-05-03 02:32:21 +00:00
WatchBox . Text = Global . Config . WatchPath ;
2011-05-04 20:31:36 +00:00
AVIBox . Text = Global . Config . AVIPath ;
2011-05-03 02:32:21 +00:00
}
2011-05-01 18:17:04 +00:00
private void SaveSettings ( )
{
2011-05-04 02:00:08 +00:00
Global . Config . BasePath = BasePathBox . Text ;
2011-05-03 02:32:21 +00:00
Global . Config . WatchPath = WatchBox . Text ;
2011-05-01 18:17:04 +00:00
}
private void Cancel_Click ( object sender , EventArgs e )
{
this . Close ( ) ;
}
private void OK_Click ( object sender , EventArgs e )
{
SaveSettings ( ) ;
this . Close ( ) ;
}
2011-05-01 18:58:19 +00:00
2011-05-02 20:37:01 +00:00
private void tabControl1_SelectedIndexChanged ( object sender , EventArgs e )
2011-05-01 18:58:19 +00:00
{
2011-05-02 20:37:01 +00:00
//TODO: make base text box Controls[0] so this will focus on it
//tabControl1.TabPages[tabControl1.SelectedIndex].Controls[0].Focus();
}
2011-05-01 18:58:19 +00:00
2011-05-02 20:37:01 +00:00
private void RecentForROMs_CheckedChanged ( object sender , EventArgs e )
{
if ( RecentForROMs . Checked )
{
NESROMsBox . Enabled = false ;
BrowseNESROMs . Enabled = false ;
Sega8ROMsBox . Enabled = false ;
Sega8BrowseROMs . Enabled = false ;
GenesisROMsBox . Enabled = false ;
GenesisBrowseROMs . Enabled = false ;
PCEROMsBox . Enabled = false ;
PCEBrowseROMs . Enabled = false ;
GBROMsBox . Enabled = false ;
GBBrowseROMs . Enabled = false ;
TI83ROMsBox . Enabled = false ;
TI83BrowseROMs . Enabled = false ;
}
else
{
NESROMsBox . Enabled = true ;
BrowseNESROMs . Enabled = true ;
Sega8ROMsBox . Enabled = true ;
Sega8BrowseROMs . Enabled = true ;
GenesisROMsBox . Enabled = true ;
GenesisBrowseROMs . Enabled = true ;
PCEROMsBox . Enabled = true ;
PCEBrowseROMs . Enabled = true ;
GBROMsBox . Enabled = true ;
GBBrowseROMs . Enabled = true ;
TI83ROMsBox . Enabled = true ;
TI83BrowseROMs . Enabled = true ;
}
2011-05-01 18:58:19 +00:00
}
2011-05-03 02:32:21 +00:00
2011-05-04 02:00:08 +00:00
private void BrowseFolder ( TextBox box , string Name )
2011-05-03 02:32:21 +00:00
{
FolderBrowserDialog f = new FolderBrowserDialog ( ) ;
2011-05-04 02:00:08 +00:00
f . Description = "Set the directory for " + Name ;
2011-05-07 02:54:09 +00:00
//TODO: figure out how to send system parameter
f . SelectedPath = PathManager . MakeAbsolutePath ( box . Text , "" ) ;
2011-05-03 02:32:21 +00:00
DialogResult result = f . ShowDialog ( ) ;
if ( result = = DialogResult . OK )
2011-05-04 02:00:08 +00:00
box . Text = f . SelectedPath ;
}
private void BrowseWatch_Click ( object sender , EventArgs e )
{
BrowseFolder ( WatchBox , WatchDescription . Text ) ;
}
private void BrowseBase_Click ( object sender , EventArgs e )
{
BrowseFolder ( BasePathBox , BaseDescription . Text ) ;
}
private void SaveButton_Click ( object sender , EventArgs e )
{
SaveSettings ( ) ;
2011-05-03 02:32:21 +00:00
}
2011-05-01 18:17:04 +00:00
}
}