diff options
Diffstat (limited to 'support/dktools/WxdkdrawFrameTools.cpt')
-rw-r--r-- | support/dktools/WxdkdrawFrameTools.cpt | 2440 |
1 files changed, 0 insertions, 2440 deletions
diff --git a/support/dktools/WxdkdrawFrameTools.cpt b/support/dktools/WxdkdrawFrameTools.cpt deleted file mode 100644 index ac19aeca5b..0000000000 --- a/support/dktools/WxdkdrawFrameTools.cpt +++ /dev/null @@ -1,2440 +0,0 @@ -%% options - -copyright owner = Dirk Krause -copyright year = 2019-xxxx -SPDX-License-Identifier: BSD-3-Clause - - -%% module - -#include "wxdkdraw.h" - -#ifndef WXDKDRAWAPPH_INCLUDED -#include "WxdkdrawApp.h" -#endif -#ifndef WXDKDRAWFRAME_H_INCLUDED -#include "WxdkdrawFrame.h" -#endif - - - -$!trace-include - - -/* IMPORTANT: Number and order of entries here must match the order in the - m_iv member array and the iv_keys array below! -*/ -/** Default values for the integer array. -*/ -static const int default_values[] = { -/* IVI_BORDER_RED */ 236 , -/* IVI_BORDER_GREEN */ 236 , -/* IVI_BORDER_BLUE */ 255 , -/* IVI_BG_RED */ 242 , -/* IVI_BG_GREEN */ 242 , -/* IVI_BG_BLUE */ 242 , -/* IVI_GRID_RED */ 202 , -/* IVI_GRID_GREEN */ 202 , -/* IVI_GRID_BLUE */ 230 , -/* IVI_PH_RED */ 255 , -/* IVI_PH_GREEN */ 214 , -/* IVI_PH_BLUE */ 0 , -/* IVI_M_COPY_RED */ 0 , -/* IVI_M_COPY_GREEN */ 143 , -/* IVI_M_COPY_BLUE */ 0 , -/* IVI_M_MOVE_RED */ 0 , -/* IVI_M_MOVE_GREEN */ 0 , -/* IVI_M_MOVE_BLUE */ 204 , -/* IVI_M_DEL_RED */ 204 , -/* IVI_M_DEL_GREEN */ 0 , -/* IVI_M_DEL_BLUE */ 0 , -/* IVI_M_GROUP_RED */ 0 , -/* IVI_M_GROUP_GREEN */ 0 , -/* IVI_M_GROUP_BLUE */ 0 , -/* IVI_MISSIMG_RED */ 204 , -/* IVI_MISSIMG_GREEN */ 0 , -/* IVI_MISSIMG_BLUE */ 0 , -/* IVI_XS_SUBSEGS */ 4 , -/* IVI_FONT_EXACT */ 0 , -/* IVI_DOT_DIAMETER_FILLED */ 8 , -/* IVI_DOT_DIAMETER_WHITE */ 10 , -/* IVI_ARROWHEAD_LENGTH */ 16 , -/* IVI_ARROWHEAD_WIDTH */ 8 , -/* IVI_STYLE_VALUE */ 4 , -/* IVI_MITER_LIMIT */ 8 , -/* IVI_REDUCE_MARKUP_POINTS */ 1 , -/* IVI_D_LAYER */ 0 , -/* IVI_D_LINE_COL_RED */ 0 , -/* IVI_D_LINE_COL_GREEN */ 0 , -/* IVI_D_LINE_COL_BLUE */ 0 , -/* IVI_D_LINEWIDTH */ 2 , -/* IVI_D_LINESTYLE */ WXD_LS_SOLID , -/* IVI_D_STYLE_VALUE */ 4 , -/* IVI_D_JOIN_STYLE */ WXD_LJ_MITERED , -/* IVI_D_MITER_LIMIT */ 8 , -/* IVI_D_CAP_STYLE */ WXD_LC_BUTTED , -/* IVI_D_AHF_TYPE */ 0 , -/* IVI_D_AHF_LENGTH */ 16 , -/* IVI_D_AHF_WIDTH */ 8 , -/* IVI_D_AHB_TYPE */ 0 , -/* IVI_D_AHB_LENGTH */ 16 , -/* IVI_D_AHB_WIDTH */ 8 , -/* IVI_D_FILL_COL_RED */ 255 , -/* IVI_D_FILL_COL_GREEN */ 255 , -/* IVI_D_FILL_COL_BLUE */ 255 , -/* IVI_D_FILL_STYLE */ WXD_FS_NONE , -/* IVI_D_TEXT_LATEX */ 1 , -/* IVI_D_TEXT_ALIGN */ WXD_TEXT_ALIGN_LEFT , -/* IVI_D_TEXT_FONT */ 0 , -/* IVI_D_TEXT_SIZE */ 12 , -/* IVI_C_GRID */ 1 , -/* IVI_C_PH */ 0 , -/* IVI_C_COR_POSITION */ 1 , -}; -/* IMPORTANT: Number and order of entries here must match the order in the - m_iv member array and the iv_keys array below! -*/ - - - -/* IMPORTANT: Number and order of entries here must match the - order in the default_values and m_iv arrays! -*/ -/** Keys to save and restore the int values. -*/ -static const wxChar * const iv_keys[] = { -$!string-table macro=wxT -# -# 0 - 2 Border colour -# -colour.border.red -colour.border.green -colour.border.blue -# -# 3 - 5 Background colour -# -colour.background.red -colour.background.blue -colour.background.green -# -# 6 - 8 Grid colour -# -colour.grid.red -colour.grid.green -colour.grid.blue -# -# 9 - 11 Placement help -# -colour.placement-help.red -colour.placement-help.green -colour.placement-help.blue -# -# 12 - 14 Modification operation: Copy -# -colour.modify.copy.red -colour.modify.copy.green -colour.modify.copy.blue -# -# 15 - 17 Modification operation: Move -# -colour.modify.move.red -colour.modify.move.green -colour.modify.move.blue -# -# 18 - 20 Modification operation: Delete -# -colour.modify.delete.red -colour.modify.delete.green -colour.modify.delete.blue -# -# 21 - 23 Modification operation: Group -# -colour.modify.group.red -colour.modify.group.green -colour.modify.group.blue -# -# 24 - 26 Markup for missing image file -# -colour.markup.missing-image.red -colour.markup.missing-image.green -colour.markup.missing-image.blue -# -# 27 Bezier spline segments per X-spline sub-segment -# -config.x-spline.sub-segments -# -# 28 Flag: Use exact font for text representation -# -config.text.font.exact -# -# 29 Diameter of filled dots in multiples of the base line width -# -config.dot.filled.diameter -# -# 30 Diameter of white-filled dots in multiples of base line width -# -config.dot.white.diameter -# -# 31 - 32 Length and width of arrowheads -# -config.arrowhead.length -config.arrowhead.width -# -# 33 Dash length in multiples of the line width -# -config.line.dash.length -# -# 34 Miter limit for mitered line join -# -config.join.miter-limit -# -# 35 Flag: Reduce size of point markup for point-related operations -# -config.markup-point.reduce-size -# -# 36 Default layer -# -default.layer -# -# 37 - 39 Default line and text colour -# -default.colour.stroke.red -default.colour.stroke.green -default.colour.stroke.blue -# -# 40 Default line width -# -default.line.width -# -# 41 - 42 Default line style and style length -# -default.line.style -default.line.dash.length -# -# 43 - 44 Join style and miter limit -# -default.join.style -default.join.miter-limit -# -# 45 Line cap style -# -default.cap.style -# -# 46 - 48 Arrowhead forward -# -default.arrowhead.forward.type -default.arrowhead.forward.length -default.arrowhead.forward.width -# -# 49 - 51 Arrowhead backward -# -default.arrowhead.backward.type -default.arrowhead.backward.length -default.arrowhead.backward.width -# -# 52 - 55 Fill colour and fill style -# -default.colour.fill.red -default.colour.fill.green -default.colour.fill.blue -default.fill.style -# -# 56 - 59 Default text setup -# -default.text.latex -default.text.align -default.text.font -default.text.size -# -# 60 - 61 Configuration items for grid and placement help -# -config.grid.enable -config.placement-help.enable -# -# 62 Correct position after zooming out -# -config.zoom-out.correct-position -$!end -}; -/* IMPORTANT: Number and order of entries here must match the - order in the default_values and m_iv arrays! -*/ - - - -/** Correct given int value v to a range specified by minimum and maximum. - @param min Range minimum. - @param max Range maximum. - @param v Value to correct if necessary. - @return Corrected value. -*/ -static -int -i_to_range(int min, int max, int v) -{ - if (min > v) { v = min; } - if (max < v) { v = max; } - return v; -} - - - -/** Correct given int value v to an unsigned range specified by minimum - and maximum. - @param min Range minimum. - @param max Range maximum. - @param v Value to correct if necessary. - @return Corrected value. -*/ -static -unsigned -u_to_range(unsigned min, unsigned max, int v) -{ - unsigned back; - - if (0 <= v) { - back = (unsigned)v; - } - else { - back = 0U; - } - if (min > back) { back = min; } - if (max < back) { back = max; } - return back; -} - - - -void -WxdkdrawFrame::DefaultStyleToArray(void) -{ - $? "+ DefaultStyleToArray" - m_iv[IVI_D_LAYER] = m_oStyle.lay; - m_iv[IVI_D_LINE_COL_RED] = m_oStyle.sc[0] ; - m_iv[IVI_D_LINE_COL_GREEN] = m_oStyle.sc[1] ; - m_iv[IVI_D_LINE_COL_BLUE] = m_oStyle.sc[2] ; - m_iv[IVI_D_LINEWIDTH] = m_oStyle.lw ; - m_iv[IVI_D_LINESTYLE] = m_oStyle.ls ; - m_iv[IVI_D_STYLE_VALUE] = m_oStyle.sl ; - m_iv[IVI_D_JOIN_STYLE] = m_oStyle.js ; - m_iv[IVI_D_MITER_LIMIT] = m_oStyle.ml ; - m_iv[IVI_D_CAP_STYLE] = m_oStyle.cs ; - m_iv[IVI_D_AHF_TYPE] = m_oStyle.aft ; - m_iv[IVI_D_AHF_LENGTH] = m_oStyle.afl ; - m_iv[IVI_D_AHF_WIDTH] = m_oStyle.afw ; - m_iv[IVI_D_AHB_TYPE] = m_oStyle.abt ; - m_iv[IVI_D_AHB_LENGTH] = m_oStyle.abl ; - m_iv[IVI_D_AHB_WIDTH] = m_oStyle.abw ; - m_iv[IVI_D_FILL_COL_RED] = m_oStyle.fc[0] ; - m_iv[IVI_D_FILL_COL_GREEN] = m_oStyle.fc[1] ; - m_iv[IVI_D_FILL_COL_BLUE] = m_oStyle.fc[2] ; - m_iv[IVI_D_FILL_STYLE] = m_oStyle.fs ; - m_iv[IVI_D_TEXT_LATEX] = m_oStyle.det.t.fl ; - m_iv[IVI_D_TEXT_ALIGN] = m_oStyle.det.t.al ; - m_iv[IVI_D_TEXT_FONT] = m_oStyle.det.t.find ; - m_iv[IVI_D_TEXT_SIZE] = m_oStyle.det.t.fsz ; - $? "- DefaultStyleToArray" -} - - - -void -WxdkdrawFrame::DefaultStyleFromArray(void) -{ - $? "+ DefaultStyleFromArray" - m_oStyle.lay = (int16_t)i_to_range( - DK4_I16_MIN, DK4_I16_MAX, m_iv[IVI_D_LAYER] - ); - m_oStyle.sc[0] = (uint8_t)u_to_range( - 0U, 255U, m_iv[IVI_D_LINE_COL_RED] - ); - m_oStyle.sc[1] = (uint8_t)u_to_range( - 0U, 255U, m_iv[IVI_D_LINE_COL_GREEN] - ); - m_oStyle.sc[2] = (uint8_t)u_to_range( - 0U, 255U, m_iv[IVI_D_LINE_COL_BLUE] - ); - m_oStyle.lw = (uint16_t)u_to_range( - 0U, DK4_U16_MAX, m_iv[IVI_D_LINEWIDTH] - ); - m_oStyle.ls = (uint8_t)u_to_range( - WXD_LS_SOLID, WXD_LS_DASH_DOT_DOT_DOT, m_iv[IVI_D_LINESTYLE] - ); - m_oStyle.sl = (uint8_t)u_to_range( - 1U, 255U, m_iv[IVI_D_STYLE_VALUE] - ); - m_oStyle.js = (uint8_t)u_to_range( - WXD_LJ_MITERED, WXD_LJ_BEVELED, m_iv[IVI_D_JOIN_STYLE] - ); - m_oStyle.ml = (uint8_t)u_to_range( - 1U, 255U, m_iv[IVI_D_MITER_LIMIT] - ); - m_oStyle.cs = (uint8_t)u_to_range( - WXD_LC_BUTTED, WXD_LC_PROJECTING, m_iv[IVI_D_CAP_STYLE] - ); - m_oStyle.aft = (uint8_t)u_to_range( - 0U, 29U, m_iv[IVI_D_AHF_TYPE] - ); - m_oStyle.afl = (uint8_t)u_to_range( - 2U, 255U, m_iv[IVI_D_AHF_LENGTH] - ); - m_oStyle.afw = (uint8_t)u_to_range( - 2U, 255U, m_iv[IVI_D_AHF_WIDTH] - ); - m_oStyle.abt = (uint8_t)u_to_range( - 0U, 29U, m_iv[IVI_D_AHB_TYPE] - ); - m_oStyle.abl = (uint8_t)u_to_range( - 2U, 255U, m_iv[IVI_D_AHB_LENGTH] - ); - m_oStyle.abw = (uint8_t)u_to_range( - 2U, 255U, m_iv[IVI_D_AHB_WIDTH] - ); - m_oStyle.fc[0] = (uint8_t)u_to_range( - 0U, 255U, m_iv[IVI_D_FILL_COL_RED] - ); - m_oStyle.fc[1] = (uint8_t)u_to_range( - 0U, 255U, m_iv[IVI_D_FILL_COL_GREEN] - ); - m_oStyle.fc[2] = (uint8_t)u_to_range( - 0U, 255U, m_iv[IVI_D_FILL_COL_BLUE] - ); - m_oStyle.fs = (uint8_t)u_to_range( - WXD_FS_NONE, WXD_FS_VERTICAL_TIRES, m_iv[IVI_D_FILL_STYLE] - ); - m_oStyle.det.t.fl = (uint8_t)u_to_range( - 0U, 1U, m_iv[IVI_D_TEXT_LATEX] - ); - m_oStyle.det.t.al = (uint8_t)u_to_range( - WXD_TA_LEFT, WXD_TA_RIGHT, m_iv[IVI_D_TEXT_ALIGN] - ); - m_oStyle.det.t.find = (uint8_t)u_to_range( - 0U, 34U, m_iv[IVI_D_TEXT_FONT] - ); - m_oStyle.det.t.fsz = (uint16_t)u_to_range( - 1U, DK4_U16_MAX, m_iv[IVI_D_TEXT_SIZE] - ); - $? "- DefaultStyleFromArray" -} - - - -void -WxdkdrawFrame::LoadDefaults(void) -{ - DK4_MEMCPY(m_iv,default_values,((size_t)(IVI_MAX)*sizeof(int))); -} - - - -void -WxdkdrawFrame::LoadConfiguration(void) -{ - LoadDefaults(); - DefaultStyleToArray(); - pAppHelp->GetMultiple(iv_keys ,m_iv, IVI_MAX); - DefaultStyleFromArray(); - cbGridOnOff->SetValue((0 != m_iv[IVI_C_GRID])); - cbPH->SetValue((0 != m_iv[IVI_C_PH])); -} - - - -void -WxdkdrawFrame::SaveConfiguration(void) -{ - DefaultStyleToArray(); - m_iv[IVI_C_GRID] = ((cbGridOnOff->GetValue()) ? 1 : 0); - m_iv[IVI_C_PH] = ((cbPH->GetValue()) ? 1 : 0); - pAppHelp->SetMultiple(iv_keys ,m_iv, IVI_MAX); -} - - - -void -WxdkdrawFrame::ResetConfiguration(void) -{ - LoadDefaults(); - wxdobj_obj_init(&m_oStyle, WXD_OT_TEXT, NULL); -} - - - -void -WxdkdrawFrame::ColorModify(size_t ivi, int rdl) -{ - wxColour curcol(m_iv[ivi], m_iv[ivi + 1], m_iv[ivi + 2]); - wxColourData wxcd; - $? "+ ColorModify" - wxcd.SetColour(curcol); - wxColourDialog dlg(this, &wxcd); - - if (wxID_OK == dlg.ShowModal()) { - wxColour col = dlg.GetColourData().GetColour(); - m_iv[ivi ] = col.Red(); - m_iv[ivi + 1] = col.Green(); - m_iv[ivi + 2] = col.Blue(); - wxdobj_drw_require_redraw(m_pDrw, rdl); - } - $? "- ColorModify" -} - - - -void -WxdkdrawFrame::ColorReset(size_t ivi, int rdl) -{ - $? "+ ColorReset" - DK4_MEMCPY(&(m_iv[ivi]),&(default_values[ivi]),(3*sizeof(int))); - wxdobj_drw_require_redraw(m_pDrw, rdl); - $? "- ColorReset" -} - - - -bool -WxdkdrawFrame::FindDirectoryForFile(wxChar *dnb, size_t dnsz, wxString & fn) -{ - wxChar const *fnstr = NULL; - wxChar const *cwdstr = NULL; - wxChar *ptr = NULL; - size_t lgt = (size_t)0U; - bool back = false; - $? "+ FindDirectoryForFile" - if ((NULL != dnb) && ((size_t)0U < dnsz)) { - dnb[0] = wxT('\0'); - wxCStrData strd = fn.c_str(); - fnstr = (wxChar const *)strd; - if (NULL != fnstr) { - lgt = dk4strx_len(fnstr); - if ((size_t)0U < lgt) { - if (lgt < dnsz) { - dk4strx_cpy_s(dnb, dnsz, fnstr, NULL); -#if DK4_HAVE_BACKSLASH_AS_SEP - ptr = dk4strx_rchr(dnb, wxT('\\')); -#else - ptr = dk4strx_rchr(dnb, wxT('/')); -#endif - if (NULL != ptr) { - *ptr = wxT('\0'); - back = true; - $? ". \"%!ws\"", dnb - } - else { $? ". no sep found" - wxString cwd = ::wxGetCwd(); - { - wxCStrData strwcd = cwd.c_str(); - { - cwdstr = (wxChar const *)strwcd; - if (NULL != cwdstr) { - lgt = dk4strx_len(cwdstr); - if ((size_t)0U < lgt) { - if (lgt < dnsz) { - dk4strx_cpy_s(dnb,dnsz,cwdstr,NULL); - back = true; - $? ". \"%!ws\"", cwdstr - } - else { $? "! string too long" - /* ERROR: CWD too long */ - dk4error_set_simple_error_code( - &m_oErrorReport, - WXD_E_CWD_TOO_LONG - ); - } - } - else { $? "! empty string" - /* ERROR: No current dir */ - dk4error_set_simple_error_code( - &m_oErrorReport, - WXD_E_NO_CWD - ); - } - } - else { $? "! no string" - /* ERROR: No current dir */ - dk4error_set_simple_error_code( - &m_oErrorReport, WXD_E_NO_CWD - ); - } - } - } - } - } - else { $? "! string too long" - /* ERROR: Output file name too long */ - dk4error_set_simple_error_code( - &m_oErrorReport, WXD_E_OUTPUT_FN_TOO_LONG - ); - } - } - else { $? "! empty string" - /* ERROR: Failed to find directory for file */ - dk4error_set_simple_error_code( - &m_oErrorReport, WXD_E_OUTPUT_DIRNAME - ); - } - } - else { $? "! no string" - /* ERROR: Failed to find directory for file */ - dk4error_set_simple_error_code( - &m_oErrorReport, WXD_E_OUTPUT_DIRNAME - ); - } - } - else { $? "! illegal arguments" - } $? "- FindDirectoryForFile %d", (back ? 1 : 0) - return back; -} - - - -bool -WxdkdrawFrame::SaveToFile(void) -{ - wxChar fnbuf[DK4_MAX_PATH]; /* File name current dir */ - wxdwr_status_t wrst; /* Writer status */ - wxString sNewTitle = wxEmptyString; /* New program window title */ - wxString sDlgTitle(sTexts[171]); /* Dialog title */ - wxString sDlgTypes(sTexts[172]); /* File type suffixes */ - FILE *fipo; /* File for output */ - int res; /* Save operation result */ - bool cc = true; /* Flag: Can continue */ - bool back = false; - $? "+ SaveToFile" - if (!(m_bHaveName)) { -#if wxCHECK_VERSION(2, 9, 0) - wxFileDialog dlg( - this, sDlgTitle, m_sFileDir, m_sFileShort, - sDlgTypes, (wxFD_SAVE | wxFD_OVERWRITE_PROMPT) - ); -#else - wxFileDialog dlg( - this, sDlgTitle, m_sFileDir, m_sFileShort, - sDlgTypes, wxSAVE - ); -#endif - if(wxID_OK == dlg.ShowModal()) { - m_sFileFull = dlg.GetPath(); - m_sFileDir = dlg.GetDirectory(); - m_sFileShort = dlg.GetFilename(); - m_bHaveName = true; - if (m_bModified) { - sNewTitle.Append(sTexts[170]); - sNewTitle.Append(m_sFileShort); - SetTitle(sNewTitle); - } - else { - SetTitle(m_sFileShort); - } - m_bUpdate = true; - } - else { - cc = false; - } - } - if (m_bHaveName && cc) { - cc = FindDirectoryForFile(fnbuf, DK4_SIZEOF(fnbuf,wxChar), m_sFileFull); - if (!(cc)) { - /* ##### ERROR: Failed to find directory */ - } - } - if (m_bHaveName && cc) { $? ". can save" - wxFFile wxff(m_sFileFull, wxT("w")); - if (wxff.IsOpened()) { $? ". file is opened" - fipo = wxff.Detach(); - if (NULL != fipo) { $? ". file is opened" - back = true; - wxdwr_status_init(&wrst, pAppHelp->GetWxEncoding()); - wrst.dirn = fnbuf; - res = wxdwr_write_file(fipo, m_pDrw, &wrst); - wrst.dirn = NULL; - if (0 == res) { $? "! failed" - back = false; - switch (wrst.ec) { - case WXDWR_E_WRITE : { $? "! write op" - /* ERROR: Write operation failed */ - wxMessageBox( - sTexts[204], sTexts[202], - (wxOK | wxCENTRE | wxICON_ERROR) - ); - } break; - case WXDWR_E_STRING_TOO_LONG : { $? "! str too long" - /* ERROR: String too long */ - if (NULL != wrst.str) { - wxString msg = wxString(sTexts[205]); - msg.Append(wxString(wrst.str)); - msg.Append(wxString(sTexts[206])); - wxMessageBox( - msg, sTexts[202], - (wxOK | wxCENTRE | wxICON_ERROR) - ); - } - else { - wxMessageBox( - sTexts[207], sTexts[202], - (wxOK | wxCENTRE | wxICON_ERROR) - ); - } - } break; - case WXDWR_E_RECODE_TEXT : { $? "! recode string" - /* ERROR: Failed to recode text */ - if (NULL != wrst.str) { - wxString msg = wxString(sTexts[208]); - msg.Append(wxString(wrst.str)); - msg.Append(wxString(sTexts[209])); - wxMessageBox( - msg, sTexts[202], - (wxOK | wxCENTRE | wxICON_ERROR) - ); - } - else { - wxMessageBox( - sTexts[210], sTexts[202], - (wxOK | wxCENTRE | wxICON_ERROR) - ); - } - - } break; - case WXDWR_E_RECODE_FILENAME : { $? "! recode fname" - /* ERROR: Failed to recode file name */ - if (NULL != wrst.str) { - wxString msg = wxString(sTexts[211]); - msg.Append(wxString(wrst.str)); - msg.Append(wxString(sTexts[212])); - wxMessageBox( - msg, sTexts[202], - (wxOK | wxCENTRE | wxICON_ERROR) - ); - } - else { - wxMessageBox( - sTexts[213], sTexts[202], - (wxOK | wxCENTRE | wxICON_ERROR) - ); - } - } break; - case WXDWR_E_STRING_EMPTY : { $? "! empty string" - /* ERROR: Empty string not expected */ - wxMessageBox( - sTexts[214], sTexts[202], - (wxOK | wxCENTRE | wxICON_ERROR) - ); - } break; - default : { $? "! any other" - /* ERROR: Unknown reason */ - wxMessageBox( - sTexts[215], sTexts[202], - (wxOK | wxCENTRE | wxICON_ERROR) - ); - } break; - } - } -#if TRACE_DEBUG - else { $? ". successfully written" - } -#endif - if (0 != fclose(fipo)) { $? "! fclose" - if (back) { - /* ERROR: Failed to write to file */ - wxMessageBox( - sTexts[204], sTexts[202], - (wxOK | wxCENTRE | wxICON_ERROR) - ); - } - back = false; - } -#if TRACE_DEBUG - else { $? ". successfully closed" - } -#endif - } - else { $? "! NULL returned" - /* ERROR: Failed to open file */ - wxMessageBox( - sTexts[203], sTexts[202], (wxOK | wxCENTRE | wxICON_ERROR) - ); - } - } - else { $? "! file not opened" - /* ERROR: Failed to open file */ - wxMessageBox( - sTexts[203], sTexts[202], (wxOK | wxCENTRE | wxICON_ERROR) - ); - } - if (back) { - SetTitle(m_sFileShort); - SetModified(false); - } - } -#if TRACE_DEBUG - else { $? "! no file name" - } -#endif - $? "- SaveToFile %d", ((back) ? 1 : 0) - return back; -} - - - -void -WxdkdrawFrame::SetModified(bool f) -{ -$? "+ SetModified" -if (f != m_bModified) { - if (f) { - wxString s = wxEmptyString; - s.Append(sTexts[170]); - if (m_bHaveName) { - s.Append(m_sFileShort); - } - else { - s.Append(sTexts[18]); - } - SetTitle(s); - } - else { - if (m_bHaveName) { - SetTitle(m_sFileShort); - } - else { - SetTitle(sTexts[18]); - } - } - m_bModified = f; - m_bUpdate = true; -} -$? "- SetModified" -} - - - - -wxSize -WxdkdrawFrame::ColourViewSize(void) -{ -int sl = 20; -if (NULL != bFileOpen) { - sl = (bFileOpen->GetClientSize()).GetHeight(); -} -$? "= ColourViewSize %d %d", sl, sl -return(wxSize(sl,sl)); -} - - - -Wxd_drawing_t * -WxdkdrawFrame::ReadDrawingFromFile(wxString & fn) -{ - wxChar dirnb[DK4_MAX_PATH]; - Wxd_drawing_t *back = NULL; /* Function result */ - FILE *fp = NULL; /* File to read from */ - bool haved = false; /* Have directory name */ - $? "+ ReadDrawingFromFile" - wxFFile wxff(fn); - haved = FindDirectoryForFile(dirnb, DK4_SIZEOF(dirnb,wxChar), fn); - if (wxff.IsOpened()) { - fp = wxff.Detach(); - if (NULL != fp) { - $? ". initialize m_oStatusReader" - wxdrd_status_init(&m_oStatusReader); - if (haved) { - m_oStatusReader.dirn = dirnb; - } - else { - m_oStatusReader.dirn = NULL; - } - back = wxdrd_read_file(fp, &m_oStatusReader); - m_oStatusReader.dirn = NULL; - fclose(fp); - if (NULL != back) { - wxdobj_drw_set_xsubs(back, (size_t)(m_iv[IVI_XS_SUBSEGS])); - wxdobj_bb_for_drawing(back); - } - else { - /* ERROR: Failed to read file */ - dk4error_set_simple_error_code( - &m_oErrorReport, WXD_E_FAILED_TO_READ_FILE - ); - } - } - else { $? "! open" - /* ERROR: Failed to open file */ - dk4error_set_simple_error_code( - &m_oErrorReport, WXD_E_FAILED_TO_OPEN_FILE - ); - } - } - else { $? "! open" - /* ERROR: Failed to open file */ - dk4error_set_simple_error_code( - &m_oErrorReport, WXD_E_FAILED_TO_OPEN_FILE - ); - } - $? "- ReadDrawingFromFile %d", TR_IPTR(back) - return back; -} - - - -void -WxdkdrawFrame::UpdateImages(void) -{ - Wxd_object_t *pobj; - dk4sto_it_reset(m_pDrw->i_flat); - do { - pobj = (Wxd_object_t *)dk4sto_it_next(m_pDrw->i_flat); - if (NULL != pobj) { - if (WXD_OT_IMAGE == pobj->ot) { - if (NULL != (pobj->det).i.fn) { - if (NULL == (pobj->det).i.bm) { - wxdobj_load_image( - pobj, - pAppHelp->GetDkEncoding(), - pAppHelp->GetWxEncoding() - ); - } - } - } - } - } while (NULL != pobj); -} - - - -void -WxdkdrawFrame::DrawingLoaded(void) -{ - /* No operation started on new drawing yet - */ - m_iState = S_NOOP; - m_iWheelControl = 0; - m_iWheelShift = 0; - m_iWheelNormal = 0; - m_pStyle = NULL; - m_pCurrent = NULL; - /* Zoom factor and grid distances - */ - drawco->CalculateZoomFactor(); - { - wxString s; - s.Printf("%g", drawco->m_dZoom); - lZoomPercent->SetLabel(s); - lZoomPercent->Refresh(); - m_bUpdate = true; - } - /* Update coefficients for fill patterns - */ - UpdateStipples(); - UpdateFonts(); - szTopBar->Layout(); - lZoomPercent->Refresh(); - UpdateImages(); - /* Coordinates conversion coefficients - */ - drawco->CalculateConversionCoefficients(); - - /* Grid setup to GUI - */ - if (NULL != m_pDrw) { - if ((uint8_t)0U != m_pDrw->gridunit) { - cbGridUnit->SetSelection(1); - } - else { - cbGridUnit->SetSelection(0); - } - if ((uint8_t)0U != m_pDrw->gridbase) { - cbGridBase->SetSelection(1); - } - else { - cbGridBase->SetSelection(0); - } - cbGridUnit->Refresh(); - cbGridBase->Refresh(); - m_bUpdate = true; - } - - /* Calculate grid - */ - drawco->CalculateGridDistances(); - - /* Required width and height - */ - - /* Scrollbar positions - */ - AdjustScrollbars(); - - /* GUI attributes object - */ - m_pStyle = NULL; - m_pCurrent = NULL; - m_iState = S_NOOP; - m_iWheelControl = 0; - m_iWheelShift = 0; - m_iWheelNormal = 0; - m_uCurrent = 0; - m_iObjToCreate = -1; - m_bSplineInterpolated = false; - m_bModified = false; - m_bMouseDiff = false; $? ". m_bMouseDiff = false" - - drawco->Refresh(); - m_bUpdate = true; -} - - - -void -WxdkdrawFrame::ModificationReportingAtEventEnd(void) -{ - if (DK4_E_NONE == m_oErrorReport.ec) { - if (0 != m_oStatusReader.mod) { - SetModified(); - wxMessageBox( - sTexts[600], sTexts[599], - (wxOK | wxCENTRE | wxICON_INFORMATION) - ); - } - } -} - - - -void -WxdkdrawFrame::OnFirstIdle(void) -{ - Wxd_drawing_t *pDrw; - $? "+ OnFirstIdle" - $? ". initialize m_oStatusReader" - wxdrd_status_init(&m_oStatusReader); - dk4error_init(&m_oErrorReport); - m_pDrw = wxdobj_drw_new(); - if (m_bHaveName) { - wxFileName wxfn(m_sFileFull); - SetTitle(m_sFileShort); - if (wxfn.IsFileReadable()) { - pDrw = ReadDrawingFromFile(m_sFileFull); - if (NULL != pDrw) { - wxdobj_drw_delete(m_pDrw); - m_pDrw = pDrw; - m_bHaveName = true; - m_bUpdate = true; - } - else { $? "! failed to read file" - /* ERROR: Failed to read file, already reported */ - } - } - else { $? "! not a readable file" - dk4error_set_simple_error_code( - &m_oErrorReport, WXD_E_FAILED_TO_OPEN_FILE - ); - } - } -#if TRACE_DEBUG - else { $? ". no file name specified" - } -#endif - /* If drawing was read, set frame as active (ready for events). - Otherwise show error message and exit application. - */ - if (NULL != m_pDrw) { - m_bActive = true; - DrawingLoaded(); - szTopBar->Layout(); - SetStatusText(sTexts[531]); - Refresh(); - Update(); - } - else { - Close(); - } - ModificationReportingAtEventEnd(); - ErrorReportingAtEventEnd(); - dk4error_init(&m_oErrorReport); - $? ". initialize m_oStatusReader" - wxdrd_status_init(&m_oStatusReader); - $? "- OnFirstIdle" -} - - - -static -int32_t i32_avg(int32_t a, int32_t b, dk4_er_t *erp) -{ - dk4_er_t er; - int32_t back = (int32_t)0L; - - dk4error_init(&er); - back = dk4ma_int32_t_add(a, b, &er) / ((int32_t)2L); - if (DK4_E_NONE != er.ec) { - dk4error_init(&er); - back = dk4ma_int32_t_add( - a, - (dk4ma_int32_t_sub(b, a, &er) / ((int32_t)2L)), - &er - ); - if (DK4_E_NONE != er.ec) { - dk4error_copy(erp, &er); - } - } - return back; -} - - - -void -WxdkdrawFrame::CorrectCenterPointIfNecessary(void) -{ - dk4_er_t er; - int32_t xcmin; /* Minimum value for center x position */ - int32_t xcmax; /* Maximum value for center x position */ - int32_t ycmin; /* Minimum value for center y position */ - int32_t ycmax; /* Maximum value for center y position */ - int32_t deltax; /* X difference border to center */ - int32_t deltay; /* Y difference border to center */ - $? "+ CorrectCenterPointIfNecessary" - dk4error_init(&er); - deltax = dk4ma_int32_from_double( - ( - (16256000.0 * (double)((drawco->m_szDrawco).GetWidth())) - / (2.0 * drawco->m_dZoom * (drawco->m_ptRes).x) - ), &er - ); - deltay = dk4ma_int32_from_double( - ( - (16256000.0 * (double)((drawco->m_szDrawco).GetHeight())) - / (2.0 * drawco->m_dZoom * (drawco->m_ptRes).y) - ), &er - ); - xcmin = dk4ma_int32_t_add( - dk4ma_int32_t_sub( - (m_pDrw->bb).xl, - dk4ma_int32_from_double((double)(m_pDrw->bleft), &er), - &er - ), deltax, &er - ); - xcmax = dk4ma_int32_t_sub( - dk4ma_int32_t_add( - (m_pDrw->bb).xr, - dk4ma_int32_from_double((double)(m_pDrw->bright), &er), - &er - ), deltax, &er - ); - ycmin = dk4ma_int32_t_add( - dk4ma_int32_t_sub( - (m_pDrw->bb).yb, - dk4ma_int32_from_double((double)(m_pDrw->bbottom), &er), - &er - ), deltay, &er - ); - ycmax = dk4ma_int32_t_sub( - dk4ma_int32_t_add( - (m_pDrw->bb).yt, - dk4ma_int32_from_double((double)(m_pDrw->btop), &er), - &er - ), deltay, &er - ); - if (DK4_E_NONE == er.ec) { - /* - X correction - */ - if (xcmax > xcmin) { - if (m_pDrw->cx < xcmin) { - m_pDrw->cx = xcmin; - } - else { - if (m_pDrw->cx > xcmax) { - m_pDrw->cx = xcmax; - } - } - } - else { - if (xcmax == xcmin) { - m_pDrw->cx = xcmin; - } - else { - xcmin = i32_avg((m_pDrw->bb).xl, (m_pDrw->bb).xr, &er); - if (DK4_E_NONE == er.ec) { - m_pDrw->cx = xcmin; - } - } - } - /* - Y correction - */ - if (ycmax > ycmin) { - if (m_pDrw->cy < ycmin) { - m_pDrw->cy = ycmin; - } - else { - if (m_pDrw->cy > ycmax) { - m_pDrw->cy = ycmax; - } - } - } - else { - if (ycmax == ycmin) { - m_pDrw->cy = ycmin; - } - else { - dk4error_init(&er); - ycmin = i32_avg((m_pDrw->bb).yb, (m_pDrw->bb).yt, &er); - if (DK4_E_NONE == er.ec) { - m_pDrw->cy = ycmin; - } - } - } - } - else { $? "! math error" - } - $? "- CorrectCenterPointIfNecessary" -} - - - -void -WxdkdrawFrame::ZoomChanged(bool bZoomOut) -{ - drawco->CalculateZoomFactor(); - { - wxString s; - s.Printf("%g", drawco->m_dZoom); - lZoomPercent->SetLabel(s); - } - UpdateStipples(); - UpdateFonts(); - szTopBar->Layout(); - lZoomPercent->Refresh(); - if (bZoomOut && (0 != m_iv[IVI_C_COR_POSITION])) { - CorrectCenterPointIfNecessary(); - } - drawco->CalculateConversionCoefficients(); - AdjustScrollbars(); - wxdobj_drw_require_redraw(m_pDrw, WXD_REFRESH_GRID); - drawco->Refresh(); - m_bUpdate = true; -} - - - -void -WxdkdrawFrame::AdjustScrollbars(void) -{ - dk4_er_t er; /* Error report */ - int xPos; /* Horizontal scrolblar position */ - int yPos; /* Vertical scrollbar position */ - int xThumb; /* Thumb size width (control width) */ - int yThumb; /* Thumb size height (control height) */ - int xRange; /* Range (required pixels) */ - int yRange; /* Range (required pixels) */ - int xPageSize; /* Pixels to scroll for page */ - int yPageSize; /* Pixels to scroll for page */ - bool bEnableX = false; /* Enable horizontal scrollbar */ - bool bEnableY = false; /* Enable vertical scrollbar */ - $? "+ AdjustScrollbars" - dk4error_init(&er); - xThumb = (drawco->m_szDrawco).GetWidth(); - yThumb = (drawco->m_szDrawco).GetHeight(); - xRange = dk4ma_int_from_double( - ceil( - ( - ( - (double)((m_pDrw->bb).xr) - (double)((m_pDrw->bb).xl) - + (double)(m_pDrw->bleft) + (double)(m_pDrw->bright) - ) * (drawco->m_ptRes).x * drawco->m_dZoom - ) / RESWXD - ), &er - ); - yRange = dk4ma_int_from_double( - ceil( - ( - ( - (double)((m_pDrw->bb).yt) - (double)((m_pDrw->bb).yb) - + (double)(m_pDrw->bbottom) + (double)(m_pDrw->btop) - ) * (drawco->m_ptRes).y * drawco->m_dZoom - ) / RESWXD - ), &er - ); - xPageSize = dk4ma_int_mul(xThumb, 4, &er) / 5; - yPageSize = dk4ma_int_mul(yThumb, 4, &er) / 5; - xPos = dk4ma_int_from_double( - dk4ma_rint( - ( - ( - ( - (double)(m_pDrw->cx) - (double)((m_pDrw->bb).xl) - + (double)(m_pDrw->bleft) - ) * (drawco->m_ptRes).x * drawco->m_dZoom - ) / RESWXD - ) - ((double)xThumb / 2.0) - ), &er - ); - yPos = dk4ma_int_from_double( - dk4ma_rint( - ( - ( - ( - (double)((m_pDrw->bb).yt) - (double)(m_pDrw->cy) - + (double)(m_pDrw->btop) - ) * (drawco->m_ptRes).y * drawco->m_dZoom - ) / RESWXD - ) - ((double)yThumb / 2.0) - ), &er - ); - if (0 > xPos) { xPos = 0; } - if (0 > yPos) { yPos = 0; } - if ((xRange - xThumb) < xPos) { xPos = xRange - xThumb; } - if ((yRange - yThumb) < yPos) { yPos = yRange - yThumb; } - if (DK4_E_NONE == er.ec) { - if (xRange > xThumb) { - bEnableX = true; - } - if (yRange > yThumb) { - bEnableY = true; - } - } - /* Set up horizontal scrollbar - */ - if (bEnableX) { - if (!(sbHori->IsEnabled())) { - sbHori->Enable(); - } - $? ". xPos = %d", xPos - $? ". xThumb = %d", xThumb - $? ". xRange = %d", xRange - $? ". xPageSize = %d", xPageSize - sbHori->SetScrollbar(xPos, xThumb, xRange, xPageSize, true); - sbHori->SetThumbPosition(xPos); - sbHori->Refresh(); - } - else { - if (sbHori->IsEnabled()) { - sbHori->Enable(false); - sbHori->Refresh(); - } - } - /* Set up vertical scrollbar - */ - if (bEnableY) { - if (!(sbVert->IsEnabled())) { - sbVert->Enable(); - } - $? ". yPos = %d", yPos - $? ". yThumb = %d", yThumb - $? ". yRange = %d", yRange - $? ". yPageSize = %d", yPageSize - sbVert->SetScrollbar(yPos, yThumb, yRange, yPageSize, true); - sbVert->SetThumbPosition(yPos); - sbVert->Refresh(); - } - else { - if (sbVert->IsEnabled()) { - sbVert->Enable(false); - sbVert->Refresh(); - } - } $? "- AdjustScrollbars" -} - - - -void -WxdkdrawFrame::StartEventHandling(void) -{ - dk4error_init(&m_oErrorReport); - m_bUpdate = false; -} - - - -void -WxdkdrawFrame::MoveScrollbar(wxScrollBar *sb, int lines, bool vert) -{ - int range; /* Scrollbar range (maximum) */ -#if 0 - int ps; /* Page size */ -#endif - int pos; /* Position */ - int ts; /* Thumb size */ - $? "+ MoveScrollbar" - range = sb->GetRange(); -#if 0 - ps = sb->GetPageSize(); -#endif - pos = sb->GetThumbPosition(); - ts = sb->GetThumbSize(); - - if (range > ts) { - pos -= (lines * ts) / 10; - if (0 > pos) { pos = 0; } - if ((range - ts) <= pos) { pos = range - ts - 1; } - sb->SetThumbPosition(pos); - if (vert) { - UseScrollV(); - } - else { - UseScrollH(); - } - sb->Refresh(); - sb->Update(); - } - $? "- MoveScrollbar" -} - - - -void -WxdkdrawFrame::ControlMouseWheel(wxMouseEvent & event) -{ - int modifiers; /* Modifier keys */ - int rotation; /* Rotation of wheel */ - int delta; /* Required rotation for line */ - int lines; /* Number of lines */ - int8_t ozl; - $? "+ ControlMouseWheel" - StartEventHandling(); - if (UpdateMousePosition(event)) { - wxdobj_drw_require_redraw(m_pDrw, WXD_REFRESH_MARKUP); - } - modifiers = event.GetModifiers(); - rotation = event.GetWheelRotation(); - delta = event.GetWheelDelta(); - switch (modifiers) { - case wxMOD_CONTROL : { - m_iWheelControl += rotation; - lines = m_iWheelControl / delta; - m_iWheelControl -= (lines * delta); - ozl = m_pDrw->zl; - if (0 < lines) { - while (0 < lines--) { - if ((int8_t)(-14) < m_pDrw->zl) { - m_pDrw->zl -= (int8_t)1; - } - } - } - else { - if (0 > lines) { - while (0 > lines++) { - if ((int8_t)14 > m_pDrw->zl) { - m_pDrw->zl += (int8_t)1; - } - } - } - } - if (ozl != m_pDrw->zl) { - ZoomChanged((ozl > m_pDrw->zl)); - UpdateGridPosition(); - } - } break; - case wxMOD_SHIFT : { - m_iWheelShift += rotation; - lines = m_iWheelShift /delta; - m_iWheelShift -= (lines * delta); - if (sbHori->IsEnabled()) { - MoveScrollbar(sbHori, lines, false); - drawco->CalculateConversionCoefficients(); - UpdateGridPosition(); - wxdobj_drw_require_redraw(m_pDrw, WXD_REFRESH_GRID); - } - } break; - case wxMOD_NONE : { - m_iWheelNormal += rotation; - lines = m_iWheelNormal / delta; - m_iWheelNormal -= (lines * delta); - if (sbVert->IsEnabled()) { - MoveScrollbar(sbVert, lines, true); - drawco->CalculateConversionCoefficients(); - UpdateGridPosition(); - wxdobj_drw_require_redraw(m_pDrw, WXD_REFRESH_GRID); - } - } break; - } - $? "- ControlMouseWheel" - EndEventHandling(); -} - - - -void -WxdkdrawFrame::UseScrollH(void) -{ - dk4_er_t er; /* Error report */ - int32_t cx; /* Center x */ - int tp; /* Thumb position */ - int ts; /* Thumb size */ -#if 0 - int r; - int p; -#endif - $? "+ UseScrollH" -#if 0 - r = sbHori->GetRange(); - p = sbHori->GetPageSize(); -#endif - tp = sbHori->GetThumbPosition(); - ts = sbHori->GetThumbSize(); - dk4error_init(&er); - cx = dk4ma_int32_from_double( - dk4ma_rint( - ( - ((double)tp + (double)ts / 2.0) * RESWXD - ) / ((drawco->m_ptRes).x * drawco->m_dZoom) - ), &er - ); - cx = dk4ma_int32_t_add(cx, (m_pDrw->bb).xl, &er); - cx = dk4ma_int32_t_sub(cx, m_pDrw->bleft, &er); - if (DK4_E_NONE == er.ec) { - m_pDrw->cx = cx; - wxdobj_drw_require_redraw(m_pDrw, WXD_REFRESH_GRID); - drawco->Refresh(); - m_bUpdate = true; - } - $? "- UseScrollH" -} - - - -void -WxdkdrawFrame::UseScrollV(void) -{ - dk4_er_t er; /* Error report */ - int32_t cy; /* Center y */ - int tp; /* Thumb position */ - int ts; /* Thumb size */ -#if 0 - int r; - int p; -#endif - $? "+ UseScrollV" -#if 0 - r = sbVert->GetRange(); - p = sbVert->GetPageSize(); -#endif - tp = sbVert->GetThumbPosition(); - ts = sbVert->GetThumbSize(); - dk4error_init(&er); - cy = dk4ma_int32_from_double( - dk4ma_rint( - ( - ((double)tp + (double)ts / 2.0) * RESWXD - ) / ((drawco->m_ptRes).x * drawco->m_dZoom) - ), &er - ); - cy = dk4ma_int32_t_sub((m_pDrw->bb).yt, cy, &er); - cy = dk4ma_int32_t_add(cy, m_pDrw->btop, &er); - if (DK4_E_NONE == er.ec) { - m_pDrw->cy = cy; - wxdobj_drw_require_redraw(m_pDrw, WXD_REFRESH_GRID); - drawco->Refresh(); - m_bUpdate = true; - } - $? "- UseScrollV" -} - - - -#if 0 - -static -bool -ColourChooserDiffersFromColour(Dk4WxColourView *pcc, int *pcol) -{ - bool back = false; - if (pcc->Red() != pcol[0]) { - back = true; - } - else { - if (pcc->Green() != pcol[1]) { - back = true; - } - else { - if (pcc->Blue() != pcol[2]) { - back = true; - } - } - } - return back; -} - -#endif - - - -void -WxdkdrawFrame::StyleToGUI(bool refresh) -{ - int valrotation = 0; /* Rotation value */ - bool enalayer = true; /* Enable layer spin control */ - bool enalinecolour = false; /* Enable line colour chooser */ - bool enalinewidth = false; /* Enable line width spin control */ - bool enalinestyle = false; /* Enable line style button */ - bool enajoinstyle = false; /* Enable join style button */ - bool enacapstyle = false; /* Enable cap style button */ - bool enafwarrow = false; /* Enable forward arrow button */ - bool enabwarrow = false; /* Enable backward arrow button */ - bool enafillcolour = false; /* Enable fill colour chooser */ - bool enafillstyle = false; /* Enable fill style button */ - bool enalatex = false; /* Enable LaTeX checkbox */ - bool enatextalign = false; /* Enable text align button */ - bool enatextfont = false; /* Enable text font button */ - bool enatextsize = false; /* Enable text size spin control */ - bool enarotation = false; /* Enable rotation spin control */ - $? "+ StyleToGUI" - if (NULL != m_pStyle) { $? ". style pointer %d", (int)(m_pStyle->ot) - /* - Check which style elements to enable - */ - switch ( (int)(m_pStyle->ot) ) { - case WXD_OT_TEXT : { $? ". text" - enalinecolour = true; - enalatex = true; - enatextalign = true; - enatextfont = true; - enatextsize = true; - enarotation = true; - valrotation = (m_pStyle->det).t.a; - } break; - case WXD_OT_POLYLINE : case WXD_OT_O_SPLINE : { $? ". polyline" - enalinecolour = true; - enalinewidth = true; - enalinestyle = true; - enajoinstyle = true; - enacapstyle = true; - enafwarrow = true; - enabwarrow = true; - } break; - case WXD_OT_O_ARC : { $? ". open arc" - enalinecolour = true; - enalinewidth = true; - enalinestyle = true; - enacapstyle = true; - enafwarrow = true; - enabwarrow = true; - } break; - case WXD_OT_POLYGON : case WXD_OT_C_SPLINE : case WXD_OT_C_ARC : { - $? ". closed path" - enalinecolour = true; $? ". line colour" - enalinewidth = true; $? ". line width" - enalinestyle = true; $? ". line style" - enajoinstyle = true; $? ". join style" - enafillcolour = true; $? ". fill colour" - enafillstyle = true; $? ". fill style" - } break; - case WXD_OT_CIRCLE : case WXD_OT_ELLIPSE : { $? ". circle/elli" - enalinecolour = true; - enalinewidth = true; - enalinestyle = true; - enafillcolour = true; - enafillstyle = true; - if (WXD_OT_ELLIPSE == m_pStyle->ot) { - enarotation = true; - valrotation = (m_pStyle->det).e.a; - } - } break; - case WXD_OT_BOX : { $? ". box" - enalinecolour = true; - enalinewidth = true; - enalinestyle = true; - enajoinstyle = true; - enafillcolour = true; - enafillstyle = true; - } break; - case WXD_OT_IMAGE : { $? ". image" - enafillcolour = true; - } break; - case WXD_OT_DOT_FILLED : { $? ". dot filled" - enalinecolour = true; - } break; - case WXD_OT_DOT_WHITE : { $? ". dot white" - enalinecolour = true; - enalinewidth = true; - } break; - default : { $? "! unknown object type" - } break; - } - - /* - Prepare to change style for selected object. - */ - - /* Layer */ - spLayerNumber->SetValue( (int)(m_pStyle->lay) ); - spLayerNumber->Enable(enalayer); - if (refresh) { spLayerNumber->Refresh(); m_bUpdate = true; } - $? ". layer" - - /* Line colour */ - ccLineColour->SetRGB(m_pStyle->sc[0], m_pStyle->sc[1], m_pStyle->sc[2]); - $? ". enalinecolour = %d", (enalinecolour ? 1 : 0) - ccLineColour->Enable(enalinecolour); - if (refresh) { ccLineColour->Refresh(); m_bUpdate = true; } - $? ". line colour" - - /* Line width */ - spLineWidth->SetValue( (int)(m_pStyle->lw) ); - $? ". enalinewidth = %d", (enalinewidth ? 1 : 0) - spLineWidth->Enable(enalinewidth); - if (refresh) { spLineWidth->Refresh(); m_bUpdate = true; } - $? ". line width" - - /* Line style */ - bStyleLineStyle->SetBitmap(WxdkdrawFrame::ms_ls_images[m_pStyle->ls]); - $? ". enalinestyle = %d", (enalinestyle ? 1 : 0) - bStyleLineStyle->Enable(enalinestyle); - if (refresh) { bStyleLineStyle->Refresh(); m_bUpdate = true; } - $? ". line style" - - /* Join style */ - bStyleLineJoins->SetBitmap(WxdkdrawFrame::ms_lj_images[m_pStyle->js]); - bStyleLineJoins->Enable(enajoinstyle); - if (refresh) { bStyleLineJoins->Refresh(); m_bUpdate = true; } - $? ". join style" - - /* Cap style */ - bStyleLineEnds->SetBitmap(WxdkdrawFrame::ms_lc_images[m_pStyle->cs]); - bStyleLineEnds->Enable(enacapstyle); - if (refresh) { bStyleLineEnds->Refresh(); m_bUpdate = true; } - $? ". cap style" - - /* Forward arrow */ - bStyleArrowForward->SetBitmap( - WxdkdrawFrame::ms_arrow_images[m_pStyle->aft] - ); - bStyleArrowForward->Enable(enafwarrow); - if (refresh) { bStyleArrowForward->Refresh(); m_bUpdate = true; } - $? ". forward arrow" - - /* Backward arrow */ - bStyleArrowBackward->SetBitmap( - WxdkdrawFrame::ms_arrow_images[m_pStyle->abt] - ); - bStyleArrowBackward->Enable(enabwarrow); - if (refresh) { bStyleArrowBackward->Refresh(); m_bUpdate = true; } - $? ". backward arrow" - - /* Fill colour */ - ccFillColour->SetRGB( - m_pStyle->fc[0], m_pStyle->fc[1], m_pStyle->fc[2] - ); - ccFillColour->Enable(enafillcolour); - if (refresh) { ccFillColour->Refresh(); m_bUpdate = true; } - $? ". fill colour" - - /* Fill style */ - bStyleFillPattern->SetBitmap(WxdkdrawFrame::ms_fs_images[m_pStyle->fs]); - bStyleFillPattern->Enable(enafillstyle); - if (refresh) { bStyleFillPattern->Refresh(); m_bUpdate = true; } - $? ". fill style" - - if (WXD_OT_TEXT == m_pStyle->ot) { - - /* LaTeX text flag */ - cbStyleTextLaTeX->SetValue( - WXD_TEXT_FLAG_NONE - != (WXD_TEXT_FLAG_LATEX & (m_pStyle->det).t.fl) - ); - cbStyleTextLaTeX->Enable(enalatex); - if (refresh) { cbStyleTextLaTeX->Refresh(); m_bUpdate = true; } - $? ". latex flag" - - $? ". text align = %u", (unsigned)((m_pStyle->det).t.al) - bStyleTextAlign->SetBitmap( - WxdkdrawFrame::ms_ta_images[(m_pStyle->det).t.al] - ); - bStyleTextAlign->Enable(enatextalign); - if (refresh) { bStyleTextAlign->Refresh(); m_bUpdate = true; } - $? ". text align" - - /* Text font */ - bStyleFontName->SetBitmap( - WxdkdrawFrame::ms_fn_images[(m_pStyle->det).t.find] - ); - bStyleFontName->Enable(enatextfont); - if (refresh) { bStyleFontName->Refresh(); m_bUpdate = true; } - $? ". font name" - - /* Text size */ - spFontSize->SetValue((m_pStyle->det).t.fsz); - spFontSize->Enable(enatextsize); - if (refresh) { spFontSize->Refresh(); m_bUpdate = true; } - $? ". text size" - - } - else { - cbStyleTextLaTeX->Enable(false); - bStyleTextAlign->Enable(false); - bStyleFontName->Enable(false); - spFontSize->Enable(false); - } - spRotation->SetValue(valrotation); - spRotation->Enable(enarotation); - if (refresh) { spRotation->Refresh(); m_bUpdate = true; } - } - else { $? ". no style object, default style" - /* - Prepare to change default styles. - */ - - /* Layer number */ - spLayerNumber->SetValue( (int)(m_oStyle.lay) ); - spLayerNumber->Enable(); - if (refresh) { spLayerNumber->Refresh(); m_bUpdate = true; } - - /* Line colour */ - ccLineColour->SetRGB( m_oStyle.sc[0], m_oStyle.sc[1], m_oStyle.sc[2] ); - ccLineColour->Enable(); - if (refresh) { ccLineColour->Refresh(); m_bUpdate = true; } - - /* Line width */ - spLineWidth->SetValue( (int)(m_oStyle.lw) ); - spLineWidth->Enable(); - if (refresh) { spLineWidth->Refresh(); m_bUpdate = true; } - - /* Line style */ - bStyleLineStyle->SetBitmap(WxdkdrawFrame::ms_ls_images[m_oStyle.ls]); - bStyleLineStyle->Enable(); - if (refresh) { bStyleLineStyle->Refresh(); m_bUpdate = true; } - - /* Join style */ - bStyleLineJoins->SetBitmap(WxdkdrawFrame::ms_lj_images[m_oStyle.js]); - bStyleLineJoins->Enable(); - if (refresh) { bStyleLineJoins->Refresh(); m_bUpdate = true; } - - /* Cap style */ - bStyleLineEnds->SetBitmap(WxdkdrawFrame::ms_lc_images[m_oStyle.cs]); - bStyleLineEnds->Enable(); - if (refresh) { bStyleLineEnds->Refresh(); m_bUpdate = true; } - - /* Forward arrow */ - bStyleArrowForward->SetBitmap( - WxdkdrawFrame::ms_arrow_images[m_oStyle.aft] - ); - bStyleArrowForward->Enable(); - if (refresh) { bStyleArrowForward->Refresh(); m_bUpdate = true; } - - /* Backward arrow */ - bStyleArrowBackward->SetBitmap( - WxdkdrawFrame::ms_arrow_images[m_oStyle.abt] - ); - bStyleArrowBackward->Enable(); - if (refresh) { bStyleArrowBackward->Refresh(); m_bUpdate = true; } - - /* Fill colour */ - ccFillColour->SetRGB( m_oStyle.fc[0], m_oStyle.fc[1], m_oStyle.fc[2] ); - ccFillColour->Enable(); - if (refresh) { ccFillColour->Refresh(); m_bUpdate = true; } - - /* Fill style */ - bStyleFillPattern->SetBitmap(WxdkdrawFrame::ms_fs_images[m_oStyle.fs]); - bStyleFillPattern->Enable(); - if (refresh) { bStyleFillPattern->Refresh(); m_bUpdate = true; } - - /* LaTeX text flag */ - cbStyleTextLaTeX->SetValue( - WXD_TEXT_FLAG_NONE != (WXD_TEXT_FLAG_LATEX & m_oStyle.det.t.fl) - ); - cbStyleTextLaTeX->Enable(); - if (refresh) { cbStyleTextLaTeX->Refresh(); m_bUpdate = true; } - - /* Text align */ - bStyleTextAlign->SetBitmap( - WxdkdrawFrame::ms_ta_images[m_oStyle.det.t.al] - ); - bStyleTextAlign->Enable(); - if (refresh) { bStyleTextAlign->Refresh(); m_bUpdate = true; } - - /* Text font */ - bStyleFontName->SetBitmap( - WxdkdrawFrame::ms_fn_images[m_oStyle.det.t.find] - ); - bStyleFontName->Enable(); - if (refresh) { bStyleFontName->Refresh(); m_bUpdate = true; } - - /* Text size */ - spFontSize->SetValue(m_oStyle.det.t.fsz); - spFontSize->Enable(); - if (refresh) { spFontSize->Refresh(); m_bUpdate = true; } - - /* Rotation */ - spRotation->SetValue(0); - spRotation->Enable(false); - if (refresh) { spRotation->Refresh(); m_bUpdate = true; } - } - $? "- StyleToGUI" -} - - - -void -WxdkdrawFrame::SetStyleObject(Wxd_object_t *pObj, bool bUpdate) -{ - if (m_pStyle != pObj) { - m_pStyle = pObj; - StyleToGUI(bUpdate); - } -} - - - -void -WxdkdrawFrame::UpdateOneFont( - Wxd_font_t *pfont -) -{ - pfont->attempted = false; - if (NULL != pfont->font) { - delete (pfont->font); - pfont->font = NULL; - } - wxdfont_find_font( - pfont, drawco->m_dZoom, (drawco->m_ptRes).y, - (0 != m_iv[IVI_FONT_EXACT]) - ); -} - - - -void -WxdkdrawFrame::UpdateFonts(void) -{ - Wxd_font_t *pfont; - Wxd_object_t *pobj; - $? "+ UpdateFonts" - /* Connect text details to fonts. - */ - $? ". assign font structures to text objects (start)" - dk4sto_it_reset(m_pDrw->i_flat); - do { - pobj = (Wxd_object_t *)dk4sto_it_next(m_pDrw->i_flat); - if (NULL != pobj) { - if (WXD_OT_TEXT == pobj->ot) { $? ". text object" - if (NULL == (pobj->det).t.font) { $? ". obj without font" - (pobj->det).t.font = FindFont( - (pobj->det).t.find, (pobj->det).t.fsz - ); - } - } - } - } while (NULL != pobj); - $? ". assign font structures to text objects (finished)" - /* Clear and renew all fonts - */ - $? ". clear and renew font objects (start)" - dk4sto_it_reset(m_pDrw->i_fonts); - do { - pfont = (Wxd_font_t *)dk4sto_it_next(m_pDrw->i_fonts); - if (NULL != pfont) { - UpdateOneFont(pfont); - } - } while (NULL != pfont); - $? ". clear and renew font objects (finished)" - $? "- UpdateFonts" -} - - - -Wxd_font_t * -WxdkdrawFrame::FindFont(uint8_t find, uint16_t fsz) -{ - Wxd_font_t tf; - Wxd_font_t *back = NULL; - $? "+ FindFont %u %u", (unsigned)find, (unsigned)fsz - tf.find = find; tf.fsz = fsz; - back = (Wxd_font_t *)dk4sto_it_find_like(m_pDrw->i_fonts, &tf, 0); - if (NULL == back) { - back = wxdfont_new(find, fsz); - if (NULL != back) { - if (0 != dk4sto_add(m_pDrw->s_fonts, back, NULL)) { - wxdfont_find_font( - back, drawco->m_dZoom, (drawco->m_ptRes).y, - (0 != m_iv[IVI_FONT_EXACT]) - ); - } - else { - wxdfont_delete(back); - back = NULL; - } - } - } $? "- FindFont %d", TR_IPTR(back) - return back; -} - - - -bool -WxdkdrawFrame::ObjectSelectableInState(Wxd_object_t const *pobj) -{ - bool back = false; - if (NULL != pobj) { - back = true; - /* - _STATE_ - In some states we want to select objects of certain - types only - */ - switch (m_iState) { - case S_MOD_SPLINE : { - back = false; - switch ( (int)(pobj->ot) ) { - case WXD_OT_O_SPLINE : - case WXD_OT_C_SPLINE : - { - back = true; - } break; - } - } break; - case S_ROTATE : { - switch ( (int)(pobj->ot) ) { - case WXD_OT_CIRCLE : - case WXD_OT_DOT_FILLED : - case WXD_OT_DOT_WHITE : - { - if (NULL == pobj->pa) { - back = false; - } - } break; - } - } break; - case S_CONVERT : { - back = wxdobj_can_convert(m_iObjToCreate, pobj); - } break; - case S_FLIP : { - /* - For some object types flipping would result - in no change - */ - switch ( (int)(pobj->ot) ) { - case WXD_OT_CIRCLE : - case WXD_OT_BOX : - case WXD_OT_IMAGE : - case WXD_OT_DOT_FILLED : - case WXD_OT_DOT_WHITE : { - if (NULL == pobj->pa) { - back = false; - } - } break; - } - } break; - case S_UNGROUP : { - /* - Only members of groups are of interest, from the member - we go upwards to find the top level group object - */ - if (NULL == pobj->pa) { - back = false; - } - } break; - case S_DETAILS : { - /* - The details to modify - if any - depend on the object type: - */ - switch ( (int)(pobj->ot) ) { - case WXD_OT_TEXT : /* Texts */ - case WXD_OT_BOX : /* Rounded corner radius */ - case WXD_OT_IMAGE : /* Image file and flags */ - case WXD_OT_DOT_FILLED : /* Diameter */ - case WXD_OT_DOT_WHITE : /* Diameter */ - { - back = true; - } break; - default : { - back = false; - } break; - } - } break; - } - } - return back; -} - - - -Wxd_object_t * -WxdkdrawFrame::FindNearestObject(bool gr) -{ - Wxd_object_t *back = NULL; /* Object with minimum distance */ - Wxd_object_t *pobj; /* Current object */ - double min = -1.0; /* Minimum distance found so far */ - double d; /* Distance to current object */ - $? "+ FindNearestObject" - dk4sto_it_reset(m_pDrw->i_flat); - do { - pobj = (Wxd_object_t *)dk4sto_it_next(m_pDrw->i_flat); - if (NULL != pobj) { - if ((wxdobj_is_active(pobj)) && (ObjectSelectableInState(pobj))) { - d = wxdobj_distance_to_point(pobj, &m_ptMousePosRaw); - if ( - (0.0 < d) - && ((0.0 > min) || (d < min)) - && (d < 2.0 * (double)(drawco->m_uGridSnap)) - ) { - min = d; - back = pobj; - } - } - } - } while (NULL != pobj); - if ((gr) && (NULL != back)) { - while (NULL != back->pa) { back = back->pa; } - } $? "- FindNearestObject %d", TR_IPTR(back) - return back; -} - - - -void -WxdkdrawFrame::RequireRedraw(int level) -{ - wxdobj_drw_require_redraw(m_pDrw, level); - drawco->Refresh(); - Update(); -} - - - -void -WxdkdrawFrame::UpdateTextForFont(Wxd_object_t *pobj, bool bRedraw) -{ - Wxd_font_t *pfont; - bool hasf; - $? "+ UpdateTextForFont" - hasf = (NULL != (pobj->det).t.font); - (pobj->det).t.font = pfont = FindFont((pobj->det).t.find,(pobj->det).t.fsz); - if (NULL != pfont) { - UpdateOneFont(pfont); - } - if (hasf) { - wxdobj_remove_unused_fonts(m_pDrw); - } - if (bRedraw) { - RequireRedraw(WXD_REFRESH_DRAWING); - } - $? "- UpdateTextForFont" -} - - - -void -WxdkdrawFrame::SetMouseAndStatusTexts(int st) -{ - $? "+ SetMouseAndStatusTexts" - /* Defaults - */ - $? ". clean all texts" - msgMouseL->SetLabel(sNlWx[7]); - msgMouseM->SetLabel(sNlWx[7]); - msgMouseR->SetLabel(sNlWx[7]); - SetStatusText(sNlWx[7]); - /* - _STATE_ Messages depending on state to enter. - */ - switch (st) { - case S_NOOP : { $? ". S_NOOP" - } break; - case S_DELETE : { $? ". S_DELETE" - msgMouseR->SetLabel(sTexts[341]); - msgMouseM->SetLabel(sTexts[534]); - } break; - case S_REGION_DELETE : { - msgMouseL->SetLabel(sTexts[532]); - msgMouseR->SetLabel(sTexts[533]); - } break; - case S_MOVE_SELECT : { $? ". S_MOVE_SELECT" - msgMouseL->SetLabel(sNlWx[7]); - msgMouseR->SetLabel(sTexts[344]); - } break; - case S_MOVE_PLACE : { $? ". S_MOVE_PLACE" - } break; - case S_COPY_SELECT : { $? ". S_COPY_SELECT" - msgMouseL->SetLabel(sNlWx[7]); - msgMouseR->SetLabel(sTexts[372]); - } break; - case S_COPY_PLACE : { $? ". S_COPY_PLACE" - } break; - case S_POLY_FIRST : { $? ". S_POLY_FIRST" - msgMouseL->SetLabel(sTexts[373]); - msgMouseR->SetLabel(sTexts[375]); - SetStatusText( - sTexts[(WXD_OT_POLYLINE == m_iObjToCreate) ? 30 : 32] - ); - } break; - case S_POLY_FURTHER : { $? ". S_POLY_FURTHER" - msgMouseL->SetLabel( - (IsAcceptablePoint()) ? (sTexts[374]) : (sNlWx[7]) - ); - msgMouseR->SetLabel(sTexts[376]); - SetStatusText( - sTexts[(WXD_OT_POLYLINE == m_iObjToCreate) ? 30 : 32] - ); - } break; - case S_SPLINE_FIRST : { $? ". S_SPLINE_FIRST" - msgMouseL->SetLabel(sTexts[373]); - msgMouseR->SetLabel(sTexts[375]); - if (WXD_OT_C_SPLINE == m_iObjToCreate) { - SetStatusText(sTexts[m_bSplineInterpolated ? 48 : 44]); - } - else { - SetStatusText(sTexts[m_bSplineInterpolated ? 46 : 42]); - } - } break; - case S_SPLINE_FURTHER : { $? ". S_SPLINE_FURTHER" - msgMouseL->SetLabel( - (IsAcceptablePoint()) ? (sTexts[374]) : (sNlWx[7]) - ); - msgMouseR->SetLabel(sTexts[376]); - if (WXD_OT_C_SPLINE == m_iObjToCreate) { - SetStatusText(sTexts[m_bSplineInterpolated ? 48 : 44]); - } - else { - SetStatusText(sTexts[m_bSplineInterpolated ? 46 : 42]); - } - } break; - case S_BOX_FIRST : { - msgMouseL->SetLabel(sTexts[377]); - msgMouseR->SetLabel(sTexts[379]); - SetStatusText(sTexts[m_bSplineInterpolated ? 36 : 34]); - } break; - case S_BOX_OPPOSITE : { - msgMouseL->SetLabel( - (IsAcceptablePoint()) ? (sTexts[378]) : (sNlWx[7]) - ); - msgMouseR->SetLabel(sTexts[379]); - SetStatusText(sTexts[m_bSplineInterpolated ? 36 : 34]); - } break; - case S_CIRCLE_CENTER : { - msgMouseL->SetLabel(sTexts[380]); - msgMouseR->SetLabel(sTexts[383]); - SetStatusText(sTexts[38]); - } break; - case S_CIRCLE_RADIUS : { - msgMouseL->SetLabel( - (IsAcceptablePoint()) ? (sTexts[381]) : (sNlWx[7]) - ); - msgMouseR->SetLabel(sTexts[382]); - SetStatusText(sTexts[38]); - } break; - case S_ELLIPSE_CENTER : { - msgMouseL->SetLabel(sTexts[380]); - msgMouseR->SetLabel(sTexts[383]); - SetStatusText(sTexts[40]); - } break; - case S_ELLIPSE_CORNER : { - msgMouseL->SetLabel( - (IsAcceptablePoint()) ? (sTexts[384]) : (sNlWx[7]) - ); - msgMouseR->SetLabel(sTexts[382]); - SetStatusText(sTexts[40]); - } break; - case S_ARC_1 : { - msgMouseL->SetLabel(sTexts[389]); - msgMouseR->SetLabel(sTexts[393]); - SetStatusText(sTexts[(WXD_OT_C_ARC == m_iObjToCreate) ? 388 : 386]); - } break; - case S_ARC_2 : { - msgMouseL->SetLabel( - (IsAcceptablePoint()) ? (sTexts[390]) : (sNlWx[7]) - ); - msgMouseR->SetLabel(sTexts[392]); - SetStatusText(sTexts[(WXD_OT_C_ARC == m_iObjToCreate) ? 388 : 386]); - } break; - case S_ARC_3 : { - msgMouseL->SetLabel( - (IsAcceptablePoint()) ? (sTexts[391]) : (sNlWx[7]) - ); - msgMouseR->SetLabel(sTexts[392]); - SetStatusText(sTexts[(WXD_OT_C_ARC == m_iObjToCreate) ? 388 : 386]); - } break; - case S_DOT : { - msgMouseL->SetLabel(sTexts[394]); - msgMouseR->SetLabel(sTexts[395]); - SetStatusText( - sTexts[(WXD_OT_DOT_WHITE == m_iObjToCreate) ? 52 : 50] - ); - } break; - case S_TEXT : { - msgMouseL->SetLabel(sTexts[403]); - msgMouseR->SetLabel(sTexts[404]); - SetStatusText(sTexts[54]); - } break; - case S_IMG_1 : { - msgMouseL->SetLabel(sTexts[405]); - msgMouseR->SetLabel(sTexts[408]); - SetStatusText(sTexts[56]); - } break; - case S_IMG_2 : { - msgMouseL->SetLabel( - (IsAcceptablePoint()) ? (sTexts[406]) : (sNlWx[7]) - ); - msgMouseR->SetLabel(sTexts[407]); - SetStatusText(sTexts[56]); - } break; - case S_LIBELEM_PLACE : { - msgMouseL->SetLabel(sTexts[411]); - msgMouseR->SetLabel(sTexts[412]); - SetStatusText(sTexts[58]); - } break; - case S_MOVEPT_SELECT : { - msgMouseL->SetLabel( - (NULL != m_pCurrent) ? (sTexts[418]) : (sNlWx[7]) - ); - msgMouseR->SetLabel(sTexts[420]); - SetStatusText(sTexts[421]); - } break; - case S_MOVEPT_PLACE : { - msgMouseL->SetLabel(sTexts[419]); - msgMouseR->SetLabel(sTexts[420]); - SetStatusText(sTexts[421]); - } break; - case S_DELPT : { - msgMouseL->SetLabel( - (NULL != m_pCurrent) ? (sTexts[431]) : (sNlWx[7]) - ); - msgMouseR->SetLabel(sTexts[432]); - SetStatusText(sTexts[433]); - } break; - case S_ADDPT_SELECT : { - msgMouseL->SetLabel( - (NULL != m_pCurrent) ? (sTexts[435]) : (sNlWx[7]) - ); - msgMouseR->SetLabel(sTexts[437]); - SetStatusText(sTexts[434]); - } break; - case S_ADDPT_PLACE : { - msgMouseL->SetLabel( - (NULL != m_pCurrent) ? (sTexts[436]) : (sNlWx[7]) - ); - msgMouseR->SetLabel(sTexts[438]); - SetStatusText(sTexts[434]); - } break; - case S_DRWSZ_SELECT : { - msgMouseL->SetLabel( - (m_bHaveCornerPoint) ? (sTexts[439]) : (sNlWx[7]) - ); - msgMouseR->SetLabel(sTexts[440]); - SetStatusText(sTexts[441]); - } break; - case S_DRWSZ_PLACE : { - msgMouseL->SetLabel(sTexts[442]); - msgMouseR->SetLabel(sTexts[443]); - SetStatusText(sTexts[441]); - } break; - case S_FLIP : { - msgMouseL->SetLabel( - (NULL != m_pCurrent) ? (sTexts[445]) : (sNlWx[7]) - ); - msgMouseR->SetLabel(sTexts[446]); - SetStatusText(sTexts[444]); - } break; - case S_GROUP_ONE : { - int num_marked_2 = wxdobj_num_marked_2(m_pDrw); - if (NULL != m_pCurrent) { - msgMouseL->SetLabel(sTexts[ - ((wxdobj_is_marked(m_pCurrent,OBJ_MARKER_2)) - ? (448) : (447)) - ]); - } - else { - msgMouseL->SetLabel( - (2 <= num_marked_2) ? (sTexts[449]) : (sNlWx[7]) - ); - } - msgMouseR->SetLabel(sTexts[(2<= num_marked_2) ? (450) : (451)]); - SetStatusText(sTexts[452]); - } break; - case S_UNGROUP : { - msgMouseL->SetLabel( - ((NULL != m_pCurrent) ? (sTexts[454]) : (sNlWx[7])) - ); - msgMouseR->SetLabel(sTexts[455]); - SetStatusText(sTexts[453]); - } break; - case S_GROUP_RECT_1 : { - msgMouseL->SetLabel(sTexts[456]); - msgMouseR->SetLabel(sTexts[451]); - SetStatusText(sTexts[457]); - } break; - case S_GROUP_RECT_2 : { - msgMouseL->SetLabel(sTexts[449]); - msgMouseR->SetLabel(sTexts[450]); - SetStatusText(sTexts[457]); - } break; - case S_DETAILS : case S_DETAILS_2 : { - msgMouseL->SetLabel( - (NULL != m_pCurrent) ? (sTexts[459]) : (sNlWx[7]) - ); - msgMouseR->SetLabel(sTexts[460]); - SetStatusText(sTexts[458]); - } break; - case S_CONVERT : { - switch ( (int)m_iObjToCreate ) { - case WXD_OT_POLYLINE : { - SetStatusText(sTexts[546]); - } break; - case WXD_OT_POLYGON : { - SetStatusText(sTexts[545]); - } break; - case WXD_OT_C_SPLINE: { - if (m_bSplineInterpolated) { - SetStatusText(sTexts[547]); - } - else { - SetStatusText(sTexts[550]); - } - } break; - case WXD_OT_O_SPLINE : { - if (m_bSplineInterpolated) { - SetStatusText(sTexts[166]); - } - else { - SetStatusText(sTexts[551]); - } - } break; - case WXD_OT_C_ARC : { - SetStatusText(sTexts[548]); - } break; - case WXD_OT_O_ARC : { - SetStatusText(sTexts[549]); - } break; - case WXD_OT_DOT_FILLED : { - SetStatusText(sTexts[553]); - } break; - case WXD_OT_DOT_WHITE : { - SetStatusText(sTexts[552]); - } break; - } - msgMouseL->SetLabel( - (NULL != m_pCurrent) ? (sTexts[554]) : (sNlWx[7]) - ); - msgMouseR->SetLabel(sTexts[555]); - } break; - case S_ROTATE : { - msgMouseL->SetLabel( - (NULL != m_pCurrent) ? (sTexts[572]) : (sNlWx[7]) - ); - msgMouseR->SetLabel(sTexts[573]); - SetStatusText(sTexts[(m_bSplineInterpolated) ? 571 : 570]); - } break; - case S_MOD_SPLINE : { - msgMouseL->SetLabel( - (NULL != m_pCurrent) ? (sTexts[622]) : (sNlWx[7]) - ); - msgMouseR->SetLabel(sTexts[623]); - SetStatusText(sTexts[624]); - } break; - default : { $? "! default" - } break; - } - /* - Refresh widgets and update window - */ - msgMouseL->Refresh(); - msgMouseM->Refresh(); - msgMouseR->Refresh(); - m_bUpdate = true; - $? "- SetMouseAndStatusTexts" -} - - - - -/* vim: set ai sw=4 ts=4 : */ - |