diff libgui/src/m-editor/file-editor-tab.cc @ 15367:501a9cc2c68f

maint: whitespace cleanup in GUI code
author Jordi Gutiérrez Hermoso <jordigh@octave.org>
date Wed, 12 Sep 2012 16:34:39 -0400
parents b4c32f245da7
children 36ececf69385
line wrap: on
line diff
--- a/libgui/src/m-editor/file-editor-tab.cc	Wed Sep 12 16:23:13 2012 -0400
+++ b/libgui/src/m-editor/file-editor-tab.cc	Wed Sep 12 16:34:39 2012 -0400
@@ -71,7 +71,7 @@
   _edit_area->setMarginsForegroundColor(QColor(96,96,96));
   _edit_area->setMarginsBackgroundColor(QColor(232,232,220));
   _edit_area->setMarginType (2, QsciScintilla::TextMargin);
-  
+
   // code folding
   _edit_area->setMarginType (3, QsciScintilla::SymbolMargin);
   _edit_area->setFolding (QsciScintilla::BoxedTreeFoldStyle , 3);
@@ -90,7 +90,7 @@
   // auto completion
   _edit_area->autoCompleteFromAll ();
   _edit_area->setAutoCompletionSource(QsciScintilla::AcsAll);
-  
+
   QVBoxLayout *layout = new QVBoxLayout ();
   layout->addWidget (_edit_area);
   layout->setMargin (0);
@@ -105,7 +105,7 @@
            this, SLOT (file_has_changed (QString)));
 
   _file_name = "";
- 
+
   notice_settings ();
 }
 
@@ -241,7 +241,7 @@
       QString keyword;
       QStringList keywordList;
 
-       // get whole string with all keywords
+      // get whole string with all keywords
       keyword = lexer->keywords (1);
       // split into single strings
       keywordList = keyword.split (QRegExp ("\\s+"));
@@ -249,21 +249,21 @@
       int i;
       for (i = 0; i < keywordList.size (); i++)
         {
-           // add single strings to the API
+          // add single strings to the API
           lexer_api->add (keywordList.at (i));
         }
       // prepare API info ... this make take some time
       lexer_api->prepare ();
     }
   else if (_file_name.endsWith (".c")
-        || _file_name.endsWith (".cc")
-        || _file_name.endsWith (".cpp")
-        || _file_name.endsWith (".cxx")
-        || _file_name.endsWith (".c++")
-        || _file_name.endsWith (".h")
-        || _file_name.endsWith (".hh")
-        || _file_name.endsWith (".hpp")
-        || _file_name.endsWith (".h++"))
+           || _file_name.endsWith (".cc")
+           || _file_name.endsWith (".cpp")
+           || _file_name.endsWith (".cxx")
+           || _file_name.endsWith (".c++")
+           || _file_name.endsWith (".h")
+           || _file_name.endsWith (".hh")
+           || _file_name.endsWith (".hpp")
+           || _file_name.endsWith (".h++"))
     {
       lexer = new QsciLexerCPP ();
     }
@@ -283,17 +283,17 @@
     {
       lexer = new QsciLexerBash ();
     }
-  
+
   QSettings *settings = resource_manager::get_settings ();
-  
+
   // Editor font (default or from settings)
   if (settings)
     lexer->setDefaultFont (QFont (
-                             settings->value ("editor/fontName",
-                                              "Courier").toString (),
-                             settings->value ("editor/fontSize",
-                                              10).toInt ()));
-  
+                                  settings->value ("editor/fontName",
+                                                   "Courier").toString (),
+                                  settings->value ("editor/fontSize",
+                                                   10).toInt ()));
+
   // TODO: Autoindent not working as it should
   lexer->setAutoIndentStyle (QsciScintilla::AiMaintain ||
                              QsciScintilla::AiOpening  ||
@@ -313,10 +313,10 @@
   function_name.chop (file_info.suffix ().length () + 1);
 
   octave_link::instance ()->post_event
-      (new octave_add_breakpoint_event (*this,
-                                        path.toStdString (),
-                                        function_name.toStdString (),
-                                        line));
+    (new octave_add_breakpoint_event (*this,
+                                      path.toStdString (),
+                                      function_name.toStdString (),
+                                      line));
 }
 
 void
@@ -330,10 +330,10 @@
   function_name.chop (file_info.suffix ().length () + 1);
 
   octave_link::instance ()->post_event
-      (new octave_remove_breakpoint_event (*this,
-                                           path.toStdString (),
-                                           function_name.toStdString (),
-                                           line));
+    (new octave_remove_breakpoint_event (*this,
+                                         path.toStdString (),
+                                         function_name.toStdString (),
+                                         line));
 }
 
 void
@@ -502,9 +502,9 @@
   function_name.chop (file_info.suffix ().length () + 1);
 
   octave_link::instance ()->post_event
-      (new octave_remove_all_breakpoints_event (*this,
-                                                path.toStdString (),
-                                                function_name.toStdString ()));
+    (new octave_remove_all_breakpoints_event (*this,
+                                              path.toStdString (),
+                                              function_name.toStdString ()));
 }
 
 void
@@ -696,7 +696,7 @@
   _file_name = saveFileName;
   // set the window title to actual file name (not modified)
   update_window_title (false);
-   // files is save -> not modified
+  // files is save -> not modified
   _edit_area->setModified (false);
   file.close();
 
@@ -713,7 +713,7 @@
   if (saveFileName == UNNAMED_FILE || saveFileName.isEmpty ())
     {
       QString directory = QString::fromStdString
-          (octave_link::instance ()->get_last_working_directory ());
+        (octave_link::instance ()->get_last_working_directory ());
 
       if (directory.isEmpty ())
         {
@@ -752,13 +752,13 @@
   QFileInfo file_info (_file_name);
   QString path = file_info.absolutePath ();
   //QString current_path = QString::fromStdString
-      (octave_link::instance ()->get_last_working_directory ());
+  (octave_link::instance ()->get_last_working_directory ());
   QString function_name = file_info.fileName ();
 
   // We have to cut off the suffix, because octave appends it.
   function_name.chop (file_info.suffix ().length () + 1);
   _file_editor->terminal ()->sendText (QString ("cd \'%1\'\n%2\n")
-    .arg(path).arg (function_name));
+                                       .arg(path).arg (function_name));
   // TODO: Sending a run event crashes for long scripts. Find out why.
   //  octave_link::instance ()
   //      ->post_event (new octave_run_file_event (*this, _file_name.toStdString ()));
@@ -778,10 +778,10 @@
           alreadyAsking = true;
 
           int decision =
-          QMessageBox::warning (this, tr ("Octave Editor"),
-                                tr ("It seems that \'%1\' has been modified by another application. Do you want to reload it?").
-                                arg (_file_name), QMessageBox::Yes,
-                                QMessageBox::No);
+            QMessageBox::warning (this, tr ("Octave Editor"),
+                                  tr ("It seems that \'%1\' has been modified by another application. Do you want to reload it?").
+                                  arg (_file_name), QMessageBox::Yes,
+                                  QMessageBox::No);
 
           if (decision == QMessageBox::Yes)
             {
@@ -794,10 +794,10 @@
   else
     {
       int decision =
-      QMessageBox::warning (this, tr ("Octave Editor"),
-                            tr ("It seems that \'%1\' has been deleted or renamed. Do you want to save it now?").
-                            arg (_file_name), QMessageBox::Save,
-                            QMessageBox::Close);
+        QMessageBox::warning (this, tr ("Octave Editor"),
+                              tr ("It seems that \'%1\' has been deleted or renamed. Do you want to save it now?").
+                              arg (_file_name), QMessageBox::Save,
+                              QMessageBox::Close);
       if (decision == QMessageBox::Save)
         {
           if (!save_file_as ())
@@ -819,35 +819,35 @@
 file_editor_tab::notice_settings ()
 {
   QSettings *settings = resource_manager::get_settings ();
-  
+
   if (settings==NULL)
     return; // this shouldn't happen!
-  
+
   _edit_area->setCaretLineVisible(settings->value ("editor/highlightCurrentLine",true).toBool ());
-  
+
   if (settings->value ("editor/codeCompletion",true).toBool ())
     _edit_area->setAutoCompletionThreshold (1);
   else
     _edit_area->setAutoCompletionThreshold (-1);
-  
+
   QFont font( settings->value ("editor/fontName","Courier").toString () ,
               settings->value ("editor/fontSize",10).toInt () );
   if (settings->value ("editor/showLineNumbers",true).toBool ())
     {
       _edit_area->setMarginLineNumbers (2, true);
       _edit_area->setMarginsFont( font );
-      QFontMetrics metrics( font );      
+      QFontMetrics metrics( font );
       _edit_area->setMarginWidth(2, metrics.width("9999"));
-    }      
+    }
   else
     {
       _edit_area->setMarginLineNumbers (2, false);
       _edit_area->setMarginWidth(2, 0);
-    }      
-  
+    }
+
   update_lexer ();
-  
+
   _long_title = settings->value ("editor/longWindowTitle",false).toBool ();
 
-  update_window_title (false);  
+  update_window_title (false);
 }