summaryrefslogtreecommitdiff
path: root/src/T2DLL/T2RemoveFavoriteDialog.cpp
diff options
context:
space:
mode:
authorAsh Wolf <ninji@wuffs.org>2023-06-28 22:22:32 +0100
committerAsh Wolf <ninji@wuffs.org>2023-06-28 22:22:32 +0100
commitc0c336500955a23e344651e5412c9d9d441ef4ee (patch)
tree790769c748db307cf3314f6e896e2f61c68561a2 /src/T2DLL/T2RemoveFavoriteDialog.cpp
parent37e364b2c6cc7487a1c888d256a73e5337bb7189 (diff)
downloadt2win-c0c336500955a23e344651e5412c9d9d441ef4ee.tar.gz
t2win-c0c336500955a23e344651e5412c9d9d441ef4ee.zip
first pass of T2DLL
Diffstat (limited to 'src/T2DLL/T2RemoveFavoriteDialog.cpp')
-rw-r--r--src/T2DLL/T2RemoveFavoriteDialog.cpp115
1 files changed, 110 insertions, 5 deletions
diff --git a/src/T2DLL/T2RemoveFavoriteDialog.cpp b/src/T2DLL/T2RemoveFavoriteDialog.cpp
index 1a64b4e..c10ea94 100644
--- a/src/T2DLL/T2RemoveFavoriteDialog.cpp
+++ b/src/T2DLL/T2RemoveFavoriteDialog.cpp
@@ -1,25 +1,130 @@
+#include "CTokenizer.h"
+#include "T2Name.h"
+#include "T2NameList.h"
+#include "T2NameTable.h"
#include "T2RemoveFavoriteDialog.h"
+#include "T2TowerDoc.h"
-T2RemoveFavoriteDialog::T2RemoveFavoriteDialog() {
+T2RemoveFavoriteDialog::T2RemoveFavoriteDialog()
+ : mNameType(0)
+{
+ mNameTable = NULL;
+ mCloseButton = NULL;
+ mDeleteButton = NULL;
}
/*virtual*/ T2RemoveFavoriteDialog::~T2RemoveFavoriteDialog() {
}
/*virtual*/ void T2RemoveFavoriteDialog::OnT2Create() {
+ mDeleteButton = GetDlgItem(1001);
+ mCloseButton = GetDlgItem(1002);
+ mNameTable = (T2NameTable *) GetDlgItem(1005);
}
-/*virtual*/ void T2RemoveFavoriteDialog::CreateDlgItem(CTokenizer&, T2Dialog::T2DialogDef&) {
+/*virtual*/ void T2RemoveFavoriteDialog::CreateDlgItem(CTokenizer& inTokenizer, T2DialogDef& inDef) {
+ if (!_stricmp(inTokenizer.Current(), "NMTBL")) {
+ RECT rect;
+ UINT id = inTokenizer.NextInteger();
+ rect.left = inTokenizer.NextInteger();
+ rect.top = inTokenizer.NextInteger();
+ rect.right = inTokenizer.NextInteger();
+ rect.bottom = inTokenizer.NextInteger();
+
+ T2NameTable *item = new T2NameTable(mTowerDoc, mImageObj, mPalette);
+ item->Create("", inDef.flags, rect, this, id);
+ item->CreateSubItem(NULL);
+ if (mCurrentFont >= 0)
+ item->SetFont(*mFonts[mCurrentFont]);
+ } else {
+ T2Dialog::CreateDlgItem(inTokenizer, inDef);
+ }
}
/*virtual*/ void T2RemoveFavoriteDialog::OnT2Destroy() {
}
-/*virtual*/ int T2RemoveFavoriteDialog::OnT2DialogCommand(unsigned int, long) {
+/*virtual*/ BOOL T2RemoveFavoriteDialog::OnT2DialogCommand(WPARAM inWParam, LPARAM inLParam) {
+ WORD code = HIWORD(inWParam);
+ WORD id = LOWORD(inWParam);
+ BOOL result = false;
+
+ if (id == 1002 && code == 0) {
+ DestroyWindow();
+ result = true;
+ } else if (id == 1001 && code == 0) {
+#line 67
+ _ASSERT(mNameTable != NULL);
+
+ T2Name *theName = mNameTable->GetSelectedName();
+ if (theName) {
+ CString str;
+ unsigned int id;
+ theName->GetName(str, id);
+ switch (mNameType) {
+ case kPeopleNameType:
+ mNameTable->RemoveCurrentCell();
+ break;
+ case kTenantNameType:
+ mNameTable->RemoveCurrentCell();
+ break;
+ }
+ }
+ } else {
+ result = T2Dialog::OnT2DialogCommand(inWParam, inLParam);
+ }
+
+ return result;
}
-void T2RemoveFavoriteDialog::InitializeForRemovePeople(T2TowerDoc*) {
+void T2RemoveFavoriteDialog::InitializeForRemovePeople(T2TowerDoc* inDoc) {
+#line 98
+ _ASSERT(mNameTable != NULL);
+ mNameTable->InsertCols(1, 0, NULL);
+
+#line 100
+ _ASSERT(inDoc->mNameDB != NULL);
+
+ LArrayIterator iterator(*inDoc->mNameDB);
+ T2Name *name = NULL;
+ int o = 0; // unused
+
+ while (iterator.Next(&name)) {
+ if (name->IsFavorite() && name->GetType() == kPeopleNameType)
+ mNameTable->Add(name);
+ }
+
+ // "cお好み削除"
+ CString dialogText = "\x63\x82\xA8\x8D\x44\x82\xDD\x8D\xED\x8F\x9C";
+ // "-人"
+ dialogText += "\x2D\x90\x6C";
+
+ SetWindowText(dialogText);
+ mNameType = kPeopleNameType;
}
-void T2RemoveFavoriteDialog::InitializeForRemoveTenant(T2TowerDoc*) {
+void T2RemoveFavoriteDialog::InitializeForRemoveTenant(T2TowerDoc* inDoc) {
+#line 122
+ _ASSERT(mNameTable != NULL);
+ mNameTable->InsertCols(1, 0, NULL);
+
+#line 124
+ _ASSERT(inDoc->mNameDB != NULL);
+
+ LArrayIterator iterator(*inDoc->mNameDB);
+ T2Name *name = NULL;
+ int o = 0; // unused
+
+ while (iterator.Next(&name)) {
+ if (name->IsFavorite() && name->GetType() == kTenantNameType)
+ mNameTable->Add(name);
+ }
+
+ // "cお好み削除"
+ CString dialogText = "\x63\x82\xA8\x8D\x44\x82\xDD\x8D\xED\x8F\x9C";
+ // "-テナント"
+ dialogText += "\x2D\x83\x65\x83\x69\x83\x93\x83\x67";
+
+ SetWindowText(dialogText);
+ mNameType = kTenantNameType;
}