mirror of
https://github.com/dgis/emu48android
synced 2025-01-29 08:34:25 +01:00
This commit is contained in:
parent
5299a5bac6
commit
e805aa74d7
10 changed files with 60 additions and 22 deletions
|
@ -13,6 +13,7 @@ NOT WORKING
|
|||
- Serial Ports (Wire or Ir)
|
||||
|
||||
TODO
|
||||
- Put the KML title in the header of the menu in the drawer
|
||||
- Bug: No refresh with the clock
|
||||
- Option to allow rotation
|
||||
- Option to auto hide the menu
|
||||
|
|
|
@ -10,7 +10,7 @@ Print "==========================================="
|
|||
Print "Original KML script by Eric Rechlin cleaned"
|
||||
Print "and modified for HP49G+ by Hugo Rodrigues"
|
||||
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 "rodrigueshugo@hotmail.com"
|
||||
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 |
|
@ -17,7 +17,9 @@ static jobject viewToUpdate = NULL;
|
|||
static jobject mainActivity = NULL;
|
||||
jobject bitmapMainScreen;
|
||||
AndroidBitmapInfo androidBitmapInfo;
|
||||
TCHAR szChosenCurrentKml[MAX_PATH];
|
||||
TCHAR szChosenCurrentKml[MAX_PATH];
|
||||
TCHAR szKmlLog[10240];
|
||||
|
||||
|
||||
extern void win32Init();
|
||||
|
||||
|
@ -352,6 +354,11 @@ JNIEXPORT jint JNICALL Java_com_regis_cosnier_emu48_NativeLib_getCurrentModel(JN
|
|||
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) {
|
||||
//OnFileNew();
|
||||
if (bDocumentAvail)
|
||||
|
|
|
@ -693,21 +693,23 @@ BOOL WINAPI SetWindowOrgEx(HDC hdc, int x, int y, LPPOINT lppt) { return 0; }
|
|||
|
||||
// GDI
|
||||
HGDIOBJ SelectObject(HDC hdc, HGDIOBJ h) {
|
||||
switch (h->handleType) {
|
||||
case HGDIOBJ_TYPE_PEN:
|
||||
break;
|
||||
case HGDIOBJ_TYPE_BRUSH:
|
||||
break;
|
||||
case HGDIOBJ_TYPE_FONT:
|
||||
break;
|
||||
case HGDIOBJ_TYPE_BITMAP:
|
||||
hdc->selectedBitmap = h;
|
||||
return h;
|
||||
case HGDIOBJ_TYPE_REGION:
|
||||
break;
|
||||
case HGDIOBJ_TYPE_PALETTE:
|
||||
hdc->selectedPalette = h;
|
||||
return h;
|
||||
if(h) {
|
||||
switch (h->handleType) {
|
||||
case HGDIOBJ_TYPE_PEN:
|
||||
break;
|
||||
case HGDIOBJ_TYPE_BRUSH:
|
||||
break;
|
||||
case HGDIOBJ_TYPE_FONT:
|
||||
break;
|
||||
case HGDIOBJ_TYPE_BITMAP:
|
||||
hdc->selectedBitmap = h;
|
||||
return h;
|
||||
case HGDIOBJ_TYPE_REGION:
|
||||
break;
|
||||
case HGDIOBJ_TYPE_PALETTE:
|
||||
hdc->selectedPalette = h;
|
||||
return h;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
@ -930,7 +932,8 @@ HBITMAP CreateDIBitmap( HDC hdc, CONST BITMAPINFOHEADER *pbmih, DWORD flInit, CO
|
|||
memcpy(newBitmapInfo, pbmi, sizeof(BITMAPINFO));
|
||||
newHDC->bitmapInfo = 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 ?
|
||||
newBitmapInfo->bmiHeader.biSizeImage :
|
||||
newBitmapInfo->bmiHeader.biHeight * stride;
|
||||
|
@ -1137,9 +1140,13 @@ UINT GetDlgItemTextA(HWND hDlg, int nIDDlgItem, LPSTR lpString,int cchMax) {
|
|||
//TODO
|
||||
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) {
|
||||
LOGD("KML log:\r\n%s", lpString);
|
||||
_tcsncpy(szKmlLog, lpString, sizeof(szKmlLog)/sizeof(TCHAR));
|
||||
}
|
||||
//TODO
|
||||
return 0;
|
||||
|
|
|
@ -937,6 +937,7 @@ extern int lstrcmpi(LPCWSTR lpString1, LPCWSTR lpString2);
|
|||
#define _tcscmp wcscmp
|
||||
#define _tcslen wcslen
|
||||
#define _tcscpy wcscpy
|
||||
#define _tcsncpy wcsncpy
|
||||
#define _tcscat wcscat
|
||||
#define _tcsstr wcsstr
|
||||
|
||||
|
@ -959,6 +960,7 @@ extern int lstrcmpi(LPCSTR lpString1, LPCSTR lpString2);
|
|||
#define _tcscmp strcmp
|
||||
#define _tcslen strlen
|
||||
#define _tcscpy strcpy
|
||||
#define _tcsncpy strncpy
|
||||
#define _tcscat strcat
|
||||
#define _tcsstr strstr
|
||||
|
||||
|
|
|
@ -112,7 +112,7 @@ public class MainActivity extends AppCompatActivity
|
|||
|
||||
String lastDocumentUrl = sharedPreferences.getString("lastDocument", "");
|
||||
if(lastDocumentUrl.length() > 0)
|
||||
NativeLib.onFileOpen(lastDocumentUrl);
|
||||
onFileOpen(lastDocumentUrl);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -292,6 +292,7 @@ public class MainActivity extends AppCompatActivity
|
|||
public void onClick(DialogInterface dialog, int which) {
|
||||
String kmlScriptFilename = kmlScripts.get(which).filename;
|
||||
NativeLib.onFileNew(kmlScriptFilename);
|
||||
showKMLLog();
|
||||
}
|
||||
}).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:
|
||||
Log.d(TAG, "onActivityResult INTENT_GETOPENFILENAME " + uri.toString());
|
||||
String url = uri.toString();
|
||||
if(NativeLib.onFileOpen(url) != 0) {
|
||||
if(onFileOpen(url) != 0) {
|
||||
SharedPreferences.Editor editor = sharedPreferences.edit();
|
||||
editor.putString("lastDocument", url);
|
||||
editor.commit();
|
||||
|
@ -425,6 +426,25 @@ public class MainActivity extends AppCompatActivity
|
|||
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_WRITE = 2;
|
||||
int openFileFromContentResolver(String url, int writeAccess) {
|
||||
|
@ -457,7 +477,7 @@ public class MainActivity extends AppCompatActivity
|
|||
boolean settingsAutosave = sharedPreferences.getBoolean("settings_autosave", false);
|
||||
boolean settingsAutosaveonexit = sharedPreferences.getBoolean("settings_autosaveonexit", 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 settingsPort1wr = sharedPreferences.getBoolean("settings_port1wr", false);
|
||||
boolean settingsPort2en = sharedPreferences.getBoolean("settings_port2en", false);
|
||||
|
|
|
@ -24,6 +24,7 @@ public class NativeLib {
|
|||
|
||||
//public static native String getCurrentFilename();
|
||||
public static native int getCurrentModel();
|
||||
public static native String getKMLLog();
|
||||
|
||||
public static native int onFileNew(String kmlFilename);
|
||||
public static native int onFileOpen(String filename);
|
||||
|
|
Loading…
Add table
Reference in a new issue