-
Notifications
You must be signed in to change notification settings - Fork 253
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature: new UI for TypeMarker (#1295)
- Loading branch information
Showing
11 changed files
with
406 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
#region License | ||
/* | ||
* Copyright (C) 1999-2023 John Källén. | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2, or (at your option) | ||
* any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program; see the file COPYING. If not, write to | ||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | ||
*/ | ||
#endregion | ||
|
||
using Reko.Core; | ||
using Reko.Gui.Components; | ||
using System; | ||
|
||
namespace Reko.Gui.ViewModels.Dialogs | ||
{ | ||
public class TypeMarkerViewModel : ReactingObject | ||
{ | ||
private Program program; | ||
private Address addr; | ||
private string captionFormat; | ||
|
||
public TypeMarkerViewModel(Program program, Address addr, string captionFormat) | ||
{ | ||
this.program = program; | ||
this.addr = addr; | ||
this.captionFormat = captionFormat; | ||
} | ||
|
||
public void Show() | ||
{ | ||
this.IsVisible = true; | ||
this.Caption = string.Format(captionFormat, addr); | ||
} | ||
|
||
public void Hide() | ||
{ | ||
this.IsVisible = false; | ||
} | ||
|
||
public string? Caption | ||
{ | ||
get => this.caption; | ||
set => this.RaiseAndSetIfChanged(ref this.caption, value); | ||
} | ||
private string? caption; | ||
|
||
public string? UserText | ||
{ | ||
get => this.userText; | ||
set => this.RaiseAndSetIfChanged(ref this.userText, value); | ||
} | ||
private string? userText; | ||
|
||
public string? FormattedType | ||
{ | ||
get => this.formattedType; | ||
set => this.RaiseAndSetIfChanged(ref this.formattedType, value); | ||
} | ||
private string? formattedType; | ||
|
||
|
||
public string FormatType(string text) | ||
{ | ||
try | ||
{ | ||
var dataType = HungarianParser.Parse(text); | ||
if (dataType is null) | ||
return " - Null - "; | ||
else | ||
return dataType.ToString(); | ||
} | ||
catch | ||
{ | ||
return " - Error - "; | ||
} | ||
} | ||
|
||
public bool IsVisible | ||
{ | ||
get => isVisible; | ||
set => this.RaiseAndSetIfChanged(ref isVisible, value); | ||
} | ||
private bool isVisible; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
94 changes: 94 additions & 0 deletions
94
src/UserInterfaces/WindowsForms/Controls/TypeMarker.Designer.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.