2011-06-08 21:39:03 +02:00
|
|
|
<?php
|
|
|
|
|
2012-11-01 21:30:37 +01:00
|
|
|
final class DifferentialPrimaryPaneView
|
|
|
|
extends DifferentialCodeWidthSensitiveView {
|
2011-06-08 21:39:03 +02:00
|
|
|
|
2011-07-08 22:00:30 +02:00
|
|
|
private $id;
|
2011-06-08 21:39:03 +02:00
|
|
|
|
2011-07-08 22:00:30 +02:00
|
|
|
public function setID($id) {
|
|
|
|
$this->id = $id;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2011-06-08 21:39:03 +02:00
|
|
|
public function render() {
|
|
|
|
|
|
|
|
// This is chosen somewhat arbitrarily so the math works out correctly
|
|
|
|
// for 80 columns and sets it to the preexisting width (1162px). It may
|
|
|
|
// need some tweaking, but when lineWidth = 80, the computed pixel width
|
|
|
|
// should be 1162px or something along those lines.
|
|
|
|
|
|
|
|
// Override the 'td' width rule with a more specific, inline style tag.
|
|
|
|
// TODO: move this to <head> somehow.
|
2012-11-01 21:30:37 +01:00
|
|
|
$td_width = ceil((88 / 80) * $this->getLineWidth());
|
2011-06-08 21:39:03 +02:00
|
|
|
$style_tag = phutil_render_tag(
|
|
|
|
'style',
|
|
|
|
array(
|
|
|
|
'type' => 'text/css',
|
|
|
|
),
|
|
|
|
".differential-diff td { width: {$td_width}ex; }");
|
|
|
|
|
|
|
|
return phutil_render_tag(
|
|
|
|
'div',
|
|
|
|
array(
|
|
|
|
'class' => 'differential-primary-pane',
|
2011-07-08 22:00:30 +02:00
|
|
|
'id' => $this->id,
|
2011-06-08 21:39:03 +02:00
|
|
|
),
|
|
|
|
$style_tag.$this->renderChildren());
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|