398 lines
9.1 KiB
C++
398 lines
9.1 KiB
C++
#ifndef _GUITAR_TABPAGE_HPP_
|
|
#define _GUITAR_TABPAGE_HPP_
|
|
#ifndef _COMMON_WINDOWS_HPP_
|
|
#include <common/windows.hpp>
|
|
#endif
|
|
#ifndef _COMMON_PUREDEVICE_HPP_
|
|
#include <common/purehdc.hpp>
|
|
#endif
|
|
#ifndef _COMMON_SMARTPOINTER_HPP_
|
|
#include <common/pointer.hpp>
|
|
#endif
|
|
#ifndef _COMMON_DIBITMAP_HPP_
|
|
#include <common/dib.hpp>
|
|
#endif
|
|
#ifndef _COMMON_CALLBACK_HPP_
|
|
#include <common/callback.hpp>
|
|
#endif
|
|
#ifndef _COMMON_PEN_HPP_
|
|
#include <common/pen.hpp>
|
|
#endif
|
|
#ifndef _COMMON_BITMAP_HPP_
|
|
#include <common/bitmap.hpp>
|
|
#endif
|
|
#ifndef _COMMON_FONT_HPP_
|
|
#include <common/font.hpp>
|
|
#endif
|
|
#ifndef _STATBAR_STATUSBAREX_HPP_
|
|
#include <statbar/statbarx.hpp>
|
|
#endif
|
|
#ifndef _GUITAR_SCROLLINFO_HPP_
|
|
#include <guitar/ScrollInfo.hpp>
|
|
#endif
|
|
#ifndef _GUITAR_TABENTRY_HPP_
|
|
#include <guitar/tabentry.hpp>
|
|
#endif
|
|
#ifndef _GUITAR_SEQUENCER_HPP_
|
|
#include <guitar/sequencer.hpp>
|
|
#endif
|
|
#ifndef _GUITAR_RANGE_HPP_
|
|
#include <guitar/range.hpp>
|
|
#endif
|
|
#ifndef _GUITAR_GLOBALDEFS_HPP_
|
|
#include <guitar/globaldefs.hpp>
|
|
#endif
|
|
|
|
class GUIWindow;
|
|
class ViewWindow;
|
|
|
|
class TabPage
|
|
{
|
|
public:
|
|
TabPage(ViewWindow &parent);
|
|
virtual ~TabPage();
|
|
bool insert(const TabEntries &entries,bool setDirty=true);
|
|
bool insert(const TabEntry &entry,bool setDirty=true);
|
|
bool insert(const TabRanges &ranges,bool setDirty=true);
|
|
bool update(GUIWindow &guiWindow);
|
|
bool play(void);
|
|
bool playRange(int rangeIndex);
|
|
bool playFromCurrent(void);
|
|
void cut(void);
|
|
void copy(void);
|
|
bool paste(void);
|
|
bool modifyProperties(void);
|
|
bool increaseTempo(void);
|
|
bool decreaseTempo(void);
|
|
bool getCancelled(void)const;
|
|
void setCancelled(bool cancelled);
|
|
bool isInPlay(void)const;
|
|
bool isPaused(void)const;
|
|
int getWidth(void)const;
|
|
int getHeight(void)const;
|
|
const TabEntries &getEntries(void)const;
|
|
const TabRanges &getRanges(void)const;
|
|
void setRanges(const TabRanges &ranges);
|
|
bool hasRange(void)const;
|
|
void setPlayNoteHandler(CallbackPointer &callbackPointer);
|
|
void setStartRange(void);
|
|
void setEndRange(void);
|
|
bool isDirty(void)const;
|
|
void isDirty(bool isDirty);
|
|
bool isInOutline(void)const;
|
|
bool isInSetRange(void)const;
|
|
void isInSetRange(bool isInSetRange);
|
|
void setStatusControlRef(SmartPointer<StatusBarEx> &statusBar);
|
|
bool isOkay(void)const;
|
|
private:
|
|
enum {BkColorBits=255,TabLineColor=0};
|
|
enum {LeftMargin=10,RightMargin=10,TopMargin=10,TabLines=6,TabSpacing=10,TabHeight=TabLines*TabSpacing,
|
|
TabSeparator=20,CharSpacing=3,TabClearance=3,MinCharWidth=16};
|
|
enum {RightArrow=0x27,LeftArrow=0x25,DownArrow=0x28,UpArrow=0x26,Insert=0x2D,Home=0x24,End=0x23,Delete=0x2E,Space=0x20,Enter=0x0D};
|
|
enum {PenWidth=1};
|
|
TabPage(const TabPage &someTabPage);
|
|
TabPage &operator=(const TabPage &someTabPage);
|
|
int drawTab(int marginLeft,int marginRight,int xPos,int yPos,int spacing,int lineCount);
|
|
void getEntryExtents(PureDevice &pureDevice,SIZE &sizeStruct,const String &string)const;
|
|
void bitBlt(PureDevice &pureDevice,const Rect &dstRect,const Point &srcPoint);
|
|
void bringOutlineIntoView(const Rect &outlineRect,const Rect &clientRect);
|
|
bool drawEntry(int entryIndex,const RGBColor &rgbColor=RGBColor(0,0,0));
|
|
bool getOutlineRect(Point mousePoint,int &entryIndex,Rect &outlineRect);
|
|
bool getNearestString(const Point &clickPoint,int &nearestString);
|
|
bool drawEntries(const RGBColor &rgbColor=RGBColor(0,0,0));
|
|
int getDimensions(GUIWindow &guiWindow,GDIPoint &gdiPoint);
|
|
bool getOutlineRect(int entryIndex,Rect &outlineRect);
|
|
int getWidestEntry(PureDevice &pureDevice)const;
|
|
bool getFretEntry(int selectedString=0);
|
|
bool createBitmap(GUIWindow &someGUIWindow);
|
|
bool outlineRect(const Rect &outlineRect);
|
|
Point getEntryPoint(int entryIndex);
|
|
bool drawTabPage(void);
|
|
void setItemsPerTab(int itemsPerTab);
|
|
void setNumTabs(int numTabs);
|
|
void setCharWidth(int charWidth);
|
|
int getNumEntries(void)const;
|
|
int getNumTabs(void)const;
|
|
int getItemsPerTab(void)const;
|
|
int getCharWidth(void)const;
|
|
void invalidate(Rect rect);
|
|
void isInOutline(bool isInOutline);
|
|
bool clearUpdate(void);
|
|
bool hasFocus(void)const;
|
|
void hasFocus(bool hasFocus);
|
|
void isInPlay(bool isInPlay);
|
|
void isPaused(bool isPaused);
|
|
void showFretEntry(const TabEntry &entry);
|
|
void setStatusText(const String &statusText);
|
|
void keepOutline(bool keepOutline);
|
|
bool keepOutline(void)const;
|
|
bool showCurrent(void);
|
|
void setCursorToTab(void);
|
|
|
|
CallbackData::ReturnType sizeHandler(CallbackData &someCallbackData);
|
|
CallbackData::ReturnType paintHandler(CallbackData &someCallbackData);
|
|
CallbackData::ReturnType verticalScrollHandler(CallbackData &someCallbackData);
|
|
CallbackData::ReturnType horizontalScrollHandler(CallbackData &someCallbackData);
|
|
CallbackData::ReturnType killFocusHandler(CallbackData &someCallbackData);
|
|
CallbackData::ReturnType setFocusHandler(CallbackData &someCallbackData);
|
|
CallbackData::ReturnType mouseMoveHandler(CallbackData &someCallbackData);
|
|
CallbackData::ReturnType leftButtonDownHandler(CallbackData &someCallbackData);
|
|
CallbackData::ReturnType leftButtonUpHandler(CallbackData &someCallbackData);
|
|
CallbackData::ReturnType leftButtonDoubleHandler(CallbackData &someCallbackData);
|
|
CallbackData::ReturnType keyDownHandler(CallbackData &someCallbackData);
|
|
|
|
Callback<TabPage> mSizeHandler;
|
|
Callback<TabPage> mPaintHandler;
|
|
Callback<TabPage> mVerticalScrollHandler;
|
|
Callback<TabPage> mHorizontalScrollHandler;
|
|
Callback<TabPage> mLeftButtonUpHandler;
|
|
Callback<TabPage> mLeftButtonDownHandler;
|
|
Callback<TabPage> mMouseMoveHandler;
|
|
Callback<TabPage> mKillFocusHandler;
|
|
Callback<TabPage> mSetFocusHandler;
|
|
Callback<TabPage> mLeftButtonDoubleHandler;
|
|
Callback<TabPage> mKeyDownHandler;
|
|
|
|
CallbackPointer mPlayNoteHandler;
|
|
TabEntries mTabEntries;
|
|
TabRanges mTabRanges;
|
|
SmartPointer<DIBitmap> mDIBitmap;
|
|
SmartPointer<DIBitmap> mOverlay;
|
|
SmartPointer<ViewWindow> mParent;
|
|
SmartPointer<Sequencer> mMIDIDevice;
|
|
SmartPointer<StatusBarEx> mStatusBar;
|
|
ScrollInfo mScrollInfo;
|
|
|
|
Rect mPrevOutlineRect;
|
|
Pen mOutlinePen;
|
|
int mNumTabs;
|
|
int mItemsPerTab;
|
|
int mCharWidth;
|
|
|
|
bool mIsInOutline;
|
|
bool mHasFocus;
|
|
bool mIsCancelled;
|
|
bool mIsInPlay;
|
|
bool mIsPaused;
|
|
bool mIsDirty;
|
|
bool mKeepOutline;
|
|
|
|
bool mIsInSetRange;
|
|
Range mCurrRange;
|
|
int mCurrEntryIndex;
|
|
Font mDrawFont;
|
|
};
|
|
|
|
inline
|
|
TabPage &TabPage::operator=(const TabPage &/*someTabPage*/)
|
|
{ // private implementation
|
|
return *this;
|
|
}
|
|
|
|
inline
|
|
int TabPage::getNumEntries(void)const
|
|
{
|
|
return mTabEntries.size();
|
|
}
|
|
|
|
inline
|
|
void TabPage::getEntryExtents(PureDevice &pureDevice,SIZE &sizeStruct,const String &string)const
|
|
{
|
|
pureDevice.getTextExtentPoint32(((String&)string).str(),&sizeStruct);
|
|
}
|
|
|
|
inline
|
|
int TabPage::getWidth(void)const
|
|
{
|
|
return ((SmartPointer<DIBitmap>&)mDIBitmap)->width();
|
|
}
|
|
|
|
inline
|
|
int TabPage::getHeight(void)const
|
|
{
|
|
return ((SmartPointer<DIBitmap>&)mDIBitmap)->height();
|
|
}
|
|
|
|
inline
|
|
int TabPage::getNumTabs(void)const
|
|
{
|
|
return mNumTabs;
|
|
}
|
|
|
|
inline
|
|
void TabPage::setNumTabs(int numTabs)
|
|
{
|
|
mNumTabs=numTabs;
|
|
}
|
|
|
|
inline
|
|
int TabPage::getCharWidth(void)const
|
|
{
|
|
return mCharWidth;
|
|
}
|
|
|
|
inline
|
|
void TabPage::setCharWidth(int charWidth)
|
|
{
|
|
mCharWidth=charWidth;
|
|
}
|
|
|
|
inline
|
|
int TabPage::getItemsPerTab(void)const
|
|
{
|
|
return mItemsPerTab;
|
|
}
|
|
|
|
inline
|
|
void TabPage::setItemsPerTab(int itemsPerTab)
|
|
{
|
|
mItemsPerTab=itemsPerTab;
|
|
}
|
|
|
|
inline
|
|
void TabPage::isInOutline(bool isInOutline)
|
|
{
|
|
mIsInOutline=isInOutline;
|
|
}
|
|
|
|
inline
|
|
bool TabPage::isInOutline(void)const
|
|
{
|
|
return mIsInOutline;
|
|
}
|
|
|
|
inline
|
|
bool TabPage::hasFocus(void)const
|
|
{
|
|
return mHasFocus;
|
|
}
|
|
|
|
inline
|
|
void TabPage::hasFocus(bool hasFocus)
|
|
{
|
|
mHasFocus=hasFocus;
|
|
}
|
|
|
|
inline
|
|
bool TabPage::getCancelled(void)const
|
|
{
|
|
return mIsCancelled;
|
|
}
|
|
|
|
inline
|
|
void TabPage::setCancelled(bool cancelled)
|
|
{
|
|
mIsCancelled=cancelled;
|
|
}
|
|
|
|
inline
|
|
bool TabPage::isInPlay(void)const
|
|
{
|
|
return mIsInPlay;
|
|
}
|
|
|
|
inline
|
|
void TabPage::isInPlay(bool isInPlay)
|
|
{
|
|
mIsInPlay=isInPlay;
|
|
}
|
|
|
|
inline
|
|
bool TabPage::isPaused(void)const
|
|
{
|
|
return mIsPaused;
|
|
}
|
|
|
|
inline
|
|
void TabPage::isPaused(bool isPaused)
|
|
{
|
|
mIsPaused=isPaused;
|
|
}
|
|
|
|
inline
|
|
void TabPage::setPlayNoteHandler(CallbackPointer &callbackPointer)
|
|
{
|
|
mPlayNoteHandler=callbackPointer;
|
|
}
|
|
|
|
inline
|
|
const TabEntries &TabPage::getEntries(void)const
|
|
{
|
|
return mTabEntries;
|
|
}
|
|
|
|
inline
|
|
const TabRanges &TabPage::getRanges(void)const
|
|
{
|
|
return mTabRanges;
|
|
}
|
|
|
|
inline
|
|
bool TabPage::hasRange(void)const
|
|
{
|
|
return mTabRanges.size()?true:false;
|
|
}
|
|
|
|
inline
|
|
bool TabPage::isDirty(void)const
|
|
{
|
|
return mIsDirty;
|
|
}
|
|
|
|
inline
|
|
void TabPage::isDirty(bool isDirty)
|
|
{
|
|
mIsDirty=isDirty;
|
|
}
|
|
|
|
inline
|
|
void TabPage::keepOutline(bool keepOutline)
|
|
{
|
|
GlobalDefs::outDebug(String("[TabPage::keepOutline]")+(keepOutline?String("true"):String("false")),GlobalDefs::Debug);
|
|
mKeepOutline=keepOutline;
|
|
}
|
|
|
|
inline
|
|
bool TabPage::keepOutline(void)const
|
|
{
|
|
return mKeepOutline;
|
|
}
|
|
|
|
inline
|
|
bool TabPage::isInSetRange(void)const
|
|
{
|
|
return mIsInSetRange;
|
|
}
|
|
|
|
inline
|
|
void TabPage::isInSetRange(bool isInSetRange)
|
|
{
|
|
mIsInSetRange=isInSetRange;
|
|
}
|
|
|
|
inline
|
|
void TabPage::setRanges(const TabRanges &ranges)
|
|
{
|
|
mTabRanges=ranges;
|
|
isDirty(true);
|
|
}
|
|
|
|
inline
|
|
void TabPage::setStatusText(const String &statusText)
|
|
{
|
|
if(!mStatusBar.isOkay())return;
|
|
mStatusBar->setText(statusText);
|
|
}
|
|
|
|
inline
|
|
void TabPage::setStatusControlRef(SmartPointer<StatusBarEx> &statusBar)
|
|
{
|
|
mStatusBar=statusBar;
|
|
}
|
|
|
|
inline
|
|
bool TabPage::isOkay(void)const
|
|
{
|
|
return mTabEntries.size()&&mDIBitmap.isOkay();
|
|
}
|
|
#endif |