Exemplo n.º 1
0
        public void paint(Graphics g1)
        {
            if (mMainForm == null)
            {
                return;
            }
            Graphics2D g       = new Graphics2D(g1.nativeGraphics);
            int        doffset = (int)(mOverviewStartToDrawClock * mOverviewPixelPerClock);

            mDrawer.draw(doffset, g);

            int key_width     = AppManager.keyWidth;
            int width         = this.Width;
            int height        = this.Height;
            int xoffset       = key_width + AppManager.keyOffset;
            int current_start = AppManager.clockFromXCoord(key_width);
            int current_end   = AppManager.clockFromXCoord(mMainForm.pictPianoRoll.getWidth());
            int x_start       = getOverviewXCoordFromClock(current_start);
            int x_end         = getOverviewXCoordFromClock(current_end);

            // 移動中している最中に,移動開始直前の部分を影付で表示する
            int stdx = AppManager.mMainWindowController.getStartToDrawX();
            int act_start_to_draw_x = (int)(mMainForm.hScroll.Value * AppManager.mMainWindowController.getScaleX());

            if (act_start_to_draw_x != stdx)
            {
                int       act_start_clock = AppManager.clockFromXCoord(key_width - stdx + act_start_to_draw_x);
                int       act_end_clock   = AppManager.clockFromXCoord(mMainForm.pictPianoRoll.getWidth() - stdx + act_start_to_draw_x);
                int       act_start_x     = getOverviewXCoordFromClock(act_start_clock);
                int       act_end_x       = getOverviewXCoordFromClock(act_end_clock);
                Rectangle rcm             = new Rectangle(act_start_x, 0, act_end_x - act_start_x, height);
                g.setColor(new Color(0, 0, 0, 100));
                g.fillRect(rcm.x + xoffset, rcm.y, rcm.width, rcm.height);
            }

            // 現在の表示範囲
            Rectangle rc = new Rectangle(x_start, 0, x_end - x_start, height - 1);

            g.setColor(new Color(255, 255, 255, 50));
            g.fillRect(rc.x + xoffset, rc.y, rc.width, rc.height);
            g.setColor(AppManager.getHilightColor());
            g.drawRect(rc.x + xoffset, rc.y, rc.width, rc.height);

            // ソングポジション
            int px_current_clock = (int)((AppManager.getCurrentClock() - mOverviewStartToDrawClock) * mOverviewPixelPerClock);

            g.setStroke(getStroke2px());
            g.setColor(Color.white);
            g.drawLine(px_current_clock + xoffset, 0, px_current_clock + xoffset, height);
            g.setStroke(getStrokeDefault());

            int   btn_width = 16;
            Color btn_bg    = new Color(149, 149, 149);

            // 左側のボタン類
            g.setStroke(getStrokeDefault());
            g.setColor(btn_bg);
            g.fillRect(0, 0, key_width, height);
            g.setColor(AppManager.COLOR_BORDER);
            // zoomボタン
            rc = getButtonBoundsZoom();
            g.setColor(mOverviewButtonZoomMouseDowned ? Color.gray : Color.lightGray);
            g.fillRect(rc.x, rc.y, rc.width, rc.height);
            g.setColor(AppManager.COLOR_BORDER);
            g.drawRect(rc.x, rc.y, rc.width, rc.height);
            int centerx = rc.x + rc.width / 2 + 1;
            int centery = rc.y + rc.height / 2 + 1;

            g.setColor(mOverviewButtonZoomMouseDowned ? Color.lightGray : Color.gray);
            g.setStroke(getStroke2px());
            g.drawLine(centerx - 4, centery, centerx + 4, centery);
            g.drawLine(centerx, centery - 4, centerx, centery + 4);
            g.setStroke(getStrokeDefault());
            // moozボタン
            rc = getButtonBoundsMooz();
            g.setColor(mOverviewButtonMoozMouseDowned ? Color.gray : Color.lightGray);
            g.fillRect(rc.x, rc.y, rc.width, rc.height);
            g.setColor(AppManager.COLOR_BORDER);
            g.drawRect(rc.x, rc.y, rc.width, rc.height);
            centerx = rc.x + rc.width / 2 + 1;
            centery = rc.y + rc.height / 2 + 1;
            g.setColor(mOverviewButtonMoozMouseDowned ? Color.lightGray : Color.gray);
            g.setStroke(getStroke2px());
            g.drawLine(centerx - 4, centery, centerx + 4, centery);
            g.setStroke(getStrokeDefault());
            // left1ボタン
            rc = getButtonBoundsLeft1();
            g.setColor(mOverviewButtonLeft1MouseDowned ? Color.gray : Color.lightGray);
            g.fillRect(rc.x, rc.y, rc.width, rc.height);
            g.setColor(AppManager.COLOR_BORDER);
            g.drawRect(rc.x, rc.y, rc.width, rc.height);
            centerx = rc.x + rc.width / 2 + 1;
            centery = rc.y + rc.height / 2 + 1;
            g.setColor(mOverviewButtonLeft1MouseDowned ? Color.lightGray : Color.gray);
            g.drawPolyline(new int[] { centerx + 4, centerx - 4, centerx + 4 }, new int[] { centery - 4, centery, centery + 4 }, 3);
            // left2ボタン
            rc = getButtonBoundsLeft2();
            g.setColor(mOverviewButtonLeft2MouseDowned ? Color.gray : Color.lightGray);
            g.fillRect(rc.x, rc.y, rc.width, rc.height);
            g.setColor(AppManager.COLOR_BORDER);
            g.drawRect(rc.x, rc.y, rc.width, rc.height);
            centerx = rc.x + rc.width / 2 + 1;
            centery = rc.y + rc.height / 2 + 1;
            g.setColor(mOverviewButtonLeft2MouseDowned ? Color.lightGray : Color.gray);
            g.drawPolyline(new int[] { centerx - 4, centerx + 4, centerx - 4 }, new int[] { centery - 4, centery, centery + 4 }, 3);

            // 右側のボタン類
            g.setColor(btn_bg);
            g.fillRect(width - btn_width - 3, 0, btn_width + 3, height);
            // right1ボタン
            rc = getButtonBoundsRight1();
            g.setColor(mOverviewButtonRight1MouseDowned ? Color.gray : Color.lightGray);
            g.fillRect(rc.x, rc.y, rc.width, rc.height);
            g.setColor(AppManager.COLOR_BORDER);
            g.drawRect(rc.x, rc.y, rc.width, rc.height);
            centerx = rc.x + rc.width / 2 + 1;
            centery = rc.y + rc.height / 2 + 1;
            g.setColor(mOverviewButtonRight1MouseDowned ? Color.lightGray : Color.gray);
            g.drawPolyline(new int[] { centerx + 4, centerx - 4, centerx + 4 }, new int[] { centery - 4, centery, centery + 4 }, 3);
            // right2ボタン
            rc = getButtonBoundsRight2();
            g.setColor(mOverviewButtonRight2MouseDowned ? Color.gray : Color.lightGray);
            g.fillRect(rc.x, rc.y, rc.width, rc.height);
            g.setColor(AppManager.COLOR_BORDER);
            g.drawRect(rc.x, rc.y, rc.width, rc.height);
            centerx = rc.x + rc.width / 2 + 1;
            centery = rc.y + rc.height / 2 + 1;
            g.setColor(mOverviewButtonRight2MouseDowned ? Color.lightGray : Color.gray);
            g.drawPolyline(new int[] { centerx - 4, centerx + 4, centerx - 4 }, new int[] { centery - 4, centery, centery + 4 }, 3);
        }