# HG changeset patch
# User insilmaril
# Date 1158233898 0
# Node ID 3a58c9ef4a18c71513d35abdb99711661f1a6035
# Parent a40af6315ac6cc5ee05ec8118be4b6167883f23a
1.8.57 - more changes in history window, Note Editor is QT4 now
diff -r a40af6315ac6 -r 3a58c9ef4a18 demos/todo.vym
Binary file demos/todo.vym has changed
diff -r a40af6315ac6 -r 3a58c9ef4a18 historywindow.cpp
--- a/historywindow.cpp Thu Sep 14 11:38:17 2006 +0000
+++ b/historywindow.cpp Thu Sep 14 11:38:18 2006 +0000
@@ -10,13 +10,13 @@
QTableWidgetItem *item;
- item= new QTableWidgetItem(tr("Action"));
+ item= new QTableWidgetItem(tr("Action","Table with actions"));
ui.historyTable->setHorizontalHeaderItem(0, item);
- item= new QTableWidgetItem(tr("Comment"));
+ item= new QTableWidgetItem(tr("Comment","Table with actions"));
ui.historyTable->setHorizontalHeaderItem(1, item);
- item= new QTableWidgetItem(tr("Undo action"));
+ item= new QTableWidgetItem(tr("Undo action","Table with actions"));
ui.historyTable->setHorizontalHeaderItem(2, item);
ui.historyTable->setSelectionBehavior (QAbstractItemView::SelectRows);
@@ -27,6 +27,17 @@
}
+void HistoryWindow::clearRow(int row)
+{
+ QTableWidgetItem *it;
+ it=ui.historyTable->item (row,0);
+ if (it) it->setText ("");
+ it=ui.historyTable->item (row,1);
+ if (it) it->setText ("");
+ it=ui.historyTable->item (row,2);
+ if (it) it->setText ("");
+}
+
void HistoryWindow::updateRow(int row, int step, SimpleSettings &set)
{
QTableWidgetItem *item;
@@ -63,7 +74,7 @@
else
ui.redoButton->setEnabled (true);
- // Update table
+ // Update undos in table
for (i=undosAvail; i>0; i--)
{
updateRow (r,s,set);
@@ -83,20 +94,24 @@
ui.historyTable->setItem(undosAvail, i, item);
}
}
- item=new QTableWidgetItem(" - " +tr("Current state","current bar in history hwindow")+ " - ");
+ item=new QTableWidgetItem(" - " +tr("Current state","Current bar in history hwindow")+ " - ");
item->setBackgroundColor (c);
ui.historyTable->setItem(undosAvail, 1, item);
+ // Update Redos in table
s=curStep;
s++; if (s>stepsTotal) s=1;
-
for (i=1;i<= redosAvail; i++)
{
updateRow (undosAvail+i,s,set);
s++; if (s>stepsTotal) s=1;
}
+ // Delete the rest
+ for (i=undosAvail+redosAvail+1;i<= stepsTotal; i++)
+ clearRow (i);
+
ui.historyTable->resizeColumnsToContents();
}
diff -r a40af6315ac6 -r 3a58c9ef4a18 historywindow.h
--- a/historywindow.h Thu Sep 14 11:38:17 2006 +0000
+++ b/historywindow.h Thu Sep 14 11:38:18 2006 +0000
@@ -1,7 +1,6 @@
#ifndef HISTORYWINDOW_H
#define HISTORYWINDOW_H
-//#include "mapeditor.h"
#include "settings.h"
#include "ui_historywindow.h"
@@ -25,6 +24,7 @@
void select();
private:
+ void clearRow (int);
void updateRow (int, int, SimpleSettings &);
Ui::HistoryWindow ui;
MapEditor *mapEditor;
diff -r a40af6315ac6 -r 3a58c9ef4a18 linkablemapobj.cpp
--- a/linkablemapobj.cpp Thu Sep 14 11:38:17 2006 +0000
+++ b/linkablemapobj.cpp Thu Sep 14 11:38:18 2006 +0000
@@ -154,10 +154,8 @@
{
if (parObj)
{
- relPos=getRelPos();
-
+ getRelPos();
parObj->calcBBoxSize();
- parObj->requestReposition();
}
}
@@ -165,8 +163,9 @@
{
relPos=p;
if (parObj)
- { parObj->calcBBoxSize();
- parObj->requestReposition();
+ {
+ parObj->calcBBoxSize();
+ requestReposition();
}
}
@@ -468,6 +467,31 @@
}
}
+void LinkableMapObj::setOrientation()
+{
+ LinkOrient orientOld=orientation;
+
+ if (!parObj)
+ {
+ orientation=OrientUndef;
+ return;
+ }
+
+ // Set orientation, first look for orientation of parent
+ if (parObj->getOrientation() != OrientUndef )
+ // use the orientation of the parent:
+ orientation=parObj->getOrientation();
+ else
+ {
+ // calc orientation depending on position rel to parent
+ if (absPos.x() < QPoint(parObj->getChildPos() ).x() )
+ orientation=OrientLeftOfCenter;
+ else
+ orientation=OrientRightOfCenter;
+ }
+ if (orientOld!=orientation) requestReposition();
+}
+
void LinkableMapObj::updateLink()
{
// needs:
@@ -511,21 +535,11 @@
p2y=QPoint( parObj->getParPos() ).y();
}
+
+
+ setDockPos(); // Call overloaded method
+/* FIXME not needed?
LinkOrient orientOld=orientation;
-
- // Set orientation, first look for orientation of parent
- if (parObj->getOrientation() != OrientUndef )
- // use the orientation of the parent:
- orientation=parObj->getOrientation();
- else
- {
- // calc orientation depending on position rel to mapCenter
- if (absPos.x() < QPoint(parObj->getChildPos() ).x() )
- orientation=OrientLeftOfCenter;
- else
- orientation=OrientRightOfCenter;
- }
-
if ((orientation!=orientOld) && (orientOld!= OrientUndef))
{
// Orientation just changed. Reorient this subbranch, because move is called
@@ -534,10 +548,11 @@
//
// Also possible: called in BranchObj::init(), then orientOld==OrientUndef,
// no need to reposition now
+ cout <<"Trying to reorientate... orient="<testFunction();
+ currentMapEditor()->testFunction();
}
void Main::helpDoc()
diff -r a40af6315ac6 -r 3a58c9ef4a18 mapcenterobj.cpp
--- a/mapcenterobj.cpp Thu Sep 14 11:38:17 2006 +0000
+++ b/mapcenterobj.cpp Thu Sep 14 11:38:18 2006 +0000
@@ -65,8 +65,8 @@
void MapCenterObj::moveAllBy (double dx, double dy)
{
- // Move myself
- moveBy(dx,dy);
+ // Move myself and childs
+ BranchObj::moveBy(dx,dy);
}
void MapCenterObj::updateLink()
@@ -80,6 +80,24 @@
b->updateLink();
}
+void MapCenterObj::updateRelPositions()
+{
+ if (repositionRequest) unsetAllRepositionRequests();
+
+ // update relative Positions of branches and floats
+ BranchObj *b;
+ for (b=branch.first(); b; b=branch.next() )
+ {
+ b->setRelPos();
+ b->setOrientation();
+ }
+
+ FloatObj *fo;
+ for (fo=floatimage.first(); fo; fo=floatimage.next() ) fo->setRelPos();
+
+ if (repositionRequest) reposition();
+}
+
LinkableMapObj* MapCenterObj::findMapObj(QPoint p, LinkableMapObj *excludeLMO)
{
BranchObj *bo;
diff -r a40af6315ac6 -r 3a58c9ef4a18 mapcenterobj.h
--- a/mapcenterobj.h Thu Sep 14 11:38:17 2006 +0000
+++ b/mapcenterobj.h Thu Sep 14 11:38:18 2006 +0000
@@ -21,6 +21,7 @@
virtual void moveAll (double,double);
virtual void moveAllBy (double,double);
virtual void updateLink();
+ virtual void updateRelPositions();
LinkableMapObj* findMapObj(QPoint,LinkableMapObj*); // find MapObj
virtual QString saveToDir (const QString&,const QString&,int, const QPoint&);// Save data recursivly to tempdir
void setVersion(const QString &);
diff -r a40af6315ac6 -r 3a58c9ef4a18 mapeditor.cpp
--- a/mapeditor.cpp Thu Sep 14 11:38:17 2006 +0000
+++ b/mapeditor.cpp Thu Sep 14 11:38:18 2006 +0000
@@ -209,7 +209,7 @@
fileName=tr("unnamed");
mapName="";
- stepsTotal=settings.readNumEntry("/mapeditor/stepsTotal",5);
+ stepsTotal=settings.readNumEntry("/mapeditor/stepsTotal",50);
undoSet.setEntry ("/history/stepsTotal",QString::number(stepsTotal));
// Initialize find routine
@@ -546,7 +546,7 @@
/* TODO remove after testing
*/
- cout << "ME::saveState() begin"<stepsTotal) curStep=1;
QString backupXML;
- QString bakMapDir=QDir::convertSeparators (QString(tmpMapDir+"/undo-%1").arg(curStep));
+ QString bakMapName=QDir::convertSeparators (QString("history-%1").arg(curStep));
+ QString bakMapDir=QDir::convertSeparators (tmpMapDir +"/"+bakMapName);
QString bakMapPath=QDir::convertSeparators(bakMapDir+"/map.xml");
// Create bakMapDir if not available
@@ -589,7 +590,13 @@
// Write XML Data to disk
saveStringToDisk (QString(bakMapPath),backupXML);
+ // We would have to save all actions in a tree, to keep track of
+ // possible redos after a action. Too complex, forget about redos.
+ redosAvail=0;
+
+ // Write the current state to disk
undoSet.setEntry ("/history/undosAvail",QString::number(undosAvail));
+ undoSet.setEntry ("/history/redosAvail",QString::number(redosAvail));
undoSet.setEntry ("/history/curStep",QString::number(curStep));
undoSet.setEntry (QString("/history/step-%1/undoCommand").arg(curStep),undoCommand);
undoSet.setEntry (QString("/history/step-%1/undoSelection").arg(curStep),undoSelection);
@@ -771,6 +778,8 @@
{
s=api.parString (ok,0); // undo selection
t=api.parString (ok,1); // backup dir
+ if (QDir::isRelativePath(t)) t=QDir::convertSeparators (tmpMapDir + "/"+t);
+ cout <undosAvail)
for (int j=undosAvail; jgetRelPos());
QString s=selection->getSelectString();
@@ -1550,7 +1564,7 @@
s, "moveRel "+ps,
s, "moveRel "+qpointToString (QPoint (x,y)),
QString("Move %1 to relativ position %2").arg(getName(selection)).arg(ps));
- selection->setRelPos (QPoint(x,y));
+ ((OrnamentedObj*)selection)->move2RelPos (x,y);
mapCenter->reposition();
adjustCanvasSize();
}
@@ -3217,7 +3231,6 @@
void MapEditor::editXLink(int i)
{
- qDebug ("ko."); //FIXME Huh?
if (selection &&
(typeid(*selection) == typeid(BranchObj)) ||
(typeid(*selection) == typeid(MapCenterObj)) )
@@ -3247,42 +3260,18 @@
{
cout << "MapEditor::testFunction() called\n";
-/*
- bool ok;
- QString text = QInputDialog::getText(
- this,
- tr("QInputDialog::getText()"),
- tr("User name:"), QLineEdit::Normal,
- QDir::home().dirName(), &ok, Qt::FramelessWindowHint);
-*/
-
- QDialog *d =new QDialog(NULL);
- QLineEdit *le=new QLineEdit (d);
-// d->setModal (true);
- d->setWindowFlags (Qt::FramelessWindowHint);
- le->setFocus();
- le->setText ("Foo");
- le->selectAll();
- connect (le, SIGNAL (returnPressed()), d, SLOT (accept()));
- d->exec();
- qWarning( le->text());
- return;
-
-
-
-/*
WarningDialog dia;
- dia.setCancelButton (true);
+ dia.showCancelButton (true);
dia.setText("This is a longer \nWarning");
+ /*
dia.setCaption("Warning: Flux problem");
dia.setShowAgainName("/warnings/mapeditor");
- dia.setWindowFlags (Qt::FramelessWindowHint);
+ */
if (dia.exec()==QDialog::Accepted)
cout << "accepted!\n";
else
cout << "canceled!\n";
return;
-*/
/* Hide hidden stuff temporary, maybe add this as regular function somewhere
if (hidemode==HideNone)
@@ -3541,7 +3530,7 @@
// Relink float to new mapcenter or branch, if shift is pressed
// Only relink, if selection really has a new parent
- if ( (e->state() & Qt::ShiftModifier) && lmo &&
+ if ( (e->modifiers()==Qt::ShiftModifier) && lmo &&
( (typeid(*lmo)==typeid(BranchObj)) ||
(typeid(*lmo)==typeid(MapCenterObj)) ) &&
( lmo != fo->getParObj())
@@ -3563,24 +3552,26 @@
movingObj=(MapObj*)(fio);
}
}
- } else // selection != a FloatObj
- {
+ } else
+ { // selection != a FloatObj
if (lmosel->getDepth()==0)
{
- if (e->state() == Qt::LeftButton && e->modifiers()==Qt::ShiftModifier)
- // If mapCenter is moved, move all the rest by default, too.
+ // Move MapCenter
+ if (e->buttons()== Qt::LeftButton && e->modifiers()==Qt::ShiftModifier)
mapCenter->moveAll(p.x() -movingObj_start.x(), p.y()-movingObj_start.y() );
else
mapCenter->move (p.x() -movingObj_start.x(), p.y()-movingObj_start.y() );
+ mapCenter->updateRelPositions();
} else
{
if (lmosel->getDepth()==1)
{
- // depth==1, mainbranch
+ // Move mainbranch
lmosel->move(p.x() -movingObj_start.x(), p.y()-movingObj_start.y() );
+ lmosel->setRelPos();
} else
{
- // depth>1
+ // Move ordinary branch
if (lmosel->getOrientation() == OrientLeftOfCenter)
// Add width of bbox here, otherwise alignRelTo will cause jumping around
lmosel->move(p.x() -movingObj_start.x()+lmosel->getBBox().width(),
@@ -3590,19 +3581,18 @@
}
// reposition subbranch
lmosel->reposition();
- //ensureSelectionVisible();
if (lmo && (lmo!=selection) &&
(typeid(*lmo) == typeid(BranchObj) ||
(typeid(*lmo) == typeid(MapCenterObj) )
) )
{
- if (e->state() & Qt::ControlModifier)
+ if (e->modifiers()==Qt::ControlModifier)
{
// Special case: CTRL to link below lmo
lmosel->setParObjTmp (lmo,p,+1);
}
- else if (e->state() & Qt::ShiftModifier)
+ else if (e->modifiers()==Qt::ShiftModifier)
lmosel->setParObjTmp (lmo,p,-1);
else
lmosel->setParObjTmp (lmo,p,0);
@@ -3688,9 +3678,9 @@
// Have we been moving something?
if ( selection && movingObj )
{
- // Moved FloatObj? Maybe we need to reposition
if(typeid(*selection)==typeid (FloatImageObj))
{
+ // Moved FloatObj. Maybe we need to reposition
FloatImageObj *fo=(FloatImageObj*)selection;
QString pold=qpointToString(movingObj_orgRelPos);
QString pnow=qpointToString(fo->getRelPos());
@@ -3699,6 +3689,7 @@
"moveRel "+pnow,
QString("Move %1 to relativ position %2").arg(getName(selection)).arg(pnow));
+ // FIXME Why calling parObj here?
selection->getParObj()->requestReposition();
mapCenter->reposition();
}
@@ -3711,9 +3702,14 @@
if (dst && (typeid(*dst)!=typeid(BranchObj) && typeid(*dst)!=typeid(MapCenterObj)))
dst=NULL;
- // Now check, if we have been moving a branch
+ if (typeid(*selection) == typeid(MapCenterObj) )
+ { // The MapCenter was moved
+ cout << "FIXME missing savestate...\n";
+ }
+
if (typeid(*selection) == typeid(BranchObj) )
- {
+ { // A branch was moved
+
// save the position in case we link to mapcenter
QPoint savePos=QPoint (selection->x(),selection->y() );
diff -r a40af6315ac6 -r 3a58c9ef4a18 ornamentedobj.cpp
--- a/ornamentedobj.cpp Thu Sep 14 11:38:17 2006 +0000
+++ b/ornamentedobj.cpp Thu Sep 14 11:38:18 2006 +0000
@@ -160,6 +160,11 @@
void OrnamentedObj::move2RelPos(double x, double y)
{
setRelPos (QPoint((int)x,(int)y));
+ if (parObj)
+ {
+ QPoint p=parObj->getChildPos();
+ move (p.x()+x, p.y() +y);
+ }
}
void OrnamentedObj::move2RelPos(QPoint p)
@@ -355,14 +360,16 @@
{
QString posAttr;
- if (useRelPos)
- posAttr=attribut("relPosX",QString().setNum(relPos.x(),10)) +
- attribut("relPosY",QString().setNum(relPos.y(),10));
+ if (depth==0)
+ posAttr=
+ attribut("absPosX",QString().setNum(absPos.x(),10)) +
+ attribut("absPosY",QString().setNum(absPos.y(),10));
else
{
- if (depth==0 || depth==1) posAttr=
- attribut("absPosX",QString().setNum(absPos.x(),10)) +
- attribut("absPosY",QString().setNum(absPos.y(),10));
+ if (depth==1)
+ posAttr=
+ attribut("relPosX",QString().setNum(relPos.x(),10)) +
+ attribut("relPosY",QString().setNum(relPos.y(),10));
else
posAttr="";
}
diff -r a40af6315ac6 -r 3a58c9ef4a18 tex/vym.changelog
--- a/tex/vym.changelog Thu Sep 14 11:38:17 2006 +0000
+++ b/tex/vym.changelog Thu Sep 14 11:38:18 2006 +0000
@@ -1,8 +1,17 @@
-------------------------------------------------------------------
-Wed Sep 8 14:43:09 CEST 2006 - uwedr
+Thu Sep 14 12:01:28 CEST 2006 - uwedr
+
+- Version: 1.8.57
+- Feature: Note Editor completly based on QT4 now.
+
+-------------------------------------------------------------------
+Wed Sep 13 16:43:09 CEST 2006 - uwedr
- Version: 1.8.56
-- Feature: New History window, started to port designer stuff to QT4
+- Feature: New History window, All designer elements ported to QT4
+- Bugfix: No more hopping around of floats, when canvas is resized
+ (by using relative positions for mainbranches. This might
+ confuse parsing 1.8.56 documents with vym <= 1.8.1
-------------------------------------------------------------------
Wed Sep 6 09:48:12 CEST 2006 - uwedr
diff -r a40af6315ac6 -r 3a58c9ef4a18 texteditor.cpp
--- a/texteditor.cpp Thu Sep 14 11:38:17 2006 +0000
+++ b/texteditor.cpp Thu Sep 14 11:38:18 2006 +0000
@@ -41,9 +41,7 @@
printer = new QPrinter( QPrinter::HighResolution );
printer->setPrinterName (settings.value("/mainwindow/printerName",printer->printerName()).toString());
- // Editor (use MyTextEdit to wrap verticalAlignmentChanged to
- // int argument. see header file)
- e = new MyTextEdit( this, "editor" );
+ e = new QTextEdit( this);
e->setFocus();
e->setTextFormat(Qt::RichText); // default
e->setTabStopWidth (20); // unit is pixel
@@ -51,9 +49,15 @@
e->setAutoFillBackground (true);
connect (e, SIGNAL( textChanged() ), this, SLOT( editorChanged() ) );
setCentralWidget( e );
- statusBar()->message( "Ready", statusbarTime);
+ statusBar()->message( tr("Ready","Statusbar message"), statusbarTime);
setCaption(__VYM " - " +tr ("Note Editor"));
+
+ connect(e, SIGNAL(currentCharFormatChanged(const QTextCharFormat &)),
+ this, SLOT(formatChanged(const QTextCharFormat &)));
+
+
+
// Toolbars
setupFileActions();
setupEditActions();
@@ -92,6 +96,9 @@
}
filenameHint="";
+ // Restore position of toolbars
+ restoreState (settings.value("/noteeditor/state",0).toByteArray());
+
// Save settings in vymrc
settings.setValue("/mainwindow/printerName",printer->printerName());
}
@@ -103,6 +110,7 @@
// Save Settings
settings.setValue( "/noteeditor/geometry/size", size() );
settings.setValue( "/noteeditor/geometry/pos", pos() );
+ settings.setValue ("/noteeditor/state",saveState(0));
settings.setValue( "/noteeditor/showWithMain",showWithMain());
@@ -114,6 +122,8 @@
settings.setValue( "/noteeditor/fonts/fonthintDefault",s );
settings.setValue("/noteeditor/fonts/varFont", varFont.toString() );
settings.setValue("/noteeditor/fonts/fixedFont", fixedFont.toString() );
+
+
}
bool TextEditor::isEmpty()
@@ -165,12 +175,12 @@
if (fn.isEmpty() )
{
filename="";
- statusBar()->message( "No filename available for this note.", statusbarTime );
+ statusBar()->message( tr("No filename available for this note.","Statusbar message"), statusbarTime );
}
else
{
filename=fn;
- statusBar()->message( QString( "Current filename is %1" ).arg( filename ), statusbarTime );
+ statusBar()->message( tr(QString( "Current filename is %1" ).arg( filename ),"Statusbar message"), statusbarTime );
}
}
@@ -304,23 +314,6 @@
tb->addAction (a);
actionEditDeleteAll=a;
- a = new QAction(QPixmap(), tr( "&Convert Paragraphs" ),this);
- /* TODO not needed any longer? remove also from docu...
- a->setStatusTip(tr( "Convert paragraphs to linebreaks" ));
- a->setShortcut( Qt::ALT + Qt::Key_P );
- connect( a, SIGNAL( activated() ), this, SLOT( textConvertPar() ) );
- editMenu->addAction (a);
- */
- actionEditConvertPar=a;
-
- a = new QAction( QPixmap(), tr( "&Join lines" ), this);
- /* TODO not needed any longer? remove also from docu...
- a->setStatusTip(tr( "Join all lines of a paragraph" ) );
- a->setShortcut(Qt::ALT + Qt::Key_J );
- connect( a, SIGNAL( activated() ), this, SLOT( textJoinLines() ) );
- editMenu->addAction (a);
- */
- actionEditJoinLines=a;
}
void TextEditor::setupFormatActions()
@@ -339,7 +332,6 @@
tb->addAction (a);
actionFormatUseFixedFont=a;
-// comboFont = new QComboBox( true, tb );
comboFont = new QComboBox;
tb->addWidget (comboFont);
QFontDatabase fontDB;
@@ -395,9 +387,28 @@
actionTextUnderline=a;
formatMenu->addSeparator();
+ QActionGroup *grp2 = new QActionGroup( this );
+ grp2->setExclusive(true);
+ a = new QAction( QPixmap (iconPath+"text_sub.png"), tr( "Subs&cript" ),grp2 );
+ a->setShortcut( Qt::CTRL + Qt::SHIFT + Qt::Key_B );
+ a->setToggleAction( true );
+ tb->addAction (a);
+ formatMenu->addAction (a);
+ connect(a, SIGNAL(activated()), this, SLOT(textVAlign()));
+ actionAlignSubScript=a;
+
+ a = new QAction( QPixmap (iconPath+"text_super.png"), tr( "Su&perscript" ),grp2 );
+ a->setShortcut( Qt::CTRL + Qt::SHIFT + Qt::Key_P );
+ a->setToggleAction( true );
+ tb->addAction (a);
+ formatMenu->addAction (a);
+ connect(a, SIGNAL(activated()), this, SLOT(textVAlign()));
+ actionAlignSuperScript=a;
QActionGroup *grp = new QActionGroup( this );
connect( grp, SIGNAL( selected( QAction* ) ), this, SLOT( textAlign( QAction* ) ) );
+ formatMenu->addSeparator();
+
a = new QAction( QPixmap (iconPath+"text_left.png"), tr( "&Left" ),grp );
a->setShortcut( Qt::CTRL+Qt::Key_L );
a->setToggleAction( true );
@@ -423,31 +434,13 @@
formatMenu->addAction (a);
actionAlignJustify=a;
- QActionGroup *grp2 = new QActionGroup( this );
- grp2->setExclusive(true);
- a = new QAction( QPixmap (iconPath+"text_sub.png"), tr( "Subs&cript" ),grp2 );
- a->setShortcut( Qt::CTRL + Qt::SHIFT + Qt::Key_B );
- a->setToggleAction( true );
- tb->addAction (a);
- formatMenu->addAction (a);
- connect(a, SIGNAL(activated()), this, SLOT(textVAlign()));
- actionAlignSubScript=a;
- a = new QAction( QPixmap (iconPath+"text_super.png"), tr( "Su&perscript" ),grp2 );
- a->setShortcut( Qt::CTRL + Qt::SHIFT + Qt::Key_P );
- a->setToggleAction( true );
- tb->addAction (a);
- formatMenu->addAction (a);
- connect(a, SIGNAL(activated()), this, SLOT(textVAlign()));
- actionAlignSuperScript=a;
-
- formatMenu->addSeparator();
+ /* FIXME
connect( e, SIGNAL( currentFontChanged( const QFont & ) ),
this, SLOT( fontChanged( const QFont & ) ) );
connect( e, SIGNAL( currentColorChanged( const QColor & ) ),
this, SLOT( colorChanged( const QColor & ) ) );
- /*
connect( e, SIGNAL( currentAlignmentChanged( int ) ),
this, SLOT( alignmentChanged( int ) ) );
connect( e, SIGNAL( currentVerticalAlignmentChanged(int)),
@@ -648,84 +641,6 @@
statusBar()->message( QString( "Note exported as %1" ).arg( filename ), statusbarTime );
}
-void TextEditor::textConvertPar()
-{
- // In X11 a copy&paste generates paragraphs,
- // which is not always wanted
- // This function replaces paragraphs by linebreaks.
-
- QString t;
- t=e->text();
- QRegExp re("");
- re.setMinimal(true);
- t.replace (re,"");
- t.replace ("
","
");
- e->setText(t);
-
- /* TODO QT3 use seletion ()
- int parFrom, parTo, indFrom, indTo;
- e->getSelection (&parFrom,&indFrom,&parTo,&indTo);
- if (parFrom>-1)
- t=e->selectedText();
- else
- t=e->text();
-
- QRegExp re("");
- re.setMinimal(true);
- t.replace (re,"");
- t.replace ("","
");
- if (parFrom>-1)
- {
- e->setCursorPosition (parFrom,indFrom);
- e->cut();
- // Tried to simply insert the changed text with
- // e->insert (t,(uint)(QTextEdit::RemoveSelected));
- // but then the html would be quoted. So I use the ugly
- // way: insert a marker, replace it in whole text of QTextEdit
- QString marker="R3PlAcEMeL4teR!";
- e->insert (marker);
- e->setText (e->text().replace(marker,t));
- } else
- e->setText(t);
- */
-}
-
-void TextEditor::textJoinLines()
-{
-/* TODO QT3
- int parFrom, parTo, indFrom, indTo;
- e->getSelection (&parFrom,&indFrom,&parTo,&indTo);
- QString t;
- if (parFrom>-1)
- t=e->selectedText();
- else
- t=e->text();
- // In addition to textConvertPar it is sometimes
- // useful to join all lines of a paragraph
- QRegExp re("\n+(?!
)");
- re.setMinimal(true);
- t.replace (re," ");
-
- // Above we may have introduced new " " at beginning of a
- // paragraph - remove it.
- re.setPattern(" ");
- t.replace (re,"
");
- if (parFrom>-1)
- {
- e->setCursorPosition (parFrom,indFrom);
- e->cut();
- // Tried to simply insert the changed text with
- // e->insert (t,(uint)(QTextEdit::RemoveSelected));
- // but then the html would be quoted. So I use the ugly
- // way: insert a marker, replace it in whole text of QTextEdit
- QString marker="R3PlAcEMeL4teR!";
- e->insert (marker);
- e->setText (e->text().replace(marker,t));
- } else
- e->setText(t);
-*/
-}
-
void TextEditor::textExportAsASCII()
{
QString text = NoteObj (e->text()).getNoteASCII();
@@ -857,8 +772,7 @@
void TextEditor::textColor()
{
QColor col = QColorDialog::getColor( e->color(), this );
- if ( !col.isValid() )
- return;
+ if ( !col.isValid() ) return;
e->setColor( col );
QPixmap pix( 16, 16 );
pix.fill( Qt::black );
@@ -868,35 +782,36 @@
void TextEditor::textAlign( QAction *a )
{
if ( a == actionAlignLeft )
- e->setAlignment( Qt::AlignLeft );
+ e->setAlignment( Qt::AlignLeft );
else if ( a == actionAlignCenter )
- e->setAlignment( Qt::AlignHCenter );
+ e->setAlignment( Qt::AlignHCenter );
else if ( a == actionAlignRight )
- e->setAlignment( Qt::AlignRight );
+ e->setAlignment( Qt::AlignRight );
else if ( a == actionAlignJustify )
- e->setAlignment( Qt::AlignJustify );
+ e->setAlignment( Qt::AlignJustify );
}
void TextEditor::textVAlign()
{
-/* FIXME QT3 alignment
+ QTextCharFormat format;
+
if ( sender() == actionAlignSuperScript && actionAlignSuperScript->isOn()) {
- e->setVerticalAlignment( QTextEdit::AlignSuperScript);
+ format.setVerticalAlignment(QTextCharFormat::AlignSuperScript);
} else if (sender() == actionAlignSubScript && actionAlignSubScript->isOn()) {
- e->setVerticalAlignment( QTextEdit::AlignSubScript);
+ format.setVerticalAlignment(QTextCharFormat::AlignSubScript);
} else {
- e->setVerticalAlignment( QTextEdit::AlignNormal);
+ format.setVerticalAlignment(QTextCharFormat::AlignNormal);
}
-*/
+ e->mergeCurrentCharFormat(format);
}
void TextEditor::fontChanged( const QFont &f )
{
-/*
- comboFont->lineEdit()->setText( f.family() );
- comboSize->lineEdit()->setText( QString::number( f.pointSize() ) );
-*/
+ int i=comboFont->findText(f.family());
+ if (i>=0) comboFont->setCurrentIndex (i);
+ i=comboSize->findText(QString::number(f.pointSize()));
+ if (i>=0) comboSize->setCurrentIndex(i);
actionTextBold->setOn( f.bold() );
actionTextItalic->setOn( f.italic() );
actionTextUnderline->setOn( f.underline() );
@@ -909,32 +824,40 @@
actionTextColor->setIconSet( pix );
}
+void TextEditor::formatChanged( const QTextCharFormat &f )
+{
+ fontChanged(f.font());
+ colorChanged(f.foreground().color());
+ alignmentChanged(e->alignment());
+ verticalAlignmentChanged (f.verticalAlignment());
+}
+
void TextEditor::alignmentChanged( int a )
{
if ( ( a == Qt::AlignLeft ) || ( a & Qt::AlignLeft ))
- actionAlignLeft->setOn( true );
+ actionAlignLeft->setOn( true );
else if ( ( a & Qt::AlignHCenter ) )
- actionAlignCenter->setOn( true );
+ actionAlignCenter->setOn( true );
else if ( ( a & Qt::AlignRight ) )
- actionAlignRight->setOn( true );
+ actionAlignRight->setOn( true );
else if ( ( a & Qt::AlignJustify ) )
- actionAlignJustify->setOn( true );
+ actionAlignJustify->setOn( true );
}
-void TextEditor::verticalAlignmentChanged(int a)
+void TextEditor::verticalAlignmentChanged(QTextCharFormat::VerticalAlignment a)
{
- /* FIXME QT3 alignment
- if (a == QTextEdit::AlignSuperScript ) {
- actionAlignSuperScript->setOn(true);
- actionAlignSubScript->setOn(false);
- } else if (a == QTextEdit::AlignSubScript ) {
- actionAlignSuperScript->setOn(false);
- actionAlignSubScript->setOn(true);
- } else {
- actionAlignSuperScript->setOn(false);
- actionAlignSubScript->setOn(false);
- }
- */
+ actionAlignSubScript->setOn (false);
+ actionAlignSuperScript->setOn (false);
+ switch (a)
+ {
+ case QTextCharFormat::AlignSuperScript:
+ actionAlignSuperScript->setOn (true);
+ break;
+ case QTextCharFormat::AlignSubScript:
+ actionAlignSubScript->setOn (true);
+ break;
+ default: ;
+ }
}
@@ -951,8 +874,6 @@
actionEditCut->setEnabled(true);
actionEditPaste->setEnabled(true);
actionEditDeleteAll->setEnabled(true);
- actionEditConvertPar->setEnabled(true);
- actionEditJoinLines->setEnabled(true);
actionFormatUseFixedFont->setEnabled(true);
}
@@ -968,8 +889,6 @@
actionEditCut->setEnabled(false);
actionEditPaste->setEnabled(false);
actionEditDeleteAll->setEnabled(false);
- actionEditConvertPar->setEnabled(false);
- actionEditJoinLines->setEnabled(false);
actionFormatUseFixedFont->setEnabled(false);
}
diff -r a40af6315ac6 -r 3a58c9ef4a18 texteditor.h
--- a/texteditor.h Thu Sep 14 11:38:17 2006 +0000
+++ b/texteditor.h Thu Sep 14 11:38:18 2006 +0000
@@ -56,8 +56,6 @@
void textLoad();
void textSaveAs();
void textSave();
- void textConvertPar();
- void textJoinLines();
void textExportAsASCII();
void textPrint();
void textEditUndo();
@@ -74,15 +72,16 @@
void textVAlign();
void fontChanged( const QFont &f );
void colorChanged( const QColor &c );
+ void formatChanged (const QTextCharFormat &f);
void alignmentChanged( int a );
- void verticalAlignmentChanged(int a);
+ void verticalAlignmentChanged(QTextCharFormat::VerticalAlignment);
void enableActions();
void disableActions();
void setState (EditorState);
private:
QPrinter *printer;
- MyTextEdit *e;
+ QTextEdit *e;
QPoint lastPos; // save last position of window
QString filename;
QString filenameHint;
@@ -95,9 +94,7 @@
QFont varFont;
QFont fixedFont;
- QComboBox
- *comboFont,
- *comboSize;
+ QComboBox *comboFont, *comboSize;
QAction *actionFileLoad,
*actionFileSave,
@@ -109,8 +106,6 @@
*actionEditCut,
*actionEditPaste,
*actionEditDeleteAll,
- *actionEditConvertPar,
- *actionEditJoinLines,
*actionFormatUseFixedFont,
*actionSettingsVarFont,
*actionSettingsFixedFont,
@@ -119,47 +114,12 @@
*actionTextUnderline,
*actionTextItalic,
*actionTextColor,
+ *actionAlignSubScript,
+ *actionAlignSuperScript,
*actionAlignLeft,
*actionAlignCenter,
*actionAlignRight,
- *actionAlignJustify,
- *actionAlignSubScript,
- *actionAlignSuperScript;
-};
-
-/* FIXME Wraps currentVerticalAlignmentChanged(VerticalAlignment)
- * to currentVerticalAlignmentChanged(int)
- * this way the signal can be used without use of the internal
- * VerticalAlignment enum of QTextEdit
- * If VerticalAlignment has been a global like the normal alignment there
- * have been no problems!
- */
-
-class MyTextEdit : public QTextEdit
-{
- Q_OBJECT;
- public:
- MyTextEdit(QWidget *parent, const char *name) : QTextEdit(parent, name)
- {
- /*
- connect(
- this, SIGNAL(currentVerticalAlignmentChanged(VerticalAlignment)),
- this, SLOT(verticalAlignmentChanged(VerticalAlignment)));
- */
- }
-// int verticalAlignment() const { return m_verticalAlignment; }
- signals:
-// void currentVerticalAlignmentChanged(int a);
- public slots:
- /*
- void verticalAlignmentChanged(VerticalAlignment a)
- {
- m_verticalAlignment = a;
- emit currentVerticalAlignmentChanged((int)a);
- }
-*/
- private:
-// int m_verticalAlignment;
+ *actionAlignJustify;
};
#endif
diff -r a40af6315ac6 -r 3a58c9ef4a18 version.h
--- a/version.h Thu Sep 14 11:38:17 2006 +0000
+++ b/version.h Thu Sep 14 11:38:18 2006 +0000
@@ -2,7 +2,7 @@
#define VERSION_H
#define __VYM "VYM"
-#define __VYM_VERSION "1.8.55"
-#define __BUILD_DATE "September 8, 2006"
+#define __VYM_VERSION "1.8.57"
+#define __BUILD_DATE "September 14, 2006"
#endif
diff -r a40af6315ac6 -r 3a58c9ef4a18 vym.pro
--- a/vym.pro Thu Sep 14 11:38:17 2006 +0000
+++ b/vym.pro Thu Sep 14 11:38:18 2006 +0000
@@ -4,11 +4,15 @@
CONFIG += qt warn_on release
QT += qt3support
-HEADERS += aboutdialog.h \
+HEADERS += \
+ aboutdialog.h \
api.h \
branchobj.h \
+ editxlinkdialog.h \
exportoofiledialog.h \
+ exportxhtmldialog.h\
exports.h \
+ extrainfodialog.h \
file.h \
findwindow.h \
flagobj.h \
@@ -28,6 +32,7 @@
mapobj.h \
misc.h \
noteobj.h \
+ options.h \
ornamentedobj.h \
process.h \
showtextdialog.h\
@@ -37,13 +42,17 @@
xml.h \
xsltproc.h \
settings.h \
- options.h
+ warningdialog.h
-SOURCES += aboutdialog.cpp \
+SOURCES += \
+ aboutdialog.cpp \
api.cpp \
branchobj.cpp \
+ editxlinkdialog.cpp \
exportoofiledialog.cpp \
exports.cpp \
+ exportxhtmldialog.cpp \
+ extrainfodialog.cpp \
file.cpp \
findwindow.cpp \
flagobj.cpp \
@@ -64,6 +73,7 @@
mapobj.cpp \
misc.cpp \
noteobj.cpp \
+ options.cpp \
ornamentedobj.cpp \
process.cpp \
showtextdialog.cpp \
@@ -72,20 +82,18 @@
xml.cpp \
xsltproc.cpp \
settings.cpp \
- options.cpp
+ warningdialog.cpp
-#The following line was inserted by qt3to4, use "FORMS" later
-FORMS3 = exportxhtmldialog.ui \
+FORMS = \
+ exportxhtmldialog.ui \
extrainfodialog.ui \
editxlinkdialog.ui \
+ historywindow.ui \
+ showtextdialog.ui \
warningdialog.ui
-FORMS = historywindow.ui \
- showtextdialog.ui
-
#The following lines were inserted by qt3to4
QT += xml
-CONFIG += uic3
TARGET = vym
TRANSLATIONS += lang/vym_de.ts
diff -r a40af6315ac6 -r 3a58c9ef4a18 warningdialog.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/warningdialog.cpp Thu Sep 14 11:38:18 2006 +0000
@@ -0,0 +1,45 @@
+#include "warningdialog.h"
+
+extern QString iconPath;
+
+WarningDialog::WarningDialog(QWidget* parent):QDialog (parent)
+{
+ ui.setupUi(this);
+ //FIXME proper icon needed
+ ui.okButton->setText(tr("Proceed"));
+ /*
+ ui.warningSign->setPixmap (QPixmap(iconPath + "icons/vym.png"));
+ ui.showAgainBox->setText (tr("Show this message again"));
+ */
+ useShowAgain=false;
+ ui.showAgainBox->hide();
+}
+
+void WarningDialog::showCancelButton (bool b)
+{
+ if (b)
+ {
+ ui.cancelButton->show();
+ ui.cancelButton->setText(tr("Cancel"));
+ } else
+ ui.cancelButton->hide();
+}
+
+void WarningDialog::setShowAgainName (const QString &s)
+{
+/*
+ showAgainName=s;
+ useShowAgain=true;
+ ui.showAgainBox->show();
+*/
+}
+
+void WarningDialog::setText (const QString &s)
+{
+ ui.warningTE->setText(s);
+}
+
+void WarningDialog::setCaption(const QString &s)
+{
+ setCaption("VYM - "+s);
+}
diff -r a40af6315ac6 -r 3a58c9ef4a18 warningdialog.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/warningdialog.h Thu Sep 14 11:38:18 2006 +0000
@@ -0,0 +1,27 @@
+#ifndef WARNINGDIALOG_H
+#define WARNINGDIALOG_H
+
+#include "ui_warningdialog.h"
+
+class WarningDialog : public QDialog
+{
+ Q_OBJECT
+
+public:
+ WarningDialog(QWidget* parent = 0);
+
+public slots:
+ virtual void showCancelButton( bool b );
+ virtual void setShowAgainName( const QString & s );
+ virtual void setText( const QString & s );
+ virtual void setCaption( const QString & s );
+
+private:
+ void init();
+ bool useShowAgain;
+ QString showAgainName;
+ Ui::WarningDialog ui;
+
+};
+
+#endif // WARNINGDIALOG_H
diff -r a40af6315ac6 -r 3a58c9ef4a18 warningdialog.ui
--- a/warningdialog.ui Thu Sep 14 11:38:17 2006 +0000
+++ b/warningdialog.ui Thu Sep 14 11:38:18 2006 +0000
@@ -1,231 +1,140 @@
-
-WarningDialog
-
-
- WarningDialog
-
-
-
- 0
- 0
- 350
- 181
-
-
-
- VYM - Warning : Foo...
-
-
-
- unnamed
-
-
-
- layout6
-
-
-
- unnamed
-
-
-
- warningSign
-
-
- true
-
-
-
-
- textLabel
-
-
- textLabel
-
-
-
-
- spacer6
-
-
- Horizontal
-
-
- Expanding
-
-
-
- 160
- 31
-
-
-
-
-
-
-
- spacer7
-
-
- Vertical
-
-
- Expanding
-
-
-
- 21
- 20
-
-
-
-
-
- layout4
-
-
-
- unnamed
-
-
-
- spacer3
-
-
- Horizontal
-
-
- Expanding
-
-
-
- 61
- 20
-
-
-
-
-
- showAgainBox
-
-
- showAgainBox
-
-
- true
-
-
-
-
- spacer4
-
-
- Horizontal
-
-
- Expanding
-
-
-
- 51
- 21
-
-
-
-
-
-
-
- spacer5
-
-
- Vertical
-
-
- Expanding
-
-
-
- 21
- 20
-
-
-
-
-
- layout3
-
-
-
- unnamed
-
-
-
- spacer2
-
-
- Horizontal
-
-
- Expanding
-
-
-
- 161
- 31
-
-
-
-
-
- cancelButton
-
-
- Cancel
-
-
-
-
- okButton
-
-
- Ok
-
-
-
-
-
-
-
-
- okButton
- clicked()
- WarningDialog
- accept()
-
-
- cancelButton
- clicked()
- WarningDialog
- reject()
-
-
-
- warningdialog.ui.h
-
-
- bool useShowAgain;
- QString showAgainName;
-
-
- setCancelButton( bool b )
- setShowAgainName( const QString & s )
- setText( const QString & s )
- setCaption( const QString & s )
-
-
- init()
-
-
-
-
+
+
+
+
+ WarningDialog
+
+
+
+ 0
+ 0
+ 543
+ 264
+
+
+
+ VYM - Warning : Foo...
+
+
+
+ 9
+
+
+ 6
+
+ -
+
+
+ -
+
+
+
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+ QSizePolicy::Expanding
+
+
+
+ 512
+ 16
+
+
+
+
+ -
+
+
+ 0
+
+
+ 6
+
+
-
+
+
+ showAgainBox
+
+
+ true
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+ QSizePolicy::Expanding
+
+
+
+ 73
+ 31
+
+
+
+
+ -
+
+
+ Cancel
+
+
+
+ -
+
+
+ Ok
+
+
+
+
+
+
+
+
+ qPixmapFromMimeSource
+
+
+
+ cancelButton
+ clicked()
+ WarningDialog
+ reject()
+
+
+ 131
+ 244
+
+
+ 266
+ 135
+
+
+
+
+ okButton
+ clicked()
+ WarningDialog
+ accept()
+
+
+ 222
+ 244
+
+
+ 266
+ 135
+
+
+
+
+
diff -r a40af6315ac6 -r 3a58c9ef4a18 warningdialog.ui.h
--- a/warningdialog.ui.h Thu Sep 14 11:38:17 2006 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-//Added by qt3to4:
-#include
-/****************************************************************************
-** ui.h extension file, included from the uic-generated form implementation.
-**
-** If you want to add, delete, or rename functions or slots, use
-** Qt Designer to update this file, preserving your code.
-**
-** You should not define a constructor or destructor in this file.
-** Instead, write your code in functions called init() and destroy().
-** These will automatically be called by the form's constructor and
-** destructor.
-*****************************************************************************/
-
-void WarningDialog::init()
-{
- warningSign->setPixmap (QPixmap("icons/vym.png"));
- setCancelButton (false);
- okButton->setText(tr("Proceed"));
- showAgainBox->setText (tr("Show this message again"));
- useShowAgain=false;
- showAgainBox->hide();
-}
-
-void WarningDialog::setCancelButton (bool b)
-{
- if (b)
- {
- cancelButton->show();
- cancelButton->setText(tr("Cancel"));
- } else
- cancelButton->hide();
-}
-
-void WarningDialog::setShowAgainName (const QString &s)
-{
- showAgainName=s;
- useShowAgain=true;
- showAgainBox->show();
-}
-
-void WarningDialog::setText (const QString &s)
-{
- textLabel->setText(s);
-}
-
-void WarningDialog::setCaption(const QString &s)
-{
- QDialog::setCaption("VYM - "+s);
-}
diff -r a40af6315ac6 -r 3a58c9ef4a18 xml.cpp
--- a/xml.cpp Thu Sep 14 11:38:17 2006 +0000
+++ b/xml.cpp Thu Sep 14 11:38:18 2006 +0000
@@ -463,6 +463,21 @@
{
bool okx,oky;
int x,y;
+ if (!a.value( "relPosX").isEmpty() && loadMode==NewMap && branchDepth<2)
+ {
+ if (!a.value( "relPosY").isEmpty() )
+ {
+ x=a.value("relPosX").toInt (&okx, 10);
+ y=a.value("relPosY").toInt (&oky, 10);
+ if (okx && oky )
+ {
+ lastOO->setUseRelPos (true);
+ lastOO->move2RelPos (x,y);
+ }
+ else
+ return false; // Couldn't read relPos
+ }
+ }
if (!a.value( "absPosX").isEmpty() && loadMode==NewMap && branchDepth<2)
{
if (!a.value( "absPosY").isEmpty() )