diff --git a/Src/Common/AppSettingsData.h b/Src/Common/AppSettingsData.h index 5beddc2dc..3aaed26a9 100644 --- a/Src/Common/AppSettingsData.h +++ b/Src/Common/AppSettingsData.h @@ -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 @@ -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"}, @@ -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" }, }; diff --git a/Src/Common/AppSettingsHeader.h b/Src/Common/AppSettingsHeader.h index bde7e7e21..20f9d068a 100644 --- a/Src/Common/AppSettingsHeader.h +++ b/Src/Common/AppSettingsHeader.h @@ -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, @@ -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 }; diff --git a/Src/Win32/Dasher.cpp b/Src/Win32/Dasher.cpp index f515d3873..1728f2dcf 100644 --- a/Src/Win32/Dasher.cpp +++ b/Src/Win32/Dasher.cpp @@ -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" @@ -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 @@ -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)); } @@ -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); +} \ No newline at end of file diff --git a/Src/Win32/Dasher.h b/Src/Win32/Dasher.h index fce443a4f..63e1370af 100644 --- a/Src/Win32/Dasher.h +++ b/Src/Win32/Dasher.h @@ -15,6 +15,7 @@ extern CONST UINT WM_DASHER_FOCUS; class CCanvas; class CEdit; +class CPopup; class CDasherWindow; namespace Dasher { @@ -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 @@ -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 &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 m_pDefaultVoice; diff --git a/Src/Win32/Dasher.rc b/Src/Win32/Dasher.rc index 80f57e31f..ed3fab7d1 100644 --- a/Src/Win32/Dasher.rc +++ b/Src/Win32/Dasher.rc @@ -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" @@ -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 @@ -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 ///////////////////////////////////////////////////////////////////////////// diff --git a/Src/Win32/Dasher.vcxproj b/Src/Win32/Dasher.vcxproj index bd984ef66..a4c8d9bfd 100644 --- a/Src/Win32/Dasher.vcxproj +++ b/Src/Win32/Dasher.vcxproj @@ -170,6 +170,8 @@ + + @@ -196,6 +198,8 @@ + + diff --git a/Src/Win32/DasherWindow.cpp b/Src/Win32/DasherWindow.cpp index 2273b4422..fed35a06c 100644 --- a/Src/Win32/DasherWindow.cpp +++ b/Src/Win32/DasherWindow.cpp @@ -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; @@ -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::Create(NULL, NULL, WindowTitle.c_str(), WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN, WS_EX_NOACTIVATE | WS_EX_APPWINDOW | WS_EX_TOPMOST); ::SetMenu(hWnd, NULL); @@ -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); @@ -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); @@ -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; @@ -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), @@ -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: @@ -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; @@ -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) @@ -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; @@ -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); diff --git a/Src/Win32/DasherWindow.h b/Src/Win32/DasherWindow.h index d7ec449a9..89a2defd2 100644 --- a/Src/Win32/DasherWindow.h +++ b/Src/Win32/DasherWindow.h @@ -14,6 +14,7 @@ #include "Widgets/Splitter.h" #include "Widgets/StatusControl.h" #include "Widgets/Edit.h" +#include "Widgets/Popup.h" class CToolbar; namespace Dasher { @@ -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() @@ -52,6 +54,7 @@ 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) @@ -59,6 +62,7 @@ class CDasherWindow : 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); @@ -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; diff --git a/Src/Win32/Widgets/AdvancedPage.cpp b/Src/Win32/Widgets/AdvancedPage.cpp index a68f042ce..61102c0ef 100644 --- a/Src/Win32/Widgets/AdvancedPage.cpp +++ b/Src/Win32/Widgets/AdvancedPage.cpp @@ -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; diff --git a/Src/Win32/Widgets/Edit.cpp b/Src/Win32/Widgets/Edit.cpp index b7d0c0776..6f57360f9 100644 --- a/Src/Win32/Widgets/Edit.cpp +++ b/Src/Win32/Widgets/Edit.cpp @@ -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). diff --git a/Src/Win32/Widgets/Edit.h b/Src/Win32/Widgets/Edit.h index b6cd43fc4..341833d1d 100644 --- a/Src/Win32/Widgets/Edit.h +++ b/Src/Win32/Widgets/Edit.h @@ -74,7 +74,6 @@ class CEdit : public ATL::CWindowImpl { HRESULT OnKeyUp(UINT message, WPARAM wParam, LPARAM lParam, BOOL& bHandled); HRESULT OnCommand(UINT message, WPARAM wParam, LPARAM lParam, BOOL& bHandled); - void Move(int x, int y, int Width, int Height); unsigned int OffsetAfterMove(unsigned int offsetBefore, bool bForwards, Dasher::CControlManager::EditDistance iDist); @@ -113,6 +112,9 @@ class CEdit : public ATL::CWindowImpl { //ACL Making these public so can be called directly from CDasher void HandleParameterChange(int iParameter); + //Expose current text- Used by the Popup Window to update external display window + std::string getOutput(); + protected: bool m_dirty; diff --git a/Src/Win32/Widgets/Popup.cpp b/Src/Win32/Widgets/Popup.cpp new file mode 100644 index 000000000..cc3400a85 --- /dev/null +++ b/Src/Win32/Widgets/Popup.cpp @@ -0,0 +1,301 @@ +// Popup.cpp +// +// Copyright (c) 2016 The Dasher Team +// +// This file is part of Dasher. +// +// Dasher is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// Dasher is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Dasher; if not, write to the Free Software +// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +// +// NOTES: Created by Jeremy Cope to facilitate extended (multiple) displays. +// + +#include "WinCommon.h" + +#include "Popup.h" +#include +#include "../../DasherCore/Event.h" +#include "FilenameGUI.h" +#include "../resource.h" +#include "../../DasherCore/DasherInterfaceBase.h" +#include "../Dasher.h" + +/** +* This class manages the external popup window +* to be used to be used on an 2nd monitor (extended display). +* +* Known Issues: +* -> Setting the font- seems to capture size but not name +* +* +* +*/ + + +using namespace Dasher; +using namespace std; +using namespace WinLocalisation; +using namespace WinUTF8; + +BOOL contains(RECT rectA, RECT rectB); +BOOL CALLBACK MonitorEnumProc(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData); + + +/** +* Constructors, Destructors, Initializers, Setup Functions +*/ +CPopup::CPopup(CAppSettings *pAppSettings) { + m_pAppSettings = pAppSettings; + + UINT CodePage = GetUserCodePage(); + m_Font = GetCodePageFont(CodePage, 14); + + m_setup = false; + m_externalMonitorRect = RECT(); + m_dasherWindwowRect = RECT(); + m_popupRect = RECT(); +} + +HWND CPopup::Create(HWND hParent, bool bNewWithDate) { + RECT r = getInitialWindow(); + m_popup = CWindowImpl::Create(hParent, r, NULL, WS_OVERLAPPEDWINDOW| ES_MULTILINE ); + return *this; +} + +CPopup::~CPopup() { + DeleteObject(m_Font); +} + +void CPopup::setupPopup() { + if (!m_setup) { + m_setup = true; + + //Calculate the size of the windows,displays + calculateDisplayProperties(); + + //Determine the placement of the popup + positionPopup(); + + //If enabled, show and start the auto update timer + if (m_pAppSettings->GetBoolParameter(APP_BP_POPUP_ENABLE) == true) { + //Show the Popup + ShowWindow(SW_SHOW); + //Fire the update timer + CDasher* dasher = (CDasher*)m_pDasherInterface; //Cast for concrete implementation + dasher->configurePopupTimer(true); + } + } +} + +void CPopup::SetFont(string Name, long Size) { + Tstring FontName; + UTF8string_to_wstring(Name, FontName); + + if(Size == 0) + Size = 14; + + DeleteObject(m_Font); + if (Name == "") { + UINT CodePage = GetUserCodePage(); + m_Font = GetCodePageFont(CodePage, -Size); + } + else { + m_Font = CreateFont(-Size, 0, 0, 0, FW_DONTCARE, FALSE, FALSE, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, FF_DONTCARE, FontName.c_str()); // DEFAULT_CHARSET => font made just from Size and FontName + } + SendMessage(WM_SETFONT, (WPARAM) m_Font, true); +} + +void CPopup::SetInterface(Dasher::CDasherInterfaceBase *DasherInterface) { + m_pDasherInterface = DasherInterface; +} + + +/** +* Text Display Management- used to update the display with different text +*/ +//Timer callback function +void CPopup::updateDisplay(const std::string sText) { + //If the display output has changed.. update the popup window + if (sText.compare(m_Output) != 0) { + m_Output = sText; + output(m_Output); + } +} +//Exposed Method so outside classes can force an update on the screen +void CPopup::output(const std::string &sText) { + wstring String; + WinUTF8::UTF8string_to_wstring(sText, String); + InsertText(String); +} +//Actually updates the window with the provided text +void CPopup::InsertText(Tstring InsertText) { + //Update entire screen + SendMessage(WM_SETTEXT, TRUE, (LPARAM)InsertText.c_str()); + //Scroll to bottom + SendMessage(EM_LINESCROLL, 0, INT_MAX); //Force to end of buffer with max integer +} + + +/** +* Popup Actionables- called when parameter changes in settings, or toolbar button is pressed +* BUG: Seems to be called twice on parameter changes +*/ +void CPopup::HandleParameterChange(int iParameter) { + switch(iParameter) { + case APP_SP_POPUP_FONT: + case APP_LP_POPUP_FONT_SIZE: + SetFont(m_pAppSettings->GetStringParameter(APP_SP_POPUP_FONT), m_pAppSettings->GetLongParameter(APP_LP_POPUP_FONT_SIZE)); + break; + case APP_BP_POPUP_ENABLE: + if(m_pAppSettings->GetBoolParameter(APP_BP_POPUP_ENABLE) == true){ + ShowWindow(SW_SHOW); + CDasher* dasher = (CDasher*)m_pDasherInterface; //Cast for concrete implementation + dasher->configurePopupTimer(true); + } + else { + ShowWindow(SW_HIDE); + } + break; + case APP_BP_POPUP_EXTERNAL_SCREEN: + positionPopup(); + break; + case APP_BP_POPUP_INFRONT: + break; + default: + break; + } +} +//Toolbar quick action ignores 'use external monitor' setting +//Forces external monitor usages (fi exists) +bool CPopup::processToolbarButtonPress() { + bool popupEnabled = false; + popupEnabled = m_pAppSettings->GetBoolParameter(APP_BP_POPUP_ENABLE); + //Action depends on current status + if (popupEnabled == false) { + //Quick button possitions fully on the external monitor, if monitor exists + LPRECT popupDisplayRect; + if (isExtMonitorDetected()) { + popupDisplayRect = &m_externalMonitorRect; + } + else { + popupDisplayRect = &m_popupRect; + } + MoveWindow(popupDisplayRect); + } + + //Update the state flag + popupEnabled = !popupEnabled; + m_pAppSettings->SetBoolParameter(APP_BP_POPUP_ENABLE, popupEnabled); //Setting the parameter triggers action + //Return the current state + return popupEnabled; +} + +/** +* Popup Management and Placement +*/ +void CPopup::Move(int x, int y, int Width, int Height) { + MoveWindow(x, y, Width, Height, TRUE); +} + +RECT CPopup::getInitialWindow() { + RECT rect; + rect = { + 1000,100,1800,500 + }; + return rect; +} + +void CPopup::calculateDisplayProperties() { + getDasherWidnowInfo(); + //Warning, assync call, enumerates all displays + getMonitorInfo(); +} + +void CPopup::positionPopup() { + LPRECT popupDisplayRect; + if (m_pAppSettings->GetBoolParameter(APP_BP_POPUP_EXTERNAL_SCREEN) == true) { + //May have setting to use external, but does external screen exists? + if (isExtMonitorDetected()) { + popupDisplayRect = &m_externalMonitorRect; + } + else { + popupDisplayRect = &m_popupRect; + } + } + else { + popupDisplayRect = &m_popupRect; + } + + //Redraw in the correct location + MoveWindow(popupDisplayRect, true); +} + +bool CPopup::isExtMonitorDetected() { + bool retVal = false; + if (!IsRectEmpty(&m_externalMonitorRect)){ + retVal = true; + } + return retVal; +} + +void CPopup::getMonitorInfo(){ + RECT* userData[2] = { &m_dasherWindwowRect, &m_externalMonitorRect }; + EnumDisplayMonitors(NULL, NULL, MonitorEnumProc, (LPARAM)&userData); +} + +void CPopup::getDasherWidnowInfo() { + //Get Dasher Window position and size + CDasher* dasher = (CDasher*)m_pDasherInterface; //Cast for concrete implementation + int iTop = 0; + int iLeft = 0; + int iBottom = 0; + int iRight = 0; + + dasher->GetWindowSize(&iTop, &iLeft, &iBottom, &iRight); + + m_dasherWindwowRect.top = iTop; + m_dasherWindwowRect.left = iLeft; + m_dasherWindwowRect.right = iRight; + m_dasherWindwowRect.bottom = iBottom; + + //Initialize our window based on the dasher window + m_popupRect.top = m_dasherWindwowRect.top + 100; + m_popupRect.left = m_dasherWindwowRect.left + 100; + m_popupRect.right = m_dasherWindwowRect.right + 100; + m_popupRect.bottom = m_dasherWindwowRect.top + (m_dasherWindwowRect.bottom - m_dasherWindwowRect.top)/2; +} + +BOOL CALLBACK MonitorEnumProc(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData) { + RECT monitorCoordinates = *lprcMonitor; + RECT** userData = (RECT**)dwData; + RECT* dasherRect = userData[0]; + RECT* externRect = userData[1]; + + //If this monitor contains the dasher Window, it is primary monitor + //Else it is external monitor, and should be used for popup. + //Else window spans multiple monitors.. + if (contains(monitorCoordinates, *dasherRect)) { + + } + else { + //Never called if no extra monitor + *externRect = monitorCoordinates; + } + return TRUE; +} + +BOOL contains(RECT rectA, RECT rectB) { + return (rectA.left < rectB.right && rectA.right > rectB.left && + rectA.top < rectB.bottom && rectA.bottom > rectB.top); +} \ No newline at end of file diff --git a/Src/Win32/Widgets/Popup.h b/Src/Win32/Widgets/Popup.h new file mode 100644 index 000000000..868edf01f --- /dev/null +++ b/Src/Win32/Widgets/Popup.h @@ -0,0 +1,110 @@ +// Popup.cpp +// +// Copyright (c) 2016 The Dasher Team +// +// This file is part of Dasher. +// +// Dasher is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// Dasher is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Dasher; if not, write to the Free Software +// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +#ifndef __Popup_h__ +#define __Popup_h__ + +#define _ATL_APARTMENT_THREADED +#include + +//You may derive a class from CComModule and use it if you want to override something, + +//but do not change the name of _Module + +extern CComModule _Module; + +#include + +#include "../AppSettings.h" +#include "../DasherAction.h" +#include "../../DasherCore/DasherTypes.h" +#include "../../DasherCore/ControlManager.h" +#include + +class CCanvas; +class CFilenameGUI; + +namespace Dasher { + class CDasherInterfaceBase; + class CEvent; +}; + +class CPopup : public ATL::CWindowImpl { + public: + + CPopup(CAppSettings *pAppSettings); + ~CPopup(); + + HWND Create(HWND hParent, bool bNewWithDate); + void setupPopup(); //Call once Dasher has been drawn, so we can determine placement + + // Superclass the built-in EDIT window class + DECLARE_WND_SUPERCLASS(NULL, _T("EDIT")) + + BEGIN_MSG_MAP(CPopup) + + END_MSG_MAP() + + void Move(int x, int y, int Width, int Height); + + void SetFont(std::string Name, long Size); + + void SetInterface(Dasher::CDasherInterfaceBase * DasherInterface); + + // called when a new character falls under the crosshair + void output(const std::string & sText); + + void updateDisplay(const std::string sText); + + //ACL Making these public so can be called directly from CDasher + void HandleParameterChange(int iParameter); + + //Called when the quick enable button is pressed in the toolbar + bool processToolbarButtonPress(); + + protected: + bool m_dirty; + + private: + Dasher::CDasherInterfaceBase *m_pDasherInterface; + CAppSettings *m_pAppSettings; + + bool m_setup; + HWND Parent; + HWND m_popup; + HWND m_hTarget; + HFONT m_Font; + HWND targetwindow; + std::string m_Output; // UTF-8 to go to training file + RECT m_dasherWindwowRect; + RECT m_externalMonitorRect; + RECT m_popupRect; //The current rect being used for the popup + + void InsertText(Tstring InsertText); // add symbol to edit control + RECT getInitialWindow(); + void calculateDisplayProperties(); + void positionPopup(); + void getDasherWidnowInfo(); + void getMonitorInfo(); + bool isExtMonitorDetected(); + +}; + +#endif /* #ifndef __CPopup_h__ */ diff --git a/Src/Win32/Widgets/PopupPage.cpp b/Src/Win32/Widgets/PopupPage.cpp new file mode 100644 index 000000000..4d10239c1 --- /dev/null +++ b/Src/Win32/Widgets/PopupPage.cpp @@ -0,0 +1,198 @@ +// AlphabetBox.cpp +// +///////////////////////////////////////////////////////////////////////////// +// +// Copyright (c) 2002 Iain Murray, Inference Group, Cavendish, Cambridge. +// +///////////////////////////////////////////////////////////////////////////// + +#include "WinCommon.h" + +#include "PopupPage.h" +#include "../resource.h" + +#include // for std::pair + +using namespace Dasher; +using namespace std; + +// Track memory leaks on Windows to the line that new'd the memory +#ifdef _WIN32 +#ifdef _DEBUG +#define DEBUG_NEW new( _NORMAL_BLOCK, THIS_FILE, __LINE__ ) +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif +#endif + +CPopupPage::CPopupPage(HWND Parent, CAppSettings *pAppSettings) +:CPrefsPageBase(Parent, pAppSettings) { + + m_CurrentColours = pAppSettings->GetStringParameter(SP_COLOUR_ID); +} + +struct menuentry { + int paramNum; // enum value in Parameters.h for setting store + int idcNum; // #define value in resource.h for dasher.rc +}; + +// List of menu items that will be displayed in the General Preferences +static menuentry menutable[] = { + {BP_DRAW_MOUSE, IDC_DRAWMOUSE}, + {BP_DRAW_MOUSE_LINE, IDC_DRAWMOUSELINE}, +}; + +void CPopupPage::PopulateList() { + // Populate the controls in the dialogue box based on the relevent parameters + // in m_pDasher + //Popup Enabled + if (m_pAppSettings->GetBoolParameter(APP_BP_POPUP_ENABLE) == true) { + SendMessage(GetDlgItem(m_hwnd, IDC_POPUP_ENABLE), BM_SETCHECK, BST_CHECKED, 0); + } + if (m_pAppSettings->GetBoolParameter(APP_BP_POPUP_EXTERNAL_SCREEN) == true) { + SendMessage(GetDlgItem(m_hwnd, IDC_POPUP_EXTERNAL), BM_SETCHECK, BST_CHECKED, 0); + } + // TODO: Annoying inversion makes this hard + if(m_pAppSettings->GetBoolParameter(BP_PALETTE_CHANGE)) { + SendMessage(GetDlgItem(m_hwnd, IDC_COLOURSCHEME), BM_SETCHECK, BST_UNCHECKED, 0); + EnableWindow(GetDlgItem(m_hwnd, IDC_COLOURS), FALSE); + } + else { + SendMessage(GetDlgItem(m_hwnd, IDC_COLOURSCHEME), BM_SETCHECK, BST_CHECKED, 0); + EnableWindow(GetDlgItem(m_hwnd, IDC_COLOURS), TRUE); + } + + for(int ii = 0; iiGetBoolParameter(menutable[ii].paramNum)) { + SendMessage(GetDlgItem(m_hwnd, menutable[ii].idcNum), BM_SETCHECK, BST_CHECKED, 0); + } + else { + SendMessage(GetDlgItem(m_hwnd, menutable[ii].idcNum), BM_SETCHECK, BST_UNCHECKED, 0); + } + } + + + HWND ListBox = GetDlgItem(m_hwnd, IDC_COLOURS); + m_pAppSettings->GetPermittedValues(SP_COLOUR_ID, ColourList); + + // Add each string to list box and index each one + bool SelectionSet = false; + for(unsigned int i = 0; i < ColourList.size(); i++) { + Tstring Item; + WinUTF8::UTF8string_to_wstring(ColourList[i], Item); + LRESULT Index = SendMessage(ListBox, LB_ADDSTRING, 0, (LPARAM) Item.c_str()); + SendMessage(ListBox, LB_SETITEMDATA, Index, (LPARAM) i); + if(ColourList[i] == m_CurrentColours) { + SendMessage(ListBox, LB_SETCURSEL, Index, 0); + SelectionSet = true; + } + } + if(SelectionSet == false) { + SendMessage(ListBox, LB_SETCURSEL, 0, 0); + LRESULT CurrentIndex = SendMessage(ListBox, LB_GETITEMDATA, 0, 0); + m_CurrentColours = ColourList[CurrentIndex]; + } + // Tell list box that we have set an item for it (so that delete and edit can be grayed if required) + SendMessage(m_hwnd, WM_COMMAND, MAKEWPARAM(IDC_COLOURS, LBN_SELCHANGE), 0); + + if(m_pAppSettings->GetLongParameter(LP_LINE_WIDTH) > 1) + SendMessage(GetDlgItem(m_hwnd, IDC_THICKLINE), BM_SETCHECK, BST_CHECKED, 0); + else + SendMessage(GetDlgItem(m_hwnd, IDC_THICKLINE), BM_SETCHECK, BST_UNCHECKED, 0); + + SendMessage(GetDlgItem(m_hwnd, IDC_OUTLINE), BM_SETCHECK, + m_pAppSettings->GetLongParameter(LP_OUTLINE_WIDTH) ? BST_CHECKED : BST_UNCHECKED, 0); + + if(m_pAppSettings->GetLongParameter(LP_DASHER_FONTSIZE) == Dasher::Opts::Normal) { + SendMessage(GetDlgItem(m_hwnd, IDC_FONT_SMALL), BM_SETCHECK, BST_CHECKED, 0); + } + else if(m_pAppSettings->GetLongParameter(LP_DASHER_FONTSIZE) == Dasher::Opts::Big) { + SendMessage(GetDlgItem(m_hwnd, IDC_FONT_LARGE), BM_SETCHECK, BST_CHECKED, 0); + } + else if(m_pAppSettings->GetLongParameter(LP_DASHER_FONTSIZE) == Dasher::Opts::VBig) { + SendMessage(GetDlgItem(m_hwnd, IDC_FONT_VLARGE), BM_SETCHECK, BST_CHECKED, 0); + } +} + + +bool CPopupPage::Apply() { + if(m_CurrentColours != std::string("")) { + m_pAppSettings->SetStringParameter(SP_COLOUR_ID, m_CurrentColours); + } + + m_pAppSettings->SetBoolParameter(BP_PALETTE_CHANGE, + SendMessage(GetDlgItem(m_hwnd, IDC_COLOURSCHEME), BM_GETCHECK, 0, 0) == BST_UNCHECKED ); + + if(SendMessage(GetDlgItem(m_hwnd, IDC_FONT_SMALL), BM_GETCHECK, 0, 0) == BST_CHECKED) + m_pAppSettings->SetLongParameter(LP_DASHER_FONTSIZE, Dasher::Opts::Normal); + else if(SendMessage(GetDlgItem(m_hwnd, IDC_FONT_LARGE), BM_GETCHECK, 0, 0) == BST_CHECKED) + m_pAppSettings->SetLongParameter(LP_DASHER_FONTSIZE, Dasher::Opts::Big); + else if(SendMessage(GetDlgItem(m_hwnd, IDC_FONT_VLARGE), BM_GETCHECK, 0, 0) == BST_CHECKED) + m_pAppSettings->SetLongParameter(LP_DASHER_FONTSIZE, Dasher::Opts::VBig); + + // Return false (and notify the user) if something is wrong. + return TRUE; +} + +LRESULT CPopupPage::WndProc(HWND Window, UINT message, WPARAM wParam, LPARAM lParam) { + // most things we pass on to CPrefsPageBase, but we need to handle slider motion + switch (message) { + case WM_COMMAND: + if (HIWORD(wParam) == BN_CLICKED || HIWORD(wParam) == LBN_SELCHANGE) { + if (LOWORD(wParam) != 0 && m_hPropertySheet != 0 && m_hwnd != 0) { + PropSheet_Changed(m_hPropertySheet, m_hwnd); // enables the 'Apply' button + // Behaviour isn't *perfect* since it activates the Apply button even if you, say, + // click 'new' alphabet then click Cancel when asked for a name. + } + } + switch (LOWORD(wParam)) { + case (IDC_COLOURS): + if (HIWORD(wParam) == LBN_SELCHANGE) { + HWND ListBox = GetDlgItem(m_hwnd, IDC_COLOURS); + LRESULT CurrentItem = SendMessage(ListBox, LB_GETCURSEL, 0, 0); + LRESULT CurrentIndex = SendMessage(ListBox, LB_GETITEMDATA, CurrentItem, 0); + m_CurrentColours = ColourList[CurrentIndex]; + } + return TRUE; + break; + case IDC_DFONT_BUTTON: // TODO: Put this in a function + { + CHOOSEFONT Data; + LOGFONT lf; + HFONT Font = (HFONT)GetStockObject(DEFAULT_GUI_FONT); + GetObject(Font, sizeof(LOGFONT), &lf); + Tstring tstrFaceName; + WinUTF8::UTF8string_to_wstring(m_pAppSettings->GetStringParameter(SP_DASHER_FONT), tstrFaceName); + _tcscpy(lf.lfFaceName, tstrFaceName.c_str()); + Data.Flags = CF_INITTOLOGFONTSTRUCT | CF_SCREENFONTS; + Data.lStructSize = sizeof(CHOOSEFONT); + // TODO: Give this an owner + Data.hwndOwner = NULL; + Data.lpLogFont = &lf; + if (ChooseFont(&Data)) { + string FontName; + WinUTF8::wstring_to_UTF8string(lf.lfFaceName, FontName); + m_pAppSettings->SetStringParameter(APP_SP_POPUP_FONT, FontName); + m_pAppSettings->SetLongParameter(APP_LP_POPUP_FONT_SIZE, lf.lfHeight); + } + } + break; + case IDC_COLOURSCHEME: + EnableWindow(GetDlgItem(m_hwnd, IDC_COLOURS), SendMessage(GetDlgItem(m_hwnd, IDC_COLOURSCHEME), BM_GETCHECK, 0, 0) == BST_CHECKED); + break; + case IDC_POPUP_ENABLE: + m_pAppSettings->SetBoolParameter(APP_BP_POPUP_ENABLE, !(m_pAppSettings->GetBoolParameter(APP_BP_POPUP_ENABLE))); + break; + case IDC_POPUP_EXTERNAL: + m_pAppSettings->SetBoolParameter(APP_BP_POPUP_EXTERNAL_SCREEN, !(m_pAppSettings->GetBoolParameter(APP_BP_POPUP_EXTERNAL_SCREEN))); + break; + case IDC_POPUP_ALWAYSTOP: + //TODO: Track setting of alwasy on top of windows + break; + default: + break; + } + } + return CPrefsPageBase::WndProc(Window, message, wParam, lParam); +} diff --git a/Src/Win32/Widgets/PopupPage.h b/Src/Win32/Widgets/PopupPage.h new file mode 100644 index 000000000..64621a9c5 --- /dev/null +++ b/Src/Win32/Widgets/PopupPage.h @@ -0,0 +1,38 @@ +// ViewPage.h +// +///////////////////////////////////////////////////////////////////////////// +// +// Copyright (c) 2002 Iain Murray, Inference Group, Cavendish, Cambridge. +// +///////////////////////////////////////////////////////////////////////////// + +#ifndef __PopupPage_h__ +#define __PopupPage_h__ + +#include "PrefsPageBase.h" + +#include "../resource.h" +#include "../AppSettings.h" + +#include "../Dasher.h" +#include "../../DasherCore/ColourIO.h" + +class CPopupPage:public CPrefsPageBase { +public: + CPopupPage(HWND Parent, CAppSettings *pAppSettings); + LRESULT WndProc(HWND Window, UINT message, WPARAM wParam, LPARAM lParam); + +private: + std::vector < std::string > ColourList; + std::string m_CurrentColours; + Dasher::CColourIO::ColourInfo CurrentInfo; + + // Some status flags: + void PopulateList(); + void InitCustomBox(); + bool UpdateInfo(); + bool Apply(); + +}; + +#endif /* #ifndef */ diff --git a/Src/Win32/Widgets/Prefs.cpp b/Src/Win32/Widgets/Prefs.cpp index 055eae9d2..b2ce57d7c 100644 --- a/Src/Win32/Widgets/Prefs.cpp +++ b/Src/Win32/Widgets/Prefs.cpp @@ -28,10 +28,12 @@ CPrefs::CPrefs(HWND hParent, CDasher *pDasher, CAppSettings *pAppSettings) { m_pControlPage = new CControlPage(hParent, pDasher, pAppSettings); m_pViewPage = new CViewPage(hParent, pAppSettings); m_pAdvancedPage = new CAdvancedPage(hParent, pAppSettings); + m_pPopupPage = new CPopupPage(hParent, pAppSettings); + // Set up the property sheets which go into the preferences // dialogue. - PROPSHEETPAGE psp[4]; + PROPSHEETPAGE psp[5]; memset(psp, 0, sizeof(psp)); psp[0].dwSize = sizeof(PROPSHEETPAGE); psp[0].dwFlags = PSP_USEICONID | PSP_USETITLE | PSP_PREMATURE; @@ -72,6 +74,16 @@ CPrefs::CPrefs(HWND hParent, CDasher *pDasher, CAppSettings *pAppSettings) { psp[3].pszTitle = MAKEINTRESOURCE(IDS_PREFS_LM); psp[3].lParam = (LPARAM) m_pAdvancedPage; psp[3].pfnCallback = NULL; + + psp[4].dwSize = sizeof(PROPSHEETPAGE); + psp[4].dwFlags = PSP_USEICONID | PSP_USETITLE | PSP_PREMATURE; + psp[4].hInstance = WinHelper::hInstApp; + psp[4].pszTemplate = MAKEINTRESOURCE(IDS_PREFS_POPUP); + psp[4].pszIcon = NULL; + psp[4].pfnDlgProc = (DLGPROC)WinWrapMap::PSWndProc; + psp[4].pszTitle = MAKEINTRESOURCE(IDS_PREFS_POPUP); + psp[4].lParam = (LPARAM)m_pPopupPage; + psp[4].pfnCallback = NULL; PROPSHEETHEADER psh; memset(&psh, 0, sizeof(psh)); diff --git a/Src/Win32/Widgets/Prefs.h b/Src/Win32/Widgets/Prefs.h index 6401381dc..f9401d900 100644 --- a/Src/Win32/Widgets/Prefs.h +++ b/Src/Win32/Widgets/Prefs.h @@ -17,6 +17,7 @@ #include "ControlPage.h" #include "ViewPage.h" #include "AdvancedPage.h" +#include "PopupPage.h" #include "../AppSettings.h" namespace Dasher { @@ -36,6 +37,7 @@ class CPrefs:public CWinWrap { CControlPage *m_pControlPage; CViewPage *m_pViewPage; CAdvancedPage *m_pAdvancedPage; + CPopupPage *m_pPopupPage; }; #endif /* #ifndef __PrefsBox_h__ */ diff --git a/Src/Win32/Widgets/Toolbar.cpp b/Src/Win32/Widgets/Toolbar.cpp index 1e6dde145..74238120a 100644 --- a/Src/Win32/Widgets/Toolbar.cpp +++ b/Src/Win32/Widgets/Toolbar.cpp @@ -41,7 +41,10 @@ SToolbarButton sButtons[] = { {-2, 5, IDS_EDIT_COPY_ALL, ID_EDIT_COPY_ALL}, {STD_PASTE, 6, IDS_EDIT_PASTE, ID_EDIT_PASTE}, {-1, -1, 0, 0}, - {STD_PROPERTIES, 7, IDS_OPTIONS_PREFS, ID_OPTIONS_PREFS} + {STD_PROPERTIES, 7, IDS_OPTIONS_PREFS, ID_OPTIONS_PREFS}, + { -1, -1, 0, 0 }, + //External Display + { STD_PRINTPRE, 8, IDC_POPUP_QUICK, ID_QUICK_POPUP }, }; CToolbar::CToolbar(HWND hParent, bool bVisible) { @@ -67,9 +70,7 @@ void CToolbar::ShowToolbar(bool bValue) { void CToolbar::CreateToolbar() { WinHelper::InitCommonControlLib(); - - - + m_hRebar = CreateWindowEx(WS_EX_TOOLWINDOW, REBARCLASSNAME, NULL, diff --git a/Src/Win32/Widgets/ViewPage.cpp b/Src/Win32/Widgets/ViewPage.cpp index ec3a67753..162b0e3a6 100644 --- a/Src/Win32/Widgets/ViewPage.cpp +++ b/Src/Win32/Widgets/ViewPage.cpp @@ -148,7 +148,6 @@ bool CViewPage::Apply() { } LRESULT CViewPage::WndProc(HWND Window, UINT message, WPARAM wParam, LPARAM lParam) { - // most things we pass on to CPrefsPageBase, but we need to handle slider motion switch (message) { diff --git a/Src/Win32/resource.h b/Src/Win32/resource.h index cde219a58..054a2447c 100644 --- a/Src/Win32/resource.h +++ b/Src/Win32/resource.h @@ -36,6 +36,7 @@ #define IDD_APPEARANCEPAGE 178 #define IDD_APPPAGE 179 #define IDD_MODULESETTINGS 180 +#define IDS_PREFS_POPUP 181 #define IDD_STATUSBAR 182 #define IDC_INPUT_LIST 1008 #define IDC_CONTROL_LIST 1009 @@ -91,9 +92,16 @@ #define IDC_CHECK5 1157 #define IDC_CONTROLBOXES 1160 #define IDC_FILE_ENCODING 1161 -#define IDC_SPEED_EDIT 1163 -#define IDC_SPEED_SPIN 1164 -#define IDC_ALPHABET_COMBO 1166 +#define IDC_POPUP_ENABLE 1162 +#define IDC_POPUP_EXTERNAL 1163 +#define IDC_POPUP_ALWAYSTOP 1164 +#define IDC_SPEED_EDIT 1165 +#define IDC_SPEED_SPIN 1166 +#define IDC_ALPHABET_COMBO 1167 + +#define IDC_POPUP_QUICK 1170 +#define ID_QUICK_POPUP 1171 + #define ID_EDIT_SELECTALL 32775 #define ID_HELP_CONTENTS 32776 #define ID_EDIT_COPY_ALL 32798