diff --git a/.github/workflows/sonarcloud.yaml b/.github/workflows/sonarcloud.yaml index 013a821..4aa9c63 100644 --- a/.github/workflows/sonarcloud.yaml +++ b/.github/workflows/sonarcloud.yaml @@ -3,6 +3,7 @@ on: push: branches: - "master" + - "2.0" jobs: "sonarcloud": diff --git a/src/Cpu6502.cpp b/src/Cpu6502.cpp index f9d5836..53311de 100644 --- a/src/Cpu6502.cpp +++ b/src/Cpu6502.cpp @@ -1,7 +1,7 @@ -/* +/* * File: Cpu6502.cpp * Author: Christopher - * + * * Created on December 12, 2013, 10:14 PM */ @@ -33,6 +33,7 @@ void Cpu6502::clock(bool phase) { setPins(PinSettings{std::make_pair(common.CLK0,phase)}); rw(); + // TODO turn these into trace log settings #ifdef TRACEREG this->trace.dumpRegisters(); #endif diff --git a/src/E2wxApp.cpp b/src/E2wxApp.cpp index 12b318d..b68ee7c 100644 --- a/src/E2wxApp.cpp +++ b/src/E2wxApp.cpp @@ -149,11 +149,12 @@ bool E2wxApp::OnInit() { // wxLogWarning("%s", "a warning has occurred"); // wxLogInfo("%s", "informational"); // wxLogVerbose("%s", "verbose"); -// wxFile().Open("foobar.txt"); +// wxFile().Open("foobar.txt"); // <-- example of generating wx log message // TODO wx log file window? // TODO remove all logging from stdout/err to log file // TODO define components to turn on/off for trace level logging (disk, cassette, woz, keyboard, ram, lss, audio, etc.) +// TODO why are log messages getting buffered? (It ruins the timestamp.) BOOST_LOG_TRIVIAL(info) << "Application ID: " << this->GetID(); BOOST_LOG_TRIVIAL(info) << "Application version: " << this->GetVersion(); diff --git a/src/PreferencesDialog.cpp b/src/PreferencesDialog.cpp index 8c39312..936909c 100644 --- a/src/PreferencesDialog.cpp +++ b/src/PreferencesDialog.cpp @@ -33,7 +33,7 @@ wxBEGIN_EVENT_TABLE(PreferencesDialog, wxDialog) EVT_BUTTON(XRCID("btnDelete"), PreferencesDialog::OnDelete) EVT_BUTTON(XRCID("btnRename"), PreferencesDialog::OnRename) wxEND_EVENT_TABLE() - +// TODO import external config file diff --git a/src/clipboardhandler.cpp b/src/clipboardhandler.cpp index c9bc1d4..6168c5a 100644 --- a/src/clipboardhandler.cpp +++ b/src/clipboardhandler.cpp @@ -17,22 +17,25 @@ */ #include "clipboardhandler.h" -#include -#include +#include -ClipboardHandler::ClipboardHandler() -{ + +ClipboardHandler::ClipboardHandler() { } -ClipboardHandler::~ClipboardHandler() -{ +ClipboardHandler::~ClipboardHandler() { } -std::string ClipboardHandler::getText() -{ - std::string ret; - char* sdlAllocatedText = SDL_GetClipboardText(); - ret.assign(sdlAllocatedText); - SDL_free(sdlAllocatedText); +wxString ClipboardHandler::getText() { + wxString ret; + if (wxTheClipboard->Open()) + { + if (wxTheClipboard->IsSupported(wxDF_TEXT)) { + wxTextDataObject data; + wxTheClipboard->GetData(data); + ret = data.GetText(); + } + wxTheClipboard->Close(); + } return ret; } diff --git a/src/clipboardhandler.h b/src/clipboardhandler.h index 65fa516..4ed101d 100644 --- a/src/clipboardhandler.h +++ b/src/clipboardhandler.h @@ -18,16 +18,14 @@ #ifndef CLIPBOARDHANDLER_H #define CLIPBOARDHANDLER_H -#include +#include - -class ClipboardHandler -{ +class ClipboardHandler { public: ClipboardHandler(); ~ClipboardHandler(); - std::string getText(); + wxString getText(); }; #endif diff --git a/src/emulator.cpp b/src/emulator.cpp index 7512025..971b72d 100644 --- a/src/emulator.cpp +++ b/src/emulator.cpp @@ -22,6 +22,7 @@ #include "e2const.h" #include +#include #include @@ -363,16 +364,13 @@ void Emulator::powerOffComputer() { void Emulator::paste() { // Feed input from the clipboard to the Apple keyboard - std::string s = this->clip.getText(); - for (unsigned int i = 0; i < s.length(); ++i) { - unsigned char key = s[i]; - // TODO fix pasting line-endings - if (key == '\n') - key = '\r'; - if ('a' <= key && key <= 'z') { - key -= 32; - } - this->keypresses.push(key); + wxString s = this->clip.getText(); + s.Replace("\n\r", "\r\n"); + s.Replace("\r\n", "\r"); + s.Replace("\n", "\r"); + s.MakeUpper(); + for (auto c : s) { + this->keypresses.push(c); } } diff --git a/src/keyboard.h b/src/keyboard.h index ca99a57..dc52233 100644 --- a/src/keyboard.h +++ b/src/keyboard.h @@ -18,8 +18,8 @@ #ifndef KEYBOARD_H #define KEYBOARD_H -#include #include +#include typedef std::queue KeypressQueue; @@ -31,7 +31,7 @@ class Keyboard { unsigned char latch; unsigned char cGet; - Uint32 lastGet; + uint32_t lastGet; public: Keyboard(KeypressQueue& q, KeyboardBufferMode& buffered);