Fix issue 462: Save/Load path problems: Main, Spare and Brush now have completely distinct fileselector settings.
git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@2003 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
parent
5a2e556f18
commit
80fc7da7f6
@ -1148,10 +1148,12 @@ void Button_Settings(void)
|
||||
{
|
||||
// Reset fileselector offsets
|
||||
// since different files are shown now
|
||||
Main_fileselector_position=0;
|
||||
Main_fileselector_offset=0;
|
||||
Spare_fileselector_position=0;
|
||||
Spare_fileselector_offset=0;
|
||||
Main_selector.Position=0;
|
||||
Main_selector.Offset=0;
|
||||
Spare_selector.Position=0;
|
||||
Spare_selector.Offset=0;
|
||||
Brush_selector.Position=0;
|
||||
Brush_selector.Offset=0;
|
||||
}
|
||||
if(Config.Allow_multi_shortcuts && !selected_config.Allow_multi_shortcuts)
|
||||
{
|
||||
@ -1562,14 +1564,14 @@ void Button_Page(void)
|
||||
// Swap du booléen "Image modifiée"
|
||||
SWAP_BYTES (Main_image_is_modified,Spare_image_is_modified)
|
||||
|
||||
// Swap des infos sur les fileselects
|
||||
strcpy(Temp_buffer ,Spare_current_directory);
|
||||
strcpy(Spare_current_directory,Main_current_directory);
|
||||
strcpy(Main_current_directory,Temp_buffer );
|
||||
// Swap fileselector data
|
||||
SWAP_BYTES (Main_selector.Format_filter,Spare_selector.Format_filter)
|
||||
SWAP_WORDS (Main_selector.Position,Spare_selector.Position)
|
||||
SWAP_WORDS (Main_selector.Offset,Spare_selector.Offset)
|
||||
strcpy(Temp_buffer ,Spare_selector.Directory);
|
||||
strcpy(Spare_selector.Directory,Main_selector.Directory);
|
||||
strcpy(Main_selector.Directory,Temp_buffer );
|
||||
|
||||
SWAP_BYTES (Main_format,Spare_format)
|
||||
SWAP_WORDS (Main_fileselector_position,Spare_fileselector_position)
|
||||
SWAP_WORDS (Main_fileselector_offset,Spare_fileselector_offset)
|
||||
|
||||
SWAP_BYTES (Main_current_layer,Spare_current_layer)
|
||||
SWAP_DWORDS(Main_layers_visible,Spare_layers_visible)
|
||||
@ -3138,7 +3140,6 @@ void Load_picture(byte image)
|
||||
T_IO_Context context;
|
||||
static char filename [MAX_PATH_CHARACTERS];
|
||||
static char directory[MAX_PATH_CHARACTERS];
|
||||
byte saved_main_format;
|
||||
|
||||
if (image)
|
||||
{
|
||||
@ -3151,19 +3152,9 @@ void Load_picture(byte image)
|
||||
strcpy(filename, Brush_filename);
|
||||
strcpy(directory, Brush_file_directory);
|
||||
Init_context_brush(&context, filename, directory);
|
||||
// back up the fileselector's format filter
|
||||
saved_main_format=Main_format;
|
||||
Main_format=Brush_format;
|
||||
}
|
||||
confirm=Button_Load_or_Save(1, &context);
|
||||
confirm=Button_Load_or_Save(image?&Main_selector:&Brush_selector, 1, &context);
|
||||
|
||||
if (!image)
|
||||
{
|
||||
// restore the fileselector's format filter
|
||||
Brush_format=Main_format;
|
||||
Main_format=saved_main_format;
|
||||
}
|
||||
|
||||
if (confirm)
|
||||
{
|
||||
if (image)
|
||||
@ -3442,7 +3433,6 @@ void Save_picture(byte image)
|
||||
T_IO_Context save_context;
|
||||
static char filename [MAX_PATH_CHARACTERS];
|
||||
static char directory[MAX_PATH_CHARACTERS];
|
||||
byte saved_main_format;
|
||||
|
||||
if (image)
|
||||
{
|
||||
@ -3457,18 +3447,9 @@ void Save_picture(byte image)
|
||||
strcpy(directory, Brush_file_directory);
|
||||
Init_context_brush(&save_context, filename, directory);
|
||||
save_context.Format = Brush_fileformat;
|
||||
// back up the fileselector's format filter
|
||||
saved_main_format=Main_format;
|
||||
Main_format=Brush_fileformat;
|
||||
}
|
||||
|
||||
confirm=Button_Load_or_Save(0, &save_context);
|
||||
if (!image)
|
||||
{
|
||||
// restore the fileselector's format filter
|
||||
Brush_format=Main_format;
|
||||
Main_format=saved_main_format;
|
||||
}
|
||||
confirm=Button_Load_or_Save(image?&Main_selector:&Brush_selector,0, &save_context);
|
||||
|
||||
if (confirm && File_exists(save_context.File_name))
|
||||
{
|
||||
|
||||
217
src/filesel.c
217
src/filesel.c
@ -135,6 +135,9 @@ byte Native_filesel(byte load)
|
||||
|
||||
T_Fileselector Filelist;
|
||||
|
||||
/// Selector settings to use, for all functions called by Load_or_save
|
||||
T_Selector_settings * Selector;
|
||||
|
||||
/// Name of the current directory
|
||||
//static char Selector_directory[1024];
|
||||
/// Filename (without directory) of the highlighted file
|
||||
@ -1047,7 +1050,7 @@ void Display_bookmark(T_Dropdown_button * Button, int bookmark_number)
|
||||
|
||||
void Print_current_directory(void)
|
||||
//
|
||||
// Affiche Main_current_directory sur 37 caractères
|
||||
// Affiche Selector->Directory sur 37 caractères
|
||||
//
|
||||
{
|
||||
char temp_name[MAX_DISPLAYABLE_PATH+1]; // Nom tronqué
|
||||
@ -1056,13 +1059,13 @@ void Print_current_directory(void)
|
||||
|
||||
Window_rectangle(10,84,37*8,8,MC_Light);
|
||||
|
||||
length=strlen(Main_current_directory);
|
||||
length=strlen(Selector->Directory);
|
||||
if (length>MAX_DISPLAYABLE_PATH)
|
||||
{ // Doh! il va falloir tronquer le répertoire (bouh !)
|
||||
|
||||
// On commence par copier bêtement les 3 premiers caractères (e.g. "C:\")
|
||||
for (index=0;index<3;index++)
|
||||
temp_name[index]=Main_current_directory[index];
|
||||
temp_name[index]=Selector->Directory[index];
|
||||
|
||||
// On y rajoute 3 petits points:
|
||||
strcpy(temp_name+3,"...");
|
||||
@ -1070,12 +1073,12 @@ void Print_current_directory(void)
|
||||
// Ensuite, on cherche un endroit à partir duquel on pourrait loger tout
|
||||
// le reste de la chaine (Ouaaaaaah!!! Vachement fort le mec!!)
|
||||
for (index++;index<length;index++)
|
||||
if ( (Main_current_directory[index]==PATH_SEPARATOR[0]) &&
|
||||
if ( (Selector->Directory[index]==PATH_SEPARATOR[0]) &&
|
||||
(length-index<=MAX_DISPLAYABLE_PATH-6) )
|
||||
{
|
||||
// Ouf: on vient de trouver un endroit dans la chaîne à partir duquel
|
||||
// on peut faire la copie:
|
||||
strcpy(temp_name+6,Main_current_directory+index);
|
||||
strcpy(temp_name+6,Selector->Directory+index);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1083,7 +1086,7 @@ void Print_current_directory(void)
|
||||
Print_in_window(10,84,temp_name,MC_Black,MC_Light);
|
||||
}
|
||||
else // Ahhh! La chaîne peut loger tranquillement dans la fenêtre
|
||||
Print_in_window(10,84,Main_current_directory,MC_Black,MC_Light);
|
||||
Print_in_window(10,84,Selector->Directory,MC_Black,MC_Light);
|
||||
|
||||
Update_window_area(10,84,37*8,8);
|
||||
}
|
||||
@ -1132,28 +1135,28 @@ void Reload_list_of_files(byte filter, T_Scroller_button * button)
|
||||
// the directory content may have changed.
|
||||
//
|
||||
// Make the offset absolute
|
||||
Main_fileselector_offset += Main_fileselector_position;
|
||||
Selector->Offset += Selector->Position;
|
||||
// Ensure it's within limits
|
||||
if (Main_fileselector_offset >= Filelist.Nb_elements)
|
||||
if (Selector->Offset >= Filelist.Nb_elements)
|
||||
{
|
||||
Main_fileselector_offset = Filelist.Nb_elements-1;
|
||||
Selector->Offset = Filelist.Nb_elements-1;
|
||||
}
|
||||
// Ensure the position doesn't show "too many files"
|
||||
if (Main_fileselector_position!=0 && Main_fileselector_position>(Filelist.Nb_elements-10))
|
||||
if (Selector->Position!=0 && Selector->Position>(Filelist.Nb_elements-10))
|
||||
{
|
||||
if (Filelist.Nb_elements<10)
|
||||
{
|
||||
Main_fileselector_position=0;
|
||||
Selector->Position=0;
|
||||
}
|
||||
else
|
||||
{
|
||||
Main_fileselector_position=Filelist.Nb_elements-10;
|
||||
Selector->Position=Filelist.Nb_elements-10;
|
||||
}
|
||||
}
|
||||
// Restore the offset as relative to the position.
|
||||
Main_fileselector_offset -= Main_fileselector_position;
|
||||
Selector->Offset -= Selector->Position;
|
||||
|
||||
Prepare_and_display_filelist(Main_fileselector_position,Main_fileselector_offset,button);
|
||||
Prepare_and_display_filelist(Selector->Position,Selector->Offset,button);
|
||||
}
|
||||
|
||||
void Scroll_fileselector(T_Scroller_button * file_scroller)
|
||||
@ -1163,14 +1166,14 @@ void Scroll_fileselector(T_Scroller_button * file_scroller)
|
||||
strcpy(old_filename,Selector_filename);
|
||||
|
||||
// On regarde si la liste a bougé
|
||||
if (file_scroller->Position!=Main_fileselector_position)
|
||||
if (file_scroller->Position!=Selector->Position)
|
||||
{
|
||||
// Si c'est le cas, il faut mettre à jour la jauge
|
||||
file_scroller->Position=Main_fileselector_position;
|
||||
file_scroller->Position=Selector->Position;
|
||||
Window_draw_slider(file_scroller);
|
||||
}
|
||||
// On récupére le nom du schmilblick à "accéder"
|
||||
Get_selected_item(&Filelist, Main_fileselector_position,Main_fileselector_offset,Selector_filename,&Selected_type);
|
||||
Get_selected_item(&Filelist, Selector->Position,Selector->Offset,Selector_filename,&Selected_type);
|
||||
if (strcmp(old_filename,Selector_filename))
|
||||
New_preview_is_needed=1;
|
||||
|
||||
@ -1205,20 +1208,20 @@ void Highlight_file(short index)
|
||||
|
||||
if ((Filelist.Nb_elements<=10) || (index<5))
|
||||
{
|
||||
Main_fileselector_position=0;
|
||||
Main_fileselector_offset=index;
|
||||
Selector->Position=0;
|
||||
Selector->Offset=index;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (index>=Filelist.Nb_elements-5)
|
||||
{
|
||||
Main_fileselector_position=Filelist.Nb_elements-10;
|
||||
Main_fileselector_offset=index-Main_fileselector_position;
|
||||
Selector->Position=Filelist.Nb_elements-10;
|
||||
Selector->Offset=index-Selector->Position;
|
||||
}
|
||||
else
|
||||
{
|
||||
Main_fileselector_position=index-4;
|
||||
Main_fileselector_offset=4;
|
||||
Selector->Position=index-4;
|
||||
Selector->Offset=4;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1337,7 +1340,7 @@ int Quicksearch_list(T_List_button * list, T_Fileselector * selector)
|
||||
return 0;
|
||||
}
|
||||
|
||||
byte Button_Load_or_Save(byte load, T_IO_Context *context)
|
||||
byte Button_Load_or_Save(T_Selector_settings *settings, byte load, T_IO_Context *context)
|
||||
// load=1 => On affiche le menu du bouton LOAD
|
||||
// load=0 => On affiche le menu du bouton SAVE
|
||||
{
|
||||
@ -1357,6 +1360,8 @@ byte Button_Load_or_Save(byte load, T_IO_Context *context)
|
||||
char initial_comment[COMMENT_SIZE+1];
|
||||
short window_shortcut;
|
||||
|
||||
Selector=settings;
|
||||
|
||||
Reset_quicksearch();
|
||||
|
||||
//if (Native_filesel(load) != 0); // TODO : handle this
|
||||
@ -1385,21 +1390,21 @@ byte Button_Load_or_Save(byte load, T_IO_Context *context)
|
||||
else
|
||||
Open_window(310,200,"Save brush");
|
||||
Window_set_normal_button(198,180,51,14,"Save",0,1,SDLK_RETURN); // 1
|
||||
if (Main_format<=FORMAT_ALL_FILES) // Correction du *.*
|
||||
if (Selector->Format_filter<=FORMAT_ALL_FILES) // Correction du *.*
|
||||
{
|
||||
Main_format=Main_fileformat;
|
||||
Main_fileselector_position=0;
|
||||
Main_fileselector_offset=0;
|
||||
Selector->Format_filter=Main_fileformat;
|
||||
Selector->Position=0;
|
||||
Selector->Offset=0;
|
||||
}
|
||||
|
||||
if (Get_fileformat(Main_format)->Save == NULL) // Correction d'un format insauvable
|
||||
if (Get_fileformat(Selector->Format_filter)->Save == NULL) // Correction d'un format insauvable
|
||||
{
|
||||
Main_format=DEFAULT_FILEFORMAT;
|
||||
Main_fileselector_position=0;
|
||||
Main_fileselector_offset=0;
|
||||
Selector->Format_filter=DEFAULT_FILEFORMAT;
|
||||
Selector->Position=0;
|
||||
Selector->Offset=0;
|
||||
}
|
||||
// Affichage du commentaire
|
||||
if (Get_fileformat(Main_format)->Comment)
|
||||
if (Get_fileformat(Selector->Format_filter)->Comment)
|
||||
Print_in_window(45,70,context->Comment,MC_Black,MC_Light);
|
||||
}
|
||||
|
||||
@ -1422,7 +1427,7 @@ byte Button_Load_or_Save(byte load, T_IO_Context *context)
|
||||
// Dropdown pour les formats de fichier
|
||||
formats_dropdown=
|
||||
Window_set_dropdown_button(68,28,52,11,0,
|
||||
Get_fileformat(Main_format)->Label,
|
||||
Get_fileformat(Selector->Format_filter)->Label,
|
||||
1,0,1,RIGHT_SIDE|LEFT_SIDE,0); // 6
|
||||
|
||||
for (format=0; format < Nb_known_formats(); format++)
|
||||
@ -1466,17 +1471,17 @@ byte Button_Load_or_Save(byte load, T_IO_Context *context)
|
||||
chdir(context->File_directory);
|
||||
Dgetpath(path,0);
|
||||
strcat(path,PATH_SEPARATOR);
|
||||
strcpy(Main_current_directory,path);
|
||||
strcpy(Selector->Directory,path);
|
||||
}
|
||||
#else
|
||||
{
|
||||
chdir(context->File_directory);
|
||||
getcwd(Main_current_directory,256);
|
||||
getcwd(Selector->Directory,256);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Affichage des premiers fichiers visibles:
|
||||
Reload_list_of_files(Main_format,file_scroller);
|
||||
Reload_list_of_files(Selector->Format_filter,file_scroller);
|
||||
|
||||
if (!load)
|
||||
{
|
||||
@ -1487,7 +1492,7 @@ byte Button_Load_or_Save(byte load, T_IO_Context *context)
|
||||
Print_filename_in_fileselector();
|
||||
|
||||
Highlight_file(Find_file_in_fileselector(&Filelist, context->File_name));
|
||||
Prepare_and_display_filelist(Main_fileselector_position,Main_fileselector_offset,file_scroller);
|
||||
Prepare_and_display_filelist(Selector->Position,Selector->Offset,file_scroller);
|
||||
}
|
||||
|
||||
New_preview_is_needed=1;
|
||||
@ -1536,7 +1541,7 @@ byte Button_Load_or_Save(byte load, T_IO_Context *context)
|
||||
char * message;
|
||||
Hide_cursor();
|
||||
// On affiche une demande de confirmation
|
||||
if (Main_fileselector_position+Main_fileselector_offset>=Filelist.Nb_directories)
|
||||
if (Selector->Position+Selector->Offset>=Filelist.Nb_directories)
|
||||
{
|
||||
message="Delete file ?";
|
||||
}
|
||||
@ -1547,7 +1552,7 @@ byte Button_Load_or_Save(byte load, T_IO_Context *context)
|
||||
if (Confirmation_box(message))
|
||||
{
|
||||
// Si c'est un fichier
|
||||
if (Main_fileselector_position+Main_fileselector_offset>=Filelist.Nb_directories)
|
||||
if (Selector->Position+Selector->Offset>=Filelist.Nb_directories)
|
||||
// On efface le fichier (si on peut)
|
||||
temp=(!remove(Selector_filename));
|
||||
else // Si c'est un repertoire
|
||||
@ -1557,38 +1562,30 @@ byte Button_Load_or_Save(byte load, T_IO_Context *context)
|
||||
if (temp) // temp indique si l'effacement s'est bien passé
|
||||
{
|
||||
// On remonte si c'était le dernier élément de la liste
|
||||
if (Main_fileselector_position+Main_fileselector_offset==Filelist.Nb_elements-1)
|
||||
if (Selector->Position+Selector->Offset==Filelist.Nb_elements-1)
|
||||
{
|
||||
if (Main_fileselector_position)
|
||||
Main_fileselector_position--;
|
||||
if (Selector->Position)
|
||||
Selector->Position--;
|
||||
else
|
||||
if (Main_fileselector_offset)
|
||||
Main_fileselector_offset--;
|
||||
if (Selector->Offset)
|
||||
Selector->Offset--;
|
||||
}
|
||||
else // Si ce n'était pas le dernier, il faut faire gaffe à ce
|
||||
{ // que ses copains d'en dessous ne remontent pas trop.
|
||||
if ( (Main_fileselector_position)
|
||||
&& (Main_fileselector_position+10==Filelist.Nb_elements) )
|
||||
if ( (Selector->Position)
|
||||
&& (Selector->Position+10==Filelist.Nb_elements) )
|
||||
{
|
||||
Main_fileselector_position--;
|
||||
Main_fileselector_offset++;
|
||||
Selector->Position--;
|
||||
Selector->Offset++;
|
||||
}
|
||||
}
|
||||
// On relit les informations
|
||||
Reload_list_of_files(Main_format,file_scroller);
|
||||
Reload_list_of_files(Selector->Format_filter,file_scroller);
|
||||
// On demande la preview du nouveau fichier sur lequel on se trouve
|
||||
New_preview_is_needed=1;
|
||||
}
|
||||
else
|
||||
Error(0);
|
||||
|
||||
// On place la barre de sélection du brouillon au début s'il a le
|
||||
// même répertoire que l'image principale.
|
||||
if (!strcmp(Main_current_directory,Spare_current_directory))
|
||||
{
|
||||
Spare_fileselector_position=0;
|
||||
Spare_fileselector_offset=0;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -1599,17 +1596,17 @@ byte Button_Load_or_Save(byte load, T_IO_Context *context)
|
||||
temp=Compute_click_offset_in_fileselector();
|
||||
if (temp>=0)
|
||||
{
|
||||
if (temp!=Main_fileselector_offset)
|
||||
if (temp!=Selector->Offset)
|
||||
{
|
||||
// On met à jour le décalage
|
||||
Main_fileselector_offset=temp;
|
||||
Selector->Offset=temp;
|
||||
|
||||
// On récupére le nom du schmilblick à "accéder"
|
||||
Get_selected_item(&Filelist, Main_fileselector_position,Main_fileselector_offset,Selector_filename,&Selected_type);
|
||||
Get_selected_item(&Filelist, Selector->Position,Selector->Offset,Selector_filename,&Selected_type);
|
||||
// On affiche le nouveau nom de fichier
|
||||
Print_filename_in_fileselector();
|
||||
// On affiche à nouveau la liste
|
||||
Display_file_list(&Filelist, Main_fileselector_position,Main_fileselector_offset);
|
||||
Display_file_list(&Filelist, Selector->Position,Selector->Offset);
|
||||
|
||||
// On vient de changer de nom de fichier, donc on doit s'appreter
|
||||
// a rafficher une preview
|
||||
@ -1623,8 +1620,8 @@ byte Button_Load_or_Save(byte load, T_IO_Context *context)
|
||||
// faut mettre le nom de fichier au nom du répertoire. Sinon, dans
|
||||
// certains cas, on risque de sauvegarder avec le nom du fichier
|
||||
// actuel au lieu de changer de répertoire.
|
||||
if (Main_fileselector_position+Main_fileselector_offset<Filelist.Nb_directories)
|
||||
Get_selected_item(&Filelist, Main_fileselector_position,Main_fileselector_offset,Selector_filename,&Selected_type);
|
||||
if (Selector->Position+Selector->Offset<Filelist.Nb_directories)
|
||||
Get_selected_item(&Filelist, Selector->Position,Selector->Offset,Selector_filename,&Selected_type);
|
||||
|
||||
has_clicked_ok=1;
|
||||
New_preview_is_needed=1;
|
||||
@ -1637,13 +1634,13 @@ byte Button_Load_or_Save(byte load, T_IO_Context *context)
|
||||
|
||||
case 5 : // Scroller de fichiers
|
||||
Hide_cursor();
|
||||
Main_fileselector_position=Window_attribute2;
|
||||
Selector->Position=Window_attribute2;
|
||||
// On récupére le nom du schmilblick à "accéder"
|
||||
Get_selected_item(&Filelist, Main_fileselector_position,Main_fileselector_offset,Selector_filename,&Selected_type);
|
||||
Get_selected_item(&Filelist, Selector->Position,Selector->Offset,Selector_filename,&Selected_type);
|
||||
// On affiche le nouveau nom de fichier
|
||||
Print_filename_in_fileselector();
|
||||
// On affiche à nouveau la liste
|
||||
Display_file_list(&Filelist, Main_fileselector_position,Main_fileselector_offset);
|
||||
Display_file_list(&Filelist, Selector->Position,Selector->Offset);
|
||||
Display_cursor();
|
||||
New_preview_is_needed=1;
|
||||
Reset_quicksearch();
|
||||
@ -1651,35 +1648,35 @@ byte Button_Load_or_Save(byte load, T_IO_Context *context)
|
||||
|
||||
case 6 : // File Format dropdown
|
||||
// Refresh fileselector according to new filter
|
||||
if (Main_format != Window_attribute2)
|
||||
if (Selector->Format_filter != Window_attribute2)
|
||||
{
|
||||
int pos_last_dot;
|
||||
char* savename = NULL;
|
||||
|
||||
Main_format = Window_attribute2;
|
||||
Selector->Format_filter = Window_attribute2;
|
||||
if (Filelist.Nb_elements>0)
|
||||
{
|
||||
T_Fileselector_item * current_item;
|
||||
current_item = Get_item_by_index(&Filelist, Main_fileselector_position + Main_fileselector_offset);
|
||||
current_item = Get_item_by_index(&Filelist, Selector->Position + Selector->Offset);
|
||||
// In "save" box, if current name is a (possible) filename
|
||||
// with extension, set it to new format's extension
|
||||
if (!load &&
|
||||
current_item->Type == 0 &&
|
||||
Get_fileformat(Main_format)->Default_extension[0] != '\0' &&
|
||||
Get_fileformat(Selector->Format_filter)->Default_extension[0] != '\0' &&
|
||||
(pos_last_dot=Position_last_dot(Selector_filename))!=-1 &&
|
||||
Selector_filename[pos_last_dot+1]!='\0')
|
||||
{
|
||||
strcpy(Selector_filename + pos_last_dot + 1,
|
||||
Get_fileformat(Main_format)->Default_extension);
|
||||
Get_fileformat(Selector->Format_filter)->Default_extension);
|
||||
}
|
||||
}
|
||||
savename = (char *)strdup(Selector_filename);
|
||||
// By default, position list at the beginning
|
||||
Main_fileselector_position = 0;
|
||||
Main_fileselector_offset = 0;
|
||||
Selector->Position = 0;
|
||||
Selector->Offset = 0;
|
||||
// Print the first visible files
|
||||
Hide_cursor();
|
||||
Reload_list_of_files(Main_format, file_scroller);
|
||||
Reload_list_of_files(Selector->Format_filter, file_scroller);
|
||||
New_preview_is_needed = 1;
|
||||
Reset_quicksearch();
|
||||
if (savename != NULL)
|
||||
@ -1689,7 +1686,7 @@ byte Button_Load_or_Save(byte load, T_IO_Context *context)
|
||||
if (pos!=0)
|
||||
{
|
||||
Highlight_file(pos);
|
||||
Prepare_and_display_filelist(Main_fileselector_position,Main_fileselector_offset,file_scroller);
|
||||
Prepare_and_display_filelist(Selector->Position,Selector->Offset,file_scroller);
|
||||
}
|
||||
// If the file is (still present) or it's a name with new
|
||||
// extension, set it as the proposed file name.
|
||||
@ -1702,7 +1699,7 @@ byte Button_Load_or_Save(byte load, T_IO_Context *context)
|
||||
}
|
||||
break;
|
||||
case 7 : // Saisie d'un commentaire pour la sauvegarde
|
||||
if ( (!load) && (Get_fileformat(Main_format)->Comment) )
|
||||
if ( (!load) && (Get_fileformat(Selector->Format_filter)->Comment) )
|
||||
{
|
||||
Readline(45, 70, context->Comment, 32, INPUT_TYPE_STRING);
|
||||
Display_cursor();
|
||||
@ -1717,7 +1714,7 @@ byte Button_Load_or_Save(byte load, T_IO_Context *context)
|
||||
if (Filelist.Nb_elements>0)
|
||||
{
|
||||
T_Fileselector_item * current_item;
|
||||
current_item = Get_item_by_index(&Filelist, Main_fileselector_position + Main_fileselector_offset);
|
||||
current_item = Get_item_by_index(&Filelist, Selector->Position + Selector->Offset);
|
||||
if (current_item->Type != 0 && !FILENAME_COMPARE(current_item->Full_name,Selector_filename))
|
||||
// current name is a highlighted directory
|
||||
Selector_filename[0]='\0';
|
||||
@ -1731,12 +1728,12 @@ byte Button_Load_or_Save(byte load, T_IO_Context *context)
|
||||
dummy=1;
|
||||
if (!dummy)
|
||||
{
|
||||
if (Get_fileformat(Main_format)->Default_extension)
|
||||
if (Get_fileformat(Selector->Format_filter)->Default_extension)
|
||||
{
|
||||
if(!Directory_exists(Selector_filename))
|
||||
{
|
||||
strcat(Selector_filename, ".");
|
||||
strcat(Selector_filename, Get_fileformat(Main_format)->Default_extension);
|
||||
strcat(Selector_filename, Get_fileformat(Selector->Format_filter)->Default_extension);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -1784,12 +1781,12 @@ byte Button_Load_or_Save(byte load, T_IO_Context *context)
|
||||
Hide_cursor();
|
||||
// Comme on tombe sur un disque qu'on connait pas, on se place en
|
||||
// début de liste:
|
||||
Main_fileselector_position=0;
|
||||
Main_fileselector_offset=0;
|
||||
Selector->Position=0;
|
||||
Selector->Offset=0;
|
||||
// Affichage des premiers fichiers visibles:
|
||||
Read_list_of_drives(&Filelist,19);
|
||||
Sort_list_of_files(&Filelist);
|
||||
Prepare_and_display_filelist(Main_fileselector_position,Main_fileselector_offset,file_scroller);
|
||||
Prepare_and_display_filelist(Selector->Position,Selector->Offset,file_scroller);
|
||||
Display_cursor();
|
||||
New_preview_is_needed=1;
|
||||
Reset_quicksearch();
|
||||
@ -1816,15 +1813,15 @@ byte Button_Load_or_Save(byte load, T_IO_Context *context)
|
||||
free(Config.Bookmark_directory[clicked_button-10]);
|
||||
Config.Bookmark_directory[clicked_button-10] = NULL;
|
||||
Config.Bookmark_label[clicked_button-10][0]='\0';
|
||||
temp=strlen(Main_current_directory);
|
||||
temp=strlen(Selector->Directory);
|
||||
Config.Bookmark_directory[clicked_button-10]=malloc(temp+1);
|
||||
strcpy(Config.Bookmark_directory[clicked_button-10],Main_current_directory);
|
||||
strcpy(Config.Bookmark_directory[clicked_button-10],Selector->Directory);
|
||||
|
||||
directory_name=Find_last_separator(Main_current_directory);
|
||||
directory_name=Find_last_separator(Selector->Directory);
|
||||
if (directory_name && directory_name[1]!='\0')
|
||||
directory_name++;
|
||||
else
|
||||
directory_name=Main_current_directory;
|
||||
directory_name=Selector->Directory;
|
||||
temp=strlen(directory_name);
|
||||
strncpy(Config.Bookmark_label[clicked_button-10],directory_name,8);
|
||||
if (temp>8)
|
||||
@ -1870,56 +1867,56 @@ byte Button_Load_or_Save(byte load, T_IO_Context *context)
|
||||
case SDLK_DOWN : // Bas
|
||||
Reset_quicksearch();
|
||||
Hide_cursor();
|
||||
Selector_scroll_down(&Main_fileselector_position,&Main_fileselector_offset);
|
||||
Selector_scroll_down(&Selector->Position,&Selector->Offset);
|
||||
Scroll_fileselector(file_scroller);
|
||||
Key=0;
|
||||
break;
|
||||
case SDLK_UP : // Haut
|
||||
Reset_quicksearch();
|
||||
Hide_cursor();
|
||||
Selector_scroll_up(&Main_fileselector_position,&Main_fileselector_offset);
|
||||
Selector_scroll_up(&Selector->Position,&Selector->Offset);
|
||||
Scroll_fileselector(file_scroller);
|
||||
Key=0;
|
||||
break;
|
||||
case SDLK_PAGEDOWN : // PageDown
|
||||
Reset_quicksearch();
|
||||
Hide_cursor();
|
||||
Selector_page_down(&Main_fileselector_position,&Main_fileselector_offset,9);
|
||||
Selector_page_down(&Selector->Position,&Selector->Offset,9);
|
||||
Scroll_fileselector(file_scroller);
|
||||
Key=0;
|
||||
break;
|
||||
case SDLK_PAGEUP : // PageUp
|
||||
Reset_quicksearch();
|
||||
Hide_cursor();
|
||||
Selector_page_up(&Main_fileselector_position,&Main_fileselector_offset,9);
|
||||
Selector_page_up(&Selector->Position,&Selector->Offset,9);
|
||||
Scroll_fileselector(file_scroller);
|
||||
Key=0;
|
||||
break;
|
||||
case SDLK_END : // End
|
||||
Reset_quicksearch();
|
||||
Hide_cursor();
|
||||
Selector_end(&Main_fileselector_position,&Main_fileselector_offset);
|
||||
Selector_end(&Selector->Position,&Selector->Offset);
|
||||
Scroll_fileselector(file_scroller);
|
||||
Key=0;
|
||||
break;
|
||||
case SDLK_HOME : // Home
|
||||
Reset_quicksearch();
|
||||
Hide_cursor();
|
||||
Selector_home(&Main_fileselector_position,&Main_fileselector_offset);
|
||||
Selector_home(&Selector->Position,&Selector->Offset);
|
||||
Scroll_fileselector(file_scroller);
|
||||
Key=0;
|
||||
break;
|
||||
case KEY_MOUSEWHEELDOWN :
|
||||
Reset_quicksearch();
|
||||
Hide_cursor();
|
||||
Selector_page_down(&Main_fileselector_position,&Main_fileselector_offset,3);
|
||||
Selector_page_down(&Selector->Position,&Selector->Offset,3);
|
||||
Scroll_fileselector(file_scroller);
|
||||
Key=0;
|
||||
break;
|
||||
case KEY_MOUSEWHEELUP :
|
||||
Reset_quicksearch();
|
||||
Hide_cursor();
|
||||
Selector_page_up(&Main_fileselector_position,&Main_fileselector_offset,3);
|
||||
Selector_page_up(&Selector->Position,&Selector->Offset,3);
|
||||
Scroll_fileselector(file_scroller);
|
||||
Key=0;
|
||||
break;
|
||||
@ -1954,12 +1951,12 @@ byte Button_Load_or_Save(byte load, T_IO_Context *context)
|
||||
selected_item=Quicksearch(&Filelist);
|
||||
if (selected_item>=0)
|
||||
{
|
||||
temp=Main_fileselector_position+Main_fileselector_offset;
|
||||
temp=Selector->Position+Selector->Offset;
|
||||
Hide_cursor();
|
||||
Highlight_file(selected_item);
|
||||
Prepare_and_display_filelist(Main_fileselector_position,Main_fileselector_offset,file_scroller);
|
||||
Prepare_and_display_filelist(Selector->Position,Selector->Offset,file_scroller);
|
||||
Display_cursor();
|
||||
if (temp!=Main_fileselector_position+Main_fileselector_offset)
|
||||
if (temp!=Selector->Position+Selector->Offset)
|
||||
New_preview_is_needed=1;
|
||||
}
|
||||
// Key=0; ?
|
||||
@ -1984,7 +1981,7 @@ byte Button_Load_or_Save(byte load, T_IO_Context *context)
|
||||
}
|
||||
else
|
||||
{
|
||||
Extract_filename(previous_directory, Main_current_directory);
|
||||
Extract_filename(previous_directory, Selector->Directory);
|
||||
}
|
||||
|
||||
// On doit rentrer dans le répertoire:
|
||||
@ -1995,12 +1992,12 @@ byte Button_Load_or_Save(byte load, T_IO_Context *context)
|
||||
char currentDrive='A';
|
||||
currentDrive=currentDrive+Dgetdrv();
|
||||
Dgetpath(path,0);
|
||||
sprintf(Main_current_directory,"%c:\%s",currentDrive,path);
|
||||
sprintf(Selector->Directory,"%c:\%s",currentDrive,path);
|
||||
#else
|
||||
getcwd(Main_current_directory,256);
|
||||
getcwd(Selector->Directory,256);
|
||||
#endif
|
||||
// On lit le nouveau répertoire
|
||||
Read_list_of_files(&Filelist, Main_format);
|
||||
Read_list_of_files(&Filelist, Selector->Format_filter);
|
||||
Sort_list_of_files(&Filelist);
|
||||
// On place la barre de sélection sur le répertoire d'où l'on vient
|
||||
Highlight_file(Find_file_in_fileselector(&Filelist, previous_directory));
|
||||
@ -2008,7 +2005,7 @@ byte Button_Load_or_Save(byte load, T_IO_Context *context)
|
||||
else
|
||||
Error(0);
|
||||
// Affichage des premiers fichiers visibles:
|
||||
Prepare_and_display_filelist(Main_fileselector_position,Main_fileselector_offset,file_scroller);
|
||||
Prepare_and_display_filelist(Selector->Position,Selector->Offset,file_scroller);
|
||||
Display_cursor();
|
||||
New_preview_is_needed=1;
|
||||
|
||||
@ -2017,8 +2014,8 @@ byte Button_Load_or_Save(byte load, T_IO_Context *context)
|
||||
}
|
||||
else // Sinon on essaye de charger ou sauver le fichier
|
||||
{
|
||||
strcpy(context->File_directory,Main_current_directory);
|
||||
context->Format = Main_format;
|
||||
strcpy(context->File_directory,Selector->Directory);
|
||||
context->Format = Selector->Format_filter;
|
||||
save_or_load_image=1;
|
||||
}
|
||||
}
|
||||
@ -2042,7 +2039,7 @@ byte Button_Load_or_Save(byte load, T_IO_Context *context)
|
||||
// On efface le format du fichier
|
||||
Window_rectangle(59,59,5*8,8,MC_Light);
|
||||
// Affichage du commentaire
|
||||
if ( (!load) && (Get_fileformat(Main_format)->Comment) )
|
||||
if ( (!load) && (Get_fileformat(Selector->Format_filter)->Comment) )
|
||||
{
|
||||
Print_in_window(45,70,context->Comment,MC_Black,MC_Light);
|
||||
}
|
||||
@ -2064,11 +2061,11 @@ byte Button_Load_or_Save(byte load, T_IO_Context *context)
|
||||
|
||||
if (Timer_state==1) // Il faut afficher la preview
|
||||
{
|
||||
if ( (Main_fileselector_position+Main_fileselector_offset>=Filelist.Nb_directories) && (Filelist.Nb_elements) )
|
||||
if ( (Selector->Position+Selector->Offset>=Filelist.Nb_directories) && (Filelist.Nb_elements) )
|
||||
{
|
||||
T_IO_Context preview_context;
|
||||
|
||||
Init_context_preview(&preview_context, Selector_filename, Main_current_directory);
|
||||
Init_context_preview(&preview_context, Selector_filename, Selector->Directory);
|
||||
Hide_cursor();
|
||||
|
||||
Load_image(&preview_context);
|
||||
@ -2087,9 +2084,9 @@ byte Button_Load_or_Save(byte load, T_IO_Context *context)
|
||||
if (has_clicked_ok)
|
||||
{
|
||||
strcpy(context->File_name, Selector_filename);
|
||||
strcpy(context->File_directory, Main_current_directory);
|
||||
strcpy(context->File_directory, Selector->Directory);
|
||||
if (!load)
|
||||
context->Format = Main_format;
|
||||
context->Format = Selector->Format_filter;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -29,7 +29,7 @@
|
||||
#include "struct.h"
|
||||
#include "loadsave.h"
|
||||
|
||||
byte Button_Load_or_Save(byte load, T_IO_Context *context);
|
||||
byte Button_Load_or_Save(T_Selector_settings *settings, byte load, T_IO_Context *context);
|
||||
|
||||
void Add_element_to_list(T_Fileselector *list, const char * full_name, const char *short_name, int type, byte icon);
|
||||
///
|
||||
@ -56,4 +56,6 @@ int Quicksearch_list(T_List_button * list, T_Fileselector * selector);
|
||||
|
||||
void Reset_quicksearch(void);
|
||||
|
||||
extern T_Selector_settings * Selector;
|
||||
|
||||
#endif
|
||||
|
||||
50
src/global.h
50
src/global.h
@ -302,21 +302,8 @@ GFX2_GLOBAL short Main_offset_X;
|
||||
GFX2_GLOBAL short Main_offset_Y;
|
||||
/// File format of the image currently edited. It's a value of enum ::FILE_FORMATS
|
||||
GFX2_GLOBAL byte Main_fileformat;
|
||||
///
|
||||
/// Fileselector "filter" format, for the current image.
|
||||
/// (The spare page has its own separate settings)
|
||||
/// It's 0 for "*.*", or a value of enum ::FILE_FORMATS
|
||||
GFX2_GLOBAL byte Main_format;
|
||||
/// Index of the first file/entry to display in the fileselector.
|
||||
GFX2_GLOBAL short Main_fileselector_position;
|
||||
///
|
||||
/// Position of the "highlight" bar in the fileselector. 10 Files can be visible,
|
||||
/// So it's a number in the [0-9] range.
|
||||
GFX2_GLOBAL short Main_fileselector_offset;
|
||||
/// Current directory for the fileselector.
|
||||
GFX2_GLOBAL char Main_current_directory[1024];
|
||||
/// Main image's file comment (some image formats support text strings).
|
||||
GFX2_GLOBAL char Main_comment[COMMENT_SIZE+1];
|
||||
/// File selector settings
|
||||
T_Selector_settings Main_selector;
|
||||
/// X position (in screen coordinates) of the separator between normal and magnified views.
|
||||
GFX2_GLOBAL short Main_separator_position;
|
||||
/// X position (in screen coordinates) of the first pixel of the magnified view.
|
||||
@ -368,21 +355,8 @@ GFX2_GLOBAL char Spare_file_directory[MAX_PATH_CHARACTERS];
|
||||
GFX2_GLOBAL char Spare_filename[MAX_PATH_CHARACTERS];
|
||||
/// File format of the image currently edited as spare page. It's a value of enum ::FILE_FORMATS
|
||||
GFX2_GLOBAL byte Spare_fileformat;
|
||||
///
|
||||
/// Fileselector "filter" format, for the spare page.
|
||||
/// (The main image has its own separate settings)
|
||||
/// It's 0 for "*.*", or a value of enum ::FILE_FORMAT
|
||||
GFX2_GLOBAL byte Spare_format;
|
||||
/// Index of the first file/entry to display in the fileselector.
|
||||
GFX2_GLOBAL short Spare_fileselector_position;
|
||||
///
|
||||
/// Position of the "highlight" bar in the fileselector. 10 Files can be visible,
|
||||
/// So it's a number in the [0-9] range.
|
||||
GFX2_GLOBAL short Spare_fileselector_offset;
|
||||
/// Current directory for the fileselector.
|
||||
GFX2_GLOBAL char Spare_current_directory[MAX_PATH_CHARACTERS];
|
||||
/// Spare page's file comment (some image formats support text strings).
|
||||
GFX2_GLOBAL char Spare_comment[COMMENT_SIZE+1];
|
||||
/// File selector settings
|
||||
T_Selector_settings Spare_selector;
|
||||
/// X position (in screen coordinates) of the separator between normal and magnified views.
|
||||
GFX2_GLOBAL short Spare_separator_position;
|
||||
/// X position (in screen coordinates) of the first pixel of the magnified view.
|
||||
@ -450,20 +424,8 @@ GFX2_GLOBAL char Brush_file_directory[MAX_PATH_CHARACTERS];
|
||||
GFX2_GLOBAL char Brush_filename[MAX_PATH_CHARACTERS];
|
||||
/// File format of the brush. It's a value of enum ::FILE_FORMATS
|
||||
GFX2_GLOBAL byte Brush_fileformat;
|
||||
///
|
||||
/// Fileselector "filter" format, for the brush.
|
||||
/// It's 0 for "*.*", or a value of enum ::FILE_FORMATS
|
||||
GFX2_GLOBAL byte Brush_format;
|
||||
/// Index of the first file/entry to display in the brush's fileselector.
|
||||
GFX2_GLOBAL short Brush_fileselector_position;
|
||||
///
|
||||
/// Position of the "highlight" bar in the brush's fileselector. 10 Files can
|
||||
/// be visible, so it's a number in the [0-9] range.
|
||||
GFX2_GLOBAL short Brush_fileselector_offset;
|
||||
/// Current directory for the brush's fileselector.
|
||||
GFX2_GLOBAL char Brush_current_directory[256];
|
||||
/// File comment in the brush's fileselector (some image formats support text strings).
|
||||
GFX2_GLOBAL char Brush_comment[COMMENT_SIZE+1];
|
||||
/// Fileselector settings
|
||||
T_Selector_settings Brush_selector;
|
||||
/// Indicator used for the "Rotate brush" operation.
|
||||
GFX2_GLOBAL byte Brush_rotation_center_is_defined;
|
||||
/// Position of the brush's rotation center, in screen coordinates.
|
||||
|
||||
16
src/help.c
16
src/help.c
@ -789,17 +789,17 @@ void Button_Stats(void)
|
||||
#if defined(__WIN32__)
|
||||
{
|
||||
ULARGE_INTEGER tailleU;
|
||||
GetDiskFreeSpaceEx(Main_current_directory,&tailleU,NULL,NULL);
|
||||
GetDiskFreeSpaceEx(Main_selector.Directory,&tailleU,NULL,NULL);
|
||||
mem_size = tailleU.QuadPart;
|
||||
}
|
||||
#elif defined(__linux__) || defined(__macosx__) || defined(__FreeBSD__) || defined(__SYLLABLE__) || defined(__AROS__)
|
||||
{
|
||||
struct statfs disk_info;
|
||||
statfs(Main_current_directory,&disk_info);
|
||||
statfs(Main_selector.Directory,&disk_info);
|
||||
mem_size=(qword) disk_info.f_bfree * (qword) disk_info.f_bsize;
|
||||
}
|
||||
#elif defined(__HAIKU__)
|
||||
mem_size = haiku_get_free_space(Main_current_directory);
|
||||
mem_size = haiku_get_free_space(Main_selector.Directory);
|
||||
#elif defined (__MINT__)
|
||||
_DISKINFO drvInfo;
|
||||
mem_size=0;
|
||||
@ -819,16 +819,16 @@ void Button_Stats(void)
|
||||
if (mem_size != 0)
|
||||
{
|
||||
#if defined(__AROS__)
|
||||
char *colon = strchr(Main_current_directory, ':');
|
||||
int len = strlen(Main_current_directory);
|
||||
char *colon = strchr(Main_selector.Directory, ':');
|
||||
int len = strlen(Main_selector.Directory);
|
||||
if (colon)
|
||||
{
|
||||
len = (long)colon - (long)Main_current_directory;
|
||||
len = (long)colon - (long)Main_selector.Directory;
|
||||
}
|
||||
if (len > 8) len = 8;
|
||||
sprintf(buffer,"Free space on %.*s:",len,Main_current_directory);
|
||||
sprintf(buffer,"Free space on %.*s:",len,Main_selector.Directory);
|
||||
#else
|
||||
sprintf(buffer,"Free space on %c:",Main_current_directory[0]);
|
||||
sprintf(buffer,"Free space on %c:",Main_selector.Directory[0]);
|
||||
#endif
|
||||
Print_in_window(10,y,buffer,STATS_TITLE_COLOR,MC_Black);
|
||||
|
||||
|
||||
@ -51,6 +51,7 @@
|
||||
#include "engine.h"
|
||||
#include "brush.h"
|
||||
#include "setup.h"
|
||||
#include "filesel.h"
|
||||
|
||||
// -- PKM -------------------------------------------------------------------
|
||||
void Test_PKM(T_IO_Context *);
|
||||
@ -427,7 +428,7 @@ void Pre_load(T_IO_Context *context, short width, short height, long file_size,
|
||||
}
|
||||
|
||||
// Affichage du vrai format
|
||||
if (format!=Main_format)
|
||||
if (format!=Selector->Format_filter)
|
||||
{
|
||||
Print_in_window( 59,59,Get_fileformat(format)->Label,MC_Black,MC_Light);
|
||||
}
|
||||
@ -820,7 +821,7 @@ void Load_image(T_IO_Context *context)
|
||||
}
|
||||
|
||||
// Comment
|
||||
strcpy(Main_comment, context->Comment);
|
||||
strcpy(Main_backups->Pages->Comment, context->Comment);
|
||||
|
||||
}
|
||||
}
|
||||
@ -1280,7 +1281,7 @@ void Init_context_layered_image(T_IO_Context * context, char *file_name, char *f
|
||||
context->Width = Main_image_width;
|
||||
context->Height = Main_image_height;
|
||||
context->Nb_layers = Main_backups->Pages->Nb_layers;
|
||||
strcpy(context->Comment, Main_comment);
|
||||
strcpy(context->Comment, Main_backups->Pages->Comment);
|
||||
context->Transparent_color=Main_backups->Pages->Transparent_color;
|
||||
context->Background_transparent=Main_backups->Pages->Background_transparent;
|
||||
if (Pixel_ratio == PIXEL_WIDE || Pixel_ratio == PIXEL_WIDE2)
|
||||
|
||||
38
src/main.c
38
src/main.c
@ -68,6 +68,7 @@
|
||||
#include "realpath.h"
|
||||
#include "input.h"
|
||||
#include "help.h"
|
||||
#include "filesel.h"
|
||||
|
||||
#if defined(__WIN32__)
|
||||
#include <windows.h>
|
||||
@ -456,46 +457,43 @@ int Init_program(int argc,char * argv[])
|
||||
// Choose directory for settings (read/write)
|
||||
Set_config_directory(program_directory,Config_directory);
|
||||
#if defined(__MINT__)
|
||||
strcpy(Main_current_directory,program_directory);
|
||||
strcpy(Main_selector.Directory,program_directory);
|
||||
#else
|
||||
// On détermine le répertoire courant:
|
||||
getcwd(Main_current_directory,256);
|
||||
getcwd(Main_selector.Directory,256);
|
||||
#endif
|
||||
|
||||
// On en profite pour le mémoriser dans le répertoire principal:
|
||||
strcpy(Initial_directory,Main_current_directory);
|
||||
strcpy(Initial_directory,Main_selector.Directory);
|
||||
|
||||
// On initialise les données sur le nom de fichier de l'image de brouillon:
|
||||
strcpy(Spare_current_directory,Main_current_directory);
|
||||
strcpy(Spare_selector.Directory,Main_selector.Directory);
|
||||
|
||||
Main_fileformat=DEFAULT_FILEFORMAT;
|
||||
Spare_fileformat =Main_fileformat;
|
||||
|
||||
strcpy(Brush_current_directory,Main_current_directory);
|
||||
strcpy(Brush_file_directory,Main_current_directory);
|
||||
strcpy(Brush_selector.Directory,Main_selector.Directory);
|
||||
strcpy(Brush_file_directory,Main_selector.Directory);
|
||||
strcpy(Brush_filename ,"NO_NAME.GIF");
|
||||
Brush_fileformat =Main_fileformat;
|
||||
|
||||
// On initialise ce qu'il faut pour que les fileselects ne plantent pas:
|
||||
|
||||
Main_fileselector_position=0; // Au début, le fileselect est en haut de la liste des fichiers
|
||||
Main_fileselector_offset=0; // Au début, le fileselect est en haut de la liste des fichiers
|
||||
Main_format=FORMAT_ALL_IMAGES;
|
||||
Main_selector.Position=0; // Au début, le fileselect est en haut de la liste des fichiers
|
||||
Main_selector.Offset=0; // Au début, le fileselect est en haut de la liste des fichiers
|
||||
Main_selector.Format_filter=FORMAT_ALL_IMAGES;
|
||||
|
||||
Main_current_layer=0;
|
||||
Main_layers_visible=0xFFFFFFFF;
|
||||
Spare_current_layer=0;
|
||||
Spare_layers_visible=0xFFFFFFFF;
|
||||
|
||||
Spare_fileselector_position=0;
|
||||
Spare_fileselector_offset=0;
|
||||
Spare_format=FORMAT_ALL_IMAGES;
|
||||
Brush_fileselector_position=0;
|
||||
Brush_fileselector_offset=0;
|
||||
Brush_format=FORMAT_ALL_IMAGES;
|
||||
|
||||
// On initialise les commentaires des images à des chaînes vides
|
||||
Main_comment[0]='\0';
|
||||
Brush_comment[0]='\0';
|
||||
Spare_selector.Position=0;
|
||||
Spare_selector.Offset=0;
|
||||
Spare_selector.Format_filter=FORMAT_ALL_IMAGES;
|
||||
Brush_selector.Position=0;
|
||||
Brush_selector.Offset=0;
|
||||
Brush_selector.Format_filter=FORMAT_ALL_IMAGES;
|
||||
|
||||
// On initialise d'ot' trucs
|
||||
Main_offset_X=0;
|
||||
@ -807,7 +805,7 @@ int Init_program(int argc,char * argv[])
|
||||
// backups
|
||||
if (file_in_command_line > 0)
|
||||
{
|
||||
strcpy(Main_current_directory, main_directory);
|
||||
strcpy(Main_selector.Directory, main_directory);
|
||||
}
|
||||
|
||||
// Test de recuperation de fichiers sauvés
|
||||
|
||||
@ -178,7 +178,6 @@ void Download_infos_page_main(T_Page * page)
|
||||
Main_image_width=page->Width;
|
||||
Main_image_height=page->Height;
|
||||
memcpy(Main_palette,page->Palette,sizeof(T_Palette));
|
||||
strcpy(Main_comment,page->Comment);
|
||||
Main_fileformat=page->File_format;
|
||||
|
||||
if (size_is_modified)
|
||||
@ -402,7 +401,6 @@ void Upload_infos_page_main(T_Page * page)
|
||||
page->Width=Main_image_width;
|
||||
page->Height=Main_image_height;
|
||||
memcpy(page->Palette,Main_palette,sizeof(T_Palette));
|
||||
strcpy(page->Comment,Main_comment);
|
||||
page->File_format=Main_fileformat;
|
||||
}
|
||||
}
|
||||
@ -786,7 +784,7 @@ int Init_all_backup_lists(int width,int height)
|
||||
// On y met les infos sur la dimension de démarrage
|
||||
Main_backups->Pages->Width=width;
|
||||
Main_backups->Pages->Height=height;
|
||||
strcpy(Main_backups->Pages->File_directory,Main_current_directory);
|
||||
strcpy(Main_backups->Pages->File_directory,Main_selector.Directory);
|
||||
strcpy(Main_backups->Pages->Filename,"NO_NAME.GIF");
|
||||
|
||||
|
||||
@ -825,7 +823,7 @@ int Init_all_backup_lists(int width,int height)
|
||||
Spare_backups->Pages->Height = height;
|
||||
memcpy(Spare_backups->Pages->Palette,Main_palette,sizeof(T_Palette));
|
||||
strcpy(Spare_backups->Pages->Comment,"");
|
||||
strcpy(Spare_backups->Pages->File_directory,Main_current_directory);
|
||||
strcpy(Spare_backups->Pages->File_directory,Main_selector.Directory);
|
||||
strcpy(Spare_backups->Pages->Filename,"NO_NAME2.GIF");
|
||||
Spare_backups->Pages->File_format=DEFAULT_FILEFORMAT;
|
||||
// Copy this informations in the global Spare_ variables
|
||||
|
||||
@ -540,4 +540,13 @@ typedef struct
|
||||
byte Flipped; ///< 0:no, 1:horizontally, 2:vertically, 3:both
|
||||
} T_Tile;
|
||||
|
||||
/// Settings for an entire file selector screen
|
||||
typedef struct T_Selector_settings
|
||||
{
|
||||
byte Format_filter; ///< 0 for "*.*", or a value of enum ::FILE_FORMATS
|
||||
short Position; ///< Index of the first file/entry to display in list
|
||||
short Offset; ///< Position of the "highlight" bar in the file list
|
||||
char Directory[256]; ///< Directory currently browsed
|
||||
} T_Selector_settings;
|
||||
|
||||
#endif
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user