|
|
@ -5,6 +5,8 @@ local ui = |
|
|
|
editor = require( "ui.editor" ), |
|
|
|
editor = require( "ui.editor" ), |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
local wx = require( "wx" ) |
|
|
|
|
|
|
|
|
|
|
|
local lfs = require( "lfs" ) |
|
|
|
local lfs = require( "lfs" ) |
|
|
|
|
|
|
|
|
|
|
|
local assert = assert |
|
|
|
local assert = assert |
|
|
@ -23,7 +25,10 @@ function new( parent, source ) |
|
|
|
local page = {} |
|
|
|
local page = {} |
|
|
|
setmetatable( page, meta ) |
|
|
|
setmetatable( page, meta ) |
|
|
|
page.editor = ui.editor.new( parent ) |
|
|
|
page.editor = ui.editor.new( parent ) |
|
|
|
page.events = { onBreakPointChanged = {} } |
|
|
|
page.events = { |
|
|
|
|
|
|
|
onBreakPointChanged = {}, |
|
|
|
|
|
|
|
onScrollChanged = {}, |
|
|
|
|
|
|
|
} |
|
|
|
page:setSource_( source ) |
|
|
|
page:setSource_( source ) |
|
|
|
page.editor.breakpointCallback = function( line ) |
|
|
|
page.editor.breakpointCallback = function( line ) |
|
|
|
page:runEvents_( "onBreakPointChanged", line ) |
|
|
|
page:runEvents_( "onBreakPointChanged", line ) |
|
|
@ -53,6 +58,9 @@ function meta.__index:update() |
|
|
|
assert( string.sub( self.source, 1, 1 ) == "@" ) |
|
|
|
assert( string.sub( self.source, 1, 1 ) == "@" ) |
|
|
|
local fileName = string.sub( self.source, 2 ) |
|
|
|
local fileName = string.sub( self.source, 2 ) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
local scrollPosition = self:GetScrollPos() |
|
|
|
|
|
|
|
self:runEvents_( "onScrollChanged", scrollPosition ) |
|
|
|
|
|
|
|
|
|
|
|
local newDate = lfs.attributes( fileName, "modification" ) or 0 |
|
|
|
local newDate = lfs.attributes( fileName, "modification" ) or 0 |
|
|
|
if newDate > self.sourceDate then |
|
|
|
if newDate > self.sourceDate then |
|
|
|
print( "reloading source file "..fileName ) |
|
|
|
print( "reloading source file "..fileName ) |
|
|
@ -78,6 +86,14 @@ function meta.__index:getFocus() |
|
|
|
return ed:GetCurrentLine() + 1 |
|
|
|
return ed:GetCurrentLine() + 1 |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function meta.__index:SetScrollPos( pos ) |
|
|
|
|
|
|
|
self.editor.editor:LineScroll(0, pos) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function meta.__index:GetScrollPos() |
|
|
|
|
|
|
|
return self.editor.editor:GetScrollPos( wx.wxVERTICAL ) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
function meta.__index:setCurrentLine( line ) |
|
|
|
function meta.__index:setCurrentLine( line ) |
|
|
|
local editor = self.editor.editor |
|
|
|
local editor = self.editor.editor |
|
|
|
if self.currentLine == line then return end |
|
|
|
if self.currentLine == line then return end |
|
|
|