Integrate path fix from Android port (tnanks a lot Pelya)
git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@2071 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
parent
c821dbebf4
commit
1248100ae9
15
src/const.h
15
src/const.h
@ -2,6 +2,7 @@
|
|||||||
*/
|
*/
|
||||||
/* Grafx2 - The Ultimate 256-color bitmap paint program
|
/* Grafx2 - The Ultimate 256-color bitmap paint program
|
||||||
|
|
||||||
|
Copyright 2014 Sergii Pylypenko
|
||||||
Copyright 2008 Yves Rizoud
|
Copyright 2008 Yves Rizoud
|
||||||
Copyright 2007 Adrien Destugues
|
Copyright 2007 Adrien Destugues
|
||||||
Copyright 1996-2001 Sunset Design (Guillaume Dorme & Karl Maritaud)
|
Copyright 1996-2001 Sunset Design (Guillaume Dorme & Karl Maritaud)
|
||||||
@ -28,6 +29,16 @@
|
|||||||
#ifndef _CONST_H_
|
#ifndef _CONST_H_
|
||||||
#define _CONST_H_
|
#define _CONST_H_
|
||||||
|
|
||||||
|
#if defined(__GP2X__) || defined(__WIZ__) || defined(__CAANOO__) || defined(__amigaos__)
|
||||||
|
// These platforms don't seem to have PATH_MAX
|
||||||
|
#undef PATH_MAX
|
||||||
|
#define PATH_MAX 260
|
||||||
|
#elif defined(__ANDROID__)
|
||||||
|
#include <sys/limits.h> // for PATH_MAX
|
||||||
|
#else
|
||||||
|
#include <limits.h> // for PATH_MAX
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef M_2PI
|
#ifndef M_2PI
|
||||||
#define M_2PI 6.28318530717958647692528676656 ///< Hmm, pie...
|
#define M_2PI 6.28318530717958647692528676656 ///< Hmm, pie...
|
||||||
#endif
|
#endif
|
||||||
@ -36,7 +47,7 @@
|
|||||||
#define VERSION2 0 ///< Version number for gfx2.cfg (2/4)
|
#define VERSION2 0 ///< Version number for gfx2.cfg (2/4)
|
||||||
#define BETA1 98 ///< Version number for gfx2.cfg (3/4)
|
#define BETA1 98 ///< Version number for gfx2.cfg (3/4)
|
||||||
#define BETA2 0 ///< Version number for gfx2.cfg (4/4)
|
#define BETA2 0 ///< Version number for gfx2.cfg (4/4)
|
||||||
#define MAX_VIDEO_MODES 100 ///< Maximum number of video modes Grafx2 can propose.
|
#define MAX_VIDEO_MODES 200 ///< Maximum number of video modes Grafx2 can propose.
|
||||||
#define NB_ZOOM_FACTORS 15 ///< Number of zoom levels available in the magnifier.
|
#define NB_ZOOM_FACTORS 15 ///< Number of zoom levels available in the magnifier.
|
||||||
#define MENU_WIDTH 254 ///< Width of the menu (not counting the palette)
|
#define MENU_WIDTH 254 ///< Width of the menu (not counting the palette)
|
||||||
#define MENU_HEIGHT 44 ///< Height of the menu.
|
#define MENU_HEIGHT 44 ///< Height of the menu.
|
||||||
@ -61,7 +72,7 @@
|
|||||||
#define COMMENT_SIZE 32 ///< Max number of characters for a comment in PKM or PNG file.
|
#define COMMENT_SIZE 32 ///< Max number of characters for a comment in PKM or PNG file.
|
||||||
#define NB_MAX_PAGES_UNDO 99 ///< Max number of undo pages
|
#define NB_MAX_PAGES_UNDO 99 ///< Max number of undo pages
|
||||||
#define DEFAULT_ZOOM_FACTOR 4 ///< Initial zoom factor for the magnifier.
|
#define DEFAULT_ZOOM_FACTOR 4 ///< Initial zoom factor for the magnifier.
|
||||||
#define MAX_PATH_CHARACTERS 260 ///< Number of characters for a file+complete path. Adapt to your OS...
|
#define MAX_PATH_CHARACTERS PATH_MAX ///< Number of characters for a file+complete path. Adapt to your OS...
|
||||||
#define NB_BOOKMARKS 4 ///< Number of bookmark buttons in Save/Load screen.
|
#define NB_BOOKMARKS 4 ///< Number of bookmark buttons in Save/Load screen.
|
||||||
// Character to show a right arrow, used when editing long strings. It's present in ::Gfx->System_font
|
// Character to show a right arrow, used when editing long strings. It's present in ::Gfx->System_font
|
||||||
#define RIGHT_TRIANGLE_CHARACTER 16
|
#define RIGHT_TRIANGLE_CHARACTER 16
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
*/
|
*/
|
||||||
/* Grafx2 - The Ultimate 256-color bitmap paint program
|
/* Grafx2 - The Ultimate 256-color bitmap paint program
|
||||||
|
|
||||||
|
Copyright 2014 Sergii Pylypenko
|
||||||
Copyright 2011 Pawel Góralski
|
Copyright 2011 Pawel Góralski
|
||||||
Copyright 2009 Franck Charlet
|
Copyright 2009 Franck Charlet
|
||||||
Copyright 2008 Peter Gordon
|
Copyright 2008 Peter Gordon
|
||||||
@ -359,7 +360,8 @@ void Read_list_of_files(T_Fileselector *list, byte selected_format)
|
|||||||
struct dirent* entry; // Structure de lecture des éléments
|
struct dirent* entry; // Structure de lecture des éléments
|
||||||
char * filter = "*"; // Extension demandée
|
char * filter = "*"; // Extension demandée
|
||||||
struct stat Infos_enreg;
|
struct stat Infos_enreg;
|
||||||
char * current_path;
|
char * current_path = NULL;
|
||||||
|
char curdir[MAX_PATH_CHARACTERS];
|
||||||
#if defined (__MINT__)
|
#if defined (__MINT__)
|
||||||
char path[1024]={0};
|
char path[1024]={0};
|
||||||
char path2[1024]={0};
|
char path2[1024]={0};
|
||||||
@ -389,7 +391,7 @@ void Read_list_of_files(T_Fileselector *list, byte selected_format)
|
|||||||
strcat(path2,PATH_SEPARATOR);
|
strcat(path2,PATH_SEPARATOR);
|
||||||
current_directory=opendir(path2);
|
current_directory=opendir(path2);
|
||||||
#else
|
#else
|
||||||
current_path=getcwd(NULL,0);
|
current_path=getcwd(curdir,MAX_PATH_CHARACTERS);
|
||||||
current_directory=opendir(current_path);
|
current_directory=opendir(current_path);
|
||||||
#endif
|
#endif
|
||||||
while ((entry=readdir(current_directory)))
|
while ((entry=readdir(current_directory)))
|
||||||
@ -1489,7 +1491,7 @@ byte Button_Load_or_Save(T_Selector_settings *settings, byte load, T_IO_Context
|
|||||||
#else
|
#else
|
||||||
{
|
{
|
||||||
chdir(context->File_directory);
|
chdir(context->File_directory);
|
||||||
getcwd(Selector->Directory,256);
|
getcwd(Selector->Directory,MAX_PATH_CHARACTERS);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -2007,7 +2009,7 @@ byte Button_Load_or_Save(T_Selector_settings *settings, byte load, T_IO_Context
|
|||||||
Dgetpath(path,0);
|
Dgetpath(path,0);
|
||||||
sprintf(Selector->Directory,"%c:\%s",currentDrive,path);
|
sprintf(Selector->Directory,"%c:\%s",currentDrive,path);
|
||||||
#else
|
#else
|
||||||
getcwd(Selector->Directory,256);
|
getcwd(Selector->Directory,MAX_PATH_CHARACTERS);
|
||||||
#endif
|
#endif
|
||||||
// On lit le nouveau répertoire
|
// On lit le nouveau répertoire
|
||||||
Read_list_of_files(&Filelist, Selector->Format_filter);
|
Read_list_of_files(&Filelist, Selector->Format_filter);
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
*/
|
*/
|
||||||
/* Grafx2 - The Ultimate 256-color bitmap paint program
|
/* Grafx2 - The Ultimate 256-color bitmap paint program
|
||||||
|
|
||||||
|
Copyright 2014 Sergii Pylypenko
|
||||||
Copyright 2009 Franck Charlet
|
Copyright 2009 Franck Charlet
|
||||||
Copyright 2009 Yves Rizoud
|
Copyright 2009 Yves Rizoud
|
||||||
Copyright 2007 Adrien Destugues
|
Copyright 2007 Adrien Destugues
|
||||||
@ -721,11 +722,11 @@ GFX2_GLOBAL byte Airbrush_multi_flow[256];
|
|||||||
/// Boolean, set to true to exit the program.
|
/// Boolean, set to true to exit the program.
|
||||||
GFX2_GLOBAL byte Quitting;
|
GFX2_GLOBAL byte Quitting;
|
||||||
/// Name of the directory that was current when the program was run.
|
/// Name of the directory that was current when the program was run.
|
||||||
GFX2_GLOBAL char Initial_directory[256];
|
GFX2_GLOBAL char Initial_directory[MAX_PATH_CHARACTERS];
|
||||||
/// Name of the directory that holds the program's (read-only) data: skins, icon, etc.
|
/// Name of the directory that holds the program's (read-only) data: skins, icon, etc.
|
||||||
GFX2_GLOBAL char Data_directory[256];
|
GFX2_GLOBAL char Data_directory[MAX_PATH_CHARACTERS];
|
||||||
/// Name of the directory where grafx2 reads and writes configuration (gfx2.ini, gfx2.cfg)
|
/// Name of the directory where grafx2 reads and writes configuration (gfx2.ini, gfx2.cfg)
|
||||||
GFX2_GLOBAL char Config_directory[256];
|
GFX2_GLOBAL char Config_directory[MAX_PATH_CHARACTERS];
|
||||||
/// Current foreground color for drawing.
|
/// Current foreground color for drawing.
|
||||||
GFX2_GLOBAL byte Fore_color;
|
GFX2_GLOBAL byte Fore_color;
|
||||||
/// Current background color for drawing.
|
/// Current background color for drawing.
|
||||||
|
|||||||
2
src/io.c
2
src/io.c
@ -455,7 +455,7 @@ int Lock_file_handle = -1;
|
|||||||
|
|
||||||
byte Create_lock_file(const char *file_directory)
|
byte Create_lock_file(const char *file_directory)
|
||||||
{
|
{
|
||||||
#if defined (__amigaos__)||(__AROS__)
|
#if defined (__amigaos__)||(__AROS__)||(__ANDROID__)
|
||||||
#warning "Missing code for your platform, please check and correct!"
|
#warning "Missing code for your platform, please check and correct!"
|
||||||
#else
|
#else
|
||||||
char lock_filename[MAX_PATH_CHARACTERS];
|
char lock_filename[MAX_PATH_CHARACTERS];
|
||||||
|
|||||||
@ -461,7 +461,7 @@ int Init_program(int argc,char * argv[])
|
|||||||
strcpy(Main_selector.Directory,program_directory);
|
strcpy(Main_selector.Directory,program_directory);
|
||||||
#else
|
#else
|
||||||
// On détermine le répertoire courant:
|
// On détermine le répertoire courant:
|
||||||
getcwd(Main_selector.Directory,256);
|
getcwd(Main_selector.Directory,MAX_PATH_CHARACTERS);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// On en profite pour le mémoriser dans le répertoire principal:
|
// On en profite pour le mémoriser dans le répertoire principal:
|
||||||
|
|||||||
@ -41,7 +41,7 @@
|
|||||||
#define MOUNTED_GETFSSTAT 1
|
#define MOUNTED_GETFSSTAT 1
|
||||||
#define HAVE_SYS_MOUNT_H 1
|
#define HAVE_SYS_MOUNT_H 1
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#elif defined(__SKYOS__)
|
#elif defined(__SKYOS__)||defined(__ANDROID__)
|
||||||
#warning "Your platform is missing some specific code here ! please check and fix :)"
|
#warning "Your platform is missing some specific code here ! please check and fix :)"
|
||||||
#else
|
#else
|
||||||
#define MOUNTED_GETMNTENT1
|
#define MOUNTED_GETMNTENT1
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
*/
|
*/
|
||||||
/* Grafx2 - The Ultimate 256-color bitmap paint program
|
/* Grafx2 - The Ultimate 256-color bitmap paint program
|
||||||
|
|
||||||
|
Copyright 2014 Sergii Pylypenko
|
||||||
Copyright 2008 Yves Rizoud
|
Copyright 2008 Yves Rizoud
|
||||||
Copyright 2007 Adrien Destugues
|
Copyright 2007 Adrien Destugues
|
||||||
Copyright 1996-2001 Sunset Design (Guillaume Dorme & Karl Maritaud)
|
Copyright 1996-2001 Sunset Design (Guillaume Dorme & Karl Maritaud)
|
||||||
@ -50,6 +51,9 @@
|
|||||||
#include <proto/iffparse.h>
|
#include <proto/iffparse.h>
|
||||||
#include <datatypes/textclass.h>
|
#include <datatypes/textclass.h>
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(__ANDROID__)
|
||||||
|
#include <SDL_screenkeyboard.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
// Virtual keyboard is ON by default on these platforms:
|
// Virtual keyboard is ON by default on these platforms:
|
||||||
#if defined(__GP2X__) || defined(__WIZ__) || defined(__CAANOO__)
|
#if defined(__GP2X__) || defined(__WIZ__) || defined(__CAANOO__)
|
||||||
@ -400,6 +404,10 @@ byte Readline_ex(word x_pos,word y_pos,char * str,byte visible_size,byte max_siz
|
|||||||
// Nothing. The caller should have initialized a valid hexa number.
|
// Nothing. The caller should have initialized a valid hexa number.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(__ANDROID__)
|
||||||
|
SDL_ANDROID_GetScreenKeyboardTextInput(str, max_size);
|
||||||
|
input_key = SDLK_RETURN;
|
||||||
|
#else
|
||||||
// Virtual keyboards
|
// Virtual keyboards
|
||||||
if (Config.Use_virtual_keyboard==1 ||
|
if (Config.Use_virtual_keyboard==1 ||
|
||||||
(VIRT_KEY_DEFAULT_ON && Config.Use_virtual_keyboard==0))
|
(VIRT_KEY_DEFAULT_ON && Config.Use_virtual_keyboard==0))
|
||||||
@ -757,7 +765,7 @@ affichage:
|
|||||||
Mouse_K=old_mouse_k;
|
Mouse_K=old_mouse_k;
|
||||||
Input_sticky_control=0;
|
Input_sticky_control=0;
|
||||||
}
|
}
|
||||||
|
#endif // defined(__ANDROID__)
|
||||||
// Effacement de la chaîne
|
// Effacement de la chaîne
|
||||||
Block(window_x+(x_pos*Menu_factor_X),window_y+(y_pos*Menu_factor_Y),
|
Block(window_x+(x_pos*Menu_factor_X),window_y+(y_pos*Menu_factor_Y),
|
||||||
visible_size*(Menu_factor_X<<3),(Menu_factor_Y<<3),BACKGROUND_COLOR);
|
visible_size*(Menu_factor_X<<3),(Menu_factor_Y<<3),BACKGROUND_COLOR);
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
*/
|
*/
|
||||||
/* Grafx2 - The Ultimate 256-color bitmap paint program
|
/* Grafx2 - The Ultimate 256-color bitmap paint program
|
||||||
|
|
||||||
|
Copyright 2014 Sergii Pylypenko
|
||||||
Copyright 2011 Pawel Góralski
|
Copyright 2011 Pawel Góralski
|
||||||
Copyright 2008 Yves Rizoud
|
Copyright 2008 Yves Rizoud
|
||||||
Copyright 2008 Franck Charlet
|
Copyright 2008 Franck Charlet
|
||||||
@ -54,6 +55,8 @@
|
|||||||
#define UPDATE_METHOD UPDATE_METHOD_FULL_PAGE
|
#define UPDATE_METHOD UPDATE_METHOD_FULL_PAGE
|
||||||
#elif defined(__MINT__)
|
#elif defined(__MINT__)
|
||||||
#define UPDATE_METHOD UPDATE_METHOD_CUMULATED
|
#define UPDATE_METHOD UPDATE_METHOD_CUMULATED
|
||||||
|
#elif defined(__ANDROID__)
|
||||||
|
#define UPDATE_METHOD UPDATE_METHOD_FULL_PAGE
|
||||||
#else
|
#else
|
||||||
#define UPDATE_METHOD UPDATE_METHOD_CUMULATED
|
#define UPDATE_METHOD UPDATE_METHOD_CUMULATED
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
*/
|
*/
|
||||||
/* Grafx2 - The Ultimate 256-color bitmap paint program
|
/* Grafx2 - The Ultimate 256-color bitmap paint program
|
||||||
|
|
||||||
|
Copyright 2014 Sergii Pylypenko
|
||||||
Copyright 2011 Pawel Góralski
|
Copyright 2011 Pawel Góralski
|
||||||
Copyright 2008 Peter Gordon
|
Copyright 2008 Peter Gordon
|
||||||
Copyright 2008 Yves Rizoud
|
Copyright 2008 Yves Rizoud
|
||||||
@ -92,6 +93,9 @@ void Set_program_directory(const char * argv0,char * program_dir)
|
|||||||
sprintf(program_dir,"%c:\%s",currentDrive,path);
|
sprintf(program_dir,"%c:\%s",currentDrive,path);
|
||||||
// Append trailing slash
|
// Append trailing slash
|
||||||
strcat(program_dir,PATH_SEPARATOR);
|
strcat(program_dir,PATH_SEPARATOR);
|
||||||
|
#elif defined(__ANDROID__)
|
||||||
|
getcwd(program_dir, MAX_PATH_CHARACTERS);
|
||||||
|
strcat(program_dir, "/");
|
||||||
// Linux: argv[0] unreliable
|
// Linux: argv[0] unreliable
|
||||||
#elif defined(__linux__)
|
#elif defined(__linux__)
|
||||||
if (argv0[0]!='/')
|
if (argv0[0]!='/')
|
||||||
@ -122,7 +126,7 @@ void Set_data_directory(const char * program_dir, char * data_dir)
|
|||||||
#if defined(__macosx__)
|
#if defined(__macosx__)
|
||||||
strcat(data_dir,"Contents/Resources/");
|
strcat(data_dir,"Contents/Resources/");
|
||||||
// On GP2X, executable is not in bin/
|
// On GP2X, executable is not in bin/
|
||||||
#elif defined (__GP2X__) || defined (__gp2x__) || defined (__WIZ__) || defined (__CAANOO__)
|
#elif defined (__GP2X__) || defined (__gp2x__) || defined (__WIZ__) || defined (__CAANOO__) || defined(__ANDROID__)
|
||||||
strcat(data_dir,"share/grafx2/");
|
strcat(data_dir,"share/grafx2/");
|
||||||
//on tos the same directory
|
//on tos the same directory
|
||||||
#elif defined (__MINT__)
|
#elif defined (__MINT__)
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
*/
|
*/
|
||||||
/* Grafx2 - The Ultimate 256-color bitmap paint program
|
/* Grafx2 - The Ultimate 256-color bitmap paint program
|
||||||
|
|
||||||
|
Copyright 2014 Sergii Pylypenko
|
||||||
Copyright 2011 Pawel Góralski
|
Copyright 2011 Pawel Góralski
|
||||||
Copyright 2008 Yves Rizoud
|
Copyright 2008 Yves Rizoud
|
||||||
Copyright 2007 Adrien Destugues
|
Copyright 2007 Adrien Destugues
|
||||||
@ -173,7 +174,7 @@ typedef struct T_Dropdown_button
|
|||||||
/// Data for one item (file, directory) in a fileselector.
|
/// Data for one item (file, directory) in a fileselector.
|
||||||
typedef struct T_Fileselector_item
|
typedef struct T_Fileselector_item
|
||||||
{
|
{
|
||||||
char Full_name[256]; ///< Filesystem value.
|
char Full_name[MAX_PATH_CHARACTERS]; ///< Filesystem value.
|
||||||
byte Type; ///< Type of item: 0 = File, 1 = Directory, 2 = Drive
|
byte Type; ///< Type of item: 0 = File, 1 = Directory, 2 = Drive
|
||||||
byte Icon; ///< One of ::ICON_TYPES, ICON_NONE for none.
|
byte Icon; ///< One of ::ICON_TYPES, ICON_NONE for none.
|
||||||
|
|
||||||
@ -545,7 +546,7 @@ typedef struct T_Selector_settings
|
|||||||
byte Format_filter; ///< 0 for "*.*", or a value of enum ::FILE_FORMATS
|
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 Position; ///< Index of the first file/entry to display in list
|
||||||
short Offset; ///< Position of the "highlight" bar in the file list
|
short Offset; ///< Position of the "highlight" bar in the file list
|
||||||
char Directory[256]; ///< Directory currently browsed
|
char Directory[MAX_PATH_CHARACTERS]; ///< Directory currently browsed
|
||||||
} T_Selector_settings;
|
} T_Selector_settings;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
*/
|
*/
|
||||||
/* Grafx2 - The Ultimate 256-color bitmap paint program
|
/* Grafx2 - The Ultimate 256-color bitmap paint program
|
||||||
|
|
||||||
|
Copyright 2014 Sergii Pylypenko
|
||||||
Copyright 2011 Pawel Góralski
|
Copyright 2011 Pawel Góralski
|
||||||
Copyright 2008 Yves Rizoud
|
Copyright 2008 Yves Rizoud
|
||||||
Copyright 2008 Franck Charlet
|
Copyright 2008 Franck Charlet
|
||||||
@ -418,10 +419,17 @@ byte *Render_text_TTF(const char *str, int font_number, int size, int antialias,
|
|||||||
bg_color.unused=fg_color.unused=255;
|
bg_color.unused=fg_color.unused=255;
|
||||||
|
|
||||||
// Text rendering: creates a 8bit surface with its dedicated palette
|
// Text rendering: creates a 8bit surface with its dedicated palette
|
||||||
|
#ifdef __ANDROID__
|
||||||
|
if (antialias)
|
||||||
|
text_surface=TTF_RenderUTF8_Shaded(font, str, fg_color, bg_color );
|
||||||
|
else
|
||||||
|
text_surface=TTF_RenderUTF8_Solid(font, str, fg_color);
|
||||||
|
#else
|
||||||
if (antialias)
|
if (antialias)
|
||||||
text_surface=TTF_RenderText_Shaded(font, str, fg_color, bg_color );
|
text_surface=TTF_RenderText_Shaded(font, str, fg_color, bg_color );
|
||||||
else
|
else
|
||||||
text_surface=TTF_RenderText_Solid(font, str, fg_color);
|
text_surface=TTF_RenderText_Solid(font, str, fg_color);
|
||||||
|
#endif
|
||||||
if (!text_surface)
|
if (!text_surface)
|
||||||
{
|
{
|
||||||
TTF_CloseFont(font);
|
TTF_CloseFont(font);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user