late fix for the new settings - need to rebuild the tree after accepting changes

doc updated with new dialog screenshot
pull/20/head v2.2
bm98 10 years ago
parent bb31a17c88
commit 837c2c9e8b

@ -4,6 +4,7 @@ using System.Linq;
using System.Text;
using System.Configuration;
using System.Drawing;
using System.Windows.Forms;
namespace SCJMapper_V2
{
@ -27,10 +28,11 @@ namespace SCJMapper_V2
/// <summary>
/// Show the Settings Dialog
/// </summary>
public void ShowSettings( )
public DialogResult ShowSettings( )
{
if ( FS == null ) FS = new FormSettings( this );
FS.ShowDialog( );
return ( FS.Canceled ) ? DialogResult.Cancel : DialogResult.OK;
}

@ -224,6 +224,11 @@ namespace SCJMapper_V2
if ( tc1.TabCount > 0 ) { cbJs1.SelectedIndex = 0; m_AT.ActionMaps.js1 = cbJs1.Text; }
if ( tc1.TabCount > 1 ) { cbJs2.SelectedIndex = 1; m_AT.ActionMaps.js2 = cbJs2.Text; }
if ( tc1.TabCount > 2 ) { cbJs3.SelectedIndex = 2; m_AT.ActionMaps.js3 = cbJs3.Text; }
if ( tc1.TabCount > 3 ) { m_AT.ActionMaps.js4 = ( String )tc1.TabPages[3].Tag; }
if ( tc1.TabCount > 4 ) { m_AT.ActionMaps.js5 = ( String )tc1.TabPages[4].Tag; }
if ( tc1.TabCount > 5 ) { m_AT.ActionMaps.js6 = ( String )tc1.TabPages[5].Tag; }
if ( tc1.TabCount > 6 ) { m_AT.ActionMaps.js7 = ( String )tc1.TabPages[6].Tag; }
if ( tc1.TabCount > 7 ) { m_AT.ActionMaps.js8 = ( String )tc1.TabPages[7].Tag; }
}
@ -339,14 +344,29 @@ namespace SCJMapper_V2
int i = cbJs1.FindString( m_AT.ActionMaps.js1 );
if ( i >= 0 ) cbJs1.SelectedIndex = i;
}
else {
if ( tc1.TabCount > 0 ) { cbJs1.SelectedIndex = 0; m_AT.ActionMaps.js1 = cbJs1.Text; }
}
if ( !String.IsNullOrEmpty( m_AT.ActionMaps.js2 ) ) {
int i = cbJs2.FindString( m_AT.ActionMaps.js2 );
if ( i >= 0 ) cbJs2.SelectedIndex = i;
}
else {
if ( tc1.TabCount > 1 ) { cbJs2.SelectedIndex = 1; m_AT.ActionMaps.js2 = cbJs2.Text; }
}
if ( !String.IsNullOrEmpty( m_AT.ActionMaps.js3 ) ) {
int i = cbJs3.FindString( m_AT.ActionMaps.js3 );
if ( i >= 0 ) cbJs3.SelectedIndex = i;
}
else {
if ( tc1.TabCount > 2 ) { cbJs3.SelectedIndex = 2; m_AT.ActionMaps.js3 = cbJs3.Text; }
}
if ( tc1.TabCount > 3 ) { m_AT.ActionMaps.js4 = ( String )tc1.TabPages[3].Tag; }
if ( tc1.TabCount > 4 ) { m_AT.ActionMaps.js5 = ( String )tc1.TabPages[4].Tag; }
if ( tc1.TabCount > 5 ) { m_AT.ActionMaps.js6 = ( String )tc1.TabPages[5].Tag; }
if ( tc1.TabCount > 6 ) { m_AT.ActionMaps.js7 = ( String )tc1.TabPages[6].Tag; }
if ( tc1.TabCount > 7 ) { m_AT.ActionMaps.js8 = ( String )tc1.TabPages[7].Tag; }
btDump.BackColor = btClear.BackColor; btDump.UseVisualStyleBackColor = btClear.UseVisualStyleBackColor; // neutral again
btGrab.BackColor = btClear.BackColor; btGrab.UseVisualStyleBackColor = btClear.UseVisualStyleBackColor; // neutral again
}
@ -695,10 +715,11 @@ namespace SCJMapper_V2
{
// have to stop polling while the Settings window is open
timer1.Enabled = false;
m_AppSettings.ShowSettings( );
foreach ( JoystickCls j in m_JS ) j.ApplySettings(); // update Seetings
m_AT.IgnoreMaps = m_AppSettings.IgnoreActionmaps;
InitActionTree( true );
if ( m_AppSettings.ShowSettings( ) != System.Windows.Forms.DialogResult.Cancel ) {
foreach ( JoystickCls j in m_JS ) j.ApplySettings( ); // update Seetings
m_AT.IgnoreMaps = m_AppSettings.IgnoreActionmaps;
InitActionTree( false );
}
timer1.Enabled = true;
}

@ -53,6 +53,8 @@
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.chkLbActionMaps = new System.Windows.Forms.CheckedListBox();
this.btCancel = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.groupBox3.SuspendLayout();
@ -60,11 +62,11 @@
//
// btDone
//
this.btDone.Location = new System.Drawing.Point(760, 340);
this.btDone.Location = new System.Drawing.Point(657, 340);
this.btDone.Name = "btDone";
this.btDone.Size = new System.Drawing.Size(93, 31);
this.btDone.TabIndex = 1;
this.btDone.Text = "Done";
this.btDone.Text = "Accept";
this.btDone.UseVisualStyleBackColor = true;
this.btDone.Click += new System.EventHandler(this.btDone_Click);
//
@ -303,12 +305,36 @@
this.chkLbActionMaps.Name = "chkLbActionMaps";
this.chkLbActionMaps.Size = new System.Drawing.Size(268, 301);
this.chkLbActionMaps.TabIndex = 0;
//
// btCancel
//
this.btCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btCancel.Location = new System.Drawing.Point(756, 340);
this.btCancel.Name = "btCancel";
this.btCancel.Size = new System.Drawing.Size(93, 31);
this.btCancel.TabIndex = 25;
this.btCancel.Text = "Cancel";
this.btCancel.UseVisualStyleBackColor = true;
this.btCancel.Click += new System.EventHandler(this.btCancel_Click);
//
// label1
//
this.label1.ForeColor = System.Drawing.Color.Red;
this.label1.Location = new System.Drawing.Point(227, 344);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(414, 28);
this.label1.TabIndex = 26;
this.label1.Text = "Note: Accepting changes will clear the action tree to apply the new settings; Can" +
"cel now if you want to save your work first.";
//
// FormSettings
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.btCancel;
this.ClientSize = new System.Drawing.Size(861, 381);
this.Controls.Add(this.label1);
this.Controls.Add(this.btCancel);
this.Controls.Add(this.groupBox3);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.groupBox1);
@ -357,5 +383,7 @@
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.GroupBox groupBox3;
private System.Windows.Forms.CheckedListBox chkLbActionMaps;
private System.Windows.Forms.Button btCancel;
private System.Windows.Forms.Label label1;
}
}

@ -13,6 +13,9 @@ namespace SCJMapper_V2
{
private readonly AppSettings m_owner = null; // owner class - access to settings
public Boolean Canceled { get; set; }
/// <summary>
/// ctor - gets the owning class instance
/// </summary>
@ -91,9 +94,16 @@ namespace SCJMapper_V2
private void btDone_Click( object sender, EventArgs e )
{
SaveSettings( );
Canceled = false;
this.Hide( );
}
private void btCancel_Click( object sender, EventArgs e )
{
LoadSettings( );
Canceled = true;
this.Hide( );
}
// allow only numbers, blanks and del
private bool nonNumberEntered = false;
@ -143,5 +153,6 @@ namespace SCJMapper_V2
}
}

@ -78,7 +78,7 @@ namespace SCJMapper_V2
{
log.Debug( "toXML - Entry" );
String r = String.Format( "<ActionMaps version=\"{0}\" ", version );
String r = String.Format( "<ActionMaps version=\"{0}\" \n", version );
if ( !String.IsNullOrEmpty( js1 ) ) r += String.Format( "js1=\"{0}\" ", js1 );
if ( !String.IsNullOrEmpty( js2 ) ) r += String.Format( "js2=\"{0}\" ", js2 );
if ( !String.IsNullOrEmpty( js3 ) ) r += String.Format( "js3=\"{0}\" ", js3 );

@ -148,7 +148,7 @@ namespace SCJMapper_V2
/// <summary>
/// Load MappingVars.csv into the ActionList and create the Master TreeView
/// Load Mappings into the ActionList and create the Master TreeView
/// </summary>
/// <param name="defaultProfileName">The name of the profile to load (w/o extension)</param>
/// <param name="applyDefaults">True if default mappings should be carried on</param>
@ -329,7 +329,7 @@ namespace SCJMapper_V2
log.Debug( "ReloadCtrl - Entry" );
foreach ( ActionMapCls acm in ActionMaps ) {
if ( IgnoreMaps.Contains( "," + acm.name + "," ) ) break; // next
if ( IgnoreMaps.Contains( "," + acm.name + "," ) ) break; // next
try {
TreeNode amTn = m_MasterTree.Nodes[acm.name]; // get the map node
// find the item to reload into the treeview

Binary file not shown.

Binary file not shown.
Loading…
Cancel
Save