/* Copyright (C) 2019-2020, Dirk Krause SPDX-License-Identifier: BSD-3-Clause */ /* WARNING: This file was generated by the dkct program (see http://dktools.sourceforge.net/ for details). Changes you make here will be lost if dkct is run again! You should modify the original source and run dkct on it. Original source: WxdkdrawDlgTextInput.wxc */ /** @file WxdkdrawDlgTextInput.cpp The WxdkdrawDlgTextInput module. */ #line 208 "WxdkdrawDlgTextInput.wxc" #ifndef WXDKDRAWDLGTEXTINPUT_H_INCLUDED #include "WxdkdrawDlgTextInput.h" #endif #line 215 "WxdkdrawDlgTextInput.wxc" /** Assign methods to event IDs. */ #if wxCHECK_VERSION(3,0,0) wxBEGIN_EVENT_TABLE(WxdkdrawDlgTextInput,wxDialog) #else BEGIN_EVENT_TABLE(WxdkdrawDlgTextInput,wxDialog) #endif EVT_BUTTON(\ wxID_OK,\ WxdkdrawDlgTextInput::OnOK\ ) EVT_BUTTON(\ wxID_CANCEL,\ WxdkdrawDlgTextInput::OnCancel\ ) EVT_TEXT_ENTER(\ WXD_ID_EXPORT_TEXT,\ WxdkdrawDlgTextInput::OnExportText\ ) EVT_TEXT_ENTER(\ WXD_ID_SCREEN_TEXT,\ WxdkdrawDlgTextInput::OnScreenText\ ) #if wxCHECK_VERSION(3,0,0) wxEND_EVENT_TABLE() #else END_EVENT_TABLE() #endif #line 247 "WxdkdrawDlgTextInput.wxc" WxdkdrawDlgTextInput::WxdkdrawDlgTextInput( WxdkdrawFrame *pParent, wxChar const * const *pLocTexts, wxChar const * const *pNlTexts, wxChar **ppExport, wxChar **ppScreen, bool bLaTeX, dk4_er_t *pErrorReport ) : wxDialog( pParent, wxID_ANY, pLocTexts[400], wxDefaultPosition, wxDefaultSize, ( ((wxDEFAULT_DIALOG_STYLE) | (wxRESIZE_BORDER)) #if 0 & (~(wxRESIZE_BORDER)) #endif & (~(wxCLOSE_BOX)) & (~(wxSYSTEM_MENU)) ) ), m_cRed(0x7F, 0, 0) { m_pParent = pParent; m_bLaTeX = bLaTeX; m_ppExport = ppExport; m_ppScreen = ppScreen; m_pLocTexts = pLocTexts; m_pErrorReport = pErrorReport; dkctGUILayoutOK = false; sizerHorizontal = NULL; sizerVertical = NULL; sizerContents = NULL; sizerButtons = NULL; labelExport = NULL; textExport = NULL; labelScreen = NULL; textScreen = NULL; buttonOK = NULL; buttonCancel = NULL; sizerHorizontal = new wxBoxSizer( wxHORIZONTAL ); if(!(sizerHorizontal)) { goto dkctGUILayoutFinished; } sizerHorizontal->Add(10, 10, 0); sizerVertical = new wxBoxSizer( wxVERTICAL ); if(!(sizerVertical)) { goto dkctGUILayoutFinished; } sizerVertical->Add(10, 10, 0); sizerContents = new wxBoxSizer( wxVERTICAL ); if(!(sizerContents)) { goto dkctGUILayoutFinished; } labelExport = new wxStaticText( this, wxID_ANY, pLocTexts[396] ); if(!(labelExport)) { goto dkctGUILayoutFinished; } sizerContents->Add( labelExport, 0, wxALIGN_LEFT ); textExport = new wxTextCtrl( this, WXD_ID_EXPORT_TEXT, pNlTexts[20], wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER ); if(!(textExport)) { goto dkctGUILayoutFinished; } textExport->SetToolTip(pLocTexts[398]); sizerContents->Add( textExport, 1, wxALIGN_LEFT|wxGROW ); sizerContents->Add(10, 10, 0); labelScreen = new wxStaticText( this, wxID_ANY, pLocTexts[397] ); if(!(labelScreen)) { goto dkctGUILayoutFinished; } sizerContents->Add( labelScreen, 0, wxALIGN_LEFT ); textScreen = new wxTextCtrl( this, WXD_ID_SCREEN_TEXT, pNlTexts[20], wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER ); if(!(textScreen)) { goto dkctGUILayoutFinished; } textScreen->SetToolTip(pLocTexts[399]); sizerContents->Add( textScreen, 1, wxALIGN_LEFT|wxGROW ); sizerVertical->Add( sizerContents, 1, wxALIGN_CENTER_HORIZONTAL|wxGROW ); sizerVertical->Add(10, 10, 0); sizerButtons = new wxStdDialogButtonSizer( ); if(!(sizerButtons)) { goto dkctGUILayoutFinished; } buttonOK = new wxButton( this, wxID_OK, pLocTexts[259] ); if(!(buttonOK)) { goto dkctGUILayoutFinished; } buttonOK->SetToolTip(pLocTexts[401]); sizerButtons->AddButton( buttonOK ); buttonCancel = new wxButton( this, wxID_CANCEL, pLocTexts[260] ); if(!(buttonCancel)) { goto dkctGUILayoutFinished; } buttonCancel->SetToolTip(pLocTexts[402]); sizerButtons->AddButton( buttonCancel ); sizerButtons->Realize(); sizerVertical->Add( sizerButtons, 0, wxALIGN_CENTER_HORIZONTAL ); sizerVertical->Add(10, 10, 0); sizerHorizontal->Add( sizerVertical, 1, wxGROW ); sizerHorizontal->Add(10, 10, 0); SetSizer(sizerHorizontal); dkctGUILayoutOK = true; dkctGUILayoutFinished: if(dkctGUILayoutOK) { sizerHorizontal->Fit(this); sizerHorizontal->SetSizeHints(this); } #line 276 "WxdkdrawDlgTextInput.wxc" if (dkctGUILayoutOK) { if (NULL != *ppExport) { wxString str(*ppExport); { textExport->SetValue(str); } } else { textExport->SetValue(pNlTexts[19]); } if ((bLaTeX) && (NULL != *ppScreen)) { wxString str(*ppScreen); { textScreen->SetValue(str); } } else { textScreen->SetValue(pNlTexts[19]); } if (!(bLaTeX)) { textScreen->Enable(false); } #if 0 panelContents->Layout(); #endif Layout(); #if 0 wxSize minsize = GetMinSize(); SetMaxSize(minsize); #endif } } #line 311 "WxdkdrawDlgTextInput.wxc" bool WxdkdrawDlgTextInput::CheckSufficientInput(void) { bool back = false; wxString exportString = textExport->GetValue(); { wxCStrData exportCstr = exportString.c_str(); { wxChar const *exportPtr = (wxChar const *)exportCstr; if (NULL != exportPtr) { if ((size_t)0U < dk4strx_len(exportPtr)) { back = true; } } } } return back; } void WxdkdrawDlgTextInput::TransferInputData(void) { bool successExport = false; wxString exportString = textExport->GetValue(); { wxCStrData exportCstr = exportString.c_str(); { wxChar const *exportPtr = (wxChar const *)exportCstr; if (NULL != exportPtr) { if ((size_t)0U < dk4strx_len(exportPtr)) { wxChar *exportNew = dk4strx_dup(exportPtr, NULL); if (NULL != exportNew) { if (NULL != *m_ppExport) { dk4mem_free(*m_ppExport); } *m_ppExport = exportNew; successExport = true; } else { /* ERROR: Memory */ dk4error_set_simple_error_code( m_pErrorReport, DK4_E_MEMORY_ALLOCATION_FAILED ); } } else { /* ERROR: No text entered */ labelExport->SetForegroundColour(m_cRed); labelExport->SetLabel(m_pLocTexts[642]); textExport->SetFocus(); Refresh(); Update(); } } else { /* ERROR: No text entered */ labelExport->SetForegroundColour(m_cRed); labelExport->SetLabel(m_pLocTexts[642]); textExport->SetFocus(); Refresh(); Update(); } } } if (successExport && m_bLaTeX) { wxString screenString = textScreen->GetValue(); { wxCStrData screenCstr = screenString.c_str(); { wxChar const *screenPtr = (wxChar const *)screenCstr; if (NULL != screenPtr) { if ((size_t)0U < dk4strx_len(screenPtr)) { wxChar *screenNew = dk4strx_dup(screenPtr, NULL); if (NULL != screenNew) { if (NULL != *m_ppScreen) { dk4mem_free(*m_ppScreen); } *m_ppScreen = screenNew; } else { /* ERROR: Memory */ dk4error_set_simple_error_code( m_pErrorReport, DK4_E_MEMORY_ALLOCATION_FAILED ); } } else { /* No text entered */ } } else { /* No text entered */ } } } } else { if (NULL != *m_ppScreen) { dk4mem_free(*m_ppScreen); *m_ppScreen = NULL; } } } void WxdkdrawDlgTextInput::OnOK(wxCommandEvent & WXUNUSED(event)) { if (CheckSufficientInput()) { TransferInputData(); if(IsModal()) { EndModal(wxID_OK); } else { SetReturnCode(wxID_OK); Show(false); } } else { /* TODO: Return to export text */ labelExport->SetForegroundColour(m_cRed); labelExport->SetLabel(m_pLocTexts[642]); textExport->SetFocus(); Refresh(); Update(); } } void WxdkdrawDlgTextInput::OnCancel(wxCommandEvent & WXUNUSED(event)) { if(IsModal()) { EndModal(wxID_CANCEL); } else { SetReturnCode(wxID_CANCEL); Show(false); } } void WxdkdrawDlgTextInput::OnExportText(wxCommandEvent & WXUNUSED(event)) { #line 466 "WxdkdrawDlgTextInput.wxc" if (m_bLaTeX) { textScreen->SetFocus(); } else { if (CheckSufficientInput()) { TransferInputData(); if(IsModal()) { EndModal(wxID_OK); } else { SetReturnCode(wxID_OK); Show(false); } } else { /* TODO: Return to export text */ labelExport->SetForegroundColour(m_cRed); labelExport->SetLabel(m_pLocTexts[642]); textExport->SetFocus(); Refresh(); Update(); } } #line 490 "WxdkdrawDlgTextInput.wxc" } void WxdkdrawDlgTextInput::OnScreenText(wxCommandEvent & WXUNUSED(event)) { #line 498 "WxdkdrawDlgTextInput.wxc" if (CheckSufficientInput()) { TransferInputData(); if(IsModal()) { EndModal(wxID_OK); } else { SetReturnCode(wxID_OK); Show(false); } } else { /* TODO: Return to export text */ labelExport->SetForegroundColour(m_cRed); labelExport->SetLabel(m_pLocTexts[642]); textExport->SetFocus(); Refresh(); Update(); } #line 517 "WxdkdrawDlgTextInput.wxc" } /* vim: set ai sw=4 ts=4 : */