V 2.38 - BETA Build 73 final upload

pull/104/head
bm98 6 years ago
parent ae715b76c2
commit 24ad052e5e

4
.gitignore vendored

@ -75,10 +75,14 @@ local.properties
## Ignore Visual Studio temporary files, build results, and ## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons. ## files generated by popular Visual Studio add-ons.
# All in local .vs
.vs/
# User-specific files # User-specific files
*.suo *.suo
*.user *.user
*.sln.docstates *.sln.docstates
*.dtbcache
# Build results # Build results

@ -165,27 +165,32 @@ namespace SCJMapper_V2
return ( AppSettings.Instance.JSnHide.Contains( jsIndex.ToString( "D2" ) ) ); return ( AppSettings.Instance.JSnHide.Contains( jsIndex.ToString( "D2" ) ) );
} }
// contains the index into the color map of this particular device
// JS are 0..n, GP is GPtab index, not used is -1
private int[] m_tabMap = new int[12] { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }; private int[] m_tabMap = new int[12] { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 };
// manage TabPage visibility // manage TabPage visibility
private void ShowTabPages() private void ShowTabPages()
{ {
// only JS devices can be hidden
foreach ( var dev in DeviceInst.JoystickListRef ) { foreach ( var dev in DeviceInst.JoystickListRef ) {
dev.Hidden = IsTabPageHidden( dev.DevInstance ); dev.Hidden = IsTabPageHidden( dev.DevInstance );
} }
tc1.SuspendLayout( ); tc1.SuspendLayout( );
// reload all pages from the dev instance
tc1.TabPages.Clear( ); tc1.TabPages.Clear( );
// rebuild tab map for visible JS devices
m_tabMap = new int[12] { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }; m_tabMap = new int[12] { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 };
int i = 0; int i = 0;
foreach ( var dev in DeviceInst.JoystickListRef ) { foreach ( var dev in DeviceInst.JoystickListRef ) {
if ( !dev.Hidden ) { if ( !dev.Hidden ) {
m_tabMap[i++] = dev.DevInstance;
tc1.TabPages.Add( dev.TabPage ); tc1.TabPages.Add( dev.TabPage );
m_tabMap[i++] = dev.DevInstance;
} }
} }
if ( DeviceInst.GamepadRef != null ) { if ( DeviceInst.GamepadRef != null ) {
tc1.TabPages.Add( DeviceInst.GamepadRef.TabPage ); tc1.TabPages.Add( DeviceInst.GamepadRef.TabPage );
m_tabMap[i++] = DeviceInst.GamepadRef.MyTabPageIndex;
} }
// select the first tab if one is available // select the first tab if one is available
if ( tc1.TabPages.Count > 0 ) if ( tc1.TabPages.Count > 0 )
@ -202,7 +207,7 @@ namespace SCJMapper_V2
/// <returns>An Argb Color</returns> /// <returns>An Argb Color</returns>
private Color JsColorSetting( int jsIndex ) private Color JsColorSetting( int jsIndex )
{ {
// JS Tab Colors // read JS Tab Colors
string[] e = AppSettings.Instance.JSnColor.Split( new char[] { ',' } ); string[] e = AppSettings.Instance.JSnColor.Split( new char[] { ',' } );
if ( jsIndex < e.Length ) { if ( jsIndex < e.Length ) {
if ( int.TryParse( e[jsIndex], out int colInt ) ) { if ( int.TryParse( e[jsIndex], out int colInt ) ) {
@ -220,14 +225,11 @@ namespace SCJMapper_V2
} }
/// <summary> /// <summary>
/// Update the TabPage Colors from Setting /// Update the TabPage Colors from Settings (only Joystick colors)
/// </summary> /// </summary>
private void UpdateTabPageColors() private void UpdateTabPageColors()
{ {
// load TabPage colors // re-load TabPage colors for each JS device
for ( int i = 0; i < MyColors.TabColor.Length; i++ ) {
}
foreach ( var dev in DeviceInst.JoystickListRef ) { foreach ( var dev in DeviceInst.JoystickListRef ) {
MyColors.TabColor[dev.DevInstance] = JsColorSetting( dev.DevInstance ); MyColors.TabColor[dev.DevInstance] = JsColorSetting( dev.DevInstance );
dev.TabPage.BackColor = MyColors.TabColor[dev.DevInstance]; dev.TabPage.BackColor = MyColors.TabColor[dev.DevInstance];
@ -479,12 +481,20 @@ namespace SCJMapper_V2
private void tc1_DrawItem( object sender, DrawItemEventArgs e ) private void tc1_DrawItem( object sender, DrawItemEventArgs e )
{ {
try { try {
// get the BG color from the current TabColor Map.
// as some devices can be hidden, use m_tabMap to find the 'real' index rather than using the tab index (this tabMap is updated on changes in Settings)
// GP should be always the last JS +1
// -1 indicates - not used
if ( m_tabMap[e.Index] < 0 )
return; // not used tab - should not happen..
Font f; Font f;
Brush backBrush = new SolidBrush( MyColors.TabColor[m_tabMap[e.Index]] ); Brush backBrush = new SolidBrush( MyColors.TabColor[m_tabMap[e.Index]] );
Brush foreBrush = new SolidBrush( Color.Black ); Brush foreBrush = new SolidBrush( Color.Black );
//This construct will tell you which tab page has focus to change the style. //The draw call sends all tabs to draw, the selected one needs to be with Bold font
if ( e.Index == this.tc1.SelectedIndex ) { if ( e.Index == this.tc1.SelectedIndex ) {
f = new Font( e.Font, FontStyle.Bold ); f = new Font( e.Font, FontStyle.Bold );
/* /*
@ -500,7 +510,6 @@ namespace SCJMapper_V2
} }
else { else {
f = e.Font; f = e.Font;
foreBrush = new SolidBrush( e.ForeColor );
} }
//To set the alignment of the caption. //To set the alignment of the caption.
@ -515,14 +524,10 @@ namespace SCJMapper_V2
sf.Dispose( ); sf.Dispose( );
if ( e.Index == this.tc1.SelectedIndex ) { if ( e.Index == this.tc1.SelectedIndex ) {
f.Dispose( ); f.Dispose( ); // we created this one
backBrush.Dispose( );
foreBrush.Dispose( );
}
else {
backBrush.Dispose( );
foreBrush.Dispose( );
} }
backBrush.Dispose( );
foreBrush.Dispose( );
} }
catch ( Exception Ex ) { catch ( Exception Ex ) {
log.Error( "Ex DrawItem", Ex ); log.Error( "Ex DrawItem", Ex );
@ -664,7 +669,8 @@ namespace SCJMapper_V2
int nJs = 0; // number the Joystick Tabs int nJs = 0; // number the Joystick Tabs
foreach ( myDxJoystick myJs in dxJoysticks ) { foreach ( myDxJoystick myJs in dxJoysticks ) {
// we have the first tab made as reference so TabPage[0] already exists // we have the first tab made as reference so TabPage[0] already exists
JoystickCls js = null; UC_JoyPanel uUC_JoyPanelNew = null; JoystickCls js = null;
UC_JoyPanel uUC_JoyPanelNew = null;
if ( tabs == 0 ) { if ( tabs == 0 ) {
// first panel - The Tab content exists already // first panel - The Tab content exists already
log.Debug( " - Add first Joystick panel" ); log.Debug( " - Add first Joystick panel" );
@ -673,7 +679,7 @@ namespace SCJMapper_V2
else { else {
log.Debug( " - Add next Joystick panel" ); log.Debug( " - Add next Joystick panel" );
// setup the further tab contents along the reference one in TabPage[0] (the control named UC_JoyPanel) // setup the further tab contents along the reference one in TabPage[0] (the control named UC_JoyPanel)
tc1.TabPages.Add( "" ); // numbering is 1 based for the user tc1.TabPages.Add( "" );
uUC_JoyPanelNew = new UC_JoyPanel( ); tc1.TabPages[tabs].Controls.Add( uUC_JoyPanelNew ); uUC_JoyPanelNew = new UC_JoyPanel( ); tc1.TabPages[tabs].Controls.Add( uUC_JoyPanelNew );
Tx.LocalizeControlTree( uUC_JoyPanelNew ); Tx.LocalizeControlTree( uUC_JoyPanelNew );
uUC_JoyPanelNew.Size = UC_JoyPanel.Size; uUC_JoyPanelNew.Location = UC_JoyPanel.Location; uUC_JoyPanelNew.Size = UC_JoyPanel.Size; uUC_JoyPanelNew.Location = UC_JoyPanel.Location;
@ -702,13 +708,18 @@ namespace SCJMapper_V2
// make the GP the LAST device if there is one. // make the GP the LAST device if there is one.
if ( ( tabs < JoystickCls.JSnum_MAX ) && ( dxGamepad != null ) ) { if ( ( tabs < JoystickCls.JSnum_MAX ) && ( dxGamepad != null ) ) {
log.Debug( " - Add Gamepad panel" ); log.Debug( " - Add Gamepad panel" );
if ( tabs > 0 ) {
tc1.TabPages.Add( "" );
log.Debug( " - Add Gamepad as next panel" );
}
tc1.TabPages[tabs].Text = Tx.Translate( "xGamepad" ) + " "; tc1.TabPages[tabs].Text = Tx.Translate( "xGamepad" ) + " ";
UC_GpadPanel uUC_GpadPanelNew = new UC_GpadPanel( ); UC_GpadPanel uUC_GpadPanelNew = new UC_GpadPanel( ); tc1.TabPages[tabs].Controls.Add( uUC_GpadPanelNew );
tc1.TabPages[tabs].Controls.Add( uUC_GpadPanelNew );
Tx.LocalizeControlTree( uUC_GpadPanelNew ); Tx.LocalizeControlTree( uUC_GpadPanelNew );
uUC_GpadPanelNew.Size = UC_JoyPanel.Size; uUC_GpadPanelNew.Location = UC_JoyPanel.Location; uUC_GpadPanelNew.Size = UC_JoyPanel.Size; uUC_GpadPanelNew.Location = UC_JoyPanel.Location;
UC_JoyPanel.Enabled = false; UC_JoyPanel.Visible = false; // don't use this one if ( tabs == 0 ) {
UC_JoyPanel.Enabled = false; UC_JoyPanel.Visible = false; // don't use this one
}
log.Debug( " - Create Gamepad instance" ); log.Debug( " - Create Gamepad instance" );
DeviceInst.GamepadInst = new GamepadCls( dxGamepad, uUC_GpadPanelNew, tabs ); // does all device related activities for that particular item DeviceInst.GamepadInst = new GamepadCls( dxGamepad, uUC_GpadPanelNew, tabs ); // does all device related activities for that particular item
DeviceInst.GamepadRef.SetDeviceName( GamepadCls.DevNameCIG ); // this is fixed ... DeviceInst.GamepadRef.SetDeviceName( GamepadCls.DevNameCIG ); // this is fixed ...

@ -1,5 +1,5 @@
SC Joystick Mapper V 2.38 - Build 73 BETA SC Joystick Mapper V 2.38 - Build 73 BETA
(c) Cassini, StandardToaster - 15-Jul-2018 (c) Cassini, StandardToaster - 19-Jul-2018
Contains 14 files + graphics: Contains 14 files + graphics:
@ -45,8 +45,8 @@ cassini@burri-web.org
Changelog: Changelog:
V 2.38 - BETA Build 73 V 2.38 - BETA Build 73
- add - ability to hide device tabs in Settings - add - ability to hide joystick device tabs in Settings
- add - ability to color device tabs in Settings - add - ability to color joystick device tabs in Settings
- update - defaultProfile.xml from SC PTU 3.2.1d as last resort built in one - update - defaultProfile.xml from SC PTU 3.2.1d as last resort built in one
- NOTE: other new stuff is not complete so you're on your own here - NOTE: other new stuff is not complete so you're on your own here
V 2.37 - BETA Build 72 - quick update for PTU 3.1 V 2.37 - BETA Build 72 - quick update for PTU 3.1

Loading…
Cancel
Save