removed keyboard.h from filebrowser
remove len>0 check from FileBrowser::UpdateInputFolders() removed NumberKeys table
This commit is contained in:
parent
c42f4d3643
commit
a7cf8107d2
3 changed files with 119 additions and 160 deletions
|
@ -22,7 +22,6 @@
|
||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "Keyboard.h"
|
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
#include "InputMappings.h"
|
#include "InputMappings.h"
|
||||||
#include "stb_image.h"
|
#include "stb_image.h"
|
||||||
|
@ -817,15 +816,8 @@ void FileBrowser::UpdateCurrentHighlight()
|
||||||
void FileBrowser::Update()
|
void FileBrowser::Update()
|
||||||
{
|
{
|
||||||
InputMappings* inputMappings = InputMappings::Instance();
|
InputMappings* inputMappings = InputMappings::Instance();
|
||||||
Keyboard* keyboard = Keyboard::Instance();
|
|
||||||
bool dirty = false;
|
|
||||||
|
|
||||||
if (keyboard->CheckChanged())
|
if ( inputMappings->CheckKeyboardBrowseMode() || inputMappings->CheckButtonsBrowseMode() )
|
||||||
dirty = inputMappings->CheckKeyboardBrowseMode();
|
|
||||||
else
|
|
||||||
dirty = inputMappings->CheckButtonsBrowseMode();
|
|
||||||
|
|
||||||
if (dirty)
|
|
||||||
UpdateInputFolders();
|
UpdateInputFolders();
|
||||||
|
|
||||||
UpdateCurrentHighlight();
|
UpdateCurrentHighlight();
|
||||||
|
@ -877,8 +869,8 @@ bool FileBrowser::AddToCaddy(FileBrowser::BrowsableList::Entry* current)
|
||||||
|
|
||||||
void FileBrowser::UpdateInputFolders()
|
void FileBrowser::UpdateInputFolders()
|
||||||
{
|
{
|
||||||
Keyboard* keyboard = Keyboard::Instance();
|
|
||||||
InputMappings* inputMappings = InputMappings::Instance();
|
InputMappings* inputMappings = InputMappings::Instance();
|
||||||
|
bool dirty = false;
|
||||||
|
|
||||||
if (inputMappings->BrowseFunction())
|
if (inputMappings->BrowseFunction())
|
||||||
{
|
{
|
||||||
|
@ -887,14 +879,7 @@ void FileBrowser::UpdateInputFolders()
|
||||||
if ( ROMOrDevice >= 1 && ROMOrDevice <= 11 )
|
if ( ROMOrDevice >= 1 && ROMOrDevice <= 11 )
|
||||||
SelectROMOrDevice(ROMOrDevice);
|
SelectROMOrDevice(ROMOrDevice);
|
||||||
}
|
}
|
||||||
else
|
else if (inputMappings->BrowseSelect())
|
||||||
{
|
|
||||||
if (folder.entries.size() > 0)
|
|
||||||
{
|
|
||||||
//u32 numberOfEntriesMinus1 = folder.entries.size() - 1;
|
|
||||||
bool dirty = false;
|
|
||||||
|
|
||||||
if (inputMappings->BrowseSelect())
|
|
||||||
{
|
{
|
||||||
FileBrowser::BrowsableList::Entry* current = folder.current;
|
FileBrowser::BrowsableList::Entry* current = folder.current;
|
||||||
if (current)
|
if (current)
|
||||||
|
@ -912,13 +897,9 @@ void FileBrowser::UpdateInputFolders()
|
||||||
}
|
}
|
||||||
dirty = true;
|
dirty = true;
|
||||||
}
|
}
|
||||||
else
|
else // not a directory
|
||||||
{
|
{
|
||||||
if (strcmp(current->filImage.fname, "..") == 0)
|
if (DiskImage::IsDiskImageExtention(current->filImage.fname))
|
||||||
{
|
|
||||||
PopFolder();
|
|
||||||
}
|
|
||||||
else if (DiskImage::IsDiskImageExtention(current->filImage.fname))
|
|
||||||
{
|
{
|
||||||
DiskImage::DiskType diskType = DiskImage::GetDiskImageTypeViaExtention(current->filImage.fname);
|
DiskImage::DiskType diskType = DiskImage::GetDiskImageTypeViaExtention(current->filImage.fname);
|
||||||
|
|
||||||
|
@ -946,11 +927,6 @@ void FileBrowser::UpdateInputFolders()
|
||||||
{
|
{
|
||||||
selectionsMade = FillCaddyWithSelections();
|
selectionsMade = FillCaddyWithSelections();
|
||||||
}
|
}
|
||||||
//else if (keyboard->KeyPressed(KEY_TAB))
|
|
||||||
//{
|
|
||||||
// state = State_DiskCaddy;
|
|
||||||
// dirty = true;
|
|
||||||
//}
|
|
||||||
else if (inputMappings->BrowseBack())
|
else if (inputMappings->BrowseBack())
|
||||||
{
|
{
|
||||||
PopFolder();
|
PopFolder();
|
||||||
|
@ -995,23 +971,16 @@ void FileBrowser::UpdateInputFolders()
|
||||||
dirty = true;
|
dirty = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (inputMappings->BrowseAutoLoad())
|
||||||
|
{
|
||||||
|
CheckAutoMountImage(EXIT_RESET, this);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dirty = folder.CheckBrowseNavigation();
|
dirty = folder.CheckBrowseNavigation();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dirty) RefeshDisplay();
|
if (dirty) RefeshDisplay();
|
||||||
}
|
|
||||||
else // no folder entries, could this ever happen?? ".." is everpresent?
|
|
||||||
{
|
|
||||||
if (inputMappings->BrowseBack())
|
|
||||||
PopFolder();
|
|
||||||
}
|
|
||||||
if (inputMappings->BrowseAutoLoad())
|
|
||||||
{
|
|
||||||
CheckAutoMountImage(EXIT_RESET, this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FileBrowser::SelectROMOrDevice(u32 index)
|
bool FileBrowser::SelectROMOrDevice(u32 index)
|
||||||
|
@ -1084,11 +1053,11 @@ bool FileBrowser::SelectLST(const char* filenameLST)
|
||||||
return validImage;
|
return validImage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
// Not used
|
// Not used
|
||||||
void FileBrowser::UpdateInputDiskCaddy()
|
void FileBrowser::UpdateInputDiskCaddy()
|
||||||
{
|
{
|
||||||
bool dirty = false;
|
bool dirty = false;
|
||||||
Keyboard* keyboard = Keyboard::Instance();
|
|
||||||
|
|
||||||
if (keyboard->KeyPressed(KEY_DELETE))
|
if (keyboard->KeyPressed(KEY_DELETE))
|
||||||
{
|
{
|
||||||
|
@ -1110,6 +1079,7 @@ void FileBrowser::UpdateInputDiskCaddy()
|
||||||
|
|
||||||
if (dirty) RefeshDisplay();
|
if (dirty) RefeshDisplay();
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
void FileBrowser::DisplayStatusBar()
|
void FileBrowser::DisplayStatusBar()
|
||||||
{
|
{
|
||||||
|
|
|
@ -198,6 +198,10 @@ bool InputMappings::CheckKeyboardBrowseMode()
|
||||||
|
|
||||||
keyboardFlags = 0;
|
keyboardFlags = 0;
|
||||||
keyboardNumLetter = 0;
|
keyboardNumLetter = 0;
|
||||||
|
if (!keyboard->CheckChanged())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (keyboard->KeyHeld(KEY_DELETE) && keyboard->KeyLCtrlAlt() )
|
if (keyboard->KeyHeld(KEY_DELETE) && keyboard->KeyLCtrlAlt() )
|
||||||
reboot_now();
|
reboot_now();
|
||||||
|
@ -293,8 +297,8 @@ void InputMappings::CheckKeyboardEmulationMode(unsigned numberOfImages, unsigned
|
||||||
Keyboard* keyboard = Keyboard::Instance();
|
Keyboard* keyboard = Keyboard::Instance();
|
||||||
|
|
||||||
keyboardFlags = 0;
|
keyboardFlags = 0;
|
||||||
if (keyboard->CheckChanged())
|
if (!keyboard->CheckChanged())
|
||||||
{
|
return;
|
||||||
|
|
||||||
if (keyboard->KeyHeld(KEY_DELETE) && keyboard->KeyLCtrlAlt() )
|
if (keyboard->KeyHeld(KEY_DELETE) && keyboard->KeyLCtrlAlt() )
|
||||||
reboot_now();
|
reboot_now();
|
||||||
|
@ -312,13 +316,12 @@ void InputMappings::CheckKeyboardEmulationMode(unsigned numberOfImages, unsigned
|
||||||
else if (numberOfImages > 1)
|
else if (numberOfImages > 1)
|
||||||
{
|
{
|
||||||
unsigned index;
|
unsigned index;
|
||||||
for (index = 0; index < sizeof(NumberKeys)/sizeof(NumberKeys[0]); index+=3)
|
for (index = 0; index < 10; index++)
|
||||||
{
|
{
|
||||||
if (keyboard->KeyHeld(NumberKeys[index])
|
if ( keyboard->KeyHeld(KEY_F1+index)
|
||||||
|| keyboard->KeyHeld(NumberKeys[index + 1])
|
|| keyboard->KeyHeld(KEY_1+index)
|
||||||
|| keyboard->KeyHeld(NumberKeys[index + 2]) )
|
|| keyboard->KeyHeld(KEY_KP1+index) )
|
||||||
directDiskSwapRequest |= (1 << index/3);
|
directDiskSwapRequest |= (1 << index);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,20 +49,6 @@
|
||||||
#define FUNCTION_FLAG (1 << 21)
|
#define FUNCTION_FLAG (1 << 21)
|
||||||
// dont exceed 32!!
|
// dont exceed 32!!
|
||||||
|
|
||||||
const unsigned NumberKeys[33] =
|
|
||||||
{
|
|
||||||
KEY_F1, KEY_KP1, KEY_1,
|
|
||||||
KEY_F2, KEY_KP2, KEY_2,
|
|
||||||
KEY_F3, KEY_KP3, KEY_3,
|
|
||||||
KEY_F4, KEY_KP4, KEY_4,
|
|
||||||
KEY_F5, KEY_KP5, KEY_5,
|
|
||||||
KEY_F6, KEY_KP6, KEY_6,
|
|
||||||
KEY_F7, KEY_KP7, KEY_7,
|
|
||||||
KEY_F8, KEY_KP8, KEY_8,
|
|
||||||
KEY_F9, KEY_KP9, KEY_9,
|
|
||||||
KEY_F10, KEY_KP0, KEY_0,
|
|
||||||
KEY_F11, KEY_KPMINUS, KEY_MINUS
|
|
||||||
};
|
|
||||||
|
|
||||||
class InputMappings : public Singleton<InputMappings>
|
class InputMappings : public Singleton<InputMappings>
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue