diff options
author | Norbert Preining <norbert@preining.info> | 2020-09-20 03:03:26 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2020-09-20 03:03:26 +0000 |
commit | 1f457376b478257b88d4a857f5ec1b6155442dd7 (patch) | |
tree | 2a06a60551dea362cf8cb0cb0ba66c78608717c4 /support/dktools/WxdkdrawDlgLineStyle.cpp | |
parent | ac690ca29ad5bf8a5203a65fd6252f7b564f4727 (diff) |
CTAN sync 202009200303
Diffstat (limited to 'support/dktools/WxdkdrawDlgLineStyle.cpp')
-rw-r--r-- | support/dktools/WxdkdrawDlgLineStyle.cpp | 342 |
1 files changed, 342 insertions, 0 deletions
diff --git a/support/dktools/WxdkdrawDlgLineStyle.cpp b/support/dktools/WxdkdrawDlgLineStyle.cpp new file mode 100644 index 0000000000..c515e096af --- /dev/null +++ b/support/dktools/WxdkdrawDlgLineStyle.cpp @@ -0,0 +1,342 @@ +/* +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: WxdkdrawDlgLineStyle.wxc +*/ + +/** @file WxdkdrawDlgLineStyle.cpp The WxdkdrawDlgLineStyle module. +*/ + + +#line 188 "WxdkdrawDlgLineStyle.wxc" + +#ifndef WXDKDRAWDLGLINESTYLE_H_INCLUDED +#include "WxdkdrawDlgLineStyle.h" +#endif + + + + + +#line 196 "WxdkdrawDlgLineStyle.wxc" + + + +#if wxCHECK_VERSION(3,0,0) +wxBEGIN_EVENT_TABLE(WxdkdrawDlgLineStyle,wxDialog) +#else +BEGIN_EVENT_TABLE(WxdkdrawDlgLineStyle,wxDialog) +#endif + EVT_BUTTON(\ + WxdkdrawDlgLineStyle::WXD_ID_LS_SOLID,\ + WxdkdrawDlgLineStyle::OnStyleButton\ + ) + EVT_BUTTON(\ + WxdkdrawDlgLineStyle::WXD_ID_LS_DASH,\ + WxdkdrawDlgLineStyle::OnStyleButton\ + ) + EVT_BUTTON(\ + WxdkdrawDlgLineStyle::WXD_ID_LS_DOT,\ + WxdkdrawDlgLineStyle::OnStyleButton\ + ) + EVT_BUTTON(\ + WxdkdrawDlgLineStyle::WXD_ID_LS_DASH_DOT,\ + WxdkdrawDlgLineStyle::OnStyleButton\ + ) + EVT_BUTTON(\ + WxdkdrawDlgLineStyle::WXD_ID_LS_DASH_DOT_DOT,\ + WxdkdrawDlgLineStyle::OnStyleButton\ + ) + EVT_BUTTON(\ + WxdkdrawDlgLineStyle::WXD_ID_LS_DASH_DOT_DOT_DOT,\ + WxdkdrawDlgLineStyle::OnStyleButton\ + ) + EVT_BUTTON(\ + wxID_CANCEL,\ + WxdkdrawDlgLineStyle::OnCancel\ + ) +#if wxCHECK_VERSION(3,0,0) +wxEND_EVENT_TABLE() +#else +END_EVENT_TABLE() +#endif + + + +#line 240 "WxdkdrawDlgLineStyle.wxc" + +WxdkdrawDlgLineStyle::WxdkdrawDlgLineStyle( + WxdkdrawFrame *pParent, + Wxd_object_t *pObject, + wxChar const * const *pTexts, + const char ** const *pImages, + bool bDrwElem +) : wxDialog( + pParent, wxID_ANY, pTexts[216], + wxDefaultPosition, wxDefaultSize, + ( + (wxDEFAULT_DIALOG_STYLE) + & (~(wxRESIZE_BORDER)) + & (~(wxCLOSE_BOX)) + & (~(wxSYSTEM_MENU)) + ) +) +{ + m_pParent = pParent; + m_pObject = pObject; + m_pTexts = pTexts; + m_pImages = pImages; + m_bDrwElem = bDrwElem; + m_uLineStyleOriginal = m_uLineStyleCurrent = pObject->ls; + dkctGUILayoutOK = false; + sizerHorizontal = NULL; + sizerVertical = NULL; + sizerButtons = NULL; + buttonCancel = NULL; + buttonSolid = NULL; + buttonDashed = NULL; + buttonDotted = NULL; + buttonDashDot = NULL; + buttonDashDotDot = NULL; + buttonDashDotDotDot = 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); + sizerButtons = new wxBoxSizer( + wxHORIZONTAL + ); + if(!(sizerButtons)) { + goto dkctGUILayoutFinished; + } + buttonSolid = new wxBitmapButton( + this, + WXD_ID_LS_SOLID, + pImages[0] + ); + if(!(buttonSolid)) { + goto dkctGUILayoutFinished; + } + buttonSolid->SetToolTip(pTexts[217]); + sizerButtons->Add( + buttonSolid, + 0, + wxALIGN_CENTER_VERTICAL + ); + sizerButtons->Add(10, 10, 0); + buttonDashed = new wxBitmapButton( + this, + WXD_ID_LS_DASH, + pImages[1] + ); + if(!(buttonDashed)) { + goto dkctGUILayoutFinished; + } + buttonDashed->SetToolTip(pTexts[218]); + sizerButtons->Add( + buttonDashed, + 0, + wxALIGN_CENTER_VERTICAL + ); + sizerButtons->Add(10, 10, 0); + buttonDotted = new wxBitmapButton( + this, + WXD_ID_LS_DOT, + pImages[2] + ); + if(!(buttonDotted)) { + goto dkctGUILayoutFinished; + } + buttonDotted->SetToolTip(pTexts[219]); + sizerButtons->Add( + buttonDotted, + 0, + wxALIGN_CENTER_VERTICAL + ); + sizerButtons->Add(10, 10, 0); + buttonDashDot = new wxBitmapButton( + this, + WXD_ID_LS_DASH_DOT, + pImages[3] + ); + if(!(buttonDashDot)) { + goto dkctGUILayoutFinished; + } + buttonDashDot->SetToolTip(pTexts[220]); + sizerButtons->Add( + buttonDashDot, + 0, + wxALIGN_CENTER_VERTICAL + ); + sizerButtons->Add(10, 10, 0); + buttonDashDotDot = new wxBitmapButton( + this, + WXD_ID_LS_DASH_DOT_DOT, + pImages[4] + ); + if(!(buttonDashDotDot)) { + goto dkctGUILayoutFinished; + } + buttonDashDotDot->SetToolTip(pTexts[221]); + sizerButtons->Add( + buttonDashDotDot, + 0, + wxALIGN_CENTER_VERTICAL + ); + sizerButtons->Add(10, 10, 0); + buttonDashDotDotDot = new wxBitmapButton( + this, + WXD_ID_LS_DASH_DOT_DOT_DOT, + pImages[5] + ); + if(!(buttonDashDotDotDot)) { + goto dkctGUILayoutFinished; + } + buttonDashDotDotDot->SetToolTip(pTexts[222]); + sizerButtons->Add( + buttonDashDotDotDot, + 0, + wxALIGN_CENTER_VERTICAL + ); + sizerVertical->Add( + sizerButtons + ); + sizerVertical->Add(10, 10, 0); + buttonCancel = new wxButton( + this, + wxID_CANCEL, + pTexts[223] + ); + if(!(buttonCancel)) { + goto dkctGUILayoutFinished; + } + buttonCancel->SetToolTip(pTexts[224]); + sizerVertical->Add( + buttonCancel, + 0, + wxALIGN_CENTER_HORIZONTAL + ); + sizerVertical->Add(10, 10, 0); + sizerHorizontal->Add( + sizerVertical + ); + sizerHorizontal->Add(10, 10, 0); + SetSizer(sizerHorizontal); + dkctGUILayoutOK = true; + dkctGUILayoutFinished: + if(dkctGUILayoutOK) { + sizerHorizontal->Fit(this); + sizerHorizontal->SetSizeHints(this); + } + +#line 265 "WxdkdrawDlgLineStyle.wxc" + if (dkctGUILayoutOK) { + wxSize minsize = GetMinSize(); + SetMaxSize(minsize); + } +} + + + + +#line 274 "WxdkdrawDlgLineStyle.wxc" + + +void +WxdkdrawDlgLineStyle::OnStyleButton(wxCommandEvent & event) +{ + bool bDoRefresh = false; + + switch (event.GetId()) { + case WXD_ID_LS_DASH : { + m_uLineStyleCurrent = WXD_LS_DASH; + } break; + case WXD_ID_LS_DOT : { + m_uLineStyleCurrent = WXD_LS_DOT; + } break; + case WXD_ID_LS_DASH_DOT : { + m_uLineStyleCurrent = WXD_LS_DASH_DOT; + } break; + case WXD_ID_LS_DASH_DOT_DOT : { + m_uLineStyleCurrent = WXD_LS_DASH_DOT_DOT; + } break; + case WXD_ID_LS_DASH_DOT_DOT_DOT : { + m_uLineStyleCurrent = WXD_LS_DASH_DOT_DOT_DOT; + } break; + default : { /* solid */ + m_uLineStyleCurrent = WXD_LS_SOLID; + } break; + } + if ((m_bDrwElem) && (m_uLineStyleCurrent != m_pObject->ls)) { + bDoRefresh = true; + } + m_pObject->ls = m_uLineStyleCurrent; + if (bDoRefresh) { + m_pParent->RequireRedraw(WXD_REFRESH_DRAWING); + } + if(IsModal()) { + EndModal(wxID_OK); + } + else { + SetReturnCode(wxID_OK); + Show(false); + } +} + + + +void +WxdkdrawDlgLineStyle::OnCancel(wxCommandEvent & WXUNUSED(event)) +{ + bool bDoRefresh = false; + m_uLineStyleCurrent = m_uLineStyleOriginal; + if ((m_bDrwElem) && (m_pObject->ls != m_uLineStyleCurrent)) { + bDoRefresh = true; + } + m_pObject->ls = m_uLineStyleCurrent; + if (bDoRefresh) { + m_pParent->RequireRedraw(WXD_REFRESH_DRAWING); + } + if(IsModal()) { + EndModal(wxID_CANCEL); + } + else { + SetReturnCode(wxID_CANCEL); + Show(false); + } +} + + + +#if 0 + +uint8_t +WxdkdrawDlgLineStyle::GetLineStyle(void) +const +{ + return m_uLineStyleCurrent; +} + +#endif + + + +/* vim: set ai sw=4 ts=4 : */ + |