Example #1
0
  @Override
  public void toggleMenu() {

    if (!this.menuShowing) {
      this.menuShowing = true;
      boolean needsUpdate = menuInited;
      if (!menuInited) {
        frame.getMenuBar(this).init(this);
        this.menuInited = true;
      }
      this.splitPanelWrapper.add(frame.getMenuBar(this));
      this.oldSplitLayoutPanel.setPixelSize(
          this.oldSplitLayoutPanel.getOffsetWidth() - GLookAndFeel.MENUBAR_WIDTH,
          this.oldSplitLayoutPanel.getOffsetHeight());
      frame
          .getMenuBar(this)
          .setPixelSize(GLookAndFeel.MENUBAR_WIDTH, this.oldSplitLayoutPanel.getOffsetHeight());
      if (needsUpdate) {
        frame.getMenuBar(this).getMenubar().updateMenubar();
      }
      this.getGuiManager().refreshDraggingViews();
      oldSplitLayoutPanel.getElement().getStyle().setOverflow(Overflow.HIDDEN);
      getGuiManager().updateStyleBarPositions(true);
      frame.getMenuBar(this).getMenubar().dispatchOpenEvent();
    } else {
      hideMenu();
    }
  }
Example #2
0
  private void buildSingleApplicationPanel() {
    if (frame != null) {
      frame.clear();
      frame.add((Widget) getEuclidianViewpanel());
      // we need to make sure trace works after this, see #4373 or #4236
      this.getEuclidianView1().createImage();
      ((DockPanelW) getEuclidianViewpanel()).setVisible(true);
      ((DockPanelW) getEuclidianViewpanel())
          .setEmbeddedSize(getSettings().getEuclidian(1).getPreferredSize().getWidth());
      ((DockPanelW) getEuclidianViewpanel()).updatePanel(false);
      getEuclidianViewpanel()
          .setPixelSize(
              getSettings().getEuclidian(1).getPreferredSize().getWidth(),
              getSettings().getEuclidian(1).getPreferredSize().getHeight());

      // FIXME: temporary hack until it is found what causes
      // the 1px difference
      // getEuclidianViewpanel().getAbsolutePanel().getElement().getStyle().setLeft(1,
      // Style.Unit.PX);
      // getEuclidianViewpanel().getAbsolutePanel().getElement().getStyle().setTop(1,
      // Style.Unit.PX);
      getEuclidianViewpanel()
          .getAbsolutePanel()
          .getElement()
          .getStyle()
          .setBottom(-1, Style.Unit.PX);
      getEuclidianViewpanel()
          .getAbsolutePanel()
          .getElement()
          .getStyle()
          .setRight(-1, Style.Unit.PX);
      oldSplitLayoutPanel = null;
    }
  }
Example #3
0
  /**
   * **************************************************** Constructs AppW for applets
   *
   * @param undoActive if true you can undo by CTRL+Z and redo by CTRL+Y
   * @param ae article element
   * @param gf frame
   * @param dimension 3 for 3d, 2 otherwise
   * @param laf look and feel
   */
  public AppWapplet(
      ArticleElement ae,
      GeoGebraFrameBoth gf,
      final boolean undoActive,
      int dimension,
      GLookAndFeel laf) {
    super(ae, dimension, laf, null);
    this.frame = gf;
    setAppletHeight(frame.getComputedHeight());
    setAppletWidth(frame.getComputedWidth());

    this.useFullGui =
        !isApplet()
            || ae.getDataParamShowAlgebraInput(false)
            || ae.getDataParamShowToolBar(false)
            || ae.getDataParamShowMenuBar(false)
            || ae.getDataParamEnableRightClick();

    Log.info(
        "GeoGebra "
            + GeoGebraConstants.VERSION_STRING
            + " "
            + GeoGebraConstants.BUILD_DATE
            + " "
            + Window.Navigator.getUserAgent());
    initCommonObjects();
    initing = true;

    this.euclidianViewPanel = new EuclidianDockPanelW(this, allowStylebar());
    // (EuclidianDockPanelW)getGuiManager().getLayout().getDockManager().getPanel(App.VIEW_EUCLIDIAN);
    this.canvas = this.euclidianViewPanel.getCanvas();
    canvas.setWidth("1px");
    canvas.setHeight("1px");
    canvas.setCoordinateSpaceHeight(1);
    canvas.setCoordinateSpaceWidth(1);
    initCoreObjects(undoActive, this);
    afterCoreObjectsInited();
    resetFonts();
    Browser.removeDefaultContextMenu(this.getArticleElement());
    if (ae.getDataParamApp() && !this.getLAF().isSmart()) {
      RootPanel.getBodyElement().addClassName("application");
    }
    if (this.showMenuBar()) {
      // opening file -> this was inited before
      if (getLoginOperation() == null) {
        initSignInEventFlow(new LoginOperationW(this), ae.isEnableUsageStats());
      }
    } else {
      if (Browser.runningLocal() && ae.isEnableUsageStats()) {
        new GeoGebraTubeAPIWSimple(has(Feature.TUBE_BETA)).checkAvailable(null);
      }
    }
  }
Example #4
0
  @Override
  public void buildApplicationPanel() {

    if (!isUsingFullGui()) {
      if (showConsProtNavigation() || !isJustEuclidianVisible()) {
        useFullGui = true;
      }
    }

    if (!isUsingFullGui()) {
      buildSingleApplicationPanel();
      return;
    }

    if (!has(Feature.KEYBOARD_BEHAVIOUR) || !hasPopup()) {
      frame.clear();
    }

    // showMenuBar should come from data-param,
    // this is just a 'second line of defense'
    // otherwise it can be used for taking ggb settings into account too
    if (articleElement.getDataParamShowMenuBar(showMenuBar)) {
      frame.attachMenubar(this);
    }
    // showToolBar should come from data-param,
    // this is just a 'second line of defense'
    // otherwise it can be used for taking ggb settings into account too
    if (articleElement.getDataParamShowToolBar(showToolBar)
        && this.getToolbarPosition() != SwingConstants.SOUTH) {
      frame.attachToolbar(this);
    }
    if (this.getInputPosition() == InputPosition.top
        && articleElement.getDataParamShowAlgebraInput(showAlgebraInput)) {
      attachAlgebraInput();
    }
    attachSplitLayoutPanel();

    // showAlgebraInput should come from data-param,
    // this is just a 'second line of defense'
    // otherwise it can be used for taking ggb settings into account too
    if (this.getInputPosition() == InputPosition.bottom
        && articleElement.getDataParamShowAlgebraInput(showAlgebraInput)) {
      attachAlgebraInput();
    }
    if (articleElement.getDataParamShowToolBar(showToolBar)
        && this.getToolbarPosition() == SwingConstants.SOUTH) {
      frame.attachToolbar(this);
    }
    frame.attachGlass();
  }
Example #5
0
 /** Attach algebra input */
 public void attachAlgebraInput() {
   // inputbar's width varies,
   // so it's probably good to regenerate every time
   GGWCommandLine inputbar = new GGWCommandLine();
   inputbar.attachApp(this);
   frame.add(inputbar);
   this.getGuiManager().getAlgebraInput().setInputFieldWidth(this.appletWidth);
 }
Example #6
0
  private void attachSplitLayoutPanel() {
    boolean oldSLPanelChanged = oldSplitLayoutPanel == getSplitLayoutPanel() ? false : true;
    oldSplitLayoutPanel = getSplitLayoutPanel();

    if (oldSplitLayoutPanel != null) {
      if (getArticleElement().getDataParamShowMenuBar(false)) {
        this.splitPanelWrapper = new HorizontalPanel();
        // TODO
        splitPanelWrapper.add(oldSplitLayoutPanel);
        if (this.menuShowing) {
          splitPanelWrapper.add(frame.getMenuBar(this));
        }
        frame.add(splitPanelWrapper);

      } else {
        frame.add(oldSplitLayoutPanel);
      }
      Browser.removeDefaultContextMenu(getSplitLayoutPanel().getElement());

      if (has(Feature.FIX_KEYBOARD_POSITION) && !oldSLPanelChanged) {
        return;
      }

      ClickStartHandler.init(
          oldSplitLayoutPanel,
          new ClickStartHandler() {
            @Override
            public void onClickStart(int x, int y, final PointerEventType type) {
              updateAVStylebar();

              if (!CancelEventTimer.cancelKeyboardHide()) {
                Timer timer =
                    new Timer() {
                      @Override
                      public void run() {
                        getAppletFrame().keyBoardNeeded(false, null);
                      }
                    };
                timer.schedule(0);
              }
            }
          });
    }
  }
Example #7
0
 private void refreshSplitLayoutPanel() {
   if (frame != null
       && frame.getWidgetCount() != 0
       && frame.getWidgetIndex(getSplitLayoutPanel()) == -1
       && frame.getWidgetIndex(oldSplitLayoutPanel) != -1) {
     int wi = frame.getWidgetIndex(oldSplitLayoutPanel);
     frame.remove(oldSplitLayoutPanel);
     frame.insert(getSplitLayoutPanel(), wi);
     oldSplitLayoutPanel = getSplitLayoutPanel();
     Browser.removeDefaultContextMenu(getSplitLayoutPanel().getElement());
   }
 }
Example #8
0
  @Override
  public void hideMenu() {
    if (!menuInited || !menuShowing) {
      if (this.getGuiManager() != null) {
        this.getGuiManager().updateStyleBarPositions(false);
      }
      return;
    }
    this.menuShowing = false;
    this.oldSplitLayoutPanel.setPixelSize(
        this.oldSplitLayoutPanel.getOffsetWidth() + GLookAndFeel.MENUBAR_WIDTH,
        this.oldSplitLayoutPanel.getOffsetHeight());

    this.splitPanelWrapper.remove(frame.getMenuBar(this));
    oldSplitLayoutPanel.getElement().getStyle().setOverflow(Overflow.VISIBLE);
    if (this.getGuiManager() != null && this.getGuiManager().getLayout() != null) {
      this.getGuiManager().getLayout().getDockManager().resizePanels();
    }

    if (this.getGuiManager() != null) {
      this.getGuiManager().setDraggingViews(false, true);
      this.getGuiManager().updateStyleBarPositions(false);
    }
  }
Example #9
0
 @Override
 public DockGlassPaneW getGlassPane() {
   return frame.getGlassPane();
 }
Example #10
0
 @Override
 public void updateContentPane() {
   super.updateContentPane();
   frame.setApplication(this);
   frame.refreshKeyboard();
 }
Example #11
0
  @Override
  public void afterLoadFileAppOrNot() {
    closePerspectivesPopup();
    if (!getLAF().isSmart()) {
      removeSplash();
    }
    String perspective = getArticleElement().getDataParamPerspective();
    if (!isUsingFullGui()) {
      if (showConsProtNavigation() || !isJustEuclidianVisible() || perspective.length() > 0) {
        useFullGui = true;
      }
    }
    frame.setApplication(this);
    if (!isUsingFullGui()) {
      buildSingleApplicationPanel();
    } else {
      ((DockManagerW) getGuiManager().getLayout().getDockManager()).init(frame);
      Perspective p = null;
      if (perspective != null) {
        p =
            PerspectiveDecoder.decode(
                perspective,
                this.getKernel().getParser(),
                ToolBar.getAllToolsNoMacros(true, false, this));
      }
      getGuiManager().updateFrameSize();
      if (articleElement.getDataParamShowAlgebraInput(false)) {
        Perspective p2 = getTmpPerspective(p);
        if (!algebraVisible(p2) && getInputPosition() == InputPosition.algebraView) {
          setInputPosition(InputPosition.bottom, false);
          p2.setInputPosition(InputPosition.bottom);
        }
      }
      getGuiManager().getLayout().setPerspectives(getTmpPerspectives(), p);
    }

    getScriptManager().ggbOnInit(); // put this here from Application
    // constructor because we have to delay
    // scripts until the EuclidianView is
    // shown

    initUndoInfoSilent();

    getEuclidianView1().synCanvasSize();

    getAppletFrame().resetAutoSize();

    getEuclidianView1().doRepaint2();
    stopCollectingRepaints();
    frame.splash.canNowHide();
    if (!articleElement.preventFocus()) {
      requestFocusInWindow();
    }

    if (isUsingFullGui()) {
      if (needsSpreadsheetTableModel()) {
        getSpreadsheetTableModel();
      }
      refreshSplitLayoutPanel();

      // probably this method can be changed by more,
      // to be more like AppWapplication's method with the same name,
      // but preferring to change what is needed only to avoid new unknown
      // bugs
      if (getGuiManager().hasSpreadsheetView()) {
        DockPanel sp = getGuiManager().getLayout().getDockManager().getPanel(App.VIEW_SPREADSHEET);
        if (sp != null) {
          sp.deferredOnResize();
        }
      }
    }

    if (isUsingFullGui()) {
      updateNavigationBars();
    }
    this.setPreferredSize(new GDimensionW((int) this.getWidth(), (int) this.getHeight()));
    setDefaultCursor();
    GeoGebraFrameW.useDataParamBorder(getArticleElement(), frame);
    GeoGebraProfiler.getInstance().profileEnd();
    onOpenFile();
    showStartTooltip(0);
    setAltText();
    adjustViews();
    kernel.notifyScreenChanged();
  }