- fixed a connection/logic bug in the editor MainWindow
authorAkiko <akiko@linux-addicted.net>
Fri, 11 Oct 2013 08:19:15 +0000 (10:19 +0200)
committerAkiko <akiko@linux-addicted.net>
Fri, 11 Oct 2013 08:19:15 +0000 (10:19 +0200)
- the editor TextWindow now works like a real text editor
- fixed a really ulgy bug in NCFile (qCompress/qDecompress looks broken in Qt5)
- updated language files (English and German)
- fixed two stupid bugs in NCFilesystem

editor/MainWindow.cxx
editor/MainWindow.hxx
editor/TextWindow.cxx
editor/TextWindow.hxx
editor/TextWindow.ui
editor/i18n_english.ts
editor/i18n_french.ts
editor/i18n_german.ts
engine/GLWidget.cxx
filesystem/NCFile.cxx
filesystem/NCFilesystem.cxx

index b21bb5e..796c333 100644 (file)
@@ -390,6 +390,9 @@ void MainWindow::slotTableStatus(quint32 from_row, quint32 to_row, ColType cols)
     // table item
     if (to_row != static_cast<quint32>(table->rowCount()))
     {
+        disconnect(table, SIGNAL(cellChanged(qint32, qint32)),
+                   this, SLOT(slotTableChange(qint32)));
+
         table->setRowCount(to_row);
         for (quint32 row = 0; row < to_row; ++row)
         {
@@ -481,9 +484,6 @@ void MainWindow::slotTableStatus(quint32 from_row, quint32 to_row, ColType cols)
                     it6->setBackground(Grey);
             }
 
-            disconnect(table, SIGNAL(cellChanged(qint32, qint32)),
-                       this, SLOT(slotTableChange(qint32)));
-
             table->setItem(row, 0, it0);
             table->setItem(row, 1, it1);
             table->setItem(row, 2, it2);
@@ -491,10 +491,9 @@ void MainWindow::slotTableStatus(quint32 from_row, quint32 to_row, ColType cols)
             table->setItem(row, 4, it4);
             table->setItem(row, 5, it5);
             table->setItem(row, 6, it6);
-
-            connect(table, SIGNAL(cellChanged(qint32, qint32)),
-                    this, SLOT(slotTableChange(qint32)));
         }
+        connect(table, SIGNAL(cellChanged(qint32, qint32)),
+                this, SLOT(slotTableChange(qint32)));
     }
     else
     {
@@ -621,6 +620,8 @@ void MainWindow::slotTableAdd(NCFile& entry, quint32 row)
 
     connect(table, SIGNAL(cellChanged(qint32, qint32)),
             this, SLOT(slotTableChange(qint32)));
+
+    setMode(Mode::Edited);
 }
 
 void MainWindow::slotTableReplace(NCFile& entry, quint32 row)
@@ -664,7 +665,12 @@ void MainWindow::slotTableRemove(quint32 row)
     setMode(Mode::Edited);
 }
 
-void MainWindow::slotTableIgnored()
+void MainWindow::slotEntryReplace(NCFile& entry, quint32 row)
+{
+    _vfs->fileReplace(entry, row);
+}
+
+void MainWindow::slotEntryIgnore()
 {
     _ui->wid_stack->setCurrentIndex(0);
     setMode(Mode::Edited);
@@ -887,27 +893,27 @@ void MainWindow::setupActions()
 
     // image viewer connections
     connect(_img, SIGNAL(sigImageUpdate(NCFile&, quint32)),
-            this, SLOT(slotTableReplace(NCFile&, quint32)));
+            this, SLOT(slotEntryReplace(NCFile&, quint32)));
     connect(_img, SIGNAL(sigImageIgnored()),
-            this, SLOT(slotTableIgnored()));
+            this, SLOT(slotEntryIgnore()));
 
     // text viewer connections
     connect(_txt, SIGNAL(sigTextUpdate(NCFile&, quint32)),
-            this, SLOT(slotTableReplace(NCFile&, quint32)));
+            this, SLOT(slotEntryReplace(NCFile&, quint32)));
     connect(_txt, SIGNAL(sigTextIgnored()),
-            this, SLOT(slotTableIgnored()));
+            this, SLOT(slotEntryIgnore()));
 
     // dat viewer connections
     connect(_dat, SIGNAL(sigDatUpdate(NCFile&, quint32)),
-            this, SLOT(slotTableReplace(NCFile&, quint32)));
+            this, SLOT(slotEntryReplace(NCFile&, quint32)));
     connect(_dat, SIGNAL(sigDatIgnored()),
-            this, SLOT(slotTableIgnored()));
+            this, SLOT(slotEntryIgnore()));
 
     // object viewer connections
     connect(_obj, SIGNAL(sigObjectUpdate(NCFile&, quint32)),
-            this, SLOT(slotTableReplace(NCFile&, quint32)));
+            this, SLOT(slotEntryReplace(NCFile&, quint32)));
     connect(_obj, SIGNAL(sigObjectIgnored()),
-            this, SLOT(slotTableIgnored()));
+            this, SLOT(slotEntryIgnore()));
 
     // context menus for the QTableWidget
     ctx_sep1->setSeparator(true);
index 87ac81d..dded375 100644 (file)
@@ -81,7 +81,9 @@ public slots:
     void slotTableAdd(NCFile& entry, quint32 row);
     void slotTableReplace(NCFile& entry, quint32 row);
     void slotTableRemove(quint32 row);
-    void slotTableIgnored();
+
+    void slotEntryReplace(NCFile& entry, quint32 row);
+    void slotEntryIgnore();
 
 protected:
     // protected stuff
index 22e1bbf..3ba7bff 100644 (file)
@@ -8,8 +8,7 @@
 // --- constructors and deconstructors ---
 
 TextWindow::TextWindow(QWidget *parent)
-: QMainWindow(parent), _ui(new Ui::TextWindow), _def(new DefSyntax(this)), _fx(new FxSyntax(this)),
-  _ini(new IniSyntax(this)), _num(0)
+: QMainWindow(parent), _ui(new Ui::TextWindow), _syn(0), _num(0)
 {
     _ui->setupUi(this);
 
@@ -19,9 +18,7 @@ TextWindow::TextWindow(QWidget *parent)
 
 TextWindow::~TextWindow()
 {
-    delete _ini;
-    delete _fx;
-    delete _def;
+    delete _syn;
     delete _ui;
 }
 
@@ -29,14 +26,16 @@ TextWindow::~TextWindow()
 
 void TextWindow::slotTextSave()
 {
-    _entry.setOData(_ui->ed_text->toPlainText().toLocal8Bit());
-    _entry.setOSize(_ui->ed_text->toPlainText().toLocal8Bit().size());
+    _entry.setOData(_ui->ed_text->toPlainText().toLatin1());
+    _entry.setOSize(_ui->ed_text->toPlainText().toLatin1().size());
     _entry.setCSize(_entry.cData().size());
     _entry.setName(_ui->ed_name->text());
     _entry.setNameLength(_entry.name().size() + 1);
     _entry.setHSize(_entry.headerSize() + _entry.nameLength());
 
     emit sigTextUpdate(_entry, _num);
+
+    setMode(Mode::Fresh);
 }
 
 void TextWindow::slotTextDiscard()
@@ -46,26 +45,40 @@ void TextWindow::slotTextDiscard()
     _ui->ed_text->clear();
 
     emit sigTextIgnored();
+
+    setMode(Mode::Fresh);
+}
+
+void TextWindow::slotEditDelete()
+{
+    _ui->ed_text->textCursor().removeSelectedText();
 }
 
 void TextWindow::slotTextView(NCFile& entry, quint32 row)
 {
     _entry = entry;
     _num = row;
-    _def->setDocument(0);
+
     _ui->ed_text->setPlainText(entry.oData());
     _ui->ed_name->setText(entry.name());
     _ui->ed_lines->setText(QString::number(_ui->ed_text->document()->lineCount()));
     _ui->ed_size->setText(QString::number(_ui->ed_text->toPlainText().size()));
 
+    delete _syn;
+
     if (entry.name().contains(".def", Qt::CaseInsensitive))
-        _def->setDocument(_ui->ed_text->document());
+        _syn = new DefSyntax(_ui->ed_text->document());
 
     if (entry.name().contains(".fx", Qt::CaseInsensitive))
-        _fx->setDocument(_ui->ed_text->document());
+        _syn = new FxSyntax(_ui->ed_text->document());
 
     if (entry.name().contains(".ini", Qt::CaseInsensitive))
-        _ini->setDocument(_ui->ed_text->document());
+        _syn = new IniSyntax(_ui->ed_text->document());
+}
+
+void TextWindow::slotTextChanged()
+{
+    setMode(Mode::Edited);
 }
 
 // --- protected methods ---
@@ -95,8 +108,48 @@ void TextWindow::setMode(const Mode mode)
 
 void TextWindow::setupActions()
 {
+    QAction *ctx_sep1 = new QAction(this);
+    QAction *ctx_sep2 = new QAction(this);
+
+    // file stuff
     connect(_ui->act_text_save, SIGNAL(triggered()),
             this, SLOT(slotTextSave()));
     connect(_ui->act_text_cancel, SIGNAL(triggered()),
             this, SLOT(slotTextDiscard()));
+
+    // edit stuff
+    connect(_ui->act_edit_undo, SIGNAL(triggered()),
+            _ui->ed_text, SLOT(undo()));
+    connect(_ui->act_edit_redo, SIGNAL(triggered()),
+            _ui->ed_text, SLOT(redo()));
+    connect(_ui->act_edit_cut, SIGNAL(triggered()),
+            _ui->ed_text, SLOT(cut()));
+    connect(_ui->act_edit_copy, SIGNAL(triggered()),
+            _ui->ed_text, SLOT(copy()));
+    connect(_ui->act_edit_insert, SIGNAL(triggered()),
+            _ui->ed_text, SLOT(paste()));
+    connect(_ui->act_edit_delete, SIGNAL(triggered()),
+            this, SLOT(slotEditDelete()));
+    connect(_ui->act_edit_selall, SIGNAL(triggered()),
+            _ui->ed_text, SLOT(selectAll()));
+
+    // recognize changes
+    connect(_ui->ed_text, SIGNAL(textChanged()),
+            this, SLOT(slotTextChanged()));
+
+    // context menu
+    ctx_sep1->setSeparator(true);
+    ctx_sep2->setSeparator(true);
+
+    _ui->ed_text->addAction(_ui->act_edit_undo);
+    _ui->ed_text->addAction(_ui->act_edit_redo);
+    _ui->ed_text->addAction(ctx_sep1);
+    _ui->ed_text->addAction(_ui->act_edit_cut);
+    _ui->ed_text->addAction(_ui->act_edit_copy);
+    _ui->ed_text->addAction(_ui->act_edit_insert);
+    _ui->ed_text->addAction(_ui->act_edit_delete);
+    _ui->ed_text->addAction(_ui->act_edit_selall);
+    _ui->ed_text->addAction(ctx_sep2);
+    _ui->ed_text->addAction(_ui->act_text_save);
+    _ui->ed_text->addAction(_ui->act_text_cancel);
 }
index e4823f8..f6b09e7 100644 (file)
@@ -7,9 +7,7 @@ namespace Ui
 {
     class TextWindow;
 }
-class DefSyntax;
-class FxSyntax;
-class IniSyntax;
+class QSyntaxHighlighter;
 
 class TextWindow : public QMainWindow {
     Q_OBJECT
@@ -32,7 +30,10 @@ public slots:
     void slotTextSave();
     void slotTextDiscard();
 
+    void slotEditDelete();
+
     void slotTextView(NCFile& entry, quint32 row);
+    void slotTextChanged();
 
 protected:
     virtual void changeEvent(QEvent *event);
@@ -41,9 +42,7 @@ protected:
 
 private:
     Ui::TextWindow *_ui;
-    DefSyntax *_def;
-    FxSyntax *_fx;
-    IniSyntax *_ini;
+    QSyntaxHighlighter *_syn;
     NCFile _entry;
     quint32 _num;
 };
index 349800f..c04d836 100644 (file)
         </property>
         <item>
          <widget class="QTextEdit" name="ed_text">
+          <property name="contextMenuPolicy">
+           <enum>Qt::ActionsContextMenu</enum>
+          </property>
           <property name="documentTitle">
            <string notr="true"/>
           </property>
-          <property name="readOnly">
-           <bool>true</bool>
-          </property>
           <property name="html">
            <string notr="true">&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
 &lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
@@ -160,7 +160,7 @@ p, li { white-space: pre-wrap; }
      <height>22</height>
     </rect>
    </property>
-   <widget class="QMenu" name="menuMM_TEXT">
+   <widget class="QMenu" name="mm_text">
     <property name="title">
      <string>MM-TEXT</string>
     </property>
@@ -168,7 +168,21 @@ p, li { white-space: pre-wrap; }
     <addaction name="separator"/>
     <addaction name="act_text_cancel"/>
    </widget>
-   <addaction name="menuMM_TEXT"/>
+   <widget class="QMenu" name="mm_edit">
+    <property name="title">
+     <string>MM-EDIT</string>
+    </property>
+    <addaction name="act_edit_undo"/>
+    <addaction name="act_edit_redo"/>
+    <addaction name="separator"/>
+    <addaction name="act_edit_cut"/>
+    <addaction name="act_edit_copy"/>
+    <addaction name="act_edit_insert"/>
+    <addaction name="act_edit_delete"/>
+    <addaction name="act_edit_selall"/>
+   </widget>
+   <addaction name="mm_text"/>
+   <addaction name="mm_edit"/>
   </widget>
   <action name="act_text_save">
    <property name="text">
@@ -180,6 +194,41 @@ p, li { white-space: pre-wrap; }
     <string>ME-TEXT-CANCEL</string>
    </property>
   </action>
+  <action name="act_edit_undo">
+   <property name="text">
+    <string>ME-EDIT-UNDO</string>
+   </property>
+  </action>
+  <action name="act_edit_redo">
+   <property name="text">
+    <string>ME-EDIT-REDO</string>
+   </property>
+  </action>
+  <action name="act_edit_cut">
+   <property name="text">
+    <string>ME-EDIT-CUT</string>
+   </property>
+  </action>
+  <action name="act_edit_copy">
+   <property name="text">
+    <string>ME-EDIT-COPY</string>
+   </property>
+  </action>
+  <action name="act_edit_insert">
+   <property name="text">
+    <string>ME-EDIT-INSERT</string>
+   </property>
+  </action>
+  <action name="act_edit_delete">
+   <property name="text">
+    <string>ME-EDIT-DELETE</string>
+   </property>
+  </action>
+  <action name="act_edit_selall">
+   <property name="text">
+    <string>ME-EDIT-SELALL</string>
+   </property>
+  </action>
  </widget>
  <resources/>
  <connections/>
index a22b50c..4e912d6 100644 (file)
     <message>
         <location filename="DatWindow.ui" line="41"/>
         <source>ME-DAT-SAVE</source>
-        <translation>Save dat changes</translation>
+        <translation>Save changes</translation>
     </message>
     <message>
         <location filename="DatWindow.ui" line="46"/>
         <source>ME-DAT-CANCEL</source>
-        <translation>Discard dat changes</translation>
+        <translation>Discard changes</translation>
     </message>
 </context>
 <context>
     <message>
         <location filename="MainWindow.ui" line="242"/>
         <source>ME-FILE-IMAGE</source>
-        <translation>View image ...</translation>
+        <translation>View image file ...</translation>
     </message>
     <message>
         <location filename="MainWindow.ui" line="247"/>
         <source>ME-FILE-TEXT</source>
-        <translation>View text ...</translation>
+        <translation>Edit text file ...</translation>
     </message>
     <message>
         <location filename="MainWindow.ui" line="252"/>
         <source>ME-FILE-DAT</source>
-        <translation>View dat ...</translation>
+        <translation>View dat file ...</translation>
     </message>
     <message>
         <location filename="MainWindow.ui" line="257"/>
         <source>ME-FILE-OBJECT</source>
-        <translation>View 3D object ...</translation>
+        <translation>View 3d object ...</translation>
     </message>
     <message>
-        <location filename="MainWindow.cxx" line="155"/>
-        <location filename="MainWindow.cxx" line="166"/>
+        <location filename="MainWindow.cxx" line="156"/>
+        <location filename="MainWindow.cxx" line="167"/>
         <source>DIA-OPEN-FILE</source>
         <translation>Open files ...</translation>
     </message>
     <message>
-        <location filename="MainWindow.cxx" line="119"/>
-        <location filename="MainWindow.cxx" line="139"/>
+        <location filename="MainWindow.cxx" line="120"/>
+        <location filename="MainWindow.cxx" line="140"/>
         <source>FLT-FILE-VFS</source>
         <oldsource>DIA-SAVE-FILE</oldsource>
         <translation>Neocron VFS file (*.vfs *.pak)</translation>
     </message>
     <message>
-        <location filename="MainWindow.cxx" line="119"/>
+        <location filename="MainWindow.cxx" line="120"/>
         <source>DIA-OPEN-VFS</source>
         <translation>Open virtual filesystem ...</translation>
     </message>
     <message>
-        <location filename="MainWindow.cxx" line="139"/>
+        <location filename="MainWindow.cxx" line="140"/>
         <source>DIA-SAVE-VFS</source>
         <translation>Save virtual filesystem ...</translation>
     </message>
     <message>
-        <location filename="MainWindow.cxx" line="155"/>
-        <location filename="MainWindow.cxx" line="166"/>
+        <location filename="MainWindow.cxx" line="156"/>
+        <location filename="MainWindow.cxx" line="167"/>
         <source>FLT-FILE-ANY</source>
         <translation>File (*.*)</translation>
     </message>
     <message>
-        <location filename="MainWindow.cxx" line="184"/>
+        <location filename="MainWindow.cxx" line="185"/>
         <source>DIA-SAVE-PLAIN</source>
         <translation>Save file ...</translation>
     </message>
     <message>
-        <location filename="MainWindow.cxx" line="184"/>
+        <location filename="MainWindow.cxx" line="185"/>
         <source>FLT-FILE-PLAIN</source>
         <translation>File (*.*)</translation>
     </message>
     <message>
-        <location filename="MainWindow.cxx" line="192"/>
+        <location filename="MainWindow.cxx" line="193"/>
         <source>DIA-SAVE-PAK</source>
         <translation>Save PAK file ...</translation>
     </message>
     <message>
-        <location filename="MainWindow.cxx" line="192"/>
+        <location filename="MainWindow.cxx" line="193"/>
         <source>FLT-FILE-PAK</source>
         <translation>Neocron PAK file (*.pak)</translation>
     </message>
     <message>
-        <location filename="MainWindow.cxx" line="200"/>
+        <location filename="MainWindow.cxx" line="201"/>
         <source>DIA-SAVE-ZLIB</source>
         <translation>Save ZLIB file ...</translation>
     </message>
     <message>
-        <location filename="MainWindow.cxx" line="200"/>
+        <location filename="MainWindow.cxx" line="201"/>
         <source>FLT-FILE-ZLIB</source>
         <translation>ZLIB file (*.z)</translation>
     </message>
     <message>
-        <location filename="MainWindow.cxx" line="312"/>
+        <location filename="MainWindow.cxx" line="313"/>
         <source>MSG-UPD-FILE</source>
         <translation>Virtual filesystem</translation>
     </message>
     <message>
-        <location filename="MainWindow.cxx" line="312"/>
+        <location filename="MainWindow.cxx" line="313"/>
         <source>MSG-UPD-WITH</source>
         <translation>with</translation>
     </message>
     <message>
-        <location filename="MainWindow.cxx" line="313"/>
+        <location filename="MainWindow.cxx" line="314"/>
         <source>MSG-UPD-ENTRIES</source>
         <translation>entries</translation>
     </message>
     <message>
         <location filename="ObjectWindow.ui" line="68"/>
         <source>ME-OBJECT-SAVE</source>
-        <translation>Save 3D object changes</translation>
+        <translation>Save changes</translation>
     </message>
     <message>
         <location filename="ObjectWindow.ui" line="73"/>
         <source>ME-OBJECT-CANCEL</source>
-        <translation>Discard 3D object changes</translation>
+        <translation>Discard changes</translation>
     </message>
 </context>
 <context>
         <translation>QTinNS Editor - Text Viewer</translation>
     </message>
     <message>
-        <location filename="TextWindow.ui" line="75"/>
+        <location filename="TextWindow.ui" line="72"/>
         <source>LAB-TEXT-NAME</source>
         <translation>Text name:</translation>
     </message>
     <message>
-        <location filename="TextWindow.ui" line="105"/>
+        <location filename="TextWindow.ui" line="102"/>
         <source>LAB-TEXT-LINES</source>
         <translation>Lines:</translation>
     </message>
     <message>
-        <location filename="TextWindow.ui" line="135"/>
+        <location filename="TextWindow.ui" line="132"/>
         <source>LAB-TEXT-SIZE</source>
         <translation>Size:</translation>
     </message>
     <message>
-        <location filename="TextWindow.ui" line="165"/>
+        <location filename="TextWindow.ui" line="162"/>
         <source>MM-TEXT</source>
         <translation>Text</translation>
     </message>
     <message>
-        <location filename="TextWindow.ui" line="175"/>
+        <location filename="TextWindow.ui" line="170"/>
+        <source>MM-EDIT</source>
+        <translation>Edit</translation>
+    </message>
+    <message>
+        <location filename="TextWindow.ui" line="186"/>
         <source>ME-TEXT-SAVE</source>
-        <translation>Save text</translation>
+        <translation>Save changes</translation>
     </message>
     <message>
-        <location filename="TextWindow.ui" line="180"/>
+        <location filename="TextWindow.ui" line="191"/>
         <source>ME-TEXT-CANCEL</source>
-        <translation>Discard text</translation>
+        <translation>Discard changes</translation>
+    </message>
+    <message>
+        <location filename="TextWindow.ui" line="196"/>
+        <source>ME-EDIT-UNDO</source>
+        <translation>Undo</translation>
+    </message>
+    <message>
+        <location filename="TextWindow.ui" line="201"/>
+        <source>ME-EDIT-REDO</source>
+        <translation>Redo</translation>
+    </message>
+    <message>
+        <location filename="TextWindow.ui" line="206"/>
+        <source>ME-EDIT-CUT</source>
+        <translation>Cut</translation>
+    </message>
+    <message>
+        <location filename="TextWindow.ui" line="211"/>
+        <source>ME-EDIT-COPY</source>
+        <translation>Copy</translation>
+    </message>
+    <message>
+        <location filename="TextWindow.ui" line="216"/>
+        <source>ME-EDIT-INSERT</source>
+        <translation>Insert</translation>
+    </message>
+    <message>
+        <location filename="TextWindow.ui" line="221"/>
+        <source>ME-EDIT-DELETE</source>
+        <translation>Delete</translation>
+    </message>
+    <message>
+        <location filename="TextWindow.ui" line="226"/>
+        <source>ME-EDIT-SELALL</source>
+        <translation>Select all</translation>
     </message>
 </context>
 </TS>
index cab46ff..ced766a 100644 (file)
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="MainWindow.cxx" line="155"/>
-        <location filename="MainWindow.cxx" line="166"/>
+        <location filename="MainWindow.cxx" line="156"/>
+        <location filename="MainWindow.cxx" line="167"/>
         <source>DIA-OPEN-FILE</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="MainWindow.cxx" line="119"/>
-        <location filename="MainWindow.cxx" line="139"/>
+        <location filename="MainWindow.cxx" line="120"/>
+        <location filename="MainWindow.cxx" line="140"/>
         <source>FLT-FILE-VFS</source>
         <oldsource>DIA-SAVE-FILE</oldsource>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="MainWindow.cxx" line="119"/>
+        <location filename="MainWindow.cxx" line="120"/>
         <source>DIA-OPEN-VFS</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="MainWindow.cxx" line="139"/>
+        <location filename="MainWindow.cxx" line="140"/>
         <source>DIA-SAVE-VFS</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="MainWindow.cxx" line="155"/>
-        <location filename="MainWindow.cxx" line="166"/>
+        <location filename="MainWindow.cxx" line="156"/>
+        <location filename="MainWindow.cxx" line="167"/>
         <source>FLT-FILE-ANY</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="MainWindow.cxx" line="184"/>
+        <location filename="MainWindow.cxx" line="185"/>
         <source>DIA-SAVE-PLAIN</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="MainWindow.cxx" line="184"/>
+        <location filename="MainWindow.cxx" line="185"/>
         <source>FLT-FILE-PLAIN</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="MainWindow.cxx" line="192"/>
+        <location filename="MainWindow.cxx" line="193"/>
         <source>DIA-SAVE-PAK</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="MainWindow.cxx" line="192"/>
+        <location filename="MainWindow.cxx" line="193"/>
         <source>FLT-FILE-PAK</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="MainWindow.cxx" line="200"/>
+        <location filename="MainWindow.cxx" line="201"/>
         <source>DIA-SAVE-ZLIB</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="MainWindow.cxx" line="200"/>
+        <location filename="MainWindow.cxx" line="201"/>
         <source>FLT-FILE-ZLIB</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="MainWindow.cxx" line="312"/>
+        <location filename="MainWindow.cxx" line="313"/>
         <source>MSG-UPD-FILE</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="MainWindow.cxx" line="312"/>
+        <location filename="MainWindow.cxx" line="313"/>
         <source>MSG-UPD-WITH</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="MainWindow.cxx" line="313"/>
+        <location filename="MainWindow.cxx" line="314"/>
         <source>MSG-UPD-ENTRIES</source>
         <translation type="unfinished"></translation>
     </message>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="TextWindow.ui" line="75"/>
+        <location filename="TextWindow.ui" line="72"/>
         <source>LAB-TEXT-NAME</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="TextWindow.ui" line="105"/>
+        <location filename="TextWindow.ui" line="102"/>
         <source>LAB-TEXT-LINES</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="TextWindow.ui" line="135"/>
+        <location filename="TextWindow.ui" line="132"/>
         <source>LAB-TEXT-SIZE</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="TextWindow.ui" line="165"/>
+        <location filename="TextWindow.ui" line="162"/>
         <source>MM-TEXT</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="TextWindow.ui" line="175"/>
+        <location filename="TextWindow.ui" line="170"/>
+        <source>MM-EDIT</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="TextWindow.ui" line="186"/>
         <source>ME-TEXT-SAVE</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="TextWindow.ui" line="180"/>
+        <location filename="TextWindow.ui" line="191"/>
         <source>ME-TEXT-CANCEL</source>
         <translation type="unfinished"></translation>
     </message>
+    <message>
+        <location filename="TextWindow.ui" line="196"/>
+        <source>ME-EDIT-UNDO</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="TextWindow.ui" line="201"/>
+        <source>ME-EDIT-REDO</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="TextWindow.ui" line="206"/>
+        <source>ME-EDIT-CUT</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="TextWindow.ui" line="211"/>
+        <source>ME-EDIT-COPY</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="TextWindow.ui" line="216"/>
+        <source>ME-EDIT-INSERT</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="TextWindow.ui" line="221"/>
+        <source>ME-EDIT-DELETE</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="TextWindow.ui" line="226"/>
+        <source>ME-EDIT-SELALL</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 </TS>
index a1fddc6..6c3d912 100644 (file)
     <message>
         <location filename="DatWindow.ui" line="41"/>
         <source>ME-DAT-SAVE</source>
-        <translation>Speichere Dat Änderungen</translation>
+        <translation>Speichere Änderungen</translation>
     </message>
     <message>
         <location filename="DatWindow.ui" line="46"/>
         <source>ME-DAT-CANCEL</source>
-        <translation>Verwerfe Dat Änderungen</translation>
+        <translation>Verwerfe Änderungen</translation>
     </message>
 </context>
 <context>
     <message>
         <location filename="MainWindow.ui" line="242"/>
         <source>ME-FILE-IMAGE</source>
-        <translation>Bild anzeigen ...</translation>
+        <translation>Bilddatei anzeigen ...</translation>
     </message>
     <message>
         <location filename="MainWindow.ui" line="247"/>
         <source>ME-FILE-TEXT</source>
-        <translation>Text anzeigen ...</translation>
+        <translation>Textdatei bearbeiten ...</translation>
     </message>
     <message>
         <location filename="MainWindow.ui" line="252"/>
         <source>ME-FILE-DAT</source>
-        <translation>Dat anzeigen ...</translation>
+        <translation>Datdatei anzeigen ...</translation>
     </message>
     <message>
         <location filename="MainWindow.ui" line="257"/>
         <translation>3D Objekt anzeigen ...</translation>
     </message>
     <message>
-        <location filename="MainWindow.cxx" line="155"/>
-        <location filename="MainWindow.cxx" line="166"/>
+        <location filename="MainWindow.cxx" line="156"/>
+        <location filename="MainWindow.cxx" line="167"/>
         <source>DIA-OPEN-FILE</source>
         <translation>Datei öffnen ...</translation>
     </message>
     <message>
-        <location filename="MainWindow.cxx" line="119"/>
-        <location filename="MainWindow.cxx" line="139"/>
+        <location filename="MainWindow.cxx" line="120"/>
+        <location filename="MainWindow.cxx" line="140"/>
         <source>FLT-FILE-VFS</source>
         <oldsource>DIA-SAVE-FILE</oldsource>
         <translation>Neocron VFS Datei (*.vfs *.pak)</translation>
     </message>
     <message>
-        <location filename="MainWindow.cxx" line="119"/>
+        <location filename="MainWindow.cxx" line="120"/>
         <source>DIA-OPEN-VFS</source>
         <translation>Virtuelles Dateisystem öffnen ...</translation>
     </message>
     <message>
-        <location filename="MainWindow.cxx" line="139"/>
+        <location filename="MainWindow.cxx" line="140"/>
         <source>DIA-SAVE-VFS</source>
         <translation>Virtuelles Dateisystem speichern ...</translation>
     </message>
     <message>
-        <location filename="MainWindow.cxx" line="155"/>
-        <location filename="MainWindow.cxx" line="166"/>
+        <location filename="MainWindow.cxx" line="156"/>
+        <location filename="MainWindow.cxx" line="167"/>
         <source>FLT-FILE-ANY</source>
         <translation>Datei (*.*)</translation>
     </message>
     <message>
-        <location filename="MainWindow.cxx" line="184"/>
+        <location filename="MainWindow.cxx" line="185"/>
         <source>DIA-SAVE-PLAIN</source>
         <translation>Datei speichern ...</translation>
     </message>
     <message>
-        <location filename="MainWindow.cxx" line="184"/>
+        <location filename="MainWindow.cxx" line="185"/>
         <source>FLT-FILE-PLAIN</source>
         <translation>Datei (*.*)</translation>
     </message>
     <message>
-        <location filename="MainWindow.cxx" line="192"/>
+        <location filename="MainWindow.cxx" line="193"/>
         <source>DIA-SAVE-PAK</source>
         <translation>PAK Datei speichern ...</translation>
     </message>
     <message>
-        <location filename="MainWindow.cxx" line="192"/>
+        <location filename="MainWindow.cxx" line="193"/>
         <source>FLT-FILE-PAK</source>
         <translation>Neocron PAK Datei (*.pak)</translation>
     </message>
     <message>
-        <location filename="MainWindow.cxx" line="200"/>
+        <location filename="MainWindow.cxx" line="201"/>
         <source>DIA-SAVE-ZLIB</source>
         <translation>ZLIB Datei speichern ...</translation>
     </message>
     <message>
-        <location filename="MainWindow.cxx" line="200"/>
+        <location filename="MainWindow.cxx" line="201"/>
         <source>FLT-FILE-ZLIB</source>
         <translation>ZLIB Datei (*.z)</translation>
     </message>
     <message>
-        <location filename="MainWindow.cxx" line="312"/>
+        <location filename="MainWindow.cxx" line="313"/>
         <source>MSG-UPD-FILE</source>
         <translation>Virtuelles Dateisystem</translation>
     </message>
     <message>
-        <location filename="MainWindow.cxx" line="312"/>
+        <location filename="MainWindow.cxx" line="313"/>
         <source>MSG-UPD-WITH</source>
         <translation>mit</translation>
     </message>
     <message>
-        <location filename="MainWindow.cxx" line="313"/>
+        <location filename="MainWindow.cxx" line="314"/>
         <source>MSG-UPD-ENTRIES</source>
         <translation>Einträgen</translation>
     </message>
     <message>
         <location filename="ObjectWindow.ui" line="68"/>
         <source>ME-OBJECT-SAVE</source>
-        <translation>Speichere 3D Objekt Änderungen</translation>
+        <translation>Speichere Änderungen</translation>
     </message>
     <message>
         <location filename="ObjectWindow.ui" line="73"/>
         <source>ME-OBJECT-CANCEL</source>
-        <translation>Verwerfe 3D Objekt Änderungen</translation>
+        <translation>Verwerfe Änderungen</translation>
     </message>
 </context>
 <context>
         <translation>QTinNS Editor - Text Viewer</translation>
     </message>
     <message>
-        <location filename="TextWindow.ui" line="75"/>
+        <location filename="TextWindow.ui" line="72"/>
         <source>LAB-TEXT-NAME</source>
         <translation>Textdateiname:</translation>
     </message>
     <message>
-        <location filename="TextWindow.ui" line="105"/>
+        <location filename="TextWindow.ui" line="102"/>
         <source>LAB-TEXT-LINES</source>
         <translation>Zeilen:</translation>
     </message>
     <message>
-        <location filename="TextWindow.ui" line="135"/>
+        <location filename="TextWindow.ui" line="132"/>
         <source>LAB-TEXT-SIZE</source>
         <translation>Größe:</translation>
     </message>
     <message>
-        <location filename="TextWindow.ui" line="165"/>
+        <location filename="TextWindow.ui" line="162"/>
         <source>MM-TEXT</source>
         <translation>Text</translation>
     </message>
     <message>
-        <location filename="TextWindow.ui" line="175"/>
+        <location filename="TextWindow.ui" line="170"/>
+        <source>MM-EDIT</source>
+        <translation>Bearbeiten</translation>
+    </message>
+    <message>
+        <location filename="TextWindow.ui" line="186"/>
         <source>ME-TEXT-SAVE</source>
         <translation>Speichere Änderungen</translation>
     </message>
     <message>
-        <location filename="TextWindow.ui" line="180"/>
+        <location filename="TextWindow.ui" line="191"/>
         <source>ME-TEXT-CANCEL</source>
-        <translatorcomment>Verwerfe Änderungen</translatorcomment>
-        <translation>Text verwerfern</translation>
+        <translation>Verwerfe Änderungen</translation>
+    </message>
+    <message>
+        <location filename="TextWindow.ui" line="196"/>
+        <source>ME-EDIT-UNDO</source>
+        <translation>Rückgängig</translation>
+    </message>
+    <message>
+        <location filename="TextWindow.ui" line="201"/>
+        <source>ME-EDIT-REDO</source>
+        <translation>Wiederherstellen</translation>
+    </message>
+    <message>
+        <location filename="TextWindow.ui" line="206"/>
+        <source>ME-EDIT-CUT</source>
+        <translation>Ausschneiden</translation>
+    </message>
+    <message>
+        <location filename="TextWindow.ui" line="211"/>
+        <source>ME-EDIT-COPY</source>
+        <translation>Kopieren</translation>
+    </message>
+    <message>
+        <location filename="TextWindow.ui" line="216"/>
+        <source>ME-EDIT-INSERT</source>
+        <translation>Einfügen</translation>
+    </message>
+    <message>
+        <location filename="TextWindow.ui" line="221"/>
+        <source>ME-EDIT-DELETE</source>
+        <translation>Löschen</translation>
+    </message>
+    <message>
+        <location filename="TextWindow.ui" line="226"/>
+        <source>ME-EDIT-SELALL</source>
+        <translation>Alles markieren</translation>
     </message>
 </context>
 </TS>
index 0e1bb94..8895445 100644 (file)
@@ -47,7 +47,7 @@ void GLWidget::paintGL()
         glVertexPointer(3, GL_FLOAT, 0, _vertices.constData());
         glEnableClientState(GL_VERTEX_ARRAY);
 
-        for (quint32 i = 0; i < _vertices.count(); ++i)
+        for (qint32 i = 0; i < _vertices.count(); ++i)
             glDrawArrays(GL_TRIANGLE_FAN, i * 4, 4);
     }
 }
@@ -81,7 +81,7 @@ void GLWidget::mouseMoveEvent(QMouseEvent *event)
         _last_pos = event->pos();
 }
 
-void GLWidget::mouseReleaseEvent(QMouseEvent *event)
+void GLWidget::mouseReleaseEvent(QMouseEvent * /*event*/)
 {
     emit sigClicked();
 }
index ad0d369..6bf527d 100644 (file)
@@ -1,4 +1,3 @@
-#include <QDataStream>
 #include "filesystem/NCFile.hxx"
 
 /*
@@ -165,17 +164,17 @@ QByteArray NCFile::cData() const
 
 void NCFile::setOData(const QByteArray& data)
 {
-    _cdata = qCompress(data, 9).mid(sizeof (quint32));
+    _cdata = qCompress(data, 9).mid(sizeof (_csize));
 }
 
 QByteArray NCFile::oData() const
 {
-    QByteArray size;
-    QDataStream stream(&size, QIODevice::WriteOnly);
+    // this is the only way it works, qCompress/qDecompress is broken!
+    QByteArray data(sizeof (_osize) + _cdata.size(), '\0');
 
-    stream << _csize;
+    data.replace(sizeof (_osize),_csize, _cdata);
 
-    return qUncompress(size + _cdata);
+    return qUncompress(data);
 }
 
 // --- status methods ---
index 3f08a61..f992cef 100644 (file)
@@ -437,7 +437,7 @@ NCFile NCFilesystem::fileRemove(const quint32& index)
 
 void NCFilesystem::recalc(QVector<NCFile>& files)
 {
-    quint32 base_offset = 0;
+    quint32 base_offset = sizeof (id.VFS) + sizeof (quint32);
     quint32 csize_offset = 0;
 
     for (auto& f : files)
@@ -666,7 +666,7 @@ quint32 NCFilesystem::vfsSaver(const QString& filename) const
 
         ofile.close();
 
-        emit sigFileStatus(0, _files.count() - 1, ColType::None);
+        emit sigFileStatus(0, _files.count(), ColType::None);
 
         return _files.count();
     }