From d222394af2aecd62b5323c173265aa8c28c72e64 Mon Sep 17 00:00:00 2001 From: Peter Kwan Date: Sat, 8 Feb 2020 21:01:19 +0000 Subject: [PATCH] Bug fixes Crash due to re-opening the Special Keys window fixed. Occasional crash due to typing on the end of a double height line fixed. Navigating across double height lines wasn't always correct. --- HelpFrame.cpp | 7 +++ HelpFrame.h | 1 + release.txt | 4 +- ttxline.cpp | 23 +++++++++ ttxline.h | 11 ++++- ttxpage.cpp | 20 ++++---- wxTED.depend | 12 ++--- wxTED.layout | 104 ++++++++++++++++++++--------------------- wxTEDMain.h | 2 +- wxsmith/HelpFrame1.wxs | 1 + 10 files changed, 114 insertions(+), 71 deletions(-) diff --git a/HelpFrame.cpp b/HelpFrame.cpp index 956e0cf..232b200 100644 --- a/HelpFrame.cpp +++ b/HelpFrame.cpp @@ -22,6 +22,8 @@ HelpFrame::HelpFrame(wxWindow* parent,wxWindowID id,const wxPoint& pos,const wxS Move(wxDefaultPosition); HtmlWindow1 = new wxHtmlWindow(this, ID_HTMLWINDOW1, wxPoint(0,72), wxSize(344,384), wxHW_SCROLLBAR_AUTO, _T("ID_HTMLWINDOW1")); HtmlWindow1->SetPage(_("\n\n\n\n\n
\n\t\n\t\tSpecial keys
\n\t\tPage Up - Show next page of carousel
\n\t\tPage Down - Show previous page of carousel
\n\t\tF11 - Hide/Reveal
\n\t\tCTRL-Z - Undo
\n\t\tAlt-Gr - Show control codes
\n\t
\n
\n
\n\tText colours
\n\t\n\t\tShift-F1 - Red text
\n\t\tShift-F2 - Green text
\n\t\tShift-F3 - Yellow text
\n\t\tShift-F4 - Blue text
\n\t\tShift-F5 - Magenta text
\n\t\tShift-F6 - Cyan text
\n\t\tShift-F7 - White text
\n\t\tShift-F8 - Black text (Level 2.5)
\n\t
\n\tGraphic colours\tWhen the small graphics cursor is displayed then pressing space will toggle the pixel on and off. Also, the keys q,w,a,s,z,x toggle individual bits within a mosaic character
\n\t\n\t\tCtrl-F1 - Graphics red
\n\t\tCtrl-F2 - Graphics green
\n\t\tCtrl-F3 - Graphics yellow
\n\t\tCtrl-F4 - Graphics blue
\n\t\tCtrl-F5 - Graphics magenta
\n\t\tCtrl-F6 - Graphics cyan
\n\t\tCtrl-F7 - Graphics white
\n\t\tCtrl-F8 - Graphics black (Level 2.5)
\n\t
\n
\n
\n\tEffects
\n\t\n\t\tCTRL-H - Flash
\n\t\tCTRL-I - Steady
\n\t\tCTRL-J - End Box
\n\t\tCTRL-K - Start Box
\n\t\tCTRL-L - Normal height
\n\t\tCTRL-M (enter) - Double height
\n\t\tCTRL-R - Conceal display
\n\t\tCTRL-D - Contiguous graphics
\n\t\tCTRL-T - Separated graphics
\n\t\tCTRL-U - Black background
\n\t\tCTRL-B - New background
\n\t\tCTRL-W - Hold graphics
\n\t\tCTRL-X - Release graphics
\n
\n CTRL-BACKSPACE - Delete Row
\n\t
\n
\n\n\n")); + + Connect(wxID_ANY,wxEVT_CLOSE_WINDOW,(wxObjectEventFunction)&HelpFrame::OnClose); //*) } @@ -31,3 +33,8 @@ HelpFrame::~HelpFrame() //*) } + +void HelpFrame::OnClose(wxCloseEvent& event) +{ + Show(false); +} diff --git a/HelpFrame.h b/HelpFrame.h index ae9dcea..2a82c5a 100644 --- a/HelpFrame.h +++ b/HelpFrame.h @@ -26,6 +26,7 @@ class HelpFrame: public wxFrame private: //(*Handlers(HelpFrame) + void OnClose(wxCloseEvent& event); //*) DECLARE_EVENT_TABLE() diff --git a/release.txt b/release.txt index 04caa1f..33d2034 100644 --- a/release.txt +++ b/release.txt @@ -14,9 +14,9 @@ Build->Select Target 6) Run Inno Script Studio using the configuration that is in the Release folder and load winpackage.iss. Set the myAppVersion and VersionInfoVersion to the new version number. - Select Project->Compile. + Select Build->Compile. This creates a setup.exe in the same folder. - Rename setup.exe to include the version number like setup_1_14.exe. + Rename setup.exe to include the version number like setup_1.45.exe. 7) Open the Github repo online https://github.com/peterkvt80/wxted diff --git a/ttxline.cpp b/ttxline.cpp index 9a3ae67..2adf899 100644 --- a/ttxline.cpp +++ b/ttxline.cpp @@ -131,6 +131,29 @@ std::string TTXLine::GetMappedline7bit() return str; } +bool TTXLine::HasDoubleHeight() +{ + bool doubleHeight=false; + uint8_t x=40; + if (m_textline.empty()) + { + return false; + } + // If the line we are testing isn't long enough, just check the last character. + if (m_textline.length()2) { - if (GetRow(cursorLoc.y-2)->IsDoubleHeight(cursorLoc.x)) + if (GetRow(cursorLoc.y-2)->HasDoubleHeight()) { cursorLoc.y--; } @@ -1090,8 +1090,8 @@ void TTXPage::SetCharAt(int code, int modifiers, wxPoint& cursorLoc, wxPoint& cu { if (cursorLoc.y<24) { - // If the last location was the top of a double height, we need to increment twice. - if (GetRow(cursorLoc.y)->IsDoubleHeight(cursorLoc.x) && cursorLoc.y<23) + // If the last location was the top half of a double height, we need to increment twice. + if (GetRow(cursorLoc.y)->HasDoubleHeight() && cursorLoc.y<23) { cursorLoc.y++; } @@ -1148,7 +1148,7 @@ void TTXPage::SetCharAt(int code, int modifiers, wxPoint& cursorLoc, wxPoint& cu } break; default : - // std::cout << "Default branch taken in SetCharAt " << (int)code << "i=" << instance << std::endl; + // std::cout << "Default branch taken in SetCharAt " << (int)code << " i=" << instance << std::endl; if (line) { // By now we should only have teletext codes. If the new code is NOT a graphic then treat it as a character @@ -1167,11 +1167,16 @@ void TTXPage::SetCharAt(int code, int modifiers, wxPoint& cursorLoc, wxPoint& cu } else { + // If this is double height, we need to skip an extra line + if (cursorLoc.y<23 && line->HasDoubleHeight()) + { + cursorLoc.y++; + } if (cursorLoc.y<24) { cursorLoc.y++; cursorLoc.x=0; - // If we have effects set up o n the left edge we would lose it + // If we have effects set up on the left edge we would lose it // so we check the first three characters just in case TTXLine* line2=m_pLine[cursorLoc.y]; // Allow for up to three control codes on a wrap @@ -1233,7 +1238,6 @@ void TTXPage::SetCharAt(int code, int modifiers, wxPoint& cursorLoc, wxPoint& cu // Deal with control codes that we might get sent // Backspace, line feed, carriage return. A lot of stuff to trap char oldChar; - std::cout << "[TTXPage::SetCharAt]TRACE 1" << std::endl; switch (code) { case WXK_BACK : // backspace 8 diff --git a/wxTED.depend b/wxTED.depend index 3dc3207..413d87f 100644 --- a/wxTED.depend +++ b/wxTED.depend @@ -511,12 +511,12 @@ -1562359383 source:e:\dev\wxted-github\wxted\helpframe.cpp +1581098828 source:e:\dev\wxted-github\wxted\helpframe.cpp "HelpFrame.h" -1427407161 e:\dev\wxted-github\wxted\helpframe.h +1581098733 e:\dev\wxted-github\wxted\helpframe.h @@ -2273,7 +2273,7 @@ 1483012312 e:\dev\wxted-github\wxted\ttxcodes.h -1563221963 e:\dev\wxted-github\wxted\ttxline.h +1581183494 e:\dev\wxted-github\wxted\ttxline.h @@ -2281,10 +2281,10 @@ 1463302150 e:\dev\wxted-github\wxted\hamm-tables.h -1574286336 source:e:\dev\wxted-github\wxted\ttxline.cpp +1581183665 source:e:\dev\wxted-github\wxted\ttxline.cpp "ttxline.h" -1578743876 source:e:\dev\wxted-github\wxted\ttxpage.cpp +1581186632 source:e:\dev\wxted-github\wxted\ttxpage.cpp "ttxpage.h" 1562535472 source:e:\dev\wxted-github\wxted\wxtedapp.cpp @@ -2797,7 +2797,7 @@ "wx/dynarray.h" "wx/vidmode.h" -1578693868 source:e:\dev\wxted-github\wxted\wxtedmain.cpp +1581100971 source:e:\dev\wxted-github\wxted\wxtedmain.cpp "wxTEDMain.h" "wx/wx.h" diff --git a/wxTED.layout b/wxTED.layout index c0b4f1e..a9ffe4b 100644 --- a/wxTED.layout +++ b/wxTED.layout @@ -2,137 +2,137 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/wxTEDMain.h b/wxTEDMain.h index 48bd74b..24255f6 100644 --- a/wxTEDMain.h +++ b/wxTEDMain.h @@ -55,7 +55,7 @@ #include "mapchar.h" // Version number -#define VERSION_STRING wxT("1.45") +#define VERSION_STRING wxT("1.46") // ftp #include diff --git a/wxsmith/HelpFrame1.wxs b/wxsmith/HelpFrame1.wxs index faff018..2fd4aab 100644 --- a/wxsmith/HelpFrame1.wxs +++ b/wxsmith/HelpFrame1.wxs @@ -4,6 +4,7 @@ Special Keys 1 1 + <html> <style> body { font-family: Helvetica, Arial, Sans-Serif; } </style> <body> <div style="border:2px black solid; display: inline-block;"> <span style="display: inline-block; background-color:#FFFFBB"> <b>Special keys</b><br/> Page Up - Show next page of carousel<br/> Page Down - Show previous page of carousel<br/> F11 - Hide/Reveal<br/> CTRL-Z - Undo<br/> Alt-Gr - Show control codes<br/> </span> </div> <div style="border:2px black solid; display: inline-block;"> <b>Text colours</b><br/> <span style="display: inline-block;"> Shift-F1 - Red text<br/> Shift-F2 - Green text<br/> Shift-F3 - Yellow text<br/> Shift-F4 - Blue text<br/> Shift-F5 - Magenta text<br/> Shift-F6 - Cyan text<br/> Shift-F7 - White text<br/> Shift-F8 - Black text (Level 2.5)<br/> </span> <b>Graphic colours</b> When the small graphics cursor is displayed then pressing space will toggle the pixel on and off. Also, the keys q,w,a,s,z,x toggle individual bits within a mosaic character<br/> <span style="display: inline-block; background-color:#BBBBBB"> Ctrl-F1 - Graphics red<br/> Ctrl-F2 - Graphics green<br/> Ctrl-F3 - Graphics yellow<br/> Ctrl-F4 - Graphics blue<br/> Ctrl-F5 - Graphics magenta<br/> Ctrl-F6 - Graphics cyan<br/> Ctrl-F7 - Graphics white<br/> Ctrl-F8 - Graphics black (Level 2.5)<br/> </span> </div> <div style="border:2px black solid; display: inline-block;"> <b>Effects</b><br/> <span style="display: inline-block; background-color:#BBBBBB"> CTRL-H - Flash<br/> CTRL-I - Steady<br/> CTRL-J - End Box<br/> CTRL-K - Start Box<br/> CTRL-L - Normal height<br/> CTRL-M (enter) - Double height<br/> CTRL-R - Conceal display<br/> CTRL-D - Contiguous graphics<br/> CTRL-T - Separated graphics<br/> CTRL-U - Black background<br/> CTRL-B - New background<br/> CTRL-W - Hold graphics<br/> CTRL-X - Release graphics<br/> <br/> CTRL-BACKSPACE - Delete Row<br/> </span> </div> </body> </html> 0,72