Initial
This commit is contained in:
79
Histogram/ClrRect.hpp
Normal file
79
Histogram/ClrRect.hpp
Normal file
@@ -0,0 +1,79 @@
|
||||
#ifndef _HISTOGRAM_COLORRECT_HPP_
|
||||
#define _HISTOGRAM_COLORRECT_HPP_
|
||||
#ifndef _ENGINE_RECT3D_HPP_
|
||||
#include <engine/rect3d.hpp>
|
||||
#endif
|
||||
|
||||
class ColorRect : public Rect3D
|
||||
{
|
||||
public:
|
||||
ColorRect(void);
|
||||
ColorRect(const ColorRect &someColorRect);
|
||||
ColorRect(const Rect3D &someRect3D,BYTE paletteIndex);
|
||||
ColorRect(const ColorRect &someColorRect,BYTE paletteIndex);
|
||||
virtual~ColorRect();
|
||||
ColorRect &operator=(const ColorRect &someColorRect);
|
||||
WORD operator==(const ColorRect &someColorRect);
|
||||
BYTE paletteIndex(void)const;
|
||||
void paletteIndex(BYTE paletteIndex);
|
||||
private:
|
||||
BYTE mPaletteIndex;
|
||||
};
|
||||
|
||||
inline
|
||||
ColorRect::ColorRect(void)
|
||||
: mPaletteIndex(0)
|
||||
{
|
||||
}
|
||||
|
||||
inline
|
||||
ColorRect::ColorRect(const ColorRect &someColorRect)
|
||||
{
|
||||
*this=someColorRect;
|
||||
}
|
||||
|
||||
inline
|
||||
ColorRect::ColorRect(const ColorRect &someColorRect,BYTE paletteIndex)
|
||||
: Rect3D((Rect3D&)someColorRect), mPaletteIndex(paletteIndex)
|
||||
{
|
||||
}
|
||||
|
||||
inline
|
||||
ColorRect::ColorRect(const Rect3D &someRect3D,BYTE paletteIndex)
|
||||
: mPaletteIndex(paletteIndex)
|
||||
{
|
||||
(Rect3D&)*this=(Rect3D&)someRect3D;
|
||||
}
|
||||
|
||||
inline
|
||||
ColorRect::~ColorRect()
|
||||
{
|
||||
}
|
||||
|
||||
inline
|
||||
ColorRect &ColorRect::operator=(const ColorRect &someColorRect)
|
||||
{
|
||||
(Rect3D&)*this=(Rect3D&)someColorRect;
|
||||
paletteIndex(someColorRect.paletteIndex());
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline
|
||||
WORD ColorRect::operator==(const ColorRect &someColorRect)
|
||||
{
|
||||
return ((Rect3D&)*this==(Rect3D&)someColorRect&&
|
||||
paletteIndex()==someColorRect.paletteIndex());
|
||||
}
|
||||
|
||||
inline
|
||||
BYTE ColorRect::paletteIndex(void)const
|
||||
{
|
||||
return mPaletteIndex;
|
||||
}
|
||||
|
||||
inline
|
||||
void ColorRect::paletteIndex(BYTE paletteIndex)
|
||||
{
|
||||
mPaletteIndex=paletteIndex;
|
||||
}
|
||||
#endif
|
||||
BIN
Histogram/Debug/Graph3D.obj
Normal file
BIN
Histogram/Debug/Graph3D.obj
Normal file
Binary file not shown.
BIN
Histogram/Debug/GraphDlg.obj
Normal file
BIN
Histogram/Debug/GraphDlg.obj
Normal file
Binary file not shown.
BIN
Histogram/Debug/GraphWnd.obj
Normal file
BIN
Histogram/Debug/GraphWnd.obj
Normal file
Binary file not shown.
BIN
Histogram/Debug/histogram.lib
Normal file
BIN
Histogram/Debug/histogram.lib
Normal file
Binary file not shown.
BIN
Histogram/Debug/histogram.pch
Normal file
BIN
Histogram/Debug/histogram.pch
Normal file
Binary file not shown.
BIN
Histogram/Debug/vc60.idb
Normal file
BIN
Histogram/Debug/vc60.idb
Normal file
Binary file not shown.
BIN
Histogram/Debug/vc60.pdb
Normal file
BIN
Histogram/Debug/vc60.pdb
Normal file
Binary file not shown.
25
Histogram/Graph3D.cpp
Normal file
25
Histogram/Graph3D.cpp
Normal file
@@ -0,0 +1,25 @@
|
||||
#include <histogram/graph3d.hpp>
|
||||
|
||||
Graph3D::Graph3D(GUIWindow &someGUIWindow)
|
||||
: mGUIWindow(&someGUIWindow), DIB3D(someGUIWindow)
|
||||
{
|
||||
}
|
||||
|
||||
Graph3D::Graph3D(GUIWindow &someGUIWindow,PurePalette &purePalette)
|
||||
: mGUIWindow(&someGUIWindow), DIB3D(someGUIWindow,purePalette)
|
||||
{
|
||||
}
|
||||
|
||||
Graph3D::~Graph3D()
|
||||
{
|
||||
}
|
||||
|
||||
WORD Graph3D::viewPortWidth(void)const
|
||||
{
|
||||
return ((SmartPointer<GUIWindow>&)mGUIWindow)->width();
|
||||
}
|
||||
|
||||
WORD Graph3D::viewPortHeight(void)const
|
||||
{
|
||||
return ((SmartPointer<GUIWindow>&)mGUIWindow)->height();
|
||||
}
|
||||
32
Histogram/Graph3D.hpp
Normal file
32
Histogram/Graph3D.hpp
Normal file
@@ -0,0 +1,32 @@
|
||||
#ifndef _HISTOGRAM_GRAPH3D_HPP_
|
||||
#define _HISTOGRAM_GRAPH3D_HPP_
|
||||
#ifndef _COMMON_WINDOWS_HPP_
|
||||
#include <common/windows.hpp>
|
||||
#endif
|
||||
#ifndef _COMMON_SMARTPOINTER_HPP_
|
||||
#include <common/pointer.hpp>
|
||||
#endif
|
||||
#ifndef _ENGINE_DIB3D_HPP_
|
||||
#include <engine/dib3d.hpp>
|
||||
#endif
|
||||
|
||||
class Graph3D : public DIB3D
|
||||
{
|
||||
public:
|
||||
Graph3D(GUIWindow &someGUIWindow);
|
||||
Graph3D(GUIWindow &someGUIWindow,PurePalette &purePalette);
|
||||
virtual ~Graph3D();
|
||||
protected:
|
||||
WORD viewPortWidth(void)const;
|
||||
WORD viewPortHeight(void)const;
|
||||
private:
|
||||
Graph3D &operator=(const Graph3D &someGraph3D);
|
||||
SmartPointer<GUIWindow> mGUIWindow;
|
||||
};
|
||||
|
||||
inline
|
||||
Graph3D &Graph3D::operator=(const Graph3D &/*someGraph3D*/)
|
||||
{ // private implementation
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
67
Histogram/GraphDlg.cpp
Normal file
67
Histogram/GraphDlg.cpp
Normal file
@@ -0,0 +1,67 @@
|
||||
#include <common/stdio.hpp>
|
||||
#include <common/string.hpp>
|
||||
#include <common/rect.hpp>
|
||||
#include <histogram/graphdlg.hpp>
|
||||
#include <histogram/graphwnd.hpp>
|
||||
|
||||
GraphDlg::GraphDlg(void)
|
||||
{
|
||||
mDestroyHandler.setCallback(this,&GraphDlg::destroyHandler);
|
||||
mInitHandler.setCallback(this,&GraphDlg::initHandler);
|
||||
mCommandHandler.setCallback(this,&GraphDlg::commandHandler);
|
||||
mCloseHandler.setCallback(this,&GraphDlg::closeHandler);
|
||||
insertHandler(VectorHandler::DestroyHandler,&mDestroyHandler);
|
||||
insertHandler(VectorHandler::InitDialogHandler,&mInitHandler);
|
||||
insertHandler(VectorHandler::CommandHandler,&mCommandHandler);
|
||||
insertHandler(VectorHandler::CloseHandler,&mCloseHandler);
|
||||
}
|
||||
|
||||
GraphDlg::~GraphDlg()
|
||||
{
|
||||
removeHandler(VectorHandler::DestroyHandler,&mDestroyHandler);
|
||||
removeHandler(VectorHandler::InitDialogHandler,&mInitHandler);
|
||||
removeHandler(VectorHandler::CommandHandler,&mCommandHandler);
|
||||
removeHandler(VectorHandler::CloseHandler,&mCloseHandler);
|
||||
}
|
||||
|
||||
bool GraphDlg::perform(TabEntries &entries,HWND hParent)
|
||||
{
|
||||
WORD returnCode;
|
||||
mTabEntries=entries;
|
||||
returnCode=::DialogBoxParam(processInstance(),(LPSTR)"GRAPHDIALOG",hParent,DWindow::DlgProc,(LPARAM)(DWindow*)this);
|
||||
return returnCode;
|
||||
}
|
||||
|
||||
CallbackData::ReturnType GraphDlg::initHandler(CallbackData &/*someCallbackData*/)
|
||||
{
|
||||
mGraphWindow=::new GraphWindow(*this,Rect(3,3,width()-6,height()-58));
|
||||
mGraphWindow.disposition(PointerDisposition::Delete);
|
||||
mGraphWindow->setFocus();
|
||||
mGraphWindow->showHistogram(mTabEntries);
|
||||
return (CallbackData::ReturnType)FALSE;
|
||||
}
|
||||
|
||||
CallbackData::ReturnType GraphDlg::destroyHandler(CallbackData &/*someCallbackData*/)
|
||||
{
|
||||
return (CallbackData::ReturnType)FALSE;
|
||||
}
|
||||
|
||||
CallbackData::ReturnType GraphDlg::closeHandler(CallbackData &/*someCallbackData*/)
|
||||
{
|
||||
endDialog(TRUE);
|
||||
return (CallbackData::ReturnType)FALSE;
|
||||
}
|
||||
|
||||
CallbackData::ReturnType GraphDlg::commandHandler(CallbackData &someCallbackData)
|
||||
{
|
||||
switch(someCallbackData.wmCommandID())
|
||||
{
|
||||
case IDCANCEL :
|
||||
endDialog(false);
|
||||
break;
|
||||
case IDOK :
|
||||
endDialog(true);
|
||||
break;
|
||||
}
|
||||
return (CallbackData::ReturnType)FALSE;
|
||||
}
|
||||
40
Histogram/GraphDlg.hpp
Normal file
40
Histogram/GraphDlg.hpp
Normal file
@@ -0,0 +1,40 @@
|
||||
#ifndef _HISTOGRAM_GRAPHDLG_HPP_
|
||||
#define _HISTOGRAM_GRAPHDLG_HPP_
|
||||
#ifndef _COMMON_SMARTPOINTER_HPP_
|
||||
#include <common/pointer.hpp>
|
||||
#endif
|
||||
#ifndef _COMMON_DWINDOW_HPP_
|
||||
#include <common/dwindow.hpp>
|
||||
#endif
|
||||
#ifndef _COMMON_SDATE_HPP_
|
||||
#include <common/sdate.hpp>
|
||||
#endif
|
||||
#ifndef _GUITAR_TABENTRY_HPP_
|
||||
#include <guitar/tabentry.hpp>
|
||||
#endif
|
||||
#ifndef _THREAD_THREADCALLBACK_HPP_
|
||||
#include <thread/tcallbck.hpp>
|
||||
#endif
|
||||
|
||||
class GraphWindow;
|
||||
|
||||
class GraphDlg : private DWindow
|
||||
{
|
||||
public:
|
||||
GraphDlg(void);
|
||||
virtual ~GraphDlg();
|
||||
bool perform(TabEntries &entries,HWND hParent);
|
||||
private:
|
||||
CallbackData::ReturnType destroyHandler(CallbackData &someCallbackData);
|
||||
CallbackData::ReturnType initHandler(CallbackData &someCallbackData);
|
||||
CallbackData::ReturnType commandHandler(CallbackData &someCallbackData);
|
||||
CallbackData::ReturnType closeHandler(CallbackData &someCallbackData);
|
||||
|
||||
Callback<GraphDlg> mCommandHandler;
|
||||
Callback<GraphDlg> mDestroyHandler;
|
||||
Callback<GraphDlg> mInitHandler;
|
||||
Callback<GraphDlg> mCloseHandler;
|
||||
SmartPointer<GraphWindow> mGraphWindow;
|
||||
TabEntries mTabEntries;
|
||||
};
|
||||
#endif
|
||||
256
Histogram/GraphWnd.cpp
Normal file
256
Histogram/GraphWnd.cpp
Normal file
@@ -0,0 +1,256 @@
|
||||
#include <histogram/graphwnd.hpp>
|
||||
#include <histogram/graph3d.hpp>
|
||||
#include <histogram/clrrect.hpp>
|
||||
#include <music/scales.hpp>
|
||||
#include <engine/spacial.hpp>
|
||||
#include <engine/rect3d.hpp>
|
||||
#include <common/string.hpp>
|
||||
#include <common/rect.hpp>
|
||||
#include <common/catmull.hpp>
|
||||
|
||||
char GraphWindow::smszClassName[]={"GraphWindow"};
|
||||
char GraphWindow::smszMenuName[]={""};
|
||||
|
||||
GraphWindow::GraphWindow(GUIWindow &parentWindow,const Rect &winRect)
|
||||
{
|
||||
mPaintHandler.setCallback(this,&GraphWindow::paintHandler);
|
||||
mCreateHandler.setCallback(this,&GraphWindow::createHandler);
|
||||
mDestroyHandler.setCallback(this,&GraphWindow::destroyHandler);
|
||||
mKeyDownHandler.setCallback(this,&GraphWindow::keyDownHandler);
|
||||
mLeftButtonDownHandler.setCallback(this,&GraphWindow::leftButtonDownHandler);
|
||||
mDialogCodeHandler.setCallback(this,&GraphWindow::dialogCodeHandler);
|
||||
insertHandler(VectorHandler::PaintHandler,&mPaintHandler);
|
||||
insertHandler(VectorHandler::CreateHandler,&mCreateHandler);
|
||||
insertHandler(VectorHandler::DestroyHandler,&mDestroyHandler);
|
||||
insertHandler(VectorHandler::KeyDownHandler,&mKeyDownHandler);
|
||||
insertHandler(VectorHandler::LeftButtonDownHandler,&mLeftButtonDownHandler);
|
||||
insertHandler(VectorHandler::DialogCodeHandler,&mDialogCodeHandler);
|
||||
registerClass();
|
||||
initializePalette();
|
||||
createWindow(parentWindow,winRect);
|
||||
mGraph3D=::new Graph3D(*this,mGraphPalette);
|
||||
mGraph3D.disposition(PointerDisposition::Delete);
|
||||
setPerspective();
|
||||
show(SW_SHOW);
|
||||
update();
|
||||
}
|
||||
|
||||
GraphWindow::GraphWindow(const GraphWindow &/*someGraphWindow*/)
|
||||
{ // private implementation
|
||||
}
|
||||
|
||||
GraphWindow::~GraphWindow()
|
||||
{
|
||||
removeHandler(VectorHandler::PaintHandler,&mPaintHandler);
|
||||
removeHandler(VectorHandler::CreateHandler,&mCreateHandler);
|
||||
removeHandler(VectorHandler::DestroyHandler,&mDestroyHandler);
|
||||
removeHandler(VectorHandler::KeyDownHandler,&mKeyDownHandler);
|
||||
removeHandler(VectorHandler::LeftButtonDownHandler,&mLeftButtonDownHandler);
|
||||
removeHandler(VectorHandler::DialogCodeHandler,&mDialogCodeHandler);
|
||||
}
|
||||
|
||||
void GraphWindow::initializePalette(void)
|
||||
{
|
||||
Array<RGBColor> rgbColors;;
|
||||
|
||||
rgbColors.size(4);
|
||||
rgbColors[0]=RGBColor(0,0,0);
|
||||
rgbColors[1]=RGBColor(255,255,255);
|
||||
rgbColors[2]=RGBColor(255,0,0);
|
||||
rgbColors[3]=RGBColor(0,255,0);
|
||||
mGraphPalette.setPaletteColors(rgbColors);
|
||||
}
|
||||
|
||||
void GraphWindow::registerClass(void)const
|
||||
{
|
||||
HINSTANCE hInstance(processInstance());
|
||||
WNDCLASS wndClass;
|
||||
|
||||
if(::GetClassInfo(hInstance,smszClassName,(WNDCLASS FAR*)&wndClass))return;
|
||||
wndClass.style =CS_HREDRAW|CS_VREDRAW|CS_DBLCLKS|CS_OWNDC;
|
||||
wndClass.lpfnWndProc =(WNDPROC)Window::WndProc;
|
||||
wndClass.cbClsExtra =0;
|
||||
wndClass.cbWndExtra =sizeof(GraphWindow*);
|
||||
wndClass.hInstance =hInstance;
|
||||
wndClass.hIcon =::LoadIcon(NULL,IDI_APPLICATION);
|
||||
wndClass.hCursor =::LoadCursor(NULL,IDC_ARROW);
|
||||
wndClass.hbrBackground =(HBRUSH)::GetStockObject(HOLLOW_BRUSH);
|
||||
wndClass.lpszMenuName =smszMenuName;
|
||||
wndClass.lpszClassName =smszClassName;
|
||||
::RegisterClass(&wndClass);
|
||||
assert(0!=::GetClassInfo(hInstance,smszClassName,(WNDCLASS FAR*)&wndClass));
|
||||
}
|
||||
|
||||
void GraphWindow::createWindow(GUIWindow &parentWindow,const Rect &winRect)
|
||||
{
|
||||
Window::createWindow(WS_EX_CLIENTEDGE,String(smszClassName),String(smszMenuName),
|
||||
WS_CHILD|WS_OVERLAPPED|WS_CLIPCHILDREN|WS_BORDER,winRect,
|
||||
parentWindow,(HMENU)103,processInstance(),(LPSTR)this);
|
||||
show(SW_SHOW);
|
||||
update();
|
||||
}
|
||||
|
||||
CallbackData::ReturnType GraphWindow::paintHandler(CallbackData &someCallbackData)
|
||||
{
|
||||
if(!mGraph3D.isOkay())return (CallbackData::ReturnType)FALSE;
|
||||
PaintInformation *pPaintInfo=(PaintInformation*)someCallbackData.lParam();
|
||||
mGraph3D->clearBits();
|
||||
for(int rectIndex=0;rectIndex<mGraphRects.size();rectIndex++)
|
||||
{
|
||||
ColorRect &colorRect=mGraphRects[rectIndex];
|
||||
mGraph3D->rectangle(colorRect,colorRect.paletteIndex());
|
||||
}
|
||||
mGraph3D->bitBlt((PureDevice&)*pPaintInfo);
|
||||
return (CallbackData::ReturnType)FALSE;
|
||||
}
|
||||
|
||||
CallbackData::ReturnType GraphWindow::createHandler(CallbackData &/*someCallbackData*/)
|
||||
{
|
||||
return (CallbackData::ReturnType)FALSE;
|
||||
}
|
||||
|
||||
CallbackData::ReturnType GraphWindow::leftButtonDownHandler(CallbackData &/*someCallbackData*/)
|
||||
{
|
||||
setFocus();
|
||||
return (CallbackData::ReturnType)FALSE;
|
||||
}
|
||||
|
||||
CallbackData::ReturnType GraphWindow::dialogCodeHandler(CallbackData &/*someCallbackData*/)
|
||||
{
|
||||
return (CallbackData::ReturnType)DLGC_WANTARROWS|DLGC_WANTCHARS;
|
||||
}
|
||||
|
||||
CallbackData::ReturnType GraphWindow::keyDownHandler(CallbackData &someCallbackData)
|
||||
{
|
||||
switch(someCallbackData.wParam())
|
||||
{
|
||||
case inKey :
|
||||
if(shiftKeyPressed())mGraph3D->cameraTwistDegrees(mGraph3D->cameraTwistDegrees()-ThetaDelta);
|
||||
mGraph3D->viewPlaneDistance(mGraph3D->viewPlaneDistance()+ViewDelta);
|
||||
invalidate(FALSE);
|
||||
break;
|
||||
case outKey :
|
||||
if(shiftKeyPressed())mGraph3D->cameraTwistDegrees(mGraph3D->cameraTwistDegrees()+ThetaDelta);
|
||||
mGraph3D->viewPlaneDistance(mGraph3D->viewPlaneDistance()-ViewDelta);
|
||||
invalidate(FALSE);
|
||||
break;
|
||||
case UpArrow :
|
||||
if(handleUpArrow())invalidate(FALSE);
|
||||
break;
|
||||
case DownArrow :
|
||||
if(handleDownArrow())invalidate(FALSE);
|
||||
break;
|
||||
case LeftArrow :
|
||||
if(handleLeftArrow())invalidate(FALSE);
|
||||
break;
|
||||
case RightArrow :
|
||||
if(handleRightArrow())invalidate(FALSE);
|
||||
break;
|
||||
}
|
||||
return (CallbackData::ReturnType)FALSE;
|
||||
}
|
||||
|
||||
CallbackData::ReturnType GraphWindow::destroyHandler(CallbackData &/*someCallbackData*/)
|
||||
{
|
||||
return (CallbackData::ReturnType)FALSE;
|
||||
}
|
||||
|
||||
void GraphWindow::showHistogram(TabEntries &entries)
|
||||
{
|
||||
Block<int> vectorInt;
|
||||
IonianScale ionianScale;
|
||||
|
||||
mGraphRects.remove();
|
||||
setPerspective();
|
||||
for(int itemIndex=0;itemIndex<entries.size();itemIndex++)
|
||||
{
|
||||
TabEntry &entry=entries[itemIndex];
|
||||
for(int index=0;index<entry.size();index++)
|
||||
{
|
||||
Note note=entry[index].getNote();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
Array<int> vectorInt;
|
||||
int itemIndex;
|
||||
int vectorIndex;
|
||||
|
||||
vectorInt.size((Note::B-Note::C)+1);
|
||||
for(int index=0;index<vectorInt.size();index++)vectorInt[index]=0;
|
||||
mGraphRects.remove();
|
||||
setPerspective();
|
||||
for(itemIndex=0,vectorIndex=0;itemIndex<entries.size();itemIndex++,vectorIndex++)
|
||||
{
|
||||
TabEntry &entry=entries[itemIndex];
|
||||
for(int index=0;index<entry.size();index++)
|
||||
{
|
||||
int value=entry[index].getNote().getNote();
|
||||
vectorInt[value]=vectorInt[value]+1;
|
||||
}
|
||||
}
|
||||
*/
|
||||
// showHistogram(vectorInt,mGraph3D->getPalette().paletteIndex(RGBColor(255,255,255)));
|
||||
// invalidate();
|
||||
}
|
||||
|
||||
void GraphWindow::showHistogram(Array<int> &vectorInt,BYTE paletteIndex,int zDepth)
|
||||
{
|
||||
Array<int> scrnInt;
|
||||
int widthAdjust(5);
|
||||
|
||||
WORD sizeFactor(((((float)width()-20)/(float)widthAdjust)/(float)(Note::B-Note::C)+1)*100.00);
|
||||
SpacialTransform resample;
|
||||
resample.transform(vectorInt,scrnInt,sizeFactor);
|
||||
for(int itemIndex=0,xPoint=widthAdjust;itemIndex<scrnInt.size();itemIndex++,xPoint+=widthAdjust)
|
||||
{
|
||||
Vector3D outerPlane(Point3D(xPoint,scrnInt[itemIndex]+1,zDepth),
|
||||
Point3D(xPoint+widthAdjust,scrnInt[itemIndex]+1,zDepth),Point3D(xPoint+widthAdjust,0,zDepth),Point3D(xPoint,0,zDepth));
|
||||
Rect3D rect3D(outerPlane,10);
|
||||
mGraphRects.insert(&ColorRect(rect3D,paletteIndex));
|
||||
}
|
||||
}
|
||||
|
||||
bool GraphWindow::handleUpArrow(void)
|
||||
{
|
||||
Point3D cameraPoint(mGraph3D->cameraPoint());
|
||||
cameraPoint.y(cameraPoint.y()+TurnDelta);
|
||||
mGraph3D->cameraPoint(cameraPoint);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool GraphWindow::handleDownArrow(void)
|
||||
{
|
||||
Point3D cameraPoint(mGraph3D->cameraPoint());
|
||||
cameraPoint.y(cameraPoint.y()-TurnDelta);
|
||||
mGraph3D->cameraPoint(cameraPoint);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool GraphWindow::handleLeftArrow(void)
|
||||
{
|
||||
Point3D cameraPoint(mGraph3D->cameraPoint());
|
||||
if(shiftKeyPressed())mGraph3D->cameraTwistDegrees(mGraph3D->cameraTwistDegrees()-ThetaDelta);
|
||||
else cameraPoint.x(cameraPoint.x()+TurnDelta);
|
||||
mGraph3D->cameraPoint(cameraPoint);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool GraphWindow::handleRightArrow(void)
|
||||
{
|
||||
Point3D cameraPoint(mGraph3D->cameraPoint());
|
||||
if(shiftKeyPressed())mGraph3D->cameraTwistDegrees(mGraph3D->cameraTwistDegrees()+ThetaDelta);
|
||||
else cameraPoint.x(cameraPoint.x()-TurnDelta);
|
||||
mGraph3D->cameraPoint(cameraPoint);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void GraphWindow::setPerspective(void)
|
||||
{
|
||||
mGraph3D->cameraTwistDegrees(134.64);
|
||||
mGraph3D->viewPlaneDistance(40);
|
||||
mGraph3D->cameraPoint(Point3D(-385,75,75));
|
||||
mGraph3D->focusPoint(Point3D(0,0,1));
|
||||
}
|
||||
92
Histogram/GraphWnd.hpp
Normal file
92
Histogram/GraphWnd.hpp
Normal file
@@ -0,0 +1,92 @@
|
||||
#ifndef _HISTOGRAM_GRAPHWINDOW_HPP_
|
||||
#define _HISTOGRAM_GRAPHWINDOW_HPP_
|
||||
#ifndef _COMMON_WINDOW_HPP_
|
||||
#include <common/window.hpp>
|
||||
#endif
|
||||
#ifndef _COMMON_SMARTPOINTER_HPP_
|
||||
#include <common/pointer.hpp>
|
||||
#endif
|
||||
#ifndef _COMMON_PUREPALETTE_HPP_
|
||||
#include <common/purepal.hpp>
|
||||
#endif
|
||||
//#ifndef _HISTOGRAM_GRAPH3D_HPP_
|
||||
//#include <histogram/graph3d.hpp>
|
||||
//#endif
|
||||
//#ifndef _MUSIC_NOTE_HPP_
|
||||
//#include <music/note.hpp>
|
||||
//#endif
|
||||
#ifndef _GUITAR_TABENTRY_HPP_
|
||||
#include <guitar/TabEntry.hpp>
|
||||
#endif
|
||||
|
||||
template <class T>
|
||||
class Block;
|
||||
template <class T>
|
||||
class Callback;
|
||||
//template <class T>
|
||||
//class PureCheck;
|
||||
class Graph3D;
|
||||
class Rect3D;
|
||||
class ColorRect;
|
||||
class FloatPairs;
|
||||
|
||||
class GraphWindow : public Window
|
||||
{
|
||||
public:
|
||||
GraphWindow(GUIWindow &parentWindow,const Rect &winRect);
|
||||
virtual ~GraphWindow();
|
||||
void showHistogram(TabEntries &entries);
|
||||
// void showHistogram(Array<Note> ¬es);
|
||||
// void showBalance(Block<PureCheck> &pureChecks);
|
||||
private:
|
||||
enum {MaxRotate=360,MinRotate=-360};
|
||||
enum {ThetaDelta=10,ViewDelta=5,TurnDelta=20};
|
||||
enum {LeftArrow=0x25,RightArrow=0x27,UpArrow=0x26,DownArrow=0x28,inKey=0x49,outKey=0x4F};
|
||||
GraphWindow(const GraphWindow &someGraphWindow);
|
||||
GraphWindow &operator=(const GraphWindow &someGraphWindow);
|
||||
void registerClass(void)const;
|
||||
void initializePalette(void);
|
||||
void createWindow(GUIWindow &parentWindow,const Rect &winRect);
|
||||
void clamp(Array<FloatPairs> &vector);
|
||||
// void clamp(PureVector<FloatPairs> &vector);
|
||||
void showHistogram(Array<int> &vectorInt,BYTE paletteIndex,int zDepth=0);
|
||||
// void showBalance(int baseMonths,PureVector<int> &vectorInt,BYTE paletteIndex,int zDepth=0);
|
||||
bool handleLeftArrow(void);
|
||||
bool handleRightArrow(void);
|
||||
bool handleUpArrow(void);
|
||||
bool handleDownArrow(void);
|
||||
void setPerspective(void);
|
||||
bool shiftKeyPressed(void)const;
|
||||
|
||||
CallbackData::ReturnType paintHandler(CallbackData &someCallbackData);
|
||||
CallbackData::ReturnType createHandler(CallbackData &someCallbackData);
|
||||
CallbackData::ReturnType destroyHandler(CallbackData &someCallbackData);
|
||||
CallbackData::ReturnType keyDownHandler(CallbackData &someCallbackData);
|
||||
CallbackData::ReturnType leftButtonDownHandler(CallbackData &someCallbackData);
|
||||
CallbackData::ReturnType dialogCodeHandler(CallbackData &someCallbackData);
|
||||
|
||||
Callback<GraphWindow> mPaintHandler;
|
||||
Callback<GraphWindow> mCreateHandler;
|
||||
Callback<GraphWindow> mDestroyHandler;
|
||||
Callback<GraphWindow> mKeyDownHandler;
|
||||
Callback<GraphWindow> mLeftButtonDownHandler;
|
||||
Callback<GraphWindow> mDialogCodeHandler;
|
||||
SmartPointer<Graph3D> mGraph3D;
|
||||
Block<ColorRect> mGraphRects;
|
||||
PurePalette mGraphPalette;
|
||||
static char smszClassName[];
|
||||
static char smszMenuName[];
|
||||
};
|
||||
|
||||
inline
|
||||
GraphWindow &GraphWindow::operator=(const GraphWindow &/*someGraphWindow*/)
|
||||
{ // private implementation
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline
|
||||
bool GraphWindow::shiftKeyPressed(void)const
|
||||
{
|
||||
return ::GetKeyState(VK_SHIFT)&0x8000;
|
||||
}
|
||||
#endif
|
||||
9
Histogram/Histogram.rc
Normal file
9
Histogram/Histogram.rc
Normal file
@@ -0,0 +1,9 @@
|
||||
GRAPHDIALOG DIALOG 6, 15, 340, 205
|
||||
STYLE DS_MODALFRAME | 0x4L | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Graph"
|
||||
FONT 8, "MS Sans Serif"
|
||||
{
|
||||
PUSHBUTTON "Dismiss", IDCANCEL, 171, 180, 50, 14
|
||||
GROUPBOX "", -1, 5, 4, 326, 166, BS_GROUPBOX
|
||||
DEFPUSHBUTTON "Graph", IDOK, 119, 180, 50, 14
|
||||
}
|
||||
104
Histogram/histogram.dsp
Normal file
104
Histogram/histogram.dsp
Normal file
@@ -0,0 +1,104 @@
|
||||
# Microsoft Developer Studio Project File - Name="histogram" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Static Library" 0x0104
|
||||
|
||||
CFG=histogram - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "histogram.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "histogram.mak" CFG="histogram - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "histogram - Win32 Release" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE "histogram - Win32 Debug" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "histogram - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo
|
||||
|
||||
!ELSEIF "$(CFG)" == "histogram - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /Gz /MTd /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /D "STRICT" /D "__FLAT__" /YX /FD /GZ /c
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "histogram - Win32 Release"
|
||||
# Name "histogram - Win32 Debug"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Graph3D.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\GraphDlg.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\GraphWnd.cpp
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
||||
59
Histogram/histogram.dsw
Normal file
59
Histogram/histogram.dsw
Normal file
@@ -0,0 +1,59 @@
|
||||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "engine"=..\engine\engine.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "histogram"=.\histogram.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
Begin Project Dependency
|
||||
Project_Dep_Name engine
|
||||
End Project Dependency
|
||||
Begin Project Dependency
|
||||
Project_Dep_Name music
|
||||
End Project Dependency
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "music"=..\music\music.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<3>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
BIN
Histogram/histogram.ncb
Normal file
BIN
Histogram/histogram.ncb
Normal file
Binary file not shown.
BIN
Histogram/histogram.opt
Normal file
BIN
Histogram/histogram.opt
Normal file
Binary file not shown.
31
Histogram/histogram.plg
Normal file
31
Histogram/histogram.plg
Normal file
@@ -0,0 +1,31 @@
|
||||
<html>
|
||||
<body>
|
||||
<pre>
|
||||
<h1>Build Log</h1>
|
||||
<h3>
|
||||
--------------------Configuration: histogram - Win32 Debug--------------------
|
||||
</h3>
|
||||
<h3>Command Lines</h3>
|
||||
Creating temporary file "C:\DOCUME~1\TERNET~1\LOCALS~1\Temp\RSP27E.tmp" with contents
|
||||
[
|
||||
/nologo /Gz /MTd /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /D "STRICT" /D "__FLAT__" /Fp"Debug/histogram.pch" /YX /Fo"Debug/" /Fd"Debug/" /FD /GZ /c
|
||||
"F:\work\Histogram\Graph3D.cpp"
|
||||
"F:\work\Histogram\GraphDlg.cpp"
|
||||
"F:\work\Histogram\GraphWnd.cpp"
|
||||
]
|
||||
Creating command line "cl.exe @C:\DOCUME~1\TERNET~1\LOCALS~1\Temp\RSP27E.tmp"
|
||||
Creating command line "link.exe -lib /nologo /out:"Debug\histogram.lib" .\Debug\Graph3D.obj .\Debug\GraphDlg.obj .\Debug\GraphWnd.obj \work\exe\msengine.lib \work\exe\music.lib "
|
||||
<h3>Output Window</h3>
|
||||
Compiling...
|
||||
Graph3D.cpp
|
||||
GraphDlg.cpp
|
||||
GraphWnd.cpp
|
||||
Creating library...
|
||||
|
||||
|
||||
|
||||
<h3>Results</h3>
|
||||
histogram.lib - 0 error(s), 0 warning(s)
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
92
Histogram/scraps.txt
Normal file
92
Histogram/scraps.txt
Normal file
@@ -0,0 +1,92 @@
|
||||
/*
|
||||
Array<FloatPairs> vectorCDB;
|
||||
Array<int> vectorInt;
|
||||
int itemIndex;
|
||||
int fvectorIndex;
|
||||
|
||||
mGraphRects.remove();
|
||||
setPerspective();
|
||||
vectorCDB.size(pureChecks.size()*3);
|
||||
vectorInt.size(pureChecks.size());
|
||||
|
||||
for(itemIndex=0,vectorIndex=0;itemIndex<pureChecks.size();itemIndex++,vectorIndex++)
|
||||
vectorCDB[vectorIndex]=FloatPairs(pureChecks[itemIndex].balance(),itemIndex);
|
||||
|
||||
for(itemIndex=0;itemIndex<pureChecks.size();itemIndex++,vectorIndex++)
|
||||
vectorCDB[vectorIndex]=FloatPairs(pureChecks[itemIndex].debit(),itemIndex);
|
||||
|
||||
for(itemIndex=0;itemIndex<pureChecks.size();itemIndex++,vectorIndex++)
|
||||
vectorCDB[vectorIndex]=FloatPairs(pureChecks[itemIndex].credit(),itemIndex);
|
||||
|
||||
clamp(vectorCDB);
|
||||
for(itemIndex=0,vectorIndex=0;itemIndex<pureChecks.size();itemIndex++,vectorIndex++)vectorInt[itemIndex]=vectorCDB[vectorIndex].column();
|
||||
showBalance(vectorInt.size(),vectorInt,mGraph3D->getPalette().paletteIndex(RGBColor(255,255,255)));
|
||||
for(itemIndex=0;itemIndex<pureChecks.size();itemIndex++,vectorIndex++)vectorInt[itemIndex]=vectorCDB[vectorIndex].column();
|
||||
showBalance(vectorInt.size(),vectorInt,mGraph3D->getPalette().paletteIndex(RGBColor(255,0,0)),10);
|
||||
for(itemIndex=0;itemIndex<pureChecks.size();itemIndex++,vectorIndex++)vectorInt[itemIndex]=vectorCDB[vectorIndex].column();
|
||||
showBalance(vectorInt.size(),vectorInt,mGraph3D->getPalette().paletteIndex(RGBColor(0,255,0)),20);
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
Array<FloatPairs> vectorCDB;
|
||||
Array<int> vectorInt;
|
||||
int itemIndex;
|
||||
int vectorIndex;
|
||||
|
||||
mGraphRects.remove();
|
||||
setPerspective();
|
||||
vectorCDB.size(entries.size());
|
||||
vectorInt.size(entries.size());
|
||||
|
||||
for(itemIndex=0,vectorIndex=0;itemIndex<entries.size();itemIndex++,vectorIndex++)
|
||||
{
|
||||
TabEntry &entry=entries[itemIndex];
|
||||
for(int index=0;index<entry.size();index++)
|
||||
{
|
||||
vectorCDB[vectorIndex]=FloatPairs(entry[index].getNote().getNote(),itemIndex);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
// for(itemIndex=0,vectorIndex=0;itemIndex<pureChecks.size();itemIndex++,vectorIndex++)
|
||||
// {
|
||||
// vectorCDB[vectorIndex]=FloatPairs(pureChecks[itemIndex].balance(),itemIndex);
|
||||
// }
|
||||
|
||||
// for(itemIndex=0;itemIndex<pureChecks.size();itemIndex++,vectorIndex++)
|
||||
// vectorCDB[vectorIndex]=FloatPairs(pureChecks[itemIndex].debit(),itemIndex);
|
||||
|
||||
// for(itemIndex=0;itemIndex<pureChecks.size();itemIndex++,vectorIndex++)
|
||||
// vectorCDB[vectorIndex]=FloatPairs(pureChecks[itemIndex].credit(),itemIndex);
|
||||
|
||||
// clamp(vectorCDB);
|
||||
|
||||
// for(itemIndex=0,vectorIndex=0;itemIndex<entries.size();itemIndex++,vectorIndex++)vectorInt[itemIndex]=vectorCDB[vectorIndex].column();
|
||||
// {
|
||||
// showHistogram(vectorInt.size(),vectorInt,mGraph3D->getPalette().paletteIndex(RGBColor(255,255,255)));
|
||||
// showHistogram(vectorInt,mGraph3D->getPalette().paletteIndex(RGBColor(255,255,255)));
|
||||
// }
|
||||
|
||||
|
||||
|
||||
/*
|
||||
void GraphWindow::clamp(Array<FloatPairs> &vector)
|
||||
{
|
||||
float factor=0.00;
|
||||
float vectorMax;
|
||||
|
||||
if(!vector.size())return;
|
||||
for(int itemIndex=0;itemIndex<vector.size();itemIndex++)
|
||||
{
|
||||
if(!itemIndex)vectorMax=vector[itemIndex].column();
|
||||
else if(vector[itemIndex].column()>vectorMax)vectorMax=vector[itemIndex].column();
|
||||
}
|
||||
factor=(1.00/(float)vectorMax);
|
||||
for(itemIndex=0;itemIndex<vector.size();itemIndex++)vector[itemIndex].column((float)vector[itemIndex].column()*factor*100.00);
|
||||
}
|
||||
*/
|
||||
Reference in New Issue
Block a user