Syntax Highlight
This commit is contained in:
@@ -83,7 +83,7 @@ function Brush(rune)
|
||||
return "Eraser "+this.settings["size"];
|
||||
}
|
||||
else{
|
||||
return "Brush "+this.settings["size"];
|
||||
return "Brush <i style='color:"+this.settings["color"]+"'>●</i> "+this.settings["size"];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -54,12 +54,19 @@ function Cursor(rune)
|
||||
this.layer.context().closePath();
|
||||
|
||||
this.layer.context().beginPath();
|
||||
this.layer.context().arc(position.x, position.y, size+1, 0, 2 * Math.PI, false);
|
||||
this.layer.context().arc(position.x, position.y, size/2, 0, 2 * Math.PI, false);
|
||||
this.layer.context().lineWidth = 1;
|
||||
this.layer.context().strokeStyle = "white";
|
||||
this.layer.context().stroke();
|
||||
this.layer.context().closePath();
|
||||
|
||||
this.layer.context().beginPath();
|
||||
this.layer.context().arc(position.x, position.y, (size/2)+1, 0, 2 * Math.PI, false);
|
||||
this.layer.context().lineWidth = 1;
|
||||
this.layer.context().strokeStyle = "black";
|
||||
this.layer.context().stroke();
|
||||
this.layer.context().closePath();
|
||||
|
||||
this.pointer_last = position;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,13 +2,13 @@ function Magnet(rune)
|
||||
{
|
||||
Module.call(this,rune);
|
||||
|
||||
this.settings = {"grid" : new Rect("1x1"), "marker": new Position("4,4"), "reset" : new Bang()};
|
||||
this.settings = {"grid" : new Rect("1x1"), "marker": new Position("4,4")};
|
||||
|
||||
this.add_method(new Method("grid",["rect","position"]));
|
||||
|
||||
this.grid = function(params,preview = false)
|
||||
{
|
||||
if(!params.rect()){ return; }
|
||||
if(!params.rect()){ return 0, "Rect?"; }
|
||||
|
||||
if(!this.layer){ this.create_layer(); }
|
||||
|
||||
@@ -19,6 +19,8 @@ function Magnet(rune)
|
||||
this.settings["grid"] = params.rect();
|
||||
this.settings["market"] = params.position();
|
||||
}
|
||||
|
||||
return 1, preview ? "preview" : "ok";
|
||||
}
|
||||
|
||||
this.draw_grid = function(rect,grid)
|
||||
|
||||
@@ -57,8 +57,6 @@ function Terminal(rune)
|
||||
ronin.terminal.run();
|
||||
}
|
||||
|
||||
this.update_status();
|
||||
|
||||
this.history = this.textarea.value;
|
||||
this.timer = 0;
|
||||
}
|
||||
@@ -106,6 +104,9 @@ function Terminal(rune)
|
||||
else if(ronin["render"].collection[method_name]){
|
||||
return ronin["render"].collection[method_name].render(parameters);
|
||||
}
|
||||
else if(setting_name){
|
||||
return 0, "Unknown Setting";
|
||||
}
|
||||
else if(ronin[module_name]){
|
||||
return 0, "Unknown Method";
|
||||
}
|
||||
@@ -120,6 +121,24 @@ function Terminal(rune)
|
||||
|
||||
this.syntax_highlight = function(line)
|
||||
{
|
||||
var line = line;
|
||||
|
||||
// Method
|
||||
if(line.indexOf(".") > 0){
|
||||
var module = line.split(".")[0];
|
||||
var method = line.split(".")[1].split(" ")[0];
|
||||
line = line.replace(module,"<span class='module'>"+module+"</span>");
|
||||
line = line.replace(method,"<span class='method'>"+method+"</span>");
|
||||
}
|
||||
|
||||
// Setting
|
||||
if(line.indexOf(":") > 0){
|
||||
var module = line.split(":")[0];
|
||||
var setting = line.split(":")[1].split(" ")[0];
|
||||
line = line.replace(module,"<span class='module'>"+module+"</span>");
|
||||
line = line.replace(setting,"<span class='setting'>"+setting+"</span>");
|
||||
}
|
||||
|
||||
return line;
|
||||
}
|
||||
|
||||
@@ -133,7 +152,7 @@ function Terminal(rune)
|
||||
this.timer = 10;
|
||||
}
|
||||
|
||||
this.update_status = function()
|
||||
this.update = function()
|
||||
{
|
||||
if(ronin.terminal.has_changed() == true){
|
||||
this.status_element.innerHTML = "Changes Pending.";
|
||||
@@ -143,6 +162,12 @@ function Terminal(rune)
|
||||
}
|
||||
|
||||
this.status_element.innerHTML += "<span class='details'>"+this.textarea.value.length+"c "+this.textarea.value.split("\n").length+"l</span>";
|
||||
|
||||
this.hint_element.innerHTML = "";
|
||||
var queue = ronin.terminal.textarea.value.split("\n")
|
||||
for(id in queue){
|
||||
this.hint_element.innerHTML += "<line><text class='input'>"+this.syntax_highlight(queue[id])+"</text></line><br />";
|
||||
}
|
||||
}
|
||||
|
||||
this.log = function(log)
|
||||
|
||||
@@ -14,9 +14,10 @@ function Widget(rune)
|
||||
{
|
||||
var s = "";
|
||||
|
||||
for (var key in ronin.modules){
|
||||
s += ronin.modules[key].widget() ? "<span class='"+key+"'><name>"+key+"</name>"+ronin.modules[key].widget()+"</span> " : "";
|
||||
}
|
||||
s += ronin.cursor.widget();
|
||||
// for (var key in ronin.modules){
|
||||
// s += ronin.modules[key].widget() ? "<span class='"+key+"'><name>"+key+"</name>"+ronin.modules[key].widget()+"</span> " : "";
|
||||
// }
|
||||
|
||||
this.element.innerHTML = s;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user