diff --git a/ReadMe.txt b/ReadMe.txt index 401fc21..1412e8a 100644 --- a/ReadMe.txt +++ b/ReadMe.txt @@ -56,7 +56,7 @@ CHANGES Version 1.5 (2019-06-xx) -- Add the printer simulator (set delay to 0 to speed up!). +- Add the Ir 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. - Fix: Bad text characters when copy/paste the stack. diff --git a/app/src/main/java/org/emulator/calculator/MainScreenView.java b/app/src/main/java/org/emulator/calculator/MainScreenView.java index ae79cb9..5ee3998 100644 --- a/app/src/main/java/org/emulator/calculator/MainScreenView.java +++ b/app/src/main/java/org/emulator/calculator/MainScreenView.java @@ -236,7 +236,7 @@ public class MainScreenView extends PanAndScaleView { public boolean onKeyDown(int keyCode, KeyEvent event) { if((event.getFlags() & KeyEvent.FLAG_VIRTUAL_HARD_KEY) == 0) { char pressedKey = (char) event.getUnicodeChar(); - Log.d(TAG, "onKeyDown is: " + pressedKey); + //Log.d(TAG, "onKeyDown is: " + pressedKey); Integer windowsKeycode = charmap.get(pressedKey); if(windowsKeycode == null) windowsKeycode = vkmap.get(keyCode); @@ -254,7 +254,7 @@ public class MainScreenView extends PanAndScaleView { public boolean onKeyUp(int keyCode, KeyEvent event) { if((event.getFlags() & KeyEvent.FLAG_VIRTUAL_HARD_KEY) == 0) { char pressedKey = (char) event.getUnicodeChar(); - Log.d(TAG, "onKeyUp is: " + pressedKey); + //Log.d(TAG, "onKeyUp is: " + pressedKey); Integer windowsKeycode = charmap.get(pressedKey); if(windowsKeycode == null) windowsKeycode = vkmap.get(keyCode); diff --git a/app/src/main/java/org/emulator/forty/eight/MainActivity.java b/app/src/main/java/org/emulator/forty/eight/MainActivity.java index 5aeb535..721c641 100644 --- a/app/src/main/java/org/emulator/forty/eight/MainActivity.java +++ b/app/src/main/java/org/emulator/forty/eight/MainActivity.java @@ -414,16 +414,18 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On int nMacroState = NativeLib.getMacroState(); boolean uRun = NativeLib.isDocumentAvailable(); - boolean bStackEnable = cCurrentRomType!='6' && cCurrentRomType!='A' && cCurrentRomType!='E' && cCurrentRomType!='P'; // CdB for HP: add apples + boolean bObjectEnable = cCurrentRomType!='6' && cCurrentRomType!='A' && cCurrentRomType!='E' && cCurrentRomType!='P'; // CdB for HP: add apples + boolean bStackCEnable = bObjectEnable; + boolean bStackPEnable = bObjectEnable; menu.findItem(R.id.nav_save).setEnabled(uRun); menu.findItem(R.id.nav_save_as).setEnabled(uRun); menu.findItem(R.id.nav_close).setEnabled(uRun); - menu.findItem(R.id.nav_load_object).setEnabled(uRun && bStackEnable); - menu.findItem(R.id.nav_save_object).setEnabled(uRun && bStackEnable); + menu.findItem(R.id.nav_load_object).setEnabled(uRun && bObjectEnable); + menu.findItem(R.id.nav_save_object).setEnabled(uRun && bObjectEnable); menu.findItem(R.id.nav_copy_screen).setEnabled(uRun); - menu.findItem(R.id.nav_copy_stack).setEnabled(uRun && bStackEnable); - menu.findItem(R.id.nav_paste_stack).setEnabled(uRun && bStackEnable); + menu.findItem(R.id.nav_copy_stack).setEnabled(uRun && bStackCEnable); + menu.findItem(R.id.nav_paste_stack).setEnabled(uRun && bStackPEnable); menu.findItem(R.id.nav_reset_calculator).setEnabled(uRun); menu.findItem(R.id.nav_backup_save).setEnabled(uRun); menu.findItem(R.id.nav_backup_restore).setEnabled(uRun && isBackup); @@ -671,7 +673,7 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT); intent.addCategory(Intent.CATEGORY_OPENABLE); intent.setType("*/*"); - intent.putExtra(Intent.EXTRA_TITLE, "emu48-state.e48"); + intent.putExtra(Intent.EXTRA_TITLE, getString(R.string.filename) + "-state.e48"); startActivityForResult(intent, INTENT_GETOPENFILENAME); } }); @@ -684,32 +686,33 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On intent.addCategory(Intent.CATEGORY_OPENABLE); intent.setType("*/*"); int model = NativeLib.getCurrentModel(); - String filename = "emu48-state.e48"; + String emuXX = getString(R.string.filename); + String filename = emuXX + "-state.e48"; switch (model) { case 'S': //HP48SX - filename = "emu48-state-48sx.e48"; + filename = emuXX + "-state-48sx.e48"; break; case 'G': //HP48GX - filename = "emu48-state-48gx.e48"; + filename = emuXX + "-state-48gx.e48"; break; case '6': //HP38G 64K RAM case 'A': //HP38G 32K RAM - filename = "emu48-state.e38"; + filename = emuXX + "-state.e38"; break; case 'E': // HP39G/(HP39G+/HP39GS)/HP40G/HP40GS - filename = "emu48-state.e39"; + filename = emuXX + "-state.e39"; break; case 'P': // HP39G+/HP39GS - filename = "emu48-state.e39"; + filename = emuXX + "-state.e39"; break; case '2': // HP48GII - filename = "emu48-state-48gii.e49"; + filename = emuXX + "-state-48gii.e49"; break; case 'Q': // HP49G+/HP50G - filename = "emu48-state-50g.e49"; + filename = emuXX + "-state-50g.e49"; break; case 'X': // HP49G - filename = "emu48-state-49g.e49"; + filename = emuXX + "-state-49g.e49"; break; } intent.putExtra(Intent.EXTRA_TITLE, filename); @@ -743,7 +746,7 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT); intent.addCategory(Intent.CATEGORY_OPENABLE); intent.setType("*/*"); - intent.putExtra(Intent.EXTRA_TITLE, "emu48-object.hp"); + intent.putExtra(Intent.EXTRA_TITLE, getString(R.string.filename) + "-object.hp"); startActivityForResult(intent, INTENT_OBJECT_LOAD); } @@ -768,7 +771,7 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On Intent intent = new Intent(Intent.ACTION_CREATE_DOCUMENT); intent.addCategory(Intent.CATEGORY_OPENABLE); intent.setType("*/*"); - intent.putExtra(Intent.EXTRA_TITLE, "emu48-object.hp"); + intent.putExtra(Intent.EXTRA_TITLE, getString(R.string.filename) + "-object.hp"); startActivityForResult(intent, INTENT_OBJECT_SAVE); } private void OnViewCopy() { @@ -779,7 +782,7 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On NativeLib.onViewCopy(bitmapScreen); - String imageFilename = "Emu48-" + new SimpleDateFormat("yyyy-MM-dd_HH-mm-ss", Locale.US).format(new Date()); + String imageFilename = getString(R.string.filename) + "-" + new SimpleDateFormat("yyyy-MM-dd_HH-mm-ss", Locale.US).format(new Date()); try { File storagePath = new File(this.getExternalCacheDir(), ""); File imageFile = File.createTempFile(imageFilename, ".png", storagePath); @@ -964,7 +967,7 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On Intent intent = new Intent(Intent.ACTION_CREATE_DOCUMENT); intent.addCategory(Intent.CATEGORY_OPENABLE); intent.setType("*/*"); - intent.putExtra(Intent.EXTRA_TITLE, "emu48-macro.mac"); + intent.putExtra(Intent.EXTRA_TITLE, getString(R.string.filename) + "-macro.mac"); startActivityForResult(intent, INTENT_MACRO_SAVE); } @@ -972,7 +975,7 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT); intent.addCategory(Intent.CATEGORY_OPENABLE); intent.setType("*/*"); - intent.putExtra(Intent.EXTRA_TITLE, "emu48-macro.mac"); + intent.putExtra(Intent.EXTRA_TITLE, getString(R.string.filename) + "-macro.mac"); startActivityForResult(intent, INTENT_MACRO_LOAD); } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 814631d..9dc8d20 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -16,6 +16,7 @@ Emu48 + emu48 Settings Open navigation drawer Close navigation drawer