WIN32: get Unicode filename of Dropped files
This commit is contained in:
parent
322d95add8
commit
b706566f57
69
src/engine.c
69
src/engine.c
@ -697,41 +697,52 @@ void Main_handler(void)
|
|||||||
char* flimit;
|
char* flimit;
|
||||||
byte old_cursor_shape;
|
byte old_cursor_shape;
|
||||||
|
|
||||||
Upload_infos_page(&Main);
|
|
||||||
|
|
||||||
flimit = Find_last_separator(Drop_file_name);
|
flimit = Find_last_separator(Drop_file_name);
|
||||||
*(flimit++) = '\0';
|
if (flimit != NULL)
|
||||||
|
|
||||||
Hide_cursor();
|
|
||||||
old_cursor_shape=Cursor_shape;
|
|
||||||
Cursor_shape=CURSOR_SHAPE_HOURGLASS;
|
|
||||||
Display_cursor();
|
|
||||||
|
|
||||||
Init_context_layered_image(&context, flimit, Drop_file_name);
|
|
||||||
Load_image(&context);
|
|
||||||
if (File_error!=1)
|
|
||||||
{
|
{
|
||||||
Compute_limits();
|
*(flimit++) = '\0';
|
||||||
Compute_paintbrush_coordinates();
|
|
||||||
Redraw_layered_image();
|
Upload_infos_page(&Main);
|
||||||
End_of_modification();
|
|
||||||
Main.image_is_modified=0;
|
|
||||||
}
|
|
||||||
Destroy_context(&context);
|
|
||||||
|
|
||||||
Compute_optimal_menu_colors(Main.palette);
|
|
||||||
Check_menu_mode();
|
|
||||||
Display_menu();
|
|
||||||
if (Config.Display_image_limits)
|
|
||||||
Display_image_limits();
|
|
||||||
|
|
||||||
Hide_cursor();
|
Hide_cursor();
|
||||||
Cursor_shape=old_cursor_shape;
|
old_cursor_shape=Cursor_shape;
|
||||||
Display_all_screen();
|
Cursor_shape=CURSOR_SHAPE_HOURGLASS;
|
||||||
Display_cursor();
|
Display_cursor();
|
||||||
|
|
||||||
|
Init_context_layered_image(&context, flimit, Drop_file_name);
|
||||||
|
if (Drop_file_name_unicode != NULL)
|
||||||
|
{
|
||||||
|
context.File_name_unicode = Find_last_separator_unicode(Drop_file_name_unicode);
|
||||||
|
if (context.File_name_unicode != NULL)
|
||||||
|
context.File_name_unicode++;
|
||||||
|
}
|
||||||
|
Load_image(&context);
|
||||||
|
if (File_error!=1)
|
||||||
|
{
|
||||||
|
Compute_limits();
|
||||||
|
Compute_paintbrush_coordinates();
|
||||||
|
Redraw_layered_image();
|
||||||
|
End_of_modification();
|
||||||
|
Main.image_is_modified=0;
|
||||||
|
}
|
||||||
|
Destroy_context(&context);
|
||||||
|
|
||||||
|
Compute_optimal_menu_colors(Main.palette);
|
||||||
|
Check_menu_mode();
|
||||||
|
Display_menu();
|
||||||
|
if (Config.Display_image_limits)
|
||||||
|
Display_image_limits();
|
||||||
|
|
||||||
|
Hide_cursor();
|
||||||
|
Cursor_shape=old_cursor_shape;
|
||||||
|
Display_all_screen();
|
||||||
|
Display_cursor();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
free(Drop_file_name);
|
free(Drop_file_name);
|
||||||
Drop_file_name=NULL;
|
Drop_file_name=NULL;
|
||||||
|
free(Drop_file_name_unicode);
|
||||||
|
Drop_file_name_unicode=NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Get_input(0))
|
if(Get_input(0))
|
||||||
|
|||||||
@ -82,6 +82,7 @@ int Snap_axis_origin_X;
|
|||||||
int Snap_axis_origin_Y;
|
int Snap_axis_origin_Y;
|
||||||
|
|
||||||
char * Drop_file_name = NULL;
|
char * Drop_file_name = NULL;
|
||||||
|
word * Drop_file_name_unicode = NULL;
|
||||||
|
|
||||||
#if defined(USE_X11) || (defined(SDL_VIDEO_DRIVER_X11) && !defined(NO_X11))
|
#if defined(USE_X11) || (defined(SDL_VIDEO_DRIVER_X11) && !defined(NO_X11))
|
||||||
char * X11_clipboard = NULL;
|
char * X11_clipboard = NULL;
|
||||||
|
|||||||
@ -75,6 +75,7 @@ extern int Snap_axis_origin_Y;
|
|||||||
/// This malloced string is set when a drag-and-drop event
|
/// This malloced string is set when a drag-and-drop event
|
||||||
/// brings a file to Grafx2's window.
|
/// brings a file to Grafx2's window.
|
||||||
extern char * Drop_file_name;
|
extern char * Drop_file_name;
|
||||||
|
extern word * Drop_file_name_unicode;
|
||||||
|
|
||||||
#if defined __HAIKU__
|
#if defined __HAIKU__
|
||||||
#define SHORTCUT_COPY (KEY_c|MOD_ALT)
|
#define SHORTCUT_COPY (KEY_c|MOD_ALT)
|
||||||
|
|||||||
@ -1435,7 +1435,7 @@ int main(int argc,char * argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
GFX2_Log(GFX2_DEBUG, "built with _MSC_VER=%d\n", _MSC_VER);
|
GFX2_Log(GFX2_DEBUG, "built with _MSC_VER=%d Windows ANSI Code Page=%u\n", _MSC_VER, GetACP());
|
||||||
#endif
|
#endif
|
||||||
Main_handler();
|
Main_handler();
|
||||||
|
|
||||||
|
|||||||
@ -31,6 +31,7 @@
|
|||||||
#include "windows.h"
|
#include "windows.h"
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
#include "keyboard.h"
|
#include "keyboard.h"
|
||||||
|
#include "unicode.h"
|
||||||
|
|
||||||
extern int user_feedback_required;
|
extern int user_feedback_required;
|
||||||
extern word Input_new_mouse_X;
|
extern word Input_new_mouse_X;
|
||||||
@ -259,17 +260,20 @@ static LRESULT CALLBACK Win32_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LP
|
|||||||
{
|
{
|
||||||
TCHAR LongDropFileName[MAX_PATH];
|
TCHAR LongDropFileName[MAX_PATH];
|
||||||
TCHAR ShortDropFileName[MAX_PATH];
|
TCHAR ShortDropFileName[MAX_PATH];
|
||||||
if (DragQueryFile(hDrop, 0 , LongDropFileName ,(UINT) MAX_PATH)
|
if (DragQueryFile(hDrop, 0 , LongDropFileName ,(UINT) MAX_PATH))
|
||||||
&& GetShortPathName(LongDropFileName, ShortDropFileName, MAX_PATH))
|
|
||||||
{
|
{
|
||||||
Drop_file_name = (char *)malloc(lstrlen(ShortDropFileName) + 1);
|
Drop_file_name_unicode = Unicode_strdup((word *)LongDropFileName);
|
||||||
if (Drop_file_name != NULL)
|
if (GetShortPathName(LongDropFileName, ShortDropFileName, MAX_PATH))
|
||||||
{
|
{
|
||||||
int i;
|
Drop_file_name = (char *)malloc(lstrlen(ShortDropFileName) + 1);
|
||||||
|
if (Drop_file_name != NULL)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
for (i = 0; ShortDropFileName[i] != 0; i++)
|
for (i = 0; ShortDropFileName[i] != 0; i++)
|
||||||
Drop_file_name[i] = (char)ShortDropFileName[i];
|
Drop_file_name[i] = (char)ShortDropFileName[i];
|
||||||
Drop_file_name[i] = 0;
|
Drop_file_name[i] = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user