V2.18 Build51 2.nd push for preRelease

fixed #36 Ctrl key works now
fix - keyboard command formatting
ActivationMode handling finished
user ActivationMode change indication in mapping tree
partial internal cleanup
doc update
pull/104/head v2.18beta
bm98 9 years ago
parent 5d948eb628
commit 29ebc857fe

@ -24,6 +24,7 @@ namespace SCJMapper_V2
static public Boolean IsDeviceClass( String deviceClass ) { return false; }
static public String DeviceClassFromInput( String input ) { return DeviceClass; }
static public String DevInput( String input ) { return input; }
static public Boolean DevMatch( String devInput ) { return false; }
public abstract String DevClass { get; }

2
Form1.Designer.cs generated

@ -334,10 +334,10 @@
//
// lblLastJ
//
this.lblLastJ.CausesValidation = false;
this.lblLastJ.ContextMenuStrip = this.cmMouseEntry;
this.lblLastJ.Location = new System.Drawing.Point(52, 42);
this.lblLastJ.Name = "lblLastJ";
this.lblLastJ.ShortcutsEnabled = false;
this.lblLastJ.Size = new System.Drawing.Size(222, 22);
this.lblLastJ.TabIndex = 14;
this.lblLastJ.Text = "...";

@ -1078,6 +1078,11 @@ namespace SCJMapper_V2
// after user entry of the context menu - see if one has changed the ActivationMode
private void cmAddDel_Closed( object sender, ToolStripDropDownClosedEventArgs e )
{
}
private void tdiCbxActivation_Click( object sender, EventArgs e )
{
cmAddDel.Close( ToolStripDropDownCloseReason.ItemClicked );
if ( !string.IsNullOrEmpty( m_prevActivationMode.Name ) && ( m_prevActivationMode.Name != ( string )tdiCbxActivation.SelectedItem ) ) {
tdiCbxActivation.Text = ( string )tdiCbxActivation.SelectedItem;
// seems to have changed - evaluate
@ -1088,33 +1093,22 @@ namespace SCJMapper_V2
}
}
private void tdiCbxActivation_Click( object sender, EventArgs e )
{
cmAddDel.Close( ToolStripDropDownCloseReason.ItemClicked );
}
private void tdiAssignBinding_Click( object sender, EventArgs e )
{ // same as btAssign_Click
if ( m_AT.UpdateSelectedItem( JoystickCls.MakeThrottle( lblLastJ.Text, cbxThrottle.Checked ), InputMode, true ) ) {
if ( m_AT.Dirty ) btDump.BackColor = MyColors.DirtyColor;
}
else MySounds.PlayNotfound( );
{
btAssign_Click( sender, e );
}
private void tdiBlendBinding_Click( object sender, EventArgs e )
{
// note: the right click selected the node
m_AT.BlendBinding( );
if ( m_AT.Dirty ) btDump.BackColor = MyColors.DirtyColor;
btBlend_Click( sender, e );
}
private void tdiClearBinding_Click( object sender, EventArgs e )
{
// note: the right click selected the node
m_AT.ClearBinding( );
if ( m_AT.Dirty ) btDump.BackColor = MyColors.DirtyColor;
btClear_Click( sender, e );
}
private void tsiAddBinding_Click( object sender, EventArgs e )
{
// note: the right click selected the node

@ -128,7 +128,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAA8
EAAAAk1TRnQBSQFMAgEBCQEAAcABDwHAAQ8BEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
EAAAAk1TRnQBSQFMAgEBCQEAAdABDwHQAQ8BEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
AwABQAMAATADAAEBAQABCAYAAQwYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA

@ -67,6 +67,18 @@ namespace SCJMapper_V2
return DeviceCls.DeviceClass; // unknown
}
/// <summary>
/// Create a DevInput string if the input does look like not having a device ID
/// </summary>
/// <param name="input">A gamepad input</param>
/// <returns>DevInput</returns>
static public new String DevInput( String input )
{
if ( DevMatch( input ) )
return input; // already
else
return DeviceID + input;
}
/// <summary>
/// Returns true if the input matches this device

@ -170,7 +170,7 @@ namespace SCJMapper_V2
{
// populate from input
// something like "v_pitch - js1_x" OR "v_pitch - xi_thumbl" OR "v_pitch - ximod+xi_thumbl+xi_mod"
String cmd = ActionTree.CommandFromNodeText( Action );
String cmd = ActionTreeNode.CommandFromNodeText( Action );
String action = ActionTreeNode.ActionFromNodeText( Action );
m_cmdCtrl = "";
if ( !String.IsNullOrWhiteSpace( cmd ) ) {

@ -108,6 +108,19 @@ namespace SCJMapper_V2
return DeviceCls.DeviceClass; // unknown
}
/// <summary>
/// Create a DevInput string if the input does look like not having a device ID
/// </summary>
/// <param name="input">A keyboard input</param>
/// <returns>DevInput</returns>
static public new String DevInput( String input )
{
if ( DevMatch( input ) )
return input; // already
else
return DeviceID + input; // this will mostly not be as expected as it returns js1_ only ..
}
/// <summary>
/// Returns true if the input matches this device
/// </summary>
@ -115,11 +128,10 @@ namespace SCJMapper_V2
/// <returns>True for a match</returns>
static public new Boolean DevMatch( String devInput )
{
return devInput.StartsWith( DeviceID );
return IsJsN( devInput );
}
/// <summary>
/// Returns the jsN part from a joystick command
/// i.e. js1_x returns js1

@ -65,6 +65,18 @@ namespace SCJMapper_V2
return DeviceCls.DeviceClass; // unknown
}
/// <summary>
/// Create a DevInput string if the input does look like not having a device ID
/// </summary>
/// <param name="input">A keyboard input</param>
/// <returns>DevInput</returns>
static public new String DevInput( String input )
{
if ( DevMatch( input ) )
return input; // already
else
return DeviceID + input;
}
/// <summary>
/// Returns true if the input matches this device

@ -67,6 +67,19 @@ namespace SCJMapper_V2
return DeviceCls.DeviceClass; // unknown
}
/// <summary>
/// Create a DevInput string if the input does look like not having a device ID
/// </summary>
/// <param name="input">A mouse input</param>
/// <returns>DevInput</returns>
static public new String DevInput( String input )
{
if ( DevMatch( input ) )
return input; // already
else
return DeviceID + input;
}
/// <summary>
/// Returns true if the input matches this device
/// </summary>

@ -36,7 +36,9 @@ namespace SCJMapper_V2
{
private static readonly log4net.ILog log = log4net.LogManager.GetLogger( System.Reflection.MethodBase.GetCurrentMethod( ).DeclaringType );
/// <summary>
/// Device Enums
/// </summary>
public enum ActionDevice
{
AD_Unknown = -1,
@ -48,9 +50,14 @@ namespace SCJMapper_V2
#region Static Items
static public ActionDevice ADevice( String device )
/// <summary>
/// Return the Device Enum from a DeviceClass string
/// </summary>
/// <param name="deviceClass">Device Class string</param>
/// <returns>Device Enum</returns>
static public ActionDevice ADevice( String deviceClass )
{
switch ( device.ToLower( ) ) {
switch ( deviceClass.ToLower( ) ) {
case KeyboardCls.DeviceClass: return ActionDevice.AD_Keyboard;
case JoystickCls.DeviceClass: return ActionDevice.AD_Joystick;
case GamepadCls.DeviceClass: return ActionDevice.AD_Gamepad;
@ -63,11 +70,11 @@ namespace SCJMapper_V2
// Static items to have this mapping in only one place
/// <summary>
/// Returns the Device ID i.e. the single letter to tag a device
/// Returns the Device Tag i.e. the single letter to mark a device in Actions
/// </summary>
/// <param name="device">The device name from the CryFile</param>
/// <returns>The single UCase device ID letter</returns>
static public String DevID( String device )
/// <param name="device">The device name from the defaultProfile</param>
/// <returns>The single UCase device Tag letter</returns>
static public String DevTag( String device )
{
switch ( device.ToLower( ) ) {
case KeyboardCls.DeviceClass: return "K";
@ -80,13 +87,13 @@ namespace SCJMapper_V2
}
/// <summary>
/// Returns the Device name from the ID
/// Returns the Device name from the Device Tag
/// </summary>
/// <param name="device">The single UCase device ID letter</param>
/// <returns>The device name from the CryFile</returns>
static public String DeviceFromID( String devID )
/// <param name="device">The single UCase device Tag letter</param>
/// <returns>The device name from the defaultProfile</returns>
static public String DeviceClassFromTag( String devTag )
{
switch ( devID ) {
switch ( devTag ) {
case "K": return KeyboardCls.DeviceClass;
case "J": return JoystickCls.DeviceClass;
case "X": return GamepadCls.DeviceClass;
@ -100,24 +107,33 @@ namespace SCJMapper_V2
/// <summary>
/// Try to derive the device class from the input string
/// </summary>
/// <param name="input">The input command string</param>
/// <param name="devInput">The input command string dev_input format</param>
/// <returns>A proper DeviceClass string</returns>
static public String DeviceClassFromInput( String input )
static public String DeviceClassFromInput( String devInput )
{
String deviceClass = DeviceCls.DeviceClass;
deviceClass = JoystickCls.DeviceClassFromInput( input );
deviceClass = JoystickCls.DeviceClassFromInput( devInput );
if ( !DeviceCls.IsUndefined( deviceClass ) ) return deviceClass;
deviceClass = GamepadCls.DeviceClassFromInput( input );
deviceClass = GamepadCls.DeviceClassFromInput( devInput );
if ( !DeviceCls.IsUndefined( deviceClass ) ) return deviceClass;
deviceClass = KeyboardCls.DeviceClassFromInput( input );
deviceClass = KeyboardCls.DeviceClassFromInput( devInput );
if ( !DeviceCls.IsUndefined( deviceClass ) ) return deviceClass;
deviceClass = MouseCls.DeviceClassFromInput( input );
deviceClass = MouseCls.DeviceClassFromInput( devInput );
if ( !DeviceCls.IsUndefined( deviceClass ) ) return deviceClass;
// others..
return deviceClass;
}
/// <summary>
/// Returns the ActionDevice from a deviceID or devInput string (mo1_, kb1_, xi1_, jsN_)
/// </summary>
/// <param name="devID">DeviceID or devInput string</param>
/// <returns>The ActionDevice</returns>
static public ActionDevice ADeviceFromDevID( string devID )
{
return ADevice( DeviceClassFromInput( devID ) );
}
/// <summary>
/// Query the devices if the input is blended
@ -143,10 +159,16 @@ namespace SCJMapper_V2
return blendedInput;
}
/// <summary>
/// Blend the input using the device specific format of the input is generic Blind
/// </summary>
/// <param name="input">An input (generic blend or a valid command)</param>
/// <param name="aDevice">A valid device</param>
/// <returns>A device blend or the original input if it was not a blend</returns>
static public String BlendInput( String input, ActionDevice aDevice )
{
if ( DeviceCls.IsBlendedInput( input ) ) {
// was generic blind
switch ( aDevice ) {
case ActionDevice.AD_Gamepad: return GamepadCls.BlendedInput;
case ActionDevice.AD_Joystick: return JoystickCls.BlendedInput;
@ -160,6 +182,46 @@ namespace SCJMapper_V2
}
}
/// <summary>
/// Extends the input to a device input if not already done
/// </summary>
/// <param name="input">An input</param>
/// <param name="aDevice">The ActionDevice</param>
/// <returns>A valid devInput (dev_input) format</returns>
static public String DevInput( string input, ActionDevice aDevice )
{
switch ( aDevice ) {
case ActionDevice.AD_Gamepad: return GamepadCls.DevInput( input );
case ActionDevice.AD_Joystick: return JoystickCls.DevInput( input );
case ActionDevice.AD_Keyboard: return KeyboardCls.DevInput( input );
case ActionDevice.AD_Mouse: return MouseCls.DevInput( input );
default: return input;
}
}
/// <summary>
/// Return the color of a device
/// </summary>
/// <param name="devInput">The devinput (determine JS colors)</param>
/// <param name="aDevice">The ActionDevice</param>
/// <returns>The device color</returns>
static public System.Drawing.Color DeviceColor( string devInput )
{
// background is along the input
ActionDevice aDevice = ADeviceFromDevID( devInput);
switch ( aDevice ) {
case ActionDevice.AD_Gamepad: return GamepadCls.XiColor( );
case ActionDevice.AD_Joystick: {
int jNum = JoystickCls.JSNum( devInput ); // need to know which JS
return JoystickCls.JsNColor( jNum );
}
case ActionDevice.AD_Keyboard: return KeyboardCls.KbdColor( );
case ActionDevice.AD_Mouse: return MouseCls.MouseColor( );
default: return MyColors.UnassignedColor;
}
}
#endregion
@ -223,7 +285,7 @@ namespace SCJMapper_V2
public ActionCommandCls AddCommand( String devInput, ActivationMode activationMode )
{
ActionCommandCls acc = new ActionCommandCls( devInput, inputList.Count - 1 ); // starts from -1 ...
acc.ActivationMode = activationMode;
acc.ActivationMode = new ActivationMode( activationMode );
inputList.Add( acc );
return acc;
}
@ -238,7 +300,7 @@ namespace SCJMapper_V2
public ActionCommandCls AddCommand( String devInput, int index )
{
ActionCommandCls acc = new ActionCommandCls( devInput, index );
acc.ActivationMode = ActivationMode.Default;
acc.ActivationMode = new ActivationMode( ActivationMode.Default );
inputList.Add( acc );
return acc;
}
@ -274,15 +336,14 @@ namespace SCJMapper_V2
/// </summary>
/// <param name="devInput">The input command</param>
/// <param name="actionCmd">The actionCommand to update</param>
public void UpdateCommandFromInput( String devInput, ActionCommandCls actionCmd )
public void UpdateCommandFromInput( String devInput, int accIndex ) // ActionCommandCls actionCmd )
{
//log.Debug( "UpdateCommandFromInput - Entry" );
if ( actionCmd == null ) return;
if ( accIndex < 0 ) return;
// Apply the input to the ActionTree
actionCmd.DevInput = BlendInput( devInput, this.actionDevice );
if ( IsBlendedInput( actionCmd.DevInput ) ) {
actionCmd.ActivationMode = ActivationMode.Default; // reset activation mode if the input is empty
this.inputList[accIndex].DevInput = BlendInput( devInput, this.actionDevice );
if ( IsBlendedInput( this.inputList[accIndex].DevInput ) || string.IsNullOrEmpty(devInput) ) {
this.inputList[accIndex].ActivationMode = new ActivationMode( ActivationMode.Default ); // reset activation mode if the input is empty
}
}
@ -408,7 +469,7 @@ namespace SCJMapper_V2
}
}
key = DevID( device ) + name; // unique id of the action
key = DevTag( device ) + name; // unique id of the action
actionDevice = ADevice( device ); // get the enum of the input device
AddCommand( input, actMode );

@ -29,8 +29,12 @@ namespace SCJMapper_V2
/// </summary>
public ActivationMode ActivationMode { get; set; } // "" or one of the defined ActivationModes
/// <summary>
/// Returns true if default ActivationMode is set
/// </summary>
public Boolean DefaultActivationMode { get { return ActivationMode == ActivationMode.Default; } }
/// <summary>
/// The complete input string (devID_input)
/// Assuming internally blended ones only (i.e. no space blends contained)
/// Can derive if a device tag is given
@ -76,7 +80,7 @@ namespace SCJMapper_V2
// init with something to debug if needed
Input = "UNDEF";
DevID = "NA0";
ActivationMode = ActivationMode.Default;
ActivationMode = new ActivationMode( ActivationMode.Default );
NodeIndex = -1;
}
@ -85,7 +89,7 @@ namespace SCJMapper_V2
{
Input = other.Input;
DevID = other.DevID;
ActivationMode = other.ActivationMode;
ActivationMode = new ActivationMode( other.ActivationMode );
NodeIndex = other.NodeIndex;
}
@ -93,7 +97,7 @@ namespace SCJMapper_V2
public ActionCommandCls( String devInp )
{
DevInput = devInp;
ActivationMode = ActivationMode.Default;
ActivationMode = new ActivationMode( ActivationMode.Default );
NodeIndex = -1;
}
@ -101,7 +105,7 @@ namespace SCJMapper_V2
public ActionCommandCls( String devInp, int nodeIx )
{
DevInput = devInp;
ActivationMode = ActivationMode.Default;
ActivationMode = new ActivationMode( ActivationMode.Default );
NodeIndex = nodeIx;
}
@ -110,7 +114,7 @@ namespace SCJMapper_V2
{
Input = inp;
DevID = dev;
ActivationMode = ActivationMode.Default;
ActivationMode = new ActivationMode( ActivationMode.Default );
NodeIndex = -1;
}
@ -119,7 +123,7 @@ namespace SCJMapper_V2
{
Input = inp;
DevID = dev;
ActivationMode = ActivationMode.Default;
ActivationMode = new ActivationMode( ActivationMode.Default );
NodeIndex = nodeIx;
}

@ -294,7 +294,7 @@ namespace SCJMapper_V2
// could return more than one if the action is the same in different actionmaps
foreach ( ActionTreeNode mtn in masterNode ) {
if ( mtn.Parent.Name == node.Parent.Name ) {
mtn.Command = node.Command; mtn.BackColor = node.BackColor;
mtn.Update( node ); // update from node
}
}
}
@ -307,7 +307,7 @@ namespace SCJMapper_V2
// could return more than one if the action is the same in different actionmaps
foreach ( ActionTreeInputNode mtn in masterNode ) {
if ( mtn.Parent.Name == node.Parent.Name ) {
mtn.Command = node.Command; mtn.BackColor = node.BackColor;
mtn.Update( node ); // update from node
}
}
}
@ -465,7 +465,7 @@ namespace SCJMapper_V2
ActivationMode defActivationMode = new ActivationMode( defActivationModeName, defMultiTap );
String devID = elem[ei].Substring( 0, 1 );
String device = ActionCls.DeviceFromID( devID );
String device = ActionCls.DeviceClassFromTag( devID );
// visual item for the action
cn = new ActionTreeNode( "UNDEF" ); cn.Name = elem[ei]; cn.Action = action; cn.BackColor = Color.White; // name with the key it to find it..
@ -521,7 +521,7 @@ namespace SCJMapper_V2
}
}//for
tn = new ActionTreeNode( acm.name, cnl ); tn.Name = acm.name; // name it to find it..
tn = new ActionTreeNode( acm.name, cnl ); tn.Name = acm.name; tn.Action = acm.name; // name it to find it..
tn.ImageIndex = 0; tn.NodeFont = new Font( m_MasterTree.Font, FontStyle.Bold );
m_MasterTree.BackColor = Color.White; // fix for defect TreeView (cut off bold text)
m_MasterTree.Nodes.Add( tn ); // add to control
@ -565,7 +565,7 @@ namespace SCJMapper_V2
if ( Ctrl.SelectedNode.Level == 1 ) {
// this is the main node with Action Cmd
ActionCls ac = FindActionObject( Ctrl.SelectedNode.Parent.Name, Ctrl.SelectedNode.Name ); if ( ac == null ) return am; // ERROR exit
ActionCommandCls acc = ac.FindActionInputObject( CommandFromNodeText( Ctrl.SelectedNode.Text ) ); if ( acc == null ) return am; // ERROR exit
ActionCommandCls acc = ac.FindActionInputObject( ActionTreeNode.CommandFromNodeText( Ctrl.SelectedNode.Text ) ); if ( acc == null ) return am; // ERROR exit
am = new ActivationModes( ac.defActivationMode ); am.Add( acc.ActivationMode );
return am;
}
@ -596,15 +596,15 @@ namespace SCJMapper_V2
if ( Ctrl.SelectedNode.Level == 1 ) {
// this is the main node with Action Cmd
ActionCls ac = FindActionObject( Ctrl.SelectedNode.Parent.Name, Ctrl.SelectedNode.Name ); if ( ac == null ) return; // ERROR exit
ActionCommandCls acc = ac.FindActionInputObject( CommandFromNodeText( Ctrl.SelectedNode.Text ) ); if ( acc == null ) return; // ERROR exit
ActionCommandCls acc = ac.FindActionInputObject( ActionTreeNode.CommandFromNodeText( Ctrl.SelectedNode.Text ) ); if ( acc == null ) return; // ERROR exit
// new am is either a named one or the Default from Profile (which is the default from the Action due to multiTaps..)
if ( ActivationMode.IsDefault( newActivationModeName ) ) {
acc.ActivationMode = ActivationMode.Default;
acc.ActivationMode = new ActivationMode( ActivationMode.Default );
}
else {
acc.ActivationMode = ActivationModes.Instance.ActivationModeByName( newActivationModeName );
}
UpdateNodeFromAction( ( ActionTreeNode )Ctrl.SelectedNode, acc );
Dirty = true;
}
else if ( Ctrl.SelectedNode.Level == 2 ) {
@ -615,11 +615,12 @@ namespace SCJMapper_V2
ActionCommandCls acc = ac.FindActionInputObject( m_ctrl.SelectedNode.Index ); if ( acc == null ) return; // ERROR exit
// new am is either a named one or the Default from Profile (which is the default from the Action due to multiTaps..)
if ( ActivationMode.IsDefault( newActivationModeName ) ) {
acc.ActivationMode = ActivationMode.Default;
acc.ActivationMode = new ActivationMode( ActivationMode.Default );
}
else {
acc.ActivationMode = ActivationModes.Instance.ActivationModeByName( newActivationModeName );
}
UpdateInputNodeFromAction( ( ActionTreeInputNode )Ctrl.SelectedNode, acc );
Dirty = true;
}
}
@ -643,10 +644,10 @@ namespace SCJMapper_V2
ActionCls ac = FindActionObject( Ctrl.SelectedNode.Parent.Name, Ctrl.SelectedNode.Name );
if ( ac == null ) return false; // ERROR exit
if ( checkKind && ( ac.actionDevice != inKind ) ) return false; // ERROR exit
ActionCommandCls acc = ac.FindActionInputObject( CommandFromNodeText( Ctrl.SelectedNode.Text ) );
ActionCommandCls acc = ac.FindActionInputObject( ActionTreeNode.CommandFromNodeText( Ctrl.SelectedNode.Text ) );
if ( acc == null ) return false; // ERROR exit
ac.UpdateCommandFromInput( input, acc );
// have it - continue
ac.UpdateCommandFromInput( ActionCls.DevInput( input, inKind ), acc.NodeIndex + 1 );
UpdateNodeFromAction( ( ActionTreeNode )Ctrl.SelectedNode, acc );
Dirty = true;
}
@ -656,11 +657,11 @@ namespace SCJMapper_V2
ActionCls ac = FindActionObject( atn.Parent.Name, atn.Name ); // the related action
if ( ac == null ) return false; // ERROR exit
if ( checkKind && ( ac.actionDevice != inKind ) ) return false; // ERROR exit
ActionCommandCls acc = ac.FindActionInputObject( m_ctrl.SelectedNode.Index );
if ( acc == null ) return false; // ERROR exit
ac.UpdateCommandFromInput( input, acc );
UpdateInputNodeFromAction( ( ActionTreeInputNode )Ctrl.SelectedNode, acc, inKind );
// have it - continue
ac.UpdateCommandFromInput( ActionCls.DevInput( input, inKind ), acc.NodeIndex + 1 );
UpdateInputNodeFromAction( ( ActionTreeInputNode )Ctrl.SelectedNode, acc );
Dirty = true;
}
return true;
@ -761,26 +762,11 @@ namespace SCJMapper_V2
else {
// mapped ( regular ones )
node.Command = actionCmd.DevInput;
// background is along the input
if ( node.ActionDevice == ActionCls.ActionDevice.AD_Joystick ) {
int jNum = JoystickCls.JSNum( actionCmd.DevID );
node.BackColor = JoystickCls.JsNColor( jNum );
}
else if ( node.ActionDevice == ActionCls.ActionDevice.AD_Gamepad ) {
node.BackColor = GamepadCls.XiColor( );
}
else if ( node.ActionDevice == ActionCls.ActionDevice.AD_Keyboard ) {
node.BackColor = KeyboardCls.KbdColor( );
}
else if ( node.ActionDevice == ActionCls.ActionDevice.AD_Mouse ) { // 20151220BM: add mouse device (from AC 2.0 defaultProfile usage)
node.BackColor = MouseCls.MouseColor( );
}
else {
// ?? what else
node.BackColor = MyColors.UnassignedColor;
}
node.BackColor = ActionCls.DeviceColor( actionCmd.DevInput );
}
node.Modified = !actionCmd.DefaultActivationMode; // apply modifier visual
UpdateMasterNode( node );
}
@ -794,8 +780,7 @@ namespace SCJMapper_V2
/// <param name="input">The input command</param>
/// <param name="node">The TreeNode to update</param>
/// <param name="actionCmd">The actionCommand that carries the update</param>
/// <param name="inKind">The input device</param>
private void UpdateInputNodeFromAction( ActionTreeInputNode node, ActionCommandCls actionCmd, ActionCls.ActionDevice inKind )
private void UpdateInputNodeFromAction( ActionTreeInputNode node, ActionCommandCls actionCmd )
{
log.Debug( "UpdateInputNodeFromAction - Entry" );
if ( actionCmd == null ) return;
@ -814,30 +799,15 @@ namespace SCJMapper_V2
else {
// mapped ( regular ones )
node.Command = actionCmd.DevInput;
// background is along the input
if ( inKind == ActionCls.ActionDevice.AD_Joystick ) {
int jNum = JoystickCls.JSNum( actionCmd.DevID );
node.BackColor = JoystickCls.JsNColor( jNum );
}
else if ( inKind == ActionCls.ActionDevice.AD_Gamepad ) {
node.BackColor = GamepadCls.XiColor( );
}
else if ( inKind == ActionCls.ActionDevice.AD_Keyboard ) {
node.BackColor = KeyboardCls.KbdColor( );
}
else if ( inKind == ActionCls.ActionDevice.AD_Mouse ) { // 20151220BM: add mouse device (from AC 2.0 defaultProfile usage)
node.BackColor = MouseCls.MouseColor( );
}
else {
// ?? what else
node.BackColor = MyColors.UnassignedColor;
}
node.BackColor = ActionCls.DeviceColor(actionCmd.DevInput );
}
UpdateMasterNode( node );
node.Modified = !actionCmd.DefaultActivationMode; // apply modifier visual
UpdateMasterNode( node );
}
/// <summary>
/// Defines what to show in the tree
/// </summary>
@ -874,7 +844,7 @@ namespace SCJMapper_V2
// refresh commands
foreach ( ActionCommandCls acc in ac.inputList ) {
try {
ac.UpdateCommandFromInput( acc.DevInput, acc ); // this may apply (un)Blending if needed
ac.UpdateCommandFromInput( acc.DevInput, acc.NodeIndex + 1 ); // this may apply (un)Blending if needed
// the first one goes into the node, further must be created if not existing
if ( first ) {
UpdateNodeFromAction( matn, acc );
@ -886,7 +856,7 @@ namespace SCJMapper_V2
ActionTreeInputNode matin = new ActionTreeInputNode( "UNDEF" ); matin.ImageKey = "Add";
acc.NodeIndex = matin.Index; // assign visual reference
matn.Nodes.Add( matin ); // add to master tree
UpdateInputNodeFromAction( matin, acc, ac.actionDevice );
UpdateInputNodeFromAction( matin, acc );
}
}
catch {
@ -998,14 +968,6 @@ namespace SCJMapper_V2
}
static public String CommandFromNodeText( String actionCommand )
{
String[] e = actionCommand.Split( new char[] { '-' } );
if ( e.Length > 1 ) return e[1].Substring( 1 );
return "";
}
/// <summary>
/// Find a control that contains the Command
/// </summary>
@ -1108,7 +1070,7 @@ namespace SCJMapper_V2
const int padInput = 25;
repList += String.Format( "\n" );
repList += String.Format( " {0}+= {1} _ {2}+=[{4}] {3}\n\n", "Action".PadRight( padAction ), "Dev", "Binding".PadRight( padInput ), "Activation", "T" ); // col description line
repList += String.Format( " {0}+- {1} _ {2}#-[{4}] {3}\n\n", "Action".PadRight( padAction ), "Dev", "Binding".PadRight( padInput ), "Activation", "T" ); // col description line
foreach ( ActionMapCls acm in ActionMaps ) {
String rep = String.Format( "*** {0}\n", acm.name );
@ -1118,16 +1080,16 @@ namespace SCJMapper_V2
if ( ShowAction( ac.actionDevice, acc.Input ) ) {
if ( !String.IsNullOrEmpty( acc.Input ) /* && !( acc.Input == DeviceCls.BlendedInput )*/ ) {
if ( acc.DevInput == ac.defBinding ) {
rep = String.Format( " {0} = {1} _ {2}", ac.name.PadRight( padAction ), acc.DevID, acc.Input.PadRight( padInput ) );
rep = String.Format( " {0} . {1} _ {2}", ac.name.PadRight( padAction ), acc.DevID, acc.Input.PadRight( padInput ) );
}
else {
rep = String.Format( " {0} + {1} _ {2}", ac.name.PadRight( padAction ), acc.DevID, acc.Input.PadRight( padInput ) ); // my binding
}
if ( acc.ActivationMode == ActivationMode.Default ) {
rep += String.Format( " = [{1}] {0}\n", ac.defActivationMode.Name, ac.defActivationMode.MultiTap );
rep += String.Format( " . [{1}] {0}\n", ac.defActivationMode.Name, ac.defActivationMode.MultiTap );
}
else {
rep += String.Format( " + [{1}] {0}\n", acc.ActivationMode.Name, acc.ActivationMode.MultiTap );
rep += String.Format( " # [{1}] {0}\n", acc.ActivationMode.Name, acc.ActivationMode.MultiTap );
}
repList += rep;

@ -19,20 +19,27 @@ namespace SCJMapper_V2
// Handle all text label composition and extraction here
public static String ComposeNodeText( String cmd )
public static String ComposeNodeText( String cmd, Boolean modified = false )
{
if ( String.IsNullOrEmpty( cmd ) ) {
return "";
}
else {
return cmd;
if ( modified )
return string.Format( "{0} {1}", cmd, ActionTreeNode.ModDiv ); // js1_button1 #
else
return string.Format( "{0}", cmd ); // js1_button1
}
}
public static void DecompNodeText( String nodeText, out String cmd )
{
cmd = nodeText;
String[] e = nodeText.Split( new char[] { RegDiv, ModDiv }, StringSplitOptions.RemoveEmptyEntries );
if ( e.Length > 0 )
cmd = e[0].TrimEnd( );
else
cmd = nodeText;
}
@ -99,7 +106,7 @@ namespace SCJMapper_V2
set
{
ActionTreeInputNode.DecompNodeText( value, out m_command );
base.Text = ActionTreeInputNode.ComposeNodeText( "$" + m_command ); // tag for the node processing
base.Text = ActionTreeInputNode.ComposeNodeText( "$" + m_command, m_modified ); // tag for the node processing
}
}
@ -110,19 +117,9 @@ namespace SCJMapper_V2
set
{
m_command = value;
Text = ActionTreeInputNode.ComposeNodeText( m_command ); // compose - later it will be decomposed again
Text = ActionTreeInputNode.ComposeNodeText( m_command, m_modified ); // compose - later it will be decomposed again
}
}
/*
public Boolean IsMappedAction
{
get
{
return !( String.IsNullOrEmpty( m_command )
|| ( m_command == JoystickCls.BlendedInput )
|| ( m_command == GamepadCls.BlendedInput ) );
}
}
*/
}
}

@ -14,18 +14,24 @@ namespace SCJMapper_V2
#region Static items
public const char RegDiv = '-';
public const char ModDiv = '#';
// Handle all text label composition and extraction here
public static String ComposeNodeText( String action, String cmd )
public static String ComposeNodeText( String action, String cmd, Boolean modified = false )
{
if ( String.IsNullOrEmpty( cmd ) ) {
return action;
return action; // v_eject
}
else if ( String.IsNullOrEmpty( action ) ) {
return cmd;
return cmd; // js1_button1
}
else {
return action + " - " + cmd;
if ( modified )
return string.Format( "{0} {2} {1} {3}", action, cmd, RegDiv, ModDiv ); // v_eject - js1_button1 #
else
return string.Format( "{0} {2} {1}", action, cmd, RegDiv ); // v_eject - js1_button1
}
}
@ -33,10 +39,10 @@ namespace SCJMapper_V2
public static void DecompNodeText( String nodeText, out String action, out String cmd )
{
action = ""; cmd = "";
String[] e = nodeText.Split( new char[] { '-' }, StringSplitOptions.RemoveEmptyEntries );
String[] e = nodeText.Split( new char[] { RegDiv, ModDiv }, StringSplitOptions.RemoveEmptyEntries );
if ( e.Length > 1 ) {
action = e[0].TrimEnd( );
if ( e[1] == " " + DeviceCls.BlendedInput ) {
if ( e[1].Trim() == DeviceCls.BlendedInput ) {
cmd = e[1];
}
else {
@ -99,15 +105,18 @@ namespace SCJMapper_V2
: base( )
{
if ( srcNode == null ) return;
// properties set once for a node
this.Name = srcNode.Name;
this.Text = srcNode.Text;
this.BackColor = srcNode.BackColor;
this.ForeColor = srcNode.ForeColor;
this.NodeFont = srcNode.NodeFont;
this.ImageKey = srcNode.ImageKey;
this.Tag = srcNode.Tag;
this.m_action = srcNode.m_action;
this.m_actionDevice = srcNode.m_actionDevice;
// these are changing while using it
this.Update( srcNode );
}
// ctor
@ -122,18 +131,34 @@ namespace SCJMapper_V2
{
}
// our own properties
private String m_action = "";
protected String m_command ="";
protected bool m_modified = false; // any modifier applied? (ActivationMode)
private ActionCls.ActionDevice m_actionDevice = ActionCls.ActionDevice.AD_Unknown;
/// <summary>
/// Update this node from the other node
/// applies dynamic props only
/// </summary>
/// <param name="other">The node to update from</param>
public void Update( ActionTreeNode other )
{
this.BackColor = other.BackColor;
this.Command = other.Command;
this.Modified = other.Modified;
}
public new String Text
{
get { return base.Text; }
set
{
ActionTreeNode.DecompNodeText( value, out m_action, out m_command );
base.Text = ActionTreeNode.ComposeNodeText( m_action, m_command );
base.Text = ActionTreeNode.ComposeNodeText( m_action, m_command, m_modified );
}
}
@ -144,7 +169,7 @@ namespace SCJMapper_V2
set
{
m_action = value;
base.Text = ActionTreeNode.ComposeNodeText( m_action, m_command );
base.Text = ActionTreeNode.ComposeNodeText( m_action, m_command, m_modified );
}
}
@ -154,7 +179,7 @@ namespace SCJMapper_V2
set
{
m_command = value;
base.Text = ActionTreeNode.ComposeNodeText( m_action, m_command );
base.Text = ActionTreeNode.ComposeNodeText( m_action, m_command, m_modified );
}
}
@ -167,6 +192,17 @@ namespace SCJMapper_V2
}
}
public Boolean Modified
{
get { return m_modified; }
set
{
m_modified = value;
base.Text = ActionTreeNode.ComposeNodeText( m_action, m_command, m_modified );
}
}
public Boolean IsJoystickAction
{
get { return ( m_actionDevice == ActionCls.ActionDevice.AD_Joystick ); }

@ -31,13 +31,15 @@ cassini@burri-web.org
Changelog:
V 2.18 - BETA Build 51
- fix - layout works now for Win10
- fix - uses game defaultProfile
- improvement - timeout for kbd modifiers (Esc no longer needed)
- improvement - ActivationMode handling
- improvement - Blending adds multiTap=1
- improvement - List commands; added Act.Modes
- fix - uses game defaultProfile again
- fix - keyboard command for all Ctrl keys fixed
- fix - keyboard command formatting
- improvement - timeout ~4 sec for kbd modifiers in Joystick Mode (Esc no longer needed)
- improvement - ActivationMode handling finished
- improvement - user ActivationMode change indication in mapping tree
- improvement - Blending adds multiTap=1 to overwrite double taps
- improvement - Dump List: added ActivationModes; device checkBox applied to list
- update - doc SCJMapper_QGuide V2.18beta.pdf
- Known Issue: Some Ctrl-keyboard commands are not shown (Ctrl Sequences)
V 2.17 - BETA Build 50
- update - Updated for SC Alpha 2.0/2.1PTU using new actionmap syntax (no longer use device attribute)
- update - Complete new QuickReference Guide

Binary file not shown.
Loading…
Cancel
Save