Fix most of issue 462 : Inconsistent directories in file selectors for image and brush.

git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1926 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
Yves Rizoud 2012-03-09 01:18:23 +00:00
parent 9ca899355c
commit 747f9e8526
2 changed files with 14 additions and 30 deletions

View File

@ -3129,8 +3129,8 @@ void Load_picture(byte image)
else
{
strcpy(filename, Brush_filename);
strcpy(directory, Main_current_directory);
Init_context_brush(&context, Brush_filename, Main_current_directory);
strcpy(directory, Brush_file_directory);
Init_context_brush(&context, filename, directory);
}
confirm=Button_Load_or_Save(1, &context);
@ -3162,13 +3162,8 @@ void Load_picture(byte image)
if (!image)
{
if (File_error==3) // Memory allocation error when loading brush
{
// Nothing to do here.
// Previous versions of Grafx2 would have damaged the Brush,
// and need reset it here, but now the loading is done in separate
// memory buffers.
}
strcpy(Brush_filename, context.File_name);
strcpy(Brush_file_directory, context.File_directory);
Tiling_offset_X=0;
Tiling_offset_Y=0;
@ -3469,7 +3464,11 @@ void Save_picture(byte image)
strcpy(Main_backups->Pages->Filename, save_context.File_name);
strcpy(Main_backups->Pages->File_directory, save_context.File_directory);
}
if (!image)
{
strcpy(Brush_filename, save_context.File_name);
strcpy(Brush_file_directory, save_context.File_directory);
}
Hide_cursor();
Cursor_shape=old_cursor_shape;
Display_cursor();

View File

@ -1400,36 +1400,21 @@ byte Button_Load_or_Save(byte load, T_IO_Context *context)
Window_display_icon_sprite(bookmark_dropdown[temp]->Pos_X+3,bookmark_dropdown[temp]->Pos_Y+2,ICON_STAR);
Display_bookmark(bookmark_dropdown[temp],temp);
}
// On prend bien soin de passer dans le répertoire courant (le bon qui faut! Oui madame!)
if (load)
{
#if defined(__MINT__)
static char path[1024]={0};
chdir(Main_current_directory);
Dgetpath(path,0);
strcat(path,PATH_SEPARATOR);
strcpy(Main_current_directory,path);
#else
chdir(Main_current_directory);
getcwd(Main_current_directory,256);
#endif
}
else
#if defined(__MINT__)
{
#if defined(__MINT__)
static char path[1024]={0};
chdir(context->File_directory);
Dgetpath(path,0);
strcat(path,PATH_SEPARATOR);
strcpy(Main_current_directory,path);
#else
}
#else
{
chdir(context->File_directory);
getcwd(Main_current_directory,256);
#endif
}
#endif
// Affichage des premiers fichiers visibles:
Reload_list_of_files(Main_format,file_scroller);