~ubuntu-branches/ubuntu/breezy/koffice/breezy

« back to all changes in this revision

Viewing changes to kivio/kiviopart/kivio_lineendsaction.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Ben Burton
  • Date: 2004-05-09 11:33:00 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20040509113300-vfrdadqsvjfuhn3b
Tags: 1:1.3.1-1
* New upstream bugfix release.
* Built against newer imagemagick (closes: #246623).
* Made koffice-libs/kformula recommend/depend on latex-xft-fonts, which
  provides mathematical fonts that the formula editor can use.  Also
  patched the kformula part to make these fonts the default.
* Changed kword menu hint from "WordProcessors" to "Word processors"
  (closes: #246209).
* Spellchecker configuration is now fixed (closes: #221256, #227568).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Kivio - Visual Modelling and Flowcharting
3
 
 * Copyright (C) 2000-2001 theKompany.com & Dave Marotti
4
 
 *
5
 
 * This program is free software; you can redistribute it and/or
6
 
 * modify it under the terms of the GNU General Public License
7
 
 * as published by the Free Software Foundation; either version 2
8
 
 * of the License, or (at your option) any later version.
9
 
 *
10
 
 * This program is distributed in the hope that it will be useful,
11
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 
 * GNU General Public License for more details.
14
 
 *
15
 
 * You should have received a copy of the GNU General Public License
16
 
 * along with this program; if not, write to the Free Software
17
 
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
18
 
 */
19
 
#include "kivio_lineendsaction.h"
20
 
#include "kivio_lineendspix.h"
21
 
#include "tkcombobox.h"
22
 
 
23
 
#include <qbitmap.h>
24
 
#include <qpixmap.h>
25
 
#include <qpainter.h>
26
 
 
27
 
LineEndsAction::LineEndsAction( bool isRightEnds, QObject* parent, const char* name )
28
 
: TKBaseSelectAction(parent,name)
29
 
{
30
 
  m_rightends = isRightEnds;
31
 
}
32
 
 
33
 
LineEndsAction::~LineEndsAction()
34
 
{
35
 
}
36
 
 
37
 
void LineEndsAction::initComboBox(TKComboBox* combo)
38
 
{
39
 
  TKBaseSelectAction::initComboBox(combo);
40
 
 
41
 
  int cindex = 0;
42
 
 
43
 
  int tw = combo->fontMetrics().width(" 99:");
44
 
 
45
 
  QBitmap mask;
46
 
  QPixmap pixAll(lineedns);
47
 
  if (!m_rightends) {
48
 
    QPixmap tpix(pixAll.width(),pixAll.height());
49
 
    QPainter tp(&tpix);
50
 
    tp.scale(-1,1);
51
 
    tp.drawPixmap(-pixAll.width()+1,0,pixAll);
52
 
    tp.end();
53
 
    pixAll = tpix;
54
 
  }
55
 
 
56
 
  QPixmap pix(pixAll.width()+tw+3,17);
57
 
  QPainter p(&pix,combo);
58
 
 
59
 
  // insert item "0: None"
60
 
  pix.fill(white);
61
 
  p.drawText(0,0,tw,pix.height(),AlignRight|AlignVCenter,QString("%1:").arg(cindex));
62
 
  p.drawText(tw+3,0,pix.width()-tw-3,pix.height(),AlignLeft|AlignVCenter,"None");
63
 
  mask = pix;
64
 
  pix.setMask(mask);
65
 
  combo->insertItem(pix,cindex++);
66
 
 
67
 
  for (int y=0; y<pixAll.height(); y+= 17 ) {
68
 
    pix.fill(white);
69
 
    p.drawText(0,0,tw,pix.height(),AlignRight|AlignVCenter,QString("%1:").arg(cindex));
70
 
    p.drawPixmap(tw+3,0,pixAll,0,y,pix.width(),pix.height());
71
 
 
72
 
    mask = pix;
73
 
    pix.setMask(mask);
74
 
    combo->insertItem(pix,cindex++);
75
 
  }
76
 
  p.end();
77
 
 
78
 
}
79
 
#include "kivio_lineendsaction.moc"