Package org.intellij.grammar.parser

Examples of org.intellij.grammar.parser.GeneratedParserUtilBase$Frame


      Animation animation) {
    d.printSection(animation.getName());
    d.printKeyValue("DefaultKeyDuration",""+animation.getDefaultKeyDuration());
    Frame[] frames = animation.getFrames();
    for(int fi=0; fi<frames.length; fi++) {
      Frame f = frames[fi];
      d.printKeyValue("KeyData"+(fi+1),f.getName());
      if(f.getKeyDuration()>0)
        d.printKeyValue("KeyDuration"+(fi+1),""+f.getKeyDuration());
    }
    for(int fi=0; fi<frames.length; fi++) {
      Frame f = frames[fi];
      Point offset = f.getOffset();
      if(offset.x!=0 || offset.y!=0) {
        d.printKeyValue("KeyEventName"+(fi+1),"__"+fi);
        d.printKeyValue("__"+fi, "("+offset.x+","+offset.y+",0)");       
      }
    }
View Full Code Here


    return null;
  }

  @Override
  public long getFrameDelay(int index) {
    Frame frame = getFrame(index);
    return (long) (frame.getFinalFrameDuration()*1000);
  }
 
View Full Code Here

        for(Frame frame: animation.getFrames()) {
          paintFrame(g, frame);
        }
      }
      if (selected instanceof Frame) {
        Frame frame = (Frame) selected;
        paintFrame(g,frame);
      }   
    }
    if(freeOffsetStart != null && freeOffsetEnd != null) {
      Point base = toScreen(freeOffsetStart);
View Full Code Here

  private int snap(int snapMe){
    return java.lang.Math.round( snapMe/parent.SnapSlider.getValue() )*parent.SnapSlider.getValue();
  }
 
  @Override public void mouseDragged(MouseEvent e) {
    Frame selected = getSelectedFrame();
    if(selected==null) return;
    if((e.getModifiersEx() & MouseEvent.BUTTON3_DOWN_MASK) == MouseEvent.BUTTON3_DOWN_MASK) {
      if(parent.isSettingOffsetDirectly())
        handleEditOffset(selected,e);     
      if(parent.isSettingOffsetWithRelativePos())
        freeOffsetEnd = getViewPoint(e);
      if(parent.isSettingPivot()) 
        selected.setPivot(new Point(getViewX(e),getViewY(e)));
      if(parent.isRectangleLocked()) {
        int x = snap(getViewX(e)), y = snap(getViewY(e))

        selected.setRectangle(new Rectangle(x,y,parent.lockRectButton.lastRect.width,parent.lockRectButton.lastRect.height));
        selected.setImageFile(editorFrame.getData().getProject().getRelativeFile(imageFile));

        int PivotDX = parent.lockRectButton.lastPivot.x - parent.lockRectButton.lastRect.x;
        int PivotDY = parent.lockRectButton.lastPivot.y - parent.lockRectButton.lastRect.y;
        selected.setPivot(new Point(x+PivotDX,y+PivotDY));
      }
      if(parent.isEditingRectangle()){
       
        Rectangle rect = selected.getRectangle();
        int x = snap(rect.x), y = snap(rect.y);
        int dx = snap(getViewX(e)-x), dy = snap(getViewY(e)-y);
        Rectangle newRectangle = new Rectangle(x,y,dx,dy);
        selected.setRectangle(newRectangle);
        selected.setImageFile(editorFrame.getData().getProject().getRelativeFile(imageFile));
      }
      if(parent.isSettingOffsetWithTemporaryPivot()) {
        if(parent.temporaryPivotOffsetButton.getPivot2()!=null) {
          parent.temporaryPivotOffsetButton.setPivot2(getViewPoint(e));
          selected.setOffset(parent.temporaryPivotOffsetButton.getOffset());
        }
        else
          parent.temporaryPivotOffsetButton.setPivot1(getViewPoint(e));
      }
    }
View Full Code Here

    repaint(20);
  }

  @Override
  public void mousePressed(MouseEvent e) {
    Frame selected  = getSelectedFrame();
    if(selected==null) return;
 
    if(e.getButton() == MouseEvent.BUTTON3) {
      if(parent.isSettingOffsetDirectly()) {
            handleEditOffset(selected, e);
      }
        if (parent.isSettingOffsetWithRelativePos()) {
          freeOffsetStart = getViewPoint(e);
        }
      if(parent.isSettingPivot()) {
        selected.setPivot(new Point(getViewX(e),getViewY(e)));
      }   
      if (parent.isRectangleLocked()) {
        selected.setRectangle(new Rectangle(getViewX(e),getViewY(e),parent.lockRectButton.lastRect.width,parent.lockRectButton.lastRect.height));
        selected.setImageFile(editorFrame.getData().getProject().getRelativeFile(imageFile));
        int PivotDX = parent.lockRectButton.lastPivot.x - parent.lockRectButton.lastRect.x;
        int PivotDY = parent.lockRectButton.lastPivot.y - parent.lockRectButton.lastRect.y;
        selected.setPivot(new Point(getViewX(e)+PivotDX,getViewY(e)+PivotDY));         
      }
      if(parent.isEditingRectangle()) {
        selected.setRectangle(new Rectangle(getViewX(e),getViewY(e),0,0));
        selected.setImageFile(editorFrame.getData().getProject().getRelativeFile(imageFile));
        selected.setPivot(null);
      }
      if(parent.isSettingOffsetWithTemporaryPivot()) {
        if(parent.temporaryPivotOffsetButton.getPivot1()==null) {
          parent.temporaryPivotOffsetButton.setPivot1(getViewPoint(e));
        } else {
          parent.temporaryPivotOffsetButton.setPivot2(getViewPoint(e));
          selected.setOffset(parent.temporaryPivotOffsetButton.getOffset());
        }
      }
    }
    repaint(20);
  }
View Full Code Here

    return e.getY()/zoom;
 
 
  @Override
  public void mouseReleased(MouseEvent e) {
    Frame frame = getSelectedFrame();
    if(parent.isSettingOffsetWithRelativePos()) {
      if(frame!=null) {
        frame.setOffset(new Point(freeOffsetEnd.x-freeOffsetStart.x, freeOffsetEnd.y-freeOffsetStart.y));
      }
      freeOffsetEnd = null;
      freeOffsetStart = null;
      repaint(20);
    }
View Full Code Here

    JTree.DropLocation loc = (JTree.DropLocation) support.getDropLocation();
    Object parent = loc.getPath().getLastPathComponent();
    int index = loc.getChildIndex();
    if(index==-1) { // We're dropping "ON" something
      if(parent instanceof Frame) {
        Frame frame = (Frame) parent;
        index = frame.getParent().getFrameIndex(frame)+1;
        parent = frame.getParent();
      } else if(parent instanceof Animation) {
        index = ((Animation) parent).getFrameCount();
      }
    }
    if(parent instanceof Animation) {
      try {
        Frame[] frames = (Frame[]) support.getTransferable().getTransferData(FrameFlavor);
        if(support.getDropAction() == COPY)
          for(Frame frame:frames) ((Animation) parent).addFrame(frame.clone(),index++);
        else if (support.getDropAction() == MOVE) {
          index--;
          for(Frame frame:frames) index = frame.move(parent,index);                   
        }
        return true;
      } catch (Exception e) {
          e.printStackTrace();
          return false;
View Full Code Here

    return null;
  }

  @Override
  public long getFrameDelay(int index) {
    Frame frame = getFrame(index);
    return (long) (frame.getFinalFrameDuration()*1000);
  }
 
View Full Code Here

    restart();
  }
 
  private boolean isValidFrame(Object object) {
    if(object instanceof Frame) {
      Frame frame = (Frame) object;
      if(frame.getRectangle() == null) return false;
      else return true;
    } else
      return false;
  }
View Full Code Here

    int index;
    if(objects[0]!=selectedFrame)
      index=0;
    else
      index=1;
    Frame frame = (Frame) objects[index];
    return frame.getPivot();
  }
View Full Code Here

TOP

Related Classes of org.intellij.grammar.parser.GeneratedParserUtilBase$Frame

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.