gitlab-pygments.rb 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +6 -0
- data/Gemfile +2 -0
- data/README.md +91 -0
- data/Rakefile +78 -0
- data/bench.rb +22 -0
- data/cache-lexers.rb +8 -0
- data/lexers +0 -0
- data/lib/pygments/lexer.rb +148 -0
- data/lib/pygments/mentos.py +344 -0
- data/lib/pygments/popen.rb +389 -0
- data/lib/pygments/version.rb +3 -0
- data/lib/pygments.rb +8 -0
- data/pygments.rb.gemspec +24 -0
- data/test/test_data.c +2581 -0
- data/test/test_data.py +514 -0
- data/test/test_data_generated +2582 -0
- data/test/test_pygments.rb +276 -0
- data/vendor/custom_formatters/gitlab.py +171 -0
- data/vendor/custom_lexers/github.py +362 -0
- data/vendor/pygments-main/AUTHORS +115 -0
- data/vendor/pygments-main/CHANGES +762 -0
- data/vendor/pygments-main/LICENSE +25 -0
- data/vendor/pygments-main/MANIFEST.in +6 -0
- data/vendor/pygments-main/Makefile +59 -0
- data/vendor/pygments-main/REVISION +1 -0
- data/vendor/pygments-main/TODO +15 -0
- data/vendor/pygments-main/docs/generate.py +472 -0
- data/vendor/pygments-main/docs/pygmentize.1 +94 -0
- data/vendor/pygments-main/docs/src/api.txt +270 -0
- data/vendor/pygments-main/docs/src/authors.txt +5 -0
- data/vendor/pygments-main/docs/src/changelog.txt +5 -0
- data/vendor/pygments-main/docs/src/cmdline.txt +147 -0
- data/vendor/pygments-main/docs/src/filterdevelopment.txt +70 -0
- data/vendor/pygments-main/docs/src/filters.txt +42 -0
- data/vendor/pygments-main/docs/src/formatterdevelopment.txt +169 -0
- data/vendor/pygments-main/docs/src/formatters.txt +48 -0
- data/vendor/pygments-main/docs/src/index.txt +69 -0
- data/vendor/pygments-main/docs/src/installation.txt +71 -0
- data/vendor/pygments-main/docs/src/integrate.txt +43 -0
- data/vendor/pygments-main/docs/src/lexerdevelopment.txt +551 -0
- data/vendor/pygments-main/docs/src/lexers.txt +67 -0
- data/vendor/pygments-main/docs/src/moinmoin.txt +39 -0
- data/vendor/pygments-main/docs/src/plugins.txt +93 -0
- data/vendor/pygments-main/docs/src/quickstart.txt +202 -0
- data/vendor/pygments-main/docs/src/rstdirective.txt +22 -0
- data/vendor/pygments-main/docs/src/styles.txt +143 -0
- data/vendor/pygments-main/docs/src/tokens.txt +349 -0
- data/vendor/pygments-main/docs/src/unicode.txt +49 -0
- data/vendor/pygments-main/external/markdown-processor.py +67 -0
- data/vendor/pygments-main/external/moin-parser.py +112 -0
- data/vendor/pygments-main/external/pygments.bashcomp +38 -0
- data/vendor/pygments-main/external/rst-directive-old.py +77 -0
- data/vendor/pygments-main/external/rst-directive.py +83 -0
- data/vendor/pygments-main/ez_setup.py +276 -0
- data/vendor/pygments-main/pygmentize +7 -0
- data/vendor/pygments-main/pygments/__init__.py +91 -0
- data/vendor/pygments-main/pygments/cmdline.py +433 -0
- data/vendor/pygments-main/pygments/console.py +74 -0
- data/vendor/pygments-main/pygments/filter.py +74 -0
- data/vendor/pygments-main/pygments/filters/__init__.py +357 -0
- data/vendor/pygments-main/pygments/formatter.py +92 -0
- data/vendor/pygments-main/pygments/formatters/__init__.py +68 -0
- data/vendor/pygments-main/pygments/formatters/_mapping.py +94 -0
- data/vendor/pygments-main/pygments/formatters/bbcode.py +109 -0
- data/vendor/pygments-main/pygments/formatters/gitlab.py +171 -0
- data/vendor/pygments-main/pygments/formatters/html.py +750 -0
- data/vendor/pygments-main/pygments/formatters/img.py +553 -0
- data/vendor/pygments-main/pygments/formatters/latex.py +378 -0
- data/vendor/pygments-main/pygments/formatters/other.py +117 -0
- data/vendor/pygments-main/pygments/formatters/rtf.py +136 -0
- data/vendor/pygments-main/pygments/formatters/svg.py +154 -0
- data/vendor/pygments-main/pygments/formatters/terminal.py +112 -0
- data/vendor/pygments-main/pygments/formatters/terminal256.py +222 -0
- data/vendor/pygments-main/pygments/lexer.py +697 -0
- data/vendor/pygments-main/pygments/lexers/__init__.py +229 -0
- data/vendor/pygments-main/pygments/lexers/_asybuiltins.py +1645 -0
- data/vendor/pygments-main/pygments/lexers/_clbuiltins.py +232 -0
- data/vendor/pygments-main/pygments/lexers/_luabuiltins.py +249 -0
- data/vendor/pygments-main/pygments/lexers/_mapping.py +298 -0
- data/vendor/pygments-main/pygments/lexers/_phpbuiltins.py +3787 -0
- data/vendor/pygments-main/pygments/lexers/_postgres_builtins.py +232 -0
- data/vendor/pygments-main/pygments/lexers/_scilab_builtins.py +29 -0
- data/vendor/pygments-main/pygments/lexers/_vimbuiltins.py +3 -0
- data/vendor/pygments-main/pygments/lexers/agile.py +1803 -0
- data/vendor/pygments-main/pygments/lexers/asm.py +360 -0
- data/vendor/pygments-main/pygments/lexers/compiled.py +2891 -0
- data/vendor/pygments-main/pygments/lexers/dotnet.py +636 -0
- data/vendor/pygments-main/pygments/lexers/functional.py +1832 -0
- data/vendor/pygments-main/pygments/lexers/github.py +362 -0
- data/vendor/pygments-main/pygments/lexers/hdl.py +356 -0
- data/vendor/pygments-main/pygments/lexers/jvm.py +847 -0
- data/vendor/pygments-main/pygments/lexers/math.py +1072 -0
- data/vendor/pygments-main/pygments/lexers/other.py +3339 -0
- data/vendor/pygments-main/pygments/lexers/parsers.py +695 -0
- data/vendor/pygments-main/pygments/lexers/shell.py +361 -0
- data/vendor/pygments-main/pygments/lexers/special.py +100 -0
- data/vendor/pygments-main/pygments/lexers/sql.py +559 -0
- data/vendor/pygments-main/pygments/lexers/templates.py +1631 -0
- data/vendor/pygments-main/pygments/lexers/text.py +1753 -0
- data/vendor/pygments-main/pygments/lexers/web.py +2864 -0
- data/vendor/pygments-main/pygments/plugin.py +74 -0
- data/vendor/pygments-main/pygments/scanner.py +104 -0
- data/vendor/pygments-main/pygments/style.py +117 -0
- data/vendor/pygments-main/pygments/styles/__init__.py +70 -0
- data/vendor/pygments-main/pygments/styles/autumn.py +65 -0
- data/vendor/pygments-main/pygments/styles/borland.py +51 -0
- data/vendor/pygments-main/pygments/styles/bw.py +49 -0
- data/vendor/pygments-main/pygments/styles/colorful.py +81 -0
- data/vendor/pygments-main/pygments/styles/default.py +73 -0
- data/vendor/pygments-main/pygments/styles/emacs.py +72 -0
- data/vendor/pygments-main/pygments/styles/friendly.py +72 -0
- data/vendor/pygments-main/pygments/styles/fruity.py +42 -0
- data/vendor/pygments-main/pygments/styles/manni.py +75 -0
- data/vendor/pygments-main/pygments/styles/monokai.py +106 -0
- data/vendor/pygments-main/pygments/styles/murphy.py +80 -0
- data/vendor/pygments-main/pygments/styles/native.py +65 -0
- data/vendor/pygments-main/pygments/styles/pastie.py +75 -0
- data/vendor/pygments-main/pygments/styles/perldoc.py +69 -0
- data/vendor/pygments-main/pygments/styles/rrt.py +33 -0
- data/vendor/pygments-main/pygments/styles/tango.py +141 -0
- data/vendor/pygments-main/pygments/styles/trac.py +63 -0
- data/vendor/pygments-main/pygments/styles/vim.py +63 -0
- data/vendor/pygments-main/pygments/styles/vs.py +38 -0
- data/vendor/pygments-main/pygments/token.py +195 -0
- data/vendor/pygments-main/pygments/unistring.py +130 -0
- data/vendor/pygments-main/pygments/util.py +232 -0
- data/vendor/pygments-main/scripts/check_sources.py +242 -0
- data/vendor/pygments-main/scripts/detect_missing_analyse_text.py +30 -0
- data/vendor/pygments-main/scripts/epydoc.css +280 -0
- data/vendor/pygments-main/scripts/find_codetags.py +205 -0
- data/vendor/pygments-main/scripts/find_error.py +171 -0
- data/vendor/pygments-main/scripts/get_vimkw.py +43 -0
- data/vendor/pygments-main/scripts/pylintrc +301 -0
- data/vendor/pygments-main/scripts/reindent.py +291 -0
- data/vendor/pygments-main/scripts/vim2pygments.py +933 -0
- data/vendor/pygments-main/setup.cfg +6 -0
- data/vendor/pygments-main/setup.py +88 -0
- data/vendor/pygments-main/tests/dtds/HTML4-f.dtd +37 -0
- data/vendor/pygments-main/tests/dtds/HTML4-s.dtd +869 -0
- data/vendor/pygments-main/tests/dtds/HTML4.dcl +88 -0
- data/vendor/pygments-main/tests/dtds/HTML4.dtd +1092 -0
- data/vendor/pygments-main/tests/dtds/HTML4.soc +9 -0
- data/vendor/pygments-main/tests/dtds/HTMLlat1.ent +195 -0
- data/vendor/pygments-main/tests/dtds/HTMLspec.ent +77 -0
- data/vendor/pygments-main/tests/dtds/HTMLsym.ent +241 -0
- data/vendor/pygments-main/tests/examplefiles/ANTLRv3.g +608 -0
- data/vendor/pygments-main/tests/examplefiles/AcidStateAdvanced.hs +209 -0
- data/vendor/pygments-main/tests/examplefiles/AlternatingGroup.mu +102 -0
- data/vendor/pygments-main/tests/examplefiles/CPDictionary.j +611 -0
- data/vendor/pygments-main/tests/examplefiles/Constants.mo +158 -0
- data/vendor/pygments-main/tests/examplefiles/DancingSudoku.lhs +411 -0
- data/vendor/pygments-main/tests/examplefiles/Errors.scala +18 -0
- data/vendor/pygments-main/tests/examplefiles/File.hy +174 -0
- data/vendor/pygments-main/tests/examplefiles/Intro.java +1660 -0
- data/vendor/pygments-main/tests/examplefiles/Makefile +1131 -0
- data/vendor/pygments-main/tests/examplefiles/Object.st +4394 -0
- data/vendor/pygments-main/tests/examplefiles/OrderedMap.hx +584 -0
- data/vendor/pygments-main/tests/examplefiles/SmallCheck.hs +378 -0
- data/vendor/pygments-main/tests/examplefiles/Sorting.mod +470 -0
- data/vendor/pygments-main/tests/examplefiles/Sudoku.lhs +382 -0
- data/vendor/pygments-main/tests/examplefiles/addressbook.proto +30 -0
- data/vendor/pygments-main/tests/examplefiles/antlr_throws +1 -0
- data/vendor/pygments-main/tests/examplefiles/apache2.conf +393 -0
- data/vendor/pygments-main/tests/examplefiles/as3_test.as +143 -0
- data/vendor/pygments-main/tests/examplefiles/as3_test2.as +46 -0
- data/vendor/pygments-main/tests/examplefiles/as3_test3.as +3 -0
- data/vendor/pygments-main/tests/examplefiles/aspx-cs_example +27 -0
- data/vendor/pygments-main/tests/examplefiles/badcase.java +2 -0
- data/vendor/pygments-main/tests/examplefiles/batchfile.bat +49 -0
- data/vendor/pygments-main/tests/examplefiles/boot-9.scm +1557 -0
- data/vendor/pygments-main/tests/examplefiles/cells.ps +515 -0
- data/vendor/pygments-main/tests/examplefiles/ceval.c +2604 -0
- data/vendor/pygments-main/tests/examplefiles/cheetah_example.html +13 -0
- data/vendor/pygments-main/tests/examplefiles/classes.dylan +40 -0
- data/vendor/pygments-main/tests/examplefiles/condensed_ruby.rb +10 -0
- data/vendor/pygments-main/tests/examplefiles/coq_RelationClasses +447 -0
- data/vendor/pygments-main/tests/examplefiles/database.pytb +20 -0
- data/vendor/pygments-main/tests/examplefiles/de.MoinMoin.po +2461 -0
- data/vendor/pygments-main/tests/examplefiles/demo.ahk +181 -0
- data/vendor/pygments-main/tests/examplefiles/demo.cfm +38 -0
- data/vendor/pygments-main/tests/examplefiles/django_sample.html+django +68 -0
- data/vendor/pygments-main/tests/examplefiles/dwarf.cw +17 -0
- data/vendor/pygments-main/tests/examplefiles/erl_session +10 -0
- data/vendor/pygments-main/tests/examplefiles/escape_semicolon.clj +1 -0
- data/vendor/pygments-main/tests/examplefiles/evil_regex.js +48 -0
- data/vendor/pygments-main/tests/examplefiles/example.c +2080 -0
- data/vendor/pygments-main/tests/examplefiles/example.cls +15 -0
- data/vendor/pygments-main/tests/examplefiles/example.cpp +2363 -0
- data/vendor/pygments-main/tests/examplefiles/example.gs +106 -0
- data/vendor/pygments-main/tests/examplefiles/example.gst +7 -0
- data/vendor/pygments-main/tests/examplefiles/example.kt +47 -0
- data/vendor/pygments-main/tests/examplefiles/example.lua +250 -0
- data/vendor/pygments-main/tests/examplefiles/example.moo +26 -0
- data/vendor/pygments-main/tests/examplefiles/example.moon +629 -0
- data/vendor/pygments-main/tests/examplefiles/example.nim +1010 -0
- data/vendor/pygments-main/tests/examplefiles/example.ns2 +69 -0
- data/vendor/pygments-main/tests/examplefiles/example.p +34 -0
- data/vendor/pygments-main/tests/examplefiles/example.pas +2708 -0
- data/vendor/pygments-main/tests/examplefiles/example.rb +1852 -0
- data/vendor/pygments-main/tests/examplefiles/example.rhtml +561 -0
- data/vendor/pygments-main/tests/examplefiles/example.sh-session +19 -0
- data/vendor/pygments-main/tests/examplefiles/example.sml +156 -0
- data/vendor/pygments-main/tests/examplefiles/example.snobol +15 -0
- data/vendor/pygments-main/tests/examplefiles/example.tea +34 -0
- data/vendor/pygments-main/tests/examplefiles/example.u +548 -0
- data/vendor/pygments-main/tests/examplefiles/example.weechatlog +9 -0
- data/vendor/pygments-main/tests/examplefiles/example.xhtml +376 -0
- data/vendor/pygments-main/tests/examplefiles/example.yaml +302 -0
- data/vendor/pygments-main/tests/examplefiles/example2.aspx +29 -0
- data/vendor/pygments-main/tests/examplefiles/example_elixir.ex +363 -0
- data/vendor/pygments-main/tests/examplefiles/example_file.fy +128 -0
- data/vendor/pygments-main/tests/examplefiles/firefox.mak +586 -0
- data/vendor/pygments-main/tests/examplefiles/flipflop.sv +19 -0
- data/vendor/pygments-main/tests/examplefiles/foo.sce +6 -0
- data/vendor/pygments-main/tests/examplefiles/format.ml +1213 -0
- data/vendor/pygments-main/tests/examplefiles/fucked_up.rb +77 -0
- data/vendor/pygments-main/tests/examplefiles/function.mu +1 -0
- data/vendor/pygments-main/tests/examplefiles/functional.rst +1472 -0
- data/vendor/pygments-main/tests/examplefiles/genclass.clj +510 -0
- data/vendor/pygments-main/tests/examplefiles/genshi_example.xml+genshi +193 -0
- data/vendor/pygments-main/tests/examplefiles/genshitext_example.genshitext +33 -0
- data/vendor/pygments-main/tests/examplefiles/glsl.frag +7 -0
- data/vendor/pygments-main/tests/examplefiles/glsl.vert +13 -0
- data/vendor/pygments-main/tests/examplefiles/html+php_faulty.php +1 -0
- data/vendor/pygments-main/tests/examplefiles/http_request_example +14 -0
- data/vendor/pygments-main/tests/examplefiles/http_response_example +27 -0
- data/vendor/pygments-main/tests/examplefiles/import.hs +4 -0
- data/vendor/pygments-main/tests/examplefiles/intro.ik +24 -0
- data/vendor/pygments-main/tests/examplefiles/ints.php +10 -0
- data/vendor/pygments-main/tests/examplefiles/intsyn.fun +675 -0
- data/vendor/pygments-main/tests/examplefiles/intsyn.sig +286 -0
- data/vendor/pygments-main/tests/examplefiles/irb_heredoc +8 -0
- data/vendor/pygments-main/tests/examplefiles/irc.lsp +214 -0
- data/vendor/pygments-main/tests/examplefiles/java.properties +16 -0
- data/vendor/pygments-main/tests/examplefiles/jbst_example1.jbst +28 -0
- data/vendor/pygments-main/tests/examplefiles/jbst_example2.jbst +45 -0
- data/vendor/pygments-main/tests/examplefiles/jinjadesignerdoc.rst +713 -0
- data/vendor/pygments-main/tests/examplefiles/lighttpd_config.conf +13 -0
- data/vendor/pygments-main/tests/examplefiles/linecontinuation.py +47 -0
- data/vendor/pygments-main/tests/examplefiles/ltmain.sh +2849 -0
- data/vendor/pygments-main/tests/examplefiles/main.cmake +42 -0
- data/vendor/pygments-main/tests/examplefiles/markdown.lsp +679 -0
- data/vendor/pygments-main/tests/examplefiles/matlab_noreturn +3 -0
- data/vendor/pygments-main/tests/examplefiles/matlab_sample +27 -0
- data/vendor/pygments-main/tests/examplefiles/matlabsession_sample.txt +37 -0
- data/vendor/pygments-main/tests/examplefiles/minimal.ns2 +4 -0
- data/vendor/pygments-main/tests/examplefiles/moin_SyntaxReference.txt +340 -0
- data/vendor/pygments-main/tests/examplefiles/multiline_regexes.rb +38 -0
- data/vendor/pygments-main/tests/examplefiles/nasm_aoutso.asm +96 -0
- data/vendor/pygments-main/tests/examplefiles/nasm_objexe.asm +30 -0
- data/vendor/pygments-main/tests/examplefiles/nemerle_sample.n +87 -0
- data/vendor/pygments-main/tests/examplefiles/nginx_nginx.conf +118 -0
- data/vendor/pygments-main/tests/examplefiles/numbers.c +12 -0
- data/vendor/pygments-main/tests/examplefiles/objc_example.m +25 -0
- data/vendor/pygments-main/tests/examplefiles/objc_example2.m +24 -0
- data/vendor/pygments-main/tests/examplefiles/perl_misc +62 -0
- data/vendor/pygments-main/tests/examplefiles/perl_perl5db +998 -0
- data/vendor/pygments-main/tests/examplefiles/perl_regex-delims +120 -0
- data/vendor/pygments-main/tests/examplefiles/perlfunc.1 +856 -0
- data/vendor/pygments-main/tests/examplefiles/phpcomplete.vim +567 -0
- data/vendor/pygments-main/tests/examplefiles/pleac.in.rb +1223 -0
- data/vendor/pygments-main/tests/examplefiles/postgresql_test.txt +47 -0
- data/vendor/pygments-main/tests/examplefiles/pppoe.applescript +10 -0
- data/vendor/pygments-main/tests/examplefiles/psql_session.txt +122 -0
- data/vendor/pygments-main/tests/examplefiles/py3_test.txt +2 -0
- data/vendor/pygments-main/tests/examplefiles/pycon_test.pycon +14 -0
- data/vendor/pygments-main/tests/examplefiles/pytb_test2.pytb +2 -0
- data/vendor/pygments-main/tests/examplefiles/python25-bsd.mak +234 -0
- data/vendor/pygments-main/tests/examplefiles/qsort.prolog +13 -0
- data/vendor/pygments-main/tests/examplefiles/r-console-transcript.Rout +38 -0
- data/vendor/pygments-main/tests/examplefiles/ragel-cpp_rlscan +280 -0
- data/vendor/pygments-main/tests/examplefiles/ragel-cpp_snippet +2 -0
- data/vendor/pygments-main/tests/examplefiles/regex.js +22 -0
- data/vendor/pygments-main/tests/examplefiles/reversi.lsp +427 -0
- data/vendor/pygments-main/tests/examplefiles/ruby_func_def.rb +11 -0
- data/vendor/pygments-main/tests/examplefiles/scilab.sci +30 -0
- data/vendor/pygments-main/tests/examplefiles/sibling.prolog +19 -0
- data/vendor/pygments-main/tests/examplefiles/simple.md +747 -0
- data/vendor/pygments-main/tests/examplefiles/smarty_example.html +209 -0
- data/vendor/pygments-main/tests/examplefiles/source.lgt +343 -0
- data/vendor/pygments-main/tests/examplefiles/sources.list +62 -0
- data/vendor/pygments-main/tests/examplefiles/sphere.pov +18 -0
- data/vendor/pygments-main/tests/examplefiles/sqlite3.sqlite3-console +27 -0
- data/vendor/pygments-main/tests/examplefiles/squid.conf +30 -0
- data/vendor/pygments-main/tests/examplefiles/string.jl +1031 -0
- data/vendor/pygments-main/tests/examplefiles/string_delimiters.d +21 -0
- data/vendor/pygments-main/tests/examplefiles/stripheredoc.sh +3 -0
- data/vendor/pygments-main/tests/examplefiles/test.R +119 -0
- data/vendor/pygments-main/tests/examplefiles/test.adb +211 -0
- data/vendor/pygments-main/tests/examplefiles/test.asy +131 -0
- data/vendor/pygments-main/tests/examplefiles/test.awk +121 -0
- data/vendor/pygments-main/tests/examplefiles/test.bas +29 -0
- data/vendor/pygments-main/tests/examplefiles/test.bmx +145 -0
- data/vendor/pygments-main/tests/examplefiles/test.boo +39 -0
- data/vendor/pygments-main/tests/examplefiles/test.bro +250 -0
- data/vendor/pygments-main/tests/examplefiles/test.cs +374 -0
- data/vendor/pygments-main/tests/examplefiles/test.css +54 -0
- data/vendor/pygments-main/tests/examplefiles/test.d +135 -0
- data/vendor/pygments-main/tests/examplefiles/test.dart +23 -0
- data/vendor/pygments-main/tests/examplefiles/test.dtd +89 -0
- data/vendor/pygments-main/tests/examplefiles/test.ec +605 -0
- data/vendor/pygments-main/tests/examplefiles/test.ecl +58 -0
- data/vendor/pygments-main/tests/examplefiles/test.eh +315 -0
- data/vendor/pygments-main/tests/examplefiles/test.erl +169 -0
- data/vendor/pygments-main/tests/examplefiles/test.evoque +33 -0
- data/vendor/pygments-main/tests/examplefiles/test.fan +818 -0
- data/vendor/pygments-main/tests/examplefiles/test.flx +57 -0
- data/vendor/pygments-main/tests/examplefiles/test.gdc +13 -0
- data/vendor/pygments-main/tests/examplefiles/test.groovy +97 -0
- data/vendor/pygments-main/tests/examplefiles/test.html +339 -0
- data/vendor/pygments-main/tests/examplefiles/test.ini +10 -0
- data/vendor/pygments-main/tests/examplefiles/test.java +653 -0
- data/vendor/pygments-main/tests/examplefiles/test.jsp +24 -0
- data/vendor/pygments-main/tests/examplefiles/test.maql +45 -0
- data/vendor/pygments-main/tests/examplefiles/test.mod +374 -0
- data/vendor/pygments-main/tests/examplefiles/test.moo +51 -0
- data/vendor/pygments-main/tests/examplefiles/test.myt +166 -0
- data/vendor/pygments-main/tests/examplefiles/test.nim +93 -0
- data/vendor/pygments-main/tests/examplefiles/test.pas +743 -0
- data/vendor/pygments-main/tests/examplefiles/test.php +505 -0
- data/vendor/pygments-main/tests/examplefiles/test.plot +333 -0
- data/vendor/pygments-main/tests/examplefiles/test.ps1 +108 -0
- data/vendor/pygments-main/tests/examplefiles/test.pypylog +1839 -0
- data/vendor/pygments-main/tests/examplefiles/test.r3 +94 -0
- data/vendor/pygments-main/tests/examplefiles/test.rb +177 -0
- data/vendor/pygments-main/tests/examplefiles/test.rhtml +43 -0
- data/vendor/pygments-main/tests/examplefiles/test.scaml +8 -0
- data/vendor/pygments-main/tests/examplefiles/test.ssp +12 -0
- data/vendor/pygments-main/tests/examplefiles/test.tcsh +830 -0
- data/vendor/pygments-main/tests/examplefiles/test.vb +407 -0
- data/vendor/pygments-main/tests/examplefiles/test.vhdl +161 -0
- data/vendor/pygments-main/tests/examplefiles/test.xqy +138 -0
- data/vendor/pygments-main/tests/examplefiles/test.xsl +23 -0
- data/vendor/pygments-main/tests/examplefiles/truncated.pytb +15 -0
- data/vendor/pygments-main/tests/examplefiles/type.lisp +1202 -0
- data/vendor/pygments-main/tests/examplefiles/underscore.coffee +603 -0
- data/vendor/pygments-main/tests/examplefiles/unicode.applescript +5 -0
- data/vendor/pygments-main/tests/examplefiles/unicodedoc.py +11 -0
- data/vendor/pygments-main/tests/examplefiles/webkit-transition.css +3 -0
- data/vendor/pygments-main/tests/examplefiles/while.pov +13 -0
- data/vendor/pygments-main/tests/examplefiles/wiki.factor +384 -0
- data/vendor/pygments-main/tests/examplefiles/xml_example +1897 -0
- data/vendor/pygments-main/tests/examplefiles/zmlrpc.f90 +798 -0
- data/vendor/pygments-main/tests/old_run.py +138 -0
- data/vendor/pygments-main/tests/run.py +48 -0
- data/vendor/pygments-main/tests/support.py +15 -0
- data/vendor/pygments-main/tests/test_basic_api.py +294 -0
- data/vendor/pygments-main/tests/test_clexer.py +31 -0
- data/vendor/pygments-main/tests/test_cmdline.py +105 -0
- data/vendor/pygments-main/tests/test_examplefiles.py +97 -0
- data/vendor/pygments-main/tests/test_html_formatter.py +162 -0
- data/vendor/pygments-main/tests/test_latex_formatter.py +55 -0
- data/vendor/pygments-main/tests/test_perllexer.py +137 -0
- data/vendor/pygments-main/tests/test_regexlexer.py +47 -0
- data/vendor/pygments-main/tests/test_token.py +46 -0
- data/vendor/pygments-main/tests/test_using_api.py +40 -0
- data/vendor/pygments-main/tests/test_util.py +116 -0
- data/vendor/simplejson/.gitignore +10 -0
- data/vendor/simplejson/.travis.yml +5 -0
- data/vendor/simplejson/CHANGES.txt +291 -0
- data/vendor/simplejson/LICENSE.txt +19 -0
- data/vendor/simplejson/MANIFEST.in +5 -0
- data/vendor/simplejson/README.rst +19 -0
- data/vendor/simplejson/conf.py +179 -0
- data/vendor/simplejson/index.rst +628 -0
- data/vendor/simplejson/scripts/make_docs.py +18 -0
- data/vendor/simplejson/setup.py +104 -0
- data/vendor/simplejson/simplejson/__init__.py +510 -0
- data/vendor/simplejson/simplejson/_speedups.c +2745 -0
- data/vendor/simplejson/simplejson/decoder.py +425 -0
- data/vendor/simplejson/simplejson/encoder.py +567 -0
- data/vendor/simplejson/simplejson/ordered_dict.py +119 -0
- data/vendor/simplejson/simplejson/scanner.py +77 -0
- data/vendor/simplejson/simplejson/tests/__init__.py +67 -0
- data/vendor/simplejson/simplejson/tests/test_bigint_as_string.py +55 -0
- data/vendor/simplejson/simplejson/tests/test_check_circular.py +30 -0
- data/vendor/simplejson/simplejson/tests/test_decimal.py +66 -0
- data/vendor/simplejson/simplejson/tests/test_decode.py +83 -0
- data/vendor/simplejson/simplejson/tests/test_default.py +9 -0
- data/vendor/simplejson/simplejson/tests/test_dump.py +67 -0
- data/vendor/simplejson/simplejson/tests/test_encode_basestring_ascii.py +46 -0
- data/vendor/simplejson/simplejson/tests/test_encode_for_html.py +32 -0
- data/vendor/simplejson/simplejson/tests/test_errors.py +34 -0
- data/vendor/simplejson/simplejson/tests/test_fail.py +91 -0
- data/vendor/simplejson/simplejson/tests/test_float.py +19 -0
- data/vendor/simplejson/simplejson/tests/test_indent.py +86 -0
- data/vendor/simplejson/simplejson/tests/test_item_sort_key.py +20 -0
- data/vendor/simplejson/simplejson/tests/test_namedtuple.py +121 -0
- data/vendor/simplejson/simplejson/tests/test_pass1.py +76 -0
- data/vendor/simplejson/simplejson/tests/test_pass2.py +14 -0
- data/vendor/simplejson/simplejson/tests/test_pass3.py +20 -0
- data/vendor/simplejson/simplejson/tests/test_recursion.py +67 -0
- data/vendor/simplejson/simplejson/tests/test_scanstring.py +117 -0
- data/vendor/simplejson/simplejson/tests/test_separators.py +42 -0
- data/vendor/simplejson/simplejson/tests/test_speedups.py +20 -0
- data/vendor/simplejson/simplejson/tests/test_tuple.py +49 -0
- data/vendor/simplejson/simplejson/tests/test_unicode.py +109 -0
- data/vendor/simplejson/simplejson/tool.py +39 -0
- metadata +492 -0
@@ -0,0 +1,23 @@
|
|
1
|
+
// Greeter example from
|
2
|
+
// <http://www.dartlang.org/docs/getting-started/interface.html>
|
3
|
+
class Greeter implements Comparable {
|
4
|
+
String prefix = 'Hello,';
|
5
|
+
Greeter() {}
|
6
|
+
Greeter.withPrefix(this.prefix);
|
7
|
+
greet(String name) => print('$prefix $name');
|
8
|
+
|
9
|
+
int compareTo(Greeter other) => prefix.compareTo(other.prefix);
|
10
|
+
}
|
11
|
+
|
12
|
+
void main() {
|
13
|
+
Greeter greeter = new Greeter();
|
14
|
+
Greeter greeter2 = new Greeter.withPrefix('Hi,');
|
15
|
+
|
16
|
+
num result = greeter2.compareTo(greeter);
|
17
|
+
if (result == 0) {
|
18
|
+
greeter2.greet('you are the same.');
|
19
|
+
} else {
|
20
|
+
greeter2.greet('you are different.');
|
21
|
+
}
|
22
|
+
}
|
23
|
+
|
@@ -0,0 +1,89 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
|
7
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
8
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" [
|
9
|
+
<!-- an internal subset can be embedded here -->
|
10
|
+
]>
|
11
|
+
|
12
|
+
<!DOCTYPE greeting SYSTEM "hello.dtd">
|
13
|
+
|
14
|
+
<!DOCTYPE greeting [
|
15
|
+
<!ELEMENT greeting (#PCDATA)>
|
16
|
+
|
17
|
+
<!-- examples from XML spec -->
|
18
|
+
|
19
|
+
<!ELEMENT br EMPTY>
|
20
|
+
<!ELEMENT p (#PCDATA|emph)* >
|
21
|
+
<!ELEMENT %name.para; %content.para; >
|
22
|
+
<!ELEMENT container ANY>
|
23
|
+
|
24
|
+
<!ELEMENT spec (front, body, back?)>
|
25
|
+
<!ELEMENT div1 (head, (p | list | note)*, div2*)>
|
26
|
+
<!ELEMENT dictionary-body (%div.mix; | %dict.mix;)*>
|
27
|
+
|
28
|
+
<!ELEMENT p (#PCDATA|a|ul|b|i|em)*>
|
29
|
+
<!ELEMENT p (#PCDATA | %font; | %phrase; | %special; | %form;)* >
|
30
|
+
<!ELEMENT b (#PCDATA)>
|
31
|
+
|
32
|
+
<!ATTLIST termdef
|
33
|
+
id ID #REQUIRED
|
34
|
+
name CDATA #IMPLIED>
|
35
|
+
<!ATTLIST list
|
36
|
+
type (bullets|ordered|glossary) "ordered">
|
37
|
+
<!ATTLIST form
|
38
|
+
method CDATA #FIXED "POST">
|
39
|
+
|
40
|
+
<!ENTITY d "
">
|
41
|
+
<!ENTITY a "
">
|
42
|
+
<!ENTITY da "
">
|
43
|
+
|
44
|
+
<!ENTITY % ISOLat2
|
45
|
+
SYSTEM "http://www.xml.com/iso/isolat2-xml.entities" >
|
46
|
+
|
47
|
+
<!ENTITY Pub-Status "This is a pre-release of the
|
48
|
+
specification.">
|
49
|
+
|
50
|
+
<!ENTITY open-hatch
|
51
|
+
SYSTEM "http://www.textuality.com/boilerplate/OpenHatch.xml">
|
52
|
+
<!ENTITY open-hatch
|
53
|
+
PUBLIC "-//Textuality//TEXT Standard open-hatch boilerplate//EN"
|
54
|
+
"http://www.textuality.com/boilerplate/OpenHatch.xml">
|
55
|
+
<!ENTITY hatch-pic
|
56
|
+
SYSTEM "../grafix/OpenHatch.gif"
|
57
|
+
NDATA gif >
|
58
|
+
|
59
|
+
<!NOTATION gif PUBLIC "gif viewer">
|
60
|
+
|
61
|
+
<!ENTITY % YN '"Yes"' >
|
62
|
+
<!ENTITY WhatHeSaid "He said %YN;" >
|
63
|
+
|
64
|
+
<!ENTITY EndAttr "27'" >
|
65
|
+
|
66
|
+
<!ENTITY % pub "Éditions Gallimard" >
|
67
|
+
<!ENTITY rights "All rights reserved" >
|
68
|
+
<!ENTITY book "La Peste: Albert Camus,
|
69
|
+
© 1947 %pub;. &rights;" >
|
70
|
+
|
71
|
+
<!ENTITY lt "&#60;">
|
72
|
+
<!ENTITY gt ">">
|
73
|
+
<!ENTITY amp "&#38;">
|
74
|
+
<!ENTITY apos "'">
|
75
|
+
<!ENTITY quot """>
|
76
|
+
|
77
|
+
<!ENTITY % draft 'INCLUDE' >
|
78
|
+
<!ENTITY % final 'IGNORE' >
|
79
|
+
|
80
|
+
<![%draft;[
|
81
|
+
<!ELEMENT book (comments*, title, body, supplements?)>
|
82
|
+
]]>
|
83
|
+
<![%final;[
|
84
|
+
<!ELEMENT book (title, body, supplements?)>
|
85
|
+
]]>
|
86
|
+
|
87
|
+
]>
|
88
|
+
|
89
|
+
|
@@ -0,0 +1,605 @@
|
|
1
|
+
namespace gui;
|
2
|
+
|
3
|
+
import "Window"
|
4
|
+
|
5
|
+
public struct AnchorValue
|
6
|
+
{
|
7
|
+
AnchorValueType type;
|
8
|
+
|
9
|
+
union
|
10
|
+
{
|
11
|
+
int distance;
|
12
|
+
float percent;
|
13
|
+
};
|
14
|
+
property int
|
15
|
+
{
|
16
|
+
set { distance = value; type = offset; }
|
17
|
+
get { return distance; }
|
18
|
+
}
|
19
|
+
property double
|
20
|
+
{
|
21
|
+
set { percent = (float) value; type = relative; }
|
22
|
+
get { return (double) percent; }
|
23
|
+
}
|
24
|
+
|
25
|
+
char * OnGetString(char * stringOutput, void * fieldData, bool * needClass)
|
26
|
+
{
|
27
|
+
if(type == offset)
|
28
|
+
{
|
29
|
+
sprintf(stringOutput, "%d", distance);
|
30
|
+
}
|
31
|
+
else if(type == relative)
|
32
|
+
{
|
33
|
+
int c;
|
34
|
+
int last = 0;
|
35
|
+
sprintf(stringOutput, "%f", percent);
|
36
|
+
c = strlen(stringOutput)-1;
|
37
|
+
for( ; c >= 0; c--)
|
38
|
+
{
|
39
|
+
if(stringOutput[c] != '0')
|
40
|
+
last = Max(last, c);
|
41
|
+
if(stringOutput[c] == '.')
|
42
|
+
{
|
43
|
+
if(last == c)
|
44
|
+
{
|
45
|
+
stringOutput[c+1] = '0';
|
46
|
+
stringOutput[c+2] = 0;
|
47
|
+
}
|
48
|
+
else
|
49
|
+
stringOutput[last+1] = 0;
|
50
|
+
break;
|
51
|
+
}
|
52
|
+
}
|
53
|
+
}
|
54
|
+
if(needClass) *needClass = false;
|
55
|
+
return stringOutput;
|
56
|
+
}
|
57
|
+
|
58
|
+
bool OnGetDataFromString(char * stringOutput)
|
59
|
+
{
|
60
|
+
char * end;
|
61
|
+
if(strchr(stringOutput, '.'))
|
62
|
+
{
|
63
|
+
float percent = (float)strtod(stringOutput, &end);
|
64
|
+
|
65
|
+
if(end != stringOutput)
|
66
|
+
{
|
67
|
+
this.percent = percent;
|
68
|
+
type = relative;
|
69
|
+
return true;
|
70
|
+
}
|
71
|
+
}
|
72
|
+
else if(stringOutput[0])
|
73
|
+
{
|
74
|
+
int distance = strtol(stringOutput, &end, 0);
|
75
|
+
if(end != stringOutput)
|
76
|
+
{
|
77
|
+
this.distance = distance;
|
78
|
+
type = offset;
|
79
|
+
return true;
|
80
|
+
}
|
81
|
+
}
|
82
|
+
else
|
83
|
+
{
|
84
|
+
distance = 0;
|
85
|
+
type = 0;
|
86
|
+
}
|
87
|
+
return false;
|
88
|
+
}
|
89
|
+
};
|
90
|
+
|
91
|
+
public struct MiddleAnchorValue
|
92
|
+
{
|
93
|
+
AnchorValueType type;
|
94
|
+
|
95
|
+
union
|
96
|
+
{
|
97
|
+
int distance;
|
98
|
+
float percent;
|
99
|
+
};
|
100
|
+
property int
|
101
|
+
{
|
102
|
+
set { distance = value; type = none; }
|
103
|
+
get { return distance; }
|
104
|
+
}
|
105
|
+
property double
|
106
|
+
{
|
107
|
+
set { percent = (float) value; type = middleRelative; }
|
108
|
+
get { return (double) percent; }
|
109
|
+
}
|
110
|
+
|
111
|
+
char * OnGetString(char * stringOutput, void * fieldData, bool * needClass)
|
112
|
+
{
|
113
|
+
if(type == middleRelative)
|
114
|
+
{
|
115
|
+
int c;
|
116
|
+
int last = 0;
|
117
|
+
sprintf(stringOutput, "%f", percent);
|
118
|
+
c = strlen(stringOutput)-1;
|
119
|
+
for( ; c >= 0; c--)
|
120
|
+
{
|
121
|
+
if(stringOutput[c] != '0')
|
122
|
+
last = Max(last, c);
|
123
|
+
if(stringOutput[c] == '.')
|
124
|
+
{
|
125
|
+
if(last == c)
|
126
|
+
{
|
127
|
+
stringOutput[c+1] = '0';
|
128
|
+
stringOutput[c+2] = 0;
|
129
|
+
}
|
130
|
+
else
|
131
|
+
stringOutput[last+1] = 0;
|
132
|
+
break;
|
133
|
+
}
|
134
|
+
}
|
135
|
+
}
|
136
|
+
else if(type == none && distance)
|
137
|
+
{
|
138
|
+
sprintf(stringOutput, "%d", distance);
|
139
|
+
}
|
140
|
+
if(needClass) *needClass = false;
|
141
|
+
return stringOutput;
|
142
|
+
}
|
143
|
+
|
144
|
+
bool OnGetDataFromString(char * stringOutput)
|
145
|
+
{
|
146
|
+
if(strchr(stringOutput, '.'))
|
147
|
+
{
|
148
|
+
percent = (float)strtod(stringOutput, null);
|
149
|
+
type = middleRelative;
|
150
|
+
}
|
151
|
+
else
|
152
|
+
{
|
153
|
+
distance = strtol(stringOutput, null, 0);
|
154
|
+
type = none;
|
155
|
+
}
|
156
|
+
return true;
|
157
|
+
}
|
158
|
+
};
|
159
|
+
|
160
|
+
public enum AnchorValueType { none, offset, relative, middleRelative, cascade, vTiled, hTiled };
|
161
|
+
|
162
|
+
public struct Anchor
|
163
|
+
{
|
164
|
+
union { AnchorValue left; MiddleAnchorValue horz; };
|
165
|
+
union { AnchorValue top; MiddleAnchorValue vert; };
|
166
|
+
AnchorValue right, bottom;
|
167
|
+
|
168
|
+
char * OnGetString(char * stringOutput, void * fieldData, bool * needClass)
|
169
|
+
{
|
170
|
+
char tempString[256];
|
171
|
+
char * anchorValue;
|
172
|
+
bool subNeedClass;
|
173
|
+
|
174
|
+
tempString[0] = '\0';
|
175
|
+
anchorValue = left.OnGetString(tempString, null, &subNeedClass);
|
176
|
+
if(anchorValue[0]) { if(stringOutput[0]) strcat(stringOutput, ", "); strcat(stringOutput, "left = "); strcat(stringOutput, anchorValue); }
|
177
|
+
|
178
|
+
//if(((!left.type && !right.type) && horz.distance) || horz.type == middleRelative)
|
179
|
+
if(!right.type && ((!left.type && horz.distance) || horz.type == middleRelative))
|
180
|
+
{
|
181
|
+
tempString[0] = '\0';
|
182
|
+
anchorValue = horz.OnGetString(tempString, null, &subNeedClass);
|
183
|
+
if(anchorValue[0]) { if(stringOutput[0]) strcat(stringOutput, ", "); strcat(stringOutput, "horz = "); strcat(stringOutput, anchorValue); }
|
184
|
+
}
|
185
|
+
|
186
|
+
tempString[0] = '\0';
|
187
|
+
anchorValue = top.OnGetString(tempString, null, &subNeedClass);
|
188
|
+
if(anchorValue[0]) { if(stringOutput[0]) strcat(stringOutput, ", "); strcat(stringOutput, "top = "); strcat(stringOutput, anchorValue); }
|
189
|
+
|
190
|
+
tempString[0] = '\0';
|
191
|
+
anchorValue = right.OnGetString(tempString, null, &subNeedClass);
|
192
|
+
if(anchorValue[0]) { if(stringOutput[0]) strcat(stringOutput, ", "); strcat(stringOutput, "right = "); strcat(stringOutput, anchorValue); }
|
193
|
+
|
194
|
+
// if(((!top.type && !bottom.type) && vert.distance) || vert.type == middleRelative)
|
195
|
+
if(!bottom.type && ((!top.type && vert.distance) || vert.type == middleRelative))
|
196
|
+
{
|
197
|
+
tempString[0] = '\0';
|
198
|
+
anchorValue = vert.OnGetString(tempString, null, &subNeedClass);
|
199
|
+
if(anchorValue[0]) { if(stringOutput[0]) strcat(stringOutput, ", "); strcat(stringOutput, "vert = "); strcat(stringOutput, anchorValue); }
|
200
|
+
}
|
201
|
+
|
202
|
+
tempString[0] = '\0';
|
203
|
+
anchorValue = bottom.OnGetString(tempString, null, &subNeedClass);
|
204
|
+
if(anchorValue[0]) { if(stringOutput[0]) strcat(stringOutput, ", "); strcat(stringOutput, "bottom = "); strcat(stringOutput, anchorValue); }
|
205
|
+
|
206
|
+
return stringOutput;
|
207
|
+
}
|
208
|
+
|
209
|
+
bool OnGetDataFromString(char * string)
|
210
|
+
{
|
211
|
+
this = Anchor {};
|
212
|
+
return class::OnGetDataFromString(string);
|
213
|
+
}
|
214
|
+
|
215
|
+
bool OnSaveEdit(DropBox dropBox, void * object)
|
216
|
+
{
|
217
|
+
return dropBox.Save();
|
218
|
+
}
|
219
|
+
|
220
|
+
Window OnEdit(Window listBox, Window master, int x, int y, int w, int h, Window control)
|
221
|
+
{
|
222
|
+
char * string = "";
|
223
|
+
AnchorDropBox comboBox
|
224
|
+
{
|
225
|
+
editText = true;
|
226
|
+
parent = listBox;
|
227
|
+
master = master;
|
228
|
+
position = Point { x, y };
|
229
|
+
//clientSize = Size { h = h };
|
230
|
+
//size.w = w;
|
231
|
+
size = { w, h };
|
232
|
+
anchorValue = this;
|
233
|
+
control = control;
|
234
|
+
borderStyle = 0;
|
235
|
+
};
|
236
|
+
|
237
|
+
comboBox.Create();
|
238
|
+
|
239
|
+
{
|
240
|
+
char tempString[MAX_F_STRING] = "";
|
241
|
+
bool needClass = false;
|
242
|
+
char * result = OnGetString(tempString, null, &needClass);
|
243
|
+
if(result) string = result;
|
244
|
+
}
|
245
|
+
comboBox.contents = string;
|
246
|
+
return comboBox;
|
247
|
+
}
|
248
|
+
};
|
249
|
+
|
250
|
+
private class AnchorButton : Button
|
251
|
+
{
|
252
|
+
toggle = true, bevel = false;
|
253
|
+
|
254
|
+
void OnRedraw(Surface surface)
|
255
|
+
{
|
256
|
+
int cw = clientSize.w;
|
257
|
+
int ch = clientSize.h;
|
258
|
+
|
259
|
+
surface.SetForeground(black);
|
260
|
+
if(checked)
|
261
|
+
{
|
262
|
+
surface.SetBackground(Color { 85,85,85 });
|
263
|
+
surface.Area(0,0, cw-1, ch-1);
|
264
|
+
}
|
265
|
+
else
|
266
|
+
surface.LineStipple(0xAAAA);
|
267
|
+
|
268
|
+
surface.Rectangle(0,0,cw-1,ch-1);
|
269
|
+
|
270
|
+
if(active)
|
271
|
+
{
|
272
|
+
surface.LineStipple(0xAAAA);
|
273
|
+
surface.Rectangle(2,2,cw-3,ch-3);
|
274
|
+
}
|
275
|
+
}
|
276
|
+
|
277
|
+
bool AnchorEditor::NotifyClicked(Button button, int x, int y, Modifiers mods)
|
278
|
+
{
|
279
|
+
AnchorDropBox anchorDropBox = (AnchorDropBox)master;
|
280
|
+
Anchor anchor = anchorDropBox.anchorValue;
|
281
|
+
Window control = anchorDropBox.control;
|
282
|
+
DataBox dropMaster = (DataBox)anchorDropBox.master;
|
283
|
+
int id = button.id;
|
284
|
+
|
285
|
+
switch(id)
|
286
|
+
{
|
287
|
+
case 0: anchor.left.type = button.checked ? offset : none; break;
|
288
|
+
case 1: anchor.top.type = button.checked ? offset : none; break;
|
289
|
+
case 2: anchor.right.type = button.checked ? offset : none; break;
|
290
|
+
case 3: anchor.bottom.type = button.checked ? offset : none; break;
|
291
|
+
}
|
292
|
+
|
293
|
+
if(anchor.horz.type == middleRelative && (id == 0 || id == 2))
|
294
|
+
{
|
295
|
+
anchorDropBox.relButtons[0].checked = false;
|
296
|
+
anchorDropBox.relButtons[2].checked = false;
|
297
|
+
}
|
298
|
+
if(anchor.vert.type == middleRelative && (id == 1 || id == 3))
|
299
|
+
{
|
300
|
+
anchorDropBox.relButtons[1].checked = false;
|
301
|
+
anchorDropBox.relButtons[3].checked = false;
|
302
|
+
}
|
303
|
+
anchorDropBox.relButtons[id].checked = false;
|
304
|
+
|
305
|
+
//anchor.horz.type = none;
|
306
|
+
//anchor.vert.type = none;
|
307
|
+
|
308
|
+
{
|
309
|
+
int vpw, vph;
|
310
|
+
int x,y,w,h;
|
311
|
+
Window parent = control.parent;
|
312
|
+
|
313
|
+
// Fix Anchor
|
314
|
+
x = control.position.x;
|
315
|
+
y = control.position.y;
|
316
|
+
w = control.size.w;
|
317
|
+
h = control.size.h;
|
318
|
+
|
319
|
+
vpw = parent.clientSize.w;
|
320
|
+
vph = parent.clientSize.h;
|
321
|
+
if(control.nonClient)
|
322
|
+
{
|
323
|
+
vpw = parent.size.w;
|
324
|
+
vph = parent.size.h;
|
325
|
+
}
|
326
|
+
else if(((BorderBits)control.borderStyle).fixed)
|
327
|
+
{
|
328
|
+
if(!control.dontScrollHorz && parent.scrollArea.w) vpw = parent.scrollArea.w;
|
329
|
+
if(!control.dontScrollVert && parent.scrollArea.h) vph = parent.scrollArea.h;
|
330
|
+
}
|
331
|
+
|
332
|
+
if(anchor.left.type == offset) anchor.left.distance = x;
|
333
|
+
else if(anchor.left.type == relative) anchor.left.percent = (float)x / vpw;
|
334
|
+
if(anchor.top.type == offset) anchor.top.distance = y;
|
335
|
+
else if(anchor.top.type == relative) anchor.top.percent = (float)y / vph;
|
336
|
+
if(anchor.right.type == offset) anchor.right.distance = vpw - (x + w);
|
337
|
+
//else if(anchor.right.type == relative) anchor.right.percent = (float) (x + w) / vpw;
|
338
|
+
else if(anchor.right.type == relative) anchor.right.percent = (float) (vpw - (x + w)) / vpw;
|
339
|
+
if(anchor.bottom.type == offset) anchor.bottom.distance = vph - (y + h);
|
340
|
+
//else if(anchor.bottom.type == relative) anchor.bottom.percent = (float) (y + h) / vph;
|
341
|
+
else if(anchor.bottom.type == relative) anchor.bottom.percent = (float) (vph - (y + h)) / vph;
|
342
|
+
|
343
|
+
if(!anchor.left.type && !anchor.right.type)
|
344
|
+
{
|
345
|
+
anchor.horz.distance = (x + w / 2) - (vpw / 2);
|
346
|
+
//anchor.horz.type = anchor.horz.distance ? offset : 0;
|
347
|
+
}
|
348
|
+
else if(anchor.horz.type == middleRelative) anchor.horz.percent = (float) ((x + w / 2) - (vpw / 2)) / vpw;
|
349
|
+
if(!anchor.top.type && !anchor.bottom.type)
|
350
|
+
{
|
351
|
+
anchor.vert.distance = (y + h / 2) - (vph / 2);
|
352
|
+
//anchor.vert.type = anchor.vert.distance ? offset : 0;
|
353
|
+
}
|
354
|
+
else if(anchor.vert.type == middleRelative) anchor.vert.percent = (float)((y + h / 2) - (vph / 2)) / vph;
|
355
|
+
}
|
356
|
+
|
357
|
+
{
|
358
|
+
char tempString[1024] = "";
|
359
|
+
bool needClass = false;
|
360
|
+
char * string = anchor.OnGetString(tempString, null, &needClass);
|
361
|
+
anchorDropBox.contents = string;
|
362
|
+
}
|
363
|
+
|
364
|
+
dropMaster.SetData(&anchor, false);
|
365
|
+
anchorDropBox.anchorValue = anchor;
|
366
|
+
return true;
|
367
|
+
}
|
368
|
+
}
|
369
|
+
|
370
|
+
private class AnchorRelButton : Button
|
371
|
+
{
|
372
|
+
toggle = true;
|
373
|
+
bevel = false;
|
374
|
+
text = "%";
|
375
|
+
//bevelOver = true;
|
376
|
+
|
377
|
+
void OnRedraw(Surface surface)
|
378
|
+
{
|
379
|
+
int cw = clientSize.w;
|
380
|
+
int ch = clientSize.h;
|
381
|
+
|
382
|
+
if(checked)
|
383
|
+
{
|
384
|
+
surface.SetForeground(black);
|
385
|
+
}
|
386
|
+
else
|
387
|
+
{
|
388
|
+
surface.SetForeground(Color{170,170,170});
|
389
|
+
}
|
390
|
+
surface.WriteText(5,2, "%", 1);
|
391
|
+
|
392
|
+
if(active)
|
393
|
+
{
|
394
|
+
surface.LineStipple(0xAAAA);
|
395
|
+
surface.Rectangle(3,3,cw-4,ch-4);
|
396
|
+
}
|
397
|
+
}
|
398
|
+
|
399
|
+
bool AnchorEditor::NotifyClicked(Button button, int x, int y, Modifiers mods)
|
400
|
+
{
|
401
|
+
AnchorDropBox anchorDropBox = (AnchorDropBox)master;
|
402
|
+
Anchor anchor = anchorDropBox.anchorValue;
|
403
|
+
Window control = anchorDropBox.control;
|
404
|
+
DataBox dropMaster = (DataBox)anchorDropBox.master;
|
405
|
+
int id = button.id;
|
406
|
+
|
407
|
+
if((id == 0 || id == 2) && ((!anchor.left.type && !anchor.right.type) || anchor.left.type == middleRelative))
|
408
|
+
{
|
409
|
+
if(button.checked) anchor.horz.type = middleRelative; else anchor.horz.type = none;
|
410
|
+
anchorDropBox.relButtons[(id + 2)%4].checked = button.checked;
|
411
|
+
}
|
412
|
+
else if((id == 1 || id == 3) && ((!anchor.top.type && !anchor.bottom.type) || anchor.top.type == middleRelative))
|
413
|
+
{
|
414
|
+
if(button.checked) anchor.vert.type = middleRelative; else anchor.vert.type = none;
|
415
|
+
anchorDropBox.relButtons[(id + 2)%4].checked = button.checked;
|
416
|
+
}
|
417
|
+
else
|
418
|
+
{
|
419
|
+
switch(id)
|
420
|
+
{
|
421
|
+
case 0: anchor.left.type = button.checked ? relative : (anchor.left.type ? offset : none); break;
|
422
|
+
case 1: anchor.top.type = button.checked ? relative : (anchor.top.type ? offset : none); break;
|
423
|
+
case 2: anchor.right.type = button.checked ? relative : (anchor.right.type ? offset : none); break;
|
424
|
+
case 3: anchor.bottom.type = button.checked ? relative : (anchor.bottom.type ? offset : none); break;
|
425
|
+
}
|
426
|
+
anchorDropBox.buttons[id].checked = true;
|
427
|
+
if(anchor.horz.type == middleRelative) anchor.horz.type = none;
|
428
|
+
if(anchor.vert.type == middleRelative) anchor.vert.type = none;
|
429
|
+
}
|
430
|
+
|
431
|
+
{
|
432
|
+
int vpw, vph;
|
433
|
+
int x,y,w,h;
|
434
|
+
Window parent = control.parent;
|
435
|
+
|
436
|
+
// Fix Anchor
|
437
|
+
x = control.position.x;
|
438
|
+
y = control.position.y;
|
439
|
+
w = control.size.w;
|
440
|
+
h = control.size.h;
|
441
|
+
|
442
|
+
vpw = parent.clientSize.w;
|
443
|
+
vph = parent.clientSize.h;
|
444
|
+
if(control.nonClient)
|
445
|
+
{
|
446
|
+
vpw = parent.size.w;
|
447
|
+
vph = parent.size.h;
|
448
|
+
}
|
449
|
+
else if(((BorderBits)control.borderStyle).fixed)
|
450
|
+
{
|
451
|
+
if(!control.dontScrollHorz && parent.scrollArea.w) vpw = parent.scrollArea.w;
|
452
|
+
if(!control.dontScrollVert && parent.scrollArea.h) vph = parent.scrollArea.h;
|
453
|
+
}
|
454
|
+
|
455
|
+
if(anchor.left.type == offset) anchor.left.distance = x;
|
456
|
+
else if(anchor.left.type == relative) anchor.left.percent = (float)x / vpw;
|
457
|
+
if(anchor.top.type == offset) anchor.top.distance = y;
|
458
|
+
else if(anchor.top.type == relative) anchor.top.percent = (float)y / vph;
|
459
|
+
if(anchor.right.type == offset) anchor.right.distance = vpw - (x + w);
|
460
|
+
//else if(anchor.right.type == relative) anchor.right.percent = (float) (x + w) / vpw;
|
461
|
+
else if(anchor.right.type == relative) anchor.right.percent = (float) (vpw - (x + w)) / vpw;
|
462
|
+
if(anchor.bottom.type == offset) anchor.bottom.distance = vph - (y + h);
|
463
|
+
//else if(anchor.bottom.type == relative) anchor.bottom.percent = (float) (y + h) / vph;
|
464
|
+
else if(anchor.bottom.type == relative) anchor.bottom.percent = (float) (vph - (y + h)) / vph;
|
465
|
+
|
466
|
+
if(!anchor.left.type && !anchor.right.type)
|
467
|
+
{
|
468
|
+
anchor.horz.distance = (x + w / 2) - (vpw / 2);
|
469
|
+
//anchor.horz.type = anchor.horz.distance ? offset : none;
|
470
|
+
}
|
471
|
+
else if(anchor.horz.type == middleRelative) anchor.horz.percent = (float) ((x + w / 2) - (vpw / 2)) / vpw;
|
472
|
+
if(!anchor.top.type && !anchor.bottom.type)
|
473
|
+
{
|
474
|
+
anchor.vert.distance = (y + h / 2) - (vph / 2);
|
475
|
+
//anchor.vert.type = anchor.vert.distance ? offset : none;
|
476
|
+
}
|
477
|
+
else if(anchor.vert.type == middleRelative) anchor.vert.percent = (float)((y + h / 2) - (vph / 2)) / vph;
|
478
|
+
}
|
479
|
+
|
480
|
+
{
|
481
|
+
char tempString[1024] = "";
|
482
|
+
bool needClass = false;
|
483
|
+
char * string = anchor.OnGetString(tempString, null, &needClass);
|
484
|
+
anchorDropBox.contents = string;
|
485
|
+
}
|
486
|
+
|
487
|
+
dropMaster.SetData(&anchor, false);
|
488
|
+
anchorDropBox.anchorValue = anchor;
|
489
|
+
return true;
|
490
|
+
}
|
491
|
+
}
|
492
|
+
|
493
|
+
private class AnchorEditor : Window
|
494
|
+
{
|
495
|
+
interim = true;
|
496
|
+
borderStyle = deepContour;
|
497
|
+
size.h = 92;
|
498
|
+
|
499
|
+
bool OnKeyDown(Key key, unichar ch)
|
500
|
+
{
|
501
|
+
if(key == escape)
|
502
|
+
return master.OnKeyDown(key, ch);
|
503
|
+
return true;
|
504
|
+
}
|
505
|
+
}
|
506
|
+
|
507
|
+
private class AnchorDropBox : DropBox
|
508
|
+
{
|
509
|
+
Anchor anchorValue;
|
510
|
+
Window control;
|
511
|
+
Button relButtons[4], buttons[4];
|
512
|
+
|
513
|
+
AnchorEditor anchorEditor
|
514
|
+
{
|
515
|
+
master = this;
|
516
|
+
autoCreate = false;
|
517
|
+
};
|
518
|
+
|
519
|
+
Window OnDropDown()
|
520
|
+
{
|
521
|
+
int c;
|
522
|
+
Button
|
523
|
+
{
|
524
|
+
anchorEditor,
|
525
|
+
anchor = Anchor { left = 28, top = 28, right = 28, bottom = 28 },
|
526
|
+
inactive = true, disabled = true
|
527
|
+
};
|
528
|
+
for(c = 0; c<4; c++)
|
529
|
+
{
|
530
|
+
Button button = buttons[c] = AnchorButton
|
531
|
+
{
|
532
|
+
anchorEditor, id = c,
|
533
|
+
size = Size { (c%2)?10:28, (c%2)?28:10 }
|
534
|
+
};
|
535
|
+
Button relButton = relButtons[c] = AnchorRelButton
|
536
|
+
{
|
537
|
+
anchorEditor, id = c;
|
538
|
+
};
|
539
|
+
|
540
|
+
switch(c)
|
541
|
+
{
|
542
|
+
case 0:
|
543
|
+
if(anchorValue.left.type && anchorValue.left.type != middleRelative) button.checked = true;
|
544
|
+
if(anchorValue.left.type == relative || anchorValue.horz.type == middleRelative) relButton.checked = true;
|
545
|
+
|
546
|
+
button.anchor = Anchor { left = 0 };
|
547
|
+
relButton.anchor = Anchor { left = 5, vert = 16 };
|
548
|
+
break;
|
549
|
+
case 1:
|
550
|
+
if(anchorValue.top.type && anchorValue.top.type != middleRelative) button.checked = true;
|
551
|
+
if(anchorValue.top.type == relative || anchorValue.vert.type == middleRelative) relButton.checked = true;
|
552
|
+
|
553
|
+
button.anchor = Anchor { top = 0 };
|
554
|
+
relButton.anchor = Anchor { top = 5, horz = 16 };
|
555
|
+
break;
|
556
|
+
case 2:
|
557
|
+
if(anchorValue.right.type && anchorValue.right.type != middleRelative) button.checked = true;
|
558
|
+
if(anchorValue.right.type == relative || anchorValue.horz.type == middleRelative) relButton.checked = true;
|
559
|
+
|
560
|
+
button.anchor = Anchor { right = 0 };
|
561
|
+
relButton.anchor = Anchor { right = 5, vert = 16 };
|
562
|
+
break;
|
563
|
+
case 3:
|
564
|
+
if(anchorValue.bottom.type && anchorValue.bottom.type != middleRelative) button.checked = true;
|
565
|
+
if(anchorValue.bottom.type == relative || anchorValue.vert.type == middleRelative) relButton.checked = true;
|
566
|
+
|
567
|
+
button.anchor = Anchor { bottom = 0 };
|
568
|
+
relButton.anchor = Anchor { bottom = 5, horz = 16 };
|
569
|
+
break;
|
570
|
+
}
|
571
|
+
}
|
572
|
+
anchorEditor.Create();
|
573
|
+
return anchorEditor;
|
574
|
+
}
|
575
|
+
|
576
|
+
void OnCloseDropDown(Window anchorEditor)
|
577
|
+
{
|
578
|
+
// TOFIX: Patch for update bug
|
579
|
+
master.Update(null);
|
580
|
+
anchorEditor.Destroy(0);
|
581
|
+
}
|
582
|
+
|
583
|
+
bool DataBox::NotifyTextEntry(AnchorDropBox dropBox, char * string, bool save)
|
584
|
+
{
|
585
|
+
Anchor anchor = dropBox.anchorValue;
|
586
|
+
Window control = dropBox.control;
|
587
|
+
|
588
|
+
if(save)
|
589
|
+
{
|
590
|
+
if(anchor.OnGetDataFromString(string))
|
591
|
+
{
|
592
|
+
SetData(&anchor, false);
|
593
|
+
dropBox.anchorValue = anchor;
|
594
|
+
}
|
595
|
+
}
|
596
|
+
else
|
597
|
+
{
|
598
|
+
char tempString[1024] = "";
|
599
|
+
bool needClass = false;
|
600
|
+
char * string = anchor.OnGetString(tempString, null, &needClass);
|
601
|
+
dropBox.contents = string;
|
602
|
+
}
|
603
|
+
return true;
|
604
|
+
}
|
605
|
+
}
|