diff --git a/libraries/Theme.class.php b/libraries/Theme.class.php index ef54a2f142..d0eccf7828 100644 --- a/libraries/Theme.class.php +++ b/libraries/Theme.class.php @@ -75,6 +75,7 @@ class PMA_Theme 'navigation', 'pmd', 'rte', + 'codemirror', 'jqplot' ); @@ -451,6 +452,23 @@ class PMA_Theme : ''; } + /** + * Gets currently configured font size. + * + * @return String with font size. + */ + function getFontSize() + { + $fs = $GLOBALS['PMA_Config']->get('fontsize'); + if (!is_null($fs)) { + return $fs; + } + if (isset($_COOKIE['pma_fontsize'])) { + return $_COOKIE['pma_fontsize']; + } + return '82%'; + } + /** * Generates code for CSS gradient using various browser extensions. * @@ -485,11 +503,9 @@ class PMA_Theme /** * Returns CSS styles for CodeMirror editor based on query formatter colors. * - * @param boolean $generic Whether to include generic CodeMirror CSS as well - * * @return string CSS code. */ - function getCssCodeMirror($generic = false) + function getCssCodeMirror() { if (! $GLOBALS['cfg']['CodemirrorEnable']) { return ''; @@ -529,97 +545,6 @@ class PMA_Theme $result[] = ' color: ' . $GLOBALS['cfg']['SQP']['fmtColor']['digit_integer'] . ';'; $result[] = '}'; - if ($generic) { - $height = ceil($GLOBALS['cfg']['TextareaRows'] * 1.2); - $result[] = <<get('fontsize') ? $GLOBALS['PMA_Config']->get('fontsize') : ( - isset($_COOKIE['pma_fontsize']) ? $_COOKIE['pma_fontsize'] : '82%'));?>; + font-size: getFontSize(); ?> } input, @@ -2124,8 +2123,6 @@ fieldset .disabled-field td { top: 103px; } -getCssCodeMirror(true); ?> - .colborder { cursor: col-resize; height: 100%; @@ -2614,7 +2611,7 @@ table.jqplot-cursor-tooltip { font-size: 0.75em; z-index: 2; } - + td.jqplot-cursor-legend-swatch { vertical-align: middle; text-align: center; diff --git a/themes/pmahomme/css/codemirror.css.php b/themes/pmahomme/css/codemirror.css.php new file mode 100644 index 0000000000..a0682eef70 --- /dev/null +++ b/themes/pmahomme/css/codemirror.css.php @@ -0,0 +1,88 @@ +.CodeMirror { + font-size: 140%; + font-family: monospace; + background: #fff; + border: 1px solid #000; +} + +.CodeMirror-scroll { + overflow: auto; + height: em; + /* This is needed to prevent an IE[67] bug where the scrolled content + is visible outside of the scrolling box. */ + position: relative; +} + +.CodeMirror-gutter { + position: absolute; left: 0; top: 0; + z-index: 10; + background-color: #f7f7f7; + border-right: 1px solid #eee; + min-width: 2em; + height: 100%; +} +.CodeMirror-gutter-text { + color: #aaa; + text-align: right; + padding: .4em .2em .4em .4em; + white-space: pre !important; +} +.CodeMirror-lines { + padding: .4em; +} + +.CodeMirror pre { + -moz-border-radius: 0; + -webkit-border-radius: 0; + -o-border-radius: 0; + border-radius: 0; + border-width: 0; margin: 0; padding: 0; background: transparent; + font-family: inherit; + font-size: inherit; + padding: 0; margin: 0; + white-space: pre; + word-wrap: normal; +} + +.CodeMirror-wrap pre { + word-wrap: break-word; + white-space: pre-wrap; +} +.CodeMirror-wrap .CodeMirror-scroll { + overflow-x: hidden; +} + +.CodeMirror textarea { + font-family: inherit !important; + font-size: inherit !important; +} + +.CodeMirror-cursor { + z-index: 10; + position: absolute; + visibility: hidden; + border-left: 1px solid black !important; +} + +.CodeMirror-focused .CodeMirror-cursor { + visibility: visible; +} + +span.CodeMirror-selected { + background: #ccc !important; + color: HighlightText !important; +} + +.CodeMirror-focused span.CodeMirror-selected { + background: Highlight !important; +} + +.CodeMirror-matchingbracket { + color: #0f0 !important; +} + +.CodeMirror-nonmatchingbracket { + color: #f22 !important; +} + +getCssCodeMirror(); ?> diff --git a/themes/pmahomme/css/common.css.php b/themes/pmahomme/css/common.css.php index c3454d9a52..79f59b6fc8 100644 --- a/themes/pmahomme/css/common.css.php +++ b/themes/pmahomme/css/common.css.php @@ -16,8 +16,7 @@ if (! defined('PMA_MINIMUM_COMMON') && ! defined('TESTSUITE')) { /* general tags */ html { - font-size: get('fontsize') ? $GLOBALS['PMA_Config']->get('fontsize') : ( - isset($_COOKIE['pma_fontsize']) ? $_COOKIE['pma_fontsize'] : '82%'));?>; + font-size: getFontSize(); ?> } input, @@ -2588,8 +2587,6 @@ fieldset .disabled-field td { top: 103px; } -getCssCodeMirror(true); ?> - .colborder { cursor: col-resize; height: 100%;