summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-reader/QTReader.cpp
Unidiff
Diffstat (limited to 'noncore/apps/opie-reader/QTReader.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-reader/QTReader.cpp540
1 files changed, 379 insertions, 161 deletions
diff --git a/noncore/apps/opie-reader/QTReader.cpp b/noncore/apps/opie-reader/QTReader.cpp
index 7cf08e5..3995ee7 100644
--- a/noncore/apps/opie-reader/QTReader.cpp
+++ b/noncore/apps/opie-reader/QTReader.cpp
@@ -24,2 +24,3 @@
24#include <qpe/qcopenvelope_qws.h> 24#include <qpe/qcopenvelope_qws.h>
25#include "StateData.h"
25 26
@@ -37,3 +38,3 @@ const char *QTReader::fonts[] = { "Helvetica", "Courier", "Times", 0 };
37 38
38QTReader::QTReader( QWidget *parent, const char *name, WFlags f) : 39QTReader::QTReader( QWidget *parent=0, const char *name=0, WFlags f = 0) :
39 QWidget(parent, name, f), 40 QWidget(parent, name, f),
@@ -50,3 +51,5 @@ QTReader::QTReader( QWidget *parent, const char *name, WFlags f) :
50 m_twotouch(true), 51 m_twotouch(true),
51 m_touchone(true) 52 m_touchone(true),
53 bDoUpdates(false),
54 m_navkeys(true)
52{ 55{
@@ -83,2 +86,3 @@ void QTReader::mousePressEvent( QMouseEvent* _e )
83{ 86{
87 buffdoc.unsuspend();
84 if (_e->button() == RightButton) 88 if (_e->button() == RightButton)
@@ -86,5 +90,36 @@ void QTReader::mousePressEvent( QMouseEvent* _e )
86 mouseUpOn = false; 90 mouseUpOn = false;
87 if (_e->y() > height()/2) 91 if (buffdoc.hasnavigation())
88 { 92 {
89 goDown(); 93 if (_e->y() > (2*height())/3)
94 {
95 goDown();
96 }
97 else if (_e->y() < height()/3)
98 {
99 goUp();
100 }
101 else
102 {
103 if (_e->x() < width()/3)
104 {
105 size_t target = pagelocate();
106 if (buffdoc.back(target))
107 {
108 locate(target);
109 }
110 }
111 else if (_e->x() > (2*width())/3)
112 {
113 size_t target = pagelocate();
114 if (buffdoc.forward(target))
115 {
116 locate(target);
117 }
118 }
119 else
120 {
121 buffdoc.saveposn(pagelocate());
122 locate(buffdoc.getHome());
123 }
124 }
90 } 125 }
@@ -92,3 +127,10 @@ void QTReader::mousePressEvent( QMouseEvent* _e )
92 { 127 {
93 goUp(); 128 if (_e->y() > height()/2)
129 {
130 goDown();
131 }
132 else
133 {
134 goUp();
135 }
94 } 136 }
@@ -97,3 +139,3 @@ void QTReader::mousePressEvent( QMouseEvent* _e )
97 139
98bool QTReader::getcurrentpos(int x, int y, size_t& start, size_t& offset, size_t& tgt) 140linkType QTReader::getcurrentpos(int x, int y, size_t& start, size_t& offset, size_t& tgt)
99{ 141{
@@ -114,6 +156,7 @@ bool QTReader::getcurrentpos(int x, int y, size_t& start, size_t& offset, size_t
114 CDrawBuffer* t = textarray[lineno]; 156 CDrawBuffer* t = textarray[lineno];
115 for (i = t->length(); t->width(i) > x; i--); 157 x = x - t->offset(width());
158 for (i = t->length(); i >= 0 && t->width(i) > x; i--);
116 offset = i; 159 offset = i;
117 } 160 }
118 return textarray[lineno]->isLink(offset, tgt); 161 return textarray[lineno]->getLinkType(offset, tgt);
119} 162}
@@ -126,4 +169,11 @@ void QTReader::setTwoTouch(bool _b)
126 169
170void QTReader::setContinuous(bool _b)
171{
172 buffdoc.unsuspend();
173 buffdoc.setContinuous(m_continuousDocument = _b);
174}
175
127void QTReader::mouseReleaseEvent( QMouseEvent* _e ) 176void QTReader::mouseReleaseEvent( QMouseEvent* _e )
128{ 177{
178 buffdoc.unsuspend();
129 if (_e->button() == LeftButton) 179 if (_e->button() == LeftButton)
@@ -143,14 +193,39 @@ void QTReader::mouseReleaseEvent( QMouseEvent* _e )
143 size_t startpos, startoffset, tgt; 193 size_t startpos, startoffset, tgt;
144 if (getcurrentpos(_e->x(), _e->y(), startpos, startoffset, tgt)) 194 switch (getcurrentpos(_e->x(), _e->y(), startpos, startoffset, tgt))
145 { 195 {
146 if (buffdoc.hyperlink(tgt)) 196 case eLink:
147 { 197 {
148 fillbuffer(); 198 size_t saveposn = pagelocate();
149 update(); 199 if (buffdoc.hyperlink(tgt))
200 {
201 buffdoc.saveposn(saveposn);
202 fillbuffer();
203 update();
204 }
205 else
206 {
207 locate(pagelocate());
208 }
209 return;
150 } 210 }
151 else 211 case ePicture:
152 { 212 {
153 locate(pagelocate()); 213 qDebug("Picture:%x", tgt);
214 QPixmap* pm = buffdoc.getPicture(tgt);
215 if (pm != NULL)
216 {
217 emit OnShowPicture(*pm);
218 delete pm;
219 }
220 else
221 {
222 locate(pagelocate());
223 }
224 return;
154 } 225 }
155 return; 226 case eNone:
227 break;
228 default:
229 qDebug("Unknown linktype");
230 return;
156 } 231 }
@@ -214,2 +289,3 @@ void QTReader::mouseReleaseEvent( QMouseEvent* _e )
214 int first = 0; 289 int first = 0;
290 int tgt = _e->x() - t->offset(width());
215 while (1) 291 while (1)
@@ -218,3 +294,3 @@ void QTReader::mouseReleaseEvent( QMouseEvent* _e )
218 while (QChar((*t)[i]).isLetter() && (*t)[i] != 0) i++; 294 while (QChar((*t)[i]).isLetter() && (*t)[i] != 0) i++;
219 if (t->width(i) > _e->x()) 295 if (t->width(i) > tgt)
220 { 296 {
@@ -284,4 +360,73 @@ void QTReader::goUp()
284 360
361void QTReader::NavUp()
362{
363 buffdoc.unsuspend();
364 if (buffdoc.hasnavigation())
365 {
366/*
367 size_t target = pagelocate();
368 if (buffdoc.back(target))
369 {
370 locate(target);
371 }
372*/
373 locate(buffdoc.startSection());
374 }
375 else
376 {
377 goUp();
378 }
379}
380
381void QTReader::NavDown()
382{
383 buffdoc.unsuspend();
384 if (buffdoc.hasnavigation())
385 {
386/*
387 size_t target = pagelocate();
388 if (buffdoc.forward(target))
389 {
390 locate(target);
391 }
392*/
393 dopageup(buffdoc.endSection());
394 }
395 else
396 {
397 goDown();
398 }
399}
400
401void QTReader::zoomin()
402{
403 if (m_fontControl.increasesize())
404 {
405 bool sc = m_autoScroll;
406 setfont();
407 m_autoScroll = false;
408 locate(pagelocate());
409 update();
410 m_autoScroll = sc;
411 if (m_autoScroll) autoscroll();
412 }
413}
414
415void QTReader::zoomout()
416{
417 if (m_fontControl.decreasesize())
418 {
419 bool sc = m_autoScroll;
420 m_autoScroll = false;
421 setfont();
422 locate(pagelocate());
423 update();
424 m_autoScroll = sc;
425 if (m_autoScroll) autoscroll();
426 }
427}
428
285void QTReader::keyPressEvent(QKeyEvent* e) 429void QTReader::keyPressEvent(QKeyEvent* e)
286{ 430{
431 buffdoc.unsuspend();
287 switch (e->key()) 432 switch (e->key())
@@ -359,32 +504,30 @@ void QTReader::keyPressEvent(QKeyEvent* e)
359 */ 504 */
360 case Key_Right: 505 case Key_Right:
361 { 506 {
362 e->accept(); 507 e->accept();
363 if (m_fontControl.increasesize()) 508 if (m_navkeys && buffdoc.hasnavigation())
364 { 509 {
365 bool sc = m_autoScroll; 510 size_t target = pagelocate();
366 setfont(); 511 if (buffdoc.forward(target))
367 m_autoScroll = false; 512 {
368 locate(pagelocate()); 513 locate(target);
369 update(); 514 }
370 m_autoScroll = sc; 515 }
371 if (m_autoScroll) autoscroll(); 516 else zoomin();
372 }
373 } 517 }
374 break; 518 break;
375 case Key_Left: 519 case Key_Left:
376 { 520 {
377 e->accept(); 521 e->accept();
378 if (m_fontControl.decreasesize()) 522 if (m_navkeys && buffdoc.hasnavigation())
379 { 523 {
380 bool sc = m_autoScroll; 524 size_t target = pagelocate();
381 m_autoScroll = false; 525 if (buffdoc.back(target))
382 setfont(); 526 {
383 locate(pagelocate()); 527 locate(target);
384 update(); 528 }
385 m_autoScroll = sc; 529 }
386 if (m_autoScroll) autoscroll(); 530 else zoomout();
387 }
388 } 531 }
389 break; 532 break;
390 case Key_Space: 533 case Key_Space:
@@ -411,2 +554,4 @@ void QTReader::setautoscroll(bool _sc)
411 { 554 {
555 CDrawBuffer* reusebuffer = textarray[numlines];
556 if (reusebuffer == NULL || reusebuffer->eof()) return;
412 m_autoScroll = true; 557 m_autoScroll = true;
@@ -419,2 +564,3 @@ bool QTReader::getline(CDrawBuffer *buff)
419{ 564{
565 buffdoc.unsuspend();
420 if (m_bMonoSpaced) 566 if (m_bMonoSpaced)
@@ -461,3 +607,3 @@ void QTReader::doscroll()
461 { 607 {
462 textarray[numlines] = new CDrawBuffer; 608 textarray[numlines] = new CDrawBuffer(&m_fontControl);
463 } 609 }
@@ -465,3 +611,3 @@ void QTReader::doscroll()
465 int ch = getline(textarray[numlines]); 611 int ch = getline(textarray[numlines]);
466 textarray[numlines-1]->render(&p, height() - textarray[numlines]->descent() - 2, m_bMonoSpaced, m_charWidth, width()); 612 textarray[numlines-1]->render(&p, height() - textarray[numlines-1]->descent() - 2, m_bMonoSpaced, m_charWidth, width());
467 mylastpos = locate(); 613 mylastpos = locate();
@@ -471,3 +617,2 @@ void QTReader::doscroll()
471 ((QTReaderApp*)parent()->parent())->setScrollState(m_autoScroll); 617 ((QTReaderApp*)parent()->parent())->setScrollState(m_autoScroll);
472 emit OnRedraw();
473 } 618 }
@@ -494,74 +639,66 @@ void QTReader::drawFonts( QPainter *p )
494{ 639{
495 setfont(); 640 if (bDoUpdates)
496 if (m_lastwidth != width() || m_lastheight != height()) 641 {
497 { 642 qDebug("How refreshing...");
498 m_lastwidth = width(); 643 if (buffdoc.empty()) return;
499 m_lastheight = height(); 644 setfont();
500 locate(pagelocate()); 645 if (m_lastwidth != width())
501 } 646 {
502 else 647 qDebug("Not Optimised %d", m_lastwidth);
503 { 648 m_lastwidth = width();
504 649 m_lastheight = height();
505/* 650 locate(pagelocate());
506 int sl = screenlines(); 651 qDebug("Not Optimised %d", m_lastwidth);
507 if (sl < numlines) 652 }
508 { 653 else
509 //qDebug("df:<%u,%u>",sl,numlines); 654 {
510 655 if (m_lastheight > height())
511 size_t newpos = locnarray[sl]; 656 {
512 CDrawBuffer** nta = new CDrawBuffer*[sl]; 657 qDebug("Optimised < %d", numlines);
513 size_t* nla = new size_t[sl]; 658 int ypos = 0;
514 for (int i = 0; i < sl; i++) 659 for (int i = 0; i < numlines; i++)
515 { 660 {
516 nta[i] = textarray[i]; 661 if ((ypos += textarray[i]->lineSpacing()) > height())
517 nla[i] = locnarray[i]; 662 {
518 } 663 numlines = i;
519 for (int i = sl; i < numlines; i++) delete textarray[i]; 664 jumpto(locnarray[i+1]);
520 delete [] locnarray; 665 break;
521 delete [] textarray; 666 }
522 textarray = nta; 667 }
523 locnarray = nla; 668 qDebug("Optimised < %d", numlines);
524 numlines = sl; 669 m_lastheight = height();
525 jumpto(mylastpos = newpos); 670 }
526 } 671 else if (m_lastheight < height())
527 if (sl > numlines) 672 {
528 { 673 qDebug("Optimised > %d", numlines);
529 //qDebug("df:<%u,%u>",sl,numlines); 674 int ypos = 0;
530 CDrawBuffer** nta = new CDrawBuffer*[sl]; 675 for (int i = 0; i <= numlines; i++)
531 size_t* nla = new size_t[sl]; 676 {
532 for (int i = 0; i < numlines; i++) 677 ypos += textarray[i]->lineSpacing();
533 { 678 }
534 nta[i] = textarray[i]; 679 fillbuffer(numlines+1, ypos);
535 nla[i] = locnarray[i]; 680 qDebug("Optimised > %d", numlines);
536 } 681 m_lastheight = height();
537 if (locate() != mylastpos) jumpto(mylastpos); 682 }
538 for (int i = numlines; i < sl; i++) 683 if (numlines > 0)
539 { 684 {
540 nta[i] = new CDrawBuffer(&m_fontControl); 685 int ypos = textarray[0]->ascent();
541 nla[i] = locate(); 686 textarray[0]->render( p, ypos, m_bMonoSpaced, m_charWidth, width());
542 getline(nta[i]); 687 for (int i = 1; i < numlines; i++)
543 } 688 {
544 mylastpos = locate(); 689 // ypos += (textarray[i-1]->lineSpacing() + textarray[i]->lineSpacing())/2;
545 delete [] locnarray; 690 ypos += (textarray[i-1]->descent() + textarray[i]->ascent())+
546 delete [] textarray; 691 (textarray[i-1]->lineExtraSpacing() + textarray[i]->lineExtraSpacing())/2;
547 textarray = nta; 692 textarray[i]->render( p, ypos, m_bMonoSpaced, m_charWidth, width());
548 locnarray = nla; 693 }
549 numlines = sl;
550 }
551*/
552 if (numlines > 0)
553 {
554 int ypos = textarray[0]->ascent();
555 textarray[0]->render( p, ypos, m_bMonoSpaced, m_charWidth, width());
556 for (int i = 1; i < numlines; i++)
557 {
558 ypos += (textarray[i-1]->lineSpacing() + textarray[i]->lineSpacing())/2;
559 textarray[i]->render( p, ypos, m_bMonoSpaced, m_charWidth, width());
560
561 }
562// mylastpos = locate(); 694// mylastpos = locate();
563 } 695 }
564 } 696 }
565 m_scrolldy1 = m_scrolldy2 = 0; 697 m_scrolldy1 = m_scrolldy2 = 0;
566 emit OnRedraw(); 698 emit OnRedraw();
699 }
700 else
701 {
702 qDebug("Not so refreshing...");
703 }
567} 704}
@@ -609,2 +746,3 @@ void QTReader::init()
609 746
747 buffdoc.unsuspend();
610 setBackgroundColor( white ); 748 setBackgroundColor( white );
@@ -620,5 +758,4 @@ void QTReader::init()
620// QMessageBox::information(this, "init", m_lastfile, 1); 758// QMessageBox::information(this, "init", m_lastfile, 1);
621 m_lastwidth = width();
622 m_lastheight = height();
623 setfont(); 759 setfont();
760/*
624 if (!m_lastfile.isEmpty()) 761 if (!m_lastfile.isEmpty())
@@ -628,2 +765,3 @@ void QTReader::init()
628 } 765 }
766*/
629} 767}
@@ -703,2 +841,3 @@ bool QTReader::locate(unsigned long n) {
703 //printf("Locate\n"); 841 //printf("Locate\n");
842 buffdoc.unsuspend();
704 buffdoc.locate(n); 843 buffdoc.locate(n);
@@ -721,2 +860,3 @@ bool QTReader::fillbuffer(int reuse, int ht)
721{ 860{
861 buffdoc.unsuspend();
722 if (buffdoc.empty()) return false; 862 if (buffdoc.empty()) return false;
@@ -728,3 +868,3 @@ bool QTReader::fillbuffer(int reuse, int ht)
728 numlines = reuse; 868 numlines = reuse;
729 while (ypos < height()) 869 while (ypos < height() || numlines < 2)
730 { 870 {
@@ -740,3 +880,3 @@ bool QTReader::fillbuffer(int reuse, int ht)
740 { 880 {
741 if (numlines - reuse == 1/* && locnarray[0] == buffdoc.locate()*/) 881 if (numlines - reuse == 1 /*&& locnarray[numlines] == buffdoc.locate()*/)
742 { 882 {
@@ -763,2 +903,3 @@ void QTReader::dopagedn()
763{ 903{
904 buffdoc.unsuspend();
764 int skip = 0, ypos = 0; 905 int skip = 0, ypos = 0;
@@ -770,2 +911,3 @@ void QTReader::dopagedn()
770 CDrawBuffer* reusebuffer = textarray[numlines]; 911 CDrawBuffer* reusebuffer = textarray[numlines];
912 if (reusebuffer != NULL && reusebuffer->eof()) return;
771 if (reusebuffer != NULL) 913 if (reusebuffer != NULL)
@@ -779,2 +921,3 @@ void QTReader::dopagedn()
779 textarray[i] = reusebuffer; 921 textarray[i] = reusebuffer;
922 // reusebuffer->empty();
780 locnarray[offset] = locnarray[i]; 923 locnarray[offset] = locnarray[i];
@@ -793,46 +936,69 @@ void QTReader::dopageup()
793{ 936{
937 buffdoc.unsuspend();
938 dopageup(locnarray[(m_overlap < numlines) ? m_overlap : numlines/2]);
939}
940
941void QTReader::dopageup(unsigned int target)
942{
943 buffdoc.unsuspend();
794 CBufferFace<CDrawBuffer*> buff; 944 CBufferFace<CDrawBuffer*> buff;
795 CBufferFace<size_t> loc; 945 CBufferFace<size_t> loc;
796 unsigned int target = locnarray[(m_overlap < numlines) ? m_overlap : numlines/2];
797 946
798 size_t delta; 947 size_t delta, guess = 2048;
799 if (target < 2048) 948 bool ch = true;
800 { 949 int nbfl, ypos = 0;
801 delta = target;
802 jumpto(0);
803 }
804 else
805 {
806 delta = 2048;
807 950
808 jumpto(target - delta); 951 while (1)
809 952 {
810 buff[0] = new CDrawBuffer(&m_fontControl); 953 ch = true;
811 954 nbfl = 0;
812 do 955 if (target < guess)
956 {
957 delta = 0; // 0 is a flag to say don't guess any more
958 jumpto( (m_continuousDocument) ? 0 : buffdoc.startSection() );
959 }
960 else if (!m_continuousDocument && (target - guess < buffdoc.startSection()))
961 {
962 delta = 0; // 0 is a flag to say don't guess any more
963 jumpto(buffdoc.startSection());
964 }
965 else
813 { 966 {
967 delta = guess;
814 968
815 if (!getline(buff[0])) break; 969 jumpto(target - delta);
816 970
817 if (locate() > target) continue; 971 buff[0] = new CDrawBuffer(&m_fontControl);
972
973 do
974 {
975
976 if (!getline(buff[0])) break;
977
978 if (locate() > target) break;
979 }
980 while (!buffdoc.iseol());
818 } 981 }
819 while (!buffdoc.iseol()); 982
820 } 983 ypos = 0;
821 int nbfl = 0; 984 while (locate() < target)
822 985 {
823 bool ch = true; 986 if (buff[nbfl] == NULL) buff[nbfl] = new CDrawBuffer(&m_fontControl);
824 int ypos = 0; 987 loc[nbfl] = locate();
825 while (locate() < target) 988 ch = getline(buff[nbfl]);
826 { 989 ypos += buff[nbfl]->lineSpacing();
827 if (buff[nbfl] == NULL) buff[nbfl] = new CDrawBuffer(&m_fontControl); 990 nbfl++;
828 loc[nbfl] = locate(); 991 if (!ch) break;
829 ch = getline(buff[nbfl]); 992 }
830 ypos += buff[nbfl]->lineSpacing(); 993 if (ypos < height() && (delta != 0))
831 nbfl++; 994 {
832 if (!ch) break; 995 for (int i = 0; i < nbfl; i++)
833 } 996 {
834 if (ypos < height()) 997 delete buff[i];
835 { 998 buff[i] = NULL;
836 locate(0); 999 }
837 return; 1000 guess <<= 1;
1001 continue;
1002 }
1003 break;
838 } 1004 }
@@ -847,5 +1013,5 @@ void QTReader::dopageup()
847 numlines = 0; 1013 numlines = 0;
848 while (ypos < height() && numlines <= nbfl-2) 1014 while (ypos < height() && numlines <= nbfl-1)
849 { 1015 {
850 ypos += buff[nbfl - numlines - 2]->lineSpacing(); 1016 ypos += buff[nbfl - numlines - 1]->lineSpacing();
851 numlines++; 1017 numlines++;
@@ -853,4 +1019,5 @@ void QTReader::dopageup()
853 --numlines; 1019 --numlines;
854 int offset = nbfl; 1020 int offset = nbfl-1;
855 offset -= numlines+1; 1021 offset -= numlines;
1022 ypos = 0;
856 for (int i = 0; i <= numlines; i++) 1023 for (int i = 0; i <= numlines; i++)
@@ -860,2 +1027,3 @@ void QTReader::dopageup()
860 locnarray[i] = loc[offset + i]; 1027 locnarray[i] = loc[offset + i];
1028 ypos += textarray[i]->lineSpacing();
861 } 1029 }
@@ -866,3 +1034,11 @@ void QTReader::dopageup()
866 1034
867// --numlines; 1035 while (ypos < height())
1036 {
1037 numlines++;
1038 locnarray[numlines] = locate();
1039 if (textarray[numlines] == NULL) textarray[numlines] = new CDrawBuffer(&m_fontControl);
1040 if (!getline(textarray[numlines])) break;
1041 ypos += textarray[numlines]->lineSpacing();
1042 }
1043
868 mylastpos = locate(); 1044 mylastpos = locate();
@@ -885,2 +1061,4 @@ bool QTReader::load_file(const char *newfile, unsigned int _lcn)
885 // QMessageBox::information(0, "Opening...", newfile); 1061 // QMessageBox::information(0, "Opening...", newfile);
1062 m_lastwidth = width();
1063 m_lastheight = height();
886 if (buffdoc.openfile(this,newfile) == 0) 1064 if (buffdoc.openfile(this,newfile) == 0)
@@ -888,2 +1066,3 @@ bool QTReader::load_file(const char *newfile, unsigned int _lcn)
888 bRC = true; 1066 bRC = true;
1067 buffdoc.setContinuous(m_continuousDocument);
889 // qDebug("buffdoc.openfile done"); 1068 // qDebug("buffdoc.openfile done");
@@ -1014,2 +1193,3 @@ void QTReader::lineUp()
1014{ 1193{
1194 buffdoc.unsuspend();
1015 CDrawBuffer* buff = textarray[numlines]; 1195 CDrawBuffer* buff = textarray[numlines];
@@ -1021,2 +1201,3 @@ void QTReader::lineUp()
1021 if (target == 0) return; 1201 if (target == 0) return;
1202 if (!m_continuousDocument && (target == buffdoc.startSection())) return;
1022 if (buffdoc.hasrandomaccess()) 1203 if (buffdoc.hasrandomaccess())
@@ -1036,2 +1217,10 @@ void QTReader::lineUp()
1036 } 1217 }
1218 else if (!m_continuousDocument && (target - delta < buffdoc.startSection()))
1219 {
1220 delta = target-buffdoc.startSection();
1221 jumpto(buffdoc.startSection());
1222 loc = locate();
1223 getline(buff);
1224 break;
1225 }
1037 jumpto(target-delta); 1226 jumpto(target-delta);
@@ -1109 +1298,30 @@ MarkupType QTReader::PreferredMarkup()
1109} 1298}
1299
1300void QTReader::setstate(const statedata& sd)
1301{
1302 bstripcr = sd.bstripcr;
1303 btextfmt = sd.btextfmt;
1304 bautofmt = sd.bautofmt;
1305 bstriphtml = sd.bstriphtml;
1306 bpeanut = sd.bpeanut;
1307 bdehyphen = sd.bdehyphen;
1308 bonespace = sd.bonespace;
1309 bunindent = sd.bunindent;
1310 brepara = sd.brepara;
1311 bdblspce = sd.bdblspce;
1312 m_bpagemode = sd.m_bpagemode;
1313 m_navkeys = sd.m_navkeys;
1314 m_bMonoSpaced = sd.m_bMonoSpaced;
1315 bremap = sd.bremap;
1316 bmakebold = sd.bmakebold;
1317 m_continuousDocument = sd.Continuous;
1318#ifdef REPALM
1319 brepalm = sd.brepalm;
1320#endif
1321 bindenter = sd.bindenter;
1322 m_encd = sd.m_charpc;
1323 m_fontname = sd.m_fontname;
1324 setContinuous(sd.Continuous);
1325 ChangeFont(sd.m_textsize);
1326 refresh();
1327}