Drop file working in proper window
This commit is contained in:
@@ -450,10 +450,12 @@ Event TranslateSDLEvent(SDL_Event *input_event) {
|
||||
} break;
|
||||
|
||||
case SDL_EVENT_DROP_FILE: {
|
||||
event.kind = EVENT_DROP_FILE;
|
||||
SDL_DropEvent &b = input_event->drop;
|
||||
String string = b.data;
|
||||
event.text = Intern(&GlobalInternTable, string).data;
|
||||
event.kind = EVENT_DROP_FILE;
|
||||
SDL_DropEvent &b = input_event->drop;
|
||||
String string = b.data;
|
||||
event.text = Intern(&GlobalInternTable, string).data;
|
||||
event.xmouse = (int16_t)roundf(DPIScale * b.x);
|
||||
event.ymouse = (int16_t)roundf(DPIScale * b.y);
|
||||
} break;
|
||||
default: {
|
||||
};
|
||||
|
||||
@@ -1,3 +1,37 @@
|
||||
/*
|
||||
- [ ] Cleanups
|
||||
- [ ] Delta based scrolling!!
|
||||
- [ ] Enable framerate?
|
||||
- [x] When dragging a file into the editor, would be nice if the file opened in the window user dropped the file into. Not the active window.
|
||||
- [ ] When 2 views of same buffer are open, the view with caret below the caret which modifies the view - starts moving and getting messed up
|
||||
- [ ] Reduce number of created buffers to one per window, should be enough
|
||||
- [ ] GetWindowZOrder to IterateWindowsInZOrder
|
||||
- [ ] Rework history API, tagging modification blocks with carets?
|
||||
- [ ] The lexing / parsing code for config / bindings appears sloppy would be nice to clean it up but I don't have any ideas
|
||||
- [ ] Test BlockArena correctnsess - random allocations, writes and undos, try to crash
|
||||
|
||||
- [ ] New error mechanism
|
||||
- [ ] BeginLog EndLog, and then show all logs as a list in the UI thing
|
||||
- [ ] Undo kinds (to enable history in fuzzy buffers)
|
||||
- [ ] Add undo kind. Snapshot kind, so that history is possible in weird buffers without paying a huge memory cost. The idea is that we would store the exact buffer state to replace with, editor would just save history of first line etc.
|
||||
|
||||
- [ ] Macros
|
||||
- [ ] Regex
|
||||
- [ ] ctags based indexing
|
||||
- [ ] WordComplete
|
||||
- [ ] Rewrite WordComplete to use CoroutineCreate, maybe try reducing globals to just the coroutine itself
|
||||
- [ ] More bounded? seems like it might be problematic on a bigger project but so far it isn't (even for SDL or raddbg)
|
||||
- [ ] Shell / terminal buffer plugin (keep the shell alive and talk with it)
|
||||
- [ ] Directory Navigation
|
||||
- [ ] Remake lister when files change on disk
|
||||
- [ ] When saving apply all the modifications instead (like deleting files, renaming etc.) or maybe that's not even needed considering we are integrating shell commands
|
||||
- [ ] OpenCode
|
||||
- [ ] Hangs the editor on big files
|
||||
- [ ] Open
|
||||
- [ ] Way to bind "open" commands to keys from config
|
||||
- [ ] Ability to access and set clipboard as well as affect selection in the open scripts
|
||||
|
||||
*/
|
||||
#define PLUGIN_PROFILER 1
|
||||
|
||||
#include "plugin_profiler.h"
|
||||
@@ -283,7 +317,7 @@ void OnCommand(Event event) {
|
||||
}
|
||||
|
||||
// Set active window on click
|
||||
if (MousePress()) {
|
||||
if (MousePress() || event.kind == EVENT_DROP_FILE) {
|
||||
Vec2I mouse = MouseVec2I();
|
||||
For(order) {
|
||||
if (!it->visible) {
|
||||
@@ -292,6 +326,9 @@ void OnCommand(Event event) {
|
||||
bool mouse_in_document = AreOverlapping(mouse, it->document_rect);
|
||||
if (mouse_in_document) {
|
||||
NextActiveWindowID = ActiveWindowID = it->id;
|
||||
if (event.kind == EVENT_DROP_FILE) {
|
||||
WindowOpenBufferView(it, event.text);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -429,10 +466,6 @@ void OnCommand(Event event) {
|
||||
}
|
||||
}
|
||||
|
||||
if (event.kind == EVENT_DROP_FILE) {
|
||||
WindowOpenBufferView(active.window, event.text);
|
||||
}
|
||||
|
||||
if (event.kind == EVENT_TEXT_INPUT) {
|
||||
String16 string16 = ToString16(scratch, event.text);
|
||||
Replace(active.view, string16);
|
||||
|
||||
Reference in New Issue
Block a user