diff options
author | Ash Wolf <ninji@wuffs.org> | 2023-06-28 22:22:32 +0100 |
---|---|---|
committer | Ash Wolf <ninji@wuffs.org> | 2023-06-28 22:22:32 +0100 |
commit | c0c336500955a23e344651e5412c9d9d441ef4ee (patch) | |
tree | 790769c748db307cf3314f6e896e2f61c68561a2 /src/T2DLL/T2MovieTable.cpp | |
parent | 37e364b2c6cc7487a1c888d256a73e5337bb7189 (diff) | |
download | t2win-c0c336500955a23e344651e5412c9d9d441ef4ee.tar.gz t2win-c0c336500955a23e344651e5412c9d9d441ef4ee.zip |
first pass of T2DLL
Diffstat (limited to '')
-rw-r--r-- | src/T2DLL/T2MovieTable.cpp | 102 |
1 files changed, 92 insertions, 10 deletions
diff --git a/src/T2DLL/T2MovieTable.cpp b/src/T2DLL/T2MovieTable.cpp index ff1d779..ee47421 100644 --- a/src/T2DLL/T2MovieTable.cpp +++ b/src/T2DLL/T2MovieTable.cpp @@ -1,31 +1,113 @@ +#include "T2MoviePlugin.h" +#include "T2MoviePluginList.h" #include "T2MovieTable.h" -/*virtual*/ int T2MovieTable::OnT2DlgItemCreate(CREATESTRUCTA*) { +/*virtual*/ int T2MovieTable::OnT2DlgItemCreate(CREATESTRUCT* cs) { + T2DlgItemTable::SetColWidth(cs->cx, 0, 0); + return T2DlgItemTable::OnT2DlgItemCreate(cs); } -T2MovieTable::T2MovieTable(T2TowerDoc*, T2ImageObj*, CPalette*) { +T2MovieTable::T2MovieTable(T2TowerDoc* inDoc, T2ImageObj* inImageObj, CPalette* inPalette) + : T2VerticalTable(inDoc, inImageObj, inPalette) +{ + mClearBackground = true; + mMovieType = 1; + + SetCellDataSize(sizeof(T2MoviePlugin *)); + InsertCols(1, 0, NULL); + SetHScrollerStyle(AlwaysHide); + SetVScrollerStyle(AlwaysShow); } -void T2MovieTable::SetMovieType(int) { +void T2MovieTable::SetMovieType(int inType) { + mMovieType = inType; } -void T2MovieTable::Add(T2MoviePlugin*) { +void T2MovieTable::Add(T2MoviePlugin* inPlugin) { + unsigned int index = mRows; + InsertRows(1, index, &inPlugin); } -void T2MovieTable::Add(CFilePluginList*) { +void T2MovieTable::Add(CFilePluginList* inList) { + T2MoviePlugin *thePlugin; + unsigned int index = mRows; + POSITION pos = inList->GetHeadPosition(); + + while (pos) { + thePlugin = (T2MoviePlugin *) inList->GetNext(pos); + InsertRows(1, index, &thePlugin); + index++; + } } -/*virtual*/ void T2MovieTable::DrawCellSelf(CDC*, const TableCellT&, int) { +/*virtual*/ void T2MovieTable::DrawCellSelf(CDC* pDC, const TableCellT& inCell, BOOL inSelected) { + DrawCell(pDC, inCell); } -/*virtual*/ void T2MovieTable::DrawCell(CDC*, const TableCellT&) { +/*virtual*/ void T2MovieTable::DrawCell(CDC* pDC, const TableCellT& inCell) { + int save = pDC->SaveDC(); + pDC->SelectPalette(mPalette, false); + pDC->RealizePalette(); + + CFont font; + RECT cellRect; + + if (FetchLocalCellFrame(inCell, cellRect)) { + T2MoviePlugin *thePlugin; + GetCellData(inCell, &thePlugin); + if (thePlugin) { + font.CreateFont(-12, 0, 0, 0, FW_DONTCARE, false, false, false, SHIFTJIS_CHARSET, OUT_TT_PRECIS, CLIP_TT_ALWAYS, PROOF_QUALITY, DEFAULT_PITCH, "\x82\x6C\x82\x72 \x83\x53\x83\x56\x83\x62\x83\x4E"); + + pDC->SelectObject(&font); + pDC->SetBkMode(TRANSPARENT); + + CString title; + thePlugin->GetTitle(title, mMovieType); + pDC->TextOut(cellRect.left + 4, cellRect.bottom - 12, title, strlen(title)); + } + } + + pDC->RestoreDC(save); } -void T2MovieTable::ClickCell(const TableCellT&, const CPoint&) { +void T2MovieTable::ClickCell(const TableCellT& inCell, const CPoint& inPt) { + T2DlgItemTable::ClickCell(inCell, inPt); + + if (IsValidCell(mSelectedCell)) { + T2MoviePlugin *thePlugin; + GetCellData(mSelectedCell, &thePlugin); + + if (thePlugin) + BroadcastMessage(-GetDlgCtrlID(), thePlugin); + } } -/*virtual*/ void T2MovieTable::OnT2DlgItemLButtonDown(unsigned int, CPoint) { +/*virtual*/ void T2MovieTable::OnT2DlgItemLButtonDown(UINT inFlags, CPoint inPt) { + CPoint pt = inPt; + ClientToView(&pt, 1); + + TableCellT cell; + FetchCellHitBy(pt, cell); + + if (IsValidCell(cell)) + ClickCell(cell, inPt); } -/*virtual*/ int T2MovieTable::OnT2DlgItemEraseBkgnd(CDC*) { +/*virtual*/ BOOL T2MovieTable::OnT2DlgItemEraseBkgnd(CDC* pDC) { + T2VerticalTable::OnT2DlgItemEraseBkgnd(pDC); + + unsigned int numOfRows, numOfColumns, theRow, theColumn; + + GetTableSize(numOfRows, numOfColumns); + for (theColumn = 1; theColumn <= numOfColumns; theColumn++) { + for (theRow = 1; theRow <= numOfRows; theRow++) { + TableCellT cell; + cell.row = theRow; + cell.col = theColumn; + DrawCell(pDC, cell); + } + } + + T2DlgItemTable::HiliteCell(pDC, mSelectedCell); + return true; } |