Changeset 2223

Show
Ignore:
Timestamp:
08/15/08 13:47:52 (3 months ago)
Author:
hlamer
Message:

Autodetect of EOL mode

Location:
v2/branches/dev/monkey/src
Files:
6 modified

Legend:

Unmodified
Added
Removed
  • v2/branches/dev/monkey/src/maininterface/ui/UISettings.cpp

    r1948 r2223  
    318318        bgEolMode->button( eolMode() )->setChecked( true ); 
    319319        cbEolVisibility->setChecked( eolVisibility() ); 
     320        cbAutoDetectEol->setChecked( autoDetectEol() ); 
    320321        gbWhitespaceVisibilityEnabled->setChecked( whitespaceVisibility() != QsciScintilla::WsInvisible ); 
    321322        if ( bgWhitespaceVisibility->button( whitespaceVisibility() ) ) 
     
    395396        setCreateBackupUponOpen( cbCreateBackupUponOpen->isChecked() ) ; 
    396397        setAutoEolConversion( cbAutoEolConversion->isChecked() ); 
     398        setAutoDetectEol( cbAutoDetectEol->isChecked() ); 
    397399        setDefaultEncoding( cbDefaultEncoding->currentText() ); 
    398400        setSelectionBackgroundColor( QColor( tbSelectionBackground->toolTip() ) ); 
     
    463465        setEolMode( (QsciScintilla::EolMode)bgEolMode->checkedId() ); 
    464466        setEolVisibility( cbEolVisibility->isChecked() ); 
     467        setAutoDetectEol( cbAutoDetectEol->isChecked() ); 
    465468        setWhitespaceVisibility( QsciScintilla::WsInvisible ); 
    466469        if ( gbWhitespaceVisibilityEnabled->isChecked() ) 
  • v2/branches/dev/monkey/src/maininterface/ui/UISettings.ui

    r1945 r2223  
    213213    <widget class="QStackedWidget" name="swPages" > 
    214214     <property name="currentIndex" > 
    215       <number>0</number> 
     215      <number>10</number> 
    216216     </property> 
    217217     <widget class="QWidget" name="pGeneral" > 
     
    221221        <y>0</y> 
    222222        <width>481</width> 
    223         <height>699</height> 
     223        <height>705</height> 
    224224       </rect> 
    225225      </property> 
     
    507507        <y>0</y> 
    508508        <width>481</width> 
    509         <height>699</height> 
     509        <height>705</height> 
    510510       </rect> 
    511511      </property> 
     
    546546        <y>0</y> 
    547547        <width>481</width> 
    548         <height>699</height> 
     548        <height>705</height> 
    549549       </rect> 
    550550      </property> 
     
    772772        <y>0</y> 
    773773        <width>481</width> 
    774         <height>699</height> 
     774        <height>705</height> 
    775775       </rect> 
    776776      </property> 
     
    936936        <y>0</y> 
    937937        <width>481</width> 
    938         <height>699</height> 
     938        <height>705</height> 
    939939       </rect> 
    940940      </property> 
     
    11701170        <y>0</y> 
    11711171        <width>481</width> 
    1172         <height>699</height> 
     1172        <height>705</height> 
    11731173       </rect> 
    11741174      </property> 
     
    14311431        <y>0</y> 
    14321432        <width>481</width> 
    1433         <height>699</height> 
     1433        <height>705</height> 
    14341434       </rect> 
    14351435      </property> 
     
    15961596        <y>0</y> 
    15971597        <width>481</width> 
    1598         <height>699</height> 
     1598        <height>705</height> 
    15991599       </rect> 
    16001600      </property> 
     
    17441744        <y>0</y> 
    17451745        <width>481</width> 
    1746         <height>699</height> 
     1746        <height>705</height> 
    17471747       </rect> 
    17481748      </property> 
     
    18971897        <y>0</y> 
    18981898        <width>481</width> 
    1899         <height>699</height> 
     1899        <height>705</height> 
    19001900       </rect> 
    19011901      </property> 
     
    21932193        <y>0</y> 
    21942194        <width>481</width> 
    2195         <height>699</height> 
     2195        <height>705</height> 
    21962196       </rect> 
    21972197      </property> 
     
    22062206        <widget class="QGroupBox" name="gbEolMode" > 
    22072207         <property name="title" > 
    2208           <string>Eol Mode</string> 
     2208          <string>EOL Mode</string> 
    22092209         </property> 
    22102210         <layout class="QGridLayout" > 
     
    22152215           <number>3</number> 
    22162216          </property> 
    2217           <item row="1" column="0" colspan="3" > 
     2217          <item row="2" column="0" colspan="3" > 
    22182218           <widget class="QCheckBox" name="cbEolVisibility" > 
    22192219            <property name="text" > 
     
    22402240            <property name="text" > 
    22412241             <string>Unix</string> 
     2242            </property> 
     2243           </widget> 
     2244          </item> 
     2245          <item row="1" column="0" > 
     2246           <widget class="QCheckBox" name="cbAutoDetectEol" > 
     2247            <property name="text" > 
     2248             <string>Autodetect EOL</string> 
    22422249            </property> 
    22432250           </widget> 
     
    24682475        <y>0</y> 
    24692476        <width>481</width> 
    2470         <height>699</height> 
     2477        <height>705</height> 
    24712478       </rect> 
    24722479      </property> 
  • v2/branches/dev/monkey/src/pMonkeyStudio.cpp

    r2214 r2223  
    15541554{ return MonkeyCore::settings()->value( settingsPath() +"/EolVisibility", false ).toBool(); } 
    15551555 
     1556void pMonkeyStudio::setAutoDetectEol( bool detect ) 
     1557{ MonkeyCore::settings()->setValue( settingsPath() +"/AutoDetectEol", detect ); } 
     1558 
     1559const bool pMonkeyStudio::autoDetectEol() 
     1560{ return MonkeyCore::settings()->value( settingsPath() +"/AutoDetectEol", false ).toBool(); } 
     1561 
    15561562void pMonkeyStudio::setWhitespaceVisibility( QsciScintilla::WhitespaceVisibility w ) 
    15571563{ MonkeyCore::settings()->setValue( settingsPath() +"/WhitespaceVisibility", w ); } 
  • v2/branches/dev/monkey/src/pMonkeyStudio.h

    r2205 r2223  
    241241        Q_MONKEY_EXPORT void setEolVisibility( bool visible ); 
    242242        Q_MONKEY_EXPORT const bool eolVisibility(); 
     243        Q_MONKEY_EXPORT void setAutoDetectEol( bool detect ); 
     244        Q_MONKEY_EXPORT const bool autoDetectEol(); 
    243245        Q_MONKEY_EXPORT void setWhitespaceVisibility( QsciScintilla::WhitespaceVisibility visibility ); 
    244246        Q_MONKEY_EXPORT const QsciScintilla::WhitespaceVisibility whitespaceVisibility(); 
  • v2/branches/dev/monkey/src/qscintillamanager/pEditor.cpp

    r2022 r2223  
    158158} 
    159159 
     160void pEditor::autoDetectEol () 
     161{ 
     162        QString currText = text(); 
     163        if (text().indexOf("\r\n") != -1) 
     164        { 
     165                setEolMode (QsciScintilla::EolWindows); 
     166                return; 
     167        } 
     168        if (text().indexOf("\n") != -1) 
     169        { 
     170                setEolMode (QsciScintilla::EolUnix); 
     171                return; 
     172        } 
     173} 
     174 
    160175int pEditor::lineNumbersMarginWidth() const 
    161176{ 
     
    293308        { 
    294309                autoDetectIndent (); 
     310        } 
     311         
     312        //autodetect eol, if need 
     313        if (pMonkeyStudio::autoDetectEol()) 
     314        { 
     315                autoDetectEol (); 
    295316        } 
    296317         
  • v2/branches/dev/monkey/src/qscintillamanager/pEditor.h

    r1983 r2223  
    6969        void autoDetectIndent(); 
    7070 
     71        // Set for self EOL mode according with actual in the file 
     72        void autoDetectEol(); 
     73 
    7174protected: 
    7275        void keyPressEvent( QKeyEvent* );