Merge commit 'origin/jg/tree_context'
[GitX.git] / html / dragtest.html
blobdfa4c5c50c8f5b1fe4123ef27058dd61e3c12351
1 <html>
2 <head>
4 <link rel="stylesheet" href="css/GitX.css" type="text/css" media="screen" title="no title" charset="utf-8">
5 <link rel="stylesheet" href="css/diff.css" type="text/css" media="screen" title="no title" charset="utf-8">
6 <script src="lib/GitX.js" type="text/javascript" charset="utf-8"></script>
7 <script src="lib/diffHighlighter.js" type="text/javascript" charset="utf-8"></script>
9 <style type="text/css" media="screen">
10 #lijstmetdingen {
11 font-size: 50%;
13 .line {
15 #selected {
16 background-color: #B5D5FE !important;
17 -webkit-border-radius: 3px;
18 -webkit-box-sizing: border-box;
19 width: 100%;
20 /* border: 1px solid red;*/
21 padding-left: 3px !important;
22 padding-right: 3px !important;
23 /* margin-left: -3px !important;
24 margin-right: -3px !important;
25 */ }
27 #selected div {
28 background-color: #B5D5FE;
31 #stageButton {
32 float: right;
34 display: block;
35 height: 12px;
36 padding: 4px;
37 -webkit-border-radius: 4px;
38 background-color: white !important;
39 border: 1px solid blue;
40 margin-top: 4px;
41 z-index: -100;
44 </style>
46 <script type="text/javascript" charset="utf-8">
47 var nodeIndex = function(list, element)
49 for (i = 0; i < list.childNodes.length; ++i)
50 if (list.childNodes[i] == element)
51 return i;
52 return -1
55 var deselect = function()
57 var selection = document.getElementById("selected");
58 if (selection) {
59 while (selection.childNodes[1])
60 selection.parentNode.insertBefore(selection.childNodes[1], selection);
61 selection.parentNode.removeChild(selection);
65 var showSelection = function(list, from, to)
67 deselect();
68 var startIndex = nodeIndex(list, from);
69 var endIndex = nodeIndex(list, to);
71 if (startIndex == -1 || endIndex == -1)
72 return;
74 if (startIndex > endIndex)
76 var tmp = endIndex;
77 endIndex = startIndex;
78 startIndex = tmp;
79 tmp = to;
80 to = from;
81 from = tmp;
84 // new Array().slice() doesn't work with elementnodes :(
85 // So we create an array ourselves
86 var elementList = [];
87 for (i = startIndex; i <= endIndex; ++i)
88 elementList.push(from.parentNode.childNodes[i]);
90 var selection = document.createElement("div");
91 selection.setAttribute("id", "selected");
92 var button = document.createElement("div");
93 button.setAttribute("id", "stageButton");
94 button.appendChild(document.createTextNode("Stage lines"));
95 button.onmousedown = function() {
96 while (selection.firstChild)
97 selection.removeChild(selection.firstChild);
98 return false;
100 selection.appendChild(button);
101 list.insertBefore(selection, from);
103 var element;
104 for (i = 0; i < elementList.length; i++)
105 selection.appendChild(elementList[i]);
108 var load = function()
110 document.onmousedown = function(event) {
111 var cur = event.target;
112 while (cur) {
113 if (cur.getAttribute && cur.getAttribute("class") && cur.getAttribute("class").indexOf("lines") != -1)
114 return;
115 cur = cur.parentNode;
117 deselect();
120 highlightDiff($("orig_diff").value,
121 $("lijstmetdingen"),
125 var list = document.getElementsByClassName("lines");
127 for (i = 0; i < list.length; ++i) {
128 file = list[i];
129 file.onmousedown = function(event) {
130 file.onmouseover = function(event2) {
131 showSelection(file, event.srcElement, event2.target);
132 return false;
135 file.onmouseup = function(event2) {
136 file.onmouseover = null;
137 file.onmouseup = null;
140 showSelection(file, event.srcElement, event.srcElement);
141 return false;
145 </script>
146 </head>
147 <body onload="load()">
148 <textarea style='display:none' id="orig_diff" rows="8" cols="40">
149 diff --git a/.gitignore b/.gitignore
150 index b89b7b7..3367a4e 100644
151 --- a/.gitignore
152 +++ b/.gitignore
153 @@ -1,4 +1,5 @@
154 build
155 +build/revision
156 *.xcodeproj/*.pbxuser
157 *.xcodeproj/*.perspectivev3
158 *.xcodeproj/*.mode1v3
159 diff --git a/ApplicationController.m b/ApplicationController.m
160 index 86252cd..3a86d38 100644
161 --- a/ApplicationController.m
162 +++ b/ApplicationController.m
163 @@ -21,7 +21,7 @@ @implementation ApplicationController
165 - (ApplicationController*)init
167 -#ifndef NDEBUG
168 +#ifdef DEBUG_BUILD
169 [NSApp activateIgnoringOtherApps:YES];
170 #endif
172 @@ -92,12 +92,16 @@ - (IBAction)openPreferencesWindow:(id)sender
173 - (IBAction)installCliTool:(id)sender;
175 BOOL success = NO;
176 - NSString* installationPath = @"/usr/local/bin/gitx";
177 + NSString* installationPath = @"/usr/local/bin/";
178 + NSString* installationName = @"gitx";
179 NSString* toolPath = [[NSBundle mainBundle] pathForResource:@"gitx" ofType:@""];
180 if (toolPath) {
181 AuthorizationRef auth;
182 if (AuthorizationCreate(NULL, kAuthorizationEmptyEnvironment, kAuthorizationFlagDefaults, &auth) == errAuthorizationSuccess) {
183 - char const* arguments[] = { "-f", "-s", [toolPath UTF8String], [installationPath UTF8String], NULL };
184 + char const* mkdir_arg[] = { "-p", [installationPath UTF8String], NULL};
185 + char const* mkdir = "/bin/mkdir";
186 + AuthorizationExecuteWithPrivileges(auth, mkdir, kAuthorizationFlagDefaults, (char**)mkdir_arg, NULL);
187 + char const* arguments[] = { "-f", "-s", [toolPath UTF8String], [[installationPath stringByAppendingString: installationName] UTF8String], NULL };
188 char const* helperTool = "/bin/ln";
189 if (AuthorizationExecuteWithPrivileges(auth, helperTool, kAuthorizationFlagDefaults, (char**)arguments, NULL) == errAuthorizationSuccess) {
190 int status;
191 </textarea>
192 <div id='lijstmetdingen'></div>
193 </body>
194 </body>
195 </html>