author | harlekin <harlekin> | 2002-08-01 00:47:09 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-08-01 00:47:09 (UTC) |
commit | ba034bf4cb91b83654056945fc27313a28528015 (patch) (side-by-side diff) | |
tree | 4df33783ca21017424135aacc2e45b94437cfdff /noncore/apps/opie-sheet/cellformat.cpp | |
parent | 26ff0c72228b9c89b079dfa381d448b6152eb408 (diff) | |
download | opie-ba034bf4cb91b83654056945fc27313a28528015.zip opie-ba034bf4cb91b83654056945fc27313a28528015.tar.gz opie-ba034bf4cb91b83654056945fc27313a28528015.tar.bz2 |
gcc3.x fixes
Diffstat (limited to 'noncore/apps/opie-sheet/cellformat.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-sheet/cellformat.cpp | 47 |
1 files changed, 37 insertions, 10 deletions
diff --git a/noncore/apps/opie-sheet/cellformat.cpp b/noncore/apps/opie-sheet/cellformat.cpp index 597502c..342ebe9 100644 --- a/noncore/apps/opie-sheet/cellformat.cpp +++ b/noncore/apps/opie-sheet/cellformat.cpp @@ -12,67 +12,92 @@ * by Serdar Ozler <sozler@sitebest.com> */ #include "cellformat.h" #include <qlistbox.h> #include <qlabel.h> #define COMBO_WIDTHS 155 #define COMBO_HEIGHTS 21 #define COLOR_COUNT 17 #define STYLE_COUNT 14 #define HALIGN_COUNT 3 #define VALIGN_COUNT 3 -QColor qtColors[COLOR_COUNT]={Qt::black, Qt::white, Qt::darkGray, Qt::gray, Qt::lightGray, Qt::red, Qt::green, Qt::blue, Qt::cyan, Qt::magenta, Qt::yellow, Qt::darkRed, Qt::darkGreen, Qt::darkBlue, Qt::darkCyan, Qt::darkMagenta, Qt::darkYellow}; -Qt::BrushStyle brushStyles[STYLE_COUNT]={Qt::SolidPattern, Qt::Dense1Pattern, Qt::Dense2Pattern, Qt::Dense3Pattern, Qt::Dense4Pattern, Qt::Dense5Pattern, Qt::Dense6Pattern, Qt::Dense7Pattern, Qt::HorPattern, Qt::VerPattern, Qt::CrossPattern, Qt::BDiagPattern, Qt::FDiagPattern, Qt::DiagCrossPattern}; +QColor qtColors[COLOR_COUNT]={Qt::black,Qt::white, Qt::darkGray, + Qt::gray, Qt::lightGray, Qt::red, + Qt::green, Qt::blue, Qt::cyan, + Qt::magenta, Qt::yellow, + Qt::darkRed, Qt::darkGreen, + Qt::darkBlue, Qt::darkCyan, + Qt::darkMagenta, Qt::darkYellow}; + +Qt::BrushStyle brushStyles[STYLE_COUNT]={Qt::SolidPattern, + Qt::Dense1Pattern, Qt::Dense2Pattern, + Qt::Dense3Pattern, Qt::Dense4Pattern, + Qt::Dense5Pattern, Qt::Dense6Pattern, + Qt::Dense7Pattern, Qt::HorPattern, + Qt::VerPattern, Qt::CrossPattern, + Qt::BDiagPattern, Qt::FDiagPattern, + Qt::DiagCrossPattern}; + QString namesHAlign[HALIGN_COUNT]={"Left", "Right", "Center"}; QString namesVAlign[VALIGN_COUNT]={"Top", "Bottom", "Center"}; -Qt::AlignmentFlags flagsHAlign[HALIGN_COUNT]={Qt::AlignLeft, Qt::AlignRight, Qt::AlignHCenter}; -Qt::AlignmentFlags flagsVAlign[VALIGN_COUNT]={Qt::AlignTop, Qt::AlignBottom, Qt::AlignVCenter}; -CellFormat::CellFormat(QWidget *parent=0) +Qt::AlignmentFlags flagsHAlign[HALIGN_COUNT]={Qt::AlignLeft, + Qt::AlignRight, + Qt::AlignHCenter}; + +Qt::AlignmentFlags flagsVAlign[VALIGN_COUNT]={Qt::AlignTop, + Qt::AlignBottom, + Qt::AlignVCenter}; + +CellFormat::CellFormat(QWidget *parent) :QDialog(parent, 0, TRUE) { // Main widget tabs=new QTabWidget(this); widgetBorders=new QWidget(tabs); widgetBackground=new QWidget(tabs); widgetFont=new QWidget(tabs); widgetAlignment=new QWidget(tabs); tabs->addTab(widgetBorders, tr("&Borders")); tabs->addTab(widgetBackground, tr("Back&ground")); tabs->addTab(widgetFont, tr("&Font")); tabs->addTab(widgetAlignment, tr("&Alignment")); fontDB.loadRenderers(); changedFont=changedAlign=changedBrush=FALSE; // Borders tab borderEditor=new BorderEditor(widgetBorders); borderEditor->setGeometry(10, 10, 215, 145); - connect(borderEditor, SIGNAL(clicked(BorderEditor::BorderArea)), this, SLOT(borderClicked(BorderEditor::BorderArea))); + connect(borderEditor, SIGNAL(clicked(BorderEditor::BorderArea)), + this, SLOT(borderClicked(BorderEditor::BorderArea))); comboBordersWidth=createCombo(COMBO_WIDTH, widgetBorders, tr("&Width:"), 165); comboBordersColor=createCombo(COMBO_COLOR, widgetBorders, tr("&Color:"), 165+(COMBO_HEIGHTS+10)); buttonBordersDefaults=new QPushButton(tr("&Default Borders"), widgetBorders); - buttonBordersDefaults->setGeometry(115, 165+2*(COMBO_HEIGHTS+10), 110, COMBO_HEIGHTS); - connect(buttonBordersDefaults, SIGNAL(clicked()), this, SLOT(slotBordersDefaults())); + buttonBordersDefaults->setGeometry(115, 165+2*(COMBO_HEIGHTS+10), + 110, COMBO_HEIGHTS); + + connect(buttonBordersDefaults, SIGNAL(clicked()), + this, SLOT(slotBordersDefaults())); // Background tab frameBackground=new QFrame(widgetBackground); frameBackground->setGeometry(10, 10, 215, 145); frameBackground->setFrameStyle(QFrame::StyledPanel | QFrame::Sunken); comboBackgroundStyle=createCombo(COMBO_STYLE, widgetBackground, tr("&Style:"), 165); connect(comboBackgroundStyle, SIGNAL(activated(int)), this, SLOT(backgroundClicked(int))); comboBackgroundColor=createCombo(COMBO_COLOR, widgetBackground, tr("&Color:"), 165+(COMBO_HEIGHTS+10)); connect(comboBackgroundColor, SIGNAL(activated(int)), this, SLOT(backgroundClicked(int))); buttonBackgroundDefaults=new QPushButton(tr("&Default Background"), widgetBackground); buttonBackgroundDefaults->setGeometry(115, 165+2*(COMBO_HEIGHTS+10), 110, COMBO_HEIGHTS); connect(buttonBackgroundDefaults, SIGNAL(clicked()), this, SLOT(slotBackgroundDefaults())); // Font tab @@ -279,47 +304,49 @@ void CellFormat::borderClicked(BorderEditor::BorderArea area) { QPen newPen(qtColors[comboBordersColor->currentItem()], comboBordersWidth->currentItem()+1, Qt::SolidLine); if (newPen==borderEditor->getPen(area)) borderEditor->setPen(QPen(Qt::gray, 1, Qt::NoPen), area); else borderEditor->setPen(newPen, area); } int CellFormat::findComboItemIndex(QComboBox *combo, const QString &item) { for (int i=0; i<combo->count(); ++i) if (combo->text(i)==item) return i; return 0; } -QComboBox *CellFormat::createCombo(comboType type, QWidget *parent, const QString &caption, int y) +QComboBox *CellFormat::createCombo(comboType type, QWidget *parent, + const QString &caption, int y) { QComboBox *combo=new QComboBox(FALSE, parent); combo->setGeometry(70, y, COMBO_WIDTHS, COMBO_HEIGHTS); combo->setSizeLimit(5); switch (type) { case COMBO_WIDTH: createWidthCombo(combo); break; case COMBO_STYLE: createStyleCombo(combo); break; case COMBO_FONT: createFontCombo(combo); break; case COMBO_SIZE: createSizeCombo(combo); break; case COMBO_COLOR: createColorCombo(combo); break; case COMBO_HALIGN: createHAlignCombo(combo); break; case COMBO_VALIGN: createVAlignCombo(combo); break; + default: break; } QLabel *label=new QLabel(combo, caption, parent); label->setGeometry(10, y, 50, COMBO_HEIGHTS); return combo; } void CellFormat::createHAlignCombo(QComboBox *combo) { for (int i=0; i<HALIGN_COUNT; ++i) combo->insertItem(namesHAlign[i]); } void CellFormat::createVAlignCombo(QComboBox *combo) { @@ -482,33 +509,33 @@ int CellFormat::exec(Sheet *s) if (changedFont) { for (row=row1; row<=row2; ++row) for (col=col1; col<=col2; ++col) sheet->setTextFont(row, col, fontFont, fontColor); } return QDialog::Accepted; } return QDialog::Rejected; } // // Border Editor // -BorderEditor::BorderEditor(QWidget *parent=0) +BorderEditor::BorderEditor(QWidget *parent) :QFrame(parent) { setFrameStyle(QFrame::StyledPanel | QFrame::Sunken); } BorderEditor::~BorderEditor() { } void BorderEditor::drawContents(QPainter *p) { QFrame::drawContents(p); int x=contentsRect().x(), y=contentsRect().y(), width=contentsRect().width()/3, height=contentsRect().height()/3; int lineFirstX=x+width/6, lineFirstY=y+height/6, lineLastX=contentsRect().right()-width/6, lineLastY=contentsRect().bottom()-height/6; |