예제 #1
0
  /** Creates the additional frames of the board frame. */
  private void initialize_windows() {
    allocate_permanent_subwindows();

    this.setLocation(120, 0);

    this.select_parameter_window.setLocation(0, 0);
    this.select_parameter_window.setVisible(false);

    this.route_parameter_window.setLocation(0, 100);
    this.autoroute_parameter_window.setLocation(0, 200);
    this.move_parameter_window.setLocation(0, 50);
    this.clearance_matrix_window.setLocation(0, 150);
    this.via_window.setLocation(50, 150);
    this.edit_vias_window.setLocation(100, 150);
    this.edit_net_rules_window.setLocation(100, 200);
    this.assign_net_classes_window.setLocation(100, 250);
    this.padstacks_window.setLocation(100, 30);
    this.packages_window.setLocation(200, 30);
    this.components_window.setLocation(300, 30);
    this.incompletes_window.setLocation(400, 30);
    this.clearance_violations_window.setLocation(500, 30);
    this.length_violations_window.setLocation(550, 30);
    this.net_info_window.setLocation(350, 30);
    this.unconnected_route_window.setLocation(650, 30);
    this.route_stubs_window.setLocation(600, 30);
    this.snapshot_window.setLocation(0, 250);
    this.layer_visibility_window.setLocation(0, 450);
    this.object_visibility_window.setLocation(0, 550);
    this.display_misc_window.setLocation(0, 350);
    this.color_manager.setLocation(0, 600);
    this.about_window.setLocation(200, 200);
  }
예제 #2
0
  /**
   * Reads an existing board design from file. If p_is_import, the design is read from a scpecctra
   * dsn file. Returns false, if the file is invalid.
   */
  boolean read(
      java.io.InputStream p_input_stream,
      boolean p_is_import,
      javax.swing.JTextField p_message_field) {
    java.awt.Point viewport_position = null;
    if (p_is_import) {
      DsnFile.ReadResult read_result =
          board_panel.board_handling.import_design(
              p_input_stream, this.board_observers, this.item_id_no_generator, this.test_level);
      if (read_result != DsnFile.ReadResult.OK) {
        if (p_message_field != null) {
          if (read_result == DsnFile.ReadResult.OUTLINE_MISSING) {
            p_message_field.setText(resources.getString("error_7"));
          } else {
            p_message_field.setText(resources.getString("error_6"));
          }
        }
        return false;
      }
      viewport_position = new java.awt.Point(0, 0);
      initialize_windows();
    } else {
      java.io.ObjectInputStream object_stream = null;
      try {
        object_stream = new java.io.ObjectInputStream(p_input_stream);
      } catch (java.io.IOException e) {
        return false;
      }
      boolean read_ok = board_panel.board_handling.read_design(object_stream, this.test_level);
      if (!read_ok) {
        return false;
      }
      java.awt.Point frame_location;
      java.awt.Rectangle frame_bounds;
      try {
        viewport_position = (java.awt.Point) object_stream.readObject();
        frame_location = (java.awt.Point) object_stream.readObject();
        frame_bounds = (java.awt.Rectangle) object_stream.readObject();
      } catch (Exception e) {
        return false;
      }
      this.setLocation(frame_location);
      this.setBounds(frame_bounds);

      allocate_permanent_subwindows();

      for (int i = 0; i < this.permanent_subwindows.length; ++i) {
        this.permanent_subwindows[i].read(object_stream);
      }
    }
    try {
      p_input_stream.close();
    } catch (java.io.IOException e) {
      return false;
    }

    java.awt.Dimension panel_size = board_panel.board_handling.graphics_context.get_panel_size();
    board_panel.setSize(panel_size);
    board_panel.setPreferredSize(panel_size);
    if (viewport_position != null) {
      board_panel.set_viewport_position(viewport_position);
    }
    board_panel.create_popup_menus();
    board_panel.init_colors();
    board_panel.board_handling.create_ratsnest();
    this.hilight_selected_button();
    this.toolbar_panel.unit_factor_field.setValue(
        board_panel.board_handling.coordinate_transform.user_unit_factor);
    this.toolbar_panel.unit_combo_box.setSelectedItem(
        board_panel.board_handling.coordinate_transform.user_unit);
    this.setVisible(true);
    if (p_is_import) {
      // Read the default gui settings, if gui default file exists.
      java.io.InputStream input_stream = null;
      boolean defaults_file_found;
      if (this.is_web_start) {
        input_stream = WebStart.get_file_input_stream(BoardFrame.GUI_DEFAULTS_FILE_NAME);
        defaults_file_found = (input_stream != null);
      } else {
        File defaults_file = new File(this.design_file.get_parent(), GUI_DEFAULTS_FILE_NAME);
        defaults_file_found = true;
        try {
          input_stream = new java.io.FileInputStream(defaults_file);
        } catch (java.io.FileNotFoundException e) {
          defaults_file_found = false;
        }
      }
      if (defaults_file_found) {
        boolean read_ok = gui.GUIDefaultsFile.read(this, board_panel.board_handling, input_stream);
        if (!read_ok) {
          screen_messages.set_status_message(resources.getString("error_1"));
        }
        try {
          input_stream.close();
        } catch (java.io.IOException e) {
          return false;
        }
      }
      this.zoom_all();
    }
    return true;
  }