Skip to content

Commit

Permalink
Merge pull request #56 from luni64/develop
Browse files Browse the repository at this point in the history
Optionally clone core library into project
  • Loading branch information
luni64 authored Aug 23, 2021
2 parents 1196940 + 0a2a5c1 commit 877f50b
Show file tree
Hide file tree
Showing 29 changed files with 427 additions and 424 deletions.
21 changes: 11 additions & 10 deletions VisualTeensy/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,14 @@ SetupData loadSetup()
setupData.mru.load(Settings.Default.mruString);
Helpers.arduinoPath = setupData.arduinoBase;

using (var reader = new StreamReader(Assembly.GetExecutingAssembly().GetManifestResourceStream("VisualTeensy.Embedded.makefile_make")))
{
setupData.makefile_fixed = reader.ReadToEnd();
}
using (var reader = new StreamReader(Assembly.GetExecutingAssembly().GetManifestResourceStream("VisualTeensy.Embedded.makefile_builder")))
{
setupData.makefile_builder = reader.ReadToEnd();
}
//using (var reader = new StreamReader(Assembly.GetExecutingAssembly().GetManifestResourceStream("VisualTeensy.Embedded.makefile_make")))
//{
// setupData.makefile_fixed = reader.ReadToEnd();
//}
//using (var reader = new StreamReader(Assembly.GetExecutingAssembly().GetManifestResourceStream("VisualTeensy.Embedded.makefile_builder")))
//{
// setupData.makefile_builder = reader.ReadToEnd();
//}



Expand Down Expand Up @@ -135,10 +135,11 @@ void saveSetup(SetupData setupData)


protected override void OnStartup(StartupEventArgs e)
{
{
CultureInfo.DefaultThreadCurrentUICulture = CultureInfo.GetCultureInfo("en-US");

this.ShutdownMode = ShutdownMode.OnExplicitShutdown;

CultureInfo.DefaultThreadCurrentUICulture = CultureInfo.GetCultureInfo("en-US");

// create applicaton folder <user>\AppData\Local\VisualTeensy (if not yet existing)
Directory.CreateDirectory(SetupData.vtAppFolder);
Expand Down
4 changes: 2 additions & 2 deletions VisualTeensy/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.0")]
[assembly: AssemblyFileVersion("1.1.0")]
[assembly: AssemblyVersion("1.2.0")]
[assembly: AssemblyFileVersion("1.2.0")]
[assembly: NeutralResourcesLanguage("en")]

12 changes: 8 additions & 4 deletions VisualTeensy/ViewModel/MainWin/MainVM.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using System.Collections.ObjectModel;
using log4net;
using System.Collections.ObjectModel;
using System.IO;
using System.Reflection;
using System.Windows;
using vtCore;
using vtCore.Interfaces;
Expand Down Expand Up @@ -110,17 +112,19 @@ public MainVM(IProject project, LibManager libManager, SetupData setup)
projecTabVM.OnPropertyChanged("");
};

mruList = new ObservableCollection<MruItemVM>();
mruList = new ObservableCollection<MruItemVM>();
foreach (var prj in setup.mru.projects)
{
mruList.Add(new MruItemVM(prj, this));
}
//var mruList = setup.mru.projects?.Select(p => new MruItemVM(p, this));
//if(mruList != null) mruList = new ObservableCollection<MruItemVM>(mruList);
log.Info($"MRU list loaded ({mruList.Count} entries)");
log.Info("constructed");
}

public LibManager libManager { get; }
public SetupData setup { get; }
public IProject project { get; }

private static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
}
}
94 changes: 31 additions & 63 deletions VisualTeensy/ViewModel/ProjectTab/ProjectTabVM.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
using System.Linq;
using vtCore.Interfaces;
using vtCore;

using log4net;
using System.Reflection;

namespace ViewModel
{
Expand Down Expand Up @@ -94,28 +95,16 @@ public BoardVM selectedBoard
}
}

public bool isMakefileBuild => project.buildSystem == BuildSystem.makefile;

public bool isMakefileBuild => project.buildSystem == BuildSystem.makefile;
// set
// {
// if (value != project.isMakefileBuild)
// {
// project.isMakefileBuild = value;
// OnPropertyChanged();
// }
// }
//}


public bool quickSetup
public SetupTypes setupType
{
get => project.selectedConfiguration.setupType == SetupTypes.quick ? true : false;
get => project.selectedConfiguration.setupType;
set
{
SetupTypes newType = value == true ? SetupTypes.quick : SetupTypes.expert; // hack, valueConverter would be better
if (project.selectedConfiguration.setupType != newType)
if (project.selectedConfiguration.setupType != value)
{
project.selectedConfiguration.setupType = newType;
project.selectedConfiguration.setupType = value;
updateAll();
OnPropertyChanged("");
}
Expand All @@ -132,7 +121,21 @@ public bool hasDebugSupport
OnPropertyChanged("");
}
}


public LibStrategy coreStragegy
{
get => project.selectedConfiguration.coreStrategy;
set
{
if (value != project.selectedConfiguration.coreStrategy)
{
project.selectedConfiguration.coreStrategy = value;
updateFiles();
OnPropertyChanged("");
}
}
}

public string makefileExtension
{
get => project.selectedConfiguration.makefileExtension;
Expand Down Expand Up @@ -202,46 +205,7 @@ public String arduinoBase
}
}
}
//public String boardTxtPath
//{
// get => project.selectedConfiguration.boardTxtPath;
// set
// {
// if (value != project.selectedConfiguration.boardTxtPath)
// {
// project.selectedConfiguration.boardTxtPath = value.Trim();
// updateAll();
// OnPropertyChanged("");
// }
// }
//}
//public bool copyBoardTxt
//{
// get => project.selectedConfiguration.copyBoardTxt;
// set
// {
// if (value != project.selectedConfiguration.copyBoardTxt)
// {
// project.selectedConfiguration.copyBoardTxt = value;
// OnPropertyChanged();
// updateFiles();
// }
// }
//}

public bool copyCore
{
get => project.selectedConfiguration.copyCore;
set
{
if (value != project.selectedConfiguration.copyCore)
{
project.selectedConfiguration.copyCore = value;
OnPropertyChanged();
updateFiles();
}
}
}

public String corePath
{
get => project.selectedConfiguration.coreBase.path;
Expand Down Expand Up @@ -295,12 +259,13 @@ public ProjectTabVM(IProject project, LibManager libManager, SetupData setup)
settFile = ProjectSettings.generate(project);
debugFile = DebugFile.generate(project, setup);



cmdGenerate = new RelayCommand(doGenerate);//, o => project.pathError == null && !String.IsNullOrWhiteSpace(project.selectedConfiguration.makefile) && !String.IsNullOrWhiteSpace(project.tasks_json) && !String.IsNullOrWhiteSpace(project.props_json));
cmdClose = new RelayCommand(doClose);

updateBoards();
OnPropertyChanged("");

log.Info("constructed");
}

internal void updateAll()
Expand All @@ -311,7 +276,7 @@ internal void updateAll()
}
internal void updateFiles()
{


makefile = Makefile.generate(project, libManager, setup);
taskFile = TaskFile.generate(project, setup);
Expand Down Expand Up @@ -356,6 +321,9 @@ protected void Message(string message)
public IProject project;
LibManager libManager;
SetupData setup;


private static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
}
}

Expand Down
4 changes: 2 additions & 2 deletions VisualTeensy/ViewModel/SaveWin/SaveWinVM.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ async Task doSave()
while (!taskVMs.IsCurrentAfterLast)
{
var taskVM = (TaskVM)taskVMs.CurrentItem;
log.Info(taskVM.title);
log.Info(taskVM.title + " started...");

await taskVM.action();
await Task.Delay(50);
await Task.Delay(150);
log.Info($"{taskVM.title} done");

taskVMs.MoveCurrentToNext();
Expand Down
12 changes: 10 additions & 2 deletions VisualTeensy/ViewModel/SetupTab/SetupTabVM.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
using System;
using log4net;
using System;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Drawing;
using System.Reflection;
using System.Windows.Data;
using vtCore;
using vtCore.Interfaces;
Expand Down Expand Up @@ -277,12 +279,13 @@ public int selectedFile
get => _selectedFile;
set => SetProperty(ref _selectedFile, value);
}
int _selectedFile=0;
int _selectedFile = 0;

public RelayCommand cmdAddFile { get; private set; }
void doAddFile(object f)
{
string filename = f as String;
log.Info($"add additional file {filename}");
setup.additionalFiles.Add(filename);
additionalFilesView.Refresh();
}
Expand All @@ -292,6 +295,7 @@ void doDelFile(object o)
{
if (selectedFile >= 0)
{
log.Info($"delete additional file {setup.additionalFiles[selectedFile]}");
setup.additionalFiles.RemoveAt(selectedFile);
additionalFilesView.Refresh();
}
Expand All @@ -309,10 +313,14 @@ public SetupTabVM(IProject project, SetupData setup)
// additionalFiles = new ObservableCollection<string>(setup.additionalFiles);

additionalFilesView = CollectionViewSource.GetDefaultView(setup.additionalFiles);

log.Info("constructed");
}

private readonly SetupData setup;
private readonly IProject project;

private static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
}
}

23 changes: 23 additions & 0 deletions VisualTeensy/Views/Converters/EnumBooleanConverter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;

namespace VisualTeensy
{
public class EnumBooleanConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return value.Equals(parameter);
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return ((bool)value) ? parameter : Binding.DoNothing;
}
}
}
Loading

0 comments on commit 877f50b

Please sign in to comment.