|
|
@ -11,6 +11,8 @@ local ui = |
|
|
|
} |
|
|
|
} |
|
|
|
local lfs = require( "lfs" ) |
|
|
|
local lfs = require( "lfs" ) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
local wx = require( "wx" ) |
|
|
|
|
|
|
|
|
|
|
|
require( "coxpcall" ) |
|
|
|
require( "coxpcall" ) |
|
|
|
local coxpcall = coxpcall |
|
|
|
local coxpcall = coxpcall |
|
|
|
local copcall = copcall |
|
|
|
local copcall = copcall |
|
|
@ -37,6 +39,15 @@ local meta = { __index = {} } |
|
|
|
|
|
|
|
|
|
|
|
local complexValueManagerMeta = { __index = {} } |
|
|
|
local complexValueManagerMeta = { __index = {} } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
local function createClientConfig(name) |
|
|
|
|
|
|
|
return { |
|
|
|
|
|
|
|
name = name, |
|
|
|
|
|
|
|
mappings = {}, |
|
|
|
|
|
|
|
breakpoints = {}, |
|
|
|
|
|
|
|
scrollPositions = {}, |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
function new( engine, window ) |
|
|
|
function new( engine, window ) |
|
|
|
local res = |
|
|
|
local res = |
|
|
|
{ |
|
|
|
{ |
|
|
@ -133,6 +144,7 @@ function meta.__index:run_() |
|
|
|
self.window:registerEvent( "onBreakPointChanged", wrapCb( function( ... ) self:onBreakPointChanged_( ... ) end ) ) |
|
|
|
self.window:registerEvent( "onBreakPointChanged", wrapCb( function( ... ) self:onBreakPointChanged_( ... ) end ) ) |
|
|
|
self.window:registerEvent( "onFileOpen", wrapCb( function( ... ) self:onFileOpen_( ... ) end ) ) |
|
|
|
self.window:registerEvent( "onFileOpen", wrapCb( function( ... ) self:onFileOpen_( ... ) end ) ) |
|
|
|
self.window:registerEvent( "onFileClosed", wrapCb( function( ... ) self:onFileClosed_( ... ) end ) ) |
|
|
|
self.window:registerEvent( "onFileClosed", wrapCb( function( ... ) self:onFileClosed_( ... ) end ) ) |
|
|
|
|
|
|
|
self.window:registerEvent( "onScrollChanged", wrapCb(function( ... ) self:onScrollChanged_( ...) end ) ) |
|
|
|
|
|
|
|
|
|
|
|
self.window:registerEvent( "onApplicationExiting", wrapCb( function( ... ) self:onApplicationExiting_( ... ) end ) ) |
|
|
|
self.window:registerEvent( "onApplicationExiting", wrapCb( function( ... ) self:onApplicationExiting_( ... ) end ) ) |
|
|
|
|
|
|
|
|
|
|
@ -143,7 +155,7 @@ function meta.__index:run_() |
|
|
|
|
|
|
|
|
|
|
|
self.window.watch.evaluateCallback = wrapCb( function( expr ) return self:evaluateExpression_( expr ) end ) |
|
|
|
self.window.watch.evaluateCallback = wrapCb( function( expr ) return self:evaluateExpression_( expr ) end ) |
|
|
|
|
|
|
|
|
|
|
|
self.configs.global = { name = "global", breakpoints = {} } |
|
|
|
self.configs.global = createClientConfig('global') |
|
|
|
self:loadConfig_( "global" ) |
|
|
|
self:loadConfig_( "global" ) |
|
|
|
|
|
|
|
|
|
|
|
self:sleep_() |
|
|
|
self:sleep_() |
|
|
@ -200,6 +212,22 @@ function meta.__index:run_() |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function meta.__index:getActiveClientConfig_() |
|
|
|
|
|
|
|
local activeClientId = self.activeClient |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if activeClientId == nil then |
|
|
|
|
|
|
|
return self.configs.global |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
local clientData = self.clients[activeClientId] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if clientData == nil then |
|
|
|
|
|
|
|
return self.configs.global |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return clientData.config |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
function meta.__index:evaluateExpression_( expr ) |
|
|
|
function meta.__index:evaluateExpression_( expr ) |
|
|
|
local clientId = self.activeClient |
|
|
|
local clientId = self.activeClient |
|
|
|
local client = self.engine.getClient( clientId ) |
|
|
|
local client = self.engine.getClient( clientId ) |
|
|
@ -224,6 +252,7 @@ function meta.__index:refreshSourcePageFocus_( remoteSource, line ) |
|
|
|
local clientData = assert( self.clients[clientId] ) |
|
|
|
local clientData = assert( self.clients[clientId] ) |
|
|
|
local sourceType = string.sub( remoteSource, 1, 1 ) |
|
|
|
local sourceType = string.sub( remoteSource, 1, 1 ) |
|
|
|
if sourceType == "@" then |
|
|
|
if sourceType == "@" then |
|
|
|
|
|
|
|
self.window:raise() |
|
|
|
print( "Setting focus to "..remoteSource.."("..line..")" ) |
|
|
|
print( "Setting focus to "..remoteSource.."("..line..")" ) |
|
|
|
remoteSource = grldc.utilities.normalizePath( string.sub( remoteSource, 2 ) ) |
|
|
|
remoteSource = grldc.utilities.normalizePath( string.sub( remoteSource, 2 ) ) |
|
|
|
local source, remotePath, remoteFile = self:getLocalSource_( clientId, remoteSource ) |
|
|
|
local source, remotePath, remoteFile = self:getLocalSource_( clientId, remoteSource ) |
|
|
@ -396,6 +425,17 @@ function meta.__index:onApplicationExiting_() |
|
|
|
self.window.threads:setData( nil ) |
|
|
|
self.window.threads:setData( nil ) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function meta.__index:refreshScrollPosition_() |
|
|
|
|
|
|
|
local config = self:getActiveClientConfig_() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for source, sp in pairs( config.scrollPositions ) do |
|
|
|
|
|
|
|
local page = self.window:getSourcePage( source ) |
|
|
|
|
|
|
|
if page ~= nil then |
|
|
|
|
|
|
|
page:SetScrollPos(sp) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
function meta.__index:refreshBreakPoints_() |
|
|
|
function meta.__index:refreshBreakPoints_() |
|
|
|
local clientId = self.activeClient |
|
|
|
local clientId = self.activeClient |
|
|
|
local config = nil |
|
|
|
local config = nil |
|
|
@ -459,6 +499,7 @@ function meta.__index:onFileOpen_( path ) |
|
|
|
self:setSourceFocus_( source, 1 ) |
|
|
|
self:setSourceFocus_( source, 1 ) |
|
|
|
self:refreshPointers_() |
|
|
|
self:refreshPointers_() |
|
|
|
self:refreshBreakPoints_() |
|
|
|
self:refreshBreakPoints_() |
|
|
|
|
|
|
|
self:refreshScrollPosition_() |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
function meta.__index:onFileClosed_( source ) |
|
|
|
function meta.__index:onFileClosed_( source ) |
|
|
@ -467,6 +508,12 @@ function meta.__index:onFileClosed_( source ) |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function meta.__index:onScrollChanged_( source, position ) |
|
|
|
|
|
|
|
local clientConfig = self:getActiveClientConfig_() |
|
|
|
|
|
|
|
clientConfig.scrollPositions[source] = position |
|
|
|
|
|
|
|
clientConfig.dirty = true |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
function meta.__index:onThreadClicked_( clientId, threadId ) |
|
|
|
function meta.__index:onThreadClicked_( clientId, threadId ) |
|
|
|
print( "Thread clicked: client="..clientId..", thread="..threadId ) |
|
|
|
print( "Thread clicked: client="..clientId..", thread="..threadId ) |
|
|
|
local clientData = self.clients[clientId] |
|
|
|
local clientData = self.clients[clientId] |
|
|
@ -683,7 +730,7 @@ function meta.__index:onNewClient_( clientId ) |
|
|
|
local client = self.engine.getClient( clientId ) |
|
|
|
local client = self.engine.getClient( clientId ) |
|
|
|
local name = client:name() |
|
|
|
local name = client:name() |
|
|
|
if self.configs[name] == nil then |
|
|
|
if self.configs[name] == nil then |
|
|
|
self.configs[name] = { name = name, mappings = {}, breakpoints = {} } |
|
|
|
self.configs[name] = createClientConfig(name) |
|
|
|
self:loadConfig_( name ) |
|
|
|
self:loadConfig_( name ) |
|
|
|
end |
|
|
|
end |
|
|
|
self.clients[clientId] = { dirty = true, activeThread = "current", activeLevel = 1, config = self.configs[name] } |
|
|
|
self.clients[clientId] = { dirty = true, activeThread = "current", activeLevel = 1, config = self.configs[name] } |
|
|
@ -741,12 +788,19 @@ function meta.__index:saveConfig_( name ) |
|
|
|
openFiles[page.pageIdx+1] = source |
|
|
|
openFiles[page.pageIdx+1] = source |
|
|
|
end |
|
|
|
end |
|
|
|
local breakpoints = clientConfig.breakpoints |
|
|
|
local breakpoints = clientConfig.breakpoints |
|
|
|
|
|
|
|
local scrollPositions = clientConfig.scrollPositions |
|
|
|
|
|
|
|
|
|
|
|
local path = "clients/"..name.."/config.lua" |
|
|
|
local path = "clients/"..name.."/config.lua" |
|
|
|
lfs.mkdir( "clients" ) |
|
|
|
lfs.mkdir( "clients" ) |
|
|
|
lfs.mkdir( "clients/"..name ) |
|
|
|
lfs.mkdir( "clients/"..name ) |
|
|
|
local file = assert( io.open( path, "w" ) ) |
|
|
|
local file = assert( io.open( path, "w" ) ) |
|
|
|
file:write( grldc.net.serialize( { mappings = clientConfig.mappings, openFiles = openFiles, breakpoints = breakpoints, breakOnConnection = clientConfig.breakOnConnection } ) ) |
|
|
|
file:write( grldc.net.serialize( { |
|
|
|
|
|
|
|
mappings = clientConfig.mappings, |
|
|
|
|
|
|
|
openFiles = openFiles, |
|
|
|
|
|
|
|
breakpoints = breakpoints, |
|
|
|
|
|
|
|
scrollPositions = scrollPositions, |
|
|
|
|
|
|
|
breakOnConnection = clientConfig.breakOnConnection |
|
|
|
|
|
|
|
} ) ) |
|
|
|
file:close() |
|
|
|
file:close() |
|
|
|
print( "Saved config \""..name.."\"" ) |
|
|
|
print( "Saved config \""..name.."\"" ) |
|
|
|
clientConfig.lastConfigSave = os.time() |
|
|
|
clientConfig.lastConfigSave = os.time() |
|
|
@ -774,6 +828,12 @@ function meta.__index:loadConfig_( name ) |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if config.scrollPositions ~= nil then |
|
|
|
|
|
|
|
for source, sp in pairs( config.scrollPositions ) do |
|
|
|
|
|
|
|
clientConfig.scrollPositions[source] = sp |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
if clientConfig.breakOnConnection == nil then |
|
|
|
if clientConfig.breakOnConnection == nil then |
|
|
|
clientConfig.breakOnConnection = true |
|
|
|
clientConfig.breakOnConnection = true |
|
|
|