Exemple #1
0
  /**
   * @param app application
   * @return All tools as a toolbar definition string
   */
  public static String getAllTools(AppD app) {
    StringBuilder sb = new StringBuilder();

    sb.append(ToolBar.getAllToolsNoMacros(true, false));

    // macros
    Kernel kernel = app.getKernel();
    int macroNumber = kernel.getMacroNumber();

    // check if at least one macro is shown
    // to avoid strange GUI
    boolean at_least_one_shown = false;
    for (int i = 0; i < macroNumber; i++) {
      Macro macro = kernel.getMacro(i);
      if (macro.isShowInToolBar()) {
        at_least_one_shown = true;
        break;
      }
    }

    if (macroNumber > 0 && at_least_one_shown) {
      sb.append(" || ");
      for (int i = 0; i < macroNumber; i++) {
        Macro macro = kernel.getMacro(i);
        if (macro.isShowInToolBar()) {
          sb.append(i + EuclidianConstants.MACRO_MODE_ID_OFFSET);
          sb.append(" ");
        }
      }
    }

    return sb.toString();
  }
  public AnimationStepPanel(AppD app) {
    kernel = app.getKernel();

    // text field for animation step
    label = new JLabel();
    tfAnimStep = new AngleTextField(6, app);
    label.setLabelFor(tfAnimStep);
    tfAnimStep.addActionListener(this);
    tfAnimStep.addFocusListener(this);

    // put it all together
    JPanel animPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    animPanel.add(label);
    animPanel.add(tfAnimStep);

    setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
    animPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
    add(animPanel);

    setLabels();
  }
  /**
   * *********************************************** Constructs a styleBar
   *
   * @param ev view
   */
  public EuclidianStyleBarD(EuclidianViewInterfaceCommon ev) {

    isIniting = true;

    this.ev = ev;
    ec = (EuclidianControllerD) ev.getEuclidianController();
    app = (AppD) ev.getApplication();
    cons = app.getKernel().getConstruction();

    // init handling of default geos
    defaultGeoMap = EuclidianStyleBarStatic.createDefaultMap();
    defaultGeos = new ArrayList<GeoElement>();

    // toolbar display settings
    setFloatable(false);
    Dimension d = getPreferredSize();
    d.height = iconHeight + 8;
    setPreferredSize(d);

    // init button-specific fields
    // TODO: put these in button classes
    EuclidianStyleBarStatic.pointStyleArray = EuclidianView.getPointStyles();
    pointStyleMap = new HashMap<Integer, Integer>();
    for (int i = 0; i < EuclidianStyleBarStatic.pointStyleArray.length; i++)
      pointStyleMap.put(EuclidianStyleBarStatic.pointStyleArray[i], i);

    EuclidianStyleBarStatic.lineStyleArray = EuclidianView.getLineTypes();
    lineStyleMap = new HashMap<Integer, Integer>();
    for (int i = 0; i < EuclidianStyleBarStatic.lineStyleArray.length; i++)
      lineStyleMap.put(EuclidianStyleBarStatic.lineStyleArray[i], i);

    setLabels(); // this will also init the GUI

    isIniting = false;

    setMode(ev.getMode()); // this will also update the stylebar
  }
 /**
  * Create a new PythonAPI instance
  *
  * @param app the running application instance
  */
 public PythonFlatAPI(AppD app) {
   this.app = app;
   this.kernel = app.getKernel();
   this.cons = kernel.getConstruction();
   this.algProcessor = kernel.getAlgebraProcessor();
 }