Ticket #4146: magnify.diff
File magnify.diff, 2.2 KB (added by , 13 years ago) |
---|
-
src/apps/magnify/Magnify.h
169 169 void AddMenu(); 170 170 void SetMagView(TMagnify* magView); 171 171 172 char fInfoStr[64]; 173 char fRGBStr[64]; 174 char fCH1Str[64]; 175 char fCH2Str[64]; 176 172 177 private: 173 178 float fFontHeight; 174 179 TMagnify* fMagView; … … 183 188 184 189 BPoint fCH1Loc; 185 190 BPoint fCH2Loc; 186 187 char fInfoStr[64];188 char fRGBStr[64];189 char fCH1Str[64];190 char fCH2Str[64];191 191 }; 192 192 193 193 class TWindow : public BWindow { … … 219 219 void ShowInfo(bool); 220 220 bool InfoIsShowing(); 221 221 void UpdateInfo(); 222 void UpdateInfoBarOnResize(); 222 223 223 224 void AddCrossHair(); 224 225 void RemoveCrossHair(); … … 240 241 float fFontHeight; 241 242 242 243 bool fShowGrid; 244 bool fInfoBarState; 243 245 244 246 int32 fHPixelCount; 245 247 int32 fVPixelCount; -
src/apps/magnify/Magnify.cpp
277 277 break; 278 278 279 279 case msg_show_info: 280 if (active) 280 if (active) { 281 fInfoBarState = !fInfoBarState; 281 282 ShowInfo(!fShowInfo); 283 } 282 284 break; 283 285 284 286 case msg_toggle_grid: … … 466 468 DONE: 467 469 fShowGrid = showGrid; 468 470 fShowInfo = showInfo; 471 fInfoBarState = showInfo; 469 472 fHPixelCount = (overridePixelCount == -1) ? hPixelCount : overridePixelCount; 470 473 fVPixelCount = (overridePixelCount == -1) ? vPixelCount : overridePixelCount; 471 474 fPixelSize = pixelSize; … … 513 516 { 514 517 CalcViewablePixels(); 515 518 fFatBits->InitBuffers(fHPixelCount, fVPixelCount, fPixelSize, ShowGrid()); 519 UpdateInfoBarOnResize(); 516 520 } 517 521 518 522 … … 677 681 678 682 679 683 void 684 TWindow::UpdateInfoBarOnResize() 685 { 686 float width, height; 687 GetPreferredSize(&width, &height); 688 689 if (fInfo->StringWidth(fInfo->fInfoStr) + 30 > width 690 || fInfo->StringWidth(fInfo->fCH1Str) + 691 fInfo->StringWidth(fInfo->fCH2Str) + 692 fInfo->StringWidth(fInfo->fRGBStr) + 30 > width) { 693 ShowInfo(false); 694 } else if (fInfoBarState) { 695 ShowInfo(true); 696 } 697 } 698 699 700 void 680 701 TWindow::AddCrossHair() 681 702 { 682 703 fFatBits->AddCrossHair();