Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial setup for ImGuiFileDialog extension #89

Merged
merged 7 commits into from
Nov 16, 2021

Conversation

tlf30
Copy link
Contributor

@tlf30 tlf30 commented Nov 7, 2021

Hello @SpaiR,

I would like to add support for the extension ImGuiFileDialog: https://github.com/aiekick/ImGuiFileDialog
I have got an initial start on it, and wanted to make sure I was headed in the right direction before I got too far into it. It looks like this should be straightforward to add, but I am seeing this error during the build:

...
    [apply] 'C:\Users\tlfal_000\Desktop\imgui-java\imgui-binding\build\jni\ImGuiFileDialog.cpp'
    [apply] '-o'
    [apply] 'C:\Users\tlfal_000\Desktop\imgui-java\imgui-binding\build\tmp\windows64\ImGuiFileDialog.o'
    [apply] 
    [apply] The ' characters around the executable and arguments are
    [apply] not part of the command.
    [apply]    58 |   #include "dirent/dirent.h" // directly open the dirent file attached to this lib
    [apply]       |            ^~~~~~~~~~~~~~~~~
    [apply] compilation terminated.

BUILD FAILED
C:\Users\tlfal_000\Desktop\imgui-java\imgui-binding\build\jni\build-windows64.xml:115: apply returned: 1
	at org.apache.tools.ant.taskdefs.ExecTask.runExecute(ExecTask.java:675)
	at org.apache.tools.ant.taskdefs.ExecuteOn.runExec(ExecuteOn.java:410)
	at org.apache.tools.ant.taskdefs.ExecTask.execute(ExecTask.java:527)
	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:299)
	at jdk.internal.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:99)
	at org.apache.tools.ant.Task.perform(Task.java:350)
	at org.apache.tools.ant.Target.execute(Target.java:449)
	at org.apache.tools.ant.Target.performTasks(Target.java:470)
	at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1401)
	at org.apache.tools.ant.Project.executeTarget(Project.java:1374)
	at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
	at org.apache.tools.ant.Project.executeTargets(Project.java:1264)
	at org.apache.tools.ant.Main.runBuild(Main.java:818)
	at org.apache.tools.ant.Main.startAnt(Main.java:223)
	at org.apache.tools.ant.launch.Launcher.run(Launcher.java:284)
	at org.apache.tools.ant.launch.Launcher.main(Launcher.java:101)

Total time: 5 seconds
...

Anyways, I would love to know your thoughts.

Thanks,
Trevor

@SpaiR SpaiR added 3rd party feat New feature or request labels Nov 7, 2021
@SpaiR
Copy link
Owner

SpaiR commented Nov 7, 2021

Hi!
I appreciate your will for a contribution! 👍

I believe you're getting the error cause u don't have a flatten files structure. The "dirent" folder is a part of the subrepo, so its path is "ImGuiFileDialog/dirent/dirent.h". When the compiler expects "dirent/dirent.h". To fix it, you need to add a path to the folder in the GenerateLibs script (as you did for the module itself).

@tlf30
Copy link
Contributor Author

tlf30 commented Nov 8, 2021

Thanks for the tip @SpaiR, that got the include working. I am running into a linker error, not fully sure what the issue is, but I have not torn it apart yet.

I would like your thoughts on the PaneFun callback. I looked at the existing callbacks, and implemented something similar. But I then realized that I will have an issue with having multiple of the callbacks defined, which is a (highly likely) possibility. Perhaps you have an idea on implementing it that will be consistent with the rest of the code base. I can hack something together for it, but I am trying to keep my coding style consistent with yours.

The hashmap return on the getSelection() method was fun to implement. I need to do some more testing on it before I am truly happy with it (primarily the stack allocation to get more than 16 reference pointer slots on the stack, I have a feeling that I am over allocating it right now), but it was a good relaxing snippet to write while drinking a beer last night. 😄

I am pulling the documentation directly from the ImGuiFileDialog code, but I am correcting a couple spelling mistakes that I am finding. Some of the API is well documented, and those parts are the main functions in the API. For now I will implement those. There are other less documented functions, I am not 100% sure how those work at the moment, but they do not seem critical to how the library functions, mostly for just styling. I may decide to implement those at a later date and just stay focused on the core functionality if that is OK.

Anyways, I would like to know your thoughts and feedback.

Thanks,
Trevor

EDIT: Some of the jni callback code is not compiling. I will strip it out and commit a compiling version to show the linker error.

@tlf30
Copy link
Contributor Author

tlf30 commented Nov 15, 2021

I got the linker error fixed (copy and paste mistake on my part). I also added a demo to the example. It works great.

I still have not implemented the functions that use the pane callbacks. I am thinking about the approach I want to use for those.

image

@tlf30 tlf30 marked this pull request as ready for review November 16, 2021 01:00
@tlf30
Copy link
Contributor Author

tlf30 commented Nov 16, 2021

@SpaiR I think I have this ready to go, can you review it?

@SpaiR SpaiR merged commit 0bbbc2e into SpaiR:master Nov 16, 2021
@SpaiR
Copy link
Owner

SpaiR commented Nov 16, 2021

@tlf30 Very clean PR! Thank you for your contribution. I'll do a release with your additions in the near future for sure.

@tlf30
Copy link
Contributor Author

tlf30 commented Nov 16, 2021

@SpaiR the one thing I realize I forgot was to update the README.md to add it to the extensions list. Perhaps when you cut the next release you can add it, or I can open another PR for it.

@SpaiR
Copy link
Owner

SpaiR commented Nov 16, 2021

@tlf30 I would appreciate it if you would do that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants