Code cleanup and minor improvements, brought back FocusBugWorkaround (still needed in guisan)
This commit is contained in:
parent
f0f41db48c
commit
59f80f9d9b
13 changed files with 545 additions and 480 deletions
|
@ -6,11 +6,38 @@
|
||||||
<Directories />
|
<Directories />
|
||||||
<PathStyle>MinGWUnixSlash</PathStyle>
|
<PathStyle>MinGWUnixSlash</PathStyle>
|
||||||
</CustomSourceDirectories>
|
</CustomSourceDirectories>
|
||||||
|
<BuildHost>
|
||||||
|
<Transport>None</Transport>
|
||||||
|
</BuildHost>
|
||||||
<DeploymentHost>
|
<DeploymentHost>
|
||||||
<HostName>192.168.1.189</HostName>
|
<HostName>192.168.1.189</HostName>
|
||||||
<Transport>SSH</Transport>
|
<Transport>SSH</Transport>
|
||||||
<UserName>pi</UserName>
|
<UserName>pi</UserName>
|
||||||
</DeploymentHost>
|
</DeploymentHost>
|
||||||
|
<MainSourceTransferCommand>
|
||||||
|
<SkipWhenRunningCommandList>false</SkipWhenRunningCommandList>
|
||||||
|
<RemoteHost>
|
||||||
|
<Transport>None</Transport>
|
||||||
|
</RemoteHost>
|
||||||
|
<LocalDirectory>$(ProjectDir)</LocalDirectory>
|
||||||
|
<RemoteDirectory>/tmp/VisualGDB/$(ProjectDirUnixStyle)</RemoteDirectory>
|
||||||
|
<FileMasks>
|
||||||
|
<string>*.cpp</string>
|
||||||
|
<string>*.h</string>
|
||||||
|
<string>*.hpp</string>
|
||||||
|
<string>*.c</string>
|
||||||
|
<string>*.cc</string>
|
||||||
|
<string>*.cxx</string>
|
||||||
|
<string>*.mak</string>
|
||||||
|
<string>Makefile</string>
|
||||||
|
<string>*.txt</string>
|
||||||
|
<string>*.cmake</string>
|
||||||
|
</FileMasks>
|
||||||
|
<TransferNewFilesOnly>true</TransferNewFilesOnly>
|
||||||
|
<IncludeSubdirectories>true</IncludeSubdirectories>
|
||||||
|
<DeleteDisappearedFiles>false</DeleteDisappearedFiles>
|
||||||
|
<ApplyGlobalExclusionList>true</ApplyGlobalExclusionList>
|
||||||
|
</MainSourceTransferCommand>
|
||||||
<AllowChangingHostForMainCommands>false</AllowChangingHostForMainCommands>
|
<AllowChangingHostForMainCommands>false</AllowChangingHostForMainCommands>
|
||||||
<SkipBuildIfNoSourceFilesChanged>false</SkipBuildIfNoSourceFilesChanged>
|
<SkipBuildIfNoSourceFilesChanged>false</SkipBuildIfNoSourceFilesChanged>
|
||||||
<IgnoreFileTransferErrors>false</IgnoreFileTransferErrors>
|
<IgnoreFileTransferErrors>false</IgnoreFileTransferErrors>
|
||||||
|
|
|
@ -45,6 +45,7 @@
|
||||||
<CPPLanguageStandard>GNUPP14</CPPLanguageStandard>
|
<CPPLanguageStandard>GNUPP14</CPPLanguageStandard>
|
||||||
<AdditionalIncludeDirectories>=/usr/local/include/SDL2;=/opt/vc/include;=/opt/vc/include/interface/vcos/pthreads;=/opt/vc/include/interface/vmcs_host/linux;../../src/guisan/include;%(ClCompile.AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>=/usr/local/include/SDL2;=/opt/vc/include;=/opt/vc/include/interface/vcos/pthreads;=/opt/vc/include/interface/vmcs_host/linux;../../src/guisan/include;%(ClCompile.AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<PreprocessorDefinitions>DEBUG=1;_REENTRANT;%(ClCompile.PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>DEBUG=1;_REENTRANT;%(ClCompile.PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<AdditionalOptions>-march=armv8-a -mfpu=neon-fp-armv8 -mfloat-abi=hard %(AdditionalOptions)</AdditionalOptions>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<AdditionalLinkerInputs>;%(Link.AdditionalLinkerInputs)</AdditionalLinkerInputs>
|
<AdditionalLinkerInputs>;%(Link.AdditionalLinkerInputs)</AdditionalLinkerInputs>
|
||||||
|
@ -58,6 +59,7 @@
|
||||||
<CPPLanguageStandard>GNUPP14</CPPLanguageStandard>
|
<CPPLanguageStandard>GNUPP14</CPPLanguageStandard>
|
||||||
<AdditionalIncludeDirectories>=/usr/local/include/SDL2;=/opt/vc/include;=/opt/vc/include/interface/vcos/pthreads;=/opt/vc/include/interface/vmcs_host/linux;../../src/guisan/include;%(ClCompile.AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>=/usr/local/include/SDL2;=/opt/vc/include;=/opt/vc/include/interface/vcos/pthreads;=/opt/vc/include/interface/vmcs_host/linux;../../src/guisan/include;%(ClCompile.AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<PreprocessorDefinitions>NDEBUG=1;RELEASE=1;_REENTRANT;%(ClCompile.PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>NDEBUG=1;RELEASE=1;_REENTRANT;%(ClCompile.PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<AdditionalOptions>-march=armv8-a -mfpu=neon-fp-armv8 -mfloat-abi=hard %(AdditionalOptions)</AdditionalOptions>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<AdditionalLinkerInputs>;%(Link.AdditionalLinkerInputs)</AdditionalLinkerInputs>
|
<AdditionalLinkerInputs>;%(Link.AdditionalLinkerInputs)</AdditionalLinkerInputs>
|
||||||
|
|
|
@ -8,81 +8,80 @@
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
|
|
||||||
|
|
||||||
int my_setcurrentdir (const TCHAR *curdir, TCHAR *oldcur)
|
int my_setcurrentdir(const TCHAR* curdir, TCHAR* oldcur)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
const int ret = 0;
|
||||||
if (oldcur)
|
if (oldcur)
|
||||||
getcwd(oldcur, MAX_DPATH);
|
getcwd(oldcur, MAX_DPATH);
|
||||||
if (curdir)
|
if (curdir)
|
||||||
chdir (curdir);
|
chdir(curdir);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int my_mkdir (const char*name)
|
int my_mkdir(const char* name)
|
||||||
{
|
{
|
||||||
return mkdir(name, 0777);
|
return mkdir(name, 0777);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int my_rmdir (const char*name)
|
int my_rmdir(const char* name)
|
||||||
{
|
{
|
||||||
return rmdir(name);
|
return rmdir(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int my_unlink (const char* name)
|
int my_unlink(const char* name)
|
||||||
{
|
{
|
||||||
return unlink(name);
|
return unlink(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int my_rename (const char* oldname, const char* newname)
|
int my_rename(const char* oldname, const char* newname)
|
||||||
{
|
{
|
||||||
return rename(oldname, newname);
|
return rename(oldname, newname);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
struct my_opendir_s
|
struct my_opendir_s
|
||||||
{
|
{
|
||||||
void *h;
|
void* h;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
struct my_opendir_s *my_opendir (const char* name)
|
struct my_opendir_s* my_opendir(const char* name)
|
||||||
{
|
{
|
||||||
struct my_opendir_s *mod;
|
struct my_opendir_s* mod;
|
||||||
|
|
||||||
mod = xmalloc (struct my_opendir_s, 1);
|
mod = xmalloc (struct my_opendir_s, 1);
|
||||||
if (!mod)
|
if (!mod)
|
||||||
return NULL;
|
return nullptr;
|
||||||
mod->h = opendir(name);
|
mod->h = opendir(name);
|
||||||
if (mod->h == NULL) {
|
if (mod->h == nullptr)
|
||||||
|
{
|
||||||
xfree (mod);
|
xfree (mod);
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
return mod;
|
return mod;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void my_closedir (struct my_opendir_s *mod)
|
void my_closedir(struct my_opendir_s* mod)
|
||||||
{
|
{
|
||||||
if (mod)
|
if (mod)
|
||||||
closedir((DIR *) mod->h);
|
closedir(static_cast<DIR *>(mod->h));
|
||||||
xfree (mod);
|
xfree (mod);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int my_readdir (struct my_opendir_s *mod, char* name)
|
int my_readdir(struct my_opendir_s* mod, char* name)
|
||||||
{
|
{
|
||||||
struct dirent *de;
|
if (!mod)
|
||||||
|
return 0;
|
||||||
|
|
||||||
if (!mod)
|
struct dirent * de = readdir(static_cast<DIR *>(mod->h));
|
||||||
return 0;
|
if (de == nullptr)
|
||||||
|
return 0;
|
||||||
de = readdir((DIR *) mod->h);
|
|
||||||
if(de == 0)
|
|
||||||
return 0;
|
|
||||||
strncpy(name, de->d_name, MAX_PATH);
|
strncpy(name, de->d_name, MAX_PATH);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -90,117 +89,118 @@ int my_readdir (struct my_opendir_s *mod, char* name)
|
||||||
|
|
||||||
struct my_openfile_s
|
struct my_openfile_s
|
||||||
{
|
{
|
||||||
void *h;
|
void* h;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
void my_close (struct my_openfile_s *mos)
|
void my_close(struct my_openfile_s* mos)
|
||||||
{
|
{
|
||||||
if(mos)
|
if (mos)
|
||||||
close((int) mos->h);
|
close(int(mos->h));
|
||||||
xfree (mos);
|
xfree (mos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
uae_s64 int my_lseek (struct my_openfile_s *mos, uae_s64 int offset, int pos)
|
uae_s64 int my_lseek(struct my_openfile_s* mos,const uae_s64 int offset, const int pos)
|
||||||
{
|
{
|
||||||
return lseek((int) mos->h, offset, pos);
|
return lseek(int(mos->h), offset, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
uae_s64 int my_fsize (struct my_openfile_s *mos)
|
uae_s64 int my_fsize(struct my_openfile_s* mos)
|
||||||
{
|
{
|
||||||
uae_s64 pos = lseek((int) mos->h, 0, SEEK_CUR);
|
uae_s64 pos = lseek(int(mos->h), 0, SEEK_CUR);
|
||||||
uae_s64 size = lseek((int) mos->h, 0, SEEK_END);
|
uae_s64 size = lseek(int(mos->h), 0, SEEK_END);
|
||||||
lseek((int) mos->h, pos, SEEK_SET);
|
lseek(int(mos->h), pos, SEEK_SET);
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
unsigned int my_read (struct my_openfile_s *mos, void *b, unsigned int size)
|
unsigned int my_read(struct my_openfile_s* mos, void* b, unsigned int size)
|
||||||
{
|
{
|
||||||
return read((int) mos->h, b, size);
|
return read(int(mos->h), b, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
unsigned int my_write (struct my_openfile_s *mos, void *b, unsigned int size)
|
unsigned int my_write(struct my_openfile_s* mos, void* b, unsigned int size)
|
||||||
{
|
{
|
||||||
return write((int) mos->h, b, size);
|
return write(int(mos->h), b, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int my_existsfile (const char *name)
|
int my_existsfile(const char* name)
|
||||||
{
|
{
|
||||||
struct stat st;
|
struct stat st;
|
||||||
if (lstat (name, &st) == -1) {
|
if (lstat(name, &st) == -1)
|
||||||
|
{
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
|
||||||
if (!S_ISDIR(st.st_mode))
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
return 0;
|
if (!S_ISDIR(st.st_mode))
|
||||||
|
return 1;
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int my_existsdir(const char *name)
|
int my_existsdir(const char* name)
|
||||||
{
|
{
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
|
||||||
if(lstat(name, &st) == -1) {
|
if (lstat(name, &st) == -1)
|
||||||
return 0;
|
{
|
||||||
} else {
|
return 0;
|
||||||
if (S_ISDIR(st.st_mode))
|
}
|
||||||
return 1;
|
if (S_ISDIR(st.st_mode))
|
||||||
}
|
return 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
struct my_openfile_s *my_open (const TCHAR *name, int flags)
|
struct my_openfile_s* my_open(const TCHAR* name, const int flags)
|
||||||
{
|
{
|
||||||
struct my_openfile_s *mos;
|
struct my_openfile_s* mos;
|
||||||
|
|
||||||
mos = xmalloc (struct my_openfile_s, 1);
|
mos = xmalloc (struct my_openfile_s, 1);
|
||||||
if (!mos)
|
if (!mos)
|
||||||
return NULL;
|
return nullptr;
|
||||||
if (flags & O_CREAT)
|
if (flags & O_CREAT)
|
||||||
mos->h = reinterpret_cast<void *>(open(name, flags, 0660));
|
mos->h = reinterpret_cast<void *>(open(name, flags, 0660));
|
||||||
else
|
else
|
||||||
mos->h = reinterpret_cast<void *>(open(name, flags));
|
mos->h = reinterpret_cast<void *>(open(name, flags));
|
||||||
if (!mos->h) {
|
if (!mos->h)
|
||||||
|
{
|
||||||
xfree (mos);
|
xfree (mos);
|
||||||
mos = NULL;
|
mos = nullptr;
|
||||||
}
|
}
|
||||||
return mos;
|
return mos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int my_truncate (const TCHAR *name, uae_u64 len)
|
int my_truncate(const TCHAR* name, uae_u64 len)
|
||||||
{
|
{
|
||||||
return truncate(name, len);
|
return truncate(name, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int my_getvolumeinfo (const char *root)
|
int my_getvolumeinfo(const char* root)
|
||||||
{
|
{
|
||||||
struct stat st;
|
struct stat st;
|
||||||
int ret = 0;
|
const int ret = 0;
|
||||||
|
|
||||||
if (lstat (root, &st) == -1)
|
if (lstat(root, &st) == -1)
|
||||||
return -1;
|
return -1;
|
||||||
if (!S_ISDIR(st.st_mode))
|
if (!S_ISDIR(st.st_mode))
|
||||||
return -2;
|
return -2;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
FILE *my_opentext (const TCHAR *name)
|
FILE* my_opentext(const TCHAR* name)
|
||||||
{
|
{
|
||||||
return fopen (name, "r");
|
return fopen(name, "r");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool my_issamepath(const TCHAR *path1, const TCHAR *path2)
|
bool my_issamepath(const TCHAR* path1, const TCHAR* path2)
|
||||||
{
|
{
|
||||||
if (!_tcsicmp(path1, path2))
|
if (!_tcsicmp(path1, path2))
|
||||||
return true;
|
return true;
|
||||||
|
@ -208,9 +208,9 @@ bool my_issamepath(const TCHAR *path1, const TCHAR *path2)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const TCHAR *my_getfilepart(const TCHAR *filename)
|
const TCHAR* my_getfilepart(const TCHAR* filename)
|
||||||
{
|
{
|
||||||
const TCHAR *p;
|
const TCHAR* p;
|
||||||
|
|
||||||
p = _tcsrchr(filename, '\\');
|
p = _tcsrchr(filename, '\\');
|
||||||
if (p)
|
if (p)
|
||||||
|
@ -223,8 +223,9 @@ const TCHAR *my_getfilepart(const TCHAR *filename)
|
||||||
|
|
||||||
|
|
||||||
/* Returns 1 if an actual volume-name was found, 2 if no volume-name (so uses some defaults) */
|
/* Returns 1 if an actual volume-name was found, 2 if no volume-name (so uses some defaults) */
|
||||||
int target_get_volume_name(struct uaedev_mount_info *mtinf, struct uaedev_config_info *ci, bool inserted, bool fullcheck, int cnt)
|
int target_get_volume_name(struct uaedev_mount_info* mtinf, struct uaedev_config_info* ci, bool inserted,
|
||||||
|
bool fullcheck, int cnt)
|
||||||
{
|
{
|
||||||
sprintf(ci->volname, "DH_%c", ci->rootdir[0]);
|
sprintf(ci->volname, "DH_%c", ci->rootdir[0]);
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,19 +27,21 @@
|
||||||
#define DIALOG_WIDTH 620
|
#define DIALOG_WIDTH 620
|
||||||
#define DIALOG_HEIGHT 272
|
#define DIALOG_HEIGHT 272
|
||||||
|
|
||||||
static SDL_Joystick *GUIjoy;
|
static SDL_Joystick* GUIjoy;
|
||||||
extern struct host_input_button host_input_buttons[MAX_INPUT_DEVICES];
|
extern struct host_input_button host_input_buttons[MAX_INPUT_DEVICES];
|
||||||
|
|
||||||
static const char* harddisk_filter[] = {".hdf", "\0"};
|
static const char* harddisk_filter[] = {".hdf", "\0"};
|
||||||
|
|
||||||
struct controller_map {
|
struct controller_map
|
||||||
|
{
|
||||||
int type;
|
int type;
|
||||||
char display[64];
|
char display[64];
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct controller_map controller[] = {
|
static struct controller_map controller[] = {
|
||||||
{ HD_CONTROLLER_TYPE_UAE, "UAE" },
|
{HD_CONTROLLER_TYPE_UAE, "UAE"},
|
||||||
{ HD_CONTROLLER_TYPE_IDE_FIRST, "A600/A1200/A4000 IDE" },
|
{HD_CONTROLLER_TYPE_IDE_FIRST, "A600/A1200/A4000 IDE"},
|
||||||
{ -1 }
|
{-1}
|
||||||
};
|
};
|
||||||
|
|
||||||
static bool dialogResult = false;
|
static bool dialogResult = false;
|
||||||
|
@ -67,13 +69,13 @@ static gcn::Label* lblSectors;
|
||||||
static gcn::TextField* txtSectors;
|
static gcn::TextField* txtSectors;
|
||||||
static gcn::Label* lblBlocksize;
|
static gcn::Label* lblBlocksize;
|
||||||
static gcn::TextField* txtBlocksize;
|
static gcn::TextField* txtBlocksize;
|
||||||
static gcn::Label *lblController;
|
static gcn::Label* lblController;
|
||||||
static gcn::UaeDropDown* cboController;
|
static gcn::UaeDropDown* cboController;
|
||||||
static gcn::UaeDropDown* cboUnit;
|
static gcn::UaeDropDown* cboUnit;
|
||||||
|
|
||||||
static void check_rdb(const TCHAR* filename)
|
static void check_rdb(const TCHAR* filename)
|
||||||
{
|
{
|
||||||
bool isrdb = hardfile_testrdb(filename);
|
const bool isrdb = hardfile_testrdb(filename);
|
||||||
if (isrdb)
|
if (isrdb)
|
||||||
{
|
{
|
||||||
txtSectors->setText("0");
|
txtSectors->setText("0");
|
||||||
|
@ -100,13 +102,14 @@ public:
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string getElementAt(int i) override
|
string getElementAt(const int i) override
|
||||||
{
|
{
|
||||||
if (i < 0 || i >= 2)
|
if (i < 0 || i >= 2)
|
||||||
return "---";
|
return "---";
|
||||||
return controller[i].display;
|
return controller[i].display;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static ControllerListModel controllerListModel;
|
static ControllerListModel controllerListModel;
|
||||||
|
|
||||||
|
|
||||||
|
@ -122,7 +125,7 @@ public:
|
||||||
return 4;
|
return 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string getElementAt(int i) override
|
string getElementAt(int i) override
|
||||||
{
|
{
|
||||||
char num[8];
|
char num[8];
|
||||||
|
|
||||||
|
@ -132,6 +135,7 @@ public:
|
||||||
return num;
|
return num;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static UnitListModel unitListModel;
|
static UnitListModel unitListModel;
|
||||||
|
|
||||||
class FilesysHardfileActionListener : public gcn::ActionListener
|
class FilesysHardfileActionListener : public gcn::ActionListener
|
||||||
|
@ -153,8 +157,10 @@ public:
|
||||||
wndEditFilesysHardfile->requestModalFocus();
|
wndEditFilesysHardfile->requestModalFocus();
|
||||||
cmdPath->requestFocus();
|
cmdPath->requestFocus();
|
||||||
}
|
}
|
||||||
else if (actionEvent.getSource() == cboController) {
|
else if (actionEvent.getSource() == cboController)
|
||||||
switch (controller[cboController->getSelected()].type) {
|
{
|
||||||
|
switch (controller[cboController->getSelected()].type)
|
||||||
|
{
|
||||||
case HD_CONTROLLER_TYPE_UAE:
|
case HD_CONTROLLER_TYPE_UAE:
|
||||||
cboUnit->setSelected(0);
|
cboUnit->setSelected(0);
|
||||||
cboUnit->setEnabled(false);
|
cboUnit->setEnabled(false);
|
||||||
|
@ -190,11 +196,15 @@ static FilesysHardfileActionListener* filesysHardfileActionListener;
|
||||||
|
|
||||||
static void InitEditFilesysHardfile()
|
static void InitEditFilesysHardfile()
|
||||||
{
|
{
|
||||||
for (int i = 0; expansionroms[i].name; i++) {
|
for (int i = 0; expansionroms[i].name; i++)
|
||||||
const struct expansionromtype *erc = &expansionroms[i];
|
{
|
||||||
if (erc->deviceflags & EXPANSIONTYPE_IDE) {
|
const struct expansionromtype* erc = &expansionroms[i];
|
||||||
for (int j = 0; controller[j].type >= 0; ++j) {
|
if (erc->deviceflags & EXPANSIONTYPE_IDE)
|
||||||
if (!strcmp(erc->friendlyname, controller[j].display)) {
|
{
|
||||||
|
for (int j = 0; controller[j].type >= 0; ++j)
|
||||||
|
{
|
||||||
|
if (!strcmp(erc->friendlyname, controller[j].display))
|
||||||
|
{
|
||||||
controller[j].type = HD_CONTROLLER_TYPE_IDE_EXPANSION_FIRST + i;
|
controller[j].type = HD_CONTROLLER_TYPE_IDE_EXPANSION_FIRST + i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -213,14 +223,16 @@ static void InitEditFilesysHardfile()
|
||||||
|
|
||||||
cmdOK = new gcn::Button("Ok");
|
cmdOK = new gcn::Button("Ok");
|
||||||
cmdOK->setSize(BUTTON_WIDTH, BUTTON_HEIGHT);
|
cmdOK->setSize(BUTTON_WIDTH, BUTTON_HEIGHT);
|
||||||
cmdOK->setPosition(DIALOG_WIDTH - DISTANCE_BORDER - 2 * BUTTON_WIDTH - DISTANCE_NEXT_X, DIALOG_HEIGHT - 2 * DISTANCE_BORDER - BUTTON_HEIGHT - 10);
|
cmdOK->setPosition(DIALOG_WIDTH - DISTANCE_BORDER - 2 * BUTTON_WIDTH - DISTANCE_NEXT_X,
|
||||||
|
DIALOG_HEIGHT - 2 * DISTANCE_BORDER - BUTTON_HEIGHT - 10);
|
||||||
cmdOK->setBaseColor(gui_baseCol);
|
cmdOK->setBaseColor(gui_baseCol);
|
||||||
cmdOK->setId("hdfOK");
|
cmdOK->setId("hdfOK");
|
||||||
cmdOK->addActionListener(filesysHardfileActionListener);
|
cmdOK->addActionListener(filesysHardfileActionListener);
|
||||||
|
|
||||||
cmdCancel = new gcn::Button("Cancel");
|
cmdCancel = new gcn::Button("Cancel");
|
||||||
cmdCancel->setSize(BUTTON_WIDTH, BUTTON_HEIGHT);
|
cmdCancel->setSize(BUTTON_WIDTH, BUTTON_HEIGHT);
|
||||||
cmdCancel->setPosition(DIALOG_WIDTH - DISTANCE_BORDER - BUTTON_WIDTH, DIALOG_HEIGHT - 2 * DISTANCE_BORDER - BUTTON_HEIGHT - 10);
|
cmdCancel->setPosition(DIALOG_WIDTH - DISTANCE_BORDER - BUTTON_WIDTH,
|
||||||
|
DIALOG_HEIGHT - 2 * DISTANCE_BORDER - BUTTON_HEIGHT - 10);
|
||||||
cmdCancel->setBaseColor(gui_baseCol);
|
cmdCancel->setBaseColor(gui_baseCol);
|
||||||
cmdCancel->setId("hdfCancel");
|
cmdCancel->setId("hdfCancel");
|
||||||
cmdCancel->addActionListener(filesysHardfileActionListener);
|
cmdCancel->addActionListener(filesysHardfileActionListener);
|
||||||
|
@ -386,8 +398,8 @@ static void ExitEditFilesysHardfile()
|
||||||
|
|
||||||
static void EditFilesysHardfileLoop()
|
static void EditFilesysHardfileLoop()
|
||||||
{
|
{
|
||||||
// TODO: Check if this is needed in Guisan?
|
FocusBugWorkaround(wndEditFilesysHardfile);
|
||||||
//FocusBugWorkaround(wndEditFilesysHardfile);
|
|
||||||
GUIjoy = SDL_JoystickOpen(0);
|
GUIjoy = SDL_JoystickOpen(0);
|
||||||
|
|
||||||
while (!dialogFinished)
|
while (!dialogFinished)
|
||||||
|
@ -433,67 +445,62 @@ static void EditFilesysHardfileLoop()
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (event.type == SDL_JOYBUTTONDOWN || event.type == SDL_JOYHATMOTION)
|
else if (event.type == SDL_JOYBUTTONDOWN || event.type == SDL_JOYHATMOTION)
|
||||||
{
|
{
|
||||||
gcn::FocusHandler* focusHdl;
|
gcn::FocusHandler* focusHdl;
|
||||||
gcn::Widget* activeWidget;
|
gcn::Widget* activeWidget;
|
||||||
|
|
||||||
int hat = SDL_JoystickGetHat(GUIjoy, 0);
|
const int hat = SDL_JoystickGetHat(GUIjoy, 0);
|
||||||
|
|
||||||
if (SDL_JoystickGetButton(GUIjoy,host_input_buttons[0].dpad_up) || (hat & SDL_HAT_UP)) // dpad
|
if (SDL_JoystickGetButton(GUIjoy, host_input_buttons[0].dpad_up) || (hat & SDL_HAT_UP)) // dpad
|
||||||
{
|
{
|
||||||
|
if (HandleNavigation(DIRECTION_UP))
|
||||||
if(HandleNavigation(DIRECTION_UP))
|
continue; // Don't change value when enter Slider -> don't send event to control
|
||||||
continue; // Don't change value when enter Slider -> don't send event to control
|
PushFakeKey(SDLK_UP);
|
||||||
else
|
break;
|
||||||
{PushFakeKey(SDLK_UP);}
|
}
|
||||||
break;
|
if (SDL_JoystickGetButton(GUIjoy, host_input_buttons[0].dpad_down) || (hat & SDL_HAT_DOWN)) // dpad
|
||||||
|
{
|
||||||
}
|
if (HandleNavigation(DIRECTION_DOWN))
|
||||||
else if (SDL_JoystickGetButton(GUIjoy,host_input_buttons[0].dpad_down) || (hat & SDL_HAT_DOWN)) // dpad
|
continue; // Don't change value when enter Slider -> don't send event to control
|
||||||
{
|
PushFakeKey(SDLK_DOWN);
|
||||||
if(HandleNavigation(DIRECTION_DOWN))
|
break;
|
||||||
continue; // Don't change value when enter Slider -> don't send event to control
|
}
|
||||||
else
|
if (SDL_JoystickGetButton(GUIjoy, host_input_buttons[0].dpad_right) || (hat & SDL_HAT_RIGHT)) // dpad
|
||||||
{PushFakeKey(SDLK_DOWN);}
|
{
|
||||||
break;
|
if (HandleNavigation(DIRECTION_RIGHT))
|
||||||
}
|
continue; // Don't change value when enter Slider -> don't send event to control
|
||||||
else if (SDL_JoystickGetButton(GUIjoy,host_input_buttons[0].dpad_right) || (hat & SDL_HAT_RIGHT)) // dpad
|
PushFakeKey(SDLK_RIGHT);
|
||||||
{
|
break;
|
||||||
if(HandleNavigation(DIRECTION_RIGHT))
|
}
|
||||||
continue; // Don't change value when enter Slider -> don't send event to control
|
if (SDL_JoystickGetButton(GUIjoy, host_input_buttons[0].dpad_left) || (hat & SDL_HAT_LEFT)) // dpad
|
||||||
else
|
{
|
||||||
{PushFakeKey(SDLK_RIGHT);}
|
if (HandleNavigation(DIRECTION_LEFT))
|
||||||
break;
|
continue; // Don't change value when enter Slider -> don't send event to control
|
||||||
}
|
PushFakeKey(SDLK_LEFT);
|
||||||
else if (SDL_JoystickGetButton(GUIjoy,host_input_buttons[0].dpad_left) || (hat & SDL_HAT_LEFT)) // dpad
|
break;
|
||||||
{
|
}
|
||||||
if(HandleNavigation(DIRECTION_LEFT))
|
if (SDL_JoystickGetButton(GUIjoy, host_input_buttons[0].south_button)) // need this to be X button
|
||||||
continue; // Don't change value when enter Slider -> don't send event to control
|
{
|
||||||
else
|
PushFakeKey(SDLK_RETURN);
|
||||||
{PushFakeKey(SDLK_LEFT);}
|
break;
|
||||||
break;
|
}
|
||||||
}
|
if (SDL_JoystickGetButton(GUIjoy, host_input_buttons[0].east_button) ||
|
||||||
|
SDL_JoystickGetButton(GUIjoy, host_input_buttons[0].start_button)) // need this to be START button
|
||||||
else if (SDL_JoystickGetButton(GUIjoy,host_input_buttons[0].south_button)) // need this to be X button
|
{
|
||||||
{
|
dialogFinished = true;
|
||||||
PushFakeKey(SDLK_RETURN);
|
break;
|
||||||
continue; }
|
}
|
||||||
|
}
|
||||||
else if (SDL_JoystickGetButton(GUIjoy,host_input_buttons[0].east_button) ||
|
//-------------------------------------------------
|
||||||
SDL_JoystickGetButton(GUIjoy,host_input_buttons[0].start_button)) // need this to be START button
|
// Send event to guichan-controls
|
||||||
{ dialogFinished = true;
|
//-------------------------------------------------
|
||||||
break;}
|
|
||||||
}
|
|
||||||
//-------------------------------------------------
|
|
||||||
// Send event to guichan-controls
|
|
||||||
//-------------------------------------------------
|
|
||||||
#ifdef ANDROIDSDL
|
#ifdef ANDROIDSDL
|
||||||
androidsdl_event(event, gui_input);
|
androidsdl_event(event, gui_input);
|
||||||
#else
|
#else
|
||||||
gui_input->pushInput(event);
|
gui_input->pushInput(event);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now we let the Gui object perform its logic.
|
// Now we let the Gui object perform its logic.
|
||||||
uae_gui->logic();
|
uae_gui->logic();
|
||||||
|
@ -506,7 +513,7 @@ static void EditFilesysHardfileLoop()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool EditFilesysHardfile(int unit_no)
|
bool EditFilesysHardfile(const int unit_no)
|
||||||
{
|
{
|
||||||
struct mountedinfo mi;
|
struct mountedinfo mi;
|
||||||
struct uaedev_config_data* uci;
|
struct uaedev_config_data* uci;
|
||||||
|
@ -521,7 +528,7 @@ bool EditFilesysHardfile(int unit_no)
|
||||||
if (unit_no >= 0)
|
if (unit_no >= 0)
|
||||||
{
|
{
|
||||||
uci = &changed_prefs.mountconfig[unit_no];
|
uci = &changed_prefs.mountconfig[unit_no];
|
||||||
struct uaedev_config_info * ci = &uci->ci;
|
struct uaedev_config_info* ci = &uci->ci;
|
||||||
get_filesys_unitconfig(&changed_prefs, unit_no, &mi);
|
get_filesys_unitconfig(&changed_prefs, unit_no, &mi);
|
||||||
|
|
||||||
strdevname.assign(ci->devname);
|
strdevname.assign(ci->devname);
|
||||||
|
@ -543,7 +550,8 @@ bool EditFilesysHardfile(int unit_no)
|
||||||
snprintf(tmp, sizeof tmp, "%d", ci->blocksize);
|
snprintf(tmp, sizeof tmp, "%d", ci->blocksize);
|
||||||
txtBlocksize->setText(tmp);
|
txtBlocksize->setText(tmp);
|
||||||
int selIndex = 0;
|
int selIndex = 0;
|
||||||
for (int i = 0; i < 2; ++i) {
|
for (int i = 0; i < 2; ++i)
|
||||||
|
{
|
||||||
if (controller[i].type == ci->controller_type)
|
if (controller[i].type == ci->controller_type)
|
||||||
selIndex = i;
|
selIndex = i;
|
||||||
}
|
}
|
||||||
|
@ -575,12 +583,12 @@ bool EditFilesysHardfile(int unit_no)
|
||||||
if (dialogResult)
|
if (dialogResult)
|
||||||
{
|
{
|
||||||
struct uaedev_config_info ci;
|
struct uaedev_config_info ci;
|
||||||
int bp = tweakbootpri(atoi(txtBootPri->getText().c_str()), chkAutoboot->isSelected() ? 1 : 0, 0);
|
const int bp = tweakbootpri(atoi(txtBootPri->getText().c_str()), chkAutoboot->isSelected() ? 1 : 0, 0);
|
||||||
extractPath(const_cast<char *>(txtPath->getText().c_str()), currentDir);
|
extractPath(const_cast<char *>(txtPath->getText().c_str()), currentDir);
|
||||||
|
|
||||||
uci_set_defaults(&ci, false);
|
uci_set_defaults(&ci, false);
|
||||||
strncpy(ci.devname, (char *) txtDevice->getText().c_str(), MAX_DPATH);
|
strncpy(ci.devname, const_cast<char *>(txtDevice->getText().c_str()), MAX_DPATH);
|
||||||
strncpy(ci.rootdir, (char *) txtPath->getText().c_str(), MAX_DPATH);
|
strncpy(ci.rootdir, const_cast<char *>(txtPath->getText().c_str()), MAX_DPATH);
|
||||||
ci.type = UAEDEV_HDF;
|
ci.type = UAEDEV_HDF;
|
||||||
ci.controller_type = controller[cboController->getSelected()].type;
|
ci.controller_type = controller[cboController->getSelected()].type;
|
||||||
ci.controller_type_unit = 0;
|
ci.controller_type_unit = 0;
|
||||||
|
@ -599,7 +607,7 @@ bool EditFilesysHardfile(int unit_no)
|
||||||
uci = add_filesys_config(&changed_prefs, unit_no, &ci);
|
uci = add_filesys_config(&changed_prefs, unit_no, &ci);
|
||||||
if (uci)
|
if (uci)
|
||||||
{
|
{
|
||||||
struct hardfiledata *hfd = get_hardfile_data(uci->configoffset);
|
struct hardfiledata* hfd = get_hardfile_data(uci->configoffset);
|
||||||
if (hfd)
|
if (hfd)
|
||||||
hardfile_media_change(hfd, &ci, true, false);
|
hardfile_media_change(hfd, &ci, true, false);
|
||||||
else
|
else
|
||||||
|
|
|
@ -27,10 +27,10 @@
|
||||||
#define DIALOG_WIDTH 520
|
#define DIALOG_WIDTH 520
|
||||||
#define DIALOG_HEIGHT 202
|
#define DIALOG_HEIGHT 202
|
||||||
|
|
||||||
static SDL_Joystick *GUIjoy;
|
static SDL_Joystick* GUIjoy;
|
||||||
extern struct host_input_button host_input_buttons[MAX_INPUT_DEVICES];
|
extern struct host_input_button host_input_buttons[MAX_INPUT_DEVICES];
|
||||||
|
|
||||||
extern std::string volName;
|
extern string volName;
|
||||||
|
|
||||||
static bool dialogResult = false;
|
static bool dialogResult = false;
|
||||||
static bool dialogFinished = false;
|
static bool dialogFinished = false;
|
||||||
|
@ -106,14 +106,16 @@ static void InitEditFilesysVirtual()
|
||||||
|
|
||||||
cmdOK = new gcn::Button("Ok");
|
cmdOK = new gcn::Button("Ok");
|
||||||
cmdOK->setSize(BUTTON_WIDTH, BUTTON_HEIGHT);
|
cmdOK->setSize(BUTTON_WIDTH, BUTTON_HEIGHT);
|
||||||
cmdOK->setPosition(DIALOG_WIDTH - DISTANCE_BORDER - 2 * BUTTON_WIDTH - DISTANCE_NEXT_X, DIALOG_HEIGHT - 2 * DISTANCE_BORDER - BUTTON_HEIGHT - 10);
|
cmdOK->setPosition(DIALOG_WIDTH - DISTANCE_BORDER - 2 * BUTTON_WIDTH - DISTANCE_NEXT_X,
|
||||||
|
DIALOG_HEIGHT - 2 * DISTANCE_BORDER - BUTTON_HEIGHT - 10);
|
||||||
cmdOK->setBaseColor(gui_baseCol);
|
cmdOK->setBaseColor(gui_baseCol);
|
||||||
cmdOK->setId("virtOK");
|
cmdOK->setId("virtOK");
|
||||||
cmdOK->addActionListener(filesysVirtualActionListener);
|
cmdOK->addActionListener(filesysVirtualActionListener);
|
||||||
|
|
||||||
cmdCancel = new gcn::Button("Cancel");
|
cmdCancel = new gcn::Button("Cancel");
|
||||||
cmdCancel->setSize(BUTTON_WIDTH, BUTTON_HEIGHT);
|
cmdCancel->setSize(BUTTON_WIDTH, BUTTON_HEIGHT);
|
||||||
cmdCancel->setPosition(DIALOG_WIDTH - DISTANCE_BORDER - BUTTON_WIDTH, DIALOG_HEIGHT - 2 * DISTANCE_BORDER - BUTTON_HEIGHT - 10);
|
cmdCancel->setPosition(DIALOG_WIDTH - DISTANCE_BORDER - BUTTON_WIDTH,
|
||||||
|
DIALOG_HEIGHT - 2 * DISTANCE_BORDER - BUTTON_HEIGHT - 10);
|
||||||
cmdCancel->setBaseColor(gui_baseCol);
|
cmdCancel->setBaseColor(gui_baseCol);
|
||||||
cmdCancel->setId("virtCancel");
|
cmdCancel->setId("virtCancel");
|
||||||
cmdCancel->addActionListener(filesysVirtualActionListener);
|
cmdCancel->addActionListener(filesysVirtualActionListener);
|
||||||
|
@ -221,6 +223,8 @@ static void ExitEditFilesysVirtual()
|
||||||
|
|
||||||
static void EditFilesysVirtualLoop()
|
static void EditFilesysVirtualLoop()
|
||||||
{
|
{
|
||||||
|
FocusBugWorkaround(wndEditFilesysVirtual);
|
||||||
|
|
||||||
GUIjoy = SDL_JoystickOpen(0);
|
GUIjoy = SDL_JoystickOpen(0);
|
||||||
while (!dialogFinished)
|
while (!dialogFinished)
|
||||||
{
|
{
|
||||||
|
@ -265,67 +269,62 @@ static void EditFilesysVirtualLoop()
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (event.type == SDL_JOYBUTTONDOWN || event.type == SDL_JOYHATMOTION)
|
else if (event.type == SDL_JOYBUTTONDOWN || event.type == SDL_JOYHATMOTION)
|
||||||
{
|
{
|
||||||
gcn::FocusHandler* focusHdl;
|
gcn::FocusHandler* focusHdl;
|
||||||
gcn::Widget* activeWidget;
|
gcn::Widget* activeWidget;
|
||||||
|
|
||||||
int hat = SDL_JoystickGetHat(GUIjoy, 0);
|
const int hat = SDL_JoystickGetHat(GUIjoy, 0);
|
||||||
|
|
||||||
if (SDL_JoystickGetButton(GUIjoy,host_input_buttons[0].dpad_up) || (hat & SDL_HAT_UP)) // dpad
|
if (SDL_JoystickGetButton(GUIjoy, host_input_buttons[0].dpad_up) || (hat & SDL_HAT_UP)) // dpad
|
||||||
{
|
{
|
||||||
|
if (HandleNavigation(DIRECTION_UP))
|
||||||
if(HandleNavigation(DIRECTION_UP))
|
continue; // Don't change value when enter Slider -> don't send event to control
|
||||||
continue; // Don't change value when enter Slider -> don't send event to control
|
PushFakeKey(SDLK_UP);
|
||||||
else
|
break;
|
||||||
{PushFakeKey(SDLK_UP);}
|
}
|
||||||
break;
|
if (SDL_JoystickGetButton(GUIjoy, host_input_buttons[0].dpad_down) || (hat & SDL_HAT_DOWN)) // dpad
|
||||||
|
{
|
||||||
}
|
if (HandleNavigation(DIRECTION_DOWN))
|
||||||
else if (SDL_JoystickGetButton(GUIjoy,host_input_buttons[0].dpad_down) || (hat & SDL_HAT_DOWN)) // dpad
|
continue; // Don't change value when enter Slider -> don't send event to control
|
||||||
{
|
PushFakeKey(SDLK_DOWN);
|
||||||
if(HandleNavigation(DIRECTION_DOWN))
|
break;
|
||||||
continue; // Don't change value when enter Slider -> don't send event to control
|
}
|
||||||
else
|
if (SDL_JoystickGetButton(GUIjoy, host_input_buttons[0].dpad_right) || (hat & SDL_HAT_RIGHT)) // dpad
|
||||||
{PushFakeKey(SDLK_DOWN);}
|
{
|
||||||
break;
|
if (HandleNavigation(DIRECTION_RIGHT))
|
||||||
}
|
continue; // Don't change value when enter Slider -> don't send event to control
|
||||||
else if (SDL_JoystickGetButton(GUIjoy,host_input_buttons[0].dpad_right) || (hat & SDL_HAT_RIGHT)) // dpad
|
PushFakeKey(SDLK_RIGHT);
|
||||||
{
|
break;
|
||||||
if(HandleNavigation(DIRECTION_RIGHT))
|
}
|
||||||
continue; // Don't change value when enter Slider -> don't send event to control
|
if (SDL_JoystickGetButton(GUIjoy, host_input_buttons[0].dpad_left) || (hat & SDL_HAT_LEFT)) // dpad
|
||||||
else
|
{
|
||||||
{PushFakeKey(SDLK_RIGHT);}
|
if (HandleNavigation(DIRECTION_LEFT))
|
||||||
break;
|
continue; // Don't change value when enter Slider -> don't send event to control
|
||||||
}
|
PushFakeKey(SDLK_LEFT);
|
||||||
else if (SDL_JoystickGetButton(GUIjoy,host_input_buttons[0].dpad_left) || (hat & SDL_HAT_LEFT)) // dpad
|
break;
|
||||||
{
|
}
|
||||||
if(HandleNavigation(DIRECTION_LEFT))
|
if (SDL_JoystickGetButton(GUIjoy, host_input_buttons[0].south_button)) // need this to be X button
|
||||||
continue; // Don't change value when enter Slider -> don't send event to control
|
{
|
||||||
else
|
PushFakeKey(SDLK_RETURN);
|
||||||
{PushFakeKey(SDLK_LEFT);}
|
break;
|
||||||
break;
|
}
|
||||||
}
|
if (SDL_JoystickGetButton(GUIjoy, host_input_buttons[0].east_button) ||
|
||||||
|
SDL_JoystickGetButton(GUIjoy, host_input_buttons[0].start_button)) // need this to be START button
|
||||||
else if (SDL_JoystickGetButton(GUIjoy,host_input_buttons[0].south_button)) // need this to be X button
|
{
|
||||||
{
|
dialogFinished = true;
|
||||||
PushFakeKey(SDLK_RETURN);
|
break;
|
||||||
continue; }
|
}
|
||||||
|
}
|
||||||
else if (SDL_JoystickGetButton(GUIjoy,host_input_buttons[0].east_button) ||
|
//-------------------------------------------------
|
||||||
SDL_JoystickGetButton(GUIjoy,host_input_buttons[0].start_button)) // need this to be START button
|
// Send event to guichan-controls
|
||||||
{ dialogFinished = true;
|
//-------------------------------------------------
|
||||||
break;}
|
|
||||||
}
|
|
||||||
//-------------------------------------------------
|
|
||||||
// Send event to guichan-controls
|
|
||||||
//-------------------------------------------------
|
|
||||||
#ifdef ANDROIDSDL
|
#ifdef ANDROIDSDL
|
||||||
androidsdl_event(event, gui_input);
|
androidsdl_event(event, gui_input);
|
||||||
#else
|
#else
|
||||||
gui_input->pushInput(event);
|
gui_input->pushInput(event);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now we let the Gui object perform its logic.
|
// Now we let the Gui object perform its logic.
|
||||||
uae_gui->logic();
|
uae_gui->logic();
|
||||||
|
@ -338,7 +337,7 @@ static void EditFilesysVirtualLoop()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool EditFilesysVirtual(int unit_no)
|
bool EditFilesysVirtual(const int unit_no)
|
||||||
{
|
{
|
||||||
struct mountedinfo mi;
|
struct mountedinfo mi;
|
||||||
struct uaedev_config_data* uci;
|
struct uaedev_config_data* uci;
|
||||||
|
@ -353,7 +352,7 @@ bool EditFilesysVirtual(int unit_no)
|
||||||
if (unit_no >= 0)
|
if (unit_no >= 0)
|
||||||
{
|
{
|
||||||
uci = &changed_prefs.mountconfig[unit_no];
|
uci = &changed_prefs.mountconfig[unit_no];
|
||||||
struct uaedev_config_info * ci = &uci->ci;
|
struct uaedev_config_info* ci = &uci->ci;
|
||||||
get_filesys_unitconfig(&changed_prefs, unit_no, &mi);
|
get_filesys_unitconfig(&changed_prefs, unit_no, &mi);
|
||||||
|
|
||||||
strdevname.assign(ci->devname);
|
strdevname.assign(ci->devname);
|
||||||
|
@ -383,13 +382,13 @@ bool EditFilesysVirtual(int unit_no)
|
||||||
if (dialogResult)
|
if (dialogResult)
|
||||||
{
|
{
|
||||||
struct uaedev_config_info ci;
|
struct uaedev_config_info ci;
|
||||||
int bp = tweakbootpri(atoi(txtBootPri->getText().c_str()), chkAutoboot->isSelected() ? 1 : 0, 0);
|
const int bp = tweakbootpri(atoi(txtBootPri->getText().c_str()), chkAutoboot->isSelected() ? 1 : 0, 0);
|
||||||
extractPath(const_cast<char *>(txtPath->getText().c_str()), currentDir);
|
extractPath(const_cast<char *>(txtPath->getText().c_str()), currentDir);
|
||||||
|
|
||||||
uci_set_defaults(&ci, true);
|
uci_set_defaults(&ci, true);
|
||||||
strncpy(ci.devname, (char *) txtDevice->getText().c_str(), MAX_DPATH);
|
strncpy(ci.devname, const_cast<char *>(txtDevice->getText().c_str()), MAX_DPATH);
|
||||||
strncpy(ci.volname, (char *) txtVolume->getText().c_str(), MAX_DPATH);
|
strncpy(ci.volname, const_cast<char *>(txtVolume->getText().c_str()), MAX_DPATH);
|
||||||
strncpy(ci.rootdir, (char *) txtPath->getText().c_str(), MAX_DPATH);
|
strncpy(ci.rootdir, const_cast<char *>(txtPath->getText().c_str()), MAX_DPATH);
|
||||||
ci.type = UAEDEV_DIR;
|
ci.type = UAEDEV_DIR;
|
||||||
ci.readonly = !chkReadWrite->isSelected();
|
ci.readonly = !chkReadWrite->isSelected();
|
||||||
ci.bootpri = bp;
|
ci.bootpri = bp;
|
||||||
|
|
|
@ -65,7 +65,7 @@ static gcn::Label* lblCDVolInfo;
|
||||||
static gcn::Slider* sldCDVol;
|
static gcn::Slider* sldCDVol;
|
||||||
|
|
||||||
|
|
||||||
static int GetHDType(int index)
|
static int GetHDType(const int index)
|
||||||
{
|
{
|
||||||
struct mountedinfo mi;
|
struct mountedinfo mi;
|
||||||
|
|
||||||
|
@ -273,7 +273,7 @@ public:
|
||||||
{
|
{
|
||||||
if (actionEvent.getSource() == sldCDVol)
|
if (actionEvent.getSource() == sldCDVol)
|
||||||
{
|
{
|
||||||
int newvol = 100 - (int)sldCDVol->getValue();
|
const int newvol = 100 - int(sldCDVol->getValue());
|
||||||
if (changed_prefs.sound_volume_cd != newvol)
|
if (changed_prefs.sound_volume_cd != newvol)
|
||||||
{
|
{
|
||||||
changed_prefs.sound_volume_cd = newvol;
|
changed_prefs.sound_volume_cd = newvol;
|
||||||
|
@ -301,7 +301,7 @@ public:
|
||||||
//---------------------------------------
|
//---------------------------------------
|
||||||
if (!bIgnoreListChange)
|
if (!bIgnoreListChange)
|
||||||
{
|
{
|
||||||
int idx = cboCDFile->getSelected();
|
const int idx = cboCDFile->getSelected();
|
||||||
|
|
||||||
if (idx < 0)
|
if (idx < 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
#define FILE_SELECT_KEEP_POSITION
|
#define FILE_SELECT_KEEP_POSITION
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static SDL_Joystick *GUIjoy;
|
static SDL_Joystick* GUIjoy;
|
||||||
extern struct host_input_button host_input_buttons[MAX_INPUT_DEVICES];
|
extern struct host_input_button host_input_buttons[MAX_INPUT_DEVICES];
|
||||||
|
|
||||||
static bool dialogResult = false;
|
static bool dialogResult = false;
|
||||||
|
@ -98,14 +98,14 @@ public:
|
||||||
{
|
{
|
||||||
if (actionEvent.getSource() == cmdOK)
|
if (actionEvent.getSource() == cmdOK)
|
||||||
{
|
{
|
||||||
int selected_item = lstFiles->getSelected();
|
const int selected_item = lstFiles->getSelected();
|
||||||
if (createNew)
|
if (createNew)
|
||||||
{
|
{
|
||||||
char tmp[MAX_PATH];
|
char tmp[MAX_PATH];
|
||||||
if (txtFilename->getText().length() <= 0)
|
if (txtFilename->getText().length() <= 0)
|
||||||
return;
|
return;
|
||||||
strncpy(tmp, workingDir, MAX_PATH - 1);
|
strncpy(tmp, workingDir, MAX_PATH - 1);
|
||||||
strncat(tmp, "/", MAX_PATH - 1);
|
strncat(tmp, "/", MAX_PATH - 1);
|
||||||
strncat(tmp, txtFilename->getText().c_str(), MAX_PATH - 1);
|
strncat(tmp, txtFilename->getText().c_str(), MAX_PATH - 1);
|
||||||
if (strstr(tmp, filefilter[0]) == nullptr)
|
if (strstr(tmp, filefilter[0]) == nullptr)
|
||||||
strncat(tmp, filefilter[0], MAX_PATH - 1);
|
strncat(tmp, filefilter[0], MAX_PATH - 1);
|
||||||
|
@ -119,7 +119,7 @@ public:
|
||||||
if (fileList->isDir(selected_item))
|
if (fileList->isDir(selected_item))
|
||||||
return; // Directory selected -> Ok not possible
|
return; // Directory selected -> Ok not possible
|
||||||
strncat(workingDir, "/", MAX_PATH - 1);
|
strncat(workingDir, "/", MAX_PATH - 1);
|
||||||
strncat(workingDir, fileList->getElementAt(selected_item).c_str(), MAX_PATH - 1);
|
strncat(workingDir, fileList->getElementAt(selected_item).c_str(), MAX_PATH - 1);
|
||||||
dialogResult = true;
|
dialogResult = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -138,7 +138,7 @@ static void checkfoldername(char* current)
|
||||||
if ((dir = opendir(current)))
|
if ((dir = opendir(current)))
|
||||||
{
|
{
|
||||||
fileList->changeDir(current);
|
fileList->changeDir(current);
|
||||||
char * ptr = realpath(current, actualpath);
|
char* ptr = realpath(current, actualpath);
|
||||||
strncpy(workingDir, ptr, MAX_PATH);
|
strncpy(workingDir, ptr, MAX_PATH);
|
||||||
closedir(dir);
|
closedir(dir);
|
||||||
}
|
}
|
||||||
|
@ -170,10 +170,10 @@ public:
|
||||||
{
|
{
|
||||||
char foldername[MAX_PATH] = "";
|
char foldername[MAX_PATH] = "";
|
||||||
|
|
||||||
int selected_item = lstFiles->getSelected();
|
const int selected_item = lstFiles->getSelected();
|
||||||
strncpy(foldername, workingDir, MAX_PATH);
|
strncpy(foldername, workingDir, MAX_PATH);
|
||||||
strncat(foldername, "/", MAX_PATH - 1);
|
strncat(foldername, "/", MAX_PATH - 1);
|
||||||
strncat(foldername, fileList->getElementAt(selected_item).c_str(), MAX_PATH - 1);
|
strncat(foldername, fileList->getElementAt(selected_item).c_str(), MAX_PATH - 1);
|
||||||
if (fileList->isDir(selected_item))
|
if (fileList->isDir(selected_item))
|
||||||
checkfoldername(foldername);
|
checkfoldername(foldername);
|
||||||
else if (!createNew)
|
else if (!createNew)
|
||||||
|
@ -201,13 +201,15 @@ static void InitSelectFile(const char* title)
|
||||||
|
|
||||||
cmdOK = new gcn::Button("Ok");
|
cmdOK = new gcn::Button("Ok");
|
||||||
cmdOK->setSize(BUTTON_WIDTH, BUTTON_HEIGHT);
|
cmdOK->setSize(BUTTON_WIDTH, BUTTON_HEIGHT);
|
||||||
cmdOK->setPosition(DIALOG_WIDTH - DISTANCE_BORDER - 2 * BUTTON_WIDTH - DISTANCE_NEXT_X, DIALOG_HEIGHT - 2 * DISTANCE_BORDER - BUTTON_HEIGHT - 10);
|
cmdOK->setPosition(DIALOG_WIDTH - DISTANCE_BORDER - 2 * BUTTON_WIDTH - DISTANCE_NEXT_X,
|
||||||
|
DIALOG_HEIGHT - 2 * DISTANCE_BORDER - BUTTON_HEIGHT - 10);
|
||||||
cmdOK->setBaseColor(gui_baseCol);
|
cmdOK->setBaseColor(gui_baseCol);
|
||||||
cmdOK->addActionListener(fileButtonActionListener);
|
cmdOK->addActionListener(fileButtonActionListener);
|
||||||
|
|
||||||
cmdCancel = new gcn::Button("Cancel");
|
cmdCancel = new gcn::Button("Cancel");
|
||||||
cmdCancel->setSize(BUTTON_WIDTH, BUTTON_HEIGHT);
|
cmdCancel->setSize(BUTTON_WIDTH, BUTTON_HEIGHT);
|
||||||
cmdCancel->setPosition(DIALOG_WIDTH - DISTANCE_BORDER - BUTTON_WIDTH, DIALOG_HEIGHT - 2 * DISTANCE_BORDER - BUTTON_HEIGHT - 10);
|
cmdCancel->setPosition(DIALOG_WIDTH - DISTANCE_BORDER - BUTTON_WIDTH,
|
||||||
|
DIALOG_HEIGHT - 2 * DISTANCE_BORDER - BUTTON_HEIGHT - 10);
|
||||||
cmdCancel->setBaseColor(gui_baseCol);
|
cmdCancel->setBaseColor(gui_baseCol);
|
||||||
cmdCancel->addActionListener(fileButtonActionListener);
|
cmdCancel->addActionListener(fileButtonActionListener);
|
||||||
|
|
||||||
|
@ -287,8 +289,8 @@ static void ExitSelectFile()
|
||||||
|
|
||||||
static void SelectFileLoop()
|
static void SelectFileLoop()
|
||||||
{
|
{
|
||||||
//TODO: is this needed in guisan?
|
FocusBugWorkaround(wndSelectFile);
|
||||||
//FocusBugWorkaround(wndSelectFile);
|
|
||||||
GUIjoy = SDL_JoystickOpen(0);
|
GUIjoy = SDL_JoystickOpen(0);
|
||||||
|
|
||||||
while (!dialogFinished)
|
while (!dialogFinished)
|
||||||
|
@ -319,7 +321,6 @@ static void SelectFileLoop()
|
||||||
lstFiles->requestFocus();
|
lstFiles->requestFocus();
|
||||||
else if (activeWidget == txtFilename)
|
else if (activeWidget == txtFilename)
|
||||||
lstFiles->requestFocus();
|
lstFiles->requestFocus();
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -338,7 +339,6 @@ static void SelectFileLoop()
|
||||||
lstFiles->requestFocus();
|
lstFiles->requestFocus();
|
||||||
else if (activeWidget == cmdOK)
|
else if (activeWidget == cmdOK)
|
||||||
cmdCancel->requestFocus();
|
cmdCancel->requestFocus();
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -352,74 +352,74 @@ static void SelectFileLoop()
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (event.type == SDL_JOYBUTTONDOWN || event.type == SDL_JOYHATMOTION)
|
else if (event.type == SDL_JOYBUTTONDOWN || event.type == SDL_JOYHATMOTION)
|
||||||
{
|
{
|
||||||
int hat = SDL_JoystickGetHat(GUIjoy, 0);
|
const int hat = SDL_JoystickGetHat(GUIjoy, 0);
|
||||||
|
|
||||||
if (SDL_JoystickGetButton(GUIjoy,host_input_buttons[0].south_button))
|
if (SDL_JoystickGetButton(GUIjoy, host_input_buttons[0].south_button))
|
||||||
{PushFakeKey(SDLK_RETURN);
|
{
|
||||||
break;}
|
PushFakeKey(SDLK_RETURN);
|
||||||
|
break;
|
||||||
else if (SDL_JoystickGetButton(GUIjoy,host_input_buttons[0].east_button) ||
|
}
|
||||||
SDL_JoystickGetButton(GUIjoy,host_input_buttons[0].start_button))
|
if (SDL_JoystickGetButton(GUIjoy, host_input_buttons[0].east_button) ||
|
||||||
{dialogFinished = true;
|
SDL_JoystickGetButton(GUIjoy, host_input_buttons[0].start_button))
|
||||||
break;}
|
{
|
||||||
|
dialogFinished = true;
|
||||||
else if (SDL_JoystickGetButton(GUIjoy,host_input_buttons[0].dpad_left) || (hat & SDL_HAT_LEFT))
|
break;
|
||||||
{
|
}
|
||||||
gcn::FocusHandler* focusHdl = gui_top->_getFocusHandler();
|
if (SDL_JoystickGetButton(GUIjoy, host_input_buttons[0].dpad_left) || (hat & SDL_HAT_LEFT))
|
||||||
gcn::Widget* activeWidget = focusHdl->getFocused();
|
{
|
||||||
if(activeWidget == lstFiles)
|
gcn::FocusHandler* focusHdl = gui_top->_getFocusHandler();
|
||||||
cmdCancel->requestFocus();
|
gcn::Widget* activeWidget = focusHdl->getFocused();
|
||||||
else if(activeWidget == cmdCancel)
|
if (activeWidget == lstFiles)
|
||||||
cmdOK->requestFocus();
|
cmdCancel->requestFocus();
|
||||||
else if(activeWidget == cmdOK)
|
else if (activeWidget == cmdCancel)
|
||||||
if(createNew)
|
cmdOK->requestFocus();
|
||||||
txtFilename->requestFocus();
|
else if (activeWidget == cmdOK)
|
||||||
else
|
if (createNew)
|
||||||
lstFiles->requestFocus();
|
txtFilename->requestFocus();
|
||||||
else if(activeWidget == txtFilename)
|
else
|
||||||
lstFiles->requestFocus();
|
lstFiles->requestFocus();
|
||||||
continue;
|
else if (activeWidget == txtFilename)
|
||||||
}
|
lstFiles->requestFocus();
|
||||||
|
break;
|
||||||
|
}
|
||||||
else if (SDL_JoystickGetButton(GUIjoy,host_input_buttons[0].dpad_right) || (hat & SDL_HAT_RIGHT))
|
if (SDL_JoystickGetButton(GUIjoy, host_input_buttons[0].dpad_right) || (hat & SDL_HAT_RIGHT))
|
||||||
{
|
{
|
||||||
gcn::FocusHandler* focusHdl = gui_top->_getFocusHandler();
|
gcn::FocusHandler* focusHdl = gui_top->_getFocusHandler();
|
||||||
gcn::Widget* activeWidget = focusHdl->getFocused();
|
gcn::Widget* activeWidget = focusHdl->getFocused();
|
||||||
if(activeWidget == lstFiles)
|
if (activeWidget == lstFiles)
|
||||||
if(createNew)
|
if (createNew)
|
||||||
txtFilename->requestFocus();
|
txtFilename->requestFocus();
|
||||||
else
|
else
|
||||||
cmdOK->requestFocus();
|
cmdOK->requestFocus();
|
||||||
else if(activeWidget == txtFilename)
|
else if (activeWidget == txtFilename)
|
||||||
cmdOK->requestFocus();
|
cmdOK->requestFocus();
|
||||||
else if(activeWidget == cmdCancel)
|
else if (activeWidget == cmdCancel)
|
||||||
lstFiles->requestFocus();
|
lstFiles->requestFocus();
|
||||||
else if(activeWidget == cmdOK)
|
else if (activeWidget == cmdOK)
|
||||||
cmdCancel->requestFocus();
|
cmdCancel->requestFocus();
|
||||||
continue;
|
break;
|
||||||
}
|
}
|
||||||
|
if (SDL_JoystickGetButton(GUIjoy, host_input_buttons[0].dpad_up) || (hat & SDL_HAT_UP))
|
||||||
else if (SDL_JoystickGetButton(GUIjoy,host_input_buttons[0].dpad_up) || (hat & SDL_HAT_UP))
|
{
|
||||||
{PushFakeKey(SDLK_UP);
|
PushFakeKey(SDLK_UP);
|
||||||
break;}
|
break;
|
||||||
|
}
|
||||||
else if (SDL_JoystickGetButton(GUIjoy,host_input_buttons[0].dpad_down) || (hat & SDL_HAT_DOWN))
|
if (SDL_JoystickGetButton(GUIjoy, host_input_buttons[0].dpad_down) || (hat & SDL_HAT_DOWN))
|
||||||
{PushFakeKey(SDLK_DOWN);
|
{
|
||||||
break;}
|
PushFakeKey(SDLK_DOWN);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
// Send event to guisan-controls
|
// Send event to guisan-controls
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
#ifdef ANDROIDSDL
|
#ifdef ANDROIDSDL
|
||||||
androidsdl_event(event, gui_input);
|
androidsdl_event(event, gui_input);
|
||||||
#else
|
#else
|
||||||
gui_input->pushInput(event);
|
gui_input->pushInput(event);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -444,7 +444,7 @@ static void SelectFileLoop()
|
||||||
static int Already_init = 0;
|
static int Already_init = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool SelectFile(const char* title, char* value, const char* filter[], bool create)
|
bool SelectFile(const char* title, char* value, const char* filter[], const bool create)
|
||||||
{
|
{
|
||||||
dialogResult = false;
|
dialogResult = false;
|
||||||
dialogFinished = false;
|
dialogFinished = false;
|
||||||
|
|
|
@ -23,12 +23,12 @@
|
||||||
#define DIALOG_WIDTH 520
|
#define DIALOG_WIDTH 520
|
||||||
#define DIALOG_HEIGHT 400
|
#define DIALOG_HEIGHT 400
|
||||||
|
|
||||||
std::string volName;
|
string volName;
|
||||||
static bool dialogResult = false;
|
static bool dialogResult = false;
|
||||||
static bool dialogFinished = false;
|
static bool dialogFinished = false;
|
||||||
static char workingDir[MAX_PATH];
|
static char workingDir[MAX_PATH];
|
||||||
|
|
||||||
static SDL_Joystick *GUIjoy;
|
static SDL_Joystick* GUIjoy;
|
||||||
extern struct host_input_button host_input_buttons[MAX_INPUT_DEVICES];
|
extern struct host_input_button host_input_buttons[MAX_INPUT_DEVICES];
|
||||||
static gcn::Window* wndSelectFolder;
|
static gcn::Window* wndSelectFolder;
|
||||||
static gcn::Button* cmdOK;
|
static gcn::Button* cmdOK;
|
||||||
|
@ -95,7 +95,7 @@ static void checkfoldername(char* current)
|
||||||
if ((dir = opendir(current)))
|
if ((dir = opendir(current)))
|
||||||
{
|
{
|
||||||
dirList = current;
|
dirList = current;
|
||||||
char * ptr = realpath(current, actualpath);
|
char* ptr = realpath(current, actualpath);
|
||||||
strncpy(workingDir, ptr, MAX_PATH);
|
strncpy(workingDir, ptr, MAX_PATH);
|
||||||
closedir(dir);
|
closedir(dir);
|
||||||
}
|
}
|
||||||
|
@ -112,7 +112,7 @@ public:
|
||||||
{
|
{
|
||||||
char foldername[MAX_PATH] = "";
|
char foldername[MAX_PATH] = "";
|
||||||
|
|
||||||
int selected_item = lstFolders->getSelected();
|
const int selected_item = lstFolders->getSelected();
|
||||||
strncpy(foldername, workingDir, MAX_PATH - 1);
|
strncpy(foldername, workingDir, MAX_PATH - 1);
|
||||||
strncat(foldername, "/", MAX_PATH - 1);
|
strncat(foldername, "/", MAX_PATH - 1);
|
||||||
strncat(foldername, dirList.getElementAt(selected_item).c_str(), MAX_PATH - 1);
|
strncat(foldername, dirList.getElementAt(selected_item).c_str(), MAX_PATH - 1);
|
||||||
|
@ -137,13 +137,15 @@ static void InitSelectFolder(const char* title)
|
||||||
|
|
||||||
cmdOK = new gcn::Button("Ok");
|
cmdOK = new gcn::Button("Ok");
|
||||||
cmdOK->setSize(BUTTON_WIDTH, BUTTON_HEIGHT);
|
cmdOK->setSize(BUTTON_WIDTH, BUTTON_HEIGHT);
|
||||||
cmdOK->setPosition(DIALOG_WIDTH - DISTANCE_BORDER - 2 * BUTTON_WIDTH - DISTANCE_NEXT_X, DIALOG_HEIGHT - 2 * DISTANCE_BORDER - BUTTON_HEIGHT - 10);
|
cmdOK->setPosition(DIALOG_WIDTH - DISTANCE_BORDER - 2 * BUTTON_WIDTH - DISTANCE_NEXT_X,
|
||||||
|
DIALOG_HEIGHT - 2 * DISTANCE_BORDER - BUTTON_HEIGHT - 10);
|
||||||
cmdOK->setBaseColor(gui_baseCol);
|
cmdOK->setBaseColor(gui_baseCol);
|
||||||
cmdOK->addActionListener(buttonActionListener);
|
cmdOK->addActionListener(buttonActionListener);
|
||||||
|
|
||||||
cmdCancel = new gcn::Button("Cancel");
|
cmdCancel = new gcn::Button("Cancel");
|
||||||
cmdCancel->setSize(BUTTON_WIDTH, BUTTON_HEIGHT);
|
cmdCancel->setSize(BUTTON_WIDTH, BUTTON_HEIGHT);
|
||||||
cmdCancel->setPosition(DIALOG_WIDTH - DISTANCE_BORDER - BUTTON_WIDTH, DIALOG_HEIGHT - 2 * DISTANCE_BORDER - BUTTON_HEIGHT - 10);
|
cmdCancel->setPosition(DIALOG_WIDTH - DISTANCE_BORDER - BUTTON_WIDTH,
|
||||||
|
DIALOG_HEIGHT - 2 * DISTANCE_BORDER - BUTTON_HEIGHT - 10);
|
||||||
cmdCancel->setBaseColor(gui_baseCol);
|
cmdCancel->setBaseColor(gui_baseCol);
|
||||||
cmdCancel->addActionListener(buttonActionListener);
|
cmdCancel->addActionListener(buttonActionListener);
|
||||||
|
|
||||||
|
@ -198,30 +200,32 @@ static void ExitSelectFolder()
|
||||||
}
|
}
|
||||||
|
|
||||||
static void navigate_right(void)
|
static void navigate_right(void)
|
||||||
{ gcn::FocusHandler* focusHdl = gui_top->_getFocusHandler();
|
{
|
||||||
gcn::Widget* activeWidget = focusHdl->getFocused();
|
gcn::FocusHandler* focusHdl = gui_top->_getFocusHandler();
|
||||||
if(activeWidget == lstFolders)
|
gcn::Widget* activeWidget = focusHdl->getFocused();
|
||||||
cmdOK->requestFocus();
|
if (activeWidget == lstFolders)
|
||||||
else if(activeWidget == cmdCancel)
|
cmdOK->requestFocus();
|
||||||
lstFolders->requestFocus();
|
else if (activeWidget == cmdCancel)
|
||||||
else if(activeWidget == cmdOK)
|
lstFolders->requestFocus();
|
||||||
cmdCancel->requestFocus();
|
else if (activeWidget == cmdOK)
|
||||||
}
|
cmdCancel->requestFocus();
|
||||||
|
}
|
||||||
|
|
||||||
static void navigate_left(void)
|
static void navigate_left(void)
|
||||||
{
|
{
|
||||||
gcn::FocusHandler* focusHdl = gui_top->_getFocusHandler();
|
gcn::FocusHandler* focusHdl = gui_top->_getFocusHandler();
|
||||||
gcn::Widget* activeWidget = focusHdl->getFocused();
|
gcn::Widget* activeWidget = focusHdl->getFocused();
|
||||||
if(activeWidget == lstFolders)
|
if (activeWidget == lstFolders)
|
||||||
cmdCancel->requestFocus();
|
cmdCancel->requestFocus();
|
||||||
else if(activeWidget == cmdCancel)
|
else if (activeWidget == cmdCancel)
|
||||||
cmdOK->requestFocus();
|
cmdOK->requestFocus();
|
||||||
else if(activeWidget == cmdOK)
|
else if (activeWidget == cmdOK)
|
||||||
lstFolders->requestFocus();
|
lstFolders->requestFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SelectFolderLoop()
|
static void SelectFolderLoop()
|
||||||
{
|
{
|
||||||
//FocusBugWorkaround(wndSelectFolder);
|
FocusBugWorkaround(wndSelectFolder);
|
||||||
|
|
||||||
while (!dialogFinished)
|
while (!dialogFinished)
|
||||||
{
|
{
|
||||||
|
@ -272,58 +276,69 @@ static void SelectFolderLoop()
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (event.type == SDL_JOYBUTTONDOWN || event.type == SDL_JOYHATMOTION)
|
else if (event.type == SDL_JOYBUTTONDOWN || event.type == SDL_JOYHATMOTION)
|
||||||
{
|
{
|
||||||
int hat = SDL_JoystickGetHat(GUIjoy, 0);
|
const int hat = SDL_JoystickGetHat(GUIjoy, 0);
|
||||||
|
|
||||||
if (SDL_JoystickGetButton(GUIjoy,host_input_buttons[0].south_button))
|
if (SDL_JoystickGetButton(GUIjoy, host_input_buttons[0].south_button))
|
||||||
{PushFakeKey(SDLK_RETURN);
|
{
|
||||||
break;}
|
PushFakeKey(SDLK_RETURN);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
else if (SDL_JoystickGetButton(GUIjoy,host_input_buttons[0].east_button) ||
|
if (SDL_JoystickGetButton(GUIjoy, host_input_buttons[0].east_button) ||
|
||||||
SDL_JoystickGetButton(GUIjoy,host_input_buttons[0].start_button))
|
SDL_JoystickGetButton(GUIjoy, host_input_buttons[0].start_button))
|
||||||
{dialogFinished = true;
|
{
|
||||||
break;}
|
dialogFinished = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
else if (SDL_JoystickGetButton(GUIjoy,host_input_buttons[0].dpad_left) || (hat & SDL_HAT_LEFT))
|
if (SDL_JoystickGetButton(GUIjoy, host_input_buttons[0].dpad_left) || (hat & SDL_HAT_LEFT))
|
||||||
{ gcn::FocusHandler* focusHdl = gui_top->_getFocusHandler();
|
{
|
||||||
gcn::Widget* activeWidget = focusHdl->getFocused();
|
gcn::FocusHandler* focusHdl = gui_top->_getFocusHandler();
|
||||||
if(activeWidget == lstFolders)
|
gcn::Widget* activeWidget = focusHdl->getFocused();
|
||||||
cmdCancel->requestFocus();
|
if (activeWidget == lstFolders)
|
||||||
else if(activeWidget == cmdCancel)
|
cmdCancel->requestFocus();
|
||||||
cmdOK->requestFocus();
|
else if (activeWidget == cmdCancel)
|
||||||
else if(activeWidget == cmdOK)
|
cmdOK->requestFocus();
|
||||||
lstFolders->requestFocus();
|
else if (activeWidget == cmdOK)
|
||||||
continue;}
|
lstFolders->requestFocus();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (SDL_JoystickGetButton(GUIjoy, host_input_buttons[0].dpad_right) || (hat & SDL_HAT_RIGHT))
|
||||||
|
{
|
||||||
|
gcn::FocusHandler* focusHdl = gui_top->_getFocusHandler();
|
||||||
|
gcn::Widget* activeWidget = focusHdl->getFocused();
|
||||||
|
if (activeWidget == lstFolders)
|
||||||
|
cmdOK->requestFocus();
|
||||||
|
else if (activeWidget == cmdCancel)
|
||||||
|
lstFolders->requestFocus();
|
||||||
|
else if (activeWidget == cmdOK)
|
||||||
|
cmdCancel->requestFocus();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
else if (SDL_JoystickGetButton(GUIjoy,host_input_buttons[0].dpad_right) || (hat & SDL_HAT_RIGHT))
|
if (SDL_JoystickGetButton(GUIjoy, host_input_buttons[0].dpad_up) || (hat & SDL_HAT_UP))
|
||||||
{ gcn::FocusHandler* focusHdl = gui_top->_getFocusHandler();
|
{
|
||||||
gcn::Widget* activeWidget = focusHdl->getFocused();
|
PushFakeKey(SDLK_UP);
|
||||||
if(activeWidget == lstFolders)
|
break;
|
||||||
cmdOK->requestFocus();
|
}
|
||||||
else if(activeWidget == cmdCancel)
|
|
||||||
lstFolders->requestFocus();
|
|
||||||
else if(activeWidget == cmdOK)
|
|
||||||
cmdCancel->requestFocus();
|
|
||||||
continue;}
|
|
||||||
|
|
||||||
else if (SDL_JoystickGetButton(GUIjoy,host_input_buttons[0].dpad_up) || (hat & SDL_HAT_UP))
|
if (SDL_JoystickGetButton(GUIjoy, host_input_buttons[0].dpad_down) || (hat & SDL_HAT_DOWN))
|
||||||
{PushFakeKey(SDLK_UP);
|
{
|
||||||
break;}
|
PushFakeKey(SDLK_DOWN);
|
||||||
|
break;
|
||||||
else if (SDL_JoystickGetButton(GUIjoy,host_input_buttons[0].dpad_down) || (hat & SDL_HAT_DOWN))
|
}
|
||||||
{PushFakeKey(SDLK_DOWN);
|
}
|
||||||
break;}
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
// Send event to guisan-controls
|
// Send event to guisan-controls
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
#ifdef ANDROIDSDL
|
#ifdef ANDROIDSDL
|
||||||
androidsdl_event(event, gui_input);
|
androidsdl_event(event, gui_input);
|
||||||
#else
|
#else
|
||||||
gui_input->pushInput(event);
|
gui_input->pushInput(event);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,14 +13,14 @@ namespace gcn
|
||||||
|
|
||||||
active = false;
|
active = false;
|
||||||
|
|
||||||
container = new gcn::Container();
|
container = new Container();
|
||||||
container->setOpaque(true);
|
container->setOpaque(true);
|
||||||
|
|
||||||
label = new gcn::Label(caption);
|
label = new Label(caption);
|
||||||
label->setHeight(16);
|
label->setHeight(16);
|
||||||
|
|
||||||
gcn::Image* img = gcn::Image::load(imagepath);
|
Image* img = Image::load(imagepath);
|
||||||
icon = new gcn::Icon(img);
|
icon = new Icon(img);
|
||||||
icon->setSize(16, 16);
|
icon->setSize(16, 16);
|
||||||
|
|
||||||
container->add(icon, 4, 4);
|
container->add(icon, 4, 4);
|
||||||
|
@ -65,7 +65,7 @@ namespace gcn
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SelectorEntry::setActive(bool active)
|
void SelectorEntry::setActive(const bool active)
|
||||||
{
|
{
|
||||||
this->active = active;
|
this->active = active;
|
||||||
if (active)
|
if (active)
|
||||||
|
@ -75,7 +75,7 @@ namespace gcn
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool SelectorEntry::getActive()
|
bool SelectorEntry::getActive() const
|
||||||
{
|
{
|
||||||
return active;
|
return active;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ namespace gcn
|
||||||
void setInactiveColor(const Color& color);
|
void setInactiveColor(const Color& color);
|
||||||
void setActiveColor(const Color& color);
|
void setActiveColor(const Color& color);
|
||||||
void setActive(bool active);
|
void setActive(bool active);
|
||||||
bool getActive();
|
bool getActive() const;
|
||||||
|
|
||||||
void widgetResized(const Event& event) override;
|
void widgetResized(const Event& event) override;
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
#include "androidsdl_event.h"
|
#include "androidsdl_event.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static SDL_Joystick *GUIjoy;
|
static SDL_Joystick* GUIjoy;
|
||||||
extern struct host_input_button host_input_buttons[MAX_INPUT_DEVICES];
|
extern struct host_input_button host_input_buttons[MAX_INPUT_DEVICES];
|
||||||
|
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ extern struct host_input_button host_input_buttons[MAX_INPUT_DEVICES];
|
||||||
|
|
||||||
static bool dialogFinished = false;
|
static bool dialogFinished = false;
|
||||||
|
|
||||||
static gcn::Window *wndShowHelp;
|
static gcn::Window* wndShowHelp;
|
||||||
static gcn::Button* cmdOK;
|
static gcn::Button* cmdOK;
|
||||||
static gcn::ListBox* lstHelp;
|
static gcn::ListBox* lstHelp;
|
||||||
static gcn::ScrollArea* scrAreaHelp;
|
static gcn::ScrollArea* scrAreaHelp;
|
||||||
|
@ -37,10 +37,10 @@ static gcn::ScrollArea* scrAreaHelp;
|
||||||
|
|
||||||
class HelpListModel : public gcn::ListModel
|
class HelpListModel : public gcn::ListModel
|
||||||
{
|
{
|
||||||
std::vector<std::string> lines;
|
vector<string> lines;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
HelpListModel(std::vector<std::string> helptext)
|
HelpListModel(const vector<string> helptext)
|
||||||
{
|
{
|
||||||
lines = helptext;
|
lines = helptext;
|
||||||
}
|
}
|
||||||
|
@ -50,14 +50,15 @@ public:
|
||||||
return lines.size();
|
return lines.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string getElementAt(int i) override
|
string getElementAt(int i) override
|
||||||
{
|
{
|
||||||
if (i >= 0 && i < lines.size())
|
if (i >= 0 && i < lines.size())
|
||||||
return lines[i];
|
return lines[i];
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
static HelpListModel *helpList;
|
|
||||||
|
static HelpListModel* helpList;
|
||||||
|
|
||||||
|
|
||||||
class ShowHelpActionListener : public gcn::ActionListener
|
class ShowHelpActionListener : public gcn::ActionListener
|
||||||
|
@ -68,10 +69,11 @@ public:
|
||||||
dialogFinished = true;
|
dialogFinished = true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static ShowHelpActionListener* showHelpActionListener;
|
static ShowHelpActionListener* showHelpActionListener;
|
||||||
|
|
||||||
|
|
||||||
static void InitShowHelp(const std::vector<std::string>& helptext)
|
static void InitShowHelp(const vector<string>& helptext)
|
||||||
{
|
{
|
||||||
wndShowHelp = new gcn::Window("Help");
|
wndShowHelp = new gcn::Window("Help");
|
||||||
wndShowHelp->setSize(DIALOG_WIDTH, DIALOG_HEIGHT);
|
wndShowHelp->setSize(DIALOG_WIDTH, DIALOG_HEIGHT);
|
||||||
|
@ -84,7 +86,8 @@ static void InitShowHelp(const std::vector<std::string>& helptext)
|
||||||
helpList = new HelpListModel(helptext);
|
helpList = new HelpListModel(helptext);
|
||||||
|
|
||||||
lstHelp = new gcn::ListBox(helpList);
|
lstHelp = new gcn::ListBox(helpList);
|
||||||
lstHelp->setSize(DIALOG_WIDTH - 2 * DISTANCE_BORDER - 4, DIALOG_HEIGHT - 3 * DISTANCE_BORDER - BUTTON_HEIGHT - DISTANCE_NEXT_Y - 10);
|
lstHelp->setSize(DIALOG_WIDTH - 2 * DISTANCE_BORDER - 4,
|
||||||
|
DIALOG_HEIGHT - 3 * DISTANCE_BORDER - BUTTON_HEIGHT - DISTANCE_NEXT_Y - 10);
|
||||||
lstHelp->setPosition(DISTANCE_BORDER, DISTANCE_BORDER);
|
lstHelp->setPosition(DISTANCE_BORDER, DISTANCE_BORDER);
|
||||||
lstHelp->setBaseColor(gui_baseCol + 0x202020);
|
lstHelp->setBaseColor(gui_baseCol + 0x202020);
|
||||||
lstHelp->setBackgroundColor(gui_baseCol);
|
lstHelp->setBackgroundColor(gui_baseCol);
|
||||||
|
@ -93,14 +96,16 @@ static void InitShowHelp(const std::vector<std::string>& helptext)
|
||||||
scrAreaHelp = new gcn::ScrollArea(lstHelp);
|
scrAreaHelp = new gcn::ScrollArea(lstHelp);
|
||||||
scrAreaHelp->setBorderSize(1);
|
scrAreaHelp->setBorderSize(1);
|
||||||
scrAreaHelp->setPosition(DISTANCE_BORDER, 10 + TEXTFIELD_HEIGHT + 10);
|
scrAreaHelp->setPosition(DISTANCE_BORDER, 10 + TEXTFIELD_HEIGHT + 10);
|
||||||
scrAreaHelp->setSize(DIALOG_WIDTH - 2 * DISTANCE_BORDER - 4, DIALOG_HEIGHT - 3 * DISTANCE_BORDER - BUTTON_HEIGHT - DISTANCE_NEXT_Y - 10);
|
scrAreaHelp->setSize(DIALOG_WIDTH - 2 * DISTANCE_BORDER - 4,
|
||||||
|
DIALOG_HEIGHT - 3 * DISTANCE_BORDER - BUTTON_HEIGHT - DISTANCE_NEXT_Y - 10);
|
||||||
scrAreaHelp->setScrollbarWidth(20);
|
scrAreaHelp->setScrollbarWidth(20);
|
||||||
scrAreaHelp->setBaseColor(gui_baseCol + 0x202020);
|
scrAreaHelp->setBaseColor(gui_baseCol + 0x202020);
|
||||||
scrAreaHelp->setBackgroundColor(gui_baseCol);
|
scrAreaHelp->setBackgroundColor(gui_baseCol);
|
||||||
|
|
||||||
cmdOK = new gcn::Button("Ok");
|
cmdOK = new gcn::Button("Ok");
|
||||||
cmdOK->setSize(BUTTON_WIDTH, BUTTON_HEIGHT);
|
cmdOK->setSize(BUTTON_WIDTH, BUTTON_HEIGHT);
|
||||||
cmdOK->setPosition(DIALOG_WIDTH - DISTANCE_BORDER - BUTTON_WIDTH, DIALOG_HEIGHT - 2 * DISTANCE_BORDER - BUTTON_HEIGHT - 10);
|
cmdOK->setPosition(DIALOG_WIDTH - DISTANCE_BORDER - BUTTON_WIDTH,
|
||||||
|
DIALOG_HEIGHT - 2 * DISTANCE_BORDER - BUTTON_HEIGHT - 10);
|
||||||
cmdOK->setBaseColor(gui_baseCol);
|
cmdOK->setBaseColor(gui_baseCol);
|
||||||
cmdOK->addActionListener(showHelpActionListener);
|
cmdOK->addActionListener(showHelpActionListener);
|
||||||
|
|
||||||
|
@ -132,8 +137,8 @@ static void ExitShowHelp(void)
|
||||||
|
|
||||||
static void ShowHelpLoop(void)
|
static void ShowHelpLoop(void)
|
||||||
{
|
{
|
||||||
//TODO: Check if this is needed in guisan?
|
FocusBugWorkaround(wndShowHelp);
|
||||||
//FocusBugWorkaround(wndShowHelp);
|
|
||||||
GUIjoy = SDL_JoystickOpen(0);
|
GUIjoy = SDL_JoystickOpen(0);
|
||||||
|
|
||||||
while (!dialogFinished)
|
while (!dialogFinished)
|
||||||
|
@ -154,31 +159,34 @@ static void ShowHelpLoop(void)
|
||||||
case SDL_SCANCODE_RETURN:
|
case SDL_SCANCODE_RETURN:
|
||||||
event.key.keysym.scancode = SDL_SCANCODE_RETURN;
|
event.key.keysym.scancode = SDL_SCANCODE_RETURN;
|
||||||
gui_input->pushInput(event); // Fire key down
|
gui_input->pushInput(event); // Fire key down
|
||||||
event.type = SDL_KEYUP; // and the key up
|
event.type = SDL_KEYUP; // and the key up
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (event.type == SDL_JOYBUTTONDOWN)
|
else if (event.type == SDL_JOYBUTTONDOWN)
|
||||||
{
|
{
|
||||||
if (SDL_JoystickGetButton(GUIjoy,host_input_buttons[0].south_button))
|
if (SDL_JoystickGetButton(GUIjoy, host_input_buttons[0].south_button))
|
||||||
{PushFakeKey(SDLK_RETURN);
|
{
|
||||||
break;}
|
PushFakeKey(SDLK_RETURN);
|
||||||
|
break;
|
||||||
else if (SDL_JoystickGetButton(GUIjoy,host_input_buttons[0].east_button) ||
|
}
|
||||||
SDL_JoystickGetButton(GUIjoy,host_input_buttons[0].start_button))
|
if (SDL_JoystickGetButton(GUIjoy, host_input_buttons[0].east_button) ||
|
||||||
{dialogFinished = true;
|
SDL_JoystickGetButton(GUIjoy, host_input_buttons[0].start_button))
|
||||||
break;}
|
{
|
||||||
}
|
dialogFinished = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
// Send event to guisan-controls
|
// Send event to guisan-controls
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
#ifdef ANDROIDSDL
|
#ifdef ANDROIDSDL
|
||||||
androidsdl_event(event, gui_input);
|
androidsdl_event(event, gui_input);
|
||||||
#else
|
#else
|
||||||
gui_input->pushInput(event);
|
gui_input->pushInput(event);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -193,7 +201,7 @@ else if (event.type == SDL_JOYBUTTONDOWN)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ShowHelp(const char *title, const std::vector<std::string>& text)
|
void ShowHelp(const char* title, const vector<string>& text)
|
||||||
{
|
{
|
||||||
dialogFinished = false;
|
dialogFinished = false;
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
|
|
||||||
static bool dialogResult = false;
|
static bool dialogResult = false;
|
||||||
static bool dialogFinished = false;
|
static bool dialogFinished = false;
|
||||||
static SDL_Joystick *GUIjoy;
|
static SDL_Joystick* GUIjoy;
|
||||||
extern struct host_input_button host_input_buttons[MAX_INPUT_DEVICES];
|
extern struct host_input_button host_input_buttons[MAX_INPUT_DEVICES];
|
||||||
static const char* dialogControlPressed;
|
static const char* dialogControlPressed;
|
||||||
static Uint8 dialogButtonPressed;
|
static Uint8 dialogButtonPressed;
|
||||||
|
@ -71,13 +71,15 @@ static void InitShowMessage()
|
||||||
|
|
||||||
cmdOK = new gcn::Button("Ok");
|
cmdOK = new gcn::Button("Ok");
|
||||||
cmdOK->setSize(BUTTON_WIDTH, BUTTON_HEIGHT);
|
cmdOK->setSize(BUTTON_WIDTH, BUTTON_HEIGHT);
|
||||||
cmdOK->setPosition(DIALOG_WIDTH - DISTANCE_BORDER - 2 * BUTTON_WIDTH - DISTANCE_NEXT_X, DIALOG_HEIGHT - 2 * DISTANCE_BORDER - BUTTON_HEIGHT - 10);
|
cmdOK->setPosition(DIALOG_WIDTH - DISTANCE_BORDER - 2 * BUTTON_WIDTH - DISTANCE_NEXT_X,
|
||||||
|
DIALOG_HEIGHT - 2 * DISTANCE_BORDER - BUTTON_HEIGHT - 10);
|
||||||
cmdOK->setBaseColor(gui_baseCol);
|
cmdOK->setBaseColor(gui_baseCol);
|
||||||
cmdOK->addActionListener(showMessageActionListener);
|
cmdOK->addActionListener(showMessageActionListener);
|
||||||
|
|
||||||
cmdCancel = new gcn::Button("Cancel");
|
cmdCancel = new gcn::Button("Cancel");
|
||||||
cmdCancel->setSize(BUTTON_WIDTH, BUTTON_HEIGHT);
|
cmdCancel->setSize(BUTTON_WIDTH, BUTTON_HEIGHT);
|
||||||
cmdCancel->setPosition(DIALOG_WIDTH - DISTANCE_BORDER - BUTTON_WIDTH, DIALOG_HEIGHT - 2 * DISTANCE_BORDER - BUTTON_HEIGHT - 10);
|
cmdCancel->setPosition(DIALOG_WIDTH - DISTANCE_BORDER - BUTTON_WIDTH,
|
||||||
|
DIALOG_HEIGHT - 2 * DISTANCE_BORDER - BUTTON_HEIGHT - 10);
|
||||||
cmdCancel->setBaseColor(gui_baseCol);
|
cmdCancel->setBaseColor(gui_baseCol);
|
||||||
cmdCancel->addActionListener(showMessageActionListener);
|
cmdCancel->addActionListener(showMessageActionListener);
|
||||||
|
|
||||||
|
@ -110,7 +112,7 @@ static void ExitShowMessage()
|
||||||
|
|
||||||
static void ShowMessageWaitInputLoop()
|
static void ShowMessageWaitInputLoop()
|
||||||
{
|
{
|
||||||
//FocusBugWorkaround(wndShowMessage);
|
FocusBugWorkaround(wndShowMessage);
|
||||||
|
|
||||||
while (!dialogFinished)
|
while (!dialogFinished)
|
||||||
{
|
{
|
||||||
|
@ -157,8 +159,8 @@ static void ShowMessageWaitInputLoop()
|
||||||
|
|
||||||
static void ShowMessageLoop()
|
static void ShowMessageLoop()
|
||||||
{
|
{
|
||||||
//TODO: Check if this is needed in guisan
|
FocusBugWorkaround(wndShowMessage);
|
||||||
//FocusBugWorkaround(wndShowMessage);
|
|
||||||
GUIjoy = SDL_JoystickOpen(0);
|
GUIjoy = SDL_JoystickOpen(0);
|
||||||
|
|
||||||
while (!dialogFinished)
|
while (!dialogFinished)
|
||||||
|
@ -183,7 +185,6 @@ static void ShowMessageLoop()
|
||||||
cmdOK->requestFocus();
|
cmdOK->requestFocus();
|
||||||
else if (activeWidget == cmdOK)
|
else if (activeWidget == cmdOK)
|
||||||
cmdCancel->requestFocus();
|
cmdCancel->requestFocus();
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -198,40 +199,44 @@ static void ShowMessageLoop()
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (event.type == SDL_JOYBUTTONDOWN || event.type == SDL_JOYHATMOTION)
|
else if (event.type == SDL_JOYBUTTONDOWN || event.type == SDL_JOYHATMOTION)
|
||||||
{
|
{
|
||||||
int hat = SDL_JoystickGetHat(GUIjoy, 0);
|
const int hat = SDL_JoystickGetHat(GUIjoy, 0);
|
||||||
|
|
||||||
if (SDL_JoystickGetButton(GUIjoy,host_input_buttons[0].south_button))
|
if (SDL_JoystickGetButton(GUIjoy, host_input_buttons[0].south_button))
|
||||||
{PushFakeKey(SDLK_RETURN);
|
{
|
||||||
break;}
|
PushFakeKey(SDLK_RETURN);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (SDL_JoystickGetButton(GUIjoy, host_input_buttons[0].east_button) ||
|
||||||
|
SDL_JoystickGetButton(GUIjoy, host_input_buttons[0].start_button))
|
||||||
|
{
|
||||||
|
dialogFinished = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (SDL_JoystickGetButton(GUIjoy, host_input_buttons[0].dpad_left) ||
|
||||||
|
SDL_JoystickGetButton(GUIjoy, host_input_buttons[0].dpad_right) ||
|
||||||
|
(hat & SDL_HAT_LEFT) ||
|
||||||
|
(hat & SDL_HAT_RIGHT))
|
||||||
|
|
||||||
else if (SDL_JoystickGetButton(GUIjoy,host_input_buttons[0].east_button) ||
|
{
|
||||||
SDL_JoystickGetButton(GUIjoy,host_input_buttons[0].start_button))
|
gcn::FocusHandler* focusHdl = gui_top->_getFocusHandler();
|
||||||
{dialogFinished = true;
|
gcn::Widget* activeWidget = focusHdl->getFocused();
|
||||||
break;}
|
if (activeWidget == cmdCancel)
|
||||||
|
cmdOK->requestFocus();
|
||||||
else if (SDL_JoystickGetButton(GUIjoy,host_input_buttons[0].dpad_left) ||
|
else if (activeWidget == cmdOK)
|
||||||
SDL_JoystickGetButton(GUIjoy,host_input_buttons[0].dpad_right) ||
|
cmdCancel->requestFocus();
|
||||||
(hat & SDL_HAT_LEFT) ||
|
break;
|
||||||
(hat & SDL_HAT_RIGHT) )
|
}
|
||||||
|
}
|
||||||
{gcn::FocusHandler* focusHdl = gui_top->_getFocusHandler();
|
|
||||||
gcn::Widget* activeWidget = focusHdl->getFocused();
|
|
||||||
if(activeWidget == cmdCancel)
|
|
||||||
cmdOK->requestFocus();
|
|
||||||
else if(activeWidget == cmdOK)
|
|
||||||
cmdCancel->requestFocus();
|
|
||||||
continue;}
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
// Send event to guisan-controls
|
// Send event to guisan-controls
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
#ifdef ANDROIDSDL
|
#ifdef ANDROIDSDL
|
||||||
androidsdl_event(event, gui_input);
|
androidsdl_event(event, gui_input);
|
||||||
#else
|
#else
|
||||||
gui_input->pushInput(event);
|
gui_input->pushInput(event);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -183,20 +183,20 @@ void RegisterRefreshFunc(void (*func)(void))
|
||||||
refreshFuncAfterDraw = func;
|
refreshFuncAfterDraw = func;
|
||||||
}
|
}
|
||||||
|
|
||||||
//void FocusBugWorkaround(gcn::Window* wnd)
|
void FocusBugWorkaround(gcn::Window* wnd)
|
||||||
//{
|
{
|
||||||
// // When modal dialog opens via mouse, the dialog will not
|
// When modal dialog opens via mouse, the dialog will not
|
||||||
// // have the focus unless there is a mouse click. We simulate the click...
|
// have the focus unless there is a mouse click. We simulate the click...
|
||||||
// SDL_Event event;
|
SDL_Event event;
|
||||||
// event.type = SDL_MOUSEBUTTONDOWN;
|
event.type = SDL_MOUSEBUTTONDOWN;
|
||||||
// event.button.button = SDL_BUTTON_LEFT;
|
event.button.button = SDL_BUTTON_LEFT;
|
||||||
// event.button.state = SDL_PRESSED;
|
event.button.state = SDL_PRESSED;
|
||||||
// event.button.x = wnd->getX() + 2;
|
event.button.x = wnd->getX() + 2;
|
||||||
// event.button.y = wnd->getY() + 2;
|
event.button.y = wnd->getY() + 2;
|
||||||
// gui_input->pushInput(event);
|
gui_input->pushInput(event);
|
||||||
// event.type = SDL_MOUSEBUTTONUP;
|
event.type = SDL_MOUSEBUTTONUP;
|
||||||
// gui_input->pushInput(event);
|
gui_input->pushInput(event);
|
||||||
//}
|
}
|
||||||
|
|
||||||
static void ShowHelpRequested()
|
static void ShowHelpRequested()
|
||||||
{
|
{
|
||||||
|
@ -849,8 +849,8 @@ void DisableResume()
|
||||||
void run_gui()
|
void run_gui()
|
||||||
{
|
{
|
||||||
#ifdef ANDROIDSDL
|
#ifdef ANDROIDSDL
|
||||||
SDL_ANDROID_SetScreenKeyboardShown(0);
|
SDL_ANDROID_SetScreenKeyboardShown(0);
|
||||||
SDL_ANDROID_SetSystemMousePointerVisible(1);
|
SDL_ANDROID_SetSystemMousePointerVisible(1);
|
||||||
#endif
|
#endif
|
||||||
gui_running = true;
|
gui_running = true;
|
||||||
gui_rtarea_flags_onenter = gui_create_rtarea_flag(&currprefs);
|
gui_rtarea_flags_onenter = gui_create_rtarea_flag(&currprefs);
|
||||||
|
@ -870,13 +870,13 @@ void run_gui()
|
||||||
sdl::gui_run();
|
sdl::gui_run();
|
||||||
widgets::gui_halt();
|
widgets::gui_halt();
|
||||||
sdl::gui_halt();
|
sdl::gui_halt();
|
||||||
#ifdef ANDROIDSDL
|
#ifdef ANDROIDSDL
|
||||||
if (currprefs.onScreen!=0)
|
if (currprefs.onScreen != 0)
|
||||||
{
|
{
|
||||||
SDL_ANDROID_SetScreenKeyboardShown(1);
|
SDL_ANDROID_SetScreenKeyboardShown(1);
|
||||||
SDL_ANDROID_SetSystemMousePointerVisible(0);
|
SDL_ANDROID_SetSystemMousePointerVisible(0);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Catch all guisan exceptions.
|
// Catch all guisan exceptions.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue