Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a setting to make stickers look smaller in the chat window (200px -> 40px) #260

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 22 additions & 5 deletions TelegramTest/MessageTableItemSticker.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ -(id)initWithObject:(TL_localMessage *)object {
if(NSSizeNotZero(self.document.imageSize)) {
self.blockSize = self.document.imageSize;
} else {
self.blockSize = NSMakeSize(200, 200);
if ([SettingsArchiver checkMaskedSetting:SmallerStickers]) {
self.blockSize = NSMakeSize(40, 40);
} else {
self.blockSize = NSMakeSize(200, 200);
}
}

NSImage *placeholder;
Expand All @@ -36,8 +40,12 @@ -(id)initWithObject:(TL_localMessage *)object {
if(!placeholder)
placeholder = white_background_color();

self.blockSize = strongsize(self.blockSize, 200);

if ([SettingsArchiver checkMaskedSetting:SmallerStickers]) {
self.blockSize = strongsize(self.blockSize, 40);
} else {
self.blockSize = strongsize(self.blockSize, 200);
}

self.imageObject = [[TGStickerImageObject alloc] initWithDocument:self.document placeholder:placeholder];

self.imageObject.imageSize = self.blockSize;
Expand All @@ -52,10 +60,19 @@ -(BOOL)makeSizeByWidth:(int)width {
if(NSSizeNotZero(self.document.imageSize)) {
self.blockSize = self.document.imageSize;
} else {
self.blockSize = NSMakeSize(200, 200);
if ([SettingsArchiver checkMaskedSetting:SmallerStickers]) {
self.blockSize = NSMakeSize(40, 40);
} else {
self.blockSize = NSMakeSize(200, 200);
}
}

self.contentSize = self.blockSize = strongsize(self.blockSize, MIN(width,200));
if ([SettingsArchiver checkMaskedSetting:SmallerStickers]) {
self.contentSize = self.blockSize = strongsize(self.blockSize, MIN(width, 40));
} else {
self.contentSize = self.blockSize = strongsize(self.blockSize, MIN(width, 200));
}


return [super makeSizeByWidth:width];
}
Expand Down
3 changes: 2 additions & 1 deletion TelegramTest/SettingsArchiver.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ typedef enum {
IncludeMutedUnreadCount = 1 << 25,
DisableAutoplayGifSetting = 1 << 26,
TripleLayoutSettings = 1 << 27,
HandleMediaKeysSettings = 2 << 28
HandleMediaKeysSettings = 2 << 28,
SmallerStickers = 2 << 29,
} SettingsMask;


Expand Down
Binary file modified TelegramTest/en.lproj/Localizable.strings
Binary file not shown.