#include"InfoPage.h"
#pragma warning(disable : 4996)
void InfoPage(int type,int nowType){
MOUSEMSG m4;
InfoPageOpen = 1;
cleardevice();
IMAGE backGround, title;
loadimage(&backGround, "resources/backGround.jpg");
loadimage(&title, "resources/title.png", 290, 109);
putimage(0, 0, &backGround);
drawAlpha(&title, 630, 30);
//print texts
rectProperties text1, text2;
text1 = { 60,45,500,100 };
text2 = { 60,85,500,200 };
char adminText1[50] = { "用户信息管理系统:" };
char adminText2[50];
if (type == AdminToVol && nowType == Administrator) {
char AdminToVolText[50] = {"管理员发件箱:"};
strcpy(adminText2, AdminToVolText);
}
if (type == AdminToVol && nowType == Volunteer) {
char AdminToVolText[50] = { "工作人员收件箱:" };
strcpy(adminText2, AdminToVolText);
}
if (type == VolToAdmin && nowType == Administrator) {
char AdminToVolText[50] = { "管理员收件箱:" };
strcpy(adminText2, AdminToVolText);
}
if (type == VolToAdmin && nowType == Volunteer) {
char AdminToVolText[50] = { "工作人员发件箱:" };
strcpy(adminText2, AdminToVolText);
}
if (type == ResiToVol && nowType == Volunteer) {
char AdminToVolText[50] = { "工作人员收件箱:" };
strcpy(adminText2, AdminToVolText);
}
if (type == ResiToVol && nowType == Residente) {
char AdminToVolText[50] = { "用户发件箱:" };
strcpy(adminText2, AdminToVolText);
}
if (type == VolToResi && nowType == Residente) {
char AdminToVolText[50] = { "用户收件箱:" };
strcpy(adminText2, AdminToVolText);
}
if (type == VolToResi && nowType == Volunteer) {
char AdminToVolText[50] = { "工作人员发件箱:" };
strcpy(adminText2, AdminToVolText);
}
DrawTextsSingle(text1, songTi, adminText1, 30, 600, 0, blueOfText);
DrawTextsSingle(text2, songTi, adminText2, 20, 500, 0, blackOfText);
char exitButtonText[50] = { "退出" };
char nextPageButtonText[50] = { "下移" };
char lastPageButtonText[50] = { "上移" };
char addUserInfoText[50] = { "发布信息" };
char delUserInfoText[50] = { "删除信息" };
char reWriteUserInfoText[50] = { "切换发出/收到" };
rectProperties exitButtonCorr, nextPageButtonCorr, lastPageButtonCorr;
rectProperties addUserInfoCorr, delUserInfoCorr, reWriteUserInfoCorr;
int downLeftCorr = 100, downTopCorr = 470, downButtonWidth = 120, downButtonHeight = 40;
//int tempDownLeftCorr = downLeftCorr;
rectProperties rectSolve = { 528,122,637,159,0,1 };
addUserInfoCorr = { downLeftCorr,downTopCorr,downLeftCorr + 1 * downButtonWidth + 0 * 10,downTopCorr + downButtonHeight,0,1 };
delUserInfoCorr = { downLeftCorr + 1 * downButtonWidth + 1 * 10,downTopCorr,downLeftCorr + 2 * downButtonWidth + 1 * 10,downTopCorr + downButtonHeight,0,1 };
reWriteUserInfoCorr = { downLeftCorr + 2 * downButtonWidth + 2 * 10,downTopCorr,downLeftCorr + 3 * downButtonWidth + 2 * 10,downTopCorr + downButtonHeight,0,1 };
lastPageButtonCorr = { downLeftCorr + 3 * downButtonWidth + 3 * 10,downTopCorr,downLeftCorr + 4 * downButtonWidth + 3 * 10,downTopCorr + downButtonHeight,0,1 };
nextPageButtonCorr = { downLeftCorr + 4 * downButtonWidth + 4 * 10,downTopCorr,downLeftCorr + 5 * downButtonWidth + 4 * 10,downTopCorr + downButtonHeight,0,1 };
exitButtonCorr = { downLeftCorr + 5 * downButtonWidth + 5 * 10,downTopCorr,downLeftCorr + 6 * downButtonWidth + 5 * 10,downTopCorr + downButtonHeight,0,1 };
DrawButton(exitButtonCorr, colorOutOfTheButton, colorInTheButton, colorClickingTheButton, exitButtonText, 20);
DrawButton(rectSolve, colorOutOfTheButton, colorInTheButton, colorClickingTheButton, exitButtonText, 20);
std::vector<TextExchange> temp;
if (type == AdminToVol) {
temp.assign(AdminToVOlMessageList.begin(), AdminToVOlMessageList.end());
}
if (type == VolToAdmin) {
temp.assign(VolToAdminMessageList.begin(), VolToAdminMessageList.end());
}
if (type == ResiToVol) {
temp.assign(ResiToVolMessageList.begin(), ResiToVolMessageList.end());
}
if (type == VolToResi) {
temp.assign(VolToResiMessageList.begin(), VolToResiMessageList.end());
}
forceToFlashButton = 1;
indexToDrawPage = 0;
do {
m4 = GetMouseMsg();
CheckButton(m4, exitButtonCorr, ExitButtonForAdminInfoPage, exitButtonText, 20);
DrawTextModule(m4, temp);
forceToFlashButton = 0;
} while (InfoPageOpen);
}
void ExitButtonForAdminInfoPage() {
InfoPageOpen = 0;
AdminPage();
}
void ReciManageMenu(){
MOUSEMSG m3;
ResiManagePageOpen = 1;
//print background
cleardevice();
IMAGE backGround, title;
loadimage(&backGround, "resources/backGround.jpg");
loadimage(&title, "resources/title.png", 290, 109);
putimage(0, 0, &backGround);
drawAlpha(&title, 630, 30);
//print texts
rectProperties text1, text2;
text1 = { 60,45,500,100 };
text2 = { 60,85,500,200 };
char adminText1[50] = { "用户信息管理系统:" };
char adminText2[50] = {"点击各个单元格可修改单元格内容"};
DrawTextsSingle(text1, songTi, adminText1, 30, 600, 0, blueOfText);
DrawTextsSingle(text2, songTi, adminText2, 20, 500, 0, blackOfText);
rectProperties exitButtonCorr, nextPageButtonCorr, lastPageButtonCorr;
rectProperties addUserInfoCorr, delUserInfoCorr, reWriteUserInfoCorr;
int downLeftCorr = 100, downTopCorr = 470, downButtonWidth = 120, downButtonHeight = 40;
//int tempDownLeftCorr = downLeftCorr;
addUserInfoCorr = { downLeftCorr,downTopCorr,downLeftCorr + 1 * downButtonWidth + 0 * 10,downTopCorr + downButtonHeight,0,1 };
delUserInfoCorr = { downLeftCorr + 1 * downButtonWidth + 1 * 10,downTopCorr,downLeftCorr + 2 * downButtonWidth + 1 * 10,downTopCorr + downButtonHeight,0,1 };
reWriteUserInfoCorr = { downLeftCorr + 2 * downButtonWidth + 2 * 10,downTopCorr,downLeftCorr + 3 * downButtonWidth + 2 * 10,downTopCorr + downButtonHeight,0,1 };
lastPageButtonCorr = { downLeftCorr + 3 * downButtonWidth + 3 * 10,downTopCorr,downLeftCorr + 4 * downButtonWidth + 3 * 10,downTopCorr + downButtonHeight,0,1 };
nextPageButtonCorr = { downLeftCorr + 4 * downButtonWidth + 4 * 10,downTopCorr,downLeftCorr + 5 * downButtonWidth + 4 * 10,downTopCorr + downButtonHeight,0,1 };
exitButtonCorr = { downLeftCorr + 5 * downButtonWidth + 5 * 10,downTopCorr,downLeftCorr + 6 * downButtonWidth + 5 * 10,downTopCorr + downButtonHeight,0,1 };
char exitButtonText[50] = { "退出" };
char nextPageButtonText[50] = { "下移" };
char lastPageButtonText[50] = { "上移" };
char addUserInfoText[50] = { "添加用户" };
char delUserInfoText[50] = { "删除用户" };
char reWriteUserInfoText[50] = { "覆写文件" };
//print sheet
int leftCoor = 22, topCoor = 170, rectWidth = 115, rectHeight = 30;
rectProperties rects0[20];
rectProperties rects1[20];
rectProperties rects2[20];
rectProperties rects3[20];
rectProperties rects4[20];
rectProperties rects5[20];
rectProperties rects6[20];
rectProperties rects7[20];
rectProperties rects8[20];
rectProperties rects9[20];
int tempLeftCoor = leftCoor, tempTopCoor = topCoor;
for (int i = 0; i < 8; i++) {
rects0[i] = { tempLeftCoor,tempTopCoor - 1 * rectHeight,tempLeftCoor + rectWidth,tempTopCoor + 0 * rectHeight ,0,1 };
tempLeftCoor += rectWidth;
}
tempLeftCoor = leftCoor, tempTopCoor = topCoor;
for (int i = 0; i < 8; i++) {
rects1[i] = { tempLeftCoor,tempTopCoor + 0 * rectHeight,tempLeftCoor + rectWidth,tempTopCoor + 1*rectHeight ,0,1 };
tempLeftCoor += rectWidth;
}
tempLeftCoor = leftCoor, tempTopCoor = topCoor;
for (int i = 0; i < 8; i++) {
rects2[i] = { tempLeftCoor,tempTopCoor + 1 * rectHeight,tempLeftCoor + rectWidth,tempTopCoor + 2*rectHeight ,0,1 };
tempLeftCoor += rectWidth;
}
tempLeftCoor = leftCoor, tempTopCoor = topCoor;
for (int i = 0; i < 8; i++) {
rects3[i] = { tempLeftCoor,tempTopCoor + 2 * rectHeight,tempLeftCoor + rectWidth,tempTopCoor + 3*rectHeight ,0,1 };
tempLeftCoor += rectWidth;
}
tempLeftCoor = leftCoor, tempTopCoor = topCoor;
for (int i = 0; i < 8; i++) {
rects4[i] = { tempLeftCoor,tempTopCoor + 3 * rectHeight,tempLeftCoor + rectWidth,tempTopCoor + 4*rectHeight ,0,1 };
tempLeftCoor += rectWidth;
}
tempLeftCoor = leftCoor, tempTopCoor = topCoor;
f