Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion Src/Common/AppSettingsData.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@
Dasher::Settings::bp_table app_boolparamtable[] = {
{ APP_BP_TIME_STAMP, "TimeStampNewFiles", Persistence::PERSISTENT, true, "TimeStampNewFiles" },
{ APP_BP_CONFIRM_UNSAVED, "ConfirmUnsavedFiles", Persistence::PERSISTENT, true, "ConfirmUnsavedFiles" },
{APP_BP_SHOW_TOOLBAR, "ViewToolbar", Persistence::PERSISTENT, true, "ViewToolbar"},
{ APP_BP_SHOW_TOOLBAR, "ViewToolbar", Persistence::PERSISTENT, true, "ViewToolbar"},
{ APP_BP_POPUP_ENABLE, "PopupEnable", Persistence::PERSISTENT, false, "PopupEnable"},
{ APP_BP_POPUP_EXTERNAL_SCREEN, "PopupFullScreen", Persistence::PERSISTENT, false, "PopupFullScreen"},
{ APP_BP_POPUP_INFRONT, "PopupInfront", Persistence::PERSISTENT, false, "PopupInfront"},
#ifdef WITH_MAEMO
{ APP_BP_SHOW_STATUSBAR, "ViewStatusbar", Persistence::PERSISTENT, false, "ViewStatusbar" },
#else
Expand All @@ -39,6 +42,7 @@ Dasher::Settings::bp_table app_boolparamtable[] = {
Dasher::Settings::lp_table app_longparamtable[] = {
{APP_LP_FILE_ENCODING, "FileEncodingFormat", Persistence::PERSISTENT, -1, "FileEncodingFormat"},
{APP_LP_EDIT_FONT_SIZE, "EditFontSize", Persistence::PERSISTENT, 0, "EditFontSize"},
{APP_LP_POPUP_FONT_SIZE, "PopupFontSize", Persistence::PERSISTENT, 0, "PopupFontSize"},
{APP_LP_EDIT_SIZE, "EditSize", Persistence::PERSISTENT, 75, "The size of the edit window"},
{APP_LP_SCREEN_WIDTH, "ScreenWidth", Persistence::PERSISTENT, 400, "ScreenWidth"},
{APP_LP_SCREEN_HEIGHT, "ScreenHeight", Persistence::PERSISTENT, 500, "ScreenHeight"},
Expand All @@ -55,6 +59,7 @@ Dasher::Settings::sp_table app_stringparamtable[] = {
{APP_SP_EDIT_FONT, "EditFont", Persistence::PERSISTENT, "Sans 20", "EditFont"},
#else
{APP_SP_EDIT_FONT, "EditFont", Persistence::PERSISTENT, "Sans 10", "EditFont"},
{APP_SP_POPUP_FONT, "PopupFont", Persistence::PERSISTENT, "Sans 10", "PopupFont"},
#endif
{ APP_SP_TOOLBAR_ID, "ToolbarID", Persistence::PERSISTENT, "", "ToolbarID" },
};
8 changes: 6 additions & 2 deletions Src/Common/AppSettingsHeader.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@

enum {
APP_BP_TIME_STAMP = END_OF_SPS, APP_BP_CONFIRM_UNSAVED, APP_BP_SHOW_TOOLBAR,
APP_BP_SHOW_STATUSBAR, APP_BP_MIRROR_LAYOUT, APP_BP_FULL_SCREEN, END_OF_APP_BPS
APP_BP_SHOW_STATUSBAR, APP_BP_MIRROR_LAYOUT, APP_BP_FULL_SCREEN,
APP_BP_POPUP_ENABLE, APP_BP_POPUP_EXTERNAL_SCREEN, APP_BP_POPUP_INFRONT,
END_OF_APP_BPS
};

enum {
APP_LP_FILE_ENCODING = END_OF_APP_BPS, APP_LP_EDIT_FONT_SIZE, // TODO Extract font size from APP_SP_EDIT_FONT as linux
APP_LP_POPUP_FONT_SIZE,
APP_LP_EDIT_SIZE,
APP_LP_SCREEN_WIDTH, APP_LP_SCREEN_HEIGHT,
APP_LP_STYLE, APP_LP_X, APP_LP_Y,
Expand All @@ -23,7 +26,8 @@ enum {
};

enum {
APP_SP_EDIT_FONT = END_OF_APP_LPS,
APP_SP_EDIT_FONT = END_OF_APP_LPS,
APP_SP_POPUP_FONT,
APP_SP_TOOLBAR_ID,
END_OF_APP_SPS
};
Expand Down
11 changes: 9 additions & 2 deletions Src/Win32/Dasher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "DasherMouseInput.h"
#include "DasherWindow.h"
#include "Widgets/Edit.h"
#include "Widgets/Popup.h"

#include "Sockets/SocketInput.h"
#include "BTSocketInput.h"
Expand All @@ -26,8 +27,8 @@ using namespace WinUTF8;

CONST UINT WM_DASHER_FOCUS = RegisterWindowMessage(L"WM_DASHER_FOCUS");

CDasher::CDasher(HWND Parent, CDasherWindow *pWindow, CEdit *pEdit, Dasher::CSettingsStore* settings, CFileUtils* fileUtils)
: CDashIntfScreenMsgs(settings, fileUtils), m_hParent(Parent), m_pWindow(pWindow), m_pEdit(pEdit) {
CDasher::CDasher(HWND Parent, CDasherWindow *pWindow, CEdit *pEdit, CPopup *pPopup, Dasher::CSettingsStore* settings, CFileUtils* fileUtils)
: CDashIntfScreenMsgs(settings, fileUtils), m_hParent(Parent), m_pWindow(pWindow), m_pEdit(pEdit), m_pPopup(pPopup) {
// This class will be a wrapper for the Dasher 'control' - think ActiveX

// Set up COM for the accessibility stuff
Expand Down Expand Up @@ -109,6 +110,7 @@ void Dasher::CDasher::HandleEvent(int iParameter) {
CDashIntfScreenMsgs::HandleEvent(iParameter);
m_pWindow->HandleParameterChange(iParameter);
m_pEdit->HandleParameterChange(iParameter);
m_pPopup->HandleParameterChange(iParameter);
if (iParameter == SP_DASHER_FONT)
m_pCanvas->SetFont(GetStringParameter(SP_DASHER_FONT));
}
Expand Down Expand Up @@ -350,3 +352,8 @@ int CDasher::GetAllContextLenght(){
std::string CDasher::GetTextAroundCursor(CControlManager::EditDistance iDist) {
return m_pEdit->GetTextAroundCursor(iDist);
}

void CDasher::configurePopupTimer(bool enable) {
//Timer is managed by the window object
m_pWindow->configurePopupTimer(enable);
}
9 changes: 6 additions & 3 deletions Src/Win32/Dasher.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ extern CONST UINT WM_DASHER_FOCUS;

class CCanvas;
class CEdit;
class CPopup;
class CDasherWindow;

namespace Dasher {
Expand All @@ -35,7 +36,7 @@ class CWinFileUtils :public CFileUtils {
class CDasher : public CDashIntfScreenMsgs
{
public:
CDasher(HWND Parent, CDasherWindow *pWindow, CEdit *pEdit, Dasher::CSettingsStore* settings, CFileUtils* fileUtils);
CDasher(HWND Parent, CDasherWindow *pWindow, CEdit *pEdit, CPopup *pPopup, Dasher::CSettingsStore* settings, CFileUtils* fileUtils);
~CDasher(void);

// The following functions will not be part of the final interface
Expand Down Expand Up @@ -70,18 +71,20 @@ class CDasher : public CDashIntfScreenMsgs
#endif
bool SupportsClipboard() override { return true; };
void CopyToClipboard(const std::string &text) override;

bool GetWindowSize(int* pTop, int* pLeft, int* pBottom, int* pRight);
void configurePopupTimer(bool enable);
private:
virtual void CreateModules() override;

void ScanDirectory(const Tstring &strMask, std::vector<std::string> &vFileList);
bool GetWindowSize(int* pTop, int* pLeft, int* pBottom, int* pRight);

void Log(); // Does the logging

CCanvas *m_pCanvas;
HWND m_hParent;
CDasherWindow *m_pWindow;
CEdit *m_pEdit;
CPopup *m_pPopup;
#ifdef WIN32_SPEECH
ISpVoice* getVoice(const string& lang);
CComPtr<ISpVoice> m_pDefaultVoice;
Expand Down
28 changes: 28 additions & 0 deletions Src/Win32/Dasher.rc
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,19 @@ BEGIN
GROUPBOX "File Encoding:",IDC_STATIC,193,194,180,30
END

IDS_PREFS_POPUP DIALOGEX 0, 0, 381, 238
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Dialog"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
GROUPBOX "Dasher Popup:", IDC_STATIC, 7, 7, 180, 50
CONTROL "Enable Popup Window", IDC_POPUP_ENABLE, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 12, 18, 110, 10
CONTROL "Use External Monitor", IDC_POPUP_EXTERNAL, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 12, 30, 110, 10
CONTROL "Always On Top", IDC_POPUP_ALWAYSTOP, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 12, 42, 110, 10
GROUPBOX "Popup Style:", IDC_STATIC, 7, 60, 180, 40
PUSHBUTTON "Change Font", IDC_DFONT_BUTTON, 12, 75, 166, 14
END

IDD_MODULESETTINGS DIALOGEX 0, 0, 309, 177
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Dialog"
Expand Down Expand Up @@ -321,6 +334,14 @@ BEGIN
TOPMARGIN, 7
BOTTOMMARGIN, 170
END

IDS_PREFS_POPUP, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 374
TOPMARGIN, 7
BOTTOMMARGIN, 231
END
END
#endif // APSTUDIO_INVOKED

Expand Down Expand Up @@ -482,9 +503,16 @@ BEGIN
IDS_UNTITLED_FILE "Untitled"
IDS_UNSAVED_CHANGES "Unsaved changes"
IDS_PREFS_LM "Application"
IDS_PREFS_POPUP "External Display"
IDS_ERR_SOCKET_TITLE "Dasher Socket Input error"
END

STRINGTABLE
BEGIN
IDC_POPUP_QUICK "Popup"
END


#endif // English (United Kingdom) resources
/////////////////////////////////////////////////////////////////////////////

Expand Down
4 changes: 4 additions & 0 deletions Src/Win32/Dasher.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@
<ClCompile Include="Widgets\ControlPage.cpp" />
<ClCompile Include="Widgets\Edit.cpp" />
<ClCompile Include="Widgets\FilenameGUI.cpp" />
<ClCompile Include="Widgets\Popup.cpp" />
<ClCompile Include="Widgets\PopupPage.cpp" />
<ClCompile Include="Widgets\Prefs.cpp" />
<ClCompile Include="Widgets\PrefsPageBase.cpp" />
<ClCompile Include="Widgets\Splitter.cpp" />
Expand All @@ -196,6 +198,8 @@
<ClInclude Include="Widgets\ControlPage.h" />
<ClInclude Include="Widgets\Edit.h" />
<ClInclude Include="Widgets\FilenameGUI.h" />
<ClInclude Include="Widgets\Popup.h" />
<ClInclude Include="Widgets\PopupPage.h" />
<ClInclude Include="Widgets\Prefs.h" />
<ClInclude Include="Widgets\PrefsPageBase.h" />
<ClInclude Include="Widgets\Splitter.h" />
Expand Down
38 changes: 33 additions & 5 deletions Src/Win32/DasherWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ CDasherWindow::CDasherWindow(const wstring& configName) : m_configName(configNam
m_pAppSettings = 0;
m_pToolbar = 0;
m_pEdit = 0;
m_pPopup = 0;
m_pSpeedAlphabetBar = 0;
m_pSplitter = 0;
m_pDasher = 0;
Expand Down Expand Up @@ -93,8 +94,6 @@ HWND CDasherWindow::Create() {
m_pAppSettings = new CAppSettings(0, 0, settings); // Takes ownership of the settings store.
int iStyle(m_pAppSettings->GetLongParameter(APP_LP_STYLE));

HWND hWnd;

if (iStyle == APP_STYLE_DIRECT) {
hWnd = CWindowImpl<CDasherWindow >::Create(NULL, NULL, WindowTitle.c_str(), WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN, WS_EX_NOACTIVATE | WS_EX_APPWINDOW | WS_EX_TOPMOST);
::SetMenu(hWnd, NULL);
Expand All @@ -109,7 +108,12 @@ HWND CDasherWindow::Create() {
m_pEdit->Create(hWnd, m_pAppSettings->GetBoolParameter(APP_BP_TIME_STAMP));
m_pEdit->SetFont(m_pAppSettings->GetStringParameter(APP_SP_EDIT_FONT), m_pAppSettings->GetLongParameter(APP_LP_EDIT_FONT_SIZE));

m_pDasher = new CDasher(hWnd, this, m_pEdit, settings, &fileUtils);
// Create Pop-Out Window - for multiple display support
m_pPopup = new CPopup(m_pAppSettings);
m_pPopup->Create(hWnd, m_pAppSettings->GetBoolParameter(APP_BP_TIME_STAMP));
m_pPopup->SetFont(m_pAppSettings->GetStringParameter(APP_SP_POPUP_FONT), m_pAppSettings->GetLongParameter(APP_LP_POPUP_FONT_SIZE));

m_pDasher = new CDasher(hWnd, this, m_pEdit, m_pPopup, settings, &fileUtils);

// Create a CAppSettings
m_pAppSettings->SetHwnd(hWnd);
Expand All @@ -121,6 +125,7 @@ HWND CDasherWindow::Create() {
// but at the moment it does, for training, blanking the display etc

m_pEdit->SetInterface(m_pDasher);
m_pPopup->SetInterface(m_pDasher);

m_pSpeedAlphabetBar = new CStatusControl(m_pDasher->GetSettingsUser(), m_pAppSettings);
m_pSpeedAlphabetBar->Create(hWnd);
Expand All @@ -136,6 +141,7 @@ HWND CDasherWindow::Create() {
CDasherWindow::~CDasherWindow() {
delete m_pToolbar;
delete m_pEdit;
delete m_pPopup;
delete m_pSplitter;
delete m_pDasher;
delete m_pSpeedAlphabetBar;
Expand All @@ -145,7 +151,6 @@ CDasherWindow::~CDasherWindow() {
}

void CDasherWindow::Show(int nCmdShow) {

RECT r = {
m_pAppSettings->GetLongParameter(APP_LP_X),
m_pAppSettings->GetLongParameter(APP_LP_Y),
Expand All @@ -160,7 +165,15 @@ void CDasherWindow::Show(int nCmdShow) {
nCmdShow = SW_MAXIMIZE;
ShowWindow(nCmdShow);
}

//This starts a brute force timer to update the popup window display
void CDasherWindow::configurePopupTimer(bool enable){
if (enable) {
::SetTimer(hWnd, 2, 1270, TIMERPROC(NULL));
}
else {
::KillTimer(hWnd, 2);
}
}
void CDasherWindow::HandleParameterChange(int iParameter) {
switch (iParameter) {
case APP_BP_SHOW_TOOLBAR:
Expand Down Expand Up @@ -223,6 +236,10 @@ LRESULT CDasherWindow::OnCommand(UINT message, WPARAM wParam, LPARAM lParam, BOO
CPrefs Prefs(m_hWnd, m_pDasher, m_pAppSettings);
return 0;
}
case ID_QUICK_POPUP: {
m_pPopup->processToolbarButtonPress();
return 0;
}
case ID_HELP_CONTENTS:
HtmlHelp(m_hWnd, L"Dasher.chm", HH_DISPLAY_INDEX, NULL);
return 0;
Expand Down Expand Up @@ -375,6 +392,15 @@ LRESULT CDasherWindow::OnOther(UINT message, WPARAM wParam, LPARAM lParam, BOOL&

return 0;
}
/* Handles Timer Callbacks*/
LRESULT CDasherWindow::OnTimer(UINT message, WPARAM wParam, LPARAM lParam, BOOL& bHandled) {
//Brute force timer to update the external display with a copy of the current Dasher edit display
//Timer should only be in use (created) by the Popup (when enabled)
string currentOutput = m_pEdit->getOutput();
m_pPopup->updateDisplay(currentOutput);
return false;
}


void CDasherWindow::Layout() {
if (!m_bFullyCreated)
Expand Down Expand Up @@ -429,6 +455,7 @@ void CDasherWindow::Layout() {
m_pEdit->Move(Width / 2, ToolbarHeight, Width - Width / 2, CanvasHeight);
}
m_pEdit->ShowWindow(SW_SHOW);
m_pPopup->setupPopup(); //Checks configuration and shows if enabled
m_pSplitter->ShowWindow(SW_HIDE);
break;

Expand Down Expand Up @@ -460,6 +487,7 @@ void CDasherWindow::Layout() {
m_pSplitter->Move(SplitterY, Width);
}
m_pEdit->ShowWindow(SW_SHOW);
m_pPopup->setupPopup(); //Checks configuration and shows if enabled
m_pSplitter->ShowWindow(SW_SHOW);
if (m_bSizeRestored)
m_pAppSettings->SetLongParameter(APP_LP_EDIT_SIZE, EditHeight);
Expand Down
7 changes: 7 additions & 0 deletions Src/Win32/DasherWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "Widgets/Splitter.h"
#include "Widgets/StatusControl.h"
#include "Widgets/Edit.h"
#include "Widgets/Popup.h"

class CToolbar;
namespace Dasher {
Expand All @@ -39,6 +40,7 @@ class CDasherWindow :
MESSAGE_HANDLER(WM_INITMENUPOPUP,OnInitMenuPopup)
MESSAGE_HANDLER(WM_SETFOCUS,OnSetFocus)
MESSAGE_HANDLER(WM_WINDOWPOSCHANGED,OnWindowPosChanged)
MESSAGE_HANDLER(WM_TIMER,OnTimer)
MESSAGE_RANGE_HANDLER(0xC000,0xFFFF,OnOther)
END_MSG_MAP()

Expand All @@ -52,13 +54,15 @@ class CDasherWindow :
LRESULT OnDestroy(UINT message, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnClose(UINT message, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnCommand(UINT message, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnTimer(UINT message, WPARAM wParam, LPARAM lParam, BOOL& bHandled);


// Create window (and children)
// failure returns NULL
HWND Create();

void Show(int nCmdShow);
void configurePopupTimer(bool enable);

void HandleWinEvent(HWINEVENTHOOK hWinEventHook, DWORD event, HWND hwnd,
LONG idObject, LONG idChild, DWORD dwEventThread, DWORD dwmsEventTime);
Expand All @@ -74,12 +78,15 @@ class CDasherWindow :

bool m_bFullyCreated;
Dasher::CDasher *m_pDasher;

HWND hWnd;

HACCEL hAccelTable;

// Widgets:
CToolbar *m_pToolbar;
CEdit *m_pEdit;
CPopup *m_pPopup;
//CCanvas *m_pCanvas;
CSplitter *m_pSplitter;
CStatusControl *m_pSpeedAlphabetBar;
Expand Down
2 changes: 1 addition & 1 deletion Src/Win32/Widgets/AdvancedPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ LRESULT CAdvancedPage::WndProc(HWND Window, UINT message, WPARAM wParam, LPARAM
switch (LOWORD(wParam)) {

case IDC_EFONT_BUTTON:
// TODO: Put this in a function
// TODO: Put this in a function
{
CHOOSEFONT Data;
LOGFONT lf;
Expand Down
7 changes: 7 additions & 0 deletions Src/Win32/Widgets/Edit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,13 @@ void CEdit::SetDirty() {
m_FilenameGUI->SetDirty(true);
}

std::string CEdit::getOutput() {
CString displayText;
GetWindowText(displayText);
std::wstring s(displayText);
return WinUTF8::wstring_to_UTF8string(s.c_str());
}

void CEdit::TNew(const Tstring &filename) {
// TODO: Send a message to the parent to say that the buffer has
// changed (as in the Linux version).
Expand Down
Loading