Changeset 1129


Ignore:
Timestamp:
Jun 30, 2011, 6:20:22 PM (6 years ago)
Author:
stefan
Message:

automatically indent line after \begin, \item, or opening braces

Location:
trunk/src
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/jlatexeditor/SCEManager.java

    r1117 r1129  
    116116    scePane.setTabCompletion(new StaticCommandsCodeHelper("(\\p{L}*)", tabCompletions));
    117117    scePane.setQuickHelp(new LatexQuickHelp("data/quickhelp/"));
     118    scePane.setLineBreakListener(new LatexLineBreakListener());
    118119
    119120    CombinedCodeAssistant codeAssistant = new CombinedCodeAssistant();
  • trunk/src/jlatexeditor/gproperties/GProperties.java

    r1099 r1129  
    121121    properties.addEntry(new Def("editor.auto_completion.delay", INT_GT_0, "200"));
    122122    properties.addEntry(new Def("editor.clear_selection_when_closing_search", BOOLEAN, "true"));
     123    properties.addEntry(new Comment(" Automatic indentation"));
     124    properties.addEntry(new Def("editor.auto_indentation.after_begin", BOOLEAN, "true"));
     125    properties.addEntry(new Def("editor.auto_indentation.after_item", BOOLEAN, "true"));
     126    properties.addEntry(new Def("editor.auto_indentation.after_opening_brace", BOOLEAN, "true"));
    123127
    124128    properties.addEntry(new Comment("\n## Shortcuts"));
  • trunk/src/sce/component/SCEPane.java

    r1075 r1129  
    3030 
    3131  SourceCodeEditor sourceCodeEditor;
    32   /**
    33    * Document.
    34    */
     32  /** Document. */
    3533  SCEDocument document = null;
    36   /**
    37    * Code Helper (code completion).
    38    */
     34  /** Code Helper (code completion). */
    3935  CodeHelper codeHelper = null;
    4036  CodeHelper tabCompletion = null;
    41   /**
    42    * Quick help.
    43    */
     37  /** Quick help. */
    4438  QuickHelp quickHelp = null;
    45   /**
    46    * Undo manager.
    47   */
     39  /** Listener for line breaks. */
     40  LineBreakListener lineBreakListener = null;
     41  /** Undo manager. */
    4842  SCEUndoManager undoManager = null;
    49   /**
    50    * General SCE Popup.
    51    */
     43  /** General SCE Popup. */
    5244  SCEPopup popup = null;
    5345
     
    209201    ui.setTabCompletion(tabCompletion);
    210202    ui.setQuickHelp(quickHelp);
     203    ui.setLineBreakListener(lineBreakListener);
    211204
    212205    // get font properties
     
    687680  }
    688681
    689   /**
     682  public void setLineBreakListener(LineBreakListener lineBreakListener) {
     683    this.lineBreakListener = lineBreakListener;
     684    if (ui != null) ui.setLineBreakListener(lineBreakListener);
     685  }
     686
     687  /**
    690688   * Finds the next splitter in the given row and direction.
    691689   *
  • trunk/src/sce/component/SCEPaneUI.java

    r1050 r1129  
    33import sce.codehelper.CodeHelper;
    44import sce.codehelper.CodeHelperPane;
     5import sce.codehelper.LineBreakListener;
    56import sce.quickhelp.QuickHelp;
    67import sce.quickhelp.QuickHelpPane;
     
    3132  CodeHelperPane codeHelperPane = null;
    3233
     34  // line break listener
     35  LineBreakListener lineBreakListener = null;
     36
    3337  // last mouse click
    3438  long lastMouseClick = 0;
     
    119123  }
    120124
    121   /**
     125  /**
     126   * Sets the listener for line breaks.
     127   *
     128   * @param lineBreakListener listener for line breaks
     129   */
     130  public void setLineBreakListener(LineBreakListener lineBreakListener) {
     131    this.lineBreakListener = lineBreakListener;
     132  }
     133
     134  /**
    122135   * Scrolls the visible rectangle.
    123136   *
     
    267280      while (indentCount < line.length() && line.charAt(indentCount) == ' ') indentCount++;
    268281      document.insert(line.substring(0, indentCount), row + 1, 0);
     282
     283      if (lineBreakListener != null) {
     284        lineBreakListener.linedWrapped(pane);
     285      }
    269286      e.consume();
    270287    }
Note: See TracChangeset for help on using the changeset viewer.