Changeset 12071 for trunk/FACT++/gui/QCameraWidget.cc
- Timestamp:
- 09/12/11 14:05:21 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/gui/QCameraWidget.cc
r12054 r12071 88 88 89 89 90 int textSize = (int)(height()*14/600);91 setFont(QFont("Monospace", textSize));90 // int textSize = (int)(width()*14/600); 91 // setFont(QFont("Monospace", textSize)); 92 92 qglColor(QColor(255, 223, 127)); 93 93 94 94 //first let's draw the usual data 95 95 //title 96 renderText(-shownSizex/2.f + 0.01f, shownSizey/2.f - textSize*pixelSize - 0.01f, 0.f, QString(titleText.c_str()));96 renderText(-shownSizex/2.f + 0.01f, shownSizey/2.f - fTextSize*pixelSize - 0.01f, 0.f, QString(titleText.c_str())); 97 97 //stats 98 98 ostringstream str; … … 100 100 str.setf(ios::fixed,ios::floatfield); 101 101 str << "Med " << fmedian;// << unitsText; 102 renderText(3, height()-3-4* textSize-35, QString(str.str().c_str()));102 renderText(3, height()-3-4*fTextSize-35, QString(str.str().c_str())); 103 103 str.str(""); 104 104 str << "Avg " << fmean;// << unitsText; 105 renderText(3, height()-3-3* textSize-27, QString(str.str().c_str()));105 renderText(3, height()-3-3*fTextSize-27, QString(str.str().c_str())); 106 106 str.str(""); 107 107 str << "RMS " << frms;// << unitsText; 108 renderText(3, height()-3-2* textSize-21, QString(str.str().c_str()));108 renderText(3, height()-3-2*fTextSize-21, QString(str.str().c_str())); 109 109 str.str(""); 110 110 str << "Min " << fmin;// << unitsText; … … 112 112 str.str(""); 113 113 str << "Max " << fmax;// << unitsText; 114 renderText(3, height()-3-1* textSize-8, QString(str.str().c_str()));114 renderText(3, height()-3-1*fTextSize-8, QString(str.str().c_str())); 115 115 //then draw the values beside the scale 116 116 //the difficulty here is to write the correct min/max besides the scale … … 119 119 //real min/max are fmin and fmax (I know, quite confusing... sorry about that) 120 120 //so. first let's see what is the span of one pixel 121 float min = (fMin < 0) ? fmin : fMin;122 float max = (fM ax < 0) ? fmax : fMax;123 textSize = (int)(height()*12/600);124 setFont(QFont("Monospace", textSize));125 float pixelSpan = (height() - textSize - 1)/(max - min);121 float min = (fMin < fScaleLimit || fMax < fScaleLimit) ? fmin : fMin; 122 float max = (fMin < fScaleLimit || fMax < fScaleLimit) ? fmax : fMax; 123 // textSize = (int)(height()*12/600); 124 // setFont(QFont("Monospace", textSize)); 125 float pixelSpan = (height() - fTextSize - 1)/(max - min); 126 126 127 127 //draw the scale values 128 128 float value = min; 129 int fontWidth = textSize; 130 if (textSize > 12) fontWidth-=3; else fontWidth -=2; 131 if (textSize < 7) fontWidth++; 129 int fontWidth = fTextSize; 130 if (fTextSize > 12) fontWidth--; 131 if (fTextSize > 10) fontWidth--; 132 if (fTextSize > 7) fontWidth--;//else fontWidth -=1; 133 // if (fTextSize < 7) fontWidth++; 132 134 for (int i=0;i<11;i++) 133 135 { … … 149 151 int w = width() - (width()/50) - fontWidth*str.str().size(); 150 152 if (i==0 || i==10) w -= width()/50; 151 if (i!=0 && i!=10) h -= textSize/2;153 if (i!=0 && i!=10) h -= fTextSize/2; 152 154 renderText(w, h, QString(str.str().c_str())); 153 155 value += (max - min)/10; … … 171 173 glPopMatrix(); 172 174 173 textSize = (int)(600*14/600);174 setFont(QFont("Times", textSize));175 // textSize = (int)(600*14/600); 176 // setFont(QFont("Times", textSize)); 175 177 } 176 178 void QCameraWidget::drawPatches() … … 399 401 void QCameraWidget::highlightPixel(int idx, bool highlight) 400 402 { 401 if (idx < 0 || idx > ACTUAL_NUM_PIXELS)403 if (idx < 0 || idx >= ACTUAL_NUM_PIXELS) 402 404 { 403 405 cout << "Error: requested pixel highlight out of bounds" << endl; … … 422 424 void QCameraWidget::highlightPatch(int idx, bool highlight) 423 425 { 424 if (idx < 0 || idx > NTMARK)426 if (idx < 0 || idx >= NTMARK) 425 427 { 426 428 cout << "Error: requested patch highlight out of bounds" << endl;
Note:
See TracChangeset
for help on using the changeset viewer.