mirror of
https://github.com/dgis/emu48android
synced 2024-12-27 09:58:46 +01:00
Add the support of the macros.
This commit is contained in:
parent
ca0e34e30e
commit
2e19448358
14 changed files with 234 additions and 35 deletions
15
ReadMe.txt
15
ReadMe.txt
|
@ -1,8 +1,5 @@
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
|
|
||||||
WARNING: WITH VERSION 1.3, THE STATUS FILE HAS BEEN MODIFIED AND IS NOW FULLY COMPATIBLE WITH THE WINDOWS VERSION AS IT SHOULD HAVE BEEN.
|
|
||||||
HOWEVER, BEFORE THE UPDATE, BACK UP YOUR DATA BECAUSE YOU COULD LOSE THEM.
|
|
||||||
|
|
||||||
This project ports the Windows application Emu48 written in C to Android.
|
This project ports the Windows application Emu48 written in C to Android.
|
||||||
It uses the Android NDK. The former Emu48 source code (written by Sébastien Carlier and Christoph Giesselink) remains untouched because of a thin win32 emulation layer above Linux/NDK!
|
It uses the Android NDK. The former Emu48 source code (written by Sébastien Carlier and Christoph Giesselink) remains untouched because of a thin win32 emulation layer above Linux/NDK!
|
||||||
This win32 layer will allow to easily update from the original Emu48 source code.
|
This win32 layer will allow to easily update from the original Emu48 source code.
|
||||||
|
@ -52,7 +49,6 @@ NOT WORKING YET
|
||||||
|
|
||||||
- Disassembler
|
- Disassembler
|
||||||
- Debugger
|
- Debugger
|
||||||
- Macro
|
|
||||||
- Serial Ports (Wire or Ir)
|
- Serial Ports (Wire or Ir)
|
||||||
|
|
||||||
|
|
||||||
|
@ -61,14 +57,15 @@ CHANGES
|
||||||
Version 1.5 (2019-06-xx)
|
Version 1.5 (2019-06-xx)
|
||||||
|
|
||||||
- Add the printer simulator (set delay to 0 to speed up!).
|
- Add the printer simulator (set delay to 0 to speed up!).
|
||||||
|
- Add the macro support.
|
||||||
- Refactor the code for easier code sharing between Emu48, Emu42 and Emu71.
|
- Refactor the code for easier code sharing between Emu48, Emu42 and Emu71.
|
||||||
- Fix: Bad text characters when copy/paste the stack.
|
- Fix: Bad text characters when copy/paste the stack.
|
||||||
- Fix: Selecting an empty KML folder prevent to select the default embedded KML folder (Github Fix: #5)!
|
- Fix: Selecting an empty KML folder prevent to select the default embedded KML folder (Github Fix: #5)!
|
||||||
- Fix a crash with waveOutClose().
|
- Fix a crash with waveOutClose().
|
||||||
- Fix an issue with the Pan and zoom which was possible after closing the calc.
|
- Fix an issue with the Pan and zoom which was possible after closing the calc.
|
||||||
- Prevent the ESC key from leaving the application.
|
- Prevent the ESC key from leaving the application (Github Fix: #6).
|
||||||
- Map the keyboard DELETE key like it should.
|
- Map the keyboard DELETE key like it should (Github Fix: #6).
|
||||||
- Map the keyboard +/= key to the + key and the _/- key to the - (US keyboard).
|
- Map the +, -, * and / keys catching the typed character instead of the virtual key (Github Fix: #6).
|
||||||
|
|
||||||
|
|
||||||
Version 1.4 (2019-06-08)
|
Version 1.4 (2019-06-08)
|
||||||
|
@ -146,12 +143,11 @@ This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
|
||||||
Note: some included files are not covered by the GPL; these include ROM image files (copyrighted by HP), KML files and faceplate images (copyrighted by their authors).
|
Note: some included files are not covered by the GPL; these include ROM image files (copyrighted by HP), KML files and faceplate images (copyrighted by their authors).
|
||||||
The Eric's Real scripts ("real*.kml" and "real*.bmp") are embedded in this application with the kind permission of Eric Rechlin.
|
The Eric's Real scripts ("real*.kml" and "real*.bmp/png") are embedded in this application with the kind permission of Eric Rechlin.
|
||||||
|
|
||||||
|
|
||||||
TODO
|
TODO
|
||||||
|
|
||||||
- Make the regular (not keypad) '*', and '/' work (#6).
|
|
||||||
- In Chrome OS:
|
- In Chrome OS:
|
||||||
- The timezone seems to be GMT (localtime_r not right?)!
|
- The timezone seems to be GMT (localtime_r not right?)!
|
||||||
- sometimes there is no OK button in the KML Script Compilation Result.
|
- sometimes there is no OK button in the KML Script Compilation Result.
|
||||||
|
@ -159,7 +155,6 @@ TODO
|
||||||
- The clock seems unsynchronized sometimes.
|
- The clock seems unsynchronized sometimes.
|
||||||
- Add KML script loading dependencies fallback to the inner ROM (and may be KML include?).
|
- Add KML script loading dependencies fallback to the inner ROM (and may be KML include?).
|
||||||
- Add a separation between the pixels (Suggestion from Jaime Meza).
|
- Add a separation between the pixels (Suggestion from Jaime Meza).
|
||||||
- Change the logo following the template.
|
|
||||||
|
|
||||||
|
|
||||||
BUILD
|
BUILD
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
|
|
||||||
WARNING: WITH VERSION 1.3, THE STATUS FILE HAS BEEN MODIFIED AND IS NOW FULLY COMPATIBLE WITH THE WINDOWS VERSION AS IT SHOULD HAVE BEEN.
|
|
||||||
HOWEVER, BEFORE THE UPDATE, BACK UP YOUR DATA BECAUSE YOU COULD LOSE THEM.
|
|
||||||
|
|
||||||
This project ports the Windows application Emu48 written in C to Android.
|
This project ports the Windows application Emu48 written in C to Android.
|
||||||
It uses the Android NDK. The former Emu48 source code (written by Sébastien Carlier and Christoph Giesselink) remains untouched because of a thin win32 emulation layer above Linux/NDK!
|
It uses the Android NDK. The former Emu48 source code (written by Sébastien Carlier and Christoph Giesselink) remains untouched because of a thin win32 emulation layer above Linux/NDK!
|
||||||
This win32 layer will allow to easily update from the original Emu48 source code.
|
This win32 layer will allow to easily update from the original Emu48 source code.
|
||||||
|
@ -45,6 +42,7 @@ NOTES
|
||||||
* pick the calculator (which should be "Eric's Real 50g (Large Cropped)")!
|
* pick the calculator (which should be "Eric's Real 50g (Large Cropped)")!
|
||||||
And because, the file "FOLDER/rom.49g" is not readonly anymore, you can save your port 2.
|
And because, the file "FOLDER/rom.49g" is not readonly anymore, you can save your port 2.
|
||||||
BUT for the moment, it is saved ONLY when you CLOSE (or change) the state file. Not when you end the application.
|
BUT for the moment, it is saved ONLY when you CLOSE (or change) the state file. Not when you end the application.
|
||||||
|
- To speed up printing, set the 'delay' to 0 in the calculator's print options.
|
||||||
|
|
||||||
|
|
||||||
NOT WORKING YET
|
NOT WORKING YET
|
||||||
|
@ -52,12 +50,24 @@ NOT WORKING YET
|
||||||
- Disassembler
|
- Disassembler
|
||||||
- Debugger
|
- Debugger
|
||||||
- Macro
|
- Macro
|
||||||
- Infrared Printer
|
|
||||||
- Serial Ports (Wire or Ir)
|
- Serial Ports (Wire or Ir)
|
||||||
|
|
||||||
|
|
||||||
CHANGES
|
CHANGES
|
||||||
|
|
||||||
|
Version 1.5 (2019-06-xx)
|
||||||
|
|
||||||
|
- Add the printer simulator (set delay to 0 to speed up!).
|
||||||
|
- Refactor the code for easier code sharing between Emu48, Emu42 and Emu71.
|
||||||
|
- Fix: Bad text characters when copy/paste the stack.
|
||||||
|
- Fix: Selecting an empty KML folder prevent to select the default embedded KML folder (Github Fix: #5)!
|
||||||
|
- Fix a crash with waveOutClose().
|
||||||
|
- Fix an issue with the Pan and zoom which was possible after closing the calc.
|
||||||
|
- Prevent the ESC key from leaving the application (Github Fix: #6).
|
||||||
|
- Map the keyboard DELETE key like it should (Github Fix: #6).
|
||||||
|
- Map the +, -, * and / keys catching the typed character instead of the virtual key (Github Fix: #6).
|
||||||
|
|
||||||
|
|
||||||
Version 1.4 (2019-06-08)
|
Version 1.4 (2019-06-08)
|
||||||
|
|
||||||
- Add an optional menu button in the top left corner.
|
- Add an optional menu button in the top left corner.
|
||||||
|
@ -133,4 +143,4 @@ This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
|
||||||
Note: some included files are not covered by the GPL; these include ROM image files (copyrighted by HP), KML files and faceplate images (copyrighted by their authors).
|
Note: some included files are not covered by the GPL; these include ROM image files (copyrighted by HP), KML files and faceplate images (copyrighted by their authors).
|
||||||
The Eric's Real scripts ("real*.kml" and "real*.bmp") are embedded in this application with the kind permission of Eric Rechlin.
|
The Eric's Real scripts ("real*.kml" and "real*.bmp/png") are embedded in this application with the kind permission of Eric Rechlin.
|
||||||
|
|
|
@ -480,6 +480,10 @@ JNIEXPORT jint JNICALL Java_org_emulator_calculator_NativeLib_getGlobalColor(JNI
|
||||||
return (jint) dwTColor;
|
return (jint) dwTColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
JNIEXPORT jint JNICALL Java_org_emulator_calculator_NativeLib_getMacroState(JNIEnv *env, jobject thisz) {
|
||||||
|
return nMacroState;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
JNIEXPORT jint JNICALL Java_org_emulator_calculator_NativeLib_onFileNew(JNIEnv *env, jobject thisz, jstring kmlFilename) {
|
JNIEXPORT jint JNICALL Java_org_emulator_calculator_NativeLib_onFileNew(JNIEnv *env, jobject thisz, jstring kmlFilename) {
|
||||||
if (bDocumentAvail)
|
if (bDocumentAvail)
|
||||||
|
@ -955,6 +959,31 @@ JNIEXPORT void JNICALL Java_org_emulator_calculator_NativeLib_onBackupDelete(JNI
|
||||||
ResetBackup();
|
ResetBackup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
JNIEXPORT void JNICALL Java_org_emulator_calculator_NativeLib_onToolMacroNew(JNIEnv *env, jobject thisz, jstring filename) {
|
||||||
|
const char *filenameUTF8 = (*env)->GetStringUTFChars(env, filename , NULL);
|
||||||
|
_tcscpy(getSaveObjectFilenameResult, filenameUTF8);
|
||||||
|
(*env)->ReleaseStringUTFChars(env, filename, filenameUTF8);
|
||||||
|
currentDialogBoxMode = DialogBoxMode_SAVE_MACRO;
|
||||||
|
OnToolMacroNew();
|
||||||
|
getSaveObjectFilenameResult[0] = 0;
|
||||||
|
currentDialogBoxMode = DialogBoxMode_UNKNOWN;
|
||||||
|
}
|
||||||
|
|
||||||
|
JNIEXPORT void JNICALL Java_org_emulator_calculator_NativeLib_onToolMacroPlay(JNIEnv *env, jobject thisz, jstring filename) {
|
||||||
|
const char *filenameUTF8 = (*env)->GetStringUTFChars(env, filename , NULL);
|
||||||
|
_tcscpy(getSaveObjectFilenameResult, filenameUTF8);
|
||||||
|
(*env)->ReleaseStringUTFChars(env, filename, filenameUTF8);
|
||||||
|
currentDialogBoxMode = DialogBoxMode_OPEN_MACRO;
|
||||||
|
OnToolMacroPlay();
|
||||||
|
getSaveObjectFilenameResult[0] = 0;
|
||||||
|
currentDialogBoxMode = DialogBoxMode_UNKNOWN;
|
||||||
|
}
|
||||||
|
|
||||||
|
JNIEXPORT void JNICALL Java_org_emulator_calculator_NativeLib_onToolMacroStop(JNIEnv *env, jobject thisz) {
|
||||||
|
OnToolMacroStop();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
JNIEXPORT void JNICALL Java_org_emulator_calculator_NativeLib_setConfiguration(JNIEnv *env, jobject thisz, jstring key, jint isDynamic, jint intValue1, jint intValue2, jstring stringValue) {
|
JNIEXPORT void JNICALL Java_org_emulator_calculator_NativeLib_setConfiguration(JNIEnv *env, jobject thisz, jstring key, jint isDynamic, jint intValue1, jint intValue2, jstring stringValue) {
|
||||||
const char *configKey = (*env)->GetStringUTFChars(env, key, NULL) ;
|
const char *configKey = (*env)->GetStringUTFChars(env, key, NULL) ;
|
||||||
const char *configStringValue = stringValue ? (*env)->GetStringUTFChars(env, stringValue, NULL) : NULL;
|
const char *configStringValue = stringValue ? (*env)->GetStringUTFChars(env, stringValue, NULL) : NULL;
|
||||||
|
@ -983,6 +1012,9 @@ JNIEXPORT void JNICALL Java_org_emulator_calculator_NativeLib_setConfiguration(J
|
||||||
SoundOpen(uWaveDevId);
|
SoundOpen(uWaveDevId);
|
||||||
soundEnabled = TRUE;
|
soundEnabled = TRUE;
|
||||||
}
|
}
|
||||||
|
} else if(_tcscmp(_T("settings_macro"), configKey) == 0) {
|
||||||
|
bMacroRealSpeed = (BOOL)intValue1;
|
||||||
|
nMacroTimeout = 500 - intValue2;
|
||||||
} else if(_tcscmp(_T("settings_port1"), configKey) == 0) {
|
} else if(_tcscmp(_T("settings_port1"), configKey) == 0) {
|
||||||
BOOL settingsPort1en = (BOOL) intValue1;
|
BOOL settingsPort1en = (BOOL) intValue1;
|
||||||
BOOL settingsPort1wr = (BOOL) intValue2;
|
BOOL settingsPort1wr = (BOOL) intValue2;
|
||||||
|
|
|
@ -513,6 +513,9 @@ int UnlockedWaitForEvent(HANDLE hHandle, uint64_t milliseconds)
|
||||||
if (milliseconds != (uint64_t) -1)
|
if (milliseconds != (uint64_t) -1)
|
||||||
{
|
{
|
||||||
result = pthread_cond_timedwait(&hHandle->eventCVariable, &hHandle->eventMutex, &ts);
|
result = pthread_cond_timedwait(&hHandle->eventCVariable, &hHandle->eventMutex, &ts);
|
||||||
|
THREAD_LOGD("UnlockedWaitForEvent() pthread_cond_timedwait() for event %x return %d", hHandle, result);
|
||||||
|
if(result == ETIMEDOUT)
|
||||||
|
result = WAIT_TIMEOUT;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -799,6 +802,15 @@ HGLOBAL WINAPI GlobalFree(HGLOBAL hMem) {
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL GetOpenFileName(LPOPENFILENAME openFilename) {
|
BOOL GetOpenFileName(LPOPENFILENAME openFilename) {
|
||||||
|
if(openFilename) {
|
||||||
|
if(currentDialogBoxMode == DialogBoxMode_OPEN_MACRO) {
|
||||||
|
openFilename->nMaxFile = MAX_PATH;
|
||||||
|
openFilename->nFileExtension = 1;
|
||||||
|
//openFilename->lpstrFile = getSaveObjectFilenameResult;
|
||||||
|
_tcsncpy(openFilename->lpstrFile, getSaveObjectFilenameResult, openFilename->nMaxFile);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -806,10 +818,12 @@ TCHAR getSaveObjectFilenameResult[MAX_PATH];
|
||||||
BOOL GetSaveFileName(LPOPENFILENAME openFilename) {
|
BOOL GetSaveFileName(LPOPENFILENAME openFilename) {
|
||||||
if(openFilename) {
|
if(openFilename) {
|
||||||
if(currentDialogBoxMode == DialogBoxMode_SET_USRPRG32
|
if(currentDialogBoxMode == DialogBoxMode_SET_USRPRG32
|
||||||
|| currentDialogBoxMode == DialogBoxMode_SET_USRPRG42) {
|
|| currentDialogBoxMode == DialogBoxMode_SET_USRPRG42
|
||||||
|
|| currentDialogBoxMode == DialogBoxMode_SAVE_MACRO) {
|
||||||
openFilename->nMaxFile = MAX_PATH;
|
openFilename->nMaxFile = MAX_PATH;
|
||||||
openFilename->nFileExtension = 1;
|
openFilename->nFileExtension = 1;
|
||||||
openFilename->lpstrFile = getSaveObjectFilenameResult;
|
//openFilename->lpstrFile = getSaveObjectFilenameResult;
|
||||||
|
_tcsncpy(openFilename->lpstrFile, getSaveObjectFilenameResult, openFilename->nMaxFile);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1255,7 +1255,9 @@ enum DialogBoxMode {
|
||||||
DialogBoxMode_GET_USRPRG32,
|
DialogBoxMode_GET_USRPRG32,
|
||||||
DialogBoxMode_SET_USRPRG32,
|
DialogBoxMode_SET_USRPRG32,
|
||||||
DialogBoxMode_GET_USRPRG42,
|
DialogBoxMode_GET_USRPRG42,
|
||||||
DialogBoxMode_SET_USRPRG42
|
DialogBoxMode_SET_USRPRG42,
|
||||||
|
DialogBoxMode_OPEN_MACRO,
|
||||||
|
DialogBoxMode_SAVE_MACRO
|
||||||
};
|
};
|
||||||
extern enum DialogBoxMode currentDialogBoxMode;
|
extern enum DialogBoxMode currentDialogBoxMode;
|
||||||
extern BOOL securityExceptionOccured;
|
extern BOOL securityExceptionOccured;
|
||||||
|
|
|
@ -44,6 +44,7 @@ public class NativeLib {
|
||||||
public static native boolean getPort1Writable();
|
public static native boolean getPort1Writable();
|
||||||
public static native boolean getSoundEnabled();
|
public static native boolean getSoundEnabled();
|
||||||
public static native int getGlobalColor();
|
public static native int getGlobalColor();
|
||||||
|
public static native int getMacroState();
|
||||||
|
|
||||||
public static native int onFileNew(String kmlFilename);
|
public static native int onFileNew(String kmlFilename);
|
||||||
public static native int onFileOpen(String filename);
|
public static native int onFileOpen(String filename);
|
||||||
|
@ -63,6 +64,10 @@ public class NativeLib {
|
||||||
public static native void onBackupRestore();
|
public static native void onBackupRestore();
|
||||||
public static native void onBackupDelete();
|
public static native void onBackupDelete();
|
||||||
|
|
||||||
|
public static native void onToolMacroNew(String filename);
|
||||||
|
public static native void onToolMacroPlay(String filename);
|
||||||
|
public static native void onToolMacroStop();
|
||||||
|
|
||||||
public static native void setConfiguration(String key, int isDynamic, int intValue1, int intValue2, String stringValue);
|
public static native void setConfiguration(String key, int isDynamic, int intValue1, int intValue2, String stringValue);
|
||||||
public static native boolean isPortExtensionPossible();
|
public static native boolean isPortExtensionPossible();
|
||||||
public static native int getState();
|
public static native int getState();
|
||||||
|
|
|
@ -105,6 +105,8 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
|
||||||
public static final int INTENT_PICK_KML_FOLDER_FOR_SETTINGS = 9;
|
public static final int INTENT_PICK_KML_FOLDER_FOR_SETTINGS = 9;
|
||||||
public static final int INTENT_PICK_KML_FOLDER_FOR_SECURITY = 10;
|
public static final int INTENT_PICK_KML_FOLDER_FOR_SECURITY = 10;
|
||||||
public static final int INTENT_CREATE_RAM_CARD = 11;
|
public static final int INTENT_CREATE_RAM_CARD = 11;
|
||||||
|
public static final int INTENT_MACRO_LOAD = 12;
|
||||||
|
public static final int INTENT_MACRO_SAVE = 13;
|
||||||
|
|
||||||
private String kmlMimeType = "application/vnd.google-earth.kml+xml";
|
private String kmlMimeType = "application/vnd.google-earth.kml+xml";
|
||||||
private boolean kmlFolderUseDefault = true;
|
private boolean kmlFolderUseDefault = true;
|
||||||
|
@ -370,6 +372,12 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
|
||||||
OnViewPrinter();
|
OnViewPrinter();
|
||||||
} else if (id == R.id.nav_create_ram_card) {
|
} else if (id == R.id.nav_create_ram_card) {
|
||||||
OnCreateRAMCard();
|
OnCreateRAMCard();
|
||||||
|
} else if (id == R.id.nav_macro_record) {
|
||||||
|
OnMacroRecord();
|
||||||
|
} else if (id == R.id.nav_macro_play) {
|
||||||
|
OnMacroPlay();
|
||||||
|
} else if (id == R.id.nav_macro_stop) {
|
||||||
|
OnMacroStop();
|
||||||
} else if (id == R.id.nav_help) {
|
} else if (id == R.id.nav_help) {
|
||||||
OnTopics();
|
OnTopics();
|
||||||
} else if (id == R.id.nav_about) {
|
} else if (id == R.id.nav_about) {
|
||||||
|
@ -401,26 +409,29 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
|
||||||
|
|
||||||
private void updateNavigationDrawerItems() {
|
private void updateNavigationDrawerItems() {
|
||||||
Menu menu = navigationView.getMenu();
|
Menu menu = navigationView.getMenu();
|
||||||
boolean isDocumentAvailable = NativeLib.isDocumentAvailable();
|
|
||||||
boolean isBackup = NativeLib.isBackup();
|
boolean isBackup = NativeLib.isBackup();
|
||||||
int cCurrentRomType = NativeLib.getCurrentModel();
|
int cCurrentRomType = NativeLib.getCurrentModel();
|
||||||
//int nState = NativeLib.getState();
|
int nMacroState = NativeLib.getMacroState();
|
||||||
//boolean bRun = (nState == 0 /* SM_RUN */ || nState == 3 /* SM_SLEEP */);
|
|
||||||
|
boolean uRun = NativeLib.isDocumentAvailable();
|
||||||
boolean bStackEnable = cCurrentRomType!='6' && cCurrentRomType!='A' && cCurrentRomType!='E' && cCurrentRomType!='P'; // CdB for HP: add apples
|
boolean bStackEnable = cCurrentRomType!='6' && cCurrentRomType!='A' && cCurrentRomType!='E' && cCurrentRomType!='P'; // CdB for HP: add apples
|
||||||
|
|
||||||
menu.findItem(R.id.nav_save).setEnabled(isDocumentAvailable);
|
menu.findItem(R.id.nav_save).setEnabled(uRun);
|
||||||
menu.findItem(R.id.nav_save_as).setEnabled(isDocumentAvailable);
|
menu.findItem(R.id.nav_save_as).setEnabled(uRun);
|
||||||
menu.findItem(R.id.nav_close).setEnabled(isDocumentAvailable);
|
menu.findItem(R.id.nav_close).setEnabled(uRun);
|
||||||
menu.findItem(R.id.nav_load_object).setEnabled(isDocumentAvailable && bStackEnable);
|
menu.findItem(R.id.nav_load_object).setEnabled(uRun && bStackEnable);
|
||||||
menu.findItem(R.id.nav_save_object).setEnabled(isDocumentAvailable && bStackEnable);
|
menu.findItem(R.id.nav_save_object).setEnabled(uRun && bStackEnable);
|
||||||
menu.findItem(R.id.nav_copy_screen).setEnabled(isDocumentAvailable);
|
menu.findItem(R.id.nav_copy_screen).setEnabled(uRun);
|
||||||
menu.findItem(R.id.nav_copy_stack).setEnabled(isDocumentAvailable && bStackEnable);
|
menu.findItem(R.id.nav_copy_stack).setEnabled(uRun && bStackEnable);
|
||||||
menu.findItem(R.id.nav_paste_stack).setEnabled(isDocumentAvailable && bStackEnable);
|
menu.findItem(R.id.nav_paste_stack).setEnabled(uRun && bStackEnable);
|
||||||
menu.findItem(R.id.nav_reset_calculator).setEnabled(isDocumentAvailable);
|
menu.findItem(R.id.nav_reset_calculator).setEnabled(uRun);
|
||||||
menu.findItem(R.id.nav_backup_save).setEnabled(isDocumentAvailable);
|
menu.findItem(R.id.nav_backup_save).setEnabled(uRun);
|
||||||
menu.findItem(R.id.nav_backup_restore).setEnabled(isDocumentAvailable && isBackup);
|
menu.findItem(R.id.nav_backup_restore).setEnabled(uRun && isBackup);
|
||||||
menu.findItem(R.id.nav_backup_delete).setEnabled(isDocumentAvailable && isBackup);
|
menu.findItem(R.id.nav_backup_delete).setEnabled(uRun && isBackup);
|
||||||
menu.findItem(R.id.nav_change_kml_script).setEnabled(isDocumentAvailable);
|
menu.findItem(R.id.nav_change_kml_script).setEnabled(uRun);
|
||||||
|
menu.findItem(R.id.nav_macro_record).setEnabled(uRun && nMacroState == 0 /* MACRO_OFF */);
|
||||||
|
menu.findItem(R.id.nav_macro_play).setEnabled(uRun && nMacroState == 0 /* MACRO_OFF */);
|
||||||
|
menu.findItem(R.id.nav_macro_stop).setEnabled(uRun && nMacroState != 0 /* MACRO_OFF */);
|
||||||
}
|
}
|
||||||
|
|
||||||
class KMLScriptItem {
|
class KMLScriptItem {
|
||||||
|
@ -949,6 +960,32 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
|
||||||
}).show();
|
}).show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnMacroRecord() {
|
||||||
|
Intent intent = new Intent(Intent.ACTION_CREATE_DOCUMENT);
|
||||||
|
intent.addCategory(Intent.CATEGORY_OPENABLE);
|
||||||
|
intent.setType("*/*");
|
||||||
|
intent.putExtra(Intent.EXTRA_TITLE, "emu48-macro.mac");
|
||||||
|
startActivityForResult(intent, INTENT_MACRO_SAVE);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnMacroPlay() {
|
||||||
|
Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
|
||||||
|
intent.addCategory(Intent.CATEGORY_OPENABLE);
|
||||||
|
intent.setType("*/*");
|
||||||
|
intent.putExtra(Intent.EXTRA_TITLE, "emu48-macro.mac");
|
||||||
|
startActivityForResult(intent, INTENT_MACRO_LOAD);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnMacroStop() {
|
||||||
|
runOnUiThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
NativeLib.onToolMacroStop();
|
||||||
|
updateNavigationDrawerItems();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private void OnTopics() {
|
private void OnTopics() {
|
||||||
startActivity(new Intent(this, InfoWebActivity.class));
|
startActivity(new Intent(this, InfoWebActivity.class));
|
||||||
}
|
}
|
||||||
|
@ -1090,6 +1127,18 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case INTENT_MACRO_LOAD: {
|
||||||
|
//Log.d(TAG, "onActivityResult INTENT_MACRO_LOAD " + url);
|
||||||
|
NativeLib.onToolMacroPlay(url);
|
||||||
|
updateNavigationDrawerItems();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case INTENT_MACRO_SAVE: {
|
||||||
|
//Log.d(TAG, "onActivityResult INTENT_MACRO_SAVE " + url);
|
||||||
|
NativeLib.onToolMacroNew(url);
|
||||||
|
updateNavigationDrawerItems();
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1324,6 +1373,7 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
|
||||||
case 24: // TOOL_MACRO_PLAY
|
case 24: // TOOL_MACRO_PLAY
|
||||||
break;
|
break;
|
||||||
case 25: // TOOL_MACRO_STOP
|
case 25: // TOOL_MACRO_STOP
|
||||||
|
OnMacroStop();
|
||||||
break;
|
break;
|
||||||
case 26: // TOOL_MACRO_SETTINGS
|
case 26: // TOOL_MACRO_SETTINGS
|
||||||
break;
|
break;
|
||||||
|
@ -1405,7 +1455,7 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
|
||||||
String[] settingKeys = {
|
String[] settingKeys = {
|
||||||
"settings_realspeed", "settings_grayscale", "settings_rotation", "settings_auto_layout",
|
"settings_realspeed", "settings_grayscale", "settings_rotation", "settings_auto_layout",
|
||||||
"settings_hide_bar", "settings_hide_button_menu", "settings_sound_volume", "settings_haptic_feedback",
|
"settings_hide_bar", "settings_hide_button_menu", "settings_sound_volume", "settings_haptic_feedback",
|
||||||
"settings_background_kml_color", "settings_background_fallback_color", "settings_printer_model",
|
"settings_background_kml_color", "settings_background_fallback_color", "settings_printer_model", "settings_macro",
|
||||||
"settings_kml", "settings_port1", "settings_port2" };
|
"settings_kml", "settings_port1", "settings_port2" };
|
||||||
for (String settingKey : settingKeys) {
|
for (String settingKey : settingKeys) {
|
||||||
updateFromPreferences(settingKey, false);
|
updateFromPreferences(settingKey, false);
|
||||||
|
@ -1484,6 +1534,14 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
|
||||||
kmFolderChange = true;
|
kmFolderChange = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case "settings_macro":
|
||||||
|
case "settings_macro_real_speed":
|
||||||
|
case "settings_macro_manual_speed":
|
||||||
|
boolean macroRealSpeed = sharedPreferences.getBoolean("settings_macro_real_speed", true);
|
||||||
|
int macroManualSpeed = sharedPreferences.getInt("settings_macro_manual_speed", 500);
|
||||||
|
NativeLib.setConfiguration("settings_macro", isDynamicValue, macroRealSpeed ? 1 : 0, macroManualSpeed, null);
|
||||||
|
break;
|
||||||
|
|
||||||
case "settings_port1":
|
case "settings_port1":
|
||||||
case "settings_port1en":
|
case "settings_port1en":
|
||||||
case "settings_port1wr":
|
case "settings_port1wr":
|
||||||
|
|
|
@ -158,6 +158,23 @@ public class SettingsActivity extends AppCompatActivity implements SharedPrefere
|
||||||
// onPreferenceChangeListenerBackgroundCustomColor.onPreferenceChange(preferenceBackgroundCustomColor, sharedPreferences.getBoolean(preferenceBackgroundCustomColor.getKey(), false));
|
// onPreferenceChangeListenerBackgroundCustomColor.onPreferenceChange(preferenceBackgroundCustomColor, sharedPreferences.getBoolean(preferenceBackgroundCustomColor.getKey(), false));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Macro
|
||||||
|
|
||||||
|
Preference preferenceMacroRealSpeed = findPreference("settings_macro_real_speed");
|
||||||
|
final Preference preferenceMacroManualSpeed = findPreference("settings_macro_manual_speed");
|
||||||
|
if(preferenceMacroRealSpeed != null && preferenceMacroManualSpeed != null) {
|
||||||
|
Preference.OnPreferenceChangeListener onPreferenceChangeListenerMacroRealSpeed = new Preference.OnPreferenceChangeListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onPreferenceChange(Preference preference, Object value) {
|
||||||
|
if(value != null)
|
||||||
|
preferenceMacroManualSpeed.setEnabled(!(Boolean) value);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
preferenceMacroRealSpeed.setOnPreferenceChangeListener(onPreferenceChangeListenerMacroRealSpeed);
|
||||||
|
onPreferenceChangeListenerMacroRealSpeed.onPreferenceChange(preferenceMacroRealSpeed, sharedPreferences.getBoolean(preferenceMacroRealSpeed.getKey(), true));
|
||||||
|
}
|
||||||
|
|
||||||
// Ports 1 & 2 settings
|
// Ports 1 & 2 settings
|
||||||
|
|
||||||
final Preference preferencePort1en = findPreference("settings_port1en");
|
final Preference preferencePort1en = findPreference("settings_port1en");
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24.0"
|
||||||
|
android:viewportHeight="24.0">
|
||||||
|
<path
|
||||||
|
android:pathData="M12,12m-8,0a8,8 0,1 1,16 0a8,8 0,1 1,-16 0"
|
||||||
|
android:fillColor="#010101"/>
|
||||||
|
</vector>
|
10
app/src/main/res/drawable/ic_play_arrow_black_24dp.xml
Normal file
10
app/src/main/res/drawable/ic_play_arrow_black_24dp.xml
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24.0"
|
||||||
|
android:viewportHeight="24.0">
|
||||||
|
<path
|
||||||
|
android:fillColor="#FF000000"
|
||||||
|
android:pathData="M8,5v14l11,-7z"/>
|
||||||
|
</vector>
|
10
app/src/main/res/drawable/ic_stop_black_24dp.xml
Normal file
10
app/src/main/res/drawable/ic_stop_black_24dp.xml
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24.0"
|
||||||
|
android:viewportHeight="24.0">
|
||||||
|
<path
|
||||||
|
android:fillColor="#FF000000"
|
||||||
|
android:pathData="M6,6h12v12H6z"/>
|
||||||
|
</vector>
|
|
@ -100,6 +100,18 @@
|
||||||
android:id="@+id/nav_create_ram_card"
|
android:id="@+id/nav_create_ram_card"
|
||||||
android:icon="@drawable/ic_memory_black_24dp"
|
android:icon="@drawable/ic_memory_black_24dp"
|
||||||
android:title="@string/nav_create_ram_card" />
|
android:title="@string/nav_create_ram_card" />
|
||||||
|
<item
|
||||||
|
android:id="@+id/nav_macro_record"
|
||||||
|
android:icon="@drawable/ic_fiber_manual_record_black_24dp"
|
||||||
|
android:title="@string/nav_macro_record" />
|
||||||
|
<item
|
||||||
|
android:id="@+id/nav_macro_play"
|
||||||
|
android:icon="@drawable/ic_play_arrow_black_24dp"
|
||||||
|
android:title="@string/nav_macro_play" />
|
||||||
|
<item
|
||||||
|
android:id="@+id/nav_macro_stop"
|
||||||
|
android:icon="@drawable/ic_stop_black_24dp"
|
||||||
|
android:title="@string/nav_macro_stop" />
|
||||||
</menu>
|
</menu>
|
||||||
</item>
|
</item>
|
||||||
<item android:title="@string/nav_help">
|
<item android:title="@string/nav_help">
|
||||||
|
|
|
@ -41,6 +41,11 @@
|
||||||
<string name="nav_show_printer">Show the Printer Simulator...</string>
|
<string name="nav_show_printer">Show the Printer Simulator...</string>
|
||||||
<string name="nav_tool">Tool</string>
|
<string name="nav_tool">Tool</string>
|
||||||
<string name="nav_create_ram_card">Create RAM Card...</string>
|
<string name="nav_create_ram_card">Create RAM Card...</string>
|
||||||
|
<string name="nav_macro_record">Record Macro...</string>
|
||||||
|
<string name="nav_macro_play">Play Macro...</string>
|
||||||
|
<string name="nav_macro_stop">Macro Stop</string>
|
||||||
|
|
||||||
|
|
||||||
<string name="nav_help">Help</string>
|
<string name="nav_help">Help</string>
|
||||||
<string name="nav_item_help">Help</string>
|
<string name="nav_item_help">Help</string>
|
||||||
<string name="nav_about">About Emu48...</string>
|
<string name="nav_about">About Emu48...</string>
|
||||||
|
@ -120,4 +125,8 @@
|
||||||
<string name="settings_printer_model_title">Printer Model</string>
|
<string name="settings_printer_model_title">Printer Model</string>
|
||||||
<string name="settings_printer_model_summary">You can choose the printer model</string>
|
<string name="settings_printer_model_summary">You can choose the printer model</string>
|
||||||
|
|
||||||
|
<string name="settings_category_macro_title">Macro</string>
|
||||||
|
<string name="settings_macro_real_speed_title">Use Real Replay Speed</string>
|
||||||
|
<string name="settings_macro_manual_speed_title">Manual Replay Speed</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -108,6 +108,21 @@
|
||||||
/>
|
/>
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
|
|
||||||
|
<PreferenceCategory android:title="@string/settings_category_macro_title">
|
||||||
|
<SwitchPreference
|
||||||
|
android:key="settings_macro_real_speed"
|
||||||
|
android:title="@string/settings_macro_real_speed_title"
|
||||||
|
android:defaultValue="true" />
|
||||||
|
<SeekBarPreference
|
||||||
|
android:key="settings_macro_manual_speed"
|
||||||
|
android:title="@string/settings_macro_manual_speed_title"
|
||||||
|
android:defaultValue="500"
|
||||||
|
android:min="0"
|
||||||
|
android:max="500"
|
||||||
|
app:showSeekBarValue="true" />
|
||||||
|
</PreferenceCategory>
|
||||||
|
|
||||||
<!--<PreferenceCategory app:title="Disassembler">
|
<!--<PreferenceCategory app:title="Disassembler">
|
||||||
"HP Mnemonics",IDC_DISASM_HP
|
"HP Mnemonics",IDC_DISASM_HP
|
||||||
"Class Mnemonics",IDC_DISASM_CLASS
|
"Class Mnemonics",IDC_DISASM_CLASS
|
||||||
|
|
Loading…
Reference in a new issue