forgottenmapeditor icon indicating copy to clipboard operation
forgottenmapeditor copied to clipboard

New Map/File Manager

Open mindrage opened this issue 11 years ago • 10 comments

Working on some File Manager stuff.

First thing is a FileDialog API. Basically a function that works like this:

FileDialog.show(title, filter, action)

it returns false if its busy, returns nil if nothing is selected. Action is a function(path) which is defined if a path is selected.

filedialog1

And a map manager for loading/saving files to make room for some extra features, like a minimap preview and recent maps. Thinking of removing the map description/positions into separate window or something. mapmanager

mindrage avatar Dec 17 '13 08:12 mindrage

That looks awesome. If you need any help with core functionality, just let me know.

asamy avatar Dec 17 '13 14:12 asamy

Well, I did try alot of g_resources functions, but none of them seems to be able to give a list of directories and files so i had to do this iterator instead:

local function directory(path)
  local t = {}
  local i = 0;
  if g_app.getOs() == "linux" then
    for filename in io.popen('ls -a "'..directory..'"'):lines() do
      table.insert(t, filename)
    end
  elseif g_app.getOs() == "windows" then
    for filename in io.popen("dir " .. directory .. " /b /ad]]"):lines() do
      table.insert(t, filename)
    end
  end

  local n = #t
  return function()
      local list = t
      i = i + 1
      if i <= n then 
    return t[i]
      end
  end
end

But as it uses shell commands its really just very inaffective and simply wrong to use.., but i can access outside of the "listed" directories. Think you could help me solve this somehow?

mindrage avatar Dec 18 '13 09:12 mindrage

Looks like we have no option but use boost filesystem and this is what im going to do, no worries. You shall have this done by today or tomorrow.

asamy avatar Dec 25 '13 19:12 asamy

OtClient's commit https://github.com/edubart/otclient/commit/6745bff132544e4b66cf39da9ae1e8a3666d86bf implements this, read the commit message to learn how it works.

asamy avatar Dec 25 '13 19:12 asamy

Please let me know about your recent activities on this, i really need this in very soon and if you need ANY help, do not hesitate to ask me. If you are unable to continue you can pass the code to someone or just post it here and we'll see if someone continues it, maybe i will.

asamy avatar Dec 26 '13 01:12 asamy

Oh sorry, Im still working on it. I'll try to finish it tomorrow. took a break due to christmas/exams.

mindrage avatar Dec 27 '13 03:12 mindrage

Great to hear, thanks!

asamy avatar Dec 27 '13 03:12 asamy

Any progress on this?

If you're having trouble using the new function, here's an explanation:

local files = g_resources.getDirectoryFiles("C:/what");
...
local map = g_map.openMap("what/map.otbm") -- or just pass the full path

asamy avatar Jan 01 '14 06:01 asamy

Oh well, I tried a bit, then got tired because i had to look up things into source all the time. But im setting up an Eclipse IDE with Lua Profiler, Autocomplete and debugger to ease development in both my server projects and perhaps otclient aswell. V http://eclipse.org/downloads/download.php?file=/koneki/products/stable/ldt/1.1/org.eclipse.koneki.ldt.product-win32.win32.x86_64.zip&mirror_id=514

the autocomplete part is easy, you just write a file with empty function headers with parameters.

Also trying to integrate an XML template for TFS 1.0

OTUI might be a bit harder to implement, but i assume it can be coded with a Java Plugin. But ill do that later.

I wont be able to finish this in a while, But you can have the modules sofar, Aint that much to be honest other than OTUI and Startup/Shutdown scripts.

http://speedy.sh/PXyBv/mapeditor-modules.zip

I'll try to share the IDE later.

mindrage avatar Jan 08 '14 19:01 mindrage

Okay, thanks. Will have this finished by the end of jan got no time now.

asamy avatar Jan 09 '14 11:01 asamy