Beispiel #1
0
        public void handleResize(Object sender, EventArgs e)
        {
            VsqFileEx vsq          = AppManager.getVsqFile();
            int       max          = AppManager.getCurrentClock();
            int       total_clocks = vsq.TotalClocks;

            if (max < total_clocks)
            {
                max = total_clocks;
            }
            int min_width = (int)(max * mOverviewPixelPerClock) + this.Width;

            if (mDrawer.getWidth() < min_width)
            {
                lock (mDrawerSyncRoot) {
                    mDrawer.setWidth(min_width);
                }
                updateCachedImage();
            }
        }
Beispiel #2
0
        public void updateCachedImage()
        {
            VsqFileEx vsq = AppManager.getVsqFile();

            if (vsq == null)
            {
                return;
            }
            if (mMainForm == null)
            {
                return;
            }
            int max          = AppManager.getCurrentClock();
            int total_clocks = vsq.TotalClocks;

            if (max < total_clocks)
            {
                max = total_clocks;
            }
            int required_width = (int)(max * mOverviewPixelPerClock) + this.Width;

            updateCachedImage(required_width);
        }
Beispiel #3
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);
        }
Beispiel #4
0
        /// <summary>
        /// コンポーネントの描画関数です
        /// </summary>
        /// <param name="g"></param>
        public void paint(Graphics g1)
        {
            int       width  = Width;
            int       height = Height;
            Rectangle rc     = new Rectangle(0, 0, width, height);

            Graphics2D g = (Graphics2D)g1;

            // 背景を塗りつぶす
            g.setStroke(getStrokeDefault());
            g.setColor(Color.gray);
            g.fillRect(rc.x, rc.y, rc.width, rc.height);

            if (AppManager.skipDrawingWaveformWhenPlaying && AppManager.isPlaying())
            {
                // 左側のボタン部との境界線
                g.setColor(mBorderColor);
                g.drawLine(0, 0, 0, height);

                g.setColor(Color.black);
                PortUtil.drawStringEx(
                    g,
                    "(hidden for performance)",
                    AppManager.baseFont8,
                    rc,
                    PortUtil.STRING_ALIGN_CENTER,
                    PortUtil.STRING_ALIGN_CENTER);
                return;
            }

            // スケール線を描く
            int half_height = height / 2;

            g.setColor(Color.black);
            g.drawLine(0, half_height, width, half_height);

            // 描画コンテキストを用いて波形を描画
            int             selected = AppManager.getSelected();
            WaveDrawContext context  = mDrawer[selected - 1];

            if (context != null)
            {
                if (mAutoMaximize)
                {
                    context.draw(
                        g,
                        Color.black,
                        rc,
                        AppManager.clockFromXCoord(AppManager.keyWidth),
                        AppManager.clockFromXCoord(AppManager.keyWidth + width),
                        AppManager.getVsqFile().TempoTable,
                        AppManager.mMainWindowController.getScaleX());
                }
                else
                {
                    context.draw(
                        g,
                        Color.black,
                        rc,
                        AppManager.clockFromXCoord(AppManager.keyWidth),
                        AppManager.clockFromXCoord(AppManager.keyWidth + width),
                        AppManager.getVsqFile().TempoTable,
                        AppManager.mMainWindowController.getScaleX(),
                        mScale);
                }
            }

            // 左側のボタン部との境界線
            g.setColor(mBorderColor);
            g.drawLine(0, 0, 0, height);

            // ソングポジション
            int song_pos_x = AppManager.xCoordFromClocks(AppManager.getCurrentClock()) - AppManager.keyWidth;

            if (0 < song_pos_x)
            {
                g.setColor(Color.white);
                g.setStroke(getStroke2px());
                g.drawLine(song_pos_x, 0, song_pos_x, height);
            }
        }