Skip to content

Commit

Permalink
Added menu file notifications. Updated labels
Browse files Browse the repository at this point in the history
  • Loading branch information
Jesus89 committed Feb 21, 2016
1 parent 0a010b7 commit 9aee1c5
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 11 deletions.
39 changes: 31 additions & 8 deletions icestudio/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,19 +72,39 @@ angular.module('app', ['flowChart', ])
// Selects the next node id.
var nextNodeID = 10;

$scope.filepath = '';
$scope.showEditor = false;

$scope.new = function () {
nextNodeID = 10;
data = { nodes: [], connections: [] }
$scope.chartDataModel = data;
$scope.chartViewModel = new flowchart.ChartViewModel(data);
$scope.initialize = function () {
nextNodeID = 10;
win.title = 'Icestudio';
$scope.filepath = '';
};
$scope.chartDataModel = { nodes: [], connections: [] };
$scope.chartViewModel = new flowchart.ChartViewModel($scope.chartDataModel);
}

$scope.new();
$scope.initialize();

$scope.new = function () {
if ($scope.filepath !== '') {
$scope.initialize();
alertify.success("New file created");
/*swal({
title: "Open file",
text: "There is an open file. Do you want to save it?",
type: "warning",
showCancelButton: true,
confirmButtonText: "Yes",
cancelButtonText: "No",
closeOnConfirm: true,
closeOnCancel: true
},
function(isConfirm){
if (isConfirm) {
$scope.saveas($scope.filepath);
}
});*/
}
};

$scope.load = function (filename) {
$scope.filepath = filename;
Expand All @@ -101,6 +121,7 @@ angular.module('app', ['flowChart', ])
$scope.chartDataModel = data;
$scope.chartViewModel = new flowchart.ChartViewModel(data);
$scope.$digest();
alertify.success("File " + name + " loaded");
};

$scope.save = function () {
Expand All @@ -113,10 +134,12 @@ angular.module('app', ['flowChart', ])
};

$scope.saveas = function (filename) {
$scope.filepath = filename;
var name = filename.replace(/^.*[\\\/]/, '').split('.')[0];
win.title = 'Icestudio - ' + name;
fs.writeFile(filename, JSON.stringify($scope.chartDataModel, null, 2), function(err) {
if (!err) {
alertify.success("File " + name + " saved");
}
});
};
Expand Down
4 changes: 2 additions & 2 deletions icestudio/js/blocks/label/label.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ angular.module('app')
}
array = value.split(' ');
for (var i = 0; i < array.length; i++) {
var item = array[i];
var item = '_' + array[i];
var block = {
label: "",
type: "linput",
Expand Down Expand Up @@ -55,7 +55,7 @@ angular.module('app')
}
array = value.split(' ');
for (var i = 0; i < array.length; i++) {
var item = array[i];
var item = '_' + array[i];
var block = {
label: "",
type: "loutput",
Expand Down
2 changes: 1 addition & 1 deletion icestudio/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"keywords": [
"FPGA", "open", "hardware"
],
"version": "0.1-alpha2",
"version": "0.1-alpha3",
"license" : "GPLv2",
"main": "icestudio.html",
"window": {
Expand Down

0 comments on commit 9aee1c5

Please sign in to comment.