[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    quanta/quanta
From:       Andras Mantia <amantia () freemail ! hu>
Date:       2004-01-26 16:46:50
Message-ID: 20040126164650.11B3A8FED () office ! kde ! org
[Download RAW message or body]

CVS commit by amantia: 

Experimental delayed reparsing. This should make the interface more responsive. 
Bug reporters: can you update/get Quanta from CVS and try it (and report back)?
Information about how to get it from CVS are in the README file (and at  \
http://developer.kde.org/source/). Note, the executable name is "quanta_be" for the \
HEAD CVS version.

Nicolas, can this cause problems in Kafka? The main idea is that the document is \
reparsed only after there was no keypress for some time. If somewhere an up-to-date \
node tree is needed, the parser->rebuild() must be called manually (see e.g \
QuantaView::slotEditCurrentTag). If it causes too much problem for you, we can \
revert, although the other alternative is threading (parsing in background), which \
may lead to better performance, but involves more code change.

CCMAIL: 63000@bugs.kde.org
CCMAIL: quanta@kde.org
CCMAIL: quanta-devel@kde.org
CCMAIL: f.faber-pro@ifrance.com


  M +9 -0      document.cpp   1.242
  M +1 -1      quanta.cpp   1.417
  M +1 -1      quanta_init.cpp   1.401
  M +4 -2      quantaview_slots.cpp   1.161
  M +6 -11     parser/parser.cpp   1.164
  M +4 -2      parser/parser.h   1.54


--- quanta/quanta/document.cpp  #1.241:1.242
@@ -1846,4 +1846,12 @@ void Document::slotTextChanged()
 void Document::slotDelayedTextChanged()
 {
+   if (typingInProgress)
+   {
+    // kdDebug(24000) << "Reparsing delayed!" << endl;
+     parser->setParsingNeeded(true);
+     QTimer::singleShot(250, this, SLOT(slotDelayedTextChanged()));
+     reparseEnabled = false;
+     return;
+   }
     uint line, column;
     QString oldNodeName = "";
@@ -1970,4 +1978,5 @@ void Document::slotDelayedTextChanged()
       quantaApp->getsTab()->slotReparse(this, baseNode , qConfig.expandLevel);
     }
+    reparseEnabled = true;
 }
 

--- quanta/quanta/quanta.cpp  #1.416:1.417
@@ -872,5 +872,5 @@ void QuantaApp::slotNewStatus()
     bool block=wTab->signalsBlocked();
     wTab->blockSignals(true);
-    //If we don't disable the parser, it wil parse page 0 and then reload kafka
+    //If we don't disable the parser, it will parse page 0 and then reload kafka
     //even if the signals are supposed to be blocked ;(
     parser->setParsingEnabled(false);

--- quanta/quanta/quanta_init.cpp  #1.400:1.401
@@ -270,5 +270,5 @@ void QuantaApp::initQuanta()
   connect(m_doc, SIGNAL(hideSplash()), SLOT(slotHideSplash()));
   connect(m_project, SIGNAL(hideSplash()), SLOT(slotHideSplash()));
-}
+  }
 
 

--- quanta/quanta/quantaview_slots.cpp  #1.160:1.161
@@ -80,7 +80,9 @@
 void QuantaView::slotEditCurrentTag()
 {
-  if (!writeExists()) return;
-
+  if (!writeExists()) 
+    return;
   Document *w = write();
+  if (parser->parsingNeeded())
+    baseNode = parser->rebuild(w);
   uint line,col;
   w->viewCursorIf->cursorPositionReal(&line, &col);

--- quanta/quanta/parser/parser.cpp  #1.163:1.164
@@ -62,4 +62,5 @@ Parser::Parser()
   m_quotesRx = QRegExp("\"|'");
   m_parsingEnabled = true;
+  m_parsingNeeded = true;
 }
 
@@ -434,4 +435,5 @@ Node *Parser::parse(Document *w)
   parseIncludedFiles();
   kdDebug(24000) << "External parser: " << t.elapsed() << " ms\n";
+  m_parsingNeeded = false;
  /*
  treeSize = 0;
@@ -531,12 +533,5 @@ Node *Parser::nodeAt(int line, int col, 
       if (node->child)
       {
-   /*     int nodeEl, nodeEc, childBl, childBc;
-        node->tag->endPos(nodeEl, nodeEc);
-        node->child->tag->beginPos(childBl, childBc);
-        if ( nodeEl < childBl || 
-             (nodeEl == childBl && nodeEc < childBc)) */
           node = node->child;
-        //else
-          //break;  
       } else
       {
@@ -880,5 +875,5 @@ void Parser::deleteNodes(Node *firstNode
 //    coutTree(m_node, 2);
   }
-  coutTree(m_node, 2);
+//  coutTree(m_node, 2);
 #ifndef BUILD_KAFKAPART
   Q_UNUSED(modifs);
@@ -1110,4 +1105,5 @@ Node *Parser::rebuild(Document *w)
 
  emit nodeTreeChanged();
+ m_parsingNeeded = false;
  return m_node;
 }

--- quanta/quanta/parser/parser.h  #1.53:1.54
@@ -70,5 +69,7 @@ public:
   /** Enable/Disable parsing. */
   void setParsingEnabled(bool enabled) {m_parsingEnabled = enabled;}
-  bool IsparsingEnabled() {return m_parsingEnabled;}
+  bool isParsingEnabled() {return m_parsingEnabled;}
+  void setParsingNeeded(bool needed) {m_parsingNeeded = needed;}
+  bool parsingNeeded() {return m_parsingNeeded;}
   /**
    * This function is ESSENTIAL : when one modify baseNode, one MUST use
@@ -109,4 +110,5 @@ private:
   QRegExp m_quotesRx;
   bool m_parsingEnabled;
+  bool m_parsingNeeded;
 
   void parseIncludedFile(const QString &fileName, DTDStruct *dtd);


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic