1 /* 2 Copyright (C) 2019-2021, Dirk Krause 3 SPDX-License-Identifier: BSD-3-Clause 4 */ 5 6 /* 7 WARNING: This file was generated by the dkct program (see 8 http://dktools.sourceforge.net/ for details). 9 Changes you make here will be lost if dkct is run again! 10 You should modify the original source and run dkct on it. 11 Original source: WxdkdrawFrame.wxc 12 */ 13 14 /** @file WxdkdrawFrame.h Header file for the WxdkdrawFrame module. 15 */ 16 17 #ifndef WXDKDRAWFRAME_H_INCLUDED 18 /** Avoid multiple inclusions. */ 19 #define WXDKDRAWFRAME_H_INCLUDED 1 20 21 22 #include <wxdkdraw/wxdkdraw.h> 23 24 #ifndef DK4WXCOLOURVIEW_H_INCLUDED 25 #include <libdk4wx/Dk4WxColourView.h> 26 #define DK4WXCOLOURVIEW_H_INCLUDED 1 27 #endif 28 29 30 /** The programs main window. 31 */ 32 class WxdkdrawFrame : public Dk4WxFrame 33 { 34 /* ----- start of control class ----- */ 35 36 /** The draw control. 37 Defined as nested class to make both classes friend of each other. 38 */ 39 class Control : public wxControl 40 { 41 /** Allow frame class full access to all members. 42 */ 43 friend class WxdkdrawFrame; 44 45 /** Class responds to events. 46 */ 47 #if wxCHECK_VERSION(3,0,0) 48 wxDECLARE_DYNAMIC_CLASS(Control); 49 #else 50 DECLARE_DYNAMIC_CLASS(Control) 51 #endif 52 53 private: 54 55 /* control private members */ 56 57 /** This class uses an event table. 58 */ 59 #if wxCHECK_VERSION(3,0,0) 60 wxDECLARE_EVENT_TABLE(); 61 #else 62 DECLARE_EVENT_TABLE() 63 #endif 64 65 protected: 66 67 /* control protected members */ 68 69 /** Name of control, used in initialization. 70 */ 71 static wxChar const ms_controlname[]; 72 73 /** Draw control size. 74 Only available within OnPaint handler. 75 */ 76 wxSize m_szDrawco; 77 78 /** Screen resolution in dpi for x and y direction. 79 */ 80 dk4_gra_point_t m_ptRes; 81 82 /** Coefficients for coordinate transformations. 83 Only available within OnPaint handler. 84 */ 85 dk4_gra_point_t m_ptM; 86 87 /** Coefficients for coordinate transformations. 88 Only available within OnPaint handler. 89 */ 90 dk4_gra_point_t m_ptN; 91 92 /** Parent frame, containing pointer to the drawing. 93 */ 94 WxdkdrawFrame *m_pParent; 95 96 /** Bitmap 1 contains border, viewport and grid. 97 */ 98 wxBitmap *m_pB1; 99 100 /** Bitmap 2 contains the graphics elements on top of bitmap 1. 101 */ 102 wxBitmap *m_pB2; 103 104 /** Bitmap 3 contains the markup on top of bitmap 2. 105 */ 106 wxBitmap *m_pB3; 107 108 /** Zoom factor, depends on zoom level. 109 */ 110 double m_dZoom; 111 112 /** Optical grid distance. 113 */ 114 uint32_t m_uGridOptical; 115 116 /** Snap grid distance. 117 */ 118 uint32_t m_uGridSnap; 119 120 /** Control is allowed to allocate bitmaps. 121 */ 122 bool m_bCanAllocate; 123 124 public: 125 126 /* control public methods */ 127 128 /** Default constructor. 129 Here for completeness 130 */ 131 Control(); 132 133 /** Constructor 134 */ 135 Control( 136 wxWindow *pParent, 137 wxWindowID wxid, 138 WxdkdrawFrame *pFrame, 139 wxPoint const & pos = wxDefaultPosition, 140 wxSize const & sz = wxDefaultSize, 141 long st = wxBORDER_NONE, 142 wxChar const *name = ms_controlname 143 ); 144 145 /** Create control. 146 This method is here for completeness, it is not used 147 by the wxdkdraw program. 148 @param pParent Parent frame. 149 @param wxid Window ID. 150 @param pFrame Parent frame. 151 @param pos Position. 152 @param sz Size. 153 @param st Control style. 154 @param name Control name. 155 */ 156 bool 157 Create( 158 wxWindow *pParent, 159 wxWindowID wxid, 160 WxdkdrawFrame *pFrame, 161 wxPoint const & pos = wxDefaultPosition, 162 wxSize const & sz = wxDefaultSize, 163 long st = wxBORDER_NONE, 164 wxChar const *name = ms_controlname 165 ); 166 167 /** Destructor. 168 */ 169 ~Control(); 170 171 /** Prepare control for destruction. 172 Release bitmaps and avoid re-allocation. 173 */ 174 void 175 PrepareForDestruction(void); 176 177 /** Handler for erase event. 178 @param event Event to handle. 179 */ 180 void 181 OnErase(wxEraseEvent & event); 182 183 /** Handler for paint event. 184 @param event Event to handle. 185 */ 186 void 187 OnPaint(wxPaintEvent & event); 188 189 /** Handler for resize event. 190 @param event Event to handle. 191 */ 192 void 193 OnSize(wxSizeEvent & event); 194 195 /** Handler for mouse enter event. 196 @param event Event to handle. 197 */ 198 void 199 OnMouseEnter(wxMouseEvent & event); 200 201 /** Handler for mouse leave event. 202 @param event Event to handle. 203 */ 204 void 205 OnMouseLeave(wxMouseEvent & event); 206 207 /** Handler for mouse motion event. 208 @param event Event to handle. 209 */ 210 void 211 OnMouseMove(wxMouseEvent & event); 212 213 /** Handler for left mouse button event. 214 @param event Event to handle. 215 */ 216 void 217 OnLeftMouseButtonDown(wxMouseEvent & event); 218 219 /** Handler for right mouse button event. 220 @param event Event to handle. 221 */ 222 void 223 OnRightMouseButtonDown(wxMouseEvent & event); 224 225 /** Handler for middle mouse button event. 226 @param event Event to handle. 227 */ 228 void 229 OnMiddleMouseButtonDown(wxMouseEvent & event); 230 231 /** Handler for mouse wheel event. 232 @param event Event to handle. 233 */ 234 void 235 OnMouseWheel(wxMouseEvent & event); 236 237 /** Handler for keyboard event. 238 @param event Event to handle. 239 */ 240 void 241 OnKeyboard(wxKeyEvent & event); 242 243 protected: 244 245 /** Check for completed initialization. 246 @return True if ready to handle events, false otherwise. 247 */ 248 bool 249 CanHandleEvents(void); 250 251 /** Fill entire control using border colour. 252 @param dc Drawing context. 253 */ 254 void 255 PaintOperation0(wxDC & dc); 256 257 /** Draw background for drawing canvas. 258 @param gc Graphics context to use. 259 */ 260 void 261 PaintOperationCanvas( 262 wxGraphicsContext *gc 263 ); 264 265 /** Draw grid in a calculated bounding box. 266 @param gc Graphics context to use. 267 @param g_end Bounding box data for grid. 268 */ 269 void 270 PaintOperationBoundingBoxGrid( 271 wxGraphicsContext *gc, 272 Wxd_bb_t const & g_end 273 ); 274 275 /** Draw grid. 276 @param gc Graphics context to use. 277 */ 278 void 279 PaintOperationGrid( 280 wxGraphicsContext *gc 281 ); 282 283 /** Decide whether or not to use placement help in current state. 284 @return True to show placement help, false otherwise. 285 */ 286 bool 287 StateUsesPlacementHelp(void); 288 289 /** Draw border, drawable area and grid. 290 @param gc Graphics context to use. 291 */ 292 void 293 PaintOperation1(wxGraphicsContext *gc); 294 295 /** Draw drawing objects. 296 @param gc Graphics context to use. 297 @param event Event to process. 298 */ 299 void 300 PaintOperation2(wxGraphicsContext *gc); 301 302 /** Draw markup on top of drawing. 303 @param gc Graphics context to use. 304 @param event Event to process. 305 */ 306 void 307 PaintOperation3(wxGraphicsContext *gc); 308 309 /** Calculate zoom factor and grid distances after zooming in 310 or out or after changing graphics. 311 */ 312 void 313 CalculateZoomFactor(void); 314 315 /** Calculate grid distances after changing grid settings. 316 */ 317 void 318 CalculateGridDistances(void); 319 320 /** Calculate conversion coefficients. 321 */ 322 void 323 CalculateConversionCoefficients(void); 324 325 /** Convert x distance from wxd to pixels. 326 @param d Distance to convert. 327 @return Conversion result. 328 */ 329 double 330 ConvDist(double d); 331 332 /** Convert x distance from wxd to pixels. 333 @param d Distance to convert. 334 @return Conversion result. 335 */ 336 double 337 ConvDist(int32_t d); 338 339 /** Convert x coordinate from wxd to pixels. 340 @param x X coordinate value in wxd. 341 @return X coordinate value in pixels. 342 */ 343 double 344 ConvX(double x); 345 346 /** Convert x coordinate from wxd to pixels. 347 @param x X coordinate value in wxd. 348 @return X coordinate value in pixels. 349 */ 350 double 351 ConvX(int32_t x); 352 353 /** Convert y coordinate from wxd to pixels. 354 @param y Y coordinate value in wxd. 355 @return Y coordinate value in pixels. 356 */ 357 double 358 ConvY(double y); 359 360 /** Convert y coordinate from wxd to pixels. 361 @param y Y coordinate value in wxd. 362 @return Y coordinate value in pixels. 363 */ 364 double 365 ConvY(int32_t y); 366 367 /** Convert x coordinate back from pixels to wxd. 368 @param x X coordinate in pixels. 369 @return X coordinate in wxd. 370 */ 371 double 372 InvX(double x); 373 374 /** Convert y coordinate back from pixels to wxd. 375 @param y Y coordinate in pixels. 376 @return Y coordinate in wxd. 377 */ 378 double 379 InvY(double y); 380 381 /** Convert x coordinate back from pixels to wxd. 382 @param x X coordinate in pixels. 383 @param ok Success flag to reset on error. 384 @return Backward conversion value on success, 0L on error. 385 */ 386 int32_t 387 InvX(double x, bool & ok); 388 389 /** Convert y coordinate back from pixels to wxd. 390 @param y Y coordinate in pixels. 391 @param ok Success flag to reset on error. 392 @return Backward conversion value on success, 0L on error. 393 */ 394 int32_t 395 InvY(double y, bool & ok); 396 397 #if 0 398 399 /** Convert x coordinate back from pixels to wxd. 400 @param dptr Address of result variable. 401 @param x X coordinate in pixels. 402 @return True on success, false on error (x out of range). 403 */ 404 bool 405 InvX(int32_t *dptr, double x); 406 407 /** Convert y coordinate back from pixels to wxd. 408 @param dptr Address of result variable. 409 @param y Y coordinate in pixels. 410 @return True on success, false on error (y out of range). 411 */ 412 bool 413 InvY(int32_t *dptr, double y); 414 415 /** Convert x coordinate back from pixels to wxd. 416 @param dptr Address of result variable. 417 @param x X coordinate in pixels. 418 @return True on success, false on error (x out of range). 419 */ 420 bool 421 InvX(int32_t *dptr, int x); 422 423 /** Convert y coordinate back from pixels to wxd. 424 @param dptr Address of result variable. 425 @param y Y coordinate in pixels. 426 @return True on success, false on error (y out of range). 427 */ 428 bool 429 InvY(int32_t *dptr, int y); 430 431 #endif 432 433 434 /** Round grid coordinate downward. 435 @param x Original coordinate. 436 @param gr Grid distance. 437 @param ok Success variable to reset on numerical errors. 438 @param fo Force downward rounding. 439 @return Result. 440 */ 441 int32_t 442 GridRoundDown( 443 int32_t x, 444 uint32_t gr, 445 bool & ok, 446 bool fo = false 447 ); 448 449 /** Round grid coordinate upward. 450 @param x Original coordinate. 451 @param gr Grid distance. 452 @param ok Success variable to reset on numerical errors. 453 @param fo Force upward rounding. 454 @return Result. 455 */ 456 int32_t 457 GridRoundUp( 458 int32_t x, 459 uint32_t gr, 460 bool & ok, 461 bool fo = false 462 ); 463 464 /** Round grid coordinate to nearest grid point. 465 @param x Original coordinate. 466 @param gr Grid distance. 467 @param ok Success variable to reset on numerical errors. 468 @return Result. 469 */ 470 int32_t 471 GridRoundNearest(int32_t x, uint32_t gr, bool & ok); 472 473 /** Check whether object contains all required data for drawing. 474 @param pobj Object to check. 475 @return True to draw the object, false to skip object. 476 */ 477 bool 478 CanDrawElement(Wxd_object_t const *pobj); 479 480 /** Check whether to draw an object in normal drawing pass. 481 @param pobj Object to check. 482 @return True to draw the object, false to skip drawing. 483 */ 484 bool 485 MustDrawElementInNormalPass(Wxd_object_t const *pobj); 486 487 /** Check whether to draw an object in markup pass. 488 @param pobj Object to check. 489 @return True to draw the object, false to skip drawing. 490 */ 491 bool 492 MustDrawElementInMarkupPass(Wxd_object_t const *pobj); 493 494 /** Check whether to highlight an object in markup pass. 495 @param pobj Object to check. 496 @return True to draw the object, false to skip drawing. 497 */ 498 bool 499 MustHighlightElementInMarkupPass(Wxd_object_t const *pobj); 500 501 /** Check whether to highlight an object in markup pass. 502 @param pobj Object to check. 503 @return True to draw the object, false to skip drawing. 504 */ 505 bool 506 MustHighlight2ElementInMarkupPass(Wxd_object_t const *pobj); 507 508 /** Check whether there are objects under construction in 509 current state. 510 @return True for states with objects under construction. 511 */ 512 bool 513 StateHasObjectsUnderModification(void); 514 515 /** Check whether there are objects to highlight in current state. 516 @return True for states with objects under construction. 517 */ 518 bool 519 StateHasObjectsToHighlight(void); 520 521 /** Check whether there are objects to highlight in current state. 522 @return True for states with objects under construction. 523 */ 524 bool 525 StateHasObjectsToHighlight2(void); 526 527 /** Choose stroke colour, either the objects stroke colour 528 or a colour for markup. 529 @param sc Destination array for colour components. 530 @param pObj Object to draw. 531 @param iMarkup Markup type to use. 532 */ 533 void 534 ChooseStrokeColour(int *sc, Wxd_object_t const *pObj, int iMarkup); 535 536 /** Draw one graphics object to graphics context. 537 @param gc Graphics context. 538 @param pObj Object to draw. 539 @param iMarkup Markup to apply. 540 @param pShift Optional shift vector. 541 */ 542 void 543 DrawElement( 544 wxGraphicsContext *gc, 545 Wxd_object_t const *pObj, 546 int iMarkup, 547 Wxd_point_t const *pShift = NULL 548 ); 549 550 /** Draw one text object to graphics context. 551 @param gc Graphics context. 552 @param pObj Object to draw. 553 @param iMarkup Markup to apply. 554 @param pShift Optional shift vector. 555 */ 556 void 557 DrawTextElement( 558 wxGraphicsContext *gc, 559 Wxd_object_t const *pObj, 560 int iMarkup, 561 Wxd_point_t const *pShift = NULL 562 ); 563 564 /** Create path for polyline or polygon. 565 @param p Path to construct. 566 @param pObj Object. 567 @param pShift Vector to shift object. 568 */ 569 void 570 PathPolyline( 571 wxGraphicsPath & p, 572 Wxd_object_t const *pObj, 573 Wxd_point_t const *pShift 574 ); 575 576 /** Create path for one X-spline segment consisting 577 of multiple sub-segments. 578 @param p Graphics path to modify. 579 @param pt Spline points array. 580 @param xsp X-spline data. 581 @param segno Number of current segment. 582 @param subsegs Number of sub-segments to produce. 583 @param divisor Divisor for derivative values. 584 @param shiftx X shift value. 585 @param shifty Y shift value. 586 @param ib Index of point B in pt. 587 @param ic Index of point C in pt. 588 */ 589 void 590 SplineSegment( 591 wxGraphicsPath & p, 592 Wxd_spline_point_t *pt, 593 dk4_xsp_2d_t *xsp, 594 uint16_t segno, 595 size_t subsegs, 596 double divisor, 597 double shiftx, 598 double shifty, 599 uint16_t ib, 600 uint16_t ic 601 ); 602 603 /** Create path for spline. 604 @param p Path to construct. 605 @param pObj Object. 606 @param pShift Vector to shift object. 607 */ 608 void 609 PathSpline( 610 wxGraphicsPath & p, 611 Wxd_object_t const *pObj, 612 Wxd_point_t const *pShift 613 ); 614 615 /** Create path for arc. 616 @param p Path to construct. 617 @param pObj Object. 618 @param pShift Vector to shift object. 619 */ 620 void 621 PathArc( 622 wxGraphicsPath & p, 623 Wxd_object_t const *pObj, 624 Wxd_point_t const *pShift 625 ); 626 627 /** Create path for circle. 628 @param p Path to construct. 629 @param pObj Object. 630 @param pShift Vector to shift object. 631 */ 632 void 633 PathCircle( 634 wxGraphicsPath & p, 635 Wxd_object_t const *pObj, 636 Wxd_point_t const *pShift 637 ); 638 639 /** Create path for ellipse. 640 @param p Path to construct. 641 @param pObj Object. 642 @param pShift Vector to shift object. 643 */ 644 void 645 PathEllipse( 646 wxGraphicsPath & p, 647 Wxd_object_t const *pObj, 648 Wxd_point_t const *pShift 649 ); 650 651 /** Create path for box. 652 @param p Path to construct. 653 @param pObj Object. 654 @param pShift Vector to shift object. 655 */ 656 void 657 PathBox( 658 wxGraphicsPath & p, 659 Wxd_object_t const *pObj, 660 Wxd_point_t const *pShift 661 ); 662 663 /** Mark up one polyline object. 664 @param gc Graphics context. 665 @param pObj Object to draw. 666 @param iMarkup Markup to apply. 667 @param pShift Optional shift vector. 668 */ 669 void 670 MarkupPolyline( 671 wxGraphicsContext *gc, 672 Wxd_object_t const *pObj, 673 int iMarkup, 674 Wxd_point_t const *pShift = NULL 675 ); 676 677 /** Mark up one spline object. 678 @param gc Graphics context. 679 @param pObj Object to draw. 680 @param iMarkup Markup to apply. 681 @param pShift Optional shift vector. 682 */ 683 void 684 MarkupSpline( 685 wxGraphicsContext *gc, 686 Wxd_object_t const *pObj, 687 int iMarkup, 688 Wxd_point_t const *pShift = NULL 689 ); 690 691 /** Mark up one arc object. 692 @param gc Graphics context. 693 @param pObj Object to draw. 694 @param iMarkup Markup to apply. 695 @param pShift Optional shift vector. 696 */ 697 void 698 MarkupArc( 699 wxGraphicsContext *gc, 700 Wxd_object_t const *pObj, 701 int iMarkup, 702 Wxd_point_t const *pShift = NULL 703 ); 704 705 /** Mark up one circle object. 706 @param gc Graphics context. 707 @param pObj Object to draw. 708 @param iMarkup Markup to apply. 709 @param pShift Optional shift vector. 710 */ 711 void 712 MarkupCircle( 713 wxGraphicsContext *gc, 714 Wxd_object_t const *pObj, 715 int iMarkup, 716 Wxd_point_t const *pShift = NULL 717 ); 718 719 /** Mark up one ellipse object. 720 @param gc Graphics context. 721 @param pObj Object to draw. 722 @param iMarkup Markup to apply. 723 @param pShift Optional shift vector. 724 */ 725 void 726 MarkupEllipse( 727 wxGraphicsContext *gc, 728 Wxd_object_t const *pObj, 729 int iMarkup, 730 Wxd_point_t const *pShift = NULL 731 ); 732 733 /** Mark up one box object. 734 @param gc Graphics context. 735 @param pObj Object to draw. 736 @param iMarkup Markup to apply. 737 @param pShift Optional shift vector. 738 */ 739 void 740 MarkupBoundingBox( 741 wxGraphicsContext *gc, 742 Wxd_object_t const *pObj, 743 Wxd_bb_t const *pbb, 744 int iMarkup, 745 Wxd_point_t const *pShift = NULL 746 ); 747 748 /** Mark up one box object. 749 @param gc Graphics context. 750 @param pObj Object to draw. 751 @param iMarkup Markup to apply. 752 @param pShift Optional shift vector. 753 */ 754 void 755 MarkupBox( 756 wxGraphicsContext *gc, 757 Wxd_object_t const *pObj, 758 int iMarkup, 759 Wxd_point_t const *pShift = NULL 760 ); 761 762 /** Draw one open path graphics object to graphics context. 763 @param gc Graphics context. 764 @param pObj Object to draw. 765 @param iMarkup Markup to apply. 766 @param pShift Optional shift vector. 767 */ 768 void 769 DrawOpenPathElement( 770 wxGraphicsContext *gc, 771 Wxd_object_t const *pObj, 772 int iMarkup, 773 Wxd_point_t const *pShift = NULL 774 ); 775 776 /** Draw one closed path graphics object to graphics context. 777 @param gc Graphics context. 778 @param pObj Object to draw. 779 @param iMarkup Markup to apply. 780 @param pShift Optional shift vector. 781 */ 782 void 783 DrawClosedPathElement( 784 wxGraphicsContext *gc, 785 Wxd_object_t const *pObj, 786 int iMarkup, 787 Wxd_point_t const *pShift = NULL 788 ); 789 790 /** Draw one image creation region to graphics context. 791 @param gc Graphics context. 792 */ 793 void 794 DrawImageRegion( 795 wxGraphicsContext *gc 796 ); 797 798 /** Draw one image object to graphics context. 799 @param gc Graphics context. 800 @param pObj Object to draw. 801 @param iMarkup Markup to apply. 802 @param pShift Optional shift vector. 803 */ 804 void 805 DrawImageElement( 806 wxGraphicsContext *gc, 807 Wxd_object_t const *pObj, 808 int iMarkup, 809 Wxd_point_t const *pShift = NULL 810 ); 811 812 /** Draw one dot object to graphics context. 813 @param gc Graphics context. 814 @param pObj Object to draw. 815 @param iMarkup Markup to apply. 816 @param pShift Optional shift vector. 817 */ 818 void 819 DrawDotElement( 820 wxGraphicsContext *gc, 821 Wxd_object_t const *pObj, 822 int iMarkup, 823 Wxd_point_t const *pShift = NULL 824 ); 825 826 /** Set up pen attributes for object. 827 @param pen Pen to modify. 828 @param pObj Object to draw. 829 @param pDash Address of dash lengths array. 830 @param pNdash Address of variable for number of elements. 831 */ 832 void 833 SetupPenForObject( 834 wxPen & pen, 835 Wxd_object_t const *pObj, 836 wxDash *pDash, 837 int *pNdash 838 ); 839 840 /** Calculate point radius for markup point. 841 @param lw Line width of object to markup, may be 0. 842 @return Markup radius to use. 843 */ 844 double 845 MarkupPointRadius(uint16_t lw); 846 847 /** Draw a markup point. 848 @param gc Grahics context to draw to. 849 @param sc Stroke colour. 850 @param x X position of point. 851 @param y Y position of point. 852 @param lw Line width of object markup point belongs to. 853 @param pShift Shift vector, may be NULL. 854 */ 855 void 856 DrawMarkupPoint( 857 wxGraphicsContext *gc, 858 int const *sc, 859 double x, 860 double y, 861 uint16_t lw, 862 Wxd_point_t const *pShift = NULL 863 ); 864 865 /** Draw a markup point. 866 @param gc Grahics context to draw to. 867 @param sc Stroke colour. 868 @param x X position of point. 869 @param y Y position of point. 870 @param lw Line width of object markup point belongs to. 871 @param pShift Shift vector, may be NULL. 872 */ 873 void 874 DrawMarkupPoint( 875 wxGraphicsContext *gc, 876 int const *sc, 877 int32_t x, 878 int32_t y, 879 uint16_t lw, 880 Wxd_point_t const *pShift = NULL 881 ); 882 883 /** Calculate vertices for arrowhead. 884 @param pt Address of result array. 885 @param pDrw Drawing. 886 @param pObj Object to add arrowheads to. 887 @param xpos X position of arrow end. 888 @param ypos Y position of arrow end. 889 @param rot Arrow rotation. 890 @param atype Arrow type. 891 @param alength Arrow length. 892 @param awidth Arrow width. 893 */ 894 void 895 ArrowVertices( 896 dk4_gra_point_t *pt, 897 Wxd_drawing_t const *pDrw, 898 Wxd_object_t const *pObj, 899 double xpos, 900 double ypos, 901 double rot, 902 uint8_t atype, 903 uint8_t alength, 904 uint8_t awidth 905 ); 906 907 /** Draw one arrowhead. 908 @param gc Grahpics context to use for drawing. 909 @param pDrw Drawing. 910 @param pObj Object to add arrowhead to. 911 @param sc Stroke colour. 912 @param xpos X position of arrowhead end. 913 @param ypos Y position of arrowhead end. 914 @param rot Arrowhead rotation. 915 @param atype Arrowhead type. 916 @param alength Arrowhead length. 917 @param awidth Arrowhead width. 918 */ 919 void 920 DrawOneArrowhead( 921 wxGraphicsContext *gc, 922 Wxd_drawing_t const *pDrw, 923 Wxd_object_t const *pObj, 924 int const *sc, 925 double xpos, 926 double ypos, 927 double rot, 928 uint8_t atype, 929 uint8_t alength, 930 uint8_t awidth 931 ); 932 933 /** Add arrowheads to object. 934 @param gc Graphics context to use for drawing. 935 @param pDrw Drawing. 936 @param pObj Object to add arrows to. 937 @param sc Stroke colour. 938 @param pShift Shift vector. 939 */ 940 void 941 AddArrowheads( 942 wxGraphicsContext *gc, 943 Wxd_drawing_t const *pDrw, 944 Wxd_object_t const *pObj, 945 int const *sc, 946 Wxd_point_t const *pShift = NULL 947 ); 948 949 /** Calculate line width in pixels for object. 950 @param pDrw Drawing. 951 @param pObj Object. 952 @return Line width to use on screen. 953 */ 954 int 955 LineWidthForObject( 956 Wxd_drawing_t const *pDrw, 957 Wxd_object_t const *pObj, 958 int iMarkup = WXD_MARKUP_NONE 959 ); 960 961 /** Highlight the point to move. 962 @param gc Graphics context to draw to. 963 @param pobj Object to highlight. 964 @param pno Point number. 965 */ 966 void 967 HighlightPointToMove( 968 wxGraphicsContext *gc, 969 Wxd_object_t const *pobj, 970 uint16_t pno 971 ); 972 973 /** Highlight the point to delete. 974 @param gc Graphics context to draw to. 975 @param pobj Object to highlight. 976 @param pno Point number. 977 */ 978 void 979 HighlightPointToDelete( 980 wxGraphicsContext *gc, 981 Wxd_object_t const *pobj, 982 uint16_t pno 983 ); 984 985 /** Highlight the point to delete. 986 @param gc Graphics context to draw to. 987 @param pobj Object to highlight. 988 @param pno Point number. 989 @param bAppend New point must be appended after pno. 990 */ 991 void 992 HighlightPointToAdd( 993 wxGraphicsContext *gc, 994 Wxd_object_t const *pobj, 995 uint16_t pno, 996 bool bAppend 997 ); 998 999 /** Highlight one point of the element for style changes. 1000 @param gc Graphics context to use. 1001 @param x X position (in WXD coordinates). 1002 @param y Y position (in WXD coordinates). 1003 @param r Radius (half square length). 1004 @param sc Colour components. 1005 */ 1006 void 1007 HighlightStylePoint( 1008 wxGraphicsContext *gc, 1009 double x, 1010 double y, 1011 double r, 1012 int const *sc 1013 ); 1014 1015 /** Highlight one point of the element for style changes. 1016 @param gc Graphics context to use. 1017 @param x X position (in WXD coordinates). 1018 @param y Y position (in WXD coordinates). 1019 @param r Radius (half square length). 1020 @param sc Colour components. 1021 */ 1022 void 1023 HighlightStylePoint( 1024 wxGraphicsContext *gc, 1025 int32_t x, 1026 int32_t y, 1027 double r, 1028 int const *sc 1029 ); 1030 1031 /** Highlight the element for style changes. 1032 @param gc Graphics context to use. 1033 @param pobj Object to highlight. 1034 */ 1035 void 1036 HighlightStyleElement( 1037 wxGraphicsContext *gc, 1038 Wxd_object_t const *pobj 1039 ); 1040 1041 /** Retrieve point coordinates from a bounding box. 1042 @param x Result variable for x coordinate. 1043 @param y Result variable for y coordinate. 1044 @param pbb Bounding box (box or image). 1045 @param pno Point number. 1046 */ 1047 void 1048 GetPointFromBox( 1049 double & x, 1050 double & y, 1051 Wxd_bb_t const *pbb, 1052 uint16_t pno 1053 ); 1054 1055 /** Highlight the point to move. 1056 @param gc Graphics context to draw to. 1057 @param pobj Object to highlight. 1058 @param pno Point number. 1059 @param ci Color index for highlighting. 1060 */ 1061 void 1062 HighlightPointForOperation( 1063 wxGraphicsContext *gc, 1064 Wxd_object_t const *pobj, 1065 uint16_t pno, 1066 int ci 1067 ); 1068 1069 /** Highlight line from mouse position to control point. 1070 @param gc Graphics context to draw to. 1071 @param pobj Object to highlight. 1072 @param pno Point number. 1073 @param ci Color index for highlighting. 1074 */ 1075 void 1076 HighlightLineToPoint( 1077 wxGraphicsContext *gc, 1078 Wxd_object_t const *pobj, 1079 uint16_t pno, 1080 int ci 1081 ); 1082 1083 }; 1084 1085 /* ----- End of control class ----- */ 1086 1087 /** The control has full access to all members of the frame class. 1088 */ 1089 friend class Control; 1090 1091 public: 1092 1093 /** IDs for menu items, buttons and other elements. 1094 */ 1095 enum { 1096 ID_FRAME = ((wxID_HIGHEST) + 1) , /**< Main window. */ 1097 ID_HELP_ABOUT , /**< Show version dialog box. */ 1098 ID_HELP_CONTENTS , /**< Open online help table of contents. */ 1099 ID_ADD_POLYINE , /**< Add polyline. */ 1100 ID_ADD_POLYGON , /**< Add polygon. */ 1101 ID_ADD_RECT , /**< Add rectangle. */ 1102 ID_ADD_BOX , /**< Add box (rounded corner rectangle). */ 1103 ID_ADD_CIRCLE , /**< Add circle. */ 1104 ID_ADD_ELLIPSE , /**< Add ellipse. */ 1105 ID_ADD_ARC_O , /**< Add open arc. */ 1106 ID_ADD_ARC_C , /**< Add closed arc. */ 1107 ID_ADD_SPL_AO , /**< Add open approximated spline. */ 1108 ID_ADD_SPL_AC , /**< Add closed approximated spline. */ 1109 ID_ADD_SPL_IO , /**< Add open interpolated spline. */ 1110 ID_ADD_SPL_IC , /**< Add closed interpolated spline. */ 1111 ID_ADD_DOT_C , /**< Add colour filled dot. */ 1112 ID_ADD_DOT_W , /**< Add white filled dot. */ 1113 ID_ADD_TEXT , /**< Add text label. */ 1114 ID_ADD_IMG , /**< Add image. */ 1115 ID_ADD_LIBELEM , /**< Add library element. */ 1116 ID_EDIT_COPY , /**< Copy object. */ 1117 ID_EDIT_MOVE , /**< Move object. */ 1118 ID_EDIT_DEL , /**< Delete object. */ 1119 ID_EDIT_PT_MOVE , /**< Move point. */ 1120 ID_EDIT_PT_ADD , /**< Add point. */ 1121 ID_EDIT_PT_DEL , /**< Delete point. */ 1122 ID_EDIT_DET , /**< Edit details. */ 1123 ID_EDIT_GRP1 , /**< Group objects (elements one by one). */ 1124 #if 0 1125 ID_EDIT_GRP12 , /**< Group objects (touching rectangle). */ 1126 #endif 1127 ID_EDIT_GRP13 , /**< Group objects (including rectangle). */ 1128 ID_EDIT_UNGRP , /**< Ungroup objects. */ 1129 ID_EDIT_FLIPH , /**< Flip ojects horizontally. */ 1130 ID_EDIT_FLIPV , /**< Flip objects vertically. */ 1131 ID_EDIT_ROTLEFT , /**< Rotate 90 degree to left. */ 1132 ID_EDIT_ROTRIGHT , /**< Rotate 90 degree to right. */ 1133 ID_EDIT_DRSZ , /**< Change drawing size interactively. */ 1134 ID_EDIT_SDRSZ , /**< Set drawing size to a paper size. */ 1135 ID_LAYERS_ALL , /**< Activate all layers. */ 1136 ID_LAYERS_MGR , /**< Run layer manager. */ 1137 ID_ZOOM_CENTER , /**< Center view. */ 1138 ID_GRID_ON_OFF , /**< Activate or deactivate grid. */ 1139 ID_GRID_UNIT , /**< Grid unit changed. */ 1140 ID_GRID_BASE , /**< Grid base changed. */ 1141 ID_PLACEMENT , /**< Placement help changed. */ 1142 #if 0 1143 ID_SELECT_OBJ, /**< Select object to change style .*/ 1144 #endif 1145 ID_STYLE_LAYER , /**< Layer spin control. */ 1146 ID_STYLE_LINE_COL , /**< Line colour button. */ 1147 ID_STYLE_LINE_WIDTH , /**< Line width spin control. */ 1148 ID_STYLE_LINE_STYLE , /**< Line style button. */ 1149 ID_STYLE_LINE_CAP , /**< Line cap button. */ 1150 ID_STYLE_LINE_JOIN , /**< Line joint button. */ 1151 ID_STYLE_ARROW_F , /**< Arrowhead forward button. */ 1152 ID_STYLE_ARROW_B , /**< Arrowhead backward button. */ 1153 ID_STYLE_FILL_COL , /**< Fill colour button. */ 1154 ID_STYLE_FILL_PATT , /**< Fill pattern button. */ 1155 ID_STYLE_TEXT_LATEX , /**< LaTeX special text checkbox. */ 1156 ID_STYLE_TEXT_ALIGN , /**< Text align button. */ 1157 ID_STYLE_TEXT_FONT , /**< Text font button. */ 1158 ID_STYLE_TEXT_SIZE , /**< Text size spin control. */ 1159 ID_SCROLL_H , /**< Horizontal scrollbar. */ 1160 ID_SCROLL_V , /**< Vertical scrollbar. */ 1161 ID_CB_POINT_MOVE_MODE , /**< Checkbox for point move mode. */ 1162 ID_SPIN_ROTATION , /**< Spin control for rotation. */ 1163 ID_EDIT_CONVERT_1 , /**< Convert to polygon. */ 1164 ID_EDIT_CONVERT_2 , /**< Convert to polyline. */ 1165 ID_EDIT_CONVERT_3 , /**< Convert to open interpolated spline. */ 1166 ID_EDIT_CONVERT_4 , /**< Convert to closed arc. */ 1167 ID_EDIT_CONVERT_5 , /**< Convert to open arc. */ 1168 ID_EDIT_CONVERT_6 , /**< Convert to closed approximated spl. */ 1169 ID_EDIT_CONVERT_7 , /**< Convert to open approximated spline. */ 1170 ID_EDIT_CONVERT_8 , /**< Convert to white filled dot. */ 1171 ID_EDIT_CONVERT_9 , /**< Convert to simple dot. */ 1172 ID_EDIT_CONVERT_A , /**< Convert to closed interpolated spl. */ 1173 ID_RESET_OPTIONS , /**< Reset options to default values. */ 1174 ID_COL_MOD_BORDER , /**< Modify border colour. */ 1175 ID_COL_RES_BORDER , /**< Reset border colour. */ 1176 ID_COL_MOD_BACKGROUND , /**< Modify background colour. */ 1177 ID_COL_RES_BACKGROUND , /**< Reset background colour. */ 1178 ID_COL_MOD_GRID , /**< Modify grid colour. */ 1179 ID_COL_RES_GRID , /**< Reset grid colour. */ 1180 ID_COL_MOD_PH , /**< Modify placement help colour. */ 1181 ID_COL_RES_PH , /**< Reset placement help colour. */ 1182 ID_COL_MOD_COPY , /**< Modify copy operation colour. */ 1183 ID_COL_RES_COPY , /**< Reset copy operation colour. */ 1184 ID_COL_MOD_MOVE , /**< Modify move operation colour. */ 1185 ID_COL_RES_MOVE , /**< Reset move operation colour. */ 1186 ID_COL_MOD_DELETE , /**< Modify delete operation colour. */ 1187 ID_COL_RES_DELETE , /**< Reset delete operation colour. */ 1188 ID_COL_MOD_GROUP , /**< Modify group candidates colour. */ 1189 ID_COL_RES_GROUP , /**< Reset group candidates colour. */ 1190 ID_COL_MOD_MISSING , /**< Modify missing image colour. */ 1191 ID_COL_RES_MISSING , /**< Reset missing image colour. */ 1192 ID_MOD_SPLINE , /**< Modify spline s value. */ 1193 ID_OPT_NEW_OBJECTS , /**< Options for new objects. */ 1194 ID_OPT_SCREEN , /**< Options for screen representation. */ 1195 }; 1196 1197 /** Zoom level range. 1198 */ 1199 enum { 1200 ZOOM_LEVEL_MIN = -14 , /**< Minimum zoom level. */ 1201 ZOOM_LEVEL_MAX = 14 /**< Maximum zoom level. */ 1202 }; 1203 1204 /* IMPORTANT: Number and order of entries (except IVI_MAX) must match 1205 the number and order of entries in the default_values and 1206 iv_keys arrays in the WxdkdrawFrameTools module! 1207 */ 1208 /** Names for indices into the m_iv array. 1209 */ 1210 enum { 1211 IVI_BORDER_RED = 0 , /**< Border colour red component. */ 1212 IVI_BORDER_GREEN , /**< Border colour green component. */ 1213 IVI_BORDER_BLUE , /**< Border colour blue component. */ 1214 IVI_BG_RED , /**< Background colour red. */ 1215 IVI_BG_GREEN , /**< Background colour green. */ 1216 IVI_BG_BLUE , /**< Background colour blue. */ 1217 IVI_GRID_RED , /**< Grid colour red. */ 1218 IVI_GRID_GREEN , /**< Grid colour green. */ 1219 IVI_GRID_BLUE , /**< Grid colour blue. */ 1220 IVI_PH_RED , /**< Placement help colour red. */ 1221 IVI_PH_GREEN , /**< Placement help colour green. */ 1222 IVI_PH_BLUE , /**< Placement help colour blue. */ 1223 IVI_M_COPY_RED , /**< Copy markup colour red. */ 1224 IVI_M_COPY_GREEN , /**< Copy markup colour green. */ 1225 IVI_M_COPY_BLUE , /**< Copy markup colour blue. */ 1226 IVI_M_MOVE_RED , /**< Move markup colour red. */ 1227 IVI_M_MOVE_GREEN , /**< Move markup colour green. */ 1228 IVI_M_MOVE_BLUE , /**< Move markup colour blue. */ 1229 IVI_M_DEL_RED , /**< Delete markup colour red. */ 1230 IVI_M_DEL_GREEN , /**< Delete markup colour green. */ 1231 IVI_M_DEL_BLUE , /**< Delete markup colour blue. */ 1232 IVI_M_GROUP_RED , /**< Group markup colour red. */ 1233 IVI_M_GROUP_GREEN , /**< Group markup colour green. */ 1234 IVI_M_GROUP_BLUE , /**< Group markup colour blue. */ 1235 IVI_MISSIMG_RED , /**< Missing image border red. */ 1236 IVI_MISSIMG_GREEN , /**< Missing image border green. */ 1237 IVI_MISSIMG_BLUE , /**< Missing image border blue. */ 1238 IVI_XS_SUBSEGS , /**< X-spline sub segments. */ 1239 IVI_FONT_EXACT , /**< Flag: Use exact fonts. */ 1240 IVI_DOT_DIAMETER_FILLED , /**< Diameter filled dots. */ 1241 IVI_DOT_DIAMETER_WHITE , /**< Diameter white filled dots. */ 1242 IVI_ARROWHEAD_LENGTH , /**< Default arrowhead length. */ 1243 IVI_ARROWHEAD_WIDTH , /**< Default arrowhead width. */ 1244 IVI_STYLE_VALUE , /**< Default style value. */ 1245 IVI_MITER_LIMIT , /**< Miter limit. */ 1246 IVI_REDUCE_MARKUP_POINTS , /**< Reduce markup point radius. */ 1247 IVI_D_LAYER , /**< Default layer for new objects. */ 1248 IVI_D_LINE_COL_RED , /**< Default line colour red comp. */ 1249 IVI_D_LINE_COL_GREEN , /**< Default line colour green comp. */ 1250 IVI_D_LINE_COL_BLUE , /**< Default line colour blue comp. */ 1251 IVI_D_LINEWIDTH , /**< Default line width. */ 1252 IVI_D_LINESTYLE , /**< Default line style. */ 1253 IVI_D_STYLE_VALUE , /**< Default style value. */ 1254 IVI_D_JOIN_STYLE , /**< Default line join style. */ 1255 IVI_D_MITER_LIMIT , /**< Default miter limit. */ 1256 IVI_D_CAP_STYLE , /**< Default line cap style. */ 1257 IVI_D_AHF_TYPE , /**< Default arrowhead forward type. */ 1258 IVI_D_AHF_LENGTH , /**< Default arrowhead forward lgt. */ 1259 IVI_D_AHF_WIDTH , /**< Default arrowhead forward width. */ 1260 IVI_D_AHB_TYPE , /**< Default arrowhead backward type. */ 1261 IVI_D_AHB_LENGTH , /**< Default arrowhead backward lgt. */ 1262 IVI_D_AHB_WIDTH , /**< Default arrowhead backward wdth. */ 1263 IVI_D_FILL_COL_RED , /**< Default fill colour red comp. */ 1264 IVI_D_FILL_COL_GREEN , /**< Default fill colour green comp. */ 1265 IVI_D_FILL_COL_BLUE , /**< Default fill colour blue comp. */ 1266 IVI_D_FILL_STYLE , /**< Default fill style. */ 1267 IVI_D_TEXT_LATEX , /**< Default LaTeX option for text. */ 1268 IVI_D_TEXT_ALIGN , /**< Default text align. */ 1269 IVI_D_TEXT_FONT , /**< Default text font. */ 1270 IVI_D_TEXT_SIZE , /**< Default text size. */ 1271 IVI_C_GRID , /**< Enable or disable grid. */ 1272 IVI_C_PH , /**< Enable or disable place help. */ 1273 IVI_C_COR_POSITION , /**< Correct position after zoom out. */ 1274 IVI_MAX /**< Number of indices in the list. */ 1275 }; 1276 /* IMPORTANT: Number and order of entries (except IVI_MAX) must match 1277 the number and order of entries in the default_values and 1278 iv_keys arrays in the WxdkdrawFrameTools module! 1279 */ 1280 1281 private: 1282 1283 /* Frame private members */ 1284 1285 /** Event table for frame. 1286 */ 1287 #if wxCHECK_VERSION(3,0,0) 1288 wxDECLARE_EVENT_TABLE(); 1289 #else 1290 DECLARE_EVENT_TABLE() 1291 #endif 1292 1293 protected: 1294 1295 /* frame protected members */ 1296 1297 /** Drawing object containing default style information. 1298 */ 1299 Wxd_object_t m_oStyle; 1300 1301 /** Border object to show drawing size. 1302 */ 1303 Wxd_object_t m_oBorder; 1304 1305 /** Status structure to read WXD file. 1306 */ 1307 wxdrd_status_t m_oStatusReader; 1308 1309 /** Status structure to write WXD file. 1310 */ 1311 wxdwr_status_t m_oStatusWriter; 1312 1313 /** Integer values for different purposes, configurable. 1314 */ 1315 int m_iv[IVI_MAX]; 1316 1317 /** Coefficients used to create stipple bitmaps, 1318 recalculated on zoom level changes or file reload. 1319 0: Length equivalent for 3.6 / sqrt(3) 1320 1: Length equivalent for 7.2 1321 2: Length equivalent for 3.6 * sqrt(2) 1322 3: Length equivalent for 14.4 1323 4: Length equivalent for 3.6 1324 5: Length equivalent for 21.6 1325 6: Length equivalent for 14.54 (width of large fish scale) 1326 7: Length equivalent for 3.7 (height of large fish scale) 1327 8: Length equivalent for 14.4 * sqrt(3) 1328 9: X difference at start of large fish scale 1329 10: Y difference at start of large fish scale 1330 11: X difference at end of large fish scale 1331 12: Y difference at end of large fish scale 1332 13: X difference at start of small fish scale 1333 14: Y difference at start of small fish scale 1334 15: X difference at end of small fish scale 1335 16: Y difference at end of small fish scale 1336 17...19 unused 1337 */ 1338 double m_dPatterns[20]; 1339 1340 /** Constant factors calculated once in the constructor. 1341 0: sqrt(3) 1342 1: dx/dt at 0 factor for large fish scales 1343 2: dy/dt at 0 factor for large fish scales 1344 3: dx/dt at 1 factor for large fish scales 1345 4: dy/dt at 1 factor for large fish scales 1346 5: dx/dt at 0 factor for small fish scales 1347 6: dy/dt at 0 factor for small fish scales 1348 7: dx/dt at 1 factor for small fish scales 1349 8: dy/dt at 1 factor for small fish scales 1350 9...15 unused 1351 */ 1352 double m_dFactors[16]; 1353 1354 /** Error report used in event processing. 1355 */ 1356 dk4_er_t m_oErrorReport; 1357 1358 /** Protect m_bIsFirstIdle against multiple access. 1359 */ 1360 wxCriticalSection csIsFirstIdle; 1361 1362 /** Original ellipse/circle data before moving a point. 1363 */ 1364 Wxd_det_ellipse_t m_ellPointMoveOri; 1365 1366 /** Full path name. 1367 */ 1368 wxString m_sFileFull; 1369 1370 /** Short file name without leading directory. 1371 */ 1372 wxString m_sFileShort; 1373 1374 /** Directory file resides in. 1375 */ 1376 wxString m_sFileDir; 1377 1378 /** Directory previous embedded image was taken from. 1379 */ 1380 wxString m_sImageDir; 1381 1382 /** Directory previous library element was taken from. 1383 */ 1384 wxString m_sLibraryDir; 1385 1386 /** Short name of previous library element. 1387 */ 1388 wxString m_sLibraryShort; 1389 1390 /** Original drawing size. 1391 */ 1392 Wxd_bb_t m_oOldSize; 1393 1394 /** Raw mouse position (not aligned to grid). 1395 */ 1396 Wxd_point_t m_ptMousePosRaw; 1397 1398 /** Mouse position aligned to grid. 1399 */ 1400 Wxd_point_t m_ptMousePosGrid; 1401 1402 /** Start point of copy or move operation. 1403 */ 1404 Wxd_point_t m_ptMouseMoveStart; 1405 1406 /** Difference in copy or move operation, 1407 (m_ptMousePosGrid - m_ptMouseMoveStart). 1408 */ 1409 Wxd_point_t m_ptMouseMoveDiff; 1410 1411 /** Original position of the point currently moved. 1412 Required to compute differences or to restore 1413 position on abort. 1414 */ 1415 Wxd_point_t m_ptPointMoveOri; 1416 1417 /** Mouse position on control in pixels. 1418 */ 1419 wxSize m_szMousePosPix; 1420 1421 /** Object currently to edit with style elements. 1422 */ 1423 Wxd_object_t *m_pStyle; 1424 1425 /** Current object, used for several purposes: 1426 * S_NOOP: Selection candidate. 1427 * S_POLY_FURTHER: Polyline we are editing. 1428 */ 1429 Wxd_object_t *m_pCurrent; 1430 1431 /** Localized texts. 1432 */ 1433 wxChar const * const *sTexts; 1434 1435 /** Non-localized texts. 1436 */ 1437 wxChar const * const *sNlWx; 1438 1439 /** Non-localized texts. 1440 */ 1441 dkChar const * const *sNlDk; 1442 1443 /** Drawing opened in this frame. 1444 */ 1445 Wxd_drawing_t *m_pDrw; 1446 1447 /** Current operation state. 1448 */ 1449 int m_iState; 1450 1451 /** Accumulated wheel rotation with control key pressed. 1452 */ 1453 int m_iWheelControl; 1454 1455 /** Accumulated wheel rotation with shift key pressed. 1456 */ 1457 int m_iWheelShift; 1458 1459 /** Accumulated wheel rotation with not key pressed. 1460 */ 1461 int m_iWheelNormal; 1462 1463 /** Index of current point to edit. 1464 */ 1465 uint16_t m_uCurrent; 1466 1467 /** Object we are about to create or to convert to. 1468 */ 1469 int8_t m_iObjToCreate; 1470 1471 /** Flag for different purposes: 1472 * Spline just created is interpolated (otherwise approximated). 1473 * Box just created is a rounded box (otherwise rectangular). 1474 * Rotation in negative direction. 1475 */ 1476 bool m_bSplineInterpolated; 1477 1478 /** Flag: Current mouse position is an acceptable point. 1479 */ 1480 bool m_bAcceptablePoint; 1481 1482 /** Flag: Is first idle. 1483 */ 1484 bool m_bIsFirstIdle; 1485 1486 /** Flag: Windows is active an event handlers can be executed. 1487 This flag is set in the reaction on the first idle event 1488 and reset on closing the application. 1489 */ 1490 bool m_bActive; 1491 1492 /** Flag: Drawing was modified (there are unsaved changes). 1493 */ 1494 bool m_bModified; 1495 1496 /** Flag: File name known for output file. 1497 */ 1498 bool m_bHaveName; 1499 1500 /** Flag: Mouse position is known. 1501 */ 1502 bool m_bMousePos; 1503 1504 /** Flag: Successfully calculated difference for copy/shift operation. 1505 */ 1506 bool m_bMouseDiff; 1507 1508 /** Snap point to move to the mouse position (otherwise relative 1509 movement). 1510 */ 1511 bool m_bSnap; 1512 1513 /** Flag: Update frame at end of event handler. 1514 */ 1515 bool m_bUpdate; 1516 1517 /** Flag: Append new point after current point (true) 1518 or insert before current point (false). 1519 */ 1520 bool m_bAppendPoint; 1521 1522 /** Flag: Have corner point to move when changing drawing size. 1523 */ 1524 bool m_bHaveCornerPoint; 1525 1526 /** Flip vertically (true) or horizontally (false). 1527 */ 1528 bool m_bVerticalFlip; 1529 1530 /* __CHANGE__ 011: Add further member variables. 1531 */ 1532 1533 /** Flag: GUI ok. 1534 */ 1535 bool dkctGUILayoutOK; 1536 1537 /** Contents panel. 1538 */ 1539 wxPanel *dkctGUIContentsPanel; 1540 1541 /** GUI element mainSizer. 1542 */ 1543 wxBoxSizer *mainSizer; 1544 1545 /** GUI element mbMain. 1546 */ 1547 wxMenuBar *mbMain; 1548 1549 /** GUI element menuFile. 1550 */ 1551 wxMenu *menuFile; 1552 1553 /** GUI element menuAdd. 1554 */ 1555 wxMenu *menuAdd; 1556 1557 /** GUI element menuEdit. 1558 */ 1559 wxMenu *menuEdit; 1560 1561 /** GUI element menuView. 1562 */ 1563 wxMenu *menuView; 1564 1565 /** GUI element menuOptions. 1566 */ 1567 wxMenu *menuOptions; 1568 1569 /** GUI element menuHelp. 1570 */ 1571 wxMenu *menuHelp; 1572 1573 /** GUI element miFileNew. 1574 */ 1575 wxMenuItem *miFileNew; 1576 1577 /** GUI element miFileOpen. 1578 */ 1579 wxMenuItem *miFileOpen; 1580 1581 /** GUI element miFileSave. 1582 */ 1583 wxMenuItem *miFileSave; 1584 1585 /** GUI element miFileSaveAs. 1586 */ 1587 wxMenuItem *miFileSaveAs; 1588 1589 /** GUI element miFileExit. 1590 */ 1591 wxMenuItem *miFileExit; 1592 1593 /** GUI element miAddPolyline. 1594 */ 1595 wxMenuItem *miAddPolyline; 1596 1597 /** GUI element miAddPolygon. 1598 */ 1599 wxMenuItem *miAddPolygon; 1600 1601 /** GUI element miAddRectangle. 1602 */ 1603 wxMenuItem *miAddRectangle; 1604 1605 /** GUI element miAddRoundedBox. 1606 */ 1607 wxMenuItem *miAddRoundedBox; 1608 1609 /** GUI element miAddCircle. 1610 */ 1611 wxMenuItem *miAddCircle; 1612 1613 /** GUI element miAddEllipse. 1614 */ 1615 wxMenuItem *miAddEllipse; 1616 1617 /** GUI element miAddArcOpen. 1618 */ 1619 wxMenuItem *miAddArcOpen; 1620 1621 /** GUI element miAddArcClosed. 1622 */ 1623 wxMenuItem *miAddArcClosed; 1624 1625 /** GUI element miAddSplineAO. 1626 */ 1627 wxMenuItem *miAddSplineAO; 1628 1629 /** GUI element miAddSplineAC. 1630 */ 1631 wxMenuItem *miAddSplineAC; 1632 1633 /** GUI element miAddSplineIO. 1634 */ 1635 wxMenuItem *miAddSplineIO; 1636 1637 /** GUI element miAddSplineIC. 1638 */ 1639 wxMenuItem *miAddSplineIC; 1640 1641 /** GUI element miAddConnector. 1642 */ 1643 wxMenuItem *miAddConnector; 1644 1645 /** GUI element miAddPin. 1646 */ 1647 wxMenuItem *miAddPin; 1648 1649 /** GUI element miAddText. 1650 */ 1651 wxMenuItem *miAddText; 1652 1653 /** GUI element miAddImage. 1654 */ 1655 wxMenuItem *miAddImage; 1656 1657 /** GUI element miAddLibelem. 1658 */ 1659 wxMenuItem *miAddLibelem; 1660 1661 /** GUI element miEditCopy. 1662 */ 1663 wxMenuItem *miEditCopy; 1664 1665 /** GUI element miEditMove. 1666 */ 1667 wxMenuItem *miEditMove; 1668 1669 /** GUI element miEditDelete. 1670 */ 1671 wxMenuItem *miEditDelete; 1672 1673 /** GUI element miEditPointAdd. 1674 */ 1675 wxMenuItem *miEditPointAdd; 1676 1677 /** GUI element miEditPointRemove. 1678 */ 1679 wxMenuItem *miEditPointRemove; 1680 1681 /** GUI element miEditPointMove. 1682 */ 1683 wxMenuItem *miEditPointMove; 1684 1685 /** GUI element miEditModifySpline. 1686 */ 1687 wxMenuItem *miEditModifySpline; 1688 1689 /** GUI element miEditFlipH. 1690 */ 1691 wxMenuItem *miEditFlipH; 1692 1693 /** GUI element miEditFlipV. 1694 */ 1695 wxMenuItem *miEditFlipV; 1696 1697 /** GUI element miEditRotLeft. 1698 */ 1699 wxMenuItem *miEditRotLeft; 1700 1701 /** GUI element miEditRotRight. 1702 */ 1703 wxMenuItem *miEditRotRight; 1704 1705 /** GUI element miEditDetails. 1706 */ 1707 wxMenuItem *miEditDetails; 1708 1709 /** GUI element mEditGroup. 1710 */ 1711 wxMenu *mEditGroup; 1712 1713 /** GUI element miEditUngroup. 1714 */ 1715 wxMenuItem *miEditUngroup; 1716 1717 /** GUI element miEditChangeSize. 1718 */ 1719 wxMenuItem *miEditChangeSize; 1720 1721 /** GUI element miEditSetSize. 1722 */ 1723 wxMenuItem *miEditSetSize; 1724 1725 /** GUI element mEditConvert. 1726 */ 1727 wxMenu *mEditConvert; 1728 1729 /** GUI element miEditGroupElements. 1730 */ 1731 wxMenuItem *miEditGroupElements; 1732 1733 /** GUI element miEditGroupIncluding. 1734 */ 1735 wxMenuItem *miEditGroupIncluding; 1736 1737 /** GUI element miPolygonToPolyline. 1738 */ 1739 wxMenuItem *miPolygonToPolyline; 1740 1741 /** GUI element miPolylineToPolygon. 1742 */ 1743 wxMenuItem *miPolylineToPolygon; 1744 1745 /** GUI element miClosedToOpenArc. 1746 */ 1747 wxMenuItem *miClosedToOpenArc; 1748 1749 /** GUI element miOpenToClosedArc. 1750 */ 1751 wxMenuItem *miOpenToClosedArc; 1752 1753 /** GUI element miClosedToOpenSpline. 1754 */ 1755 wxMenuItem *miClosedToOpenSpline; 1756 1757 /** GUI element miOpenToClosedSpline. 1758 */ 1759 wxMenuItem *miOpenToClosedSpline; 1760 1761 /** GUI element miClosedToOpenIntSpline. 1762 */ 1763 wxMenuItem *miClosedToOpenIntSpline; 1764 1765 /** GUI element miOpenToClosedIntSpline. 1766 */ 1767 wxMenuItem *miOpenToClosedIntSpline; 1768 1769 /** GUI element miWhiteFilledToDot. 1770 */ 1771 wxMenuItem *miWhiteFilledToDot; 1772 1773 /** GUI element miDotToWhiteFilled. 1774 */ 1775 wxMenuItem *miDotToWhiteFilled; 1776 1777 /** GUI element menuZoom. 1778 */ 1779 wxMenu *menuZoom; 1780 1781 /** GUI element menuLayer. 1782 */ 1783 wxMenu *menuLayer; 1784 1785 /** GUI element miViewCenterView. 1786 */ 1787 wxMenuItem *miViewCenterView; 1788 1789 /** GUI element menuColours. 1790 */ 1791 wxMenu *menuColours; 1792 1793 /** GUI element miOptionsNewObjects. 1794 */ 1795 wxMenuItem *miOptionsNewObjects; 1796 1797 /** GUI element miOptionsScreen. 1798 */ 1799 wxMenuItem *miOptionsScreen; 1800 1801 /** GUI element miOptionsReset. 1802 */ 1803 wxMenuItem *miOptionsReset; 1804 1805 /** GUI element miZoomIn. 1806 */ 1807 wxMenuItem *miZoomIn; 1808 1809 /** GUI element miZoomOut. 1810 */ 1811 wxMenuItem *miZoomOut; 1812 1813 /** GUI element miZoomReset. 1814 */ 1815 wxMenuItem *miZoomReset; 1816 1817 /** GUI element miLayerActivateAll. 1818 */ 1819 wxMenuItem *miLayerActivateAll; 1820 1821 /** GUI element miLayerManager. 1822 */ 1823 wxMenuItem *miLayerManager; 1824 1825 /** GUI element menuColourBorder. 1826 */ 1827 wxMenu *menuColourBorder; 1828 1829 /** GUI element menuColourBackground. 1830 */ 1831 wxMenu *menuColourBackground; 1832 1833 /** GUI element menuColourGrid. 1834 */ 1835 wxMenu *menuColourGrid; 1836 1837 /** GUI element menuColourPlacement. 1838 */ 1839 wxMenu *menuColourPlacement; 1840 1841 /** GUI element menuColourCopy. 1842 */ 1843 wxMenu *menuColourCopy; 1844 1845 /** GUI element menuColourMove. 1846 */ 1847 wxMenu *menuColourMove; 1848 1849 /** GUI element menuColourDelete. 1850 */ 1851 wxMenu *menuColourDelete; 1852 1853 /** GUI element menuColourGroup. 1854 */ 1855 wxMenu *menuColourGroup; 1856 1857 /** GUI element menuColourMissing. 1858 */ 1859 wxMenu *menuColourMissing; 1860 1861 /** GUI element miColourBorderModify. 1862 */ 1863 wxMenuItem *miColourBorderModify; 1864 1865 /** GUI element miColourBorderReset. 1866 */ 1867 wxMenuItem *miColourBorderReset; 1868 1869 /** GUI element miColourBackgroundModify. 1870 */ 1871 wxMenuItem *miColourBackgroundModify; 1872 1873 /** GUI element miColourBackgroundReset. 1874 */ 1875 wxMenuItem *miColourBackgroundReset; 1876 1877 /** GUI element miColourGridModify. 1878 */ 1879 wxMenuItem *miColourGridModify; 1880 1881 /** GUI element miColourGridReset. 1882 */ 1883 wxMenuItem *miColourGridReset; 1884 1885 /** GUI element miColourPlacementModify. 1886 */ 1887 wxMenuItem *miColourPlacementModify; 1888 1889 /** GUI element miColourPlacementReset. 1890 */ 1891 wxMenuItem *miColourPlacementReset; 1892 1893 /** GUI element miColourCopyModify. 1894 */ 1895 wxMenuItem *miColourCopyModify; 1896 1897 /** GUI element miColourCopyReset. 1898 */ 1899 wxMenuItem *miColourCopyReset; 1900 1901 /** GUI element miColourMoveModify. 1902 */ 1903 wxMenuItem *miColourMoveModify; 1904 1905 /** GUI element miColourMoveReset. 1906 */ 1907 wxMenuItem *miColourMoveReset; 1908 1909 /** GUI element miColourDeleteModify. 1910 */ 1911 wxMenuItem *miColourDeleteModify; 1912 1913 /** GUI element miColourDeleteReset. 1914 */ 1915 wxMenuItem *miColourDeleteReset; 1916 1917 /** GUI element miColourGroupModify. 1918 */ 1919 wxMenuItem *miColourGroupModify; 1920 1921 /** GUI element miColourGroupReset. 1922 */ 1923 wxMenuItem *miColourGroupReset; 1924 1925 /** GUI element miColourMissingModify. 1926 */ 1927 wxMenuItem *miColourMissingModify; 1928 1929 /** GUI element miColourMissingReset. 1930 */ 1931 wxMenuItem *miColourMissingReset; 1932 1933 /** GUI element miHelpAbout. 1934 */ 1935 wxMenuItem *miHelpAbout; 1936 1937 /** GUI element miHelpContents. 1938 */ 1939 wxMenuItem *miHelpContents; 1940 1941 /** GUI element verticalSizer. 1942 */ 1943 wxBoxSizer *verticalSizer; 1944 1945 /** GUI element szTopBar. 1946 */ 1947 wxBoxSizer *szTopBar; 1948 1949 /** GUI element szMiddleBar. 1950 */ 1951 wxBoxSizer *szMiddleBar; 1952 1953 /** GUI element szBottomBar. 1954 */ 1955 wxGridBagSizer *szBottomBar; 1956 1957 /** GUI element szHintsBar. 1958 */ 1959 wxBoxSizer *szHintsBar; 1960 1961 /** GUI element bFileOpen. 1962 */ 1963 wxBitmapButton *bFileOpen; 1964 1965 /** GUI element bFileSave. 1966 */ 1967 wxBitmapButton *bFileSave; 1968 1969 /** GUI element lZoomPercent. 1970 */ 1971 wxStaticText *lZoomPercent; 1972 1973 /** GUI element bZoomIn. 1974 */ 1975 wxBitmapButton *bZoomIn; 1976 1977 /** GUI element bZoomOut. 1978 */ 1979 wxBitmapButton *bZoomOut; 1980 1981 /** GUI element bZoomOne. 1982 */ 1983 wxBitmapButton *bZoomOne; 1984 1985 /** GUI element cbGridOnOff. 1986 */ 1987 wxCheckBox *cbGridOnOff; 1988 1989 /** GUI element cbGridUnit. 1990 */ 1991 wxChoice *cbGridUnit; 1992 1993 /** GUI element cbGridBase. 1994 */ 1995 wxChoice *cbGridBase; 1996 1997 /** GUI element cbPH. 1998 */ 1999 wxCheckBox *cbPH; 2000 2001 /** GUI element szLeftBar. 2002 */ 2003 wxGridBagSizer *szLeftBar; 2004 2005 /** GUI element szOperationsAndDraw. 2006 */ 2007 wxBoxSizer *szOperationsAndDraw; 2008 2009 /** GUI element bPolyline. 2010 */ 2011 wxBitmapButton *bPolyline; 2012 2013 /** GUI element bPolygon. 2014 */ 2015 wxBitmapButton *bPolygon; 2016 2017 /** GUI element bRect. 2018 */ 2019 wxBitmapButton *bRect; 2020 2021 /** GUI element bBox. 2022 */ 2023 wxBitmapButton *bBox; 2024 2025 /** GUI element bCircle. 2026 */ 2027 wxBitmapButton *bCircle; 2028 2029 /** GUI element bEllipse. 2030 */ 2031 wxBitmapButton *bEllipse; 2032 2033 /** GUI element bArcOpen. 2034 */ 2035 wxBitmapButton *bArcOpen; 2036 2037 /** GUI element bArcClosed. 2038 */ 2039 wxBitmapButton *bArcClosed; 2040 2041 /** GUI element bSplineAO. 2042 */ 2043 wxBitmapButton *bSplineAO; 2044 2045 /** GUI element bSplineAC. 2046 */ 2047 wxBitmapButton *bSplineAC; 2048 2049 /** GUI element bSplineIO. 2050 */ 2051 wxBitmapButton *bSplineIO; 2052 2053 /** GUI element bSplineIC. 2054 */ 2055 wxBitmapButton *bSplineIC; 2056 2057 /** GUI element bConnector. 2058 */ 2059 wxBitmapButton *bConnector; 2060 2061 /** GUI element bPin. 2062 */ 2063 wxBitmapButton *bPin; 2064 2065 /** GUI element bText. 2066 */ 2067 wxBitmapButton *bText; 2068 2069 /** GUI element bImage. 2070 */ 2071 wxBitmapButton *bImage; 2072 2073 /** GUI element bLibelem. 2074 */ 2075 wxBitmapButton *bLibelem; 2076 2077 /** GUI element szOperationButtons. 2078 */ 2079 wxBoxSizer *szOperationButtons; 2080 2081 /** GUI element szDrawco. 2082 */ 2083 wxGridBagSizer *szDrawco; 2084 2085 /** GUI element lLayer. 2086 */ 2087 wxStaticText *lLayer; 2088 2089 /** GUI element spLayerNumber. 2090 */ 2091 wxSpinCtrl *spLayerNumber; 2092 2093 /** GUI element lLine. 2094 */ 2095 wxStaticText *lLine; 2096 2097 /** GUI element szLine. 2098 */ 2099 wxBoxSizer *szLine; 2100 2101 /** GUI element lFill. 2102 */ 2103 wxStaticText *lFill; 2104 2105 /** GUI element szFill. 2106 */ 2107 wxBoxSizer *szFill; 2108 2109 /** GUI element lText. 2110 */ 2111 wxStaticText *lText; 2112 2113 /** GUI element szText. 2114 */ 2115 wxBoxSizer *szText; 2116 2117 /** GUI element ccLineColour. 2118 */ 2119 Dk4WxColourView *ccLineColour; 2120 2121 /** GUI element spLineWidth. 2122 */ 2123 wxSpinCtrl *spLineWidth; 2124 2125 /** GUI element bStyleLineStyle. 2126 */ 2127 wxBitmapButton *bStyleLineStyle; 2128 2129 /** GUI element bStyleLineJoins. 2130 */ 2131 wxBitmapButton *bStyleLineJoins; 2132 2133 /** GUI element bStyleLineEnds. 2134 */ 2135 wxBitmapButton *bStyleLineEnds; 2136 2137 /** GUI element bStyleArrowForward. 2138 */ 2139 wxBitmapButton *bStyleArrowForward; 2140 2141 /** GUI element bStyleArrowBackward. 2142 */ 2143 wxBitmapButton *bStyleArrowBackward; 2144 2145 /** GUI element ccFillColour. 2146 */ 2147 Dk4WxColourView *ccFillColour; 2148 2149 /** GUI element bStyleFillPattern. 2150 */ 2151 wxBitmapButton *bStyleFillPattern; 2152 2153 /** GUI element cbStyleTextLaTeX. 2154 */ 2155 wxCheckBox *cbStyleTextLaTeX; 2156 2157 /** GUI element bStyleTextAlign. 2158 */ 2159 wxBitmapButton *bStyleTextAlign; 2160 2161 /** GUI element bStyleFontName. 2162 */ 2163 wxBitmapButton *bStyleFontName; 2164 2165 /** GUI element spFontSize. 2166 */ 2167 wxSpinCtrl *spFontSize; 2168 2169 /** GUI element lRotation. 2170 */ 2171 wxStaticText *lRotation; 2172 2173 /** GUI element spRotation. 2174 */ 2175 wxSpinCtrl *spRotation; 2176 2177 /** GUI element tlMouseL. 2178 */ 2179 wxStaticText *tlMouseL; 2180 2181 /** GUI element msgMouseL. 2182 */ 2183 wxStaticText *msgMouseL; 2184 2185 /** GUI element tlMouseM. 2186 */ 2187 wxStaticText *tlMouseM; 2188 2189 /** GUI element msgMouseM. 2190 */ 2191 wxStaticText *msgMouseM; 2192 2193 /** GUI element tlMouseR. 2194 */ 2195 wxStaticText *tlMouseR; 2196 2197 /** GUI element msgMouseR. 2198 */ 2199 wxStaticText *msgMouseR; 2200 2201 /** GUI element tlPosX. 2202 */ 2203 wxStaticText *tlPosX; 2204 2205 /** GUI element msgPosX. 2206 */ 2207 wxStaticText *msgPosX; 2208 2209 /** GUI element tlPosY. 2210 */ 2211 wxStaticText *tlPosY; 2212 2213 /** GUI element msgPosY. 2214 */ 2215 wxStaticText *msgPosY; 2216 2217 /** GUI element bEditCopy. 2218 */ 2219 wxBitmapButton *bEditCopy; 2220 2221 /** GUI element bEditMove. 2222 */ 2223 wxBitmapButton *bEditMove; 2224 2225 /** GUI element bEditDelete. 2226 */ 2227 wxBitmapButton *bEditDelete; 2228 2229 /** GUI element bEditPointAdd. 2230 */ 2231 wxBitmapButton *bEditPointAdd; 2232 2233 /** GUI element bEditPointDelete. 2234 */ 2235 wxBitmapButton *bEditPointDelete; 2236 2237 /** GUI element bEditPointMove. 2238 */ 2239 wxBitmapButton *bEditPointMove; 2240 2241 /** GUI element cbPointMoveMode. 2242 */ 2243 wxChoice *cbPointMoveMode; 2244 2245 /** GUI element bModifySplineValue. 2246 */ 2247 wxBitmapButton *bModifySplineValue; 2248 2249 /** GUI element bEditFlipH. 2250 */ 2251 wxBitmapButton *bEditFlipH; 2252 2253 /** GUI element bEditFlipV. 2254 */ 2255 wxBitmapButton *bEditFlipV; 2256 2257 /** GUI element bEditRotLeft. 2258 */ 2259 wxBitmapButton *bEditRotLeft; 2260 2261 /** GUI element bEditRotRight. 2262 */ 2263 wxBitmapButton *bEditRotRight; 2264 2265 /** GUI element bEditDetails. 2266 */ 2267 wxBitmapButton *bEditDetails; 2268 2269 /** GUI element bEditGroup. 2270 */ 2271 wxBitmapButton *bEditGroup; 2272 2273 /** GUI element bEditGroup3. 2274 */ 2275 wxBitmapButton *bEditGroup3; 2276 2277 /** GUI element bEditUngroup. 2278 */ 2279 wxBitmapButton *bEditUngroup; 2280 2281 /** GUI element bEditChangeSize. 2282 */ 2283 wxBitmapButton *bEditChangeSize; 2284 2285 /** GUI element drawco. 2286 */ 2287 Control *drawco; 2288 2289 /** GUI element sbVert. 2290 */ 2291 wxScrollBar *sbVert; 2292 2293 /** GUI element sbHori. 2294 */ 2295 wxScrollBar *sbHori; 2296 2297 2298 public: 2299 2300 /* frame public members */ 2301 2302 /** Names for bitmaps to visualize line styles. 2303 */ 2304 static const char ** const ms_ls_images[]; 2305 2306 /** Names for bitmaps to visualize line cap styles. 2307 */ 2308 static const char ** const ms_lc_images[]; 2309 2310 /** Names for bitmaps to visualize line join styles. 2311 */ 2312 static const char ** const ms_lj_images[]; 2313 2314 /** Names for bitmaps to visualize arrow types. 2315 */ 2316 static const char ** const ms_arrow_images[]; 2317 2318 /** Names for bitmaps to visualize fill patterns. 2319 */ 2320 static const char ** const ms_fs_images[]; 2321 2322 /** Names for bitmaps to visualize text alignments. 2323 */ 2324 static const char ** const ms_ta_images[]; 2325 2326 /** Names for bitmaps to visualize fonts. 2327 */ 2328 static const char ** const ms_fn_images[]; 2329 2330 /** Constructor. 2331 @param wxid Window ID. 2332 @param applicationHelper Application helper object. 2333 @param hc Help controller for online help. 2334 @param argc Number of command line arguments. 2335 @param argv Command line arguments array. 2336 @param localizedTexts Localized wxChar texts. 2337 @param nlWx Non-localized wxChar texts. 2338 @param nlDk Non-localized dkChar texts. 2339 */ 2340 WxdkdrawFrame( 2341 int wxid, 2342 Dk4WxApplicationHelper *applicationHelper, 2343 Dk4WxHelpController *hc, 2344 int argc, 2345 wxChar **argv, 2346 wxChar const * const *localizedTexts, 2347 wxChar const * const *nlWx, 2348 dkChar const * const *nlDk 2349 ); 2350 2351 /** Destructor. 2352 */ 2353 ~WxdkdrawFrame(); 2354 2355 /** Check whether we can close the window. 2356 @param isLast Flag: Last main window to close. 2357 */ 2358 bool 2359 CanClose(bool isFinal); 2360 2361 /** Handler for File/Exit. 2362 @param event Event to process. 2363 */ 2364 void 2365 OnQuit(wxCommandEvent & event); 2366 2367 /** Handler for Help/About. 2368 @param event Event to process. 2369 */ 2370 void 2371 OnAbout(wxCommandEvent & event); 2372 2373 /** Handler for Help/Contents. 2374 @param event Event to process. 2375 */ 2376 void 2377 OnHelpContents(wxCommandEvent & event); 2378 2379 /** Handler for idle events. 2380 @param event Event to process. 2381 */ 2382 void 2383 OnIdle(wxIdleEvent & event); 2384 2385 /** Handler File / New. 2386 @param event Event to process. 2387 */ 2388 void 2389 OnFileNew(wxCommandEvent & event); 2390 2391 /** Handler File / Open. 2392 @param event Event to process. 2393 */ 2394 void 2395 OnFileOpen(wxCommandEvent & event); 2396 2397 /** Save drawing to file. 2398 @return True on success, false on error. 2399 */ 2400 bool 2401 SaveToFile(void); 2402 2403 /** Mark the drawing as modified or not modified. 2404 @param f New flag value. 2405 */ 2406 void 2407 SetModified(bool f = true); 2408 2409 /** Handler File / Save. 2410 @param event Event to process. 2411 */ 2412 void 2413 OnFileSave(wxCommandEvent & event); 2414 2415 /** Handler File / Save as. 2416 @param event Event to process. 2417 */ 2418 void 2419 OnFileSaveAs(wxCommandEvent & event); 2420 2421 /** On zoom out correct the center point if necessary. 2422 */ 2423 void 2424 CorrectCenterPointIfNecessary(void); 2425 2426 /** Zoom level was changed. 2427 @param bZoomOut Zoom change was "zoom out". 2428 */ 2429 void 2430 ZoomChanged(bool bZoomOut = false); 2431 2432 /** Adjust scrollbars after zoom or position change. 2433 */ 2434 void 2435 AdjustScrollbars(void); 2436 2437 /** Handler Zoom / In. 2438 @param event Event to process. 2439 */ 2440 void 2441 OnZoomIn(wxCommandEvent & event); 2442 2443 /** Handler Zoom / Out. 2444 @param event Event to process. 2445 */ 2446 void 2447 OnZoomOut(wxCommandEvent & event); 2448 2449 /** Handler Zoom / Reset. 2450 @param event Event to process. 2451 */ 2452 void 2453 OnZoom100(wxCommandEvent & event); 2454 2455 /** Start polygon or polyline. 2456 @param ot Object type to start, WXD_OT_POLYLINE or WXD_OT_POLYGON. 2457 */ 2458 void 2459 OnPolygonPolyline(int8_t ot); 2460 2461 /** Handler for Add polyline. 2462 @param event Event to process. 2463 */ 2464 void 2465 OnAddPolyline(wxCommandEvent & event); 2466 2467 2468 /** Handler for Add polygon. 2469 @param event Event to process. 2470 */ 2471 void 2472 OnAddPolygon(wxCommandEvent & event); 2473 2474 /** Start creation of rectangular box. 2475 @param bRounded Rounded corners (rectangular otherwise). 2476 */ 2477 void 2478 OnRectangleBox(bool bRounded); 2479 2480 /** Handler for Add rectangle. 2481 @param event Event to process. 2482 */ 2483 void 2484 OnAddRectangle(wxCommandEvent & event); 2485 2486 /** Handler for Add box. 2487 @param event Event to process. 2488 */ 2489 void 2490 OnAddBox(wxCommandEvent & event); 2491 2492 /** Handler for Add circle. 2493 @param event Event to process. 2494 */ 2495 void 2496 OnAddCircle(wxCommandEvent & event); 2497 2498 /** Handler for Add ellipse. 2499 @param event Event to process. 2500 */ 2501 void 2502 OnAddEllipse(wxCommandEvent & event); 2503 2504 /** Handler for Add open arc. 2505 @param event Event to process. 2506 */ 2507 void 2508 OnAddArcOpen(wxCommandEvent & event); 2509 2510 /** Handler for Add closed arc. 2511 @param event Event to process. 2512 */ 2513 void 2514 OnAddArcClosed(wxCommandEvent & event); 2515 2516 /** Start creation of new spline. 2517 @param ot Object type (open or closed spline). 2518 @param bInterpolated Interpolated or approximated. 2519 */ 2520 void 2521 OnSpline(int8_t ot, bool bInterpolated); 2522 2523 /** Handler for Add open approximated spline. 2524 @param event Event to process. 2525 */ 2526 void 2527 OnAddSplineAO(wxCommandEvent & event); 2528 2529 /** Handler for Add closed approximated spline. 2530 @param event Event to process. 2531 */ 2532 void 2533 OnAddSplineAC(wxCommandEvent & event); 2534 2535 /** Handler for Add open interpolated spline. 2536 @param event Event to process. 2537 */ 2538 void 2539 OnAddSplineIO(wxCommandEvent & event); 2540 2541 /** Handler for Add closed interpolated spline. 2542 @param event Event to process. 2543 */ 2544 void 2545 OnAddSplineIC(wxCommandEvent & event); 2546 2547 /** Handler for Add dot. 2548 @param event Event to process. 2549 */ 2550 void 2551 OnAddDot(wxCommandEvent & event); 2552 2553 /** Handler for Add white filled dot. 2554 @param event Event to process. 2555 */ 2556 void 2557 OnAddWhiteDot(wxCommandEvent & event); 2558 2559 /** Handler for Add text label. 2560 @param event Event to process. 2561 */ 2562 void 2563 OnAddTextlabel(wxCommandEvent & event); 2564 2565 /** Handler for Add image. 2566 @param event Event to process. 2567 */ 2568 void 2569 OnAddImage(wxCommandEvent & event); 2570 2571 /** Inner function to add library element. 2572 */ 2573 void 2574 AddLibelem(void); 2575 2576 /** Handler for Add library element. 2577 @param event Event to process. 2578 */ 2579 void 2580 OnAddLibelem(wxCommandEvent & event); 2581 2582 /** Handler for Edit / copy. 2583 @param event Event to process. 2584 */ 2585 void 2586 OnEditCopy(wxCommandEvent & event); 2587 2588 /** Handler for Edit / move. 2589 @param event Event to process. 2590 */ 2591 void 2592 OnEditMove(wxCommandEvent & event); 2593 2594 /** Handler for Edit / delete. 2595 @param event Event to process. 2596 */ 2597 void 2598 OnEditDelete(wxCommandEvent & event); 2599 2600 /** Handler for Edit / Move point. 2601 @param event Event to process. 2602 */ 2603 void 2604 OnEditPointMove(wxCommandEvent & event); 2605 2606 /** Handler for Edit / Add point. 2607 @param event Event to process. 2608 */ 2609 void 2610 OnEditPointAdd(wxCommandEvent & event); 2611 2612 /** Handler for Edit / Delete point. 2613 @param event Event to process. 2614 */ 2615 void 2616 OnEditPointDelete(wxCommandEvent & event); 2617 2618 /** Handler for Edit / Details. 2619 @param event Event to process. 2620 */ 2621 void 2622 OnEditDetails(wxCommandEvent & event); 2623 2624 /** Handler for Edit / Group. 2625 @param event Event to process. 2626 */ 2627 void 2628 OnEditGroup(wxCommandEvent & event); 2629 2630 /** Handler for Edit / Group. 2631 @param event Event to process. 2632 */ 2633 void 2634 OnEditGroup3(wxCommandEvent & event); 2635 2636 /** Handler for Edit / Ungroup. 2637 @param event Event to process. 2638 */ 2639 void 2640 OnEditUngroup(wxCommandEvent & event); 2641 2642 /** Handler for Edit / Flip horizontally. 2643 @param event Event to process. 2644 */ 2645 void 2646 OnEditFlipH(wxCommandEvent & event); 2647 2648 /** Handler for Edit / Flip vertically. 2649 @param event Event to process. 2650 */ 2651 void 2652 OnEditFlipV(wxCommandEvent & event); 2653 2654 /** Handler for Rotate left. 2655 @param event Event to process. 2656 */ 2657 void 2658 OnEditRotateLeft(wxCommandEvent & event); 2659 2660 /** Handler for Rotate right. 2661 @param event Event to process. 2662 */ 2663 void 2664 OnEditRotateRight(wxCommandEvent & event); 2665 2666 /** Handler for Edit / Change drawing size. 2667 @param event Event to process. 2668 */ 2669 void 2670 OnEditChangeSize(wxCommandEvent & event); 2671 2672 /** Hander for Edit / Set drawing size. 2673 @param event Event to process. 2674 */ 2675 void 2676 OnEditSetSize(wxCommandEvent & event); 2677 2678 /** Handler for View / Layers / Activate all. 2679 @param event Event to process. 2680 */ 2681 void 2682 OnLayersAll(wxCommandEvent & event); 2683 2684 /** Handler for View / Layers / Layer manager. 2685 @param event Event to process. 2686 */ 2687 void 2688 OnLayerManager(wxCommandEvent & event); 2689 2690 /** Center view. 2691 */ 2692 void 2693 OnCenterViewFunction(void); 2694 2695 /** Handler for View / center view. 2696 @param event Event to process. 2697 */ 2698 void 2699 OnCenterView(wxCommandEvent & event); 2700 2701 /** Handler for conversion. 2702 @param event Event to process. 2703 */ 2704 void 2705 OnConvert1(wxCommandEvent & event); 2706 2707 /** Handler for conversion. 2708 @param event Event to process. 2709 */ 2710 void 2711 OnConvert2(wxCommandEvent & event); 2712 2713 /** Handler for conversion. 2714 @param event Event to process. 2715 */ 2716 void 2717 OnConvert3(wxCommandEvent & event); 2718 2719 /** Handler for conversion. 2720 @param event Event to process. 2721 */ 2722 void 2723 OnConvert4(wxCommandEvent & event); 2724 2725 /** Handler for conversion. 2726 @param event Event to process. 2727 */ 2728 void 2729 OnConvert5(wxCommandEvent & event); 2730 2731 /** Handler for conversion. 2732 @param event Event to process. 2733 */ 2734 void 2735 OnConvert6(wxCommandEvent & event); 2736 2737 /** Handler for conversion. 2738 @param event Event to process. 2739 */ 2740 void 2741 OnConvert7(wxCommandEvent & event); 2742 2743 /** Handler for conversion. 2744 @param event Event to process. 2745 */ 2746 void 2747 OnConvert8(wxCommandEvent & event); 2748 2749 /** Handler for conversion. 2750 @param event Event to process. 2751 */ 2752 void 2753 OnConvert9(wxCommandEvent & event); 2754 2755 /** Handler for conversion. 2756 @param event Event to process. 2757 */ 2758 void 2759 OnConvertA(wxCommandEvent & event); 2760 2761 /** Handler for options reset. 2762 @param event Event to process. 2763 */ 2764 void 2765 OnResetOptions(wxCommandEvent & event); 2766 2767 /** Handler for "modify spline s value" button or menu item. 2768 */ 2769 void 2770 OnModifySplineValue(wxCommandEvent & event); 2771 2772 /** Handler for "defaults for new objects" menu item. 2773 @param event Event to process. 2774 */ 2775 void 2776 OnOptionsNewObjects(wxCommandEvent & event); 2777 2778 /** Handler for "screen representation options" menu item. 2779 @param event Event to process. 2780 */ 2781 void 2782 OnOptionsScreenRepresentation(wxCommandEvent & event); 2783 2784 /** Handler for colour modification. 2785 @param event Event to process. 2786 */ 2787 void 2788 OnColourBorderModify(wxCommandEvent & event); 2789 2790 /** Handler for colour reset. 2791 @param event Event to process. 2792 */ 2793 void 2794 OnColourBorderReset(wxCommandEvent & event); 2795 2796 /** Handler for colour modification. 2797 @param event Event to process. 2798 */ 2799 void 2800 OnColourBackgroundModify(wxCommandEvent & event); 2801 2802 /** Handler for colour reset. 2803 @param event Event to process. 2804 */ 2805 void 2806 OnColourBackgroundReset(wxCommandEvent & event); 2807 2808 /** Handler for colour modification. 2809 @param event Event to process. 2810 */ 2811 void 2812 OnColourGridModify(wxCommandEvent & event); 2813 2814 /** Handler for colour reset. 2815 @param event Event to process. 2816 */ 2817 void 2818 OnColourGridReset(wxCommandEvent & event); 2819 2820 /** Handler for colour modification. 2821 @param event Event to process. 2822 */ 2823 void 2824 OnColourPlacementModify(wxCommandEvent & event); 2825 2826 /** Handler for colour reset. 2827 @param event Event to process. 2828 */ 2829 void 2830 OnColourPlacementReset(wxCommandEvent & event); 2831 2832 /** Handler for colour modification. 2833 @param event Event to process. 2834 */ 2835 void 2836 OnColourCopyModify(wxCommandEvent & event); 2837 2838 /** Handler for colour reset. 2839 @param event Event to process. 2840 */ 2841 void 2842 OnColourCopyReset(wxCommandEvent & event); 2843 2844 /** Handler for colour modification. 2845 @param event Event to process. 2846 */ 2847 void 2848 OnColourMoveModify(wxCommandEvent & event); 2849 2850 /** Handler for colour reset. 2851 @param event Event to process. 2852 */ 2853 void 2854 OnColourMoveReset(wxCommandEvent & event); 2855 2856 /** Handler for colour modification. 2857 @param event Event to process. 2858 */ 2859 void 2860 OnColourDeleteModify(wxCommandEvent & event); 2861 2862 /** Handler for colour reset. 2863 @param event Event to process. 2864 */ 2865 void 2866 OnColourDeleteReset(wxCommandEvent & event); 2867 2868 /** Handler for colour modification. 2869 @param event Event to process. 2870 */ 2871 void 2872 OnColourGroupModify(wxCommandEvent & event); 2873 2874 /** Handler for colour reset. 2875 @param event Event to process. 2876 */ 2877 void 2878 OnColourGroupReset(wxCommandEvent & event); 2879 2880 /** Handler for colour modification. 2881 @param event Event to process. 2882 */ 2883 void 2884 OnColourMissingModify(wxCommandEvent & event); 2885 2886 /** Handler for colour reset. 2887 @param event Event to process. 2888 */ 2889 void 2890 OnColourMissingReset(wxCommandEvent & event); 2891 2892 /** Handler for Grid on/off. 2893 @param event Event to process. 2894 */ 2895 void 2896 OnGridOnOff(wxCommandEvent & event); 2897 2898 /** Handler for Grid unit. 2899 @param event Event to process. 2900 */ 2901 void 2902 OnGridUnit(wxCommandEvent & event); 2903 2904 /** Handler for Grid base. 2905 @param event Event to process. 2906 */ 2907 void 2908 OnGridBase(wxCommandEvent & event); 2909 2910 /** Handler for placement help checkbox. 2911 @param event Event to process. 2912 */ 2913 void 2914 OnPlacementHelp(wxCommandEvent & event); 2915 2916 /** Handler for layer change. 2917 @param event Event to process. 2918 */ 2919 void 2920 OnStyleLayer(wxSpinEvent & event); 2921 2922 /** Handler for line colour change. 2923 @param event Event to process. 2924 */ 2925 void 2926 OnStyleLineColour(wxCommandEvent & event); 2927 2928 /** Handler for line width change. 2929 @param event Event to process. 2930 */ 2931 void 2932 OnStyleLineWidth(wxSpinEvent & event); 2933 2934 /** Handler for line style button. 2935 @param event Event to process. 2936 */ 2937 void 2938 OnStyleLineStyle(wxCommandEvent & event); 2939 2940 /** Handler for line cap. 2941 @param event Event to process. 2942 */ 2943 void 2944 OnStyleLineCap(wxCommandEvent & event); 2945 2946 /** Handler for line width change. 2947 @param event Event to process. 2948 */ 2949 void 2950 OnStyleLineJoin(wxCommandEvent & event); 2951 2952 /** Handler for arrowhead forward button. 2953 @param event Event to process. 2954 */ 2955 void 2956 OnStyleLineArrowF(wxCommandEvent & event); 2957 2958 /** Handler for arrowhead backward button. 2959 @param event Event to process. 2960 */ 2961 void 2962 OnStyleLineArrowB(wxCommandEvent & event); 2963 2964 /** Handler for line width change. 2965 @param event Event to process. 2966 */ 2967 void 2968 OnStyleFillColour(wxCommandEvent & event); 2969 2970 /** Handler for fill pattern change. 2971 @param event Event to process. 2972 */ 2973 void 2974 OnStyleFillPattern(wxCommandEvent & event); 2975 2976 /** Handler for line width change. 2977 @param event Event to process. 2978 */ 2979 void 2980 OnStyleTextLatex(wxCommandEvent & event); 2981 2982 /** Handler for text align change. 2983 @param event Event to process. 2984 */ 2985 void 2986 OnStyleTextAlign(wxCommandEvent & event); 2987 2988 /** Handler for text font change. 2989 @param event Event to process. 2990 */ 2991 void 2992 OnStyleTextFont(wxCommandEvent & event); 2993 2994 /** Handler for text size change. 2995 @param event Event to process. 2996 */ 2997 void 2998 OnStyleTextSize(wxSpinEvent & event); 2999 3000 /** Handler for rotation spin control. 3001 @param event Event to process. 3002 */ 3003 void 3004 OnSpinRotation(wxSpinEvent & event); 3005 3006 /** Horizontal scrollbar handler. 3007 @param event Event to process. 3008 */ 3009 void 3010 OnScrollH(wxScrollEvent & event); 3011 3012 /** Vertical scrollbar handler. 3013 @param event Event to process. 3014 */ 3015 void 3016 OnScrollV(wxScrollEvent & event); 3017 3018 /** Require a redraw. 3019 Only to be executed between BeginEventHandling() 3020 and EndEventHandling(). 3021 @param level Redraw level to require. 3022 */ 3023 void 3024 RequireRedraw(int level); 3025 3026 /** Update text if new font was choosen. 3027 @param pobj Modified text object. 3028 @param bRedraw Schedule redraw. 3029 */ 3030 void 3031 UpdateTextForFont(Wxd_object_t *pobj, bool bRedraw = true); 3032 3033 /** Set text for mouse messages when entering a new state. 3034 @param st New state to enter. 3035 */ 3036 void 3037 SetMouseAndStatusTexts(int st); 3038 3039 /* __CHANGE__ 014: Add further methods. 3040 */ 3041 3042 /** Attempt to update all fonts. 3043 */ 3044 void 3045 UpdateFonts(void); 3046 3047 protected: 3048 3049 /* frame protected methods */ 3050 3051 /** Transfer style information from object to GUI elements. 3052 @param refresh Flag: Refresh GUI elements explicitly. 3053 */ 3054 void 3055 StyleToGUI(bool refresh = true); 3056 3057 /** Set style object (object to modify using the style GUI elements). 3058 @param pObj Object to modify. 3059 */ 3060 void 3061 SetStyleObject(Wxd_object_t *pObj = NULL, bool bUpdate = true); 3062 3063 /** Check whether the frame is up and initialized to handle events. 3064 On success, initialize things to handle one event. 3065 @return True to start event handling, false to skip. 3066 */ 3067 bool 3068 BeginEventHandling(void); 3069 3070 /** Start handling of events from control. 3071 */ 3072 void 3073 StartEventHandling(void); 3074 3075 /** Report modifications while reading a file at the end 3076 of event processing. 3077 */ 3078 void 3079 ModificationReportingAtEventEnd(void); 3080 3081 /** Do error reporting at end of event handling. 3082 */ 3083 void 3084 ErrorReportingAtEventEnd(void); 3085 3086 /** End handling one event. If necessary call Update() on the frame. 3087 */ 3088 void 3089 EndEventHandling(void); 3090 3091 /** Update one stipple structure. 3092 @param psti Stipple structure to update. 3093 */ 3094 void 3095 UpdateOneStipple(Wxd_stipple_t *psti); 3096 3097 /** Update internal pattern coefficients in m_dPatterns. 3098 Recalculation necessary after changing zoom factor and/or 3099 loading a new file. 3100 */ 3101 void 3102 UpdatePatternCoefficients(void); 3103 3104 /** Update stipple bitmaps after changing zoom or loading 3105 a file. 3106 */ 3107 void 3108 UpdateStipples(void); 3109 3110 /** Attempt to read all images not yet read. 3111 */ 3112 void 3113 UpdateImages(void); 3114 3115 /** Update one font. 3116 @param pfont Font to update. 3117 */ 3118 void 3119 UpdateOneFont(Wxd_font_t *pfont); 3120 3121 /** Find font structure, create new one if necessary. 3122 @param find Font index. 3123 @param fsz Font size in pt. 3124 @return Valid pointer to font structure on success, NULL on error. 3125 */ 3126 Wxd_font_t * 3127 FindFont(uint8_t find, uint16_t fsz); 3128 3129 /** Read a drawing from file. 3130 @param fn File name to read. 3131 @return Pointer to new drawing on success, NULL on error. 3132 */ 3133 Wxd_drawing_t * 3134 ReadDrawingFromFile(wxString & fn); 3135 3136 /** A new drawing was loaded, adjust GUI. 3137 */ 3138 void 3139 DrawingLoaded(void); 3140 3141 /** Find suitable size for colour viewers, derived from 3142 the height of the layer number spin control. 3143 @return Size suggestion for colour viewer. 3144 */ 3145 wxSize 3146 ColourViewSize(void); 3147 3148 /** Complete setup on first idle event. 3149 Using the first idle event ensures the window is already 3150 shown on screen. 3151 */ 3152 void 3153 OnFirstIdle(void); 3154 3155 /** Copy default style values to m_iv array. 3156 */ 3157 void 3158 DefaultStyleToArray(void); 3159 3160 /** Get default style values from m_iv array. 3161 */ 3162 void 3163 DefaultStyleFromArray(void); 3164 3165 /** Load defaults. 3166 */ 3167 void 3168 LoadDefaults(void); 3169 3170 /** Load configuration. 3171 */ 3172 void 3173 LoadConfiguration(void); 3174 3175 /** Save configuration. 3176 */ 3177 void 3178 SaveConfiguration(void); 3179 3180 /** Reset configuration settings to default values. 3181 */ 3182 void 3183 ResetConfiguration(void); 3184 3185 /** Update the position labels. 3186 @param havepos Flag: Position is known. 3187 @param x X position if position is known. 3188 @param y Y position if position is known. 3189 */ 3190 void 3191 UpdatePositionLabels(bool havepos, int32_t x, int32_t y); 3192 3193 /** Calculate drawing and grid position from mouse position. 3194 @return True if position was changed, false if no change. 3195 */ 3196 bool 3197 UpdateGridPosition(void); 3198 3199 /** Retrieve mouse position, calculate drawing and grid position. 3200 @param event Event to process. 3201 @return True if position was changed, false if everything 3202 unchanged. 3203 */ 3204 bool 3205 UpdateMousePosition(wxMouseEvent & event); 3206 3207 /** Move scrollbar position as action on mouse wheel. 3208 @param sb Scrollbar to modify. 3209 @param lines Number of lines to move. 3210 @param vert Flag: Moving the vertical bar. 3211 */ 3212 void 3213 MoveScrollbar(wxScrollBar *sb, int lines, bool vert); 3214 3215 /** Check whether an object is selectable in the current state. 3216 @param pobj Object to check. 3217 @return True if object is selectable, false otherwise. 3218 */ 3219 bool 3220 ObjectSelectableInState(Wxd_object_t const *pobj); 3221 3222 /** Find object nearest to raw mouse coordinates (not grid-aligned). 3223 @param gr Return group object instead of simple object. 3224 @return Object if found or NULL. 3225 */ 3226 Wxd_object_t * 3227 FindNearestObject(bool gr = false); 3228 3229 /** End polyline drawing operation while waiting for first point. 3230 @param bComplete End completely. 3231 @param bSkip Skip data entered so far in operation. 3232 */ 3233 void 3234 EndOperationPolyFirst(void); 3235 3236 /** End polyline drawing operation if points exist. 3237 @param bComplete End completely. 3238 @param bSkip Skip data entered so far in operation. 3239 */ 3240 void 3241 EndOperationPolyFurther(bool bComplete, bool bSkip); 3242 3243 /** End spline drawing operation while waiting for first point. 3244 */ 3245 void 3246 EndOperationSplineFirst(void); 3247 3248 /** End spline drawing operation if points exist. 3249 @param bComplete End completely. 3250 @param bSkip Skip data entered so far in operation. 3251 */ 3252 void 3253 EndOperationSplineFurther(bool bComplete, bool bSkip); 3254 3255 /** End 2-point operation while waiting for second point. 3256 @param ns Next state. 3257 @param bComplete End completely. 3258 */ 3259 void 3260 EndOperationTwoPointsSecond(int ns, bool bComplete); 3261 3262 /** End box drawing while waiting for first point. 3263 */ 3264 void 3265 EndOperationBoxFirst(void); 3266 3267 /** End box drawing while waiting for opposite point. 3268 @param bComplete End completely. 3269 */ 3270 void 3271 EndOperationBoxOpposite(bool bComplete); 3272 3273 /** End circle drawing while waiting for center point. 3274 */ 3275 void 3276 EndOperationCircleCenter(void); 3277 3278 /** End circle drawing while waiting for radius point. 3279 @param bComplete End completely. 3280 */ 3281 void 3282 EndOperationCircleRadius(bool bComplete); 3283 3284 /** End ellipse drawing while waiting for center point. 3285 */ 3286 void 3287 EndOperationEllipseCenter(void); 3288 3289 /** End ellipse drawing while waiting for bounding box corner point. 3290 @param bComplete End completely. 3291 */ 3292 void 3293 EndOperationEllipseCorner(bool bComplete); 3294 3295 /** End arc drawing while waiting for start point. 3296 */ 3297 void 3298 EndOperationArc1(void); 3299 3300 /** End arc drawing while waiting for intermediate point. 3301 @param bComplete End completely. 3302 */ 3303 void 3304 EndOperationArc2(bool bComplete); 3305 3306 /** End arc drawing while waiting for end point. 3307 @param bComplete End completely. 3308 */ 3309 void 3310 EndOperationArc3(bool bComplete); 3311 3312 /** End dot drawing while waiting for point. 3313 */ 3314 void 3315 EndOperationDot(void); 3316 3317 /** End library element placement operation while waiting for point. 3318 */ 3319 void 3320 EndOperationLibelemPlace(void); 3321 3322 /** End point move operation while placing point. 3323 */ 3324 void 3325 EndOperationPointMovePlace(void); 3326 3327 /** End point add operation while placing point. 3328 @param bComplete End completely. 3329 */ 3330 void 3331 EndOperationPointAddPlace(bool bComplete); 3332 3333 /** End point add operation while placing drawing corner point. 3334 @param bComplete End completely. 3335 */ 3336 void 3337 EndOperationDrawingSizePlace(bool bComplete); 3338 3339 /** End recent operation. 3340 @param bComplete End completely. 3341 @param bSkip Skip data entered so far in operation. 3342 */ 3343 void 3344 EndOperation(bool bComplete = false, bool bSkip = false); 3345 3346 /** Move marker 2 marked objects into new group. 3347 */ 3348 void 3349 GroupNewForMarkedObjects(void); 3350 3351 /** Ungroup objects from group (resolve group). 3352 @param pgrp Group to resolve. 3353 */ 3354 void 3355 UngroupObjects(Wxd_object_t *pgrp); 3356 3357 /** Check whether the current point is an acceptable point. 3358 @return Test result. 3359 */ 3360 bool 3361 IsAcceptablePoint(void); 3362 3363 /** Reaction on mouse move in S_NOOP state. 3364 */ 3365 void 3366 MouseMoveNoop(void); 3367 3368 /** Reaction on mouse move in S_DELETE state. 3369 */ 3370 void 3371 MouseMoveDelete(void); 3372 3373 /** Reaction on mouse move in S_REGION_DELETE state. 3374 */ 3375 void 3376 MouseMoveRegionDelete(void); 3377 3378 /** Reaction on mouse move while selecting objects to move. 3379 */ 3380 void 3381 MouseMoveMoveSelect(void); 3382 3383 /** Reaction on mouse move while placing objects to move. 3384 */ 3385 void 3386 MouseMoveMovePlace(void); 3387 3388 /** Reaction on mouse move while selecting objects to copy. 3389 */ 3390 void 3391 MouseMoveCopySelect(void); 3392 3393 /** Reaction on mouse move while placing objects to copy. 3394 */ 3395 void 3396 MouseMoveCopyPlace(void); 3397 3398 /** Reaction on middle mouse key. 3399 */ 3400 void 3401 MouseMiddleDelete(void); 3402 3403 /** Reaction on left mouse click in S_NOOP state. 3404 */ 3405 void 3406 MouseLeftNoop(void); 3407 3408 /** Reaction on left mouse click in S_DELETE state. 3409 */ 3410 void 3411 MouseLeftDelete(void); 3412 3413 /** Reaction on left mouse click in S_REGION_DELETE state. 3414 */ 3415 void 3416 MouseLeftRegionDelete(void); 3417 3418 /** Reaction on left mouse click while selecting objects to move. 3419 */ 3420 void 3421 MouseLeftMoveSelect(void); 3422 3423 /** Reaction on left mouse click while placing objects to move. 3424 */ 3425 void 3426 MouseLeftMovePlace(void); 3427 3428 /** Reaction on left mouse click while selecting objects to copy. 3429 */ 3430 void 3431 MouseLeftCopySelect(void); 3432 3433 /** Reaction on left mouse click while placing objects to copy. 3434 */ 3435 void 3436 MouseLeftCopyPlace(void); 3437 3438 /** Reaction on mouse move in S_POLY_FIRST state. 3439 */ 3440 void 3441 MouseMovePolyFirst(void); 3442 3443 /** Reaction on mouse move in S_POLY_FURTHER state. 3444 */ 3445 void 3446 MouseMovePolyFurther(void); 3447 3448 /** Reaction on mouse left click in S_POLY_FIRST state. 3449 */ 3450 void 3451 MouseLeftPolyFirst(void); 3452 3453 /** Reaction on mouse left click in S_POLY_FURTHER state. 3454 */ 3455 void 3456 MouseLeftPolyFurther(void); 3457 3458 /** X-spline s value at end points. 3459 @return S value. 3460 */ 3461 double 3462 SValueAtEnd(void); 3463 3464 /** Reaction on mouse movement in S_SPLINE_FIRST state. 3465 */ 3466 void 3467 MouseMoveSplineFirst(void); 3468 3469 /** Reaction on mouse movement in S_SPLINE_FURTHER state. 3470 */ 3471 void 3472 MouseMoveSplineFurther(void); 3473 3474 /** Reaction on mouse left click in S_SPLINE_FIRST state. 3475 */ 3476 void 3477 MouseLeftSplineFirst(void); 3478 3479 /** Reaction on mouse left click in S_SPLINE_FURTHER state. 3480 */ 3481 void 3482 MouseLeftSplineFurther(void); 3483 3484 /** Reaction on mouse move in S_ELLIPSE_CENTER state. 3485 */ 3486 void 3487 MouseMoveEllipseCenter(void); 3488 3489 /** Reaction on mouse left click in S_ELLIPSE_CENTER state. 3490 */ 3491 void 3492 MouseLeftEllipseCenter(void); 3493 3494 /** Reaction on mouse move in S_ELLIPSE_CORNER state. 3495 */ 3496 void 3497 MouseMoveEllipseCorner(void); 3498 3499 /** Reaction on mouse left click in S_ELLIPSE_CORNER state. 3500 */ 3501 void 3502 MouseLeftEllipseCorner(void); 3503 3504 /** Reaction on mouse move in S_ARC_1 state. 3505 */ 3506 void 3507 MouseMoveArc1(void); 3508 3509 /** Reaction on mouse left click in S_ARC_1 state. 3510 */ 3511 void 3512 MouseLeftArc1(void); 3513 3514 /** Reaction on mouse move in S_ARC_2 state. 3515 */ 3516 void 3517 MouseMoveArc2(void); 3518 3519 /** Reaction on mouse left click in S_ARC_2 state. 3520 */ 3521 void 3522 MouseLeftArc2(void); 3523 3524 /** Reaction on mouse move in S_ARC_3 state. 3525 */ 3526 void 3527 MouseMoveArc3(void); 3528 3529 /** Reaction on mouse left click in S_ARC_3 state. 3530 */ 3531 void 3532 MouseLeftArc3(void); 3533 3534 /** Set box details (bounding box from start point and current point). 3535 The radius should be updated only while constructing a box, 3536 not while moving a point. 3537 @param bUpdateRadius Update radius. 3538 */ 3539 void 3540 SetBoxDetails(bool bUpdateRadius); 3541 3542 /** Reaction on mouse move in S_BOX_FIRST state. 3543 */ 3544 void 3545 MouseMoveBoxFirst(void); 3546 3547 /** Reaction on mouse move in S_BOX_OPPOSITE state. 3548 */ 3549 void 3550 MouseMoveBoxOpposite(void); 3551 3552 /** Reaction on mouse left click in S_BOX_FIRST state. 3553 */ 3554 void 3555 MouseLeftBoxFirst(void); 3556 3557 /** Reaction on mouse left click in S_BOX_OPPOSITE state. 3558 */ 3559 void 3560 MouseLeftBoxOpposite(void); 3561 3562 /** Reaction on mouse move in S_CIRCLE_CENTER state. 3563 */ 3564 void 3565 MouseMoveCircleCenter(void); 3566 3567 /** Calculate circle radius from center point to current point. 3568 */ 3569 void 3570 CalculateCircleRadius(uint32_t & rx, dk4_er_t *erp); 3571 3572 /** Calculate ellipse radii from center point to current point. 3573 */ 3574 void 3575 CalculateEllipseRadii(uint32_t & rx, uint32_t & ry, dk4_er_t *erp); 3576 3577 /** Reaction on mouse move in S_CIRCLE_RADIUS state. 3578 */ 3579 void 3580 MouseMoveCircleRadius(void); 3581 3582 /** Reaction on mouse left click in S_CIRCLE_CENTER state. 3583 */ 3584 void 3585 MouseLeftCircleCenter(void); 3586 3587 /** Reaction on mouse left click in S_CIRCLE_RADIUS state. 3588 */ 3589 void 3590 MouseLeftCircleRadius(void); 3591 3592 /** Reaction on mouse move in S_DOT state. 3593 */ 3594 void 3595 MouseMoveDot(void); 3596 3597 /** Reaction on mouse left click in S_DOT state. 3598 */ 3599 void 3600 MouseLeftDot(void); 3601 3602 /** Reaction on mouse move in S_TEXT state. 3603 */ 3604 void 3605 MouseMoveText(void); 3606 3607 /** Reaction on mouse left click in S_TEXT state. 3608 */ 3609 void 3610 MouseLeftText(void); 3611 3612 /** Reaction on mouse move in S_IMG_1 state. 3613 */ 3614 void 3615 MouseMoveImage1(void); 3616 3617 /** Reaction on mouse move in S_IMG_2 state. 3618 */ 3619 void 3620 MouseMoveImage2(void); 3621 3622 /** Reaction on mouse left click in S_IMG_1 state. 3623 */ 3624 void 3625 MouseLeftImage1(void); 3626 3627 /** Reaction on mouse left click in S_IMG_2 state. 3628 */ 3629 void 3630 MouseLeftImage2(void); 3631 3632 /** Reaction on mouse move in S_LIBELEM_PLACE state. 3633 */ 3634 void 3635 MouseMoveLibelemPlace(void); 3636 3637 /** Reaction on mouse left click in S_LIBELEM_PLACE state. 3638 */ 3639 void 3640 MouseLeftLibelemPlace(void); 3641 3642 /** Reaction on mouse move in S_MOVEPT_SELECT state. 3643 */ 3644 void 3645 MouseMovePointMoveSelect(void); 3646 3647 /** Reaction on mouse left click in S_MOVEPT_SELECT state. 3648 */ 3649 void 3650 MouseLeftPointMoveSelect(void); 3651 3652 /** Reaction on mouse move in S_MOVEPT_PLACE state. 3653 */ 3654 void 3655 MouseMovePointMovePlace(void); 3656 3657 /** Modify spline s value after moving a spline point. 3658 @param pCurrent Spline object to modify. 3659 @param uCurrent Index of point to modify. 3660 */ 3661 void 3662 ModifySplineValue(Wxd_object_t *pCurrent, uint16_t uCurrent); 3663 3664 /** Reaction on mouse left click in S_MOVEPT_PLACE state. 3665 */ 3666 void 3667 MouseLeftPointMovePlace(void); 3668 3669 /** Reaction on mouse move in S_DELPT state. 3670 */ 3671 void 3672 MouseMovePointDelete(void); 3673 3674 /** Reaction on mouse left click in S_DELPT state. 3675 */ 3676 void 3677 MouseLeftPointDelete(void); 3678 3679 /** Reaction on mouse move in S_ADDPT_SELECT state. 3680 */ 3681 void 3682 MouseMovePointAddSelect(void); 3683 3684 /** Reaction on mouse left click in S_ADDPT_SELECT state. 3685 */ 3686 void 3687 MouseLeftPointAddSelect(void); 3688 3689 /** Reaction on mouse move in S_ADDPT_PLACE state. 3690 */ 3691 void 3692 MouseMovePointAddPlace(void); 3693 3694 /** Reaction on mouse move in S_DRWSZ_SELECT state. 3695 */ 3696 void 3697 MouseMoveDrawingSizeSelect(void); 3698 3699 /** Reaction on mouse move in S_DRWSZ_PLACE state. 3700 */ 3701 void 3702 MouseMoveDrawingSizePlace(void); 3703 3704 /** Reaction on mouse left click in S_ADDPT_PLACE state. 3705 */ 3706 void 3707 MouseLeftPointAddPlace(void); 3708 3709 /** Reaction on mouse left click in S_DRWSZ_SELECT state. 3710 */ 3711 void 3712 MouseLeftDrawingSizeSelect(void); 3713 3714 /** Reaction on mouse left click in S_DRWSZ_PLACE state. 3715 */ 3716 void 3717 MouseLeftDrawingSizePlace(void); 3718 3719 /** Reaction on mouse movement click in S_FLIP state. 3720 */ 3721 void 3722 MouseMoveFlip(void); 3723 3724 /** Reaction on mouse left click in S_FLIP state. 3725 */ 3726 void 3727 MouseLeftFlip(void); 3728 3729 /** Reaction on mouse movement in S_GROUP_ONE state. 3730 */ 3731 void 3732 MouseMoveGroupOne(void); 3733 3734 /** Reaction on mouse left click in S_GROUP_ONE state. 3735 */ 3736 void 3737 MouseLeftGroupOne(void); 3738 3739 /** Mark objects in the selected rectangle for grouping. 3740 */ 3741 void 3742 MarkObjectsForRectangleGrouping(void); 3743 3744 /** Mark objects in the selected rectangle for deletion. 3745 */ 3746 void 3747 MarkObjectsForRectangleDeletion(void); 3748 3749 /** Reaction on mouse movement in S_GROUP_RECT_1 state. 3750 */ 3751 void 3752 MouseMoveGroupRect1(void); 3753 3754 /** Reaction on mouse left click in S_GROUP_RECT_1 state. 3755 */ 3756 void 3757 MouseLeftGroupRect1(void); 3758 3759 /** Reaction on mouse movement in S_GROUP_RECT_2 state. 3760 */ 3761 void 3762 MouseMoveGroupRect2(void); 3763 3764 /** Reaction on mouse left click in S_GROUP_RECT_2 state. 3765 */ 3766 void 3767 MouseLeftGroupRect2(void); 3768 3769 /** Reaction on mouse movement in S_UNGROUP state. 3770 */ 3771 void 3772 MouseMoveUngroup(void); 3773 3774 /** Reaction on mouse left click in S_UNGROUP state. 3775 */ 3776 void 3777 MouseLeftUngroup(void); 3778 3779 /** Reaction on mouse movement in S_DETAILS state. 3780 */ 3781 void 3782 MouseMoveDetails(void); 3783 3784 /** Reaction on mouse left click in S_DETAILS state. 3785 */ 3786 void 3787 MouseLeftDetails(void); 3788 3789 /** Object type conversion: spline to polyline or polygon. 3790 @param pobj Object to convert. 3791 */ 3792 void 3793 ConvertSplineToPoly(Wxd_object_t *pobj); 3794 3795 /** Object type conversion: arc to polyline or polygon. 3796 @param pobj Object to convert. 3797 */ 3798 void 3799 ConvertArcToPoly(Wxd_object_t *pobj); 3800 3801 /** Object type conversion: box to polyline or polygon. 3802 @param pobj Object to convert. 3803 */ 3804 void 3805 ConvertBoxToPoly(Wxd_object_t *pobj); 3806 3807 /** Object type conversion: polyline or polygon to spline. 3808 @param pobj Object to convert. 3809 */ 3810 void 3811 ConvertPolyToSpline(Wxd_object_t *pobj); 3812 3813 /** Object type conversion: spline to spline. 3814 @param pobj Object to convert. 3815 */ 3816 void 3817 ConvertSplineToSpline(Wxd_object_t *pobj); 3818 3819 /** Object type conversion: arc to spline. 3820 @param pobj Object to convert. 3821 */ 3822 void 3823 ConvertArcToSpline(Wxd_object_t *pobj); 3824 3825 /** Object type conversion: box to spline. 3826 @param pobj Object to convert. 3827 */ 3828 void 3829 ConvertBoxToSpline(Wxd_object_t *pobj); 3830 3831 /** Object type conversion: polyline or polygon to arc. 3832 @param pobj Object to convert. 3833 */ 3834 void 3835 ConvertPolyToArc(Wxd_object_t *pobj); 3836 3837 /** Object type conversion: spline to arc. 3838 @param pobj Object to convert. 3839 */ 3840 void 3841 ConvertSplineToArc(Wxd_object_t *pobj); 3842 3843 /** Object type conversion: circle to dot. 3844 @param pobj Object to convert. 3845 */ 3846 void 3847 ConvertCircleToDot(Wxd_object_t *pobj); 3848 3849 /** Convert object to specified type. 3850 */ 3851 void 3852 ObjectTypeConversion(Wxd_object_t *pobj); 3853 3854 /** Reaction on mouse move in S_CONVERT state. 3855 */ 3856 void 3857 MouseMoveConvert(void); 3858 3859 /** Reaction on left mouse button in S_CONVERT state. 3860 */ 3861 void 3862 MouseLeftConvert(void); 3863 3864 /** Reaction on mouse move in S_ROTATE state. 3865 */ 3866 void 3867 MouseMoveRotate(void); 3868 3869 /** Reaction on left mouse button in S_ROTATE state. 3870 */ 3871 void 3872 MouseLeftRotate(void); 3873 3874 /** Reaction on mouse move in S_MOD_SPLINE state. 3875 */ 3876 void 3877 MouseMoveModspline(void); 3878 3879 /** Reaction on left mouse button in S_MOD_SPLINE state. 3880 */ 3881 void 3882 MouseLeftModspline(void); 3883 3884 /** Retrieve input from one text control, set pointer to 3885 a dynamic copy of the input text. 3886 @param ptxt Address of pointer to modify. 3887 @param ptc Text control containing users input. 3888 @param bKeepOld Keep old text if new text is empty. 3889 */ 3890 void 3891 ChangeOneLabelText( 3892 wxChar **ptxt, 3893 wxTextCtrl *ptc, 3894 bool bKeepOld = true 3895 ); 3896 3897 /** Retrieve the input from text controls for export text and 3898 screen text, save text to m_pCurrent. 3899 @param ptce Text control for export text. 3900 @param ptcs Text control for screen text. 3901 @param bLaTeX LaTeX or non-LaTeX text. 3902 */ 3903 void 3904 RetrieveTextDetails( 3905 wxTextCtrl *ptce, 3906 wxTextCtrl *ptcs, 3907 bool bLaTeX 3908 ); 3909 3910 /** Modify text label details (texts). 3911 */ 3912 void 3913 ModifyDetailsText(void); 3914 3915 /** Modify box details (corner radius). 3916 */ 3917 void 3918 ModifyDetailsBox(void); 3919 3920 /** Change image file for image object. 3921 @param pa New file name to use. 3922 */ 3923 void 3924 ChangeImageFile(wxString & pa); 3925 3926 /** Modify image details (image file name and flags). 3927 */ 3928 void 3929 ModifyDetailsImage(void); 3930 3931 /** Modify filled dot details (diameter). 3932 */ 3933 void 3934 ModifyDetailsDotFilled(void); 3935 3936 /** Modify white dot details (diameter and line width). 3937 */ 3938 void 3939 ModifyDetailsDotWhite(void); 3940 3941 /** Handler for mouse entering control area. 3942 @param event Event to process. 3943 */ 3944 void 3945 ControlMouseEnter(wxMouseEvent & event); 3946 3947 /** Handler for mouse leaving the control area. 3948 @param event Event to process. 3949 */ 3950 void 3951 ControlMouseLeave(wxMouseEvent & event); 3952 3953 /** Handler for mouse move. 3954 @param event Event to process. 3955 */ 3956 void 3957 ControlMouseMove(wxMouseEvent & event); 3958 3959 /** Handler for left mouse button click. 3960 @param event Event to process. 3961 */ 3962 void 3963 ControlLeftMouseButton(wxMouseEvent & event); 3964 3965 /** End current operation on right mouse button or escape key. 3966 */ 3967 void 3968 RightMouseOrEscape(void); 3969 3970 /** Handler for right mouse button click. 3971 @param event Event to process. 3972 */ 3973 void 3974 ControlRightMouseButton(wxMouseEvent & event); 3975 3976 /** Handler for middle mouse button click. 3977 @param event Event to process. 3978 */ 3979 void 3980 ControlMiddleMouseButton(wxMouseEvent & event); 3981 3982 /** Handler for mouse wheell move. 3983 @param event Event to process. 3984 */ 3985 void 3986 ControlMouseWheel(wxMouseEvent & event); 3987 3988 /** Use values from horizontal scrollbar. 3989 */ 3990 void 3991 UseScrollH(void); 3992 3993 /** Use values from vertical scrollbar. 3994 */ 3995 void 3996 UseScrollV(void); 3997 3998 /** Find directory where current file is saved. 3999 @param dnb Buffer for directory. 4000 @param dnsz Size of dnb (number of wxChar). 4001 @param fn File name to find directory for. 4002 @return True on success, false on error. 4003 */ 4004 bool 4005 FindDirectoryForFile(wxChar *dnb, size_t dnsz, wxString & fn); 4006 4007 /** Modify a colour. 4008 @param ivi Index of color start in m_iv array. 4009 @param rdl Redraw level required by operation. 4010 */ 4011 void 4012 ColorModify(size_t ivi, int rdl); 4013 4014 /** Modify a colour. 4015 @param ivi Index of color start in m_iv array. 4016 @param rdl Redraw level required by operation. 4017 */ 4018 void 4019 ColorReset(size_t ivi, int rdl); 4020 }; 4021 4022 4023 4024 /* vim: set ai sw=4 ts=4 : */ 4025 4026 #endif 4027