Exemplo n.º 1
0
  /**
   * acts when mouse has been released in euclidian controller
   *
   * @param creatorMode says if euclidian view is in creator mode (ie not move mode)
   */
  public void mouseReleasedForPropertiesView(boolean creatorMode) {

    GeoElement geo;
    if (objectPanel == null) {
      geo = null;
    } else {
      geo = objectPanel.consumeGeoAdded();
    }

    if (app.getSelectionManager().selectedGeosSize() > 0) {
      // selected geo is the most important
      updatePropertiesViewCheckConstants(app.getSelectionManager().getSelectedGeos());
    } else if (geo != null) { // last created geo
      if (creatorMode) { // if euclidian view is e.g. in move mode, then
        // geo was created by a script, so just show
        // object properties
        ArrayList<GeoElement> geos = new ArrayList<GeoElement>();
        geos.add(geo);
        setOptionPanel(OptionType.OBJECTS, geos);
      } else {
        setOptionPanel(OptionType.OBJECTS, null);
      }
    } else { // focus
      updateSelectedTab(Construction.Constants.NOT);
      setOptionPanelRegardingFocus(true);
      // updatePropertiesView();
    }
  }
Exemplo n.º 2
0
  protected final void setOptionPanelRegardingFocus(boolean updateEuclidianTab) {

    if (stayInCurrentPanelWithObjects()) return;

    OptionType type = getFocusedViewType();

    if (type != null) {
      if (type == OptionType.EUCLIDIAN || type == OptionType.EUCLIDIAN2) {

        if (app.getActiveEuclidianView()
            .getEuclidianController()
            .checkBoxOrTextfieldOrButtonJustHitted()) {
          // hit check box or text field : does nothing
          return;
        }

        // ev clicked
        setOptionPanelWithoutCheck(type);
        if (updateEuclidianTab) {
          setSelectedTab(type);
        }

      } else setOptionPanel(type);

      // here necessary no object is selected
      updateObjectPanelSelection(app.getSelectionManager().getSelectedGeos());
    }
  }
Exemplo n.º 3
0
  /**
   * Sets and shows the option panel for the given option type
   *
   * @param type type
   */
  public final void setOptionPanel(OptionType type) {

    ArrayList<GeoElement> geos = removeAllConstants(app.getSelectionManager().getSelectedGeos());

    if (type == OptionType.OBJECTS) { // ensure that at least one geo is
      // selected
      if (geos.size() == 0) {
        GeoElement geo = app.getSelectionManager().setFirstGeoSelectedForPropertiesView();
        if (geo == null) {
          // does nothing: stay in same panel
          return;
        }

        // add this first geo
        geos.add(geo);
      }
    }

    setOptionPanel(type, geos);
  }
Exemplo n.º 4
0
  protected boolean stayInCurrentPanelWithObjects() {

    return stayInCurrentPanel()
        || (selectedOptionType == OptionType.OBJECTS
            && app.getSelectionManager().getSelectedGeos().size() > 0);
  }