This commit is contained in:
dgis 2018-12-14 21:10:53 +00:00
parent 5299a5bac6
commit e805aa74d7
10 changed files with 60 additions and 22 deletions

View file

@ -13,6 +13,7 @@ NOT WORKING
- Serial Ports (Wire or Ir) - Serial Ports (Wire or Ir)
TODO TODO
- Put the KML title in the header of the menu in the drawer
- Bug: No refresh with the clock - Bug: No refresh with the clock
- Option to allow rotation - Option to allow rotation
- Option to auto hide the menu - Option to auto hide the menu

View file

@ -10,7 +10,7 @@ Print "==========================================="
Print "Original KML script by Eric Rechlin cleaned" Print "Original KML script by Eric Rechlin cleaned"
Print "and modified for HP49G+ by Hugo Rodrigues" Print "and modified for HP49G+ by Hugo Rodrigues"
Print "Graphic based on a scan of the HP49G+" Print "Graphic based on a scan of the HP49G+"
Print "Thanks to Christoph Gießelink for BEEP.49G" Print "Thanks to Christoph Gießelink for BEEP.49G"
Print "http://www.hpcalc.org" Print "http://www.hpcalc.org"
Print "rodrigueshugo@hotmail.com" Print "rodrigueshugo@hotmail.com"
Print "===========================================" Print "==========================================="

Binary file not shown.

Before

Width:  |  Height:  |  Size: 228 KiB

After

Width:  |  Height:  |  Size: 277 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 264 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 264 KiB

View file

@ -17,7 +17,9 @@ static jobject viewToUpdate = NULL;
static jobject mainActivity = NULL; static jobject mainActivity = NULL;
jobject bitmapMainScreen; jobject bitmapMainScreen;
AndroidBitmapInfo androidBitmapInfo; AndroidBitmapInfo androidBitmapInfo;
TCHAR szChosenCurrentKml[MAX_PATH]; TCHAR szChosenCurrentKml[MAX_PATH];
TCHAR szKmlLog[10240];
extern void win32Init(); extern void win32Init();
@ -352,6 +354,11 @@ JNIEXPORT jint JNICALL Java_com_regis_cosnier_emu48_NativeLib_getCurrentModel(JN
return cCurrentRomType; return cCurrentRomType;
} }
JNIEXPORT jstring JNICALL Java_com_regis_cosnier_emu48_NativeLib_getKMLLog(JNIEnv *env, jobject thisz) {
jstring result = (*env)->NewStringUTF(env, szKmlLog);
return result;
}
JNIEXPORT jint JNICALL Java_com_regis_cosnier_emu48_NativeLib_onFileNew(JNIEnv *env, jobject thisz, jstring kmlFilename) { JNIEXPORT jint JNICALL Java_com_regis_cosnier_emu48_NativeLib_onFileNew(JNIEnv *env, jobject thisz, jstring kmlFilename) {
//OnFileNew(); //OnFileNew();
if (bDocumentAvail) if (bDocumentAvail)

View file

@ -693,21 +693,23 @@ BOOL WINAPI SetWindowOrgEx(HDC hdc, int x, int y, LPPOINT lppt) { return 0; }
// GDI // GDI
HGDIOBJ SelectObject(HDC hdc, HGDIOBJ h) { HGDIOBJ SelectObject(HDC hdc, HGDIOBJ h) {
switch (h->handleType) { if(h) {
case HGDIOBJ_TYPE_PEN: switch (h->handleType) {
break; case HGDIOBJ_TYPE_PEN:
case HGDIOBJ_TYPE_BRUSH: break;
break; case HGDIOBJ_TYPE_BRUSH:
case HGDIOBJ_TYPE_FONT: break;
break; case HGDIOBJ_TYPE_FONT:
case HGDIOBJ_TYPE_BITMAP: break;
hdc->selectedBitmap = h; case HGDIOBJ_TYPE_BITMAP:
return h; hdc->selectedBitmap = h;
case HGDIOBJ_TYPE_REGION: return h;
break; case HGDIOBJ_TYPE_REGION:
case HGDIOBJ_TYPE_PALETTE: break;
hdc->selectedPalette = h; case HGDIOBJ_TYPE_PALETTE:
return h; hdc->selectedPalette = h;
return h;
}
} }
return NULL; return NULL;
} }
@ -930,7 +932,8 @@ HBITMAP CreateDIBitmap( HDC hdc, CONST BITMAPINFOHEADER *pbmih, DWORD flInit, CO
memcpy(newBitmapInfo, pbmi, sizeof(BITMAPINFO)); memcpy(newBitmapInfo, pbmi, sizeof(BITMAPINFO));
newHDC->bitmapInfo = newBitmapInfo; newHDC->bitmapInfo = newBitmapInfo;
newHDC->bitmapInfoHeader = (BITMAPINFOHEADER *)newBitmapInfo; newHDC->bitmapInfoHeader = (BITMAPINFOHEADER *)newBitmapInfo;
size_t stride = (size_t)(newBitmapInfo->bmiHeader.biWidth * (newBitmapInfo->bmiHeader.biBitCount >> 3)); //size_t stride = (size_t)(newBitmapInfo->bmiHeader.biWidth * (newBitmapInfo->bmiHeader.biBitCount >> 3));
size_t stride = (size_t)(4 * ((newBitmapInfo->bmiHeader.biWidth * newBitmapInfo->bmiHeader.biBitCount + 31) / 32));
size_t size = newBitmapInfo->bmiHeader.biSizeImage ? size_t size = newBitmapInfo->bmiHeader.biSizeImage ?
newBitmapInfo->bmiHeader.biSizeImage : newBitmapInfo->bmiHeader.biSizeImage :
newBitmapInfo->bmiHeader.biHeight * stride; newBitmapInfo->bmiHeader.biHeight * stride;
@ -1137,9 +1140,13 @@ UINT GetDlgItemTextA(HWND hDlg, int nIDDlgItem, LPSTR lpString,int cchMax) {
//TODO //TODO
return 0; return 0;
} }
BOOL SetDlgItemText(HWND hDlg, int nIDDlgItem, LPCSTR lpString) {
extern TCHAR szKmlLog[10240];
BOOL SetDlgItemText(HWND hDlg, int nIDDlgItem, LPCTSTR lpString) {
if(nIDDlgItem == IDC_KMLLOG) { if(nIDDlgItem == IDC_KMLLOG) {
LOGD("KML log:\r\n%s", lpString); LOGD("KML log:\r\n%s", lpString);
_tcsncpy(szKmlLog, lpString, sizeof(szKmlLog)/sizeof(TCHAR));
} }
//TODO //TODO
return 0; return 0;

View file

@ -937,6 +937,7 @@ extern int lstrcmpi(LPCWSTR lpString1, LPCWSTR lpString2);
#define _tcscmp wcscmp #define _tcscmp wcscmp
#define _tcslen wcslen #define _tcslen wcslen
#define _tcscpy wcscpy #define _tcscpy wcscpy
#define _tcsncpy wcsncpy
#define _tcscat wcscat #define _tcscat wcscat
#define _tcsstr wcsstr #define _tcsstr wcsstr
@ -959,6 +960,7 @@ extern int lstrcmpi(LPCSTR lpString1, LPCSTR lpString2);
#define _tcscmp strcmp #define _tcscmp strcmp
#define _tcslen strlen #define _tcslen strlen
#define _tcscpy strcpy #define _tcscpy strcpy
#define _tcsncpy strncpy
#define _tcscat strcat #define _tcscat strcat
#define _tcsstr strstr #define _tcsstr strstr

View file

@ -112,7 +112,7 @@ public class MainActivity extends AppCompatActivity
String lastDocumentUrl = sharedPreferences.getString("lastDocument", ""); String lastDocumentUrl = sharedPreferences.getString("lastDocument", "");
if(lastDocumentUrl.length() > 0) if(lastDocumentUrl.length() > 0)
NativeLib.onFileOpen(lastDocumentUrl); onFileOpen(lastDocumentUrl);
} }
@Override @Override
@ -292,6 +292,7 @@ public class MainActivity extends AppCompatActivity
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
String kmlScriptFilename = kmlScripts.get(which).filename; String kmlScriptFilename = kmlScripts.get(which).filename;
NativeLib.onFileNew(kmlScriptFilename); NativeLib.onFileNew(kmlScriptFilename);
showKMLLog();
} }
}).show(); }).show();
} }
@ -404,7 +405,7 @@ public class MainActivity extends AppCompatActivity
//just as an example, I am writing a String to the Uri I received from the user: //just as an example, I am writing a String to the Uri I received from the user:
Log.d(TAG, "onActivityResult INTENT_GETOPENFILENAME " + uri.toString()); Log.d(TAG, "onActivityResult INTENT_GETOPENFILENAME " + uri.toString());
String url = uri.toString(); String url = uri.toString();
if(NativeLib.onFileOpen(url) != 0) { if(onFileOpen(url) != 0) {
SharedPreferences.Editor editor = sharedPreferences.edit(); SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putString("lastDocument", url); editor.putString("lastDocument", url);
editor.commit(); editor.commit();
@ -425,6 +426,25 @@ public class MainActivity extends AppCompatActivity
super.onActivityResult(requestCode, resultCode, data); super.onActivityResult(requestCode, resultCode, data);
} }
private int onFileOpen(String url) {
int result = NativeLib.onFileOpen(url);
showKMLLog();
return result;
}
private void showKMLLog() {
if(sharedPreferences.getBoolean("settings_alwaysdisplog", true)) {
String kmlLog = NativeLib.getKMLLog();
new AlertDialog.Builder(this)
.setTitle("Pick a calculator")
.setMessage(kmlLog)
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
}
}).show();
}
}
final int GENERIC_READ = 1; final int GENERIC_READ = 1;
final int GENERIC_WRITE = 2; final int GENERIC_WRITE = 2;
int openFileFromContentResolver(String url, int writeAccess) { int openFileFromContentResolver(String url, int writeAccess) {
@ -457,7 +477,7 @@ public class MainActivity extends AppCompatActivity
boolean settingsAutosave = sharedPreferences.getBoolean("settings_autosave", false); boolean settingsAutosave = sharedPreferences.getBoolean("settings_autosave", false);
boolean settingsAutosaveonexit = sharedPreferences.getBoolean("settings_autosaveonexit", false); boolean settingsAutosaveonexit = sharedPreferences.getBoolean("settings_autosaveonexit", false);
boolean settingsObjectloadwarning = sharedPreferences.getBoolean("settings_objectloadwarning", false); boolean settingsObjectloadwarning = sharedPreferences.getBoolean("settings_objectloadwarning", false);
boolean settingsAlwaysdisplog = sharedPreferences.getBoolean("settings_alwaysdisplog", false); boolean settingsAlwaysdisplog = sharedPreferences.getBoolean("settings_alwaysdisplog", true);
boolean settingsPort1en = sharedPreferences.getBoolean("settings_port1en", false); boolean settingsPort1en = sharedPreferences.getBoolean("settings_port1en", false);
boolean settingsPort1wr = sharedPreferences.getBoolean("settings_port1wr", false); boolean settingsPort1wr = sharedPreferences.getBoolean("settings_port1wr", false);
boolean settingsPort2en = sharedPreferences.getBoolean("settings_port2en", false); boolean settingsPort2en = sharedPreferences.getBoolean("settings_port2en", false);

View file

@ -24,6 +24,7 @@ public class NativeLib {
//public static native String getCurrentFilename(); //public static native String getCurrentFilename();
public static native int getCurrentModel(); public static native int getCurrentModel();
public static native String getKMLLog();
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);