Browse Source

bug fix

cl-refactor
yann300 10 years ago
parent
commit
dc054d7b53
  1. 1
      mix/CodeModel.cpp
  2. 1
      mix/qml/CodeEditorView.qml
  3. 5
      mix/qml/WebCodeEditor.qml
  4. 19
      mix/qml/html/codeeditor.js

1
mix/CodeModel.cpp

@ -43,7 +43,6 @@
#include "CodeHighlighter.h"
#include "FileIo.h"
#include "CodeModel.h"
#include "QBigInt.h"
using namespace dev::mix;

1
mix/qml/CodeEditorView.qml

@ -288,6 +288,7 @@ Item {
messageDialog.doc = editorListModel.get(index);
messageDialog.open();
}
loader.item.displayGasEstimation(gasEstimationAction.checked);
}
}
Component.onCompleted: {

5
mix/qml/WebCodeEditor.qml

@ -144,7 +144,12 @@ Item {
function compilationComplete()
{
if (editorBrowser)
{
editorBrowser.runJavaScript("compilationComplete()", function(result) { });
parent.displayGasEstimation(gasEstimationAction.checked);
}
}
function compilationError(error, sourceName)

19
mix/qml/html/codeeditor.js

@ -216,25 +216,26 @@ setGasCosts = function(_gasCosts)
{
gasCosts = JSON.parse(_gasCosts);
if (showGasEstimation)
if (showingGasEstimation)
{
displayGasEstimation(false);
displayGasEstimation(true);
}
}
var showGasEstimation = false;
var showingGasEstimation = false;
var gasMarkText = [];
var gasMarkRef = {};
displayGasEstimation = function(show)
{
show = JSON.parse(show);
showGasEstimation = show;
showingGasEstimation = show;
if (show)
{
var maxGas = 20000;
var step = colorGradient.length / maxGas; // 20000 max gas
gasMarkRef = [];
clearGasMark();
gasMarkText = [];
gasMarkRef = {};
for (var i in gasCosts)
{
@ -257,8 +258,7 @@ displayGasEstimation = function(show)
else
{
CodeMirror.off(editor.getWrapperElement(), "mouseover", listenMouseOver);
for (var k in gasMarkText)
gasMarkText[k].clear();
clearGasMark();
if (gasAnnotation)
{
gasAnnotation.clear();
@ -267,6 +267,13 @@ displayGasEstimation = function(show)
}
}
function clearGasMark()
{
if (gasMarkText)
for (var k in gasMarkText)
gasMarkText[k].clear();
}
var gasAnnotation;
function listenMouseOver(e)
{

Loading…
Cancel
Save