Further iconized the channels, TRIED TO fix the broken attachement message height, the fix seems to be via just implementing them

This commit is contained in:
winsped
2026-07-22 00:36:56 +03:00
parent ed98242af8
commit d7221c7227
8 changed files with 37 additions and 12 deletions
+6 -1
View File
@@ -234,11 +234,16 @@ LRESULT CALLBACK ChatWndProc(HWND hwnd, UINT uMsg, WPARAM wParam,
for (int i = 0; i < cwnd->uimsgcnt; i++) { for (int i = 0; i < cwnd->uimsgcnt; i++) {
RECT contr = {0, 0, clientRect.right - clientRect.left - 6 - 6 - 40, RECT contr = {0, 0, clientRect.right - clientRect.left - 6 - 6 - 40,
0}; 0};
if (strlen(cwnd->uimsgs[i].msg.content) == 0) {
msgdet[i].TextContentHeight = 0;
}
else{
DrawTextA(hdc, cwnd->uimsgs[i].msg.content, DrawTextA(hdc, cwnd->uimsgs[i].msg.content,
strlen(cwnd->uimsgs[i].msg.content), &contr, strlen(cwnd->uimsgs[i].msg.content), &contr,
DT_CALCRECT | DT_WORDBREAK); DT_CALCRECT | DT_WORDBREAK);
// printf("%i | %i\n", i, contr.bottom - contr.top);
msgdet[i].TextContentHeight = contr.bottom - contr.top; msgdet[i].TextContentHeight = contr.bottom - contr.top;
}
// printf("%i | %i\n", i, contr.bottom - contr.top);
msgdet[i].StartMsg = IsStartMsg(cwnd, i); msgdet[i].StartMsg = IsStartMsg(cwnd, i);
if (msgdet[i].StartMsg) { if (msgdet[i].StartMsg) {
+3 -2
View File
@@ -3,11 +3,12 @@
int DiscordSendMessage(const char *channelID, const char* content); int DiscordSendMessage(const char *channelID, const char* content);
int DiscordListGuildChannels(char* guildID, DiscordChannel** out); int DiscordListGuildChannels(char* guildID, DiscordChannel** out);
#define GUILD_TEXT 0 #define GUILD_TEXT 0
#define DM_CHANNEL 1 #define CHANNEL_DM 1
#define GUILD_VOICE 2 #define GUILD_VOICE 2
#define GROUPCHAT_CHANNEL 3 #define CHANNEL_GC 3
#define GUILD_CATEGORY 4 #define GUILD_CATEGORY 4
#define GUILD_ANNOUNCEMENT 5 #define GUILD_ANNOUNCEMENT 5
#define GUILD_FORUM 15
int DiscordGetChannelHistory(const char* channelID, unsigned int amount, DiscordMessage** msgs); int DiscordGetChannelHistory(const char* channelID, unsigned int amount, DiscordMessage** msgs);
char *DiscordFetchTmpPfp(char *userID, char *hash); char *DiscordFetchTmpPfp(char *userID, char *hash);
char *DiscordFetchTmpGuildIcon(char *guildID, char *hash); char *DiscordFetchTmpGuildIcon(char *guildID, char *hash);
+22 -7
View File
@@ -72,9 +72,11 @@ int WINAPI WinMain(HINSTANCE hinstance, HINSTANCE hPrevInstance, PSTR pCmdLine,
InitSnowsControls(); InitSnowsControls();
hSidePfps = ImageList_Create(32, 32, ILC_COLOR32 | ILC_MASK, 12, 1); hSidePfps = ImageList_Create(32, 32, ILC_COLOR32 | ILC_MASK, 12, 1);
hChannelImgList = ImageList_Create(16, 16, ILC_COLOR32 | ILC_MASK, 8, 1); hChannelImgList = ImageList_Create(16, 16, ILC_COLOR32 | ILC_MASK, 8, 1);
ImageList_AddMasked(hChannelImgList,LoadBitmap(hinstance,MAKEINTRESOURCE(IDI_CHANNEL_CATEGORY)),RGB(255,0,255));
ImageList_AddMasked(hChannelImgList,LoadBitmap(hinstance,MAKEINTRESOURCE(IDI_CHANNEL_TC)),RGB(255,0,255)); ImageList_AddMasked(hChannelImgList,LoadBitmap(hinstance,MAKEINTRESOURCE(IDI_CHANNEL_TC)),RGB(255,0,255));
ImageList_AddMasked(hChannelImgList,LoadBitmap(hinstance,MAKEINTRESOURCE(IDI_CHANNEL_VC)),RGB(255,0,255)); ImageList_AddMasked(hChannelImgList,LoadBitmap(hinstance,MAKEINTRESOURCE(IDI_CHANNEL_VC)),RGB(255,0,255));
ImageList_AddMasked(hChannelImgList,LoadBitmap(hinstance,MAKEINTRESOURCE(IDI_CHANNEL_ANC)),RGB(255,0,255)); ImageList_AddMasked(hChannelImgList,LoadBitmap(hinstance,MAKEINTRESOURCE(IDI_CHANNEL_ANC)),RGB(255,0,255));
ImageList_AddMasked(hChannelImgList,LoadBitmap(hinstance,MAKEINTRESOURCE(IDI_CHANNEL_FORUM)),RGB(255,0,255));
hInstance = hinstance; hInstance = hinstance;
// register the window claws // register the window claws
const char CLASS_NAME[] = "BackcordMain"; const char CLASS_NAME[] = "BackcordMain";
@@ -391,7 +393,7 @@ LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam,
HTREEITEM hParent = TVI_ROOT; HTREEITEM hParent = TVI_ROOT;
int pfpidx = 0; int pfpidx = 0;
for (int i = 0; i < cnt; i++) { for (int i = 0; i < cnt; i++) {
if (dms[i].type == DM_CHANNEL) { if (dms[i].type == CHANNEL_DM) {
printf("%s\n", dms[i].receipents[0].Username); printf("%s\n", dms[i].receipents[0].Username);
if (dms[i].receipents[0].avatar) { if (dms[i].receipents[0].avatar) {
@@ -451,6 +453,7 @@ LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam,
DiscordChannel *Channels; DiscordChannel *Channels;
int ChannelCount = int ChannelCount =
DiscordListGuildChannels(guild->id, &Channels); DiscordListGuildChannels(guild->id, &Channels);
TreeView_SelectItem(hChTree, NULL);
TreeView_DeleteAllItems(hChTree); TreeView_DeleteAllItems(hChTree);
//TreeView_SetImageList(hChTree, hChannelImgList, TVSIL_NORMAL); //TreeView_SetImageList(hChTree, hChannelImgList, TVSIL_NORMAL);
struct hashmap *ChannelUITable = struct hashmap *ChannelUITable =
@@ -480,13 +483,18 @@ LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam,
tvInsert.item.lParam = (LPARAM) & (Channels[i]); tvInsert.item.lParam = (LPARAM) & (Channels[i]);
tvInsert.item.state = TVIS_EXPANDED; tvInsert.item.state = TVIS_EXPANDED;
tvInsert.item.stateMask = TVIS_EXPANDED; tvInsert.item.stateMask = TVIS_EXPANDED;
if(Channels[i].type==GUILD_VOICE){ if(Channels[i].type==GUILD_CATEGORY){
tvInsert.item.iImage=1;
}else if(Channels[i].type==GUILD_ANNOUNCEMENT){
tvInsert.item.iImage=2;
}else{
tvInsert.item.iImage=0; tvInsert.item.iImage=0;
} }
else if(Channels[i].type==GUILD_VOICE){
tvInsert.item.iImage=2;
}else if(Channels[i].type==GUILD_ANNOUNCEMENT){
tvInsert.item.iImage=3;
}else if(Channels[i].type==GUILD_FORUM){
tvInsert.item.iImage=4;
}else{
tvInsert.item.iImage=1;
}
HTREEITEM lres = (HTREEITEM)SendMessage( HTREEITEM lres = (HTREEITEM)SendMessage(
hChTree, TVM_INSERTITEM, 0, (LPARAM)&tvInsert); hChTree, TVM_INSERTITEM, 0, (LPARAM)&tvInsert);
if (Channels[i].type == GUILD_CATEGORY) { if (Channels[i].type == GUILD_CATEGORY) {
@@ -503,9 +511,16 @@ LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam,
pnmv->itemNew.state & TVIS_SELECTED) { pnmv->itemNew.state & TVIS_SELECTED) {
DiscordChannel *chnl = ((DiscordChannel *)pnmv->itemNew.lParam); DiscordChannel *chnl = ((DiscordChannel *)pnmv->itemNew.lParam);
if (chnl->type != GUILD_CATEGORY) { if (chnl->type != GUILD_CATEGORY) {
char *title = malloc(13 + strlen(chnl->name)); char *title = NULL;
if(chnl->type==CHANNEL_DM){
title = malloc(12 + strlen(chnl->receipents[0].DisplayName));
wsprintf(title, "Backcord - %s", chnl->receipents[0].DisplayName);
SetWindowTextA(hwnd, title);
}else{
title = malloc(13 + strlen(chnl->name));
wsprintf(title, "Backcord - #%s", chnl->name); wsprintf(title, "Backcord - #%s", chnl->name);
SetWindowTextA(hwnd, title); SetWindowTextA(hwnd, title);
}
DiscordMessage *msgs; DiscordMessage *msgs;
int msgcnt = DiscordGetChannelHistory(chnl->id, 50, &msgs); int msgcnt = DiscordGetChannelHistory(chnl->id, 50, &msgs);
ClearChatControl(hMsgList); ClearChatControl(hMsgList);
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 822 B

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 822 B

+3 -1
View File
@@ -2,4 +2,6 @@
#define IDI_BACKCORDBANNERIC 102 #define IDI_BACKCORDBANNERIC 102
#define IDI_CHANNEL_TC 110 #define IDI_CHANNEL_TC 110
#define IDI_CHANNEL_VC 111 #define IDI_CHANNEL_VC 111
#define IDI_CHANNEL_ANC 112 #define IDI_CHANNEL_ANC 112
#define IDI_CHANNEL_FORUM 113
#define IDI_CHANNEL_CATEGORY 114
BIN
View File
Binary file not shown.
+3 -1
View File
@@ -2,6 +2,8 @@
IDI_BACKCORDIC RCDATA "backcord_icon.png" IDI_BACKCORDIC RCDATA "backcord_icon.png"
IDI_BACKCORDBANNERIC BITMAP "backcordbanner.bmp" IDI_BACKCORDBANNERIC BITMAP "backcordbanner.bmp"
IDI_CHANNEL_CATEGORY BITMAP "category.bmp"
IDI_CHANNEL_TC BITMAP "tc.bmp" IDI_CHANNEL_TC BITMAP "tc.bmp"
IDI_CHANNEL_VC BITMAP "vc.bmp" IDI_CHANNEL_VC BITMAP "vc.bmp"
IDI_CHANNEL_ANC BITMAP "anc.bmp" IDI_CHANNEL_ANC BITMAP "anc.bmp"
IDI_CHANNEL_FORUM BITMAP "forum.bmp"