Search in sources :

Example 1 with GroupFrame

use of com.xenoage.zong.layout.frames.GroupFrame in project Zong by Xenoage.

the class PageTest method createPageWithUnrotatedFrames.

/**
 * Creates a layout with a page with some unrotated frames for testing.
 */
private Layout createPageWithUnrotatedFrames() {
    Layout layout = new Layout(null);
    PageFormat pf = new PageFormat(new Size2f(200, 200), new PageMargins(10, 10, 10, 10));
    Page page = new Page(pf);
    layout.addPage(page);
    // Frame 1
    frm1 = new ScoreFrame();
    frm1.setPosition(p(120, 120));
    frm1.setSize(s(60, 80));
    page.addFrame(frm1);
    // Frame 2
    frm2 = new GroupFrame();
    frm2.setPosition(p(90, 110));
    frm2.setSize(s(60, 40));
    page.addFrame(frm2);
    // Childframe 2a
    frm2a = new ScoreFrame();
    frm2a.setPosition(p(30, 0));
    frm2a.setSize(s(10, 10));
    frm2.addChildFrame(frm2a);
    // Childframe 2b
    frm2b = new ScoreFrame();
    frm2b.setPosition(p(-10, -20));
    frm2b.setSize(s(10, 10));
    frm2.addChildFrame(frm2b);
    // Frame 3
    frm3 = new ScoreFrame();
    frm3.setPosition(p(30, 80));
    frm3.setSize(s(30, 60));
    page.addFrame(frm3);
    return layout;
}
Also used : PageMargins(com.xenoage.zong.core.format.PageMargins) PageFormat(com.xenoage.zong.core.format.PageFormat) ScoreFrame(com.xenoage.zong.layout.frames.ScoreFrame) Size2f(com.xenoage.utils.math.geom.Size2f) GroupFrame(com.xenoage.zong.layout.frames.GroupFrame)

Example 2 with GroupFrame

use of com.xenoage.zong.layout.frames.GroupFrame in project Zong by Xenoage.

the class LayoutTest method createTestLayout.

private void createTestLayout() {
    // layout:
    // [page 1 [frame 1_1]]
    // [page 2 [frame 2_1] [group 2_2 [group 2_2_1 [frame 2_2_1_1] [frame 2_2_1_2]] [frame 2_2_2]]]
    // [page 3 [frame 3_1]]
    layout = new Layout(null);
    // page 1
    page_1 = new Page(PageFormat.Companion.getDefaultValue());
    layout.addPage(page_1);
    frame_1_1 = new TestFrame();
    page_1.addFrame(frame_1_1);
    // page 2
    page_2 = new Page(PageFormat.Companion.getDefaultValue());
    layout.addPage(page_2);
    frame_2_1 = new TestFrame();
    page_2.addFrame(frame_2_1);
    group_2_2 = new GroupFrame();
    page_2.addFrame(group_2_2);
    group_2_2_1 = new GroupFrame();
    group_2_2.addChildFrame(group_2_2_1);
    frame_2_2_1_1 = new TestFrame();
    group_2_2_1.addChildFrame(frame_2_2_1_1);
    frame_2_2_1_2 = new TestFrame();
    group_2_2_1.addChildFrame(frame_2_2_1_2);
    frame_2_2_2 = new TestFrame();
    group_2_2.addChildFrame(frame_2_2_2);
    // page 3
    page_3 = new Page(PageFormat.Companion.getDefaultValue());
    layout.addPage(page_3);
    frame_3_1 = new TestFrame();
    page_3.addFrame(frame_3_1);
}
Also used : TestFrame(com.xenoage.zong.layout.frames.TestFrame) GroupFrame(com.xenoage.zong.layout.frames.GroupFrame)

Example 3 with GroupFrame

use of com.xenoage.zong.layout.frames.GroupFrame in project Zong by Xenoage.

the class PageTest method createPageWithRotatedFrames.

/**
 * Creates a layout with a page with some rotated frames for testing.
 * See PageTest.odg for a preview of the page.
 */
private Layout createPageWithRotatedFrames() {
    Layout layout = new Layout(null);
    PageFormat pf = new PageFormat(new Size2f(200, 200), new PageMargins(10, 10, 10, 10));
    Page page = new Page(pf);
    layout.addPage(page);
    // Frame 1
    frm1 = new ScoreFrame();
    frm1.setPosition(p(120, 120));
    frm1.setSize(s(60, 80));
    frm1.setRotation(-30);
    page.addFrame(frm1);
    // Frame 2
    frm2 = new GroupFrame();
    frm2.setPosition(p(90, 110));
    frm2.setSize(s(60, 40));
    frm2.setRotation(70);
    page.addFrame(frm2);
    // Childframe 2a
    frm2a = new ScoreFrame();
    frm2a.setPosition(p(20, 10));
    frm2a.setSize(s(10, 10));
    frm2a.setRotation(0);
    frm2.addChildFrame(frm2a);
    // Childframe 2b
    frm2b = new ScoreFrame();
    frm2b.setPosition(p(-10, -5));
    frm2b.setSize(s(20, 20));
    frm2b.setRotation(70);
    frm2.addChildFrame(frm2b);
    // Frame 3
    frm3 = new ScoreFrame();
    frm3.setPosition(p(95, 155));
    frm3.setSize(s(80, 40));
    frm3.setRotation(30);
    page.addFrame(frm3);
    return layout;
}
Also used : PageMargins(com.xenoage.zong.core.format.PageMargins) PageFormat(com.xenoage.zong.core.format.PageFormat) ScoreFrame(com.xenoage.zong.layout.frames.ScoreFrame) Size2f(com.xenoage.utils.math.geom.Size2f) GroupFrame(com.xenoage.zong.layout.frames.GroupFrame)

Example 4 with GroupFrame

use of com.xenoage.zong.layout.frames.GroupFrame in project Zong by Xenoage.

the class GroupFrameRenderer method paint.

@Override
public void paint(Frame frame, Canvas canvas, RendererArgs args) {
    super.paint(frame, canvas, args);
    // paint child frames
    GroupFrame groupFrame = (GroupFrame) frame;
    for (Frame child : groupFrame.children) {
        FramesRenderer.paintAny(child, canvas, args);
    }
}
Also used : Frame(com.xenoage.zong.layout.frames.Frame) GroupFrame(com.xenoage.zong.layout.frames.GroupFrame) GroupFrame(com.xenoage.zong.layout.frames.GroupFrame)

Aggregations

GroupFrame (com.xenoage.zong.layout.frames.GroupFrame)4 Size2f (com.xenoage.utils.math.geom.Size2f)2 PageFormat (com.xenoage.zong.core.format.PageFormat)2 PageMargins (com.xenoage.zong.core.format.PageMargins)2 ScoreFrame (com.xenoage.zong.layout.frames.ScoreFrame)2 Frame (com.xenoage.zong.layout.frames.Frame)1 TestFrame (com.xenoage.zong.layout.frames.TestFrame)1