예제 #1
0
int textWidthInFont(const QString text, const QFont& font)
{
	QFontMetrics qfm(font);
	QSize size = qfm.size(0, text);

    return size.width();
}
예제 #2
0
void CButton::updateText()
{
    QFontMetrics qfm(m_TextLabel.font());
    QString strTemp(qfm.elidedText(m_Text,Qt::ElideRight,GetTextWidth()));
    m_TextLabel.setText(strTemp);
    m_TextLabel.setAlignment(Qt::AlignCenter);
    //m_TextLabel.setGeometry((this->width() - m_TextLabel.width()) / 2, (this->height() - m_TextLabel.height()) / 2, m_TextLabel.width(), m_TextLabel.height());
    m_TextLabel.setAttribute(Qt::WA_TranslucentBackground, true);
}
/**
 * Update the number of unread messages in the tray icon
 */
void KCheckGmailTray::updateCountImage(QColor color)
{
    kDebug() << k_funcinfo << "Count=" << mMailCount;

    if(mMailCount == 0)
        setPixmapEmpty();
    else {
        // adapted from KMSystemTray::updateCount()

        int oldPixmapWidth = mPixGmail.size().width();

        QString countString = QString::number( mMailCount );
        QFont countFont = KGlobalSettings::generalFont();
        countFont.setBold(true);

        // decrease the size of the font for the number of unread messages if the
        // number doesn't fit into the available space
        float countFontSize = countFont.pointSizeF();
        QFontMetrics qfm( countFont );
        int width = qfm.width( countString );
        if( width > (oldPixmapWidth - 2) )
        {
            countFontSize *= float( oldPixmapWidth - 2 ) / float( width );
            countFont.setPointSizeF( countFontSize );
        }

        // Overlay the light KCheckGmail image with the number image
        QImage iconWithNumberImage = mLightIconImage.copy();
        QPainter p( &iconWithNumberImage );
        p.setFont( countFont );
        KColorScheme scheme( QPalette::Active, KColorScheme::View );

        qfm = QFontMetrics( countFont );
        QRect boundingRect = qfm.tightBoundingRect( countString );
        boundingRect.adjust( 0, 0, 0, 2 );
        boundingRect.setHeight( qMin( boundingRect.height(), oldPixmapWidth ) );
        boundingRect.moveTo( (oldPixmapWidth - boundingRect.width()) / 2,
                             ((oldPixmapWidth - boundingRect.height()) / 2) - 1 );
        p.setOpacity( 0.7 );
        p.setBrush( scheme.background( KColorScheme::LinkBackground ) );
        p.setPen( scheme.background( KColorScheme::LinkBackground ).color() );
        p.drawRoundedRect( boundingRect, 2.0, 2.0 );

        p.setBrush( Qt::NoBrush );
//		p.setPen( scheme.foreground( KColorScheme::LinkText ).color() );
        p.setPen(color);
        p.setOpacity( 1.0 );
        p.drawText( iconWithNumberImage.rect(), Qt::AlignCenter, countString );

        setIcon( QPixmap::fromImage( iconWithNumberImage ) );
    }
}
예제 #4
0
int TextCursor::cursorAtX(int x) const
{
	int pos = 0;

	QFontMetrics qfm(owner()->style()->font());
	int width = 0;
	for (int i = 1; i <= owner()->text().length(); ++i)
	{
		int new_width = qfm.width(owner()->text().left(i));
		if ( x > (new_width + width + 1) / 2 ) pos++;
		width = new_width;
	}

	return pos;
}
QSize RepoItemDelegate::sizeHintForRepoCategoryItem(const QStyleOptionViewItem &option,
                                                    const RepoCategoryItem *item) const
{
    int width, height;

	QFontMetrics qfm(option.font);
    QSize size = qfm.size(0, item->name());

    width = qMin(size.width(), kRepoCategoryIndicatorWidth)
        + kMarginBetweenIndicatorAndName + kRepoCategoryNameMaxWidth;

    height = qMax(size.height(), kRepoCategoryIndicatorHeight) + kPadding;

    // qDebug("width = %d, height = %d\n", width, height);

    return QSize(width, height);
}
예제 #6
0
void TextCursor::setSelectedByDrag(int xBegin, int xEnd)
{
	selectionBegin_ = 0;
	selectionEnd_ = 0;

	QFontMetrics qfm(owner()->style()->font());
	int width = 0;
	for (int i = 1; i <= owner()->text().length(); ++i)
	{
		int new_width = qfm.width(owner()->text().left(i));
		if ( xBegin > (new_width + width + 1) / 2 ) selectionBegin_++;
		if ( xEnd > (new_width + width + 1) / 2 ) selectionEnd_++;
		width = new_width;
	}

	owner()->setFocus();
	owner()->setUpdateNeeded();
}
예제 #7
0
void PathBubble0::resizeFont(QString aText, QString fontType , int &fontSize, int style, int width, int height)
{
    int newFontSize;
	QFont aFont(fontType, fontSize, style);
	QFontMetrics qfm(aFont);	
	QSize size = qfm.size(0, aText);	
	newFontSize=fontSize;
	if(size.width()>width*0.95||size.width()<width*0.85)
	    fontSize= fontSize*width*0.9/size.width();
	
	QFont aFont2(fontType, fontSize, style);
	QFontMetrics qfm2(aFont2);	
	size = qfm2.size(0, aText);	
	if(size.height()>height*0.95)
	{
		fontSize = fontSize*height*0.95/size.height();		
	}
	if(fontSize<1)
		fontSize=1;
}
예제 #8
0
QSize Braces::getSizeOfBrace(const QString& brace, const QFont& font, int innerHeight, QPointF* offset) const
{
	if (innerHeight < 1) return QSize(0,0);

	if (brace.isEmpty()) return QSize(0, innerHeight);

	QFont f(font);
	f.setPixelSize(innerHeight);
	QFontMetrics qfm(f);

	// TODO tightBoundingRect is supposedly very slow on Windows. Test this.
	QRect bound = qfm.tightBoundingRect(brace);
	if (offset)
	{
		offset->setX(-bound.left());
		offset->setY(-bound.top());
	}

	return bound.size();
}
예제 #9
0
QString fitTextToWidth(const QString& text, const QFont& font, int width)
{
    static QString ELLIPSISES = "...";

	QFontMetrics qfm(font);
	QSize size = qfm.size(0, text);
	if (size.width() <= width)
		return text;				// it fits, so just display it

	// doesn't fit, so we need to truncate and add ellipses
	QSize sizeElippses = qfm.size(0, ELLIPSISES); // we need to cut short enough to add these
	QString s = text;
	while (s.length() > 0)     // never cut shorter than this...
	{
		int len = s.length();
		s = text.left(len-1);
		size = qfm.size(0, s);
		if (size.width() <= (width - sizeElippses.width()))
			break;              // we are finally short enough
	}

	return (s + ELLIPSISES);
}
void ControlWidget::bindDBusService(DBusMediaPlayer2 *dbusInter)
{
    m_dbusInter = dbusInter;

    connect(m_prevSong, &DImageButton::clicked, m_dbusInter, &DBusMediaPlayer2::Previous);
    connect(m_nextSong, &DImageButton::clicked, m_dbusInter, &DBusMediaPlayer2::Next);
    connect(m_pauseSong, &DImageButton::clicked, m_dbusInter, &DBusMediaPlayer2::PlayPause);
    connect(m_dbusInter, &DBusMediaPlayer2::PlaybackStatusChanged, this, &ControlWidget::changePauseBtnPic);
    connect(m_dbusInter, &DBusMediaPlayer2::VolumeChanged, this, &ControlWidget::changeVolumeBtnPic);
    connect(m_dbusInter, &DBusMediaPlayer2::VolumeChanged, [this] {
        m_volumeNums->setText(QString::number(m_dbusInter->volume() * 100));
    });
    connect(m_dbusInter, &DBusMediaPlayer2::MetadataChanged, [this] {
        const QString text = m_dbusInter->metadata().value("xesam:title").toString();
        QFontMetrics qfm(m_songName->font());

        if (qfm.width(text) > m_songName->width())
            m_songName->setText(qfm.elidedText(text, Qt::ElideRight, m_songName->width()));
        else
            m_songName->setText(text);
    });
    connect(m_volume, &DImageButton::clicked, [this] {
        const double currentVolume = m_dbusInter->volume();

        if (currentVolume) {
            m_lastVolumeNums = currentVolume;
            m_dbusInter->setVolume(0);
        } else {
            m_dbusInter->setVolume(m_lastVolumeNums);
        }
    });

    m_dbusInter->VolumeChanged();
    m_dbusInter->MetadataChanged();
    m_dbusInter->PlaybackStatusChanged();
    m_dbusInter->VolumeChanged();
}
예제 #11
0
void AppBase::SetEdlidedText(QLabel *pLabel,QString strText,int iWidth)
{
    QFontMetrics qfm(pLabel->font());
    pLabel->setText(qfm.elidedText(strText,Qt::ElideRight,iWidth));
}
예제 #12
0
PreFlightCheckListPage::PreFlightCheckListPage( QWidget* parent ) :
  QWidget( parent ),
  CheckListFileName("cumulus-checklist.txt")
{
  setObjectName("PreFlightCheckListPage");
  setWindowFlags( Qt::Tool );
  setWindowModality( Qt::WindowModal );
  setAttribute(Qt::WA_DeleteOnClose);
  setWindowTitle( tr("PreFlight - Checklist") );

  if( parent )
    {
      resize( parent->size() );
    }

  QVBoxLayout *contentLayout = new QVBoxLayout;
  setLayout(contentLayout);

  m_fileDisplay = new QLabel;
  m_fileDisplay->setWordWrap( true );
  m_fileDisplay->hide();
  contentLayout->addWidget( m_fileDisplay );

  QHBoxLayout *hbox = new QHBoxLayout;
  hbox->setMargin( 0 );
  contentLayout->addLayout( hbox );

  m_list = new QTableWidget( 0, 2, this );
  m_list->setSelectionBehavior( QAbstractItemView::SelectItems );
  m_list->setHorizontalScrollBarPolicy( Qt::ScrollBarAsNeeded );
  m_list->setAlternatingRowColors( true );
  m_list->setVerticalScrollMode( QAbstractItemView::ScrollPerPixel );
  m_list->setHorizontalScrollMode( QAbstractItemView::ScrollPerPixel );

  // calculates the needed icon size
  QFontMetrics qfm( font() );
  int iconSize = qfm.height();

  // Sets the icon size of a list entry
  m_list->setIconSize( QSize(iconSize, iconSize) );

  hbox->addWidget( m_list );

  connect( m_list, SIGNAL(cellDoubleClicked(int, int)),
           SLOT(slotEditCell(int, int)) );

  connect( m_list, SIGNAL(cellClicked(int, int)),
           SLOT(slotCellClicked(int, int)) );

#ifdef ANDROID
  QScrollBar* lvsb = m_list->verticalScrollBar();
  lvsb->setStyleSheet( Layout::getCbSbStyle() );
#endif

#ifdef QSCROLLER
  QScroller::grabGesture(m_list->viewport(), QScroller::LeftMouseButtonGesture);
#endif

#ifdef QTSCROLLER
  QtScroller::grabGesture(m_list->viewport(), QtScroller::LeftMouseButtonGesture);
#endif

  QString style = "QTableView QTableCornerButton::section { background: gray }";
  m_list->setStyleSheet( style );
  QHeaderView *vHeader = m_list->verticalHeader();
  style = "QHeaderView::section { width: 2em }";
  vHeader->setStyleSheet( style );

  // set new row height from configuration
  int afMargin = GeneralConfig::instance()->getListDisplayAFMargin();
  rowDelegate = new RowDelegate( m_list, afMargin );
  m_list->setItemDelegate( rowDelegate );

  QHeaderView* hHeader = m_list->horizontalHeader();
  hHeader->setStretchLastSection( true );
  hHeader->hide();

  QTableWidgetItem *item = new QTableWidgetItem( tr(" Check Point ") );
  m_list->setHorizontalHeaderItem( 0, item );

#ifndef ANDROID
  int buttonSize = Layout::getButtonSize();
#else
  int buttonSize = Layout::getButtonSize(16);
#endif

  iconSize   = buttonSize - 5;

  QPushButton* toggleButton = new QPushButton(this);
  toggleButton->setIcon(QIcon(GeneralConfig::instance()->loadPixmap("file-32.png")));
  toggleButton->setIconSize( QSize(iconSize, iconSize) );
  toggleButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::QSizePolicy::Preferred);
  toggleButton->setMinimumSize(buttonSize, buttonSize);
  toggleButton->setMaximumSize(buttonSize, buttonSize);

  QPushButton *addButton = new QPushButton;
  addButton->setIcon( QIcon( GeneralConfig::instance()->loadPixmap( "add.png" ) ) );
  addButton->setIconSize(QSize(iconSize, iconSize));
  addButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::QSizePolicy::Preferred);
  addButton->setMinimumSize(buttonSize, buttonSize);
  addButton->setMaximumSize(buttonSize, buttonSize);

  m_editButton = new QPushButton(this);
  m_editButton->setIcon( QIcon(GeneralConfig::instance()->loadPixmap("edit_new.png")) );
  m_editButton->setIconSize( QSize(iconSize, iconSize) );
  m_editButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::QSizePolicy::Preferred);
  m_editButton->setMinimumSize(buttonSize, buttonSize);
  m_editButton->setMaximumSize(buttonSize, buttonSize);

  m_deleteButton = new QPushButton;
  m_deleteButton->setIcon( QIcon( GeneralConfig::instance()->loadPixmap( "delete.png" ) ) );
  m_deleteButton->setIconSize( QSize(iconSize, iconSize) );
  m_deleteButton->setEnabled(false);
  m_deleteButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::QSizePolicy::Preferred);
  m_deleteButton->setMinimumSize(buttonSize, buttonSize);
  m_deleteButton->setMaximumSize(buttonSize, buttonSize);

  QPushButton *cancel = new QPushButton(this);
  cancel->setIcon(QIcon(GeneralConfig::instance()->loadPixmap("cancel.png")));
  cancel->setIconSize(QSize(iconSize, iconSize));
  cancel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::QSizePolicy::Preferred);
  cancel->setMinimumSize(buttonSize, buttonSize);
  cancel->setMaximumSize(buttonSize, buttonSize);

  m_ok = new QPushButton(this);
  m_ok->setIcon(QIcon(GeneralConfig::instance()->loadPixmap("ok.png")));
  m_ok->setIconSize(QSize(iconSize, iconSize));
  m_ok->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::QSizePolicy::Preferred);
  m_ok->setMinimumSize(buttonSize, buttonSize);
  m_ok->setMaximumSize(buttonSize, buttonSize);

  QLabel *titlePix = new QLabel(this);
  titlePix->setAlignment( Qt::AlignCenter );
  titlePix->setPixmap( _globalMapConfig->createGlider(315, 1.6) );

  connect( addButton, SIGNAL(pressed()), SLOT(slotAddRow()) );
  connect( toggleButton, SIGNAL(pressed()), SLOT(slotToogleFilenameDisplay()) );
  connect( m_editButton, SIGNAL(pressed()), SLOT(slotEdit()) );
  connect( m_deleteButton, SIGNAL(pressed()), SLOT(slotDeleteRows()) );
  connect( m_ok, SIGNAL(pressed()), SLOT(slotAccept()) );
  connect( cancel, SIGNAL(pressed()), SLOT(slotReject()) );

  QVBoxLayout *buttonBox = new QVBoxLayout;
  hbox->addLayout(buttonBox);

  buttonBox->setSpacing(0);
  buttonBox->addWidget(toggleButton);
  buttonBox->addSpacing(10 * Layout::getIntScaledDensity());
  buttonBox->addWidget(addButton);
  buttonBox->addSpacing(10 * Layout::getIntScaledDensity());
  buttonBox->addWidget(m_editButton);
  buttonBox->addSpacing(10 * Layout::getIntScaledDensity());
  buttonBox->addWidget(m_deleteButton);
  buttonBox->addSpacing(10 * Layout::getIntScaledDensity());
  buttonBox->addWidget(cancel);
  buttonBox->addSpacing(10 * Layout::getIntScaledDensity());
  buttonBox->addWidget(m_ok);
  buttonBox->addStretch(2);
  buttonBox->addWidget(titlePix);
}
예제 #13
0
void DisplayText::setFont(QFont font)
{
  QFontMetrics qfm(font);
  _fontWidth = qfm.averageCharWidth()+1;  // the plus one is emperical
  QTextBrowser::setFont(font);
}
void CustomComboboxItem::setText(QString text)
{
    //m_pTextLab->setText(text);
    QFontMetrics qfm(m_pTextLab->font());
    m_pTextLab->setText(qfm.elidedText(text,Qt::ElideRight,width() - height()));
}
예제 #15
0
파일: ruler.cpp 프로젝트: sglass68/paperman
void Ruler::drawContents(QPainter* painter)
{
//The ruler looks like this:
//
// |....+....|....+....|
// or
// |....|....|....|....|
// or
// | + | + | + | + | + |
// or
// |  |  |  |  |  |  |  |
//
// where
// | == longmark
// + == mediummark
// . == shortmark
//
// The layout depends on the pixel distance between marks.
// We try to ensure, that the distance between marks is at least 5
// pixel. Otherwise the ruler might look bad due to rounding errors.

	int mark_number;//number of marks between longmarks
	double mark_dist;//distance between marks
	int mc;//mark counter
  int w = width();
  int h = height();
  bool draw_mm,draw_lm,draw_sm;
  bool draw_mm_text;
  draw_lm = false;
  draw_mm = false;
  draw_sm = false;

  //scalefactor
  double f;
	if(mOrientation == Qt::Horizontal)
    f = double(w)/(mMaxRange-mMinRange);
  else
    f = double(h)/(mMaxRange-mMinRange);
  //drawing offset
  double x_off;
  x_off = mMinRange*f;

  QString qs;
  int textheight;
  int textwidth;

  QFont qf(qApp->font());
  QFontMetrics qfm(qf );

  int dignum = 1;
  qs = "0";
  //find number of digits for max val
  while(int(mMaxRange)/dignum > 10)
  {
    qs += "0";
    dignum *=10;
  }
	textwidth = qfm.boundingRect(qs).width();
	textheight=qfm.boundingRect(qs).height();

  int lm_text_step;
  int lm_text_cnt;
  int draw_lm_text_cnt;
  int draw_lm_text = 0;

	if(mOrientation == Qt::Horizontal)
	{
    if((textheight + 12) > 30)
      setFixedHeight(textheight + 12);
    else
      setFixedHeight(30);
    int cnt = 1;
    for(cnt=1;cnt<int(mMaxRange);cnt *= 10)
    {
      if(double(cnt) * f > 20.0)
        break;
    }
    mark_dist = double(cnt) * f;
    lm_text_step = cnt;
    if(mMinRange > 0.0)
      lm_text_cnt = 1 + int(mMinRange)/lm_text_step;
    else
      lm_text_cnt = 0;
    //if cnt > 1, then it might be possible to draw text on the medium markers
    //find pixel distance between longmark values
    draw_lm_text_cnt = 0;
    while(draw_lm_text_cnt*int(mark_dist) < textwidth + 10)
      ++draw_lm_text_cnt;
    if((cnt > 1) && (int(mark_dist) > 2*(textwidth + 10)))
      draw_mm_text = true;
    if((cnt % 2) != 0)
      draw_mm_text = false;

    if(int(mark_dist) < 2*textwidth +10)
      draw_mm_text = false;
    if(mark_dist >= 50.0)
    {
      //draw 1 mediummark and 8 shortmarks between longmarks
      mark_dist = mark_dist/10.0;
      mark_number = 10;
    }
    else if(mark_dist >= 25.0)
    {
      //draw 5 shortmarks between longmarks
      mark_dist = mark_dist/5.0;
      mark_number = 5;
    }
    else if(mark_dist >= 10.0)
    {
      //draw 1 mediummark between longmarks
      mark_dist = mark_dist/2.0;
      mark_number = 2;
    }
    else
      mark_number = 0;

    double map_max;

    map_max = mMaxRange*f;
    mc = int(ceil(double(x_off)/mark_dist));

    double d;
		for(d=x_off;d<=map_max;d+=0.1)
		{
      switch(mark_number)
      {
        case 0:
          if(d >= mark_dist*double(mc))
            draw_lm = true;
          break;
        case 2:
          if((d >= mark_dist*double(mc)) && (mc % 2 == 0))
            draw_lm = true;
          else if(d >= (mark_dist*double(mc)))
            draw_mm = true;
          break;
        case 5:;
          if((d>= mark_dist*double(mc)) && (mc % 5 == 0))
            draw_lm = true;
          else if(d >= mark_dist*double(mc))
            draw_sm = true;
          break;
        case 10:;
          if((d >= (mark_dist*double(mc)) ) && (mc % 10 == 0))
            draw_lm = true;
          else if((d >= (mark_dist*double(mc)) ) && (mc % 5 == 0))
            draw_mm = true;
          else if(d >= (mark_dist*double(mc)) )
            draw_sm = true;
          break;
        default:;
      }
      if(draw_lm)
      {
				painter->drawLine((int)(d-x_off),height(),(int)(d-x_off),height()-12);//4*height()/7);					
        draw_lm = false;
				if(draw_lm_text == 0)
				{
					 qs.sprintf("%i",int(lm_text_cnt * lm_text_step));
//p         	 drawText ((int)(d-x_off+2),height()-12,qs);//height()/2, qs );
				}
        ++draw_lm_text;
        if(draw_lm_text >= draw_lm_text_cnt)
          draw_lm_text = 0;
        lm_text_cnt += 1;
        ++mc;
      }
      else if(draw_mm)
      {
				painter->drawLine((int)(d-x_off),height(),(int)(d-x_off),height()-6);//2*height()/3);					
        draw_mm = false;
				if(draw_mm_text)
				{
					 qs.sprintf("%i",int(lm_text_cnt * lm_text_step -
                               lm_text_step/2));
//p         	 drawText ((int)(d-x_off+2),height()-12,qs);//height()/2, qs );
				}
        ++mc;
      }
      else if(draw_sm)
      {
				painter->drawLine((int)(d-x_off),height(),(int)(d-x_off),height()-3);//4*height()/5);					
        draw_sm = false;
        ++mc;
      }
    }
  }
	else
	{
    if((textwidth + 12) > 30)
      setFixedWidth(textwidth + 12);
    else
      setFixedWidth(30);
    int cnt = 1;
    for(cnt=1;cnt<int(mMaxRange);cnt *= 10)
    {
      if(double(cnt) * f > 20.0)
        break;
    }
    mark_dist = double(cnt) * f;
    lm_text_step = cnt;
    if(mMinRange > 0.0)
      lm_text_cnt = 1 + int(mMinRange)/lm_text_step;
    else
      lm_text_cnt = 0;
    //if cnt > 1, then itmight be possible to draw text on the medium markers
    //find pixel distance between longmark values
    draw_lm_text_cnt = 0;
    while(draw_lm_text_cnt*int(mark_dist) < textwidth + 10)
      ++draw_lm_text_cnt;
    if((cnt > 1) && (int(mark_dist) > 2*(textwidth + 10)))
      draw_mm_text = true;
    if((cnt % 2) != 0)
      draw_mm_text = false;


    if(int(mark_dist) < 2*textwidth +10)
      draw_mm_text = false;
    if(mark_dist >= 50.0)
    {
      //draw 1 mediummark and 8 shortmarks between longmarks
      mark_dist = mark_dist/10.0;
      mark_number = 10;
    }
    else if(mark_dist >= 25.0)
    {
      //draw 5 shortmarks between longmarks
      mark_dist = mark_dist/5.0;
      mark_number = 5;
    }
    else if(mark_dist >= 10.0)
    {
      //draw 1 mediummark between longmarks
      mark_dist = mark_dist/2.0;
      mark_number = 2;
    }
    else
      mark_number = 0;

    double map_max;

    map_max = mMaxRange*f;
    mc = int(ceil(double(x_off)/mark_dist));

    double d;
		for(d=x_off;d<=map_max;d+=0.1)
		{
      switch(mark_number)
      {
        case 0:
          if(d >= mark_dist*double(mc))
            draw_lm = true;
          break;
        case 2:
          if((d >= mark_dist*double(mc)) && (mc % 2 == 0))
            draw_lm = true;
          else if(d >= (mark_dist*double(mc)))
            draw_mm = true;
          break;
        case 5:;
          if((d>= mark_dist*double(mc)) && (mc % 5 == 0))
            draw_lm = true;
          else if(d >= mark_dist*double(mc))
            draw_sm = true;
          break;
        case 10:;
          if((d >= (mark_dist*double(mc)) ) && (mc % 10 == 0))
            draw_lm = true;
          else if((d >= (mark_dist*double(mc)) ) && (mc % 5 == 0))
            draw_mm = true;
          else if(d >= (mark_dist*double(mc)) )
            draw_sm = true;
          break;
        default:;
      }
      if(draw_lm)
      {
				painter->drawLine(width(),(int)(d-x_off),width()-12,(int)(d-x_off));					
        draw_lm = false;
				if(draw_lm_text == 0)
				{
					 qs.sprintf("%i",int(lm_text_cnt * lm_text_step));
//p         	 drawText(1,(int)(d-x_off + textheight + 2), qs );
				}
        ++draw_lm_text;
        if(draw_lm_text >= draw_lm_text_cnt)
          draw_lm_text = 0;
        lm_text_cnt += 1;
        ++mc;
      }
      else if(draw_mm)
      {
				painter->drawLine(width(),(int)(d-x_off),width()-6,(int)(d-x_off));					
        draw_mm = false;
				if(draw_mm_text)
				{
					 qs.sprintf("%i",lm_text_cnt * lm_text_step -
                               lm_text_step/2);
//p         	 drawText(1,(int)(d-x_off + textheight + 2), qs );
				}
        ++mc;
      }
      else if(draw_sm)
      {
				painter->drawLine(width(),(int)(d-x_off),width()-3,(int)(d-x_off));					
        draw_sm = false;
        ++mc;
      }
    }
  }
}