# HG changeset patch # User insilmaril # Date 1223291420 0 # Node ID 7f43b93242aa53aad31c9ce2db3dc48a1c9f450d # Parent 7ea31701156edf93d8b43d9d8614d9a36e870dc3 Various fixes, also from 1.12. branch diff -r 7ea31701156e -r 7f43b93242aa animpoint.cpp --- a/animpoint.cpp Tue Aug 05 07:36:53 2008 +0000 +++ b/animpoint.cpp Mon Oct 06 11:10:20 2008 +0000 @@ -114,8 +114,12 @@ setY (destPos.y() ); return animated; } - setX (startPos.x() + vector.x()*sqrt(n/animTicks) ); - setY (startPos.y() + vector.y()*sqrt(n/animTicks) ); + + // Some math slow down the movement + qreal f=1-n/animTicks; + qreal ff=1-f*f*f; + setX (startPos.x() + vector.x()*ff ); + setY (startPos.y() + vector.y()*ff ); return animated; } diff -r 7ea31701156e -r 7f43b93242aa demos/vym-projectplan.vym Binary file demos/vym-projectplan.vym has changed diff -r 7ea31701156e -r 7f43b93242aa lang/vym_zh_CN.ts --- a/lang/vym_zh_CN.ts Tue Aug 05 07:36:53 2008 +0000 +++ b/lang/vym_zh_CN.ts Mon Oct 06 11:10:20 2008 +0000 @@ -1,9 +1,10 @@ + AboutDialog - + Ok Ok Button 确定 @@ -12,23 +13,23 @@ AboutTextBrowser - + Please use Settings-> 请使用 "设置"-> - + Set application to open an URL 设置用于打开 URL 的应用程序 - + Warning About window 警告 - + Couldn't find a viewer to open %1. About window @@ -41,12 +42,12 @@ AttributeDialog - Edit definitions - + 属性对话框 - 编辑定义 AttributeDialog - Edit %1 - + 属性对话框 - 编辑 %1 @@ -54,17 +55,17 @@ Attributes - + 属性 Add key - + 添加键 Close - 关闭 + 关闭 @@ -72,7 +73,7 @@ Form - + 表单 @@ -81,125 +82,125 @@ Property Editor Window caption - + 属性编辑器 Name Branchprop window: Attribute name - + Value Branchprop window: Attribute value - + Type Branchprop window: Attribute type - + 类型 Branch Property Editor - + 分支属性编辑器 Frame - + 边框 Geometry - + 几何 No Frame - 无边框 + 无边框 Rectangle - 矩形 + 矩形 Ellipse - + 椭圆 Padding - + 填充 Borderline width - + 边缘宽度 Colors - + 颜色 Borderline color - + 边缘颜色 Background color - + 背景颜色 Layout - + 布局 Include images horizontally - 在水平方向包含图象 + 在水平方向包含图象 Include images vertically - 在垂直方向包含图象 + 在垂直方向包含图象 Link - + 链接 Hide link if unselected - + 未选中时隐藏链接 Attributes - + 属性 + - + + - - + - Close - 关闭 + 关闭 @@ -283,7 +284,6 @@ 在该导图中保存设置 - showWarnings e.g. if directory is not empty 显示警告,例如当目录非空时 @@ -353,22 +353,18 @@ VYM - 导出 HTML 至目录 - VYM - Path to CSS file VYM - CSS 文件路径 - VYM - Path to XSL file VYM - XSL 文件路径 - VYM - Path to pre export script VYM - 预导出脚本路径 - VYM - Path to post export script VYM - 导出后脚本路径 @@ -400,7 +396,7 @@ show warnings of xslt processor - + 显示 XSLT 处理器的警告 @@ -474,7 +470,7 @@ New map - 新建导图 + 新建导图 @@ -490,7 +486,6 @@ 重做 - New Row 新行 @@ -582,7 +577,6 @@ 卷起分支 - Unscroll all 展开全部 @@ -607,7 +601,6 @@ 使用当前选定分支的标题作为 URL - Create URL to Bugzilla 创建至 Bugzilla 的 URL @@ -744,7 +737,6 @@ 直线链接样式 - Linkstyle Parabel 抛物线链接样式 @@ -764,17 +756,14 @@ 多股抛物线 - Linkstyle Thick Parabel 粗抛物线链接样式 - No Frame 无边框 - Rectangle 矩形 @@ -819,12 +808,10 @@ 缩小 - &Next Window 下一窗口(&N) - &Previous Window 上一窗口(&P) @@ -894,12 +881,10 @@ 新建 - Critical Load Error 严重载入错误 - Couldn't find a map (*.xml) in .vym archive. 无法在 .vym 存档中找到导图(*.xml)。 @@ -921,29 +906,24 @@ 导入:将选中项替换为 vym 导图 - Save Error 保存错误 - could not be removed before saving 无法在保存前删除 - compressed (vym default) 压缩(vym 默认) - uncompressed 未压缩 - Export XML to directory 导出 XML 至目录 @@ -983,7 +963,6 @@ 严重错误 - Couldn't find the documentation vym.pdf in various places. 无法在任何位置找到文档 vym.pdf。 @@ -1052,7 +1031,6 @@ 您希望新建一个吗? - The map %1 did not use the compressed vym file format. Writing it uncompressed will also write images @@ -1104,17 +1082,14 @@ 重做 - Create URL to FATE 创建至 FATE 的 URL - Include top and bottom position of images into branch 将图象上下位置包括进分支 - Include left and right position of images into branch 将图象左右位置包括进分支 @@ -1124,31 +1099,26 @@ 隐藏链接 - Note Systemflag 注解 - WWW Document (external) Systemflag WWW 文档(外部) - Link to another vym map Systemflag 至另一 vym 导图的链接 - subtree is scrolled Systemflag 子树已卷起 - subtree is temporary scrolled Systemflag 子树暂时卷起 @@ -1232,7 +1202,6 @@ 我不喜欢 - I just love... Standardflag 我就是爱…… @@ -1265,7 +1234,6 @@ KDE 书签 - Export as ASCII 导出为 ASCII @@ -1295,7 +1263,6 @@ 导出时隐藏对象 - Hide object in exported maps Systemflag 导出时将被隐藏的对象 @@ -1395,7 +1362,6 @@ 显示注解编辑器 - Show history window 显示历史窗口 @@ -1410,7 +1376,6 @@ 无法启动 %1 以打开一个新标签。 - Export map as image 将导图导出为图象 @@ -1448,14 +1413,12 @@ 打开子树中的所有链接 - Couldn't create temporary directory before load 无法在载入前创建临时目录 - Couldn't create temporary directory before save 无法在保存前创建临时目录 @@ -1466,7 +1429,6 @@ 对不起,当前只有 Konqueror 和 Mozilla 支持标签浏览。 - &New... File menu 新建(&N)... @@ -1722,7 +1684,6 @@ 卷起分支 - Unscroll all scrolled branches Edit menu 展开所有卷起的分支 @@ -1764,13 +1725,11 @@ 将标题作为 URL - Create URL to Bugzilla Edit menu 创建至 Bugzilla 的 URL - Create URL to FATE Edit menu 创建至 FATE 的 URL @@ -1914,24 +1873,20 @@ 着色子树(&T) - No Frame Branch attribute 无边框 - RectangleBranch attribute 举行分支属性 - Include images vertically Branch attribute 在垂直方向包含图象 - Include images horizontally Branch attribute 在水平方向包含图象 @@ -1979,19 +1934,16 @@ 显示注解编辑器 - Show history window View action 显示历史窗口 - Next Window View action 下一窗口 - Previous Window View action 上一窗口 @@ -2099,7 +2051,6 @@ 删除 - URLs and vymLinks Context menu name URL 以及 vym链接 @@ -2123,7 +2074,6 @@ 保存图象 - The directory %1 is not empty. Do you risk to overwrite its contents? write directory @@ -2134,497 +2084,499 @@ &New map File menu - + 新建导图(&N) &Copy to new map File menu - + 复制到新导图(&C) Copy selection to mapcenter of a new map Status tip File menu - + 复制选区到新导图的图心 Add mapcenter Canvas context menu - + 添加图心 Sort children Edit menu - + 子分支排序 Unscroll childs Edit menu - + 展开子分支 Unscroll all scrolled branches in selected subtree - + 在选择子树里展开所有卷起的分支 Edit local URL... Edit menu - + 编辑本地 URL... Edit local URL - + 编辑本地 URL Create URL to Novell Bugzilla Edit menu - + 创建至 Novell Bugzilla 的 URL Create URL to Novell Bugzilla - + 创建至 Novell Bugzilla 的 URL Create URL to Novell FATE Edit menu - + 创建至 Novell FATE 的 URL Create URL to Novell FATE - + 创建至 Novell FATE 的 URL Property window Dialog to edit properties of selection - + 属性窗口 Set properties for selection - + 设置选区属性 Linkstyle Curve - + 曲线链接样式 Linkstyle Thick Curve - + 粗曲线链接样式 Set &Link Color - + 设置链接颜色(&L) Set &Selection Color - + 设置选区颜色(&S) Set Selection Color - + 设置选区颜色 Set &Background image - + 设置背景图像(&B) Set Background image - + 设置背景图像 Show selection View action - + 显示选区 Show selection - + 显示选区 History Window View action - + 历史窗口 Show History Window - + 显示历史窗口 Antialiasing View action - + 反锯齿 Antialiasing - + 反锯齿 Smooth pixmap transformations View action - + 平滑位图变形 Next Map View action - + 下一导图 Previous Map View action - + 上一导图 Note SystemFlag - 注解 + 注解 URL to Document SystemFlag - + 到文档的 URL Link to another vym map SystemFlag - 至另一 vym 导图的链接 + 至另一 vym 导图的链接 subtree is scrolled SystemFlag - 子树已卷起 + 子树已卷起 subtree is temporary scrolled SystemFlag - 子树暂时卷起 + 子树暂时卷起 Hide object in exported maps SystemFlag - 导出时将被隐藏的对象 + 导出时将被隐藏的对象 I just love... Standardflag - + 我只是喜欢 ... Important Freemind-Flag - 重要 + 重要 Priority Freemind-Flag - + 优先级 Back Freemind-Flag - + 返回 Forward Freemind-Flag - + 前进 Look here Freemind-Flag - + 看这里 Dangerous Freemind-Flag - 危险 + 危险 Don't forget Freemind-Flag - + 不要忘记 Flag Freemind-Flag - + 标记 Home Freemind-Flag - + Telephone Freemind-Flag - + 电话 Music Freemind-Flag - + 音乐 Mailbox Freemind-Flag - + 邮箱 Maix Freemind-Flag - + Maix Password Freemind-Flag - + 密码 To be improved Freemind-Flag - + 将要改进 Stop Freemind-Flag - + 停止 Magic Freemind-Flag - + 神奇 To be discussed Freemind-Flag - + 将要讨论 Reminder Freemind-Flag - + 提醒 Excellent Freemind-Flag - + 优异 Linux Freemind-Flag - + Linux Sweet Freemind-Flag - + 甜蜜 Set path for macros Settings action - + 设置宏路径 Set path for macros - + 设置宏路径 Set number of undo levels Settings action - + 设置 undo 级 Set number of undo levels - + 设置 undo 级 Autosave Settings action - + 自动保存 Autosave - + 自动保存 Autosave time Settings action - + 自动保存时间 Autosave time - + 自动保存时间 Write backup file on save Settings action - + 保存时备份 Write backup file on save - + 保存时备份 Animation Settings action - + 动画 Animation - + 动画 Open VYM example maps Help action - + 打开 VYM 的例子导图 Open VYM example maps - + 打开 VYM 的例子导图 References (URLs, vymLinks, ...) Context menu name - + 引用 (URL, vym链接...) &%1 %2 - + &%1 %2 Load Freemind map - + 导入 Freemid 导图 Export as CSV - + 导出为 CSV Directory with vym macros: - + vym宏的目录: QInputDialog::getInteger() - + QInputDialog::getInteger() Number of undo/redo levels: - + 撤消级别 : Settings have been changed. The next map opened will have "%1" undo/redo levels - + 设置已更改。下一个导图将有 %1 个撤消级别 Number of seconds before autosave: - + 自动保存的秒数: History for %1 Window Caption - + %1 的历史 Couldn't find the documentation %1 in: %2 - + 在: +%2 中找不到%1 的文档 Load vym example map - + 载入 vym 例子导图 Couldn't find a macro at %1. - + 在 %1 不能找到宏 + Set directory for vym macros - + 设置宏目录 @@ -2660,7 +2612,6 @@ 请输入 URL: - vym map vym 导图 @@ -2675,7 +2626,6 @@ 严重导入错误 - New Map Heading of mapcenter in new map 新建导图 @@ -2718,7 +2668,6 @@ 未命名 - History for 历史 @@ -2752,20 +2701,20 @@ Critical Load Error - 严重载入错误 + 严重载入错误 Couldn't create temporary directory before load - 无法在载入前创建临时目录 + 无法在载入前创建临时目录 Couldn't find a map (*.xml) in .vym archive. - 无法在 .vym 存档中找到导图(*.xml)。 + 无法在 .vym 存档中找到导图(*.xml)。 @@ -2776,7 +2725,7 @@ and flags and thus may overwrite files in the given directory Do you want to write the map - 导图 %1 + 导图 %1 未使用 vym 压缩文件格式。 如果写入的话,图象与标记都会写入,这可能导致 指定目录中的文件被覆盖。 @@ -2786,91 +2735,93 @@ compressed (vym default) - 压缩(vym 默认) + 压缩(vym 默认) uncompressed - 未压缩 + 未压缩 Save Error - 保存错误 + 保存错误 %1 could not be removed before saving - + %1 +在保存时不能移除 %1 could not be renamed before saving - + %1 +在保存时不能重命名 Couldn't create temporary directory before save - 无法在保存前创建临时目录 + 无法在保存前创建临时目录 Export map as image - 将导图导出为图象 + 将导图导出为图象 Export XML to directory - 导出 XML 至目录 + 导出 XML 至目录 Autosave disabled during undo. - + 在撤消时禁用自动保存。 Load background image - + 载入背景图像 Text Filedialog - + 文本 Spreadsheet Filedialog - + 电子表格 Textdocument Filedialog - + 文本文档 Images Filedialog - 图象 + 图象 Set URL to a local file - + 设置到本地文档的 URL %1 items on map Info about map - + 在导图上的 %1 条目 @@ -2879,23 +2830,27 @@ %1 Do you want to reload that map with the new file? - + 在磁盘上的导图文件发生了更改: + +%1 + +您想要从新文件中重新载入吗? Reload - + 重新载入 Ignore - + 忽略 QObject - + This is not an image. 这不是图象。 @@ -2942,7 +2897,7 @@ zip 未正常退出 - + Couldn't start unzip to decompress data. 无法启动 unzip 以解压数据。 @@ -2978,7 +2933,7 @@ 取消 - + Sorry, no preview for multiple selected files. 对不起,无法预览 @@ -3022,26 +2977,27 @@ Export as ASCII - 导出为 ASCII + 导出为 ASCII (still experimental) - (仍处于试验阶段) + (仍处于试验阶段) The directory %1 is not empty. Do you risk to overwrite its contents? write directory - 目录 %1 非空。 + 目录 %1 非空。 您希望冒险覆盖其内容吗? Couldn't open %1. - + 不能打开 %1. + @@ -3062,7 +3018,7 @@ Save script - + 保存脚本 @@ -3070,79 +3026,81 @@ exists already. Do you want to overwrite it? dialog 'save as' - 文件 %1 已存在。 + 文件 %1 +已存在。 您希望覆盖它吗? Overwrite - 覆盖 + 覆盖 Cancel - 取消 + 取消 Load script - + 加载脚本 Error - 错误 + 错误 Couldn't open %1. - + 不能打开 %1. + Simple Script Editor - + 简单脚本编辑器 Save as - + 另存为 Save - 保存 + 保存 Qt::CTRL + Qt::Key_S - + Qt::CTRL + Qt::Key_S Open - 打开 + 打开 Qt::CTRL +Qt::Key_O - + Qt::CTRL +Qt::Key_O Run - + 运行 Qt::CTRL + Qt::Key_R - + Qt::CTRL + Qt::Key_R Close - 关闭 + 关闭 @@ -3483,7 +3441,7 @@ showAgainBox - 再次提醒 + 再次提醒 @@ -3498,12 +3456,12 @@ Proceed - 进行 + 进行 Show this message again - + 再次显示这条消息 diff -r 7ea31701156e -r 7f43b93242aa linkablemapobj.cpp --- a/linkablemapobj.cpp Tue Aug 05 07:36:53 2008 +0000 +++ b/linkablemapobj.cpp Mon Oct 06 11:10:20 2008 +0000 @@ -99,6 +99,9 @@ // Reset ID objID=""; + + // Crossreference to treemodel + treeItem=NULL; } void LinkableMapObj::copy (LinkableMapObj* other) @@ -111,6 +114,17 @@ relPos=other->relPos; useOrientation=other->useOrientation; objID=other->objID; + treeItem=other->treeItem; +} + +void LinkableMapObj::setTreeItem (TreeItem *ti) +{ + treeItem=ti; +} + +TreeItem* LinkableMapObj::getTreeItem () +{ + return treeItem; } void LinkableMapObj::setModel (VymModel *vm) diff -r 7ea31701156e -r 7f43b93242aa linkablemapobj.h --- a/linkablemapobj.h Tue Aug 05 07:36:53 2008 +0000 +++ b/linkablemapobj.h Mon Oct 06 11:10:20 2008 +0000 @@ -5,6 +5,7 @@ #include "noteobj.h" #include "headingobj.h" #include "flagrowobj.h" +#include "treeitem.h" #define MAX_DEPTH 999 @@ -57,6 +58,8 @@ virtual void init (); virtual void copy (LinkableMapObj*); + virtual void setTreeItem(TreeItem *); + virtual TreeItem* getTreeItem(); virtual void setModel (VymModel *vm); virtual VymModel* getModel (); @@ -166,5 +169,7 @@ bool useOrientation; QString objID; // id set during load/save currently used for xLinks + + TreeItem *treeItem; // Crossrefence to treemodel }; #endif diff -r 7ea31701156e -r 7f43b93242aa mainwindow.cpp --- a/mainwindow.cpp Tue Aug 05 07:36:53 2008 +0000 +++ b/mainwindow.cpp Mon Oct 06 11:10:20 2008 +0000 @@ -1719,11 +1719,14 @@ VymView *Main::createView (VymModel *model) { - VymView *vm=new VymView; - + VymView *vm=new VymView (model); + +/* // Create TreeView QTreeView *tv=new QTreeView; - tv->setModel (model->getTreeModel() ); + tv->setModel (model); + tv->setMinimumWidth (350); + tv->setColumnWidth (0,350); // Create good old MapEditor MapEditor* me=model->getMapEditor(); @@ -1741,6 +1744,7 @@ sizes.append (600); vm->setSizes (sizes); +*/ return vm; } diff -r 7ea31701156e -r 7f43b93242aa mainwindow.h --- a/mainwindow.h Tue Aug 05 07:36:53 2008 +0000 +++ b/mainwindow.h Mon Oct 06 11:10:20 2008 +0000 @@ -11,10 +11,7 @@ #include "mapeditor.h" #include "simplescripteditor.h" #include "texteditor.h" - -class VymView : public QSplitter -{ -}; +#include "vymview.h" class Main : public QMainWindow { diff -r 7ea31701156e -r 7f43b93242aa mapeditor.cpp --- a/mapeditor.cpp Tue Aug 05 07:36:53 2008 +0000 +++ b/mapeditor.cpp Mon Oct 06 11:10:20 2008 +0000 @@ -267,7 +267,7 @@ QString("%1 (\"%2\")").arg(u).arg(f), bo, QString("%1 (\"%2\")").arg(r).arg(f), - QString("Toggling standard flag \"%1\" of %2").arg(f).arg(getName(bo))); + QString("Toggling standard flag \"%1\" of %2").arg(f).arg(model->getObjectName(bo))); bo->toggleStandardFlag (f,mainWindow->useFlagGroups()); model->updateSelection(); } @@ -652,7 +652,7 @@ "moveRel "+pold, fio, "moveRel "+pnow, - QString("Move %1 to relative position %2").arg(getName(fio)).arg(pnow)); + QString("Move %1 to relative position %2").arg(model->getObjectName(fio)).arg(pnow)); fio->getParObj()->requestReposition(); model->reposition(); @@ -774,7 +774,7 @@ tmpXLink->setEnd ( ((BranchObj*)(dst)) ); tmpXLink->updateXLink(); tmpXLink->activate(); //FIXME savestate missing - //model->saveStateComplete(QString("Activate xLink from %1 to %2").arg(getName(tmpXLink->getBegin())).arg(getName(tmpXLink->getEnd())) ); + //model->saveStateComplete(QString("Activate xLink from %1 to %2").arg(model->getObjectName(tmpXLink->getBegin())).arg(model->getObjectName(tmpXLink->getEnd())) ); } else { delete(tmpXLink); @@ -797,7 +797,7 @@ "moveRel "+pold, fo, "moveRel "+pnow, - QString("Move %1 to relative position %2").arg(getName(fo)).arg(pnow)); + QString("Move %1 to relative position %2").arg(model->getObjectName(fo)).arg(pnow)); fo->getParObj()->requestReposition(); model->reposition(); @@ -822,7 +822,7 @@ "move "+pold, bo, "move "+pnow, - QString("Move mapcenter %1 to position %2").arg(getName(bo)).arg(pnow)); + QString("Move mapcenter %1 to position %2").arg(model->getObjectName(bo)).arg(pnow)); } } @@ -880,7 +880,7 @@ model->saveState ( postSelStr,undoCom, preSelStr, redoCom, - QString("Relink %1 to %2").arg(getName(bsel)).arg(getName(dst)) ); + QString("Relink %1 to %2").arg(model->getObjectName(bsel)).arg(model->getObjectName(dst)) ); model->reposition(); // not necessary if we undo temporary move below } else @@ -900,7 +900,7 @@ model->saveState( model->getSelectString(lmosel), "moveRel "+qpointfToString(movingObj_orgRelPos), preSelStr, "moveRel "+ps, - QString("Move %1 to relative position %2").arg(getName(lmosel)).arg(ps)); + QString("Move %1 to relative position %2").arg(model->getObjectName(lmosel)).arg(ps)); } } @@ -1054,6 +1054,13 @@ } -// FIXME the following are not needed... -QString MapEditor::getName(const LinkableMapObj*) {return QString();} +void MapEditor::setSelectionModel (QItemSelectionModel *sm) +{ + selModel=sm; +} +QItemSelectionModel* MapEditor::selectionModel () +{ + return selModel; +} + diff -r 7ea31701156e -r 7f43b93242aa mapeditor.h --- a/mapeditor.h Tue Aug 05 07:36:53 2008 +0000 +++ b/mapeditor.h Mon Oct 06 11:10:20 2008 +0000 @@ -2,10 +2,10 @@ #define MAPEDITOR_H #include +#include #include "attribute.h" #include "ornamentedobj.h" -#include "selection.h" // FIXME should not be needed #include "settings.h" #include "vymmodel.h" @@ -92,8 +92,12 @@ QPoint exportOffset; // set before export, used in save - Selection xelection; // FIXME only here to get rid of some gcc errors... - QString getName(const LinkableMapObj*); // FIXME see above, renamed to getObjectName in VymModel... +public: + void setSelectionModel (QItemSelectionModel*); + QItemSelectionModel* selectionModel(); +private: + QItemSelectionModel* selModel; // we treat MapEditor as View here... + }; #endif diff -r 7ea31701156e -r 7f43b93242aa selection.cpp --- a/selection.cpp Tue Aug 05 07:36:53 2008 +0000 +++ b/selection.cpp Mon Oct 06 11:10:20 2008 +0000 @@ -3,7 +3,6 @@ #include "selection.h" #include "mainwindow.h" -#include "mapeditor.h" #include "vymmodel.h" @@ -186,6 +185,13 @@ return NULL; } +TreeItem* Selection::getBranchItem() +{ + BranchObj* bo=getBranch(); + if (bo) return bo->getTreeItem(); + return NULL; +} + FloatImageObj* Selection::getFloatImage() { if (!selectList.isEmpty()) diff -r 7ea31701156e -r 7f43b93242aa selection.h --- a/selection.h Tue Aug 05 07:36:53 2008 +0000 +++ b/selection.h Mon Oct 06 11:10:20 2008 +0000 @@ -5,6 +5,7 @@ #include #include +#include "treeitem.h" class BranchObj; class FloatImageObj; @@ -38,6 +39,7 @@ LinkableMapObj * first(); // first in selection list LinkableMapObj * single(); // NULL, if multiple selected BranchObj* getBranch(); + TreeItem* getBranchItem(); FloatImageObj* getFloatImage(); QString getSelectString(); diff -r 7ea31701156e -r 7f43b93242aa tex/vym.changelog --- a/tex/vym.changelog Tue Aug 05 07:36:53 2008 +0000 +++ b/tex/vym.changelog Mon Oct 06 11:10:20 2008 +0000 @@ -1,5 +1,15 @@ ------------------------------------------------------------------- -Sun Jul 27 16:37:24 CEST 2008 - uwe +Mon Oct 6 11:16:48 CEST 2008 - uwedr@suse.de + +- Bugfix: Updated chinese translation from Moligaloo + +------------------------------------------------------------------- +Sun Oct 5 16:58:32 CEST 2008 - uwedr@suse.de + +- Bugfix: No more segfault for "delete & keep childs" on MapCenter + +------------------------------------------------------------------- +Sun Jul 27 16:37:24 CEST 2008 - uwedr@suse.de - Bugfix: Animation timer didn't stop after animation was done, which caused high load diff -r 7ea31701156e -r 7f43b93242aa treeitem.cpp --- a/treeitem.cpp Tue Aug 05 07:36:53 2008 +0000 +++ b/treeitem.cpp Mon Oct 06 11:10:20 2008 +0000 @@ -6,6 +6,7 @@ { parentItem = parent; itemData = data; + lmo=NULL; } TreeItem::~TreeItem() @@ -38,9 +39,36 @@ return itemData.value(column); } -TreeItem *TreeItem::parent() +void TreeItem::setHeading (const QString s) { - return parentItem; + itemData[0]=s; +} + +QString TreeItem::getHeading () +{ + return itemData[0].toString(); +} + +void TreeItem::setType(const Type t) +{ + type=t; + itemData[1]=getTypeName(); +} + +TreeItem::Type TreeItem::getType() +{ + return type; +} + +QString TreeItem::getTypeName() +{ + switch (type) + { + case Undefined: return QString ("Undefined"); + case MapCenter: return QString ("MapCenter"); + case Branch: return QString ("Branch"); + default: return QString ("TreeItem::getTypeName no typename defined?!"); + } } int TreeItem::row() const @@ -50,3 +78,24 @@ return 0; } + +int TreeItem::column() const +{ + return 0; +} + +TreeItem *TreeItem::parent() +{ + return parentItem; +} + +LinkableMapObj* TreeItem::getLMO() +{ + return lmo; +} + +void TreeItem::setLMO(LinkableMapObj *l) +{ + lmo=l; +} + diff -r 7ea31701156e -r 7f43b93242aa treeitem.h --- a/treeitem.h Tue Aug 05 07:36:53 2008 +0000 +++ b/treeitem.h Mon Oct 06 11:10:20 2008 +0000 @@ -4,9 +4,12 @@ #include #include +class LinkableMapObj; + class TreeItem { public: + enum Type {Undefined,MapCenter,Branch}; TreeItem(const QList &data, TreeItem *parent = 0); ~TreeItem(); @@ -16,13 +19,27 @@ int childCount() const; int columnCount() const; QVariant data(int column) const; + void setHeading (const QString s); + QString getHeading(); + void setType (const Type t); + Type getType (); + QString getTypeName (); + int row() const; + int column() const; TreeItem *parent(); + // Relation to map objects in graphicsscene + LinkableMapObj* getLMO(); + void setLMO (LinkableMapObj*); + private: QList childItems; QList itemData; TreeItem *parentItem; + + Type type; + LinkableMapObj *lmo; }; #endif diff -r 7ea31701156e -r 7f43b93242aa treemodel.cpp --- a/treemodel.cpp Tue Aug 05 07:36:53 2008 +0000 +++ b/treemodel.cpp Mon Oct 06 11:10:20 2008 +0000 @@ -3,13 +3,16 @@ #include "treeitem.h" #include "treemodel.h" +TreeItem* TreeModel::itFirst=NULL; +TreeItem* TreeModel::itCur=NULL; + TreeModel::TreeModel(QObject *parent) : QAbstractItemModel(parent) { QList rootData; rootData << "Heading" << "Type" <<"Note"; rootItem = new TreeItem(rootData); - setupModelData(rootItem); + // setupModelData(rootItem); } TreeModel::~TreeModel() @@ -98,7 +101,158 @@ return parentItem->childCount(); } -void TreeModel::setupModelData(TreeItem *root) +TreeItem* TreeModel::first() +{ + itCur=NULL; + itFirst=rootItem; + return rootItem; +} + +TreeItem* TreeModel::next() +{ +/* + BranchObj *bo; + BranchObj *lmo; + BranchObj *po=(BranchObj*)parObj; + + if (branch.isEmpty()) + bo=NULL; + else + bo=branch.first(); + + if (!itCur) + { + // no itCur, we are just beginning + if (bo) + { + // we have children, return first one + itCur=this; + return bo; + } + else + { + // No children, so there is no next + itCur=this; + return NULL; + } + } + + // We have an itCur + if (itCur==po) + { // We come from parent + if (bo) + { + // there are children, go there + itCur=this; + return bo; + } + else + { // no children, try to go up again + if (po) + { + // go back to parent and try to find next there + itCur=this; + lmo=po->next(); + itCur=this; + return lmo; + + } + else + { + // can't go up, I am mapCenter, no next + itCur=NULL; + return NULL; + } + } + } + + // We don't come from parent, but from brother or children + + // Try to find last child, where we came from, in my own children + bool searching=true; + int i=0; + while (inext(); + itCur=this; + return lmo; + } + else + { + // can't go up, I am mapCenter + itCur=NULL; + return NULL; + } + } + } + + // couldn't find last child, it must be a nephew of mine + if (branch.size()>0) + { + // proceed with my first child + itCur=this; + return branch.first(); + } + else + { + // or go back to my parents + if (po) + { + // go up + itCur=this; + lmo=po->next(); + itCur=this; + return lmo; + } + else + { + // can't go up, I am mapCenter + itCur=NULL; + return NULL; + } + } + */ +} + +QModelIndex TreeModel::index (TreeItem* ti) +{ + return createIndex (ti->row(),ti->column(),ti); +} + +TreeItem* TreeModel::LMOToItem (LinkableMapObj *lmo)// FIXME not used so far!!! +{ + TreeItem *ti=rootItem; +} + +void TreeModel::setupModelData(TreeItem *root) // FIXME not needed anymore { QList cData; @@ -125,6 +279,4 @@ cData.clear(); cData << "Main B"<<"Branch" <<"Data 3"; mco->appendChild(new TreeItem(cData, mco)); - - //QModelIndex ix=index (0,0,QModelIndex() ); } diff -r 7ea31701156e -r 7f43b93242aa treemodel.h --- a/treemodel.h Tue Aug 05 07:36:53 2008 +0000 +++ b/treemodel.h Mon Oct 06 11:10:20 2008 +0000 @@ -5,7 +5,9 @@ #include #include + class TreeItem; +class LinkableMapObj; class TreeModel : public QAbstractItemModel { @@ -25,10 +27,17 @@ int rowCount(const QModelIndex &parent = QModelIndex()) const; int columnCount(const QModelIndex &parent = QModelIndex()) const; -private: + TreeItem *first(); + TreeItem *next(); + +protected: + QModelIndex index (TreeItem* ti); + TreeItem *LMOToItem(LinkableMapObj*); void setupModelData(TreeItem *parent); TreeItem *rootItem; + static TreeItem* itFirst; + static TreeItem* itCur; }; #endif diff -r 7ea31701156e -r 7f43b93242aa version.h --- a/version.h Tue Aug 05 07:36:53 2008 +0000 +++ b/version.h Mon Oct 06 11:10:20 2008 +0000 @@ -7,7 +7,7 @@ #define __VYM_VERSION "1.13.0" //#define __VYM_CODENAME "Codename: RC-1" #define __VYM_CODENAME "Codename: development version" -#define __VYM_BUILD_DATE "2008-08-05" +#define __VYM_BUILD_DATE "2008-09-10" bool checkVersion(const QString &); diff -r 7ea31701156e -r 7f43b93242aa vym.pro --- a/vym.pro Tue Aug 05 07:36:53 2008 +0000 +++ b/vym.pro Mon Oct 06 11:10:20 2008 +0000 @@ -76,6 +76,7 @@ settings.h \ treeitem.h \ treemodel.h \ + vymview.h \ warningdialog.h SOURCES += \ @@ -132,6 +133,7 @@ xmlobj.cpp \ xsltproc.cpp \ settings.cpp \ + vymview.cpp \ warningdialog.cpp FORMS = \ diff -r 7ea31701156e -r 7f43b93242aa vymmodel.cpp --- a/vymmodel.cpp Tue Aug 05 07:36:53 2008 +0000 +++ b/vymmodel.cpp Mon Oct 06 11:10:20 2008 +0000 @@ -17,6 +17,7 @@ #include "warningdialog.h" #include "xml-freemind.h" +#include "xmlobj.h" #include "xml-vym.h" @@ -118,9 +119,6 @@ itFind=NULL; EOFind=false; - // TreeModel - treeModel=new TreeModel; - // animations animationUse=settings.readBoolEntry("/animation/use",false); animationTicks=settings.readNumEntry("/animation/ticks",10); @@ -164,11 +162,6 @@ return mapEditor; } -TreeModel* VymModel::getTreeModel() -{ - return treeModel; -} - bool VymModel::isRepositionBlocked() { return blockReposition; @@ -190,6 +183,9 @@ // offset offset of bbox of whole map in scene. // Needed for XML export + + XMLObj xml; + // Save Header QString ls; switch (linkstyle) @@ -211,22 +207,22 @@ QString s="\n"; QString colhint=""; if (linkcolorhint==LinkableMapObj::HeadingColor) - colhint=attribut("linkColorHint","HeadingColor"); - - QString mapAttr=attribut("version",vymVersion); + colhint=xml.attribut("linkColorHint","HeadingColor"); + + QString mapAttr=xml.attribut("version",vymVersion); if (!saveSel) - mapAttr+= attribut("author",author) + - attribut("comment",comment) + - attribut("date",getDate()) + - attribut("backgroundColor", mapScene->backgroundBrush().color().name() ) + - attribut("selectionColor", selection.getColor().name() ) + - attribut("linkStyle", ls ) + - attribut("linkColor", defLinkColor.name() ) + - attribut("defXLinkColor", defXLinkColor.name() ) + - attribut("defXLinkWidth", QString().setNum(defXLinkWidth,10) ) + + mapAttr+= xml.attribut("author",author) + + xml.attribut("comment",comment) + + xml.attribut("date",getDate()) + + xml.attribut("backgroundColor", mapScene->backgroundBrush().color().name() ) + + xml.attribut("selectionColor", selection.getColor().name() ) + + xml.attribut("linkStyle", ls ) + + xml.attribut("linkColor", defLinkColor.name() ) + + xml.attribut("defXLinkColor", defXLinkColor.name() ) + + xml.attribut("defXLinkWidth", QString().setNum(defXLinkWidth,10) ) + colhint; - s+=beginElement("vymmap",mapAttr); - incIndent(); + s+=xml.beginElement("vymmap",mapAttr); + xml.incIndent(); // Find the used flags while traversing the tree standardFlagsDefault->resetUsedCounter(); @@ -254,10 +250,10 @@ // Save selection if (!selection.isEmpty() && !saveSel ) - s+=valueElement("select",selection.getSelectString()); - - decIndent(); - s+=endElement("vymmap"); + s+=xml.valueElement("select",selection.getSelectString()); + + xml.decIndent(); + s+=xml.endElement("vymmap"); if (writeflags) standardFlagsDefault->saveToDir (tmpdir+"/flags/","",writeflags); @@ -1488,27 +1484,33 @@ "setHeading (\""+s+"\")", QString("Set heading of %1 to \"%2\"").arg(getObjectName(sel)).arg(s) ); sel->setHeading(s ); + TreeItem *ti=selection.getBranchItem(); + if (ti) ti->setHeading (s); + //FIXME ix is wrong ModelIndex below, ix2 is (hopefully) correct: + QModelIndex ix=index( ti->row(), ti->column(), index (0,0,QModelIndex()) ); + cout <<"VM::setHeading s="<row()<<","<column()<<")"<selectionModel(); + selectionModel->clear(); + QItemSelection sel (ix2,ix2); + selectionModel->select (sel, QItemSelectionModel::Select); + } + reposition(); selection.update(); ensureSelectionVisible(); } } -/* FIXME delete this -QString VymModel::getHeading(bool &ok, QPoint &p) -{ - BranchObj *bo=selection.getBranch(); - if (bo) - { - ok=true; - //p=scene->mapFromScene(bo->getAbsPos()); // FIXME this is view-dependant!!! - return bo->getHeading(); - } - ok=false; - return QString(); -} -*/ - void VymModel::setHeadingInt(const QString &s) { BranchObj *bo=selection.getBranch(); @@ -1962,6 +1964,36 @@ } } +void VymModel::createMapCenter() +{ + MapCenterObj *mco=addMapCenter (QPointF (0,0) ); + selection.select (mco); +} + +void VymModel::createBranch() +{ + BranchObj *bo=selection.getBranch(); + if (bo) + { + BranchObj *newbo=addNewBranchInt (-2); // FIXME Old model, merge with below + + // Create TreeItem + QList cData; + cData << "VM:createBranch" << "undef"<<"undef"; + TreeItem *parti=bo->getTreeItem(); + TreeItem *ti=new TreeItem (cData,parti); + ti->setLMO (newbo); + ti->setType (TreeItem::Branch); + parti->appendChild (ti); + + if (newbo) + { + newbo->setTreeItem (ti); + selection.select (newbo); + } + } +} + MapCenterObj* VymModel::addMapCenter () { MapCenterObj *mco=addMapCenter (contextPos); @@ -1986,6 +2018,16 @@ mapCenter->setHeading (QApplication::translate("Heading of mapcenter in new map", "New map")); mapCenter->setMapEditor(mapEditor); //FIXME needed to get defLinkStyle, mapLinkColorHint ... for later added objects mapCenters.append(mapCenter); + + // Create TreeItem + QList cData; + cData << "VM:addMapCenter" << "undef"<<"undef"; + TreeItem *ti=new TreeItem (cData,rootItem); + ti->setLMO (mapCenter); + ti->setType (TreeItem::MapCenter); + mapCenter->setTreeItem (ti); + rootItem->appendChild (ti); + return mapCenter; } @@ -2180,6 +2222,17 @@ if (bo) { par=(BranchObj*)(bo->getParObj()); + + // Don't use this on mapcenter + if (!par) return; + + // Check if we have childs at all to keep + if (bo->countBranches()==0) + { + deleteSelection(); + return; + } + QPointF p=bo->getRelPos(); saveStateChangingPart( bo->getParObj(), @@ -4704,6 +4757,21 @@ } } +void VymModel::selectParent() +{ + LinkableMapObj *lmo=selection.first(); + BranchObj* par; + if (lmo) + { + par=(BranchObj*)(lmo->getParObj()); + if (!par) return; + selection.select(par); + selection.update(); + ensureSelectionVisible(); + sendSelection(); + } +} + Selection::Type VymModel::selectionType() { return selection.type(); diff -r 7ea31701156e -r 7f43b93242aa vymmodel.h --- a/vymmodel.h Tue Aug 05 07:36:53 2008 +0000 +++ b/vymmodel.h Mon Oct 06 11:10:20 2008 +0000 @@ -9,14 +9,10 @@ #include "mapeditor.h" #include "parser.h" #include "selection.h" +#include "treeitem.h" #include "treemodel.h" -#include "xmlobj.h" - -/*! \brief This will later be divided into Model/View -*/ - -class VymModel : public QObject, public XMLObj { +class VymModel : public TreeModel { Q_OBJECT //////////////////////////////////////////// @@ -39,11 +35,6 @@ MapEditor* getMapEditor(); // FIXME not necessary -private: - TreeModel* treeModel; -public: - TreeModel* getTreeModel(); - bool isRepositionBlocked(); //!< While load or undo there is no need to update graphicsview void updateActions(); //!< Update buttons in mainwindow @@ -288,6 +279,10 @@ void moveBranchDown(); //!< Move branch down void sortChildren(); //!< Sort children lexically + // The create methods are used to quickly parse a XML file + void createMapCenter(); //!< Create and select MapCenter + void createBranch(); //!< Create and select Branch + /*! \brief Add new mapcenter Disclaimer: Still experimental, not fully supported yet. @@ -552,6 +547,7 @@ void selectRightBranch(); void selectFirstBranch(); void selectLastBranch(); + void selectParent(); public: Selection::Type selectionType(); diff -r 7ea31701156e -r 7f43b93242aa vymview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vymview.cpp Mon Oct 06 11:10:20 2008 +0000 @@ -0,0 +1,39 @@ +#include "vymview.h" + +#include "mapeditor.h" + +VymView::VymView(VymModel *model) +{ + // Create TreeView + QTreeView *treeview=new QTreeView; + treeview->setModel ((QAbstractItemModel*)model); + treeview->setMinimumWidth (350); + treeview->setColumnWidth (0,350); + + // Create good old MapEditor + MapEditor* me=model->getMapEditor(); + if (!me) me=new MapEditor (model); + + me->setSelectionModel (treeview->selectionModel() ); + + //me->viewport()->setFocus(); + //FIXME me->setAntiAlias (actionViewToggleAntiAlias->isOn()); + //FIXME me->setSmoothPixmap(actionViewToggleSmoothPixmapTransform->isOn()); + + addWidget (treeview); + addWidget (me); + + // Set geometry + QList sizes; + sizes.append (150); + sizes.append (600); + setSizes (sizes); +} + +QItemSelectionModel* VymView::selectionModel() +{ + if (treeview) return treeview->selectionModel(); + return NULL; +} + + diff -r 7ea31701156e -r 7f43b93242aa vymview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vymview.h Mon Oct 06 11:10:20 2008 +0000 @@ -0,0 +1,22 @@ +#ifndef VYMVIEW_H +#define VYMVIEW_H + +#include +#include +#include + +class VymModel; + + +class VymView : public QSplitter +{ +public: + VymView(VymModel *model); + QItemSelectionModel* selectionModel(); +private: + QTreeView *treeview; +}; + + +#endif + diff -r 7ea31701156e -r 7f43b93242aa xml-vym.cpp --- a/xml-vym.cpp Tue Aug 05 07:36:53 2008 +0000 +++ b/xml-vym.cpp Mon Oct 06 11:10:20 2008 +0000 @@ -18,15 +18,6 @@ extern Settings settings; extern QString vymVersion; -/* -parseVYMHandler::parseVYMHandler() {} - -parseVYMHandler::~parseVYMHandler() {} - -QString parseVYMHandler::errorProtocol() { return errorProt; } - -*/ - bool parseVYMHandler::startDocument() { errorProt = ""; @@ -39,18 +30,6 @@ return true; } - -/* -QString parseVYMHandler::parseHREF(QString href) -{ - QString type=href.section(":",0,0); - QString path=href.section(":",1,1); - if (!tmpDir.endsWith("/")) - return tmpDir + "/" + path; - else - return tmpDir + path; -} -*/ bool parseVYMHandler::startElement ( const QString&, const QString&, const QString& eName, const QXmlAttributes& atts ) { @@ -144,7 +123,8 @@ { // Really use the found mapcenter as MCO in a new map - lastBranch=model->addMapCenter(); + model->createMapCenter(); + lastBranch=model->getSelectedBranch(); } else { // Treat the found mapcenter as a branch @@ -156,8 +136,8 @@ lastBranch=(BranchObj*)lmo; if (loadMode==ImportAdd) { - lastBranch->addBranch(); - lastBranch=lastBranch->getLastBranch(); + model->createBranch(); + lastBranch=model->getSelectedBranch(); } else lastBranch->clear(); } else @@ -216,8 +196,8 @@ state=StateBranch; if (loadMode==ImportAdd) { - lastBranch->addBranch(); - lastBranch=lastBranch->getLastBranch(); + model->createBranch(); + lastBranch=model->getSelectedBranch(); } else lastBranch->clear(); @@ -233,8 +213,8 @@ } else if ( eName == "branch" && state == StateMapCenter) { state=StateBranch; - lastBranch->addBranch(); - lastBranch=lastBranch->getLastBranch(); + model->createBranch(); + lastBranch=model->getSelectedBranch(); readBranchAttr (atts); } else if ( eName == "htmlnote" && state == StateBranch) { @@ -254,8 +234,8 @@ if (!readXLinkAttr (atts)) return false; } else if ( eName == "branch" && state == StateBranch ) { - lastBranch->addBranch(); - lastBranch=lastBranch->getLastBranch(); + model->createBranch(); + lastBranch=model->getSelectedBranch(); readBranchAttr (atts); } else if ( eName == "html" && state == StateHtmlNote ) { @@ -286,7 +266,8 @@ switch ( state ) { case StateBranch: - lastBranch=(BranchObj*)(lastBranch->getParObj()); + model->selectParent(); + lastBranch=model->getSelectedBranch(); break; case StateHtml: htmldata+=""; @@ -335,7 +316,7 @@ htmldata+=ch_org; break; case StateHeading: - lastBranch->setHeading(ch_simplified); + model->setHeading(ch_simplified); break; default: return false;