コード例 #1
0
ファイル: NewsPanel.java プロジェクト: ThatGuyOverTher/Frost
  /** Save the settings of this panel */
  private void saveSettings() {
    settings.setValue(
        SettingsClass.FCP2_DEFAULT_PRIO_MESSAGE_UPLOAD, uploadPrioTextField.getText());
    settings.setValue(
        SettingsClass.FCP2_DEFAULT_PRIO_MESSAGE_DOWNLOAD, downloadPrioTextField.getText());
    settings.setValue(
        SettingsClass.FCP2_USE_ONE_CONNECTION_FOR_MESSAGES,
        useOneConnectionForMessagesCheckBox.isSelected());

    settings.setValue(SettingsClass.MAX_MESSAGE_DISPLAY, displayDaysTextField.getText());
    settings.setValue(SettingsClass.MAX_MESSAGE_DOWNLOAD, downloadDaysTextField.getText());
    settings.setValue(
        SettingsClass.MESSAGE_BASE, messageBaseTextField.getText().trim().toLowerCase());
    settings.setValue(
        SettingsClass.ALWAYS_DOWNLOAD_MESSAGES_BACKLOAD,
        alwaysDownloadBackloadCheckBox.isSelected());

    settings.setValue(
        SettingsClass.BOARD_AUTOUPDATE_CONCURRENT_UPDATES, concurrentUpdatesTextField.getText());
    settings.setValue(
        SettingsClass.BOARD_AUTOUPDATE_MIN_INTERVAL, minimumIntervalTextField.getText());

    // settings.setValue(SettingsClass.BOARD_AUTOUPDATE_ENABLED,
    // automaticBoardUpdateCheckBox.isSelected());
    // we change setting in MainFrame, this is auto-saved during frostSettings.save()
    MainFrame.getInstance()
        .setAutomaticBoardUpdateEnabled(automaticBoardUpdateCheckBox.isSelected());

    settings.setValue(
        SettingsClass.STORAGE_STORE_SENT_MESSAGES, storeSentMessagesCheckBox.isSelected());
    settings.setValue(SettingsClass.SILENTLY_RETRY_MESSAGES, silentlyRetryCheckBox.isSelected());

    settings.setValue(SettingsClass.ALTERNATE_EDITOR_ENABLED, altEditCheckBox.isSelected());
    settings.setValue(SettingsClass.ALTERNATE_EDITOR_COMMAND, altEditTextField.getText());
  }
コード例 #2
0
ファイル: NewsPanel.java プロジェクト: ThatGuyOverTher/Frost
  /** Load the settings of this panel */
  private void loadSettings() {
    uploadPrioTextField.setText(settings.getValue(SettingsClass.FCP2_DEFAULT_PRIO_MESSAGE_UPLOAD));
    downloadPrioTextField.setText(
        settings.getValue(SettingsClass.FCP2_DEFAULT_PRIO_MESSAGE_DOWNLOAD));
    useOneConnectionForMessagesCheckBox.setSelected(
        settings.getBoolValue(SettingsClass.FCP2_USE_ONE_CONNECTION_FOR_MESSAGES));

    displayDaysTextField.setText(settings.getValue(SettingsClass.MAX_MESSAGE_DISPLAY));
    downloadDaysTextField.setText(settings.getValue(SettingsClass.MAX_MESSAGE_DOWNLOAD));
    messageBaseTextField.setText(settings.getValue(SettingsClass.MESSAGE_BASE));
    alwaysDownloadBackloadCheckBox.setSelected(
        settings.getBoolValue(SettingsClass.ALWAYS_DOWNLOAD_MESSAGES_BACKLOAD));

    minimumIntervalTextField.setText(
        settings.getValue(SettingsClass.BOARD_AUTOUPDATE_MIN_INTERVAL));
    concurrentUpdatesTextField.setText(
        settings.getValue(SettingsClass.BOARD_AUTOUPDATE_CONCURRENT_UPDATES));

    // this setting is in MainFrame
    automaticBoardUpdateCheckBox.setSelected(
        MainFrame.getInstance().isAutomaticBoardUpdateEnabled());
    refreshUpdateState();

    storeSentMessagesCheckBox.setSelected(
        settings.getBoolValue(SettingsClass.STORAGE_STORE_SENT_MESSAGES));
    silentlyRetryCheckBox.setSelected(settings.getBoolValue(SettingsClass.SILENTLY_RETRY_MESSAGES));

    altEditCheckBox.setSelected(settings.getBoolValue(SettingsClass.ALTERNATE_EDITOR_ENABLED));
    altEditTextField.setEnabled(altEditCheckBox.isSelected());
    altEditTextField.setText(settings.getValue(SettingsClass.ALTERNATE_EDITOR_COMMAND));
  }
コード例 #3
0
  private void loadWindowState() {
    // load size, location and state of window
    int lastHeight = Core.frostSettings.getIntValue("helpBrowser.lastFrameHeight");
    int lastWidth = Core.frostSettings.getIntValue("helpBrowser.lastFrameWidth");
    final int lastPosX = Core.frostSettings.getIntValue("helpBrowser.lastFramePosX");
    final int lastPosY = Core.frostSettings.getIntValue("helpBrowser.lastFramePosY");
    final boolean lastMaximized = Core.frostSettings.getBoolValue("helpBrowser.lastFrameMaximized");

    if (lastHeight <= 0 || lastWidth <= 0) {
      // first call
      setSize(780, 550);
      setLocationRelativeTo(MainFrame.getInstance());
      return;
    }

    final Dimension scrSize = Toolkit.getDefaultToolkit().getScreenSize();

    if (lastWidth < 100) {
      lastWidth = 780;
    }
    if (lastHeight < 100) {
      lastHeight = 550;
    }

    if ((lastPosX + lastWidth) > scrSize.width) {
      setSize(780, 550);
      setLocationRelativeTo(MainFrame.getInstance());
      return;
    }

    if ((lastPosY + lastHeight) > scrSize.height) {
      setSize(780, 550);
      setLocationRelativeTo(MainFrame.getInstance());
      return;
    }

    setBounds(lastPosX, lastPosY, lastWidth, lastHeight);

    if (lastMaximized) {
      setExtendedState(getExtendedState() | Frame.MAXIMIZED_BOTH);
    }
  }
コード例 #4
0
  public static void zoomToFit(Viewport2 viewport) {
    ViewDefinition viewdef = viewport.getViewDefinition();
    // if (MainFrame.getInstance().getMeshToolBar().getMode() != MeshToolBar.VIEW_ZOOM) {
    //	MainFrame.getInstance().getJPatchScreen().removeAllMouseListeners();
    //	MainFrame.getInstance().getJPatchScreen().addMouseListeners(new
    // ChangeViewMouseListener(MouseEvent.BUTTON1,ChangeViewMouseListener.ZOOM));
    //	MainFrame.getInstance().getMeshToolBar().setMode(MeshToolBar.VIEW_ZOOM);
    // } else {
    //	MainFrame.getInstance().getMeshToolBar().reset();
    // }
    Selection selection = MainFrame.getInstance().getSelection();
    float left = Float.MAX_VALUE;
    float right = -Float.MAX_VALUE;
    float bottom = Float.MAX_VALUE;
    float top = -Float.MAX_VALUE;
    Point3f p3 = new Point3f();
    Matrix4f m4View = viewdef.getScreenMatrix();
    // Matrix3f m3RotScale = new Matrix3f();
    // m4View.getRotationScale(m3RotScale);
    boolean doit = true;
    if (selection != null && !selection.isSingle()) {
      for (Iterator it = selection.getObjects().iterator(); it.hasNext(); ) {
        Object object = it.next();
        if (object instanceof ControlPoint) {
          p3.set(((ControlPoint) object).getPosition());
          m4View.transform(p3);
          if (p3.x < left) left = p3.x;
          if (p3.x > right) right = p3.x;
          if (p3.y < bottom) bottom = p3.y;
          if (p3.y > top) top = p3.y;
        }
      }
    } else {
      ArrayList heads = MainFrame.getInstance().getModel().allHeads();
      int p = 0;
      for (Iterator it = heads.iterator(); it.hasNext(); ) {
        ControlPoint cp = (ControlPoint) it.next();
        if (!cp.isHidden()) {
          p3.set(cp.getPosition());
          m4View.transform(p3);
          if (p3.x < left) left = p3.x;
          if (p3.x > right) right = p3.x;
          if (p3.y < bottom) bottom = p3.y;
          if (p3.y > top) top = p3.y;
          p++;
        }
      }
      doit = (p >= 2);
    }
    if (doit) {
      // System.out.println(left + " " + right + " " + top + " " + bottom + " " +
      // viewdef.getScale());
      // System.out.println(viewdef.getTranslateX() + " " + viewdef.getTranslateY());
      float centerX = (left + right) / 2f;
      float centerY = (top + bottom) / 2f;
      float dimX = viewdef.getWidth() / 2f;
      float dimY = viewdef.getHeight() / 2f;
      float sizeX = right - centerX;
      float sizeY = top - centerY;
      if (sizeX > 0 || sizeY > 0) {
        // System.out.println(centerX + ":" + centerY);

        float scaleX = dimX / sizeX;
        float scaleY = dimY / sizeY;
        float scale = Math.min(scaleX, scaleY) * 0.9f;
        // viewdef.setScale(viewdef.getScale() * scale);
        viewdef.setLock(null);
        viewdef.moveView(-centerX / dimX + 1, (dimY - centerY) / dimX, false);
        viewdef.scaleView(scale);
        // viewdef.setTranslation(centerX, centerY);
        // viewdef.computeMatrix();
        // viewport.render();
      }
    }
  }
コード例 #5
0
 public void actionPerformed(ActionEvent actionEvent) {
   zoomToFit(MainFrame.getInstance().getJPatchScreen().getActiveViewport());
 }