1 /* 2 * Copyright (c) 2016 Helmut Neemann 3 * Use of this source code is governed by the GPL v3 license 4 * that can be found in the LICENSE file. 5 */ 6 package de.neemann.digital.core.element; 7 8 import de.neemann.digital.analyse.expression.format.FormatToExpression; 9 import de.neemann.digital.core.IntFormat; 10 import de.neemann.digital.core.arithmetic.BarrelShifterMode; 11 import de.neemann.digital.core.arithmetic.LeftRightFormat; 12 import de.neemann.digital.core.extern.Application; 13 import de.neemann.digital.core.io.CommonConnectionType; 14 import de.neemann.digital.core.io.InValue; 15 import de.neemann.digital.core.memory.DataField; 16 import de.neemann.digital.core.memory.rom.ROMManger; 17 import de.neemann.digital.draw.graphics.Orientation; 18 import de.neemann.digital.draw.graphics.Style; 19 import de.neemann.digital.draw.library.ElementLibrary; 20 import de.neemann.digital.draw.model.InverterConfig; 21 import de.neemann.digital.draw.shapes.CustomCircuitShapeType; 22 import de.neemann.digital.draw.shapes.custom.CustomShapeDescription; 23 import de.neemann.digital.gui.components.data.ScopeTrigger; 24 import de.neemann.digital.testing.TestCaseDescription; 25 import de.neemann.gui.Screen; 26 import de.neemann.gui.language.Language; 27 28 import java.awt.*; 29 import java.io.File; 30 import java.lang.reflect.Field; 31 import java.lang.reflect.Modifier; 32 import java.util.HashMap; 33 import java.util.Locale; 34 35 /** 36 * Collection of key constants 37 */ 38 public final class Keys { 39 40 private static final class InstanceHolder { 41 private static final HashMap<String, Key> INSTANCE = createMap(); 42 createMap()43 private static HashMap<String, Key> createMap() { 44 HashMap<String, Key> map = new HashMap<>(); 45 for (Field k : Keys.class.getDeclaredFields()) { 46 if (Modifier.isStatic(k.getModifiers()) && Key.class.isAssignableFrom(k.getType())) { 47 try { 48 Key key = (Key) k.get(null); 49 map.put(key.getKey(), key); 50 } catch (IllegalAccessException e) { 51 throw new RuntimeException("error accessing the Keys"); 52 } 53 } 54 } 55 return map; 56 } 57 } 58 59 /** 60 * Returns the key of the given name. 61 * If key does not exist, null is returned. 62 * 63 * @param name the name of the key 64 * @return the key or null 65 */ getKeyByName(String name)66 public static Key getKeyByName(String name) { 67 return InstanceHolder.INSTANCE.get(name); 68 } 69 70 /** 71 * @return all available keys 72 */ getKeys()73 public static Iterable<Key> getKeys() { 74 return InstanceHolder.INSTANCE.values(); 75 } 76 77 Keys()78 private Keys() { 79 } 80 81 /** 82 * number of bits in simple gates like And and Or 83 */ 84 public static final Key.KeyBits BITS 85 = new Key.KeyBits("Bits", 1); 86 87 /** 88 * input bits of sign extender 89 */ 90 public static final Key.KeyBits INPUT_BITS 91 = new Key.KeyBits("inputBits", 8); 92 93 /** 94 * output bits of sign extender 95 */ 96 public static final Key.KeyBits OUTPUT_BITS 97 = new Key.KeyBits("outputBits", 16); 98 99 /** 100 * number of inputs in simple gates like And and Or 101 */ 102 public static final Key.KeyInteger INPUT_COUNT // needs to have the same default value as ADDR_BITS!!! see de.neemann.digital.gui.components.EditorFactory#DataFieldEditor 103 = new Key.KeyInteger("Inputs", 2) 104 .setComboBoxValues(2, 3, 4, 5) 105 .setMin(2); 106 107 108 /** 109 * The counter max value 110 */ 111 public static final Key.KeyInteger MAX_VALUE 112 = new Key.KeyInteger("maxValue", 0) 113 .setMin(0); 114 115 116 /** 117 * the delay time used by the delay component 118 */ 119 public static final Key.KeyInteger DELAY_TIME 120 = new Key.KeyInteger("delayTime", 1) 121 .setComboBoxValues(1, 2, 3, 4, 5) 122 .setMin(1) 123 .setMax(20); 124 125 /** 126 * the timer delay time 127 */ 128 public static final Key.KeyInteger MONOFLOP_DELAY 129 = new Key.KeyInteger("timerDelay", 1) 130 .setMin(1); 131 132 /** 133 * The elements label 134 */ 135 public static final Key<String> LABEL 136 = new Key<>("Label", ""); 137 138 139 /** 140 * The font size 141 */ 142 public static final Key<Integer> FONT_SIZE = 143 new Key.KeyInteger("textFontSize", Style.NORMAL.getFontSize()) 144 .setComboBoxValues(14, 17, 20, 24, 36, 48, 60) 145 .setMin(10) 146 .setMax(70); 147 148 /** 149 * text orientation 150 */ 151 public static final Key<Orientation> TEXT_ORIENTATION 152 = new Key.KeyEnum<>("textOrientation", Orientation.LEFTTOP, Orientation.values()).setSecondary(); 153 154 155 /** 156 * The size of a LED 157 */ 158 public static final Key<Integer> LED_SIZE 159 = new Key.KeyInteger("Size", 1) 160 .setComboBoxValues(0, 1, 2, 3, 4, 5) 161 .setMin(0) 162 .allowGroupEdit() 163 .setSecondary(); 164 165 /** 166 * The size of a seven seg display 167 */ 168 public static final Key<Integer> SEVEN_SEG_SIZE 169 = new Key.KeyInteger("Size", 2) 170 .setComboBoxValues(0, 1, 2, 3, 4, 5) 171 .setMin(0) 172 .allowGroupEdit(); 173 174 /** 175 * The value of constants 176 */ 177 public static final Key<Long> VALUE 178 = new Key<>("Value", 1L).setAdaptiveIntFormat().allowGroupEdit(); 179 180 /** 181 * The default value of elements 182 */ 183 public static final Key<Long> DEFAULT 184 = new Key<>("Default", 0L).allowGroupEdit().setSecondary(); 185 186 /** 187 * The default value of inputs 188 */ 189 public static final Key<InValue> INPUT_DEFAULT 190 = new Key<>("InDefault", new InValue(0)).setAdaptiveIntFormat().allowGroupEdit().setSecondary(); 191 192 /** 193 * The default value of the dip switch 194 */ 195 public static final Key<Boolean> DIP_DEFAULT 196 = new Key<>("dipDefault", false).allowGroupEdit().setSecondary(); 197 198 199 /** 200 * Color of LEDs 201 */ 202 public static final Key<java.awt.Color> COLOR 203 = new Key<>("Color", java.awt.Color.RED).allowGroupEdit(); 204 205 /** 206 * The input splitting of a splitter 207 */ 208 public static final Key<String> INPUT_SPLIT 209 = new Key<>("Input Splitting", "4,4"); 210 211 /** 212 * The output splitting of a splitter 213 */ 214 public static final Key<String> OUTPUT_SPLIT 215 = new Key<>("Output Splitting", "8"); 216 217 /** 218 * The splitter spreading 219 */ 220 public static final Key<Integer> SPLITTER_SPREADING 221 = new Key.KeyInteger("splitterSpreading", 1) 222 .setComboBoxValues(1, 2, 3, 4) 223 .setMin(1) 224 .setMax(10) 225 .setSecondary(); 226 227 228 /** 229 * flag to enable realtime mode at a clock 230 */ 231 public static final Key<Boolean> RUN_AT_REAL_TIME 232 = new Key<>("runRealTime", false); 233 234 /** 235 * inverts the output of a gate 236 */ 237 public static final Key<Boolean> INVERT_OUTPUT 238 = new Key<>("invertOutput", true); 239 240 /** 241 * The real time frequency of the clock 242 */ 243 public static final Key<Integer> FREQUENCY 244 = new Key.KeyInteger("Frequency", 1) 245 .setComboBoxValues(1, 2, 5, 10, 20, 50, 100, 200, 500, 5000, 50000, Integer.MAX_VALUE) 246 .setMin(1) 247 .setDependsOn(RUN_AT_REAL_TIME); 248 249 /** 250 * the bit count of a muxer or decoder 251 */ 252 public static final Key<Integer> SELECTOR_BITS 253 = new Key.KeyBits("Selector Bits", 1).setMax(8); 254 255 /** 256 * number of address bits of memory 257 */ 258 public static final Key<Integer> ADDR_BITS 259 = new Key.KeyBits("AddrBits", 2).setMax(24); // needs to have the same default value as INPUT_COUNT!!! see de.neemann.digital.gui.components.EditorFactory#DataFieldEditor 260 261 /** 262 * indicates a diode as blown fuse or as programmed 263 */ 264 public static final Key<Boolean> BLOWN 265 = new Key<>("Blown", false).allowGroupEdit(); 266 267 /** 268 * indicates a switch as closed or not 269 */ 270 public static final Key<Boolean> CLOSED 271 = new Key<>("Closed", false).allowGroupEdit(); 272 273 /** 274 * signed flag for comparator element 275 */ 276 public static final Key<Boolean> SIGNED 277 = new Key<>("Signed", false).allowGroupEdit(); 278 279 /** 280 * Selects if the reminder of the division is always positive 281 */ 282 public static final Key<Boolean> REMAINDER_POSITIVE 283 = new Key<>("remainderPositive", true).setDependsOn(SIGNED); 284 285 /** 286 * the data key for memory 287 */ 288 public static final Key<DataField> DATA 289 = new Key<>("Data", DataField::new); 290 291 /** 292 * flag for flipping selector pos in muxers, decoders and drivers 293 */ 294 public static final Key<Boolean> FLIP_SEL_POSITON 295 = new Key<>("flipSelPos", false).allowGroupEdit(); 296 297 /** 298 * the rotation of the elements 299 */ 300 public static final Key<Rotation> ROTATE 301 = new Key<>("rotation", new Rotation(0)).allowGroupEdit().setSecondary(); 302 303 /** 304 * the width of an element if it is included as nested element 305 */ 306 public static final Key.KeyInteger WIDTH 307 = new Key.KeyInteger("Width", 3) 308 .setMin(2); 309 310 /** 311 * defines the shape type of the custom circuit 312 */ 313 public static final Key<CustomCircuitShapeType> SHAPE_TYPE 314 = new Key.KeyEnum<>("shapeType", CustomCircuitShapeType.DEFAULT, CustomCircuitShapeType.values()).setSecondary(); 315 316 /** 317 * Defines the distance to the previous pin. Used by the layout shape type 318 */ 319 public static final Key.KeyInteger LAYOUT_SHAPE_DELTA 320 = new Key.KeyInteger("layoutShapeDelta", 0) 321 .setMin(0); 322 323 /** 324 * the width of an element if it is included as nested element 325 */ 326 public static final Key<Integer> HEIGHT 327 = new Key.KeyInteger("Height", 3) 328 .setMin(2) 329 .setSecondary() 330 .setDependsOn(SHAPE_TYPE, cst -> cst.equals(CustomCircuitShapeType.LAYOUT)); 331 332 /** 333 * width of the terminal 334 */ 335 public static final Key.KeyInteger TERM_WIDTH 336 = new Key.KeyInteger("termWidth", 50) 337 .setMin(10); 338 339 /** 340 * height of the terminal 341 */ 342 public static final Key.KeyInteger TERM_HEIGHT 343 = new Key.KeyInteger("termHeight", 25) 344 .setMin(5); 345 346 /** 347 * break timeout cycles 348 */ 349 public static final Key.KeyInteger CYCLES 350 = new Key.KeyInteger("Cycles", 100000) 351 .setComboBoxValues(1000, 10000, 100000, 1000000); 352 353 /** 354 * break enabled 355 */ 356 public static final Key<Boolean> ENABLED 357 = new Key<>("enabled", true) 358 .allowGroupEdit(); 359 360 /** 361 * flag to make a value a probe 362 */ 363 public static final Key<Boolean> VALUE_IS_PROBE 364 = new Key<>("valueIsProbe", false).allowGroupEdit().setSecondary(); 365 366 /** 367 * flag to set a ROM as program memory 368 */ 369 public static final Key<Boolean> IS_PROGRAM_MEMORY 370 = new Key<>("isProgramMemory", false).setSecondary(); 371 372 /** 373 * flag to set a ROM as program memory 374 */ 375 public static final Key<Boolean> IS_PROGRAM_COUNTER 376 = new Key<>("isProgramCounter", false).setSecondary(); 377 378 /** 379 * flag to enable the ROMs auto load function 380 */ 381 public static final Key<Boolean> AUTO_RELOAD_ROM 382 = new Key<>("autoReload", false).setSecondary(); 383 384 /** 385 * flag to show the data table window 386 */ 387 public static final Key<Boolean> SHOW_DATA_TABLE 388 = new Key<>("showDataTable", false).setSecondary(); 389 390 /** 391 * flag to show the data graph window 392 */ 393 public static final Key<Boolean> SHOW_DATA_GRAPH 394 = new Key<>("showDataGraph", false).setSecondary(); 395 396 /** 397 * flag to show the data graph window in single gate mode 398 */ 399 public static final Key<Boolean> SHOW_DATA_GRAPH_MICRO 400 = new Key<>("showDataGraphMicro", false).setSecondary(); 401 402 /** 403 * Used to add the value to the measurement graph 404 */ 405 public static final Key<Boolean> ADD_VALUE_TO_GRAPH 406 = new Key<>("addValueToGraph", true).allowGroupEdit().setSecondary(); 407 408 /** 409 * flag to enable the single gate mode in the embedded data view 410 */ 411 public static final Key<Boolean> MICRO_STEP 412 = new Key<>("microStep", false); 413 414 /** 415 * the max number of samples in the embedded data view 416 */ 417 public static final Key.KeyInteger MAX_STEP_COUNT 418 = new Key.KeyInteger("maxStepCount", 25) 419 .setMin(5); 420 421 /** 422 * flag to enable high z mode at an input 423 */ 424 public static final Key<Boolean> IS_HIGH_Z 425 = new Key<>("isHighZ", false).allowGroupEdit().setSecondary(); 426 427 /** 428 * flag to avoid active low at an input 429 */ 430 public static final Key<Boolean> AVOID_ACTIVE_LOW 431 = new Key<>("avoidActiveLow", false) 432 .setDependsOn(IS_HIGH_Z) 433 .allowGroupEdit() 434 .setSecondary(); 435 436 /** 437 * the description of an element 438 */ 439 public static final Key.LongString DESCRIPTION 440 = new Key.LongString("Description"); 441 442 /** 443 * A net name 444 */ 445 public static final Key<String> NETNAME 446 = new Key<>("NetName", ""); 447 448 /** 449 * shape setting 450 */ 451 public static final Key<Boolean> SETTINGS_IEEE_SHAPES 452 = new Key<>("IEEEShapes", !Locale.getDefault().getLanguage().equals(Locale.GERMAN.getLanguage())).setRequiresRestart(); 453 454 /** 455 * The GUI Language 456 */ 457 public static final Key<Language> SETTINGS_LANGUAGE 458 = new Key<>("Language", new Language()).setRequiresRestart(); 459 460 461 /** 462 * Default state of the tree view 463 */ 464 public static final Key<Boolean> SETTINGS_DEFAULT_TREESELECT 465 = new Key<>("defTreeSelect", false); 466 467 /** 468 * The GUI expression string representation 469 */ 470 public static final Key.KeyEnum<FormatToExpression> SETTINGS_EXPRESSION_FORMAT 471 = new Key.KeyEnum<>("ExpressionFormat", FormatToExpression.UNICODE, FormatToExpression.values(), true); 472 473 /** 474 * enables the grid 475 */ 476 public static final Key<Boolean> SETTINGS_GRID 477 = new Key<>("grid", true).setRequiresRepaint(); 478 479 /** 480 * enables the wire bits view 481 */ 482 public static final Key<Boolean> SETTINGS_SHOW_WIRE_BITS 483 = new Key<>("showWireBits", false); 484 485 /** 486 * enables the MAC mouse mode 487 */ 488 public static final Key<Boolean> SETTINGS_MAC_MOUSE 489 = new Key<>("macMouse", Screen.isMac()).setRequiresRestart().setSecondary(); 490 491 /** 492 * enables tunnel rename dialog 493 */ 494 public static final Key<Boolean> SETTINGS_SHOW_TUNNEL_RENAME_DIALOG 495 = new Key<>("tunnelRenameDialog", true).setSecondary(); 496 497 /** 498 * output format for numbers 499 */ 500 public static final Key<IntFormat> INT_FORMAT 501 = new Key.KeyEnum<>("intFormat", IntFormat.def, IntFormat.values()).setSecondary(); 502 503 /** 504 * fixed point fractional binary digits 505 */ 506 public static final Key<Integer> FIXED_POINT 507 = new Key.KeyInteger("fixedPoint", 4) 508 .setMin(1) 509 .setMax(64) 510 .setDependsOn(INT_FORMAT, intFormat -> intFormat.equals(IntFormat.fixed) || intFormat.equals(IntFormat.fixedSigned)) 511 .allowGroupEdit() 512 .setSecondary(); 513 514 /** 515 * width of the terminal 516 */ 517 public static final Key.KeyInteger GRAPHIC_WIDTH 518 = new Key.KeyInteger("graphicWidth", 160) 519 .setMin(4); 520 521 /** 522 * height of the terminal 523 */ 524 public static final Key.KeyInteger GRAPHIC_HEIGHT 525 = new Key.KeyInteger("graphicHeight", 100) 526 .setMin(4); 527 528 /** 529 * flag used by a relay to indicate if it is normally open or normally closed. 530 */ 531 public static final Key<Boolean> RELAY_NORMALLY_CLOSED 532 = new Key<>("relayNormallyClosed", false).allowGroupEdit(); 533 534 535 /** 536 * Number of poles in the double throw relay 537 */ 538 public static final Key<Integer> POLES 539 = new Key.KeyInteger("poles", 1) 540 .setComboBoxValues(1, 2, 3, 4) 541 .setMin(1).allowGroupEdit(); 542 543 544 /** 545 * flag used by a barrel shifter to select the shift mode 546 */ 547 public static final Key<BarrelShifterMode> BARREL_SHIFTER_MODE 548 = new Key.KeyEnum<>("barrelShifterMode", BarrelShifterMode.logical, BarrelShifterMode.values()); 549 550 /** 551 * flag used by a barrel shifter to indicate shift direction 552 */ 553 public static final Key<LeftRightFormat> DIRECTION 554 = new Key.KeyEnum<>("direction", LeftRightFormat.left, LeftRightFormat.values()); 555 556 /** 557 * flag used by a barrel shifter to indicate if shift value is signed 558 */ 559 public static final Key<Boolean> BARREL_SIGNED 560 = new Key<>("barrelSigned", false); 561 562 /** 563 * Used to indicate if the 7-seg display has a common cathode output 564 */ 565 public static final Key<Boolean> COMMON_CONNECTION 566 = new Key<>("commonCathode", false).allowGroupEdit(); 567 568 /** 569 * Used to define the common connection type 570 */ 571 public static final Key<CommonConnectionType> COMMON_CONNECTION_TYPE 572 = new Key.KeyEnum<>("commonConnectionType", CommonConnectionType.cathode, CommonConnectionType.values()).setDependsOn(COMMON_CONNECTION).allowGroupEdit(); 573 574 /** 575 * Used to enable the storage of the last state in the Seven Seg display. 576 */ 577 public static final Key<Boolean> LED_PERSISTENCE 578 = new Key<>("ledPersistence", false).allowGroupEdit(); 579 580 /** 581 * Fitter for the atf15xx 582 */ 583 public static final Key<File> SETTINGS_ATF1502_FITTER 584 = new Key.KeyFile("atf1502Fitter", new File("c:/Wincupl/WinCupl/Fitters")).setDirectoryOnly(true).setSecondary(); 585 586 /** 587 * Flash software for the atf15xx 588 */ 589 public static final Key<File> SETTINGS_ATMISP 590 = new Key.KeyFile("ATMISP", getATMISPPath()).setSecondary(); 591 getATMISPPath()592 private static File getATMISPPath() { 593 File f = new File("c:/Tools/ATMISP7/ATMISP.exe"); 594 if (f.exists()) 595 return f; 596 return new File("c:/ATMISP7/ATMISP.exe"); 597 } 598 599 /** 600 * row bits in led matrix 601 */ 602 public static final Key.KeyBits ROW_DATA_BITS 603 = new Key.KeyBits("rowDataBits", 8); 604 605 /** 606 * column address bits in led matrix 607 */ 608 public static final Key.KeyBits COL_ADDR_BITS 609 = new Key.KeyBits("colAddrBits", 3); 610 611 /** 612 * In locked mode the circuit can not be modified 613 */ 614 public static final Key<Boolean> LOCKED_MODE 615 = new Key<>("lockedMode", false); 616 617 /** 618 * the pin number 619 */ 620 public static final Key<String> PINNUMBER = 621 new Key<>("pinNumber", "").setSecondary(); 622 623 /** 624 * the pin count 625 */ 626 public static final Key<Integer> PINCOUNT = 627 new Key.KeyInteger("pinCount", 0) 628 .setMin(0) 629 .setSecondary() 630 .setDependsOn(SHAPE_TYPE, st -> st.equals(CustomCircuitShapeType.DIL)); 631 632 633 /** 634 * contains the input inverter config 635 */ 636 public static final Key<InverterConfig> INVERTER_CONFIG 637 = new Key<>("inverterConfig", new InverterConfig.Builder().build()); 638 639 /** 640 * Background Color of nested circuits 641 */ 642 public static final Key<java.awt.Color> BACKGROUND_COLOR 643 = new Key<>("backgroundColor", new Color(255, 255, 180, 200)); 644 645 /** 646 * the screen resolution 647 */ 648 public static final Key<Integer> SETTINGS_FONT_SCALING = 649 new Key.KeyInteger("fontSize", Screen.getDefaultFontScaling()) 650 .setComboBoxValues(100, 120, 150, 180, 200, 250, 300) 651 .setMin(50) 652 .setMax(400) 653 .setRequiresRestart() 654 .setSecondary(); 655 656 /** 657 * Uses the equals key instead of the plus key. 658 */ 659 public static final Key<Boolean> SETTINGS_USE_EQUALS_KEY; 660 661 static { 662 String language = Locale.getDefault().getLanguage(); 663 SETTINGS_USE_EQUALS_KEY = new Key<>("equalsInsteadOfPlus", 664 language.equals("en") || language.equals("fr")).setSecondary(); 665 } 666 667 /** 668 * true if a enable input is needed 669 */ 670 public static final Key<Boolean> WITH_ENABLE 671 = new Key<>("withEnable", true); 672 673 /** 674 * true to simulate a unidirectional FET 675 */ 676 public static final Key<Boolean> FET_UNIDIRECTIONAL 677 = new Key<>("unidirectional", false); 678 679 /** 680 * true if component is active low 681 */ 682 public static final Key<Boolean> ACTIVE_LOW 683 = new Key<>("activeLow", false).allowGroupEdit(); 684 685 /** 686 * true if button is mapped to the keyboard 687 */ 688 public static final Key<Boolean> MAP_TO_KEY 689 = new Key<>("mapToKey", false).allowGroupEdit(); 690 691 /** 692 * Fitter for the atf1502 693 */ 694 public static final Key<File> SETTINGS_LIBRARY_PATH 695 = new Key.KeyFile("libraryPath", ElementLibrary.getLibPath()).setDirectoryOnly(true).setSecondary(); 696 697 /** 698 * A jar containing custom java components 699 */ 700 public static final Key<File> SETTINGS_JAR_PATH 701 = new Key.KeyFile("jarPath", new File("")).setSecondary().setRequiresRestart(); 702 703 /** 704 * The manager which contains all the roms data 705 */ 706 public static final Key<ROMManger> ROMMANAGER 707 = new Key<>("romContent", ROMManger::new).setSecondary(); 708 709 710 /** 711 * The type of the external process 712 */ 713 public static final Key.KeyEnum<Application.Type> APPLICATION_TYPE 714 = new Key.KeyEnum<>("applicationType", Application.Type.Generic, Application.Type.values()); 715 /** 716 * The inputs used by the external process 717 */ 718 public static final Key<String> EXTERNAL_INPUTS 719 = new Key<>("externalInputs", "in"); 720 /** 721 * The outputs used by the external process 722 */ 723 public static final Key<String> EXTERNAL_OUTPUTS 724 = new Key<>("externalOutputs", "out"); 725 /** 726 * The code to be executed by the external process 727 */ 728 public static final Key.LongString EXTERNAL_CODE 729 = new Key.LongString("Code").setRows(30).setColumns(80).setLineNumbers(true); 730 731 /** 732 * Path to ghdl 733 */ 734 public static final Key<File> SETTINGS_GHDL_PATH 735 = new Key.KeyFile("ghdlPath", new File("ghdl")).setSecondary(); 736 737 /** 738 * The ghdl options 739 */ 740 public static final Key<String> GHDL_OPTIONS 741 = new Key.LongString("ghdlOptions", "--std=08 --ieee=synopsys").setRows(3).setColumns(30).setPanelId("Options"); 742 743 /** 744 * The iverilog options 745 */ 746 public static final Key<String> IVERILOG_OPTIONS 747 = new Key.LongString("iverilogOptions", "").setRows(3).setColumns(30).setPanelId("Options"); 748 749 /** 750 * Path to iverilog installation directory 751 */ 752 public static final Key<File> SETTINGS_IVERILOG_PATH 753 = new Key.KeyFile("iverilogPath", new File("iverilog")).setSecondary(); 754 755 /** 756 * Avoid component tooltips in the main panel 757 */ 758 public static final Key<Boolean> SETTINGS_NOTOOLTIPS = 759 new Key<>("noComponentToolTips", false); 760 761 /** 762 * Shape used to represent a visual element 763 */ 764 public static final Key<CustomShapeDescription> CUSTOM_SHAPE 765 = new Key<>("customShape", new CustomShapeDescription.Builder().build()) 766 .setSecondary() 767 .setDependsOn(SHAPE_TYPE, st -> st.equals(CustomCircuitShapeType.CUSTOM)); 768 769 /** 770 * True if a program is loaded to the simulator at startup 771 */ 772 public static final Key<Boolean> PRELOAD_PROGRAM 773 = new Key<>("preloadProgram", false).setSecondary(); 774 775 /** 776 * The file to preload as a program at startup 777 */ 778 public static final Key<File> PROGRAM_TO_PRELOAD 779 = new Key.KeyFile("preloadProgramFile", new File("")).setSecondary().setDependsOn(PRELOAD_PROGRAM); 780 781 /** 782 * Selects a wide shape 783 */ 784 public static final Key<Boolean> WIDE_SHAPE 785 = new Key<>("wideShape", false).setSecondary().allowGroupEdit(); 786 787 788 /** 789 * the width of the rectangle 790 */ 791 public static final Key.KeyInteger RECT_WIDTH 792 = new Key.KeyInteger("RectWidth", 3) 793 .setMin(2); 794 795 /** 796 * the height of the rectangle 797 */ 798 public static final Key.KeyInteger RECT_HEIGHT 799 = new Key.KeyInteger("RectHeight", 3) 800 .setMin(2); 801 802 /** 803 * the position of the text in the rectangle 804 */ 805 public static final Key<Boolean> RECT_INSIDE 806 = new Key<>("RectInside", false).setSecondary(); 807 808 /** 809 * the position of the text in the rectangle 810 */ 811 public static final Key<Boolean> RECT_BOTTOM 812 = new Key<>("RectBottom", false).setSecondary(); 813 814 /** 815 * the position of the text in the rectangle 816 */ 817 public static final Key<Boolean> RECT_RIGHT 818 = new Key<>("RectRight", false).setSecondary(); 819 820 821 /** 822 * Selects the midi channel 823 */ 824 public static final Key.KeyInteger MIDI_CHANNEL = 825 new Key.KeyInteger("midiChannel", 1) 826 .setMin(1) 827 .setMax(16); 828 829 /** 830 * Selects the midi channel 831 */ 832 public static final Key<String> MIDI_INSTRUMENT = 833 new Key<>("midiInstrument", ""); 834 835 /** 836 * Enables Program change 837 */ 838 public static final Key<Boolean> MIDI_PROG_CHANGE = 839 new Key<>("midiProgChange", false); 840 841 /** 842 * Stores the IDE settings file 843 */ 844 public static final Key<File> SETTINGS_TOOLCHAIN_CONFIG = 845 new Key.KeyFile("toolChainConfig", new File("")).setSecondary().setRequiresRestart(); 846 847 /** 848 * Used to input statements to generify a circuit. 849 */ 850 public static final Key<String> GENERIC = 851 new Key.LongString("generic").setLineNumbers(true).allowGroupEdit(); 852 853 /** 854 * Used to input statements to generify a circuit. 855 */ 856 public static final Key<String> GENERICLARGE = 857 new Key.LongString("generic").setLineNumbers(true).setRows(20).allowGroupEdit(); 858 859 /** 860 * Circuit is generic 861 */ 862 public static final Key<Boolean> IS_GENERIC = 863 new Key<>("isGeneric", false).setSecondary(); 864 865 866 /** 867 * Enables the tutorial 868 */ 869 public static final Key<Boolean> SETTINGS_SHOW_TUTORIAL = 870 new Key<>("showTutorial", true).setSecondary(); 871 872 /** 873 * Enables the wire tool tips 874 */ 875 public static final Key<Boolean> SETTINGS_WIRETOOLTIP = 876 new Key<>("wireToolTips", false); 877 878 879 /** 880 * The switch acts as input 881 */ 882 public static final Key<Boolean> SWITCH_ACTS_AS_INPUT = 883 new Key<>("switchActsAsInput", false).setSecondary(); 884 885 /** 886 * Snaps the element to the grid 887 */ 888 public static final Key<Boolean> SNAP_TO_GRID = 889 new Key<>("snapToGrid", true).setSecondary(); 890 891 /** 892 * Mirrors the component 893 */ 894 public static final Key<Boolean> MIRROR = 895 new Key<>("mirror", false).allowGroupEdit().setSecondary(); 896 897 /** 898 * The test data 899 */ 900 public static final Key<TestCaseDescription> TESTDATA = 901 new Key<>("Testdata", TestCaseDescription::new); 902 903 /** 904 * The scope trigger mode 905 */ 906 public static final Key.KeyEnum<ScopeTrigger.Trigger> TRIGGER = 907 new Key.KeyEnum<>("trigger", ScopeTrigger.Trigger.both, ScopeTrigger.Trigger.values()); 908 909 910 } 911