From b84fe2b7030ce00b59d33fbdb80ab65d03775140 Mon Sep 17 00:00:00 2001 From: Mark Roszko Date: Tue, 31 Dec 2019 04:05:51 +0000 Subject: [PATCH] ADDED: Editing style of multiple graphical lines at the same time. Provides the ability to quickly set the style of multiple lines. This is only allowed if the selection includes _only_ graphical lines. --- bitmaps_png/CMakeLists.txt | 5 + bitmaps_png/cpp_16/question_mark.cpp | 22 + bitmaps_png/cpp_other/stroke_dash.cpp | 27 + bitmaps_png/cpp_other/stroke_dashdot.cpp | 30 + bitmaps_png/cpp_other/stroke_dot.cpp | 31 + bitmaps_png/cpp_other/stroke_solid.cpp | 25 + .../include/bitmaps_png/bitmaps_list.h | 5 + bitmaps_png/sources/question_mark.svg | 38 + bitmaps_png/sources/stroke_dash.svg | 40 + bitmaps_png/sources/stroke_dashdot.svg | 40 + bitmaps_png/sources/stroke_dot.svg | 42 + bitmaps_png/sources/stroke_solid.svg | 38 + eeschema/dialogs/dialog_edit_line_style.cpp | 167 ++- eeschema/dialogs/dialog_edit_line_style.h | 6 +- .../dialogs/dialog_edit_line_style_base.cpp | 92 +- .../dialogs/dialog_edit_line_style_base.fbp | 1048 ++++++++--------- .../dialogs/dialog_edit_line_style_base.h | 37 +- eeschema/tools/sch_edit_tool.cpp | 44 +- include/tool/selection.h | 14 + 19 files changed, 1070 insertions(+), 681 deletions(-) create mode 100644 bitmaps_png/cpp_16/question_mark.cpp create mode 100644 bitmaps_png/cpp_other/stroke_dash.cpp create mode 100644 bitmaps_png/cpp_other/stroke_dashdot.cpp create mode 100644 bitmaps_png/cpp_other/stroke_dot.cpp create mode 100644 bitmaps_png/cpp_other/stroke_solid.cpp create mode 100644 bitmaps_png/sources/question_mark.svg create mode 100644 bitmaps_png/sources/stroke_dash.svg create mode 100644 bitmaps_png/sources/stroke_dashdot.svg create mode 100644 bitmaps_png/sources/stroke_dot.svg create mode 100644 bitmaps_png/sources/stroke_solid.svg diff --git a/bitmaps_png/CMakeLists.txt b/bitmaps_png/CMakeLists.txt index cba63dfbda..229008e941 100644 --- a/bitmaps_png/CMakeLists.txt +++ b/bitmaps_png/CMakeLists.txt @@ -91,6 +91,7 @@ set( BMAPS_SMALL pintype_opencoll pintype_openemit pintype_noconnect + question_mark refresh small_down small_edit @@ -534,6 +535,10 @@ set( BMAPS_BIG ) set( BMAPS_OTHER + stroke_dash + stroke_dashdot + stroke_dot + stroke_solid tune_diff_pair_length_legend tune_diff_pair_skew_legend tune_single_track_length_legend diff --git a/bitmaps_png/cpp_16/question_mark.cpp b/bitmaps_png/cpp_16/question_mark.cpp new file mode 100644 index 0000000000..ec20e250c7 --- /dev/null +++ b/bitmaps_png/cpp_16/question_mark.cpp @@ -0,0 +1,22 @@ + +/* Do not modify this file, it was automatically generated by the + * PNG2cpp CMake script, using a *.png file as input. + */ + +#include + +static const unsigned char png[] = { + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, + 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x08, 0x04, 0x00, 0x00, 0x00, 0xb5, 0xfa, 0x37, + 0xea, 0x00, 0x00, 0x00, 0x4c, 0x49, 0x44, 0x41, 0x54, 0x28, 0xcf, 0x63, 0x60, 0x18, 0x6c, 0xc0, + 0x83, 0x21, 0x8c, 0xa1, 0x8c, 0x21, 0x88, 0x81, 0x11, 0xbb, 0xb4, 0x09, 0x43, 0x1b, 0x90, 0x94, + 0x63, 0xf8, 0xc1, 0x60, 0x83, 0x5d, 0x01, 0x3b, 0x83, 0x0b, 0x90, 0x14, 0x66, 0xf8, 0xce, 0xa0, + 0x80, 0xcf, 0x9a, 0x44, 0x86, 0x6e, 0xfc, 0xee, 0x98, 0xc6, 0xc0, 0x8c, 0x4f, 0x5a, 0x98, 0xc1, + 0x02, 0xbf, 0x7e, 0x0d, 0x06, 0x69, 0xfc, 0x0a, 0x9a, 0x18, 0xf2, 0x06, 0x5d, 0xe0, 0x33, 0x00, + 0x00, 0x29, 0xbc, 0x07, 0xec, 0x3c, 0xd3, 0xa9, 0x4c, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, + 0x44, 0xae, 0x42, 0x60, 0x82, +}; + +const BITMAP_OPAQUE question_mark_xpm[1] = {{ png, sizeof( png ), "question_mark_xpm" }}; + +//EOF diff --git a/bitmaps_png/cpp_other/stroke_dash.cpp b/bitmaps_png/cpp_other/stroke_dash.cpp new file mode 100644 index 0000000000..1bcfdc55e2 --- /dev/null +++ b/bitmaps_png/cpp_other/stroke_dash.cpp @@ -0,0 +1,27 @@ + +/* Do not modify this file, it was automatically generated by the + * PNG2cpp CMake script, using a *.png file as input. + */ + +#include + +static const unsigned char png[] = { + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, + 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x10, 0x08, 0x06, 0x00, 0x00, 0x00, 0xa6, 0xe7, 0x79, + 0x29, 0x00, 0x00, 0x00, 0xa5, 0x49, 0x44, 0x41, 0x54, 0x58, 0xc3, 0x63, 0x60, 0x18, 0x05, 0xa3, + 0x60, 0x14, 0x8c, 0x02, 0x04, 0x60, 0x04, 0x62, 0x6e, 0x12, 0x31, 0x23, 0x91, 0xe6, 0x72, 0x90, + 0x88, 0xe9, 0x68, 0x2e, 0x77, 0x16, 0x0f, 0x83, 0xc8, 0xb1, 0x02, 0x06, 0xf1, 0x87, 0x17, 0x18, + 0xa4, 0xbe, 0xfc, 0x27, 0x09, 0x83, 0xf4, 0x80, 0xf4, 0x82, 0xcc, 0xc0, 0x69, 0xee, 0x83, 0x73, + 0x0c, 0x92, 0xef, 0xff, 0x92, 0x84, 0xc5, 0x1f, 0x9e, 0xa3, 0x9f, 0xb9, 0xa2, 0xe7, 0xa7, 0x32, + 0x48, 0xff, 0xff, 0x4f, 0x11, 0x06, 0x99, 0x81, 0x0e, 0xc4, 0x2e, 0x50, 0x6e, 0x2e, 0xc8, 0x0c, + 0x1a, 0x9b, 0xcb, 0xc4, 0x20, 0xf1, 0xf4, 0x05, 0xc5, 0x06, 0x82, 0xcc, 0x00, 0x99, 0x85, 0x00, + 0x40, 0x73, 0x9f, 0x51, 0xc1, 0xdc, 0x67, 0x34, 0x37, 0x97, 0x4a, 0x01, 0xf0, 0x6c, 0xc8, 0x06, + 0xc0, 0x88, 0xcf, 0x02, 0xc8, 0x85, 0xca, 0x79, 0x06, 0xa9, 0xcf, 0x24, 0x14, 0x82, 0x40, 0xb5, + 0x20, 0x3d, 0x78, 0x0b, 0xab, 0xa3, 0xf9, 0xe4, 0x17, 0x56, 0x40, 0xbd, 0xf4, 0x34, 0x77, 0xe4, + 0x56, 0x83, 0xa3, 0x60, 0x14, 0x8c, 0x82, 0x91, 0x0a, 0x00, 0xfd, 0x46, 0x7a, 0xf6, 0xe4, 0x09, + 0x17, 0x5a, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82, +}; + +const BITMAP_OPAQUE stroke_dash_xpm[1] = {{ png, sizeof( png ), "stroke_dash_xpm" }}; + +//EOF diff --git a/bitmaps_png/cpp_other/stroke_dashdot.cpp b/bitmaps_png/cpp_other/stroke_dashdot.cpp new file mode 100644 index 0000000000..25ba36ea05 --- /dev/null +++ b/bitmaps_png/cpp_other/stroke_dashdot.cpp @@ -0,0 +1,30 @@ + +/* Do not modify this file, it was automatically generated by the + * PNG2cpp CMake script, using a *.png file as input. + */ + +#include + +static const unsigned char png[] = { + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, + 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x10, 0x08, 0x06, 0x00, 0x00, 0x00, 0xa6, 0xe7, 0x79, + 0x29, 0x00, 0x00, 0x00, 0xd6, 0x49, 0x44, 0x41, 0x54, 0x58, 0xc3, 0x63, 0x60, 0x18, 0x05, 0xa3, + 0x60, 0x14, 0x8c, 0x02, 0x04, 0x60, 0x04, 0x62, 0x6e, 0x12, 0x31, 0x23, 0x99, 0x76, 0xb1, 0x22, + 0x99, 0xc1, 0x31, 0xb0, 0xee, 0xe5, 0xce, 0xe2, 0x61, 0x10, 0x39, 0x56, 0xc0, 0x20, 0xfe, 0xf0, + 0x02, 0x83, 0xd4, 0x97, 0xff, 0x24, 0x61, 0x90, 0x1e, 0x90, 0x5e, 0x90, 0x19, 0xc4, 0x00, 0x81, + 0xb9, 0x5a, 0x0c, 0x62, 0x97, 0xa7, 0x30, 0x48, 0xbc, 0x7c, 0x03, 0x37, 0x43, 0xf2, 0xdd, 0x4f, + 0x06, 0xf1, 0xdb, 0x6b, 0x19, 0x84, 0x36, 0x7a, 0x10, 0x65, 0x06, 0xd5, 0xdd, 0x2b, 0x7a, 0x7e, + 0x2a, 0x83, 0xf4, 0xff, 0xff, 0x14, 0x61, 0x90, 0x19, 0x84, 0x00, 0x4f, 0x85, 0x30, 0xd0, 0xe3, + 0xf7, 0x71, 0x9a, 0x21, 0xf5, 0xfd, 0x17, 0x83, 0xd0, 0x6a, 0x07, 0x82, 0xe6, 0x50, 0xd9, 0xbd, + 0x4c, 0x0c, 0x12, 0x4f, 0x5f, 0x50, 0x6c, 0x20, 0xc8, 0x0c, 0x90, 0x59, 0xf8, 0x80, 0xf0, 0xf6, + 0x50, 0x82, 0xe6, 0x88, 0x5d, 0x9d, 0x4c, 0xc0, 0xfb, 0x54, 0x77, 0x2f, 0x95, 0x0c, 0x7c, 0x36, + 0xc4, 0x02, 0x00, 0xd9, 0xbd, 0x23, 0x3c, 0x0b, 0x20, 0x15, 0x2a, 0x0f, 0xce, 0x33, 0x48, 0x7d, + 0x26, 0xa1, 0x50, 0x01, 0xaa, 0x05, 0xe9, 0x21, 0xa5, 0x10, 0x14, 0x5c, 0xa8, 0x09, 0x2c, 0x04, + 0x27, 0xa3, 0x15, 0x82, 0x3f, 0x20, 0x85, 0xe0, 0x7a, 0x77, 0xd2, 0x0a, 0x41, 0xea, 0xbb, 0x77, + 0x84, 0x56, 0x83, 0xa3, 0x60, 0x14, 0x8c, 0x82, 0x91, 0x0a, 0x00, 0x52, 0xd0, 0x0d, 0xf8, 0xc1, + 0xaa, 0x4a, 0xe4, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82, +}; + +const BITMAP_OPAQUE stroke_dashdot_xpm[1] = {{ png, sizeof( png ), "stroke_dashdot_xpm" }}; + +//EOF diff --git a/bitmaps_png/cpp_other/stroke_dot.cpp b/bitmaps_png/cpp_other/stroke_dot.cpp new file mode 100644 index 0000000000..ce2d05bc26 --- /dev/null +++ b/bitmaps_png/cpp_other/stroke_dot.cpp @@ -0,0 +1,31 @@ + +/* Do not modify this file, it was automatically generated by the + * PNG2cpp CMake script, using a *.png file as input. + */ + +#include + +static const unsigned char png[] = { + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, + 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x10, 0x08, 0x06, 0x00, 0x00, 0x00, 0xa6, 0xe7, 0x79, + 0x29, 0x00, 0x00, 0x00, 0xda, 0x49, 0x44, 0x41, 0x54, 0x58, 0xc3, 0x63, 0x60, 0x18, 0x05, 0xa3, + 0x60, 0x14, 0x8c, 0x02, 0x04, 0x60, 0x04, 0x62, 0x6e, 0x24, 0xcc, 0x48, 0x23, 0x3d, 0x20, 0xc0, + 0x8e, 0xa4, 0x87, 0x7d, 0x60, 0xdd, 0xc7, 0x9d, 0xc5, 0xc3, 0x20, 0x72, 0xac, 0x80, 0x41, 0xfc, + 0xe1, 0x05, 0x06, 0xa9, 0x2f, 0xff, 0xe1, 0x18, 0xc4, 0x07, 0x89, 0x83, 0xe4, 0xa9, 0xa1, 0x07, + 0x04, 0x84, 0x56, 0x59, 0x32, 0x88, 0xdd, 0x58, 0xc0, 0x20, 0xf9, 0xf6, 0x33, 0x5c, 0x0f, 0x88, + 0x0d, 0x12, 0x13, 0x5c, 0x61, 0x81, 0x55, 0x0f, 0xcd, 0xdd, 0x27, 0x7a, 0x7e, 0x2a, 0x83, 0xf4, + 0xff, 0xff, 0x38, 0x31, 0x48, 0x1e, 0x1d, 0x90, 0xa3, 0x47, 0x60, 0x8e, 0x3a, 0x83, 0xe4, 0xc7, + 0x0f, 0x38, 0xf5, 0x80, 0xe4, 0x40, 0x6a, 0xa8, 0x61, 0x17, 0x09, 0x7a, 0x98, 0x18, 0x24, 0x9e, + 0xbe, 0xc0, 0xab, 0x18, 0x24, 0x0f, 0x52, 0x87, 0x00, 0xe4, 0xe8, 0x01, 0x3a, 0xea, 0x54, 0x09, + 0x5e, 0x3d, 0x60, 0x87, 0x01, 0xd5, 0xa0, 0x02, 0x9a, 0xbb, 0x8f, 0x08, 0xc5, 0xcf, 0xc8, 0xb0, + 0xe0, 0x19, 0x1d, 0x03, 0x80, 0x52, 0xf7, 0x0d, 0x9e, 0x2c, 0xf0, 0x7e, 0x20, 0xb2, 0x00, 0x52, + 0x81, 0xf1, 0xe0, 0x3c, 0x83, 0xd4, 0x67, 0x68, 0x81, 0x01, 0xa4, 0x41, 0x7c, 0x82, 0x85, 0x0c, + 0x09, 0x7a, 0x40, 0x00, 0x54, 0xd0, 0x89, 0xdd, 0x98, 0x8f, 0xa5, 0x10, 0x9c, 0x4f, 0xb8, 0x10, + 0xa4, 0xbd, 0xfb, 0x46, 0x68, 0x35, 0x38, 0x0a, 0x46, 0xc1, 0x28, 0x18, 0xa9, 0x00, 0x00, 0xba, + 0xdf, 0xf2, 0x05, 0x94, 0xde, 0xe7, 0x97, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, + 0x42, 0x60, 0x82, +}; + +const BITMAP_OPAQUE stroke_dot_xpm[1] = {{ png, sizeof( png ), "stroke_dot_xpm" }}; + +//EOF diff --git a/bitmaps_png/cpp_other/stroke_solid.cpp b/bitmaps_png/cpp_other/stroke_solid.cpp new file mode 100644 index 0000000000..b04af630b5 --- /dev/null +++ b/bitmaps_png/cpp_other/stroke_solid.cpp @@ -0,0 +1,25 @@ + +/* Do not modify this file, it was automatically generated by the + * PNG2cpp CMake script, using a *.png file as input. + */ + +#include + +static const unsigned char png[] = { + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, + 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x10, 0x08, 0x06, 0x00, 0x00, 0x00, 0xa6, 0xe7, 0x79, + 0x29, 0x00, 0x00, 0x00, 0x79, 0x49, 0x44, 0x41, 0x54, 0x58, 0xc3, 0x63, 0x60, 0x18, 0x05, 0xa3, + 0x60, 0x14, 0x8c, 0x02, 0x04, 0x60, 0x02, 0x62, 0xee, 0x61, 0x8e, 0x99, 0x30, 0xbd, 0xcd, 0x9d, + 0xc5, 0xc3, 0x20, 0x7a, 0x7e, 0x2a, 0x83, 0xc4, 0xb3, 0x17, 0x0c, 0x52, 0x5f, 0xfe, 0x0f, 0x6b, + 0x0c, 0xf2, 0xa3, 0xd8, 0x85, 0xa9, 0x60, 0x3f, 0xc3, 0x81, 0xc8, 0xb1, 0x02, 0x06, 0xe9, 0xff, + 0xff, 0x47, 0x14, 0x06, 0xf9, 0x19, 0x0a, 0x18, 0x19, 0xc4, 0x1f, 0x5c, 0x18, 0x71, 0x01, 0x00, + 0xf2, 0x33, 0xc8, 0xef, 0x90, 0x00, 0x78, 0x38, 0xa2, 0x03, 0x60, 0xc4, 0x67, 0x01, 0xa4, 0x42, + 0xf0, 0x29, 0xb0, 0x10, 0xfc, 0x3c, 0x8c, 0x0b, 0x41, 0xa0, 0xdf, 0x40, 0x7e, 0x04, 0xf9, 0x15, + 0xa5, 0x10, 0x1c, 0xf1, 0xd5, 0xe0, 0x28, 0x18, 0x05, 0xa3, 0x60, 0xa4, 0x02, 0x00, 0xa5, 0x1e, + 0xfd, 0xde, 0x95, 0x35, 0x0a, 0xb9, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, + 0x60, 0x82, +}; + +const BITMAP_OPAQUE stroke_solid_xpm[1] = {{ png, sizeof( png ), "stroke_solid_xpm" }}; + +//EOF diff --git a/bitmaps_png/include/bitmaps_png/bitmaps_list.h b/bitmaps_png/include/bitmaps_png/bitmaps_list.h index d49a145d44..9784b36c49 100644 --- a/bitmaps_png/include/bitmaps_png/bitmaps_list.h +++ b/bitmaps_png/include/bitmaps_png/bitmaps_list.h @@ -375,6 +375,7 @@ EXTERN_BITMAP( ps_diff_pair_tune_phase_xpm ) EXTERN_BITMAP( ps_diff_pair_via_gap_xpm ) EXTERN_BITMAP( ps_tune_length_xpm ) EXTERN_BITMAP( py_script_xpm ) +EXTERN_BITMAP( question_mark_xpm ) EXTERN_BITMAP( ratsnest_xpm ) EXTERN_BITMAP( read_setup_xpm ) EXTERN_BITMAP( recent_xpm ) @@ -437,6 +438,10 @@ EXTERN_BITMAP( small_library_xpm ) EXTERN_BITMAP( small_plus_xpm ) EXTERN_BITMAP( small_up_xpm ) EXTERN_BITMAP( spreadsheet_xpm ) +EXTERN_BITMAP( stroke_dash_xpm ) +EXTERN_BITMAP( stroke_dashdot_xpm ) +EXTERN_BITMAP( stroke_dot_xpm ) +EXTERN_BITMAP( stroke_solid_xpm ) EXTERN_BITMAP( svg_file_xpm ) EXTERN_BITMAP( swap_layer_xpm ) EXTERN_BITMAP( text_xpm ) diff --git a/bitmaps_png/sources/question_mark.svg b/bitmaps_png/sources/question_mark.svg new file mode 100644 index 0000000000..dee5ed8d9e --- /dev/null +++ b/bitmaps_png/sources/question_mark.svg @@ -0,0 +1,38 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bitmaps_png/sources/stroke_dash.svg b/bitmaps_png/sources/stroke_dash.svg new file mode 100644 index 0000000000..b1de3ae317 --- /dev/null +++ b/bitmaps_png/sources/stroke_dash.svg @@ -0,0 +1,40 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bitmaps_png/sources/stroke_dashdot.svg b/bitmaps_png/sources/stroke_dashdot.svg new file mode 100644 index 0000000000..ccfdc0dc68 --- /dev/null +++ b/bitmaps_png/sources/stroke_dashdot.svg @@ -0,0 +1,40 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bitmaps_png/sources/stroke_dot.svg b/bitmaps_png/sources/stroke_dot.svg new file mode 100644 index 0000000000..5ba2db3c75 --- /dev/null +++ b/bitmaps_png/sources/stroke_dot.svg @@ -0,0 +1,42 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bitmaps_png/sources/stroke_solid.svg b/bitmaps_png/sources/stroke_solid.svg new file mode 100644 index 0000000000..a623e93baf --- /dev/null +++ b/bitmaps_png/sources/stroke_solid.svg @@ -0,0 +1,38 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/eeschema/dialogs/dialog_edit_line_style.cpp b/eeschema/dialogs/dialog_edit_line_style.cpp index 9c4d349060..3b3c29bce3 100644 --- a/eeschema/dialogs/dialog_edit_line_style.cpp +++ b/eeschema/dialogs/dialog_edit_line_style.cpp @@ -22,29 +22,50 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -#include -#include +#include #include -#include #include +#include +#include const int BUTT_COLOR_MINSIZE_X = 32; const int BUTT_COLOR_MINSIZE_Y = 20; -DIALOG_EDIT_LINE_STYLE::DIALOG_EDIT_LINE_STYLE( SCH_EDIT_FRAME* aParent, SCH_LINE* aLine ) : - DIALOG_EDIT_LINE_STYLE_BASE( aParent ), - m_frame( aParent ), - m_line( aLine ), - m_width( aParent, m_staticTextWidth, m_lineWidth, m_staticWidthUnits, true ) + +struct lineTypeStruct +{ + wxString name; + const BITMAP_OPAQUE* bitmap; +}; + + +/* + * Conversion map between PLOT_DASH_TYPE values and style names displayed + */ +const std::map lineTypeNames = { + { PLOT_DASH_TYPE::SOLID, { _( "Solid" ), stroke_solid_xpm } }, + { PLOT_DASH_TYPE::DASH, { _( "Dashed" ), stroke_dash_xpm } }, + { PLOT_DASH_TYPE::DOT, { _( "Dotted" ), stroke_dot_xpm } }, + { PLOT_DASH_TYPE::DASHDOT, { _( "Dash-Dot" ), stroke_dashdot_xpm } }, +}; + + +DIALOG_EDIT_LINE_STYLE::DIALOG_EDIT_LINE_STYLE( + SCH_EDIT_FRAME* aParent, std::deque& lines ) + : DIALOG_EDIT_LINE_STYLE_BASE( aParent ), + m_frame( aParent ), + m_lines( lines ), + m_width( aParent, m_staticTextWidth, m_lineWidth, m_staticWidthUnits, true ) { m_sdbSizerApply->SetLabel( _( "Default" ) ); - wxBitmap bitmap( std::max( m_colorButton->GetSize().x, BUTT_COLOR_MINSIZE_X ), - std::max( m_colorButton->GetSize().y, BUTT_COLOR_MINSIZE_Y ) ); - m_colorButton->SetBitmap( bitmap ); - SetInitialFocus( m_lineWidth ); + for( auto& typeEntry : lineTypeNames ) + { + m_typeCombo->Append( typeEntry.second.name, KiBitmap( typeEntry.second.bitmap ) ); + } + m_sdbSizerOK->SetDefault(); // Now all widgets have the size fixed, call FinishDialogSettings @@ -54,9 +75,49 @@ DIALOG_EDIT_LINE_STYLE::DIALOG_EDIT_LINE_STYLE( SCH_EDIT_FRAME* aParent, SCH_LIN bool DIALOG_EDIT_LINE_STYLE::TransferDataToWindow() { - m_width.SetValue( m_line->GetPenSize() ); - setColor( m_line->GetLineColor() ); - m_lineStyle->SetSelection( static_cast( m_line->GetLineStyle() ) ); + auto first_line = m_lines.front(); + + if( std::all_of( m_lines.begin() + 1, m_lines.end(), + [&]( const SCH_LINE* r ) + { + return r->GetPenSize() == first_line->GetPenSize(); + } ) ) + { + m_width.SetValue( first_line->GetPenSize() ); + } + else + { + m_width.SetValue( INDETERMINATE ); + } + + if( std::all_of( m_lines.begin() + 1, m_lines.end(), + [&]( const SCH_LINE* r ) + { + return r->GetLineColor() == first_line->GetLineColor(); + } ) ) + { + setColor( first_line->GetLineColor() ); + } + else + { + setColor( COLOR4D::UNSPECIFIED ); + } + + if( std::all_of( m_lines.begin() + 1, m_lines.end(), + [&]( const SCH_LINE* r ) + { + return r->GetLineStyle() == first_line->GetLineStyle(); + } ) ) + { + int style = static_cast( first_line->GetLineStyle() ); + wxCHECK_MSG( style < lineTypeNames.size(), false, + "Line type for first line is not found in the type lookup map" ); + m_typeCombo->SetSelection( style ); + } + else + { + m_typeCombo->SetSelection( wxNOT_FOUND ); + } return true; } @@ -64,7 +125,7 @@ bool DIALOG_EDIT_LINE_STYLE::TransferDataToWindow() void DIALOG_EDIT_LINE_STYLE::onColorButtonClicked( wxCommandEvent& event ) { - COLOR4D newColor = COLOR4D::UNSPECIFIED; + COLOR4D newColor = COLOR4D::UNSPECIFIED; DIALOG_COLOR_PICKER dialog( this, m_selectedColor, false ); if( dialog.ShowModal() == wxID_OK ) @@ -74,25 +135,36 @@ void DIALOG_EDIT_LINE_STYLE::onColorButtonClicked( wxCommandEvent& event ) return; setColor( newColor ); - } + void DIALOG_EDIT_LINE_STYLE::updateColorButton( COLOR4D& aColor ) { wxMemoryDC iconDC; - wxBitmap bitmap = m_colorButton->GetBitmapLabel(); - iconDC.SelectObject( bitmap ); - iconDC.SetPen( *wxBLACK_PEN ); - wxBrush brush( aColor.ToColour() ); - iconDC.SetBrush( brush ); + if( aColor == COLOR4D::UNSPECIFIED ) + { + m_colorButton->SetBitmap( KiBitmap( question_mark_xpm ) ); + } + else + { + wxBitmap bitmap( std::max( m_colorButton->GetSize().x, BUTT_COLOR_MINSIZE_X ), + std::max( m_colorButton->GetSize().y, BUTT_COLOR_MINSIZE_Y ) ); - // Paint the full bitmap in aColor: - iconDC.SetBackground( brush ); - iconDC.Clear(); + iconDC.SelectObject( bitmap ); + iconDC.SetPen( *wxBLACK_PEN ); + + wxBrush brush( aColor.ToColour() ); + iconDC.SetBrush( brush ); + + // Paint the full bitmap in aColor: + iconDC.SetBackground( brush ); + iconDC.Clear(); + + m_colorButton->SetBitmap( bitmap ); + } - m_colorButton->SetBitmapLabel( bitmap ); m_colorButton->Refresh(); Refresh( false ); @@ -101,9 +173,14 @@ void DIALOG_EDIT_LINE_STYLE::updateColorButton( COLOR4D& aColor ) void DIALOG_EDIT_LINE_STYLE::resetDefaults( wxCommandEvent& event ) { - m_width.SetValue( m_line->GetDefaultWidth() ); - setColor( m_line->GetDefaultColor() ); - m_lineStyle->SetSelection( static_cast( m_line->GetDefaultStyle() ) ); + m_width.SetValue( m_lines.front()->GetDefaultWidth() ); + setColor( m_lines.front()->GetDefaultColor() ); + + auto typeIt = lineTypeNames.find( m_lines.front()->GetDefaultStyle() ); + wxCHECK_RET( typeIt != lineTypeNames.end(), + "Default line type not found line dialogs line type lookup map" ); + + m_typeCombo->SetSelection( static_cast( typeIt->first ) ); Refresh(); } @@ -117,13 +194,35 @@ void DIALOG_EDIT_LINE_STYLE::setColor( const COLOR4D& aColor ) bool DIALOG_EDIT_LINE_STYLE::TransferDataFromWindow() { - m_frame->SaveCopyInUndoList( m_line, UR_CHANGED ); + for( auto& line : m_lines ) + { + m_frame->SaveCopyInUndoList( line, UR_CHANGED ); - m_line->SetLineWidth( m_width.GetValue() ); - m_line->SetLineStyle( m_lineStyle->GetSelection() ); - m_line->SetLineColor( m_selectedColor ); + if( !m_width.IsIndeterminate() ) + { + line->SetLineWidth( m_width.GetValue() ); + } + + if( m_typeCombo->GetSelection() != wxNOT_FOUND ) + { + int selection = m_typeCombo->GetSelection(); + wxCHECK_MSG( selection < lineTypeNames.size(), false, + "Selected line type index exceeds size of line type lookup map" ); + + auto it = lineTypeNames.begin(); + std::advance( it, selection ); + + line->SetLineStyle( it->first ); + } + + if( m_selectedColor != COLOR4D::UNSPECIFIED ) + { + line->SetLineColor( m_selectedColor ); + } + + m_frame->RefreshItem( line ); + } - m_frame->RefreshItem( m_line ); m_frame->GetCanvas()->Refresh(); m_frame->OnModify(); diff --git a/eeschema/dialogs/dialog_edit_line_style.h b/eeschema/dialogs/dialog_edit_line_style.h index 5823493e10..bdcc99a3f9 100644 --- a/eeschema/dialogs/dialog_edit_line_style.h +++ b/eeschema/dialogs/dialog_edit_line_style.h @@ -36,14 +36,14 @@ class SCH_LINE; class DIALOG_EDIT_LINE_STYLE : public DIALOG_EDIT_LINE_STYLE_BASE { public: - DIALOG_EDIT_LINE_STYLE( SCH_EDIT_FRAME* aParent, SCH_LINE* aLine ); + DIALOG_EDIT_LINE_STYLE( SCH_EDIT_FRAME* aParent, std::deque& lines ); bool TransferDataToWindow() override; bool TransferDataFromWindow() override; private: - SCH_EDIT_FRAME* m_frame; - SCH_LINE* m_line; + SCH_EDIT_FRAME* m_frame; + std::deque m_lines; UNIT_BINDER m_width; COLOR4D m_selectedColor; diff --git a/eeschema/dialogs/dialog_edit_line_style_base.cpp b/eeschema/dialogs/dialog_edit_line_style_base.cpp index 56a6aa8246..66d129e45d 100644 --- a/eeschema/dialogs/dialog_edit_line_style_base.cpp +++ b/eeschema/dialogs/dialog_edit_line_style_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Apr 19 2018) +// C++ code generated with wxFormBuilder (version Oct 26 2018) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -17,63 +17,65 @@ END_EVENT_TABLE() DIALOG_EDIT_LINE_STYLE_BASE::DIALOG_EDIT_LINE_STYLE_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style ) { this->SetSizeHints( wxDefaultSize, wxDefaultSize ); - + wxBoxSizer* mainSizer; mainSizer = new wxBoxSizer( wxVERTICAL ); - - wxBoxSizer* bSizerUpper; - bSizerUpper = new wxBoxSizer( wxHORIZONTAL ); - - wxStaticBoxSizer* sbSizerGeneral; - sbSizerGeneral = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("General:") ), wxVERTICAL ); - + + + mainSizer->Add( 0, 0, 1, wxEXPAND, 5 ); + wxFlexGridSizer* fgSizerGeneral; fgSizerGeneral = new wxFlexGridSizer( 0, 3, 0, 0 ); fgSizerGeneral->AddGrowableCol( 1 ); fgSizerGeneral->SetFlexibleDirection( wxBOTH ); fgSizerGeneral->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); - - m_staticTextWidth = new wxStaticText( sbSizerGeneral->GetStaticBox(), wxID_ANY, _("Width:"), wxDefaultPosition, wxDefaultSize, 0 ); + + m_staticTextWidth = new wxStaticText( this, wxID_ANY, _("Width:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextWidth->Wrap( -1 ); fgSizerGeneral->Add( m_staticTextWidth, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 ); - - m_lineWidth = new wxTextCtrl( sbSizerGeneral->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( -1,-1 ), 0 ); + + m_lineWidth = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( -1,-1 ), 0 ); m_lineWidth->SetMinSize( wxSize( 80,-1 ) ); - + fgSizerGeneral->Add( m_lineWidth, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 3 ); - - m_staticWidthUnits = new wxStaticText( sbSizerGeneral->GetStaticBox(), wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 ); + + m_staticWidthUnits = new wxStaticText( this, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticWidthUnits->Wrap( -1 ); - fgSizerGeneral->Add( m_staticWidthUnits, 0, wxALIGN_CENTER_VERTICAL|wxALL, 1 ); - - m_staticText5 = new wxStaticText( sbSizerGeneral->GetStaticBox(), wxID_ANY, _("Color:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticWidthUnits->SetMinSize( wxSize( 40,-1 ) ); + + fgSizerGeneral->Add( m_staticWidthUnits, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 ); + + m_staticText5 = new wxStaticText( this, wxID_ANY, _("Color:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText5->Wrap( -1 ); fgSizerGeneral->Add( m_staticText5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - - m_colorButton = new wxBitmapButton( sbSizerGeneral->GetStaticBox(), idColorBtn, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW ); - fgSizerGeneral->Add( m_colorButton, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); - - - sbSizerGeneral->Add( fgSizerGeneral, 3, wxEXPAND, 5 ); - - - bSizerUpper->Add( sbSizerGeneral, 3, wxALL|wxEXPAND, 5 ); - - wxString m_lineStyleChoices[] = { _("Solid"), _("Dashed"), _("Dotted"), _("Dash-Dot") }; - int m_lineStyleNChoices = sizeof( m_lineStyleChoices ) / sizeof( wxString ); - m_lineStyle = new wxRadioBox( this, wxID_ANY, _("Line Style:"), wxDefaultPosition, wxDefaultSize, m_lineStyleNChoices, m_lineStyleChoices, 4, wxRA_SPECIFY_ROWS ); - m_lineStyle->SetSelection( 1 ); - bSizerUpper->Add( m_lineStyle, 2, wxALL|wxEXPAND, 5 ); - - - mainSizer->Add( bSizerUpper, 0, wxEXPAND, 5 ); - - + + m_colorButton = new wxBitmapButton( this, idColorBtn, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 ); + + m_colorButton->SetBitmap( wxNullBitmap ); + fgSizerGeneral->Add( m_colorButton, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 3 ); + + m_staticText4 = new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText4->Wrap( -1 ); + fgSizerGeneral->Add( m_staticText4, 0, wxALL, 5 ); + + m_staticText51 = new wxStaticText( this, wxID_ANY, _("Type:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText51->Wrap( -1 ); + fgSizerGeneral->Add( m_staticText51, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + + m_typeCombo = new wxBitmapComboBox( this, wxID_ANY, _("Combo!"), wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY ); + m_typeCombo->SetMinSize( wxSize( 140,-1 ) ); + + fgSizerGeneral->Add( m_typeCombo, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 3 ); + + + mainSizer->Add( fgSizerGeneral, 3, wxEXPAND, 5 ); + + mainSizer->Add( 0, 0, 1, wxALL|wxEXPAND, 1 ); - + m_staticline = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); mainSizer->Add( m_staticline, 0, wxEXPAND | wxALL, 5 ); - + m_sdbSizer = new wxStdDialogButtonSizer(); m_sdbSizerOK = new wxButton( this, wxID_OK ); m_sdbSizer->AddButton( m_sdbSizerOK ); @@ -82,13 +84,13 @@ DIALOG_EDIT_LINE_STYLE_BASE::DIALOG_EDIT_LINE_STYLE_BASE( wxWindow* parent, wxWi m_sdbSizerCancel = new wxButton( this, wxID_CANCEL ); m_sdbSizer->AddButton( m_sdbSizerCancel ); m_sdbSizer->Realize(); - + mainSizer->Add( m_sdbSizer, 0, wxALL|wxALIGN_RIGHT, 5 ); - - + + this->SetSizer( mainSizer ); this->Layout(); - + this->Centre( wxBOTH ); } diff --git a/eeschema/dialogs/dialog_edit_line_style_base.fbp b/eeschema/dialogs/dialog_edit_line_style_base.fbp index ccccfc810a..908d77f909 100644 --- a/eeschema/dialogs/dialog_edit_line_style_base.fbp +++ b/eeschema/dialogs/dialog_edit_line_style_base.fbp @@ -1,6 +1,6 @@ - + C++ @@ -45,50 +45,14 @@ DIALOG_EDIT_LINE_STYLE_BASE - 298,204 - wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER + 325,180 + wxDEFAULT_DIALOG_STYLE DIALOG_SHIM; dialog_shim.h Line Style - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - mainSizer @@ -97,483 +61,34 @@ 5 wxEXPAND - 0 - + 1 + + 0 + protected + 0 + + + + 5 + wxEXPAND + 3 + + 3 + wxBOTH + 1 + + 0 - bSizerUpper - wxHORIZONTAL + fgSizerGeneral + wxFLEX_GROWMODE_SPECIFIED none - - 5 - wxALL|wxEXPAND - 3 - - wxID_ANY - General: - - sbSizerGeneral - wxVERTICAL - 1 - none - - - 5 - wxEXPAND - 3 - - 3 - wxBOTH - 1 - - 0 - - fgSizerGeneral - wxFLEX_GROWMODE_SPECIFIED - none - 0 - 0 - - 3 - wxALIGN_CENTER_VERTICAL|wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Width: - - 0 - - - 0 - - 1 - m_staticTextWidth - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 3 - wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - 0 - 20,-1 - 0 - 80,-1 - 1 - m_lineWidth - 1 - - - protected - 1 - - Resizable - 1 - -1,-1 - - - 0 - - bool - wxFILTER_NUMERIC - wxDefaultValidator - m_isValid - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1 - wxALIGN_CENTER_VERTICAL|wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - unit - - 0 - - - 0 - - 1 - m_staticWidthUnits - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALIGN_CENTER_VERTICAL|wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Color: - - 0 - - - 0 - - 1 - m_staticText5 - 1 - - - protected - 1 - - Resizable - 1 - - - ; forward_declare - 0 - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - - - Load From File; - - 1 - 0 - 1 - - 1 - 0 - 0 - - Dock - 0 - Left - 1 - - 1 - - - 0 - 0 - - idColorBtn - MyButton - - 0 - - - 0 - - 1 - m_colorButton - 1 - - - protected - 1 - - Resizable - - 1 - - wxBU_AUTODRAW - ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - onColorButtonClicked - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + 0 + 0 - 5 - wxALL|wxEXPAND - 2 - + 3 + wxALIGN_CENTER_VERTICAL|wxALL + 0 + 1 1 1 @@ -587,7 +102,6 @@ 1 0 - "Solid" "Dashed" "Dotted" "Dash-Dot" 1 1 @@ -602,8 +116,8 @@ 0 0 wxID_ANY - Line Style: - 4 + Width: + 0 0 @@ -611,7 +125,7 @@ 0 1 - m_lineStyle + m_staticTextWidth 1 @@ -619,10 +133,264 @@ 1 Resizable - 1 1 - wxRA_SPECIFY_ROWS + + + 0 + + + + + -1 + + + + 3 + wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + -1,-1 + 0 + 80,-1 + 1 + m_lineWidth + 1 + + + protected + 1 + + Resizable + 1 + -1,-1 + + + 0 + + bool + wxFILTER_NUMERIC + wxDefaultValidator + m_isValid + + + + + + + + 3 + wxALIGN_CENTER_VERTICAL|wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + unit + 0 + + 0 + + + 0 + 40,-1 + 1 + m_staticWidthUnits + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + 5 + wxALIGN_CENTER_VERTICAL|wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Color: + 0 + + 0 + + + 0 + + 1 + m_staticText5 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; Not forward_declare + 0 + + + + + -1 + + + + 3 + wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + Load From File; + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 1 + + 1 + + + 0 + 0 + idColorBtn + MyButton + + 0 + + 0 + + + 0 + + 1 + m_colorButton + 1 + + + protected + 1 + + + + Resizable + 1 + + ; forward_declare 0 @@ -633,30 +401,194 @@ - - - - - - - - - - - - - - - - - - - - - - - - + onColorButtonClicked + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + + 0 + + 1 + m_staticText4 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxALIGN_CENTER_VERTICAL|wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Type: + 0 + + 0 + + + 0 + + 1 + m_staticText51 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 3 + wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + 140,-1 + 1 + m_typeCombo + 1 + + + protected + 1 + + Resizable + -1 + 1 + + wxCB_READONLY + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + Combo! + + + @@ -727,29 +659,6 @@ - - - - - - - - - - - - - - - - - - - - - - - @@ -769,13 +678,6 @@ m_sdbSizer protected resetDefaults - - - - - - - diff --git a/eeschema/dialogs/dialog_edit_line_style_base.h b/eeschema/dialogs/dialog_edit_line_style_base.h index f26b638795..1ddcc316c3 100644 --- a/eeschema/dialogs/dialog_edit_line_style_base.h +++ b/eeschema/dialogs/dialog_edit_line_style_base.h @@ -1,12 +1,11 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Apr 19 2018) +// C++ code generated with wxFormBuilder (version Oct 26 2018) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! /////////////////////////////////////////////////////////////////////////// -#ifndef __DIALOG_EDIT_LINE_STYLE_BASE_H__ -#define __DIALOG_EDIT_LINE_STYLE_BASE_H__ +#pragma once #include #include @@ -19,14 +18,13 @@ #include #include #include +#include #include #include #include -#include #include +#include #include -#include -#include #include #include @@ -39,41 +37,42 @@ class DIALOG_EDIT_LINE_STYLE_BASE : public DIALOG_SHIM { DECLARE_EVENT_TABLE() private: - + // Private event handlers void _wxFB_onColorButtonClicked( wxCommandEvent& event ){ onColorButtonClicked( event ); } void _wxFB_resetDefaults( wxCommandEvent& event ){ resetDefaults( event ); } - - + + protected: enum { idColorBtn = 1000 }; - + wxStaticText* m_staticTextWidth; wxTextCtrl* m_lineWidth; wxStaticText* m_staticWidthUnits; wxStaticText* m_staticText5; wxBitmapButton* m_colorButton; - wxRadioBox* m_lineStyle; + wxStaticText* m_staticText4; + wxStaticText* m_staticText51; + wxBitmapComboBox* m_typeCombo; wxStaticLine* m_staticline; wxStdDialogButtonSizer* m_sdbSizer; wxButton* m_sdbSizerOK; wxButton* m_sdbSizerApply; wxButton* m_sdbSizerCancel; - + // Virtual event handlers, overide them in your derived class virtual void onColorButtonClicked( wxCommandEvent& event ) { event.Skip(); } virtual void resetDefaults( wxCommandEvent& event ) { event.Skip(); } - - + + public: - bool m_isValid; - - DIALOG_EDIT_LINE_STYLE_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Line Style"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 298,204 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + bool m_isValid; + + DIALOG_EDIT_LINE_STYLE_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Line Style"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 325,180 ), long style = wxDEFAULT_DIALOG_STYLE ); ~DIALOG_EDIT_LINE_STYLE_BASE(); - + }; -#endif //__DIALOG_EDIT_LINE_STYLE_BASE_H__ diff --git a/eeschema/tools/sch_edit_tool.cpp b/eeschema/tools/sch_edit_tool.cpp index b47638d29b..a4bff8b1e2 100644 --- a/eeschema/tools/sch_edit_tool.cpp +++ b/eeschema/tools/sch_edit_tool.cpp @@ -176,7 +176,9 @@ bool SCH_EDIT_TOOL::Init() }; auto propertiesCondition = []( const SELECTION& aSel ) { - if( aSel.GetSize() != 1 ) + if( aSel.GetSize() != 1 + && !( aSel.GetSize() >= 1 && aSel.Front()->Type() == SCH_LINE_T + && aSel.AreAllItemsIdentical() ) ) return false; auto item = static_cast( aSel.Front() ); @@ -192,12 +194,25 @@ bool SCH_EDIT_TOOL::Init() return false; case SCH_LINE_T: { - SCH_LINE* line = static_cast( item ); - - assert( line != nullptr ); + const std::deque items = aSel.GetItems(); + if( !std::all_of( items.begin(), items.end(), + [&]( const EDA_ITEM* item ) + { + const SCH_LINE* line = dynamic_cast( item ); + if ( line == nullptr ) + { + wxLogWarning( + "Non-line object encountered in selection, this shouldn't have bypassed the preceeding check" ); + return false; + } + return line->IsGraphicLine(); + } ) ) + { + return false; + } // Only graphic lines support properties in the file format - return line->IsGraphicLine(); + return true; } default: return true; @@ -1297,7 +1312,22 @@ int SCH_EDIT_TOOL::Properties( const TOOL_EVENT& aEvent ) if( !line->IsGraphicLine() ) break; - DIALOG_EDIT_LINE_STYLE dlg( m_frame, line ); + if( !selection.AreAllItemsIdentical() ) + break; + + std::deque lines; + for( auto item : selection.Items() ) + { + auto line = dynamic_cast( item ); + assert( line != nullptr ); + lines.push_back( line ); + } + + if( !std::all_of( lines.begin(), lines.end(), + [&]( const SCH_LINE* r ) { return r->IsGraphicLine(); } ) ) + break; + + DIALOG_EDIT_LINE_STYLE dlg( m_frame, lines ); if( dlg.ShowModal() == wxID_OK ) { @@ -1305,7 +1335,7 @@ int SCH_EDIT_TOOL::Properties( const TOOL_EVENT& aEvent ) m_frame->OnModify(); } } - break; + break; case SCH_MARKER_T: // These items have no properties to edit case SCH_JUNCTION_T: diff --git a/include/tool/selection.h b/include/tool/selection.h index e340b45fa1..ae97bffdbb 100644 --- a/include/tool/selection.h +++ b/include/tool/selection.h @@ -250,6 +250,20 @@ public: m_referencePoint = NULLOPT; } + /** + * Checks if all items in the selection are the same KICAD_T type + * + * @return True if all items are the same type, this includes zero or single items + */ + bool AreAllItemsIdentical() const + { + return ( std::all_of( m_items.begin() + 1, m_items.end(), + [&]( const EDA_ITEM* r ) + { + return r->Type() == m_items.front()->Type(); + } ) ); + } + protected: OPT m_referencePoint; std::deque m_items;