Exemplo n.º 1
0
 private void applyUseAsText(ArrayList<GeoElement> geos) {
   // btnUseAsText
   for (int i = 0; i < geos.size(); i++) {
     GeoElement geo = geos.get(i);
     if (geo instanceof GeoCasCell) {
       ((GeoCasCell) geo).setUseAsText(btnUseAsText.isSelected());
       geo.updateRepaint();
       needUndo = true;
     }
   }
 }
Exemplo n.º 2
0
  @Override
  public void mouseReleased(MouseEvent e) {
    e.consume();

    // handle marble click
    int releasedRow = table.rowAtPoint(e.getPoint());
    if (releasedRow == mousePressedRow) {
      int totalHeight = 0;
      for (int i = 0; i < releasedRow; i++) totalHeight += table.getRowHeight(i);

      int marbleTop =
          ((JPanel)
                  rowHeader
                      .getCellRenderer()
                      .getListCellRendererComponent(
                          rowHeader, (releasedRow + 1) + "", releasedRow, false, false))
              .getComponent(1)
              .getY();
      if (e.getY() > marbleTop + totalHeight - 4 && e.getY() < marbleTop + totalHeight + 16) {

        GeoCasCell clickedCell = table.getGeoCasCell(table.rowAtPoint(e.getPoint()));
        if (table.isEditing()) {
          table.stopEditing();
        }
        clickedCell.toggleTwinGeoEuclidianVisible();
      }
    }

    mousePressedRow = -1;
    // handle right click

    if (rightClick) {
      if (!rowHeader.isSelectedIndex(releasedRow)) {
        rowHeader.setSelectedIndex(releasedRow);
      }
      if (rowHeader.getSelectedIndices().length > 0) {
        RowHeaderPopupMenu popupMenu = new RowHeaderPopupMenu(rowHeader, table);
        popupMenu.show(e.getComponent(), e.getX(), e.getY());
      }
    }
  }
Exemplo n.º 3
0
  private void applyTextColor(ArrayList<GeoElement> geos) {

    Color color = geogebra.awt.GColorD.getAwtColor(btnTextColor.getSelectedColor());
    for (int i = 0; i < geos.size(); i++) {
      GeoElement geo = geos.get(i);
      if (geo instanceof GeoCasCell) {
        ((GeoCasCell) geo).setFontColor(new geogebra.awt.GColorD(color));
        geo.updateRepaint();
        needUndo = true;
      }
    }
  }
Exemplo n.º 4
0
  private void applyTextSize(ArrayList<GeoElement> geos) {

    double fontSize =
        GeoText.getRelativeFontSize(
            btnTextSize.getSelectedIndex()); // transform indices to the range -4, .. ,
    // 4

    for (int i = 0; i < geos.size(); i++) {
      GeoElement geo = geos.get(i);
      if (geo instanceof GeoCasCell
          && ((GeoCasCell) geo).getGeoText().getFontSizeMultiplier() != fontSize) {
        ((GeoCasCell) geo).setFontSizeMultiplier(fontSize);
        geo.updateRepaint();
        needUndo = true;
      }
    }
  }
Exemplo n.º 5
0
  private void applyFontStyle(ArrayList<GeoElement> geos) {

    int fontStyle = 0;
    if (btnBold.isSelected()) fontStyle += 1;
    if (btnItalic.isSelected()) fontStyle += 2;
    App.printStacktrace(geos.size() + "");
    for (int i = 0; i < geos.size(); i++) {
      GeoElement geo = geos.get(i);
      App.debug(((GeoCasCell) geo).getGeoText());
      if (geo instanceof GeoCasCell
          && ((GeoCasCell) geo).getGeoText().getFontStyle() != fontStyle) {
        ((GeoCasCell) geo).getGeoText().setFontStyle(fontStyle);
        geo.updateRepaint();
        needUndo = true;
      }
    }
  }