Permalink
Browse files

Added page up / page down functionality through minor editor refactor…

…ing plus some additions to the usual places; removed some debugging code from gtk.js; stepped on some of Dion's IDEA project file changes
  • Loading branch information...
1 parent 011132e commit 27a81fc70da9e4a9916b7ab918df50c7d433ab6e Ben Galbraith committed Jan 23, 2009
Showing with 84 additions and 26 deletions.
  1. +44 −0 bespin.iml
  2. +3 −3 bespin.ipr
  3. +18 −0 frontend/js/editor/actions.js
  4. +12 −8 frontend/js/editor/editor.js
  5. +0 −9 frontend/js/th/gtk.js
  6. +3 −2 frontend/js/util/keys.js
  7. +4 −4 frontend/js/util/navigate.js
View
@@ -14,13 +14,21 @@
<setting name="EXPLODED_ENABLED" value="false" />
<setting name="JAR_URL" value="file://" />
<setting name="JAR_ENABLED" value="false" />
+ <setting name="BUILD_MODULE_ON_FRAME_DEACTIVATION" value="false" />
+ <setting name="BUILD_EXTERNAL_DEPENDENCIES" value="false" />
<setting name="EXCLUDE_EXPLODED_DIRECTORY" value="true" />
+ <setting name="RUN_JASPER_VALIDATION" value="false" />
+ <setting name="BUILD_ONLY_WEB_RESOURCES" value="false" />
</building>
<packaging>
<containerElement type="module" name="canvasgrid">
<attribute name="method" value="1" />
<attribute name="URI" value="/WEB-INF/classes" />
</containerElement>
+ <containerElement type="module" name="bespin">
+ <attribute name="method" value="1" />
+ <attribute name="URI" value="/WEB-INF/classes" />
+ </containerElement>
</packaging>
</configuration>
</facet>
@@ -37,13 +45,48 @@
<setting name="EXPLODED_ENABLED" value="false" />
<setting name="JAR_URL" value="file://" />
<setting name="JAR_ENABLED" value="false" />
+ <setting name="BUILD_MODULE_ON_FRAME_DEACTIVATION" value="false" />
+ <setting name="BUILD_EXTERNAL_DEPENDENCIES" value="false" />
<setting name="EXCLUDE_EXPLODED_DIRECTORY" value="true" />
+ <setting name="RUN_JASPER_VALIDATION" value="false" />
+ <setting name="BUILD_ONLY_WEB_RESOURCES" value="false" />
</building>
<packaging>
<containerElement type="module" name="canvasgrid">
<attribute name="method" value="1" />
<attribute name="URI" value="/WEB-INF/classes" />
</containerElement>
+ <containerElement type="module" name="bespin">
+ <attribute name="method" value="1" />
+ <attribute name="URI" value="/WEB-INF/classes" />
+ </containerElement>
+ </packaging>
+ </configuration>
+ </facet>
+ <facet type="web" name="Web3" implicit="true">
+ <configuration>
+ <descriptors>
+ <deploymentDescriptor name="web.xml" url="file://$MODULE_DIR$/backend/java/web/WEB-INF/web.xml" optional="false" version="2.5" />
+ </descriptors>
+ <webroots>
+ <root url="file://$MODULE_DIR$/backend/java/web" relative="/" />
+ </webroots>
+ <building>
+ <setting name="EXPLODED_URL" value="file://" />
+ <setting name="EXPLODED_ENABLED" value="false" />
+ <setting name="JAR_URL" value="file://" />
+ <setting name="JAR_ENABLED" value="false" />
+ <setting name="BUILD_MODULE_ON_FRAME_DEACTIVATION" value="false" />
+ <setting name="BUILD_EXTERNAL_DEPENDENCIES" value="false" />
+ <setting name="EXCLUDE_EXPLODED_DIRECTORY" value="true" />
+ <setting name="RUN_JASPER_VALIDATION" value="true" />
+ <setting name="BUILD_ONLY_WEB_RESOURCES" value="false" />
+ </building>
+ <packaging>
+ <containerElement type="module" name="bespin">
+ <attribute name="method" value="1" />
+ <attribute name="URI" value="/WEB-INF/classes" />
+ </containerElement>
</packaging>
</configuration>
</facet>
@@ -62,6 +105,7 @@
<SOURCES />
</library>
</orderEntry>
+ <orderEntryProperties />
</component>
</module>
View
@@ -424,7 +424,7 @@
<module fileurl="file://$PROJECT_DIR$/bespin.iml" filepath="$PROJECT_DIR$/bespin.iml" />
</modules>
</component>
- <component name="ProjectRootManager" version="2" languageLevel="JDK_1_3" assert-keyword="false" jdk-15="false" project-jdk-name="1.6" project-jdk-type="JavaSDK">
+ <component name="ProjectRootManager" version="2" assert-keyword="false" jdk-15="false" project-jdk-name="1.6" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
<component name="ResourceManagerContainer">
@@ -476,7 +476,7 @@
</entry>
</map>
</option>
- <option name="myVersion" value="124" />
+ <option name="myVersion" value="123" />
</component>
<component name="SvnChangesBrowserSettings">
<option name="USE_AUTHOR_FIELD" value="true" />
@@ -493,7 +493,7 @@
<option name="SHOW_FILE_HISTORY_AS_TREE" value="true" />
</component>
<component name="VcsDirectoryMappings">
- <mapping directory="" vcs="svn" />
+ <mapping directory="" vcs="" />
</component>
<component name="WebServicesPlugin" addRequiredLibraries="true" />
<component name="com.intellij.ide.util.scopeChooser.ScopeChooserConfigurable" proportions="" version="1">
@@ -119,6 +119,24 @@ var EditorActions = Class.create({
return args;
},
+ movePageUp: function(args) {
+ this.editor.cursorPosition.row = Math.max(this.editor.ui.firstVisibleRow - this.editor.ui.visibleRows, 0);;
+
+ this.handleCursorSelection(args);
+ this.repaint();
+
+ return args;
+ },
+
+ movePageDown: function(args) {
+ this.editor.cursorPosition.row = Math.min(this.editor.cursorPosition.row + this.editor.ui.visibleRows, this.editor.model.getRowCount() - 1);
+
+ this.handleCursorSelection(args);
+ this.repaint();
+
+ return args;
+ },
+
moveWordLeft: function(args) {
var row = this.editor.model.getRowArray(args.pos.row);
@@ -312,7 +312,8 @@ var EditorUI = Class.create({
this.lineHeight; // reserved for when line height is calculated dynamically instead of with a constant; set first time a paint occurs
this.charWidth; // set first time a paint occurs
- this.cheight; // last time the
+ this.visibleRows; // the number of rows visible in the editor; set each time a paint occurs
+ this.firstVisibleRow; // first row that is visible in the editor; set each time a paint occurs
this.nibup; // rect
this.nibdown; // rect
this.nibleft; // rect
@@ -611,6 +612,9 @@ var EditorUI = Class.create({
listener.bindKeyString("APPLE", Key.ARROW_UP, this.actions.moveToFileTop);
listener.bindKeyString("APPLE", Key.ARROW_DOWN, this.actions.moveToFileBottom);
+ listener.bindKeyString("", Key.PAGE_UP, this.actions.movePageUp);
+ listener.bindKeyString("", Key.PAGE_DOWN, this.actions.movePageDown);
+
// Other key bindings can be found in commands themselves.
// For example, this:
// listener.bindKeyString("CTRL SHIFT", Key.N, "bespin:editor:newfile");
@@ -660,7 +664,6 @@ var EditorUI = Class.create({
var x, y;
var cy;
var currentLine;
- var firstLineToRender;
var lastLineToRender;
var refreshCanvas = (this.lastLineCount != ed.model.getRowCount());
@@ -741,14 +744,15 @@ var EditorUI = Class.create({
ctx.translate(0, this.yoffset);
// only paint those lines that can be visible
- firstLineToRender = Math.floor(Math.abs(this.yoffset / lineHeight));
- lastLineToRender = Math.ceil(firstLineToRender + (cheight / lineHeight));
+ this.visibleRows = Math.ceil(cheight / lineHeight);
+ this.firstVisibleRow = Math.floor(Math.abs(this.yoffset / lineHeight));
+ lastLineToRender = this.firstVisibleRow + this.visibleRows;
if (lastLineToRender > (ed.model.getRowCount() - 1)) lastLineToRender = ed.model.getRowCount() - 1;
// paint the line numbers
if (refreshCanvas) {
- y = (lineHeight * firstLineToRender);
- for (currentLine = firstLineToRender; currentLine <= lastLineToRender; currentLine++) {
+ y = (lineHeight * this.firstVisibleRow);
+ for (currentLine = this.firstVisibleRow; currentLine <= lastLineToRender; currentLine++) {
x = this.GUTTER_INSETS.left;
cy = y + (lineHeight - this.LINE_INSETS.bottom);
@@ -771,13 +775,13 @@ var EditorUI = Class.create({
var lastColumn = firstColumn + (Math.ceil((cwidth - this.GUTTER_WIDTH) / this.charWidth));
// paint the line content and zebra stripes (kept in separate loop to simplify scroll translation and clipping)
- y = (lineHeight * firstLineToRender);
+ y = (lineHeight * this.firstVisibleRow);
var cc; // the starting column of the current region in the region render loop below
var ce; // the ending column in the same loop
var ri; // counter variable used for the same loop
var regionlen; // length of the text in the region; used in the same loop
var tx, tw;
- for (currentLine = firstLineToRender; currentLine <= lastLineToRender; currentLine++) {
+ for (currentLine = this.firstVisibleRow; currentLine <= lastLineToRender; currentLine++) {
x = this.GUTTER_WIDTH;
if (!refreshCanvas) {
View
@@ -76,15 +76,6 @@ var fixCanvas = function(ctx) {
if (!ctx.measureText) {
ctx.measureText = function() { return 10; }
}
-
- // temporary debugging crap
-// if (ctx.fillRect && !ctx.fillRectOriginal) {
-// ctx.fillRectOriginal = ctx.fillRect;
-// ctx.fillRect = function(x, y, w, h) {
-// console.log(x + ", " + y + ", " + w + ", " + h);
-// ctx.fillRectOriginal(x, y, w, h);
-// }
-// }
};
/*
View
@@ -67,8 +67,9 @@ var Key = {
ARROW_UP: 38,
ARROW_RIGHT: 39,
ARROW_DOWN: 40,
- DELETE: 46
-
+ DELETE: 46,
+ PAGE_UP: 33,
+ PAGE_DOWN: 34
};
/*
@@ -36,19 +36,19 @@ var Navigate = new function() {
// Public
return {
dashboard: function() {
- go("/dashboard.html");
+ go("dashboard.html");
},
home: function() {
- go("/");
+ go("index.html");
},
quickEdit: function() {
- go("/editor.html#new=true");
+ go("editor.html#new=true");
},
editor: function(project, path) {
- var url = "/editor.html#";
+ var url = "editor.html#";
var args = [];
if (project) args.push("project=" + project);

0 comments on commit 27a81fc

Please sign in to comment.