mirror of
https://github.com/SCToolsfactory/SCJMapper-V2.git
synced 2024-11-04 18:00:26 +00:00
V 2.30 - BETA Build 64 - second commit
- add - addbind of Mouse input is possible for Keyboard actions - seems to work somehow in the game... - fixes and refacturing while encountered...
This commit is contained in:
parent
b3f9dbbacc
commit
b5580a7182
22
FormMain.cs
22
FormMain.cs
@ -130,6 +130,13 @@ private void AutoTabXML_Assignment( EATabXML tab )
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateDDMapping(string mapName )
|
||||
{
|
||||
tsDDbtMappings.Text = mapName;
|
||||
m_AppSettings.DefMappingName = mapName; m_AppSettings.Save( );
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Main Form Handling
|
||||
@ -229,8 +236,7 @@ private void MainForm_Load( object sender, System.EventArgs e )
|
||||
SetRebindField( txMappingName.Text );
|
||||
foreach ( ToolStripDropDownItem d in tsDDbtMappings.DropDownItems ) {
|
||||
if ( d.Text == txMappingName.Text ) {
|
||||
tsDDbtMappings.Text = txMappingName.Text;
|
||||
m_AppSettings.DefMappingName = txMappingName.Text; m_AppSettings.Save( ); // update if it exists
|
||||
UpdateDDMapping( txMappingName.Text );
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -391,8 +397,14 @@ private void InitActionTree( bool addDefaultBinding )
|
||||
log.Debug( "InitActionTree - Entry" );
|
||||
|
||||
// build TreeView and the ActionMaps
|
||||
if ( m_AT != null ) m_AT.NodeSelectedEvent -= M_AT_NodeSelectedEvent; // disconnect the Event
|
||||
if ( m_AT != null ) {
|
||||
m_AT.NodeSelectedEvent -= M_AT_NodeSelectedEvent; // disconnect the Event
|
||||
m_AT.Dispose( );
|
||||
}
|
||||
|
||||
m_AT = new ActionTree( );
|
||||
log.DebugFormat( "InitActionTree - New AT: {0}", m_AT.GetHashCode().ToString() );
|
||||
|
||||
m_AT.NodeSelectedEvent += M_AT_NodeSelectedEvent; // connect the Event
|
||||
|
||||
m_AT.Ctrl = treeView1; // the ActionTree owns the TreeView control
|
||||
@ -879,8 +891,7 @@ private void resetDefaultsToolStripMenuItem_Click( object sender, EventArgs e )
|
||||
|
||||
private void tsDDbtMappings_DropDownItemClicked( object sender, ToolStripItemClickedEventArgs e )
|
||||
{
|
||||
tsDDbtMappings.Text = e.ClickedItem.Text;
|
||||
m_AppSettings.DefMappingName = e.ClickedItem.Text; m_AppSettings.Save( );
|
||||
UpdateDDMapping( e.ClickedItem.Text );
|
||||
}
|
||||
|
||||
|
||||
@ -1162,6 +1173,7 @@ private void btSaveMyMapping_Click( object sender, EventArgs e )
|
||||
|
||||
// get the new one into the list
|
||||
LoadMappingDD( );
|
||||
UpdateDDMapping( txMappingName.Text );
|
||||
m_AppSettings.MyMappingName = txMappingName.Text; m_AppSettings.Save( );// last used - persist
|
||||
txMappingName.BackColor = MyColors.SuccessColor;
|
||||
}
|
||||
|
@ -340,13 +340,17 @@ public bool fromXML( string xml )
|
||||
this[toID].fromXML( xml );
|
||||
}
|
||||
else {
|
||||
log.InfoFormat( "Read XML Options - instance {0} is not available - dropped this content", nInstance );
|
||||
log.InfoFormat( "Read XML Options - joystick instance {0} is not available - dropped this content", nInstance );
|
||||
}
|
||||
}
|
||||
else if ( type.ToLowerInvariant( ) == "xboxpad" ) {
|
||||
string toID = TuneOptionID( GamepadCls.DeviceClass, nInstance );
|
||||
if ( this.ContainsKey( toID ) ) // 20170513: bugfix if gamepad is in the XML but not connected right now - ignore
|
||||
if ( this.ContainsKey( toID ) ) {// 20170513: bugfix if gamepad is in the XML but not connected right now - ignore
|
||||
this[toID].fromXML( xml );
|
||||
}
|
||||
else {
|
||||
log.InfoFormat( "Read XML Options - xboxpad instance {0} is not available - dropped this content", nInstance );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -100,6 +100,7 @@ private void M_ctrl_AfterSelect( object sender, TreeViewEventArgs e )
|
||||
/// </summary>
|
||||
public ActionTree()
|
||||
{
|
||||
log.DebugFormat( "ctor - Entry {0}", m_MasterTree.GetHashCode( ).ToString( ) );
|
||||
IgnoreMaps = ""; // nothing to ignore
|
||||
}
|
||||
|
||||
@ -110,6 +111,7 @@ protected virtual void Dispose( bool disposing )
|
||||
if ( m_MasterTree != null ) m_MasterTree.Dispose( );
|
||||
}
|
||||
// free native resources
|
||||
m_tvCtrlRef.AfterSelect -= M_ctrl_AfterSelect;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
@ -152,11 +154,14 @@ public bool CanBlendBinding
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if a binding can be cleared
|
||||
/// </summary>
|
||||
public bool CanClearBinding
|
||||
{
|
||||
get {
|
||||
if ( Ctrl.SelectedNode == null ) return false;
|
||||
else return ( Ctrl.SelectedNode.Level == 1 ) && IsMappedAction;
|
||||
else return ( ( Ctrl.SelectedNode.Level == 1 ) && (IsMappedAction || IsDisabledAction)) ;
|
||||
}
|
||||
}
|
||||
|
||||
@ -177,6 +182,9 @@ public bool CanDelBinding
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the action is mapped
|
||||
/// </summary>
|
||||
public bool IsMappedAction
|
||||
{
|
||||
get {
|
||||
@ -188,6 +196,20 @@ public bool IsMappedAction
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the action is disabled
|
||||
/// </summary>
|
||||
public bool IsDisabledAction
|
||||
{
|
||||
get {
|
||||
if ( ( Ctrl.SelectedNode.Level == 0 ) || ( Ctrl.SelectedNode.Level > 2 ) ) return false; // not on node
|
||||
if ( Ctrl.SelectedNode == null ) return false; // no node selected
|
||||
if ( Ctrl.SelectedNode.Parent == null ) return false; // ERROR EXIT
|
||||
|
||||
return ( Ctrl.SelectedNode as ActionTreeNode ).IsDisabledAction;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public bool ShowAction( ActionCls.ActionDevice actDev, string input )
|
||||
{
|
||||
@ -291,6 +313,7 @@ private void UpdateMasterNode( ActionTreeNode node )
|
||||
|
||||
private void UpdateMasterNode( ActionTreeInputNode node )
|
||||
{
|
||||
log.DebugFormat( "UpdateMasterNode - Entry {0}", m_MasterTree.GetHashCode( ).ToString( ) );
|
||||
// copy to master node
|
||||
TreeNode[] masterNode = m_MasterTree.Nodes.Find( node.Name, true ); // find the same node in master
|
||||
if ( masterNode.Length == 0 ) throw new IndexOutOfRangeException( "ActionTree ERROR - cannot find synched node in master" ); // OUT OF SYNC
|
||||
@ -310,6 +333,7 @@ private void UpdateMasterNode( ActionTreeInputNode node )
|
||||
/// <returns>The sought node or null</returns>
|
||||
private ActionTreeNode FindMasterAction( ActionTreeNode atn )
|
||||
{
|
||||
log.DebugFormat( "FindMasterAction(ActionTreeNode) - Entry {0}", m_MasterTree.GetHashCode( ).ToString( ) );
|
||||
if ( atn.Level != 1 ) return null; // sanity
|
||||
|
||||
TreeNode[] masterNode = m_MasterTree.Nodes.Find( atn.Name, true ); // find the same node in master
|
||||
@ -323,6 +347,27 @@ private ActionTreeNode FindMasterAction( ActionTreeNode atn )
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Find the master element for the given ActionTreeInputNode
|
||||
/// </summary>
|
||||
/// <param name="atn">The ActionTreeInputNode to find</param>
|
||||
/// <returns>The sought node or null</returns>
|
||||
private ActionTreeInputNode FindMasterAction( ActionTreeInputNode atn )
|
||||
{
|
||||
log.DebugFormat( "FindMasterAction(ActionTreeInputNode) - Entry {0}", m_MasterTree.GetHashCode().ToString() );
|
||||
if ( atn.Level != 2 ) return null; // sanity
|
||||
|
||||
TreeNode[] masterNode = m_MasterTree.Nodes.Find( atn.Name, true ); // find the same node in master
|
||||
if ( masterNode.Length == 0 ) throw new IndexOutOfRangeException( "ActionTree ERROR - cannot find synched node in master" ); // OUT OF SYNC
|
||||
// could return more than one if the action is the same in different actionmaps
|
||||
foreach ( ActionTreeInputNode mtn in masterNode ) {
|
||||
if ( mtn.Parent.Name == atn.Parent.Name ) {
|
||||
return mtn;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
@ -666,10 +711,17 @@ public bool UpdateSelectedItem( string input, ActionCls.ActionDevice inKind, boo
|
||||
if ( string.IsNullOrEmpty( input ) )
|
||||
atn.Action = "UNDEF"; // apply UNDEF
|
||||
else
|
||||
atn.Action = ""; // remove UNDEF
|
||||
atn.Action = patn.Action; // apply the parent Action
|
||||
ActionCls ac = FindActionObject( patn.Parent.Name, patn.Name ); // the related action in an actionmap
|
||||
if ( ac == null ) return false; // ERROR exit
|
||||
if ( checkKind && ( ac.actionDevice != inKind ) ) return false; // ERROR exit
|
||||
if ( checkKind ) {
|
||||
if (ac.actionDevice == ActionCls.ActionDevice.AD_Keyboard ) {
|
||||
if (( inKind != ActionCls.ActionDevice.AD_Keyboard ) && (inKind != ActionCls.ActionDevice.AD_Mouse)) return false; // ERROR exit
|
||||
}
|
||||
else {
|
||||
if ( ac.actionDevice != inKind ) return false; // ERROR exit
|
||||
}
|
||||
}
|
||||
ActionCommandCls acc = ac.FindActionInputObject( atn.Index );
|
||||
if ( acc == null ) return false; // ERROR exit
|
||||
// have it - continue
|
||||
@ -772,7 +824,7 @@ public void DefineShowOptions( bool showJoystick, bool showGamepad, bool showKey
|
||||
/// </summary>
|
||||
public void ReloadTreeView()
|
||||
{
|
||||
log.Debug( "ReloadTreeView - Entry" );
|
||||
log.DebugFormat( "ReloadTreeView - Entry {0}", m_MasterTree.GetHashCode().ToString() );
|
||||
|
||||
foreach ( ActionMapCls acm in ActionMaps ) {
|
||||
if ( IgnoreMaps.Contains( "," + acm.name + "," ) ) break; // next
|
||||
@ -794,7 +846,9 @@ public void ReloadTreeView()
|
||||
}
|
||||
else {
|
||||
// have to recreate the action child nodes
|
||||
ActionTreeInputNode matin = new ActionTreeInputNode( "UNDEF" ); matin.ImageKey = "Add";
|
||||
//ActionTreeInputNode matin = new ActionTreeInputNode( "UNDEF" ); matin.ImageKey = "Add";
|
||||
ActionTreeInputNode matin = new ActionTreeInputNode( ac.name ); matin.ImageKey = "Add";
|
||||
matin.Name = matn.Name + "_" + matin.Index; // unique name needed
|
||||
acc.NodeIndex = matin.Index; // assign visual reference
|
||||
matn.Nodes.Add( matin ); // add to master tree
|
||||
matin.UpdateAction( acc ); UpdateMasterNode( matin );
|
||||
@ -802,12 +856,11 @@ public void ReloadTreeView()
|
||||
} catch {
|
||||
; // key not found
|
||||
}
|
||||
NodeSelected( this.SelectedAction, this.SelectedCtrl );
|
||||
Dirty = true;
|
||||
} // foreach
|
||||
}
|
||||
} catch {
|
||||
; // map key not found ??
|
||||
} catch (Exception e) {
|
||||
log.DebugFormat( "ReloadTreeView - Exception in loading Treevie\n{0}", e.Message ); // map key not found ??
|
||||
}
|
||||
}
|
||||
|
||||
@ -1061,7 +1114,7 @@ public string SelectedCtrl
|
||||
return ActionTreeNode.CommandFromNodeText( matn.Text );
|
||||
}
|
||||
else if ( Ctrl.SelectedNode.Level == 2 ) {
|
||||
ActionTreeNode matn = FindMasterAction( (ActionTreeNode)Ctrl.SelectedNode.Parent ); // the parent treenode
|
||||
ActionTreeNode matn = FindMasterAction( (ActionTreeInputNode)Ctrl.SelectedNode ); // the parent treenode
|
||||
return ActionTreeNode.CommandFromNodeText( matn.Text );
|
||||
}
|
||||
else return "";
|
||||
|
@ -173,7 +173,7 @@ public void UpdateAction( ActionCommandCls actionCmd )
|
||||
else {
|
||||
// mapped ( regular ones )
|
||||
this.Command = actionCmd.DevInput;
|
||||
if ( this.Level == 2 ) this.Action = ""; // remove UNDEF - 20160525 fix addbind not showing UNDEF if assigned
|
||||
//if ( this.Level == 2 ) this.Action = ""; // remove UNDEF - 20160525 fix addbind not showing UNDEF if assigned
|
||||
// background is along the input
|
||||
this.BackColor = ActionCls.DeviceColor( actionCmd.DevInput );
|
||||
}
|
||||
@ -253,6 +253,9 @@ public Boolean IsKeyboardAction
|
||||
get { return ( m_actionDevice == ActionCls.ActionDevice.AD_Mouse ); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the action is mapped
|
||||
/// </summary>
|
||||
public Boolean IsMappedAction
|
||||
{
|
||||
get {
|
||||
@ -260,6 +263,16 @@ public Boolean IsMappedAction
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the action is disabled
|
||||
/// </summary>
|
||||
public Boolean IsDisabledAction
|
||||
{
|
||||
get {
|
||||
return ActionCls.IsBlendedInput( m_command );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
SC Joystick Mapper V 2.30 - Build 64 BETA
|
||||
(c) Cassini, StandardToaster - 13-May-2017
|
||||
(c) Cassini, StandardToaster - 14-May-2017
|
||||
|
||||
Contains 9 files:
|
||||
|
||||
@ -32,8 +32,10 @@ Changelog:
|
||||
V 2.30 - BETA Build 64
|
||||
- add - Tab to show all mappings for the current input (Tabbed with XML other Dump items)
|
||||
- add - Setting (enabled, disabled -> default) to automatically switch the new tabs - either Input or Dump
|
||||
- add - addbind of Mouse input is possible for Keyboard actions - seems to work somehow in the game...
|
||||
- fix - issue with user activations modes while dumping the mapping list
|
||||
- fix - issue with loading a map with gamepad mappings and the gamepad is not connected
|
||||
- fixes and refacturing while encountered...
|
||||
- update - doc SCJMapper_QGuide V2.30beta.pdf
|
||||
Changelog:
|
||||
V 2.29 - BETA Build 63
|
||||
|
Loading…
Reference in New Issue
Block a user