127 exit; |
127 exit; |
128 |
128 |
129 LastChatScaleValue:= ChatScaleValue; |
129 LastChatScaleValue:= ChatScaleValue; |
130 LastUIScaleValue:= UIScaleValue; |
130 LastUIScaleValue:= UIScaleValue; |
131 |
131 |
132 // determine font size - note: +0.1 to because I don't trust float inaccuracy combined with floor |
132 // determine font size - note: +0.001 to because I don't trust float inaccuracy combined with floor |
133 fntSize:= max(1, floor(UIScaleValue * ChatScaleValue * Fontz[fnt16].Height + 0.1)); |
133 fntSize:= max(1, floor(UIScaleValue * ChatScaleValue * cBaseChatFontHeight + 0.001)); |
134 |
134 |
135 if Fontz[fntChat].Height <> fntSize then |
135 if Fontz[fntChat].Height <> fntSize then |
136 begin |
136 begin |
137 // adjust associated heights |
137 // adjust associated heights |
138 Fontz[fntChat].Height:= fntSize; |
138 Fontz[fntChat].Height:= fntSize; |
152 ReloadLines(); |
152 ReloadLines(); |
153 UpdateInputLinePrefix(); |
153 UpdateInputLinePrefix(); |
154 UpdateCursorCoords(); |
154 UpdateCursorCoords(); |
155 end; |
155 end; |
156 |
156 |
157 procedure ChatSizeInc(); |
157 procedure ChatSizeInc(pxprecise: boolean); |
158 begin |
158 var fntSize: integer; |
159 // TODO cChatMinScaleLevel, cChatSizeDelta (probably half of cZoomDelta) |
159 begin |
160 // TODO always - effectively -- increase font by 1px? |
160 if pxprecise then |
161 if ChatScaleValue < cMinZoomLevel then |
161 begin |
162 begin |
162 fntSize:= Fontz[fntChat].Height; |
163 ChatScaleValue:= ChatScaleValue + cZoomDelta; |
163 inc(fntSize); |
164 AdjustToUIScale(); |
164 ChatScaleValue:= 1.0 * fntSize / cBaseChatFontHeight; |
165 end; |
165 end |
166 end; |
166 else |
167 |
167 ChatScaleValue:= ChatScaleValue * (1.0 + cChatScaleRelDelta); |
168 procedure ChatSizeDec(); |
168 if ChatScaleValue > cMaxChatScaleValue then |
169 begin |
169 ChatScaleValue:= cMaxChatScaleValue; |
170 // TODO cChatMaxScaleLevel, cChatSizeDelta (probably half of cZoomDelta) |
170 AdjustToUIScale(); |
171 // TODO always - effectively -- increase font by 1px? |
171 end; |
172 if ChatScaleValue > cMaxZoomLevel then |
172 |
173 begin |
173 procedure ChatSizeDec(pxprecise: boolean); |
174 ChatScaleValue:= ChatScaleValue - cZoomDelta; |
174 var fntSize: integer; |
175 AdjustToUIScale(); |
175 begin |
176 end; |
176 if pxprecise then |
|
177 begin |
|
178 fntSize:= Fontz[fntChat].Height; |
|
179 dec(fntSize); |
|
180 ChatScaleValue:= 1.0 * fntSize / cBaseChatFontHeight; |
|
181 end |
|
182 else |
|
183 ChatScaleValue:= ChatScaleValue / (1.0 + cChatScaleRelDelta); |
|
184 if ChatScaleValue < cMinChatScaleValue then |
|
185 ChatScaleValue:= cMinChatScaleValue; |
|
186 AdjustToUIScale(); |
177 end; |
187 end; |
178 |
188 |
179 procedure chatSizeReset(); |
189 procedure chatSizeReset(); |
180 begin |
190 begin |
181 ChatScaleValue:= cDefaultChatScaleLevel; |
191 ChatScaleValue:= cDefaultChatScaleLevel; |
1089 // make chat bigger |
1099 // make chat bigger |
1090 SDL_SCANCODE_KP_PLUS, SDL_SCANCODE_EQUALS: |
1100 SDL_SCANCODE_KP_PLUS, SDL_SCANCODE_EQUALS: |
1091 begin |
1101 begin |
1092 if ctrl then |
1102 if ctrl then |
1093 begin |
1103 begin |
1094 ChatSizeInc(); |
1104 ChatSizeInc(selMode); |
1095 SkipNextInput:= true; |
1105 SkipNextInput:= true; |
1096 end; |
1106 end; |
1097 end; |
1107 end; |
1098 // make chat smaller |
1108 // make chat smaller |
1099 SDL_SCANCODE_KP_MINUS, SDL_SCANCODE_MINUS: |
1109 SDL_SCANCODE_KP_MINUS, SDL_SCANCODE_MINUS: |
1100 begin |
1110 begin |
1101 if ctrl then |
1111 if ctrl then |
1102 begin |
1112 begin |
1103 ChatSizeDec(); |
1113 ChatSizeDec(selMode); |
1104 SkipNextInput:= true; |
1114 SkipNextInput:= true; |
1105 end; |
1115 end; |
1106 end; |
1116 end; |
1107 // revert chat size to default |
1117 // revert chat size to default |
1108 SDL_SCANCODE_KP_0, SDL_SCANCODE_0: |
1118 SDL_SCANCODE_KP_0, SDL_SCANCODE_0: |