Skip to content

Commit

Permalink
Add: Remember column widths and popup dialog placement
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgRottensteiner committed Jul 3, 2024
1 parent 44e9584 commit 01b514c
Show file tree
Hide file tree
Showing 31 changed files with 642 additions and 213 deletions.
1 change: 1 addition & 0 deletions C64Models/Types/FileChunkConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ public class FileChunkConstants
public const ushort SETTINGS_MEMORY_VIEW = 0x201F;
public const ushort SETTINGS_BREAKPOINTS = 0x2020;
public const ushort SETTINGS_BREAKPOINT = 0x2021;
public const ushort SETTINGS_DIALOG_APPEARANCE = 0x2022;
}

}
2 changes: 1 addition & 1 deletion C64Models/Version/StudioVersion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ namespace RetroDevStudio
public static class Version
{
public const string VersionBase = "7.8";
public const string BuildNumber = "14";
public const string BuildNumber = "15";
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 36 additions & 2 deletions C64Studio/Controls/DecentForms/MenuButton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ namespace DecentForms
{
public class MenuButton : Button
{
private bool _ShowDropDownArrow = true;
private bool _ShowSplitBar = false;


[DefaultValue( null )]
public ContextMenuStrip Menu
{
Expand All @@ -20,10 +24,40 @@ public ContextMenuStrip Menu


[DefaultValue( true )]
public bool ShowDropDownArrow { get; set; }
public bool ShowDropDownArrow
{
get
{
return _ShowDropDownArrow;
}
set
{
if ( _ShowDropDownArrow != value )
{
_ShowDropDownArrow = value;
Invalidate();
}
}
}



[DefaultValue( false )]
public bool ShowSplitBar { get; set; }
public bool ShowSplitBar
{
get
{
return _ShowSplitBar;
}
set
{
if ( _ShowSplitBar != value )
{
_ShowSplitBar = value;
Invalidate();
}
}
}

[DefaultValue( false )]
public bool Checked { get; set; }
Expand Down
75 changes: 44 additions & 31 deletions C64Studio/Dialogs/FormMacros.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

72 changes: 35 additions & 37 deletions C64Studio/Dialogs/FormMacros.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,48 +13,15 @@ public partial class FormMacros : Form
private DocumentInfo m_Doc = null;
private TextBox m_Edit = null;
private StudioCore Core = null;
private string _AppearanceKey = "";



public FormMacros( StudioCore Core, DocumentInfo Doc, TextBox EditToInsert )
{
InitializeComponent();

m_Doc = Doc;
m_Edit = EditToInsert;
this.Core = Core;

InsertMacro( "$(Filename)" );
InsertMacro( "$(File)" );
InsertMacro( "$(FilenameWithoutExtension)" );
InsertMacro( "$(FilePath)" );
InsertMacro( "$(BuildTargetPath)" );
InsertMacro( "$(BuildTargetFilename)" );
InsertMacro( "$(BuildTargetFilenameWithoutExtension)" );
InsertMacro( "$(BuildTargetFile)" );
InsertMacro( "$(BuildTargetFileWithoutExtension)" );
InsertMacro( "$(RunPath)" );
InsertMacro( "$(RunFilename)" );
InsertMacro( "$(RunFile)" );
InsertMacro( "$(RunFilenameWithoutExtension)" );
InsertMacro( "$(DebugStartAddress)" );
InsertMacro( "$(DebugStartAddressHex)" );

InsertMacro( "$(ConfigName)" );
InsertMacro( "$(ProjectPath)" );
InsertMacro( "$(SolutionPath)" );
InsertMacro( "$(MediaManager)" );
InsertMacro( "$(MediaTool)" );

Core.Theming.ApplyTheme( this );
}



public FormMacros( StudioCore Core, DocumentInfo Doc, TextBox EditToInsert, bool ShowRunCommands )
public FormMacros( StudioCore Core, DocumentInfo Doc, TextBox EditToInsert, bool ShowRunCommands, string AppearanceKey )
{
InitializeComponent();

_AppearanceKey = AppearanceKey;
m_Doc = Doc;
m_Edit = EditToInsert;
this.Core = Core;
Expand Down Expand Up @@ -83,6 +50,10 @@ public FormMacros( StudioCore Core, DocumentInfo Doc, TextBox EditToInsert, bool
InsertMacro( "$(SolutionPath)" );
InsertMacro( "$(MediaManager)" );
InsertMacro( "$(MediaTool)" );

btnInsert.Visible = ( m_Edit != null );

Core.Theming.ApplyTheme( this );
}


Expand All @@ -105,7 +76,17 @@ private void listMacros_ItemActivate( object sender, EventArgs e )
{
return;
}
InsertMacro();
}



private void InsertMacro()
{
int caretPos = m_Edit.SelectionStart;
m_Edit.Text = m_Edit.Text.Insert( m_Edit.SelectionStart, listMacros.SelectedItems[0].SubItems[0].Text );
m_Edit.SelectionStart = caretPos + listMacros.SelectedItems[0].SubItems[0].Text.Length;
m_Edit.SelectionLength = 0;
}


Expand All @@ -116,7 +97,7 @@ private void btnInsert_Click( DecentForms.ControlBase Sender )
{
return;
}
m_Edit.Text = m_Edit.Text.Insert( m_Edit.SelectionStart, listMacros.SelectedItems[0].SubItems[0].Text );
InsertMacro();
}


Expand All @@ -127,5 +108,22 @@ private void btnOK_Click( DecentForms.ControlBase Sender )
}



private void FormMacros_FormClosing( object sender, FormClosingEventArgs e )
{
Core.Settings.DialogSettings.StoreAppearance( _AppearanceKey, this );
Core.Settings.DialogSettings.StoreListViewColumns( _AppearanceKey, listMacros );
}



private void FormMacros_Load( object sender, EventArgs e )
{
Core.Settings.DialogSettings.RestoreAppearance( _AppearanceKey, this );
Core.Settings.DialogSettings.RestoreListViewColumns( _AppearanceKey, listMacros );
}



}
}
24 changes: 3 additions & 21 deletions C64Studio/Dialogs/Preferences/PrefTools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -456,28 +456,10 @@ private void editToolTrueDriveOffArguments_TextChanged( object sender, EventArgs

private void btnMacros_Click( DecentForms.ControlBase Sender )
{
string macroInfo = "";
bool error = false;

var Document = Core.MainForm.ActiveDocumentInfo;
if ( Document == null )
{
macroInfo = "Sorry, but no document is currently active.";
error = true;
}
else
{
macroInfo = "$(Filename) = " + Core.MainForm.FillParameters( "$(Filename)", Document, false, out error ) + System.Environment.NewLine;
macroInfo += "$(FilenameWithoutExtension) = " + Core.MainForm.FillParameters( "$(FilenameWithoutExtension)", Document, false, out error ) + System.Environment.NewLine;
macroInfo += "$(FilePath) = " + Core.MainForm.FillParameters( "$(FilePath)", Document, false, out error ) + System.Environment.NewLine;
macroInfo += "$(BuildTargetFilename) = " + Core.MainForm.FillParameters( "$(BuildTargetFilename)", Document, false, out error ) + System.Environment.NewLine;
macroInfo += "$(BuildTargetFilenameWithoutExtension) = " + Core.MainForm.FillParameters( "$(BuildTargetFilenameWithoutExtension)", Document, false, out error ) + System.Environment.NewLine;
macroInfo += "$(DebugStartAddress) = " + Core.MainForm.FillParameters( "$(DebugStartAddress)", Document, false, out error ) + System.Environment.NewLine;
macroInfo += "$(DebugStartAddressHex) = " + Core.MainForm.FillParameters( "$(DebugStartAddressHex)", Document, false, out error ) + System.Environment.NewLine;

macroInfo += System.Environment.NewLine + System.Environment.NewLine + "Any other value will be calculated as expression, including symbols of the current build. Prefix with '0x' to output the value hexadecimal.";
}
System.Windows.Forms.MessageBox.Show( macroInfo, "Macros" );

var formMacros = new FormMacros( Core, Document, null, true, "Macros.Tools" );
formMacros.ShowDialog();
}


Expand Down
Loading

0 comments on commit 01b514c

Please sign in to comment.