merged p5 3.0a1

This commit is contained in:
Darius Morawiec
2014-07-31 15:17:43 +02:00
2641 changed files with 37957 additions and 390279 deletions
+6 -4
View File
@@ -4,6 +4,8 @@ Processing
This is the official source code for the [Processing](http://processing.org) Development Environment (PDE),
the “core” and the libraries that are included with the [download](http://processing.org/download).
> Development of Processing 3 has started, so major changes are underway inside this repository. **If you need a stable version of the source, use the tag processing-0227-2.2.1.** Do not expect this code to be stable. Major changes include severe things like breaking libraries (due to chaining operations in PVector) or the removal of `Applet` as the base class for PApplet. Some of these will be sorted out before the release, others are simply being tested or are developments that are in-progress.
If you have found a bug in the Processing software, you can file it here under the [“issues” tab](https://github.com/processing/processing/issues).
If it relates to the [JavaScript](http://processingjs.org) version, please use [their issue tracker](https://processing-js.lighthouseapp.com/).
All Android-related development has moved to its own repository [here](https://github.com/processing/processing-android),
@@ -15,18 +17,18 @@ changes made by [processing-bugs](https://github.com/processing-bugs), it may be
Over time this will clean itself up as bugs are fixed and new issues are added from within Github.
Help speed this process along by helping us!
The [processing-web](https://github.com/processing/processing-web/) repository
contains reference, examples, and the site.
The [processing-docs](https://github.com/processing/processing-docs/) repository contains reference, examples, and the site.
(Please use that link to file issues regarding the web site, the examples, or the reference.)
The instructions for building the source [are here](https://github.com/processing/processing/wiki/Build-Instructions).
Someday we'll also write code style guidelines, fix all these bugs,
throw together hundreds of unit tests, and solve the Israeli-Palestinian conflict.
throw together hundreds of unit tests,
and get rich off all this stuff that we're giving away for free.
But in the meantime, I ask for your patience,
[participation](https://github.com/processing/processing/wiki/Project-List),
and [patches](https://github.com/processing/processing/pulls).
Ben Fry, 3 February 2013
Last updated 21 April 2013
Last updated 30 July 2014
+1 -2
View File
@@ -6,8 +6,7 @@
<attribute name="ignore_optional_problems" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="test/src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.launching.macosx.MacOSXType/JDK 1.7.0.55"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry combineaccessrules="false" kind="src" path="/processing-core"/>
<classpathentry kind="lib" path="lib/antlr.jar" sourcepath="lib/antlr-src.zip"/>
<classpathentry kind="lib" path="lib/jna.jar"/>
-381
View File
@@ -1,381 +0,0 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled
org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
org.eclipse.jdt.core.compiler.problem.deadCode=ignore
org.eclipse.jdt.core.compiler.problem.deprecation=warning
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore
org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
org.eclipse.jdt.core.compiler.problem.nullReference=ignore
org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=ignore
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=ignore
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
org.eclipse.jdt.core.compiler.problem.unusedImport=warning
org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
org.eclipse.jdt.core.compiler.source=1.7
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=18
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=18
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=18
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_assignment=0
org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=36
org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=18
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=18
org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80
org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16
org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
org.eclipse.jdt.core.formatter.blank_lines_after_package=1
org.eclipse.jdt.core.formatter.blank_lines_before_field=1
org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
org.eclipse.jdt.core.formatter.blank_lines_before_method=1
org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
org.eclipse.jdt.core.formatter.blank_lines_before_package=0
org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
org.eclipse.jdt.core.formatter.comment.format_block_comments=true
org.eclipse.jdt.core.formatter.comment.format_header=false
org.eclipse.jdt.core.formatter.comment.format_html=true
org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
org.eclipse.jdt.core.formatter.comment.format_line_comments=false
org.eclipse.jdt.core.formatter.comment.format_source_code=true
org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert
org.eclipse.jdt.core.formatter.comment.line_length=80
org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true
org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false
org.eclipse.jdt.core.formatter.compact_else_if=true
org.eclipse.jdt.core.formatter.continuation_indentation=1
org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=1
org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off
org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
org.eclipse.jdt.core.formatter.indent_empty_lines=false
org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
org.eclipse.jdt.core.formatter.indentation.size=2
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert
org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
org.eclipse.jdt.core.formatter.join_lines_in_comments=true
org.eclipse.jdt.core.formatter.join_wrapped_lines=true
org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
org.eclipse.jdt.core.formatter.lineSplit=80
org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=true
org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
org.eclipse.jdt.core.formatter.tabulation.char=space
org.eclipse.jdt.core.formatter.tabulation.size=2
org.eclipse.jdt.core.formatter.use_on_off_tags=false
org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
+46 -74
View File
@@ -46,9 +46,9 @@ import processing.mode.java.JavaMode;
public class Base {
// Added accessors for 0218 because the UpdateCheck class was not properly
// updating the values, due to javac inlining the static final values.
static private final int REVISION = 228;
static private final int REVISION = 229;
/** This might be replaced by main() if there's a lib/version.txt file. */
static private String VERSION_NAME = "0228"; //$NON-NLS-1$
static private String VERSION_NAME = "0229"; //$NON-NLS-1$
/** Set true if this a proper release rather than a numbered revision. */
// static private boolean RELEASE = false;
@@ -300,12 +300,12 @@ public class Base {
// try {
// Class.forName("processing.mode.java2.DebugMode");
ModeContribution experimentalContrib =
ModeContribution.load(this, getContentFile("modes/experimental"), //$NON-NLS-1$
ModeContribution.load(this, getContentFile("modes/ExperimentalMode"), //$NON-NLS-1$
"processing.mode.experimental.ExperimentalMode"); //$NON-NLS-1$
if (experimentalContrib != null) {
Mode experimentalMode = experimentalContrib.getMode();
//coreModes = new Mode[] { javaMode, androidMode, experimentalMode };
coreModes = new Mode[] { javaMode, experimentalMode };
coreModes = new Mode[] { experimentalMode, javaMode };
}
// } catch (ClassNotFoundException e) { }
@@ -604,38 +604,37 @@ public class Base {
}
/**
* The call has already checked to make sure this sketch is not modified,
* now change the mode.
*/
protected void changeMode(Mode mode) {
if (activeEditor.getMode() != mode) {
Sketch sketch = activeEditor.getSketch();
if (sketch.isModified()) {
Base.showWarning("Save",
"Please save the sketch before changing the mode.",
null);
return;
}
nextMode = mode;
// If the current editor contains file extensions that the new mode can handle, then
// write a sketch.properties file with the new mode specified, and reopen.
boolean newModeCanHandleCurrentSource = true;
for (final SketchCode code: sketch.getCode()) {
if (!mode.validExtension(code.getExtension())) {
newModeCanHandleCurrentSource = false;
break;
}
}
if (newModeCanHandleCurrentSource) {
final File props = new File(sketch.getCodeFolder(), "sketch.properties");
saveModeSettings(props, nextMode);
if (sketch.isUntitled()) {
// If no changes have been made, just close and start fresh.
// (Otherwise the editor would lose its 'untitled' status.)
handleClose(activeEditor, true);
handleOpen(sketch.getMainFilePath());
} else {
// If you're changing modes, and there's nothing in the current sketch, you probably
// don't intend to keep the old, wrong-mode editor around.
if (sketch.isUntitled()) {
handleClose(activeEditor, true);
}
handleNew();
} else {
// If the current editor contains file extensions that the new mode can handle, then
// write a sketch.properties file with the new mode specified, and reopen.
boolean newModeCanHandleCurrentSource = true;
for (final SketchCode code: sketch.getCode()) {
if (!mode.validExtension(code.getExtension())) {
newModeCanHandleCurrentSource = false;
break;
}
}
if (newModeCanHandleCurrentSource) {
final File props = new File(sketch.getCodeFolder(), "sketch.properties");
saveModeSettings(props, nextMode);
handleClose(activeEditor, true);
handleOpen(sketch.getMainFilePath());
}
}
}
}
@@ -930,14 +929,18 @@ public class Base {
return null;
}
// System.err.println(" editors: " + editors);
// Cycle through open windows to make sure that it's not already open.
for (Editor editor : editors) {
if (editor.getSketch().getMainFile().equals(file)) {
editor.toFront();
// move back to the top of the recent list
handleRecent(editor);
return editor;
// User may have double-clicked any PDE in the sketch folder,
// so we have to check each open tab (not just the main one).
// https://github.com/processing/processing/issues/2506
for (SketchCode tab : editor.getSketch().getCode()) {
if (tab.getFile().equals(file)) {
editor.toFront();
// move back to the top of the recent list
handleRecent(editor);
return editor;
}
}
}
@@ -960,8 +963,6 @@ public class Base {
// Editor.State state = new Editor.State(editors);
Editor editor = nextMode.createEditor(this, path, state);
if (editor == null) {
// if it's the last editor window
// if (editors.size() == 0 && defaultFileMenu == null) {
// if it's not mode[0] already, then don't go into an infinite loop
// trying to recreate a window with the default mode.
if (nextMode == coreModes[0]) {
@@ -974,15 +975,14 @@ public class Base {
editor = coreModes[0].createEditor(this, path, state);
}
}
// Make sure that the sketch actually loaded
if (editor.getSketch() == null) {
// System.err.println("sketch was null, getting out of handleOpen");
Sketch sketch = editor.getSketch();
if (sketch == null) {
return null; // Just walk away quietly
}
// editor.untitled = untitled;
editor.getSketch().setUntitled(untitled);
sketch.setUntitled(untitled);
editors.add(editor);
handleRecent(editor);
@@ -1867,41 +1867,15 @@ public class Base {
}
// static public String getExamplesPath() {
// return examplesFolder.getAbsolutePath();
// }
// public File getExamplesFolder() {
// return examplesFolder;
// }
// static public String getLibrariesPath() {
// return librariesFolder.getAbsolutePath();
// }
// public File getLibrariesFolder() {
// return librariesFolder;
// }
// static public File getToolsFolder() {
static public File getToolsFolder() {
// return toolsFolder;
return getContentFile("tools");
}
// static public String getToolsPath() {
// return toolsFolder.getAbsolutePath();
// }
static public void locateSketchbookFolder() {
// If a value is at least set, first check to see if the folder exists.
// If it doesn't, warn the user that the sketchbook folder is being reset.
String sketchbookPath = Preferences.get("sketchbook.path"); //$NON-NLS-1$
String sketchbookPath = Preferences.getSketchbookPath();
if (sketchbookPath != null) {
sketchbookFolder = new File(sketchbookPath);
if (!sketchbookFolder.exists()) {
@@ -1918,7 +1892,7 @@ public class Base {
// If no path is set, get the default sketchbook folder for this platform
if (sketchbookFolder == null) {
sketchbookFolder = getDefaultSketchbookFolder();
Preferences.set("sketchbook.path", sketchbookFolder.getAbsolutePath());
Preferences.setSketchbookPath(sketchbookFolder.getAbsolutePath());
if (!sketchbookFolder.exists()) {
sketchbookFolder.mkdirs();
}
@@ -1933,19 +1907,17 @@ public class Base {
public void setSketchbookFolder(File folder) {
sketchbookFolder = folder;
Preferences.set("sketchbook.path", folder.getAbsolutePath());
Preferences.setSketchbookPath(folder.getAbsolutePath());
rebuildSketchbookMenus();
}
static public File getSketchbookFolder() {
// return new File(Preferences.get("sketchbook.path"));
return sketchbookFolder;
}
static public File getSketchbookLibrariesFolder() {
// return new File(getSketchbookFolder(), "libraries");
return new File(sketchbookFolder, "libraries");
}
+17
View File
@@ -442,6 +442,23 @@ public class ColorChooser { //extends JFrame implements DocumentListener {
row.add(Box.createHorizontalGlue());
box.add(row);
row = Box.createHorizontalBox();
if (Base.isMacOS()) {
row.add(Box.createHorizontalStrut(11));
} else {
row.add(createFixedLabel(""));
}
button = new JButton("Cancel");
button.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
ColorChooser.this.hide();
}
});
row.add(button);
row.add(Box.createHorizontalGlue());
box.add(row);
//
box.add(Box.createVerticalGlue());
+99 -12
View File
@@ -33,6 +33,7 @@ import java.awt.event.*;
import java.awt.print.*;
import java.io.*;
import java.util.*;
import java.util.List;
import java.util.Timer;
import javax.swing.*;
@@ -383,20 +384,37 @@ public abstract class Editor extends JFrame implements RunnerListener {
protected void initModeMenu() {
modeMenu = new JMenu();
ButtonGroup modeGroup = new ButtonGroup();
for (final Mode m : base.getModeList()) {
if (mode == m) {
JRadioButtonMenuItem item = new JRadioButtonMenuItem(m.getTitle());
// doesn't need a listener, since it doesn't do anything
item.setSelected(true);
modeMenu.add(item);
} else {
JMenuItem item = new JMenuItem(m.getTitle());
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
JRadioButtonMenuItem item = new JRadioButtonMenuItem(m.getTitle());
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (!sketch.isModified()) {
base.changeMode(m);
} else {
Base.showWarning("Save",
"Please save the sketch before changing the mode.",
null);
// Re-select the old checkbox, because it was automatically
// updated by Java, even though the Mode could not be changed.
// https://github.com/processing/processing/issues/2615
for (Component c : modeMenu.getPopupMenu().getComponents()) {
if (c instanceof JRadioButtonMenuItem) {
if (((JRadioButtonMenuItem)c).getText() == mode.getTitle()) {
((JRadioButtonMenuItem)c).setSelected(true);
break;
}
}
}
}
});
modeMenu.add(item);
}
});
modeMenu.add(item);
modeGroup.add(item);
if (mode == m) {
item.setSelected(true);
}
}
@@ -588,6 +606,16 @@ public abstract class Editor extends JFrame implements RunnerListener {
fileMenu.add(item);
fileMenu.add(base.getSketchbookMenu());
JMenuItem sbMenu = Toolkit.newJMenuItemShift("Sketchbook Tree", 'K');
sbMenu.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
mode.showSketchbookFrame();
}
});
fileMenu.add(sbMenu);
// fileMenu.add(mode.getExamplesMenu());
item = Toolkit.newJMenuItemShift(Language.text("menu.file.examples"), 'O');
@@ -895,6 +923,57 @@ public abstract class Editor extends JFrame implements RunnerListener {
});
sketchMenu.add(item);
sketchMenu.addSeparator();
// final Editor editorName = this;
sketchMenu.addMenuListener(new MenuListener() {
// Menu Listener that populates the menu only when the menu is opened
List<JMenuItem> menuList = new ArrayList<JMenuItem>();
@Override
public void menuSelected(MenuEvent event) {
JMenuItem item;
for (final Editor editor : base.getEditors()) {
//if (Editor.this.getSketch().getName().trim().contains(editor2.getSketch().getName().trim()))
if (getSketch().getMainFilePath().equals(editor.getSketch().getMainFilePath())) {
item = new JCheckBoxMenuItem(editor.getSketch().getName());
item.setSelected(true);
} else {
item = new JMenuItem(editor.getSketch().getName());
}
item.setText(editor.getSketch().getName() +
" (" + editor.getMode().getTitle() + ")");
// Action listener to bring the appropriate sketch in front
item.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
editor.setState(Frame.NORMAL);
editor.setVisible(true);
editor.toFront();
}
});
sketchMenu.add(item);
menuList.add(item);
}
}
@Override
public void menuDeselected(MenuEvent event) {
for (JMenuItem item : menuList) {
sketchMenu.remove(item);
}
menuList.clear();
}
@Override
public void menuCanceled(MenuEvent event) {
menuDeselected(event);
}
});
return sketchMenu;
}
@@ -1163,6 +1242,11 @@ public abstract class Editor extends JFrame implements RunnerListener {
public void showReference(String filename) {
File file = new File(mode.getReferenceFolder(), filename);
try {
file = file.getCanonicalFile();
} catch (IOException e) {
e.printStackTrace();
}
// Prepend with file:// and also encode spaces & other characters
Base.openURL(file.toURI().toString());
}
@@ -2369,7 +2453,10 @@ public abstract class Editor extends JFrame implements RunnerListener {
statusNotice("Saving...");
try {
if (sketch.saveAs()) {
statusNotice("Done Saving.");
// statusNotice("Done Saving.");
// status is now printed from Sketch so that "Done Saving."
// is only printed after Save As when progress bar is shown.
// Disabling this for 0125, instead rebuild the menu inside
// the Save As method of the Sketch object, since that's the
// only one who knows whether something was renamed.
+7 -1
View File
@@ -212,7 +212,13 @@ public class EditorConsole extends JScrollPane {
StyleConstants.setBold(errStyle, font.isBold());
StyleConstants.setItalic(errStyle, font.isItalic());
consoleTextPane.setBackground(bgColor);
if (UIManager.getLookAndFeel().getID().equals("Nimbus")) {
getViewport().setBackground(bgColor);
consoleTextPane.setOpaque(false);
consoleTextPane.setBackground(new Color(0, 0, 0, 0));
} else {
consoleTextPane.setBackground(bgColor);
}
// calculate height of a line of text in pixels
// and size window accordingly
+98
View File
@@ -879,6 +879,104 @@ public abstract class Mode {
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
public DefaultMutableTreeNode buildSketchbookTree(){
DefaultMutableTreeNode sbNode = new DefaultMutableTreeNode("Sketchbook");
try {
base.addSketches(sbNode, Base.getSketchbookFolder());
} catch (IOException e) {
e.printStackTrace();
}
return sbNode;
}
protected JFrame sketchbookFrame;
public void showSketchbookFrame() {
if (sketchbookFrame == null) {
sketchbookFrame = new JFrame("Processing Sketchbook");
Toolkit.setIcon(sketchbookFrame);
Toolkit.registerWindowCloseKeys(sketchbookFrame.getRootPane(),
new ActionListener() {
public void actionPerformed(ActionEvent e) {
sketchbookFrame.setVisible(false);
}
});
final JTree tree = new JTree(buildSketchbookTree());
tree.getSelectionModel()
.setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
tree.setShowsRootHandles(true);
tree.expandRow(0);
tree.setRootVisible(false);
tree.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e) {
if (e.getClickCount() == 2) {
DefaultMutableTreeNode node = (DefaultMutableTreeNode) tree
.getLastSelectedPathComponent();
int selRow = tree.getRowForLocation(e.getX(), e.getY());
//TreePath selPath = tree.getPathForLocation(e.getX(), e.getY());
//if (node != null && node.isLeaf() && node.getPath().equals(selPath)) {
if (node != null && node.isLeaf() && selRow != -1) {
SketchReference sketch = (SketchReference) node.getUserObject();
base.handleOpen(sketch.getPath());
}
}
}
});
tree.addKeyListener(new KeyAdapter() {
public void keyPressed(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_ESCAPE) { // doesn't fire keyTyped()
sketchbookFrame.setVisible(false);
}
}
public void keyTyped(KeyEvent e) {
if (e.getKeyChar() == KeyEvent.VK_ENTER) {
DefaultMutableTreeNode node = (DefaultMutableTreeNode) tree
.getLastSelectedPathComponent();
if (node != null && node.isLeaf()) {
SketchReference sketch = (SketchReference) node.getUserObject();
base.handleOpen(sketch.getPath());
}
}
}
});
tree.setBorder(new EmptyBorder(5, 5, 5, 5));
if (Base.isMacOS()) {
tree.setToggleClickCount(2);
} else {
tree.setToggleClickCount(1);
}
JScrollPane treePane = new JScrollPane(tree);
treePane.setPreferredSize(new Dimension(250, 450));
treePane.setBorder(new EmptyBorder(0, 0, 0, 0));
sketchbookFrame.getContentPane().add(treePane);
sketchbookFrame.pack();
}
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
// Space for the editor plus a li'l gap
int roughWidth = sketchbookFrame.getWidth() + 20;
Point p = null;
// If no window open, or the editor is at the edge of the screen
if (base.activeEditor == null
|| (p = base.activeEditor.getLocation()).x < roughWidth) {
// Center the window on the screen
sketchbookFrame.setLocationRelativeTo(null);
} else {
// Open the window relative to the editor
sketchbookFrame.setLocation(p.x - roughWidth, p.y);
}
sketchbookFrame.setVisible(true);
}
});
}
/**
* Get an image object from the theme folder.
+244 -262
View File
@@ -3,7 +3,7 @@
/*
Part of the Processing project - http://processing.org
Copyright (c) 2004-12 Ben Fry and Casey Reas
Copyright (c) 2004-14 Ben Fry and Casey Reas
Copyright (c) 2001-04 Massachusetts Institute of Technology
This program is free software; you can redistribute it and/or modify
@@ -28,7 +28,11 @@ import java.io.*;
import java.util.*;
import javax.swing.*;
import javax.swing.border.*;
import javax.swing.event.*;
import processing.app.ColorChooser;
import processing.app.Language;
import processing.core.*;
@@ -98,7 +102,7 @@ public class Preferences {
// and linux is all over the map
static final int GUI_BIG = 13;
static final int GUI_BETWEEN = 10;
static final int GUI_BETWEEN = 8;
static final int GUI_SMALL = 6;
// gui elements
@@ -107,27 +111,32 @@ public class Preferences {
int wide, high;
JTextField sketchbookLocationField;
JTextField presentColor;
JTextField presentColorHex;
JCheckBox editorAntialiasBox;
JCheckBox deletePreviousBox;
JCheckBox whinyBox;
JCheckBox memoryOverrideBox;
JTextField memoryField;
JCheckBox checkUpdatesBox;
//JTextField fontSizeField;
JComboBox fontSizeField;
JComboBox consoleSizeField;
JCheckBox inputMethodBox;
JCheckBox autoAssociateBox;
ColorChooser selector;
//JRadioButton bitsThirtyTwoButton;
//JRadioButton bitsSixtyFourButton;
JCheckBox errorCheckerBox;
JCheckBox warningsCheckerBox;
JCheckBox codeCompletionBox;
JCheckBox importSuggestionsBox;
JCheckBox codeCompletionTriggerBox;
JComboBox displaySelectionBox;
JComboBox languageSelectionBox;
int displayCount;
//Font[] monoFontList;
String[] monoFontFamilies;
JComboBox fontSelectionBox;
@@ -158,16 +167,6 @@ public class Preferences {
// check for platform-specific properties in the defaults
String platformExt = "." + PConstants.platformNames[PApplet.platform]; //$NON-NLS-1$
int platformExtLength = platformExt.length();
// Enumeration e = table.keys();
// while (e.hasMoreElements()) {
// String key = (String) e.nextElement();
// if (key.endsWith(platformExt)) {
// // this is a key specific to a particular platform
// String actualKey = key.substring(0, key.length() - platformExtLength);
// String value = get(key);
// table.put(actualKey, value);
// }
// }
// Get a list of keys that are specific to this platform
ArrayList<String> platformKeys = new ArrayList<String>();
@@ -190,28 +189,10 @@ public class Preferences {
// other things that have to be set explicitly for the defaults
setColor("run.window.bgcolor", SystemColor.control); //$NON-NLS-1$
// Load a prefs file if specified on the command line
// if (commandLinePrefs != null) {
// try {
// load(new FileInputStream(commandLinePrefs));
//
// } catch (Exception poe) {
// Base.showError("Error",
// "Could not read preferences from " +
// commandLinePrefs, poe);
// }
// } else if (!Base.isCommandLine()) {
// next load user preferences file
preferencesFile = Base.getSettingsFile(PREFS_FILE);
if (!preferencesFile.exists()) {
// create a new preferences file if none exists
// saves the defaults out to the file
save();
} else {
// load the previous preferences file
if (preferencesFile.exists()) {
try {
load(new FileInputStream(preferencesFile));
@@ -222,7 +203,12 @@ public class Preferences {
preferencesFile.getAbsolutePath() +
" and restart Processing.", ex);
}
// }
}
if (checkSketchbookPref() || !preferencesFile.exists()) {
// create a new preferences file if none exists
// saves the defaults out to the file
save();
}
PApplet.useNativeSelect =
@@ -247,11 +233,6 @@ public class Preferences {
dialog = new JFrame(Language.text("preferences"));
dialog.setResizable(false);
// GroupLayout layout = new GroupLayout(getContentPane());
// dialog.getContentPane().setLayout(layout);
// layout.setAutoCreateGaps(true);
// layout.setAutoCreateContainerGaps(true);
Container pain = dialog.getContentPane();
pain.setLayout(null);
@@ -286,11 +267,6 @@ public class Preferences {
PApplet.selectFolder(Language.text("preferences.sketchbook_location.popup"),
"sketchbookCallback", dflt,
Preferences.this, dialog);
// File file =
// Base.selectFolder("Select new sketchbook location", dflt, dialog);
// if (file != null) {
// sketchbookLocationField.setText(file.getAbsolutePath());
// }
}
});
pain.add(button);
@@ -372,15 +348,10 @@ public class Preferences {
Container box = Box.createHorizontalBox();
label = new JLabel(Language.text("preferences.editor_font_size")+": ");
box.add(label);
//fontSizeField = new JTextField(4);
fontSizeField = new JComboBox<Integer>(FONT_SIZES);
// fontSizeField = new JComboBox<Integer>(FONT_SIZES);
fontSizeField.setEditable(true);
box.add(fontSizeField);
// label = new JLabel(" ("+Language.text("preferences.requires_restart")+")");
// label = new JLabel(" (requires restart of Processing)");
// box.add(label);
box.add(Box.createHorizontalStrut(GUI_BETWEEN));
label = new JLabel(Language.text("preferences.console_font_size")+": ");
@@ -394,19 +365,136 @@ public class Preferences {
pain.add(box);
d = box.getPreferredSize();
box.setBounds(left, top, d.width, d.height);
// Font editorFont = Preferences.getFont("editor.font");
//fontSizeField.setText(String.valueOf(editorFont.getSize()));
// fontSizeField.setSelectedItem(editorFont.getSize());
fontSizeField.setSelectedItem(Preferences.getFont("editor.font.size"));
top += d.height + GUI_BETWEEN;
Container colorBox = Box.createHorizontalBox();
label = new JLabel("Background color when Presenting: ");
colorBox.add(label);
final String colorTip = "<html>"
+ "Select the background color used when using Present.<br/>"
+ "Present is used to present a sketch in full-screen, <br/>"
+ "accessible from the Sketch menu.";
label.setToolTipText(colorTip);
presentColor = new JTextField(" ");
presentColor.setOpaque(true);
presentColor.setEnabled(false);
presentColor.setBorder(new CompoundBorder(BorderFactory.createMatteBorder(
1, 1, 0, 0, new Color(195, 195, 195)), BorderFactory.createMatteBorder(
0, 0, 1, 1, new Color(54, 54, 54))));
presentColor.setBackground(Preferences.getColor("run.present.bgcolor"));
presentColorHex = new JTextField(6);
presentColorHex
.setText(Preferences.get("run.present.bgcolor").substring(1));
presentColorHex.getDocument().addDocumentListener(new DocumentListener() {
@Override
public void removeUpdate(DocumentEvent e) {
final String colorValue = presentColorHex.getText().toUpperCase();
if (colorValue.length() == 7 && (colorValue.startsWith("#")))
EventQueue.invokeLater(new Runnable() {
public void run() {
presentColorHex.setText(colorValue.substring(1));
}
});
if (colorValue.length() == 6
&& colorValue.matches("[0123456789ABCDEF]*")) {
presentColor.setBackground(new Color(Integer.parseInt(
colorValue.substring(0, 2), 16), Integer.parseInt(
colorValue.substring(2, 4), 16), Integer.parseInt(
colorValue.substring(4, 6), 16)));
if (!colorValue.equals(presentColorHex.getText()))
EventQueue.invokeLater(new Runnable() {
public void run() {
presentColorHex.setText(colorValue);
}
});
}
}
@Override
public void insertUpdate(DocumentEvent e) {
final String colorValue = presentColorHex.getText().toUpperCase();
if (colorValue.length() == 7 && (colorValue.startsWith("#")))
EventQueue.invokeLater(new Runnable() {
public void run() {
presentColorHex.setText(colorValue.substring(1));
}
});
if (colorValue.length() == 6
&& colorValue.matches("[0123456789ABCDEF]*")) {
presentColor.setBackground(new Color(Integer.parseInt(
colorValue.substring(0, 2), 16), Integer.parseInt(
colorValue.substring(2, 4), 16), Integer.parseInt(
colorValue.substring(4, 6), 16)));
if (!colorValue.equals(presentColorHex.getText()))
EventQueue.invokeLater(new Runnable() {
public void run() {
presentColorHex.setText(colorValue);
}
});
}
}
@Override public void changedUpdate(DocumentEvent e) {}
});
selector = new ColorChooser(dialog, false,
Preferences.getColor("run.present.bgcolor"), "OK",
new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
String colorValue = selector.getHexColor();
presentColorHex.setText(colorValue.substring(1));
presentColor.setBackground(new Color(Integer.parseInt(
colorValue.substring(1, 3), 16), Integer.parseInt(
colorValue.substring(3, 5), 16), Integer.parseInt(
colorValue.substring(5, 7), 16)));
selector.hide();
}
});
presentColor.addMouseListener(new MouseListener() {
@Override public void mouseReleased(MouseEvent e) {}
@Override public void mousePressed(MouseEvent e) {}
@Override
public void mouseExited(MouseEvent e) {
dialog.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
}
@Override
public void mouseEntered(MouseEvent e) {
dialog.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
}
@Override
public void mouseClicked(MouseEvent e) {
selector.show();
}
});
label = new JLabel("#");
colorBox.add(label);
colorBox.add(presentColorHex);
colorBox.add(Box.createHorizontalStrut(GUI_SMALL + 2 / 3 * GUI_SMALL));
colorBox.add(presentColor);
pain.add(colorBox);
d = colorBox.getPreferredSize();
colorBox.setBounds(left, top, d.width, d.height);
top += d.height + GUI_BETWEEN;
// [ ] Use smooth text in editor window
editorAntialiasBox = new JCheckBox(Language.text("preferences.use_smooth_text"));
// new JCheckBox("Use smooth text in editor window " +
// "(requires restart of Processing)");
pain.add(editorAntialiasBox);
d = editorAntialiasBox.getPreferredSize();
// adding +10 because ubuntu + jre 1.5 truncating items
@@ -414,7 +502,7 @@ public class Preferences {
right = Math.max(right, left + d.width);
top += d.height + GUI_BETWEEN;
// [ ] Enable complex text input (for Japanese et al, requires restart)
inputMethodBox =
@@ -426,6 +514,51 @@ public class Preferences {
inputMethodBox.setBounds(left, top, d.width + 10, d.height);
right = Math.max(right, left + d.width);
top += d.height + GUI_BETWEEN;
// [ ] Continuously check for errors - PDE X
errorCheckerBox =
new JCheckBox("Continuously check for errors");
pain.add(errorCheckerBox);
d = errorCheckerBox.getPreferredSize();
errorCheckerBox.setBounds(left, top, d.width + 10, d.height);
//right = Math.max(right, left + d.width);
//top += d.height + GUI_BETWEEN;
int warningLeft = left + d.width;
// [ ] Show Warnings - PDE X
warningsCheckerBox =
new JCheckBox("Show warnings");
pain.add(warningsCheckerBox);
d = warningsCheckerBox.getPreferredSize();
warningsCheckerBox.setBounds(warningLeft, top, d.width + 10, d.height);
right = Math.max(right, warningLeft + d.width);
top += d.height + GUI_BETWEEN;
// [ ] Enable Code Completion - PDE X
codeCompletionBox =
new JCheckBox("Enable code completion");
pain.add(codeCompletionBox);
d = codeCompletionBox.getPreferredSize();
codeCompletionBox.setBounds(left, top, d.width + 10, d.height);
int toggleLeft = left + d.width;
// [ ] Toggle Code Completion Trigger - PDE X
final String modifier = Base.isMacOS() ? "\u2318" : "Ctrl";
codeCompletionTriggerBox =
new JCheckBox("Trigger with " + modifier + "-space");
pain.add(codeCompletionTriggerBox);
d = codeCompletionTriggerBox.getPreferredSize();
codeCompletionTriggerBox.setBounds(toggleLeft, top, d.width + 10, d.height);
right = Math.max(right, toggleLeft + d.width);
top += d.height + GUI_BETWEEN;
// [ ] Increase maximum available memory to [______] MB
@@ -442,19 +575,6 @@ public class Preferences {
top += d.height + GUI_BETWEEN;
// // [ ] Use multiple .jar files when exporting applets
//
// exportSeparateBox =
// new JCheckBox("Use multiple .jar files when exporting applets " +
// "(ignored when using libraries)");
// pain.add(exportSeparateBox);
// d = exportSeparateBox.getPreferredSize();
// // adding +10 because ubuntu + jre 1.5 truncating items
// exportSeparateBox.setBounds(left, top, d.width + 10, d.height);
// right = Math.max(right, left + d.width);
// top += d.height + GUI_BETWEEN;
// [ ] Delete previous application folder on export
deletePreviousBox =
@@ -466,17 +586,7 @@ public class Preferences {
top += d.height + GUI_BETWEEN;
// // [ ] Use external editor
//
// externalEditorBox = new JCheckBox("Use external editor");
// pain.add(externalEditorBox);
// d = externalEditorBox.getPreferredSize();
// externalEditorBox.setBounds(left, top, d.width + 10, d.height);
// right = Math.max(right, left + d.width);
// top += d.height + GUI_BETWEEN;
// [ ] Use external editor
// [ ] Hide tab/toolbar background image
whinyBox = new JCheckBox(Language.text("preferences.hide_toolbar_background_image")+
" ("+Language.text("preferences.requires_restart")+")");
@@ -526,30 +636,6 @@ public class Preferences {
}
// Launch programs as [ ] 32-bit [ ] 64-bit (Mac OS X only)
/*
if (Base.isMacOS()) {
box = Box.createHorizontalBox();
label = new JLabel(Language.text("preferences.launch_programs_in")+" ");
box.add(label);
bitsThirtyTwoButton = new JRadioButton("32-bit "+Language.text("preferences.launch_programs_in.mode")+" ");
box.add(bitsThirtyTwoButton);
bitsSixtyFourButton = new JRadioButton("64-bit "+Language.text("preferences.launch_programs_in.mode"));
box.add(bitsSixtyFourButton);
ButtonGroup bg = new ButtonGroup();
bg.add(bitsThirtyTwoButton);
bg.add(bitsSixtyFourButton);
pain.add(box);
d = box.getPreferredSize();
box.setBounds(left, top, d.width, d.height);
top += d.height + GUI_BETWEEN;
}
*/
// More preferences are in the ...
label = new JLabel(Language.text("preferences.file")+":");
@@ -708,7 +794,7 @@ public class Preferences {
// each platform, and nobody wants to debug/support that.
// if the sketchbook path has changed, rebuild the menus
String oldPath = get("sketchbook.path"); //$NON-NLS-1$
String oldPath = getSketchbookPath();
String newPath = sketchbookLocationField.getText();
if (!newPath.equals(oldPath)) {
base.setSketchbookFolder(new File(newPath));
@@ -756,52 +842,12 @@ public class Preferences {
System.err.println("Ignoring bad memory setting");
}
/*
// was gonna use this to check memory settings,
// but it quickly gets much too messy
if (getBoolean("run.options.memory")) {
Process process = Runtime.getRuntime().exec(new String[] {
"java", "-Xms" + memoryMin + "m", "-Xmx" + memoryMax + "m"
});
processInput = new SystemOutSiphon(process.getInputStream());
processError = new MessageSiphon(process.getErrorStream(), this);
}
*/
/*
// If a change has been made between 32- and 64-bit, the libraries need
// to be reloaded so that their native paths are set correctly.
if (Base.isMacOS()) {
String oldBits = get("run.options.bits"); //$NON-NLS-1$
String newBits = bitsThirtyTwoButton.isSelected() ? "32" : "64"; //$NON-NLS-1$ //$NON-NLS-2$
if (!oldBits.equals(newBits)) {
set("run.options.bits", newBits); //$NON-NLS-1$
for (Mode m : base.getModeList()) {
m.rebuildLibraryList();
}
}
}
*/
// Don't change anything if the user closes the window before fonts load
if (fontSelectionBox.isEnabled()) {
String fontFamily = (String) fontSelectionBox.getSelectedItem();
set("editor.font.family", fontFamily);
}
/*
String newSizeText = fontSizeField.getText();
try {
int newSize = Integer.parseInt(newSizeText.trim());
//String pieces[] = PApplet.split(get("editor.font"), ','); //$NON-NLS-1$
//pieces[2] = String.valueOf(newSize);
//set("editor.font", PApplet.join(pieces, ',')); //$NON-NLS-1$
set("editor.font.size", String.valueOf(newSize));
} catch (Exception e) {
Base.log("Ignoring invalid font size " + newSizeText); //$NON-NLS-1$
}
*/
try {
Object selection = fontSizeField.getSelectedItem();
if (selection instanceof String) {
@@ -828,51 +874,45 @@ public class Preferences {
consoleSizeField.setSelectedItem(getInteger("console.font.size"));
}
setColor("run.present.bgcolor", presentColor.getBackground());
setBoolean("editor.input_method_support", inputMethodBox.isSelected()); //$NON-NLS-1$
if (autoAssociateBox != null) {
setBoolean("platform.auto_file_type_associations", //$NON-NLS-1$
autoAssociateBox.isSelected());
}
setBoolean("pdex.errorCheckEnabled", errorCheckerBox.isSelected());
setBoolean("pdex.warningsEnabled", warningsCheckerBox.isSelected());
setBoolean("pdex.ccEnabled", codeCompletionBox.isSelected());
setBoolean("pdex.ccTriggerEnabled", codeCompletionTriggerBox.isSelected());
for (Editor editor : base.getEditors()) {
editor.applyPreferences();
}
}
protected void showFrame() {
editorAntialiasBox.setSelected(getBoolean("editor.smooth")); //$NON-NLS-1$
inputMethodBox.setSelected(getBoolean("editor.input_method_support")); //$NON-NLS-1$
// set all settings entry boxes to their actual status
// exportSeparateBox.
// setSelected(getBoolean("export.applet.separate_jar_files"));
errorCheckerBox.setSelected(getBoolean("pdex.errorCheckEnabled"));
warningsCheckerBox.setSelected(getBoolean("pdex.warningsEnabled"));
codeCompletionBox.setSelected(getBoolean("pdex.ccEnabled"));
codeCompletionTriggerBox.setSelected(getBoolean("pdex.ccTriggerEnabled"));
deletePreviousBox.
setSelected(getBoolean("export.delete_target_folder")); //$NON-NLS-1$
//closingLastQuitsBox.
// setSelected(getBoolean("sketchbook.closing_last_window_quits"));
//sketchPromptBox.
// setSelected(getBoolean("sketchbook.prompt"));
//sketchCleanBox.
// setSelected(getBoolean("sketchbook.auto_clean"));
sketchbookLocationField.
setText(get("sketchbook.path")); //$NON-NLS-1$
// externalEditorBox.
// setSelected(getBoolean("editor.external"));
checkUpdatesBox.
setSelected(getBoolean("update.check")); //$NON-NLS-1$
sketchbookLocationField.setText(getSketchbookPath());
checkUpdatesBox.setSelected(getBoolean("update.check")); //$NON-NLS-1$
whinyBox.setSelected(getBoolean("header.hide.image") || //$NON-NLS-1$
getBoolean("buttons.hide.image")); //$NON-NLS-1$
updateDisplayList();
int displayNum = getInteger("run.display"); //$NON-NLS-1$
// System.out.println("display is " + displayNum + ", d count is " + displayCount);
if (displayNum >= 0 && displayNum < displayCount) {
// System.out.println("setting num to " + displayNum);
displaySelectionBox.setSelectedIndex(displayNum);
}
@@ -886,27 +926,14 @@ public class Preferences {
fontSizeField.setSelectedItem(getInteger("editor.font.size"));
consoleSizeField.setSelectedItem(getInteger("console.font.size"));
presentColor.setBackground(Preferences.getColor("run.present.bgcolor"));
presentColorHex.setText(Preferences.get("run.present.bgcolor").substring(1));
memoryOverrideBox.
setSelected(getBoolean("run.options.memory")); //$NON-NLS-1$
memoryField.
setText(get("run.options.memory.maximum")); //$NON-NLS-1$
/*
if (Base.isMacOS()) {
String bits = Preferences.get("run.options.bits"); //$NON-NLS-1$
if (bits.equals("32")) { //$NON-NLS-1$
bitsThirtyTwoButton.setSelected(true);
} else if (bits.equals("64")) { //$NON-NLS-1$
bitsSixtyFourButton.setSelected(true);
}
// in case we go back and support OS X 10.5...
if (System.getProperty("os.version").startsWith("10.5")) { //$NON-NLS-1$ //$NON-NLS-2$
bitsSixtyFourButton.setSelected(true);
bitsThirtyTwoButton.setEnabled(false);
}
}
*/
if (autoAssociateBox != null) {
autoAssociateBox.
setSelected(getBoolean("platform.auto_file_type_associations")); //$NON-NLS-1$
@@ -934,37 +961,11 @@ public class Preferences {
void initFontList() {
/*
if (monoFontList == null) {
monoFontList = Toolkit.getMonoFontList().toArray(new Font[0]);
fontSelectionBox.setModel(new DefaultComboBoxModel(monoFontList));
fontSelectionBox.setRenderer(new FontNamer());
// Preferred size just makes it extend to the container
//fontSelectionBox.setSize(fontSelectionBox.getPreferredSize());
// Minimum size is better, but cuts things off (on OS X), so we add 20
//Dimension minSize = fontSelectionBox.getMinimumSize();
//Dimension minSize = fontSelectionBox.getPreferredSize();
//fontSelectionBox.setSize(minSize.width + 20, minSize.height);
fontSelectionBox.setEnabled(true);
}
*/
if (monoFontFamilies == null) {
monoFontFamilies = Toolkit.getMonoFontFamilies();
fontSelectionBox.setModel(new DefaultComboBoxModel(monoFontFamilies));
String family = get("editor.font.family");
// System.out.println("family is " + family);
// System.out.println("font sel items = " + fontSelectionBox.getItemCount());
// for (int i = 0; i < fontSelectionBox.getItemCount(); i++) {
// String item = (String) fontSelectionBox.getItemAt(i);
// if (fontSelectionBox.getItemAt(i) == family) {
// System.out.println("found at index " + i);
// } else if (item.equals(family)) {
// System.out.println("equals at index " + i);
// } else {
// System.out.println("nothing doing: " + item);
// }
// }
// Set a reasonable default, in case selecting the family fails
fontSelectionBox.setSelectedItem("Monospaced");
fontSelectionBox.setSelectedItem(family);
@@ -988,22 +989,6 @@ public class Preferences {
}
// Workaround for Apple bullsh*t caused by their not releasing a 32-bit
// version of Java for Mac OS X 10.5.
// static public String checkBits() {
// String bits = Preferences.get("run.options.bits");
// if (bits == null) {
// if (System.getProperty("os.version").startsWith("10.5")) {
// bits = "64";
// } else {
// bits = "32";
// }
// Preferences.set("run.options.bits", bits);
// }
// return bits;
// }
// .................................................................
@@ -1062,20 +1047,8 @@ public class Preferences {
// all the information from preferences.txt
//static public String get(String attribute) {
//return get(attribute, null);
//}
static public String get(String attribute /*, String defaultValue */) {
return table.get(attribute);
/*
//String value = (properties != null) ?
//properties.getProperty(attribute) : applet.getParameter(attribute);
String value = properties.getProperty(attribute);
return (value == null) ?
defaultValue : value;
*/
}
@@ -1213,28 +1186,37 @@ public class Preferences {
}
return new Font("Dialog", Font.PLAIN, 12);
}
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
/*
static public SyntaxStyle getStyle(String what) {
String str = get("editor." + what + ".style"); //, dflt); //$NON-NLS-1$ //$NON-NLS-2$
StringTokenizer st = new StringTokenizer(str, ","); //$NON-NLS-1$
String s = st.nextToken();
if (s.indexOf("#") == 0) s = s.substring(1); //$NON-NLS-1$
Color color = Color.DARK_GRAY;
try {
color = new Color(Integer.parseInt(s, 16));
} catch (Exception e) { }
s = st.nextToken();
boolean bold = (s.indexOf("bold") != -1); //$NON-NLS-1$
// boolean italic = (s.indexOf("italic") != -1); //$NON-NLS-1$
//System.out.println(what + " = " + str + " " + bold + " " + italic);
// return new SyntaxStyle(color, italic, bold);
return new SyntaxStyle(color, bold);
/**
* Check for a 3.0 sketchbook location, and if none exists,
* try to grab it from the 2.0 sketchbook location.
* @return true if a location was found and the pref didn't exist
*/
static protected boolean checkSketchbookPref() {
// If a 3.0 sketchbook location has never been inited
if (getSketchbookPath() == null) {
String twoPath = get("sketchbook.path");
// If they've run the 2.0 version, start with that location
if (twoPath != null) {
setSketchbookPath(twoPath);
return true; // save the sketchbook right away
}
// Otherwise it'll be null, and reset properly by Base
}
return false;
}
static protected String getSketchbookPath() {
return get("sketchbook.path.three"); //$NON-NLS-1$
}
static protected void setSketchbookPath(String path) {
set("sketchbook.path.three", path); //$NON-NLS-1$
}
*/
}
+379
View File
@@ -0,0 +1,379 @@
package processing.app;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JProgressBar;
import javax.swing.SwingWorker;
//Class used to handle progress bar, and run Save As or Add File in
//background so that
//progress bar can update without freezing
public class ProgressFrame extends JFrame implements PropertyChangeListener {
private static final long serialVersionUID = 1L;
private JProgressBar progressBar;
private JLabel saveAsLabel;
private TaskSaveAs t;
private TaskAddFile t2;
private File[] copyItems;
private File newFolder;
private File addFile, sourceFile;
private Editor editor;
// create a new background thread to save as
public class TaskSaveAs extends SwingWorker<Void, Void> {
@Override
protected Void doInBackground() throws Exception {
// a large part of the file copying happens in this background
// thread
long totalSize = 0;
for (File copyable : copyItems) {
totalSize += getFileLength(copyable);
}
long progress = 0;
setProgress(0);
for (File copyable : ProgressFrame.this.copyItems) {
// loop to copy over the items that make sense, and to set the
// current progress
if (copyable.isDirectory()) {
copyDir(copyable,
new File(ProgressFrame.this.newFolder, copyable.getName()),
this, progress, totalSize);
progress += getFileLength(copyable);
} else {
copyFile(copyable,
new File(ProgressFrame.this.newFolder, copyable.getName()),
this, progress, totalSize);
if (getFileLength(copyable) < 524288) {
// If the file length > 0.5MB, the copyFile() function has
// been redesigned to change progress every 0.5MB so that
// the progress bar doesn't stagnate during that time
progress += getFileLength(copyable);
setProgress((int) Math.min(Math.ceil(progress * 100.0 / totalSize),
100));
}
}
}
return null;
}
public void setProgressBarStatus(int status) {
setProgress(status);
}
@Override
public void done() {
// to close the progress bar automatically when done, and to
// print that Saving is done in Message Area
editor.statusNotice("Done Saving.");
ProgressFrame.this.closeProgressBar();
}
}
// create a new background thread to add a file
public class TaskAddFile extends SwingWorker<Void, Void> {
@Override
protected Void doInBackground() throws Exception {
// a large part of the file copying happens in this background
// thread
setProgress(0);
copyFile(sourceFile, addFile, this);
if (addFile.length() < 1024) {
// If the file length > 1kB, the copyFile() function has
// been redesigned to change progress every 1kB so that
// the progress bar doesn't stagnate during that time
// If file <1 kB, just fill up Progress Bar to 100%
// directly, since time to copy is now negligable (when
// perceived by a human, anyway)
setProgress(100);
}
return null;
}
public void setProgressBarStatus(int status) {
setProgress(status);
}
@Override
public void done() {
// to close the progress bar automatically when done, and to
// print that adding file is done in Message Area
editor.statusNotice("One file added to the sketch.");
ProgressFrame.this.closeProgressBar();
}
}
//Use for Save As
public ProgressFrame(File[] c, File nf, String oldName, String newName,
Editor editor) {
// initialize a copyItems and newFolder, which are used for file
// copying in the background thread
copyItems = c;
newFolder = nf;
this.editor = editor;
// the UI of the progress bar follows
setDefaultCloseOperation(HIDE_ON_CLOSE);
setBounds(200, 200, 400, 140);
setResizable(false);
setTitle("Saving As...");
JPanel panel = new JPanel(null);
add(panel);
setContentPane(panel);
saveAsLabel = new JLabel("Saving " + oldName + " as " + newName + "...");
saveAsLabel.setBounds(40, 20, 300, 20);
progressBar = new JProgressBar(0, 100);
progressBar.setValue(0);
progressBar.setBounds(40, 50, 300, 30);
progressBar.setStringPainted(true);
panel.add(progressBar);
panel.add(saveAsLabel);
Toolkit.setIcon(this);
this.setVisible(true);
// create an instance of TaskSaveAs and run execute() on this
// instance to
// start background thread
t = new TaskSaveAs();
t.addPropertyChangeListener(this);
t.execute();
}
//Use for Add File
public ProgressFrame(File sf, File add, Editor editor) {
addFile = add;
sourceFile = sf;
this.editor = editor;
// the UI of the progress bar follows
setDefaultCloseOperation(HIDE_ON_CLOSE);
setBounds(200, 200, 400, 140);
setResizable(false);
setTitle("Adding File...");
JPanel panel = new JPanel(null);
add(panel);
setContentPane(panel);
saveAsLabel = new JLabel("Adding " + addFile.getName());
saveAsLabel.setBounds(40, 20, 300, 20);
progressBar = new JProgressBar(0, 100);
progressBar.setValue(0);
progressBar.setBounds(40, 50, 300, 30);
progressBar.setStringPainted(true);
panel.add(progressBar);
panel.add(saveAsLabel);
Toolkit.setIcon(this);
this.setVisible(true);
// create an instance of TaskAddFile and run execute() on this
// instance to
// start background thread
t2 = new TaskAddFile();
t2.addPropertyChangeListener(this);
t2.execute();
}
public long getFileLength(File f)// function to return the length of
// the file, or
// ENTIRE directory, including the
// component files
// and sub-folders if passed
{
long fol_len = 0;
if (f.isDirectory()) {
String files[] = f.list();
for (int i = 0; i < files.length; i++) {
File temp = new File(f, files[i]);
if (temp.isDirectory()) {
fol_len += getFileLength(temp);
} else {
fol_len += (temp.length());
}
}
} else {
return (f.length());
}
return fol_len;
}
public void propertyChange(PropertyChangeEvent evt)
// detects a change in the property of the background task, i.e., is
// called when the size of files already copied changes
{
if ("progress" == evt.getPropertyName()) {
int progress = (Integer) evt.getNewValue();
progressBar.setValue(progress);
}
}
private void closeProgressBar()
// closes progress bar
{
this.dispose();
}
static public void copyFile(File sourceFile, File targetFile,
ProgressFrame.TaskSaveAs progBar,
double progress, double totalSize)
throws IOException {
// Overloaded copyFile that is called whenever a Save As is being done, so that the
// ProgressBar is updated for very large files as well
BufferedInputStream from = new BufferedInputStream(
new FileInputStream(
sourceFile));
BufferedOutputStream to = new BufferedOutputStream(
new FileOutputStream(
targetFile));
byte[] buffer = new byte[16 * 1024];
int bytesRead;
int totalRead = 0;
while ((bytesRead = from.read(buffer)) != -1) {
to.write(buffer, 0, bytesRead);
totalRead += bytesRead;
if (totalRead >= 524288) //to update progress bar every 0.5MB
{
progress += totalRead;
progBar.setProgressBarStatus((int) Math.min(Math.ceil(progress * 100.0
/ totalSize), 100));
totalRead = 0;
}
}
if (sourceFile.length() > 524288) {
// Update the progress bar one final time if file size is more than 0.5MB,
// otherwise, the update is handled either by the copyDir function,
// or directly by ProgressFrame.TaskSaveAs.doInBackground()
progress += totalRead;
progBar.setProgressBarStatus((int) Math.min(Math.ceil(progress * 100.0
/ totalSize), 100));
}
from.close();
from = null;
to.flush();
to.close();
to = null;
targetFile.setLastModified(sourceFile.lastModified());
targetFile.setExecutable(sourceFile.canExecute());
}
static public void copyFile(File sourceFile, File targetFile,
ProgressFrame.TaskAddFile progBar)
throws IOException {
// Overloaded copyFile that is called whenever a addFile is being done,
// so that the
// ProgressBar is updated
double totalSize = sourceFile.length();
int progress = 0;
BufferedInputStream from = new BufferedInputStream(
new FileInputStream(
sourceFile));
BufferedOutputStream to = new BufferedOutputStream(
new FileOutputStream(
targetFile));
byte[] buffer = new byte[16 * 1024];
int bytesRead;
int totalRead = 0;
while ((bytesRead = from.read(buffer)) != -1) {
to.write(buffer, 0, bytesRead);
totalRead += bytesRead;
if (totalRead >= 1024) // to update progress bar every 1kB
{
progress += totalRead;
progBar.setProgressBarStatus((int) Math.min(Math.ceil(progress * 100.0
/ totalSize), 100));
totalRead = 0;
}
}
if (sourceFile.length() > 1024) {
// Update the progress bar one final time if file size is more than
// 1kB,
// otherwise, the update is handled directly by
// ProgressFrame.TaskAddFile.doInBackground()
progress += totalRead;
progBar.setProgressBarStatus((int) Math.min(Math.ceil(progress * 100.0
/ totalSize), 100));
}
from.close();
from = null;
to.flush();
to.close();
to = null;
targetFile.setLastModified(sourceFile.lastModified());
targetFile.setExecutable(sourceFile.canExecute());
}
static public double copyDir(File sourceDir, File targetDir,
ProgressFrame.TaskSaveAs progBar,
double progress, double totalSize)
throws IOException {
// Overloaded copyDir so that the Save As progress bar gets updated when the
// files are in folders as well (like in the data folder)
if (sourceDir.equals(targetDir)) {
final String urDum = "source and target directories are identical";
throw new IllegalArgumentException(urDum);
}
targetDir.mkdirs();
String files[] = sourceDir.list();
for (int i = 0; i < files.length; i++) {
// Ignore dot files (.DS_Store), dot folders (.svn) while copying
if (files[i].charAt(0) == '.')
continue;
//if (files[i].equals(".") || files[i].equals("..")) continue;
File source = new File(sourceDir, files[i]);
File target = new File(targetDir, files[i]);
if (source.isDirectory()) {
//target.mkdirs();
progress = copyDir(source, target, progBar, progress, totalSize);
progBar.setProgressBarStatus((int) Math.min(Math.ceil(progress * 100.0
/ totalSize), 100));
target.setLastModified(source.lastModified());
} else {
copyFile(source, target, progBar, progress, totalSize);
// Update SaveAs progress bar
progress += source.length();
progBar.setProgressBarStatus((int) Math.min(Math.ceil(progress * 100.0
/ totalSize), 100));
}
}
return progress;
}
}
+126 -25
View File
@@ -26,6 +26,9 @@ package processing.app;
import processing.core.*;
import java.awt.*;
import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.io.*;
import javax.swing.*;
@@ -286,7 +289,8 @@ public class Sketch {
}
renamingCode = false;
editor.status.edit("Name for new file:", "");
// editor.status.edit("Name for new file:", "");
promptForTabName("Name for new file:", "");
}
@@ -326,8 +330,94 @@ public class Sketch {
"New name for sketch:" : "New name for file:";
String oldName = (current.isExtension(mode.getDefaultExtension())) ?
current.getPrettyName() : current.getFileName();
editor.status.edit(prompt, oldName);
// editor.status.edit(prompt, oldName);
promptForTabName(prompt, oldName);
}
/**
* Displays a dialog for renaming or creating a new tab
* @param prompt - msg to display
* @param oldName
*/
protected void promptForTabName(String prompt, String oldName) {
final JTextField field = new JTextField(oldName);
field.addKeyListener(new KeyAdapter() {
// Forget ESC, the JDialog should handle it.
// Use keyTyped to catch when the feller is actually added to the text
// field. With keyTyped, as opposed to keyPressed, the keyCode will be
// zero, even if it's enter or backspace or whatever, so the keychar
// should be used instead. Grr.
public void keyTyped(KeyEvent event) {
//System.out.println("got event " + event);
char ch = event.getKeyChar();
if ((ch == '_') || (ch == '.') || // allow.pde and .java
(('A' <= ch) && (ch <= 'Z')) || (('a' <= ch) && (ch <= 'z'))) {
// These events are allowed straight through.
} else if (ch == ' ') {
String t = field.getText();
int start = field.getSelectionStart();
int end = field.getSelectionEnd();
field.setText(t.substring(0, start) + "_" + t.substring(end));
field.setCaretPosition(start + 1);
event.consume();
} else if ((ch >= '0') && (ch <= '9')) {
// getCaretPosition == 0 means that it's the first char
// and the field is empty.
// getSelectionStart means that it *will be* the first
// char, because the selection is about to be replaced
// with whatever is typed.
if (field.getCaretPosition() == 0 ||
field.getSelectionStart() == 0) {
// number not allowed as first digit
event.consume();
}
} else if (ch == KeyEvent.VK_ENTER) {
// Slightly ugly hack that ensures OK button of the dialog consumes
// the Enter key event. Since the text field is the default component
// in the dialog, OK doesn't consume Enter key event, by default.
Container parent = field.getParent();
while (!(parent instanceof JOptionPane)) {
parent = parent.getParent();
}
JOptionPane pane = (JOptionPane) parent;
final JPanel pnlBottom = (JPanel)
pane.getComponent(pane.getComponentCount() - 1);
for (int i = 0; i < pnlBottom.getComponents().length; i++) {
Component component = pnlBottom.getComponents()[i];
if (component instanceof JButton) {
final JButton okButton = (JButton) component;
if (okButton.getText().equalsIgnoreCase("OK")) {
ActionListener[] actionListeners =
okButton.getActionListeners();
if (actionListeners.length > 0) {
actionListeners[0].actionPerformed(null);
event.consume();
}
}
}
}
} else {
event.consume();
}
}
});
int userReply = JOptionPane.showOptionDialog(editor, new Object[] {
prompt, field },
"New Name",
JOptionPane.OK_CANCEL_OPTION,
JOptionPane.PLAIN_MESSAGE,
null, new Object[] {
Preferences.PROMPT_OK,
Preferences.PROMPT_CANCEL },
field);
if (userReply == JOptionPane.OK_OPTION) {
nameCode(field.getText());
}
}
/**
@@ -382,7 +472,7 @@ public class Sketch {
if (current == code[0]) { // If this is the main tab, disallow
Base.showWarning("Problem with rename",
"The first tab cannot be a ." + newExtension + " file.\n" +
"(It may be time for your to graduate to a\n" +
"(It may be time for you to graduate to a\n" +
"\"real\" programming environment, hotshot.)");
return;
}
@@ -654,7 +744,8 @@ public class Sketch {
if (Base.isMacOS()) {
// http://developer.apple.com/qa/qa2001/qa1146.html
Object modifiedParam = modified ? Boolean.TRUE : Boolean.FALSE;
editor.getRootPane().putClientProperty("windowModified", modifiedParam);
// https://developer.apple.com/library/mac/technotes/tn2007/tn2196.html#WINDOW_DOCUMENTMODIFIED
editor.getRootPane().putClientProperty("Window.documentModified", modifiedParam);
}
}
@@ -712,6 +803,8 @@ public class Sketch {
protected boolean saveAs() throws IOException {
String newParentDir = null;
String newName = null;
final String oldName2 = folder.getName();
// TODO rewrite this to use shared version from PApplet
final String PROMPT = Language.text("save");
if (Preferences.getBoolean("chooser.files.native")) {
@@ -719,7 +812,7 @@ public class Sketch {
FileDialog fd = new FileDialog(editor, PROMPT, FileDialog.SAVE);
if (isReadOnly() || isUntitled()) {
// default to the sketchbook folder
fd.setDirectory(Preferences.get("sketchbook.path"));
fd.setDirectory(Preferences.getSketchbookPath());
} else {
// default to the parent folder of where this was
fd.setDirectory(folder.getParent());
@@ -734,7 +827,7 @@ public class Sketch {
fc.setDialogTitle(PROMPT);
if (isReadOnly() || isUntitled()) {
// default to the sketchbook folder
fc.setCurrentDirectory(new File(Preferences.get("sketchbook.path")));
fc.setCurrentDirectory(new File(Preferences.getSketchbookPath()));
} else {
// default to the parent folder of where this was
fc.setCurrentDirectory(folder.getParentFile());
@@ -846,15 +939,21 @@ public class Sketch {
return true;
}
});
// now copy over the items that make sense
for (File copyable : copyItems) {
if (copyable.isDirectory()) {
Base.copyDir(copyable, new File(newFolder, copyable.getName()));
} else {
Base.copyFile(copyable, new File(newFolder, copyable.getName()));
}
}
final File newFolder2 = newFolder;
final File[] copyItems2 = copyItems;
final String newName2 = newName;
// Create a new event dispatch thread- to display ProgressBar
// while Saving As
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
new ProgressFrame(copyItems2, newFolder2, oldName2, newName2, editor);
}
});
// save the other tabs to their new location
for (int i = 1; i < codeCount; i++) {
File newFile = new File(newFolder, code[i].getFileName());
@@ -885,6 +984,7 @@ public class Sketch {
}
/**
* Update internal state for new sketch name or folder location.
*/
@@ -950,7 +1050,8 @@ public class Sketch {
boolean result = addFile(sourceFile);
if (result) {
editor.statusNotice("One file added to the sketch.");
// editor.statusNotice("One file added to the sketch.");
//Done from within TaskAddFile inner class when copying is completed
}
}
@@ -1043,16 +1144,17 @@ public class Sketch {
// in case the user is "adding" the code in an attempt
// to update the sketch's tabs
if (!sourceFile.equals(destFile)) {
try {
Base.copyFile(sourceFile, destFile);
} catch (IOException e) {
Base.showWarning("Error adding file",
"Could not add '" + filename + "' to the sketch.", e);
return false;
if (!sourceFile.equals(destFile)) {
final File sourceFile2 = sourceFile;
final File destFile2 = destFile;
// Create a new event dispatch thread- to display ProgressBar
// while Saving As
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
new ProgressFrame(sourceFile2, destFile2, editor);
}
}
});
}
if (codeExtension != null) {
SketchCode newCode = new SketchCode(destFile, codeExtension);
@@ -1286,7 +1388,6 @@ public class Sketch {
*/
public String getMainFilePath() {
return primaryFile.getAbsolutePath();
//return code[0].file.getAbsolutePath();
}
+10 -3
View File
@@ -40,8 +40,8 @@ import java.awt.font.TextLayout;
import java.awt.geom.AffineTransform;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.HashSet;
@@ -453,9 +453,16 @@ public class Toolkit {
}
/**
* Get a font from the JRE lib/fonts folder. Our default fonts are also
* installed there so that the monospace (and others) can be used by other
* font listing calls (i.e. it appears in the list of monospace fonts in
* the Preferences window).
*/
static private Font createFont(String filename, int size) throws IOException, FontFormatException {
InputStream is = Base.getLibStream("fonts/" + filename);
BufferedInputStream input = new BufferedInputStream(is);
//InputStream is = Base.getLibStream("fonts/" + filename);
File fontFile = new File(System.getProperty("java.home"), "lib/fonts/" + filename);
BufferedInputStream input = new BufferedInputStream(new FileInputStream(fontFile));
Font font = Font.createFont(Font.TRUETYPE_FONT, input);
input.close();
return font.deriveFont((float) size);
+4 -4
View File
@@ -58,7 +58,7 @@ public class UpdateCheck {
new Thread(new Runnable() {
public void run() {
try {
Thread.sleep(30 * 1000); // give the PDE time to get rolling
Thread.sleep(20 * 1000); // give the PDE time to get rolling
updateCheck();
} catch (Exception e) {
// this can safely be ignored, too many instances where no net
@@ -124,11 +124,11 @@ public class UpdateCheck {
// (this should really be handled better).
Thread.sleep(5 * 1000);
if ((!base.libraryManagerFrame.hasAlreadyBeenOpened() &&
base.libraryManagerFrame.hasUpdates()) ||
base.libraryManagerFrame.hasUpdates(base)) ||
(!base.toolManagerFrame.hasAlreadyBeenOpened() &&
base.toolManagerFrame.hasUpdates()) ||
base.toolManagerFrame.hasUpdates(base)) ||
(!base.modeManagerFrame.hasAlreadyBeenOpened() &&
base.modeManagerFrame.hasUpdates())) {
base.modeManagerFrame.hasUpdates(base))) {
promptToOpenContributionManager();
}
}
@@ -1,4 +1,4 @@
/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
/*
Part of the Processing project - http://processing.org
@@ -23,6 +23,7 @@ package processing.app.contrib;
import java.io.*;
import java.util.HashMap;
import java.util.List;
import processing.app.Base;
import processing.app.Editor;
@@ -53,6 +54,13 @@ class AvailableContribution extends Contribution {
version = PApplet.parseInt(versionStr, 0);
}
prettyVersion = params.get("prettyVersion");
String lastUpdatedStr = params.get("lastUpdated");
if (lastUpdatedStr != null)
try {
lastUpdated = Long.parseLong(lastUpdatedStr);
} catch (NumberFormatException e) {
lastUpdated = 0;
}
}
@@ -179,26 +187,96 @@ class AvailableContribution extends Contribution {
/**
* We overwrite the properties file with the curated version from the
* Processing site. This ensures that things have been cleaned up (for
* instance, that the "sentence" is really a sentence) and that bad data
* from the contrib's .properties file doesn't break the manager.
* We overwrite those fields that aren't proper in the properties file with
* the curated version from the Processing site. This ensures that things have
* been cleaned up (for instance, that the "sentence" is really a sentence)
* and that bad data from the contrib's .properties file doesn't break the
* manager. However, it also ensures that valid fields in the properties file
* aren't overwritten, since the properties file may be more recent than the
* contributions.txt file.
*
* @param propFile
* @return
*/
public boolean writePropertiesFile(File propFile) {
try {
HashMap<String, String> properties = Base.readSettings(propFile);
String name = properties.get("name");
if (name == null || name.isEmpty())
name = getName();
String category;
List<String> categoryList = parseCategories(properties.get("category"));
if (categoryList.size() == 1 && categoryList.get(0).equals("Unknown"))
category = getCategoryStr();
else {
StringBuilder sb = new StringBuilder();
for (String cat : categories) {
sb.append(cat);
sb.append(',');
}
sb.deleteCharAt(sb.length() - 1);
category = sb.toString();
}
String authorList = properties.get("authorList");
if (authorList == null || authorList.isEmpty())
authorList = getAuthorList();
String url = properties.get("url");
if (url == null || url.isEmpty())
url = getUrl();
String sentence = properties.get("sentence");
if (sentence == null || sentence.isEmpty())
sentence = getSentence();
String paragraph = properties.get("paragraph");
if (paragraph == null || paragraph.isEmpty())
paragraph = getParagraph();
int version;
try {
version = Integer.parseInt(properties.get("version"));
} catch (NumberFormatException e) {
version = getVersion();
System.err.println("The version number for the “" + name
+ "” contribution is not set properly.");
System.err
.println("Please contact the author to fix it according to the guidelines.");
}
String prettyVersion = properties.get("prettyVersion");
if (prettyVersion == null || prettyVersion.isEmpty())
prettyVersion = getPrettyVersion();
long lastUpdated;
try {
lastUpdated = Long.parseLong(properties.get("lastUpdated"));
}
catch (NumberFormatException nfe) {
lastUpdated = getLastUpdated();
// Better comment these out till all contribs have a lastUpdated
// System.err.println("The last updated date for the “" + name
// + "” contribution is not set properly.");
// System.err
// .println("Please contact the author to fix it according to the guidelines.");
}
if (propFile.delete() && propFile.createNewFile() && propFile.setWritable(true)) {
PrintWriter writer = PApplet.createWriter(propFile);
writer.println("name=" + getName());
writer.println("category=" + getCategoryStr());
writer.println("authorList=" + getAuthorList());
writer.println("url=" + getUrl());
writer.println("sentence=" + getSentence());
writer.println("paragraph=" + getParagraph());
writer.println("version=" + getVersion());
writer.println("prettyVersion=" + getPrettyVersion());
writer.println("name=" + name);
writer.println("category=" + category);
writer.println("authorList=" + authorList);
writer.println("url=" + url);
writer.println("sentence=" + sentence);
writer.println("paragraph=" + paragraph);
writer.println("version=" + version);
writer.println("prettyVersion=" + prettyVersion);
writer.println("lastUpdated=" + lastUpdated);
writer.flush();
writer.close();
@@ -43,6 +43,7 @@ abstract public class Contribution {
protected String paragraph; // <paragraph length description for site>
protected int version; // 102
protected String prettyVersion; // "1.0.2"
protected long lastUpdated; // 1402805757
// "Sound"
@@ -120,6 +121,11 @@ abstract public class Contribution {
public String getPrettyVersion() {
return prettyVersion;
}
// 1402805757
public long getLastUpdated() {
return lastUpdated;
}
abstract public ContributionType getType();
@@ -27,6 +27,7 @@ import java.util.*;
import java.util.concurrent.locks.ReentrantLock;
import processing.app.Base;
import processing.app.Library;
import processing.core.PApplet;
@@ -379,6 +380,19 @@ public class ContributionListing {
}
return false;
}
boolean hasUpdates(Base base) {
for (ModeContribution m : base.getModeContribs())
if (hasUpdates(m))
return true;
for (Library l : base.getActiveEditor().getMode().contribLibraries)
if (hasUpdates(l))
return true;
for (ToolContribution t : base.getActiveEditor().contribTools)
if (hasUpdates(t))
return true;
return false;
}
boolean hasUpdates(Contribution contribution) {
@@ -393,6 +407,24 @@ public class ContributionListing {
}
String getLatestVersion(Contribution contribution) {
Contribution newestContrib = getAvailableContribution(contribution);
String latestVersion = newestContrib.getPrettyVersion();
if (latestVersion != null && !latestVersion.isEmpty()) {
if (latestVersion.toLowerCase().startsWith("build")) // For Python mode
return ("v" + latestVersion.substring(5, latestVersion.indexOf(','))
.trim());
else if (latestVersion.toLowerCase().startsWith("v")) // For ketai library
return latestVersion;
else
return ("v" + latestVersion);
}
else
return null;
}
boolean hasDownloadedLatestList() {
return hasDownloadedLatestList;
}
@@ -74,6 +74,10 @@ public class ContributionManagerDialog {
}
public boolean hasUpdates(Base base) {
return contribListing.hasUpdates(base);
}
public void showFrame(Editor editor) {
this.editor = editor;
@@ -106,7 +110,7 @@ public class ContributionManagerDialog {
status.setErrorMessage("Connection timed out while " +
"downloading the contribution list.");
} else {
status.setErrorMessage("Could not download the list" +
status.setErrorMessage("Could not download the list " +
"of available contributions.");
}
exception.printStackTrace();
@@ -121,6 +125,7 @@ public class ContributionManagerDialog {
* Close the window after an OK or Cancel.
*/
protected void disposeFrame() {
status.clear();
dialog.dispose();
editor = null;
}
@@ -163,6 +168,7 @@ public class ContributionManagerDialog {
category = null;
}
filterLibraries(category, filterField.filters);
contributionListPanel.updateColors();
}
});
@@ -420,6 +426,8 @@ public class ContributionManagerDialog {
filter = filter.replaceAll("[^\\x30-\\x39^\\x61-\\x7a^\\x3a]", " ");
filters = Arrays.asList(filter.split(" "));
filterLibraries(category, filters);
contributionListPanel.updateColors();
}
public String getFilterText() {
@@ -28,6 +28,8 @@ import java.net.MalformedURLException;
import java.net.URL;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.Date;
import java.text.DateFormat;
import javax.swing.*;
import javax.swing.border.EmptyBorder;
@@ -99,6 +101,7 @@ class ContributionPanel extends JPanel {
installActionListener = new ActionListener() {
public void actionPerformed(ActionEvent e) {
listPanel.contribManager.status.clear();
if (contrib instanceof AvailableContribution) {
installContribution((AvailableContribution) contrib);
contribListing.replaceContribution(contrib, contrib);
@@ -108,6 +111,7 @@ class ContributionPanel extends JPanel {
undoActionListener = new ActionListener() {
public void actionPerformed(ActionEvent e) {
listPanel.contribManager.status.clear();
if (contrib instanceof LocalContribution) {
LocalContribution installed = (LocalContribution) contrib;
installed.setDeletionFlag(false);
@@ -118,6 +122,7 @@ class ContributionPanel extends JPanel {
removeActionListener = new ActionListener() {
public void actionPerformed(ActionEvent arg) {
listPanel.contribManager.status.clear();
if (contrib.isInstalled() && contrib instanceof LocalContribution) {
updateButton.setEnabled(false);
installRemoveButton.setEnabled(false);
@@ -180,6 +185,9 @@ class ContributionPanel extends JPanel {
descriptionBlock.setContentType("text/html");
setTextStyle(descriptionBlock);
descriptionBlock.setOpaque(false);
if (UIManager.getLookAndFeel().getID().equals("Nimbus")) {
descriptionBlock.setBackground(new Color(0, 0, 0, 0));
}
// stripTextSelectionListeners(descriptionBlock);
descriptionBlock.setBorder(new EmptyBorder(4, 7, 7, 7));
@@ -209,6 +217,7 @@ class ContributionPanel extends JPanel {
updateButton.setVisible(false);
updateButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
listPanel.contribManager.status.clear();
updateButton.setEnabled(false);
AvailableContribution ad = contribListing.getAvailableContribution(contrib);
String url = ad.link;
@@ -359,6 +368,29 @@ class ContributionPanel extends JPanel {
}
description.append(sentence);
}
String version = contrib.getPrettyVersion();
if (version != null && !version.isEmpty()) {
description.append("<br/>");
if (version.toLowerCase().startsWith("build")) // For Python mode
description.append("v"
+ version.substring(5, version.indexOf(',')).trim());
else if (version.toLowerCase().startsWith("v")) // For ketai library
description.append(version);
else
description.append("v" + version);
}
long lastUpdatedUTC = contrib.getLastUpdated();
if (lastUpdatedUTC != 0) {
DateFormat dateFormatter = DateFormat.getDateInstance(DateFormat.MEDIUM);
Date lastUpdatedDate = new Date(lastUpdatedUTC);
if (version != null && !version.isEmpty())
description.append(", ");
description.append("Last Updated on " + dateFormatter.format(lastUpdatedDate));
}
description.append("</body></html>");
//descriptionText.setText(description.toString());
descriptionBlock.setText(description.toString());
@@ -371,7 +403,11 @@ class ContributionPanel extends JPanel {
// Already marked for deletion, see requiresRestart() notes below.
versionText.append("To finish an update, reinstall this contribution after restarting.");
} else {
versionText.append("New version available!");
String latestVersion = contribListing.getLatestVersion(contrib);
if (latestVersion != null)
versionText.append("New version (" + latestVersion + ") available!");
else
versionText.append("New version available!");
if (contrib.getType().requiresRestart()) {
// If a contribution can't be reinstalled in-place, the user may need
// to remove the current version, restart Processing, then install.
@@ -1,4 +1,4 @@
/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
/*
Part of the Processing project - http://processing.org
@@ -74,6 +74,15 @@ public abstract class LocalContribution extends Contribution {
System.err.println("Please contact the library author to fix it according to the guidelines.");
}
prettyVersion = properties.get("prettyVersion");
try {
lastUpdated = Long.parseLong(properties.get("lastUpdated"));
} catch (NumberFormatException e) {
lastUpdated = 0;
// Better comment these out till all contribs have a lastUpdated
// System.err.println("The last updated timestamp for the “" + name + "” library is not set properly.");
// System.err.println("Please contact the library author to fix it according to the guidelines.");
}
} else {
Base.log("No properties file at " + propertiesFile.getAbsolutePath());
@@ -45,6 +45,11 @@ class StatusPanel extends JLabel {
setText(message);
repaint();
}
void clear() {
setText("");
repaint();
}
}
@@ -23,6 +23,7 @@
package processing.app.platform;
import java.io.File;
import java.awt.Toolkit;
import processing.app.Base;
import processing.app.Platform;
@@ -47,6 +48,21 @@ public class LinuxPlatform extends Platform {
"placement. For more background, please read the wiki:\n" +
"http://wiki.processing.org/w/Supported_Platforms#Linux", null);
}
// Set x11 WM_CLASS property which is used as the application
// name by Gnome3 and other window managers.
// https://github.com/processing/processing/issues/2534
try {
Toolkit xToolkit = Toolkit.getDefaultToolkit();
java.lang.reflect.Field awtAppClassNameField =
xToolkit.getClass().getDeclaredField("awtAppClassName");
awtAppClassNameField.setAccessible(true);
awtAppClassNameField.set(xToolkit, "Processing");
} catch(Exception e) {
// In case the implementation details change
e.printStackTrace();
}
}
@@ -22,7 +22,6 @@
package processing.app.platform;
import java.awt.Dimension;
import java.awt.event.*;
import javax.swing.*;
@@ -30,7 +29,6 @@ import javax.swing.*;
import processing.app.About;
import processing.app.Base;
import processing.app.Toolkit;
import processing.core.PApplet;
import com.apple.eawt.*;
@@ -84,27 +82,27 @@ public class ThinkDifferent implements ApplicationListener {
// This is kind of a gross way to do this, but the alternatives? Hrm.
Base.defaultFileMenu = fileMenu;
if (PApplet.javaVersion <= 1.6f) { // doesn't work on Oracle's Java
try {
application.setDefaultMenuBar(defaultMenuBar);
} catch (Exception e) {
e.printStackTrace(); // oh well nevermind
}
} else {
// The douchebags at Oracle didn't feel that a working f*king menubar
// on OS X was important enough to make it into the 7u40 release.
//http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=8007267
// It languished in the JDK 8 source and has been backported for 7u60:
//http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=8022667
JFrame offscreen = new JFrame();
offscreen.setUndecorated(true);
offscreen.setJMenuBar(defaultMenuBar);
Dimension screen = Toolkit.getScreenSize();
offscreen.setLocation(screen.width, screen.height);
offscreen.setVisible(true);
// if (PApplet.javaVersion <= 1.6f) { // doesn't work on Oracle's Java
try {
application.setDefaultMenuBar(defaultMenuBar);
} catch (Exception e) {
e.printStackTrace(); // oh well, never mind
}
// } else {
// // The douchebags at Oracle didn't feel that a working f*king menubar
// // on OS X was important enough to make it into the 7u40 release.
// //http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=8007267
// // It languished in the JDK 8 source and has been backported for 7u60:
// //http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=8022667
//
// JFrame offscreen = new JFrame();
// offscreen.setUndecorated(true);
// offscreen.setJMenuBar(defaultMenuBar);
// Dimension screen = Toolkit.getScreenSize();
// offscreen.setLocation(screen.width, screen.height);
// offscreen.setVisible(true);
// }
}
@@ -103,7 +103,7 @@ public class JEditTextArea extends JComponent
}
// Initialize some misc. stuff
painter = new TextAreaPainter(this, defaults);
painter = createPainter(defaults);
documentHandler = new DocumentHandler();
eventListenerList = new EventListenerList();
caretEvent = new MutableCaretEvent();
@@ -176,6 +176,16 @@ public class JEditTextArea extends JComponent
}
/**
* Override this to provide your own painter for this {@link JEditTextArea}.
* @param defaults
* @return a newly constructed {@link TextAreaPainter}.
*/
protected TextAreaPainter createPainter(final TextAreaDefaults defaults) {
return new TextAreaPainter(this, defaults);
}
/**
* Inline Input Method Support for Japanese.
*/
+38 -34
View File
@@ -422,7 +422,7 @@ public class JavaBuild {
String entry = (dot == -1) ? item : item.substring(0, dot);
// System.out.print(entry + " => ");
if (item.startsWith("static ")) {
if (item.startsWith("static ")) {
// import static - https://github.com/processing/processing/issues/8
// Remove more stuff.
int dot2 = item.lastIndexOf('.');
@@ -472,8 +472,8 @@ public class JavaBuild {
javaClassPath = javaClassPath.substring(1, javaClassPath.length() - 1);
}
classPath += File.pathSeparator + javaClassPath;
// But make sure that there isn't anything in there that's missing,
// But make sure that there isn't anything in there that's missing,
// otherwise ECJ will complain and die. For instance, Java 1.7 (or maybe
// it's appbundler?) adds Java/Classes to the path, which kills us.
//String[] classPieces = PApplet.split(classPath, File.pathSeparator);
@@ -549,7 +549,7 @@ public class JavaBuild {
if (pkg.startsWith("processing.data.")) return true;
if (pkg.startsWith("processing.event.")) return true;
if (pkg.startsWith("processing.opengl.")) return true;
// if (pkg.startsWith("com.jogamp.")) return true;
// // ignore core, data, and opengl packages
@@ -1113,11 +1113,11 @@ public class JavaBuild {
File folder = null;
for (String platformName : PConstants.platformNames) {
int platform = Base.getPlatformIndex(platformName);
// Can only embed Java on the native platform
boolean embedJava = (platform == PApplet.platform) &&
boolean embedJava = (platform == PApplet.platform) &&
Preferences.getBoolean("export.application.embed_java");
if (Preferences.getBoolean("export.application.platform." + platformName)) {
if (Library.hasMultipleArch(platform, importedLibraries)) {
// export the 32-bit version
@@ -1216,41 +1216,41 @@ public class JavaBuild {
File jdkFolder = new File(Base.getJavaHome(), "../../..");
String jdkFolderName = jdkFolder.getCanonicalFile().getName();
jvmRuntime = "<key>JVMRuntime</key>\n <string>" + jdkFolderName + "</string>";
jdkPath = new File(dotAppFolder, "Contents/PlugIns/" + jdkFolderName + ".jdk").getAbsolutePath();
jdkPath = new File(dotAppFolder, "Contents/PlugIns/" + jdkFolderName).getAbsolutePath();
}
File contentsFolder = new File(dotAppFolder, "Contents");
contentsFolder.mkdirs();
// Info.plist will be written later
// set the jar folder to a different location than windows/linux
//jarFolder = new File(dotAppFolder, "Contents/Resources/Java");
jarFolder = new File(contentsFolder, "Java");
File macosFolder = new File(contentsFolder, "MacOS");
macosFolder.mkdirs();
Base.copyFile(new File(contentsOrig, "MacOS/Processing"),
Base.copyFile(new File(contentsOrig, "MacOS/Processing"),
new File(contentsFolder, "MacOS/" + sketch.getName()));
File pkgInfo = new File(contentsFolder, "PkgInfo");
PrintWriter writer = PApplet.createWriter(pkgInfo);
writer.println("APPL????");
writer.flush();
writer.close();
// Use faster(?) native copy here (also to do sym links)
if (embedJava) {
Base.copyDirNative(new File(contentsOrig, "PlugIns"),
new File(contentsFolder, "PlugIns"));
}
File resourcesFolder = new File(contentsFolder, "Resources");
Base.copyDir(new File(contentsOrig, "Resources/en.lproj"),
Base.copyDir(new File(contentsOrig, "Resources/en.lproj"),
new File(resourcesFolder, "en.lproj"));
Base.copyFile(mode.getContentFile("application/sketch.icns"),
new File(resourcesFolder, "sketch.icns"));
/*
String stubName = "Contents/MacOS/JavaApplicationStub";
// need to set the stub to executable
@@ -1279,7 +1279,7 @@ public class JavaBuild {
if (embedJava) {
Base.copyDirNative(Base.getJavaHome(), new File(destFolder, "java"));
}
} else if (exportPlatform == PConstants.WINDOWS) {
if (embedJava) {
Base.copyDir(Base.getJavaHome(), new File(destFolder, "java"));
@@ -1312,7 +1312,7 @@ public class JavaBuild {
}
*/
/// start copying all jar files
Vector<String> jarListVector = new Vector<String>();
@@ -1446,7 +1446,11 @@ public class JavaBuild {
}
// https://github.com/processing/processing/issues/2239
runOptions.add("-Djna.nosys=true");
// https://github.com/processing/processing/issues/2559
if (exportPlatform == PConstants.WINDOWS) {
runOptions.add("-Djava.library.path=\"%EXEDIR%\\lib\"");
}
/// macosx: write out Info.plist (template for classpath, etc)
@@ -1457,7 +1461,7 @@ public class JavaBuild {
runOptionsXML.append(opt);
runOptionsXML.append("</string>");
runOptionsXML.append('\n');
}
}
String PLIST_TEMPLATE = "Info.plist.tmpl";
File plistTemplate = new File(sketch.getFolder(), PLIST_TEMPLATE);
@@ -1500,10 +1504,10 @@ public class JavaBuild {
// attempt to code sign if the Xcode tools appear to be installed
if (Base.isMacOS() && new File("/usr/bin/codesign_allocate").exists()) {
if (embedJava) {
ProcessHelper.ffs("codesign", "--force", "--sign", "-", jdkPath);
ProcessHelper.ffs("codesign", "--force", "--sign", "-", jdkPath);
}
String appPath = dotAppFolder.getAbsolutePath();
ProcessHelper.ffs("codesign", "--force", "--sign", "-", appPath);
ProcessHelper.ffs("codesign", "--force", "--sign", "-", appPath);
}
} else if (exportPlatform == PConstants.WINDOWS) {
@@ -1513,27 +1517,27 @@ public class JavaBuild {
XML project = new XML("project");
XML target = project.addChild("target");
target.setString("name", "windows");
XML taskdef = target.addChild("taskdef");
taskdef.setString("name", "launch4j");
taskdef.setString("classname", "net.sf.launch4j.ant.Launch4jTask");
String launchPath = mode.getContentFile("application/launch4j").getAbsolutePath();
taskdef.setString("classpath", launchPath + "/launch4j.jar:" + launchPath + "/lib/xstream.jar");
XML launch4j = target.addChild("launch4j");
// not all launch4j options are available when embedded inside the ant
// build file (i.e. the icon param doesn't work), so use a config file
//<launch4j configFile="windows/work/config.xml" />
launch4j.setString("configFile", configFile.getAbsolutePath());
XML config = new XML("launch4jConfig");
config.addChild("headerType").setContent("gui");
config.addChild("dontWrapJar").setContent("true");
config.addChild("downloadUrl").setContent("http://java.com/download");
File exeFile = new File(destFolder, sketch.getName() + ".exe");
config.addChild("outfile").setContent(exeFile.getAbsolutePath());
File iconFile = mode.getContentFile("application/sketch.ico");
config.addChild("icon").setContent(iconFile.getAbsolutePath());
@@ -1550,7 +1554,7 @@ public class JavaBuild {
for (String opt : runOptions) {
jre.addChild("opt").setContent(opt);
}
/*
XML config = launch4j.addChild("config");
config.setString("headerType", "gui");
@@ -1558,10 +1562,10 @@ public class JavaBuild {
config.setString("outfile", exeFile.getAbsolutePath());
config.setString("dontWrapJar", "true");
config.setString("jarPath", "lib\\" + jarList[0]);
File iconFile = mode.getContentFile("application/sketch.ico");
config.addChild("icon").setContent(iconFile.getAbsolutePath());
XML clazzPath = config.addChild("classPath");
clazzPath.setString("mainClass", sketch.getName());
for (int i = 1; i < jarList.length; i++) {
@@ -1575,11 +1579,11 @@ public class JavaBuild {
jre.addChild("opt").setContent(opt);
}
*/
config.save(configFile);
project.save(buildFile);
if (!buildWindowsLauncher(buildFile, "windows")) {
// don't delete the build file, might be useful for debugging
// don't delete the build file, might be useful for debugging
return false;
}
configFile.delete();
@@ -1597,10 +1601,10 @@ public class JavaBuild {
// another fix for bug #234, LD_LIBRARY_PATH ignored on some platforms
//ps.print("LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$APPDIR\n");
if (embedJava) {
// https://github.com/processing/processing/issues/2349
// https://github.com/processing/processing/issues/2349
pw.print("$APPDIR/java/bin/");
}
String runOptionsStr =
String runOptionsStr =
PApplet.join(runOptions.toArray(new String[0]), " ");
pw.print("java " + runOptionsStr +
" -Djava.library.path=\"$APPDIR:$APPDIR/lib\"" +
@@ -1646,7 +1650,7 @@ public class JavaBuild {
}
/**
/**
* Run the launch4j build.xml file through ant to create the exe.
* Most of this code was lifted from Android mode.
*/
@@ -289,6 +289,11 @@ public class JavaEditor extends Editor {
}
});
// Only possible to export OS X applications on OS X
if (!Base.isMacOS()) {
// Make sure they don't have a previous 'true' setting for this
Preferences.setBoolean("export.application.platform.macosx", false);
}
final JCheckBox macosxButton = new JCheckBox("Mac OS X");
macosxButton.setSelected(Preferences.getBoolean("export.application.platform.macosx"));
macosxButton.addItemListener(new ItemListener() {
@@ -296,6 +301,10 @@ public class JavaEditor extends Editor {
Preferences.setBoolean("export.application.platform.macosx", macosxButton.isSelected());
}
});
if (!Base.isMacOS()) {
macosxButton.setEnabled(false);
macosxButton.setToolTipText("Mac OS X export is only available on Mac OS X");
}
final JCheckBox linuxButton = new JCheckBox("Linux");
//linuxButton.setMnemonic(KeyEvent.VK_L);
+1 -1
View File
@@ -46,7 +46,7 @@ public class JavaMode extends Mode {
public String getTitle() {
return "Java";
return "Java (2.0)";
}
@@ -194,6 +194,9 @@ public class PdeKeyListener {
textarea.setSelectedText(spaces(tabSize));
event.consume();
return true;
} else if (!Preferences.getBoolean("editor.tabs.expand")) {
textarea.setSelectedText("\t");
event.consume();
}
break;
@@ -63,19 +63,6 @@ public class Runner implements MessageConsumer {
// Thread transferring remote output stream to our output stream
protected Thread outThread = null;
// Mode for tracing the Trace program (default= 0 off)
// protected int debugTraceMode = 0;
// Do we want to watch assignments to fields
// protected boolean watchFields = false;
// // Class patterns for which we don't want events
// protected String[] excludes = {
// "java.*", "javax.*", "sun.*", "com.sun.*",
// "apple.*",
// "processing.*"
// };
protected SketchException exception;
protected Editor editor;
protected JavaBuild build;
@@ -138,60 +125,6 @@ public class Runner implements MessageConsumer {
// Everyone works the same under Java 7 (also on OS X)
String[] commandArgs = new String[] { Base.getJavaPath(), jdwpArg };
/*
String[] commandArgs = null;
if (!Base.isMacOS()) {
commandArgs = new String[] {
Base.getJavaPath(),
jdwpArg
};
} else {
// Decided to just set this to 1.6 only, because otherwise it's gonna
// be a shitshow if folks are getting Apple's 1.6 with 32-bit and
// Oracle's 1.7 when run in 64-bit mode. ("Why does my sketch suck in
// 64-bit? Why is retina broken?)
// The --request flag will prompt to install Apple's 1.6 JVM if none is
// available. We're specifying 1.6 so that we can get support for both
// 32- and 64-bit, because Oracle won't be releasing Java 1.7 in 32-bit.
// Helpfully, the --request flag is not present on Mac OS X 10.6
// (luckily it is also not needed, because 1.6 is installed by default)
// but it requires an additional workaround to not use that flag,
// otherwise will see an error about an unsupported option. The flag is
// available with 10.7 and 10.8, the only other supported versions of
// OS X at this point, because we require 10.6.8 and higher. That also
// means we don't need to check for any other OS versions, the user is
// a douchebag and modifies Info.plist to get around the restriction.
if (false) {
if (System.getProperty("os.version").startsWith("10.6")) {
commandArgs = new String[] {
"/usr/libexec/java_home",
"--version", "1.6",
"--exec", "java",
"-d" + Base.getNativeBits(),
jdwpArg
};
} else { // for 10.7, 10.8, etc
commandArgs = new String[] {
"/usr/libexec/java_home",
"--request", // install on-demand
"--version", "1.6",
"--exec", "java",
"-d" + Base.getNativeBits(),
// debugArg,
jdwpArg
};
}
} else {
// testing jdk-7u40
commandArgs = new String[] {
//"/Library/Java/JavaVirtualMachines/jdk1.7.0_40.jdk/Contents/Home/bin/java",
Base.getJavaPath(),
jdwpArg
};
}
}
*/
commandArgs = PApplet.concat(commandArgs, vmParams);
commandArgs = PApplet.concat(commandArgs, sketchParams);
// PApplet.println(commandArgs);
@@ -482,153 +415,6 @@ public class Runner implements MessageConsumer {
}
/*
protected VirtualMachine launchVirtualMachine(String[] vmParams,
String[] classParams) {
//vm = launchTarget(sb.toString());
LaunchingConnector connector = (LaunchingConnector)
findConnector("com.sun.jdi.RawCommandLineLaunch");
//PApplet.println(connector); // gets the defaults
//Map arguments = connectorArguments(connector, mainArgs);
Map arguments = connector.defaultArguments();
Connector.Argument commandArg =
(Connector.Argument)arguments.get("command");
// Using localhost instead of 127.0.0.1 sometimes causes a
// "Transport Error 202" error message when trying to run.
// http://dev.processing.org/bugs/show_bug.cgi?id=895
// String addr = "127.0.0.1:" + (8000 + (int) (Math.random() * 1000));
//String addr = "localhost:" + (8000 + (int) (Math.random() * 1000));
// Better yet, host is not needed, so using just the port for the address
String addr = "" + (8000 + (int) (Math.random() * 1000));
String commandArgs =
"java -Xrunjdwp:transport=dt_socket,address=" + addr + ",suspend=y ";
if (Base.isMacOS()) {
// Decided to just set this to 1.6 only, because otherwise it's gonna
// be a shitshow if folks are getting Apple's 1.6 with 32-bit and
// Oracle's 1.7 when run in 64-bit mode. ("Why does my sketch suck in
// 64-bit? Why is retina broken?)
// The --request flag will prompt to install Apple's 1.6 JVM if none is
// available. We're specifying 1.6 so that we can get support for both
// 32- and 64-bit, because Oracle won't be releasing Java 1.7 in 32-bit.
// Helpfully, the --request flag is not present on Mac OS X 10.6
// (luckily it is also not needed, because 1.6 is installed by default)
// but it requires an additional workaround to not use that flag,
// otherwise will see an error about an unsupported option. The flag is
// available with 10.7 and 10.8, the only other supported versions of
// OS X at this point, because we require 10.6.8 and higher. That also
// means we don't need to check for any other OS versions, unless
// is a douchebag and modifies Info.plist to get around the restriction.
addr = "" + (8000 + (int) (Math.random() * 1000));
commandArgs =
"/usr/libexec/java_home " +
(System.getProperty("os.version").startsWith("10.6") ? "" : "--request ") +
"--version 1.6 " +
"--exec java " +
"-d" + Base.getNativeBits() + " " +
"-Xrunjdwp:transport=dt_socket,address=" + addr + ",suspend=y ";
}
for (int i = 0; i < vmParams.length; i++) {
commandArgs = addArgument(commandArgs, vmParams[i], ' ');
}
if (classParams != null) {
for (int i = 0; i < classParams.length; i++) {
commandArgs = addArgument(commandArgs, classParams[i], ' ');
}
}
System.out.println("commandArgs is " + commandArgs);
commandArg.setValue(commandArgs);
Connector.Argument addressArg =
(Connector.Argument)arguments.get("address");
addressArg.setValue(addr);
//PApplet.println(connector); // prints the current
//com.sun.tools.jdi.AbstractLauncher al;
//com.sun.tools.jdi.RawCommandLineLauncher rcll;
//System.out.println(PApplet.javaVersion);
// http://java.sun.com/j2se/1.5.0/docs/guide/jpda/conninv.html#sunlaunch
try {
return connector.launch(arguments);
} catch (IOException exc) {
throw new Error("Unable to launch target VM: " + exc);
} catch (IllegalConnectorArgumentsException exc) {
throw new Error("Internal error: " + exc);
} catch (VMStartException exc) {
Process p = exc.process();
//System.out.println(p);
String[] errorStrings = PApplet.loadStrings(p.getErrorStream());
//String[] inputStrings =
PApplet.loadStrings(p.getInputStream());
if (errorStrings != null && errorStrings.length > 1) {
if (errorStrings[0].indexOf("Invalid maximum heap size") != -1) {
Base.showWarning("Way Too High",
"Please lower the value for \u201Cmaximum available memory\u201D in the\n" +
"Preferences window. For more information, read Help \u2192 Troubleshooting.",
exc);
} else {
PApplet.println(errorStrings);
System.err.println("Using startup command:");
PApplet.println(arguments);
}
} else {
exc.printStackTrace();
System.err.println("Could not run the sketch (Target VM failed to initialize).");
if (Preferences.getBoolean("run.options.memory")) {
// Only mention this if they've even altered the memory setup
System.err.println("Make sure that you haven't set the maximum available memory too high.");
}
System.err.println("For more information, read revisions.txt and Help \u2192 Troubleshooting.");
}
// changing this to separate editor and listener [091124]
//if (editor != null) {
listener.statusError("Could not run the sketch.");
//}
return null;
}
}
private static boolean hasWhitespace(String string) {
int length = string.length();
for (int i = 0; i < length; i++) {
if (Character.isWhitespace(string.charAt(i))) {
return true;
}
}
return false;
}
private static String addArgument(String string, String argument, char sep) {
if (hasWhitespace(argument) || argument.indexOf(',') != -1) {
// Quotes were stripped out for this argument, add 'em back.
StringBuffer buffer = new StringBuffer(string);
buffer.append('"');
for (int i = 0; i < argument.length(); i++) {
char c = argument.charAt(i);
if (c == '"') {
buffer.append('\\');
// buffer.append("\\\\");
}
buffer.append(c);
}
buffer.append('"');
buffer.append(sep);
return buffer.toString();
} else {
return string + argument + String.valueOf(sep);
}
}
*/
/**
* Generate the trace.
* Enable events, start thread to display events,
@@ -639,9 +425,6 @@ public class Runner implements MessageConsumer {
//vm.setDebugTraceMode(debugTraceMode);
// vm.setDebugTraceMode(VirtualMachine.TRACE_ALL);
// vm.setDebugTraceMode(VirtualMachine.TRACE_NONE); // formerly, seems to have no effect
// For internal debugging
PrintWriter writer = null;
// Calling this seems to set something internally to make the
// Eclipse JDI wake up. Without it, an ObjectCollectedException
@@ -735,7 +518,6 @@ public class Runner implements MessageConsumer {
// we don't interrupt
}
//System.out.println("and leaving");
if (writer != null) writer.close();
}
+157 -160
View File
@@ -14,7 +14,7 @@
<and>
<os family="unix" />
<not>
<os family="mac" />
<os family="mac" />
</not>
</and>
</condition>
@@ -31,6 +31,9 @@
</condition>
</fail>
<property name="examples.dir"
value="../../processing-docs/content/examples" />
<!-- Figure out the JRE download location for Linux and Windows. -->
<condition property="jre.file" value="jre-7u40-${platform}-i586.tgz">
<equals arg1="${sun.arch.data.model}" arg2="32" />
@@ -151,21 +154,21 @@
</condition>
<!-- Set the version of Java that must be present to build. -->
<property name="jdk.update.macosx" value="55" />
<property name="jdk.update.macosx" value="65" />
<property name="jdk.path.macosx" value="/Library/Java/JavaVirtualMachines/jdk1.7.0_${jdk.update.macosx}.jdk" />
<available file="${jdk.path.macosx}" property="macosx_jdk_found" />
<fail if="macosx" unless="macosx_jdk_found"
message="JDK 7u${jdk.update.macosx} required.${line.separator}To build on OS X, you must install Oracle's JDK 7u${jdk.update.macosx} from${line.separator}http://www.oracle.com/technetwork/java/javase/downloads${line.separator}Note that only 7u${jdk.update.macosx} (not a later or earlier version) will work. ${line.separator}And it must be the JDK, not the JRE. And do not try to defy me again." />
message="JDK 7u${jdk.update.macosx} required.${line.separator}To build on OS X, you must install Oracle's JDK 7u${jdk.update.macosx} from${line.separator}http://www.oracle.com/technetwork/java/javase/downloads${line.separator}Note that only 7u${jdk.update.macosx} (not a later or earlier version) will work. ${line.separator}And it must be the JDK, not the JRE. And do not try to defy me again." />
<!--
<fail if="linux" unless="java_tools_found"
message="The JAVA_HOME variable must be set to the location of a full JDK. For instance, on Ubuntu Linux, this might be /usr/lib/jvm/java-6-sun." />
message="The JAVA_HOME variable must be set to the location of a full JDK. For instance, on Ubuntu Linux, this might be /usr/lib/jvm/java-6-sun." />
-->
<!-- Figure out the platform-specific output directory for all this work. -->
<condition property="target.path"
value="macosx/work/Processing.app/Contents/Java">
value="macosx/work/Processing.app/Contents/Java">
<os family="mac" />
</condition>
@@ -201,10 +204,14 @@
</target>
<target name="dist" depends="revision-check"
description="Build Processing for distribution.">
description="Build Processing for distribution.">
<input message="Enter version number:"
addproperty="version"
defaultvalue="${revision}" />
addproperty="version"
defaultvalue="${revision}" />
<available file="${examples.dir}" property="examples.exist" />
<fail unless="examples.exist" message="To do a distribution, the processing-docs repo must be checked out at the same level as the processing repo." />
<antcall target="${platform}-dist" />
</target>
@@ -226,8 +233,12 @@
<subant buildpath="../java/libraries/net" target="clean"/>
<subant buildpath="../java/libraries/pdf" target="clean"/>
<subant buildpath="../java/libraries/serial" target="clean"/>
<subant buildpath="../java/libraries/video" target="clean"/>
<subant buildpath="../java/libraries/sound" target="clean"/>
<subant buildpath="shared/tools/MovieMaker" target="clean"/>
<subant buildpath="../pdex" target="clean"/>
<!-- make sure this isn't around from an old build 140730 -->
<delete dir="../java/examples" />
</target>
<target name="subprojects-build">
@@ -237,8 +248,9 @@
<subant buildpath="../java/libraries/net" target="build"/>
<subant buildpath="../java/libraries/pdf" target="build"/>
<subant buildpath="../java/libraries/serial" target="build"/>
<subant buildpath="../java/libraries/video" target="build"/>
<subant buildpath="../java/libraries/sound" target="build"/>
<subant buildpath="shared/tools/MovieMaker" target="build"/>
<subant buildpath="../pdex" target="package"/>
</target>
@@ -248,7 +260,7 @@
<target name="assemble" depends="version-clear, version-write">
<fail unless="target.path"
message="Do not call assemble from the command line." />
message="Do not call assemble from the command line." />
<!-- copy shared tools folder -->
<copy todir="${target.path}/tools">
@@ -257,34 +269,33 @@
<copy todir="${target.path}/modes/java">
<fileset dir="../java">
<!-- don't include LWJGL, it's not operational -->
<exclude name="libraries/lwjgl/**" />
<!--
<exclude name="**/bin/*" />
<exclude name="**/src/*" />
<exclude name="examples" />
<exclude name="**/cmd/**" />
-->
<exclude name="reference.zip" />
<exclude name="**/._*" />
<!-- don't include LWJGL, it's not operational -->
<exclude name="libraries/lwjgl/**" />
<!-- probably not necessary anymore -->
<exclude name="examples/**/applet/**" />
<exclude name="reference.zip" />
<exclude name="**/._*" />
</fileset>
</copy>
<delete dir="${target.path}/modes/java/examples">
<include name="**/applet/**" />
</delete>
<!-- get the examples folder -->
<copy todir="${target.path}/modes/java/examples">
<fileset dir="${examples.dir}" />
</copy>
<unzip dest="${target.path}/modes/java"
src="../java/reference.zip"
overwrite="false">
src="../java/reference.zip"
overwrite="false">
<patternset>
<exclude name="__MACOSX/**" />
<exclude name="**/._*" />
<exclude name="__MACOSX/**" />
<exclude name="**/._*" />
</patternset>
</unzip>
</unzip>
<!-- copy PDE X mode folder-->
<copy todir="${target.path}/modes/">
<fileset dir="../pdex/dist" />
</copy>
</target>
<target name="version-clear">
@@ -303,39 +314,39 @@
<!-- figure out the revision number -->
<loadfile srcfile="../todo.txt" property="revision">
<filterchain>
<headfilter lines="1"/>
<tokenfilter>
<stringtokenizer suppressdelims="true"/>
<!-- grab the thing from the first line that's 4 digits -->
<containsregex pattern="(\d\d\d\d)" />
</tokenfilter>
<headfilter lines="1"/>
<tokenfilter>
<stringtokenizer suppressdelims="true"/>
<!-- grab the thing from the first line that's 4 digits -->
<containsregex pattern="(\d\d\d\d)" />
</tokenfilter>
</filterchain>
</loadfile>
<!-- <echo message="revision is ${revision}." /> -->
<!-- figure out the revision number in base.java -->
<loadfile srcfile="../app/src/processing/app/Base.java"
property="revision.base">
property="revision.base">
<filterchain>
<tokenfilter>
<linetokenizer />
<containsregex pattern="String VERSION_NAME = "/>
<replaceregex pattern="[^0-9]*" flags="g" replace=""/>
</tokenfilter>
<tokenfilter>
<linetokenizer />
<containsregex pattern="String VERSION_NAME = "/>
<replaceregex pattern="[^0-9]*" flags="g" replace=""/>
</tokenfilter>
</filterchain>
</loadfile>
<!-- <echo message="base revision is ${revision.base}." /> -->
<condition property="revision.correct">
<!-- Using contains because I can't figure out how to get rid of the
LF in revision.base. Please file a bug if you have a fix. -->
LF in revision.base. Please file a bug if you have a fix. -->
<contains string="${revision.base}" substring="${revision}"/>
</condition>
<!-- the revision.base property won't be set
if $revision wasn't found... -->
if $revision wasn't found... -->
<fail unless="revision.correct"
message="Fix revision number in Base.java" />
message="Fix revision number in Base.java" />
</target>
@@ -369,25 +380,25 @@
<!--icon="macosx/processing.icns"-->
<bundleapp outputDirectory="macosx/work"
name="Processing"
displayName="Processing"
executableName="Processing"
identifier="org.processing.app"
signature="Pde2"
icon="macosx/processing.icns"
copyright="© The Processing Foundation"
getInfo="${version}, Copyright © The Processing Foundation"
shortVersion="${version}"
version="${revision}"
mainClassName="processing.app.Base">
name="Processing"
displayName="Processing"
executableName="Processing"
identifier="org.processing.app"
signature="Pde2"
icon="macosx/processing.icns"
copyright="© The Processing Foundation"
getInfo="${version}, Copyright © The Processing Foundation"
shortVersion="${version}"
version="${revision}"
mainClassName="processing.app.Base">
<!-- The appbundler task needs a couple files (the Info.plist and
anything else outside /jre) from the full JDK, even though
it's primarily copying over the JRE folder. -->
it's primarily copying over the JRE folder. -->
<runtime dir="${jdk.path.macosx}/Contents/Home" />
<!-- Eventually we'll want to load the JRE directly from
the .tgz on the Oracle site, though it's in a folder called
jre1.7.0_40.jre, so we'll need to strip that out. -->
the .tgz on the Oracle site, though it's in a folder called
jre1.7.0_40.jre, so we'll need to strip that out. -->
<!-- Same as runtime.jars, seen above; plus core.jar. -->
<classpath file="../app/pde.jar" />
@@ -411,9 +422,9 @@
<!--icon="macosx/template.app/Contents/Resources/pde.icns"-->
<!--icon="${bundle.icon}"-->
<bundledocument extensions="pde"
icon="macosx/pde.icns"
name="Processing Source Code"
role="Editor">
icon="macosx/pde.icns"
name="Processing Source Code"
role="Editor">
</bundledocument>
<!-- Sets dock icon when debugging (not launched via launch svcs) -->
@@ -425,8 +436,9 @@
<!-- Probably no longer needed? [fry 130917]
<option value="-Xms128M" />
<option value="-Xmx256M" />
-->
<!-- returning 140606 per PDE X request -->
<option value="-Xmx256M" />
<option value="-Dapple.awt.application.name=Processing" />
@@ -442,27 +454,27 @@
the old options; most of these are probably no longer useful
<key>apple.laf.useScreenMenuBar</key>
<string>true</string>
<key>apple.awt.showGrowBox</key>
<string>true</string>
<key>com.apple.smallTabs</key>
<string>true</string>
<key>apple.awt.Antialiasing</key>
<string>false</string>
<key>apple.awt.TextAntialiasing</key>
<string>true</string>
<key>com.apple.hwaccel</key>
<string>true</string>
<key>apple.awt.use-file-dialog-packages</key>
<string>false</string>
<key>apple.awt.graphics.UseQuartz</key>
<string>true</string>
<key>apple.awt.showGrowBox</key>
<string>true</string>
<key>com.apple.smallTabs</key>
<string>true</string>
<key>apple.awt.Antialiasing</key>
<string>false</string>
<key>apple.awt.TextAntialiasing</key>
<string>true</string>
<key>com.apple.hwaccel</key>
<string>true</string>
<key>apple.awt.use-file-dialog-packages</key>
<string>false</string>
<key>apple.awt.graphics.UseQuartz</key>
<string>true</string>
-->
</bundleapp>
<copy todir="macosx/work/Processing.app/Contents/Java">
<fileset dir=".." includes="core/library/**" /> <!-- why this? -->
<!--<fileset dir="shared" includes="launch4j/**" />-->
<fileset dir="shared" includes="lib/**" />
<fileset dir="shared" includes="lib/**" excludes="lib/fonts/**" />
<fileset file="shared/revisions.txt" />
</copy>
@@ -475,33 +487,30 @@
<antcall target="assemble">
<param name="target.path"
value="macosx/work/Processing.app/Contents/Java" />
value="macosx/work/Processing.app/Contents/Java" />
</antcall>
<property name="launch4j.dir" value="macosx/work/Processing.app/Contents/Java/modes/java/application/launch4j" />
<!-- rename the version we need -->
<move file="${launch4j.dir}/bin/windres-macosx"
tofile="${launch4j.dir}/bin/windres" />
tofile="${launch4j.dir}/bin/windres" />
<move file="${launch4j.dir}/bin/ld-macosx"
tofile="${launch4j.dir}/bin/ld" />
tofile="${launch4j.dir}/bin/ld" />
<!-- make executable (ant doesn't preserve) -->
<chmod perm="ugo+x" file="${launch4j.dir}/bin/windres" />
<chmod perm="ugo+x" file="${launch4j.dir}/bin/ld" />
<!-- remove the others -->
<delete>
<delete failonerror="true">
<fileset dir="${launch4j.dir}/bin" includes="ld-*" />
<fileset dir="${launch4j.dir}/bin" includes="windres-*" />
</delete>
<delete dir="${target.path}/modes/java/libraries/video/library/windows32" />
<delete dir="${target.path}/modes/java/libraries/video/library/windows64" />
</target>
<target name="macosx-run" depends="macosx-build"
description="Run Mac OS X version">
description="Run Mac OS X version">
<exec executable="open" dir="macosx/work" spawn="true">
<arg value="-a" />
<arg value="/Applications/Utilities/Terminal.app" />
@@ -537,8 +546,8 @@
</target>
<target name="macosx-dist" if="macosx"
depends="macosx-build"
description="Create a downloadable .zip for the Mac OS X version">
depends="macosx-build"
description="Create a downloadable .zip for the Mac OS X version">
<!-- The ant copy command does not preserve permissions. -->
<chmod file="macosx/work/Processing.app/Contents/MacOS/JavaApplicationStub" perm="ugo+x" />
@@ -546,9 +555,9 @@
<!-- Now handled by the app bundler -->
<!--
<replace file="macosx/work/Processing.app/Contents/Info.plist"
token="VERSION" value="${version}" />
token="VERSION" value="${version}" />
<replace file="macosx/work/Processing.app/Contents/Info.plist"
token="REVISION" value="${revision}" />
token="REVISION" value="${revision}" />
-->
<antcall target="macosx-dist-sign" />
@@ -593,7 +602,7 @@
<copy todir="linux/work">
<fileset dir=".." includes="core/library/**" />
<fileset dir="shared" includes="launch4j/**" />
<fileset dir="shared" includes="lib/**" />
<fileset dir="shared" includes="lib/**" excludes="lib/fonts/**" />
<fileset dir="shared" includes="modes/**" />
<fileset file="shared/revisions.txt" />
</copy>
@@ -606,16 +615,16 @@
<!-- rename the version we need -->
<move file="${launch4j.dir}/bin/windres-linux"
tofile="${launch4j.dir}/bin/windres" />
tofile="${launch4j.dir}/bin/windres" />
<move file="${launch4j.dir}/bin/ld-linux"
tofile="${launch4j.dir}/bin/ld" />
tofile="${launch4j.dir}/bin/ld" />
<!-- make executable (ant doesn't preserve) -->
<chmod perm="ugo+x" file="${launch4j.dir}/bin/windres" />
<chmod perm="ugo+x" file="${launch4j.dir}/bin/ld" />
<!-- remove the others -->
<delete>
<delete failonerror="true">
<fileset dir="${launch4j.dir}/bin" includes="ld-*" />
<fileset dir="${launch4j.dir}/bin" includes="windres-*" />
</delete>
@@ -623,10 +632,6 @@
<copy todir="linux/work/lib" flatten="true">
<fileset refid="runtime.jars" />
</copy>
<delete dir="${target.path}/modes/java/libraries/video/library/macosx64" />
<delete dir="${target.path}/modes/java/libraries/video/library/windows32" />
<delete dir="${target.path}/modes/java/libraries/video/library/windows64" />
<copy file="linux/processing" todir="linux/work" />
<chmod perm="ugo+x" file="linux/work/processing" />
@@ -637,19 +642,19 @@
<!--
<property name="jre.file"
value="jre-tools-6u37-linux${sun.arch.data.model}.tgz" />
value="jre-tools-6u37-linux${sun.arch.data.model}.tgz" />
-->
<get src="http://processing.googlecode.com/files/${jre.file}"
dest="linux/jre.tgz"
usetimestamp="true" />
dest="linux/jre.tgz"
usetimestamp="true" />
<!--
<!--
Cannot use ant version of tar because it doesn't preserve properties.
<untar compression="gzip"
dest="linux/work"
src="linux/jre.tgz"
overwrite="false"/>
dest="linux/work"
src="linux/jre.tgz"
overwrite="false"/>
-->
<!--
@@ -679,7 +684,7 @@
<delete dir="linux/jre1.7.0_40" />
<!-- Remove unused JRE bloat. -->
<delete>
<delete failonerror="true">
<fileset refid="javafx-basics" />
<fileset refid="javafx-linux-${sun.arch.data.model}" />
<fileset refid="jre-optional-linux" />
@@ -692,12 +697,12 @@
</target>
<target name="linux-run" depends="linux-build"
description="Run Linux version">
description="Run Linux version">
<exec executable="./processing" dir="linux/work" spawn="true"/>
</target>
<target name="linux-dist" depends="linux-build"
description="Build .tar.gz of linux version">
description="Build .tar.gz of linux version">
<!--
<tar compression="gzip" destfile="linux/processing-${version}.tgz">
@@ -736,7 +741,7 @@
<!-- - - - - - - - -->
<target name="windows-clean" depends="subprojects-clean"
description="Clean windows version">
description="Clean windows version">
<delete dir="windows/work" />
</target>
@@ -753,8 +758,8 @@
</target>
<target name="windows-build"
depends="revision-check, windows-checkos, subprojects-build"
description="Build windows version">
depends="revision-check, windows-checkos, subprojects-build"
description="Build windows version">
<mkdir dir="windows/work" />
<!-- assemble the pde -->
@@ -766,7 +771,7 @@
<copy todir="windows/work">
<fileset dir=".." includes="core/library/**" />
<fileset dir="shared" includes="launch4j/**" />
<fileset dir="shared" includes="lib/**" />
<fileset dir="shared" includes="lib/**" excludes="lib/fonts/**" />
<fileset dir="shared" includes="modes/**" />
<fileset file="shared/revisions.txt" />
</copy>
@@ -781,32 +786,22 @@
<!-- rename the version we need -->
<move file="${launch4j.dir}/bin/windres-windows.exe"
tofile="${launch4j.dir}/bin/windres.exe" />
tofile="${launch4j.dir}/bin/windres.exe" />
<move file="${launch4j.dir}/bin/ld-windows.exe"
tofile="${launch4j.dir}/bin/ld.exe" />
tofile="${launch4j.dir}/bin/ld.exe" />
<!-- remove the others -->
<delete>
<delete failonerror="true">
<fileset dir="${launch4j.dir}/bin" includes="ld-*" />
<fileset dir="${launch4j.dir}/bin" includes="windres-*" />
</delete>
<delete dir="${target.path}/modes/java/libraries/video/library/macosx64" />
<condition property="video.delete" value="32">
<equals arg1="${sun.arch.data.model}" arg2="64" />
</condition>
<condition property="video.delete" value="64">
<equals arg1="${sun.arch.data.model}" arg2="32" />
</condition>
<delete dir="${target.path}/modes/java/libraries/video/library/windows${video.delete}" />
<taskdef name="launch4j"
classname="net.sf.launch4j.ant.Launch4jTask"
classpath="${launch4j.dir}/launch4j.jar; ${launch4j.dir}/lib/xstream.jar" />
classname="net.sf.launch4j.ant.Launch4jTask"
classpath="${launch4j.dir}/launch4j.jar; ${launch4j.dir}/lib/xstream.jar" />
<!-- not all launch4j options are available when embedded inside this
file (i.e. the icon param doesn't work), so use a config file -->
file (i.e. the icon param doesn't work), so use a config file -->
<launch4j configFile="windows/config.xml" />
<launch4j configFile="windows/config-cmd.xml" />
@@ -817,22 +812,22 @@
<!-- starting with 2.0a7, require the local JRE + tools.jar -->
<get src="http://processing.googlecode.com/files/${jre.file}"
dest="windows/jre.tgz"
usetimestamp="true" />
dest="windows/jre.tgz"
usetimestamp="true" />
<!--
<unzip dest="windows/work" src="windows/jre.zip" overwrite="false"/>
-->
<!-- Hopefully this is OK with the permissions (unlike Linux),
since those shouldn't matter on Windows. -->
since those shouldn't matter on Windows. -->
<untar compression="gzip"
dest="windows/work"
src="windows/jre.tgz"
overwrite="false" />
dest="windows/work"
src="windows/jre.tgz"
overwrite="false" />
<move file="windows/work/jre1.7.0_40" tofile="windows/work/java" />
<!-- Remove space-wasting JavaFX garbage. -->
<delete>
<delete failonerror="true">
<fileset refid="javafx-basics" />
<fileset refid="javafx-windows" />
<fileset refid="jre-optional-windows" />
@@ -844,36 +839,36 @@
</target>
<target name="windows-run" depends="windows-build"
description="Run windows version">
description="Run windows version">
<exec executable="windows/work/processing.exe"
dir="windows/work" spawn="true"/>
dir="windows/work" spawn="true"/>
</target>
<target name="windows-dist" depends="windows-build"
description="Create .zip files of windows version">
description="Create .zip files of windows version">
<!--
<zip basedir="windows/work"
prefix="processing-${version}"
destfile="windows/processing-${version}.zip" />
prefix="processing-${version}"
destfile="windows/processing-${version}.zip" />
<zip basedir="windows/work"
prefix="processing-${version}"
destfile="windows/processing-${version}-expert.zip"
excludes="java/**" />
prefix="processing-${version}"
destfile="windows/processing-${version}-expert.zip"
excludes="java/**" />
-->
<property name="windows.dist" value="windows/processing-${version}-windows${sun.arch.data.model}.zip" />
<zip destfile="${windows.dist}">
<zipfileset dir="windows/work"
prefix="processing-${version}" />
prefix="processing-${version}" />
</zip>
<!-- Expert is too much of a headache. Just nix it for 2.0. -->
<!--
<zip destfile="windows/processing-${version}-windows-expert.zip">
<zipfileset dir="windows/work"
prefix="processing-${version}"
excludes="java/**" />
prefix="processing-${version}"
excludes="java/**" />
</zip>
-->
@@ -916,23 +911,23 @@ remove the spaces for depth since it should be double dash, but screws up commen
<javadoc access="public" author="false" classpath="../core/library/jogl-all.jar:../core/bin:../core/library/gluegen-rt.jar" destdir="javadoc/core" nodeprecated="false" nodeprecatedlist="false" noindex="false" nonavbar="false" notree="false" source="1.6" splitindex="false" use="false" version="false">
<!-- provide links for java.* classes.
also suppresses the java.lang prefix in the text. -->
also suppresses the java.lang prefix in the text. -->
<link href="http://docs.oracle.com/javase/7/docs/api/" />
<!-- prevent files from always appearing to have changed -->
<arg value="-notimestamp" />
<packageset dir="../core/src">
<include name="processing/**" />
<include name="processing/**" />
</packageset>
</javadoc>
<!--
<copy file="javadoc/stylesheet.css"
tofile="javadoc/core/stylesheet.css" />
tofile="javadoc/core/stylesheet.css" />
<copy file="javadoc/index.html"
tofile="javadoc/core/index.html" />
tofile="javadoc/core/index.html" />
-->
<!-- build everything else -->
@@ -947,25 +942,27 @@ remove the spaces for depth since it should be double dash, but screws up commen
<link href="http://docs.oracle.com/javase/7/docs/api/" />
<packageset dir="../app/src">
<include name="antlr/**" />
<include name="processing/**" />
<include name="antlr/**" />
<include name="processing/**" />
</packageset>
<packageset dir="../app/generated">
<include name="processing/**" />
<include name="processing/**" />
</packageset>
<packageset dir="../core/src">
<include name="processing/**" />
<include name="japplemenubar/**" />
<include name="processing/**" />
<!--
<include name="japplemenubar/**" />
-->
</packageset>
</javadoc>
<!--
<copy file="javadoc/stylesheet.css"
tofile="javadoc/everything/stylesheet.css" />
tofile="javadoc/everything/stylesheet.css" />
<copy file="javadoc/index.html"
tofile="javadoc/everything/index.html" />
tofile="javadoc/everything/index.html" />
-->
<!-- set the MIME type so that Google Code shows the files properly -->
@@ -1005,7 +1002,7 @@ remove the spaces for depth since it should be double dash, but screws up commen
<!-- - - - - - - - -->
<target name="clean" description="Perform a spring cleaning"
depends="linux-clean, windows-clean, macosx-clean, subprojects-clean">
depends="linux-clean, windows-clean, macosx-clean, subprojects-clean">
</target>
</project>
+2 -2
View File
@@ -103,7 +103,7 @@ cmd_name='processing-java'
if [ $current_name = $cmd_name ]
then
java -Djna.nosys=true processing.mode.java.Commander "$@"
java -Djna.nosys=true -Xmx256m processing.mode.java.Commander "$@"
exit $?
else
# Start Processing in the same directory as this script
@@ -114,5 +114,5 @@ else
fi
cd "$APPDIR"
java -Djna.nosys=true processing.app.Base "$SKETCH" &
java -Djna.nosys=true -Xmx256m processing.app.Base "$SKETCH" &
fi
-2
View File
@@ -1,2 +0,0 @@
[InternetShortcut]
URL=https://github.com/kritzikratzi/jAppleMenuBar
+11
View File
@@ -339,3 +339,14 @@ run.present.stop.color = #cccccc
#proxy.port=8080
proxy.host=
proxy.port=
# PDE X
pdex.autoSave.autoSaveByDefault=true
pdex.autoSave.autoSaveEnabled=false
pdex.autoSave.promptDisplay=true
pdex.autoSaveInterval=5
pdex.ccEnabled=true
pdex.dbgOutput=false
pdex.errorCheckEnabled=true
pdex.warningsEnabled=true
pdex.writeErrorLogs=false
+143
View File
@@ -1,3 +1,146 @@
PROCESSING 3.0a2 (REV 0229) - ?? August 2014
[ fixes ]
+ The Examples weren't included in 3.0a1. Oops.
https://github.com/processing/processing/issues/2652
[ changes ]
+ Added a new sketchbook location, so that you can have separate sketchbooks
with 2.0 and 3.0 releases. The downside is that they won't stay in sync,
but the upside is that sketches that haven't been updated, or conflicting
Libraries, Modes, or Tools won't cause trouble with the other version.
The new preference is called sketchbook.location.three (the old preference
was sketchbook.location). If you already have a 2.0 sketchbook, that will
be used by default with 3.0 until you change it in the Preferences window.
+ Neglected to mention with the previous release that the video library has
been removed from the default download. This decreases the size of the
Processing download by about 20%. In addition, it was only the video
library for the platform being downloaded, and with the return of cross-
platform application export, that could cause sadness. To use the video
library, use the "Add Library..." menu and select it from the list.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
PROCESSING 3.0a1 (REV 0228) - 26 July 2014
Kicking off the 3.0 release process. The focus for Processing 3 is improving
the editor and the coding process, so we'll be integrating what was formerly
PDE X as the main editor.
This release also includes a number of bug fixes and changes, based on
in-progress Google Summer of Code projects and a few helpful souls on Github.
Please contribute to the Processing 3 release by testing and reporting bugs.
Or better yet, helping us fix them and submitting pull requests.
[ contributed fixes! ]
+ Fix blendMode() problems in the default renderer (thanks Jakub Valtar!)
https://github.com/processing/processing/issues/2012
https://github.com/processing/processing/issues/2275
https://github.com/processing/processing/issues/2276
https://github.com/processing/processing/issues/2483
+ Lighting issues with non-planar triangle strips or quad strips
https://github.com/processing/processing/issues/2014
https://github.com/processing/processing/issues/2018
https://github.com/processing/processing/pull/2644
+ Set the application name on Linux
https://github.com/processing/processing/issues/2534
https://github.com/processing/processing/pull/2584
+ Serial library not working on export
https://github.com/processing/processing/issues/2559
+ Fix build problems on Windows
https://github.com/processing/processing/issues/2603
https://github.com/processing/processing/pull/2610
+ filter() not applying to images produced by saveframe() consistently
https://github.com/processing/processing/issues/2619
+ drawLatch in PJOGL can be null after requesting frame rendering
https://github.com/processing/processing/issues/2630
[ summer of code ]
+ Line coloring incorrect for filtered contribution listings
https://github.com/processing/processing/issues/2583
https://github.com/processing/processing/pull/2598
+ Added Present's background color as an option to the Preferences window
https://github.com/processing/processing/pull/2568
+ Check for updates on startup
https://github.com/processing/processing/pull/2636
+ Avoid problems with out-of-date contribution list
https://github.com/processing/processing/issues/2572
+ Integrate tweak mode into the new editor
https://github.com/processing/processing/pull/2624
+ Implementation of a list of open sketches in the Sketch menu
https://github.com/processing/processing/pull/2551
+ Add preference to set the present color
https://github.com/processing/processing/pull/2568
+ Fix a problem where mode menu selection would change even if
the change was canceled due to the sketch being modified
https://github.com/processing/processing/issues/2615
+ Add date and time stamps to the Contribution Manager
https://github.com/processing/processing/pull/2651
[ more bug fixes ]
+ Prevent the current Mode from being de-selected
https://github.com/processing/processing/issues/2545
+ Prevent ArrayIndexOutOfBoundsException when calling min/maxValue()
on a FloatDict that only contains NaN values
+ Last row was being skipped on tables with the 'newlines' option set
+ Debug table parsing with header rows
+ Bug fix for setting Table data types
+ Fixes for new Table(Iterable). Category data types were not importing
their dictionary, column titles weren't set, and performance improvements
were badly needed.
+ When using setColumnType(), replace nulls with missingInt, missingFloat, etc
Formerly, this was throwing a NullPointerException.
[ changes ]
+ A new sound library has been added, and Minim has been removed. Minim
will now available via the Contributions Manager.
+ Add copy() method to PVector
+ Major performance improvements to parsing w/ the 'newlines' option
+ add getColumnTitle(int) and getColumnTitles() to TableRow interface
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
PROCESSING 2.2.1 (REV 0227) - 19 May 2014
A handful of bug fixes, the most prominent rolls back a change that broke
+2
View File
@@ -34,6 +34,8 @@
<opt>-Djna.nosys=true</opt>
<!-- for 2.2, set a minimum version -->
<minVersion>1.7.0_40</minVersion>
<!-- increase available per PDE X request -->
<maxHeapSize>256</maxHeapSize>
</jre>
<messages>
<startupErr>An error occurred while starting the application.</startupErr>
+2
View File
@@ -34,6 +34,8 @@
<opt>-Djna.nosys=true</opt>
<!-- for 2.2, set a minimum version -->
<minVersion>1.7.0_40</minVersion>
<!-- increase available per PDE X request -->
<maxHeapSize>256</maxHeapSize>
</jre>
<splash>
<file>about.bmp</file>
-381
View File
@@ -1,381 +0,0 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled
org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
org.eclipse.jdt.core.compiler.problem.deadCode=ignore
org.eclipse.jdt.core.compiler.problem.deprecation=warning
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore
org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore
org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=disabled
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
org.eclipse.jdt.core.compiler.problem.nullReference=warning
org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
org.eclipse.jdt.core.compiler.problem.unusedImport=warning
org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
org.eclipse.jdt.core.compiler.source=1.6
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=18
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=18
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=18
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_assignment=0
org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=36
org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=18
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=18
org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80
org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16
org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
org.eclipse.jdt.core.formatter.blank_lines_after_package=1
org.eclipse.jdt.core.formatter.blank_lines_before_field=1
org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
org.eclipse.jdt.core.formatter.blank_lines_before_method=1
org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
org.eclipse.jdt.core.formatter.blank_lines_before_package=0
org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
org.eclipse.jdt.core.formatter.comment.format_block_comments=true
org.eclipse.jdt.core.formatter.comment.format_header=false
org.eclipse.jdt.core.formatter.comment.format_html=true
org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
org.eclipse.jdt.core.formatter.comment.format_line_comments=false
org.eclipse.jdt.core.formatter.comment.format_source_code=true
org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert
org.eclipse.jdt.core.formatter.comment.line_length=80
org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true
org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false
org.eclipse.jdt.core.formatter.compact_else_if=true
org.eclipse.jdt.core.formatter.continuation_indentation=1
org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=1
org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off
org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
org.eclipse.jdt.core.formatter.indent_empty_lines=false
org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
org.eclipse.jdt.core.formatter.indentation.size=2
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert
org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
org.eclipse.jdt.core.formatter.join_lines_in_comments=true
org.eclipse.jdt.core.formatter.join_wrapped_lines=true
org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
org.eclipse.jdt.core.formatter.lineSplit=80
org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=true
org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
org.eclipse.jdt.core.formatter.tabulation.char=space
org.eclipse.jdt.core.formatter.tabulation.size=2
org.eclipse.jdt.core.formatter.use_on_off_tags=false
org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
+2
View File
@@ -38,8 +38,10 @@
</javac>
<!-- Copy the jnilib to the bin folder so it's included. -->
<!--
<copy todir="bin/japplemenubar"
file="src/japplemenubar/libjAppleMenuBar.jnilib" />
-->
<!-- Copy shaders to bin. (Eclipse does this automatically.) -->
<copy todir="bin">
+38
View File
@@ -1,3 +1,41 @@
0228 core (3.0a1)
X add copy() method to PVector
X modify PVector to include better methods for chaining operations
X http://code.google.com/p/processing/issues/detail?id=218
X https://github.com/processing/processing/issues/257
X PVector discussion with Dan
o Jer and Dan will look at their code, plus toxiclibs
X blendMode() broken with default renderer
X fix from Jakub Valtar
X https://github.com/processing/processing/issues/2012
X may have been introduced between 2.0b7 and 2.0b8
X https://github.com/processing/processing/issues/2275
X https://github.com/processing/processing/issues/2276
X https://github.com/processing/processing/issues/2483
X if all data is NaN in a FloatDict, return NaN for maxValue() and minValue()
X formerly as AIOOBE -1 because -1 means "not found"
X but that was indexing directly into the data array
pulls
X filter() not applying to images produced by saveframe() consistently
X https://github.com/processing/processing/issues/2619
X drawLatch in PJOGL can be null after requesting frame rendering
X https://github.com/processing/processing/issues/2630
table
X major performance improvements to 'newlines' parsing
X last row was being skipped on tables with the 'newlines' option set
X debug table parsing with header rows
X bug fix for setting data types
X add getColumnTitle(int) and getColumnTitles() to TableRow interface
X fixes for new Table(Iterable)
X category data types were not importing their dictionary
X column titles weren't set on the new table
X drastic performance improvements for addRow()
X when using setColumnType(), replace nulls with missingInt, missingFloat, etc
X formerly, was throwing a NullPointerException
0227 core (2.2.1)
X Permit mouse PRESS to set mouseX/mouseY
X https://github.com/processing/processing/pull/2509
-88
View File
@@ -1,88 +0,0 @@
/*
Part of the Processing project - http://processing.org
Copyright (c) 2011-12 hansi raber, released under LGPL under agreement
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation, version 2.1.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General
Public License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330,
Boston, MA 02111-1307 USA
*/
package japplemenubar;
import java.io.*;
import processing.core.PApplet;
/**
* Starting point for the application. General initialization should be done
* inside the ApplicationController's init() method. If certain kinds of
* non-Swing initialization takes too long, it should happen in a new Thread
* and off the Swing event dispatch thread (EDT).
*
* @author hansi
*/
public class JAppleMenuBar {
static JAppleMenuBar instance;
static final String FILENAME = "libjAppleMenuBar.jnilib";
static {
try {
File temp = File.createTempFile("processing", "menubar");
temp.delete(); // remove the file itself
temp.mkdirs(); // create a directory out of it
temp.deleteOnExit();
File jnilibFile = new File(temp, FILENAME);
InputStream input = JAppleMenuBar.class.getResourceAsStream(FILENAME);
if (input != null) {
if (PApplet.saveStream(jnilibFile, input)) {
System.load(jnilibFile.getAbsolutePath());
instance = new JAppleMenuBar();
} else {
sadness("Problem saving " + FILENAME + " for full screen use.");
}
} else {
sadness("Could not load " + FILENAME + " from core.jar");
}
} catch (IOException e) {
sadness("Unknown error, here's the stack trace.");
e.printStackTrace();
}
}
static void sadness(String msg) {
System.err.println("Full screen mode disabled. " + msg);
}
// static public void show() {
// instance.setVisible(true);
// }
static public void hide() {
instance.setVisible(false, false);
}
public native void setVisible(boolean visibility, boolean kioskMode);
// public void setVisible(boolean visibility) {
// // Keep original API in-tact. Default kiosk-mode to off.
// setVisible(visibility, false);
// }
}
+69 -38
View File
@@ -10410,25 +10410,6 @@ public class PApplet extends Applet
}
// /**
// * GIF image of the Processing logo.
// */
// static public final byte[] ICON_IMAGE = {
// 71, 73, 70, 56, 57, 97, 16, 0, 16, 0, -77, 0, 0, 0, 0, 0, -1, -1, -1, 12,
// 12, 13, -15, -15, -14, 45, 57, 74, 54, 80, 111, 47, 71, 97, 62, 88, 117,
// 1, 14, 27, 7, 41, 73, 15, 52, 85, 2, 31, 55, 4, 54, 94, 18, 69, 109, 37,
// 87, 126, -1, -1, -1, 33, -7, 4, 1, 0, 0, 15, 0, 44, 0, 0, 0, 0, 16, 0, 16,
// 0, 0, 4, 122, -16, -107, 114, -86, -67, 83, 30, -42, 26, -17, -100, -45,
// 56, -57, -108, 48, 40, 122, -90, 104, 67, -91, -51, 32, -53, 77, -78, -100,
// 47, -86, 12, 76, -110, -20, -74, -101, 97, -93, 27, 40, 20, -65, 65, 48,
// -111, 99, -20, -112, -117, -123, -47, -105, 24, 114, -112, 74, 69, 84, 25,
// 93, 88, -75, 9, 46, 2, 49, 88, -116, -67, 7, -19, -83, 60, 38, 3, -34, 2,
// 66, -95, 27, -98, 13, 4, -17, 55, 33, 109, 11, 11, -2, -128, 121, 123, 62,
// 91, 120, -128, 127, 122, 115, 102, 2, 119, 0, -116, -113, -119, 6, 102,
// 121, -108, -126, 5, 18, 6, 4, -102, -101, -100, 114, 15, 17, 0, 59
// };
static ArrayList<Image> iconImages;
protected void setIconImage(Frame frame) {
@@ -10457,18 +10438,46 @@ public class PApplet extends Applet
}
// Not gonna do this dynamically, only on startup. Too much headache.
// public void fullscreen() {
// if (frame != null) {
// if (PApplet.platform == MACOSX) {
// japplemenubar.JAppleMenuBar.hide();
// }
// GraphicsConfiguration gc = frame.getGraphicsConfiguration();
// Rectangle rect = gc.getBounds();
//// GraphicsDevice device = gc.getDevice();
// frame.setBounds(rect.x, rect.y, rect.width, rect.height);
// }
// }
/**
* Use reflection to call
* <code>com.apple.eawt.FullScreenUtilities.setWindowCanFullScreen(window, true);</code>
*/
static private void macosxFullScreenEnable(Window window) {
try {
Class<?> util = Class.forName("com.apple.eawt.FullScreenUtilities");
Class params[] = new Class[] { Window.class, Boolean.TYPE };
Method method = util.getMethod("setWindowCanFullScreen", params);
method.invoke(util, window, true);
} catch (ClassNotFoundException cnfe) {
// ignored
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* Use reflection to call
* <code>com.apple.eawt.Application.getApplication().requestToggleFullScreen(window);</code>
*/
static private void macosxFullScreenToggle(Window window) {
try {
Class<?> appClass = Class.forName("com.apple.eawt.Application");
Method getAppMethod = appClass.getMethod("getApplication");
Object app = getAppMethod.invoke(null, new Object[0]);
Method requestMethod =
appClass.getMethod("requestToggleFullScreen", Window.class);
requestMethod.invoke(app, window);
} catch (ClassNotFoundException cnfe) {
// ignored
} catch (Exception e) {
e.printStackTrace();
}
}
/**
@@ -10868,11 +10877,21 @@ public class PApplet extends Applet
// // or cmd/ctrl-shift-R in the PDE.
if (present) {
if (platform == MACOSX) {
// Call some native code to remove the menu bar on OS X. Not necessary
// on Linux and Windows, who are happy to make full screen windows.
japplemenubar.JAppleMenuBar.hide();
}
// if (platform == MACOSX) {
// println("before");
// println(screenRect);
// println(frame.getBounds());
//
// // Call some native code to remove the menu bar on OS X. Not necessary
// // on Linux and Windows, who are happy to make full screen windows.
//// japplemenubar.JAppleMenuBar.hide();
// toggleFullScreen(frame);
// println("after");
// println(screenRect);
// println(frame.getBounds());
//
// println(applet.width + " " + applet.height);
// }
// After the pack(), the screen bounds are gonna be 0s
frame.setBounds(screenRect);
@@ -10880,6 +10899,17 @@ public class PApplet extends Applet
(screenRect.height - applet.height) / 2,
applet.width, applet.height);
if (platform == MACOSX) {
macosxFullScreenEnable(frame);
macosxFullScreenToggle(frame);
// toggleFullScreen(frame);
// println("after");
// println(screenRect);
// println(frame.getBounds());
// println(applet.width + " " + applet.height);
}
if (!hideStop) {
Label label = new Label("stop");
label.setForeground(stopColor);
@@ -13149,9 +13179,9 @@ public class PApplet extends Applet
* @param x x-coordinate of text
* @param y y-coordinate of text
* @see PGraphics#textAlign(int, int)
* @see PGraphics#textMode(int)
* @see PApplet#loadFont(String)
* @see PGraphics#textFont(PFont)
* @see PGraphics#textMode(int)
* @see PGraphics#textSize(float)
* @see PGraphics#rectMode(int)
* @see PGraphics#fill(int, float)
* @see_external String
@@ -13290,6 +13320,7 @@ public class PApplet extends Applet
* @webref transform
* @see PGraphics#popMatrix()
* @see PGraphics#translate(float, float, float)
* @see PGraphics#scale(float)
* @see PGraphics#rotate(float)
* @see PGraphics#rotateX(float)
* @see PGraphics#rotateY(float)
+5 -4
View File
@@ -2664,8 +2664,8 @@ public class PGraphics extends PImage implements PConstants {
}
if (stop - start > TWO_PI) {
start = 0;
stop = TWO_PI;
// don't change start, it is visible in PIE mode
stop = start + TWO_PI;
}
arcImpl(x, y, w, h, start, stop, mode);
}
@@ -4234,9 +4234,9 @@ public class PGraphics extends PImage implements PConstants {
* @param x x-coordinate of text
* @param y y-coordinate of text
* @see PGraphics#textAlign(int, int)
* @see PGraphics#textMode(int)
* @see PApplet#loadFont(String)
* @see PGraphics#textFont(PFont)
* @see PGraphics#textMode(int)
* @see PGraphics#textSize(float)
* @see PGraphics#rectMode(int)
* @see PGraphics#fill(int, float)
* @see_external String
@@ -4808,6 +4808,7 @@ public class PGraphics extends PImage implements PConstants {
* @webref transform
* @see PGraphics#popMatrix()
* @see PGraphics#translate(float, float, float)
* @see PGraphics#scale(float)
* @see PGraphics#rotate(float)
* @see PGraphics#rotateX(float)
* @see PGraphics#rotateY(float)
+11 -2
View File
@@ -743,11 +743,14 @@ public class PGraphicsJava2D extends PGraphics {
int[] srcPixels = new int[width];
int[] dstPixels = new int[width];
// Java won't set the high bits when RGB, returns 0 for alpha
int alphaFiller = (dstIn.getNumBands() == 3) ? (0xFF << 24) : 0x00;
for (int y = 0; y < height; y++) {
src.getDataElements(0, y, width, 1, srcPixels);
dstIn.getDataElements(0, y, width, 1, dstPixels);
for (int x = 0; x < width; x++) {
dstPixels[x] = blendColor(srcPixels[x], dstPixels[x], mode);
dstPixels[x] = blendColor(srcPixels[x], alphaFiller | dstPixels[x], mode);
}
dstOut.setDataElements(0, y, width, 1, dstPixels);
}
@@ -1298,6 +1301,12 @@ public class PGraphicsJava2D extends PGraphics {
}
if (who.modified) {
if (who.pixels == null) {
// This might be a PGraphics that hasn't been drawn to yet.
// Can't just bail because the cache has been created above.
// https://github.com/processing/processing/issues/2208
who.pixels = new int[who.width * who.height];
}
cash.update(who, tint, tintColor);
who.modified = false;
}
@@ -1671,7 +1680,7 @@ public class PGraphicsJava2D extends PGraphics {
if (textFont == null) {
defaultFontOrDeath("textWidth");
}
Font font = (Font) textFont.getNative();
//if (font != null && (textFont.isStream() || hints[ENABLE_NATIVE_FONTS])) {
if (font != null) {
+7 -3
View File
@@ -283,10 +283,14 @@ public class PImage implements PConstants, Cloneable {
width = bi.getWidth();
height = bi.getHeight();
pixels = new int[width * height];
WritableRaster raster = bi.getRaster();
raster.getDataElements(0, 0, width, height, pixels);
if (bi.getType() == BufferedImage.TYPE_INT_ARGB) {
pixels = ((DataBufferInt) bi.getRaster().getDataBuffer()).getData();
int type = bi.getType();
if (type == BufferedImage.TYPE_INT_ARGB) {
format = ARGB;
} else if (type == BufferedImage.TYPE_INT_RGB) {
for (int i = 0; i < pixels.length; i++) {
pixels[i] = 0xFF000000 | pixels[i];
}
}
} else { // go the old school java 1.0 route
+6 -1
View File
@@ -2065,7 +2065,12 @@ public class PShape implements PConstants {
vertices[index][X] = vec.x;
vertices[index][Y] = vec.y;
vertices[index][Z] = vec.z;
if (vertices[index].length > 2) {
vertices[index][Z] = vec.z;
} else if (vec.z != 0 && vec.z == vec.z) {
throw new IllegalArgumentException("Cannot set a z-coordinate on a 2D shape");
}
}
+122 -1
View File
@@ -518,7 +518,7 @@ public class PShapeSVG extends PShape {
c == 'S' || c == 's' ||
c == 'Q' || c == 'q' || // quadratic beziers
c == 'T' || c == 't' ||
// c == 'A' || c == 'a' || // elliptical arc
c == 'A' || c == 'a' || // elliptical arc
c == 'Z' || c == 'z' || // closepath
c == ',') {
separate = true;
@@ -816,6 +816,40 @@ public class PShapeSVG extends PShape {
}
break;
// A - elliptical arc to (absolute)
case 'A': {
float rx = PApplet.parseFloat(pathTokens[i + 1]);
float ry = PApplet.parseFloat(pathTokens[i + 2]);
float angle = PApplet.parseFloat(pathTokens[i + 3]);
boolean fa = PApplet.parseFloat(pathTokens[i + 4]) != 0;
boolean fs = PApplet.parseFloat(pathTokens[i + 5]) != 0;
float endX = PApplet.parseFloat(pathTokens[i + 6]);
float endY = PApplet.parseFloat(pathTokens[i + 7]);
parsePathArcto(cx, cy, rx, ry, angle, fa, fs, endX, endY);
cx = endX;
cy = endY;
i += 8;
prevCurve = true;
}
break;
// a - elliptical arc to (relative)
case 'a': {
float rx = PApplet.parseFloat(pathTokens[i + 1]);
float ry = PApplet.parseFloat(pathTokens[i + 2]);
float angle = PApplet.parseFloat(pathTokens[i + 3]);
boolean fa = PApplet.parseFloat(pathTokens[i + 4]) != 0;
boolean fs = PApplet.parseFloat(pathTokens[i + 5]) != 0;
float endX = cx + PApplet.parseFloat(pathTokens[i + 6]);
float endY = cy + PApplet.parseFloat(pathTokens[i + 7]);
parsePathArcto(cx, cy, rx, ry, angle, fa, fs, endX, endY);
cx = endX;
cy = endY;
i += 8;
prevCurve = true;
}
break;
case 'Z':
case 'z':
// since closing the path, the 'current' point needs
@@ -924,6 +958,93 @@ public class PShapeSVG extends PShape {
}
// Approximates elliptical arc by several bezier segments.
// Meets SVG standard requirements from:
// http://www.w3.org/TR/SVG/paths.html#PathDataEllipticalArcCommands
// http://www.w3.org/TR/SVG/implnote.html#ArcImplementationNotes
// Based on arc to bezier curve equations from:
// http://www.spaceroots.org/documents/ellipse/node22.html
private void parsePathArcto(float x1, float y1,
float rx, float ry,
float angle,
boolean fa, boolean fs,
float x2, float y2) {
if (x1 == x2 && y1 == y2) return;
if (rx == 0 || ry == 0) { parsePathLineto(x2, y2); return; }
rx = PApplet.abs(rx); ry = PApplet.abs(ry);
float phi = PApplet.radians(((angle % 360) + 360) % 360);
float cosPhi = PApplet.cos(phi), sinPhi = PApplet.sin(phi);
float x1r = ( cosPhi * (x1 - x2) + sinPhi * (y1 - y2)) / 2;
float y1r = (-sinPhi * (x1 - x2) + cosPhi * (y1 - y2)) / 2;
float cxr, cyr;
{
float A = (x1r*x1r) / (rx*rx) + (y1r*y1r) / (ry*ry);
if (A > 1) {
// No solution, scale ellipse up according to SVG standard
float sqrtA = PApplet.sqrt(A);
rx *= sqrtA; cxr = 0;
ry *= sqrtA; cyr = 0;
} else {
float k = ((fa == fs) ? -1f : 1f) *
PApplet.sqrt((rx*rx * ry*ry) / ((rx*rx * y1r*y1r) + (ry*ry * x1r*x1r)) - 1f);
cxr = k * rx * y1r / ry;
cyr = -k * ry * x1r / rx;
}
}
float cx = cosPhi * cxr - sinPhi * cyr + (x1 + x2) / 2;
float cy = sinPhi * cxr + cosPhi * cyr + (y1 + y2) / 2;
float phi1, phiDelta;
{
float sx = ( x1r - cxr) / rx, sy = ( y1r - cyr) / ry;
float tx = (-x1r - cxr) / rx, ty = (-y1r - cyr) / ry;
phi1 = PApplet.atan2(sy, sx);
phiDelta = (((PApplet.atan2(ty, tx) - phi1) % TWO_PI) + TWO_PI) % TWO_PI;
if (!fs) phiDelta -= TWO_PI;
}
// One segment can not cover more that PI, less than PI/2 is
// recommended to avoid visible inaccuracies caused by rounding errors
int segmentCount = PApplet.ceil(PApplet.abs(phiDelta) / TWO_PI * 4);
float inc = phiDelta / segmentCount;
float a = PApplet.sin(inc) *
(PApplet.sqrt(4 + 3 * PApplet.sq(PApplet.tan(inc / 2))) - 1) / 3;
float sinPhi1 = PApplet.sin(phi1), cosPhi1 = PApplet.cos(phi1);
float p1x = x1;
float p1y = y1;
float relq1x = a * (-rx * cosPhi * sinPhi1 - ry * sinPhi * cosPhi1);
float relq1y = a * (-rx * sinPhi * sinPhi1 + ry * cosPhi * cosPhi1);
for (int i = 0; i < segmentCount; i++) {
float eta = phi1 + (i + 1) * inc;
float sinEta = PApplet.sin(eta), cosEta = PApplet.cos(eta);
float p2x = cx + rx * cosPhi * cosEta - ry * sinPhi * sinEta;
float p2y = cy + rx * sinPhi * cosEta + ry * cosPhi * sinEta;
float relq2x = a * (-rx * cosPhi * sinEta - ry * sinPhi * cosEta);
float relq2y = a * (-rx * sinPhi * sinEta + ry * cosPhi * cosEta);
if (i == segmentCount - 1) { p2x = x2; p2y = y2; }
parsePathCode(BEZIER_VERTEX);
parsePathVertex(p1x + relq1x, p1y + relq1y);
parsePathVertex(p2x - relq2x, p2y - relq2y);
parsePathVertex(p2x, p2y);
p1x = p2x; relq1x = relq2x;
p1y = p2y; relq1y = relq2y;
}
}
/**
* Parse the specified SVG matrix into a PMatrix2D. Note that PMatrix2D
* is rotated relative to the SVG definition, so parameters are rearranged
+59 -21
View File
@@ -119,6 +119,7 @@ public class PVector implements Serializable {
/** Array so that this can be temporarily used in an array context */
transient protected float[] array;
/**
* Constructor for an empty vector: x, y, and z are set to 0.
*/
@@ -149,6 +150,7 @@ public class PVector implements Serializable {
this.z = 0;
}
/**
* ( begin auto-generated from PVector_set.xml )
*
@@ -169,6 +171,7 @@ public class PVector implements Serializable {
this.z = z;
}
/**
* @param x the x component of the vector
* @param y the y component of the vector
@@ -178,6 +181,7 @@ public class PVector implements Serializable {
this.y = y;
}
/**
* @param v any variable of type PVector
*/
@@ -217,9 +221,10 @@ public class PVector implements Serializable {
* @see PVector#random3D()
*/
static public PVector random2D() {
return random2D(null,null);
return random2D(null, null);
}
/**
* Make a new 2D unit vector with a random direction
* using Processing's current random number generator
@@ -227,7 +232,7 @@ public class PVector implements Serializable {
* @return the random PVector
*/
static public PVector random2D(PApplet parent) {
return random2D(null,parent);
return random2D(null, parent);
}
/**
@@ -236,18 +241,23 @@ public class PVector implements Serializable {
* @return the random PVector
*/
static public PVector random2D(PVector target) {
return random2D(target,null);
return random2D(target, null);
}
/**
* Make a new 2D unit vector with a random direction
* Make a new 2D unit vector with a random direction. Pass in the parent
* PApplet if you want randomSeed() to work (and be predictable). Or leave
* it null and be... random.
* @return the random PVector
*/
static public PVector random2D(PVector target, PApplet parent) {
if (parent == null) return fromAngle((float)(Math.random()*Math.PI*2),target);
else return fromAngle(parent.random(PConstants.TWO_PI),target);
return (parent == null) ?
fromAngle((float) (Math.random() * Math.PI*2), target) :
fromAngle(parent.random(PConstants.TAU), target);
}
/**
* ( begin auto-generated from PVector_random3D.xml )
*
@@ -262,9 +272,10 @@ public class PVector implements Serializable {
* @see PVector#random2D()
*/
static public PVector random3D() {
return random3D(null,null);
return random3D(null, null);
}
/**
* Make a new 3D unit vector with a random direction
* using Processing's current random number generator
@@ -272,18 +283,20 @@ public class PVector implements Serializable {
* @return the random PVector
*/
static public PVector random3D(PApplet parent) {
return random3D(null,parent);
return random3D(null, parent);
}
/**
* Set a 3D vector to a random unit vector with a random direction
* @param target the target vector (if null, a new vector will be created)
* @return the random PVector
*/
static public PVector random3D(PVector target) {
return random3D(target,null);
return random3D(target, null);
}
/**
* Make a new 3D unit vector with a random direction
* @return the random PVector
@@ -309,6 +322,7 @@ public class PVector implements Serializable {
return target;
}
/**
* ( begin auto-generated from PVector_sub.xml )
*
@@ -342,6 +356,12 @@ public class PVector implements Serializable {
return target;
}
public PVector copy() {
return new PVector(x, y, z);
}
/**
* ( begin auto-generated from PVector_get.xml )
*
@@ -353,10 +373,12 @@ public class PVector implements Serializable {
* @usage web_application
* @brief Get a copy of the vector
*/
@Deprecated
public PVector get() {
return new PVector(x, y, z);
return copy();
}
/**
* @param target
*/
@@ -393,6 +415,7 @@ public class PVector implements Serializable {
return (float) Math.sqrt(x*x + y*y + z*z);
}
/**
* ( begin auto-generated from PVector_mag.xml )
*
@@ -413,6 +436,7 @@ public class PVector implements Serializable {
return (x*x + y*y + z*z);
}
/**
* ( begin auto-generated from PVector_add.xml )
*
@@ -435,6 +459,7 @@ public class PVector implements Serializable {
z += v.z;
}
/**
* @param x x component of the vector
* @param y y component of the vector
@@ -493,6 +518,7 @@ public class PVector implements Serializable {
z -= v.z;
}
/**
* @param x the x component of the vector
* @param y the y component of the vector
@@ -571,7 +597,6 @@ public class PVector implements Serializable {
}
/**
* ( begin auto-generated from PVector_div.xml )
*
@@ -600,6 +625,7 @@ public class PVector implements Serializable {
return div(v, n, null);
}
/**
* Divide a vector by a scalar and store the result in another vector.
* @param target PVector in which to store the result
@@ -665,6 +691,7 @@ public class PVector implements Serializable {
return x*v.x + y*v.y + z*v.z;
}
/**
* @param x x component of the vector
* @param y y component of the vector
@@ -674,6 +701,7 @@ public class PVector implements Serializable {
return this.x*x + this.y*y + this.z*z;
}
/**
* @param v1 any variable of type PVector
* @param v2 any variable of type PVector
@@ -717,6 +745,7 @@ public class PVector implements Serializable {
return target;
}
/**
* @param v1 any variable of type PVector
* @param v2 any variable of type PVector
@@ -792,6 +821,7 @@ public class PVector implements Serializable {
}
}
/**
* ( begin auto-generated from PVector_setMag.xml )
*
@@ -809,6 +839,7 @@ public class PVector implements Serializable {
mult(len);
}
/**
* Sets the magnitude of this vector, storing the result in another vector.
* @param target Set to null to create a new vector
@@ -821,6 +852,7 @@ public class PVector implements Serializable {
return target;
}
/**
* ( begin auto-generated from PVector_setMag.xml )
*
@@ -858,10 +890,10 @@ public class PVector implements Serializable {
* @param theta the angle of rotation
*/
public void rotate(float theta) {
float xTemp = x;
float temp = x;
// Might need to check for rounding errors like with angleBetween function?
x = x*PApplet.cos(theta) - y*PApplet.sin(theta);
y = xTemp*PApplet.sin(theta) + y*PApplet.cos(theta);
y = temp*PApplet.sin(theta) + y*PApplet.cos(theta);
}
@@ -880,22 +912,24 @@ public class PVector implements Serializable {
* @see PApplet#lerp(float, float, float)
*/
public void lerp(PVector v, float amt) {
x = PApplet.lerp(x,v.x,amt);
y = PApplet.lerp(y,v.y,amt);
z = PApplet.lerp(z,v.z,amt);
x = PApplet.lerp(x, v.x, amt);
y = PApplet.lerp(y, v.y, amt);
z = PApplet.lerp(z, v.z, amt);
}
/**
* Linear interpolate between two vectors (returns a new PVector object)
* @param v1 the vector to start from
* @param v2 the vector to lerp to
*/
public static PVector lerp(PVector v1, PVector v2, float amt) {
PVector v = v1.get();
PVector v = v1.copy();
v.lerp(v2, amt);
return v;
}
/**
* Linear interpolate the vector to x,y,z values
* @param x the x component to lerp to
@@ -903,11 +937,12 @@ public class PVector implements Serializable {
* @param z the z component to lerp to
*/
public void lerp(float x, float y, float z, float amt) {
this.x = PApplet.lerp(this.x,x,amt);
this.y = PApplet.lerp(this.y,y,amt);
this.z = PApplet.lerp(this.z,z,amt);
this.x = PApplet.lerp(this.x, x, amt);
this.y = PApplet.lerp(this.y, y, amt);
this.z = PApplet.lerp(this.z, z, amt);
}
/**
* ( begin auto-generated from PVector_angleBetween.xml )
*
@@ -976,14 +1011,17 @@ public class PVector implements Serializable {
return array;
}
@Override
public boolean equals(Object obj) {
if (!(obj instanceof PVector))
if (!(obj instanceof PVector)) {
return false;
}
final PVector p = (PVector) obj;
return x == p.x && y == p.y && z == p.z;
}
@Override
public int hashCode() {
int result = 1;
+43 -13
View File
@@ -411,13 +411,21 @@ public class FloatDict {
public String minKey() {
checkMinMax("minKey");
return keys[minIndex()];
int index = minIndex();
if (index == -1) {
return null;
}
return keys[index];
}
public float minValue() {
checkMinMax("minValue");
return values[minIndex()];
int index = minIndex();
if (index == -1) {
return Float.NaN;
}
return values[index];
}
@@ -452,17 +460,25 @@ public class FloatDict {
}
/** The key for a max value. */
/** The key for a max value, or null if everything is NaN (no max). */
public String maxKey() {
checkMinMax("maxKey");
return keys[maxIndex()];
int index = maxIndex();
if (index == -1) {
return null;
}
return keys[index];
}
/** The max value. */
/** The max value. (Or NaN if they're all NaN.) */
public float maxValue() {
checkMinMax("maxValue");
return values[maxIndex()];
int index = maxIndex();
if (index == -1) {
return Float.NaN;
}
return values[index];
}
@@ -652,7 +668,22 @@ public class FloatDict {
Sort s = new Sort() {
@Override
public int size() {
return count;
if (useKeys) {
return count; // don't worry about NaN values
} else { // first move NaN values to the end of the list
int right = count - 1;
while (values[right] != values[right]) {
right--;
}
for (int i = right; i >= 0; --i) {
if (Float.isNaN(values[i])) {
swap(i, right);
--right;
}
}
return right + 1;
}
}
@Override
@@ -713,12 +744,11 @@ public class FloatDict {
}
// /**
// * Write tab-delimited entries out to the console.
// */
// public void print() {
// write(new PrintWriter(System.out));
// }
public void print() {
for (int i = 0; i < size(); i++) {
System.out.println(keys[i] + " = " + values[i]);
}
}
/**
+25 -2
View File
@@ -110,6 +110,9 @@ public class FloatList implements Iterable<Float> {
* @brief Get an entry at a particular index
*/
public float get(int index) {
if (index >= count) {
throw new ArrayIndexOutOfBoundsException(index);
}
return data[index];
}
@@ -563,7 +566,20 @@ public class FloatList implements Iterable<Float> {
new Sort() {
@Override
public int size() {
return count;
// move NaN values to the end of the list and don't sort them
int right = count - 1;
while (data[right] != data[right]) {
right--;
}
for (int i = right; i >= 0; --i) {
float v = data[i];
if (v != v) {
data[i] = data[right];
data[right] = v;
--right;
}
}
return right + 1;
}
@Override
@@ -601,7 +617,7 @@ public class FloatList implements Iterable<Float> {
/**
* @webref floatlist:method
* @brief Reverse sort, orders values by first digit
* @brief Reverse the order of the list elements
*/
public void reverse() {
int ii = count - 1;
@@ -763,6 +779,13 @@ public class FloatList implements Iterable<Float> {
}
public void print() {
for (int i = 0; i < size(); i++) {
System.out.format("[%d] %f%n", i, data[i]);
}
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
+7
View File
@@ -663,6 +663,13 @@ public class IntDict {
}
public void print() {
for (int i = 0; i < size(); i++) {
System.out.println(keys[i] + " = " + values[i]);
}
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
+4 -1
View File
@@ -130,6 +130,9 @@ public class IntList implements Iterable<Integer> {
* @brief Get an entry at a particular index
*/
public int get(int index) {
if (index >= this.count) {
throw new ArrayIndexOutOfBoundsException(index);
}
return data[index];
}
@@ -569,7 +572,7 @@ public class IntList implements Iterable<Integer> {
/**
* @webref intlist:method
* @brief Reverse sort, orders values by first digit
* @brief Reverse the order of the list elements
*/
public void reverse() {
int ii = count - 1;
+2 -2
View File
@@ -31,8 +31,8 @@ public abstract class Sort implements Runnable {
protected int partition(int left, int right) {
int pivot = right;
do {
while (compare(++left, pivot) < 0) ;
while ((right != 0) && (compare(--right, pivot) > 0)) ;
while (compare(++left, pivot) < 0) { }
while ((right != 0) && (compare(--right, pivot) > 0)) { }
swap(left, right);
} while (left < right);
swap(left, right);
+7
View File
@@ -428,6 +428,13 @@ public class StringDict {
}
public void print() {
for (int i = 0; i < size(); i++) {
System.out.println(keys[i] + " = " + values[i]);
}
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
+10 -6
View File
@@ -113,6 +113,9 @@ public class StringList implements Iterable<String> {
* @brief Get an entry at a particular index
*/
public String get(int index) {
if (index >= count) {
throw new ArrayIndexOutOfBoundsException(index);
}
return data[index];
}
@@ -309,7 +312,7 @@ public class StringList implements Iterable<String> {
if (index < 0) {
throw new IllegalArgumentException("insert() index cannot be negative: it was " + index);
}
if (index >= values.length) {
if (index >= data.length) {
throw new IllegalArgumentException("insert() index " + index + " is past the end of this list");
}
@@ -495,7 +498,7 @@ public class StringList implements Iterable<String> {
/**
* @webref stringlist:method
* @brief To come...
* @brief Reverse the order of the list elements
*/
public void reverse() {
int ii = count - 1;
@@ -702,10 +705,11 @@ public class StringList implements Iterable<String> {
}
// static public StringList split(String value, char delim) {
// String[] array = PApplet.split(value, delim);
// return new StringList(array);
// }
public void print() {
for (int i = 0; i < size(); i++) {
System.out.format("[%d] %s%n", i, data[i]);
}
}
@Override
+99 -17
View File
@@ -155,12 +155,30 @@ public class Table {
public Table(Iterable<TableRow> rows) {
init();
boolean typed = false;
for (TableRow row : rows) {
if (!typed) {
setColumnTypes(row.getColumnTypes());
int row = 0;
int alloc = 10;
for (TableRow incoming : rows) {
if (row == 0) {
setColumnTypes(incoming.getColumnTypes());
setColumnTitles(incoming.getColumnTitles());
// Do this after setting types, otherwise it'll attempt to parse the
// allocated but empty rows, and drive CATEGORY columns nutso.
setRowCount(alloc);
} else if (row == alloc) {
// Far more efficient than re-allocating all columns and doing a copy
alloc *= 2;
setRowCount(alloc);
}
addRow(row);
//addRow(row);
setRow(row++, incoming);
}
// Shrink the table to only the rows that were used
if (row != alloc) {
setRowCount(row);
}
}
@@ -417,6 +435,10 @@ public class Table {
char[] c = new char[100];
int count = 0;
boolean insideQuote = false;
int alloc = 100;
setRowCount(100);
int row = 0;
int col = 0;
int ch;
@@ -462,14 +484,23 @@ public class Table {
}
setString(row, col, new String(c, 0, count));
count = 0;
if (row == 0 && header) {
row++;
if (row == 1 && header) {
// Use internal row removal (efficient because only one row).
removeTitleRow();
// Un-set the header variable so that next time around, we don't
// just get stuck into a loop, removing the 0th row repeatedly.
header = false;
// Reset the number of rows (removeTitleRow() won't reset our local 'row' counter)
row = 0;
}
// if (row % 1000 == 0) {
// PApplet.println(PApplet.nfc(row));
// }
if (row == alloc) {
alloc *= 2;
setRowCount(alloc);
}
row++;
col = 0;
} else if (ch == ',') {
@@ -491,6 +522,10 @@ public class Table {
if (count > 0) {
setString(row, col, new String(c, 0, count));
}
row++; // set row to row count (the current row index + 1)
if (alloc != row) {
setRowCount(row); // shrink to the actual size
}
}
@@ -1484,7 +1519,7 @@ public class Table {
int[] intData = new int[rowCount];
for (int row = 0; row < rowCount; row++) {
String s = getString(row, column);
intData[row] = PApplet.parseInt(s, missingInt);
intData[row] = (s == null) ? missingInt : PApplet.parseInt(s, missingInt);
}
columns[column] = intData;
break;
@@ -1494,7 +1529,7 @@ public class Table {
for (int row = 0; row < rowCount; row++) {
String s = getString(row, column);
try {
longData[row] = Long.parseLong(s);
longData[row] = (s == null) ? missingLong : Long.parseLong(s);
} catch (NumberFormatException nfe) {
longData[row] = missingLong;
}
@@ -1506,7 +1541,7 @@ public class Table {
float[] floatData = new float[rowCount];
for (int row = 0; row < rowCount; row++) {
String s = getString(row, column);
floatData[row] = PApplet.parseFloat(s, missingFloat);
floatData[row] = (s == null) ? missingFloat : PApplet.parseFloat(s, missingFloat);
}
columns[column] = floatData;
break;
@@ -1516,7 +1551,7 @@ public class Table {
for (int row = 0; row < rowCount; row++) {
String s = getString(row, column);
try {
doubleData[row] = Double.parseDouble(s);
doubleData[row] = (s == null) ? missingDouble : Double.parseDouble(s);
} catch (NumberFormatException nfe) {
doubleData[row] = missingDouble;
}
@@ -1818,13 +1853,16 @@ public class Table {
* @param source a reference to the original row to be duplicated
*/
public TableRow addRow(TableRow source) {
int row = rowCount;
return setRow(rowCount, source);
}
public TableRow setRow(int row, TableRow source) {
// Make sure there are enough columns to add this data
ensureBounds(row, source.getColumnCount() - 1);
for (int col = 0; col < columns.length; col++) {
switch (columnTypes[col]) {
case CATEGORY:
case INT:
setInt(row, col, source.getInt(col));
break;
@@ -1840,6 +1878,14 @@ public class Table {
case STRING:
setString(row, col, source.getString(col));
break;
case CATEGORY:
int index = source.getInt(col);
setInt(row, col, index);
if (!columnCategories[col].hasCategory(index)) {
columnCategories[col].setCategory(index, source.getString(col));
}
break;
default:
throw new RuntimeException("no types");
}
@@ -2272,6 +2318,14 @@ public class Table {
public int[] getColumnTypes() {
return table.getColumnTypes();
}
public String getColumnTitle(int column) {
return table.getColumnTitle(column);
}
public String[] getColumnTitles() {
return table.getColumnTitles();
}
}
@@ -2930,11 +2984,19 @@ public class Table {
return missingString;
}
return columnCategories[column].key(cat);
} else {
return String.valueOf(Array.get(columns[column], row));
} else if (columnTypes[column] == FLOAT) {
if (Float.isNaN(getFloat(row, column))) {
return null;
}
} else if (columnTypes[column] == DOUBLE) {
if (Double.isNaN(getFloat(row, column))) {
return null;
}
}
return String.valueOf(Array.get(columns[column], row));
}
/**
* @param columnName title of the column to reference
*/
@@ -3389,9 +3451,9 @@ public class Table {
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
public void replaceAll(String orig, String replacement) {
public void replaceAll(String regex, String replacement) {
for (int col = 0; col < columns.length; col++) {
replaceAll(orig, replacement, col);
replaceAll(regex, replacement, col);
}
}
@@ -3592,6 +3654,18 @@ public class Table {
return indexToData.get(index);
}
boolean hasCategory(int index) {
return index < size() && indexToData.get(index) != null;
}
void setCategory(int index, String name) {
while (indexToData.size() <= index) {
indexToData.add(null);
}
indexToData.set(index, name);
dataToIndex.put(name, index);
}
int size() {
return dataToIndex.size();
}
@@ -3613,9 +3687,11 @@ public class Table {
void read(DataInputStream input) throws IOException {
int count = input.readInt();
//System.out.println("found " + count + " entries in category map");
dataToIndex = new HashMap<String, Integer>(count);
for (int i = 0; i < count; i++) {
String str = input.readUTF();
//System.out.println(i + " " + str);
dataToIndex.put(str, i);
indexToData.add(str);
}
@@ -4216,4 +4292,10 @@ public class Table {
}
}
*/
/** Make a copy of the current table */
public Table copy() {
return new Table(rows());
}
}
+3
View File
@@ -109,4 +109,7 @@ public interface TableRow {
public int getColumnType(int column);
public int[] getColumnTypes();
public String getColumnTitle(int column);
public String[] getColumnTitles();
}
@@ -1,7 +1,7 @@
/*
Part of the Processing project - http://processing.org
Copyright (c) 2011-12 Ben Fry and Casey Reas
Copyright (c) 2011-13 Ben Fry and Casey Reas
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -24,7 +24,8 @@ precision mediump int;
#endif
varying vec4 vertColor;
varying vec4 backVertColor;
void main() {
gl_FragColor = vertColor;
gl_FragColor = gl_FrontFacing ? vertColor : backVertColor;
}
+27 -17
View File
@@ -43,6 +43,7 @@ attribute vec4 emissive;
attribute float shininess;
varying vec4 vertColor;
varying vec4 backVertColor;
const float zero_float = 0.0;
const float one_float = 1.0;
@@ -82,17 +83,17 @@ void main() {
// Normal vector in eye coordinates
vec3 ecNormal = normalize(normalMatrix * normal);
if (dot(-one_float * ecVertex, ecNormal) < zero_float) {
// If normal is away from camera, choose its opposite.
// If we add backface culling, this will be backfacing
ecNormal *= -one_float;
}
vec3 ecNormalInv = ecNormal * -one_float;
// Light calculations
vec3 totalAmbient = vec3(0, 0, 0);
vec3 totalDiffuse = vec3(0, 0, 0);
vec3 totalSpecular = vec3(0, 0, 0);
vec3 totalFrontDiffuse = vec3(0, 0, 0);
vec3 totalFrontSpecular = vec3(0, 0, 0);
vec3 totalBackDiffuse = vec3(0, 0, 0);
vec3 totalBackSpecular = vec3(0, 0, 0);
for (int i = 0; i < 8; i++) {
if (lightCount == i) break;
@@ -118,24 +119,33 @@ void main() {
: one_float;
if (any(greaterThan(lightAmbient[i], zero_vec3))) {
totalAmbient += lightAmbient[i] * falloff;
totalAmbient += lightAmbient[i] * falloff;
}
if (any(greaterThan(lightDiffuse[i], zero_vec3))) {
totalDiffuse += lightDiffuse[i] * falloff * spotf *
lambertFactor(lightDir, ecNormal);
totalFrontDiffuse += lightDiffuse[i] * falloff * spotf *
lambertFactor(lightDir, ecNormal);
totalBackDiffuse += lightDiffuse[i] * falloff * spotf *
lambertFactor(lightDir, ecNormalInv);
}
if (any(greaterThan(lightSpecular[i], zero_vec3))) {
totalSpecular += lightSpecular[i] * falloff * spotf *
blinnPhongFactor(lightDir, ecVertex, ecNormal, shininess);
totalFrontSpecular += lightSpecular[i] * falloff * spotf *
blinnPhongFactor(lightDir, ecVertex, ecNormal, shininess);
totalBackSpecular += lightSpecular[i] * falloff * spotf *
blinnPhongFactor(lightDir, ecVertex, ecNormalInv, shininess);
}
}
// Calculating final color as result of all lights (plus emissive term).
// Transparency is determined exclusively by the diffuse component.
vertColor = vec4(totalAmbient, 0) * ambient +
vec4(totalDiffuse, 1) * color +
vec4(totalSpecular, 0) * specular +
vec4(emissive.rgb, 0);
vertColor = vec4(totalAmbient, 0) * ambient +
vec4(totalFrontDiffuse, 1) * color +
vec4(totalFrontSpecular, 0) * specular +
vec4(emissive.rgb, 0);
backVertColor = vec4(totalAmbient, 0) * ambient +
vec4(totalBackDiffuse, 1) * color +
vec4(totalBackSpecular, 0) * specular +
vec4(emissive.rgb, 0);
}
+176 -92
View File
@@ -160,6 +160,11 @@ public class PGraphicsOpenGL extends PGraphics {
PGraphicsOpenGL.class.getResource("ColorFrag.glsl");
static protected URL defTextureShaderFragURL =
PGraphicsOpenGL.class.getResource("TextureFrag.glsl");
static protected URL defLightShaderFragURL =
PGraphicsOpenGL.class.getResource("LightFrag.glsl");
static protected URL defTexlightShaderFragURL =
PGraphicsOpenGL.class.getResource("TexlightFrag.glsl");
static protected URL defLineShaderVertURL =
PGraphicsOpenGL.class.getResource("LineVert.glsl");
static protected URL defLineShaderFragURL =
@@ -379,9 +384,9 @@ public class PGraphicsOpenGL extends PGraphics {
/** PImage that wraps filterTexture. */
protected PImage filterImage;
/** Flag to indicate if the user is manipulating the
* pixels array through the set()/get() methods */
protected boolean setgetPixels;
/** Flag to indicate that pixels array is up-to-date and
* ready to be manipulated through the set()/get() methods */
protected boolean arePixelsUpToDate;
// ........................................................
@@ -2151,6 +2156,9 @@ public class PGraphicsOpenGL extends PGraphics {
if ((flushMode == FLUSH_CONTINUOUSLY) ||
(flushMode == FLUSH_WHEN_FULL && tessGeo.isFull())) {
flush();
} else {
// pixels array is not up-to-date anymore
arePixelsUpToDate = false;
}
}
@@ -2166,6 +2174,9 @@ public class PGraphicsOpenGL extends PGraphics {
if (flushMode == FLUSH_CONTINUOUSLY ||
(flushMode == FLUSH_WHEN_FULL && tessGeo.isFull())) {
flush();
} else {
// pixels array is not up-to-date anymore
arePixelsUpToDate = false;
}
}
@@ -2443,7 +2454,7 @@ public class PGraphicsOpenGL extends PGraphics {
tessGeo.clear();
texCache.clear();
setgetPixels = false;
arePixelsUpToDate = false;
}
@@ -3237,6 +3248,7 @@ public class PGraphicsOpenGL extends PGraphics {
normalMode = NORMAL_MODE_SHAPE;
inGeo.setMaterial(fillColor, strokeColor, strokeWeight,
ambientColor, specularColor, emissiveColor, shininess);
inGeo.setNormal(normalX, normalY, normalZ);
inGeo.addArc(x, y, w, h, start, stop, fill, stroke, mode);
endShape();
@@ -5435,7 +5447,7 @@ public class PGraphicsOpenGL extends PGraphics {
needEndDraw = true;
}
if (!setgetPixels) {
if (!arePixelsUpToDate) {
// Draws any remaining geometry in case the user is still not
// setting/getting new pixels.
flush();
@@ -5443,10 +5455,13 @@ public class PGraphicsOpenGL extends PGraphics {
allocatePixels();
if (!setgetPixels) {
if (!arePixelsUpToDate) {
readPixels();
}
// Pixels are now up-to-date, set the flag.
arePixelsUpToDate = true;
if (needEndDraw) {
endDraw();
}
@@ -5566,7 +5581,6 @@ public class PGraphicsOpenGL extends PGraphics {
@Override
public int get(int x, int y) {
loadPixels();
setgetPixels = true;
return super.get(x, y);
}
@@ -5576,7 +5590,6 @@ public class PGraphicsOpenGL extends PGraphics {
int sourceWidth, int sourceHeight,
PImage target, int targetX, int targetY) {
loadPixels();
setgetPixels = true;
super.getImpl(sourceX, sourceY, sourceWidth, sourceHeight,
target, targetX, targetY);
}
@@ -5585,7 +5598,6 @@ public class PGraphicsOpenGL extends PGraphics {
@Override
public void set(int x, int y, int argb) {
loadPixels();
setgetPixels = true;
super.set(x, y, argb);
}
@@ -5596,7 +5608,6 @@ public class PGraphicsOpenGL extends PGraphics {
int sourceWidth, int sourceHeight,
int targetX, int targetY) {
loadPixels();
setgetPixels = true;
super.setImpl(sourceImage, sourceX, sourceY, sourceWidth, sourceHeight,
targetX, targetY);
// do we need this?
@@ -6531,8 +6542,12 @@ public class PGraphicsOpenGL extends PGraphics {
lightSpecular(0, 0, 0);
}
// Because y is flipped, the vertices that should be specified by
// the user in CCW order to define a front-facing facet, end up being CW.
// Vertices should be specified by user in CW order (left-handed)
// That is CCW order (right-handed). Vertex shader inverts
// Y-axis and outputs vertices in CW order (right-handed).
// Culling occurs after the vertex shader, so FRONT FACE
// has to be set to CW (right-handed) for OpenGL to correctly
// recognize FRONT and BACK faces.
pgl.frontFace(PGL.CW);
pgl.disable(PGL.CULL_FACE);
@@ -6540,7 +6555,8 @@ public class PGraphicsOpenGL extends PGraphics {
pgl.activeTexture(PGL.TEXTURE0);
// The current normal vector is set to be parallel to the Z axis.
normalX = normalY = normalZ = 0;
normalX = normalY = 0;
normalZ = 1;
// Clear depth and stencil buffers.
pgl.depthMask(true);
@@ -6569,7 +6585,7 @@ public class PGraphicsOpenGL extends PGraphics {
clearColorBuffer = false;
modified = false;
setgetPixels = false;
arePixelsUpToDate = false;
}
@@ -6680,9 +6696,13 @@ public class PGraphicsOpenGL extends PGraphics {
@Override
// TODO: deprecate this method, the kind arguments is not used anymore
public void shader(PShader shader, int kind) {
shader(shader);
flush(); // Flushing geometry drawn with a different shader.
if (kind == TRIANGLES) polyShader = shader;
else if (kind == LINES) lineShader = shader;
else if (kind == POINTS) pointShader = shader;
else PGraphics.showWarning(UNKNOWN_SHADER_KIND_ERROR);
}
@@ -6736,7 +6756,7 @@ public class PGraphicsOpenGL extends PGraphics {
if (useDefault || !polyShader.checkPolyType(PShader.TEXLIGHT)) {
if (ppg.defTexlightShader == null) {
String[] vertSource = pgl.loadVertexShader(defTexlightShaderVertURL, 120);
String[] fragSource = pgl.loadFragmentShader(defTextureShaderFragURL, 120);
String[] fragSource = pgl.loadFragmentShader(defTexlightShaderFragURL, 120);
ppg.defTexlightShader = new PShader(parent, vertSource, fragSource);
}
shader = ppg.defTexlightShader;
@@ -6747,7 +6767,7 @@ public class PGraphicsOpenGL extends PGraphics {
if (useDefault || !polyShader.checkPolyType(PShader.LIGHT)) {
if (ppg.defLightShader == null) {
String[] vertSource = pgl.loadVertexShader(defLightShaderVertURL, 120);
String[] fragSource = pgl.loadFragmentShader(defColorShaderFragURL, 120);
String[] fragSource = pgl.loadFragmentShader(defLightShaderFragURL, 120);
ppg.defLightShader = new PShader(parent, vertSource, fragSource);
}
shader = ppg.defLightShader;
@@ -7794,6 +7814,7 @@ public class PGraphicsOpenGL extends PGraphics {
//
// Normal calculation
// Expects vertices in CW (left-handed) order.
void calcTriangleNormal(int i0, int i1, int i2) {
int index;
@@ -7821,9 +7842,9 @@ public class PGraphicsOpenGL extends PGraphics {
float v10z = z0 - z1;
// The automatic normal calculation in Processing assumes
// that vertices as given in CCW order so:
// that vertices as given in CCW order (right-handed) so:
// n = v12 x v10
// so that the normal outwards.
// so that the normal extends from the front face.
float nx = v12y * v10z - v10y * v12z;
float ny = v12z * v10x - v10z * v12x;
float nz = v12x * v10y - v10x * v12y;
@@ -7872,14 +7893,18 @@ public class PGraphicsOpenGL extends PGraphics {
for (int i = 1; i < vertexCount - 1; i++) {
int i1 = i;
int i0, i2;
if (i % 2 == 0) {
// The even triangles (0, 2, 4...) should be CW
i0 = i + 1;
i2 = i - 1;
} else {
// The even triangles (1, 3, 5...) should be CCW
// Vertices are specified by user as:
// 1-3 ...
// |\|\ ...
// 0-2-4 ...
if (i % 2 == 1) {
// The odd triangles (1, 3, 5...) should be CW (left-handed)
i0 = i - 1;
i2 = i + 1;
} else {
// The even triangles (2, 4, 6...) should be CCW (left-handed)
i0 = i + 1;
i2 = i - 1;
}
calcTriangleNormal(i0, i1, i2);
}
@@ -7904,8 +7929,14 @@ public class PGraphicsOpenGL extends PGraphics {
int i2 = 2 * qd;
int i3 = 2 * qd + 1;
calcTriangleNormal(i0, i3, i1);
calcTriangleNormal(i0, i2, i3);
// Vertices are specified by user as:
// 1-3-5 ...
// |\|\| ...
// 0-2-4 ...
// thus (0, 1, 2) and (2, 1, 3) are triangles
// in CW order (left-handed).
calcTriangleNormal(i0, i1, i2);
calcTriangleNormal(i2, i1, i3);
}
}
@@ -8077,56 +8108,108 @@ public class PGraphicsOpenGL extends PGraphics {
int startLUT = (int) (0.5f + (start / TWO_PI) * SINCOS_LENGTH);
int stopLUT = (int) (0.5f + (stop / TWO_PI) * SINCOS_LENGTH);
int idx0 = addVertex(centerX, centerY, VERTEX, true);
// get length before wrapping indexes so (startLUT <= stopLUT);
int length = PApplet.constrain(stopLUT - startLUT, 0, SINCOS_LENGTH);
int increment = 1; // what's a good algorithm? stopLUT - startLUT;
int pidx = 0, idx = 0;
for (int i = startLUT; i < stopLUT; i += increment) {
int ii = i % SINCOS_LENGTH;
// modulo won't make the value positive
if (ii < 0) ii += SINCOS_LENGTH;
boolean fullCircle = length == SINCOS_LENGTH;
if (fullCircle && arcMode == CHORD) {
// get rid of overlapping vertices,
// solves problem with closing edge in P3D
length -= 1;
stopLUT -= 1;
}
{ // wrap indexes so they are safe to use in LUT
startLUT %= SINCOS_LENGTH;
if (startLUT < 0) startLUT += SINCOS_LENGTH;
stopLUT %= SINCOS_LENGTH;
if (stopLUT < 0) stopLUT += SINCOS_LENGTH;
}
int idx0;
if (arcMode == CHORD || arcMode == OPEN) {
// move center to the middle of flat side
// to properly display arcs smaller than PI
float relX = (cosLUT[startLUT] + cosLUT[stopLUT]) * 0.5f * hr;
float relY = (sinLUT[startLUT] + sinLUT[stopLUT]) * 0.5f * vr;
idx0 = addVertex(centerX + relX, centerY + relY, VERTEX, true);
} else {
idx0 = addVertex(centerX, centerY, VERTEX, true);
}
int inc;
{ // initializes inc the same way ellipse does
float sx1 = pg.screenX(x, y);
float sy1 = pg.screenY(x, y);
float sx2 = pg.screenX(x + w, y + h);
float sy2 = pg.screenY(x + w, y + h);
int accuracy =
PApplet.min(MAX_POINT_ACCURACY, PApplet.max(MIN_POINT_ACCURACY,
(int) (TWO_PI * PApplet.dist(sx1, sy1, sx2, sy2) /
POINT_ACCURACY_FACTOR)));
inc = PApplet.max(1, SINCOS_LENGTH / accuracy);
}
int idx = idx0;
int pidx;
int i = -inc;
int ii;
// i: (0 -> length) inclusive
// ii: (startLUT -> stopLUT) inclusive, going CW (left-handed),
// wrapping around end of LUT
do {
i += inc;
i = PApplet.min(i, length); // clamp so last vertex won't go over
ii = startLUT + i; // ii from 0 to (2 * SINCOS_LENGTH - 1)
if (ii >= SINCOS_LENGTH) ii -= SINCOS_LENGTH;
pidx = idx;
idx = addVertex(centerX + cosLUT[ii] * hr,
centerY + sinLUT[ii] * vr,
VERTEX, i == startLUT && !fill);
VERTEX, i == 0 && !fill);
if (stroke) {
if (arcMode == PIE) {
addEdge(pidx, idx, i == startLUT, false);
} else if (startLUT < i) {
addEdge(pidx, idx, i == startLUT + 1, arcMode == 0 &&
i == stopLUT - 1);
if (arcMode == CHORD || arcMode == PIE) {
addEdge(pidx, idx, i == 0, false);
} else if (0 < i) {
// when drawing full circle, the edge is closed later
addEdge(pidx, idx, i == inc, i == length && !fullCircle);
}
}
} while (i < length);
// keeping last vertex as idx and second last vertex as pidx
pidx = idx;
}
// draw last point explicitly for accuracy
idx = addVertex(centerX + cosLUT[stopLUT % SINCOS_LENGTH] * hr,
centerY + sinLUT[stopLUT % SINCOS_LENGTH] * vr,
VERTEX, false);
if (stroke) {
if (arcMode == PIE) {
if (arcMode == CHORD || arcMode == PIE) {
addEdge(idx, idx0, false, false);
closeEdge(idx, idx0);
}
}
if (arcMode == CHORD || arcMode == OPEN) {
// Add a last vertex coincident with the first along the perimeter
pidx = idx;
int i = startLUT;
int ii = i % SINCOS_LENGTH;
if (ii < 0) ii += SINCOS_LENGTH;
idx = addVertex(centerX + cosLUT[ii] * hr,
centerY + sinLUT[ii] * vr,
VERTEX, false);
if (stroke && arcMode == CHORD) {
addEdge(pidx, idx, false, true);
} else if (fullCircle) {
closeEdge(pidx, idx);
}
}
}
void addBox(float w, float h, float d,
boolean fill, boolean stroke) {
// Correct normals if some dimensions are negative so they always
// extend from front face. We could just take absolute value
// of dimensions, but that would affect texturing.
boolean invertNormX = (h > 0) != (d > 0);
boolean invertNormY = (w > 0) != (d > 0);
boolean invertNormZ = (w > 0) != (h > 0);
int normX = invertNormX ? -1 : 1;
int normY = invertNormY ? -1 : 1;
int normZ = invertNormZ ? -1 : 1;
float x1 = -w/2f; float x2 = w/2f;
float y1 = -h/2f; float y2 = h/2f;
float z1 = -d/2f; float z2 = d/2f;
@@ -8134,11 +8217,11 @@ public class PGraphicsOpenGL extends PGraphics {
int idx1 = 0, idx2 = 0, idx3 = 0, idx4 = 0;
if (fill || stroke) {
// back face
setNormal(0, 0, -1);
setNormal(0, 0, -normZ);
idx1 = addVertex(x1, y1, z1, 0, 0, VERTEX, true);
idx2 = addVertex(x2, y1, z1, 1, 0, VERTEX, false);
idx2 = addVertex(x1, y2, z1, 0, 1, VERTEX, false);
idx3 = addVertex(x2, y2, z1, 1, 1, VERTEX, false);
idx4 = addVertex(x1, y2, z1, 0, 1, VERTEX, false);
idx4 = addVertex(x2, y1, z1, 1, 0, VERTEX, false);
if (stroke) {
addEdge(idx1, idx2, true, false);
addEdge(idx2, idx3, false, false);
@@ -8148,10 +8231,10 @@ public class PGraphicsOpenGL extends PGraphics {
}
// front face
setNormal(0, 0, 1);
idx1 = addVertex(x2, y1, z2, 0, 0, VERTEX, false);
setNormal(0, 0, normZ);
idx1 = addVertex(x1, y2, z2, 1, 1, VERTEX, false);
idx2 = addVertex(x1, y1, z2, 1, 0, VERTEX, false);
idx3 = addVertex(x1, y2, z2, 1, 1, VERTEX, false);
idx3 = addVertex(x2, y1, z2, 0, 0, VERTEX, false);
idx4 = addVertex(x2, y2, z2, 0, 1, VERTEX, false);
if (stroke) {
addEdge(idx1, idx2, true, false);
@@ -8162,11 +8245,11 @@ public class PGraphicsOpenGL extends PGraphics {
}
// right face
setNormal(1, 0, 0);
setNormal(normX, 0, 0);
idx1 = addVertex(x2, y1, z1, 0, 0, VERTEX, false);
idx2 = addVertex(x2, y1, z2, 1, 0, VERTEX, false);
idx2 = addVertex(x2, y2, z1, 0, 1, VERTEX, false);
idx3 = addVertex(x2, y2, z2, 1, 1, VERTEX, false);
idx4 = addVertex(x2, y2, z1, 0, 1, VERTEX, false);
idx4 = addVertex(x2, y1, z2, 1, 0, VERTEX, false);
if (stroke) {
addEdge(idx1, idx2, true, false);
addEdge(idx2, idx3, false, false);
@@ -8176,10 +8259,10 @@ public class PGraphicsOpenGL extends PGraphics {
}
// left face
setNormal(-1, 0, 0);
idx1 = addVertex(x1, y1, z2, 0, 0, VERTEX, false);
setNormal(-normX, 0, 0);
idx1 = addVertex(x1, y2, z1, 1, 1, VERTEX, false);
idx2 = addVertex(x1, y1, z1, 1, 0, VERTEX, false);
idx3 = addVertex(x1, y2, z1, 1, 1, VERTEX, false);
idx3 = addVertex(x1, y1, z2, 0, 0, VERTEX, false);
idx4 = addVertex(x1, y2, z2, 0, 1, VERTEX, false);
if (stroke) {
addEdge(idx1, idx2, true, false);
@@ -8189,26 +8272,26 @@ public class PGraphicsOpenGL extends PGraphics {
closeEdge(idx4, idx1);
}
// bottom face
setNormal(0, -1, 0);
idx1 = addVertex(x1, y1, z2, 0, 0, VERTEX, false);
idx2 = addVertex(x2, y1, z2, 1, 0, VERTEX, false);
idx3 = addVertex(x2, y1, z1, 1, 1, VERTEX, false);
idx4 = addVertex(x1, y1, z1, 0, 1, VERTEX, false);
if (stroke) {
addEdge(idx1, idx2, true, false);
addEdge(idx2, idx3, false, false);
addEdge(idx3, idx4, false, false);
addEdge(idx4, idx1, false, false);
closeEdge(idx4, idx1);
}
// top face
setNormal(0, 1, 0);
setNormal(0, -normY, 0);
idx1 = addVertex(x2, y1, z1, 1, 1, VERTEX, false);
idx2 = addVertex(x2, y1, z2, 1, 0, VERTEX, false);
idx3 = addVertex(x1, y1, z2, 0, 0, VERTEX, false);
idx4 = addVertex(x1, y1, z1, 0, 1, VERTEX, false);
if (stroke) {
addEdge(idx1, idx2, true, false);
addEdge(idx2, idx3, false, false);
addEdge(idx3, idx4, false, false);
addEdge(idx4, idx1, false, false);
closeEdge(idx4, idx1);
}
// bottom face
setNormal(0, normY, 0);
idx1 = addVertex(x1, y2, z1, 0, 0, VERTEX, false);
idx2 = addVertex(x2, y2, z1, 1, 0, VERTEX, false);
idx2 = addVertex(x1, y2, z2, 0, 1, VERTEX, false);
idx3 = addVertex(x2, y2, z2, 1, 1, VERTEX, false);
idx4 = addVertex(x1, y2, z2, 0, 1, VERTEX, false);
idx4 = addVertex(x2, y2, z1, 1, 0, VERTEX, false);
if (stroke) {
addEdge(idx1, idx2, true, false);
addEdge(idx2, idx3, false, false);
@@ -8338,8 +8421,8 @@ public class PGraphicsOpenGL extends PGraphics {
int i0 = vert0 + i;
int i1 = vert0 + i + detailU + 1;
indices[indCount + 3 * i + 0] = i0;
indices[indCount + 3 * i + 1] = i1;
indices[indCount + 3 * i + 0] = i1;
indices[indCount + 3 * i + 1] = i0;
indices[indCount + 3 * i + 2] = i0 + 1;
addEdge(i0, i0 + 1, true, true);
@@ -9165,6 +9248,7 @@ public class PGraphicsOpenGL extends PGraphics {
//
// Normal calculation
// Expects vertices in CW (left-handed) order.
void calcPolyNormal(int i0, int i1, int i2) {
int index;
+1 -1
View File
@@ -167,7 +167,7 @@ public class PJOGL extends PGL {
/** This countdown latch is used to maintain the synchronization between
* Processing's drawing thread and JOGL's rendering thread */
protected CountDownLatch drawLatch;
protected CountDownLatch drawLatch = new CountDownLatch(0);
/** Flag used to do request final display() call to make sure that the
* buffers are properly swapped.
+94 -17
View File
@@ -58,6 +58,13 @@ import java.util.Stack;
* DXF: http://en.wikipedia.org/wiki/AutoCAD_DXF
*/
public class PShapeOpenGL extends PShape {
// Testing these constants, not use as they might go away...
static public final int POSITION = 0;
static public final int NORMAL = 1;
static public final int TEXCOORD = 2;
static public final int DIRECTION = 3;
static public final int OFFSET = 4;
static protected final int TRANSLATE = 0;
static protected final int ROTATE = 1;
static protected final int SCALE = 2;
@@ -108,6 +115,9 @@ public class PShapeOpenGL extends PShape {
public int glPointAttrib;
public int glPointIndex;
// Testing this field, not use as it might go away...
public int glUsage = PGL.STATIC_DRAW;
// ........................................................
// Offsets for geometry aggregation and update.
@@ -2493,6 +2503,73 @@ public class PShapeOpenGL extends PShape {
return tess;
}
// Testing this method, not use as it might go away...
public float[] getTessellation(int kind, int data) {
updateTessellation();
if (kind == TRIANGLES) {
if (data == POSITION) {
if (is3D()) {
root.setModifiedPolyVertices(firstPolyVertex, lastPolyVertex);
} else if (is2D()) {
int last1 = lastPolyVertex + 1;
if (-1 < firstLineVertex) last1 = firstLineVertex;
if (-1 < firstPointVertex) last1 = firstPointVertex;
root.setModifiedPolyVertices(firstPolyVertex, last1 - 1);
}
return tessGeo.polyVertices;
} else if (data == NORMAL) {
if (is3D()) {
root.setModifiedPolyNormals(firstPolyVertex, lastPolyVertex);
} else if (is2D()) {
int last1 = lastPolyVertex + 1;
if (-1 < firstLineVertex) last1 = firstLineVertex;
if (-1 < firstPointVertex) last1 = firstPointVertex;
root.setModifiedPolyNormals(firstPolyVertex, last1 - 1);
}
return tessGeo.polyNormals;
} else if (data == TEXCOORD) {
if (is3D()) {
root.setModifiedPolyTexCoords(firstPolyVertex, lastPolyVertex);
} else if (is2D()) {
int last1 = lastPolyVertex + 1;
if (-1 < firstLineVertex) last1 = firstLineVertex;
if (-1 < firstPointVertex) last1 = firstPointVertex;
root.setModifiedPolyTexCoords(firstPolyVertex, last1 - 1);
}
return tessGeo.polyTexCoords;
}
} else if (kind == LINES) {
if (data == POSITION) {
if (is3D()) {
root.setModifiedLineVertices(firstLineVertex, lastLineVertex);
} else if (is2D()) {
root.setModifiedPolyVertices(firstLineVertex, lastLineVertex);
}
return tessGeo.lineVertices;
} else if (data == DIRECTION) {
if (is2D()) {
root.setModifiedLineAttributes(firstLineVertex, lastLineVertex);
}
return tessGeo.lineDirections;
}
} else if (kind == POINTS) {
if (data == POSITION) {
if (is3D()) {
root.setModifiedPointVertices(firstPointVertex, lastPointVertex);
} else if (is2D()) {
root.setModifiedPolyVertices(firstPointVertex, lastPointVertex);
}
return tessGeo.pointVertices;
} else if (data == OFFSET) {
if (is2D()) {
root.setModifiedPointAttributes(firstPointVertex, lastPointVertex);
}
return tessGeo.pointOffsets;
}
}
return null;
}
///////////////////////////////////////////////////////////
@@ -3652,56 +3729,56 @@ public class PShapeOpenGL extends PShape {
glPolyVertex = PGraphicsOpenGL.createVertexBufferObject(context, pgl);
pgl.bindBuffer(PGL.ARRAY_BUFFER, glPolyVertex);
pgl.bufferData(PGL.ARRAY_BUFFER, 4 * sizef,
tessGeo.polyVerticesBuffer, PGL.STATIC_DRAW);
tessGeo.polyVerticesBuffer, glUsage);
tessGeo.updatePolyColorsBuffer();
if (glPolyColor == 0)
glPolyColor = PGraphicsOpenGL.createVertexBufferObject(context, pgl);
pgl.bindBuffer(PGL.ARRAY_BUFFER, glPolyColor);
pgl.bufferData(PGL.ARRAY_BUFFER, sizei,
tessGeo.polyColorsBuffer, PGL.STATIC_DRAW);
tessGeo.polyColorsBuffer, glUsage);
tessGeo.updatePolyNormalsBuffer();
if (glPolyNormal == 0)
glPolyNormal = PGraphicsOpenGL.createVertexBufferObject(context, pgl);
pgl.bindBuffer(PGL.ARRAY_BUFFER, glPolyNormal);
pgl.bufferData(PGL.ARRAY_BUFFER, 3 * sizef,
tessGeo.polyNormalsBuffer, PGL.STATIC_DRAW);
tessGeo.polyNormalsBuffer, glUsage);
tessGeo.updatePolyTexCoordsBuffer();
if (glPolyTexcoord == 0)
glPolyTexcoord = PGraphicsOpenGL.createVertexBufferObject(context, pgl);
pgl.bindBuffer(PGL.ARRAY_BUFFER, glPolyTexcoord);
pgl.bufferData(PGL.ARRAY_BUFFER, 2 * sizef,
tessGeo.polyTexCoordsBuffer, PGL.STATIC_DRAW);
tessGeo.polyTexCoordsBuffer, glUsage);
tessGeo.updatePolyAmbientBuffer();
if (glPolyAmbient == 0)
glPolyAmbient = PGraphicsOpenGL.createVertexBufferObject(context, pgl);
pgl.bindBuffer(PGL.ARRAY_BUFFER, glPolyAmbient);
pgl.bufferData(PGL.ARRAY_BUFFER, sizei,
tessGeo.polyAmbientBuffer, PGL.STATIC_DRAW);
tessGeo.polyAmbientBuffer, glUsage);
tessGeo.updatePolySpecularBuffer();
if (glPolySpecular == 0)
glPolySpecular = PGraphicsOpenGL.createVertexBufferObject(context, pgl);
pgl.bindBuffer(PGL.ARRAY_BUFFER, glPolySpecular);
pgl.bufferData(PGL.ARRAY_BUFFER, sizei,
tessGeo.polySpecularBuffer, PGL.STATIC_DRAW);
tessGeo.polySpecularBuffer, glUsage);
tessGeo.updatePolyEmissiveBuffer();
if (glPolyEmissive == 0)
glPolyEmissive = PGraphicsOpenGL.createVertexBufferObject(context, pgl);
pgl.bindBuffer(PGL.ARRAY_BUFFER, glPolyEmissive);
pgl.bufferData(PGL.ARRAY_BUFFER, sizei,
tessGeo.polyEmissiveBuffer, PGL.STATIC_DRAW);
tessGeo.polyEmissiveBuffer, glUsage);
tessGeo.updatePolyShininessBuffer();
if (glPolyShininess == 0)
glPolyShininess = PGraphicsOpenGL.createVertexBufferObject(context, pgl);
pgl.bindBuffer(PGL.ARRAY_BUFFER, glPolyShininess);
pgl.bufferData(PGL.ARRAY_BUFFER, sizef,
tessGeo.polyShininessBuffer, PGL.STATIC_DRAW);
tessGeo.polyShininessBuffer, glUsage);
pgl.bindBuffer(PGL.ARRAY_BUFFER, 0);
@@ -3711,7 +3788,7 @@ public class PShapeOpenGL extends PShape {
pgl.bindBuffer(PGL.ELEMENT_ARRAY_BUFFER, glPolyIndex);
pgl.bufferData(PGL.ELEMENT_ARRAY_BUFFER,
tessGeo.polyIndexCount * PGL.SIZEOF_INDEX,
tessGeo.polyIndicesBuffer, PGL.STATIC_DRAW);
tessGeo.polyIndicesBuffer, glUsage);
pgl.bindBuffer(PGL.ELEMENT_ARRAY_BUFFER, 0);
}
@@ -3727,21 +3804,21 @@ public class PShapeOpenGL extends PShape {
glLineVertex = PGraphicsOpenGL.createVertexBufferObject(context, pgl);
pgl.bindBuffer(PGL.ARRAY_BUFFER, glLineVertex);
pgl.bufferData(PGL.ARRAY_BUFFER, 4 * sizef,
tessGeo.lineVerticesBuffer, PGL.STATIC_DRAW);
tessGeo.lineVerticesBuffer, glUsage);
tessGeo.updateLineColorsBuffer();
if (glLineColor == 0)
glLineColor = PGraphicsOpenGL.createVertexBufferObject(context, pgl);
pgl.bindBuffer(PGL.ARRAY_BUFFER, glLineColor);
pgl.bufferData(PGL.ARRAY_BUFFER, sizei,
tessGeo.lineColorsBuffer, PGL.STATIC_DRAW);
tessGeo.lineColorsBuffer, glUsage);
tessGeo.updateLineDirectionsBuffer();
if (glLineAttrib == 0)
glLineAttrib = PGraphicsOpenGL.createVertexBufferObject(context, pgl);
pgl.bindBuffer(PGL.ARRAY_BUFFER, glLineAttrib);
pgl.bufferData(PGL.ARRAY_BUFFER, 4 * sizef,
tessGeo.lineDirectionsBuffer, PGL.STATIC_DRAW);
tessGeo.lineDirectionsBuffer, glUsage);
pgl.bindBuffer(PGL.ARRAY_BUFFER, 0);
@@ -3751,7 +3828,7 @@ public class PShapeOpenGL extends PShape {
pgl.bindBuffer(PGL.ELEMENT_ARRAY_BUFFER, glLineIndex);
pgl.bufferData(PGL.ELEMENT_ARRAY_BUFFER,
tessGeo.lineIndexCount * PGL.SIZEOF_INDEX,
tessGeo.lineIndicesBuffer, PGL.STATIC_DRAW);
tessGeo.lineIndicesBuffer, glUsage);
pgl.bindBuffer(PGL.ELEMENT_ARRAY_BUFFER, 0);
}
@@ -3767,21 +3844,21 @@ public class PShapeOpenGL extends PShape {
glPointVertex = PGraphicsOpenGL.createVertexBufferObject(context, pgl);
pgl.bindBuffer(PGL.ARRAY_BUFFER, glPointVertex);
pgl.bufferData(PGL.ARRAY_BUFFER, 4 * sizef,
tessGeo.pointVerticesBuffer, PGL.STATIC_DRAW);
tessGeo.pointVerticesBuffer, glUsage);
tessGeo.updatePointColorsBuffer();
if (glPointColor == 0)
glPointColor = PGraphicsOpenGL.createVertexBufferObject(context, pgl);
pgl.bindBuffer(PGL.ARRAY_BUFFER, glPointColor);
pgl.bufferData(PGL.ARRAY_BUFFER, sizei,
tessGeo.pointColorsBuffer, PGL.STATIC_DRAW);
tessGeo.pointColorsBuffer, glUsage);
tessGeo.updatePointOffsetsBuffer();
if (glPointAttrib == 0)
glPointAttrib = PGraphicsOpenGL.createVertexBufferObject(context, pgl);
pgl.bindBuffer(PGL.ARRAY_BUFFER, glPointAttrib);
pgl.bufferData(PGL.ARRAY_BUFFER, 2 * sizef,
tessGeo.pointOffsetsBuffer, PGL.STATIC_DRAW);
tessGeo.pointOffsetsBuffer, glUsage);
pgl.bindBuffer(PGL.ARRAY_BUFFER, 0);
@@ -3791,7 +3868,7 @@ public class PShapeOpenGL extends PShape {
pgl.bindBuffer(PGL.ELEMENT_ARRAY_BUFFER, glPointIndex);
pgl.bufferData(PGL.ELEMENT_ARRAY_BUFFER,
tessGeo.pointIndexCount * PGL.SIZEOF_INDEX,
tessGeo.pointIndicesBuffer, PGL.STATIC_DRAW);
tessGeo.pointIndicesBuffer, glUsage);
pgl.bindBuffer(PGL.ELEMENT_ARRAY_BUFFER, 0);
}
@@ -1,7 +1,7 @@
/*
Part of the Processing project - http://processing.org
Copyright (c) 2011-12 Ben Fry and Casey Reas
Copyright (c) 2011-13 Ben Fry and Casey Reas
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -18,14 +18,19 @@
Boston, MA 02111-1307 USA
*/
uniform mat4 transform;
#ifdef GL_ES
precision mediump float;
precision mediump int;
#endif
attribute vec4 vertex;
attribute vec4 color;
uniform sampler2D texture;
uniform vec2 texOffset;
varying vec4 vertColor;
varying vec4 backVertColor;
varying vec4 vertTexCoord;
void main() {
gl_Position = transform * vertex;
vertColor = color;
gl_FragColor = texture2D(texture, vertTexCoord.st) * (gl_FrontFacing ? vertColor : backVertColor);
}
+28 -18
View File
@@ -45,6 +45,7 @@ attribute vec4 emissive;
attribute float shininess;
varying vec4 vertColor;
varying vec4 backVertColor;
varying vec4 vertTexCoord;
const float zero_float = 0.0;
@@ -85,17 +86,17 @@ void main() {
// Normal vector in eye coordinates
vec3 ecNormal = normalize(normalMatrix * normal);
if (dot(-one_float * ecVertex, ecNormal) < zero_float) {
// If normal is away from camera, choose its opposite.
// If we add backface culling, this will be backfacing
ecNormal *= -one_float;
}
vec3 ecNormalInv = ecNormal * -one_float;
// Light calculations
vec3 totalAmbient = vec3(0, 0, 0);
vec3 totalDiffuse = vec3(0, 0, 0);
vec3 totalSpecular = vec3(0, 0, 0);
vec3 totalFrontDiffuse = vec3(0, 0, 0);
vec3 totalFrontSpecular = vec3(0, 0, 0);
vec3 totalBackDiffuse = vec3(0, 0, 0);
vec3 totalBackSpecular = vec3(0, 0, 0);
for (int i = 0; i < 8; i++) {
if (lightCount == i) break;
@@ -121,27 +122,36 @@ void main() {
: one_float;
if (any(greaterThan(lightAmbient[i], zero_vec3))) {
totalAmbient += lightAmbient[i] * falloff;
totalAmbient += lightAmbient[i] * falloff;
}
if (any(greaterThan(lightDiffuse[i], zero_vec3))) {
totalDiffuse += lightDiffuse[i] * falloff * spotf *
lambertFactor(lightDir, ecNormal);
totalFrontDiffuse += lightDiffuse[i] * falloff * spotf *
lambertFactor(lightDir, ecNormal);
totalBackDiffuse += lightDiffuse[i] * falloff * spotf *
lambertFactor(lightDir, ecNormalInv);
}
if (any(greaterThan(lightSpecular[i], zero_vec3))) {
totalSpecular += lightSpecular[i] * falloff * spotf *
blinnPhongFactor(lightDir, ecVertex, ecNormal, shininess);
}
totalFrontSpecular += lightSpecular[i] * falloff * spotf *
blinnPhongFactor(lightDir, ecVertex, ecNormal, shininess);
totalBackSpecular += lightSpecular[i] * falloff * spotf *
blinnPhongFactor(lightDir, ecVertex, ecNormalInv, shininess);
}
}
// Calculating final color as result of all lights (plus emissive term).
// Transparency is determined exclusively by the diffuse component.
vertColor = vec4(totalAmbient, 0) * ambient +
vec4(totalDiffuse, 1) * color +
vec4(totalSpecular, 0) * specular +
vec4(emissive.rgb, 0);
vertColor = vec4(totalAmbient, 0) * ambient +
vec4(totalFrontDiffuse, 1) * color +
vec4(totalFrontSpecular, 0) * specular +
vec4(emissive.rgb, 0);
backVertColor = vec4(totalAmbient, 0) * ambient +
vec4(totalBackDiffuse, 1) * color +
vec4(totalBackSpecular, 0) * specular +
vec4(emissive.rgb, 0);
// Calculating texture coordinates, with r and q set both to one
vertTexCoord = texMatrix * vec4(texCoord, 1.0, 1.0);
}
+95 -39
View File
@@ -1,9 +1,90 @@
0228 core
0229 core (3.0a2)
X PImage resize() causes images to not draw
X https://github.com/processing/processing/issues/2228
X https://github.com/processing/processing/pull/2324
X move to native OS X full screen (gets rid of native code)
X https://github.com/processing/processing/issues/2641
X do bounds check on setVertex(PVector)
X https://github.com/processing/processing/issues/2556
X using createGraphics() w/o begin/endDraw(), don't attempt drawing w/ image()
X https://github.com/processing/processing/issues/2208
data
X add copy() method to Table
X return null from getString() on NaN float and double values
X affects how saveTable() works (writes blank entries instead of NaN)
X get(5) with an empty Int/Float/StringList was returning 0
X https://github.com/processing/processing/pull/2343
o fix for maxValue() and minValue() when all entries are bad
o on FloatDict it was NaN, check across the lists and other dict types
X nothing else to do here
X FloatDict and FloatList should always put NaN values at the end on sort
X same for the other list and dict classes
X (this is part of the point of having these easier versions)
o 'collector' class.. Dict that points to a list
o String as a key, int/float/string list as values
X seems too much like a better place for HashMap
X add print() method to other data types (not just IntList)
pulls
X implement A and a (elliptical arcs)
X https://github.com/processing/processing/issues/169
X http://code.google.com/p/processing/issues/detail?id=130
X https://github.com/processing/processing/pull/2659
X done with an approximation, if re-saving this will destroy data (docs)
X fix typo in StringList.insert()
X https://github.com/processing/processing/pull/2672
X StingList.insert() error (should be an easy fix)
X https://github.com/processing/processing/issues/2548
earlier
X default font fixes (merged for 2.2.1 or earlier)
X https://github.com/processing/processing/issues/2331
X https://github.com/processing/processing/pull/2338
X image resize() takes oddly long time
X https://github.com/processing/processing/issues/5
X the problem was confirmed to have fixed itself
applet/component
_ remove Applet as base class
_ performance issues on OS X (might be threading due to Applet)
_ https://github.com/processing/processing/issues/2423
_ play with improvements to full screen here
_ new full screen sometimes causes sketch to temporarily be in the wrong spot
_ add option to have full screen span across screens
_ display=all in cmd line
_ sketchDisplay() -> 0 for all, or 1, 2, 3...
_ clean up requestFocus() stuff
_ make sure it works with retina/canvas/strategy as well
processing.data
_ need a better method for "missing" data in Table
_ if missing int is zero, can't just remove those values from saving a table
_ but for NaN values, it's a necessity
_ get() methods in List/Dict shouldn't allow you to get bad values
_ but set() methods can automatically resize the arrays
_ though that means insert() should allow you to insert past the end
_ addRow() is not efficient, probably need to do the doubling
o or have a setIncrement() function?
_ it would default to 1 on tables loaded from a file
_ and default to doubling when created with "new Table"
_ row count and array size are combined.. need to break apart
_ match and iterators
_ add match version that returns table that's only a pointer to original
_ save the constructor for the version that actually copies data
_ the table pointer version will be speedy and allow chaining
later
_ bring back chaining in JSON (and add to XML)
_ maybe once we make the PVector change
high
_ pull for image resize and alpha issues
_ https://github.com/processing/processing/pull/2324
_ Closing opengl sketch from the PDE doesn't stop java process on windows
_ https://github.com/processing/processing/issues/2335
_ dataPath() not working when app is not run from app dir on Linux
_ https://github.com/processing/processing/issues/2195
_ "Buffers have not been created" error for sketches w/o draw()
@@ -14,38 +95,21 @@ _ some sort of threading issue happening here
_ https://github.com/processing/processing/issues/1672
_ https://github.com/processing/processing/issues/2039 (dupe)
_ https://github.com/processing/processing/issues/2294 (dupe)
_ also check this out with the new full screen code on OS X
_ point() rendering differently in 2.0.3 and 2.1
_ https://github.com/processing/processing/issues/2278
_ internally, we probably have to call set() if it's a 1 pixel point
_ but that's going to be a mess.. need to first check the CTM
_ tint() not working in PDF (regression between 2.0.3 and 2.1)
_ https://github.com/processing/processing/issues/2428
_ default font fixes
_ https://github.com/processing/processing/issues/2331
_ https://github.com/processing/processing/pull/2338
_ add print() method to other data types (not just IntList)
_ Sort out blending differences with P2D/P3D
_ might be that compatible images not setting alpha mode correctly
_ image = gc.createCompatibleVolatileImage(source.width, source.height, Transparency.TRANSLUCENT);
_ https://github.com/processing/processing/issues/1844
_ 'collector' class.. Dict that points to a list
_ String as a key, int/float/string list as values
_ blendMode(ADD) is broken with default renderer
_ https://github.com/processing/processing/issues/2012
_ may have been introduced between 2.0b7 and 2.0b8
_ https://github.com/processing/processing/issues/2275
_ https://github.com/processing/processing/issues/2276
_ https://github.com/processing/processing/issues/2483
_ add option to have full screen span across screens
_ display=all in cmd line
_ sketchDisplay() -> 0 for all, or 1, 2, 3...
_ clean up requestFocus() stuff
_ make sure it works with retina/canvas/strategy as well
_ finish PFont.getShape() implementation
_ needs to have a way to set width/height properly
_ draw(s) doesn't work on the returned PShape
_ TGA files writing strangely
_ https://github.com/processing/processing/issues/2096
hidpi
_ saveFrame() with retina render is making black images
@@ -56,26 +120,20 @@ _ hint(ENABLE_RETINA_PIXELS) or hint(ENABLE_HIDPI_PIXELS)
_ hint(ENABLE_2X_PIXELS)?
_ hidpi is Apple's name as well
_ no high-res display support for OpenGL
_ https://github.com/processing/processing/issues/2573
_ https://jogamp.org/bugzilla/show_bug.cgi?id=741
_ no high-dpi support for core on Windows
_ https://github.com/processing/processing/issues/2411
_ retina sketches slow to start
_ https://github.com/processing/processing/issues/2357
cantfix
_ crash on startup when "Mirror Displays" selected
_ suspect that this is a specific chipset since Oracle didn't reproduce
_ https://github.com/processing/processing/issues/2186
_ test with JG's 13" retina laptop
table
_ addRow() is not efficient, probably need to do the doubling
_ or have a setIncrement() function?
_ it would default to 1 on tables loaded from a file
_ and default to doubling when created with "new Table"
_ row count and array size are combined.. need to break apart
_ match and iterators
_ add match version that returns table that's only a pointer to original
_ save the constructor for the version that actually copies data
_ the table pointer version will be speedy and allow chaining
decisions/misc
_ make join() work with Iterable?
@@ -173,6 +231,8 @@ _ is this still true?
_ decide how disconnectEvent should actually be handled (and name?)
_ was disconnect always there?
_ will need documentation
_ negative indices so that we can work relative to the end in data classes?
_ add Double and Long versions of the classes?
@@ -313,6 +373,9 @@ _ https://github.com/processing/processing/issues/1727
CORE / PImage
_ TGA files writing strangely
_ https://github.com/processing/processing/issues/2096
_ don't grab pixels of java2d images unless asked
_ this is the difference between a lot of loadPixels() and not
_ so important to have it in before beta if that's the change
@@ -399,8 +462,6 @@ _ for PShape, need to be able to set the origin (flash people)
CORE / PShapeSVG
_ implement A and a (elliptical arcs)
_ http://code.google.com/p/processing/issues/detail?id=130
_ implement support for SVG gradients from Inkscape
_ http://code.google.com/p/processing/issues/detail?id=1142
_ need to handle <!ENTITY tags in XML for SVG documents
@@ -430,13 +491,8 @@ _ https://github.com/processing/processing/issues/1596
CORE / PVector
_ PVector discussion with Dan
_ Jer and Dan will look at their code, plus toxiclibs
_ modify PVector to include better methods for chaining operations
_ http://code.google.com/p/processing/issues/detail?id=218
_ add screen(PVector), model(PVector) and world(PVector)?
_ maybe screenVec()? or screenXYZ()?
_ PVector chaining -> Dan looking into this
CORE / OpenGL (Andres)
+47
View File
@@ -1,3 +1,50 @@
0228 pde (3.0a1)
X increase heap size to 256m (-Xmx256) per Manindra request
X use a ButtonGroup so that the current Mode cannot be de-selected
X https://github.com/processing/processing/issues/2545
earlier
X cpu usage when nothing happening (unmarked duplicate)
X https://github.com/processing/processing/issues/1074
gsoc
X Line coloring incorrect for filtered contribution listings
X https://github.com/processing/processing/issues/2583
X https://github.com/processing/processing/pull/2598
X Added Present's background color as an option to the Preferences window
X https://github.com/processing/processing/pull/2568
X check for updates with contribs
X https://github.com/processing/processing/pull/2636
X shows update manager on startup
X contrib properties files ignored in favor of contributions.txt from p5.org
X https://github.com/processing/processing/issues/2572
X tweak mode integrated
X https://github.com/processing/processing/pull/2624
X wrong mode selected if sketch is modified (checkbox changes)
X https://github.com/processing/processing/issues/2615
X https://github.com/processing/processing/issues/2586
X Add date and time stamps to the Contribution Manager
X https://github.com/processing/processing/pull/2651
pulls
X Implementation of a list of open sketches in the Sketch menu
X https://github.com/processing/processing/pull/2551
X color selector for the pref (not reading it properly)
X https://github.com/processing/processing/pull/2568
X lighting issues with non-planar triangle strips or quad strips
X https://github.com/processing/processing/issues/2014
X https://github.com/processing/processing/issues/2018
X https://github.com/processing/processing/pull/2644
X set application name on Linux
X https://github.com/processing/processing/issues/2534
X https://github.com/processing/processing/pull/2584
X serial not working on export
X https://github.com/processing/processing/issues/2559
X build error on Windows
X https://github.com/processing/processing/issues/2603
X https://github.com/processing/processing/pull/2610
0227 pde (2.2.1)
X use mouseReleased() instead of mousePressed() in color selector
X otherwise it registers the release as a click in the color window
@@ -1,51 +0,0 @@
/**
* Array.
*
* An array is a list of data. Each piece of data in an array
* is identified by an index number representing its position in
* the array. Arrays are zero based, which means that the first
* element in the array is [0], the second element is [1], and so on.
* In this example, an array named "coswav" is created and
* filled with the cosine values. This data is displayed three
* separate ways on the screen.
*/
float[] coswave;
void setup() {
size(640, 360);
coswave = new float[width];
for (int i = 0; i < width; i++) {
float amount = map(i, 0, width, 0, PI);
coswave[i] = abs(cos(amount));
}
background(255);
noLoop();
}
void draw() {
int y1 = 0;
int y2 = height/3;
for (int i = 0; i < width; i+=2) {
stroke(coswave[i]*255);
line(i, y1, i, y2);
}
y1 = y2;
y2 = y1 + y1;
for (int i = 0; i < width; i+=2) {
stroke(coswave[i]*255 / 4);
line(i, y1, i, y2);
}
y1 = y2;
y2 = height;
for (int i = 0; i < width; i+=2) {
stroke(255 - coswave[i]*255);
line(i, y1, i, y2);
}
}
@@ -1,43 +0,0 @@
/**
* Array 2D.
*
* Demonstrates the syntax for creating a two-dimensional (2D) array.
* Values in a 2D array are accessed through two index values.
* 2D arrays are useful for storing images. In this example, each dot
* is colored in relation to its distance from the center of the image.
*/
float[][] distances;
float maxDistance;
int spacer;
void setup() {
size(640, 360);
maxDistance = dist(width/2, height/2, width, height);
distances = new float[width][height];
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
float distance = dist(width/2, height/2, x, y);
distances[x][y] = distance/maxDistance * 255;
}
}
spacer = 10;
noLoop(); // Run once and stop
}
void draw() {
background(0);
// This embedded loop skips over values in the arrays based on
// the spacer variable, so there are more values in the array
// than are drawn here. Change the value of the spacer variable
// to change the density of the points
for (int y = 0; y < height; y += spacer) {
for (int x = 0; x < width; x += spacer) {
stroke(distances[x][y]);
point(x + spacer/2, y + spacer/2);
}
}
}
@@ -1,34 +0,0 @@
/**
* Array Objects.
*
* Demonstrates the syntax for creating an array of custom objects.
*/
int unit = 40;
int count;
Module[] mods;
void setup() {
size(640, 360);
noStroke();
int wideCount = width / unit;
int highCount = height / unit;
count = wideCount * highCount;
mods = new Module[count];
int index = 0;
for (int y = 0; y < highCount; y++) {
for (int x = 0; x < wideCount; x++) {
mods[index++] = new Module(x*unit, y*unit, unit/2, unit/2, random(0.05, 0.8), unit);
}
}
}
void draw() {
background(0);
for (int i = 0; i < count; i++) {
mods[i].update();
mods[i].draw();
}
}
@@ -1,39 +0,0 @@
class Module {
int xOffset;
int yOffset;
float x, y;
int unit;
int xDirection = 1;
int yDirection = 1;
float speed;
// Contructor
Module(int xOffsetTemp, int yOffsetTemp, int xTemp, int yTemp, float speedTemp, int tempUnit) {
xOffset = xOffsetTemp;
yOffset = yOffsetTemp;
x = xTemp;
y = yTemp;
speed = speedTemp;
unit = tempUnit;
}
// Custom method for updating the variables
void update() {
x = x + (speed * xDirection);
if (x >= unit || x <= 0) {
xDirection *= -1;
x = x + (1 * xDirection);
y = y + (1 * yDirection);
}
if (y >= unit || y <= 0) {
yDirection *= -1;
y = y + (1 * yDirection);
}
}
// Custom method for drawing the object
void draw() {
fill(255);
ellipse(xOffset + x, yOffset + y, 6, 6);
}
}
@@ -1,28 +0,0 @@
/**
* Move Eye.
* by Simon Greenwold.
*
* The camera lifts up (controlled by mouseY) while looking at the same point.
*/
void setup() {
size(640, 360, P3D);
fill(204);
}
void draw() {
lights();
background(0);
// Change height of the camera with mouseY
camera(30.0, mouseY, 220.0, // eyeX, eyeY, eyeZ
0.0, 0.0, 0.0, // centerX, centerY, centerZ
0.0, 1.0, 0.0); // upX, upY, upZ
noStroke();
box(90);
stroke(255);
line(-100, 0, 0, 100, 0, 0);
line(0, -100, 0, 0, 100, 0);
line(0, 0, -100, 0, 0, 100);
}
@@ -1,40 +0,0 @@
/**
* Perspective vs. Ortho
*
* Move the mouse left to right to change the "far"
* parameter for the perspective() and ortho() functions.
* This parameter sets the maximum distance from the
* origin away from the viewer and will clip the geometry.
* Click a mouse button to switch between the perspective and
* orthographic projections.
*/
boolean showPerspective = false;
void setup() {
size(600, 360, P3D);
noFill();
fill(255);
noStroke();
}
void draw() {
lights();
background(0);
float far = map(mouseX, 0, width, 120, 400);
if (showPerspective == true) {
perspective(PI/3.0, float(width)/float(height), 10, far);
} else {
ortho(0, width, 0, height, 10, far);
}
translate(width/2, height/2, 0);
rotateX(-PI/6);
rotateY(PI/3);
box(180);
}
void mousePressed() {
showPerspective = !showPerspective;
}
@@ -1,41 +0,0 @@
/**
* Perspective.
*
* Move the mouse left and right to change the field of view (fov).
* Click to modify the aspect ratio. The perspective() function
* sets a perspective projection applying foreshortening, making
* distant objects appear smaller than closer ones. The parameters
* define a viewing volume with the shape of truncated pyramid.
* Objects near to the front of the volume appear their actual size,
* while farther objects appear smaller. This projection simulates
* the perspective of the world more accurately than orthographic projection.
* The version of perspective without parameters sets the default
* perspective and the version with four parameters allows the programmer
* to set the area precisely.
*/
void setup() {
size(640, 360, P3D);
noStroke();
}
void draw() {
lights();
background(204);
float cameraY = height/2.0;
float fov = mouseX/float(width) * PI/2;
float cameraZ = cameraY / tan(fov / 2.0);
float aspect = float(width)/float(height);
if (mousePressed) {
aspect = aspect / 2.0;
}
perspective(fov, aspect, cameraZ/10.0, cameraZ*10.0);
translate(width/2+30, height/2, 0);
rotateX(-PI/6);
rotateY(PI/3 + mouseY/float(height) * PI);
box(45);
translate(0, 0, -50);
box(30);
}
@@ -1,27 +0,0 @@
/**
* Brightness
* by Rusty Robison.
*
* Brightness is the relative lightness or darkness of a color.
* Move the cursor vertically over each bar to alter its brightness.
*/
int barWidth = 20;
int lastBar = -1;
void setup() {
size(640, 360);
colorMode(HSB, width, 100, width);
noStroke();
background(0);
}
void draw() {
int whichBar = mouseX / barWidth;
if (whichBar != lastBar) {
int barX = whichBar * barWidth;
fill(barX, 100, mouseY);
rect(barX, 0, barWidth, height);
lastBar = whichBar;
}
}
@@ -1,40 +0,0 @@
/**
* Color Variables (Homage to Albers).
*
* This example creates variables for colors that may be referred to
* in the program by a name, rather than a number.
*/
size(640, 360);
noStroke();
background(51, 0, 0);
color inside = color(204, 102, 0);
color middle = color(204, 153, 0);
color outside = color(153, 51, 0);
// These statements are equivalent to the statements above.
// Programmers may use the format they prefer.
//color inside = #CC6600;
//color middle = #CC9900;
//color outside = #993300;
pushMatrix();
translate(80, 80);
fill(outside);
rect(0, 0, 200, 200);
fill(middle);
rect(40, 60, 120, 120);
fill(inside);
rect(60, 90, 80, 80);
popMatrix();
pushMatrix();
translate(360, 80);
fill(inside);
rect(0, 0, 200, 200);
fill(outside);
rect(40, 60, 120, 120);
fill(middle);
rect(60, 90, 80, 80);
popMatrix();
-30
View File
@@ -1,30 +0,0 @@
/**
* Hue.
*
* Hue is the color reflected from or transmitted through an object
* and is typically referred to as the name of the color (red, blue, yellow, etc.)
* Move the cursor vertically over each bar to alter its hue.
*/
int barWidth = 20;
int lastBar = -1;
void setup()
{
size(640, 360);
colorMode(HSB, height, height, height);
noStroke();
background(0);
}
void draw()
{
int whichBar = mouseX / barWidth;
if (whichBar != lastBar) {
int barX = whichBar * barWidth;
fill(mouseY, height, height);
rect(barX, 0, barWidth, height);
lastBar = whichBar;
}
}
@@ -1,55 +0,0 @@
/**
* Simple Linear Gradient
*
* The lerpColor() function is useful for interpolating
* between two colors.
*/
// Constants
int Y_AXIS = 1;
int X_AXIS = 2;
color b1, b2, c1, c2;
void setup() {
size(640, 360);
// Define colors
b1 = color(255);
b2 = color(0);
c1 = color(204, 102, 0);
c2 = color(0, 102, 153);
noLoop();
}
void draw() {
// Background
setGradient(0, 0, width/2, height, b1, b2, X_AXIS);
setGradient(width/2, 0, width/2, height, b2, b1, X_AXIS);
// Foreground
setGradient(50, 90, 540, 80, c1, c2, Y_AXIS);
setGradient(50, 190, 540, 80, c2, c1, X_AXIS);
}
void setGradient(int x, int y, float w, float h, color c1, color c2, int axis ) {
noFill();
if (axis == Y_AXIS) { // Top to bottom gradient
for (int i = y; i <= y+h; i++) {
float inter = map(i, y, y+h, 0, 1);
color c = lerpColor(c1, c2, inter);
stroke(c);
line(x, i, x+w, i);
}
}
else if (axis == X_AXIS) { // Left to right gradient
for (int i = x; i <= x+w; i++) {
float inter = map(i, x, x+w, 0, 1);
color c = lerpColor(c1, c2, inter);
stroke(c);
line(i, y, i, y+h);
}
}
}
@@ -1,36 +0,0 @@
/**
* Radial Gradient.
*
* Draws are series of concentric circles to create a gradient
* from one color to another.
*/
int dim;
void setup() {
size(640, 360);
dim = width/2;
background(0);
colorMode(HSB, 360, 100, 100);
noStroke();
ellipseMode(RADIUS);
frameRate(1);
}
void draw() {
background(0);
for (int x = 0; x <= width; x+=dim) {
drawGradient(x, height/2);
}
}
void drawGradient(float x, float y) {
int radius = dim/2;
float h = random(0, 360);
for (int r = radius; r > 0; --r) {
fill(h, 90, 90);
ellipse(x, y, r, r);
h = (h + 1) % 360;
}
}
@@ -1,42 +0,0 @@
/**
* Relativity.
*
* Each color is perceived in relation to other colors. The top and bottom
* bars each contain the same component colors, but a different display order
* causes individual colors to appear differently.
*/
color a, b, c, d, e;
void setup() {
size(640, 360);
noStroke();
a = color(165, 167, 20);
b = color(77, 86, 59);
c = color(42, 106, 105);
d = color(165, 89, 20);
e = color(146, 150, 127);
noLoop(); // Draw only one time
}
void draw() {
drawBand(a, b, c, d, e, 0, width/128);
drawBand(c, a, d, b, e, height/2, width/128);
}
void drawBand(color v, color w, color x, color y, color z, int ypos, int barWidth) {
int num = 5;
color[] colorOrder = { v, w, x, y, z };
for(int i = 0; i < width; i += barWidth*num) {
for(int j = 0; j < num; j++) {
fill(colorOrder[j]);
rect(i+j*barWidth, ypos, barWidth, height/2);
}
}
}
@@ -1,29 +0,0 @@
/**
* Saturation.
*
* Saturation is the strength or purity of the color and represents the
* amount of gray in proportion to the hue. A "saturated" color is pure
* and an "unsaturated" color has a large percentage of gray.
* Move the cursor vertically over each bar to alter its saturation.
*/
int barWidth = 20;
int lastBar = -1;
void setup() {
size(640, 360);
colorMode(HSB, width, height, 100);
noStroke();
}
void draw() {
int whichBar = mouseX / barWidth;
if (whichBar != lastBar) {
int barX = whichBar * barWidth;
fill(barX, mouseY, 66);
rect(barX, 0, barWidth, height);
lastBar = whichBar;
}
}
@@ -1,39 +0,0 @@
/**
* Wave Gradient
* by Ira Greenberg.
*
* Generate a gradient along a sin() wave.
*/
float angle = 0;
float px = 0, py = 0;
float amplitude = 30;
float frequency = 0;
float fillGap = 2.5;
color c;
void setup() {
size(640, 360);
background(200);
noLoop();
}
void draw() {
for (int i =- 75; i < height+75; i++){
// Reset angle to 0, so waves stack properly
angle = 0;
// Increasing frequency causes more gaps
frequency+=.002;
for (float j = 0; j < width+75; j++){
py = i + sin(radians(angle)) * amplitude;
angle += frequency;
c = color(abs(py-i)*255/amplitude, 255-abs(py-i)*255/amplitude, j*(255.0/(width+50)));
// Hack to fill gaps. Raise value of fillGap if you increase frequency
for (int filler = 0; filler < fillGap; filler++){
set(int(j-filler), int(py)-filler, c);
set(int(j), int(py), c);
set(int(j+filler), int(py)+filler, c);
}
}
}
}
@@ -1,26 +0,0 @@
/**
* Conditionals 1.
*
* Conditions are like questions.
* They allow a program to decide to take one action if
* the answer to a question is true or to do another action
* if the answer to the question is false.
* The questions asked within a program are always logical
* or relational statements. For example, if the variable 'i' is
* equal to zero then draw a line.
*/
size(640, 360);
background(0);
for(int i = 10; i < width; i += 10) {
// If 'i' divides by 20 with no remainder draw the first line
// else draw the second line
if(i%20 == 0) {
stroke(255);
line(i, 80, i, height/2);
} else {
stroke(153);
line(i, 20, i, 180);
}
}
@@ -1,28 +0,0 @@
/**
* Conditionals 2.
*
* We extend the language of conditionals from the previous
* example by adding the keyword "else". This allows conditionals
* to ask two or more sequential questions, each with a different
* action.
*/
size(640, 360);
background(0);
for(int i = 2; i < width-2; i += 2) {
// If 'i' divides by 20 with no remainder
if((i % 20) == 0) {
stroke(255);
line(i, 80, i, height/2);
// If 'i' divides by 10 with no remainder
} else if ((i % 10) == 0) {
stroke(153);
line(i, 20, i, 180);
// If neither of the above two conditions are met
// then draw this line
} else {
stroke(102);
line(i, height/2, i, height-20);
}
}
@@ -1,24 +0,0 @@
/**
* Embedding Iteration.
*
* Embedding "for" structures allows repetition in two dimensions.
*
*/
size(640, 360);
background(0);
noStroke();
int gridSize = 40;
for (int x = gridSize; x <= width - gridSize; x += gridSize) {
for (int y = gridSize; y <= height - gridSize; y += gridSize) {
noStroke();
fill(255);
rect(x-1, y-1, 3, 3);
stroke(255, 50);
line(x, y, width/2, height/2);
}
}
@@ -1,41 +0,0 @@
/**
* Iteration.
*
* Iteration with a "for" structure to construct repetitive forms.
*/
int y;
int num = 14;
size(640, 360);
background(102);
noStroke();
// Draw gray bars
fill(255);
y = 60;
for(int i = 0; i < num/3; i++) {
rect(50, y, 475, 10);
y+=20;
}
// Gray bars
fill(51);
y = 40;
for(int i = 0; i < num; i++) {
rect(405, y, 30, 10);
y += 20;
}
y = 50;
for(int i = 0; i < num; i++) {
rect(425, y, 30, 10);
y += 20;
}
// Thin lines
y = 45;
fill(0);
for(int i = 0; i < num-1; i++) {
rect(120, y, 40, 1);
y+= 20;
}
@@ -1,45 +0,0 @@
/**
* Logical Operators.
*
* The logical operators for AND (&&) and OR (||) are used to
* combine simple relational statements into more complex expressions.
* The NOT (!) operator is used to negate a boolean statement.
*/
size(640, 360);
background(126);
boolean test = false;
for (int i = 5; i <= height; i += 5) {
// Logical AND
stroke(0);
if((i > 35) && (i < 100)) {
line(width/4, i, width/2, i);
test = false;
}
// Logical OR
stroke(76);
if ((i <= 35) || (i >= 100)) {
line(width/2, i, width, i);
test = true;
}
// Testing if a boolean value is "true"
// The expression "if(test)" is equivalent to "if(test == true)"
if (test) {
stroke(0);
point(width/3, i);
}
// Testing if a boolean value is "false"
// The expression "if(!test)" is equivalent to "if(test == false)"
if (!test) {
stroke(255);
point(width/4, i);
}
}
@@ -1,53 +0,0 @@
/**
* Characters Strings.
*
* The character datatype, abbreviated as char, stores letters and
* symbols in the Unicode format, a coding system developed to support
* a variety of world languages. Characters are distinguished from other
* symbols by putting them between single quotes ('P').<br />
* <br />
* A string is a sequence of characters. A string is noted by surrounding
* a group of letters with double quotes ("Processing").
* Chars and strings are most often used with the keyboard methods,
* to display text to the screen, and to load images or files.<br />
* <br />
* The String datatype must be capitalized because it is a complex datatype.
* A String is actually a class with its own methods, some of which are
* featured below.
*/
// The next line is needed if running in JavaScript Mode with Processing.js
/* @pjs font="Georgia.ttf"; */
char letter;
String words = "Begin...";
void setup() {
size(640, 360);
// Create the font
textFont(createFont("Georgia", 36));
}
void draw() {
background(0); // Set background to black
// Draw the letter to the center of the screen
textSize(14);
text("Click on the program, then type to add to the String", 50, 50);
text("Current key: " + letter, 50, 70);
text("The String is " + words.length() + " characters long", 50, 90);
textSize(36);
text(words, 50, 120, 540, 300);
}
void keyPressed() {
// The variable "key" always contains the value
// of the most recent key pressed.
if ((key >= 'A' && key <= 'z') || key == ' ') {
letter = key;
words = words + key;
// Write the letter to the console
println(key);
}
}
@@ -1,36 +0,0 @@
/**
* Datatype Conversion.
*
* It is sometimes beneficial to convert a value from one type of
* data to another. Each of the conversion functions converts its parameter
* to an equivalent representation within its datatype.
* The conversion functions include int(), float(), char(), byte(), and others.
*/
// The next line is needed if running in JavaScript Mode with Processing.js
/* @pjs font="Georgia.ttf"; */
size(640, 360);
background(0);
noStroke();
textFont(createFont("Georgia",24));
char c; // Chars are used for storing alphanumeric symbols
float f; // Floats are decimal numbers
int i; // Integers are values between 2,147,483,647 and -2147483648
byte b; // Bytes are values between -128 and 128
c = 'A';
f = float(c); // Sets f = 65.0
i = int(f * 1.4); // Sets i to 91
b = byte(c / 2); // Sets b to 32
//println(f);
//println(i);
//println(b);
text("The value of variable c is " + c, 50, 100);
text("The value of variable f is " + f, 50, 150);
text("The value of variable i is " + i, 50, 200);
text("The value of variable b is " + b, 50, 250);
@@ -1,34 +0,0 @@
/**
* Integers Floats.
*
* Integers and floats are two different kinds of numerical data.
* An integer (more commonly called an int) is a number without
* a decimal point. A float is a floating-point number, which means
* it is a number that has a decimal place. Floats are used when
* more precision is needed.
*/
int a = 0; // Create a variable "a" of the datatype "int"
float b = 0.0; // Create a variable "b" of the datatype "float"
void setup() {
size(640, 360);
stroke(255);
frameRate(30);
}
void draw() {
background(0);
a = a + 1;
b = b + 0.2;
line(a, 0, a, height/2);
line(b, height/2, b, height);
if(a > width) {
a = 0;
}
if(b > width) {
b = 0;
}
}
@@ -1,37 +0,0 @@
/**
* True/False.
*
* A Boolean variable has only two possible values: true or false.
* It is common to use Booleans with control statements to
* determine the flow of a program. In this example, when the
* boolean value "x" is true, vertical black lines are drawn and when
* the boolean value "x" is false, horizontal gray lines are drawn.
*/
boolean b = false;
size(640, 360);
background(0);
stroke(255);
int d = 20;
int middle = width/2;;
for (int i = d; i <= width; i += d) {
if (i < middle) {
b = true;
} else {
b = false;
}
if (b == true) {
// Vertical line
line(i, d, i, height-d);
}
if (b == false) {
// Horizontal line
line(middle, i - middle + d, width-d, i - middle + d);
}
}
@@ -1,57 +0,0 @@
/**
* Variable Scope.
*
* Variables have a global or local "scope".
* For example, variables declared within either the
* setup() or draw() functions may be only used in these
* functions. Global variables, variables declared outside
* of setup() and draw(), may be used anywhere within the program.
* If a local variable is declared with the same name as a
* global variable, the program will use the local variable to make
* its calculations within the current scope. Variables are localized
* within each block, the space between a { and }.
*/
int a = 80; // Create a global variable "a"
void setup() {
size(640, 360);
background(0);
stroke(255);
noLoop();
}
void draw() {
// Draw a line using the global variable "a"
line(a, 0, a, height);
// Create a new variable "a" local to the for() statement
for (int a = 120; a < 200; a += 2) {
line(a, 0, a, height);
}
// Create a new variable "a" local to the draw() function
int a = 300;
// Draw a line using the new local variable "a"
line(a, 0, a, height);
// Make a call to the custom function drawAnotherLine()
drawAnotherLine();
// Make a call to the custom function setYetAnotherLine()
drawYetAnotherLine();
}
void drawAnotherLine() {
// Create a new variable "a" local to this method
int a = 320;
// Draw a line using the local variable "a"
line(a, 0, a, height);
}
void drawYetAnotherLine() {
// Because no new local variable "a" is set,
// this lines draws using the original global
// variable "a" which is set to the value 20.
line(a+2, 0, a+2, height);
}
@@ -1,40 +0,0 @@
/**
* Variables.
*
* Variables are used for storing values. In this example, change
* the values of variables to affect the composition.
*/
size(640, 360);
background(0);
stroke(153);
strokeWeight(4);
strokeCap(SQUARE);
int a = 50;
int b = 120;
int c = 180;
line(a, b, a+c, b);
line(a, b+10, a+c, b+10);
line(a, b+20, a+c, b+20);
line(a, b+30, a+c, b+30);
a = a + c;
b = height-b;
line(a, b, a+c, b);
line(a, b+10, a+c, b+10);
line(a, b+20, a+c, b+20);
line(a, b+30, a+c, b+30);
a = a + c;
b = height-b;
line(a, b, a+c, b);
line(a, b+10, a+c, b+10);
line(a, b+20, a+c, b+20);
line(a, b+30, a+c, b+30);
@@ -1,22 +0,0 @@
/**
* Bezier.
*
* The first two parameters for the bezier() function specify the
* first point in the curve and the last two parameters specify
* the last point. The middle parameters set the control points
* that define the shape of the curve.
*/
void setup() {
size(640, 360);
stroke(255);
noFill();
}
void draw() {
background(0);
for (int i = 0; i < 200; i += 20) {
bezier(mouseX-(i/2.0), 40+i, 410, 20, 440, 300, 240-(i/16.0), 300+(i/8.0));
}
}
@@ -1,30 +0,0 @@
/**
* Pie Chart
*
* Uses the arc() function to generate a pie chart from the data
* stored in an array.
*/
int[] angles = { 30, 10, 45, 35, 60, 38, 75, 67 };
void setup() {
size(640, 360);
noStroke();
noLoop(); // Run once and stop
}
void draw() {
background(100);
pieChart(300, angles);
}
void pieChart(float diameter, int[] data) {
float lastAngle = 0;
for (int i = 0; i < data.length; i++) {
float gray = map(i, 0, data.length, 0, 255);
fill(gray);
arc(width/2, height/2, diameter, diameter, lastAngle, lastAngle+radians(angles[i]));
lastAngle += radians(angles[i]);
}
}
@@ -1,34 +0,0 @@
/**
* Points and Lines.
*
* Points and lines can be used to draw basic geometry.
* Change the value of the variable 'd' to scale the form.
* The four variables set the positions based on the value of 'd'.
*/
int d = 70;
int p1 = d;
int p2 = p1+d;
int p3 = p2+d;
int p4 = p3+d;
size(640, 360);
noSmooth();
background(0);
translate(140, 0);
// Draw gray box
stroke(153);
line(p3, p3, p2, p3);
line(p2, p3, p2, p2);
line(p2, p2, p3, p2);
line(p3, p2, p3, p3);
// Draw white points
stroke(255);
point(p1, p1);
point(p1, p3);
point(p2, p4);
point(p3, p1);
point(p4, p2);
point(p4, p4);
@@ -1,30 +0,0 @@
/**
* Primitives 3D.
*
* Placing mathematically 3D objects in synthetic space.
* The lights() method reveals their imagined dimension.
* The box() and sphere() functions each have one parameter
* which is used to specify their size. These shapes are
* positioned using the translate() function.
*/
size(640, 360, P3D);
background(0);
lights();
noStroke();
pushMatrix();
translate(130, height/2, 0);
rotateY(1.25);
rotateX(-0.4);
box(100);
popMatrix();
noFill();
stroke(255);
pushMatrix();
translate(500, height*0.35, -200);
sphere(280);
popMatrix();
@@ -1,46 +0,0 @@
/**
* Regular Polygon
*
* What is your favorite? Pentagon? Hexagon? Heptagon?
* No? What about the icosagon? The polygon() function
* created for this example is capable of drawing any
* regular polygon. Try placing different numbers into the
* polygon() function calls within draw() to explore.
*/
void setup() {
size(640, 360);
}
void draw() {
background(102);
pushMatrix();
translate(width*0.2, height*0.5);
rotate(frameCount / 200.0);
polygon(0, 0, 82, 3);
popMatrix();
pushMatrix();
translate(width*0.5, height*0.5);
rotate(frameCount / 50.0);
polygon(0, 0, 80, 20);
popMatrix();
pushMatrix();
translate(width*0.8, height*0.5);
rotate(frameCount / -100.0);
polygon(0, 0, 70, 7);
popMatrix();
}
void polygon(float x, float y, float radius, int npoints) {
float angle = TWO_PI / npoints;
beginShape();
for (float a = 0; a < TWO_PI; a += angle) {
float sx = x + cos(a) * radius;
float sy = y + sin(a) * radius;
vertex(sx, sy);
}
endShape(CLOSE);
}
@@ -1,32 +0,0 @@
/**
* Shape Primitives.
*
* The basic shape primitive functions are triangle(),
* rect(), quad(), ellipse(), and arc(). Squares are made
* with rect() and circles are made with ellipse(). Each
* of these functions requires a number of parameters to
* determine the shape's position and size.
*/
size(640, 360);
background(0);
noStroke();
fill(204);
triangle(18, 18, 18, 360, 81, 360);
fill(102);
rect(81, 81, 63, 63);
fill(204);
quad(189, 18, 216, 18, 216, 360, 144, 360);
fill(255);
ellipse(252, 144, 72, 72);
fill(204);
triangle(288, 18, 351, 360, 288, 360);
fill(255);
arc(479, 300, 280, 280, PI, TWO_PI);
-48
View File
@@ -1,48 +0,0 @@
/**
* Star
*
* The star() function created for this example is capable of drawing a
* wide range of different forms. Try placing different numbers into the
* star() function calls within draw() to explore.
*/
void setup() {
size(640, 360);
}
void draw() {
background(102);
pushMatrix();
translate(width*0.2, height*0.5);
rotate(frameCount / 200.0);
star(0, 0, 5, 70, 3);
popMatrix();
pushMatrix();
translate(width*0.5, height*0.5);
rotate(frameCount / 50.0);
star(0, 0, 80, 100, 40);
popMatrix();
pushMatrix();
translate(width*0.8, height*0.5);
rotate(frameCount / -100.0);
star(0, 0, 30, 70, 5);
popMatrix();
}
void star(float x, float y, float radius1, float radius2, int npoints) {
float angle = TWO_PI / npoints;
float halfAngle = angle/2.0;
beginShape();
for (float a = 0; a < TWO_PI; a += angle) {
float sx = x + cos(a) * radius2;
float sy = y + sin(a) * radius2;
vertex(sx, sy);
sx = x + cos(a+halfAngle) * radius1;
sy = y + sin(a+halfAngle) * radius1;
vertex(sx, sy);
}
endShape(CLOSE);
}
@@ -1,42 +0,0 @@
/**
* Triangle Strip
* by Ira Greenberg.
*
* Generate a closed ring using the vertex() function and
* beginShape(TRIANGLE_STRIP) mode. The outsideRadius and insideRadius
* variables control ring's radii respectively.
*/
int x;
int y;
float outsideRadius = 150;
float insideRadius = 100;
void setup() {
size(640, 360);
background(204);
x = width/2;
y = height/2;
}
void draw() {
background(204);
int numPoints = int(map(mouseX, 0, width, 6, 60));
float angle = 0;
float angleStep = 180.0/numPoints;
beginShape(TRIANGLE_STRIP);
for (int i = 0; i <= numPoints; i++) {
float px = x + cos(radians(angle)) * outsideRadius;
float py = y + sin(radians(angle)) * outsideRadius;
angle += angleStep;
vertex(px, py);
px = x + cos(radians(angle)) * insideRadius;
py = y + sin(radians(angle)) * insideRadius;
vertex(px, py);
angle += angleStep;
}
endShape();
}

Some files were not shown because too many files have changed in this diff Show More