[prev in list] [next in list] [prev in thread] [next in thread]
List: koffice-devel
Subject: Re: Bug fix patch for KPresenter (Text Object)
From: Toshitaka Fujioka <toshitaka () kde ! gr ! jp>
Date: 2001-06-21 12:51:29
[Download RAW message or body]
On Saturday 16 June 2001 23:42, Laurent Montel wrote:
> Le Samedi 16 Juin 2001 14:31, Toshitaka Fujioka a écrit :
> > Hello,
> >
> > This patch sets the color that user set with
> > "Configure KPresenter... -> Color".
> > (background color of text object in editing mode)
>
> Perhaps you can just store background color and not a pointer to
> KPresenterDoc.
Thank you for advice.
I remade patch. Works fine save and load of background color. But I use
pointer to KPresenterDoc.
If patch was wrong, please advice.
Thank you.
--
Toshitaka Fujioka
http://www.kde.org The K Desktop Environment Project
fujioka@kde.org
http://www.kde.gr.jp Japan KDE User's Group
toshitaka@kde.gr.jp
-- We offer the best Desktop Environment to you. (This is my goal. ;-)) --
["koffice-kpresenter-editting-text-object-background-color-20010621.diff" (text/plain)]
diff -ur koffice.orig/kpresenter/kpresenter_dlg_config.cc koffice/kpresenter/kpresenter_dlg_config.cc
--- koffice.orig/kpresenter/kpresenter_dlg_config.cc Thu Jun 21 21:09:40 2001
+++ koffice/kpresenter/kpresenter_dlg_config.cc Thu Jun 21 21:12:17 2001
@@ -82,14 +82,12 @@
lay1->setMargin( 20 );
lay1->setSpacing( 10 );
- int oldRastX = 10;
- int oldRastY = 10;
+ int oldRastX = m_pView->kPresenterDoc()->rastX();
+ int oldRastY = m_pView->kPresenterDoc()->rastY();
oldAutoSaveValue = m_pView->kPresenterDoc()->defaultAutoSave()/60;
if( config->hasGroup("Interface") ) {
config->setGroup( "Interface" );
- oldRastX = config->readNumEntry( "RastX", 10 );
- oldRastY = config->readNumEntry( "RastY", 10 );
oldAutoSaveValue = config->readNumEntry( "AutoSave", oldAutoSaveValue );
}
@@ -122,8 +120,6 @@
config->setGroup( "Interface" );
if( rastX != oldRastX || rastY != oldRastX ) {
- config->writeEntry( "RastX", rastX );
- config->writeEntry( "RastY", rastY );
doc->setRasters( rastX, rastY, true );
doc->repaint( false );
}
@@ -148,11 +144,7 @@
m_pView = _view;
config = KPresenterFactory::global()->config();
- oldBgColor = Qt::white;
- if( config->hasGroup( "KPresenter Color" ) ) {
- config->setGroup( "KPresenter Color" );
- oldBgColor = config->readColorEntry( "BackgroundColor", &oldBgColor );
- }
+ oldBgColor = m_pView->kPresenterDoc()->txtBackCol();
QVBoxLayout *box = new QVBoxLayout( this );
box->setMargin( 5 );
@@ -178,8 +170,6 @@
KPresenterDoc * doc = m_pView->kPresenterDoc();
if( oldBgColor != _col ) {
doc->setTxtBackCol( _col );
- config->setGroup( "KPresenter Color" );
- config->writeEntry( "BackgroundColor", _col );
doc->replaceObjs();
doc->repaint( false );
}
diff -ur koffice.orig/kpresenter/kpresenter_doc.cc koffice/kpresenter/kpresenter_doc.cc
--- koffice.orig/kpresenter/kpresenter_doc.cc Thu Jun 21 21:09:28 2001
+++ koffice/kpresenter/kpresenter_doc.cc Thu Jun 21 21:25:19 2001
@@ -2985,8 +2985,18 @@
objStartY = -1;
else
objStartY = getPageRect( _page - 1, 0, 0 ).y() + getPageRect( _page - 1, 0, 0 ).height();
+
+ QColor tmp_txtBackCol = _txtBackCol;
+ unsigned int tmp_RastX = _rastX;
+ unsigned int tmp_RastY = _rastY;
+
loadNativeFormat( fileName );
objStartY = 0;
+
+ _txtBackCol = tmp_txtBackCol;
+ _rastX = tmp_RastX;
+ _rastY = tmp_RastY;
+
_clean = true;
setModified(true);
KPBackGround *kpbackground = _backgroundList.at( _backgroundList.count() - 1 );
diff -ur koffice.orig/kpresenter/ktextedit.cc koffice/kpresenter/ktextedit.cc
--- koffice.orig/kpresenter/ktextedit.cc Thu Jun 21 21:09:29 2001
+++ koffice/kpresenter/ktextedit.cc Thu Jun 21 21:14:59 2001
@@ -65,6 +65,7 @@
doc( new KTextEditDocument( d, txtobj ) ), undoRedoInfo( doc )
{
init();
+ kp_doc = d;
}
KTextEdit::~KTextEdit()
@@ -166,7 +167,7 @@
QSize s( doc->firstParag()->rect().size() );
p->fillRect( 0, 0, width(), doc->y(),
- colorGroup().brush( QColorGroup::Base ) );
+ QBrush( getColorTextBack() ) );
if ( !doubleBuffer ) {
doubleBuffer = bufferPixmap( s );
@@ -207,7 +208,7 @@
painter.begin( doubleBuffer );
}
painter.fillRect( QRect( 0, 0, s.width(), s.height() ),
- colorGroup().brush( QColorGroup::Base ) );
+ QBrush( getColorTextBack() ) );
parag->paint( painter, colorGroup(), drawCur ? cursor : 0, TRUE );
@@ -215,7 +216,7 @@
if ( parag->rect().x() + parag->rect().width() < 0 + width() )
p->fillRect( parag->rect().x() + parag->rect().width(), parag->rect().y(),
( 0 + width() ) - ( parag->rect().x() + parag->rect().width() ),
- parag->rect().height(), colorGroup().brush( QColorGroup::Base ) );
+ parag->rect().height(), QBrush( getColorTextBack() ) );
parag = parag->next();
}
@@ -223,7 +224,7 @@
if ( parag->rect().y() + parag->rect().height() - 0 < height() )
p->fillRect( 0, parag->rect().y() + parag->rect().height(), width(),
height() - ( parag->rect().y() + parag->rect().height() ),
- colorGroup().brush( QColorGroup::Base ) );
+ QBrush( getColorTextBack() ) );
cursorVisible = TRUE;
}
@@ -599,7 +600,7 @@
if ( fill )
painter.fillRect( chr->x, y, cw, h,
- colorGroup().brush( QColorGroup::Base ) );
+ QBrush( getColorTextBack() ) );
if ( chr->c != '\t' )
painter.drawText( chr->x, y + bl, chr->c );
@@ -607,7 +608,11 @@
if ( visible ) {
int x = chr->x;
int w = 1;
- painter.fillRect( QRect( x, y, w, h ), red );
+ QColor color = getColorTextBack();
+ if ( color.red() > color.green() && color.red() > color.blue() )
+ painter.fillRect( QRect( x, y, w, h ), blue );
+ else
+ painter.fillRect( QRect( x, y, w, h ), red );
}
p.drawPixmap( cursor->parag()->rect().topLeft() + QPoint( chr->x, y ), *doubleBuffer,
@@ -1549,6 +1554,11 @@
}
}
return QWidget::event( e );
+}
+
+QColor KTextEdit::getColorTextBack()
+{
+ return kp_doc->txtBackCol();
}
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
diff -ur koffice.orig/kpresenter/ktextedit.h koffice/kpresenter/ktextedit.h
--- koffice.orig/kpresenter/ktextedit.h Thu Jun 21 21:09:29 2001
+++ koffice/kpresenter/ktextedit.h Thu Jun 21 21:15:43 2001
@@ -779,6 +779,7 @@
void doKeyboardAction( int action );
void checkUndoRedoInfo( UndoRedoInfo::Type t );
void repaintChanged();
+ QColor getColorTextBack();
private:
KTextEditDocument *doc;
@@ -801,6 +802,7 @@
bool readOnly, modified, mightStartDrag;
QPoint dragStartPos;
int mLines;
+ KPresenterDoc *kp_doc;
};
_______________________________________________
Koffice-devel mailing list
Koffice-devel@master.kde.org
http://master.kde.org/mailman/listinfo/koffice-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic