Exemplo n.º 1
0
  /** Invoked when this window is about to close. */
  protected void onWindowClose() {
    if (ClassicPrefs.getSaveWindowProperties()) {
      ClassicPrefs.setWindowMaximized((getExtendedState() & MAXIMIZED_BOTH) == MAXIMIZED_BOTH);

      setVisible(false);
      if (ClassicPrefs.getWindowMaximized()) {
        // setExtendedState(getExtendedState() & ~MAXIMIZED_BOTH);
        CC.cleanExit();
        return;
      }

      java.awt.Point p = getLocation();
      Dimension d = getSize();
      StringBuffer sb = new StringBuffer();
      sb.append(p.x).append(',').append(p.y).append(',');
      sb.append(d.width).append(',').append(d.height);
      ClassicPrefs.setWindowSizeAndLocation(sb.toString());

      ClassicPrefs.setHSplitDividerLocation(hSplitPane.getDividerLocation());
    }

    if (ClassicPrefs.getSaveLeftPaneState()) {
      int idx = 0;
      for (int i = 0; i < getLeftPane().getPages().length; i++) {
        if (getLeftPane().getPages()[i] == getLeftPane().getCurrentPage()) {
          idx = i;
          break;
        }
      }

      ClassicPrefs.setLeftPanePageIndex(idx);

      idx = getLeftPane().getOrchestrasPage().getCurrentOrchestraIndex();

      if (idx >= 0 && idx < CC.getOrchestras().getOrchestraCount())
        ClassicPrefs.setCurrentOrchestraIndex(idx);
    }

    StringBuffer sb = new StringBuffer();
    for (String s : recentScripts) sb.append(s).append("\n");
    ClassicPrefs.setRecentScripts(sb.toString());

    LSConsoleModel model = getLSConsoleModel();
    sb = new StringBuffer();
    for (String s : model.getCommandHistory()) sb.append(s).append("\n");
    ClassicPrefs.setLSConsoleHistory(sb.toString());

    ClassicPrefs.setShowLSConsole(isLSConsoleShown());
    ClassicPrefs.setLSConsolePopOut(isLSConsolePopOut());

    ClassicPrefs.setVSplitDividerLocation(vSplitPane.getDividerLocation());
    super.onWindowClose();
  }
Exemplo n.º 2
0
  /** Creates a new instance of JSMainFrame */
  public MainFrame() {
    setTitle(i18n.getLabel("MainFrame.title"));

    getContentPane().add(toolbar, BorderLayout.NORTH);
    getContentPane().add(mainPane);

    mainPane.setLayout(new BorderLayout());
    mainPane.add(statusbar, BorderLayout.SOUTH);

    ChannelsPane p = new ChannelsPane("Untitled");
    p.addListSelectionListener(this);
    getChannelsPaneList().add(p);
    miList.add(new JMenuItem(new A4n.MoveChannelsTo(p)));

    channelsPane.add(getChannelsPane(0));

    bottomPane.setLayout(new BorderLayout());

    rightPane.setLayout(new BorderLayout());
    rightPane.add(channelsPane);

    hSplitPane =
        new JSplitPane(
            JSplitPane.HORIZONTAL_SPLIT,
            true, // continuousLayout
            getLeftPane(),
            rightPane);

    hSplitPane.setOneTouchExpandable(true);
    if (ClassicPrefs.getSaveWindowProperties()) {
      hSplitPane.setDividerLocation(ClassicPrefs.getHSplitDividerLocation());
    }

    mainPane.add(hSplitPane);

    vSplitPane =
        new JSplitPane(
            JSplitPane.VERTICAL_SPLIT,
            true, // continuousLayout
            channelsPane,
            bottomPane);

    vSplitPane.setDividerSize(3);
    vSplitPane.setDividerLocation(ClassicPrefs.getVSplitDividerLocation());

    rightPane.add(vSplitPane);

    if (applicationIcon != null) setIconImage(applicationIcon.getImage());

    initMainFrame();

    pack();

    if (ClassicPrefs.getSaveWindowProperties()) setSavedSize();
    else setDefaultSize();

    if (ClassicPrefs.getSaveLeftPaneState()) {
      NavigationPage page = getLeftPane().getPages()[ClassicPrefs.getLeftPanePageIndex()];

      getLeftPane().getModel().addPage(page);
      getLeftPane().getModel().clearHistory();

      int idx = ClassicPrefs.getCurrentOrchestraIndex();
      if (idx >= 0 && idx < CC.getOrchestras().getOrchestraCount()) {
        OrchestraModel om = CC.getOrchestras().getOrchestra(idx);
        getLeftPane().getOrchestrasPage().setSelectedOrchestra(om);
      }
    }
  }