summaryrefslogtreecommitdiff
path: root/support/dktools/DkWxTraceOptionsDialog.wxc
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /support/dktools/DkWxTraceOptionsDialog.wxc
Initial commit
Diffstat (limited to 'support/dktools/DkWxTraceOptionsDialog.wxc')
-rw-r--r--support/dktools/DkWxTraceOptionsDialog.wxc418
1 files changed, 418 insertions, 0 deletions
diff --git a/support/dktools/DkWxTraceOptionsDialog.wxc b/support/dktools/DkWxTraceOptionsDialog.wxc
new file mode 100644
index 0000000000..348b9008cb
--- /dev/null
+++ b/support/dktools/DkWxTraceOptionsDialog.wxc
@@ -0,0 +1,418 @@
+%% options
+
+copyright owner = Dirk Krause
+copyright year = 2011-xxxx
+license = bsd
+
+
+%% wx-gui
+
+type = dialog
+contents = sDialog
+
+[wxBoxSizer sDialog]
+direction = horizontal
+contents = $stretch(10)
+contents = verticalSizer
+contents = $stretch(10)
+
+[wxBoxSizer verticalSizer]
+direction = vertical
+grow = yes
+contents = $stretch(10)
+contents = sSetup centered-x
+contents = $stretch(10)
+contents = sButtons centered-x
+contents = $stretch(10)
+
+[wxGridBagSizer sSetup]
+contents = sttGeneral 0 0 1 4 left
+contents = cbMake +1 0 1 4 left
+contents = $space(1,10) +1 0 1 4 left
+contents = sttOutput +1 0 1 4 left
+contents = cbLinenumbers +1 0 1 4 left
+contents = cbUseSplint +1 0 1 2 left centered-y
+contents = chSplintChar . 2 1 1 left centered-y
+contents = $space(1,10) +1 0 1 4 left
+contents = sttDebug +1 0 1 4 left
+contents = cbDebug +1 0 1 4 left
+contents = $space(20,1) +1 0 1 1 left
+contents = cbDebStdout . 1 1 3 left
+contents = cbDebTime +1 1 1 3 left
+contents = cbDebTraceKw +1 1 1 3 left
+contents = cbDebWide +1 1 1 3 left
+contents = cbDebPortable +1 1 1 3 left
+
+[wxStaticText sttGeneral]
+text = sTexts[33]
+
+[wxCheckBox cbMake]
+text = sTexts[31]
+tip = sTexts[32]
+
+[wxStaticText sttOutput]
+text = sTexts[34]
+
+[wxCheckBox cbLinenumbers]
+text = sTexts[35]
+tip = sTexts[42]
+
+[wxCheckBox cbUseSplint]
+text = sTexts[94]
+tip = sTexts[95]
+id = DkWxTrace_UseSplint
+
+[wxChoice chSplintChar]
+choices = 18 splintCommentChars
+tip = sTexts[96]
+id = DkWxTrace_SplintChar
+
+[wxStaticText sttDebug]
+text = sTexts[36]
+
+[wxCheckBox cbDebug]
+text = sTexts[37]
+tip = sTexts[43]
+id = DkWxTrace_Debug
+
+[wxCheckBox cbDebStdout]
+text = sTexts[38]
+tip = sTexts[44]
+
+[wxCheckBox cbDebTime]
+text = sTexts[39]
+tip = sTexts[45]
+
+[wxCheckBox cbDebTraceKw]
+text = sTexts[40]
+tip = sTexts[46]
+
+[wxCheckBox cbDebWide]
+text = sTexts[41]
+tip = sTexts[48]
+
+[wxCheckBox cbDebPortable]
+text = sTexts[97]
+tip = sTexts[98]
+
+[wxStdDialogButtonSizer sButtons]
+contents = bOK
+contents = bCancel
+
+[wxButton bOK]
+id = wxID_OK
+text = sTexts[26]
+tip = sTexts[28]
+
+[wxButton bCancel]
+id = wxID_CANCEL
+text = sTexts[27]
+tip = sTexts[29]
+
+%% header start
+
+%% class start
+/** Trace options dialog.
+*/
+class DkWxTraceOptionsDialog : public wxDialog
+{
+ private:
+
+ /** Event table.
+ */
+ DECLARE_EVENT_TABLE()
+
+ protected:
+
+ /** Color for section heads.
+ */
+ wxColour cRed;
+
+ /** Parent window.
+ */
+ DkWxTraceFrame *pa;
+
+ /** Message texts.
+ */
+ wxChar const * const *sTexts;
+
+ /** Option set to configure.
+ */
+ DKCT_OPTION_SET *options;
+
+ /** Flag: We are in correction routine.
+ */
+ int is_correcting;
+
+%% class end
+ public:
+
+ /** Constructor.
+ @param parent Parent window.
+ @param title Title text.
+ @param messageTexts Localized message texts.
+ @param o Options set to modify using this dialog.
+ */
+ DkWxTraceOptionsDialog(
+ DkWxTraceFrame *parent,
+ wxChar const *title,
+ wxChar const * const *messageTexts,
+ DKCT_OPTION_SET *o
+ );
+
+ protected:
+
+ /** Handler for OK button.
+ @param event Event to process.
+ */
+ void OnOK(wxCommandEvent& WXUNUSED(event));
+
+ /** Handler for Cancel button.
+ @param event Event to process.
+ */
+ void OnCancel(wxCommandEvent& WXUNUSED(event));
+
+ /** Handler for clicking the debug checkbox.
+ @param event Event to process.
+ */
+ void OnChangeDebug(wxCommandEvent & WXUNUSED(event));
+
+ /** Handler for changing the use splint option.
+ @param event Event to process.
+ */
+ void OnChangeUseSplint(wxCommandEvent & WXUNUSED(event));
+
+ public:
+
+ /** Transfer data from GUI controls to configuration structure.
+ */
+ void dataOut();
+
+ /** Transfer data from configuration structure to GUI controls.
+ */
+ void dataIn();
+
+ /** Correct GUI depending on cbDebug.
+ */
+ void correctGUI();
+};
+
+%% header end
+
+%% module start
+
+#include "dkwxtrace.h"
+
+
+
+$!trace-include
+
+BEGIN_EVENT_TABLE(DkWxTraceOptionsDialog, wxDialog)
+ EVT_BUTTON(wxID_OK, DkWxTraceOptionsDialog::OnOK)
+ EVT_BUTTON(wxID_CANCEL, DkWxTraceOptionsDialog::OnCancel)
+ EVT_CHECKBOX(DkWxTrace_Debug, DkWxTraceOptionsDialog::OnChangeDebug)
+ EVT_CHECKBOX(DkWxTrace_UseSplint, DkWxTraceOptionsDialog::OnChangeUseSplint)
+END_EVENT_TABLE()
+
+%% constructor start
+DkWxTraceOptionsDialog::DkWxTraceOptionsDialog(
+ DkWxTraceFrame *parent,
+ wxChar const *title,
+ wxChar const * const *messageTexts,
+ DKCT_OPTION_SET *o
+) : wxDialog(
+ parent,
+ wxID_ANY,
+ title,
+ wxDefaultPosition,
+ wxDefaultSize,
+ wxDEFAULT_DIALOG_STYLE
+),
+cRed(0x7F, 0x00, 0x00)
+{
+ wxString splintCommentChars[] = {
+ wxString(messageTexts[76]),
+ wxString(messageTexts[77]),
+ wxString(messageTexts[78]),
+ wxString(messageTexts[79]),
+ wxString(messageTexts[80]),
+ wxString(messageTexts[81]),
+ wxString(messageTexts[82]),
+ wxString(messageTexts[83]),
+ wxString(messageTexts[84]),
+ wxString(messageTexts[85]),
+ wxString(messageTexts[86]),
+ wxString(messageTexts[87]),
+ wxString(messageTexts[88]),
+ wxString(messageTexts[89]),
+ wxString(messageTexts[90]),
+ wxString(messageTexts[91]),
+ wxString(messageTexts[92]),
+ wxString(messageTexts[93]),
+ };
+ pa = parent;
+ sTexts = messageTexts;
+ options = o;
+ is_correcting = 0;
+%% constructor end
+ if (dkctGUILayoutOK) {
+ sttGeneral->SetForegroundColour(cRed);
+ sttOutput->SetForegroundColour(cRed);
+ sttDebug->SetForegroundColour(cRed);
+ }
+}
+
+%% module end
+
+void
+DkWxTraceOptionsDialog::OnOK(
+ wxCommandEvent & event
+)
+{
+ dataOut();
+ if(IsModal()) {
+ EndModal(wxID_OK);
+ } else {
+ SetReturnCode(wxID_OK);
+ Show(false);
+ }
+}
+
+
+void
+DkWxTraceOptionsDialog::OnCancel(
+ wxCommandEvent & event
+)
+{
+ if(IsModal()) {
+ EndModal(wxID_CANCEL);
+ } else {
+ SetReturnCode(wxID_CANCEL);
+ Show(false);
+ }
+}
+
+
+
+void
+DkWxTraceOptionsDialog::OnChangeDebug(
+ wxCommandEvent & event
+)
+{
+ correctGUI();
+}
+
+
+
+void
+DkWxTraceOptionsDialog::OnChangeUseSplint(
+ wxCommandEvent & event
+)
+{
+ correctGUI();
+}
+
+
+void
+DkWxTraceOptionsDialog::dataIn()
+{
+ cbLinenumbers->SetValue((options->lnn) ? true : false);
+ cbMake->SetValue((options->mak) ? true : false);
+ cbDebug->SetValue((options->deb) ? true : false);
+ cbDebStdout->SetValue((options->deb == 2) ? true : false);
+ cbDebWide->SetValue((options->win) ? true : false);
+ cbDebPortable->SetValue((options->port) ? true : false);
+ cbDebTraceKw->SetValue((options->tkw) ? true : false);
+ cbDebTime->SetValue((options->ts) ? true : false);
+ if ('\0' != options->spls) {
+ cbUseSplint->SetValue(true);
+ chSplintChar->SetSelection(pa->findSplintCharacterIndex(options->spls));
+ } else {
+ cbUseSplint->SetValue(false);
+ chSplintChar->SetSelection(0);
+ }
+ correctGUI();
+}
+
+
+
+void
+DkWxTraceOptionsDialog::dataOut()
+{
+ options->deb = (cbDebug->GetValue()) ? (
+ (cbDebStdout->GetValue()) ? 2 : 1
+ ) : 0;
+ options->lnn = (cbLinenumbers->GetValue()) ? 1 : 0;
+ options->mak = (cbMake->GetValue()) ? 1 : 0;
+ options->tkw = (cbDebTraceKw->GetValue()) ? 1 : 0;
+ options->ts = (cbDebTime->GetValue()) ? 1 : 0;
+ options->win = (cbDebWide->GetValue()) ? 1 : 0;
+ options->port = (cbDebPortable->GetValue()) ? 1 : 0;
+ if (cbUseSplint->GetValue()) {
+ options->spls =
+ (char)((sTexts[76 + chSplintChar->GetCurrentSelection()])[0]);
+ } else {
+ options->spls = '\0';
+ }
+}
+
+
+void
+DkWxTraceOptionsDialog::correctGUI()
+{
+ if(!(is_correcting)) {
+ is_correcting = 1;
+ if(cbDebug) {
+ if(cbDebug->GetValue()) {
+ if(cbDebStdout) {
+ cbDebStdout->Enable(true);
+ }
+ if(cbDebTime) {
+ cbDebTime->Enable(true);
+ }
+ if(cbDebTraceKw) {
+ cbDebTraceKw->Enable(true);
+ }
+ if(cbDebWide) {
+ cbDebWide->Enable(true);
+ }
+ if(NULL != cbDebPortable) {
+ cbDebPortable->Enable(true);
+ }
+ } else {
+ if(cbDebStdout) {
+ cbDebStdout->SetValue(false);
+ cbDebStdout->Enable(false);
+ }
+ if(cbDebTime) {
+ cbDebTime->SetValue(false);
+ cbDebTime->Enable(false);
+ }
+ if(cbDebTraceKw) {
+ cbDebTraceKw->SetValue(false);
+ cbDebTraceKw->Enable(false);
+ }
+ if(cbDebWide) {
+ cbDebWide->SetValue(false);
+ cbDebWide->Enable(false);
+ }
+ if(NULL != cbDebPortable) {
+ cbDebPortable->SetValue(false);
+ cbDebPortable->Enable(false);
+ }
+ }
+ }
+ if (cbUseSplint) {
+ if (cbUseSplint->GetValue()) { $? ". enable"
+ chSplintChar->Enable(true);
+ } else { $? ". disable"
+ chSplintChar->Enable(false);
+ }
+ }
+ is_correcting = 0;
+ Refresh();
+ Update();
+ }
+}
+
+